@theaileverage/marionette 0.2.0 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2 — 2026-09-08
4
+
5
+ - Ship a Marionette agent skill with setup, task coordination, recovery, and SDK guidance.
6
+ - Place new workers in appropriately sized sibling panes, with overflow tabs, durable creation recovery, and cleanup that preserves sibling workers.
7
+ - Export a dependency-free Herdr SDK covering all 102 Herdr 0.9.0/protocol-22 schema methods plus persistent graphics streams, with generated TypeScript types, cancellable event subscriptions, bounded buffering, and file-frame acknowledgements.
8
+ - Verify graphics payloads, placement, replacement, and layer cleanup through the real Herdr server/client renderer with a simulated Kitty-capable terminal. Expand the regression suite to 117 tests.
9
+
10
+ ## 0.2.1 — 2026-09-08
11
+
12
+ - Separate verification, terminal release, delivery, evidence archival and Git collection lifecycles. Task completion continues to preserve branches and worktrees.
13
+ - Automatic release of settled, identity-verified single-pane workers after integrated outcome completion; retained failures, native-input states and ambiguous close reconciliation.
14
+ - Explicit merged/published/abandoned delivery, durable SHA-256 evidence archives and standalone Git bundles. Archived evidence preserves completion after checkout removal and detects tampering.
15
+ - Opt-in retention policies, live consumer and dirty-file guards, safe worktree removal, later PR-branch collection and compare-and-delete for explicitly abandoned archived branches.
16
+ - CLI/MCP cleanup tools, dashboard eligibility and retention controls, and regression coverage for recovery, identity changes, lease fencing, shared checkouts and evidence preservation.
17
+
3
18
  ## 0.2.0 — 8 September 2026
4
19
 
5
20
  - Persistent outcomes, observable completion criteria, independent assessments and integrated reviews. Required descendants, current revisions and artifact digests guard completion.
@@ -0,0 +1,7 @@
1
+ # Contributing
2
+
3
+ Use Node 22.13 or newer and install dependencies with `npm ci`. Run `npm run check`, `npm test`, `npm run build` and `npm run format:check` before opening a pull request. Describe the concrete behavior change and its validation. Keep tests deterministic; the standard suite must not start paid agent sessions or depend on a developer's Herdr configuration.
4
+
5
+ Keep generated bundles, local agent configuration, `.env` files, `.marionette` state, `.runtime` fixtures and credentials out of commits. Live validation scripts are opt-in and use explicitly named isolated sessions. Never point them at someone else's active session.
6
+
7
+ Changes enter `main` through pull requests. Release preparation and publication follow [RELEASING.md](RELEASING.md). Marionette is licensed under [MIT](LICENSE); bundled third-party licenses are preserved in `THIRD_PARTY_NOTICES.md`.
package/DESIGN.md CHANGED
@@ -30,7 +30,7 @@ The lead recommends isolation based on likely concurrent file conflicts and requ
30
30
 
31
31
  Managed worktrees live beneath the instance state directory, with a unique project/task path and `marionette/<task-id>` branch. Before any Git write, a durable plan records the repository and common Git directory, source and destination working directories, branch, and resolved base commit. Only committed history is checked out. A monorepo subdirectory maps to the same relative path in the new tree. The effective `task.cwd` and file checks are validated before Herdr receives that directory.
32
32
 
33
- The worktree lifecycle is separate from the worker run lifecycle: `planned → creating → ready`. A restart may execute a persisted plan or adopt a registered creation only after checking repository identity, branch, checkout status, and pinned commit. Ambiguous or incomplete creations fail closed and preserve all files. A ready worktree must retain its identity but may contain worker commits and dirty files, which retries preserve. Git calls use argument arrays, bounded subprocess execution, disabled hooks, and a cleared inherited Git environment; no forced checkout, reset, merge, prune, or removal is issued. Pause/cancel/redirect during preparation is applied before worker launch.
33
+ The worktree lifecycle is separate from the worker run lifecycle: `planned → creating → ready`. A restart may execute a persisted plan or adopt a registered creation only after checking repository identity, branch, checkout status, and pinned commit. Ambiguous or incomplete creations fail closed and preserve all files. A ready worktree must retain its identity but may contain worker commits and dirty files, which retries preserve. Git calls use argument arrays, bounded subprocess execution, disabled hooks, and a cleared inherited Git environment; preparation issues no forced checkout, reset, merge, prune, or removal. Later cleanup uses the separately authorized lifecycle below. Pause/cancel/redirect during preparation is applied before worker launch.
34
34
 
35
35
  Completion leaves the branch and worktree available. The lead recommends review, merge, or push/PR based on the user's workflow and obtains a choice unless already authorized. These delivery actions use normal Git/hosting tools and are not automatic supervisor side effects. No task dependency implicitly integrates another branch. The structured worktree metadata is available in briefings, task reads, inbox-associated task state, and the dashboard.
36
36
 
@@ -38,7 +38,7 @@ Completion leaves the branch and worktree available. The lead recommends review,
38
38
 
39
39
  Tasks normally follow `queued → preparing → running → verifying → completed/failed`. Dependencies, concurrency and ownership can retain `queued`. Questions or native screens produce `blocked`; pause produces `paused`. Cancel/redirect await an interrupted worker before acting. The revised objective fences obsolete reports immediately.
40
40
 
41
- Before `tab.create`, the run is persisted as `creating`. Returned identifiers are saved before `agent.start`; the agent must become interactively ready before any task prompt is sent. `prompting` is persisted before `agent.prompt`. Native startup and input screens never trigger automatic approvals. The transport validates response IDs and handles fragmented NDJSON; loss before acknowledgement is treated as ambiguous.
41
+ Before `tab.create` or `pane.split`, the run is persisted as `creating`, with the split target and pre-creation pane membership when applicable. Layout allocation is serialized per project; new workers share tabs only when all live members match saved pane-scoped run identities. Geometry and a four-pane cap determine whether to split or create another tab. Returned identifiers are saved before `agent.start`; the agent must become interactively ready before any task prompt is sent. `prompting` is persisted before `agent.prompt`. Native startup and input screens never trigger automatic approvals. The transport validates response IDs and handles fragmented NDJSON; loss before acknowledgement is treated as ambiguous.
42
42
 
43
43
  A crash in `creating` or `prompting`, or while a control is `sending`, requires explicit reconciliation. A run in `starting` is inspected and continued in its existing pane. Running attempts reattach; verification safely reruns. Identity mismatch suspends control. This is conservative at-most-once automatic dispatch with visible uncertainty, not a claim of exactly-once external execution.
44
44
 
@@ -63,3 +63,11 @@ See [ORCHESTRATION.md](ORCHESTRATION.md) for the public 0.2 contract. Outcomes,
63
63
  Task and outcome revisions fence asynchronous verification and plan changes. Required descendants form an acyclic completion graph together with dependencies. Changed artifacts invalidate affected work and integrated evidence. Parent yield transfers declared ownership to children after the native turn settles; resumption reuses its original run, pane and native conversation. Shared worker and lead reservations are acquired before external dispatch.
64
64
 
65
65
  Lead wait delivery persists waiting, ready, sending, delivered or uncertain state. Current lease ownership and exact native identity are checked before side effects and after asynchronous reads. Ambiguous acknowledgements never trigger automatic replay. Routine event summaries and targeted artifact/history reads reduce repeated context. Cache metrics retain missing values as unavailable and native message IDs prevent duplicate import.
66
+
67
+ ## Resource retirement
68
+
69
+ The cleanup service separates run release from worktree delivery/archive/collection. Completed integrated outcomes enable conservative automatic worker-pane release (legacy runs retain exclusive-tab release); failed/cancelled runs require inspection. Closure persists `closing → closed` or `uncertain`, pins the full native identity and original terminal, and never replays an ambiguous close. It does not close project sessions or workspaces.
70
+
71
+ Managed-checkout collection is disabled until explicitly requested or covered by an authorized retention policy. All tasks sharing the checkout are locked during inspection; task mutations, child submission, project registration and evidence assessment are fenced while cleanup awaits external reads. Archives seal terminal tasks and preserve file evidence, run diagnostics and a Git bundle. File writes and directory entries are flushed before committing the archive record. Collection verifies live files and archive digests before non-forced worktree removal. Original task references resolve to archived bytes only after recorded collection and actual checkout disappearance; tampering still invalidates acceptance. Delivery records retain pinned HEAD/target commits. Published branches can be collected later after a new merged delivery decision. Explicit abandonment retains a bundle before compare-and-delete of the exact branch tip. Partial Git operations preserve their phase and are explicitly inspectable/retryable.
72
+
73
+ Closing a native terminal and invoking Git have unavoidable external-process boundaries. Herdr protocol 20 has no atomic conditional-close operation; identity is checked immediately before the close, but operators must not repurpose a terminal concurrently with its cleanup. Git checks and branch-tip comparisons likewise do not replace coordination with external tools editing a checkout. Marionette fences its own concurrent mutations and refuses unsafe observed states.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The AI Leverage
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/ORCHESTRATION.md CHANGED
@@ -107,3 +107,36 @@ Combine a sequential implementation/review dependency with new repair and re-ver
107
107
  Stop the existing supervisor, retain its state, then start 0.2 with the same `--home` and rerun setup. Database schema 2 migrates legacy tasks into persistent implicit outcomes while preserving IDs, run identity, receipts, verification, leases and setup bindings. Newer database schemas fail closed. Old runtime directories remain available to existing workers.
108
108
 
109
109
  Legacy submissions without an outcome remain compatible through implicit criteria derived from their assignment checks. New lead prompts establish an explicit outcome first. The 0.2 setup contract refuses an older running supervisor and prints the stop/start remedy instead of mixing protocol versions.
110
+
111
+ ## Delivery, archival and cleanup in 0.2.1
112
+
113
+ Cleanup has five stages: verify the result, release execution resources, record delivery, archive evidence, and collect eligible Git resources. Task completion alone never deletes branches or worktrees. Project sessions and workspaces remain until the operator retires the project through Herdr.
114
+
115
+ `cleanup.preview` takes `taskId` and returns run identities, cleanup states, blocking consumers, delivery, archive and project policy without deleting anything. The dashboard exposes these operations under **Delivery and cleanup** in task details. Every mutation requires the current lead `lease` and a meaningful `reason`.
116
+
117
+ - `cleanup.release` takes `taskId` and optional `runId`. After the lead has inspected the result and decided that no native continuation is needed, it preserves bounded output and closes the settled worker's pane. Sibling panes stay open. Legacy runs without pane-scoped ownership retain exclusive single-pane tab release. The exact workspace, tab, pane, terminal, agent name/kind and native session must still match. Changed worker identities, busy agents, pending controls, lead waits, active dependent tasks and waiting parents prevent closure. Failed/cancelled results need this explicit inspection; their files remain intact.
118
+ - Automatic release defaults on and waits for a completed integrated outcome, a settled completed task, and no active consumers. It runs at most once per ten-second scan. Failed, blocked, paused, yielding and uncertain work stays available. A failed preflight is retained for inspection instead of being retried continuously.
119
+ - A close intent is durable before `pane.close` (or `tab.close` for legacy runs). Lost acknowledgements or restart during closure become `uncertain` and never replay automatically. `cleanup.reconcile` takes `taskId`, optional `runId`, and `resolution: "closed" | "not-closed"`. Closed requires the original pane and terminal to be absent (also the tab for legacy runs); not-closed requires the original settled identity. A later explicit release can retry a reconciled retained terminal. Closing a tab manually is also recognized only after confirming the original terminal is absent.
120
+ - `cleanup.deliver` records `disposition: "merged" | "published" | "abandoned"` and, except for abandonment, `targetRef`. It performs no commit, merge, fetch or push. Supply a full branch ref such as `refs/heads/main`; published work requires a refreshed remote-tracking ref such as `refs/remotes/origin/review`. The clean worktree's HEAD must be an ancestor of that target. Local remote-tracking metadata must be refreshed using the normal Git workflow first. Squash/rebase integration without ancestry proof needs manual review; it is not inferred from similar content. Modified, untracked and ignored files block delivery and collection. Preserve or remove those files explicitly; collection never forces their removal.
121
+ - `cleanup.archive` seals all finished tasks sharing a managed checkout after every recorded worker terminal has been released and all live consumers have finished. Completed tasks require integrated outcome completion. It stores receipt artifacts, file-check evidence and referenced outcome evidence with SHA-256 digests, a manifest containing reports/checks/output and public run identity, and a standalone Git bundle retaining committed history, including abandoned unique commits. Files and directories are flushed before the durable archive record is committed. Archives live in `<state>/archives/<archive-id>` and remain private. Sealed tasks cannot resume or retry; create a new assignment for further work.
122
+ - `cleanup.collect` requires the preview's exact `archiveId`, `taskId`, and optional `deleteBranch` (default false). It rechecks archive integrity, original worker absence, all tasks/projects sharing the checkout, Git identity, clean files, delivery ancestry and unchanged evidence. It removes the worktree through non-forced `git worktree remove`. Merged branch deletion rechecks ancestry and compares the branch tip against the archived commit with `git update-ref -d REF EXPECTED_COMMIT`; a moved tip is retained and exposes a recoverable partial result. Explicit abandonment plus `deleteBranch: true` permits compare-and-delete of the exact archived branch tip after checking that no checkout uses it. Published PR branches remain until a subsequent merged or abandoned delivery decision. That decision and branch collection can happen after the worktree has already been removed.
123
+
124
+ Live files remain authoritative while the checkout exists: archival does not mask edits or stale verification. Once an authorized collection removes it, existing `task:TASK_ID:path` evidence references resolve to their verified archived bytes. Missing or tampered archived evidence still invalidates acceptance. An interrupted removal retains its phase and error; inspect and repeat `cleanup.collect` with the same archive ID. It checks whether Git actually removed the original worktree before proceeding. A branch that moved is preserved. No session, workspace, source checkout, remote branch, archive, or unrelated file is collected.
125
+
126
+ `cleanup.configure` stores a project-wide authorized retention policy:
127
+
128
+ ```json
129
+ {
130
+ "lease": { "projectId": "PROJECT_ID", "owner": "LEAD", "epoch": 1, "token": "PRIVATE" },
131
+ "reason": "User authorized retaining delivered work for seven days",
132
+ "policy": {
133
+ "autoRelease": true,
134
+ "collectAfterHours": 168,
135
+ "deleteMergedBranches": false
136
+ }
137
+ }
138
+ ```
139
+
140
+ The default `collectAfterHours: null` retains worktrees until explicit collection; the default `deleteMergedBranches: false` retains branches. A configured delay begins at recorded delivery and never bypasses checks, archives or consumers. Only completed, delivered work is automatically archived and collected; failures and abandonment require explicit actions. Revoking/changing policy before a pending side effect stops that automatic operation. Cleanup errors remain in the inbox and archive/run records for inspection. Closing the supervisor drains cleanup operations along with other work; it does not initiate cleanup during shutdown.
141
+
142
+ Upgrade with `stop`, `start`, and setup using the existing state directory. The additive records retain schema 2 and existing run identities. A new supervisor is required for the cleanup tools; existing workers keep their versioned report executable paths.
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Marionette
2
2
 
3
+ [![CI](https://github.com/theaileverage/marionette/actions/workflows/ci.yml/badge.svg)](https://github.com/theaileverage/marionette/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/@theaileverage/marionette)](https://www.npmjs.com/package/@theaileverage/marionette)
5
+
3
6
  Marionette keeps one named lead conversation available while Codex, Claude Code, and AGY specialists work in Herdr. A persistent local supervisor owns dispatch and monitoring; the lead, MCP tools, CLI, and dashboard share the same task, decision, and inbox state.
4
7
 
5
8
  ## Outcome orchestration in 0.2
@@ -34,6 +37,21 @@ npx @theaileverage/marionette dashboard
34
37
 
35
38
  To install the shorter `marionette` command globally, use `npm install -g @theaileverage/marionette`.
36
39
 
40
+ ## Agent skill and Herdr SDK
41
+
42
+ The distributable agent skill lives at [skills/marionette/SKILL.md](skills/marionette/SKILL.md). Copy the `skills/marionette` folder into your agent's skill directory (for example `~/.codex/skills/marionette`) to enable discovery. It covers lead leases, assignments, outcome completion, worker reports, recovery, and programmatic terminal control.
43
+
44
+ The dependency-free ESM SDK targets Herdr 0.9.0/protocol 22. It exports typed access to all 102 schema methods, persistent event subscriptions, graphics streams, and short helpers for common operations:
45
+
46
+ ```js
47
+ import { HerdrClient } from '@theaileverage/marionette/herdr-sdk';
48
+
49
+ const herdr = HerdrClient.fromEnv(); // Requires a real Herdr-managed environment.
50
+ const { panes } = await herdr.pane.list(process.env.HERDR_WORKSPACE_ID);
51
+ ```
52
+
53
+ Services can pass an explicitly selected absolute socket path to `new HerdrClient(socketPath)`. Use `herdr.api["pane.resize"]({ pane_id, direction: "right", amount: 0.1 })` for the full wire API. See [the SDK guide](skills/marionette/references/herdr-sdk.md) for typed requests, subscriptions, binary/file frames, cancellation, and coverage limits. Use Marionette task APIs for managed workers; direct SDK calls do not create task records or enforce leases.
54
+
37
55
  ## Setup for agents and scripts
38
56
 
39
57
  The wizard and non-interactive setup use the same implementation. `--yes` accepts defaults; `--json` returns a JSON result and never prompts. Errors return `{ "ok": false, "error": "..." }` with a nonzero exit status when `--json` is used. Unknown options and config keys are rejected.
@@ -92,7 +110,7 @@ npm run build
92
110
  node dist/cli.js setup
93
111
  ```
94
112
 
95
- `npm pack` checks, tests, builds, and produces the same allowlisted tarball used for publishing. Only the bundled CLI/MCP executable, built dashboard, package metadata, and documentation are distributed; local state, logs, credentials, test artifacts, and source fixtures are excluded.
113
+ `npm pack` checks, tests, builds, and produces the same allowlisted tarball used for publishing. Only the bundled CLI/MCP executable, thin Herdr SDK with TypeScript declarations, agent skill, built dashboard, package metadata, and documentation are distributed; local state, logs, credentials, test artifacts, and source fixtures are excluded.
96
114
 
97
115
  ## Connect Herdr explicitly
98
116
 
@@ -118,7 +136,7 @@ node dist/cli.js call project.register --file register.json
118
136
  node dist/cli.js projects
119
137
  ```
120
138
 
121
- Registration checks the live socket and workspace. The socket path determines the actual session; the session name is the explicit human-readable label. Each assignment creates a new unfocused tab in that workspace. No existing pane is reused. Optional `agentArgs` contains argument arrays per kind (`codex`, `claude`, `agy`) when an explicit project-specific agent configuration is needed. It defaults to no overrides.
139
+ Registration checks the live socket and workspace. The socket path determines the actual session; the session name is the explicit human-readable label. Each assignment gets a new unfocused pane. Marionette groups up to four workers per owned tab, splitting the largest suitable pane to the right or down. It creates a new tab when no owned group has room for at least 60 columns by 12 rows per pane. Existing user panes are never reused; all live tab members must match saved Marionette terminal identities. Optional `agentArgs` contains argument arrays per kind (`codex`, `claude`, `agy`) when an explicit project-specific agent configuration is needed. It defaults to no overrides.
122
140
 
123
141
  ## Connect Codex desktop and terminal leads
124
142
 
@@ -163,7 +181,7 @@ The lead assesses likely file conflicts before dispatch: overlapping files, cros
163
181
  - Independent worktrees can edit the same repository files concurrently. Ownership remains a filesystem-path contract; it does not predict merge conflicts or protect shared external resources. Dependencies wait for completion but do not merge another task's changes into a worktree. Select an appropriate committed base when one task needs another's result.
164
182
  - Worktree creation requires an existing Git repository and a valid commit. Failure starts no worker and never falls back silently to the shared checkout. Git hooks are disabled for supervisor worktree operations; dependency installation, submodule initialization, and other project setup remain explicit task instructions.
165
183
 
166
- After verification, the lead recommends a next step and asks the user to choose unless already authorized: review locally, merge, or push the task branch and open a PR through the user's Git hosting workflow. Marionette retains the branch and worktree on completion, failure, and cancellation; it does not automatically commit, publish, merge, or delete them. Ordinary Git and PR tools can operate in `task.cwd`. Retries reuse the same worktree and preserve worker commits and uncommitted changes.
184
+ After verification, the lead recommends a next step and asks the user to choose unless already authorized: review locally, merge, or push the task branch and open a PR through the user's Git hosting workflow. Marionette retains the branch and worktree on completion, failure, and cancellation. It does not automatically commit, publish, or merge; the separate delivery/archive/cleanup lifecycle governs later removal. Ordinary Git and PR tools can operate in `task.cwd`. Retries reuse the same worktree and preserve worker commits and uncommitted changes.
167
185
 
168
186
  For existing worktrees created outside Marionette, supply an in-root `cwd` in shared mode or register an external worktree as a separate project. Separate projects cannot have cross-project task dependencies.
169
187
 
@@ -218,6 +236,14 @@ node dist/cli.js call decision.record --lease /private/tmp/marionette-lead.json
218
236
 
219
237
  Workers receive an attempt-scoped report credential through their new pane environment. The supplied instructions explain `worker-report --file REPORT.json`, including revision, summary, artifact paths, and evidence. Credentials are not included in briefings. Workers must request normal sandbox approval if their report command needs permission to reach the local supervisor.
220
238
 
239
+ ## Delivery and cleanup
240
+
241
+ Version 0.2.1 separates terminal release from delivery and Git cleanup. After integrated outcome completion, the supervisor can save worker diagnostics and close an eligible settled worker pane automatically. Failed/cancelled work needs explicit inspection; blocked, paused, waiting and uncertain workers stay intact.
242
+
243
+ Task completion preserves branches and worktrees. Use the task drawer's **Delivery and cleanup** panel or `cleanup.preview`, `cleanup.release`, `cleanup.deliver`, `cleanup.archive`, and `cleanup.collect` through CLI/MCP. Record merged, published or explicitly abandoned work, preserve evidence and committed history, then collect only the exact eligible checkout. A published PR branch stays available for later review and merge. Archives preserve completion evidence after the worktree is removed.
244
+
245
+ Automatic worktree collection is disabled by default. `cleanup.configure` can authorize a retention delay and optional merged-branch deletion. Dirty/untracked/ignored files, active consumers, changed resource identities and ambiguous operations prevent removal. Project Herdr sessions and workspaces remain. See [the full cleanup contract](ORCHESTRATION.md#delivery-archival-and-cleanup-in-021) for safeguards, recovery, and API inputs.
246
+
221
247
  ## Handover
222
248
 
223
249
  `lead_handover` transfers control atomically and returns the receiving lead's lease and a current briefing. The previous owner/token/epoch immediately stops authorizing writes; existing workers continue.
@@ -240,7 +266,7 @@ The inbox displays up to 200 unacknowledged events per page. Marking them read a
240
266
 
241
267
  - Restarting the supervisor reattaches using the saved workspace, terminal, agent name/kind, and native session identity. It does not repeat a prompt because a socket disconnected.
242
268
  - A crash during pane creation, prompt delivery, or control delivery produces an `uncertain` task. Inspect the original pane and use `task_reconcile` with `delivered` or `not-delivered` and actual evidence. Do not guess. No automatic replay occurs.
243
- - If creation lost its acknowledgement, no task prompt was attempted. `not-delivered` reconciliation checks for an absent tab or one matching untouched shell. An occupied or ambiguous tab is refused. Original tabs are retained. If the identity cannot be established, resolve the named pane/session through Herdr before retrying.
269
+ - If creation lost its acknowledgement, no task prompt was attempted. `not-delivered` reconciliation checks for an absent tab or one matching untouched shell. An occupied or ambiguous tab is refused. For interrupted splits, the saved pre-creation membership identifies a possible new shell; moved, occupied, or ambiguous additions are refused. Original terminals are retained. If the identity cannot be established, resolve the named pane/session through Herdr before retrying.
244
270
  - A crash during startup blocks for inspection and continuation of the existing pane. Restart during verification reruns checks. Design checks to be safe to repeat; Marionette cannot make arbitrary commands transactional.
245
271
  - Retries require a failed/cancelled task and a settled previous worker, and consume the assignment's maximum of one to three attempts. They are explicit, never automatic for ambiguous work.
246
272
  - Managed worktree creation persists `planned → creating → ready` before worker launch. Restart reuses a matching registered checkout. A creation interrupted before `ready` is reused only if clean at the pinned base; missing, incomplete, or mismatched checkouts fail preparation for inspection without reset, pruning, or destructive recreation. Once ready, retries preserve edits. An interrupted creation that cannot be validated requires manual inspection and repair or a new assignment.
@@ -261,3 +287,7 @@ npm run format:check
261
287
  The tests use isolated temporary databases and a labeled Herdr protocol double for deterministic failure injection, plus real Unix-socket transport and HTTP/STDIO MCP integration. They do not start paid agent work. The test runner needs permission to listen on local sockets.
262
288
 
263
289
  See [VERIFICATION.md](VERIFICATION.md) for the real three-agent acceptance evidence, browser results, and tested versions. [DESIGN.md](DESIGN.md) describes persistence, state transitions, and trust boundaries. `scripts/live-validation.mjs` inspects the opt-in live fixture retained on this machine; `start` intentionally refuses to duplicate an existing exercise. Its real results and private leases remain in `.runtime/`.
290
+
291
+ ## Contributing and releases
292
+
293
+ Marionette is MIT licensed. See [CONTRIBUTING.md](CONTRIBUTING.md) for development checks and [RELEASING.md](RELEASING.md) for versioned GitHub/npm releases.
package/RELEASING.md ADDED
@@ -0,0 +1,64 @@
1
+ # Releasing Marionette
2
+
3
+ The public repository is [theaileverage/marionette](https://github.com/theaileverage/marionette). Source changes go through pull requests into `main`. GitHub Actions runs formatting, metadata validation, type checks, tests, a production build and an installed-package smoke test on Linux and macOS with Node 22 and 24. These checks use protocol fixtures, not paid agent sessions.
4
+
5
+ ## Prepare a version
6
+
7
+ From a clean checkout, create a branch and run:
8
+
9
+ ```sh
10
+ git switch -c release/0.2.1
11
+ npm run release:prepare -- 0.2.1
12
+ ```
13
+
14
+ The helper updates `package.json`, `package-lock.json`, `src/version.ts` and a dated changelog section. Replace the placeholder with concrete release notes. Do not change the setup protocol number unless the protocol changes. Update verification evidence when behavior changes, then run:
15
+
16
+ ```sh
17
+ npm run format
18
+ npm run release:check
19
+ npm pack --pack-destination /private/tmp
20
+ ```
21
+
22
+ Commit the release preparation and open a pull request. `Required CI` must pass before merging. A tag must point at a commit contained in `main`; it must exactly match the package, lockfile, runtime version and changelog. Stable versions go to npm `latest`; prereleases such as `0.3.0-beta.1` go to `next`.
23
+
24
+ ## Publish the merged version
25
+
26
+ ```sh
27
+ git switch main
28
+ git pull --ff-only
29
+ git tag -a v0.2.1 -m 'Release 0.2.1'
30
+ git push origin v0.2.1
31
+ ```
32
+
33
+ The `Release` workflow rebuilds and verifies the package, publishes the tested tarball using npm OIDC, compares the registry integrity, then creates a GitHub release with the tarball and `SHA256SUMS`. It uses pinned official actions, read-only checkout credentials, a dedicated `npm` environment, and an explicitly scoped OIDC permission. No npm token is stored in GitHub.
34
+
35
+ If a run fails after npm publication, rerun the failed job. Existing package integrity must match before the workflow continues; it never overwrites an npm version or a differing GitHub asset. You can also dispatch on the existing tag:
36
+
37
+ ```sh
38
+ gh workflow run release.yml --ref v0.2.1 -f tag=v0.2.1
39
+ ```
40
+
41
+ Do not move or delete published tags. Fix a bad release with a new version. Registry publication is irreversible in the usual release workflow; removing a GitHub release does not remove its npm package.
42
+
43
+ ## npm trusted publisher
44
+
45
+ The package's trusted publisher must match these exact values:
46
+
47
+ - Package: `@theaileverage/marionette`
48
+ - Repository: `theaileverage/marionette`
49
+ - Workflow: `release.yml`
50
+ - Environment: `npm`
51
+ - Permission: publish
52
+
53
+ A package maintainer configures this once through npm's authenticated trust flow:
54
+
55
+ ```sh
56
+ npm exec --yes --package npm@11.19.1 -- npm trust github @theaileverage/marionette \
57
+ --repo theaileverage/marionette --file release.yml --env npm --allow-publish --yes
58
+ ```
59
+
60
+ npm may require fresh two-factor/browser authentication for this administrative operation. Subsequent CI publishing uses the GitHub OIDC identity. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/) and the [npm trust command](https://docs.npmjs.com/cli/v11/commands/npm-trust/). Protect the `npm` environment so only version tags deploy; repository administrators can manage any required reviewer policy.
61
+
62
+ ## Initial 0.2.0 release
63
+
64
+ Version 0.2.0 was published to npm before this repository existed. `.github/release-baseline.json` pins its verified registry integrity. Only this exact version may reuse the original npm tarball for its initial GitHub release; the workflow never attempts to republish it. The repository adds licensing, metadata and CI/release tooling after that publication, so rebuilding the initial repository commit need not reproduce the old package byte for byte. Future releases are built and published from their Git tags.
@@ -2258,3 +2258,211 @@ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
2258
2258
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
2259
2259
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2260
2260
  ```
2261
+
2262
+ ## Herdr 0.9.0 API schema
2263
+
2264
+ The SDK protocol types are generated from Herdr (https://github.com/herdrdev/herdr/tree/v0.9.0), licensed under Apache-2.0.
2265
+
2266
+ ```text
2267
+ Apache License
2268
+ Version 2.0, January 2004
2269
+ http://www.apache.org/licenses/
2270
+
2271
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
2272
+
2273
+ 1. Definitions.
2274
+
2275
+ "License" shall mean the terms and conditions for use, reproduction,
2276
+ and distribution as defined by Sections 1 through 9 of this document.
2277
+
2278
+ "Licensor" shall mean the copyright owner or entity authorized by
2279
+ the copyright owner that is granting the License.
2280
+
2281
+ "Legal Entity" shall mean the union of the acting entity and all
2282
+ other entities that control, are controlled by, or are under common
2283
+ control with that entity. For the purposes of this definition,
2284
+ "control" means (i) the power, direct or indirect, to cause the
2285
+ direction or management of such entity, whether by contract or
2286
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
2287
+ outstanding shares, or (iii) beneficial ownership of such entity.
2288
+
2289
+ "You" (or "Your") shall mean an individual or Legal Entity
2290
+ exercising permissions granted by this License.
2291
+
2292
+ "Source" form shall mean the preferred form for making modifications,
2293
+ including but not limited to software source code, documentation
2294
+ source, and configuration files.
2295
+
2296
+ "Object" form shall mean any form resulting from mechanical
2297
+ transformation or translation of a Source form, including but
2298
+ not limited to compiled object code, generated documentation,
2299
+ and conversions to other media types.
2300
+
2301
+ "Work" shall mean the work of authorship, whether in Source or
2302
+ Object form, made available under the License, as indicated by a
2303
+ copyright notice that is included in or attached to the work
2304
+ (an example is provided in the Appendix below).
2305
+
2306
+ "Derivative Works" shall mean any work, whether in Source or Object
2307
+ form, that is based on (or derived from) the Work and for which the
2308
+ editorial revisions, annotations, elaborations, or other modifications
2309
+ represent, as a whole, an original work of authorship. For the purposes
2310
+ of this License, Derivative Works shall not include works that remain
2311
+ separable from, or merely link (or bind by name) to the interfaces of,
2312
+ the Work and Derivative Works thereof.
2313
+
2314
+ "Contribution" shall mean any work of authorship, including
2315
+ the original version of the Work and any modifications or additions
2316
+ to that Work or Derivative Works thereof, that is intentionally
2317
+ submitted to Licensor for inclusion in the Work by the copyright owner
2318
+ or by an individual or Legal Entity authorized to submit on behalf of
2319
+ the copyright owner. For the purposes of this definition, "submitted"
2320
+ means any form of electronic, verbal, or written communication sent
2321
+ to the Licensor or its representatives, including but not limited to
2322
+ communication on electronic mailing lists, source code control systems,
2323
+ and issue tracking systems that are managed by, or on behalf of, the
2324
+ Licensor for the purpose of discussing and improving the Work, but
2325
+ excluding communication that is conspicuously marked or otherwise
2326
+ designated in writing by the copyright owner as "Not a Contribution."
2327
+
2328
+ "Contributor" shall mean Licensor and any individual or Legal Entity
2329
+ on behalf of whom a Contribution has been received by Licensor and
2330
+ subsequently incorporated within the Work.
2331
+
2332
+ 2. Grant of Copyright License. Subject to the terms and conditions of
2333
+ this License, each Contributor hereby grants to You a perpetual,
2334
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
2335
+ copyright license to reproduce, prepare Derivative Works of,
2336
+ publicly display, publicly perform, sublicense, and distribute the
2337
+ Work and such Derivative Works in Source or Object form.
2338
+
2339
+ 3. Grant of Patent License. Subject to the terms and conditions of
2340
+ this License, each Contributor hereby grants to You a perpetual,
2341
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
2342
+ (except as stated in this section) patent license to make, have made,
2343
+ use, offer to sell, sell, import, and otherwise transfer the Work,
2344
+ where such license applies only to those patent claims licensable
2345
+ by such Contributor that are necessarily infringed by their
2346
+ Contribution(s) alone or by combination of their Contribution(s)
2347
+ with the Work to which such Contribution(s) was submitted. If You
2348
+ institute patent litigation against any entity (including a
2349
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
2350
+ or a Contribution incorporated within the Work constitutes direct
2351
+ or contributory patent infringement, then any patent licenses
2352
+ granted to You under this License for that Work shall terminate
2353
+ as of the date such litigation is filed.
2354
+
2355
+ 4. Redistribution. You may reproduce and distribute copies of the
2356
+ Work or Derivative Works thereof in any medium, with or without
2357
+ modifications, and in Source or Object form, provided that You
2358
+ meet the following conditions:
2359
+
2360
+ (a) You must give any other recipients of the Work or
2361
+ Derivative Works a copy of this License; and
2362
+
2363
+ (b) You must cause any modified files to carry prominent notices
2364
+ stating that You changed the files; and
2365
+
2366
+ (c) You must retain, in the Source form of any Derivative Works
2367
+ that You distribute, all copyright, patent, trademark, and
2368
+ attribution notices from the Source form of the Work,
2369
+ excluding those notices that do not pertain to any part of
2370
+ the Derivative Works; and
2371
+
2372
+ (d) If the Work includes a "NOTICE" text file as part of its
2373
+ distribution, then any Derivative Works that You distribute must
2374
+ include a readable copy of the attribution notices contained
2375
+ within such NOTICE file, excluding those notices that do not
2376
+ pertain to any part of the Derivative Works, in at least one
2377
+ of the following places: within a NOTICE text file distributed
2378
+ as part of the Derivative Works; within the Source form or
2379
+ documentation, if provided along with the Derivative Works; or,
2380
+ within a display generated by the Derivative Works, if and
2381
+ wherever such third-party notices normally appear. The contents
2382
+ of the NOTICE file are for informational purposes only and
2383
+ do not modify the License. You may add Your own attribution
2384
+ notices within Derivative Works that You distribute, alongside
2385
+ or as an addendum to the NOTICE text from the Work, provided
2386
+ that such additional attribution notices cannot be construed
2387
+ as modifying the License.
2388
+
2389
+ You may add Your own copyright statement to Your modifications and
2390
+ may provide additional or different license terms and conditions
2391
+ for use, reproduction, or distribution of Your modifications, or
2392
+ for any such Derivative Works as a whole, provided Your use,
2393
+ reproduction, and distribution of the Work otherwise complies with
2394
+ the conditions stated in this License.
2395
+
2396
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
2397
+ any Contribution intentionally submitted for inclusion in the Work
2398
+ by You to the Licensor shall be under the terms and conditions of
2399
+ this License, without any additional terms or conditions.
2400
+ Notwithstanding the above, nothing herein shall supersede or modify
2401
+ the terms of any separate license agreement you may have executed
2402
+ with Licensor regarding such Contributions.
2403
+
2404
+ 6. Trademarks. This License does not grant permission to use the trade
2405
+ names, trademarks, service marks, or product names of the Licensor,
2406
+ except as required for reasonable and customary use in describing the
2407
+ origin of the Work and reproducing the content of the NOTICE file.
2408
+
2409
+ 7. Disclaimer of Warranty. Unless required by applicable law or
2410
+ agreed to in writing, Licensor provides the Work (and each
2411
+ Contributor provides its Contributions) on an "AS IS" BASIS,
2412
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
2413
+ implied, including, without limitation, any warranties or conditions
2414
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
2415
+ PARTICULAR PURPOSE. You are solely responsible for determining the
2416
+ appropriateness of using or redistributing the Work and assume any
2417
+ risks associated with Your exercise of permissions under this License.
2418
+
2419
+ 8. Limitation of Liability. In no event and under no legal theory,
2420
+ whether in tort (including negligence), contract, or otherwise,
2421
+ unless required by applicable law (such as deliberate and grossly
2422
+ negligent acts) or agreed to in writing, shall any Contributor be
2423
+ liable to You for damages, including any direct, indirect, special,
2424
+ incidental, or consequential damages of any character arising as a
2425
+ result of this License or out of the use or inability to use the
2426
+ Work (including but not limited to damages for loss of goodwill,
2427
+ work stoppage, computer failure or malfunction, or any and all
2428
+ other commercial damages or losses), even if such Contributor
2429
+ has been advised of the possibility of such damages.
2430
+
2431
+ 9. Accepting Warranty or Additional Liability. While redistributing
2432
+ the Work or Derivative Works thereof, You may choose to offer,
2433
+ and charge a fee for, acceptance of support, warranty, indemnity,
2434
+ or other liability obligations and/or rights consistent with this
2435
+ License. However, in accepting such obligations, You may act only
2436
+ on Your own behalf and on Your sole responsibility, not on behalf
2437
+ of any other Contributor, and only if You agree to indemnify,
2438
+ defend, and hold each Contributor harmless for any liability
2439
+ incurred by, or claims asserted against, such Contributor by reason
2440
+ of your accepting any such warranty or additional liability.
2441
+
2442
+ END OF TERMS AND CONDITIONS
2443
+
2444
+ APPENDIX: How to apply the Apache License to your work.
2445
+
2446
+ To apply the Apache License to your work, attach the following
2447
+ boilerplate notice, with the fields enclosed by brackets "[]"
2448
+ replaced with your own identifying information. (Don't include
2449
+ the brackets!) The text should be enclosed in the appropriate
2450
+ comment syntax for the file format. We also recommend that a
2451
+ file or class name and description of purpose be included on the
2452
+ same "printed page" as the copyright notice for easier
2453
+ identification within third-party archives.
2454
+
2455
+ Copyright [yyyy] [name of copyright owner]
2456
+
2457
+ Licensed under the Apache License, Version 2.0 (the "License");
2458
+ you may not use this file except in compliance with the License.
2459
+ You may obtain a copy of the License at
2460
+
2461
+ http://www.apache.org/licenses/LICENSE-2.0
2462
+
2463
+ Unless required by applicable law or agreed to in writing, software
2464
+ distributed under the License is distributed on an "AS IS" BASIS,
2465
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2466
+ See the License for the specific language governing permissions and
2467
+ limitations under the License.
2468
+ ```
package/VERIFICATION.md CHANGED
@@ -1,7 +1,27 @@
1
1
  # Verification record
2
2
 
3
+ ## Herdr SDK and pane layout 0.2.2 (8 September 2026)
4
+
5
+ The SDK exposes all 102 methods from the installed Herdr 0.9.0/protocol-22 schema plus the documented graphics-stream transport. The 117-test suite covers generated API coverage, socket framing, event cancellation and buffer limits, graphics errors and acknowledgements, pane layout selection, interrupted creation recovery, and sibling-safe terminal cleanup. The packed SDK was imported independently and its public TypeScript types compiled in a fresh consumer.
6
+
7
+ A disposable named Herdr 0.9.0 session and real attached Herdr client rendered a 120-by-80 four-color fixture through a simulated Kitty-capable PTY with 10-by-20-pixel cells. Captured terminal graphics commands contained byte-exact RGBA (38,400 bytes), RGB (28,800 bytes), converted BGRA (38,400 bytes), and PNG (289 bytes) payloads. A BGRA file frame returned the expected sequence 7 / revision 11 acknowledgement and emitted the expected RGBA pixels. All placements retained the requested 24-by-8-cell size. Frame replacement and stream closure emitted deletions for all five image IDs. The decoded renderer output was visually inspected.
8
+
9
+ This verifies the installed Herdr server/client rendering pipeline and SDK transports. The outer terminal was simulated; Computer Use denied access to Ghostty, so native Ghostty display and direct-file terminal consumption were not visually verified. No existing Herdr session was controlled and no paid agent was launched. The test server and frame sources were cleaned up.
10
+
11
+ ## Resource lifecycle 0.2.1 (8 September 2026)
12
+
13
+ The release adds 26 cleanup regression tests to the existing suite (100 total). The cleanup fixtures use real temporary Git repositories/worktrees and SQLite databases, plus an explicitly labelled Herdr protocol double. They exercise integrated-outcome release, retained failures/native-input states, split and replaced tabs, busy workers, lead handover, lost acknowledgements and restart reconciliation, dirty/untracked/ignored files, shared-checkout and registered-project consumers, archived evidence and Git bundles, tampering, branch movement, published-then-merged delivery, explicit abandonment, policy opt-in/revocation, directory/symlink artifacts and continuation after terminal release. HTTP/STDIO integration checks all 47 MCP tools, including the seven cleanup tools.
14
+
15
+ The installed Herdr protocol-20 schema was inspected for `tab.get`, `pane.list`, `agent.get`, and `tab.close`. No real user worker, tab, branch or worktree was removed in this release exercise, and no paid agent was launched. Protocol-fixture results do not claim new live native-agent acceptance; the earlier 0.2.0 exercise remains documented below.
16
+
17
+ The built dashboard was checked in an isolated temporary supervisor with no real Herdr connection. Cleanup eligibility rendered the retained worker and blocking reasons. A seven-day retention policy saved and reloaded through the UI. Screenshots were visually inspected at desktop and 390-pixel mobile width; the mobile drawer and document both measured 390 pixels with no horizontal overflow. The test used private fixture state and left production project bindings untouched.
18
+
19
+ Release gates: formatting, TypeScript checks, release metadata, the full suite, production build, packaged-install smoke, and the Linux/macOS Node 22/24 CI matrix. Evidence archival flushes files/directories before recording success; collection retains an explicit phase through interruptions and rechecks identity/integrity before removal. Herdr does not provide an atomic conditional-close primitive, so external operators must not repurpose a tab while cleanup is closing it.
20
+
3
21
  ## Outcome orchestration 0.2.0 (8 September 2026)
4
22
 
23
+ Published `@theaileverage/marionette@0.2.0` publicly with the `latest` tag. The registry integrity exactly matches the tested tarball, and an independent fresh-cache registry install returned version `0.2.0`. All required validation, including the cold-resume probe, passed before publication.
24
+
5
25
  The release candidate implements the complete outcome lifecycle. The current suite has **72 tests** covering recursive completion and an in-flight verification race, late requirements, artifact invalidation, cycles, scoped delegation, shared capacity/budgets, native identity fencing, ambiguous delivery, legacy migration, model discovery/validation and actual HTTP/STDIO MCP/CLI parity. Protocol doubles are explicitly separated from the real agent exercise below.
6
26
 
7
27
  ### Real supported-agent acceptance