@senpi/runtime 3.0.186 → 3.0.187
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/actions/llm-decision/openclaw-llm-decision.d.ts +1 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.js +1 -1
- package/dist/approvals/telemetry.d.ts +3 -2
- package/dist/approvals/telemetry.d.ts.map +1 -1
- package/dist/approvals/telemetry.js.map +1 -1
- package/dist/approvals/tool-approval-gate.d.ts +9 -3
- package/dist/approvals/tool-approval-gate.d.ts.map +1 -1
- package/dist/approvals/tool-approval-gate.js +18 -5
- package/dist/approvals/tool-approval-gate.js.map +1 -1
- package/dist/approvals/turn-context.d.ts +43 -18
- package/dist/approvals/turn-context.d.ts.map +1 -1
- package/dist/approvals/turn-context.js +67 -24
- package/dist/approvals/turn-context.js.map +1 -1
- package/dist/cli/guide-commands.d.ts.map +1 -1
- package/dist/cli/guide-commands.js +2 -1
- package/dist/cli/guide-commands.js.map +1 -1
- package/dist/cli/senpi-commands.d.ts.map +1 -1
- package/dist/cli/senpi-commands.js +8 -0
- package/dist/cli/senpi-commands.js.map +1 -1
- package/dist/deploy/register.d.ts +1 -0
- package/dist/deploy/register.d.ts.map +1 -1
- package/dist/deploy/register.js +2 -1
- package/dist/deploy/register.js.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.d.ts +38 -2
- package/dist/dsl/monitor/dsl-failure-events.d.ts.map +1 -1
- package/dist/dsl/monitor/dsl-failure-events.js +67 -4
- package/dist/dsl/monitor/dsl-failure-events.js.map +1 -1
- package/dist/dsl/monitor/process-one-position.d.ts.map +1 -1
- package/dist/dsl/monitor/process-one-position.js +25 -1
- package/dist/dsl/monitor/process-one-position.js.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +484 -146
- package/dist/index.js.map +1 -1
- package/dist/runtime/auto-update/coordinator.d.ts +19 -2
- package/dist/runtime/auto-update/coordinator.d.ts.map +1 -1
- package/dist/runtime/auto-update/coordinator.js +104 -20
- package/dist/runtime/auto-update/coordinator.js.map +1 -1
- package/dist/runtime/auto-update/gateway-restart.d.ts +2 -2
- package/dist/runtime/auto-update/gateway-restart.js +1 -1
- package/dist/runtime/auto-update/idle-gate.d.ts +45 -9
- package/dist/runtime/auto-update/idle-gate.d.ts.map +1 -1
- package/dist/runtime/auto-update/idle-gate.js +26 -14
- package/dist/runtime/auto-update/idle-gate.js.map +1 -1
- package/dist/runtime/auto-update/register-idle-gate.d.ts +1 -1
- package/dist/runtime/auto-update/register-idle-gate.d.ts.map +1 -1
- package/dist/runtime/auto-update/register-idle-gate.js +8 -4
- package/dist/runtime/auto-update/register-idle-gate.js.map +1 -1
- package/dist/runtime/auto-update/run-update-command.d.ts +1 -1
- package/dist/runtime/auto-update/run-update-command.js +1 -1
- package/dist/runtime/auto-update/types.d.ts +2 -1
- package/dist/runtime/auto-update/types.d.ts.map +1 -1
- package/dist/runtime/auto-update/types.js.map +1 -1
- package/dist/runtime/auto-update/update-schedule.d.ts +14 -4
- package/dist/runtime/auto-update/update-schedule.d.ts.map +1 -1
- package/dist/runtime/auto-update/update-schedule.js +21 -5
- package/dist/runtime/auto-update/update-schedule.js.map +1 -1
- package/dist/runtime/process-state.d.ts +168 -0
- package/dist/runtime/process-state.d.ts.map +1 -0
- package/dist/runtime/process-state.js +81 -0
- package/dist/runtime/process-state.js.map +1 -0
- package/dist/runtime/reconcile-state.d.ts.map +1 -1
- package/dist/runtime/reconcile-state.js +18 -4
- package/dist/runtime/reconcile-state.js.map +1 -1
- package/dist/runtime/strategy-registry.d.ts +16 -0
- package/dist/runtime/strategy-registry.d.ts.map +1 -1
- package/dist/runtime/strategy-registry.js +7 -3
- package/dist/runtime/strategy-registry.js.map +1 -1
- package/dist/runtime/update-apply-deps.d.ts +5 -3
- package/dist/runtime/update-apply-deps.d.ts.map +1 -1
- package/dist/runtime/update-apply-deps.js +15 -3
- package/dist/runtime/update-apply-deps.js.map +1 -1
- package/dist/senpi/client.d.ts +5 -1
- package/dist/senpi/client.d.ts.map +1 -1
- package/dist/senpi/client.js +20 -7
- package/dist/senpi/client.js.map +1 -1
- package/dist/telemetry/metrics.d.ts +1 -1
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/metrics.js +1 -1
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/telemetry/spans/span-hooks.d.ts +1 -1
- package/dist/telemetry/spans/span-hooks.js +1 -1
- package/dist/test-setup.js +7 -1
- package/dist/test-setup.js.map +1 -1
- package/dist/tool-surface/crib-hook.d.ts.map +1 -1
- package/dist/tool-surface/crib-hook.js +8 -0
- package/dist/tool-surface/crib-hook.js.map +1 -1
- package/dist/tool-surface/crib-sheet.d.ts +1 -1
- package/dist/tool-surface/crib-sheet.js +1 -1
- package/dist/tool-surface/mcp-tool-source.d.ts +1 -1
- package/dist/tool-surface/mcp-tool-source.js +2 -2
- package/dist/utils/event-catalog.d.ts +27 -1
- package/dist/utils/event-catalog.d.ts.map +1 -1
- package/dist/utils/event-catalog.js +6 -0
- package/dist/utils/event-catalog.js.map +1 -1
- package/dist/widgets/tool.d.ts +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idle-gate.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/idle-gate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"idle-gate.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/idle-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AA6EjE,yCAAyC;AACzC,MAAM,UAAU,sBAAsB;IACpC,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,iBAAiB,EAAE,SAAS,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
6
|
+
* Sources, as on OpenClaw 2026.10.10:
|
|
7
7
|
* - `before_prompt_build` hook context (`PluginHookAgentContext`: `runId`,
|
|
8
8
|
* `sessionKey`, `trigger`, `inputProvenance`) classifies a run; lifecycle
|
|
9
9
|
* `start` events carry no trigger (`src/plugins/hook-agent-context.types.ts`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-idle-gate.d.ts","sourceRoot":"","sources":["../../../src/runtime/auto-update/register-idle-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"register-idle-gate.d.ts","sourceRoot":"","sources":["../../../src/runtime/auto-update/register-idle-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACnG,sHAAsH;IACtH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE;YACP,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,KAAK,OAAO,CAAC;SAChE,CAAC;KACH,CAAC;CACH;AAED,UAAU,UAAU;IAClB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAMD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAC5C,GAAG,EAAE,eAAe,CAAC;IACrB,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB,GAAG,OAAO,CA8EV;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,MAAM,CAAC;CACxB,GAAG,MAAM,CAYT"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
let previousUnsubscribe;
|
|
1
|
+
import { runtimeProcessState } from "../process-state.js";
|
|
3
2
|
function rec(value) {
|
|
4
3
|
return value && typeof value === "object" ? value : undefined;
|
|
5
4
|
}
|
|
@@ -57,7 +56,12 @@ export function registerIdleGateHooks(params) {
|
|
|
57
56
|
return false;
|
|
58
57
|
if (api.registrationMode !== undefined && api.registrationMode !== "full")
|
|
59
58
|
return false;
|
|
60
|
-
// A second registration in the same process replaces the first listener.
|
|
59
|
+
// A second full registration in the same process replaces the first listener. The handle is
|
|
60
|
+
// process state, not module scope: a 10.x plugin reload evaluates this module again, and a
|
|
61
|
+
// module-scope handle would start empty and leave the old listener (and its gate) subscribed.
|
|
62
|
+
const processState = runtimeProcessState();
|
|
63
|
+
const previousUnsubscribe = processState.idleGateUnsubscribe;
|
|
64
|
+
processState.idleGateUnsubscribe = undefined;
|
|
61
65
|
if (typeof previousUnsubscribe === "function") {
|
|
62
66
|
try {
|
|
63
67
|
previousUnsubscribe();
|
|
@@ -66,7 +70,7 @@ export function registerIdleGateHooks(params) {
|
|
|
66
70
|
// ignore
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
|
-
|
|
73
|
+
processState.idleGateUnsubscribe = onAgentEvent((event) => {
|
|
70
74
|
guard("lifecycle", () => {
|
|
71
75
|
const e = rec(event);
|
|
72
76
|
if (!e || e.stream !== "lifecycle")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-idle-gate.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/register-idle-gate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register-idle-gate.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/register-idle-gate.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAkB1D,SAAS,GAAG,CAAC,KAAc;IACzB,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAE,KAAiC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7F,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAKrC;IACC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IACnC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAc,EAAQ,EAAE;QACnD,IAAI,CAAC;YACH,EAAE,EAAE,CAAC;QACP,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,EAAE,IAAI,CACV,iCAAiC,IAAI,yBAAyB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACvH,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IAEF,GAAG,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,MAAe,EAAE,GAAY,EAAE,EAAE;QAC9D,KAAK,CAAC,qBAAqB,EAAE,GAAG,EAAE;YAChC,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACnB,IAAI,CAAC,CAAC;gBAAE,OAAO;YACf,IAAI,CAAC,eAAe,CAClB,CAAC,CAAC,KAAK,EACP,EAAE,OAAO,EAAE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AI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* On an OpenClaw 10.x host it refuses before running anything: 10.10 refuses
|
|
5
5
|
* `plugins update` while the gateway runs ("Plugin updates require the Gateway
|
|
6
|
-
* to be stopped", `openclaw-worktrees/v2026.10.10
|
|
6
|
+
* to be stopped", `openclaw-worktrees/v2026.10.10/src/cli/plugins-update-command.ts`)
|
|
7
7
|
* and its consent prompt needs a TTY, so the call could only fail. The 10.x
|
|
8
8
|
* path is restart-to-apply: the coordinator writes the install marker and the
|
|
9
9
|
* senpi-agent wrapper installs with the gateway down. The coordinator does not
|
|
@@ -29,7 +29,7 @@ const SAFE_NPM_NAME = /^(?:@[A-Za-z0-9._-]+\/)?[A-Za-z0-9._-]+(?:@[A-Za-z0-9][A-
|
|
|
29
29
|
*
|
|
30
30
|
* On an OpenClaw 10.x host it refuses before running anything: 10.10 refuses
|
|
31
31
|
* `plugins update` while the gateway runs ("Plugin updates require the Gateway
|
|
32
|
-
* to be stopped", `openclaw-worktrees/v2026.10.10
|
|
32
|
+
* to be stopped", `openclaw-worktrees/v2026.10.10/src/cli/plugins-update-command.ts`)
|
|
33
33
|
* and its consent prompt needs a TTY, so the call could only fail. The 10.x
|
|
34
34
|
* path is restart-to-apply: the coordinator writes the install marker and the
|
|
35
35
|
* senpi-agent wrapper installs with the gateway down. The coordinator does not
|
|
@@ -139,7 +139,8 @@ export interface AutoUpdateSnapshot {
|
|
|
139
139
|
/**
|
|
140
140
|
* OpenClaw 10.x only: why the pending update has not been applied yet, while `lastAction` is
|
|
141
141
|
* `pending-idle:<v>`. `spread` while the box waits for its offset; otherwise the idle gate's
|
|
142
|
-
* blockers (`user-run`, `user-queued`, `approval`, `order`, `recent-message
|
|
142
|
+
* blockers (`user-run`, `user-queued`, `approval`, `order`, `deploy`, `recent-message`,
|
|
143
|
+
* `recent-start`). Empty otherwise.
|
|
143
144
|
*/
|
|
144
145
|
pendingBlockers: string[];
|
|
145
146
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/auto-update/types.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC;AAE1D,oFAAoF;AACpF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAElE,0EAA0E;AAC1E,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,yEAAyE;IACzE,UAAU,EAAE,OAAO,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,6FAA6F;IAC7F,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAA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AAC;IACpC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC;;;;;OAKG;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,GAAG,iBAAiB,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE1F,sEAAsE;AACtE,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,yBAAyB,CAAC;IACnC,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,0EAA0E;AAC1E,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAc/D;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAmBxE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,MAAM,EACtB,aAAa,EAAE,cAAc,GAC5B,eAAe,CAUjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/types.ts"],"names":[],"mappings":"AA4KA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D,SAAS,MAAM,CAAC,KAAc,EAAE,QAAiB;IAC/C,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AACvD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAgB;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChF,CAAC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE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,CAAC;QAC7E,kBAAkB,EAAE,OAAO,GAAG,CAAC,kBAAkB,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;KACpG,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CAC1C,cAAsB,EACtB,aAA6B;IAE7B,OAAO;QACL,sBAAsB,EAAE,cAAc;QACtC,qBAAqB,EAAE,cAAc;QACrC,aAAa,EAAE,EAAE;QACjB,mBAAmB,EAAE,CAAC;QACtB,aAAa;QACb,iBAAiB,EAAE,SAAS;QAC5B,wBAAwB,EAAE,EAAE;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* limiter is 1/min per user). So each box waits a deterministic offset derived
|
|
7
7
|
* from its MID within a 6 h window, plus ±10 min of jitter, after it first sees
|
|
8
8
|
* a new version. If it never finds an idle moment, it forces the update 24 h
|
|
9
|
-
* after it became eligible, inside a fixed 03:00–05:00 UTC
|
|
10
|
-
* the forced path goes through the gateway's own restart deferral, so a reply
|
|
9
|
+
* after it became eligible, at its own moment inside a fixed 03:00–05:00 UTC
|
|
10
|
+
* quiet window. Even the forced path goes through the gateway's own restart deferral, so a reply
|
|
11
11
|
* in progress still finishes.
|
|
12
12
|
*
|
|
13
13
|
* Every function here is pure.
|
|
@@ -22,6 +22,11 @@ export declare const UPDATE_MAX_DEFERRAL_MS: number;
|
|
|
22
22
|
export declare const UPDATE_QUIET_START_HOUR_UTC = 3;
|
|
23
23
|
/** Quiet window end, UTC hour (exclusive). */
|
|
24
24
|
export declare const UPDATE_QUIET_END_HOUR_UTC = 5;
|
|
25
|
+
/**
|
|
26
|
+
* Width of the per-box forced moment inside the quiet window. 10 min short of the 2 h window, so a
|
|
27
|
+
* box re-reading its gate every 3 min always gets a read after its moment and before the window ends.
|
|
28
|
+
*/
|
|
29
|
+
export declare const UPDATE_FORCE_SPREAD_MS: number;
|
|
25
30
|
/**
|
|
26
31
|
* 32-bit FNV-1a over the UTF-8 bytes of `input`.
|
|
27
32
|
*
|
|
@@ -49,9 +54,14 @@ export declare function jitterMs(rand: () => number): number;
|
|
|
49
54
|
export declare function eligibleAt(firstSeenAt: number, mid: string, rand: () => number): number;
|
|
50
55
|
/** Whether `now` falls inside the 03:00–05:00 UTC quiet window. */
|
|
51
56
|
export declare function isInQuietWindow(now: number): boolean;
|
|
57
|
+
/** The box's deterministic delay after the quiet window opens before it may force an update. */
|
|
58
|
+
export declare function forceOffsetMs(mid: string): number;
|
|
52
59
|
/**
|
|
53
60
|
* Whether a busy box must update anyway: at least 24 h past `eligibleAtMs`
|
|
54
|
-
* **and** inside the quiet window
|
|
61
|
+
* **and** inside the quiet window **and** past the box's own moment in it, so
|
|
62
|
+
* every overdue box does not restart in the window's first minutes.
|
|
63
|
+
*
|
|
64
|
+
* @param mid - The box's stable identity; without one the moment is the window's start.
|
|
55
65
|
*/
|
|
56
|
-
export declare function mustForce(now: number, eligibleAtMs: number): boolean;
|
|
66
|
+
export declare function mustForce(now: number, eligibleAtMs: number, mid?: string): boolean;
|
|
57
67
|
//# sourceMappingURL=update-schedule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-schedule.d.ts","sourceRoot":"","sources":["../../../src/runtime/auto-update/update-schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,0CAA0C;AAC1C,eAAO,MAAM,uBAAuB,QAAkB,CAAC;AACvD,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,QAAc,CAAC;AAC5C,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,QAAmB,CAAC;AACvD,gDAAgD;AAChD,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,8CAA8C;AAC9C,eAAO,MAAM,yBAAyB,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"update-schedule.d.ts","sourceRoot":"","sources":["../../../src/runtime/auto-update/update-schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,0CAA0C;AAC1C,eAAO,MAAM,uBAAuB,QAAkB,CAAC;AACvD,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,QAAc,CAAC;AAC5C,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,QAAmB,CAAC;AACvD,gDAAgD;AAChD,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,8CAA8C;AAC9C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAC3C;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAe,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO7C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,MAAM,GAAG,MAAM,CAEvF;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAKlF"}
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* limiter is 1/min per user). So each box waits a deterministic offset derived
|
|
7
7
|
* from its MID within a 6 h window, plus ±10 min of jitter, after it first sees
|
|
8
8
|
* a new version. If it never finds an idle moment, it forces the update 24 h
|
|
9
|
-
* after it became eligible, inside a fixed 03:00–05:00 UTC
|
|
10
|
-
* the forced path goes through the gateway's own restart deferral, so a reply
|
|
9
|
+
* after it became eligible, at its own moment inside a fixed 03:00–05:00 UTC
|
|
10
|
+
* quiet window. Even the forced path goes through the gateway's own restart deferral, so a reply
|
|
11
11
|
* in progress still finishes.
|
|
12
12
|
*
|
|
13
13
|
* Every function here is pure.
|
|
@@ -22,6 +22,11 @@ export const UPDATE_MAX_DEFERRAL_MS = 24 * 60 * 60_000;
|
|
|
22
22
|
export const UPDATE_QUIET_START_HOUR_UTC = 3;
|
|
23
23
|
/** Quiet window end, UTC hour (exclusive). */
|
|
24
24
|
export const UPDATE_QUIET_END_HOUR_UTC = 5;
|
|
25
|
+
/**
|
|
26
|
+
* Width of the per-box forced moment inside the quiet window. 10 min short of the 2 h window, so a
|
|
27
|
+
* box re-reading its gate every 3 min always gets a read after its moment and before the window ends.
|
|
28
|
+
*/
|
|
29
|
+
export const UPDATE_FORCE_SPREAD_MS = 110 * 60_000;
|
|
25
30
|
/**
|
|
26
31
|
* 32-bit FNV-1a over the UTF-8 bytes of `input`.
|
|
27
32
|
*
|
|
@@ -65,11 +70,22 @@ export function isInQuietWindow(now) {
|
|
|
65
70
|
const hour = new Date(now).getUTCHours();
|
|
66
71
|
return hour >= UPDATE_QUIET_START_HOUR_UTC && hour < UPDATE_QUIET_END_HOUR_UTC;
|
|
67
72
|
}
|
|
73
|
+
/** The box's deterministic delay after the quiet window opens before it may force an update. */
|
|
74
|
+
export function forceOffsetMs(mid) {
|
|
75
|
+
return fnv1a32(mid) % UPDATE_FORCE_SPREAD_MS;
|
|
76
|
+
}
|
|
68
77
|
/**
|
|
69
78
|
* Whether a busy box must update anyway: at least 24 h past `eligibleAtMs`
|
|
70
|
-
* **and** inside the quiet window
|
|
79
|
+
* **and** inside the quiet window **and** past the box's own moment in it, so
|
|
80
|
+
* every overdue box does not restart in the window's first minutes.
|
|
81
|
+
*
|
|
82
|
+
* @param mid - The box's stable identity; without one the moment is the window's start.
|
|
71
83
|
*/
|
|
72
|
-
export function mustForce(now, eligibleAtMs) {
|
|
73
|
-
|
|
84
|
+
export function mustForce(now, eligibleAtMs, mid) {
|
|
85
|
+
if (now < eligibleAtMs + UPDATE_MAX_DEFERRAL_MS || !isInQuietWindow(now))
|
|
86
|
+
return false;
|
|
87
|
+
const date = new Date(now);
|
|
88
|
+
const opensAt = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), UPDATE_QUIET_START_HOUR_UTC);
|
|
89
|
+
return mid === undefined || now - opensAt >= forceOffsetMs(mid);
|
|
74
90
|
}
|
|
75
91
|
//# sourceMappingURL=update-schedule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-schedule.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/update-schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,0CAA0C;AAC1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;AACvD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,GAAG,MAAM,CAAC;AAC5C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;AACvD,gDAAgD;AAChD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAC7C,8CAA8C;AAC9C,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"update-schedule.js","sourceRoot":"","sources":["../../../src/runtime/auto-update/update-schedule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,0CAA0C;AAC1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC;AACvD,2DAA2D;AAC3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,GAAG,MAAM,CAAC;AAC5C,+EAA+E;AAC/E,M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AAI,2BAA2B,IAAI,IAAI,GAAG,yBAAyB,CAAC;AACjF,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,sBAAsB,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,YAAoB,EAAE,GAAY;IACvE,IAAI,GAAG,GAAG,YAAY,GAAG,sBAAsB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACvF,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,2BAA2B,CAAC,CAAC;IACpH,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG,OAAO,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-wide state the plugin must keep across a 10.x plugin reload, pinned on `globalThis`.
|
|
3
|
+
*
|
|
4
|
+
* OpenClaw 10.10 replaces a plugin whose `plugins.entries.<id>` changes (`reloadGatewayPlugins`)
|
|
5
|
+
* in the same gateway process, and it loads the replacement from a fresh source capture, so this
|
|
6
|
+
* module, `index.ts` and every class in them are evaluated again. A module-scope variable starts
|
|
7
|
+
* over; only `globalThis` is shared by every module copy (the reason `strategies-store.ts` pins its
|
|
8
|
+
* store there). What a reload must not forget lives here:
|
|
9
|
+
*
|
|
10
|
+
* - the deploy controller per deploys dir, and whether its boot scan ran: a re-registration must
|
|
11
|
+
* not stamp the deploy the previous registration is still running `interrupted`, and its
|
|
12
|
+
* `running()` / `inFlight()` must keep seeing that job so single-flight and the idle gate hold;
|
|
13
|
+
* - the trackers the self-update idle gate and the approval gate read (money calls, open
|
|
14
|
+
* approvals, run kinds), and the idle gate's own activity (user runs, subagents, queued and
|
|
15
|
+
* recent user messages), so an order, a prompt, a run or a message seen by the previous
|
|
16
|
+
* registration still counts after it; and the idle gate's lifecycle-listener handle, so a new
|
|
17
|
+
* registration unsubscribes the old listener instead of stacking one more per reload;
|
|
18
|
+
* - the approval gate's unclassified-block count that `senpi status` warns about;
|
|
19
|
+
* - the per-wallet install fence and the two locks that keep one change at a time: the per-runtime
|
|
20
|
+
* delete/apply lock and the registry-file lock. An install, apply or delete the previous
|
|
21
|
+
* registration started may still be running (a deploy job is not drained by a reload), and a
|
|
22
|
+
* second install on the same wallet, or an interleaved registry write, would break the
|
|
23
|
+
* one-runtime-per-wallet rule or drop a funded wallet's registry row;
|
|
24
|
+
* - the in-process order-call count, the facts-send lock and the 5.x notice latch.
|
|
25
|
+
*
|
|
26
|
+
* Only state lives here. Hooks, services and gateway methods are registered on each new `api`.
|
|
27
|
+
* Nothing held may write through an old registration's `api`: logging goes through
|
|
28
|
+
* {@link processLog}, which forwards to the latest full registration's logger.
|
|
29
|
+
*
|
|
30
|
+
* The held objects keep the class of the module copy that made them. That is safe while a reload
|
|
31
|
+
* loads the same code, which is the case this covers: an update installs new code and restarts the
|
|
32
|
+
* gateway, which starts a new process. A change to this shape must change {@link PROCESS_STATE_KEY}.
|
|
33
|
+
*/
|
|
34
|
+
import type { DeployJobController } from "../deploy/job.js";
|
|
35
|
+
import type { PendingApprovalTracker } from "../approvals/tool-approval-gate.js";
|
|
36
|
+
import type { TurnContextTracker } from "../approvals/turn-context.js";
|
|
37
|
+
import type { KeyedMutex } from "../utils/keyed-mutex.js";
|
|
38
|
+
import type { MoneyCallTracker } from "./auto-update/money-call-tracker.js";
|
|
39
|
+
import type { IdleGateActivity } from "./auto-update/idle-gate.js";
|
|
40
|
+
import type { ScannerRowLite } from "../deploy/orchestrator.js";
|
|
41
|
+
/** The logger shape the held objects write through. */
|
|
42
|
+
export interface ProcessLogger {
|
|
43
|
+
info(line: string): void;
|
|
44
|
+
warn(line: string): void;
|
|
45
|
+
error?(line: string): void;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* How a runtime an orphaned install started was settled (see {@link RuntimeHost}):
|
|
49
|
+
* - `running`: the live registration already runs a runtime on that id or wallet (`unwired` as
|
|
50
|
+
* its `unwiredRuntimes` records it);
|
|
51
|
+
* - `booted`: the live registration started the registry row itself (`unwired` as an install reports it);
|
|
52
|
+
* - `pending`: no live registration yet; the next service start boots the row;
|
|
53
|
+
* - `no-row`: the registry has no row under that id, so there is nothing to run;
|
|
54
|
+
* - `failed`: the live registration could not start the row; the next restart tries again.
|
|
55
|
+
*/
|
|
56
|
+
export type RuntimeHandOff = {
|
|
57
|
+
outcome: "running";
|
|
58
|
+
runtimeId: string;
|
|
59
|
+
unwired?: string;
|
|
60
|
+
} | {
|
|
61
|
+
outcome: "booted";
|
|
62
|
+
runtimeId: string;
|
|
63
|
+
unwired?: string;
|
|
64
|
+
} | {
|
|
65
|
+
outcome: "pending";
|
|
66
|
+
} | {
|
|
67
|
+
outcome: "no-row";
|
|
68
|
+
} | {
|
|
69
|
+
outcome: "failed";
|
|
70
|
+
message: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The registration whose service is running, as other registrations see it. An install that
|
|
74
|
+
* outlived its registration's service (a 10.x reload stopped it mid-install) hands its runtime here
|
|
75
|
+
* so the live registration owns and wires it, with its own api, hooks and logger.
|
|
76
|
+
*/
|
|
77
|
+
export interface RuntimeHost {
|
|
78
|
+
/**
|
|
79
|
+
* Make sure the registry row `runtimeId` runs in this registration: no-op when this registration
|
|
80
|
+
* already runs that id or a runtime on `walletKey` (folded), else start the row. Never throws.
|
|
81
|
+
*/
|
|
82
|
+
adoptRuntime(request: {
|
|
83
|
+
runtimeId: string;
|
|
84
|
+
walletKey: string;
|
|
85
|
+
}): Promise<RuntimeHandOff>;
|
|
86
|
+
/**
|
|
87
|
+
* The live registration's `deleteRuntimeCore`. A stopped registration forwards its deletes here:
|
|
88
|
+
* it holds no runtime handles, so its own delete would remove the row and archive the state dir
|
|
89
|
+
* while the live registration's runtime keeps trading.
|
|
90
|
+
*/
|
|
91
|
+
deleteRuntime(params: Record<string, unknown> | undefined): Promise<RuntimeDeleteResult>;
|
|
92
|
+
/** Whether the live registration runs `runtimeId` with its entry scanners wired (the deploy's H4 check). */
|
|
93
|
+
runtimeIsLive(runtimeId: string): Promise<boolean>;
|
|
94
|
+
/** The live registration's scanner rows for `runtimeId`, or null when it does not run it. */
|
|
95
|
+
getScannerRows(runtimeId: string): Promise<ScannerRowLite[] | null>;
|
|
96
|
+
}
|
|
97
|
+
/** What `deleteRuntimeCore` answers. */
|
|
98
|
+
export type RuntimeDeleteResult = {
|
|
99
|
+
ok: true;
|
|
100
|
+
payload: {
|
|
101
|
+
id: string;
|
|
102
|
+
};
|
|
103
|
+
} | {
|
|
104
|
+
ok: false;
|
|
105
|
+
error: {
|
|
106
|
+
code: string;
|
|
107
|
+
message: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
/** Everything one gateway process keeps across plugin registrations. */
|
|
111
|
+
export interface RuntimeProcessState {
|
|
112
|
+
/** The latest full registration's `api.logger`; {@link processLog} forwards to it. */
|
|
113
|
+
logger: ProcessLogger | null;
|
|
114
|
+
/** One deploy controller per deploys dir, reused by every registration in this process. */
|
|
115
|
+
deployControllers: Map<string, DeployJobController>;
|
|
116
|
+
/** Deploys dirs whose boot scan already ran in this process. */
|
|
117
|
+
bootScanned: Set<string>;
|
|
118
|
+
moneyCalls?: MoneyCallTracker;
|
|
119
|
+
pendingApprovals?: PendingApprovalTracker;
|
|
120
|
+
turnContext?: TurnContextTracker;
|
|
121
|
+
/** What the self-update idle gate has seen (user runs, subagents, user messages). */
|
|
122
|
+
idleGateActivity?: IdleGateActivity;
|
|
123
|
+
/** The unsubscribe handle of the idle gate's `onAgentEvent` lifecycle listener, from the last full registration. */
|
|
124
|
+
idleGateUnsubscribe?: unknown;
|
|
125
|
+
/** Gated calls the 10.x approval gate refused as `run_unclassified` in this process, and when the last was. */
|
|
126
|
+
unclassifiedBlocks: number;
|
|
127
|
+
lastUnclassifiedBlockAt?: string;
|
|
128
|
+
/**
|
|
129
|
+
* The wallets (folded) with a runtime install running in this process, and which runtime. The
|
|
130
|
+
* `[E_WALLET_INSTALL_IN_FLIGHT]` fence in `installRuntimeCore` and the reaper's delete check read it.
|
|
131
|
+
*/
|
|
132
|
+
installsInFlight: Map<string, {
|
|
133
|
+
runtimeId: string;
|
|
134
|
+
startedAtMs: number;
|
|
135
|
+
}>;
|
|
136
|
+
/** One delete or update apply per runtime id at a time (`runtimeChangeLock`). */
|
|
137
|
+
runtimeChangeLock?: KeyedMutex;
|
|
138
|
+
/** One registry-file writer per state dir at a time (`withRegistryLock`). */
|
|
139
|
+
registryLock?: KeyedMutex;
|
|
140
|
+
/** The registration whose service is running; set at the end of its start, cleared by its stop. */
|
|
141
|
+
runtimeHost: RuntimeHost | null;
|
|
142
|
+
/**
|
|
143
|
+
* Runtimes an orphaned install handed off while no registration was live, runtime id → folded
|
|
144
|
+
* wallet. The next {@link RuntimeHost} adopts them when its start publishes it.
|
|
145
|
+
*/
|
|
146
|
+
pendingRuntimeHandOffs: Map<string, string>;
|
|
147
|
+
/** One StrategyFacts send per runtime at a time, across registrations. */
|
|
148
|
+
factsSendLock?: KeyedMutex;
|
|
149
|
+
/** Whether the 5.x "cannot classify runs" notice was logged in this process. */
|
|
150
|
+
legacyTurnClassificationNoticeLogged: boolean;
|
|
151
|
+
/** The runtime's own order/close MCP calls in flight, across every module copy. */
|
|
152
|
+
orderCallsInFlight: number;
|
|
153
|
+
}
|
|
154
|
+
/** The process's state, created on first use. Every module copy reads and writes the same object. */
|
|
155
|
+
export declare function runtimeProcessState(): RuntimeProcessState;
|
|
156
|
+
/** Drops the process state, as a new process would start. Tests only. */
|
|
157
|
+
export declare function resetRuntimeProcessStateForTests(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Makes `logger` the sink {@link processLog} writes to. Called on every full registration, so a
|
|
160
|
+
* held object that outlives its registration (a running deploy) logs through the current one.
|
|
161
|
+
*/
|
|
162
|
+
export declare function bindProcessLogger(logger: ProcessLogger): void;
|
|
163
|
+
/**
|
|
164
|
+
* A logger that resolves the current registration's logger at each call. Never throws: it is the
|
|
165
|
+
* narration path of a running deploy, which a logger fault must not change.
|
|
166
|
+
*/
|
|
167
|
+
export declare const processLog: Required<ProcessLogger>;
|
|
168
|
+
//# sourceMappingURL=process-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-state.d.ts","sourceRoot":"","sources":["../../src/runtime/process-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,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AE,QAAQ,CAAC,aAAa,CAI9C,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-wide state the plugin must keep across a 10.x plugin reload, pinned on `globalThis`.
|
|
3
|
+
*
|
|
4
|
+
* OpenClaw 10.10 replaces a plugin whose `plugins.entries.<id>` changes (`reloadGatewayPlugins`)
|
|
5
|
+
* in the same gateway process, and it loads the replacement from a fresh source capture, so this
|
|
6
|
+
* module, `index.ts` and every class in them are evaluated again. A module-scope variable starts
|
|
7
|
+
* over; only `globalThis` is shared by every module copy (the reason `strategies-store.ts` pins its
|
|
8
|
+
* store there). What a reload must not forget lives here:
|
|
9
|
+
*
|
|
10
|
+
* - the deploy controller per deploys dir, and whether its boot scan ran: a re-registration must
|
|
11
|
+
* not stamp the deploy the previous registration is still running `interrupted`, and its
|
|
12
|
+
* `running()` / `inFlight()` must keep seeing that job so single-flight and the idle gate hold;
|
|
13
|
+
* - the trackers the self-update idle gate and the approval gate read (money calls, open
|
|
14
|
+
* approvals, run kinds), and the idle gate's own activity (user runs, subagents, queued and
|
|
15
|
+
* recent user messages), so an order, a prompt, a run or a message seen by the previous
|
|
16
|
+
* registration still counts after it; and the idle gate's lifecycle-listener handle, so a new
|
|
17
|
+
* registration unsubscribes the old listener instead of stacking one more per reload;
|
|
18
|
+
* - the approval gate's unclassified-block count that `senpi status` warns about;
|
|
19
|
+
* - the per-wallet install fence and the two locks that keep one change at a time: the per-runtime
|
|
20
|
+
* delete/apply lock and the registry-file lock. An install, apply or delete the previous
|
|
21
|
+
* registration started may still be running (a deploy job is not drained by a reload), and a
|
|
22
|
+
* second install on the same wallet, or an interleaved registry write, would break the
|
|
23
|
+
* one-runtime-per-wallet rule or drop a funded wallet's registry row;
|
|
24
|
+
* - the in-process order-call count, the facts-send lock and the 5.x notice latch.
|
|
25
|
+
*
|
|
26
|
+
* Only state lives here. Hooks, services and gateway methods are registered on each new `api`.
|
|
27
|
+
* Nothing held may write through an old registration's `api`: logging goes through
|
|
28
|
+
* {@link processLog}, which forwards to the latest full registration's logger.
|
|
29
|
+
*
|
|
30
|
+
* The held objects keep the class of the module copy that made them. That is safe while a reload
|
|
31
|
+
* loads the same code, which is the case this covers: an update installs new code and restarts the
|
|
32
|
+
* gateway, which starts a new process. A change to this shape must change {@link PROCESS_STATE_KEY}.
|
|
33
|
+
*/
|
|
34
|
+
const PROCESS_STATE_KEY = Symbol.for("senpi.runtime.processState.v1");
|
|
35
|
+
/** The process's state, created on first use. Every module copy reads and writes the same object. */
|
|
36
|
+
export function runtimeProcessState() {
|
|
37
|
+
const holder = globalThis;
|
|
38
|
+
holder[PROCESS_STATE_KEY] ??= {
|
|
39
|
+
logger: null,
|
|
40
|
+
deployControllers: new Map(),
|
|
41
|
+
bootScanned: new Set(),
|
|
42
|
+
installsInFlight: new Map(),
|
|
43
|
+
runtimeHost: null,
|
|
44
|
+
pendingRuntimeHandOffs: new Map(),
|
|
45
|
+
legacyTurnClassificationNoticeLogged: false,
|
|
46
|
+
orderCallsInFlight: 0,
|
|
47
|
+
unclassifiedBlocks: 0,
|
|
48
|
+
};
|
|
49
|
+
return holder[PROCESS_STATE_KEY];
|
|
50
|
+
}
|
|
51
|
+
/** Drops the process state, as a new process would start. Tests only. */
|
|
52
|
+
export function resetRuntimeProcessStateForTests() {
|
|
53
|
+
delete globalThis[PROCESS_STATE_KEY];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Makes `logger` the sink {@link processLog} writes to. Called on every full registration, so a
|
|
57
|
+
* held object that outlives its registration (a running deploy) logs through the current one.
|
|
58
|
+
*/
|
|
59
|
+
export function bindProcessLogger(logger) {
|
|
60
|
+
runtimeProcessState().logger = logger;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A logger that resolves the current registration's logger at each call. Never throws: it is the
|
|
64
|
+
* narration path of a running deploy, which a logger fault must not change.
|
|
65
|
+
*/
|
|
66
|
+
export const processLog = {
|
|
67
|
+
info: (line) => forward("info", line),
|
|
68
|
+
warn: (line) => forward("warn", line),
|
|
69
|
+
error: (line) => forward("error", line),
|
|
70
|
+
};
|
|
71
|
+
function forward(level, line) {
|
|
72
|
+
try {
|
|
73
|
+
const logger = runtimeProcessState().logger;
|
|
74
|
+
const write = logger?.[level] ?? logger?.warn;
|
|
75
|
+
write?.call(logger, line);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// Narration only.
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=process-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-state.js","sourceRoot":"","sources":["../../src/runtime/process-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAuGH,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AAEtE,qGAAqG;AACrG,MAAM,UAAU,mBAAmB;IACjC,MAAM,MAAM,GAAG,UAA2D,CAAC;IAC3E,MAAM,CAAC,iBAAiB,CAAC,KAAK;QAC5B,MAAM,EAAE,IAAI;QACZ,iBAAiB,EAAE,IAAI,GAAG,EAAE;QAC5B,WAAW,EAAE,IAAI,GAAG,EAAE;QACtB,gBAAgB,EAAE,IAAI,GAAG,EAAE;QAC3B,WAAW,EAAE,IAAI;QACjB,sBAAsB,EAAE,IAAI,GAAG,EAAE;QACjC,oCAAoC,EAAE,KAAK;QAC3C,kBAAkB,EAAE,CAAC;QACrB,kBAAkB,EAAE,CAAC;KACtB,CAAC;IACF,OAAO,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACnC,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,gCAAgC;IAC9C,OAAQ,UAA4D,CAAC,iBAAiB,CAAC,CAAC;AAC1F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAqB;IACrD,mBAAmB,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC;AACxC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAA4B;IACjD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;IACrC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;IACrC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;CACxC,CAAC;AAEF,SAAS,OAAO,CAAC,KAAgC,EAAE,IAAY;IAC7D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAC,MAAM,CAAC;QAC5C,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,MAAM,EAAE,IAAI,CAAC;QAC9C,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,kBAAkB;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconcile-state.d.ts","sourceRoot":"","sources":["../../src/runtime/reconcile-state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"reconcile-state.d.ts","sourceRoot":"","sources":["../../src/runtime/reconcile-state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mB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;;;;;;;;;GAWG;AACH,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,WAAW,EAClB,wBAAwB,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EAChE,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,CAmFf"}
|
|
@@ -8,6 +8,7 @@ import { stateKey } from "../state/index.js";
|
|
|
8
8
|
import { createLogger } from "../utils/logger.js";
|
|
9
9
|
import { withRetry } from "../utils/retry.js";
|
|
10
10
|
import { normalizeDslCoinDex } from "../utils/perp-coin.js";
|
|
11
|
+
import { recordDslDegradation } from "../telemetry/metrics.js";
|
|
11
12
|
const logger = createLogger("[senpi-core][reconcile]");
|
|
12
13
|
function positionKey(address, asset, dex) {
|
|
13
14
|
return `${address}:${asset}:${dex ?? ""}`;
|
|
@@ -15,7 +16,7 @@ function positionKey(address, asset, dex) {
|
|
|
15
16
|
async function resolveMissingPositionCloseReason(senpi, state, strategyState, strategyStateOnly) {
|
|
16
17
|
const slOrderId = state.slOrderId;
|
|
17
18
|
if (slOrderId == null)
|
|
18
|
-
return CLOSE_REASON.CLOSED_EXTERNALLY;
|
|
19
|
+
return { reason: CLOSE_REASON.CLOSED_EXTERNALLY, stopResting: false };
|
|
19
20
|
try {
|
|
20
21
|
const status = await withRetry(() => {
|
|
21
22
|
if (strategyState)
|
|
@@ -37,7 +38,8 @@ async function resolveMissingPositionCloseReason(senpi, state, strategyState, st
|
|
|
37
38
|
}),
|
|
38
39
|
});
|
|
39
40
|
if (status?.filled)
|
|
40
|
-
return CLOSE_REASON.EXCHANGE_SL_HIT;
|
|
41
|
+
return { reason: CLOSE_REASON.EXCHANGE_SL_HIT, stopResting: false };
|
|
42
|
+
return { reason: CLOSE_REASON.CLOSED_EXTERNALLY, stopResting: status?.status === "open" };
|
|
41
43
|
}
|
|
42
44
|
catch (err) {
|
|
43
45
|
logger.warn("reconcile: getOrderStatus failed while classifying missing position", {
|
|
@@ -47,7 +49,7 @@ async function resolveMissingPositionCloseReason(senpi, state, strategyState, st
|
|
|
47
49
|
err,
|
|
48
50
|
});
|
|
49
51
|
}
|
|
50
|
-
return CLOSE_REASON.CLOSED_EXTERNALLY;
|
|
52
|
+
return { reason: CLOSE_REASON.CLOSED_EXTERNALLY, stopResting: false };
|
|
51
53
|
}
|
|
52
54
|
export async function archiveGoneState(stateManager, senpi, state, opts) {
|
|
53
55
|
const ts = new Date().toISOString();
|
|
@@ -72,7 +74,7 @@ export async function archiveGoneState(stateManager, senpi, state, opts) {
|
|
|
72
74
|
outcome = "skipped";
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
75
|
-
const archivedCloseReason = await resolveMissingPositionCloseReason(senpi, state, opts?.strategyState, strategyStateOnly);
|
|
77
|
+
const { reason: archivedCloseReason, stopResting } = await resolveMissingPositionCloseReason(senpi, state, opts?.strategyState, strategyStateOnly);
|
|
76
78
|
const closedState = {
|
|
77
79
|
...state,
|
|
78
80
|
active: false,
|
|
@@ -86,6 +88,18 @@ export async function archiveGoneState(stateManager, senpi, state, opts) {
|
|
|
86
88
|
asset: state.asset,
|
|
87
89
|
closeReason: archivedCloseReason,
|
|
88
90
|
});
|
|
91
|
+
// The stop read `open` at archive time. The engine cancels it after the close fills,
|
|
92
|
+
// so this can be the gap before that cancel; a stop that stays is a leftover. The
|
|
93
|
+
// count makes either visible in telemetry, where a box log is not.
|
|
94
|
+
if (stopResting) {
|
|
95
|
+
logger.warn("reconcile: archived position's stop still resting at archive time", {
|
|
96
|
+
address: state.address,
|
|
97
|
+
asset: state.asset,
|
|
98
|
+
dex: normalizeDslCoinDex(state.asset, dex).dex,
|
|
99
|
+
slOrderId: state.slOrderId,
|
|
100
|
+
});
|
|
101
|
+
recordDslDegradation({ failure: "stop_resting_at_archive" });
|
|
102
|
+
}
|
|
89
103
|
if (opts?.bus) {
|
|
90
104
|
const tsEmit = new Date().toISOString();
|
|
91
105
|
// Dex only for a non-main book, so an xyz close is distinct from the same base coin on main.
|