@0xmaxma/claude-gateway 2.1.0 → 2.1.1
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/README.md +1 -0
- package/dist/agent/runner.d.ts +9 -0
- package/dist/agent/runner.d.ts.map +1 -1
- package/dist/agent/runner.js +18 -12
- package/dist/agent/runner.js.map +1 -1
- package/dist/agent/workspace-loader.d.ts +28 -1
- package/dist/agent/workspace-loader.d.ts.map +1 -1
- package/dist/agent/workspace-loader.js +70 -6
- package/dist/agent/workspace-loader.js.map +1 -1
- package/dist/api/gateway-router.d.ts.map +1 -1
- package/dist/api/gateway-router.js +10 -1
- package/dist/api/gateway-router.js.map +1 -1
- package/dist/apps/agent-manager.d.ts +9 -0
- package/dist/apps/agent-manager.d.ts.map +1 -1
- package/dist/apps/agent-manager.js +29 -0
- package/dist/apps/agent-manager.js.map +1 -1
- package/dist/apps/compose-generator.d.ts +4 -0
- package/dist/apps/compose-generator.d.ts.map +1 -1
- package/dist/apps/compose-generator.js +6 -3
- package/dist/apps/compose-generator.js.map +1 -1
- package/dist/apps/installer.d.ts +1 -0
- package/dist/apps/installer.d.ts.map +1 -1
- package/dist/apps/registry.d.ts +1 -0
- package/dist/apps/registry.d.ts.map +1 -1
- package/dist/build-provenance.json +4 -4
- package/dist/config/agent-lifecycle.d.ts +4 -2
- package/dist/config/agent-lifecycle.d.ts.map +1 -1
- package/dist/config/agent-lifecycle.js +11 -3
- package/dist/config/agent-lifecycle.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +10 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/reload-policy.d.ts.map +1 -1
- package/dist/config/reload-policy.js +3 -0
- package/dist/config/reload-policy.js.map +1 -1
- package/dist/index.js +35 -7
- package/dist/index.js.map +1 -1
- package/dist/orchestration/bridge.d.ts +2 -0
- package/dist/orchestration/bridge.d.ts.map +1 -1
- package/dist/orchestration/bridge.js +8 -5
- package/dist/orchestration/bridge.js.map +1 -1
- package/dist/orchestration/capabilities.d.ts.map +1 -1
- package/dist/orchestration/capabilities.js +1 -0
- package/dist/orchestration/capabilities.js.map +1 -1
- package/dist/orchestration/container.d.ts.map +1 -1
- package/dist/orchestration/container.js +3 -1
- package/dist/orchestration/container.js.map +1 -1
- package/dist/orchestration/context-footprint.d.ts +8 -1
- package/dist/orchestration/context-footprint.d.ts.map +1 -1
- package/dist/orchestration/context-footprint.js +27 -9
- package/dist/orchestration/context-footprint.js.map +1 -1
- package/dist/orchestration/dashboard-reader-worker.js +1 -1
- package/dist/orchestration/dashboard-reader-worker.js.map +1 -1
- package/dist/orchestration/recovery.d.ts.map +1 -1
- package/dist/orchestration/recovery.js +3 -0
- package/dist/orchestration/recovery.js.map +1 -1
- package/dist/orchestration/restart-resume.d.ts +13 -0
- package/dist/orchestration/restart-resume.d.ts.map +1 -0
- package/dist/orchestration/restart-resume.js +32 -0
- package/dist/orchestration/restart-resume.js.map +1 -0
- package/dist/orchestration/runtime.d.ts.map +1 -1
- package/dist/orchestration/runtime.js +3 -1
- package/dist/orchestration/runtime.js.map +1 -1
- package/dist/orchestration/source-policy.d.ts +2 -0
- package/dist/orchestration/source-policy.d.ts.map +1 -1
- package/dist/orchestration/source-policy.js +3 -1
- package/dist/orchestration/source-policy.js.map +1 -1
- package/dist/orchestration/task-files.d.ts +2 -0
- package/dist/orchestration/task-files.d.ts.map +1 -1
- package/dist/orchestration/task-files.js +17 -6
- package/dist/orchestration/task-files.js.map +1 -1
- package/dist/orchestration/tasks/driver.d.ts.map +1 -1
- package/dist/orchestration/tasks/driver.js +11 -1
- package/dist/orchestration/tasks/driver.js.map +1 -1
- package/dist/orchestration/tasks/failure.js +1 -1
- package/dist/orchestration/tasks/failure.js.map +1 -1
- package/dist/orchestration/tasks/scheduler.d.ts +2 -0
- package/dist/orchestration/tasks/scheduler.d.ts.map +1 -1
- package/dist/orchestration/tasks/scheduler.js +38 -27
- package/dist/orchestration/tasks/scheduler.js.map +1 -1
- package/dist/orchestration/tasks/service.d.ts +6 -0
- package/dist/orchestration/tasks/service.d.ts.map +1 -1
- package/dist/orchestration/tasks/service.js +65 -1
- package/dist/orchestration/tasks/service.js.map +1 -1
- package/dist/orchestration/types.d.ts +13 -0
- package/dist/orchestration/types.d.ts.map +1 -1
- package/dist/orchestration/types.js.map +1 -1
- package/dist/session/process.d.ts +22 -1
- package/dist/session/process.d.ts.map +1 -1
- package/dist/session/process.js +72 -18
- package/dist/session/process.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/mcp/tools/agent/module.ts +3 -1
- package/mcp/tools/apps/module.ts +4 -2
- package/mcp/tools/apps/skills/create-app-yaml/SKILL.md +1 -1
- package/mcp/tools/apps/skills/install-app/SKILL.md +2 -1
- package/mcp/tools/cron/module.ts +3 -0
- package/mcp/tools/memory/isolate-memory.test.ts +95 -0
- package/mcp/tools/memory/module.ts +3 -1
- package/mcp/tools/skills/module.ts +4 -2
- package/mcp/tools/tasks/module.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/orchestration/tasks/service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAA6C,MAAM,UAAU,CAAC;AACzF,OAAO,EAA8B,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAsB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAc,aAAa,EAAwB,UAAU,EAAE,kBAAkB,EAAc,MAAM,UAAU,CAAC;AACpM,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/orchestration/tasks/service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ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AAM,EAAC,UAAU,EAAC,MAAM,EAAC,QAAQ,EAAC,MAAM,EAAC,KAAK,EAAC,MAAI,IAAI,GAAE,YAAY;IAoBnJ,sFAAsF;IACtF,gBAAgB,CAAC,OAAO,EAAC,cAAc,EAAC,MAAM,EAAC,MAAM,EAAC,QAAQ,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,EAAC,UAAU,EAAC,MAAM,EAAC,YAAY,EAAC,MAAM,EAAC,KAAK,EAAC,MAAI,MAAM,GAAE,YAAY;IAoB3J;;kFAE8E;IAC9E,OAAO,CAAC,kBAAkB;IAe1B,yFAAyF;IACzF,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IA0BrF;+EAC2E;IAC3E,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,YAAY;IAsBrH,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAE,WAAW,GAAG,UAAwB,GAAG,IAAI;CAU5G"}
|
|
@@ -28,6 +28,7 @@ const config_1 = require("../config");
|
|
|
28
28
|
const conversation_intake_1 = require("../conversation-intake");
|
|
29
29
|
const types_1 = require("../types");
|
|
30
30
|
const subagent_tool_schemas_1 = require("../subagent-tool-schemas");
|
|
31
|
+
const restart_resume_1 = require("../restart-resume");
|
|
31
32
|
/** Parent states a subagent runs under; any other parent can neither start nor wait for one. */
|
|
32
33
|
exports.RUNNING_PARENT = ['starting', 'running', 'interrupting'];
|
|
33
34
|
/** Refs the agent may name itself; the gateway's own additions are bounded separately by MAX_INTAKE_INPUTS. */
|
|
@@ -749,6 +750,7 @@ class TaskService {
|
|
|
749
750
|
// Retrying an unconfirmed stall stop ("Retry cleanup") finishes the supervisor's
|
|
750
751
|
// stop; it must not turn that stall into a user/agent cancellation.
|
|
751
752
|
const retriesStall = task.state === 'needs_reconciliation' && task.cancellation?.requestedBy === 'supervisor';
|
|
753
|
+
delete task.restartRecovery; // A stop is final: the stranded worker is cleaned up, never resumed.
|
|
752
754
|
if (!retriesStall)
|
|
753
755
|
task.cancellation = { requestedBy, requestedAt: Date.now() };
|
|
754
756
|
delete task.queuedCommands;
|
|
@@ -1021,6 +1023,8 @@ class TaskService {
|
|
|
1021
1023
|
attempt.processIdentity = identity;
|
|
1022
1024
|
task.state = 'running';
|
|
1023
1025
|
task.appliedRevision = attempt.revision;
|
|
1026
|
+
if (task.restartResume)
|
|
1027
|
+
task.restartResume.pending = false;
|
|
1024
1028
|
if (task.executionControl?.revision === attempt.revision)
|
|
1025
1029
|
task.executionControl.phase = 'applied';
|
|
1026
1030
|
this.store.saveAttempt(attempt);
|
|
@@ -1295,6 +1299,7 @@ class TaskService {
|
|
|
1295
1299
|
outcome = { type: 'failed', failure: { code: 'WORKER_BLOCKED', message: task.workflow.checkpoint.findings.filter(f => f.status === 'open').map(f => f.summary).join('\n').slice(0, 4096), observedAt: Date.now() } };
|
|
1296
1300
|
}
|
|
1297
1301
|
const stalled = task.state === 'cancel_requested' ? this.stalledFailure(task, outcome.type !== 'unknown') : undefined;
|
|
1302
|
+
const restartInterrupted = (outcome.type === 'failed' || outcome.type === 'stopped') && outcome.failure?.code === 'GATEWAY_SHUTDOWN' && (0, restart_resume_1.restartResumable)(task);
|
|
1298
1303
|
if (outcome.type !== 'completed' && outcome.type !== 'paused') {
|
|
1299
1304
|
attempt.failure = stalled ?? outcome.failure ?? (0, failure_1.taskFailure)(undefined, outcome.type === 'stopped' ? 'WORKER_STOPPED' : 'WORKER_FAILED');
|
|
1300
1305
|
task.failure = attempt.failure;
|
|
@@ -1305,6 +1310,9 @@ class TaskService {
|
|
|
1305
1310
|
if (outcome.type === 'unknown') {
|
|
1306
1311
|
if (task.executionControl?.phase === 'pending')
|
|
1307
1312
|
task.executionControl.phase = 'blocked';
|
|
1313
|
+
// A shutdown whose stop could not be confirmed resumes once the next gateway stops that worker.
|
|
1314
|
+
if (outcome.failure?.code === 'GATEWAY_SHUTDOWN')
|
|
1315
|
+
(0, restart_resume_1.markRestartRecovery)(task);
|
|
1308
1316
|
attempt.state = 'unknown';
|
|
1309
1317
|
task.state = 'needs_reconciliation';
|
|
1310
1318
|
}
|
|
@@ -1328,6 +1336,8 @@ class TaskService {
|
|
|
1328
1336
|
task.state = 'waiting_input';
|
|
1329
1337
|
task.latestProgress = { source: 'runtime', observedAt: Date.now(), text: task.gatewayTarget?.adapter === 'computer' && outcome.computerReport ? (0, computer_outcome_1.computerOutcomeText)(outcome.computerReport) : task.gatewayTarget?.adapter === 'browser' && outcome.browserReport ? (0, browser_outcome_1.browserOutcomeText)(outcome.browserReport) : 'Waiting for your next command.' };
|
|
1330
1338
|
}
|
|
1339
|
+
else if (restartInterrupted)
|
|
1340
|
+
this.resumeAfterRestart(task, attempt);
|
|
1331
1341
|
else
|
|
1332
1342
|
task.state = outcome.type === 'completed' ? 'completed' : 'failed';
|
|
1333
1343
|
if (task.state === 'completed' && outcome.type === 'completed')
|
|
@@ -1363,11 +1373,14 @@ class TaskService {
|
|
|
1363
1373
|
this.store.appendEvent(task.conversationId, 'task.provider_refusal', { attemptId, refusals }, task.taskId);
|
|
1364
1374
|
if (outcome.type !== 'unknown')
|
|
1365
1375
|
this.pool.release(task.taskId, outcome.type === 'completed' || outcome.type === 'paused');
|
|
1376
|
+
// A resume brief belongs only to the next attempt of a re-queued task.
|
|
1377
|
+
if (task.restartResume && task.state !== 'queued')
|
|
1378
|
+
task.restartResume.pending = false;
|
|
1366
1379
|
this.store.saveAttempt(attempt);
|
|
1367
1380
|
this.store.saveTask(task, task.stateVersion);
|
|
1368
1381
|
if (task.state === 'queued')
|
|
1369
1382
|
this.store.enqueue('schedule', `schedule:${task.taskId}:${task.stateVersion}`, { taskId: task.taskId });
|
|
1370
|
-
else if (types_1.TERMINAL_TASK_STATES.has(task.state) || task.state === 'needs_reconciliation' || (waitingForCommand && task.state === 'waiting_input' && task.automationController !== 'user' && task.executionControl?.phase !== 'paused') || (waitingForCommand && (0, automation_session_1.agentStepRunEnded)(task)))
|
|
1383
|
+
else if (types_1.TERMINAL_TASK_STATES.has(task.state) || (task.state === 'needs_reconciliation' && !task.restartRecovery) || (waitingForCommand && task.state === 'waiting_input' && task.automationController !== 'user' && task.executionControl?.phase !== 'paused') || (waitingForCommand && (0, automation_session_1.agentStepRunEnded)(task)))
|
|
1371
1384
|
this.notify(task);
|
|
1372
1385
|
return task;
|
|
1373
1386
|
});
|
|
@@ -1624,6 +1637,57 @@ class TaskService {
|
|
|
1624
1637
|
return task;
|
|
1625
1638
|
}, taskId);
|
|
1626
1639
|
}
|
|
1640
|
+
/** Re-queue already-authorized work interrupted by a gateway restart as a new attempt of the same
|
|
1641
|
+
* task (#603), or fail it as a blocker once the per-revision cap is spent. No failure report is
|
|
1642
|
+
* sent for a resume: that report turn could only ask the user to continue. */
|
|
1643
|
+
resumeAfterRestart(task, attempt, lastProgressHint) {
|
|
1644
|
+
const previous = task.restartResume?.revision === attempt.revision ? task.restartResume : undefined;
|
|
1645
|
+
const count = (previous?.count ?? 0) + 1;
|
|
1646
|
+
if (count > restart_resume_1.MAX_RESTART_RESUMES) {
|
|
1647
|
+
task.state = 'failed';
|
|
1648
|
+
if (task.restartResume)
|
|
1649
|
+
task.restartResume.pending = false;
|
|
1650
|
+
attempt.failure = task.failure = { code: 'GATEWAY_SHUTDOWN_REPEATED', message: `Gateway restarts interrupted this task ${count} times; automatic resume stopped after ${restart_resume_1.MAX_RESTART_RESUMES} resumes. Existing changes are retained; any follow-up must verify them first and must not blindly repeat side effects.`, observedAt: Date.now() };
|
|
1651
|
+
return false;
|
|
1652
|
+
}
|
|
1653
|
+
task.state = 'queued';
|
|
1654
|
+
task.restartResume = { count, revision: attempt.revision, pending: true,
|
|
1655
|
+
lastProgress: task.latestProgress?.source === 'worker' ? task.latestProgress.text : lastProgressHint ?? previous?.lastProgress };
|
|
1656
|
+
this.cancelSubagents(task);
|
|
1657
|
+
return true;
|
|
1658
|
+
}
|
|
1659
|
+
/** Scheduler-only: settle a worker that restart recovery could not prove had stopped. */
|
|
1660
|
+
resolveRestartRecovery(attemptId, generation, stopped) {
|
|
1661
|
+
this.store.transaction(() => {
|
|
1662
|
+
const attempt = this.store.attempt(attemptId), task = attempt && this.store.task(attempt.taskId);
|
|
1663
|
+
if (!attempt || !task || attempt.generation !== generation || task.activeAttemptId !== attemptId || task.state !== 'needs_reconciliation' || !task.restartRecovery)
|
|
1664
|
+
throw new types_1.OrchestrationError('STALE_ATTEMPT');
|
|
1665
|
+
const hint = task.restartRecovery.lastProgress;
|
|
1666
|
+
delete task.restartRecovery;
|
|
1667
|
+
if (!stopped) {
|
|
1668
|
+
// Never run the same work twice: an unproven stop keeps the existing reconciliation state.
|
|
1669
|
+
const message = 'Cannot verify that the worker from before the gateway restart has stopped, so the task was not resumed automatically. Stopping the task retries cleanup; existing files and prior effects are retained.';
|
|
1670
|
+
task.failure = { code: 'CLEANUP_UNCONFIRMED', message, observedAt: Date.now() };
|
|
1671
|
+
task.latestProgress = { source: 'runtime', observedAt: Date.now(), text: message };
|
|
1672
|
+
this.store.saveTask(task, task.stateVersion);
|
|
1673
|
+
this.store.appendEvent(task.conversationId, 'task.restart_recovered', { stopped, state: task.state }, task.taskId);
|
|
1674
|
+
this.notify(task);
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
attempt.state = 'ended';
|
|
1678
|
+
attempt.failure = task.failure = (0, failure_1.shutdownFailure)();
|
|
1679
|
+
task.activeAttemptId = undefined;
|
|
1680
|
+
this.pool.release(task.taskId, false);
|
|
1681
|
+
const resumed = this.resumeAfterRestart(task, attempt, hint);
|
|
1682
|
+
this.store.saveAttempt(attempt);
|
|
1683
|
+
this.store.saveTask(task, task.stateVersion);
|
|
1684
|
+
this.store.appendEvent(task.conversationId, 'task.restart_recovered', { stopped, state: task.state }, task.taskId);
|
|
1685
|
+
if (resumed)
|
|
1686
|
+
this.store.enqueue('schedule', `schedule:${task.taskId}:${task.stateVersion}`, { taskId: task.taskId });
|
|
1687
|
+
else
|
|
1688
|
+
this.notify(task);
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1627
1691
|
/** Offline operator workflow only; not exposed through conversation tools.
|
|
1628
1692
|
* Caller holds the instance lock and has checked liveness/side effects. */
|
|
1629
1693
|
reconcile(taskId, state, evidence) {
|