@holokai/neuron-sdk 0.2.0 → 0.4.0
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/README.md +63 -3
- package/dist/auth.d.mts +187 -0
- package/dist/auth.d.ts +187 -0
- package/dist/auth.js +354 -0
- package/dist/auth.js.map +1 -0
- package/dist/auth.mjs +343 -0
- package/dist/auth.mjs.map +1 -0
- package/dist/cli.js +436 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.mts +21 -8
- package/dist/index.d.ts +21 -8
- package/dist/index.js +100 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -29
- package/dist/index.mjs.map +1 -1
- package/dist/ipc.d.mts +1 -1
- package/dist/ipc.d.ts +1 -1
- package/dist/{transport-QqkooS7K.d.mts → transport-Cs5tY2IO.d.mts} +91 -2
- package/dist/{transport-QqkooS7K.d.ts → transport-Cs5tY2IO.d.ts} +91 -2
- package/package.json +12 -3
|
@@ -13,6 +13,27 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
13
13
|
onBehalfOf: string;
|
|
14
14
|
}>]>;
|
|
15
15
|
concurrency: z.ZodNumber;
|
|
16
|
+
/**
|
|
17
|
+
* Plain-language contract advertisement (HOL-2926). All three fields
|
|
18
|
+
* are optional and additive: older neurons keep sending
|
|
19
|
+
* `{ type, scope, concurrency }` and the gateway accepts both shapes.
|
|
20
|
+
* When present they flow (fire-and-forget) to Moku's
|
|
21
|
+
* `capability_catalog` so registry-sourced capabilities render with a
|
|
22
|
+
* real contract in the supervisor catalog instead of type-only stubs.
|
|
23
|
+
*
|
|
24
|
+
* Omit rather than null — the fields are `.optional()`, not
|
|
25
|
+
* `.nullable()`, and a `null` description fails validation.
|
|
26
|
+
*/
|
|
27
|
+
description: z.ZodOptional<z.ZodString>;
|
|
28
|
+
/**
|
|
29
|
+
* JSON Schema for the capability's input payload — opaque on the wire,
|
|
30
|
+
* but `null` is rejected: the reconcile push to Moku is last-writer-wins
|
|
31
|
+
* per present key, so a null here could wipe a stored schema.
|
|
32
|
+
* (`description` already rejects null via `z.string()`.)
|
|
33
|
+
*/
|
|
34
|
+
inputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
35
|
+
/** JSON Schema for the capability's output payload — same rules as inputSchema. */
|
|
36
|
+
outputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
16
37
|
/**
|
|
17
38
|
* Per-capability lease TTL override in milliseconds (HOL-356).
|
|
18
39
|
* The gateway uses this when minting a lease's `expiresAt`; absent
|
|
@@ -33,6 +54,9 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
33
54
|
onBehalfOf: string;
|
|
34
55
|
};
|
|
35
56
|
concurrency: number;
|
|
57
|
+
description?: string | undefined;
|
|
58
|
+
inputSchema?: unknown;
|
|
59
|
+
outputSchema?: unknown;
|
|
36
60
|
leaseTtlMs?: number | undefined;
|
|
37
61
|
}, {
|
|
38
62
|
type: string;
|
|
@@ -40,6 +64,9 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
40
64
|
onBehalfOf: string;
|
|
41
65
|
};
|
|
42
66
|
concurrency: number;
|
|
67
|
+
description?: string | undefined;
|
|
68
|
+
inputSchema?: unknown;
|
|
69
|
+
outputSchema?: unknown;
|
|
43
70
|
leaseTtlMs?: number | undefined;
|
|
44
71
|
}>;
|
|
45
72
|
type Capability = z.infer<typeof CapabilitySchema>;
|
|
@@ -145,6 +172,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
145
172
|
onBehalfOf: string;
|
|
146
173
|
}>]>;
|
|
147
174
|
concurrency: z.ZodNumber;
|
|
175
|
+
description: z.ZodOptional<z.ZodString>;
|
|
176
|
+
inputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
177
|
+
outputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
148
178
|
leaseTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
149
179
|
}, "strict", z.ZodTypeAny, {
|
|
150
180
|
type: string;
|
|
@@ -152,6 +182,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
152
182
|
onBehalfOf: string;
|
|
153
183
|
};
|
|
154
184
|
concurrency: number;
|
|
185
|
+
description?: string | undefined;
|
|
186
|
+
inputSchema?: unknown;
|
|
187
|
+
outputSchema?: unknown;
|
|
155
188
|
leaseTtlMs?: number | undefined;
|
|
156
189
|
}, {
|
|
157
190
|
type: string;
|
|
@@ -159,6 +192,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
159
192
|
onBehalfOf: string;
|
|
160
193
|
};
|
|
161
194
|
concurrency: number;
|
|
195
|
+
description?: string | undefined;
|
|
196
|
+
inputSchema?: unknown;
|
|
197
|
+
outputSchema?: unknown;
|
|
162
198
|
leaseTtlMs?: number | undefined;
|
|
163
199
|
}>, "many">, {
|
|
164
200
|
type: string;
|
|
@@ -166,6 +202,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
166
202
|
onBehalfOf: string;
|
|
167
203
|
};
|
|
168
204
|
concurrency: number;
|
|
205
|
+
description?: string | undefined;
|
|
206
|
+
inputSchema?: unknown;
|
|
207
|
+
outputSchema?: unknown;
|
|
169
208
|
leaseTtlMs?: number | undefined;
|
|
170
209
|
}[], {
|
|
171
210
|
type: string;
|
|
@@ -173,6 +212,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
173
212
|
onBehalfOf: string;
|
|
174
213
|
};
|
|
175
214
|
concurrency: number;
|
|
215
|
+
description?: string | undefined;
|
|
216
|
+
inputSchema?: unknown;
|
|
217
|
+
outputSchema?: unknown;
|
|
176
218
|
leaseTtlMs?: number | undefined;
|
|
177
219
|
}[]>;
|
|
178
220
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -185,6 +227,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
185
227
|
onBehalfOf: string;
|
|
186
228
|
};
|
|
187
229
|
concurrency: number;
|
|
230
|
+
description?: string | undefined;
|
|
231
|
+
inputSchema?: unknown;
|
|
232
|
+
outputSchema?: unknown;
|
|
188
233
|
leaseTtlMs?: number | undefined;
|
|
189
234
|
}[];
|
|
190
235
|
}, {
|
|
@@ -197,6 +242,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
197
242
|
onBehalfOf: string;
|
|
198
243
|
};
|
|
199
244
|
concurrency: number;
|
|
245
|
+
description?: string | undefined;
|
|
246
|
+
inputSchema?: unknown;
|
|
247
|
+
outputSchema?: unknown;
|
|
200
248
|
leaseTtlMs?: number | undefined;
|
|
201
249
|
}[];
|
|
202
250
|
}>;
|
|
@@ -214,6 +262,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
214
262
|
onBehalfOf: string;
|
|
215
263
|
}>]>;
|
|
216
264
|
concurrency: z.ZodNumber;
|
|
265
|
+
description: z.ZodOptional<z.ZodString>;
|
|
266
|
+
inputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
267
|
+
outputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
217
268
|
leaseTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
218
269
|
}, "strict", z.ZodTypeAny, {
|
|
219
270
|
type: string;
|
|
@@ -221,6 +272,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
221
272
|
onBehalfOf: string;
|
|
222
273
|
};
|
|
223
274
|
concurrency: number;
|
|
275
|
+
description?: string | undefined;
|
|
276
|
+
inputSchema?: unknown;
|
|
277
|
+
outputSchema?: unknown;
|
|
224
278
|
leaseTtlMs?: number | undefined;
|
|
225
279
|
}, {
|
|
226
280
|
type: string;
|
|
@@ -228,6 +282,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
228
282
|
onBehalfOf: string;
|
|
229
283
|
};
|
|
230
284
|
concurrency: number;
|
|
285
|
+
description?: string | undefined;
|
|
286
|
+
inputSchema?: unknown;
|
|
287
|
+
outputSchema?: unknown;
|
|
231
288
|
leaseTtlMs?: number | undefined;
|
|
232
289
|
}>;
|
|
233
290
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -238,6 +295,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
238
295
|
onBehalfOf: string;
|
|
239
296
|
};
|
|
240
297
|
concurrency: number;
|
|
298
|
+
description?: string | undefined;
|
|
299
|
+
inputSchema?: unknown;
|
|
300
|
+
outputSchema?: unknown;
|
|
241
301
|
leaseTtlMs?: number | undefined;
|
|
242
302
|
};
|
|
243
303
|
neuronId: string;
|
|
@@ -249,6 +309,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
249
309
|
onBehalfOf: string;
|
|
250
310
|
};
|
|
251
311
|
concurrency: number;
|
|
312
|
+
description?: string | undefined;
|
|
313
|
+
inputSchema?: unknown;
|
|
314
|
+
outputSchema?: unknown;
|
|
252
315
|
leaseTtlMs?: number | undefined;
|
|
253
316
|
};
|
|
254
317
|
neuronId: string;
|
|
@@ -384,6 +447,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
384
447
|
onBehalfOf: string;
|
|
385
448
|
}>]>;
|
|
386
449
|
concurrency: z.ZodNumber;
|
|
450
|
+
description: z.ZodOptional<z.ZodString>;
|
|
451
|
+
inputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
452
|
+
outputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
387
453
|
leaseTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
388
454
|
}, "strict", z.ZodTypeAny, {
|
|
389
455
|
type: string;
|
|
@@ -391,6 +457,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
391
457
|
onBehalfOf: string;
|
|
392
458
|
};
|
|
393
459
|
concurrency: number;
|
|
460
|
+
description?: string | undefined;
|
|
461
|
+
inputSchema?: unknown;
|
|
462
|
+
outputSchema?: unknown;
|
|
394
463
|
leaseTtlMs?: number | undefined;
|
|
395
464
|
}, {
|
|
396
465
|
type: string;
|
|
@@ -398,6 +467,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
398
467
|
onBehalfOf: string;
|
|
399
468
|
};
|
|
400
469
|
concurrency: number;
|
|
470
|
+
description?: string | undefined;
|
|
471
|
+
inputSchema?: unknown;
|
|
472
|
+
outputSchema?: unknown;
|
|
401
473
|
leaseTtlMs?: number | undefined;
|
|
402
474
|
}>, "many">;
|
|
403
475
|
acceptedAt: z.ZodString;
|
|
@@ -409,6 +481,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
409
481
|
onBehalfOf: string;
|
|
410
482
|
};
|
|
411
483
|
concurrency: number;
|
|
484
|
+
description?: string | undefined;
|
|
485
|
+
inputSchema?: unknown;
|
|
486
|
+
outputSchema?: unknown;
|
|
412
487
|
leaseTtlMs?: number | undefined;
|
|
413
488
|
}[];
|
|
414
489
|
sessionId: string;
|
|
@@ -421,6 +496,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
421
496
|
onBehalfOf: string;
|
|
422
497
|
};
|
|
423
498
|
concurrency: number;
|
|
499
|
+
description?: string | undefined;
|
|
500
|
+
inputSchema?: unknown;
|
|
501
|
+
outputSchema?: unknown;
|
|
424
502
|
leaseTtlMs?: number | undefined;
|
|
425
503
|
}[];
|
|
426
504
|
sessionId: string;
|
|
@@ -637,11 +715,16 @@ interface HandlerContext {
|
|
|
637
715
|
interface CapabilityRegistration extends Capability {
|
|
638
716
|
/** JSON Schema validated against the lease input before invoking the
|
|
639
717
|
* handler. Mismatch produces a `schema-mismatch` nack and the handler
|
|
640
|
-
* is never called.
|
|
718
|
+
* is never called. This is the authority for inbound validation — the
|
|
719
|
+
* `inputSchema` on the lease frame is ignored (HOL-2913). Omit it and
|
|
720
|
+
* input is not validated client-side at all. Also advertised on the
|
|
721
|
+
* register frame (HOL-2926) so the capability catalog knows the
|
|
722
|
+
* contract. */
|
|
641
723
|
inputSchema?: JsonSchema;
|
|
642
724
|
/** JSON Schema validated against the handler's return value. Mismatch
|
|
643
725
|
* produces a `schema-mismatch` nack and the gateway publishes a failed
|
|
644
|
-
* TaskResult.
|
|
726
|
+
* TaskResult. Same authority as `inputSchema`; note the gateway also
|
|
727
|
+
* validates ack output against its own schema regardless. */
|
|
645
728
|
outputSchema?: JsonSchema;
|
|
646
729
|
}
|
|
647
730
|
/**
|
|
@@ -653,6 +736,12 @@ interface CapabilityRegistration extends Capability {
|
|
|
653
736
|
interface CapabilityHandleOptions {
|
|
654
737
|
scope?: Capability['scope'];
|
|
655
738
|
concurrency?: number;
|
|
739
|
+
/**
|
|
740
|
+
* Overrides the def's `description` in the advertised contract
|
|
741
|
+
* (HOL-2926) — e.g. a deployment-specific wording. Rarely needed; the
|
|
742
|
+
* def's description is used when absent.
|
|
743
|
+
*/
|
|
744
|
+
description?: string;
|
|
656
745
|
/**
|
|
657
746
|
* Per-capability lease TTL override (HOL-356). Wins over the same
|
|
658
747
|
* field on the def. See `CapabilityDefInit.leaseTtlMs` for shape;
|
|
@@ -13,6 +13,27 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
13
13
|
onBehalfOf: string;
|
|
14
14
|
}>]>;
|
|
15
15
|
concurrency: z.ZodNumber;
|
|
16
|
+
/**
|
|
17
|
+
* Plain-language contract advertisement (HOL-2926). All three fields
|
|
18
|
+
* are optional and additive: older neurons keep sending
|
|
19
|
+
* `{ type, scope, concurrency }` and the gateway accepts both shapes.
|
|
20
|
+
* When present they flow (fire-and-forget) to Moku's
|
|
21
|
+
* `capability_catalog` so registry-sourced capabilities render with a
|
|
22
|
+
* real contract in the supervisor catalog instead of type-only stubs.
|
|
23
|
+
*
|
|
24
|
+
* Omit rather than null — the fields are `.optional()`, not
|
|
25
|
+
* `.nullable()`, and a `null` description fails validation.
|
|
26
|
+
*/
|
|
27
|
+
description: z.ZodOptional<z.ZodString>;
|
|
28
|
+
/**
|
|
29
|
+
* JSON Schema for the capability's input payload — opaque on the wire,
|
|
30
|
+
* but `null` is rejected: the reconcile push to Moku is last-writer-wins
|
|
31
|
+
* per present key, so a null here could wipe a stored schema.
|
|
32
|
+
* (`description` already rejects null via `z.string()`.)
|
|
33
|
+
*/
|
|
34
|
+
inputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
35
|
+
/** JSON Schema for the capability's output payload — same rules as inputSchema. */
|
|
36
|
+
outputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
16
37
|
/**
|
|
17
38
|
* Per-capability lease TTL override in milliseconds (HOL-356).
|
|
18
39
|
* The gateway uses this when minting a lease's `expiresAt`; absent
|
|
@@ -33,6 +54,9 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
33
54
|
onBehalfOf: string;
|
|
34
55
|
};
|
|
35
56
|
concurrency: number;
|
|
57
|
+
description?: string | undefined;
|
|
58
|
+
inputSchema?: unknown;
|
|
59
|
+
outputSchema?: unknown;
|
|
36
60
|
leaseTtlMs?: number | undefined;
|
|
37
61
|
}, {
|
|
38
62
|
type: string;
|
|
@@ -40,6 +64,9 @@ declare const CapabilitySchema: z.ZodObject<{
|
|
|
40
64
|
onBehalfOf: string;
|
|
41
65
|
};
|
|
42
66
|
concurrency: number;
|
|
67
|
+
description?: string | undefined;
|
|
68
|
+
inputSchema?: unknown;
|
|
69
|
+
outputSchema?: unknown;
|
|
43
70
|
leaseTtlMs?: number | undefined;
|
|
44
71
|
}>;
|
|
45
72
|
type Capability = z.infer<typeof CapabilitySchema>;
|
|
@@ -145,6 +172,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
145
172
|
onBehalfOf: string;
|
|
146
173
|
}>]>;
|
|
147
174
|
concurrency: z.ZodNumber;
|
|
175
|
+
description: z.ZodOptional<z.ZodString>;
|
|
176
|
+
inputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
177
|
+
outputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
148
178
|
leaseTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
149
179
|
}, "strict", z.ZodTypeAny, {
|
|
150
180
|
type: string;
|
|
@@ -152,6 +182,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
152
182
|
onBehalfOf: string;
|
|
153
183
|
};
|
|
154
184
|
concurrency: number;
|
|
185
|
+
description?: string | undefined;
|
|
186
|
+
inputSchema?: unknown;
|
|
187
|
+
outputSchema?: unknown;
|
|
155
188
|
leaseTtlMs?: number | undefined;
|
|
156
189
|
}, {
|
|
157
190
|
type: string;
|
|
@@ -159,6 +192,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
159
192
|
onBehalfOf: string;
|
|
160
193
|
};
|
|
161
194
|
concurrency: number;
|
|
195
|
+
description?: string | undefined;
|
|
196
|
+
inputSchema?: unknown;
|
|
197
|
+
outputSchema?: unknown;
|
|
162
198
|
leaseTtlMs?: number | undefined;
|
|
163
199
|
}>, "many">, {
|
|
164
200
|
type: string;
|
|
@@ -166,6 +202,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
166
202
|
onBehalfOf: string;
|
|
167
203
|
};
|
|
168
204
|
concurrency: number;
|
|
205
|
+
description?: string | undefined;
|
|
206
|
+
inputSchema?: unknown;
|
|
207
|
+
outputSchema?: unknown;
|
|
169
208
|
leaseTtlMs?: number | undefined;
|
|
170
209
|
}[], {
|
|
171
210
|
type: string;
|
|
@@ -173,6 +212,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
173
212
|
onBehalfOf: string;
|
|
174
213
|
};
|
|
175
214
|
concurrency: number;
|
|
215
|
+
description?: string | undefined;
|
|
216
|
+
inputSchema?: unknown;
|
|
217
|
+
outputSchema?: unknown;
|
|
176
218
|
leaseTtlMs?: number | undefined;
|
|
177
219
|
}[]>;
|
|
178
220
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -185,6 +227,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
185
227
|
onBehalfOf: string;
|
|
186
228
|
};
|
|
187
229
|
concurrency: number;
|
|
230
|
+
description?: string | undefined;
|
|
231
|
+
inputSchema?: unknown;
|
|
232
|
+
outputSchema?: unknown;
|
|
188
233
|
leaseTtlMs?: number | undefined;
|
|
189
234
|
}[];
|
|
190
235
|
}, {
|
|
@@ -197,6 +242,9 @@ declare const RegisterFrameSchema: z.ZodObject<{
|
|
|
197
242
|
onBehalfOf: string;
|
|
198
243
|
};
|
|
199
244
|
concurrency: number;
|
|
245
|
+
description?: string | undefined;
|
|
246
|
+
inputSchema?: unknown;
|
|
247
|
+
outputSchema?: unknown;
|
|
200
248
|
leaseTtlMs?: number | undefined;
|
|
201
249
|
}[];
|
|
202
250
|
}>;
|
|
@@ -214,6 +262,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
214
262
|
onBehalfOf: string;
|
|
215
263
|
}>]>;
|
|
216
264
|
concurrency: z.ZodNumber;
|
|
265
|
+
description: z.ZodOptional<z.ZodString>;
|
|
266
|
+
inputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
267
|
+
outputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
217
268
|
leaseTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
218
269
|
}, "strict", z.ZodTypeAny, {
|
|
219
270
|
type: string;
|
|
@@ -221,6 +272,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
221
272
|
onBehalfOf: string;
|
|
222
273
|
};
|
|
223
274
|
concurrency: number;
|
|
275
|
+
description?: string | undefined;
|
|
276
|
+
inputSchema?: unknown;
|
|
277
|
+
outputSchema?: unknown;
|
|
224
278
|
leaseTtlMs?: number | undefined;
|
|
225
279
|
}, {
|
|
226
280
|
type: string;
|
|
@@ -228,6 +282,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
228
282
|
onBehalfOf: string;
|
|
229
283
|
};
|
|
230
284
|
concurrency: number;
|
|
285
|
+
description?: string | undefined;
|
|
286
|
+
inputSchema?: unknown;
|
|
287
|
+
outputSchema?: unknown;
|
|
231
288
|
leaseTtlMs?: number | undefined;
|
|
232
289
|
}>;
|
|
233
290
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -238,6 +295,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
238
295
|
onBehalfOf: string;
|
|
239
296
|
};
|
|
240
297
|
concurrency: number;
|
|
298
|
+
description?: string | undefined;
|
|
299
|
+
inputSchema?: unknown;
|
|
300
|
+
outputSchema?: unknown;
|
|
241
301
|
leaseTtlMs?: number | undefined;
|
|
242
302
|
};
|
|
243
303
|
neuronId: string;
|
|
@@ -249,6 +309,9 @@ declare const UpdateCapabilityFrameSchema: z.ZodObject<{
|
|
|
249
309
|
onBehalfOf: string;
|
|
250
310
|
};
|
|
251
311
|
concurrency: number;
|
|
312
|
+
description?: string | undefined;
|
|
313
|
+
inputSchema?: unknown;
|
|
314
|
+
outputSchema?: unknown;
|
|
252
315
|
leaseTtlMs?: number | undefined;
|
|
253
316
|
};
|
|
254
317
|
neuronId: string;
|
|
@@ -384,6 +447,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
384
447
|
onBehalfOf: string;
|
|
385
448
|
}>]>;
|
|
386
449
|
concurrency: z.ZodNumber;
|
|
450
|
+
description: z.ZodOptional<z.ZodString>;
|
|
451
|
+
inputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
452
|
+
outputSchema: z.ZodOptional<z.ZodEffects<z.ZodUnknown, unknown, unknown>>;
|
|
387
453
|
leaseTtlMs: z.ZodOptional<z.ZodNumber>;
|
|
388
454
|
}, "strict", z.ZodTypeAny, {
|
|
389
455
|
type: string;
|
|
@@ -391,6 +457,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
391
457
|
onBehalfOf: string;
|
|
392
458
|
};
|
|
393
459
|
concurrency: number;
|
|
460
|
+
description?: string | undefined;
|
|
461
|
+
inputSchema?: unknown;
|
|
462
|
+
outputSchema?: unknown;
|
|
394
463
|
leaseTtlMs?: number | undefined;
|
|
395
464
|
}, {
|
|
396
465
|
type: string;
|
|
@@ -398,6 +467,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
398
467
|
onBehalfOf: string;
|
|
399
468
|
};
|
|
400
469
|
concurrency: number;
|
|
470
|
+
description?: string | undefined;
|
|
471
|
+
inputSchema?: unknown;
|
|
472
|
+
outputSchema?: unknown;
|
|
401
473
|
leaseTtlMs?: number | undefined;
|
|
402
474
|
}>, "many">;
|
|
403
475
|
acceptedAt: z.ZodString;
|
|
@@ -409,6 +481,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
409
481
|
onBehalfOf: string;
|
|
410
482
|
};
|
|
411
483
|
concurrency: number;
|
|
484
|
+
description?: string | undefined;
|
|
485
|
+
inputSchema?: unknown;
|
|
486
|
+
outputSchema?: unknown;
|
|
412
487
|
leaseTtlMs?: number | undefined;
|
|
413
488
|
}[];
|
|
414
489
|
sessionId: string;
|
|
@@ -421,6 +496,9 @@ declare const ServerToNeuronFrameSchema: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
421
496
|
onBehalfOf: string;
|
|
422
497
|
};
|
|
423
498
|
concurrency: number;
|
|
499
|
+
description?: string | undefined;
|
|
500
|
+
inputSchema?: unknown;
|
|
501
|
+
outputSchema?: unknown;
|
|
424
502
|
leaseTtlMs?: number | undefined;
|
|
425
503
|
}[];
|
|
426
504
|
sessionId: string;
|
|
@@ -637,11 +715,16 @@ interface HandlerContext {
|
|
|
637
715
|
interface CapabilityRegistration extends Capability {
|
|
638
716
|
/** JSON Schema validated against the lease input before invoking the
|
|
639
717
|
* handler. Mismatch produces a `schema-mismatch` nack and the handler
|
|
640
|
-
* is never called.
|
|
718
|
+
* is never called. This is the authority for inbound validation — the
|
|
719
|
+
* `inputSchema` on the lease frame is ignored (HOL-2913). Omit it and
|
|
720
|
+
* input is not validated client-side at all. Also advertised on the
|
|
721
|
+
* register frame (HOL-2926) so the capability catalog knows the
|
|
722
|
+
* contract. */
|
|
641
723
|
inputSchema?: JsonSchema;
|
|
642
724
|
/** JSON Schema validated against the handler's return value. Mismatch
|
|
643
725
|
* produces a `schema-mismatch` nack and the gateway publishes a failed
|
|
644
|
-
* TaskResult.
|
|
726
|
+
* TaskResult. Same authority as `inputSchema`; note the gateway also
|
|
727
|
+
* validates ack output against its own schema regardless. */
|
|
645
728
|
outputSchema?: JsonSchema;
|
|
646
729
|
}
|
|
647
730
|
/**
|
|
@@ -653,6 +736,12 @@ interface CapabilityRegistration extends Capability {
|
|
|
653
736
|
interface CapabilityHandleOptions {
|
|
654
737
|
scope?: Capability['scope'];
|
|
655
738
|
concurrency?: number;
|
|
739
|
+
/**
|
|
740
|
+
* Overrides the def's `description` in the advertised contract
|
|
741
|
+
* (HOL-2926) — e.g. a deployment-specific wording. Rarely needed; the
|
|
742
|
+
* def's description is used when absent.
|
|
743
|
+
*/
|
|
744
|
+
description?: string;
|
|
656
745
|
/**
|
|
657
746
|
* Per-capability lease TTL override (HOL-356). Wins over the same
|
|
658
747
|
* field on the def. See `CapabilityDefInit.leaseTtlMs` for shape;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holokai/neuron-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "SDK for building Holokai neurons — connect to a BigBrain gateway over HTTP+SSE or Electron IPC and execute capability-typed tasks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Holokai",
|
|
@@ -37,8 +37,17 @@
|
|
|
37
37
|
"import": "./dist/ipc.mjs",
|
|
38
38
|
"require": "./dist/ipc.js",
|
|
39
39
|
"default": "./dist/ipc.js"
|
|
40
|
+
},
|
|
41
|
+
"./auth": {
|
|
42
|
+
"types": "./dist/auth.d.ts",
|
|
43
|
+
"import": "./dist/auth.mjs",
|
|
44
|
+
"require": "./dist/auth.js",
|
|
45
|
+
"default": "./dist/auth.js"
|
|
40
46
|
}
|
|
41
47
|
},
|
|
48
|
+
"bin": {
|
|
49
|
+
"neuron-sdk": "./dist/cli.js"
|
|
50
|
+
},
|
|
42
51
|
"files": [
|
|
43
52
|
"dist",
|
|
44
53
|
"README.md",
|
|
@@ -52,8 +61,8 @@
|
|
|
52
61
|
"clean": "rm -rf dist",
|
|
53
62
|
"test": "vitest run && pnpm run check:browser && pnpm run check:no-workspace",
|
|
54
63
|
"test:watch": "vitest",
|
|
55
|
-
"check:browser": "
|
|
56
|
-
"check:no-workspace": "
|
|
64
|
+
"check:browser": "node scripts/check-browser-build.mjs",
|
|
65
|
+
"check:no-workspace": "node scripts/check-no-workspace-imports.mjs",
|
|
57
66
|
"lint": "eslint src",
|
|
58
67
|
"lint:fix": "eslint src --fix",
|
|
59
68
|
"typecheck": "tsc --noEmit",
|