@hearsay-tools/squawk 0.18.0-dev.8054 → 0.18.0-dev.8057
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/automations/agent-tools.d.ts +2 -0
- package/dist/automations/agent-tools.js +24 -0
- package/dist/automations/agent-tools.js.map +1 -0
- package/dist/automations/tool-catalog.d.ts +119 -0
- package/dist/automations/tool-catalog.js +48 -0
- package/dist/automations/tool-catalog.js.map +1 -0
- package/dist/automations/tool-client.d.ts +9 -0
- package/dist/automations/tool-client.js +19 -0
- package/dist/automations/tool-client.js.map +1 -0
- package/dist/automations/tool-env.d.ts +1 -0
- package/dist/automations/tool-env.js +3 -0
- package/dist/automations/tool-env.js.map +1 -0
- package/dist/automations/tool-errors.d.ts +9 -0
- package/dist/automations/tool-errors.js +34 -0
- package/dist/automations/tool-errors.js.map +1 -0
- package/dist/automations/tool-session.d.ts +5 -0
- package/dist/automations/tool-session.js +19 -0
- package/dist/automations/tool-session.js.map +1 -0
- package/dist/automations/tools.d.ts +325 -0
- package/dist/automations/tools.js +30 -0
- package/dist/automations/tools.js.map +1 -0
- package/dist/built-in-tool-definitions.d.ts +0 -2
- package/dist/built-in-tool-definitions.js +3 -35
- package/dist/built-in-tool-definitions.js.map +1 -1
- package/dist/built-in-tools.js +4 -2
- package/dist/built-in-tools.js.map +1 -1
- package/dist/ci-wait/client.d.ts +0 -17
- package/dist/ci-wait/client.js +0 -31
- package/dist/ci-wait/client.js.map +1 -1
- package/dist/ci-wait/controller.js +1 -2
- package/dist/ci-wait/controller.js.map +1 -1
- package/dist/ci-wait/errors.d.ts +1 -14
- package/dist/ci-wait/errors.js +0 -68
- package/dist/ci-wait/errors.js.map +1 -1
- package/dist/ci-wait/tool-catalog.d.ts +0 -263
- package/dist/ci-wait/tool-catalog.js +0 -58
- package/dist/ci-wait/tool-catalog.js.map +1 -1
- package/dist/ci-wait/tool-definition.d.ts +21 -0
- package/dist/ci-wait/tool-definition.js +9 -0
- package/dist/ci-wait/tool-definition.js.map +1 -0
- package/dist/ci-wait/tool-registry.d.ts +2 -0
- package/dist/ci-wait/tool-registry.js.map +1 -1
- package/dist/ci-wait/tools.d.ts +2 -381
- package/dist/ci-wait/tools.js +3 -46
- package/dist/ci-wait/tools.js.map +1 -1
- package/dist/delegation/routes.d.ts +79 -79
- package/dist/preview/agent-address.js +1 -1
- package/dist/preview/agent-address.js.map +1 -1
- package/dist/preview/agent-tools.d.ts +2 -0
- package/dist/preview/agent-tools.js +18 -0
- package/dist/preview/agent-tools.js.map +1 -0
- package/dist/preview/registration.js +1 -1
- package/dist/preview/registration.js.map +1 -1
- package/dist/preview/run-tools.d.ts +1 -0
- package/dist/preview/run-tools.js +2 -1
- package/dist/preview/run-tools.js.map +1 -1
- package/dist/preview/tool-catalog.d.ts +146 -0
- package/dist/preview/tool-catalog.js +14 -0
- package/dist/preview/tool-catalog.js.map +1 -0
- package/dist/preview/tool-client.d.ts +8 -0
- package/dist/preview/tool-client.js +16 -0
- package/dist/preview/tool-client.js.map +1 -0
- package/dist/preview/tool-env.d.ts +2 -0
- package/dist/preview/tool-env.js +4 -0
- package/dist/preview/tool-env.js.map +1 -0
- package/dist/preview/tool-errors.d.ts +7 -0
- package/dist/preview/tool-errors.js +36 -0
- package/dist/preview/tool-errors.js.map +1 -0
- package/dist/preview/tool-session.d.ts +6 -0
- package/dist/preview/tool-session.js +9 -0
- package/dist/preview/tool-session.js.map +1 -0
- package/dist/preview/tools.d.ts +57 -0
- package/dist/preview/tools.js +18 -0
- package/dist/preview/tools.js.map +1 -0
- package/dist/runs/run-archive.d.ts +72 -72
- package/dist/serve-command.d.ts +1 -1
- package/dist/serve-command.js +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/preview-cdp-socket.js +1 -1
- package/dist/server/preview-socket.js +1 -1
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/server.d.ts +1323 -1323
- package/dist/workflows/run/compose.js +2 -2
- package/dist/workflows/run/compose.js.map +1 -1
- package/dist/workflows/run/squawk-tools.d.ts +6 -9
- package/dist/workflows/run/squawk-tools.js +8 -18
- package/dist/workflows/run/squawk-tools.js.map +1 -1
- package/dist/workflows/run/wait-engine.d.ts +72 -72
- package/package.json +4 -4
- package/dist/ci-wait/tool-env.d.ts +0 -4
- package/dist/ci-wait/tool-env.js +0 -11
- package/dist/ci-wait/tool-env.js.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { automationSessionHandlers } from './tool-session.js';
|
|
2
|
+
import { productEnvEntries } from '../core/product-env.js';
|
|
3
|
+
import { automationToolRequestSchema, automationToolAnswerSchema } from '../contract/index.js';
|
|
4
|
+
import { scheduleInvalidInput, scheduleRefusal } from './tool-errors.js';
|
|
5
|
+
import { automationsToolEnabled } from './tool-env.js';
|
|
6
|
+
import { SCHEDULED_TASK_LIMITS, scheduleTaskAnswerSchema, scheduleTaskRequestSchema, scheduledTasksAnswerSchema, scheduledTasksRequestSchema } from '../contract/index.js';
|
|
7
|
+
import { SCHEDULE_TASK_TOOL, AUTOMATION_TOOL, SCHEDULED_TASKS_TOOL, formatScheduleTaskTool, formatAutomationTool, formatScheduledTasksTool } from './tools.js';
|
|
8
|
+
import { AUTOMATION_TOOL_CLIENT_TIMEOUT_MS } from '../core/github-request-limits.js';
|
|
9
|
+
import { bind, metadata } from '../ci-wait/tool-definition.js';
|
|
10
|
+
const schedulePolicy = {
|
|
11
|
+
sessionEnv: (env) => productEnvEntries('AUTOMATIONS', automationsToolEnabled(env) ? '1' : '0'),
|
|
12
|
+
enabled: automationsToolEnabled, maxBodyBytes: SCHEDULED_TASK_LIMITS.wireBytes,
|
|
13
|
+
invalid: (error) => scheduleRefusal('invalid_request', scheduleInvalidInput(error)),
|
|
14
|
+
oversized: () => scheduleRefusal('invalid_request', 'The arguments exceed 1 MiB.'),
|
|
15
|
+
disabled: () => scheduleRefusal('automations_off'), unavailable: () => scheduleRefusal('unavailable'),
|
|
16
|
+
envNames: () => ['CEZ_AUTOMATIONS'],
|
|
17
|
+
};
|
|
18
|
+
export const automationAgentTools = [
|
|
19
|
+
{ ...metadata(SCHEDULE_TASK_TOOL, scheduleTaskAnswerSchema, formatScheduleTaskTool), ...schedulePolicy, sessionHandlers: (_runId, host) => automationSessionHandlers(host), ...bind(scheduleTaskRequestSchema, async (h, input, signal) => h.scheduleTask ? scheduleTaskAnswerSchema.parse(await h.scheduleTask(input, signal)) : scheduleRefusal('unavailable')) },
|
|
20
|
+
{ ...metadata(AUTOMATION_TOOL, automationToolAnswerSchema, formatAutomationTool), ...schedulePolicy, timeoutMs: AUTOMATION_TOOL_CLIENT_TIMEOUT_MS, runnerFields: { ids: ['definition.task.runner', 'definition.task.steps.*.runner'] },
|
|
21
|
+
...bind(automationToolRequestSchema, async (h, input, signal) => h.automation ? automationToolAnswerSchema.parse(await h.automation(input, signal)) : scheduleRefusal('unavailable')) },
|
|
22
|
+
{ ...metadata(SCHEDULED_TASKS_TOOL, scheduledTasksAnswerSchema, formatScheduledTasksTool), ...schedulePolicy, ...bind(scheduledTasksRequestSchema, async (h, input, signal) => h.scheduledTasks ? scheduledTasksAnswerSchema.parse(await h.scheduledTasks(input, signal)) : scheduleRefusal('unavailable')) },
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=agent-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-tools.js","sourceRoot":"","sources":["../../src/automations/agent-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AACvH,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eA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|
4
|
+
* does not keep a session parked on timers for days. `cezar_scheduled_tasks` takes one action per
|
|
5
|
+
* call; its union is advertised as one flat object for the same reason as `cezar_wait`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const scheduleTaskToolDefinition: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
inputSchema: {
|
|
11
|
+
$schema?: "https://json-schema.org/draft/2020-12/schema" | "http://json-schema.org/draft-07/schema#" | "http://json-schema.org/draft-04/schema#";
|
|
12
|
+
$id?: string;
|
|
13
|
+
$anchor?: string;
|
|
14
|
+
$ref?: string;
|
|
15
|
+
$dynamicRef?: string;
|
|
16
|
+
$dynamicAnchor?: string;
|
|
17
|
+
$vocabulary?: Record<string, boolean>;
|
|
18
|
+
$comment?: string;
|
|
19
|
+
$defs?: Record<string, z.core.JSONSchema.JSONSchema>;
|
|
20
|
+
additionalItems?: z.core.JSONSchema._JSONSchema;
|
|
21
|
+
unevaluatedItems?: z.core.JSONSchema._JSONSchema;
|
|
22
|
+
prefixItems?: z.core.JSONSchema._JSONSchema[];
|
|
23
|
+
items?: z.core.JSONSchema._JSONSchema | z.core.JSONSchema._JSONSchema[];
|
|
24
|
+
contains?: z.core.JSONSchema._JSONSchema;
|
|
25
|
+
additionalProperties?: z.core.JSONSchema._JSONSchema;
|
|
26
|
+
unevaluatedProperties?: z.core.JSONSchema._JSONSchema;
|
|
27
|
+
properties?: Record<string, z.core.JSONSchema._JSONSchema>;
|
|
28
|
+
patternProperties?: Record<string, z.core.JSONSchema._JSONSchema>;
|
|
29
|
+
dependentSchemas?: Record<string, z.core.JSONSchema._JSONSchema>;
|
|
30
|
+
propertyNames?: z.core.JSONSchema._JSONSchema;
|
|
31
|
+
if?: z.core.JSONSchema._JSONSchema;
|
|
32
|
+
then?: z.core.JSONSchema._JSONSchema;
|
|
33
|
+
else?: z.core.JSONSchema._JSONSchema;
|
|
34
|
+
allOf?: z.core.JSONSchema.JSONSchema[];
|
|
35
|
+
anyOf?: z.core.JSONSchema.JSONSchema[];
|
|
36
|
+
oneOf?: z.core.JSONSchema.JSONSchema[];
|
|
37
|
+
not?: z.core.JSONSchema._JSONSchema;
|
|
38
|
+
multipleOf?: number;
|
|
39
|
+
maximum?: number;
|
|
40
|
+
exclusiveMaximum?: number | boolean;
|
|
41
|
+
minimum?: number;
|
|
42
|
+
exclusiveMinimum?: number | boolean;
|
|
43
|
+
maxLength?: number;
|
|
44
|
+
minLength?: number;
|
|
45
|
+
pattern?: string;
|
|
46
|
+
maxItems?: number;
|
|
47
|
+
minItems?: number;
|
|
48
|
+
uniqueItems?: boolean;
|
|
49
|
+
maxContains?: number;
|
|
50
|
+
minContains?: number;
|
|
51
|
+
maxProperties?: number;
|
|
52
|
+
minProperties?: number;
|
|
53
|
+
required?: string[];
|
|
54
|
+
dependentRequired?: Record<string, string[]>;
|
|
55
|
+
enum?: Array<string | number | boolean | null>;
|
|
56
|
+
const?: string | number | boolean | null;
|
|
57
|
+
id?: string;
|
|
58
|
+
title?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
default?: unknown;
|
|
61
|
+
deprecated?: boolean;
|
|
62
|
+
readOnly?: boolean;
|
|
63
|
+
writeOnly?: boolean;
|
|
64
|
+
nullable?: boolean;
|
|
65
|
+
examples?: unknown[];
|
|
66
|
+
format?: string;
|
|
67
|
+
contentMediaType?: string;
|
|
68
|
+
contentEncoding?: string;
|
|
69
|
+
contentSchema?: z.core.JSONSchema.JSONSchema;
|
|
70
|
+
_prefault?: unknown;
|
|
71
|
+
"~standard": z.core.ZodStandardSchemaWithJSON<z.ZodObject<{
|
|
72
|
+
at: z.ZodOptional<z.ZodString>;
|
|
73
|
+
delay: z.ZodOptional<z.ZodString>;
|
|
74
|
+
latest_start: z.ZodOptional<z.ZodString>;
|
|
75
|
+
workflow: z.ZodOptional<z.ZodString>;
|
|
76
|
+
runner: z.ZodOptional<z.ZodString>;
|
|
77
|
+
model: z.ZodOptional<z.ZodString>;
|
|
78
|
+
effort: z.ZodOptional<z.ZodString>;
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
prompt: z.ZodString;
|
|
81
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
}, z.core.$strict>>;
|
|
83
|
+
type: 'object';
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export declare const scheduledTasksToolDefinition: {
|
|
87
|
+
name: string;
|
|
88
|
+
description: string;
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: 'object';
|
|
91
|
+
properties: {
|
|
92
|
+
action: {
|
|
93
|
+
type: string;
|
|
94
|
+
enum: ("cancel" | "enable" | "list" | "pause" | "show" | "update")[];
|
|
95
|
+
description: string;
|
|
96
|
+
};
|
|
97
|
+
archived: {
|
|
98
|
+
description: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
required: string[];
|
|
102
|
+
additionalProperties: boolean;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export declare const automationToolDefinition: {
|
|
106
|
+
name: string;
|
|
107
|
+
description: string;
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: 'object';
|
|
110
|
+
properties: {
|
|
111
|
+
action: {
|
|
112
|
+
type: string;
|
|
113
|
+
enum: ("create" | "enable" | "preview" | "show")[];
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
required: string[];
|
|
117
|
+
additionalProperties: boolean;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { automationToolRequestSchema } from '../contract/index.js';
|
|
3
|
+
import { scheduleTaskRequestSchema, scheduledTasksRequestSchema } from '../contract/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* hearsay-tools/cezarion#1465: a one-time schedule starts later as an ordinary task, so the agent
|
|
6
|
+
* does not keep a session parked on timers for days. `cezar_scheduled_tasks` takes one action per
|
|
7
|
+
* call; its union is advertised as one flat object for the same reason as `cezar_wait`.
|
|
8
|
+
*/
|
|
9
|
+
export const scheduleTaskToolDefinition = {
|
|
10
|
+
name: 'cezar_schedule_task',
|
|
11
|
+
description: `Schedule a new task to start once, later, in this project: give a name, the full prompt the task starts from, and either \`at\` (a UTC time YYYY-MM-DDTHH:MMZ, like every time in Squawk tools) or \`delay\` (30m, 6h, 7d of elapsed time from now). For a relative time ("in 2 hours"), use \`delay\`. For a clock time that the user names, convert it from the user's time zone to UTC. \`latest_start\` (10m to 30d) bounds how late it may still start after Squawk was down; past it the schedule is marked missed. Pass enable: true only when the user's request asks for the work to run later; otherwise it is created paused for the user to enable. The new task does not see this conversation, so put every detail it needs in the prompt. The answer gives \`due_at\` in UTC. The cockpit shows the schedule in local time.`,
|
|
12
|
+
inputSchema: { ...z.toJSONSchema(scheduleTaskRequestSchema, { io: 'input' }), type: 'object' },
|
|
13
|
+
};
|
|
14
|
+
function flatScheduledTasksInputSchema() {
|
|
15
|
+
const properties = {};
|
|
16
|
+
for (const option of scheduledTasksRequestSchema.options)
|
|
17
|
+
Object.assign(properties, z.toJSONSchema(option, { io: 'input' }).properties);
|
|
18
|
+
return {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
...properties,
|
|
22
|
+
action: { type: 'string', enum: scheduledTasksRequestSchema.options.map(option => option.shape.action.value), description: '"list" lists the one-time schedules of this project; "show", "update", "pause", "enable" and "cancel" take the `id` a list or a create answered.' },
|
|
23
|
+
archived: { ...properties.archived, description: 'action "list": "include" adds the archived schedules, "only" lists just them.' },
|
|
24
|
+
},
|
|
25
|
+
required: ['action'],
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export const scheduledTasksToolDefinition = {
|
|
30
|
+
name: 'cezar_scheduled_tasks',
|
|
31
|
+
description: 'List, show, update, pause, enable or cancel the one-time scheduled tasks of this project, one action per call. Change only the schedules the user asked you to manage. "update" takes the same fields as cezar_schedule_task; a new `at` or `delay` must be in the future. "cancel" archives the schedule so it never starts; an archived schedule cannot change.',
|
|
32
|
+
inputSchema: flatScheduledTasksInputSchema(),
|
|
33
|
+
};
|
|
34
|
+
function flatAutomationInputSchema() {
|
|
35
|
+
const properties = {};
|
|
36
|
+
for (const option of automationToolRequestSchema.options)
|
|
37
|
+
Object.assign(properties, z.toJSONSchema(option, { io: 'input' }).properties);
|
|
38
|
+
return { type: 'object', properties: {
|
|
39
|
+
...properties,
|
|
40
|
+
action: { type: 'string', enum: automationToolRequestSchema.options.map(option => option.shape.action.value) },
|
|
41
|
+
}, required: ['action'], additionalProperties: false };
|
|
42
|
+
}
|
|
43
|
+
export const automationToolDefinition = {
|
|
44
|
+
name: 'cezar_automation',
|
|
45
|
+
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.',
|
|
46
|
+
inputSchema: flatAutomationInputSchema(),
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=tool-catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-catalog.js","sourceRoot":"","sources":["../../src/automations/tool-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAE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,CAAC,UAAU,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AutomationToolAnswer } from '../contract/index.js';
|
|
2
|
+
import { type ScheduleTaskAnswer, type ScheduledTasksAnswer } from '../contract/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* hearsay-tools/cezarion#1465: unparsed too. A list of 50 schedules can pass the 32 KiB the
|
|
5
|
+
* other answers fit in, so these two read up to the schedule answer cap.
|
|
6
|
+
*/
|
|
7
|
+
export declare function callScheduleTask(input: unknown, env?: NodeJS.ProcessEnv): Promise<ScheduleTaskAnswer>;
|
|
8
|
+
export declare function callScheduledTasks(input: unknown, env?: NodeJS.ProcessEnv): Promise<ScheduledTasksAnswer>;
|
|
9
|
+
export declare function callAutomation(input: unknown, env?: NodeJS.ProcessEnv): Promise<AutomationToolAnswer>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { callTool } from '../ci-wait/client.js';
|
|
2
|
+
import { AUTOMATION_TOOL_CLIENT_TIMEOUT_MS } from '../core/github-request-limits.js';
|
|
3
|
+
import { automationToolAnswerSchema } from '../contract/index.js';
|
|
4
|
+
import { SCHEDULED_TASK_LIMITS, scheduleTaskAnswerSchema, scheduledTasksAnswerSchema } from '../contract/index.js';
|
|
5
|
+
const SCHEDULE_UNAVAILABLE = `Squawk could not reach its scheduler: the owning session is closed or the private IPC connection failed.`;
|
|
6
|
+
/**
|
|
7
|
+
* hearsay-tools/cezarion#1465: unparsed too. A list of 50 schedules can pass the 32 KiB the
|
|
8
|
+
* other answers fit in, so these two read up to the schedule answer cap.
|
|
9
|
+
*/
|
|
10
|
+
export function callScheduleTask(input, env = process.env) {
|
|
11
|
+
return callTool(input, env, 'cezar_schedule_task', scheduleTaskAnswerSchema, { ok: false, code: 'unavailable', message: SCHEDULE_UNAVAILABLE }, SCHEDULED_TASK_LIMITS.wireBytes);
|
|
12
|
+
}
|
|
13
|
+
export function callScheduledTasks(input, env = process.env) {
|
|
14
|
+
return callTool(input, env, 'cezar_scheduled_tasks', scheduledTasksAnswerSchema, { ok: false, code: 'unavailable', message: SCHEDULE_UNAVAILABLE }, SCHEDULED_TASK_LIMITS.wireBytes);
|
|
15
|
+
}
|
|
16
|
+
export function callAutomation(input, env = process.env) {
|
|
17
|
+
return callTool(input, env, 'cezar_automation', automationToolAnswerSchema, { ok: false, code: 'unavailable', message: SCHEDULE_UNAVAILABLE }, SCHEDULED_TASK_LIMITS.wireBytes, AUTOMATION_TOOL_CLIENT_TIMEOUT_MS);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tool-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-client.js","sourceRoot":"","sources":["../../src/automations/tool-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAA6B,MAAM,8CAA8C,CAAC;AACrH,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,0BAA0B,EAAsD,MAAM,8CAA8C,CAAC;AAC/L,MAAM,oBAAoB,GAAG,0GAA0G,CAAC;AACxI;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc,EAAE,GAAG,GAAsB,OAAO,CAAC,GAAG;IACnF,OAAO,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;AACnL,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAc,EAAE,GAAG,GAAsB,OAAO,CAAC,GAAG;IACrF,OAAO,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;AACvL,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,GAAG,GAAsB,OAAO,CAAC,GAAG;IACjF,OAAO,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,qBAAqB,CAAC,SAAS,EAAE,iCAAiC,CAAC,CAAC;AACrN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function automationsToolEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-env.js","sourceRoot":"","sources":["../../src/automations/tool-env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,MAAM,UAAU,sBAAsB,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG,IAAa,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ScheduledTaskRefusalCode } from '../contract/index.js';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
export declare function scheduleRefusal(code: ScheduledTaskRefusalCode, message?: string): {
|
|
4
|
+
ok: false;
|
|
5
|
+
code: ScheduledTaskRefusalCode;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
/** Names the unknown field or the first failing field and its rule, never the value sent. */
|
|
9
|
+
export declare function scheduleInvalidInput(error?: z.ZodError): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// hearsay-tools/cezarion#1465: `cezar_schedule_task` and `cezar_scheduled_tasks` refusals.
|
|
2
|
+
const scheduleMessages = {
|
|
3
|
+
automations_off: `Automations are off in this cockpit (CEZ_AUTOMATIONS=0), so Squawk cannot schedule a task. Tell the user.`,
|
|
4
|
+
unavailable: `Squawk could not reach its scheduler for this session. Tell the user; scheduling needs a running cockpit.`,
|
|
5
|
+
};
|
|
6
|
+
export function scheduleRefusal(code, message) {
|
|
7
|
+
return { ok: false, code, message: message ?? scheduleMessages[code] ?? 'Invalid arguments.' };
|
|
8
|
+
}
|
|
9
|
+
const SCHEDULE_FIELD_RULES = {
|
|
10
|
+
action: 'must be "list", "show", "update", "pause", "enable" or "cancel"',
|
|
11
|
+
id: 'must be the id of a one-time schedule a list or a create answered',
|
|
12
|
+
archived: 'must be "include" or "only"',
|
|
13
|
+
name: 'must be a string of 1 to 200 characters',
|
|
14
|
+
prompt: 'must be a string of 1 to 100000 characters',
|
|
15
|
+
at: 'must be a UTC time YYYY-MM-DDTHH:MMZ; give at or delay, not both',
|
|
16
|
+
delay: 'must be a duration such as 30m, 6h or 7d; give at or delay, not both',
|
|
17
|
+
latest_start: 'must be a duration such as 30m, 6h or 7d',
|
|
18
|
+
workflow: 'must be a workflow name',
|
|
19
|
+
runner: 'must be a runner name',
|
|
20
|
+
model: 'must be a model id',
|
|
21
|
+
effort: 'must be an effort level',
|
|
22
|
+
enable: 'must be true or false',
|
|
23
|
+
};
|
|
24
|
+
/** Names the unknown field or the first failing field and its rule, never the value sent. */
|
|
25
|
+
export function scheduleInvalidInput(error) {
|
|
26
|
+
const issue = error?.issues[0];
|
|
27
|
+
if (issue?.code === 'unrecognized_keys')
|
|
28
|
+
return `Unknown field ${issue.keys.map(key => JSON.stringify(key.slice(0, 64))).join(', ')}.`;
|
|
29
|
+
const field = error?.issues.map(entry => entry.path[0]).find((key) => typeof key === 'string' && key in SCHEDULE_FIELD_RULES);
|
|
30
|
+
if (field)
|
|
31
|
+
return `\`${field}\` ${SCHEDULE_FIELD_RULES[field]}.`;
|
|
32
|
+
return 'The arguments must be a JSON object.';
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=tool-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-errors.js","sourceRoot":"","sources":["../../src/automations/tool-errors.ts"],"names":[],"mappings":"AAEA,2FAA2F;AAC3F,MAAM,gBAAgB,GAAyF;IAC7G,eAAe,EAAE,2GAA2G;IAC5H,WAAW,EAAE,2GAA2G;CACzH,CAAC;AACF,MAAM,UAAU,eAAe,CAAC,IAA8B,EAAE,OAAgB;IAC9E,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,IAAI,gBAAgB,CAAC,IAAqC,CAAC,IAAI,oBAAoB,EAAE,CAAC;AAClI,CAAC;AAED,MAAM,oBAAoB,GAA2B;IACnD,MAAM,EAAE,iEAAiE;IACzE,EAAE,EAAE,mEAAmE;IACvE,QAAQ,EAAE,6BAA6B;IACvC,IAAI,EAAE,yCAAyC;IAC/C,MAAM,EAAE,4CAA4C;IACpD,EAAE,EAAE,kEAAkE;IACtE,KAAK,EAAE,sEAAsE;IAC7E,YAAY,EAAE,0CAA0C;IACxD,QAAQ,EAAE,yBAAyB;IACnC,MAAM,EAAE,uBAAuB;IAC/B,KAAK,EAAE,oBAAoB;IAC3B,MAAM,EAAE,yBAAyB;IACjC,MAAM,EAAE,uBAAuB;CAChC,CAAC;AAEF,6FAA6F;AAC7F,MAAM,UAAU,oBAAoB,CAAC,KAAkB;IACrD,MAAM,KAAK,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,KAAK,EAAE,IAAI,KAAK,mBAAmB;QAAE,OAAO,iBAAiB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;IACvI,MAAM,KAAK,GAAG,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAiB,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,oBAAoB,CAAC,CAAC;IAC7I,IAAI,KAAK;QAAE,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAC;IACjE,OAAO,sCAAsC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AutomationToolService } from '../workflows/run/types.ts';
|
|
2
|
+
import type { SquawkToolHandlers } from '../ci-wait/controller.ts';
|
|
3
|
+
export declare function automationSessionHandlers(host: {
|
|
4
|
+
awaitAutomationTools(signal: AbortSignal): Promise<AutomationToolService | undefined>;
|
|
5
|
+
}): Pick<SquawkToolHandlers, 'automation' | 'scheduleTask' | 'scheduledTasks'>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { scheduleRefusal } from './tool-errors.js';
|
|
2
|
+
export function automationSessionHandlers(host) {
|
|
3
|
+
return {
|
|
4
|
+
automation: async (request, signal) => {
|
|
5
|
+
const tools = await host.awaitAutomationTools(signal);
|
|
6
|
+
return tools?.automation ? tools.automation(request, signal) : scheduleRefusal('unavailable');
|
|
7
|
+
},
|
|
8
|
+
// A schedule belongs to the project, not to this run: any session there may manage one.
|
|
9
|
+
scheduleTask: async (request, signal) => {
|
|
10
|
+
const tools = await host.awaitAutomationTools(signal);
|
|
11
|
+
return tools ? tools.scheduleTask(request) : scheduleRefusal('unavailable');
|
|
12
|
+
},
|
|
13
|
+
scheduledTasks: async (request, signal) => {
|
|
14
|
+
const tools = await host.awaitAutomationTools(signal);
|
|
15
|
+
return tools ? tools.scheduledTasks(request) : scheduleRefusal('unavailable');
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tool-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-session.js","sourceRoot":"","sources":["../../src/automations/tool-session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,UAAU,yBAAyB,CAAC,IAA+F;IACvI,OAAO;QACL,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACpC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YACtD,OAAO,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAChG,CAAC;QACD,wFAAwF;QACxF,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YACtD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAC9E,CAAC;QACD,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACxC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YACtD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;QAChF,CAAC;KACF,CAAC;AACJ,CAAC"}
|