eve 0.26.0 → 0.26.2
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/CHANGELOG.md +17 -0
- package/dist/src/chunks/{use-eve-agent-CruinZmd.js → use-eve-agent-AeQLLhu9.js} +118 -92
- package/dist/src/chunks/{use-eve-agent-BkztZA0v.js → use-eve-agent-PMY2WkAt.js} +118 -92
- package/dist/src/cli/banner.d.ts +5 -0
- package/dist/src/cli/banner.js +1 -1
- package/dist/src/cli/commands/info.d.ts +2 -0
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/dev/tui/blocks.d.ts +56 -8
- package/dist/src/cli/dev/tui/blocks.js +7 -7
- package/dist/src/cli/dev/tui/diagnostic-presentation.d.ts +2 -0
- package/dist/src/cli/dev/tui/diagnostic-presentation.js +3 -2
- package/dist/src/cli/dev/tui/file-content-cache.d.ts +35 -0
- package/dist/src/cli/dev/tui/file-content-cache.js +3 -0
- package/dist/src/cli/dev/tui/line-diff.d.ts +24 -0
- package/dist/src/cli/dev/tui/line-diff.js +1 -0
- package/dist/src/cli/dev/tui/markdown.d.ts +2 -1
- package/dist/src/cli/dev/tui/markdown.js +7 -3
- package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +12 -0
- package/dist/src/cli/dev/tui/prompt-placeholder.js +1 -0
- package/dist/src/cli/dev/tui/question-panel.d.ts +24 -0
- package/dist/src/cli/dev/tui/question-panel.js +1 -0
- package/dist/src/cli/dev/tui/rail.d.ts +15 -0
- package/dist/src/cli/dev/tui/rail.js +1 -0
- package/dist/src/cli/dev/tui/runner.d.ts +22 -65
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.js +1 -1
- package/dist/src/cli/dev/tui/setup-issues.js +1 -1
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/stream-format.d.ts +16 -3
- package/dist/src/cli/dev/tui/stream-format.js +1 -1
- package/dist/src/cli/dev/tui/subagent-pump.d.ts +127 -0
- package/dist/src/cli/dev/tui/subagent-pump.js +1 -0
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +34 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +11 -10
- package/dist/src/cli/dev/tui/test/mock-terminal.d.ts +7 -0
- package/dist/src/cli/dev/tui/test/mock-terminal.js +1 -1
- package/dist/src/cli/dev/tui/theme.d.ts +16 -2
- package/dist/src/cli/dev/tui/theme.js +1 -1
- package/dist/src/cli/dev/tui/todo-panel.d.ts +44 -0
- package/dist/src/cli/dev/tui/todo-panel.js +1 -0
- package/dist/src/cli/dev/tui/tool-block-groups.d.ts +40 -0
- package/dist/src/cli/dev/tui/tool-block-groups.js +1 -0
- package/dist/src/cli/dev/tui/tool-presentation.d.ts +67 -0
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -0
- package/dist/src/cli/dev/tui/tool-rows.d.ts +15 -0
- package/dist/src/cli/dev/tui/tool-rows.js +2 -0
- package/dist/src/cli/dev/tui/turn-clock.d.ts +36 -0
- package/dist/src/cli/dev/tui/turn-clock.js +1 -0
- package/dist/src/cli/dev/tui/types.d.ts +2 -2
- package/dist/src/cli/dev/ui-options.js +1 -1
- package/dist/src/client/index.js +1 -1
- package/dist/src/client/message-action-parts.d.ts +43 -0
- package/dist/src/client/message-action-parts.js +1 -0
- package/dist/src/client/message-reducer.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +6 -5
- package/dist/src/compiled/@chat-adapter/slack/blocks.d.ts +47 -2
- package/dist/src/compiled/@chat-adapter/slack/blocks.js +10 -8
- package/dist/src/compiled/@chat-adapter/slack/index.d.ts +168 -8
- package/dist/src/compiled/@chat-adapter/slack/index.js +28 -28
- package/dist/src/compiled/@chat-adapter/slack/{types-AntsVifS.d.ts → types-CdGmMyOr.d.ts} +1 -1
- package/dist/src/compiled/@chat-adapter/slack/webhook.d.ts +2 -2
- package/dist/src/compiled/@chat-adapter/twilio/index.d.ts +1 -1
- package/dist/src/compiled/@chat-adapter/twilio/index.js +1 -1
- package/dist/src/compiled/@chat-adapter/twilio/webhook.d.ts +2 -2
- package/dist/src/compiled/@vercel/sandbox/index.js +12 -12
- package/dist/src/compiled/_chunks/node/{auth-Cuszvn7l.js → auth-BuQkq4Gr.js} +2 -2
- package/dist/src/compiled/_chunks/node/{dist-CdH_Yoxt.js → dist-BweCayKF.js} +42 -35
- package/dist/src/compiled/_chunks/node/{dist-Drt-_JVK.js → dist-DvkWiagq.js} +6 -4
- package/dist/src/compiled/chat/index.d.ts +17 -6
- package/dist/src/compiled/chat/index.js +1 -1
- package/dist/src/compiled/chat/{jsx-runtime-CzthIo1o.d.ts → jsx-runtime-_JEEAotp.d.ts} +125 -5
- package/dist/src/compiled/marked/LICENSE.md +44 -0
- package/dist/src/compiled/marked/index.d.ts +24 -0
- package/dist/src/compiled/marked/index.js +59 -0
- package/dist/src/compiler/model-catalog.js +1 -1
- package/dist/src/evals/autoevals-client.js +1 -1
- package/dist/src/evals/session.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -1
- package/dist/src/execution/sandbox/bindings/vercel-lookup.js +1 -1
- package/dist/src/execution/session.d.ts +0 -2
- package/dist/src/execution/session.js +1 -1
- package/dist/src/execution/skills/instructions.d.ts +3 -3
- package/dist/src/execution/skills/instructions.js +2 -2
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/messages.d.ts +7 -0
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/stale-input-responses.js +2 -2
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/internal/application/compiled-artifacts.js +9 -3
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/gateway.d.ts +19 -0
- package/dist/src/internal/gateway.js +1 -0
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response-from-manifest.js +1 -1
- package/dist/src/internal/nitro/routes/info.js +1 -1
- package/dist/src/internal/resolve-model-endpoint-status.d.ts +46 -3
- package/dist/src/internal/resolve-model-endpoint-status.js +1 -1
- package/dist/src/internal/user-agent.d.ts +11 -0
- package/dist/src/internal/user-agent.js +1 -0
- package/dist/src/public/tools/defaults.d.ts +3 -3
- package/dist/src/runtime/framework-tools/index.d.ts +3 -2
- package/dist/src/runtime/framework-tools/index.js +1 -1
- package/dist/src/runtime/framework-tools/skill.d.ts +6 -1
- package/dist/src/runtime/framework-tools/skill.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/setup/boxes/select-model.js +1 -1
- package/dist/src/setup/flows/link.d.ts +13 -3
- package/dist/src/setup/flows/link.js +1 -1
- package/dist/src/setup/flows/model.d.ts +4 -3
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/provider.d.ts +3 -1
- package/dist/src/setup/flows/provider.js +2 -2
- package/dist/src/setup/gateway-models.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/setup/validate-gateway-key.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +7 -7
- package/docs/reference/cli.md +1 -1
- package/docs/schedules.mdx +1 -1
- package/docs/skills.mdx +1 -1
- package/package.json +6 -5
- package/dist/src/execution/sandbox/bindings/vercel-user-agent.d.ts +0 -6
- package/dist/src/execution/sandbox/bindings/vercel-user-agent.js +0 -1
- package/dist/src/execution/workflow-skill-root.d.ts +0 -6
- package/dist/src/execution/workflow-skill-root.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function hasEnvValue(e){return e!==void 0&&e.trim().length>0}function resolveGatewayCredential(e){let t=e.apiKeyFile===void 0?e.apiKeyInEnv===!0?{kind:`shell`}:void 0:{kind:`env-file`,path:e.apiKeyFile},n=e.oidcFile!==void 0||e.oidcAvailable===!0;if(t!==void 0){let r={credential:`api-key`,source:t};return n&&(r.shadowedOidc=e.oidcFile===void 0?{}:{file:e.oidcFile}),r}if(n)return e.oidcFile===void 0?{credential:`oidc`}:{credential:`oidc`,file:e.oidcFile}}function resolveModelEndpointStatus(e,t){if(e.kind===`external`)return{kind:`external`,provider:e.provider};let n=resolveGatewayCredential({apiKeyInEnv:t.apiKey,oidcAvailable:t.oidc});return n===void 0?{kind:`gateway`,connected:!1}:{kind:`gateway`,connected:!0,credential:n.credential}}export{hasEnvValue,resolveGatewayCredential,resolveModelEndpointStatus};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Product token for the installed package, such as `package-name/1.2.3`. */
|
|
2
|
+
export declare function buildPackageUserAgent(): string;
|
|
3
|
+
/** Appends the installed package product without discarding an existing User-Agent. */
|
|
4
|
+
export declare function appendPackageUserAgent(headers: Headers): Headers;
|
|
5
|
+
/**
|
|
6
|
+
* Wraps a `fetch` implementation so every request's `user-agent` carries the
|
|
7
|
+
* installed package product token (appended after existing products). Without
|
|
8
|
+
* an explicit `inner`, `globalThis.fetch` is resolved per request rather than
|
|
9
|
+
* captured at wrap time, so globally installed instrumentation still applies.
|
|
10
|
+
*/
|
|
11
|
+
export declare function withPackageUserAgent(inner?: typeof globalThis.fetch): typeof globalThis.fetch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveInstalledPackageInfo}from"#internal/application/package.js";function buildPackageUserAgent(){let{name:t,version:n}=resolveInstalledPackageInfo();return`${t}/${n}`}function joinUserAgentProducts(...e){return e.filter(Boolean).join(` `)}function appendPackageUserAgent(e){let t=buildPackageUserAgent(),n=e.get(`user-agent`);return n?.split(/\s+/).includes(t)||e.set(`user-agent`,joinUserAgentProducts(n,t)),e}function withPackageUserAgent(e){return(t,n)=>{let r=new Headers(n?.headers??(typeof t==`object`&&`headers`in t?t.headers:void 0));return appendPackageUserAgent(r),(e??globalThis.fetch)(t,{...n,headers:r})}}export{appendPackageUserAgent,buildPackageUserAgent,withPackageUserAgent};
|
|
@@ -37,9 +37,9 @@ export declare const webFetch: ToolDefinition;
|
|
|
37
37
|
*/
|
|
38
38
|
export declare const todo: ToolDefinition;
|
|
39
39
|
/**
|
|
40
|
-
* Framework-provided skill loading tool (`load_skill`).
|
|
41
|
-
*
|
|
42
|
-
* only useful when the agent declares skills: with no skills available the
|
|
40
|
+
* Framework-provided skill loading tool (`load_skill`). Returns a named
|
|
41
|
+
* authored skill's instructions directly; dynamic skills remain sandbox-backed.
|
|
42
|
+
* It is only useful when the agent declares skills: with no skills available the
|
|
43
43
|
* framework does not surface skill descriptions to the model, so the model has
|
|
44
44
|
* nothing to load.
|
|
45
45
|
*/
|
|
@@ -3,7 +3,7 @@ export type { ReadFileStamp, ReadFileState } from "#runtime/framework-tools/file
|
|
|
3
3
|
export { ReadFileStateKey } from "#runtime/framework-tools/file-state.js";
|
|
4
4
|
export type { TodoItem, TodoState } from "#runtime/framework-tools/todo.js";
|
|
5
5
|
export { TodoStateKey } from "#runtime/framework-tools/todo.js";
|
|
6
|
-
import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
6
|
+
import type { ResolvedSkillDefinition, ResolvedToolDefinition } from "#runtime/types.js";
|
|
7
7
|
/**
|
|
8
8
|
* Returns framework-owned tool definitions registered in the tool registry
|
|
9
9
|
* alongside authored tools during graph resolution.
|
|
@@ -11,7 +11,8 @@ import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
|
11
11
|
* `connection_search` is no longer in this list. The graph resolution path
|
|
12
12
|
* registers it as a framework dynamic tool resolver.
|
|
13
13
|
*/
|
|
14
|
-
export declare function getFrameworkToolDefinitions(
|
|
14
|
+
export declare function getFrameworkToolDefinitions(config?: {
|
|
15
|
+
readonly authoredSkills?: readonly ResolvedSkillDefinition[];
|
|
15
16
|
readonly hasConnections?: boolean;
|
|
16
17
|
}): readonly ResolvedToolDefinition[];
|
|
17
18
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ConnectionRegistryKey}from"#context/providers/connection-key.js";import{ReadFileStateKey}from"#runtime/framework-tools/file-state.js";import{TODO_TOOL_DEFINITION,TodoStateKey}from"#runtime/framework-tools/todo.js";import{AGENT_TOOL_DEFINITION}from"#runtime/framework-tools/agent.js";import{ASK_QUESTION_TOOL_DEFINITION}from"#runtime/framework-tools/ask-question.js";import{WEB_SEARCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-search.js";import{BASH_TOOL_DEFINITION}from"#runtime/framework-tools/bash.js";import{GLOB_TOOL_DEFINITION}from"#runtime/framework-tools/glob.js";import{GREP_TOOL_DEFINITION}from"#runtime/framework-tools/grep.js";import{READ_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/read-file.js";import{SKILL_TOOL_DEFINITION}from"#runtime/framework-tools/skill.js";import{WEB_FETCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-fetch.js";import{WRITE_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/write-file.js";const REGISTERED_FRAMEWORK_TOOLS=[ASK_QUESTION_TOOL_DEFINITION,BASH_TOOL_DEFINITION,GLOB_TOOL_DEFINITION,GREP_TOOL_DEFINITION,READ_FILE_TOOL_DEFINITION,WRITE_FILE_TOOL_DEFINITION,TODO_TOOL_DEFINITION,WEB_FETCH_TOOL_DEFINITION,WEB_SEARCH_TOOL_DEFINITION,SKILL_TOOL_DEFINITION],ALL_FRAMEWORK_TOOLS=[...REGISTERED_FRAMEWORK_TOOLS,AGENT_TOOL_DEFINITION];function getFrameworkToolDefinitions(e){return REGISTERED_FRAMEWORK_TOOLS}function getAllFrameworkToolDefinitions(){return ALL_FRAMEWORK_TOOLS}function getAllFrameworkToolNames(){return new Set(ALL_FRAMEWORK_TOOLS.map(e=>e.name))}export{ConnectionRegistryKey,ReadFileStateKey,TodoStateKey,getAllFrameworkToolDefinitions,getAllFrameworkToolNames,getFrameworkToolDefinitions};
|
|
1
|
+
import{ConnectionRegistryKey}from"#context/providers/connection-key.js";import{ReadFileStateKey}from"#runtime/framework-tools/file-state.js";import{TODO_TOOL_DEFINITION,TodoStateKey}from"#runtime/framework-tools/todo.js";import{AGENT_TOOL_DEFINITION}from"#runtime/framework-tools/agent.js";import{ASK_QUESTION_TOOL_DEFINITION}from"#runtime/framework-tools/ask-question.js";import{WEB_SEARCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-search.js";import{BASH_TOOL_DEFINITION}from"#runtime/framework-tools/bash.js";import{GLOB_TOOL_DEFINITION}from"#runtime/framework-tools/glob.js";import{GREP_TOOL_DEFINITION}from"#runtime/framework-tools/grep.js";import{READ_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/read-file.js";import{SKILL_TOOL_DEFINITION,createSkillToolDefinition}from"#runtime/framework-tools/skill.js";import{WEB_FETCH_TOOL_DEFINITION}from"#runtime/framework-tools/web-fetch.js";import{WRITE_FILE_TOOL_DEFINITION}from"#runtime/framework-tools/write-file.js";const REGISTERED_FRAMEWORK_TOOLS=[ASK_QUESTION_TOOL_DEFINITION,BASH_TOOL_DEFINITION,GLOB_TOOL_DEFINITION,GREP_TOOL_DEFINITION,READ_FILE_TOOL_DEFINITION,WRITE_FILE_TOOL_DEFINITION,TODO_TOOL_DEFINITION,WEB_FETCH_TOOL_DEFINITION,WEB_SEARCH_TOOL_DEFINITION,SKILL_TOOL_DEFINITION],ALL_FRAMEWORK_TOOLS=[...REGISTERED_FRAMEWORK_TOOLS,AGENT_TOOL_DEFINITION];function getFrameworkToolDefinitions(e){let t=e?.authoredSkills;return t===void 0?REGISTERED_FRAMEWORK_TOOLS:REGISTERED_FRAMEWORK_TOOLS.map(e=>e.name===SKILL_TOOL_DEFINITION.name?createSkillToolDefinition(t):e)}function getAllFrameworkToolDefinitions(){return ALL_FRAMEWORK_TOOLS}function getAllFrameworkToolNames(){return new Set(ALL_FRAMEWORK_TOOLS.map(e=>e.name))}export{ConnectionRegistryKey,ReadFileStateKey,TodoStateKey,getAllFrameworkToolDefinitions,getAllFrameworkToolNames,getFrameworkToolDefinitions};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { z } from "#compiled/zod/index.js";
|
|
2
|
-
import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
2
|
+
import type { ResolvedSkillDefinition, ResolvedToolDefinition } from "#runtime/types.js";
|
|
3
3
|
export declare const SKILL_INPUT_SCHEMA: z.ZodObject<{
|
|
4
4
|
skill: z.ZodString;
|
|
5
5
|
}, z.core.$strict>;
|
|
6
6
|
export declare const SKILL_OUTPUT_SCHEMA: z.ZodString;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a node-specific `load_skill` definition with authored skills bound
|
|
9
|
+
* into its executor.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createSkillToolDefinition(authoredSkills: readonly ResolvedSkillDefinition[]): ResolvedToolDefinition;
|
|
7
12
|
export declare const SKILL_TOOL_DEFINITION: ResolvedToolDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{DynamicSkillManifestKey,SandboxKey}from"#context/keys.js";import{loadContext}from"#context/container.js";import{loadSkillFromSandbox}from"#runtime/skills/sandbox-access.js";import{ConnectionRegistryKey}from"#context/providers/connection-key.js";async function executeLoadSkillTool(e){let
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{DynamicSkillManifestKey,SandboxKey}from"#context/keys.js";import{loadContext}from"#context/container.js";import{loadSkillFromSandbox}from"#runtime/skills/sandbox-access.js";import{ConnectionRegistryKey}from"#context/providers/connection-key.js";async function executeLoadSkillTool(e,t){let r=loadContext(),{skill:i}=e,a=availableDynamicSkillNames(r),o=[...new Set([...t.map(e=>e.name),...a])].sort();try{if(a.includes(i)){let e=r.get(SandboxKey);if(e===void 0)throw Error(`The dynamic skill "${i}" requires sandbox access on the runtime context.`);return await loadSkillFromSandbox(e,i,o)}let e=t.find(e=>e.name===i);if(e!==void 0)return e.markdown;throw Error(formatSkillNotFoundError(i,o))}catch(e){let t=r.get(ConnectionRegistryKey)?.getConnectionNames().find(e=>e.toLowerCase()===i.toLowerCase());if(t===void 0||o.includes(i))throw e;let n=e instanceof Error?e.message:String(e);throw Error(`${n} "${t}" is an installed connection, not a skill. Use connection_search with connection "${t}" to find its tools.`,{cause:e})}}function availableDynamicSkillNames(e){let n=Object.values(e.get(DynamicSkillManifestKey)??{}).flat().map(e=>e.name);return[...new Set(n)].sort()}function formatSkillNotFoundError(e,t){return`No skill named "${e}".${t.length>0?` Available skills: ${t.join(`, `)}.`:``}`}const SKILL_INPUT_SCHEMA=z.strictObject({skill:z.string().describe(`Available skill name or id.`)}),SKILL_OUTPUT_SCHEMA=z.string(),SKILL_TOOL_METADATA={description:[`Load the full instructions for one available skill by name or id.`,`Use this tool when the request clearly matches a listed skill description or when the user explicitly asks for that skill.`,`This is not for MCP connections; use connection_search to access an installed connection.`,`Loading adds the skill instructions to the current turn.`,`Choose the "skill" value from the Available skills block.`].join(` `),inputSchema:SKILL_INPUT_SCHEMA,logicalPath:`eve:framework/load-skill`,name:`load_skill`,outputSchema:SKILL_OUTPUT_SCHEMA,sourceId:`eve:load-skill-tool`,sourceKind:`module`};function createSkillToolDefinition(e){return{...SKILL_TOOL_METADATA,execute:t=>executeLoadSkillTool(t,e)}}const SKILL_TOOL_DEFINITION=createSkillToolDefinition([]);export{SKILL_INPUT_SCHEMA,SKILL_OUTPUT_SCHEMA,SKILL_TOOL_DEFINITION,createSkillToolDefinition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expectObjectRecord}from"#internal/authored-module.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{createRuntimeSubagentRegistry}from"#runtime/subagents/registry.js";import{createRuntimeToolRegistry}from"#runtime/tools/registry.js";import{WORKFLOW_TOOL_NAME}from"#shared/workflow-sandbox.js";import{getAllFrameworkChannelNames,getFrameworkChannelDefinitions}from"#runtime/framework-channels/index.js";import{getAllFrameworkToolNames,getFrameworkToolDefinitions}from"#runtime/framework-tools/index.js";import{createConnectionSearchResolver}from"#runtime/framework-tools/connection-search-dynamic.js";import{resolveAgent}from"#runtime/resolve-agent.js";import{loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{createResolvedRuntimeTurnAgent}from"#runtime/agent/bootstrap.js";import{createRuntimeHookRegistry}from"#runtime/hooks/registry.js";import{createRuntimeSandboxRegistry}from"#runtime/sandbox/registry.js";var ResolveRuntimeAgentGraphError=class extends Error{logicalPath;nodeId;sourceId;constructor(e,t={}){super(e),this.name=`ResolveRuntimeAgentGraphError`,t.logicalPath!==void 0&&(this.logicalPath=t.logicalPath),t.nodeId!==void 0&&(this.nodeId=t.nodeId),t.sourceId!==void 0&&(this.sourceId=t.sourceId)}};async function resolveRuntimeAgentGraph(e){let n=new Map,r=createChildNodeIdsByParentNodeId(e.manifest),i=new Map(e.manifest.subagents.map(e=>[e.nodeId,e]));return{nodesByNodeId:n,root:await resolveRuntimeAgentNode({childNodeIdsByParentNodeId:r,manifest:e.manifest,moduleMap:e.moduleMap,nodeId:ROOT_COMPILED_AGENT_NODE_ID,nodesByNodeId:n,subagentNodesById:i})}}async function resolveRuntimeAgentNode(e){let t=toRuntimeNodeId(e.nodeId);if(e.nodesByNodeId.has(t))throw new ResolveRuntimeAgentGraphError(`Found multiple runtime agent nodes for node id "${t}".`,{nodeId:t,sourceId:e.sourceId});let r=await resolveAgent({manifest:e.manifest,moduleMap:e.moduleMap,nodeId:e.nodeId}),a=r.connections.length>0,o=getFrameworkToolDefinitions({hasConnections:a}),s=new Set(o.map(e=>e.name)),c=getAllFrameworkToolNames(),l=new Set(r.tools.map(e=>e.name));for(let n of r.disabledFrameworkTools)if(!c.has(n))throw new ResolveRuntimeAgentGraphError(`agent/tools/${n}.ts exports disableTool() but "${n}" is not a framework tool. Rename the file to one of: ${[...c].sort().join(`, `)}.`,{nodeId:t,sourceId:e.sourceId});let u=new Set(r.disabledFrameworkTools),d=await createRuntimeToolRegistry({tools:[...o.filter(e=>!l.has(e.name)&&!u.has(e.name)),...r.tools]},{reservedToolNames:[WORKFLOW_TOOL_NAME,...s.has(LOAD_SKILL_TOOL_NAME)||l.has(LOAD_SKILL_TOOL_NAME)?[]:[LOAD_SKILL_TOOL_NAME]]}),f=new Set(r.channels.map(e=>e.name)),p=getAllFrameworkChannelNames();for(let n of r.disabledFrameworkChannels)if(!p.has(n))throw new ResolveRuntimeAgentGraphError(`agent/channels/${n}.ts exports disableRoute() but "${n}" is not a framework channel. Rename the file to one of: ${[...p].sort().join(`, `)}.`,{nodeId:t,sourceId:e.sourceId});let m=new Set(r.disabledFrameworkChannels),h=[...getFrameworkChannelDefinitions().filter(e=>!f.has(e.name)&&!m.has(e.name)),...r.channels],g=createRuntimeSandboxRegistry({authoredSandbox:r.sandbox,workspaceResourceRoot:r.workspaceResourceRoot}),_=createRuntimeSubagentRegistry({reservedToolNames:[LOAD_SKILL_TOOL_NAME,...d.preparedTools.map(e=>e.name)],subagents:await resolveRuntimeSubagents({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,manifest:e.manifest,moduleMap:e.moduleMap,nodesByNodeId:e.nodesByNodeId,parentNodeId:e.nodeId,subagentNodesById:e.subagentNodesById})}),v=a?{...r,dynamicToolResolvers:[...r.dynamicToolResolvers,createConnectionSearchResolver()]}:r,y={agent:v,channels:h,hookRegistry:createRuntimeHookRegistry(v.hooks),nodeId:t,sandboxRegistry:g,sourceId:e.sourceId,subagentRegistry:_,toolRegistry:d,turnAgent:createResolvedRuntimeTurnAgent({agent:v,nodeId:t,tools:[...d.preparedTools,..._.preparedTools]})};return e.nodesByNodeId.set(t,y),y}async function resolveRuntimeSubagents(e){let t=[],n=e.childNodeIdsByParentNodeId.get(e.parentNodeId)??[];for(let r of n){let n=e.subagentNodesById.get(r);if(n===void 0)throw new ResolveRuntimeAgentGraphError(`Missing compiled subagent node "${r}" while resolving runtime subagents.`,{nodeId:toRuntimeNodeId(e.parentNodeId),sourceId:r});t.push(await resolveRuntimeSubagent({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,moduleMap:e.moduleMap,nodesByNodeId:e.nodesByNodeId,sourceRef:n,subagentNodesById:e.subagentNodesById}))}for(let n of e.manifest.remoteAgents)t.push(await resolveRuntimeRemoteAgent({moduleMap:e.moduleMap,nodeScopeId:e.parentNodeId,sourceRef:n}));return t}async function resolveRuntimeSubagent(e){let t={description:e.sourceRef.description,kind:`subagent`,logicalPath:e.sourceRef.logicalPath,name:e.sourceRef.name,nodeId:toRuntimeNodeId(e.sourceRef.nodeId),sourceId:e.sourceRef.sourceId,sourceKind:`module`};return await resolveRuntimeAgentNode({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,manifest:e.sourceRef.agent,moduleMap:e.moduleMap,nodeId:e.sourceRef.nodeId,nodesByNodeId:e.nodesByNodeId,sourceId:e.sourceRef.sourceId,subagentNodesById:e.subagentNodesById}),t}async function resolveRuntimeRemoteAgent(t){let n=expectObjectRecord(await loadResolvedModuleExport({definition:t.sourceRef,kindLabel:`remote agent`,moduleMap:t.moduleMap,nodeId:t.nodeScopeId}),`Expected remote agent source "${t.sourceRef.logicalPath}" to export an object.`),r={description:t.sourceRef.description,kind:`remote`,logicalPath:t.sourceRef.logicalPath,name:t.sourceRef.name,nodeId:toRuntimeNodeId(t.sourceRef.nodeId),outputSchema:t.sourceRef.outputSchema,path:t.sourceRef.path,sourceId:t.sourceRef.sourceId,sourceKind:`module`,url:await resolveRemoteAgentUrl({bakedUrl:t.sourceRef.url,logicalPath:t.sourceRef.logicalPath,resolvedUrl:n.url})};typeof n.auth==`function`&&(r.auth=n.auth);let i=resolveRemoteAgentHeaders(n.headers);return i!==void 0&&(r.headers=i),r}async function resolveRemoteAgentUrl(e){if(typeof e.resolvedUrl==`function`){let t=await e.resolvedUrl();if(typeof t!=`string`||t.length===0)throw Error(`Remote agent "${e.logicalPath}" url function must return a non-empty string.`);return t}let t=e.bakedUrl??(typeof e.resolvedUrl==`string`?e.resolvedUrl:``);if(t.length===0)throw Error(`Remote agent "${e.logicalPath}" is missing a url.`);return t}function resolveRemoteAgentHeaders(e){if(e===void 0)return;if(typeof e==`function`)return e;if(typeof e!=`object`||!e||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function createChildNodeIdsByParentNodeId(e){let t=new Map;for(let n of e.subagentEdges){let e=t.get(n.parentNodeId);if(e===void 0){t.set(n.parentNodeId,[n.childNodeId]);continue}e.push(n.childNodeId)}return t}function toRuntimeNodeId(e){return e===ROOT_COMPILED_AGENT_NODE_ID?ROOT_RUNTIME_AGENT_NODE_ID:e}export{resolveRuntimeAgentGraph};
|
|
1
|
+
import{expectObjectRecord}from"#internal/authored-module.js";import{ROOT_COMPILED_AGENT_NODE_ID}from"#compiler/manifest.js";import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{ROOT_RUNTIME_AGENT_NODE_ID}from"#runtime/graph.js";import{createRuntimeSubagentRegistry}from"#runtime/subagents/registry.js";import{createRuntimeToolRegistry}from"#runtime/tools/registry.js";import{WORKFLOW_TOOL_NAME}from"#shared/workflow-sandbox.js";import{getAllFrameworkChannelNames,getFrameworkChannelDefinitions}from"#runtime/framework-channels/index.js";import{getAllFrameworkToolNames,getFrameworkToolDefinitions}from"#runtime/framework-tools/index.js";import{createConnectionSearchResolver}from"#runtime/framework-tools/connection-search-dynamic.js";import{resolveAgent}from"#runtime/resolve-agent.js";import{loadResolvedModuleExport}from"#runtime/resolve-helpers.js";import{createResolvedRuntimeTurnAgent}from"#runtime/agent/bootstrap.js";import{createRuntimeHookRegistry}from"#runtime/hooks/registry.js";import{createRuntimeSandboxRegistry}from"#runtime/sandbox/registry.js";var ResolveRuntimeAgentGraphError=class extends Error{logicalPath;nodeId;sourceId;constructor(e,t={}){super(e),this.name=`ResolveRuntimeAgentGraphError`,t.logicalPath!==void 0&&(this.logicalPath=t.logicalPath),t.nodeId!==void 0&&(this.nodeId=t.nodeId),t.sourceId!==void 0&&(this.sourceId=t.sourceId)}};async function resolveRuntimeAgentGraph(e){let n=new Map,r=createChildNodeIdsByParentNodeId(e.manifest),i=new Map(e.manifest.subagents.map(e=>[e.nodeId,e]));return{nodesByNodeId:n,root:await resolveRuntimeAgentNode({childNodeIdsByParentNodeId:r,manifest:e.manifest,moduleMap:e.moduleMap,nodeId:ROOT_COMPILED_AGENT_NODE_ID,nodesByNodeId:n,subagentNodesById:i})}}async function resolveRuntimeAgentNode(e){let t=toRuntimeNodeId(e.nodeId);if(e.nodesByNodeId.has(t))throw new ResolveRuntimeAgentGraphError(`Found multiple runtime agent nodes for node id "${t}".`,{nodeId:t,sourceId:e.sourceId});let r=await resolveAgent({manifest:e.manifest,moduleMap:e.moduleMap,nodeId:e.nodeId}),a=r.connections.length>0,o=getFrameworkToolDefinitions({authoredSkills:r.skills,hasConnections:a}),s=new Set(o.map(e=>e.name)),c=getAllFrameworkToolNames(),l=new Set(r.tools.map(e=>e.name));for(let n of r.disabledFrameworkTools)if(!c.has(n))throw new ResolveRuntimeAgentGraphError(`agent/tools/${n}.ts exports disableTool() but "${n}" is not a framework tool. Rename the file to one of: ${[...c].sort().join(`, `)}.`,{nodeId:t,sourceId:e.sourceId});let u=new Set(r.disabledFrameworkTools),d=await createRuntimeToolRegistry({tools:[...o.filter(e=>!l.has(e.name)&&!u.has(e.name)),...r.tools]},{reservedToolNames:[WORKFLOW_TOOL_NAME,...s.has(LOAD_SKILL_TOOL_NAME)||l.has(LOAD_SKILL_TOOL_NAME)?[]:[LOAD_SKILL_TOOL_NAME]]}),f=new Set(r.channels.map(e=>e.name)),p=getAllFrameworkChannelNames();for(let n of r.disabledFrameworkChannels)if(!p.has(n))throw new ResolveRuntimeAgentGraphError(`agent/channels/${n}.ts exports disableRoute() but "${n}" is not a framework channel. Rename the file to one of: ${[...p].sort().join(`, `)}.`,{nodeId:t,sourceId:e.sourceId});let m=new Set(r.disabledFrameworkChannels),h=[...getFrameworkChannelDefinitions().filter(e=>!f.has(e.name)&&!m.has(e.name)),...r.channels],g=createRuntimeSandboxRegistry({authoredSandbox:r.sandbox,workspaceResourceRoot:r.workspaceResourceRoot}),_=createRuntimeSubagentRegistry({reservedToolNames:[LOAD_SKILL_TOOL_NAME,...d.preparedTools.map(e=>e.name)],subagents:await resolveRuntimeSubagents({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,manifest:e.manifest,moduleMap:e.moduleMap,nodesByNodeId:e.nodesByNodeId,parentNodeId:e.nodeId,subagentNodesById:e.subagentNodesById})}),v=a?{...r,dynamicToolResolvers:[...r.dynamicToolResolvers,createConnectionSearchResolver()]}:r,y={agent:v,channels:h,hookRegistry:createRuntimeHookRegistry(v.hooks),nodeId:t,sandboxRegistry:g,sourceId:e.sourceId,subagentRegistry:_,toolRegistry:d,turnAgent:createResolvedRuntimeTurnAgent({agent:v,nodeId:t,tools:[...d.preparedTools,..._.preparedTools]})};return e.nodesByNodeId.set(t,y),y}async function resolveRuntimeSubagents(e){let t=[],n=e.childNodeIdsByParentNodeId.get(e.parentNodeId)??[];for(let r of n){let n=e.subagentNodesById.get(r);if(n===void 0)throw new ResolveRuntimeAgentGraphError(`Missing compiled subagent node "${r}" while resolving runtime subagents.`,{nodeId:toRuntimeNodeId(e.parentNodeId),sourceId:r});t.push(await resolveRuntimeSubagent({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,moduleMap:e.moduleMap,nodesByNodeId:e.nodesByNodeId,sourceRef:n,subagentNodesById:e.subagentNodesById}))}for(let n of e.manifest.remoteAgents)t.push(await resolveRuntimeRemoteAgent({moduleMap:e.moduleMap,nodeScopeId:e.parentNodeId,sourceRef:n}));return t}async function resolveRuntimeSubagent(e){let t={description:e.sourceRef.description,kind:`subagent`,logicalPath:e.sourceRef.logicalPath,name:e.sourceRef.name,nodeId:toRuntimeNodeId(e.sourceRef.nodeId),sourceId:e.sourceRef.sourceId,sourceKind:`module`};return await resolveRuntimeAgentNode({childNodeIdsByParentNodeId:e.childNodeIdsByParentNodeId,manifest:e.sourceRef.agent,moduleMap:e.moduleMap,nodeId:e.sourceRef.nodeId,nodesByNodeId:e.nodesByNodeId,sourceId:e.sourceRef.sourceId,subagentNodesById:e.subagentNodesById}),t}async function resolveRuntimeRemoteAgent(t){let n=expectObjectRecord(await loadResolvedModuleExport({definition:t.sourceRef,kindLabel:`remote agent`,moduleMap:t.moduleMap,nodeId:t.nodeScopeId}),`Expected remote agent source "${t.sourceRef.logicalPath}" to export an object.`),r={description:t.sourceRef.description,kind:`remote`,logicalPath:t.sourceRef.logicalPath,name:t.sourceRef.name,nodeId:toRuntimeNodeId(t.sourceRef.nodeId),outputSchema:t.sourceRef.outputSchema,path:t.sourceRef.path,sourceId:t.sourceRef.sourceId,sourceKind:`module`,url:await resolveRemoteAgentUrl({bakedUrl:t.sourceRef.url,logicalPath:t.sourceRef.logicalPath,resolvedUrl:n.url})};typeof n.auth==`function`&&(r.auth=n.auth);let i=resolveRemoteAgentHeaders(n.headers);return i!==void 0&&(r.headers=i),r}async function resolveRemoteAgentUrl(e){if(typeof e.resolvedUrl==`function`){let t=await e.resolvedUrl();if(typeof t!=`string`||t.length===0)throw Error(`Remote agent "${e.logicalPath}" url function must return a non-empty string.`);return t}let t=e.bakedUrl??(typeof e.resolvedUrl==`string`?e.resolvedUrl:``);if(t.length===0)throw Error(`Remote agent "${e.logicalPath}" is missing a url.`);return t}function resolveRemoteAgentHeaders(e){if(e===void 0)return;if(typeof e==`function`)return e;if(typeof e!=`object`||!e||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&(t[n]=r);return t}function createChildNodeIdsByParentNodeId(e){let t=new Map;for(let n of e.subagentEdges){let e=t.get(n.parentNodeId);if(e===void 0){t.set(n.parentNodeId,[n.childNodeId]);continue}e.push(n.childNodeId)}return t}function toRuntimeNodeId(e){return e===ROOT_COMPILED_AGENT_NODE_ID?ROOT_RUNTIME_AGENT_NODE_ID:e}export{resolveRuntimeAgentGraph};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{select}from"../ask.js";import{z}from"#compiled/zod/index.js";import{DEFAULT_AGENT_MODEL_ID}from"#shared/default-agent-model.js";const gatewayCatalogModelSchema=z.object({id:z.string(),name:z.string(),type:z.string(),owned_by:z.string(),released:z.number().finite().optional().catch(void 0),tags:z.array(z.string()).optional().catch(void 0),pricing:z.object({service_tiers:z.record(z.string(),z.unknown()).optional().catch(void 0)}).optional().catch(void 0)}),gatewayCatalogSchema=z.object({data:z.array(z.unknown())}).transform(({data:e})=>e.flatMap(e=>{let t=gatewayCatalogModelSchema.safeParse(e);return t.success?[t.data]:[]}));function modelOption(e,t,n,r=!0){return{id:e,label:t,value:e,hint:n,featured:r||void 0}}const FEATURED_MODEL_IDS=[DEFAULT_AGENT_MODEL_ID,`anthropic/claude-opus-4.8`,`openai/gpt-5.5`],FALLBACK_MODELS=[modelOption(DEFAULT_AGENT_MODEL_ID,`Claude Sonnet 5`,`Anthropic`),modelOption(`anthropic/claude-opus-4.8`,`Claude Opus 4.8`,`Anthropic`),modelOption(`openai/gpt-5.5`,`GPT-5.5`,`OpenAI`),modelOption(`google/gemini-3.5`,`Gemini 3.5`,`Google`,!1)],PROVIDER_BRANDS={openai:`OpenAI`,xai:`xAI`,deepseek:`DeepSeek`,moonshotai:`Moonshot AI`};function providerLabel(e){return e.length===0?``:PROVIDER_BRANDS[e]??e.charAt(0).toUpperCase()+e.slice(1)}async function fetchGatewayCatalog(e){let t=new AbortController,n=setTimeout(()=>t.abort(),5e3);try{let n=e===void 0?t.signal:AbortSignal.any([e,t.signal])
|
|
1
|
+
import{select}from"../ask.js";import{z}from"#compiled/zod/index.js";import{DEFAULT_AGENT_MODEL_ID}from"#shared/default-agent-model.js";import{AI_GATEWAY_MODELS_URL,vercelGatewayFetch}from"#internal/gateway.js";const gatewayCatalogModelSchema=z.object({id:z.string(),name:z.string(),type:z.string(),owned_by:z.string(),released:z.number().finite().optional().catch(void 0),tags:z.array(z.string()).optional().catch(void 0),pricing:z.object({service_tiers:z.record(z.string(),z.unknown()).optional().catch(void 0)}).optional().catch(void 0)}),gatewayCatalogSchema=z.object({data:z.array(z.unknown())}).transform(({data:e})=>e.flatMap(e=>{let t=gatewayCatalogModelSchema.safeParse(e);return t.success?[t.data]:[]}));function modelOption(e,t,n,r=!0){return{id:e,label:t,value:e,hint:n,featured:r||void 0}}const FEATURED_MODEL_IDS=[DEFAULT_AGENT_MODEL_ID,`anthropic/claude-opus-4.8`,`openai/gpt-5.5`],FALLBACK_MODELS=[modelOption(DEFAULT_AGENT_MODEL_ID,`Claude Sonnet 5`,`Anthropic`),modelOption(`anthropic/claude-opus-4.8`,`Claude Opus 4.8`,`Anthropic`),modelOption(`openai/gpt-5.5`,`GPT-5.5`,`OpenAI`),modelOption(`google/gemini-3.5`,`Gemini 3.5`,`Google`,!1)],PROVIDER_BRANDS={openai:`OpenAI`,xai:`xAI`,deepseek:`DeepSeek`,moonshotai:`Moonshot AI`};function providerLabel(e){return e.length===0?``:PROVIDER_BRANDS[e]??e.charAt(0).toUpperCase()+e.slice(1)}async function fetchGatewayCatalog(e){let t=new AbortController,n=setTimeout(()=>t.abort(),5e3);try{let n=await vercelGatewayFetch(AI_GATEWAY_MODELS_URL,{signal:e===void 0?t.signal:AbortSignal.any([e,t.signal])});if(!n.ok)throw Error(`AI Gateway model catalog request failed (${n.status}).`);return parseGatewayCatalog(await n.json())}finally{clearTimeout(n)}}function parseGatewayCatalog(e){let t=gatewayCatalogSchema.safeParse(e);if(!t.success)throw Error(`AI Gateway returned an invalid model catalog.`);return t.data}function featuredPriority(e){let t=FEATURED_MODEL_IDS.indexOf(e);return t===-1?FEATURED_MODEL_IDS.length:t}function modelOptionsFromCatalog(e){if(e===void 0)return FALLBACK_MODELS;let t=e.filter(e=>e.type===`language`&&(e.tags??[]).includes(`web-search`)).map(e=>{let t=e.id.split(`/`)[0]??``;return{value:e.id,label:e.name,hint:providerLabel(t),provider:t,released:e.released}}).sort((e,t)=>{let n=featuredPriority(e.value)-featuredPriority(t.value);if(n!==0)return n;let r=(t.released??-1/0)-(e.released??-1/0);if(r!==0)return r;let i=e.label.localeCompare(t.label);return i===0?e.value.localeCompare(t.value):i});return t.length===0?FALLBACK_MODELS:t.map(({value:e,label:t,hint:n})=>({id:e,label:t,value:e,hint:n,featured:FEATURED_MODEL_IDS.includes(e)||void 0}))}async function buildModelOptions(e,t){try{return modelOptionsFromCatalog(await e(t))}catch{return t?.throwIfAborted(),FALLBACK_MODELS}}function selectModel(t){let r=t.deps??{fetchModels:fetchGatewayCatalog};return{id:`select-model`,async gather({signal:i}){let a=t.presetModel;if(a!==void 0&&a.length>0)return a;let o=await buildModelOptions(r.fetchModels,i),s=t.defaultModel!==void 0&&o.some(e=>e.value===t.defaultModel)?t.defaultModel:o.some(e=>e.value===DEFAULT_AGENT_MODEL_ID)?DEFAULT_AGENT_MODEL_ID:o[0]?.value;return t.asker.ask(select({key:`model`,message:`Which model should your agent use?`,options:o,recommended:s,required:!0,search:!0,placeholder:`type to search`}))},async perform({input:e}){return e},apply(e,t){return{...e,modelId:t}}}}export{fetchGatewayCatalog,modelOptionsFromCatalog,parseGatewayCatalog,selectModel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type GatewayCredentialResolution } from "#internal/resolve-model-endpoint-status.js";
|
|
2
2
|
import { type ApplyAiGatewayCredentialDeps } from "../boxes/apply-ai-gateway-credential.js";
|
|
3
3
|
import { findEnvFileWithKey } from "../boxes/detect-ai-gateway.js";
|
|
4
4
|
import { type LinkProjectDeps } from "../boxes/link-project.js";
|
|
@@ -9,14 +9,20 @@ import type { Prompter } from "../prompter.js";
|
|
|
9
9
|
export interface LinkFlowDeps {
|
|
10
10
|
detectProjectIdentity: typeof detectProjectIdentity;
|
|
11
11
|
findEnvFileWithKey: typeof findEnvFileWithKey;
|
|
12
|
+
/** Shell environment probed for a gateway key that would shadow OIDC. */
|
|
13
|
+
env: Record<string, string | undefined>;
|
|
12
14
|
resolveProvisioning?: ResolveProvisioningDeps;
|
|
13
15
|
linkProject?: LinkProjectDeps;
|
|
14
16
|
applyAiGatewayCredential?: ApplyAiGatewayCredentialDeps;
|
|
15
17
|
}
|
|
16
18
|
export type LinkFlowResult = {
|
|
17
19
|
kind: "done";
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The credential the runtime will actually resolve, from the one
|
|
22
|
+
* precedence authority ({@link resolveGatewayCredential}): a gateway
|
|
23
|
+
* API key — env file or shell — outranks the pulled OIDC token.
|
|
24
|
+
*/
|
|
25
|
+
resolution?: GatewayCredentialResolution;
|
|
20
26
|
} | {
|
|
21
27
|
kind: "cancelled";
|
|
22
28
|
};
|
|
@@ -36,6 +42,10 @@ export type LinkFlowResult = {
|
|
|
36
42
|
* Ends by verifying a model credential actually landed (`VERCEL_OIDC_TOKEN`
|
|
37
43
|
* or `AI_GATEWAY_API_KEY` in an env file) — an env pull can succeed without
|
|
38
44
|
* granting gateway access, and the difference is what the user acts on next.
|
|
45
|
+
* The reported credential mirrors runtime resolution — `AI_GATEWAY_API_KEY`
|
|
46
|
+
* (env file or shell) outranks the OIDC token, exactly as the AI SDK gateway
|
|
47
|
+
* provider resolves it — so the outcome message, the status bar, and the
|
|
48
|
+
* actual authentication can never disagree.
|
|
39
49
|
*/
|
|
40
50
|
export declare function runLinkFlow(input: {
|
|
41
51
|
appRoot: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__toESM}from"../../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{AI_GATEWAY_API_KEY_ENV_VAR}from"../ai-gateway-api-key.js";import{interactiveAsker,withAnswers}from"../ask.js";import{detectProjectIdentity}from"../project-resolution.js";import{snapshotSetupState}from"../state.js";import{WizardCancelledError}from"../step.js";import{withSpinner}from"../with-spinner.js";import{detectAiGateway,findEnvFileWithKey}from"../boxes/detect-ai-gateway.js";import{applyAiGatewayCredential}from"../boxes/apply-ai-gateway-credential.js";import{linkVercelProject}from"../boxes/link-project.js";import{resolveProvisioning}from"../boxes/resolve-provisioning.js";import{runInteractive}from"../runner.js";import{inProjectSetupState,prompterSink}from"./in-project.js";var import_picocolors=__toESM(require_picocolors(),1);async function runLinkFlow(e){let{appRoot:t,prompter:a,signal:o,projectSelection:s=`existing-only`}=e,c={detectProjectIdentity,findEnvFileWithKey,...e.deps},l=await withSpinner(a,`Checking the current Vercel link...`,async()=>{let e=await c.detectProjectIdentity(t,{signal:o});return o?.throwIfAborted(),e});if(l===void 0){let[n,r]=await Promise.all([c.findEnvFileWithKey(t,AI_GATEWAY_API_KEY_ENV_VAR),c.findEnvFileWithKey(t,`VERCEL_OIDC_TOKEN`)]),i=n??r;i!==void 0&&e.teamSelectMessage===void 0&&a.log.message(`This directory is not linked to a Vercel project yet — the model currently runs on credentials from ${i}.`)}else{let e=l.teamName===void 0?import_picocolors.default.bold(l.projectName):`${import_picocolors.default.bold(l.projectName)} in ${import_picocolors.default.bold(l.teamName)}`;try{if(await a.select({message:`This directory is already linked to\n${e}`,options:[{value:`relink`,label:`Link to another project`},{value:`dismiss`,label:`Dismiss`}]})===`dismiss`)return{kind:`cancelled`}}catch(e){if(e instanceof WizardCancelledError)return{kind:`cancelled`};throw e}}let u=inProjectSetupState(t,{kind:`unresolved`});if((await runInteractive([resolveProvisioning({asker:withAnswers({deploy:`vercel`})(interactiveAsker(a)),prompter:a,targetDirectory:t,mode:{headless:!1},adoptExistingLink:!1,projectSelection:s,teamSelectMessage:e.teamSelectMessage,deps:c.resolveProvisioning}),linkVercelProject({prompter:a,deps:c.linkProject}),detectAiGateway(),applyAiGatewayCredential({prompter:a,deps:c.applyAiGatewayCredential})],u,prompterSink(a),{snapshot:snapshotSetupState,signal:o})).kind===`cancelled`)return{kind:`cancelled`};let[d,f]=await Promise.all([c.findEnvFileWithKey(t,`VERCEL_OIDC_TOKEN`),c.findEnvFileWithKey(t,AI_GATEWAY_API_KEY_ENV_VAR)]);o?.throwIfAborted(),d===void 0&&f===void 0&&a.log.warning("Linked, but no model credential landed in an env file (VERCEL_OIDC_TOKEN or AI_GATEWAY_API_KEY). Run `vercel env pull` once the project has AI Gateway access.");let p={kind:`done`};
|
|
1
|
+
import{__toESM}from"../../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{AI_GATEWAY_API_KEY_ENV_VAR}from"../ai-gateway-api-key.js";import{interactiveAsker,withAnswers}from"../ask.js";import{detectProjectIdentity}from"../project-resolution.js";import{snapshotSetupState}from"../state.js";import{WizardCancelledError}from"../step.js";import{withSpinner}from"../with-spinner.js";import{detectAiGateway,findEnvFileWithKey}from"../boxes/detect-ai-gateway.js";import{applyAiGatewayCredential}from"../boxes/apply-ai-gateway-credential.js";import{linkVercelProject}from"../boxes/link-project.js";import{resolveProvisioning}from"../boxes/resolve-provisioning.js";import{runInteractive}from"../runner.js";import{inProjectSetupState,prompterSink}from"./in-project.js";import{hasEnvValue,resolveGatewayCredential}from"#internal/resolve-model-endpoint-status.js";var import_picocolors=__toESM(require_picocolors(),1);async function runLinkFlow(e){let{appRoot:t,prompter:a,signal:o,projectSelection:s=`existing-only`}=e,c={detectProjectIdentity,findEnvFileWithKey,env:process.env,...e.deps},l=await withSpinner(a,`Checking the current Vercel link...`,async()=>{let e=await c.detectProjectIdentity(t,{signal:o});return o?.throwIfAborted(),e});if(l===void 0){let[n,r]=await Promise.all([c.findEnvFileWithKey(t,AI_GATEWAY_API_KEY_ENV_VAR),c.findEnvFileWithKey(t,`VERCEL_OIDC_TOKEN`)]),i=n??r;i!==void 0&&e.teamSelectMessage===void 0&&a.log.message(`This directory is not linked to a Vercel project yet — the model currently runs on credentials from ${i}.`)}else{let e=l.teamName===void 0?import_picocolors.default.bold(l.projectName):`${import_picocolors.default.bold(l.projectName)} in ${import_picocolors.default.bold(l.teamName)}`;try{if(await a.select({message:`This directory is already linked to\n${e}`,options:[{value:`relink`,label:`Link to another project`},{value:`dismiss`,label:`Dismiss`}]})===`dismiss`)return{kind:`cancelled`}}catch(e){if(e instanceof WizardCancelledError)return{kind:`cancelled`};throw e}}let u=inProjectSetupState(t,{kind:`unresolved`});if((await runInteractive([resolveProvisioning({asker:withAnswers({deploy:`vercel`})(interactiveAsker(a)),prompter:a,targetDirectory:t,mode:{headless:!1},adoptExistingLink:!1,projectSelection:s,teamSelectMessage:e.teamSelectMessage,deps:c.resolveProvisioning}),linkVercelProject({prompter:a,deps:c.linkProject}),detectAiGateway(),applyAiGatewayCredential({prompter:a,deps:c.applyAiGatewayCredential})],u,prompterSink(a),{snapshot:snapshotSetupState,signal:o})).kind===`cancelled`)return{kind:`cancelled`};let[d,f]=await Promise.all([c.findEnvFileWithKey(t,`VERCEL_OIDC_TOKEN`),c.findEnvFileWithKey(t,AI_GATEWAY_API_KEY_ENV_VAR)]);o?.throwIfAborted(),d===void 0&&f===void 0&&a.log.warning("Linked, but no model credential landed in an env file (VERCEL_OIDC_TOKEN or AI_GATEWAY_API_KEY). Run `vercel env pull` once the project has AI Gateway access.");let p={kind:`done`},m={apiKeyInEnv:hasEnvValue(c.env[AI_GATEWAY_API_KEY_ENV_VAR])};f!==void 0&&(m.apiKeyFile=f),d!==void 0&&(m.oidcFile=d);let h=resolveGatewayCredential(m);return h!==void 0&&(p.resolution=h),p}export{runLinkFlow};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type GatewayCredentialResolution } from "#internal/resolve-model-endpoint-status.js";
|
|
1
2
|
import type { AgentModelSettingsPatch } from "#source-change/apply-agent-model-settings.js";
|
|
2
|
-
import { AI_GATEWAY_API_KEY_ENV_VAR } from "../ai-gateway-api-key.js";
|
|
3
3
|
import { type SelectModelDeps } from "../boxes/select-model.js";
|
|
4
4
|
import { type GatewayModelCapabilities, type ReasoningLevel } from "../boxes/model-capabilities.js";
|
|
5
5
|
import { type VercelProjectOperationOptions } from "../project-resolution.js";
|
|
@@ -92,7 +92,8 @@ export type { ModelProviderStatus };
|
|
|
92
92
|
* disk — so it never surfaces as an outcome.
|
|
93
93
|
*/
|
|
94
94
|
export interface ModelProviderOutcome {
|
|
95
|
-
credential
|
|
95
|
+
/** The credential resolution the runtime will honor; see {@link LinkFlowResult}. */
|
|
96
|
+
resolution?: GatewayCredentialResolution;
|
|
96
97
|
status: ModelProviderStatus;
|
|
97
98
|
}
|
|
98
99
|
export type ModelFlowResult = {
|
|
@@ -113,7 +114,7 @@ export declare const MODEL_MENU_MESSAGE = "";
|
|
|
113
114
|
* and `AI_GATEWAY_API_KEY` outranks `VERCEL_OIDC_TOKEN` because it is the one
|
|
114
115
|
* the provider sub-flow's own-key branch writes.
|
|
115
116
|
*/
|
|
116
|
-
export declare function detectModelProviderStatus(appRoot: string, options?: VercelProjectOperationOptions): Promise<ModelProviderStatus>;
|
|
117
|
+
export declare function detectModelProviderStatus(appRoot: string, options?: VercelProjectOperationOptions, env?: Record<string, string | undefined>): Promise<ModelProviderStatus>;
|
|
117
118
|
/**
|
|
118
119
|
* THE MODEL FLOW for the dev TUI's `/model`: a root menu whose Change model
|
|
119
120
|
* row opens the composite model screen (catalog pick, reasoning-effort slider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__toESM}from"../../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{AI_GATEWAY_API_KEY_ENV_VAR}from"../ai-gateway-api-key.js";import{detectProjectIdentity}from"../project-resolution.js";import{WizardCancelledError}from"../step.js";import{withSpinner}from"../with-spinner.js";import{findEnvFileWithKey}from"../boxes/detect-ai-gateway.js";import{gatewayModelCapabilities}from"../boxes/model-capabilities.js";import{fetchGatewayCatalog,modelOptionsFromCatalog}from"../boxes/select-model.js";import{changeAgentModelSettings,formatApplyModelSettingsOutcome}from"./model-source-change.js";import{runProviderFlow}from"./provider.js";import{inspectApplication}from"#services/inspect-application.js";import{formatModelSummary}from"#shared/model-summary.js";import{readGatewayServiceTier}from"#shared/gateway-service-tier.js";var import_picocolors=__toESM(require_picocolors(),1);const MODEL_MENU_MESSAGE=``;function providerStatusHint(e,t=e=>e){
|
|
1
|
+
import{__toESM}from"../../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{AI_GATEWAY_API_KEY_ENV_VAR}from"../ai-gateway-api-key.js";import{detectProjectIdentity}from"../project-resolution.js";import{WizardCancelledError}from"../step.js";import{withSpinner}from"../with-spinner.js";import{findEnvFileWithKey}from"../boxes/detect-ai-gateway.js";import{gatewayModelCapabilities}from"../boxes/model-capabilities.js";import{fetchGatewayCatalog,modelOptionsFromCatalog}from"../boxes/select-model.js";import{changeAgentModelSettings,formatApplyModelSettingsOutcome}from"./model-source-change.js";import{runProviderFlow}from"./provider.js";import{inspectApplication}from"#services/inspect-application.js";import{hasEnvValue,resolveGatewayCredential}from"#internal/resolve-model-endpoint-status.js";import{formatModelSummary}from"#shared/model-summary.js";import{readGatewayServiceTier}from"#shared/gateway-service-tier.js";var import_picocolors=__toESM(require_picocolors(),1);const MODEL_MENU_MESSAGE=``;function providerStatusHint(e,t=e=>e){if(e.kind===`gateway-project`)return`AI Gateway (Linked to ${e.teamName===void 0?t(e.projectName):`${t(e.projectName)} in ${t(e.teamName)}`})`;let n=e.source.kind===`shell`?`your shell`:e.source.path;return`AI Gateway (${e.envKey} in ${n})`}function modelListRows(e){return modelOptionsFromCatalog(e).map(e=>{let t={value:e.value,label:e.value};return e.featured===!0&&(t.featured=!0),t})}function formatModelDraftHint(e,t,n){let r={model:e};return t!==null&&(r.reasoning=t),n.kind===`priority`&&(r.fastGlyph=`↯`),formatModelSummary(r)}function modelMenuRows(e,t,n,r,i,a,o){let s;a||o?(s={value:`model`,label:`Change model`,description:a?`The model, its reasoning effort, and the Gateway service tier`:`Reasoning and service tier; the model itself is an SDK model call in agent.ts`},e!==null&&(s.hint=formatModelDraftHint(e,t,n))):s={value:`model`,label:`Change model`,disabled:!0,description:`Set via an SDK model call in agent.ts; edit the source to change it`};let c;return c=i?.kind===`external`?{disabled:!0,value:`provider`,label:`Change provider`,description:`Disabled in external endpoint mode`}:r.kind===`unset`?{value:`provider`,label:import_picocolors.default.bold(`Configure model access`),hint:import_picocolors.default.yellow(`Not configured`),description:`How your agent reaches the model provider`,accent:`warning`}:{value:`provider`,label:`Change provider`,hint:providerStatusHint(r,import_picocolors.default.bold),description:`How your agent reaches the model provider`},[s,c,{value:`done`,label:`Done`}]}async function detectModelProviderStatus(e,t={},i=process.env){let[a,s,c]=await Promise.all([detectProjectIdentity(e,t),findEnvFileWithKey(e,AI_GATEWAY_API_KEY_ENV_VAR),findEnvFileWithKey(e,`VERCEL_OIDC_TOKEN`)]);if(a!==void 0){let e={kind:`gateway-project`,projectName:a.projectName};return a.teamName!==void 0&&(e.teamName=a.teamName),e}let l={apiKeyInEnv:hasEnvValue(i[AI_GATEWAY_API_KEY_ENV_VAR])};s!==void 0&&(l.apiKeyFile=s),c!==void 0&&(l.oidcFile=c);let u=resolveGatewayCredential(l);return u===void 0?{kind:`unset`}:u.credential===`api-key`?{kind:`gateway-key`,envKey:AI_GATEWAY_API_KEY_ENV_VAR,source:u.source}:{kind:`gateway-key`,envKey:`VERCEL_OIDC_TOKEN`,source:{kind:`env-file`,path:u.file}}}async function runModelFlow(e){let{appRoot:t,prompter:n,signal:r}=e,o={readCurrentModel:readCurrentAgentModel,applySettings:changeAgentModelSettings,detectProviderStatus:detectModelProviderStatus,runProviderFlow,...e.deps},detectProvider=(e=!0)=>o.detectProviderStatus(t,e&&r!==void 0?{signal:r}:{}),l=o.selectModel?.fetchModels??fetchGatewayCatalog,[d,f,p]=await withSpinner(n,`Checking the project…`,()=>Promise.all([o.readCurrentModel(t),detectProvider(),l(r).catch(()=>void 0)]));r?.throwIfAborted();let{id:m,routing:h,serviceTier:g,editable:_,settingsEditable:v}=d,y=d.reasoning===`provider-default`?null:d.reasoning,b=f,x={model:{kind:`keep`},reasoning:{kind:`keep`},gatewayServiceTier:{kind:`keep`}},S,C,w=!1,T=h?.kind===`external`?{tone:`warning`,text:"`agent.ts` specifies the model provider directly. Model, provider, and service-tier changes stay source-owned; reasoning remains configurable here."}:void 0,E=b.kind===`unset`&&h?.kind!==`external`?`provider`:_||v?`model`:`provider`,D=h?.kind!==`external`&&(e.initialStep===`provider`||b.kind===`unset`);for(;;){let e;if(D)D=!1,e=`provider`;else try{e=await n.select({message:``,options:modelMenuRows(m,y,g,b,h,_,v),hintLayout:`stacked`,initialValue:E,notices:T===void 0?[]:[T]})}catch(e){if(!(e instanceof WizardCancelledError))throw e;if(hasModelSettingsChanges(x))return{kind:`cancelled`,discardedDraft:!0};break}if(e===`done`){w=!0;break}if(e===`model`){let e=o.pickModelSettings;if(e===void 0)throw Error(`runModelFlow requires a pickModelSettings dep to open the model screen.`);let t=await e({model:_?{kind:`pick`,options:modelListRows(p),current:m}:{kind:`fixed`,current:m,reason:`Set via an SDK model call in agent.ts; edit the source to change it`},reasoning:y,serviceTier:g,settingsEditable:v,externalRouting:h?.kind===`external`,capabilitiesFor:e=>gatewayModelCapabilities(p,e)});if(r?.throwIfAborted(),t===void 0){E=`model`;continue}t.model!==void 0&&(m=t.model,h={kind:`gateway`,target:t.model.split(`/`)[0]??``},x.model={kind:`set`,value:t.model}),t.reasoning!==void 0&&(y=t.reasoning==="default"?null:t.reasoning,x.reasoning=y===null?{kind:`remove`}:{kind:`set`,value:y}),t.serviceTier!==void 0&&(g=t.serviceTier===`priority`?{kind:`priority`}:{kind:`standard`},x.gatewayServiceTier=t.serviceTier===`priority`?{kind:`set`,value:`priority`}:{kind:`remove`}),E=`done`;continue}let c=await o.runProviderFlow({appRoot:t,prompter:n,signal:r,currentProvider:b});if(c.kind===`cancelled`){if(r?.aborted)return{kind:`cancelled`};E=`provider`;continue}if(c.kind===`external-provider`){if(r?.aborted)return{kind:`cancelled`};E=`done`;continue}b=await withSpinner(n,`Checking the project…`,()=>detectProvider(!1)),C={status:b},c.kind===`done`&&c.resolution!==void 0&&(C.resolution=c.resolution),w=!0;break}if(w&&hasModelSettingsChanges(x)&&(S=await o.applySettings({appRoot:t,patch:x}),r?.throwIfAborted()),S===void 0&&C===void 0)return{kind:`cancelled`};let O={kind:`done`};return S!==void 0&&(O.modelMessage=formatApplyModelSettingsOutcome(S)),C!==void 0&&(O.providerOutcome=C),O}function hasModelSettingsChanges(e){return e.model.kind!==`keep`||e.reasoning.kind!==`keep`||e.gatewayServiceTier.kind!==`keep`}async function readCurrentAgentModel(e){try{let{compiledState:t}=await inspectApplication(e),n=t?.manifest.config,r=n?.model;return{id:r?.id??null,routing:r?.routing??null,reasoning:n?.reasoning??null,serviceTier:readGatewayServiceTier(r?.providerOptions),editable:r!==void 0&&r.source===void 0,settingsEditable:n?.source!==void 0}}catch{return{id:null,routing:null,reasoning:null,serviceTier:{kind:`standard`},editable:!1,settingsEditable:!1}}}async function modelChangeRefusalForUneditableModel(e){let{editable:t,routing:n}=await readCurrentAgentModel(e);return t?null:`Model is set via ${n?.kind===`external`?`the external provider \`${n.provider}\``:`an SDK model call`} in agent.ts, not a string literal; /model can't rewrite it. Edit \`model\` in agent.ts.`}export{MODEL_MENU_MESSAGE,detectModelProviderStatus,modelChangeRefusalForUneditableModel,runModelFlow};
|
|
@@ -3,6 +3,7 @@ import { AI_GATEWAY_API_KEY_ENV_VAR } from "../ai-gateway-api-key.js";
|
|
|
3
3
|
import type { Prompter, SelectOption } from "../prompter.js";
|
|
4
4
|
import { validateGatewayApiKey, type GatewayKeyValidation } from "../validate-gateway-key.js";
|
|
5
5
|
import { getVercelAuthStatus } from "../vercel-project.js";
|
|
6
|
+
import type { GatewayCredentialSource } from "#internal/resolve-model-endpoint-status.js";
|
|
6
7
|
import { runLinkFlow, type LinkFlowResult } from "./link.js";
|
|
7
8
|
export type ProviderConnection = "project" | "own-key" | "external";
|
|
8
9
|
/**
|
|
@@ -20,7 +21,8 @@ export type ModelProviderStatus = {
|
|
|
20
21
|
} | {
|
|
21
22
|
kind: "gateway-key";
|
|
22
23
|
envKey: typeof AI_GATEWAY_API_KEY_ENV_VAR | "VERCEL_OIDC_TOKEN";
|
|
23
|
-
|
|
24
|
+
/** Where the credential lives — an env file, or the shell for a key. */
|
|
25
|
+
source: GatewayCredentialSource;
|
|
24
26
|
};
|
|
25
27
|
export declare const PROVIDER_QUESTION = "Which model provider do you want to use?";
|
|
26
28
|
export declare const EXTERNAL_PROVIDER_INSTRUCTIONS_TITLE = "Using another model provider";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{__toESM}from"../../_virtual/_rolldown/runtime.js";import{require_picocolors}from"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js";import{appendEnv}from"../append-env.js";import{AI_GATEWAY_API_KEY_ENV_FILE,AI_GATEWAY_API_KEY_ENV_VAR,writeAiGatewayApiKey}from"../ai-gateway-api-key.js";import{WizardCancelledError}from"../step.js";import{withSpinner}from"../with-spinner.js";import{getVercelAuthStatus,vercelAuthBlockerReason}from"../vercel-project.js";import{runLinkFlow}from"./link.js";import{validateGatewayApiKey}from"../validate-gateway-key.js";var import_picocolors=__toESM(require_picocolors(),1);const PROVIDER_QUESTION=`Which model provider do you want to use?`,EXTERNAL_PROVIDER_INSTRUCTIONS_TITLE=`Using another model provider`,EXTERNAL_PROVIDER_INSTRUCTIONS=[`Set your provider's API key in ${AI_GATEWAY_API_KEY_ENV_FILE} — e.g. ANTHROPIC_API_KEY or OPENAI_API_KEY.`,'In agent/agent.ts, set `model` to a provider-authored model — e.g. `anthropic("claude-opus-4.8")` from `@ai-sdk/anthropic`.',`See https://eve.dev/docs/agent-config for details.`,"A running `eve dev` reloads env files automatically — no restart needed."];function projectConnectionOption(e){let t={value:`project`,label:`AI Gateway via Project`,hint:`Authenticates with AI Gateway automatically
|
|
2
|
-
in a new or existing project. No keys to manage.`},n=e===void 0?void 0:vercelAuthBlockerReason(e);return n===void 0?t:{...t,disabled:!0,disabledReason:n,disabledReasonTone:`warning`}}function providerOptions(e,t){let n=projectConnectionOption(e);if(t?.kind===`gateway-project`){let e=t.teamName===void 0?import_picocolors.default.bold(t.projectName):`${import_picocolors.default.bold(t.projectName)} in team ${import_picocolors.default.bold(t.teamName)}`;n={...n,checked:!0,hint:`Linked to ${e}`}}let r={value:`own-key`,label:`AI Gateway via ${AI_GATEWAY_API_KEY_ENV_VAR}`,hint:`⎿ type your key`};
|
|
2
|
+
in a new or existing project. No keys to manage.`},n=e===void 0?void 0:vercelAuthBlockerReason(e);return n===void 0?t:{...t,disabled:!0,disabledReason:n,disabledReasonTone:`warning`}}function providerOptions(e,t){let n=projectConnectionOption(e);if(t?.kind===`gateway-project`){let e=t.teamName===void 0?import_picocolors.default.bold(t.projectName):`${import_picocolors.default.bold(t.projectName)} in team ${import_picocolors.default.bold(t.teamName)}`;n={...n,checked:!0,hint:`Linked to ${e}`}}let r={value:`own-key`,label:`AI Gateway via ${AI_GATEWAY_API_KEY_ENV_VAR}`,hint:`⎿ type your key`};if(t?.kind===`gateway-key`){let e=t.source.kind===`shell`?`your shell`:t.source.path;r={...r,checked:!0,hint:`${t.envKey} set in ${e}`}}return[n,r,{value:`external`,label:`Other providers`,hint:`Connect directly to a model provider
|
|
3
3
|
via OPENAI_API_KEY or ANTHROPIC_API_KEY.`}]}async function selectProvider(e){let t={message:PROVIDER_QUESTION,options:e.options,initialValue:e.initialValue,validateInlineKey:e.validateInlineKey};if(e.picker===void 0)throw Error(`The provider flow requires the Dev TUI provider picker.`);let n=await e.picker(t);if(n===void 0)throw new WizardCancelledError;return n}async function runProviderFlow(e){let{appRoot:t,prompter:r,signal:i}=e,o={getVercelAuthStatus,runLinkFlow,appendEnv,validateGatewayApiKey,...e.deps},s,c=e.currentProvider?.kind===`gateway-key`?`own-key`:`project`,l;try{for(;;){let n=await selectProvider({picker:e.picker,options:providerOptions(s,e.currentProvider),initialValue:c,validateInlineKey:(e,t)=>o.validateGatewayApiKey(e,i===void 0?t:AbortSignal.any([i,t]))});if(n.kind===`external`)return r.acknowledge?await r.acknowledge({message:EXTERNAL_PROVIDER_INSTRUCTIONS_TITLE,lines:EXTERNAL_PROVIDER_INSTRUCTIONS}):r.note(EXTERNAL_PROVIDER_INSTRUCTIONS.join(`
|
|
4
|
-
`),EXTERNAL_PROVIDER_INSTRUCTIONS_TITLE),{kind:`external-provider`};if(n.kind===`inline-key`){l=n;break}let a=await withSpinner(r,`Checking your Vercel login…`,()=>o.getVercelAuthStatus(t,{signal:i}));if(i?.throwIfAborted(),s=a,vercelAuthBlockerReason(s)!==void 0){c=`own-key`;continue}return await o.runLinkFlow({appRoot:t,prompter:r,signal:i,projectSelection:`create-or-link`})}}catch(e){if(e instanceof WizardCancelledError)return{kind:`cancelled`};throw e}let u=l.key.trim(),d=l.validation;i?.throwIfAborted(),d.kind===`inconclusive`&&r.log.warning(`Couldn't reach the gateway to validate (${d.message}). Saving the key anyway.`);let f=await writeAiGatewayApiKey({projectRoot:t,apiKey:u,appendEnv:o.appendEnv});return r.log.success(`${f.envKey} set.`),{kind:`done`,credential:f.
|
|
4
|
+
`),EXTERNAL_PROVIDER_INSTRUCTIONS_TITLE),{kind:`external-provider`};if(n.kind===`inline-key`){l=n;break}let a=await withSpinner(r,`Checking your Vercel login…`,()=>o.getVercelAuthStatus(t,{signal:i}));if(i?.throwIfAborted(),s=a,vercelAuthBlockerReason(s)!==void 0){c=`own-key`;continue}return await o.runLinkFlow({appRoot:t,prompter:r,signal:i,projectSelection:`create-or-link`})}}catch(e){if(e instanceof WizardCancelledError)return{kind:`cancelled`};throw e}let u=l.key.trim(),d=l.validation;i?.throwIfAborted(),d.kind===`inconclusive`&&r.log.warning(`Couldn't reach the gateway to validate (${d.message}). Saving the key anyway.`);let f=await writeAiGatewayApiKey({projectRoot:t,apiKey:u,appendEnv:o.appendEnv});return r.log.success(`${f.envKey} set.`),{kind:`done`,resolution:{credential:`api-key`,source:{kind:`env-file`,path:f.envFile}}}}export{EXTERNAL_PROVIDER_INSTRUCTIONS,EXTERNAL_PROVIDER_INSTRUCTIONS_TITLE,PROVIDER_QUESTION,runProviderFlow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{captureVercel}from"#setup/primitives/index.js";async function fetchGatewayModelIds(
|
|
1
|
+
import{captureVercel}from"#setup/primitives/index.js";import{AI_GATEWAY_MODELS_URL}from"#internal/gateway.js";import{buildPackageUserAgent}from"#internal/user-agent.js";async function fetchGatewayModelIds(n){let r=await captureVercel([`curl`,AI_GATEWAY_MODELS_URL,`--`,`--silent`,`--header`,`User-Agent: ${buildPackageUserAgent()}`],{cwd:n});if(!r.ok)return null;try{let e=JSON.parse(r.stdout);if(!Array.isArray(e.data))return null;let t=e.data.map(e=>e.id).filter(e=>typeof e==`string`);return new Set(t)}catch{return null}}export{fetchGatewayModelIds};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`^7.0.26`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.4.0`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.26.
|
|
1
|
+
import{pinnedNodeEngineMajor}from"../../node-engine.js";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"../update/module-files.js";import{pathExists,writeTextFile}from"../files.js";import{resolveVersionToken}from"../version-tokens.js";import{applyPackageManagerWorkspaceConfiguration,isPackageManagerWorkspaceMember,patchWorkspaceRootPackageJson}from"../workspace-root.js";import{WEB_APP_TEMPLATE_FILES}from"./web-template.js";import{basename,join,resolve}from"node:path";import{mkdir,readdir,stat}from"node:fs/promises";const CURRENT_DIRECTORY_PROJECT_NAME=`.`,ALLOWED_CREATE_IN_PLACE_ENTRIES=new Set([`.DS_Store`,`.git`,`.gitkeep`,`.hg`]),DEFAULT_AI_PACKAGE_VERSION=`^7.0.26`,DEFAULT_CONNECT_PACKAGE_VERSION=`0.4.0`,DEFAULT_ZOD_PACKAGE_VERSION=`4.4.3`,DEFAULT_EVE_PACKAGE_CONTRACT={version:`0.26.2`,nodeEngine:`>=24`};function resolveEvePackageContract(e=DEFAULT_EVE_PACKAGE_CONTRACT){return{version:resolveVersionToken(`evePackage.version`,e.version),nodeEngine:resolveVersionToken(`evePackage.nodeEngine`,e.nodeEngine)}}function modelProviderSlug(e){let t=(e.split(`/`)[0]??``).replaceAll(/[^A-Za-z0-9._-]/gu,``);return t.length>0?t:`anthropic`}function byokProviderEnvVar(e){let t=modelProviderSlug(e).toUpperCase().replaceAll(/[^A-Z0-9]/gu,`_`);return`${/^[0-9]/.test(t)?`_`:``}${t}_API_KEY`}function agentTemplateFiles(e){return{"agent/agent.ts":BASE_AGENT_TEMPLATE.replaceAll(`__EVE_INIT_MODEL__`,e),"agent/channels/eve.ts":WEB_APP_TEMPLATE_FILES[`agent/channels/eve.ts`],"agent/instructions.md":AGENT_INSTRUCTIONS_TEMPLATE}}function renderTemplate(e,t){return e.replaceAll(`__EVE_INIT_APP_NAME__`,t.appName).replaceAll(`__EVE_INIT_MODEL__`,t.model).replaceAll(`__EVE_INIT_BYOK_PROVIDER__`,modelProviderSlug(t.model)).replaceAll(`__EVE_INIT_BYOK_ENV_VAR__`,byokProviderEnvVar(t.model)).replaceAll(`__EVE_INIT_PACKAGE_VERSION__`,formatEveDependencySpecifier(t.eveVersion)).replaceAll(`__EVE_INIT_AI_SDK_VERSION__`,t.aiPackageVersion).replaceAll(`__EVE_INIT_CONNECT_VERSION__`,t.connectPackageVersion).replaceAll(`__EVE_INIT_ZOD_VERSION__`,t.zodPackageVersion).replaceAll(`__EVE_INIT_TYPESCRIPT_VERSION__`,t.typescriptPackageVersion).replaceAll(`__EVE_INIT_TYPES_NODE_VERSION__`,t.nodeTypesVersion).replaceAll(`__EVE_INIT_NODE_ENGINE__`,t.nodeEngine)}function formatEveDependencySpecifier(e){return/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/.test(e)?`^${e}`:e}const BASE_AGENT_TEMPLATE=`import { defineAgent } from "eve";
|
|
2
2
|
|
|
3
3
|
export default defineAgent({
|
|
4
4
|
model: "__EVE_INIT_MODEL__",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toErrorMessage}from"#shared/errors.js";import{createGateway}from"ai";function isGatewayAuthRejection(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`authentication_error`||t.name===`GatewayAuthenticationError`||t.statusCode===401}async function validateGatewayApiKey(
|
|
1
|
+
import{toErrorMessage}from"#shared/errors.js";import{vercelGatewayFetch}from"#internal/gateway.js";import{createGateway}from"ai";function isGatewayAuthRejection(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`authentication_error`||t.name===`GatewayAuthenticationError`||t.statusCode===401}async function validateGatewayApiKey(r,i){let a=AbortSignal.timeout(1e4),o=i===void 0?a:AbortSignal.any([i,a]);try{return await createGateway({apiKey:r,fetch:(e,n)=>vercelGatewayFetch(e,{...n,signal:o})}).getCredits(),{kind:`valid`}}catch(t){if(i?.aborted===!0)throw t;return isGatewayAuthRejection(t)?{kind:`invalid`,message:`The AI Gateway rejected this key.`}:{kind:`inconclusive`,message:toErrorMessage(t)}}}export{validateGatewayApiKey};
|
package/dist/src/svelte/index.js
CHANGED
package/dist/src/vue/index.js
CHANGED
|
@@ -19,7 +19,7 @@ React, Vue, and Svelte apps reach for [`useEveAgent()`](../guides/frontend/overv
|
|
|
19
19
|
## Start a session
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
curl -X POST http://127.0.0.1:
|
|
22
|
+
curl -X POST http://127.0.0.1:2000/eve/v1/session \
|
|
23
23
|
-H 'content-type: application/json' \
|
|
24
24
|
-d '{"message":"Summarize the latest forecast."}'
|
|
25
25
|
```
|
|
@@ -29,7 +29,7 @@ eve responds right away. The JSON body carries a `sessionId` and a `continuation
|
|
|
29
29
|
## Stream a session
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
curl http://127.0.0.1:
|
|
32
|
+
curl http://127.0.0.1:2000/eve/v1/session/<sessionId>/stream
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
The stream is newline-delimited JSON (NDJSON), one event per line:
|
|
@@ -78,7 +78,7 @@ A delegated subagent publishes progress on its own child-session stream. The par
|
|
|
78
78
|
Once the session is waiting (you'll see `session.waiting`), POST your follow-up to the session endpoint with `event.data.continuationToken`:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
curl -X POST http://127.0.0.1:
|
|
81
|
+
curl -X POST http://127.0.0.1:2000/eve/v1/session/<sessionId> \
|
|
82
82
|
-H 'content-type: application/json' \
|
|
83
83
|
-d '{"continuationToken":"<token>","message":"Now send the short version."}'
|
|
84
84
|
```
|
|
@@ -100,7 +100,7 @@ For deterministic ordering, send one follow-up at a time and wait for the next `
|
|
|
100
100
|
POST to the session's cancel endpoint to stop the turn that is currently running. The body is optional; pass `turnId` (stamped on every turn-scoped stream event) to scope the cancel to the turn you observed:
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
|
-
curl -X POST http://127.0.0.1:
|
|
103
|
+
curl -X POST http://127.0.0.1:2000/eve/v1/session/<sessionId>/cancel
|
|
104
104
|
# {"ok":true,"sessionId":"<sessionId>","status":"accepted"}
|
|
105
105
|
```
|
|
106
106
|
|
|
@@ -113,13 +113,13 @@ Custom channel routes request the same cancellation without knowing the session
|
|
|
113
113
|
The stream is durable. Every event is recorded before a step completes, so consumers can reconnect from their cursor when an HTTP connection ends. A nonnegative `startIndex` is an absolute event count: use it to pick up where you dropped off or pass `0` to rewind to the start.
|
|
114
114
|
|
|
115
115
|
```bash
|
|
116
|
-
curl "http://127.0.0.1:
|
|
116
|
+
curl "http://127.0.0.1:2000/eve/v1/session/<sessionId>/stream?startIndex=<count>"
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
A negative `startIndex` reads relative to the stream's current tail. For example, `-1` reads the latest event, which is normally `session.waiting` for a resumable session:
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
|
-
curl "http://127.0.0.1:
|
|
122
|
+
curl "http://127.0.0.1:2000/eve/v1/session/<sessionId>/stream?startIndex=-1"
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
This gives a consumer that only persisted `sessionId` a lightweight way to recover the current `continuationToken`. Because a tail-relative position does not resolve to an absolute consumed-event count, client tail reads do not automatically reconnect or advance the stored cursor.
|
|
@@ -135,7 +135,7 @@ Start with the [TypeScript SDK](../guides/client/overview) guide. It covers basi
|
|
|
135
135
|
`GET /eve/v1/info` returns a JSON inspection snapshot for the running agent: model, instructions, authored and framework tools, skills, channels, schedules, subagents, sandbox, connections, hooks, workflow, and workspace metadata. It uses the resolved `eveChannel()` route auth when `agent/channels/eve.ts` authors one; otherwise it falls back to the framework default of Vercel OIDC plus local development access.
|
|
136
136
|
|
|
137
137
|
```bash
|
|
138
|
-
curl http://127.0.0.1:
|
|
138
|
+
curl http://127.0.0.1:2000/eve/v1/info
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
With the default auth chain (`[vercelOidc(), localDev()]`), a local Vercel OIDC bearer takes precedence and other local requests fall back to development access. A deployed Vercel target requires a valid OIDC bearer, with a same-project bypass for in-deployment callers. See [auth & route protection](../guides/auth-and-route-protection).
|
package/docs/reference/cli.md
CHANGED
|
@@ -147,7 +147,7 @@ Pass a bare URL and the UI connects to that server instead of booting a local on
|
|
|
147
147
|
| Flag | Type | Default | Description |
|
|
148
148
|
| ----------------------------------- | ------ | ------------------ | ----------------------------------------------------------------------------------------- |
|
|
149
149
|
| `--host <host>` | string | all interfaces | Host interface to bind |
|
|
150
|
-
| `--port <port>` | number | `$PORT`, then
|
|
150
|
+
| `--port <port>` | number | `$PORT`, then 2000 | Port to listen on |
|
|
151
151
|
| `-u, --url <url>` | string | none | Connect to an existing server URL instead of starting one |
|
|
152
152
|
| `-H, --header <header>` | string | none | Request header for a URL target, in `Name: value` form; repeat for multiple headers |
|
|
153
153
|
| `--no-ui` | flag | UI on | Start the server without an interactive UI |
|
package/docs/schedules.mdx
CHANGED
|
@@ -90,7 +90,7 @@ A handler-form session runs on the same durable runtime engine as any other sess
|
|
|
90
90
|
The dev server mounts a one-shot dispatch route that fires a schedule by name, out of band, exactly once. Since `eve dev` never runs schedules on their cron cadence, this is how you trigger one without waiting for the next production tick.
|
|
91
91
|
|
|
92
92
|
```sh
|
|
93
|
-
curl -X POST http://localhost:
|
|
93
|
+
curl -X POST http://localhost:2000/eve/v1/dev/schedules/heartbeat
|
|
94
94
|
# -> { "scheduleId": "heartbeat", "sessionIds": ["..."] }
|
|
95
95
|
```
|
|
96
96
|
|
package/docs/skills.mdx
CHANGED
|
@@ -9,7 +9,7 @@ A skill is a model-loadable procedure that follows the `SKILL.md` convention. It
|
|
|
9
9
|
|
|
10
10
|
eve scans the files under `agent/skills/` and exposes each one's description to the model alongside a framework-owned `load_skill` tool. When a request matches a skill's description (or you name the skill outright), the model calls `load_skill`, and eve appends that skill's markdown to the active turn's context.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Static skills do not require a sandbox: `load_skill` returns their instructions directly from the compiled agent. Dynamic skills and access to supporting package files require a sandbox. Builds may also prewarm sandbox templates that contain static package files. Supporting files are available under `$HOME/.agents/skills/<skill>/`, with `/workspace/skills/<skill>/` as the fallback when `$HOME` is unavailable. Sibling references inside `SKILL.md`, such as `references/checklist.md`, are relative to the directory containing that specific `SKILL.md`.
|
|
13
13
|
|
|
14
14
|
The description is a routing hint, not a label. Write it as the task that should trigger activation:
|
|
15
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
|
|
6
6
|
"keywords": [
|
|
@@ -289,9 +289,9 @@
|
|
|
289
289
|
"@ai-sdk/otel": "^1.0.26",
|
|
290
290
|
"@ai-sdk/provider": "^4.0.3",
|
|
291
291
|
"@ai-sdk/provider-utils": "^5.0.9",
|
|
292
|
-
"@chat-adapter/slack": "4.
|
|
293
|
-
"@chat-adapter/state-memory": "4.
|
|
294
|
-
"@chat-adapter/twilio": "4.
|
|
292
|
+
"@chat-adapter/slack": "4.34.0",
|
|
293
|
+
"@chat-adapter/state-memory": "4.34.0",
|
|
294
|
+
"@chat-adapter/twilio": "4.34.0",
|
|
295
295
|
"@clack/core": "1.3.1",
|
|
296
296
|
"@nuxt/kit": "^4.0.0",
|
|
297
297
|
"@standard-schema/spec": "1.1.0",
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
"@workflow/world-vercel": "5.0.0-beta.31",
|
|
313
313
|
"ai": "^7.0.26",
|
|
314
314
|
"autoevals": "0.0.132",
|
|
315
|
-
"chat": "4.
|
|
315
|
+
"chat": "4.34.0",
|
|
316
316
|
"chokidar": "5.0.0",
|
|
317
317
|
"commander": "14.0.3",
|
|
318
318
|
"emulate": "0.6.0",
|
|
@@ -323,6 +323,7 @@
|
|
|
323
323
|
"jose": "6.2.3",
|
|
324
324
|
"jsonc-parser": "3.3.1",
|
|
325
325
|
"just-bash": "3.0.1",
|
|
326
|
+
"marked": "17.0.6",
|
|
326
327
|
"microsandbox": "0.5.5",
|
|
327
328
|
"next": "16.3.0-preview.6",
|
|
328
329
|
"picocolors": "1.1.1",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function eveSandboxUserAgentToken(): string;
|
|
2
|
-
/**
|
|
3
|
-
* Wraps a `fetch` implementation so every request's `user-agent` ends with the
|
|
4
|
-
* {@link eveSandboxUserAgentToken} (e.g.: eve/0.18.1).
|
|
5
|
-
*/
|
|
6
|
-
export declare function withEveSandboxUserAgent(inner?: typeof globalThis.fetch): typeof globalThis.fetch;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{resolveInstalledPackageInfo}from"#internal/application/package.js";function eveSandboxUserAgentToken(){let{name:t,version:n}=resolveInstalledPackageInfo();return`${t}/${n}`}function withEveSandboxUserAgent(e=globalThis.fetch){let t=eveSandboxUserAgentToken();return(n,r)=>{let i=new Headers(r?.headers??(typeof n==`object`&&n&&`headers`in n?n.headers:void 0)),a=i.get(`user-agent`);return i.set(`user-agent`,a?`${a} ${t}`:t),e(n,{...r,headers:i})}}export{eveSandboxUserAgentToken,withEveSandboxUserAgent};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ContextContainer } from "#context/container.js";
|
|
2
|
-
import type { RuntimeTurnAgent } from "#runtime/agent/bootstrap.js";
|
|
3
|
-
export declare function resolveSessionSkillRoot(input: {
|
|
4
|
-
readonly ctx: ContextContainer;
|
|
5
|
-
readonly turnAgent: RuntimeTurnAgent;
|
|
6
|
-
}): Promise<string | undefined>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{SandboxKey}from"#context/keys.js";import{resolveSandboxSkillRoot}from"#shared/skill-paths.js";async function resolveSessionSkillRoot(e){if((e.turnAgent.availableSkills?.length??0)===0)return;let t=e.ctx.get(SandboxKey);if(t===void 0)return;let n=await t.get();if(n!==null)return await resolveSandboxSkillRoot({sandbox:n})}export{resolveSessionSkillRoot};
|