@hasna/todos 0.11.65 → 0.11.67

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.
Files changed (55) hide show
  1. package/README.md +78 -49
  2. package/dashboard/dist/assets/{index-aJefI7kh.js → index-DVotjwab.js} +1 -1
  3. package/dashboard/dist/index.html +1 -1
  4. package/dist/cli/commands/project-commands.d.ts.map +1 -1
  5. package/dist/cli/commands/query-commands.d.ts.map +1 -1
  6. package/dist/cli/commands/storage-commands.d.ts +5 -0
  7. package/dist/cli/commands/storage-commands.d.ts.map +1 -1
  8. package/dist/cli/commands/task-commands.d.ts.map +1 -1
  9. package/dist/cli/index.js +1034 -231
  10. package/dist/contracts.js +409 -129
  11. package/dist/db/agents.d.ts.map +1 -1
  12. package/dist/db/audit.d.ts.map +1 -1
  13. package/dist/db/migrations.d.ts.map +1 -1
  14. package/dist/db/plans.d.ts.map +1 -1
  15. package/dist/db/projects.d.ts.map +1 -1
  16. package/dist/db/schema.d.ts.map +1 -1
  17. package/dist/db/storage-tombstones.d.ts +26 -0
  18. package/dist/db/storage-tombstones.d.ts.map +1 -0
  19. package/dist/db/task-crud.d.ts.map +1 -1
  20. package/dist/db/task-lifecycle.d.ts.map +1 -1
  21. package/dist/db/task-lists.d.ts.map +1 -1
  22. package/dist/db/task-runs.d.ts.map +1 -1
  23. package/dist/db/templates.d.ts.map +1 -1
  24. package/dist/index.d.ts +4 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +928 -219
  27. package/dist/lib/approval-gates.d.ts.map +1 -1
  28. package/dist/lib/event-emission-safety.d.ts +9 -0
  29. package/dist/lib/event-emission-safety.d.ts.map +1 -0
  30. package/dist/lib/event-hooks.d.ts +1 -0
  31. package/dist/lib/event-hooks.d.ts.map +1 -1
  32. package/dist/lib/feature-manifest.d.ts.map +1 -1
  33. package/dist/lib/project-bootstrap.d.ts +1 -0
  34. package/dist/lib/project-bootstrap.d.ts.map +1 -1
  35. package/dist/lib/review-queues.d.ts.map +1 -1
  36. package/dist/lib/shared-events.d.ts +1 -0
  37. package/dist/lib/shared-events.d.ts.map +1 -1
  38. package/dist/lib/task-route-contract.d.ts +33 -0
  39. package/dist/lib/task-route-contract.d.ts.map +1 -0
  40. package/dist/lib/task-routing.d.ts +55 -0
  41. package/dist/lib/task-routing.d.ts.map +1 -0
  42. package/dist/mcp/index.js +459 -162
  43. package/dist/registry.js +409 -129
  44. package/dist/release-provenance.json +3 -3
  45. package/dist/server/index.js +482 -185
  46. package/dist/storage/interfaces.d.ts +20 -0
  47. package/dist/storage/interfaces.d.ts.map +1 -1
  48. package/dist/storage/postgres-adapter.d.ts.map +1 -1
  49. package/dist/storage/postgres-sync.d.ts +6 -1
  50. package/dist/storage/postgres-sync.d.ts.map +1 -1
  51. package/dist/storage/sqlite-snapshot.d.ts.map +1 -1
  52. package/dist/storage.js +677 -152
  53. package/dist/types/index.d.ts +22 -0
  54. package/dist/types/index.d.ts.map +1 -1
  55. package/package.json +1 -1
package/README.md CHANGED
@@ -283,7 +283,7 @@ todos extract-watch . --dry-run --max-runs 1 --json
283
283
 
284
284
  Created tasks are tagged with `extracted` and linked back to the source file.
285
285
  MCP clients can call `extract_todos` and `watch_source_todos` for the same
286
- offline workflow; no hosted code search, cloud sync, or telemetry is used.
286
+ offline workflow; no hosted code search, hosted sync, or telemetry is used.
287
287
 
288
288
  ## Local Editor Integrations
289
289
 
@@ -339,6 +339,34 @@ MCP clients can use `require_approval_gate`, `approve_approval_gate`,
339
339
  `list_approval_gates`. Gate events are written to task audit history and, when
340
340
  a run is linked, to the local run ledger.
341
341
 
342
+ ### OpenAutomations Approval And Evidence Handoff
343
+
344
+ OpenAutomations approval gates can be mirrored to Todos approval gates when an
345
+ automation action affects external systems, spends money, mutates production
346
+ state, or needs human consent. Use the automation run id as the linked run or
347
+ metadata reference, and keep the approval decision id in task/run evidence:
348
+
349
+ ```bash
350
+ todos approvals require <task-id> automation:<action-id> \
351
+ --requester automations \
352
+ --reviewer operator \
353
+ --reason "OpenAutomations action requires consent"
354
+ todos approvals approve <task-id> automation:<action-id> \
355
+ --reviewer operator \
356
+ --note "Approved action execution"
357
+ todos record-verification <task-id> "automations queue complete <action-id>" \
358
+ --status passed \
359
+ --summary "Action completed by runner open-loops:<worker-id>"
360
+ ```
361
+
362
+ Todos owns task approvals, task comments, verification evidence, audit-ledger
363
+ checkpoints, and release evidence. OpenAutomations owns automation specs,
364
+ action queue leases, DLQ/replay, and action approval state. Store only redacted
365
+ summaries, action ids, run ids, decision ids, artifact paths, and verification
366
+ commands in Todos; do not store raw event payloads, secret values, connector
367
+ tokens, or full action inputs unless the task explicitly requires them and they
368
+ have been redacted.
369
+
342
370
  ## Local Review Queues
343
371
 
344
372
  Review queues turn local task review into an explicit agent workflow: request a
@@ -401,52 +429,53 @@ MCP clients can use `set_local_event_hook`, `list_local_event_hooks`,
401
429
  `test_local_event_hook`, and `remove_local_event_hook`. Hook delivery is
402
430
  local-only; it does not call hosted webhooks or cloud automation services.
403
431
 
404
- ## Shared Event Webhooks
405
-
406
- Task lifecycle changes also emit shared `@hasna/events` events with source
407
- `todos`. Use `todos webhooks` for durable command or webhook subscriptions. This
408
- is the preferred bridge for automation that should react to new tasks without
409
- polling:
410
-
411
- ```bash
412
- todos webhooks add loops \
413
- --id openloops-task-created \
414
- --transport command \
415
- --source todos \
416
- --type task.created \
417
- --metadata 'project_path=/home/hasna/workspace/hasna/opensource/*' \
418
- --metadata-json 'route_enabled=true' \
419
- --metadata-json 'automation.no_auto!=true' \
420
- --metadata-json 'automation.manual_required!=true' \
421
- --metadata-json 'automation.requires_approval!=true' \
422
- --metadata-json 'automation.approval_required!=true' \
423
- --arg=events \
424
- --arg=handle \
425
- --arg=todos-task \
426
- --arg=--provider \
427
- --arg=codewith \
428
- --arg=--auth-profile-pool \
429
- --arg=account004,account005,account006 \
430
- --arg=--permission-mode \
431
- --arg=bypass \
432
- --arg=--sandbox \
433
- --arg=danger-full-access \
434
- --arg=--worktree-mode \
435
- --arg=required \
436
- --timeout-ms 900000 \
432
+ ## Shared Task Events And Route State
433
+
434
+ Task lifecycle changes emit shared `@hasna/events` events with source `todos`.
435
+ Todos is the human-visible task ledger: it emits task intent, routing gates, and
436
+ workflow artifact pointers. OpenEvents owns durable channel delivery/replay, and
437
+ OpenLoops owns workflow admission, work-item leases, agent execution, evaluator
438
+ cycles, and run manifests.
439
+
440
+ Use `project-bootstrap --route-enabled` to opt a project task list into
441
+ task-created routing, then inspect route state with deterministic JSON before a
442
+ route or workflow starts:
443
+
444
+ ```bash
445
+ todos project-bootstrap . --route-enabled --json
446
+ todos ready --json
447
+ todos task route-state <task-id> --json
448
+ ```
449
+
450
+ `todos ready --json` includes a `route_state` object for each pending unblocked
451
+ task. `route_state.schema_version` is `todos.task_route_state.v1`. It exposes
452
+ `eligible`, denial `reasons`, dependency blockers, route context, boolean gates,
453
+ and compact OpenLoops pointers:
454
+
455
+ - `current_workflow_invocation_id`
456
+ - `current_run_id`
457
+ - `latest_manifest_path`
458
+ - `latest_evaluation_path`
459
+ - `workflow_state`
460
+
461
+ OpenLoops updates those pointers after admission or evaluator progress:
462
+
463
+ ```bash
464
+ todos task workflow-pointers <task-id> \
465
+ --invocation <workflow-invocation-id> \
466
+ --run <workflow-run-id> \
467
+ --manifest /home/hasna/.hasna/loops/runs/<project>/<subject>/<run>/manifest.json \
468
+ --state working \
437
469
  --json
438
470
  ```
439
471
 
440
- When a task is created, `@hasna/events` sends the event JSON on stdin and in
441
- `HASNA_EVENT_JSON`. OpenLoops uses that event to create a deduped one-shot
442
- worker/verifier workflow for the task. Use account-profile pools instead of a
443
- single pinned profile, and require isolated worktrees for repo-mutating routes.
444
- The event data includes task identity,
445
- title, description, project/list ids, working directory, tags, metadata, status,
446
- priority, approval state, and timestamps. Event metadata includes routing-safe
447
- project/list/path fields, `route_enabled` when the task metadata opts in, and an
448
- `automation` object containing only boolean routing gates such as `no_auto`,
449
- `manual_required`, `requires_approval`, and `approval_required`.
472
+ Shared task event data includes task identity, title, description, project/list
473
+ ids, working directory, tags, metadata, status, priority, approval state, and
474
+ timestamps. Event metadata includes routing-safe project/list/path fields,
475
+ `route_enabled` when task or task-list metadata opts in, route-state schema
476
+ version, compact workflow pointers, and an `automation` object containing only
477
+ boolean routing gates such as `no_auto`, `manual_required`,
478
+ `requires_approval`, and `approval_required`.
450
479
 
451
480
  Production task-created routes should fail closed:
452
481
 
@@ -454,14 +483,14 @@ Production task-created routes should fail closed:
454
483
  approved routing tag such as `auto:route`.
455
484
  - Add negative automation predicates so `no_auto`, manual, and approval-gated
456
485
  tasks do not invoke the route.
457
- - Scope by project path, task list, tags, or repo metadata before invoking
458
- OpenLoops.
486
+ - Scope by project path, task list, tags, or repo metadata before invoking an
487
+ OpenLoops route.
459
488
  - Avoid overlapping opt-in channels for the same task family unless the target
460
- handler is idempotent. `loops events handle todos-task` dedupes by task id and
489
+ handler is idempotent. OpenLoops task-event admission dedupes by task id and
461
490
  event type, but a narrower subscription still avoids wasted invocations.
462
491
 
463
492
  For tag opt-in, use a second route with the same deny predicates and
464
- `--data 'tags=auto:route'` instead of `--metadata-json 'route_enabled=true'`.
493
+ `tags=auto:route` instead of `route_enabled=true`.
465
494
  Tasks without one of those opt-ins are intentionally no-route. Local event hooks
466
495
  remain available for local-only JSONL/socket/script integrations.
467
496
 
@@ -1048,7 +1077,7 @@ todos calendar import team.ics --json
1048
1077
 
1049
1078
  Recurring task rules are mapped into ICS `RRULE` values when possible, and task
1050
1079
  SLA thresholds appear as local calendar events without any Google Calendar,
1051
- hosted API, or cloud sync dependency. MCP clients use `create_calendar_item`,
1080
+ hosted API, or hosted sync dependency. MCP clients use `create_calendar_item`,
1052
1081
  `list_calendar_events`, `export_calendar_ics`, and `import_calendar_ics`.
1053
1082
 
1054
1083
  ## Local Saved Search Views