@anchrd/intel-contract 0.1.0 → 0.2.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 +24 -3
- package/dist/contract/contract.d.ts +4 -115
- package/dist/contract/contract.js +12 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
# @anchrd/intel-contract
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The shared wire contract for [`@anchrd/intel-api`](https://www.npmjs.com/package/@anchrd/intel-api): Zod
|
|
4
|
+
schemas that describe every payload crossing Intel's HTTP, MCP and browser surfaces.
|
|
5
|
+
|
|
6
|
+
You rarely install this directly — the server and the UI both depend on it. Reach for it when you
|
|
7
|
+
write your own client against the Intel HTTP API and want the same types and validation the server
|
|
8
|
+
uses.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @anchrd/intel-contract
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Use
|
|
4
17
|
|
|
5
18
|
```ts
|
|
6
|
-
import { CreateKnowledgeNodeInput } from "@anchrd/intel-contract";
|
|
19
|
+
import { CreateKnowledgeNodeInput, KnowledgeNode } from "@anchrd/intel-contract";
|
|
7
20
|
|
|
8
21
|
const input = CreateKnowledgeNodeInput.parse(payload);
|
|
22
|
+
const node = KnowledgeNode.parse(await response.json());
|
|
9
23
|
```
|
|
10
24
|
|
|
11
|
-
Mutation inputs are strict: unknown
|
|
25
|
+
Mutation inputs are strict: an unknown field is rejected rather than silently dropped, so a typo in
|
|
26
|
+
a client never becomes a value that quietly fails to apply. Types are inferred from the schemas, so
|
|
27
|
+
`z.infer` gives you the same shape the server validates against.
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
Proprietary. Published publicly for installation convenience; this is not an open-source license and
|
|
32
|
+
grants no right to use, copy, modify or redistribute the software. Contact Anchrd for licensing.
|
|
@@ -483,18 +483,7 @@ export declare const DeleteKnowledgeLinkResult: z.ZodObject<{
|
|
|
483
483
|
}, z.core.$strict>;
|
|
484
484
|
export type DeleteKnowledgeLinkResult = z.infer<typeof DeleteKnowledgeLinkResult>;
|
|
485
485
|
export declare const ToolSourceUrl: z.ZodURL;
|
|
486
|
-
export declare const
|
|
487
|
-
id: z.ZodString;
|
|
488
|
-
name: z.ZodString;
|
|
489
|
-
url: z.ZodURL;
|
|
490
|
-
connectionHandle: z.ZodString;
|
|
491
|
-
enabled: z.ZodBoolean;
|
|
492
|
-
createdBy: z.ZodString;
|
|
493
|
-
createdAt: z.ZodISODateTime;
|
|
494
|
-
updatedAt: z.ZodISODateTime;
|
|
495
|
-
lastDiscoveredAt: z.ZodNullable<z.ZodISODateTime>;
|
|
496
|
-
}, z.core.$strict>;
|
|
497
|
-
export type ToolSource = z.infer<typeof ToolSource>;
|
|
486
|
+
export declare const ToolName: z.ZodString;
|
|
498
487
|
export declare const ToolAnnotations: z.ZodObject<{
|
|
499
488
|
title: z.ZodOptional<z.ZodString>;
|
|
500
489
|
readOnlyHint: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -504,7 +493,6 @@ export declare const ToolAnnotations: z.ZodObject<{
|
|
|
504
493
|
}, z.core.$strict>;
|
|
505
494
|
export type ToolAnnotations = z.infer<typeof ToolAnnotations>;
|
|
506
495
|
export declare const ToolCapability: z.ZodObject<{
|
|
507
|
-
sourceId: z.ZodString;
|
|
508
496
|
name: z.ZodString;
|
|
509
497
|
title: z.ZodNullable<z.ZodString>;
|
|
510
498
|
description: z.ZodNullable<z.ZodString>;
|
|
@@ -518,30 +506,11 @@ export declare const ToolCapability: z.ZodObject<{
|
|
|
518
506
|
openWorldHint: z.ZodOptional<z.ZodBoolean>;
|
|
519
507
|
}, z.core.$strict>;
|
|
520
508
|
fingerprint: z.ZodString;
|
|
521
|
-
discoveredAt: z.ZodISODateTime;
|
|
522
509
|
}, z.core.$strict>;
|
|
523
510
|
export type ToolCapability = z.infer<typeof ToolCapability>;
|
|
524
|
-
export declare const
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
forbidden: "forbidden";
|
|
528
|
-
invalid: "invalid";
|
|
529
|
-
}>;
|
|
530
|
-
export type ToolConnectionStatus = z.infer<typeof ToolConnectionStatus>;
|
|
531
|
-
export declare const ToolCatalogEntry: z.ZodObject<{
|
|
532
|
-
source: z.ZodObject<{
|
|
533
|
-
id: z.ZodString;
|
|
534
|
-
name: z.ZodString;
|
|
535
|
-
url: z.ZodURL;
|
|
536
|
-
connectionHandle: z.ZodString;
|
|
537
|
-
enabled: z.ZodBoolean;
|
|
538
|
-
createdBy: z.ZodString;
|
|
539
|
-
createdAt: z.ZodISODateTime;
|
|
540
|
-
updatedAt: z.ZodISODateTime;
|
|
541
|
-
lastDiscoveredAt: z.ZodNullable<z.ZodISODateTime>;
|
|
542
|
-
}, z.core.$strict>;
|
|
543
|
-
capability: z.ZodObject<{
|
|
544
|
-
sourceId: z.ZodString;
|
|
511
|
+
export declare const ToolCatalog: z.ZodObject<{
|
|
512
|
+
portalConnected: z.ZodBoolean;
|
|
513
|
+
items: z.ZodArray<z.ZodObject<{
|
|
545
514
|
name: z.ZodString;
|
|
546
515
|
title: z.ZodNullable<z.ZodString>;
|
|
547
516
|
description: z.ZodNullable<z.ZodString>;
|
|
@@ -555,89 +524,15 @@ export declare const ToolCatalogEntry: z.ZodObject<{
|
|
|
555
524
|
openWorldHint: z.ZodOptional<z.ZodBoolean>;
|
|
556
525
|
}, z.core.$strict>;
|
|
557
526
|
fingerprint: z.ZodString;
|
|
558
|
-
discoveredAt: z.ZodISODateTime;
|
|
559
|
-
}, z.core.$strict>;
|
|
560
|
-
connectionStatus: z.ZodEnum<{
|
|
561
|
-
connected: "connected";
|
|
562
|
-
missing: "missing";
|
|
563
|
-
forbidden: "forbidden";
|
|
564
|
-
invalid: "invalid";
|
|
565
|
-
}>;
|
|
566
|
-
}, z.core.$strict>;
|
|
567
|
-
export type ToolCatalogEntry = z.infer<typeof ToolCatalogEntry>;
|
|
568
|
-
export declare const ToolSourceList: z.ZodObject<{
|
|
569
|
-
items: z.ZodArray<z.ZodObject<{
|
|
570
|
-
id: z.ZodString;
|
|
571
|
-
name: z.ZodString;
|
|
572
|
-
url: z.ZodURL;
|
|
573
|
-
connectionHandle: z.ZodString;
|
|
574
|
-
enabled: z.ZodBoolean;
|
|
575
|
-
createdBy: z.ZodString;
|
|
576
|
-
createdAt: z.ZodISODateTime;
|
|
577
|
-
updatedAt: z.ZodISODateTime;
|
|
578
|
-
lastDiscoveredAt: z.ZodNullable<z.ZodISODateTime>;
|
|
579
|
-
}, z.core.$strict>>;
|
|
580
|
-
}, z.core.$strict>;
|
|
581
|
-
export type ToolSourceList = z.infer<typeof ToolSourceList>;
|
|
582
|
-
export declare const ToolCatalog: z.ZodObject<{
|
|
583
|
-
items: z.ZodArray<z.ZodObject<{
|
|
584
|
-
source: z.ZodObject<{
|
|
585
|
-
id: z.ZodString;
|
|
586
|
-
name: z.ZodString;
|
|
587
|
-
url: z.ZodURL;
|
|
588
|
-
connectionHandle: z.ZodString;
|
|
589
|
-
enabled: z.ZodBoolean;
|
|
590
|
-
createdBy: z.ZodString;
|
|
591
|
-
createdAt: z.ZodISODateTime;
|
|
592
|
-
updatedAt: z.ZodISODateTime;
|
|
593
|
-
lastDiscoveredAt: z.ZodNullable<z.ZodISODateTime>;
|
|
594
|
-
}, z.core.$strict>;
|
|
595
|
-
capability: z.ZodObject<{
|
|
596
|
-
sourceId: z.ZodString;
|
|
597
|
-
name: z.ZodString;
|
|
598
|
-
title: z.ZodNullable<z.ZodString>;
|
|
599
|
-
description: z.ZodNullable<z.ZodString>;
|
|
600
|
-
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
601
|
-
outputSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
602
|
-
annotations: z.ZodObject<{
|
|
603
|
-
title: z.ZodOptional<z.ZodString>;
|
|
604
|
-
readOnlyHint: z.ZodOptional<z.ZodBoolean>;
|
|
605
|
-
destructiveHint: z.ZodOptional<z.ZodBoolean>;
|
|
606
|
-
idempotentHint: z.ZodOptional<z.ZodBoolean>;
|
|
607
|
-
openWorldHint: z.ZodOptional<z.ZodBoolean>;
|
|
608
|
-
}, z.core.$strict>;
|
|
609
|
-
fingerprint: z.ZodString;
|
|
610
|
-
discoveredAt: z.ZodISODateTime;
|
|
611
|
-
}, z.core.$strict>;
|
|
612
|
-
connectionStatus: z.ZodEnum<{
|
|
613
|
-
connected: "connected";
|
|
614
|
-
missing: "missing";
|
|
615
|
-
forbidden: "forbidden";
|
|
616
|
-
invalid: "invalid";
|
|
617
|
-
}>;
|
|
618
527
|
}, z.core.$strict>>;
|
|
619
528
|
}, z.core.$strict>;
|
|
620
529
|
export type ToolCatalog = z.infer<typeof ToolCatalog>;
|
|
621
|
-
export declare const CreateToolSourceInput: z.ZodObject<{
|
|
622
|
-
name: z.ZodString;
|
|
623
|
-
url: z.ZodURL;
|
|
624
|
-
connectionHandle: z.ZodDefault<z.ZodString>;
|
|
625
|
-
idempotencyKey: z.ZodString;
|
|
626
|
-
}, z.core.$strict>;
|
|
627
|
-
export type CreateToolSourceInput = z.infer<typeof CreateToolSourceInput>;
|
|
628
|
-
export declare const DiscoverToolSourceInput: z.ZodObject<{
|
|
629
|
-
sourceId: z.ZodString;
|
|
630
|
-
idempotencyKey: z.ZodString;
|
|
631
|
-
}, z.core.$strict>;
|
|
632
|
-
export type DiscoverToolSourceInput = z.infer<typeof DiscoverToolSourceInput>;
|
|
633
530
|
export declare const TestToolInput: z.ZodObject<{
|
|
634
|
-
sourceId: z.ZodString;
|
|
635
531
|
name: z.ZodString;
|
|
636
532
|
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
637
533
|
}, z.core.$strict>;
|
|
638
534
|
export type TestToolInput = z.infer<typeof TestToolInput>;
|
|
639
535
|
export declare const ExecuteToolInput: z.ZodObject<{
|
|
640
|
-
sourceId: z.ZodString;
|
|
641
536
|
name: z.ZodString;
|
|
642
537
|
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
643
538
|
}, z.core.$strict>;
|
|
@@ -703,7 +598,6 @@ export declare const FlowNode: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
703
598
|
}, z.core.$strict>, z.ZodObject<{
|
|
704
599
|
kind: z.ZodLiteral<"tool">;
|
|
705
600
|
configuration: z.ZodObject<{
|
|
706
|
-
sourceId: z.ZodString;
|
|
707
601
|
toolName: z.ZodString;
|
|
708
602
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
709
603
|
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -814,7 +708,6 @@ export declare const FlowGraph: z.ZodObject<{
|
|
|
814
708
|
}, z.core.$strict>, z.ZodObject<{
|
|
815
709
|
kind: z.ZodLiteral<"tool">;
|
|
816
710
|
configuration: z.ZodObject<{
|
|
817
|
-
sourceId: z.ZodString;
|
|
818
711
|
toolName: z.ZodString;
|
|
819
712
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
820
713
|
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -941,7 +834,6 @@ export declare const FlowVersion: z.ZodObject<{
|
|
|
941
834
|
}, z.core.$strict>, z.ZodObject<{
|
|
942
835
|
kind: z.ZodLiteral<"tool">;
|
|
943
836
|
configuration: z.ZodObject<{
|
|
944
|
-
sourceId: z.ZodString;
|
|
945
837
|
toolName: z.ZodString;
|
|
946
838
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
947
839
|
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -1071,7 +963,6 @@ export declare const FlowDocument: z.ZodObject<{
|
|
|
1071
963
|
}, z.core.$strict>, z.ZodObject<{
|
|
1072
964
|
kind: z.ZodLiteral<"tool">;
|
|
1073
965
|
configuration: z.ZodObject<{
|
|
1074
|
-
sourceId: z.ZodString;
|
|
1075
966
|
toolName: z.ZodString;
|
|
1076
967
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1077
968
|
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -1213,7 +1104,6 @@ export declare const SaveFlowVersionInput: z.ZodObject<{
|
|
|
1213
1104
|
}, z.core.$strict>, z.ZodObject<{
|
|
1214
1105
|
kind: z.ZodLiteral<"tool">;
|
|
1215
1106
|
configuration: z.ZodObject<{
|
|
1216
|
-
sourceId: z.ZodString;
|
|
1217
1107
|
toolName: z.ZodString;
|
|
1218
1108
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1219
1109
|
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -1415,7 +1305,6 @@ export declare const FlowRunStep: z.ZodObject<{
|
|
|
1415
1305
|
}, z.core.$strict>, z.ZodObject<{
|
|
1416
1306
|
kind: z.ZodLiteral<"tool">;
|
|
1417
1307
|
configuration: z.ZodObject<{
|
|
1418
|
-
sourceId: z.ZodString;
|
|
1419
1308
|
toolName: z.ZodString;
|
|
1420
1309
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1421
1310
|
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -227,18 +227,10 @@ export const ToolSourceUrl = z.url().refine((value) => {
|
|
|
227
227
|
catch {
|
|
228
228
|
return false;
|
|
229
229
|
}
|
|
230
|
-
}, "
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
url: ToolSourceUrl,
|
|
235
|
-
connectionHandle: z.string().regex(/^[a-z0-9][a-z0-9-]{1,62}$/),
|
|
236
|
-
enabled: z.boolean(),
|
|
237
|
-
createdBy: IntelId,
|
|
238
|
-
createdAt: IsoDateTime,
|
|
239
|
-
updatedAt: IsoDateTime,
|
|
240
|
-
lastDiscoveredAt: IsoDateTime.nullable(),
|
|
241
|
-
});
|
|
230
|
+
}, "The portal must use an approved public HTTPS host without embedded credentials");
|
|
231
|
+
// The portal namespaces every upstream tool, so the name alone identifies the target server. Intel
|
|
232
|
+
// never learns which server that is — the portal resolves it and attaches the credentials.
|
|
233
|
+
export const ToolName = z.string().min(1).max(240);
|
|
242
234
|
export const ToolAnnotations = z.strictObject({
|
|
243
235
|
title: z.string().max(240).optional(),
|
|
244
236
|
readOnlyHint: z.boolean().optional(),
|
|
@@ -247,40 +239,22 @@ export const ToolAnnotations = z.strictObject({
|
|
|
247
239
|
openWorldHint: z.boolean().optional(),
|
|
248
240
|
});
|
|
249
241
|
export const ToolCapability = z.strictObject({
|
|
250
|
-
|
|
251
|
-
name: z.string().min(1).max(240),
|
|
242
|
+
name: ToolName,
|
|
252
243
|
title: z.string().max(240).nullable(),
|
|
253
244
|
description: z.string().max(10_000).nullable(),
|
|
254
245
|
inputSchema: z.record(z.string(), z.unknown()),
|
|
255
246
|
outputSchema: z.record(z.string(), z.unknown()).nullable(),
|
|
256
247
|
annotations: ToolAnnotations,
|
|
257
248
|
fingerprint: z.string().regex(/^[a-f0-9]{64}$/),
|
|
258
|
-
discoveredAt: IsoDateTime,
|
|
259
|
-
});
|
|
260
|
-
export const ToolConnectionStatus = z.enum(["connected", "missing", "forbidden", "invalid"]);
|
|
261
|
-
export const ToolCatalogEntry = z.strictObject({
|
|
262
|
-
source: ToolSource,
|
|
263
|
-
capability: ToolCapability,
|
|
264
|
-
connectionStatus: ToolConnectionStatus,
|
|
265
|
-
});
|
|
266
|
-
export const ToolSourceList = z.strictObject({ items: z.array(ToolSource) });
|
|
267
|
-
export const ToolCatalog = z.strictObject({ items: z.array(ToolCatalogEntry) });
|
|
268
|
-
export const CreateToolSourceInput = z.strictObject({
|
|
269
|
-
name: z.string().trim().min(1).max(120),
|
|
270
|
-
url: ToolSourceUrl,
|
|
271
|
-
connectionHandle: z
|
|
272
|
-
.string()
|
|
273
|
-
.regex(/^[a-z0-9][a-z0-9-]{1,62}$/)
|
|
274
|
-
.default("intel-tools"),
|
|
275
|
-
idempotencyKey: z.string().min(8).max(200),
|
|
276
249
|
});
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
250
|
+
// The catalog reflects one live tools/list for the requesting user. It is never stored as a
|
|
251
|
+
// permission mirror, so there is no per-source state and no Intel-owned connection status.
|
|
252
|
+
export const ToolCatalog = z.strictObject({
|
|
253
|
+
portalConnected: z.boolean(),
|
|
254
|
+
items: z.array(ToolCapability),
|
|
280
255
|
});
|
|
281
256
|
export const TestToolInput = z.strictObject({
|
|
282
|
-
|
|
283
|
-
name: z.string().min(1).max(240),
|
|
257
|
+
name: ToolName,
|
|
284
258
|
arguments: z.record(z.string(), z.unknown()).default({}),
|
|
285
259
|
});
|
|
286
260
|
export const ExecuteToolInput = TestToolInput;
|
|
@@ -325,8 +299,7 @@ export const FlowNode = z.discriminatedUnion("kind", [
|
|
|
325
299
|
...FlowNodeBase,
|
|
326
300
|
kind: z.literal("tool"),
|
|
327
301
|
configuration: z.strictObject({
|
|
328
|
-
|
|
329
|
-
toolName: z.string().min(1).max(240),
|
|
302
|
+
toolName: ToolName,
|
|
330
303
|
fingerprint: z
|
|
331
304
|
.string()
|
|
332
305
|
.regex(/^[a-f0-9]{64}$/)
|