@hasna/loops 0.3.12 → 0.3.14

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
@@ -5,7 +5,7 @@ OpenLoops is a local CLI and daemon for persistent loops and workflows: schedule
5
5
  It supports deterministic command loops, JSON-defined workflows, and guarded CLI adapters for headless coding agents:
6
6
 
7
7
  - `claude`
8
- - `cursor-agent`
8
+ - `cursor agent` or `agent`
9
9
  - `codewith exec`
10
10
  - `aicopilot run`
11
11
  - `opencode run`
@@ -78,6 +78,7 @@ loops create agent supply-chain-watch \
78
78
  --provider codewith \
79
79
  --every 15m \
80
80
  --cwd /path/to/repo \
81
+ --sandbox danger-full-access \
81
82
  --prompt "Check for suspicious dependency or supply-chain changes. Report only concrete findings."
82
83
  ```
83
84
 
@@ -89,6 +90,7 @@ loops create agent supply-chain-watch \
89
90
  --auth-profile account001 \
90
91
  --every 15m \
91
92
  --cwd /path/to/repo \
93
+ --sandbox danger-full-access \
92
94
  --prompt "Check for suspicious dependency or supply-chain changes. Report only concrete findings."
93
95
  ```
94
96
 
@@ -203,6 +205,63 @@ Use `shell: true` only when you intentionally want shell parsing:
203
205
  { "type": "command", "command": "git status --short", "shell": true }
204
206
  ```
205
207
 
208
+ ## Templates And Task Events
209
+
210
+ Built-in templates turn common orchestration flows into reusable workflow JSON.
211
+ `todos-task-worker-verifier` performs one todos task and then verifies it.
212
+ `event-worker-verifier` handles any Hasna event envelope and then verifies the
213
+ handling.
214
+
215
+ ```bash
216
+ loops templates list
217
+ loops templates render todos-task-worker-verifier \
218
+ --var taskId=<task-id> \
219
+ --var taskTitle="Fix parser" \
220
+ --var projectPath=/path/to/repo \
221
+ --var provider=codewith \
222
+ --var authProfile=account005 \
223
+ --var sandbox=danger-full-access
224
+ loops templates create-workflow todos-task-worker-verifier \
225
+ --var taskId=<task-id> \
226
+ --var projectPath=/path/to/repo
227
+ loops templates render event-worker-verifier \
228
+ --var eventId=<event-id> \
229
+ --var eventType=knowledge.record.created \
230
+ --var eventSource=knowledge \
231
+ --var eventJson='{"id":"<event-id>"}' \
232
+ --var projectPath=/path/to/repo
233
+ ```
234
+
235
+ For event-driven task automation, `loops events handle todos-task` reads a
236
+ Hasna event envelope from stdin or `HASNA_EVENT_JSON`, renders the template, and
237
+ schedules a deduped one-shot workflow loop:
238
+
239
+ ```bash
240
+ cat task-created-event.json | loops events handle todos-task \
241
+ --provider codewith \
242
+ --auth-profile account005 \
243
+ --permission-mode bypass \
244
+ --sandbox danger-full-access
245
+ ```
246
+
247
+ For other Hasna apps that expose `@hasna/events` webhooks, use the generic
248
+ handler:
249
+
250
+ ```bash
251
+ cat event.json | loops events handle generic \
252
+ --provider codewith \
253
+ --auth-profile account005 \
254
+ --permission-mode bypass \
255
+ --sandbox danger-full-access \
256
+ --project-path /path/to/repo
257
+ ```
258
+
259
+ This is the intended deterministic-to-agentic path: a producer creates a todos
260
+ task, `@hasna/events` delivers `task.created`, OpenLoops creates a worker and a
261
+ verifier workflow, and the workflow updates todos with evidence. Use
262
+ `--dry-run` to inspect the rendered workflow and loop input without storing
263
+ anything.
264
+
206
265
  ## Transcript-Driven Loops
207
266
 
208
267
  OpenLoops can turn long-form media or meeting transcripts into recurring workflow work when paired with `iapp-transcriber`. The template at `docs/workflows/transcript-feedback-to-loops.json` transcribes an authorized media URL, asks an agent to extract recurring loop candidates, authors workflow specs, and validates generated workflows before scheduling. Copy it into the target repo, replace `/path/to/repo` with that repo's absolute path, and provide `TRANSCRIBER_SOURCE_URL` through the runner environment or a private, uncommitted workflow copy before storing or scheduling it. Do not commit private or signed media URLs.
@@ -283,11 +342,14 @@ The adapters intentionally use provider command surfaces instead of pretending e
283
342
  - Claude uses `claude -p --output-format json` and safe-mode/local setting sources by default.
284
343
  - Codewith uses `codewith --ask-for-approval never exec --json --ephemeral --skip-git-repo-check`.
285
344
  - AI Copilot and OpenCode use `run --format json --pure`.
286
- - Cursor is CLI-first for now via `cursor-agent -p`; treat output as less stable until a stronger public SDK contract is selected.
345
+ - Cursor is CLI-first for now via `cursor agent -p`, with `agent -p` as the fallback launcher on machines that expose the standalone Cursor Agent binary; treat output as less stable until a stronger public SDK contract is selected.
287
346
  - Codex uses `codex exec --json --ephemeral --ask-for-approval never`.
288
347
  - Agent prompts are sent through child stdin instead of argv so prompt bodies do not appear in process listings.
289
348
  - When `--account` or a step `account` is set, OpenLoops resolves `accounts env <profile> --tool <tool>` before spawning the target, strips inherited tool home/API-key variables, and applies the selected profile only to that process. Missing account profiles fail before the provider binary receives the prompt.
290
349
  - `--auth-profile` and step `authProfile` are provider-native auth selectors. They currently apply to Codewith and are passed to Codewith as `--auth-profile <name>` before `exec`; they do not call OpenAccounts.
350
+ - `--sandbox` maps to provider-native sandbox flags. Codewith/Codex accept `read-only`, `workspace-write`, or `danger-full-access`; Cursor accepts `enabled` or `disabled`.
351
+ - `--permission-mode` maps `plan`, `auto`, and `bypass` where the provider supports it. Claude uses native permission modes, Cursor maps bypass to `--force`, and OpenCode/AICopilot map bypass to `--dangerously-skip-permissions`.
352
+ - `--variant` is provider-specific reasoning/model effort. Claude maps it to `--effort`, Codewith/Codex map it to `model_reasoning_effort`, and OpenCode/AICopilot pass `--variant`.
291
353
  - Daemon and scheduled runs prepend common user executable directories such as `~/.local/bin` and `~/.bun/bin` before resolving provider CLIs.
292
354
 
293
355
  For production loops that can mutate repos, prefer disposable worktrees and explicit prompts that name allowed write scope.