@clowder-ai/plugin-sdk 0.1.0-beta.5
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/contract-mirror.d.ts +120 -0
- package/dist/contract-mirror.d.ts.map +1 -0
- package/dist/contract-mirror.js +179 -0
- package/dist/contract-mirror.js.map +1 -0
- package/dist/events-publisher.d.ts +34 -0
- package/dist/events-publisher.d.ts.map +1 -0
- package/dist/events-publisher.js +62 -0
- package/dist/events-publisher.js.map +1 -0
- package/dist/handshake-client.d.ts +66 -0
- package/dist/handshake-client.d.ts.map +1 -0
- package/dist/handshake-client.js +124 -0
- package/dist/handshake-client.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/standalone-host.d.ts +43 -0
- package/dist/standalone-host.d.ts.map +1 -0
- package/dist/standalone-host.js +195 -0
- package/dist/standalone-host.js.map +1 -0
- package/dist/stdio-runtime.d.ts +50 -0
- package/dist/stdio-runtime.d.ts.map +1 -0
- package/dist/stdio-runtime.js +294 -0
- package/dist/stdio-runtime.js.map +1 -0
- package/dist/wire-dispatch.d.ts +43 -0
- package/dist/wire-dispatch.d.ts.map +1 -0
- package/dist/wire-dispatch.js +999 -0
- package/dist/wire-dispatch.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract-mirror constants — runtime key sets and enum values that
|
|
3
|
+
* mirror @clowder-ai/plugin-contract TypeScript interfaces and types.
|
|
4
|
+
*
|
|
5
|
+
* These exist because the contract expresses certain closed constraints
|
|
6
|
+
* (additionalProperties: false, enum unions) only at the type level,
|
|
7
|
+
* with no runtime array/set export.
|
|
8
|
+
*
|
|
9
|
+
* ## DELETION TARGET
|
|
10
|
+
*
|
|
11
|
+
* Every constant in this module is scheduled for deletion when the
|
|
12
|
+
* contract exports a runtime equivalent (beta.5 delta scope, Fable
|
|
13
|
+
* ruling on S1 R3 contract seam). Each constant documents which
|
|
14
|
+
* contract source it mirrors.
|
|
15
|
+
*
|
|
16
|
+
* ## Drift prevention
|
|
17
|
+
*
|
|
18
|
+
* contract-mirror.test.ts verifies each constant against the contract
|
|
19
|
+
* source (schema JSON enum where available, structural assertions
|
|
20
|
+
* against contract types elsewhere). Drift = CI red.
|
|
21
|
+
*
|
|
22
|
+
* Pattern precedent: #10 MAX_FRAME_BYTES alias + drift test → Fable
|
|
23
|
+
* ruling 1 (fixtures test-only import) → this ruling (systematic).
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* MessagingErrorCode runtime values.
|
|
27
|
+
*
|
|
28
|
+
* Mirror of: messaging.schema.json → definitions.MessagingErrorCode.enum
|
|
29
|
+
* Contract type: MessagingErrorCode (contract.generated.ts:217)
|
|
30
|
+
* Drift test: automated, vs schema JSON enum (exact member + order match)
|
|
31
|
+
*/
|
|
32
|
+
export declare const MESSAGING_ERROR_CODES: readonly ["VALIDATION", "PERMISSION", "NOT_FOUND", "CONFLICT", "RETRYABLE_INFLIGHT", "STALE_CURSOR"];
|
|
33
|
+
export declare const MESSAGING_ERROR_CODE_SET: Set<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Mirror of: WireSuccessResponse interface (envelope.ts:108-113)
|
|
36
|
+
* Keys: jsonrpc, id, result — additionalProperties: false
|
|
37
|
+
*/
|
|
38
|
+
export declare const RESPONSE_SUCCESS_KEYS: Set<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Mirror of: WireApplicationErrorResponse / WireStandardErrorResponse
|
|
41
|
+
* (envelope.ts:129-166). Keys: jsonrpc, id, error — additionalProperties: false
|
|
42
|
+
*/
|
|
43
|
+
export declare const RESPONSE_ERROR_KEYS: Set<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Mirror of: WireNotification interface (envelope.ts:89-96)
|
|
46
|
+
* Keys: jsonrpc, method, params — additionalProperties: false
|
|
47
|
+
*/
|
|
48
|
+
export declare const NOTIFICATION_ALLOWED_KEYS: Set<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Mirror of: WireRequest interface (envelope.ts:66-75)
|
|
51
|
+
* Keys: jsonrpc, id, method, params — additionalProperties: false
|
|
52
|
+
*/
|
|
53
|
+
export declare const REQUEST_ALLOWED_KEYS: Set<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Mirror of: WireRequest.params / WireNotification.params (envelope.ts:71-74, 93-95)
|
|
56
|
+
* Keys: meta, input — additionalProperties: false
|
|
57
|
+
*/
|
|
58
|
+
export declare const PARAMS_ALLOWED_KEYS: Set<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Mirror of: CallMeta interface (envelope.ts:43-52)
|
|
61
|
+
* Keys: deadlineUnixMs — additionalProperties: false, v0 single field
|
|
62
|
+
*/
|
|
63
|
+
export declare const META_ALLOWED_KEYS: Set<string>;
|
|
64
|
+
/** Mirror of: PingInput (row-shapes.ts:144-147). Keys: {nonce} */
|
|
65
|
+
export declare const PING_INPUT_KEYS: Set<string>;
|
|
66
|
+
/** Mirror of: DrainInput (row-shapes.ts:183-193). Keys: {deadlineUnixMs} */
|
|
67
|
+
export declare const DRAIN_INPUT_KEYS: Set<string>;
|
|
68
|
+
/** Mirror of: SubscribeInput (row-shapes.ts:27-30). Keys: {handle} */
|
|
69
|
+
export declare const SUBSCRIBE_INPUT_KEYS: Set<string>;
|
|
70
|
+
/** Mirror of: MessagingAckRequest (row-shapes.ts:76-81). Keys: {subscriptionId, ackToken} */
|
|
71
|
+
export declare const ACK_INPUT_KEYS: Set<string>;
|
|
72
|
+
/** Mirror of: GrantsChangedInput = GrantSnapshot (row-shapes.ts:128, grants.ts). Keys: {grantRevision, effectiveGrants} */
|
|
73
|
+
export declare const GRANTS_CHANGED_INPUT_KEYS: Set<string>;
|
|
74
|
+
/** Mirror of: CandidateHello (handshake.ts:62-71). */
|
|
75
|
+
export declare const CANDIDATE_HELLO_KEYS: Set<string>;
|
|
76
|
+
/** Mirror of: SessionBinding (handshake.ts:82-101). */
|
|
77
|
+
export declare const SESSION_BINDING_KEYS: Set<string>;
|
|
78
|
+
/** Mirror of: BrokerReadyParams (handshake.ts:113-116). */
|
|
79
|
+
export declare const BROKER_READY_PARAMS_KEYS: Set<string>;
|
|
80
|
+
/** Mirror of: PingResult (row-shapes.ts:152-158). Keys: {nonce} */
|
|
81
|
+
export declare const PING_RESULT_KEYS: Set<string>;
|
|
82
|
+
/** Mirror of: SubscribeResult (row-shapes.ts:35-39). Keys: {subscriptionId} */
|
|
83
|
+
export declare const SUBSCRIBE_RESULT_KEYS: Set<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Mirror of: deliver acknowledgement result closed member set.
|
|
86
|
+
* Row 9 (host.messaging.deliver) has a frozen ack result shape
|
|
87
|
+
* {deliveryId: string, length 1..128 code points} — additionalProperties: false.
|
|
88
|
+
*
|
|
89
|
+
* Despite row 9 being RESERVED overall (DeliverResult = never in types),
|
|
90
|
+
* the ack shape is frozen per the #1165 protocol specification. The
|
|
91
|
+
* deliveryId echo is the fundamental delivery acknowledgement mechanism.
|
|
92
|
+
*
|
|
93
|
+
* Maintainer requirement: enforce closed member set + string bounds.
|
|
94
|
+
*/
|
|
95
|
+
export declare const DELIVER_RESULT_KEYS: Set<string>;
|
|
96
|
+
/** Minimum deliveryId code-point length (frozen row 9 ack shape). */
|
|
97
|
+
export declare const DELIVER_DELIVERY_ID_MIN_LENGTH: 1;
|
|
98
|
+
/** Maximum deliveryId code-point length (frozen row 9 ack shape). */
|
|
99
|
+
export declare const DELIVER_DELIVERY_ID_MAX_LENGTH: 128;
|
|
100
|
+
/**
|
|
101
|
+
* Mirror of: StandardWireError body keys (errors.ts:240-299)
|
|
102
|
+
* Standard errors: {code, message} — no data field.
|
|
103
|
+
*/
|
|
104
|
+
export declare const ERROR_BODY_STANDARD_KEYS: Set<string>;
|
|
105
|
+
/**
|
|
106
|
+
* Mirror of: ApplicationWireError body keys (errors.ts:182-234)
|
|
107
|
+
* Application errors: {code, message, data} — data required.
|
|
108
|
+
*/
|
|
109
|
+
export declare const ERROR_BODY_APPLICATION_KEYS: Set<string>;
|
|
110
|
+
/**
|
|
111
|
+
* Mirror of: HandshakeRejectedError.data / DeliveryRejectedError.data /
|
|
112
|
+
* SnapshotUnavailableError.data — all {reason: <enum>}
|
|
113
|
+
*/
|
|
114
|
+
export declare const REASON_DATA_KEYS: Set<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Mirror of: DomainError.data (errors.ts:205-206)
|
|
117
|
+
* Keys: {code: MessagingErrorCode} — additionalProperties: false
|
|
118
|
+
*/
|
|
119
|
+
export declare const CODE_DATA_KEYS: Set<string>;
|
|
120
|
+
//# sourceMappingURL=contract-mirror.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-mirror.d.ts","sourceRoot":"","sources":["../src/contract-mirror.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,sGAOxB,CAAC;AAEX,eAAO,MAAM,wBAAwB,aAAyC,CAAC;AAM/E;;;GAGG;AACH,eAAO,MAAM,qBAAqB,aAAuC,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aAAsC,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,yBAAyB,aAA2C,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,aAAiD,CAAC;AAMnF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aAA6B,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,iBAAiB,aAA8B,CAAC;AAM7D,kEAAkE;AAClE,eAAO,MAAM,eAAe,aAAqB,CAAC;AAElD,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,aAA8B,CAAC;AAE5D,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,aAAsB,CAAC;AAExD,6FAA6F;AAC7F,eAAO,MAAM,cAAc,aAA0C,CAAC;AAEtE,2HAA2H;AAC3H,eAAO,MAAM,yBAAyB,aAAgD,CAAC;AAMvF,sDAAsD;AACtD,eAAO,MAAM,oBAAoB,aAK/B,CAAC;AAEH,uDAAuD;AACvD,eAAO,MAAM,oBAAoB,aAU/B,CAAC;AAEH,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,aAA4B,CAAC;AAMlE,mEAAmE;AACnE,eAAO,MAAM,gBAAgB,aAAqB,CAAC;AAEnD,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,aAA8B,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,aAA0B,CAAC;AAE3D,qEAAqE;AACrE,eAAO,MAAM,8BAA8B,EAAG,CAAU,CAAC;AAEzD,qEAAqE;AACrE,eAAO,MAAM,8BAA8B,EAAG,GAAY,CAAC;AAM3D;;;GAGG;AACH,eAAO,MAAM,wBAAwB,aAA+B,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,2BAA2B,aAAuC,CAAC;AAMhF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,aAAsB,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,cAAc,aAAoB,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract-mirror constants — runtime key sets and enum values that
|
|
3
|
+
* mirror @clowder-ai/plugin-contract TypeScript interfaces and types.
|
|
4
|
+
*
|
|
5
|
+
* These exist because the contract expresses certain closed constraints
|
|
6
|
+
* (additionalProperties: false, enum unions) only at the type level,
|
|
7
|
+
* with no runtime array/set export.
|
|
8
|
+
*
|
|
9
|
+
* ## DELETION TARGET
|
|
10
|
+
*
|
|
11
|
+
* Every constant in this module is scheduled for deletion when the
|
|
12
|
+
* contract exports a runtime equivalent (beta.5 delta scope, Fable
|
|
13
|
+
* ruling on S1 R3 contract seam). Each constant documents which
|
|
14
|
+
* contract source it mirrors.
|
|
15
|
+
*
|
|
16
|
+
* ## Drift prevention
|
|
17
|
+
*
|
|
18
|
+
* contract-mirror.test.ts verifies each constant against the contract
|
|
19
|
+
* source (schema JSON enum where available, structural assertions
|
|
20
|
+
* against contract types elsewhere). Drift = CI red.
|
|
21
|
+
*
|
|
22
|
+
* Pattern precedent: #10 MAX_FRAME_BYTES alias + drift test → Fable
|
|
23
|
+
* ruling 1 (fixtures test-only import) → this ruling (systematic).
|
|
24
|
+
*/
|
|
25
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
26
|
+
// Enum mirrors — contract has type-only unions, no runtime arrays
|
|
27
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
28
|
+
/**
|
|
29
|
+
* MessagingErrorCode runtime values.
|
|
30
|
+
*
|
|
31
|
+
* Mirror of: messaging.schema.json → definitions.MessagingErrorCode.enum
|
|
32
|
+
* Contract type: MessagingErrorCode (contract.generated.ts:217)
|
|
33
|
+
* Drift test: automated, vs schema JSON enum (exact member + order match)
|
|
34
|
+
*/
|
|
35
|
+
export const MESSAGING_ERROR_CODES = [
|
|
36
|
+
'VALIDATION',
|
|
37
|
+
'PERMISSION',
|
|
38
|
+
'NOT_FOUND',
|
|
39
|
+
'CONFLICT',
|
|
40
|
+
'RETRYABLE_INFLIGHT',
|
|
41
|
+
'STALE_CURSOR',
|
|
42
|
+
];
|
|
43
|
+
export const MESSAGING_ERROR_CODE_SET = new Set(MESSAGING_ERROR_CODES);
|
|
44
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
45
|
+
// Envelope outer key sets (additionalProperties: false)
|
|
46
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
47
|
+
/**
|
|
48
|
+
* Mirror of: WireSuccessResponse interface (envelope.ts:108-113)
|
|
49
|
+
* Keys: jsonrpc, id, result — additionalProperties: false
|
|
50
|
+
*/
|
|
51
|
+
export const RESPONSE_SUCCESS_KEYS = new Set(['jsonrpc', 'id', 'result']);
|
|
52
|
+
/**
|
|
53
|
+
* Mirror of: WireApplicationErrorResponse / WireStandardErrorResponse
|
|
54
|
+
* (envelope.ts:129-166). Keys: jsonrpc, id, error — additionalProperties: false
|
|
55
|
+
*/
|
|
56
|
+
export const RESPONSE_ERROR_KEYS = new Set(['jsonrpc', 'id', 'error']);
|
|
57
|
+
/**
|
|
58
|
+
* Mirror of: WireNotification interface (envelope.ts:89-96)
|
|
59
|
+
* Keys: jsonrpc, method, params — additionalProperties: false
|
|
60
|
+
*/
|
|
61
|
+
export const NOTIFICATION_ALLOWED_KEYS = new Set(['jsonrpc', 'method', 'params']);
|
|
62
|
+
/**
|
|
63
|
+
* Mirror of: WireRequest interface (envelope.ts:66-75)
|
|
64
|
+
* Keys: jsonrpc, id, method, params — additionalProperties: false
|
|
65
|
+
*/
|
|
66
|
+
export const REQUEST_ALLOWED_KEYS = new Set(['jsonrpc', 'id', 'method', 'params']);
|
|
67
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
68
|
+
// Params / meta key sets (closed nested objects)
|
|
69
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
70
|
+
/**
|
|
71
|
+
* Mirror of: WireRequest.params / WireNotification.params (envelope.ts:71-74, 93-95)
|
|
72
|
+
* Keys: meta, input — additionalProperties: false
|
|
73
|
+
*/
|
|
74
|
+
export const PARAMS_ALLOWED_KEYS = new Set(['meta', 'input']);
|
|
75
|
+
/**
|
|
76
|
+
* Mirror of: CallMeta interface (envelope.ts:43-52)
|
|
77
|
+
* Keys: deadlineUnixMs — additionalProperties: false, v0 single field
|
|
78
|
+
*/
|
|
79
|
+
export const META_ALLOWED_KEYS = new Set(['deadlineUnixMs']);
|
|
80
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
81
|
+
// Per-method CLOSED-row input key sets (additionalProperties: false)
|
|
82
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
83
|
+
/** Mirror of: PingInput (row-shapes.ts:144-147). Keys: {nonce} */
|
|
84
|
+
export const PING_INPUT_KEYS = new Set(['nonce']);
|
|
85
|
+
/** Mirror of: DrainInput (row-shapes.ts:183-193). Keys: {deadlineUnixMs} */
|
|
86
|
+
export const DRAIN_INPUT_KEYS = new Set(['deadlineUnixMs']);
|
|
87
|
+
/** Mirror of: SubscribeInput (row-shapes.ts:27-30). Keys: {handle} */
|
|
88
|
+
export const SUBSCRIBE_INPUT_KEYS = new Set(['handle']);
|
|
89
|
+
/** Mirror of: MessagingAckRequest (row-shapes.ts:76-81). Keys: {subscriptionId, ackToken} */
|
|
90
|
+
export const ACK_INPUT_KEYS = new Set(['subscriptionId', 'ackToken']);
|
|
91
|
+
/** Mirror of: GrantsChangedInput = GrantSnapshot (row-shapes.ts:128, grants.ts). Keys: {grantRevision, effectiveGrants} */
|
|
92
|
+
export const GRANTS_CHANGED_INPUT_KEYS = new Set(['grantRevision', 'effectiveGrants']);
|
|
93
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
94
|
+
// Handshake object key sets (type-only structural contract)
|
|
95
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
96
|
+
/** Mirror of: CandidateHello (handshake.ts:62-71). */
|
|
97
|
+
export const CANDIDATE_HELLO_KEYS = new Set([
|
|
98
|
+
'pluginId',
|
|
99
|
+
'packageDigest',
|
|
100
|
+
'contractVersion',
|
|
101
|
+
'wireVersion',
|
|
102
|
+
]);
|
|
103
|
+
/** Mirror of: SessionBinding (handshake.ts:82-101). */
|
|
104
|
+
export const SESSION_BINDING_KEYS = new Set([
|
|
105
|
+
'pluginId',
|
|
106
|
+
'packageDigest',
|
|
107
|
+
'contractVersion',
|
|
108
|
+
'wireVersion',
|
|
109
|
+
'pluginInstanceId',
|
|
110
|
+
'brokerSessionId',
|
|
111
|
+
'grantRevision',
|
|
112
|
+
'effectiveGrants',
|
|
113
|
+
'bindingNonce',
|
|
114
|
+
]);
|
|
115
|
+
/** Mirror of: BrokerReadyParams (handshake.ts:113-116). */
|
|
116
|
+
export const BROKER_READY_PARAMS_KEYS = new Set(['bindingNonce']);
|
|
117
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
118
|
+
// Per-method CLOSED-row result key sets (additionalProperties: false)
|
|
119
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
120
|
+
/** Mirror of: PingResult (row-shapes.ts:152-158). Keys: {nonce} */
|
|
121
|
+
export const PING_RESULT_KEYS = new Set(['nonce']);
|
|
122
|
+
/** Mirror of: SubscribeResult (row-shapes.ts:35-39). Keys: {subscriptionId} */
|
|
123
|
+
export const SUBSCRIBE_RESULT_KEYS = new Set(['subscriptionId']);
|
|
124
|
+
/**
|
|
125
|
+
* Mirror of: deliver acknowledgement result closed member set.
|
|
126
|
+
* Row 9 (host.messaging.deliver) has a frozen ack result shape
|
|
127
|
+
* {deliveryId: string, length 1..128 code points} — additionalProperties: false.
|
|
128
|
+
*
|
|
129
|
+
* Despite row 9 being RESERVED overall (DeliverResult = never in types),
|
|
130
|
+
* the ack shape is frozen per the #1165 protocol specification. The
|
|
131
|
+
* deliveryId echo is the fundamental delivery acknowledgement mechanism.
|
|
132
|
+
*
|
|
133
|
+
* Maintainer requirement: enforce closed member set + string bounds.
|
|
134
|
+
*/
|
|
135
|
+
export const DELIVER_RESULT_KEYS = new Set(['deliveryId']);
|
|
136
|
+
/** Minimum deliveryId code-point length (frozen row 9 ack shape). */
|
|
137
|
+
export const DELIVER_DELIVERY_ID_MIN_LENGTH = 1;
|
|
138
|
+
/** Maximum deliveryId code-point length (frozen row 9 ack shape). */
|
|
139
|
+
export const DELIVER_DELIVERY_ID_MAX_LENGTH = 128;
|
|
140
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
141
|
+
// Error body key sets (closed per error variant)
|
|
142
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
143
|
+
/**
|
|
144
|
+
* Mirror of: StandardWireError body keys (errors.ts:240-299)
|
|
145
|
+
* Standard errors: {code, message} — no data field.
|
|
146
|
+
*/
|
|
147
|
+
export const ERROR_BODY_STANDARD_KEYS = new Set(['code', 'message']);
|
|
148
|
+
/**
|
|
149
|
+
* Mirror of: ApplicationWireError body keys (errors.ts:182-234)
|
|
150
|
+
* Application errors: {code, message, data} — data required.
|
|
151
|
+
*/
|
|
152
|
+
export const ERROR_BODY_APPLICATION_KEYS = new Set(['code', 'message', 'data']);
|
|
153
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
154
|
+
// Per-arm application error data key sets (additionalProperties: false)
|
|
155
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
156
|
+
/**
|
|
157
|
+
* Mirror of: HandshakeRejectedError.data / DeliveryRejectedError.data /
|
|
158
|
+
* SnapshotUnavailableError.data — all {reason: <enum>}
|
|
159
|
+
*/
|
|
160
|
+
export const REASON_DATA_KEYS = new Set(['reason']);
|
|
161
|
+
/**
|
|
162
|
+
* Mirror of: DomainError.data (errors.ts:205-206)
|
|
163
|
+
* Keys: {code: MessagingErrorCode} — additionalProperties: false
|
|
164
|
+
*/
|
|
165
|
+
export const CODE_DATA_KEYS = new Set(['code']);
|
|
166
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
167
|
+
// NOTE: Constants NOT in this module (derived from contract imports)
|
|
168
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
169
|
+
//
|
|
170
|
+
// The following are built from contract-imported arrays, not mirrors:
|
|
171
|
+
// KNOWN_ERROR_CODES = new Set(ALL_ERROR_CODES) — from contract
|
|
172
|
+
// APPLICATION_CODES = new Set(APPLICATION_ERROR_CODES) — from contract
|
|
173
|
+
// HANDSHAKE_REASONS = new Set(HANDSHAKE_REJECT_REASONS) — from contract
|
|
174
|
+
// DELIVERY_REASONS = new Set(DELIVERY_REJECT_REASONS) — from contract
|
|
175
|
+
// SNAPSHOT_REASONS = new Set(SNAPSHOT_UNAVAILABLE_REASONS) — from contract
|
|
176
|
+
// NULL_ID_ERROR_CODES = new Set([PARSE_ERROR_CODE]) — from contract
|
|
177
|
+
//
|
|
178
|
+
// These stay in wire-dispatch.ts as performance wrappers, not mirrors.
|
|
179
|
+
//# sourceMappingURL=contract-mirror.js.map
|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+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AAE3D,qEAAqE;AACrE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAU,CAAC;AAEzD,qEAAqE;AACrE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAY,CAAC;AAE3D,8EAA8E;AAC9E,iDAAiD;AACjD,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhF,8EAA8E;AAC9E,wEAAwE;AACxE,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEhD,8EAA8E;AAC9E,qEAAqE;AACrE,8EAA8E;AAC9E,EAAE;AACF,sEAAsE;AACtE,yEAAyE;AACzE,0EAA0E;AAC1E,0EAA0E;AAC1E,0EAA0E;AAC1E,8EAA8E;AAC9E,0EAA0E;AAC1E,EAAE;AACF,uEAAuE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Host-bound events.publish helper for declared C-2 signals. */
|
|
2
|
+
import { type EventsPublishInput, type EventsPublishResult, type SignalDeclaration, type SignalSchemaCatalog } from '@clowder-ai/plugin-contract';
|
|
3
|
+
import type { LocalHandshakeState } from './handshake-client.js';
|
|
4
|
+
export type EventsPublishErrorCode = 'SESSION_NOT_ACTIVATED' | 'GRANT_MISSING' | 'SESSION_NOT_LIVE' | 'SIGNAL_UNDECLARED' | 'INVALID_DECLARATIONS' | 'INVALID_INPUT' | 'INVALID_RESULT';
|
|
5
|
+
export declare class EventsPublishError extends Error {
|
|
6
|
+
readonly code: EventsPublishErrorCode;
|
|
7
|
+
constructor(code: EventsPublishErrorCode, message: string);
|
|
8
|
+
}
|
|
9
|
+
export interface EventsPublishHostTransport {
|
|
10
|
+
/**
|
|
11
|
+
* Calls the Host Broker. The SDK deliberately supplies no codec, route,
|
|
12
|
+
* credential, producer identity, or provenance field of its own.
|
|
13
|
+
*/
|
|
14
|
+
call(method: 'events.publish', input: EventsPublishInput): Promise<unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface StdioSessionLiveness {
|
|
17
|
+
readonly kind: 'stdio-session';
|
|
18
|
+
/** Host/runtime-owned connection-or-lease verdict; no plugin clock math. */
|
|
19
|
+
isLive(): boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface EventsPublisherOptions {
|
|
22
|
+
readonly transport: EventsPublishHostTransport;
|
|
23
|
+
/** Contract-validated manifest signals.provides snapshot. */
|
|
24
|
+
readonly declaredSignals: readonly SignalDeclaration[];
|
|
25
|
+
/** Host/package-loader-resolved schemas keyed by the declaration schemaRef. */
|
|
26
|
+
readonly signalSchemas: SignalSchemaCatalog;
|
|
27
|
+
readonly getHandshakeState: () => LocalHandshakeState;
|
|
28
|
+
readonly liveness: StdioSessionLiveness;
|
|
29
|
+
}
|
|
30
|
+
export interface EventsPublisher {
|
|
31
|
+
publish(input: unknown): Promise<EventsPublishResult>;
|
|
32
|
+
}
|
|
33
|
+
export declare function createEventsPublisher(options: EventsPublisherOptions): EventsPublisher;
|
|
34
|
+
//# sourceMappingURL=events-publisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events-publisher.d.ts","source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AAE,sBAAsB,GAAG,eAAe,CA2CtF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Host-bound events.publish helper for declared C-2 signals. */
|
|
2
|
+
import { validateDeclaredEventsPublishInput, validateEventsPublishResult, } from '@clowder-ai/plugin-contract';
|
|
3
|
+
export class EventsPublishError extends Error {
|
|
4
|
+
code;
|
|
5
|
+
constructor(code, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'EventsPublishError';
|
|
8
|
+
this.code = code;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function requireLiveSession(options) {
|
|
12
|
+
const state = options.getHandshakeState();
|
|
13
|
+
if (state.phase !== 'activated') {
|
|
14
|
+
throw new EventsPublishError('SESSION_NOT_ACTIVATED', 'events.publish requires an activated Host-bound session');
|
|
15
|
+
}
|
|
16
|
+
if (!state.binding.effectiveGrants.includes('events.publish')) {
|
|
17
|
+
throw new EventsPublishError('GRANT_MISSING', 'the active Host grant snapshot does not include events.publish');
|
|
18
|
+
}
|
|
19
|
+
let live = false;
|
|
20
|
+
try {
|
|
21
|
+
live = options.liveness.isLive();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
live = false;
|
|
25
|
+
}
|
|
26
|
+
if (!live) {
|
|
27
|
+
throw new EventsPublishError('SESSION_NOT_LIVE', 'the Host-owned stdio session liveness verdict is not live');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function createEventsPublisher(options) {
|
|
31
|
+
return {
|
|
32
|
+
async publish(candidate) {
|
|
33
|
+
requireLiveSession(options);
|
|
34
|
+
const inputValidation = validateDeclaredEventsPublishInput(options.declaredSignals, options.signalSchemas, candidate);
|
|
35
|
+
if (!inputValidation.valid) {
|
|
36
|
+
const keywords = new Set(inputValidation.errors.map(({ keyword }) => keyword));
|
|
37
|
+
const code = keywords.has('declaredSignalType')
|
|
38
|
+
? 'SIGNAL_UNDECLARED'
|
|
39
|
+
: keywords.has('signalDeclaration') ||
|
|
40
|
+
keywords.has('signalSchemaUnresolved') ||
|
|
41
|
+
keywords.has('signalSchemaInvalid')
|
|
42
|
+
? 'INVALID_DECLARATIONS'
|
|
43
|
+
: 'INVALID_INPUT';
|
|
44
|
+
throw new EventsPublishError(code, `events.publish input rejected: ${inputValidation.errors
|
|
45
|
+
.map(({ instancePath, message }) => `${instancePath || '/'} ${message}`)
|
|
46
|
+
.join('; ')}`);
|
|
47
|
+
}
|
|
48
|
+
// Snapshot after validation so caller mutation cannot change the value
|
|
49
|
+
// while the transport is serializing it.
|
|
50
|
+
const input = structuredClone(inputValidation.value);
|
|
51
|
+
const result = await options.transport.call('events.publish', input);
|
|
52
|
+
const resultValidation = validateEventsPublishResult(result);
|
|
53
|
+
if (!resultValidation.valid) {
|
|
54
|
+
throw new EventsPublishError('INVALID_RESULT', `events.publish Host result rejected: ${resultValidation.errors
|
|
55
|
+
.map(({ instancePath, message }) => `${instancePath || '/'} ${message}`)
|
|
56
|
+
.join('; ')}`);
|
|
57
|
+
}
|
|
58
|
+
return structuredClone(resultValidation.value);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=events-publisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events-publisher.js","sourceRoot":"","sources":["../src/events-publisher.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,OAAO,EACL,kCAAkC,EAClC,2BAA2B,GAK5B,MAAM,6BAA6B,CAAC;AAarC,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAyB;IAEtC,YAAY,IAA4B,EAAE,OAAe;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AA8BD,SAAS,kBAAkB,CAAC,OAA+B;IACzD,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE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CAAC,wBAAwB,CAAC;wBACtC,QAAQ,CAAC,GAAG,CAAC,qBAAqB,CAAC;wBACrC,CAAC,CAAC,sBAAsB;wBACxB,CAAC,CAAC,eAAe,CAAC;gBACtB,MAAM,IAAI,kBAAkB,CAC1B,IAAI,EACJ,kCAAkC,eAAe,CAAC,MAAM;qBACrD,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,YAAY,IAAI,GAAG,IAAI,OAAO,EAAE,CAAC;qBACvE,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;YACJ,CAAC;YAED,uEAAuE;YACvE,yCAAyC;YACzC,MAAM,KAAK,GAAG,eAAe,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YACrD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;YACrE,MAAM,gBAAgB,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;YAC7D,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;gBAC5B,MAAM,IAAI,kBAAkB,CAC1B,gBAAgB,EAChB,wCAAwC,gBAAgB,CAAC,MAAM;qBAC5D,GAAG,CAAC,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,GAAG,YAAY,IAAI,GAAG,IAAI,OAAO,EAAE,CAAC;qBACvE,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;YACJ,CAAC;YACD,OAAO,eAAe,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACjD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type BrokerReadyParams, type CandidateHello, type HandshakeRejectReason, type SessionBinding } from '@clowder-ai/plugin-contract';
|
|
2
|
+
export type HandshakePhase = 'candidate' | 'bound' | 'activated' | 'rejected';
|
|
3
|
+
export interface CandidateHandshakeState {
|
|
4
|
+
readonly phase: 'candidate';
|
|
5
|
+
readonly candidate: CandidateHello;
|
|
6
|
+
}
|
|
7
|
+
export interface BoundHandshakeState {
|
|
8
|
+
readonly phase: 'bound';
|
|
9
|
+
readonly candidate: CandidateHello;
|
|
10
|
+
readonly binding: SessionBinding;
|
|
11
|
+
}
|
|
12
|
+
export interface ActivatedHandshakeState {
|
|
13
|
+
readonly phase: 'activated';
|
|
14
|
+
readonly candidate: CandidateHello;
|
|
15
|
+
readonly binding: SessionBinding;
|
|
16
|
+
readonly activation: BrokerReadyParams;
|
|
17
|
+
}
|
|
18
|
+
export interface RejectedHandshakeState {
|
|
19
|
+
readonly phase: 'rejected';
|
|
20
|
+
readonly reason: HandshakeRejectReason;
|
|
21
|
+
}
|
|
22
|
+
export type LocalHandshakeState = CandidateHandshakeState | BoundHandshakeState | ActivatedHandshakeState | RejectedHandshakeState;
|
|
23
|
+
export interface HandshakeValidationLevels {
|
|
24
|
+
/** All H1–H9 fields use the published beta.8 closed grammar. */
|
|
25
|
+
readonly contractFields: 'full';
|
|
26
|
+
}
|
|
27
|
+
export interface CandidateHandshakeIntent {
|
|
28
|
+
readonly kind: 'candidate';
|
|
29
|
+
readonly transport: 'local-only';
|
|
30
|
+
readonly candidate: CandidateHello;
|
|
31
|
+
readonly validation: HandshakeValidationLevels;
|
|
32
|
+
}
|
|
33
|
+
export interface BindingHandshakeIntent {
|
|
34
|
+
readonly kind: 'binding';
|
|
35
|
+
readonly transport: 'local-only';
|
|
36
|
+
readonly binding: SessionBinding;
|
|
37
|
+
readonly validation: HandshakeValidationLevels;
|
|
38
|
+
}
|
|
39
|
+
export interface ActivationHandshakeIntent {
|
|
40
|
+
readonly kind: 'activation';
|
|
41
|
+
readonly transport: 'local-only';
|
|
42
|
+
readonly ready: BrokerReadyParams;
|
|
43
|
+
readonly validation: HandshakeValidationLevels;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Objects in this union are deliberately codec-free. They retain the future
|
|
47
|
+
* HarnessWireShape outbound/inbound orientation without constructing wire
|
|
48
|
+
* frames. The published contract now owns the complete beta.8 grammar.
|
|
49
|
+
*/
|
|
50
|
+
export type LocalHandshakeIntent = CandidateHandshakeIntent | BindingHandshakeIntent | ActivationHandshakeIntent;
|
|
51
|
+
export type LocalHandshakeTransition = {
|
|
52
|
+
readonly accepted: true;
|
|
53
|
+
readonly state: CandidateHandshakeState | BoundHandshakeState | ActivatedHandshakeState;
|
|
54
|
+
readonly intent: LocalHandshakeIntent;
|
|
55
|
+
} | {
|
|
56
|
+
readonly accepted: false;
|
|
57
|
+
readonly reason: HandshakeRejectReason;
|
|
58
|
+
readonly state: RejectedHandshakeState;
|
|
59
|
+
};
|
|
60
|
+
/** Starts a local-only handshake by validating the candidate claims. */
|
|
61
|
+
export declare function beginLocalHandshake(candidate: unknown): LocalHandshakeTransition;
|
|
62
|
+
/** Accepts a Host-provided binding only from the local candidate state. */
|
|
63
|
+
export declare function acceptSessionBinding(state: LocalHandshakeState, binding: unknown): LocalHandshakeTransition;
|
|
64
|
+
/** Creates the local activation intent after the binding nonce oracle passes. */
|
|
65
|
+
export declare function prepareActivation(state: LocalHandshakeState, ready: unknown): LocalHandshakeTransition;
|
|
66
|
+
//# sourceMappingURL=handshake-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake-client.d.ts","sourceRoot":"","sources":["../src/handshake-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AAErC,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,CAAC;AAE9E,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;CACpC;AAED,MAAM,WAA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IAClC,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;CAChD;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAC5B,wBAAwB,GACxB,sBAAsB,GACtB,yBAAyB,CAAC;AAE9B,MAAM,MAAM,wBAAwB,GAChC;IACE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,uBAAuB,GAAG,mBAAmB,GAAG,uBAAuB,CAAC;IACxF,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;CACvC,GACD;IACE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;CACxC,CAAC;AAsEN,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,OAAO,GAAG,wBAAwB,CAgBhF;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,mBAAmB,EAC1B,OAAO,EAAE,OAAO,GACf,wBAAwB,CAuB1B;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,OAAO,GACb,wBAAwB,CAqB1B"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { HANDSHAKE_REJECT_REASONS, validateBrokerReadyParams, validateCandidateHello, validateSessionBinding, } from '@clowder-ai/plugin-contract';
|
|
2
|
+
const HANDSHAKE_REASON_SET = new Set(HANDSHAKE_REJECT_REASONS);
|
|
3
|
+
const CLOSED_CONTRACT = {
|
|
4
|
+
contractFields: 'full',
|
|
5
|
+
};
|
|
6
|
+
function reject(reason) {
|
|
7
|
+
if (!HANDSHAKE_REASON_SET.has(reason)) {
|
|
8
|
+
throw new RangeError(`unknown handshake rejection reason: ${reason}`);
|
|
9
|
+
}
|
|
10
|
+
return { accepted: false, reason, state: { phase: 'rejected', reason } };
|
|
11
|
+
}
|
|
12
|
+
function snapshotCandidate(candidate) {
|
|
13
|
+
return {
|
|
14
|
+
pluginId: candidate.pluginId,
|
|
15
|
+
packageDigest: candidate.packageDigest,
|
|
16
|
+
contractVersion: candidate.contractVersion,
|
|
17
|
+
wireVersion: candidate.wireVersion,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function snapshotBinding(binding) {
|
|
21
|
+
return {
|
|
22
|
+
pluginId: binding.pluginId,
|
|
23
|
+
packageDigest: binding.packageDigest,
|
|
24
|
+
contractVersion: binding.contractVersion,
|
|
25
|
+
wireVersion: binding.wireVersion,
|
|
26
|
+
pluginInstanceId: binding.pluginInstanceId,
|
|
27
|
+
brokerSessionId: binding.brokerSessionId,
|
|
28
|
+
grantRevision: binding.grantRevision,
|
|
29
|
+
effectiveGrants: [...binding.effectiveGrants],
|
|
30
|
+
bindingNonce: binding.bindingNonce,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function snapshotReady(ready) {
|
|
34
|
+
return { bindingNonce: ready.bindingNonce };
|
|
35
|
+
}
|
|
36
|
+
function isCandidateHello(value) {
|
|
37
|
+
return validateCandidateHello(value);
|
|
38
|
+
}
|
|
39
|
+
function validateBinding(candidate, value) {
|
|
40
|
+
if (!validateSessionBinding(value)) {
|
|
41
|
+
return { valid: false, reason: 'AUTHORITY_VIOLATION' };
|
|
42
|
+
}
|
|
43
|
+
if (value.pluginId !== candidate.pluginId || value.packageDigest !== candidate.packageDigest) {
|
|
44
|
+
return { valid: false, reason: 'PACKAGE_MISMATCH' };
|
|
45
|
+
}
|
|
46
|
+
if (value.contractVersion !== candidate.contractVersion) {
|
|
47
|
+
return { valid: false, reason: 'CONTRACT_INCOMPATIBLE' };
|
|
48
|
+
}
|
|
49
|
+
if (value.wireVersion !== candidate.wireVersion) {
|
|
50
|
+
return { valid: false, reason: 'WIRE_INCOMPATIBLE' };
|
|
51
|
+
}
|
|
52
|
+
return { valid: true, binding: snapshotBinding(value) };
|
|
53
|
+
}
|
|
54
|
+
function validateReady(value, binding) {
|
|
55
|
+
return (validateBrokerReadyParams(value) &&
|
|
56
|
+
value.bindingNonce === binding.bindingNonce);
|
|
57
|
+
}
|
|
58
|
+
/** Starts a local-only handshake by validating the candidate claims. */
|
|
59
|
+
export function beginLocalHandshake(candidate) {
|
|
60
|
+
if (!isCandidateHello(candidate)) {
|
|
61
|
+
return reject('MALFORMED_HELLO');
|
|
62
|
+
}
|
|
63
|
+
const candidateSnapshot = snapshotCandidate(candidate);
|
|
64
|
+
const state = { phase: 'candidate', candidate: candidateSnapshot };
|
|
65
|
+
return {
|
|
66
|
+
accepted: true,
|
|
67
|
+
state,
|
|
68
|
+
intent: {
|
|
69
|
+
kind: 'candidate',
|
|
70
|
+
transport: 'local-only',
|
|
71
|
+
candidate: candidateSnapshot,
|
|
72
|
+
validation: CLOSED_CONTRACT,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Accepts a Host-provided binding only from the local candidate state. */
|
|
77
|
+
export function acceptSessionBinding(state, binding) {
|
|
78
|
+
if (state.phase !== 'candidate') {
|
|
79
|
+
return reject('BINDING_REPLAY');
|
|
80
|
+
}
|
|
81
|
+
const result = validateBinding(state.candidate, binding);
|
|
82
|
+
if (!result.valid) {
|
|
83
|
+
return reject(result.reason);
|
|
84
|
+
}
|
|
85
|
+
const next = {
|
|
86
|
+
phase: 'bound',
|
|
87
|
+
candidate: state.candidate,
|
|
88
|
+
binding: result.binding,
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
accepted: true,
|
|
92
|
+
state: next,
|
|
93
|
+
intent: {
|
|
94
|
+
kind: 'binding',
|
|
95
|
+
transport: 'local-only',
|
|
96
|
+
binding: result.binding,
|
|
97
|
+
validation: CLOSED_CONTRACT,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** Creates the local activation intent after the binding nonce oracle passes. */
|
|
102
|
+
export function prepareActivation(state, ready) {
|
|
103
|
+
if (state.phase !== 'bound' || !validateReady(ready, state.binding)) {
|
|
104
|
+
return reject('BINDING_REPLAY');
|
|
105
|
+
}
|
|
106
|
+
const readySnapshot = snapshotReady(ready);
|
|
107
|
+
const next = {
|
|
108
|
+
phase: 'activated',
|
|
109
|
+
candidate: state.candidate,
|
|
110
|
+
binding: state.binding,
|
|
111
|
+
activation: readySnapshot,
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
accepted: true,
|
|
115
|
+
state: next,
|
|
116
|
+
intent: {
|
|
117
|
+
kind: 'activation',
|
|
118
|
+
transport: 'local-only',
|
|
119
|
+
ready: readySnapshot,
|
|
120
|
+
validation: CLOSED_CONTRACT,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=handshake-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake-client.js","sourceRoot":"","sources":["../src/handshake-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,GAKvB,MAAM,6BAA6B,CAAC;AAiFrC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAS,wBAAwB,CAAC,CAAC;AACvE,MAAM,eAAe,GAA8B;IACjD,cAAc,EAAE,MAAM;CACvB,CAAC;AAEF,SAAS,MAAM,CAAC,MAA6B;IAC3C,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,UAAU,CAAC,uCAAuC,MAAM,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;AAC3E,CAAC;AAED,SAAS,iBAAiB,CAAC,SAAyB;IAClD,OAAO;QACL,QAAQ,EAAE,SAAS,CAAC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
4
|
+
* This package exposes:
|
|
5
|
+
* 1. Schema-neutral NDJSON transport (stdio-runtime, S0/#12)
|
|
6
|
+
* 2. Wire dispatch classifier (wire-dispatch, S1)
|
|
7
|
+
*
|
|
8
|
+
* The beta.8 handshake rows and beta.9 events.publish row are executable;
|
|
9
|
+
* remaining production RPC methods stay reserved. The dispatch
|
|
10
|
+
* classifier gates all methods: CLOSED rows validate input shapes, RESERVED
|
|
11
|
+
* rows fail-closed with T-G (input type is `never` in v0 — no legal params
|
|
12
|
+
* exist).
|
|
13
|
+
*/
|
|
14
|
+
export { NdjsonFrameError, StdioRuntimeFatalError, createStdioChannel, startStdioRuntime, type StdioChannel, type StdioChannelOptions, type JsonObject, type StdioFrame, type StdioFrameErrorCode, type StdioFrameHandler, type StdioRuntimeFatalReason, type StdioRuntimeFatalErrorOptions, type StdioRuntimeOptions, } from './stdio-runtime.js';
|
|
15
|
+
export { loadStandaloneManifest, ManifestStartupError, startStandaloneHost, type StandaloneHost, type StandaloneHostOptions, } from './standalone-host.js';
|
|
16
|
+
export { acceptSessionBinding, beginLocalHandshake, prepareActivation, type ActivatedHandshakeState, type ActivationHandshakeIntent, type BindingHandshakeIntent, type BoundHandshakeState, type CandidateHandshakeIntent, type CandidateHandshakeState, type HandshakePhase, type HandshakeValidationLevels, type LocalHandshakeIntent, type LocalHandshakeState, type LocalHandshakeTransition, type RejectedHandshakeState, } from './handshake-client.js';
|
|
17
|
+
export { classifyFrame, type DispatchResult, type InFlightEntry, type RequestSnapshot, } from './wire-dispatch.js';
|
|
18
|
+
export { EventsPublishError, createEventsPublisher, type EventsPublishErrorCode, type EventsPublishHostTransport, type StdioSessionLiveness, type EventsPublisherOptions, type EventsPublisher, } from './events-publisher.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|