eve 0.24.6 → 0.25.1
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 +21 -0
- package/dist/src/chunks/{use-eve-agent-6BO9gFVq.js → use-eve-agent-CQIeqmKc.js} +69 -64
- package/dist/src/chunks/{use-eve-agent-B1MJNRE-.js → use-eve-agent-Cy73lgA6.js} +69 -64
- package/dist/src/cli/commands/agent-instructions.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/extension-build.d.ts +1 -1
- package/dist/src/cli/commands/extension-build.js +1 -1
- package/dist/src/client/output-schema.d.ts +0 -7
- package/dist/src/client/output-schema.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiler/extension-compatibility.d.ts +56 -0
- package/dist/src/compiler/extension-compatibility.js +1 -0
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/compiler/normalize-subagent.js +1 -1
- package/dist/src/context/build-dynamic-tools.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.d.ts +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/discover/discover-agent.d.ts +29 -7
- package/dist/src/discover/discover-agent.js +1 -1
- package/dist/src/discover/extensions.d.ts +43 -8
- package/dist/src/discover/extensions.js +1 -1
- package/dist/src/discover/filesystem.d.ts +3 -1
- package/dist/src/discover/filesystem.js +1 -1
- package/dist/src/discover/named-source-directory.js +1 -1
- package/dist/src/discover/skills.js +1 -1
- package/dist/src/evals/autoevals-client.js +2 -2
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.d.ts +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -1
- package/dist/src/execution/sandbox/development-cleanup.d.ts +1 -1
- package/dist/src/execution/sandbox/development-cleanup.js +1 -1
- package/dist/src/execution/sandbox/development-run.d.ts +0 -3
- package/dist/src/execution/sandbox/development-run.js +1 -1
- package/dist/src/execution/sandbox/ensure.js +1 -1
- package/dist/src/execution/subagent-tool.js +1 -1
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/input-extraction.d.ts +10 -1
- package/dist/src/harness/input-extraction.js +1 -1
- package/dist/src/harness/input-requests.d.ts +12 -2
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/messages.d.ts +8 -1
- package/dist/src/harness/messages.js +1 -1
- package/dist/src/harness/stale-input-responses.d.ts +26 -0
- package/dist/src/harness/stale-input-responses.js +3 -0
- package/dist/src/harness/step-hooks.d.ts +1 -12
- package/dist/src/harness/step-hooks.js +1 -1
- package/dist/src/harness/tool-call-input-errors.d.ts +11 -0
- package/dist/src/harness/tool-call-input-errors.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/workflow-sandbox.d.ts +1 -1
- package/dist/src/harness/workflow-sandbox.js +1 -1
- package/dist/src/internal/application/optional-package-install.d.ts +5 -0
- package/dist/src/internal/application/optional-package-install.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/schema-backed.js +1 -1
- package/dist/src/internal/authored-module-loader.d.ts +17 -0
- package/dist/src/internal/authored-module-loader.js +2 -2
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/authored-package-boundary.d.ts +8 -0
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot.d.ts +4 -0
- package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
- package/dist/src/internal/nitro/host/build-extension.d.ts +6 -21
- package/dist/src/internal/nitro/host/build-extension.js +2 -4
- package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/dev-workspace-extensions.d.ts +18 -0
- package/dist/src/internal/nitro/host/dev-workspace-extensions.js +1 -0
- package/dist/src/internal/nitro/host/extension-build-config.d.ts +18 -0
- package/dist/src/internal/nitro/host/extension-build-config.js +1 -0
- package/dist/src/internal/nitro/host/extension-capability-requirements.d.ts +10 -0
- package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -0
- package/dist/src/internal/nitro/host/extension-declarations.d.ts +10 -0
- package/dist/src/internal/nitro/host/extension-declarations.js +2 -0
- package/dist/src/internal/nitro/host/extension-distribution.d.ts +32 -0
- package/dist/src/internal/nitro/host/extension-distribution.js +3 -0
- package/dist/src/internal/nitro/host/extension-state-usage.d.ts +7 -0
- package/dist/src/internal/nitro/host/extension-state-usage.js +1 -0
- package/dist/src/internal/nitro/host/prepare-application-host.d.ts +5 -1
- package/dist/src/internal/nitro/host/prepare-application-host.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/nitro/host/types.d.ts +2 -0
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/public/definitions/hook.d.ts +63 -12
- package/dist/src/public/definitions/tool.d.ts +2 -2
- package/dist/src/public/hooks/index.d.ts +1 -1
- package/dist/src/public/tools/internal.js +1 -1
- package/dist/src/runtime/agent/mock-model-fixtures.js +2 -2
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/runtime/framework-tools/ask-question.d.ts +23 -9
- package/dist/src/runtime/framework-tools/ask-question.js +1 -1
- package/dist/src/runtime/framework-tools/bash.d.ts +10 -3
- package/dist/src/runtime/framework-tools/bash.js +1 -1
- package/dist/src/runtime/framework-tools/connection-search-dynamic.js +1 -1
- package/dist/src/runtime/framework-tools/final-output.d.ts +1 -1
- package/dist/src/runtime/framework-tools/final-output.js +1 -1
- package/dist/src/runtime/framework-tools/glob.d.ts +12 -3
- package/dist/src/runtime/framework-tools/glob.js +1 -1
- package/dist/src/runtime/framework-tools/grep.d.ts +16 -3
- package/dist/src/runtime/framework-tools/grep.js +1 -1
- package/dist/src/runtime/framework-tools/read-file.d.ts +13 -3
- package/dist/src/runtime/framework-tools/read-file.js +1 -1
- package/dist/src/runtime/framework-tools/skill.d.ts +5 -2
- package/dist/src/runtime/framework-tools/skill.js +1 -1
- package/dist/src/runtime/framework-tools/todo.d.ts +57 -10
- package/dist/src/runtime/framework-tools/todo.js +3 -3
- package/dist/src/runtime/framework-tools/web-fetch.d.ts +16 -3
- package/dist/src/runtime/framework-tools/web-fetch.js +1 -1
- package/dist/src/runtime/framework-tools/write-file.d.ts +9 -3
- package/dist/src/runtime/framework-tools/write-file.js +1 -1
- package/dist/src/runtime/loaders/compile-metadata.js +1 -1
- package/dist/src/runtime/loaders/manifest.js +1 -1
- package/dist/src/runtime/loaders/module-map.js +1 -1
- package/dist/src/runtime/resolve-tool.d.ts +4 -5
- package/dist/src/runtime/resolve-tool.js +1 -1
- package/dist/src/runtime/subagents/registry.d.ts +6 -3
- package/dist/src/runtime/subagents/registry.js +1 -1
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/runtime/types.d.ts +7 -9
- package/dist/src/setup/boxes/deploy-project.d.ts +11 -1
- package/dist/src/setup/boxes/deploy-project.js +1 -1
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/extension.js +2 -2
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/update/channels.js +1 -1
- package/dist/src/setup/scaffold/update/connections.js +1 -1
- package/dist/src/setup/vercel-project-framework.d.ts +4 -2
- package/dist/src/shared/extension-package-contract.d.ts +11 -0
- package/dist/src/shared/extension-package-contract.js +1 -0
- package/dist/src/shared/json.d.ts +4 -0
- package/dist/src/shared/json.js +1 -1
- package/dist/src/shared/tool-schema.d.ts +52 -0
- package/dist/src/shared/tool-schema.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +6 -0
- package/docs/extensions.md +22 -6
- package/docs/reference/cli.md +2 -2
- package/package.json +1 -1
- package/dist/src/internal/json-schema.d.ts +0 -1
- package/dist/src/internal/json-schema.js +0 -1
- package/dist/src/setup/boxes/reconcile-host-framework-preset.d.ts +0 -26
- package/dist/src/setup/boxes/reconcile-host-framework-preset.js +0 -1
- package/dist/src/shared/hook-definition.d.ts +0 -36
- package/dist/src/shared/hook-definition.js +0 -1
- package/dist/src/shared/json-schema.d.ts +0 -9
- package/dist/src/shared/json-schema.js +0 -1
|
@@ -1,7 +1,52 @@
|
|
|
1
1
|
import type { HandleMessageStreamEvent } from "../../protocol/message.js";
|
|
2
2
|
import type { SessionContext } from "./callback-context.js";
|
|
3
3
|
import type { ExactDefinition } from "./exact.js";
|
|
4
|
-
|
|
4
|
+
type ProtocolEvent<TType extends HandleMessageStreamEvent["type"]> = Extract<HandleMessageStreamEvent, {
|
|
5
|
+
type: TType;
|
|
6
|
+
}>;
|
|
7
|
+
/**
|
|
8
|
+
* Public event contract available to authored hooks.
|
|
9
|
+
*
|
|
10
|
+
* The explicit map keeps hook compatibility independent from the internal
|
|
11
|
+
* protocol union: new protocol events do not become extension hook events
|
|
12
|
+
* until eve exposes them here.
|
|
13
|
+
*/
|
|
14
|
+
export interface HookEventMap {
|
|
15
|
+
readonly "action.result": ProtocolEvent<"action.result">;
|
|
16
|
+
readonly "actions.requested": ProtocolEvent<"actions.requested">;
|
|
17
|
+
readonly "authorization.completed": ProtocolEvent<"authorization.completed">;
|
|
18
|
+
readonly "authorization.required": ProtocolEvent<"authorization.required">;
|
|
19
|
+
readonly "compaction.completed": ProtocolEvent<"compaction.completed">;
|
|
20
|
+
readonly "compaction.requested": ProtocolEvent<"compaction.requested">;
|
|
21
|
+
readonly "input.requested": ProtocolEvent<"input.requested">;
|
|
22
|
+
readonly "message.appended": ProtocolEvent<"message.appended">;
|
|
23
|
+
readonly "message.completed": ProtocolEvent<"message.completed">;
|
|
24
|
+
readonly "message.received": ProtocolEvent<"message.received">;
|
|
25
|
+
readonly "reasoning.appended": ProtocolEvent<"reasoning.appended">;
|
|
26
|
+
readonly "reasoning.completed": ProtocolEvent<"reasoning.completed">;
|
|
27
|
+
readonly "result.completed": ProtocolEvent<"result.completed">;
|
|
28
|
+
readonly "session.completed": ProtocolEvent<"session.completed">;
|
|
29
|
+
readonly "session.failed": ProtocolEvent<"session.failed">;
|
|
30
|
+
readonly "session.started": ProtocolEvent<"session.started">;
|
|
31
|
+
readonly "session.waiting": ProtocolEvent<"session.waiting">;
|
|
32
|
+
readonly "step.completed": ProtocolEvent<"step.completed">;
|
|
33
|
+
readonly "step.failed": ProtocolEvent<"step.failed">;
|
|
34
|
+
readonly "step.started": ProtocolEvent<"step.started">;
|
|
35
|
+
readonly "subagent.called": ProtocolEvent<"subagent.called">;
|
|
36
|
+
readonly "subagent.completed": ProtocolEvent<"subagent.completed">;
|
|
37
|
+
readonly "subagent.event": ProtocolEvent<"subagent.event">;
|
|
38
|
+
readonly "subagent.started": ProtocolEvent<"subagent.started">;
|
|
39
|
+
readonly "turn.cancelled": ProtocolEvent<"turn.cancelled">;
|
|
40
|
+
readonly "turn.completed": ProtocolEvent<"turn.completed">;
|
|
41
|
+
readonly "turn.failed": ProtocolEvent<"turn.failed">;
|
|
42
|
+
readonly "turn.started": ProtocolEvent<"turn.started">;
|
|
43
|
+
}
|
|
44
|
+
/** Event type discriminators available to authored hooks. */
|
|
45
|
+
export type HookEventType = keyof HookEventMap;
|
|
46
|
+
/** Authored hook event keys, including the wildcard subscriber. */
|
|
47
|
+
export type HookEventKey = HookEventType | "*";
|
|
48
|
+
/** Event received by a handler for one authored hook event key. */
|
|
49
|
+
export type HookEvent<TKey extends HookEventKey = HookEventType> = TKey extends HookEventType ? HookEventMap[TKey] : HookEventMap[HookEventType];
|
|
5
50
|
/**
|
|
6
51
|
* Every hook handler receives this context.
|
|
7
52
|
*
|
|
@@ -21,9 +66,9 @@ export interface HookContext extends SessionContext {
|
|
|
21
66
|
/**
|
|
22
67
|
* Side-effect-only handler for one accepted runtime stream event.
|
|
23
68
|
*
|
|
24
|
-
* `TEvent` is one variant of
|
|
25
|
-
*
|
|
26
|
-
*
|
|
69
|
+
* `TEvent` is one variant of {@link HookEvent}. {@link StreamEventHooks}
|
|
70
|
+
* infers it from the event key. The typed event is the first argument, `ctx`
|
|
71
|
+
* is the last.
|
|
27
72
|
*/
|
|
28
73
|
export type StreamEventHook<TEvent> = (event: TEvent, ctx: HookContext) => void | Promise<void>;
|
|
29
74
|
/**
|
|
@@ -32,7 +77,9 @@ export type StreamEventHook<TEvent> = (event: TEvent, ctx: HookContext) => void
|
|
|
32
77
|
* `*` matches every accepted runtime stream event and runs after the
|
|
33
78
|
* typed handler for that event (if any).
|
|
34
79
|
*/
|
|
35
|
-
export type StreamEventHooks =
|
|
80
|
+
export type StreamEventHooks<TKey extends HookEventKey = HookEventKey> = {
|
|
81
|
+
readonly [TKey_ in TKey]?: StreamEventHook<HookEvent<TKey_>>;
|
|
82
|
+
};
|
|
36
83
|
/**
|
|
37
84
|
* Public hook definition authored in `agent/hooks/*.ts`.
|
|
38
85
|
*
|
|
@@ -42,12 +89,16 @@ export type StreamEventHooks = GenericStreamEventHooks<HandleMessageStreamEvent,
|
|
|
42
89
|
* contribute runtime model messages, use `defineDynamic` +
|
|
43
90
|
* `defineInstructions` in `agent/instructions/`.
|
|
44
91
|
*/
|
|
45
|
-
export
|
|
92
|
+
export interface HookDefinition<TKey extends HookEventKey = HookEventKey> {
|
|
93
|
+
readonly events?: StreamEventHooks<TKey>;
|
|
94
|
+
}
|
|
95
|
+
type DefinedHookEventKeys<TDefinition extends HookDefinition> = Extract<keyof NonNullable<TDefinition["events"]>, HookEventKey>;
|
|
46
96
|
/**
|
|
47
|
-
* Identity-with-types helper. Returns the passed definition unchanged
|
|
48
|
-
*
|
|
49
|
-
* any
|
|
50
|
-
*
|
|
51
|
-
*
|
|
97
|
+
* Identity-with-types helper. Returns the passed definition unchanged at
|
|
98
|
+
* runtime while preserving its authored event keys behind the public
|
|
99
|
+
* {@link HookDefinition} boundary and rejecting any key outside `events`.
|
|
100
|
+
* Authors export
|
|
101
|
+
* `defineHook({ events: { "session.started": (event, ctx) => { ... } } })`.
|
|
52
102
|
*/
|
|
53
|
-
export declare function defineHook<T extends HookDefinition>(definition: ExactDefinition<T, HookDefinition>): T
|
|
103
|
+
export declare function defineHook<const T extends HookDefinition>(definition: ExactDefinition<T, HookDefinition>): HookDefinition<DefinedHookEventKeys<T>>;
|
|
104
|
+
export {};
|
|
@@ -87,7 +87,7 @@ export type ToolContext = SessionContext & {
|
|
|
87
87
|
* the extension (`agent/tools/get_weather.ts` registers as `get_weather`).
|
|
88
88
|
* Authored definitions have no `name` field; identity is path-derived.
|
|
89
89
|
*/
|
|
90
|
-
export
|
|
90
|
+
export interface ToolDefinition<TInput = unknown, TOutput = unknown> extends PublicToolDefinition<TInput, TOutput> {
|
|
91
91
|
execute(input: TInput, ctx: ToolContext): Promise<TOutput> | TOutput;
|
|
92
92
|
/**
|
|
93
93
|
* Optional per-tool approval gate. The return value determines whether
|
|
@@ -109,7 +109,7 @@ export type ToolDefinition<TInput = unknown, TOutput = unknown> = PublicToolDefi
|
|
|
109
109
|
* (`action.result`) always receive the full output regardless.
|
|
110
110
|
*/
|
|
111
111
|
toModelOutput?: (output: TOutput) => ToolModelOutput | Promise<ToolModelOutput>;
|
|
112
|
-
}
|
|
112
|
+
}
|
|
113
113
|
/**
|
|
114
114
|
* Defines a tool configuration, used both for static tools (default export
|
|
115
115
|
* from `agent/tools/*.ts`) and as the entry wrapper inside `defineDynamic`
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* See {@link defineHook} for the authoring shape and
|
|
6
6
|
* {@link HookContext} for the runtime context every handler receives.
|
|
7
7
|
*/
|
|
8
|
-
export { type HookContext, type HookDefinition, type StreamEventHook, type StreamEventHooks, defineHook, } from "#public/definitions/hook.js";
|
|
8
|
+
export { type HookContext, type HookDefinition, type HookEvent, type HookEventKey, type HookEventMap, type HookEventType, type StreamEventHook, type StreamEventHooks, defineHook, } from "#public/definitions/hook.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function toPublicToolDefinition(e){if(!e.execute)throw Error(`Tool "${e.name}" is client-side and cannot be re-exported publicly.`);let t=e.execute,n=
|
|
1
|
+
function toPublicToolDefinition(e){if(!e.execute)throw Error(`Tool "${e.name}" is client-side and cannot be re-exported publicly.`);let t=e.execute,n={description:e.description,execute:(e,n)=>t(e,{abortSignal:n.abortSignal,messages:[],toolCallId:n.callId}),inputSchema:e.inputSchema??{},outputSchema:e.outputSchema};return e.approval!==void 0&&(n.approval=e.approval),n}export{toPublicToolDefinition};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{getPromptContentText}from"#runtime/agent/bootstrap-model-utils.js";function createMockAuthoredToolInput(e,t,
|
|
1
|
+
import{LOAD_SKILL_TOOL_NAME}from"#runtime/skills/fragment-context.js";import{getPromptContentText}from"#runtime/agent/bootstrap-model-utils.js";import{createJsonSchemaSample}from"#runtime/agent/mock-structured-output.js";function createMockAuthoredToolInput(e,t,r){let i=getToolInputPropertyNames(e.inputSchema);if(e.name===`ask_question`||hasProperties(i,[`prompt`,`options`]))return createAskQuestionInput(t);if(i.includes(`command`))return{command:resolveShellCommand(t)};if(i.includes(`topic`)||!hasDeclaredInputProperties(e.inputSchema)&&/\btopic\b/u.test(normalizeText(t)))return{topic:resolveLookupTopic(t)};let a=extractAnchoredInputs(i,t);if(Object.keys(a).length>0)return a;if(i.length===1&&i[0]===`message`)return{message:t};if(i.includes(`city`)||!hasDeclaredInputProperties(e.inputSchema))return{city:r};let o=createJsonSchemaSample(e.inputSchema);return isRecord(o)?o:{}}function extractAnchoredInputs(e,t){let n={};for(let r of e){let e=RegExp(`\\b${escapeRegExp(r)}\\b\\s*(?:to|=|:)?\\s*(?:\`([^\`]+)\`|"([^"]+)"|'([^']+)')`,`iu`).exec(t),i=e?.[1]??e?.[2]??e?.[3];i!==void 0&&(n[r]=i.trim())}return n}function escapeRegExp(e){return e.replace(/[$()*+.?[\\\]^{|}]/gu,String.raw`\$&`)}function resolveMockFixtureToken(e){let n=e.filter(e=>e.role===`system`).map(e=>getPromptContentText(e.content)).join(`
|
|
2
2
|
`),r=[...getLoadedSkillResultTexts(e),n,getTrailingUserText(e)];for(let e of r){let t=resolveExactFixtureReply(e);if(t!==null)return t}return null}function resolveWeatherCity(e){let t=/"city"\s*:\s*"([^"]+)"/u.exec(e);return t?.[1]?t[1].trim():(/\b(?:in|for)\s+([A-Za-z][A-Za-z\s.-]*?)(?:[?.!,]|$)/u.exec(e)??/\b([A-Z][a-z]+(?:\s+[A-Z][a-z]+)*)\b/u.exec(e))?.[1]?.trim()||`Brooklyn`}function formatToolOutput(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function getTrailingUserText(e){let n=[];for(let r of[...e].reverse())if(r.role!==`system`){if(r.role!==`user`)break;n.unshift(getPromptContentText(r.content))}return n.join(`
|
|
3
|
-
`)}function getLoadedSkillResultTexts(t){return t.flatMap(t=>t.role!==`tool`&&t.role!==`assistant`?[]:(typeof t.content==`string`?[t.content]:t.content).flatMap(t=>typeof t==`string`||t.type!==`tool-result`||t.toolName!==LOAD_SKILL_TOOL_NAME||t.output.type===`execution-denied`?[]:[formatToolOutput(t.output.value)]))}function resolveExactFixtureReply(e){let t=matchExactValue(/\breply\s+with\s+the\s+exact\s+string\s+(`([^`]+)`|"([^"]+)"|'([^']+)'|([^\s.]+))\s+and\s+nothing\s+else\b/iu,e);if(t!==null)return t;let n=e.split(/\r?\n/u);for(let e=0;e<n.length;e+=1){let t=n[e]?.trim()??``,r=/\breply\s+with\s+exactly(?:\s+the\s+following\s+text\s+and\s+nothing\s+else)?:\s*(.+)$/iu.exec(t);if(r?.[1])return cleanExactValue(r[1]);if(/\breply\s+with\s+exactly\s+the\s+following\s+text\s+and\s+nothing\s+else:\s*$/iu.test(t)||/\breply\s+with\s+exactly:\s*$/iu.test(t)){let t=n.slice(e+1).map(e=>e.trim()).find(e=>e.length>0);if(t!==void 0)return cleanExactValue(t)}}return matchExactValue(/\binclude\s+the\s+exact\s+token\s+(`([^`]+)`|"([^"]+)"|'([^']+)'|([^\s.]+))\s+verbatim\b/iu,e)}function matchExactValue(e,t){let n=e.exec(t);return n===null?null:cleanExactValue(n[2]??n[3]??n[4]??n[5]??n[1]??``)}function cleanExactValue(e){return e.trim()}function getToolInputPropertyNames(e){return!isRecord(e)||!isRecord(e.properties)?[]:Object.keys(e.properties)}function hasProperties(e,t){return t.every(t=>e.includes(t))}function createAskQuestionInput(e){let t=parseInputOptions(e),n={prompt:resolveQuestionPrompt(e)};return t.length>0&&(n.options=t),/\ballow\s*freeform\s+(?:to\s+)?true\b|\ballowfreeform\s+(?:to\s+)?true\b/iu.test(e)&&(n.allowFreeform=!0),n}function parseInputOptions(e){return[...e.matchAll(/\bid\b\s*:?\s*"([^"]+)"\s*,\s*label\b\s*:?\s*"([^"]+)"/giu)].map(e=>({id:e[1]??``,label:e[2]??``}))}function resolveQuestionPrompt(e){let t=/\b(?:set\s+)?prompt\s+to:\s*'([^']+)'/iu.exec(e)??/\b(?:set\s+)?prompt\s+to:\s*"([^"]+)"/iu.exec(e);return t?.[1]?t[1].trim():/\bask(?:\s+me)?\s+(?:to\s+)?(.+?)(?:\.|$)/iu.exec(e)?.[1]?.trim()||`Please choose an option.`}function resolveShellCommand(e){let t=/`([^`]+)`/u.exec(e);return t?.[1]?t[1].trim():(/\b(?:run|command)\s+["']([^"']+)["']/iu.exec(e)??/\bcommand\s+(.+?)(?:\.|$)/iu.exec(e))?.[1]?.trim()||`pwd`}function resolveLookupTopic(e){return/\btopic\s+['"]?([A-Za-z0-9_.-]+)['"]?/u.exec(e)?.[1]??`demo`}function normalizeText(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,` `).trim()}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{createMockAuthoredToolInput,formatToolOutput,resolveMockFixtureToken,resolveWeatherCity};
|
|
3
|
+
`)}function getLoadedSkillResultTexts(t){return t.flatMap(t=>t.role!==`tool`&&t.role!==`assistant`?[]:(typeof t.content==`string`?[t.content]:t.content).flatMap(t=>typeof t==`string`||t.type!==`tool-result`||t.toolName!==LOAD_SKILL_TOOL_NAME||t.output.type===`execution-denied`?[]:[formatToolOutput(t.output.value)]))}function resolveExactFixtureReply(e){let t=matchExactValue(/\breply\s+with\s+the\s+exact\s+string\s+(`([^`]+)`|"([^"]+)"|'([^']+)'|([^\s.]+))\s+and\s+nothing\s+else\b/iu,e);if(t!==null)return t;let n=e.split(/\r?\n/u);for(let e=0;e<n.length;e+=1){let t=n[e]?.trim()??``,r=/\breply\s+with\s+exactly(?:\s+the\s+following\s+text\s+and\s+nothing\s+else)?:\s*(.+)$/iu.exec(t);if(r?.[1])return cleanExactValue(r[1]);if(/\breply\s+with\s+exactly\s+the\s+following\s+text\s+and\s+nothing\s+else:\s*$/iu.test(t)||/\breply\s+with\s+exactly:\s*$/iu.test(t)){let t=n.slice(e+1).map(e=>e.trim()).find(e=>e.length>0);if(t!==void 0)return cleanExactValue(t)}}return matchExactValue(/\binclude\s+the\s+exact\s+token\s+(`([^`]+)`|"([^"]+)"|'([^']+)'|([^\s.]+))\s+verbatim\b/iu,e)}function matchExactValue(e,t){let n=e.exec(t);return n===null?null:cleanExactValue(n[2]??n[3]??n[4]??n[5]??n[1]??``)}function cleanExactValue(e){return e.trim()}function getToolInputPropertyNames(e){return!isRecord(e)||!isRecord(e.properties)?[]:Object.keys(e.properties)}function hasDeclaredInputProperties(e){return isRecord(e)&&isRecord(e.properties)}function hasProperties(e,t){return t.every(t=>e.includes(t))}function createAskQuestionInput(e){let t=parseInputOptions(e),n={prompt:resolveQuestionPrompt(e)};return t.length>0&&(n.options=t),/\ballow\s*freeform\s+(?:to\s+)?true\b|\ballowfreeform\s+(?:to\s+)?true\b/iu.test(e)&&(n.allowFreeform=!0),n}function parseInputOptions(e){return[...e.matchAll(/\bid\b\s*:?\s*"([^"]+)"\s*,\s*label\b\s*:?\s*"([^"]+)"/giu)].map(e=>({id:e[1]??``,label:e[2]??``}))}function resolveQuestionPrompt(e){let t=/\b(?:set\s+)?prompt\s+to:\s*'([^']+)'/iu.exec(e)??/\b(?:set\s+)?prompt\s+to:\s*"([^"]+)"/iu.exec(e);return t?.[1]?t[1].trim():/\bask(?:\s+me)?\s+(?:to\s+)?(.+?)(?:\.|$)/iu.exec(e)?.[1]?.trim()||`Please choose an option.`}function resolveShellCommand(e){let t=/`([^`]+)`/u.exec(e);return t?.[1]?t[1].trim():(/\b(?:run|command)\s+["']([^"']+)["']/iu.exec(e)??/\bcommand\s+(.+?)(?:\.|$)/iu.exec(e))?.[1]?.trim()||`pwd`}function resolveLookupTopic(e){return/\btopic\s+['"]?([A-Za-z0-9_.-]+)['"]?/u.exec(e)?.[1]??`demo`}function normalizeText(e){return e.toLowerCase().replace(/[^a-z0-9]+/gu,` `).trim()}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{createMockAuthoredToolInput,formatToolOutput,resolveMockFixtureToken,resolveWeatherCity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isLoopbackHostname}from"#shared/network-address.js";import{isObject}from"#shared/guards.js";import{
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{isLoopbackHostname}from"#shared/network-address.js";import{isObject}from"#shared/guards.js";import{toInputSchema}from"#shared/tool-schema.js";import{tool}from"ai";import{passesToolFilter,resolveHeaders}from"#runtime/connections/mcp-client.js";import{HTTP_METHODS,operationDescription,operationName,uniqueName}from"#runtime/connections/openapi-operations.js";import{buildInputSchema,deref,derefSchema,isArray}from"#runtime/connections/openapi-schema.js";import{applySecurity,resolveSecurity}from"#runtime/connections/openapi-security.js";import{extractServerUrl,parseSpecDocument}from"#runtime/connections/openapi-spec.js";const log=createLogger(`runtime.connections.openapi-client`),SWAGGER_PARAMETER_SCHEMA_KEYS=[`default`,`enum`,`exclusiveMaximum`,`exclusiveMinimum`,`format`,`items`,`maximum`,`maxItems`,`maxLength`,`minimum`,`minItems`,`minLength`,`multipleOf`,`pattern`,`type`,`uniqueItems`];var OpenApiConnectionClient=class{#e;#t;#n;constructor(e){this.#n=e}async connect(){return this.#r()}async getToolMetadata(){return(await this.#r()).metadata}async getTools(){return(await this.#r()).tools}async executeTool(e,t,r){let i=await this.#r(),a=i.operations.get(e);if(a===void 0)throw Error(`Tool "${e}" not found in connection "${this.#n.connectionName}".`);return this.#f(a,i.baseUrl,isObject(t)?t:{},{abortSignal:r?.abortSignal})}async close(){this.#e=void 0,this.#t=void 0}async#r(){if(this.#t!==void 0)return this.#t;if(this.#e!==void 0)return this.#e;this.#e=this.#i();try{return this.#t=await this.#e,this.#t}catch(e){throw this.#e=void 0,e}}async#i(){let e=await this.#o(),t=this.#a(e),o=this.#s(e),s=this.#n.tools,c=s===void 0?o:o.filter(e=>passesToolFilter(e.toolName,s)),l=[],u=new Map,d={};for(let e of c){let a;try{a=toInputSchema(e.inputSchema)}catch(t){log.warn(`omitting OpenAPI operation with an invalid input schema`,{connectionName:this.#n.connectionName,error:t,toolName:e.toolName});continue}u.set(e.toolName,e),l.push({description:e.description,inputSchema:e.inputSchema,name:e.toolName}),d[e.toolName]=tool({description:e.description,inputSchema:a,execute:async(r,i)=>this.#f(e,t,isObject(r)?r:{},{abortSignal:i?.abortSignal})})}return{metadata:l,operations:u,tools:d,baseUrl:t}}#a(e){let t=this.#n.url,n=typeof t==`string`&&t.trim().length>0?t:extractServerUrl(e,this.#n.spec);if(n===void 0)throw Error(`OpenAPI connection "${this.#n.connectionName}" has no base URL: set "baseUrl" or ensure the document declares an absolute "servers" entry or Swagger "host".`);return assertSecureUrl(n,this.#n.connectionName,`base`),n}async#o(){let e=this.#n.spec;if(e===void 0)throw Error(`OpenAPI connection "${this.#n.connectionName}" is missing its "spec" source.`);if(typeof e!=`string`)return e;assertSecureUrl(e,this.#n.connectionName,`spec`);let t;try{t=await fetch(e,{headers:{accept:`application/json, application/yaml, text/yaml, */*`}})}catch(t){throw Error(`OpenAPI connection "${this.#n.connectionName}" failed to fetch its spec from "${e}": ${String(t)}`)}if(t.redirected&&assertSecureUrl(t.url,this.#n.connectionName,`spec`),!t.ok)throw Error(`OpenAPI connection "${this.#n.connectionName}" failed to fetch its spec from "${e}": HTTP ${t.status}.`);let r=await t.text(),i;try{i=parseSpecDocument(r)}catch(t){throw Error(`OpenAPI connection "${this.#n.connectionName}" spec at "${e}" could not be parsed as JSON or YAML: ${String(t)}`)}if(!isObject(i))throw Error(`OpenAPI connection "${this.#n.connectionName}" spec at "${e}" is not an OpenAPI document object.`);return i}#s(e){let t=e.paths;if(!isObject(t))return[];let r=[],i=new Set;for(let[a,o]of Object.entries(t)){if(!isObject(o))continue;let t=isArray(o.parameters)?o.parameters:[];for(let f of HTTP_METHODS){let s=o[f];if(!isObject(s))continue;let p=uniqueName(operationName(s,f,a),i),m=isArray(s.parameters)?s.parameters:[],h=[...t,...m],g=this.#c(e,h),_=this.#l(e,s.requestBody,h);r.push({toolName:p,method:f,pathTemplate:a,description:operationDescription(s),parameters:g,requestBody:_,inputSchema:buildInputSchema(g,_),security:resolveSecurity(e,s)})}}return r}#c(e,t){let r=[];for(let i of t){let t=isObject(i)?deref(e,i):i;if(!isObject(t))continue;let a=t.in;if(a!==`path`&&a!==`query`&&a!==`header`&&a!==`cookie`||typeof t.name!=`string`)continue;let o=this.#u(e,t);r.push({name:t.name,location:a,required:t.required===!0||a===`path`,schema:o,description:typeof t.description==`string`?t.description:void 0})}return r}#l(e,t,r=[]){if(isObject(t)){let r=deref(e,t);if(isObject(r)&&isObject(r.content)){let t=r.content,i=`application/json`in t?`application/json`:Object.keys(t)[0];if(i!==void 0){let a=t[i],o=isObject(a)&&isObject(a.schema)?derefSchema(e,a.schema):{};return{required:r.required===!0,contentType:i,schema:o}}}}return this.#d(e,r)}#u(e,t){if(isObject(t.schema))return derefSchema(e,t.schema);let r={};for(let e of SWAGGER_PARAMETER_SCHEMA_KEYS)t[e]!==void 0&&(r[e]=t[e]);return derefSchema(e,r)}#d(e,t){for(let r of t){let t=isObject(r)?deref(e,r):r;if(!isObject(t)||t.in!==`body`)continue;let i=isObject(t.schema)?derefSchema(e,t.schema):{};return{required:t.required===!0,contentType:`application/json`,schema:i}}}async#f(e,t,n,r){let i=await resolveHeaders(this.#n),a=e.pathTemplate,s=new URLSearchParams,c=[];for(let t of e.parameters){let e=n[t.name];e!=null&&(t.location===`path`?a=a.replace(`{${t.name}}`,encodeURIComponent(String(e))):t.location===`query`?appendQuery(s,t.name,e):t.location===`cookie`?c.push(`${t.name}=${encodeURIComponent(String(e))}`):i[t.name]=String(e))}if(applySecurity(e.security,this.#n,i,s,c),c.length>0){let e=i.cookie??i.Cookie;delete i.Cookie,i.cookie=[e,...c].filter(e=>!!e).join(`; `)}let l=new URL(joinPath(t,a));l.search=s.toString();let u;e.requestBody!==void 0&&n.body!==void 0&&(u=JSON.stringify(n.body),i[`content-type`]=e.requestBody.contentType);let d=await fetch(l,{method:e.method.toUpperCase(),headers:i,body:u,signal:r?.abortSignal});return{status:d.status,statusText:d.statusText,body:await readResponseBody(d)}}};function appendQuery(e,t,n){if(isArray(n)){for(let r of n)e.append(t,String(r));return}e.append(t,String(n))}function joinPath(e,t){return`${e.endsWith(`/`)?e.slice(0,-1):e}${t.startsWith(`/`)?t:`/${t}`}`}function assertSecureUrl(e,n,r){let i;try{i=new URL(e)}catch{throw Error(`OpenAPI connection "${n}" has an invalid ${r} URL "${e}".`)}if(i.protocol!==`https:`&&!(i.protocol===`http:`&&isLoopbackHostname(i.hostname)))throw Error(`OpenAPI connection "${n}" must use https for its ${r} (got "${i.protocol}//${i.host}").`)}async function readResponseBody(e){let t=await e.text();if(t.length===0)return null;if((e.headers.get(`content-type`)??``).includes(`application/json`))try{return JSON.parse(t)}catch{return t}return t}export{OpenApiConnectionClient};
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "#compiled/zod/index.js";
|
|
2
2
|
import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Stable model-visible name for the framework question tool.
|
|
5
5
|
*/
|
|
6
6
|
export declare const ASK_QUESTION_TOOL_NAME = "ask_question";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export declare const ASK_QUESTION_INPUT_SCHEMA: z.ZodObject<{
|
|
8
|
+
allowFreeform: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10
|
+
description: z.ZodOptional<z.ZodString>;
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
label: z.ZodString;
|
|
13
|
+
style: z.ZodOptional<z.ZodEnum<{
|
|
14
|
+
danger: "danger";
|
|
15
|
+
default: "default";
|
|
16
|
+
primary: "primary";
|
|
17
|
+
}>>;
|
|
18
|
+
}, z.core.$strict>>>;
|
|
19
|
+
prompt: z.ZodString;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export declare const ASK_QUESTION_OUTPUT_SCHEMA: z.ZodObject<{
|
|
22
|
+
optionId: z.ZodOptional<z.ZodString>;
|
|
23
|
+
status: z.ZodEnum<{
|
|
24
|
+
answered: "answered";
|
|
25
|
+
ignored: "ignored";
|
|
26
|
+
}>;
|
|
27
|
+
text: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strict>;
|
|
15
29
|
/**
|
|
16
30
|
* Root-only framework tool that lets the agent request structured user input.
|
|
17
31
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z}from"#compiled/zod/index.js";import{inputRequestSchema}from"#runtime/input/types.js";const ASK_QUESTION_TOOL_NAME=`ask_question`,
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{inputRequestSchema}from"#runtime/input/types.js";const ASK_QUESTION_TOOL_NAME=`ask_question`,ASK_QUESTION_INPUT_SCHEMA=inputRequestSchema.omit({action:!0,display:!0,requestId:!0}),ASK_QUESTION_OUTPUT_SCHEMA=z.object({optionId:z.string().optional(),status:z.enum([`answered`,`ignored`]),text:z.string().optional()}).strict(),ASK_QUESTION_TOOL_DEFINITION={description:`Ask the user a question and wait for their response before continuing. Use this when you need clarification or a choice from the user.`,inputSchema:ASK_QUESTION_INPUT_SCHEMA,logicalPath:`eve:framework/ask-question`,name:ASK_QUESTION_TOOL_NAME,outputSchema:ASK_QUESTION_OUTPUT_SCHEMA,sourceId:`eve:ask-question-tool`,sourceKind:`module`};export{ASK_QUESTION_INPUT_SCHEMA,ASK_QUESTION_OUTPUT_SCHEMA,ASK_QUESTION_TOOL_DEFINITION,ASK_QUESTION_TOOL_NAME};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "#compiled/zod/index.js";
|
|
2
2
|
import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Shared input schema used by the framework `bash` tool and any author tool
|
|
@@ -8,10 +8,17 @@ import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
|
8
8
|
* `BASH_TOOL_DEFINITION` use the exact same schema object — keeping model
|
|
9
9
|
* input contracts in sync without duplication.
|
|
10
10
|
*/
|
|
11
|
-
export declare const BASH_INPUT_SCHEMA:
|
|
11
|
+
export declare const BASH_INPUT_SCHEMA: z.ZodObject<{
|
|
12
|
+
command: z.ZodString;
|
|
13
|
+
}, z.core.$strict>;
|
|
12
14
|
/**
|
|
13
15
|
* Shared output schema used by the framework `bash` tool and any author tool
|
|
14
16
|
* constructed via {@link defineBashTool}.
|
|
15
17
|
*/
|
|
16
|
-
export declare const BASH_OUTPUT_SCHEMA:
|
|
18
|
+
export declare const BASH_OUTPUT_SCHEMA: z.ZodObject<{
|
|
19
|
+
exitCode: z.ZodNumber;
|
|
20
|
+
stderr: z.ZodString;
|
|
21
|
+
stdout: z.ZodString;
|
|
22
|
+
truncated: z.ZodBoolean;
|
|
23
|
+
}, z.core.$strict>;
|
|
17
24
|
export declare const BASH_TOOL_DEFINITION: ResolvedToolDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{requireSandboxSession}from"#execution/sandbox/require-sandbox.js";import{executeBashOnSandbox}from"#execution/sandbox/bash-tool.js";const BASH_INPUT_SCHEMA={
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{requireSandboxSession}from"#execution/sandbox/require-sandbox.js";import{executeBashOnSandbox}from"#execution/sandbox/bash-tool.js";const BASH_INPUT_SCHEMA=z.strictObject({command:z.string().describe(`The shell command to execute.`)}),BASH_OUTPUT_SCHEMA=z.strictObject({exitCode:z.number(),stderr:z.string(),stdout:z.string(),truncated:z.boolean()});async function executeBash(e,t){return executeBashOnSandbox(await requireSandboxSession(t?.abortSignal),e)}const BASH_TOOL_DEFINITION={description:`Execute a shell command in the shared workspace environment.`,execute:executeBash,inputSchema:BASH_INPUT_SCHEMA,logicalPath:`eve:framework/bash`,name:`bash`,outputSchema:BASH_OUTPUT_SCHEMA,sourceId:`eve:bash-tool`,sourceKind:`module`};export{BASH_INPUT_SCHEMA,BASH_OUTPUT_SCHEMA,BASH_TOOL_DEFINITION};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createLogger}from"#internal/logging.js";import{loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";import{ConnectionRegistryKey}from"#context/providers/connection-key.js";import{ConnectionAuthorizationFailedError,isConnectionAuthorizationFailedError,isConnectionAuthorizationRequiredError}from"#public/connections/errors.js";import{getAuthorizationResult,getHookUrl,requestAuthorization}from"#harness/authorization.js";import{supportsInteractiveAuthorization}from"#runtime/connections/types.js";import{resolveAuthorizationCallbackUrl,stampChallengeDisplayName}from"#runtime/connections/scoped-authorization.js";import{resolveConnectionAuthorization}from"#runtime/connections/resolve-authorization.js";import{writeCachedToken}from"#runtime/connections/authorization-tokens.js";import{principalKey,resolveConnectionPrincipal}from"#runtime/connections/principal.js";const logger=createLogger(`framework.connection-search-dynamic`),
|
|
1
|
+
import{createLogger}from"#internal/logging.js";import{z}from"#compiled/zod/index.js";import{loadContext}from"#context/container.js";import{ContextKey}from"#context/key.js";import{ConnectionRegistryKey}from"#context/providers/connection-key.js";import{ConnectionAuthorizationFailedError,isConnectionAuthorizationFailedError,isConnectionAuthorizationRequiredError}from"#public/connections/errors.js";import{getAuthorizationResult,getHookUrl,requestAuthorization}from"#harness/authorization.js";import{supportsInteractiveAuthorization}from"#runtime/connections/types.js";import{resolveAuthorizationCallbackUrl,stampChallengeDisplayName}from"#runtime/connections/scoped-authorization.js";import{resolveConnectionAuthorization}from"#runtime/connections/resolve-authorization.js";import{writeCachedToken}from"#runtime/connections/authorization-tokens.js";import{principalKey,resolveConnectionPrincipal}from"#runtime/connections/principal.js";const logger=createLogger(`framework.connection-search-dynamic`),CONNECTION_SEARCH_INPUT_SCHEMA=z.strictObject({connection:z.string().describe(`Optional: limit search to a specific connection name.`).optional(),keywords:z.string().describe(`Search keywords and expanded aliases. Distill intent into keywords; avoid stop words like 'a', 'the', 'in'.`),limit:z.number().describe(`Max results to return. Default 10.`).optional()}),connectionSchema=z.looseObject({}),CONNECTION_SEARCH_RESULT_ITEM_SCHEMA=z.strictObject({connection:z.string(),description:z.string(),error:z.string().optional(),inputSchema:connectionSchema.optional(),needsAuthorization:z.boolean().optional(),outputSchema:connectionSchema.optional(),qualifiedName:z.string().optional(),tool:z.string().optional()}),CONNECTION_SEARCH_OUTPUT_SCHEMA=z.array(CONNECTION_SEARCH_RESULT_ITEM_SCHEMA),ConnectionSearchResultsKey=new ContextKey(`eve.connectionSearchResults`);function qualifiedConnectionToolName(e,t){return`${e}__${t}`}function tokenize(e){return e.toLowerCase().split(/[\s_\-./]+/).filter(e=>e.length>1)}function scoreMatch(e,t){let n=tokenize(t.name),r=tokenize(t.description),i=0;for(let t of e){for(let e of n)(e.includes(t)||t.includes(e))&&(i+=3);for(let e of r)(e.includes(t)||t.includes(e))&&(i+=1)}return i}async function resolveInteractiveAuth(e,t){let n=e.getConnections().find(e=>e.connectionName===t);if(n===void 0)return;let r=await resolveConnectionAuthorization(n);if(supportsInteractiveAuthorization(r))return r}async function completePendingAuthorizations(e){let t=loadContext(),r=new Set;for(let n of e.getConnections()){let i=getAuthorizationResult(n.connectionName);if(!i)continue;let a=await resolveInteractiveAuth(e,n.connectionName);if(!a)continue;let o=resolveConnectionPrincipal(n.connectionName,a),s=await a.completeAuthorization({callbackUrl:i.hookUrl,connection:{url:n.url??``},principal:o,resume:i.resume,callback:i.callback});writeCachedToken(t,n.connectionName,principalKey(o),s),r.add(n.connectionName)}return r}async function executeConnectionSearch(e){let t=loadContext(),r=t.get(ConnectionRegistryKey);if(r===void 0)return[];let a=await completePendingAuthorizations(r),c=e.limit??10,l=tokenize(e.keywords),u=[],d=[],f=e.connection!==void 0&&e.connection!==``?r.getConnections().filter(t=>t.connectionName===e.connection):r.getConnections(),m=[];for(let e of f){let t;try{t=await r.getClient(e.connectionName).getToolMetadata()}catch(t){if(isConnectionAuthorizationRequiredError(t)){if(a.has(e.connectionName)){logger.warn(`connection still unauthorized after authorization`,{connection:e.connectionName}),d.push({connection:e.connectionName,description:e.description,error:`Authorization for "${e.connectionName}" did not take effect; the token was rejected after sign-in.`});continue}let t=await resolveInteractiveAuth(r,e.connectionName);if(t){let n=getHookUrl(e.connectionName);if(n){let r=resolveConnectionPrincipal(e.connectionName,t),i=resolveAuthorizationCallbackUrl({authorization:t,callbackUrl:n});try{let{challenge:n,resume:a}=await t.startAuthorization({callbackUrl:i,connection:{url:e.url??``},principal:r});m.push({name:e.connectionName,challenge:stampChallengeDisplayName(n,t),hookUrl:i,resume:a})}catch(t){logger.warn(`startAuthorization failed`,{connection:e.connectionName,error:t instanceof Error?t:Error(String(t))})}}}d.push({connection:e.connectionName,description:e.description,needsAuthorization:!0});continue}if(isConnectionAuthorizationFailedError(t)){logger.warn(`connection authorization failed`,{connection:e.connectionName,reason:t.reason,retryable:t.retryable,error:t}),d.push({connection:e.connectionName,description:e.description,error:`Authorization failed for ${e.connectionName}: ${t.message}`});continue}let n=t instanceof Error?t.message:`unknown error`;logger.warn(`failed to load connection tools`,{connection:e.connectionName,error:t instanceof Error?t:Error(n)}),d.push({connection:e.connectionName,description:e.description,error:`Failed to load tools for "${e.connectionName}": ${n}`});continue}for(let n of t){let t=scoreMatch(l,n);t>0&&u.push({item:{connection:e.connectionName,description:n.description,inputSchema:n.inputSchema,outputSchema:n.outputSchema,qualifiedName:qualifiedConnectionToolName(e.connectionName,n.name),tool:n.name},score:t})}}if(m.length>0)return requestAuthorization(m);u.sort((e,t)=>t.score-e.score);let h=u.slice(0,c).map(e=>e.item);if(h.length>0){let e=[...h,...d],n=t.get(ConnectionSearchResultsKey)??[],r=new Map(n.map(e=>[e.qualifiedName,e]));for(let e of h)e.qualifiedName&&r.set(e.qualifiedName,e);return t.set(ConnectionSearchResultsKey,[...r.values()]),e}return f.map(e=>d.find(t=>t.connection===e.connectionName)||{connection:e.connectionName,description:e.description})}function extractDiscoveredTools(e){let t=new Map;for(let n of e){if(n.role!==`tool`)continue;let e=n.content;for(let n of e){if(n.type!==`tool-result`||n.toolName!==`connection_search`)continue;let e=n.output;if(e==null)continue;let r=typeof e==`object`&&`type`in e&&`value`in e?e.value:e;if(Array.isArray(r))for(let e of r)e.tool&&e.qualifiedName&&t.set(e.qualifiedName,e)}}return[...t.values()]}function createConnectionSearchEvents(){return{"step.started":async(e,t)=>{let r=loadContext().get(ConnectionRegistryKey);if(!r||r.getConnections().length===0)return null;let o=r.getConnections().map(e=>e.connectionName),l=extractDiscoveredTools(t.messages),u=loadContext().get(ConnectionSearchResultsKey)??[],p=new Map;for(let e of u)e.qualifiedName&&p.set(e.qualifiedName,e);for(let e of l)e.qualifiedName&&p.set(e.qualifiedName,e);let h=[...p.values()],g={};g.connection_search={description:`Search for tools across your connections. Discovered tools become directly callable by their qualified name (e.g. \`linear__list_issues\`) in your next response. Available connections: ${o.join(`, `)}.`,inputSchema:CONNECTION_SEARCH_INPUT_SCHEMA,async execute(e){return executeConnectionSearch(e)},outputSchema:CONNECTION_SEARCH_OUTPUT_SCHEMA};for(let e of h){let t=e.connection,o=e.tool,l=r.getConnectionApproval(t);g[qualifiedConnectionToolName(t,o)]={description:e.description,inputSchema:e.inputSchema??{type:`object`},approval:l,outputSchema:e.outputSchema,async execute(e,r){let l=loadContext().get(ConnectionRegistryKey),u=l.getConnections().find(e=>e.connectionName===t),p=await resolveInteractiveAuth(l,t),m=!1;if(p){let e=getAuthorizationResult(t);if(e){m=!0;let r=loadContext(),i=resolveConnectionPrincipal(t,p),a=await p.completeAuthorization({callbackUrl:e.hookUrl,connection:{url:u?.url??``},principal:i,resume:e.resume,callback:e.callback});writeCachedToken(r,t,principalKey(i),a)}}try{return await l.getClient(t).executeTool(o,e,{abortSignal:r.abortSignal})}catch(e){if(!isConnectionAuthorizationRequiredError(e)||!p)throw e;if(m)throw new ConnectionAuthorizationFailedError(t,{retryable:!1,reason:`token_rejected_after_authorization`,message:`Connection "${t}" rejected the token immediately after authorization.`});let n=getHookUrl(t);if(!n)throw e;let r=resolveConnectionPrincipal(t,p),i=resolveAuthorizationCallbackUrl({authorization:p,callbackUrl:n}),{challenge:o,resume:c}=await p.startAuthorization({callbackUrl:i,connection:{url:u?.url??``},principal:r});return requestAuthorization([{name:t,challenge:stampChallengeDisplayName(o,p),hookUrl:i,resume:c}])}}}}return g}}}function createConnectionSearchResolver(){let e=createConnectionSearchEvents();return{slug:`connection`,eventNames:Object.keys(e),events:e,sourceId:`eve:connection-search-dynamic`,sourceKind:`module`,logicalPath:`eve:framework/connection-search-dynamic`}}export{createConnectionSearchEvents,createConnectionSearchResolver,extractDiscoveredTools};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{toInputSchema}from"#shared/tool-schema.js";const FINAL_OUTPUT_TOOL_NAME=`final_output`;function buildFinalOutputTool(e){let t=toInputSchema(e);return{description:`Deliver your final answer in the required structure by calling this tool. Call it exactly once, when you are done; do not answer in prose.`,inputSchema:t,outputSchema:t}}export{FINAL_OUTPUT_TOOL_NAME,buildFinalOutputTool};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "#compiled/zod/index.js";
|
|
2
2
|
import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Shared input schema used by the framework `glob` tool and any author tool
|
|
@@ -8,10 +8,19 @@ import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
|
8
8
|
* `GLOB_TOOL_DEFINITION` use the exact same schema object — keeping model
|
|
9
9
|
* input contracts in sync without duplication.
|
|
10
10
|
*/
|
|
11
|
-
export declare const GLOB_INPUT_SCHEMA:
|
|
11
|
+
export declare const GLOB_INPUT_SCHEMA: z.ZodObject<{
|
|
12
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
path: z.ZodOptional<z.ZodString>;
|
|
14
|
+
pattern: z.ZodString;
|
|
15
|
+
}, z.core.$strict>;
|
|
12
16
|
/**
|
|
13
17
|
* Shared output schema used by the framework `glob` tool and any author tool
|
|
14
18
|
* constructed via {@link defineGlobTool}.
|
|
15
19
|
*/
|
|
16
|
-
export declare const GLOB_OUTPUT_SCHEMA:
|
|
20
|
+
export declare const GLOB_OUTPUT_SCHEMA: z.ZodObject<{
|
|
21
|
+
content: z.ZodString;
|
|
22
|
+
count: z.ZodNumber;
|
|
23
|
+
path: z.ZodString;
|
|
24
|
+
truncated: z.ZodBoolean;
|
|
25
|
+
}, z.core.$strict>;
|
|
17
26
|
export declare const GLOB_TOOL_DEFINITION: ResolvedToolDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{requireSandboxSession}from"#execution/sandbox/require-sandbox.js";import{executeGlobOnSandbox}from"#execution/sandbox/glob-tool.js";const GLOB_INPUT_SCHEMA={
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{requireSandboxSession}from"#execution/sandbox/require-sandbox.js";import{executeGlobOnSandbox}from"#execution/sandbox/glob-tool.js";const GLOB_INPUT_SCHEMA=z.strictObject({limit:z.number().int().min(1).max(1e3).describe(`Maximum number of results to return. Defaults to 100.`).optional(),path:z.string().describe(`The directory to search in. Defaults to /workspace. Must be an absolute path. Omit to use the default.`).optional(),pattern:z.string().describe(`The glob pattern to match files against (e.g. "**/*.ts", "src/**/*.js").`)}),GLOB_OUTPUT_SCHEMA=z.strictObject({content:z.string(),count:z.number().int(),path:z.string(),truncated:z.boolean()});async function executeGlob(e,t){return executeGlobOnSandbox(await requireSandboxSession(t?.abortSignal),e)}const GLOB_TOOL_DEFINITION={description:[`Fast file pattern matching tool that works with any codebase size.`,``,`Usage:`,`- Supports glob patterns like "**/*.js" or "src/**/*.ts".`,`- Returns matching file paths.`,`- Use this tool when you need to find files by name patterns.`,`- If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.`,`- Use the grep tool instead if you need to search file contents.`,`- Call this tool in parallel when you know there are multiple patterns to search for.`].join(`
|
|
2
2
|
`),execute:executeGlob,inputSchema:GLOB_INPUT_SCHEMA,logicalPath:`eve:framework/glob`,name:`glob`,outputSchema:GLOB_OUTPUT_SCHEMA,sourceId:`eve:glob-tool`,sourceKind:`module`};export{GLOB_INPUT_SCHEMA,GLOB_OUTPUT_SCHEMA,GLOB_TOOL_DEFINITION};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "#compiled/zod/index.js";
|
|
2
2
|
import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Shared input schema used by the framework `grep` tool and any author tool
|
|
@@ -8,10 +8,23 @@ import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
|
8
8
|
* `GREP_TOOL_DEFINITION` use the exact same schema object — keeping model
|
|
9
9
|
* input contracts in sync without duplication.
|
|
10
10
|
*/
|
|
11
|
-
export declare const GREP_INPUT_SCHEMA:
|
|
11
|
+
export declare const GREP_INPUT_SCHEMA: z.ZodObject<{
|
|
12
|
+
context: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
glob: z.ZodOptional<z.ZodString>;
|
|
14
|
+
ignoreCase: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
literal: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
path: z.ZodOptional<z.ZodString>;
|
|
18
|
+
pattern: z.ZodString;
|
|
19
|
+
}, z.core.$strict>;
|
|
12
20
|
/**
|
|
13
21
|
* Shared output schema used by the framework `grep` tool and any author tool
|
|
14
22
|
* constructed via {@link defineGrepTool}.
|
|
15
23
|
*/
|
|
16
|
-
export declare const GREP_OUTPUT_SCHEMA:
|
|
24
|
+
export declare const GREP_OUTPUT_SCHEMA: z.ZodObject<{
|
|
25
|
+
content: z.ZodString;
|
|
26
|
+
matchCount: z.ZodNumber;
|
|
27
|
+
path: z.ZodString;
|
|
28
|
+
truncated: z.ZodBoolean;
|
|
29
|
+
}, z.core.$strict>;
|
|
17
30
|
export declare const GREP_TOOL_DEFINITION: ResolvedToolDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{requireSandboxSession}from"#execution/sandbox/require-sandbox.js";import{executeGrepOnSandbox}from"#execution/sandbox/grep-tool.js";const GREP_INPUT_SCHEMA={
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{requireSandboxSession}from"#execution/sandbox/require-sandbox.js";import{executeGrepOnSandbox}from"#execution/sandbox/grep-tool.js";const GREP_INPUT_SCHEMA=z.strictObject({context:z.number().int().min(0).describe(`Number of surrounding context lines to include before and after each match. Defaults to 0.`).optional(),glob:z.string().describe(`Filter files by glob pattern (e.g. "*.ts", "*.{ts,tsx}").`).optional(),ignoreCase:z.boolean().describe(`Perform case-insensitive search. Defaults to false.`).optional(),limit:z.number().int().min(1).max(1e3).describe(`Maximum number of matches to return per file. Defaults to 100.`).optional(),literal:z.boolean().describe(`Treat the pattern as a literal string instead of a regular expression. Defaults to false.`).optional(),path:z.string().describe(`The directory or file to search in. Defaults to /workspace. Must be an absolute path. Omit to use the default.`).optional(),pattern:z.string().describe(`The regex pattern to search for in file contents (e.g. "log.*Error", "function\\s+\\w+").`)}),GREP_OUTPUT_SCHEMA=z.strictObject({content:z.string(),matchCount:z.number().int(),path:z.string(),truncated:z.boolean()});async function executeGrep(e,t){return executeGrepOnSandbox(await requireSandboxSession(t?.abortSignal),e)}const GREP_TOOL_DEFINITION={description:[`Fast content search tool that works with any codebase size.`,``,`Usage:`,`- Searches file contents using regular expressions.`,`- Supports full regex syntax (e.g. "log.*Error", "function\\s+\\w+").`,`- Filter files by pattern with the glob parameter (e.g. "*.js", "*.{ts,tsx}").`,`- Returns matching lines with file paths and line numbers.`,`- Use this tool when you need to find files containing specific patterns.`,`- Use the glob tool instead if you only need to find files by name.`,`- Call this tool in parallel when you have multiple independent searches.`,`- Any line longer than 2000 characters is truncated.`].join(`
|
|
2
2
|
`),execute:executeGrep,inputSchema:GREP_INPUT_SCHEMA,logicalPath:`eve:framework/grep`,name:`grep`,outputSchema:GREP_OUTPUT_SCHEMA,sourceId:`eve:grep-tool`,sourceKind:`module`};export{GREP_INPUT_SCHEMA,GREP_OUTPUT_SCHEMA,GREP_TOOL_DEFINITION};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from "#compiled/zod/index.js";
|
|
2
2
|
import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Shared input schema used by the framework `read_file` tool and any author
|
|
@@ -8,10 +8,20 @@ import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
|
8
8
|
* `READ_FILE_TOOL_DEFINITION` use the exact same schema object — keeping
|
|
9
9
|
* model input contracts in sync without duplication.
|
|
10
10
|
*/
|
|
11
|
-
export declare const READ_FILE_INPUT_SCHEMA:
|
|
11
|
+
export declare const READ_FILE_INPUT_SCHEMA: z.ZodObject<{
|
|
12
|
+
filePath: z.ZodString;
|
|
13
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
}, z.core.$strict>;
|
|
12
16
|
/**
|
|
13
17
|
* Shared output schema used by the framework `read_file` tool and any author
|
|
14
18
|
* tool constructed via {@link defineReadFileTool}.
|
|
15
19
|
*/
|
|
16
|
-
export declare const READ_FILE_OUTPUT_SCHEMA:
|
|
20
|
+
export declare const READ_FILE_OUTPUT_SCHEMA: z.ZodObject<{
|
|
21
|
+
content: z.ZodString;
|
|
22
|
+
nextOffset: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
path: z.ZodString;
|
|
24
|
+
totalLines: z.ZodNumber;
|
|
25
|
+
truncated: z.ZodBoolean;
|
|
26
|
+
}, z.core.$strict>;
|
|
17
27
|
export declare const READ_FILE_TOOL_DEFINITION: ResolvedToolDefinition;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{requireSandboxSession}from"#execution/sandbox/require-sandbox.js";import{executeReadFileOnSandbox}from"#execution/sandbox/read-file-tool.js";const READ_FILE_INPUT_SCHEMA={
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{requireSandboxSession}from"#execution/sandbox/require-sandbox.js";import{executeReadFileOnSandbox}from"#execution/sandbox/read-file-tool.js";const READ_FILE_INPUT_SCHEMA=z.strictObject({filePath:z.string().describe(`The absolute path to the file to read.`),limit:z.number().int().min(1).describe(`Maximum number of lines to return. Defaults to 2000.`).optional(),offset:z.number().int().min(1).describe(`1-based line number to start from. Defaults to 1.`).optional()}),READ_FILE_OUTPUT_SCHEMA=z.strictObject({content:z.string(),nextOffset:z.number().int().min(1).optional(),path:z.string(),totalLines:z.number().int().min(0),truncated:z.boolean()});async function executeReadFile(e,t){return executeReadFileOnSandbox(await requireSandboxSession(t?.abortSignal),e)}const READ_FILE_TOOL_DEFINITION={description:[`Read a file from the local filesystem. If the path does not exist, an error is returned.`,``,`Usage:`,`- The filePath parameter should be an absolute path.`,`- By default, this tool returns up to 2000 lines from the start of the file.`,`- The offset parameter is the line number to start from (1-indexed).`,`- To read later sections, call this tool again with a larger offset.`,`- Use the grep tool to find specific content in large files or files with long lines.`,`- If you are unsure of the correct file path, use the glob tool to look up filenames by glob pattern.`,'- Contents are returned with each line prefixed by its line number as `<line>: <content>`. For example, if a file has contents "foo\\n", you will receive "1: foo\\n".',`- Any line longer than 2000 characters is truncated.`,`- Call this tool in parallel when you know there are multiple files you want to read.`,`- Avoid tiny repeated slices (30 line chunks). If you need more context, read a larger window.`].join(`
|
|
2
2
|
`),execute:executeReadFile,inputSchema:READ_FILE_INPUT_SCHEMA,logicalPath:`eve:framework/read-file`,name:`read_file`,outputSchema:READ_FILE_OUTPUT_SCHEMA,sourceId:`eve:read-file-tool`,sourceKind:`module`};export{READ_FILE_INPUT_SCHEMA,READ_FILE_OUTPUT_SCHEMA,READ_FILE_TOOL_DEFINITION};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { z } from "#compiled/zod/index.js";
|
|
1
2
|
import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
export declare const SKILL_INPUT_SCHEMA: z.ZodObject<{
|
|
4
|
+
skill: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
export declare const SKILL_OUTPUT_SCHEMA: z.ZodString;
|
|
4
7
|
export declare const SKILL_TOOL_DEFINITION: ResolvedToolDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DynamicSkillManifestKey,SandboxKey}from"#context/keys.js";import{loadContext}from"#context/container.js";import{loadSkillFromSandbox}from"#runtime/skills/sandbox-access.js";import{ConnectionRegistryKey}from"#context/providers/connection-key.js";async function executeLoadSkillTool(e){let
|
|
1
|
+
import{z}from"#compiled/zod/index.js";import{DynamicSkillManifestKey,SandboxKey}from"#context/keys.js";import{loadContext}from"#context/container.js";import{loadSkillFromSandbox}from"#runtime/skills/sandbox-access.js";import{ConnectionRegistryKey}from"#context/providers/connection-key.js";async function executeLoadSkillTool(e){let t=loadContext(),i=t.get(SandboxKey);if(i===void 0)throw Error(`The load_skill tool requires sandbox access on the runtime context. Ensure the step is running inside a managed runtime context with sandbox support.`);let{skill:a}=e,o=availableSkillNames(t);try{return await loadSkillFromSandbox(i,a,o)}catch(e){let n=t.get(ConnectionRegistryKey)?.getConnectionNames().find(e=>e.toLowerCase()===a.toLowerCase());if(n===void 0||o.includes(a))throw e;let r=e instanceof Error?e.message:String(e);throw Error(`${r} "${n}" is an installed connection, not a skill. Use connection_search with connection "${n}" to find its tools.`,{cause:e})}}function availableSkillNames(e){let n=Object.values(e.get(DynamicSkillManifestKey)??{}).flat().map(e=>e.name);return[...new Set(n)].sort()}const SKILL_INPUT_SCHEMA=z.strictObject({skill:z.string().describe(`Available skill name or id.`)}),SKILL_OUTPUT_SCHEMA=z.string(),SKILL_TOOL_DEFINITION={description:[`Load the full instructions for one available skill by name or id.`,`Use this tool when the request clearly matches a listed skill description or when the user explicitly asks for that skill.`,`This is not for MCP connections; use connection_search to access an installed connection.`,`Loading adds the skill instructions to the current turn.`,`Choose the "skill" value from the Available skills block.`].join(` `),execute:e=>executeLoadSkillTool(e),inputSchema:SKILL_INPUT_SCHEMA,logicalPath:`eve:framework/load-skill`,name:`load_skill`,outputSchema:SKILL_OUTPUT_SCHEMA,sourceId:`eve:load-skill-tool`,sourceKind:`module`};export{SKILL_INPUT_SCHEMA,SKILL_OUTPUT_SCHEMA,SKILL_TOOL_DEFINITION};
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import type { ModelMessage } from "ai";
|
|
2
|
+
import { z } from "#compiled/zod/index.js";
|
|
2
3
|
import { ContextKey } from "#context/key.js";
|
|
3
4
|
import type { ResolvedToolDefinition } from "#runtime/types.js";
|
|
4
|
-
import type { JsonObject } from "#shared/json.js";
|
|
5
5
|
/**
|
|
6
6
|
* Single item in the todo list.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
readonly content: string;
|
|
10
|
-
readonly priority: "high" | "medium" | "low";
|
|
11
|
-
readonly status: "pending" | "in_progress" | "completed" | "cancelled";
|
|
12
|
-
}
|
|
8
|
+
export type TodoItem = z.infer<typeof TODO_ITEM_SCHEMA>;
|
|
13
9
|
/**
|
|
14
10
|
* Durable state for the framework todo tool.
|
|
15
11
|
*/
|
|
@@ -23,9 +19,7 @@ export declare const TodoStateKey: ContextKey<TodoState>;
|
|
|
23
19
|
* When `todos` is provided, the list is replaced (full replacement write).
|
|
24
20
|
* When `todos` is omitted, the current list is returned without modification.
|
|
25
21
|
*/
|
|
26
|
-
export
|
|
27
|
-
readonly todos?: readonly TodoItem[];
|
|
28
|
-
}
|
|
22
|
+
export type TodoToolInput = z.infer<typeof TODO_INPUT_SCHEMA>;
|
|
29
23
|
/**
|
|
30
24
|
* Builds the message that re-injects the current todo list after the harness
|
|
31
25
|
* compacts message history, so the agent keeps its task list across
|
|
@@ -42,5 +36,58 @@ export declare function getTodoCompactionMessage(): ModelMessage | undefined;
|
|
|
42
36
|
* the full current state.
|
|
43
37
|
*/
|
|
44
38
|
export declare function executeTodoTool(input: TodoToolInput): unknown;
|
|
45
|
-
|
|
39
|
+
declare const TODO_ITEM_SCHEMA: z.ZodObject<{
|
|
40
|
+
content: z.ZodString;
|
|
41
|
+
priority: z.ZodEnum<{
|
|
42
|
+
high: "high";
|
|
43
|
+
low: "low";
|
|
44
|
+
medium: "medium";
|
|
45
|
+
}>;
|
|
46
|
+
status: z.ZodEnum<{
|
|
47
|
+
cancelled: "cancelled";
|
|
48
|
+
completed: "completed";
|
|
49
|
+
in_progress: "in_progress";
|
|
50
|
+
pending: "pending";
|
|
51
|
+
}>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
export declare const TODO_INPUT_SCHEMA: z.ZodObject<{
|
|
54
|
+
todos: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
55
|
+
content: z.ZodString;
|
|
56
|
+
priority: z.ZodEnum<{
|
|
57
|
+
high: "high";
|
|
58
|
+
low: "low";
|
|
59
|
+
medium: "medium";
|
|
60
|
+
}>;
|
|
61
|
+
status: z.ZodEnum<{
|
|
62
|
+
cancelled: "cancelled";
|
|
63
|
+
completed: "completed";
|
|
64
|
+
in_progress: "in_progress";
|
|
65
|
+
pending: "pending";
|
|
66
|
+
}>;
|
|
67
|
+
}, z.core.$strict>>>;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
export declare const TODO_OUTPUT_SCHEMA: z.ZodObject<{
|
|
70
|
+
counts: z.ZodObject<{
|
|
71
|
+
cancelled: z.ZodNumber;
|
|
72
|
+
completed: z.ZodNumber;
|
|
73
|
+
in_progress: z.ZodNumber;
|
|
74
|
+
pending: z.ZodNumber;
|
|
75
|
+
total: z.ZodNumber;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
todos: z.ZodArray<z.ZodObject<{
|
|
78
|
+
content: z.ZodString;
|
|
79
|
+
priority: z.ZodEnum<{
|
|
80
|
+
high: "high";
|
|
81
|
+
low: "low";
|
|
82
|
+
medium: "medium";
|
|
83
|
+
}>;
|
|
84
|
+
status: z.ZodEnum<{
|
|
85
|
+
cancelled: "cancelled";
|
|
86
|
+
completed: "completed";
|
|
87
|
+
in_progress: "in_progress";
|
|
88
|
+
pending: "pending";
|
|
89
|
+
}>;
|
|
90
|
+
}, z.core.$strict>>;
|
|
91
|
+
}, z.core.$strict>;
|
|
46
92
|
export declare const TODO_TOOL_DEFINITION: ResolvedToolDefinition;
|
|
93
|
+
export {};
|