@claudexor/harness-claude 1.0.1 → 2.1.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/dist/capability-profile.d.ts +3 -0
- package/dist/capability-profile.d.ts.map +1 -0
- package/dist/capability-profile.js +34 -0
- package/dist/capability-profile.js.map +1 -0
- package/dist/doctor-remedy.d.ts +9 -0
- package/dist/doctor-remedy.d.ts.map +1 -0
- package/dist/doctor-remedy.js +15 -0
- package/dist/doctor-remedy.js.map +1 -0
- package/dist/index.d.ts +71 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +545 -220
- package/dist/index.js.map +1 -1
- package/dist/interactive.d.ts +10 -3
- package/dist/interactive.d.ts.map +1 -1
- package/dist/interactive.js +31 -6
- package/dist/interactive.js.map +1 -1
- package/dist/native-home.d.ts +21 -0
- package/dist/native-home.d.ts.map +1 -0
- package/dist/native-home.js +61 -0
- package/dist/native-home.js.map +1 -0
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +206 -15
- package/dist/parse.js.map +1 -1
- package/dist/profile.d.ts +27 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +174 -0
- package/dist/profile.js.map +1 -0
- package/dist/smoke.d.ts +9 -0
- package/dist/smoke.d.ts.map +1 -0
- package/dist/smoke.js +94 -0
- package/dist/smoke.js.map +1 -0
- package/package.json +8 -5
package/dist/smoke.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { providerScrubEnv, runCapture } from "@claudexor/core";
|
|
4
|
+
import { anthropicApiKey, BIN, CLAUDE_PROVIDER_ENV_DENYLIST, redactClaudeDoctorDetail, } from "./index.js";
|
|
5
|
+
export async function smokeIsolatedApiKey(abortSignal) {
|
|
6
|
+
const key = anthropicApiKey();
|
|
7
|
+
if (!key)
|
|
8
|
+
return { ok: false, detail: "no API key fallback available" };
|
|
9
|
+
const dir = mkdtempSync(`${tmpdir()}/claudexor-claude-smoke-`);
|
|
10
|
+
try {
|
|
11
|
+
const env = Object.fromEntries(CLAUDE_PROVIDER_ENV_DENYLIST.map((name) => [name, null]));
|
|
12
|
+
env.HOME = dir;
|
|
13
|
+
env.XDG_CONFIG_HOME = `${dir}/.config`;
|
|
14
|
+
env.CLAUDE_CONFIG_DIR = dir;
|
|
15
|
+
env.ANTHROPIC_API_KEY = key;
|
|
16
|
+
const r = await runCapture(BIN, [
|
|
17
|
+
"-p",
|
|
18
|
+
"Reply exactly OK",
|
|
19
|
+
"--output-format",
|
|
20
|
+
"stream-json",
|
|
21
|
+
"--verbose",
|
|
22
|
+
"--permission-mode",
|
|
23
|
+
"plan",
|
|
24
|
+
], {
|
|
25
|
+
cwd: dir,
|
|
26
|
+
env,
|
|
27
|
+
timeoutMs: 60_000,
|
|
28
|
+
abortSignal,
|
|
29
|
+
cancelSignal: "SIGTERM",
|
|
30
|
+
cancelKillDelayMs: 0,
|
|
31
|
+
});
|
|
32
|
+
const text = `${r.stdout}\n${r.stderr}`;
|
|
33
|
+
if (r.code === 0 && text.includes("OK"))
|
|
34
|
+
return { ok: true, detail: "isolated CLAUDE_CONFIG_DIR smoke passed" };
|
|
35
|
+
return {
|
|
36
|
+
ok: false,
|
|
37
|
+
detail: redactClaudeDoctorDetail(text || `claude exited with code ${r.code}`),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
return {
|
|
42
|
+
ok: false,
|
|
43
|
+
detail: redactClaudeDoctorDetail(err instanceof Error ? err.message : String(err)),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
rmSync(dir, { recursive: true, force: true });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export async function smokeIsolatedOAuthToken(token, abortSignal) {
|
|
51
|
+
const dir = mkdtempSync(`${tmpdir()}/claudexor-claude-oauth-smoke-`);
|
|
52
|
+
try {
|
|
53
|
+
const env = {
|
|
54
|
+
...providerScrubEnv(),
|
|
55
|
+
HOME: dir,
|
|
56
|
+
XDG_CONFIG_HOME: `${dir}/.config`,
|
|
57
|
+
CLAUDE_CONFIG_DIR: dir,
|
|
58
|
+
CLAUDE_CODE_OAUTH_TOKEN: token,
|
|
59
|
+
};
|
|
60
|
+
const r = await runCapture(BIN, [
|
|
61
|
+
"-p",
|
|
62
|
+
"Reply exactly OK",
|
|
63
|
+
"--output-format",
|
|
64
|
+
"stream-json",
|
|
65
|
+
"--verbose",
|
|
66
|
+
"--permission-mode",
|
|
67
|
+
"plan",
|
|
68
|
+
], {
|
|
69
|
+
cwd: dir,
|
|
70
|
+
env,
|
|
71
|
+
timeoutMs: 60_000,
|
|
72
|
+
abortSignal,
|
|
73
|
+
cancelSignal: "SIGTERM",
|
|
74
|
+
cancelKillDelayMs: 0,
|
|
75
|
+
});
|
|
76
|
+
const text = `${r.stdout}\n${r.stderr}`;
|
|
77
|
+
if (r.code === 0 && text.includes("OK"))
|
|
78
|
+
return { ok: true, detail: "isolated Claude setup-token smoke passed" };
|
|
79
|
+
return {
|
|
80
|
+
ok: false,
|
|
81
|
+
detail: redactClaudeDoctorDetail(text || `claude exited with code ${r.code}`),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
return {
|
|
86
|
+
ok: false,
|
|
87
|
+
detail: redactClaudeDoctorDetail(err instanceof Error ? err.message : String(err)),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
rmSync(dir, { recursive: true, force: true });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=smoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smoke.js","sourceRoot":"","sources":["../src/smoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,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,IAAI,GAAG,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QACxC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YACrC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,0CAA0C,EAAE,CAAC;QAC1E,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,wBAAwB,CAAC,IAAI,IAAI,2BAA2B,CAAC,CAAC,IAAI,EAAE,CAAC;SAC9E,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,wBAAwB,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACnF,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claudexor/harness-claude",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Claude Code adapter (claude -p --output-format stream-json).",
|
|
6
6
|
"type": "module",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@claudexor/
|
|
20
|
-
"@claudexor/secrets": "1.
|
|
21
|
-
"@claudexor/
|
|
22
|
-
"@claudexor/util": "1.
|
|
19
|
+
"@claudexor/core": "2.1.3",
|
|
20
|
+
"@claudexor/secrets": "2.1.3",
|
|
21
|
+
"@claudexor/schema": "2.1.3",
|
|
22
|
+
"@claudexor/util": "2.1.3"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"yaml": "^2.6.1"
|
|
41
|
+
},
|
|
39
42
|
"scripts": {
|
|
40
43
|
"build": "tsc",
|
|
41
44
|
"typecheck": "tsc --noEmit"
|