@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,40 +0,0 @@
1
- /**
2
- * Fastify route: `GET /audit`.
3
- *
4
- * Proxies a `audit_query` MCP call through the runtime handle matching the
5
- * requested wallet address. AbortSignal is wired to the HTTP request lifetime
6
- * so MCP cancels in-flight work when the client disconnects.
7
- *
8
- * Business logic lives entirely in `handlers/audit.ts`. This file contains
9
- * only Fastify wiring and query-string coercion.
10
- */
11
- import type { FastifyInstance } from "fastify";
12
- import type { RuntimeHandle } from "../../runtime/run.js";
13
- import type { Logger } from "../../utils/logger.js";
14
- /**
15
- * Dependencies injected into the `/audit` route at registration time.
16
- */
17
- export interface AuditRouteDeps {
18
- /** Live runtime handles maintained by the plugin, keyed by lowercased address. */
19
- runtimeHandles: Map<string, RuntimeHandle>;
20
- /** Logger instance for unexpected errors. */
21
- logger: Logger;
22
- }
23
- /**
24
- * Register `GET /audit` on the given Fastify instance.
25
- *
26
- * Coerces string query-string values to their typed counterparts before
27
- * forwarding to `auditHandler`. The `success` field is `"true" | "false"` from
28
- * the schema; converted to `boolean`. Integer fields are parsed with
29
- * `parseInt`. Missing optional fields are left as `undefined`.
30
- *
31
- * HTTP status mapping from `AuditQueryError.code`:
32
- * - `NOT_FOUND` → 404
33
- * - `ABORTED` → 504 (gateway timeout — client disconnected)
34
- * - `UPSTREAM` → 502 (bad gateway — MCP error)
35
- *
36
- * @param fastify Fastify instance to register the route on.
37
- * @param deps Route dependencies injected at plugin start.
38
- */
39
- export declare function registerAuditRoute(fastify: FastifyInstance, deps: AuditRouteDeps): void;
40
- //# sourceMappingURL=audit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../src/runtime-api/routes/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kFAAkF;IAClF,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3C,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,cAAc,GACnB,IAAI,CA4DN"}
@@ -1,82 +0,0 @@
1
- /**
2
- * Fastify route: `GET /audit`.
3
- *
4
- * Proxies a `audit_query` MCP call through the runtime handle matching the
5
- * requested wallet address. AbortSignal is wired to the HTTP request lifetime
6
- * so MCP cancels in-flight work when the client disconnects.
7
- *
8
- * Business logic lives entirely in `handlers/audit.ts`. This file contains
9
- * only Fastify wiring and query-string coercion.
10
- */
11
- import { AuditQuery } from "./audit.schema.js";
12
- import { auditHandler } from "../handlers/audit.js";
13
- /**
14
- * Register `GET /audit` on the given Fastify instance.
15
- *
16
- * Coerces string query-string values to their typed counterparts before
17
- * forwarding to `auditHandler`. The `success` field is `"true" | "false"` from
18
- * the schema; converted to `boolean`. Integer fields are parsed with
19
- * `parseInt`. Missing optional fields are left as `undefined`.
20
- *
21
- * HTTP status mapping from `AuditQueryError.code`:
22
- * - `NOT_FOUND` → 404
23
- * - `ABORTED` → 504 (gateway timeout — client disconnected)
24
- * - `UPSTREAM` → 502 (bad gateway — MCP error)
25
- *
26
- * @param fastify Fastify instance to register the route on.
27
- * @param deps Route dependencies injected at plugin start.
28
- */
29
- export function registerAuditRoute(fastify, deps) {
30
- fastify.get("/audit", { schema: { querystring: AuditQuery } }, async (req, reply) => {
31
- const q = req.query;
32
- // Coerce string query-string values to typed handler args.
33
- const args = {
34
- ...(q.tool_name !== undefined && { tool_name: q.tool_name }),
35
- ...(q.action_type !== undefined && { action_type: q.action_type }),
36
- ...(q.success !== undefined && { success: q.success === "true" }),
37
- ...(q.start_time !== undefined && { start_time: q.start_time }),
38
- ...(q.end_time !== undefined && { end_time: q.end_time }),
39
- ...(q.min_duration_ms !== undefined && {
40
- min_duration_ms: parseInt(q.min_duration_ms, 10),
41
- }),
42
- ...(q.max_duration_ms !== undefined && {
43
- max_duration_ms: parseInt(q.max_duration_ms, 10),
44
- }),
45
- ...(q.limit !== undefined
46
- ? { limit: parseInt(q.limit, 10) }
47
- : { limit: 100 }),
48
- ...(q.offset !== undefined
49
- ? { offset: parseInt(q.offset, 10) }
50
- : { offset: 0 }),
51
- ...(q.cursor_requested_at !== undefined && {
52
- cursor_requested_at: q.cursor_requested_at,
53
- }),
54
- ...(q.cursor_id !== undefined && { cursor_id: q.cursor_id }),
55
- };
56
- // Wire AbortSignal to the request close event so MCP cancellation works
57
- // when the HTTP client disconnects before the MCP response arrives.
58
- const ac = new AbortController();
59
- req.raw.on("close", () => {
60
- if (req.raw.destroyed)
61
- ac.abort();
62
- });
63
- const result = await auditHandler(q.address, args, deps, ac.signal);
64
- if (result.ok) {
65
- return reply.send({
66
- address: result.address,
67
- strategyId: result.strategyId,
68
- ...result.result,
69
- });
70
- }
71
- const statusMap = {
72
- NOT_FOUND: 404,
73
- ABORTED: 504,
74
- UPSTREAM: 502,
75
- };
76
- const status = statusMap[result.code] ?? 502;
77
- return reply
78
- .status(status)
79
- .send({ ok: false, code: result.code, message: result.message });
80
- });
81
- }
82
- //# sourceMappingURL=audit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/runtime-api/routes/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAepD;;;;;;;;;;;;;;;GAeG;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AAC;QAC7C,OAAO,KAAK;aACT,MAAM,CAAC,MAAM,CAAC;aACd,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1,75 +0,0 @@
1
- /**
2
- * TypeBox schema for the `GET /audit` query string.
3
- *
4
- * All Fastify query-string values arrive as strings. Integer fields
5
- * (`min_duration_ms`, `max_duration_ms`, `limit`, `offset`) and the `success`
6
- * boolean are declared as strings here so TypeBox validation passes on the raw
7
- * HTTP input. The route handler coerces them to the appropriate types before
8
- * forwarding to `auditHandler`.
9
- *
10
- * Fields excluded from the caller-visible surface (per plan Section 6):
11
- * - `resource_type` — always `"strategy"`, set by `RuntimeHandle.auditQuery`.
12
- * - `resource_id` — resolved wallet → strategyId, set by the handle.
13
- * - `user_ids` — server-controlled (the MCP API-key user).
14
- * - `usernames` — server-controlled (the MCP API-key user).
15
- *
16
- * @see senpi-hyperliquid-mcp/src/tools/audit.tools.ts `auditQueryInputSchema`
17
- * for the upstream MCP Zod schema this mirrors.
18
- */
19
- import { type Static } from "@sinclair/typebox";
20
- /** TypeBox schema for `GET /audit` query-string parameters. */
21
- export declare const AuditQuery: import("@sinclair/typebox").TObject<{
22
- /**
23
- * Wallet address to scope the audit query.
24
- * Required — used to look up the matching runtime handle.
25
- */
26
- address: import("@sinclair/typebox").TString;
27
- /** Filter by exact tool name (e.g. `create_position`). */
28
- tool_name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
29
- /**
30
- * Filter by action classification.
31
- * One of: `read`, `create`, `update`, `delete`.
32
- */
33
- action_type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"read">, import("@sinclair/typebox").TLiteral<"create">, import("@sinclair/typebox").TLiteral<"update">, import("@sinclair/typebox").TLiteral<"delete">]>>;
34
- /**
35
- * Filter by success/failure.
36
- * Query strings arrive as text — coerce `"true"` / `"false"` in the route.
37
- */
38
- success: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"true">, import("@sinclair/typebox").TLiteral<"false">]>>;
39
- /** ISO 8601 inclusive lower bound on `requested_at`. */
40
- start_time: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
41
- /** ISO 8601 inclusive upper bound on `requested_at`. */
42
- end_time: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
43
- /**
44
- * Minimum end-to-end duration in ms.
45
- * Arrives as a string; pattern restricts to non-negative integers so
46
- * `parseInt` never produces NaN. Coerced to integer in the route handler.
47
- */
48
- min_duration_ms: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
49
- /**
50
- * Maximum end-to-end duration in ms.
51
- * Arrives as a string; pattern restricts to non-negative integers so
52
- * `parseInt` never produces NaN. Coerced to integer in the route handler.
53
- */
54
- max_duration_ms: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
55
- /**
56
- * Page size (1–1000, MCP default 100).
57
- * Arrives as a string; pattern restricts to non-negative integers.
58
- * Coerced to integer in the route handler. Default `100` applied on
59
- * missing value. MCP enforces the 1–1000 range.
60
- */
61
- limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
62
- /**
63
- * Offset-based pagination skip count (≥0, MCP default 0).
64
- * Arrives as a string; pattern restricts to non-negative integers.
65
- * Coerced to integer in the route handler.
66
- */
67
- offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
68
- /** Cursor timestamp for keyset pagination (ISO 8601). Must pair with `cursor_id`. */
69
- cursor_requested_at: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
70
- /** Cursor UUID for keyset pagination. Must pair with `cursor_requested_at`. */
71
- cursor_id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
72
- }>;
73
- /** TypeScript type for the `GET /audit` query string. */
74
- export type AuditQueryT = Static<typeof AuditQuery>;
75
- //# sourceMappingURL=audit.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit.schema.d.ts","sourceRoot":"","sources":["../../../src/runtime-api/routes/audit.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,+DAA+D;AAC/D,eAAO,MAAM,UAAU;IAEnB;;;OAGG;;IAGH,0DAA0D;;IAG1D;;;OAGG;;IAUH;;;OAGG;;IAKH,wDAAwD;;IAGxD,wDAAwD;;IAGxD;;;;OAIG;;IAGH;;;;OAIG;;IAGH;;;;;OAKG;;IAGH;;;;OAIG;;IAGH,qFAAqF;;IAGrF,+EAA+E;;EAIlF,CAAC;AAEF,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -1,78 +0,0 @@
1
- /**
2
- * TypeBox schema for the `GET /audit` query string.
3
- *
4
- * All Fastify query-string values arrive as strings. Integer fields
5
- * (`min_duration_ms`, `max_duration_ms`, `limit`, `offset`) and the `success`
6
- * boolean are declared as strings here so TypeBox validation passes on the raw
7
- * HTTP input. The route handler coerces them to the appropriate types before
8
- * forwarding to `auditHandler`.
9
- *
10
- * Fields excluded from the caller-visible surface (per plan Section 6):
11
- * - `resource_type` — always `"strategy"`, set by `RuntimeHandle.auditQuery`.
12
- * - `resource_id` — resolved wallet → strategyId, set by the handle.
13
- * - `user_ids` — server-controlled (the MCP API-key user).
14
- * - `usernames` — server-controlled (the MCP API-key user).
15
- *
16
- * @see senpi-hyperliquid-mcp/src/tools/audit.tools.ts `auditQueryInputSchema`
17
- * for the upstream MCP Zod schema this mirrors.
18
- */
19
- import { Type } from "@sinclair/typebox";
20
- /** TypeBox schema for `GET /audit` query-string parameters. */
21
- export const AuditQuery = Type.Object({
22
- /**
23
- * Wallet address to scope the audit query.
24
- * Required — used to look up the matching runtime handle.
25
- */
26
- address: Type.String({ minLength: 1 }),
27
- /** Filter by exact tool name (e.g. `create_position`). */
28
- tool_name: Type.Optional(Type.String()),
29
- /**
30
- * Filter by action classification.
31
- * One of: `read`, `create`, `update`, `delete`.
32
- */
33
- action_type: Type.Optional(Type.Union([
34
- Type.Literal("read"),
35
- Type.Literal("create"),
36
- Type.Literal("update"),
37
- Type.Literal("delete"),
38
- ])),
39
- /**
40
- * Filter by success/failure.
41
- * Query strings arrive as text — coerce `"true"` / `"false"` in the route.
42
- */
43
- success: Type.Optional(Type.Union([Type.Literal("true"), Type.Literal("false")])),
44
- /** ISO 8601 inclusive lower bound on `requested_at`. */
45
- start_time: Type.Optional(Type.String()),
46
- /** ISO 8601 inclusive upper bound on `requested_at`. */
47
- end_time: Type.Optional(Type.String()),
48
- /**
49
- * Minimum end-to-end duration in ms.
50
- * Arrives as a string; pattern restricts to non-negative integers so
51
- * `parseInt` never produces NaN. Coerced to integer in the route handler.
52
- */
53
- min_duration_ms: Type.Optional(Type.String({ pattern: "^\\d+$" })),
54
- /**
55
- * Maximum end-to-end duration in ms.
56
- * Arrives as a string; pattern restricts to non-negative integers so
57
- * `parseInt` never produces NaN. Coerced to integer in the route handler.
58
- */
59
- max_duration_ms: Type.Optional(Type.String({ pattern: "^\\d+$" })),
60
- /**
61
- * Page size (1–1000, MCP default 100).
62
- * Arrives as a string; pattern restricts to non-negative integers.
63
- * Coerced to integer in the route handler. Default `100` applied on
64
- * missing value. MCP enforces the 1–1000 range.
65
- */
66
- limit: Type.Optional(Type.String({ pattern: "^\\d+$" })),
67
- /**
68
- * Offset-based pagination skip count (≥0, MCP default 0).
69
- * Arrives as a string; pattern restricts to non-negative integers.
70
- * Coerced to integer in the route handler.
71
- */
72
- offset: Type.Optional(Type.String({ pattern: "^\\d+$" })),
73
- /** Cursor timestamp for keyset pagination (ISO 8601). Must pair with `cursor_id`. */
74
- cursor_requested_at: Type.Optional(Type.String()),
75
- /** Cursor UUID for keyset pagination. Must pair with `cursor_requested_at`. */
76
- cursor_id: Type.Optional(Type.String()),
77
- }, { additionalProperties: false });
78
- //# sourceMappingURL=audit.schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit.schema.js","sourceRoot":"","sources":["../../../src/runtime-api/routes/audit.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AAEtD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CACnC;IACE;;;OAGG;IACH,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;IAEtC,0DAA0D;IAC1D,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAEvC;;;OAGG;IACH,WAAW,EAAE,IAAI,CAAC,QAAQ,CACxB,IAAI,CAAC,KAAK,CAAC;QACT,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;KACvB,CAAC,CACH;IAED;;;OAGG;IACH,OAAO,EAAE,IAAI,CAAC,QAAQ,CACpB,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAC1D;IAED,wDAAwD;IACxD,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAExC,wDAAwD;IACxD,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAEtC;;;;OAIG;IACH,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAElE;;;;OAIG;IACH,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAElE;;;;;OAKG;IACH,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAExD;;;;OAIG;IACH,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAEzD,qFAAqF;IACrF,mBAAmB,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAEjD,+EAA+E;IAC/E,SAAS,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;CACxC,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAChC,CAAC"}
@@ -1,53 +0,0 @@
1
- /**
2
- * Fastify route: `GET /health`.
3
- *
4
- * Returns a three-state readiness signal (`starting` | `ok` | `draining`)
5
- * suitable for load-balancer / Kubernetes liveness and readiness probes.
6
- * Also exposes per-runtime signal-queue depth for capacity planning.
7
- *
8
- * HTTP status:
9
- * - `200` when `status === "ok"`.
10
- * - `503` when `status === "starting"` or `"draining"` — load balancer
11
- * should stop routing new requests but the process is still alive.
12
- */
13
- import type { FastifyInstance } from "fastify";
14
- import type { Readiness } from "../readiness.js";
15
- import type { RuntimeHandle } from "../../runtime/run.js";
16
- /**
17
- * Dependencies injected into the `/health` route at registration time.
18
- */
19
- export interface HealthRouteDeps {
20
- /** Live runtime handles maintained by the plugin, keyed by lowercased address. */
21
- runtimeHandles: Map<string, RuntimeHandle>;
22
- /** Subset of `ApiConfig` needed for the response body. */
23
- apiConfig: {
24
- host: string;
25
- port: number;
26
- };
27
- /**
28
- * Three-state readiness flag.
29
- * S5 (lifecycle) flips it to `"ok"` after the server binds and to
30
- * `"draining"` during graceful shutdown.
31
- */
32
- readiness: Readiness;
33
- /**
34
- * Plugin version string (read from `openclaw.plugin.json` at boot).
35
- * Included in the response so callers can correlate logs with deployments.
36
- */
37
- version: string;
38
- /** Unix epoch ms timestamp recorded when `createApi()` was called. */
39
- bootedAt: number;
40
- }
41
- /**
42
- * Register `GET /health` on the given Fastify instance.
43
- *
44
- * Response is never cached (`Cache-Control: no-store`). The shape is stable
45
- * across minor versions — callers may rely on `status`, `runtimes.count`, and
46
- * `runtimes.items[].signalQueueDepth` being present whenever the server is
47
- * reachable.
48
- *
49
- * @param fastify Fastify instance to register the route on.
50
- * @param deps Route dependencies injected at plugin start.
51
- */
52
- export declare function registerHealthRoute(fastify: FastifyInstance, deps: HealthRouteDeps): void;
53
- //# sourceMappingURL=health.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/runtime-api/routes/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3C,0DAA0D;IAC1D,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C;;;;OAIG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,eAAe,GACpB,IAAI,CAyBN"}
@@ -1,48 +0,0 @@
1
- /**
2
- * Fastify route: `GET /health`.
3
- *
4
- * Returns a three-state readiness signal (`starting` | `ok` | `draining`)
5
- * suitable for load-balancer / Kubernetes liveness and readiness probes.
6
- * Also exposes per-runtime signal-queue depth for capacity planning.
7
- *
8
- * HTTP status:
9
- * - `200` when `status === "ok"`.
10
- * - `503` when `status === "starting"` or `"draining"` — load balancer
11
- * should stop routing new requests but the process is still alive.
12
- */
13
- /**
14
- * Register `GET /health` on the given Fastify instance.
15
- *
16
- * Response is never cached (`Cache-Control: no-store`). The shape is stable
17
- * across minor versions — callers may rely on `status`, `runtimes.count`, and
18
- * `runtimes.items[].signalQueueDepth` being present whenever the server is
19
- * reachable.
20
- *
21
- * @param fastify Fastify instance to register the route on.
22
- * @param deps Route dependencies injected at plugin start.
23
- */
24
- export function registerHealthRoute(fastify, deps) {
25
- fastify.get("/health", async (_req, reply) => {
26
- const status = deps.readiness.state();
27
- const httpStatus = status === "ok" ? 200 : 503;
28
- const items = Array.from(deps.runtimeHandles, ([_id, handle]) => ({
29
- address: handle.wallet.toLowerCase(),
30
- signalQueueDepth: handle.getSignalQueueDepth(),
31
- }));
32
- return reply
33
- .status(httpStatus)
34
- .header("Cache-Control", "no-store")
35
- .send({
36
- status,
37
- version: deps.version,
38
- uptime_ms: Date.now() - deps.bootedAt,
39
- runtimes: { count: items.length, items },
40
- api: { host: deps.apiConfig.host, port: deps.apiConfig.port },
41
- build: {
42
- commit: process.env.SENPI_GIT_COMMIT ?? null,
43
- node: process.version,
44
- },
45
- });
46
- });
47
- }
48
- //# sourceMappingURL=health.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.js","sourceRoot":"","sources":["../../../src/runtime-api/routes/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG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- *
4
- * Accepts a batch of signal items targeting one or more runtime wallets,
5
- * groups them by `(address, scanner)` to avoid the per-key ingest lock, fans
6
- * out groups in parallel, processes items within each group sequentially, and
7
- * returns per-item results in input order.
8
- *
9
- * Business logic lives entirely in:
10
- * - `handlers/ingest-signals.ts` — per-item dispatch + error translation.
11
- * - `handlers/group-by-scanner.ts` — lock-aware grouping helper.
12
- *
13
- * This file contains only Fastify wiring and the handler-level cap check.
14
- */
15
- import type { FastifyInstance } from "fastify";
16
- import type { RuntimeHandle } from "../../runtime/run.js";
17
- import type { Logger } from "../../utils/logger.js";
18
- /**
19
- * Dependencies injected into the `/signals` route at registration time.
20
- */
21
- export interface SignalsRouteDeps {
22
- /** Live runtime handles maintained by the plugin, keyed by lowercased address. */
23
- runtimeHandles: Map<string, RuntimeHandle>;
24
- /** Logger instance for unexpected errors. */
25
- logger: Logger;
26
- /**
27
- * Maximum number of items allowed in a single request.
28
- * Sourced from `config.api.maxItemsPerSignalsRequest` (default 10).
29
- */
30
- maxItems: number;
31
- /**
32
- * Transport tag forwarded to the ingest handler for telemetry.
33
- * Fixed as `"http"` for this route; the gateway shim passes `"gateway"`.
34
- */
35
- transport: "http" | "gateway";
36
- }
37
- /**
38
- * Register `POST /signals` on the given Fastify instance.
39
- *
40
- * The route validates the body against the `SignalsBody` TypeBox schema, then:
41
- * 1. Rejects oversized batches (handler-level cap, configurable).
42
- * 2. Groups items by `(address, scanner)` via `groupByAddressScanner`.
43
- * 3. Runs groups in parallel; items within each group run sequentially.
44
- * 4. Re-flattens results back to input order before responding.
45
- *
46
- * @param fastify Fastify instance to register the route on.
47
- * @param deps Route dependencies injected at plugin start.
48
- */
49
- export declare function registerSignalsRoute(fastify: FastifyInstance, deps: SignalsRouteDeps): void;
50
- //# sourceMappingURL=signals.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../../src/runtime-api/routes/signals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3C,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,gBAAgB,GACrB,IAAI,CA6CN"}
@@ -1,65 +0,0 @@
1
- /**
2
- * Fastify route: `POST /signals`.
3
- *
4
- * Accepts a batch of signal items targeting one or more runtime wallets,
5
- * groups them by `(address, scanner)` to avoid the per-key ingest lock, fans
6
- * out groups in parallel, processes items within each group sequentially, and
7
- * returns per-item results in input order.
8
- *
9
- * Business logic lives entirely in:
10
- * - `handlers/ingest-signals.ts` — per-item dispatch + error translation.
11
- * - `handlers/group-by-scanner.ts` — lock-aware grouping helper.
12
- *
13
- * This file contains only Fastify wiring and the handler-level cap check.
14
- */
15
- import { SignalsBody } from "./signals.schema.js";
16
- import { ingestSignalsHandler } from "../handlers/ingest-signals.js";
17
- import { groupByAddressScanner } from "../handlers/group-by-scanner.js";
18
- /**
19
- * Register `POST /signals` on the given Fastify instance.
20
- *
21
- * The route validates the body against the `SignalsBody` TypeBox schema, then:
22
- * 1. Rejects oversized batches (handler-level cap, configurable).
23
- * 2. Groups items by `(address, scanner)` via `groupByAddressScanner`.
24
- * 3. Runs groups in parallel; items within each group run sequentially.
25
- * 4. Re-flattens results back to input order before responding.
26
- *
27
- * @param fastify Fastify instance to register the route on.
28
- * @param deps Route dependencies injected at plugin start.
29
- */
30
- export function registerSignalsRoute(fastify, deps) {
31
- fastify.post("/signals", { schema: { body: SignalsBody } }, async (req, reply) => {
32
- const items = req.body;
33
- // Handler-level cap — operator-tunable, not encoded in the TypeBox schema.
34
- if (items.length > deps.maxItems) {
35
- return reply.status(400).send({
36
- success: false,
37
- code: "INVALID_REQUEST",
38
- message: `Exceeded api.maxItemsPerSignalsRequest=${deps.maxItems}; got ${items.length}.`,
39
- });
40
- }
41
- // Group by (address, scanner) — each group is a SignalGroup (IndexedSignalItem[]).
42
- const groups = groupByAddressScanner(items);
43
- // Fan out across groups in parallel; process items within each group sequentially.
44
- const grouped = await Promise.all(groups.map(async (group) => {
45
- const out = [];
46
- for (const { index, item } of group) {
47
- out.push({
48
- index,
49
- result: await ingestSignalsHandler(item, {
50
- runtimeHandles: deps.runtimeHandles,
51
- logger: deps.logger,
52
- transport: deps.transport,
53
- }),
54
- });
55
- }
56
- return out;
57
- }));
58
- // Re-flatten in input order.
59
- const flat = grouped.flat();
60
- flat.sort((a, b) => a.index - b.index);
61
- const results = flat.map((entry) => entry.result);
62
- return reply.send({ results });
63
- });
64
- }
65
- //# sourceMappingURL=signals.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signals.js","sourceRoot":"","sources":["../../../src/runtime-api/routes/signals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAyBxE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAwB,EACxB,IAAsB;IAEtB,OAAO,CAAC,IAAI,CACV,UAAU,EACV,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EACjC,KAAK,EAAE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AG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAElE,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -1,94 +0,0 @@
1
- /**
2
- * TypeBox schema for the `POST /signals` request body.
3
- *
4
- * `SignalItemT` is derived from TypeBox `Static<>` and is structurally
5
- * compatible with the hand-written {@link SignalItem} interface in
6
- * `handlers/types.ts`. The interface in `handlers/types.ts` is kept as the
7
- * canonical description (referenced by JSDoc across the codebase); this module
8
- * derives the runtime-validatable form from TypeBox so both shapes stay in
9
- * sync at compile-time.
10
- *
11
- * Note on `direction`: the TypeBox schema accepts any string so
12
- * `SignalItemT["direction"]` is `string | undefined`, matching
13
- * `Signal["direction"]` in `scanners/types.ts`. The tighter
14
- * `"long" | "short" | null` constraint lives in the MCP layer; the runtime
15
- * applies it implicitly during scanner-engine ingest.
16
- *
17
- * Note on `maxItems`: enforced at handler level using the configured
18
- * `api.maxItemsPerSignalsRequest` value (default 10). Schema-level cap is
19
- * kept open-ended so the shape works in tests without recompiling.
20
- */
21
- import { type Static } from "@sinclair/typebox";
22
- /** TypeBox schema for one item in the `POST /signals` body. */
23
- export declare const SignalItem: import("@sinclair/typebox").TObject<{
24
- /** Wallet address of the target runtime. Lowercased server-side. */
25
- address: import("@sinclair/typebox").TString;
26
- /** Configured scanner id. */
27
- scanner: import("@sinclair/typebox").TString;
28
- /** Asset for a single ingested signal. */
29
- asset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
30
- /**
31
- * Direction for a single ingested signal.
32
- * Accepts any string — `"long"` / `"short"` are the conventional values.
33
- */
34
- direction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
35
- /** Confidence score for a single ingested signal (0–1). */
36
- score: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
37
- /** Signal classification override for a single ingested signal. */
38
- signal_type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
39
- /**
40
- * Single ingest payload for signal-producing or context-producing scanners.
41
- * Mutually exclusive with `signals[]`.
42
- */
43
- data: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
44
- /**
45
- * Batch signal payloads for signal-producing external scanners.
46
- * Mutually exclusive with `data`.
47
- */
48
- signals: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
49
- asset: import("@sinclair/typebox").TString;
50
- direction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
51
- score: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
52
- signal_type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
53
- data: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
54
- }>>>;
55
- }>;
56
- /** TypeBox schema for the full `POST /signals` request body array. */
57
- export declare const SignalsBody: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
58
- /** Wallet address of the target runtime. Lowercased server-side. */
59
- address: import("@sinclair/typebox").TString;
60
- /** Configured scanner id. */
61
- scanner: import("@sinclair/typebox").TString;
62
- /** Asset for a single ingested signal. */
63
- asset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
64
- /**
65
- * Direction for a single ingested signal.
66
- * Accepts any string — `"long"` / `"short"` are the conventional values.
67
- */
68
- direction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
69
- /** Confidence score for a single ingested signal (0–1). */
70
- score: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
71
- /** Signal classification override for a single ingested signal. */
72
- signal_type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
73
- /**
74
- * Single ingest payload for signal-producing or context-producing scanners.
75
- * Mutually exclusive with `signals[]`.
76
- */
77
- data: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
78
- /**
79
- * Batch signal payloads for signal-producing external scanners.
80
- * Mutually exclusive with `data`.
81
- */
82
- signals: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
83
- asset: import("@sinclair/typebox").TString;
84
- direction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
85
- score: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
86
- signal_type: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
87
- data: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
88
- }>>>;
89
- }>>;
90
- /** TypeScript type for one signal item — derived from TypeBox, single source of truth. */
91
- export type SignalItemT = Static<typeof SignalItem>;
92
- /** TypeScript type for the `POST /signals` request body. */
93
- export type SignalsBodyT = Static<typeof SignalsBody>;
94
- //# sourceMappingURL=signals.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signals.schema.d.ts","sourceRoot":"","sources":["../../../src/runtime-api/routes/signals.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEtD,+DAA+D;AAC/D,eAAO,MAAM,UAAU;IAEnB,oEAAoE;;IAEpE,6BAA6B;;IAE7B,0CAA0C;;IAE1C;;;OAGG;;IAEH,2DAA2D;;IAE3D,mEAAmE;;IAEnE;;;OAGG;;IAEH;;;OAGG;;;;;;;;EAcN,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,WAAW;IAxCpB,oEAAoE;;IAEpE,6BAA6B;;IAE7B,0CAA0C;;IAE1C;;;OAGG;;IAEH,2DAA2D;;IAE3D,mEAAmE;;IAEnE;;;OAGG;;IAEH;;;OAGG;;;;;;;;GAiB2D,CAAC;AAEnE,0FAA0F;AAC1F,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,4DAA4D;AAC5D,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC"}