@fungi.computer/workflows-wire 0.0.1 → 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/dist/outcomes.js CHANGED
@@ -1,126 +1,226 @@
1
1
  import * as z from "zod";
2
2
  import { appCapabilityIds } from "@fungi.computer/puffball";
3
+ /** Lowercase Workflow slug used by library files and host commands. */
3
4
  export const workflowIdSchema = z.string().regex(/^[a-z0-9][a-z0-9-]{0,62}$/);
4
5
  const identity = z.string().min(1).max(256);
5
- const refusal = z.strictObject({ error: identity });
6
+ const refusal = z.strictObject({
7
+ /** Host-authored invocation refusal. */
8
+ error: identity,
9
+ });
6
10
  /** What the palette shows before a method's ports are ever fetched. */
7
- const methodSummarySchema = z.strictObject({
11
+ const methodSummarySchema = z.lazy(() => z.strictObject({
12
+ /** Port details have not yet been loaded. */
8
13
  pending: z.literal(true).optional(),
14
+ /** Human-readable method summary. */
9
15
  description: z.string().max(1000),
16
+ /** Declared read, write or external effect. */
10
17
  effect: z.enum(["read", "write", "external"]),
18
+ /** Declared approval mode. */
11
19
  approval: z.enum(["none", "queue", "simulate"]),
20
+ /** Capabilities required by this method. */
12
21
  requires: z.array(z.string().max(80)).max(64),
22
+ /** Digest identifying the declaration being summarized. */
13
23
  digest: z.string().max(128),
14
- });
15
- const eventSummarySchema = z.strictObject({
24
+ }));
25
+ const eventSummarySchema = z.lazy(() => z.strictObject({
26
+ /** Human-readable event summary. */
16
27
  description: z.string().max(1000),
28
+ /** Digest identifying the event declaration. */
17
29
  digest: z.string().max(128),
18
- });
30
+ }));
19
31
  const entryIdentity = {
32
+ /** Installation exposing these ports. */
20
33
  installationId: identity,
34
+ /** App installed at this installation. */
21
35
  appId: identity,
36
+ /** App display name shown in the palette. */
22
37
  displayName: z.string().max(256),
38
+ /** Optional declared App icon. */
23
39
  icon: z.string().min(1).max(80).optional(),
40
+ /** App capabilities included in the admitted catalog row. */
24
41
  capabilities: z.array(z.enum(appCapabilityIds)).optional(),
42
+ /** Whether Workflow publication is granted to this installation. */
25
43
  workflowPublishGranted: z.boolean().optional(),
44
+ /** Whether Workflow execution is granted to this installation. */
26
45
  workflowRunGranted: z.boolean().optional(),
27
46
  };
28
47
  /** `catalog({})`: a palette index over every installation, with no port schemas. */
29
- const catalogIndexEntrySchema = z.strictObject({
48
+ const catalogIndexEntrySchema = z.lazy(() => z.strictObject({
30
49
  ...entryIdentity,
50
+ /** Method summaries indexed by declared name. */
31
51
  methods: z.record(z.string(), methodSummarySchema),
52
+ /** Event summaries indexed by declared name. */
32
53
  events: z.record(z.string(), eventSummarySchema).optional(),
33
- });
54
+ }));
34
55
  /** `catalog({installationId})`: that one installation's full declared ports. */
35
- const catalogFullEntrySchema = z.strictObject({
56
+ const catalogFullEntrySchema = z.lazy(() => z.strictObject({
36
57
  ...entryIdentity,
58
+ /** Complete JSON method declarations indexed by name. */
37
59
  methods: z.record(z.string(), z.json()),
60
+ /** Complete JSON event declarations indexed by name. */
38
61
  events: z.record(z.string(), z.json()).optional(),
39
- });
40
- export const catalogInputSchema = z.strictObject({
62
+ }));
63
+ /** Select the palette index, or one installation's complete port declarations. */
64
+ export const catalogInputSchema = z.lazy(() => z.strictObject({
65
+ /** Select one installation, or omit to read the palette index. */
41
66
  installationId: identity.optional(),
42
- });
67
+ }));
43
68
  /** App method declarations admitted by the host for the current invocation. */
44
- export const catalogReplySchema = z.union([
45
- z.strictObject({ apps: z.array(catalogIndexEntrySchema).max(200) }),
46
- z.strictObject({ app: catalogFullEntrySchema }),
69
+ export const catalogReplySchema = z.lazy(() => z.union([
70
+ z.strictObject({
71
+ /** Bounded palette index over admitted installations. */
72
+ apps: z.array(catalogIndexEntrySchema).max(200),
73
+ }),
74
+ z.strictObject({
75
+ /** Full port declarations for the selected installation. */
76
+ app: catalogFullEntrySchema,
77
+ }),
47
78
  refusal,
48
- ]);
49
- export const workflowIssueSchema = z.object({
79
+ ]));
80
+ /** Validation issue with optional graph, node, trigger, port or edge location. */
81
+ export const workflowIssueSchema = z.lazy(() => z.object({
82
+ /** Machine-readable validation issue category. */
50
83
  code: z.string(),
84
+ /** Human-readable validation explanation. */
51
85
  message: z.string(),
86
+ /** Graph containing the invalid declaration. */
52
87
  graph: z.string().optional(),
88
+ /** Node associated with this issue. */
53
89
  node: z.string().optional(),
90
+ /** Trigger associated with this issue. */
54
91
  trigger: z.string().optional(),
92
+ /** Port associated with this issue. */
55
93
  port: z.string().optional(),
94
+ /** Edge index associated with this issue. */
56
95
  edge: z.number().optional(),
57
- });
58
- export const runReply = z.union([
96
+ }));
97
+ /** Run admission result, including replay/conflict, invalid input or refusal. */
98
+ export const runReply = z.lazy(() => z.union([
59
99
  z.strictObject({
100
+ /** Admission, replay or request-conflict discriminator. */
60
101
  kind: z.enum(["started", "replay", "conflict"]),
102
+ /** Identity of the run selected by admission. */
61
103
  runId: identity,
104
+ /** Digest of the admitted plan. */
62
105
  planDigest: identity,
63
106
  }),
64
107
  z.strictObject({
108
+ /** The run request failed validation. */
65
109
  kind: z.literal("invalid"),
110
+ /** Validation issues explaining the refusal. */
66
111
  issues: z.array(workflowIssueSchema),
67
112
  }),
68
- z.strictObject({ error: identity }),
69
- ]);
70
- export const cancelReplySchema = z.union([
71
- z.strictObject({ kind: z.enum(["cancelled", "terminal"]) }),
72
- z.strictObject({ kind: z.literal("refused"), reason: z.literal("denied") }),
73
- z.strictObject({ error: z.string() }),
74
- ]);
113
+ z.strictObject({
114
+ /** Host-authored invocation refusal. */
115
+ error: identity,
116
+ }),
117
+ ]));
118
+ /** Cancellation result, an already-terminal run, or an authority refusal. */
119
+ export const cancelReplySchema = z.lazy(() => z.union([
120
+ z.strictObject({
121
+ /** Cancellation completed, or the run was already terminal. */
122
+ kind: z.enum(["cancelled", "terminal"]),
123
+ }),
124
+ z.strictObject({
125
+ /** The cancellation was refused. */
126
+ kind: z.literal("refused"),
127
+ /** Caller lacked authority to cancel the run. */
128
+ reason: z.literal("denied"),
129
+ }),
130
+ z.strictObject({
131
+ /** Host-authored invocation error. */
132
+ error: z.string(),
133
+ }),
134
+ ]));
135
+ /** Lifecycle outcome reported for a Workflow run. */
75
136
  export const runOutcomeSchema = z.enum(["active", "terminal", "cancelled"]);
76
- export const statusReply = z.union([
137
+ /** Bounded run status snapshot with events, reviews, output and error. */
138
+ export const statusReply = z.lazy(() => z.union([
77
139
  z.strictObject({
140
+ /** Identity of the inspected run. */
78
141
  runId: identity,
142
+ /** Digest of the run's admitted plan. */
79
143
  planDigest: identity,
144
+ /** Current run lifecycle outcome. */
80
145
  outcome: runOutcomeSchema,
146
+ /** Human-readable run title. */
81
147
  title: z.string().max(120),
148
+ /** Bounded run event records. */
82
149
  events: z.array(z.record(z.string(), z.json())).max(4096),
150
+ /** Bounded review records associated with the run. */
83
151
  reviews: z.array(z.record(z.string(), z.json())).max(256),
152
+ /** Run status label supplied by the host. */
84
153
  status: identity,
154
+ /** JSON run output. */
85
155
  output: z.json(),
156
+ /** JSON run error. */
86
157
  error: z.json(),
87
158
  }),
88
159
  refusal,
89
- ]);
90
- export const answerReviewReply = z.union([
160
+ ]));
161
+ /** Result of answering a waiting run review, or an invocation refusal. */
162
+ export const answerReviewReply = z.lazy(() => z.union([
91
163
  z.strictObject({
164
+ /** Acceptance, denial, absence of a waiting review or invalid answer. */
92
165
  result: z.enum(["accepted", "denied", "not_waiting", "invalid"]),
93
166
  }),
94
167
  refusal,
95
- ]);
168
+ ]));
96
169
  const id = z.string().min(1).max(256);
97
- const denied = z.strictObject({ error: id });
98
- export const scheduleArmReplySchema = z.union([
99
- z.strictObject({ kind: z.literal("armed"), scheduleId: id }),
170
+ const denied = z.strictObject({
171
+ /** Host-authored invocation refusal. */
172
+ error: id,
173
+ });
174
+ /** Schedule-trigger admission or its refusal details. */
175
+ export const scheduleArmReplySchema = z.lazy(() => z.union([
100
176
  z.strictObject({
177
+ /** Schedule-trigger registration was armed. */
178
+ kind: z.literal("armed"),
179
+ /** Identity of the armed schedule registration. */
180
+ scheduleId: id,
181
+ }),
182
+ z.strictObject({
183
+ /** Schedule-trigger registration was refused. */
101
184
  kind: z.literal("refused"),
185
+ /** Host-authored reason for the refusal. */
102
186
  reason: z.string(),
187
+ /** Optional validation issues associated with the trigger. */
103
188
  issues: z.array(z.json()).optional(),
104
189
  }),
105
190
  denied,
106
- ]);
107
- export const triggerDisarmReplySchema = z.union([
108
- z.strictObject({ kind: z.enum(["disarmed", "not_found"]) }),
191
+ ]));
192
+ /** Trigger disarm result, including an absent trigger or denied invocation. */
193
+ export const triggerDisarmReplySchema = z.lazy(() => z.union([
194
+ z.strictObject({
195
+ /** Registration was disarmed or was already absent. */
196
+ kind: z.enum(["disarmed", "not_found"]),
197
+ }),
109
198
  denied,
110
- ]);
111
- export const schedulesReplySchema = z.union([
199
+ ]));
200
+ /** Visible schedule-trigger rows with their next due time and lifecycle state. */
201
+ export const schedulesReplySchema = z.lazy(() => z.union([
112
202
  z.strictObject({
203
+ /** Schedule-trigger registrations visible to this invocation. */
113
204
  schedules: z.array(z.strictObject({
205
+ /** Identity of the schedule registration. */
114
206
  scheduleId: id,
207
+ /** Installation owning the Workflow schedule and its control door. */
208
+ installationId: id,
209
+ /** Workflow whose published trigger was armed. */
115
210
  workflowId: workflowIdSchema,
211
+ /** Trigger identity within the published definition. */
116
212
  triggerId: id,
213
+ /** Next occurrence time in epoch milliseconds. */
117
214
  nextDueAt: z.number().int(),
215
+ /** Current schedule lifecycle state. */
118
216
  state: z.enum(["active", "paused", "cancelled", "finished"]),
217
+ /** Latest scheduling failure, or null when absent. */
119
218
  lastError: z.string().nullable(),
120
219
  })),
121
220
  }),
122
221
  denied,
123
- ]);
222
+ ]));
223
+ /** Origin category recorded for a run: manual, schedule, event, Agent or key. */
124
224
  export const workflowRunSourceSchema = z.enum([
125
225
  "manual",
126
226
  "schedule",
@@ -129,55 +229,93 @@ export const workflowRunSourceSchema = z.enum([
129
229
  "key",
130
230
  ]);
131
231
  /** The Agent Session (`sessionId`) stays host-side; the wire names only the Agent/key and its grantor. */
132
- export const workflowRunInitiatedBySchema = z.union([
133
- z.strictObject({ kind: z.literal("member"), memberId: id }),
232
+ export const workflowRunInitiatedBySchema = z.lazy(() => z.union([
134
233
  z.strictObject({
234
+ /** Run initiated directly by a member. */
235
+ kind: z.literal("member"),
236
+ /** Identity of the initiating member. */
237
+ memberId: id,
238
+ }),
239
+ z.strictObject({
240
+ /** Run initiated by an Agent. */
135
241
  kind: z.literal("agent"),
242
+ /** Identity of the initiating Agent. */
136
243
  agentId: id,
244
+ /** Member whose grant authorizes the invocation. */
137
245
  grantorMemberId: id,
138
246
  }),
139
247
  z.strictObject({
248
+ /** Run initiated by a named key. */
140
249
  kind: z.literal("key"),
250
+ /** Identity of the initiating key. */
141
251
  keyId: id,
252
+ /** Member whose grant authorizes the invocation. */
142
253
  grantorMemberId: id,
143
254
  }),
144
- ]);
145
- export const runsReplySchema = z.union([
255
+ ]));
256
+ /** Bounded recent-run rows with their source, initiator and pinned commit. */
257
+ export const runsReplySchema = z.lazy(() => z.union([
146
258
  z.strictObject({
259
+ /** Bounded recent runs visible to this invocation. */
147
260
  runs: z
148
261
  .array(z.strictObject({
262
+ /** Identity of the recorded run. */
149
263
  runId: id,
264
+ /** Workflow selected by the run. */
150
265
  workflowId: workflowIdSchema,
266
+ /** Exact published commit used by the run. */
151
267
  commit: z.string(),
268
+ /** Origin category recorded at admission. */
152
269
  source: workflowRunSourceSchema,
270
+ /** Published trigger that initiated the run, when applicable. */
153
271
  triggerId: id.optional(),
272
+ /** Host-admitted initiating principal and grantor. */
154
273
  initiatedBy: workflowRunInitiatedBySchema,
274
+ /** Run start timestamp. */
155
275
  startedAt: z.number(),
156
276
  }))
157
277
  .max(50),
158
278
  }),
159
279
  denied,
160
- ]);
161
- export const eventArmReplySchema = z.union([
162
- z.strictObject({ kind: z.literal("armed"), eventTriggerId: id }),
280
+ ]));
281
+ /** Event-trigger admission or its refusal details. */
282
+ export const eventArmReplySchema = z.lazy(() => z.union([
283
+ z.strictObject({
284
+ /** Event-trigger registration was armed. */
285
+ kind: z.literal("armed"),
286
+ /** Identity of the armed event registration. */
287
+ eventTriggerId: id,
288
+ }),
163
289
  z.strictObject({
290
+ /** Event-trigger registration was refused. */
164
291
  kind: z.literal("refused"),
292
+ /** Host-authored reason for the refusal. */
165
293
  reason: z.string(),
294
+ /** Optional validation issues associated with the trigger. */
166
295
  issues: z.array(z.json()).optional(),
167
296
  }),
168
297
  denied,
169
- ]);
170
- export const eventTriggersReplySchema = z.union([
298
+ ]));
299
+ /** Visible event-trigger rows with emitter, event and current state. */
300
+ export const eventTriggersReplySchema = z.lazy(() => z.union([
171
301
  z.strictObject({
302
+ /** Event-trigger registrations visible to this invocation. */
172
303
  eventTriggers: z.array(z.strictObject({
304
+ /** Identity of the event registration. */
173
305
  eventTriggerId: id,
306
+ /** Workflow whose published trigger was armed. */
174
307
  workflowId: workflowIdSchema,
308
+ /** Trigger identity within the published definition. */
175
309
  triggerId: id,
310
+ /** Installation supplying the subscribed event. */
176
311
  emitterInstallationId: id,
312
+ /** Declared event name. */
177
313
  event: id,
314
+ /** Current event registration state. */
178
315
  state: z.enum(["active", "paused"]),
316
+ /** Latest event-trigger failure, or null when absent. */
179
317
  lastError: z.string().nullable(),
180
318
  })),
181
319
  }),
182
320
  denied,
183
- ]);
321
+ ]));
@@ -1,6 +1,6 @@
1
1
  import { type WorkflowDefinition } from "@fungi.computer/braid";
2
2
  import type { PublishedDefinitionPort, WorkflowPublicationContext } from "@fungi.computer/braid/runtime";
3
- /** The slice of {@link WorkflowPublicationContext} this port actually reads. */
3
+ /** The installation identity and Git access read from the Workflow publication context. */
4
4
  export type WorkflowPublishedDefinitionContext = Pick<WorkflowPublicationContext, "installationId" | "git">;
5
5
  /**
6
6
  * How a host reads one published Workflow definition back out of Git. The
@@ -8,6 +8,7 @@ export type WorkflowPublishedDefinitionContext = Pick<WorkflowPublicationContext
8
8
  * port only wraps that read into the braid-shaped `PublishedDefinition`.
9
9
  */
10
10
  export type WorkflowPublishedReader = Readonly<{
11
+ /** Read an exact published version or commit, or null when absent. */
11
12
  published(workflowId: string, at: {
12
13
  version: number;
13
14
  } | {
@@ -0,0 +1,11 @@
1
+ import * as S from "effect/Schema";
2
+ /** A registered repository App as the host reports it to the calling installation:
3
+ * read-only identity from the source owner and the live caller. Hosts and Apps
4
+ * share this wire; an App never imports the host package for it.
5
+ * Reading it neither registers a repository nor selects or runs a Computer. */
6
+ export declare const repositoryWorkflowSourceSchema: S.Struct<{
7
+ readonly appId: S.refine<import("@fungi.computer/puffball").AppId, S.String>;
8
+ readonly installationId: S.String;
9
+ readonly callerAppId: S.refine<import("@fungi.computer/puffball").AppId, S.String>;
10
+ readonly callerSourceRevision: S.refine<import("@fungi.computer/puffball").SourceRevision, S.String>;
11
+ }>;
@@ -0,0 +1,12 @@
1
+ import * as S from "effect/Schema";
2
+ import { appIdSchema, sourceRevisionSchema, } from "@fungi.computer/puffball/effect";
3
+ /** A registered repository App as the host reports it to the calling installation:
4
+ * read-only identity from the source owner and the live caller. Hosts and Apps
5
+ * share this wire; an App never imports the host package for it.
6
+ * Reading it neither registers a repository nor selects or runs a Computer. */
7
+ export const repositoryWorkflowSourceSchema = S.Struct({
8
+ appId: appIdSchema,
9
+ installationId: S.String.check(S.isMinLength(1), S.isMaxLength(256)),
10
+ callerAppId: appIdSchema,
11
+ callerSourceRevision: sourceRevisionSchema,
12
+ });
@@ -1,13 +1,13 @@
1
1
  import * as z from "zod";
2
2
  /** The App's `WORKFLOWS.runs` read, scoped to one Workflow when given. */
3
- export declare const runsInputSchema: z.ZodObject<{
3
+ export declare const runsInputSchema: z.ZodLazy<z.ZodObject<{
4
4
  workflowId: z.ZodOptional<z.ZodString>;
5
- }, z.core.$strict>;
5
+ }, z.core.$strict>>;
6
6
  /**
7
7
  * One listed run, from the stored source of truth plus the App's own copy of
8
8
  * the published document at `commit`; display metadata never comes from Git.
9
9
  */
10
- export declare const runListItemSchema: z.ZodObject<{
10
+ export declare const runListItemSchema: z.ZodLazy<z.ZodObject<{
11
11
  runId: z.ZodString;
12
12
  workflowId: z.ZodString;
13
13
  commit: z.ZodString;
@@ -22,7 +22,7 @@ export declare const runListItemSchema: z.ZodObject<{
22
22
  key: "key";
23
23
  }>;
24
24
  triggerId: z.ZodOptional<z.ZodString>;
25
- initiatedBy: z.ZodUnion<readonly [z.ZodObject<{
25
+ initiatedBy: z.ZodLazy<z.ZodUnion<readonly [z.ZodObject<{
26
26
  kind: z.ZodLiteral<"member">;
27
27
  memberId: z.ZodString;
28
28
  }, z.core.$strict>, z.ZodObject<{
@@ -33,17 +33,19 @@ export declare const runListItemSchema: z.ZodObject<{
33
33
  kind: z.ZodLiteral<"key">;
34
34
  keyId: z.ZodString;
35
35
  grantorMemberId: z.ZodString;
36
- }, z.core.$strict>]>;
37
- }, z.core.$strict>;
36
+ }, z.core.$strict>]>>;
37
+ }, z.core.$strict>>;
38
+ /** Decoded run row with its pinned publication and display metadata. */
38
39
  export type WorkflowRunListItem = z.output<typeof runListItemSchema>;
39
40
  /**
40
41
  * The calling member's own id, so the Runs UI can tell its own runs from a
41
42
  * teammate's (an owner now sees every run in the installation, not only
42
43
  * their own) without guessing identity from the list itself.
43
44
  */
44
- export declare const viewerReplySchema: z.ZodUnion<readonly [z.ZodObject<{
45
+ export declare const viewerReplySchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodObject<{
45
46
  memberId: z.ZodString;
46
47
  }, z.core.$strict>, z.ZodObject<{
47
48
  error: z.ZodString;
48
- }, z.core.$strict>]>;
49
+ }, z.core.$strict>]>>;
50
+ /** Calling member identity, or a refusal returned by the viewer read. */
49
51
  export type ViewerReply = z.output<typeof viewerReplySchema>;
@@ -2,14 +2,14 @@ import * as z from "zod";
2
2
  import { workflowIdSchema } from "@fungi.computer/braid";
3
3
  import { workflowRunSourceSchema, workflowRunInitiatedBySchema, } from "./outcomes.js";
4
4
  /** The App's `WORKFLOWS.runs` read, scoped to one Workflow when given. */
5
- export const runsInputSchema = z.strictObject({
5
+ export const runsInputSchema = z.lazy(() => z.strictObject({
6
6
  workflowId: workflowIdSchema.optional(),
7
- });
7
+ }));
8
8
  /**
9
9
  * One listed run, from the stored source of truth plus the App's own copy of
10
10
  * the published document at `commit`; display metadata never comes from Git.
11
11
  */
12
- export const runListItemSchema = z.strictObject({
12
+ export const runListItemSchema = z.lazy(() => z.strictObject({
13
13
  runId: z.string(),
14
14
  workflowId: workflowIdSchema,
15
15
  commit: z.string(),
@@ -19,13 +19,13 @@ export const runListItemSchema = z.strictObject({
19
19
  source: workflowRunSourceSchema,
20
20
  triggerId: z.string().optional(),
21
21
  initiatedBy: workflowRunInitiatedBySchema,
22
- });
22
+ }));
23
23
  /**
24
24
  * The calling member's own id, so the Runs UI can tell its own runs from a
25
25
  * teammate's (an owner now sees every run in the installation, not only
26
26
  * their own) without guessing identity from the list itself.
27
27
  */
28
- export const viewerReplySchema = z.union([
28
+ export const viewerReplySchema = z.lazy(() => z.union([
29
29
  z.strictObject({ memberId: z.string() }),
30
30
  z.strictObject({ error: z.string() }),
31
- ]);
31
+ ]));
@@ -4,9 +4,10 @@ export declare const runDeliverySchema: z.ZodObject<{
4
4
  agentId: z.ZodString;
5
5
  sessionId: z.ZodString;
6
6
  }, z.core.$strict>;
7
+ /** Agent and Session selected to receive run endings. */
7
8
  export type RunDelivery = z.output<typeof runDeliverySchema>;
8
9
  /** One chat the member may choose for run reports: an existing Agent Session. */
9
- export declare const chatsReplySchema: z.ZodUnion<readonly [z.ZodObject<{
10
+ export declare const chatsReplySchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodObject<{
10
11
  chats: z.ZodArray<z.ZodObject<{
11
12
  agentId: z.ZodString;
12
13
  sessionId: z.ZodString;
@@ -14,27 +15,31 @@ export declare const chatsReplySchema: z.ZodUnion<readonly [z.ZodObject<{
14
15
  }, z.core.$strict>>;
15
16
  }, z.core.$strict>, z.ZodObject<{
16
17
  error: z.ZodLiteral<"not_granted">;
17
- }, z.core.$strict>]>;
18
+ }, z.core.$strict>]>>;
18
19
  /** The published trigger supplies cadence or event matching; the host supplies authority scope. */
19
- export declare const triggerTargetSchema: z.ZodObject<{
20
+ export declare const triggerTargetSchema: z.ZodLazy<z.ZodObject<{
20
21
  workflowId: z.ZodString;
21
22
  commit: z.ZodString;
22
23
  triggerId: z.ZodString;
23
- bindings: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
24
+ bindings: z.ZodRecord<z.ZodLazy<z.ZodString>, z.ZodUnion<readonly [z.ZodString, z.ZodLazy<z.ZodObject<{
24
25
  kind: z.ZodLiteral<"team-source">;
25
- }, z.core.$strict>]>>;
26
+ }, z.core.$strict>>]>>;
26
27
  delivery: z.ZodOptional<z.ZodObject<{
27
28
  agentId: z.ZodString;
28
29
  sessionId: z.ZodString;
29
30
  }, z.core.$strict>>;
30
- }, z.core.$strict>;
31
+ }, z.core.$strict>>;
32
+ /** Identify the schedule-trigger registration to disarm. */
31
33
  export declare const scheduleDisarmInputSchema: z.ZodObject<{
32
34
  scheduleId: z.ZodString;
33
35
  }, z.core.$strict>;
36
+ /** Identify the event-trigger registration to disarm. */
34
37
  export declare const eventDisarmInputSchema: z.ZodObject<{
35
38
  eventTriggerId: z.ZodString;
36
39
  }, z.core.$strict>;
40
+ /** Trigger listing takes no caller-supplied filters. */
37
41
  export declare const triggerListInputSchema: z.ZodObject<{}, z.core.$strict>;
42
+ /** Published trigger, pinned commit, selected bindings and optional run delivery. */
38
43
  export type WorkflowTriggerTarget = z.output<typeof triggerTargetSchema>;
39
44
  /** Host binding input carries the App-owned immutable row digest, never caller input. */
40
45
  export type WorkflowTriggerArmTarget = WorkflowTriggerTarget & Readonly<{
@@ -6,22 +6,25 @@ const id = z.string().min(1).max(256);
6
6
  /** The Agent Session (chat) that receives the ending of every run it covers. */
7
7
  export const runDeliverySchema = z.strictObject({ agentId: id, sessionId: id });
8
8
  /** One chat the member may choose for run reports: an existing Agent Session. */
9
- export const chatsReplySchema = z.union([
9
+ export const chatsReplySchema = z.lazy(() => z.union([
10
10
  z.strictObject({
11
11
  chats: z
12
12
  .array(runDeliverySchema.extend({ title: z.string().max(4_096) }))
13
13
  .max(200),
14
14
  }),
15
15
  z.strictObject({ error: z.literal("not_granted") }),
16
- ]);
16
+ ]));
17
17
  /** The published trigger supplies cadence or event matching; the host supplies authority scope. */
18
- export const triggerTargetSchema = z.strictObject({
18
+ export const triggerTargetSchema = z.lazy(() => z.strictObject({
19
19
  workflowId: workflowIdSchema,
20
20
  commit: gitSha1Schema,
21
21
  triggerId: z.string().min(1).max(80),
22
22
  bindings: bindingsSelectionSchema,
23
23
  delivery: runDeliverySchema.optional(),
24
- });
24
+ }));
25
+ /** Identify the schedule-trigger registration to disarm. */
25
26
  export const scheduleDisarmInputSchema = z.strictObject({ scheduleId: id });
27
+ /** Identify the event-trigger registration to disarm. */
26
28
  export const eventDisarmInputSchema = z.strictObject({ eventTriggerId: id });
29
+ /** Trigger listing takes no caller-supplied filters. */
27
30
  export const triggerListInputSchema = z.strictObject({});
@@ -4,13 +4,14 @@ import * as S from "effect/Schema";
4
4
  /**
5
5
  * The read side of a Workflows library's Git layout, shared by the Workflows
6
6
  * App and the hosts that read its published definitions: one repository,
7
- * `workflows`, one `workflows/<id>.json` file per Workflow (its definition
7
+ * `trellis`, one `workflows/<id>.json` file per Workflow (its definition
8
8
  * plus `layout` and optional `provenance`), and one `<id>@v<n>` tag per
9
9
  * published version on `main`'s ancestry.
10
10
  */
11
11
  export declare const workflowLibraryRepository = "trellis";
12
12
  /** Where one Workflow's file lives in its library repository. */
13
13
  export declare const workflowFilePath: (id: string) => string;
14
+ /** Decode stored definition, node layout and optional import/fork provenance. */
14
15
  export declare const workflowDraftSchema: S.Struct<{
15
16
  readonly definition: S.Struct<{
16
17
  readonly format: S.Literal<"fungi.workflow/v1">;
@@ -60,6 +61,7 @@ export declare const workflowDraftSchema: S.Struct<{
60
61
  readonly id: S.String;
61
62
  readonly kind: S.Literal<"review">;
62
63
  readonly title: S.String;
64
+ readonly detail: S.optionalKey<S.String>;
63
65
  readonly show: S.$Array<S.Struct<{
64
66
  readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
65
67
  readonly port: S.String;
@@ -69,6 +71,7 @@ export declare const workflowDraftSchema: S.Struct<{
69
71
  readonly choices: S.optionalKey<S.$Array<S.Struct<{
70
72
  readonly id: S.String;
71
73
  readonly label: S.String;
74
+ readonly description: S.optionalKey<S.String>;
72
75
  }>>>;
73
76
  }>, S.Struct<{
74
77
  readonly id: S.String;
@@ -179,6 +182,7 @@ export declare const workflowDraftSchema: S.Struct<{
179
182
  readonly id: S.String;
180
183
  readonly kind: S.Literal<"review">;
181
184
  readonly title: S.String;
185
+ readonly detail: S.optionalKey<S.String>;
182
186
  readonly show: S.$Array<S.Struct<{
183
187
  readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
184
188
  readonly port: S.String;
@@ -188,6 +192,7 @@ export declare const workflowDraftSchema: S.Struct<{
188
192
  readonly choices: S.optionalKey<S.$Array<S.Struct<{
189
193
  readonly id: S.String;
190
194
  readonly label: S.String;
195
+ readonly description: S.optionalKey<S.String>;
191
196
  }>>>;
192
197
  }>, S.Struct<{
193
198
  readonly id: S.String;
@@ -269,8 +274,10 @@ export declare const workflowDraftSchema: S.Struct<{
269
274
  export type WorkflowDraft = typeof workflowDraftSchema.Type;
270
275
  /** A Workflow file's content at the commit it was read from. */
271
276
  export type WorkflowDocument = WorkflowDraft & {
277
+ /** Exact Git commit from which the document was read. */
272
278
  readonly commit: string;
273
279
  };
280
+ /** Read-only Git operations needed to traverse and decode library files. */
274
281
  export type WorkflowReadGit = Pick<GitBinding, "readCommit" | "readTree" | "readBlob">;
275
282
  /** Read the immediate Workflow directory without following symlinks or submodules. */
276
283
  export declare function workflowFiles(git: WorkflowReadGit, commit: string | null): Promise<Readonly<{
@@ -6,7 +6,7 @@ import { provenanceSchema } from "./library-contracts.js";
6
6
  /**
7
7
  * The read side of a Workflows library's Git layout, shared by the Workflows
8
8
  * App and the hosts that read its published definitions: one repository,
9
- * `workflows`, one `workflows/<id>.json` file per Workflow (its definition
9
+ * `trellis`, one `workflows/<id>.json` file per Workflow (its definition
10
10
  * plus `layout` and optional `provenance`), and one `<id>@v<n>` tag per
11
11
  * published version on `main`'s ancestry.
12
12
  */
@@ -16,6 +16,7 @@ const emptyTree = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
16
16
  /** Where one Workflow's file lives in its library repository. */
17
17
  export const workflowFilePath = (id) => `workflows/${workflowIdSchema.parse(id)}.json`;
18
18
  const layoutSchema = S.Record(S.String, S.Struct({ x: S.Finite, y: S.Finite }));
19
+ /** Decode stored definition, node layout and optional import/fork provenance. */
19
20
  export const workflowDraftSchema = S.Struct({
20
21
  definition: workflowDefinitionSchema,
21
22
  layout: layoutSchema,