@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
package/dist/ci-wait/tools.d.ts
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
+
import { type AgentToolResult } from './tool-registry.ts';
|
|
1
2
|
import type { SquawkAskAnswer, SquawkWaitAnswer } from '../contract/index.js';
|
|
2
3
|
export { waitToolDefinition, askToolDefinition, cancelWaitToolDefinition, doneToolDefinition, previewToolDefinition, previewStopToolDefinition, scheduleTaskToolDefinition, automationToolDefinition, scheduledTasksToolDefinition } from './tool-catalog.ts';
|
|
3
4
|
export { previewToolEnabled, automationsToolEnabled } from './tool-env.ts';
|
|
4
5
|
export { squawkToolNames, squawkToolEnvNames } from './tool-names.ts';
|
|
6
|
+
import { callSquawkAsk, callSquawkCancelWait, callSquawkDone, callSquawkWait, callPreviewServe, callPreviewStop, callScheduleTask, callAutomation, callScheduledTasks } from './client.ts';
|
|
5
7
|
/**
|
|
6
8
|
* The one list of Squawk tools (#781). The MCP adapter lists it, Pi's extension registers it, and
|
|
7
9
|
* every allow-list or admission site reads its names, so adding a tool is one edit here.
|
|
8
10
|
*/
|
|
9
|
-
type ToolResult =
|
|
10
|
-
content: Array<{
|
|
11
|
-
type: 'text';
|
|
12
|
-
text: string;
|
|
13
|
-
}>;
|
|
14
|
-
isError?: boolean;
|
|
15
|
-
details: unknown;
|
|
16
|
-
};
|
|
11
|
+
type ToolResult = AgentToolResult;
|
|
17
12
|
export type SquawkTool = {
|
|
18
13
|
definition: {
|
|
19
14
|
name: string;
|
|
@@ -82,6 +77,53 @@ export declare function invokeAskTool(input: unknown): Promise<{
|
|
|
82
77
|
})[] | undefined;
|
|
83
78
|
};
|
|
84
79
|
}>;
|
|
80
|
+
export declare function formatAskTool(answer: Awaited<ReturnType<typeof callSquawkAsk>>): {
|
|
81
|
+
content: {
|
|
82
|
+
type: 'text';
|
|
83
|
+
text: string;
|
|
84
|
+
}[];
|
|
85
|
+
isError: boolean;
|
|
86
|
+
details: {
|
|
87
|
+
ok: true;
|
|
88
|
+
wait_id: string;
|
|
89
|
+
open_waits: ({
|
|
90
|
+
wait_id: string;
|
|
91
|
+
summary: string;
|
|
92
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
93
|
+
deadline: string;
|
|
94
|
+
} | {
|
|
95
|
+
wait_id: string;
|
|
96
|
+
summary: string;
|
|
97
|
+
kind: "human";
|
|
98
|
+
} | {
|
|
99
|
+
wait_id: string;
|
|
100
|
+
summary: string;
|
|
101
|
+
kind: "plugin";
|
|
102
|
+
pluginKind: string;
|
|
103
|
+
deadline?: string | undefined;
|
|
104
|
+
})[];
|
|
105
|
+
} | {
|
|
106
|
+
ok: false;
|
|
107
|
+
code: "autonomous_run" | "capability_revoked" | "capacity" | "finish_requested" | "generation_mismatch" | "invalid_request" | "manager_disposed" | "persistence" | "root_finish_pending" | "run_cancelled" | "run_missing" | "run_not_running" | "run_stopping" | "session_closed" | "session_replaced" | "supervisor_is_worker" | "unauthorized" | "unavailable" | "worker_execution_stopped" | "worker_wait_pending";
|
|
108
|
+
message: string;
|
|
109
|
+
open_waits?: ({
|
|
110
|
+
wait_id: string;
|
|
111
|
+
summary: string;
|
|
112
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
113
|
+
deadline: string;
|
|
114
|
+
} | {
|
|
115
|
+
wait_id: string;
|
|
116
|
+
summary: string;
|
|
117
|
+
kind: "human";
|
|
118
|
+
} | {
|
|
119
|
+
wait_id: string;
|
|
120
|
+
summary: string;
|
|
121
|
+
kind: "plugin";
|
|
122
|
+
pluginKind: string;
|
|
123
|
+
deadline?: string | undefined;
|
|
124
|
+
})[] | undefined;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
85
127
|
/** JSON first, then one hint sentence, as `invokePreviewTool` answers. */
|
|
86
128
|
export declare function waitAnswerHint(answer: SquawkWaitAnswer): string;
|
|
87
129
|
export declare function invokeWaitTool(input: unknown): Promise<{
|
|
@@ -156,6 +198,78 @@ export declare function invokeWaitTool(input: unknown): Promise<{
|
|
|
156
198
|
})[] | undefined;
|
|
157
199
|
};
|
|
158
200
|
}>;
|
|
201
|
+
export declare function formatWaitTool(answer: Awaited<ReturnType<typeof callSquawkWait>>): {
|
|
202
|
+
content: {
|
|
203
|
+
type: 'text';
|
|
204
|
+
text: string;
|
|
205
|
+
}[];
|
|
206
|
+
isError: boolean;
|
|
207
|
+
details: {
|
|
208
|
+
operation_id?: string | undefined;
|
|
209
|
+
ok: true;
|
|
210
|
+
effect?: "applied" | "unchanged" | undefined;
|
|
211
|
+
deduplicated?: boolean | undefined;
|
|
212
|
+
replayed?: boolean | undefined;
|
|
213
|
+
wait_phase?: "cancelled" | "delivered" | "open" | "resolved" | "unavailable" | undefined;
|
|
214
|
+
wait_id: string;
|
|
215
|
+
kind: string;
|
|
216
|
+
deadline?: string | undefined;
|
|
217
|
+
open_waits: ({
|
|
218
|
+
wait_id: string;
|
|
219
|
+
summary: string;
|
|
220
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
221
|
+
deadline: string;
|
|
222
|
+
} | {
|
|
223
|
+
wait_id: string;
|
|
224
|
+
summary: string;
|
|
225
|
+
kind: "human";
|
|
226
|
+
} | {
|
|
227
|
+
wait_id: string;
|
|
228
|
+
summary: string;
|
|
229
|
+
kind: "plugin";
|
|
230
|
+
pluginKind: string;
|
|
231
|
+
deadline?: string | undefined;
|
|
232
|
+
})[];
|
|
233
|
+
} | {
|
|
234
|
+
operation_id?: string | undefined;
|
|
235
|
+
ok: false;
|
|
236
|
+
effect?: "refused" | "unknown" | undefined;
|
|
237
|
+
retained_wait?: {
|
|
238
|
+
wait_id: string;
|
|
239
|
+
summary: string;
|
|
240
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
241
|
+
deadline: string;
|
|
242
|
+
} | {
|
|
243
|
+
wait_id: string;
|
|
244
|
+
summary: string;
|
|
245
|
+
kind: "human";
|
|
246
|
+
} | {
|
|
247
|
+
wait_id: string;
|
|
248
|
+
summary: string;
|
|
249
|
+
kind: "plugin";
|
|
250
|
+
pluginKind: string;
|
|
251
|
+
deadline?: string | undefined;
|
|
252
|
+
} | undefined;
|
|
253
|
+
code: "authentication" | "capability_revoked" | "capacity" | "command_failed" | "denied_scope" | "duplicate_deadline" | "exit_file_outside" | "finish_requested" | "generation_mismatch" | "gh_missing" | "inaccessible_pr" | "invalid_request" | "malformed_data" | "manager_disposed" | "messaging_off" | "operation_conflict" | "outcome_unknown" | "output_limit" | "persistence" | "process_not_allowed" | "process_not_owned" | "query_timeout" | "registration_aborted" | "root_finish_pending" | "run_cancelled" | "run_missing" | "run_not_running" | "run_stopping" | "session_closed" | "session_replaced" | "timers_disabled" | "turn_changed" | "unauthorized" | "unavailable" | "unsupported_host" | "wait_conflict" | "wake_budget_spent" | "worker_execution_stopped" | "worker_wait_pending";
|
|
254
|
+
message: string;
|
|
255
|
+
open_waits?: ({
|
|
256
|
+
wait_id: string;
|
|
257
|
+
summary: string;
|
|
258
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
259
|
+
deadline: string;
|
|
260
|
+
} | {
|
|
261
|
+
wait_id: string;
|
|
262
|
+
summary: string;
|
|
263
|
+
kind: "human";
|
|
264
|
+
} | {
|
|
265
|
+
wait_id: string;
|
|
266
|
+
summary: string;
|
|
267
|
+
kind: "plugin";
|
|
268
|
+
pluginKind: string;
|
|
269
|
+
deadline?: string | undefined;
|
|
270
|
+
})[] | undefined;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
159
273
|
export declare function invokeCancelWaitTool(input: unknown): Promise<{
|
|
160
274
|
content: {
|
|
161
275
|
type: 'text';
|
|
@@ -203,6 +317,53 @@ export declare function invokeCancelWaitTool(input: unknown): Promise<{
|
|
|
203
317
|
})[] | undefined;
|
|
204
318
|
};
|
|
205
319
|
}>;
|
|
320
|
+
export declare function formatCancelWaitTool(answer: Awaited<ReturnType<typeof callSquawkCancelWait>>): {
|
|
321
|
+
content: {
|
|
322
|
+
type: 'text';
|
|
323
|
+
text: string;
|
|
324
|
+
}[];
|
|
325
|
+
isError: boolean;
|
|
326
|
+
details: {
|
|
327
|
+
cancelled: true;
|
|
328
|
+
wait_id: string;
|
|
329
|
+
open_waits: ({
|
|
330
|
+
wait_id: string;
|
|
331
|
+
summary: string;
|
|
332
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
333
|
+
deadline: string;
|
|
334
|
+
} | {
|
|
335
|
+
wait_id: string;
|
|
336
|
+
summary: string;
|
|
337
|
+
kind: "human";
|
|
338
|
+
} | {
|
|
339
|
+
wait_id: string;
|
|
340
|
+
summary: string;
|
|
341
|
+
kind: "plugin";
|
|
342
|
+
pluginKind: string;
|
|
343
|
+
deadline?: string | undefined;
|
|
344
|
+
})[];
|
|
345
|
+
} | {
|
|
346
|
+
cancelled: false;
|
|
347
|
+
code: "already_resolved" | "human_question" | "invalid_request" | "not_found" | "unavailable";
|
|
348
|
+
message: string;
|
|
349
|
+
open_waits?: ({
|
|
350
|
+
wait_id: string;
|
|
351
|
+
summary: string;
|
|
352
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
353
|
+
deadline: string;
|
|
354
|
+
} | {
|
|
355
|
+
wait_id: string;
|
|
356
|
+
summary: string;
|
|
357
|
+
kind: "human";
|
|
358
|
+
} | {
|
|
359
|
+
wait_id: string;
|
|
360
|
+
summary: string;
|
|
361
|
+
kind: "plugin";
|
|
362
|
+
pluginKind: string;
|
|
363
|
+
deadline?: string | undefined;
|
|
364
|
+
})[] | undefined;
|
|
365
|
+
};
|
|
366
|
+
};
|
|
206
367
|
export declare function invokeDoneTool(input: unknown): Promise<{
|
|
207
368
|
content: {
|
|
208
369
|
type: 'text';
|
|
@@ -291,6 +452,94 @@ export declare function invokeDoneTool(input: unknown): Promise<{
|
|
|
291
452
|
})[] | undefined;
|
|
292
453
|
};
|
|
293
454
|
}>;
|
|
455
|
+
export declare function formatDoneTool(answer: Awaited<ReturnType<typeof callSquawkDone>>): {
|
|
456
|
+
content: {
|
|
457
|
+
type: 'text';
|
|
458
|
+
text: string;
|
|
459
|
+
}[];
|
|
460
|
+
isError: boolean;
|
|
461
|
+
details: {
|
|
462
|
+
ok: true;
|
|
463
|
+
finishes: "at_turn_end";
|
|
464
|
+
open_waits: ({
|
|
465
|
+
wait_id: string;
|
|
466
|
+
summary: string;
|
|
467
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
468
|
+
deadline: string;
|
|
469
|
+
} | {
|
|
470
|
+
wait_id: string;
|
|
471
|
+
summary: string;
|
|
472
|
+
kind: "human";
|
|
473
|
+
} | {
|
|
474
|
+
wait_id: string;
|
|
475
|
+
summary: string;
|
|
476
|
+
kind: "plugin";
|
|
477
|
+
pluginKind: string;
|
|
478
|
+
deadline?: string | undefined;
|
|
479
|
+
})[];
|
|
480
|
+
completes: "task";
|
|
481
|
+
} | {
|
|
482
|
+
ok: true;
|
|
483
|
+
finishes: "at_turn_end";
|
|
484
|
+
open_waits: ({
|
|
485
|
+
wait_id: string;
|
|
486
|
+
summary: string;
|
|
487
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
488
|
+
deadline: string;
|
|
489
|
+
} | {
|
|
490
|
+
wait_id: string;
|
|
491
|
+
summary: string;
|
|
492
|
+
kind: "human";
|
|
493
|
+
} | {
|
|
494
|
+
wait_id: string;
|
|
495
|
+
summary: string;
|
|
496
|
+
kind: "plugin";
|
|
497
|
+
pluginKind: string;
|
|
498
|
+
deadline?: string | undefined;
|
|
499
|
+
})[];
|
|
500
|
+
completes: "step";
|
|
501
|
+
next_step: string;
|
|
502
|
+
} | {
|
|
503
|
+
ok: false;
|
|
504
|
+
code: "capability_revoked" | "finish_requested" | "generation_mismatch" | "human_question_pending" | "input_pending" | "invalid_request" | "manager_disposed" | "not_final_step" | "requests_outstanding" | "requests_unanswered" | "root_finish_pending" | "run_cancelled" | "run_missing" | "run_not_running" | "run_stopping" | "session_closed" | "session_replaced" | "unavailable" | "worker_questions" | "worker_wait_pending" | "workers_outstanding" | "workers_uncollected";
|
|
505
|
+
message: string;
|
|
506
|
+
workers?: {
|
|
507
|
+
worker_id: string;
|
|
508
|
+
reason: "outstanding" | "question" | "uncollected";
|
|
509
|
+
}[] | undefined;
|
|
510
|
+
open_waits?: ({
|
|
511
|
+
wait_id: string;
|
|
512
|
+
summary: string;
|
|
513
|
+
kind: "peer" | "pr" | "process" | "subagent" | "timer" | "worker";
|
|
514
|
+
deadline: string;
|
|
515
|
+
} | {
|
|
516
|
+
wait_id: string;
|
|
517
|
+
summary: string;
|
|
518
|
+
kind: "human";
|
|
519
|
+
} | {
|
|
520
|
+
wait_id: string;
|
|
521
|
+
summary: string;
|
|
522
|
+
kind: "plugin";
|
|
523
|
+
pluginKind: string;
|
|
524
|
+
deadline?: string | undefined;
|
|
525
|
+
})[] | undefined;
|
|
526
|
+
owed?: ({
|
|
527
|
+
kind: "wait_result";
|
|
528
|
+
wait_id: string;
|
|
529
|
+
wait_kind: string;
|
|
530
|
+
} | {
|
|
531
|
+
kind: "queued";
|
|
532
|
+
input_id?: string | undefined;
|
|
533
|
+
source: string;
|
|
534
|
+
} | {
|
|
535
|
+
kind: "in_flight";
|
|
536
|
+
input_id: string;
|
|
537
|
+
} | {
|
|
538
|
+
kind: "unread";
|
|
539
|
+
input_id: string;
|
|
540
|
+
})[] | undefined;
|
|
541
|
+
};
|
|
542
|
+
};
|
|
294
543
|
/** JSON first, then the hint as a plain sentence: the shape every Squawk tool answers in. */
|
|
295
544
|
export declare function invokePreviewTool(input: unknown): Promise<{
|
|
296
545
|
content: {
|
|
@@ -305,6 +554,19 @@ export declare function invokePreviewTool(input: unknown): Promise<{
|
|
|
305
554
|
hint: string;
|
|
306
555
|
};
|
|
307
556
|
}>;
|
|
557
|
+
export declare function formatPreviewTool(result: Awaited<ReturnType<typeof callPreviewServe>>): {
|
|
558
|
+
content: {
|
|
559
|
+
type: 'text';
|
|
560
|
+
text: string;
|
|
561
|
+
}[];
|
|
562
|
+
isError: boolean;
|
|
563
|
+
details: {
|
|
564
|
+
ok: boolean;
|
|
565
|
+
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
566
|
+
message: string;
|
|
567
|
+
hint: string;
|
|
568
|
+
};
|
|
569
|
+
};
|
|
308
570
|
export declare function invokePreviewStopTool(input: unknown): Promise<{
|
|
309
571
|
content: {
|
|
310
572
|
type: 'text';
|
|
@@ -318,6 +580,20 @@ export declare function invokePreviewStopTool(input: unknown): Promise<{
|
|
|
318
580
|
hint: string;
|
|
319
581
|
};
|
|
320
582
|
}>;
|
|
583
|
+
export declare function formatPreviewStopTool(result: Awaited<ReturnType<typeof callPreviewStop>>): {
|
|
584
|
+
content: {
|
|
585
|
+
type: 'text';
|
|
586
|
+
text: string;
|
|
587
|
+
}[];
|
|
588
|
+
isError: boolean;
|
|
589
|
+
details: {
|
|
590
|
+
ok: boolean;
|
|
591
|
+
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
592
|
+
message: string;
|
|
593
|
+
hint: string;
|
|
594
|
+
};
|
|
595
|
+
};
|
|
596
|
+
export declare const PREVIEW_STOP_TOOL: SquawkTool;
|
|
321
597
|
export declare function invokeScheduleTaskTool(input: unknown): Promise<{
|
|
322
598
|
content: {
|
|
323
599
|
type: 'text';
|
|
@@ -325,6 +601,10 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
|
|
|
325
601
|
}[];
|
|
326
602
|
isError: boolean;
|
|
327
603
|
details: {
|
|
604
|
+
ok: false;
|
|
605
|
+
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
606
|
+
message: string;
|
|
607
|
+
} | {
|
|
328
608
|
ok: true;
|
|
329
609
|
task: {
|
|
330
610
|
id: string;
|
|
@@ -336,12 +616,32 @@ export declare function invokeScheduleTaskTool(input: unknown): Promise<{
|
|
|
336
616
|
url?: string | undefined;
|
|
337
617
|
};
|
|
338
618
|
note: string;
|
|
339
|
-
}
|
|
619
|
+
};
|
|
620
|
+
}>;
|
|
621
|
+
export declare function formatScheduleTaskTool(answer: Awaited<ReturnType<typeof callScheduleTask>>): {
|
|
622
|
+
content: {
|
|
623
|
+
type: 'text';
|
|
624
|
+
text: string;
|
|
625
|
+
}[];
|
|
626
|
+
isError: boolean;
|
|
627
|
+
details: {
|
|
340
628
|
ok: false;
|
|
341
629
|
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
342
630
|
message: string;
|
|
631
|
+
} | {
|
|
632
|
+
ok: true;
|
|
633
|
+
task: {
|
|
634
|
+
id: string;
|
|
635
|
+
name: string;
|
|
636
|
+
status: "archived" | "failed" | "missed" | "paused" | "waiting";
|
|
637
|
+
due_at: string;
|
|
638
|
+
latest_start_minutes?: number | undefined;
|
|
639
|
+
run_id?: string | undefined;
|
|
640
|
+
url?: string | undefined;
|
|
641
|
+
};
|
|
642
|
+
note: string;
|
|
343
643
|
};
|
|
344
|
-
}
|
|
644
|
+
};
|
|
345
645
|
export declare function invokeScheduledTasksTool(input: unknown): Promise<{
|
|
346
646
|
content: {
|
|
347
647
|
type: 'text';
|
|
@@ -376,6 +676,40 @@ export declare function invokeScheduledTasksTool(input: unknown): Promise<{
|
|
|
376
676
|
};
|
|
377
677
|
};
|
|
378
678
|
}>;
|
|
679
|
+
export declare function formatScheduledTasksTool(answer: Awaited<ReturnType<typeof callScheduledTasks>>): {
|
|
680
|
+
content: {
|
|
681
|
+
type: 'text';
|
|
682
|
+
text: string;
|
|
683
|
+
}[];
|
|
684
|
+
isError: boolean;
|
|
685
|
+
details: {
|
|
686
|
+
ok: false;
|
|
687
|
+
code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
|
|
688
|
+
message: string;
|
|
689
|
+
} | {
|
|
690
|
+
ok: true;
|
|
691
|
+
tasks: {
|
|
692
|
+
id: string;
|
|
693
|
+
name: string;
|
|
694
|
+
status: "archived" | "failed" | "missed" | "paused" | "waiting";
|
|
695
|
+
due_at: string;
|
|
696
|
+
latest_start_minutes?: number | undefined;
|
|
697
|
+
run_id?: string | undefined;
|
|
698
|
+
url?: string | undefined;
|
|
699
|
+
}[];
|
|
700
|
+
} | {
|
|
701
|
+
ok: true;
|
|
702
|
+
task: {
|
|
703
|
+
id: string;
|
|
704
|
+
name: string;
|
|
705
|
+
status: "archived" | "failed" | "missed" | "paused" | "waiting";
|
|
706
|
+
due_at: string;
|
|
707
|
+
latest_start_minutes?: number | undefined;
|
|
708
|
+
run_id?: string | undefined;
|
|
709
|
+
url?: string | undefined;
|
|
710
|
+
};
|
|
711
|
+
};
|
|
712
|
+
};
|
|
379
713
|
export declare function invokeAutomationTool(input: unknown): Promise<{
|
|
380
714
|
content: {
|
|
381
715
|
type: 'text';
|
|
@@ -478,5 +812,115 @@ export declare function invokeAutomationTool(input: unknown): Promise<{
|
|
|
478
812
|
message: string;
|
|
479
813
|
};
|
|
480
814
|
}>;
|
|
815
|
+
export declare function formatAutomationTool(answer: Awaited<ReturnType<typeof callAutomation>>): {
|
|
816
|
+
content: {
|
|
817
|
+
type: 'text';
|
|
818
|
+
text: string;
|
|
819
|
+
}[];
|
|
820
|
+
isError: boolean;
|
|
821
|
+
details: {
|
|
822
|
+
ok: true;
|
|
823
|
+
automation: {
|
|
824
|
+
[x: string]: unknown;
|
|
825
|
+
id: string;
|
|
826
|
+
revision: number;
|
|
827
|
+
name: string;
|
|
828
|
+
description?: string | undefined;
|
|
829
|
+
enabled: boolean;
|
|
830
|
+
kind: "github" | "schedule";
|
|
831
|
+
events?: ("issue.labeled" | "issue.opened" | "issue.unlabeled" | "pull_request.opened")[] | undefined;
|
|
832
|
+
intervalSeconds?: number | undefined;
|
|
833
|
+
filters?: {
|
|
834
|
+
[x: string]: unknown;
|
|
835
|
+
includeExisting?: boolean | undefined;
|
|
836
|
+
requireCurrentLabels?: boolean | undefined;
|
|
837
|
+
authors?: string[] | undefined;
|
|
838
|
+
assignees?: string[] | undefined;
|
|
839
|
+
allLabels?: string[] | undefined;
|
|
840
|
+
anyLabels?: string[] | undefined;
|
|
841
|
+
excludeLabels?: string[] | undefined;
|
|
842
|
+
changedLabels?: string[] | undefined;
|
|
843
|
+
lookbackDays: number;
|
|
844
|
+
maxRecords: number;
|
|
845
|
+
} | undefined;
|
|
846
|
+
schedule?: {
|
|
847
|
+
[x: string]: unknown;
|
|
848
|
+
type: "daily" | "hours" | "once" | "weekdays" | "weekly";
|
|
849
|
+
hour?: number | undefined;
|
|
850
|
+
minute?: number | undefined;
|
|
851
|
+
day?: number | undefined;
|
|
852
|
+
every?: 1 | 2 | 3 | 4 | 6 | 8 | 12 | undefined;
|
|
853
|
+
at?: string | undefined;
|
|
854
|
+
timeZone?: string | undefined;
|
|
855
|
+
latestStartMinutes?: number | undefined;
|
|
856
|
+
} | undefined;
|
|
857
|
+
task: {
|
|
858
|
+
[x: string]: unknown;
|
|
859
|
+
archiveWhenDone?: boolean | undefined;
|
|
860
|
+
autoMergePr?: boolean | undefined;
|
|
861
|
+
allowWorkers?: boolean | undefined;
|
|
862
|
+
allowMessaging?: boolean | undefined;
|
|
863
|
+
prompt: string;
|
|
864
|
+
workflow?: string | undefined;
|
|
865
|
+
steps?: {
|
|
866
|
+
id: string;
|
|
867
|
+
name?: string | undefined;
|
|
868
|
+
prompt?: string | undefined;
|
|
869
|
+
skill?: string | undefined;
|
|
870
|
+
model?: string | undefined;
|
|
871
|
+
effort?: string | undefined;
|
|
872
|
+
timeoutMs?: number | undefined;
|
|
873
|
+
runner?: string | undefined;
|
|
874
|
+
agentProfile?: string | undefined;
|
|
875
|
+
allowedTools?: string[] | undefined;
|
|
876
|
+
bashAllowlist?: string[] | undefined;
|
|
877
|
+
kind?: "plugin" | undefined;
|
|
878
|
+
pluginKind?: string | undefined;
|
|
879
|
+
config?: Record<string, unknown> | undefined;
|
|
880
|
+
command?: string | undefined;
|
|
881
|
+
onFail?: {
|
|
882
|
+
retry: string;
|
|
883
|
+
max: number;
|
|
884
|
+
} | undefined;
|
|
885
|
+
}[] | undefined;
|
|
886
|
+
runner?: string | undefined;
|
|
887
|
+
model?: string | undefined;
|
|
888
|
+
effort?: string | undefined;
|
|
889
|
+
variants?: 1 | 2 | 3 | undefined;
|
|
890
|
+
worktree?: boolean | undefined;
|
|
891
|
+
autonomous?: boolean | undefined;
|
|
892
|
+
systemPrompt?: string | undefined;
|
|
893
|
+
};
|
|
894
|
+
archived?: {
|
|
895
|
+
[x: string]: unknown;
|
|
896
|
+
at: string;
|
|
897
|
+
outcome: "cancelled" | "launched";
|
|
898
|
+
runId?: string | undefined;
|
|
899
|
+
receiptId?: string | undefined;
|
|
900
|
+
trigger?: "late" | "manual" | "retry" | "schedule" | undefined;
|
|
901
|
+
} | undefined;
|
|
902
|
+
createdAt: string;
|
|
903
|
+
updatedAt: string;
|
|
904
|
+
};
|
|
905
|
+
url?: string | undefined;
|
|
906
|
+
next_run_at?: string | undefined;
|
|
907
|
+
preview?: {
|
|
908
|
+
matches: number;
|
|
909
|
+
truncated: boolean;
|
|
910
|
+
} | undefined;
|
|
911
|
+
} | {
|
|
912
|
+
ok: false;
|
|
913
|
+
code: "automations_off" | "conflict" | "explicit_required" | "invalid_request" | "not_found" | "preview_required" | "unavailable";
|
|
914
|
+
message: string;
|
|
915
|
+
};
|
|
916
|
+
};
|
|
917
|
+
export declare const AUTOMATION_TOOL: SquawkTool;
|
|
918
|
+
export declare const SCHEDULE_TASK_TOOL: SquawkTool;
|
|
919
|
+
export declare const SCHEDULED_TASKS_TOOL: SquawkTool;
|
|
920
|
+
export declare const WAIT_TOOL: SquawkTool;
|
|
921
|
+
export declare const ASK_TOOL: SquawkTool;
|
|
922
|
+
export declare const CANCEL_WAIT_TOOL: SquawkTool;
|
|
923
|
+
export declare const DONE_TOOL: SquawkTool;
|
|
924
|
+
export declare const PREVIEW_TOOL: SquawkTool;
|
|
481
925
|
export declare function squawkTools(env?: NodeJS.ProcessEnv): SquawkTool[];
|
|
482
926
|
export declare function squawkServerInstructions(env?: NodeJS.ProcessEnv): string;
|
package/dist/ci-wait/tools.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { agentToolInstructions, agentToolMetadata, enabledAgentTools } from './tool-registry.js';
|
|
2
|
+
import { waitToolDefinition, askToolDefinition, cancelWaitToolDefinition, doneToolDefinition, previewToolDefinition, previewStopToolDefinition, scheduleTaskToolDefinition, automationToolDefinition, scheduledTasksToolDefinition } from './tool-catalog.js';
|
|
2
3
|
export { waitToolDefinition, askToolDefinition, cancelWaitToolDefinition, doneToolDefinition, previewToolDefinition, previewStopToolDefinition, scheduleTaskToolDefinition, automationToolDefinition, scheduledTasksToolDefinition } from './tool-catalog.js';
|
|
3
4
|
export { previewToolEnabled, automationsToolEnabled } from './tool-env.js';
|
|
4
5
|
export { squawkToolNames, squawkToolEnvNames } from './tool-names.js';
|
|
@@ -15,7 +16,9 @@ export function askAnswerHint(answer) {
|
|
|
15
16
|
return 'Not asked. Fix the call from the message, or continue without asking.';
|
|
16
17
|
}
|
|
17
18
|
export async function invokeAskTool(input) {
|
|
18
|
-
|
|
19
|
+
return formatAskTool(await callSquawkAsk(input));
|
|
20
|
+
}
|
|
21
|
+
export function formatAskTool(answer) {
|
|
19
22
|
return { content: [{ type: 'text', text: `${JSON.stringify(answer)}\n${askAnswerHint(answer)}` }], isError: !answer.ok, details: answer };
|
|
20
23
|
}
|
|
21
24
|
/** JSON first, then one hint sentence, as `invokePreviewTool` answers. */
|
|
@@ -32,17 +35,23 @@ export function waitAnswerHint(answer) {
|
|
|
32
35
|
: 'Registered. End your turn to wait; any open wait wakes you when it resolves.';
|
|
33
36
|
}
|
|
34
37
|
export async function invokeWaitTool(input) {
|
|
35
|
-
|
|
38
|
+
return formatWaitTool(await callSquawkWait(input));
|
|
39
|
+
}
|
|
40
|
+
export function formatWaitTool(answer) {
|
|
36
41
|
const hint = waitAnswerHint(answer);
|
|
37
42
|
return { content: [{ type: 'text', text: `${JSON.stringify(answer)}\n${hint}` }], isError: !answer.ok, details: answer };
|
|
38
43
|
}
|
|
39
44
|
export async function invokeCancelWaitTool(input) {
|
|
40
|
-
|
|
45
|
+
return formatCancelWaitTool(await callSquawkCancelWait(input));
|
|
46
|
+
}
|
|
47
|
+
export function formatCancelWaitTool(answer) {
|
|
41
48
|
const hint = answer.cancelled ? 'Cancelled. The waits in open_waits stay open.' : 'Not cancelled. Check the message and the waits in open_waits.';
|
|
42
49
|
return { content: [{ type: 'text', text: `${JSON.stringify(answer)}\n${hint}` }], isError: !answer.cancelled, details: answer };
|
|
43
50
|
}
|
|
44
51
|
export async function invokeDoneTool(input) {
|
|
45
|
-
|
|
52
|
+
return formatDoneTool(await callSquawkDone(input));
|
|
53
|
+
}
|
|
54
|
+
export function formatDoneTool(answer) {
|
|
46
55
|
const hint = !answer.ok ? 'Not finished. Do what the message says, then call cezar_done again.'
|
|
47
56
|
: answer.completes === 'step' ? `Accepted. End your turn; Squawk completes this step at its end and starts "${answer.next_step}".`
|
|
48
57
|
: `Accepted. End your turn; Squawk finishes the task at its end.`;
|
|
@@ -50,51 +59,54 @@ export async function invokeDoneTool(input) {
|
|
|
50
59
|
}
|
|
51
60
|
/** JSON first, then the hint as a plain sentence: the shape every Squawk tool answers in. */
|
|
52
61
|
export async function invokePreviewTool(input) {
|
|
53
|
-
|
|
62
|
+
return formatPreviewTool(await callPreviewServe(input));
|
|
63
|
+
}
|
|
64
|
+
export function formatPreviewTool(result) {
|
|
54
65
|
return { content: [{ type: 'text', text: `${JSON.stringify(result)}\n${result.hint}` }], isError: !result.ok, details: result };
|
|
55
66
|
}
|
|
56
67
|
export async function invokePreviewStopTool(input) {
|
|
57
|
-
|
|
68
|
+
return formatPreviewStopTool(await callPreviewStop(input));
|
|
69
|
+
}
|
|
70
|
+
export function formatPreviewStopTool(result) {
|
|
58
71
|
return { content: [{ type: 'text', text: `${JSON.stringify(result)}\n${result.hint}` }], isError: !result.ok, details: result };
|
|
59
72
|
}
|
|
60
|
-
const PREVIEW_STOP_TOOL = { definition: previewStopToolDefinition, trigger: `load when your Squawk-started preview server needs stopping or restarting.`, label: 'Stop live preview', invoke: invokePreviewStopTool };
|
|
73
|
+
export const PREVIEW_STOP_TOOL = { definition: previewStopToolDefinition, trigger: `load when your Squawk-started preview server needs stopping or restarting.`, label: 'Stop live preview', invoke: invokePreviewStopTool };
|
|
61
74
|
function scheduleHint(answer) {
|
|
62
75
|
if (answer.ok)
|
|
63
76
|
return 'Done. due_at is UTC: tell the user that time in their time zone, and name the zone.';
|
|
64
77
|
return answer.code === 'automations_off' || answer.code === 'unavailable' ? 'Not scheduled. Tell the user, and do not retry.' : 'Not changed. Fix the call from the message, or continue without it.';
|
|
65
78
|
}
|
|
66
79
|
export async function invokeScheduleTaskTool(input) {
|
|
67
|
-
|
|
80
|
+
return formatScheduleTaskTool(await callScheduleTask(input));
|
|
81
|
+
}
|
|
82
|
+
export function formatScheduleTaskTool(answer) {
|
|
68
83
|
return { content: [{ type: 'text', text: `${JSON.stringify(answer)}\n${scheduleHint(answer)}` }], isError: !answer.ok, details: answer };
|
|
69
84
|
}
|
|
70
85
|
export async function invokeScheduledTasksTool(input) {
|
|
71
|
-
|
|
86
|
+
return formatScheduledTasksTool(await callScheduledTasks(input));
|
|
87
|
+
}
|
|
88
|
+
export function formatScheduledTasksTool(answer) {
|
|
72
89
|
return { content: [{ type: 'text', text: `${JSON.stringify(answer)}\n${scheduleHint(answer)}` }], isError: !answer.ok, details: answer };
|
|
73
90
|
}
|
|
74
91
|
export async function invokeAutomationTool(input) {
|
|
75
|
-
|
|
92
|
+
return formatAutomationTool(await callAutomation(input));
|
|
93
|
+
}
|
|
94
|
+
export function formatAutomationTool(answer) {
|
|
76
95
|
const hint = answer.ok ? 'Report the url and preview matches, or the next occurrence in the user’s time zone.' : 'Stop and report the error. Do not substitute another automation mechanism.';
|
|
77
96
|
return { content: [{ type: 'text', text: `${JSON.stringify(answer)}\n${hint}` }], isError: !answer.ok, details: answer };
|
|
78
97
|
}
|
|
79
|
-
const AUTOMATION_TOOL = { definition: automationToolDefinition, trigger: 'load when the user asks for recurring work, or wants to inspect or activate an automation.', label: 'Automations', invoke: invokeAutomationTool };
|
|
80
|
-
const SCHEDULE_TASK_TOOL = { definition: scheduleTaskToolDefinition, trigger: 'load when work should start later as a new task (in an hour, tomorrow, next week) instead of keeping this session waiting.', label: 'Schedule a task', invoke: invokeScheduleTaskTool };
|
|
81
|
-
const SCHEDULED_TASKS_TOOL = { definition: scheduledTasksToolDefinition, trigger: 'load when you need to list, change, pause, resume or cancel a one-time scheduled task.', label: 'Scheduled tasks', invoke: invokeScheduledTasksTool };
|
|
82
|
-
const WAIT_TOOL = { definition: waitToolDefinition, trigger: 'load when you are waiting on CI for a PR or on a background job you started, or want to re-check something later; end your turn after it answers.', label: 'Wait', invoke: invokeWaitTool };
|
|
83
|
-
const ASK_TOOL = { definition: askToolDefinition, trigger: 'load for a user decision or missing input; provide the full draft or findings in its rendered context field.', label: 'Ask the user', invoke: invokeAskTool };
|
|
84
|
-
const CANCEL_WAIT_TOOL = { definition: cancelWaitToolDefinition, trigger: 'load when a wait you registered is no longer needed.', label: 'Cancel wait', invoke: invokeCancelWaitTool };
|
|
85
|
-
const DONE_TOOL = { definition: doneToolDefinition, trigger: 'load when the task is complete and verified.', label: 'Done', invoke: invokeDoneTool };
|
|
86
|
-
const PREVIEW_TOOL = { definition: previewToolDefinition, trigger: 'load when you have started, or are about to start, a web server the user should click through.', label: 'Live preview', invoke: invokePreviewTool };
|
|
87
|
-
const TOOLS_BY_NAME = new Map([
|
|
88
|
-
WAIT_TOOL, ASK_TOOL, CANCEL_WAIT_TOOL, DONE_TOOL,
|
|
89
|
-
PREVIEW_TOOL, PREVIEW_STOP_TOOL, SCHEDULE_TASK_TOOL, AUTOMATION_TOOL, SCHEDULED_TASKS_TOOL,
|
|
90
|
-
].map(tool => [tool.definition.name, tool]));
|
|
98
|
+
export const AUTOMATION_TOOL = { definition: automationToolDefinition, trigger: 'load when the user asks for recurring work, or wants to inspect or activate an automation.', label: 'Automations', invoke: invokeAutomationTool };
|
|
99
|
+
export const SCHEDULE_TASK_TOOL = { definition: scheduleTaskToolDefinition, trigger: 'load when work should start later as a new task (in an hour, tomorrow, next week) instead of keeping this session waiting.', label: 'Schedule a task', invoke: invokeScheduleTaskTool };
|
|
100
|
+
export const SCHEDULED_TASKS_TOOL = { definition: scheduledTasksToolDefinition, trigger: 'load when you need to list, change, pause, resume or cancel a one-time scheduled task.', label: 'Scheduled tasks', invoke: invokeScheduledTasksTool };
|
|
101
|
+
export const WAIT_TOOL = { definition: waitToolDefinition, trigger: 'load when you are waiting on CI for a PR or on a background job you started, or want to re-check something later; end your turn after it answers.', label: 'Wait', invoke: invokeWaitTool };
|
|
102
|
+
export const ASK_TOOL = { definition: askToolDefinition, trigger: 'load for a user decision or missing input; provide the full draft or findings in its rendered context field.', label: 'Ask the user', invoke: invokeAskTool };
|
|
103
|
+
export const CANCEL_WAIT_TOOL = { definition: cancelWaitToolDefinition, trigger: 'load when a wait you registered is no longer needed.', label: 'Cancel wait', invoke: invokeCancelWaitTool };
|
|
104
|
+
export const DONE_TOOL = { definition: doneToolDefinition, trigger: 'load when the task is complete and verified.', label: 'Done', invoke: invokeDoneTool };
|
|
105
|
+
export const PREVIEW_TOOL = { definition: previewToolDefinition, trigger: 'load when you have started, or are about to start, a web server the user should click through.', label: 'Live preview', invoke: invokePreviewTool };
|
|
91
106
|
export function squawkTools(env = process.env) {
|
|
92
|
-
return
|
|
107
|
+
return enabledAgentTools(env).map(tool => ({ definition: agentToolMetadata(tool), trigger: tool.trigger, label: tool.label, invoke: tool.invoke }));
|
|
93
108
|
}
|
|
94
109
|
export function squawkServerInstructions(env = process.env) {
|
|
95
|
-
return
|
|
96
|
-
`The interface to Squawk, the orchestrator running this session. Load a tool below when its situation comes up.`,
|
|
97
|
-
...squawkTools(env).map(tool => `- ${tool.definition.name}: ${tool.trigger}`),
|
|
98
|
-
].join('\n');
|
|
110
|
+
return agentToolInstructions(enabledAgentTools(env));
|
|
99
111
|
}
|
|
100
112
|
//# sourceMappingURL=tools.js.map
|