@hasna/loops 0.3.16 → 0.3.18

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/dist/sdk/index.js CHANGED
@@ -1050,6 +1050,30 @@ class Store {
1050
1050
  throw new Error(`loop not found after update: ${id}`);
1051
1051
  return after;
1052
1052
  }
1053
+ renameLoop(id, name, opts = {}) {
1054
+ const current = this.getLoop(id);
1055
+ if (!current)
1056
+ throw new Error(`loop not found: ${id}`);
1057
+ const trimmed = name.trim();
1058
+ if (!trimmed)
1059
+ throw new Error("loop name must not be empty");
1060
+ const updated = (opts.now ?? new Date).toISOString();
1061
+ this.db.query(`UPDATE loops SET name=$name, updated_at=$updated
1062
+ WHERE id=$id
1063
+ AND ($daemonLeaseId IS NULL OR EXISTS (
1064
+ SELECT 1 FROM daemon_lease WHERE id=$daemonLeaseId AND expires_at > $now
1065
+ ))`).run({
1066
+ $id: id,
1067
+ $name: trimmed,
1068
+ $updated: updated,
1069
+ $daemonLeaseId: opts.daemonLeaseId ?? null,
1070
+ $now: updated
1071
+ });
1072
+ const after = this.getLoop(id);
1073
+ if (!after)
1074
+ throw new Error(`loop not found after rename: ${id}`);
1075
+ return after;
1076
+ }
1053
1077
  archiveLoop(idOrName) {
1054
1078
  const loop = this.requireLoop(idOrName);
1055
1079
  if (loop.archivedAt)
package/docs/USAGE.md CHANGED
@@ -184,7 +184,8 @@ Use `shell: true` only when you intentionally want shell parsing:
184
184
  Built-in templates turn common orchestration flows into reusable workflow JSON.
185
185
  `todos-task-worker-verifier` performs one todos task and then verifies it.
186
186
  `event-worker-verifier` handles any Hasna event envelope and then verifies the
187
- handling.
187
+ handling. `bounded-agent-worker-verifier` is for recurring bounded agent work:
188
+ one worker runs a narrow objective, then a fresh verifier audits the result.
188
189
 
189
190
  ```bash
190
191
  loops templates list
@@ -204,6 +205,12 @@ loops templates render event-worker-verifier \
204
205
  --var eventSource=knowledge \
205
206
  --var eventJson='{"id":"<event-id>"}' \
206
207
  --var projectPath=/path/to/repo
208
+ loops templates render bounded-agent-worker-verifier \
209
+ --var objective="Check docs drift and queue tasks for gaps" \
210
+ --var projectPath=/path/to/repo \
211
+ --var provider=codewith \
212
+ --var authProfilePool=account004,account005 \
213
+ --var sandbox=danger-full-access
207
214
  ```
208
215
 
209
216
  For event-driven task automation, `loops events handle todos-task` reads a
@@ -287,15 +294,42 @@ loops expectations <loop-id-or-name> --json
287
294
 
288
295
  The JSON contains the expectation result, bounded error/stdout/stderr evidence,
289
296
  a stable failure fingerprint, route metadata, and recommended task fields.
290
- OpenLoops does not mutate Todos from these commands. Until Todos has a native
291
- upsert command, consumers can use the included compatibility fallback:
292
- `todos search <dedupe-key>`, then `todos add ...` or `todos comment ...`.
293
- The planned native integration is represented in `futureNativeUpsert`.
297
+ OpenLoops does not mutate Todos from `health` or `expectations`. To turn failed
298
+ expectations into deduped tasks, use the explicit routing command:
299
+
300
+ ```bash
301
+ loops health route-tasks \
302
+ --project ~/.hasna/loops \
303
+ --task-list loop-error-self-heal \
304
+ --max-actions 5
305
+ ```
306
+
307
+ Use `--dry-run --json` first when testing a new automation path. Routed tasks
308
+ include the stable failure fingerprint, classification, loop id/name, and
309
+ `no_tmux_dispatch=true` metadata.
294
310
 
295
311
  Failure classifications are: `rate_limit`, `auth`, `model_not_found`,
296
312
  `context_length`, `schema_response_format`, `node_init`, `timeout`, `sigsegv`,
297
313
  `skipped_previous_active`, and `unknown`.
298
314
 
315
+ ## Hygiene
316
+
317
+ OpenLoops includes deterministic hygiene checks for replacing local maintenance
318
+ scripts with package commands:
319
+
320
+ ```bash
321
+ loops hygiene names --json
322
+ loops hygiene names --apply
323
+ loops hygiene duplicates --json
324
+ loops hygiene scripts --json
325
+ ```
326
+
327
+ `hygiene names` reports canonical `machine-*` or `repo-<name>-*` loop names and
328
+ only renames when `--apply` is present. `hygiene duplicates` groups loops with
329
+ the same normalized name, cwd, and schedule. `hygiene scripts` inventories loops
330
+ whose command still references `~/.hasna/loops/scripts`; use it as a migration
331
+ gate before deleting local scripts.
332
+
299
333
  Archive loops when retiring old automation but preserving history:
300
334
 
301
335
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/loops",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
4
4
  "description": "Persistent local loop and workflow runner for deterministic commands and headless AI coding agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",