@shipfox/workflow-document 2.0.1 → 2.1.1

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.
@@ -1,4 +1,5 @@
1
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
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
3
  export { InvalidWorkflowDocumentError, invalidWorkflowDocumentErrorCode, parseWorkflowDocument, } from './workflow-document-parser.js';
4
+ export { type BuildWorkflowJsonSchemaOptions, buildWorkflowJsonSchema, } from './workflow-json-schema.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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;AACvC,OAAO,EACL,KAAK,8BAA8B,EACnC,uBAAuB,GACxB,MAAM,2BAA2B,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export { agentThinkingByHarness, agentThinkingSchema, claudeAgentThinkingSchema, DEFAULT_AGENT_THINKING, DEFAULT_HARNESS, DEFAULT_MODEL_PROVIDER, harnessSchema, piAgentThinkingSchema, thinkingLevelsForHarness } from './step-enums.js';
2
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
3
  export { InvalidWorkflowDocumentError, invalidWorkflowDocumentErrorCode, parseWorkflowDocument } from './workflow-document-parser.js';
4
+ export { buildWorkflowJsonSchema } from './workflow-json-schema.js';
4
5
 
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +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"}
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';\nexport {\n type BuildWorkflowJsonSchemaOptions,\n buildWorkflowJsonSchema,\n} from './workflow-json-schema.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","buildWorkflowJsonSchema"],"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;AACvC,SAEEC,uBAAuB,QAClB,4BAA4B"}
@@ -1 +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"}
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;;;EAGxB,CAAC;AACH,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;;;;;;;;EAK5B,CAAC;AAEL,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"}
@@ -2,7 +2,9 @@ import { z } from 'zod';
2
2
  export const harnessSchema = z.enum([
3
3
  'pi',
4
4
  'claude'
5
- ]);
5
+ ]).meta({
6
+ description: 'Agent harness. When omitted, Shipfox uses the workspace default harness, or `pi` when none is configured.'
7
+ });
6
8
  export const DEFAULT_HARNESS = 'pi';
7
9
  export const piAgentThinkingSchema = z.enum([
8
10
  'off',
@@ -27,7 +29,9 @@ export const agentThinkingSchema = z.enum([
27
29
  'high',
28
30
  'xhigh',
29
31
  'max'
30
- ]);
32
+ ]).meta({
33
+ description: 'Reasoning effort for an agent step. Supported values depend on the resolved harness. When omitted, Shipfox uses the provider default, or `xhigh` when none is configured.'
34
+ });
31
35
  export const DEFAULT_AGENT_THINKING = 'xhigh';
32
36
  export const agentThinkingByHarness = {
33
37
  pi: piAgentThinkingSchema,
@@ -1 +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"}
1
+ {"version":3,"sources":["../../src/document/step-enums.ts"],"sourcesContent":["import {z} from 'zod';\n\nexport const harnessSchema = z.enum(['pi', 'claude']).meta({\n description:\n 'Agent harness. When omitted, Shipfox uses the workspace default harness, or `pi` when none is configured.',\n});\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\n .enum(['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'])\n .meta({\n description:\n 'Reasoning effort for an agent step. Supported values depend on the resolved harness. When omitted, Shipfox uses the provider default, or `xhigh` when none is configured.',\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","meta","description","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,EAAEC,IAAI,CAAC;IACzDC,aACE;AACJ,GAAG;AAEH,OAAO,MAAMC,kBAAkB,KAAgC;AAE/D,OAAO,MAAMC,wBAAwBN,EAAEE,IAAI,CAAC;IAAC;IAAO;IAAW;IAAO;IAAU;IAAQ;CAAQ,EAAE;AAClG,OAAO,MAAMK,4BAA4BP,EAAEE,IAAI,CAAC;IAAC;IAAO;IAAU;IAAQ;IAAS;CAAM,EAAE;AAC3F,OAAO,MAAMM,sBAAsBR,EAChCE,IAAI,CAAC;IAAC;IAAO;IAAW;IAAO;IAAU;IAAQ;IAAS;CAAM,EAChEC,IAAI,CAAC;IACJC,aACE;AACJ,GAAG;AAIL,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"}
@@ -85,6 +85,7 @@ export declare const workflowDocumentStepIntegrationSchema: z.ZodObject<{
85
85
  exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
86
  allow_write: z.ZodOptional<z.ZodBoolean>;
87
87
  }, z.core.$strict>;
88
+ export declare const workflowDocumentAgentStepFields: readonly ["model", "prompt", "harness", "thinking", "provider", "tools", "integrations"];
88
89
  export declare const workflowDocumentStepSchema: z.ZodObject<{
89
90
  key: z.ZodOptional<z.ZodString>;
90
91
  if: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-document.d.ts","sourceRoot":"","sources":["../../src/document/workflow-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAetB,eAAO,MAAM,iCAAiC,MAAM,CAAC;AACrD,eAAO,MAAM,0CAA0C,QAAY,CAAC;AACpE,eAAO,MAAM,+BAA+B,kDAAmD,CAAC;AAChG,eAAO,MAAM,0CAA0C,MAAoC,CAAC;AAC5F,eAAO,MAAM,yDAAyD,QAC1B,CAAC;AAC7C,eAAO,MAAM,8CAA8C,KAAK,CAAC;AAIjE,eAAO,MAAM,yBAAyB,yFAkBlC,CAAC;AAuDL,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;qBAmB1C,CAAC;AASL,eAAO,MAAM,0BAA0B;;;;;CAKF,CAAC;AAItC,eAAO,MAAM,6BAA6B;;;;;;kBA2BtC,CAAC;AAEL,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkCjC,CAAC;AAEL,QAAA,MAAM,8BAA8B;;;;;;kBAYhC,CAAC;AAEL,eAAO,MAAM,8BAA8B;;;;;;;;kBAOzC,CAAC;AAEH,eAAO,MAAM,8CAA8C,yBAAoC,CAAC;AAEhG,eAAO,MAAM,qCAAqC;;;;;kBAKhD,C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IALIZED_BYTES} bytes.`
45
45
  });
46
46
  }
47
+ }).meta({
48
+ description: `Environment variables as string, number, or boolean values. Each map allows up to ${WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES} entries and ${WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES} serialized bytes.`
47
49
  });
48
50
  const workflowDocumentStepOutputKeyPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
49
- const workflowDocumentStepOutputTypeSchema = z.enum(workflowDocumentStepOutputTypes);
51
+ const workflowDocumentStepOutputTypeSchema = z.enum(workflowDocumentStepOutputTypes).meta({
52
+ description: 'Declared output type. Use `json` when the output has a JSON Schema.'
53
+ });
50
54
  const workflowDocumentStepOutputDeclarationSchema = z.union([
51
55
  workflowDocumentStepOutputTypeSchema.transform((type)=>({
52
56
  type
53
57
  })),
54
58
  z.strictObject({
55
59
  type: workflowDocumentStepOutputTypeSchema,
56
- schema: z.unknown().optional()
60
+ schema: z.unknown().optional().meta({
61
+ description: 'JSON Schema for a `json` output. It allows up to ' + WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES + ' serialized bytes and ' + WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH + ' nesting levels.'
62
+ })
57
63
  })
58
64
  ]).superRefine((declaration, ctx)=>{
59
65
  const schema = 'schema' in declaration ? declaration.schema : undefined;
@@ -117,23 +123,39 @@ export const workflowDocumentStepOutputsSchema = z.record(z.string(), workflowDo
117
123
  message: 'Output keys must be CEL identifiers.'
118
124
  });
119
125
  }
126
+ }).meta({
127
+ description: `Named step outputs. Keys must be CEL identifiers and each step allows up to ${WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES} declarations.`
120
128
  });
121
129
  const workflowDocumentTriggerBaseSchema = {
122
- source: z.string().min(1),
123
- with: z.record(z.string(), z.unknown()).optional(),
124
- filter: z.string().min(1).optional(),
125
- config: z.record(z.string(), z.unknown()).optional()
130
+ source: z.string().min(1).meta({
131
+ description: 'Integration connection slug or built-in trigger source. See [Trigger sources](/reference/trigger-sources).'
132
+ }),
133
+ with: z.record(z.string(), z.unknown()).optional().meta({
134
+ description: 'Provider-specific values used to match or configure the trigger. See [expressions](/reference/expressions#context-available).'
135
+ }),
136
+ filter: z.string().min(1).optional().meta({
137
+ description: 'CEL condition that filters matching events. It is not supported for `manual` or `cron` triggers. See [trigger filters](/reference/expressions#trigger-filters).'
138
+ }),
139
+ config: z.record(z.string(), z.unknown()).optional().meta({
140
+ description: 'Source-specific configuration. It is supported only for top-level triggers with a known built-in source. See [cron triggers](/reference/trigger-sources#cron).'
141
+ })
126
142
  };
127
143
  export const triggerSourceConfigSchemas = {
128
144
  cron: z.strictObject({
129
- schedule: z.string().min(1).optional(),
130
- timezone: z.string().min(1).optional()
145
+ schedule: z.string().min(1).optional().meta({
146
+ description: 'Cron expression that schedules the workflow.'
147
+ }),
148
+ timezone: z.string().min(1).optional().meta({
149
+ description: 'IANA time zone used to evaluate `schedule`.'
150
+ })
131
151
  })
132
152
  };
133
153
  const triggerSourceConfigSchemaRegistry = triggerSourceConfigSchemas;
134
154
  export const workflowDocumentTriggerSchema = z.strictObject({
135
155
  ...workflowDocumentTriggerBaseSchema,
136
- event: z.string().min(1)
156
+ event: z.string().min(1).meta({
157
+ description: 'Provider event name that starts the workflow.'
158
+ })
137
159
  }).superRefine((trigger, ctx)=>{
138
160
  if (trigger.config === undefined) return;
139
161
  const configSchema = triggerSourceConfigSchemaRegistry[trigger.source];
@@ -160,21 +182,39 @@ export const workflowDocumentTriggerSchema = z.strictObject({
160
182
  }
161
183
  });
162
184
  const workflowDocumentListeningSchema = z.strictObject({
163
- on: z.array(workflowDocumentTriggerSchema).min(1),
164
- until: z.array(workflowDocumentTriggerSchema).min(1).optional(),
165
- timeout: z.string().min(1).optional(),
166
- max_executions: z.number().int().positive().optional(),
185
+ on: z.array(workflowDocumentTriggerSchema).min(1).meta({
186
+ description: 'Events that start listening. Listening triggers cannot use `config`.'
187
+ }),
188
+ until: z.array(workflowDocumentTriggerSchema).min(1).optional().meta({
189
+ description: 'Events that resolve listening. Listening jobs need this, `timeout`, or `max_executions`; these triggers cannot use `config`.'
190
+ }),
191
+ timeout: z.string().min(1).optional().meta({
192
+ description: 'Maximum duration to listen before resolving. A listening job needs this, `until`, or `max_executions`.'
193
+ }),
194
+ max_executions: z.number().int().positive().optional().meta({
195
+ description: 'Maximum number of matching events before resolving. A listening job needs this, `until`, or `timeout`.'
196
+ }),
167
197
  batch: z.strictObject({
168
- debounce: z.string().min(1).optional(),
169
- max_size: z.number().int().positive().optional(),
170
- max_wait: z.string().min(1).optional()
198
+ debounce: z.string().min(1).optional().meta({
199
+ description: 'Quiet period to wait for more matching events before processing a batch.'
200
+ }),
201
+ max_size: z.number().int().positive().optional().meta({
202
+ description: 'Maximum number of matching events in one batch.'
203
+ }),
204
+ max_wait: z.string().min(1).optional().meta({
205
+ description: 'Maximum time to wait before processing a partial batch.'
206
+ })
171
207
  }).refine((value)=>value.debounce !== undefined || value.max_size !== undefined || value.max_wait !== undefined, {
172
208
  message: 'Expected debounce, max_size, or max_wait'
173
- }).optional(),
209
+ }).optional().meta({
210
+ description: 'Optional batching policy. Set at least one of `debounce`, `max_size`, or `max_wait`.'
211
+ }),
174
212
  on_resolve: z.enum([
175
213
  'finish',
176
214
  'cancel'
177
- ]).optional()
215
+ ]).optional().meta({
216
+ description: 'How the job resolves when its listening condition is met.'
217
+ })
178
218
  }).superRefine((listening, ctx)=>{
179
219
  for (const field of [
180
220
  'on',
@@ -196,11 +236,19 @@ const workflowDocumentListeningSchema = z.strictObject({
196
236
  }
197
237
  });
198
238
  const workflowDocumentStepGateSchema = z.strictObject({
199
- success: z.string().min(1).optional(),
239
+ success: z.string().min(1).optional().meta({
240
+ description: 'CEL expression that must evaluate to true for the step to succeed. See [gate outcomes](/understand/feedback-loops#gate-outcomes).'
241
+ }),
200
242
  on_failure: z.strictObject({
201
- restart_from: z.string().min(1),
202
- feedback: z.string().min(1).optional()
203
- }).optional()
243
+ restart_from: z.string().min(1).meta({
244
+ description: 'Key of an earlier step in the same job to restart from after a failed gate.'
245
+ }),
246
+ feedback: z.string().min(1).optional().meta({
247
+ description: 'Feedback supplied when the gate fails before restarting.'
248
+ })
249
+ }).optional().meta({
250
+ description: 'Restart behavior when the success gate fails. See [feedback loops](/understand/feedback-loops).'
251
+ })
204
252
  }).refine((value)=>value.success !== undefined || value.on_failure !== undefined, {
205
253
  message: 'Expected success or on_failure'
206
254
  });
@@ -209,17 +257,40 @@ export const workflowDocumentCheckoutSchema = z.strictObject({
209
257
  contents: z.enum([
210
258
  'read',
211
259
  'write'
212
- ]).optional()
213
- }).optional(),
214
- 'persist-credentials': z.boolean().optional()
260
+ ]).optional().meta({
261
+ description: 'Repository contents permission granted to checkout.'
262
+ })
263
+ }).optional().meta({
264
+ description: 'Repository permissions used during checkout.'
265
+ }),
266
+ 'persist-credentials': z.boolean().optional().meta({
267
+ description: 'Whether checkout credentials remain available to later run steps.'
268
+ })
215
269
  });
216
270
  export const workflowDocumentStepIntegrationSelectionSchema = z.array(z.string().min(1)).min(1);
217
271
  export const workflowDocumentStepIntegrationSchema = z.strictObject({
218
- connection: z.string().min(1).optional(),
219
- include: workflowDocumentStepIntegrationSelectionSchema,
220
- exclude: workflowDocumentStepIntegrationSelectionSchema.optional(),
221
- allow_write: z.boolean().optional()
272
+ connection: z.string().min(1).optional().meta({
273
+ description: 'Integration connection slug to use for these tools.'
274
+ }),
275
+ include: workflowDocumentStepIntegrationSelectionSchema.meta({
276
+ description: 'Tool selectors to make available to the agent.'
277
+ }),
278
+ exclude: workflowDocumentStepIntegrationSelectionSchema.optional().meta({
279
+ description: 'Tool selectors to remove from the included tools.'
280
+ }),
281
+ allow_write: z.boolean().optional().meta({
282
+ description: 'Allows write-capable integration tools. Omit or set false for read-only access.'
283
+ })
222
284
  });
285
+ export const workflowDocumentAgentStepFields = [
286
+ 'model',
287
+ 'prompt',
288
+ 'harness',
289
+ 'thinking',
290
+ 'provider',
291
+ 'tools',
292
+ 'integrations'
293
+ ];
223
294
  // A step is a run step (`run`) or an inline agent step (`prompt`), never
224
295
  // both. They share one strict object so an unknown key is still rejected; the
225
296
  // `superRefine` discriminates by which payload keys are present and emits one
@@ -227,21 +298,51 @@ export const workflowDocumentStepIntegrationSchema = z.strictObject({
227
298
  // errors at once). The `agent` keyword is declared only so the reserved-keyword
228
299
  // case produces a clear message instead of a generic "unrecognized key".
229
300
  export const workflowDocumentStepSchema = z.strictObject({
230
- key: z.string().min(1).optional(),
231
- if: z.string().min(1).optional(),
232
- name: z.string().min(1).optional(),
233
- run: z.string().min(1).optional(),
234
- model: z.string().min(1).optional(),
235
- prompt: z.string().min(1).optional(),
236
- harness: harnessSchema.optional(),
237
- thinking: agentThinkingSchema.optional(),
238
- provider: z.string().min(1).optional(),
239
- tools: z.array(z.string().min(1)).min(1).optional(),
240
- integrations: z.array(workflowDocumentStepIntegrationSchema).min(1).optional(),
241
- agent: z.unknown().optional(),
242
- gate: workflowDocumentStepGateSchema.optional(),
243
- env: workflowDocumentEnvSchema.optional(),
244
- outputs: workflowDocumentStepOutputsSchema.optional()
301
+ key: z.string().min(1).optional().meta({
302
+ description: 'Stable step key for dependencies and outputs.'
303
+ }),
304
+ if: z.string().min(1).optional().meta({
305
+ description: 'CEL condition wrapped in exactly one $' + '{{ }} interpolation. See [conditionals](/reference/expressions#conditionals-if).'
306
+ }),
307
+ name: z.string().min(1).optional().meta({
308
+ description: 'Human-readable step name.'
309
+ }),
310
+ run: z.string().min(1).optional().meta({
311
+ description: 'Shell command for a run step. Do not combine it with agent-only fields.'
312
+ }),
313
+ model: z.string().min(1).optional().meta({
314
+ description: 'Model ID for an agent step. It requires `prompt` and is not valid on a run step.'
315
+ }),
316
+ prompt: z.string().min(1).optional().meta({
317
+ description: 'Prompt for an agent step. It is required when any agent-only field is set.'
318
+ }),
319
+ harness: harnessSchema.optional().meta({
320
+ description: 'Agent harness. When omitted, Shipfox uses the workspace default harness, or `pi` when none is configured.'
321
+ }),
322
+ thinking: agentThinkingSchema.optional().meta({
323
+ description: 'Reasoning effort for an agent step. Supported values depend on the resolved harness. When omitted, Shipfox uses the provider default, or `xhigh` when none is configured.'
324
+ }),
325
+ provider: z.string().min(1).optional().meta({
326
+ description: 'Model provider ID for an agent step. It requires `prompt` and is not valid on a run step.'
327
+ }),
328
+ tools: z.array(z.string().min(1)).min(1).optional().meta({
329
+ description: 'Built-in tool IDs for an agent step. It requires `prompt` and is not valid on a run step.'
330
+ }),
331
+ integrations: z.array(workflowDocumentStepIntegrationSchema).min(1).optional().meta({
332
+ description: 'Integration tools available to an agent step. It requires `prompt` and is not valid on a run step. See [integration tools](/how-to/author-workflows/use-integration-tools).'
333
+ }),
334
+ agent: z.unknown().optional().meta({
335
+ description: 'Reserved keyword. It is rejected; use `prompt` to define an agent step.'
336
+ }),
337
+ gate: workflowDocumentStepGateSchema.optional().meta({
338
+ description: 'Success gate and optional restart behavior after the step runs.'
339
+ }),
340
+ env: workflowDocumentEnvSchema.optional().meta({
341
+ description: 'Environment variables for a run step. They are not valid on an agent step.'
342
+ }),
343
+ outputs: workflowDocumentStepOutputsSchema.optional().meta({
344
+ description: 'Named output declarations produced by this step.'
345
+ })
245
346
  }).superRefine((step, ctx)=>{
246
347
  if (step.agent !== undefined) {
247
348
  ctx.addIssue({
@@ -254,15 +355,7 @@ export const workflowDocumentStepSchema = z.strictObject({
254
355
  return;
255
356
  }
256
357
  if (step.run !== undefined) {
257
- for (const key of [
258
- 'model',
259
- 'prompt',
260
- 'harness',
261
- 'thinking',
262
- 'provider',
263
- 'tools',
264
- 'integrations'
265
- ]){
358
+ for (const key of workflowDocumentAgentStepFields){
266
359
  if (step[key] !== undefined) {
267
360
  ctx.addIssue({
268
361
  code: 'custom',
@@ -275,7 +368,7 @@ export const workflowDocumentStepSchema = z.strictObject({
275
368
  }
276
369
  return;
277
370
  }
278
- const isAgent = step.model !== undefined || step.prompt !== undefined || step.harness !== undefined || step.thinking !== undefined || step.provider !== undefined || step.tools !== undefined || step.integrations !== undefined;
371
+ const isAgent = workflowDocumentAgentStepFields.some((field)=>step[field] !== undefined);
279
372
  if (!isAgent) {
280
373
  ctx.addIssue({
281
374
  code: 'custom',
@@ -303,24 +396,56 @@ export const workflowDocumentStepSchema = z.strictObject({
303
396
  }
304
397
  });
305
398
  export const workflowDocumentJobSchema = z.strictObject({
306
- needs: stringOrStringArraySchema.optional(),
307
- if: z.string().min(1).optional(),
308
- runner: stringOrStringArraySchema.optional(),
309
- success: z.string().min(1).optional(),
310
- outputs: nonEmptyRecordSchema(z.string().min(1)).optional(),
311
- execution_timeout: z.string().min(1).optional(),
312
- checkout: workflowDocumentCheckoutSchema.optional(),
313
- listening: workflowDocumentListeningSchema.optional(),
314
- name: z.string().min(1).optional(),
315
- env: workflowDocumentEnvSchema.optional(),
316
- steps: z.array(workflowDocumentStepSchema).min(1)
399
+ needs: stringOrStringArraySchema.optional().meta({
400
+ description: 'Job key or keys that must complete before this job starts.'
401
+ }),
402
+ if: z.string().min(1).optional().meta({
403
+ description: 'CEL condition wrapped in exactly one $' + '{{ }} interpolation. See [conditionals](/reference/expressions#conditionals-if).'
404
+ }),
405
+ runner: stringOrStringArraySchema.optional().meta({
406
+ description: 'Runner label or ordered fallback labels for this job. See [runners and execution environments](/understand/runners-and-execution-environments).'
407
+ }),
408
+ success: z.string().min(1).optional().meta({
409
+ description: 'CEL expression that determines whether the job succeeds. See [job success](/reference/expressions#job-success-success).'
410
+ }),
411
+ outputs: nonEmptyRecordSchema(z.string().min(1)).optional().meta({
412
+ description: 'Named job outputs mapped from step values.'
413
+ }),
414
+ execution_timeout: z.string().min(1).optional().meta({
415
+ description: 'Maximum duration for one job execution.'
416
+ }),
417
+ checkout: workflowDocumentCheckoutSchema.optional().meta({
418
+ description: 'Checkout settings for repository content and credentials.'
419
+ }),
420
+ listening: workflowDocumentListeningSchema.optional().meta({
421
+ description: 'Event-listening configuration for this job. See [listening jobs](/understand/listening-jobs).'
422
+ }),
423
+ name: z.string().min(1).optional().meta({
424
+ description: 'Human-readable job name.'
425
+ }),
426
+ env: workflowDocumentEnvSchema.optional().meta({
427
+ description: 'Environment variables for run steps in this job. They do not apply to agent steps. See [secrets and variables](/reference/secrets-variables).'
428
+ }),
429
+ steps: z.array(workflowDocumentStepSchema).min(1).meta({
430
+ description: 'Ordered run or agent steps. Each job needs at least one step.'
431
+ })
317
432
  });
318
433
  export const workflowDocumentSchema = z.strictObject({
319
- name: z.string().min(1),
320
- runner: stringOrStringArraySchema.optional(),
321
- env: workflowDocumentEnvSchema.optional(),
322
- triggers: nonEmptyRecordSchema(workflowDocumentTriggerSchema).optional(),
323
- jobs: nonEmptyRecordSchema(workflowDocumentJobSchema)
434
+ name: z.string().min(1).meta({
435
+ description: 'Human-readable workflow name.'
436
+ }),
437
+ runner: stringOrStringArraySchema.optional().meta({
438
+ description: 'Default runner label or ordered fallback labels for run jobs. See [runners and execution environments](/understand/runners-and-execution-environments).'
439
+ }),
440
+ env: workflowDocumentEnvSchema.optional().meta({
441
+ description: 'Workflow-level environment variables for run steps. They do not apply to agent steps. See [secrets and variables](/reference/secrets-variables).'
442
+ }),
443
+ triggers: nonEmptyRecordSchema(workflowDocumentTriggerSchema).optional().meta({
444
+ description: 'Named events that start workflow runs. A workflow can have at most one `manual` trigger.'
445
+ }),
446
+ jobs: nonEmptyRecordSchema(workflowDocumentJobSchema).meta({
447
+ description: 'Named jobs that make up the workflow. At least one job is required.'
448
+ })
324
449
  });
325
450
  function maxJsonDepth(value) {
326
451
  if (value === null || typeof value !== 'object') return 0;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/document/workflow-document.ts"],"sourcesContent":["import {z} from 'zod';\nimport {agentThinkingSchema, harnessSchema} from './step-enums.js';\n\nconst stringOrStringArraySchema = z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]);\nconst nonEmptyRecordSchema = <ValueSchema extends z.ZodType>(valueSchema: ValueSchema) =>\n z\n .record(z.string().min(1), valueSchema)\n .refine((value) => Object.keys(value).length > 0, {message: 'Expected at least one entry'});\n\n// Runner shell steps execute on Unix shells, so workflow env names follow the\n// portable POSIX-style variable shape.\nconst envNameSchema = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);\nconst envStringValueSchema = z.string().refine((value) => !value.includes('\\u0000'), {\n message: 'Env string values cannot contain null bytes',\n});\nexport const WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES = 128;\nexport const WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES = 32 * 1024;\nexport const workflowDocumentStepOutputTypes = ['string', 'number', 'boolean', 'json'] as const;\nexport const WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES = WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES;\nexport const WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES =\n WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES;\nexport const WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH = 64;\n\nconst utf8Encoder = new TextEncoder();\n\nexport const workflowDocumentEnvSchema = z\n .record(envNameSchema, z.union([envStringValueSchema, z.number(), z.boolean()]))\n .superRefine((env, ctx) => {\n const entries = Object.keys(env).length;\n if (entries > WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES) {\n ctx.addIssue({\n code: 'custom',\n message: `Env cannot define more than ${WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES} entries.`,\n });\n }\n\n const serializedBytes = utf8Encoder.encode(JSON.stringify(env)).byteLength;\n if (serializedBytes > WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES) {\n ctx.addIssue({\n code: 'custom',\n message: `Env cannot serialize to more than ${WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES} bytes.`,\n });\n }\n });\n\nconst workflowDocumentStepOutputKeyPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\nconst workflowDocumentStepOutputTypeSchema = z.enum(workflowDocumentStepOutputTypes);\n\nconst workflowDocumentStepOutputDeclarationSchema = z\n .union([\n workflowDocumentStepOutputTypeSchema.transform((type) => ({type})),\n z.strictObject({\n type: workflowDocumentStepOutputTypeSchema,\n schema: z.unknown().optional(),\n }),\n ])\n .superRefine((declaration, ctx) => {\n const schema = 'schema' in declaration ? declaration.schema : undefined;\n if (declaration.type !== 'json' && schema !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['schema'],\n message: '`schema` is only supported for json outputs.',\n });\n return;\n }\n\n if (schema === undefined) return;\n\n if (!isJsonSchemaDocument(schema)) {\n ctx.addIssue({\n code: 'custom',\n path: ['schema'],\n message: 'Schema must be a valid JSON Schema document.',\n });\n return;\n }\n\n const serializedBytes = utf8Encoder.encode(JSON.stringify(schema)).byteLength;\n if (serializedBytes > WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES) {\n ctx.addIssue({\n code: 'custom',\n path: ['schema'],\n message: `Output JSON Schema cannot serialize to more than ${WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES} bytes.`,\n });\n }\n\n const depth = maxJsonDepth(schema);\n if (depth > WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH) {\n ctx.addIssue({\n code: 'custom',\n path: ['schema'],\n message: `Output JSON Schema cannot be nested deeper than ${WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH} levels.`,\n });\n }\n });\n\nexport const workflowDocumentStepOutputsSchema = z\n .record(z.string(), workflowDocumentStepOutputDeclarationSchema)\n .superRefine((outputs, ctx) => {\n const entries = Object.keys(outputs).length;\n if (entries > WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES) {\n ctx.addIssue({\n code: 'custom',\n message: `Step outputs cannot define more than ${WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES} entries.`,\n });\n }\n\n for (const key of Object.keys(outputs)) {\n if (workflowDocumentStepOutputKeyPattern.test(key)) continue;\n ctx.addIssue({\n code: 'custom',\n path: [key],\n message: 'Output keys must be CEL identifiers.',\n });\n }\n });\n\nconst workflowDocumentTriggerBaseSchema = {\n source: z.string().min(1),\n with: z.record(z.string(), z.unknown()).optional(),\n filter: z.string().min(1).optional(),\n config: z.record(z.string(), z.unknown()).optional(),\n} satisfies z.ZodRawShape;\n\nexport const triggerSourceConfigSchemas = {\n cron: z.strictObject({\n schedule: z.string().min(1).optional(),\n timezone: z.string().min(1).optional(),\n }),\n} satisfies Record<string, z.ZodType>;\nconst triggerSourceConfigSchemaRegistry: Readonly<Record<string, z.ZodType>> =\n triggerSourceConfigSchemas;\n\nexport const workflowDocumentTriggerSchema = z\n .strictObject({\n ...workflowDocumentTriggerBaseSchema,\n event: z.string().min(1),\n })\n .superRefine((trigger, ctx) => {\n if (trigger.config === undefined) return;\n\n const configSchema = triggerSourceConfigSchemaRegistry[trigger.source];\n if (configSchema === undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['config'],\n message: `\\`config\\` is not supported for source \\`${trigger.source}\\`.`,\n });\n return;\n }\n\n const configResult = configSchema.safeParse(trigger.config);\n if (configResult.success) return;\n\n for (const configIssue of configResult.error.issues) {\n ctx.addIssue({\n ...configIssue,\n path: ['config', ...configIssue.path],\n });\n }\n });\n\nconst workflowDocumentListeningSchema = z\n .strictObject({\n on: z.array(workflowDocumentTriggerSchema).min(1),\n until: z.array(workflowDocumentTriggerSchema).min(1).optional(),\n timeout: z.string().min(1).optional(),\n max_executions: z.number().int().positive().optional(),\n batch: z\n .strictObject({\n debounce: z.string().min(1).optional(),\n max_size: z.number().int().positive().optional(),\n max_wait: z.string().min(1).optional(),\n })\n .refine(\n (value) =>\n value.debounce !== undefined ||\n value.max_size !== undefined ||\n value.max_wait !== undefined,\n {message: 'Expected debounce, max_size, or max_wait'},\n )\n .optional(),\n on_resolve: z.enum(['finish', 'cancel']).optional(),\n })\n .superRefine((listening, ctx) => {\n for (const field of ['on', 'until'] as const) {\n for (const [index, trigger] of (listening[field] ?? []).entries()) {\n if (trigger.config !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: [field, index, 'config'],\n message: '`config` is only supported on top-level triggers.',\n });\n }\n }\n }\n });\n\nconst workflowDocumentStepGateSchema = z\n .strictObject({\n success: z.string().min(1).optional(),\n on_failure: z\n .strictObject({\n restart_from: z.string().min(1),\n feedback: z.string().min(1).optional(),\n })\n .optional(),\n })\n .refine((value) => value.success !== undefined || value.on_failure !== undefined, {\n message: 'Expected success or on_failure',\n });\n\nexport const workflowDocumentCheckoutSchema = z.strictObject({\n permissions: z\n .strictObject({\n contents: z.enum(['read', 'write']).optional(),\n })\n .optional(),\n 'persist-credentials': z.boolean().optional(),\n});\n\nexport const workflowDocumentStepIntegrationSelectionSchema = z.array(z.string().min(1)).min(1);\n\nexport const workflowDocumentStepIntegrationSchema = z.strictObject({\n connection: z.string().min(1).optional(),\n include: workflowDocumentStepIntegrationSelectionSchema,\n exclude: workflowDocumentStepIntegrationSelectionSchema.optional(),\n allow_write: z.boolean().optional(),\n});\n\n// A step is a run step (`run`) or an inline agent step (`prompt`), never\n// both. They share one strict object so an unknown key is still rejected; the\n// `superRefine` discriminates by which payload keys are present and emits one\n// targeted issue per failure mode (a plain union would surface every branch's\n// errors at once). The `agent` keyword is declared only so the reserved-keyword\n// case produces a clear message instead of a generic \"unrecognized key\".\nexport const workflowDocumentStepSchema = z\n .strictObject({\n key: z.string().min(1).optional(),\n if: z.string().min(1).optional(),\n name: z.string().min(1).optional(),\n run: z.string().min(1).optional(),\n model: z.string().min(1).optional(),\n prompt: z.string().min(1).optional(),\n harness: harnessSchema.optional(),\n thinking: agentThinkingSchema.optional(),\n provider: z.string().min(1).optional(),\n tools: z.array(z.string().min(1)).min(1).optional(),\n integrations: z.array(workflowDocumentStepIntegrationSchema).min(1).optional(),\n agent: z.unknown().optional(),\n gate: workflowDocumentStepGateSchema.optional(),\n env: workflowDocumentEnvSchema.optional(),\n outputs: workflowDocumentStepOutputsSchema.optional(),\n })\n .superRefine((step, ctx) => {\n if (step.agent !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['agent'],\n message: 'The \"agent\" keyword is reserved for a future step kind and is not supported yet.',\n });\n return;\n }\n\n if (step.run !== undefined) {\n for (const key of [\n 'model',\n 'prompt',\n 'harness',\n 'thinking',\n 'provider',\n 'tools',\n 'integrations',\n ] as const) {\n if (step[key] !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: [key],\n message: `\"${key}\" is not valid on a run step.`,\n });\n }\n }\n return;\n }\n\n const isAgent =\n step.model !== undefined ||\n step.prompt !== undefined ||\n step.harness !== undefined ||\n step.thinking !== undefined ||\n step.provider !== undefined ||\n step.tools !== undefined ||\n step.integrations !== undefined;\n\n if (!isAgent) {\n ctx.addIssue({\n code: 'custom',\n message: 'A step must define either \"run\" or an agent \"prompt\".',\n });\n return;\n }\n\n if (step.env !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['env'],\n message: '\"env\" is supported only on run steps.',\n });\n }\n if (step.prompt === undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['prompt'],\n message: 'An agent step requires \"prompt\".',\n });\n }\n });\n\nexport const workflowDocumentJobSchema = z.strictObject({\n needs: stringOrStringArraySchema.optional(),\n if: z.string().min(1).optional(),\n runner: stringOrStringArraySchema.optional(),\n success: z.string().min(1).optional(),\n outputs: nonEmptyRecordSchema(z.string().min(1)).optional(),\n execution_timeout: z.string().min(1).optional(),\n checkout: workflowDocumentCheckoutSchema.optional(),\n listening: workflowDocumentListeningSchema.optional(),\n name: z.string().min(1).optional(),\n env: workflowDocumentEnvSchema.optional(),\n steps: z.array(workflowDocumentStepSchema).min(1),\n});\n\nexport const workflowDocumentSchema = z.strictObject({\n name: z.string().min(1),\n runner: stringOrStringArraySchema.optional(),\n env: workflowDocumentEnvSchema.optional(),\n triggers: nonEmptyRecordSchema(workflowDocumentTriggerSchema).optional(),\n jobs: nonEmptyRecordSchema(workflowDocumentJobSchema),\n});\n\nexport type WorkflowDocument = z.infer<typeof workflowDocumentSchema>;\nexport type WorkflowDocumentJobCheckout = z.infer<typeof workflowDocumentCheckoutSchema>;\nexport type WorkflowDocumentEnv = z.infer<typeof workflowDocumentEnvSchema>;\nexport type WorkflowDocumentJob = z.infer<typeof workflowDocumentJobSchema>;\nexport type WorkflowDocumentJobListening = z.infer<typeof workflowDocumentListeningSchema>;\nexport type WorkflowDocumentRunStepGate = z.infer<typeof workflowDocumentStepGateSchema>;\nexport type WorkflowDocumentStepIntegration = z.infer<typeof workflowDocumentStepIntegrationSchema>;\nexport type WorkflowDocumentStepOutputType = (typeof workflowDocumentStepOutputTypes)[number];\nexport type WorkflowDocumentStepOutputs = z.infer<typeof workflowDocumentStepOutputsSchema>;\nexport type WorkflowDocumentStep = z.infer<typeof workflowDocumentStepSchema>;\nexport type WorkflowDocumentTrigger = z.infer<typeof workflowDocumentTriggerSchema>;\n\nfunction maxJsonDepth(value: unknown): number {\n if (value === null || typeof value !== 'object') return 0;\n if (Array.isArray(value)) {\n if (value.length === 0) return 1;\n return 1 + Math.max(...value.map(maxJsonDepth));\n }\n\n const entries = Object.values(value);\n if (entries.length === 0) return 1;\n return 1 + Math.max(...entries.map(maxJsonDepth));\n}\n\nfunction isJsonSchemaDocument(value: unknown): boolean {\n return (\n typeof value === 'boolean' ||\n (typeof value === 'object' && value !== null && !Array.isArray(value))\n );\n}\n"],"names":["z","agentThinkingSchema","harnessSchema","stringOrStringArraySchema","union","string","min","array","nonEmptyRecordSchema","valueSchema","record","refine","value","Object","keys","length","message","envNameSchema","regex","envStringValueSchema","includes","WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES","WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES","workflowDocumentStepOutputTypes","WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES","WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES","WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH","utf8Encoder","TextEncoder","workflowDocumentEnvSchema","number","boolean","superRefine","env","ctx","entries","addIssue","code","serializedBytes","encode","JSON","stringify","byteLength","workflowDocumentStepOutputKeyPattern","workflowDocumentStepOutputTypeSchema","enum","workflowDocumentStepOutputDeclarationSchema","transform","type","strictObject","schema","unknown","optional","declaration","undefined","path","isJsonSchemaDocument","depth","maxJsonDepth","workflowDocumentStepOutputsSchema","outputs","key","test","workflowDocumentTriggerBaseSchema","source","with","filter","config","triggerSourceConfigSchemas","cron","schedule","timezone","triggerSourceConfigSchemaRegistry","workflowDocumentTriggerSchema","event","trigger","configSchema","configResult","safeParse","success","configIssue","error","issues","workflowDocumentListeningSchema","on","until","timeout","max_executions","int","positive","batch","debounce","max_size","max_wait","on_resolve","listening","field","index","workflowDocumentStepGateSchema","on_failure","restart_from","feedback","workflowDocumentCheckoutSchema","permissions","contents","workflowDocumentStepIntegrationSelectionSchema","workflowDocumentStepIntegrationSchema","connection","include","exclude","allow_write","workflowDocumentStepSchema","if","name","run","model","prompt","harness","thinking","provider","tools","integrations","agent","gate","step","isAgent","workflowDocumentJobSchema","needs","runner","execution_timeout","checkout","steps","workflowDocumentSchema","triggers","jobs","Array","isArray","Math","max","map","values"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AACtB,SAAQC,mBAAmB,EAAEC,aAAa,QAAO,kBAAkB;AAEnE,MAAMC,4BAA4BH,EAAEI,KAAK,CAAC;IAACJ,EAAEK,MAAM,GAAGC,GAAG,CAAC;IAAIN,EAAEO,KAAK,CAACP,EAAEK,MAAM,GAAGC,GAAG,CAAC,IAAIA,GAAG,CAAC;CAAG;AAChG,MAAME,uBAAuB,CAAgCC,cAC3DT,EACGU,MAAM,CAACV,EAAEK,MAAM,GAAGC,GAAG,CAAC,IAAIG,aAC1BE,MAAM,CAAC,CAACC,QAAUC,OAAOC,IAAI,CAACF,OAAOG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Q;IAC7C8E,UAAU5B,+BAA+BlD,QAAQ;IACjD2C,WAAWZ,gCAAgC/B,QAAQ;IACnD6D,MAAMjH,EAAEK,MAAM,GAAGC,GAAG,CAAC,GAAG8C,QAAQ;IAChCnB,KAAKJ,0BAA0BuB,QAAQ;IACvC+E,OAAOnI,EAAEO,KAAK,CAACwG,4BAA4BzG,GAAG,CAAC;AACjD,GAAG;AAEH,OAAO,MAAM8H,yBAAyBpI,EAAEiD,YAAY,CAAC;IACnDgE,MAAMjH,EAAEK,MAAM,GAAGC,GAAG,CAAC;IACrB0H,QAAQ7H,0BAA0BiD,QAAQ;IAC1CnB,KAAKJ,0BAA0BuB,QAAQ;IACvCiF,UAAU7H,qBAAqBiE,+BAA+BrB,QAAQ;IACtEkF,MAAM9H,qBAAqBsH;AAC7B,GAAG;AAcH,SAASpE,aAAa9C,KAAc;IAClC,IAAIA,UAAU,QAAQ,OAAOA,UAAU,UAAU,OAAO;IACxD,IAAI2H,MAAMC,OAAO,CAAC5H,QAAQ;QACxB,IAAIA,MAAMG,MAAM,KAAK,GAAG,OAAO;QAC/B,OAAO,IAAI0H,KAAKC,GAAG,IAAI9H,MAAM+H,GAAG,CAACjF;IACnC;IAEA,MAAMvB,UAAUtB,OAAO+H,MAAM,CAAChI;IAC9B,IAAIuB,QAAQpB,MAAM,KAAK,GAAG,OAAO;IACjC,OAAO,IAAI0H,KAAKC,GAAG,IAAIvG,QAAQwG,GAAG,CAACjF;AACrC;AAEA,SAASF,qBAAqB5C,KAAc;IAC1C,OACE,OAAOA,UAAU,aAChB,OAAOA,UAAU,YAAYA,UAAU,QAAQ,CAAC2H,MAAMC,OAAO,CAAC5H;AAEnE"}
1
+ {"version":3,"sources":["../../src/document/workflow-document.ts"],"sourcesContent":["import {z} from 'zod';\nimport {agentThinkingSchema, harnessSchema} from './step-enums.js';\n\nconst stringOrStringArraySchema = z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]);\nconst nonEmptyRecordSchema = <ValueSchema extends z.ZodType>(valueSchema: ValueSchema) =>\n z\n .record(z.string().min(1), valueSchema)\n .refine((value) => Object.keys(value).length > 0, {message: 'Expected at least one entry'});\n\n// Runner shell steps execute on Unix shells, so workflow env names follow the\n// portable POSIX-style variable shape.\nconst envNameSchema = z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);\nconst envStringValueSchema = z.string().refine((value) => !value.includes('\\u0000'), {\n message: 'Env string values cannot contain null bytes',\n});\nexport const WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES = 128;\nexport const WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES = 32 * 1024;\nexport const workflowDocumentStepOutputTypes = ['string', 'number', 'boolean', 'json'] as const;\nexport const WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES = WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES;\nexport const WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES =\n WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES;\nexport const WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH = 64;\n\nconst utf8Encoder = new TextEncoder();\n\nexport const workflowDocumentEnvSchema = z\n .record(envNameSchema, z.union([envStringValueSchema, z.number(), z.boolean()]))\n .superRefine((env, ctx) => {\n const entries = Object.keys(env).length;\n if (entries > WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES) {\n ctx.addIssue({\n code: 'custom',\n message: `Env cannot define more than ${WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES} entries.`,\n });\n }\n\n const serializedBytes = utf8Encoder.encode(JSON.stringify(env)).byteLength;\n if (serializedBytes > WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES) {\n ctx.addIssue({\n code: 'custom',\n message: `Env cannot serialize to more than ${WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES} bytes.`,\n });\n }\n })\n .meta({\n description: `Environment variables as string, number, or boolean values. Each map allows up to ${WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES} entries and ${WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES} serialized bytes.`,\n });\n\nconst workflowDocumentStepOutputKeyPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\nconst workflowDocumentStepOutputTypeSchema = z.enum(workflowDocumentStepOutputTypes).meta({\n description: 'Declared output type. Use `json` when the output has a JSON Schema.',\n});\n\nconst workflowDocumentStepOutputDeclarationSchema = z\n .union([\n workflowDocumentStepOutputTypeSchema.transform((type) => ({type})),\n z.strictObject({\n type: workflowDocumentStepOutputTypeSchema,\n schema: z\n .unknown()\n .optional()\n .meta({\n description:\n 'JSON Schema for a `json` output. It allows up to ' +\n WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES +\n ' serialized bytes and ' +\n WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH +\n ' nesting levels.',\n }),\n }),\n ])\n .superRefine((declaration, ctx) => {\n const schema = 'schema' in declaration ? declaration.schema : undefined;\n if (declaration.type !== 'json' && schema !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['schema'],\n message: '`schema` is only supported for json outputs.',\n });\n return;\n }\n\n if (schema === undefined) return;\n\n if (!isJsonSchemaDocument(schema)) {\n ctx.addIssue({\n code: 'custom',\n path: ['schema'],\n message: 'Schema must be a valid JSON Schema document.',\n });\n return;\n }\n\n const serializedBytes = utf8Encoder.encode(JSON.stringify(schema)).byteLength;\n if (serializedBytes > WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES) {\n ctx.addIssue({\n code: 'custom',\n path: ['schema'],\n message: `Output JSON Schema cannot serialize to more than ${WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES} bytes.`,\n });\n }\n\n const depth = maxJsonDepth(schema);\n if (depth > WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH) {\n ctx.addIssue({\n code: 'custom',\n path: ['schema'],\n message: `Output JSON Schema cannot be nested deeper than ${WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH} levels.`,\n });\n }\n });\n\nexport const workflowDocumentStepOutputsSchema = z\n .record(z.string(), workflowDocumentStepOutputDeclarationSchema)\n .superRefine((outputs, ctx) => {\n const entries = Object.keys(outputs).length;\n if (entries > WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES) {\n ctx.addIssue({\n code: 'custom',\n message: `Step outputs cannot define more than ${WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES} entries.`,\n });\n }\n\n for (const key of Object.keys(outputs)) {\n if (workflowDocumentStepOutputKeyPattern.test(key)) continue;\n ctx.addIssue({\n code: 'custom',\n path: [key],\n message: 'Output keys must be CEL identifiers.',\n });\n }\n })\n .meta({\n description: `Named step outputs. Keys must be CEL identifiers and each step allows up to ${WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES} declarations.`,\n });\n\nconst workflowDocumentTriggerBaseSchema = {\n source: z.string().min(1).meta({\n description:\n 'Integration connection slug or built-in trigger source. See [Trigger sources](/reference/trigger-sources).',\n }),\n with: z.record(z.string(), z.unknown()).optional().meta({\n description:\n 'Provider-specific values used to match or configure the trigger. See [expressions](/reference/expressions#context-available).',\n }),\n filter: z.string().min(1).optional().meta({\n description:\n 'CEL condition that filters matching events. It is not supported for `manual` or `cron` triggers. See [trigger filters](/reference/expressions#trigger-filters).',\n }),\n config: z.record(z.string(), z.unknown()).optional().meta({\n description:\n 'Source-specific configuration. It is supported only for top-level triggers with a known built-in source. See [cron triggers](/reference/trigger-sources#cron).',\n }),\n} satisfies z.ZodRawShape;\n\nexport const triggerSourceConfigSchemas = {\n cron: z.strictObject({\n schedule: z.string().min(1).optional().meta({\n description: 'Cron expression that schedules the workflow.',\n }),\n timezone: z.string().min(1).optional().meta({\n description: 'IANA time zone used to evaluate `schedule`.',\n }),\n }),\n} satisfies Record<string, z.ZodType>;\nconst triggerSourceConfigSchemaRegistry: Readonly<Record<string, z.ZodType>> =\n triggerSourceConfigSchemas;\n\nexport const workflowDocumentTriggerSchema = z\n .strictObject({\n ...workflowDocumentTriggerBaseSchema,\n event: z.string().min(1).meta({\n description: 'Provider event name that starts the workflow.',\n }),\n })\n .superRefine((trigger, ctx) => {\n if (trigger.config === undefined) return;\n\n const configSchema = triggerSourceConfigSchemaRegistry[trigger.source];\n if (configSchema === undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['config'],\n message: `\\`config\\` is not supported for source \\`${trigger.source}\\`.`,\n });\n return;\n }\n\n const configResult = configSchema.safeParse(trigger.config);\n if (configResult.success) return;\n\n for (const configIssue of configResult.error.issues) {\n ctx.addIssue({\n ...configIssue,\n path: ['config', ...configIssue.path],\n });\n }\n });\n\nconst workflowDocumentListeningSchema = z\n .strictObject({\n on: z.array(workflowDocumentTriggerSchema).min(1).meta({\n description: 'Events that start listening. Listening triggers cannot use `config`.',\n }),\n until: z.array(workflowDocumentTriggerSchema).min(1).optional().meta({\n description:\n 'Events that resolve listening. Listening jobs need this, `timeout`, or `max_executions`; these triggers cannot use `config`.',\n }),\n timeout: z.string().min(1).optional().meta({\n description:\n 'Maximum duration to listen before resolving. A listening job needs this, `until`, or `max_executions`.',\n }),\n max_executions: z.number().int().positive().optional().meta({\n description:\n 'Maximum number of matching events before resolving. A listening job needs this, `until`, or `timeout`.',\n }),\n batch: z\n .strictObject({\n debounce: z.string().min(1).optional().meta({\n description: 'Quiet period to wait for more matching events before processing a batch.',\n }),\n max_size: z.number().int().positive().optional().meta({\n description: 'Maximum number of matching events in one batch.',\n }),\n max_wait: z.string().min(1).optional().meta({\n description: 'Maximum time to wait before processing a partial batch.',\n }),\n })\n .refine(\n (value) =>\n value.debounce !== undefined ||\n value.max_size !== undefined ||\n value.max_wait !== undefined,\n {message: 'Expected debounce, max_size, or max_wait'},\n )\n .optional()\n .meta({\n description:\n 'Optional batching policy. Set at least one of `debounce`, `max_size`, or `max_wait`.',\n }),\n on_resolve: z.enum(['finish', 'cancel']).optional().meta({\n description: 'How the job resolves when its listening condition is met.',\n }),\n })\n .superRefine((listening, ctx) => {\n for (const field of ['on', 'until'] as const) {\n for (const [index, trigger] of (listening[field] ?? []).entries()) {\n if (trigger.config !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: [field, index, 'config'],\n message: '`config` is only supported on top-level triggers.',\n });\n }\n }\n }\n });\n\nconst workflowDocumentStepGateSchema = z\n .strictObject({\n success: z.string().min(1).optional().meta({\n description:\n 'CEL expression that must evaluate to true for the step to succeed. See [gate outcomes](/understand/feedback-loops#gate-outcomes).',\n }),\n on_failure: z\n .strictObject({\n restart_from: z.string().min(1).meta({\n description:\n 'Key of an earlier step in the same job to restart from after a failed gate.',\n }),\n feedback: z.string().min(1).optional().meta({\n description: 'Feedback supplied when the gate fails before restarting.',\n }),\n })\n .optional()\n .meta({\n description:\n 'Restart behavior when the success gate fails. See [feedback loops](/understand/feedback-loops).',\n }),\n })\n .refine((value) => value.success !== undefined || value.on_failure !== undefined, {\n message: 'Expected success or on_failure',\n });\n\nexport const workflowDocumentCheckoutSchema = z.strictObject({\n permissions: z\n .strictObject({\n contents: z.enum(['read', 'write']).optional().meta({\n description: 'Repository contents permission granted to checkout.',\n }),\n })\n .optional()\n .meta({\n description: 'Repository permissions used during checkout.',\n }),\n 'persist-credentials': z.boolean().optional().meta({\n description: 'Whether checkout credentials remain available to later run steps.',\n }),\n});\n\nexport const workflowDocumentStepIntegrationSelectionSchema = z.array(z.string().min(1)).min(1);\n\nexport const workflowDocumentStepIntegrationSchema = z.strictObject({\n connection: z.string().min(1).optional().meta({\n description: 'Integration connection slug to use for these tools.',\n }),\n include: workflowDocumentStepIntegrationSelectionSchema.meta({\n description: 'Tool selectors to make available to the agent.',\n }),\n exclude: workflowDocumentStepIntegrationSelectionSchema.optional().meta({\n description: 'Tool selectors to remove from the included tools.',\n }),\n allow_write: z.boolean().optional().meta({\n description: 'Allows write-capable integration tools. Omit or set false for read-only access.',\n }),\n});\n\nexport const workflowDocumentAgentStepFields = [\n 'model',\n 'prompt',\n 'harness',\n 'thinking',\n 'provider',\n 'tools',\n 'integrations',\n] as const;\n\n// A step is a run step (`run`) or an inline agent step (`prompt`), never\n// both. They share one strict object so an unknown key is still rejected; the\n// `superRefine` discriminates by which payload keys are present and emits one\n// targeted issue per failure mode (a plain union would surface every branch's\n// errors at once). The `agent` keyword is declared only so the reserved-keyword\n// case produces a clear message instead of a generic \"unrecognized key\".\nexport const workflowDocumentStepSchema = z\n .strictObject({\n key: z\n .string()\n .min(1)\n .optional()\n .meta({description: 'Stable step key for dependencies and outputs.'}),\n if: z\n .string()\n .min(1)\n .optional()\n .meta({\n description:\n 'CEL condition wrapped in exactly one $' +\n '{{ }} interpolation. See [conditionals](/reference/expressions#conditionals-if).',\n }),\n name: z.string().min(1).optional().meta({description: 'Human-readable step name.'}),\n run: z.string().min(1).optional().meta({\n description: 'Shell command for a run step. Do not combine it with agent-only fields.',\n }),\n model: z.string().min(1).optional().meta({\n description:\n 'Model ID for an agent step. It requires `prompt` and is not valid on a run step.',\n }),\n prompt: z.string().min(1).optional().meta({\n description: 'Prompt for an agent step. It is required when any agent-only field is set.',\n }),\n harness: harnessSchema.optional().meta({\n description:\n 'Agent harness. When omitted, Shipfox uses the workspace default harness, or `pi` when none is configured.',\n }),\n thinking: agentThinkingSchema.optional().meta({\n description:\n 'Reasoning effort for an agent step. Supported values depend on the resolved harness. When omitted, Shipfox uses the provider default, or `xhigh` when none is configured.',\n }),\n provider: z.string().min(1).optional().meta({\n description:\n 'Model provider ID for an agent step. It requires `prompt` and is not valid on a run step.',\n }),\n tools: z.array(z.string().min(1)).min(1).optional().meta({\n description:\n 'Built-in tool IDs for an agent step. It requires `prompt` and is not valid on a run step.',\n }),\n integrations: z.array(workflowDocumentStepIntegrationSchema).min(1).optional().meta({\n description:\n 'Integration tools available to an agent step. It requires `prompt` and is not valid on a run step. See [integration tools](/how-to/author-workflows/use-integration-tools).',\n }),\n agent: z.unknown().optional().meta({\n description: 'Reserved keyword. It is rejected; use `prompt` to define an agent step.',\n }),\n gate: workflowDocumentStepGateSchema.optional().meta({\n description: 'Success gate and optional restart behavior after the step runs.',\n }),\n env: workflowDocumentEnvSchema.optional().meta({\n description: 'Environment variables for a run step. They are not valid on an agent step.',\n }),\n outputs: workflowDocumentStepOutputsSchema.optional().meta({\n description: 'Named output declarations produced by this step.',\n }),\n })\n .superRefine((step, ctx) => {\n if (step.agent !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['agent'],\n message: 'The \"agent\" keyword is reserved for a future step kind and is not supported yet.',\n });\n return;\n }\n\n if (step.run !== undefined) {\n for (const key of workflowDocumentAgentStepFields) {\n if (step[key] !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: [key],\n message: `\"${key}\" is not valid on a run step.`,\n });\n }\n }\n return;\n }\n\n const isAgent = workflowDocumentAgentStepFields.some((field) => step[field] !== undefined);\n\n if (!isAgent) {\n ctx.addIssue({\n code: 'custom',\n message: 'A step must define either \"run\" or an agent \"prompt\".',\n });\n return;\n }\n\n if (step.env !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['env'],\n message: '\"env\" is supported only on run steps.',\n });\n }\n if (step.prompt === undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['prompt'],\n message: 'An agent step requires \"prompt\".',\n });\n }\n });\n\nexport const workflowDocumentJobSchema = z.strictObject({\n needs: stringOrStringArraySchema.optional().meta({\n description: 'Job key or keys that must complete before this job starts.',\n }),\n if: z\n .string()\n .min(1)\n .optional()\n .meta({\n description:\n 'CEL condition wrapped in exactly one $' +\n '{{ }} interpolation. See [conditionals](/reference/expressions#conditionals-if).',\n }),\n runner: stringOrStringArraySchema.optional().meta({\n description:\n 'Runner label or ordered fallback labels for this job. See [runners and execution environments](/understand/runners-and-execution-environments).',\n }),\n success: z.string().min(1).optional().meta({\n description:\n 'CEL expression that determines whether the job succeeds. See [job success](/reference/expressions#job-success-success).',\n }),\n outputs: nonEmptyRecordSchema(z.string().min(1)).optional().meta({\n description: 'Named job outputs mapped from step values.',\n }),\n execution_timeout: z.string().min(1).optional().meta({\n description: 'Maximum duration for one job execution.',\n }),\n checkout: workflowDocumentCheckoutSchema.optional().meta({\n description: 'Checkout settings for repository content and credentials.',\n }),\n listening: workflowDocumentListeningSchema.optional().meta({\n description:\n 'Event-listening configuration for this job. See [listening jobs](/understand/listening-jobs).',\n }),\n name: z.string().min(1).optional().meta({description: 'Human-readable job name.'}),\n env: workflowDocumentEnvSchema.optional().meta({\n description:\n 'Environment variables for run steps in this job. They do not apply to agent steps. See [secrets and variables](/reference/secrets-variables).',\n }),\n steps: z.array(workflowDocumentStepSchema).min(1).meta({\n description: 'Ordered run or agent steps. Each job needs at least one step.',\n }),\n});\n\nexport const workflowDocumentSchema = z.strictObject({\n name: z.string().min(1).meta({description: 'Human-readable workflow name.'}),\n runner: stringOrStringArraySchema.optional().meta({\n description:\n 'Default runner label or ordered fallback labels for run jobs. See [runners and execution environments](/understand/runners-and-execution-environments).',\n }),\n env: workflowDocumentEnvSchema.optional().meta({\n description:\n 'Workflow-level environment variables for run steps. They do not apply to agent steps. See [secrets and variables](/reference/secrets-variables).',\n }),\n triggers: nonEmptyRecordSchema(workflowDocumentTriggerSchema).optional().meta({\n description:\n 'Named events that start workflow runs. A workflow can have at most one `manual` trigger.',\n }),\n jobs: nonEmptyRecordSchema(workflowDocumentJobSchema).meta({\n description: 'Named jobs that make up the workflow. At least one job is required.',\n }),\n});\n\nexport type WorkflowDocument = z.infer<typeof workflowDocumentSchema>;\nexport type WorkflowDocumentJobCheckout = z.infer<typeof workflowDocumentCheckoutSchema>;\nexport type WorkflowDocumentEnv = z.infer<typeof workflowDocumentEnvSchema>;\nexport type WorkflowDocumentJob = z.infer<typeof workflowDocumentJobSchema>;\nexport type WorkflowDocumentJobListening = z.infer<typeof workflowDocumentListeningSchema>;\nexport type WorkflowDocumentRunStepGate = z.infer<typeof workflowDocumentStepGateSchema>;\nexport type WorkflowDocumentStepIntegration = z.infer<typeof workflowDocumentStepIntegrationSchema>;\nexport type WorkflowDocumentStepOutputType = (typeof workflowDocumentStepOutputTypes)[number];\nexport type WorkflowDocumentStepOutputs = z.infer<typeof workflowDocumentStepOutputsSchema>;\nexport type WorkflowDocumentStep = z.infer<typeof workflowDocumentStepSchema>;\nexport type WorkflowDocumentTrigger = z.infer<typeof workflowDocumentTriggerSchema>;\n\nfunction maxJsonDepth(value: unknown): number {\n if (value === null || typeof value !== 'object') return 0;\n if (Array.isArray(value)) {\n if (value.length === 0) return 1;\n return 1 + Math.max(...value.map(maxJsonDepth));\n }\n\n const entries = Object.values(value);\n if (entries.length === 0) return 1;\n return 1 + Math.max(...entries.map(maxJsonDepth));\n}\n\nfunction isJsonSchemaDocument(value: unknown): boolean {\n return (\n typeof value === 'boolean' ||\n (typeof value === 'object' && value !== null && !Array.isArray(value))\n );\n}\n"],"names":["z","agentThinkingSchema","harnessSchema","stringOrStringArraySchema","union","string","min","array","nonEmptyRecordSchema","valueSchema","record","refine","value","Object","keys","length","message","envNameSchema","regex","envStringValueSchema","includes","WORKFLOW_DOCUMENT_ENV_MAX_ENTRIES","WORKFLOW_DOCUMENT_ENV_MAX_SERIALIZED_BYTES","workflowDocumentStepOutputTypes","WORKFLOW_DOCUMENT_STEP_OUTPUTS_MAX_ENTRIES","WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_SERIALIZED_BYTES","WORKFLOW_DOCUMENT_STEP_OUTPUT_SCHEMA_MAX_DEPTH","utf8Encoder","TextEncoder","workflowDocumentEnvSchema","number","boolean","superRefine","env","ctx","entries","addIssue","code","serializedBytes","encode","JSON","stringify","byteLength","meta","description","workflowDocumentStepOutputKeyPattern","workflowDocumentStepOutputTypeSchema","enum","workflowDocumentStepOutputDeclarationSchema","transform","type","strictObject","schema","unknown","optional","declaration","undefined","path","isJsonSchemaDocument","depth","maxJsonDepth","workflowDocumentStepOutputsSchema","outputs","key","test","workflowDocumentTriggerBaseSchema","source","with","filter","config","triggerSourceConfigSchemas","cron","schedule","timezone","triggerSourceConfigSchemaRegistry","workflowDocumentTriggerSchema","event","trigger","configSchema","configResult","safeParse","success","configIssue","error","issues","workflowDocumentListeningSchema","on","until","timeout","max_executions","int","positive","batch","debounce","max_size","max_wait","on_resolve","listening","field","index","workflowDocumentStepGateSchema","on_failure","restart_from","feedback","workflowDocumentCheckoutSchema","permissions","contents","workflowDocumentStepIntegrationSelectionSchema","workflowDocumentStepIntegrationSchema","connection","include","exclude","allow_write","workflowDocumentAgentStepFields","workflowDocumentStepSchema","if","name","run","model","prompt","harness","thinking","provider","tools","integrations","agent","gate","step","isAgent","some","workflowDocumentJobSchema","needs","runner","execution_timeout","checkout","steps","workflowDocumentSchema","triggers","jobs","Array","isArray","Math","max","map","values"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AACtB,SAAQC,mBAAmB,EAAEC,aAAa,QAAO,kBAAkB;AAEnE,MAAMC,4BAA4BH,EAAEI,KAAK,CAAC;IAACJ,EAAEK,MAAM,GAAGC,GAAG,CAAC;IAAIN,EAAEO,KAAK,CAACP,EAAEK,MAAM,GAAGC,GAAG,CAAC,IAAIA,GAAG,CAAC;CAAG;AAChG,MAAME,uBAAuB,CAAgCC,cAC3DT,EACGU,MAAM,CAACV,EAAEK,MAAM,GAAGC,GAAG,CAAC,IAAIG,aAC1BE,MAAM,CAAC,CAACC,QAAUC,OAAOC,IAAI,CAACF,OAAOG,MAAM,GAAG,GAAG;QAACC,SAAS;IAA6B;AAE7F,8EAA8E;AAC9E,uCAAuC;AACvC,MAAMC,gBAAgBjB,EAAEK,MAAM,GAAGa,KAAK,CAAC;AACvC,MAAMC,uBAAuBnB,EAAEK,MAAM,GAAGM,MAAM,CAAC,CAACC,QAAU,CAACA,MAAMQ,QAAQ,CAAC,WAAW;IACnFJ,SAAS;AACX;AACA,OAAO,MAAMK,oCAAoC,I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