@hasna/workflows 0.2.0 → 0.2.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.
package/README.md CHANGED
@@ -87,6 +87,34 @@ run API includes `triggerRun`, `getRun`, `listNodes`, `events`, `cancelRun` and
87
87
  the graph, context and cycle budget. Reusing a key for a different request returns
88
88
  HTTP 409. Run context cannot contain the reserved `__wf` or `steps` fields.
89
89
 
90
+ A step's optional `cwd` names its working directory on the server executing the
91
+ workflow. It applies to shell commands and model lanes; prefer an absolute path.
92
+ Codex prompts keep their native repository, sandbox and approval defaults. Supply
93
+ `cwd` for work in an existing trusted repository. For a prompt that needs no file
94
+ changes and may run outside a repository, explicitly set `codexMode: "read-only"`:
95
+
96
+ ```ts
97
+ import { createWorkflowsClient, type WorkflowGraph } from "@hasna/workflows/sdk";
98
+
99
+ const workflows = createWorkflowsClient();
100
+ const graph: WorkflowGraph = {
101
+ name: "read-only-answer", version: "1",
102
+ nodes: [
103
+ { id: "start", type: "start", next: "answer" },
104
+ { id: "answer", type: "step", lane: "codex", codexMode: "read-only",
105
+ prompt: "Return the requested answer without changing files.", next: "end" },
106
+ { id: "end", type: "end" },
107
+ ],
108
+ };
109
+ await workflows.triggerRun(graph, {}, { idempotencyKey: "read-only-answer-1" });
110
+ ```
111
+
112
+ This explicit mode uses Codex's read-only sandbox, permits a nonrepository
113
+ directory and refuses approval escalation. It applies only to Codex prompt steps;
114
+ shell commands cannot select it. An empty Codex response fails the step even when
115
+ the native process exits successfully. Memoization distinguishes the working
116
+ directory, lane and execution mode.
117
+
90
118
  ## MCP
91
119
 
92
120
  Register `workflows-mcp` as a stdio command in Codex, Claude Code, OpenCode, Sumi,