-
Notifications
You must be signed in to change notification settings - Fork 1
Fix chat prototype build #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
784254a
Seng/chat prototype (#279)
afterrburn 65170ce
remove unused component
9bb5dd6
gracefully return empty array when tutorial does not exist
104fef1
cleanup agent-docs readme and bun
4d3828f
move agent IDs to config since they are not secrets
36d12c0
update agent url configs
66c9233
fix config issue
9b61379
fix env
67225dc
Merge branch 'main' into fix-chat-prototype-build
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
### Rule: tutorials-structure | ||
|
||
Purpose: Define how tutorials are authored and rendered so docs and runnable code stay in sync. | ||
|
||
### Structure | ||
- Narrative pages: `content/Tutorial/<tutorial-id>/step-<n>.mdx` | ||
- Section navigation: `content/Tutorial/meta.json` (list MDX page slugs in order) | ||
- Runnable example project: `examples/<tutorial-id>/` (full project; exclude `node_modules/`, `.uv/`) | ||
- Tutorial code snippets: must be imported from files via `<CodeFromFiles />` | ||
- Other, non-project examples: use regular fenced code blocks in MDX | ||
|
||
### MDX authoring | ||
- Each step MDX must use frontmatter: | ||
- `title`, `description` (recommended: `stepNumber`, `next`, `prev`) | ||
- Import real code from the example project using repo-root-relative paths via `<CodeFromFiles />`: | ||
|
||
```mdx | ||
--- | ||
title: Step 1 — Getting Started | ||
description: Intro step | ||
--- | ||
|
||
<!-- Single snippet --> | ||
<CodeFromFiles snippets={[{ path: "/examples/javascript-sdk/src/agent.ts", lang: "ts", title: "agent.ts" }]} /> | ||
|
||
<!-- Line range --> | ||
<CodeFromFiles snippets={[{ path: "/examples/javascript-sdk/src/agent.ts", lang: "ts", from: 12, to: 48, title: "Handler section" }]} /> | ||
|
||
<!-- Multi-language tabs --> | ||
<CodeFromFiles snippets={[ | ||
{ path: "/examples/javascript-sdk/src/agent.ts", lang: "ts", title: "TypeScript" }, | ||
{ path: "/examples/javascript-sdk-python/src/agent.py", lang: "python", title: "Python" }, | ||
]} title="Agent comparison" /> | ||
``` | ||
|
||
### `<CodeFromFiles />` component | ||
- Available in MDX via the docs page components map | ||
- Props: | ||
- `snippets`: array of `{ path, lang?, from?, to?, title? }` | ||
- `path`: repo-root-relative (must start with `/`), validated and read server-side | ||
- `lang`: language for highlighting (auto-inferred if omitted) | ||
- `from`, `to`: 1-based line range (inclusive) | ||
- `title`: label per tab | ||
- `title` (optional): heading displayed above the tabs | ||
- Renders using shared `CodeBlock` styling and `Tabs` for multiple snippets | ||
|
||
### Example project conventions (`examples/<tutorial-id>/`) | ||
- Include: `package.json`, `tsconfig.json`, `src/**`, optional `README.md`, optional lockfile | ||
- Exclude: `node_modules/` | ||
- Optional hygiene: | ||
- Add `examples/**` to `.eslintignore` if you don’t want repo-wide linting on example sources | ||
- Add `examples/**` to root `tsconfig.json` `exclude` if you don’t want repo-wide type-checks | ||
- Should be runnable in a sandbox (StackBlitz/CodeSandbox) via `package.json` scripts | ||
|
||
### Rendering pipeline | ||
- Fumadocs loads MDX via `lib/source.ts` and `app/(docs)/[[...slug]]/page.tsx` | ||
- `<CodeFromFiles />` reads files at build/server time and renders with `CodeBlock` | ||
|
||
|
||
### Agent compatibility (optional) | ||
- Step API: `GET /api/tutorials/:id/steps/:stepNumber` returns `{ mdx, snippets }`. | ||
- The chat UI replaces each `<CodeFromFiles />` occurrence with one or more fenced code blocks by consuming entries from `snippets` in order. | ||
|
||
### Quality gates (recommended) | ||
- CI verifies: | ||
- All `content/Tutorial/**.mdx` pages referenced by `content/Tutorial/meta.json` build without errors | ||
- All `<CodeFromFiles snippets={[...]}/>` references resolve to existing files | ||
- Optional: the example project type-checks (`tsc --noEmit`) or passes a smoke test | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# Agent Configuration | ||
AGENT_BASE_URL=http://127.0.0.1:3500 | ||
AGENT_ID=agent_9ccc5545e93644bd9d7954e632a55a61 | ||
|
||
# Alternative: You can also set the full URL instead of BASE_URL + ID | ||
# AGENT_FULL_URL=http://127.0.0.1:3500/agent_9ccc5545e93644bd9d7954e632a55a61 | ||
# API key can be found in agent-docs .env AGENTUITY_SDK_KEY | ||
AGENTUITY_API_KEY= | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ yarn-error.log* | |
.env*.local | ||
.env.local | ||
.env.production | ||
.env | ||
.vercel | ||
next-env.d.ts | ||
.open-next | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align auth var name with runtime (AGENT_BEARER_TOKEN) or support alias.
env.ts reads AGENT_BEARER_TOKEN; this sample introduces AGENTUITY_API_KEY. Either update env.ts to accept AGENTUITY_API_KEY as an alias (recommended; see my env.ts diff) or change the sample to AGENT_BEARER_TOKEN to avoid 401s. Also add a trailing newline to satisfy dotenv-linter.
Recommended sample tweak:
📝 Committable suggestion
🧰 Tools
🪛 dotenv-linter (3.3.0)
[warning] 5-5: [EndingBlankLine] No blank line at the end of the file
(EndingBlankLine)
🤖 Prompt for AI Agents