@theaileverage/marionette 0.2.1 → 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 +7 -0
- package/DESIGN.md +3 -3
- package/ORCHESTRATION.md +2 -2
- package/README.md +19 -4
- package/THIRD_PARTY_NOTICES.md +208 -0
- package/VERIFICATION.md +8 -0
- package/dist/cli.js +789 -121
- package/dist/herdr-protocol.d.ts +1916 -0
- package/dist/herdr-protocol.js +108 -0
- package/dist/herdr-sdk.d.ts +105 -0
- package/dist/herdr-sdk.js +105 -0
- package/dist/herdr-streams.d.ts +49 -0
- package/dist/herdr-streams.js +156 -0
- package/dist/herdr-transport.d.ts +50 -0
- package/dist/herdr-transport.js +232 -0
- package/dist/mcp.js +1 -1
- package/package.json +22 -5
- package/public/assets/{index-BCi4LMak.js → index-CCfdv-uF.js} +1 -1
- package/public/index.html +1 -1
- package/skills/marionette/SKILL.md +70 -0
- package/skills/marionette/references/coordination.md +63 -0
- package/skills/marionette/references/herdr-sdk.md +147 -0
- package/vendor/herdr-0.9.0/LICENSE +201 -0
- package/vendor/herdr-0.9.0/README.md +5 -0
package/public/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="theme-color" content="#182a29" />
|
|
7
7
|
<title>Marionette · Project control</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-CCfdv-uF.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-Dfuji944.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: marionette
|
|
3
|
+
description: Coordinate persistent coding, research, and review workers through Marionette using its MCP tools or CLI. Use when asked to use Marionette, act as its lead, or complete an assignment in a Marionette worker pane.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Marionette
|
|
7
|
+
|
|
8
|
+
Marionette is a persistent supervisor for agent CLIs in Herdr. Leads use a fenced lease; workers use an attempt-scoped environment credential. Read the role you are performing below. Use Marionette for managed task dispatch and lifecycle; direct Herdr operations do not create Marionette assignments or satisfy acceptance checks.
|
|
9
|
+
|
|
10
|
+
## Connect and establish context
|
|
11
|
+
|
|
12
|
+
Prefer connected Marionette MCP tools. MCP names use underscores (`project_briefing`); CLI action names use dots (`project.briefing`). Read the tool's input schema before constructing a call.
|
|
13
|
+
|
|
14
|
+
For CLI access, use the installed `marionette`, or `node /absolute/package/dist/cli.js` for a source build. Commands discover the project binding from the working directory; pass `--home /absolute/state/directory` for a selected instance. Start with:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
marionette projects
|
|
18
|
+
marionette briefing PROJECT_ID
|
|
19
|
+
marionette inbox PROJECT_ID --consumer stable-lead-name
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Read the selected project's briefing, decisions, outstanding questions, and inbox before dispatch. Keep IDs from responses; do not infer workspace, task, revision, or lead identity from names or UI focus. Use `task_get` / `task.get` for targeted detail.
|
|
23
|
+
|
|
24
|
+
If setup is needed, `marionette setup --schema` and `setup --help` describe the installed options. `setup --json --project /absolute/project --lead codex-desktop --lead-name NAME` creates/reuses the named session, supervisor and project binding and configures the selected lead. Setup's `--dry-run` previews its effects. Preserve an existing installation and saved lead. `doctor` diagnoses connections; deleting state is not a recovery step.
|
|
25
|
+
|
|
26
|
+
## Lead workflow
|
|
27
|
+
|
|
28
|
+
Read a supplied bootstrap prompt and private lease file locally. Keep the token out of prose, artifacts, and logs. A CLI mutation accepts `--lease /private/path/lead.json`; an MCP mutation accepts the equivalent `lease` object. Acquire control only for initial establishment or an authorized takeover. `lead_handover` / `lead.handover` transfers the lease and invalidates the old one. Do not take over merely because another lead is quiet.
|
|
29
|
+
|
|
30
|
+
Submit an assignment with a stable idempotency `key`, an objective, `kind` (`codex`, `claude`, or `agy`), bounded `ownership`, and meaningful `checks`. See [assignment and outcome examples](references/coordination.md) when constructing inputs.
|
|
31
|
+
|
|
32
|
+
- Ownership paths are literal files or directory prefixes relative to the task's working directory, not globs. Workers share files unless explicitly placed in a worktree. Preserve concurrent edits.
|
|
33
|
+
- Assess file conflicts before choosing execution. Use shared mode for disjoint work or deliberate access to uncommitted changes. Recommend worktree mode for overlapping work and obtain a choice when the workflow has not already been authorized. Worktrees start from committed HEAD or `baseRef`; source edits and dependency branches are not automatically copied or merged.
|
|
34
|
+
- Submission returns before startup. A queued assignment may be waiting for dependencies, ownership, provider/model limits, or project capacity. Read its wait reason before retrying.
|
|
35
|
+
- After a lost submission response, reuse the same key and identical input. A changed objective needs a redirect/revision with its own key, not a duplicated assignment.
|
|
36
|
+
- Use `task_control` / `task.control` for reply, pause, cancel, redirect, or explicit keys. Cancellation retains the worker terminal. A worker's native permission UI requires inspecting the actual screen and resolving the specific request.
|
|
37
|
+
|
|
38
|
+
For durable multi-step outcomes, create criteria with `outcome_create`, attach assignments to the outcome and current tree revision, and use `plan_revise` with current revisions and reasons for changes. Review evidence independently. Finish with criterion assessments, integrated review, and `outcome_complete`; worker prose and terminal idle status are insufficient. Required failed, cancelled, stale, or unverified work prevents completion.
|
|
39
|
+
|
|
40
|
+
When no independent work remains, register `lead_wait` with an observable condition and yield. A Herdr adapter must pin the actual lead pane, terminal, agent name/kind, and native session obtained through `project_inspect`. Desktop leads use the `next-message` adapter: MCP alone does not wake an idle conversation. Read and acknowledge inbox events on later turns; do not hold a model turn open polling. Save checkpoints before handover or consequential context changes.
|
|
41
|
+
|
|
42
|
+
Completion retains Git worktrees and branches. Follow existing authorization for review, merging, publishing, and cleanup; task completion itself does not authorize publication. Use `cleanup_preview` before explicit release/delivery/archive/collection. Pane-aware workers can share a tab, so never close a worker's entire tab manually to release one worker.
|
|
43
|
+
|
|
44
|
+
## Worker workflow
|
|
45
|
+
|
|
46
|
+
Your launch prompt is the task contract: preserve its ID, current revision, working directory, owned paths, and checks. Use its exact durable worker CLI path. Credentials are already in `MARIONETTE_WORKER_TOKEN`, `MARIONETTE_TASK_ID`, and `MARIONETTE_URL`; do not print them or acquire a lead lease.
|
|
47
|
+
|
|
48
|
+
Write request/report JSON under `.marionette-reports/TASK_ID/` in the task working directory. Run the supplied `worker-report --file /absolute/report.json` command with, for example:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"revision": 1,
|
|
53
|
+
"type": "complete",
|
|
54
|
+
"summary": "Implemented the assigned behavior and verified it",
|
|
55
|
+
"artifacts": ["src/owned-file.ts"],
|
|
56
|
+
"evidence": ["Actual command and result"]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Use the actual revision and artifacts. Other report types are `progress`, `blocked`, and `failure`. For a question, report `blocked` with the precise question in `summary`, then yield. Request normal sandbox permission if the report command cannot reach the local supervisor. Finish your native turn after the report so Marionette can observe settlement and verify checks.
|
|
61
|
+
|
|
62
|
+
Only workers explicitly granted `canDelegate` may create children, through `worker-call` action `delegate`. Children stay within the parent's ownership and inherited budget. Read current state through `worker-call` action `inspect`; mutations include the current parent revision. After delegation, report `yield` at the returned `parentRevision`, end the turn, and stop editing delegated paths until resumed. Integrate child evidence and pass your own checks before completing.
|
|
63
|
+
|
|
64
|
+
## Recover uncertainty
|
|
65
|
+
|
|
66
|
+
An `uncertain` run means delivery or creation lost confirmation. Inspect the recorded pane and output, then use `task_reconcile` with evidence and `delivered` or `not-delivered`. Do not replay automatically. A creation interruption cannot be marked delivered because no task prompt was attempted. Ambiguous split membership or an occupied orphan pane requires manual inspection; recovery preserves it. Explicit retries consume the task's bounded attempts and preserve its worktree.
|
|
67
|
+
|
|
68
|
+
## Programmatic Herdr control
|
|
69
|
+
|
|
70
|
+
For explicitly requested terminal control or integration code, read [the thin SDK guide](references/herdr-sdk.md). The SDK controls terminals; it does not enforce Marionette leases, task ownership, or verification. Use task controls for Marionette-managed workers.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Assignment and outcome inputs
|
|
2
|
+
|
|
3
|
+
CLI calls accept JSON files; MCP calls accept the same fields with the lease supplied in the object. Replace IDs, paths and checks with observed project values.
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"assignment": {
|
|
8
|
+
"projectId": "PROJECT_ID",
|
|
9
|
+
"key": "parser-v1",
|
|
10
|
+
"title": "Implement invoice parser",
|
|
11
|
+
"kind": "codex",
|
|
12
|
+
"prompt": "Implement the parser and its behavior tests. Preserve concurrent edits.",
|
|
13
|
+
"ownership": ["src/parser.ts", "tests/parser.test.ts"],
|
|
14
|
+
"execution": { "mode": "shared" },
|
|
15
|
+
"dependencies": [],
|
|
16
|
+
"checks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "npm",
|
|
20
|
+
"args": ["test", "--", "tests/parser.test.ts"],
|
|
21
|
+
"timeoutMs": 30000
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"maxAttempts": 2
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
marionette call task.submit --file assignment.json --lease /private/path/lead.json
|
|
31
|
+
marionette call task.get --json '{"taskId":"RETURNED_TASK_ID"}'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Command checks execute without a shell. Use a real executable and argument array; shell syntax is not interpreted. File checks support `path`, optional `contains` and `sha256`, and `allowUnchanged` (false by default). A file normally must change from its dispatch digest. Worker-reported artifacts must be owned by the assignment.
|
|
35
|
+
|
|
36
|
+
For an isolated checkout use `"execution": { "mode": "worktree", "baseRef": "main" }` only when that branch and workflow are appropriate. `baseRef` is optional. Inspect returned `task.worktree` and `task.cwd`; don't invent the checkout path.
|
|
37
|
+
|
|
38
|
+
A persistent outcome starts with:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"outcome": {
|
|
43
|
+
"projectId": "PROJECT_ID",
|
|
44
|
+
"key": "parser-outcome-v1",
|
|
45
|
+
"objective": "Deliver correct invoice parsing",
|
|
46
|
+
"scope": ["src/parser.ts", "tests/parser.test.ts", "review"],
|
|
47
|
+
"category": "software",
|
|
48
|
+
"criteria": [
|
|
49
|
+
{
|
|
50
|
+
"id": "correct",
|
|
51
|
+
"description": "Valid invoices parse and invalid inputs fail clearly",
|
|
52
|
+
"requiredEvidence": "Independent tests and review"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
"maxTurns": 30,
|
|
56
|
+
"maxDepth": 2
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Call `outcome.create`, then add the returned `outcomeId` and current `expectedTreeRevision` to assignments. `maxTurns` bounds supervisor-triggered execution turns, not tokens or cost. Each required addition changes the tree revision; fetch fresh state before the next revision-sensitive call.
|
|
62
|
+
|
|
63
|
+
For each criterion call `outcome.assess` with `outcomeId`, `expectedRevision`, `criterionId`, `rationale`, and `references` (file path strings). Call `outcome.integrate` with the current revision, `summary`, and `references`; then `outcome.complete`. All require the lease. References into managed checkouts use `task:TASK_ID:relative/owned/file`. Never weaken the completion contract merely to pass it.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Thin Herdr SDK
|
|
2
|
+
|
|
3
|
+
## Coverage and compatibility
|
|
4
|
+
|
|
5
|
+
The SDK targets the installed Herdr **0.9.0, protocol 22** schema. It exposes all **102 schema-defined methods**, plus the documented `pane.graphics.stream` transport omitted by upstream's exported schema. This includes workspace, worktree, tab, pane, layout, agent, event, integration, plugin, notification, client, and server APIs. The full surface uses `api[method](params, options?)`; the short helpers below remain conveniences for common operations.
|
|
6
|
+
|
|
7
|
+
The vendored schema and generated types are reproducible with `npm run sdk:generate` in the Marionette source checkout. Coverage tests exercise every method through an isolated Unix-socket peer, plus streaming success/failure cases. A separate live 0.9.0 server/client check verified emitted RGB/RGBA/BGRA/PNG payloads, file-frame acknowledgements, placement, replacement, and layer removal using a simulated Kitty-capable terminal. See `VERIFICATION.md` in the package for evidence and limits; this does not validate every server-side operation or the native terminal display. Herdr still enforces semantic constraints, installed plugins, and client/graphics capabilities. Existing Marionette pane and agent methods also remain schema-compatible with 0.8.2/protocol 20.
|
|
8
|
+
|
|
9
|
+
The [Socket API documentation](https://herdr.dev/docs/socket-api/) describes the server contract. In 0.9.0, multiple clients can size tabs independently, so read current pane geometry before splitting.
|
|
10
|
+
|
|
11
|
+
After installing a build of Marionette containing the SDK, import its ESM subpath in Node.js 22.13+:
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import { HerdrClient, HerdrError } from '@theaileverage/marionette/herdr-sdk';
|
|
15
|
+
|
|
16
|
+
// Inside a real Herdr pane: reads HERDR_ENV and HERDR_SOCKET_PATH.
|
|
17
|
+
const herdr = HerdrClient.fromEnv();
|
|
18
|
+
const caller = process.env.HERDR_PANE_ID;
|
|
19
|
+
if (!caller) throw new Error('Missing caller pane');
|
|
20
|
+
const { layout } = await herdr.pane.layout(caller);
|
|
21
|
+
const rect = layout.panes.find((pane) => pane.pane_id === caller)?.rect;
|
|
22
|
+
if (!rect) throw new Error('Caller pane is missing from layout');
|
|
23
|
+
const { pane } = await herdr.pane.split(caller, {
|
|
24
|
+
direction: rect.width >= rect.height * 3 ? 'right' : 'down',
|
|
25
|
+
cwd: process.cwd(),
|
|
26
|
+
});
|
|
27
|
+
await herdr.agent.start(pane.pane_id, 'reviewer', 'codex');
|
|
28
|
+
const { agent } = await herdr.agent.get(pane.pane_id);
|
|
29
|
+
if (
|
|
30
|
+
agent.name !== 'reviewer' ||
|
|
31
|
+
agent.agent !== 'codex' ||
|
|
32
|
+
!['idle', 'done'].includes(agent.agent_status) ||
|
|
33
|
+
agent.launch_pending ||
|
|
34
|
+
agent.interactive_ready === false
|
|
35
|
+
) {
|
|
36
|
+
throw new Error('Inspect startup readiness before sending work');
|
|
37
|
+
}
|
|
38
|
+
await herdr.agent.prompt('reviewer', 'Review the assigned code and report actionable findings.', {
|
|
39
|
+
timeout_ms: 120000,
|
|
40
|
+
});
|
|
41
|
+
const { read } = await herdr.pane.read(pane.pane_id, 120);
|
|
42
|
+
console.log(read.text);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This example creates and runs an independent agent only when that work is authorized. Do not use it to bypass a Marionette worker's delegation restriction.
|
|
46
|
+
|
|
47
|
+
For service integration, `new HerdrClient('/absolute/explicitly-selected/herdr.sock')` selects a named connection without fabricating caller environment or relying on UI focus. The constructor does not discover or start sessions. Keep the selected socket private to the local user.
|
|
48
|
+
|
|
49
|
+
Typed helpers preserve Herdr's result envelopes and opaque IDs:
|
|
50
|
+
|
|
51
|
+
- `workspace.list()`, `workspace.create({ cwd, label, env?, focus? })`
|
|
52
|
+
- `tab.list(workspaceId)`, `tab.create(workspaceId, { cwd, label?, env?, focus? })`, `tab.close(tabId)`
|
|
53
|
+
- `pane.list(workspaceId)`, `pane.layout(paneId)`, `pane.split(paneId, { direction, cwd, ratio?, env?, focus? })`
|
|
54
|
+
- `pane.read(paneId, lines?)`, `pane.sendText(paneId, text)`, `pane.sendKeys(paneId, keys)`, `pane.close(paneId)`
|
|
55
|
+
- `agent.start(paneId, name, kind, args?, timeoutMs?)`, `agent.get(target)`, `agent.prompt(target, text, wait?)`, `agent.wait(target, { timeout_ms, until? })`, `agent.sendKeys(target, keys)`
|
|
56
|
+
|
|
57
|
+
Creation defaults to `focus: false`. `pane.split` maps its target to the protocol's `target_pane_id`. Read uses `recent_unwrapped` text. `sendText` does not submit Enter; use `agent.prompt` for atomic agent prompt submission. Start requires an available shell pane. `agent.start` only acknowledges the protocol launch; check `agent.get` for matching identity and interactive readiness before prompting. The CLI can provide additional startup polling that the raw socket does not.
|
|
58
|
+
|
|
59
|
+
## Full typed wire API
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { HerdrClient, HERDR_METHODS } from '@theaileverage/marionette/herdr-sdk';
|
|
63
|
+
|
|
64
|
+
const herdr = HerdrClient.fromEnv();
|
|
65
|
+
const info = await herdr.request('ping');
|
|
66
|
+
if (info.type === 'pong') console.log(info.version, info.protocol);
|
|
67
|
+
|
|
68
|
+
// Same exact method and parameter names as Herdr's schema:
|
|
69
|
+
const layout = await herdr.api['pane.layout']({ pane_id: process.env.HERDR_PANE_ID });
|
|
70
|
+
if (layout.type === 'pane_layout') console.log(layout.layout.panes);
|
|
71
|
+
const plugins = await herdr.api['plugin.list']();
|
|
72
|
+
if (plugins.type === 'plugin_list') console.log(plugins.plugins);
|
|
73
|
+
console.log(HERDR_METHODS); // 102 schema-defined names
|
|
74
|
+
console.log(Object.keys(herdr.api)); // Includes pane.graphics.stream as well
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`request(method, params?, options?)` supports all one-shot methods with generated parameter types. It returns the schema's discriminated `HerdrResult` union; narrow on `result.type` to read a particular response shape. Parameters are required when the schema requires fields. Runtime semantic and range validation belongs to Herdr. Values are ordinary JSON/JavaScript values; use safe integer values for counters that need exact arithmetic.
|
|
78
|
+
|
|
79
|
+
`api[method]` exposes those same calls and routes `events.subscribe` and `pane.graphics.stream` to persistent connections. `HerdrParams`, `HerdrMethod`, `HerdrResult`, `HerdrEvent`, and the request/response type namespaces are exported for typed agent code. The wire API passes parameters as supplied: unlike convenience creation helpers, it does not add `focus: false` or fill missing targets. Pass explicit IDs to avoid server-focused defaults.
|
|
80
|
+
|
|
81
|
+
Options accept `signal: AbortSignal`, `timeoutMs`, and `maxResponseBytes` (default 32 MiB per message). Ordinary requests default to 10 seconds. Agent startup and server waits allow their requested server timeout plus five seconds; a wait with no server deadline remains open until completion, disconnect or cancellation. `timeoutMs: null` explicitly disables the transport deadline. Aborting a mutation cannot undo input already delivered.
|
|
82
|
+
|
|
83
|
+
`call<Result>(method, params?, timeoutMs?)` remains an untyped escape hatch for future one-shot extensions, with a 10-second default. JavaScript omits `<Result>`. It refuses the two streaming methods, since closing at their first acknowledgement would discard the stream.
|
|
84
|
+
|
|
85
|
+
## Event subscriptions
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
const controller = new AbortController();
|
|
89
|
+
const events = await herdr.subscribe([{ type: 'pane.created' }, { type: 'layout.updated' }], {
|
|
90
|
+
signal: controller.signal,
|
|
91
|
+
maxQueuedEvents: 1024,
|
|
92
|
+
});
|
|
93
|
+
try {
|
|
94
|
+
// Subscribe first: 0.9.0 does not replay lifecycle history.
|
|
95
|
+
const snapshot = await herdr.request('session.snapshot');
|
|
96
|
+
console.log(snapshot);
|
|
97
|
+
for await (const event of events) {
|
|
98
|
+
console.log(event.event, event.data);
|
|
99
|
+
// Apply events to the snapshot in order; break when this monitoring job finishes.
|
|
100
|
+
}
|
|
101
|
+
} finally {
|
|
102
|
+
events.close();
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Subscription creation resolves only after Herdr's acknowledgement. It then buffers events while the initial snapshot is loading. All lifecycle, output-match, agent-status, and scroll subscriptions are available through generated `RequestTypes.Subscription`. A `for await` break or `events.close()` releases the socket. The supplied signal cancels the stream's entire lifetime. The open timeout applies only to acknowledgement.
|
|
107
|
+
|
|
108
|
+
Buffers default to 1,024 pending messages and 32 MiB total; `maxQueuedEvents` and `maxQueuedBytes` customize these bounds. Overflow fails with `herdr_stream_overflow` and closes the socket instead of silently losing events. Errors and unexpected disconnects reject iteration and `events.closed`. The SDK never reconnects or replays automatically; after an intentional reconnect, subscribe first and take a fresh snapshot.
|
|
109
|
+
|
|
110
|
+
## Graphics streams
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
const stream = await herdr.graphicsStream({ pane_id: 'OBSERVED_PANE_ID', layer_id: 'preview' });
|
|
114
|
+
try {
|
|
115
|
+
// One pixel of owned RGBA bytes; the SDK computes data_length.
|
|
116
|
+
await stream.frame(
|
|
117
|
+
{ format: 'rgba', image_width: 1, image_height: 1 },
|
|
118
|
+
new Uint8Array([255, 128, 0, 255]),
|
|
119
|
+
);
|
|
120
|
+
// Keep the stream open for the desired display lifetime.
|
|
121
|
+
} finally {
|
|
122
|
+
stream.close(); // Herdr removes the layer when its owning stream closes.
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Await each frame before sending another. Concurrent frames are rejected with `herdr_stream_busy` to prevent interleaved headers/bodies. Inline PNG/RGB/RGBA/BGRA frames send a JSON header followed by exactly the raw payload bytes, up to Herdr's 16 MiB inline limit. `frame()` resolves after the local socket write; Herdr does not send successful inline-frame acknowledgements. Observe `stream.closed` for later server errors.
|
|
127
|
+
|
|
128
|
+
For negotiated direct-file transport, first inspect `api['pane.graphics.info']`. Only use it when the server advertises support for the intended format, layer, size and attached terminal. Send an immutable absolute local `rgba` or `bgra` file with:
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
const ack = await stream.fileFrame({
|
|
132
|
+
format: 'rgba',
|
|
133
|
+
image_width: 800,
|
|
134
|
+
image_height: 600,
|
|
135
|
+
file: { path: '/absolute/private/frame.rgba' },
|
|
136
|
+
sequence: 1,
|
|
137
|
+
revision: 1,
|
|
138
|
+
});
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The returned ACK must match both sequence and revision before the source file may be reused. A failed or timed-out call grants no source-reuse acknowledgement. The SDK does not read, write or remove the source file. Frame calls have a 30-second default transport deadline. Graphics-stream request/frame types are maintained against Herdr's tagged stream implementation because the exported schema omits that method.
|
|
142
|
+
|
|
143
|
+
## Errors and scope
|
|
144
|
+
|
|
145
|
+
Errors expose `code` and `message`. Server codes are preserved; transport failures include `herdr_timeout`, `herdr_unavailable`, `herdr_disconnected`, `herdr_aborted`, `herdr_response_too_large`, and `herdr_stream_overflow`. A timeout or disconnect can occur after a mutation succeeded. Inspect the intended target before deciding to retry.
|
|
146
|
+
|
|
147
|
+
The SDK is dependency-free at runtime and accepts explicitly selected Unix socket paths or Windows named-pipe paths. It does not start sessions, manage permissions, install plugins, or dispatch workers except through the API calls the caller chooses. Closing a tab closes every pane inside it; preserve sibling workers and close only resources within the authorized scope.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Herdr 0.9.0 socket schema
|
|
2
|
+
|
|
3
|
+
`api.schema.json` is the unmodified output of `herdr api schema --json` from the installed Herdr 0.9.0 binary (protocol 22). The corresponding upstream release is https://github.com/herdrdev/herdr/tree/v0.9.0. The upstream Apache-2.0 license is retained in `LICENSE`.
|
|
4
|
+
|
|
5
|
+
Marionette generates TypeScript declarations and its method registry with `npm run sdk:generate`. The generated types describe wire structure; Herdr enforces numeric ranges, feature availability, and other semantic constraints. The documented `pane.graphics.stream` transport is handled separately because upstream omits it from this JSON schema; its contract comes from `src/api/schema/panes.rs` and `src/api/server/pane_graphics_stream.rs` at the same tag.
|