@yu_robotics/remote-cli 1.6.234 → 1.6.235

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.
Files changed (82) hide show
  1. package/dist/client/MessageHandler.d.ts.map +1 -1
  2. package/dist/client/MessageHandler.js +77 -11
  3. package/dist/client/MessageHandler.js.map +1 -1
  4. package/dist/executor/AcpExecutor.d.ts +13 -1
  5. package/dist/executor/AcpExecutor.d.ts.map +1 -1
  6. package/dist/executor/AcpExecutor.js +18 -2
  7. package/dist/executor/AcpExecutor.js.map +1 -1
  8. package/dist/executor/ClaudePersistentExecutor.d.ts +14 -0
  9. package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
  10. package/dist/executor/ClaudePersistentExecutor.js +184 -10
  11. package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
  12. package/dist/executor/DshExecutor.d.ts +1 -0
  13. package/dist/executor/DshExecutor.d.ts.map +1 -1
  14. package/dist/executor/DshExecutor.js +14 -0
  15. package/dist/executor/DshExecutor.js.map +1 -1
  16. package/dist/executor/IExecutor.d.ts +5 -0
  17. package/dist/executor/IExecutor.d.ts.map +1 -1
  18. package/dist/executor/acp/AcpClient.d.ts +4 -3
  19. package/dist/executor/acp/AcpClient.d.ts.map +1 -1
  20. package/dist/executor/acp/AcpClient.js.map +1 -1
  21. package/dist/executor/dsh/DshAcpClient.d.ts +9 -0
  22. package/dist/executor/dsh/DshAcpClient.d.ts.map +1 -1
  23. package/dist/executor/dsh/DshAcpClient.js +72 -2
  24. package/dist/executor/dsh/DshAcpClient.js.map +1 -1
  25. package/dist/executor/dsh/DshPrivacy.d.ts +1 -1
  26. package/dist/executor/dsh/DshPrivacy.d.ts.map +1 -1
  27. package/dist/executor/dsh/DshPrivacy.js +3 -3
  28. package/dist/executor/dsh/DshPrivacy.js.map +1 -1
  29. package/dist/maintenance/release-notes.json +1 -1
  30. package/dist/managed/tools.d.ts +2 -2
  31. package/dist/scheduling/ScheduleCapabilities.d.ts +5 -7
  32. package/dist/scheduling/ScheduleCapabilities.d.ts.map +1 -1
  33. package/dist/scheduling/ScheduleCapabilities.js +6 -7
  34. package/dist/scheduling/ScheduleCapabilities.js.map +1 -1
  35. package/dist/scheduling/ScheduleCommand.js +1 -1
  36. package/dist/scheduling/ScheduleCommand.js.map +1 -1
  37. package/dist/scheduling/ScheduleService.d.ts.map +1 -1
  38. package/dist/scheduling/ScheduleService.js +40 -16
  39. package/dist/scheduling/ScheduleService.js.map +1 -1
  40. package/dist/scheduling/ScheduleToolScope.d.ts +1 -0
  41. package/dist/scheduling/ScheduleToolScope.d.ts.map +1 -1
  42. package/dist/scheduling/ScheduleToolScope.js +3 -1
  43. package/dist/scheduling/ScheduleToolScope.js.map +1 -1
  44. package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts +82 -0
  45. package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts.map +1 -0
  46. package/dist/scheduling/claude/ClaudeSessionSchedules.js +457 -0
  47. package/dist/scheduling/claude/ClaudeSessionSchedules.js.map +1 -0
  48. package/dist/scheduling/dsh/SessionScheduleBridge.d.ts +35 -0
  49. package/dist/scheduling/dsh/SessionScheduleBridge.d.ts.map +1 -0
  50. package/dist/scheduling/dsh/SessionScheduleBridge.js +300 -0
  51. package/dist/scheduling/dsh/SessionScheduleBridge.js.map +1 -0
  52. package/dist/scheduling/dsh/SessionScheduleClient.d.ts +15 -0
  53. package/dist/scheduling/dsh/SessionScheduleClient.d.ts.map +1 -0
  54. package/dist/scheduling/dsh/SessionScheduleClient.js +182 -0
  55. package/dist/scheduling/dsh/SessionScheduleClient.js.map +1 -0
  56. package/dist/scheduling/dsh/SessionScheduleStorage.d.ts +8 -0
  57. package/dist/scheduling/dsh/SessionScheduleStorage.d.ts.map +1 -0
  58. package/dist/scheduling/dsh/SessionScheduleStorage.js +34 -0
  59. package/dist/scheduling/dsh/SessionScheduleStorage.js.map +1 -0
  60. package/dist/scheduling/dsh/sessionLaunch.d.ts +3 -0
  61. package/dist/scheduling/dsh/sessionLaunch.d.ts.map +1 -0
  62. package/dist/scheduling/dsh/sessionLaunch.js +22 -0
  63. package/dist/scheduling/dsh/sessionLaunch.js.map +1 -0
  64. package/dist/scheduling/dsh/sessionProtocol.d.ts +4 -0
  65. package/dist/scheduling/dsh/sessionProtocol.d.ts.map +1 -0
  66. package/dist/scheduling/dsh/sessionProtocol.js +7 -0
  67. package/dist/scheduling/dsh/sessionProtocol.js.map +1 -0
  68. package/dist/scheduling/toolContract.d.ts +1 -1
  69. package/dist/scheduling/toolContract.js +2 -2
  70. package/dist/scheduling/toolContract.js.map +1 -1
  71. package/dist/scheduling/types.d.ts +11 -2
  72. package/dist/scheduling/types.d.ts.map +1 -1
  73. package/dist/scheduling/types.js.map +1 -1
  74. package/native/prebuilds/darwin-arm64/managed_native.node +0 -0
  75. package/native/prebuilds/darwin-arm64/manifest.json +1 -1
  76. package/native/prebuilds/darwin-x64/managed_native.node +0 -0
  77. package/native/prebuilds/darwin-x64/manifest.json +1 -1
  78. package/native/prebuilds/win32-arm64/managed_native.node +0 -0
  79. package/native/prebuilds/win32-arm64/manifest.json +1 -1
  80. package/native/prebuilds/win32-x64/managed_native.node +0 -0
  81. package/native/prebuilds/win32-x64/manifest.json +1 -1
  82. package/package.json +1 -1
@@ -0,0 +1,82 @@
1
+ import { type NativeScheduleInput, type NativeScheduleHandle, type NativeScheduleEvent } from '../types';
2
+ export interface NativeScheduleAction {
3
+ tool: 'CronCreate' | 'CronList' | 'CronDelete';
4
+ input: Record<string, unknown>;
5
+ }
6
+ type Frame = Record<string, any>;
7
+ interface Job {
8
+ id: string;
9
+ marker: string;
10
+ prompt: string;
11
+ nativeId?: string;
12
+ recurring: boolean;
13
+ deadline?: number;
14
+ current(): boolean;
15
+ uncertain: boolean;
16
+ retired: boolean;
17
+ cancelled: boolean;
18
+ emit(event: NativeScheduleEvent): void;
19
+ }
20
+ export declare const SCHEDULE_HOOK = "remote-cli-session-schedules";
21
+ export declare const SCHEDULE_HOOKS: {
22
+ PreToolUse: {
23
+ matcher: string;
24
+ hookCallbackIds: string[];
25
+ timeout: number;
26
+ }[];
27
+ UserPromptSubmit: {
28
+ hookCallbackIds: string[];
29
+ timeout: number;
30
+ }[];
31
+ };
32
+ /** One adapter per foreground process. It owns jobs, never the shared process or its history. */
33
+ export declare class ClaudeSessionSchedules {
34
+ private readonly options;
35
+ private jobs;
36
+ private pending?;
37
+ private scope?;
38
+ private batch?;
39
+ private submitted?;
40
+ private capable;
41
+ private managementTurn;
42
+ private closed;
43
+ private seen;
44
+ private resultIds;
45
+ private foregroundId?;
46
+ private foregroundStarted;
47
+ foregroundDispatched(id: string, management?: boolean): void;
48
+ private authorized;
49
+ constructor(options: {
50
+ send(frame: Frame): void;
51
+ manage(prompt: string, current: () => boolean): Promise<{
52
+ success: boolean;
53
+ }>;
54
+ wake(): void;
55
+ timezone?: string;
56
+ timeoutMs?: number;
57
+ });
58
+ get busy(): boolean;
59
+ get hasJobs(): boolean;
60
+ inToolOperation<T>(id: string, current: () => boolean, run: () => Promise<T>, inTurn?: boolean): Promise<T>;
61
+ action(id: string): NativeScheduleAction | undefined;
62
+ create(input: NativeScheduleInput, emit: Job['emit'], current?: () => boolean, timezone?: string): Promise<NativeScheduleHandle>;
63
+ private handle;
64
+ private cancel;
65
+ private inventory;
66
+ private request;
67
+ private failPending;
68
+ /** Called before an ordinary command resolves so its unexecuted reservations cannot deadlock drain(). */
69
+ foregroundEnded(): void;
70
+ /** Consume only schedule-owned frames. Ordinary user output continues through the existing executor. */
71
+ accept(frame: Frame): boolean;
72
+ private receipt;
73
+ private hook;
74
+ private matchPrompts;
75
+ private bind;
76
+ private completeOccurrence;
77
+ private retire;
78
+ /** Only a confirmed process close loses all session-only jobs. */
79
+ processClosed(): void;
80
+ }
81
+ export {};
82
+ //# sourceMappingURL=ClaudeSessionSchedules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClaudeSessionSchedules.d.ts","sourceRoot":"","sources":["../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AAO;IAUf,OAAO,CAAC,IAAI;IAwCZ,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,MAAM;IAId,kEAAkE;IAClE,aAAa,IAAI,IAAI;CAOtB"}
@@ -0,0 +1,457 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClaudeSessionSchedules = exports.SCHEDULE_HOOKS = exports.SCHEDULE_HOOK = void 0;
4
+ const crypto_1 = require("crypto");
5
+ const rules_1 = require("./rules");
6
+ const types_1 = require("../types");
7
+ exports.SCHEDULE_HOOK = 'remote-cli-session-schedules';
8
+ exports.SCHEDULE_HOOKS = {
9
+ PreToolUse: [{ matcher: '.*', hookCallbackIds: [exports.SCHEDULE_HOOK], timeout: 10 }],
10
+ UserPromptSubmit: [{ hookCallbackIds: [exports.SCHEDULE_HOOK], timeout: 10 }],
11
+ };
12
+ const idPattern = /^[A-Za-z0-9_-]{1,128}$/;
13
+ const canonical = (value) => JSON.stringify(value && typeof value === 'object' && !Array.isArray(value)
14
+ ? Object.fromEntries(Object.keys(value).sort().map(key => [key, value[key]])) : value);
15
+ /** One adapter per foreground process. It owns jobs, never the shared process or its history. */
16
+ class ClaudeSessionSchedules {
17
+ options;
18
+ jobs = new Map();
19
+ pending;
20
+ scope;
21
+ batch;
22
+ submitted;
23
+ capable = false;
24
+ managementTurn = false;
25
+ closed = false;
26
+ seen = new Set();
27
+ resultIds = new Set();
28
+ foregroundId;
29
+ foregroundStarted = false;
30
+ foregroundDispatched(id, management = false) {
31
+ this.foregroundId = id;
32
+ this.foregroundStarted = false;
33
+ this.managementTurn = management;
34
+ if (management && this.pending && !this.pending.scope?.inTurn)
35
+ this.pending.managementId = id;
36
+ }
37
+ authorized = new Map();
38
+ constructor(options) {
39
+ this.options = options;
40
+ }
41
+ get busy() { return !!this.batch || !!this.submitted; }
42
+ get hasJobs() { return [...this.jobs.values()].some(job => !job.retired); }
43
+ async inToolOperation(id, current, run, inTurn = true) {
44
+ if (this.scope)
45
+ throw new Error('A native schedule operation is already active.');
46
+ const scope = { id, current, inTurn };
47
+ this.scope = scope;
48
+ try {
49
+ return await run();
50
+ }
51
+ finally {
52
+ if (this.scope === scope)
53
+ this.scope = undefined;
54
+ }
55
+ }
56
+ action(id) {
57
+ return this.pending?.scope?.inTurn && this.pending.scope.id === id && this.pending.scope.current() && !this.pending.toolId
58
+ ? structuredClone(this.pending.action) : undefined;
59
+ }
60
+ async create(input, emit, current = () => true, timezone = this.options.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone) {
61
+ if (this.closed || this.jobs.has(input.id) || this.jobs.size >= 100 || [...this.jobs.values()].filter(j => !j.retired).length >= 5) {
62
+ throw new Error('Native session schedule identity or capacity is unavailable.');
63
+ }
64
+ const rule = (0, rules_1.nativeRule)(input.rule, Date.now());
65
+ let cron = rule.cron;
66
+ if (rule.at) {
67
+ const formatter = new Intl.DateTimeFormat('en-US', { timeZone: timezone, year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', hourCycle: 'h23' });
68
+ const parts = formatter.formatToParts(rule.at);
69
+ // During a daylight-saving rollback cron could select an earlier instance
70
+ // of the same wall minute. Refuse that ambiguity rather than fire early.
71
+ for (let minutes = 1; minutes <= 180; minutes++) {
72
+ const earlier = rule.at - minutes * 60_000;
73
+ if (earlier > Date.now() && formatter.format(earlier) === formatter.format(rule.at)) {
74
+ throw new Error('This one-shot time is ambiguous in the native session timezone. Choose a time outside the clock rollback.');
75
+ }
76
+ }
77
+ const part = (name) => Number(parts.find(p => p.type === name).value);
78
+ cron = `${part('minute')} ${part('hour')} ${part('day')} ${part('month')} *`;
79
+ }
80
+ else if (new Intl.DateTimeFormat('en', { timeZone: rule.timezone }).resolvedOptions().timeZone
81
+ !== new Intl.DateTimeFormat('en', { timeZone: timezone }).resolvedOptions().timeZone) {
82
+ throw new Error(`Shared Claude schedules use the native session timezone (${timezone}); choose that timezone. The conversation timezone was not changed.`);
83
+ }
84
+ const marker = `[remote-cli:${(0, crypto_1.randomUUID)()}]`;
85
+ const job = { id: input.id, marker, prompt: `${marker}\n${input.prompt}`, recurring: rule.recurring,
86
+ deadline: rule.at, current, uncertain: false, retired: false, cancelled: false, emit };
87
+ this.jobs.set(job.id, job);
88
+ const handle = this.handle(job);
89
+ try {
90
+ await this.request(job, { tool: 'CronCreate', input: { cron, prompt: job.prompt, recurring: rule.recurring, durable: false } });
91
+ if (!job.nativeId)
92
+ throw new Error('Native creation returned no verified job ID.');
93
+ return handle;
94
+ }
95
+ catch (error) {
96
+ if (job.uncertain || job.nativeId)
97
+ throw new types_1.NativeScheduleCleanupError('Native creation is unconfirmed. Use cancellation to reconcile this owned job; do not recreate it.', handle);
98
+ job.retired = true;
99
+ throw error;
100
+ }
101
+ }
102
+ handle(job) {
103
+ return {
104
+ cancellationKeepsRunning: true,
105
+ get nativeId() { return job.nativeId ?? `unconfirmed-${job.id}`; },
106
+ list: async () => {
107
+ if (job.retired || this.closed || job.cancelled)
108
+ return false;
109
+ const text = await this.request(job, { tool: 'CronList', input: {} });
110
+ const exists = this.inventory(job, text);
111
+ if (!exists) {
112
+ job.uncertain = false;
113
+ job.cancelled = true;
114
+ }
115
+ return exists;
116
+ },
117
+ cancel: () => this.cancel(job),
118
+ stop: async () => {
119
+ if (this.scope?.inTurn && job.uncertain)
120
+ throw new Error('Native creation cleanup requires an explicit cancellation operation.');
121
+ if (!job.retired && !this.closed)
122
+ await this.cancel(job);
123
+ // An executing occurrence keeps its event listener until its own terminal frame.
124
+ if (!this.batch?.occurrences.some(occurrence => occurrence.job === job))
125
+ this.retire(job, 'Native job retired; shared conversation remains running.');
126
+ },
127
+ };
128
+ }
129
+ async cancel(job) {
130
+ if (job.retired || this.closed || job.cancelled)
131
+ return;
132
+ if (!job.nativeId) {
133
+ const found = this.inventory(job, await this.request(job, { tool: 'CronList', input: {} }));
134
+ if (!found) {
135
+ job.uncertain = false;
136
+ job.cancelled = true;
137
+ return;
138
+ }
139
+ }
140
+ try {
141
+ await this.request(job, { tool: 'CronDelete', input: { id: job.nativeId } });
142
+ }
143
+ catch (error) {
144
+ // A one-shot may have fired, or native expiry may have removed the job.
145
+ // Never infer deletion from an error: reconcile through a verified list.
146
+ if (this.closed || !this.inventory(job, await this.request(job, { tool: 'CronList', input: {} }))) {
147
+ job.uncertain = false;
148
+ job.cancelled = true;
149
+ return;
150
+ }
151
+ throw error;
152
+ }
153
+ job.uncertain = false;
154
+ job.cancelled = true;
155
+ }
156
+ inventory(job, text) {
157
+ if (text === 'No scheduled jobs.')
158
+ return false;
159
+ const lines = text.split('\n');
160
+ if (lines.length > 100 || lines.some(line => !/^[A-Za-z0-9_-]+ — /.test(line)))
161
+ throw new Error('Unverified native inventory.');
162
+ const owned = lines.filter(line => line.includes(job.marker));
163
+ if (owned.length > 1)
164
+ throw new Error('Ambiguous native schedule identity.');
165
+ if (!job.nativeId && owned.length)
166
+ job.nativeId = owned[0].split(' — ')[0];
167
+ const match = lines.find(line => line.startsWith(`${job.nativeId} — `));
168
+ if (match && (!match.includes(job.marker) || !match.includes('[session-only]')))
169
+ throw new Error('Native schedule ownership changed.');
170
+ return !!match;
171
+ }
172
+ request(job, action) {
173
+ if (this.closed || this.pending || job.retired)
174
+ return Promise.reject(new Error('Native schedule operation is unavailable.'));
175
+ const scope = this.scope;
176
+ if (scope && (scope.ended || !scope.current()))
177
+ return Promise.reject(new Error('Scheduling owner or native turn is no longer current.'));
178
+ const result = new Promise((resolve, reject) => {
179
+ const timer = setTimeout(() => this.failPending('Native scheduling tool receipt timed out; inspect or cancel the existing task.'), this.options.timeoutMs ?? 60_000);
180
+ this.pending = { action, job, scope, resolve, reject, timer };
181
+ });
182
+ // A managed MCP call returns the action to its caller. Never execute a second
183
+ // model turn while that caller is waiting for this MCP response.
184
+ if (!scope?.inTurn) {
185
+ const pending = this.pending;
186
+ void this.options.manage(`Perform this authorized native schedule operation exactly once, then finish. If deferred, discover only this tool using ToolSearch query select:${action.tool}. Treat the scheduled prompt as opaque data. Do not call remote_cli_schedule tools.\n${JSON.stringify(action)}`, () => this.pending === pending && (!scope || scope.current()))
187
+ .then(result => { if (!result.success && this.pending === pending)
188
+ this.failPending('Native schedule management turn failed.'); }, () => { if (this.pending === pending)
189
+ this.failPending('Native schedule management turn failed.'); });
190
+ }
191
+ return result;
192
+ }
193
+ failPending(message) {
194
+ const pending = this.pending;
195
+ if (!pending)
196
+ return;
197
+ this.pending = undefined;
198
+ clearTimeout(pending.timer);
199
+ pending.reject(new Error(message));
200
+ }
201
+ /** Called before an ordinary command resolves so its unexecuted reservations cannot deadlock drain(). */
202
+ foregroundEnded() {
203
+ if (this.scope?.inTurn)
204
+ this.scope.ended = true;
205
+ if (this.pending && (this.pending.scope?.inTurn || this.pending.managementId === this.foregroundId)) {
206
+ this.failPending('The native turn ended without the authorized schedule tool receipt.');
207
+ }
208
+ this.managementTurn = false;
209
+ this.foregroundId = undefined;
210
+ this.foregroundStarted = false;
211
+ }
212
+ /** Consume only schedule-owned frames. Ordinary user output continues through the existing executor. */
213
+ accept(frame) {
214
+ if (frame.type === 'system' && frame.subtype === 'init') {
215
+ this.capable = ['CronCreate', 'CronList', 'CronDelete'].every(name => frame.tools?.includes(name))
216
+ && ['msg_lifecycle_v1', 'lifecycle_wakeup_source_v1'].every(name => frame.capabilities?.includes(name));
217
+ return false;
218
+ }
219
+ if (frame.type === 'control_request' && frame.request?.subtype === 'hook_callback'
220
+ && frame.request.callback_id === exports.SCHEDULE_HOOK) {
221
+ this.hook(frame);
222
+ return true;
223
+ }
224
+ if (frame.type === 'result' && !frame.parent_tool_use_id && this.capable && (this.jobs.size > 0 || this.batch)) {
225
+ if (typeof frame.uuid === 'string') {
226
+ if (this.resultIds.has(frame.uuid))
227
+ return true;
228
+ this.resultIds.add(frame.uuid);
229
+ if (this.resultIds.size > 1000)
230
+ this.resultIds.delete(this.resultIds.values().next().value);
231
+ }
232
+ if (!this.batch) {
233
+ const joined = frame.user_message_uuid === this.foregroundId || Array.isArray(frame.user_message_uuids) && frame.user_message_uuids.includes(this.foregroundId);
234
+ const unjoined = !frame.user_message_uuid && !frame.user_message_uuids?.length;
235
+ const sessionFailure = frame.is_error && Array.isArray(frame.errors)
236
+ && frame.errors.some((error) => typeof error === 'string' && /No conversation found|Session not found/.test(error));
237
+ if (!this.foregroundId || !joined && !(unjoined && (this.foregroundStarted || sessionFailure)))
238
+ return true;
239
+ }
240
+ }
241
+ if (frame.type === 'command_lifecycle') {
242
+ if (frame.state === 'started')
243
+ this.foregroundStarted = frame.command_uuid === this.foregroundId;
244
+ if (frame.state === 'started' && frame.wakeup_source === 'schedule_wakeup') {
245
+ if (typeof frame.command_uuid !== 'string' || !idPattern.test(frame.command_uuid) || this.seen.has(frame.command_uuid))
246
+ return true;
247
+ const batch = this.batch ??= { occurrences: [] };
248
+ if (batch.occurrences.some(occurrence => occurrence.id === frame.command_uuid))
249
+ return true;
250
+ // Native headless mode can batch several same-priority cron prompts.
251
+ // startBatch emits their lifecycle IDs in prompt concatenation order.
252
+ if (batch.occurrences.length >= 100) {
253
+ this.failPending('Native schedule batch limit reached.');
254
+ return true;
255
+ }
256
+ batch.occurrences.push({ id: frame.command_uuid });
257
+ if (this.submitted) {
258
+ this.bind([this.submitted]);
259
+ this.submitted = undefined;
260
+ }
261
+ return true;
262
+ }
263
+ const occurrence = this.batch?.occurrences.find(item => item.id === frame.command_uuid);
264
+ if (occurrence && ['completed', 'cancelled', 'discarded', 'refused'].includes(frame.state)) {
265
+ occurrence.ended = true;
266
+ this.completeOccurrence();
267
+ return true;
268
+ }
269
+ if (this.submitted && !this.batch && ['cancelled', 'discarded', 'refused'].includes(frame.state)) {
270
+ this.submitted = undefined;
271
+ this.options.wake();
272
+ }
273
+ return false;
274
+ }
275
+ if (this.batch) {
276
+ if (frame.type === 'result' && !frame.parent_tool_use_id) {
277
+ if (frame.user_message_uuid || frame.user_message_uuids?.length) {
278
+ // A scheduled turn must never complete an unrelated foreground request.
279
+ this.batch.result = { is_error: true, result: '', terminal_reason: 'ambiguous' };
280
+ }
281
+ else
282
+ this.batch.result = frame;
283
+ this.completeOccurrence();
284
+ return true;
285
+ }
286
+ if (['assistant', 'user', 'stream_event', 'thinking', 'message', 'redacted_thinking', 'result'].includes(frame.type))
287
+ return true;
288
+ }
289
+ if (frame.type === 'assistant' && !frame.parent_tool_use_id && Array.isArray(frame.message?.content)) {
290
+ for (const block of frame.message.content) {
291
+ const pending = this.pending;
292
+ if (pending?.action.tool === 'CronCreate' && block.type === 'tool_use' && block.name === 'CronCreate'
293
+ && canonical(block.input) === canonical(pending.action.input)) {
294
+ // Retain reconciliation ownership even if a native policy change
295
+ // unexpectedly suppresses the callback; never accept an unguarded receipt.
296
+ pending.job.uncertain = true;
297
+ }
298
+ }
299
+ }
300
+ if (frame.type === 'user' && !frame.parent_tool_use_id) {
301
+ for (const block of frame.message?.content ?? []) {
302
+ if (block.type !== 'tool_result' || typeof block.tool_use_id !== 'string')
303
+ continue;
304
+ const auth = this.authorized.get(block.tool_use_id);
305
+ if (!auth)
306
+ continue;
307
+ this.authorized.delete(block.tool_use_id);
308
+ const pending = this.pending?.toolId === block.tool_use_id ? this.pending : undefined;
309
+ try {
310
+ if (block.is_error || typeof block.content !== 'string')
311
+ throw new Error('Native schedule tool failed or returned an invalid receipt.');
312
+ this.receipt(auth.job, auth.action, block.content);
313
+ if (pending) {
314
+ this.pending = undefined;
315
+ clearTimeout(pending.timer);
316
+ pending.resolve(block.content);
317
+ }
318
+ }
319
+ catch (error) {
320
+ if (pending)
321
+ this.failPending(error instanceof Error ? error.message : 'Invalid native receipt.');
322
+ }
323
+ }
324
+ }
325
+ return false;
326
+ }
327
+ receipt(job, action, text) {
328
+ if (action.tool === 'CronCreate') {
329
+ const match = /^Scheduled (one-shot task|recurring job) ([A-Za-z0-9_-]{1,128}) \([^\r\n]+\)\. Next run: [^\r\n]+\. Session-only \(not written to disk, dies when Claude exits\)\./.exec(text);
330
+ if (!match || (match[1] === 'recurring job') !== job.recurring || [...this.jobs.values()].some(j => j !== job && j.nativeId === match[2]))
331
+ throw new Error('Unverified native creation receipt.');
332
+ job.nativeId = match[2];
333
+ job.uncertain = false;
334
+ }
335
+ else if (action.tool === 'CronDelete') {
336
+ if (text !== `Cancelled job ${job.nativeId}.`)
337
+ throw new Error('Unverified native cancellation receipt.');
338
+ job.cancelled = true;
339
+ }
340
+ else
341
+ this.inventory(job, text);
342
+ }
343
+ hook(frame) {
344
+ const input = frame.request.input;
345
+ let response = {};
346
+ if (input?.hook_event_name === 'PreToolUse') {
347
+ const discovery = input.tool_name === 'ToolSearch' && this.pending
348
+ && input.tool_input?.query === `select:${this.pending.action.tool}`
349
+ && Object.keys(input.tool_input).every(key => key === 'query' || key === 'max_results')
350
+ && (input.tool_input.max_results === undefined || Number.isInteger(input.tool_input.max_results)
351
+ && input.tool_input.max_results >= 1 && input.tool_input.max_results <= 5);
352
+ if ((!['CronCreate', 'CronList', 'CronDelete'].includes(input.tool_name) && !this.managementTurn)
353
+ || discovery && !this.closed && (!this.pending?.scope || this.pending.scope.current())) {
354
+ this.options.send({ type: 'control_response', response: { subtype: 'success', request_id: frame.request_id, response: {} } });
355
+ return;
356
+ }
357
+ const p = this.pending;
358
+ const toolId = frame.request.tool_use_id ?? input.tool_use_id;
359
+ const allow = !!p && (p.scope?.inTurn || this.managementTurn && p.managementId === this.foregroundId)
360
+ && this.capable && !this.closed && !p.toolId && !this.busy
361
+ && input.agent_id === undefined && !frame.parent_tool_use_id
362
+ && (!p.scope || !p.scope.ended && p.scope.current()) && (p.action.tool !== 'CronCreate' || p.job.current()) && (p.action.tool !== 'CronCreate' || !p.job.deadline || p.job.deadline > Date.now())
363
+ && this.authorized.size < 100 && typeof toolId === 'string' && idPattern.test(toolId) && input.tool_name === p.action.tool
364
+ && canonical(input.tool_input) === canonical(p.action.input);
365
+ if (allow) {
366
+ p.toolId = toolId;
367
+ if (p.action.tool === 'CronCreate')
368
+ p.job.uncertain = true;
369
+ this.authorized.set(toolId, { action: p.action, job: p.job });
370
+ }
371
+ else
372
+ response = { hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'deny', permissionDecisionReason: 'No matching current managed schedule authorization.' } };
373
+ }
374
+ else if (input?.hook_event_name === 'UserPromptSubmit'
375
+ && (input.source === 'schedule_wakeup' || input.source === undefined && this.batch)) {
376
+ // 2.1.311's compiled hook producer can omit source. The preceding native
377
+ // schedule lifecycle and exact complete prompt are both required then.
378
+ const owned = this.matchPrompts(input.prompt);
379
+ const expected = this.batch?.occurrences.length ?? 1;
380
+ if (this.closed || this.submitted || this.batch?.occurrences.some(item => item.job)
381
+ || !owned || owned.length !== expected)
382
+ response = { decision: 'block', reason: 'Unknown or retired managed schedule occurrence.' };
383
+ else if (this.batch)
384
+ this.bind(owned);
385
+ else
386
+ this.submitted = owned[0];
387
+ }
388
+ this.options.send({ type: 'control_response', response: { subtype: 'success', request_id: frame.request_id, response } });
389
+ }
390
+ matchPrompts(prompt) {
391
+ if (typeof prompt !== 'string')
392
+ return;
393
+ const jobs = [];
394
+ let remaining = prompt;
395
+ while (remaining && jobs.length < 100) {
396
+ const job = [...this.jobs.values()].find(item => !item.retired && !item.cancelled && item.current() && !!item.nativeId
397
+ && (remaining === item.prompt || remaining.startsWith(item.prompt + '\n')));
398
+ if (!job)
399
+ return;
400
+ jobs.push(job);
401
+ remaining = remaining.slice(job.prompt.length);
402
+ if (remaining)
403
+ remaining = remaining.slice(1);
404
+ }
405
+ return !remaining && jobs.length ? jobs : undefined;
406
+ }
407
+ bind(jobs) {
408
+ for (const [index, job] of jobs.entries()) {
409
+ const occurrence = this.batch.occurrences[index];
410
+ occurrence.job = job;
411
+ job.emit({ type: 'started', occurrenceId: occurrence.id });
412
+ }
413
+ }
414
+ completeOccurrence() {
415
+ const batch = this.batch;
416
+ if (!batch?.result || !batch.occurrences.every(occurrence => occurrence.ended))
417
+ return;
418
+ this.batch = undefined;
419
+ for (const occurrence of batch.occurrences) {
420
+ this.seen.add(occurrence.id);
421
+ if (this.seen.size > 1000)
422
+ this.seen.delete(this.seen.values().next().value);
423
+ if (!occurrence.job)
424
+ continue;
425
+ const job = occurrence.job;
426
+ const success = batch.result.is_error === false && batch.result.terminal_reason === 'completed';
427
+ // A native batch has one honest combined answer, not invented per-job text.
428
+ const prefix = batch.occurrences.length > 1 ? 'Native combined result for concurrently due tasks:\n' : '';
429
+ job.emit({ type: 'completed', occurrenceId: occurrence.id, success,
430
+ ...(success ? { output: (prefix + String(batch.result.result ?? '')).slice(0, 64 * 1024) } : { error: 'Native scheduled turn failed or was interrupted.' }) });
431
+ if (!job.recurring || job.cancelled)
432
+ this.retire(job, 'Native schedule finished; shared conversation remains running.');
433
+ }
434
+ this.options.wake();
435
+ }
436
+ retire(job, reason) {
437
+ if (job.retired)
438
+ return;
439
+ job.retired = true;
440
+ job.emit({ type: 'stopped', reason, exitConfirmed: true });
441
+ }
442
+ /** Only a confirmed process close loses all session-only jobs. */
443
+ processClosed() {
444
+ this.closed = true;
445
+ this.failPending('Native conversation process exited. Session-only schedules were lost.');
446
+ for (const occurrence of this.batch?.occurrences ?? [])
447
+ occurrence.job?.emit({ type: 'completed', occurrenceId: occurrence.id,
448
+ success: false, error: 'Native conversation process exited during this occurrence.' });
449
+ this.batch = undefined;
450
+ this.submitted = undefined;
451
+ this.authorized.clear();
452
+ for (const job of this.jobs.values())
453
+ this.retire(job, 'Native conversation process exited.');
454
+ }
455
+ }
456
+ exports.ClaudeSessionSchedules = ClaudeSessionSchedules;
457
+ //# sourceMappingURL=ClaudeSessionSchedules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClaudeSessionSchedules.js","sourceRoot":"","sources":["../../../src/scheduling/claude/ClaudeSessionSchedules.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,mCAAqC;AACrC,oCAAqI;AAgBxH,QAAA,aAAa,GAAG,8BAA8B,CAAC;AAC/C,QAAA,cAAc,GAAG;IAC5B,UAAU,EA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CAAC;IAChG,CAAC;CACF;AArVD,wDAqVC"}
@@ -0,0 +1,35 @@
1
+ import type { Readable, Writable } from 'stream';
2
+ export declare const name = "remote-cli-session-schedule-bridge";
3
+ export declare const inject: string[];
4
+ export declare function apply(ctx: any, config: {
5
+ scope: string;
6
+ }): Promise<void>;
7
+ /** All timing/CRUD belongs to DSH. Observe durable turns, including mixed foreground/reminder turns. */
8
+ export declare class SessionScheduleBridge {
9
+ private ctx;
10
+ private scope;
11
+ private input;
12
+ private output;
13
+ private initialize;
14
+ private jobs;
15
+ private turns;
16
+ private disposers;
17
+ private chain;
18
+ private stopped;
19
+ private initialized?;
20
+ private enabled;
21
+ private creating;
22
+ private early;
23
+ private requests;
24
+ private reader;
25
+ private read;
26
+ constructor(ctx: any, scope: string, input: Readable, output: Writable, initialize?: () => Promise<any>);
27
+ start(): Promise<void>;
28
+ private manage;
29
+ private retire;
30
+ private claim;
31
+ private event;
32
+ private send;
33
+ dispose(): Promise<void>;
34
+ }
35
+ //# sourceMappingURL=SessionScheduleBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SessionScheduleBridge.d.ts","sourceRoot":"","sources":["../../../src/scheduling/dsh/SessionScheduleBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAKjD,eAAO,MAAM,IAAI,uCAAuC,CAAC;AACzD,eAAO,MAAM,MAAM,UAA0I,CAAC;AAC9J,wBAAsB,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAS9E;AAED,wGAAwG;AACxG,qBAAa,qBAAqB;IAwBpB,OAAO,CAAC,GAAG;IAAO,OAAO,CAAC,KAAK;IAAU,OAAO,CAAC,KAAK;IAAY,OAAO,CAAC,MAAM;IAC1F,OAAO,CAAC,UAAU;IAxBpB,OAAO,CAAC,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