@senpi/runtime 3.0.237 → 3.0.238

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
  2. package/dist/actions/close-position/close-position.action.js +15 -0
  3. package/dist/actions/close-position/close-position.action.js.map +1 -1
  4. package/dist/actions/llm-decision/openclaw-llm-decision.d.ts +25 -1
  5. package/dist/actions/llm-decision/openclaw-llm-decision.d.ts.map +1 -1
  6. package/dist/actions/llm-decision/openclaw-llm-decision.js +83 -15
  7. package/dist/actions/llm-decision/openclaw-llm-decision.js.map +1 -1
  8. package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
  9. package/dist/actions/open-position/open-position.action.js +15 -0
  10. package/dist/actions/open-position/open-position.action.js.map +1 -1
  11. package/dist/adapter/api-wrapper.d.ts +61 -0
  12. package/dist/adapter/api-wrapper.d.ts.map +1 -0
  13. package/dist/adapter/api-wrapper.js +92 -0
  14. package/dist/adapter/api-wrapper.js.map +1 -0
  15. package/dist/adapter/approvals-file.d.ts +35 -0
  16. package/dist/adapter/approvals-file.d.ts.map +1 -0
  17. package/dist/adapter/approvals-file.js +80 -0
  18. package/dist/adapter/approvals-file.js.map +1 -0
  19. package/dist/adapter/busy-file.d.ts +56 -0
  20. package/dist/adapter/busy-file.d.ts.map +1 -0
  21. package/dist/adapter/busy-file.js +86 -0
  22. package/dist/adapter/busy-file.js.map +1 -0
  23. package/dist/adapter/daemon-client.d.ts +37 -0
  24. package/dist/adapter/daemon-client.d.ts.map +1 -0
  25. package/dist/adapter/daemon-client.js +74 -0
  26. package/dist/adapter/daemon-client.js.map +1 -0
  27. package/dist/adapter/mode.d.ts +28 -0
  28. package/dist/adapter/mode.d.ts.map +1 -0
  29. package/dist/adapter/mode.js +42 -0
  30. package/dist/adapter/mode.js.map +1 -0
  31. package/dist/adapter/passthrough-cli.d.ts +30 -0
  32. package/dist/adapter/passthrough-cli.d.ts.map +1 -0
  33. package/dist/adapter/passthrough-cli.js +44 -0
  34. package/dist/adapter/passthrough-cli.js.map +1 -0
  35. package/dist/adapter/runtime-skill-cap.d.ts +13 -0
  36. package/dist/adapter/runtime-skill-cap.d.ts.map +1 -0
  37. package/dist/adapter/runtime-skill-cap.js +17 -0
  38. package/dist/adapter/runtime-skill-cap.js.map +1 -0
  39. package/dist/approvals/tool-approval-gate.d.ts +2 -0
  40. package/dist/approvals/tool-approval-gate.d.ts.map +1 -1
  41. package/dist/approvals/tool-approval-gate.js +5 -2
  42. package/dist/approvals/tool-approval-gate.js.map +1 -1
  43. package/dist/cli/daemon-call.d.ts +50 -0
  44. package/dist/cli/daemon-call.d.ts.map +1 -0
  45. package/dist/cli/daemon-call.js +165 -0
  46. package/dist/cli/daemon-call.js.map +1 -0
  47. package/dist/cli/guide-commands.d.ts.map +1 -1
  48. package/dist/cli/guide-commands.js +53 -17
  49. package/dist/cli/guide-commands.js.map +1 -1
  50. package/dist/cli/senpi-commands.d.ts +8 -6
  51. package/dist/cli/senpi-commands.d.ts.map +1 -1
  52. package/dist/cli/senpi-commands.js +101 -67
  53. package/dist/cli/senpi-commands.js.map +1 -1
  54. package/dist/cli/standalone.d.ts +24 -0
  55. package/dist/cli/standalone.d.ts.map +1 -0
  56. package/dist/cli/standalone.js +111 -0
  57. package/dist/cli/standalone.js.map +1 -0
  58. package/dist/cli/update-command.d.ts +7 -8
  59. package/dist/cli/update-command.d.ts.map +1 -1
  60. package/dist/cli/update-command.js +8 -33
  61. package/dist/cli/update-command.js.map +1 -1
  62. package/dist/daemon/api-version.d.ts +3 -0
  63. package/dist/daemon/api-version.d.ts.map +1 -0
  64. package/dist/daemon/api-version.js +3 -0
  65. package/dist/daemon/api-version.js.map +1 -0
  66. package/dist/daemon/errors.d.ts +36 -0
  67. package/dist/daemon/errors.d.ts.map +1 -0
  68. package/dist/daemon/errors.js +97 -0
  69. package/dist/daemon/errors.js.map +1 -0
  70. package/dist/daemon/host.d.ts +130 -0
  71. package/dist/daemon/host.d.ts.map +1 -0
  72. package/dist/daemon/host.js +202 -0
  73. package/dist/daemon/host.js.map +1 -0
  74. package/dist/daemon/http-routes.d.ts +37 -0
  75. package/dist/daemon/http-routes.d.ts.map +1 -0
  76. package/dist/daemon/http-routes.js +233 -0
  77. package/dist/daemon/http-routes.js.map +1 -0
  78. package/dist/daemon/main.d.ts +93 -0
  79. package/dist/daemon/main.d.ts.map +1 -0
  80. package/dist/daemon/main.js +308 -0
  81. package/dist/daemon/main.js.map +1 -0
  82. package/dist/daemon/mcp-endpoint.d.ts +55 -0
  83. package/dist/daemon/mcp-endpoint.d.ts.map +1 -0
  84. package/dist/daemon/mcp-endpoint.js +178 -0
  85. package/dist/daemon/mcp-endpoint.js.map +1 -0
  86. package/dist/daemon/memory.d.ts +29 -0
  87. package/dist/daemon/memory.d.ts.map +1 -0
  88. package/dist/daemon/memory.js +74 -0
  89. package/dist/daemon/memory.js.map +1 -0
  90. package/dist/daemon/owner-lock.d.ts +44 -0
  91. package/dist/daemon/owner-lock.d.ts.map +1 -0
  92. package/dist/daemon/owner-lock.js +149 -0
  93. package/dist/daemon/owner-lock.js.map +1 -0
  94. package/dist/daemon/request-ids.d.ts +48 -0
  95. package/dist/daemon/request-ids.d.ts.map +1 -0
  96. package/dist/daemon/request-ids.js +123 -0
  97. package/dist/daemon/request-ids.js.map +1 -0
  98. package/dist/daemon/route-table.d.ts +51 -0
  99. package/dist/daemon/route-table.d.ts.map +1 -0
  100. package/dist/daemon/route-table.js +120 -0
  101. package/dist/daemon/route-table.js.map +1 -0
  102. package/dist/daemon/telemetry-ws.d.ts +60 -0
  103. package/dist/daemon/telemetry-ws.d.ts.map +1 -0
  104. package/dist/daemon/telemetry-ws.js +166 -0
  105. package/dist/daemon/telemetry-ws.js.map +1 -0
  106. package/dist/daemon/update-request.d.ts +145 -0
  107. package/dist/daemon/update-request.d.ts.map +1 -0
  108. package/dist/daemon/update-request.js +250 -0
  109. package/dist/daemon/update-request.js.map +1 -0
  110. package/dist/deploy/package.d.ts +8 -0
  111. package/dist/deploy/package.d.ts.map +1 -1
  112. package/dist/deploy/package.js +8 -0
  113. package/dist/deploy/package.js.map +1 -1
  114. package/dist/deploy/recheck-commands.d.ts +2 -0
  115. package/dist/deploy/recheck-commands.d.ts.map +1 -1
  116. package/dist/deploy/recheck-commands.js +4 -0
  117. package/dist/deploy/recheck-commands.js.map +1 -1
  118. package/dist/deploy/sim-admission.d.ts +94 -0
  119. package/dist/deploy/sim-admission.d.ts.map +1 -0
  120. package/dist/deploy/sim-admission.js +138 -0
  121. package/dist/deploy/sim-admission.js.map +1 -0
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +174 -14
  124. package/dist/index.js.map +1 -1
  125. package/dist/runtime/agent-wake.d.ts +116 -0
  126. package/dist/runtime/agent-wake.d.ts.map +1 -0
  127. package/dist/runtime/agent-wake.js +181 -0
  128. package/dist/runtime/agent-wake.js.map +1 -0
  129. package/dist/runtime/auto-update/coordinator.d.ts +18 -0
  130. package/dist/runtime/auto-update/coordinator.d.ts.map +1 -1
  131. package/dist/runtime/auto-update/coordinator.js +80 -2
  132. package/dist/runtime/auto-update/coordinator.js.map +1 -1
  133. package/dist/runtime/auto-update/idle-gate.d.ts +12 -1
  134. package/dist/runtime/auto-update/idle-gate.d.ts.map +1 -1
  135. package/dist/runtime/auto-update/idle-gate.js +7 -4
  136. package/dist/runtime/auto-update/idle-gate.js.map +1 -1
  137. package/dist/runtime/create-actions.d.ts +5 -1
  138. package/dist/runtime/create-actions.d.ts.map +1 -1
  139. package/dist/runtime/create-actions.js +17 -2
  140. package/dist/runtime/create-actions.js.map +1 -1
  141. package/dist/runtime/decision-errors.d.ts +5 -0
  142. package/dist/runtime/decision-errors.d.ts.map +1 -1
  143. package/dist/runtime/decision-errors.js +10 -0
  144. package/dist/runtime/decision-errors.js.map +1 -1
  145. package/dist/runtime/recipe-file.d.ts +73 -0
  146. package/dist/runtime/recipe-file.d.ts.map +1 -0
  147. package/dist/runtime/recipe-file.js +194 -0
  148. package/dist/runtime/recipe-file.js.map +1 -0
  149. package/dist/runtime/runtime-descriptor.d.ts +23 -0
  150. package/dist/runtime/runtime-descriptor.d.ts.map +1 -1
  151. package/dist/runtime/runtime-descriptor.js +40 -0
  152. package/dist/runtime/runtime-descriptor.js.map +1 -1
  153. package/dist/runtime/runtime.d.ts +12 -0
  154. package/dist/runtime/runtime.d.ts.map +1 -1
  155. package/dist/runtime/runtime.js +109 -4
  156. package/dist/runtime/runtime.js.map +1 -1
  157. package/dist/runtime/update-apply-deps.d.ts +4 -2
  158. package/dist/runtime/update-apply-deps.d.ts.map +1 -1
  159. package/dist/runtime/update-apply-deps.js +4 -2
  160. package/dist/runtime/update-apply-deps.js.map +1 -1
  161. package/dist/runtime/update-handler.d.ts +6 -0
  162. package/dist/runtime/update-handler.d.ts.map +1 -1
  163. package/dist/runtime/update-handler.js +159 -12
  164. package/dist/runtime/update-handler.js.map +1 -1
  165. package/dist/runtime/update-register.d.ts.map +1 -1
  166. package/dist/runtime/update-register.js +18 -0
  167. package/dist/runtime/update-register.js.map +1 -1
  168. package/dist/runtime-api/extensions.d.ts +20 -0
  169. package/dist/runtime-api/extensions.d.ts.map +1 -0
  170. package/dist/runtime-api/extensions.js +28 -0
  171. package/dist/runtime-api/extensions.js.map +1 -0
  172. package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
  173. package/dist/runtime-api/intake/intake-mount.js +3 -1
  174. package/dist/runtime-api/intake/intake-mount.js.map +1 -1
  175. package/dist/runtime-api/lifecycle.d.ts.map +1 -1
  176. package/dist/runtime-api/lifecycle.js +6 -0
  177. package/dist/runtime-api/lifecycle.js.map +1 -1
  178. package/dist/runtime-api/server.d.ts.map +1 -1
  179. package/dist/runtime-api/server.js +3 -0
  180. package/dist/runtime-api/server.js.map +1 -1
  181. package/dist/scanners/external-scanner-receiver.d.ts +2 -0
  182. package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
  183. package/dist/scanners/external-scanner-receiver.js +4 -0
  184. package/dist/scanners/external-scanner-receiver.js.map +1 -1
  185. package/dist/telemetry/context.d.ts +17 -0
  186. package/dist/telemetry/context.d.ts.map +1 -1
  187. package/dist/telemetry/context.js.map +1 -1
  188. package/dist/telemetry/otel-sdk.d.ts +2 -0
  189. package/dist/telemetry/otel-sdk.d.ts.map +1 -1
  190. package/dist/telemetry/otel-sdk.js +2 -0
  191. package/dist/telemetry/otel-sdk.js.map +1 -1
  192. package/dist/types/scanner.d.ts +6 -0
  193. package/dist/types/scanner.d.ts.map +1 -1
  194. package/dist/validate/package-gates-stage.d.ts +13 -1
  195. package/dist/validate/package-gates-stage.d.ts.map +1 -1
  196. package/dist/validate/package-gates-stage.js +3 -8
  197. package/dist/validate/package-gates-stage.js.map +1 -1
  198. package/dist/validate/target.d.ts +75 -1
  199. package/dist/validate/target.d.ts.map +1 -1
  200. package/dist/validate/target.js +94 -28
  201. package/dist/validate/target.js.map +1 -1
  202. package/openclaw.plugin.json +1 -1
  203. package/package.json +8 -2
@@ -0,0 +1,120 @@
1
+ /**
2
+ * The daemon's HTTP API, as one table shared by the server (`http-routes.ts`), the `senpi` CLI
3
+ * (`senpi call`) and the adapter's gateway-method aliases.
4
+ *
5
+ * Every route calls the same gateway handler today's OpenClaw method uses, so answers are
6
+ * unchanged; only the transport differs. Paths follow the design's appendix. Reads whose handler
7
+ * accepts no `runtimeId` today also get a box-wide path (e.g. `/v1/positions`), so every call the
8
+ * CLI makes today has a route.
9
+ *
10
+ * Not exposed on purpose: `senpi.installRuntime` (deploy is the only create path),
11
+ * `senpi.ingestExternalScannerData` (dropped), `senpi.skills.*` (adapter),
12
+ * `senpi.telemetry.subscribe` (served on the 8788 feed listener).
13
+ */
14
+ const ADDR = { address: "string" };
15
+ export const ROUTES = [
16
+ // Deploy — the only create path.
17
+ { method: "senpi.deploy.start", http: "POST", path: "/v1/deploys", body: true, write: true, handlerOwnsRequestId: true, memoryGated: true },
18
+ { method: "senpi.deploy.status", http: "GET", path: "/v1/deploys/latest" },
19
+ { method: "senpi.deploy.status", http: "GET", path: "/v1/deploys/:deployId" },
20
+ // Strategy update: plan by default, apply with `apply: true`.
21
+ { method: "senpi.update", http: "POST", path: "/v1/runtimes/:id/update", body: true, write: true },
22
+ // List / delete.
23
+ { method: "senpi.listRuntimes", http: "GET", path: "/v1/runtimes" },
24
+ { method: "senpi.deleteRuntime", http: "DELETE", path: "/v1/runtimes/:id", query: { ...ADDR, deleteReason: "string", requestId: "string" }, write: true },
25
+ // DSL positions.
26
+ { method: "senpi.listDslPositions", http: "GET", path: "/v1/positions", query: { ...ADDR } },
27
+ { method: "senpi.listDslPositions", http: "GET", path: "/v1/runtimes/:runtimeId/positions", query: { ...ADDR } },
28
+ { method: "senpi.getDslPositionState", http: "GET", path: "/v1/runtimes/:runtimeId/positions/:asset", query: { ...ADDR } },
29
+ { method: "senpi.listDslArchives", http: "GET", path: "/v1/closed-positions", query: { ...ADDR, limit: "number" } },
30
+ { method: "senpi.listDslArchives", http: "GET", path: "/v1/runtimes/:runtimeId/closed-positions", query: { ...ADDR, limit: "number" } },
31
+ // Actions.
32
+ { method: "senpi.listActions", http: "GET", path: "/v1/actions", query: { ...ADDR, actionName: "string" } },
33
+ { method: "senpi.listActions", http: "GET", path: "/v1/runtimes/:runtimeId/actions", query: { ...ADDR, actionName: "string" } },
34
+ { method: "senpi.getActionState", http: "GET", path: "/v1/runtimes/:runtimeId/actions/:actionName", query: { ...ADDR } },
35
+ {
36
+ method: "senpi.getActionHistory",
37
+ http: "GET",
38
+ path: "/v1/runtimes/:runtimeId/actions/:actionName/history",
39
+ query: { ...ADDR, limit: "number", outcomeFilter: "string" },
40
+ },
41
+ // Audit, risk audit, events.
42
+ {
43
+ method: "senpi.auditQuery",
44
+ http: "GET",
45
+ path: "/v1/runtimes/:runtimeId/audit",
46
+ query: {
47
+ tool_name: "string",
48
+ action_type: "string",
49
+ success: "boolean",
50
+ start_time: "string",
51
+ end_time: "string",
52
+ limit: "number",
53
+ offset: "number",
54
+ },
55
+ },
56
+ { method: "senpi.getRiskAudit", http: "GET", path: "/v1/runtimes/:runtimeId/risk-audit", query: { ...ADDR, limit: "number" } },
57
+ {
58
+ method: "senpi.getEvents",
59
+ http: "GET",
60
+ path: "/v1/runtimes/:runtimeId/events",
61
+ query: { ...ADDR, name: "string", asset: "string", level: "string", since: "string", until: "string", limit: "number" },
62
+ },
63
+ // Health status and system state (the runtime's `senpi status` / `senpi state` reads).
64
+ { method: "senpi.getHealthStatus", http: "GET", path: "/v1/status" },
65
+ { method: "senpi.getHealthStatus", http: "GET", path: "/v1/runtimes/:runtimeId/status" },
66
+ { method: "senpi.getSystemState", http: "GET", path: "/v1/state" },
67
+ { method: "senpi.getSystemState", http: "GET", path: "/v1/runtimes/:runtimeId/state" },
68
+ // Updates: the daemon owns the check.
69
+ // A forced check can install a new version and restart: a write for `sent`.
70
+ { method: "senpi.autoUpdate.checkNow", http: "POST", path: "/v1/updates/check", body: true, write: true },
71
+ ];
72
+ /** Gateway methods the daemon serves (the adapter aliases exactly these). */
73
+ export const DAEMON_METHODS = [...new Set(ROUTES.map((r) => r.method))].sort();
74
+ /** Methods that exist on the plugin today and are deliberately not served by the daemon. */
75
+ export const NOT_SERVED_BY_DAEMON = {
76
+ "senpi.installRuntime": "not exposed: deploy is the only way to create a strategy",
77
+ "senpi.ingestExternalScannerData": "dropped: scanners post to /signals",
78
+ "senpi.skills.status": "served by the adapter's skills manager",
79
+ "senpi.skills.update": "served by the adapter's skills manager",
80
+ "senpi.skills.updateAll": "served by the adapter's skills manager",
81
+ "senpi.telemetry.subscribe": "served by the feed listener on 127.0.0.1:8788",
82
+ };
83
+ export function pathParamNames(path) {
84
+ return path
85
+ .split("/")
86
+ .filter((seg) => seg.startsWith(":"))
87
+ .map((seg) => seg.slice(1));
88
+ }
89
+ /**
90
+ * Client side (CLI `senpi call`, adapter aliases): turn a gateway method call into the HTTP
91
+ * request for it. Picks the most specific route whose path params are all present.
92
+ */
93
+ export function buildRequest(method, params = {}) {
94
+ const candidates = ROUTES.filter((r) => r.method === method)
95
+ .map((r) => ({ r, names: pathParamNames(r.path) }))
96
+ .filter(({ names }) => names.every((n) => params[n] !== undefined && params[n] !== null && params[n] !== ""))
97
+ .sort((a, b) => b.names.length - a.names.length);
98
+ const pick = candidates[0];
99
+ if (!pick)
100
+ return null;
101
+ const { r, names } = pick;
102
+ let url = r.path;
103
+ for (const n of names)
104
+ url = url.replace(`:${n}`, encodeURIComponent(String(params[n])));
105
+ const rest = {};
106
+ for (const [k, v] of Object.entries(params))
107
+ if (!names.includes(k))
108
+ rest[k] = v;
109
+ if (r.body)
110
+ return { http: r.http, url, body: rest, route: r };
111
+ const qs = new URLSearchParams();
112
+ for (const [k, v] of Object.entries(rest)) {
113
+ if (v === undefined || v === null)
114
+ continue;
115
+ qs.set(k, typeof v === "string" ? v : JSON.stringify(v));
116
+ }
117
+ const q = qs.toString();
118
+ return { http: r.http, url: q ? `${url}?${q}` : url, route: r };
119
+ }
120
+ //# sourceMappingURL=route-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-table.js","sourceRoot":"","sources":["../../src/daemon/route-table.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAuBH,MAAM,IAAI,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAW,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAyB;IAC1C,iCAAiC;IACjC,EAAE,MAAM,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE;IAC3I,EAAE,MAAM,EAAE,qBAAqB,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE;IAC1E,EAAE,MAAM,EAAE,qBAAqB,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAA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CAAC,CAAC;IACzF,MAAM,IAAI,GAA4B,EAAE,CAAC;IACzC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACjF,IAAI,CAAC,CAAC,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC/D,MAAM,EAAE,GAAG,IAAI,eAAe,EAAE,CAAC;IACjC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI;YAAE,SAAS;QAC5C,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IACxB,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAClE,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The daemon's live-feed listener: a read-only websocket on 127.0.0.1:8788.
3
+ *
4
+ * It serves only the scanner feed, so the feed keeps flowing while OpenClaw restarts or sleeps.
5
+ * The wrapper's `/telemetry` route and agent-bridge's line 2 connect here.
6
+ *
7
+ * Protocol: the same frames the browser gets from OpenClaw today, so agent-bridge can pass them
8
+ * through unchanged:
9
+ * → { "type": "req", "id", "method": "senpi.telemetry.subscribe", "params"? }
10
+ * ← { "type": "res", "id", "ok": true, "payload": { v, strategies, events } } (today's reply)
11
+ * ← { "type": "event", "event": "plugin.senpi.strategies" | "plugin.senpi.events", "payload" }
12
+ *
13
+ * - The subscribe reply comes from today's `senpi.telemetry.subscribe` handler, unchanged
14
+ * (snapshot, up to 80 events per strategy, epoch + seq cursor, PII scrubbed).
15
+ * - Live frames come from today's publishers through the host's `broadcast` (30 s strategies,
16
+ * 1 s events, frame cap and PII scrub applied by the publishers as today).
17
+ * - Read-only: any other method is refused. No token (nothing here can trade).
18
+ * - Lossy: a subscriber that cannot keep up has frames dropped, never slowing the others or
19
+ * growing memory without bound. A dropped `plugin.senpi.events` frame is not silent: before that
20
+ * subscriber's next frame it gets
21
+ * ← { "type": "event", "event": "plugin.senpi.resync",
22
+ * "payload": { "v": 1, "reason": "frames_dropped", "droppedEvents": n, "action": "resubscribe" } }
23
+ * so a client that does not check `seq` knows to subscribe again (the reply is a fresh snapshot
24
+ * and cursor). Dropped `plugin.senpi.strategies` frames need no marker: each one is a full
25
+ * snapshot and the next arrives within 30 s.
26
+ */
27
+ import type { BroadcastFn, HostLogger, InvokeResult } from "./host.js";
28
+ export declare const FEED_SUBSCRIBE_METHOD = "senpi.telemetry.subscribe";
29
+ export declare const FEED_EVENT_PREFIX = "plugin.senpi.";
30
+ export declare const DEFAULT_FEED_PORT = 8788;
31
+ /** Sent to a subscriber that missed `plugin.senpi.events` frames, before its next frame. */
32
+ export declare const FEED_RESYNC_EVENT = "plugin.senpi.resync";
33
+ /** Per-subscriber send buffer above which live frames are dropped for that subscriber. */
34
+ export declare const DEFAULT_MAX_BUFFERED_BYTES: number;
35
+ export interface FeedListenerOptions {
36
+ host?: string;
37
+ port?: number;
38
+ /** Calls today's subscribe handler (through the daemon host). */
39
+ subscribe(params: Record<string, unknown>): Promise<InvokeResult>;
40
+ /** Registers for the host's broadcasts; returns an unsubscribe. */
41
+ onBroadcast(fn: BroadcastFn): () => void;
42
+ logger: HostLogger;
43
+ /** A number, or a function read per frame (tests). */
44
+ maxBufferedBytes?: number | (() => number);
45
+ }
46
+ export interface FeedListenerStats {
47
+ listening: boolean;
48
+ host: string;
49
+ port: number;
50
+ connections: number;
51
+ subscribers: number;
52
+ droppedFrames: number;
53
+ }
54
+ export interface FeedListener {
55
+ readonly port: number;
56
+ stats(): FeedListenerStats;
57
+ close(): Promise<void>;
58
+ }
59
+ export declare function startFeedListener(opts: FeedListenerOptions): Promise<FeedListener>;
60
+ //# sourceMappingURL=telemetry-ws.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry-ws.d.ts","sourceRoot":"","sources":["../../src/daemon/telemetry-ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEvE,eAAO,MAAM,qBAAqB,8BAA8B,CAAC;AACjE,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AACjD,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,0FAA0F;AAC1F,eAAO,MAAM,0BAA0B,QAAc,CAAC;AAKtD,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClE,mEAAmE;IACnE,WAAW,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC;IACzC,MAAM,EAAE,UAAU,CAAC;IACnB,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,KAAK,IAAI,iBAAiB,CAAC;IAC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAcD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,CA6HxF"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * The daemon's live-feed listener: a read-only websocket on 127.0.0.1:8788.
3
+ *
4
+ * It serves only the scanner feed, so the feed keeps flowing while OpenClaw restarts or sleeps.
5
+ * The wrapper's `/telemetry` route and agent-bridge's line 2 connect here.
6
+ *
7
+ * Protocol: the same frames the browser gets from OpenClaw today, so agent-bridge can pass them
8
+ * through unchanged:
9
+ * → { "type": "req", "id", "method": "senpi.telemetry.subscribe", "params"? }
10
+ * ← { "type": "res", "id", "ok": true, "payload": { v, strategies, events } } (today's reply)
11
+ * ← { "type": "event", "event": "plugin.senpi.strategies" | "plugin.senpi.events", "payload" }
12
+ *
13
+ * - The subscribe reply comes from today's `senpi.telemetry.subscribe` handler, unchanged
14
+ * (snapshot, up to 80 events per strategy, epoch + seq cursor, PII scrubbed).
15
+ * - Live frames come from today's publishers through the host's `broadcast` (30 s strategies,
16
+ * 1 s events, frame cap and PII scrub applied by the publishers as today).
17
+ * - Read-only: any other method is refused. No token (nothing here can trade).
18
+ * - Lossy: a subscriber that cannot keep up has frames dropped, never slowing the others or
19
+ * growing memory without bound. A dropped `plugin.senpi.events` frame is not silent: before that
20
+ * subscriber's next frame it gets
21
+ * ← { "type": "event", "event": "plugin.senpi.resync",
22
+ * "payload": { "v": 1, "reason": "frames_dropped", "droppedEvents": n, "action": "resubscribe" } }
23
+ * so a client that does not check `seq` knows to subscribe again (the reply is a fresh snapshot
24
+ * and cursor). Dropped `plugin.senpi.strategies` frames need no marker: each one is a full
25
+ * snapshot and the next arrives within 30 s.
26
+ */
27
+ import { WebSocketServer, WebSocket } from "ws";
28
+ export const FEED_SUBSCRIBE_METHOD = "senpi.telemetry.subscribe";
29
+ export const FEED_EVENT_PREFIX = "plugin.senpi.";
30
+ export const DEFAULT_FEED_PORT = 8788;
31
+ /** Sent to a subscriber that missed `plugin.senpi.events` frames, before its next frame. */
32
+ export const FEED_RESYNC_EVENT = "plugin.senpi.resync";
33
+ const EVENTS_FRAME = "plugin.senpi.events";
34
+ /** Per-subscriber send buffer above which live frames are dropped for that subscriber. */
35
+ export const DEFAULT_MAX_BUFFERED_BYTES = 1024 * 1024;
36
+ const PING_INTERVAL_MS = 30_000;
37
+ /** Requests are tiny (a subscribe); anything bigger is not ours. */
38
+ const MAX_INCOMING_BYTES = 16 * 1024;
39
+ function send(ws, frame) {
40
+ if (ws.readyState === WebSocket.OPEN)
41
+ ws.send(JSON.stringify(frame));
42
+ }
43
+ export async function startFeedListener(opts) {
44
+ const host = opts.host ?? "127.0.0.1";
45
+ if (host !== "127.0.0.1") {
46
+ throw new Error(`[senpi-daemon] refusing to bind the feed listener to "${host}": it listens on 127.0.0.1 only`);
47
+ }
48
+ const limit = opts.maxBufferedBytes ?? DEFAULT_MAX_BUFFERED_BYTES;
49
+ const maxBuffered = () => (typeof limit === "function" ? limit() : limit);
50
+ const clients = new Set();
51
+ let droppedFrames = 0;
52
+ let listening = false;
53
+ const wss = new WebSocketServer({ host, port: opts.port ?? DEFAULT_FEED_PORT, maxPayload: MAX_INCOMING_BYTES });
54
+ await new Promise((resolve, reject) => {
55
+ wss.once("listening", () => resolve());
56
+ wss.once("error", reject);
57
+ });
58
+ listening = true;
59
+ const address = wss.address();
60
+ const port = typeof address === "object" && address ? address.port : (opts.port ?? DEFAULT_FEED_PORT);
61
+ wss.on("connection", (ws) => {
62
+ const client = { ws, subscribed: false, alive: true, missedEvents: 0 };
63
+ clients.add(client);
64
+ ws.on("pong", () => {
65
+ client.alive = true;
66
+ });
67
+ ws.on("close", () => clients.delete(client));
68
+ ws.on("error", () => clients.delete(client));
69
+ ws.on("message", (data) => {
70
+ void handleMessage(client, data);
71
+ });
72
+ });
73
+ async function handleMessage(client, data) {
74
+ let frame;
75
+ try {
76
+ frame = JSON.parse(data.toString());
77
+ }
78
+ catch {
79
+ return; // not JSON: not a request we answer
80
+ }
81
+ if (frame?.type !== "req" || typeof frame.id !== "string")
82
+ return;
83
+ const id = frame.id;
84
+ if (frame.method !== FEED_SUBSCRIBE_METHOD) {
85
+ send(client.ws, {
86
+ type: "res",
87
+ id,
88
+ ok: false,
89
+ error: { code: "METHOD_FORBIDDEN", message: `read-only feed: only ${FEED_SUBSCRIBE_METHOD} is served here` },
90
+ });
91
+ return;
92
+ }
93
+ const params = frame.params && typeof frame.params === "object" && !Array.isArray(frame.params)
94
+ ? frame.params
95
+ : {};
96
+ const result = await opts.subscribe(params);
97
+ if (result.ok) {
98
+ send(client.ws, { type: "res", id, ok: true, payload: result.payload });
99
+ client.subscribed = true;
100
+ // A fresh subscribe is a full resync: nothing missed is owed any more.
101
+ client.missedEvents = 0;
102
+ }
103
+ else {
104
+ send(client.ws, { type: "res", id, ok: false, error: result.error });
105
+ }
106
+ }
107
+ const offBroadcast = opts.onBroadcast((event, payload) => {
108
+ if (!event.startsWith(FEED_EVENT_PREFIX))
109
+ return;
110
+ let encoded;
111
+ for (const client of clients) {
112
+ if (!client.subscribed || client.ws.readyState !== WebSocket.OPEN)
113
+ continue;
114
+ if (client.ws.bufferedAmount > maxBuffered()) {
115
+ droppedFrames += 1;
116
+ if (event === EVENTS_FRAME)
117
+ client.missedEvents += 1;
118
+ continue;
119
+ }
120
+ if (client.missedEvents > 0) {
121
+ client.ws.send(JSON.stringify({
122
+ type: "event",
123
+ event: FEED_RESYNC_EVENT,
124
+ payload: { v: 1, reason: "frames_dropped", droppedEvents: client.missedEvents, action: "resubscribe" },
125
+ }));
126
+ client.missedEvents = 0;
127
+ }
128
+ encoded ??= JSON.stringify({ type: "event", event, payload });
129
+ client.ws.send(encoded);
130
+ }
131
+ });
132
+ const pinger = setInterval(() => {
133
+ for (const client of clients) {
134
+ if (!client.alive) {
135
+ client.ws.terminate();
136
+ clients.delete(client);
137
+ continue;
138
+ }
139
+ client.alive = false;
140
+ client.ws.ping();
141
+ }
142
+ }, PING_INTERVAL_MS);
143
+ pinger.unref();
144
+ opts.logger.info(`[senpi-daemon] feed listener on ${host}:${port}`);
145
+ return {
146
+ port,
147
+ stats: () => ({
148
+ listening,
149
+ host,
150
+ port,
151
+ connections: clients.size,
152
+ subscribers: [...clients].filter((c) => c.subscribed).length,
153
+ droppedFrames,
154
+ }),
155
+ close: async () => {
156
+ clearInterval(pinger);
157
+ offBroadcast();
158
+ for (const c of clients)
159
+ c.ws.terminate();
160
+ clients.clear();
161
+ await new Promise((resolve) => wss.close(() => resolve()));
162
+ listening = false;
163
+ },
164
+ };
165
+ }
166
+ //# sourceMappingURL=telemetry-ws.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry-ws.js","sourceRoot":"","sources":["../../src/daemon/telemetry-ws.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAgB,MAAM,IAAI,CAAC;AAG9D,MAAM,CAAC,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AACjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,4FAA4F;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AACvD,MAAM,YA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@@ -0,0 +1,145 @@
1
+ /**
2
+ * The daemon's side of runtime updates: it decides WHEN, the wrapper does the rest.
3
+ *
4
+ * - {@link requestRuntimeSwitch}: `POST {SENPI_WRAPPER_URL}/internal/runtime/switch {version}` with
5
+ * no token (the wrapper accepts it from loopback only). The wrapper answers 202 `{accepted: true, version}` at once, then installs,
6
+ * stops this process, switches `/data/runtime/current`, starts the new version and rolls back if
7
+ * it is not healthy. The outcome shows in the wrapper's `/setup/healthz` `runtime.lastUpdate`.
8
+ * - {@link createDaemonIdleGate}: today's idle gate trimmed to the daemon's own work. A daemon
9
+ * restart never cuts chat, so user turns, queued messages, the last user message and the process
10
+ * start do not count; a deploy running, the daemon's own money calls in flight, and a strategy
11
+ * install, update or delete in progress do.
12
+ * - {@link freshBoxCatchUp}: a daemon that starts with no strategies (a claimed warm slot, a new
13
+ * box) asks for the latest version on its line straight away, before it reports ready.
14
+ *
15
+ * The schedule (6 h spread with jitter, forced within 24 h in 03:00–05:00 UTC, never over money in
16
+ * motion), the hourly npm check on `SENPI_RUNTIME_NPM_SPEC` and the no-majors rule stay in
17
+ * `src/runtime/auto-update/` (the coordinator's `requestSwitch` path).
18
+ */
19
+ import { UpdateIdleGate, type IdleGateReader } from "../runtime/auto-update/idle-gate.js";
20
+ import type { VersionSource } from "../runtime/auto-update/version-source.js";
21
+ export declare const SWITCH_PATH = "/internal/runtime/switch";
22
+ /** How long the switch request may take; the wrapper answers 202 before it installs anything. */
23
+ export declare const SWITCH_REQUEST_TIMEOUT_MS = 15000;
24
+ export type FetchLike = (url: string, init: {
25
+ method: string;
26
+ headers: Record<string, string>;
27
+ body?: string;
28
+ signal?: AbortSignal;
29
+ }) => Promise<{
30
+ status: number;
31
+ text(): Promise<string>;
32
+ }>;
33
+ export interface SwitchRequestOptions {
34
+ /** `SENPI_WRAPPER_URL`, e.g. `http://127.0.0.1:8080`. */
35
+ wrapperUrl: string;
36
+ version: string;
37
+ fetchImpl?: FetchLike;
38
+ timeoutMs?: number;
39
+ }
40
+ /** The wrapper refused or could not be reached. */
41
+ export declare class SwitchRequestError extends Error {
42
+ readonly status?: number | undefined;
43
+ constructor(message: string, status?: number | undefined);
44
+ }
45
+ /** The wrapper URL from the env, only when it is loopback http (the endpoint is inside-box only). */
46
+ export declare function resolveWrapperUrl(env?: NodeJS.ProcessEnv): string | undefined;
47
+ /**
48
+ * Ask the wrapper to switch to `version`. Resolves on 202 `{accepted: true}`; throws
49
+ * {@link SwitchRequestError} on any other answer, a timeout or a connection failure.
50
+ */
51
+ export declare function requestRuntimeSwitch(opts: SwitchRequestOptions): Promise<{
52
+ version: string;
53
+ }>;
54
+ export interface DaemonIdleGateDeps {
55
+ /** The daemon's own Senpi money calls in flight (`senpiOrderCallsInFlight`). */
56
+ ordersInFlight: () => number;
57
+ /** A `senpi deploy` job is running (`DeployJobController.inFlight`). */
58
+ deploysInFlight: () => boolean;
59
+ /** Strategy installs, update applies and deletes in progress. */
60
+ runtimeChangesInFlight: () => number;
61
+ }
62
+ /** The daemon's update gate: only its own work blocks a switch. */
63
+ export declare function createDaemonIdleGate(deps: DaemonIdleGateDeps): UpdateIdleGate & IdleGateReader;
64
+ export type CatchUpOutcome = {
65
+ outcome: "not-fresh";
66
+ strategies: number;
67
+ } | {
68
+ outcome: "up-to-date";
69
+ latest: string;
70
+ } | {
71
+ outcome: "major-held";
72
+ latest: string;
73
+ } | {
74
+ outcome: "check-failed";
75
+ reason: string;
76
+ } | {
77
+ outcome: "no-wrapper";
78
+ } | {
79
+ outcome: "already-requested";
80
+ latest: string;
81
+ requestedAt: string;
82
+ } | {
83
+ outcome: "switch-failed";
84
+ latest: string;
85
+ reason: string;
86
+ }
87
+ /** Accepted, but this process was not stopped within the wait (or the wrapper reported it skipped/failed). */
88
+ | {
89
+ outcome: "requested-not-switched";
90
+ latest: string;
91
+ reason: string;
92
+ }
93
+ /** Accepted and the stop arrived (the abort signal fired): the caller exits for the new version. */
94
+ | {
95
+ outcome: "requested";
96
+ latest: string;
97
+ };
98
+ export interface CatchUpOptions {
99
+ /** Strategies registered on this box (registry rows). Only 0 is fresh. */
100
+ strategies: number;
101
+ currentVersion: string;
102
+ /** The npm spec the box tracks (`SENPI_RUNTIME_NPM_SPEC`, else the package name). */
103
+ spec: string;
104
+ versionSource: VersionSource;
105
+ /** Undefined when `SENPI_WRAPPER_URL` is missing or not loopback. */
106
+ requestSwitch?: (version: string) => Promise<void>;
107
+ /** Where the last catch-up request is remembered, so a rolled-back version is not asked for in a loop. */
108
+ stateFile: string;
109
+ /** Fires when the wrapper stops this process (SIGTERM). */
110
+ signal?: AbortSignal;
111
+ /** How long to wait for the wrapper's stop after it accepted (default 5 min). */
112
+ waitForStopMs?: number;
113
+ /** Optional early end: the wrapper's `runtime.lastUpdate` says this version was skipped or failed. */
114
+ readLastUpdate?: () => Promise<{
115
+ version?: string;
116
+ result?: string;
117
+ at?: string;
118
+ } | undefined>;
119
+ /** Cap on one `readLastUpdate` call (default {@link WRAPPER_HEALTH_READ_TIMEOUT_MS}). */
120
+ healthReadTimeoutMs?: number;
121
+ now?: () => number;
122
+ sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
123
+ logger?: {
124
+ info(msg: string): void;
125
+ warn(msg: string): void;
126
+ };
127
+ }
128
+ /** A repeat request for the same version is skipped for this long (the wrapper's rollback window). */
129
+ export declare const CATCH_UP_REPEAT_MS: number;
130
+ export declare const CATCH_UP_WAIT_FOR_STOP_MS: number;
131
+ /**
132
+ * A fresh daemon (no strategies) catches up to the latest version on its line before it reports
133
+ * ready. Never a major. Every failure is reported and the daemon starts on the version it has: a
134
+ * new box must not be left without a runtime because npm or the wrapper had a bad minute.
135
+ */
136
+ export declare function freshBoxCatchUp(opts: CatchUpOptions): Promise<CatchUpOutcome>;
137
+ /** Reads the wrapper's `runtime.lastUpdate` from `/setup/healthz`; undefined on any failure. */
138
+ /** How long one wrapper health read may take in the fresh-box wait; a hung read counts as no answer. */
139
+ export declare const WRAPPER_HEALTH_READ_TIMEOUT_MS = 5000;
140
+ export declare function wrapperLastUpdateReader(wrapperUrl: string, fetchImpl?: FetchLike, timeoutMs?: number): () => Promise<{
141
+ version?: string;
142
+ result?: string;
143
+ at?: string;
144
+ } | undefined>;
145
+ //# sourceMappingURL=update-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-request.d.ts","sourceRoot":"","sources":["../../src/daemon/update-request.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,iGAAiG;AACjG,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KAAK,OAAO,CAAC;IAC/I,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC,CAAC;AAEH,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,mDAAmD;AACnD,qBAAa,kBAAmB,SAAQ,KAAK;IACd,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;gBAAzC,OAAO,EAAE,MAAM,EAAW,MAAM,CAAC,EAAE,MAAM,YAAA;CAItD;AAED,qGAAqG;AACrG,wBAAgB,iBAA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