@peakflo/agent-harness 0.0.0-stage → 0.2.1-rc.3
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/LICENSE +21 -0
- package/README.md +38 -2
- package/dist/adapters/acp-adapter.d.ts +177 -0
- package/dist/adapters/acp-adapter.js +1732 -0
- package/dist/adapters/claude-code-adapter.d.ts +171 -0
- package/dist/adapters/claude-code-adapter.js +1918 -0
- package/dist/adapters/codex-adapter.d.ts +67 -0
- package/dist/adapters/codex-adapter.js +681 -0
- package/dist/adapters/codex-app-server-adapter.d.ts +105 -0
- package/dist/adapters/codex-app-server-adapter.js +1309 -0
- package/dist/adapters/coding-agent-adapter.d.ts +289 -0
- package/dist/adapters/coding-agent-adapter.js +31 -0
- package/dist/adapters/index.d.ts +17 -0
- package/dist/adapters/index.js +35 -0
- package/dist/adapters/model-gateway.d.ts +84 -0
- package/dist/adapters/model-gateway.js +270 -0
- package/dist/adapters/opencode-adapter.d.ts +403 -0
- package/dist/adapters/opencode-adapter.js +2710 -0
- package/dist/adapters/opencode-config.d.ts +41 -0
- package/dist/adapters/opencode-config.js +147 -0
- package/dist/adapters/opencode-server-policy.d.ts +82 -0
- package/dist/adapters/opencode-server-policy.js +148 -0
- package/dist/adapters/pi-adapter.d.ts +168 -0
- package/dist/adapters/pi-adapter.js +1468 -0
- package/dist/capabilities.d.ts +58 -0
- package/dist/capabilities.js +161 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +231 -0
- package/dist/contract.d.ts +273 -0
- package/dist/contract.js +357 -0
- package/dist/control-plane.d.ts +178 -0
- package/dist/control-plane.js +431 -0
- package/dist/credential-store.d.ts +110 -0
- package/dist/credential-store.js +181 -0
- package/dist/enrol/browser-enrol.d.ts +85 -0
- package/dist/enrol/browser-enrol.js +387 -0
- package/dist/github-command-guards.d.ts +20 -0
- package/dist/github-command-guards.js +330 -0
- package/dist/github-proxy-certificates.d.ts +25 -0
- package/dist/github-proxy-certificates.js +145 -0
- package/dist/github-proxy.d.ts +37 -0
- package/dist/github-proxy.js +476 -0
- package/dist/github-workspace.d.ts +55 -0
- package/dist/github-workspace.js +537 -0
- package/dist/harness.d.ts +333 -0
- package/dist/harness.js +1414 -0
- package/dist/health.d.ts +45 -0
- package/dist/health.js +116 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +123 -0
- package/dist/model-probe.d.ts +96 -0
- package/dist/model-probe.js +195 -0
- package/dist/options.d.ts +15 -0
- package/dist/options.js +212 -0
- package/dist/ports-default.d.ts +212 -0
- package/dist/ports-default.js +333 -0
- package/dist/ports.d.ts +436 -0
- package/dist/ports.js +27 -0
- package/dist/runtime/attachments.d.ts +92 -0
- package/dist/runtime/attachments.js +377 -0
- package/dist/runtime/child-stream-guards.d.ts +45 -0
- package/dist/runtime/child-stream-guards.js +111 -0
- package/dist/runtime/conversation.d.ts +87 -0
- package/dist/runtime/conversation.js +156 -0
- package/dist/runtime/lease-renewal.d.ts +169 -0
- package/dist/runtime/lease-renewal.js +433 -0
- package/dist/runtime/mcp-auth-proxy.d.ts +82 -0
- package/dist/runtime/mcp-auth-proxy.js +300 -0
- package/dist/runtime/permission-mode.d.ts +116 -0
- package/dist/runtime/permission-mode.js +146 -0
- package/dist/runtime/projection.d.ts +71 -0
- package/dist/runtime/projection.js +211 -0
- package/dist/runtime/session-runner.d.ts +520 -0
- package/dist/runtime/session-runner.js +2122 -0
- package/dist/shared/reasoning-effort.d.ts +11 -0
- package/dist/shared/reasoning-effort.js +20 -0
- package/dist/store/conversation-store.d.ts +100 -0
- package/dist/store/conversation-store.js +305 -0
- package/dist/store/sqlite-store.d.ts +120 -0
- package/dist/store/sqlite-store.js +346 -0
- package/dist/types.d.ts +952 -0
- package/dist/types.js +55 -0
- package/dist/version.d.ts +32 -0
- package/dist/version.js +77 -0
- package/package.json +53 -4
package/dist/types.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* THE RUNNER WIRE CONTRACT — the single meeting point between the control
|
|
4
|
+
* plane (Track A, workflow-builder) and the harness (Track B, extracted from
|
|
5
|
+
* 20x).
|
|
6
|
+
*
|
|
7
|
+
* This file is the contract. `packages/agentSandbox/test/control-plane-stub.mjs`
|
|
8
|
+
* is the SAME contract in executable form. The two are kept in lockstep on
|
|
9
|
+
* purpose: prose drifts, a running stub does not.
|
|
10
|
+
*
|
|
11
|
+
* FOUR PROPERTIES THAT ARE NOT NEGOTIABLE
|
|
12
|
+
*
|
|
13
|
+
* 1. VERSIONED. Every request carries `protocolVersion`. A harness below the
|
|
14
|
+
* control plane's floor is refused, and the refusal is FINAL — the harness
|
|
15
|
+
* exits so the host is recycled onto a supported version. See
|
|
16
|
+
* `./contract.ts`.
|
|
17
|
+
*
|
|
18
|
+
* 2. OUTBOUND ONLY. Nothing here requires the harness to accept an inbound
|
|
19
|
+
* connection. Work is delivered by a bounded long-poll (`GET .../lease`),
|
|
20
|
+
* never by the control plane dialling in. That single property is what lets
|
|
21
|
+
* a customer VM behind NAT work with no tunnel and no listening port.
|
|
22
|
+
* Anything that needs to reach a running harness — abort, an answer to a
|
|
23
|
+
* question — travels back on the NEXT poll, which is why
|
|
24
|
+
* `RunnerHeartbeatResponse.sessionCommands` exists.
|
|
25
|
+
*
|
|
26
|
+
* 3. RUNTIME NEUTRAL. A Daytona sandbox, a customer VM and the 20x desktop are
|
|
27
|
+
* the same client. There is no route, field or token that only one of them
|
|
28
|
+
* can use. `POST /api/coding-agents/sessions/:id/ingest` in particular is
|
|
29
|
+
* identical for all three; that is the whole payoff of the extraction.
|
|
30
|
+
*
|
|
31
|
+
* 4. TOKENS TRAVEL IN THE ENVIRONMENT OR IN HEADERS, NEVER IN ARGV.
|
|
32
|
+
* `/proc/<pid>/cmdline` is world-readable; `/proc/<pid>/environ` is readable
|
|
33
|
+
* only by the process owner. Every credential below is either an
|
|
34
|
+
* `Authorization: Bearer` header or an environment variable handed to a
|
|
35
|
+
* child process. Do not "improve" this by adding a `--token` flag.
|
|
36
|
+
*/
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
/* -------------------------------------------------------------------------- */
|
|
39
|
+
/* Phase 0 bootstrap shapes — REMOVED */
|
|
40
|
+
/* -------------------------------------------------------------------------- */
|
|
41
|
+
/*
|
|
42
|
+
* `RegisterRequest`, `RegisterResponse`, `HeartbeatRequest` and
|
|
43
|
+
* `HeartbeatResponse` described the Phase 0 routes
|
|
44
|
+
* `/api/coding-agents/harness/{register,heartbeat}`. Both routes and all four
|
|
45
|
+
* shapes are gone.
|
|
46
|
+
*
|
|
47
|
+
* They were never aliases of the runner protocol: they carried no
|
|
48
|
+
* `protocolVersion`, so that path could not be protocol-version gated, and it
|
|
49
|
+
* was the only registration route running in production. Deleting them removes
|
|
50
|
+
* the last route exempt from the versioning guarantee.
|
|
51
|
+
*
|
|
52
|
+
* The replacements are `RunnerRegisterRequest`/`RunnerRegisterResponse` and
|
|
53
|
+
* `RunnerHeartbeatRequest`/`RunnerHeartbeatResponse` above. `sandboxToken` and
|
|
54
|
+
* `sandboxId` became `runnerCredential` and `runnerId`.
|
|
55
|
+
*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** The version of THIS package, as installed. */
|
|
2
|
+
export declare function getHarnessVersion(): string;
|
|
3
|
+
/**
|
|
4
|
+
* The version of the SANDBOX TOOLS layer (gh, @peculiar/x509, ...) currently
|
|
5
|
+
* installed, or null when nothing was ever synced — a self-hosted runner or
|
|
6
|
+
* desktop, or a sandbox that booted before this layer existed.
|
|
7
|
+
*
|
|
8
|
+
* Set by pf-bootstrap on the child environment it hands to the harness,
|
|
9
|
+
* `PF_INSTALLED_TOOLS_VERSION`, AFTER it resolved (fetched, reused, or fell
|
|
10
|
+
* back to) a tools install — never guessed by the harness itself, the same
|
|
11
|
+
* way `PF_HARNESS_DEGRADED` is reported rather than inferred.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getInstalledSandboxToolsVersion(): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* The tools pin pf-bootstrap most recently TRIED to install and could not
|
|
16
|
+
* make stick this boot (a bad hash, a registry outage, a malformed pin —
|
|
17
|
+
* anything that made it fall back or keep the prior install instead). Set
|
|
18
|
+
* on the harness's own environment, alongside `PF_INSTALLED_TOOLS_VERSION`.
|
|
19
|
+
*
|
|
20
|
+
* Read by `observeSandboxToolsPin()` to avoid re-arming a drain for the
|
|
21
|
+
* EXACT SAME pin the current boot cycle already gave up on — without this,
|
|
22
|
+
* a standing bad pin in a control-plane secret spins every affected sandbox
|
|
23
|
+
* in an unbounded drain -> exit-75 -> reboot -> fallback -> still-mismatched
|
|
24
|
+
* loop that takes zero leases the entire time.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getAttemptedSandboxToolsVersion(): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* The `pi` version baked into the snapshot, or null when the binary is
|
|
29
|
+
* absent. Reported at registration so the control plane can see the runtime
|
|
30
|
+
* matrix of its fleet without shelling into a sandbox.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getPiVersion(): string | null;
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHarnessVersion = getHarnessVersion;
|
|
4
|
+
exports.getInstalledSandboxToolsVersion = getInstalledSandboxToolsVersion;
|
|
5
|
+
exports.getAttemptedSandboxToolsVersion = getAttemptedSandboxToolsVersion;
|
|
6
|
+
exports.getPiVersion = getPiVersion;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
let cachedHarnessVersion = null;
|
|
11
|
+
let cachedPiVersion;
|
|
12
|
+
/** The version of THIS package, as installed. */
|
|
13
|
+
function getHarnessVersion() {
|
|
14
|
+
if (cachedHarnessVersion) {
|
|
15
|
+
return cachedHarnessVersion;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
const pkg = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, '..', 'package.json'), 'utf8'));
|
|
19
|
+
cachedHarnessVersion = pkg.version ?? '0.0.0';
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
cachedHarnessVersion = '0.0.0';
|
|
23
|
+
}
|
|
24
|
+
return cachedHarnessVersion;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The version of the SANDBOX TOOLS layer (gh, @peculiar/x509, ...) currently
|
|
28
|
+
* installed, or null when nothing was ever synced — a self-hosted runner or
|
|
29
|
+
* desktop, or a sandbox that booted before this layer existed.
|
|
30
|
+
*
|
|
31
|
+
* Set by pf-bootstrap on the child environment it hands to the harness,
|
|
32
|
+
* `PF_INSTALLED_TOOLS_VERSION`, AFTER it resolved (fetched, reused, or fell
|
|
33
|
+
* back to) a tools install — never guessed by the harness itself, the same
|
|
34
|
+
* way `PF_HARNESS_DEGRADED` is reported rather than inferred.
|
|
35
|
+
*/
|
|
36
|
+
function getInstalledSandboxToolsVersion() {
|
|
37
|
+
const value = process.env.PF_INSTALLED_TOOLS_VERSION;
|
|
38
|
+
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The tools pin pf-bootstrap most recently TRIED to install and could not
|
|
42
|
+
* make stick this boot (a bad hash, a registry outage, a malformed pin —
|
|
43
|
+
* anything that made it fall back or keep the prior install instead). Set
|
|
44
|
+
* on the harness's own environment, alongside `PF_INSTALLED_TOOLS_VERSION`.
|
|
45
|
+
*
|
|
46
|
+
* Read by `observeSandboxToolsPin()` to avoid re-arming a drain for the
|
|
47
|
+
* EXACT SAME pin the current boot cycle already gave up on — without this,
|
|
48
|
+
* a standing bad pin in a control-plane secret spins every affected sandbox
|
|
49
|
+
* in an unbounded drain -> exit-75 -> reboot -> fallback -> still-mismatched
|
|
50
|
+
* loop that takes zero leases the entire time.
|
|
51
|
+
*/
|
|
52
|
+
function getAttemptedSandboxToolsVersion() {
|
|
53
|
+
const value = process.env.PF_ATTEMPTED_TOOLS_VERSION;
|
|
54
|
+
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The `pi` version baked into the snapshot, or null when the binary is
|
|
58
|
+
* absent. Reported at registration so the control plane can see the runtime
|
|
59
|
+
* matrix of its fleet without shelling into a sandbox.
|
|
60
|
+
*/
|
|
61
|
+
function getPiVersion() {
|
|
62
|
+
if (cachedPiVersion !== undefined) {
|
|
63
|
+
return cachedPiVersion;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const out = (0, node_child_process_1.execFileSync)('pi', ['--version'], {
|
|
67
|
+
encoding: 'utf8',
|
|
68
|
+
timeout: 10_000,
|
|
69
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
70
|
+
});
|
|
71
|
+
cachedPiVersion = out.trim() || null;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
cachedPiVersion = null;
|
|
75
|
+
}
|
|
76
|
+
return cachedPiVersion;
|
|
77
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peakflo/agent-harness",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.1-rc.3",
|
|
4
|
+
"description": "Headless Peakflo coding-agent harness. One codebase, three hosting modes: a Daytona cloud sandbox, a customer VM, and the 20x desktop.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"pf-agent-harness": "dist/cli.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=22.19"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public",
|
|
22
|
+
"registry": "https://registry.npmjs.org/"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "rm -rf dist && tsc -p tsconfig.json && node scripts/make-executable.mjs",
|
|
26
|
+
"dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
|
|
27
|
+
"start": "tsx src/cli.ts start",
|
|
28
|
+
"clean": "rm -rf dist",
|
|
29
|
+
"test": "jest"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@anthropic-ai/claude-agent-sdk": "^0.3.195",
|
|
33
|
+
"@opencode-ai/sdk": "^1.15.13",
|
|
34
|
+
"@types/node": "^22.10.0",
|
|
35
|
+
"tsx": "^4.19.3",
|
|
36
|
+
"typescript": "^5.7.2",
|
|
37
|
+
"undici": "^7.21.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@peculiar/x509": "^2.1.0",
|
|
41
|
+
"reflect-metadata": "^0.2.2"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/peakflo/workflow-builder.git",
|
|
46
|
+
"directory": "packages/agent-harness"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/peakflo/workflow-builder/tree/main/packages/agent-harness",
|
|
49
|
+
"keywords": [
|
|
50
|
+
"peakflo",
|
|
51
|
+
"agent",
|
|
52
|
+
"runner",
|
|
53
|
+
"harness"
|
|
54
|
+
]
|
|
55
|
+
}
|