eve 0.54.0 → 0.54.3
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 +26 -0
- package/dist/src/chunks/{use-eve-agent-BR8EpIOX.js → use-eve-agent-CxPlg0KL.js} +0 -1
- package/dist/src/chunks/{use-eve-agent-XnfjQt1Z.js → use-eve-agent-D-KQzzyW.js} +0 -1
- package/dist/src/cli/dev/tui/setup-commands.js +1 -1
- package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-content.d.ts +1 -3
- package/dist/src/cli/dev/tui/traces/trace-content.js +2 -2
- package/dist/src/cli/dev/tui/traces/trace-conversation.js +1 -1
- package/dist/src/cli/dev/tui/traces/trace-view.js +1 -1
- package/dist/src/client/agent-info-schema.d.ts +0 -1
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +3 -1
- package/dist/src/compiled/just-secrets/LICENSE +21 -0
- package/dist/src/compiled/just-secrets/index.d.ts +20 -0
- package/dist/src/compiled/just-secrets/index.js +2 -0
- package/dist/src/compiled/just-secrets/windows.ps1 +138 -0
- package/dist/src/compiler/default-tool-policy.js +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +6 -6
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-manifest-helpers.d.ts +2 -1
- package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/resolve-workspace-subagent.d.ts +13 -0
- package/dist/src/compiler/resolve-workspace-subagent.js +1 -0
- package/dist/src/context/memory-event-lifecycle.d.ts +2 -0
- package/dist/src/context/memory-event-lifecycle.js +1 -1
- package/dist/src/context/memory-lifecycle.d.ts +5 -0
- package/dist/src/context/memory-lifecycle.js +1 -1
- package/dist/src/execution/coordination-dispatch-step.js +1 -1
- package/dist/src/execution/create-session-step.js +1 -1
- package/dist/src/execution/durable-session-migrations/snapshot.d.ts +0 -16
- package/dist/src/execution/durable-session-migrations/snapshot.js +1 -1
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/session.d.ts +0 -2
- package/dist/src/execution/session.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.d.ts +1 -12
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/execution/tools/sleep-workflow.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-agent.d.ts +1 -2
- package/dist/src/execution/tools/subagent/invoke-agent.js +1 -1
- package/dist/src/execution/tools/tasks.d.ts +1 -8
- package/dist/src/execution/tools/tasks.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/framework/sources/registry.js +1 -1
- package/dist/src/harness/compaction.js +1 -1
- package/dist/src/harness/coordination.js +1 -1
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/execute-tool.d.ts +2 -4
- package/dist/src/harness/messages.d.ts +1 -1
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/model-call-error.d.ts +5 -0
- package/dist/src/harness/model-call-error.js +1 -1
- package/dist/src/harness/semantic-errors/rules/model-provider.js +1 -1
- package/dist/src/harness/step-hooks.d.ts +17 -10
- package/dist/src/harness/step-hooks.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/instrumentation/content.js +1 -1
- package/dist/src/instrumentation/dispatch.js +1 -1
- package/dist/src/instrumentation/lifecycle.d.ts +7 -3
- package/dist/src/instrumentation/memory.d.ts +72 -0
- package/dist/src/instrumentation/memory.js +1 -0
- package/dist/src/instrumentation/native-events.js +1 -1
- package/dist/src/instrumentation/provider.d.ts +1 -0
- package/dist/src/instrumentation/runtime.d.ts +3 -0
- package/dist/src/instrumentation/runtime.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/nitro/routes/index.d.ts +6 -0
- package/dist/src/internal/nitro/routes/index.js +7 -7
- package/dist/src/internal/vercel/assemble-eve-services.js +1 -1
- package/dist/src/internal/vercel/build-agent-workspace.js +1 -1
- package/dist/src/internal/vercel/build-multi-agent-landing-page.d.ts +3 -0
- package/dist/src/internal/vercel/build-multi-agent-landing-page.js +1 -0
- package/dist/src/internal/vercel/eve-service-contribution.d.ts +4 -0
- package/dist/src/internal/vercel/eve-service-contribution.js +1 -1
- package/dist/src/public/definitions/workspace-agent.d.ts +25 -0
- package/dist/src/public/definitions/workspace-agent.js +1 -0
- package/dist/src/public/index.d.ts +1 -0
- package/dist/src/public/index.js +1 -1
- package/dist/src/public/models/openai/chatgpt/credential-store.d.ts +22 -4
- package/dist/src/public/models/openai/chatgpt/credential-store.js +1 -1
- package/dist/src/public/models/openai/chatgpt/oauth.d.ts +6 -4
- package/dist/src/public/models/openai/chatgpt/token-broker.js +1 -1
- package/dist/src/setup/flows/chatgpt-auth.js +1 -1
- package/dist/src/setup/flows/model.d.ts +0 -2
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +1 -1
- package/dist/src/shared/action-types.d.ts +4 -0
- package/dist/src/shared/action-types.js +1 -1
- package/dist/src/shared/dispatch-action.d.ts +1 -1
- package/dist/src/subagents/callback-route.js +1 -1
- package/dist/src/subagents/callback-step.d.ts +0 -8
- package/dist/src/subagents/callback-step.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tasks/delivery-context.d.ts +2 -2
- package/dist/src/tasks/delivery-context.js +2 -2
- package/dist/src/tasks/session-index.d.ts +6 -3
- package/dist/src/tasks/session-index.js +1 -1
- package/dist/src/tasks/session-task-cohorts.d.ts +10 -2
- package/dist/src/tasks/session-task-cohorts.js +1 -1
- package/dist/src/tools/behavior.d.ts +1 -3
- package/dist/src/tools/framework/task-contract.d.ts +0 -4
- package/dist/src/tools/framework/task-contract.js +1 -1
- package/dist/src/tracing/agent-action-instrumentation.js +1 -1
- package/dist/src/tracing/agent-approval-instrumentation.js +1 -1
- package/dist/src/tracing/agent-channel-delivery-instrumentation.js +1 -1
- package/dist/src/tracing/agent-memory-instrumentation.d.ts +13 -0
- package/dist/src/tracing/agent-memory-instrumentation.js +1 -0
- package/dist/src/tracing/agent-otel-content.d.ts +4 -12
- package/dist/src/tracing/agent-otel-content.js +3 -3
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-span-contract.d.ts +1 -0
- package/dist/src/tracing/agent-span-contract.js +1 -1
- package/dist/src/tracing/agent-tool-instrumentation.js +1 -1
- package/dist/src/tracing/agent-trace-context-codec.js +1 -1
- package/dist/src/tracing/agent-trace-context-store.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +3 -1
- package/dist/src/tracing/content-attributes.js +1 -1
- package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/concepts/built-in-tools.md +0 -20
- package/docs/concepts/sessions-runs-and-streaming.md +9 -1
- package/docs/guides/frontend/overview.mdx +1 -1
- package/docs/guides/instrumentation.md +65 -30
- package/docs/reference/cli.md +9 -9
- package/docs/reference/typescript-api.md +7 -3
- package/docs/subagents/index.mdx +46 -10
- package/package.json +2 -6
- package/dist/src/execution/tasks/child/update-step.d.ts +0 -6
- package/dist/src/execution/tasks/child/update-step.js +0 -1
- package/dist/src/execution/tasks/child/update.d.ts +0 -8
- package/dist/src/execution/tasks/child/update.js +0 -1
- package/dist/src/public/tools/task-update.d.ts +0 -1
- package/dist/src/public/tools/task-update.js +0 -1
- package/dist/src/tools/framework/task-update.d.ts +0 -5
- package/dist/src/tools/framework/task-update.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# eve
|
|
2
2
|
|
|
3
|
+
## 0.54.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6cb22a4: Store ChatGPT refresh credentials in the OS credential store using vendored just-secrets, with access tokens kept in memory. Existing users must sign in once through eve; a successful save removes the old plaintext session file. ChatGPT sign-in now remains inside the model setup panel while browser authentication is in progress.
|
|
8
|
+
- c5bb66f: fix(eve): align internal AI SDK step lifecycle hooks with the current `onStepStart` and `onStepEnd` callback names
|
|
9
|
+
- fb6750f: Resume sessions whose history predates user-message provenance instead of failing with a missing-kind error. Existing unclassified messages retain their content and are marked `legacy.unknown`, without treating unknown framework input as a new human request after compaction.
|
|
10
|
+
- eaf8895: Add `defineWorkspaceAgent()` for delegating to a workspace peer by name. It selects Vercel routing and OIDC automatically on Vercel, accepts explicit transport overrides elsewhere, and uses the peer agent's description by default.
|
|
11
|
+
|
|
12
|
+
## 0.54.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 15e18d6: Treat recalled memory records as model input content when applying instrumentation trace policies.
|
|
17
|
+
- 47b7a38: Emit OpenTelemetry GenAI `invoke_workflow` spans when a `defineWorkflowTool` run coordinates nested agents, using the path-derived tool name as `gen_ai.workflow.name`. Durable workflow tools without agent operations remain ordinary actions.
|
|
18
|
+
|
|
19
|
+
## 0.54.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- ee11c23: Record model input once using the OpenTelemetry `gen_ai.input.messages` schema. Local traces no longer serialize the duplicate `ai.prompt.messages` payload, avoiding binary attachment traversal.
|
|
24
|
+
- b27e9f2: Remove the `task_update` tool and its child-to-parent progress callbacks; use the child session's stream to follow progress. Successful results from overlapping background tasks now reach the parent together across launch turns, after child settlement updates usage and handles; user input, failures, and cancellation remain responsive.
|
|
25
|
+
- b27e9f2: Report content-filtered model responses distinctly, including their finish reason and Gateway generation ID when available, instead of retrying them as empty responses. Filtered partial text is no longer delivered as a completed reply.
|
|
26
|
+
- 0e2912f: Add OpenTelemetry GenAI spans for memory provider recall and capture operations.
|
|
27
|
+
- b27e9f2: Fix `eve dev` silently stopping session updates during long periods of background work. The terminal now keeps listening while the prompt is open, so completion reports appear without another user message.
|
|
28
|
+
|
|
3
29
|
## 0.54.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{formatRegistrySessionResult,registryItemProgress,registryResultTone}from"./registry-result-message.js";import{createTuiPrompter}from"./tui-prompter.js";import{runDeployFlow}from"#setup/flows/deploy.js";import{WizardCancelledError}from"#setup/step.js";import{runLoginFlow}from"#setup/flows/login.js";import{HumanActionRequiredError}from"#setup/human-action.js";import{runInstallVercelCliFlow}from"#setup/flows/install-vercel-cli.js";import{runModelFlow}from"#setup/flows/model.js";import{runProviderFlow}from"#setup/flows/provider.js";import{RegistryFlowFailedError,runRegistryFlow}from"#setup/flows/registry.js";const SETUP_FLOW_CONFIG={"vc:install":{title:`Install the Vercel CLI`,indicator:`pulse`},"vc:login":{title:`Log in to Vercel`,indicator:`pulse`},model:{title:`Configure the agent model`,indicator:`pulse`},add:{title:`Add to your agent`,indicator:`pulse`},deploy:{title:`Deploy to Vercel`,indicator:`spinner`}};function muteableRenderer(e,t,n){return{readSelect:n=>t()?Promise.resolve(void 0):e.readSelect(n),readEditableSelect:n=>t()?Promise.resolve(void 0):e.readEditableSelect(n),readProviderPicker:n=>t()?Promise.resolve(void 0):e.readProviderPicker(n),readModelEditor:n=>t()?Promise.resolve(void 0):e.readModelEditor(n),readText:n=>t()?Promise.resolve(void 0):e.readText(n),readAcknowledge:n=>t()?Promise.resolve():e.readAcknowledge(n),readChoice:n=>t()?{choice:Promise.resolve(void 0),close:()=>{}}:e.readChoice(n),setNavigation:n=>{t()||e.setNavigation?.(n)},setStatus:n=>{t()||e.setStatus(n)},renderLine:(n,r)=>{(!t()||r===`warning`||r===`error`)&&e.renderLine(n,r)},replaceContent:n=>{t()||e.replaceContent?.(n)},renderOutput:n=>{t()||e.renderOutput(n)},withInheritedStdio:t=>e.withInheritedStdio(t),withExclusiveTerminal:e=>n?.(e)??e()}}async function runTuiSetupCommand(e){let{command:t}=e,n=!1,r=new AbortController,i=muteableRenderer(e.renderer,()=>n,e.withExclusiveTerminal),a=(e.createPrompter??createTuiPrompter)(i),cancelActiveRegistryItem,runRegistryItem=async e=>{let t=new AbortController;cancelActiveRegistryItem=()=>t.abort(new WizardCancelledError);try{return await e(AbortSignal.any([r.signal,t.signal]))}finally{cancelActiveRegistryItem=void 0}},o=e.renderer.waitForInterrupt(),s=executeSetupCommand(e,a,i,r.signal,runRegistryItem),c=s.then(e=>({kind:`outcome`,value:e}));try{for(;;){let i=!1;try{let e=await Promise.race([c,o.promise.then(e=>({kind:`interrupt`,interrupt:e}))]);if(e.kind===`outcome`)return e.value;if(t===`add`&&e.interrupt===`escape`&&cancelActiveRegistryItem!==void 0)cancelActiveRegistryItem(),i=!0;else{n=!0,r.abort(new WizardCancelledError);let e=await s;return e.partial===!0?e:{...e,message:`/${t} interrupted.`,tone:`error`,preserveFlowDiagnostics:!0}}}finally{o.dispose()}i&&(o=e.renderer.waitForInterrupt())}}finally{e.renderer.setStatus(void 0)}}async function executeSetupCommand(e,t,n,r,i){let{command:a,appRoot:o}=e,s={runInstallVercelCliFlow,runLoginFlow,runModelFlow,runRegistryFlow,runDeployFlow,...e.flows};try{switch(a){case`vc:install`:return installVercelCliResultMessage(await s.runInstallVercelCliFlow({appRoot:o,prompter:t,signal:r}));case`vc:login`:return loginResultMessage(await s.runLoginFlow({appRoot:o,prompter:t,signal:r}));case`model`:{let pickProvider=e=>n.readProviderPicker(e),i={appRoot:e.agentRoot??o,environmentRoot:o,prompter:t,signal:r,chatGptAccountLabel:e.chatGptAccountLabel,deps:{pickModelSettings:e=>n.readModelEditor(e),runProviderFlow:e=>runProviderFlow({...e,picker:pickProvider,recoverHumanAction:e=>recoverVercelHumanAction(e,s,{appRoot:o,prompter:t,signal:r})})}};e.initialModelStep!==void 0&&(i.initialStep=e.initialModelStep),e.onOnboardingScreen!==void 0&&(i.onScreen=t=>e.onOnboardingScreen?.({screen:t}))
|
|
1
|
+
import{formatRegistrySessionResult,registryItemProgress,registryResultTone}from"./registry-result-message.js";import{createTuiPrompter}from"./tui-prompter.js";import{runDeployFlow}from"#setup/flows/deploy.js";import{WizardCancelledError}from"#setup/step.js";import{runLoginFlow}from"#setup/flows/login.js";import{HumanActionRequiredError}from"#setup/human-action.js";import{runInstallVercelCliFlow}from"#setup/flows/install-vercel-cli.js";import{runModelFlow}from"#setup/flows/model.js";import{runProviderFlow}from"#setup/flows/provider.js";import{RegistryFlowFailedError,runRegistryFlow}from"#setup/flows/registry.js";const SETUP_FLOW_CONFIG={"vc:install":{title:`Install the Vercel CLI`,indicator:`pulse`},"vc:login":{title:`Log in to Vercel`,indicator:`pulse`},model:{title:`Configure the agent model`,indicator:`pulse`},add:{title:`Add to your agent`,indicator:`pulse`},deploy:{title:`Deploy to Vercel`,indicator:`spinner`}};function muteableRenderer(e,t,n){return{readSelect:n=>t()?Promise.resolve(void 0):e.readSelect(n),readEditableSelect:n=>t()?Promise.resolve(void 0):e.readEditableSelect(n),readProviderPicker:n=>t()?Promise.resolve(void 0):e.readProviderPicker(n),readModelEditor:n=>t()?Promise.resolve(void 0):e.readModelEditor(n),readText:n=>t()?Promise.resolve(void 0):e.readText(n),readAcknowledge:n=>t()?Promise.resolve():e.readAcknowledge(n),readChoice:n=>t()?{choice:Promise.resolve(void 0),close:()=>{}}:e.readChoice(n),setNavigation:n=>{t()||e.setNavigation?.(n)},setStatus:n=>{t()||e.setStatus(n)},renderLine:(n,r)=>{(!t()||r===`warning`||r===`error`)&&e.renderLine(n,r)},replaceContent:n=>{t()||e.replaceContent?.(n)},renderOutput:n=>{t()||e.renderOutput(n)},withInheritedStdio:t=>e.withInheritedStdio(t),withExclusiveTerminal:e=>n?.(e)??e()}}async function runTuiSetupCommand(e){let{command:t}=e,n=!1,r=new AbortController,i=muteableRenderer(e.renderer,()=>n,e.withExclusiveTerminal),a=(e.createPrompter??createTuiPrompter)(i),cancelActiveRegistryItem,runRegistryItem=async e=>{let t=new AbortController;cancelActiveRegistryItem=()=>t.abort(new WizardCancelledError);try{return await e(AbortSignal.any([r.signal,t.signal]))}finally{cancelActiveRegistryItem=void 0}},o=e.renderer.waitForInterrupt(),s=executeSetupCommand(e,a,i,r.signal,runRegistryItem),c=s.then(e=>({kind:`outcome`,value:e}));try{for(;;){let i=!1;try{let e=await Promise.race([c,o.promise.then(e=>({kind:`interrupt`,interrupt:e}))]);if(e.kind===`outcome`)return e.value;if(t===`add`&&e.interrupt===`escape`&&cancelActiveRegistryItem!==void 0)cancelActiveRegistryItem(),i=!0;else{n=!0,r.abort(new WizardCancelledError);let e=await s;return e.partial===!0?e:{...e,message:`/${t} interrupted.`,tone:`error`,preserveFlowDiagnostics:!0}}}finally{o.dispose()}i&&(o=e.renderer.waitForInterrupt())}}finally{e.renderer.setStatus(void 0)}}async function executeSetupCommand(e,t,n,r,i){let{command:a,appRoot:o}=e,s={runInstallVercelCliFlow,runLoginFlow,runModelFlow,runRegistryFlow,runDeployFlow,...e.flows};try{switch(a){case`vc:install`:return installVercelCliResultMessage(await s.runInstallVercelCliFlow({appRoot:o,prompter:t,signal:r}));case`vc:login`:return loginResultMessage(await s.runLoginFlow({appRoot:o,prompter:t,signal:r}));case`model`:{let pickProvider=e=>n.readProviderPicker(e),i={appRoot:e.agentRoot??o,environmentRoot:o,prompter:t,signal:r,chatGptAccountLabel:e.chatGptAccountLabel,deps:{pickModelSettings:e=>n.readModelEditor(e),runProviderFlow:e=>runProviderFlow({...e,picker:pickProvider,recoverHumanAction:e=>recoverVercelHumanAction(e,s,{appRoot:o,prompter:t,signal:r})})}};e.initialModelStep!==void 0&&(i.initialStep=e.initialModelStep),e.onOnboardingScreen!==void 0&&(i.onScreen=t=>e.onOnboardingScreen?.({screen:t}));let a=await s.runModelFlow(i);if(a.kind===`cancelled`)return{message:a.discardedDraft===!0?`/model dismissed. Drafted changes were discarded; Done commits them.`:`/model dismissed.`,cancelled:!0,preserveFlowDiagnostics:!1};let c=[];a.modelMessage!==void 0&&c.push(a.modelMessage),a.providerSelection!==void 0&&c.push(providerSelectionMessage(a.providerSelection));let l={message:c.join(`
|
|
2
2
|
`),preserveFlowDiagnostics:!1};return a.accessChanged&&(l.effect={kind:`model-access-changed`}),l}case`add`:{let a=await s.runRegistryFlow({appRoot:o,prompter:t,signal:r,initialAddress:e.initialRegistryAddress,plannerContext:e.registryPlannerContext,onScreen:e.onOnboardingScreen,onItemStart:registryItemProgress(n),runItem:i});if(a.kind===`cancelled`)return{message:`/add dismissed.`,cancelled:!0,preserveFlowDiagnostics:!0};let c=a.result,l=registryResultTone(c),u=c.items.length>0||c.failures.length>0||c.outcomes!==void 0?formatRegistrySessionResult(c):`No integrations selected.`,d={message:l===`error`?`/add failed — ${u}`:u,preserveFlowDiagnostics:!0};return c.cancelled===!0?(d.partial=!0,d.tone=`error`):l!==void 0&&(d.tone=l),c.deployed===`production`&&(d.effect={kind:`deployed`}),d}case`deploy`:{let e=await s.runDeployFlow({appRoot:o,prompter:t,interactive:!0,signal:r});return e.kind===`cancelled`?{message:`/deploy dismissed.`,preserveFlowDiagnostics:!0}:e.kind===`needs-link`?{message:`Not linked to a Vercel project — run /model to connect one first.`,preserveFlowDiagnostics:!0}:e.kind===`local-model`?{message:`ChatGPT subscription models are local-only. Switch to an AI Gateway or server-authenticated model before deploying.`,preserveFlowDiagnostics:!0}:{message:e.productionUrl===void 0?`Deployed.`:`Deployed: ${e.productionUrl}`,preserveFlowDiagnostics:!0,effect:{kind:`deployed`}}}}}catch(e){if(e instanceof WizardCancelledError)return{message:`/${a} dismissed.`,cancelled:!0,preserveFlowDiagnostics:a!==`model`};let n=e instanceof RegistryFlowFailedError?e.cause:e,i=await vercelCliUpgradeOutcome(n,a,s,{appRoot:o,prompter:t,signal:r});if(i!==void 0)return withRegistryResults(i,e);let c=vercelActionOutcome(n,a);return c===void 0?e instanceof RegistryFlowFailedError?{message:`${formatRegistrySessionResult(e.completed)}\n\n${e.message}`,partial:!0,tone:`error`,preserveFlowDiagnostics:!0}:{message:`/${a} failed: ${e instanceof Error?e.message:String(e)}`,tone:`error`,preserveFlowDiagnostics:!0}:withRegistryResults(c,e)}}async function recoverVercelHumanAction(e,t,n){let r=e.action.kind;if(r!==`vercel-cli-missing`&&r!==`vercel-cli-upgrade`&&r!==`vercel-login`&&r!==`vercel-forbidden`)throw e;let i=r===`vercel-cli-missing`?{label:`Install Vercel CLI`,message:`The Vercel CLI is required. Install it now?`}:r===`vercel-cli-upgrade`?{label:`Upgrade Vercel CLI`,message:`Your Vercel CLI needs an update. Upgrade it now?`}:{label:r===`vercel-forbidden`?`Re-authenticate with Vercel`:`Log in to Vercel`,message:r===`vercel-forbidden`?`Vercel denied access to that team. Re-authenticate and continue?`:`You need to log in to Vercel to continue.`},a;try{a=await n.prompter.select({message:i.message,options:[{value:`repair`,label:`${i.label} and continue`},{value:`cancel`,label:`Choose another option`}],initialValue:`repair`})}catch{return`cancel`}if(a===`cancel`)return`cancel`;if(r===`vercel-cli-missing`||r===`vercel-cli-upgrade`){let e=await t.runInstallVercelCliFlow({appRoot:n.appRoot,prompter:n.prompter,signal:n.signal,upgrade:r===`vercel-cli-upgrade`});return e.kind===`installed`||e.kind===`already`?`retry`:(n.prompter.log.warning(e.kind===`failed`&&e.reason!==void 0?`Couldn't ${r===`vercel-cli-upgrade`?`upgrade`:`install`} the Vercel CLI: ${e.reason}`:`Couldn't ${r===`vercel-cli-upgrade`?`upgrade`:`install`} the Vercel CLI.`),`cancel`)}let o=await t.runLoginFlow({appRoot:n.appRoot,prompter:n.prompter,signal:n.signal,force:r===`vercel-forbidden`});return n.prompter.replaceContent?.(),o.kind===`logged-in`||o.kind===`already`?`retry`:`cancel`}function withRegistryResults(e,t){return t instanceof RegistryFlowFailedError?{...e,message:`${formatRegistrySessionResult(t.completed)}\n\n${e.message}`,partial:!0,tone:`error`,preserveFlowDiagnostics:!0}:e}async function vercelCliUpgradeOutcome(e,t,n,r){if(!(e instanceof HumanActionRequiredError)||e.action.kind!==`vercel-cli-upgrade`)return;let i;try{i=await r.prompter.select({message:`Your Vercel CLI needs an update to list your teams. Upgrade now?`,options:[{value:`upgrade`,label:`Upgrade Vercel CLI`,description:`Run the Vercel CLI's native upgrader`},{value:`later`,label:`Not now`}],initialValue:`upgrade`})}catch{i=`later`}if(i===`later`)return{message:`The Vercel CLI needs an update — run \`vercel upgrade\`, then retry /${t}.`,tone:`error`,preserveFlowDiagnostics:!0};let a;try{a=await n.runInstallVercelCliFlow({appRoot:r.appRoot,prompter:r.prompter,signal:r.signal,upgrade:!0})}catch(e){return{message:vercelCliUpgradeFailureMessage(t,errorMessage(e)),tone:`error`,preserveFlowDiagnostics:!0}}switch(a.kind){case`installed`:return{message:`Upgraded the Vercel CLI. Retry /${t}.`,tone:`error`,preserveFlowDiagnostics:!1};case`failed`:return{message:vercelCliUpgradeFailureMessage(t,a.reason),tone:`error`,preserveFlowDiagnostics:!0};case`cancelled`:return{message:`Vercel CLI upgrade cancelled — run \`vercel upgrade\`, then retry /${t}.`,tone:`error`,preserveFlowDiagnostics:!0};case`already`:return{message:`The Vercel CLI is already up to date. Retry /${t}.`,tone:`error`,preserveFlowDiagnostics:!1}}}function errorMessage(e){let t=(e instanceof Error?e.message:String(e)).replace(/\s+/gu,` `).trim();return t.length<=240?t:`${t.slice(0,239)}…`}function vercelCliUpgradeFailureMessage(e,t){return`Couldn't upgrade the Vercel CLI${t===void 0||t===``?``:` (${t})`} — run \`vercel upgrade\`, then retry /${e}.`}function vercelActionOutcome(e,t){if(!(e instanceof HumanActionRequiredError))return;let n=vercelActionMessage(e.action.kind,t);return n===void 0?void 0:{message:n,tone:`error`,preserveFlowDiagnostics:!0}}function vercelActionMessage(e,t){switch(e){case`vercel-login`:return`You're not logged in to Vercel — run /vc:login, then retry /${t}.`;case`vercel-forbidden`:return`Vercel denied access to that team — run /vc:login to re-authenticate (for example to complete SSO), or pick a team you can access, then retry /${t}.`;case`vercel-cli-missing`:return`The Vercel CLI isn't installed — run /vc:install to install it, then retry /${t}.`;case`vercel-cli-upgrade`:return`The Vercel CLI needs an update — run \`vercel upgrade\`, then retry /${t}.`;default:return}}function installVercelCliResultMessage(e){switch(e.kind){case`cancelled`:return{message:`/vc:install dismissed.`,preserveFlowDiagnostics:!1};case`already`:return{message:`The Vercel CLI is already installed.`,preserveFlowDiagnostics:!1};case`failed`:return{message:"Couldn't install the Vercel CLI — install it manually with `npm i -g vercel@latest`.",preserveFlowDiagnostics:!0};case`installed`:return{message:`Installed the Vercel CLI. Run /vc:login next.`,preserveFlowDiagnostics:!1,effect:{kind:`refresh-identity`}}}}function loginResultMessage(e){switch(e.kind){case`cancelled`:return{message:`/vc:login dismissed.`,preserveFlowDiagnostics:!1};case`already`:return{message:`You're already logged in to Vercel.`,preserveFlowDiagnostics:!1};case`cli-missing`:return{message:`The Vercel CLI isn't installed — run /vc:install to install it, then retry /vc:login.`,preserveFlowDiagnostics:!0};case`failed`:return{message:`Vercel login didn't complete — run /vc:login to try again.`,preserveFlowDiagnostics:!0};case`logged-in`:return{message:`Logged in to Vercel.`,preserveFlowDiagnostics:!1,effect:{kind:`refresh-identity`}};case`unavailable`:return{message:`Couldn't reach Vercel — check your connection, then retry /vc:login.`,preserveFlowDiagnostics:!0}}}function providerSelectionMessage(e){return e===`chatgpt`?`ChatGPT subscription selected.`:e===`ai-gateway-project`?`AI Gateway via Project selected.`:`AI Gateway via API key selected.`}export{SETUP_FLOW_CONFIG,runTuiSetupCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{summarizeToolArgs,summarizeToolResult}from"./tool-format.js";import{diffWriteDetail}from"./line-diff.js";import{stripTerminalControls}from"#cli/ui/terminal-text.js";const WRITE_FILE_VERB=`Write`,DELEGATE_VERB=`Delegate`,FINAL_OUTPUT_TITLE=`Return final output`,BUILTIN_TOOL_COPY={agent:{verb:`Delegate`,pastVerb:`Delegated`,argKey:`message`,singularNoun:`task`,pluralNoun:`tasks`},ask_question:{verb:`Ask`,pastVerb:`Asked`,argKey:`prompt`,singularNoun:`question`,pluralNoun:`questions`},bash:{verb:`Run`,pastVerb:`Ran`,argKey:`command`,singularNoun:`command`,pluralNoun:`commands`},connection_search:{verb:`Discover`,pastVerb:`Discovered`,argKey:`keywords`,singularNoun:`tool search`,pluralNoun:`tool searches`},glob:{verb:`Glob`,pastVerb:`Globbed`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},grep:{verb:`Grep`,pastVerb:`Grepped`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},load_skill:{verb:`Load`,pastVerb:`Loaded`,argKey:`skill`,singularNoun:`skill`,pluralNoun:`skills`},read_file:{verb:`Read`,pastVerb:`Read`,argKey:`filePath`,singularNoun:`file`,pluralNoun:`files`},task_cancel:{verb:`Cancel`,pastVerb:`Cancelled`,argKey:`taskIds`,extractItem:taskIdsArg,singularNoun:`task`,pluralNoun:`tasks`},
|
|
1
|
+
import{summarizeToolArgs,summarizeToolResult}from"./tool-format.js";import{diffWriteDetail}from"./line-diff.js";import{stripTerminalControls}from"#cli/ui/terminal-text.js";const WRITE_FILE_VERB=`Write`,DELEGATE_VERB=`Delegate`,FINAL_OUTPUT_TITLE=`Return final output`,BUILTIN_TOOL_COPY={agent:{verb:`Delegate`,pastVerb:`Delegated`,argKey:`message`,singularNoun:`task`,pluralNoun:`tasks`},ask_question:{verb:`Ask`,pastVerb:`Asked`,argKey:`prompt`,singularNoun:`question`,pluralNoun:`questions`},bash:{verb:`Run`,pastVerb:`Ran`,argKey:`command`,singularNoun:`command`,pluralNoun:`commands`},connection_search:{verb:`Discover`,pastVerb:`Discovered`,argKey:`keywords`,singularNoun:`tool search`,pluralNoun:`tool searches`},glob:{verb:`Glob`,pastVerb:`Globbed`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},grep:{verb:`Grep`,pastVerb:`Grepped`,argKey:`pattern`,singularNoun:`pattern`,pluralNoun:`patterns`},load_skill:{verb:`Load`,pastVerb:`Loaded`,argKey:`skill`,singularNoun:`skill`,pluralNoun:`skills`},read_file:{verb:`Read`,pastVerb:`Read`,argKey:`filePath`,singularNoun:`file`,pluralNoun:`files`},task_cancel:{verb:`Cancel`,pastVerb:`Cancelled`,argKey:`taskIds`,extractItem:taskIdsArg,singularNoun:`task`,pluralNoun:`tasks`},web_fetch:{verb:`Fetch`,pastVerb:`Fetched`,argKey:`url`,singularNoun:`URL`,pluralNoun:`URLs`},web_search:{verb:`Search`,pastVerb:`Searched`,argKey:`query`,extractItem:e=>salientArg(e,`objective`)??salientArg(e,`search_query`)??salientArg(e,`searchQuery`)??webSearchActionArg(e),singularNoun:`query`,pluralNoun:`queries`}};function presentWriteFileTool(e,t,n){let r=readWriteFileInput(e,t);if(r===void 0)return{title:e,subtitle:summarizeToolArgs(t),summarizeResult:summarizeToolResult};let i=diffWriteDetail(n?.previousContent,r.content,n?.existed).map(e=>e.kind===`gap`?e:{...e,text:stripTerminalControls(e.text)});return{title:`${WRITE_FILE_VERB} ${salientLine(r.path)??r.path}`,doneTitle:`Wrote ${salientLine(r.path)??r.path}`,subtitle:``,summarizeResult:()=>void 0,detail:i,keepDetailWhenDone:!0}}function readWriteFileInput(e,t){if(toolBaseName(e)!==`write_file`||typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.filePath,i=n.content;if(typeof r==`string`&&r.trim().length!==0&&typeof i==`string`)return{path:r,content:i}}function presentTool(e,t,n){let r=toolBaseName(e);if(r===`todo`)return presentTodoTool(t);if(r===`write_file`)return presentWriteFileTool(e,t,n);if(n?.isSubagent===!0)return{title:`${DELEGATE_VERB} ${r}`,doneTitle:`Delegated ${r}`,subtitle:salientArg(t,`message`)??``,summarizeResult:()=>void 0};if(r===`final_output`)return{title:FINAL_OUTPUT_TITLE,subtitle:``,summarizeResult:()=>void 0};let i=BUILTIN_TOOL_COPY[r];if(i!==void 0){let e=salientArg(t,i.argKey)??i.extractItem?.(t);if(e!==void 0)return{title:`${i.verb} ${e}`,doneTitle:`${i.pastVerb} ${e}`,subtitle:``,summarizeResult:()=>void 0,group:{verb:i.verb,pastVerb:i.pastVerb,singularNoun:i.singularNoun,pluralNoun:i.pluralNoun,item:e}}}return{title:e,subtitle:summarizeToolArgs(t),summarizeResult:summarizeToolResult}}function presentPreparingTool(e,t){let n=toolBaseName(e);if(n===`final_output`)return{title:FINAL_OUTPUT_TITLE,subtitle:``,summarizeResult:()=>void 0};if(t?.isSubagent===!0)return{title:`${DELEGATE_VERB} ${n} …`,subtitle:``,summarizeResult:()=>void 0};let r=n===`write_file`?WRITE_FILE_VERB:BUILTIN_TOOL_COPY[n]?.verb;return{title:r===void 0?e:`${r} …`,subtitle:r===void 0?`preparing…`:``,summarizeResult:()=>void 0}}function isPanelRoutedTool(e){let t=toolBaseName(e);return t===`todo`||t===`ask_question`}function toolBaseName(e){return e.split(/[.:/]/u).at(-1)??e}function presentTodoTool(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e.todos:void 0;return Array.isArray(t)?{title:`Update todo list`,subtitle:`${t.length} task${t.length===1?``:`s`}`,summarizeResult:()=>void 0}:{title:`Read todo list`,subtitle:``,summarizeResult:()=>void 0}}function webSearchActionArg(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.action;if(typeof t!=`object`||!t||Array.isArray(t))return;let n=t,r=n.queries;if(Array.isArray(r)){let e=r.filter(e=>typeof e==`string`).map(salientLine).filter(e=>e!==void 0).join(`, `);if(e.length>0)return e}for(let e of[`query`,`url`,`pattern`]){let t=n[e];if(typeof t==`string`){let e=salientLine(t);if(e!==void 0)return e}}}function taskIdsArg(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e.taskIds;if(!Array.isArray(t))return;let n=t.filter(e=>typeof e==`string`);if(n.length!==0)return salientLine(n.join(`, `))}function salientArg(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];if(typeof n==`string`)return salientLine(n)}function salientLine(e){let t=stripTerminalControls(e).split(/\r?\n/u).find(e=>e.trim().length>0)?.trim()??``;return t.length>0?t:void 0}export{isPanelRoutedTool,presentPreparingTool,presentTool,readWriteFileInput,toolBaseName};
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
* Formats span attribute values for the `/traces` detail panel. Payload
|
|
3
3
|
* attributes render as readable structure — prompt messages as a chat-like
|
|
4
4
|
* transcript with role-prefixed blocks and hanging indents, JSON as
|
|
5
|
-
* pretty-printed blocks — instead of one wrapped blob.
|
|
6
|
-
* noise was already stripped at capture time (see `agent-otel-provider.ts`),
|
|
7
|
-
* so what remains here is presentation only.
|
|
5
|
+
* pretty-printed blocks — instead of one wrapped blob.
|
|
8
6
|
*
|
|
9
7
|
* Every returned line fits the given width; wrapped continuations keep a
|
|
10
8
|
* two-space hanging indent so they read as part of their block.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{stripTerminalControls,visibleLength,wrapVisibleLine}from"#cli/ui/terminal-text.js";function formatAttributeContent(e,t,n,r){if(typeof t!=`string`)return Array.isArray(t)?prettyJson(t,r):[stripTerminalControls(shortJson(t))];if(e===`
|
|
2
|
-
`).flatMap(e=>wrapHanging(e,t,t))}function wrapPrefixed(e,t,n,r){let i=n??(e=>e),a=[];return splitEmbeddedNewlines([t]).forEach((t,n)=>{let o=n===0?e:` `,s=n===0?visibleLength(e):2;wrapHanging(t,r,Math.max(8,r-s)).forEach((e,t)=>{a.push(t===0?`${o}${i(e)}`:` ${i(e)}`)})}),a}function wrapHanging(e,t,n){let r=wrapVisibleLine(e,Math.max(8,t-2));if(visibleLength(r[0]??``)<=n)return r;let[i,...a]=wrapVisibleLine(r[0]??``,Math.max(8,n));return[i??``,...a,...r.slice(1)]}function splitEmbeddedNewlines(e){let t=e.flatMap(e=>e.split(/\r\n|\r|\n/));for(;t.length>1&&t[t.length-1]===``;)t.pop();return t}function shortJson(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function parseJson(e){try{return JSON.parse(e)}catch{return}}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{formatAttributeContent,formatPayloadContent,prettyJson,splitEmbeddedNewlines,wrapPlainText};
|
|
1
|
+
import{stripTerminalControls,visibleLength,wrapVisibleLine}from"#cli/ui/terminal-text.js";function formatAttributeContent(e,t,n,r){if(typeof t!=`string`)return Array.isArray(t)?prettyJson(t,r):[stripTerminalControls(shortJson(t))];if(e===`gen_ai.input.messages`){let e=genAiMessageTranscript(t,n,r);if(e!==void 0)return e}return formatPayloadContent(t,r)}function wrapPlainText(e,t){return splitEmbeddedNewlines([stripTerminalControls(e)]).flatMap(e=>wrapVisibleLine(e,t))}function formatPayloadContent(e,t){let n=parseJson(e);return n!==void 0&&(Array.isArray(n)||isRecord(n))?prettyJson(n,t):wrapPlainText(e,t)}function genAiMessageTranscript(e,t,n){let r=parseJson(e);if(!Array.isArray(r)||!r.every(isGenAiMessage))return;let i=[],a=new Map;for(let e of r){let r=genAiMessageParts(e.parts,a),o=e.role===`tool`?toolRoleLabel(r):stripTerminalControls(String(e.role));r.forEach((e,r)=>{let a=r===0?`${t(`${o}:`)} `:` `;i.push(...wrapPrefixed(a,e.text,e.dim?t:void 0,n))})}return i}function toolRoleLabel(e){let t=e.find(e=>e.name!==void 0);return t?.name===void 0?`tool`:`tool ${t.name}`}function genAiMessageParts(e,t){if(!Array.isArray(e))return[{text:shortJson(e)}];let n=[];for(let r of e){if(!isRecord(r)||typeof r.type!=`string`){n.push({text:shortJson(r)});continue}if(r.type===`text`&&typeof r.content==`string`)n.push({text:stripTerminalControls(r.content)});else if(r.type===`reasoning`){let e=typeof r.content==`string`?stripTerminalControls(r.content.trim()):``;n.push({dim:!0,text:e.length>0?`⟨reasoning⟩ ${e}`:`⟨reasoning⟩`})}else if(r.type===`tool_call`&&typeof r.name==`string`){let e=stripTerminalControls(r.name);typeof r.id==`string`&&t.set(r.id,e),n.push({name:e,text:`→ ${e}(${shortJson(r.arguments)})`})}else if(r.type===`tool_call_response`){let e=typeof r.id==`string`?t.get(r.id):void 0;n.push({name:e,text:toolResponseText(r.response)})}else n.push({text:shortJson(r)})}return n.length===0&&n.push({text:shortJson(e)}),n}function toolResponseText(e){return typeof e==`string`?stripTerminalControls(e):shortJson(e)}function prettyJson(e,t){return JSON.stringify(e,null,2).split(`
|
|
2
|
+
`).flatMap(e=>wrapHanging(e,t,t))}function wrapPrefixed(e,t,n,r){let i=n??(e=>e),a=[];return splitEmbeddedNewlines([t]).forEach((t,n)=>{let o=n===0?e:` `,s=n===0?visibleLength(e):2;wrapHanging(t,r,Math.max(8,r-s)).forEach((e,t)=>{a.push(t===0?`${o}${i(e)}`:` ${i(e)}`)})}),a}function wrapHanging(e,t,n){let r=wrapVisibleLine(e,Math.max(8,t-2));if(visibleLength(r[0]??``)<=n)return r;let[i,...a]=wrapVisibleLine(r[0]??``,Math.max(8,n));return[i??``,...a,...r.slice(1)]}function splitEmbeddedNewlines(e){let t=e.flatMap(e=>e.split(/\r\n|\r|\n/));for(;t.length>1&&t[t.length-1]===``;)t.pop();return t}function shortJson(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function parseJson(e){try{return JSON.parse(e)}catch{return}}function isGenAiMessage(e){return isRecord(e)&&typeof e.role==`string`}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{formatAttributeContent,formatPayloadContent,prettyJson,splitEmbeddedNewlines,wrapPlainText};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatCompactTokenCount}from"../stream-format.js";import{formatPayloadContent,wrapPlainText}from"./trace-content.js";import{SURFACE_CLOSE}from"./trace-surfaces.js";import{formatElapsed}from"#cli/format-elapsed.js";import{clipVisible,stripTerminalControls,visibleLength}from"#cli/ui/terminal-text.js";import{agentTurnIdentity}from"#tracing/agent-span-contract.js";import{compareLocalTraceSpans,isAgentTurnSpan}from"#tracing/local-trace-reader.js";function buildConversationItems(e){let t=new Map(e.spans.map(e=>[e.spanId,e])),n=new Map;for(let r of e.spans){if(!isAgentTurnSpan(r))continue;let e=agentTurnIdentity(r),i=turnSubagent(r,t);e!==void 0&&i!==void 0&&n.set(e,i)}let r=[],i=[...e.spans].sort(compareLocalTraceSpans).find(e=>isModelSpan(e)&&typeof e.attributes[`ai.prompt.system`]==`string`),a=i?.attributes[`ai.prompt.system`];i!==void 0&&typeof a==`string`&&a.length>0&&r.push({item:{kind:`system`,durationMs:0,error:!1,span:i,subagent:subagentFor(i,n,t),text:a},order:0n});for(let i of e.spans){let e=subagentFor(i,n,t),a=stringAttribute(i,`agent.channel.delivery.input`);if(a!==void 0){let t=deliveryText(a);if(t===void 0)continue;r.push({item:{kind:`user`,durationMs:0,error:!1,span:i,subagent:e,text:t},order:i.startTimeNs});continue}if(isModelSpan(i)){let n=stringAttribute(i,`ai.response.text`),a=stringAttribute(i,`ai.response.reasoning`),o=numberAttribute(i,`agent.usage.input_tokens`)!==void 0||numberAttribute(i,`agent.usage.output_tokens`)!==void 0,s=i.attributes[`ai.response.tool_calls`]!==void 0;if((n===void 0||n.trim().length===0)&&(a===void 0||a.trim().length===0)&&!o&&!s&&i.statusCode!==2)continue;r.push({item:{kind:`assistant`,costUsd:stepCostUsd(i,t),durationMs:spanDurationMs(i),error:i.statusCode===2,inputTokens:numberAttribute(i,`agent.usage.input_tokens`),model:stringAttribute(i,`gen_ai.request.model`),outputTokens:numberAttribute(i,`agent.usage.output_tokens`),reasoning:a,span:i,subagent:e,text:n,toolCallNames:s?parseToolCallNames(stringAttribute(i,`ai.response.tool_calls`)):void 0},order:i.startTimeNs});for(let t of parseProviderToolResults(stringAttribute(i,`ai.response.tool_results`)))r.push({item:{kind:`tool`,args:t.args,durationMs:0,error:t.error,name:stripTerminalControls(t.name),result:t.result,span:i,subagent:e},order:i.startTimeNs});continue}i.name===`agent.action
|
|
1
|
+
import{formatCompactTokenCount}from"../stream-format.js";import{formatPayloadContent,wrapPlainText}from"./trace-content.js";import{SURFACE_CLOSE}from"./trace-surfaces.js";import{formatElapsed}from"#cli/format-elapsed.js";import{clipVisible,stripTerminalControls,visibleLength}from"#cli/ui/terminal-text.js";import{agentTurnIdentity}from"#tracing/agent-span-contract.js";import{compareLocalTraceSpans,isAgentTurnSpan}from"#tracing/local-trace-reader.js";function buildConversationItems(e){let t=new Map(e.spans.map(e=>[e.spanId,e])),n=new Map;for(let r of e.spans){if(!isAgentTurnSpan(r))continue;let e=agentTurnIdentity(r),i=turnSubagent(r,t);e!==void 0&&i!==void 0&&n.set(e,i)}let r=[],i=[...e.spans].sort(compareLocalTraceSpans).find(e=>isModelSpan(e)&&typeof e.attributes[`ai.prompt.system`]==`string`),a=i?.attributes[`ai.prompt.system`];i!==void 0&&typeof a==`string`&&a.length>0&&r.push({item:{kind:`system`,durationMs:0,error:!1,span:i,subagent:subagentFor(i,n,t),text:a},order:0n});for(let i of e.spans){let e=subagentFor(i,n,t),a=stringAttribute(i,`agent.channel.delivery.input`);if(a!==void 0){let t=deliveryText(a);if(t===void 0)continue;r.push({item:{kind:`user`,durationMs:0,error:!1,span:i,subagent:e,text:t},order:i.startTimeNs});continue}if(isModelSpan(i)){let n=stringAttribute(i,`ai.response.text`),a=stringAttribute(i,`ai.response.reasoning`),o=numberAttribute(i,`agent.usage.input_tokens`)!==void 0||numberAttribute(i,`agent.usage.output_tokens`)!==void 0,s=i.attributes[`ai.response.tool_calls`]!==void 0;if((n===void 0||n.trim().length===0)&&(a===void 0||a.trim().length===0)&&!o&&!s&&i.statusCode!==2)continue;r.push({item:{kind:`assistant`,costUsd:stepCostUsd(i,t),durationMs:spanDurationMs(i),error:i.statusCode===2,inputTokens:numberAttribute(i,`agent.usage.input_tokens`),model:stringAttribute(i,`gen_ai.request.model`),outputTokens:numberAttribute(i,`agent.usage.output_tokens`),reasoning:a,span:i,subagent:e,text:n,toolCallNames:s?parseToolCallNames(stringAttribute(i,`ai.response.tool_calls`)):void 0},order:i.startTimeNs});for(let t of parseProviderToolResults(stringAttribute(i,`ai.response.tool_results`)))r.push({item:{kind:`tool`,args:t.args,durationMs:0,error:t.error,name:stripTerminalControls(t.name),result:t.result,span:i,subagent:e},order:i.startTimeNs});continue}(i.name===`agent.action`||stringAttribute(i,`gen_ai.operation.name`)===`invoke_workflow`)&&r.push({item:{kind:`tool`,args:stringAttribute(i,`gen_ai.tool.call.arguments`),durationMs:spanDurationMs(i),error:i.statusCode===2,name:stripTerminalControls(stringAttribute(i,`agent.action.name`)??stringAttribute(i,`gen_ai.workflow.name`)??`action`),result:unwrapJsonString(stringAttribute(i,`gen_ai.tool.call.result`)),span:i,subagent:e},order:i.startTimeNs})}return r.sort((e,t)=>e.order===t.order?0:e.order<t.order?-1:1).map(e=>e.item)}function subagentFor(e,t,n){let r=e;for(;r!==void 0;){let e=agentTurnIdentity(r);if(e!==void 0)return t.get(e);r=r.parentSpanId===void 0?void 0:n.get(r.parentSpanId)}}function turnSubagent(e,t){let n=stringAttribute(e,`agent.subagent.name`);if(n!==void 0){let t=n??stringAttribute(e,`gen_ai.agent.name`);return{name:t===void 0?void 0:stripTerminalControls(t)}}let r=e.parentSpanId===void 0?void 0:t.get(e.parentSpanId);if(r===void 0||r.name!==`agent.action`)return;let i=stringAttribute(r,`agent.action.kind`);if(i!==`subagent-call`&&i!==`remote-agent-call`)return;let a=stringAttribute(r,`agent.turn.id`);if(a===void 0)return;let o=stringAttribute(r,`agent.action.name`);return{name:o===void 0?void 0:stripTerminalControls(o),parentCallId:stringAttribute(r,`agent.action.call_id`),parentTurnId:a}}function renderConversationItem(e,t,n,r,i,a){let{colors:o,glyph:s}=n,c=Math.max(8,t-8),l=conversationItemExpandable(e,t),u=n.color?a:void 0,d=u?.primaryText??o.white,f,p,m=[];if(e.kind===`tool`){let t=o.bold(d(e.name??`tool`));f=`${foldMarker(i,l,n)}${t}`,p=e.durationMs>0?o.dim(formatElapsed(e.durationMs)):``;let r=e.args===void 0?[]:formatPayloadContent(e.args,c),a=e.result===void 0?[]:formatPayloadContent(e.result,c),s=i?r:capLines(r,c),u=i?a:capLines(a,c);s.length>0&&m.push(``,o.dim(`Input:`),``,...s),u.length>0&&m.push(``,o.dim(`Output:`),``,...u)}else if(e.kind===`system`){f=`${foldMarker(i,l,n)}${o.bold(d(`system`))}`,p=o.dim(`~${formatCompactTokenCount(estimateTokens(e.text??``))} tokens`);let t=wrapPlainText(e.text??``,c);m.push(...i?t:capLines(t,c))}else if(e.kind===`assistant`){f=`${foldMarker(i,l,n)}${o.bold(d(`assistant`))}${e.model===void 0?``:o.dim(` · ${stripTerminalControls(e.model)}`)}`,p=assistantMetrics(e,s,o);let t=e.reasoning===void 0||e.reasoning.trim().length===0?[]:wrapPlainText(e.reasoning,c),r=e.text===void 0||e.text.trim().length===0?[]:wrapPlainText(e.text,c),a=(i?t:capLines(t,c)).map(e=>o.dim(e)),u=i?r:capLines(r,c);if(a.length>0&&(m.push(o.dim(`Thought:`),``,...a),u.length>0&&m.push(``)),m.push(...u),(e.text===void 0||e.text.trim().length===0)&&e.toolCallNames!==void 0&&e.toolCallNames.length>0){a.length>0&&m.push(``);for(let t of e.toolCallNames)m.push(o.dim(`→ ${t}`))}}else{let t=e.kind===`user`&&e.subagent!==void 0?`task`:e.kind;f=`${foldMarker(i,l,n)}${o.bold(d(t))}`,p=``;let r=e.text===void 0||e.text.trim().length===0?[]:wrapPlainText(e.text,c);m.push(...i?r:capLines(r,c))}if(e.subagent!==void 0){let t=e.subagent.name===void 0?`subagent`:`subagent:${e.subagent.name}`;f+=o.dim(` · ${t}`)}e.error&&(f+=` ${o.red(s.error)}`),!i&&l?m.push(`…`,``,o.dim(`Click to expand`)):i&&l&&m.push(``,o.dim(`Click to collapse`));let h=u===void 0?void 0:e.error?u.errorHeader:u.header,g=u===void 0?void 0:e.error?u.errorBody:u.body,_=railCell(n,r,e.error,u);return[cardRow(``,t,n,_,h),cardSplitRow(f,p,t,n,_,h),cardRow(``,t,n,_,h),cardRow(``,t,n,_,g),...m.map(e=>cardRow(e,t,n,_,g)),cardRow(``,t,n,_,g)]}function cardRow(e,t,n,r,i){let a=clipVisible(e,Math.max(1,t-8)),o=` `.repeat(Math.max(0,t-8-visibleLength(a)));return i===void 0||!n.color?` ${r} ${a}${o} `:` ${r}${i} ${a.replaceAll(`\x1B[0m`,`\x1b[0m${i}`)}\x1b[0m${i}${o} ${SURFACE_CLOSE} `}function railCell(e,t,n,r){let{colors:i,glyph:a}=e;if(t){let t=e.unicode?`▌`:a.rule;return r===void 0?i.white(t):r.primaryText(t)}return r===void 0?n?i.red(a.rule):i.dim(a.rule):` `}function cardSplitRow(e,t,n,r,i,a){if(visibleLength(t)===0)return cardRow(e,n,r,i,a);let o=Math.max(1,n-8),s=visibleLength(t),c=Math.max(1,o-s-2),l=clipVisible(e,c);return cardRow(`${l}${` `.repeat(Math.max(2,o-visibleLength(l)-s))}${t}`,n,r,i,a)}function assistantMetrics(e,t,n){let r=[];return e.durationMs>0&&r.push(formatElapsed(e.durationMs)),e.inputTokens!==void 0&&r.push(`${t.arrowUp}${formatCompactTokenCount(e.inputTokens)}`),e.outputTokens!==void 0&&r.push(`${t.arrowDown}${formatCompactTokenCount(e.outputTokens)}`),e.costUsd!==void 0&&r.push(formatCost(e.costUsd)),r.length===0?``:n.dim(r.join(` · `))}function formatCost(e){return e>=.01?`$${e.toFixed(2)}`:`$${e.toFixed(4)}`}function stepCostUsd(e,t){let n=e;for(;n.parentSpanId!==void 0;){if(n=t.get(n.parentSpanId),n===void 0)return;if(n.name===`agent.step`)return numberAttribute(n,`gen_ai.usage.cost`)}}function foldMarker(e,t,n){return e?`${n.colors.dim(`▾`)} `:t?`${n.colors.dim(`▸`)} `:``}function capLines(e,t){return e.length<=3?[...e]:[...e.slice(0,2),clipVisible(e[2],Math.max(1,t))]}function conversationItemLineCount(e,t,n,r){return renderConversationItem(e,t,n,!1,r).length}function conversationItemExpandable(e,t){let n=Math.max(8,t-8);if(e.kind===`tool`){let t=e.args===void 0?0:formatPayloadContent(e.args,n-2).length,r=e.result===void 0?0:formatPayloadContent(e.result,n-2).length;return t>3||r>3}if(e.kind===`system`)return wrapPlainText(e.text??``,n).length>3;if(e.kind===`user`)return(e.text===void 0||e.text.trim().length===0?0:wrapPlainText(e.text,n).length)>3;let r=e.reasoning===void 0||e.reasoning.trim().length===0?0:wrapPlainText(e.reasoning,n).length,i=e.text===void 0||e.text.trim().length===0?0:wrapPlainText(e.text,n).length;return r>3||i>3}function estimateTokens(e){return Math.ceil(e.length/4)}function deliveryText(e){if(e!==void 0)try{let t=JSON.parse(e);return isRecord(t)&&typeof t.message==`string`?t.message:void 0}catch{return e}}function unwrapJsonString(e){if(e!==void 0)try{let t=JSON.parse(e);return typeof t==`string`?t:e}catch{return e}}function isModelSpan(e){return e.name.startsWith(`ai.`)&&e.name.includes(`do`)||e.attributes[`gen_ai.operation.name`]===`chat`}function parseToolCallNames(e){if(e!==void 0)try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>isRecord(e)&&typeof e.toolName==`string`).map(e=>e.toolName):void 0}catch{return}}function parseProviderToolResults(e){if(e===void 0)return[];try{let t=JSON.parse(e);if(!Array.isArray(t))return[];let asText=e=>typeof e==`string`?e:e===void 0?void 0:JSON.stringify(e);return t.filter(isRecord).map(e=>{let t=`error`in e;return{args:asText(e.input),error:t,name:typeof e.toolName==`string`?e.toolName:`tool`,result:asText(t?e.error:e.output)}})}catch{return[]}}function stringAttribute(e,t){let n=e.attributes[t];return typeof n==`string`?n:void 0}function numberAttribute(e,t){let n=e.attributes[t];return typeof n==`number`?n:void 0}function spanDurationMs(e){return Math.max(0,Number(e.endTimeNs-e.startTimeNs)/1e6)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{buildConversationItems,conversationItemExpandable,conversationItemLineCount,renderConversationItem};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{formatAttributeContent}from"./trace-content.js";import{renderConversationItem}from"./trace-conversation.js";import{orderedTextSelection,selectedTraceViewerSpan}from"./trace-viewer-state.js";import{formatElapsed}from"#cli/format-elapsed.js";import{clipVisible,sliceVisible,stripAnsi,stripTerminalControls,visibleLength,wrapVisibleLine}from"#cli/ui/terminal-text.js";import{describeLocalTraceSpan}from"#tracing/local-trace-reader.js";function renderTraceViewer(e,t){let{width:n,height:r,theme:i}=t,a=chromeStyles(i,t.surfaces),o=Math.max(1,r-3-3),s=e.panelOpen?panelWidthFor(n):0,c=Math.max(20,n-(s===0?0:s+1)),l=panelDetailLines(e,s,i,t.surfaces),u=o,d=[];if(d.push(...renderHeader(e,t)),e.traces.length===0)d.push(...renderEmptyState(t,i,o));else if(e.trace===void 0)d.push(...center(o,a.muted(`Loading trace…`)));else{let r=renderConversation(e,t,c,o);for(let t=0;t<o;t+=1){let i=r[t]??``;if(s===0){d.push(i);continue}let a=l[e.panelScroll+t]??``;e.textSelection!==void 0&&e.textSelection.region===`panel`&&(a=highlightSelection(a,e.panelScroll+t,e.textSelection,s)),d.push(joinPanels(i,c,a,n))}}return d.push(...renderFooter(e,n,i,t.surfaces)),t.toast!==void 0&&overlayToast(d,t.toast,n,i,t.surfaces),{rows:d,panelTotalRows:l.length,timelineViewportRows:o,panelViewportRows:u,contentWidth:c}}function chromeStyles(e,t){let n=e.color?t:void 0;return{muted:n?.mutedText??e.colors.dim,primary:n?.primaryText??(e=>e)}}function overlayToast(e,t,n,r,i){let a=` ${stripTerminalControls(t)} `,o=visibleLength(a),s=r.unicode?`▌`:r.glyph.rule,c=r.color?i:void 0,l=c===void 0?``:c.body,u=c?.primaryText??r.colors.white,d=r.color?`\x1B[0m`:``,f=[`${l}${u(s)}${` `.repeat(o)}${d}`,`${l}${u(s)}${u(a)}${d}`,`${l}${u(s)}${` `.repeat(o)}${d}`];for(let[t,r]of f.entries()){let i=2+t;if(i>=e.length)break;e[i]=overlayRight(e[i],r,n,1)}}function overlayRight(e,t,n,r){let i=Math.max(0,n-r-visibleLength(t)),a=visibleLength(e),o=a<i?e+` `.repeat(i-a):e;return`${sliceVisible(o,i)}\x1b[0m${t}`}const CONVERSATION_CONTENT_KEYS=new Set([`
|
|
1
|
+
import{formatAttributeContent}from"./trace-content.js";import{renderConversationItem}from"./trace-conversation.js";import{orderedTextSelection,selectedTraceViewerSpan}from"./trace-viewer-state.js";import{formatElapsed}from"#cli/format-elapsed.js";import{clipVisible,sliceVisible,stripAnsi,stripTerminalControls,visibleLength,wrapVisibleLine}from"#cli/ui/terminal-text.js";import{describeLocalTraceSpan}from"#tracing/local-trace-reader.js";function renderTraceViewer(e,t){let{width:n,height:r,theme:i}=t,a=chromeStyles(i,t.surfaces),o=Math.max(1,r-3-3),s=e.panelOpen?panelWidthFor(n):0,c=Math.max(20,n-(s===0?0:s+1)),l=panelDetailLines(e,s,i,t.surfaces),u=o,d=[];if(d.push(...renderHeader(e,t)),e.traces.length===0)d.push(...renderEmptyState(t,i,o));else if(e.trace===void 0)d.push(...center(o,a.muted(`Loading trace…`)));else{let r=renderConversation(e,t,c,o);for(let t=0;t<o;t+=1){let i=r[t]??``;if(s===0){d.push(i);continue}let a=l[e.panelScroll+t]??``;e.textSelection!==void 0&&e.textSelection.region===`panel`&&(a=highlightSelection(a,e.panelScroll+t,e.textSelection,s)),d.push(joinPanels(i,c,a,n))}}return d.push(...renderFooter(e,n,i,t.surfaces)),t.toast!==void 0&&overlayToast(d,t.toast,n,i,t.surfaces),{rows:d,panelTotalRows:l.length,timelineViewportRows:o,panelViewportRows:u,contentWidth:c}}function chromeStyles(e,t){let n=e.color?t:void 0;return{muted:n?.mutedText??e.colors.dim,primary:n?.primaryText??(e=>e)}}function overlayToast(e,t,n,r,i){let a=` ${stripTerminalControls(t)} `,o=visibleLength(a),s=r.unicode?`▌`:r.glyph.rule,c=r.color?i:void 0,l=c===void 0?``:c.body,u=c?.primaryText??r.colors.white,d=r.color?`\x1B[0m`:``,f=[`${l}${u(s)}${` `.repeat(o)}${d}`,`${l}${u(s)}${u(a)}${d}`,`${l}${u(s)}${` `.repeat(o)}${d}`];for(let[t,r]of f.entries()){let i=2+t;if(i>=e.length)break;e[i]=overlayRight(e[i],r,n,1)}}function overlayRight(e,t,n,r){let i=Math.max(0,n-r-visibleLength(t)),a=visibleLength(e),o=a<i?e+` `.repeat(i-a):e;return`${sliceVisible(o,i)}\x1b[0m${t}`}const CONVERSATION_CONTENT_KEYS=new Set([`gen_ai.input.messages`,`ai.prompt.system`,`ai.response.reasoning`,`ai.response.text`,`ai.response.tool_calls`,`ai.response.tool_results`,`gen_ai.tool.call.arguments`,`gen_ai.tool.call.result`]);function renderSpanDetail(e,t,n,r){let{colors:i}=n,{muted:a,primary:o}=chromeStyles(n,r?.surfaces),s=[],c=stripTerminalControls(e.name);s.push(...wrapVisibleLine(i.bold(o(c)),t));let l=describeLocalTraceSpan(e).map(stripTerminalControls);l.length>0&&s.push(a(l.join(`, `))),s.push(``);let fact=(e,t)=>`${a(e.padEnd(10))}${t}`,u=e.statusCode===2;s.push(fact(`status`,u?i.red(`ERROR`):i.green(`ok`))),s.push(fact(`duration`,formatElapsed(durationMs(e.startTimeNs,e.endTimeNs)))),s.push(fact(`started`,clockTime(e.startTimeNs))),s.push(fact(`span`,e.spanId)),e.parentSpanId!==void 0&&s.push(fact(`parent`,e.parentSpanId)),e.scope!==void 0&&s.push(fact(`scope`,stripTerminalControls(e.scope))),s.push(``);let d=Object.keys(e.attributes).filter(e=>r?.excludeKeys?.has(e)!==!0).sort();if(d.length===0)s.push(a(`no attributes`));else{s.push(a(`attributes (${d.length})`));for(let n of d){let r=formatAttributeContent(n,e.attributes[n],i.dim,t-2),o=stripTerminalControls(n);if(r.length===1)s.push(...wrapVisibleLine(`${a(o)} ${r[0]}`,t));else{s.push(a(o));for(let e of r)s.push(` ${e}`)}}}return s.map(e=>clipVisible(e,t))}function renderHeader(e,t){let{theme:n,width:r}=t,{colors:i,glyph:a}=n,{muted:o,primary:s}=chromeStyles(n,t.surfaces),c=[];if(e.trace?.agentName!==void 0&&c.push(stripTerminalControls(e.trace.agentName)),e.trace?.conversationId!==void 0&&c.push(`conversation ${stripTerminalControls(e.trace.conversationId)}`),e.trace!==void 0){let n=t.activeWindowEndNs!==void 0&&t.activeWindowEndNs>e.trace.endTimeNs?t.activeWindowEndNs:e.trace.endTimeNs;c.push(clockTime(e.trace.startTimeNs),`${e.trace.spans.length} span${e.trace.spans.length===1?``:`s`}`,formatElapsed(durationMs(e.trace.startTimeNs,n)))}let l=`${i.bold(s(`${a.brand} traces`))}${c.length===0?``:o(` · ${c.join(` · `)}`)}`,u=e.traces.length===0?``:o(`[${e.traceIndex+1}/${e.traces.length}]`),d=[t.activeWindowEndNs===void 0?``:i.green(`● live`),u].filter(e=>e.length>0).join(` `),f=joinRight(` ${clipVisible(l,Math.max(0,r-visibleLength(d)-2))}`,d,r);return[``,clipVisible(f,r),``]}function renderConversation(e,t,n,r){let{theme:i}=t;if(e.conversationItems.length===0)return[chromeStyles(i,t.surfaces).muted(` No conversation content in this trace; its export policy may have redacted it.`)];let a=conversationLines(e,n,i,t.surfaces).slice(e.scrollRow,e.scrollRow+r);return e.textSelection===void 0||e.textSelection.region!==`conversation`?a:a.map((t,r)=>highlightSelection(t,e.scrollRow+r,e.textSelection,n))}function conversationLines(e,t,n,r){let i=[];for(let a=0;a<e.conversationItems.length;a+=1)i.push(...renderConversationItem(e.conversationItems[a],t,n,a===e.selectedRow,e.expandedItems.has(a),r),``);return i}function panelDetailLines(e,t,n,r){let i=selectedTraceViewerSpan(e);return!e.panelOpen||t<=0||i===void 0?[]:[``,...renderSpanDetail(i,Math.max(16,t-3),n,{excludeKeys:CONVERSATION_CONTENT_KEYS,surfaces:r}).map(e=>` ${e}`)]}function conversationSelectionText(e,t,n,r,i){return selectionText(conversationLines(e,t,n,i),r)}function panelSelectionText(e,t,n,r){return selectionText(panelDetailLines(e,e.panelOpen?panelWidthFor(t):0,n),r)}function selectionText(e,t){let{start:n,end:r}=orderedTextSelection(t),i=[];for(let t=Math.max(0,n.line);t<=r.line&&t<e.length;t+=1){let a=stripAnsi(e[t]),o=t===n.line?n.column:0,s=t===r.line?r.column+1:1/0,c=s===1/0?a:sliceVisible(a,s),l=sliceVisible(a,o).length;i.push(c.slice(l).trimEnd())}return i.join(`
|
|
2
2
|
`)}function highlightSelection(e,t,n,r){let{start:i,end:a}=orderedTextSelection(n);if(t<i.line||t>a.line)return e;let o=t===i.line?i.column:0,s=t===a.line?a.column+1:r,c=visibleLength(e),l=c<s?e+` `.repeat(s-c):e,u=sliceVisible(l,o),d=sliceVisible(l,s),f=d.slice(u.length),p=l.slice(d.length);return f.length===0?e:`${u}\x1b[7m${f.replaceAll(`\x1B[0m`,`\x1B[0m\x1B[7m`)}\x1b[27m${p}`}function renderFooter(e,t,n,r){let{colors:i}=n,{muted:a}=chromeStyles(n,r),[o,s]=n.unicode?[`↑↓`,`←→`]:[`^/v`,`</>`],c=e.panelFocus?`${o} scroll · tab cards · esc back`:`${o} select · ${s} expand · enter attrs · tab focus · [ ] traces · q close`,l=e.conversationItems.length,u=l===0?``:a(`item ${e.selectedRow+1}/${l}`),d=[e.notice===void 0?``:i.yellow(e.notice),u].filter(e=>e.length>0).join(a(` · `));return[``,clipVisible(` ${a(c)}`,t),clipVisible(d.length===0?``:` ${d}`,t)]}function renderEmptyState(e,t,n){let{muted:r,primary:i}=chromeStyles(t,e.surfaces),[a,o]=e.tracingDisabled===!0?[`Tracing is disabled (EVE_TRACES=off).`,`Re-enable it and spans stream in live.`]:[`No local traces yet.`,`Chat with your agent — spans stream in live.`];return center(n,t.colors.bold(i(a)),r(o))}function center(e,...t){let n=Array.from({length:e},()=>``),r=Math.max(0,Math.floor(e/2)-1);return t.forEach((t,i)=>{r+i<e&&(n[r+i]=t)}),n}function joinPanels(e,t,n,r){let i=Math.max(0,r-t-1);return`${padTo(e,t)} ${clipVisible(n,i)}`}function joinRight(e,t,n){if(t.length===0)return e;let r=Math.max(1,n-visibleLength(e)-visibleLength(t));return`${e}${` `.repeat(r)}${t}`}function padTo(e,t){let n=visibleLength(e);return n>=t?clipVisible(e,t):e+` `.repeat(t-n)}function panelWidthFor(e){return e<42?0:Math.min(64,Math.max(20,Math.floor(e*.42)),e-20-1)}function durationMs(e,t){return Math.max(0,Number(t-e)/1e6)}function clockTime(e){let t=new Date(Number(e/1000000n)),pad=(e,t=2)=>String(e).padStart(t,`0`);return`${pad(t.getHours())}:${pad(t.getMinutes())}:${pad(t.getSeconds())}.${pad(t.getMilliseconds(),3)}`}export{conversationSelectionText,panelSelectionText,renderSpanDetail,renderTraceViewer};
|
|
@@ -1553,7 +1553,6 @@ export declare const AgentInfoResultSchema: z.ZodObject<{
|
|
|
1553
1553
|
action: z.ZodOptional<z.ZodEnum<{
|
|
1554
1554
|
"subagent-call": "subagent-call";
|
|
1555
1555
|
"task-cancel": "task-cancel";
|
|
1556
|
-
"task-update": "task-update";
|
|
1557
1556
|
"workflow-tool-call": "workflow-tool-call";
|
|
1558
1557
|
}>>;
|
|
1559
1558
|
audience: z.ZodArray<z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";const owner=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`application`)}).strict(),z.object({feature:z.string(),kind:z.literal(`framework`)}).strict(),z.object({kind:z.literal(`extension`),namespace:z.string(),packageName:z.string()}).strict()]),moduleBacking=z.discriminatedUnion(`kind`,[z.object({externalDependencies:z.array(z.string()),extensionScope:z.object({namespace:z.string(),sourceRoot:z.string()}).strict().optional(),kind:z.literal(`filesystem`),sourcePath:z.string()}).strict(),z.object({dependencies:z.record(z.string(),z.string()).optional(),kind:z.literal(`programmatic`),moduleId:z.string(),parameters:z.record(z.string(),z.unknown()).optional(),registryId:z.string(),revision:z.string(),semanticRevision:z.string().optional()}).strict()]),binding=z.object({backing:moduleBacking,logicalPath:z.string(),owner}).strict(),source=z.object({binding:binding.optional(),exportName:z.string().optional(),logicalPath:z.string(),owner,sourceId:z.string(),sourceKind:z.enum([`markdown`,`module`,`skill-package`])}).strict(),entry=source.extend({name:z.string()}).strict(),dynamicResolver=source.extend({eventNames:z.array(z.string()),slug:z.string()}).strict(),modelRouting=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`gateway`),target:z.string(),byok:z.string().optional()}).strict(),z.object({kind:z.literal(`external`),provider:z.string()}).strict()]),modelEndpoint=z.union([z.object({kind:z.literal(`external`),provider:z.string()}).strict(),z.object({kind:z.literal(`chatgpt`),state:z.enum([`checking`,`ready`,`signed-out`,`reauth-required`,`unavailable`]),accountLabel:z.string().optional()}).strict(),z.object({kind:z.literal(`gateway`),connected:z.literal(!0),credential:z.enum([`api-key`,`oidc`])}).strict(),z.object({kind:z.literal(`gateway`),connected:z.literal(!1)}).strict()]),modelBaseFields={contextWindowTokens:z.number().optional(),providerOptions:z.unknown().optional(),reasoning:z.enum([`provider-default`,`none`,`minimal`,`low`,`medium`,`high`,`xhigh`]).optional().catch(void 0),source:source.optional()},agentModel=z.union([z.object({...modelBaseFields,endpoint:modelEndpoint.optional(),id:z.string(),routing:modelRouting}).strict(),z.object({...modelBaseFields,endpoint:z.never().optional(),id:z.never().optional(),routing:z.object({kind:z.literal(`dynamic`),resolver:dynamicResolver}).strict()}).strict()]),tool=entry.extend({description:z.string(),hasAuth:z.boolean(),hasExecute:z.boolean(),hasModelOutputProjection:z.boolean(),hasOutputSchema:z.boolean(),inputSchema:z.unknown(),outputSchema:z.unknown().optional(),requiresApproval:z.boolean()}).strict(),skill=entry.extend({description:z.string(),license:z.string().optional(),markdown:z.string(),metadata:z.record(z.string(),z.string()).optional()}).strict(),instructions=entry.extend({content:z.string(),role:z.enum([`system`,`user`])}).strict(),schedule=entry.extend({cron:z.string(),hasRun:z.boolean(),markdown:z.string().optional()}).strict(),channelMethod=z.enum([`GET`,`HEAD`,`POST`,`PUT`,`PATCH`,`DELETE`,`OPTIONS`,`WEBSOCKET`]),channelRoute=entry.extend({adapterKind:z.string().optional(),method:channelMethod,urlPath:z.string()}).strict(),sourceDescriptor=z.object({backing:z.union([moduleBacking,z.object({kind:z.literal(`resource`),sourcePath:z.string()}).strict()]),form:z.enum([`derived`,`direct`]),layer:z.enum([`framework-default`,`extension-package`,`extension-override`,`application`]),logicalPath:z.string(),owner,sourceId:z.string()}).strict(),shadowedChannelRoute=z.object({method:channelMethod,source:sourceDescriptor,urlPath:z.string(),winnerSourceId:z.string()}).strict(),connection=source.extend({connectionName:z.string(),description:z.string(),hasApproval:z.boolean(),hasAuthorization:z.boolean(),hasHeaders:z.boolean(),protocol:z.string(),toolFilter:z.unknown().optional(),url:z.string()}).strict(),hook=source.extend({eventNames:z.array(z.string()),slug:z.string()}).strict(),memory=source.extend({description:z.string().optional(),slot:z.string(),visibility:z.enum([`scope`,`session`])}).strict(),sandbox=source.extend({backendKind:z.string().optional(),description:z.string().optional(),hasBootstrap:z.boolean(),hasOnSession:z.boolean(),revalidationKey:z.string().optional(),sourceHash:z.string().optional()}).strict(),subagent=entry.extend({configResolver:dynamicResolver.optional(),description:z.string().optional(),entryPath:z.string(),nodeId:z.string(),parentNodeId:z.string(),rootPath:z.string(),summary:z.object({channels:z.number(),connections:z.number(),hooks:z.number(),instructions:z.number(),memories:z.number(),schedules:z.number(),skills:z.number(),tools:z.number()}).strict()}).strict(),remoteAgent=entry.extend({description:z.string(),nodeId:z.string(),parentNodeId:z.string(),url:z.string().optional()}).strict(),kernelEffect=z.object({action:z.enum([`subagent-call`,`task-update`,`task-cancel`,`workflow-tool-call`]).optional(),audience:z.array(z.enum([`root-session`,`delegated-task-child`,`requires-request-input`])),kind:z.enum([`request-input`,`dispatch`,`provider-tool`]),sourceId:z.string()}).strict(),compositionDiagnostic=z.object({kind:z.enum([`disabled`,`shadowed`]),logicalPath:z.string(),owner,sourceId:z.string(),winnerSourceId:z.string().optional()}).strict(),workflow=z.discriminatedUnion(`enabled`,[z.object({enabled:z.literal(!1),toolName:z.string()}).strict(),z.object({enabled:z.literal(!0),source,toolName:z.string()}).strict()]),AgentInfoResultSchema=z.object({agent:z.object({agentRoot:z.string(),appRoot:z.string(),config:source.extend({binding}).strict(),description:z.string().optional(),model:agentModel,name:z.string(),nodeId:z.string(),outputSchema:z.unknown().optional()}).strict(),capabilities:z.object({devRoutes:z.boolean()}).strict(),channels:z.object({routes:z.array(channelRoute),shadowed:z.array(shadowedChannelRoute)}).strict(),composition:z.object({disabled:z.array(compositionDiagnostic),shadowed:z.array(compositionDiagnostic)}).strict(),connections:z.array(connection),diagnostics:z.object({discoveryErrors:z.number(),discoveryWarnings:z.number()}).strict(),hooks:z.array(hook),instructions:z.object({dynamic:z.array(dynamicResolver),static:z.array(instructions)}).strict(),instrumentation:source.optional(),kernelEffects:z.array(kernelEffect),kind:z.literal(`eve-agent-info`),memories:z.array(memory),mode:z.enum([`development`,`production`]),remoteAgents:z.object({entries:z.array(remoteAgent),total:z.number()}).strict(),sandbox,schedules:z.array(schedule),skills:z.object({dynamic:z.array(dynamicResolver),static:z.array(skill)}).strict(),subagents:z.object({local:z.array(subagent),total:z.number()}).strict(),tools:z.object({dynamic:z.array(dynamicResolver),static:z.array(tool)}).strict(),version:z.literal(4),workflow,workspace:z.object({resourceRoot:z.unknown(),rootEntries:z.array(z.string())}).strict()}).strict().superRefine((e,t)=>{let assertUnique=(e,n,r)=>{let i=new Set;e.forEach((e,a)=>{let o=n(e);i.has(o)&&t.addIssue({code:`custom`,message:`Duplicate public identity "${o}".`,path:[...r,a]}),i.add(o)})},assertTotal=(e,n,r)=>{(!Number.isSafeInteger(e)||e<0||e!==n.length)&&t.addIssue({code:`custom`,message:`Expected total ${n.length}, received ${e}.`,path:[...r]})};assertUnique(e.tools.static,e=>e.name,[`tools`,`static`]),assertUnique(e.tools.dynamic,e=>e.slug,[`tools`,`dynamic`]),assertUnique(e.skills.static,e=>e.name,[`skills`,`static`]),assertUnique(e.skills.dynamic,e=>e.slug,[`skills`,`dynamic`]),assertUnique(e.instructions.static,e=>e.name,[`instructions`,`static`]),assertUnique(e.instructions.dynamic,e=>e.slug,[`instructions`,`dynamic`]),assertUnique(e.schedules,e=>e.name,[`schedules`]),assertUnique(e.connections,e=>e.connectionName,[`connections`]),assertUnique(e.hooks,e=>e.slug,[`hooks`]),assertUnique(e.memories,e=>e.slot,[`memories`]),assertUnique(e.channels.routes,e=>`${e.method} ${normalizeRoutePattern(e.urlPath)}`,[`channels`,`routes`]),assertUnique(e.subagents.local,e=>e.nodeId,[`subagents`,`local`]),assertUnique(e.remoteAgents.entries,e=>e.nodeId,[`remoteAgents`,`entries`]),assertTotal(e.subagents.total,e.subagents.local,[`subagents`,`total`]),assertTotal(e.remoteAgents.total,e.remoteAgents.entries,[`remoteAgents`,`total`]);let n=[[e.agent.config,[`agent`,`config`]],...e.agent.model.source===void 0?[]:[[e.agent.model.source,[`agent`,`model`,`source`]]],...e.agent.model.routing.kind===`dynamic`?[[e.agent.model.routing.resolver,[`agent`,`model`,`routing`,`resolver`]]]:[],...e.channels.routes.map((e,t)=>[e,[`channels`,`routes`,t]]),...e.connections.map((e,t)=>[e,[`connections`,t]]),...e.hooks.map((e,t)=>[e,[`hooks`,t]]),...e.instructions.dynamic.map((e,t)=>[e,[`instructions`,`dynamic`,t]]),...e.instructions.static.map((e,t)=>[e,[`instructions`,`static`,t]]),...e.memories.map((e,t)=>[e,[`memories`,t]]),...e.instrumentation===void 0?[]:[[e.instrumentation,[`instrumentation`]]],...e.remoteAgents.entries.map((e,t)=>[e,[`remoteAgents`,`entries`,t]]),...e.schedules.map((e,t)=>[e,[`schedules`,t]]),...e.skills.dynamic.map((e,t)=>[e,[`skills`,`dynamic`,t]]),...e.skills.static.map((e,t)=>[e,[`skills`,`static`,t]]),...e.subagents.local.flatMap((e,t)=>e.configResolver===void 0?[]:[[e.configResolver,[`subagents`,`local`,t,`configResolver`]]]),...e.tools.dynamic.map((e,t)=>[e,[`tools`,`dynamic`,t]]),...e.tools.static.map((e,t)=>[e,[`tools`,`static`,t]]),...e.workflow.enabled?[[e.workflow.source,[`workflow`,`source`]]]:[],[e.sandbox,[`sandbox`]]];for(let[e,r]of n){if(e.sourceKind===`module`&&e.binding===void 0){t.addIssue({code:`custom`,message:`Module source is missing its compiled binding.`,path:[...r,`binding`]});continue}if(e.sourceKind!==`module`&&e.binding!==void 0){t.addIssue({code:`custom`,message:`${e.sourceKind} source cannot carry a module binding.`,path:[...r,`binding`]});continue}e.binding!==void 0&&(e.binding.logicalPath!==e.logicalPath&&t.addIssue({code:`custom`,message:`Source and binding logical paths do not match.`,path:[...r,`binding`,`logicalPath`]}),JSON.stringify(e.binding.owner)!==JSON.stringify(e.owner)&&t.addIssue({code:`custom`,message:`Source and binding owners do not match.`,path:[...r,`binding`,`owner`]}))}});function normalizeRoutePattern(e){return e.replace(/^\/+|\/+$/g,``).split(`/`).map(e=>e.startsWith(`:`)||/^\[[^\]]+\]$/.test(e)?`:`:e).join(`/`)}export{AgentInfoResultSchema};
|
|
1
|
+
import{z}from"#compiled/zod/index.js";const owner=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`application`)}).strict(),z.object({feature:z.string(),kind:z.literal(`framework`)}).strict(),z.object({kind:z.literal(`extension`),namespace:z.string(),packageName:z.string()}).strict()]),moduleBacking=z.discriminatedUnion(`kind`,[z.object({externalDependencies:z.array(z.string()),extensionScope:z.object({namespace:z.string(),sourceRoot:z.string()}).strict().optional(),kind:z.literal(`filesystem`),sourcePath:z.string()}).strict(),z.object({dependencies:z.record(z.string(),z.string()).optional(),kind:z.literal(`programmatic`),moduleId:z.string(),parameters:z.record(z.string(),z.unknown()).optional(),registryId:z.string(),revision:z.string(),semanticRevision:z.string().optional()}).strict()]),binding=z.object({backing:moduleBacking,logicalPath:z.string(),owner}).strict(),source=z.object({binding:binding.optional(),exportName:z.string().optional(),logicalPath:z.string(),owner,sourceId:z.string(),sourceKind:z.enum([`markdown`,`module`,`skill-package`])}).strict(),entry=source.extend({name:z.string()}).strict(),dynamicResolver=source.extend({eventNames:z.array(z.string()),slug:z.string()}).strict(),modelRouting=z.discriminatedUnion(`kind`,[z.object({kind:z.literal(`gateway`),target:z.string(),byok:z.string().optional()}).strict(),z.object({kind:z.literal(`external`),provider:z.string()}).strict()]),modelEndpoint=z.union([z.object({kind:z.literal(`external`),provider:z.string()}).strict(),z.object({kind:z.literal(`chatgpt`),state:z.enum([`checking`,`ready`,`signed-out`,`reauth-required`,`unavailable`]),accountLabel:z.string().optional()}).strict(),z.object({kind:z.literal(`gateway`),connected:z.literal(!0),credential:z.enum([`api-key`,`oidc`])}).strict(),z.object({kind:z.literal(`gateway`),connected:z.literal(!1)}).strict()]),modelBaseFields={contextWindowTokens:z.number().optional(),providerOptions:z.unknown().optional(),reasoning:z.enum([`provider-default`,`none`,`minimal`,`low`,`medium`,`high`,`xhigh`]).optional().catch(void 0),source:source.optional()},agentModel=z.union([z.object({...modelBaseFields,endpoint:modelEndpoint.optional(),id:z.string(),routing:modelRouting}).strict(),z.object({...modelBaseFields,endpoint:z.never().optional(),id:z.never().optional(),routing:z.object({kind:z.literal(`dynamic`),resolver:dynamicResolver}).strict()}).strict()]),tool=entry.extend({description:z.string(),hasAuth:z.boolean(),hasExecute:z.boolean(),hasModelOutputProjection:z.boolean(),hasOutputSchema:z.boolean(),inputSchema:z.unknown(),outputSchema:z.unknown().optional(),requiresApproval:z.boolean()}).strict(),skill=entry.extend({description:z.string(),license:z.string().optional(),markdown:z.string(),metadata:z.record(z.string(),z.string()).optional()}).strict(),instructions=entry.extend({content:z.string(),role:z.enum([`system`,`user`])}).strict(),schedule=entry.extend({cron:z.string(),hasRun:z.boolean(),markdown:z.string().optional()}).strict(),channelMethod=z.enum([`GET`,`HEAD`,`POST`,`PUT`,`PATCH`,`DELETE`,`OPTIONS`,`WEBSOCKET`]),channelRoute=entry.extend({adapterKind:z.string().optional(),method:channelMethod,urlPath:z.string()}).strict(),sourceDescriptor=z.object({backing:z.union([moduleBacking,z.object({kind:z.literal(`resource`),sourcePath:z.string()}).strict()]),form:z.enum([`derived`,`direct`]),layer:z.enum([`framework-default`,`extension-package`,`extension-override`,`application`]),logicalPath:z.string(),owner,sourceId:z.string()}).strict(),shadowedChannelRoute=z.object({method:channelMethod,source:sourceDescriptor,urlPath:z.string(),winnerSourceId:z.string()}).strict(),connection=source.extend({connectionName:z.string(),description:z.string(),hasApproval:z.boolean(),hasAuthorization:z.boolean(),hasHeaders:z.boolean(),protocol:z.string(),toolFilter:z.unknown().optional(),url:z.string()}).strict(),hook=source.extend({eventNames:z.array(z.string()),slug:z.string()}).strict(),memory=source.extend({description:z.string().optional(),slot:z.string(),visibility:z.enum([`scope`,`session`])}).strict(),sandbox=source.extend({backendKind:z.string().optional(),description:z.string().optional(),hasBootstrap:z.boolean(),hasOnSession:z.boolean(),revalidationKey:z.string().optional(),sourceHash:z.string().optional()}).strict(),subagent=entry.extend({configResolver:dynamicResolver.optional(),description:z.string().optional(),entryPath:z.string(),nodeId:z.string(),parentNodeId:z.string(),rootPath:z.string(),summary:z.object({channels:z.number(),connections:z.number(),hooks:z.number(),instructions:z.number(),memories:z.number(),schedules:z.number(),skills:z.number(),tools:z.number()}).strict()}).strict(),remoteAgent=entry.extend({description:z.string(),nodeId:z.string(),parentNodeId:z.string(),url:z.string().optional()}).strict(),kernelEffect=z.object({action:z.enum([`subagent-call`,`task-cancel`,`workflow-tool-call`]).optional(),audience:z.array(z.enum([`root-session`,`delegated-task-child`,`requires-request-input`])),kind:z.enum([`request-input`,`dispatch`,`provider-tool`]),sourceId:z.string()}).strict(),compositionDiagnostic=z.object({kind:z.enum([`disabled`,`shadowed`]),logicalPath:z.string(),owner,sourceId:z.string(),winnerSourceId:z.string().optional()}).strict(),workflow=z.discriminatedUnion(`enabled`,[z.object({enabled:z.literal(!1),toolName:z.string()}).strict(),z.object({enabled:z.literal(!0),source,toolName:z.string()}).strict()]),AgentInfoResultSchema=z.object({agent:z.object({agentRoot:z.string(),appRoot:z.string(),config:source.extend({binding}).strict(),description:z.string().optional(),model:agentModel,name:z.string(),nodeId:z.string(),outputSchema:z.unknown().optional()}).strict(),capabilities:z.object({devRoutes:z.boolean()}).strict(),channels:z.object({routes:z.array(channelRoute),shadowed:z.array(shadowedChannelRoute)}).strict(),composition:z.object({disabled:z.array(compositionDiagnostic),shadowed:z.array(compositionDiagnostic)}).strict(),connections:z.array(connection),diagnostics:z.object({discoveryErrors:z.number(),discoveryWarnings:z.number()}).strict(),hooks:z.array(hook),instructions:z.object({dynamic:z.array(dynamicResolver),static:z.array(instructions)}).strict(),instrumentation:source.optional(),kernelEffects:z.array(kernelEffect),kind:z.literal(`eve-agent-info`),memories:z.array(memory),mode:z.enum([`development`,`production`]),remoteAgents:z.object({entries:z.array(remoteAgent),total:z.number()}).strict(),sandbox,schedules:z.array(schedule),skills:z.object({dynamic:z.array(dynamicResolver),static:z.array(skill)}).strict(),subagents:z.object({local:z.array(subagent),total:z.number()}).strict(),tools:z.object({dynamic:z.array(dynamicResolver),static:z.array(tool)}).strict(),version:z.literal(4),workflow,workspace:z.object({resourceRoot:z.unknown(),rootEntries:z.array(z.string())}).strict()}).strict().superRefine((e,t)=>{let assertUnique=(e,n,r)=>{let i=new Set;e.forEach((e,a)=>{let o=n(e);i.has(o)&&t.addIssue({code:`custom`,message:`Duplicate public identity "${o}".`,path:[...r,a]}),i.add(o)})},assertTotal=(e,n,r)=>{(!Number.isSafeInteger(e)||e<0||e!==n.length)&&t.addIssue({code:`custom`,message:`Expected total ${n.length}, received ${e}.`,path:[...r]})};assertUnique(e.tools.static,e=>e.name,[`tools`,`static`]),assertUnique(e.tools.dynamic,e=>e.slug,[`tools`,`dynamic`]),assertUnique(e.skills.static,e=>e.name,[`skills`,`static`]),assertUnique(e.skills.dynamic,e=>e.slug,[`skills`,`dynamic`]),assertUnique(e.instructions.static,e=>e.name,[`instructions`,`static`]),assertUnique(e.instructions.dynamic,e=>e.slug,[`instructions`,`dynamic`]),assertUnique(e.schedules,e=>e.name,[`schedules`]),assertUnique(e.connections,e=>e.connectionName,[`connections`]),assertUnique(e.hooks,e=>e.slug,[`hooks`]),assertUnique(e.memories,e=>e.slot,[`memories`]),assertUnique(e.channels.routes,e=>`${e.method} ${normalizeRoutePattern(e.urlPath)}`,[`channels`,`routes`]),assertUnique(e.subagents.local,e=>e.nodeId,[`subagents`,`local`]),assertUnique(e.remoteAgents.entries,e=>e.nodeId,[`remoteAgents`,`entries`]),assertTotal(e.subagents.total,e.subagents.local,[`subagents`,`total`]),assertTotal(e.remoteAgents.total,e.remoteAgents.entries,[`remoteAgents`,`total`]);let n=[[e.agent.config,[`agent`,`config`]],...e.agent.model.source===void 0?[]:[[e.agent.model.source,[`agent`,`model`,`source`]]],...e.agent.model.routing.kind===`dynamic`?[[e.agent.model.routing.resolver,[`agent`,`model`,`routing`,`resolver`]]]:[],...e.channels.routes.map((e,t)=>[e,[`channels`,`routes`,t]]),...e.connections.map((e,t)=>[e,[`connections`,t]]),...e.hooks.map((e,t)=>[e,[`hooks`,t]]),...e.instructions.dynamic.map((e,t)=>[e,[`instructions`,`dynamic`,t]]),...e.instructions.static.map((e,t)=>[e,[`instructions`,`static`,t]]),...e.memories.map((e,t)=>[e,[`memories`,t]]),...e.instrumentation===void 0?[]:[[e.instrumentation,[`instrumentation`]]],...e.remoteAgents.entries.map((e,t)=>[e,[`remoteAgents`,`entries`,t]]),...e.schedules.map((e,t)=>[e,[`schedules`,t]]),...e.skills.dynamic.map((e,t)=>[e,[`skills`,`dynamic`,t]]),...e.skills.static.map((e,t)=>[e,[`skills`,`static`,t]]),...e.subagents.local.flatMap((e,t)=>e.configResolver===void 0?[]:[[e.configResolver,[`subagents`,`local`,t,`configResolver`]]]),...e.tools.dynamic.map((e,t)=>[e,[`tools`,`dynamic`,t]]),...e.tools.static.map((e,t)=>[e,[`tools`,`static`,t]]),...e.workflow.enabled?[[e.workflow.source,[`workflow`,`source`]]]:[],[e.sandbox,[`sandbox`]]];for(let[e,r]of n){if(e.sourceKind===`module`&&e.binding===void 0){t.addIssue({code:`custom`,message:`Module source is missing its compiled binding.`,path:[...r,`binding`]});continue}if(e.sourceKind!==`module`&&e.binding!==void 0){t.addIssue({code:`custom`,message:`${e.sourceKind} source cannot carry a module binding.`,path:[...r,`binding`]});continue}e.binding!==void 0&&(e.binding.logicalPath!==e.logicalPath&&t.addIssue({code:`custom`,message:`Source and binding logical paths do not match.`,path:[...r,`binding`,`logicalPath`]}),JSON.stringify(e.binding.owner)!==JSON.stringify(e.owner)&&t.addIssue({code:`custom`,message:`Source and binding owners do not match.`,path:[...r,`binding`,`owner`]}))}});function normalizeRoutePattern(e){return e.replace(/^\/+|\/+$/g,``).split(`/`).map(e=>e.startsWith(`:`)||/^\[[^\]]+\]$/.test(e)?`:`:e).join(`/`)}export{AgentInfoResultSchema};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"moduleFingerprints": {
|
|
3
3
|
"@eve/catalog": "1a52c83c427f093856c0f21512b04d1546e959c80bb1c58672520cbead580260",
|
|
4
|
+
"just-secrets": "1ce67d437d0bb06df02e4e99180a3c5f5edf0010314010226e97b96d462bba5d",
|
|
4
5
|
"@workflow/world-local": "eeaeed751310cf36666c3daa07f305f431710951b0523b97dcdca3d6e69b1061"
|
|
5
6
|
},
|
|
6
7
|
"moduleVersions": {
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"jose": "6.2.3",
|
|
23
24
|
"jsonc-parser": "3.3.1",
|
|
24
25
|
"@types/json-schema": "7.0.15",
|
|
26
|
+
"just-secrets": "0.0.2",
|
|
25
27
|
"marked": "17.0.6",
|
|
26
28
|
"@ai-sdk/mcp": "2.0.45",
|
|
27
29
|
"@modelcontextprotocol/server": "2.0.0",
|
|
@@ -54,7 +56,7 @@
|
|
|
54
56
|
"zod": "4.5.4",
|
|
55
57
|
"zod-validation-error": "5.0.0"
|
|
56
58
|
},
|
|
57
|
-
"scriptHash": "
|
|
59
|
+
"scriptHash": "832a583779021f10d8b9100f7d883ef4de7cfd94825559893b77288327735ec8",
|
|
58
60
|
"toolVersions": {
|
|
59
61
|
"rolldown": "1.2.7",
|
|
60
62
|
"typescript": "7.0.2"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vercel, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Identifies a credential within a service. */
|
|
2
|
+
export interface SecretsOptions {
|
|
3
|
+
service: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface Secrets {
|
|
8
|
+
/** Returns the stored secret, or null when it does not exist. */
|
|
9
|
+
get(options: SecretsOptions): Promise<string | null>;
|
|
10
|
+
get(service: string, name: string): Promise<string | null>;
|
|
11
|
+
/** Creates or replaces a secret in the native credential store. */
|
|
12
|
+
set(options: SecretsOptions & { value: string }): Promise<void>;
|
|
13
|
+
set(service: string, name: string, value: string): Promise<void>;
|
|
14
|
+
/** Returns true when deleted, or false when it does not exist. */
|
|
15
|
+
delete(options: SecretsOptions): Promise<boolean>;
|
|
16
|
+
delete(service: string, name: string): Promise<boolean>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Native secret storage for Node.js 22+, using OS-provided credential tools. */
|
|
20
|
+
export declare const secrets: Secrets;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{spawn as e}from"node:child_process";import{readFile as t}from"node:fs/promises";import n from"node:path";function r(e,t=`ERR_SECRETS_STORE`){return Object.assign(Error(e),{code:t})}function i(t,n,{input:i=``,timeout:a=6e4,maxOutput:o=1048576}={}){return new Promise((s,c)=>{let l;try{l=e(t,n,{shell:!1,windowsHide:!0,stdio:[`pipe`,`pipe`,`pipe`],cwd:void 0})}catch{c(r(`Could not start the OS credential tool.`,`ERR_SECRETS_UNAVAILABLE`));return}let u=[],d=[],f=0,p,m,h=!1,g=(e,t)=>{if(!h){h=!0,clearTimeout(v);for(let e of[...u,...d])e.fill(0);u.length=d.length=0,e?c(e):s(t)}},_=e=>{p??=e,l.kill(`SIGKILL`),l.stdin.destroy(),l.stdout.destroy(),l.stderr.destroy(),g(p)},v=setTimeout(()=>_(r(`The OS credential tool timed out. Unlock your credential store and retry.`,`ERR_SECRETS_TIMEOUT`)),a);for(let[e,t]of[[l.stdout,u],[l.stderr,d]])e.on(`data`,e=>{if(h){e.fill(0);return}f+=e.length,f>o?(e.fill(0),_(r(`The OS credential tool exceeded its output limit.`,`ERR_SECRETS_OUTPUT_LIMIT`))):t.push(e)}),e.on(`error`,()=>_(r(`Could not read the OS credential tool response.`)));l.on(`error`,e=>{let t=e.code===`EACCES`||e.code===`EPERM`?`ERR_SECRETS_ACCESS_DENIED`:`ERR_SECRETS_UNAVAILABLE`;g(r(`Could not start the OS credential tool. Check its installation and permissions.`,t))}),l.stdin.on(`error`,()=>{m=r(`Could not send input to the OS credential tool.`)}),l.on(`close`,(e,t)=>{if(h)return;if(t!==null||!Number.isInteger(e)){g(r(`The OS credential tool terminated unexpectedly.`));return}if(e===0&&m){g(m);return}let n=Buffer.concat(u),i=Buffer.concat(d),a={code:e,stdout:n.toString(`utf8`),stderr:i.toString(`utf8`)};n.fill(0),i.fill(0),g(void 0,a)}),l.stdin.end(i)})}const a=`/usr/bin/security`,o=`secrets:v1:`,s=e=>o+Buffer.from(e,`utf8`).toString(`base64`),c=e=>`"`+e.replaceAll(`\\`,`\\\\`).replaceAll(`"`,`\\"`)+`"`,l=`macOS Keychain operation failed. Check Keychain access and unlock your login keychain.`;function u({run:e=i,keychain:t=`login.keychain-db`}={}){if(/[\r\n\0]/u.test(t))throw TypeError(`Invalid keychain path.`);let n=(e,t)=>[`-s`,s(e),`-a`,s(t)];function u(e,t=!1){if(t&&e.code===44)return!1;if(e.code!==0){let t=e.code===36||e.code===128?`ERR_SECRETS_ACCESS_DENIED`:`ERR_SECRETS_STORE`;throw r(l,t)}return!0}let d=async()=>u(await e(a,[`-q`,`show-keychain-info`,t]));return{async get(i,s){await d();let c=await e(a,[`-q`,`find-generic-password`,...n(i,s),`-w`,t]);if(!u(c,!0))return null;let f=c.stdout.replace(/\n$/u,``);if(!f.startsWith(o))throw r(l);let p=f.slice(11),m=Buffer.from(p,`base64`),h=m.toString(`utf8`);if(m.length>2560||m.toString(`base64`)!==p||!Buffer.from(h,`utf8`).equals(m))throw r(l);return h},async set(i,o,f){let p=[`add-generic-password`,`-U`,...n(i,o),`-w`,s(f),t].map(c).join(` `)+`
|
|
2
|
+
`;if(Buffer.byteLength(p)>=4096)throw RangeError(`The combined service, name, and value exceed the macOS command limit.`);await d();let m=await e(a,[`-q`,`-i`],{input:p});if(u(m),m.stderr!==``||m.stdout!==``)throw r(l)},async delete(r,i){return await d(),u(await e(a,[`-q`,`delete-generic-password`,...n(r,i),t]),!0)}}}const d=`Linux credential operation failed; ensure /usr/bin/secret-tool and an unlocked Secret Service session are available`,f=`secrets:v1:`,p=new Set([`ERR_SECRETS_UNAVAILABLE`,`ERR_SECRETS_TIMEOUT`,`ERR_SECRETS_OUTPUT_LIMIT`,`ERR_SECRETS_STORE`,`ERR_SECRETS_ACCESS_DENIED`]);function m(e){return f+Buffer.from(e,`utf8`).toString(`base64`)}function h(e){if(!e.startsWith(f)||e.length>3427)throw r(d);let t=e.slice(11),n=Buffer.from(t,`base64`),i=n.toString(`utf8`);if(n.length>2560||n.toString(`base64`)!==t||!Buffer.from(i,`utf8`).equals(n))throw r(d);return i}function g({run:e=i}={}){async function t(t,n,i,a){let o=[`application`,`secrets`,`service`,m(n),`name`,m(i)],s;try{s=await e(`/usr/bin/secret-tool`,[t,...t===`store`?[`--label=secrets`]:t===`search`?[`--all`,`--unlock`]:[],`--`,...o],{input:t===`store`?m(a):``})}catch(e){let t=p.has(e?.code)?e.code:e?.code===`ENOENT`?`ERR_SECRETS_UNAVAILABLE`:e?.code===`EACCES`||e?.code===`EPERM`?`ERR_SECRETS_ACCESS_DENIED`:`ERR_SECRETS_STORE`;throw r(d,t)}if(!s||!Number.isInteger(s.code)||typeof s.stdout!=`string`||typeof s.stderr!=`string`||s.code!==0)throw r(d);if(t===`search`){let e=new Set([0,2,4].map(e=>`attribute.${o[e]} = ${o[e+1]}\n`));if((s.stderr.match(/[^\n]*\n|[^\n]+$/g)??[]).some(t=>!e.has(t)))throw r(d);if(s.stdout===``&&s.stderr===``)return!1;let t=/\[[^\r\n\]]+\]\nlabel = [^\r\n]*\nsecret = (secrets:v1:[A-Za-z0-9+/=]*)\ncreated = [^\r\n]*\nmodified = [^\r\n]*\n(?:schema = [^\r\n]*\n)?/gy,n=0,i;for(;(i=t.exec(s.stdout))!==null;)h(i[1]),n=t.lastIndex;if(n===0||n!==s.stdout.length)throw r(d);return!0}if(s.stderr!==``||t!==`lookup`&&s.stdout!==``)throw r(d);return t!==`lookup`||h(s.stdout)}return{async get(e,n){return await t(`search`,e,n)?t(`lookup`,e,n):null},async set(e,n,r){await t(`store`,e,n,r)},async delete(e,n){if(!await t(`search`,e,n))return!1;if(await t(`clear`,e,n),await t(`search`,e,n))throw r(d);return!0}}}const _=new URL(`./windows.ps1`,import.meta.url),v=`Windows credential operation failed`,y=new Set([`ERR_SECRETS_UNAVAILABLE`,`ERR_SECRETS_TIMEOUT`,`ERR_SECRETS_OUTPUT_LIMIT`,`ERR_SECRETS_STORE`,`ERR_SECRETS_ACCESS_DENIED`]);function b({run:e=i}={}){let a;async function o(i,o,s,c){let l=process.env.SystemRoot??process.env.SYSTEMROOT;if(typeof l!=`string`||!/^[a-z]:\\/i.test(l)||l.includes(`\0`))throw r(`Windows PowerShell is unavailable`,`ERR_SECRETS_UNAVAILABLE`);let u=n.win32.join(l,`System32`,`WindowsPowerShell`,`v1.0`,`powershell.exe`),d;try{a??=t(_,`utf8`).then(e=>Buffer.from(e,`utf16le`).toString(`base64`)),d=await e(u,[`-NoLogo`,`-NoProfile`,`-NonInteractive`,`-InputFormat`,`Text`,`-OutputFormat`,`Text`,`-EncodedCommand`,await a],{input:JSON.stringify({operation:i,service:o,name:s,...i===`set`?{value:c}:{}})})}catch(e){throw r(v,y.has(e?.code)?e.code:`ERR_SECRETS_STORE`)}let f;try{if(!d||!Number.isInteger(d.code)||typeof d.stdout!=`string`||(f=JSON.parse(d.stdout),!f||typeof f!=`object`||Array.isArray(f)||Object.keys(f).length!==1))throw null}catch{throw r(v)}if(d.code!==0){if(f.error===1168&&i!==`set`)return i===`get`&&null;let e=f.error===5?`ERR_SECRETS_ACCESS_DENIED`:f.error===1312||f.error===50||f.error===`ERR_SECRETS_UNAVAILABLE`?`ERR_SECRETS_UNAVAILABLE`:`ERR_SECRETS_STORE`;throw r(v,e)}if(d.stderr!==``||!Object.hasOwn(f,`value`))throw r(v);if(i===`get`){if(f.value!==null&&(typeof f.value!=`string`||!f.value.isWellFormed()||Buffer.byteLength(f.value,`utf8`)>2560))throw r(v);return f.value}if(i===`delete`&&typeof f.value==`boolean`)return f.value;if(i!==`set`||f.value!==!0)throw r(v)}return{get:(e,t)=>o(`get`,e,t),set:(e,t,n)=>o(`set`,e,t,n),delete:(e,t)=>o(`delete`,e,t)}}function x(e,t,n){if(typeof e!=`string`)throw TypeError(`${t} must be a string.`);if(!e.isWellFormed())throw TypeError(`${t} must contain valid Unicode.`);if(t!==`value`&&e.length===0)throw TypeError(`${t} must not be empty.`);if(Buffer.byteLength(e,`utf8`)>n)throw RangeError(`${t} must not exceed ${n} UTF-8 bytes.`);return e}function S(e,t){let n=e[0]!==null&&typeof e[0]==`object`&&!Array.isArray(e[0]);if(e.length!==(n?1:t?3:2))throw TypeError(`Expected an options object or service, name`+(t?`, value.`:`.`));let r=n?e[0]:{service:e[0],name:e[1],value:e[2]};return[x(r.service,`service`,256),x(r.name,`name`,256),...t?[x(r.value,`value`,2560)]:[]]}function C(){switch(process.platform){case`darwin`:return u();case`linux`:return g();case`win32`:return b();default:throw r(`Native secret storage is supported on macOS, Linux, and Windows.`,`ERR_SECRETS_UNSUPPORTED`)}}function w(e=C){let t,n=()=>t??=e();return Object.freeze({async get(...e){let t=S(e,!1);return n().get(...t)},async set(...e){let t=S(e,!0);await n().set(...t)},async delete(...e){let t=S(e,!1);return n().delete(...t)}})}const T=w();export{T as secrets};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
$ErrorActionPreference = 'Stop'
|
|
2
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
3
|
+
try {
|
|
4
|
+
if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage') {
|
|
5
|
+
throw 'Unavailable'
|
|
6
|
+
}
|
|
7
|
+
[Console]::InputEncoding = [System.Text.UTF8Encoding]::new($false, $true)
|
|
8
|
+
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false, $true)
|
|
9
|
+
Add-Type -TypeDefinition @'
|
|
10
|
+
using System;
|
|
11
|
+
using System.ComponentModel;
|
|
12
|
+
using System.Runtime.InteropServices;
|
|
13
|
+
using System.Text;
|
|
14
|
+
|
|
15
|
+
public static class SecretsCredentials {
|
|
16
|
+
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
|
17
|
+
private struct Credential {
|
|
18
|
+
public uint Flags;
|
|
19
|
+
public uint Type;
|
|
20
|
+
public IntPtr TargetName;
|
|
21
|
+
public IntPtr Comment;
|
|
22
|
+
public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten;
|
|
23
|
+
public uint CredentialBlobSize;
|
|
24
|
+
public IntPtr CredentialBlob;
|
|
25
|
+
public uint Persist;
|
|
26
|
+
public uint AttributeCount;
|
|
27
|
+
public IntPtr Attributes;
|
|
28
|
+
public IntPtr TargetAlias;
|
|
29
|
+
public IntPtr UserName;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[DllImport("advapi32.dll", EntryPoint = "CredWriteW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
|
33
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
34
|
+
private static extern bool CredWrite(ref Credential credential, uint flags);
|
|
35
|
+
[DllImport("advapi32.dll", EntryPoint = "CredReadW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
|
36
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
37
|
+
private static extern bool CredRead(string target, uint type, uint flags, out IntPtr credential);
|
|
38
|
+
[DllImport("advapi32.dll", EntryPoint = "CredDeleteW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
|
|
39
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
40
|
+
private static extern bool CredDelete(string target, uint type, uint flags);
|
|
41
|
+
[DllImport("advapi32.dll", ExactSpelling = true)]
|
|
42
|
+
private static extern void CredFree(IntPtr credential);
|
|
43
|
+
|
|
44
|
+
private static readonly Encoding Utf8 = new UTF8Encoding(false, true);
|
|
45
|
+
private static void Zero(IntPtr pointer, int length) {
|
|
46
|
+
if (pointer != IntPtr.Zero) for (int i = 0; i < length; i++) Marshal.WriteByte(pointer, i, 0);
|
|
47
|
+
}
|
|
48
|
+
public static string Target(string service, string name) {
|
|
49
|
+
// Length framing avoids both delimiter collisions and JSON serializer differences.
|
|
50
|
+
byte[] a = Utf8.GetBytes(service), b = Utf8.GetBytes(name);
|
|
51
|
+
if (a.Length > 256 || b.Length > 256) throw new ArgumentException();
|
|
52
|
+
byte[] framed = new byte[4 + a.Length + b.Length];
|
|
53
|
+
framed[0] = (byte)(a.Length >> 8); framed[1] = (byte)a.Length;
|
|
54
|
+
framed[2] = (byte)(b.Length >> 8); framed[3] = (byte)b.Length;
|
|
55
|
+
Buffer.BlockCopy(a, 0, framed, 4, a.Length);
|
|
56
|
+
Buffer.BlockCopy(b, 0, framed, 4 + a.Length, b.Length);
|
|
57
|
+
// Credential targets are case-insensitive; hex preserves identity under case folding.
|
|
58
|
+
string target = "secrets:" + BitConverter.ToString(framed).Replace("-", "").ToLowerInvariant();
|
|
59
|
+
if (target.Length > 32767) throw new ArgumentException();
|
|
60
|
+
return target;
|
|
61
|
+
}
|
|
62
|
+
public static void Write(string target, string value) {
|
|
63
|
+
byte[] bytes = Utf8.GetBytes(value);
|
|
64
|
+
IntPtr blob = IntPtr.Zero, targetPointer = IntPtr.Zero;
|
|
65
|
+
try {
|
|
66
|
+
if (bytes.Length > 2560) throw new ArgumentException();
|
|
67
|
+
targetPointer = Marshal.StringToCoTaskMemUni(target);
|
|
68
|
+
// Allocate one byte even for an empty secret; its native length remains zero.
|
|
69
|
+
blob = Marshal.AllocHGlobal(Math.Max(1, bytes.Length));
|
|
70
|
+
Marshal.WriteByte(blob, 0, 0);
|
|
71
|
+
if (bytes.Length != 0) Marshal.Copy(bytes, 0, blob, bytes.Length);
|
|
72
|
+
Credential credential = new Credential {
|
|
73
|
+
Type = 1, TargetName = targetPointer, CredentialBlob = blob,
|
|
74
|
+
CredentialBlobSize = (uint)bytes.Length, Persist = 3
|
|
75
|
+
};
|
|
76
|
+
if (!CredWrite(ref credential, 0)) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
77
|
+
} finally {
|
|
78
|
+
if (blob != IntPtr.Zero) { Zero(blob, Math.Max(1, bytes.Length)); Marshal.FreeHGlobal(blob); }
|
|
79
|
+
if (targetPointer != IntPtr.Zero) Marshal.ZeroFreeCoTaskMemUnicode(targetPointer);
|
|
80
|
+
Array.Clear(bytes, 0, bytes.Length);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
public static string Read(string target) {
|
|
84
|
+
IntPtr pointer = IntPtr.Zero;
|
|
85
|
+
Credential credential = new Credential();
|
|
86
|
+
byte[] bytes = null;
|
|
87
|
+
try {
|
|
88
|
+
if (!CredRead(target, 1, 0, out pointer)) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
89
|
+
credential = (Credential)Marshal.PtrToStructure(pointer, typeof(Credential));
|
|
90
|
+
if (credential.CredentialBlobSize > 2560 || (credential.CredentialBlobSize != 0 && credential.CredentialBlob == IntPtr.Zero)) throw new ArgumentException();
|
|
91
|
+
bytes = new byte[(int)credential.CredentialBlobSize];
|
|
92
|
+
if (bytes.Length != 0) Marshal.Copy(credential.CredentialBlob, bytes, 0, bytes.Length);
|
|
93
|
+
return Utf8.GetString(bytes);
|
|
94
|
+
} finally {
|
|
95
|
+
if (bytes != null) Array.Clear(bytes, 0, bytes.Length);
|
|
96
|
+
if (pointer != IntPtr.Zero) {
|
|
97
|
+
try {
|
|
98
|
+
// Rejected native lengths must not turn cleanup into an unbounded write.
|
|
99
|
+
Zero(credential.CredentialBlob, (int)Math.Min(credential.CredentialBlobSize, 2560u));
|
|
100
|
+
} finally { CredFree(pointer); }
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
public static bool Delete(string target) {
|
|
105
|
+
if (!CredDelete(target, 1, 0)) throw new Win32Exception(Marshal.GetLastWin32Error());
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
'@
|
|
110
|
+
$request = [Console]::In.ReadToEnd() | ConvertFrom-Json
|
|
111
|
+
if ($request.service -isnot [string] -or $request.name -isnot [string]) { throw 'Invalid request' }
|
|
112
|
+
$target = [SecretsCredentials]::Target($request.service, $request.name)
|
|
113
|
+
switch -CaseSensitive ($request.operation) {
|
|
114
|
+
'get' { $value = [SecretsCredentials]::Read($target) }
|
|
115
|
+
'set' {
|
|
116
|
+
if ($request.value -isnot [string]) { throw 'Invalid request' }
|
|
117
|
+
[SecretsCredentials]::Write($target, $request.value)
|
|
118
|
+
$value = $true
|
|
119
|
+
}
|
|
120
|
+
'delete' { $value = [SecretsCredentials]::Delete($target) }
|
|
121
|
+
default { throw 'Invalid request' }
|
|
122
|
+
}
|
|
123
|
+
[Console]::Out.WriteLine((ConvertTo-Json -Compress -InputObject @{ value = $value }))
|
|
124
|
+
exit 0
|
|
125
|
+
} catch {
|
|
126
|
+
# Never serialize exception messages: native and PowerShell errors can contain input.
|
|
127
|
+
$code = 'ERR_SECRETS_STORE'
|
|
128
|
+
if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage') {
|
|
129
|
+
# Full-language APIs may themselves be forbidden, so use only a fixed ASCII literal.
|
|
130
|
+
Write-Output '{"error":"ERR_SECRETS_UNAVAILABLE"}'
|
|
131
|
+
exit 1
|
|
132
|
+
}
|
|
133
|
+
$exception = $_.Exception
|
|
134
|
+
while ($null -ne $exception.InnerException) { $exception = $exception.InnerException }
|
|
135
|
+
if ($exception -is [System.ComponentModel.Win32Exception]) { $code = $exception.NativeErrorCode }
|
|
136
|
+
[Console]::Out.WriteLine((ConvertTo-Json -Compress -InputObject @{ error = $code }))
|
|
137
|
+
exit 1
|
|
138
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{canonicalSourceSlot,composeAgentModuleCandidates}from"#compiler/source-graph.js";const REQUIRED_FRAMEWORK_TOOL_SLOTS=new Set([`tools/connection_search`]);function assertFrameworkToolPolicy(e,t){let n=canonicalSourceSlot(e.logicalPath);if(n===`tools/connection_search`&&t.kind===`disabled`)throw Error(`The required "connection_search" tool cannot be disabled. Remove "agent/tools/connection_search.ts" or export a replacement tool from it.`);let r={"tools/agent":`self-agent`,"tools/task_cancel":`task-cancel
|
|
1
|
+
import{canonicalSourceSlot,composeAgentModuleCandidates}from"#compiler/source-graph.js";const REQUIRED_FRAMEWORK_TOOL_SLOTS=new Set([`tools/connection_search`]);function assertFrameworkToolPolicy(e,t){let n=canonicalSourceSlot(e.logicalPath);if(n===`tools/connection_search`&&t.kind===`disabled`)throw Error(`The required "connection_search" tool cannot be disabled. Remove "agent/tools/connection_search.ts" or export a replacement tool from it.`);let r={"tools/agent":`self-agent`,"tools/task_cancel":`task-cancel`}[n];if(r!==void 0&&t.kind===`tool`&&(t.definition.behavior?.handling?.kind!==`dispatch`||t.definition.behavior.handling.action!==r)){let e=n.slice(6);throw Error(`The framework "${e}" tool cannot be overridden. Re-export it from "eve/tools/${e}" or disable it with disableTool().`)}}function applyDefaultToolPolicy(e,t){if(t.defaultTools!==!1)return;let n=new Set(e.graph.orderedCandidates.filter(e=>e.layer!==`framework-default`).map(e=>canonicalSourceSlot(e.logicalPath)));e.graph.composed=composeAgentModuleCandidates(e.graph.orderedCandidates.filter(e=>{let t=canonicalSourceSlot(e.logicalPath);return e.layer!==`framework-default`||!t.startsWith(`tools/`)||REQUIRED_FRAMEWORK_TOOL_SLOTS.has(t)||n.has(t)}))}export{applyDefaultToolPolicy,assertFrameworkToolPolicy};
|
|
@@ -11,8 +11,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
|
11
11
|
readonly dropped: {};
|
|
12
12
|
};
|
|
13
13
|
readonly tool: {
|
|
14
|
-
readonly current:
|
|
15
|
-
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 28, 29, 30, 31, 32, 34, 35];
|
|
14
|
+
readonly current: 36;
|
|
15
|
+
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 28, 29, 30, 31, 32, 34, 35, 36];
|
|
16
16
|
readonly dropped: {
|
|
17
17
|
readonly 14: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
18
18
|
readonly 15: "TaskExec replaces stageEffect with send";
|
|
@@ -32,8 +32,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
readonly dynamicTool: {
|
|
35
|
-
readonly current:
|
|
36
|
-
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 28, 29, 30, 31, 32, 33];
|
|
35
|
+
readonly current: 34;
|
|
36
|
+
readonly supported: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 28, 29, 30, 31, 32, 33, 34];
|
|
37
37
|
readonly dropped: {
|
|
38
38
|
readonly 21: "Message and reasoning append events now expose deltas instead of cumulative snapshots.";
|
|
39
39
|
readonly 23: "TaskExec.delegated was removed; migrate to workflow-backed background tools";
|
|
@@ -58,8 +58,8 @@ declare const EXTENSION_CAPABILITY_CONTRACTS: {
|
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
readonly subagent: {
|
|
61
|
-
readonly current:
|
|
62
|
-
readonly supported: readonly [3, 4, 6, 7, 8, 9, 10, 11, 12];
|
|
61
|
+
readonly current: 13;
|
|
62
|
+
readonly supported: readonly [3, 4, 6, 7, 8, 9, 10, 11, 12, 13];
|
|
63
63
|
readonly dropped: {
|
|
64
64
|
readonly 1: "Persistent subagent sessions are now the default and the experimental opt-in was removed";
|
|
65
65
|
readonly 2: "Persistent subagent sessions are now the default and the experimental opt-in was removed";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=2,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,EXTENSION_CAPABILITY_CONTRACTS={extension:{current:1,supported:[1],dropped:{}},tool:{current:
|
|
1
|
+
import{readFile,writeFile}from"node:fs/promises";import{z}from"#compiled/zod/index.js";import{join}from"node:path";import{formatValidationError}from"#runtime/validation.js";const EXTENSION_COMPATIBILITY_MANIFEST_KIND=`eve-extension`,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION=2,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME=`_manifest.json`,EXTENSION_CAPABILITY_CONTRACTS={extension:{current:1,supported:[1],dropped:{}},tool:{current:36,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,28,29,30,31,32,34,35,36],dropped:{14:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,15:`TaskExec replaces stageEffect with send`,16:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,17:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,18:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,19:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,20:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,21:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,22:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,23:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,24:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,25:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,26:`Background tools now use task yield descriptors`,27:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,33:`ctx.agent now accepts the subagent name as its first argument, derives invocation identity internally, and infers structured output types`}},dynamicTool:{current:34,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,28,29,30,31,32,33,34],dropped:{21:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`,23:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,24:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,25:`TaskExec.delegated was removed; migrate to workflow-backed background tools`,26:`Background tools now use task yield descriptors`,27:`TaskExec.delegated was removed; migrate to workflow-backed background tools`}},channel:{current:19,supported:[1,2,3,4,5,6,7,8,9,10,11,13,14,15,16,17,18,19],dropped:{12:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},schedule:{current:11,supported:[1,2,3,4,6,7,8,9,10,11],dropped:{5:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},subagent:{current:13,supported:[3,4,6,7,8,9,10,11,12,13],dropped:{1:`Persistent subagent sessions are now the default and the experimental opt-in was removed`,2:`Persistent subagent sessions are now the default and the experimental opt-in was removed`,5:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},connection:{current:15,supported:[1,2,3,4,5,6,7,8,11,12,13,14,15],dropped:{9:`Dynamic connection resolvers no longer receive conversation or channel continuation data`,10:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},hook:{current:22,supported:[10,11,12,13,14,15,17,18,19,20,21,22],dropped:{1:`Model identity moved from session.started runtime metadata to step.started call attribution.`,2:`Model identity moved from session.started runtime metadata to step.started call attribution.`,3:`Model identity moved from session.started runtime metadata to step.started call attribution.`,4:`Model identity moved from session.started runtime metadata to step.started call attribution.`,5:`Model identity moved from session.started runtime metadata to step.started call attribution.`,6:`Model identity moved from session.started runtime metadata to step.started call attribution.`,7:`Model identity moved from session.started runtime metadata to step.started call attribution.`,8:`Model identity moved from session.started runtime metadata to step.started call attribution.`,9:`Model identity moved from session.started runtime metadata to step.started call attribution.`,16:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},skill:{current:1,supported:[1],dropped:{}},dynamicSkill:{current:17,supported:[1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,17],dropped:{13:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},instructions:{current:2,supported:[1,2],dropped:{}},dynamicInstructions:{current:18,supported:[1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,18],dropped:{14:`Message and reasoning append events now expose deltas instead of cumulative snapshots.`}},config:{current:1,supported:[1],dropped:{}},state:{current:5,supported:[1,2,3,4,5],dropped:{}}},EXTENSION_CAPABILITY_VERSIONS=Object.fromEntries(Object.entries(EXTENSION_CAPABILITY_CONTRACTS).map(([e,t])=>[e,t.current])),EXTENSION_CAPABILITY_SUPPORT=Object.keys(EXTENSION_CAPABILITY_CONTRACTS).reduce((e,t)=>(e[t]=EXTENSION_CAPABILITY_CONTRACTS[t].supported,e),{}),extensionCompatibilityManifestV1Schema=z.object({kind:z.literal(EXTENSION_COMPATIBILITY_MANIFEST_KIND),formatVersion:z.literal(1),builtWithEve:z.string().min(1),requires:z.record(z.string(),z.number().int().positive())}).strict(),extensionCompatibilityManifestV2Schema=extensionCompatibilityManifestV1Schema.extend({formatVersion:z.literal(2),build:z.object({externalDependencies:z.array(z.string().min(1)).readonly()}).strict().optional()}),extensionCompatibilityManifestSchema=z.union([extensionCompatibilityManifestV1Schema,extensionCompatibilityManifestV2Schema]);function serializeExtensionCompatibilityManifest(e){return`${JSON.stringify(e,null,2)}\n`}function parseExtensionCompatibilityManifest(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`Extension compatibility manifest "${t}" is not valid JSON: ${e instanceof Error?e.message:String(e)}`)}let r=extensionCompatibilityManifestSchema.safeParse(n);if(!r.success)throw Error(`Extension compatibility manifest "${t}" is invalid. ${formatValidationError(r.error)}`);return r.data}async function readExtensionCompatibilityManifest(e){return parseExtensionCompatibilityManifest(await readFile(e,`utf8`),e)}async function writeExtensionCompatibilityManifest(e,t){await writeFile(join(e,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),serializeExtensionCompatibilityManifest(t),`utf8`)}function findUnsupportedExtensionCapabilities(e,t=EXTENSION_CAPABILITY_SUPPORT){return Object.entries(e.requires).flatMap(([e,n])=>{let r=Object.hasOwn(t,e)?t[e]??[]:[];return r.includes(n)?[]:[{capability:e,requiredVersion:n,supportedVersions:r}]}).sort((e,t)=>e.capability.localeCompare(t.capability))}export{EXTENSION_CAPABILITY_SUPPORT,EXTENSION_CAPABILITY_VERSIONS,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,EXTENSION_COMPATIBILITY_MANIFEST_FORMAT_VERSION,EXTENSION_COMPATIBILITY_MANIFEST_KIND,findUnsupportedExtensionCapabilities,parseExtensionCompatibilityManifest,readExtensionCompatibilityManifest,serializeExtensionCompatibilityManifest,writeExtensionCompatibilityManifest};
|