@bastani/atomic 0.8.23 → 0.8.24-alpha.2

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +13 -0
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/CHANGELOG.md +13 -0
  5. package/dist/builtin/mcp/package.json +1 -1
  6. package/dist/builtin/subagents/CHANGELOG.md +28 -0
  7. package/dist/builtin/subagents/README.md +16 -0
  8. package/dist/builtin/subagents/agents/code-simplifier.md +2 -3
  9. package/dist/builtin/subagents/agents/codebase-analyzer.md +2 -3
  10. package/dist/builtin/subagents/agents/codebase-locator.md +2 -3
  11. package/dist/builtin/subagents/agents/codebase-online-researcher.md +2 -3
  12. package/dist/builtin/subagents/agents/codebase-pattern-finder.md +2 -3
  13. package/dist/builtin/subagents/agents/codebase-research-analyzer.md +2 -3
  14. package/dist/builtin/subagents/agents/codebase-research-locator.md +2 -3
  15. package/dist/builtin/subagents/agents/debugger.md +2 -3
  16. package/dist/builtin/subagents/package.json +1 -1
  17. package/dist/builtin/subagents/skills/subagent/SKILL.md +6 -0
  18. package/dist/builtin/subagents/src/agents/agent-serializer.ts +3 -0
  19. package/dist/builtin/subagents/src/agents/agents.ts +20 -1
  20. package/dist/builtin/subagents/src/runs/background/async-execution.ts +1 -1
  21. package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +3 -1
  22. package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +7 -7
  23. package/dist/builtin/subagents/src/runs/foreground/execution.ts +5 -1
  24. package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +9 -10
  25. package/dist/builtin/subagents/src/shared/types.ts +1 -0
  26. package/dist/builtin/web-access/CHANGELOG.md +13 -0
  27. package/dist/builtin/web-access/package.json +1 -1
  28. package/dist/builtin/workflows/CHANGELOG.md +35 -0
  29. package/dist/builtin/workflows/README.md +38 -41
  30. package/dist/builtin/workflows/ambient.d.ts +36 -0
  31. package/dist/builtin/workflows/builtin/deep-research-codebase.d.ts +35 -0
  32. package/dist/builtin/workflows/builtin/deep-research-codebase.ts +11 -14
  33. package/dist/builtin/workflows/builtin/goal.d.ts +46 -0
  34. package/dist/builtin/workflows/builtin/goal.ts +10 -12
  35. package/dist/builtin/workflows/builtin/index.d.ts +136 -0
  36. package/dist/builtin/workflows/builtin/open-claude-design.d.ts +44 -0
  37. package/dist/builtin/workflows/builtin/open-claude-design.ts +19 -20
  38. package/dist/builtin/workflows/builtin/ralph.d.ts +36 -0
  39. package/dist/builtin/workflows/builtin/ralph.ts +20 -24
  40. package/dist/builtin/workflows/package.json +15 -5
  41. package/dist/builtin/workflows/src/authoring.d.ts +197 -0
  42. package/dist/builtin/workflows/src/extension/workflow-module-loader.ts +6 -12
  43. package/dist/builtin/workflows/src/extension/workflow-schema.ts +3 -2
  44. package/dist/builtin/workflows/src/index.ts +0 -5
  45. package/dist/builtin/workflows/src/runs/foreground/executor.ts +23 -9
  46. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +33 -5
  47. package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +72 -11
  48. package/dist/builtin/workflows/src/sdk-surface.ts +12 -2
  49. package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +523 -0
  50. package/dist/builtin/workflows/src/shared/render-inputs-schema.ts +1 -1
  51. package/dist/builtin/workflows/src/shared/types.ts +65 -350
  52. package/dist/builtin/workflows/src/workflows/define-workflow.ts +59 -44
  53. package/dist/core/atomic-guide-command.d.ts.map +1 -1
  54. package/dist/core/atomic-guide-command.js +1 -1
  55. package/dist/core/atomic-guide-command.js.map +1 -1
  56. package/dist/index.d.ts +1 -0
  57. package/dist/modes/interactive/components/chat-message-renderer.d.ts +1 -0
  58. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  59. package/dist/modes/interactive/components/chat-message-renderer.js +13 -1
  60. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  61. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  62. package/dist/modes/interactive/interactive-mode.js +1 -1
  63. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  64. package/dist/utils/changelog.d.ts.map +1 -1
  65. package/dist/utils/changelog.js +23 -16
  66. package/dist/utils/changelog.js.map +1 -1
  67. package/docs/extensions.md +2 -2
  68. package/docs/packages.md +8 -4
  69. package/docs/subagents.md +30 -0
  70. package/docs/workflows.md +62 -21
  71. package/package.json +20 -1
  72. package/dist/builtin/workflows/src/runs/shared/workflow-runner.ts +0 -335
@@ -226,13 +226,12 @@ export default defineWorkflow("open-claude-design")
226
226
  const specFileUrl = `file://${specPath}`;
227
227
 
228
228
  const designModelConfig = {
229
- model: "anthropic/claude-opus-4-8",
229
+ model: "anthropic/claude-opus-4-8:xhigh",
230
230
  fallbackModels: [
231
- "github-copilot/claude-opus-4.7",
232
- "anthropic/claude-sonnet-4-6",
233
- "github-copilot/claude-sonnet-4.6",
231
+ "github-copilot/claude-opus-4.8:medium",
232
+ "anthropic/claude-sonnet-4-6:xhigh",
233
+ "github-copilot/claude-sonnet-4.6:medium",
234
234
  ],
235
- thinkingLevel: "high" as const,
236
235
  };
237
236
 
238
237
  let designSystem: string;
@@ -243,7 +242,7 @@ export default defineWorkflow("open-claude-design")
243
242
  prompt: taggedPrompt([
244
243
  [
245
244
  "role",
246
- "You are an impeccable design-system analyst. Apply the impeccable `document` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/document.md) to read an existing DESIGN.md / PRODUCT.md (or equivalent) and re-emit it in the six-section Google Stitch DESIGN.md format so the rest of this workflow can rely on it.",
245
+ "You are an impeccable design-system analyst. Apply the impeccable `document` sub-skill to read an existing DESIGN.md / PRODUCT.md (or equivalent) and re-emit it in the six-section Google Stitch DESIGN.md format so the rest of this workflow can rely on it.",
247
246
  ],
248
247
  [
249
248
  "objective",
@@ -289,7 +288,7 @@ export default defineWorkflow("open-claude-design")
289
288
  task: taggedPrompt([
290
289
  [
291
290
  "role",
292
- "You are an impeccable design-system locator. Apply the impeccable `extract` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/extract.md) to find design-system evidence already living in this codebase.",
291
+ "You are an impeccable design-system locator. Apply the impeccable `extract` sub-skill to find design-system evidence already living in this codebase.",
293
292
  ],
294
293
  [
295
294
  "objective",
@@ -320,7 +319,7 @@ export default defineWorkflow("open-claude-design")
320
319
  task: taggedPrompt([
321
320
  [
322
321
  "role",
323
- "You are an impeccable UI architecture auditor. Apply the impeccable `audit` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/audit.md) to score the project's UI implementation across five dimensions.",
322
+ "You are an impeccable UI architecture auditor. Apply the impeccable `audit` sub-skill to score the project's UI implementation across five dimensions.",
324
323
  ],
325
324
  [
326
325
  "objective",
@@ -360,7 +359,7 @@ export default defineWorkflow("open-claude-design")
360
359
  task: taggedPrompt([
361
360
  [
362
361
  "role",
363
- "You are an impeccable pattern miner. Apply the impeccable `extract` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/extract.md) to harvest reusable design and component patterns, plus the anti-patterns to avoid.",
362
+ "You are an impeccable pattern miner. Apply the impeccable `extract` sub-skill to harvest reusable design and component patterns, plus the anti-patterns to avoid.",
364
363
  ],
365
364
  [
366
365
  "objective",
@@ -394,7 +393,7 @@ export default defineWorkflow("open-claude-design")
394
393
  prompt: taggedPrompt([
395
394
  [
396
395
  "role",
397
- "You are an impeccable design-system author. Apply the impeccable `document` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/document.md) to synthesize a project-specific DESIGN.md in the six-section Google Stitch format from the three onboarding analyses.",
396
+ "You are an impeccable design-system author. Apply the impeccable `document` sub-skill to synthesize a project-specific DESIGN.md in the six-section Google Stitch format from the three onboarding analyses.",
398
397
  ],
399
398
  [
400
399
  "objective",
@@ -442,7 +441,7 @@ export default defineWorkflow("open-claude-design")
442
441
  task: taggedPrompt([
443
442
  [
444
443
  "role",
445
- "You are an impeccable reference extractor for live web pages. Apply the impeccable `extract` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/extract.md) to pull only the design traits that should transfer into the project — never just clone the source.",
444
+ "You are an impeccable reference extractor for live web pages. Apply the impeccable `extract` sub-skill to pull only the design traits that should transfer into the project — never just clone the source.",
446
445
  ],
447
446
  [
448
447
  "objective",
@@ -478,7 +477,7 @@ export default defineWorkflow("open-claude-design")
478
477
  task: taggedPrompt([
479
478
  [
480
479
  "role",
481
- "You are an impeccable reference parser for local design files. Apply the impeccable `extract` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/extract.md) to lift concrete, citable requirements out of supplied references.",
480
+ "You are an impeccable reference parser for local design files. Apply the impeccable `extract` sub-skill to lift concrete, citable requirements out of supplied references.",
482
481
  ],
483
482
  [
484
483
  "objective",
@@ -520,7 +519,7 @@ export default defineWorkflow("open-claude-design")
520
519
  prompt: taggedPrompt([
521
520
  [
522
521
  "role",
523
- "You are an impeccable design-and-build engineer. Apply the impeccable `craft` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/craft.md) to ship a production-quality HTML artifact that traces back to the synthesized DESIGN.md.",
522
+ "You are an impeccable design-and-build engineer. Apply the impeccable `craft` sub-skill to ship a production-quality HTML artifact that traces back to the synthesized DESIGN.md.",
524
523
  ],
525
524
  [
526
525
  "objective",
@@ -609,7 +608,7 @@ export default defineWorkflow("open-claude-design")
609
608
  prompt: taggedPrompt([
610
609
  [
611
610
  "role",
612
- "You are an impeccable design reviewer collecting actionable refinement feedback from the user about the rendered HTML preview. Apply the impeccable `critique` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/critique.md) to decide whether the artifact is ready.",
611
+ "You are an impeccable design reviewer collecting actionable refinement feedback from the user about the rendered HTML preview. Apply the impeccable `critique` sub-skill to decide whether the artifact is ready.",
613
612
  ],
614
613
  [
615
614
  "objective",
@@ -653,7 +652,7 @@ export default defineWorkflow("open-claude-design")
653
652
  task: taggedPrompt([
654
653
  [
655
654
  "role",
656
- "You are an impeccable design critic. Apply the impeccable `critique` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/critique.md) to run the formal two-pass review against the live HTML preview.",
655
+ "You are an impeccable design critic. Apply the impeccable `critique` sub-skill to run the formal two-pass review against the live HTML preview.",
657
656
  ],
658
657
  [
659
658
  "objective",
@@ -696,7 +695,7 @@ export default defineWorkflow("open-claude-design")
696
695
  task: taggedPrompt([
697
696
  [
698
697
  "role",
699
- "You are an impeccable visual QA specialist for the rendered HTML preview. Apply the impeccable `audit` (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/audit.md) plus `live` (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/live.md) sub-skills to validate the rendered output against breakpoints, states, and accessibility.",
698
+ "You are an impeccable visual QA specialist for the rendered HTML preview. Apply the impeccable `audit` plus `live` sub-skills to validate the rendered output against breakpoints, states, and accessibility.",
700
699
  ],
701
700
  [
702
701
  "objective",
@@ -742,7 +741,7 @@ export default defineWorkflow("open-claude-design")
742
741
  prompt: taggedPrompt([
743
742
  [
744
743
  "role",
745
- "You are an impeccable design polisher. Apply the impeccable `polish` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/polish.md) — the meticulous final pass between good and great — to revise the HTML preview in place.",
744
+ "You are an impeccable design polisher. Apply the impeccable `polish` — the meticulous final pass between good and great — to revise the HTML preview in place.",
746
745
  ],
747
746
  [
748
747
  "objective",
@@ -828,7 +827,7 @@ export default defineWorkflow("open-claude-design")
828
827
  prompt: taggedPrompt([
829
828
  [
830
829
  "role",
831
- "You are an impeccable pre-release gate. Apply the impeccable `audit` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/audit.md) one final time to block export only for concrete, evidence-backed issues.",
830
+ "You are an impeccable pre-release gate. Apply the impeccable `audit` sub-skill one final time to block export only for concrete, evidence-backed issues.",
832
831
  ],
833
832
  [
834
833
  "objective",
@@ -864,7 +863,7 @@ export default defineWorkflow("open-claude-design")
864
863
  prompt: taggedPrompt([
865
864
  [
866
865
  "role",
867
- "You are an impeccable production-readiness hardener. Apply the impeccable `harden` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/harden.md) to remove blocking findings without redesigning.",
866
+ "You are an impeccable production-readiness hardener. Apply the impeccable `harden` sub-skill to remove blocking findings without redesigning.",
868
867
  ],
869
868
  [
870
869
  "objective",
@@ -903,7 +902,7 @@ export default defineWorkflow("open-claude-design")
903
902
  prompt: taggedPrompt([
904
903
  [
905
904
  "role",
906
- "You are an impeccable design documenter. Apply the impeccable `document` sub-skill (https://github.com/pbakaus/impeccable/blob/main/site/content/skills/document.md) to produce a RICH HTML SPEC that bundles the approved preview together with implementation guidance for Claude Code / frontend engineers.",
905
+ "You are an impeccable design documenter. Apply the impeccable `document` sub-skill to produce a RICH HTML SPEC that bundles the approved preview together with implementation guidance for a design/frontend engineer.",
907
906
  ],
908
907
  [
909
908
  "objective",
@@ -0,0 +1,36 @@
1
+ import type { WorkflowDefinition, WorkflowInputValues, WorkflowOutputValues } from "../src/authoring.js";
2
+
3
+ export type RalphWorkflowInputs = WorkflowInputValues & {
4
+ readonly prompt: string;
5
+ readonly max_loops: number;
6
+ readonly base_branch: string;
7
+ readonly git_worktree_dir: string;
8
+ };
9
+
10
+ export type RalphWorkflowRunInputs = WorkflowInputValues & {
11
+ readonly prompt: string;
12
+ readonly max_loops?: number;
13
+ readonly base_branch?: string;
14
+ readonly git_worktree_dir?: string;
15
+ };
16
+
17
+ export type RalphWorkflowOutputs = WorkflowOutputValues & {
18
+ readonly result?: string;
19
+ readonly plan?: string;
20
+ readonly plan_path?: string;
21
+ readonly implementation_notes_path?: string;
22
+ readonly pr_report?: string;
23
+ readonly approved?: boolean;
24
+ readonly iterations_completed?: number;
25
+ readonly review_report?: string;
26
+ readonly review_report_path?: string;
27
+ };
28
+
29
+ export type RalphWorkflowDefinition = WorkflowDefinition<
30
+ RalphWorkflowInputs,
31
+ RalphWorkflowOutputs,
32
+ RalphWorkflowRunInputs
33
+ >;
34
+
35
+ declare const workflow: RalphWorkflowDefinition;
36
+ export default workflow;
@@ -432,50 +432,46 @@ async function runRalphWorkflow(
432
432
  let iterationsCompleted = 0;
433
433
 
434
434
  const plannerModelConfig = {
435
- model: "openai/gpt-5.5",
435
+ model: "openai/gpt-5.5:xhigh",
436
436
  fallbackModels: [
437
- "openai-codex/gpt-5.5",
438
- "github-copilot/gpt-5.5",
439
- "anthropic/claude-opus-4-8",
440
- "github-copilot/claude-opus-4.7",
437
+ "openai-codex/gpt-5.5:xhigh",
438
+ "github-copilot/gpt-5.5:xhigh",
439
+ "anthropic/claude-opus-4-8:xhigh",
440
+ "github-copilot/claude-opus-4.8:medium",
441
441
  ],
442
- thinkingLevel: "high" as const,
443
442
  excludedTools: ["ask_user_question"],
444
443
  };
445
444
 
446
445
  const orchestratorModelConfig = {
447
- model: "openai/gpt-5.5",
446
+ model: "openai/gpt-5.5:medium",
448
447
  fallbackModels: [
449
- "openai-codex/gpt-5.5",
450
- "github-copilot/gpt-5.5",
451
- "anthropic/claude-sonnet-4-6",
452
- "github-copilot/claude-sonnet-4.6",
448
+ "openai-codex/gpt-5.5:medium",
449
+ "github-copilot/gpt-5.5:medium",
450
+ "anthropic/claude-sonnet-4-6:medium",
451
+ "github-copilot/claude-sonnet-4.6:medium",
453
452
  ],
454
- thinkingLevel: "medium" as const,
455
453
  excludedTools: ["ask_user_question"],
456
454
  };
457
455
 
458
456
  const simplifierModelConfig = {
459
- model: "openai/gpt-5.5",
457
+ model: "openai/gpt-5.5:medium",
460
458
  fallbackModels: [
461
- "openai-codex/gpt-5.5",
462
- "github-copilot/gpt-5.5",
463
- "anthropic/claude-sonnet-4-6",
464
- "github-copilot/claude-sonnet-4.6",
459
+ "openai-codex/gpt-5.5:medium",
460
+ "github-copilot/gpt-5.5:medium",
461
+ "anthropic/claude-sonnet-4-6:medium",
462
+ "github-copilot/claude-sonnet-4.6:medium",
465
463
  ],
466
- thinkingLevel: "medium" as const,
467
464
  excludedTools: ["ask_user_question"],
468
465
  };
469
466
 
470
467
  const reviewerModelConfig = {
471
- model: "openai/gpt-5.5",
468
+ model: "openai/gpt-5.5:xhigh",
472
469
  fallbackModels: [
473
- "openai-codex/gpt-5.5",
474
- "github-copilot/gpt-5.5",
475
- "anthropic/claude-opus-4-8",
476
- "github-copilot/claude-opus-4.7",
470
+ "openai-codex/gpt-5.5:xhigh",
471
+ "github-copilot/gpt-5.5:xhigh",
472
+ "anthropic/claude-opus-4-8:xhigh",
473
+ "github-copilot/claude-opus-4.8:medium",
477
474
  ],
478
- thinkingLevel: "high" as const,
479
475
  excludedTools: ["ask_user_question"],
480
476
  customTools: [reviewDecisionTool],
481
477
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.8.23",
3
+ "version": "0.8.24-alpha.2",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -13,11 +13,20 @@
13
13
  "bun": ">=1.3.14"
14
14
  },
15
15
  "main": "./src/index.ts",
16
- "types": "./src/index.ts",
16
+ "types": "./src/authoring.ts",
17
17
  "exports": {
18
- ".": "./src/index.ts",
19
- "./builtin": "./builtin/index.ts",
20
- "./builtin/*": "./builtin/*.ts"
18
+ ".": {
19
+ "types": "./src/authoring.ts",
20
+ "default": "./src/index.ts"
21
+ },
22
+ "./builtin": {
23
+ "types": "./builtin/index.d.ts",
24
+ "default": "./builtin/index.ts"
25
+ },
26
+ "./builtin/*": {
27
+ "types": "./builtin/*.d.ts",
28
+ "default": "./builtin/*.ts"
29
+ }
21
30
  },
22
31
  "repository": {
23
32
  "type": "git",
@@ -39,6 +48,7 @@
39
48
  "files": [
40
49
  "src/**/*.ts",
41
50
  "builtin/**/*.ts",
51
+ "builtin/**/*.d.ts",
42
52
  "skills/**/*",
43
53
  "prompts/**/*",
44
54
  "themes/*.json",
@@ -0,0 +1,197 @@
1
+ import type { TAny, TArray, TArrayOptions, TBigInt, TBoolean, TEnum, TEnumValue, TInteger, TIntersect, TIntersectOptions, TLiteral, TLiteralValue, TNever, TNull, TNumber, TNumberOptions, TOmit, TObject, TObjectOptions, TPartial, TPick, TRecordAction, TRequired, TSchema, TSchemaOptions, TString, TStringOptions, TTuple, TTupleOptions, TUndefined, TUnion, TUnknown, TVoid, Type as TypeboxType, TKeysToIndexer } from "typebox";
2
+ type PreserveOptions<T extends TSchema, O extends TSchemaOptions> = T & O;
3
+ type TypeScriptEnumLike = Record<string, string | number>;
4
+ type TypeScriptEnumValues<T extends TypeScriptEnumLike> = Extract<T[keyof T], TEnumValue>[];
5
+ export declare const Type: Omit<typeof TypeboxType, "Any" | "Array" | "BigInt" | "Boolean" | "Enum" | "Integer" | "Intersect" | "Literal" | "Never" | "Null" | "Number" | "Omit" | "Partial" | "Pick" | "Object" | "Record" | "Required" | "String" | "Tuple" | "Undefined" | "Union" | "Unknown" | "Void"> & {
6
+ Any<const O extends TSchemaOptions>(options: O): PreserveOptions<TAny, O>;
7
+ Any(): TAny;
8
+ Array<Type extends TSchema, const O extends TArrayOptions>(items: Type, options: O): PreserveOptions<TArray<Type>, O>;
9
+ Array<Type extends TSchema>(items: Type): TArray<Type>;
10
+ BigInt<const O extends TSchemaOptions>(options: O): PreserveOptions<TBigInt, O>;
11
+ BigInt(): TBigInt;
12
+ Boolean<const O extends TSchemaOptions>(options: O): PreserveOptions<TBoolean, O>;
13
+ Boolean(): TBoolean;
14
+ Enum<Values extends TEnumValue[], const O extends TSchemaOptions>(values: readonly [...Values], options: O): PreserveOptions<TEnum<Values>, O>;
15
+ Enum<Values extends TEnumValue[]>(values: readonly [...Values]): TEnum<Values>;
16
+ Enum<Enum extends TypeScriptEnumLike, const O extends TSchemaOptions>(value: Enum, options: O): PreserveOptions<TEnum<TypeScriptEnumValues<Enum>>, O>;
17
+ Enum<Enum extends TypeScriptEnumLike>(value: Enum): TEnum<TypeScriptEnumValues<Enum>>;
18
+ Integer<const O extends TNumberOptions>(options: O): PreserveOptions<TInteger, O>;
19
+ Integer(): TInteger;
20
+ Intersect<Types extends TSchema[], const O extends TIntersectOptions>(types: [...Types], options: O): PreserveOptions<TIntersect<Types>, O>;
21
+ Intersect<Types extends TSchema[]>(types: [...Types]): TIntersect<Types>;
22
+ Literal<const Value extends TLiteralValue, const O extends TSchemaOptions>(value: Value, options: O): PreserveOptions<TLiteral<Value>, O>;
23
+ Literal<const Value extends TLiteralValue>(value: Value): TLiteral<Value>;
24
+ Never<const O extends TSchemaOptions>(options: O): PreserveOptions<TNever, O>;
25
+ Never(): TNever;
26
+ Null<const O extends TSchemaOptions>(options: O): PreserveOptions<TNull, O>;
27
+ Null(): TNull;
28
+ Number<const O extends TNumberOptions>(options: O): PreserveOptions<TNumber, O>;
29
+ Number(): TNumber;
30
+ Omit<Type extends TSchema, Indexer extends PropertyKey[], const O extends TSchemaOptions>(type: Type, indexer: readonly [...Indexer], options: O): PreserveOptions<TOmit<Type, TKeysToIndexer<Indexer>>, O>;
31
+ Omit<Type extends TSchema, Indexer extends PropertyKey[]>(type: Type, indexer: readonly [...Indexer]): TOmit<Type, TKeysToIndexer<Indexer>>;
32
+ Omit<Type extends TSchema, Indexer extends TSchema, const O extends TSchemaOptions>(type: Type, indexer: Indexer, options: O): PreserveOptions<TOmit<Type, Indexer>, O>;
33
+ Omit<Type extends TSchema, Indexer extends TSchema>(type: Type, indexer: Indexer): TOmit<Type, Indexer>;
34
+ Partial<Type extends TSchema, const O extends TSchemaOptions>(type: Type, options: O): PreserveOptions<TPartial<Type>, O>;
35
+ Partial<Type extends TSchema>(type: Type): TPartial<Type>;
36
+ Pick<Type extends TSchema, Indexer extends PropertyKey[], const O extends TSchemaOptions>(type: Type, indexer: readonly [...Indexer], options: O): PreserveOptions<TPick<Type, TKeysToIndexer<Indexer>>, O>;
37
+ Pick<Type extends TSchema, Indexer extends PropertyKey[]>(type: Type, indexer: readonly [...Indexer]): TPick<Type, TKeysToIndexer<Indexer>>;
38
+ Pick<Type extends TSchema, Indexer extends TSchema, const O extends TSchemaOptions>(type: Type, indexer: Indexer, options: O): PreserveOptions<TPick<Type, Indexer>, O>;
39
+ Pick<Type extends TSchema, Indexer extends TSchema>(type: Type, indexer: Indexer): TPick<Type, Indexer>;
40
+ Object<Properties extends Record<PropertyKey, TSchema>, const O extends TObjectOptions>(properties: Properties, options: O): PreserveOptions<TObject<Properties>, O>;
41
+ Object<Properties extends Record<PropertyKey, TSchema>>(properties: Properties): TObject<Properties>;
42
+ Record<Key extends TSchema, Value extends TSchema, const O extends TObjectOptions>(key: Key, value: Value, options: O): PreserveOptions<TRecordAction<Key, Value>, O>;
43
+ Record<Key extends TSchema, Value extends TSchema>(key: Key, value: Value): TRecordAction<Key, Value>;
44
+ Required<Type extends TSchema, const O extends TSchemaOptions>(type: Type, options: O): PreserveOptions<TRequired<Type>, O>;
45
+ Required<Type extends TSchema>(type: Type): TRequired<Type>;
46
+ String<const O extends TStringOptions>(options: O): PreserveOptions<TString, O>;
47
+ String(): TString;
48
+ Tuple<Types extends TSchema[], const O extends TTupleOptions>(types: [...Types], options: O): PreserveOptions<TTuple<Types>, O>;
49
+ Tuple<Types extends TSchema[]>(types: [...Types]): TTuple<Types>;
50
+ Undefined<const O extends TSchemaOptions>(options: O): PreserveOptions<TUndefined, O>;
51
+ Undefined(): TUndefined;
52
+ Union<Types extends TSchema[], const O extends TSchemaOptions>(anyOf: [...Types], options: O): PreserveOptions<TUnion<Types>, O>;
53
+ Union<Types extends TSchema[]>(anyOf: [...Types]): TUnion<Types>;
54
+ Unknown<const O extends TSchemaOptions>(options: O): PreserveOptions<TUnknown, O>;
55
+ Unknown(): TUnknown;
56
+ Void<const O extends TSchemaOptions>(options: O): PreserveOptions<TVoid, O>;
57
+ Void(): TVoid;
58
+ };
59
+ export type { Static, TSchema } from "typebox";
60
+ export type { AgentSessionAdapter, CompleteAdapter, CompleteStageOpts, GitWorktreeSetupOptions, GitWorktreeSetupResult, PromptAdapter, PromptOptions, ResolvedInputs, RunResult, RunStatus, StageAdapters, StageStatus, StageOptions, StageContext, StageSnapshot, StageExecutionMeta, StageMcpOptions, StageOutputOptions, StagePromptOptions, StageSessionCreateOptions, StageSessionCreateResult, StageSessionRuntime, WorkflowAction, WorkflowArtifact, WorkflowChainOptions, WorkflowChainStep, WorkflowChildResult, WorkflowContextMode, WorkflowControlEvent, WorkflowCustomToolDefinition, WorkflowDetails, WorkflowDetailsMode, WorkflowDetailsStatus, WorkflowDirectOptions, WorkflowDirectTaskItem, WorkflowExecutionMode, WorkflowExecutionPolicy, WorkflowInputBindings, WorkflowInputSchema, WorkflowInputSchemaMap, WorkflowInputValues, WorkflowIntercomSummary, WorkflowMaxOutput, WorkflowMcpPort, WorkflowModelAttempt, WorkflowModelCatalogPort, WorkflowModelFallbackFields, WorkflowModelInfo, WorkflowModelUsage, WorkflowModelValue, WorkflowOutputMode, WorkflowOutputSchema, WorkflowOutputSchemaMap, WorkflowOutputValues, WorkflowParallelChainStep, WorkflowParallelOptions, WorkflowPersistencePort, WorkflowProgressSummary, WorkflowRunChildOptions, WorkflowRunOutput, WorkflowRuntimeConfig, WorkflowSerializableObject, WorkflowSerializablePrimitive, WorkflowSerializableValue, WorkflowSharedTaskDefaults, WorkflowTaskContext, WorkflowTaskContextInput, WorkflowTaskOptions, WorkflowTaskResult, WorkflowTaskSessionFields, WorkflowTaskSessionOptions, WorkflowTaskStep, WorkflowThinkingLevel, WorkflowUIAdapter, WorkflowUIContext, WorkflowWorktreeInputBinding, } from "./shared/authoring-contract.js";
61
+ import type * as AuthoringContract from "./shared/authoring-contract.js";
62
+ import type { GitWorktreeSetupOptions, GitWorktreeSetupResult, ResolvedInputs, RunResult, RunStatus, StageSnapshot, WorkflowDefinition as WorkflowContractDefinition, WorkflowDetails, WorkflowDirectOptions, WorkflowDirectTaskItem, WorkflowExecutionPolicy, WorkflowInputValues, WorkflowOutputValues, WorkflowSerializableObject, WorkflowChainStep } from "./shared/authoring-contract.js";
63
+ declare const workflowDefinitionBrand: unique symbol;
64
+ type WorkflowDefinitionBrand = {
65
+ readonly [workflowDefinitionBrand]: true;
66
+ };
67
+ export interface WorkflowDefinition<TInputs extends WorkflowInputValues = WorkflowInputValues, TOutputs extends WorkflowOutputValues = WorkflowOutputValues, TRunInputs extends WorkflowInputValues = TInputs, TDefinitionBrand extends object = WorkflowDefinitionBrand> extends WorkflowContractDefinition<TInputs, TOutputs, TRunInputs, TDefinitionBrand>, WorkflowDefinitionBrand {
68
+ }
69
+ export type WorkflowRunContext<TInputs extends WorkflowInputValues = WorkflowInputValues> = AuthoringContract.WorkflowRunContext<TInputs, WorkflowDefinitionBrand>;
70
+ export type WorkflowRunFn<TInputs extends WorkflowInputValues = WorkflowInputValues, TOutputs extends WorkflowOutputValues = WorkflowOutputValues> = AuthoringContract.WorkflowRunFn<TInputs, TOutputs, WorkflowDefinitionBrand>;
71
+ export type AnyWorkflowDefinition = WorkflowDefinition<WorkflowInputValues, WorkflowOutputValues, WorkflowInputValues>;
72
+ export type WorkflowBuilder<TInputs extends WorkflowInputValues = {}, TOutputs extends WorkflowOutputValues = {}, TRunInputs extends WorkflowInputValues = TInputs> = AuthoringContract.WorkflowBuilder<TInputs, TOutputs, TRunInputs, WorkflowDefinitionBrand, WorkflowDefinition<TInputs, TOutputs, TRunInputs>>;
73
+ export type CompletedWorkflowBuilder<TInputs extends WorkflowInputValues = {}, TOutputs extends WorkflowOutputValues = {}, TRunInputs extends WorkflowInputValues = TInputs> = AuthoringContract.CompletedWorkflowBuilder<TInputs, TOutputs, TRunInputs, WorkflowDefinitionBrand, WorkflowDefinition<TInputs, TOutputs, TRunInputs>>;
74
+ export type RunContinuationOpts = AuthoringContract.RunContinuationOpts;
75
+ export type WorkflowParentRunLink = AuthoringContract.WorkflowParentRunLink;
76
+ export type RunOpts = Omit<AuthoringContract.RunOpts, "registry"> & {
77
+ readonly registry?: WorkflowRegistry;
78
+ };
79
+ export declare const INTERACTIVE_WORKFLOW_POLICY: WorkflowExecutionPolicy;
80
+ export declare const NON_INTERACTIVE_WORKFLOW_POLICY: WorkflowExecutionPolicy;
81
+ export declare function run<TInputs extends WorkflowInputValues, TOutputs extends WorkflowOutputValues, TRunInputs extends WorkflowInputValues = TInputs>(definition: WorkflowDefinition<TInputs, TOutputs, TRunInputs>, inputs: Readonly<NoInfer<TRunInputs>>, opts?: RunOpts): Promise<RunResult<TOutputs>>;
82
+ export declare function runTask(task: WorkflowDirectTaskItem, runOptions?: RunOpts): Promise<WorkflowDetails>;
83
+ export declare function runTask(task: WorkflowDirectTaskItem, options?: WorkflowDirectOptions, runOptions?: RunOpts): Promise<WorkflowDetails>;
84
+ export declare function runParallel(tasks: readonly WorkflowDirectTaskItem[], options?: WorkflowDirectOptions, runOptions?: RunOpts): Promise<WorkflowDetails>;
85
+ export declare function runChain(steps: readonly WorkflowChainStep[], options?: WorkflowDirectOptions, runOptions?: RunOpts): Promise<WorkflowDetails>;
86
+ export declare function resolveInputs<TInputs extends WorkflowInputValues>(schema: Readonly<Record<keyof TInputs & string, TSchema>>, provided: Partial<TInputs>): ResolvedInputs<TInputs>;
87
+ export declare function setupGitWorktree(options: GitWorktreeSetupOptions): GitWorktreeSetupResult;
88
+ export interface WorkflowRegistry {
89
+ register<TInputs extends WorkflowInputValues, TOutputs extends WorkflowOutputValues>(definition: WorkflowDefinition<TInputs, TOutputs>): WorkflowRegistry;
90
+ merge(other: WorkflowRegistry): WorkflowRegistry;
91
+ get(name: string): AnyWorkflowDefinition | undefined;
92
+ has(name: string): boolean;
93
+ remove(name: string): WorkflowRegistry;
94
+ names(): string[];
95
+ all(): AnyWorkflowDefinition[];
96
+ }
97
+ /**
98
+ * @deprecated Removed imperative workflow API. This runtime value only throws
99
+ * a migration error; author workflows with defineWorkflow(...).compile().
100
+ */
101
+ export declare const runWorkflow: never;
102
+ export declare function defineWorkflow(name: string): WorkflowBuilder;
103
+ export declare function createRegistry<TDefinitions extends readonly AnyWorkflowDefinition[] = readonly AnyWorkflowDefinition[]>(initial?: TDefinitions): WorkflowRegistry;
104
+ export declare function normalizeWorkflowName(name: string): string;
105
+ export declare function workflowNamesEqual(a: string, b: string): boolean;
106
+ export declare class GraphFrontierTracker {
107
+ onSpawn(stageId: string, stageName: string): string[];
108
+ currentParents(): string[];
109
+ replaceParents(stageId: string, parentIds: readonly string[]): void;
110
+ onSettle(stageId: string): void;
111
+ getNodes(): StageNode[];
112
+ getParents(stageId: string): string[];
113
+ reset(): void;
114
+ }
115
+ export interface StageNode extends WorkflowSerializableObject {
116
+ readonly id: string;
117
+ readonly name: string;
118
+ readonly parentIds: readonly string[];
119
+ }
120
+ export type NoticeLevel = "info" | "warning" | "error";
121
+ export type PromptKind = "input" | "confirm" | "select" | "editor";
122
+ export interface PendingPrompt extends WorkflowSerializableObject {
123
+ readonly id: string;
124
+ readonly kind: PromptKind;
125
+ readonly message: string;
126
+ readonly choices?: readonly string[];
127
+ readonly initial?: string;
128
+ readonly createdAt: number;
129
+ }
130
+ export interface ToolEvent {
131
+ readonly name: string;
132
+ readonly input?: Record<string, unknown>;
133
+ readonly output?: string;
134
+ readonly startedAt?: number;
135
+ readonly endedAt?: number;
136
+ }
137
+ export interface WorkflowNotice extends WorkflowSerializableObject {
138
+ readonly id: string;
139
+ readonly runId?: string;
140
+ readonly stageId?: string;
141
+ readonly level: NoticeLevel;
142
+ readonly message: string;
143
+ readonly createdAt: number;
144
+ readonly requiresAck?: boolean;
145
+ readonly ackedAt?: number;
146
+ }
147
+ export interface WorkflowOverlayAdapter {
148
+ show(notice: WorkflowNotice): void;
149
+ hide(): void;
150
+ }
151
+ export interface RunSnapshot {
152
+ readonly id: string;
153
+ readonly name: string;
154
+ readonly status: RunStatus;
155
+ readonly stages: readonly StageSnapshot[];
156
+ readonly startedAt: number;
157
+ readonly endedAt?: number;
158
+ readonly durationMs?: number;
159
+ readonly result?: WorkflowOutputValues;
160
+ readonly error?: string;
161
+ readonly pendingPrompt?: PendingPrompt;
162
+ }
163
+ export interface StoreSnapshot {
164
+ readonly runs: readonly RunSnapshot[];
165
+ readonly notices: readonly WorkflowNotice[];
166
+ readonly version: number;
167
+ }
168
+ export interface Store {
169
+ runs(): readonly RunSnapshot[];
170
+ notices(): readonly WorkflowNotice[];
171
+ activeRunId(): string | null;
172
+ recordRunStart(run: RunSnapshot): void;
173
+ recordStageStart(runId: string, stage: StageSnapshot): void;
174
+ recordToolStart(runId: string, stageId: string, evt: ToolEvent): void;
175
+ recordToolEnd(runId: string, stageId: string, evt: ToolEvent): void;
176
+ recordStageEnd(runId: string, stage: StageSnapshot): void;
177
+ recordRunEnd(runId: string, status: RunStatus, result?: WorkflowOutputValues, error?: string): boolean;
178
+ removeRun(runId: string): boolean;
179
+ recordNotice(notice: WorkflowNotice): void;
180
+ ackNotice(id: string): boolean;
181
+ }
182
+ export declare function createStore(): Store;
183
+ export declare const store: Store;
184
+ export interface ActiveRunEntry {
185
+ readonly controller: AbortController;
186
+ readonly children: readonly AbortController[];
187
+ }
188
+ export interface CancellationRegistry {
189
+ register(runId: string, controller: AbortController): void;
190
+ registerChild(runId: string, controller: AbortController): void;
191
+ abort(runId: string, reason?: unknown): boolean;
192
+ abortAll(reason?: unknown): number;
193
+ unregister(runId: string): void;
194
+ isAborted(runId: string): boolean;
195
+ }
196
+ export declare function createCancellationRegistry(): CancellationRegistry;
197
+ export declare const cancellationRegistry: CancellationRegistry;
@@ -8,26 +8,17 @@
8
8
 
9
9
  import { createJiti } from "jiti/static";
10
10
  import * as workflowsSdkSurface from "../sdk-surface.js";
11
+ import { isBrandedWorkflowDefinition } from "../workflows/define-workflow.js";
11
12
  import deepResearchCodebase from "../../builtin/deep-research-codebase.js";
12
13
  import goal from "../../builtin/goal.js";
13
14
  import openClaudeDesign from "../../builtin/open-claude-design.js";
14
15
  import ralph from "../../builtin/ralph.js";
15
16
 
16
- type RunWorkflowFunction = typeof import("../runs/shared/workflow-runner.js").runWorkflow;
17
-
18
- const runWorkflow: RunWorkflowFunction = async (...args) => {
19
- const { runWorkflow: actualRunWorkflow } = await import("../runs/shared/workflow-runner.js");
20
- return actualRunWorkflow(...args);
21
- };
22
-
23
17
  const WORKFLOWS_MODULE_SPECIFIER = "@bastani/workflows";
24
18
  const WORKFLOWS_BUILTIN_MODULE_SPECIFIER = `${WORKFLOWS_MODULE_SPECIFIER}/builtin`;
25
- // Keep this in sync with index.ts through sdk-surface.ts. runWorkflow stays as
26
- // a lazy wrapper because the public re-export comes from workflow-runner.ts,
27
- // which imports discovery.ts and would otherwise reintroduce a cycle.
19
+ // Keep this in sync with index.ts through sdk-surface.ts.
28
20
  const WORKFLOWS_SDK_MODULE: Record<string, unknown> = {
29
21
  ...workflowsSdkSurface,
30
- runWorkflow,
31
22
  };
32
23
  const WORKFLOWS_BUILTIN_MODULE: Record<string, unknown> = {
33
24
  deepResearchCodebase,
@@ -104,7 +95,10 @@ export function validateWorkflowDefinitionShape(value: unknown): string | null {
104
95
  const d = value as Record<string, unknown>;
105
96
 
106
97
  if (d["__piWorkflow"] !== true) {
107
- return "missing or incorrect __piWorkflow sentinel (expected true)";
98
+ return "missing or incorrect __piWorkflow sentinel (expected true); export a workflow from defineWorkflow(...).compile()";
99
+ }
100
+ if (!isBrandedWorkflowDefinition(value)) {
101
+ return "workflow definition is not produced by defineWorkflow(...).compile(); hand-rolled __piWorkflow objects are not supported";
108
102
  }
109
103
  if (typeof d["name"] !== "string" || (d["name"] as string).trim().length === 0) {
110
104
  return "name must be a non-empty string";
@@ -42,7 +42,7 @@ const StageSessionOptionProperties = {
42
42
  agentDir: Type.Optional(Type.String()),
43
43
  authStorage: Type.Optional(SdkSessionOptionSchema("authStorage")),
44
44
  modelRegistry: Type.Optional(SdkSessionOptionSchema("modelRegistry")),
45
- model: Type.Optional(Type.Unsafe<WorkflowModelValue>({})),
45
+ model: Type.Optional(Type.Unsafe<WorkflowModelValue>({ description: "Primary model id or SDK model object. String ids may include a reasoning suffix, e.g. openai/gpt-5:high; valid levels: off|minimal|low|medium|high|xhigh." })),
46
46
  thinkingLevel: Type.Optional(SdkSessionOptionSchema("thinkingLevel")),
47
47
  scopedModels: Type.Optional(Type.Array(SdkSessionOptionArrayElementSchema("scopedModels"))),
48
48
  noTools: Type.Optional(Type.Unsafe<NonNullable<CreateAgentSessionOptions["noTools"]>>({
@@ -54,7 +54,8 @@ const StageSessionOptionProperties = {
54
54
  sessionManager: Type.Optional(SdkSessionOptionSchema("sessionManager")),
55
55
  settingsManager: Type.Optional(SdkSessionOptionSchema("settingsManager")),
56
56
  sessionStartEvent: Type.Optional(SdkSessionOptionSchema("sessionStartEvent")),
57
- fallbackModels: Type.Optional(Type.Array(Type.String())),
57
+ fallbackModels: Type.Optional(Type.Array(Type.String({ description: "Fallback model id; may include a reasoning suffix like :low or :off." }))),
58
+ fallbackThinkingLevels: Type.Optional(Type.Array(Type.String({ description: "Deprecated compatibility helper aligned to fallbackModels; ignored when the fallback model has a :level suffix." }))),
58
59
  mcp: Type.Optional(McpOptionsSchema),
59
60
  sessionDir: Type.Optional(Type.String()),
60
61
  context: Type.Optional(Type.Union([Type.Literal("fresh"), Type.Literal("fork")])),
@@ -7,9 +7,4 @@
7
7
  // virtual SDK used by workflow discovery stays in lockstep with this entry.
8
8
  export * from "./sdk-surface.js";
9
9
 
10
- // runWorkflow is exported here only: workflow-runner imports discovery.ts, so
11
- // discovery provides a lazy wrapper instead of importing this entry eagerly.
12
- export { runWorkflow } from "./runs/shared/workflow-runner.js";
13
- export type { WorkflowOptions, WorkflowRunOptions } from "./runs/shared/workflow-runner.js";
14
-
15
10
  // Note: `Type` / `Static` / `TSchema` are re-exported via ./sdk-surface.js.