@hasna/loops 0.3.48 → 0.3.50

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
@@ -251,6 +251,65 @@ loops templates render deterministic-check-create-task \
251
251
  --var checkCommand='your deterministic check and todos upsert command'
252
252
  ```
253
253
 
254
+ Custom reusable workflow templates live under the OpenLoops app data directory:
255
+ `~/.hasna/loops/templates` by default, or `$LOOPS_DATA_DIR/templates` when
256
+ `LOOPS_DATA_DIR` is set. Store templates as declarative JSON files; listing,
257
+ showing, and rendering templates never executes workflow steps or mutates the
258
+ registry.
259
+
260
+ ```json
261
+ {
262
+ "id": "custom-report",
263
+ "name": "Custom Report",
264
+ "description": "Run a custom report workflow from the local template registry.",
265
+ "kind": "workflow",
266
+ "variables": [
267
+ { "name": "objective", "required": true, "description": "Report objective." },
268
+ { "name": "projectPath", "required": true, "description": "Working directory." },
269
+ { "name": "timeoutMs", "default": "300000", "type": "number" }
270
+ ],
271
+ "workflow": {
272
+ "name": "custom-report-${objective}",
273
+ "steps": [
274
+ {
275
+ "id": "worker",
276
+ "target": {
277
+ "type": "agent",
278
+ "provider": "codewith",
279
+ "prompt": "/goal ${objective}\nProduce the requested report only.",
280
+ "cwd": "${projectPath}",
281
+ "configIsolation": "safe",
282
+ "permissionMode": "bypass",
283
+ "sandbox": "workspace-write",
284
+ "timeoutMs": "${timeoutMs}"
285
+ },
286
+ "timeoutMs": "${timeoutMs}"
287
+ }
288
+ ]
289
+ }
290
+ }
291
+ ```
292
+
293
+ ```bash
294
+ loops templates validate ./custom-report.json
295
+ loops templates import ./custom-report.json
296
+ loops templates list --source custom
297
+ loops templates show custom-report
298
+ loops templates render custom-report \
299
+ --var objective="Check docs drift" \
300
+ --var projectPath=/path/to/repo
301
+ loops templates create-workflow custom-report \
302
+ --var objective="Check docs drift" \
303
+ --var projectPath=/path/to/repo
304
+ ```
305
+
306
+ Use `--source builtin`, `--source custom`, or `--source all` on
307
+ `list`, `show`, `render`, and `create-workflow` when automation needs an
308
+ explicit source. Custom template ids and names cannot override built-ins.
309
+ Custom templates fail closed for `danger-full-access`; use built-in templates
310
+ with explicit break-glass handling for emergency workflows that need that
311
+ sandbox.
312
+
254
313
  For event-driven task automation, `loops events handle todos-task` reads a
255
314
  Hasna event envelope from stdin or `HASNA_EVENT_JSON`, records a
256
315
  `WorkflowInvocation`, upserts an admission work item, and admits that work item
@@ -315,6 +374,38 @@ loops routes show <work-item-id>
315
374
  loops routes invocations
316
375
  ```
317
376
 
377
+ For Hasna OSS task-created routing, use a deterministic drain instead of tmux
378
+ dispatch:
379
+
380
+ ```bash
381
+ loops routes schedule todos-task oss-task-route-drain \
382
+ --every 5m \
383
+ --todos-project "$HOME/.hasna/loops" \
384
+ --project-path-prefix /home/hasna/workspace/hasna/opensource \
385
+ --tags auto:route \
386
+ --provider codewith \
387
+ --auth-profile-pool account004,account005,account006 \
388
+ --add-dir "$HOME/.hasna/todos,$HOME/.hasna/loops" \
389
+ --project-group oss \
390
+ --max-dispatch 2 \
391
+ --scan-limit 5000 \
392
+ --max-active-per-project 1 \
393
+ --max-active-per-project-group 4 \
394
+ --max-active 12 \
395
+ --worktree-mode required \
396
+ --evidence-dir "$HOME/.hasna/loops/reports/oss-task-route-drain" \
397
+ --compact
398
+ ```
399
+
400
+ Only route tasks that explicitly opt in with `auto:route`, `route_enabled=true`,
401
+ or `automation.allowed=true`. Use Codewith account pools, required worktrees,
402
+ max-active throttles, and bounded evidence directories. Do not dispatch or paste
403
+ task prompts into tmux panes. Keep `--scan-limit` large enough for the local
404
+ ready-task backlog; otherwise low-priority or newly-created tasks can sit beyond
405
+ the scanned window. Generated one-shot task/event route workflow specs are
406
+ archived automatically when their workflow run reaches a terminal state;
407
+ workflow run history and manifests are preserved.
408
+
318
409
  Workflow run manifests are written under
319
410
  `.hasna/loops/runs/<project-slug>/<subject-key>/<run-id>/manifest.json`.
320
411
  `subject-key` is a safe derived path segment, not the raw subject reference.
@@ -389,6 +480,7 @@ loops runs <id-or-name>
389
480
  loops pause <id-or-name>
390
481
  loops resume <id-or-name>
391
482
  loops stop <id-or-name>
483
+ loops rename <id-or-name> <new-name>
392
484
  loops archive <id-or-name>
393
485
  loops unarchive <id-or-name>
394
486
  loops remove <id-or-name>
@@ -436,6 +528,20 @@ package-managed cursor under `<LOOPS_DATA_DIR>/route-cursors.json` so bounded
436
528
  `--max-actions` runs advance through all findings over repeated scheduled runs
437
529
  instead of reprocessing only the first batch.
438
530
 
531
+ Use `loops rename` for deliberate operator naming changes that should not be
532
+ encoded as automatic hygiene policy:
533
+
534
+ ```bash
535
+ loops rename machine-todos-drain-oss-repos-strict-5m machine-todos-drain-oss-repos
536
+ loops --json rename <loop-id> machine-ops-loop-health-route-tasks
537
+ ```
538
+
539
+ `rename` preserves the loop id, schedule, run history, archive state, and target
540
+ configuration. It rejects empty or duplicate names and writes a SQLite backup
541
+ under `<LOOPS_DATA_DIR>/backups` before mutating the loop row. Keep cadence in
542
+ schedule metadata and operator tables rather than in the loop name when the name
543
+ is meant for humans.
544
+
439
545
  Archive loops when retiring old automation but preserving history:
440
546
 
441
547
  ```bash