@shipfox/workflow-document 2.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shipfox
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,208 @@
1
+ # Workflow Document
2
+
3
+ Input shape for Shipfox workflow authoring.
4
+
5
+ ## What it does
6
+
7
+ - `workflowDocumentSchema` defines the accepted Zod shape for a workflow document.
8
+ - `parseWorkflowDocument` parses unknown input into a typed `WorkflowDocument`.
9
+ - `InvalidWorkflowDocumentError` reports invalid input with the original Zod error as `cause`.
10
+ - `WorkflowDocumentRunStepGate` describes the step `gate` block with `success`
11
+ and `on_failure`.
12
+ - A job step is either a **run step** (`run: <shell command>`) or an inline
13
+ **agent step** (`prompt`, with optional `model`, `harness`, `thinking`, and
14
+ `provider`).
15
+ A step carries one or the other, never both.
16
+
17
+ Use this package where Shipfox accepts a workflow object from a file, tool, or
18
+ API call. It checks the shape only. It does not add defaults, pick runners,
19
+ check job links, save data, or run jobs.
20
+
21
+ Keep it near the edge of the system. If the value is good, pass it to the next
22
+ layer. If the value is bad, show the fields from the Zod error to the user.
23
+
24
+ ## Installation
25
+
26
+ ```sh
27
+ pnpm add @shipfox/workflow-document
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```ts
33
+ import {InvalidWorkflowDocumentError, parseWorkflowDocument} from '@shipfox/workflow-document';
34
+
35
+ try {
36
+ const document = parseWorkflowDocument({
37
+ name: 'simple build',
38
+ triggers: {
39
+ main_push: {
40
+ source: 'github_acme',
41
+ event: 'push',
42
+ filter: 'event.ref == "refs/heads/main"',
43
+ },
44
+ },
45
+ jobs: {
46
+ build: {
47
+ checkout: {
48
+ permissions: {contents: 'read'},
49
+ 'persist-credentials': true,
50
+ },
51
+ env: {NODE_ENV: 'test'},
52
+ runner: 'ubuntu-latest',
53
+ steps: [{run: 'npm run build', env: {CI: true}, gate: {success: 'step.exit_code == 0'}}],
54
+ },
55
+ },
56
+ });
57
+
58
+ document.jobs.build.steps[0]?.run; // "npm run build"
59
+ } catch (error) {
60
+ if (error instanceof InvalidWorkflowDocumentError) {
61
+ error.code; // "invalid-workflow-document"
62
+ error.validationError.issues; // Zod issues for presentation boundaries
63
+ }
64
+
65
+ throw error;
66
+ }
67
+ ```
68
+
69
+ A step can also be an inline agent step. It declares a `prompt` and no `run`.
70
+ `model`, `harness`, `thinking`, `provider`, `tools`, and `integrations` are optional
71
+ authoring hints; later layers resolve omitted values before the runner executes
72
+ the step. The `provider` names the model's provider (for example `anthropic` or
73
+ `openai`); pairing it with `model` lets a step target a non-default
74
+ provider/model pair. The recommended pattern is an agent step that produces a
75
+ change, followed by a `run` step whose `gate` judges the result:
76
+
77
+ ```ts
78
+ parseWorkflowDocument({
79
+ name: 'agent build',
80
+ jobs: {
81
+ fix: {
82
+ steps: [
83
+ {prompt: 'Fix the failing tests.'},
84
+ {model: 'gpt-5.5-pro', provider: 'openai', prompt: 'Review the fix.'},
85
+ {run: 'npm test', gate: {success: 'step.exit_code == 0'}},
86
+ ],
87
+ },
88
+ },
89
+ });
90
+ ```
91
+
92
+ Integration tools are selected with an `integrations` block on an agent step.
93
+ This package validates the shape only: non-empty selections, optional connection
94
+ and boolean write opt-in. Catalog checks, wildcard expansion, connection lookup,
95
+ and write-safety rules belong to later layers.
96
+
97
+ ```ts
98
+ parseWorkflowDocument({
99
+ name: 'triage',
100
+ jobs: {
101
+ inspect: {
102
+ steps: [
103
+ {
104
+ harness: 'claude',
105
+ tools: ['Read', 'Grep'],
106
+ prompt: 'Triage the pull request and comment with the next action.',
107
+ integrations: [
108
+ {
109
+ connection: 'github-main',
110
+ include: ['issue_read.get', 'pull_request_read.get_files'],
111
+ exclude: ['actions_run_trigger.run_workflow'],
112
+ allow_write: false,
113
+ },
114
+ ],
115
+ },
116
+ ],
117
+ },
118
+ },
119
+ });
120
+ ```
121
+
122
+ Jobs may also declare checkout intent. `permissions.contents` accepts `read` or
123
+ `write`; `persist-credentials` accepts a boolean. Both fields are optional in
124
+ the document shape. Later layers resolve omitted values to read-only checkout
125
+ with persisted credentials enabled.
126
+
127
+ ```ts
128
+ parseWorkflowDocument({
129
+ name: 'release',
130
+ jobs: {
131
+ publish: {
132
+ checkout: {
133
+ permissions: {contents: 'write'},
134
+ 'persist-credentials': false,
135
+ },
136
+ steps: [{run: 'pnpm release'}],
137
+ },
138
+ },
139
+ });
140
+ ```
141
+
142
+ ## Behavior Notes
143
+
144
+ - The public contract is the Zod schema and the TypeScript types built from it.
145
+ - Bad input throws a typed `Error`; UI or API code can read `validationError.issues` for field details.
146
+ - The `checkout` block is checked as input shape here. Default resolution,
147
+ permission capping, credential minting, and runner checkout behavior belong to
148
+ later layers.
149
+ - The `gate` block is checked as input shape here. CEL parsing and restart
150
+ target checks belong to definitions-owned model code.
151
+ - A step is discriminated by which keys it carries: `run` marks a run step;
152
+ `prompt`, `model`, `harness`, `thinking`, `provider`, `tools`, or
153
+ `integrations` mark an agent step, and an agent step must include `prompt`.
154
+ Declaring run and agent fields together, or neither kind, is rejected.
155
+ `model`, `harness`, `thinking`, `provider`, `tools`, and `integrations` are
156
+ valid only on an agent step; using them on a run step is rejected. `thinking`
157
+ is validated against a fixed set (`off`, `minimal`, `low`, `medium`, `high`,
158
+ `xhigh`). Provider, model, tool, integration connection, and integration
159
+ catalog checks belong to the model layer, not this parser. The `agent` key is
160
+ reserved for a future step kind and is rejected today.
161
+ - `env` can be declared on the workflow, a job, or a run step. Values may be
162
+ strings, numbers, or booleans; the model layer stringifies numbers and
163
+ booleans before a run is saved. Values are literal. Expression interpolation
164
+ such as `${{ ... }}` is not evaluated.
165
+ - Each `env` map can define up to 128 entries and must serialize to 32768 bytes
166
+ or less as JSON. The limit is checked separately at workflow, job, and run-step
167
+ scope before the model layer copies merged env into saved run-step config.
168
+ - `env` applies only to run steps. Declaring `env` directly on an agent step is
169
+ rejected. Workflow-level and job-level `env` is not applied to agent steps.
170
+ - Run-step env is plaintext, non-secret configuration. Values are stored in the
171
+ committed workflow file and in the saved step config, and they are not masked.
172
+ Do not put secrets in `env`.
173
+ - Env precedence is workflow, then job, then step; the nearest scope wins. A run
174
+ step inherits the runner process environment, and workflow env can override
175
+ names such as `PATH` for that subprocess. This is within the run-step trust
176
+ boundary because the workflow author already controls the shell script.
177
+ - There is no unset syntax. `env: {}` does not remove inherited variables, and
178
+ `FOO: ""` sets `FOO` to an empty string.
179
+ - Rules that need a project, user, runner, database row, or saved state belong
180
+ outside this package.
181
+
182
+ This package answers one question: does this value have the right fields. The
183
+ next layer can then decide what those fields mean. Keeping that split clear
184
+ makes errors easier to show and tests easier to read.
185
+
186
+ A file can come from a person, a tool, or a form. This part checks it before any
187
+ other part uses it. Good data moves on. Bad data stops close to where it came
188
+ from. That gives the caller a clear place to show what must change.
189
+
190
+ This keeps the first step fast and easy to use. It also lets later code work
191
+ with a value that has already passed the basic shape check.
192
+
193
+ Use it at the start of a flow. Do not wait until save time. The sooner this
194
+ part runs, the easier it is to tell the caller what is wrong and ask for a
195
+ small fix.
196
+
197
+ ## Development
198
+
199
+ ```sh
200
+ turbo build --filter=@shipfox/workflow-document
201
+ turbo check --filter=@shipfox/workflow-document
202
+ turbo type --filter=@shipfox/workflow-document
203
+ turbo test --filter=@shipfox/workflow-document
204
+ ```
205
+
206
+ ## License
207
+
208
+ MIT
@@ -0,0 +1,4 @@
1
+ export { type AgentThinking, agentThinkingByHarness, agentThinkingSchema, claudeAgentThinkingSchema, DEFAULT_AGENT_THINKING, DEFAULT_HARNESS, DEFAULT_MODEL_PROVIDER, type Harness, harnessSchema, piAgentThinkingSchema, thinkingLevelsForHarness, } from './step-enums.js';
2
+ export { triggerSourceConfigSchemas, WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES, WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES, WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH, WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES, WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES, type WorkflowDocument, type WorkflowDocumentEnv, type WorkflowDocumentJob, type WorkflowDocumentJobCheckout, type WorkflowDocumentRunStepGate, type WorkflowDocumentStep, type WorkflowDocumentStepIntegration, type WorkflowDocumentStepOutputs, type WorkflowDocumentStepOutputType, type WorkflowDocumentTrigger, workflowDocumentCheckoutSchema, workflowDocumentEnvSchema, workflowDocumentJobSchema, workflowDocumentSchema, workflowDocumentStepIntegrationSchema, workflowDocumentStepIntegrationSelectionSchema, workflowDocumentStepOutputsSchema, workflowDocumentStepOutputTypes, workflowDocumentStepSchema, workflowDocumentTriggerSchema, } from './workflow-document.js';
3
+ export { InvalidWorkflowDocumentError, invalidWorkflowDocumentErrorCode, parseWorkflowDocument, } from './workflow-document-parser.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,KAAK,OAAO,EACZ,aAAa,EACb,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,0BAA0B,EAC1B,iCAAiC,EACjC,0CAA0C,EAC1C,8CAA8C,EAC9C,yDAAyD,EACzD,0CAA0C,EAC1C,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,uBAAuB,EAC5B,8BAA8B,EAC9B,yBAAyB,EACzB,yBAAyB,EACzB,sBAAsB,EACtB,qCAAqC,EACrC,8CAA8C,EAC9C,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,qBAAqB,GACtB,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { agentThinkingByHarness, agentThinkingSchema, claudeAgentThinkingSchema, DEFAULT_AGENT_THINKING, DEFAULT_HARNESS, DEFAULT_MODEL_PROVIDER, harnessSchema, piAgentThinkingSchema, thinkingLevelsForHarness } from './step-enums.js';
2
+ export { triggerSourceConfigSchemas, WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES, WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES, WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH, WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES, WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES, workflowDocumentCheckoutSchema, workflowDocumentEnvSchema, workflowDocumentJobSchema, workflowDocumentSchema, workflowDocumentStepIntegrationSchema, workflowDocumentStepIntegrationSelectionSchema, workflowDocumentStepOutputsSchema, workflowDocumentStepOutputTypes, workflowDocumentStepSchema, workflowDocumentTriggerSchema } from './workflow-document.js';
3
+ export { InvalidWorkflowDocumentError, invalidWorkflowDocumentErrorCode, parseWorkflowDocument } from './workflow-document-parser.js';
4
+
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/document/index.ts"],"sourcesContent":["export {\n type AgentThinking,\n agentThinkingByHarness,\n agentThinkingSchema,\n claudeAgentThinkingSchema,\n DEFAULT_AGENT_THINKING,\n DEFAULT_HARNESS,\n DEFAULT_MODEL_PROVIDER,\n type Harness,\n harnessSchema,\n piAgentThinkingSchema,\n thinkingLevelsForHarness,\n} from './step-enums.js';\nexport {\n triggerSourceConfigSchemas,\n WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES,\n WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES,\n WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH,\n WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES,\n WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES,\n type WorkflowDocument,\n type WorkflowDocumentEnv,\n type WorkflowDocumentJob,\n type WorkflowDocumentJobCheckout,\n type WorkflowDocumentRunStepGate,\n type WorkflowDocumentStep,\n type WorkflowDocumentStepIntegration,\n type WorkflowDocumentStepOutputs,\n type WorkflowDocumentStepOutputType,\n type WorkflowDocumentTrigger,\n workflowDocumentCheckoutSchema,\n workflowDocumentEnvSchema,\n workflowDocumentJobSchema,\n workflowDocumentSchema,\n workflowDocumentStepIntegrationSchema,\n workflowDocumentStepIntegrationSelectionSchema,\n workflowDocumentStepOutputsSchema,\n workflowDocumentStepOutputTypes,\n workflowDocumentStepSchema,\n workflowDocumentTriggerSchema,\n} from './workflow-document.js';\nexport {\n InvalidWorkflowDocumentError,\n invalidWorkflowDocumentErrorCode,\n parseWorkflowDocument,\n} from './workflow-document-parser.js';\n"],"names":["agentThinkingByHarness","agentThinkingSchema","claudeAgentThinkingSchema","DEFAULT_AGENT_THINKING","DEFAULT_HARNESS","DEFAULT_MODEL_PROVIDER","harnessSchema","piAgentThinkingSchema","thinkingLevelsForHarness","triggerSourceConfigSchemas","WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES","WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES","WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH","WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES","WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES","workflowDocumentCheckoutSchema","workflowDocumentEnvSchema","workflowDocumentJobSchema","workflowDocumentSchema","workflowDocumentStepIntegrationSchema","workflowDocumentStepIntegrationSelectionSchema","workflowDocumentStepOutputsSchema","workflowDocumentStepOutputTypes","workflowDocumentStepSchema","workflowDocumentTriggerSchema","InvalidWorkflowDocumentError","invalidWorkflowDocumentErrorCode","parseWorkflowDocument"],"mappings":"AAAA,SAEEA,sBAAsB,EACtBC,mBAAmB,EACnBC,yBAAyB,EACzBC,sBAAsB,EACtBC,eAAe,EACfC,sBAAsB,EAEtBC,aAAa,EACbC,qBAAqB,EACrBC,wBAAwB,QACnB,kBAAkB;AACzB,SACEC,0BAA0B,EAC1BC,iCAAiC,EACjCC,0CAA0C,EAC1CC,8CAA8C,EAC9CC,yDAAyD,EACzDC,0CAA0C,EAW1CC,8BAA8B,EAC9BC,yBAAyB,EACzBC,yBAAyB,EACzBC,sBAAsB,EACtBC,qCAAqC,EACrCC,8CAA8C,EAC9CC,iCAAiC,EACjCC,+BAA+B,EAC/BC,0BAA0B,EAC1BC,6BAA6B,QACxB,yBAAyB;AAChC,SACEC,4BAA4B,EAC5BC,gCAAgC,EAChCC,qBAAqB,QAChB,gCAAgC"}
@@ -0,0 +1,53 @@
1
+ import { z } from 'zod';
2
+ export declare const harnessSchema: z.ZodEnum<{
3
+ pi: "pi";
4
+ claude: "claude";
5
+ }>;
6
+ export type Harness = z.infer<typeof harnessSchema>;
7
+ export declare const DEFAULT_HARNESS: "pi";
8
+ export declare const piAgentThinkingSchema: z.ZodEnum<{
9
+ off: "off";
10
+ minimal: "minimal";
11
+ low: "low";
12
+ medium: "medium";
13
+ high: "high";
14
+ xhigh: "xhigh";
15
+ }>;
16
+ export declare const claudeAgentThinkingSchema: z.ZodEnum<{
17
+ low: "low";
18
+ medium: "medium";
19
+ high: "high";
20
+ xhigh: "xhigh";
21
+ max: "max";
22
+ }>;
23
+ export declare const agentThinkingSchema: z.ZodEnum<{
24
+ off: "off";
25
+ minimal: "minimal";
26
+ low: "low";
27
+ medium: "medium";
28
+ high: "high";
29
+ xhigh: "xhigh";
30
+ max: "max";
31
+ }>;
32
+ export type AgentThinking = z.infer<typeof agentThinkingSchema>;
33
+ export declare const DEFAULT_AGENT_THINKING: "xhigh";
34
+ export declare const agentThinkingByHarness: {
35
+ readonly pi: z.ZodEnum<{
36
+ off: "off";
37
+ minimal: "minimal";
38
+ low: "low";
39
+ medium: "medium";
40
+ high: "high";
41
+ xhigh: "xhigh";
42
+ }>;
43
+ readonly claude: z.ZodEnum<{
44
+ low: "low";
45
+ medium: "medium";
46
+ high: "high";
47
+ xhigh: "xhigh";
48
+ max: "max";
49
+ }>;
50
+ };
51
+ export declare function thinkingLevelsForHarness(harness: Harness): readonly AgentThinking[];
52
+ export declare const DEFAULT_MODEL_PROVIDER: "anthropic";
53
+ //# sourceMappingURL=step-enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-enums.d.ts","sourceRoot":"","sources":["../../src/document/step-enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,aAAa;;;EAA2B,CAAC;AACtD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,eAAO,MAAM,eAAe,MAAkC,CAAC;AAE/D,eAAO,MAAM,qBAAqB;;;;;;;EAA+D,CAAC;AAClG,eAAO,MAAM,yBAAyB;;;;;;EAAoD,CAAC;AAC3F,eAAO,MAAM,mBAAmB;;;;;;;;EAQ9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,sBAAsB,SAA2C,CAAC;AAE/E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;CAMlC,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,aAAa,EAAE,CAEnF;AAGD,eAAO,MAAM,sBAAsB,EAAG,WAAoB,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ export const harnessSchema = z.enum([
3
+ 'pi',
4
+ 'claude'
5
+ ]);
6
+ export const DEFAULT_HARNESS = 'pi';
7
+ export const piAgentThinkingSchema = z.enum([
8
+ 'off',
9
+ 'minimal',
10
+ 'low',
11
+ 'medium',
12
+ 'high',
13
+ 'xhigh'
14
+ ]);
15
+ export const claudeAgentThinkingSchema = z.enum([
16
+ 'low',
17
+ 'medium',
18
+ 'high',
19
+ 'xhigh',
20
+ 'max'
21
+ ]);
22
+ export const agentThinkingSchema = z.enum([
23
+ 'off',
24
+ 'minimal',
25
+ 'low',
26
+ 'medium',
27
+ 'high',
28
+ 'xhigh',
29
+ 'max'
30
+ ]);
31
+ export const DEFAULT_AGENT_THINKING = 'xhigh';
32
+ export const agentThinkingByHarness = {
33
+ pi: piAgentThinkingSchema,
34
+ claude: claudeAgentThinkingSchema
35
+ };
36
+ export function thinkingLevelsForHarness(harness) {
37
+ return agentThinkingByHarness[harness].options;
38
+ }
39
+ // Used by later resolution layers when no workspace or instance provider is configured.
40
+ export const DEFAULT_MODEL_PROVIDER = 'anthropic';
41
+
42
+ //# sourceMappingURL=step-enums.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/document/step-enums.ts"],"sourcesContent":["import {z} from 'zod';\n\nexport const harnessSchema = z.enum(['pi', 'claude']);\nexport type Harness = z.infer<typeof harnessSchema>;\nexport const DEFAULT_HARNESS = 'pi' as const satisfies Harness;\n\nexport const piAgentThinkingSchema = z.enum(['off', 'minimal', 'low', 'medium', 'high', 'xhigh']);\nexport const claudeAgentThinkingSchema = z.enum(['low', 'medium', 'high', 'xhigh', 'max']);\nexport const agentThinkingSchema = z.enum([\n 'off',\n 'minimal',\n 'low',\n 'medium',\n 'high',\n 'xhigh',\n 'max',\n]);\n\nexport type AgentThinking = z.infer<typeof agentThinkingSchema>;\n\nexport const DEFAULT_AGENT_THINKING = 'xhigh' as const satisfies AgentThinking;\n\nexport const agentThinkingByHarness = {\n pi: piAgentThinkingSchema,\n claude: claudeAgentThinkingSchema,\n} as const satisfies Record<\n Harness,\n typeof piAgentThinkingSchema | typeof claudeAgentThinkingSchema\n>;\n\nexport function thinkingLevelsForHarness(harness: Harness): readonly AgentThinking[] {\n return agentThinkingByHarness[harness].options;\n}\n\n// Used by later resolution layers when no workspace or instance provider is configured.\nexport const DEFAULT_MODEL_PROVIDER = 'anthropic' as const;\n"],"names":["z","harnessSchema","enum","DEFAULT_HARNESS","piAgentThinkingSchema","claudeAgentThinkingSchema","agentThinkingSchema","DEFAULT_AGENT_THINKING","agentThinkingByHarness","pi","claude","thinkingLevelsForHarness","harness","options","DEFAULT_MODEL_PROVIDER"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AAEtB,OAAO,MAAMC,gBAAgBD,EAAEE,IAAI,CAAC;IAAC;IAAM;CAAS,EAAE;AAEtD,OAAO,MAAMC,kBAAkB,KAAgC;AAE/D,OAAO,MAAMC,wBAAwBJ,EAAEE,IAAI,CAAC;IAAC;IAAO;IAAW;IAAO;IAAU;IAAQ;CAAQ,EAAE;AAClG,OAAO,MAAMG,4BAA4BL,EAAEE,IAAI,CAAC;IAAC;IAAO;IAAU;IAAQ;IAAS;CAAM,EAAE;AAC3F,OAAO,MAAMI,sBAAsBN,EAAEE,IAAI,CAAC;IACxC;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAIH,OAAO,MAAMK,yBAAyB,QAAyC;AAE/E,OAAO,MAAMC,yBAAyB;IACpCC,IAAIL;IACJM,QAAQL;AACV,EAGE;AAEF,OAAO,SAASM,yBAAyBC,OAAgB;IACvD,OAAOJ,sBAAsB,CAACI,QAAQ,CAACC,OAAO;AAChD;AAEA,wFAAwF;AACxF,OAAO,MAAMC,yBAAyB,YAAqB"}
@@ -0,0 +1,10 @@
1
+ import type { z } from 'zod';
2
+ import { type WorkflowDocument } from './workflow-document.js';
3
+ export declare const invalidWorkflowDocumentErrorCode = "invalid-workflow-document";
4
+ export declare class InvalidWorkflowDocumentError extends Error {
5
+ readonly code = "invalid-workflow-document";
6
+ readonly validationError: z.ZodError<WorkflowDocument>;
7
+ constructor(validationError: z.ZodError<WorkflowDocument>);
8
+ }
9
+ export declare function parseWorkflowDocument(input: unknown): WorkflowDocument;
10
+ //# sourceMappingURL=workflow-document-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-document-parser.d.ts","sourceRoot":"","sources":["../../src/document/workflow-document-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAC,KAAK,gBAAgB,EAAyB,MAAM,wBAAwB,CAAC;AAErF,eAAO,MAAM,gCAAgC,8BAA8B,CAAC;AAE5E,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,+BAAoC;IACjD,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;gBAE3C,eAAe,EAAE,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;CAK1D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAKtE"}
@@ -0,0 +1,18 @@
1
+ import { workflowDocumentSchema } from './workflow-document.js';
2
+ export const invalidWorkflowDocumentErrorCode = 'invalid-workflow-document';
3
+ export class InvalidWorkflowDocumentError extends Error {
4
+ constructor(validationError){
5
+ super('Invalid workflow document', {
6
+ cause: validationError
7
+ }), this.code = invalidWorkflowDocumentErrorCode;
8
+ this.name = 'InvalidWorkflowDocumentError';
9
+ this.validationError = validationError;
10
+ }
11
+ }
12
+ export function parseWorkflowDocument(input) {
13
+ const result = workflowDocumentSchema.safeParse(input);
14
+ if (result.success) return result.data;
15
+ throw new InvalidWorkflowDocumentError(result.error);
16
+ }
17
+
18
+ //# sourceMappingURL=workflow-document-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/document/workflow-document-parser.ts"],"sourcesContent":["import type {z} from 'zod';\nimport {type WorkflowDocument, workflowDocumentSchema} from './workflow-document.js';\n\nexport const invalidWorkflowDocumentErrorCode = 'invalid-workflow-document';\n\nexport class InvalidWorkflowDocumentError extends Error {\n readonly code = invalidWorkflowDocumentErrorCode;\n readonly validationError: z.ZodError<WorkflowDocument>;\n\n constructor(validationError: z.ZodError<WorkflowDocument>) {\n super('Invalid workflow document', {cause: validationError});\n this.name = 'InvalidWorkflowDocumentError';\n this.validationError = validationError;\n }\n}\n\nexport function parseWorkflowDocument(input: unknown): WorkflowDocument {\n const result = workflowDocumentSchema.safeParse(input);\n if (result.success) return result.data;\n\n throw new InvalidWorkflowDocumentError(result.error);\n}\n"],"names":["workflowDocumentSchema","invalidWorkflowDocumentErrorCode","InvalidWorkflowDocumentError","Error","validationError","cause","code","name","parseWorkflowDocument","input","result","safeParse","success","data","error"],"mappings":"AACA,SAA+BA,sBAAsB,QAAO,yBAAyB;AAErF,OAAO,MAAMC,mCAAmC,4BAA4B;AAE5E,OAAO,MAAMC,qCAAqCC;IAIhD,YAAYC,eAA6C,CAAE;QACzD,KAAK,CAAC,6BAA6B;YAACC,OAAOD;QAAe,SAJnDE,OAAOL;QAKd,IAAI,CAACM,IAAI,GAAG;QACZ,IAAI,CAACH,eAAe,GAAGA;IACzB;AACF;AAEA,OAAO,SAASI,sBAAsBC,KAAc;IAClD,MAAMC,SAASV,uBAAuBW,SAAS,CAACF;IAChD,IAAIC,OAAOE,OAAO,EAAE,OAAOF,OAAOG,IAAI;IAEtC,MAAM,IAAIX,6BAA6BQ,OAAOI,KAAK;AACrD"}