@bastani/atomic 0.6.4 → 0.6.5-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/.agents/skills/create-spec/SKILL.md +6 -3
  2. package/.agents/skills/tdd/SKILL.md +107 -0
  3. package/.agents/skills/tdd/deep-modules.md +33 -0
  4. package/.agents/skills/tdd/interface-design.md +31 -0
  5. package/.agents/skills/tdd/mocking.md +59 -0
  6. package/.agents/skills/tdd/refactoring.md +10 -0
  7. package/.agents/skills/tdd/tests.md +61 -0
  8. package/.agents/skills/workflow-creator/SKILL.md +550 -0
  9. package/.agents/skills/workflow-creator/references/agent-sessions.md +891 -0
  10. package/.agents/skills/workflow-creator/references/agent-setup-recipe.md +266 -0
  11. package/.agents/skills/workflow-creator/references/computation-and-validation.md +201 -0
  12. package/.agents/skills/workflow-creator/references/control-flow.md +470 -0
  13. package/.agents/skills/workflow-creator/references/failure-modes.md +1014 -0
  14. package/.agents/skills/workflow-creator/references/getting-started.md +392 -0
  15. package/.agents/skills/workflow-creator/references/registry-and-validation.md +141 -0
  16. package/.agents/skills/workflow-creator/references/running-workflows.md +418 -0
  17. package/.agents/skills/workflow-creator/references/session-config.md +384 -0
  18. package/.agents/skills/workflow-creator/references/state-and-data-flow.md +356 -0
  19. package/.agents/skills/workflow-creator/references/user-input.md +234 -0
  20. package/.agents/skills/workflow-creator/references/workflow-inputs.md +392 -0
  21. package/.claude/agents/debugger.md +2 -2
  22. package/.claude/agents/reviewer.md +1 -1
  23. package/.claude/agents/worker.md +2 -2
  24. package/.github/agents/debugger.md +1 -1
  25. package/.github/agents/worker.md +1 -1
  26. package/.mcp.json +5 -1
  27. package/.opencode/agents/debugger.md +1 -1
  28. package/.opencode/agents/worker.md +1 -1
  29. package/README.md +236 -201
  30. package/dist/sdk/define-workflow.d.ts +11 -6
  31. package/dist/sdk/define-workflow.d.ts.map +1 -1
  32. package/dist/sdk/errors.d.ts +10 -0
  33. package/dist/sdk/errors.d.ts.map +1 -1
  34. package/dist/sdk/index.d.ts +21 -9
  35. package/dist/sdk/index.d.ts.map +1 -1
  36. package/dist/sdk/primitives/inputs.d.ts +36 -0
  37. package/dist/sdk/primitives/inputs.d.ts.map +1 -0
  38. package/dist/sdk/primitives/metadata.d.ts +40 -0
  39. package/dist/sdk/primitives/metadata.d.ts.map +1 -0
  40. package/dist/sdk/primitives/run.d.ts +57 -0
  41. package/dist/sdk/primitives/run.d.ts.map +1 -0
  42. package/dist/sdk/primitives/sessions.d.ts +128 -0
  43. package/dist/sdk/primitives/sessions.d.ts.map +1 -0
  44. package/dist/sdk/runtime/executor.d.ts +24 -56
  45. package/dist/sdk/runtime/executor.d.ts.map +1 -1
  46. package/dist/sdk/runtime/orchestrator-entry.d.ts +26 -0
  47. package/dist/sdk/runtime/orchestrator-entry.d.ts.map +1 -0
  48. package/dist/sdk/runtime/tmux.d.ts +20 -0
  49. package/dist/sdk/runtime/tmux.d.ts.map +1 -1
  50. package/dist/sdk/types.d.ts +26 -86
  51. package/dist/sdk/types.d.ts.map +1 -1
  52. package/dist/sdk/workflows/builtin/deep-research-codebase/claude/index.d.ts.map +1 -1
  53. package/dist/sdk/workflows/builtin/deep-research-codebase/copilot/index.d.ts.map +1 -1
  54. package/dist/sdk/workflows/builtin/deep-research-codebase/opencode/index.d.ts.map +1 -1
  55. package/dist/sdk/workflows/builtin/open-claude-design/claude/index.d.ts.map +1 -1
  56. package/dist/sdk/workflows/builtin/open-claude-design/copilot/index.d.ts.map +1 -1
  57. package/dist/sdk/workflows/builtin/open-claude-design/opencode/index.d.ts.map +1 -1
  58. package/dist/sdk/workflows/builtin/ralph/claude/index.d.ts.map +1 -1
  59. package/dist/sdk/workflows/builtin/ralph/copilot/index.d.ts.map +1 -1
  60. package/dist/sdk/workflows/builtin/ralph/opencode/index.d.ts.map +1 -1
  61. package/dist/sdk/workflows/index.d.ts +20 -12
  62. package/dist/sdk/workflows/index.d.ts.map +1 -1
  63. package/dist/services/config/additional-instructions.d.ts +1 -1
  64. package/dist/services/config/additional-instructions.d.ts.map +1 -1
  65. package/package.json +4 -4
  66. package/src/cli.ts +39 -56
  67. package/src/commands/builtin-registry.ts +37 -0
  68. package/src/commands/cli/chat/index.ts +1 -3
  69. package/src/{sdk → commands/cli}/management-commands.ts +15 -55
  70. package/src/commands/cli/session.ts +1 -1
  71. package/src/commands/cli/workflow-command.test.ts +250 -16
  72. package/src/commands/cli/workflow-inputs.test.ts +1 -0
  73. package/src/commands/cli/workflow-inputs.ts +13 -3
  74. package/src/commands/cli/workflow-list.test.ts +1 -0
  75. package/src/commands/cli/workflow-list.ts +0 -0
  76. package/src/commands/cli/workflow-status.ts +1 -1
  77. package/src/commands/cli/workflow.ts +191 -11
  78. package/src/sdk/define-workflow.test.ts +47 -16
  79. package/src/sdk/define-workflow.ts +24 -6
  80. package/src/sdk/errors.test.ts +11 -0
  81. package/src/sdk/errors.ts +13 -0
  82. package/src/sdk/index.test.ts +92 -0
  83. package/src/sdk/index.ts +71 -15
  84. package/src/sdk/primitives/inputs.ts +48 -0
  85. package/src/sdk/primitives/metadata.ts +63 -0
  86. package/src/sdk/primitives/run.ts +81 -0
  87. package/src/sdk/primitives/sessions.test.ts +594 -0
  88. package/src/sdk/primitives/sessions.ts +328 -0
  89. package/src/sdk/runtime/executor.ts +36 -115
  90. package/src/sdk/runtime/orchestrator-entry.ts +110 -0
  91. package/src/sdk/runtime/tmux.ts +33 -0
  92. package/src/sdk/types.ts +26 -91
  93. package/src/sdk/workflows/builtin/deep-research-codebase/claude/index.ts +1 -0
  94. package/src/sdk/workflows/builtin/deep-research-codebase/copilot/index.ts +1 -0
  95. package/src/sdk/workflows/builtin/deep-research-codebase/opencode/index.ts +1 -0
  96. package/src/sdk/workflows/builtin/open-claude-design/claude/index.ts +1 -0
  97. package/src/sdk/workflows/builtin/open-claude-design/copilot/index.ts +1 -0
  98. package/src/sdk/workflows/builtin/open-claude-design/opencode/index.ts +1 -0
  99. package/src/sdk/workflows/builtin/ralph/claude/index.ts +1 -0
  100. package/src/sdk/workflows/builtin/ralph/copilot/index.ts +1 -0
  101. package/src/sdk/workflows/builtin/ralph/opencode/index.ts +1 -0
  102. package/src/sdk/workflows/index.ts +68 -51
  103. package/src/services/config/additional-instructions.ts +1 -1
  104. package/.agents/skills/test-driven-development/SKILL.md +0 -371
  105. package/.agents/skills/test-driven-development/testing-anti-patterns.md +0 -299
  106. package/dist/commands/cli/session.d.ts +0 -67
  107. package/dist/commands/cli/session.d.ts.map +0 -1
  108. package/dist/commands/cli/workflow-status.d.ts +0 -63
  109. package/dist/commands/cli/workflow-status.d.ts.map +0 -1
  110. package/dist/sdk/commander.d.ts +0 -74
  111. package/dist/sdk/commander.d.ts.map +0 -1
  112. package/dist/sdk/management-commands.d.ts +0 -42
  113. package/dist/sdk/management-commands.d.ts.map +0 -1
  114. package/dist/sdk/workflow-cli.d.ts +0 -103
  115. package/dist/sdk/workflow-cli.d.ts.map +0 -1
  116. package/dist/sdk/workflows/builtin-registry.d.ts +0 -113
  117. package/dist/sdk/workflows/builtin-registry.d.ts.map +0 -1
  118. package/src/sdk/commander.ts +0 -161
  119. package/src/sdk/workflow-cli.ts +0 -409
  120. package/src/sdk/workflows/builtin-registry.ts +0 -23
@@ -13,12 +13,17 @@
13
13
  import type { AgentType, WorkflowOptions, WorkflowContext, WorkflowDefinition, WorkflowInput } from "./types.ts";
14
14
  type AnyInputs = readonly WorkflowInput[];
15
15
  /**
16
- * Flag and subcommand names reserved by the worker CLI that cannot be used as
17
- * workflow input names. The first block (`name` / `agent` / `detach` / `list`
18
- * / `help` / `version`) collides with Commander's own flags on the root
19
- * command; the second block (`session` / `status`) collides with the auto-
20
- * registered management subcommands added by `createWorkflowCli` when
21
- * `includeManagementCommands` is left at its default (`true`).
16
+ * Input names reserved because they collide with the atomic CLI's `workflow`
17
+ * subcommand surface. The first block (`name` / `agent` / `detach` / `list`
18
+ * / `help` / `version`) collides with the atomic CLI's `workflow` subcommand
19
+ * flags (`-n/--name`, `-a/--agent`, `-d/--detach`, `-l/--list`, `-h/--help`,
20
+ * `-v/--version`). The second block (`session` / `status`) collides with the
21
+ * atomic CLI's management subcommands (`atomic workflow session …`,
22
+ * `atomic workflow status`).
23
+ *
24
+ * User-app CLIs built with the SDK primitives are NOT bound by these
25
+ * reservations at runtime — the check runs only inside `defineWorkflow` so
26
+ * that workflows remain portable to the atomic CLI without renaming.
22
27
  */
23
28
  export declare const RESERVED_INPUT_NAMES: readonly ["name", "agent", "detach", "list", "help", "version", "session", "status"];
24
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"define-workflow.d.ts","sourceRoot":"","sources":["../../src/sdk/define-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,KAAK,SAAS,GAAG,SAAS,aAAa,EAAE,CAAC;AAE1C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,sFASvB,CAAC;AAgEX;;;GAGG;AACH,qBAAa,eAAe,CAC1B,CAAC,SAAS,SAAS,GAAG,SAAS,EAC/B,CAAC,SAAS,SAAS,GAAG,SAAS;IAE/B,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAG,iBAAiB,CAAU;IAC9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,KAAK,CAAgE;IAC7E,OAAO,CAAC,UAAU,CAA0B;gBAEhC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IAIvC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,GAAG,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAOzD;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,EAAE,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,EAAE,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAW5D;;;;;OAKG;IACH,OAAO,IAAI,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC;CAyDpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAC5B,KAAK,CAAC,CAAC,SAAS,SAAS,aAAa,EAAE,GAAG,SAAS,aAAa,EAAE,EAEnE,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAC1B,eAAe,CAAC,SAAS,EAAE,CAAC,CAAC,CAK/B"}
@@ -19,6 +19,16 @@ export declare class InvalidWorkflowError extends Error {
19
19
  readonly path: string;
20
20
  constructor(path: string);
21
21
  }
22
+ /**
23
+ * Thrown by session primitives when the requested tmux session id is
24
+ * not present on the atomic socket. Carries the id so the CLI layer can
25
+ * render an actionable "run `atomic session list` to see what's
26
+ * running" hint without parsing message text.
27
+ */
28
+ export declare class SessionNotFoundError extends Error {
29
+ readonly id: string;
30
+ constructor(id: string);
31
+ }
22
32
  /**
23
33
  * Thrown when a workflow declares a `minSDKVersion` newer than the
24
34
  * bundled CLI. Carries both versions so the CLI can render an
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/sdk/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qEAAqE;AACrE,qBAAa,sBAAuB,SAAQ,KAAK;aACnB,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK;gBAApC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK;CAIjE;AAED,qEAAqE;AACrE,qBAAa,wBAAyB,SAAQ,KAAK;aACrB,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAUzC;AAED,8EAA8E;AAC9E,qBAAa,oBAAqB,SAAQ,KAAK;aACjB,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAOzC;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;aAE3B,IAAI,EAAE,MAAM;aACZ,eAAe,EAAE,MAAM;aACvB,cAAc,EAAE,MAAM;gBAFtB,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM;CAQzC;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/sdk/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qEAAqE;AACrE,qBAAa,sBAAuB,SAAQ,KAAK;aACnB,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK;gBAApC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK;CAIjE;AAED,qEAAqE;AACrE,qBAAa,wBAAyB,SAAQ,KAAK;aACrB,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAUzC;AAED,8EAA8E;AAC9E,qBAAa,oBAAqB,SAAQ,KAAK;aACjB,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAOzC;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;aACjB,EAAE,EAAE,MAAM;gBAAV,EAAE,EAAE,MAAM;CAIvC;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;aAE3B,IAAI,EAAE,MAAM;aACZ,eAAe,EAAE,MAAM;aACvB,cAAc,EAAE,MAAM;gBAFtB,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,MAAM;CAQzC;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD"}
@@ -1,14 +1,26 @@
1
1
  /**
2
- * atomic SDK
2
+ * @bastani/atomic SDK barrel.
3
3
  *
4
- * Public API barrel re-exports the SDK surface.
5
- * CLI-only concerns (colors, prompts, process management) are not exported here.
4
+ * Public API for authoring and running workflows. Composition primitives
5
+ * are pure functions; consumers wire them into their own CLI shape (via
6
+ * Commander, citty, yargs, an OpenTUI app, etc.). The SDK itself ships
7
+ * no opinionated CLI wrapper.
6
8
  */
7
- export { MissingDependencyError, WorkflowNotCompiledError, InvalidWorkflowError, } from "./errors.ts";
8
- export type { AgentType, Transcript, SavedMessage, SaveTranscript, SessionContext, SessionRef, SessionHandle, SessionRunOptions, WorkflowContext, WorkflowOptions, WorkflowDefinition, StageClientOptions, StageSessionOptions, ProviderClient, ProviderSession, } from "./types.ts";
9
- export { defineWorkflow } from "./define-workflow.ts";
10
- export type { Registry } from "./registry.ts";
9
+ export { MissingDependencyError, WorkflowNotCompiledError, InvalidWorkflowError, SessionNotFoundError, } from "./errors.ts";
10
+ export { defineWorkflow, WorkflowBuilder } from "./define-workflow.ts";
11
11
  export { createRegistry } from "./registry.ts";
12
- export { createWorkflowCli } from "./workflow-cli.ts";
13
- export type { WorkflowCli, CreateWorkflowCliOptions } from "./types.ts";
12
+ export type { Registry } from "./registry.ts";
13
+ export type { AgentType, Transcript, SavedMessage, SaveTranscript, SessionContext, SessionRef, SessionHandle, SessionRunOptions, WorkflowContext, WorkflowOptions, WorkflowDefinition, WorkflowInput, WorkflowInputType, StageClientOptions, StageSessionOptions, ProviderClient, ProviderSession, } from "./types.ts";
14
+ export { getName, getDescription, getAgent, getInputSchema, getSource, getMinSDKVersion, } from "./primitives/metadata.ts";
15
+ import type { AgentType, Registry, WorkflowDefinition } from "./types.ts";
16
+ /** Snapshot every workflow registered in `registry`. */
17
+ export declare function listWorkflows(registry: Registry): readonly WorkflowDefinition[];
18
+ /** Resolve a workflow by `(name, agent)`; returns `undefined` when not found. */
19
+ export declare function getWorkflow(registry: Registry, agent: AgentType, name: string): WorkflowDefinition | undefined;
20
+ export { validateInputs } from "./primitives/inputs.ts";
21
+ export type { ResolvedInputs } from "./primitives/inputs.ts";
22
+ export { runWorkflow } from "./primitives/run.ts";
23
+ export type { RunWorkflowOptions, RunWorkflowResult, } from "./primitives/run.ts";
24
+ export { listSessions, getSession, stopSession, attachSession, detachSession, nextWindow, previousWindow, gotoOrchestrator, getSessionStatus, getSessionTranscript, } from "./primitives/sessions.ts";
25
+ export type { SessionInfo, SessionScope, StatusSnapshot, ListSessionsOptions, SessionPrimitiveDeps, } from "./primitives/sessions.ts";
14
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,cAAc,EACd,cAAc,EACd,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sdk/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAA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
3
+ *
4
+ * Wraps `validateAndResolve` from `worker-shared.ts` with a workflow-aware
5
+ * signature so consumers don't need to reach into the SDK internals to
6
+ * coerce, default, and validate raw user-supplied input maps.
7
+ */
8
+ import type { WorkflowInput } from "../types.ts";
9
+ /**
10
+ * Validated, defaults-applied input map. The shape matches
11
+ * `Record<string, string>` because the executor's tmux launcher serialises
12
+ * inputs as JSON strings; integer coercion happens later, inside
13
+ * `runOrchestrator`, against the same schema.
14
+ */
15
+ export type ResolvedInputs = Record<string, string>;
16
+ /**
17
+ * Structural shape `validateInputs` reads off a workflow definition.
18
+ * Typed as a minimal interface (rather than `WorkflowDefinition`) so the
19
+ * primitive accepts narrowly-typed compiled definitions without
20
+ * triggering contravariance failures in the `run` method signature.
21
+ */
22
+ export interface ValidatableWorkflow {
23
+ readonly inputs: readonly WorkflowInput[];
24
+ }
25
+ /**
26
+ * Validate raw user inputs against a workflow's declared schema.
27
+ *
28
+ * - Throws on unknown flags or missing required fields.
29
+ * - Applies declared defaults and the first enum value when no value is given.
30
+ * - Validates enum membership and integer parseability.
31
+ * - For free-form workflows (no declared inputs), passes through every
32
+ * non-empty key as-is — this preserves the legacy
33
+ * `--prompt "<text>"` shape.
34
+ */
35
+ export declare function validateInputs(workflow: ValidatableWorkflow, raw: Record<string, string>): ResolvedInputs;
36
+ //# sourceMappingURL=inputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../src/sdk/primitives/inputs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;CAC3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,mBAAmB,EAC7B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,cAAc,CAKhB"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Workflow metadata accessors.
3
+ *
4
+ * Function-style getters keep the public surface forward-compatible —
5
+ * adding optional metadata fields to `WorkflowDefinition` doesn't force
6
+ * every consumer to read directly off the object, so we can add lazy
7
+ * derivation, deprecation warnings, or normalization in one place.
8
+ */
9
+ import type { AgentType, WorkflowInput } from "../types.ts";
10
+ /**
11
+ * Structural shape the metadata accessors read off a workflow
12
+ * definition. Typed as a minimal interface (rather than the full
13
+ * `WorkflowDefinition<A, I>`) so the accessors accept narrowly-typed
14
+ * compiled definitions without triggering contravariance failures on
15
+ * the `run` method signature.
16
+ */
17
+ export interface MetadataWorkflow {
18
+ readonly name: string;
19
+ readonly description: string;
20
+ readonly agent: AgentType;
21
+ readonly inputs: readonly WorkflowInput[];
22
+ readonly source: string;
23
+ readonly minSDKVersion: string | null;
24
+ }
25
+ /** Workflow's unique name. */
26
+ export declare function getName(workflow: MetadataWorkflow): string;
27
+ /** Human-readable description (empty string when none was declared). */
28
+ export declare function getDescription(workflow: MetadataWorkflow): string;
29
+ /** Agent backend the workflow targets. */
30
+ export declare function getAgent(workflow: MetadataWorkflow): AgentType;
31
+ /** Frozen copy of the declared input schema (empty for free-form workflows). */
32
+ export declare function getInputSchema(workflow: MetadataWorkflow): readonly WorkflowInput[];
33
+ /** Absolute path of the workflow's source file (`import.meta.path`). */
34
+ export declare function getSource(workflow: MetadataWorkflow): string;
35
+ /**
36
+ * Minimum SDK version this workflow declares (or `null` when none was
37
+ * specified). Atomic uses this to gate stale workflows on older installs.
38
+ */
39
+ export declare function getMinSDKVersion(workflow: MetadataWorkflow): string | null;
40
+ //# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/sdk/primitives/metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,8BAA8B;AAC9B,wBAAgB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAE1D;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAEjE;AAED,0CAA0C;AAC1C,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,SAAS,CAE9D;AAED,gFAAgF;AAChF,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,gBAAgB,GACzB,SAAS,aAAa,EAAE,CAE1B;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAE5D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,gBAAgB,GACzB,MAAM,GAAG,IAAI,CAEf"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * `runWorkflow` primitive — the public entry point for spawning a
3
+ * workflow tmux session.
4
+ *
5
+ * Thin wrapper around the runtime executor's `executeWorkflow`. Handles
6
+ * the input-validation step so the executor's contract stays single-
7
+ * responsibility: caller passes raw inputs, primitive validates them
8
+ * against the workflow's schema, executor only sees a clean record.
9
+ */
10
+ import type { RegistrableWorkflow } from "../types.ts";
11
+ /** Options for `runWorkflow()`. */
12
+ export interface RunWorkflowOptions {
13
+ /** Compiled workflow definition (the default export of a workflow module). */
14
+ workflow: RegistrableWorkflow;
15
+ /**
16
+ * Raw input map. The primitive runs the same validation pipeline the
17
+ * atomic CLI uses: required-field check, default fill-in, enum and
18
+ * integer parsing. Pass an empty object for free-form workflows that
19
+ * don't take any user input.
20
+ */
21
+ inputs?: Record<string, string>;
22
+ /** Project root the workflow runs in. Defaults to `process.cwd()`. */
23
+ cwd?: string;
24
+ /**
25
+ * When true, create the tmux session and return immediately instead
26
+ * of attaching. The orchestrator keeps running in the background on
27
+ * the shared atomic tmux socket and can be reattached later via
28
+ * `attachSession()`.
29
+ */
30
+ detach?: boolean;
31
+ }
32
+ /** Result of a successful `runWorkflow()` call. */
33
+ export interface RunWorkflowResult {
34
+ /** Workflow run id (8-char hex; the trailing segment of the tmux session name). */
35
+ id: string;
36
+ /** Tmux session name (`atomic-wf-<agent>-<workflowName>-<id>`). */
37
+ tmuxSessionName: string;
38
+ }
39
+ /**
40
+ * Run a compiled workflow.
41
+ *
42
+ * Validates inputs, then spawns the orchestrator tmux session via
43
+ * `executeWorkflow`. In foreground mode, the returned promise resolves
44
+ * after the user detaches from the session; in `detach: true` mode the
45
+ * promise resolves as soon as the session is created on the atomic
46
+ * socket.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * import workflow from "./hello.ts";
51
+ * import { runWorkflow } from "@bastani/atomic/workflows";
52
+ *
53
+ * await runWorkflow({ workflow, inputs: { greeting: "hi" } });
54
+ * ```
55
+ */
56
+ export declare function runWorkflow(options: RunWorkflowOptions): Promise<RunWorkflowResult>;
57
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/sdk/primitives/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAsB,MAAM,aAAa,CAAC;AAG3E,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,mDAAmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,EAAE,EAAE,MAAM,CAAC;IACX,mEAAmE;IACnE,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CAe5B"}
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Session-management primitives.
3
+ *
4
+ * Thin wrappers around the tmux runtime utilities and the on-disk
5
+ * `~/.atomic/sessions/<workflowRunId>/` layout. Consumers (atomic CLI,
6
+ * third-party CLIs, embedding TUIs) call these instead of touching tmux
7
+ * commands or the status-writer schema directly.
8
+ */
9
+ import { type SessionType, type TmuxSession } from "../runtime/tmux.ts";
10
+ import { readSnapshot, type WorkflowStatusSnapshot } from "../runtime/status-writer.ts";
11
+ import type { AgentType, SavedMessage } from "../types.ts";
12
+ /** Scope filter for session listings — chat sessions, workflow sessions, or both. */
13
+ export type SessionScope = "chat" | "workflow" | "all";
14
+ /** Single session entry returned by `listSessions` / `getSession`. */
15
+ export interface SessionInfo {
16
+ /** Tmux session name (e.g. `atomic-wf-claude-ralph-a1b2c3d4`). */
17
+ id: string;
18
+ /** Session type derived from the name prefix. */
19
+ type?: SessionType;
20
+ /** Agent backend that owns this session. */
21
+ agent?: string;
22
+ /** ISO 8601 creation timestamp. */
23
+ created: string;
24
+ /** Whether a tmux client is currently attached. */
25
+ attached: boolean;
26
+ }
27
+ /** Status snapshot persisted by the orchestrator at `~/.atomic/sessions/<id>/status.json`. */
28
+ export type StatusSnapshot = WorkflowStatusSnapshot;
29
+ /** Options for filtering `listSessions()`. */
30
+ export interface ListSessionsOptions {
31
+ /** Restrict to one or more agent backends. */
32
+ agent?: AgentType | readonly AgentType[];
33
+ /** Restrict by session kind. Defaults to `"all"`. */
34
+ scope?: SessionScope;
35
+ }
36
+ /**
37
+ * Injectable dependencies for the session primitives.
38
+ *
39
+ * Defaults wire through to the real tmux/status-writer implementations.
40
+ * Tests pass in mocks; embedding consumers can override the base directory
41
+ * or swap the tmux backend (e.g. for psmux on Windows) without monkey-
42
+ * patching the underlying modules.
43
+ */
44
+ export interface SessionPrimitiveDeps {
45
+ isTmuxInstalled: () => boolean;
46
+ listAllTmuxSessions: () => readonly TmuxSession[];
47
+ killSession: (id: string) => void;
48
+ attachSession: (id: string) => void;
49
+ detachClients: (id: string) => void;
50
+ nextWindow: (id: string) => void;
51
+ previousWindow: (id: string) => void;
52
+ /** `target` is a tmux window target like `<session>:<index>`. */
53
+ selectWindow: (target: string) => void;
54
+ readSnapshot: typeof readSnapshot;
55
+ /** Base directory for session artefacts. Defaults to `~/.atomic/sessions`. */
56
+ sessionsBaseDir: string;
57
+ }
58
+ /**
59
+ * List atomic-managed tmux sessions on the shared `atomic` socket.
60
+ *
61
+ * Returns an empty array when tmux is not installed or the server has no
62
+ * sessions — never throws on the cold-start path.
63
+ */
64
+ export declare function listSessions(options?: ListSessionsOptions, deps?: SessionPrimitiveDeps): SessionInfo[];
65
+ /** Look up a single session by id. Returns `undefined` when not found. */
66
+ export declare function getSession(id: string, deps?: SessionPrimitiveDeps): SessionInfo | undefined;
67
+ /**
68
+ * Stop a running session. Best-effort: if the session is already gone
69
+ * the underlying `tmux kill-session` is a no-op-equivalent.
70
+ */
71
+ export declare function stopSession(id: string, deps?: SessionPrimitiveDeps): Promise<void>;
72
+ /**
73
+ * Attach to a running session interactively. Only valid when the host
74
+ * process has a TTY — otherwise the underlying tmux invocation will
75
+ * complain that it can't take over the terminal.
76
+ */
77
+ export declare function attachSession(id: string, deps?: SessionPrimitiveDeps): Promise<void>;
78
+ /**
79
+ * Move the session's current-window pointer to the next window.
80
+ * Mirrors the `Ctrl+\` keybinding bound inside an attached client.
81
+ *
82
+ * Pure navigation: never attaches. An already-attached client sees the
83
+ * change live; if no client is watching, the session's current-window
84
+ * pointer is updated silently and a subsequent `attachSession` will
85
+ * land on the new window. Compose `nextWindow(id)` + `attachSession(id)`
86
+ * if you want navigate-then-attach.
87
+ */
88
+ export declare function nextWindow(id: string, deps?: SessionPrimitiveDeps): Promise<void>;
89
+ /**
90
+ * Move the session's current-window pointer to the previous window.
91
+ * Symmetrical counterpart to {@link nextWindow} — also pure navigation.
92
+ */
93
+ export declare function previousWindow(id: string, deps?: SessionPrimitiveDeps): Promise<void>;
94
+ /**
95
+ * Jump to the orchestrator window (window 0) of the target session.
96
+ * Mirrors the `Ctrl+G` keybinding bound inside an attached client.
97
+ *
98
+ * For workflow sessions, window 0 hosts the orchestrator graph view;
99
+ * for chat sessions, window 0 is the agent pane. Pure navigation —
100
+ * never attaches.
101
+ */
102
+ export declare function gotoOrchestrator(id: string, deps?: SessionPrimitiveDeps): Promise<void>;
103
+ /**
104
+ * Detach every client currently attached to a session. The session
105
+ * itself keeps running in the background — re-attach with
106
+ * {@link attachSession} or `tmux -L atomic attach -t <id>`.
107
+ *
108
+ * Best-effort, idempotent: returns silently when tmux is missing, the
109
+ * session is already gone, or no clients are attached.
110
+ */
111
+ export declare function detachSession(id: string, deps?: SessionPrimitiveDeps): Promise<void>;
112
+ /**
113
+ * Read the on-disk status snapshot for a workflow session. Returns
114
+ * `null` when the orchestrator hasn't written one yet (the workflow
115
+ * is still very early) or when the directory doesn't exist.
116
+ */
117
+ export declare function getSessionStatus(id: string, deps?: SessionPrimitiveDeps): Promise<StatusSnapshot | null>;
118
+ /**
119
+ * Read the saved native-message transcript for a single session inside
120
+ * a workflow run. `id` is the tmux session id (`atomic-wf-...`); the
121
+ * `sessionName` is the `name` passed to `ctx.stage({ name })` whose
122
+ * messages were saved via `s.save(...)`.
123
+ *
124
+ * Returns an empty array when no transcript was persisted (e.g. the
125
+ * workflow chose not to call `s.save`).
126
+ */
127
+ export declare function getSessionTranscript(id: string, sessionName: string, deps?: SessionPrimitiveDeps): Promise<SavedMessage[]>;
128
+ //# sourceMappingURL=sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/sdk/primitives/sessions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EASL,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EAEZ,KAAK,sBAAsB,EAC5B,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3D,qFAAqF;AACrF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AAEvD,sEAAsE;AACtE,MAAM,WAAW,WAAW;IAC1B,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,iDAAiD;IACjD,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,8FAA8F;AAC9F,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAEpD,8CAA8C;AAC9C,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,SAAS,EAAE,CAAC;IACzC,qDAAqD;IACrD,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,MAAM,OAA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CAGf;AAED;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,oBAAkC,GACvC,OAAO,CAAC,IAAI,CAAC,CAGf;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,oBAAkC,GACvC,OAAO,CAAC,IAAI,CAAC,CASf;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,oBAAkC,GACvC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAIhC;AAED;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,oBAAkC,GACvC,OAAO,CAAC,YAAY,EAAE,CAAC,CAezB"}
@@ -2,16 +2,20 @@
2
2
  * Workflow runtime executor.
3
3
  *
4
4
  * Architecture:
5
- * 1. `executeWorkflow()` is called by the CLI command or worker
6
- * 2. It creates a tmux session with an orchestrator pane that re-executes
7
- * the user's entrypoint file with `ATOMIC_ORCHESTRATOR_MODE=1`
5
+ * 1. `executeWorkflow()` is called by the CLI command (e.g. atomic) or by
6
+ * the SDK's `runWorkflow()` primitive
7
+ * 2. It creates a tmux session with an orchestrator pane that runs the
8
+ * SDK-owned `orchestrator-entry.ts` with three positional args:
9
+ * `<workflowSource> <agent> <inputsB64>`
8
10
  * 3. The CLI then attaches to the tmux session (user sees it live)
9
- * 4. The orchestrator pane calls `definition.run(workflowCtx)` the
10
- * user's callback uses `ctx.stage()` to spawn agent sessions
11
+ * 4. The orchestrator pane imports the workflow module by `source`,
12
+ * calls `runOrchestrator(definition, inputs)`, which then calls
13
+ * `definition.run(workflowCtx)` — the user's callback uses
14
+ * `ctx.stage()` to spawn agent sessions
11
15
  *
12
- * In the new model the user's own file (e.g. `src/worker.ts`) is re-executed
13
- * with env vars (`ATOMIC_ORCHESTRATOR_MODE`, `ATOMIC_WF_KEY`) that signal
14
- * re-entry. The worker detects those vars and calls `runOrchestrator(definition)`.
16
+ * The dev's CLI is never re-imported. The SDK orchestrator entry script
17
+ * is the only re-exec target, so there is no orchestrator-mode env var
18
+ * re-entry signal and no boilerplate in user code.
15
19
  */
16
20
  import type { WorkflowDefinition, WorkflowInput, AgentType, SavedMessage, StageClientOptions } from "../types.ts";
17
21
  export { errorMessage } from "../errors.ts";
@@ -27,19 +31,6 @@ export interface WorkflowRunOptions {
27
31
  * whether the workflow declares a schema. Empty record is valid.
28
32
  */
29
33
  inputs?: Record<string, string>;
30
- /**
31
- * Absolute path to the user's entrypoint file (e.g. `src/worker.ts`).
32
- * The launcher re-executes this file with `ATOMIC_ORCHESTRATOR_MODE=1`
33
- * so the worker can detect re-entry and call `runOrchestrator()`.
34
- * Defaults to `process.argv[1]` at the call site.
35
- */
36
- entrypointFile: string;
37
- /**
38
- * Registry key identifying this workflow, formatted as `"<agent>/<name>"`.
39
- * Passed via `ATOMIC_WF_KEY` so the orchestrator can resolve the
40
- * definition from the registry without a file-system scan.
41
- */
42
- workflowKey: string;
43
34
  /** Project root (defaults to cwd) */
44
35
  projectRoot?: string;
45
36
  /**
@@ -95,14 +86,6 @@ export declare function escBash(s: string): string;
95
86
  * variable expansion. Null bytes are stripped for safety.
96
87
  */
97
88
  export declare function escPwsh(s: string): string;
98
- /**
99
- * Decode the ATOMIC_WF_INPUTS env var (base64-encoded JSON) into a
100
- * `Record<string, string>`. Returns an empty record when the variable
101
- * is missing, malformed, or does not decode to a string-map object —
102
- * structured inputs are optional, so a corrupt payload must never
103
- * prevent free-form workflows from running.
104
- */
105
- export declare function parseInputsEnv(raw: string | undefined): Record<string, string>;
106
89
  /**
107
90
  * Coerce raw string inputs to their declared runtime types. Integer inputs
108
91
  * become `number`; every other declared type passes through as `string`.
@@ -120,7 +103,10 @@ export declare function coerceInputsBySchema(inputs: Record<string, string>, sch
120
103
  * orchestrator as the initial pane, then attaches so the user sees
121
104
  * everything live — even when invoked from inside another tmux session.
122
105
  */
123
- export declare function executeWorkflow(options: WorkflowRunOptions): Promise<void>;
106
+ export declare function executeWorkflow(options: WorkflowRunOptions): Promise<{
107
+ id: string;
108
+ tmuxSessionName: string;
109
+ }>;
124
110
  /** Type guard for objects with a string `content` property (Copilot assistant.message data). */
125
111
  export declare function hasContent(value: unknown): value is {
126
112
  content: string;
@@ -256,34 +242,16 @@ interface ExternalCopilotOptions {
256
242
  * token auth to the session-level option that 0.3.0 introduced for this case.
257
243
  */
258
244
  export declare function normalizeExternalCopilotOptions(clientOptions: StageClientOptions<"copilot">, sessionGitHubToken?: string): ExternalCopilotOptions;
259
- /**
260
- * Run the orchestrator inside a tmux pane.
261
- *
262
- * Called by the worker entrypoint when `ATOMIC_ORCHESTRATOR_MODE=1` is set.
263
- * The `definition` parameter is resolved by the caller (the worker) from the
264
- * registry using `ATOMIC_WF_KEY` — this function no longer performs any
265
- * file-path import or workflow discovery.
266
- *
267
- * @param definition - Resolved workflow definition from the registry.
268
- */
269
245
  export { validateOrchestratorEnv } from "./executor-env.ts";
270
246
  /**
271
- * Orchestrator re-entry guard.
272
- *
273
- * When `executeWorkflow()` spawns a detached pane, it re-invokes the
274
- * composition root with `ATOMIC_ORCHESTRATOR_MODE=1` +
275
- * `ATOMIC_WF_KEY="<agent>/<name>"`. This helper detects that re-entry
276
- * and hands off to `runOrchestrator()` with the resolved definition.
277
- *
278
- * Returns `true` when re-entry was handled (caller should stop normal
279
- * CLI flow). Returns `false` when `ATOMIC_ORCHESTRATOR_MODE` is unset
280
- * — the caller should proceed with argv parsing.
247
+ * Run the orchestrator for a compiled workflow definition.
281
248
  *
282
- * The `resolve` callback lets embedded workers pass a trivial lookup
283
- * (their single bound definition) while the dispatcher passes its
284
- * registry. Throws on malformed or unknown keys so authoring mistakes
285
- * surface loudly instead of silently hanging.
249
+ * Called by the SDK's `orchestrator-entry.ts` after it imports the
250
+ * workflow module by `source` and decodes the inputs payload from argv.
251
+ * The runtime environment (`ATOMIC_WF_ID`, `ATOMIC_WF_TMUX`,
252
+ * `ATOMIC_WF_AGENT`, `ATOMIC_WF_CWD`) is set by the launcher script that
253
+ * `executeWorkflow()` writes — those vars describe *where* this
254
+ * orchestrator is running, not what to do.
286
255
  */
287
- export declare function handleOrchestratorReEntry(resolve: (name: string, agent: AgentType) => WorkflowDefinition | undefined): Promise<boolean>;
288
- export declare function runOrchestrator(definition: WorkflowDefinition): Promise<void>;
256
+ export declare function runOrchestrator(definition: WorkflowDefinition, inputs?: Record<string, string>): Promise<void>;
289
257
  //# sourceMappingURL=executor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/sdk/runtime/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,KAAK,EACV,kBAAkB,EAElB,aAAa,EAKb,SAAS,EAET,YAAY,EAEZ,kBAAkB,EAInB,MAAM,aAAa,CAAC;AAyErB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAa5C,MAAM,WAAW,kBAAkB;IACjC,uCAAuC;IACvC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,iBAAiB;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC;;;;;OAKG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAoDD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,SAAS,CAgB1D;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,OAAO,CAKtD;AAyBD;;;;;GAKG;AACH,wBAAgB,yBA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AC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAC5C,kBAAkB,CAAC,EAAE,MAAM,GAC1B,sBAAsB,CAsBxB;AAsnBD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAG5D;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,UAAU,EAAE,kBAAkB,EAC9B,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAClC,OAAO,CAAC,IAAI,CAAC,CA8Jf"}
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * SDK-owned orchestrator entry script.
4
+ *
5
+ * Run as the tmux pane command for every workflow spawned by `runWorkflow`.
6
+ * Reads the workflow source path, agent, and base64-encoded inputs from
7
+ * positional argv, imports the workflow module, validates the default
8
+ * export, and hands off to `runOrchestrator()`.
9
+ *
10
+ * Argv layout (after `bun <this-file>`):
11
+ * argv[2] = absolute path to the workflow's source file
12
+ * (the `source` field from `defineWorkflow({ source: ... })`)
13
+ * argv[3] = agent — one of "claude" | "copilot" | "opencode"
14
+ * argv[4] = base64-encoded JSON record of structured inputs
15
+ *
16
+ * The dev's CLI never re-imports its own argv[1] — there's no
17
+ * `ATOMIC_ORCHESTRATOR_MODE` env var, no `handleOrchestratorReentry()`,
18
+ * no boilerplate. This file is the only re-exec target.
19
+ *
20
+ * The remaining ATOMIC_WF_* env vars (ID, TMUX, AGENT, CWD) are still set
21
+ * by the launcher script written by `executeWorkflow()` — they describe
22
+ * the runtime environment (which tmux session, which workflow run id,
23
+ * etc.) rather than acting as a re-entry signal.
24
+ */
25
+ export {};
26
+ //# sourceMappingURL=orchestrator-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator-entry.d.ts","sourceRoot":"","sources":["../../../src/sdk/runtime/orchestrator-entry.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
@@ -249,6 +249,16 @@ export declare function getCurrentSession(): string | null;
249
249
  * - Inside tmux: runs `switch-client` (returns immediately).
250
250
  */
251
251
  export declare function attachOrSwitch(sessionName: string): void;
252
+ /**
253
+ * Detach every client currently attached to the given atomic-managed
254
+ * tmux session. The session itself stays alive — only the clients are
255
+ * disconnected. Mirrors {@link attachSession}: attach connects a client,
256
+ * detachClients disconnects them.
257
+ *
258
+ * Best-effort: returns silently when the session has no attached clients
259
+ * or has already been torn down.
260
+ */
261
+ export declare function detachClients(sessionName: string): void;
252
262
  /**
253
263
  * Detach from the user's current tmux session and replace the client
254
264
  * with an attach to a session on the atomic socket.
@@ -265,6 +275,16 @@ export declare function detachAndAttachAtomic(sessionName: string): void;
265
275
  * Select (switch to) a window within the current tmux session.
266
276
  */
267
277
  export declare function selectWindow(target: string): void;
278
+ /**
279
+ * Move the target session's current-window pointer forward by one.
280
+ * Equivalent to the `Ctrl+\` binding inside an attached client, but
281
+ * usable without a client and addressable by session name.
282
+ */
283
+ export declare function nextWindow(sessionName: string): void;
284
+ /**
285
+ * Move the target session's current-window pointer backward by one.
286
+ */
287
+ export declare function previousWindow(sessionName: string): void;
268
288
  /**
269
289
  * Collapse all whitespace to single spaces for robust capture comparison.
270
290
  * Prevents false negatives from tmux inserting/stripping whitespace.
@@ -1 +1 @@
1
- {"version":3,"file":"tmux.d.ts","sourceRoot":"","sources":["../../../src/sdk/runtime/tmux.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAMtC,4FAA4F;AAC5F,eAAO,MAAM,WAAW,WAAW,CAAC;AAUpC,0DAA0D;AAC1D,MAAM,MAAM,UAAU,GAClB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC5B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA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