-
Notifications
You must be signed in to change notification settings - Fork 1
Update explorer #697
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
base: main
Are you sure you want to change the base?
Update explorer #697
Conversation
Resolved conflicts: - apps/docs/src/web/App.tsx: kept our version (CODE_EXAMPLES in separate file) - apps/docs/src/web/code-examples.ts: updated to use new c.waitUntil() API - bun.lock: regenerated Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds a cloud sandbox SSE execution system for live demo scripts, a centralized sandbox scripts registry, many standalone run scripts, updated agent creation examples to Changes
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📦 Canary Packages Publishedversion: PackagesInstallAdd to your {
"dependencies": {
"@agentuity/evals": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-evals-0.1.28-dc7b52d.tgz",
"@agentuity/react": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-react-0.1.28-dc7b52d.tgz",
"@agentuity/workbench": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-workbench-0.1.28-dc7b52d.tgz",
"@agentuity/core": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-core-0.1.28-dc7b52d.tgz",
"@agentuity/cli": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-cli-0.1.28-dc7b52d.tgz",
"@agentuity/auth": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-auth-0.1.28-dc7b52d.tgz",
"@agentuity/frontend": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-frontend-0.1.28-dc7b52d.tgz",
"@agentuity/opencode": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-opencode-0.1.28-dc7b52d.tgz",
"@agentuity/server": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-server-0.1.28-dc7b52d.tgz",
"@agentuity/schema": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-schema-0.1.28-dc7b52d.tgz",
"@agentuity/runtime": "https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-runtime-0.1.28-dc7b52d.tgz"
}
}Or install directly: bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-evals-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-react-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-workbench-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-core-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-cli-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-auth-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-frontend-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-opencode-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-server-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-schema-0.1.28-dc7b52d.tgz
bun add https://agentuity-sdk-objects.t3.storage.dev/npm/0.1.28-dc7b52d/agentuity-runtime-0.1.28-dc7b52d.tgzCLI Executables
Run Canary CLIagentuity canary 0.1.28-dc7b52d [command] [...args] |
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.
Actionable comments posted: 20
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/docs/src/web/index.html (1)
63-63: Point the module script to/web/frontend.tsx.The docs guideline requires the module script in this file to reference
/web/frontend.tsx. Please update the src accordingly.🛠️ Proposed fix
- <script type="module" src="./frontend.tsx" async></script> + <script type="module" src="/web/frontend.tsx" async></script>As per coding guidelines, please update the script path.
apps/docs/src/web/App.tsx (1)
641-699: Restrict postMessage target origin and includerecreatingstatus in running check.The current code broadcasts
postMessageto any parent with'*'and drops query parameters from URLs. Additionally, theisRunningcheck doesn't account for therecreatingstatus, which is a valid backend state that should keep the Run button disabled.🔧 Suggested adjustments
- const path = url.startsWith('http') - ? new URL(url).pathname + new URL(url).hash - : url; - window.parent.postMessage({ type: 'NAVIGATE', path }, '*'); + const resolvedUrl = url.startsWith('http') + ? new URL(url) + : new URL(url, window.location.origin); + const path = `${resolvedUrl.pathname}${resolvedUrl.search}${resolvedUrl.hash}`; + const targetOrigin = resolvedUrl.origin; + window.parent.postMessage({ type: 'NAVIGATE', path }, targetOrigin);- const isRunning = - sandbox.state.status === "creating" || - sandbox.state.status === "running"; + const isRunning = + sandbox.state.status === "creating" || + sandbox.state.status === "recreating" || + sandbox.state.status === "running";
🤖 Fix all issues with AI agents
In `@apps/docs/agentuity-snapshot.yaml`:
- Around line 22-40: The snapshot config currently includes "tsconfig.json" but
also has the broad exclusion pattern "!**/tsconfig.json" which will remove the
root tsconfig; update the rules so they don't conflict by either removing the
inclusion "tsconfig.json" if the root tsconfig isn't required at runtime, or
narrow the exclusion pattern (e.g., change "!**/tsconfig.json" to a targeted
pattern like "!node_modules/**/tsconfig.json" or "!src/**/tsconfig.json") so
nested tsconfig files are excluded without deleting the root one.
In `@apps/docs/src/api/sandbox/scripts.ts`:
- Around line 621-624: SCRIPT_DEFAULTS.vector currently includes a seedData
property that the vector script never reads; either remove seedData from
SCRIPT_DEFAULTS or wire it up in the vector script. To fix, either delete the
seedData key from SCRIPT_DEFAULTS.vector so defaults are accurate, or update the
vector script's entry point (where it reads script options) to read
options.seedData and invoke the existing seeding logic (or add seeding logic)
when true; reference SCRIPT_DEFAULTS, the "vector" default object, and the
seedData property when making the change.
- Around line 529-543: The printed labels misidentify the evaluated models;
update the console output strings around responseA, responseB, and judgment to
use the actual model IDs ("gpt-5-nano" for Model A and "claude-haiku-4-5" for
Model B) instead of "GPT-4o-mini" and "Claude Haiku". Locate the block that logs
userPrompt, responseA.text, responseB.text and judgment (the console.log calls
referencing userPrompt, responseA, responseB, and judgment) and replace the
human-facing names with the exact model IDs, and ensure the winner mapping
(judgment.winner === "model-a" ? ...) maps to those same IDs so the Winner line
is consistent.
In `@apps/docs/src/run/AGENTS.md`:
- Around line 173-186: The fenced TypeScript sample uses hard tabs which
triggers markdownlint MD010; replace all hard tab characters with spaces in the
code block(s) containing the invoke example (the block showing invoke(async
(ctx) => { ... }) and calls like ctx.kv.set) and in the other similar fenced
blocks mentioned so they use only spaces for indentation; ensure you update all
occurrences so linting no longer reports MD010.
- Around line 13-31: The fenced directory listing in AGENTS.md is missing a
language specifier which triggers markdownlint MD040; update the opening code
fence for the directory tree in the AGENTS.md file to include a language (e.g.,
change "```" to "```text") so the block is typed and linting passes, leaving the
block contents unchanged.
In `@apps/docs/src/run/chat.ts`:
- Around line 13-29: Wrap the JSON.parse of process.argv[2] in a try/catch and
on parse failure throw a StructuredError (implement a small factory named
StructuredError that accepts message and details) instead of letting the
exception bubble; after successful parse validate that the resulting input has a
string message (type guard against Input/message and ensure Message.role/type
shapes) and if not throw a StructuredError indicating invalid input type; keep
the existing fallback to "What is Agentuity?" only when input parsing succeeds
and input.message is undefined, and reference the existing symbols input, Input,
Message, and message when applying these checks.
In `@apps/docs/src/run/evals.ts`:
- Around line 29-45: Move the JSON.parse call inside the existing try block so
malformed JSON is caught and still allows the script to emit the output marker;
specifically, remove the top-level const input: Input = JSON.parse(...) and
instead parse process.argv[2] within the try before computing question (or wrap
parsing in its own try/catch that falls back to '{}'), ensuring code that uses
input/question (the variables around generateText, createAgentContext, and
ctx.logger.info) runs after parsing so errors surface via the existing catch and
the ---OUTPUT--- marker is always emitted.
In `@apps/docs/src/run/invoke.ts`:
- Around line 23-31: The dynamic import using agentName is vulnerable to path
traversal; validate or restrict agentName before importing (the variable names
to change are agentName and the dynamic import that assigns agent). Ensure
agentName matches a safe whitelist or a strict regex (e.g. only letters,
numbers, hyphen, underscore) and reject/exit if it fails, or map agentName to a
known module name from an allowlist; only after validation/map perform the await
import(`../agent/${agentName}/agent`) and keep the existing error handling that
logs and exits when the module cannot be loaded.
- Around line 36-37: The file prints result with console.log("---OUTPUT---") and
console.log(JSON.stringify(result, null, 2)) but lacks the dev HMR hook; add an
import.meta.hot guard near the bottom to enable Hot Module Replacement in dev
mode (e.g., check import.meta.hot and call import.meta.hot.accept() /
import.meta.hot.dispose(...) as appropriate) so the module safely supports HMR
during development.
In `@apps/docs/src/run/model-arena.ts`:
- Around line 4-78: The header comment and console output labels are
inconsistent with the actual models used (openai("gpt-5-nano") and
anthropic("claude-haiku-4-5")). Update the top comment and all user-facing
strings (e.g., the console prints "Model A (GPT-4o-mini):" and "Model B (Claude
Haiku):" and the winner mapping that shows "Model A (GPT-4o-mini)" / "Model B
(Claude Haiku)") to reflect the real model IDs or clear human-readable names
that include those IDs (e.g., "Model A (gpt-5-nano)" and "Model B
(claude-haiku-4-5)"), ensuring references to generateText calls
openai("gpt-5-nano") and anthropic("claude-haiku-4-5") are consistent.
In `@apps/docs/src/run/sse-stream.ts`:
- Around line 21-31: The JSON.parse of process.argv[2] is done outside the
try/catch and can crash the process on invalid input; move the parse into the
existing try block so parsing errors are caught. Specifically, remove the
top-level const input = JSON.parse(...) and instead inside the try do const
input: Input = JSON.parse(process.argv[2] ?? '{}'); then derive const prompt =
input.prompt ?? "..."; keep using createAgentContext()/ctx and, in the catch
block, call ctx.logger.error with the caught error (and emit your clean error
block/exit) so invalid JSON produces a handled error instead of crashing.
In `@apps/docs/src/run/streaming.ts`:
- Around line 21-22: Wrap the JSON.parse of process.argv[2] in a try-catch and
throw a StructuredError from `@agentuity/core` on parse failure (include a clear
message and attach the original error), then ensure the existing runtime catch
block (the one currently at lines 48-51) also rethrows or logs errors as
StructuredError instances (wrap non-StructuredError exceptions into new
StructuredError with context). Target the Input type/variable (input), the
prompt assignment, and the top-level error handler so all parse and runtime
errors consistently use StructuredError.
In `@apps/docs/src/run/vector.ts`:
- Around line 30-55: Wrap the vector ops (ctx.vector.upsert, ctx.vector.search
and the for-loop over results) in a try/finally block so that
ctx.vector.delete(namespace, product.sku) and the final ctx.logger.info("Cleaned
up", { sku: product.sku }) always run; keep the upsert/search logic and result
logging inside the try, and place the delete+cleanup log in finally, ensuring
any thrown error still propagates after cleanup.
In `@apps/docs/src/web/AGENTS.md`:
- Line 207: The docs show an inconsistency between the status union in
useSandboxRunner and the example for TerminalOutput: include 'recreating' in the
TerminalOutput status union or explicitly document how 'recreating' is
mapped/handled (e.g., merged into 'creating' or treated as a transient state).
Update the AGENTS.md examples so TerminalOutput's documented status type matches
useSandboxRunner's (`'idle' | 'creating' | 'recreating' | 'running' |
'completed' | 'error'`) or add a short note next to TerminalOutput explaining
the mapping/exception for 'recreating'; reference useSandboxRunner and
TerminalOutput in the change so readers know the source of truth.
In `@apps/docs/src/web/code-examples.ts`:
- Around line 298-336: The examples use openai(...) but never import it; update
the durable-stream example (the block that defines router/post("/generate") and
uses streamText and stream.url) and the evals example to add the missing import
statement by importing openai from "@ai-sdk/openai" so openai(...) is defined;
locate the code examples that call openai(...) (e.g., the durable-stream snippet
using streamText and the evals snippet) and add the import at the top of each
example.
In `@apps/docs/src/web/components/CodeBlock.tsx`:
- Around line 30-55: The Monaco decorations in the handleEditorMount callback
reference CSS classes line-highlight-subtle and line-highlight-important that
aren’t defined; add corresponding styles to your global stylesheet or Tailwind
config (or component/global CSS module) so those classes provide visible line
background (and any desired padding/border) when applied by
editor.createDecorationsCollection in CodeBlock.tsx; update whichever global
style entrypoint you use (e.g., globals.css or tailwind config) to include
.line-highlight-subtle and .line-highlight-important with appropriate
background-color/opacity and ensure they are loaded into the app.
In `@apps/docs/src/web/components/Typing.tsx`:
- Around line 68-89: The typing animation never restarts because
hasCompletedRef.current is never reset; inside the useEffect in Typing.tsx (the
effect that depends on children, duration, started) reset
hasCompletedRef.current to false (and clear/initialize displayedText if
appropriate) when the effect runs for a new children value (or when started
toggles) before early-return checks, so the interval logic can run again and
onCompleteRef/current behavior remains correct.
- Around line 48-65: The IntersectionObserver callback starts a setTimeout that
can call setStarted after a delay even if the component unmounts; capture the
timer id when scheduling the timeout (e.g., let timeoutId =
window.setTimeout(...)) and ensure you clear it in the cleanup function returned
from the effect (call clearTimeout(timeoutId)) and still disconnect the
observer; reference the observer variable, the elementRef.current
observe/disconnect logic, the delay value and the setStarted call so the timeout
is always cancelled on unmount to avoid updating an unmounted component.
- Around line 25-27: MotionComponent is being recreated on every render because
motion.create(Component, ...) is called inline; memoize it to prevent remounts
and lost animations by moving the call out of the render path (or wrapping it in
useMemo) so the same component reference is reused. Update the code that defines
MotionComponent (the motion.create call that uses Component) to either hoist it
above the React component or wrap it in React.useMemo(() =>
motion.create(Component, { forwardMotionProps: true }), [Component]) so it only
changes when Component actually changes.
In `@apps/docs/src/web/hooks/useSandboxRunner.ts`:
- Around line 92-99: Replace the current use of btoa(JSON.stringify(input)) in
useSandboxRunner.ts with a UTF-8-safe base64 encoder: encode the JSON string
using TextEncoder to get a Uint8Array and then convert those bytes to a base64
string (e.g., via window.btoa on a byte->char string or other byte-to-base64
routine) before adding it to url as inputBase64; in the server handler
(apps/docs/src/api/sandbox/route.ts) decode the incoming input query param using
a proper base64->UTF8 path (e.g., Buffer.from(inputBase64,
'base64').toString('utf8') or equivalent) so the parsed JSON receives correct
Unicode characters. Ensure you keep the existing param name "input" and
JSON.parse the decoded UTF-8 string where the route currently reads the input
query.
🧹 Nitpick comments (21)
apps/docs/src/run/objectstore.ts (3)
1-14: Use single quotes per coding guidelines.The file header and imports look good. However, the coding guidelines specify using single quotes for TypeScript files. Consider running Prettier with the project configuration to fix quote style.
16-46: Add error handling for S3 operations.S3 operations (write, read, exists, delete) can fail due to network issues, permission errors, or misconfiguration. Since this is a demo script meant to showcase Object Storage functionality, wrapping operations in try/catch would provide a better user experience and demonstrate proper error handling patterns.
Proposed fix with error handling
const ctx = createAgentContext(); const filename = `demo-${Date.now()}.txt`; const content = `Hello from Object Storage!\nTimestamp: ${new Date().toISOString()}`; -ctx.logger.info("Writing file"); +try { + ctx.logger.info('Writing file'); -// Write a file -const file = s3.file(filename); -await file.write(content); + // Write a file + const file = s3.file(filename); + await file.write(content); -ctx.logger.info("Reading file"); + ctx.logger.info('Reading file'); -// Read it back -const readContent = await file.text(); + // Read it back + const readContent = await file.text(); -// Check existence -const exists = await file.exists(); + // Check existence + const exists = await file.exists(); -ctx.logger.info("Deleting file"); + ctx.logger.info('Deleting file'); -// Delete -await file.delete(); + // Delete + await file.delete(); -console.log("---OUTPUT---"); -console.log(`Write: "${filename}"`); -console.log(` Content: ${content.split("\n")[0]}...`); -console.log(`Read: "${filename}"`); -console.log(` Content: ${readContent.split("\n")[0]}...`); -console.log(`Exists: ${exists}`); -console.log(`Deleted: "${filename}"`); + console.log('---OUTPUT---'); + console.log(`Write: "${filename}"`); + console.log(` Content: ${content.split('\n')[0]}...`); + console.log(`Read: "${filename}"`); + console.log(` Content: ${readContent.split('\n')[0]}...`); + console.log(`Exists: ${exists}`); + console.log(`Deleted: "${filename}"`); +} catch (error) { + ctx.logger.error('Object Storage demo failed', { error }); + console.log('---OUTPUT---'); + console.log(`Error: ${error instanceof Error ? error.message : String(error)}`); + process.exit(1); +}
32-33: Consider verifying existence after delete to demonstrate full lifecycle.The
existscheck on line 33 happens before the delete operation, so it will always returntrue. To better demonstrate the complete Object Storage lifecycle, consider also checking existence after delete to show the file is gone.Proposed enhancement
// Check existence -const exists = await file.exists(); +const existsBefore = await file.exists(); ctx.logger.info("Deleting file"); // Delete await file.delete(); +// Verify deletion +const existsAfter = await file.exists(); + console.log("---OUTPUT---"); console.log(`Write: "${filename}"`); console.log(` Content: ${content.split("\n")[0]}...`); console.log(`Read: "${filename}"`); console.log(` Content: ${readContent.split("\n")[0]}...`); -console.log(`Exists: ${exists}`); +console.log(`Exists (before delete): ${existsBefore}`); +console.log(`Exists (after delete): ${existsAfter}`); console.log(`Deleted: "${filename}"`);apps/docs/src/run/chat.ts (2)
61-63: Awaitsession.state.getto avoid NaN if it’s async.
thread.state.getis awaited, so ifsession.state.getis async too,Date.now() - PromiseyieldsNaN. Awaiting is safe even if it’s sync.🛠️ Proposed fix
-const elapsed = Date.now() - (ctx.session.state.get("requestStart") as number); +const requestStart = (await ctx.session.state.get('requestStart')) as number; +const elapsed = Date.now() - requestStart;Please confirm
session.state.get’s return type in@agentuity/runtime.
13-17: Addimport.meta.hothandling for docs run scripts.To support HMR in dev mode for
apps/docs/src, add animport.meta.hotguard. As per coding guidelines, this is required for files in this path.♻️ Proposed addition
import { createAgentContext } from "@agentuity/runtime"; import { openai } from "@ai-sdk/openai"; import { generateText } from "ai"; import agentuityDocs from "../agent/chat/agentuity-context.txt"; +if (import.meta.hot) { + import.meta.hot.accept(); + import.meta.hot.dispose(() => {}); +}apps/docs/src/run/cron.ts (1)
35-55: Ensure KV cleanup even if a step fails.If
set/getthrows, the delete won’t run. Atry/finallykeeps the demo namespace clean.🛠️ Proposed refactor
// Cache the result in KV storage console.log("Step 2: Caching in KV storage..."); -await ctx.kv.set(bucket, "latest-sync", mockData, { ttl: 3600 }); -console.log(` Cached to "${bucket}/latest-sync" (TTL: 1 hour)`); -console.log(""); - -// Verify the cache -const cached = await ctx.kv.get(bucket, "latest-sync"); -console.log("Step 3: Verifying cache..."); -if (cached.exists) { - const data = cached.data as typeof mockData; - console.log(` Cache verified: ${data.recordCount} records`); -} else { - console.log(" Cache verification failed!"); -} -console.log(""); - -// Cleanup (demo only - real cron jobs would keep the cache) -console.log("Step 4: Cleaning up (demo only)..."); -await ctx.kv.delete(bucket, "latest-sync"); -console.log(` Deleted "${bucket}/latest-sync"`); -console.log(""); +try { + await ctx.kv.set(bucket, "latest-sync", mockData, { ttl: 3600 }); + console.log(` Cached to "${bucket}/latest-sync" (TTL: 1 hour)`); + console.log(""); + + // Verify the cache + const cached = await ctx.kv.get(bucket, "latest-sync"); + console.log("Step 3: Verifying cache..."); + if (cached.exists) { + const data = cached.data as typeof mockData; + console.log(` Cache verified: ${data.recordCount} records`); + } else { + console.log(" Cache verification failed!"); + } + console.log(""); +} finally { + // Cleanup (demo only - real cron jobs would keep the cache) + console.log("Step 4: Cleaning up (demo only)..."); + await ctx.kv.delete(bucket, "latest-sync"); + console.log(` Deleted "${bucket}/latest-sync"`); + console.log(""); +}apps/docs/src/run/durable-stream.ts (1)
26-45: Guarantee stream closure withtry/finally.If
writefails,closewon’t run. Wrapping the write in atry/finallykeeps the stream consistent.🛠️ Proposed refactor
-// Write content -await stream.write(content); -console.log("Content written:"); -console.log(` "${content.split('\n')[0]}..."`); -console.log(""); - -// Close the stream -await stream.close(); -console.log("Stream closed"); -console.log(""); +try { + // Write content + await stream.write(content); + console.log("Content written:"); + console.log(` "${content.split('\n')[0]}..."`); + console.log(""); +} finally { + // Close the stream + await stream.close(); + console.log("Stream closed"); + console.log(""); +}apps/docs/src/run/hello.ts (2)
11-11: Consider wrappingJSON.parsein try-catch for CLI robustness.If a user passes malformed JSON, the script will crash with an unhelpful error. Other scripts in the PR (e.g.,
ai-gateway.ts) wrap their main logic in try-catch.🔧 Suggested improvement
-const input = JSON.parse(process.argv[2] ?? '{"name":"World"}'); +let input: { name?: string }; +try { + input = JSON.parse(process.argv[2] ?? '{"name":"World"}'); +} catch { + console.error("Invalid JSON input, using default"); + input = { name: "World" }; +}
14-18: Missing error handling and stdout flush.The
ctx.invoke()call could fail, and there's no try-catch. Additionally,ai-gateway.tsincludes a stdout flush before exit for reliability—consider adding it here for consistency across run scripts.🔧 Suggested improvement
-ctx.logger.info("Processing greeting", { name: input.name }); -const result = await ctx.invoke(() => helloAgent.run(input)); - -console.log("---OUTPUT---"); -console.log(result); +try { + ctx.logger.info("Processing greeting", { name: input.name }); + const result = await ctx.invoke(() => helloAgent.run(input)); + + console.log("---OUTPUT---"); + console.log(result); +} catch (error) { + console.log("---OUTPUT---"); + console.log(`Error: ${error instanceof Error ? error.message : String(error)}`); +} + +// Ensure stdout is flushed before exit +await new Promise<void>((resolve) => { + process.stdout.write("", () => resolve()); +});apps/docs/src/run/kv.ts (1)
29-48: Add error handling and stdout flush for consistency.This script lacks the try-catch and stdout flush pattern used in
ai-gateway.ts. If KV operations fail (network issues, invalid bucket), the script will crash without a user-friendly error message.🔧 Suggested improvement
-ctx.logger.info("Setting key"); - -// SET - store data with TTL -await ctx.kv.set(bucket, key, sessionData, { ttl: 300 }); - -ctx.logger.info("Getting key"); - -// GET - retrieve data -const result = await ctx.kv.get(bucket, key); - -// DELETE - cleanup (before OUTPUT so it shows in logs) -await ctx.kv.delete(bucket, key); -ctx.logger.info("Deleted key"); - -console.log("---OUTPUT---"); -console.log(`Set: "${key}"`); -console.log(` visitorId: "${sessionData.visitorId}"`); -console.log(` theme: "${sessionData.preferences.theme}"`); -console.log(`Get: ${result.exists ? "found" : "not found"}`); -console.log(`Deleted: "${key}"`); +try { + ctx.logger.info("Setting key"); + + // SET - store data with TTL + await ctx.kv.set(bucket, key, sessionData, { ttl: 300 }); + + ctx.logger.info("Getting key"); + + // GET - retrieve data + const result = await ctx.kv.get(bucket, key); + + // DELETE - cleanup (before OUTPUT so it shows in logs) + await ctx.kv.delete(bucket, key); + ctx.logger.info("Deleted key"); + + console.log("---OUTPUT---"); + console.log(`Set: "${key}"`); + console.log(` visitorId: "${sessionData.visitorId}"`); + console.log(` theme: "${sessionData.preferences.theme}"`); + console.log(`Get: ${result.exists ? "found" : "not found"}`); + console.log(`Deleted: "${key}"`); +} catch (error) { + console.log("---OUTPUT---"); + console.log(`Error: ${error instanceof Error ? error.message : String(error)}`); +} + +// Ensure stdout is flushed before exit +await new Promise<void>((resolve) => { + process.stdout.write("", () => resolve()); +});apps/docs/AGENTS.md (2)
34-71: Add language specifier to fenced code block.The directory structure code block is missing a language specifier. Use
textorplaintextfor non-code blocks to satisfy markdown linting rules.📝 Suggested fix
-``` +```text apps/docs/ ├── src/
105-112: Add language specifier to data flow diagram.This code block is also missing a language specifier. Use
textorplaintextfor diagram blocks.📝 Suggested fix
-``` +```text Browser → useSandboxRunner hookapps/docs/src/run/handler-context.ts (1)
49-55: Clean up demo thread state after the read.This script sets
demo-keybut never deletes it, which can leave leftovers across repeated sandbox runs.♻️ Suggested tweak
await ctx.thread.state.set("demo-key", { value: "test" }); const stored = await ctx.thread.state.get("demo-key"); +await ctx.thread.state.delete("demo-key"); console.log(` set("demo-key", {value: "test"})`); console.log(` get("demo-key") -> ${JSON.stringify(stored)}`); +console.log(` delete("demo-key")`);apps/docs/src/run/evals.ts (1)
85-88: Use StructuredError for consistent error handling.The catch block logs raw error strings. Please wrap errors with
StructuredErrorso sandbox consumers get a consistent schema. As per coding guidelines.apps/docs/scripts/create-deps-snapshot.sh (2)
18-18: Harden bash failure handling withpipefailand unset checks.This script relies on pipelines (e.g.,
grep) and env vars;set -euo pipefailavoids masked failures and unset-variable surprises.✅ Suggested fix
-set -e +set -euo pipefail
50-65: Pin dependency versions for reproducible snapshots.Using
"latest"makes snapshots non-deterministic and harder to debug. Consider pinning versions (or generating this file from a lockfile) to keep snapshots stable.apps/docs/src/web/components/TerminalOutput.tsx (1)
53-69: Minor: Redundantcompletedentry instatusConfig.The
completedstatus is handled separately at lines 54-59 before thestatusConfiglookup, making thecompletedentry in the object (line 65) unreachable dead code.♻️ Suggested cleanup
const getStatusConfig = (status: TerminalStatus, exitCode: number | null | undefined): { dot: string; text: string } => { if (status === 'completed') { if (exitCode !== null && exitCode !== undefined && exitCode !== 0) { return { dot: 'bg-red-500', text: 'Failed' }; } return { dot: 'bg-green-500', text: 'Completed' }; } const statusConfig: Record<TerminalStatus, { dot: string; text: string }> = { idle: { dot: 'bg-zinc-500', text: 'Ready' }, creating: { dot: 'bg-yellow-500 animate-pulse', text: 'Creating sandbox' }, recreating: { dot: 'bg-yellow-500 animate-pulse', text: 'Recreating sandbox' }, running: { dot: 'bg-cyan-500 animate-pulse', text: 'Executing' }, - completed: { dot: 'bg-green-500', text: 'Completed' }, error: { dot: 'bg-red-500', text: 'Error' }, }; return statusConfig[status]; };Note: This would require changing the type from
Record<TerminalStatus, ...>to a partial or explicit type, or keeping it as-is for type completeness. The current code works correctly.apps/docs/src/web/components/HandlerContextDemo.tsx (1)
247-268: Consider caching the endpoint lookup.The
endpoints.find()is called twice for the samelastEndpointvalue (lines 252 and 265). While this is a minor performance consideration for a small array, you could cache it for cleaner code.♻️ Suggested improvement
+ const selectedEndpoint = lastEndpoint + ? endpoints.find((ep) => ep.id === lastEndpoint) + : null; + {/* Explanation for selected endpoint */} - {lastEndpoint && ( + {selectedEndpoint && ( <div className="bg-cyan-50/50 dark:bg-cyan-950/20 border border-cyan-200 dark:border-cyan-900 rounded-lg p-4"> <div className="flex items-center justify-between mb-2"> <code className="text-cyan-700 dark:text-cyan-400 font-mono text-sm"> - {endpoints.find((ep) => ep.id === lastEndpoint)?.codeHint} + {selectedEndpoint.codeHint} </code> <!-- ... --> </div> <p className="text-zinc-600 dark:text-zinc-400 text-sm"> - {endpoints.find((ep) => ep.id === lastEndpoint)?.explanation} + {selectedEndpoint.explanation} </p> </div> )}apps/docs/src/api/sandbox/route.ts (1)
152-155: PreferStructuredErrorfor error handling in the route.Consider wrapping errors with
StructuredError(from@agentuity/core) before logging/emitting SSE to keep error handling consistent. As per coding guidelines, preferStructuredErrorfor error handling.apps/docs/src/web/AGENTS.md (2)
16-37: Add language specifier to the fenced code block.The code block showing the directory structure should specify a language for proper rendering and syntax highlighting.
📝 Suggested fix
-``` +```text src/web/ ├── App.tsx # Main app with demo config and routingBased on static analysis hints.
112-124: Consider using spaces instead of hard tabs in code blocks.The code examples throughout this file use hard tabs for indentation. While this is internally consistent, Markdown best practice is to use spaces for better cross-platform rendering.
This applies to code blocks at:
- Lines 112-124 (useAPI example)
- Lines 184-202 (useSandboxRunner example)
- Lines 216-229 (CodeBlock example)
- Lines 235-244 (TerminalOutput example)
- Lines 250-267 (DemoConfig interface)
Based on static analysis hints.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
apps/docs/src/generated/app.tsis excluded by!**/generated/**apps/docs/src/generated/routes.tsis excluded by!**/generated/**bun.lockis excluded by!**/*.lock
📒 Files selected for processing (34)
apps/docs/AGENTS.mdapps/docs/agentuity-snapshot.yamlapps/docs/package.jsonapps/docs/scripts/create-deps-snapshot.shapps/docs/src/agent/AGENTS.mdapps/docs/src/api/AGENTS.mdapps/docs/src/api/sandbox/route.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/AGENTS.mdapps/docs/src/run/agent-calls.tsapps/docs/src/run/ai-gateway.tsapps/docs/src/run/chat.tsapps/docs/src/run/cron.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/evals.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/hello.tsapps/docs/src/run/invoke.tsapps/docs/src/run/kv.tsapps/docs/src/run/model-arena.tsapps/docs/src/run/objectstore.tsapps/docs/src/run/sse-stream.tsapps/docs/src/run/streaming.tsapps/docs/src/run/vector.tsapps/docs/src/web/AGENTS.mdapps/docs/src/web/App.tsxapps/docs/src/web/code-examples.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/components/Typing.tsxapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/web/index.htmlapps/docs/src/web/test-outputs.ts
🧰 Additional context used
📓 Path-based instructions (12)
apps/docs/src/web/**/index.html
📄 CodeRabbit inference engine (apps/docs/src/web/AGENTS.md)
apps/docs/src/web/**/index.html: index.html must have a<div id="root"></div>element
Module script tag in index.html must reference /web/frontend.tsx
Files:
apps/docs/src/web/index.html
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use Prettier formatter with tabs (width 3), single quotes, and semicolons for TypeScript files
Use TypeScript strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
apps/docs/src/run/streaming.tsapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/run/kv.tsapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/run/cron.tsapps/docs/src/web/code-examples.tsapps/docs/src/run/chat.tsapps/docs/src/web/components/Typing.tsxapps/docs/src/run/evals.tsapps/docs/src/run/agent-calls.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/objectstore.tsapps/docs/src/run/hello.tsapps/docs/src/run/model-arena.tsapps/docs/src/api/sandbox/route.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/test-outputs.tsapps/docs/src/run/sse-stream.tsapps/docs/src/run/ai-gateway.tsapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/run/invoke.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/vector.tsapps/docs/src/web/App.tsx
apps/docs/src/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Support hot module reloading in dev mode using import.meta.hot
Files:
apps/docs/src/run/streaming.tsapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/run/kv.tsapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/run/cron.tsapps/docs/src/web/code-examples.tsapps/docs/src/run/chat.tsapps/docs/src/web/components/Typing.tsxapps/docs/src/run/evals.tsapps/docs/src/run/agent-calls.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/objectstore.tsapps/docs/src/run/hello.tsapps/docs/src/run/model-arena.tsapps/docs/src/api/sandbox/route.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/test-outputs.tsapps/docs/src/run/sse-stream.tsapps/docs/src/run/ai-gateway.tsapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/run/invoke.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/vector.tsapps/docs/src/web/App.tsx
apps/docs/src/web/components/**/*.{tsx,ts,jsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
React frontend components should be located in src/web/components/ and use React 19 features
Files:
apps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/components/Typing.tsxapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsx
apps/docs/src/web/**/*.{tsx,jsx}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Use Tailwind CSS for styling in React components
Files:
apps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/components/Typing.tsxapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/App.tsx
apps/docs/src/web/**/*.{tsx,ts}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Use TypeScript/TSX syntax in React components; the Agentuity build system handles compilation automatically
Files:
apps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/web/code-examples.tsapps/docs/src/web/components/Typing.tsxapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/test-outputs.tsapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/App.tsx
apps/docs/src/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/docs/src/web/AGENTS.md)
apps/docs/src/web/**/*.{ts,tsx}: Use TypeScript for type safety in React components
Wrap your app with AgentuityProvider for hooks to work
Place reusable components in separate files
Handle loading and error states in UI components
Use useAgent hook for one-off agent calls
Use useAgentWebsocket hook for bidirectional real-time communication
Use useAgentEventStream hook for server-to-client streaming
All agents are accessible via useAgent hook using agent name
Files:
apps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/web/code-examples.tsapps/docs/src/web/components/Typing.tsxapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/test-outputs.tsapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/App.tsx
apps/docs/package.json
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
apps/docs/package.json: Workspace dependencies (@agentuity/runtime,@agentuity/react,@agentuity/schema,@agentuity/workbench,@agentuity/evals,@agentuity/cli) should be imported with workspace:* versions
Use the local CLI directly via bun ../../packages/cli/bin/cli.ts in scripts rather than relying on installed CLI packages
Files:
apps/docs/package.json
apps/docs/src/agent/**
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Agent implementations should be organized in separate subdirectories within src/agent/ (hello, chat, kv, vector, evals, model-arena, etc.)
Files:
apps/docs/src/agent/AGENTS.md
apps/docs/src/api/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
API routes should be implemented in the src/api/ directory following REST, streaming, SSE, and WebSocket patterns
Files:
apps/docs/src/api/sandbox/route.tsapps/docs/src/api/sandbox/scripts.ts
apps/docs/src/web/App.tsx
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
The main React component should be implemented in App.tsx and configure demos according to the application structure
Files:
apps/docs/src/web/App.tsx
apps/docs/src/web/**/App.tsx
📄 CodeRabbit inference engine (apps/docs/src/web/AGENTS.md)
App.tsx must export a function named
App
Files:
apps/docs/src/web/App.tsx
🧠 Learnings (5)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.
Applied to files:
apps/docs/src/run/streaming.tsapps/docs/src/run/kv.tsapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/run/cron.tsapps/docs/src/web/code-examples.tsapps/docs/src/run/chat.tsapps/docs/src/run/evals.tsapps/docs/src/run/agent-calls.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/objectstore.tsapps/docs/src/run/hello.tsapps/docs/src/run/model-arena.tsapps/docs/src/api/sandbox/route.tsapps/docs/src/web/test-outputs.tsapps/docs/src/run/sse-stream.tsapps/docs/src/run/ai-gateway.tsapps/docs/src/run/invoke.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/vector.ts
📚 Learning: 2026-01-09T16:26:51.893Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 523
File: templates/_base/src/web/frontend.tsx:13-35
Timestamp: 2026-01-09T16:26:51.893Z
Learning: In web frontend code, prefer using the built-in Error class for runtime errors. Do not throw or re-export StructuredError from agentuity/core in web app code. Replace instances of StructuredError with new Error or custom error types that extend Error; ensure error handling logic remains intact and that error messages are descriptive. This guideline applies to all web UI TypeScript/TSX files that run in the browser and import StructuredError from agentuity/core.
Applied to files:
apps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/components/Typing.tsxapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/App.tsx
📚 Learning: 2026-01-09T22:09:27.894Z
Learnt from: CR
Repo: agentuity/sdk PR: 0
File: apps/docs/src/agent/AGENTS.md:0-0
Timestamp: 2026-01-09T22:09:27.894Z
Learning: Applies to apps/docs/src/agent/src/agent/**/agent.ts : Each agent folder must contain agent.ts (required) - Agent definition with metadata, schema, and handler
Applied to files:
apps/docs/src/agent/AGENTS.md
📚 Learning: 2025-12-22T16:52:53.853Z
Learnt from: CR
Repo: agentuity/sdk PR: 0
File: apps/testing/integration-suite/src/agent/AGENTS.md:0-0
Timestamp: 2025-12-22T16:52:53.853Z
Learning: Applies to apps/testing/integration-suite/src/agent/src/agent/**/agent.ts : Each agent folder must contain an **agent.ts** file with agent definition including metadata, schema, and handler
Applied to files:
apps/docs/src/agent/AGENTS.md
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.
Applied to files:
apps/docs/src/api/sandbox/route.tsapps/docs/src/api/sandbox/scripts.ts
🧬 Code graph analysis (6)
apps/docs/scripts/create-deps-snapshot.sh (1)
packages/vscode/src/core/cliClient.ts (1)
exec(144-275)
apps/docs/src/web/hooks/useSandboxRunner.ts (1)
apps/docs/src/web/components/TerminalOutput.tsx (1)
TerminalStatus(3-3)
apps/docs/src/run/model-arena.ts (1)
apps/docs/src/agent/model-arena/types.ts (1)
JudgmentSchema(51-62)
apps/docs/src/api/sandbox/route.ts (1)
apps/docs/src/api/sandbox/scripts.ts (2)
SCRIPTS(8-618)SCRIPT_DEFAULTS(621-636)
apps/docs/src/web/components/CodeBlock.tsx (1)
apps/docs/src/web/components/ThemeContext.tsx (1)
useTheme(88-94)
apps/docs/src/web/App.tsx (6)
apps/docs/src/web/components/CodeBlock.tsx (2)
LineHighlight(6-9)CodeBlock(20-197)apps/docs/src/web/components/KVExplorer.tsx (1)
KVExplorer(3-179)apps/docs/src/web/components/EvalsDemo.tsx (1)
EvalsDemo(34-331)apps/docs/src/web/hooks/useSandboxRunner.ts (1)
useSandboxRunner(62-197)apps/docs/src/web/test-outputs.ts (1)
TEST_OUTPUTS(5-176)apps/docs/src/web/components/TerminalOutput.tsx (1)
TerminalOutput(25-124)
🪛 Biome (2.1.2)
apps/docs/src/api/sandbox/route.ts
[error] 20-20: Unexpected control character in a regular expression.
Control characters are unusual and potentially incorrect inputs, so they are disallowed.
(lint/suspicious/noControlCharactersInRegex)
🪛 markdownlint-cli2 (0.18.1)
apps/docs/src/agent/AGENTS.md
19-19: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
50-50: Hard tabs
Column: 1
(MD010, no-hard-tabs)
51-51: Hard tabs
Column: 1
(MD010, no-hard-tabs)
52-52: Hard tabs
Column: 1
(MD010, no-hard-tabs)
53-53: Hard tabs
Column: 1
(MD010, no-hard-tabs)
54-54: Hard tabs
Column: 1
(MD010, no-hard-tabs)
55-55: Hard tabs
Column: 1
(MD010, no-hard-tabs)
56-56: Hard tabs
Column: 1
(MD010, no-hard-tabs)
57-57: Hard tabs
Column: 1
(MD010, no-hard-tabs)
58-58: Hard tabs
Column: 1
(MD010, no-hard-tabs)
59-59: Hard tabs
Column: 1
(MD010, no-hard-tabs)
60-60: Hard tabs
Column: 1
(MD010, no-hard-tabs)
77-77: Hard tabs
Column: 1
(MD010, no-hard-tabs)
78-78: Hard tabs
Column: 1
(MD010, no-hard-tabs)
79-79: Hard tabs
Column: 1
(MD010, no-hard-tabs)
80-80: Hard tabs
Column: 1
(MD010, no-hard-tabs)
81-81: Hard tabs
Column: 1
(MD010, no-hard-tabs)
82-82: Hard tabs
Column: 1
(MD010, no-hard-tabs)
83-83: Hard tabs
Column: 1
(MD010, no-hard-tabs)
84-84: Hard tabs
Column: 1
(MD010, no-hard-tabs)
85-85: Hard tabs
Column: 1
(MD010, no-hard-tabs)
86-86: Hard tabs
Column: 1
(MD010, no-hard-tabs)
87-87: Hard tabs
Column: 1
(MD010, no-hard-tabs)
88-88: Hard tabs
Column: 1
(MD010, no-hard-tabs)
101-101: Hard tabs
Column: 1
(MD010, no-hard-tabs)
102-102: Hard tabs
Column: 1
(MD010, no-hard-tabs)
103-103: Hard tabs
Column: 1
(MD010, no-hard-tabs)
104-104: Hard tabs
Column: 1
(MD010, no-hard-tabs)
105-105: Hard tabs
Column: 1
(MD010, no-hard-tabs)
106-106: Hard tabs
Column: 1
(MD010, no-hard-tabs)
107-107: Hard tabs
Column: 1
(MD010, no-hard-tabs)
108-108: Hard tabs
Column: 1
(MD010, no-hard-tabs)
109-109: Hard tabs
Column: 1
(MD010, no-hard-tabs)
110-110: Hard tabs
Column: 1
(MD010, no-hard-tabs)
112-112: Hard tabs
Column: 1
(MD010, no-hard-tabs)
113-113: Hard tabs
Column: 1
(MD010, no-hard-tabs)
115-115: Hard tabs
Column: 1
(MD010, no-hard-tabs)
116-116: Hard tabs
Column: 1
(MD010, no-hard-tabs)
117-117: Hard tabs
Column: 1
(MD010, no-hard-tabs)
118-118: Hard tabs
Column: 1
(MD010, no-hard-tabs)
119-119: Hard tabs
Column: 1
(MD010, no-hard-tabs)
153-153: Hard tabs
Column: 1
(MD010, no-hard-tabs)
154-154: Hard tabs
Column: 1
(MD010, no-hard-tabs)
155-155: Hard tabs
Column: 1
(MD010, no-hard-tabs)
185-185: Hard tabs
Column: 1
(MD010, no-hard-tabs)
186-186: Hard tabs
Column: 1
(MD010, no-hard-tabs)
187-187: Hard tabs
Column: 1
(MD010, no-hard-tabs)
249-249: Hard tabs
Column: 1
(MD010, no-hard-tabs)
275-275: Hard tabs
Column: 1
(MD010, no-hard-tabs)
318-318: Hard tabs
Column: 1
(MD010, no-hard-tabs)
319-319: Hard tabs
Column: 1
(MD010, no-hard-tabs)
320-320: Hard tabs
Column: 1
(MD010, no-hard-tabs)
321-321: Hard tabs
Column: 1
(MD010, no-hard-tabs)
323-323: Hard tabs
Column: 1
(MD010, no-hard-tabs)
apps/docs/AGENTS.md
34-34: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
105-105: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
apps/docs/src/api/AGENTS.md
13-13: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
103-103: Hard tabs
Column: 1
(MD010, no-hard-tabs)
104-104: Hard tabs
Column: 1
(MD010, no-hard-tabs)
106-106: Hard tabs
Column: 1
(MD010, no-hard-tabs)
107-107: Hard tabs
Column: 1
(MD010, no-hard-tabs)
108-108: Hard tabs
Column: 1
(MD010, no-hard-tabs)
109-109: Hard tabs
Column: 1
(MD010, no-hard-tabs)
114-114: Hard tabs
Column: 1
(MD010, no-hard-tabs)
115-115: Hard tabs
Column: 1
(MD010, no-hard-tabs)
262-262: Hard tabs
Column: 1
(MD010, no-hard-tabs)
263-263: Hard tabs
Column: 1
(MD010, no-hard-tabs)
264-264: Hard tabs
Column: 1
(MD010, no-hard-tabs)
265-265: Hard tabs
Column: 1
(MD010, no-hard-tabs)
266-266: Hard tabs
Column: 1
(MD010, no-hard-tabs)
268-268: Hard tabs
Column: 1
(MD010, no-hard-tabs)
269-269: Hard tabs
Column: 1
(MD010, no-hard-tabs)
270-270: Hard tabs
Column: 1
(MD010, no-hard-tabs)
271-271: Hard tabs
Column: 1
(MD010, no-hard-tabs)
272-272: Hard tabs
Column: 1
(MD010, no-hard-tabs)
273-273: Hard tabs
Column: 1
(MD010, no-hard-tabs)
274-274: Hard tabs
Column: 1
(MD010, no-hard-tabs)
275-275: Hard tabs
Column: 1
(MD010, no-hard-tabs)
277-277: Hard tabs
Column: 1
(MD010, no-hard-tabs)
278-278: Hard tabs
Column: 1
(MD010, no-hard-tabs)
279-279: Hard tabs
Column: 1
(MD010, no-hard-tabs)
280-280: Hard tabs
Column: 1
(MD010, no-hard-tabs)
281-281: Hard tabs
Column: 1
(MD010, no-hard-tabs)
306-306: Hard tabs
Column: 1
(MD010, no-hard-tabs)
307-307: Hard tabs
Column: 1
(MD010, no-hard-tabs)
308-308: Hard tabs
Column: 1
(MD010, no-hard-tabs)
309-309: Hard tabs
Column: 1
(MD010, no-hard-tabs)
310-310: Hard tabs
Column: 1
(MD010, no-hard-tabs)
311-311: Hard tabs
Column: 1
(MD010, no-hard-tabs)
312-312: Hard tabs
Column: 1
(MD010, no-hard-tabs)
330-330: Hard tabs
Column: 1
(MD010, no-hard-tabs)
331-331: Hard tabs
Column: 1
(MD010, no-hard-tabs)
332-332: Hard tabs
Column: 1
(MD010, no-hard-tabs)
333-333: Hard tabs
Column: 1
(MD010, no-hard-tabs)
335-335: Hard tabs
Column: 1
(MD010, no-hard-tabs)
336-336: Hard tabs
Column: 1
(MD010, no-hard-tabs)
337-337: Hard tabs
Column: 1
(MD010, no-hard-tabs)
338-338: Hard tabs
Column: 1
(MD010, no-hard-tabs)
340-340: Hard tabs
Column: 1
(MD010, no-hard-tabs)
341-341: Hard tabs
Column: 1
(MD010, no-hard-tabs)
342-342: Hard tabs
Column: 1
(MD010, no-hard-tabs)
343-343: Hard tabs
Column: 1
(MD010, no-hard-tabs)
357-357: Hard tabs
Column: 1
(MD010, no-hard-tabs)
359-359: Hard tabs
Column: 1
(MD010, no-hard-tabs)
360-360: Hard tabs
Column: 1
(MD010, no-hard-tabs)
361-361: Hard tabs
Column: 1
(MD010, no-hard-tabs)
362-362: Hard tabs
Column: 1
(MD010, no-hard-tabs)
363-363: Hard tabs
Column: 1
(MD010, no-hard-tabs)
364-364: Hard tabs
Column: 1
(MD010, no-hard-tabs)
365-365: Hard tabs
Column: 1
(MD010, no-hard-tabs)
367-367: Hard tabs
Column: 1
(MD010, no-hard-tabs)
368-368: Hard tabs
Column: 1
(MD010, no-hard-tabs)
apps/docs/src/run/AGENTS.md
13-13: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
178-178: Hard tabs
Column: 1
(MD010, no-hard-tabs)
180-180: Hard tabs
Column: 1
(MD010, no-hard-tabs)
181-181: Hard tabs
Column: 1
(MD010, no-hard-tabs)
183-183: Hard tabs
Column: 1
(MD010, no-hard-tabs)
184-184: Hard tabs
Column: 1
(MD010, no-hard-tabs)
185-185: Hard tabs
Column: 1
(MD010, no-hard-tabs)
194-194: Hard tabs
Column: 1
(MD010, no-hard-tabs)
195-195: Hard tabs
Column: 1
(MD010, no-hard-tabs)
203-203: Hard tabs
Column: 1
(MD010, no-hard-tabs)
204-204: Hard tabs
Column: 1
(MD010, no-hard-tabs)
273-273: Hard tabs
Column: 1
(MD010, no-hard-tabs)
275-275: Hard tabs
Column: 1
(MD010, no-hard-tabs)
276-276: Hard tabs
Column: 1
(MD010, no-hard-tabs)
277-277: Hard tabs
Column: 1
(MD010, no-hard-tabs)
278-278: Hard tabs
Column: 1
(MD010, no-hard-tabs)
279-279: Hard tabs
Column: 1
(MD010, no-hard-tabs)
280-280: Hard tabs
Column: 1
(MD010, no-hard-tabs)
apps/docs/src/web/AGENTS.md
16-16: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
116-116: Hard tabs
Column: 1
(MD010, no-hard-tabs)
118-118: Hard tabs
Column: 1
(MD010, no-hard-tabs)
119-119: Hard tabs
Column: 1
(MD010, no-hard-tabs)
120-120: Hard tabs
Column: 1
(MD010, no-hard-tabs)
121-121: Hard tabs
Column: 1
(MD010, no-hard-tabs)
122-122: Hard tabs
Column: 1
(MD010, no-hard-tabs)
188-188: Hard tabs
Column: 1
(MD010, no-hard-tabs)
190-190: Hard tabs
Column: 1
(MD010, no-hard-tabs)
191-191: Hard tabs
Column: 1
(MD010, no-hard-tabs)
192-192: Hard tabs
Column: 1
(MD010, no-hard-tabs)
194-194: Hard tabs
Column: 1
(MD010, no-hard-tabs)
195-195: Hard tabs
Column: 1
(MD010, no-hard-tabs)
196-196: Hard tabs
Column: 1
(MD010, no-hard-tabs)
197-197: Hard tabs
Column: 1
(MD010, no-hard-tabs)
198-198: Hard tabs
Column: 1
(MD010, no-hard-tabs)
199-199: Hard tabs
Column: 1
(MD010, no-hard-tabs)
200-200: Hard tabs
Column: 1
(MD010, no-hard-tabs)
201-201: Hard tabs
Column: 1
(MD010, no-hard-tabs)
220-220: Hard tabs
Column: 1
(MD010, no-hard-tabs)
221-221: Hard tabs
Column: 1
(MD010, no-hard-tabs)
222-222: Hard tabs
Column: 1
(MD010, no-hard-tabs)
223-223: Hard tabs
Column: 1
(MD010, no-hard-tabs)
224-224: Hard tabs
Column: 1
(MD010, no-hard-tabs)
225-225: Hard tabs
Column: 1
(MD010, no-hard-tabs)
226-226: Hard tabs
Column: 1
(MD010, no-hard-tabs)
227-227: Hard tabs
Column: 1
(MD010, no-hard-tabs)
239-239: Hard tabs
Column: 1
(MD010, no-hard-tabs)
240-240: Hard tabs
Column: 1
(MD010, no-hard-tabs)
241-241: Hard tabs
Column: 1
(MD010, no-hard-tabs)
242-242: Hard tabs
Column: 1
(MD010, no-hard-tabs)
252-252: Hard tabs
Column: 1
(MD010, no-hard-tabs)
253-253: Hard tabs
Column: 1
(MD010, no-hard-tabs)
254-254: Hard tabs
Column: 1
(MD010, no-hard-tabs)
255-255: Hard tabs
Column: 1
(MD010, no-hard-tabs)
256-256: Hard tabs
Column: 1
(MD010, no-hard-tabs)
257-257: Hard tabs
Column: 1
(MD010, no-hard-tabs)
258-258: Hard tabs
Column: 1
(MD010, no-hard-tabs)
259-259: Hard tabs
Column: 1
(MD010, no-hard-tabs)
260-260: Hard tabs
Column: 1
(MD010, no-hard-tabs)
261-261: Hard tabs
Column: 1
(MD010, no-hard-tabs)
262-262: Hard tabs
Column: 1
(MD010, no-hard-tabs)
263-263: Hard tabs
Column: 1
(MD010, no-hard-tabs)
264-264: Hard tabs
Column: 1
(MD010, no-hard-tabs)
265-265: Hard tabs
Column: 1
(MD010, no-hard-tabs)
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| ```typescript | ||
| // src/run/newscript.ts | ||
| import { invoke } from '@agentuity/runtime'; | ||
|
|
||
| await invoke(async (ctx) => { | ||
| const input = JSON.parse(process.argv[2] || '{}'); | ||
|
|
||
| // Your SDK demonstration code here | ||
| const result = await ctx.kv.set('key', { value: input.data }); | ||
|
|
||
| console.log('---OUTPUT---'); | ||
| console.log(JSON.stringify({ success: true, result }, null, 2)); | ||
| console.log('---OUTPUT---'); | ||
| }); |
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.
Replace hard tabs with spaces in code samples.
markdownlint MD010 flags tabs in these fenced blocks; use spaces to keep lint clean.
Also applies to: 191-205, 268-280
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
178-178: Hard tabs
Column: 1
(MD010, no-hard-tabs)
180-180: Hard tabs
Column: 1
(MD010, no-hard-tabs)
181-181: Hard tabs
Column: 1
(MD010, no-hard-tabs)
183-183: Hard tabs
Column: 1
(MD010, no-hard-tabs)
184-184: Hard tabs
Column: 1
(MD010, no-hard-tabs)
185-185: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🤖 Prompt for AI Agents
In `@apps/docs/src/run/AGENTS.md` around lines 173 - 186, The fenced TypeScript
sample uses hard tabs which triggers markdownlint MD010; replace all hard tab
characters with spaces in the code block(s) containing the invoke example (the
block showing invoke(async (ctx) => { ... }) and calls like ctx.kv.set) and in
the other similar fenced blocks mentioned so they use only spaces for
indentation; ensure you update all occurrences so linting no longer reports
MD010.
| // Apply line decorations when editor mounts | ||
| const handleEditorMount: OnMount = useCallback( | ||
| (editor, monaco) => { | ||
| if (!highlights?.length) return; | ||
|
|
||
| const decorations = highlights.map((h) => { | ||
| const [startLine, endLine] = | ||
| typeof h.lines === "number" ? [h.lines, h.lines] : h.lines; | ||
| const styleClass = | ||
| h.className === "subtle" | ||
| ? "line-highlight-subtle" | ||
| : "line-highlight-important"; | ||
|
|
||
| return { | ||
| range: new monaco.Range(startLine, 1, endLine, 1), | ||
| options: { | ||
| isWholeLine: true, | ||
| className: styleClass, | ||
| }, | ||
| }; | ||
| }); | ||
|
|
||
| editor.createDecorationsCollection(decorations); | ||
| }, | ||
| [highlights] | ||
| ); |
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.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for line-highlight CSS class definitions in various file types
echo "=== Searching for CSS class definitions ==="
rg "line-highlight" --type=css --type=scss -A 2 || echo "No matches in CSS/SCSS"
echo -e "\n=== Searching in all files ==="
rg "line-highlight" -A 2
echo -e "\n=== Checking Tailwind configuration ==="
fd -e config -e js -e ts | xargs grep -l "tailwind" 2>/dev/null | head -5Repository: agentuity/sdk
Length of output: 689
🏁 Script executed:
#!/bin/bash
# Check if classes are defined inline or in CSS-in-JS
echo "=== Checking CodeBlock.tsx for style definitions ==="
cat -n apps/docs/src/web/components/CodeBlock.tsx | grep -A 5 -B 5 "style\|css\|className" | head -50
echo -e "\n=== Searching for any global stylesheet ==="
fd -e css -e scss | head -20
echo -e "\n=== Checking if styles are in a separate module ==="
fd "CodeBlock" --type fRepository: agentuity/sdk
Length of output: 2399
🏁 Script executed:
#!/bin/bash
# Check global stylesheets that might apply to CodeBlock
echo "=== Checking styles.css files ==="
fd "styles.css" -o "App.css"
echo -e "\n=== Checking for any CSS file in apps/docs ==="
fd -e css apps/docs/
echo -e "\n=== Checking if line-highlight is defined anywhere else ==="
rg "line-highlight-" . --type=ts --type=tsx --type=cssRepository: agentuity/sdk
Length of output: 724
🏁 Script executed:
#!/bin/bash
# Correct search for CSS files and line-highlight definitions
echo "=== Checking for CSS files in apps/docs ==="
find apps/docs -name "*.css" -o -name "*.scss" 2>/dev/null
echo -e "\n=== Checking entire apps/docs structure ==="
find apps/docs -type f \( -name "*.css" -o -name "*.scss" \) | head -20
echo -e "\n=== Final verification: line-highlight anywhere ==="
grep -r "line-highlight" . --include="*.css" --include="*.scss" --include="*.ts" --include="*.tsx" 2>/dev/null || echo "No line-highlight definitions found"
echo -e "\n=== Check if CodeBlock.tsx has any <style> tag ==="
grep -n "style>" apps/docs/src/web/components/CodeBlock.tsx || echo "No inline style tag found"Repository: agentuity/sdk
Length of output: 434
Define CSS classes for line highlighting in Monaco editor.
The handleEditorMount callback applies Monaco decorations with class names line-highlight-subtle and line-highlight-important, but these CSS classes are not defined anywhere in the codebase. Add these styles to your global stylesheet or Tailwind configuration so the highlighting renders visually.
🤖 Prompt for AI Agents
In `@apps/docs/src/web/components/CodeBlock.tsx` around lines 30 - 55, The Monaco
decorations in the handleEditorMount callback reference CSS classes
line-highlight-subtle and line-highlight-important that aren’t defined; add
corresponding styles to your global stylesheet or Tailwind config (or
component/global CSS module) so those classes provide visible line background
(and any desired padding/border) when applied by
editor.createDecorationsCollection in CodeBlock.tsx; update whichever global
style entrypoint you use (e.g., globals.css or tailwind config) to include
.line-highlight-subtle and .line-highlight-important with appropriate
background-color/opacity and ensure they are loaded into the app.
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.
Actionable comments posted: 5
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/docs/src/web/App.tsx (1)
496-505: Conflicting ARIA attributes on SVG.
aria-hidden="true"hides the element from assistive technologies, makingaria-label="Agentuity Logo"ineffective. Choose one approach:
- Decorative: Keep
aria-hidden="true", removearia-label- Semantic: Remove
aria-hidden="true", keeparia-labelSince there's adjacent text ("SDK Explorer"), the logo is likely decorative.
🛠️ Suggested fix (decorative logo)
<svg aria-hidden="true" - aria-label="Agentuity Logo" className={className}
🤖 Fix all issues with AI agents
In `@apps/docs/AGENTS.md`:
- Around line 114-121: The docs note a manual copy workflow between src/run/*.ts
and scripts.ts (which contains SCRIPT_DEFAULTS) and request automation:
implement a prebuild generator that reads all src/run/*.ts files, inlines their
contents into scripts.ts (replacing the template literal entries and updating
SCRIPT_DEFAULTS), and add a validation step (precommit or CI) that compares
generated scripts.ts against source files to fail the build on drift; wire this
into package.json scripts so building runs the generator before Bun.build and
the validator runs in CI.
In `@apps/docs/src/api/sandbox/route.ts`:
- Around line 19-23: The regex literal containing the control character in
function cleanOutput (the /\x1b\[[0-9;]*m/g pattern) triggers Biome's
noControlCharactersInRegex rule; replace it by defining a constant RegExp via
the RegExp constructor (e.g., const ansiEscape = new RegExp(...)) and use that
constant in cleanOutput, leaving the other replacements unchanged; update any
references to the literal in this file to use the new symbol (e.g., ansiEscape)
so the control character is not in a regex literal.
In `@apps/docs/src/run/durable-stream.ts`:
- Around line 18-20: The JSON.parse call for const input should be moved inside
the existing try-catch so malformed JSON doesn't crash the script; inside the
try, parse process.argv[2] (falling back to '{}' if undefined) and then derive
content from input.content (keeping the existing default string), and in the
catch block emit the same '---OUTPUT---' error block with the parsing error
message and exit non-zero; update references to the input and content variables
accordingly so the rest of durable-stream.ts uses the parsed input only after
successful parsing.
In `@apps/docs/src/web/AGENTS.md`:
- Around line 178-204: The SDK Explorer code block contains hard tabs which
violate markdownlint MD010; replace all hard tab characters with spaces in that
block (specifically inside the example using useSandboxRunner, the MyDemo
component, and the TerminalOutput usage) so indentation uses spaces
consistently; ensure the import line, function signature, const destructuring,
handleRun, JSX elements (button, TerminalOutput) and their nested lines are
converted to spaces and reflowed to match surrounding Markdown formatting.
In `@apps/docs/src/web/components/CodeBlock.tsx`:
- Around line 11-18: The CodeBlock component can call an undefined onRun when
showRunButton is true; update the CodeBlockProps (or the click handler in the
CodeBlock component) to prevent this: either make the props discriminated so
showRunButton: true requires onRun (and showRunButton?: false forbids it) as
suggested, or add a runtime guard in the run button's onClick (in the CodeBlock
component) that checks typeof onRun === "function" before calling (and disable
the button or no-op if not). Reference CodeBlockProps and the run button click
handler inside the CodeBlock component to locate where to apply the fix.
♻️ Duplicate comments (7)
apps/docs/src/run/AGENTS.md (1)
173-186: Replace hard tabs with spaces in fenced code blocks.The TypeScript code samples use hard tabs which trigger markdownlint MD010. While the coding guidelines specify tabs for
.tsfiles, code blocks embedded in Markdown should use spaces for lint compliance.apps/docs/src/run/streaming.ts (1)
21-22: Move JSON parsing inside the try-catch block to handle invalid input gracefully.If
process.argv[2]contains malformed JSON,JSON.parsewill throw before entering the try-catch, causing the script to crash without the expected---OUTPUT---error block.Suggested fix
-const input: Input = JSON.parse(process.argv[2] ?? '{}'); -const prompt = input.prompt ?? 'Write a short poem about AI.'; - -const ctx = createAgentContext(); -ctx.logger.info('Streaming started', { prompt }); - -try { +const ctx = createAgentContext(); + +try { + const input: Input = JSON.parse(process.argv[2] ?? '{}'); + const prompt = input.prompt ?? 'Write a short poem about AI.'; + ctx.logger.info('Streaming started', { prompt }); + const { textStream } = streamText({apps/docs/src/run/sse-stream.ts (1)
21-25: Move JSON parsing inside the try-catch block.Past review already flagged this - if
process.argv[2]contains malformed JSON, the script crashes without the expected error block.apps/docs/src/api/sandbox/route.ts (1)
44-49: Decode base64 input as UTF‑8 to avoid Unicode corruption.The client encodes UTF‑8 bytes;
atob()returns a binary string which mangles non‑ASCII characters. Decode withBuffer.from(..., 'base64').toString('utf-8')beforeJSON.parse.🛠️ Suggested fix
- input = JSON.parse(atob(inputBase64)); + input = JSON.parse(Buffer.from(inputBase64, 'base64').toString('utf-8'));apps/docs/src/web/AGENTS.md (1)
235-240: Align TerminalOutput status union with useSandboxRunner (recreating).The example omits
recreating, which is documented and supported elsewhere.🛠️ Suggested fix
- status={status} // 'idle' | 'creating' | 'running' | 'completed' | 'error' + status={status} // 'idle' | 'creating' | 'recreating' | 'running' | 'completed' | 'error'apps/docs/src/web/code-examples.ts (1)
298-317: Add missingopenaiimports in durable-stream and evals examples.Both snippets call
openai(...)but never import it, breaking copy‑paste usage.🛠️ Suggested fix
- 'durable-stream': `// Create durable content with shareable URLs. + 'durable-stream': `// Create durable content with shareable URLs. // Unlike ephemeral streams, content persists forever. import { createRouter } from "@agentuity/runtime"; +import { openai } from "@ai-sdk/openai"; import { streamText } from "ai";- evals: `// Evals run automatically after your agent responds. + evals: `// Evals run automatically after your agent responds. // Define evaluations in a separate file alongside your agent. import { answerCompleteness } from "@agentuity/evals"; +import { openai } from "@ai-sdk/openai"; import { generateObject } from "ai"; import { z } from "zod";Also applies to: 452-483
apps/docs/src/web/components/CodeBlock.tsx (1)
37-59: Missing CSS class definitions for line highlighting.The Monaco decorations reference
line-highlight-subtleandline-highlight-importantclasses that need to be defined in your stylesheet for the highlighting to render visually.
🧹 Nitpick comments (5)
apps/docs/AGENTS.md (1)
99-143: Consider adding operational and security guidance.The Cloud Sandbox Architecture section is comprehensive but could benefit from mentioning:
- Security considerations (sandboxing isolation, input validation, code injection prevention)
- Error handling strategies (timeout handling, resource exhaustion, sandbox failures)
- Operational limits (rate limiting, execution time limits, resource constraints)
These considerations are important for production sandbox systems.
Suggested additions
Add a subsection after line 136:
**Security & Operational Considerations:** - **Isolation**: Sandboxes run in isolated environments with limited network and filesystem access - **Input Validation**: All user inputs are validated and sanitized before execution - **Timeouts**: Scripts have execution time limits to prevent resource exhaustion - **Rate Limiting**: API endpoints enforce rate limits to prevent abuse - **Resource Constraints**: Sandboxes have memory and CPU limits - **Error Recovery**: Failed sandboxes are automatically cleaned up; errors are logged for debuggingapps/docs/src/web/components/HandlerContextDemo.tsx (1)
1-1: Derive the selected endpoint once for the info panel.This avoids repeated
findcalls and ensures the panel only renders when metadata is available.♻️ Suggested refactor
@@ export function HandlerContextDemo() { const [loading, setLoading] = useState(false); const [error, setError] = useState<string | null>(null); const [data, setData] = useState<unknown>(null); const [lastEndpoint, setLastEndpoint] = useState<string | null>(null); const [mockLogs, setMockLogs] = useState<LogEntry[]>([]); + const selectedEndpoint = lastEndpoint + ? endpoints.find((ep) => ep.id === lastEndpoint) + : null; @@ - {lastEndpoint && ( + {selectedEndpoint && ( <div className="bg-cyan-50/50 dark:bg-cyan-950/20 border border-cyan-200 dark:border-cyan-900 rounded-lg p-4"> <div className="flex items-center justify-between mb-2"> <code className="text-cyan-700 dark:text-cyan-400 font-mono text-sm"> - {endpoints.find((ep) => ep.id === lastEndpoint)?.codeHint} + {selectedEndpoint.codeHint} </code> @@ <p className="text-zinc-600 dark:text-zinc-400 text-sm"> - {endpoints.find((ep) => ep.id === lastEndpoint)?.explanation} + {selectedEndpoint.explanation} </p> </div> )}Also applies to: 237-258
apps/docs/src/run/durable-stream.ts (1)
53-56: Consider adding stdout flush for consistency with other run scripts.Other scripts like
streaming.tsinclude a stdout flush before exit to ensure output isn't lost in buffered environments.Suggested addition at end of file
// Ensure stdout is flushed before exit await new Promise<void>((resolve) => { process.stdout.write('', () => resolve()); });apps/docs/src/run/handler-context.ts (1)
50-56: Consider cleaning up thread state to align with documented cleanup philosophy.Per the AGENTS.md cleanup guidelines, demo scripts should delete their demo data to avoid polluting storage. The
demo-keyset here persists after execution.Suggested addition after line 56
console.log(` get("demo-key") -> ${JSON.stringify(stored)}`); + await ctx.thread.state.delete('demo-key'); console.log('');apps/docs/src/web/App.tsx (1)
684-686: Consider error boundary for demo components.Demo components are rendered without an error boundary. If a demo throws, it could crash the entire app. React 19 has improved error handling, but a localized boundary would provide better UX by isolating failures to the demo panel.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
apps/docs/src/generated/webanalytics.tsis excluded by!**/generated/**
📒 Files selected for processing (29)
apps/docs/AGENTS.mdapps/docs/agentuity-snapshot.yamlapps/docs/src/api/sandbox/route.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/AGENTS.mdapps/docs/src/run/agent-calls.tsapps/docs/src/run/ai-gateway.tsapps/docs/src/run/chat.tsapps/docs/src/run/cron.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/evals.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/hello.tsapps/docs/src/run/invoke.tsapps/docs/src/run/kv.tsapps/docs/src/run/model-arena.tsapps/docs/src/run/objectstore.tsapps/docs/src/run/sse-stream.tsapps/docs/src/run/streaming.tsapps/docs/src/run/vector.tsapps/docs/src/web/AGENTS.mdapps/docs/src/web/App.tsxapps/docs/src/web/code-examples.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/components/Typing.tsxapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/web/index.html
🚧 Files skipped from review as they are similar to previous changes (13)
- apps/docs/src/web/index.html
- apps/docs/src/run/kv.ts
- apps/docs/src/run/objectstore.ts
- apps/docs/src/run/invoke.ts
- apps/docs/src/run/evals.ts
- apps/docs/src/run/agent-calls.ts
- apps/docs/src/run/ai-gateway.ts
- apps/docs/src/run/hello.ts
- apps/docs/src/run/cron.ts
- apps/docs/src/run/vector.ts
- apps/docs/src/run/model-arena.ts
- apps/docs/src/run/chat.ts
- apps/docs/src/web/components/Typing.tsx
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use Prettier formatter with tabs (width 3), single quotes, and semicolons for TypeScript files
Use TypeScript strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
apps/docs/src/web/code-examples.tsapps/docs/src/run/sse-stream.tsapps/docs/src/api/sandbox/route.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/handler-context.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/api/sandbox/scripts.tsapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/run/streaming.tsapps/docs/src/web/App.tsx
apps/docs/src/web/**/*.{tsx,ts}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Use TypeScript/TSX syntax in React components; the Agentuity build system handles compilation automatically
Files:
apps/docs/src/web/code-examples.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/web/App.tsx
apps/docs/src/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Support hot module reloading in dev mode using import.meta.hot
Files:
apps/docs/src/web/code-examples.tsapps/docs/src/run/sse-stream.tsapps/docs/src/api/sandbox/route.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/handler-context.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/api/sandbox/scripts.tsapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/run/streaming.tsapps/docs/src/web/App.tsx
apps/docs/src/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/docs/src/web/AGENTS.md)
apps/docs/src/web/**/*.{ts,tsx}: Use TypeScript for type safety in React components
Wrap your app with AgentuityProvider for hooks to work
Place reusable components in separate files
Handle loading and error states in UI components
Use useAgent hook for one-off agent calls
Use useAgentWebsocket hook for bidirectional real-time communication
Use useAgentEventStream hook for server-to-client streaming
All agents are accessible via useAgent hook using agent name
Files:
apps/docs/src/web/code-examples.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/web/App.tsx
apps/docs/src/api/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
API routes should be implemented in the src/api/ directory following REST, streaming, SSE, and WebSocket patterns
Files:
apps/docs/src/api/sandbox/route.tsapps/docs/src/api/sandbox/scripts.ts
apps/docs/src/web/components/**/*.{tsx,ts,jsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
React frontend components should be located in src/web/components/ and use React 19 features
Files:
apps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/TerminalOutput.tsx
apps/docs/src/web/**/*.{tsx,jsx}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Use Tailwind CSS for styling in React components
Files:
apps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/App.tsx
apps/docs/src/web/App.tsx
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
The main React component should be implemented in App.tsx and configure demos according to the application structure
Files:
apps/docs/src/web/App.tsx
apps/docs/src/web/**/App.tsx
📄 CodeRabbit inference engine (apps/docs/src/web/AGENTS.md)
App.tsx must export a function named
App
Files:
apps/docs/src/web/App.tsx
🧠 Learnings (3)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.
Applied to files:
apps/docs/src/web/code-examples.tsapps/docs/src/run/sse-stream.tsapps/docs/src/api/sandbox/route.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/handler-context.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/web/hooks/useSandboxRunner.tsapps/docs/src/run/streaming.ts
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.
Applied to files:
apps/docs/src/api/sandbox/route.tsapps/docs/src/api/sandbox/scripts.ts
📚 Learning: 2026-01-09T16:26:51.893Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 523
File: templates/_base/src/web/frontend.tsx:13-35
Timestamp: 2026-01-09T16:26:51.893Z
Learning: In web frontend code, prefer using the built-in Error class for runtime errors. Do not throw or re-export StructuredError from agentuity/core in web app code. Replace instances of StructuredError with new Error or custom error types that extend Error; ensure error handling logic remains intact and that error messages are descriptive. This guideline applies to all web UI TypeScript/TSX files that run in the browser and import StructuredError from agentuity/core.
Applied to files:
apps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/TerminalOutput.tsxapps/docs/src/web/App.tsx
🧬 Code graph analysis (3)
apps/docs/src/web/components/CodeBlock.tsx (1)
apps/docs/src/web/components/ThemeContext.tsx (1)
useTheme(88-94)
apps/docs/src/web/hooks/useSandboxRunner.ts (2)
apps/docs/src/web/components/TerminalOutput.tsx (1)
TerminalStatus(3-3)packages/vscode/src/features/devServer/devServerManager.ts (1)
setState(25-29)
apps/docs/src/run/streaming.ts (1)
packages/cli/src/tui.ts (1)
prompt(1741-1762)
🪛 Biome (2.1.2)
apps/docs/src/api/sandbox/route.ts
[error] 20-20: Unexpected control character in a regular expression.
Control characters are unusual and potentially incorrect inputs, so they are disallowed.
(lint/suspicious/noControlCharactersInRegex)
🪛 markdownlint-cli2 (0.18.1)
apps/docs/src/web/AGENTS.md
178-178: Hard tabs
Column: 1
(MD010, no-hard-tabs)
180-180: Hard tabs
Column: 1
(MD010, no-hard-tabs)
181-181: Hard tabs
Column: 1
(MD010, no-hard-tabs)
183-183: Hard tabs
Column: 1
(MD010, no-hard-tabs)
184-184: Hard tabs
Column: 1
(MD010, no-hard-tabs)
185-185: Hard tabs
Column: 1
(MD010, no-hard-tabs)
194-194: Hard tabs
Column: 1
(MD010, no-hard-tabs)
195-195: Hard tabs
Column: 1
(MD010, no-hard-tabs)
203-203: Hard tabs
Column: 1
(MD010, no-hard-tabs)
204-204: Hard tabs
Column: 1
(MD010, no-hard-tabs)
apps/docs/src/run/AGENTS.md
178-178: Hard tabs
Column: 1
(MD010, no-hard-tabs)
180-180: Hard tabs
Column: 1
(MD010, no-hard-tabs)
181-181: Hard tabs
Column: 1
(MD010, no-hard-tabs)
183-183: Hard tabs
Column: 1
(MD010, no-hard-tabs)
184-184: Hard tabs
Column: 1
(MD010, no-hard-tabs)
185-185: Hard tabs
Column: 1
(MD010, no-hard-tabs)
194-194: Hard tabs
Column: 1
(MD010, no-hard-tabs)
195-195: Hard tabs
Column: 1
(MD010, no-hard-tabs)
203-203: Hard tabs
Column: 1
(MD010, no-hard-tabs)
204-204: Hard tabs
Column: 1
(MD010, no-hard-tabs)
273-273: Hard tabs
Column: 1
(MD010, no-hard-tabs)
275-275: Hard tabs
Column: 1
(MD010, no-hard-tabs)
276-276: Hard tabs
Column: 1
(MD010, no-hard-tabs)
277-277: Hard tabs
Column: 1
(MD010, no-hard-tabs)
278-278: Hard tabs
Column: 1
(MD010, no-hard-tabs)
279-279: Hard tabs
Column: 1
(MD010, no-hard-tabs)
280-280: Hard tabs
Column: 1
(MD010, no-hard-tabs)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Template Integration Tests
- GitHub Check: Framework Integration Tests (TanStack & Next.js)
- GitHub Check: Package Installation & Usage Test
- GitHub Check: Queue CLI Tests
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Build
🔇 Additional comments (30)
apps/docs/AGENTS.md (4)
10-10: Clear addition aligns with new functionality.The mention of cloud sandbox execution environment is consistent with the detailed architecture section below.
34-71: Well-structured documentation.The directory structure is clear, comprehensive, and includes helpful inline comments explaining the purpose of each directory.
123-129: No changes needed. The documentation correctly references "all 15 scripts"—verification confirms exactly 15 script files exist insrc/run/, and theSCRIPTSconstant inscripts.tscontains all of them as strings.
28-28: Verify React 19 compatibility and usage.React 19 includes significant breaking changes (ref as prop, removed APIs like propTypes/defaultProps for function components, new JSX transform requirements, TypeScript changes). Confirm the codebase has been properly migrated and tested with React 19.
Key changes to verify:
refis now a regular prop (noforwardRefneeded)- Removed:
propTypes,defaultPropsfor function components- Required: modern JSX transform (2020+)
- TypeScript:
useRefrequires an argument, ref callback return values cause errorsapps/docs/src/web/components/HandlerContextDemo.tsx (1)
12-95: Endpoint explanations and code hints read clearly.Nice improvement to the endpoint metadata; the richer explanations make the demo easier to follow.
apps/docs/src/run/streaming.ts (2)
33-39: LGTM!The streaming accumulation logic correctly collects chunks and tracks token count. The comment accurately notes that sandbox buffering means output appears at once.
53-56: LGTM!Good practice to ensure stdout is flushed before exit, preventing output loss in buffered environments.
apps/docs/src/run/durable-stream.ts (1)
27-52: LGTM!The durable stream workflow is well-structured: create → write → close → display URL. The demo effectively showcases the stream lifecycle and shareable URL feature.
apps/docs/agentuity-snapshot.yaml (2)
22-23: LGTM - Previous conflict resolved.The exclusion pattern at line 40 is now
!node_modules/**/tsconfig.json, which correctly excludes only nested tsconfig files within node_modules while preserving the roottsconfig.jsonincluded at line 23.Also applies to: 40-40
67-72: LGTM!Environment variables are properly templated using
${}syntax for runtime injection of secrets. Good practice to keep S3 credentials and SDK keys externalized.apps/docs/src/run/AGENTS.md (2)
1-31: LGTM!Well-structured documentation with clear purpose, directory structure (now with proper
textlanguage specifier), and comprehensive script reference. This provides excellent onboarding context for developers working with the run scripts.
155-168: Helpful context on script duplication rationale.Good documentation explaining why scripts exist both as files and as template literals in
scripts.ts- the Bun.build limitation with?rawimports is a legitimate constraint worth documenting.apps/docs/src/run/handler-context.ts (2)
17-23: LGTM!Good pattern demonstrating the distinction between
createAgentContext()(standalone context with "pending" IDs) andgetAgentContext()(real context from AsyncLocalStorage with actual IDs). The comment clearly explains why this two-step approach is needed.
65-68: LGTM!Error handling correctly catches exceptions and produces the expected
---OUTPUT---block format for sandbox parsing.apps/docs/src/run/sse-stream.ts (2)
27-47: LGTM!The streaming logic correctly accumulates chunks and counts tokens. The output format with
[Streamed N SSE events]clearly distinguishes this from the raw streaming demo.
53-56: LGTM!Stdout flush ensures output isn't lost in buffered environments, consistent with streaming.ts.
apps/docs/src/api/sandbox/scripts.ts (2)
8-657: LGTM: centralized sandbox script registry is clear and runnable.The embedded usage notes and cleanup steps make these demos easy to understand and execute.
659-677: LGTM: defaults mapping is sensible and UI-friendly.This keeps the UI inputs aligned with script expectations.
apps/docs/src/web/code-examples.ts (1)
1-7: LGTM: centralized CODE_EXAMPLES mapping is clean and reusable.Nice single source of truth for editor snippets.
apps/docs/src/web/hooks/useSandboxRunner.ts (1)
60-197: LGTM: solid SSE lifecycle handling and cleanup.State transitions, cleanup, and streaming aggregation are cleanly handled.
apps/docs/src/web/components/TerminalOutput.tsx (1)
14-125: LGTM: clear status mapping and output UX.The status-to-UI mapping and auto-scroll behavior look solid.
apps/docs/src/web/components/CodeBlock.tsx (3)
1-9: LGTM!Clean imports and well-defined
LineHighlightinterface with proper type narrowing for single line vs range.
69-117: LGTM!Run button implementation with loading state, spinner animation, and proper disabled styling.
165-196: LGTM!Monaco Editor configuration is well-suited for a read-only code viewer: minimap disabled, context menu off, proper scrollbar sizing, and theme synchronization.
apps/docs/src/web/App.tsx (6)
1-24: LGTM!Imports are well-organized with clear groupings: external packages, local data, components, and hooks.
42-58: LGTM!Interface extensions cleanly add sandbox and highlighting capabilities. Using
unknownforsandboxInputprovides flexibility for varying input shapes across demos.
659-668: LGTM!The
postMessagenavigation pattern is appropriate for iframe embedding, allowing the parent frame to handle routing. Path extraction correctly handles both absolute URLs and relative paths.
689-716: LGTM!Clean conditional rendering based on
sandboxEnabled. Terminal output correctly receives sandbox state with test mode fallbacks.
732-783: LGTM!URL-based navigation with browser history integration is well-implemented. Provider hierarchy correctly wraps components with
ThemeProviderandAgentuityProviderper guidelines.
614-625: No action needed. TheuseSandboxRunnerhook already memoizes bothrunandresetwithuseCallbackand empty dependency arrays, ensuring stable references. Using them in dependency arrays is safe and correct.Likely an incorrect or invalid review comment.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| ## SDK Explorer Components | ||
|
|
||
| ### useSandboxRunner Hook | ||
|
|
||
| Custom hook for executing scripts in cloud sandboxes via SSE: | ||
|
|
||
| ```typescript | ||
| import { useSandboxRunner } from './hooks/useSandboxRunner'; | ||
|
|
||
| function MyDemo() { | ||
| const { status, output, error, exitCode, run } = useSandboxRunner(); | ||
|
|
||
| const handleRun = () => { | ||
| run('hello', { name: 'World' }); // script name, input object | ||
| }; | ||
|
|
||
| return ( | ||
| <div> | ||
| <button onClick={handleRun} disabled={status === 'running'}> | ||
| Run | ||
| </button> | ||
| <TerminalOutput status={status} output={output} exitCode={exitCode} /> | ||
| </div> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
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.
Replace hard tabs in SDK Explorer section (markdownlint MD010).
Tabs are flagged by markdownlint; swap them for spaces in this block to keep lint clean.
🛠️ Example adjustment
- ### useSandboxRunner Hook
+### useSandboxRunner Hook🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
178-178: Hard tabs
Column: 1
(MD010, no-hard-tabs)
180-180: Hard tabs
Column: 1
(MD010, no-hard-tabs)
181-181: Hard tabs
Column: 1
(MD010, no-hard-tabs)
183-183: Hard tabs
Column: 1
(MD010, no-hard-tabs)
184-184: Hard tabs
Column: 1
(MD010, no-hard-tabs)
185-185: Hard tabs
Column: 1
(MD010, no-hard-tabs)
194-194: Hard tabs
Column: 1
(MD010, no-hard-tabs)
195-195: Hard tabs
Column: 1
(MD010, no-hard-tabs)
203-203: Hard tabs
Column: 1
(MD010, no-hard-tabs)
204-204: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🤖 Prompt for AI Agents
In `@apps/docs/src/web/AGENTS.md` around lines 178 - 204, The SDK Explorer code
block contains hard tabs which violate markdownlint MD010; replace all hard tab
characters with spaces in that block (specifically inside the example using
useSandboxRunner, the MyDemo component, and the TerminalOutput usage) so
indentation uses spaces consistently; ensure the import line, function
signature, const destructuring, handleRun, JSX elements (button, TerminalOutput)
and their nested lines are converted to spaces and reflowed to match surrounding
Markdown formatting.
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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@apps/docs/src/api/sandbox/route.ts`:
- Around line 68-73: The sendRunningOnce helper currently calls
stream.writeSSE({ event: 'status', data: 'running' }) without awaiting it,
causing a potential race; make sendRunningOnce async, await stream.writeSSE(...)
inside it and keep the sentRunning guard, and then update all call sites (where
sendRunningOnce() is invoked) to await sendRunningOnce() so the "running" SSE is
emitted before subsequent stdout/event writes; ensure you reference the
sentRunning flag, sendRunningOnce function, and stream.writeSSE call when making
the changes.
In `@apps/docs/src/run/model-arena.ts`:
- Line 9: The top-of-file comment incorrectly says "Groq as judge"; update that
comment to accurately reflect the actual judge model in use by naming OpenAI
(gpt-5-nano) — e.g., replace "Uses OpenAI vs Anthropic with Groq as judge" with
"Uses OpenAI vs Anthropic with OpenAI (gpt-5-nano) as judge" so the comment
matches the code that sets the judge to gpt-5-nano.
♻️ Duplicate comments (1)
apps/docs/src/web/components/CodeBlock.tsx (1)
37-59: Verify CSS class definitions for line highlighting exist.The decoration classes
line-highlight-subtleandline-highlight-important(lines 44-45) are applied to Monaco editor decorations, but these CSS classes need to be defined in a global stylesheet for the highlighting to be visible.#!/bin/bash # Search for the CSS class definitions in the codebase echo "=== Searching for line-highlight CSS classes ===" rg "line-highlight-subtle|line-highlight-important" --type=css -A 2 echo -e "\n=== Searching in all files including inline styles ===" rg "line-highlight-(subtle|important)" -g "*.css" -g "*.scss" -g "*.html" -g "index.html" echo -e "\n=== Check index.html for inline styles ===" cat apps/docs/src/web/index.html | grep -A 10 "line-highlight" || echo "No inline styles found"
🧹 Nitpick comments (6)
apps/docs/src/run/model-arena.ts (1)
44-44: Remove unusedctxvariable.The
createAgentContext()is called butctxis never used in the script. This is dead code that should be removed.-const ctx = createAgentContext();apps/docs/src/api/sandbox/route.ts (2)
56-58: Handle potentially undefined script default.If a script exists in
SCRIPTSbut has no corresponding entry inSCRIPT_DEFAULTS, theinputwill beundefined, which may cause issues downstream when passed toJSON.stringify(input)at line 134.Consider providing a fallback empty object:
} else { - input = SCRIPT_DEFAULTS[scriptName]; + input = SCRIPT_DEFAULTS[scriptName] ?? {}; }
97-102: Remove redundant script content check.The
scriptContentcheck on lines 99-102 is redundant because line 39 already validates thatscriptNameexists inSCRIPTS. If validation passes,SCRIPTS[scriptName]is guaranteed to exist.const scriptPath = `src/run/${scriptName}.ts`; const scriptContent = SCRIPTS[scriptName]; -if (!scriptContent) { - await stream.writeSSE({ event: 'error', data: `Script not found: ${scriptName}` }); - return; -}apps/docs/src/web/code-examples.ts (2)
339-376: Add type definition forMessagein the chat example.The
Message[]type on line 352 is used but not defined, which would cause a TypeScript error if users copy this code directly.Consider adding the type definition at the beginning of the example:
chat: `// Multi-turn chat with thread and session state // Demonstrates: thread state, session state APIs import { createAgentContext } from "@agentuity/runtime"; import { openai } from "@ai-sdk/openai"; import { generateText } from "ai"; + +interface Message { + role: "user" | "assistant"; + content: string; +} const ctx = createAgentContext();
378-423: DefineuserPromptvariable in the model-arena example.The
userPromptvariable (line 401, 405, 413) is used but not defined in this code example. Users copying this code would get a reference error.'model-arena': `// LLM-as-Judge: Have one model evaluate outputs from other models. // Pattern: Generate responses in parallel, then use generateObject() // to get structured evaluation with guaranteed schema compliance. import { anthropic } from "@ai-sdk/anthropic"; import { openai } from "@ai-sdk/openai"; import { generateText, generateObject } from "ai"; import { z } from "zod"; + +const userPrompt = "Write a creative one-liner about programming.";apps/docs/src/web/components/HandlerContextDemo.tsx (1)
237-261: Consider extracting the endpoint lookup outside JSX.The IIFE pattern works but is unconventional in JSX. Consider extracting the selected endpoint lookup for cleaner code:
+ const selectedEndpoint = lastEndpoint + ? endpoints.find((ep) => ep.id === lastEndpoint) + : null; + return ( <div className="flex flex-col gap-6"> ... {/* Explanation for selected endpoint */} - {lastEndpoint && (() => { - const selectedEndpoint = endpoints.find((ep) => ep.id === lastEndpoint); - return ( - <div className="bg-cyan-50/50 ..."> + {selectedEndpoint && ( + <div className="bg-cyan-50/50 ..."> ... - </div> - ); - })()} + </div> + )}This makes the conditional rendering more idiomatic and easier to follow.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
apps/docs/src/api/sandbox/route.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/model-arena.tsapps/docs/src/run/sse-stream.tsapps/docs/src/run/streaming.tsapps/docs/src/web/code-examples.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/components/HandlerContextDemo.tsx
🚧 Files skipped from review as they are similar to previous changes (4)
- apps/docs/src/run/streaming.ts
- apps/docs/src/api/sandbox/scripts.ts
- apps/docs/src/run/durable-stream.ts
- apps/docs/src/run/sse-stream.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use Prettier formatter with tabs (width 3), single quotes, and semicolons for TypeScript files
Use TypeScript strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
apps/docs/src/run/handler-context.tsapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/run/model-arena.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/code-examples.tsapps/docs/src/api/sandbox/route.ts
apps/docs/src/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Support hot module reloading in dev mode using import.meta.hot
Files:
apps/docs/src/run/handler-context.tsapps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/run/model-arena.tsapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/code-examples.tsapps/docs/src/api/sandbox/route.ts
apps/docs/src/web/components/**/*.{tsx,ts,jsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
React frontend components should be located in src/web/components/ and use React 19 features
Files:
apps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/CodeBlock.tsx
apps/docs/src/web/**/*.{tsx,jsx}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Use Tailwind CSS for styling in React components
Files:
apps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/CodeBlock.tsx
apps/docs/src/web/**/*.{tsx,ts}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Use TypeScript/TSX syntax in React components; the Agentuity build system handles compilation automatically
Files:
apps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/code-examples.ts
apps/docs/src/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/docs/src/web/AGENTS.md)
apps/docs/src/web/**/*.{ts,tsx}: Use TypeScript for type safety in React components
Wrap your app with AgentuityProvider for hooks to work
Place reusable components in separate files
Handle loading and error states in UI components
Use useAgent hook for one-off agent calls
Use useAgentWebsocket hook for bidirectional real-time communication
Use useAgentEventStream hook for server-to-client streaming
All agents are accessible via useAgent hook using agent name
Files:
apps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/CodeBlock.tsxapps/docs/src/web/code-examples.ts
apps/docs/src/api/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
API routes should be implemented in the src/api/ directory following REST, streaming, SSE, and WebSocket patterns
Files:
apps/docs/src/api/sandbox/route.ts
🧠 Learnings (3)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.
Applied to files:
apps/docs/src/run/handler-context.tsapps/docs/src/run/model-arena.tsapps/docs/src/web/code-examples.tsapps/docs/src/api/sandbox/route.ts
📚 Learning: 2026-01-09T16:26:51.893Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 523
File: templates/_base/src/web/frontend.tsx:13-35
Timestamp: 2026-01-09T16:26:51.893Z
Learning: In web frontend code, prefer using the built-in Error class for runtime errors. Do not throw or re-export StructuredError from agentuity/core in web app code. Replace instances of StructuredError with new Error or custom error types that extend Error; ensure error handling logic remains intact and that error messages are descriptive. This guideline applies to all web UI TypeScript/TSX files that run in the browser and import StructuredError from agentuity/core.
Applied to files:
apps/docs/src/web/components/HandlerContextDemo.tsxapps/docs/src/web/components/CodeBlock.tsx
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.
Applied to files:
apps/docs/src/api/sandbox/route.ts
🧬 Code graph analysis (2)
apps/docs/src/run/model-arena.ts (2)
apps/docs/src/agent/model-arena/types.ts (1)
Judgment(67-67)packages/cli/src/tui.ts (1)
output(435-437)
apps/docs/src/web/components/CodeBlock.tsx (1)
apps/docs/src/web/components/ThemeContext.tsx (1)
useTheme(88-94)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Template Integration Tests
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: Build
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Framework Integration Tests (TanStack & Next.js)
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Sandbox CLI Tests
🔇 Additional comments (7)
apps/docs/src/run/model-arena.ts (1)
49-94: LGTM!The parallel generation pattern with
Promise.all, JSON parsing with fallback, output buffering, and stdout flush before exit are all well-implemented for a sandbox demo script.apps/docs/src/run/handler-context.ts (1)
19-71: LGTM!The script correctly demonstrates the AgentContext API by using
invoke()to obtain a context with real IDs from AsyncLocalStorage. The demonstration of identifiers, logger, storage access, thread state, and session state is comprehensive and well-structured.apps/docs/src/api/sandbox/route.ts (1)
30-163: LGTM on overall structure.The SSE streaming implementation, sandbox configuration, environment variable setup, and error handling are well-structured. The exit code detection from stdout and the completion logging provide good observability.
apps/docs/src/web/code-examples.ts (1)
1-6: LGTM on structure and documentation.The file header clearly distinguishes these as educational examples separate from the executable scripts in
src/run/*.ts. The centralized CODE_EXAMPLES constant provides a clean API for Monaco editor integration.apps/docs/src/web/components/HandlerContextDemo.tsx (1)
12-97: LGTM on endpoint enhancements.The addition of
explanationandcodeHintfields to all endpoints provides valuable context for users. The React fragments for explanations properly structure the inline code elements.apps/docs/src/web/components/CodeBlock.tsx (2)
69-117: LGTM on run button implementation.The run button correctly uses optional chaining (
onRun?.()) to guard against undefined callbacks. The loading state with spinner animation and disabled styling provides good UX feedback.
165-196: LGTM on Monaco Editor configuration.The Monaco editor is well-configured for a read-only code display: minimap disabled, appropriate font size, controlled scrollbars, and proper padding. The theme switching based on
resolvedThemecorrectly integrates with the app's theme system.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/docs/src/api/AGENTS.md (1)
234-248: Outdated example uses deprecated agent access pattern.Line 236 still uses
c.agent.myAgent.run(), which contradicts the documented pattern change emphasized throughout this file (lines 94, 156, 425-426). This inconsistency will confuse users.📝 Proposed fix to align with direct import pattern
+import myAgent from '../../agent/myAgent/agent'; + router.get('/', async (c) => { try { - const result = await c.agent.myAgent.run({ data: 'test' }); + const result = await myAgent.run({ data: 'test' }); return c.json({ success: true, result }); } catch (error) { c.var.logger.error('Agent call failed:', error);
🤖 Fix all issues with AI agents
In `@apps/docs/src/run/model-arena.ts`:
- Around line 41-42: The CLI currently calls JSON.parse directly for
process.argv[2] (setting const input) which can throw before your try/catch;
replace that raw parse with the safe parseJSON helper (or wrap the parse in
try/catch) so invalid JSON falls back to a safe default object and preserves
buffered error output; update the code that sets input and userPrompt (variables
input and userPrompt in model-arena.ts) to use parseJSON(process.argv[2] ??
'{}') and keep the existing default prompt logic.
🧹 Nitpick comments (6)
apps/docs/src/api/AGENTS.md (1)
13-13: Consider adding language identifier to code block.The fenced code block on line 13 lacks a language identifier. Adding
```textor```plaintextwould satisfy the markdownlint rule and improve syntax highlighting.📋 Proposed fix
-``` +```text src/api/ ├── index.ts # Empty router (mounted at /api)apps/docs/src/run/model-arena.ts (2)
90-96: Addimport.meta.hotguard for docs HMR.Docs TS files should support HMR in dev. Add a guarded
import.meta.hot.accept()to align with the docs guideline. As per coding guidelines, ...✅ Proposed change
console.log(output.join('\n')); // Ensure stdout is flushed before exit await new Promise<void>((resolve) => { process.stdout.write('', () => resolve()); }); + +if (import.meta.hot) { + import.meta.hot.accept(); +}
86-88: Consider using StructuredError for consistency with error handling guidelines (optional).The current error handling pattern aligns with the coding guideline to use
StructuredErrorfrom@agentuity/core. However, this is an example/demonstration file in the docs directory. While other example files inapps/docs/src/currently use the sameinstanceof Errorpattern, aligning withStructuredErrorwould improve consistency with the repo's standard error handling approach. This is a recommended improvement rather than a critical fix, as it does not impact functionality and matches common practices in the docs directory.apps/docs/scripts/create-deps-snapshot.sh (3)
23-23: Harden bash error handling with-uandpipefail.Line 23:
set -ewon’t catch unset vars or pipeline failures (e.g., thegreppipeline).♻️ Proposed update
-set -e +set -euo pipefail
48-56: Usemktempand clean up the temp package.json.The fixed
/tmp/deps-package.jsonpath can collide between parallel runs and isn’t cleaned up.♻️ Proposed update
-# Cleanup on exit -cleanup() { - echo "Cleaning up sandbox..." - agentuity cloud sandbox delete "$SANDBOX_ID" --confirm --org-id "$AGENTUITY_ORG_ID" 2>/dev/null || true -} -trap cleanup EXIT +DEPS_PKG_JSON="" +cleanup() { + echo "Cleaning up sandbox..." + agentuity cloud sandbox delete "$SANDBOX_ID" --confirm --org-id "$AGENTUITY_ORG_ID" 2>/dev/null || true + if [ -n "${DEPS_PKG_JSON:-}" ]; then + rm -f "$DEPS_PKG_JSON" + fi +} +trap cleanup EXIT # Create package.json with dependencies -cat > /tmp/deps-package.json << 'EOF' +DEPS_PKG_JSON="$(mktemp -t deps-package.XXXXXX.json)" +cat > "$DEPS_PKG_JSON" << 'EOF' @@ -echo "Uploading package.json..." -agentuity cloud sandbox cp --org-id "$AGENTUITY_ORG_ID" /tmp/deps-package.json "$SANDBOX_ID":/home/agentuity/package.json +echo "Uploading package.json..." +agentuity cloud sandbox cp --org-id "$AGENTUITY_ORG_ID" "$DEPS_PKG_JSON" "$SANDBOX_ID":/home/agentuity/package.jsonAlso applies to: 74-76
33-38: Use--jsonflag for structured output instead of grep parsing.Lines 33–38: The current grep-based parsing is fragile and prone to breakage if CLI output changes. The
agentuity cloud sandbox createcommand supports the--jsonflag (or--format json), which allows reliable extraction of the sandbox ID using tools likejqinstead of regex.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
apps/docs/agentuity-snapshot.yamlapps/docs/scripts/create-deps-snapshot.shapps/docs/src/api/AGENTS.mdapps/docs/src/api/agent-calls/route.tsapps/docs/src/api/context/route.tsapps/docs/src/api/durable-stream/route.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/model-arena.tsapps/docs/src/web/code-examples.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/docs/src/api/sandbox/scripts.ts
- apps/docs/agentuity-snapshot.yaml
- apps/docs/src/web/code-examples.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use Prettier formatter with tabs (width 3), single quotes, and semicolons for TypeScript files
Use TypeScript strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
apps/docs/src/api/agent-calls/route.tsapps/docs/src/api/durable-stream/route.tsapps/docs/src/api/context/route.tsapps/docs/src/run/model-arena.ts
apps/docs/src/api/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
API routes should be implemented in the src/api/ directory following REST, streaming, SSE, and WebSocket patterns
Files:
apps/docs/src/api/agent-calls/route.tsapps/docs/src/api/durable-stream/route.tsapps/docs/src/api/context/route.ts
apps/docs/src/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Support hot module reloading in dev mode using import.meta.hot
Files:
apps/docs/src/api/agent-calls/route.tsapps/docs/src/api/durable-stream/route.tsapps/docs/src/api/context/route.tsapps/docs/src/run/model-arena.ts
🧠 Learnings (2)
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.
Applied to files:
apps/docs/src/api/agent-calls/route.tsapps/docs/src/api/durable-stream/route.tsapps/docs/src/api/context/route.ts
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.
Applied to files:
apps/docs/src/api/agent-calls/route.tsapps/docs/src/api/durable-stream/route.tsapps/docs/src/api/context/route.tsapps/docs/src/run/model-arena.ts
🧬 Code graph analysis (4)
apps/docs/src/api/agent-calls/route.ts (1)
apps/testing/nextjs-app/agentuity/.agentuity/app.js (1)
c(23363-23369)
apps/docs/src/api/durable-stream/route.ts (1)
apps/testing/nextjs-app/agentuity/.agentuity/app.js (1)
c(23363-23369)
apps/docs/src/api/context/route.ts (1)
apps/testing/nextjs-app/agentuity/.agentuity/app.js (1)
c(23363-23369)
apps/docs/src/run/model-arena.ts (2)
apps/docs/src/agent/model-arena/types.ts (1)
Judgment(67-67)packages/cli/src/tui.ts (1)
output(435-437)
🪛 markdownlint-cli2 (0.18.1)
apps/docs/src/api/AGENTS.md
13-13: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
103-103: Hard tabs
Column: 1
(MD010, no-hard-tabs)
104-104: Hard tabs
Column: 1
(MD010, no-hard-tabs)
106-106: Hard tabs
Column: 1
(MD010, no-hard-tabs)
107-107: Hard tabs
Column: 1
(MD010, no-hard-tabs)
108-108: Hard tabs
Column: 1
(MD010, no-hard-tabs)
109-109: Hard tabs
Column: 1
(MD010, no-hard-tabs)
114-114: Hard tabs
Column: 1
(MD010, no-hard-tabs)
115-115: Hard tabs
Column: 1
(MD010, no-hard-tabs)
262-262: Hard tabs
Column: 1
(MD010, no-hard-tabs)
263-263: Hard tabs
Column: 1
(MD010, no-hard-tabs)
264-264: Hard tabs
Column: 1
(MD010, no-hard-tabs)
265-265: Hard tabs
Column: 1
(MD010, no-hard-tabs)
266-266: Hard tabs
Column: 1
(MD010, no-hard-tabs)
268-268: Hard tabs
Column: 1
(MD010, no-hard-tabs)
269-269: Hard tabs
Column: 1
(MD010, no-hard-tabs)
270-270: Hard tabs
Column: 1
(MD010, no-hard-tabs)
271-271: Hard tabs
Column: 1
(MD010, no-hard-tabs)
272-272: Hard tabs
Column: 1
(MD010, no-hard-tabs)
273-273: Hard tabs
Column: 1
(MD010, no-hard-tabs)
274-274: Hard tabs
Column: 1
(MD010, no-hard-tabs)
275-275: Hard tabs
Column: 1
(MD010, no-hard-tabs)
277-277: Hard tabs
Column: 1
(MD010, no-hard-tabs)
278-278: Hard tabs
Column: 1
(MD010, no-hard-tabs)
279-279: Hard tabs
Column: 1
(MD010, no-hard-tabs)
280-280: Hard tabs
Column: 1
(MD010, no-hard-tabs)
281-281: Hard tabs
Column: 1
(MD010, no-hard-tabs)
306-306: Hard tabs
Column: 1
(MD010, no-hard-tabs)
307-307: Hard tabs
Column: 1
(MD010, no-hard-tabs)
308-308: Hard tabs
Column: 1
(MD010, no-hard-tabs)
309-309: Hard tabs
Column: 1
(MD010, no-hard-tabs)
310-310: Hard tabs
Column: 1
(MD010, no-hard-tabs)
311-311: Hard tabs
Column: 1
(MD010, no-hard-tabs)
312-312: Hard tabs
Column: 1
(MD010, no-hard-tabs)
330-330: Hard tabs
Column: 1
(MD010, no-hard-tabs)
331-331: Hard tabs
Column: 1
(MD010, no-hard-tabs)
332-332: Hard tabs
Column: 1
(MD010, no-hard-tabs)
333-333: Hard tabs
Column: 1
(MD010, no-hard-tabs)
335-335: Hard tabs
Column: 1
(MD010, no-hard-tabs)
336-336: Hard tabs
Column: 1
(MD010, no-hard-tabs)
337-337: Hard tabs
Column: 1
(MD010, no-hard-tabs)
338-338: Hard tabs
Column: 1
(MD010, no-hard-tabs)
340-340: Hard tabs
Column: 1
(MD010, no-hard-tabs)
341-341: Hard tabs
Column: 1
(MD010, no-hard-tabs)
342-342: Hard tabs
Column: 1
(MD010, no-hard-tabs)
343-343: Hard tabs
Column: 1
(MD010, no-hard-tabs)
357-357: Hard tabs
Column: 1
(MD010, no-hard-tabs)
359-359: Hard tabs
Column: 1
(MD010, no-hard-tabs)
360-360: Hard tabs
Column: 1
(MD010, no-hard-tabs)
361-361: Hard tabs
Column: 1
(MD010, no-hard-tabs)
362-362: Hard tabs
Column: 1
(MD010, no-hard-tabs)
363-363: Hard tabs
Column: 1
(MD010, no-hard-tabs)
365-365: Hard tabs
Column: 1
(MD010, no-hard-tabs)
366-366: Hard tabs
Column: 1
(MD010, no-hard-tabs)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: Storage CLI Tests
- GitHub Check: Framework Integration Tests (TanStack & Next.js)
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Template Integration Tests
- GitHub Check: Pack & Upload
- GitHub Check: Build
🔇 Additional comments (12)
apps/docs/src/api/context/route.ts (1)
74-84: LGTM! Consistent API migration for background tasks.The change from
c.waitUntiltoc.var.waitUntilaligns with how other context variables (c.var.logger,c.var.session, etc.) are accessed throughout this file, maintaining consistency.apps/docs/src/api/durable-stream/route.ts (1)
96-97: LGTM! Background task scheduling updated consistently.The migration to
c.var.waitUntilis applied correctly. ThegenerateInBackground()function has proper error handling and ensures the stream is closed in thefinallyblock, which is good practice.apps/docs/src/api/agent-calls/route.ts (1)
63-73: LGTM! Background task scheduling migrated correctly.The change to
c.var.waitUntilis consistent with the pattern applied across all API route files in this PR. The task includes proper logging withtaskIdfor traceability.apps/docs/src/api/AGENTS.md (6)
11-33: LGTM! Comprehensive route documentation.The updated directory structure clearly documents all new routes, including the sandbox execution endpoint mentioned in the PR objectives.
94-124: LGTM! Clear demonstration of the new agent invocation pattern.The examples properly show direct agent imports and the
.run()method usage, along with the validator pattern. This aligns well with the documented API changes.
156-156: LGTM! Important clarification of agent access pattern.The updated context documentation correctly reflects the shift from
c.var.agentto direct imports.
251-294: LGTM! Excellent SSE streaming documentation.The new section provides comprehensive coverage of Server-Sent Events with clear examples, event structure documentation, and references to implementation examples. This aligns well with the sandbox functionality additions.
372-395: LGTM! Clear sandbox endpoint documentation.This new section effectively documents the sandbox execution feature mentioned in the PR objectives. The SSE event descriptions and script addition instructions are clear and actionable.
424-426: LGTM! Rules properly codify the new patterns.The updated rules section clearly states the direct import pattern and agent invocation methods, providing a helpful reference that aligns with examples throughout the document.
apps/docs/scripts/create-deps-snapshot.sh (3)
25-31: Clear guard for missing org ID.The early exit and message make failure modes obvious.
83-88: Snapshot creation command looks good.Clear naming, description, and tagging make the snapshot easy to discover.
60-69: Pin dependency versions for reproducible snapshots.Lines 60–69: Using
"latest"in the temporary package.json makes snapshots non-deterministic—new releases can change the installed versions without code changes. Source pinned versions fromapps/docs/package.json(which has caret-pinned versions forai,@ai-sdk/*,zod, etc.) to ensure consistent snapshots.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| const input: Input = JSON.parse(process.argv[2] ?? '{}'); | ||
| const userPrompt = input.prompt ?? 'Write a creative one-liner about programming.'; |
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.
Guard CLI JSON parsing to avoid early crash.
JSON.parse runs before the try/catch; invalid input will throw and skip your buffered error output. Consider using the existing parseJSON helper for a safe fallback.
✅ Proposed change
-const input: Input = JSON.parse(process.argv[2] ?? '{}');
+const input: Input = parseJSON<Input>(process.argv[2] ?? '{}', {});🤖 Prompt for AI Agents
In `@apps/docs/src/run/model-arena.ts` around lines 41 - 42, The CLI currently
calls JSON.parse directly for process.argv[2] (setting const input) which can
throw before your try/catch; replace that raw parse with the safe parseJSON
helper (or wrap the parse in try/catch) so invalid JSON falls back to a safe
default object and preserves buffered error output; update the code that sets
input and userPrompt (variables input and userPrompt in model-arena.ts) to use
parseJSON(process.argv[2] ?? '{}') and keep the existing default prompt logic.
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.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/docs/src/api/AGENTS.md (1)
102-121: Replace hard tabs with spaces in code fences.markdownlint (MD010) is flagging tabs in multiple examples (e.g., Line 103, Line 262, Line 306, Line 330, Line 357). Consider converting tabs to spaces for consistency and lint compliance.
Also applies to: 261-282, 305-313, 329-343, 356-367
🤖 Fix all issues with AI agents
In `@apps/docs/src/api/AGENTS.md`:
- Around line 340-342: Replace the console.log call inside the WebSocket
example's ws.onClose handler with the structured logger referenced in the docs
(use c.var.logger, e.g. c.var.logger.info) so the example aligns with the
project's logging rules; update the ws.onClose callback (symbol: ws.onClose) to
call c.var.logger.info('Client disconnected') instead of console.log to maintain
consistency with guidance.
- Around line 13-33: The fenced code block showing the src/api directory tree in
AGENTS.md lacks a language hint; update the opening fence from ``` to ```text
(or ```plaintext) so markdownlint MD040 is satisfied and the block is treated as
plain text—locate the directory tree code fence in AGENTS.md and change the
fence accordingly.
- Around line 255-266: The streaming examples call openai('gpt-4o-mini') but
never import openai, causing copy-paste failures; add the missing import (e.g.,
import { openai } from 'ai') to the top of both the SSE example and the raw
streaming snippet so that symbols like openai, streamText, sse and createRouter
resolve correctly.
In `@apps/docs/src/run/ai-gateway.ts`:
- Around line 21-22: The CLI JSON parsing for the variable input (const input:
Input = JSON.parse(process.argv[2] ?? '{}')) can throw before any surrounding
try/catch; wrap the JSON.parse call in a try/catch (or use a safe-parse helper)
so malformed JSON is caught, convert failures to a default object (e.g., {}),
and surface a properly formatted error message before exiting; update usage of
input and prompt (const prompt = input.prompt ?? '...') to rely on the
safely-parsed input so the process never crashes on invalid CLI JSON.
♻️ Duplicate comments (1)
apps/docs/src/run/model-arena.ts (1)
41-42: Guard CLI JSON parsing to avoid early crash.
JSON.parseruns before the try/catch block. Invalid input throws an unhandled exception, bypassing your error handling. Use the existingparseJSONhelper.🐛 Proposed fix
-const input: Input = JSON.parse(process.argv[2] ?? '{}'); +const input: Input = parseJSON<Input>(process.argv[2] ?? '{}', {});
🧹 Nitpick comments (5)
apps/docs/src/run/handler-context.ts (2)
49-57: Consider using try/finally for cleanup.If an error occurs between
setanddelete, thedemo-keywon't be cleaned up. While this is low-risk for a demo script, using try/finally would demonstrate a more robust pattern.♻️ Suggested improvement
// Thread state demonstration console.log('Thread State (persists across requests):'); await ctx.thread.state.set('demo-key', { value: 'test' }); - const stored = await ctx.thread.state.get('demo-key'); - console.log(` set("demo-key", {value: "test"})`); - console.log(` get("demo-key") -> ${JSON.stringify(stored)}`); - await ctx.thread.state.delete('demo-key'); - console.log(' delete("demo-key") - cleaned up'); + try { + const stored = await ctx.thread.state.get('demo-key'); + console.log(` set("demo-key", {value: "test"})`); + console.log(` get("demo-key") -> ${JSON.stringify(stored)}`); + } finally { + await ctx.thread.state.delete('demo-key'); + console.log(' delete("demo-key") - cleaned up'); + }
66-69: Consider using StructuredError for consistency with coding guidelines.The coding guidelines specify using
StructuredErrorfrom@agentuity/corefor error handling. While the current generic error handling works, demonstratingStructuredErrorwould align with project conventions and provide educational value in this demo script.♻️ Suggested improvement
-import { createAgentContext, getAgentContext } from '@agentuity/runtime'; +import { createAgentContext, getAgentContext } from '@agentuity/runtime'; +import { StructuredError } from '@agentuity/core';} catch (error) { console.log('---OUTPUT---'); - console.log(`Error: ${error instanceof Error ? error.message : String(error)}`); + const structuredError = StructuredError.from(error); + console.log(`Error: ${structuredError.message}`); }As per coding guidelines, StructuredError from
@agentuity/coreshould be used for error handling.apps/docs/src/api/sandbox/scripts.ts (1)
526-534: Missing type annotations in embeddedparseJSONfunction.The
parseJSONfunction in the model-arena script lacks type parameters, unlike the evals script (lines 594-602) which has proper TypeScript generics. While this works at runtime, it creates inconsistency across demo scripts.♻️ Suggested fix for consistency
-function parseJSON(text, fallback) { +function parseJSON<T>(text: string, fallback: T): T { try { const jsonMatch = text.match(/\\\`\\\`\\\`(?:json)?\\s*([\\s\\S]*?)\\\`\\\`\\\`/); const jsonStr = jsonMatch && jsonMatch[1] ? jsonMatch[1].trim() : text.trim(); return JSON.parse(jsonStr); } catch { return fallback; } }apps/docs/src/run/model-arena.ts (1)
44-47:ctxis created but never used.The agent context is initialized but not referenced. Either remove it if unneeded, or use
ctx.loggerfor the INFO/ERROR output to maintain consistency with other demo scripts (e.g.,ai-gateway.ts).♻️ Option: Use ctx.logger for consistency
try { // Generate competing responses in parallel (no logging during execution) const [responseA, responseB] = await Promise.all([ generateText({ model: openai('gpt-5-nano'), prompt: userPrompt, }), generateText({ model: anthropic('claude-haiku-4-5'), prompt: userPrompt, }), ]); // Use OpenAI for judging with manual JSON parsing const judgeResult = await generateText({ model: openai('gpt-5-nano'), prompt: `Compare these responses...`, }); const judgment = parseJSON<Judgment>(judgeResult.text, {...}); - // Buffer all output (matches reference code style) - output.push(`[INFO] Model A (OpenAI gpt-5-nano): "${responseA.text}"`); + ctx.logger.info(`Model A (OpenAI gpt-5-nano)`, { response: responseA.text });apps/docs/package.json (1)
13-14: Make the snapshot script invocation more portable.Directly executing the script relies on the executable bit and can fail on some environments. Consider invoking it explicitly via a shell.
♻️ Suggested tweak
- "snapshot": "./scripts/build-snapshot.sh" + "snapshot": "bash ./scripts/build-snapshot.sh"
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (11)
apps/docs/package.jsonapps/docs/src/api/AGENTS.mdapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/ai-gateway.tsapps/docs/src/run/durable-stream.tsapps/docs/src/run/evals.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/model-arena.tsapps/docs/src/run/sse-stream.tsapps/docs/src/run/streaming.tsapps/docs/src/web/index.html
🚧 Files skipped from review as they are similar to previous changes (5)
- apps/docs/src/run/durable-stream.ts
- apps/docs/src/run/sse-stream.ts
- apps/docs/src/run/streaming.ts
- apps/docs/src/web/index.html
- apps/docs/src/run/evals.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use Prettier formatter with tabs (width 3), single quotes, and semicolons for TypeScript files
Use TypeScript strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
apps/docs/src/run/model-arena.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/ai-gateway.ts
apps/docs/src/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Support hot module reloading in dev mode using import.meta.hot
Files:
apps/docs/src/run/model-arena.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/ai-gateway.ts
apps/docs/src/api/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
API routes should be implemented in the src/api/ directory following REST, streaming, SSE, and WebSocket patterns
Files:
apps/docs/src/api/sandbox/scripts.ts
apps/docs/package.json
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
apps/docs/package.json: Workspace dependencies (@agentuity/runtime,@agentuity/react,@agentuity/schema,@agentuity/workbench,@agentuity/evals,@agentuity/cli) should be imported with workspace:* versions
Use the local CLI directly via bun ../../packages/cli/bin/cli.ts in scripts rather than relying on installed CLI packages
Files:
apps/docs/package.json
🧠 Learnings (2)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.
Applied to files:
apps/docs/src/run/model-arena.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/run/handler-context.tsapps/docs/src/run/ai-gateway.ts
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.
Applied to files:
apps/docs/src/api/sandbox/scripts.ts
🧬 Code graph analysis (1)
apps/docs/src/run/model-arena.ts (1)
apps/docs/src/agent/model-arena/types.ts (1)
Judgment(67-67)
🪛 markdownlint-cli2 (0.18.1)
apps/docs/src/api/AGENTS.md
13-13: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
103-103: Hard tabs
Column: 1
(MD010, no-hard-tabs)
104-104: Hard tabs
Column: 1
(MD010, no-hard-tabs)
106-106: Hard tabs
Column: 1
(MD010, no-hard-tabs)
107-107: Hard tabs
Column: 1
(MD010, no-hard-tabs)
108-108: Hard tabs
Column: 1
(MD010, no-hard-tabs)
109-109: Hard tabs
Column: 1
(MD010, no-hard-tabs)
114-114: Hard tabs
Column: 1
(MD010, no-hard-tabs)
115-115: Hard tabs
Column: 1
(MD010, no-hard-tabs)
262-262: Hard tabs
Column: 1
(MD010, no-hard-tabs)
263-263: Hard tabs
Column: 1
(MD010, no-hard-tabs)
264-264: Hard tabs
Column: 1
(MD010, no-hard-tabs)
265-265: Hard tabs
Column: 1
(MD010, no-hard-tabs)
266-266: Hard tabs
Column: 1
(MD010, no-hard-tabs)
268-268: Hard tabs
Column: 1
(MD010, no-hard-tabs)
269-269: Hard tabs
Column: 1
(MD010, no-hard-tabs)
270-270: Hard tabs
Column: 1
(MD010, no-hard-tabs)
271-271: Hard tabs
Column: 1
(MD010, no-hard-tabs)
272-272: Hard tabs
Column: 1
(MD010, no-hard-tabs)
273-273: Hard tabs
Column: 1
(MD010, no-hard-tabs)
274-274: Hard tabs
Column: 1
(MD010, no-hard-tabs)
275-275: Hard tabs
Column: 1
(MD010, no-hard-tabs)
277-277: Hard tabs
Column: 1
(MD010, no-hard-tabs)
278-278: Hard tabs
Column: 1
(MD010, no-hard-tabs)
279-279: Hard tabs
Column: 1
(MD010, no-hard-tabs)
280-280: Hard tabs
Column: 1
(MD010, no-hard-tabs)
281-281: Hard tabs
Column: 1
(MD010, no-hard-tabs)
306-306: Hard tabs
Column: 1
(MD010, no-hard-tabs)
307-307: Hard tabs
Column: 1
(MD010, no-hard-tabs)
308-308: Hard tabs
Column: 1
(MD010, no-hard-tabs)
309-309: Hard tabs
Column: 1
(MD010, no-hard-tabs)
310-310: Hard tabs
Column: 1
(MD010, no-hard-tabs)
311-311: Hard tabs
Column: 1
(MD010, no-hard-tabs)
312-312: Hard tabs
Column: 1
(MD010, no-hard-tabs)
330-330: Hard tabs
Column: 1
(MD010, no-hard-tabs)
331-331: Hard tabs
Column: 1
(MD010, no-hard-tabs)
332-332: Hard tabs
Column: 1
(MD010, no-hard-tabs)
333-333: Hard tabs
Column: 1
(MD010, no-hard-tabs)
335-335: Hard tabs
Column: 1
(MD010, no-hard-tabs)
336-336: Hard tabs
Column: 1
(MD010, no-hard-tabs)
337-337: Hard tabs
Column: 1
(MD010, no-hard-tabs)
338-338: Hard tabs
Column: 1
(MD010, no-hard-tabs)
340-340: Hard tabs
Column: 1
(MD010, no-hard-tabs)
341-341: Hard tabs
Column: 1
(MD010, no-hard-tabs)
342-342: Hard tabs
Column: 1
(MD010, no-hard-tabs)
343-343: Hard tabs
Column: 1
(MD010, no-hard-tabs)
357-357: Hard tabs
Column: 1
(MD010, no-hard-tabs)
359-359: Hard tabs
Column: 1
(MD010, no-hard-tabs)
360-360: Hard tabs
Column: 1
(MD010, no-hard-tabs)
361-361: Hard tabs
Column: 1
(MD010, no-hard-tabs)
362-362: Hard tabs
Column: 1
(MD010, no-hard-tabs)
363-363: Hard tabs
Column: 1
(MD010, no-hard-tabs)
365-365: Hard tabs
Column: 1
(MD010, no-hard-tabs)
366-366: Hard tabs
Column: 1
(MD010, no-hard-tabs)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Framework Integration Tests (TanStack & Next.js)
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: Sandbox CLI Tests
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Build
🔇 Additional comments (10)
apps/docs/src/run/handler-context.ts (4)
1-15: LGTM!Clear documentation header explaining the script's purpose, and appropriate imports for the AgentContext demonstration.
27-40: LGTM!Good demonstration of context identifiers and structured logging with metadata objects.
59-65: LGTM!Session state demonstration is clear. The synchronous API usage (no
await) aligns with typical in-memory session state implementations.
17-70: No action required.Standalone run scripts are executed via
bun runCLI and exit after completion. They are not modules in a dev server context, so the HMR requirement does not apply. None of the 15 run scripts inapps/docs/src/run/implementimport.meta.hot, confirming this pattern across the codebase.apps/docs/src/api/sandbox/scripts.ts (2)
8-651: Well-structured sandbox script registry.The SCRIPTS object provides a comprehensive set of demo scripts covering various Agentuity features. The scripts are well-documented with usage comments and handle errors consistently with try/catch blocks.
653-671: SCRIPT_DEFAULTS properly aligned with SCRIPTS.All 14 script keys have corresponding default entries, and the default values match the fallback values used within each script's code.
apps/docs/src/run/model-arena.ts (1)
1-91: Clean implementation of LLM-as-Judge pattern.The script correctly demonstrates parallel model calls, JSON response parsing with fallback, and buffered output. The header comments accurately describe the models used.
apps/docs/src/run/ai-gateway.ts (1)
26-54: Well-structured parallel gateway demo.The script effectively demonstrates calling multiple AI providers through the Agentuity gateway with proper error handling and clear output formatting.
apps/docs/src/api/AGENTS.md (1)
356-363: No changes needed. The code is correct as written.
c.waitUntil()in this SDK explicitly accepts bothPromise<void>and(() => void | Promise<void>)as documented in the type definition. The implementation invokes function callbacks immediately and handles both synchronous and asynchronous returns. The patternc.waitUntil(async () => { ... })is standard across the codebase and extensively tested.Likely an incorrect or invalid review comment.
apps/docs/package.json (1)
18-23: All dependencies are correctly configured and compatible.Workspace packages are properly versioned with
workspace:*, scripts correctly invoke the local CLI viabun ../../packages/cli/bin/cli.ts, and all external packages (@monaco-editor/react4.7.0, motion 12.29.0, tailwind-merge 3.4.0) are compatible with React 19.2.0. The tailwind-merge version is current (latest as of January 2026).
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| ``` | ||
| src/api/ | ||
| ├── index.ts (optional, mounted at /api) | ||
| ├── status/ | ||
| │ └── route.ts (mounted at /api/status) | ||
| ├── users/ | ||
| │ └── route.ts (mounted at /api/users) | ||
| ├── agent-call/ | ||
| └── route.ts (mounted at /api/agent-call) | ||
| ├── index.ts # Empty router (mounted at /api) | ||
| ├── hello/ # Basic greeting endpoint | ||
| ├── chat/ # Chat conversation endpoint | ||
| ├── context/ # AgentContext info endpoint | ||
| ├── key-value/ # KV storage operations | ||
| ├── vector-storage/ # Vector search endpoint | ||
| ├── object-storage/ # S3 file operations | ||
| ├── ai-gateway/ # Multi-provider LLM routing (streaming) | ||
| ├── streaming/ # Raw text streaming | ||
| ├── sse-stream/ # Server-Sent Events streaming | ||
| ├── durable-stream/ # Persistent streams with public URLs | ||
| ├── agent-calls/ # Agent invocation patterns (sync/background/chain) | ||
| ├── model-arena/ # LLM-as-judge comparison (SSE) | ||
| ├── evals/ # Quality evaluations endpoint | ||
| ├── websocket/ # WebSocket bidirectional communication | ||
| └── sandbox/ # Cloud sandbox execution (SSE) | ||
| ├── route.ts # Sandbox execution endpoint | ||
| └── scripts.ts # Demo scripts stored as strings | ||
| ``` |
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.
Add a language hint to the fenced code block.
markdownlint (MD040) flags the directory tree block without a language. Use text (or plaintext) to fix.
🛠️ Proposed fix
-```
+```text
src/api/
├── index.ts # Empty router (mounted at /api)
├── hello/ # Basic greeting endpoint
@@
├── route.ts # Sandbox execution endpoint
└── scripts.ts # Demo scripts stored as strings</details>
<!-- suggestion_start -->
<details>
<summary>📝 Committable suggestion</summary>
> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
```suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
13-13: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
In `@apps/docs/src/api/AGENTS.md` around lines 13 - 33, The fenced code block
showing the src/api directory tree in AGENTS.md lacks a language hint; update
the opening fence from ``` to ```text (or ```plaintext) so markdownlint MD040 is
satisfied and the block is treated as plain text—locate the directory tree code
fence in AGENTS.md and change the fence accordingly.
| ```typescript | ||
| import { createRouter, sse } from '@agentuity/runtime'; | ||
| import { streamText } from 'ai'; | ||
|
|
||
| const router = createRouter(); | ||
|
|
||
| router.get('/stream', (c) => | ||
| sse(async (c, stream) => { | ||
| const { textStream } = streamText({ | ||
| model: openai('gpt-4o-mini'), | ||
| prompt: 'Tell me a story', | ||
| }); |
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.
🧩 Analysis chain
🏁 Script executed:
# First, let's check if the file exists and examine lines 255-266 and 299-310
wc -l apps/docs/src/api/AGENTS.mdRepository: agentuity/sdk
Length of output: 88
🏁 Script executed:
# Read the relevant sections
sed -n '250,270p' apps/docs/src/api/AGENTS.mdRepository: agentuity/sdk
Length of output: 561
🏁 Script executed:
# Also check lines around 299-310
sed -n '295,315p' apps/docs/src/api/AGENTS.mdRepository: agentuity/sdk
Length of output: 524
🏁 Script executed:
# Search for all import statements in the file to see if openai is imported anywhere
rg "import.*openai" apps/docs/src/api/AGENTS.mdRepository: agentuity/sdk
Length of output: 39
🏁 Script executed:
# Search for openai imports in the codebase (excluding the docs file itself)
rg "@ai-sdk/openai" --type typescript --type jsonRepository: agentuity/sdk
Length of output: 91
🏁 Script executed:
# Check package.json to see if `@ai-sdk/openai` is listed as a dependency
cat package.json | grep -A 5 -B 5 "@ai-sdk/openai"Repository: agentuity/sdk
Length of output: 39
🏁 Script executed:
# Search for any examples in the codebase that use streamText with openai
rg "streamText" --type typescript -A 3 -B 3 | head -50Repository: agentuity/sdk
Length of output: 91
🏁 Script executed:
# Search without file type restrictions
rg "@ai-sdk/openai"Repository: agentuity/sdk
Length of output: 5850
🏁 Script executed:
# Look at package.json files in the repository
find . -name "package.json" -exec grep -l "ai-sdk\|@vercel/ai\|ai" {} \; | head -10Repository: agentuity/sdk
Length of output: 9925
🏁 Script executed:
# Search for any openai model usage in the codebase
rg "openai\(" --no-filename -B 2 -A 2 | head -40Repository: agentuity/sdk
Length of output: 1339
🏁 Script executed:
# Check the ai SDK documentation or common patterns
rg "from 'ai" | head -20Repository: agentuity/sdk
Length of output: 1665
Add missing openai import to streaming examples.
Both SSE and raw streaming snippets call openai('gpt-4o-mini') but don't import it. This breaks copy-paste usage. Add the import to both code blocks.
Proposed fix
import { createRouter, sse } from '@agentuity/runtime';
import { streamText } from 'ai';
+import { openai } from '@ai-sdk/openai'; import { createRouter, stream } from '@agentuity/runtime';
import { streamText } from 'ai';
+import { openai } from '@ai-sdk/openai';🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
262-262: Hard tabs
Column: 1
(MD010, no-hard-tabs)
263-263: Hard tabs
Column: 1
(MD010, no-hard-tabs)
264-264: Hard tabs
Column: 1
(MD010, no-hard-tabs)
265-265: Hard tabs
Column: 1
(MD010, no-hard-tabs)
266-266: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🤖 Prompt for AI Agents
In `@apps/docs/src/api/AGENTS.md` around lines 255 - 266, The streaming examples
call openai('gpt-4o-mini') but never import openai, causing copy-paste failures;
add the missing import (e.g., import { openai } from 'ai') to the top of both
the SSE example and the raw streaming snippet so that symbols like openai,
streamText, sse and createRouter resolve correctly.
| ws.onClose(() => { | ||
| console.log('Client disconnected'); | ||
| }); |
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.
Use structured logger in WebSocket example.
Line 341 uses console.log, but the rules section (Line 424) now states to use c.var.logger. Keep examples consistent with guidance.
🛠️ Proposed fix
- ws.onClose(() => {
- console.log('Client disconnected');
- });
+ ws.onClose(() => {
+ c.var.logger.info('Client disconnected');
+ });📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ws.onClose(() => { | |
| console.log('Client disconnected'); | |
| }); | |
| ws.onClose(() => { | |
| c.var.logger.info('Client disconnected'); | |
| }); |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
340-340: Hard tabs
Column: 1
(MD010, no-hard-tabs)
341-341: Hard tabs
Column: 1
(MD010, no-hard-tabs)
342-342: Hard tabs
Column: 1
(MD010, no-hard-tabs)
🤖 Prompt for AI Agents
In `@apps/docs/src/api/AGENTS.md` around lines 340 - 342, Replace the console.log
call inside the WebSocket example's ws.onClose handler with the structured
logger referenced in the docs (use c.var.logger, e.g. c.var.logger.info) so the
example aligns with the project's logging rules; update the ws.onClose callback
(symbol: ws.onClose) to call c.var.logger.info('Client disconnected') instead of
console.log to maintain consistency with guidance.
| const input: Input = JSON.parse(process.argv[2] ?? '{}'); | ||
| const prompt = input.prompt ?? 'Explain AI agents in 1 sentence.'; |
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.
Wrap CLI input parsing in error handling.
JSON.parse executes before the try/catch block. Invalid JSON input causes an unhandled exception that bypasses the error output format.
🐛 Proposed fix
+function parseJSON<T>(text: string, fallback: T): T {
+ try {
+ return JSON.parse(text);
+ } catch {
+ return fallback;
+ }
+}
+
-const input: Input = JSON.parse(process.argv[2] ?? '{}');
+const input: Input = parseJSON<Input>(process.argv[2] ?? '{}', {});
const prompt = input.prompt ?? 'Explain AI agents in 1 sentence.';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const input: Input = JSON.parse(process.argv[2] ?? '{}'); | |
| const prompt = input.prompt ?? 'Explain AI agents in 1 sentence.'; | |
| function parseJSON<T>(text: string, fallback: T): T { | |
| try { | |
| return JSON.parse(text); | |
| } catch { | |
| return fallback; | |
| } | |
| } | |
| const input: Input = parseJSON<Input>(process.argv[2] ?? '{}', {}); | |
| const prompt = input.prompt ?? 'Explain AI agents in 1 sentence.'; |
🤖 Prompt for AI Agents
In `@apps/docs/src/run/ai-gateway.ts` around lines 21 - 22, The CLI JSON parsing
for the variable input (const input: Input = JSON.parse(process.argv[2] ??
'{}')) can throw before any surrounding try/catch; wrap the JSON.parse call in a
try/catch (or use a safe-parse helper) so malformed JSON is caught, convert
failures to a default object (e.g., {}), and surface a properly formatted error
message before exiting; update usage of input and prompt (const prompt =
input.prompt ?? '...') to rely on the safely-parsed input so the process never
crashes on invalid CLI JSON.
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.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@apps/docs/src/web/App.tsx`:
- Around line 496-499: The SVG element in App.tsx currently has both
aria-hidden="true" and aria-label="Agentuity Logo", which conflicts because
aria-hidden hides the label from assistive tech; decide whether the logo is
meaningful or decorative and update the svg accordingly: if meaningful, remove
aria-hidden and add an accessible name (keep aria-label="Agentuity Logo" or add
<title> and role="img"); if decorative, remove the aria-label and keep
aria-hidden="true". Locate the <svg ... className={className}> instance in the
App component and apply the chosen change.
- Around line 650-659: The onClick handler currently calls
window.parent.postMessage(..., '*'), which is unsafe; change it to compute a
concrete targetOrigin and pass that instead: when demo.docsUrl is absolute
(url.startsWith('http')) parse it once with new URL(url) to get its origin and
use that as the postMessage targetOrigin, and when docsUrl is a relative path
use window.location.origin (or window.parent.location?.origin if available) as
the targetOrigin; update the code that constructs path (reuse the same URL
object instead of calling new URL twice) and replace the '*' argument with the
resolved origin before calling window.parent.postMessage in the button onClick.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
apps/docs/package.jsonapps/docs/scripts/generate-sandbox-scripts.tsapps/docs/src/api/sandbox/scripts.tsapps/docs/src/web/App.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/docs/package.json
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use Prettier formatter with tabs (width 3), single quotes, and semicolons for TypeScript files
Use TypeScript strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
apps/docs/src/web/App.tsxapps/docs/scripts/generate-sandbox-scripts.tsapps/docs/src/api/sandbox/scripts.ts
apps/docs/src/web/**/*.{tsx,jsx}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Use Tailwind CSS for styling in React components
Files:
apps/docs/src/web/App.tsx
apps/docs/src/web/App.tsx
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
The main React component should be implemented in App.tsx and configure demos according to the application structure
Files:
apps/docs/src/web/App.tsx
apps/docs/src/web/**/*.{tsx,ts}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Use TypeScript/TSX syntax in React components; the Agentuity build system handles compilation automatically
Files:
apps/docs/src/web/App.tsx
apps/docs/src/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
Support hot module reloading in dev mode using import.meta.hot
Files:
apps/docs/src/web/App.tsxapps/docs/src/api/sandbox/scripts.ts
apps/docs/src/web/**/App.tsx
📄 CodeRabbit inference engine (apps/docs/src/web/AGENTS.md)
App.tsx must export a function named
App
Files:
apps/docs/src/web/App.tsx
apps/docs/src/web/**/*.{ts,tsx}
📄 CodeRabbit inference engine (apps/docs/src/web/AGENTS.md)
apps/docs/src/web/**/*.{ts,tsx}: Use TypeScript for type safety in React components
Wrap your app with AgentuityProvider for hooks to work
Place reusable components in separate files
Handle loading and error states in UI components
Use useAgent hook for one-off agent calls
Use useAgentWebsocket hook for bidirectional real-time communication
Use useAgentEventStream hook for server-to-client streaming
All agents are accessible via useAgent hook using agent name
Files:
apps/docs/src/web/App.tsx
apps/docs/src/api/**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (apps/docs/AGENTS.md)
API routes should be implemented in the src/api/ directory following REST, streaming, SSE, and WebSocket patterns
Files:
apps/docs/src/api/sandbox/scripts.ts
🧠 Learnings (3)
📚 Learning: 2026-01-09T16:26:51.893Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 523
File: templates/_base/src/web/frontend.tsx:13-35
Timestamp: 2026-01-09T16:26:51.893Z
Learning: In web frontend code, prefer using the built-in Error class for runtime errors. Do not throw or re-export StructuredError from agentuity/core in web app code. Replace instances of StructuredError with new Error or custom error types that extend Error; ensure error handling logic remains intact and that error messages are descriptive. This guideline applies to all web UI TypeScript/TSX files that run in the browser and import StructuredError from agentuity/core.
Applied to files:
apps/docs/src/web/App.tsx
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.
Applied to files:
apps/docs/scripts/generate-sandbox-scripts.tsapps/docs/src/api/sandbox/scripts.ts
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.
Applied to files:
apps/docs/src/api/sandbox/scripts.ts
🧬 Code graph analysis (1)
apps/docs/src/web/App.tsx (6)
apps/docs/src/web/components/CodeBlock.tsx (2)
LineHighlight(6-9)CodeBlock(20-199)apps/docs/src/web/components/HelloDemo.tsx (1)
HelloDemo(4-47)apps/docs/src/web/code-examples.ts (1)
CODE_EXAMPLES(6-494)apps/docs/src/web/hooks/useSandboxRunner.ts (1)
useSandboxRunner(60-198)apps/docs/src/web/test-outputs.ts (1)
TEST_OUTPUTS(5-176)apps/docs/src/web/components/TerminalOutput.tsx (1)
TerminalOutput(21-128)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Playwright E2E Smoke Test
- GitHub Check: Framework Integration Tests (TanStack & Next.js)
- GitHub Check: SDK Integration Test Suite
- GitHub Check: Sandbox CLI Tests
- GitHub Check: Package Installation & Usage Test
- GitHub Check: Cloud Deployment Tests
- GitHub Check: Queue CLI Tests
- GitHub Check: Template Integration Tests
- GitHub Check: Pack & Upload
- GitHub Check: Build
🔇 Additional comments (3)
apps/docs/src/api/sandbox/scripts.ts (1)
1-43: LGTM!The auto-generated file is well-structured with proper header documentation. Both previously flagged issues have been addressed:
- Model labels in
model-arenanow correctly referencegpt-5-nanoandclaude-haiku-4-5- The
seedDatafield has been removed from thevectordefaultsThe file correctly follows the tab-based formatting guidelines.
apps/docs/scripts/generate-sandbox-scripts.ts (1)
1-104: LGTM!The generator script is well-designed:
- Clean separation of concerns with
extractDefaultInputhandling default extraction andgenerateScriptsorchestrating the workflow- Proper error handling around JSON parsing with safe fallbacks
- Deterministic output via
files.sort()ensures consistent generated content- The generated output template includes appropriate header documentation and follows the project's tab-based formatting
- Entry point error handling correctly exits with code 1 on failure
apps/docs/src/web/App.tsx (1)
724-773: The HMR requirement is already satisfied. The entry point (apps/docs/src/web/frontend.tsx) properly implementsimport.meta.hotwith state preservation. App.tsx, as a child component, is automatically eligible for hot reloading through Vite's HMR system and doesn't require a separate module-levelimport.meta.hot.accept()hook. Adding it here would be redundant and non-idiomatic for this architecture.Likely an incorrect or invalid review comment.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| <svg | ||
| aria-hidden="true" | ||
| aria-label="Agentuity Logo" | ||
| className={className} |
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.
Resolve the SVG accessibility conflict (aria-hidden + aria-label).
aria-hidden="true" hides the SVG from assistive tech, so the label is ignored. Either remove aria-hidden (if the logo is meaningful) or drop the label (if decorative).
🛠️ Suggested fix (make it accessible)
- aria-hidden="true"
- aria-label="Agentuity Logo"
+ role="img"
+ aria-label="Agentuity Logo"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <svg | |
| aria-hidden="true" | |
| aria-label="Agentuity Logo" | |
| className={className} | |
| <svg | |
| role="img" | |
| aria-label="Agentuity Logo" | |
| className={className} |
🤖 Prompt for AI Agents
In `@apps/docs/src/web/App.tsx` around lines 496 - 499, The SVG element in App.tsx
currently has both aria-hidden="true" and aria-label="Agentuity Logo", which
conflicts because aria-hidden hides the label from assistive tech; decide
whether the logo is meaningful or decorative and update the svg accordingly: if
meaningful, remove aria-hidden and add an accessible name (keep
aria-label="Agentuity Logo" or add <title> and role="img"); if decorative,
remove the aria-label and keep aria-hidden="true". Locate the <svg ...
className={className}> instance in the App component and apply the chosen
change.
| <button | ||
| type="button" | ||
| onClick={() => { | ||
| // Ask parent to navigate via postMessage | ||
| const url = demo.docsUrl as string; | ||
| const path = url.startsWith('http') | ||
| ? new URL(url).pathname + new URL(url).hash | ||
| : url; | ||
| window.parent.postMessage({ type: 'NAVIGATE', path }, '*'); | ||
| }} |
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.
Avoid postMessage with wildcard targetOrigin.
Using '*' broadcasts to any parent origin. Since the docs URL is known, constrain targetOrigin to the resolved origin.
🔒 Proposed fix
- const url = demo.docsUrl as string;
- const path = url.startsWith('http')
- ? new URL(url).pathname + new URL(url).hash
- : url;
- window.parent.postMessage({ type: 'NAVIGATE', path }, '*');
+ const url = demo.docsUrl as string;
+ const resolved = url.startsWith('http')
+ ? new URL(url)
+ : new URL(url, window.location.origin);
+ const path = resolved.pathname + resolved.hash;
+ window.parent.postMessage({ type: 'NAVIGATE', path }, resolved.origin);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <button | |
| type="button" | |
| onClick={() => { | |
| // Ask parent to navigate via postMessage | |
| const url = demo.docsUrl as string; | |
| const path = url.startsWith('http') | |
| ? new URL(url).pathname + new URL(url).hash | |
| : url; | |
| window.parent.postMessage({ type: 'NAVIGATE', path }, '*'); | |
| }} | |
| <button | |
| type="button" | |
| onClick={() => { | |
| // Ask parent to navigate via postMessage | |
| const url = demo.docsUrl as string; | |
| const resolved = url.startsWith('http') | |
| ? new URL(url) | |
| : new URL(url, window.location.origin); | |
| const path = resolved.pathname + resolved.hash; | |
| window.parent.postMessage({ type: 'NAVIGATE', path }, resolved.origin); | |
| }} |
🤖 Prompt for AI Agents
In `@apps/docs/src/web/App.tsx` around lines 650 - 659, The onClick handler
currently calls window.parent.postMessage(..., '*'), which is unsafe; change it
to compute a concrete targetOrigin and pass that instead: when demo.docsUrl is
absolute (url.startsWith('http')) parse it once with new URL(url) to get its
origin and use that as the postMessage targetOrigin, and when docsUrl is a
relative path use window.location.origin (or window.parent.location?.origin if
available) as the targetOrigin; update the code that constructs path (reuse the
same URL object instead of calling new URL twice) and replace the '*' argument
with the resolved origin before calling window.parent.postMessage in the button
onClick.
Summary by CodeRabbit
New Features
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.