@namzu/sdk 45.0.0 → 45.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/dist/authorization/gate.d.ts.map +1 -1
- package/dist/authorization/gate.js +12 -2
- package/dist/authorization/gate.js.map +1 -1
- package/dist/authorization/rules.d.ts.map +1 -1
- package/dist/authorization/rules.js +37 -6
- package/dist/authorization/rules.js.map +1 -1
- package/dist/authorization/shell-lexer.d.ts +14 -0
- package/dist/authorization/shell-lexer.d.ts.map +1 -1
- package/dist/authorization/shell-lexer.js +19 -6
- package/dist/authorization/shell-lexer.js.map +1 -1
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +2 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +1 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- package/dist/directory/types.d.ts +2 -0
- package/dist/directory/types.d.ts.map +1 -1
- package/dist/directory/types.js.map +1 -1
- package/dist/manager/resident/outbox.d.ts +4 -4
- package/dist/prompt/coding-agent-doctrine.d.ts +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +1 -0
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/public-runtime.d.ts +4 -1
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +11 -1
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-tools.d.ts +4 -0
- package/dist/public-tools.d.ts.map +1 -1
- package/dist/public-tools.js +10 -0
- package/dist/public-tools.js.map +1 -1
- package/dist/public-types.d.ts +7 -1
- package/dist/public-types.d.ts.map +1 -1
- package/dist/runtime/query/declined.d.ts +12 -0
- package/dist/runtime/query/declined.d.ts.map +1 -0
- package/dist/runtime/query/declined.js +12 -0
- package/dist/runtime/query/declined.js.map +1 -0
- package/dist/runtime/query/executor.d.ts +3 -1
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +14 -2
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +1 -0
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +7 -0
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +6 -0
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/handoff.d.ts +22 -0
- package/dist/runtime/query/iteration/phases/handoff.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/handoff.js +65 -0
- package/dist/runtime/query/iteration/phases/handoff.js.map +1 -0
- package/dist/runtime/query/iteration/phases/index.d.ts +1 -0
- package/dist/runtime/query/iteration/phases/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/index.js +1 -0
- package/dist/runtime/query/iteration/phases/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +8 -3
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +3 -2
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/review-policy.d.ts.map +1 -1
- package/dist/runtime/query/review-policy.js +4 -3
- package/dist/runtime/query/review-policy.js.map +1 -1
- package/dist/schedules/cron.d.ts +21 -0
- package/dist/schedules/cron.d.ts.map +1 -0
- package/dist/schedules/cron.js +167 -0
- package/dist/schedules/cron.js.map +1 -0
- package/dist/schedules/describe.d.ts +14 -0
- package/dist/schedules/describe.d.ts.map +1 -0
- package/dist/schedules/describe.js +133 -0
- package/dist/schedules/describe.js.map +1 -0
- package/dist/schedules/errors.d.ts +11 -0
- package/dist/schedules/errors.d.ts.map +1 -0
- package/dist/schedules/errors.js +15 -0
- package/dist/schedules/errors.js.map +1 -0
- package/dist/schedules/evaluate.d.ts +35 -0
- package/dist/schedules/evaluate.d.ts.map +1 -0
- package/dist/schedules/evaluate.js +158 -0
- package/dist/schedules/evaluate.js.map +1 -0
- package/dist/schedules/index.d.ts +11 -0
- package/dist/schedules/index.d.ts.map +1 -0
- package/dist/schedules/index.js +8 -0
- package/dist/schedules/index.js.map +1 -0
- package/dist/schedules/next-fire.d.ts +50 -0
- package/dist/schedules/next-fire.d.ts.map +1 -0
- package/dist/schedules/next-fire.js +250 -0
- package/dist/schedules/next-fire.js.map +1 -0
- package/dist/schedules/spec.d.ts +30 -0
- package/dist/schedules/spec.d.ts.map +1 -0
- package/dist/schedules/spec.js +169 -0
- package/dist/schedules/spec.js.map +1 -0
- package/dist/schedules/types.d.ts +144 -0
- package/dist/schedules/types.d.ts.map +1 -0
- package/dist/schedules/types.js +11 -0
- package/dist/schedules/types.js.map +1 -0
- package/dist/schedules/tz.d.ts +44 -0
- package/dist/schedules/tz.d.ts.map +1 -0
- package/dist/schedules/tz.js +141 -0
- package/dist/schedules/tz.js.map +1 -0
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +1 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/loader.d.ts +16 -3
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +48 -4
- package/dist/skills/loader.js.map +1 -1
- package/dist/tools/builtins/browser-url.d.ts +83 -0
- package/dist/tools/builtins/browser-url.d.ts.map +1 -0
- package/dist/tools/builtins/browser-url.js +240 -0
- package/dist/tools/builtins/browser-url.js.map +1 -0
- package/dist/tools/builtins/browser.d.ts +367 -0
- package/dist/tools/builtins/browser.d.ts.map +1 -0
- package/dist/tools/builtins/browser.js +704 -0
- package/dist/tools/builtins/browser.js.map +1 -0
- package/dist/tools/builtins/skill.d.ts.map +1 -1
- package/dist/tools/builtins/skill.js +15 -0
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/defineTool.d.ts +2 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +1 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/tools/schedules/index.d.ts +5 -0
- package/dist/tools/schedules/index.d.ts.map +1 -0
- package/dist/tools/schedules/index.js +4 -0
- package/dist/tools/schedules/index.js.map +1 -0
- package/dist/tools/schedules/loop-tool.d.ts +14 -0
- package/dist/tools/schedules/loop-tool.d.ts.map +1 -0
- package/dist/tools/schedules/loop-tool.js +81 -0
- package/dist/tools/schedules/loop-tool.js.map +1 -0
- package/dist/tools/schedules/present.d.ts +16 -0
- package/dist/tools/schedules/present.d.ts.map +1 -0
- package/dist/tools/schedules/present.js +69 -0
- package/dist/tools/schedules/present.js.map +1 -0
- package/dist/tools/schedules/prompt-scan.d.ts +17 -0
- package/dist/tools/schedules/prompt-scan.d.ts.map +1 -0
- package/dist/tools/schedules/prompt-scan.js +92 -0
- package/dist/tools/schedules/prompt-scan.js.map +1 -0
- package/dist/tools/schedules/schedule-tool.d.ts +16 -0
- package/dist/tools/schedules/schedule-tool.d.ts.map +1 -0
- package/dist/tools/schedules/schedule-tool.js +327 -0
- package/dist/tools/schedules/schedule-tool.js.map +1 -0
- package/dist/tools/schedules/types.d.ts +184 -0
- package/dist/tools/schedules/types.d.ts.map +1 -0
- package/dist/tools/schedules/types.js +11 -0
- package/dist/tools/schedules/types.js.map +1 -0
- package/dist/types/authorization/index.d.ts +86 -9
- package/dist/types/authorization/index.d.ts.map +1 -1
- package/dist/types/authorization/index.js +11 -1
- package/dist/types/authorization/index.js.map +1 -1
- package/dist/types/browser/index.d.ts +280 -0
- package/dist/types/browser/index.d.ts.map +1 -0
- package/dist/types/browser/index.js +12 -0
- package/dist/types/browser/index.js.map +1 -0
- package/dist/types/session/events.d.ts +6 -0
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/events.js.map +1 -1
- package/dist/types/session/records.d.ts +23 -0
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +9 -0
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/tool/index.d.ts +41 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +7 -0
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/dist/utils/frontmatter.d.ts +18 -2
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js +13 -3
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/id.d.ts +8 -0
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +12 -0
- package/dist/utils/id.js.map +1 -1
- package/package.json +1 -1
- package/src/authorization/gate.ts +14 -2
- package/src/authorization/rules.ts +37 -7
- package/src/authorization/shell-lexer.ts +36 -6
- package/src/bridge/a2a/mapper.ts +2 -0
- package/src/bridge/sse/mapper.ts +1 -0
- package/src/directory/types.ts +2 -0
- package/src/prompt/coding-agent-doctrine.ts +1 -0
- package/src/public-runtime.ts +28 -0
- package/src/public-tools.ts +35 -0
- package/src/public-types.ts +50 -0
- package/src/runtime/query/declined.ts +12 -0
- package/src/runtime/query/executor.ts +17 -1
- package/src/runtime/query/index.ts +1 -0
- package/src/runtime/query/iteration/index.ts +8 -0
- package/src/runtime/query/iteration/phases/context.ts +6 -0
- package/src/runtime/query/iteration/phases/handoff.ts +74 -0
- package/src/runtime/query/iteration/phases/index.ts +1 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +11 -4
- package/src/runtime/query/resume-pending.ts +3 -2
- package/src/runtime/query/review-policy.ts +4 -3
- package/src/schedules/cron.ts +202 -0
- package/src/schedules/describe.ts +138 -0
- package/src/schedules/errors.ts +15 -0
- package/src/schedules/evaluate.ts +178 -0
- package/src/schedules/index.ts +18 -0
- package/src/schedules/next-fire.ts +257 -0
- package/src/schedules/spec.ts +210 -0
- package/src/schedules/types.ts +163 -0
- package/src/schedules/tz.ts +155 -0
- package/src/skills/index.ts +1 -1
- package/src/skills/loader.ts +55 -4
- package/src/tools/builtins/browser-url.ts +251 -0
- package/src/tools/builtins/browser.ts +817 -0
- package/src/tools/builtins/skill.ts +18 -0
- package/src/tools/defineTool.ts +3 -0
- package/src/tools/schedules/index.ts +4 -0
- package/src/tools/schedules/loop-tool.ts +85 -0
- package/src/tools/schedules/present.ts +86 -0
- package/src/tools/schedules/prompt-scan.ts +96 -0
- package/src/tools/schedules/schedule-tool.ts +376 -0
- package/src/tools/schedules/types.ts +197 -0
- package/src/types/authorization/index.ts +60 -2
- package/src/types/browser/index.ts +341 -0
- package/src/types/session/events.ts +6 -0
- package/src/types/session/records.ts +10 -0
- package/src/types/tool/index.ts +42 -0
- package/src/types/tool/presentation.ts +7 -0
- package/src/utils/frontmatter.ts +29 -3
- package/src/utils/id.ts +14 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { canonicalizeBrowserSitePattern } from '../builtins/browser-url.js';
|
|
3
|
+
import { defineTool } from '../defineTool.js';
|
|
4
|
+
import { presentScheduleCall, presentScheduleResult } from './present.js';
|
|
5
|
+
import { scanSchedulePrompt } from './prompt-scan.js';
|
|
6
|
+
export const SCHEDULE_TOOL_NAME = 'schedule';
|
|
7
|
+
/**
|
|
8
|
+
* A person reads the whole proposal — the prompt, the rules, the schedule,
|
|
9
|
+
* the credential source — before answering `create`, `resume` or `delete`.
|
|
10
|
+
* The executor's `DEFAULT_TOOL_TIMEOUT_MS` (two minutes) is sized for a tool
|
|
11
|
+
* call, not a person on the other end of a screen, and would abandon the
|
|
12
|
+
* call out from under them mid-read. `save_skill`
|
|
13
|
+
* (`packages/cli/src/skills/save.ts`) waits on the same kind of answer and
|
|
14
|
+
* uses the same thirty minutes, for the same reason.
|
|
15
|
+
*/
|
|
16
|
+
const OPERATOR_CONFIRM_TIMEOUT_MS = 30 * 60_000;
|
|
17
|
+
const EFFECT = z.enum(['allow', 'ask', 'deny']);
|
|
18
|
+
const NETWORK_TOOLS = ['web_fetch', 'web_search'];
|
|
19
|
+
const BROWSER_PROFILE = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
20
|
+
const inputSchema = z.object({
|
|
21
|
+
action: z
|
|
22
|
+
.enum(['create', 'list', 'pause', 'resume', 'delete'])
|
|
23
|
+
.describe('What to do. create, resume and delete ask the operator first.'),
|
|
24
|
+
name: z
|
|
25
|
+
.string()
|
|
26
|
+
.regex(/^[a-z0-9][a-z0-9-]{0,62}$/)
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('create: job name, lowercase letters, digits and dashes'),
|
|
29
|
+
prompt: z.string().min(1).max(20_000).optional().describe('create: what the run is asked to do'),
|
|
30
|
+
when: z
|
|
31
|
+
.string()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('create: "every 30m", "0 9 * * 1-5" (cron), "at 2026-09-24 09:00", "in 2h"'),
|
|
34
|
+
folder: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe("create: folder to run in; leave unset for the session's unless the user named one"),
|
|
38
|
+
tz: z
|
|
39
|
+
.string()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("create: IANA time zone; leave unset for the operator's own zone unless the user named another"),
|
|
42
|
+
permissions: z
|
|
43
|
+
.object({
|
|
44
|
+
preset: z
|
|
45
|
+
.enum(['read-only', 'edit-in-folder'])
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('read-only: read/glob/grep/ls only. edit-in-folder: also edit and write, bash asks'),
|
|
48
|
+
unmatched: z
|
|
49
|
+
.enum(['park', 'deny'])
|
|
50
|
+
.describe('A call no rule covers: park (wait for the operator) or deny'),
|
|
51
|
+
execution: z
|
|
52
|
+
.enum(['host', 'sandbox'])
|
|
53
|
+
.optional()
|
|
54
|
+
.describe('Where commands run; leave unset (this machine) unless the user asked for a sandbox'),
|
|
55
|
+
rules: z
|
|
56
|
+
.record(z.string(), z.union([EFFECT, z.record(z.string(), EFFECT)]))
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('Extra rules, e.g. {"bash": {"npm test*": "allow"}}'),
|
|
59
|
+
browser: z
|
|
60
|
+
.object({
|
|
61
|
+
profile: z
|
|
62
|
+
.string()
|
|
63
|
+
.regex(BROWSER_PROFILE)
|
|
64
|
+
.describe('Browser profile the operator signed in with, e.g. "work"'),
|
|
65
|
+
sites: z
|
|
66
|
+
.record(z.string(), z.enum(['read', 'ask', 'act']))
|
|
67
|
+
.describe('Site to level, e.g. {"https://github.com": "read"}. read: open and read only; ask: changes wait for the operator; act: changes run unasked. Unlisted sites are denied; there is no "*".'),
|
|
68
|
+
headed: z.boolean().optional().describe('Show the browser window; default no window'),
|
|
69
|
+
})
|
|
70
|
+
.optional()
|
|
71
|
+
.describe('Browser access; omit for none'),
|
|
72
|
+
})
|
|
73
|
+
.optional()
|
|
74
|
+
.describe('create: REQUIRED explicit permission set; there is no default'),
|
|
75
|
+
budget: z
|
|
76
|
+
.object({
|
|
77
|
+
maxIterations: z
|
|
78
|
+
.number()
|
|
79
|
+
.int()
|
|
80
|
+
.positive()
|
|
81
|
+
.optional()
|
|
82
|
+
.describe('Model steps one run may take (each model call with its tool calls is one step), not how many times the job runs. Omit for the default; a browser task takes 10 or more.'),
|
|
83
|
+
tokenBudget: z
|
|
84
|
+
.number()
|
|
85
|
+
.int()
|
|
86
|
+
.positive()
|
|
87
|
+
.optional()
|
|
88
|
+
.describe('Tokens one run may spend in total. Every model call resends the whole prompt (often 10,000-30,000 tokens each), so a run needs far more than its answer; omit for the default.'),
|
|
89
|
+
timeoutMs: z
|
|
90
|
+
.number()
|
|
91
|
+
.int()
|
|
92
|
+
.positive()
|
|
93
|
+
.optional()
|
|
94
|
+
.describe('Wall clock of one run, in milliseconds'),
|
|
95
|
+
})
|
|
96
|
+
.optional()
|
|
97
|
+
.describe('Limits of ONE run; omit to use the defaults'),
|
|
98
|
+
job: z.string().optional().describe('pause/resume/delete: job name'),
|
|
99
|
+
allFolders: z.boolean().optional().describe('list: include jobs of other folders (names only)'),
|
|
100
|
+
});
|
|
101
|
+
function refuse(error) {
|
|
102
|
+
return { success: false, output: '', error };
|
|
103
|
+
}
|
|
104
|
+
function effectsOf(rule) {
|
|
105
|
+
if (typeof rule === 'string')
|
|
106
|
+
return [rule];
|
|
107
|
+
if (rule && typeof rule === 'object')
|
|
108
|
+
return Object.values(rule);
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Refuse a network tool beside a shell that runs on the host: a scheduled run
|
|
113
|
+
* that can both read the machine and reach the internet, unattended, is the
|
|
114
|
+
* exfiltration shape, and only the operator can choose it.
|
|
115
|
+
*/
|
|
116
|
+
function networkWithHostShell(draft) {
|
|
117
|
+
const rules = draft.permissions.rules ?? {};
|
|
118
|
+
const network = draft.permissions.browser !== undefined ||
|
|
119
|
+
NETWORK_TOOLS.some((t) => effectsOf(rules[t]).some((e) => e === 'allow' || e === 'ask'));
|
|
120
|
+
if (!network)
|
|
121
|
+
return false;
|
|
122
|
+
const bashEffects = effectsOf(rules.bash);
|
|
123
|
+
// The read-only preset denies bash; its rules are expanded by the host,
|
|
124
|
+
// so the draft carries only its name.
|
|
125
|
+
const shellPossible = bashEffects.length > 0
|
|
126
|
+
? bashEffects.some((e) => e !== 'deny')
|
|
127
|
+
: draft.permissions.preset !== 'read-only' && draft.permissions.unmatched !== 'deny';
|
|
128
|
+
return shellPossible && (draft.permissions.execution ?? 'host') === 'host';
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The browser grant with its site keys canonicalised, or why it is refused.
|
|
132
|
+
* Keys are rewritten so the host, the confirmation and the compiled rules
|
|
133
|
+
* all see one spelling of each site.
|
|
134
|
+
*/
|
|
135
|
+
function browserGrant(host, proposed) {
|
|
136
|
+
if (host.browserGrants !== true) {
|
|
137
|
+
return {
|
|
138
|
+
ok: false,
|
|
139
|
+
error: 'This host cannot give a scheduled job browser access. Propose the job without permissions.browser, or ask the operator to add it with `namzu schedule add`.',
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const entries = Object.entries(proposed.sites);
|
|
143
|
+
if (entries.length === 0) {
|
|
144
|
+
return {
|
|
145
|
+
ok: false,
|
|
146
|
+
error: 'permissions.browser.sites is empty; list each site the run may open, e.g. {"https://github.com": "read"}.',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const sites = {};
|
|
150
|
+
for (const [key, level] of entries) {
|
|
151
|
+
if (key.trim() === '*') {
|
|
152
|
+
return {
|
|
153
|
+
ok: false,
|
|
154
|
+
error: 'A scheduled job cannot grant every site ("*"); unlisted sites are always denied. List each site.',
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const verdict = canonicalizeBrowserSitePattern(key);
|
|
158
|
+
if (!verdict.ok)
|
|
159
|
+
return { ok: false, error: `permissions.browser.sites: ${verdict.reason}` };
|
|
160
|
+
if (verdict.pattern in sites && sites[verdict.pattern] !== level) {
|
|
161
|
+
return {
|
|
162
|
+
ok: false,
|
|
163
|
+
error: `permissions.browser.sites names ${verdict.pattern} twice with different levels.`,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
sites[verdict.pattern] = level;
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
ok: true,
|
|
170
|
+
grant: {
|
|
171
|
+
profile: proposed.profile,
|
|
172
|
+
sites,
|
|
173
|
+
...(proposed.headed !== undefined ? { headed: proposed.headed } : {}),
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
async function create(host, input, signal) {
|
|
178
|
+
const missing = ['name', 'prompt', 'when', 'permissions'].filter((k) => input[k] === undefined);
|
|
179
|
+
if (missing.length > 0) {
|
|
180
|
+
return refuse(`create needs ${missing.join(', ')}. permissions is required: propose an explicit set (a preset and/or rules, plus unmatched).`);
|
|
181
|
+
}
|
|
182
|
+
const proposed = input.permissions;
|
|
183
|
+
if (!proposed.preset && !proposed.rules && !proposed.browser) {
|
|
184
|
+
return refuse('permissions needs a preset, rules or a browser grant; an empty permission set is not a choice.');
|
|
185
|
+
}
|
|
186
|
+
let permissions = proposed;
|
|
187
|
+
if (proposed.browser) {
|
|
188
|
+
const grant = browserGrant(host, proposed.browser);
|
|
189
|
+
if (!grant.ok)
|
|
190
|
+
return refuse(grant.error);
|
|
191
|
+
permissions = { ...proposed, browser: grant.grant };
|
|
192
|
+
}
|
|
193
|
+
const draft = {
|
|
194
|
+
name: input.name,
|
|
195
|
+
prompt: input.prompt,
|
|
196
|
+
when: input.when,
|
|
197
|
+
...(input.folder !== undefined ? { folder: input.folder } : {}),
|
|
198
|
+
...(input.tz !== undefined ? { tz: input.tz } : {}),
|
|
199
|
+
permissions,
|
|
200
|
+
...(input.budget ? { budget: input.budget } : {}),
|
|
201
|
+
};
|
|
202
|
+
if (networkWithHostShell(draft)) {
|
|
203
|
+
return refuse('A scheduled job proposed here cannot combine web or browser access with a shell on the host. Deny bash, use execution "sandbox", or ask the operator to create it with `namzu schedule add`.');
|
|
204
|
+
}
|
|
205
|
+
let preview;
|
|
206
|
+
try {
|
|
207
|
+
preview = await host.preview(draft);
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
return refuse(error instanceof Error ? error.message : String(error));
|
|
211
|
+
}
|
|
212
|
+
let answer;
|
|
213
|
+
try {
|
|
214
|
+
answer = await host.confirm({
|
|
215
|
+
preview,
|
|
216
|
+
promptFindings: scanSchedulePrompt(preview.prompt),
|
|
217
|
+
proposedBy: 'model',
|
|
218
|
+
}, signal);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
answer = 'cancel';
|
|
222
|
+
}
|
|
223
|
+
// The deadline or the turn can settle `host.confirm` from underneath a
|
|
224
|
+
// host that resolves optimistically on its own close; never create on an
|
|
225
|
+
// answer that arrived after the operator was no longer being asked.
|
|
226
|
+
if (signal?.aborted)
|
|
227
|
+
answer = 'cancel';
|
|
228
|
+
if (answer !== 'create' && answer !== 'create-paused') {
|
|
229
|
+
return {
|
|
230
|
+
success: false,
|
|
231
|
+
output: '',
|
|
232
|
+
error: 'The operator did not confirm the job, so it was not created.',
|
|
233
|
+
data: { cancelled: true },
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
const created = await host.create(draft, preview, { paused: answer === 'create-paused' });
|
|
237
|
+
const said = answer === 'create-paused'
|
|
238
|
+
? `Job "${created.name}" was created paused. The operator can resume it with /schedule.`
|
|
239
|
+
: `Job "${created.name}" was created. It runs ${preview.schedule}, with nobody watching; results arrive as a notification and a session.`;
|
|
240
|
+
return {
|
|
241
|
+
success: true,
|
|
242
|
+
output: created.note ? `${said} ${created.note}` : said,
|
|
243
|
+
data: { name: created.name, paused: answer === 'create-paused' },
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
async function list(host, input) {
|
|
247
|
+
const jobs = await host.list({ allFolders: input.allFolders === true });
|
|
248
|
+
if (jobs.length === 0)
|
|
249
|
+
return { success: true, output: 'No scheduled jobs.', data: { jobs: [] } };
|
|
250
|
+
const lines = jobs.map((j) => `${j.name} · ${j.state} · ${j.schedule}${j.nextFireAt ? ` · next ${j.nextFireAt}` : ''}${j.lastStatus ? ` · last ${j.lastStatus}` : ''} · ${j.folder}`);
|
|
251
|
+
return { success: true, output: lines.join('\n'), data: { jobs } };
|
|
252
|
+
}
|
|
253
|
+
async function lifecycle(host, input, action, signal) {
|
|
254
|
+
if (!input.job)
|
|
255
|
+
return refuse(`${action} needs job (the job's name).`);
|
|
256
|
+
const job = await host.find(input.job);
|
|
257
|
+
if (!job)
|
|
258
|
+
return refuse(`No scheduled job is named "${input.job}".`);
|
|
259
|
+
if (action !== 'pause') {
|
|
260
|
+
let confirmed = false;
|
|
261
|
+
try {
|
|
262
|
+
confirmed = await host.confirmAction(job, action, signal);
|
|
263
|
+
}
|
|
264
|
+
catch {
|
|
265
|
+
confirmed = false;
|
|
266
|
+
}
|
|
267
|
+
if (signal?.aborted)
|
|
268
|
+
confirmed = false;
|
|
269
|
+
if (!confirmed)
|
|
270
|
+
return {
|
|
271
|
+
...refuse(`The operator did not confirm; "${job.name}" was not changed.`),
|
|
272
|
+
data: { cancelled: true },
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
if (action === 'pause')
|
|
276
|
+
await host.pause(job.name);
|
|
277
|
+
else if (action === 'resume')
|
|
278
|
+
await host.resume(job.name);
|
|
279
|
+
else
|
|
280
|
+
await host.delete(job.name);
|
|
281
|
+
const verb = action === 'pause' ? 'paused' : action === 'resume' ? 'resumed' : 'deleted';
|
|
282
|
+
return { success: true, output: `Job "${job.name}" ${verb}.`, data: { name: job.name, action } };
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* The `schedule` tool: create, list, pause, resume and delete the operator's
|
|
286
|
+
* scheduled jobs from a conversation.
|
|
287
|
+
*
|
|
288
|
+
* Creation, resuming and deleting are confirmed by a person through the host
|
|
289
|
+
* (`ScheduleToolHost.confirm`), on a screen the host draws from its own
|
|
290
|
+
* computation. The model cannot propose that uncovered calls run without
|
|
291
|
+
* asking, nor web access beside a host shell. Register it only where a person
|
|
292
|
+
* is present to confirm: never in a headless run, a scheduled run or a
|
|
293
|
+
* sub-agent.
|
|
294
|
+
*/
|
|
295
|
+
export function buildScheduleTools(host) {
|
|
296
|
+
return [
|
|
297
|
+
defineTool({
|
|
298
|
+
name: SCHEDULE_TOOL_NAME,
|
|
299
|
+
description: "Manage the operator's scheduled jobs: prompts that run later in a folder, with nobody watching, under an explicit permission set. Use it only when the user asks for something to happen on a schedule. create, resume and delete are confirmed by the operator; pause is not. A job needs name, prompt, when and permissions (unmatched: park or deny, plus a preset, rules or a browser grant). Leave every other field (folder, tz, execution, budget, headed) unset unless the user asked for it: the defaults are the operator's, and the confirmation marks each value you chose. Scheduled runs cannot ask questions.",
|
|
300
|
+
inputSchema,
|
|
301
|
+
category: 'custom',
|
|
302
|
+
permissions: [],
|
|
303
|
+
readOnly: (input) => input.action === 'list',
|
|
304
|
+
// `delete` removes a job only after the operator confirms it on the
|
|
305
|
+
// host's own screen; a destructive flag would put a second review,
|
|
306
|
+
// over the raw arguments, in front of that confirmation.
|
|
307
|
+
destructive: false,
|
|
308
|
+
concurrencySafe: false,
|
|
309
|
+
presentCall: presentScheduleCall,
|
|
310
|
+
presentResult: presentScheduleResult,
|
|
311
|
+
// A person, not a tool, answers `create`/`resume`/`delete`; see
|
|
312
|
+
// `OPERATOR_CONFIRM_TIMEOUT_MS`.
|
|
313
|
+
timeoutMs: OPERATOR_CONFIRM_TIMEOUT_MS,
|
|
314
|
+
async execute(input, context) {
|
|
315
|
+
switch (input.action) {
|
|
316
|
+
case 'create':
|
|
317
|
+
return create(host, input, context.abortSignal);
|
|
318
|
+
case 'list':
|
|
319
|
+
return list(host, input);
|
|
320
|
+
default:
|
|
321
|
+
return lifecycle(host, input, input.action, context.abortSignal);
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
}),
|
|
325
|
+
];
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=schedule-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-tool.js","sourceRoot":"","sources":["../../../src/tools/schedules/schedule-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAA;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAQrD,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAA;AAE5C;;;;;;;;GAQG;AACH,MAAM,2BAA2B,GAAG,EAAE,GAAG,MAAM,CAAA;A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V,IAAI,EAAE,kBAAkB;YACxB,WAAW,EACV,8lBAA8lB;YAC/lB,WAAW;YACX,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM;YAC5C,oEAAoE;YACpE,mEAAmE;YACnE,yDAAyD;YACzD,WAAW,EAAE,KAAK;YAClB,eAAe,EAAE,KAAK;YACtB,WAAW,EAAE,mBAAmB;YAChC,aAAa,EAAE,qBAAqB;YACpC,gEAAgE;YAChE,iCAAiC;YACjC,SAAS,EAAE,2BAA2B;YACtC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,OAAoB;gBACxC,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;oBACtB,KAAK,QAAQ;wBACZ,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;oBAChD,KAAK,MAAM;wBACV,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;oBACzB;wBACC,OAAO,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;gBAClE,CAAC;YACF,CAAC;SACD,CAAC;KACF,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host side of the `schedule` and `session_loop` tools.
|
|
3
|
+
*
|
|
4
|
+
* The SDK holds the tool's contract with the model — its schema, its refusals
|
|
5
|
+
* and its confirmation rule — and nothing about where jobs are stored or how
|
|
6
|
+
* a confirmation is drawn. The host supplies both, and it computes every
|
|
7
|
+
* field a person is asked to confirm: the model's own words are never what
|
|
8
|
+
* the confirmation shows as fact.
|
|
9
|
+
*/
|
|
10
|
+
/** A rule effect, in the vocabulary of the CLI's `[permissions]` table. */
|
|
11
|
+
export type ScheduleRuleEffect = 'allow' | 'ask' | 'deny';
|
|
12
|
+
/** What the model proposes. Validated by the tool's schema, then by the host. */
|
|
13
|
+
export interface ScheduleJobDraft {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly prompt: string;
|
|
16
|
+
/** Schedule words: `every 30m`, `0 9 * * 1-5`, `at 09:00`, `in 2h`. */
|
|
17
|
+
readonly when: string;
|
|
18
|
+
/** Folder the job runs in. Absent: the session's working directory. */
|
|
19
|
+
readonly folder?: string;
|
|
20
|
+
/** IANA zone for a cron expression or a local time. Absent: the host's. */
|
|
21
|
+
readonly tz?: string;
|
|
22
|
+
readonly permissions: {
|
|
23
|
+
readonly preset?: 'read-only' | 'edit-in-folder';
|
|
24
|
+
/**
|
|
25
|
+
* What happens to a call no rule covers. The model may choose `park`
|
|
26
|
+
* (wait for the operator) or `deny`; running uncovered calls without
|
|
27
|
+
* asking is an operator decision the tool cannot propose.
|
|
28
|
+
*/
|
|
29
|
+
readonly unmatched: 'park' | 'deny';
|
|
30
|
+
readonly execution?: 'host' | 'sandbox';
|
|
31
|
+
readonly rules?: Readonly<Record<string, ScheduleRuleEffect | Readonly<Record<string, ScheduleRuleEffect>>>>;
|
|
32
|
+
/**
|
|
33
|
+
* Browser access for the run. Absent: the `browser` and `browser_act`
|
|
34
|
+
* tools are denied. Present: only the listed sites are reachable, at
|
|
35
|
+
* the listed level, and every other site is denied — there is no
|
|
36
|
+
* catch-all key. The tool refuses this block unless the host sets
|
|
37
|
+
* {@link ScheduleToolHost.browserGrants}.
|
|
38
|
+
*/
|
|
39
|
+
readonly browser?: ScheduleBrowserGrant;
|
|
40
|
+
};
|
|
41
|
+
readonly budget?: {
|
|
42
|
+
readonly maxIterations?: number;
|
|
43
|
+
readonly tokenBudget?: number;
|
|
44
|
+
readonly timeoutMs?: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* How far a scheduled run may go on one site. `read`: open and read pages,
|
|
49
|
+
* never change them. `ask`: open and change pages, each change parked for the
|
|
50
|
+
* operator. `act`: open and change pages without asking.
|
|
51
|
+
*/
|
|
52
|
+
export type ScheduleBrowserSiteLevel = 'read' | 'ask' | 'act';
|
|
53
|
+
/** A scheduled job's browser grant. */
|
|
54
|
+
export interface ScheduleBrowserGrant {
|
|
55
|
+
/** The browser profile the run uses; the operator's, signed in beforehand. */
|
|
56
|
+
readonly profile: string;
|
|
57
|
+
/**
|
|
58
|
+
* Canonical site key (`https://github.com`, `https://*.example.com`,
|
|
59
|
+
* `http://localhost:*`) to level. The tool canonicalises the keys the
|
|
60
|
+
* model wrote (see `canonicalizeBrowserSitePattern`) before the host sees
|
|
61
|
+
* them. Unlisted sites are denied.
|
|
62
|
+
*/
|
|
63
|
+
readonly sites: Readonly<Record<string, ScheduleBrowserSiteLevel>>;
|
|
64
|
+
/** Show the browser window during the run. Default: no window. */
|
|
65
|
+
readonly headed?: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** What the person confirming is shown. Every field is the host's own computation. */
|
|
68
|
+
export interface ScheduleJobPreview {
|
|
69
|
+
readonly name: string;
|
|
70
|
+
/** The canonical folder the job would run in. */
|
|
71
|
+
readonly folder: string;
|
|
72
|
+
/** True when `folder` is outside the session's working directory and added directories. */
|
|
73
|
+
readonly outsideSessionRoots: boolean;
|
|
74
|
+
readonly prompt: string;
|
|
75
|
+
/** The schedule in words, with its zone. */
|
|
76
|
+
readonly schedule: string;
|
|
77
|
+
/** The next fire times, ISO-8601 UTC. */
|
|
78
|
+
readonly nextFireTimes: readonly string[];
|
|
79
|
+
/** The permission set expanded to one line per rule, config denies included. */
|
|
80
|
+
readonly rules: readonly string[];
|
|
81
|
+
readonly unmatched: 'park' | 'deny' | 'allow';
|
|
82
|
+
readonly execution: 'host' | 'sandbox';
|
|
83
|
+
/** A rule lets the run reach the network. */
|
|
84
|
+
readonly networkAccess: boolean;
|
|
85
|
+
readonly budget: {
|
|
86
|
+
readonly maxIterations: number;
|
|
87
|
+
readonly tokenBudget: number;
|
|
88
|
+
readonly timeoutMs: number;
|
|
89
|
+
};
|
|
90
|
+
/** Runs per day at most, times the token budget. Absent for a one-shot. */
|
|
91
|
+
readonly dailyTokenCeiling?: number;
|
|
92
|
+
/** Provider and model the job is pinned to. */
|
|
93
|
+
readonly model: string;
|
|
94
|
+
/** Where the run's credential comes from, in words. */
|
|
95
|
+
readonly credentialSource?: string;
|
|
96
|
+
/** Anything the host wants said in the warning colour. */
|
|
97
|
+
readonly warnings: readonly string[];
|
|
98
|
+
}
|
|
99
|
+
/** A job as the `list` action reports it. */
|
|
100
|
+
export interface ScheduleJobSummary {
|
|
101
|
+
readonly name: string;
|
|
102
|
+
readonly folder: string;
|
|
103
|
+
readonly state: string;
|
|
104
|
+
readonly schedule: string;
|
|
105
|
+
readonly nextFireAt?: string;
|
|
106
|
+
readonly lastStatus?: string;
|
|
107
|
+
/** Present only for jobs in the session's own folder. */
|
|
108
|
+
readonly prompt?: string;
|
|
109
|
+
}
|
|
110
|
+
/** What the person answered to a proposed job. */
|
|
111
|
+
export type ScheduleConfirmAnswer = 'create' | 'create-paused' | 'cancel';
|
|
112
|
+
export interface ScheduleConfirmRequest {
|
|
113
|
+
readonly preview: ScheduleJobPreview;
|
|
114
|
+
/** The prompt tripwire's findings over `preview.prompt`. */
|
|
115
|
+
readonly promptFindings: readonly string[];
|
|
116
|
+
/** Always `model` from this tool: the banner says it was not the operator. */
|
|
117
|
+
readonly proposedBy: 'model';
|
|
118
|
+
}
|
|
119
|
+
export interface ScheduleToolHost {
|
|
120
|
+
/**
|
|
121
|
+
* The host can store and enforce {@link ScheduleJobDraft.permissions}
|
|
122
|
+
* `.browser`. Absent or false: the tool refuses a draft carrying one,
|
|
123
|
+
* rather than let the host drop it and confirm a job the model believes
|
|
124
|
+
* can use the browser.
|
|
125
|
+
*/
|
|
126
|
+
readonly browserGrants?: boolean;
|
|
127
|
+
/** Validate the draft and compute what the person will be shown. Throws with a message on a refusal. */
|
|
128
|
+
preview(draft: ScheduleJobDraft): Promise<ScheduleJobPreview>;
|
|
129
|
+
/**
|
|
130
|
+
* Ask the person. Anything but `create` or `create-paused` — `cancel`, a
|
|
131
|
+
* thrown error, a closed screen — means no job.
|
|
132
|
+
*
|
|
133
|
+
* `signal` fires when the tool's own confirmation deadline elapses or the
|
|
134
|
+
* turn is aborted; a host that draws a screen closes it then rather than
|
|
135
|
+
* leaving it live after the tool has given up on the answer.
|
|
136
|
+
*/
|
|
137
|
+
confirm(request: ScheduleConfirmRequest, signal?: AbortSignal): Promise<ScheduleConfirmAnswer>;
|
|
138
|
+
/**
|
|
139
|
+
* Create the job the person confirmed. `note`, when given, is appended to
|
|
140
|
+
* what the model is told, for what the person must still do before the
|
|
141
|
+
* job runs (install a scheduler, say): the model reports the job as set
|
|
142
|
+
* up otherwise.
|
|
143
|
+
*/
|
|
144
|
+
create(draft: ScheduleJobDraft, preview: ScheduleJobPreview, options: {
|
|
145
|
+
readonly paused: boolean;
|
|
146
|
+
}): Promise<{
|
|
147
|
+
readonly name: string;
|
|
148
|
+
readonly note?: string;
|
|
149
|
+
}>;
|
|
150
|
+
/** Jobs, the session folder's in full, other folders' without their prompts. */
|
|
151
|
+
list(options: {
|
|
152
|
+
readonly allFolders: boolean;
|
|
153
|
+
}): Promise<readonly ScheduleJobSummary[]>;
|
|
154
|
+
/** A job by name or id prefix, or undefined. */
|
|
155
|
+
find(job: string): Promise<ScheduleJobSummary | undefined>;
|
|
156
|
+
/** Ask the person to confirm resuming or deleting a job. See `confirm` on `signal`. */
|
|
157
|
+
confirmAction(job: ScheduleJobSummary, action: 'resume' | 'delete', signal?: AbortSignal): Promise<boolean>;
|
|
158
|
+
pause(job: string): Promise<void>;
|
|
159
|
+
resume(job: string): Promise<void>;
|
|
160
|
+
delete(job: string): Promise<void>;
|
|
161
|
+
}
|
|
162
|
+
/** A prompt the session re-sends to itself on an interval. */
|
|
163
|
+
export interface SessionLoop {
|
|
164
|
+
readonly id: string;
|
|
165
|
+
/** The interval in words. */
|
|
166
|
+
readonly schedule: string;
|
|
167
|
+
readonly prompt: string;
|
|
168
|
+
readonly createdAt: string;
|
|
169
|
+
readonly expiresAt?: string;
|
|
170
|
+
readonly lastFiredAt?: string;
|
|
171
|
+
readonly createdBy: 'operator' | 'model';
|
|
172
|
+
}
|
|
173
|
+
export interface SessionLoopHost {
|
|
174
|
+
/** Throws with a message when the interval is not usable or the loop limit is reached. */
|
|
175
|
+
create(request: {
|
|
176
|
+
readonly interval: string;
|
|
177
|
+
readonly prompt: string;
|
|
178
|
+
readonly createdBy: 'model';
|
|
179
|
+
}): Promise<SessionLoop>;
|
|
180
|
+
list(): readonly SessionLoop[];
|
|
181
|
+
/** Stop one loop by id, or every loop with `all`. Returns how many stopped. */
|
|
182
|
+
delete(id: string): Promise<number>;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/schedules/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,2EAA2E;AAC3E,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;AAEzD,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,WAAW,EAAE;QACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,gBAAgB,CAAA;QAChD;;;;WAIG;QACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAA;QACnC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAA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,OAAO,CAAC,IAAI,CAAC,CAAA;IAClC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAClC;AAED,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,6BAA6B;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAA;CACxC;AAED,MAAM,WAAW,eAAe;IAC/B,0FAA0F;IAC1F,MAAM,CAAC,OAAO,EAAE;QACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;QACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;QACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;KAC3B,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IACxB,IAAI,IAAI,SAAS,WAAW,EAAE,CAAA;IAC9B,+EAA+E;IAC/E,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACnC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host side of the `schedule` and `session_loop` tools.
|
|
3
|
+
*
|
|
4
|
+
* The SDK holds the tool's contract with the model — its schema, its refusals
|
|
5
|
+
* and its confirmation rule — and nothing about where jobs are stored or how
|
|
6
|
+
* a confirmation is drawn. The host supplies both, and it computes every
|
|
7
|
+
* field a person is asked to confirm: the model's own words are never what
|
|
8
|
+
* the confirmation shows as fact.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/tools/schedules/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|