@scotthuang/agent-knock-knock 0.14.14 → 0.14.15
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 +5 -0
- package/README.md +3 -3
- package/dist/src/doctor-capabilities.d.ts +7 -2
- package/dist/src/doctor-capabilities.js +15 -14
- package/dist/src/doctor-capabilities.js.map +1 -1
- package/dist/src/herdr-api-contract.d.ts +15 -0
- package/dist/src/herdr-api-contract.js +152 -0
- package/dist/src/herdr-api-contract.js.map +1 -0
- package/dist/src/herdr-compatibility.d.ts +48 -0
- package/dist/src/herdr-compatibility.js +36 -0
- package/dist/src/herdr-compatibility.js.map +1 -0
- package/dist/src/herdr-operation-capabilities.d.ts +17 -0
- package/dist/src/herdr-operation-capabilities.js +66 -0
- package/dist/src/herdr-operation-capabilities.js.map +1 -0
- package/dist/src/herdr-terminal-control-provider.d.ts +11 -6
- package/dist/src/herdr-terminal-control-provider.js +158 -79
- package/dist/src/herdr-terminal-control-provider.js.map +1 -1
- package/dist/src/install-doctor-command-adapter.js +5 -2
- package/dist/src/install-doctor-command-adapter.js.map +1 -1
- package/dist/src/terminal-monitor-decision-policy.d.ts +1 -1
- package/dist/src/terminal-permission-control-list-projection.d.ts +1 -1
- package/docs/openclaw-operations.md +1 -1
- package/docs/quickstart-herdr.md +15 -3
- package/package.json +1 -1
- package/templates/openclaw-skills/agent-knock-knock/SKILL.md +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.14.15 - 2026-10-21
|
|
4
|
+
|
|
5
|
+
- Determine local Herdr capabilities per operation instead of rejecting unfamiliar versions. Retain `0.8.0` / protocol `19` and `0.9.5` / protocol `22` as tested baselines, with socket, terminal and process identity checks before input.
|
|
6
|
+
- Probe read capabilities without terminal input; require a matching CLI schema declaration or verified baseline behavior for writes. Keep untested servers without input evidence read-only, reject incompatible declarations without fallback, and preserve uncertainty after dispatch. Doctor reports installation readiness separately from unprobed live capabilities.
|
|
7
|
+
|
|
3
8
|
## 0.14.14 - 2026-10-18
|
|
4
9
|
|
|
5
10
|
- Attempt all implemented Codex Desktop operations after an app update instead of blocking writes on an exact version allowlist. Preserve tested-build metadata separately from current action availability.
|
package/README.md
CHANGED
|
@@ -198,7 +198,7 @@ can use a supported terminal route. Claude Code direct control is available unde
|
|
|
198
198
|
|
|
199
199
|
| Component | Supported boundary |
|
|
200
200
|
| --- | --- |
|
|
201
|
-
| Terminal hosts | tmux; local Herdr `0.8.0` protocol `19` |
|
|
201
|
+
| Terminal hosts | tmux; local Herdr with per-operation capability checks (AKK `0.14.15`+). Tested Herdr baselines: `0.8.0` / protocol `19` and `0.9.5` / protocol `22`. See the [Herdr guide](docs/quickstart-herdr.md#current-boundary). |
|
|
202
202
|
| Codex Desktop | macOS with a compatible live connection; app updates alone do not disable controls. See the [tested versions and operation matrix](docs/codex-desktop-compatibility.md#version-and-platform-evidence). |
|
|
203
203
|
| Codex CLI shared backend | Live-tested on macOS: CLI `0.162.1` + backend `0.162.1`, and previously `0.160.0` + `0.162.0`. Requires a loaded main CLI conversation and compatible live protocol. These are tested combinations, **not a numeric minimum**. |
|
|
204
204
|
| Claude Code direct connection | macOS, live-tested `2.1.296`, compatible native peer protocol `1`, and Python 3 available to AKK. Basic task sending, progress and completion observation; unsupported controls require the original terminal. See the [direct guide](docs/claude-cli-direct.md). |
|
|
@@ -208,7 +208,7 @@ can use a supported terminal route. Claude Code direct control is available unde
|
|
|
208
208
|
| DeepSeek Harness connector | Web `0.2.0-rc.2` (RC); connector `0.1.0-rc.5` (`next`), pinned AKK `0.14.7`. See its guide for alpha and legacy coverage. |
|
|
209
209
|
| Runtime | Node.js `22.19.0`+ on macOS or Linux |
|
|
210
210
|
|
|
211
|
-
The adjacent OpenClaw boundary `2026.5.10-beta.2` is intentionally unsupported. Herdr
|
|
211
|
+
The adjacent OpenClaw boundary `2026.5.10-beta.2` is intentionally unsupported. Herdr versions are observations, not an allowlist: discovery verifies live identity and read capabilities, while input requires a matching CLI schema declaration or verified baseline behavior. An untested server without input evidence exposes only verified read capabilities. Desktop controls validate the live native contract. Desktop catalog presence alone does not prove the conversation is open or controllable. See each connector guide, the [Pi/DSH validation matrix](docs/pi-dsh-compatibility.md), and the Desktop guide for tested boundaries and limitations.
|
|
212
212
|
|
|
213
213
|
Codex CLI model changes and cancellation still require an eligible terminal.
|
|
214
214
|
New/clear/resume operations for paginated Codex CLI `0.158+` and cold-loading
|
|
@@ -225,7 +225,7 @@ Choose the guide that matches what you are trying to do:
|
|
|
225
225
|
| Guide | Use it for |
|
|
226
226
|
| --- | --- |
|
|
227
227
|
| [tmux quick start](docs/quickstart-tmux.md) | First OpenClaw task, multiple panes, and selectors |
|
|
228
|
-
| [Herdr quick start](docs/quickstart-herdr.md) | Local Herdr discovery and
|
|
228
|
+
| [Herdr quick start](docs/quickstart-herdr.md) | Local Herdr discovery, operation capabilities, and tested baselines |
|
|
229
229
|
| [Codex CLI direct control](docs/codex-cli-native-compatibility.md) | Connect without tmux/Herdr, select conversations, send tasks, and follow exact progress and completion |
|
|
230
230
|
| [Claude Code direct control](docs/claude-cli-direct.md) | Basic tasks without tmux/Herdr or Claude plugins, exact progress and completion, and terminal fallback boundaries |
|
|
231
231
|
| [Codex Desktop](docs/codex-desktop-compatibility.md) | Discover existing Desktop conversations, send and monitor exact tasks, respond to interactions, and change native settings |
|
|
@@ -6,6 +6,7 @@ export interface DoctorCommandCheck {
|
|
|
6
6
|
command: string;
|
|
7
7
|
available: boolean;
|
|
8
8
|
version_supported?: boolean;
|
|
9
|
+
version_tested?: boolean;
|
|
9
10
|
native_profile_supported?: boolean;
|
|
10
11
|
native_profile?: string;
|
|
11
12
|
native_actions_available?: boolean;
|
|
@@ -47,8 +48,12 @@ interface DoctorTmuxCapability extends DoctorModeCapability {
|
|
|
47
48
|
recommended: true;
|
|
48
49
|
}
|
|
49
50
|
interface DoctorHerdrCapability extends DoctorModeCapability {
|
|
51
|
+
/** Legacy diagnostic: a valid CLI is not excluded by its release number. */
|
|
50
52
|
version_supported: boolean;
|
|
51
|
-
|
|
53
|
+
version_tested: boolean;
|
|
54
|
+
tested_versions: readonly string[];
|
|
55
|
+
compatibility_policy: "capability_probe";
|
|
56
|
+
runtime_capability_state: "not_probed";
|
|
52
57
|
}
|
|
53
58
|
export interface DoctorCapabilitySummary {
|
|
54
59
|
coreOk: boolean;
|
|
@@ -60,7 +65,7 @@ export interface DoctorCapabilitySummary {
|
|
|
60
65
|
tmux: DoctorTmuxCapability;
|
|
61
66
|
herdr: DoctorHerdrCapability;
|
|
62
67
|
}
|
|
63
|
-
export declare const DOCTOR_SUPPORTED_HERDR_VERSION: "0.
|
|
68
|
+
export declare const DOCTOR_SUPPORTED_HERDR_VERSION: "0.9.5";
|
|
64
69
|
export declare const DOCTOR_PROBE_COMMANDS: readonly DoctorProbeCommand[];
|
|
65
70
|
/**
|
|
66
71
|
* Return the exact native lifecycle/status profile verified for a coding-agent
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { HERDR_EXACT_VERSION, HERDR_SUPPORTED_VERSIONS, herdrCompatibilityProfile } from "./herdr-compatibility.js";
|
|
2
3
|
import { claudeNativeInspectionBehaviorProfile, claudeRuntimeCompatibilityWarning, claudeRuntimeLifecycleCompatibilityProfile } from "./claude-lifecycle-compatibility.js";
|
|
3
4
|
import { codexLifecycleBehaviorProfile, codexRuntimeCompatibilityProfile, codexRuntimeLifecycleBehaviorProfile } from "./codex-lifecycle-compatibility.js";
|
|
4
|
-
export const DOCTOR_SUPPORTED_HERDR_VERSION =
|
|
5
|
+
export const DOCTOR_SUPPORTED_HERDR_VERSION = HERDR_EXACT_VERSION;
|
|
6
|
+
const HERDR_VERSION_REQUIREMENT = "herdr (runtime capabilities checked per operation)";
|
|
5
7
|
const DEFAULT_PROBE_TIMEOUT_MS = 3_000;
|
|
6
8
|
const MAX_PROBE_TIMEOUT_MS = 30_000;
|
|
7
9
|
const MAX_PROBE_BUFFER_BYTES = 64 * 1024;
|
|
@@ -140,7 +142,6 @@ export function evaluateDoctorCapabilities(checks) {
|
|
|
140
142
|
const tmuxTransportOk = isUsable(checkByCommand.get("tmux"));
|
|
141
143
|
const herdrCheck = checkByCommand.get("herdr");
|
|
142
144
|
const herdrExecutableOk = isUsable(herdrCheck);
|
|
143
|
-
const herdrVersionSupported = herdrExecutableOk && herdrCheck?.version_supported === true;
|
|
144
145
|
const tmux = {
|
|
145
146
|
available: tmuxTransportOk && agentsOk,
|
|
146
147
|
status: readinessFromParts([coreOk, tmuxTransportOk, agentsOk]),
|
|
@@ -154,30 +155,29 @@ export function evaluateDoctorCapabilities(checks) {
|
|
|
154
155
|
]
|
|
155
156
|
};
|
|
156
157
|
const herdr = {
|
|
157
|
-
available:
|
|
158
|
-
status: readinessFromParts([coreOk,
|
|
159
|
-
version_supported:
|
|
160
|
-
|
|
158
|
+
available: herdrExecutableOk && agentsOk,
|
|
159
|
+
status: readinessFromParts([coreOk, herdrExecutableOk, agentsOk]),
|
|
160
|
+
version_supported: herdrExecutableOk,
|
|
161
|
+
version_tested: herdrCheck?.version_tested === true,
|
|
162
|
+
tested_versions: HERDR_SUPPORTED_VERSIONS,
|
|
163
|
+
compatibility_policy: "capability_probe",
|
|
164
|
+
runtime_capability_state: "not_probed",
|
|
161
165
|
agents: availableAgents,
|
|
162
166
|
requires: [
|
|
163
167
|
"node",
|
|
164
168
|
"openclaw",
|
|
165
|
-
|
|
169
|
+
HERDR_VERSION_REQUIREMENT,
|
|
166
170
|
"codex or claude"
|
|
167
171
|
],
|
|
168
172
|
missing: [
|
|
169
173
|
...missingCore,
|
|
170
|
-
...(!herdrExecutableOk
|
|
171
|
-
? ["herdr"]
|
|
172
|
-
: !herdrVersionSupported
|
|
173
|
-
? [`herdr ${DOCTOR_SUPPORTED_HERDR_VERSION}`]
|
|
174
|
-
: []),
|
|
174
|
+
...(!herdrExecutableOk ? ["herdr"] : []),
|
|
175
175
|
...(!agentsOk ? ["codex or claude"] : [])
|
|
176
176
|
]
|
|
177
177
|
};
|
|
178
178
|
const availableTransports = [
|
|
179
179
|
...(tmuxTransportOk ? ["tmux"] : []),
|
|
180
|
-
...(
|
|
180
|
+
...(herdrExecutableOk ? ["herdr"] : [])
|
|
181
181
|
];
|
|
182
182
|
const anyTransportOk = availableTransports.length > 0;
|
|
183
183
|
return {
|
|
@@ -232,7 +232,8 @@ function buildProbeResult({ command, executable, args, status, durationMs, versi
|
|
|
232
232
|
: {}),
|
|
233
233
|
...(command === "herdr"
|
|
234
234
|
? {
|
|
235
|
-
version_supported: status === "ok"
|
|
235
|
+
version_supported: status === "ok",
|
|
236
|
+
version_tested: herdrCompatibilityProfile(version) !== undefined
|
|
236
237
|
}
|
|
237
238
|
: {}),
|
|
238
239
|
found: status !== "not_found",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-capabilities.js","sourceRoot":"","sources":["../../src/doctor-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,qCAAqC,EACrC,iCAAiC,EACjC,0CAA0C,EAC3C,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,EAChC,oCAAoC,EACrC,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"doctor-capabilities.js","sourceRoot":"","sources":["../../src/doctor-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qCAAqC,EACrC,iCAAiC,EACjC,0CAA0C,EAC3C,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,EAChC,oCA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redInputContract {
|
|
6
|
+
textInput: HerdrOperationSupport;
|
|
7
|
+
keyInput: HerdrOperationSupport;
|
|
8
|
+
rawTextInput: HerdrOperationSupport;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Inspect a CLI declaration, not remote negotiation or proof of execution.
|
|
12
|
+
* Callers must bind its version/protocol to the current server observation.
|
|
13
|
+
* Unknown constraints cannot silently authorize input; no input is probed here.
|
|
14
|
+
*/
|
|
15
|
+
export declare function inspectHerdrInputSchema(schema: unknown, protocol: number): HerdrDeclaredInputContract;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { isRecord } from "./value-guards.js";
|
|
2
|
+
const ANNOTATIONS = new Set([
|
|
3
|
+
"$comment", "title", "description", "default", "examples", "deprecated"
|
|
4
|
+
]);
|
|
5
|
+
const DIALECT = "https://json-schema.org/draft/2020-12/schema";
|
|
6
|
+
/**
|
|
7
|
+
* Inspect a CLI declaration, not remote negotiation or proof of execution.
|
|
8
|
+
* Callers must bind its version/protocol to the current server observation.
|
|
9
|
+
* Unknown constraints cannot silently authorize input; no input is probed here.
|
|
10
|
+
*/
|
|
11
|
+
export function inspectHerdrInputSchema(schema, protocol) {
|
|
12
|
+
if (!isRecord(schema) || schema.schema_version !== 1 || !isRecord(schema.schemas) ||
|
|
13
|
+
"$id" in schema || (schema.$schema !== undefined && schema.$schema !== DIALECT)) {
|
|
14
|
+
return unavailableContract("unknown", "unrecognized_cli_schema_envelope");
|
|
15
|
+
}
|
|
16
|
+
if (schema.protocol !== protocol)
|
|
17
|
+
return unavailableContract("unknown", "cli_schema_protocol_mismatch");
|
|
18
|
+
const { request, success_response: success, error_response: error } = schema.schemas;
|
|
19
|
+
if (!isRecord(request) || !isRecord(success) || !isRecord(error)) {
|
|
20
|
+
return unavailableContract("unknown", "cli_schema_envelopes_missing");
|
|
21
|
+
}
|
|
22
|
+
const reader = new HerdrSchemaReader(schema);
|
|
23
|
+
if (!validEnvelopes(reader, request, success, error)) {
|
|
24
|
+
return unavailableContract("unsupported", "cli_schema_request_or_ack_contract_incompatible");
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
textInput: inputOperation(reader, request, "pane.send_input", "text"),
|
|
28
|
+
keyInput: inputOperation(reader, request, "pane.send_input", "keys"),
|
|
29
|
+
rawTextInput: inputOperation(reader, request, "pane.send_text", "text")
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function unavailableContract(state, reason) {
|
|
33
|
+
return { textInput: { state, reason }, keyInput: { state, reason }, rawTextInput: { state, reason } };
|
|
34
|
+
}
|
|
35
|
+
/** Only the bounded, internal-reference JSON Schema subset used by Herdr. */
|
|
36
|
+
class HerdrSchemaReader {
|
|
37
|
+
schema;
|
|
38
|
+
constructor(schema) {
|
|
39
|
+
this.schema = schema;
|
|
40
|
+
}
|
|
41
|
+
deref(value) {
|
|
42
|
+
const visited = new Set();
|
|
43
|
+
for (let depth = 0; depth < 8; depth++) {
|
|
44
|
+
if (!isRecord(value))
|
|
45
|
+
return undefined;
|
|
46
|
+
if (!("$ref" in value))
|
|
47
|
+
return value;
|
|
48
|
+
const ref = value.$ref;
|
|
49
|
+
if (typeof ref !== "string" || !ref.startsWith("#/schemas/") || visited.has(ref) ||
|
|
50
|
+
!onlyKeys(value, ["$ref"]))
|
|
51
|
+
return undefined;
|
|
52
|
+
visited.add(ref);
|
|
53
|
+
value = this.pointer(ref);
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
pointer(ref) {
|
|
58
|
+
let value = this.schema;
|
|
59
|
+
for (const part of ref.slice(2).split("/")) {
|
|
60
|
+
const key = part.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
61
|
+
if (!isRecord(value) || !Object.hasOwn(value, key) || "$id" in value ||
|
|
62
|
+
(value.$schema !== undefined && value.$schema !== DIALECT))
|
|
63
|
+
return undefined;
|
|
64
|
+
value = value[key];
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
string(value, constant) {
|
|
69
|
+
const shape = this.deref(value);
|
|
70
|
+
return !!shape && shape.type === "string" &&
|
|
71
|
+
onlyKeys(shape, constant === undefined ? ["type"] : ["type", "const"]) &&
|
|
72
|
+
(constant === undefined || shape.const === constant);
|
|
73
|
+
}
|
|
74
|
+
object(value, sent, required, extras = []) {
|
|
75
|
+
const shape = this.deref(value);
|
|
76
|
+
if (!shape || shape.type !== "object" || !isRecord(shape.properties) ||
|
|
77
|
+
!onlyKeys(shape, ["type", "properties", "required", "$defs", ...extras]) ||
|
|
78
|
+
!Array.isArray(shape.required) ||
|
|
79
|
+
!shape.required.every((key) => typeof key === "string" && sent.includes(key)) ||
|
|
80
|
+
!required.every((key) => shape.required.includes(key)))
|
|
81
|
+
return undefined;
|
|
82
|
+
return shape;
|
|
83
|
+
}
|
|
84
|
+
// Unknown branches can overlap. Exclude only a provably different discriminator.
|
|
85
|
+
possibleVariants(variants, key, expected) {
|
|
86
|
+
if (!Array.isArray(variants))
|
|
87
|
+
return [];
|
|
88
|
+
return variants.filter((value) => {
|
|
89
|
+
const shape = this.deref(value);
|
|
90
|
+
const discriminator = shape && isRecord(shape.properties) ? this.deref(shape.properties[key]) : undefined;
|
|
91
|
+
return !discriminator || typeof discriminator.const !== "string" || discriminator.const === expected;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function property(shape, key) {
|
|
96
|
+
return isRecord(shape.properties) ? shape.properties[key] : undefined;
|
|
97
|
+
}
|
|
98
|
+
function validEnvelopes(reader, request, success, error) {
|
|
99
|
+
const req = reader.object(request, ["id", "method", "params"], ["id"], ["oneOf"]);
|
|
100
|
+
const ack = reader.object(success, ["id", "result"], ["id", "result"]);
|
|
101
|
+
const err = reader.object(error, ["id", "error"], ["id", "error"]);
|
|
102
|
+
if (!req || !ack || !err || !Array.isArray(req.oneOf) ||
|
|
103
|
+
Object.keys(req.properties).some((key) => key !== "id"))
|
|
104
|
+
return false;
|
|
105
|
+
const body = reader.object(property(err, "error"), ["code", "message"], ["code", "message"]);
|
|
106
|
+
const result = reader.deref(property(ack, "result"));
|
|
107
|
+
if (!body || !result || !onlyKeys(result, ["oneOf"]))
|
|
108
|
+
return false;
|
|
109
|
+
const oks = reader.possibleVariants(result.oneOf, "type", "ok");
|
|
110
|
+
const ok = oks.length === 1 && reader.object(oks[0], ["type"], ["type"]);
|
|
111
|
+
return !!ok && reader.string(property(ok, "type"), "ok") &&
|
|
112
|
+
[req, ack, err].every((shape) => reader.string(property(shape, "id"))) &&
|
|
113
|
+
reader.string(property(body, "code")) && reader.string(property(body, "message"));
|
|
114
|
+
}
|
|
115
|
+
function inputOperation(reader, request, method, field) {
|
|
116
|
+
const unavailable = (detail) => ({
|
|
117
|
+
state: "unsupported", reason: `cli_schema_${method}_${field}_${detail}`
|
|
118
|
+
});
|
|
119
|
+
const variants = reader.possibleVariants(request.oneOf, "method", method);
|
|
120
|
+
if (variants.length !== 1)
|
|
121
|
+
return unavailable("method_missing_or_ambiguous");
|
|
122
|
+
const variant = reader.object(variants[0], ["method", "params"], ["method", "params"]);
|
|
123
|
+
if (!variant || !reader.string(property(variant, "method"), method))
|
|
124
|
+
return unavailable("request_incompatible");
|
|
125
|
+
if (Object.keys(variant.properties).some((key) => !["method", "params"].includes(key))) {
|
|
126
|
+
return unavailable("unrecognized_envelope_constraint");
|
|
127
|
+
}
|
|
128
|
+
const params = reader.deref(property(variant, "params"));
|
|
129
|
+
if (params?.additionalProperties !== undefined && typeof params.additionalProperties !== "boolean") {
|
|
130
|
+
return unavailable("unknown_additional_properties_constraint");
|
|
131
|
+
}
|
|
132
|
+
// additionalProperties=false is safe here: every field we send is declared.
|
|
133
|
+
const shape = reader.object(params, ["pane_id", field], ["pane_id"], ["additionalProperties"]);
|
|
134
|
+
if (!shape)
|
|
135
|
+
return unavailable("params_incompatible");
|
|
136
|
+
if (!reader.string(property(shape, "pane_id")))
|
|
137
|
+
return unavailable("pane_identity_incompatible");
|
|
138
|
+
if (!validPayload(reader, property(shape, field), field))
|
|
139
|
+
return unavailable("payload_incompatible");
|
|
140
|
+
return { state: "available", reason: "matching_cli_schema" };
|
|
141
|
+
}
|
|
142
|
+
function validPayload(reader, value, field) {
|
|
143
|
+
if (field === "text")
|
|
144
|
+
return reader.string(value);
|
|
145
|
+
const keys = reader.deref(value);
|
|
146
|
+
return !!keys && keys.type === "array" && onlyKeys(keys, ["type", "items"]) && reader.string(keys.items);
|
|
147
|
+
}
|
|
148
|
+
function onlyKeys(value, keys) {
|
|
149
|
+
return Object.keys(value).every((key) => ANNOTATIONS.has(key) || keys.includes(key) ||
|
|
150
|
+
(key === "$schema" && value[key] === DIALECT));
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=herdr-api-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herdr-api-contract.js","sourceRoot":"","sources":["../../src/herdr-api-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAc7C,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY;CACxE,CAAC,CAAC;AACH,MAAM,OAAO,GAAG,8CAA8C,CAAC;AAE/D;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAe,EAAE,QAAgB;IACvE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,cAAc,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;QAC7E,KAAK,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC,EAAE,CAAC;QACpF,OAAO,mBAAmB,CAAC,SAAS,EAAE,kCAAkC,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,KAA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AAC,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3G,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa,EAAE,IAAc;IAC7C,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QACjF,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Releases with direct behavior evidence, not a runtime version allowlist.
|
|
3
|
+
* Herdr's endpoint protocol generation is a separate UI protocol; ping and
|
|
4
|
+
* session.snapshot report the protocol numbers below.
|
|
5
|
+
*
|
|
6
|
+
* v0.8.0 and v0.9.5 retain the same NDJSON envelopes, terminal/process identity,
|
|
7
|
+
* pane.read sources and formats, and single-enqueue pane.send_input semantics.
|
|
8
|
+
* v0.9.5 adds a pre-enqueue canonical-line size check (pane_send_failed).
|
|
9
|
+
*/
|
|
10
|
+
export declare const HERDR_COMPATIBILITY_PROFILES: readonly [{
|
|
11
|
+
readonly version: "0.9.5";
|
|
12
|
+
readonly protocol: 22;
|
|
13
|
+
}, {
|
|
14
|
+
readonly version: "0.8.0";
|
|
15
|
+
readonly protocol: 19;
|
|
16
|
+
}];
|
|
17
|
+
export type HerdrCompatibilityProfile = typeof HERDR_COMPATIBILITY_PROFILES[number];
|
|
18
|
+
export interface HerdrServerObservation {
|
|
19
|
+
version: string;
|
|
20
|
+
protocol: number;
|
|
21
|
+
baselineKnown: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface HerdrOperationCapability {
|
|
24
|
+
state: "available" | "unsupported" | "unknown";
|
|
25
|
+
reason: string;
|
|
26
|
+
evidence: "runtime_probe" | "matching_cli_schema" | "verified_release" | "none";
|
|
27
|
+
}
|
|
28
|
+
export interface HerdrOperationCapabilities {
|
|
29
|
+
visibleText: HerdrOperationCapability;
|
|
30
|
+
visibleAnsi: HerdrOperationCapability;
|
|
31
|
+
detectionText: HerdrOperationCapability;
|
|
32
|
+
textInput: HerdrOperationCapability;
|
|
33
|
+
keyInput: HerdrOperationCapability;
|
|
34
|
+
rawTextInput: HerdrOperationCapability;
|
|
35
|
+
}
|
|
36
|
+
/** Latest verified release, retained for diagnostic and fixture compatibility. */
|
|
37
|
+
export declare const HERDR_EXACT_VERSION: "0.9.5";
|
|
38
|
+
export declare const HERDR_EXACT_PROTOCOL: 22;
|
|
39
|
+
export declare const HERDR_SUPPORTED_VERSIONS: ("0.8.0" | "0.9.5")[];
|
|
40
|
+
export declare function herdrCompatibilityProfile(version: unknown): HerdrCompatibilityProfile | undefined;
|
|
41
|
+
export declare function matchesHerdrCompatibilityProfile(value: {
|
|
42
|
+
version?: unknown;
|
|
43
|
+
protocol?: unknown;
|
|
44
|
+
}, profile: Pick<HerdrServerObservation, "version" | "protocol">): boolean;
|
|
45
|
+
export declare function observeHerdrServer(value: {
|
|
46
|
+
version?: unknown;
|
|
47
|
+
protocol?: unknown;
|
|
48
|
+
}): HerdrServerObservation | undefined;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Releases with direct behavior evidence, not a runtime version allowlist.
|
|
3
|
+
* Herdr's endpoint protocol generation is a separate UI protocol; ping and
|
|
4
|
+
* session.snapshot report the protocol numbers below.
|
|
5
|
+
*
|
|
6
|
+
* v0.8.0 and v0.9.5 retain the same NDJSON envelopes, terminal/process identity,
|
|
7
|
+
* pane.read sources and formats, and single-enqueue pane.send_input semantics.
|
|
8
|
+
* v0.9.5 adds a pre-enqueue canonical-line size check (pane_send_failed).
|
|
9
|
+
*/
|
|
10
|
+
export const HERDR_COMPATIBILITY_PROFILES = [
|
|
11
|
+
{ version: "0.9.5", protocol: 22 },
|
|
12
|
+
{ version: "0.8.0", protocol: 19 }
|
|
13
|
+
];
|
|
14
|
+
/** Latest verified release, retained for diagnostic and fixture compatibility. */
|
|
15
|
+
export const HERDR_EXACT_VERSION = HERDR_COMPATIBILITY_PROFILES[0].version;
|
|
16
|
+
export const HERDR_EXACT_PROTOCOL = HERDR_COMPATIBILITY_PROFILES[0].protocol;
|
|
17
|
+
export const HERDR_SUPPORTED_VERSIONS = HERDR_COMPATIBILITY_PROFILES.map((profile) => profile.version);
|
|
18
|
+
export function herdrCompatibilityProfile(version) {
|
|
19
|
+
return HERDR_COMPATIBILITY_PROFILES.find((profile) => profile.version === version);
|
|
20
|
+
}
|
|
21
|
+
export function matchesHerdrCompatibilityProfile(value, profile) {
|
|
22
|
+
return value.version === profile.version && value.protocol === profile.protocol;
|
|
23
|
+
}
|
|
24
|
+
export function observeHerdrServer(value) {
|
|
25
|
+
if (typeof value.version !== "string" || !value.version.trim() ||
|
|
26
|
+
typeof value.protocol !== "number" || !Number.isSafeInteger(value.protocol) ||
|
|
27
|
+
value.protocol < 0)
|
|
28
|
+
return undefined;
|
|
29
|
+
const baseline = herdrCompatibilityProfile(value.version);
|
|
30
|
+
return {
|
|
31
|
+
version: value.version,
|
|
32
|
+
protocol: value.protocol,
|
|
33
|
+
baselineKnown: baseline !== undefined && baseline.protocol === value.protocol
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=herdr-compatibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herdr-compatibility.js","sourceRoot":"","sources":["../../src/herdr-compatibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;CAC1B,CAAC;AA0BX,kFAAkF;AAClF,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@
|
|
|
1
|
+
import type { TerminalControlCapability, TerminalEndpointRef, TerminalProviderCapability } from "./terminal-control-ref.js";
|
|
2
|
+
import type { HerdrOperationCapabilities, HerdrServerObservation } from "./herdr-compatibility.js";
|
|
3
|
+
export interface HerdrCliObservation {
|
|
4
|
+
version?: string;
|
|
5
|
+
schema?: unknown;
|
|
6
|
+
schemaState: "available" | "unavailable" | "malformed";
|
|
7
|
+
}
|
|
8
|
+
export declare function declaredHerdrInputCapabilities(cli: HerdrCliObservation, server: HerdrServerObservation): Pick<HerdrOperationCapabilities, "textInput" | "keyInput" | "rawTextInput">;
|
|
9
|
+
export declare function herdrControlCapabilities(operations: HerdrOperationCapabilities): TerminalControlCapability[];
|
|
10
|
+
export declare function assertOperationAvailable(capabilities: HerdrOperationCapabilities, operation: keyof HerdrOperationCapabilities): void;
|
|
11
|
+
export declare function assertInputEndpointCapability(terminal: TerminalEndpointRef, providerCapabilities: readonly TerminalProviderCapability[], providerCapability: "text_delivery" | "key_delivery", operations?: HerdrOperationCapabilities): void;
|
|
12
|
+
/** Prefer agent detection for plain status; visible text is a bounded fallback. */
|
|
13
|
+
export declare function selectHerdrReadOperation(capabilities: HerdrOperationCapabilities, viewportOnly: boolean, preserveEscapes: boolean): {
|
|
14
|
+
source: "visible" | "detection";
|
|
15
|
+
format: "text" | "ansi";
|
|
16
|
+
operation: "visibleText" | "visibleAnsi" | "detectionText";
|
|
17
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { inspectHerdrInputSchema } from "./herdr-api-contract.js";
|
|
2
|
+
import { TerminalControlInputNotSentError } from "./terminal-control-provider.js";
|
|
3
|
+
export function declaredHerdrInputCapabilities(cli, server) {
|
|
4
|
+
const mismatched = cli.version !== server.version;
|
|
5
|
+
if (mismatched || cli.schemaState === "unavailable") {
|
|
6
|
+
const capability = server.baselineKnown
|
|
7
|
+
? { state: "available", reason: "verified release input behavior; no matching CLI schema", evidence: "verified_release" }
|
|
8
|
+
: { state: "unknown", reason: "no matching CLI schema or verified input behavior", evidence: "none" };
|
|
9
|
+
return { textInput: capability, keyInput: capability, rawTextInput: capability };
|
|
10
|
+
}
|
|
11
|
+
const declaration = inspectHerdrInputSchema(cli.schema, server.protocol);
|
|
12
|
+
const capability = (support) => ({
|
|
13
|
+
...support,
|
|
14
|
+
evidence: support.state === "unknown" ? "none" : "matching_cli_schema"
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
textInput: capability(declaration.textInput),
|
|
18
|
+
keyInput: capability(declaration.keyInput),
|
|
19
|
+
rawTextInput: capability(declaration.rawTextInput)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function herdrControlCapabilities(operations) {
|
|
23
|
+
const readable = [operations.visibleText, operations.detectionText]
|
|
24
|
+
.some((capability) => capability.state === "available");
|
|
25
|
+
// Public Send is a composite text+Enter operation. Keep detailed partial
|
|
26
|
+
// input support in diagnostics instead of advertising an unusable Send.
|
|
27
|
+
const sendable = operations.textInput.state === "available" &&
|
|
28
|
+
operations.keyInput.state === "available";
|
|
29
|
+
return [
|
|
30
|
+
...(readable ? ["screen_status", "screen_completion"] : []),
|
|
31
|
+
"durable_completion",
|
|
32
|
+
...(sendable ? ["send_keys", "terminal_approval", "terminal_cancel"] : [])
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
export function assertOperationAvailable(capabilities, operation) {
|
|
36
|
+
const capability = capabilities[operation];
|
|
37
|
+
if (capability.state !== "available") {
|
|
38
|
+
throw new Error(`Herdr ${operation} is ${capability.state}: ${capability.reason}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function assertInputEndpointCapability(terminal, providerCapabilities, providerCapability, operations) {
|
|
42
|
+
if (terminal.identity.providerKind !== "herdr") {
|
|
43
|
+
throw new TerminalControlInputNotSentError(`terminal control provider herdr cannot use ${terminal.identity.providerKind}`);
|
|
44
|
+
}
|
|
45
|
+
if (!terminal.capabilities.includes("send_keys")) {
|
|
46
|
+
const detail = operations ? ["textInput", "keyInput"]
|
|
47
|
+
.filter((operation) => operations[operation].state !== "available")
|
|
48
|
+
.map((operation) => `${operation} is ${operations[operation].state}: ${operations[operation].reason}`)
|
|
49
|
+
.join("; ") : "";
|
|
50
|
+
throw new TerminalControlInputNotSentError(`Herdr terminal does not permit send_keys${detail ? `; ${detail}` : ""}`);
|
|
51
|
+
}
|
|
52
|
+
if (!providerCapabilities.includes(providerCapability)) {
|
|
53
|
+
throw new TerminalControlInputNotSentError(`Herdr provider does not support ${providerCapability}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Prefer agent detection for plain status; visible text is a bounded fallback. */
|
|
57
|
+
export function selectHerdrReadOperation(capabilities, viewportOnly, preserveEscapes) {
|
|
58
|
+
if (preserveEscapes)
|
|
59
|
+
return { source: "visible", format: "ansi", operation: "visibleAnsi" };
|
|
60
|
+
if (viewportOnly || (capabilities.detectionText.state !== "available" &&
|
|
61
|
+
capabilities.visibleText.state === "available")) {
|
|
62
|
+
return { source: "visible", format: "text", operation: "visibleText" };
|
|
63
|
+
}
|
|
64
|
+
return { source: "detection", format: "text", operation: "detectionText" };
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=herdr-operation-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herdr-operation-capabilities.js","sourceRoot":"","sources":["../../src/herdr-operation-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAgBlF,MAAM,UAAU,8BAA8B,CAC5C,GAAwB,EACxB,MAA8B;IAE9B,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO,CAAC;IAClD,IAAI,UAAU,IAAI,GAAG,CAAC,WAAW,KAAK,aAAa,EAAE,CAAC;QACpD,MAAM,UAAU,GAA6B,MAAM,CAAC,aAAa;YAC/D,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E,CAAC;QACnB,MAAM,IAAI,gCAAgC,CACxC,2CAA2C,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACzE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,gCAAgC,CACxC,mCAAmC,kBAAkB,EAAE,CACxD,CAAC;IACJ,CAAC;AACH,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,wBAAwB,CACtC,YAAwC,EACxC,YAAqB,EACrB,eAAwB;IAMxB,IAAI,eAAe;QAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;IAC5F,IAAI,YAAY,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,KAAK,WAAW;QACjE,YAAY,CAAC,WAAW,CAAC,KAAK,KAAK,WAAW,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;IACzE,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;AAC7E,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { type HerdrOperationCapabilities, type HerdrServerObservation } from "./herdr-compatibility.js";
|
|
2
|
+
export { HERDR_EXACT_PROTOCOL, HERDR_EXACT_VERSION } from "./herdr-compatibility.js";
|
|
1
3
|
import { type CommandResult, type TerminalDiscoveryDiagnosticLog, type TerminalControlProvider, type TerminalViewport } from "./terminal-control-provider.js";
|
|
2
4
|
import { type TerminalControlCapability, type TerminalControlRef, type TerminalEndpointRef, type TerminalProviderCapability } from "./terminal-control-ref.js";
|
|
3
5
|
import type { TerminalProcessSnapshot } from "./terminal-agent-adapter.js";
|
|
4
6
|
import { type HerdrRequestFunction, type HerdrSocketIdentity } from "./herdr-socket-transport.js";
|
|
5
7
|
export { HerdrApiError, HerdrTransportError, readHerdrSocketIdentity, requestHerdrUnixSocket, type HerdrRequestFunction, type HerdrRequestOptions, type HerdrSocketIdentity, type HerdrWireRequest } from "./herdr-socket-transport.js";
|
|
6
|
-
export declare const HERDR_EXACT_VERSION = "0.8.0";
|
|
7
|
-
export declare const HERDR_EXACT_PROTOCOL = 19;
|
|
8
8
|
export interface HerdrTtyDeviceIdentity {
|
|
9
9
|
device: string;
|
|
10
10
|
inode: string;
|
|
@@ -32,14 +32,17 @@ export interface HerdrSessionInfo {
|
|
|
32
32
|
export interface HerdrTerminalControlDiagnostics {
|
|
33
33
|
commands: string[];
|
|
34
34
|
selectedCommand?: string;
|
|
35
|
-
expectedVersion: string;
|
|
36
|
-
expectedProtocol: number;
|
|
37
35
|
sessions: HerdrSessionInfo[];
|
|
38
36
|
attempts: Array<{
|
|
39
37
|
session: string;
|
|
40
38
|
socketPath: string;
|
|
41
39
|
status: "ok" | "error";
|
|
42
40
|
paneCount?: number;
|
|
41
|
+
server?: HerdrServerObservation;
|
|
42
|
+
capabilities?: Array<{
|
|
43
|
+
paneId: string;
|
|
44
|
+
operations: HerdrOperationCapabilities;
|
|
45
|
+
}>;
|
|
43
46
|
skippedWithoutShellPid?: string[];
|
|
44
47
|
error?: string;
|
|
45
48
|
}>;
|
|
@@ -56,7 +59,7 @@ export declare class HerdrTerminalControlProvider implements TerminalControlProv
|
|
|
56
59
|
private readonly statSocket;
|
|
57
60
|
private readonly inspectTtyViewport;
|
|
58
61
|
private readonly diagnosticLog?;
|
|
59
|
-
private readonly
|
|
62
|
+
private readonly endpointObservations;
|
|
60
63
|
private requestSequence;
|
|
61
64
|
constructor(options?: {
|
|
62
65
|
command?: string;
|
|
@@ -83,13 +86,15 @@ export declare class HerdrTerminalControlProvider implements TerminalControlProv
|
|
|
83
86
|
scrollHistoryDown(terminal: TerminalEndpointRef): Promise<void>;
|
|
84
87
|
private logDiagnostic;
|
|
85
88
|
private discoverSessions;
|
|
89
|
+
private inspectCliSchema;
|
|
86
90
|
private probeCommand;
|
|
87
91
|
private inspectSession;
|
|
92
|
+
private probeReadCapability;
|
|
88
93
|
private assertCompatibleServer;
|
|
89
94
|
private invoke;
|
|
90
95
|
private resolveForInput;
|
|
91
96
|
private sendInput;
|
|
92
|
-
private
|
|
97
|
+
private requireEndpointObservation;
|
|
93
98
|
}
|
|
94
99
|
export declare function parseHerdrSessionList(output: string): HerdrSessionInfo[];
|
|
95
100
|
/** Translate the tmux-oriented bridge key vocabulary to Herdr key combos. */
|