@hasna/loops 0.3.38 → 0.3.39
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 +95 -14
- package/dist/cli/index.js +1489 -179
- package/dist/daemon/index.js +494 -43
- package/dist/index.d.ts +1 -1
- package/dist/index.js +818 -53
- package/dist/lib/format.d.ts +3 -1
- package/dist/lib/run-artifacts.d.ts +15 -0
- package/dist/lib/store.d.ts +33 -1
- package/dist/lib/store.js +419 -8
- package/dist/lib/templates.d.ts +10 -0
- package/dist/sdk/index.d.ts +2 -1
- package/dist/sdk/index.js +524 -33
- package/dist/types.d.ts +109 -0
- package/docs/USAGE.md +57 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ loops create agent supply-chain-watch \
|
|
|
78
78
|
--provider codewith \
|
|
79
79
|
--every 15m \
|
|
80
80
|
--cwd /path/to/repo \
|
|
81
|
-
--sandbox
|
|
81
|
+
--sandbox workspace-write \
|
|
82
82
|
--prompt "Check for suspicious dependency or supply-chain changes. Report only concrete findings."
|
|
83
83
|
```
|
|
84
84
|
|
|
@@ -90,7 +90,7 @@ loops create agent supply-chain-watch \
|
|
|
90
90
|
--auth-profile account001 \
|
|
91
91
|
--every 15m \
|
|
92
92
|
--cwd /path/to/repo \
|
|
93
|
-
--sandbox
|
|
93
|
+
--sandbox workspace-write \
|
|
94
94
|
--prompt "Check for suspicious dependency or supply-chain changes. Report only concrete findings."
|
|
95
95
|
```
|
|
96
96
|
|
|
@@ -212,6 +212,9 @@ Built-in templates turn common orchestration flows into reusable workflow JSON.
|
|
|
212
212
|
`event-worker-verifier` handles any Hasna event envelope and then verifies the
|
|
213
213
|
handling. `bounded-agent-worker-verifier` is for recurring bounded agent work:
|
|
214
214
|
one worker runs a narrow objective, then a fresh verifier audits the result.
|
|
215
|
+
The catalog also includes `task-lifecycle`, `pr-review`, `scheduled-audit`,
|
|
216
|
+
`knowledge-refresh`, `report-only`, `incident-response`, and
|
|
217
|
+
`deterministic-check-create-task` for common operator workflows.
|
|
215
218
|
|
|
216
219
|
```bash
|
|
217
220
|
loops templates list
|
|
@@ -221,7 +224,7 @@ loops templates render todos-task-worker-verifier \
|
|
|
221
224
|
--var projectPath=/path/to/repo \
|
|
222
225
|
--var provider=codewith \
|
|
223
226
|
--var authProfilePool=account004,account005,account006 \
|
|
224
|
-
--var sandbox=
|
|
227
|
+
--var sandbox=workspace-write
|
|
225
228
|
loops templates create-workflow todos-task-worker-verifier \
|
|
226
229
|
--var taskId=<task-id> \
|
|
227
230
|
--var projectPath=/path/to/repo
|
|
@@ -236,20 +239,27 @@ loops templates render bounded-agent-worker-verifier \
|
|
|
236
239
|
--var projectPath=/path/to/repo \
|
|
237
240
|
--var provider=codewith \
|
|
238
241
|
--var authProfilePool=account004,account005 \
|
|
239
|
-
--var sandbox=
|
|
242
|
+
--var sandbox=workspace-write \
|
|
240
243
|
--var worktreeMode=required
|
|
244
|
+
loops templates render pr-review \
|
|
245
|
+
--var prUrl=https://github.com/hasna/loops/pull/123 \
|
|
246
|
+
--var projectPath=/path/to/repo
|
|
247
|
+
loops templates render deterministic-check-create-task \
|
|
248
|
+
--var projectPath=/path/to/repo \
|
|
249
|
+
--var checkCommand='your deterministic check and todos upsert command'
|
|
241
250
|
```
|
|
242
251
|
|
|
243
252
|
For event-driven task automation, `loops events handle todos-task` reads a
|
|
244
|
-
Hasna event envelope from stdin or `HASNA_EVENT_JSON`,
|
|
245
|
-
|
|
253
|
+
Hasna event envelope from stdin or `HASNA_EVENT_JSON`, records a
|
|
254
|
+
`WorkflowInvocation`, upserts an admission work item, and admits that work item
|
|
255
|
+
into a deduped one-shot workflow loop when route capacity allows:
|
|
246
256
|
|
|
247
257
|
```bash
|
|
248
258
|
cat task-created-event.json | loops events handle todos-task \
|
|
249
259
|
--provider codewith \
|
|
250
260
|
--auth-profile-pool account004,account005,account006 \
|
|
251
261
|
--permission-mode bypass \
|
|
252
|
-
--sandbox
|
|
262
|
+
--sandbox workspace-write \
|
|
253
263
|
--worktree-mode required
|
|
254
264
|
```
|
|
255
265
|
|
|
@@ -261,18 +271,89 @@ cat event.json | loops events handle generic \
|
|
|
261
271
|
--provider codewith \
|
|
262
272
|
--auth-profile-pool account004,account005,account006 \
|
|
263
273
|
--permission-mode bypass \
|
|
264
|
-
--sandbox
|
|
274
|
+
--sandbox workspace-write \
|
|
265
275
|
--project-path /path/to/repo \
|
|
266
276
|
--worktree-mode required
|
|
267
277
|
```
|
|
268
278
|
|
|
269
279
|
This is the intended deterministic-to-agentic path: a producer creates a todos
|
|
270
|
-
task, `@hasna/events` delivers `task.created`, OpenLoops
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
280
|
+
task, `@hasna/events` delivers `task.created`, OpenLoops records the invocation
|
|
281
|
+
and admission item, OpenLoops creates a worker/verifier workflow when admitted,
|
|
282
|
+
and the workflow updates todos with evidence. Use account pools so worker and
|
|
283
|
+
verifier steps do not burn the same profile; OpenLoops picks deterministically
|
|
284
|
+
and uses a different verifier profile when the pool has at least two entries.
|
|
285
|
+
Use `--dry-run` to inspect the rendered invocation, work item, workflow, and
|
|
286
|
+
loop input without storing anything.
|
|
287
|
+
|
|
288
|
+
Generated worker/verifier workflows fail closed when `sandbox=danger-full-access`
|
|
289
|
+
is requested without `manualBreakGlass=true`. Use `workspace-write` for
|
|
290
|
+
unattended task/event routes. Full access is an explicit manual emergency path,
|
|
291
|
+
not a default automation mode.
|
|
292
|
+
|
|
293
|
+
Inspect route state with:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
cat task-created-event.json | loops routes preview todos-task --sandbox workspace-write
|
|
297
|
+
cat task-created-event.json | loops routes create todos-task --sandbox workspace-write
|
|
298
|
+
loops routes drain todos-task --task-list oss --max-dispatch 2 --compact
|
|
299
|
+
loops routes schedule todos-task route-drain-oss-5m --every 5m --task-list oss --max-dispatch 1 --compact
|
|
300
|
+
loops routes list --route-key todos-task
|
|
301
|
+
loops routes show <work-item-id>
|
|
302
|
+
loops routes invocations
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
Workflow run manifests are written under
|
|
306
|
+
`.hasna/loops/runs/<project-slug>/<subject-key>/<run-id>/manifest.json`.
|
|
307
|
+
`subject-key` is a safe derived path segment, not the raw subject reference.
|
|
308
|
+
|
|
309
|
+
## OpenAutomations Runtime Binding
|
|
310
|
+
|
|
311
|
+
OpenLoops can be used as an execution runtime for deterministic OpenAutomations
|
|
312
|
+
product automations, but it does not own the automation product surface.
|
|
313
|
+
`@hasna/automations` owns automation specs, trigger materialization, product
|
|
314
|
+
automation action queues, DLQ/replay, idempotency, approvals, and audit
|
|
315
|
+
evidence. OpenLoops owns agent workflow invocation/admission/runs. OpenLoops
|
|
316
|
+
only executes work that OpenAutomations has explicitly handed off; it does not
|
|
317
|
+
make OpenAutomations the queue owner for todos task/PR/review agent workflows.
|
|
318
|
+
|
|
319
|
+
The SDK exposes the boundary descriptor:
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
import { openAutomationsRuntimeBinding } from "@hasna/loops";
|
|
323
|
+
|
|
324
|
+
const binding = openAutomationsRuntimeBinding();
|
|
325
|
+
console.log(binding.handoff); // "claim-queue"
|
|
326
|
+
console.log(binding.eventHandoff.handlerCommand); // "loops events handle generic"
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
The claim-queue handoff uses the OpenAutomations CLI or SDK:
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
automations queue claim --runner open-loops:<worker-id>
|
|
333
|
+
automations queue complete <action-id> --runner open-loops:<worker-id>
|
|
334
|
+
automations queue fail <action-id> --runner open-loops:<worker-id> --code <code> --message <message>
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
For explicit event workflow routing, OpenAutomations can export the normalized
|
|
338
|
+
event envelope and OpenLoops can consume it through the existing generic event
|
|
339
|
+
handler:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
automations --json webhooks event <route> --body-json '<json>' \
|
|
343
|
+
| loops --json events handle generic
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
This is not automation materialization in OpenLoops. It is an explicit
|
|
347
|
+
event-envelope workflow handoff: OpenAutomations owns deterministic automation
|
|
348
|
+
specs, webhook normalization, queue state, approvals, DLQ, and replay; OpenLoops
|
|
349
|
+
owns agent workflow invocation after the operator routes the envelope to
|
|
350
|
+
`loops events handle generic`.
|
|
351
|
+
|
|
352
|
+
Do not store automation specs in OpenLoops, infer automation triggers from event
|
|
353
|
+
transport alone, or replace the OpenAutomations queue with loop/workflow rows.
|
|
354
|
+
When a loop or workflow is used for execution, keep `HASNA_AUTOMATIONS_DIR`
|
|
355
|
+
pointing at the owning OpenAutomations data root and preserve the runner id in
|
|
356
|
+
completion/failure calls so OpenAutomations can enforce action leases.
|
|
276
357
|
|
|
277
358
|
## Transcript-Driven Loops
|
|
278
359
|
|