@senpi/runtime 1.0.95-dev.runtime-phase-2-api.20260505163136 → 1.0.95-dev.runtime-phase-2.20260506193916

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 (107) hide show
  1. package/README.md +0 -13
  2. package/dist/dsl/events/handlers.d.ts +2 -1
  3. package/dist/dsl/events/handlers.d.ts.map +1 -1
  4. package/dist/dsl/events/handlers.js +3 -0
  5. package/dist/dsl/events/handlers.js.map +1 -1
  6. package/dist/dsl/plugin/index.d.ts +1 -1
  7. package/dist/dsl/plugin/index.d.ts.map +1 -1
  8. package/dist/dsl/plugin/index.js.map +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +90 -161
  11. package/dist/index.js.map +1 -1
  12. package/dist/runtime/auto-update/coordinator.d.ts +8 -12
  13. package/dist/runtime/auto-update/coordinator.d.ts.map +1 -1
  14. package/dist/runtime/auto-update/coordinator.js +17 -18
  15. package/dist/runtime/auto-update/coordinator.js.map +1 -1
  16. package/dist/runtime/auto-update/gateway-restart.d.ts +2 -9
  17. package/dist/runtime/auto-update/gateway-restart.d.ts.map +1 -1
  18. package/dist/runtime/auto-update/gateway-restart.js +13 -23
  19. package/dist/runtime/auto-update/gateway-restart.js.map +1 -1
  20. package/dist/runtime/create-actions.d.ts.map +1 -1
  21. package/dist/runtime/create-actions.js +2 -13
  22. package/dist/runtime/create-actions.js.map +1 -1
  23. package/dist/runtime/run.d.ts +1 -47
  24. package/dist/runtime/run.d.ts.map +1 -1
  25. package/dist/runtime/run.js +0 -9
  26. package/dist/runtime/run.js.map +1 -1
  27. package/dist/runtime/runtime.d.ts +3 -58
  28. package/dist/runtime/runtime.d.ts.map +1 -1
  29. package/dist/runtime/runtime.js +7 -172
  30. package/dist/runtime/runtime.js.map +1 -1
  31. package/dist/senpi/client.d.ts +2 -92
  32. package/dist/senpi/client.d.ts.map +1 -1
  33. package/dist/senpi/client.js +8 -181
  34. package/dist/senpi/client.js.map +1 -1
  35. package/dist/tracking/constants.d.ts.map +1 -1
  36. package/dist/tracking/constants.js +4 -0
  37. package/dist/tracking/constants.js.map +1 -1
  38. package/dist/tracking/index.d.ts +1 -0
  39. package/dist/tracking/index.d.ts.map +1 -1
  40. package/dist/tracking/index.js +1 -0
  41. package/dist/tracking/index.js.map +1 -1
  42. package/dist/tracking/plugin-event-tracker.d.ts +13 -0
  43. package/dist/tracking/plugin-event-tracker.d.ts.map +1 -0
  44. package/dist/tracking/plugin-event-tracker.js +27 -0
  45. package/dist/tracking/plugin-event-tracker.js.map +1 -0
  46. package/openclaw.plugin.json +0 -24
  47. package/package.json +2 -6
  48. package/dist/runtime/audit-query.types.d.ts +0 -113
  49. package/dist/runtime/audit-query.types.d.ts.map +0 -1
  50. package/dist/runtime/audit-query.types.js +0 -35
  51. package/dist/runtime/audit-query.types.js.map +0 -1
  52. package/dist/runtime-api/config.d.ts +0 -47
  53. package/dist/runtime-api/config.d.ts.map +0 -1
  54. package/dist/runtime-api/config.js +0 -74
  55. package/dist/runtime-api/config.js.map +0 -1
  56. package/dist/runtime-api/handlers/audit.d.ts +0 -76
  57. package/dist/runtime-api/handlers/audit.d.ts.map +0 -1
  58. package/dist/runtime-api/handlers/audit.js +0 -63
  59. package/dist/runtime-api/handlers/audit.js.map +0 -1
  60. package/dist/runtime-api/handlers/group-by-scanner.d.ts +0 -43
  61. package/dist/runtime-api/handlers/group-by-scanner.d.ts.map +0 -1
  62. package/dist/runtime-api/handlers/group-by-scanner.js +0 -43
  63. package/dist/runtime-api/handlers/group-by-scanner.js.map +0 -1
  64. package/dist/runtime-api/handlers/ingest-signals.d.ts +0 -54
  65. package/dist/runtime-api/handlers/ingest-signals.d.ts.map +0 -1
  66. package/dist/runtime-api/handlers/ingest-signals.js +0 -134
  67. package/dist/runtime-api/handlers/ingest-signals.js.map +0 -1
  68. package/dist/runtime-api/handlers/lookup.d.ts +0 -36
  69. package/dist/runtime-api/handlers/lookup.d.ts.map +0 -1
  70. package/dist/runtime-api/handlers/lookup.js +0 -31
  71. package/dist/runtime-api/handlers/lookup.js.map +0 -1
  72. package/dist/runtime-api/handlers/types.d.ts +0 -80
  73. package/dist/runtime-api/handlers/types.d.ts.map +0 -1
  74. package/dist/runtime-api/handlers/types.js +0 -8
  75. package/dist/runtime-api/handlers/types.js.map +0 -1
  76. package/dist/runtime-api/lifecycle.d.ts +0 -98
  77. package/dist/runtime-api/lifecycle.d.ts.map +0 -1
  78. package/dist/runtime-api/lifecycle.js +0 -137
  79. package/dist/runtime-api/lifecycle.js.map +0 -1
  80. package/dist/runtime-api/readiness.d.ts +0 -37
  81. package/dist/runtime-api/readiness.d.ts.map +0 -1
  82. package/dist/runtime-api/readiness.js +0 -35
  83. package/dist/runtime-api/readiness.js.map +0 -1
  84. package/dist/runtime-api/routes/audit.d.ts +0 -40
  85. package/dist/runtime-api/routes/audit.d.ts.map +0 -1
  86. package/dist/runtime-api/routes/audit.js +0 -82
  87. package/dist/runtime-api/routes/audit.js.map +0 -1
  88. package/dist/runtime-api/routes/audit.schema.d.ts +0 -75
  89. package/dist/runtime-api/routes/audit.schema.d.ts.map +0 -1
  90. package/dist/runtime-api/routes/audit.schema.js +0 -78
  91. package/dist/runtime-api/routes/audit.schema.js.map +0 -1
  92. package/dist/runtime-api/routes/health.d.ts +0 -53
  93. package/dist/runtime-api/routes/health.d.ts.map +0 -1
  94. package/dist/runtime-api/routes/health.js +0 -48
  95. package/dist/runtime-api/routes/health.js.map +0 -1
  96. package/dist/runtime-api/routes/signals.d.ts +0 -50
  97. package/dist/runtime-api/routes/signals.d.ts.map +0 -1
  98. package/dist/runtime-api/routes/signals.js +0 -65
  99. package/dist/runtime-api/routes/signals.js.map +0 -1
  100. package/dist/runtime-api/routes/signals.schema.d.ts +0 -94
  101. package/dist/runtime-api/routes/signals.schema.d.ts.map +0 -1
  102. package/dist/runtime-api/routes/signals.schema.js +0 -58
  103. package/dist/runtime-api/routes/signals.schema.js.map +0 -1
  104. package/dist/runtime-api/server.d.ts +0 -79
  105. package/dist/runtime-api/server.d.ts.map +0 -1
  106. package/dist/runtime-api/server.js +0 -105
  107. package/dist/runtime-api/server.js.map +0 -1
@@ -1,134 +0,0 @@
1
- /**
2
- * Shared ingest handler for `POST /signals`.
3
- *
4
- * Called by the HTTP route (S4) and the gateway-method shim (S6). Contains
5
- * all business logic for one ingest item — lookup, validation, execution, and
6
- * error translation — so neither transport duplicates logic.
7
- */
8
- import { ExternalScannerIngestError, } from "../../scanners/external-scanner-receiver.js";
9
- import { findRuntimeHandleByAddress } from "./lookup.js";
10
- /**
11
- * Ingest one signal item.
12
- *
13
- * Looks up the runtime by address, validates handler-level constraints, calls
14
- * `RuntimeHandle.ingestExternalScannerData`, and translates all error shapes
15
- * into the uniform `{ success: false, code, message }` discriminant. Never
16
- * throws — all error paths return a `SignalResult`.
17
- *
18
- * Validation rules (beyond TypeBox):
19
- * - At least one of `asset`, `data`, or `signals` must be present; an item
20
- * with none of those fields has nothing to ingest → `INVALID_REQUEST`.
21
- * - `data` and `signals` are mutually exclusive → `INVALID_REQUEST`.
22
- * (The runtime also enforces this, but we check early to surface a clear
23
- * message before the engine lock is acquired.)
24
- *
25
- * Per-(address, scanner) ingest lock is the engine's concern; callers should
26
- * use {@link groupByAddressScanner} or nest multiple signals in `signals[]`
27
- * rather than submitting concurrent top-level items for the same key.
28
- *
29
- * @param item A single element from the `POST /signals` request body.
30
- * @param deps Injected dependencies.
31
- * @returns A resolved `SignalResult` — never rejects.
32
- */
33
- export async function ingestSignalsHandler(item, deps) {
34
- const address = item.address.toLowerCase();
35
- const { scanner } = item;
36
- // --- Handler-level validation ---
37
- const hasAsset = item.asset !== undefined;
38
- const hasData = item.data !== undefined;
39
- const hasSignals = item.signals !== undefined;
40
- if (!hasAsset && !hasData && !hasSignals) {
41
- return {
42
- success: false,
43
- address,
44
- scanner,
45
- code: "INVALID_REQUEST",
46
- message: "Signal item must include at least one of: asset, data, or signals.",
47
- };
48
- }
49
- if (hasData && hasSignals) {
50
- return {
51
- success: false,
52
- address,
53
- scanner,
54
- code: "INVALID_REQUEST",
55
- message: "Signal item must not include both data and signals — they are mutually exclusive.",
56
- };
57
- }
58
- // --- Runtime lookup ---
59
- const lookup = findRuntimeHandleByAddress(deps.runtimeHandles, address);
60
- if (!lookup.found) {
61
- return {
62
- success: false,
63
- address,
64
- scanner,
65
- code: "NOT_FOUND",
66
- message: lookup.message,
67
- };
68
- }
69
- const { handle } = lookup;
70
- // --- Build the ingest request (address stays at the routing layer) ---
71
- const request = {
72
- scanner: item.scanner,
73
- ...(item.asset !== undefined && { asset: item.asset }),
74
- ...(item.direction !== undefined && { direction: item.direction }),
75
- ...(item.score !== undefined && { score: item.score }),
76
- ...(item.signal_type !== undefined && { signal_type: item.signal_type }),
77
- ...(item.data !== undefined && { data: item.data }),
78
- ...(item.signals !== undefined && { signals: item.signals }),
79
- };
80
- // --- Dispatch ---
81
- console.info("[senpi-runtime] [ingest-trace] /signals handler dispatching", JSON.stringify({
82
- address,
83
- scanner,
84
- transport: deps.transport,
85
- hasAsset,
86
- hasData,
87
- hasSignals,
88
- dataKeys: hasData ? Object.keys(item.data) : [],
89
- }));
90
- try {
91
- const result = await handle.ingestExternalScannerData(request);
92
- // TODO(s11): emit runtime.signals_ingested with transport=deps.transport
93
- console.info("[senpi-runtime] [ingest-trace] /signals handler dispatch ok", JSON.stringify({ address, scanner, signalCount: result.signalCount, contextUpdated: result.contextUpdated }));
94
- return {
95
- success: true,
96
- address,
97
- scanner,
98
- timestamp: result.timestamp,
99
- signalCount: result.signalCount,
100
- contextUpdated: result.contextUpdated,
101
- };
102
- }
103
- catch (err) {
104
- console.info("[senpi-runtime] [ingest-trace] /signals handler dispatch THREW", JSON.stringify({
105
- address,
106
- scanner,
107
- errType: err instanceof Error ? err.constructor.name : typeof err,
108
- message: err instanceof Error ? err.message : String(err),
109
- }));
110
- if (err instanceof ExternalScannerIngestError) {
111
- return {
112
- success: false,
113
- address,
114
- scanner,
115
- code: err.code,
116
- message: err.message,
117
- };
118
- }
119
- // Unexpected throw — do not add a new INTERNAL code; map to UNAVAILABLE
120
- // per Section 5 plan: "reuse INVALID_REQUEST | NOT_FOUND | UNAVAILABLE".
121
- const message = err instanceof Error
122
- ? err.message
123
- : `Unexpected ingest error: ${String(err)}`;
124
- deps.logger.error("[senpi-core][runtime-api][ingest-signals] Unexpected error during ingest", { address, scanner, transport: deps.transport, err });
125
- return {
126
- success: false,
127
- address,
128
- scanner,
129
- code: "UNAVAILABLE",
130
- message,
131
- };
132
- }
133
- }
134
- //# sourceMappingURL=ingest-signals.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ingest-signals.js","sourceRoot":"","sources":["../../../src/runtime-api/handlers/ingest-signals.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,0BAA0B,GAE3B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAyBzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAgB,EAChB,IAAuB;IAEvB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAC3C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB,mCAAmC;IAEnC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC;IAE9C,IAAI,CAAC,QAAQ,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;QACzC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO;YACP,OAAO;YACP,IAAI,EAAE,iBAAiB;YACvB,OAAO,EACL,oEAAoE;SACvE,CAAC;IACJ,CAAC;IAED,IAA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BACP,OAAO;gBACP,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,OAAO,EAAE,GAAG,CAAC,OAAO;aACrB,CAAC;QACJ,CAAC;QAED,wEAAwE;QACxE,yEAAyE;QACzE,MAAM,OAAO,GACX,GAAG,YAAY,KAAK;YAClB,CAAC,CAAC,GAAG,CAAC,OAAO;YACb,CAAC,CAAC,4BAA4B,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,0EAA0E,EAC1E,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CACrD,CAAC;QACF,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO;YACP,OAAO;YACP,IAAI,EAAE,aAAa;YACnB,OAAO;SACR,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,36 +0,0 @@
1
- /**
2
- * Pure helper for resolving a running runtime handle by wallet address.
3
- *
4
- * Extracted from `getRuntimeHandleByAddressOrRespond` in `src/index.ts` so
5
- * both the HTTP route layer (S4) and the gateway shim (S6) can share the
6
- * lookup logic without the respond-on-error side-effect.
7
- */
8
- import type { RuntimeHandle } from "../../runtime/run.js";
9
- /**
10
- * Discriminated result of a handle lookup.
11
- *
12
- * Use `found` to narrow:
13
- * - `true` → `runtimeId` and `handle` are available.
14
- * - `false` → `code` is always `"NOT_FOUND"` and `message` describes the miss.
15
- */
16
- export type LookupResult = {
17
- found: true;
18
- runtimeId: string;
19
- handle: RuntimeHandle;
20
- } | {
21
- found: false;
22
- code: "NOT_FOUND";
23
- message: string;
24
- };
25
- /**
26
- * Find a running runtime by lowercased wallet address.
27
- *
28
- * Matches case-insensitively — wallet addresses from the runtime's strategy
29
- * config may differ in capitalisation from caller-supplied values.
30
- *
31
- * @param handles The live map maintained by the plugin (`runtimeHandles`).
32
- * @param address Wallet address to search for. Case is normalised internally.
33
- * @returns A discriminated union; never throws.
34
- */
35
- export declare function findRuntimeHandleByAddress(handles: Map<string, RuntimeHandle>, address: string): LookupResult;
36
- //# sourceMappingURL=lookup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../../src/runtime-api/handlers/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,GACzD;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EACnC,OAAO,EAAE,MAAM,GACd,YAAY,CAYd"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Pure helper for resolving a running runtime handle by wallet address.
3
- *
4
- * Extracted from `getRuntimeHandleByAddressOrRespond` in `src/index.ts` so
5
- * both the HTTP route layer (S4) and the gateway shim (S6) can share the
6
- * lookup logic without the respond-on-error side-effect.
7
- */
8
- /**
9
- * Find a running runtime by lowercased wallet address.
10
- *
11
- * Matches case-insensitively — wallet addresses from the runtime's strategy
12
- * config may differ in capitalisation from caller-supplied values.
13
- *
14
- * @param handles The live map maintained by the plugin (`runtimeHandles`).
15
- * @param address Wallet address to search for. Case is normalised internally.
16
- * @returns A discriminated union; never throws.
17
- */
18
- export function findRuntimeHandleByAddress(handles, address) {
19
- const normalizedAddress = address.toLowerCase();
20
- for (const [runtimeId, handle] of handles) {
21
- if (handle.wallet.toLowerCase() === normalizedAddress) {
22
- return { found: true, runtimeId, handle };
23
- }
24
- }
25
- return {
26
- found: false,
27
- code: "NOT_FOUND",
28
- message: `No running runtime found for wallet address "${address}".`,
29
- };
30
- }
31
- //# sourceMappingURL=lookup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../src/runtime-api/handlers/lookup.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAmC,EACnC,OAAe;IAEf,MAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAChD,KAAK,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QAC1C,IAAI,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,iBAAiB,EAAE,CAAC;YACtD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;QAC5C,CAAC;IACH,CAAC;IACD,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,gDAAgD,OAAO,IAAI;KACrE,CAAC;AACJ,CAAC"}
@@ -1,80 +0,0 @@
1
- /**
2
- * Transport-agnostic type definitions shared by all `src/runtime-api/handlers/`
3
- * modules and the route layer that consumes them.
4
- *
5
- * No Fastify imports. No side-effects.
6
- */
7
- import type { ExternalScannerIngestSignalItem, ExternalScannerIngestErrorCode } from "../../scanners/external-scanner-receiver.js";
8
- import type { Signal } from "../../scanners/types.js";
9
- /**
10
- * Per-item shape accepted by `POST /signals`.
11
- *
12
- * Mirrors {@link ExternalScannerIngestRequest} with `address` lifted to the
13
- * item level so a single request body can target multiple wallets.
14
- *
15
- * Only one of `data` (single-signal shortcut) or `signals[]` (batch within
16
- * one address+scanner) may be present — the handler enforces mutual exclusion
17
- * at runtime in addition to the TypeBox schema check.
18
- */
19
- export interface SignalItem {
20
- /** Wallet address of the target runtime. Lowercased server-side. */
21
- address: string;
22
- /** Configured scanner id. */
23
- scanner: string;
24
- /** Asset for a single ingested signal. */
25
- asset?: string;
26
- /** Direction for a single ingested signal. */
27
- direction?: Signal["direction"];
28
- /** Confidence score for a single ingested signal (0–1). */
29
- score?: number;
30
- /** Signal classification override for a single ingested signal. */
31
- signal_type?: string;
32
- /**
33
- * Single ingest payload for signal-producing or context-producing scanners.
34
- * Mutually exclusive with `signals[]`.
35
- */
36
- data?: Record<string, unknown>;
37
- /**
38
- * Batch signal payloads for signal-producing external scanners.
39
- * Mutually exclusive with `data`.
40
- * Prefer this over multiple top-level items for the same address+scanner
41
- * to avoid the per-(address, scanner) ingest lock.
42
- */
43
- signals?: ExternalScannerIngestSignalItem[];
44
- }
45
- /**
46
- * Per-item result returned by {@link ingestSignalsHandler}.
47
- *
48
- * Uses `success` (not `ok`) — this is the per-item signal shape (Section 5 of
49
- * the plan). The `/audit` handler uses `ok` because it is a single-resource
50
- * HTTP response, not a fan-out array result.
51
- *
52
- * Error codes reuse the existing
53
- * {@link ExternalScannerIngestErrorCode} taxonomy:
54
- * `INVALID_REQUEST | NOT_FOUND | UNAVAILABLE`. No `INTERNAL` code is added —
55
- * unexpected throws map to `UNAVAILABLE`.
56
- */
57
- export type SignalResult = {
58
- success: true;
59
- /** Lowercased wallet address. */
60
- address: string;
61
- /** Configured scanner id. */
62
- scanner: string;
63
- /** Unix epoch ms timestamp from the ingest result. */
64
- timestamp: number;
65
- /** Number of committed signals; `0` for context-only ingests. */
66
- signalCount: number;
67
- /** Whether retained context was updated. */
68
- contextUpdated: boolean;
69
- } | {
70
- success: false;
71
- /** Lowercased wallet address. */
72
- address: string;
73
- /** Configured scanner id. */
74
- scanner: string;
75
- /** Machine-readable failure code. */
76
- code: ExternalScannerIngestErrorCode;
77
- /** Human-readable failure detail. */
78
- message: string;
79
- };
80
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime-api/handlers/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,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and the route layer that consumes them.
4
- *
5
- * No Fastify imports. No side-effects.
6
- */
7
- export {};
8
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime-api/handlers/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -1,98 +0,0 @@
1
- /**
2
- * Start/stop helpers for the runtime HTTP API.
3
- *
4
- * This module owns the Fastify server lifecycle: binding the port,
5
- * flipping readiness states, and draining in-flight requests on shutdown
6
- * with a hard 15s timeout so teardown always proceeds.
7
- *
8
- * The plugin glue layer (S6 in `src/index.ts`) calls {@link startApi} during
9
- * `api.lifecycle.start` and {@link ApiHandle.close} during `api.lifecycle.stop`.
10
- * This module does NOT modify `src/index.ts`.
11
- */
12
- import type { FastifyInstance } from "fastify";
13
- import { type CreateApiDeps, type ApiArtifacts } from "./server.js";
14
- import type { Logger } from "../utils/logger.js";
15
- /**
16
- * Hard timeout for Fastify drain.
17
- *
18
- * After this many milliseconds, {@link stopApi} logs a warning and proceeds
19
- * to runtime teardown regardless of in-flight requests. 15s is enough
20
- * headroom for any Telegram notification or close-resolver tick that may
21
- * be mid-flight on the underlying runtime.
22
- */
23
- export declare const DRAIN_HARD_TIMEOUT_MS = 15000;
24
- /**
25
- * Handle returned by {@link startApi}.
26
- *
27
- * The plugin lifecycle layer holds this and calls `ready()` once runtimes
28
- * are confirmed healthy, then `close()` at shutdown.
29
- */
30
- export interface ApiHandle {
31
- /** The bound Fastify instance (exposed for tests that need `fastify.inject`). */
32
- fastify: FastifyInstance;
33
- /**
34
- * Flip readiness from `"starting"` to `"ok"`.
35
- *
36
- * Call immediately after {@link startApi} resolves unless you need a
37
- * deliberate warm-up window before accepting traffic.
38
- */
39
- ready: () => void;
40
- /**
41
- * Drain in-flight requests and close the HTTP server.
42
- *
43
- * Sets readiness to `"draining"` (so `/health` starts returning 503),
44
- * then awaits `fastify.close()` with a hard {@link DRAIN_HARD_TIMEOUT_MS}
45
- * timeout. If the timeout fires, a warning is logged and teardown proceeds
46
- * without waiting further.
47
- *
48
- * Never throws — all errors are logged and swallowed so the caller's
49
- * teardown sequence is not interrupted.
50
- */
51
- close: () => Promise<void>;
52
- }
53
- /**
54
- * Start the HTTP API server.
55
- *
56
- * Calls {@link createApi} to build the Fastify instance, binds it to
57
- * `deps.apiConfig.host:deps.apiConfig.port`, and returns an {@link ApiHandle}.
58
- *
59
- * The server is NOT yet marked ready after this call — `/health` will return
60
- * 503 until the caller invokes `handle.ready()`. Call `ready()` immediately
61
- * after the runtimes are confirmed up, which in the plugin lifecycle is right
62
- * after `startApi` returns.
63
- *
64
- * A boot-time warning is logged when `deps.apiConfig.host !== "127.0.0.1"` so
65
- * any operator who opts into Docker port mapping sees it in the logs.
66
- *
67
- * @param deps Same dependencies passed to {@link createApi}: runtime handles,
68
- * validated API config, logger, and plugin version string.
69
- * @returns An {@link ApiHandle} whose `ready()` and `close()` methods drive
70
- * the lifecycle.
71
- * @throws Re-throws any `fastify.listen()` error (e.g. `EADDRINUSE`) so
72
- * the plugin lifecycle layer can perform its rollback and fail the
73
- * openclaw start cleanly.
74
- */
75
- export declare function startApi(deps: CreateApiDeps): Promise<ApiHandle>;
76
- /**
77
- * Drain in-flight requests and close the HTTP server.
78
- *
79
- * Sets readiness to `"draining"` immediately so `/health` stops returning 200,
80
- * then races `fastify.close()` against {@link DRAIN_HARD_TIMEOUT_MS}. If the
81
- * hard timeout fires first, a warning is logged and a best-effort force-close
82
- * is issued (fire-and-forget). The function always resolves — it never rejects.
83
- *
84
- * @param artifacts The {@link ApiArtifacts} returned by `createApi`.
85
- * @param logger Logger for the startup/drain messages.
86
- */
87
- declare function stopApi(artifacts: ApiArtifacts, logger: Logger): Promise<void>;
88
- /**
89
- * Exported for tests (S8) so they can assert drain timeout behavior without
90
- * going through the full `startApi` path.
91
- *
92
- * @internal Not part of the public API surface — import only in `__tests__/`.
93
- */
94
- export declare const __test_only: {
95
- stopApi: typeof stopApi;
96
- };
97
- export {};
98
- //# sourceMappingURL=lifecycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/runtime-api/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAa,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,iFAAiF;IACjF,OAAO,EAAE,eAAe,CAAC;IACzB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;;;;;;;OAUG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CA+BtE;AAED;;;;;;;;;;GAUG;AACH,iBAAe,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD7E;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;CAAc,CAAC"}
@@ -1,137 +0,0 @@
1
- /**
2
- * Start/stop helpers for the runtime HTTP API.
3
- *
4
- * This module owns the Fastify server lifecycle: binding the port,
5
- * flipping readiness states, and draining in-flight requests on shutdown
6
- * with a hard 15s timeout so teardown always proceeds.
7
- *
8
- * The plugin glue layer (S6 in `src/index.ts`) calls {@link startApi} during
9
- * `api.lifecycle.start` and {@link ApiHandle.close} during `api.lifecycle.stop`.
10
- * This module does NOT modify `src/index.ts`.
11
- */
12
- import { createApi } from "./server.js";
13
- /**
14
- * Hard timeout for Fastify drain.
15
- *
16
- * After this many milliseconds, {@link stopApi} logs a warning and proceeds
17
- * to runtime teardown regardless of in-flight requests. 15s is enough
18
- * headroom for any Telegram notification or close-resolver tick that may
19
- * be mid-flight on the underlying runtime.
20
- */
21
- export const DRAIN_HARD_TIMEOUT_MS = 15_000;
22
- /**
23
- * Start the HTTP API server.
24
- *
25
- * Calls {@link createApi} to build the Fastify instance, binds it to
26
- * `deps.apiConfig.host:deps.apiConfig.port`, and returns an {@link ApiHandle}.
27
- *
28
- * The server is NOT yet marked ready after this call — `/health` will return
29
- * 503 until the caller invokes `handle.ready()`. Call `ready()` immediately
30
- * after the runtimes are confirmed up, which in the plugin lifecycle is right
31
- * after `startApi` returns.
32
- *
33
- * A boot-time warning is logged when `deps.apiConfig.host !== "127.0.0.1"` so
34
- * any operator who opts into Docker port mapping sees it in the logs.
35
- *
36
- * @param deps Same dependencies passed to {@link createApi}: runtime handles,
37
- * validated API config, logger, and plugin version string.
38
- * @returns An {@link ApiHandle} whose `ready()` and `close()` methods drive
39
- * the lifecycle.
40
- * @throws Re-throws any `fastify.listen()` error (e.g. `EADDRINUSE`) so
41
- * the plugin lifecycle layer can perform its rollback and fail the
42
- * openclaw start cleanly.
43
- */
44
- export async function startApi(deps) {
45
- const artifacts = createApi(deps);
46
- await artifacts.fastify.listen({
47
- host: deps.apiConfig.host,
48
- port: deps.apiConfig.port,
49
- });
50
- deps.logger.info("[runtime-api] api server started", {
51
- host: deps.apiConfig.host,
52
- port: deps.apiConfig.port,
53
- });
54
- // Friction is a feature: anyone who flips host to 0.0.0.0 sees this in logs.
55
- if (deps.apiConfig.host !== "127.0.0.1") {
56
- deps.logger.warn("[runtime-api] api.host is bound to \"" +
57
- deps.apiConfig.host +
58
- "\". " +
59
- "The API is reachable from anything on this container's Docker network. " +
60
- "If you set this for Postman testing, make sure your docker-compose port mapping " +
61
- "uses the \"127.0.0.1:\" prefix so the API is not exposed beyond your laptop's loopback. " +
62
- "See docs/runtime-docs/runtime-api.md \"Postman testing recipe\".");
63
- }
64
- return {
65
- fastify: artifacts.fastify,
66
- ready: () => artifacts.readiness.setOk(),
67
- close: () => stopApi(artifacts, deps.logger),
68
- };
69
- }
70
- /**
71
- * Drain in-flight requests and close the HTTP server.
72
- *
73
- * Sets readiness to `"draining"` immediately so `/health` stops returning 200,
74
- * then races `fastify.close()` against {@link DRAIN_HARD_TIMEOUT_MS}. If the
75
- * hard timeout fires first, a warning is logged and a best-effort force-close
76
- * is issued (fire-and-forget). The function always resolves — it never rejects.
77
- *
78
- * @param artifacts The {@link ApiArtifacts} returned by `createApi`.
79
- * @param logger Logger for the startup/drain messages.
80
- */
81
- async function stopApi(artifacts, logger) {
82
- artifacts.readiness.setDraining();
83
- // Capture the close promise once. Two reasons:
84
- // 1. We need to mute its rejection unconditionally — when the drain
85
- // timeout wins the race, the close promise is still in flight and
86
- // may reject later, producing an unhandled rejection (the second
87
- // .close() call in the timeout branch was a *new* promise, not a
88
- // handler for the original).
89
- // 2. We need a stable reference to race against the timeout below.
90
- const closePromise = artifacts.fastify.close();
91
- // Pre-attach a no-op catch so a late rejection on the original promise
92
- // is always considered handled. The catch returns a new derived promise
93
- // that we ignore — this does NOT prevent Promise.race below from seeing
94
- // the rejection, since handlers on the same promise are independent.
95
- closePromise.catch(() => { });
96
- // Capture the timeout handle so we can clear it on the happy path.
97
- // Otherwise, when fastify.close() wins the race, the still-pending
98
- // setTimeout fires DRAIN_HARD_TIMEOUT_MS later and rejects an unwatched
99
- // promise — an unhandled rejection on every clean shutdown.
100
- let timeoutHandle;
101
- try {
102
- await Promise.race([
103
- closePromise,
104
- new Promise((_resolve, reject) => {
105
- timeoutHandle = setTimeout(() => reject(new Error("DRAIN_TIMEOUT")), DRAIN_HARD_TIMEOUT_MS);
106
- }),
107
- ]);
108
- logger.info("[runtime-api] api server stopped");
109
- }
110
- catch (err) {
111
- if (err.message === "DRAIN_TIMEOUT") {
112
- logger.warn("[runtime-api] api server drain exceeded hard timeout; proceeding to teardown", { timeoutMs: DRAIN_HARD_TIMEOUT_MS });
113
- // The original closePromise is still in flight; any future rejection
114
- // is already muted by the .catch() above. Caller proceeds to
115
- // runtime teardown.
116
- return;
117
- }
118
- // Unexpected close error — log and swallow so teardown sequence continues.
119
- logger.error("[runtime-api] unexpected error during api server close", {
120
- err,
121
- });
122
- }
123
- finally {
124
- // Always clear so the timeout cannot fire after stopApi returns.
125
- if (timeoutHandle !== undefined) {
126
- clearTimeout(timeoutHandle);
127
- }
128
- }
129
- }
130
- /**
131
- * Exported for tests (S8) so they can assert drain timeout behavior without
132
- * going through the full `startApi` path.
133
- *
134
- * @internal Not part of the public API surface — import only in `__tests__/`.
135
- */
136
- export const __test_only = { stopApi };
137
- //# sourceMappingURL=lifecycle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/runtime-api/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,SAAS,EAAyC,MAAM,aAAa,CAAC;AAG/E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAgC5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAmB;IAChD,MAAM,SAAS,GAAiB,SAAS,CAAC,IAAI,CAAC,CAAC;IAEhD,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI;QACzB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI;KAC1B,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE;QACnD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI;QACzB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI;KAC1B,CAAC,CAAC;IAEH,6EAA6E;IAC7E,IA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;SACH,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAAa,CAAC,OAAO,KAAK,eAAe,EAAE,CAAC;YAC/C,MAAM,CAAC,IAAI,CACT,8EAA8E,EAC9E,EAAE,SAAS,EAAE,qBAAqB,EAAE,CACrC,CAAC;YACF,qEAAqE;YACrE,6DAA6D;YAC7D,oBAAoB;YACpB,OAAO;QACT,CAAC;QACD,2EAA2E;QAC3E,MAAM,CAAC,KAAK,CAAC,wDAAwD,EAAE;YACrE,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,iEAAiE;QACjE,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;YAChC,YAAY,CAAC,aAAa,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,CAAC"}
@@ -1,37 +0,0 @@
1
- /**
2
- * Three-state readiness contract for `GET /health`.
3
- *
4
- * S5 (lifecycle layer) wires the lifecycle to flip these states:
5
- * - `"starting"` — initial state; server is binding or warming up.
6
- * - `"ok"` — server is bound and ready to handle traffic.
7
- * - `"draining"` — graceful-shutdown in progress; stop routing new requests.
8
- *
9
- * `GET /health` returns `200` for `"ok"` and `503` for the other two states
10
- * so load balancers stop routing before the process exits.
11
- */
12
- /** Three valid readiness states. */
13
- export type ReadinessState = "starting" | "ok" | "draining";
14
- /**
15
- * Read-only interface consumed by `GET /health` and any other component that
16
- * needs to observe readiness without being able to mutate it.
17
- */
18
- export interface Readiness {
19
- /** Return the current readiness state synchronously. */
20
- state(): ReadinessState;
21
- }
22
- /**
23
- * Create a mutable readiness object.
24
- *
25
- * The returned object satisfies both the read-only {@link Readiness} interface
26
- * and exposes `setOk()` / `setDraining()` mutators for the lifecycle layer
27
- * (S5) to call at the appropriate moments.
28
- *
29
- * Initial state is `"starting"`.
30
- *
31
- * @returns A combined readiness + mutator object.
32
- */
33
- export declare function createReadiness(): Readiness & {
34
- setOk(): void;
35
- setDraining(): void;
36
- };
37
- //# sourceMappingURL=readiness.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../../src/runtime-api/readiness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,oCAAoC;AACpC,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,IAAI,GAAG,UAAU,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,wDAAwD;IACxD,KAAK,IAAI,cAAc,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,IAAI,SAAS,GAAG;IAC7C,KAAK,IAAI,IAAI,CAAC;IACd,WAAW,IAAI,IAAI,CAAC;CACrB,CAWA"}
@@ -1,35 +0,0 @@
1
- /**
2
- * Three-state readiness contract for `GET /health`.
3
- *
4
- * S5 (lifecycle layer) wires the lifecycle to flip these states:
5
- * - `"starting"` — initial state; server is binding or warming up.
6
- * - `"ok"` — server is bound and ready to handle traffic.
7
- * - `"draining"` — graceful-shutdown in progress; stop routing new requests.
8
- *
9
- * `GET /health` returns `200` for `"ok"` and `503` for the other two states
10
- * so load balancers stop routing before the process exits.
11
- */
12
- /**
13
- * Create a mutable readiness object.
14
- *
15
- * The returned object satisfies both the read-only {@link Readiness} interface
16
- * and exposes `setOk()` / `setDraining()` mutators for the lifecycle layer
17
- * (S5) to call at the appropriate moments.
18
- *
19
- * Initial state is `"starting"`.
20
- *
21
- * @returns A combined readiness + mutator object.
22
- */
23
- export function createReadiness() {
24
- let s = "starting";
25
- return {
26
- state: () => s,
27
- setOk: () => {
28
- s = "ok";
29
- },
30
- setDraining: () => {
31
- s = "draining";
32
- },
33
- };
34
- }
35
- //# sourceMappingURL=readiness.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"readiness.js","sourceRoot":"","sources":["../../src/runtime-api/readiness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAcH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe;IAI7B,IAAI,CAAC,GAAmB,UAAU,CAAC;IACnC,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QACd,KAAK,EAAE,GAAG,EAAE;YACV,CAAC,GAAG,IAAI,CAAC;QACX,CAAC;QACD,WAAW,EAAE,GAAG,EAAE;YAChB,CAAC,GAAG,UAAU,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}