@fungi.computer/workflows-wire 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +44 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/library-contracts.d.ts +501 -0
- package/dist/library-contracts.js +203 -0
- package/dist/outcomes.d.ts +294 -0
- package/dist/outcomes.js +183 -0
- package/dist/published-definition.d.ts +22 -0
- package/dist/published-definition.js +20 -0
- package/dist/run-contracts.d.ts +49 -0
- package/dist/run-contracts.js +31 -0
- package/dist/run-ids.d.ts +5 -0
- package/dist/run-ids.js +10 -0
- package/dist/trigger-contracts.d.ts +42 -0
- package/dist/trigger-contracts.js +27 -0
- package/dist/workflow-repository.d.ts +320 -0
- package/dist/workflow-repository.js +209 -0
- package/package.json +29 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type WorkflowDefinition } from "@fungi.computer/braid";
|
|
2
|
+
import type { PublishedDefinitionPort, WorkflowPublicationContext } from "@fungi.computer/braid/runtime";
|
|
3
|
+
/** The slice of {@link WorkflowPublicationContext} this port actually reads. */
|
|
4
|
+
export type WorkflowPublishedDefinitionContext = Pick<WorkflowPublicationContext, "installationId" | "git">;
|
|
5
|
+
/**
|
|
6
|
+
* How a host reads one published Workflow definition back out of Git. The
|
|
7
|
+
* Trellis App owns the Git layout (drafts, versions, the copy index); this
|
|
8
|
+
* port only wraps that read into the braid-shaped `PublishedDefinition`.
|
|
9
|
+
*/
|
|
10
|
+
export type WorkflowPublishedReader = Readonly<{
|
|
11
|
+
published(workflowId: string, at: {
|
|
12
|
+
version: number;
|
|
13
|
+
} | {
|
|
14
|
+
commit: string;
|
|
15
|
+
}): Promise<Readonly<{
|
|
16
|
+
definition: WorkflowDefinition;
|
|
17
|
+
commit: string;
|
|
18
|
+
version: number | null;
|
|
19
|
+
}> | null>;
|
|
20
|
+
}>;
|
|
21
|
+
/** Trigger arm verification uses current admitted Git; direct starts carry the App's original row. */
|
|
22
|
+
export declare function createWorkflowPublishedDefinitionPort(createReader: (git: WorkflowPublishedDefinitionContext["git"]) => WorkflowPublishedReader): PublishedDefinitionPort<WorkflowPublishedDefinitionContext>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { contentDigest } from "@fungi.computer/braid";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
/** Trigger arm verification uses current admitted Git; direct starts carry the App's original row. */
|
|
4
|
+
export function createWorkflowPublishedDefinitionPort(createReader) {
|
|
5
|
+
return {
|
|
6
|
+
async resolve({ git }, selector) {
|
|
7
|
+
const reader = createReader(git);
|
|
8
|
+
const published = await reader.published(selector.workflowId, selector);
|
|
9
|
+
return published === null
|
|
10
|
+
? null
|
|
11
|
+
: {
|
|
12
|
+
workflowId: selector.workflowId,
|
|
13
|
+
definition: published.definition,
|
|
14
|
+
commit: published.commit,
|
|
15
|
+
version: published.version,
|
|
16
|
+
digest: await contentDigest(Schema.decodeUnknownSync(Schema.Json)(published.definition)),
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
/** The App's `WORKFLOWS.runs` read, scoped to one Workflow when given. */
|
|
3
|
+
export declare const runsInputSchema: z.ZodLazy<z.ZodObject<{
|
|
4
|
+
workflowId: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, z.core.$strict>>;
|
|
6
|
+
/**
|
|
7
|
+
* One listed run, from the stored source of truth plus the App's own copy of
|
|
8
|
+
* the published document at `commit`; display metadata never comes from Git.
|
|
9
|
+
*/
|
|
10
|
+
export declare const runListItemSchema: z.ZodLazy<z.ZodObject<{
|
|
11
|
+
runId: z.ZodString;
|
|
12
|
+
workflowId: z.ZodString;
|
|
13
|
+
commit: z.ZodString;
|
|
14
|
+
version: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
startedAt: z.ZodNumber;
|
|
16
|
+
title: z.ZodNullable<z.ZodString>;
|
|
17
|
+
source: z.ZodEnum<{
|
|
18
|
+
manual: "manual";
|
|
19
|
+
schedule: "schedule";
|
|
20
|
+
event: "event";
|
|
21
|
+
agent: "agent";
|
|
22
|
+
key: "key";
|
|
23
|
+
}>;
|
|
24
|
+
triggerId: z.ZodOptional<z.ZodString>;
|
|
25
|
+
initiatedBy: z.ZodLazy<z.ZodUnion<readonly [z.ZodObject<{
|
|
26
|
+
kind: z.ZodLiteral<"member">;
|
|
27
|
+
memberId: z.ZodString;
|
|
28
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
29
|
+
kind: z.ZodLiteral<"agent">;
|
|
30
|
+
agentId: z.ZodString;
|
|
31
|
+
grantorMemberId: z.ZodString;
|
|
32
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
33
|
+
kind: z.ZodLiteral<"key">;
|
|
34
|
+
keyId: z.ZodString;
|
|
35
|
+
grantorMemberId: z.ZodString;
|
|
36
|
+
}, z.core.$strict>]>>;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
export type WorkflowRunListItem = z.output<typeof runListItemSchema>;
|
|
39
|
+
/**
|
|
40
|
+
* The calling member's own id, so the Runs UI can tell its own runs from a
|
|
41
|
+
* teammate's (an owner now sees every run in the installation, not only
|
|
42
|
+
* their own) without guessing identity from the list itself.
|
|
43
|
+
*/
|
|
44
|
+
export declare const viewerReplySchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodObject<{
|
|
45
|
+
memberId: z.ZodString;
|
|
46
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
47
|
+
error: z.ZodString;
|
|
48
|
+
}, z.core.$strict>]>>;
|
|
49
|
+
export type ViewerReply = z.output<typeof viewerReplySchema>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { workflowIdSchema } from "@fungi.computer/braid";
|
|
3
|
+
import { workflowRunSourceSchema, workflowRunInitiatedBySchema, } from "./outcomes.js";
|
|
4
|
+
/** The App's `WORKFLOWS.runs` read, scoped to one Workflow when given. */
|
|
5
|
+
export const runsInputSchema = z.lazy(() => z.strictObject({
|
|
6
|
+
workflowId: workflowIdSchema.optional(),
|
|
7
|
+
}));
|
|
8
|
+
/**
|
|
9
|
+
* One listed run, from the stored source of truth plus the App's own copy of
|
|
10
|
+
* the published document at `commit`; display metadata never comes from Git.
|
|
11
|
+
*/
|
|
12
|
+
export const runListItemSchema = z.lazy(() => z.strictObject({
|
|
13
|
+
runId: z.string(),
|
|
14
|
+
workflowId: workflowIdSchema,
|
|
15
|
+
commit: z.string(),
|
|
16
|
+
version: z.number().int().positive().nullable(),
|
|
17
|
+
startedAt: z.number(),
|
|
18
|
+
title: z.string().nullable(),
|
|
19
|
+
source: workflowRunSourceSchema,
|
|
20
|
+
triggerId: z.string().optional(),
|
|
21
|
+
initiatedBy: workflowRunInitiatedBySchema,
|
|
22
|
+
}));
|
|
23
|
+
/**
|
|
24
|
+
* The calling member's own id, so the Runs UI can tell its own runs from a
|
|
25
|
+
* teammate's (an owner now sees every run in the installation, not only
|
|
26
|
+
* their own) without guessing identity from the list itself.
|
|
27
|
+
*/
|
|
28
|
+
export const viewerReplySchema = z.lazy(() => z.union([
|
|
29
|
+
z.strictObject({ memberId: z.string() }),
|
|
30
|
+
z.strictObject({ error: z.string() }),
|
|
31
|
+
]));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Typed id codec for Workflow run requests: mint and validate
|
|
2
|
+
* `workflow_request_*` ids. Hosts derive run ids from the request. */
|
|
3
|
+
export declare const workflowRunRequestIds: Readonly<{
|
|
4
|
+
readonly request: import("@fungi.computer/cairn/id").IdCodec<"agar-workflow-run", "request", 1>;
|
|
5
|
+
}>;
|
package/dist/run-ids.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineIdFamily } from "@fungi.computer/cairn/id";
|
|
2
|
+
/** Typed id codec for Workflow run requests: mint and validate
|
|
3
|
+
* `workflow_request_*` ids. Hosts derive run ids from the request. */
|
|
4
|
+
export const workflowRunRequestIds = defineIdFamily({
|
|
5
|
+
family: "agar-workflow-run",
|
|
6
|
+
version: 1,
|
|
7
|
+
kinds: {
|
|
8
|
+
request: { prefix: "workflow_request" },
|
|
9
|
+
},
|
|
10
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
/** The Agent Session (chat) that receives the ending of every run it covers. */
|
|
3
|
+
export declare const runDeliverySchema: z.ZodObject<{
|
|
4
|
+
agentId: z.ZodString;
|
|
5
|
+
sessionId: z.ZodString;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export type RunDelivery = z.output<typeof runDeliverySchema>;
|
|
8
|
+
/** One chat the member may choose for run reports: an existing Agent Session. */
|
|
9
|
+
export declare const chatsReplySchema: z.ZodLazy<z.ZodUnion<readonly [z.ZodObject<{
|
|
10
|
+
chats: z.ZodArray<z.ZodObject<{
|
|
11
|
+
agentId: z.ZodString;
|
|
12
|
+
sessionId: z.ZodString;
|
|
13
|
+
title: z.ZodString;
|
|
14
|
+
}, z.core.$strict>>;
|
|
15
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
16
|
+
error: z.ZodLiteral<"not_granted">;
|
|
17
|
+
}, z.core.$strict>]>>;
|
|
18
|
+
/** The published trigger supplies cadence or event matching; the host supplies authority scope. */
|
|
19
|
+
export declare const triggerTargetSchema: z.ZodLazy<z.ZodObject<{
|
|
20
|
+
workflowId: z.ZodString;
|
|
21
|
+
commit: z.ZodString;
|
|
22
|
+
triggerId: z.ZodString;
|
|
23
|
+
bindings: z.ZodRecord<z.ZodLazy<z.ZodString>, z.ZodUnion<readonly [z.ZodString, z.ZodLazy<z.ZodObject<{
|
|
24
|
+
kind: z.ZodLiteral<"team-source">;
|
|
25
|
+
}, z.core.$strict>>]>>;
|
|
26
|
+
delivery: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
agentId: z.ZodString;
|
|
28
|
+
sessionId: z.ZodString;
|
|
29
|
+
}, z.core.$strict>>;
|
|
30
|
+
}, z.core.$strict>>;
|
|
31
|
+
export declare const scheduleDisarmInputSchema: z.ZodObject<{
|
|
32
|
+
scheduleId: z.ZodString;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export declare const eventDisarmInputSchema: z.ZodObject<{
|
|
35
|
+
eventTriggerId: z.ZodString;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
export declare const triggerListInputSchema: z.ZodObject<{}, z.core.$strict>;
|
|
38
|
+
export type WorkflowTriggerTarget = z.output<typeof triggerTargetSchema>;
|
|
39
|
+
/** Host binding input carries the App-owned immutable row digest, never caller input. */
|
|
40
|
+
export type WorkflowTriggerArmTarget = WorkflowTriggerTarget & Readonly<{
|
|
41
|
+
digest: string;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { bindingsSelectionSchema } from "@fungi.computer/braid/git-access";
|
|
3
|
+
import { gitSha1Schema } from "@fungi.computer/puffball/git-representation";
|
|
4
|
+
import { workflowIdSchema } from "@fungi.computer/braid";
|
|
5
|
+
const id = z.string().min(1).max(256);
|
|
6
|
+
/** The Agent Session (chat) that receives the ending of every run it covers. */
|
|
7
|
+
export const runDeliverySchema = z.strictObject({ agentId: id, sessionId: id });
|
|
8
|
+
/** One chat the member may choose for run reports: an existing Agent Session. */
|
|
9
|
+
export const chatsReplySchema = z.lazy(() => z.union([
|
|
10
|
+
z.strictObject({
|
|
11
|
+
chats: z
|
|
12
|
+
.array(runDeliverySchema.extend({ title: z.string().max(4_096) }))
|
|
13
|
+
.max(200),
|
|
14
|
+
}),
|
|
15
|
+
z.strictObject({ error: z.literal("not_granted") }),
|
|
16
|
+
]));
|
|
17
|
+
/** The published trigger supplies cadence or event matching; the host supplies authority scope. */
|
|
18
|
+
export const triggerTargetSchema = z.lazy(() => z.strictObject({
|
|
19
|
+
workflowId: workflowIdSchema,
|
|
20
|
+
commit: gitSha1Schema,
|
|
21
|
+
triggerId: z.string().min(1).max(80),
|
|
22
|
+
bindings: bindingsSelectionSchema,
|
|
23
|
+
delivery: runDeliverySchema.optional(),
|
|
24
|
+
}));
|
|
25
|
+
export const scheduleDisarmInputSchema = z.strictObject({ scheduleId: id });
|
|
26
|
+
export const eventDisarmInputSchema = z.strictObject({ eventTriggerId: id });
|
|
27
|
+
export const triggerListInputSchema = z.strictObject({});
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { type Issue } from "@fungi.computer/braid";
|
|
2
|
+
import type { GitBinding } from "@fungi.computer/agar/git";
|
|
3
|
+
import * as S from "effect/Schema";
|
|
4
|
+
/**
|
|
5
|
+
* The read side of a Workflows library's Git layout, shared by the Workflows
|
|
6
|
+
* App and the hosts that read its published definitions: one repository,
|
|
7
|
+
* `workflows`, one `workflows/<id>.json` file per Workflow (its definition
|
|
8
|
+
* plus `layout` and optional `provenance`), and one `<id>@v<n>` tag per
|
|
9
|
+
* published version on `main`'s ancestry.
|
|
10
|
+
*/
|
|
11
|
+
export declare const workflowLibraryRepository = "trellis";
|
|
12
|
+
/** Where one Workflow's file lives in its library repository. */
|
|
13
|
+
export declare const workflowFilePath: (id: string) => string;
|
|
14
|
+
export declare const workflowDraftSchema: S.Struct<{
|
|
15
|
+
readonly definition: S.Struct<{
|
|
16
|
+
readonly format: S.Literal<"fungi.workflow/v1">;
|
|
17
|
+
readonly title: S.String;
|
|
18
|
+
readonly description: S.optionalKey<S.String>;
|
|
19
|
+
readonly apps: S.$Record<S.String, S.Struct<{
|
|
20
|
+
readonly appId: S.String;
|
|
21
|
+
readonly role: S.optionalKey<S.String>;
|
|
22
|
+
}>>;
|
|
23
|
+
readonly subgraphs: S.optionalKey<S.$Record<S.String, S.Struct<{
|
|
24
|
+
readonly input: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
25
|
+
readonly nodes: S.$Array<S.Union<readonly [S.Struct<{
|
|
26
|
+
readonly id: S.String;
|
|
27
|
+
readonly kind: S.Literal<"code">;
|
|
28
|
+
readonly source: S.String;
|
|
29
|
+
readonly input: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
30
|
+
readonly output: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
31
|
+
readonly values: S.$Record<S.String, S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>;
|
|
32
|
+
}>, S.Struct<{
|
|
33
|
+
readonly id: S.String;
|
|
34
|
+
readonly kind: S.Literal<"app">;
|
|
35
|
+
readonly app: S.String;
|
|
36
|
+
readonly method: S.String;
|
|
37
|
+
readonly methodDigest: S.String;
|
|
38
|
+
readonly values: S.$Record<S.String, S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>;
|
|
39
|
+
readonly gitAccess: S.optionalKey<S.declare<{
|
|
40
|
+
binding: string;
|
|
41
|
+
repository: string;
|
|
42
|
+
branches: string[];
|
|
43
|
+
} | {
|
|
44
|
+
binding: string;
|
|
45
|
+
repository: string;
|
|
46
|
+
access: "read";
|
|
47
|
+
}, {
|
|
48
|
+
binding: string;
|
|
49
|
+
repository: string;
|
|
50
|
+
branches: string[];
|
|
51
|
+
} | {
|
|
52
|
+
binding: string;
|
|
53
|
+
repository: string;
|
|
54
|
+
access: "read";
|
|
55
|
+
}>>;
|
|
56
|
+
readonly retry: S.optionalKey<S.Struct<{
|
|
57
|
+
readonly attempts: S.Number;
|
|
58
|
+
}>>;
|
|
59
|
+
}>, S.Struct<{
|
|
60
|
+
readonly id: S.String;
|
|
61
|
+
readonly kind: S.Literal<"review">;
|
|
62
|
+
readonly title: S.String;
|
|
63
|
+
readonly detail: S.optionalKey<S.String>;
|
|
64
|
+
readonly show: S.$Array<S.Struct<{
|
|
65
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
66
|
+
readonly port: S.String;
|
|
67
|
+
}>>;
|
|
68
|
+
readonly reviewers: S.Literals<readonly ["runner", "owners"]>;
|
|
69
|
+
readonly timeout: S.Number;
|
|
70
|
+
readonly choices: S.optionalKey<S.$Array<S.Struct<{
|
|
71
|
+
readonly id: S.String;
|
|
72
|
+
readonly label: S.String;
|
|
73
|
+
readonly description: S.optionalKey<S.String>;
|
|
74
|
+
}>>>;
|
|
75
|
+
}>, S.Struct<{
|
|
76
|
+
readonly id: S.String;
|
|
77
|
+
readonly kind: S.Literal<"condition">;
|
|
78
|
+
readonly test: S.Codec<import("@fungi.computer/braid").Predicate, import("@fungi.computer/braid").Predicate, never, never>;
|
|
79
|
+
}>, S.Struct<{
|
|
80
|
+
readonly id: S.String;
|
|
81
|
+
readonly kind: S.Literal<"map">;
|
|
82
|
+
readonly over: S.Struct<{
|
|
83
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
84
|
+
readonly port: S.String;
|
|
85
|
+
}>;
|
|
86
|
+
readonly body: S.String;
|
|
87
|
+
readonly concurrency: S.Number;
|
|
88
|
+
readonly maxItems: S.Number;
|
|
89
|
+
}>, S.Struct<{
|
|
90
|
+
readonly id: S.String;
|
|
91
|
+
readonly kind: S.Literal<"repeat">;
|
|
92
|
+
readonly body: S.String;
|
|
93
|
+
readonly maxRounds: S.Number;
|
|
94
|
+
readonly until: S.Codec<import("@fungi.computer/braid").Predicate, import("@fungi.computer/braid").Predicate, never, never>;
|
|
95
|
+
}>, S.Struct<{
|
|
96
|
+
readonly id: S.String;
|
|
97
|
+
readonly kind: S.Literal<"wait">;
|
|
98
|
+
readonly for: S.Number;
|
|
99
|
+
}>, S.Struct<{
|
|
100
|
+
readonly id: S.String;
|
|
101
|
+
readonly kind: S.Literal<"transform">;
|
|
102
|
+
readonly fields: S.$Record<S.String, S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>;
|
|
103
|
+
}>]>>;
|
|
104
|
+
readonly edges: S.$Array<S.Struct<{
|
|
105
|
+
readonly from: S.Struct<{
|
|
106
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
107
|
+
readonly port: S.String;
|
|
108
|
+
}>;
|
|
109
|
+
readonly to: S.Struct<{
|
|
110
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
111
|
+
readonly port: S.String;
|
|
112
|
+
}>;
|
|
113
|
+
}>>;
|
|
114
|
+
readonly output: S.$Record<S.String, S.Struct<{
|
|
115
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
116
|
+
readonly port: S.String;
|
|
117
|
+
}>>;
|
|
118
|
+
}>>>;
|
|
119
|
+
readonly triggers: S.optionalKey<S.$Array<S.Union<readonly [S.Struct<{
|
|
120
|
+
readonly id: S.String;
|
|
121
|
+
readonly on: S.Literal<"webhook">;
|
|
122
|
+
readonly title: S.optionalKey<S.String>;
|
|
123
|
+
readonly when: S.optionalKey<S.Codec<import("@fungi.computer/braid").Predicate, import("@fungi.computer/braid").Predicate, never, never>>;
|
|
124
|
+
readonly input: S.optionalKey<S.$Record<S.String, S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>>;
|
|
125
|
+
}>, S.Struct<{
|
|
126
|
+
readonly id: S.String;
|
|
127
|
+
readonly on: S.Literal<"schedule">;
|
|
128
|
+
readonly title: S.optionalKey<S.String>;
|
|
129
|
+
readonly cron: S.Struct<{
|
|
130
|
+
readonly expression: S.String;
|
|
131
|
+
readonly timeZone: S.String;
|
|
132
|
+
}>;
|
|
133
|
+
readonly input: S.optionalKey<S.$Record<S.String, S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>>;
|
|
134
|
+
}>, S.Struct<{
|
|
135
|
+
readonly id: S.String;
|
|
136
|
+
readonly on: S.Literal<"event">;
|
|
137
|
+
readonly title: S.optionalKey<S.String>;
|
|
138
|
+
readonly app: S.String;
|
|
139
|
+
readonly event: S.String;
|
|
140
|
+
readonly eventDigest: S.String;
|
|
141
|
+
readonly when: S.optionalKey<S.Codec<import("@fungi.computer/braid").Predicate, import("@fungi.computer/braid").Predicate, never, never>>;
|
|
142
|
+
readonly input: S.optionalKey<S.$Record<S.String, S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>>;
|
|
143
|
+
readonly repository: S.optionalKey<S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>;
|
|
144
|
+
}>]>>>;
|
|
145
|
+
readonly input: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
146
|
+
readonly nodes: S.$Array<S.Union<readonly [S.Struct<{
|
|
147
|
+
readonly id: S.String;
|
|
148
|
+
readonly kind: S.Literal<"code">;
|
|
149
|
+
readonly source: S.String;
|
|
150
|
+
readonly input: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
151
|
+
readonly output: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
152
|
+
readonly values: S.$Record<S.String, S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>;
|
|
153
|
+
}>, S.Struct<{
|
|
154
|
+
readonly id: S.String;
|
|
155
|
+
readonly kind: S.Literal<"app">;
|
|
156
|
+
readonly app: S.String;
|
|
157
|
+
readonly method: S.String;
|
|
158
|
+
readonly methodDigest: S.String;
|
|
159
|
+
readonly values: S.$Record<S.String, S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>;
|
|
160
|
+
readonly gitAccess: S.optionalKey<S.declare<{
|
|
161
|
+
binding: string;
|
|
162
|
+
repository: string;
|
|
163
|
+
branches: string[];
|
|
164
|
+
} | {
|
|
165
|
+
binding: string;
|
|
166
|
+
repository: string;
|
|
167
|
+
access: "read";
|
|
168
|
+
}, {
|
|
169
|
+
binding: string;
|
|
170
|
+
repository: string;
|
|
171
|
+
branches: string[];
|
|
172
|
+
} | {
|
|
173
|
+
binding: string;
|
|
174
|
+
repository: string;
|
|
175
|
+
access: "read";
|
|
176
|
+
}>>;
|
|
177
|
+
readonly retry: S.optionalKey<S.Struct<{
|
|
178
|
+
readonly attempts: S.Number;
|
|
179
|
+
}>>;
|
|
180
|
+
}>, S.Struct<{
|
|
181
|
+
readonly id: S.String;
|
|
182
|
+
readonly kind: S.Literal<"review">;
|
|
183
|
+
readonly title: S.String;
|
|
184
|
+
readonly detail: S.optionalKey<S.String>;
|
|
185
|
+
readonly show: S.$Array<S.Struct<{
|
|
186
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
187
|
+
readonly port: S.String;
|
|
188
|
+
}>>;
|
|
189
|
+
readonly reviewers: S.Literals<readonly ["runner", "owners"]>;
|
|
190
|
+
readonly timeout: S.Number;
|
|
191
|
+
readonly choices: S.optionalKey<S.$Array<S.Struct<{
|
|
192
|
+
readonly id: S.String;
|
|
193
|
+
readonly label: S.String;
|
|
194
|
+
readonly description: S.optionalKey<S.String>;
|
|
195
|
+
}>>>;
|
|
196
|
+
}>, S.Struct<{
|
|
197
|
+
readonly id: S.String;
|
|
198
|
+
readonly kind: S.Literal<"condition">;
|
|
199
|
+
readonly test: S.Codec<import("@fungi.computer/braid").Predicate, import("@fungi.computer/braid").Predicate, never, never>;
|
|
200
|
+
}>, S.Struct<{
|
|
201
|
+
readonly id: S.String;
|
|
202
|
+
readonly kind: S.Literal<"map">;
|
|
203
|
+
readonly over: S.Struct<{
|
|
204
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
205
|
+
readonly port: S.String;
|
|
206
|
+
}>;
|
|
207
|
+
readonly body: S.String;
|
|
208
|
+
readonly concurrency: S.Number;
|
|
209
|
+
readonly maxItems: S.Number;
|
|
210
|
+
}>, S.Struct<{
|
|
211
|
+
readonly id: S.String;
|
|
212
|
+
readonly kind: S.Literal<"repeat">;
|
|
213
|
+
readonly body: S.String;
|
|
214
|
+
readonly maxRounds: S.Number;
|
|
215
|
+
readonly until: S.Codec<import("@fungi.computer/braid").Predicate, import("@fungi.computer/braid").Predicate, never, never>;
|
|
216
|
+
}>, S.Struct<{
|
|
217
|
+
readonly id: S.String;
|
|
218
|
+
readonly kind: S.Literal<"wait">;
|
|
219
|
+
readonly for: S.Number;
|
|
220
|
+
}>, S.Struct<{
|
|
221
|
+
readonly id: S.String;
|
|
222
|
+
readonly kind: S.Literal<"transform">;
|
|
223
|
+
readonly fields: S.$Record<S.String, S.Codec<import("@fungi.computer/braid").Mapping, import("@fungi.computer/braid").Mapping, never, never>>;
|
|
224
|
+
}>]>>;
|
|
225
|
+
readonly edges: S.$Array<S.Struct<{
|
|
226
|
+
readonly from: S.Struct<{
|
|
227
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
228
|
+
readonly port: S.String;
|
|
229
|
+
}>;
|
|
230
|
+
readonly to: S.Struct<{
|
|
231
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
232
|
+
readonly port: S.String;
|
|
233
|
+
}>;
|
|
234
|
+
}>>;
|
|
235
|
+
readonly output: S.$Record<S.String, S.Struct<{
|
|
236
|
+
readonly node: S.Union<readonly [S.String, S.Literals<readonly ["$input", "$item"]>]>;
|
|
237
|
+
readonly port: S.String;
|
|
238
|
+
}>>;
|
|
239
|
+
}>;
|
|
240
|
+
readonly layout: S.$Record<S.String, S.Struct<{
|
|
241
|
+
readonly x: S.Finite;
|
|
242
|
+
readonly y: S.Finite;
|
|
243
|
+
}>>;
|
|
244
|
+
readonly provenance: S.optionalKey<S.declare<{
|
|
245
|
+
kind: "import";
|
|
246
|
+
workflowId: string;
|
|
247
|
+
version: number;
|
|
248
|
+
commit: string;
|
|
249
|
+
sha256: string & {
|
|
250
|
+
readonly appReleaseKind: "Sha256Digest";
|
|
251
|
+
};
|
|
252
|
+
origin?: string | undefined;
|
|
253
|
+
} | {
|
|
254
|
+
kind: "fork";
|
|
255
|
+
workflowId: string;
|
|
256
|
+
commit: string;
|
|
257
|
+
}, {
|
|
258
|
+
kind: "import";
|
|
259
|
+
workflowId: string;
|
|
260
|
+
version: number;
|
|
261
|
+
commit: string;
|
|
262
|
+
sha256: string & {
|
|
263
|
+
readonly appReleaseKind: "Sha256Digest";
|
|
264
|
+
};
|
|
265
|
+
origin?: string | undefined;
|
|
266
|
+
} | {
|
|
267
|
+
kind: "fork";
|
|
268
|
+
workflowId: string;
|
|
269
|
+
commit: string;
|
|
270
|
+
}>>;
|
|
271
|
+
}>;
|
|
272
|
+
/** One Workflow file's decoded content. */
|
|
273
|
+
export type WorkflowDraft = typeof workflowDraftSchema.Type;
|
|
274
|
+
/** A Workflow file's content at the commit it was read from. */
|
|
275
|
+
export type WorkflowDocument = WorkflowDraft & {
|
|
276
|
+
readonly commit: string;
|
|
277
|
+
};
|
|
278
|
+
export type WorkflowReadGit = Pick<GitBinding, "readCommit" | "readTree" | "readBlob">;
|
|
279
|
+
/** Read the immediate Workflow directory without following symlinks or submodules. */
|
|
280
|
+
export declare function workflowFiles(git: WorkflowReadGit, commit: string | null): Promise<Readonly<{
|
|
281
|
+
name: string;
|
|
282
|
+
mode: string;
|
|
283
|
+
hash: string;
|
|
284
|
+
type: "blob" | "tree" | "commit";
|
|
285
|
+
}>[]>;
|
|
286
|
+
/** Changed Workflow IDs in one accepted ref update, including deletions and mode changes. */
|
|
287
|
+
export declare function changedWorkflowIds(git: WorkflowReadGit, before: string, after: string): Promise<string[]>;
|
|
288
|
+
/** Decode a pushed file separately from the admitted catalog's semantic validation. */
|
|
289
|
+
export declare function inspectWorkflowFile(git: WorkflowReadGit, workflowId: string, commit: string): Promise<{
|
|
290
|
+
kind: "missing";
|
|
291
|
+
} | {
|
|
292
|
+
kind: "valid";
|
|
293
|
+
draft: WorkflowDraft;
|
|
294
|
+
} | {
|
|
295
|
+
kind: "invalid";
|
|
296
|
+
issues: readonly Issue[];
|
|
297
|
+
}>;
|
|
298
|
+
/** One Workflow's file at `commit`, or null when it is absent or invalid. */
|
|
299
|
+
export declare function readWorkflowAt(git: WorkflowReadGit, workflowId: string, commit: string | null): Promise<WorkflowDocument | null>;
|
|
300
|
+
/** A Workflow's published versions, newest first, from its `<id>@v<n>` tags. */
|
|
301
|
+
export declare function versionRefs(workflowId: string, references: Awaited<ReturnType<GitBinding["refs"]>>): {
|
|
302
|
+
version: number;
|
|
303
|
+
commit: string;
|
|
304
|
+
}[];
|
|
305
|
+
/** Batched first-parent reads retain every merge parent; the caller owns its IO budget. */
|
|
306
|
+
export declare function workflowCommitIsAncestor(git: GitBinding, before: string, after: string): Promise<boolean>;
|
|
307
|
+
/** Each Git object read at most once while one listing runs. */
|
|
308
|
+
export declare function listingGit(git: GitBinding): WorkflowReadGit;
|
|
309
|
+
/**
|
|
310
|
+
* One published Workflow: a version tag, or a commit, on `main`'s ancestry.
|
|
311
|
+
* `copied` answers from a caller's own read copy of that commit when it has
|
|
312
|
+
* one; otherwise the file is read from Git within a bounded read budget.
|
|
313
|
+
*/
|
|
314
|
+
export declare function readPublishedWorkflow(git: GitBinding, workflowId: string, at: {
|
|
315
|
+
version: number;
|
|
316
|
+
} | {
|
|
317
|
+
commit: string;
|
|
318
|
+
}, copied?: (commit: string) => WorkflowDocument | null): Promise<(WorkflowDocument & {
|
|
319
|
+
readonly version: number | null;
|
|
320
|
+
}) | null>;
|