@hearsay-tools/squawk 0.18.0-pr3631.6580 → 0.18.0-pr3633.6592
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 +298 -2
- package/dist/ci-wait/controller.d.ts +37 -37
- package/dist/delegation/routes.d.ts +15 -15
- package/dist/delegation/transport.d.ts +4 -4
- package/dist/project-migration/steps.js +2 -1
- package/dist/project-migration/steps.js.map +1 -1
- package/dist/runs/conversation-members.d.ts +27 -0
- package/dist/runs/conversation-members.js +73 -0
- package/dist/runs/conversation-members.js.map +1 -0
- package/dist/runs/project-run-connection.js +8 -2
- package/dist/runs/project-run-connection.js.map +1 -1
- package/dist/runs/run-database-migrations.d.ts +8 -0
- package/dist/runs/run-database-migrations.js +192 -0
- package/dist/runs/run-database-migrations.js.map +1 -0
- package/dist/runs/run-database-version.d.ts +1 -1
- package/dist/runs/run-database-version.js +1 -1
- package/dist/runs/run-database.d.ts +8 -0
- package/dist/runs/run-database.js +12 -190
- package/dist/runs/run-database.js.map +1 -1
- package/dist/runs/run-row.d.ts +3 -0
- package/dist/runs/run-row.js +9 -0
- package/dist/runs/run-row.js.map +1 -1
- package/dist/runs/store.d.ts +2 -2
- package/dist/runs/store.js +3 -4
- package/dist/runs/store.js.map +1 -1
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/server.d.ts +2881 -2881
- package/dist/workflows/run/wait-engine.d.ts +72 -72
- package/package.json +5 -4
- package/scripts/benchmark-conversation-lookup.ts +104 -0
- package/scripts/benchmark-store-fixture.ts +43 -0
- package/scripts/benchmark-worktree-retention.ts +18 -43
package/README.md
CHANGED
|
@@ -427,11 +427,307 @@ See [Owned workers](docs/workers.md).
|
|
|
427
427
|
|
|
428
428
|
## From the terminal: `hsq task` and `hsq message`
|
|
429
429
|
|
|
430
|
-
|
|
430
|
+
`hsq task` starts, watches and steers tasks **in the running cockpit** from a shell — for you, or
|
|
431
|
+
for a bot driving one. Every command prints one JSON object and exits with a code the caller can
|
|
432
|
+
branch on, so nothing has to parse prose. It never starts a server: it finds the cockpit whose
|
|
433
|
+
project registry holds this checkout (ports 4321–4370; a task worktree resolves to its parent
|
|
434
|
+
project), or you point it at one with `--url` / `HSQ_URL` (`CEZ_URL` fallback).
|
|
435
|
+
|
|
436
|
+
```text
|
|
437
|
+
hsq task [--url <origin> | --repo <dir>] <operation> …
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
The shared `--url`, `--repo` and `--help`/`-h` flags also work before the operation;
|
|
441
|
+
`--url` and `--repo` accept both `--flag value` and `--flag=value`. A shared flag repeated
|
|
442
|
+
before the operation or on both sides is a usage error. Operation flags stay after the
|
|
443
|
+
operation. `hsq task --help <operation>` shows that operation's help without discovery.
|
|
444
|
+
An explicit `--url` wins over `HSQ_URL` (`CEZ_URL` fallback); `--repo` selects the checkout to discover.
|
|
445
|
+
|
|
446
|
+
`hsq task send` is human input. It can answer a pending human question. It refuses
|
|
447
|
+
inside a task (`HSQ_TASK_ID` (`CEZ_TASK_ID` fallback) is set). Agents use `hsq message` for task messages,
|
|
448
|
+
including peer and parent/worker conversations; see [Owned workers](docs/workers.md#owned-workers).
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
id=$(hsq task start --task-file - <<'EOF' | jq -r .id
|
|
452
|
+
Fix the `hsq task` docs. Keep $(example) and "quotes" literal.
|
|
453
|
+
EOF
|
|
454
|
+
)
|
|
455
|
+
hsq task wait "$id" --timeout-seconds 900 # 0 done/review/needs you · 1 failed · 3 timeout
|
|
456
|
+
hsq task list # currentStepId (running), pullRequestUrl (done/review), capped error (failed)
|
|
457
|
+
hsq task status "$id" # slim JSON: status, attention, question, branch, handoffUrl…
|
|
458
|
+
hsq task send "$id" 'Use the retry helper instead' # delivered live, queued before start
|
|
459
|
+
hsq task send "$id" --resume 'Continue with the next step' # resumed: reopen a settled session
|
|
460
|
+
hsq task log "$id" --follow --timeout-seconds 300 # JSON lines until it needs you or ends
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
`list --status` accepts comma-separated values: `queued`, `running`, `waiting`, `review`,
|
|
464
|
+
`done`, `failed`, `cancelled`. Default rows include only the next-action field for their status
|
|
465
|
+
when defined; errors use the first line, at most 200 characters including `…` when cut.
|
|
466
|
+
Default `status` includes `handoffUrl`, a URL to the existing handoff endpoint even before
|
|
467
|
+
contents are seeded, and keeps the full error. `--full` still prints the contract unchanged.
|
|
468
|
+
To answer a pending `question`, use the same `send` with the answer text. Without `--resume`,
|
|
469
|
+
a closed session returns `delivery: not-delivered` and the `next` command. For multi-line or
|
|
470
|
+
shell-sensitive messages use `send <id> --text-file <path|->` (`-` reads stdin); the quoting
|
|
471
|
+
rules below apply to messages too.
|
|
472
|
+
|
|
473
|
+
Use `--task-file PATH` to read a saved task (for example, `hsq task start --task-file task.md`),
|
|
474
|
+
or `--task-file -` to read stdin as above. The quoted heredoc delimiter (`<<'EOF'`) keeps
|
|
475
|
+
backticks and `$()` literal in the task text.
|
|
476
|
+
|
|
477
|
+
POSIX shells, including Bash, expand backticks and `$()` in double-quoted arguments before
|
|
478
|
+
hsq receives the text. **Do not put raw backticks in double-quoted task arguments.** This can
|
|
479
|
+
execute parts of your prompt as shell commands and leave holes in the stored task, including
|
|
480
|
+
when starting tasks through SSH and `bash -lc`. Prefer a task file or stdin with a quoted
|
|
481
|
+
heredoc delimiter. A single-quoted positional argument still works for short tasks:
|
|
482
|
+
`hsq task start 'Fix the typo'`.
|
|
483
|
+
|
|
484
|
+
`hsq task start --task-file task.md --skill <name>` names one skill as the task's agent step;
|
|
485
|
+
`--skill` and `--workflow` are mutually exclusive. The CLI checks `GET /skills` first and
|
|
486
|
+
includes a `warning` in its JSON result if the skill is missing or the catalog cannot be
|
|
487
|
+
checked; it still starts the run. Like a cockpit skill start, if the skill is missing at
|
|
488
|
+
execution, the agent uses the plain prompt and the run logs a note. CLI starts do not change
|
|
489
|
+
the cockpit composer's recent picks or skill-usage ranking.
|
|
490
|
+
Without either flag, `start` still runs `quick-task`.
|
|
491
|
+
|
|
492
|
+
`--runner <claude|codex|opencode|pi|cursor|omp>` picks the runner, as in a workflow step and
|
|
493
|
+
`hsq discover --runner`; `--model` and `--effort` pin the rest. `--backend` is a permanent
|
|
494
|
+
alias of `--runner` with no warning. Giving both with different values exits 64.
|
|
495
|
+
|
|
496
|
+
`--archive-when-done` archives the task after **Done**. `--auto-merge-pr` merges its
|
|
497
|
+
PR after **Done** only when current-head CI and GitHub rules pass. It can mark a
|
|
498
|
+
draft PR ready. Both controls are off by default. They also appear as switches in
|
|
499
|
+
the task composer and task details. With both on, Squawk merges before it archives;
|
|
500
|
+
without a PR, it archives on Done. Pending or blocked completion actions show their
|
|
501
|
+
reason in task details. Use `status <id> --full` to read the saved `archiveWhenDone`,
|
|
502
|
+
`autoMergePr` and `completionAction` fields. Existing task choices can be changed
|
|
503
|
+
through `PATCH /api/v1/p/:projectId/runs/:id` with the matching boolean fields.
|
|
504
|
+
|
|
505
|
+
`start` is retry-safe: it sends a request id (`--request-id <UUID>` to pick your own), and a
|
|
506
|
+
retry with the same id and start options answers with the run the first one created
|
|
507
|
+
(`created: false`) instead of starting a second. Changing a completion control on that
|
|
508
|
+
retry is a payload conflict. Also: `list`, `stop`, `finish`, `diff [--stat]`, `open`.
|
|
509
|
+
Use `archive <id>` to hide a task from `list`, `unarchive <id>` to restore it, and
|
|
510
|
+
`list --all` to include archived tasks. `list` never shows owned workers, with or without
|
|
511
|
+
`--all`: they are steer targets of their parent task. Id-addressed commands (`status`, `wait`,
|
|
512
|
+
`send`, `log`, `stop`, …) still accept a worker's id. `archive-finished` sweeps finished tasks (not scheduled runs waiting on a usage limit, and not owned workers, which leave with their parent) and prints
|
|
513
|
+
`{"archived": count, "ids": [...], "pinnedIds": [...]}`. The single-task commands print `{"id": "…", "archived": true|false}`.
|
|
514
|
+
Exit codes:
|
|
515
|
+
`0` ok (`wait`/`start --wait`/`log --follow`: the task ended `done`/`review` or stopped for attention), `1` task
|
|
516
|
+
failed/cancelled or a message was not delivered, `2` no cockpit or the cockpit refused (its `error`
|
|
517
|
+
is passed through), `3` timed out, `64` usage error. `hsq task --help` lists every flag.
|
|
518
|
+
|
|
519
|
+
**When a task needs you.** `status`, `list`, `wait` and the final `log --follow` line carry `attention` and `attentionLabel`,
|
|
520
|
+
derived by the same function the cockpit's Needs You uses, so the CLI and the cockpit cannot
|
|
521
|
+
disagree. Read those rather than the raw status:
|
|
522
|
+
|
|
523
|
+
- `attention: waiting` (`attentionLabel` "needs you" / "needs review"), `error` or `permission`
|
|
524
|
+
means the task wants a human. A `waiting` task is attention **even when no question is
|
|
525
|
+
pending** — a finished turn parks the task for follow-up without a structured question —
|
|
526
|
+
unless its top open wait is CI or a timer (below). A pending question shows as `question`
|
|
527
|
+
on `status`, with the agent's Markdown context as `questionContext` when it sent one, and as
|
|
528
|
+
`waitingOn` `{ kind: 'human' }`; never clear a task on its absence alone.
|
|
529
|
+
- `attention: running` with `attentionLabel` "waiting for CI", "waiting for merge" or "monitoring"
|
|
530
|
+
(`status: waiting` with an open PR wait or timer in `waitingOn`) is neither settled nor attention: the agent is
|
|
531
|
+
still working on its own sub-agents or a watched command, whatever its last log line says.
|
|
532
|
+
- `attention: none` with "waiting on 2 workers" is a task parked on its own workers; it will wake
|
|
533
|
+
by itself.
|
|
534
|
+
|
|
535
|
+
`wait`, `start --wait` and `log --follow` stop as soon as a task needs you or ends
|
|
536
|
+
(`--until attention`, the default); `--until settled` waits for a terminal status only — for
|
|
537
|
+
`--autonomous` runs, or a bot that wants an outcome:
|
|
538
|
+
|
|
539
|
+
```bash
|
|
540
|
+
hsq task wait "$id" # stops when the task needs you, or ends
|
|
541
|
+
hsq task wait "$id" --until settled # done/review/failed/cancelled only
|
|
542
|
+
hsq task start --task-file task.md --wait # returns as soon as the agent parks
|
|
543
|
+
hsq task start --task-file task.md --wait --autonomous --until settled # runs to completion
|
|
544
|
+
hsq task log "$id" --follow # streams until the task needs you, or ends
|
|
545
|
+
hsq task log "$id" --follow --until settled # streams until done/review/failed/cancelled
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
*Migrating from `--until settled`.* Before 0.16, `wait` and `start --wait` defaulted to
|
|
549
|
+
`settled`, so an ordinary interactive task ran out the timeout (exit 3) although the agent had
|
|
550
|
+
parked within seconds. The default is now `attention`. A bot that polls for terminal state adds
|
|
551
|
+
`--until settled` to its `wait` / `start --wait` calls; nothing else about `settled` changed. Each
|
|
552
|
+
run in the `wait` output (and the `start --wait` object) now carries `attention` +
|
|
553
|
+
`attentionLabel`, and the output's top level says which `until` was in force, so a caller can tell
|
|
554
|
+
"parked for follow-up" (`status: waiting`, `attention: waiting`) from "finished" (`status: done`,
|
|
555
|
+
`attention: none`) without knowing Squawk's status vocabulary.
|
|
556
|
+
|
|
557
|
+
*`log --follow` (#931).* `log --follow` used to stop on a terminal status only, so tailing an
|
|
558
|
+
interactive task streamed until `--timeout-seconds` and exited 3 after the agent had parked. It
|
|
559
|
+
now takes the same `--until` with the same `attention` default, judged by the same function as
|
|
560
|
+
`wait`; `--until` without `--follow` is a usage error. Every event is still printed before the
|
|
561
|
+
final line, which is now `{"id", "status", "attention", "attentionLabel", "until", "timedOut"}`. A
|
|
562
|
+
bot that tails to terminal state adds `--until settled`. `log` without `--follow` is unchanged.
|
|
563
|
+
|
|
564
|
+
**A bot that lives behind an HTTP endpoint** does not have to poll. Add a webhook (a name, a
|
|
565
|
+
description, a URL and an optional Bearer token) under **Webhooks** in the project's **Settings →
|
|
566
|
+
General** and turn on **Task notifications**. Every task that opts in then POSTs one delivery to
|
|
567
|
+
each such webhook when it enters a state that webhook selects: **Needs you**, **Failed**,
|
|
568
|
+
**Done** and **Cancelled** by default, plus **Running**, **Waiting for agents**, **Waiting on CI**,
|
|
569
|
+
**Waiting** (a timer) and **Any other wait** when you tick them. A question that puts the task in
|
|
570
|
+
Needs you is `task.question`; every other entry is `task.status`, and the body's `state` names the
|
|
571
|
+
state. `task.subscribed` (when it opts in, at start or on hand-off) and **Send test** always go out.
|
|
572
|
+
Each body carries the same slim projection `hsq task status` prints, under `task`. `hsq task start`
|
|
573
|
+
opts in only with `--notify` (off by default); the cockpit's New task form
|
|
574
|
+
has a **Notify webhook** toggle; and a running task's **Hand off** button (or
|
|
575
|
+
`hsq task notify <id> --message '…'`) turns it on later with a note for the bot. `notify` (and
|
|
576
|
+
`send --notify`) on a worker's id is a usage error that names the parent to notify instead;
|
|
577
|
+
`notify --off` still works on one. The note goes to
|
|
578
|
+
the webhook only, never to the agent. Delivery is best-effort: 10 s timeout, 3 attempts, and a
|
|
579
|
+
failure shows in the thread without touching the task. The token is stored in `<config>` and never
|
|
580
|
+
sent back to a browser. Under `HSQ_DRY_RUN=1` (`CEZ_DRY_RUN` fallback) nothing is sent; the payload is logged in the thread.
|
|
581
|
+
|
|
582
|
+
A project can hold several webhooks, each with its own states, and each body names the webhook it
|
|
583
|
+
went to under `webhook`. One failing webhook never delays or stops another.
|
|
584
|
+
|
|
585
|
+
### Reports from agents: `hsq webhook`
|
|
586
|
+
|
|
587
|
+
Turn on **Let agents send reports** for a webhook, and agents in that project can send it a report
|
|
588
|
+
on demand: a friction report to a triage bot instead of a new GitHub issue, for example. Agents see
|
|
589
|
+
each such webhook's name and description in their system prompt, so write the description as
|
|
590
|
+
instructions ("Send friction you hit with tools here instead of filing a GitHub issue"). A webhook
|
|
591
|
+
without that switch cannot be reached this way.
|
|
592
|
+
|
|
593
|
+
```sh
|
|
594
|
+
hsq webhook list # the webhooks open to agents
|
|
595
|
+
hsq webhook send 'Friction reports' --message-file report.md --title 'Squeal skipped an edit'
|
|
596
|
+
hsq webhook send <name|id> --message 'Short report' [--data '{"severity":"low"}']
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
The body is `event: "agent.report"` with `webhook`, `title`, the Markdown `message`, your `data`,
|
|
600
|
+
and the reporting task's `runId`, thread `url` and `task` projection. The command prints the
|
|
601
|
+
outcome as JSON and exits 0 delivered, 1 not delivered, 2 refused or no cockpit, 64 usage.
|
|
602
|
+
|
|
603
|
+
### Automations from a task: `hsq automation`
|
|
604
|
+
|
|
605
|
+
`hsq automation` creates and manages automations (on by default; `HSQ_AUTOMATIONS=0` (`CEZ_AUTOMATIONS` fallback) disables them) on the cockpit that
|
|
606
|
+
runs the task, so an agent asked to "do X every morning" or "whenever a PR opens" sets up an
|
|
607
|
+
automation instead of a cron job. Like `hsq task`, it prints one JSON object per invocation and
|
|
608
|
+
exits 0 ok, 1 check failed, 2 refused or no cockpit, 3 check timed out, 64 usage.
|
|
609
|
+
|
|
610
|
+
```sh
|
|
611
|
+
hsq automation schema # the definition reference (needs no cockpit)
|
|
612
|
+
hsq automation add --name 'Weekday triage' --cron '0 7 * * 1-5' --prompt 'Triage new issues'
|
|
613
|
+
hsq automation add --name 'Review PRs' --on pull_request.opened --every 5m --label bug --prompt-file p.md
|
|
614
|
+
hsq automation add --name 'Agent triage' --on issue.labeled --changed-label needs-agent --prompt 'Triage #{{github.number}}'
|
|
615
|
+
hsq automation create --file def.json [--enable] # full JSON form; stdin when no flag is given
|
|
616
|
+
hsq automation update <id> --json '{"task":{"prompt":"…"}}'
|
|
617
|
+
hsq automation add --name 'Check the rollout' --at 2026-10-29T09:00 --tz Europe/Warsaw --prompt 'Check the rollout'
|
|
618
|
+
hsq automation add --name 'Follow up' --in 7d --latest-start 6h --prompt 'Follow up on the migration'
|
|
619
|
+
hsq automation check <id> [--execute] · run <id> · list [--archived include|only] · show <id> · enable <id> · pause <id> · cancel <id> · delete <id>
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
`add` and `create` send the same body and create the automation **paused** unless `--enable` is
|
|
623
|
+
given; `--cron` accepts the four shapes a schedule can take (daily, weekdays, one weekday, every N
|
|
624
|
+
hours) and anything else is a usage error pointing to the JSON form. `update` replaces each key
|
|
625
|
+
it is given, except `task`, which merges key by key (`null` removes one); it restates `enabled`
|
|
626
|
+
and echoes the revision it read, so a concurrent edit in the cockpit is refused (exit 2), never
|
|
627
|
+
overwritten. Mutating commands print the automation's cockpit page as `url`.
|
|
628
|
+
|
|
629
|
+
`add` accepts `--archive-when-done` and `--auto-merge-pr` with the same behavior as
|
|
630
|
+
`hsq task start`. The JSON keys are `task.archiveWhenDone` and `task.autoMergePr`.
|
|
631
|
+
Both are optional booleans and default to off. The automation editor has the same
|
|
632
|
+
switches. Editing these choices affects future tasks only; it does not change tasks
|
|
633
|
+
the automation already launched. Enabling an automation or making its tasks autonomous
|
|
634
|
+
does not enable either completion control.
|
|
635
|
+
|
|
636
|
+
GitHub automations exclude events before enablement by default. Turn on **Include existing items**
|
|
637
|
+
in the editor, pass `--include-existing` to `add`, or set `"filters": {"includeExisting": true,
|
|
638
|
+
"lookbackDays": 7, "maxRecords": 25}` in a JSON definition to include older matches within the
|
|
639
|
+
lookback (1–90 days). Turning this on for an enabled automation reopens that window on its next
|
|
640
|
+
check. Changing only the lookback preserves the completed cursor; pause and re-enable to
|
|
641
|
+
reopen the wider history window. Previously processed matches stay deduplicated across edits, pauses and restarts, and
|
|
642
|
+
per-check limits still apply. Historical scans resume across checks and restarts when capped.
|
|
643
|
+
GitHub search is limited to 1,000 items per window and label timelines to 100 events per item;
|
|
644
|
+
reaching either limit reports an error with guidance to narrow the filters or lookback. **Test filter** previews the selected window independently of the
|
|
645
|
+
execution cursor; it never launches tasks. For label triggers, the window applies to the label
|
|
646
|
+
event's time, so a newly added label can match an old issue even with history off. Historical
|
|
647
|
+
label discovery revisits the rolling window because later comments can move issues between pages;
|
|
648
|
+
receipts prevent those repeated observations from launching duplicate tasks.
|
|
649
|
+
|
|
650
|
+
A **one-time schedule** (**Once** in the editor, `--at` or `--in` on `add`, `"schedule":
|
|
651
|
+
{"type": "once", "at": "2026-10-29T09:00", "timeZone": "Europe/Warsaw"}` in JSON) starts one
|
|
652
|
+
ordinary task at a wall-clock time in an explicit IANA zone. It is created paused like every
|
|
653
|
+
automation; **Enable** arms it. When it is due, Squawk starts the task and moves the schedule to
|
|
654
|
+
**Archived** with a link to that task; **Run now** does the same at once, so it never runs twice.
|
|
655
|
+
**Cancel** archives it without a task. An archived schedule cannot change, and the list hides it
|
|
656
|
+
until you pick the **Archived** filter. Squawk must be running at the due time. If it was not,
|
|
657
|
+
the schedule starts on the next boot only within its **Latest start** (no limit by default; 10
|
|
658
|
+
minutes to 30 days); after that it is marked **Missed** and stays until you edit, cancel or run it.
|
|
659
|
+
A launch that fails marks it **Failed**, and nothing retries on its own; **Retry** or **Run now**
|
|
660
|
+
relaunches the same receipt, so one schedule starts at most one task. Agents can create and manage
|
|
661
|
+
one-time schedules with the `cezar_schedule_task` and `cezar_scheduled_tasks` tools, which exist
|
|
662
|
+
by default unless `HSQ_AUTOMATIONS=0` (`CEZ_AUTOMATIONS` fallback) and also create schedules paused unless the user asked for them to run.
|
|
663
|
+
These tools take and answer the due time in UTC, like every other time in a Squawk tool; the
|
|
664
|
+
schedule keeps a wall time in the cockpit's time zone, so the cockpit shows it in local time.
|
|
665
|
+
|
|
666
|
+
Automation list counters use two windows. **Launched** counts every stored task with that
|
|
667
|
+
automation's provenance, across definition revisions, including historical variants, completed and
|
|
668
|
+
archived tasks. Restarting or compacting automation logs and receipts does not change it;
|
|
669
|
+
deleting a task removes it from the count. **Matches**, **Duplicates** and **Errors** describe
|
|
670
|
+
only that automation's latest 100 activity-log rows. Recent activity remains a separate log view.
|
|
671
|
+
|
|
672
|
+
The address comes from `HSQ_COCKPIT_URL` (`CEZ_COCKPIT_URL` fallback) and `HSQ_PROJECT_ID` (`CEZ_PROJECT_ID` fallback), which the cockpit puts in a task's
|
|
673
|
+
environment. Without them, only an explicit `--url`, `--repo` or `HSQ_URL` (`CEZ_URL` fallback) looks for a cockpit;
|
|
674
|
+
otherwise the command exits 2 and never starts a server. With automations off, the cockpit's `409`
|
|
675
|
+
is relayed verbatim (exit 2).
|
|
431
676
|
|
|
432
677
|
## Workflow format
|
|
433
678
|
|
|
434
|
-
|
|
679
|
+
A workflow is a small YAML file in `.ai/cezar/workflows/`:
|
|
680
|
+
|
|
681
|
+
```yaml
|
|
682
|
+
name: fix-and-verify
|
|
683
|
+
description: Implement the task, then verify; retry with failing output on red.
|
|
684
|
+
steps:
|
|
685
|
+
- id: implement
|
|
686
|
+
name: Implement
|
|
687
|
+
prompt: "{{task}}"
|
|
688
|
+
skill: project-conventions # optional — from .ai/skills or .ai/cezar/skills
|
|
689
|
+
# model: opus # optional per-step model override
|
|
690
|
+
# effort: high # optional per-step effort: low · medium · high · xhigh · max
|
|
691
|
+
# runner: codex # optional per-step backend: claude · codex · opencode · cursor · pi · omp
|
|
692
|
+
# timeoutMs: 7200000 # optional agent-step wall-clock cap (2 hours); 0 = no limit
|
|
693
|
+
# allowedTools: [Read, Edit, Write, Grep, Glob, Bash]
|
|
694
|
+
- id: verify
|
|
695
|
+
name: Verify
|
|
696
|
+
command: "npm test" # a check step: exit 0 passes
|
|
697
|
+
onFail:
|
|
698
|
+
retry: implement # loop back to an earlier step…
|
|
699
|
+
max: 2 # …at most twice
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
`{{task}}` is replaced with the task text you typed. When a check fails and loops
|
|
703
|
+
back, its failing output is appended to the retried agent's prompt so the next
|
|
704
|
+
attempt can see what broke.
|
|
705
|
+
|
|
706
|
+
Agent steps have no wall-clock limit by default, including steps before a check or
|
|
707
|
+
another agent. This applies to cockpit tasks, owned workers and `hsq run`, on every
|
|
708
|
+
runner. Non-final agent steps still close after their turn and advance the chain.
|
|
709
|
+
An authored agent step may opt into `timeoutMs`: an integer from `0` to `2147483647`
|
|
710
|
+
milliseconds, with `0` disabling the cap. A positive limit measures the entire
|
|
711
|
+
session from startup, including waiting; expiry fails the step and stops the chain.
|
|
712
|
+
It does not add workflow retry/resume behavior. Check steps reject this field.
|
|
713
|
+
Skill shorthand, default tasks and free-form Continue have no wall-clock cap.
|
|
714
|
+
All managed sessions have a separate 30-minute no-progress safeguard: while a turn
|
|
715
|
+
is open, native stream, tool or heartbeat activity refreshes it. A silent turn
|
|
716
|
+
fails and its process is terminated, with SIGKILL escalation if needed. Busy turns
|
|
717
|
+
can run longer than 30 minutes. Waiting at a turn boundary or for a human answer
|
|
718
|
+
pauses this safeguard; the next turn or answer rearms it. Standalone runner calls
|
|
719
|
+
keep their 30-minute wall-clock default. Startup protection and the existing
|
|
720
|
+
parked-session lifecycle still apply.
|
|
721
|
+
|
|
722
|
+
Prefer skills over steps? A workflow can also be written in the portable
|
|
723
|
+
shorthand — an ordered list of skill names, each becoming one agent step:
|
|
724
|
+
|
|
725
|
+
```yaml
|
|
726
|
+
name: triage-and-fix
|
|
727
|
+
skills: [reproduce, root-cause, implement, self-review]
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
---
|
|
435
731
|
|
|
436
732
|
## How it runs agents
|
|
437
733
|
|
|
@@ -280,11 +280,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
280
280
|
"/api/v1/tools/ask": {
|
|
281
281
|
$post: {
|
|
282
282
|
output: {
|
|
283
|
-
|
|
283
|
+
ok: false;
|
|
284
|
+
code: 'unavailable';
|
|
284
285
|
message: string;
|
|
285
286
|
};
|
|
286
287
|
outputFormat: "json";
|
|
287
|
-
status:
|
|
288
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
288
289
|
input: {
|
|
289
290
|
json: {
|
|
290
291
|
questions: {
|
|
@@ -302,12 +303,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
302
303
|
};
|
|
303
304
|
} | {
|
|
304
305
|
output: {
|
|
305
|
-
|
|
306
|
-
code: 'unavailable';
|
|
306
|
+
code: 'capability_revoked';
|
|
307
307
|
message: string;
|
|
308
308
|
};
|
|
309
309
|
outputFormat: "json";
|
|
310
|
-
status:
|
|
310
|
+
status: 401;
|
|
311
311
|
input: {
|
|
312
312
|
json: {
|
|
313
313
|
questions: {
|
|
@@ -375,11 +375,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
375
375
|
"/api/v1/tools/cancel-wait": {
|
|
376
376
|
$post: {
|
|
377
377
|
output: {
|
|
378
|
-
|
|
378
|
+
cancelled: false;
|
|
379
|
+
code: 'unavailable';
|
|
379
380
|
message: string;
|
|
380
381
|
};
|
|
381
382
|
outputFormat: "json";
|
|
382
|
-
status:
|
|
383
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
383
384
|
input: {
|
|
384
385
|
json: {
|
|
385
386
|
wait_id: string;
|
|
@@ -387,12 +388,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
387
388
|
};
|
|
388
389
|
} | {
|
|
389
390
|
output: {
|
|
390
|
-
|
|
391
|
-
code: 'unavailable';
|
|
391
|
+
code: 'capability_revoked';
|
|
392
392
|
message: string;
|
|
393
393
|
};
|
|
394
394
|
outputFormat: "json";
|
|
395
|
-
status:
|
|
395
|
+
status: 401;
|
|
396
396
|
input: {
|
|
397
397
|
json: {
|
|
398
398
|
wait_id: string;
|
|
@@ -440,11 +440,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
440
440
|
"/api/v1/tools/done": {
|
|
441
441
|
$post: {
|
|
442
442
|
output: {
|
|
443
|
-
|
|
443
|
+
ok: false;
|
|
444
|
+
code: 'unavailable';
|
|
444
445
|
message: string;
|
|
445
446
|
};
|
|
446
447
|
outputFormat: "json";
|
|
447
|
-
status:
|
|
448
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
448
449
|
input: {
|
|
449
450
|
json: {
|
|
450
451
|
summary?: string | undefined;
|
|
@@ -452,12 +453,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
452
453
|
};
|
|
453
454
|
} | {
|
|
454
455
|
output: {
|
|
455
|
-
|
|
456
|
-
code: 'unavailable';
|
|
456
|
+
code: 'capability_revoked';
|
|
457
457
|
message: string;
|
|
458
458
|
};
|
|
459
459
|
outputFormat: "json";
|
|
460
|
-
status:
|
|
460
|
+
status: 401;
|
|
461
461
|
input: {
|
|
462
462
|
json: {
|
|
463
463
|
summary?: string | undefined;
|
|
@@ -525,11 +525,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
525
525
|
"/api/v1/tools/preview-stop": {
|
|
526
526
|
$post: {
|
|
527
527
|
output: {
|
|
528
|
-
|
|
528
|
+
ok: boolean;
|
|
529
|
+
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
529
530
|
message: string;
|
|
531
|
+
hint: string;
|
|
530
532
|
};
|
|
531
533
|
outputFormat: "json";
|
|
532
|
-
status:
|
|
534
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
533
535
|
input: {
|
|
534
536
|
json: {
|
|
535
537
|
port: number;
|
|
@@ -538,13 +540,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
538
540
|
};
|
|
539
541
|
} | {
|
|
540
542
|
output: {
|
|
541
|
-
|
|
542
|
-
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
543
|
+
code: 'capability_revoked';
|
|
543
544
|
message: string;
|
|
544
|
-
hint: string;
|
|
545
545
|
};
|
|
546
546
|
outputFormat: "json";
|
|
547
|
-
status:
|
|
547
|
+
status: 401;
|
|
548
548
|
input: {
|
|
549
549
|
json: {
|
|
550
550
|
port: number;
|
|
@@ -557,11 +557,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
557
557
|
"/api/v1/tools/preview-serve": {
|
|
558
558
|
$post: {
|
|
559
559
|
output: {
|
|
560
|
-
|
|
560
|
+
ok: boolean;
|
|
561
|
+
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
561
562
|
message: string;
|
|
563
|
+
hint: string;
|
|
562
564
|
};
|
|
563
565
|
outputFormat: "json";
|
|
564
|
-
status:
|
|
566
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
565
567
|
input: {
|
|
566
568
|
json: {
|
|
567
569
|
command: string;
|
|
@@ -573,13 +575,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
573
575
|
};
|
|
574
576
|
} | {
|
|
575
577
|
output: {
|
|
576
|
-
|
|
577
|
-
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
578
|
+
code: 'capability_revoked';
|
|
578
579
|
message: string;
|
|
579
|
-
hint: string;
|
|
580
580
|
};
|
|
581
581
|
outputFormat: "json";
|
|
582
|
-
status:
|
|
582
|
+
status: 401;
|
|
583
583
|
input: {
|
|
584
584
|
json: {
|
|
585
585
|
command: string;
|
|
@@ -595,11 +595,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
595
595
|
"/api/v1/tools/schedule-task": {
|
|
596
596
|
$post: {
|
|
597
597
|
output: {
|
|
598
|
-
|
|
598
|
+
ok: false;
|
|
599
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
599
600
|
message: string;
|
|
600
601
|
};
|
|
601
602
|
outputFormat: "json";
|
|
602
|
-
status:
|
|
603
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
603
604
|
input: {
|
|
604
605
|
json: {
|
|
605
606
|
at?: string | undefined;
|
|
@@ -616,12 +617,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
616
617
|
};
|
|
617
618
|
} | {
|
|
618
619
|
output: {
|
|
619
|
-
|
|
620
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
620
|
+
code: 'capability_revoked';
|
|
621
621
|
message: string;
|
|
622
622
|
};
|
|
623
623
|
outputFormat: "json";
|
|
624
|
-
status:
|
|
624
|
+
status: 401;
|
|
625
625
|
input: {
|
|
626
626
|
json: {
|
|
627
627
|
at?: string | undefined;
|
|
@@ -676,11 +676,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
676
676
|
"/api/v1/tools/scheduled-tasks": {
|
|
677
677
|
$post: {
|
|
678
678
|
output: {
|
|
679
|
-
|
|
679
|
+
ok: false;
|
|
680
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
680
681
|
message: string;
|
|
681
682
|
};
|
|
682
683
|
outputFormat: "json";
|
|
683
|
-
status:
|
|
684
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
684
685
|
input: {
|
|
685
686
|
json: {
|
|
686
687
|
at?: string | undefined;
|
|
@@ -713,12 +714,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
713
714
|
};
|
|
714
715
|
} | {
|
|
715
716
|
output: {
|
|
716
|
-
|
|
717
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
717
|
+
code: 'capability_revoked';
|
|
718
718
|
message: string;
|
|
719
719
|
};
|
|
720
720
|
outputFormat: "json";
|
|
721
|
-
status:
|
|
721
|
+
status: 401;
|
|
722
722
|
input: {
|
|
723
723
|
json: {
|
|
724
724
|
at?: string | undefined;
|
|
@@ -82,17 +82,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
82
82
|
"/discover": {
|
|
83
83
|
$post: {
|
|
84
84
|
output: {
|
|
85
|
-
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
86
|
-
models: {
|
|
87
|
-
id: string;
|
|
88
|
-
label: string;
|
|
89
|
-
description: string;
|
|
90
|
-
effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
|
|
91
|
-
}[];
|
|
92
|
-
source: "cache" | "live" | "unavailable";
|
|
93
|
-
stale: boolean;
|
|
94
|
-
reason?: string | undefined;
|
|
95
|
-
} | {
|
|
96
85
|
scope: "host-default-account";
|
|
97
86
|
runners: {
|
|
98
87
|
status: "connected" | "disconnected" | "not-installed" | "unknown";
|
|
@@ -113,6 +102,17 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
113
102
|
reason?: string | undefined;
|
|
114
103
|
}[];
|
|
115
104
|
nextOffset?: number | undefined;
|
|
105
|
+
} | {
|
|
106
|
+
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
107
|
+
models: {
|
|
108
|
+
id: string;
|
|
109
|
+
label: string;
|
|
110
|
+
description: string;
|
|
111
|
+
effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
|
|
112
|
+
}[];
|
|
113
|
+
source: "cache" | "live" | "unavailable";
|
|
114
|
+
stale: boolean;
|
|
115
|
+
reason?: string | undefined;
|
|
116
116
|
};
|
|
117
117
|
outputFormat: "json";
|
|
118
118
|
status: 200;
|
|
@@ -221,13 +221,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
221
221
|
status: 200;
|
|
222
222
|
input: {
|
|
223
223
|
json: {
|
|
224
|
-
workerIds: string[];
|
|
225
|
-
timeoutSeconds?: number | undefined;
|
|
226
|
-
mode?: "all" | "any" | "one" | undefined;
|
|
227
|
-
} | {
|
|
228
224
|
requestIds: string[];
|
|
229
225
|
mode?: "all" | "any" | "one" | undefined;
|
|
230
226
|
timeoutSeconds?: number | undefined;
|
|
227
|
+
} | {
|
|
228
|
+
workerIds: string[];
|
|
229
|
+
timeoutSeconds?: number | undefined;
|
|
230
|
+
mode?: "all" | "any" | "one" | undefined;
|
|
231
231
|
} | {
|
|
232
232
|
peerIds: string[];
|
|
233
233
|
timeoutSeconds?: number | undefined;
|
|
@@ -196,13 +196,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
196
196
|
status: 200;
|
|
197
197
|
input: {
|
|
198
198
|
json: {
|
|
199
|
-
workerIds: string[];
|
|
200
|
-
timeoutSeconds?: number | undefined;
|
|
201
|
-
mode?: "all" | "any" | "one" | undefined;
|
|
202
|
-
} | {
|
|
203
199
|
requestIds: string[];
|
|
204
200
|
mode?: "all" | "any" | "one" | undefined;
|
|
205
201
|
timeoutSeconds?: number | undefined;
|
|
202
|
+
} | {
|
|
203
|
+
workerIds: string[];
|
|
204
|
+
timeoutSeconds?: number | undefined;
|
|
205
|
+
mode?: "all" | "any" | "one" | undefined;
|
|
206
206
|
} | {
|
|
207
207
|
peerIds: string[];
|
|
208
208
|
timeoutSeconds?: number | undefined;
|
|
@@ -242,8 +242,9 @@ function runStoreStep(journal, fault) {
|
|
|
242
242
|
if (!changed)
|
|
243
243
|
continue;
|
|
244
244
|
const { seq: _seq, revision, ...input } = row;
|
|
245
|
+
// Paths change, run ids do not: the row keeps the conversation members it has.
|
|
245
246
|
upserts.push({ ...input, worktreePath: column.worktree_path, data: serializeLike(row.data, data), summary: serializeLike(row.summary, summary),
|
|
246
|
-
issueAttributionCurrent: db.getMeta(`issue-attribution:${id}`) === String(revision) });
|
|
247
|
+
issueAttributionCurrent: db.getMeta(`issue-attribution:${id}`) === String(revision), conversationMembers: db.conversationMembers(id) });
|
|
247
248
|
}
|
|
248
249
|
if (upserts.length > 0)
|
|
249
250
|
db.transaction({ upserts, deletes: [], beforeCommit: () => { fault('run-store:commit'); } });
|