@parcha/agentrun-harness-claude 0.0.0-stage → 0.1.0-beta.30

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +4 -0
  4. package/README.md +56 -2
  5. package/dist/adapter.d.ts +129 -0
  6. package/dist/adapter.js +514 -0
  7. package/dist/binary.d.ts +25 -0
  8. package/dist/binary.js +71 -0
  9. package/dist/cli-names.d.ts +7 -0
  10. package/dist/cli-names.js +17 -0
  11. package/dist/env.d.ts +81 -0
  12. package/dist/env.js +92 -0
  13. package/dist/errors.d.ts +27 -0
  14. package/dist/errors.js +42 -0
  15. package/dist/harness.d.ts +287 -0
  16. package/dist/harness.js +887 -0
  17. package/dist/host/kernel.d.ts +10 -0
  18. package/dist/host/kernel.js +1 -0
  19. package/dist/host/machine.d.ts +77 -0
  20. package/dist/host/machine.js +261 -0
  21. package/dist/host/policy.d.ts +104 -0
  22. package/dist/host/policy.js +437 -0
  23. package/dist/host/process.d.ts +130 -0
  24. package/dist/host/process.js +31 -0
  25. package/dist/host/tool-server.d.ts +44 -0
  26. package/dist/host/tool-server.js +47 -0
  27. package/dist/ids.d.ts +9 -0
  28. package/dist/ids.js +17 -0
  29. package/dist/inbox.d.ts +14 -0
  30. package/dist/inbox.js +36 -0
  31. package/dist/index.d.ts +11 -0
  32. package/dist/index.js +7 -0
  33. package/dist/serial.d.ts +3 -0
  34. package/dist/serial.js +10 -0
  35. package/dist/spawn.d.ts +51 -0
  36. package/dist/spawn.js +131 -0
  37. package/dist/store.d.ts +119 -0
  38. package/dist/store.js +202 -0
  39. package/dist/testing/fake-anthropic.d.ts +97 -0
  40. package/dist/testing/fake-anthropic.js +279 -0
  41. package/dist/testing/fake-sdk.d.ts +60 -0
  42. package/dist/testing/fake-sdk.js +402 -0
  43. package/dist/testing/index.d.ts +3 -0
  44. package/dist/testing/index.js +5 -0
  45. package/dist/transcript.d.ts +73 -0
  46. package/dist/transcript.js +116 -0
  47. package/dist/versions.d.ts +34 -0
  48. package/dist/versions.js +76 -0
  49. package/package.json +76 -4
  50. package/vendor/durable-harness/UPSTREAM.json +59 -0
@@ -0,0 +1,76 @@
1
+ // Copyright 2026 Vercel Inc. Licensed under the Apache License, Version 2.0; see LICENSE in this package.
2
+ // From github.com/vercel-labs/durable-harness, packages/harness-claude-code/src/versions.ts at ea8aa4060c (UPSTREAM.json records its blob and sha256).
3
+ // Changed by Parcha, imports rewritten for AgentRun; patches: 002-names, 004-pins
4
+ import { existsSync, readFileSync } from 'node:fs';
5
+ import { dirname, join } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { Unavailable } from './host/kernel.js';
8
+ /**
9
+ * The Agent SDK and Claude Code versions this harness is built and tested
10
+ * with (docs/workspaces.md §5.2). The harness drives CLI internals that move
11
+ * between releases: the transcript the mirror carries, the `system/init`
12
+ * tool set `builtins: true` is pinned against, the spawn arguments and env
13
+ * `sandboxSpawn` checks. So the installed SDK must be the pinned one (pnpm
14
+ * only warns on a peer mismatch), and the CLI in the VM image is the one
15
+ * that SDK release bundles (`claudeCodeVersion`). A test keeps these equal
16
+ * to package.json's, the installed SDK's and harness-world-sandbox's base.
17
+ */
18
+ export const CLAUDE_AGENT_SDK_VERSION = '0.3.286';
19
+ /** The Claude Code CLI the pinned SDK release bundles (its package.json's `claudeCodeVersion`), installed in the VM image. */
20
+ export const CLAUDE_CODE_VERSION = '2.1.286';
21
+ /** Where the pinned CLI is in a session VM booted from the base (harness-world-sandbox's `CLAUDE_CLI`). */
22
+ export const CLAUDE_VM_EXECUTABLE = `/opt/dh/claude/${CLAUDE_CODE_VERSION}/claude`;
23
+ /** The install line for the pinned SDK. */
24
+ export const CLAUDE_AGENT_SDK_INSTALL = `npm install --save-exact @anthropic-ai/claude-agent-sdk@${CLAUDE_AGENT_SDK_VERSION}`;
25
+ const SDK = '@anthropic-ai/claude-agent-sdk';
26
+ /**
27
+ * The version of `name` an import from here finds: Node's lookup for a
28
+ * package's folder (`node_modules/<name>` in this module's directory or the
29
+ * nearest one above it). Undefined when it isn't there (the import says what
30
+ * is missing) or this module isn't a file.
31
+ */
32
+ export function installedVersion(name, from = import.meta.url) {
33
+ let dir;
34
+ try {
35
+ dir = dirname(fileURLToPath(from));
36
+ }
37
+ catch {
38
+ return undefined;
39
+ }
40
+ for (;;) {
41
+ const manifest = join(dir, 'node_modules', name, 'package.json');
42
+ if (existsSync(manifest)) {
43
+ try {
44
+ const pkg = JSON.parse(readFileSync(manifest, 'utf8'));
45
+ if (pkg.name === name)
46
+ return pkg.version;
47
+ }
48
+ catch { }
49
+ }
50
+ if (dirname(dir) === dir)
51
+ return undefined;
52
+ dir = dirname(dir);
53
+ }
54
+ }
55
+ /**
56
+ * The installed Agent SDK, when it isn't the pinned one, as an `Unavailable`
57
+ * naming both versions and the install line (the turn fails with it; the
58
+ * session stays, and a fixed install drives it again), or undefined when it
59
+ * matches or can't be found (the import then says what is missing).
60
+ */
61
+ export function checkAgentSdkVersion(versionOf = installedVersion) {
62
+ const installed = versionOf(SDK);
63
+ if (installed === undefined || installed === CLAUDE_AGENT_SDK_VERSION)
64
+ return undefined;
65
+ return new Unavailable(`agentrun-harness-claude: installed ${SDK} ${installed} (expected ${CLAUDE_AGENT_SDK_VERSION}): the Claude Agent harness runs only with the Agent SDK it is built with`, {
66
+ code: 'unavailable',
67
+ hint: `Install the pinned version: ${CLAUDE_AGENT_SDK_INSTALL}`,
68
+ });
69
+ }
70
+ let checked;
71
+ /** `checkAgentSdkVersion()`, once per process: throws its `Unavailable`. */
72
+ export function assertAgentSdkVersion() {
73
+ checked ??= { error: checkAgentSdkVersion() };
74
+ if (checked.error)
75
+ throw checked.error;
76
+ }
package/package.json CHANGED
@@ -1,6 +1,78 @@
1
1
  {
2
2
  "name": "@parcha/agentrun-harness-claude",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-beta.30",
4
+ "description": "The Claude Agent SDK as an AgentRun harness: the host's tools as its only tools, its model behind a loopback proxy, durable in AgentRun's own store.",
5
+ "keywords": [
6
+ "agentrun",
7
+ "agent",
8
+ "harness",
9
+ "claude-agent",
10
+ "durable"
11
+ ],
12
+ "type": "module",
13
+ "license": "Apache-2.0",
14
+ "author": "Parcha Labs, Inc.",
15
+ "engines": {
16
+ "node": ">=22.19.0"
17
+ },
18
+ "main": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ },
25
+ "./testing": {
26
+ "types": "./dist/testing/index.d.ts",
27
+ "default": "./dist/testing/index.js"
28
+ },
29
+ "./package.json": "./package.json"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "README.md",
34
+ "CHANGELOG.md",
35
+ "LICENSE",
36
+ "NOTICE",
37
+ "vendor/durable-harness/UPSTREAM.json"
38
+ ],
39
+ "sideEffects": false,
40
+ "scripts": {
41
+ "build": "rm -rf dist && tsc -p tsconfig.json",
42
+ "prepack": "npm run build",
43
+ "typecheck": "tsc -p tsconfig.json --noEmit",
44
+ "test": "node --test --test-concurrency=8 'test/*.test.mjs'"
45
+ },
46
+ "dependencies": {
47
+ "@parcha/agentrun-dsl": "0.1.0-beta.30",
48
+ "@parcha/agentrun-kernel": "0.1.0-beta.30"
49
+ },
50
+ "peerDependencies": {
51
+ "@anthropic-ai/claude-agent-sdk": "0.3.286",
52
+ "@modelcontextprotocol/sdk": "^1.29.0"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@anthropic-ai/claude-agent-sdk": {
56
+ "optional": true
57
+ },
58
+ "@modelcontextprotocol/sdk": {
59
+ "optional": true
60
+ }
61
+ },
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "git+https://github.com/Parcha-ai/agentrun.git",
65
+ "directory": "packages/run-adapters-claude-agent"
66
+ },
67
+ "bugs": {
68
+ "url": "https://github.com/Parcha-ai/agentrun/issues"
69
+ },
70
+ "homepage": "https://agentrun.ai",
71
+ "publishConfig": {
72
+ "access": "public",
73
+ "tag": "beta"
74
+ },
75
+ "devDependencies": {
76
+ "@anthropic-ai/claude-agent-sdk": "0.3.286"
77
+ }
78
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "repo": "github.com/vercel-labs/durable-harness",
3
+ "commit": "ea8aa4060cf4fb8cd39737ce8ab21c4e0f40c741",
4
+ "license": "Apache-2.0",
5
+ "copyright": "Copyright 2026 Vercel Inc.",
6
+ "notice": null,
7
+ "files": {
8
+ "src/harness.ts": {
9
+ "upstream": "packages/harness-claude-code/src/harness.ts",
10
+ "blob": "5666c64e0ad9ae1735bfa6e17755932239950bae",
11
+ "sha256": "5201e82b7595bf299371113509e3062020d85fbd6e1ff67b6aa1dff1b4803b5f"
12
+ },
13
+ "src/transcript.ts": {
14
+ "upstream": "packages/harness-claude-code/src/transcript.ts",
15
+ "blob": "65851c9aa4a6254743609713f8d68836b3b27656",
16
+ "sha256": "d45c99f2d72bcb2b10d5332f676b77ff3b201871a4676e7609a8ff45204f7bbf"
17
+ },
18
+ "src/store.ts": {
19
+ "upstream": "packages/harness-claude-code/src/store.ts",
20
+ "blob": "14adbbd67f9ee551366d17ef22a8928b966503ac",
21
+ "sha256": "5d0c561be93b26448280d254804f355d5fc551d24dc1fb1bdb121bb4aef68c14"
22
+ },
23
+ "src/inbox.ts": {
24
+ "upstream": "packages/harness-claude-code/src/inbox.ts",
25
+ "blob": "bf05a952e2da087179aeefb47b772b369038022f",
26
+ "sha256": "17e046da54f8b935f5e2e34d60f1f9880aeff28c544d2c65009bf7e4b4dd0907"
27
+ },
28
+ "src/ids.ts": {
29
+ "upstream": "packages/harness-claude-code/src/ids.ts",
30
+ "blob": "e1611dd61f881b0a33bd3b43e7f0f7529c76ca4f",
31
+ "sha256": "dfc94889df310eb045fca95a56cc12667f1c254cbb0120fa36114841441f7cca"
32
+ },
33
+ "src/env.ts": {
34
+ "upstream": "packages/harness-claude-code/src/env.ts",
35
+ "blob": "8ab38d02325f7fc05347be67cfc54e9d08add46e",
36
+ "sha256": "69dd08daf5f54d72bf9b3d638ef4e0524d491da40d02a8dae62116ecd9cdc168"
37
+ },
38
+ "src/versions.ts": {
39
+ "upstream": "packages/harness-claude-code/src/versions.ts",
40
+ "blob": "4ed9a3997a1935a24d0532fb9ddb60a8c84c1f25",
41
+ "sha256": "bf6c0e69e3276393d3c5636a5a66494a5efb6e1fb5fa5a7ab454ffb7c4aed930"
42
+ },
43
+ "src/binary.ts": {
44
+ "upstream": "packages/harness-claude-code/src/binary.ts",
45
+ "blob": "2cd673d9026f12f526c53f8f33699241338f1e00",
46
+ "sha256": "f3e4b62692cc08767fe1d653e85ad164802a9e239839eb3bb134ecd0b5a806b8"
47
+ },
48
+ "src/testing/fake-sdk.ts": {
49
+ "upstream": "packages/harness-claude-code/test/fake-sdk.ts",
50
+ "blob": "babd0f394dccc1775266959a9379ec01e82b49ad",
51
+ "sha256": "06f7b4f506fb3c15acf87315f5f02f8c615501efbac82bbbf731685cd96d1068"
52
+ },
53
+ "src/testing/fake-anthropic.ts": {
54
+ "upstream": "packages/harness-claude-code/test/fake-anthropic.ts",
55
+ "blob": "f6764ca8d18538982e3f1efcb52f566cbc4023a1",
56
+ "sha256": "9d7c87553b594d2da897700bafaf598bef784e69761b58bf5dc5fee2f94d74c9"
57
+ }
58
+ }
59
+ }