@anchrd/colab-sdk 0.1.52 → 0.1.54
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/action-blocks/action-blocks.d.ts +6 -0
- package/dist/action-blocks/action-blocks.js +7 -2
- package/dist/actions/actions.d.ts +3 -20
- package/dist/actions/actions.js +0 -3
- package/dist/conversations/conversations.d.ts +8 -0
- package/dist/conversations/conversations.js +5 -0
- package/dist/error/error.js +48 -3
- package/dist/flows/flow-runs.d.ts +2313 -0
- package/dist/flows/flow-runs.js +424 -0
- package/dist/flows/flows.d.ts +2751 -0
- package/dist/flows/flows.js +469 -0
- package/dist/gadgets/gadgets.d.ts +0 -21
- package/dist/gadgets/gadgets.js +1 -6
- package/dist/goals/goals.d.ts +3 -0
- package/dist/grammar/grammar.d.ts +1 -0
- package/dist/grammar/grammar.js +4 -0
- package/dist/home/home.d.ts +0 -5
- package/dist/nodes/nodes.d.ts +8 -1
- package/dist/nodes/nodes.js +2 -0
- package/dist/operators/operators.js +2 -1
- package/dist/relations/relations.d.ts +2 -0
- package/dist/schedule/schedule.d.ts +1 -0
- package/dist/schedule/schedule.js +1 -1
- package/dist/sdk.d.ts +3 -1
- package/dist/sdk.js +3 -1
- package/dist/sources/sources.d.ts +0 -10
- package/dist/sources/sources.js +4 -4
- package/dist/tree-order/tree-order.d.ts +1 -1
- package/dist/tree-order/tree-order.js +1 -0
- package/dist/written/written.d.ts +4 -0
- package/dist/written/written.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { GadgetVersionRef } from "../gadgets/gadgets.js";
|
|
3
|
+
import { idSchema } from "../ids/ids.js";
|
|
4
|
+
import { CreateSection, NodeId, NodePath, NodePerson, SecretId } from "../nodes/nodes.js";
|
|
5
|
+
import { IdempotencyKey, Rev } from "../primitives/primitives.js";
|
|
6
|
+
import { TimeZone } from "../profile/profile.js";
|
|
7
|
+
import { weekdays } from "../schedule/schedule.js";
|
|
8
|
+
import { UserId } from "../users/users.js";
|
|
9
|
+
// Flows (#1228, E274, Nodes › Flow): a node that operates a portal without an API in a browser. Its
|
|
10
|
+
// steps (an instruction for people, actions for the machine), its secrets, its one schedule, a draft
|
|
11
|
+
// and published versions. The inputs of `intelligence_flow_*` and their answers.
|
|
12
|
+
//
|
|
13
|
+
// ⚠️ The action format below is THE format: the runner (#1229), the free run (#1230) and the
|
|
14
|
+
// recording (#1233) import it and never write a second one.
|
|
15
|
+
//
|
|
16
|
+
// ⚠️ A secret's NAME travels under `credential`, never under a key that holds `secret`: `/mcp`
|
|
17
|
+
// strikes every value under such a key (`redactSecrets`), and the model has to read the name.
|
|
18
|
+
const FlowId = NodeId.describe("The flow's id, a `node_…` of kind flow.");
|
|
19
|
+
export const FlowStepId = idSchema("step").describe("A step of the flow, `step_…`.");
|
|
20
|
+
// ---- Limits ----
|
|
21
|
+
export const flowLimits = {
|
|
22
|
+
hosts: 20,
|
|
23
|
+
steps: 200,
|
|
24
|
+
actions: 50,
|
|
25
|
+
// A step under a step, and nothing below that: two levels.
|
|
26
|
+
levels: 2,
|
|
27
|
+
secrets: 50,
|
|
28
|
+
readFields: 50,
|
|
29
|
+
// How often a `repeat` runs at most, whatever it repeats over.
|
|
30
|
+
repeatMax: 1000,
|
|
31
|
+
};
|
|
32
|
+
// ---- Targets ----
|
|
33
|
+
const targetExtras = {
|
|
34
|
+
css: z
|
|
35
|
+
.string()
|
|
36
|
+
.min(1)
|
|
37
|
+
.max(500)
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("A CSS selector as an extra hint when the description alone finds more than one element. Never the only thing that names the element."),
|
|
40
|
+
nth: z
|
|
41
|
+
.int()
|
|
42
|
+
.min(1)
|
|
43
|
+
.max(1000)
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Which one when several elements match, counted from 1."),
|
|
46
|
+
// #1233: two elements of the same role and name (two "Details" in a list) told apart by what
|
|
47
|
+
// they stand in, not by their place: the row that holds the text A-1005.
|
|
48
|
+
within: z
|
|
49
|
+
.strictObject({
|
|
50
|
+
role: z.string().min(1).max(60).describe("The container's role, like row or listitem."),
|
|
51
|
+
has: z
|
|
52
|
+
.string()
|
|
53
|
+
.min(1)
|
|
54
|
+
.max(300)
|
|
55
|
+
.describe("A text the container holds and no other of its kind does, like A-1005."),
|
|
56
|
+
})
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("The container the element stands in, named by its role and a text only it holds: the row with A-1005. Survives a list sorted anew, unlike nth."),
|
|
59
|
+
};
|
|
60
|
+
// The element an action acts on, described the way a person names it, so a step survives a redesign
|
|
61
|
+
// and a person can read it: a role with its name, a field's label, or the visible text. A CSS path
|
|
62
|
+
// is a hint beside one of them and by construction never stands alone.
|
|
63
|
+
export const FlowTarget = z
|
|
64
|
+
.discriminatedUnion("by", [
|
|
65
|
+
z.strictObject({
|
|
66
|
+
by: z.literal("role"),
|
|
67
|
+
role: z
|
|
68
|
+
.string()
|
|
69
|
+
.min(1)
|
|
70
|
+
.max(60)
|
|
71
|
+
.describe("The ARIA role, like button, link, textbox, checkbox, row."),
|
|
72
|
+
// Optional since #1230: the entries of a list are often elements of one role without a name
|
|
73
|
+
// (the items of a blog's list), which a read's rows names by role alone.
|
|
74
|
+
name: z
|
|
75
|
+
.string()
|
|
76
|
+
.min(1)
|
|
77
|
+
.max(300)
|
|
78
|
+
.optional()
|
|
79
|
+
.describe("The accessible name, like Anmelden. Leaving it out means every element of that role, like the items of a list as the rows of a read."),
|
|
80
|
+
...targetExtras,
|
|
81
|
+
}),
|
|
82
|
+
z.strictObject({
|
|
83
|
+
by: z.literal("label"),
|
|
84
|
+
label: z.string().min(1).max(300).describe("The label of a form field, like E-Mail."),
|
|
85
|
+
...targetExtras,
|
|
86
|
+
}),
|
|
87
|
+
z.strictObject({
|
|
88
|
+
by: z.literal("text"),
|
|
89
|
+
text: z.string().min(1).max(300).describe("The visible text of the element."),
|
|
90
|
+
...targetExtras,
|
|
91
|
+
}),
|
|
92
|
+
])
|
|
93
|
+
.describe('The element, described durably: { by: "role", role, name }, { by: "label", label } or { by: "text", text }; css and nth only as extras.');
|
|
94
|
+
// ---- Actions ----
|
|
95
|
+
// A secret's name as a line of a `.env` file names it.
|
|
96
|
+
export const FlowSecretName = z
|
|
97
|
+
.string()
|
|
98
|
+
.regex(/^[A-Z][A-Z0-9_]{0,63}$/, "A secret's name is capitals, digits and _, like PORTAL_PASSWORD.")
|
|
99
|
+
.describe("A secret's name in capitals, like PORTAL_PASSWORD.");
|
|
100
|
+
// What a run keeps read data under until a `write` takes it.
|
|
101
|
+
const DataName = z
|
|
102
|
+
.string()
|
|
103
|
+
.regex(/^[a-z][A-Za-z0-9]{0,39}$/, "A name is a word like inquiries.")
|
|
104
|
+
.describe("The name read data stands under during the run, a word like inquiries.");
|
|
105
|
+
export const flowActionTypes = ["open", "click", "fill", "read", "write", "repeat"];
|
|
106
|
+
export const flowReadTakes = ["text", "link", "value"];
|
|
107
|
+
// #1233: `write.key` became `unique`: `/mcp` strikes every value under a key named `key`, so the AI
|
|
108
|
+
// could not read its own. A stored version or draft with `key` reads as `unique`.
|
|
109
|
+
function legacyKey(value) {
|
|
110
|
+
if (typeof value === "object" &&
|
|
111
|
+
value !== null &&
|
|
112
|
+
value.type === "write" &&
|
|
113
|
+
"key" in value &&
|
|
114
|
+
!("unique" in value)) {
|
|
115
|
+
const { key, ...rest } = value;
|
|
116
|
+
return { ...rest, unique: key };
|
|
117
|
+
}
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
const FlowActionUnion = z
|
|
121
|
+
.discriminatedUnion("type", [
|
|
122
|
+
z.strictObject({
|
|
123
|
+
type: z.literal("open"),
|
|
124
|
+
url: z
|
|
125
|
+
.url({ protocol: /^https$/ })
|
|
126
|
+
.max(2000)
|
|
127
|
+
.describe("The address to open: https, on one of the flow's hosts."),
|
|
128
|
+
}),
|
|
129
|
+
z.strictObject({
|
|
130
|
+
type: z.literal("click"),
|
|
131
|
+
target: FlowTarget,
|
|
132
|
+
}),
|
|
133
|
+
z.strictObject({
|
|
134
|
+
type: z.literal("fill"),
|
|
135
|
+
target: FlowTarget,
|
|
136
|
+
value: z
|
|
137
|
+
.union([
|
|
138
|
+
z.strictObject({
|
|
139
|
+
text: z.string().max(10_000).describe("The text to type, as it stands."),
|
|
140
|
+
}),
|
|
141
|
+
z.strictObject({
|
|
142
|
+
credential: FlowSecretName.describe("The NAME of one of the flow's secrets; the runner fills in its value, which nobody reads."),
|
|
143
|
+
}),
|
|
144
|
+
])
|
|
145
|
+
.describe("What to type: { text } or { credential: the name of a secret }."),
|
|
146
|
+
// #1233: Enter after typing, as a person sends a search or a sign-in.
|
|
147
|
+
enter: z
|
|
148
|
+
.literal(true)
|
|
149
|
+
.optional()
|
|
150
|
+
.describe("Press Enter in the field after filling it, like sending a search."),
|
|
151
|
+
}),
|
|
152
|
+
z.strictObject({
|
|
153
|
+
type: z.literal("read"),
|
|
154
|
+
into: DataName,
|
|
155
|
+
rows: FlowTarget.optional().describe("The element that repeats once per entry, like a row of a list. Leaving it out reads one entry from the page."),
|
|
156
|
+
fields: z
|
|
157
|
+
.array(z.strictObject({
|
|
158
|
+
name: z.string().min(1).max(100).describe("The field's name, like a table's column."),
|
|
159
|
+
target: FlowTarget,
|
|
160
|
+
take: z
|
|
161
|
+
.enum(flowReadTakes)
|
|
162
|
+
.optional()
|
|
163
|
+
.describe("What to take from the element: text (the default), link (its address) or value (a field's value)."),
|
|
164
|
+
// #1230: a list item of a portal often carries title and date in one text without an
|
|
165
|
+
// element of their own; a pattern takes the part.
|
|
166
|
+
pattern: z
|
|
167
|
+
.string()
|
|
168
|
+
.min(1)
|
|
169
|
+
.max(200)
|
|
170
|
+
.refine((source) => {
|
|
171
|
+
try {
|
|
172
|
+
new RegExp(source);
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
}, "Not a regular expression.")
|
|
179
|
+
.optional()
|
|
180
|
+
.describe("A regular expression (JavaScript) that takes a part of what was taken: its first group, or the whole match; no match gives an empty value. Like ^([^\\n]+) for the first line, or (\\d{1,2}\\. \\S+ \\d{4}) for a date."),
|
|
181
|
+
}))
|
|
182
|
+
.min(1)
|
|
183
|
+
.max(flowLimits.readFields)
|
|
184
|
+
.describe("The fields of one entry, each found inside the row."),
|
|
185
|
+
}),
|
|
186
|
+
z.strictObject({
|
|
187
|
+
type: z.literal("write"),
|
|
188
|
+
from: DataName.describe("The name a read action of this flow put the data under."),
|
|
189
|
+
nodeId: NodeId.describe("The table to write the entries into: one row per entry, each field into the column of the same name."),
|
|
190
|
+
unique: z
|
|
191
|
+
.string()
|
|
192
|
+
.min(1)
|
|
193
|
+
.max(100)
|
|
194
|
+
.optional()
|
|
195
|
+
.describe("The field that names an entry, like Link: an entry whose value in that column stands in the table already is not written again. Leaving it out writes every entry."),
|
|
196
|
+
}),
|
|
197
|
+
z.strictObject({
|
|
198
|
+
type: z.literal("repeat"),
|
|
199
|
+
over: z
|
|
200
|
+
.union([
|
|
201
|
+
z.strictObject({ each: FlowTarget }),
|
|
202
|
+
z.strictObject({ while: FlowTarget }),
|
|
203
|
+
z.strictObject({
|
|
204
|
+
times: z.int().min(1).max(flowLimits.repeatMax).describe("How many rounds."),
|
|
205
|
+
}),
|
|
206
|
+
])
|
|
207
|
+
.describe("What the steps below repeat over: { each: target } once per matching element, { while: target } as long as the element is there (like a Next button), or { times: n }. A repeat is the last action of a top-level step; the steps below it are what runs each round, after the step's other actions."),
|
|
208
|
+
max: z
|
|
209
|
+
.int()
|
|
210
|
+
.min(1)
|
|
211
|
+
.max(flowLimits.repeatMax)
|
|
212
|
+
.optional()
|
|
213
|
+
.describe("At most this many rounds. Leaving it out: times runs its n rounds, each and while at most 100."),
|
|
214
|
+
}),
|
|
215
|
+
])
|
|
216
|
+
.describe("One thing the browser does: open (an address), click, fill (a text or a secret by name), read (entries by a pattern), write (read entries into a node) or repeat (the steps below this one).");
|
|
217
|
+
export const FlowAction = z.preprocess(legacyKey, FlowActionUnion);
|
|
218
|
+
export const FlowActions = z
|
|
219
|
+
.array(FlowAction)
|
|
220
|
+
.max(flowLimits.actions)
|
|
221
|
+
.describe("The step's actions in order, at most 50.");
|
|
222
|
+
// ---- Steps ----
|
|
223
|
+
// fixed: the actions fit the instruction, a fixed run replays them. open: they are missing or stale,
|
|
224
|
+
// and the next run goes on freely from here.
|
|
225
|
+
export const flowStepStates = ["fixed", "open"];
|
|
226
|
+
export const FlowStepState = z.enum(flowStepStates);
|
|
227
|
+
const StepTitle = z.string().max(200).describe("The step's title, a few words.");
|
|
228
|
+
const StepInstruction = z
|
|
229
|
+
.string()
|
|
230
|
+
.max(4000)
|
|
231
|
+
.describe("What is to happen in this step, in plain words a person can change.");
|
|
232
|
+
const StepSuccess = z
|
|
233
|
+
.string()
|
|
234
|
+
.max(2000)
|
|
235
|
+
.describe('How to tell that it worked ("Geklappt, wenn"), in plain words.');
|
|
236
|
+
// Where the page must stand once the step worked (#1230): the address's path, like /anfragen. A
|
|
237
|
+
// fixed run fails the step when the page stands elsewhere, so a wrong password that lands on the sign-in
|
|
238
|
+
// page again is a failure and not an empty list. Optional, so versions stored before it still read.
|
|
239
|
+
export const FlowReachedPath = z
|
|
240
|
+
.string()
|
|
241
|
+
.regex(/^\/[^\s?#]{0,499}$/, "A path starts with / and carries no query, like /anfragen.")
|
|
242
|
+
.describe("The path the page stands at once this step worked, like /anfragen, without query. A fixed run fails the step when the page stands elsewhere. Only for a page every run reaches, not one that depends on being signed in already.");
|
|
243
|
+
const stepFields = {
|
|
244
|
+
stepId: FlowStepId,
|
|
245
|
+
title: z.string(),
|
|
246
|
+
instruction: z.string(),
|
|
247
|
+
success: z.string(),
|
|
248
|
+
actions: z.array(FlowAction),
|
|
249
|
+
state: FlowStepState,
|
|
250
|
+
reachedPath: FlowReachedPath.nullable().optional(),
|
|
251
|
+
};
|
|
252
|
+
// A step as an answer carries it: a top-level step with the steps below it, in order.
|
|
253
|
+
export const FlowSubStep = z.object(stepFields);
|
|
254
|
+
export const FlowStep = z.object({ ...stepFields, steps: z.array(FlowSubStep) });
|
|
255
|
+
// ---- The schedule ----
|
|
256
|
+
export const flowRhythms = ["hourly", "daily", "weekly"];
|
|
257
|
+
// A flow's hour (#1229): the Worker's one cron fires on the hour, so a run starts on the hour; a
|
|
258
|
+
// time with minutes would start at the next tick while the view said the minute. As a source's.
|
|
259
|
+
export const FlowHour = z
|
|
260
|
+
.string()
|
|
261
|
+
.regex(/^([01]\d|2[0-3]):00$/, "A flow runs on the hour: a time is a full hour, HH:00, like 08:00.");
|
|
262
|
+
// One schedule per flow (E274 (10)): the switch, the rhythm, the weekdays, the time. The fields a
|
|
263
|
+
// rhythm takes are checked by `flowScheduleProblem`, not by a refinement here: a refined schema
|
|
264
|
+
// cannot be extended by `/mcp` (trap of `sdk`).
|
|
265
|
+
export const FlowSchedule = z.strictObject({
|
|
266
|
+
enabled: z
|
|
267
|
+
.boolean()
|
|
268
|
+
.describe("Whether the flow runs on its schedule. Off keeps the rhythm for later."),
|
|
269
|
+
rhythm: z
|
|
270
|
+
.enum(flowRhythms)
|
|
271
|
+
.describe("hourly (on the hour), daily (on days at time) or weekly (on exactly one day at time)."),
|
|
272
|
+
days: z
|
|
273
|
+
.array(z.enum(weekdays))
|
|
274
|
+
.min(1)
|
|
275
|
+
.max(7)
|
|
276
|
+
.optional()
|
|
277
|
+
.describe("The weekdays of daily, like [monday, tuesday]; exactly one for weekly. Not hourly."),
|
|
278
|
+
time: FlowHour.optional().describe("The hour of daily and weekly, HH:00 in zone, like 08:00: runs start on the hour."),
|
|
279
|
+
zone: TimeZone.optional().describe("The IANA time zone the time is read in, like Europe/Berlin. Leaving it out keeps the one set, at first the creator's."),
|
|
280
|
+
});
|
|
281
|
+
// What is wrong with a schedule's combination of fields, or null. One place for the tool and the UI.
|
|
282
|
+
export function flowScheduleProblem(schedule) {
|
|
283
|
+
if (schedule.rhythm === "hourly") {
|
|
284
|
+
if (schedule.days !== undefined) {
|
|
285
|
+
return { path: "days", message: "An hourly rhythm takes no days; leave them out." };
|
|
286
|
+
}
|
|
287
|
+
if (schedule.time !== undefined) {
|
|
288
|
+
return { path: "time", message: "An hourly rhythm takes no time; leave it out." };
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
if (schedule.days === undefined) {
|
|
293
|
+
return { path: "days", message: `A ${schedule.rhythm} rhythm needs days, like [monday].` };
|
|
294
|
+
}
|
|
295
|
+
if (schedule.time === undefined) {
|
|
296
|
+
return { path: "time", message: `A ${schedule.rhythm} rhythm needs a time, like 08:00.` };
|
|
297
|
+
}
|
|
298
|
+
if (new Set(schedule.days).size !== schedule.days.length) {
|
|
299
|
+
return { path: "days", message: "Each weekday only once." };
|
|
300
|
+
}
|
|
301
|
+
if (schedule.rhythm === "weekly" && schedule.days.length !== 1) {
|
|
302
|
+
return { path: "days", message: "A weekly rhythm runs on exactly one day, like [monday]." };
|
|
303
|
+
}
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
// ---- Settings ----
|
|
307
|
+
export const flowRecordingDays = [7, 14, 30];
|
|
308
|
+
const RecordingDays = z
|
|
309
|
+
.union([z.literal(7), z.literal(14), z.literal(30)])
|
|
310
|
+
.describe("How many days the recordings of the runs stay: 7, 14 or 30.");
|
|
311
|
+
// A host as "Zugang" names it: a name, no scheme, no path, no port.
|
|
312
|
+
export const FlowHost = z
|
|
313
|
+
.string()
|
|
314
|
+
.max(253)
|
|
315
|
+
.regex(/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/, "A host is a name like portal.example.com, lowercase, without https:// and without a path.");
|
|
316
|
+
const Hosts = z
|
|
317
|
+
.array(FlowHost)
|
|
318
|
+
.max(flowLimits.hosts)
|
|
319
|
+
.describe("The hosts the flow reaches, like [portal.example.com]: the browser opens nothing else. The whole list.");
|
|
320
|
+
const FlowSettingsInput = z.strictObject({
|
|
321
|
+
responsibleId: UserId.nullable()
|
|
322
|
+
.optional()
|
|
323
|
+
.describe("The Operator or person who hears of a fixed run that fails or meets an open step, takes the same run over, repairs the flow and publishes it; null for nobody, then such a run ends. Only whoever may write the flow changes it."),
|
|
324
|
+
recordingDays: RecordingDays.optional(),
|
|
325
|
+
});
|
|
326
|
+
// ---- The tools' inputs ----
|
|
327
|
+
export const FlowCreateInput = z.strictObject({
|
|
328
|
+
// ⚠️ Required and nullable (trap C015): null is the caller's own root folder (#791).
|
|
329
|
+
parentId: NodeId.nullable().describe("The folder to create the flow in, one you can write to; null creates it in your own root folder (Own), or on the top level of Shared with section shared, where only you see it until you share it."),
|
|
330
|
+
section: CreateSection,
|
|
331
|
+
name: z.string().max(200).describe("The name as people read it."),
|
|
332
|
+
hosts: Hosts.optional(),
|
|
333
|
+
idempotencyKey: IdempotencyKey,
|
|
334
|
+
});
|
|
335
|
+
export const FlowGetInput = z.strictObject({
|
|
336
|
+
flowId: FlowId,
|
|
337
|
+
version: GadgetVersionRef.optional().describe("Which steps to read. Leaving it out gives whoever may change the flow the steps as they stand (the draft where there is one) and a reader the live version. live, draft or a published version's number ask for one state; draft and a number only with the right to change the flow."),
|
|
338
|
+
});
|
|
339
|
+
export const FlowUpdateInput = z.strictObject({
|
|
340
|
+
flowId: FlowId,
|
|
341
|
+
hosts: Hosts.optional(),
|
|
342
|
+
schedule: FlowSchedule.optional().describe("The flow's one schedule, whole: enabled, rhythm, and for daily and weekly days and time."),
|
|
343
|
+
settings: FlowSettingsInput.optional().describe("The flow's settings; only the fields you send change. They apply at once, not through the draft."),
|
|
344
|
+
fromVersion: z
|
|
345
|
+
.number()
|
|
346
|
+
.int()
|
|
347
|
+
.min(1)
|
|
348
|
+
.optional()
|
|
349
|
+
.describe("Restore: the draft becomes the steps of this published version; it goes live only when published."),
|
|
350
|
+
discard: z
|
|
351
|
+
.literal(true)
|
|
352
|
+
.optional()
|
|
353
|
+
.describe("Throw the draft away: the steps are the live version's again."),
|
|
354
|
+
rev: Rev,
|
|
355
|
+
});
|
|
356
|
+
export const FlowPublishInput = z.strictObject({ flowId: FlowId, rev: Rev });
|
|
357
|
+
const Placement = {
|
|
358
|
+
parentStepId: FlowStepId.nullable()
|
|
359
|
+
.optional()
|
|
360
|
+
.describe("The step this one hangs under (a loop or a condition), two levels at most; null or leaving it out puts it on the top level."),
|
|
361
|
+
afterStepId: FlowStepId.nullable()
|
|
362
|
+
.optional()
|
|
363
|
+
.describe("The step on the same level it comes right after; null puts it first. Leaving it out puts it last."),
|
|
364
|
+
};
|
|
365
|
+
const StateInput = FlowStepState.optional().describe("fixed: the actions fit the instruction and a fixed run replays them, which needs at least one action. open: the next run goes on freely from here. Leaving it out: a new step is open, and a changed instruction makes a step open.");
|
|
366
|
+
export const FlowStepCreateInput = z.strictObject({
|
|
367
|
+
flowId: FlowId,
|
|
368
|
+
title: StepTitle,
|
|
369
|
+
instruction: StepInstruction,
|
|
370
|
+
success: StepSuccess.optional(),
|
|
371
|
+
actions: FlowActions.optional(),
|
|
372
|
+
state: StateInput,
|
|
373
|
+
reachedPath: FlowReachedPath.optional(),
|
|
374
|
+
...Placement,
|
|
375
|
+
rev: Rev,
|
|
376
|
+
});
|
|
377
|
+
export const FlowStepUpdateInput = z.strictObject({
|
|
378
|
+
flowId: FlowId,
|
|
379
|
+
stepId: FlowStepId,
|
|
380
|
+
title: StepTitle.optional(),
|
|
381
|
+
instruction: StepInstruction.optional(),
|
|
382
|
+
success: StepSuccess.optional(),
|
|
383
|
+
actions: FlowActions.optional().describe("The step's actions, the whole list in order, at most 50."),
|
|
384
|
+
state: StateInput,
|
|
385
|
+
reachedPath: FlowReachedPath.nullable()
|
|
386
|
+
.optional()
|
|
387
|
+
.describe("The path the page stands at once this step worked; null removes it."),
|
|
388
|
+
rev: Rev,
|
|
389
|
+
});
|
|
390
|
+
export const FlowStepMoveInput = z.strictObject({
|
|
391
|
+
flowId: FlowId,
|
|
392
|
+
stepId: FlowStepId,
|
|
393
|
+
...Placement,
|
|
394
|
+
rev: Rev,
|
|
395
|
+
});
|
|
396
|
+
export const FlowStepRemoveInput = z.strictObject({
|
|
397
|
+
flowId: FlowId,
|
|
398
|
+
stepId: FlowStepId,
|
|
399
|
+
rev: Rev,
|
|
400
|
+
});
|
|
401
|
+
const SecretValue = z
|
|
402
|
+
.string()
|
|
403
|
+
.min(1)
|
|
404
|
+
.max(10_000)
|
|
405
|
+
.describe("The secret's value. Stored sealed and never shown again.");
|
|
406
|
+
const FlowSecretId = SecretId.describe("A secret of the flow, `secret_…`.");
|
|
407
|
+
export const FlowSecretListInput = z.strictObject({ flowId: FlowId });
|
|
408
|
+
export const FlowSecretCreateInput = z.strictObject({
|
|
409
|
+
flowId: FlowId,
|
|
410
|
+
name: FlowSecretName,
|
|
411
|
+
value: SecretValue,
|
|
412
|
+
});
|
|
413
|
+
export const FlowSecretUpdateInput = z.strictObject({
|
|
414
|
+
flowId: FlowId,
|
|
415
|
+
secretId: FlowSecretId,
|
|
416
|
+
value: SecretValue,
|
|
417
|
+
});
|
|
418
|
+
export const FlowSecretRemoveInput = z.strictObject({ flowId: FlowId, secretId: FlowSecretId });
|
|
419
|
+
// ---- Answers ----
|
|
420
|
+
// A secret as every answer names it: never its value.
|
|
421
|
+
export const FlowSecret = z.object({
|
|
422
|
+
secretId: SecretId,
|
|
423
|
+
name: z.string(),
|
|
424
|
+
setAt: z.iso.datetime(),
|
|
425
|
+
});
|
|
426
|
+
export const FlowSecretList = z.object({ items: z.array(FlowSecret) });
|
|
427
|
+
export const FlowSecretRemoved = z.object({ secretId: SecretId, removed: z.literal(true) });
|
|
428
|
+
export const FlowScheduleDetail = z.object({
|
|
429
|
+
enabled: z.boolean(),
|
|
430
|
+
rhythm: z.enum(flowRhythms),
|
|
431
|
+
days: z.array(z.enum(weekdays)).optional(),
|
|
432
|
+
time: z.string().optional(),
|
|
433
|
+
zone: z.string(),
|
|
434
|
+
});
|
|
435
|
+
export const FlowDetail = z.object({
|
|
436
|
+
flowId: FlowId,
|
|
437
|
+
name: z.string(),
|
|
438
|
+
hidden: z.boolean(),
|
|
439
|
+
parentId: NodeId.nullable(),
|
|
440
|
+
path: NodePath,
|
|
441
|
+
hosts: z.array(z.string()),
|
|
442
|
+
schedule: FlowScheduleDetail,
|
|
443
|
+
// When the schedule runs the flow next (#1229), computed by the server; null while the schedule is
|
|
444
|
+
// off or nothing is live.
|
|
445
|
+
nextRunAt: z.iso.datetime().nullable(),
|
|
446
|
+
// Which steps these are: a published version's number, the draft, or null for a reader of a flow
|
|
447
|
+
// nobody published yet (then `steps` is empty).
|
|
448
|
+
version: z.union([z.number().int(), z.literal("draft")]).nullable(),
|
|
449
|
+
steps: z.array(FlowStep),
|
|
450
|
+
live: z
|
|
451
|
+
.object({ version: z.number().int(), publishedAt: z.iso.datetime(), publishedBy: NodePerson })
|
|
452
|
+
.nullable(),
|
|
453
|
+
// Set while the steps differ from the live version's: who changed them last, and when.
|
|
454
|
+
draft: z.object({ updatedAt: z.iso.datetime(), updatedBy: NodePerson }).nullable(),
|
|
455
|
+
// Only for whoever may change the flow; null for a reader.
|
|
456
|
+
settings: z
|
|
457
|
+
.object({
|
|
458
|
+
responsible: NodePerson.nullable(),
|
|
459
|
+
recordingDays: z.number().int(),
|
|
460
|
+
// Names only, never values. ⚠️ Not `secrets`: `/mcp` strikes every value under such a name.
|
|
461
|
+
credentials: z.array(z.object({ name: z.string(), setAt: z.iso.datetime() })),
|
|
462
|
+
})
|
|
463
|
+
.nullable(),
|
|
464
|
+
rights: z.object({ write: z.boolean() }),
|
|
465
|
+
rev: Rev,
|
|
466
|
+
archivedAt: z.iso.datetime().nullable(),
|
|
467
|
+
});
|
|
468
|
+
// A published version's content, the JSON `versions.content` holds: the steps as they were.
|
|
469
|
+
export const FlowVersionContent = z.object({ steps: z.array(FlowStep) });
|
|
@@ -49,12 +49,6 @@ export declare const GadgetVersionRef: z.ZodPreprocess<z.ZodUnion<readonly [z.Zo
|
|
|
49
49
|
draft: "draft";
|
|
50
50
|
}>, z.ZodNumber]>, unknown>;
|
|
51
51
|
export type GadgetVersionRef = z.infer<typeof GadgetVersionRef>;
|
|
52
|
-
export declare const GadgetLevel: z.ZodEnum<{
|
|
53
|
-
publish: "publish";
|
|
54
|
-
draft: "draft";
|
|
55
|
-
report: "report";
|
|
56
|
-
}>;
|
|
57
|
-
export type GadgetLevel = z.infer<typeof GadgetLevel>;
|
|
58
52
|
export declare const gadgetLogDays: readonly [7, 14, 30];
|
|
59
53
|
export declare const GadgetCreateInput: z.ZodObject<{
|
|
60
54
|
parentId: z.ZodNullable<z.ZodTemplateLiteral<`node_${string}`>>;
|
|
@@ -101,11 +95,6 @@ export declare const GadgetUpdateInput: z.ZodObject<{
|
|
|
101
95
|
files: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
|
|
102
96
|
settings: z.ZodOptional<z.ZodObject<{
|
|
103
97
|
responsibleId: z.ZodOptional<z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>>;
|
|
104
|
-
level: z.ZodOptional<z.ZodEnum<{
|
|
105
|
-
publish: "publish";
|
|
106
|
-
draft: "draft";
|
|
107
|
-
report: "report";
|
|
108
|
-
}>>;
|
|
109
98
|
logDays: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<7>, z.ZodLiteral<14>, z.ZodLiteral<30>]>>;
|
|
110
99
|
uses: z.ZodOptional<z.ZodRecord<z.ZodTemplateLiteral<`node_${string}`>, z.ZodTemplateLiteral<`node_${string}`>>>;
|
|
111
100
|
original: z.ZodOptional<z.ZodNull>;
|
|
@@ -233,11 +222,6 @@ export declare const GadgetSettings: z.ZodObject<{
|
|
|
233
222
|
human: "human";
|
|
234
223
|
}>>;
|
|
235
224
|
}, z.core.$strip>>;
|
|
236
|
-
level: z.ZodEnum<{
|
|
237
|
-
publish: "publish";
|
|
238
|
-
draft: "draft";
|
|
239
|
-
report: "report";
|
|
240
|
-
}>;
|
|
241
225
|
logDays: z.ZodNumber;
|
|
242
226
|
}, z.core.$strip>;
|
|
243
227
|
export type GadgetSettings = z.infer<typeof GadgetSettings>;
|
|
@@ -584,11 +568,6 @@ export declare const GadgetDetail: z.ZodObject<{
|
|
|
584
568
|
human: "human";
|
|
585
569
|
}>>;
|
|
586
570
|
}, z.core.$strip>>;
|
|
587
|
-
level: z.ZodEnum<{
|
|
588
|
-
publish: "publish";
|
|
589
|
-
draft: "draft";
|
|
590
|
-
report: "report";
|
|
591
|
-
}>;
|
|
592
571
|
logDays: z.ZodNumber;
|
|
593
572
|
}, z.core.$strip>>;
|
|
594
573
|
rights: z.ZodObject<{
|
package/dist/gadgets/gadgets.js
CHANGED
|
@@ -72,9 +72,6 @@ export const GadgetManifest = z.strictObject({
|
|
|
72
72
|
// Which state of the gadget: the live version, the draft, or a published version by its number.
|
|
73
73
|
// Over REST the query string carries text, so digits become the number here.
|
|
74
74
|
export const GadgetVersionRef = z.preprocess((value) => (typeof value === "string" && /^[1-9][0-9]{0,8}$/.test(value) ? Number(value) : value), z.union([z.enum(["live", "draft"]), z.number().int().min(1)]));
|
|
75
|
-
// Who answers for errors and red tests, and how far they may go (Nodes › Gadget › Einstellungen):
|
|
76
|
-
// only report, repair as a draft (the default), or repair and publish.
|
|
77
|
-
export const GadgetLevel = z.enum(["report", "draft", "publish"]);
|
|
78
75
|
export const gadgetLogDays = [7, 14, 30];
|
|
79
76
|
const LogDays = z
|
|
80
77
|
.union([z.literal(7), z.literal(14), z.literal(30)])
|
|
@@ -133,8 +130,7 @@ export const GadgetGetInput = z.strictObject({
|
|
|
133
130
|
const GadgetSettingsInput = z.strictObject({
|
|
134
131
|
responsibleId: UserId.nullable()
|
|
135
132
|
.optional()
|
|
136
|
-
.describe("The Operator or person who gets every new error and red test as an Action; null for nobody, then the publisher gets a hint."),
|
|
137
|
-
level: GadgetLevel.optional().describe("How far the responsible goes: report, draft (repair as a draft, the default) or publish (repair and publish, only with every test green and no new rights)."),
|
|
133
|
+
.describe("The Operator or person who gets every new error and red test as an Action, repairs it and publishes the repair (only with every test green and no new rights); null for nobody, then the publisher gets a hint. Only whoever may write the gadget changes it."),
|
|
138
134
|
logDays: LogDays.optional(),
|
|
139
135
|
uses: z
|
|
140
136
|
.record(NodeId, NodeId)
|
|
@@ -265,7 +261,6 @@ export const GadgetDiffFile = GadgetChange.extend({
|
|
|
265
261
|
});
|
|
266
262
|
export const GadgetSettings = z.object({
|
|
267
263
|
responsible: NodePerson.nullable(),
|
|
268
|
-
level: GadgetLevel,
|
|
269
264
|
logDays: z.number().int(),
|
|
270
265
|
});
|
|
271
266
|
// One use of the `colab` binding during a call: which tool, how long, and the error code it answered
|
package/dist/goals/goals.d.ts
CHANGED
|
@@ -155,6 +155,7 @@ export declare const GoalCheck: z.ZodObject<{
|
|
|
155
155
|
goal: "goal";
|
|
156
156
|
skill: "skill";
|
|
157
157
|
source: "source";
|
|
158
|
+
flow: "flow";
|
|
158
159
|
}>>>;
|
|
159
160
|
needs: z.ZodNullable<z.ZodEnum<{
|
|
160
161
|
write: "write";
|
|
@@ -231,6 +232,7 @@ export declare const GoalReady: z.ZodObject<{
|
|
|
231
232
|
goal: "goal";
|
|
232
233
|
skill: "skill";
|
|
233
234
|
source: "source";
|
|
235
|
+
flow: "flow";
|
|
234
236
|
}>>>;
|
|
235
237
|
needs: z.ZodNullable<z.ZodEnum<{
|
|
236
238
|
write: "write";
|
|
@@ -796,6 +798,7 @@ export declare const GoalDetail: z.ZodObject<{
|
|
|
796
798
|
goal: "goal";
|
|
797
799
|
skill: "skill";
|
|
798
800
|
source: "source";
|
|
801
|
+
flow: "flow";
|
|
799
802
|
}>>>;
|
|
800
803
|
needs: z.ZodNullable<z.ZodEnum<{
|
|
801
804
|
write: "write";
|
package/dist/grammar/grammar.js
CHANGED
|
@@ -96,6 +96,10 @@ export const resources = {
|
|
|
96
96
|
source: "sources",
|
|
97
97
|
query: "queries",
|
|
98
98
|
item: "items",
|
|
99
|
+
// A node that operates a portal without an API in a browser (#1228, E274, Nodes › Flow):
|
|
100
|
+
// `intelligence_flow_*`; its steps are `intelligence_flow_step_*`, its secrets
|
|
101
|
+
// `intelligence_flow_secret_*`, both words that stood here already. Named by the epic #1226.
|
|
102
|
+
flow: "flows",
|
|
99
103
|
// The company as a whole (#930, Organisation › System): its default time zone and language,
|
|
100
104
|
// `access_organisation_get` and `_update`. One per installation, so its routes carry no id.
|
|
101
105
|
organisation: "organisations",
|
package/dist/home/home.d.ts
CHANGED
|
@@ -254,11 +254,6 @@ export declare const Home: z.ZodObject<{
|
|
|
254
254
|
human: "human";
|
|
255
255
|
}>>;
|
|
256
256
|
}, z.core.$strip>>;
|
|
257
|
-
level: z.ZodEnum<{
|
|
258
|
-
publish: "publish";
|
|
259
|
-
draft: "draft";
|
|
260
|
-
report: "report";
|
|
261
|
-
}>;
|
|
262
257
|
logDays: z.ZodNumber;
|
|
263
258
|
}, z.core.$strip>>;
|
|
264
259
|
rights: z.ZodObject<{
|
package/dist/nodes/nodes.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const SecretFields: {
|
|
|
7
7
|
secret: z.ZodOptional<z.ZodLiteral<true>>;
|
|
8
8
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
9
9
|
};
|
|
10
|
-
export declare const nodeKinds: readonly ["folder", "document", "table", "board", "task", "file", "gadget", "goal", "skill", "source"];
|
|
10
|
+
export declare const nodeKinds: readonly ["folder", "document", "table", "board", "task", "file", "gadget", "goal", "skill", "source", "flow"];
|
|
11
11
|
export declare const NodeKind: z.ZodEnum<{
|
|
12
12
|
file: "file";
|
|
13
13
|
folder: "folder";
|
|
@@ -19,6 +19,7 @@ export declare const NodeKind: z.ZodEnum<{
|
|
|
19
19
|
goal: "goal";
|
|
20
20
|
skill: "skill";
|
|
21
21
|
source: "source";
|
|
22
|
+
flow: "flow";
|
|
22
23
|
}>;
|
|
23
24
|
export type NodeKind = z.infer<typeof NodeKind>;
|
|
24
25
|
export declare const unknownNodeKind: "unknown";
|
|
@@ -34,6 +35,7 @@ export declare const NodeKindRead: z.ZodCatch<z.ZodEnum<{
|
|
|
34
35
|
goal: "goal";
|
|
35
36
|
skill: "skill";
|
|
36
37
|
source: "source";
|
|
38
|
+
flow: "flow";
|
|
37
39
|
}>>;
|
|
38
40
|
export type NodeKindRead = z.infer<typeof NodeKindRead>;
|
|
39
41
|
export declare const responsibleKinds: readonly ["document", "table", "file"];
|
|
@@ -118,6 +120,7 @@ export declare const NodeListItem: z.ZodObject<{
|
|
|
118
120
|
goal: "goal";
|
|
119
121
|
skill: "skill";
|
|
120
122
|
source: "source";
|
|
123
|
+
flow: "flow";
|
|
121
124
|
}>>;
|
|
122
125
|
name: z.ZodString;
|
|
123
126
|
hidden: z.ZodBoolean;
|
|
@@ -182,6 +185,7 @@ export declare const NodeList: z.ZodObject<{
|
|
|
182
185
|
goal: "goal";
|
|
183
186
|
skill: "skill";
|
|
184
187
|
source: "source";
|
|
188
|
+
flow: "flow";
|
|
185
189
|
}>>;
|
|
186
190
|
name: z.ZodString;
|
|
187
191
|
hidden: z.ZodBoolean;
|
|
@@ -270,6 +274,7 @@ export declare const NodeHit: z.ZodObject<{
|
|
|
270
274
|
goal: "goal";
|
|
271
275
|
skill: "skill";
|
|
272
276
|
source: "source";
|
|
277
|
+
flow: "flow";
|
|
273
278
|
}>>;
|
|
274
279
|
name: z.ZodString;
|
|
275
280
|
path: z.ZodObject<{
|
|
@@ -334,6 +339,7 @@ export declare const NodeSearch: z.ZodObject<{
|
|
|
334
339
|
goal: "goal";
|
|
335
340
|
skill: "skill";
|
|
336
341
|
source: "source";
|
|
342
|
+
flow: "flow";
|
|
337
343
|
}>>;
|
|
338
344
|
name: z.ZodString;
|
|
339
345
|
path: z.ZodObject<{
|
|
@@ -430,6 +436,7 @@ export declare const NodeDetail: z.ZodObject<{
|
|
|
430
436
|
goal: "goal";
|
|
431
437
|
skill: "skill";
|
|
432
438
|
source: "source";
|
|
439
|
+
flow: "flow";
|
|
433
440
|
}>>;
|
|
434
441
|
name: z.ZodString;
|
|
435
442
|
hidden: z.ZodBoolean;
|
package/dist/nodes/nodes.js
CHANGED
|
@@ -40,6 +40,8 @@ export const nodeKinds = [
|
|
|
40
40
|
"skill",
|
|
41
41
|
// #900, E151: fetches data from outside on a schedule and keeps it as items.
|
|
42
42
|
"source",
|
|
43
|
+
// #1228, E274: operates a portal without an API in a browser, step by step.
|
|
44
|
+
"flow",
|
|
43
45
|
];
|
|
44
46
|
export const NodeKind = z.enum(nodeKinds);
|
|
45
47
|
// A list entry of a kind this release does not know yet reads as `unknown` (E195, #784): a tab
|