@anchrd/intel-contract 0.17.0 → 0.18.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/dist/contract/flow-run.d.ts +2 -2
- package/dist/contract/flow.d.ts +11 -11
- package/dist/contract/flow.js +38 -5
- package/package.json +1 -1
|
@@ -130,9 +130,9 @@ export declare const FlowRunStep: z.ZodObject<{
|
|
|
130
130
|
}, z.core.$strict>, z.ZodObject<{
|
|
131
131
|
kind: z.ZodLiteral<"tool">;
|
|
132
132
|
configuration: z.ZodObject<{
|
|
133
|
-
|
|
133
|
+
server: z.ZodString;
|
|
134
|
+
allow: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
134
135
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
135
|
-
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
136
136
|
}, z.core.$strict>;
|
|
137
137
|
id: z.ZodString;
|
|
138
138
|
position: z.ZodObject<{
|
package/dist/contract/flow.d.ts
CHANGED
|
@@ -106,9 +106,9 @@ export declare const FlowNode: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
106
106
|
}, z.core.$strict>, z.ZodObject<{
|
|
107
107
|
kind: z.ZodLiteral<"tool">;
|
|
108
108
|
configuration: z.ZodObject<{
|
|
109
|
-
|
|
109
|
+
server: z.ZodString;
|
|
110
|
+
allow: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
110
111
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
111
|
-
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
112
112
|
}, z.core.$strict>;
|
|
113
113
|
id: z.ZodString;
|
|
114
114
|
position: z.ZodObject<{
|
|
@@ -245,9 +245,9 @@ export declare const FlowGraph: z.ZodObject<{
|
|
|
245
245
|
}, z.core.$strict>, z.ZodObject<{
|
|
246
246
|
kind: z.ZodLiteral<"tool">;
|
|
247
247
|
configuration: z.ZodObject<{
|
|
248
|
-
|
|
248
|
+
server: z.ZodString;
|
|
249
|
+
allow: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
249
250
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
250
|
-
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
251
251
|
}, z.core.$strict>;
|
|
252
252
|
id: z.ZodString;
|
|
253
253
|
position: z.ZodObject<{
|
|
@@ -396,9 +396,9 @@ export declare const FlowVersion: z.ZodObject<{
|
|
|
396
396
|
}, z.core.$strict>, z.ZodObject<{
|
|
397
397
|
kind: z.ZodLiteral<"tool">;
|
|
398
398
|
configuration: z.ZodObject<{
|
|
399
|
-
|
|
399
|
+
server: z.ZodString;
|
|
400
|
+
allow: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
400
401
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
401
|
-
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
402
402
|
}, z.core.$strict>;
|
|
403
403
|
id: z.ZodString;
|
|
404
404
|
position: z.ZodObject<{
|
|
@@ -550,9 +550,9 @@ export declare const FlowDocument: z.ZodObject<{
|
|
|
550
550
|
}, z.core.$strict>, z.ZodObject<{
|
|
551
551
|
kind: z.ZodLiteral<"tool">;
|
|
552
552
|
configuration: z.ZodObject<{
|
|
553
|
-
|
|
553
|
+
server: z.ZodString;
|
|
554
|
+
allow: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
554
555
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
555
|
-
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
556
556
|
}, z.core.$strict>;
|
|
557
557
|
id: z.ZodString;
|
|
558
558
|
position: z.ZodObject<{
|
|
@@ -673,7 +673,7 @@ export declare const FlowRequirements: z.ZodObject<{
|
|
|
673
673
|
title: z.ZodString;
|
|
674
674
|
}, z.core.$strict>>;
|
|
675
675
|
hiddenNodes: z.ZodNumber;
|
|
676
|
-
|
|
676
|
+
servers: z.ZodArray<z.ZodString>;
|
|
677
677
|
}, z.core.$strict>;
|
|
678
678
|
export type FlowRequirements = z.infer<typeof FlowRequirements>;
|
|
679
679
|
export declare const FlowValidation: z.ZodObject<{
|
|
@@ -801,9 +801,9 @@ export declare const SaveFlowVersionInput: z.ZodObject<{
|
|
|
801
801
|
}, z.core.$strict>, z.ZodObject<{
|
|
802
802
|
kind: z.ZodLiteral<"tool">;
|
|
803
803
|
configuration: z.ZodObject<{
|
|
804
|
-
|
|
804
|
+
server: z.ZodString;
|
|
805
|
+
allow: z.ZodDefault<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
805
806
|
fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
806
|
-
arguments: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
807
807
|
}, z.core.$strict>;
|
|
808
808
|
id: z.ZodString;
|
|
809
809
|
position: z.ZodObject<{
|
package/dist/contract/flow.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { IdempotencyKey, IntelId, IsoDateTime, LinkConfiguration } from "./contract.js";
|
|
3
|
-
import { ToolName } from "./tool.js";
|
|
3
|
+
import { serverOf, ToolName, ToolServerHandle } from "./tool.js";
|
|
4
4
|
export const FlowNodeId = z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/);
|
|
5
5
|
export const FlowPosition = z.strictObject({ x: z.number().finite(), y: z.number().finite() });
|
|
6
6
|
// A node has a title and nothing else to write in prose (#39). A second free text beside it was
|
|
@@ -77,17 +77,50 @@ export const FlowNode = z.discriminatedUnion("kind", [
|
|
|
77
77
|
}),
|
|
78
78
|
z.strictObject({ ...FlowNodeBase, kind: z.literal("upload"), configuration: LinkConfiguration }),
|
|
79
79
|
z.strictObject({ ...FlowNodeBase, kind: z.literal("table"), configuration: LinkConfiguration }),
|
|
80
|
+
/**
|
|
81
|
+
* A tool step names a SERVER, and optionally the functions of it that this step may use.
|
|
82
|
+
*
|
|
83
|
+
* ⚠️ It named a single function until #489, together with a raw argument object the author had to
|
|
84
|
+
* write as JSON. That modelled the protocol instead of the intent: an author gives a step access
|
|
85
|
+
* to Notion; WHICH of Notion's 28 functions runs, and with which arguments, follows from the
|
|
86
|
+
* step's instruction and can only be known while the flow runs.
|
|
87
|
+
*
|
|
88
|
+
* `allow: null` means every function of that server. A list narrows it, and every entry has to
|
|
89
|
+
* belong to `server` — checked below, because a name from another server would silently widen
|
|
90
|
+
* the step past the one thing this configuration is supposed to bound.
|
|
91
|
+
*
|
|
92
|
+
* ⚠️ There is deliberately no `arguments` field any more. Arguments are produced at run time and
|
|
93
|
+
* validated against the tool's own `inputSchema` from a live `tools/list`; a stored copy would be
|
|
94
|
+
* a second source for something the far side already defines, and it would go stale silently.
|
|
95
|
+
*/
|
|
80
96
|
z.strictObject({
|
|
81
97
|
...FlowNodeBase,
|
|
82
98
|
kind: z.literal("tool"),
|
|
83
|
-
configuration: z
|
|
84
|
-
|
|
99
|
+
configuration: z
|
|
100
|
+
.strictObject({
|
|
101
|
+
server: ToolServerHandle,
|
|
102
|
+
allow: z.array(ToolName).nullable().default(null),
|
|
85
103
|
fingerprint: z
|
|
86
104
|
.string()
|
|
87
105
|
.regex(/^[a-f0-9]{64}$/)
|
|
88
106
|
.nullable()
|
|
89
107
|
.default(null),
|
|
90
|
-
|
|
108
|
+
})
|
|
109
|
+
.check((ctx) => {
|
|
110
|
+
const { server, allow } = ctx.value;
|
|
111
|
+
if (allow === null)
|
|
112
|
+
return;
|
|
113
|
+
// The prefix rule is the contract's own (`serverOf`), so a step cannot claim a function
|
|
114
|
+
// that the portal would route somewhere else entirely.
|
|
115
|
+
for (const name of allow) {
|
|
116
|
+
if (serverOf(name, [server]) === null) {
|
|
117
|
+
ctx.issues.push({
|
|
118
|
+
code: "custom",
|
|
119
|
+
input: name,
|
|
120
|
+
message: `An allowed function has to belong to the step's server: ${name} is not a function of ${server}`,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
91
124
|
}),
|
|
92
125
|
}),
|
|
93
126
|
z.strictObject({
|
|
@@ -222,7 +255,7 @@ export const FlowRequirements = z.strictObject({
|
|
|
222
255
|
versionId: IntelId.nullable(),
|
|
223
256
|
nodes: z.array(ReferencedNode),
|
|
224
257
|
hiddenNodes: z.number().int().nonnegative(),
|
|
225
|
-
|
|
258
|
+
servers: z.array(ToolServerHandle),
|
|
226
259
|
});
|
|
227
260
|
// What stands between this flow and a run, asked on demand and answered for the person asking.
|
|
228
261
|
//
|