@hasna/loops 0.3.53 → 0.3.55

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
@@ -101,6 +101,51 @@ accounts tools add codewith --label "Codewith" --env-var CODEWITH_HOME --bin cod
101
101
  accounts tools add aicopilot --label "AI Copilot" --env-var AICOPILOT_CONFIG_DIR --bin aicopilot
102
102
  ```
103
103
 
104
+ ## Prompt Files
105
+
106
+ Use prompt files for production agent prompts instead of long inline strings.
107
+
108
+ ```bash
109
+ mkdir -p ~/.hasna/loops/prompts
110
+ $EDITOR ~/.hasna/loops/prompts/repo-morning-check.md
111
+
112
+ loops create agent morning-check \
113
+ --provider codewith \
114
+ --auth-profile account001 \
115
+ --cron "0 8 * * *" \
116
+ --cwd /path/to/repo \
117
+ --prompt-file ~/.hasna/loops/prompts/repo-morning-check.md
118
+ ```
119
+
120
+ Workflow JSON also supports `promptFile` on agent targets. Relative paths
121
+ resolve from the workflow JSON file's directory:
122
+
123
+ ```json
124
+ {
125
+ "name": "repo-morning",
126
+ "steps": [
127
+ {
128
+ "id": "review",
129
+ "target": {
130
+ "type": "agent",
131
+ "provider": "codewith",
132
+ "cwd": "/path/to/repo",
133
+ "promptFile": "prompts/repo-morning-review.md"
134
+ }
135
+ }
136
+ ]
137
+ }
138
+ ```
139
+
140
+ OpenLoops records `promptSource` metadata and redacts prompt bodies in public
141
+ CLI output by default, including `templates render`. Use
142
+ `~/.hasna/loops/prompts/<stable-name>.md` as the default prompt store for
143
+ production loops.
144
+
145
+ Reusable custom templates cannot contain `promptFile`. Keep prompt files in
146
+ direct workflow JSON or agent loop creation; use template variables only for
147
+ non-secret routing/configuration data.
148
+
104
149
  ## Goals
105
150
 
106
151
  Add `--goal` to wrap a command, agent, or workflow loop in an AI-SDK orchestration layer. OpenLoops asks the configured model to create a flat DAG plan, executes ready nodes by calling the underlying target, then runs an adversarial achievement audit before marking the goal complete.
@@ -191,6 +236,11 @@ loops workflows recover <workflow-run-id>
191
236
  loops create workflow repo-morning-loop --workflow repo-morning --cron "0 8 * * *"
192
237
  ```
193
238
 
239
+ Use `recover` only for interrupted `running` workflow runs whose recorded child
240
+ process is gone. Terminal `timed_out` task/event workflow runs are audit
241
+ history; requeue them through the original task/event route after fixing the
242
+ cause.
243
+
194
244
  Workflow specs are stored separately from loops. A loop can schedule a workflow, but workflow runs and step runs have their own durable rows and events. Steps run in dependency order and a scheduled workflow run is idempotent per loop slot.
195
245
 
196
246
  For command steps, `command` is the executable when `shell` is not true. Put flags in `args`:
@@ -257,6 +307,30 @@ Custom reusable workflow templates live under the OpenLoops app data directory:
257
307
  showing, and rendering templates never executes workflow steps or mutates the
258
308
  registry.
259
309
 
310
+ Timeout policy is explicit. Deterministic command/check steps should normally
311
+ keep finite `timeoutMs`/`idleTimeoutMs` guards so broken shell work cannot run
312
+ forever. Agentic work steps default to no timeout in built-in worker/verifier
313
+ and task-lifecycle templates; use `timeoutMs: null` in workflow JSON, or
314
+ `--timeout none` / `--timeout unlimited` for CLI-created targets, when a step
315
+ may need hours or days. Use a positive numeric `timeoutMs` only when an agentic
316
+ step is intentionally bounded.
317
+
318
+ To migrate existing workflow loops, do not edit `workflow_specs.steps_json`
319
+ directly because historical workflow runs must keep pointing at their original
320
+ spec. Use the append-only migrator:
321
+
322
+ ```bash
323
+ loops workflows migrate-agent-timeouts --loop <loop-id-or-name>
324
+ loops workflows migrate-agent-timeouts --loop <loop-id-or-name> --apply
325
+ ```
326
+
327
+ The command dry-runs by default. With `--apply`, it creates a new workflow spec
328
+ with the requested agent timeout policy, retargets only future executions of
329
+ eligible non-running workflow loops, and leaves terminal timed-out workflow runs
330
+ as audit history. Use `loops workflows recover` only for interrupted `running`
331
+ workflow runs whose recorded child process is gone; terminal `timed_out` runs
332
+ must be requeued by re-delivering or draining the original task/event route.
333
+
260
334
  ```json
261
335
  {
262
336
  "id": "custom-report",
@@ -265,8 +339,7 @@ registry.
265
339
  "kind": "workflow",
266
340
  "variables": [
267
341
  { "name": "objective", "required": true, "description": "Report objective." },
268
- { "name": "projectPath", "required": true, "description": "Working directory." },
269
- { "name": "timeoutMs", "default": "300000", "type": "number" }
342
+ { "name": "projectPath", "required": true, "description": "Working directory." }
270
343
  ],
271
344
  "workflow": {
272
345
  "name": "custom-report-${objective}",
@@ -281,9 +354,9 @@ registry.
281
354
  "configIsolation": "safe",
282
355
  "permissionMode": "bypass",
283
356
  "sandbox": "workspace-write",
284
- "timeoutMs": "${timeoutMs}"
357
+ "timeoutMs": null
285
358
  },
286
- "timeoutMs": "${timeoutMs}"
359
+ "timeoutMs": null
287
360
  }
288
361
  ]
289
362
  }