eve 0.55.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/src/channel/audience.d.ts +3 -3
- package/dist/src/channel/conversation-context.d.ts +4 -2
- package/dist/src/channel/conversation-context.js +1 -1
- package/dist/src/chunks/{use-eve-agent-CxPlg0KL.js → use-eve-agent-CMdMlS7Y.js} +0 -10
- package/dist/src/chunks/{use-eve-agent-D-KQzzyW.js → use-eve-agent-RUGSwq8b.js} +0 -10
- package/dist/src/cli/commands/registry-metadata.d.ts +0 -18
- package/dist/src/cli/commands/registry-metadata.js +1 -1
- package/dist/src/cli/commands/registry-pnpm-build-policy-flow.js +1 -1
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/tui/blocks.d.ts +2 -0
- package/dist/src/cli/dev/tui/blocks.js +3 -3
- package/dist/src/cli/dev/tui/markdown.d.ts +8 -1
- package/dist/src/cli/dev/tui/markdown.js +7 -7
- package/dist/src/cli/dev/tui/runner.d.ts +4 -1
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +5 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/tui.d.ts +4 -1
- package/dist/src/cli/ui/terminal-text.js +1 -1
- package/dist/src/client/agent-info-schema.d.ts +0 -57
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +18 -8
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +12 -11
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-manifest.js +1 -1
- package/dist/src/compiler/normalize-tool.d.ts +0 -3
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/compiler/validate-artifact.js +1 -1
- package/dist/src/context/keys.d.ts +2 -0
- package/dist/src/context/keys.js +1 -1
- package/dist/src/eve-channel/audience.d.ts +2 -2
- package/dist/src/eve-channel/audience.js +1 -1
- package/dist/src/eve-channel/types.d.ts +5 -5
- package/dist/src/execution/coordination-dispatch-step.d.ts +2 -2
- 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-store.d.ts +0 -1
- package/dist/src/execution/dynamic-workflow/program-step.d.ts +21 -0
- package/dist/src/execution/dynamic-workflow/program-step.js +1 -0
- package/dist/src/execution/dynamic-workflow/schema.d.ts +36 -0
- package/dist/src/execution/dynamic-workflow/schema.js +1 -0
- package/dist/src/execution/dynamic-workflow/security-step.d.ts +3 -0
- package/dist/src/execution/dynamic-workflow/security-step.js +1 -0
- package/dist/src/execution/dynamic-workflow/tool.d.ts +8 -0
- package/dist/src/execution/dynamic-workflow/tool.js +1 -0
- package/dist/src/execution/dynamic-workflow/workflow.d.ts +10 -0
- package/dist/src/execution/dynamic-workflow/workflow.js +1 -0
- package/dist/src/execution/eve-workflow-attributes.d.ts +2 -1
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/inline-turn.js +1 -1
- package/dist/src/execution/model-call-batching.js +1 -1
- package/dist/src/execution/next-driver-action.d.ts +0 -8
- package/dist/src/execution/node-step.d.ts +0 -5
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/runtime-context.js +1 -1
- package/dist/src/execution/session.d.ts +0 -1
- package/dist/src/execution/session.js +2 -2
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/tasks/parent/delegate.d.ts +7 -0
- package/dist/src/execution/tasks/parent/delegate.js +1 -1
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/tools/sleep-workflow.js +1 -1
- package/dist/src/execution/tools/subagent/invoke-step.d.ts +2 -0
- package/dist/src/execution/tools/subagent/invoke-step.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/advertised-tools.d.ts +0 -3
- package/dist/src/harness/advertised-tools.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/types.d.ts +0 -21
- package/dist/src/instrumentation/content.js +1 -1
- package/dist/src/instrumentation/lifecycle.d.ts +5 -7
- package/dist/src/instrumentation/native-events.d.ts +2 -0
- package/dist/src/instrumentation/native-events.js +1 -1
- package/dist/src/instrumentation/runtime.js +1 -1
- package/dist/src/instrumentation/session-context.d.ts +2 -0
- package/dist/src/instrumentation/session-context.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/connection.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.d.ts +3 -4
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
- package/dist/src/internal/nitro/host/workflow-sandbox-runtime-plugin.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/public/channels/chat-sdk/audience.d.ts +2 -2
- package/dist/src/public/channels/index.d.ts +1 -1
- package/dist/src/public/channels/telegram/audience.d.ts +2 -2
- package/dist/src/public/connections/index.d.ts +1 -1
- package/dist/src/public/definitions/channel.d.ts +1 -1
- package/dist/src/public/definitions/connections/mcp.d.ts +1 -1
- package/dist/src/public/definitions/connections/openapi.d.ts +1 -1
- package/dist/src/public/tools/workflow.d.ts +1 -4
- package/dist/src/public/tools/workflow.js +1 -1
- package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
- package/dist/src/runtime/connections/authorization-tokens.d.ts +2 -4
- package/dist/src/runtime/connections/principal.d.ts +6 -6
- package/dist/src/runtime/connections/principal.js +1 -1
- package/dist/src/runtime/resolve-agent-graph.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/resolve-tool.js +1 -1
- package/dist/src/runtime/types.d.ts +3 -9
- package/dist/src/self-modification/extension/classify-registry-item.d.ts +3 -3
- package/dist/src/self-modification/extension/classify-registry-item.js +1 -1
- package/dist/src/self-modification/extension/tools/search_registry.d.ts +1 -7
- package/dist/src/self-modification/extension/tools/search_registry.js +1 -1
- package/dist/src/setup/flows/registry.js +1 -1
- package/dist/src/setup/integrations/self-modification/setup.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +6 -2
- package/dist/src/shared/channel-definition.d.ts +2 -2
- package/dist/src/shared/connection-types.d.ts +20 -7
- package/dist/src/shared/conversation-context.d.ts +15 -0
- package/dist/src/shared/validate-authorization.js +1 -1
- package/dist/src/shared/workflow-sandbox.d.ts +18 -12
- package/dist/src/shared/workflow-sandbox.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/session-index.d.ts +11 -0
- package/dist/src/tasks/session-index.js +1 -1
- package/dist/src/tools/auth.d.ts +5 -6
- package/dist/src/tools/provided/workflow.d.ts +12 -0
- package/dist/src/tools/provided/workflow.js +1 -0
- package/dist/src/tools/workflow-program-input.d.ts +6 -0
- package/dist/src/tools/workflow-program-input.js +1 -0
- package/dist/src/tracing/agent-otel-provider.js +1 -1
- package/dist/src/tracing/agent-otel-runtime-context.d.ts +2 -1
- package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
- package/dist/src/tracing/agent-otel-session-context.js +1 -1
- package/dist/src/tracing/agent-trace-context-codec.js +1 -1
- package/dist/src/tracing/agent-trace-state.d.ts +2 -0
- package/dist/src/tracing/content-attributes.js +1 -1
- package/dist/src/tracing/local-instrumentation-runtime.d.ts +1 -1
- package/dist/src/tracing/local-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/agent-config.md +1 -1
- package/docs/channels/chat-sdk.mdx +7 -0
- package/docs/channels/custom.mdx +16 -6
- package/docs/channels/eve.mdx +18 -18
- package/docs/channels/linear.mdx +7 -3
- package/docs/channels/overview.mdx +13 -0
- package/docs/channels/slack.mdx +9 -1
- package/docs/connections/mcp.mdx +4 -1
- package/docs/connections/openapi.mdx +8 -2
- package/docs/connections/overview.mdx +16 -13
- package/docs/getting-started.mdx +1 -1
- package/docs/guides/deployment/self-hosting.md +1 -1
- package/docs/guides/deployment/vercel.mdx +2 -2
- package/docs/guides/dev-tui.md +4 -4
- package/docs/guides/dynamic-capabilities.md +4 -4
- package/docs/guides/hooks.md +1 -1
- package/docs/guides/instrumentation/meta.json +4 -0
- package/docs/guides/instrumentation/otel.mdx +149 -0
- package/docs/guides/instrumentation/overview.md +199 -0
- package/docs/guides/instrumentation/providers.mdx +169 -0
- package/docs/guides/meta.json +0 -1
- package/docs/guides/remote-agents.md +19 -21
- package/docs/install-integrations.mdx +2 -4
- package/docs/patterns/multi-tenant-auth.md +3 -3
- package/docs/reference/cli.md +14 -14
- package/docs/reference/typescript-api.md +9 -9
- package/docs/subagents/index.mdx +2 -2
- package/docs/tools/workflows.mdx +56 -1
- package/package.json +1 -1
- package/dist/src/cli/commands/registry-package.d.ts +0 -52
- package/dist/src/cli/commands/registry-package.js +0 -1
- package/dist/src/harness/workflow-continuation-security.d.ts +0 -5
- package/dist/src/harness/workflow-continuation-security.js +0 -1
- package/dist/src/harness/workflow-interrupt-state.d.ts +0 -20
- package/dist/src/harness/workflow-interrupt-state.js +0 -1
- package/dist/src/harness/workflow-lifecycle.d.ts +0 -32
- package/dist/src/harness/workflow-lifecycle.js +0 -1
- package/dist/src/harness/workflow-sandbox.d.ts +0 -28
- package/dist/src/harness/workflow-sandbox.js +0 -2
- package/dist/src/harness/workflow-subagent-limit.d.ts +0 -28
- package/dist/src/harness/workflow-subagent-limit.js +0 -1
- package/dist/src/harness/workflow-task-state.d.ts +0 -9
- package/dist/src/harness/workflow-task-state.js +0 -1
- package/dist/src/harness/workflow-tool-description.d.ts +0 -22
- package/dist/src/harness/workflow-tool-description.js +0 -37
- package/dist/src/tools/workflow.d.ts +0 -37
- package/dist/src/tools/workflow.js +0 -1
- package/docs/guides/instrumentation-providers.md +0 -249
- package/docs/guides/instrumentation.md +0 -453
package/docs/tools/workflows.mdx
CHANGED
|
@@ -99,7 +99,62 @@ workflow and step modules reachable from the agent's runtime modules. Unrelated
|
|
|
99
99
|
in the host application stay outside the agent bundle. An unresolved workflow import fails
|
|
100
100
|
the build with the missing import in the error.
|
|
101
101
|
|
|
102
|
-
###
|
|
102
|
+
### Add a runtime-generated workflow tool
|
|
103
|
+
|
|
104
|
+
Create `agent/tools/workflow.ts` and export the provided `workflow` factory when the model should
|
|
105
|
+
supply the JavaScript program at runtime:
|
|
106
|
+
|
|
107
|
+
```ts title="agent/tools/workflow.ts"
|
|
108
|
+
import { workflow } from "eve/tools/workflow";
|
|
109
|
+
|
|
110
|
+
export default workflow({ maxSubagents: 20 });
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The model supplies an async function body through the tool's `js` input. Its only host capability is
|
|
114
|
+
`ctx.agent(name, { message, agentId?, outputSchema? })`. For example:
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
const [triage, review] = await Promise.all([
|
|
118
|
+
ctx.agent("ticket-triage", { message: JSON.stringify(tickets) }),
|
|
119
|
+
ctx.agent("ticket-review", { message: JSON.stringify(tickets) }),
|
|
120
|
+
]);
|
|
121
|
+
return { triage, review };
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`maxSubagents` defaults to `100` and must be an integer from `1` through `128`. The generated
|
|
125
|
+
program cannot access the workflow context, session state,
|
|
126
|
+
credentials, imports, or ordinary tools. Agent authorization, questions, approvals, cancellation,
|
|
127
|
+
and `agentId` continuation use the same owner-managed behavior as direct `ctx.agent` calls.
|
|
128
|
+
|
|
129
|
+
The sandbox resumes after every pending call in the current batch settles. `Promise.all` supports
|
|
130
|
+
fan-out followed by fan-in, but `Promise.race` does not resume after only the first child settles.
|
|
131
|
+
A child failure is thrown at the corresponding `ctx.agent` call, so generated code can catch it.
|
|
132
|
+
The program must return a JSON-serializable value.
|
|
133
|
+
|
|
134
|
+
### Migrate from `experimental_workflow`
|
|
135
|
+
|
|
136
|
+
The experimental uppercase `Workflow` framework tool and its exports have been removed. Replace the
|
|
137
|
+
old sentinel:
|
|
138
|
+
|
|
139
|
+
```diff
|
|
140
|
+
-import { experimental_workflow } from "eve/tools/workflow";
|
|
141
|
+
-
|
|
142
|
+
-export default experimental_workflow({ maxSubagents: 20 });
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
with the lowercase factory:
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
import { workflow } from "eve/tools/workflow";
|
|
149
|
+
|
|
150
|
+
export default workflow({ maxSubagents: 20 });
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The path gives the authored tool the model-facing name `workflow`. eve does not discover or inject
|
|
154
|
+
an agent catalog. Calls use the same target resolution, availability, and authorization checks as
|
|
155
|
+
`ctx.agent` in any other authored workflow tool.
|
|
156
|
+
|
|
157
|
+
### Migrate an authored workflow tool
|
|
103
158
|
|
|
104
159
|
Replace `defineTool` with `defineWorkflowTool`, keep the executor's `"use workflow"` directive,
|
|
105
160
|
and replace `agent(ctx, input)` and `ask(ctx, request)` with `ctx.agent(target, input)` and
|
package/package.json
CHANGED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { type RegistryConfig } from "#compiled/shadcn-registry/index.js";
|
|
2
|
-
import { z } from "#compiled/zod/index.js";
|
|
3
|
-
import { type Prompter } from "#setup/prompter.js";
|
|
4
|
-
import type { RegistrySetupCompletion } from "#setup/registry-setup-protocol.js";
|
|
5
|
-
import type { AddCommandOptions, RegistryCommandLogger } from "./registry.js";
|
|
6
|
-
import { type DeclaredPnpmBuildPolicy } from "./registry-pnpm-build-policy-flow.js";
|
|
7
|
-
import type { RegistrySetupCommand } from "./registry-setup-command.js";
|
|
8
|
-
export declare const RegistryPackageComponentSchema: z.ZodObject<{
|
|
9
|
-
item: z.ZodString;
|
|
10
|
-
label: z.ZodString;
|
|
11
|
-
description: z.ZodOptional<z.ZodString>;
|
|
12
|
-
default: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
export type RegistryPackageComponent = z.infer<typeof RegistryPackageComponentSchema>;
|
|
15
|
-
interface PackageMetadata {
|
|
16
|
-
requires?: string;
|
|
17
|
-
install?: {
|
|
18
|
-
pnpm?: {
|
|
19
|
-
buildScripts: readonly DeclaredPnpmBuildPolicy[];
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
setup?: RegistrySetupCommand[];
|
|
23
|
-
}
|
|
24
|
-
export interface RegistryPackageDependencies {
|
|
25
|
-
createPrompter?: () => Prompter;
|
|
26
|
-
hasInteractiveTerminal?: () => boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface RegistryPackageOperations {
|
|
29
|
-
itemAddress(item: string): string;
|
|
30
|
-
metadata(item: unknown): PackageMetadata | undefined;
|
|
31
|
-
assertCompatibleVersion(requiredVersion: string | undefined): void;
|
|
32
|
-
runSetups(input: {
|
|
33
|
-
item: string;
|
|
34
|
-
setups: RegistrySetupCommand[];
|
|
35
|
-
prompter: Prompter;
|
|
36
|
-
}): Promise<RegistrySetupCompletion | false>;
|
|
37
|
-
setupReminder(item: string): string;
|
|
38
|
-
}
|
|
39
|
-
export declare function runRegistryPackage(input: {
|
|
40
|
-
logger: RegistryCommandLogger;
|
|
41
|
-
appRoot: string;
|
|
42
|
-
item: string;
|
|
43
|
-
components: readonly RegistryPackageComponent[];
|
|
44
|
-
config: RegistryConfig;
|
|
45
|
-
options: AddCommandOptions & {
|
|
46
|
-
prompter?: Prompter;
|
|
47
|
-
signal?: AbortSignal;
|
|
48
|
-
};
|
|
49
|
-
dependencies: RegistryPackageDependencies;
|
|
50
|
-
operations: RegistryPackageOperations;
|
|
51
|
-
}): Promise<RegistrySetupCompletion | false>;
|
|
52
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hasInteractiveTerminal}from"./preconditions.js";import{headlessSetupContinuation,serializeHeadlessSetupEvent}from"./setup-headless.js";import{prepareDeclaredPnpmBuildPolicy}from"./registry-pnpm-build-policy-flow.js";import{z}from"#compiled/zod/index.js";import{createPrompter}from"#setup/prompter.js";import{headlessAsker,interactiveAsker,withAnswers,withPolicy}from"#setup/ask.js";import{mergeRegistrySetupCompletions}from"#setup/registry-setup-completion.js";import{addRegistryItems,getRegistryItems}from"#compiled/shadcn-registry/index.js";const RegistryPackageComponentSchema=z.object({item:z.string().min(1),label:z.string().min(1),description:z.string().optional(),default:z.boolean().default(!1)});async function selectComponents(e,t,n,r,i,a){if(r.prompter===void 0&&!r.nonInteractive&&(r.yes===!0||!i))return n.filter(e=>e.default);let o={key:`components`,message:`Add ${t}`,required:!0,recommended:n.filter(e=>e.default),options:n.map(e=>({id:e.item,value:e,label:e.label,hint:e.description}))},s=r.nonInteractive?withAnswers(r.answers??{})(r.yes?withPolicy(`assume`)(headlessAsker()):headlessAsker()):interactiveAsker(a());try{return await s.askMany(o)}catch(n){if(!r.nonInteractive||!(n instanceof Error)||n.name!==`InteractionRequired`)throw n;let i=n.question,{setupQuestionToWire:a}=await import(`#setup/setup-question-wire.js`),o=a(i);e.error(serializeHeadlessSetupEvent({version:1,type:`blocked`,status:`input_required`,item:t,installed:!1,completedItems:[],question:o,next:headlessSetupContinuation({item:t,installed:!1,answers:r.answers,question:o})})),process.exitCode=2;return}}async function runRegistryPackage(e){let{logger:t,appRoot:n,item:r,components:i,config:a,options:o,dependencies:s,operations:c}=e,l=s.hasInteractiveTerminal?.()??hasInteractiveTerminal(),u=o.prompter,getPrompter=()=>u??=s.createPrompter?.()??createPrompter(),d=await selectComponents(t,r,i,o,l,getPrompter);if(d===void 0)return!1;let f=d.map(e=>c.itemAddress(e.item)),p=await getRegistryItems(f,{config:a});if(p.length!==d.length)throw Error(`Registry package "${r}" could not resolve all selected components.`);let m=p.map(e=>{let t=c.metadata(e);return c.assertCompatibleVersion(t?.requires),t});if(o.skipInstall!==!0&&!await prepareDeclaredPnpmBuildPolicy({logger:t,appRoot:n,item:r,policies:m.flatMap(e=>e?.install?.pnpm?.buildScripts??[]),options:o}))return!1;o.skipInstall!==!0&&await addRegistryItems(f,{config:a,cwd:n,overwrite:o.overwrite,silent:o.silent});let h={facts:[]};if(o.skipSetup===!0)return h;if(!o.nonInteractive&&o.yes!==!0&&o.prompter===void 0&&!l)return t.log(c.setupReminder(r)),h;for(let e of m){if(e?.setup===void 0)continue;let t=await c.runSetups({item:r,setups:e.setup,prompter:getPrompter()});if(t===!1)return!1;h=mergeRegistrySetupCompletions(h,t)}return h}export{RegistryPackageComponentSchema,runRegistryPackage};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { HarnessSession } from "#harness/types.js";
|
|
2
|
-
import type { WorkflowSandboxContinuationSecurity } from "#shared/workflow-sandbox.js";
|
|
3
|
-
export declare function ensureWorkflowContinuationSecurity(session: HarnessSession): HarnessSession;
|
|
4
|
-
export declare function readWorkflowContinuationSecurity(session: HarnessSession): WorkflowSandboxContinuationSecurity | undefined;
|
|
5
|
-
export declare function getWorkflowContinuationSecurity(session: HarnessSession): WorkflowSandboxContinuationSecurity;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{randomBytes}from"node:crypto";const WORKFLOW_CONTINUATION_SECURITY_KEY=`eve.harness.workflowContinuationSecurity`;function ensureWorkflowContinuationSecurity(e){return e.state?.[WORKFLOW_CONTINUATION_SECURITY_KEY]===void 0?{...e,state:{...e.state,[WORKFLOW_CONTINUATION_SECURITY_KEY]:{signingKey:randomBytes(32).toString(`base64url`),version:1}}}:(getWorkflowContinuationSecurity(e),e)}function readWorkflowContinuationSecurity(e){let t=e.state?.[WORKFLOW_CONTINUATION_SECURITY_KEY];if(typeof t==`object`&&t&&t.version===1&&typeof t.signingKey==`string`&&/^[A-Za-z0-9_-]{43}$/.test(t.signingKey))return{signingKey:t.signingKey,maxAgeMs:31536e6}}function getWorkflowContinuationSecurity(e){let t=readWorkflowContinuationSecurity(e);if(t===void 0)throw Error(`Workflow continuation security state is missing or invalid.`);return t}export{ensureWorkflowContinuationSecurity,getWorkflowContinuationSecurity,readWorkflowContinuationSecurity};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ModelMessage } from "ai";
|
|
2
|
-
import type { HarnessSession, SessionStateMap } from "#harness/types.js";
|
|
3
|
-
import type { WorkflowSandboxInterrupt } from "#shared/workflow-sandbox.js";
|
|
4
|
-
export interface PendingWorkflowInterrupt {
|
|
5
|
-
readonly interrupt: WorkflowSandboxInterrupt;
|
|
6
|
-
readonly responseMessages: readonly ModelMessage[];
|
|
7
|
-
readonly usedCalls: number;
|
|
8
|
-
}
|
|
9
|
-
export declare function getPendingWorkflowInterrupt(state: SessionStateMap | undefined): PendingWorkflowInterrupt | undefined;
|
|
10
|
-
export declare function setPendingWorkflowInterrupt(input: {
|
|
11
|
-
readonly interrupt: WorkflowSandboxInterrupt;
|
|
12
|
-
readonly responseMessages: readonly ModelMessage[];
|
|
13
|
-
readonly session: HarnessSession;
|
|
14
|
-
readonly usedCalls: number;
|
|
15
|
-
}): HarnessSession;
|
|
16
|
-
export declare function setPendingWorkflowUsedCalls(input: {
|
|
17
|
-
readonly session: HarnessSession;
|
|
18
|
-
readonly usedCalls: number;
|
|
19
|
-
}): HarnessSession;
|
|
20
|
-
export declare function clearPendingWorkflowInterrupt(session: HarnessSession): HarnessSession;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{WORKFLOW_TASK_INTERRUPT_KIND}from"#harness/workflow-task-state.js";const PENDING_KEY=`eve.harness.pendingWorkflowInterrupt`;function getPendingWorkflowInterrupt(e){let t=e?.[PENDING_KEY];if(isRecord(t)&&isWorkflowInterruptShape(t.interrupt)&&Array.isArray(t.responseMessages)&&!(!Number.isSafeInteger(t.usedCalls)||t.usedCalls<0))return{interrupt:t.interrupt,responseMessages:t.responseMessages,usedCalls:t.usedCalls}}function setPendingWorkflowInterrupt(e){return{...e.session,state:{...e.session.state,[PENDING_KEY]:{interrupt:e.interrupt,responseMessages:e.responseMessages,usedCalls:e.usedCalls}}}}function setPendingWorkflowUsedCalls(e){let t=getPendingWorkflowInterrupt(e.session.state);return t===void 0?e.session:setPendingWorkflowInterrupt({...t,session:e.session,usedCalls:e.usedCalls})}function clearPendingWorkflowInterrupt(e){if(e.state?.[PENDING_KEY]===void 0)return e;let t={...e.state};return delete t[PENDING_KEY],{...e,state:Object.keys(t).length>0?t:void 0}}function isWorkflowInterruptShape(e){return isRecord(e)&&e.type===`code-mode-interrupt`&&typeof e.interruptId==`string`&&typeof e.outerToolCallId==`string`&&isRecord(e.payload)&&e.payload.kind===WORKFLOW_TASK_INTERRUPT_KIND&&isRecord(e.continuation)&&e.continuation.version===2&&typeof e.continuation.outerToolCallId==`string`&&Array.isArray(e.continuation.pendingInterruptions)&&Array.isArray(e.continuation.resolutions)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{clearPendingWorkflowInterrupt,getPendingWorkflowInterrupt,setPendingWorkflowInterrupt,setPendingWorkflowUsedCalls};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { HarnessEmissionState } from "#harness/emission.js";
|
|
2
|
-
import type { HarnessEmitFn, HarnessToolMap } from "#harness/types.js";
|
|
3
|
-
import type { WorkflowSandboxInterrupt } from "#shared/workflow-sandbox.js";
|
|
4
|
-
export declare function createWorkflowLifecycle(input: {
|
|
5
|
-
readonly emit: EmitWorkflowLifecycleEvent;
|
|
6
|
-
readonly emissionState: HarnessEmissionState;
|
|
7
|
-
readonly skipReplayed?: boolean;
|
|
8
|
-
readonly tools: HarnessToolMap;
|
|
9
|
-
}): {
|
|
10
|
-
onAfterExecute?: (input: {
|
|
11
|
-
readonly result: unknown;
|
|
12
|
-
}) => Promise<void>;
|
|
13
|
-
};
|
|
14
|
-
type EmitWorkflowLifecycleEvent = HarnessEmitFn;
|
|
15
|
-
/** Projects newly parked workflow calls onto eve's existing action stream. */
|
|
16
|
-
export declare function emitWorkflowActionsRequested(input: {
|
|
17
|
-
readonly emit: EmitWorkflowLifecycleEvent;
|
|
18
|
-
readonly emissionState: HarnessEmissionState;
|
|
19
|
-
readonly interrupts: readonly WorkflowSandboxInterrupt[];
|
|
20
|
-
readonly tools: HarnessToolMap;
|
|
21
|
-
}): Promise<void>;
|
|
22
|
-
/** Projects completed workflow children before replaying their continuation. */
|
|
23
|
-
export declare function emitWorkflowActionResults(input: {
|
|
24
|
-
readonly emit: EmitWorkflowLifecycleEvent;
|
|
25
|
-
readonly emissionState: HarnessEmissionState;
|
|
26
|
-
readonly interrupts: readonly WorkflowSandboxInterrupt[];
|
|
27
|
-
readonly results: readonly {
|
|
28
|
-
readonly isError?: boolean;
|
|
29
|
-
readonly output?: unknown;
|
|
30
|
-
}[];
|
|
31
|
-
}): Promise<void>;
|
|
32
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createActionResultEvent,createActionsRequestedEvent}from"#protocol/message.js";import{collectActionPresentation,createPresentedRuntimeActionRequestFromToolCall}from"#harness/action-presentation.js";import{createRuntimeToolResultFromValue}from"#harness/action-result-helpers.js";import{getWorkflowSandboxInterrupt}from"#shared/workflow-sandbox.js";function createWorkflowLifecycle(e){return{async onAfterExecute(t){if(e.skipReplayed)return;let n=await getWorkflowSandboxInterrupt(t.result,{});n!==void 0&&await emitWorkflowActionsRequested({emit:e.emit,emissionState:e.emissionState,interrupts:[n],tools:e.tools})}}}async function emitWorkflowActionsRequested(e){for(let t of e.interrupts){let n={input:t.input,toolCallId:t.toolCallId,toolName:t.toolName,type:`tool-call`},r=createPresentedRuntimeActionRequestFromToolCall({toolCall:n,tools:e.tools});await e.emit(createActionsRequestedEvent({actions:[r.action],presentation:collectActionPresentation([r]),sequence:e.emissionState.sequence,stepIndex:e.emissionState.stepIndex,turnId:e.emissionState.turnId}))}}async function emitWorkflowActionResults(e){for(let[t,n]of e.results.entries()){let r=e.interrupts[t];if(r===void 0)break;await e.emit(createActionResultEvent({result:createRuntimeToolResultFromValue({callId:r.toolCallId,isError:n.isError,output:n.output,toolName:r.toolName}),sequence:e.emissionState.sequence,stepIndex:e.emissionState.stepIndex,turnId:e.emissionState.turnId}))}}export{createWorkflowLifecycle,emitWorkflowActionResults,emitWorkflowActionsRequested};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ToolSet } from "ai";
|
|
2
|
-
import type { HarnessToolMap } from "#harness/types.js";
|
|
3
|
-
import { type WorkflowSandboxContinuationSecurity } from "#shared/workflow-sandbox.js";
|
|
4
|
-
interface WorkflowToolSet {
|
|
5
|
-
readonly hostTools: ToolSet;
|
|
6
|
-
readonly modelTools: ToolSet;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Adds the dynamic `Workflow` tool while leaving every ordinary model tool
|
|
10
|
-
* untouched. Only workflow-callable delegation tasks enter the sandbox.
|
|
11
|
-
*/
|
|
12
|
-
export declare function applyWorkflowTool(input: {
|
|
13
|
-
readonly continuationSecurity: WorkflowSandboxContinuationSecurity;
|
|
14
|
-
readonly harnessTools: HarnessToolMap;
|
|
15
|
-
readonly maxSubagents?: number;
|
|
16
|
-
readonly tools: ToolSet;
|
|
17
|
-
}): Promise<WorkflowToolSet>;
|
|
18
|
-
/**
|
|
19
|
-
* Keeps code mode's bridge capacity strictly above eve's dispatch budget.
|
|
20
|
-
* The extra request lets the first over-budget call resolve through eve's
|
|
21
|
-
* `WORKFLOW_SUBAGENT_LIMIT_REACHED` result instead of failing the sandbox.
|
|
22
|
-
*/
|
|
23
|
-
export declare function resolveWorkflowSandboxBridgeRequestLimit(maxSubagents?: number): number;
|
|
24
|
-
/** Rebuilds the subagent-only host surface used to resume a parked workflow. */
|
|
25
|
-
export declare function buildWorkflowHostTools(input: {
|
|
26
|
-
readonly tools: HarnessToolMap;
|
|
27
|
-
}): ToolSet;
|
|
28
|
-
export {};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{DEFAULT_WORKFLOW_MAX_SUBAGENTS}from"#harness/workflow-subagent-limit.js";import{WORKFLOW_TASK_INTERRUPT_KIND}from"#harness/workflow-task-state.js";import{WORKFLOW_TOOL_NAME,createWorkflowSandboxTool,readWorkflowSandboxResolution,requestWorkflowSandboxInterrupt}from"#shared/workflow-sandbox.js";import{workflowToolDescription}from"#harness/workflow-tool-description.js";const workflowInputSchema=z.strictObject({js:z.string().describe(`Complete JavaScript orchestration program. Call only the agents listed in the Workflow description and return one JSON-serializable result.`)});async function applyWorkflowTool(e){let t=createWorkflowHostTools(e.harnessTools,Object.keys(e.tools));if(Object.keys(t).length===0)return{hostTools:t,modelTools:e.tools};let n=await createWorkflowSandboxTool({bridgeRequestLimit:resolveWorkflowSandboxBridgeRequestLimit(e.maxSubagents),continuationSecurity:e.continuationSecurity,hostTools:t}),r=typeof n.description==`string`?n.description:``,i=workflowToolDescription(Object.keys(t),{maxSubagents:e.maxSubagents}),a=workflowApiReference(r),o={...e.tools};return o[WORKFLOW_TOOL_NAME]={...n,description:a.length>0?`${i}\n\n${a}`:i,inputSchema:workflowInputSchema},{hostTools:t,modelTools:o}}function resolveWorkflowSandboxBridgeRequestLimit(e){return Math.max(256,(e??DEFAULT_WORKFLOW_MAX_SUBAGENTS)+1)}function workflowApiReference(e){let t=e.indexOf(`Tools:
|
|
2
|
-
`);return t<0?e:`Available agent API:\n${e.slice(t+7)}`}function buildWorkflowHostTools(e){return createWorkflowHostTools(e.tools,e.tools.keys())}function createWorkflowHostTools(e,t){let n={};for(let r of t){let t=e.get(r);t?.workflowId!==void 0&&(n[r]=createWorkflowTaskHostTool(t))}return n}function createWorkflowTaskHostTool(e){return{description:e.description,inputSchema:e.inputSchema,execute:async(t,n)=>{let r=readWorkflowSandboxResolution(n);return r===void 0?requestWorkflowSandboxInterrupt({kind:WORKFLOW_TASK_INTERRUPT_KIND,task:{executeInput:e.executeInput?.(t),nodeId:e.nodeId,resultKind:e.resultKind,workflowId:e.workflowId},toolInput:t,toolName:e.name}):r}}}export{applyWorkflowTool,buildWorkflowHostTools,resolveWorkflowSandboxBridgeRequestLimit};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { RuntimeWorkflowTaskRequest } from "#shared/action-types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Default maximum number of subagent (and remote-agent) calls one `Workflow`
|
|
4
|
-
* tool invocation may dispatch.
|
|
5
|
-
*/
|
|
6
|
-
export declare const DEFAULT_WORKFLOW_MAX_SUBAGENTS = 100;
|
|
7
|
-
/**
|
|
8
|
-
* Partition of one workflow interrupt's pending tasks against the invocation's
|
|
9
|
-
* subagent budget. Allowed tasks may dispatch; blocked tasks resolve with an
|
|
10
|
-
* error result instead of starting a child.
|
|
11
|
-
*/
|
|
12
|
-
export type WorkflowSubagentDispatchPlan = {
|
|
13
|
-
readonly allowed: readonly RuntimeWorkflowTaskRequest[];
|
|
14
|
-
readonly blocked: readonly RuntimeWorkflowTaskRequest[];
|
|
15
|
-
readonly maxSubagents: number;
|
|
16
|
-
readonly usedCalls: number;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Splits the pending actions of one workflow interrupt into the prefix that
|
|
20
|
-
* still fits the invocation's `maxSubagents` budget and the remainder that
|
|
21
|
-
* must be blocked. Actions keep request order so results pair with the sandbox
|
|
22
|
-
* program's call order.
|
|
23
|
-
*/
|
|
24
|
-
export declare function planWorkflowSubagentDispatch(input: {
|
|
25
|
-
readonly tasks: readonly RuntimeWorkflowTaskRequest[];
|
|
26
|
-
readonly maxSubagents?: number;
|
|
27
|
-
readonly usedCalls: number;
|
|
28
|
-
}): WorkflowSubagentDispatchPlan;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const DEFAULT_WORKFLOW_MAX_SUBAGENTS=100;function planWorkflowSubagentDispatch(e){let t=e.maxSubagents??100,n=e.usedCalls,r=Math.max(0,t-n),i=[],a=[];for(let t of e.tasks)t.resultKind===`subagent`?r>0?(i.push(t),r--):a.push(t):i.push(t);return{allowed:i,blocked:a,maxSubagents:t,usedCalls:n}}export{DEFAULT_WORKFLOW_MAX_SUBAGENTS,planWorkflowSubagentDispatch};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { RuntimeWorkflowTaskRequest } from "#shared/action-types.js";
|
|
2
|
-
import { type WorkflowSandboxInterrupt } from "#shared/workflow-sandbox.js";
|
|
3
|
-
export declare const WORKFLOW_TASK_INTERRUPT_KIND = "eve.workflow-task";
|
|
4
|
-
export declare function isWorkflowTaskInterrupt(interrupt: unknown): boolean;
|
|
5
|
-
export declare function buildWorkflowTaskFromInterrupt(interrupt: WorkflowSandboxInterrupt): RuntimeWorkflowTaskRequest;
|
|
6
|
-
/** Returns every pending workflow-task interrupt in deterministic ledger order. */
|
|
7
|
-
export declare function getWorkflowTaskInterrupts(interrupt: WorkflowSandboxInterrupt): WorkflowSandboxInterrupt[];
|
|
8
|
-
export declare function buildWorkflowTasksFromInterrupt(interrupt: WorkflowSandboxInterrupt): RuntimeWorkflowTaskRequest[];
|
|
9
|
-
export declare function getWorkflowTaskCallIds(interrupt: WorkflowSandboxInterrupt): string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getWorkflowSandboxPendingInterrupts}from"#shared/workflow-sandbox.js";const WORKFLOW_TASK_INTERRUPT_KIND=`eve.workflow-task`;function isWorkflowTaskInterrupt(e){return isRecord(e)&&isRecord(e.payload)&&e.payload.kind===`eve.workflow-task`}function buildWorkflowTaskFromInterrupt(e){let t=e.payload,n=t.task,r=t.toolInput,i=t.toolName,a=sanitizeCallId(`${i}_${`interruptId`in e?String(e.interruptId):``}`);if(n===void 0||typeof n.workflowId!=`string`)throw Error(`Workflow delegation interrupts require a workflow task.`);let o={callId:a,executeInput:n.executeInput,input:r,kind:`workflow-task`,resultKind:n.resultKind,toolName:i,workflowId:n.workflowId};return n.nodeId!==void 0&&(o.nodeId=n.nodeId),o}function getWorkflowTaskInterrupts(e){return getWorkflowSandboxPendingInterrupts(e).filter(isWorkflowTaskInterrupt)}function buildWorkflowTasksFromInterrupt(e){return getWorkflowTaskInterrupts(e).map(e=>buildWorkflowTaskFromInterrupt(e))}function getWorkflowTaskCallIds(e){return buildWorkflowTasksFromInterrupt(e).map(e=>e.callId)}function sanitizeCallId(e){return e.replace(/[^a-zA-Z0-9_-]/g,`_`)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{WORKFLOW_TASK_INTERRUPT_KIND,buildWorkflowTaskFromInterrupt,buildWorkflowTasksFromInterrupt,getWorkflowTaskCallIds,getWorkflowTaskInterrupts,isWorkflowTaskInterrupt};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builds the model-facing description for the `Workflow` orchestration tool.
|
|
3
|
-
*
|
|
4
|
-
* Dynamic in the agent's callable agents:
|
|
5
|
-
* - lists every callable agent by name (the built-in `agent` plus one per
|
|
6
|
-
* declared subagent and remote agent);
|
|
7
|
-
* - the worked example uses only the built-in `agent`, so it is valid for any
|
|
8
|
-
* agent;
|
|
9
|
-
* - a single simple subagent example is appended *only when* the agent has a
|
|
10
|
-
* declared subagent or remote agent (i.e. an agent other than `agent`).
|
|
11
|
-
*
|
|
12
|
-
* The sandbox package's generated input signatures are appended after this
|
|
13
|
-
* framing.
|
|
14
|
-
*
|
|
15
|
-
* @param toolNames - Names of the agent functions callable inside the sandbox.
|
|
16
|
-
* @param options - `maxSubagents`: the invocation's subagent-call budget
|
|
17
|
-
* (defaults to {@link DEFAULT_WORKFLOW_MAX_SUBAGENTS}), surfaced so the
|
|
18
|
-
* model sizes its fan-out to fit.
|
|
19
|
-
*/
|
|
20
|
-
export declare function workflowToolDescription(toolNames: readonly string[], options?: {
|
|
21
|
-
readonly maxSubagents?: number;
|
|
22
|
-
}): string;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import{DEFAULT_WORKFLOW_MAX_SUBAGENTS}from"#harness/workflow-subagent-limit.js";function workflowToolDescription(e,t){let n=t?.maxSubagents??DEFAULT_WORKFLOW_MAX_SUBAGENTS,r=e.length>0?e:[`agent`],i=r.map(e=>`\`${e}\``).join(`, `),a=r.filter(e=>e!==`agent`),o=a.length>0?`\n\nDeclared subagents use the same API — e.g. \`const note = await ${agentAccess(a[0])}({ message: "..." });\`.`:``;return`Use \`Workflow\` when a task needs JavaScript to coordinate multiple child-agent calls as one durable step. It is an orchestration tool, not a general-purpose tool runner.
|
|
2
|
-
|
|
3
|
-
Use \`Workflow\` for:
|
|
4
|
-
- fan-out or map-reduce over a list, especially when the number of calls comes from runtime data;
|
|
5
|
-
- dependent pipelines where one agent's result becomes another agent's input;
|
|
6
|
-
- conditional branches or follow-up calls chosen from earlier results;
|
|
7
|
-
- deterministic filtering, sorting, or aggregation of several agent results before returning one value.
|
|
8
|
-
|
|
9
|
-
Do not use \`Workflow\` when:
|
|
10
|
-
- one delegation, or a small fixed set of unrelated delegations, can be called directly;
|
|
11
|
-
- no child-agent call is needed;
|
|
12
|
-
- the task needs files, network, shell, connections, skills, or ordinary tools — none are available inside Workflow;
|
|
13
|
-
- JavaScript would only wrap work the parent agent can express more clearly with direct calls.
|
|
14
|
-
|
|
15
|
-
Workflow earns its overhead when code materially controls call count, concurrency, ordering, data flow, or aggregation. Put the complete orchestration in one JavaScript program and return the final JSON-serializable value.
|
|
16
|
-
|
|
17
|
-
One Workflow program may dispatch at most ${String(n)} agent calls in total (sequential and parallel calls alike); calls beyond that budget fail with \`WORKFLOW_SUBAGENT_LIMIT_REACHED\` instead of running. Size fan-outs to fit the budget.
|
|
18
|
-
|
|
19
|
-
The only callable operations are these agents — no filesystem, network, shell, or other tools: ${i}. Call them only through the \`tools\` object, using the exact member syntax in the API reference below. Each call is async and resolves to the child's result, or a typed object when you pass an \`outputSchema\`. Sequence with \`await\`, run agents concurrently with \`Promise.all([...])\`, and use \`map\`/\`filter\`/\`flatMap\` to build calls and combine results. The program's return value becomes the tool result.
|
|
20
|
-
|
|
21
|
-
Example — fan out across areas with \`agent\`, then pipe the results into a synthesis step:
|
|
22
|
-
\`\`\`js
|
|
23
|
-
const areas = ["correctness", "security", "performance"];
|
|
24
|
-
const reviews = await Promise.all(
|
|
25
|
-
areas.map((area) =>
|
|
26
|
-
tools.agent({
|
|
27
|
-
message: \`Review the change for \${area}.\`,
|
|
28
|
-
outputSchema: { type: "object", properties: { findings: { type: "array", items: { type: "string" } } } },
|
|
29
|
-
}),
|
|
30
|
-
),
|
|
31
|
-
);
|
|
32
|
-
const verdict = await tools.agent({
|
|
33
|
-
message: \`Summarize these findings into a verdict: \${JSON.stringify(reviews)}\`,
|
|
34
|
-
outputSchema: { type: "object", properties: { verdict: { type: "string" }, blocking: { type: "boolean" } } },
|
|
35
|
-
});
|
|
36
|
-
return verdict;
|
|
37
|
-
\`\`\`${o}`}function agentAccess(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/u.test(e)?`tools.${e}`:`tools[${JSON.stringify(e)}]`}export{workflowToolDescription};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
declare const EXPERIMENTAL_WORKFLOW_TOOL_KIND = "eve:enable-workflow-tool";
|
|
2
|
-
/** Configuration accepted by {@link experimental_workflow}. */
|
|
3
|
-
export interface ExperimentalWorkflowToolInput {
|
|
4
|
-
/**
|
|
5
|
-
* Maximum number of subagent or remote-agent calls one `Workflow` program
|
|
6
|
-
* may dispatch, counted across sequential and parallel calls alike.
|
|
7
|
-
*
|
|
8
|
-
* Calls beyond the limit fail with a `WORKFLOW_SUBAGENT_LIMIT_REACHED`
|
|
9
|
-
* result instead of starting a child session.
|
|
10
|
-
*
|
|
11
|
-
* @default 100
|
|
12
|
-
*/
|
|
13
|
-
readonly maxSubagents?: number;
|
|
14
|
-
}
|
|
15
|
-
/** Framework `Workflow` tool definition returned by {@link experimental_workflow}. */
|
|
16
|
-
export interface ExperimentalWorkflowToolDefinition extends ExperimentalWorkflowToolInput {
|
|
17
|
-
readonly kind: typeof EXPERIMENTAL_WORKFLOW_TOOL_KIND;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Enables and configures the experimental framework `Workflow` tool, an
|
|
21
|
-
* isolated JavaScript sandbox whose only callable operations are this agent's
|
|
22
|
-
* subagents and remote agents. Export the result from
|
|
23
|
-
* `agent/tools/workflow.ts`:
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
* import { experimental_workflow } from "eve/tools";
|
|
27
|
-
*
|
|
28
|
-
* export default experimental_workflow({ maxSubagents: 25 });
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* Only the root session sees the tool. The resulting model-facing tool is
|
|
32
|
-
* still called `Workflow`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function experimental_workflow(input?: ExperimentalWorkflowToolInput): ExperimentalWorkflowToolDefinition;
|
|
35
|
-
/** Type guard for a definition returned by {@link experimental_workflow}. */
|
|
36
|
-
export declare function isExperimentalWorkflowToolDefinition(value: unknown): value is ExperimentalWorkflowToolDefinition;
|
|
37
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const EXPERIMENTAL_WORKFLOW_TOOL_KIND=`eve:enable-workflow-tool`;function experimental_workflow(e={}){let t={kind:EXPERIMENTAL_WORKFLOW_TOOL_KIND};return e.maxSubagents!==void 0&&(t.maxSubagents=e.maxSubagents),t}function isExperimentalWorkflowToolDefinition(e){return typeof e==`object`&&!!e&&e.kind===EXPERIMENTAL_WORKFLOW_TOOL_KIND}export{experimental_workflow,isExperimentalWorkflowToolDefinition};
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Instrumentation Providers"
|
|
3
|
-
description: "Configure the experimental instrumentation provider layout, control captured inputs and outputs, and redact OpenTelemetry spans before export."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Instrumentation providers split observability into files under `agent/instrumentation/`. Each file can handle eve lifecycle events or add an OpenTelemetry destination without owning the rest of the telemetry pipeline.
|
|
7
|
-
|
|
8
|
-
**This API is experimental and may change without a deprecation period.** Enable it explicitly in `agent.ts`:
|
|
9
|
-
|
|
10
|
-
```ts title="agent/agent.ts"
|
|
11
|
-
import { defineAgent } from "eve";
|
|
12
|
-
|
|
13
|
-
export default defineAgent({
|
|
14
|
-
model: "anthropic/claude-sonnet-5",
|
|
15
|
-
experimental: {
|
|
16
|
-
instrumentationProviders: true,
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The provider directory replaces `agent/instrumentation.ts`; the two layouts cannot be used together. See [Observability](./instrumentation) for the default `instrumentation.ts` API.
|
|
22
|
-
|
|
23
|
-
## Add a provider
|
|
24
|
-
|
|
25
|
-
The filename identifies the provider slot. Each file must default-export `defineInstrumentation(...)`, an OpenTelemetry integration, or `disableInstrumentation()`.
|
|
26
|
-
|
|
27
|
-
```text
|
|
28
|
-
agent/instrumentation/
|
|
29
|
-
audit.ts lifecycle event provider
|
|
30
|
-
braintrust.ts OpenTelemetry destination
|
|
31
|
-
otel.ts process-wide OpenTelemetry settings
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
This provider records action timing and identity without receiving tool arguments or results:
|
|
35
|
-
|
|
36
|
-
```ts title="agent/instrumentation/audit.ts"
|
|
37
|
-
import { defineInstrumentation } from "eve/instrumentation";
|
|
38
|
-
|
|
39
|
-
export default defineInstrumentation({
|
|
40
|
-
events: {
|
|
41
|
-
"action.started": (event, ctx) => {
|
|
42
|
-
ctx.state.set({ name: event.name, startedAt: Date.now() });
|
|
43
|
-
},
|
|
44
|
-
"action.completed": (event, ctx) => {
|
|
45
|
-
const started = ctx.state.get() as { name: string; startedAt: number } | undefined;
|
|
46
|
-
if (started === undefined) return;
|
|
47
|
-
|
|
48
|
-
console.log({
|
|
49
|
-
action: started.name,
|
|
50
|
-
durationMs: Date.now() - started.startedAt,
|
|
51
|
-
outcome: event.outcome,
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
`ctx.state` is JSON storage scoped to this provider and operation. It survives durable suspension and is released after the terminal event.
|
|
59
|
-
|
|
60
|
-
## Control inputs and outputs
|
|
61
|
-
|
|
62
|
-
Each provider has an independent `tracePolicy`. It decides whether the provider receives events and whether those events include input or output content.
|
|
63
|
-
|
|
64
|
-
```ts title="agent/instrumentation/audit.ts"
|
|
65
|
-
import { defineInstrumentation } from "eve/instrumentation";
|
|
66
|
-
|
|
67
|
-
export default defineInstrumentation({
|
|
68
|
-
tracePolicy: ({ audience, environment }) => ({
|
|
69
|
-
emit: true,
|
|
70
|
-
recordInputs: audience === "public" || environment === "development",
|
|
71
|
-
recordOutputs: audience === "public" || environment === "development",
|
|
72
|
-
}),
|
|
73
|
-
events: {
|
|
74
|
-
"model.call.started": (event) => {
|
|
75
|
-
console.log("input", event.input);
|
|
76
|
-
},
|
|
77
|
-
"model.call.completed": (event) => {
|
|
78
|
-
console.log("output", event.content);
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
The policy receives `agentName`, `channel`, `audience`, `mode`, `environment`, and `principalType`. `audience` is `"public"`, `"private"`, or `"unknown"`. `environment` is `"development"`, `"preview"`, or `"production"`.
|
|
85
|
-
|
|
86
|
-
`principalType` is the principal used for classification. Normal channels report their route or session principal; forwarded eve sessions report the calling deployment's principal. Sessions that predate the durable conversation key report their session initiator.
|
|
87
|
-
|
|
88
|
-
The default policy emits metadata for every audience and includes inputs and outputs for `public` conversations and for any audience in a development environment. Preview behaves like production: an `unknown` conversation records metadata only. Return an explicit decision to change that behavior:
|
|
89
|
-
|
|
90
|
-
| Decision | Result |
|
|
91
|
-
| --------------------------------------------- | ------------------------------------------------------------ |
|
|
92
|
-
| `false` or `{ emit: false }` | Do not invoke this provider for the trace. |
|
|
93
|
-
| `true` | Emit the trace with the default audience-aware content rule. |
|
|
94
|
-
| `{ emit: true, recordInputs, recordOutputs }` | Emit the trace with the selected content directions. |
|
|
95
|
-
|
|
96
|
-
Inputs include model prompts, tool arguments, channel input, and user responses. Outputs include model responses, tool results, requests for user input, provider metadata, and error details. Content fields are optional on event types because the active policy may remove them.
|
|
97
|
-
|
|
98
|
-
A provider's policy does not change another provider or the OpenTelemetry pipeline. A policy that throws fails closed for that provider.
|
|
99
|
-
|
|
100
|
-
## Redact fields in a custom provider
|
|
101
|
-
|
|
102
|
-
Lifecycle events are immutable snapshots. Copy the fields you need into a destination-specific payload and redact that copy before sending it:
|
|
103
|
-
|
|
104
|
-
```ts title="agent/instrumentation/audit.ts"
|
|
105
|
-
import { defineInstrumentation } from "eve/instrumentation";
|
|
106
|
-
|
|
107
|
-
export default defineInstrumentation({
|
|
108
|
-
tracePolicy: () => ({
|
|
109
|
-
emit: true,
|
|
110
|
-
recordInputs: true,
|
|
111
|
-
recordOutputs: false,
|
|
112
|
-
}),
|
|
113
|
-
events: {
|
|
114
|
-
"action.started": async (event) => {
|
|
115
|
-
await sendAuditRecord({
|
|
116
|
-
id: event.idempotencyKey,
|
|
117
|
-
input: redactApiKey(event.input),
|
|
118
|
-
kind: event.kind,
|
|
119
|
-
name: event.name,
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
function redactApiKey(value: unknown): unknown {
|
|
126
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return value;
|
|
127
|
-
|
|
128
|
-
const record = value as Record<string, unknown>;
|
|
129
|
-
return "apiKey" in record ? { ...record, apiKey: "[redacted]" } : record;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
async function sendAuditRecord(record: unknown): Promise<void> {
|
|
133
|
-
// Send the sanitized record to your provider.
|
|
134
|
-
void record;
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Prefer `recordInputs: false` or `recordOutputs: false` when the destination does not need an entire content direction. Use field-level redaction only when the destination needs part of that content.
|
|
139
|
-
|
|
140
|
-
## Add an OpenTelemetry destination
|
|
141
|
-
|
|
142
|
-
OpenTelemetry configuration has two parts:
|
|
143
|
-
|
|
144
|
-
- `otel()` declares process-wide settings such as the resource, sampler, propagators, and trace capture policy. Declare it at most once.
|
|
145
|
-
- `otelIntegration()` adds one destination. Declare one file per exporter or processor chain.
|
|
146
|
-
|
|
147
|
-
Most agents only need a destination:
|
|
148
|
-
|
|
149
|
-
```ts title="agent/instrumentation/braintrust.ts"
|
|
150
|
-
import { BraintrustExporter } from "@braintrust/otel";
|
|
151
|
-
import { otelIntegration } from "eve/instrumentation/otel";
|
|
152
|
-
|
|
153
|
-
export default otelIntegration({
|
|
154
|
-
traceExporter: new BraintrustExporter({ filterAISpans: true }),
|
|
155
|
-
});
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
Custom destinations receive the schema v4 agent trace contract. Follow [Query exported traces](./instrumentation#query-exported-traces) to find activations and sessions across traces.
|
|
159
|
-
|
|
160
|
-
Add `agent/instrumentation/otel.ts` when you need process-wide settings or want to control which content eve writes to OpenTelemetry spans:
|
|
161
|
-
|
|
162
|
-
```ts title="agent/instrumentation/otel.ts"
|
|
163
|
-
import { otel } from "eve/instrumentation/otel";
|
|
164
|
-
|
|
165
|
-
export default otel({
|
|
166
|
-
resource: { "deployment.environment": process.env.VERCEL_ENV ?? "development" },
|
|
167
|
-
tracePolicy: ({ audience, environment }) => ({
|
|
168
|
-
emit: true,
|
|
169
|
-
recordInputs: audience === "public" || environment === "development",
|
|
170
|
-
recordOutputs: audience === "public" || environment === "development",
|
|
171
|
-
}),
|
|
172
|
-
});
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
The OpenTelemetry `tracePolicy` is a capture ceiling shared by its destinations. A destination cannot restore content excluded by this policy. It does not affect lifecycle event providers created with `defineInstrumentation()`.
|
|
176
|
-
|
|
177
|
-
## Redact managed OpenTelemetry destinations
|
|
178
|
-
|
|
179
|
-
`localTraces()` and `agentRuns()` accept an `exportPolicy`. Use the built-in redactors to remove known input or output attributes before that destination's processors receive a span:
|
|
180
|
-
|
|
181
|
-
```ts title="agent/instrumentation/agent-runs.ts"
|
|
182
|
-
import {
|
|
183
|
-
agentRuns,
|
|
184
|
-
composeSpanExportPolicies,
|
|
185
|
-
redactSpanInputs,
|
|
186
|
-
redactSpanOutputs,
|
|
187
|
-
} from "eve/instrumentation/otel";
|
|
188
|
-
|
|
189
|
-
export default agentRuns({
|
|
190
|
-
exportPolicy: composeSpanExportPolicies(
|
|
191
|
-
redactSpanInputs(({ audience }) => audience !== "public"),
|
|
192
|
-
redactSpanOutputs(({ audience }) => audience !== "public"),
|
|
193
|
-
{
|
|
194
|
-
attribute: ({ key }) =>
|
|
195
|
-
key === "user.email" ? { action: "replace", value: "[redacted]" } : { action: "keep" },
|
|
196
|
-
},
|
|
197
|
-
),
|
|
198
|
-
});
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
`redactSpanInputs()` removes known prompts, instructions, documents, and tool arguments. `redactSpanOutputs()` removes known responses, reasoning, tool results, exception details, event attributes, and status messages. Their optional predicate receives the span name, IDs, attributes, and channel audience.
|
|
202
|
-
|
|
203
|
-
An export policy can also remove spans or attributes:
|
|
204
|
-
|
|
205
|
-
```ts
|
|
206
|
-
{
|
|
207
|
-
span: ({ name }) => name !== "internal.cache.refresh",
|
|
208
|
-
attribute: ({ key }) =>
|
|
209
|
-
key === "customer.id" ? { action: "drop" } : { action: "keep" },
|
|
210
|
-
}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
Policies run in declaration order. A later policy sees the filtered span produced by earlier policies. Redaction and filtering apply only to that destination and do not mutate spans shared with other destinations.
|
|
214
|
-
|
|
215
|
-
`recordInputs` and `recordOutputs` remain accepted by `localTraces()` and `agentRuns()` for compatibility, but are deprecated. Use `redactSpanInputs()` and `redactSpanOutputs()` in `exportPolicy` instead.
|
|
216
|
-
|
|
217
|
-
`otelIntegration()` does not accept `exportPolicy`. Use the process-wide `otel({ tracePolicy })` to limit capture for all custom OpenTelemetry destinations, or supply a destination-specific `SpanProcessor` that filters before its exporter.
|
|
218
|
-
|
|
219
|
-
## Built-in slots
|
|
220
|
-
|
|
221
|
-
The provider layout adds two environment-specific defaults:
|
|
222
|
-
|
|
223
|
-
- `local` records local traces during `eve dev`.
|
|
224
|
-
- `agent-runs` exports to Vercel Agent Runs in preview and production deployments.
|
|
225
|
-
|
|
226
|
-
Omitting these files preserves the defaults. Reconfigure a slot by exporting `localTraces()` or `agentRuns()` from the matching file. Disable one explicitly:
|
|
227
|
-
|
|
228
|
-
```ts title="agent/instrumentation/local.ts"
|
|
229
|
-
import { disableInstrumentation } from "eve/instrumentation";
|
|
230
|
-
|
|
231
|
-
export default disableInstrumentation();
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
## Lifecycle events
|
|
235
|
-
|
|
236
|
-
Providers can handle session, channel delivery, turn, model attempt, model call, action, input request, and tool call events. Start and terminal events share an `idempotencyKey`, which can serve as a destination row ID.
|
|
237
|
-
|
|
238
|
-
An ordinary tool emits both `action.*` and `tool.call.*` events. Use `action.*` for eve's durable dispatch lifecycle, including tools, skills, subagents, and remote agents. Use `tool.call.*` only when you need the AI SDK's in-process tool execution boundary.
|
|
239
|
-
|
|
240
|
-
Handlers for different providers run concurrently and are failure-isolated. Do not depend on provider execution order. Use `flush` to drain buffered records and `shutdown` to release resources.
|
|
241
|
-
|
|
242
|
-
The [agent trace contract](./instrumentation#agent-trace-contract) defines span
|
|
243
|
-
names, identities, and usage counters shared by the exporters and local viewers.
|
|
244
|
-
|
|
245
|
-
## What to read next
|
|
246
|
-
|
|
247
|
-
- [Observability](./instrumentation): the default `instrumentation.ts` API and trace hierarchy
|
|
248
|
-
- [Local development](./dev-tui): inspect local traces in the TUI
|
|
249
|
-
- [Hooks](./hooks): react to runtime events outside the instrumentation provider API
|