@cleocode/contracts 2026.5.130 → 2026.5.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/atomic-tools-contract.test.d.ts +14 -0
- package/dist/__tests__/atomic-tools-contract.test.d.ts.map +1 -0
- package/dist/__tests__/atomic-tools-contract.test.js +55 -0
- package/dist/__tests__/atomic-tools-contract.test.js.map +1 -0
- package/dist/__tests__/gateway-contract.test.d.ts +18 -0
- package/dist/__tests__/gateway-contract.test.d.ts.map +1 -0
- package/dist/__tests__/gateway-contract.test.js +187 -0
- package/dist/__tests__/gateway-contract.test.js.map +1 -0
- package/dist/__tests__/mvi.test.d.ts +17 -0
- package/dist/__tests__/mvi.test.d.ts.map +1 -0
- package/dist/__tests__/mvi.test.js +147 -0
- package/dist/__tests__/mvi.test.js.map +1 -0
- package/dist/__tests__/operation-def.test.js +1 -1
- package/dist/__tests__/operation-def.test.js.map +1 -1
- package/dist/boundary.d.ts +26 -0
- package/dist/boundary.d.ts.map +1 -1
- package/dist/boundary.js +44 -6
- package/dist/boundary.js.map +1 -1
- package/dist/branch-lock.d.ts +35 -1
- package/dist/branch-lock.d.ts.map +1 -1
- package/dist/branch-lock.js +23 -2
- package/dist/branch-lock.js.map +1 -1
- package/dist/daemon/__tests__/health-roundtrip.test.d.ts +13 -0
- package/dist/daemon/__tests__/health-roundtrip.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/health-roundtrip.test.js +69 -0
- package/dist/daemon/__tests__/health-roundtrip.test.js.map +1 -0
- package/dist/daemon/health.d.ts +108 -0
- package/dist/daemon/health.d.ts.map +1 -0
- package/dist/daemon/health.js +95 -0
- package/dist/daemon/health.js.map +1 -0
- package/dist/daemon/index.d.ts +24 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +22 -0
- package/dist/daemon/index.js.map +1 -0
- package/dist/daemon/subsystem.d.ts +121 -0
- package/dist/daemon/subsystem.d.ts.map +1 -0
- package/dist/daemon/subsystem.js +28 -0
- package/dist/daemon/subsystem.js.map +1 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.d.ts +15 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.d.ts.map +1 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.js +40 -0
- package/dist/daemon-ipc/__tests__/daemon-ipc-freeze.test.js.map +1 -0
- package/dist/daemon-ipc/index.d.ts +44 -0
- package/dist/daemon-ipc/index.d.ts.map +1 -0
- package/dist/daemon-ipc/index.js +43 -0
- package/dist/daemon-ipc/index.js.map +1 -0
- package/dist/db-inventory.json +8 -8
- package/dist/dispatch/identity.d.ts +1 -1
- package/dist/dispatch/identity.d.ts.map +1 -1
- package/dist/dispatch/identity.js +3 -0
- package/dist/dispatch/identity.js.map +1 -1
- package/dist/dispatch/operation-def.d.ts +16 -0
- package/dist/dispatch/operation-def.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.d.ts.map +1 -1
- package/dist/dispatch/operations-registry.js +133 -0
- package/dist/dispatch/operations-registry.js.map +1 -1
- package/dist/exit-codes.d.ts +1 -1
- package/dist/exit-codes.js +1 -1
- package/dist/gateway/rpc/__tests__/freeze.test.d.ts +20 -0
- package/dist/gateway/rpc/__tests__/freeze.test.d.ts.map +1 -0
- package/dist/gateway/rpc/__tests__/freeze.test.js +122 -0
- package/dist/gateway/rpc/__tests__/freeze.test.js.map +1 -0
- package/dist/gateway/rpc/index.d.ts +23 -0
- package/dist/gateway/rpc/index.d.ts.map +1 -0
- package/dist/gateway/rpc/index.js +22 -0
- package/dist/gateway/rpc/index.js.map +1 -0
- package/dist/gateway/rpc/messages.d.ts +263 -0
- package/dist/gateway/rpc/messages.d.ts.map +1 -0
- package/dist/gateway/rpc/messages.js +152 -0
- package/dist/gateway/rpc/messages.js.map +1 -0
- package/dist/gateway/rpc/version.d.ts +39 -0
- package/dist/gateway/rpc/version.d.ts.map +1 -0
- package/dist/gateway/rpc/version.js +39 -0
- package/dist/gateway/rpc/version.js.map +1 -0
- package/dist/gateway.d.ts +239 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +171 -0
- package/dist/gateway.js.map +1 -0
- package/dist/goal.d.ts +314 -0
- package/dist/goal.d.ts.map +1 -0
- package/dist/goal.js +118 -0
- package/dist/goal.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/mvi.d.ts +209 -0
- package/dist/mvi.d.ts.map +1 -0
- package/dist/mvi.js +99 -0
- package/dist/mvi.js.map +1 -0
- package/dist/operations/attention.d.ts +114 -0
- package/dist/operations/attention.d.ts.map +1 -0
- package/dist/operations/attention.js +22 -0
- package/dist/operations/attention.js.map +1 -0
- package/dist/operations/focus.d.ts +25 -0
- package/dist/operations/focus.d.ts.map +1 -1
- package/dist/operations/index.d.ts +1 -0
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +1 -0
- package/dist/operations/index.js.map +1 -1
- package/dist/operations/session.d.ts +11 -0
- package/dist/operations/session.d.ts.map +1 -1
- package/dist/release/evidence-atoms.d.ts +3 -2
- package/dist/release/evidence-atoms.d.ts.map +1 -1
- package/dist/release/evidence-atoms.js +3 -2
- package/dist/release/evidence-atoms.js.map +1 -1
- package/dist/sdk-tool.d.ts +1 -1
- package/dist/sdk-tool.js +1 -1
- package/dist/supervisor-ipc/__tests__/freeze.test.d.ts +15 -0
- package/dist/supervisor-ipc/__tests__/freeze.test.d.ts.map +1 -0
- package/dist/supervisor-ipc/__tests__/freeze.test.js +159 -0
- package/dist/supervisor-ipc/__tests__/freeze.test.js.map +1 -0
- package/dist/supervisor-ipc/index.d.ts +15 -0
- package/dist/supervisor-ipc/index.d.ts.map +1 -0
- package/dist/supervisor-ipc/index.js +14 -0
- package/dist/supervisor-ipc/index.js.map +1 -0
- package/dist/supervisor-ipc/messages.d.ts +457 -0
- package/dist/supervisor-ipc/messages.d.ts.map +1 -0
- package/dist/supervisor-ipc/messages.js +312 -0
- package/dist/supervisor-ipc/messages.js.map +1 -0
- package/dist/supervisor-ipc/version.d.ts +29 -0
- package/dist/supervisor-ipc/version.d.ts.map +1 -0
- package/dist/supervisor-ipc/version.js +29 -0
- package/dist/supervisor-ipc/version.js.map +1 -0
- package/dist/task.d.ts +5 -5
- package/dist/tools/__tests__/composite.test.d.ts +14 -0
- package/dist/tools/__tests__/composite.test.d.ts.map +1 -0
- package/dist/tools/__tests__/composite.test.js +75 -0
- package/dist/tools/__tests__/composite.test.js.map +1 -0
- package/dist/tools/atomic.d.ts +195 -0
- package/dist/tools/atomic.d.ts.map +1 -0
- package/dist/tools/atomic.js +82 -0
- package/dist/tools/atomic.js.map +1 -0
- package/dist/tools/composite.d.ts +128 -0
- package/dist/tools/composite.d.ts.map +1 -0
- package/dist/tools/composite.js +88 -0
- package/dist/tools/composite.js.map +1 -0
- package/package.json +34 -2
- package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
- package/src/__tests__/atomic-tools-contract.test.ts +67 -0
- package/src/__tests__/gateway-contract.test.ts +219 -0
- package/src/__tests__/mvi.test.ts +175 -0
- package/src/__tests__/operation-def.test.ts +2 -1
- package/src/boundary.ts +76 -6
- package/src/branch-lock.ts +49 -2
- package/src/daemon/__tests__/health-roundtrip.test.ts +84 -0
- package/src/daemon/health.ts +121 -0
- package/src/daemon/index.ts +35 -0
- package/src/daemon/subsystem.ts +126 -0
- package/src/daemon-ipc/__tests__/daemon-ipc-freeze.test.ts +53 -0
- package/src/daemon-ipc/index.ts +90 -0
- package/src/db-inventory.json +8 -8
- package/src/dispatch/identity.ts +3 -0
- package/src/dispatch/operation-def.ts +16 -0
- package/src/dispatch/operations-registry.ts +140 -0
- package/src/exit-codes.ts +1 -1
- package/src/gateway/rpc/__tests__/freeze.test.ts +139 -0
- package/src/gateway/rpc/index.ts +43 -0
- package/src/gateway/rpc/messages.ts +187 -0
- package/src/gateway/rpc/version.ts +40 -0
- package/src/gateway.ts +252 -0
- package/src/goal.ts +348 -0
- package/src/index.ts +109 -0
- package/src/mvi.ts +236 -0
- package/src/operations/attention.ts +117 -0
- package/src/operations/focus.ts +26 -0
- package/src/operations/index.ts +1 -0
- package/src/operations/session.ts +11 -0
- package/src/release/evidence-atoms.ts +3 -2
- package/src/sdk-tool.ts +1 -1
- package/src/supervisor-ipc/__tests__/freeze.test.ts +180 -0
- package/src/supervisor-ipc/index.ts +62 -0
- package/src/supervisor-ipc/messages.ts +396 -0
- package/src/supervisor-ipc/version.ts +30 -0
- package/src/task.ts +5 -5
- package/src/tools/__tests__/composite.test.ts +88 -0
- package/src/tools/atomic.ts +274 -0
- package/src/tools/composite.ts +173 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FROZEN protocol version for the `gateway/rpc` v1.0 wire contract.
|
|
3
|
+
*
|
|
4
|
+
* The CLI-RPC transport adapter (`@cleocode/runtime/gateway/rpc`) and any RPC
|
|
5
|
+
* client MUST agree on this value. The wire format is newline-delimited JSON
|
|
6
|
+
* (NDJSON): one {@link GatewayRpcFrame} per line over a unix-domain socket —
|
|
7
|
+
* the same framing discipline as the FROZEN `supervisor-ipc` v1.0 contract
|
|
8
|
+
* (`packages/contracts/src/supervisor-ipc/`), but a SEPARATE message set: this
|
|
9
|
+
* carries `DispatchRequest`/`DispatchResponse` over the gateway, not supervisor
|
|
10
|
+
* process-control messages.
|
|
11
|
+
*
|
|
12
|
+
* Bump only via a new major contract revision in a new directory, never edit
|
|
13
|
+
* this value in place — see {@link GATEWAY_RPC_MESSAGE_KINDS} for the frozen
|
|
14
|
+
* v1.0 message set.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc7464 | NDJSON framing}
|
|
17
|
+
* @task T11449
|
|
18
|
+
* @epic T11254
|
|
19
|
+
* @saga T11243
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* The frozen `gateway/rpc` protocol version string.
|
|
24
|
+
*
|
|
25
|
+
* Both the TS drift test (`__tests__/freeze.test.ts`) and the adapter's
|
|
26
|
+
* version-negotiation handshake pin this exact value. A frame whose
|
|
27
|
+
* `protocol_version` differs from this is rejected with an `error` frame.
|
|
28
|
+
*/
|
|
29
|
+
export declare const GATEWAY_RPC_PROTOCOL_VERSION: "1.0.0";
|
|
30
|
+
/**
|
|
31
|
+
* Default base name for the RPC unix-socket channel.
|
|
32
|
+
*
|
|
33
|
+
* Callers resolve the concrete socket path under the CLEO home (e.g.
|
|
34
|
+
* `<cleoHome>/<basename>.sock`); the adapter itself takes the resolved path so
|
|
35
|
+
* the runtime stays free of any `@cleocode/paths` dependency. Mirrors
|
|
36
|
+
* {@link SUPERVISOR_IPC_CHANNEL_BASENAME} from the supervisor-ipc contract.
|
|
37
|
+
*/
|
|
38
|
+
export declare const GATEWAY_RPC_CHANNEL_BASENAME: "cleo-gateway-rpc";
|
|
39
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/gateway/rpc/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,EAAG,OAAgB,CAAC;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,EAAG,kBAA2B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FROZEN protocol version for the `gateway/rpc` v1.0 wire contract.
|
|
3
|
+
*
|
|
4
|
+
* The CLI-RPC transport adapter (`@cleocode/runtime/gateway/rpc`) and any RPC
|
|
5
|
+
* client MUST agree on this value. The wire format is newline-delimited JSON
|
|
6
|
+
* (NDJSON): one {@link GatewayRpcFrame} per line over a unix-domain socket —
|
|
7
|
+
* the same framing discipline as the FROZEN `supervisor-ipc` v1.0 contract
|
|
8
|
+
* (`packages/contracts/src/supervisor-ipc/`), but a SEPARATE message set: this
|
|
9
|
+
* carries `DispatchRequest`/`DispatchResponse` over the gateway, not supervisor
|
|
10
|
+
* process-control messages.
|
|
11
|
+
*
|
|
12
|
+
* Bump only via a new major contract revision in a new directory, never edit
|
|
13
|
+
* this value in place — see {@link GATEWAY_RPC_MESSAGE_KINDS} for the frozen
|
|
14
|
+
* v1.0 message set.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link https://datatracker.ietf.org/doc/html/rfc7464 | NDJSON framing}
|
|
17
|
+
* @task T11449
|
|
18
|
+
* @epic T11254
|
|
19
|
+
* @saga T11243
|
|
20
|
+
* @packageDocumentation
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* The frozen `gateway/rpc` protocol version string.
|
|
24
|
+
*
|
|
25
|
+
* Both the TS drift test (`__tests__/freeze.test.ts`) and the adapter's
|
|
26
|
+
* version-negotiation handshake pin this exact value. A frame whose
|
|
27
|
+
* `protocol_version` differs from this is rejected with an `error` frame.
|
|
28
|
+
*/
|
|
29
|
+
export const GATEWAY_RPC_PROTOCOL_VERSION = '1.0.0';
|
|
30
|
+
/**
|
|
31
|
+
* Default base name for the RPC unix-socket channel.
|
|
32
|
+
*
|
|
33
|
+
* Callers resolve the concrete socket path under the CLEO home (e.g.
|
|
34
|
+
* `<cleoHome>/<basename>.sock`); the adapter itself takes the resolved path so
|
|
35
|
+
* the runtime stays free of any `@cleocode/paths` dependency. Mirrors
|
|
36
|
+
* {@link SUPERVISOR_IPC_CHANNEL_BASENAME} from the supervisor-ipc contract.
|
|
37
|
+
*/
|
|
38
|
+
export const GATEWAY_RPC_CHANNEL_BASENAME = 'cleo-gateway-rpc';
|
|
39
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/gateway/rpc/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAgB,CAAC;AAE7D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,kBAA2B,CAAC"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateway contract — the transport-agnostic CQRS dispatch shapes.
|
|
3
|
+
*
|
|
4
|
+
* Every operation flows through:
|
|
5
|
+
* GatewayRequest → Middleware → DomainHandler → GatewayResponse
|
|
6
|
+
*
|
|
7
|
+
* These shapes were promoted verbatim from `packages/cleo/src/dispatch/types.ts`
|
|
8
|
+
* into `@cleocode/contracts/gateway` (R3-T2 · T11446 · SG-RUNTIME-UNIFICATION)
|
|
9
|
+
* so that EVERY transport adapter — CLI, MCP, RPC, HTTP — shares one canonical,
|
|
10
|
+
* zod-validated contract instead of the CLI owning a private copy. The CLI was
|
|
11
|
+
* the only historical transport (`Source = 'cli'`); {@link GatewaySource} now
|
|
12
|
+
* widens that to the four planned transports.
|
|
13
|
+
*
|
|
14
|
+
* Design: the zod schemas are the single source of truth (AC8 — runtime
|
|
15
|
+
* validation at untrusted transport boundaries such as MCP/RPC/HTTP). The TS
|
|
16
|
+
* types are derived via {@link https://zod.dev | z.infer}, so the static and
|
|
17
|
+
* runtime contracts can never drift. The behavioral contracts that zod cannot
|
|
18
|
+
* model (function types: {@link DomainHandler}, {@link Middleware},
|
|
19
|
+
* {@link DispatchNext}) remain TS-only and reference the inferred data types.
|
|
20
|
+
*
|
|
21
|
+
* @epic T4820
|
|
22
|
+
* @task T11446
|
|
23
|
+
* @saga T11243
|
|
24
|
+
*/
|
|
25
|
+
import type { LAFSPage, MVILevel } from '@cleocode/lafs';
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
import type { CanonicalDomain, Gateway, Tier } from './dispatch/identity.js';
|
|
28
|
+
import type { ProblemDetails } from './engine-result.js';
|
|
29
|
+
export { CANONICAL_DOMAINS } from './dispatch/identity.js';
|
|
30
|
+
export type { CanonicalDomain, Gateway, Tier };
|
|
31
|
+
/**
|
|
32
|
+
* Frozen version of the gateway contract. Bump on any breaking change to the
|
|
33
|
+
* request/response/error shapes; the freeze + spec are owned by R3-T8 (T11452).
|
|
34
|
+
*/
|
|
35
|
+
export declare const GATEWAY_CONTRACT_VERSION: "1.0.0";
|
|
36
|
+
/** The four canonical transports a gateway request can originate from. */
|
|
37
|
+
export declare const GATEWAY_SOURCES: readonly ["cli", "mcp", "rpc", "http"];
|
|
38
|
+
/** Where a gateway request originated. Widened from the historical CLI-only `'cli'`. */
|
|
39
|
+
export declare const gatewaySourceSchema: z.ZodEnum<{
|
|
40
|
+
http: "http";
|
|
41
|
+
cli: "cli";
|
|
42
|
+
mcp: "mcp";
|
|
43
|
+
rpc: "rpc";
|
|
44
|
+
}>;
|
|
45
|
+
/** Where a gateway request originated. */
|
|
46
|
+
export type GatewaySource = z.infer<typeof gatewaySourceSchema>;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use {@link GatewaySource}. Retained as a structural alias so the
|
|
49
|
+
* historical `import type { Source }` sites keep compiling unchanged.
|
|
50
|
+
*/
|
|
51
|
+
export type Source = GatewaySource;
|
|
52
|
+
/**
|
|
53
|
+
* Canonical request shape produced by every transport adapter. The dispatcher
|
|
54
|
+
* validates this against the OperationRegistry before passing it through the
|
|
55
|
+
* middleware pipeline and into a {@link DomainHandler}.
|
|
56
|
+
*/
|
|
57
|
+
export declare const dispatchRequestSchema: z.ZodObject<{
|
|
58
|
+
gateway: z.ZodCustom<Gateway, Gateway>;
|
|
59
|
+
domain: z.ZodString;
|
|
60
|
+
operation: z.ZodString;
|
|
61
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
62
|
+
source: z.ZodEnum<{
|
|
63
|
+
http: "http";
|
|
64
|
+
cli: "cli";
|
|
65
|
+
mcp: "mcp";
|
|
66
|
+
rpc: "rpc";
|
|
67
|
+
}>;
|
|
68
|
+
requestId: z.ZodString;
|
|
69
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
70
|
+
originSessionId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
executionSessionId: z.ZodOptional<z.ZodString>;
|
|
72
|
+
_fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
73
|
+
_mvi: z.ZodOptional<z.ZodCustom<MVILevel, MVILevel>>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
/** {@inheritDoc dispatchRequestSchema} */
|
|
76
|
+
export type DispatchRequest = z.infer<typeof dispatchRequestSchema>;
|
|
77
|
+
/** Rate-limit metadata attached to every response. */
|
|
78
|
+
export declare const rateLimitMetaSchema: z.ZodObject<{
|
|
79
|
+
limit: z.ZodNumber;
|
|
80
|
+
remaining: z.ZodNumber;
|
|
81
|
+
resetMs: z.ZodNumber;
|
|
82
|
+
category: z.ZodString;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
/** {@inheritDoc rateLimitMetaSchema} */
|
|
85
|
+
export type RateLimitMeta = z.infer<typeof rateLimitMetaSchema>;
|
|
86
|
+
/** Structured error shape (LAFS-compatible). */
|
|
87
|
+
export declare const dispatchErrorSchema: z.ZodObject<{
|
|
88
|
+
code: z.ZodString;
|
|
89
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
message: z.ZodString;
|
|
91
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
92
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
93
|
+
alternatives: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
|
+
action: z.ZodString;
|
|
95
|
+
command: z.ZodString;
|
|
96
|
+
}, z.core.$strip>>>;
|
|
97
|
+
problemDetails: z.ZodOptional<z.ZodCustom<ProblemDetails, ProblemDetails>>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
/** {@inheritDoc dispatchErrorSchema} */
|
|
100
|
+
export type DispatchError = z.infer<typeof dispatchErrorSchema>;
|
|
101
|
+
/**
|
|
102
|
+
* Always-present metadata block on every {@link DispatchResponse}.
|
|
103
|
+
*
|
|
104
|
+
* The catch-all (`[key: string]: unknown`) makes this assignable to
|
|
105
|
+
* `Record<string, unknown>` in covariant positions, eliminating the T9767
|
|
106
|
+
* cast-chain anti-pattern at every responseMeta call site.
|
|
107
|
+
*
|
|
108
|
+
* @task T9767
|
|
109
|
+
*/
|
|
110
|
+
export declare const dispatchResponseMetaSchema: z.ZodObject<{
|
|
111
|
+
gateway: z.ZodCustom<Gateway, Gateway>;
|
|
112
|
+
domain: z.ZodString;
|
|
113
|
+
operation: z.ZodString;
|
|
114
|
+
timestamp: z.ZodString;
|
|
115
|
+
duration_ms: z.ZodNumber;
|
|
116
|
+
source: z.ZodEnum<{
|
|
117
|
+
http: "http";
|
|
118
|
+
cli: "cli";
|
|
119
|
+
mcp: "mcp";
|
|
120
|
+
rpc: "rpc";
|
|
121
|
+
}>;
|
|
122
|
+
requestId: z.ZodString;
|
|
123
|
+
rateLimit: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
limit: z.ZodNumber;
|
|
125
|
+
remaining: z.ZodNumber;
|
|
126
|
+
resetMs: z.ZodNumber;
|
|
127
|
+
category: z.ZodString;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
130
|
+
originSessionId: z.ZodOptional<z.ZodString>;
|
|
131
|
+
executionSessionId: z.ZodOptional<z.ZodString>;
|
|
132
|
+
version: z.ZodOptional<z.ZodString>;
|
|
133
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
134
|
+
/** {@inheritDoc dispatchResponseMetaSchema} */
|
|
135
|
+
export type DispatchResponseMeta = z.infer<typeof dispatchResponseMetaSchema>;
|
|
136
|
+
/**
|
|
137
|
+
* Canonical response shape returned by the dispatcher. The CLI adapter
|
|
138
|
+
* translates this into cliOutput() / cliError() + process.exit(); other
|
|
139
|
+
* transports serialize it onto their wire.
|
|
140
|
+
*/
|
|
141
|
+
export declare const dispatchResponseSchema: z.ZodObject<{
|
|
142
|
+
meta: z.ZodObject<{
|
|
143
|
+
gateway: z.ZodCustom<Gateway, Gateway>;
|
|
144
|
+
domain: z.ZodString;
|
|
145
|
+
operation: z.ZodString;
|
|
146
|
+
timestamp: z.ZodString;
|
|
147
|
+
duration_ms: z.ZodNumber;
|
|
148
|
+
source: z.ZodEnum<{
|
|
149
|
+
http: "http";
|
|
150
|
+
cli: "cli";
|
|
151
|
+
mcp: "mcp";
|
|
152
|
+
rpc: "rpc";
|
|
153
|
+
}>;
|
|
154
|
+
requestId: z.ZodString;
|
|
155
|
+
rateLimit: z.ZodOptional<z.ZodObject<{
|
|
156
|
+
limit: z.ZodNumber;
|
|
157
|
+
remaining: z.ZodNumber;
|
|
158
|
+
resetMs: z.ZodNumber;
|
|
159
|
+
category: z.ZodString;
|
|
160
|
+
}, z.core.$strip>>;
|
|
161
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
162
|
+
originSessionId: z.ZodOptional<z.ZodString>;
|
|
163
|
+
executionSessionId: z.ZodOptional<z.ZodString>;
|
|
164
|
+
version: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
166
|
+
success: z.ZodBoolean;
|
|
167
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
168
|
+
page: z.ZodOptional<z.ZodCustom<LAFSPage, LAFSPage>>;
|
|
169
|
+
partial: z.ZodOptional<z.ZodBoolean>;
|
|
170
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
171
|
+
code: z.ZodString;
|
|
172
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
173
|
+
message: z.ZodString;
|
|
174
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
175
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
176
|
+
alternatives: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
177
|
+
action: z.ZodString;
|
|
178
|
+
command: z.ZodString;
|
|
179
|
+
}, z.core.$strip>>>;
|
|
180
|
+
problemDetails: z.ZodOptional<z.ZodCustom<ProblemDetails, ProblemDetails>>;
|
|
181
|
+
}, z.core.$strip>>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
/** {@inheritDoc dispatchResponseSchema} */
|
|
184
|
+
export type DispatchResponse = z.infer<typeof dispatchResponseSchema>;
|
|
185
|
+
/**
|
|
186
|
+
* A single frame emitted by a streaming gateway operation. Unary transports
|
|
187
|
+
* (CLI) never see these; streaming transports (Studio SSE, RPC server-push)
|
|
188
|
+
* emit a sequence terminated by a `done` or `error` event.
|
|
189
|
+
*/
|
|
190
|
+
export declare const gatewayStreamEventSchema: z.ZodObject<{
|
|
191
|
+
kind: z.ZodEnum<{
|
|
192
|
+
error: "error";
|
|
193
|
+
done: "done";
|
|
194
|
+
data: "data";
|
|
195
|
+
}>;
|
|
196
|
+
seq: z.ZodNumber;
|
|
197
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
198
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
code: z.ZodString;
|
|
200
|
+
exitCode: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
message: z.ZodString;
|
|
202
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
203
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
204
|
+
alternatives: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
205
|
+
action: z.ZodString;
|
|
206
|
+
command: z.ZodString;
|
|
207
|
+
}, z.core.$strip>>>;
|
|
208
|
+
problemDetails: z.ZodOptional<z.ZodCustom<ProblemDetails, ProblemDetails>>;
|
|
209
|
+
}, z.core.$strip>>;
|
|
210
|
+
requestId: z.ZodString;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
/** {@inheritDoc gatewayStreamEventSchema} */
|
|
213
|
+
export type GatewayStreamEvent = z.infer<typeof gatewayStreamEventSchema>;
|
|
214
|
+
/**
|
|
215
|
+
* Contract for domain handlers.
|
|
216
|
+
*
|
|
217
|
+
* Each canonical domain (tasks, session, memory, check, pipeline, orchestrate,
|
|
218
|
+
* tools, admin, nexus, sticky, intelligence) implements this interface.
|
|
219
|
+
*/
|
|
220
|
+
export interface DomainHandler {
|
|
221
|
+
/** Execute a read-only query operation. */
|
|
222
|
+
query(operation: string, params?: Record<string, unknown>): Promise<DispatchResponse>;
|
|
223
|
+
/** Execute a state-modifying mutation operation. */
|
|
224
|
+
mutate(operation: string, params?: Record<string, unknown>): Promise<DispatchResponse>;
|
|
225
|
+
/** Declared operations for introspection and validation. */
|
|
226
|
+
getSupportedOperations(): {
|
|
227
|
+
query: string[];
|
|
228
|
+
mutate: string[];
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/** Async continuation that produces a {@link DispatchResponse}. */
|
|
232
|
+
export type DispatchNext = () => Promise<DispatchResponse>;
|
|
233
|
+
/**
|
|
234
|
+
* Middleware function signature. Receives the request and a `next`
|
|
235
|
+
* continuation; can short-circuit (e.g. rate-limit exceeded) or modify the
|
|
236
|
+
* request/response.
|
|
237
|
+
*/
|
|
238
|
+
export type Middleware = (request: DispatchRequest, next: DispatchNext) => Promise<DispatchResponse>;
|
|
239
|
+
//# sourceMappingURL=gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;A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AEH,2CAA2C;AAC3C,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAMtE;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;iBAWnC,CAAC;AAEH,6CAA6C;AAC7C,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAM1E;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtF,oDAAoD;IACpD,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACvF,4DAA4D;IAC5D,sBAAsB,IAAI;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CACjE;AAED,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CACvB,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,YAAY,KACf,OAAO,CAAC,gBAAgB,CAAC,CAAC"}
|
package/dist/gateway.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateway contract — the transport-agnostic CQRS dispatch shapes.
|
|
3
|
+
*
|
|
4
|
+
* Every operation flows through:
|
|
5
|
+
* GatewayRequest → Middleware → DomainHandler → GatewayResponse
|
|
6
|
+
*
|
|
7
|
+
* These shapes were promoted verbatim from `packages/cleo/src/dispatch/types.ts`
|
|
8
|
+
* into `@cleocode/contracts/gateway` (R3-T2 · T11446 · SG-RUNTIME-UNIFICATION)
|
|
9
|
+
* so that EVERY transport adapter — CLI, MCP, RPC, HTTP — shares one canonical,
|
|
10
|
+
* zod-validated contract instead of the CLI owning a private copy. The CLI was
|
|
11
|
+
* the only historical transport (`Source = 'cli'`); {@link GatewaySource} now
|
|
12
|
+
* widens that to the four planned transports.
|
|
13
|
+
*
|
|
14
|
+
* Design: the zod schemas are the single source of truth (AC8 — runtime
|
|
15
|
+
* validation at untrusted transport boundaries such as MCP/RPC/HTTP). The TS
|
|
16
|
+
* types are derived via {@link https://zod.dev | z.infer}, so the static and
|
|
17
|
+
* runtime contracts can never drift. The behavioral contracts that zod cannot
|
|
18
|
+
* model (function types: {@link DomainHandler}, {@link Middleware},
|
|
19
|
+
* {@link DispatchNext}) remain TS-only and reference the inferred data types.
|
|
20
|
+
*
|
|
21
|
+
* @epic T4820
|
|
22
|
+
* @task T11446
|
|
23
|
+
* @saga T11243
|
|
24
|
+
*/
|
|
25
|
+
import { isMVILevel } from '@cleocode/lafs';
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
export { CANONICAL_DOMAINS } from './dispatch/identity.js';
|
|
28
|
+
/**
|
|
29
|
+
* Frozen version of the gateway contract. Bump on any breaking change to the
|
|
30
|
+
* request/response/error shapes; the freeze + spec are owned by R3-T8 (T11452).
|
|
31
|
+
*/
|
|
32
|
+
export const GATEWAY_CONTRACT_VERSION = '1.0.0';
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// GatewaySource — transport of origin
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
/** The four canonical transports a gateway request can originate from. */
|
|
37
|
+
export const GATEWAY_SOURCES = ['cli', 'mcp', 'rpc', 'http'];
|
|
38
|
+
/** Where a gateway request originated. Widened from the historical CLI-only `'cli'`. */
|
|
39
|
+
export const gatewaySourceSchema = z.enum(GATEWAY_SOURCES);
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Foreign-type bridges (kept opaque to avoid re-deriving lafs/contracts schemas)
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
/** MVI verbosity level — validated through lafs's own {@link isMVILevel} guard (DRY SoT). */
|
|
44
|
+
const mviLevelSchema = z.custom((v) => isMVILevel(v));
|
|
45
|
+
/** LAFS pagination envelope — produced internally; carried opaquely across transports. */
|
|
46
|
+
const lafsPageSchema = z.custom();
|
|
47
|
+
/** RFC 9457 Problem Details — produced internally from CleoError.toProblemDetails(). */
|
|
48
|
+
const problemDetailsSchema = z.custom();
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
// DispatchRequest
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
/**
|
|
53
|
+
* Canonical request shape produced by every transport adapter. The dispatcher
|
|
54
|
+
* validates this against the OperationRegistry before passing it through the
|
|
55
|
+
* middleware pipeline and into a {@link DomainHandler}.
|
|
56
|
+
*/
|
|
57
|
+
export const dispatchRequestSchema = z.object({
|
|
58
|
+
/** CQRS gateway (command/query). */
|
|
59
|
+
gateway: z.custom(),
|
|
60
|
+
/** Target domain (canonical name). */
|
|
61
|
+
domain: z.string(),
|
|
62
|
+
/** Domain-specific operation name. */
|
|
63
|
+
operation: z.string(),
|
|
64
|
+
/** Operation parameters (already sanitized by middleware). */
|
|
65
|
+
params: z.record(z.string(), z.unknown()).optional(),
|
|
66
|
+
/** Which transport this request came from. */
|
|
67
|
+
source: gatewaySourceSchema,
|
|
68
|
+
/** Unique request identifier for tracing. */
|
|
69
|
+
requestId: z.string(),
|
|
70
|
+
/** Bound session ID, if any. */
|
|
71
|
+
sessionId: z.string().optional(),
|
|
72
|
+
/** Root session that originated the workflow/saga, if any. */
|
|
73
|
+
originSessionId: z.string().optional(),
|
|
74
|
+
/** Specific execution instance for this command/step, if any. */
|
|
75
|
+
executionSessionId: z.string().optional(),
|
|
76
|
+
/** LAFS field selection: filter response data to these fields only. */
|
|
77
|
+
_fields: z.array(z.string()).optional(),
|
|
78
|
+
/** LAFS envelope verbosity. Defaults to 'standard'. 'custom' is server-set via _fields. */
|
|
79
|
+
_mvi: mviLevelSchema.optional(),
|
|
80
|
+
});
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
// DispatchResponse + supporting shapes
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
/** Rate-limit metadata attached to every response. */
|
|
85
|
+
export const rateLimitMetaSchema = z.object({
|
|
86
|
+
limit: z.number(),
|
|
87
|
+
remaining: z.number(),
|
|
88
|
+
resetMs: z.number(),
|
|
89
|
+
category: z.string(),
|
|
90
|
+
});
|
|
91
|
+
/** Structured error shape (LAFS-compatible). */
|
|
92
|
+
export const dispatchErrorSchema = z.object({
|
|
93
|
+
/** Machine-readable error code (E_NOT_FOUND, E_VALIDATION_FAILED, …). */
|
|
94
|
+
code: z.string(),
|
|
95
|
+
/** LAFS exit code (1-99). */
|
|
96
|
+
exitCode: z.number().optional(),
|
|
97
|
+
/** Human-readable message. */
|
|
98
|
+
message: z.string(),
|
|
99
|
+
/** Additional structured details. */
|
|
100
|
+
details: z.record(z.string(), z.unknown()).optional(),
|
|
101
|
+
/** Copy-paste fix command. */
|
|
102
|
+
fix: z.string().optional(),
|
|
103
|
+
/** Alternative actions the caller can try. */
|
|
104
|
+
alternatives: z.array(z.object({ action: z.string(), command: z.string() })).optional(),
|
|
105
|
+
/** RFC 9457 Problem Details (populated from CleoError.toProblemDetails()). */
|
|
106
|
+
problemDetails: problemDetailsSchema.optional(),
|
|
107
|
+
});
|
|
108
|
+
/**
|
|
109
|
+
* Always-present metadata block on every {@link DispatchResponse}.
|
|
110
|
+
*
|
|
111
|
+
* The catch-all (`[key: string]: unknown`) makes this assignable to
|
|
112
|
+
* `Record<string, unknown>` in covariant positions, eliminating the T9767
|
|
113
|
+
* cast-chain anti-pattern at every responseMeta call site.
|
|
114
|
+
*
|
|
115
|
+
* @task T9767
|
|
116
|
+
*/
|
|
117
|
+
export const dispatchResponseMetaSchema = z
|
|
118
|
+
.object({
|
|
119
|
+
gateway: z.custom(),
|
|
120
|
+
domain: z.string(),
|
|
121
|
+
operation: z.string(),
|
|
122
|
+
timestamp: z.string(),
|
|
123
|
+
duration_ms: z.number(),
|
|
124
|
+
source: gatewaySourceSchema,
|
|
125
|
+
requestId: z.string(),
|
|
126
|
+
rateLimit: rateLimitMetaSchema.optional(),
|
|
127
|
+
/** Session ID that processed this request (T4959). */
|
|
128
|
+
sessionId: z.string().optional(),
|
|
129
|
+
/** Root session that originated the workflow/saga. */
|
|
130
|
+
originSessionId: z.string().optional(),
|
|
131
|
+
/** Specific execution instance for this command/step. */
|
|
132
|
+
executionSessionId: z.string().optional(),
|
|
133
|
+
/** Preserves protocol-level version for backward compat. */
|
|
134
|
+
version: z.string().optional(),
|
|
135
|
+
})
|
|
136
|
+
.catchall(z.unknown());
|
|
137
|
+
/**
|
|
138
|
+
* Canonical response shape returned by the dispatcher. The CLI adapter
|
|
139
|
+
* translates this into cliOutput() / cliError() + process.exit(); other
|
|
140
|
+
* transports serialize it onto their wire.
|
|
141
|
+
*/
|
|
142
|
+
export const dispatchResponseSchema = z.object({
|
|
143
|
+
/** Always-present metadata for every dispatch response. */
|
|
144
|
+
meta: dispatchResponseMetaSchema,
|
|
145
|
+
success: z.boolean(),
|
|
146
|
+
data: z.unknown().optional(),
|
|
147
|
+
page: lafsPageSchema.optional(),
|
|
148
|
+
partial: z.boolean().optional(),
|
|
149
|
+
error: dispatchErrorSchema.optional(),
|
|
150
|
+
});
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
// GatewayStreamEvent — for streaming transports (SSE/HTTP, RPC server-push)
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
/**
|
|
155
|
+
* A single frame emitted by a streaming gateway operation. Unary transports
|
|
156
|
+
* (CLI) never see these; streaming transports (Studio SSE, RPC server-push)
|
|
157
|
+
* emit a sequence terminated by a `done` or `error` event.
|
|
158
|
+
*/
|
|
159
|
+
export const gatewayStreamEventSchema = z.object({
|
|
160
|
+
/** Frame kind: incremental data, terminal success, or terminal error. */
|
|
161
|
+
kind: z.enum(['data', 'done', 'error']),
|
|
162
|
+
/** Monotonic sequence number within the stream (0-based). */
|
|
163
|
+
seq: z.number(),
|
|
164
|
+
/** Payload for `data`/`done` frames. */
|
|
165
|
+
data: z.unknown().optional(),
|
|
166
|
+
/** Error detail for `error` frames. */
|
|
167
|
+
error: dispatchErrorSchema.optional(),
|
|
168
|
+
/** Correlates the stream back to its originating request. */
|
|
169
|
+
requestId: z.string(),
|
|
170
|
+
});
|
|
171
|
+
//# sourceMappingURL=gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.js","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAgB,CAAC;AAEzD,8EAA8E;AAC9E,sCAAsC;AACtC,8EAA8E;AAE9E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAU,CAAC;AAEtE,wFAAwF;AACxF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAW3D,8EAA8E;AAC9E,iFAAiF;AACjF,8EAA8E;AAE9E,6FAA6F;AAC7F,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAW,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhE,0FAA0F;AAC1F,MAAM,cAAc,GAA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