@hearsay-tools/squawk 0.18.0-dev.8044 → 0.18.0-dev.8054
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/built-in-tool-definitions.d.ts +4 -0
- package/dist/built-in-tool-definitions.js +61 -0
- package/dist/built-in-tool-definitions.js.map +1 -0
- package/dist/built-in-tools.d.ts +3 -0
- package/dist/built-in-tools.js +9 -0
- package/dist/built-in-tools.js.map +1 -0
- package/dist/built-in-wait-kinds.d.ts +3 -0
- package/dist/built-in-wait-kinds.js +10 -0
- package/dist/built-in-wait-kinds.js.map +1 -0
- package/dist/ci-wait/client.d.ts +75 -0
- package/dist/ci-wait/client.js +44 -13
- package/dist/ci-wait/client.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +57 -1153
- package/dist/ci-wait/controller.js +56 -175
- package/dist/ci-wait/controller.js.map +1 -1
- package/dist/ci-wait/mcp.d.ts +1 -1
- package/dist/ci-wait/mcp.js +7 -5
- package/dist/ci-wait/mcp.js.map +1 -1
- package/dist/ci-wait/tool-catalog.d.ts +19 -578
- package/dist/ci-wait/tool-catalog.js +17 -38
- package/dist/ci-wait/tool-catalog.js.map +1 -1
- package/dist/ci-wait/tool-names.d.ts +1 -8
- package/dist/ci-wait/tool-names.js +8 -16
- package/dist/ci-wait/tool-names.js.map +1 -1
- package/dist/ci-wait/tool-registry.d.ts +64 -0
- package/dist/ci-wait/tool-registry.js +32 -0
- package/dist/ci-wait/tool-registry.js.map +1 -0
- package/dist/ci-wait/tools.d.ts +454 -10
- package/dist/ci-wait/tools.js +40 -28
- package/dist/ci-wait/tools.js.map +1 -1
- package/dist/contract/agent-tools.d.ts +51 -0
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +21 -0
- package/dist/delegation/park-notice.js +2 -2
- package/dist/delegation/park-notice.js.map +1 -1
- package/dist/delegation/transport.d.ts +11 -11
- package/dist/runs/run-exits.d.ts +336 -336
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/server.d.ts +1559 -1559
- package/dist/subcommands.js +6 -0
- package/dist/subcommands.js.map +1 -1
- package/dist/workflows/continuation-admission.d.ts +72 -72
- package/dist/workflows/run/compose.d.ts +1 -1
- package/dist/workflows/run/continuation-session.js +2 -2
- package/dist/workflows/run/continuation-session.js.map +1 -1
- package/dist/workflows/run/done-accepted.js +4 -4
- package/dist/workflows/run/done-accepted.js.map +1 -1
- package/dist/workflows/run/input-batch.js +2 -2
- package/dist/workflows/run/input-batch.js.map +1 -1
- package/dist/workflows/run/input-delivery.js +2 -2
- package/dist/workflows/run/input-delivery.js.map +1 -1
- package/dist/workflows/run/squawk-tools.d.ts +1 -1
- package/dist/workflows/run/step-loop.js +2 -2
- package/dist/workflows/run/step-loop.js.map +1 -1
- package/dist/workflows/run/subagent-waits.js +2 -2
- package/dist/workflows/run/subagent-waits.js.map +1 -1
- package/dist/workflows/run/turn-settler.js +2 -2
- package/dist/workflows/run/turn-settler.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +3 -1
- package/dist/workflows/run/wait-engine.js +50 -6
- package/dist/workflows/run/wait-engine.js.map +1 -1
- package/dist/workflows/run/wait-input-descriptors.d.ts +3 -0
- package/dist/workflows/run/wait-input-descriptors.js +30 -0
- package/dist/workflows/run/wait-input-descriptors.js.map +1 -0
- package/dist/workflows/run/wait-kind-registry.d.ts +73 -0
- package/dist/workflows/run/wait-kind-registry.js +35 -0
- package/dist/workflows/run/wait-kind-registry.js.map +1 -0
- package/dist/workflows/run/wait-kinds.d.ts +1033 -4
- package/dist/workflows/run/wait-kinds.js +45 -9
- package/dist/workflows/run/wait-kinds.js.map +1 -1
- package/dist/workflows/run/wait-registration-tool.js +3 -3
- package/dist/workflows/run/wait-registration-tool.js.map +1 -1
- package/dist/workflows/run/wait-registration.js +13 -8
- package/dist/workflows/run/wait-registration.js.map +1 -1
- package/dist/workflows/run/wait-registry.d.ts +5 -1
- package/dist/workflows/run/wait-registry.js +42 -2
- package/dist/workflows/run/wait-registry.js.map +1 -1
- package/dist/workflows/run/wake-admission.js +7 -3
- package/dist/workflows/run/wake-admission.js.map +1 -1
- package/dist/workflows/run.d.ts +1 -1
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/waits.d.ts +3 -8
- package/dist/workflows/waits.js +10 -15
- package/dist/workflows/waits.js.map +1 -1
- package/package.json +4 -4
- package/scripts/benchmark-runtime.ts +6 -0
- package/scripts/measure-transcript-facts-health.mjs +6 -0
- package/scripts/mock-ci-tool.mjs +1 -1
- package/scripts/mock-wire-tools.mjs +7 -1
- package/scripts/omp-ci-wait.mjs +4 -14
- package/scripts/pi-ci-wait.mjs +3 -13
|
@@ -1,45 +1,28 @@
|
|
|
1
|
+
import { agentToolMetadata, enabledAgentTools } from './tool-registry.js';
|
|
1
2
|
import { automationToolRequestSchema } from '../contract/index.js';
|
|
2
|
-
import {
|
|
3
|
-
import { squawkAskRequestSchema, squawkCancelWaitRequestSchema, squawkDoneRequestSchema, builtInSquawkWaitRequestSchema } from '../contract/index.js';
|
|
3
|
+
import { squawkAskRequestSchema, squawkCancelWaitRequestSchema, squawkDoneRequestSchema } from '../contract/index.js';
|
|
4
4
|
import { ASK_LIMITS } from '../contract/index.js';
|
|
5
5
|
import { previewStopRequestSchema, previewServeRequestSchema } from '../contract/index.js';
|
|
6
6
|
import { scheduleTaskRequestSchema, scheduledTasksRequestSchema } from '../contract/index.js';
|
|
7
|
+
import { registeredWaitKinds } from '../workflows/run/wait-kind-registry.js';
|
|
7
8
|
import { z } from 'zod';
|
|
8
9
|
/**
|
|
9
10
|
* The Anthropic tool API refuses a top-level `oneOf`/`anyOf`/`allOf`, so `cezar_wait` advertises
|
|
10
11
|
* one flat object: every kind's fields side by side, with `kind` as an enum. Each field's bounds
|
|
11
12
|
* come from its kind's own schema; the discriminated union validates on the server.
|
|
12
13
|
*/
|
|
13
|
-
function flatWaitInputSchema() {
|
|
14
|
+
export function flatWaitInputSchema() {
|
|
15
|
+
const inputs = registeredWaitKinds().flatMap(row => row.inputs ?? []).sort((a, b) => a.order - b.order);
|
|
14
16
|
const properties = {};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
for (const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
kind: { type: 'string', enum: builtInSquawkWaitRequestSchema.options.map(option => option.shape.kind.value), description: '"pr" waits for a GitHub pull request: its checks or its merge (see `until`); "worker" waits for workers you own; "request" waits for replies to requests you sent; "peer" waits for named peer tasks to message you or settle; "timer" wakes you after `seconds`; "process" wakes you when a background command ends.' },
|
|
25
|
-
operation_id: field('operation_id', 'Optional retry identity. Reuse it with exactly the same arguments after an unknown outcome; never use it for a different registration.'),
|
|
26
|
-
pr: field('pr', 'kind "pr": the HTTPS GitHub pull request URL.'),
|
|
27
|
-
until: field('until', 'kind "pr": "checks" (default) watches checks; "merge" waits for merge or closure and ignores queue removal. After requesting a merge, use "merge_or_blocked": wakes on merge, closure, conflict, or neither queue membership nor enabled auto-merge remaining. Pending checks or a queue slot alone do not end it. All targets retain their deadline and query-error exits. Only "merged" confirms success; "blocked" requires inspection and grants no permission to retry or merge.'),
|
|
28
|
-
wake_on_conflict: field('wake_on_conflict', 'kind "pr": Default true for "checks" and "merge". Set false when your work depends on another PR merging and you want to ignore its conflicts. "merge_or_blocked" always reports conflicts, regardless of this setting. With "checks", a conflicting PR may have no checks, ending as no_checks or deadline.'),
|
|
29
|
-
head_sha: field('head_sha', 'kind "pr": optional. Right after you push, pass the pushed commit (`git rev-parse HEAD`): the wait watches it while GitHub still shows the previous head, for up to 60 seconds.'),
|
|
30
|
-
worker_ids: field('worker_ids', 'kind "worker": the workers you own to wait for (1–32 unique ids).'),
|
|
31
|
-
request_ids: field('request_ids', 'kind "request": the requests you sent, to a worker, your parent or a peer task, to wait for a reply to (1–32 unique ids).'),
|
|
32
|
-
peer_ids: field('peer_ids', 'kind "peer": the peer root tasks of this project to wait for (1–32 unique task ids; find them with `hsq message tasks`). A message from one of them, or one of them settling, ends the wait; other messages wake you and keep it open.'),
|
|
33
|
-
mode: field('mode', 'kind "worker" or "request": "any" wakes you when one selected id settles (default), "all" when every one has, "one" takes exactly one id.'),
|
|
34
|
-
timeout_seconds: field('timeout_seconds', 'The deadline in seconds. kind "pr": 1–7200, default 1800. kind "worker", "request" or "peer": 1–7200, default 600 (the default shown is the pr one). kind "process": 1–7200, default 1800.'),
|
|
35
|
-
seconds: field('seconds', 'kind "timer": seconds until the wake (60–7200).'),
|
|
36
|
-
pid: field('pid', 'kind "process": the PID of the background command: the `pid` the job start command printed.'),
|
|
37
|
-
exit_file: field('exit_file', 'kind "process": optional. The `exitFile` that `hsq job start` printed for this `pid`, in any `--dir`, or a file that your own wrapper writes the exit code to, in $TMPDIR or the worktree, with a new name for each command. Leave it out for a command that is already running or that writes its status file somewhere else.'),
|
|
38
|
-
note: field('note', 'kind "timer" or "process": what to re-check, handed back to you at the wake.'),
|
|
39
|
-
},
|
|
40
|
-
required: ['kind'],
|
|
41
|
-
additionalProperties: false,
|
|
42
|
-
};
|
|
17
|
+
for (const input of [...inputs].reverse())
|
|
18
|
+
Object.assign(properties, input.properties);
|
|
19
|
+
for (const input of inputs)
|
|
20
|
+
for (const [key, description] of Object.entries(input.descriptions ?? {})) {
|
|
21
|
+
if (key in properties)
|
|
22
|
+
properties[key] = { ...properties[key], description };
|
|
23
|
+
}
|
|
24
|
+
properties.kind = { type: 'string', enum: inputs.map(input => input.kind), description: inputs.map(input => input.description).join('; ') };
|
|
25
|
+
return { type: 'object', properties, required: ['kind'], additionalProperties: false };
|
|
43
26
|
}
|
|
44
27
|
export const waitToolDefinition = {
|
|
45
28
|
name: 'cezar_wait',
|
|
@@ -59,7 +42,7 @@ export const waitToolDefinition = {
|
|
|
59
42
|
'The wake then reports `exited` without a code: read the command\'s own log or status file after it. ' +
|
|
60
43
|
'Never start a watcher or helper process to copy a file into $TMPDIR. ' +
|
|
61
44
|
'An unchanged repeat names the retained wait. A changed timeout is refused and keeps that wait active; do not cancel it as a duplicate. On an unknown outcome retry the same operation_id and arguments, without a fallback timer.',
|
|
62
|
-
inputSchema
|
|
45
|
+
get inputSchema() { return flatWaitInputSchema(); },
|
|
63
46
|
};
|
|
64
47
|
/**
|
|
65
48
|
* hearsay-tools/cezarion#1234: the user's answer gets its own tool, so its card is required and
|
|
@@ -139,12 +122,8 @@ export const automationToolDefinition = {
|
|
|
139
122
|
description: 'Create, show, preview or enable a repeating automation in this project. "create" takes definition: a GitHub poll (kind github, events, intervalSeconds, filters and task) or repeating schedule (kind schedule, schedule and task). Creation is always paused. The Automations system instructions give the absolute CLI command: run its schema subcommand on demand for definition fields, bounds and prompt placeholders before creating. "show", "preview" and "enable" take its id. "preview" checks a GitHub poll without launching tasks. "enable" requires explicit: true, only when the user explicitly asked to switch it on; a poll also needs a successful preview of its current definition in this session. Autonomy is not enable consent. Report the url and preview matches, or next_run_at for a schedule (UTC; convert to the user’s zone). On refusal stop and report the error; never substitute a cron job, GitHub Action or polling script. Use cezar_schedule_task and cezar_scheduled_tasks for one-time schedules. Leave task.archiveWhenDone and task.autoMergePr off unless the user asks for each completion action.',
|
|
140
123
|
inputSchema: flatAutomationInputSchema(),
|
|
141
124
|
};
|
|
142
|
-
/** Tool definitions in
|
|
125
|
+
/** Tool definitions in registration order, evaluated only after boot seals. */
|
|
143
126
|
export function squawkToolDefinitions(env = process.env) {
|
|
144
|
-
return
|
|
145
|
-
waitToolDefinition, askToolDefinition, cancelWaitToolDefinition, doneToolDefinition,
|
|
146
|
-
...(previewToolEnabled(env) ? [previewToolDefinition, previewStopToolDefinition] : []),
|
|
147
|
-
...(automationsToolEnabled(env) ? [scheduleTaskToolDefinition, automationToolDefinition, scheduledTasksToolDefinition] : []),
|
|
148
|
-
];
|
|
127
|
+
return enabledAgentTools(env).map(agentToolMetadata);
|
|
149
128
|
}
|
|
150
129
|
//# sourceMappingURL=tool-catalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-catalog.js","sourceRoot":"","sources":["../../src/ci-wait/tool-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tool-catalog.js","sourceRoot":"","sources":["../../src/ci-wait/tool-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AACzI,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAC3G,OAAO,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AACtH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACxG,MAAM,UAAU,GAA4B,EAAE,CAAC;IAC/C,KAAK,MAAM,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,OAAO,EAAE;QAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACvF,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,KAAK,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,MAAM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AC,UAAU,CAAC,CAAC;IACxI,OAAO,EAAE,IAAI,EAAE,QAAiB,EAAE,UAAU,EAAE;YAC5C,GAAG,UAAU;YACb,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;SAC/G,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;AACzD,CAAC;AACD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,mlCAAmlC;IAChmC,WAAW,EAAE,yBAAyB,EAAE;CACzC,CAAC;AAEF,+EAA+E;AAC/E,MAAM,UAAU,qBAAqB,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IACxE,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool names in the same order `squawkToolDefinitions` advertises them. A leaf, so a runner that
|
|
3
|
-
* only needs the names never loads the tool schemas; `ci-wait/tools.test.ts` pins the two lists together.
|
|
4
|
-
*/
|
|
5
1
|
export declare function squawkToolNames(env?: NodeJS.ProcessEnv): string[];
|
|
6
|
-
/**
|
|
7
|
-
* Env names a harness must forward to the adapter process. Several harnesses spawn MCP servers
|
|
8
|
-
* from an allowlist, so preview opt-in and automations opt-out must both reach the adapter.
|
|
9
|
-
*/
|
|
2
|
+
/** A feature may need its disabling flag forwarded even when it is disabled. */
|
|
10
3
|
export declare function squawkToolEnvNames(env?: NodeJS.ProcessEnv): string[];
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
* Tool names in the same order `squawkToolDefinitions` advertises them. A leaf, so a runner that
|
|
4
|
-
* only needs the names never loads the tool schemas; `ci-wait/tools.test.ts` pins the two lists together.
|
|
5
|
-
*/
|
|
1
|
+
import { enabledAgentTools, registeredAgentTools } from './tool-registry.js';
|
|
6
2
|
export function squawkToolNames(env = process.env) {
|
|
7
|
-
return
|
|
8
|
-
'cezar_wait', 'cezar_ask', 'cezar_cancel_wait', 'cezar_done',
|
|
9
|
-
...(previewToolEnabled(env) ? ['cezar_preview_serve', 'cezar_preview_stop'] : []),
|
|
10
|
-
...(automationsToolEnabled(env) ? ['cezar_schedule_task', 'cezar_automation', 'cezar_scheduled_tasks'] : []),
|
|
11
|
-
];
|
|
3
|
+
return enabledAgentTools(env).map(tool => tool.name);
|
|
12
4
|
}
|
|
13
|
-
/**
|
|
14
|
-
* Env names a harness must forward to the adapter process. Several harnesses spawn MCP servers
|
|
15
|
-
* from an allowlist, so preview opt-in and automations opt-out must both reach the adapter.
|
|
16
|
-
*/
|
|
5
|
+
/** A feature may need its disabling flag forwarded even when it is disabled. */
|
|
17
6
|
export function squawkToolEnvNames(env = process.env) {
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const names = new Set(['CEZ_TOOL_TOKEN', 'CEZ_TOOL_SOCKET', ...registeredAgentTools().flatMap(tool => tool.envNames?.(env) ?? []).sort()]);
|
|
8
|
+
return [...names].flatMap(name => {
|
|
9
|
+
const preferred = name.replace(/^CEZ_/, 'HSQ_');
|
|
10
|
+
return env[preferred] === undefined ? [name] : [name, preferred];
|
|
11
|
+
});
|
|
20
12
|
}
|
|
21
13
|
//# sourceMappingURL=tool-names.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-names.js","sourceRoot":"","sources":["../../src/ci-wait/tool-names.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"tool-names.js","sourceRoot":"","sources":["../../src/ci-wait/tool-names.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,MAAM,UAAU,eAAe,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IAClE,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC;AACD,gFAAgF;AAChF,MAAM,UAAU,kBAAkB,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IACrE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,oBAAoB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC3I,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { SquawkToolHandlers } from './controller.ts';
|
|
3
|
+
export type JsonObject = {
|
|
4
|
+
type: 'object';
|
|
5
|
+
properties?: Record<string, unknown>;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
export type AgentToolResult = {
|
|
9
|
+
content: Array<{
|
|
10
|
+
type: 'text';
|
|
11
|
+
text: string;
|
|
12
|
+
}>;
|
|
13
|
+
isError?: boolean | undefined;
|
|
14
|
+
details: unknown;
|
|
15
|
+
};
|
|
16
|
+
/** One registration owns metadata, validation, transport policy and session dispatch. */
|
|
17
|
+
export interface AgentToolDefinition {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string | (() => string);
|
|
20
|
+
inputSchema: JsonObject | (() => JsonObject);
|
|
21
|
+
trigger: string;
|
|
22
|
+
label: string;
|
|
23
|
+
enabled?(env: NodeJS.ProcessEnv): boolean;
|
|
24
|
+
envNames?(env: NodeJS.ProcessEnv): string[];
|
|
25
|
+
maxBodyBytes?: number;
|
|
26
|
+
timeoutMs?: number;
|
|
27
|
+
schema: z.ZodType;
|
|
28
|
+
runnerFields?: {
|
|
29
|
+
ids: string[];
|
|
30
|
+
};
|
|
31
|
+
invalid(error: z.ZodError, input: unknown): unknown;
|
|
32
|
+
oversized(): unknown;
|
|
33
|
+
disabled?(): unknown;
|
|
34
|
+
unavailable(error?: unknown, input?: unknown): unknown;
|
|
35
|
+
/** Wait registration receipts survive session revocation after their commit. */
|
|
36
|
+
committedReceipt?: boolean;
|
|
37
|
+
handle(handlers: SquawkToolHandlers, input: unknown, signal: AbortSignal): Promise<unknown>;
|
|
38
|
+
format?(answer: unknown): AgentToolResult;
|
|
39
|
+
invoke(input: unknown): Promise<AgentToolResult>;
|
|
40
|
+
}
|
|
41
|
+
export declare const registerAgentTool: (tool: AgentToolDefinition) => void;
|
|
42
|
+
export declare const sealAgentTools: () => void;
|
|
43
|
+
export declare const agentToolsSealed: () => boolean;
|
|
44
|
+
export declare const registeredAgentTools: () => AgentToolDefinition[];
|
|
45
|
+
export declare const agentTool: (key: string) => AgentToolDefinition | undefined;
|
|
46
|
+
export declare const agentToolNames: () => string[];
|
|
47
|
+
export declare function enabledAgentTools(env?: NodeJS.ProcessEnv): AgentToolDefinition[];
|
|
48
|
+
export declare function agentToolMetadata(tool: AgentToolDefinition): {
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
inputSchema: JsonObject;
|
|
52
|
+
trigger: string;
|
|
53
|
+
label: string;
|
|
54
|
+
};
|
|
55
|
+
export declare function agentToolInstructions(tools: Array<{
|
|
56
|
+
name: string;
|
|
57
|
+
trigger: string;
|
|
58
|
+
}>): string;
|
|
59
|
+
/** Adapters receive transport policy with metadata so feature hints stay feature-owned. */
|
|
60
|
+
export declare function agentToolTransport(tool: AgentToolDefinition): {
|
|
61
|
+
timeoutMs: number;
|
|
62
|
+
unavailable: AgentToolResult;
|
|
63
|
+
};
|
|
64
|
+
export declare function formatAgentToolAnswer(tool: AgentToolDefinition, answer: unknown): AgentToolResult;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createKeyedRegistry } from '../core/registry.js';
|
|
2
|
+
const registry = createKeyedRegistry({
|
|
3
|
+
name: 'Agent tool registry', reservedKeys: ['ci-wait'], bootHint: 'Call registerBuiltInTools(), then sealAgentTools() at boot.',
|
|
4
|
+
});
|
|
5
|
+
export const registerAgentTool = (tool) => registry.register(tool.name, tool);
|
|
6
|
+
export const sealAgentTools = registry.seal;
|
|
7
|
+
export const agentToolsSealed = registry.isSealed;
|
|
8
|
+
export const registeredAgentTools = registry.values;
|
|
9
|
+
export const agentTool = registry.get;
|
|
10
|
+
export const agentToolNames = registry.keys;
|
|
11
|
+
export function enabledAgentTools(env = process.env) {
|
|
12
|
+
return registeredAgentTools().filter(tool => !tool.enabled || tool.enabled(env));
|
|
13
|
+
}
|
|
14
|
+
export function agentToolMetadata(tool) {
|
|
15
|
+
return { name: tool.name, description: typeof tool.description === 'function' ? tool.description() : tool.description,
|
|
16
|
+
inputSchema: typeof tool.inputSchema === 'function' ? tool.inputSchema() : tool.inputSchema,
|
|
17
|
+
trigger: tool.trigger, label: tool.label };
|
|
18
|
+
}
|
|
19
|
+
export function agentToolInstructions(tools) {
|
|
20
|
+
return ['The interface to Squawk, the orchestrator running this session. Load a tool below when its situation comes up.',
|
|
21
|
+
...tools.map(tool => `- ${tool.name}: ${tool.trigger}`)].join('\n');
|
|
22
|
+
}
|
|
23
|
+
/** Adapters receive transport policy with metadata so feature hints stay feature-owned. */
|
|
24
|
+
export function agentToolTransport(tool) {
|
|
25
|
+
const answer = tool.unavailable();
|
|
26
|
+
return { timeoutMs: tool.timeoutMs ?? 15_000,
|
|
27
|
+
unavailable: formatAgentToolAnswer(tool, answer) };
|
|
28
|
+
}
|
|
29
|
+
export function formatAgentToolAnswer(tool, answer) {
|
|
30
|
+
return tool.format ? tool.format(answer) : { content: [{ type: 'text', text: JSON.stringify(answer) }], details: answer };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../src/ci-wait/tool-registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA2B1D,MAAM,QAAQ,GAAG,mBAAmB,CAA8B;IAChE,IAAI,EAAE,qBAAqB,EAAE,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,6DAA6D;CAChI,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAyB,EAAQ,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACzG,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,QAAQ,CAAC;AAClD,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC;AACpD,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC;AAC5C,MAAM,UAAU,iBAAiB,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IACpE,OAAO,oBAAoB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,E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