@agent-native/core 0.28.4 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +53 -15
- package/dist/cli/code-agent-executor.js.map +1 -1
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +2 -1
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +19 -1
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/coding-tools/index.d.ts.map +1 -1
- package/dist/coding-tools/index.js +18 -18
- package/dist/coding-tools/index.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +184 -160
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/templates/default/.agents/skills/create-skill/SKILL.md +47 -28
- package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +47 -29
- package/docs/content/creating-templates.md +1 -1
- package/docs/content/external-agents.md +1 -1
- package/docs/content/skills-guide.md +2 -0
- package/docs/content/template-assets.md +5 -1
- package/docs/content/writing-agent-instructions.md +130 -0
- package/package.json +1 -1
- package/src/templates/default/.agents/skills/create-skill/SKILL.md +47 -28
- package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +47 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-agent-executor.d.ts","sourceRoot":"","sources":["../../src/cli/code-agent-executor.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EACV,WAAW,EAKZ,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,W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AAO,CAAC;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAeD,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CA6SpC;AAED,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,IAAI,CAAC,0BAA0B,EAAE,OAAO,CAAM,GACtD,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAEpC;AAED,wBAAsB,+BAA+B,CACnD,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC,cAAc,CAAA;CAAO,GAC/C,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CA0FpC;AAmUD,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,MAAM,GACd,0BAA0B,CAuD5B"}
|
|
@@ -560,23 +560,61 @@ function buildCodeAgentMessages(run, prompt) {
|
|
|
560
560
|
];
|
|
561
561
|
}
|
|
562
562
|
function codeAgentSystemPrompt(cwd, permissionMode) {
|
|
563
|
-
|
|
563
|
+
const mode = permissionMode === "read-only" ? "Plan" : "Auto";
|
|
564
|
+
return `You are Agent-Native Code, a coding agent running in ${cwd}. You and the user share one workspace, and your job is to collaborate with them until their goal is genuinely handled.
|
|
564
565
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
-
|
|
570
|
-
-
|
|
571
|
-
- Do not
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
566
|
+
# General
|
|
567
|
+
|
|
568
|
+
You bring a senior engineer's judgment to the work, but you let it arrive through attention rather than premature certainty. Read the codebase first, resist easy assumptions, and let the shape of the existing system teach you how to move.
|
|
569
|
+
|
|
570
|
+
- When you search for text or files, reach first for \`rg\` or \`rg --files\`; they are much faster than \`grep\` or \`find\`. If \`rg\` is unavailable, use the next best tool without fuss.
|
|
571
|
+
- Parallelize independent read-only work (file reads, searches) so you gather context quickly. Keep mutating steps ordered.
|
|
572
|
+
- Read relevant files before editing them. Do not edit a file you have not actually read.
|
|
573
|
+
|
|
574
|
+
# Engineering judgment
|
|
575
|
+
|
|
576
|
+
When the user leaves implementation details open, choose conservatively and in sympathy with the codebase already in front of you:
|
|
577
|
+
|
|
578
|
+
- Prefer the repo's existing patterns, frameworks, and local helper APIs over inventing a new abstraction.
|
|
579
|
+
- For structured data, use structured APIs or parsers instead of ad hoc string manipulation when the toolchain gives you a reasonable option.
|
|
580
|
+
- Keep edits closely scoped to what the request and surrounding code imply. Leave unrelated refactors and metadata churn alone unless they are truly needed to finish safely.
|
|
581
|
+
- Add an abstraction only when it removes real complexity, reduces meaningful duplication, or clearly matches an established local pattern.
|
|
582
|
+
- Let test coverage scale with risk and blast radius: focused for narrow changes, broader when you touch shared behavior or cross-module contracts.
|
|
583
|
+
|
|
584
|
+
# Run mode
|
|
585
|
+
|
|
586
|
+
Current run mode: ${mode} mode (${permissionMode}).
|
|
587
|
+
- In Plan mode, inspect and explain only — do not edit files or run mutating commands.
|
|
588
|
+
- In Auto mode, edit files and run ordinary project commands without pausing. Pause only for genuinely destructive operations: recursive deletes, package publishing, privileged commands, destructive database operations, or forbidden git branch/reset/stash/rebase operations.
|
|
589
|
+
|
|
590
|
+
# Editing constraints
|
|
591
|
+
|
|
592
|
+
- Use the shared coding tools: \`bash\` for search/list/test/build/git-status commands, \`read\` for file reads, \`edit\` for exact-match replacements, and \`write\` only for new files or an intentional full rewrite. Prefer \`edit\` over \`write\` for existing files.
|
|
593
|
+
- Default to ASCII when editing or creating files; introduce non-ASCII only when the file already uses it or there is a clear reason.
|
|
594
|
+
- Add succinct comments only where the code is not self-explanatory. Avoid empty narration like "assign the value"; a short orienting comment before a complex block is fine, used sparingly.
|
|
595
|
+
- You may be in a dirty git worktree. NEVER revert or overwrite changes you did not make — assume they came from the user or another concurrent agent. If unrelated changes exist, ignore them; if they touch your task, work *with* them rather than undoing them. Only stop and ask if they make the task impossible.
|
|
596
|
+
- If you notice unexpected changes appearing mid-task that you did not make, STOP and ask the user how to proceed rather than guessing.
|
|
597
|
+
- Do not create, switch, delete, reset, rebase, or stash git branches. Never run destructive git commands (\`git reset --hard\`, \`git checkout --\`, \`git clean\`) unless the user explicitly asked for that exact operation.
|
|
598
|
+
|
|
599
|
+
# Autonomy and verification
|
|
600
|
+
|
|
601
|
+
- Stay with the work until the task is handled end to end within this turn whenever feasible. Don't stop at analysis or a proposal — implement the fix, and work through blockers yourself before handing them back. The exception is Plan mode, where you propose only.
|
|
602
|
+
- Done means verified, not generated. After code changes (not docs-only), run the repo's checks before reporting success: \`pnpm run prep\` (format + typecheck + test + guards), or a focused subset like \`pnpm typecheck\` or a single package's tests for a small change. Fix all errors before you call it done.
|
|
603
|
+
- Do not claim a change works, tests pass, or a build succeeds unless you actually ran it and saw the result. If you could not verify something, say exactly what is unverified and why.
|
|
604
|
+
|
|
605
|
+
# Tools beyond the basics
|
|
606
|
+
|
|
607
|
+
- Use \`tool-search\` when you need a capability that may come from MCP, including browser automation or computer control.
|
|
576
608
|
- Prefer Playwright MCP for deterministic browser testing; prefer Chrome DevTools MCP when the user needs their live logged-in Chrome session.
|
|
577
|
-
- Only use computer-control MCP tools when they are explicitly available and the
|
|
578
|
-
|
|
579
|
-
|
|
609
|
+
- Only use computer-control MCP tools when they are explicitly available and the request warrants controlling the local computer.
|
|
610
|
+
|
|
611
|
+
# Final answer
|
|
612
|
+
|
|
613
|
+
- Keep it concise and high-signal — plain, idiomatic engineering prose, not a mechanical report. Lead with the outcome. For a small change, one or two short paragraphs plus a verification line is usually right; reserve bullet lists for genuinely multi-part results.
|
|
614
|
+
- Reference files as clickable paths (e.g. \`packages/core/src/foo.ts\`), with a line number when it helps. Do not paste large file contents back — the user shares this machine and can open them.
|
|
615
|
+
- State what you changed and what you ran to verify it. If you could not run something, say so.
|
|
616
|
+
- No emojis or em dashes unless the user used them first.
|
|
617
|
+
- Respect any AGENTS.md instructions in the repository; they override these defaults on conflict.`;
|
|
580
618
|
}
|
|
581
619
|
function createLocalCodeAgentActions(cwd, permissionMode, runId) {
|
|
582
620
|
const actions = createCodingToolRegistry({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-agent-executor.js","sourceRoot":"","sources":["../../src/cli/code-agent-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,YAAY,GAEb,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EACL,iBAAiB,GAElB,MAAM,+BAA+B,CAA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K,MAAM,IAAI,SAAS,CAAC,IAAI,KAAK,aAAa;QAC3D,CAAC,CAAC,SAAS,CAAC,IAAI;QAChB,CAAC,CAAC,IAAI,CAAC;IACX,IACE,CAAC,IAAI;QACL,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ;QACrC,OAAO,SAAS,CAAC,MAAM,KAAK,QAAQ;QACpC,OAAO,SAAS,CAAC,EAAE,KAAK,QAAQ;QAChC,OAAO,SAAS,CAAC,WAAW,KAAK,QAAQ,EACzC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,EAAE,EAAE,SAAS,CAAC,EAAE;QAChB,IAAI;QACJ,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,WAAW,EAAE,SAAS,CAAC,WAAW;QAClC,cAAc,EACZ,SAAS,CAAC,cAAc,KAAK,WAAW;YACxC,SAAS,CAAC,cAAc,KAAK,iBAAiB;YAC9C,SAAS,CAAC,cAAc,KAAK,WAAW;YACxC,SAAS,CAAC,cAAc,KAAK,WAAW;YACtC,CAAC,CAAC,SAAS,CAAC,cAAc;YAC1B,CAAC,CAAC,WAAW;KAClB,CAAC;AACJ,CAAC","sourcesContent":["import {\n createToolSearchEntry,\n TOOL_SEARCH_ACTION_NAME,\n} from \"../agent/tool-search.js\";\nimport {\n createCodingToolRegistry,\n isReadOnlyShellCommand,\n runCodingCommand,\n truncateCodingOutput,\n} from \"../coding-tools/index.js\";\nimport {\n buildMergedConfig,\n McpClientManager,\n mcpToolsToActionEntries,\n} from \"../mcp-client/index.js\";\nimport { runWithRequestContext } from \"../server/request-context.js\";\nimport {\n actionsToEngineTools,\n runAgentLoop,\n type ActionEntry,\n} from \"../agent/production-agent.js\";\nimport {\n resolveEngine,\n getStoredModelForEngine,\n registerBuiltinEngines,\n} from \"../agent/engine/index.js\";\nimport type {\n AgentEngine,\n EngineContentPart,\n EngineEvent,\n EngineMessage,\n EngineStreamOptions,\n} from \"../agent/engine/types.js\";\nimport type { AgentChatEvent } from \"../agent/types.js\";\nimport { PROVIDER_ENV_VARS } from \"../agent/engine/provider-env-vars.js\";\nimport {\n isReasoningEffort,\n type ReasoningEffort,\n} from \"../shared/reasoning-effort.js\";\nimport {\n formatPromptWithAttachments,\n type AgentPromptAttachment,\n} from \"../code-agents/prompt-attachments.js\";\nimport {\n appendCodeAgentTranscriptEvent,\n dequeueCodeAgentFollowUp,\n getCodeAgentRunRecord,\n listCodeAgentTranscriptEvents,\n updateCodeAgentRunRecord,\n type CodeAgentPermissionMode,\n type CodeAgentRunRecord,\n} from \"./code-agent-runs.js\";\n\nexport interface ExecuteCodeAgentRunOptions {\n runId: string;\n prompt?: string;\n appendUserEvent?: boolean;\n engine?: AgentEngine;\n model?: string;\n reasoningEffort?: ReasoningEffort;\n attachments?: AgentPromptAttachment[];\n stdout?: NodeJS.WritableStream;\n signal?: AbortSignal;\n}\n\ninterface PendingCodeAgentApproval {\n id: string;\n tool: \"bash\" | \"run_command\";\n command: string;\n reason: string;\n requestedAt: string;\n permissionMode: CodeAgentPermissionMode;\n}\n\nconst DEFAULT_COMMAND_TIMEOUT_MS = 120_000;\nconst MAX_TOOL_OUTPUT_CHARS = 50_000;\nconst MAX_FILE_READ_CHARS = 120_000;\n\nexport async function executeCodeAgentRun(\n options: ExecuteCodeAgentRunOptions,\n): Promise<CodeAgentRunRecord | null> {\n const existing = getCodeAgentRunRecord(options.runId);\n if (!existing) return null;\n\n const prompt = options.prompt ?? latestUserPrompt(existing.id);\n const executionPrompt = formatPromptWithAttachments(\n prompt,\n options.attachments ?? latestUserPromptAttachments(existing.id, prompt),\n );\n if (!prompt) {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: \"No prompt was found for this Agent-Native Code run.\",\n metadata: { status: \"errored\", phase: \"missing-prompt\" },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: \"errored\",\n phase: \"missing-prompt\",\n progress: {\n label: \"Missing prompt\",\n completed: 0,\n total: 1,\n failed: 1,\n percent: 0,\n },\n });\n }\n\n if (options.appendUserEvent !== false) {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"user\",\n message: prompt,\n metadata: { source: \"execution-prompt\" },\n });\n }\n\n const running = updateCodeAgentRunRecord(existing.id, {\n status: \"running\",\n phase: \"executing\",\n progress: {\n label: \"Running\",\n completed: 0,\n total: 1,\n percent: 10,\n },\n metadata: {\n executionStartedAt: new Date().toISOString(),\n },\n });\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: \"Agent-Native Code run started.\",\n metadata: { status: \"running\", phase: \"executing\" },\n });\n\n const requestedEngine = metadataString(existing, \"engine\");\n const engine =\n options.engine ?? (await resolveExecutorEngine(requestedEngine));\n if (!engine) {\n const message =\n \"No LLM provider key was found. Set ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, or another supported provider key and resume this run.\";\n options.stdout?.write(`${message}\\n`);\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message,\n metadata: { status: \"paused\", phase: \"missing-credentials\" },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: \"paused\",\n phase: \"missing-credentials\",\n needsApproval: false,\n progress: {\n label: \"Missing credentials\",\n completed: 0,\n total: 1,\n percent: 0,\n },\n });\n }\n\n const model =\n options.model ??\n metadataString(existing, \"model\") ??\n process.env.AGENT_MODEL ??\n (await getStoredModelForEngine(engine).catch(() => undefined)) ??\n engine.defaultModel;\n const reasoningEffort =\n options.reasoningEffort ?? metadataReasoningEffort(existing);\n const cwd = existing.cwd || process.cwd();\n const permissionMode = existing.permissionMode ?? \"full-auto\";\n const actions = createLocalCodeAgentActions(cwd, permissionMode, existing.id);\n const mcpManager = await startCodeAgentMcpManager(existing.id);\n if (mcpManager) {\n Object.assign(actions, mcpToolsToActionEntries(mcpManager));\n }\n actions[TOOL_SEARCH_ACTION_NAME] = createToolSearchEntry(() => actions);\n const tools = actionsToEngineTools(actions);\n const messages = buildCodeAgentMessages(existing, executionPrompt);\n const controller = new AbortController();\n const abortFromParent = () => controller.abort();\n if (options.signal) {\n if (options.signal.aborted) controller.abort();\n else\n options.signal.addEventListener(\"abort\", abortFromParent, { once: true });\n }\n\n let assistantText = \"\";\n const send = (event: AgentChatEvent) => {\n if (event.type === \"text\") {\n assistantText += event.text;\n options.stdout?.write(event.text);\n return;\n }\n if (event.type === \"activity\") {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: event.label,\n metadata: { type: \"activity\", tool: event.tool },\n });\n return;\n }\n if (event.type === \"tool_start\") {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: `Running ${event.tool}.`,\n metadata: { type: \"tool_start\", tool: event.tool, input: event.input },\n });\n return;\n }\n if (event.type === \"tool_done\") {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: `Finished ${event.tool}.`,\n metadata: {\n type: \"tool_done\",\n tool: event.tool,\n result: truncateCodingOutput(event.result, 4000),\n ...(event.mcpApp ? { mcpApp: event.mcpApp } : {}),\n },\n });\n return;\n }\n if (event.type === \"error\") {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: event.error,\n metadata: { type: \"error\", errorCode: event.errorCode },\n });\n }\n };\n\n try {\n await runWithOptionalCodeAgentRequestContext(existing, () =>\n runAgentLoop({\n engine,\n model,\n systemPrompt: codeAgentSystemPrompt(cwd, permissionMode),\n tools,\n actions,\n messages,\n send,\n signal: controller.signal,\n maxIterations: 12,\n reasoningEffort,\n }),\n );\n if (assistantText.trim()) {\n options.stdout?.write(\"\\n\");\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"system\",\n message: assistantText.trim(),\n metadata: {\n role: \"assistant\",\n model,\n engine: engine.name,\n reasoningEffort,\n },\n });\n }\n const approvalPending = getPendingApproval(existing.id);\n if (approvalPending) {\n const message = `Agent-Native Code run paused for approval: ${approvalPending.reason}`;\n options.stdout?.write(`\\n${message}\\n`);\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message,\n metadata: {\n status: \"needs-approval\",\n phase: \"approval-required\",\n pendingApprovalId: approvalPending.id,\n },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: \"needs-approval\",\n phase: \"approval-required\",\n needsApproval: true,\n progress: {\n label: \"Approval required\",\n completed: 0,\n total: 1,\n percent: 50,\n },\n });\n }\n\n const pendingFollowUp = dequeueCodeAgentFollowUp(existing.id);\n if (pendingFollowUp) {\n const message =\n pendingFollowUp.mode === \"queued\"\n ? \"Agent-Native Code run completed; running queued follow-up.\"\n : \"Agent-Native Code run completed; applying steering follow-up.\";\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message,\n metadata: {\n status: \"running\",\n phase: \"follow-up\",\n followUpId: pendingFollowUp.id,\n followUpMode: pendingFollowUp.mode,\n },\n });\n if (pendingFollowUp.permissionMode) {\n updateCodeAgentRunRecord(existing.id, {\n permissionMode: pendingFollowUp.permissionMode,\n });\n }\n return executeCodeAgentRun({\n ...options,\n runId: existing.id,\n prompt: pendingFollowUp.prompt,\n attachments:\n pendingFollowUp.attachments ??\n userPromptAttachmentsForEvent(existing.id, pendingFollowUp.eventId),\n appendUserEvent: false,\n });\n }\n\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: \"Agent-Native Code run completed.\",\n metadata: { status: \"completed\", phase: \"complete\" },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: \"completed\",\n phase: \"complete\",\n needsApproval: false,\n progress: {\n label: \"Complete\",\n completed: 1,\n total: 1,\n percent: 100,\n },\n metadata: {\n executionCompletedAt: new Date().toISOString(),\n engine: engine.name,\n model,\n reasoningEffort,\n permissionMode,\n },\n });\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n options.stdout?.write(`\\nAgent-Native Code run failed: ${message}\\n`);\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: `Agent-Native Code run failed: ${message}`,\n metadata: { status: \"errored\", phase: \"error\" },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: controller.signal.aborted ? \"paused\" : \"errored\",\n phase: controller.signal.aborted ? \"paused\" : \"error\",\n progress: {\n label: controller.signal.aborted ? \"Paused\" : \"Error\",\n completed: 0,\n total: 1,\n failed: controller.signal.aborted ? 0 : 1,\n percent: 0,\n },\n metadata: {\n executionError: message,\n executionErroredAt: new Date().toISOString(),\n },\n });\n } finally {\n options.signal?.removeEventListener(\"abort\", abortFromParent);\n await mcpManager?.stop().catch(() => undefined);\n void running;\n }\n}\n\nexport async function executeExistingCodeAgentRun(\n runId: string,\n options: Omit<ExecuteCodeAgentRunOptions, \"runId\"> = {},\n): Promise<CodeAgentRunRecord | null> {\n return executeCodeAgentRun({ ...options, runId, appendUserEvent: false });\n}\n\nexport async function executePendingCodeAgentApproval(\n runId: string,\n options: { stdout?: NodeJS.WritableStream } = {},\n): Promise<CodeAgentRunRecord | null> {\n const record = getCodeAgentRunRecord(runId);\n if (!record) return null;\n const approval = getPendingApproval(runId);\n if (!approval) {\n options.stdout?.write(\"No pending approval was found for this run.\\n\");\n return record;\n }\n\n const permission = classifyCodeAgentCommandPermission(approval.command);\n if (permission.kind === \"forbidden\") {\n const message = `Approval cannot run forbidden command: ${permission.reason}`;\n options.stdout?.write(`${message}\\n`);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message,\n metadata: {\n status: \"needs-approval\",\n phase: \"approval-forbidden\",\n approvalId: approval.id,\n },\n });\n return updateCodeAgentRunRecord(runId, {\n status: \"needs-approval\",\n phase: \"approval-forbidden\",\n needsApproval: true,\n });\n }\n\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `Approved command ${approval.id}; running now.`,\n metadata: {\n status: \"running\",\n phase: \"approval-running\",\n approvalId: approval.id,\n command: approval.command,\n },\n });\n const result = await runCodingCommand(\n approval.command,\n record.cwd || process.cwd(),\n DEFAULT_COMMAND_TIMEOUT_MS,\n );\n const summary = truncateCodingOutput(\n [\n `Approved command finished with exit code ${result.code}.`,\n result.timedOut ? \"Timed out: true\" : \"\",\n result.stdout ? `stdout:\\n${result.stdout}` : \"\",\n result.stderr ? `stderr:\\n${result.stderr}` : \"\",\n ]\n .filter(Boolean)\n .join(\"\\n\\n\"),\n MAX_TOOL_OUTPUT_CHARS,\n );\n options.stdout?.write(`${summary}\\n`);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: summary,\n metadata: {\n status: result.code === 0 ? \"paused\" : \"errored\",\n phase: \"approval-complete\",\n approvalId: approval.id,\n exitCode: result.code,\n timedOut: result.timedOut,\n },\n });\n return updateCodeAgentRunRecord(runId, {\n status: result.code === 0 ? \"paused\" : \"errored\",\n phase: result.code === 0 ? \"approval-complete\" : \"approval-command-error\",\n needsApproval: false,\n progress: {\n label: result.code === 0 ? \"Approval complete\" : \"Approval failed\",\n completed: result.code === 0 ? 1 : 0,\n total: 1,\n failed: result.code === 0 ? 0 : 1,\n percent: result.code === 0 ? 100 : 0,\n },\n metadata: {\n pendingApproval: undefined,\n lastApproval: {\n ...approval,\n completedAt: new Date().toISOString(),\n exitCode: result.code,\n },\n },\n });\n}\n\nfunction latestUserPrompt(runId: string): string {\n const events = listCodeAgentTranscriptEvents(runId);\n for (let i = events.length - 1; i >= 0; i--) {\n const event = events[i];\n if (event.kind === \"user\" && event.message.trim()) return event.message;\n }\n return \"\";\n}\n\nfunction latestUserPromptAttachments(\n runId: string,\n prompt: string,\n): AgentPromptAttachment[] {\n const events = listCodeAgentTranscriptEvents(runId);\n const normalizedPrompt = prompt.trim();\n for (let i = events.length - 1; i >= 0; i--) {\n const event = events[i];\n if (event.kind !== \"user\" || !event.message.trim()) continue;\n if (\n !normalizedPrompt ||\n event.message.trim() === normalizedPrompt ||\n i === events.length - 1\n ) {\n return promptAttachmentsFromMetadata(event.metadata?.attachments);\n }\n }\n return [];\n}\n\nfunction userPromptAttachmentsForEvent(\n runId: string,\n eventId: string | undefined,\n): AgentPromptAttachment[] {\n if (!eventId) return [];\n const event = listCodeAgentTranscriptEvents(runId).find(\n (item) => item.id === eventId && item.kind === \"user\",\n );\n return promptAttachmentsFromMetadata(event?.metadata?.attachments);\n}\n\nfunction promptAttachmentsFromMetadata(\n value: unknown,\n): AgentPromptAttachment[] {\n if (!Array.isArray(value)) return [];\n return value\n .filter((item): item is Record<string, unknown> =>\n Boolean(item && typeof item === \"object\" && !Array.isArray(item)),\n )\n .map((item) => ({\n name: typeof item.name === \"string\" && item.name ? item.name : \"file\",\n ...(typeof item.type === \"string\" ? { type: item.type } : {}),\n ...(typeof item.size === \"number\" ? { size: item.size } : {}),\n ...(typeof item.text === \"string\" ? { text: item.text } : {}),\n ...(typeof item.dataUrl === \"string\" ? { dataUrl: item.dataUrl } : {}),\n }));\n}\n\nfunction metadataString(\n run: CodeAgentRunRecord,\n key: string,\n): string | undefined {\n const value = run.metadata?.[key];\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n}\n\nasync function startCodeAgentMcpManager(\n runId: string,\n): Promise<McpClientManager | null> {\n const config = await buildMergedConfig().catch((err) => {\n const message = err instanceof Error ? err.message : String(err);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `MCP tools unavailable: ${message}`,\n metadata: { type: \"mcp-config-error\" },\n });\n return null;\n });\n if (!config || Object.keys(config.servers ?? {}).length === 0) return null;\n\n const manager = new McpClientManager(config);\n await manager.start().catch((err) => {\n const message = err instanceof Error ? err.message : String(err);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `MCP tools failed to start: ${message}`,\n metadata: { type: \"mcp-start-error\" },\n });\n });\n const status = manager.getStatus();\n if (status.totalTools === 0) {\n await manager.stop().catch(() => undefined);\n return null;\n }\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `Connected ${status.totalTools} MCP tool${status.totalTools === 1 ? \"\" : \"s\"} for this run.`,\n metadata: {\n type: \"mcp-tools-connected\",\n servers: status.connectedServers,\n toolCount: status.totalTools,\n },\n });\n return manager;\n}\n\nfunction runWithOptionalCodeAgentRequestContext<T>(\n run: CodeAgentRunRecord,\n fn: () => T | Promise<T>,\n): T | Promise<T> {\n const userEmail =\n metadataString(run, \"ownerEmail\") ??\n metadataString(run, \"userEmail\") ??\n process.env.AGENT_USER_EMAIL;\n const orgId = metadataString(run, \"orgId\") ?? process.env.AGENT_ORG_ID;\n if (!userEmail && !orgId) return fn();\n return runWithRequestContext({ userEmail, orgId }, fn);\n}\n\nfunction metadataReasoningEffort(\n run: CodeAgentRunRecord,\n): ReasoningEffort | undefined {\n const value = run.metadata?.reasoningEffort ?? run.metadata?.effort;\n return isReasoningEffort(value) && value !== \"auto\" ? value : undefined;\n}\n\nasync function resolveExecutorEngine(\n requestedEngine?: string,\n): Promise<AgentEngine | null> {\n const fakeText = process.env.AGENT_NATIVE_CODE_AGENT_FAKE_RESPONSE;\n if (fakeText !== undefined) {\n return createFakeCodeAgentEngine(fakeText || \"Done.\");\n }\n registerBuiltinEngines();\n if (!hasAnyProviderCredential()) return null;\n return resolveEngine({\n engineOption: requestedEngine ?? process.env.AGENT_ENGINE,\n });\n}\n\nfunction hasAnyProviderCredential(): boolean {\n if (process.env.AGENT_ENGINE) return true;\n if (PROVIDER_ENV_VARS.some((key) => Boolean(process.env[key]))) return true;\n return Boolean(\n process.env.BUILDER_PRIVATE_KEY && process.env.BUILDER_PUBLIC_KEY,\n );\n}\n\nfunction createFakeCodeAgentEngine(text: string): AgentEngine {\n return {\n name: \"fake-code-agent\",\n label: \"Fake Agent-Native Code\",\n defaultModel: \"fake-code-agent\",\n supportedModels: [\"fake-code-agent\"],\n capabilities: {\n thinking: false,\n promptCaching: false,\n vision: false,\n computerUse: false,\n parallelToolCalls: false,\n },\n async *stream(_opts: EngineStreamOptions): AsyncIterable<EngineEvent> {\n yield { type: \"text-delta\", text };\n yield {\n type: \"assistant-content\",\n parts: [{ type: \"text\", text }],\n };\n yield {\n type: \"usage\",\n inputTokens: 1,\n outputTokens: 1,\n cacheReadTokens: 0,\n cacheWriteTokens: 0,\n };\n yield { type: \"stop\", reason: \"end_turn\" };\n },\n };\n}\n\nfunction buildCodeAgentMessages(\n run: CodeAgentRunRecord,\n prompt: string,\n): EngineMessage[] {\n const transcript = listCodeAgentTranscriptEvents(run.id)\n .slice(-40)\n .map((event) => {\n const label =\n event.kind === \"user\"\n ? \"User\"\n : event.metadata?.role === \"assistant\"\n ? \"Assistant\"\n : event.kind;\n return `${label}: ${event.message}`;\n })\n .join(\"\\n\");\n const context = transcript\n ? `\\n\\nPrevious session transcript:\\n${transcript}`\n : \"\";\n return [\n {\n role: \"user\",\n content: [\n {\n type: \"text\",\n text: `${prompt}${context}`,\n },\n ],\n },\n ];\n}\n\nfunction codeAgentSystemPrompt(\n cwd: string,\n permissionMode: CodeAgentPermissionMode,\n): string {\n return `You are Agent-Native Code, a local coding agent running in ${cwd}.\n\nWork like a careful senior engineer:\n- Read relevant files before editing.\n- Prefer small, focused changes.\n- Current run mode: ${permissionMode === \"read-only\" ? \"Plan mode\" : \"Auto mode\"} (${permissionMode}).\n- In Plan mode, inspect and explain only.\n- In Auto mode, edit files and run ordinary project commands without pausing. Pause only for genuinely destructive operations such as recursive deletes, package publishing, privileged commands, destructive database operations, or forbidden git branch/reset/stash/rebase operations.\n- Do not create, switch, delete, reset, rebase, or stash git branches.\n- Do not run destructive git commands.\n- Use the shared coding tools: bash for search/list/test/build commands, read for file reads, edit for exact replacement edits, and write only for new files or intentional full rewrites.\n- Prefer edit over write when changing existing files, then run focused verification with bash.\n- Use tool-search when you need a capability that may come from MCP, including browser automation or computer control.\n- Prefer Playwright MCP for deterministic browser testing; prefer Chrome DevTools MCP when the user needs their live logged-in Chrome session.\n- Only use computer-control MCP tools when they are explicitly available and the user request warrants controlling the local computer.\n- Keep the final answer concise and include files changed plus tests run.\n- Respect any AGENTS.md instructions in the repository.`;\n}\n\nfunction createLocalCodeAgentActions(\n cwd: string,\n permissionMode: CodeAgentPermissionMode,\n runId: string,\n): Record<string, ActionEntry> {\n const actions = createCodingToolRegistry({\n cwd,\n restrictToCwd: true,\n commandTimeoutMs: DEFAULT_COMMAND_TIMEOUT_MS,\n maxOutputChars: MAX_TOOL_OUTPUT_CHARS,\n maxFileReadChars: MAX_FILE_READ_CHARS,\n canWrite: (toolName) => permissionErrorForWrite(permissionMode, toolName),\n beforeBash: ({ command }) => {\n const permission = classifyCodeAgentCommandPermission(command);\n if (permission.kind === \"forbidden\") {\n return `Error: command is blocked by Agent-Native Code policy: ${permission.reason}`;\n }\n if (permission.kind !== \"read\") {\n const permissionError = permissionErrorForWrite(permissionMode, \"bash\");\n if (permissionError) return permissionError;\n }\n if (permission.kind === \"approval-required\") {\n const approval = requestCodeAgentApproval(runId, {\n tool: \"bash\",\n command,\n reason: permission.reason,\n permissionMode,\n });\n return [\n `Approval required before running this command: ${permission.reason}.`,\n `Approval id: ${approval.id}`,\n `Command: ${command}`,\n \"The run is paused; approve from the Agent-Native Code UI/CLI if this command is intentional.\",\n ].join(\"\\n\");\n }\n return null;\n },\n });\n if (permissionMode === \"read-only\") {\n return {\n bash: actions.bash,\n read: actions.read,\n };\n }\n return actions;\n}\n\nexport type CodeAgentCommandPermission =\n | { kind: \"read\" }\n | { kind: \"write\" }\n | { kind: \"approval-required\"; reason: string }\n | { kind: \"forbidden\"; reason: string };\n\nexport function classifyCodeAgentCommandPermission(\n command: string,\n): CodeAgentCommandPermission {\n const normalized = command.trim().toLowerCase();\n if (!normalized) return { kind: \"read\" };\n\n const blockedPatterns: Array<[RegExp, string]> = [\n [\n /\\bgit\\s+(checkout|switch|reset|rebase|stash|clean|worktree)\\b/,\n \"forbidden git branch/reset/stash/rebase operation\",\n ],\n [\n /\\bgit\\s+branch\\b(?!\\s+--show-current\\b)/,\n \"forbidden git branch operation\",\n ],\n [/\\bdrizzle-kit\\s+push\\b/, \"drizzle-kit push is not allowed\"],\n ];\n for (const [pattern, reason] of blockedPatterns) {\n if (pattern.test(normalized)) return { kind: \"forbidden\", reason };\n }\n\n const approvalPatterns: Array<[RegExp, string]> = [\n [/\\brm\\s+-rf\\b/, \"destructive recursive delete\"],\n [/\\bsudo\\b/, \"privileged command\"],\n [/\\bkill\\s+-9\\b/, \"force-kill command\"],\n [/\\bcurl\\b.*\\|\\s*(sh|bash|zsh)\\b/, \"remote script execution\"],\n [/\\b(wget|fetch)\\b.*\\|\\s*(sh|bash|zsh)\\b/, \"remote script execution\"],\n [/\\bnpm\\s+publish\\b/, \"package publish\"],\n [/\\bpnpm\\s+publish\\b/, \"package publish\"],\n [/\\btruncate\\b/, \"destructive data command\"],\n [/\\bdrop\\s+(table|column|database)\\b/, \"destructive database command\"],\n [/\\bdelete\\s+from\\b(?![\\s\\S]*\\bwhere\\b)/, \"unscoped delete command\"],\n ];\n for (const [pattern, reason] of approvalPatterns) {\n if (pattern.test(normalized)) {\n return { kind: \"approval-required\", reason };\n }\n }\n\n if (isReadOnlyShellCommand(command)) {\n return { kind: \"read\" };\n }\n\n const writePatterns = [\n /(^|[^>])>(?!>)/,\n />>/,\n /\\btee\\b/,\n /\\bapply_patch\\b/,\n /\\b(write|touch|mkdir|cp|mv|rm|chmod|chown)\\b/,\n /\\bpnpm\\s+(add|install|remove|dlx)\\b/,\n /\\bnpm\\s+(install|i|add|remove|uninstall)\\b/,\n ];\n if (writePatterns.some((pattern) => pattern.test(normalized))) {\n return { kind: \"write\" };\n }\n\n return { kind: \"write\" };\n}\n\nfunction permissionErrorForWrite(\n permissionMode: CodeAgentPermissionMode,\n toolName: string,\n): string | null {\n if (\n permissionMode === \"ask-before-edit\" ||\n permissionMode === \"auto-edit\" ||\n permissionMode === \"full-auto\"\n ) {\n return null;\n }\n if (permissionMode === \"read-only\") {\n return `Error: ${toolName} is unavailable in read-only mode.`;\n }\n return `Error: ${toolName} is blocked by the current run mode.`;\n}\n\nfunction requestCodeAgentApproval(\n runId: string,\n input: Omit<PendingCodeAgentApproval, \"id\" | \"requestedAt\">,\n): PendingCodeAgentApproval {\n const requestedAt = new Date().toISOString();\n const approval: PendingCodeAgentApproval = {\n id: `approval-${requestedAt.replace(/\\D/g, \"\").slice(0, 14)}`,\n requestedAt,\n ...input,\n };\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `Approval required: ${approval.reason}`,\n metadata: {\n status: \"needs-approval\",\n phase: \"approval-required\",\n pendingApproval: approval,\n },\n });\n updateCodeAgentRunRecord(runId, {\n status: \"needs-approval\",\n phase: \"approval-required\",\n needsApproval: true,\n progress: {\n label: \"Approval required\",\n completed: 0,\n total: 1,\n percent: 50,\n },\n metadata: {\n pendingApproval: approval,\n },\n });\n return approval;\n}\n\nfunction getPendingApproval(runId: string): PendingCodeAgentApproval | null {\n const record = getCodeAgentRunRecord(runId);\n const approval = record?.metadata?.pendingApproval;\n if (!approval || typeof approval !== \"object\") return null;\n const candidate = approval as Record<string, unknown>;\n const tool =\n candidate.tool === \"bash\" || candidate.tool === \"run_command\"\n ? candidate.tool\n : null;\n if (\n !tool ||\n typeof candidate.command !== \"string\" ||\n typeof candidate.reason !== \"string\" ||\n typeof candidate.id !== \"string\" ||\n typeof candidate.requestedAt !== \"string\"\n ) {\n return null;\n }\n return {\n id: candidate.id,\n tool,\n command: candidate.command,\n reason: candidate.reason,\n requestedAt: candidate.requestedAt,\n permissionMode:\n candidate.permissionMode === \"read-only\" ||\n candidate.permissionMode === \"ask-before-edit\" ||\n candidate.permissionMode === \"auto-edit\" ||\n candidate.permissionMode === \"full-auto\"\n ? candidate.permissionMode\n : \"full-auto\",\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"code-agent-executor.js","sourceRoot":"","sources":["../../src/cli/code-agent-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACt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B,CAAC,CAAC,WAAW;KAClB,CAAC;AACJ,CAAC","sourcesContent":["import {\n createToolSearchEntry,\n TOOL_SEARCH_ACTION_NAME,\n} from \"../agent/tool-search.js\";\nimport {\n createCodingToolRegistry,\n isReadOnlyShellCommand,\n runCodingCommand,\n truncateCodingOutput,\n} from \"../coding-tools/index.js\";\nimport {\n buildMergedConfig,\n McpClientManager,\n mcpToolsToActionEntries,\n} from \"../mcp-client/index.js\";\nimport { runWithRequestContext } from \"../server/request-context.js\";\nimport {\n actionsToEngineTools,\n runAgentLoop,\n type ActionEntry,\n} from \"../agent/production-agent.js\";\nimport {\n resolveEngine,\n getStoredModelForEngine,\n registerBuiltinEngines,\n} from \"../agent/engine/index.js\";\nimport type {\n AgentEngine,\n EngineContentPart,\n EngineEvent,\n EngineMessage,\n EngineStreamOptions,\n} from \"../agent/engine/types.js\";\nimport type { AgentChatEvent } from \"../agent/types.js\";\nimport { PROVIDER_ENV_VARS } from \"../agent/engine/provider-env-vars.js\";\nimport {\n isReasoningEffort,\n type ReasoningEffort,\n} from \"../shared/reasoning-effort.js\";\nimport {\n formatPromptWithAttachments,\n type AgentPromptAttachment,\n} from \"../code-agents/prompt-attachments.js\";\nimport {\n appendCodeAgentTranscriptEvent,\n dequeueCodeAgentFollowUp,\n getCodeAgentRunRecord,\n listCodeAgentTranscriptEvents,\n updateCodeAgentRunRecord,\n type CodeAgentPermissionMode,\n type CodeAgentRunRecord,\n} from \"./code-agent-runs.js\";\n\nexport interface ExecuteCodeAgentRunOptions {\n runId: string;\n prompt?: string;\n appendUserEvent?: boolean;\n engine?: AgentEngine;\n model?: string;\n reasoningEffort?: ReasoningEffort;\n attachments?: AgentPromptAttachment[];\n stdout?: NodeJS.WritableStream;\n signal?: AbortSignal;\n}\n\ninterface PendingCodeAgentApproval {\n id: string;\n tool: \"bash\" | \"run_command\";\n command: string;\n reason: string;\n requestedAt: string;\n permissionMode: CodeAgentPermissionMode;\n}\n\nconst DEFAULT_COMMAND_TIMEOUT_MS = 120_000;\nconst MAX_TOOL_OUTPUT_CHARS = 50_000;\nconst MAX_FILE_READ_CHARS = 120_000;\n\nexport async function executeCodeAgentRun(\n options: ExecuteCodeAgentRunOptions,\n): Promise<CodeAgentRunRecord | null> {\n const existing = getCodeAgentRunRecord(options.runId);\n if (!existing) return null;\n\n const prompt = options.prompt ?? latestUserPrompt(existing.id);\n const executionPrompt = formatPromptWithAttachments(\n prompt,\n options.attachments ?? latestUserPromptAttachments(existing.id, prompt),\n );\n if (!prompt) {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: \"No prompt was found for this Agent-Native Code run.\",\n metadata: { status: \"errored\", phase: \"missing-prompt\" },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: \"errored\",\n phase: \"missing-prompt\",\n progress: {\n label: \"Missing prompt\",\n completed: 0,\n total: 1,\n failed: 1,\n percent: 0,\n },\n });\n }\n\n if (options.appendUserEvent !== false) {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"user\",\n message: prompt,\n metadata: { source: \"execution-prompt\" },\n });\n }\n\n const running = updateCodeAgentRunRecord(existing.id, {\n status: \"running\",\n phase: \"executing\",\n progress: {\n label: \"Running\",\n completed: 0,\n total: 1,\n percent: 10,\n },\n metadata: {\n executionStartedAt: new Date().toISOString(),\n },\n });\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: \"Agent-Native Code run started.\",\n metadata: { status: \"running\", phase: \"executing\" },\n });\n\n const requestedEngine = metadataString(existing, \"engine\");\n const engine =\n options.engine ?? (await resolveExecutorEngine(requestedEngine));\n if (!engine) {\n const message =\n \"No LLM provider key was found. Set ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, or another supported provider key and resume this run.\";\n options.stdout?.write(`${message}\\n`);\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message,\n metadata: { status: \"paused\", phase: \"missing-credentials\" },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: \"paused\",\n phase: \"missing-credentials\",\n needsApproval: false,\n progress: {\n label: \"Missing credentials\",\n completed: 0,\n total: 1,\n percent: 0,\n },\n });\n }\n\n const model =\n options.model ??\n metadataString(existing, \"model\") ??\n process.env.AGENT_MODEL ??\n (await getStoredModelForEngine(engine).catch(() => undefined)) ??\n engine.defaultModel;\n const reasoningEffort =\n options.reasoningEffort ?? metadataReasoningEffort(existing);\n const cwd = existing.cwd || process.cwd();\n const permissionMode = existing.permissionMode ?? \"full-auto\";\n const actions = createLocalCodeAgentActions(cwd, permissionMode, existing.id);\n const mcpManager = await startCodeAgentMcpManager(existing.id);\n if (mcpManager) {\n Object.assign(actions, mcpToolsToActionEntries(mcpManager));\n }\n actions[TOOL_SEARCH_ACTION_NAME] = createToolSearchEntry(() => actions);\n const tools = actionsToEngineTools(actions);\n const messages = buildCodeAgentMessages(existing, executionPrompt);\n const controller = new AbortController();\n const abortFromParent = () => controller.abort();\n if (options.signal) {\n if (options.signal.aborted) controller.abort();\n else\n options.signal.addEventListener(\"abort\", abortFromParent, { once: true });\n }\n\n let assistantText = \"\";\n const send = (event: AgentChatEvent) => {\n if (event.type === \"text\") {\n assistantText += event.text;\n options.stdout?.write(event.text);\n return;\n }\n if (event.type === \"activity\") {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: event.label,\n metadata: { type: \"activity\", tool: event.tool },\n });\n return;\n }\n if (event.type === \"tool_start\") {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: `Running ${event.tool}.`,\n metadata: { type: \"tool_start\", tool: event.tool, input: event.input },\n });\n return;\n }\n if (event.type === \"tool_done\") {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: `Finished ${event.tool}.`,\n metadata: {\n type: \"tool_done\",\n tool: event.tool,\n result: truncateCodingOutput(event.result, 4000),\n ...(event.mcpApp ? { mcpApp: event.mcpApp } : {}),\n },\n });\n return;\n }\n if (event.type === \"error\") {\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: event.error,\n metadata: { type: \"error\", errorCode: event.errorCode },\n });\n }\n };\n\n try {\n await runWithOptionalCodeAgentRequestContext(existing, () =>\n runAgentLoop({\n engine,\n model,\n systemPrompt: codeAgentSystemPrompt(cwd, permissionMode),\n tools,\n actions,\n messages,\n send,\n signal: controller.signal,\n maxIterations: 12,\n reasoningEffort,\n }),\n );\n if (assistantText.trim()) {\n options.stdout?.write(\"\\n\");\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"system\",\n message: assistantText.trim(),\n metadata: {\n role: \"assistant\",\n model,\n engine: engine.name,\n reasoningEffort,\n },\n });\n }\n const approvalPending = getPendingApproval(existing.id);\n if (approvalPending) {\n const message = `Agent-Native Code run paused for approval: ${approvalPending.reason}`;\n options.stdout?.write(`\\n${message}\\n`);\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message,\n metadata: {\n status: \"needs-approval\",\n phase: \"approval-required\",\n pendingApprovalId: approvalPending.id,\n },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: \"needs-approval\",\n phase: \"approval-required\",\n needsApproval: true,\n progress: {\n label: \"Approval required\",\n completed: 0,\n total: 1,\n percent: 50,\n },\n });\n }\n\n const pendingFollowUp = dequeueCodeAgentFollowUp(existing.id);\n if (pendingFollowUp) {\n const message =\n pendingFollowUp.mode === \"queued\"\n ? \"Agent-Native Code run completed; running queued follow-up.\"\n : \"Agent-Native Code run completed; applying steering follow-up.\";\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message,\n metadata: {\n status: \"running\",\n phase: \"follow-up\",\n followUpId: pendingFollowUp.id,\n followUpMode: pendingFollowUp.mode,\n },\n });\n if (pendingFollowUp.permissionMode) {\n updateCodeAgentRunRecord(existing.id, {\n permissionMode: pendingFollowUp.permissionMode,\n });\n }\n return executeCodeAgentRun({\n ...options,\n runId: existing.id,\n prompt: pendingFollowUp.prompt,\n attachments:\n pendingFollowUp.attachments ??\n userPromptAttachmentsForEvent(existing.id, pendingFollowUp.eventId),\n appendUserEvent: false,\n });\n }\n\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: \"Agent-Native Code run completed.\",\n metadata: { status: \"completed\", phase: \"complete\" },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: \"completed\",\n phase: \"complete\",\n needsApproval: false,\n progress: {\n label: \"Complete\",\n completed: 1,\n total: 1,\n percent: 100,\n },\n metadata: {\n executionCompletedAt: new Date().toISOString(),\n engine: engine.name,\n model,\n reasoningEffort,\n permissionMode,\n },\n });\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n options.stdout?.write(`\\nAgent-Native Code run failed: ${message}\\n`);\n appendCodeAgentTranscriptEvent({\n runId: existing.id,\n kind: \"status\",\n message: `Agent-Native Code run failed: ${message}`,\n metadata: { status: \"errored\", phase: \"error\" },\n });\n return updateCodeAgentRunRecord(existing.id, {\n status: controller.signal.aborted ? \"paused\" : \"errored\",\n phase: controller.signal.aborted ? \"paused\" : \"error\",\n progress: {\n label: controller.signal.aborted ? \"Paused\" : \"Error\",\n completed: 0,\n total: 1,\n failed: controller.signal.aborted ? 0 : 1,\n percent: 0,\n },\n metadata: {\n executionError: message,\n executionErroredAt: new Date().toISOString(),\n },\n });\n } finally {\n options.signal?.removeEventListener(\"abort\", abortFromParent);\n await mcpManager?.stop().catch(() => undefined);\n void running;\n }\n}\n\nexport async function executeExistingCodeAgentRun(\n runId: string,\n options: Omit<ExecuteCodeAgentRunOptions, \"runId\"> = {},\n): Promise<CodeAgentRunRecord | null> {\n return executeCodeAgentRun({ ...options, runId, appendUserEvent: false });\n}\n\nexport async function executePendingCodeAgentApproval(\n runId: string,\n options: { stdout?: NodeJS.WritableStream } = {},\n): Promise<CodeAgentRunRecord | null> {\n const record = getCodeAgentRunRecord(runId);\n if (!record) return null;\n const approval = getPendingApproval(runId);\n if (!approval) {\n options.stdout?.write(\"No pending approval was found for this run.\\n\");\n return record;\n }\n\n const permission = classifyCodeAgentCommandPermission(approval.command);\n if (permission.kind === \"forbidden\") {\n const message = `Approval cannot run forbidden command: ${permission.reason}`;\n options.stdout?.write(`${message}\\n`);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message,\n metadata: {\n status: \"needs-approval\",\n phase: \"approval-forbidden\",\n approvalId: approval.id,\n },\n });\n return updateCodeAgentRunRecord(runId, {\n status: \"needs-approval\",\n phase: \"approval-forbidden\",\n needsApproval: true,\n });\n }\n\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `Approved command ${approval.id}; running now.`,\n metadata: {\n status: \"running\",\n phase: \"approval-running\",\n approvalId: approval.id,\n command: approval.command,\n },\n });\n const result = await runCodingCommand(\n approval.command,\n record.cwd || process.cwd(),\n DEFAULT_COMMAND_TIMEOUT_MS,\n );\n const summary = truncateCodingOutput(\n [\n `Approved command finished with exit code ${result.code}.`,\n result.timedOut ? \"Timed out: true\" : \"\",\n result.stdout ? `stdout:\\n${result.stdout}` : \"\",\n result.stderr ? `stderr:\\n${result.stderr}` : \"\",\n ]\n .filter(Boolean)\n .join(\"\\n\\n\"),\n MAX_TOOL_OUTPUT_CHARS,\n );\n options.stdout?.write(`${summary}\\n`);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: summary,\n metadata: {\n status: result.code === 0 ? \"paused\" : \"errored\",\n phase: \"approval-complete\",\n approvalId: approval.id,\n exitCode: result.code,\n timedOut: result.timedOut,\n },\n });\n return updateCodeAgentRunRecord(runId, {\n status: result.code === 0 ? \"paused\" : \"errored\",\n phase: result.code === 0 ? \"approval-complete\" : \"approval-command-error\",\n needsApproval: false,\n progress: {\n label: result.code === 0 ? \"Approval complete\" : \"Approval failed\",\n completed: result.code === 0 ? 1 : 0,\n total: 1,\n failed: result.code === 0 ? 0 : 1,\n percent: result.code === 0 ? 100 : 0,\n },\n metadata: {\n pendingApproval: undefined,\n lastApproval: {\n ...approval,\n completedAt: new Date().toISOString(),\n exitCode: result.code,\n },\n },\n });\n}\n\nfunction latestUserPrompt(runId: string): string {\n const events = listCodeAgentTranscriptEvents(runId);\n for (let i = events.length - 1; i >= 0; i--) {\n const event = events[i];\n if (event.kind === \"user\" && event.message.trim()) return event.message;\n }\n return \"\";\n}\n\nfunction latestUserPromptAttachments(\n runId: string,\n prompt: string,\n): AgentPromptAttachment[] {\n const events = listCodeAgentTranscriptEvents(runId);\n const normalizedPrompt = prompt.trim();\n for (let i = events.length - 1; i >= 0; i--) {\n const event = events[i];\n if (event.kind !== \"user\" || !event.message.trim()) continue;\n if (\n !normalizedPrompt ||\n event.message.trim() === normalizedPrompt ||\n i === events.length - 1\n ) {\n return promptAttachmentsFromMetadata(event.metadata?.attachments);\n }\n }\n return [];\n}\n\nfunction userPromptAttachmentsForEvent(\n runId: string,\n eventId: string | undefined,\n): AgentPromptAttachment[] {\n if (!eventId) return [];\n const event = listCodeAgentTranscriptEvents(runId).find(\n (item) => item.id === eventId && item.kind === \"user\",\n );\n return promptAttachmentsFromMetadata(event?.metadata?.attachments);\n}\n\nfunction promptAttachmentsFromMetadata(\n value: unknown,\n): AgentPromptAttachment[] {\n if (!Array.isArray(value)) return [];\n return value\n .filter((item): item is Record<string, unknown> =>\n Boolean(item && typeof item === \"object\" && !Array.isArray(item)),\n )\n .map((item) => ({\n name: typeof item.name === \"string\" && item.name ? item.name : \"file\",\n ...(typeof item.type === \"string\" ? { type: item.type } : {}),\n ...(typeof item.size === \"number\" ? { size: item.size } : {}),\n ...(typeof item.text === \"string\" ? { text: item.text } : {}),\n ...(typeof item.dataUrl === \"string\" ? { dataUrl: item.dataUrl } : {}),\n }));\n}\n\nfunction metadataString(\n run: CodeAgentRunRecord,\n key: string,\n): string | undefined {\n const value = run.metadata?.[key];\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n}\n\nasync function startCodeAgentMcpManager(\n runId: string,\n): Promise<McpClientManager | null> {\n const config = await buildMergedConfig().catch((err) => {\n const message = err instanceof Error ? err.message : String(err);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `MCP tools unavailable: ${message}`,\n metadata: { type: \"mcp-config-error\" },\n });\n return null;\n });\n if (!config || Object.keys(config.servers ?? {}).length === 0) return null;\n\n const manager = new McpClientManager(config);\n await manager.start().catch((err) => {\n const message = err instanceof Error ? err.message : String(err);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `MCP tools failed to start: ${message}`,\n metadata: { type: \"mcp-start-error\" },\n });\n });\n const status = manager.getStatus();\n if (status.totalTools === 0) {\n await manager.stop().catch(() => undefined);\n return null;\n }\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `Connected ${status.totalTools} MCP tool${status.totalTools === 1 ? \"\" : \"s\"} for this run.`,\n metadata: {\n type: \"mcp-tools-connected\",\n servers: status.connectedServers,\n toolCount: status.totalTools,\n },\n });\n return manager;\n}\n\nfunction runWithOptionalCodeAgentRequestContext<T>(\n run: CodeAgentRunRecord,\n fn: () => T | Promise<T>,\n): T | Promise<T> {\n const userEmail =\n metadataString(run, \"ownerEmail\") ??\n metadataString(run, \"userEmail\") ??\n process.env.AGENT_USER_EMAIL;\n const orgId = metadataString(run, \"orgId\") ?? process.env.AGENT_ORG_ID;\n if (!userEmail && !orgId) return fn();\n return runWithRequestContext({ userEmail, orgId }, fn);\n}\n\nfunction metadataReasoningEffort(\n run: CodeAgentRunRecord,\n): ReasoningEffort | undefined {\n const value = run.metadata?.reasoningEffort ?? run.metadata?.effort;\n return isReasoningEffort(value) && value !== \"auto\" ? value : undefined;\n}\n\nasync function resolveExecutorEngine(\n requestedEngine?: string,\n): Promise<AgentEngine | null> {\n const fakeText = process.env.AGENT_NATIVE_CODE_AGENT_FAKE_RESPONSE;\n if (fakeText !== undefined) {\n return createFakeCodeAgentEngine(fakeText || \"Done.\");\n }\n registerBuiltinEngines();\n if (!hasAnyProviderCredential()) return null;\n return resolveEngine({\n engineOption: requestedEngine ?? process.env.AGENT_ENGINE,\n });\n}\n\nfunction hasAnyProviderCredential(): boolean {\n if (process.env.AGENT_ENGINE) return true;\n if (PROVIDER_ENV_VARS.some((key) => Boolean(process.env[key]))) return true;\n return Boolean(\n process.env.BUILDER_PRIVATE_KEY && process.env.BUILDER_PUBLIC_KEY,\n );\n}\n\nfunction createFakeCodeAgentEngine(text: string): AgentEngine {\n return {\n name: \"fake-code-agent\",\n label: \"Fake Agent-Native Code\",\n defaultModel: \"fake-code-agent\",\n supportedModels: [\"fake-code-agent\"],\n capabilities: {\n thinking: false,\n promptCaching: false,\n vision: false,\n computerUse: false,\n parallelToolCalls: false,\n },\n async *stream(_opts: EngineStreamOptions): AsyncIterable<EngineEvent> {\n yield { type: \"text-delta\", text };\n yield {\n type: \"assistant-content\",\n parts: [{ type: \"text\", text }],\n };\n yield {\n type: \"usage\",\n inputTokens: 1,\n outputTokens: 1,\n cacheReadTokens: 0,\n cacheWriteTokens: 0,\n };\n yield { type: \"stop\", reason: \"end_turn\" };\n },\n };\n}\n\nfunction buildCodeAgentMessages(\n run: CodeAgentRunRecord,\n prompt: string,\n): EngineMessage[] {\n const transcript = listCodeAgentTranscriptEvents(run.id)\n .slice(-40)\n .map((event) => {\n const label =\n event.kind === \"user\"\n ? \"User\"\n : event.metadata?.role === \"assistant\"\n ? \"Assistant\"\n : event.kind;\n return `${label}: ${event.message}`;\n })\n .join(\"\\n\");\n const context = transcript\n ? `\\n\\nPrevious session transcript:\\n${transcript}`\n : \"\";\n return [\n {\n role: \"user\",\n content: [\n {\n type: \"text\",\n text: `${prompt}${context}`,\n },\n ],\n },\n ];\n}\n\nfunction codeAgentSystemPrompt(\n cwd: string,\n permissionMode: CodeAgentPermissionMode,\n): string {\n const mode = permissionMode === \"read-only\" ? \"Plan\" : \"Auto\";\n return `You are Agent-Native Code, a coding agent running in ${cwd}. You and the user share one workspace, and your job is to collaborate with them until their goal is genuinely handled.\n\n# General\n\nYou bring a senior engineer's judgment to the work, but you let it arrive through attention rather than premature certainty. Read the codebase first, resist easy assumptions, and let the shape of the existing system teach you how to move.\n\n- When you search for text or files, reach first for \\`rg\\` or \\`rg --files\\`; they are much faster than \\`grep\\` or \\`find\\`. If \\`rg\\` is unavailable, use the next best tool without fuss.\n- Parallelize independent read-only work (file reads, searches) so you gather context quickly. Keep mutating steps ordered.\n- Read relevant files before editing them. Do not edit a file you have not actually read.\n\n# Engineering judgment\n\nWhen the user leaves implementation details open, choose conservatively and in sympathy with the codebase already in front of you:\n\n- Prefer the repo's existing patterns, frameworks, and local helper APIs over inventing a new abstraction.\n- For structured data, use structured APIs or parsers instead of ad hoc string manipulation when the toolchain gives you a reasonable option.\n- Keep edits closely scoped to what the request and surrounding code imply. Leave unrelated refactors and metadata churn alone unless they are truly needed to finish safely.\n- Add an abstraction only when it removes real complexity, reduces meaningful duplication, or clearly matches an established local pattern.\n- Let test coverage scale with risk and blast radius: focused for narrow changes, broader when you touch shared behavior or cross-module contracts.\n\n# Run mode\n\nCurrent run mode: ${mode} mode (${permissionMode}).\n- In Plan mode, inspect and explain only — do not edit files or run mutating commands.\n- In Auto mode, edit files and run ordinary project commands without pausing. Pause only for genuinely destructive operations: recursive deletes, package publishing, privileged commands, destructive database operations, or forbidden git branch/reset/stash/rebase operations.\n\n# Editing constraints\n\n- Use the shared coding tools: \\`bash\\` for search/list/test/build/git-status commands, \\`read\\` for file reads, \\`edit\\` for exact-match replacements, and \\`write\\` only for new files or an intentional full rewrite. Prefer \\`edit\\` over \\`write\\` for existing files.\n- Default to ASCII when editing or creating files; introduce non-ASCII only when the file already uses it or there is a clear reason.\n- Add succinct comments only where the code is not self-explanatory. Avoid empty narration like \"assign the value\"; a short orienting comment before a complex block is fine, used sparingly.\n- You may be in a dirty git worktree. NEVER revert or overwrite changes you did not make — assume they came from the user or another concurrent agent. If unrelated changes exist, ignore them; if they touch your task, work *with* them rather than undoing them. Only stop and ask if they make the task impossible.\n- If you notice unexpected changes appearing mid-task that you did not make, STOP and ask the user how to proceed rather than guessing.\n- Do not create, switch, delete, reset, rebase, or stash git branches. Never run destructive git commands (\\`git reset --hard\\`, \\`git checkout --\\`, \\`git clean\\`) unless the user explicitly asked for that exact operation.\n\n# Autonomy and verification\n\n- Stay with the work until the task is handled end to end within this turn whenever feasible. Don't stop at analysis or a proposal — implement the fix, and work through blockers yourself before handing them back. The exception is Plan mode, where you propose only.\n- Done means verified, not generated. After code changes (not docs-only), run the repo's checks before reporting success: \\`pnpm run prep\\` (format + typecheck + test + guards), or a focused subset like \\`pnpm typecheck\\` or a single package's tests for a small change. Fix all errors before you call it done.\n- Do not claim a change works, tests pass, or a build succeeds unless you actually ran it and saw the result. If you could not verify something, say exactly what is unverified and why.\n\n# Tools beyond the basics\n\n- Use \\`tool-search\\` when you need a capability that may come from MCP, including browser automation or computer control.\n- Prefer Playwright MCP for deterministic browser testing; prefer Chrome DevTools MCP when the user needs their live logged-in Chrome session.\n- Only use computer-control MCP tools when they are explicitly available and the request warrants controlling the local computer.\n\n# Final answer\n\n- Keep it concise and high-signal — plain, idiomatic engineering prose, not a mechanical report. Lead with the outcome. For a small change, one or two short paragraphs plus a verification line is usually right; reserve bullet lists for genuinely multi-part results.\n- Reference files as clickable paths (e.g. \\`packages/core/src/foo.ts\\`), with a line number when it helps. Do not paste large file contents back — the user shares this machine and can open them.\n- State what you changed and what you ran to verify it. If you could not run something, say so.\n- No emojis or em dashes unless the user used them first.\n- Respect any AGENTS.md instructions in the repository; they override these defaults on conflict.`;\n}\n\nfunction createLocalCodeAgentActions(\n cwd: string,\n permissionMode: CodeAgentPermissionMode,\n runId: string,\n): Record<string, ActionEntry> {\n const actions = createCodingToolRegistry({\n cwd,\n restrictToCwd: true,\n commandTimeoutMs: DEFAULT_COMMAND_TIMEOUT_MS,\n maxOutputChars: MAX_TOOL_OUTPUT_CHARS,\n maxFileReadChars: MAX_FILE_READ_CHARS,\n canWrite: (toolName) => permissionErrorForWrite(permissionMode, toolName),\n beforeBash: ({ command }) => {\n const permission = classifyCodeAgentCommandPermission(command);\n if (permission.kind === \"forbidden\") {\n return `Error: command is blocked by Agent-Native Code policy: ${permission.reason}`;\n }\n if (permission.kind !== \"read\") {\n const permissionError = permissionErrorForWrite(permissionMode, \"bash\");\n if (permissionError) return permissionError;\n }\n if (permission.kind === \"approval-required\") {\n const approval = requestCodeAgentApproval(runId, {\n tool: \"bash\",\n command,\n reason: permission.reason,\n permissionMode,\n });\n return [\n `Approval required before running this command: ${permission.reason}.`,\n `Approval id: ${approval.id}`,\n `Command: ${command}`,\n \"The run is paused; approve from the Agent-Native Code UI/CLI if this command is intentional.\",\n ].join(\"\\n\");\n }\n return null;\n },\n });\n if (permissionMode === \"read-only\") {\n return {\n bash: actions.bash,\n read: actions.read,\n };\n }\n return actions;\n}\n\nexport type CodeAgentCommandPermission =\n | { kind: \"read\" }\n | { kind: \"write\" }\n | { kind: \"approval-required\"; reason: string }\n | { kind: \"forbidden\"; reason: string };\n\nexport function classifyCodeAgentCommandPermission(\n command: string,\n): CodeAgentCommandPermission {\n const normalized = command.trim().toLowerCase();\n if (!normalized) return { kind: \"read\" };\n\n const blockedPatterns: Array<[RegExp, string]> = [\n [\n /\\bgit\\s+(checkout|switch|reset|rebase|stash|clean|worktree)\\b/,\n \"forbidden git branch/reset/stash/rebase operation\",\n ],\n [\n /\\bgit\\s+branch\\b(?!\\s+--show-current\\b)/,\n \"forbidden git branch operation\",\n ],\n [/\\bdrizzle-kit\\s+push\\b/, \"drizzle-kit push is not allowed\"],\n ];\n for (const [pattern, reason] of blockedPatterns) {\n if (pattern.test(normalized)) return { kind: \"forbidden\", reason };\n }\n\n const approvalPatterns: Array<[RegExp, string]> = [\n [/\\brm\\s+-rf\\b/, \"destructive recursive delete\"],\n [/\\bsudo\\b/, \"privileged command\"],\n [/\\bkill\\s+-9\\b/, \"force-kill command\"],\n [/\\bcurl\\b.*\\|\\s*(sh|bash|zsh)\\b/, \"remote script execution\"],\n [/\\b(wget|fetch)\\b.*\\|\\s*(sh|bash|zsh)\\b/, \"remote script execution\"],\n [/\\bnpm\\s+publish\\b/, \"package publish\"],\n [/\\bpnpm\\s+publish\\b/, \"package publish\"],\n [/\\btruncate\\b/, \"destructive data command\"],\n [/\\bdrop\\s+(table|column|database)\\b/, \"destructive database command\"],\n [/\\bdelete\\s+from\\b(?![\\s\\S]*\\bwhere\\b)/, \"unscoped delete command\"],\n ];\n for (const [pattern, reason] of approvalPatterns) {\n if (pattern.test(normalized)) {\n return { kind: \"approval-required\", reason };\n }\n }\n\n if (isReadOnlyShellCommand(command)) {\n return { kind: \"read\" };\n }\n\n const writePatterns = [\n /(^|[^>])>(?!>)/,\n />>/,\n /\\btee\\b/,\n /\\bapply_patch\\b/,\n /\\b(write|touch|mkdir|cp|mv|rm|chmod|chown)\\b/,\n /\\bpnpm\\s+(add|install|remove|dlx)\\b/,\n /\\bnpm\\s+(install|i|add|remove|uninstall)\\b/,\n ];\n if (writePatterns.some((pattern) => pattern.test(normalized))) {\n return { kind: \"write\" };\n }\n\n return { kind: \"write\" };\n}\n\nfunction permissionErrorForWrite(\n permissionMode: CodeAgentPermissionMode,\n toolName: string,\n): string | null {\n if (\n permissionMode === \"ask-before-edit\" ||\n permissionMode === \"auto-edit\" ||\n permissionMode === \"full-auto\"\n ) {\n return null;\n }\n if (permissionMode === \"read-only\") {\n return `Error: ${toolName} is unavailable in read-only mode.`;\n }\n return `Error: ${toolName} is blocked by the current run mode.`;\n}\n\nfunction requestCodeAgentApproval(\n runId: string,\n input: Omit<PendingCodeAgentApproval, \"id\" | \"requestedAt\">,\n): PendingCodeAgentApproval {\n const requestedAt = new Date().toISOString();\n const approval: PendingCodeAgentApproval = {\n id: `approval-${requestedAt.replace(/\\D/g, \"\").slice(0, 14)}`,\n requestedAt,\n ...input,\n };\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: `Approval required: ${approval.reason}`,\n metadata: {\n status: \"needs-approval\",\n phase: \"approval-required\",\n pendingApproval: approval,\n },\n });\n updateCodeAgentRunRecord(runId, {\n status: \"needs-approval\",\n phase: \"approval-required\",\n needsApproval: true,\n progress: {\n label: \"Approval required\",\n completed: 0,\n total: 1,\n percent: 50,\n },\n metadata: {\n pendingApproval: approval,\n },\n });\n return approval;\n}\n\nfunction getPendingApproval(runId: string): PendingCodeAgentApproval | null {\n const record = getCodeAgentRunRecord(runId);\n const approval = record?.metadata?.pendingApproval;\n if (!approval || typeof approval !== \"object\") return null;\n const candidate = approval as Record<string, unknown>;\n const tool =\n candidate.tool === \"bash\" || candidate.tool === \"run_command\"\n ? candidate.tool\n : null;\n if (\n !tool ||\n typeof candidate.command !== \"string\" ||\n typeof candidate.reason !== \"string\" ||\n typeof candidate.id !== \"string\" ||\n typeof candidate.requestedAt !== \"string\"\n ) {\n return null;\n }\n return {\n id: candidate.id,\n tool,\n command: candidate.command,\n reason: candidate.reason,\n requestedAt: candidate.requestedAt,\n permissionMode:\n candidate.permissionMode === \"read-only\" ||\n candidate.permissionMode === \"ask-before-edit\" ||\n candidate.permissionMode === \"auto-edit\" ||\n candidate.permissionMode === \"full-auto\"\n ? candidate.permissionMode\n : \"full-auto\",\n };\n}\n"]}
|
package/dist/cli/skills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAqPxD,KAAK,aAAa,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,QAAQ,EAAE,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAWD,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/D;AAcD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,gBAAgB,CA4DhE;AAgHD,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,gBAAgB,EACxB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAuF1B;AAeD,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAiDf"}
|
package/dist/cli/skills.js
CHANGED
|
@@ -52,7 +52,8 @@ or generated image/video assets that another app can reference by ID and URL.
|
|
|
52
52
|
\`generate-image-batch\`, \`generate-video\`,
|
|
53
53
|
\`refresh-generation-run\`, and \`export-asset\`.
|
|
54
54
|
- Use browser/deep-link fallback when the host cannot render MCP Apps inline.
|
|
55
|
-
Surface the returned picker link
|
|
55
|
+
Surface the returned picker link. If it opens in a normal browser tab, have
|
|
56
|
+
the user select an asset there and paste back the copied handoff summary.
|
|
56
57
|
|
|
57
58
|
## Image And Video Workflows
|
|
58
59
|
|
package/dist/cli/skills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,yBAAyB,GAG1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;mCAesB,CAAC;AAEpC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDvB,CAAC;AAEF,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDnC,CAAC;AAEF,MAAM,mBAAmB,GAAG;IAC1B,MAAM,EAAE;QACN,SAAS,EAAE,QAAQ;QACnB,QAAQ,EAAE,yBAAyB,CAAC;YAClC,aAAa,EAAE,CAAC;YAChB,EAAE,EAAE,QAAQ;YACZ,WAAW,EAAE,QAAQ;YACrB,WAAW,EACT,sFAAsF;YACxF,MAAM,EAAE;gBACN,GAAG,EAAE,iCAAiC;gBACtC,MAAM,EAAE,mDAAmD;aAC5D;YACD,GAA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ent-native skills` is the friendly install surface for app-backed skills.\n * The lower-level `app-skill` commands remain the packaging primitives; this\n * command handles the common \"install Assets for my agent\" path in one step.\n */\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { spawn } from \"node:child_process\";\n\nimport {\n buildAppSkillPack,\n ensureAppSkill,\n loadAppSkillManifest,\n normalizeAppSkillManifest,\n type AppSkillManifest,\n type LoadedAppSkillManifest,\n} from \"./app-skill.js\";\nimport { resolveClients } from \"./connect.js\";\nimport type { ClientId } from \"./mcp-config-writers.js\";\n\nconst HELP = `agent-native skills\n\nUsage:\n agent-native skills list\n agent-native skills add assets|design-exploration [--client codex|claude-code|claude-code-cli|cowork|all] [--scope user|project] [--yes] [--dry-run] [--json]\n agent-native skills add <manifest-or-app-dir> [--client ...] [--yes]\n\nExamples:\n agent-native skills add assets\n agent-native skills add design-exploration\n agent-native skills add assets --client claude-code\n agent-native skills add ./dist/assets-skill --client codex\n\nThe add command installs skill instructions with the open skills CLI, then\nregisters the app-backed MCP connector. Use app-skill pack for marketplace\nbundles and custom adapter output.`;\n\nconst ASSETS_SKILL_MD = `---\nname: assets\ndescription: >-\n Use Assets for brand-safe image or video generation, human picker UI,\n search/list/export actions, and cross-app asset selection.\nmetadata:\n visibility: exported\n---\n\n# Assets\n\nUse the Assets app when a workflow needs reusable brand media, a human picker,\nor generated image/video assets that another app can reference by ID and URL.\n\n## Choose The Path\n\n- Use \\`open-asset-picker\\` when a person should browse, search, generate, and\n select an asset in UI. Pass \\`mediaType: \"image\"\\` by default, or\n \\`mediaType: \"video\"\\` for video libraries. When the user asks to create a\n specific image and choose the best option, pass \\`prompt\\`,\n \\`autoGenerate: true\\`, and \\`count: 3\\` so the picker opens with candidates\n to preview and select.\n- Use unattended actions when the agent already knows what to do:\n \\`search-assets\\`, \\`list-assets\\`, \\`generate-image\\`,\n \\`generate-image-batch\\`, \\`generate-video\\`,\n \\`refresh-generation-run\\`, and \\`export-asset\\`.\n- Use browser/deep-link fallback when the host cannot render MCP Apps inline.\n Surface the returned picker link instead of inventing a separate UI.\n\n## Image And Video Workflows\n\n1. Pick or match the library with \\`list-libraries\\` or \\`match-library\\`.\n2. For images, call \\`generate-image\\` or \\`generate-image-batch\\`. Image\n actions are synchronous: one batch call should return the finished image\n candidates, so do not poll or regenerate unless a returned slot failed.\n3. For videos, call \\`generate-video\\` and poll \\`refresh-generation-run\\`\n until the run completes.\n4. Preserve returned \\`assetId\\`, \\`runId\\`, \\`previewUrl\\`, \\`downloadUrl\\`,\n media type, and dimensions so the caller can attach or embed the result.\n\n## Cross-App Use\n\n- Hosted default: connect \\`https://assets.agent-native.com/_agent-native/mcp\\`.\n Do not put shared secrets in skill files.\n- Local customization: use \\`agent-native app-skill launch --local\\` from an\n Assets app-skill manifest, or pass \\`--into <path>\\` for editable source.\n- Do not call image/video providers directly from another app. Assets owns\n generation, picker UI, search/list/export, and asset context.\n`;\n\nconst DESIGN_EXPLORATION_SKILL_MD = `---\nname: design-exploration\ndescription: >-\n Use Design for UI/UX exploration, side-by-side design directions,\n interactive prototype previews, user selection, iteration, and design-to-code\n handoff through the hosted Design MCP app.\nmetadata:\n visibility: exported\n---\n\n# Design Exploration\n\nUse the Design app when a workflow needs visual UI exploration, prototype\niteration, or a human-in-the-loop choice among design directions.\n\n## Choose The Path\n\n- Use \\`create-design\\` first to create a project shell. Do not report the\n design as ready until it has renderable HTML.\n- For open-ended UX exploration, generate three distinct, complete HTML\n directions and call \\`present-design-variants\\`. The inline Design MCP app\n shows the options, lets the user pick one, and persists the selected variant.\n- For direct refinements to an already chosen direction, call\n \\`get-design-snapshot\\`, edit from the current tuned HTML, then call\n \\`generate-design\\`.\n- Use \\`export-coding-handoff\\` when the user wants to implement the chosen\n design in a codebase.\n\n## Exploration Defaults\n\n1. Default to three variants unless the user asks for a different count.\n2. Make variants structurally and stylistically distinct, not just color swaps.\n3. Each variant must be a complete standalone HTML document that renders\n without a build step.\n4. For product UI redesigns, prefer cleaner hierarchy, progressive disclosure,\n and realistic controls over decorative mockups.\n5. After \\`present-design-variants\\`, wait for the user's pick before\n generating the next version. If they say \"I like #2 but...\", snapshot the\n chosen design and refine that direction with \\`generate-design\\`.\n\n## Cross-App Use\n\n- Hosted default: connect \\`https://design.agent-native.com/_agent-native/mcp\\`.\n Do not put shared secrets in skill files.\n- Dispatch can expose Design alongside other apps. Use Design for UI/UX design\n tasks, Assets for image/media selection, Slides for decks, and so on.\n- Keep the loop visual: surface the inline MCP App or the returned \"Open\n design\" link instead of pasting large HTML blobs into chat.\n`;\n\nconst BUILT_IN_APP_SKILLS = {\n assets: {\n skillName: \"assets\",\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"assets\",\n displayName: \"Assets\",\n description:\n \"Create, search, select, and export brand image and video assets from the Assets app.\",\n hosted: {\n url: \"https://assets.agent-native.com\",\n mcpUrl: \"https://assets.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-assets\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Authenticate with the Assets MCP connector in the host app. No shared secrets are stored in skill files.\",\n },\n surfaces: [\n {\n id: \"asset-picker\",\n action: \"open-asset-picker\",\n path: \"/picker\",\n mediaTypes: [\"image\", \"video\"],\n defaultMediaType: \"image\",\n },\n ],\n skills: [\n {\n path: \"skills/assets\",\n visibility: \"exported\",\n exportAs: \"assets\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: ASSETS_SKILL_MD,\n },\n design: {\n skillName: \"design-exploration\",\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"design\",\n displayName: \"Design\",\n description:\n \"Explore, compare, iterate, and export interactive UI design prototypes from the Design app.\",\n hosted: {\n url: \"https://design.agent-native.com\",\n mcpUrl: \"https://design.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-design\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Authenticate with the Design MCP connector in the host app. No shared secrets are stored in skill files.\",\n },\n surfaces: [\n {\n id: \"design-exploration\",\n action: \"present-design-variants\",\n path: \"/design\",\n },\n ],\n skills: [\n {\n path: \"skills/design-exploration\",\n visibility: \"exported\",\n exportAs: \"design-exploration\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: DESIGN_EXPLORATION_SKILL_MD,\n },\n} satisfies Record<\n string,\n { manifest: AppSkillManifest; skillMarkdown: string; skillName: string }\n>;\n\ntype BuiltInAppSkillId = keyof typeof BUILT_IN_APP_SKILLS;\n\nconst BUILT_IN_APP_SKILL_ALIASES = {\n assets: \"assets\",\n asset: \"assets\",\n \"asset-generation\": \"assets\",\n images: \"assets\",\n image: \"assets\",\n \"image-generation\": \"assets\",\n \"agent-native-assets\": \"assets\",\n \"agent-native-images\": \"assets\",\n design: \"design\",\n \"ui-design\": \"design\",\n \"ux-design\": \"design\",\n \"design-exploration\": \"design\",\n \"ux-exploration\": \"design\",\n \"agent-native-design\": \"design\",\n \"agent-native-design-exploration\": \"design\",\n} satisfies Record<string, BuiltInAppSkillId>;\n\nconst BUILT_IN_APP_SKILL_DISPLAY_ALIASES = {\n assets: [\"images\", \"image-generation\", \"agent-native-images\"],\n design: [\n \"design-exploration\",\n \"ux-exploration\",\n \"agent-native-design-exploration\",\n ],\n} satisfies Record<BuiltInAppSkillId, string[]>;\n\ntype SkillsCommand = \"list\" | \"add\" | \"help\";\n\nexport interface ParsedSkillsArgs {\n command: SkillsCommand;\n target?: string;\n client: string;\n scope: string;\n yes: boolean;\n dryRun: boolean;\n printJson: boolean;\n instructions: boolean;\n mcp: boolean;\n}\n\nexport interface SkillsAddResult {\n id: string;\n displayName: string;\n instructionSource?: string;\n skillNames: string[];\n skillsAgents: string[];\n mcpUrl: string;\n mcpClients: ClientId[];\n dryRun: boolean;\n commands: string[];\n}\n\ninterface SkillInstallTarget {\n id: string;\n displayName: string;\n loaded: LoadedAppSkillManifest;\n skillNames: string[];\n materializeInstructions(outDir: string): string;\n cleanup?: () => void;\n}\n\ninterface RunSkillsOptions {\n baseDir?: string;\n log?: (message: string) => void;\n runCommand?: (cmd: string, args: string[]) => Promise<number>;\n}\n\nfunction normalizeKnownSkillTarget(\n value: string | undefined,\n): BuiltInAppSkillId | undefined {\n const key = value?.trim().toLowerCase();\n if (!key) return undefined;\n return BUILT_IN_APP_SKILL_ALIASES[key];\n}\n\nfunction isKnownSkill(value: string | undefined): boolean {\n return Boolean(normalizeKnownSkillTarget(value));\n}\n\nexport function parseSkillsArgs(argv: string[]): ParsedSkillsArgs {\n const first = argv[0];\n let command: SkillsCommand = \"list\";\n let args = argv;\n if (first === \"help\" || first === \"--help\" || first === \"-h\") {\n command = \"help\";\n args = argv.slice(1);\n } else if (first === \"list\" || first === \"add\") {\n command = first;\n args = argv.slice(1);\n } else if (first) {\n command = \"add\";\n }\n\n const out: ParsedSkillsArgs = {\n command,\n client: \"codex\",\n scope: \"user\",\n yes: false,\n dryRun: false,\n printJson: false,\n instructions: true,\n mcp: true,\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n const eat = (flag: string): string | undefined => {\n if (arg === flag) {\n const next = args[++i];\n if (!next || next.startsWith(\"-\")) {\n throw new Error(`Missing value for ${flag}.`);\n }\n return next;\n }\n if (arg.startsWith(`${flag}=`)) {\n const value = arg.slice(flag.length + 1);\n if (!value) throw new Error(`Missing value for ${flag}.`);\n return value;\n }\n return undefined;\n };\n let value: string | undefined;\n if ((value = eat(\"--client\")) !== undefined) out.client = value;\n else if ((value = eat(\"--scope\")) !== undefined) out.scope = value;\n else if (arg === \"--yes\" || arg === \"-y\") out.yes = true;\n else if (arg === \"--dry-run\") out.dryRun = true;\n else if (arg === \"--json\") out.printJson = true;\n else if (arg === \"--mcp-only\") out.instructions = false;\n else if (arg === \"--instructions-only\" || arg === \"--no-mcp\")\n out.mcp = false;\n else if (arg.startsWith(\"-\")) throw new Error(`Unknown option: ${arg}`);\n else if (!out.target) out.target = arg;\n else throw new Error(`Unexpected argument: ${arg}`);\n }\n\n if (out.scope !== \"user\" && out.scope !== \"project\") {\n throw new Error(\"--scope must be either user or project.\");\n }\n return out;\n}\n\nfunction loadSkillTarget(target: string): SkillInstallTarget {\n const knownTarget = normalizeKnownSkillTarget(target);\n if (knownTarget) {\n const builtIn = BUILT_IN_APP_SKILLS[knownTarget];\n return {\n id: builtIn.manifest.id,\n displayName: builtIn.manifest.displayName,\n loaded: {\n manifest: builtIn.manifest,\n file: `<built-in:${builtIn.manifest.id}>`,\n dir: process.cwd(),\n },\n skillNames: [builtIn.skillName],\n materializeInstructions(outDir) {\n const skillDir = path.join(outDir, \"skills\", builtIn.skillName);\n fs.mkdirSync(skillDir, { recursive: true });\n fs.writeFileSync(\n path.join(skillDir, \"SKILL.md\"),\n builtIn.skillMarkdown,\n \"utf-8\",\n );\n return outDir;\n },\n };\n }\n\n const resolved = path.resolve(target);\n const manifestFile = fs.statSync(resolved).isDirectory()\n ? path.join(resolved, \"agent-native.app-skill.json\")\n : resolved;\n const loaded = loadAppSkillManifest(manifestFile);\n return {\n id: loaded.manifest.id,\n displayName: loaded.manifest.displayName,\n loaded,\n skillNames: loaded.manifest.skills\n .filter(\n (skill) =>\n skill.visibility === \"exported\" || skill.visibility === \"both\",\n )\n .map((skill) => skill.exportAs ?? path.basename(skill.path)),\n materializeInstructions(outDir) {\n const packed = buildAppSkillPack(loaded, outDir);\n const vercelAdapter = path.join(\n packed.outDir,\n \"adapters\",\n \"vercel-skills\",\n );\n return fs.existsSync(vercelAdapter) ? vercelAdapter : packed.outDir;\n },\n };\n}\n\nfunction skillsAgentsForClients(clients: ClientId[]): string[] {\n const agents = new Set<string>();\n for (const client of clients) {\n if (client === \"codex\") agents.add(\"codex\");\n if (client === \"claude-code\" || client === \"claude-code-cli\") {\n agents.add(\"claude-code\");\n }\n }\n return [...agents];\n}\n\nfunction shellArg(value: string): string {\n if (/^[A-Za-z0-9_/:=.,@+-]+$/.test(value)) return value;\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\nfunction commandString(cmd: string, args: string[]): string {\n return [cmd, ...args].map(shellArg).join(\" \");\n}\n\nfunction dryRunInstallCommand(\n parsed: ParsedSkillsArgs,\n target: string,\n): string {\n const args = [\n \"skills\",\n \"add\",\n target,\n \"--client\",\n parsed.client,\n \"--scope\",\n parsed.scope,\n ];\n if (parsed.instructions && !parsed.mcp) args.push(\"--instructions-only\");\n if (!parsed.instructions && parsed.mcp) args.push(\"--mcp-only\");\n if (parsed.yes || isKnownSkill(target)) args.push(\"--yes\");\n return commandString(\"agent-native\", args);\n}\n\nasync function runCommand(cmd: string, args: string[]): Promise<number> {\n return new Promise((resolve, reject) => {\n const child = spawn(cmd, args, {\n stdio: \"inherit\",\n shell: process.platform === \"win32\",\n env: process.env,\n });\n child.on(\"error\", reject);\n child.on(\"exit\", (code, signal) => {\n if (signal) {\n reject(new Error(`${cmd} was interrupted by ${signal}.`));\n return;\n }\n resolve(code ?? 0);\n });\n });\n}\n\nexport async function addAgentNativeSkill(\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions = {},\n): Promise<SkillsAddResult> {\n const target = parsed.target ?? \"assets\";\n const knownTarget = normalizeKnownSkillTarget(target);\n if (!knownTarget && !fs.existsSync(path.resolve(target))) {\n throw new Error(\n `Unknown skill or manifest path: ${target}. Run \"agent-native skills list\".`,\n );\n }\n const installTarget = loadSkillTarget(target);\n const clients = resolveClients(parsed.client);\n const skillsAgents = skillsAgentsForClients(clients);\n if (parsed.dryRun) {\n try {\n return {\n id: installTarget.id,\n displayName: installTarget.displayName,\n skillNames: installTarget.skillNames,\n skillsAgents,\n mcpUrl: installTarget.loaded.manifest.hosted.mcpUrl,\n mcpClients: clients,\n dryRun: true,\n commands: [dryRunInstallCommand(parsed, target)],\n };\n } finally {\n installTarget.cleanup?.();\n }\n }\n const commands: string[] = [];\n const tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), \"an-skills-add-\"));\n let instructionSource: string | undefined;\n\n try {\n if (parsed.instructions) {\n if (skillsAgents.length === 0) {\n throw new Error(\n \"Skill instructions can only be installed for Codex or Claude Code clients. Use --mcp-only for MCP-only clients.\",\n );\n }\n instructionSource = installTarget.materializeInstructions(tmpRoot);\n const args = [\n \"--yes\",\n \"skills@latest\",\n \"add\",\n instructionSource,\n \"--copy\",\n ...installTarget.skillNames.flatMap((skill) => [\"--skill\", skill]),\n ...skillsAgents.flatMap((agent) => [\"-a\", agent]),\n ...(parsed.yes || knownTarget ? [\"-y\"] : []),\n ];\n commands.push(commandString(\"npx\", args));\n if (!parsed.dryRun) {\n const code = await (options.runCommand ?? runCommand)(\"npx\", args);\n if (code !== 0) throw new Error(`npx skills add exited with ${code}.`);\n }\n }\n\n if (parsed.mcp) {\n commands.push(\n `agent-native app-skill ensure --manifest ${installTarget.loaded.file} --client ${parsed.client} --scope ${parsed.scope} --yes`,\n );\n if (!parsed.dryRun) {\n await ensureAppSkill(installTarget.loaded, {\n clients,\n scope: parsed.scope,\n baseDir: options.baseDir,\n yes: parsed.yes || Boolean(knownTarget),\n confirm: true,\n log: options.log,\n });\n }\n }\n\n return {\n id: installTarget.id,\n displayName: installTarget.displayName,\n instructionSource,\n skillNames: installTarget.skillNames,\n skillsAgents,\n mcpUrl: installTarget.loaded.manifest.hosted.mcpUrl,\n mcpClients: clients,\n dryRun: parsed.dryRun,\n commands,\n };\n } finally {\n fs.rmSync(tmpRoot, { recursive: true, force: true });\n installTarget.cleanup?.();\n }\n}\n\nfunction listSkills() {\n return Object.values(BUILT_IN_APP_SKILLS).map((entry) => ({\n id: entry.manifest.id,\n aliases:\n BUILT_IN_APP_SKILL_DISPLAY_ALIASES[\n entry.manifest.id as BuiltInAppSkillId\n ] ?? [],\n name: entry.manifest.displayName,\n description: entry.manifest.description,\n mcpUrl: entry.manifest.hosted.mcpUrl,\n }));\n}\n\nexport async function runSkills(\n argv: string[],\n options: RunSkillsOptions = {},\n): Promise<void> {\n const parsed = parseSkillsArgs(argv);\n const log = parsed.printJson\n ? undefined\n : (message: string) => process.stdout.write(`${message}\\n`);\n\n if (parsed.command === \"help\") {\n process.stdout.write(`${HELP}\\n`);\n return;\n }\n\n if (parsed.command === \"list\") {\n const skills = listSkills();\n if (parsed.printJson) {\n process.stdout.write(`${JSON.stringify(skills, null, 2)}\\n`);\n return;\n }\n for (const skill of skills) {\n const description = skill.description.replace(/[.?!]?$/, \".\");\n const aliases = skill.aliases.length\n ? ` Aliases: ${skill.aliases.join(\", \")}.`\n : \"\";\n process.stdout.write(\n `${skill.id.padEnd(12)} ${description}${aliases} (${skill.mcpUrl})\\n`,\n );\n }\n return;\n }\n\n const result = await addAgentNativeSkill(parsed, {\n ...options,\n log,\n });\n\n if (parsed.printJson) {\n process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n return;\n }\n\n if (parsed.dryRun) {\n process.stdout.write(`${result.commands.join(\"\\n\")}\\n`);\n return;\n }\n\n process.stdout.write(\n `Installed ${result.displayName} skill for ${result.skillsAgents.join(\n \", \",\n )} and registered ${result.mcpUrl} for ${result.mcpClients.join(\", \")}.\\n`,\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,yBAAyB,GAG1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;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AAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxD,OAAO;IACT,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,aAAa,MAAM,CAAC,WAAW,cAAc,MAAM,CAAC,YAAY,CAAC,IAAI,CACnE,IAAI,CACL,mBAAmB,MAAM,CAAC,MAAM,QAAQ,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAC3E,CAAC;AACJ,CAAC","sourcesContent":["/**\n * `agent-native skills` is the friendly install surface for app-backed skills.\n * The lower-level `app-skill` commands remain the packaging primitives; this\n * command handles the common \"install Assets for my agent\" path in one step.\n */\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { spawn } from \"node:child_process\";\n\nimport {\n buildAppSkillPack,\n ensureAppSkill,\n loadAppSkillManifest,\n normalizeAppSkillManifest,\n type AppSkillManifest,\n type LoadedAppSkillManifest,\n} from \"./app-skill.js\";\nimport { resolveClients } from \"./connect.js\";\nimport type { ClientId } from \"./mcp-config-writers.js\";\n\nconst HELP = `agent-native skills\n\nUsage:\n agent-native skills list\n agent-native skills add assets|design-exploration [--client codex|claude-code|claude-code-cli|cowork|all] [--scope user|project] [--yes] [--dry-run] [--json]\n agent-native skills add <manifest-or-app-dir> [--client ...] [--yes]\n\nExamples:\n agent-native skills add assets\n agent-native skills add design-exploration\n agent-native skills add assets --client claude-code\n agent-native skills add ./dist/assets-skill --client codex\n\nThe add command installs skill instructions with the open skills CLI, then\nregisters the app-backed MCP connector. Use app-skill pack for marketplace\nbundles and custom adapter output.`;\n\nconst ASSETS_SKILL_MD = `---\nname: assets\ndescription: >-\n Use Assets for brand-safe image or video generation, human picker UI,\n search/list/export actions, and cross-app asset selection.\nmetadata:\n visibility: exported\n---\n\n# Assets\n\nUse the Assets app when a workflow needs reusable brand media, a human picker,\nor generated image/video assets that another app can reference by ID and URL.\n\n## Choose The Path\n\n- Use \\`open-asset-picker\\` when a person should browse, search, generate, and\n select an asset in UI. Pass \\`mediaType: \"image\"\\` by default, or\n \\`mediaType: \"video\"\\` for video libraries. When the user asks to create a\n specific image and choose the best option, pass \\`prompt\\`,\n \\`autoGenerate: true\\`, and \\`count: 3\\` so the picker opens with candidates\n to preview and select.\n- Use unattended actions when the agent already knows what to do:\n \\`search-assets\\`, \\`list-assets\\`, \\`generate-image\\`,\n \\`generate-image-batch\\`, \\`generate-video\\`,\n \\`refresh-generation-run\\`, and \\`export-asset\\`.\n- Use browser/deep-link fallback when the host cannot render MCP Apps inline.\n Surface the returned picker link. If it opens in a normal browser tab, have\n the user select an asset there and paste back the copied handoff summary.\n\n## Image And Video Workflows\n\n1. Pick or match the library with \\`list-libraries\\` or \\`match-library\\`.\n2. For images, call \\`generate-image\\` or \\`generate-image-batch\\`. Image\n actions are synchronous: one batch call should return the finished image\n candidates, so do not poll or regenerate unless a returned slot failed.\n3. For videos, call \\`generate-video\\` and poll \\`refresh-generation-run\\`\n until the run completes.\n4. Preserve returned \\`assetId\\`, \\`runId\\`, \\`previewUrl\\`, \\`downloadUrl\\`,\n media type, and dimensions so the caller can attach or embed the result.\n\n## Cross-App Use\n\n- Hosted default: connect \\`https://assets.agent-native.com/_agent-native/mcp\\`.\n Do not put shared secrets in skill files.\n- Local customization: use \\`agent-native app-skill launch --local\\` from an\n Assets app-skill manifest, or pass \\`--into <path>\\` for editable source.\n- Do not call image/video providers directly from another app. Assets owns\n generation, picker UI, search/list/export, and asset context.\n`;\n\nconst DESIGN_EXPLORATION_SKILL_MD = `---\nname: design-exploration\ndescription: >-\n Use Design for UI/UX exploration, side-by-side design directions,\n interactive prototype previews, user selection, iteration, and design-to-code\n handoff through the hosted Design MCP app.\nmetadata:\n visibility: exported\n---\n\n# Design Exploration\n\nUse the Design app when a workflow needs visual UI exploration, prototype\niteration, or a human-in-the-loop choice among design directions.\n\n## Choose The Path\n\n- Use \\`create-design\\` first to create a project shell. Do not report the\n design as ready until it has renderable HTML.\n- For open-ended UX exploration, generate three distinct, complete HTML\n directions and call \\`present-design-variants\\`. The inline Design MCP app\n shows the options, lets the user pick one, and persists the selected variant.\n- For direct refinements to an already chosen direction, call\n \\`get-design-snapshot\\`, edit from the current tuned HTML, then call\n \\`generate-design\\`.\n- Use \\`export-coding-handoff\\` when the user wants to implement the chosen\n design in a codebase.\n\n## Exploration Defaults\n\n1. Default to three variants unless the user asks for a different count.\n2. Make variants structurally and stylistically distinct, not just color swaps.\n3. Each variant must be a complete standalone HTML document that renders\n without a build step.\n4. For product UI redesigns, prefer cleaner hierarchy, progressive disclosure,\n and realistic controls over decorative mockups.\n5. After \\`present-design-variants\\`, wait for the user's pick before\n generating the next version. If they say \"I like #2 but...\", snapshot the\n chosen design and refine that direction with \\`generate-design\\`.\n\n## Cross-App Use\n\n- Hosted default: connect \\`https://design.agent-native.com/_agent-native/mcp\\`.\n Do not put shared secrets in skill files.\n- Dispatch can expose Design alongside other apps. Use Design for UI/UX design\n tasks, Assets for image/media selection, Slides for decks, and so on.\n- Keep the loop visual: surface the inline MCP App or the returned \"Open\n design\" link instead of pasting large HTML blobs into chat.\n`;\n\nconst BUILT_IN_APP_SKILLS = {\n assets: {\n skillName: \"assets\",\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"assets\",\n displayName: \"Assets\",\n description:\n \"Create, search, select, and export brand image and video assets from the Assets app.\",\n hosted: {\n url: \"https://assets.agent-native.com\",\n mcpUrl: \"https://assets.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-assets\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Authenticate with the Assets MCP connector in the host app. No shared secrets are stored in skill files.\",\n },\n surfaces: [\n {\n id: \"asset-picker\",\n action: \"open-asset-picker\",\n path: \"/picker\",\n mediaTypes: [\"image\", \"video\"],\n defaultMediaType: \"image\",\n },\n ],\n skills: [\n {\n path: \"skills/assets\",\n visibility: \"exported\",\n exportAs: \"assets\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: ASSETS_SKILL_MD,\n },\n design: {\n skillName: \"design-exploration\",\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"design\",\n displayName: \"Design\",\n description:\n \"Explore, compare, iterate, and export interactive UI design prototypes from the Design app.\",\n hosted: {\n url: \"https://design.agent-native.com\",\n mcpUrl: \"https://design.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-design\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Authenticate with the Design MCP connector in the host app. No shared secrets are stored in skill files.\",\n },\n surfaces: [\n {\n id: \"design-exploration\",\n action: \"present-design-variants\",\n path: \"/design\",\n },\n ],\n skills: [\n {\n path: \"skills/design-exploration\",\n visibility: \"exported\",\n exportAs: \"design-exploration\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: DESIGN_EXPLORATION_SKILL_MD,\n },\n} satisfies Record<\n string,\n { manifest: AppSkillManifest; skillMarkdown: string; skillName: string }\n>;\n\ntype BuiltInAppSkillId = keyof typeof BUILT_IN_APP_SKILLS;\n\nconst BUILT_IN_APP_SKILL_ALIASES = {\n assets: \"assets\",\n asset: \"assets\",\n \"asset-generation\": \"assets\",\n images: \"assets\",\n image: \"assets\",\n \"image-generation\": \"assets\",\n \"agent-native-assets\": \"assets\",\n \"agent-native-images\": \"assets\",\n design: \"design\",\n \"ui-design\": \"design\",\n \"ux-design\": \"design\",\n \"design-exploration\": \"design\",\n \"ux-exploration\": \"design\",\n \"agent-native-design\": \"design\",\n \"agent-native-design-exploration\": \"design\",\n} satisfies Record<string, BuiltInAppSkillId>;\n\nconst BUILT_IN_APP_SKILL_DISPLAY_ALIASES = {\n assets: [\"images\", \"image-generation\", \"agent-native-images\"],\n design: [\n \"design-exploration\",\n \"ux-exploration\",\n \"agent-native-design-exploration\",\n ],\n} satisfies Record<BuiltInAppSkillId, string[]>;\n\ntype SkillsCommand = \"list\" | \"add\" | \"help\";\n\nexport interface ParsedSkillsArgs {\n command: SkillsCommand;\n target?: string;\n client: string;\n scope: string;\n yes: boolean;\n dryRun: boolean;\n printJson: boolean;\n instructions: boolean;\n mcp: boolean;\n}\n\nexport interface SkillsAddResult {\n id: string;\n displayName: string;\n instructionSource?: string;\n skillNames: string[];\n skillsAgents: string[];\n mcpUrl: string;\n mcpClients: ClientId[];\n dryRun: boolean;\n commands: string[];\n}\n\ninterface SkillInstallTarget {\n id: string;\n displayName: string;\n loaded: LoadedAppSkillManifest;\n skillNames: string[];\n materializeInstructions(outDir: string): string;\n cleanup?: () => void;\n}\n\ninterface RunSkillsOptions {\n baseDir?: string;\n log?: (message: string) => void;\n runCommand?: (cmd: string, args: string[]) => Promise<number>;\n}\n\nfunction normalizeKnownSkillTarget(\n value: string | undefined,\n): BuiltInAppSkillId | undefined {\n const key = value?.trim().toLowerCase();\n if (!key) return undefined;\n return BUILT_IN_APP_SKILL_ALIASES[key];\n}\n\nfunction isKnownSkill(value: string | undefined): boolean {\n return Boolean(normalizeKnownSkillTarget(value));\n}\n\nexport function parseSkillsArgs(argv: string[]): ParsedSkillsArgs {\n const first = argv[0];\n let command: SkillsCommand = \"list\";\n let args = argv;\n if (first === \"help\" || first === \"--help\" || first === \"-h\") {\n command = \"help\";\n args = argv.slice(1);\n } else if (first === \"list\" || first === \"add\") {\n command = first;\n args = argv.slice(1);\n } else if (first) {\n command = \"add\";\n }\n\n const out: ParsedSkillsArgs = {\n command,\n client: \"codex\",\n scope: \"user\",\n yes: false,\n dryRun: false,\n printJson: false,\n instructions: true,\n mcp: true,\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n const eat = (flag: string): string | undefined => {\n if (arg === flag) {\n const next = args[++i];\n if (!next || next.startsWith(\"-\")) {\n throw new Error(`Missing value for ${flag}.`);\n }\n return next;\n }\n if (arg.startsWith(`${flag}=`)) {\n const value = arg.slice(flag.length + 1);\n if (!value) throw new Error(`Missing value for ${flag}.`);\n return value;\n }\n return undefined;\n };\n let value: string | undefined;\n if ((value = eat(\"--client\")) !== undefined) out.client = value;\n else if ((value = eat(\"--scope\")) !== undefined) out.scope = value;\n else if (arg === \"--yes\" || arg === \"-y\") out.yes = true;\n else if (arg === \"--dry-run\") out.dryRun = true;\n else if (arg === \"--json\") out.printJson = true;\n else if (arg === \"--mcp-only\") out.instructions = false;\n else if (arg === \"--instructions-only\" || arg === \"--no-mcp\")\n out.mcp = false;\n else if (arg.startsWith(\"-\")) throw new Error(`Unknown option: ${arg}`);\n else if (!out.target) out.target = arg;\n else throw new Error(`Unexpected argument: ${arg}`);\n }\n\n if (out.scope !== \"user\" && out.scope !== \"project\") {\n throw new Error(\"--scope must be either user or project.\");\n }\n return out;\n}\n\nfunction loadSkillTarget(target: string): SkillInstallTarget {\n const knownTarget = normalizeKnownSkillTarget(target);\n if (knownTarget) {\n const builtIn = BUILT_IN_APP_SKILLS[knownTarget];\n return {\n id: builtIn.manifest.id,\n displayName: builtIn.manifest.displayName,\n loaded: {\n manifest: builtIn.manifest,\n file: `<built-in:${builtIn.manifest.id}>`,\n dir: process.cwd(),\n },\n skillNames: [builtIn.skillName],\n materializeInstructions(outDir) {\n const skillDir = path.join(outDir, \"skills\", builtIn.skillName);\n fs.mkdirSync(skillDir, { recursive: true });\n fs.writeFileSync(\n path.join(skillDir, \"SKILL.md\"),\n builtIn.skillMarkdown,\n \"utf-8\",\n );\n return outDir;\n },\n };\n }\n\n const resolved = path.resolve(target);\n const manifestFile = fs.statSync(resolved).isDirectory()\n ? path.join(resolved, \"agent-native.app-skill.json\")\n : resolved;\n const loaded = loadAppSkillManifest(manifestFile);\n return {\n id: loaded.manifest.id,\n displayName: loaded.manifest.displayName,\n loaded,\n skillNames: loaded.manifest.skills\n .filter(\n (skill) =>\n skill.visibility === \"exported\" || skill.visibility === \"both\",\n )\n .map((skill) => skill.exportAs ?? path.basename(skill.path)),\n materializeInstructions(outDir) {\n const packed = buildAppSkillPack(loaded, outDir);\n const vercelAdapter = path.join(\n packed.outDir,\n \"adapters\",\n \"vercel-skills\",\n );\n return fs.existsSync(vercelAdapter) ? vercelAdapter : packed.outDir;\n },\n };\n}\n\nfunction skillsAgentsForClients(clients: ClientId[]): string[] {\n const agents = new Set<string>();\n for (const client of clients) {\n if (client === \"codex\") agents.add(\"codex\");\n if (client === \"claude-code\" || client === \"claude-code-cli\") {\n agents.add(\"claude-code\");\n }\n }\n return [...agents];\n}\n\nfunction shellArg(value: string): string {\n if (/^[A-Za-z0-9_/:=.,@+-]+$/.test(value)) return value;\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\nfunction commandString(cmd: string, args: string[]): string {\n return [cmd, ...args].map(shellArg).join(\" \");\n}\n\nfunction dryRunInstallCommand(\n parsed: ParsedSkillsArgs,\n target: string,\n): string {\n const args = [\n \"skills\",\n \"add\",\n target,\n \"--client\",\n parsed.client,\n \"--scope\",\n parsed.scope,\n ];\n if (parsed.instructions && !parsed.mcp) args.push(\"--instructions-only\");\n if (!parsed.instructions && parsed.mcp) args.push(\"--mcp-only\");\n if (parsed.yes || isKnownSkill(target)) args.push(\"--yes\");\n return commandString(\"agent-native\", args);\n}\n\nasync function runCommand(cmd: string, args: string[]): Promise<number> {\n return new Promise((resolve, reject) => {\n const child = spawn(cmd, args, {\n stdio: \"inherit\",\n shell: process.platform === \"win32\",\n env: process.env,\n });\n child.on(\"error\", reject);\n child.on(\"exit\", (code, signal) => {\n if (signal) {\n reject(new Error(`${cmd} was interrupted by ${signal}.`));\n return;\n }\n resolve(code ?? 0);\n });\n });\n}\n\nexport async function addAgentNativeSkill(\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions = {},\n): Promise<SkillsAddResult> {\n const target = parsed.target ?? \"assets\";\n const knownTarget = normalizeKnownSkillTarget(target);\n if (!knownTarget && !fs.existsSync(path.resolve(target))) {\n throw new Error(\n `Unknown skill or manifest path: ${target}. Run \"agent-native skills list\".`,\n );\n }\n const installTarget = loadSkillTarget(target);\n const clients = resolveClients(parsed.client);\n const skillsAgents = skillsAgentsForClients(clients);\n if (parsed.dryRun) {\n try {\n return {\n id: installTarget.id,\n displayName: installTarget.displayName,\n skillNames: installTarget.skillNames,\n skillsAgents,\n mcpUrl: installTarget.loaded.manifest.hosted.mcpUrl,\n mcpClients: clients,\n dryRun: true,\n commands: [dryRunInstallCommand(parsed, target)],\n };\n } finally {\n installTarget.cleanup?.();\n }\n }\n const commands: string[] = [];\n const tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), \"an-skills-add-\"));\n let instructionSource: string | undefined;\n\n try {\n if (parsed.instructions) {\n if (skillsAgents.length === 0) {\n throw new Error(\n \"Skill instructions can only be installed for Codex or Claude Code clients. Use --mcp-only for MCP-only clients.\",\n );\n }\n instructionSource = installTarget.materializeInstructions(tmpRoot);\n const args = [\n \"--yes\",\n \"skills@latest\",\n \"add\",\n instructionSource,\n \"--copy\",\n ...installTarget.skillNames.flatMap((skill) => [\"--skill\", skill]),\n ...skillsAgents.flatMap((agent) => [\"-a\", agent]),\n ...(parsed.yes || knownTarget ? [\"-y\"] : []),\n ];\n commands.push(commandString(\"npx\", args));\n if (!parsed.dryRun) {\n const code = await (options.runCommand ?? runCommand)(\"npx\", args);\n if (code !== 0) throw new Error(`npx skills add exited with ${code}.`);\n }\n }\n\n if (parsed.mcp) {\n commands.push(\n `agent-native app-skill ensure --manifest ${installTarget.loaded.file} --client ${parsed.client} --scope ${parsed.scope} --yes`,\n );\n if (!parsed.dryRun) {\n await ensureAppSkill(installTarget.loaded, {\n clients,\n scope: parsed.scope,\n baseDir: options.baseDir,\n yes: parsed.yes || Boolean(knownTarget),\n confirm: true,\n log: options.log,\n });\n }\n }\n\n return {\n id: installTarget.id,\n displayName: installTarget.displayName,\n instructionSource,\n skillNames: installTarget.skillNames,\n skillsAgents,\n mcpUrl: installTarget.loaded.manifest.hosted.mcpUrl,\n mcpClients: clients,\n dryRun: parsed.dryRun,\n commands,\n };\n } finally {\n fs.rmSync(tmpRoot, { recursive: true, force: true });\n installTarget.cleanup?.();\n }\n}\n\nfunction listSkills() {\n return Object.values(BUILT_IN_APP_SKILLS).map((entry) => ({\n id: entry.manifest.id,\n aliases:\n BUILT_IN_APP_SKILL_DISPLAY_ALIASES[\n entry.manifest.id as BuiltInAppSkillId\n ] ?? [],\n name: entry.manifest.displayName,\n description: entry.manifest.description,\n mcpUrl: entry.manifest.hosted.mcpUrl,\n }));\n}\n\nexport async function runSkills(\n argv: string[],\n options: RunSkillsOptions = {},\n): Promise<void> {\n const parsed = parseSkillsArgs(argv);\n const log = parsed.printJson\n ? undefined\n : (message: string) => process.stdout.write(`${message}\\n`);\n\n if (parsed.command === \"help\") {\n process.stdout.write(`${HELP}\\n`);\n return;\n }\n\n if (parsed.command === \"list\") {\n const skills = listSkills();\n if (parsed.printJson) {\n process.stdout.write(`${JSON.stringify(skills, null, 2)}\\n`);\n return;\n }\n for (const skill of skills) {\n const description = skill.description.replace(/[.?!]?$/, \".\");\n const aliases = skill.aliases.length\n ? ` Aliases: ${skill.aliases.join(\", \")}.`\n : \"\";\n process.stdout.write(\n `${skill.id.padEnd(12)} ${description}${aliases} (${skill.mcpUrl})\\n`,\n );\n }\n return;\n }\n\n const result = await addAgentNativeSkill(parsed, {\n ...options,\n log,\n });\n\n if (parsed.printJson) {\n process.stdout.write(`${JSON.stringify(result, null, 2)}\\n`);\n return;\n }\n\n if (parsed.dryRun) {\n process.stdout.write(`${result.commands.join(\"\\n\")}\\n`);\n return;\n }\n\n process.stdout.write(\n `Installed ${result.displayName} skill for ${result.skillsAgents.join(\n \", \",\n )} and registered ${result.mcpUrl} for ${result.mcpClients.join(\", \")}.\\n`,\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EAEV,gBAAgB,EAEhB,yBAAyB,EAI1B,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"AssistantChat.d.ts","sourceRoot":"","sources":["../../src/client/AssistantChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EAEV,gBAAgB,EAEhB,yBAAyB,EAI1B,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAgD/B,OAAO,KAAK,EACV,0BAA0B,EAE3B,MAAM,qBAAqB,CAAC;AAsL7B,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,OAAO,CAAC;AA6jDvD,wBAAgB,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