@yu_robotics/remote-cli 1.6.231 → 1.6.234
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/client/MessageHandler.d.ts +23 -0
- package/dist/client/MessageHandler.d.ts.map +1 -1
- package/dist/client/MessageHandler.js +422 -8
- package/dist/client/MessageHandler.js.map +1 -1
- package/dist/client/WebSocketClient.d.ts +4 -1
- package/dist/client/WebSocketClient.d.ts.map +1 -1
- package/dist/client/WebSocketClient.js +39 -3
- package/dist/client/WebSocketClient.js.map +1 -1
- package/dist/delegation/DelegationBridge.d.ts +2 -13
- package/dist/delegation/DelegationBridge.d.ts.map +1 -1
- package/dist/delegation/DelegationBridge.js +3 -126
- package/dist/delegation/DelegationBridge.js.map +1 -1
- package/dist/delegation/contract.d.ts +3 -4
- package/dist/delegation/contract.d.ts.map +1 -1
- package/dist/delegation/contract.js +3 -2
- package/dist/delegation/contract.js.map +1 -1
- package/dist/delegation/mcpServer.js +3 -2
- package/dist/delegation/mcpServer.js.map +1 -1
- package/dist/delegation/piExtension.d.ts +3 -3
- package/dist/delegation/piExtension.d.ts.map +1 -1
- package/dist/delegation/piExtension.js +4 -4
- package/dist/delegation/piExtension.js.map +1 -1
- package/dist/executor/AcpExecutor.d.ts +1 -0
- package/dist/executor/AcpExecutor.d.ts.map +1 -1
- package/dist/executor/AcpExecutor.js +10 -4
- package/dist/executor/AcpExecutor.js.map +1 -1
- package/dist/executor/AgyExecutor.d.ts +1 -0
- package/dist/executor/AgyExecutor.d.ts.map +1 -1
- package/dist/executor/AgyExecutor.js +5 -0
- package/dist/executor/AgyExecutor.js.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.d.ts +1 -0
- package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
- package/dist/executor/ClaudePersistentExecutor.js +7 -1
- package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
- package/dist/executor/CodexAppServerExecutor.d.ts +1 -0
- package/dist/executor/CodexAppServerExecutor.d.ts.map +1 -1
- package/dist/executor/CodexAppServerExecutor.js +15 -8
- package/dist/executor/CodexAppServerExecutor.js.map +1 -1
- package/dist/executor/IExecutor.d.ts +2 -0
- package/dist/executor/IExecutor.d.ts.map +1 -1
- package/dist/executor/PiExecutor.d.ts +1 -0
- package/dist/executor/PiExecutor.d.ts.map +1 -1
- package/dist/executor/PiExecutor.js +5 -0
- package/dist/executor/PiExecutor.js.map +1 -1
- package/dist/executor/pi/PiClient.d.ts.map +1 -1
- package/dist/executor/pi/PiClient.js +1 -0
- package/dist/executor/pi/PiClient.js.map +1 -1
- package/dist/maintenance/release-notes.json +1 -1
- package/dist/managed/ManagedToolBridge.d.ts +14 -0
- package/dist/managed/ManagedToolBridge.d.ts.map +1 -0
- package/dist/managed/ManagedToolBridge.js +132 -0
- package/dist/managed/ManagedToolBridge.js.map +1 -0
- package/dist/managed/contract.d.ts +9 -0
- package/dist/managed/contract.d.ts.map +1 -0
- package/dist/managed/contract.js +7 -0
- package/dist/managed/contract.js.map +1 -0
- package/dist/managed/tools.d.ts +230 -0
- package/dist/managed/tools.d.ts.map +1 -0
- package/dist/managed/tools.js +23 -0
- package/dist/managed/tools.js.map +1 -0
- package/dist/scheduling/ClaudeNativeScheduleProvider.d.ts +19 -0
- package/dist/scheduling/ClaudeNativeScheduleProvider.d.ts.map +1 -0
- package/dist/scheduling/ClaudeNativeScheduleProvider.js +570 -0
- package/dist/scheduling/ClaudeNativeScheduleProvider.js.map +1 -0
- package/dist/scheduling/DshNativeScheduleProvider.d.ts +19 -0
- package/dist/scheduling/DshNativeScheduleProvider.d.ts.map +1 -0
- package/dist/scheduling/DshNativeScheduleProvider.js +470 -0
- package/dist/scheduling/DshNativeScheduleProvider.js.map +1 -0
- package/dist/scheduling/ScheduleCapabilities.d.ts +53 -0
- package/dist/scheduling/ScheduleCapabilities.d.ts.map +1 -0
- package/dist/scheduling/ScheduleCapabilities.js +65 -0
- package/dist/scheduling/ScheduleCapabilities.js.map +1 -0
- package/dist/scheduling/ScheduleCardService.d.ts +26 -0
- package/dist/scheduling/ScheduleCardService.d.ts.map +1 -0
- package/dist/scheduling/ScheduleCardService.js +109 -0
- package/dist/scheduling/ScheduleCardService.js.map +1 -0
- package/dist/scheduling/ScheduleCommand.d.ts +27 -0
- package/dist/scheduling/ScheduleCommand.d.ts.map +1 -0
- package/dist/scheduling/ScheduleCommand.js +173 -0
- package/dist/scheduling/ScheduleCommand.js.map +1 -0
- package/dist/scheduling/ScheduleDeliveryClient.d.ts +17 -0
- package/dist/scheduling/ScheduleDeliveryClient.d.ts.map +1 -0
- package/dist/scheduling/ScheduleDeliveryClient.js +109 -0
- package/dist/scheduling/ScheduleDeliveryClient.js.map +1 -0
- package/dist/scheduling/ScheduleService.d.ts +75 -0
- package/dist/scheduling/ScheduleService.d.ts.map +1 -0
- package/dist/scheduling/ScheduleService.js +749 -0
- package/dist/scheduling/ScheduleService.js.map +1 -0
- package/dist/scheduling/ScheduleToolScope.d.ts +55 -0
- package/dist/scheduling/ScheduleToolScope.d.ts.map +1 -0
- package/dist/scheduling/ScheduleToolScope.js +182 -0
- package/dist/scheduling/ScheduleToolScope.js.map +1 -0
- package/dist/scheduling/claude/rules.d.ts +8 -0
- package/dist/scheduling/claude/rules.d.ts.map +1 -0
- package/dist/scheduling/claude/rules.js +46 -0
- package/dist/scheduling/claude/rules.js.map +1 -0
- package/dist/scheduling/dsh/HostBridge.d.ts +96 -0
- package/dist/scheduling/dsh/HostBridge.d.ts.map +1 -0
- package/dist/scheduling/dsh/HostBridge.js +364 -0
- package/dist/scheduling/dsh/HostBridge.js.map +1 -0
- package/dist/scheduling/dsh/ScopePlugin.d.ts +9 -0
- package/dist/scheduling/dsh/ScopePlugin.d.ts.map +1 -0
- package/dist/scheduling/dsh/ScopePlugin.js +13 -0
- package/dist/scheduling/dsh/ScopePlugin.js.map +1 -0
- package/dist/scheduling/dsh/launch.d.ts +13 -0
- package/dist/scheduling/dsh/launch.d.ts.map +1 -0
- package/dist/scheduling/dsh/launch.js +58 -0
- package/dist/scheduling/dsh/launch.js.map +1 -0
- package/dist/scheduling/dsh/protocol.d.ts +28 -0
- package/dist/scheduling/dsh/protocol.d.ts.map +1 -0
- package/dist/scheduling/dsh/protocol.js +142 -0
- package/dist/scheduling/dsh/protocol.js.map +1 -0
- package/dist/scheduling/toolContract.d.ts +48 -0
- package/dist/scheduling/toolContract.d.ts.map +1 -0
- package/dist/scheduling/toolContract.js +24 -0
- package/dist/scheduling/toolContract.js.map +1 -0
- package/dist/scheduling/types.d.ts +79 -0
- package/dist/scheduling/types.d.ts.map +1 -0
- package/dist/scheduling/types.js +13 -0
- package/dist/scheduling/types.js.map +1 -0
- package/dist/types/ScheduleCards.d.ts +56 -0
- package/dist/types/ScheduleCards.d.ts.map +1 -0
- package/dist/types/ScheduleCards.js +3 -0
- package/dist/types/ScheduleCards.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -1
- package/native/prebuilds/darwin-arm64/managed_native.node +0 -0
- package/native/prebuilds/darwin-arm64/manifest.json +1 -1
- package/native/prebuilds/darwin-x64/managed_native.node +0 -0
- package/native/prebuilds/darwin-x64/manifest.json +1 -1
- package/native/prebuilds/win32-arm64/managed_native.node +0 -0
- package/native/prebuilds/win32-arm64/manifest.json +1 -1
- package/native/prebuilds/win32-x64/managed_native.node +0 -0
- package/native/prebuilds/win32-x64/manifest.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DshNativeScheduleProvider = void 0;
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
+
const crypto_1 = require("crypto");
|
|
9
|
+
const ManagedProcessGroups_1 = require("../executor/ManagedProcessGroups");
|
|
10
|
+
const ManagedSpawn_1 = require("../executor/ManagedSpawn");
|
|
11
|
+
const types_1 = require("./types");
|
|
12
|
+
const launch_1 = require("./dsh/launch");
|
|
13
|
+
const protocol_1 = require("./dsh/protocol");
|
|
14
|
+
function deferred() {
|
|
15
|
+
let resolve;
|
|
16
|
+
let reject;
|
|
17
|
+
const promise = new Promise((yes, no) => { resolve = yes; reject = no; });
|
|
18
|
+
void promise.catch(() => { });
|
|
19
|
+
return { promise, resolve, reject };
|
|
20
|
+
}
|
|
21
|
+
/** First-party DSH timing over ACP, with a process-owned host event/CRUD adapter. Never resumes a scope. */
|
|
22
|
+
class DshNativeScheduleProvider {
|
|
23
|
+
options;
|
|
24
|
+
constructor(options = {}) {
|
|
25
|
+
this.options = options;
|
|
26
|
+
}
|
|
27
|
+
async create(input, onEvent) {
|
|
28
|
+
input = { ...input, rule: { ...input.rule } };
|
|
29
|
+
const rule = (0, protocol_1.normalizeRule)(input.rule, (this.options.now ?? Date.now)());
|
|
30
|
+
if (!(0, protocol_1.identifier)(input.id) || !(0, protocol_1.validPrompt)(input.prompt))
|
|
31
|
+
throw new Error('Invalid DSH schedule ID or prompt.');
|
|
32
|
+
for (const value of [input.command, input.model, input.effort]) {
|
|
33
|
+
if (value !== undefined && (typeof value !== 'string' || !value.trim() || value.length > 1024 || /[\x00-\x1f]/.test(value))) {
|
|
34
|
+
throw new Error('Invalid DSH launch option.');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
let cwd;
|
|
38
|
+
try {
|
|
39
|
+
cwd = await promises_1.default.realpath(input.cwd);
|
|
40
|
+
if (!(await promises_1.default.stat(cwd)).isDirectory())
|
|
41
|
+
throw new Error();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
throw new Error('DSH schedule working directory is unavailable.');
|
|
45
|
+
}
|
|
46
|
+
const launch = await (this.options.launch ?? launch_1.createLaunch)();
|
|
47
|
+
let session;
|
|
48
|
+
try {
|
|
49
|
+
session = new DshSession({ ...input, rule, cwd }, onEvent, launch, this.options);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
await launch.dispose();
|
|
53
|
+
throw new Error('Native DSH schedule process could not start.');
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
await session.start();
|
|
57
|
+
return session;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
try {
|
|
61
|
+
await session.stop();
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
throw new types_1.NativeScheduleCleanupError('DSH creation failed; process-tree exit or owned storage cleanup is unconfirmed. Retry cleanup with this handle.', session);
|
|
65
|
+
}
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.DshNativeScheduleProvider = DshNativeScheduleProvider;
|
|
71
|
+
class DshSession {
|
|
72
|
+
input;
|
|
73
|
+
onEvent;
|
|
74
|
+
launch;
|
|
75
|
+
options;
|
|
76
|
+
jobId = '';
|
|
77
|
+
get nativeId() { return this.jobId; }
|
|
78
|
+
sessionId = '';
|
|
79
|
+
title = `remote-cli-${(0, crypto_1.randomUUID)()}`;
|
|
80
|
+
child;
|
|
81
|
+
groups = new ManagedProcessGroups_1.ManagedProcessGroups();
|
|
82
|
+
ready = deferred();
|
|
83
|
+
exited = deferred();
|
|
84
|
+
pending = new Map();
|
|
85
|
+
sequence = 0;
|
|
86
|
+
rpcId = 0;
|
|
87
|
+
commandId = 0;
|
|
88
|
+
closed = false;
|
|
89
|
+
leaderExited = false;
|
|
90
|
+
spawnFailed = false;
|
|
91
|
+
spawned = false;
|
|
92
|
+
stopping = false;
|
|
93
|
+
confirmed = false;
|
|
94
|
+
cancelRequested = false;
|
|
95
|
+
failure;
|
|
96
|
+
shutdown;
|
|
97
|
+
serial = Promise.resolve();
|
|
98
|
+
active;
|
|
99
|
+
lastOccurrence = '';
|
|
100
|
+
lastTurn = 0;
|
|
101
|
+
reader = new protocol_1.JsonLines(frame => this.frame(frame));
|
|
102
|
+
timeout;
|
|
103
|
+
shutdownTimeout;
|
|
104
|
+
constructor(input, onEvent, launch, options) {
|
|
105
|
+
this.input = input;
|
|
106
|
+
this.onEvent = onEvent;
|
|
107
|
+
this.launch = launch;
|
|
108
|
+
this.options = options;
|
|
109
|
+
this.timeout = options.managementTimeoutMs ?? 30_000;
|
|
110
|
+
this.shutdownTimeout = options.shutdownTimeoutMs ?? 2_000;
|
|
111
|
+
}
|
|
112
|
+
launchProcess() {
|
|
113
|
+
const { options, input, launch } = this;
|
|
114
|
+
try {
|
|
115
|
+
this.child = (options.spawn ?? ((command, args, opts) => (0, ManagedSpawn_1.spawnManaged)(true, command, args, opts)))(input.command ?? 'dsh', launch.args, {
|
|
116
|
+
cwd: input.cwd, env: launch.env, stdio: ['pipe', 'pipe', 'pipe'], shell: false, windowsHide: true,
|
|
117
|
+
detached: process.platform !== 'win32',
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
throw new Error('Native DSH schedule process could not start.');
|
|
122
|
+
}
|
|
123
|
+
if (!options.confirmProcessExit)
|
|
124
|
+
this.groups.track(this.child);
|
|
125
|
+
this.child.once('spawn', () => { this.spawned = true; });
|
|
126
|
+
this.child.on('error', () => {
|
|
127
|
+
this.spawnFailed = !this.spawned && this.child.pid === undefined;
|
|
128
|
+
this.fail('Native DSH process could not start or be controlled.');
|
|
129
|
+
});
|
|
130
|
+
this.child.once('exit', () => {
|
|
131
|
+
this.leaderExited = true;
|
|
132
|
+
// Closing owned pipes permits close/group proof even if a descendant inherited stdout.
|
|
133
|
+
if (!this.stopping)
|
|
134
|
+
this.fail('Native DSH process exited unexpectedly.');
|
|
135
|
+
this.child.stdout?.destroy();
|
|
136
|
+
this.child.stderr?.destroy();
|
|
137
|
+
});
|
|
138
|
+
this.child.once('close', () => {
|
|
139
|
+
this.closed = true;
|
|
140
|
+
this.exited.resolve();
|
|
141
|
+
this.rejectPending(new Error('Native DSH process closed.'));
|
|
142
|
+
if (this.active) {
|
|
143
|
+
const active = this.active;
|
|
144
|
+
this.active = undefined;
|
|
145
|
+
this.emit({ type: 'completed', occurrenceId: active.id, success: false, error: 'Native DSH exited before completion was confirmed.' });
|
|
146
|
+
}
|
|
147
|
+
if (!this.stopping)
|
|
148
|
+
this.fail('Native DSH process closed unexpectedly.');
|
|
149
|
+
});
|
|
150
|
+
if (!this.child.stdin || !this.child.stdout || !this.child.stderr)
|
|
151
|
+
throw new Error('Native DSH stdio is unavailable.');
|
|
152
|
+
this.child.stdout.on('data', (chunk) => {
|
|
153
|
+
if (this.closed)
|
|
154
|
+
return;
|
|
155
|
+
try {
|
|
156
|
+
this.reader.read(chunk);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
this.fail('Invalid or ambiguous DSH scheduling protocol.');
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
this.child.stdout.on('error', () => this.fail('Native DSH output failed.'));
|
|
163
|
+
this.child.stdin.on('error', () => this.fail('Native DSH input failed.'));
|
|
164
|
+
this.child.stderr.on('data', () => { });
|
|
165
|
+
this.child.stderr.on('error', () => { });
|
|
166
|
+
}
|
|
167
|
+
async start() {
|
|
168
|
+
this.launchProcess();
|
|
169
|
+
await this.bounded(this.ready.promise);
|
|
170
|
+
await this.rpc('initialize', { protocolVersion: 1, clientCapabilities: {} }, value => {
|
|
171
|
+
if (value.protocolVersion !== 1)
|
|
172
|
+
throw new Error();
|
|
173
|
+
});
|
|
174
|
+
await this.rpc('session/new', { cwd: this.input.cwd, mcpServers: [] }, value => {
|
|
175
|
+
if (!(0, protocol_1.identifier)(value.sessionId) || this.sessionId)
|
|
176
|
+
throw new Error();
|
|
177
|
+
this.sessionId = value.sessionId;
|
|
178
|
+
});
|
|
179
|
+
for (const [configId, value] of [['model', this.input.model], ['reasoning_effort', this.input.effort]]) {
|
|
180
|
+
if (value === undefined)
|
|
181
|
+
continue;
|
|
182
|
+
const selected = configId === 'reasoning_effort' && value === 'auto' ? '' : value;
|
|
183
|
+
await this.rpc('session/set_config_option', { sessionId: this.sessionId, configId, value: selected }, result => {
|
|
184
|
+
if (!Array.isArray(result.configOptions) || !result.configOptions.some(option => option.id === configId && option.currentValue === selected))
|
|
185
|
+
throw new Error();
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
await this.manage('bind', { cwd: this.input.cwd }, () => { });
|
|
189
|
+
await this.manage('create', { rule: this.input.rule, prompt: this.input.prompt, title: this.title }, result => {
|
|
190
|
+
if (this.jobId || !(0, protocol_1.identifier)(result.nativeId) || !(0, protocol_1.matchesRecord)(result.record, this.input.rule, this.input.prompt, this.title, result.nativeId))
|
|
191
|
+
throw new Error();
|
|
192
|
+
this.jobId = result.nativeId;
|
|
193
|
+
});
|
|
194
|
+
if (this.failure)
|
|
195
|
+
throw this.failure;
|
|
196
|
+
}
|
|
197
|
+
list() {
|
|
198
|
+
return this.enqueue(async () => {
|
|
199
|
+
if (this.confirmed)
|
|
200
|
+
return false;
|
|
201
|
+
this.assertLive();
|
|
202
|
+
const present = await this.manage('list', {}, result => {
|
|
203
|
+
if (result.nativeId !== this.jobId || !Array.isArray(result.records) || result.records.length > 1
|
|
204
|
+
|| result.records.some(row => !(0, protocol_1.matchesRecord)(row, this.input.rule, this.input.prompt, this.title, this.jobId)))
|
|
205
|
+
throw new Error();
|
|
206
|
+
return result.records.length === 1;
|
|
207
|
+
});
|
|
208
|
+
if (!present)
|
|
209
|
+
await this.stop();
|
|
210
|
+
return present;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
cancel() {
|
|
214
|
+
return this.enqueue(async () => {
|
|
215
|
+
if (this.confirmed)
|
|
216
|
+
return;
|
|
217
|
+
try {
|
|
218
|
+
this.assertLive();
|
|
219
|
+
this.cancelRequested = true;
|
|
220
|
+
await this.manage('cancel', {}, result => this.validateDeletion(result));
|
|
221
|
+
}
|
|
222
|
+
finally {
|
|
223
|
+
await this.stop();
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
validateDeletion(result) {
|
|
228
|
+
if ((this.jobId && result.nativeId !== this.jobId) || (!this.jobId && result.nativeId !== '' && !(0, protocol_1.identifier)(result.nativeId))
|
|
229
|
+
|| result.deleted !== true || result.remaining !== 0)
|
|
230
|
+
throw new Error();
|
|
231
|
+
}
|
|
232
|
+
stop() {
|
|
233
|
+
if (this.confirmed)
|
|
234
|
+
return Promise.resolve();
|
|
235
|
+
if (this.shutdown)
|
|
236
|
+
return this.shutdown;
|
|
237
|
+
this.stopping = true;
|
|
238
|
+
this.rejectPending(new Error('Native DSH schedule is stopping.'));
|
|
239
|
+
this.shutdown = this.shutdownProcess();
|
|
240
|
+
void this.shutdown.catch(() => {
|
|
241
|
+
this.shutdown = undefined;
|
|
242
|
+
this.emit({ type: 'stopped', reason: 'DSH process-tree exit or private storage cleanup is unconfirmed.', exitConfirmed: false });
|
|
243
|
+
});
|
|
244
|
+
return this.shutdown;
|
|
245
|
+
}
|
|
246
|
+
async shutdownProcess() {
|
|
247
|
+
if (!this.child) {
|
|
248
|
+
await this.launch.dispose();
|
|
249
|
+
this.confirmed = true;
|
|
250
|
+
this.emit({ type: 'stopped', reason: 'Native DSH launch did not start.', exitConfirmed: true });
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
// Best-effort native deletion precedes EOF. Even a broken protocol must retain process ownership.
|
|
254
|
+
if (!this.closed && !this.failure && this.sessionId) {
|
|
255
|
+
try {
|
|
256
|
+
await this.manage('cancel', {}, result => this.validateDeletion(result), true);
|
|
257
|
+
}
|
|
258
|
+
catch { /* Continue containment. */ }
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
this.child.stdin?.end();
|
|
262
|
+
}
|
|
263
|
+
catch { /* Continue containment. */ }
|
|
264
|
+
if (!await this.waitForClose()) {
|
|
265
|
+
this.signal('SIGTERM');
|
|
266
|
+
if (!await this.waitForClose()) {
|
|
267
|
+
this.signal('SIGKILL');
|
|
268
|
+
if (!await this.waitForClose())
|
|
269
|
+
throw new Error('DSH process exit is unconfirmed.');
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (this.options.confirmProcessExit)
|
|
273
|
+
await this.options.confirmProcessExit(this.child);
|
|
274
|
+
else if (!this.spawnFailed)
|
|
275
|
+
await this.groups.waitForExit();
|
|
276
|
+
await this.launch.dispose();
|
|
277
|
+
this.confirmed = true;
|
|
278
|
+
this.emit({ type: 'stopped', reason: this.failure?.message ?? 'Native DSH schedule stopped.', exitConfirmed: true });
|
|
279
|
+
}
|
|
280
|
+
signal(signal) {
|
|
281
|
+
try {
|
|
282
|
+
if (!this.options.spawn && process.platform === 'linux' && !this.leaderExited && this.child.pid)
|
|
283
|
+
process.kill(-this.child.pid, signal);
|
|
284
|
+
else
|
|
285
|
+
this.child.kill(signal);
|
|
286
|
+
}
|
|
287
|
+
catch { /* A signal attempt is never exit proof. */ }
|
|
288
|
+
}
|
|
289
|
+
async waitForClose() {
|
|
290
|
+
if (this.closed)
|
|
291
|
+
return true;
|
|
292
|
+
let timer;
|
|
293
|
+
try {
|
|
294
|
+
return await Promise.race([this.exited.promise.then(() => true), new Promise(resolve => {
|
|
295
|
+
timer = setTimeout(() => resolve(false), this.shutdownTimeout);
|
|
296
|
+
})]);
|
|
297
|
+
}
|
|
298
|
+
finally {
|
|
299
|
+
clearTimeout(timer);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
assertLive() {
|
|
303
|
+
if (this.failure)
|
|
304
|
+
throw this.failure;
|
|
305
|
+
if (this.stopping || this.closed)
|
|
306
|
+
throw new Error('Native DSH schedule is stopped.');
|
|
307
|
+
}
|
|
308
|
+
emit(event) {
|
|
309
|
+
try {
|
|
310
|
+
this.onEvent(event);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
if (!this.stopping)
|
|
314
|
+
this.fail('DSH schedule event delivery failed.');
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
fail(message) {
|
|
318
|
+
this.failure ??= new Error(message);
|
|
319
|
+
this.rejectPending(this.failure);
|
|
320
|
+
void this.stop().catch(() => { });
|
|
321
|
+
}
|
|
322
|
+
rejectPending(error) {
|
|
323
|
+
this.ready.reject(error);
|
|
324
|
+
for (const request of this.pending.values())
|
|
325
|
+
request.done.reject(error);
|
|
326
|
+
this.pending.clear();
|
|
327
|
+
}
|
|
328
|
+
enqueue(run) {
|
|
329
|
+
const next = this.serial.then(run);
|
|
330
|
+
this.serial = next.catch(() => { });
|
|
331
|
+
return next;
|
|
332
|
+
}
|
|
333
|
+
async bounded(work) {
|
|
334
|
+
let timer;
|
|
335
|
+
try {
|
|
336
|
+
return await Promise.race([work, new Promise((_, reject) => {
|
|
337
|
+
timer = setTimeout(() => reject(new Error('Native DSH schedule operation timed out.')), this.timeout);
|
|
338
|
+
})]);
|
|
339
|
+
}
|
|
340
|
+
finally {
|
|
341
|
+
clearTimeout(timer);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
send(frame) {
|
|
345
|
+
if (this.closed || !this.child.stdin?.writable)
|
|
346
|
+
throw new Error('Native DSH input is unavailable.');
|
|
347
|
+
const line = JSON.stringify(frame) + '\n';
|
|
348
|
+
if (Buffer.byteLength(line) > protocol_1.MAX_FRAME || this.child.stdin.writableLength > protocol_1.MAX_FRAME)
|
|
349
|
+
throw new Error('Native DSH input limit exceeded.');
|
|
350
|
+
this.child.stdin.write(line, error => { if (error)
|
|
351
|
+
this.fail('Native DSH input write failed.'); });
|
|
352
|
+
}
|
|
353
|
+
async request(key, frame, validate, allowStopping = false) {
|
|
354
|
+
if (!allowStopping)
|
|
355
|
+
this.assertLive();
|
|
356
|
+
const done = deferred();
|
|
357
|
+
this.pending.set(key, { done, validate });
|
|
358
|
+
try {
|
|
359
|
+
this.send(frame);
|
|
360
|
+
return await this.bounded(done.promise);
|
|
361
|
+
}
|
|
362
|
+
catch {
|
|
363
|
+
if (!this.stopping)
|
|
364
|
+
this.fail('Native DSH schedule operation failed or timed out.');
|
|
365
|
+
throw new Error('Native DSH schedule operation failed or timed out.');
|
|
366
|
+
}
|
|
367
|
+
finally {
|
|
368
|
+
this.pending.delete(key);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
rpc(method, params, validate) {
|
|
372
|
+
const id = ++this.rpcId;
|
|
373
|
+
return this.request(`rpc:${id}`, { jsonrpc: '2.0', id, method, params }, validate);
|
|
374
|
+
}
|
|
375
|
+
manage(operation, extras, validate, allowStopping = false) {
|
|
376
|
+
const requestId = ++this.commandId;
|
|
377
|
+
return this.request(`command:${requestId}`, { jsonrpc: '2.0', method: protocol_1.COMMAND, params: {
|
|
378
|
+
version: protocol_1.VERSION, scope: this.launch.scope, requestId, operation, sessionId: this.sessionId, ...extras,
|
|
379
|
+
} }, result => {
|
|
380
|
+
if (result.operation !== operation || result.sessionId !== this.sessionId)
|
|
381
|
+
throw new Error();
|
|
382
|
+
return validate(result);
|
|
383
|
+
}, allowStopping);
|
|
384
|
+
}
|
|
385
|
+
settle(key, value) {
|
|
386
|
+
const request = this.pending.get(key);
|
|
387
|
+
if (!request) {
|
|
388
|
+
if (this.stopping)
|
|
389
|
+
return;
|
|
390
|
+
throw new Error();
|
|
391
|
+
}
|
|
392
|
+
if (!(0, protocol_1.object)(value))
|
|
393
|
+
throw new Error();
|
|
394
|
+
const validated = request.validate(value);
|
|
395
|
+
this.pending.delete(key);
|
|
396
|
+
request.done.resolve(validated);
|
|
397
|
+
}
|
|
398
|
+
frame(frame) {
|
|
399
|
+
// Once provenance or transport integrity is lost, later frames cannot repair it.
|
|
400
|
+
// Keep the active occurrence for the confirmed-close failure path.
|
|
401
|
+
if (this.failure)
|
|
402
|
+
return;
|
|
403
|
+
if (frame.jsonrpc !== '2.0')
|
|
404
|
+
throw new Error();
|
|
405
|
+
if (frame.method === protocol_1.EVENT) {
|
|
406
|
+
const p = frame.params;
|
|
407
|
+
if (!(0, protocol_1.object)(p) || 'id' in frame || p.version !== protocol_1.VERSION || p.scope !== this.launch.scope || p.sequence !== this.sequence + 1)
|
|
408
|
+
throw new Error();
|
|
409
|
+
this.sequence = p.sequence;
|
|
410
|
+
if (p.kind === 'ready') {
|
|
411
|
+
if (this.sequence !== 1)
|
|
412
|
+
throw new Error();
|
|
413
|
+
this.ready.resolve();
|
|
414
|
+
}
|
|
415
|
+
else if (p.kind === 'fatal')
|
|
416
|
+
this.fail('Native DSH schedule bridge rejected ownership or protocol state.');
|
|
417
|
+
else if (p.kind === 'receipt')
|
|
418
|
+
this.settle(`command:${p.requestId}`, p);
|
|
419
|
+
else if (p.kind === 'started' || p.kind === 'completed')
|
|
420
|
+
this.occurrence(p);
|
|
421
|
+
else
|
|
422
|
+
throw new Error();
|
|
423
|
+
}
|
|
424
|
+
else if ('id' in frame && !('method' in frame)) {
|
|
425
|
+
if ('error' in frame)
|
|
426
|
+
throw new Error();
|
|
427
|
+
this.settle(`rpc:${frame.id}`, frame.result);
|
|
428
|
+
}
|
|
429
|
+
else if ('id' in frame) {
|
|
430
|
+
// Unattended execution never auto-grants unknown approvals or client-side execution.
|
|
431
|
+
if (frame.method === 'session/request_permission' && frame.params?.sessionId === this.sessionId) {
|
|
432
|
+
this.send({ jsonrpc: '2.0', id: frame.id, result: { outcome: { outcome: 'cancelled' } } });
|
|
433
|
+
}
|
|
434
|
+
else
|
|
435
|
+
this.send({ jsonrpc: '2.0', id: frame.id, error: { code: -32601, message: 'Unsupported unattended client request.' } });
|
|
436
|
+
}
|
|
437
|
+
else if (frame.method === 'session/update') {
|
|
438
|
+
if (frame.params?.sessionId !== this.sessionId)
|
|
439
|
+
throw new Error();
|
|
440
|
+
// Output belongs to the bridge's native turn, not to ACP chunk arrival order.
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
occurrence(p) {
|
|
444
|
+
if (!this.jobId || p.nativeId !== this.jobId || p.sessionId !== this.sessionId || !(0, protocol_1.identifier)(p.messageId)
|
|
445
|
+
|| !Number.isSafeInteger(p.turn) || p.turn < 1 || !(0, protocol_1.instant)(p.occurrenceAt))
|
|
446
|
+
throw new Error();
|
|
447
|
+
const id = `${p.nativeId}:${p.occurrenceAt}`;
|
|
448
|
+
if (p.kind === 'started') {
|
|
449
|
+
if (this.active || p.turn <= this.lastTurn || p.occurrenceAt <= this.lastOccurrence
|
|
450
|
+
|| (this.input.rule.kind === 'once' && p.occurrenceAt !== this.input.rule.at))
|
|
451
|
+
throw new Error();
|
|
452
|
+
this.lastTurn = p.turn;
|
|
453
|
+
this.lastOccurrence = p.occurrenceAt;
|
|
454
|
+
this.active = { id, turn: p.turn, messageId: p.messageId, occurrenceAt: p.occurrenceAt };
|
|
455
|
+
this.emit({ type: 'started', occurrenceId: id });
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
if (!this.active || this.active.id !== id || this.active.turn !== p.turn || this.active.messageId !== p.messageId
|
|
459
|
+
|| typeof p.success !== 'boolean' || typeof p.output !== 'string' || Buffer.byteLength(p.output) > protocol_1.MAX_OUTPUT
|
|
460
|
+
|| (p.error !== undefined && (typeof p.error !== 'string' || p.error.length > 256)))
|
|
461
|
+
throw new Error();
|
|
462
|
+
this.active = undefined;
|
|
463
|
+
this.emit({ type: 'completed', occurrenceId: id, success: p.success, output: p.output,
|
|
464
|
+
...(p.success ? {} : { error: 'Native DSH scheduled turn did not complete successfully.' }) });
|
|
465
|
+
if (this.input.rule.kind === 'once' && !this.cancelRequested && !this.stopping)
|
|
466
|
+
void this.stop().catch(() => { });
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
//# sourceMappingURL=DshNativeScheduleProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DshNativeScheduleProvider.js","sourceRoot":"","sources":["../../src/scheduling/DshNativeScheduleProvider.ts"],"names":[],"mappings":";;;;;;AACA,2DAA6B;AAC7B,mCAAoC;AACpC,2EAAwE;AACxE,2DAAwD;AACxD,mCACyE;AACzE,yCAA4D;AAC5D,6CAC+E;AAW/E,SAAS,QAAQ;I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
+
import type { BackendKey } from '../types/config';
|
|
2
|
+
/** Native timing AND an existing-transport result path are required for admission. */
|
|
3
|
+
export declare const NATIVE_SCHEDULE_CAPABILITIES: {
|
|
4
|
+
readonly claude: {
|
|
5
|
+
readonly label: "Claude";
|
|
6
|
+
readonly supported: true;
|
|
7
|
+
readonly detail: "One-shot and recurring cron; requires advertised native tools/lifecycle capabilities, unrestricted execution, and a compatible Router.";
|
|
8
|
+
};
|
|
9
|
+
readonly codex: {
|
|
10
|
+
readonly label: "Codex";
|
|
11
|
+
readonly supported: false;
|
|
12
|
+
readonly detail: "Codex 0.167.0 app-server delegates automation tools to its client; it has no native scheduled-job engine. In-turn sleep is not a managed schedule.";
|
|
13
|
+
};
|
|
14
|
+
readonly agy: {
|
|
15
|
+
readonly label: "AGY";
|
|
16
|
+
readonly supported: false;
|
|
17
|
+
readonly detail: "AGY 1.5.5 has native scheduling, but tested stream-json recurring results appeared only after another input, without separate occurrence completion.";
|
|
18
|
+
};
|
|
19
|
+
readonly dsh: {
|
|
20
|
+
readonly label: "DSH";
|
|
21
|
+
readonly supported: true;
|
|
22
|
+
readonly detail: "Native one-shot and recurring scheduling through a process-owned plugin overlay and ACP event adapter; isolated job storage is never automatically reopened.";
|
|
23
|
+
};
|
|
24
|
+
readonly kimi: {
|
|
25
|
+
readonly label: "Kimi";
|
|
26
|
+
readonly supported: false;
|
|
27
|
+
readonly detail: "Kimi 2.5.0 has native cron, but its ACP server filters output to the active client prompt and drops autonomous scheduled turns.";
|
|
28
|
+
};
|
|
29
|
+
readonly opencode: {
|
|
30
|
+
readonly label: "OpenCode";
|
|
31
|
+
readonly supported: false;
|
|
32
|
+
readonly detail: "OpenCode 1.19.5 has no built-in scheduler. Version 2.2.7 has native scheduling, but its ACP bridge closes root-output subscriptions after the client prompt ends.";
|
|
33
|
+
};
|
|
34
|
+
readonly pi: {
|
|
35
|
+
readonly label: "Pi";
|
|
36
|
+
readonly supported: false;
|
|
37
|
+
readonly detail: "Pi coding-agent 1.5.2 has no built-in scheduler in its CLI RPC runtime; the first-party durable timer harness is a separate runtime.";
|
|
38
|
+
};
|
|
39
|
+
readonly zcode: {
|
|
40
|
+
readonly label: "ZCode";
|
|
41
|
+
readonly supported: false;
|
|
42
|
+
readonly detail: "ZCode 3.17.2 / CLI 0.17.1 app-server delegates Cron management to its host; native timing and dispatch require the separate desktop scheduler and host services.";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export type NativeScheduleBackend = {
|
|
46
|
+
[Key in BackendKey]: typeof NATIVE_SCHEDULE_CAPABILITIES[Key]['supported'] extends true ? Key : never;
|
|
47
|
+
}[BackendKey];
|
|
48
|
+
export declare function isNativeScheduleBackend(value: unknown): value is NativeScheduleBackend;
|
|
49
|
+
/** Reject unsupported/unknown backends without falling back to another executor. */
|
|
50
|
+
export declare function assertNativeScheduleBackend(backend: string): asserts backend is NativeScheduleBackend;
|
|
51
|
+
/** Product capabilities are deliberately distinct from an available adapter. */
|
|
52
|
+
export declare const SCHEDULE_CAPABILITIES: string;
|
|
53
|
+
//# sourceMappingURL=ScheduleCapabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduleCapabilities.d.ts","sourceRoot":"","sources":["../../src/scheduling/ScheduleCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQlD,sFAAsF;AACtF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCkB,CAAC;AAE5D,MAAM,MAAM,qBAAqB,GAAG;KACjC,GAAG,IAAI,UAAU,GAAG,OAAO,4BAA4B,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,SAAS,IAAI,GAAG,GAAG,GAAG,KAAK;CACtG,CAAC,UAAU,CAAC,CAAC;AAEd,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAGtF;AAED,oFAAoF;AACpF,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,IAAI,qBAAqB,CAQrG;AAED,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,QAStB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SCHEDULE_CAPABILITIES = exports.NATIVE_SCHEDULE_CAPABILITIES = void 0;
|
|
4
|
+
exports.isNativeScheduleBackend = isNativeScheduleBackend;
|
|
5
|
+
exports.assertNativeScheduleBackend = assertNativeScheduleBackend;
|
|
6
|
+
/** Native timing AND an existing-transport result path are required for admission. */
|
|
7
|
+
exports.NATIVE_SCHEDULE_CAPABILITIES = {
|
|
8
|
+
claude: {
|
|
9
|
+
label: 'Claude', supported: true,
|
|
10
|
+
detail: 'One-shot and recurring cron; requires advertised native tools/lifecycle capabilities, unrestricted execution, and a compatible Router.',
|
|
11
|
+
},
|
|
12
|
+
codex: {
|
|
13
|
+
label: 'Codex', supported: false,
|
|
14
|
+
detail: 'Codex 0.167.0 app-server delegates automation tools to its client; it has no native scheduled-job engine. In-turn sleep is not a managed schedule.',
|
|
15
|
+
},
|
|
16
|
+
agy: {
|
|
17
|
+
label: 'AGY', supported: false,
|
|
18
|
+
detail: 'AGY 1.5.5 has native scheduling, but tested stream-json recurring results appeared only after another input, without separate occurrence completion.',
|
|
19
|
+
},
|
|
20
|
+
dsh: {
|
|
21
|
+
label: 'DSH', supported: true,
|
|
22
|
+
detail: 'Native one-shot and recurring scheduling through a process-owned plugin overlay and ACP event adapter; isolated job storage is never automatically reopened.',
|
|
23
|
+
},
|
|
24
|
+
kimi: {
|
|
25
|
+
label: 'Kimi', supported: false,
|
|
26
|
+
detail: 'Kimi 2.5.0 has native cron, but its ACP server filters output to the active client prompt and drops autonomous scheduled turns.',
|
|
27
|
+
},
|
|
28
|
+
opencode: {
|
|
29
|
+
label: 'OpenCode', supported: false,
|
|
30
|
+
detail: 'OpenCode 1.19.5 has no built-in scheduler. Version 2.2.7 has native scheduling, but its ACP bridge closes root-output subscriptions after the client prompt ends.',
|
|
31
|
+
},
|
|
32
|
+
pi: {
|
|
33
|
+
label: 'Pi', supported: false,
|
|
34
|
+
detail: 'Pi coding-agent 1.5.2 has no built-in scheduler in its CLI RPC runtime; the first-party durable timer harness is a separate runtime.',
|
|
35
|
+
},
|
|
36
|
+
zcode: {
|
|
37
|
+
label: 'ZCode', supported: false,
|
|
38
|
+
detail: 'ZCode 3.17.2 / CLI 0.17.1 app-server delegates Cron management to its host; native timing and dispatch require the separate desktop scheduler and host services.',
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
function isNativeScheduleBackend(value) {
|
|
42
|
+
return typeof value === 'string' && Object.hasOwn(exports.NATIVE_SCHEDULE_CAPABILITIES, value)
|
|
43
|
+
&& exports.NATIVE_SCHEDULE_CAPABILITIES[value].supported;
|
|
44
|
+
}
|
|
45
|
+
/** Reject unsupported/unknown backends without falling back to another executor. */
|
|
46
|
+
function assertNativeScheduleBackend(backend) {
|
|
47
|
+
if (!Object.hasOwn(exports.NATIVE_SCHEDULE_CAPABILITIES, backend)) {
|
|
48
|
+
throw new Error('Native scheduling is temporarily unsupported for this unknown backend. Use /schedule capabilities to inspect supported backends.');
|
|
49
|
+
}
|
|
50
|
+
const capability = exports.NATIVE_SCHEDULE_CAPABILITIES[backend];
|
|
51
|
+
if (!capability.supported) {
|
|
52
|
+
throw new Error(`${capability.label} scheduling is temporarily unsupported. ${capability.detail} Use /schedule capabilities to inspect supported backends.`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Product capabilities are deliberately distinct from an available adapter. */
|
|
56
|
+
exports.SCHEDULE_CAPABILITIES = [
|
|
57
|
+
'Native scheduling adapters:',
|
|
58
|
+
...Object.values(exports.NATIVE_SCHEDULE_CAPABILITIES).map(capability => `- ${capability.label}: ${capability.supported ? 'supported (runtime checks required)' : 'temporarily unsupported'}. ${capability.detail}`),
|
|
59
|
+
'',
|
|
60
|
+
'Each task uses a separate native session with its own prompt and captured working directory/model. Conversation history is not copied.',
|
|
61
|
+
'The native backend owns timing. No Router timer or periodic model polling is used.',
|
|
62
|
+
'Keep the CLI running. Restart reports interruption instead of recreating tasks. Claude jobs are session-only; DSH uses isolated native storage that is never automatically reopened.',
|
|
63
|
+
'Timing is approximate and recurring Claude jobs expire after seven days. Use an explicit IANA timezone for recurring cron.',
|
|
64
|
+
].join('\n');
|
|
65
|
+
//# sourceMappingURL=ScheduleCapabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScheduleCapabilities.js","sourceRoot":"","sources":["../../src/scheduling/ScheduleCapabilities.ts"],"names":[],"mappings":";;;AAgDA,0DAGC;AAGD,kEAQC;AAtDD,sFAAsF;AACzE,QAAA,4BAA4B,GAAG;IAC1C,MAAM,EAAE;QACN,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI;QAChC,MAAM,EAAE,wIAAwI;KACjJ;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK;QAChC,MAAM,EAAE,oJAAoJ;KAC7J;IACD,GAAG,EAAE;QACH,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK;QAC9B,MAAM,EAAE,sJAAsJ;KAC/J;IACD,GAAG,EAAE;QACH,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI;QAC7B,MAAM,EAAE,8JAA8J;KACvK;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK;QAC/B,MAAM,EAAE,iIAAiI;KAC1I;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK;QACnC,MAAM,EAAE,mKAAmK;KAC5K;IACD,EAAE,EAAE;QACF,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK;Q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