omp-superagent 0.1.11 → 0.1.15
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/DESIGN.md +21 -5
- package/README.ko.md +3 -1
- package/README.md +3 -1
- package/THIRD_PARTY_NOTICES.md +6 -0
- package/assets/architecture-dark.svg +4 -4
- package/assets/architecture.ko-dark.svg +4 -4
- package/assets/architecture.ko.svg +4 -4
- package/assets/architecture.mmd +5 -5
- package/assets/architecture.svg +4 -4
- package/config.example.json +1 -0
- package/docs/OPERATIONS.en.md +242 -31
- package/docs/OPERATIONS.md +225 -25
- package/docs/design/execution.md +161 -43
- package/docs/design/messaging.md +45 -9
- package/docs/releases/0.1.11.md +4 -2
- package/docs/releases/0.1.13.md +13 -0
- package/docs/releases/0.1.15.md +13 -0
- package/gateway/bin/omp-gateway-darwin-arm64 +0 -0
- package/gateway/bin/omp-gateway-darwin-x64 +0 -0
- package/gateway/bin/omp-gateway-linux-arm64 +0 -0
- package/gateway/bin/omp-gateway-linux-x64 +0 -0
- package/host-owner/bin/omp-host-owner-darwin-arm64 +0 -0
- package/host-owner/bin/omp-host-owner-darwin-x64 +0 -0
- package/host-owner/bin/omp-host-owner-linux-arm64 +0 -0
- package/host-owner/bin/omp-host-owner-linux-x64 +0 -0
- package/package.json +9 -3
- package/scripts/prepare-worker-memory.ts +37 -0
- package/scripts/upgrade-evidence-files.mjs +100 -0
- package/scripts/upgrade-evidence.mjs +192 -0
- package/scripts/upgrade-host-wire.mjs +162 -0
- package/skills/head/SKILL.md +22 -47
- package/skills/head/references/routing.md +11 -12
- package/skills/head/references/supervision.md +10 -14
- package/skills/lane/SKILL.md +14 -16
- package/skills/lane/references/workflow.md +14 -27
- package/src/cli.ts +59 -79
- package/src/config/config.ts +4 -0
- package/src/contracts.ts +34 -27
- package/src/cron/cron-jobs.ts +4 -3
- package/src/cron/cron-pr-intake.ts +1 -2
- package/src/extension.ts +57 -14
- package/src/gateway/gateway-client.ts +14 -12
- package/src/group/group-runner.ts +3 -2
- package/src/group-runner-extension.ts +7 -3
- package/src/host-extension.ts +109 -2
- package/src/host-sdk-helper.ts +12 -3
- package/src/lane/decision-tool.ts +2 -3
- package/src/lane/lane-report.ts +8 -30
- package/src/lane/lane-rows.ts +1 -1
- package/src/lane/workflow.ts +44 -3
- package/src/lane-extension.ts +5 -46
- package/src/messaging/discord-context.ts +8 -6
- package/src/omp/host-protocol.ts +4 -3
- package/src/omp/host.ts +24 -7
- package/src/omp/managed-super.ts +43 -27
- package/src/omp/native-sessions.ts +12 -0
- package/src/omp/worker-memory-import.ts +410 -0
- package/src/omp/worker-memory-sdk.ts +8 -0
- package/src/operator/setup.ts +8 -13
- package/src/operator/stop-lane.ts +25 -0
- package/src/pr/pr-github-schema.ts +9 -0
- package/src/pr/pr-github.ts +6 -2
- package/src/pr/pr-intake-automation.ts +11 -8
- package/src/pr/pr-intake-fix.ts +2 -5
- package/src/pr/pr-intake-review.ts +7 -7
- package/src/routing/topic-history.ts +2 -2
- package/src/runtime/controller.ts +444 -408
- package/src/runtime/head-recovery.ts +7 -7
- package/src/runtime/worker-memory.ts +156 -0
- package/src/storage/deferred-routing.ts +1 -7
- package/src/storage/store.ts +441 -375
- package/src/worker/worker-host.ts +3 -2
- package/src/worker/worker-ledger.ts +20 -11
- package/src/worker/worker-memory-page.ts +83 -0
- package/src/worker/worker-memory-proofs.ts +260 -0
- package/src/worker/worker-memory-source.ts +305 -0
- package/src/worker/worker-memory-storage.ts +130 -0
- package/src/worker/worker-profile.ts +2 -0
- package/src/worker/worker-repository.ts +92 -7
- package/src/worker/worker-request.ts +1 -0
- package/src/worker/worker-service.ts +25 -8
- package/src/worker/worker-wire.ts +20 -6
package/src/cli.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { inspectInstalledOmp } from "./omp/installed-omp";
|
|
|
8
8
|
import { requireHostOwner } from "./omp/host-owner-path";
|
|
9
9
|
import { loadCredentials } from "./config/credentials";
|
|
10
10
|
import { WORKFLOW_NAMES, type Lane } from "./contracts";
|
|
11
|
-
import type { HostConnection } from "./omp/host";
|
|
12
11
|
import { readLaneRows } from "./lane/lane-rows";
|
|
13
12
|
|
|
14
13
|
// Keep Host/SDK imports out of setup, doctor and command registration:
|
|
@@ -155,13 +154,28 @@ Alternative: Discord voice with separately billed OpenAI Live API (no Codex logi
|
|
|
155
154
|
Full guide: ${join(import.meta.dir, "../docs/discord-voice.md")}
|
|
156
155
|
`;
|
|
157
156
|
|
|
157
|
+
function printJson(value: unknown): void {
|
|
158
|
+
console.log(JSON.stringify(value, null, 2));
|
|
159
|
+
}
|
|
160
|
+
|
|
158
161
|
function laneRows(stateDir: string): Lane[] {
|
|
159
162
|
const path = join(stateDir, "coordination.sqlite");
|
|
160
163
|
if (!existsSync(path)) return [];
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
using db = new Database(path, { readonly: true });
|
|
165
|
+
return readLaneRows(db);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function commandFlags(args: string[], usage: string, toggle: string, valueFlags: string[]) {
|
|
169
|
+
const values = new Map<string, string>();
|
|
170
|
+
let enabled = false;
|
|
171
|
+
for (let i = 0; i < args.length; i++) {
|
|
172
|
+
const flag = args[i];
|
|
173
|
+
if (flag === toggle && !enabled) { enabled = true; continue; }
|
|
174
|
+
const value = args[++i];
|
|
175
|
+
if (!valueFlags.includes(flag) || values.has(flag) || !value || value.startsWith("-")) throw new Error(usage);
|
|
176
|
+
values.set(flag, value);
|
|
177
|
+
}
|
|
178
|
+
return { enabled, values };
|
|
165
179
|
}
|
|
166
180
|
|
|
167
181
|
async function workerCommand(args: string[]): Promise<void> {
|
|
@@ -175,26 +189,15 @@ async function workerCommand(args: string[]): Promise<void> {
|
|
|
175
189
|
const usage = "Usage: omp-sa worker add user@host[:port] [--config FILE] [--default [--local-repo PATH]]";
|
|
176
190
|
const [destination, ...flags] = operands;
|
|
177
191
|
if (!destination || destination.startsWith("-")) throw new Error(usage);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
let preferred = false;
|
|
181
|
-
for (let index = 0; index < flags.length; index++) {
|
|
182
|
-
const flag = flags[index];
|
|
183
|
-
if (flag === "--default" && !preferred) { preferred = true; continue; }
|
|
184
|
-
const value = flags[index + 1];
|
|
185
|
-
if (!value || value.startsWith("-")) throw new Error(usage);
|
|
186
|
-
if (flag === "--config" && !configPath) configPath = value;
|
|
187
|
-
else if (flag === "--local-repo" && !localRepo) localRepo = value;
|
|
188
|
-
else throw new Error(usage);
|
|
189
|
-
index++;
|
|
190
|
-
}
|
|
192
|
+
const { enabled: preferred, values } = commandFlags(flags, usage, "--default", ["--config", "--local-repo"]);
|
|
193
|
+
const localRepo = values.get("--local-repo");
|
|
191
194
|
if (localRepo && !preferred) throw new Error(usage);
|
|
192
|
-
const config = await loadConfig(
|
|
195
|
+
const config = await loadConfig(values.get("--config") ?? "config.local.json");
|
|
193
196
|
const { addWorker } = await import("./worker/worker-registration");
|
|
194
197
|
const { workerDescribe } = await import("./worker/worker-wire");
|
|
195
198
|
const result = await addWorker({ destination, stateDir: config.stateDir,
|
|
196
199
|
...(preferred ? { defaultRepositoryRoot: localRepo ?? config.headCwd } : {}) }, workerDescribe);
|
|
197
|
-
|
|
200
|
+
printJson(result);
|
|
198
201
|
if (result.status === "pending" && result.verificationError) process.exitCode = 1;
|
|
199
202
|
return;
|
|
200
203
|
}
|
|
@@ -212,10 +215,10 @@ async function workerCommand(args: string[]): Promise<void> {
|
|
|
212
215
|
const { workerInventory, workerDoctor } = await import("./worker/worker-doctor");
|
|
213
216
|
if (destination) {
|
|
214
217
|
const report = await workerDoctor(stateDir, destination);
|
|
215
|
-
|
|
218
|
+
printJson(report);
|
|
216
219
|
if (report.status === "blocked") process.exitCode = 1;
|
|
217
220
|
} else {
|
|
218
|
-
|
|
221
|
+
printJson(workerInventory(stateDir));
|
|
219
222
|
}
|
|
220
223
|
return;
|
|
221
224
|
}
|
|
@@ -240,7 +243,7 @@ async function workerCommand(args: string[]): Promise<void> {
|
|
|
240
243
|
activeManagedUlw();
|
|
241
244
|
const { executable } = await inspectInstalledOmp(["omp"]);
|
|
242
245
|
const { workerId, stateDir, repos, capacity } = await enrollWorker({ home: homedir(), headKey: publicKey, repositories, executable });
|
|
243
|
-
|
|
246
|
+
printJson({ status: "initialized", workerId, stateDir, repos, capacity });
|
|
244
247
|
return;
|
|
245
248
|
}
|
|
246
249
|
case "serve": {
|
|
@@ -264,39 +267,37 @@ export async function main(args = process.argv.slice(2)): Promise<void> {
|
|
|
264
267
|
const [command] = args;
|
|
265
268
|
if (!["setup", "start", "install", "uninstall", "status", "group", "stop", "doctor", "discord-commands", "telegram-commands", "slack-commands"].includes(command!)) throw new Error(`Unknown command: ${command}`);
|
|
266
269
|
const configAt = args.indexOf("--config");
|
|
267
|
-
|
|
268
|
-
if (
|
|
269
|
-
|
|
270
|
+
const configFile = args[configAt + 1];
|
|
271
|
+
if (configAt < 0 || !configFile) throw new Error("--config FILE is required");
|
|
272
|
+
const optionalTargetArgs = (configAt === 1 && args.length === 3) ||
|
|
273
|
+
(configAt === 2 && args.length === 4 && !args[1]?.startsWith("-"));
|
|
274
|
+
if (command === "stop" && !optionalTargetArgs)
|
|
270
275
|
throw new Error("Usage: omp-sa stop [main|LANE_ID] --config FILE");
|
|
271
276
|
if (command === "install" || command === "uninstall") {
|
|
272
|
-
if (args.length !== 3 || configAt !== 1 ||
|
|
277
|
+
if (args.length !== 3 || configAt !== 1 || configFile.startsWith("-"))
|
|
273
278
|
throw new Error(`Usage: ${command} --config FILE`);
|
|
274
|
-
const config = await loadConfig(
|
|
279
|
+
const config = await loadConfig(configFile);
|
|
275
280
|
const { installAutostart, uninstallAutostart } = await import("./operator/autostart");
|
|
276
|
-
|
|
281
|
+
printJson(await (command === "install" ? installAutostart(config) : uninstallAutostart(config)));
|
|
277
282
|
return;
|
|
278
283
|
}
|
|
279
284
|
if (command === "setup") {
|
|
280
285
|
const { setup } = await import("./operator/setup");
|
|
281
|
-
await setup(
|
|
286
|
+
await setup(configFile);
|
|
282
287
|
return;
|
|
283
288
|
}
|
|
284
289
|
if (command === "discord-commands" || command === "telegram-commands" || command === "slack-commands") {
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const flag = args[index]!;
|
|
294
|
-
if (flag === "--apply" && !apply) { apply = true; continue; }
|
|
295
|
-
const value = args[index + 1];
|
|
296
|
-
if (!valueFlags.has(flag) || values.has(flag) || !value || value.startsWith("-")) throw new Error(usage);
|
|
297
|
-
values.set(flag, value);
|
|
298
|
-
index++;
|
|
290
|
+
const valueFlags = ["--config"];
|
|
291
|
+
let extra = "";
|
|
292
|
+
if (command === "telegram-commands") {
|
|
293
|
+
valueFlags.push("--language");
|
|
294
|
+
extra = " [--language CODE]";
|
|
295
|
+
} else if (command === "slack-commands") {
|
|
296
|
+
valueFlags.push("--manifest-token-env");
|
|
297
|
+
extra = " --manifest-token-env NAME";
|
|
299
298
|
}
|
|
299
|
+
const usage = `Usage: ${command} --config FILE${extra} [--apply]`;
|
|
300
|
+
const { enabled: apply, values } = commandFlags(args.slice(1), usage, "--apply", valueFlags);
|
|
300
301
|
const configPath = values.get("--config");
|
|
301
302
|
const manifestTokenEnv = values.get("--manifest-token-env");
|
|
302
303
|
if (!configPath || command === "slack-commands" && !manifestTokenEnv) throw new Error(usage);
|
|
@@ -312,17 +313,15 @@ export async function main(args = process.argv.slice(2)): Promise<void> {
|
|
|
312
313
|
const { registerSlackCommands } = await import("./messaging/slack-command-registration");
|
|
313
314
|
report = await registerSlackCommands(config, { apply, manifestTokenEnv: manifestTokenEnv! });
|
|
314
315
|
}
|
|
315
|
-
|
|
316
|
+
printJson(report);
|
|
316
317
|
if (report && typeof report === "object" && "status" in report && report.status === "blocked") process.exitCode = 1;
|
|
317
318
|
return;
|
|
318
319
|
}
|
|
319
|
-
const config = await loadConfig(
|
|
320
|
+
const config = await loadConfig(configFile);
|
|
320
321
|
if (command === "group") {
|
|
321
|
-
if (!
|
|
322
|
-
throw new Error("Usage: group [REQUEST_ID] --config FILE");
|
|
323
|
-
}
|
|
322
|
+
if (!optionalTargetArgs) throw new Error("Usage: group [REQUEST_ID] --config FILE");
|
|
324
323
|
const { groupRequests } = await import("./group/group-access");
|
|
325
|
-
|
|
324
|
+
printJson(groupRequests(config.stateDir, configAt === 2 ? args[1] : undefined));
|
|
326
325
|
return;
|
|
327
326
|
}
|
|
328
327
|
const target = args[1] && !args[1]!.startsWith("-") ? args[1]! : "main";
|
|
@@ -332,7 +331,7 @@ export async function main(args = process.argv.slice(2)): Promise<void> {
|
|
|
332
331
|
loadCredentials(config);
|
|
333
332
|
const omp = await inspectInstalledOmp(config.command, credentialEnvNames(config));
|
|
334
333
|
const memory = await inspectManagedMemory(config);
|
|
335
|
-
|
|
334
|
+
printJson({
|
|
336
335
|
config: config.path, command: config.command, headCwd: config.headCwd,
|
|
337
336
|
omp, hostOwnerExecutable: await requireHostOwner(), gatewayExecutable: await requireGateway(), nativeTuiAttach: false,
|
|
338
337
|
maxHosts: config.maxHosts, maxSubagents: config.maxSubagents,
|
|
@@ -341,7 +340,7 @@ export async function main(args = process.argv.slice(2)): Promise<void> {
|
|
|
341
340
|
memory,
|
|
342
341
|
...(memory.status === "enabled" ? {} : { memoryBlock: memoryBlockReason(memory) }),
|
|
343
342
|
messengersActivated: false,
|
|
344
|
-
}
|
|
343
|
+
});
|
|
345
344
|
if (memory.status !== "enabled") process.exitCode = 1;
|
|
346
345
|
return;
|
|
347
346
|
}
|
|
@@ -350,7 +349,7 @@ export async function main(args = process.argv.slice(2)): Promise<void> {
|
|
|
350
349
|
const { autostartStatus } = await import("./operator/autostart");
|
|
351
350
|
const { listWorkers } = await import("./worker/worker-registration");
|
|
352
351
|
const { lanePlacement } = await import("./lane/lane-rows");
|
|
353
|
-
|
|
352
|
+
printJson({
|
|
354
353
|
gateway: await gatewayStatus(config),
|
|
355
354
|
autostart: await autostartStatus(config),
|
|
356
355
|
main: { socketPath: hostPaths(config, "main").socketPath },
|
|
@@ -363,7 +362,7 @@ export async function main(args = process.argv.slice(2)): Promise<void> {
|
|
|
363
362
|
placement: lanePlacement(l),
|
|
364
363
|
})),
|
|
365
364
|
note: "Gateway/head readiness is live when reachable. Lane records are not a completion guarantee; workers are last verified, not live probes.",
|
|
366
|
-
}
|
|
365
|
+
});
|
|
367
366
|
return;
|
|
368
367
|
}
|
|
369
368
|
if (command === "stop") {
|
|
@@ -375,28 +374,9 @@ export async function main(args = process.argv.slice(2)): Promise<void> {
|
|
|
375
374
|
}
|
|
376
375
|
const lane = laneRows(config.stateDir).find(record => record.id === target);
|
|
377
376
|
if (!lane) throw new Error("Unknown managed lane");
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
const { lookupWorker, remoteLanePaths, workerConnect, workerRef } = await import("./worker/worker-wire");
|
|
382
|
-
const paths = remoteLanePaths(remote, lane.id);
|
|
383
|
-
if (lane.pid === null || !lane.sessionId || lane.sessionFile !== paths.sessionFile || lane.socketPath !== paths.socketPath)
|
|
384
|
-
throw new Error("Remote lane has no recorded Host identity eligible for shutdown");
|
|
385
|
-
host = await workerConnect(await lookupWorker(config.stateDir, remote), workerRef(lane));
|
|
386
|
-
} else {
|
|
387
|
-
const { connect } = await import("./omp/host");
|
|
388
|
-
host = await connect(hostPaths(config, target).socketPath);
|
|
389
|
-
}
|
|
390
|
-
try {
|
|
391
|
-
if (remote) {
|
|
392
|
-
const state = await host.client.getState();
|
|
393
|
-
if (state.hostPid !== lane.pid || state.sessionId !== lane.sessionId || state.sessionFile !== lane.sessionFile)
|
|
394
|
-
throw new Error("Remote Host identity no longer matches the recorded lane; shutdown was not sent");
|
|
395
|
-
}
|
|
396
|
-
const response = await host.request({ type: "shutdown_host" });
|
|
397
|
-
if (!response.success) throw new Error(response.error ?? "Host refused shutdown");
|
|
398
|
-
console.log(`Host ${target} accepted graceful shutdown.`);
|
|
399
|
-
} finally { await host.close(); }
|
|
377
|
+
const { stopManagedLane } = await import("./operator/stop-lane");
|
|
378
|
+
await stopManagedLane(config, lane);
|
|
379
|
+
console.log(`Host ${target} accepted graceful shutdown.`);
|
|
400
380
|
return;
|
|
401
381
|
}
|
|
402
382
|
if (target !== "main") {
|
|
@@ -409,9 +389,9 @@ export async function main(args = process.argv.slice(2)): Promise<void> {
|
|
|
409
389
|
const { gatewayPaths } = await import("./gateway/gateway-protocol");
|
|
410
390
|
const { launchGateway } = await import("./gateway/gateway-native");
|
|
411
391
|
const status = await launchGateway(config);
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
note: "Gateway owns messenger transports. Explicit start may return while initialization is checking/running or blocked. head.ready requires verified native high/middle/low presets; head.initialization reports setup/recovery state separately from approval-reconciled intake readiness. Ordinary input remains durably queued until initialization completes." }
|
|
392
|
+
const paths = gatewayPaths(config);
|
|
393
|
+
printJson({ ...status, gatewaySocketPath: paths.socketPath, gatewayLogPath: paths.logPath,
|
|
394
|
+
note: "Gateway owns messenger transports. Explicit start may return while initialization is checking/running or blocked. head.ready requires verified native high/middle/low presets; head.initialization reports setup/recovery state separately from approval-reconciled intake readiness. Ordinary input remains durably queued until initialization completes." });
|
|
415
395
|
}
|
|
416
396
|
|
|
417
397
|
if (import.meta.main) {
|
package/src/config/config.ts
CHANGED
|
@@ -73,6 +73,7 @@ export interface Config {
|
|
|
73
73
|
maxSubagents: number;
|
|
74
74
|
idleMs: number;
|
|
75
75
|
readonly headIdleMs?: number;
|
|
76
|
+
readonly remoteMemorySync?: boolean;
|
|
76
77
|
model?: string;
|
|
77
78
|
discord?: DiscordConfig;
|
|
78
79
|
telegram?: TelegramConfig;
|
|
@@ -243,6 +244,8 @@ export function parseConfig(value: unknown, path: string): Config {
|
|
|
243
244
|
const editProgressInPlace = discord?.editProgressInPlace;
|
|
244
245
|
if (editProgressInPlace !== undefined && typeof editProgressInPlace !== "boolean")
|
|
245
246
|
throw new Error("discord.editProgressInPlace must be a boolean");
|
|
247
|
+
if (raw.remoteMemorySync !== undefined && typeof raw.remoteMemorySync !== "boolean")
|
|
248
|
+
throw new Error("remoteMemorySync must be a boolean");
|
|
246
249
|
const voice = discord?.voice === undefined ? undefined : record(discord.voice, "discord.voice");
|
|
247
250
|
let voiceConfig: DiscordVoiceConfig | undefined;
|
|
248
251
|
if (voice) {
|
|
@@ -286,6 +289,7 @@ export function parseConfig(value: unknown, path: string): Config {
|
|
|
286
289
|
maxSubagents,
|
|
287
290
|
idleMs: integer(raw.idleMs, "idleMs", 0),
|
|
288
291
|
headIdleMs: raw.headIdleMs === undefined ? DEFAULT_HEAD_IDLE_MS : integer(raw.headIdleMs, "headIdleMs", 0),
|
|
292
|
+
...(raw.remoteMemorySync === true && { remoteMemorySync: true }),
|
|
289
293
|
...(raw.model === undefined ? {} : { model: text(raw.model, "model") }),
|
|
290
294
|
...(discord ? { discord: {
|
|
291
295
|
tokenEnv: tokenEnv(discord.tokenEnv, "discord.tokenEnv"),
|
package/src/contracts.ts
CHANGED
|
@@ -57,8 +57,10 @@ export function deferredRecoveryCandidate(text: string) {
|
|
|
57
57
|
return { kind: "lane-stop", laneId: argument } as const;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
export
|
|
60
|
+
/** Reserved legacy synthetic identities; never a source of work or authority. */
|
|
61
|
+
export function isRetiredScopeInput(id: string): boolean {
|
|
62
|
+
return id.startsWith("scope-review:") || id.startsWith("handoff:scope-review:");
|
|
63
|
+
}
|
|
62
64
|
|
|
63
65
|
/** Exact successor generation reserved when a submitted card is authorized to restore its original lane session. */
|
|
64
66
|
export const laneModelPickerRestoreKey = (sourceId: string) => `lane-model:picker-restore:${sourceId}`;
|
|
@@ -304,7 +306,7 @@ export interface OutputRecord {
|
|
|
304
306
|
sourceId: string;
|
|
305
307
|
route: Route;
|
|
306
308
|
/** Durable original owner message, only in the same physical conversation. */
|
|
307
|
-
replyTo?: MessageReference;
|
|
309
|
+
replyTo?: MessageReference & { readonly requireExisting?: true };
|
|
308
310
|
/** Discord status message replaced in place; fixed when the output is claimed. */
|
|
309
311
|
readonly editOf?: MessageReference;
|
|
310
312
|
/** Initial Discord status message; overflow falls back to one attachment instead of multi-message split. */
|
|
@@ -318,24 +320,12 @@ export interface OutputRecord {
|
|
|
318
320
|
}
|
|
319
321
|
|
|
320
322
|
export type SettlementOutput = Pick<OutputRecord, "id" | "text" | "picker"> & {
|
|
323
|
+
/** Physically distinct Discord HEAD steers proved to precede this shared answer. */
|
|
324
|
+
readonly discordHeadFollowups?: readonly string[];
|
|
321
325
|
/** Controller-only lane failure routing, never derived from output text. */
|
|
322
326
|
readonly laneFailure?: "quota" | "recover";
|
|
323
|
-
/** Controller-verified clean native settlement of a solo scope-review admission. */
|
|
324
|
-
readonly scopeReviewEligible?: boolean;
|
|
325
327
|
};
|
|
326
328
|
|
|
327
|
-
export interface ScopeReview {
|
|
328
|
-
readonly lane: Lane;
|
|
329
|
-
readonly original: InputRecord;
|
|
330
|
-
readonly handoff: InputRecord;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/** Controller-proven successful native report, with its exact own approval if one was required. */
|
|
334
|
-
export interface ScopeReviewNativeProof {
|
|
335
|
-
readonly toolCallId: string;
|
|
336
|
-
readonly approvalId?: string;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
329
|
export interface LaneRecoveryScope {
|
|
340
330
|
readonly lane: Lane;
|
|
341
331
|
readonly failed: InputRecord;
|
|
@@ -398,6 +388,11 @@ export interface HeadRecoveryEffect {
|
|
|
398
388
|
state: string;
|
|
399
389
|
}
|
|
400
390
|
|
|
391
|
+
/** A known failure is terminal; an unrecognized state is not evidence of settlement. */
|
|
392
|
+
export function headRecoveryEffectsSettled(effects: readonly HeadRecoveryEffect[]): boolean {
|
|
393
|
+
return effects.every(({ state }) => state === "sent" || state === "complete" || state === "failed");
|
|
394
|
+
}
|
|
395
|
+
|
|
401
396
|
/** Ordered HEAD receipts for owner inputs still waiting for topic routing. */
|
|
402
397
|
export interface DeferredRoutingPort {
|
|
403
398
|
enqueue(input: Inbound): void;
|
|
@@ -424,12 +419,6 @@ export interface StorePort {
|
|
|
424
419
|
ownerSource(id: string): InputRecord | null;
|
|
425
420
|
/** Revalidate a report's exact failed admission, actionable owner and operator selection. */
|
|
426
421
|
laneRecoveryScope(reportId: string): LaneRecoveryScope | null;
|
|
427
|
-
/** Stage a verified direct native scope-review signal; does not enqueue a HEAD input. */
|
|
428
|
-
recordScopeReview(inputId: string, generation: number, sessionId: string, sourceId: string, proof: ScopeReviewNativeProof): boolean;
|
|
429
|
-
/** Verify the current owner request, solo admission, and lane binding for review or granted dispatch. */
|
|
430
|
-
scopeReview(reviewId: string): ScopeReview | null;
|
|
431
|
-
/** Record one HEAD intent; only eligible native settlement can admit corrective work. */
|
|
432
|
-
requestScopeCorrection(reviewId: string): string;
|
|
433
422
|
/** Original parent route for a redirected report or a handoff derived from that report. */
|
|
434
423
|
reportApprovalSource(id: string): InputRecord | null;
|
|
435
424
|
/** Manager handoff's verified reply route, pinned for a parent-origin thread follow-up or a joined bound reply. */
|
|
@@ -448,9 +437,11 @@ export interface StorePort {
|
|
|
448
437
|
latestLaneRun(target: string): InputRecord | null;
|
|
449
438
|
/** A successful lane run still has an unresolved final report or delivery. */
|
|
450
439
|
hasPendingLaneResult(target: string): boolean;
|
|
451
|
-
/** A current scope review or granted correction still needs this lane generation. */
|
|
452
|
-
hasPendingScopeReview(target: string): boolean;
|
|
453
440
|
hasPendingLanePlacement(target: string): boolean;
|
|
441
|
+
/** Check both transfer endpoints without reading their queued messages or private dialog contents. */
|
|
442
|
+
hasWorkerMemoryHold(target: string): boolean;
|
|
443
|
+
/** Optional maintenance must never wait for a competing Gateway writer. */
|
|
444
|
+
tryWorkerMemoryMeta(keys: string | readonly string[], value: string): boolean;
|
|
454
445
|
/** An uncertain HEAD input with a nonempty original native-owner record. */
|
|
455
446
|
hasHeadRecoveryInput(): boolean;
|
|
456
447
|
/** No automatic head replacement while an original HEAD delivery is unresolved. */
|
|
@@ -460,6 +451,8 @@ export interface StorePort {
|
|
|
460
451
|
kickoffHold(target: string): KickoffHold | null;
|
|
461
452
|
/** The first authorized revision on the physical route, even after settlement. */
|
|
462
453
|
firstAdmittedMessage(route: Route, messageId: string): InputRecord | null;
|
|
454
|
+
/** A physically later owner message (or revision of this original) was already admitted in this exact topic. */
|
|
455
|
+
isLateTopicOriginal(source: InputRecord): boolean;
|
|
463
456
|
/** Exact logical child of a parent reply; unverified evidence must not select a stop target. */
|
|
464
457
|
repliedParentTopic(route: Route, messageId: string): Lane | "unverified" | null;
|
|
465
458
|
/** Workspace evidenced by a placed owner message or a confirmed bot reply on this physical route. */
|
|
@@ -478,6 +471,10 @@ export interface StorePort {
|
|
|
478
471
|
admittedMessageIds(route: Route): Iterable<string>;
|
|
479
472
|
bindInput(id: string, target: string): void;
|
|
480
473
|
submit(id: string, requestId: string, generation: number): boolean;
|
|
474
|
+
/** Reopen the verified lane and submit its goal resume together, without admitting a prompt. */
|
|
475
|
+
submitGoalResume(input: Inbound, target: string, sourceId: string, owner: {
|
|
476
|
+
requestId: string; generation: number; sessionId: string; sessionFile: string; cursor: string | null; goalId?: string;
|
|
477
|
+
}, priorWorkState?: Lane["workState"]): InputRecord;
|
|
481
478
|
/** Nonterminal native assistant observation; never settles or dispatches its owner. */
|
|
482
479
|
progress(id: string, generation: number, sessionId: string, eventId: string, text: string, editInPlace?: boolean): boolean;
|
|
483
480
|
recordLaneReport(id: string, generation: number, sessionId: string, eventId: string, report: LaneReport, observedAt?: number): boolean;
|
|
@@ -516,6 +513,16 @@ export interface StorePort {
|
|
|
516
513
|
putApproval(approval: Approval, ownerInputId?: string): void;
|
|
517
514
|
approval(id: string): Approval | null;
|
|
518
515
|
approvals(target?: string): Approval[];
|
|
516
|
+
/** No Messenger card or automatic native response for a retired approval or its unresolved admission. */
|
|
517
|
+
isNativeApprovalHeld(owner: {
|
|
518
|
+
readonly target: string; readonly generation: number; readonly sessionId: string;
|
|
519
|
+
readonly input?: { readonly id: string; readonly sessionFile: string };
|
|
520
|
+
}, approvalId: string): boolean;
|
|
521
|
+
/** Retired card identities whose original remote dismissal is not yet confirmed. */
|
|
522
|
+
retiredApprovalDismissals(): string[];
|
|
523
|
+
/** Consume the one dismissal attempt only when there is an exact remote card receipt. */
|
|
524
|
+
claimRetiredApprovalDismissal(id: string): Approval | null;
|
|
525
|
+
finishRetiredApprovalDismissal(id: string): void;
|
|
519
526
|
resolveApproval(id: string, generation: number, state: "answered" | "cancelled", resolution?: ApprovalResolution): boolean;
|
|
520
527
|
setApprovalMessage(id: string, remoteId: string): void;
|
|
521
528
|
recoverDeliveries(): void;
|
|
@@ -608,8 +615,8 @@ export interface Messenger {
|
|
|
608
615
|
}): Promise<void>;
|
|
609
616
|
send(output: OutputRecord): Promise<string>;
|
|
610
617
|
sendGroup?(reply: GroupReply): Promise<string>;
|
|
611
|
-
/**
|
|
612
|
-
assertRoute?(route: Route, purpose?: "history"): void | Promise<void>;
|
|
618
|
+
/** Read-only checks for history and already-admitted bound work do not require a drained Gateway queue. */
|
|
619
|
+
assertRoute?(route: Route, purpose?: "history" | "bound-work"): void | Promise<void>;
|
|
613
620
|
/** Cosmetic own reactions on the original message; never an admission or completion receipt. */
|
|
614
621
|
setActivity?(message: MessageReference, activity: MessageActivity): Promise<void>;
|
|
615
622
|
showApproval(approval: Approval): Promise<string>;
|
package/src/cron/cron-jobs.ts
CHANGED
|
@@ -87,6 +87,10 @@ export interface CronUpdate {
|
|
|
87
87
|
readonly cancelPending?: string;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
function reject(text: string): CronUpdate {
|
|
91
|
+
return { text, state: "cancelled" };
|
|
92
|
+
}
|
|
93
|
+
|
|
90
94
|
function jobMetadata(state: CronState, changed: CronJob, remove = false) {
|
|
91
95
|
const next = state.jobs.filter(job => job.id !== changed.id);
|
|
92
96
|
if (!remove) next.push(changed);
|
|
@@ -379,7 +383,6 @@ export class CronJobs {
|
|
|
379
383
|
}
|
|
380
384
|
|
|
381
385
|
private addPrJob(input: InputRecord, tail: string, now: number): CronUpdate {
|
|
382
|
-
const reject = (text: string): CronUpdate => ({ text, state: "cancelled" });
|
|
383
386
|
const source = this.prControlSource(input.id);
|
|
384
387
|
if (!source || routeKey(source.route) !== routeKey(input.route)) {
|
|
385
388
|
return reject("PR intake requires a new authenticated owner command in a Discord guild parent channel.");
|
|
@@ -434,7 +437,6 @@ export class CronJobs {
|
|
|
434
437
|
}
|
|
435
438
|
|
|
436
439
|
private setPrMode(input: InputRecord, argument: string): CronUpdate {
|
|
437
|
-
const reject = (text: string): CronUpdate => ({ text, state: "cancelled" });
|
|
438
440
|
const source = this.prControlSource(input.id);
|
|
439
441
|
if (source?.state !== "pending" || routeKey(source.route) !== routeKey(input.route)) {
|
|
440
442
|
return reject("Changing PR intake mode requires a new authenticated owner command in its Discord guild parent channel.");
|
|
@@ -486,7 +488,6 @@ export class CronJobs {
|
|
|
486
488
|
|
|
487
489
|
control(input: InputRecord, argument: string, now: number): CronUpdate {
|
|
488
490
|
const [, action = "", tail = ""] = /^(\S+)(?:\s+([\s\S]*))?$/.exec(argument) ?? [];
|
|
489
|
-
const reject = (text: string): CronUpdate => ({ text, state: "cancelled" });
|
|
490
491
|
if (!action || action === "help" && !tail) return { text: usage };
|
|
491
492
|
const state = this.state();
|
|
492
493
|
const scoped = state.jobs.flatMap(job => {
|
|
@@ -86,9 +86,8 @@ function offerText(repository: string, candidate: CronPrCandidate): string {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export function describePrIntake(store: StorePort, job: CronPrJob, number: number | null): string {
|
|
89
|
-
const
|
|
89
|
+
const newest = ledger(store, job.repository)?.candidates.filter(candidate => candidate.jobId === job.id).reverse() ?? [];
|
|
90
90
|
const summary = job.lastRunId ? store.getMeta(outcomeKey(job.lastRunId)) : null;
|
|
91
|
-
const newest = [...candidates].reverse();
|
|
92
91
|
const selected = number === null ? newest.slice(0, 10) : newest.filter(candidate => candidate.number === number);
|
|
93
92
|
const open = !job.paused && !job.removed && job.stopBoundary === store.getMeta("head:stop-boundary");
|
|
94
93
|
const lines = selected.map(candidate => {
|
package/src/extension.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { fileURLToPath } from "node:url";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
|
|
5
5
|
import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings";
|
|
6
|
+
import { loadLegacyPiModule } from "@oh-my-pi/pi-coding-agent/extensibility/plugins/legacy-pi-compat";
|
|
6
7
|
import { Type } from "@sinclair/typebox";
|
|
7
8
|
import { configuredPlatforms, hostPaths, loadConfigSnapshot } from "./config/config";
|
|
8
9
|
import { loadWakeConfig } from "./config/wake-config";
|
|
@@ -28,6 +29,38 @@ import { soulUpdateSchema } from "./omp/soul";
|
|
|
28
29
|
// from this package so a same-name workspace skill cannot change the procedure.
|
|
29
30
|
const headInstructions = readFileSync(new URL("../skills/head/SKILL.md", import.meta.url), "utf8");
|
|
30
31
|
const headReferenceDirectory = fileURLToPath(new URL("../skills/head/references", import.meta.url));
|
|
32
|
+
|
|
33
|
+
type WorkerMemoryModule = typeof import("./omp/worker-memory-import");
|
|
34
|
+
type WorkerMemorySdk = typeof import("./omp/worker-memory-sdk");
|
|
35
|
+
|
|
36
|
+
function workerMemoryModule(value: unknown): value is WorkerMemoryModule {
|
|
37
|
+
return !!value && typeof value === "object" && "prepareWorkerMemoryImport" in value
|
|
38
|
+
&& typeof value.prepareWorkerMemoryImport === "function";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function workerMemorySdk(value: unknown): value is WorkerMemorySdk {
|
|
42
|
+
const functions: ReadonlyArray<keyof WorkerMemorySdk> = ["computeMnemopiBankScope", "fastembedModelName",
|
|
43
|
+
"withMnemopiRuntimeOptions", "getMnemopiRuntimeOptions", "embed", "insertLiveEmbeddings"];
|
|
44
|
+
return !!value && typeof value === "object"
|
|
45
|
+
&& functions.every(key => typeof Reflect.get(value, key) === "function");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function loadWorkerMemoryDestination() {
|
|
49
|
+
const options = { reload: false };
|
|
50
|
+
try {
|
|
51
|
+
const [sdk, memory] = await Promise.all([
|
|
52
|
+
loadLegacyPiModule(fileURLToPath(new URL("../.upstream/worker-memory-sdk.mjs", import.meta.url)), options),
|
|
53
|
+
loadLegacyPiModule(fileURLToPath(new URL("./omp/worker-memory-import.ts", import.meta.url)), options),
|
|
54
|
+
]);
|
|
55
|
+
if (workerMemorySdk(sdk) && workerMemoryModule(memory))
|
|
56
|
+
return (session: Parameters<WorkerMemoryModule["prepareWorkerMemoryImport"]>[0], cwd: string) =>
|
|
57
|
+
memory.prepareWorkerMemoryImport(session, cwd, sdk);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (!(error instanceof Error)) throw error;
|
|
60
|
+
// Optional capability: don't activate a remote-memory lane without it.
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
31
64
|
const managerTools: Record<string, true> = {
|
|
32
65
|
head_recovery: true, head_set_model: true, cron_create: true, soul_update: true,
|
|
33
66
|
lane_models: true, lane_init_presets: true, lane_set_model: true, lane_review_decision: true,
|
|
@@ -45,10 +78,16 @@ const result = (value: unknown) => ({
|
|
|
45
78
|
content: [{ type: "text" as const, text: typeof value === "string" ? value : JSON.stringify(value, null, 2) }],
|
|
46
79
|
details: {},
|
|
47
80
|
});
|
|
48
|
-
const
|
|
81
|
+
const workflowSelection = Type.Object({
|
|
49
82
|
name: Type.Union(WORKFLOW_NAMES.map(name => Type.Literal(name))),
|
|
50
83
|
reason: Type.String({ minLength: 1 }),
|
|
51
|
-
}, { additionalProperties: false })
|
|
84
|
+
}, { additionalProperties: false });
|
|
85
|
+
const workflowSchema = Type.Optional(workflowSelection);
|
|
86
|
+
const laneModelSelection = {
|
|
87
|
+
model: Type.Optional(Type.Object({ provider: Type.String({ minLength: 1 }), id: Type.String({ minLength: 1 }) })),
|
|
88
|
+
preset: Type.Optional(Type.String({ minLength: 1 })),
|
|
89
|
+
modelReason: Type.String({ minLength: 1 }),
|
|
90
|
+
} as const;
|
|
52
91
|
const threadTagsSchema = Type.Array(Type.String({ pattern: "^[0-9]{1,20}$" }), { maxItems: 5, uniqueItems: true });
|
|
53
92
|
const threadTitleSchema = Type.String({ minLength: 1, maxLength: 100, pattern: "\\S" });
|
|
54
93
|
const threadChangeFields = {
|
|
@@ -135,8 +174,6 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
135
174
|
pi.on("tool_call", (event, ctx) => {
|
|
136
175
|
if (runtime?.laneDecisionReviewActive() && (ctx.agent.kind !== "main" || event.toolName !== "lane_review_decision"))
|
|
137
176
|
return { block: true, reason: "A lane question permits only answering or escalating its original decision" };
|
|
138
|
-
if (runtime?.scopeReviewActive() && (ctx.agent.kind !== "main" || event.toolName !== "lane_message"))
|
|
139
|
-
return { block: true, reason: "This assignment review permits only a direct same-lane correction from its verified owner message" };
|
|
140
177
|
if (event.toolName === "soul_update") {
|
|
141
178
|
try { requireRuntime(ctx).authorizeSoulUpdate(event.input, ctx.sessionManager.getSessionId()); }
|
|
142
179
|
catch (error) {
|
|
@@ -168,8 +205,7 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
168
205
|
return { block: true, reason: "HEAD recovery is restricted to the original main head" };
|
|
169
206
|
if (["cron_create", "decision_list", "decision_inspect", "decision_withdraw"].includes(event.toolName) && ctx.agent.kind !== "main")
|
|
170
207
|
return { block: true, reason: "Lane management is restricted to the main superagent head" };
|
|
171
|
-
if (
|
|
172
|
-
if (ctx.agent.kind !== "main" || event.toolName !== "head_recovery") {
|
|
208
|
+
if (runtime?.headRecoveryActive() && (ctx.agent.kind !== "main" || event.toolName !== "head_recovery")) {
|
|
173
209
|
runtime.blockHeadRecoveryTool();
|
|
174
210
|
return { block: true, reason: "The isolated HEAD recovery turn permits only head_recovery; original work is not replayed" };
|
|
175
211
|
}
|
|
@@ -324,9 +360,7 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
324
360
|
parameters: Type.Object({
|
|
325
361
|
sourceId: Type.String(), title: Type.String(), cwd: Type.String(),
|
|
326
362
|
kickoff: Type.String({ minLength: 1, description: "A concise message in the user's language stating the concrete approach. Delivered in the work topic before native lane execution; failed or uncertain delivery holds execution." }),
|
|
327
|
-
|
|
328
|
-
preset: Type.Optional(Type.String({ minLength: 1 })),
|
|
329
|
-
modelReason: Type.String({ minLength: 1 }),
|
|
363
|
+
...laneModelSelection,
|
|
330
364
|
brief: Type.Optional(Type.String()), acceptance: Type.Optional(Type.Array(Type.String())),
|
|
331
365
|
workflow: workflowSchema,
|
|
332
366
|
placement: Type.Optional(Type.Object({
|
|
@@ -448,9 +482,7 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
448
482
|
description: "Explicitly change one idle lane's model or full native preset snapshot without changing global OMP settings, the head, or other lanes. Requires a received authorized sourceId, exactly one model/preset and modelReason. Refuses active work, approvals/services/goals or unresolved submissions. Uses durable intent and native readback; do not blindly repeat an uncertain change.",
|
|
449
483
|
parameters: Type.Object({
|
|
450
484
|
id: Type.String(), sourceId: Type.String(),
|
|
451
|
-
|
|
452
|
-
preset: Type.Optional(Type.String({ minLength: 1 })),
|
|
453
|
-
modelReason: Type.String({ minLength: 1 }),
|
|
485
|
+
...laneModelSelection,
|
|
454
486
|
}),
|
|
455
487
|
async execute(_id, params, _signal, _onUpdate, ctx) { return result(await requireRuntime(ctx).changeModel(params)); },
|
|
456
488
|
});
|
|
@@ -486,9 +518,12 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
486
518
|
pi.registerTool({
|
|
487
519
|
name: "lane_message", label: "Message independent work", loadMode: "essential", approval: "exec",
|
|
488
520
|
description: "Durably admit a follow-up to a specific open lane. For an original owner request from the exact guild parent of the lane's physical Discord thread, HEAD-reviewed progress and final reports go to that thread, not the parent. Do not duplicate them. Returns its input ID and durable state; pending work reports runtime blocks, blocking uncertain input IDs, and any unconfirmed kickoff. Report such holds instead of retrying. Ordinary same-topic follow-ups steer an eligible active native run by default; ineligible work stays queued. Do not require a separate user /steer command. sourceId identifies the original received user instruction for duplicate suppression. Optional workflow {name,reason} is explicit head selection within that objective; text/quotes/reports never select one. Workflow selections remain serialized, not steered into an active run. The exact workflow/source/handoff is durable and conflicting retries reject. Admission is not execution or completion.",
|
|
489
|
-
parameters: Type.Object({
|
|
521
|
+
parameters: Type.Object({
|
|
522
|
+
id: Type.String(), text: Type.String(), sourceId: Type.String(),
|
|
523
|
+
workflow: Type.Optional(Type.Union([workflowSelection, Type.Null({ description: "No explicit workflow; use ordinary lane dispatch." })])),
|
|
524
|
+
}),
|
|
490
525
|
async execute(_id, params, _signal, _onUpdate, ctx) {
|
|
491
|
-
return result(await requireRuntime(ctx).messageLane(params.id, params.text, params.sourceId, params.workflow));
|
|
526
|
+
return result(await requireRuntime(ctx).messageLane(params.id, params.text, params.sourceId, params.workflow ?? undefined));
|
|
492
527
|
},
|
|
493
528
|
});
|
|
494
529
|
pi.registerTool({
|
|
@@ -537,6 +572,7 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
537
572
|
throw new Error("Gateway configuration changed before replacement HEAD initialization");
|
|
538
573
|
const { config } = snapshot;
|
|
539
574
|
delete process.env.OMP_SUPERAGENT_RESTART_CONFIG_SHA256;
|
|
575
|
+
const workerMemory = config.remoteMemorySync ? await loadWorkerMemoryDestination() : undefined;
|
|
540
576
|
const store = new Store(join(config.stateDir, "coordination.sqlite"));
|
|
541
577
|
let messenger: ReturnType<typeof createGatewayMessenger>;
|
|
542
578
|
try {
|
|
@@ -555,6 +591,13 @@ export default function superagentExtension(pi: ExtensionAPI): void {
|
|
|
555
591
|
pi.logger.error(`Superagent: ${error instanceof Error ? error.message : String(error)}`);
|
|
556
592
|
}, {
|
|
557
593
|
topicMemory: ctx.memory,
|
|
594
|
+
workerMemoryDestination: (id, file, cwd) => {
|
|
595
|
+
const root = pi.pi.AgentRegistry.global().get(pi.pi.MAIN_AGENT_ID);
|
|
596
|
+
const session = root?.session;
|
|
597
|
+
return root?.id === ctx.agent.id && session instanceof pi.pi.AgentSession
|
|
598
|
+
&& session.sessionId === id && session.sessionFile === file && cwd === ctx.cwd
|
|
599
|
+
? workerMemory?.(session, cwd) : undefined;
|
|
600
|
+
},
|
|
558
601
|
readHeadQuota: (failure, sessionId, signal) => {
|
|
559
602
|
const session = pi.pi.AgentRegistry.global().get(pi.pi.MAIN_AGENT_ID)?.session;
|
|
560
603
|
return session instanceof pi.pi.AgentSession && session.sessionId === sessionId
|