ghostrail 0.15.2 → 0.16.0
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/README.md +12 -9
- package/dist/agent/claude-code.d.ts.map +1 -1
- package/dist/agent/claude-code.js +4 -1
- package/dist/agent/claude-code.js.map +1 -1
- package/dist/board/page.d.ts +1 -1
- package/dist/board/page.d.ts.map +1 -1
- package/dist/board/page.js +2 -1
- package/dist/board/page.js.map +1 -1
- package/dist/board/server.d.ts +1 -1
- package/dist/board/server.d.ts.map +1 -1
- package/dist/board/server.js +7 -1
- package/dist/board/server.js.map +1 -1
- package/dist/board/stats.d.ts +1 -1
- package/dist/board/stats.d.ts.map +1 -1
- package/dist/board/stats.js +2 -1
- package/dist/board/stats.js.map +1 -1
- package/dist/claude-profile/index.d.ts +1 -1
- package/dist/claude-profile/index.d.ts.map +1 -1
- package/dist/claude-profile/index.js +1 -1
- package/dist/claude-profile/index.js.map +1 -1
- package/dist/claude-profile/setup.d.ts +7 -0
- package/dist/claude-profile/setup.d.ts.map +1 -1
- package/dist/claude-profile/setup.js +7 -0
- package/dist/claude-profile/setup.js.map +1 -1
- package/dist/cli/commands.d.ts +6 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +98 -2
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +11 -0
- package/dist/commands/help.js.map +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +18 -2
- package/dist/config/load.js.map +1 -1
- package/dist/config/schema.d.ts +8 -2
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/dashboard/page.d.ts +7 -1
- package/dist/dashboard/page.d.ts.map +1 -1
- package/dist/dashboard/page.js +204 -39
- package/dist/dashboard/page.js.map +1 -1
- package/dist/dashboard/routes.d.ts +32 -0
- package/dist/dashboard/routes.d.ts.map +1 -1
- package/dist/dashboard/routes.js +45 -0
- package/dist/dashboard/routes.js.map +1 -1
- package/dist/dashboard/server.d.ts +35 -9
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +75 -11
- package/dist/dashboard/server.js.map +1 -1
- package/dist/doctor/checks.d.ts +87 -0
- package/dist/doctor/checks.d.ts.map +1 -0
- package/dist/doctor/checks.js +414 -0
- package/dist/doctor/checks.js.map +1 -0
- package/dist/doctor/index.d.ts +6 -0
- package/dist/doctor/index.d.ts.map +1 -0
- package/dist/doctor/index.js +5 -0
- package/dist/doctor/index.js.map +1 -0
- package/dist/doctor/probes.d.ts +42 -0
- package/dist/doctor/probes.d.ts.map +1 -0
- package/dist/doctor/probes.js +136 -0
- package/dist/doctor/probes.js.map +1 -0
- package/dist/doctor/report.d.ts +13 -0
- package/dist/doctor/report.d.ts.map +1 -0
- package/dist/doctor/report.js +32 -0
- package/dist/doctor/report.js.map +1 -0
- package/dist/doctor/run.d.ts +48 -0
- package/dist/doctor/run.d.ts.map +1 -0
- package/dist/doctor/run.js +109 -0
- package/dist/doctor/run.js.map +1 -0
- package/dist/doctor/types.d.ts +17 -0
- package/dist/doctor/types.d.ts.map +1 -0
- package/dist/doctor/types.js +6 -0
- package/dist/doctor/types.js.map +1 -0
- package/dist/loop/budget.d.ts +11 -2
- package/dist/loop/budget.d.ts.map +1 -1
- package/dist/loop/budget.js +13 -3
- package/dist/loop/budget.js.map +1 -1
- package/dist/loop/comments.d.ts +20 -0
- package/dist/loop/comments.d.ts.map +1 -0
- package/dist/loop/comments.js +35 -0
- package/dist/loop/comments.js.map +1 -0
- package/dist/loop/engine.d.ts.map +1 -1
- package/dist/loop/engine.js +18 -0
- package/dist/loop/engine.js.map +1 -1
- package/dist/loop/index.d.ts +1 -0
- package/dist/loop/index.d.ts.map +1 -1
- package/dist/loop/index.js +1 -0
- package/dist/loop/index.js.map +1 -1
- package/dist/source/dependencies.d.ts +81 -0
- package/dist/source/dependencies.d.ts.map +1 -0
- package/dist/source/dependencies.js +218 -0
- package/dist/source/dependencies.js.map +1 -0
- package/dist/source/index.d.ts +1 -0
- package/dist/source/index.d.ts.map +1 -1
- package/dist/source/index.js +1 -0
- package/dist/source/index.js.map +1 -1
- package/dist/source/linear.d.ts +17 -1
- package/dist/source/linear.d.ts.map +1 -1
- package/dist/source/linear.js +75 -9
- package/dist/source/linear.js.map +1 -1
- package/dist/store/events.d.ts +8 -0
- package/dist/store/events.d.ts.map +1 -1
- package/dist/store/events.js +10 -0
- package/dist/store/events.js.map +1 -1
- package/dist/store/file-store.d.ts +1 -1
- package/dist/store/file-store.d.ts.map +1 -1
- package/dist/store/file-store.js +7 -0
- package/dist/store/file-store.js.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +1 -1
- package/dist/store/index.js.map +1 -1
- package/dist/store/port.d.ts +15 -0
- package/dist/store/port.d.ts.map +1 -1
- package/dist/store/port.js +17 -1
- package/dist/store/port.js.map +1 -1
- package/dist/triage/engine.d.ts.map +1 -1
- package/dist/triage/engine.js +2 -0
- package/dist/triage/engine.js.map +1 -1
- package/package.json +3 -1
- package/skill/ghostrail/SKILL.md +15 -34
- package/templates/code/prompts/resolve-issue.md +7 -0
- package/templates/code/prompts/triage.md +7 -0
- package/templates/content/prompts/draft.md +7 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../src/doctor/checks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAM/D,MAAM,UAAU,WAAW,CACzB,MAAoE;IAEpE,MAAM,EAAE,GAAG,QAAQ,CAAC;IACpB,MAAM,KAAK,GAAG,QAAQ,CAAC;IACvB,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;QACd,OAAO,EAAE,EAAE,E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ACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,MAAM,EAAE,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { checkBackend, checkClaudeAuthCredential, checkClaudeProbe, checkClaudeProfile, checkConfig, checkGate, checkGithubCredential, checkHistory, checkLinearCredential, checkLinearProbe, checkPrompt, type ClaudeProbeResult, classifyCredential, type CredentialShape, type LinearProbeResult, type PromptField, scriptNameOf, unresolvedGateCommands, } from "./checks.js";
|
|
2
|
+
export { claudeProbeInvocation, isCommitted, isDockerAvailable, isImagePresent, interpretClaudeProbe, probeClaudeAuth, probeLinearAuth, readPackageScripts, } from "./probes.js";
|
|
3
|
+
export { hasFailure, orderedFixes, renderDoctorJson, renderDoctorText } from "./report.js";
|
|
4
|
+
export { type DoctorDeps, type DoctorRunOptions, runDoctor } from "./run.js";
|
|
5
|
+
export type { DoctorCheck, DoctorReport, DoctorStatus } from "./types.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/doctor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,qBAAqB,EACrB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,KAAK,iBAAiB,EACtB,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,YAAY,EACZ,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7E,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { checkBackend, checkClaudeAuthCredential, checkClaudeProbe, checkClaudeProfile, checkConfig, checkGate, checkGithubCredential, checkHistory, checkLinearCredential, checkLinearProbe, checkPrompt, classifyCredential, scriptNameOf, unresolvedGateCommands, } from "./checks.js";
|
|
2
|
+
export { claudeProbeInvocation, isCommitted, isDockerAvailable, isImagePresent, interpretClaudeProbe, probeClaudeAuth, probeLinearAuth, readPackageScripts, } from "./probes.js";
|
|
3
|
+
export { hasFailure, orderedFixes, renderDoctorJson, renderDoctorText } from "./report.js";
|
|
4
|
+
export { runDoctor } from "./run.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/doctor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,qBAAqB,EACrB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EAEX,kBAAkB,EAIlB,YAAY,EACZ,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAA0C,SAAS,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The I/O doctor's checks are built on: git, docker, a real `claude -p` call,
|
|
3
|
+
* and a Linear GraphQL query. Each is a free function so `run.ts` can swap in a
|
|
4
|
+
* fake for tests — nothing here is ever exercised by the test suite for real.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExecOptions, ExecResult } from "../backend/types.js";
|
|
7
|
+
import type { BackendKind } from "../config/schema.js";
|
|
8
|
+
import type { ClaudeProbeResult, LinearProbeResult } from "./checks.js";
|
|
9
|
+
/** Whether `relPath` is present in the repo's `HEAD` tree (not merely on disk). */
|
|
10
|
+
export declare function isCommitted(repoPath: string, relPath: string): Promise<boolean>;
|
|
11
|
+
/** The repo's `package.json` `scripts` table, or undefined if there is none to read. */
|
|
12
|
+
export declare function readPackageScripts(repoPath: string): Promise<Record<string, unknown> | undefined>;
|
|
13
|
+
/** True if the Docker CLI and daemon are reachable. */
|
|
14
|
+
export declare function isDockerAvailable(): Promise<boolean>;
|
|
15
|
+
/** True if `image` is present in the local Docker image store. */
|
|
16
|
+
export declare function isImagePresent(image: string): Promise<boolean>;
|
|
17
|
+
export interface ClaudeAuthProbeOptions {
|
|
18
|
+
backendKind: BackendKind;
|
|
19
|
+
/** The configured (or default) container image; ignored for a non-container backend. */
|
|
20
|
+
image?: string;
|
|
21
|
+
/** The environment to read ANTHROPIC_API_KEY / CLAUDE_CODE_OAUTH_TOKEN from. */
|
|
22
|
+
env: Record<string, string | undefined>;
|
|
23
|
+
timeoutMs?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The command (and its exec options) a `claude -p` auth probe would run for the
|
|
27
|
+
* given backend: directly on the host for anything other than `container`,
|
|
28
|
+
* inside a disposable `docker run --rm` for `container` — the whole point being
|
|
29
|
+
* that a container only ever receives forwarded env vars, so a host-side login
|
|
30
|
+
* proves nothing about it. Pure: builds the invocation, never runs it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function claudeProbeInvocation(options: ClaudeAuthProbeOptions): {
|
|
33
|
+
command: string[];
|
|
34
|
+
execOptions: ExecOptions;
|
|
35
|
+
};
|
|
36
|
+
/** Run the probe {@link claudeProbeInvocation} builds, and classify the result. */
|
|
37
|
+
export declare function probeClaudeAuth(options: ClaudeAuthProbeOptions): Promise<ClaudeProbeResult>;
|
|
38
|
+
/** Classify a `claude -p` probe's raw result into a {@link ClaudeProbeResult}. */
|
|
39
|
+
export declare function interpretClaudeProbe(result: ExecResult): ClaudeProbeResult;
|
|
40
|
+
/** Send one cheap authenticated Linear query to check the key actually works. */
|
|
41
|
+
export declare function probeLinearAuth(apiKey: string, fetchImpl?: typeof fetch): Promise<LinearProbeResult>;
|
|
42
|
+
//# sourceMappingURL=probes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probes.d.ts","sourceRoot":"","sources":["../../src/doctor/probes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExE,mFAAmF;AACnF,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAIrF;AAED,wFAAwF;AACxF,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAW9C;AAED,uDAAuD;AACvD,wBAAgB,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAEpD;AAED,kEAAkE;AAClE,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGpE;AAKD,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkBD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG;IACtE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAmBA;AAED,mFAAmF;AACnF,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAIjG;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,iBAAiB,CAQ1E;AAID,iFAAiF;AACjF,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CA2B5B"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The I/O doctor's checks are built on: git, docker, a real `claude -p` call,
|
|
3
|
+
* and a Linear GraphQL query. Each is a free function so `run.ts` can swap in a
|
|
4
|
+
* fake for tests — nothing here is ever exercised by the test suite for real.
|
|
5
|
+
*/
|
|
6
|
+
import { readFile } from "node:fs/promises";
|
|
7
|
+
import { join, sep } from "node:path";
|
|
8
|
+
import { describeAgentFailure } from "../agent/failure.js";
|
|
9
|
+
import { ContainerBackend } from "../backend/container.js";
|
|
10
|
+
import { DEFAULT_CONTAINER_IMAGE } from "../backend/docker.js";
|
|
11
|
+
import { spawnCollect } from "../backend/proc.js";
|
|
12
|
+
/** Whether `relPath` is present in the repo's `HEAD` tree (not merely on disk). */
|
|
13
|
+
export async function isCommitted(repoPath, relPath) {
|
|
14
|
+
const posixPath = relPath.split(sep).join("/");
|
|
15
|
+
const result = await spawnCollect(["git", "-C", repoPath, "cat-file", "-e", `HEAD:${posixPath}`]);
|
|
16
|
+
return result.exitCode === 0;
|
|
17
|
+
}
|
|
18
|
+
/** The repo's `package.json` `scripts` table, or undefined if there is none to read. */
|
|
19
|
+
export async function readPackageScripts(repoPath) {
|
|
20
|
+
try {
|
|
21
|
+
const raw = await readFile(join(repoPath, "package.json"), "utf8");
|
|
22
|
+
const parsed = JSON.parse(raw);
|
|
23
|
+
if (parsed.scripts !== null && typeof parsed.scripts === "object") {
|
|
24
|
+
return parsed.scripts;
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** True if the Docker CLI and daemon are reachable. */
|
|
33
|
+
export function isDockerAvailable() {
|
|
34
|
+
return ContainerBackend.isAvailable();
|
|
35
|
+
}
|
|
36
|
+
/** True if `image` is present in the local Docker image store. */
|
|
37
|
+
export async function isImagePresent(image) {
|
|
38
|
+
const result = await spawnCollect(["docker", "image", "inspect", image]);
|
|
39
|
+
return result.exitCode === 0;
|
|
40
|
+
}
|
|
41
|
+
const PROBE_PROMPT = "Reply with exactly the single word: ok";
|
|
42
|
+
const DEFAULT_PROBE_TIMEOUT_MS = 30_000;
|
|
43
|
+
function forwardedClaudeAuth(env) {
|
|
44
|
+
const out = {};
|
|
45
|
+
for (const key of ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"]) {
|
|
46
|
+
const value = env[key];
|
|
47
|
+
if (value !== undefined && value.trim().length > 0)
|
|
48
|
+
out[key] = value;
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
/** `-e KEY=VALUE` flags for each forwarded env entry, in insertion order. */
|
|
53
|
+
function dockerEnvFlags(env) {
|
|
54
|
+
const flags = [];
|
|
55
|
+
for (const [key, value] of Object.entries(env))
|
|
56
|
+
flags.push("-e", `${key}=${value}`);
|
|
57
|
+
return flags;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The command (and its exec options) a `claude -p` auth probe would run for the
|
|
61
|
+
* given backend: directly on the host for anything other than `container`,
|
|
62
|
+
* inside a disposable `docker run --rm` for `container` — the whole point being
|
|
63
|
+
* that a container only ever receives forwarded env vars, so a host-side login
|
|
64
|
+
* proves nothing about it. Pure: builds the invocation, never runs it.
|
|
65
|
+
*/
|
|
66
|
+
export function claudeProbeInvocation(options) {
|
|
67
|
+
const forwarded = forwardedClaudeAuth(options.env);
|
|
68
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS;
|
|
69
|
+
const claudeArgs = ["claude", "-p", PROBE_PROMPT, "--output-format", "json"];
|
|
70
|
+
if (options.backendKind === "container") {
|
|
71
|
+
return {
|
|
72
|
+
command: [
|
|
73
|
+
"docker",
|
|
74
|
+
"run",
|
|
75
|
+
"--rm",
|
|
76
|
+
...dockerEnvFlags(forwarded),
|
|
77
|
+
options.image ?? DEFAULT_CONTAINER_IMAGE,
|
|
78
|
+
...claudeArgs,
|
|
79
|
+
],
|
|
80
|
+
execOptions: { timeoutMs },
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return { command: claudeArgs, execOptions: { env: forwarded, timeoutMs } };
|
|
84
|
+
}
|
|
85
|
+
/** Run the probe {@link claudeProbeInvocation} builds, and classify the result. */
|
|
86
|
+
export async function probeClaudeAuth(options) {
|
|
87
|
+
const { command, execOptions } = claudeProbeInvocation(options);
|
|
88
|
+
const result = await spawnCollect(command, execOptions);
|
|
89
|
+
return interpretClaudeProbe(result);
|
|
90
|
+
}
|
|
91
|
+
/** Classify a `claude -p` probe's raw result into a {@link ClaudeProbeResult}. */
|
|
92
|
+
export function interpretClaudeProbe(result) {
|
|
93
|
+
if (result.exitCode === 0)
|
|
94
|
+
return { kind: "ok" };
|
|
95
|
+
const text = `${result.stdout}\n${result.stderr}`;
|
|
96
|
+
if (/401/.test(text) && /invalid bearer token/i.test(text))
|
|
97
|
+
return { kind: "invalid-token" };
|
|
98
|
+
return {
|
|
99
|
+
kind: "error",
|
|
100
|
+
message: describeAgentFailure(result.exitCode, result.stdout, result.stderr),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const LINEAR_PROBE_BODY = JSON.stringify({ query: "{ viewer { id } }" });
|
|
104
|
+
/** Send one cheap authenticated Linear query to check the key actually works. */
|
|
105
|
+
export async function probeLinearAuth(apiKey, fetchImpl = fetch) {
|
|
106
|
+
let response;
|
|
107
|
+
try {
|
|
108
|
+
response = await fetchImpl("https://api.linear.app/graphql", {
|
|
109
|
+
method: "POST",
|
|
110
|
+
headers: { "Content-Type": "application/json", Authorization: apiKey },
|
|
111
|
+
body: LINEAR_PROBE_BODY,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return { kind: "error", message: error instanceof Error ? error.message : String(error) };
|
|
116
|
+
}
|
|
117
|
+
if (response.status === 401)
|
|
118
|
+
return { kind: "unauthorized" };
|
|
119
|
+
if (!response.ok)
|
|
120
|
+
return { kind: "error", message: `HTTP ${response.status}` };
|
|
121
|
+
let body;
|
|
122
|
+
try {
|
|
123
|
+
body = (await response.json());
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return { kind: "ok" };
|
|
127
|
+
}
|
|
128
|
+
const firstError = body.errors?.[0]?.message;
|
|
129
|
+
if (firstError !== undefined) {
|
|
130
|
+
return /auth/i.test(firstError)
|
|
131
|
+
? { kind: "unauthorized" }
|
|
132
|
+
: { kind: "error", message: firstError };
|
|
133
|
+
}
|
|
134
|
+
return { kind: "ok" };
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=probes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probes.js","sourceRoot":"","sources":["../../src/doctor/probes.ts"],"names":[],"mappings":"AA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AAE,OAAO,CAAC;IAC7C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;YAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE;YAC1B,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAC7C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DoctorReport } from "./types.js";
|
|
2
|
+
export declare function hasFailure(report: DoctorReport): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Every check's fix, most blocking first: every `fail` check's fix in check
|
|
5
|
+
* order, then every `warn` check's fix in check order. A check with no `fix`
|
|
6
|
+
* (typically a `pass`) contributes nothing.
|
|
7
|
+
*/
|
|
8
|
+
export declare function orderedFixes(report: DoctorReport): string[];
|
|
9
|
+
/** One line per check, then an ordered "fix this first" list. */
|
|
10
|
+
export declare function renderDoctorText(report: DoctorReport): string;
|
|
11
|
+
/** Machine-readable form, for a wrapper or the board to render. */
|
|
12
|
+
export declare function renderDoctorJson(report: DoctorReport): string;
|
|
13
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/doctor/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAExD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,EAAE,CAM3D;AAOD,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAM7D;AAED,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAM7D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export function hasFailure(report) {
|
|
2
|
+
return report.checks.some((check) => check.status === "fail");
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Every check's fix, most blocking first: every `fail` check's fix in check
|
|
6
|
+
* order, then every `warn` check's fix in check order. A check with no `fix`
|
|
7
|
+
* (typically a `pass`) contributes nothing.
|
|
8
|
+
*/
|
|
9
|
+
export function orderedFixes(report) {
|
|
10
|
+
const byStatus = (status) => report.checks
|
|
11
|
+
.filter((check) => check.status === status && check.fix !== undefined)
|
|
12
|
+
.map((check) => check.fix);
|
|
13
|
+
return [...byStatus("fail"), ...byStatus("warn")];
|
|
14
|
+
}
|
|
15
|
+
function renderLine(check) {
|
|
16
|
+
const base = `${check.status.padEnd(4)} ${check.label}: ${check.detail}`;
|
|
17
|
+
return check.fix === undefined ? base : `${base} — fix: ${check.fix}`;
|
|
18
|
+
}
|
|
19
|
+
/** One line per check, then an ordered "fix this first" list. */
|
|
20
|
+
export function renderDoctorText(report) {
|
|
21
|
+
const lines = report.checks.map(renderLine).join("\n");
|
|
22
|
+
const fixes = orderedFixes(report);
|
|
23
|
+
if (fixes.length === 0)
|
|
24
|
+
return `${lines}\n`;
|
|
25
|
+
const fixLines = fixes.map((fix, index) => ` ${index + 1}. ${fix}`).join("\n");
|
|
26
|
+
return `${lines}\n\nfix first:\n${fixLines}\n`;
|
|
27
|
+
}
|
|
28
|
+
/** Machine-readable form, for a wrapper or the board to render. */
|
|
29
|
+
export function renderDoctorJson(report) {
|
|
30
|
+
return `${JSON.stringify({ ok: !hasFailure(report), checks: report.checks, fixes: orderedFixes(report) }, null, 2)}\n`;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/doctor/report.ts"],"names":[],"mappings":"AAEA,MAAM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K,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChF,OAAO,GAAG,KAAK,mBAAmB,QAAQ,IAAI,CAAC;AACjD,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAAC,MAAoB;IACnD,OAAO,GAAG,IAAI,CAAC,SAAS,CACtB,EAAE,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,EAC/E,IAAI,EACJ,CAAC,CACF,IAAI,CAAC;AACR,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrates `ghostrail doctor`: gathers facts (via the real probes, or
|
|
3
|
+
* fakes injected through `deps`) and hands each to the matching pure check in
|
|
4
|
+
* checks.ts, in the fixed order documented in specs/doctor-command.spec.md.
|
|
5
|
+
*/
|
|
6
|
+
import type { ConfigError } from "../config/result.js";
|
|
7
|
+
import type { GhostrailConfig } from "../config/schema.js";
|
|
8
|
+
import type { RunRow } from "../store/events.js";
|
|
9
|
+
import { isCommitted, isDockerAvailable, isImagePresent, probeClaudeAuth, probeLinearAuth, readPackageScripts } from "./probes.js";
|
|
10
|
+
import type { DoctorReport } from "./types.js";
|
|
11
|
+
export interface DoctorRunOptions {
|
|
12
|
+
/** The repo root: where prompt paths and package.json are resolved from. */
|
|
13
|
+
repoPath: string;
|
|
14
|
+
/** The already-parsed (or failed) config. */
|
|
15
|
+
config: {
|
|
16
|
+
ok: true;
|
|
17
|
+
value: GhostrailConfig;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
errors: readonly ConfigError[];
|
|
21
|
+
};
|
|
22
|
+
/** The environment after the secrets loader's overrides are applied. */
|
|
23
|
+
env: Record<string, string | undefined>;
|
|
24
|
+
/** Skip the probes that cost money or take real wall-clock time. */
|
|
25
|
+
quick: boolean;
|
|
26
|
+
/** The ghostrail Claude profile dir, if one is in use. */
|
|
27
|
+
claudeProfileDir?: string;
|
|
28
|
+
/** The source `~/.claude` a profile would have been composed from. */
|
|
29
|
+
claudeSourceHome: string;
|
|
30
|
+
/** Skills requested via `--pin` at `claude-setup` time; defaults to its own default. */
|
|
31
|
+
claudePins?: readonly string[];
|
|
32
|
+
/** The repo's recent runs, newest first (already read from its store). */
|
|
33
|
+
historyRows: readonly RunRow[];
|
|
34
|
+
}
|
|
35
|
+
/** Every probe `runDoctor` performs, overridable for tests. */
|
|
36
|
+
export interface DoctorDeps {
|
|
37
|
+
isCommitted?: typeof isCommitted;
|
|
38
|
+
readPackageScripts?: typeof readPackageScripts;
|
|
39
|
+
isDockerAvailable?: typeof isDockerAvailable;
|
|
40
|
+
isImagePresent?: typeof isImagePresent;
|
|
41
|
+
probeClaudeAuth?: typeof probeClaudeAuth;
|
|
42
|
+
probeLinearAuth?: typeof probeLinearAuth;
|
|
43
|
+
buildClaudeProposal?: (sourceHome: string, profileDir: string, pins: readonly string[]) => Promise<{
|
|
44
|
+
missingPins: string[];
|
|
45
|
+
}>;
|
|
46
|
+
}
|
|
47
|
+
export declare function runDoctor(options: DoctorRunOptions, deps?: DoctorDeps): Promise<DoctorReport>;
|
|
48
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/doctor/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAe,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAkBjD,OAAO,EACL,WAAW,EACX,iBAAiB,EACj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C;CACzC;AAWD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,gBAAgB,EACzB,IAAI,GAAE,UAAe,GACpB,OAAO,CAAC,YAAY,CAAC,CAkGvB"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrates `ghostrail doctor`: gathers facts (via the real probes, or
|
|
3
|
+
* fakes injected through `deps`) and hands each to the matching pure check in
|
|
4
|
+
* checks.ts, in the fixed order documented in specs/doctor-command.spec.md.
|
|
5
|
+
*/
|
|
6
|
+
import { access } from "node:fs/promises";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { DEFAULT_CLAUDE_PINS, buildProposal } from "../claude-profile/index.js";
|
|
9
|
+
import { checkBackend, checkClaudeAuthCredential, checkClaudeProbe, checkClaudeProfile, checkConfig, checkGate, checkGithubCredential, checkHistory, checkLinearCredential, checkLinearProbe, checkPrompt, classifyCredential, } from "./checks.js";
|
|
10
|
+
import { isCommitted, isDockerAvailable, isImagePresent, probeClaudeAuth, probeLinearAuth, readPackageScripts, } from "./probes.js";
|
|
11
|
+
async function pathExists(path) {
|
|
12
|
+
try {
|
|
13
|
+
await access(path);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export async function runDoctor(options, deps = {}) {
|
|
21
|
+
const isCommittedFn = deps.isCommitted ?? isCommitted;
|
|
22
|
+
const readScripts = deps.readPackageScripts ?? readPackageScripts;
|
|
23
|
+
const dockerAvailableFn = deps.isDockerAvailable ?? isDockerAvailable;
|
|
24
|
+
const imagePresentFn = deps.isImagePresent ?? isImagePresent;
|
|
25
|
+
const claudeProbeFn = deps.probeClaudeAuth ?? probeClaudeAuth;
|
|
26
|
+
const linearProbeFn = deps.probeLinearAuth ?? probeLinearAuth;
|
|
27
|
+
const proposalFn = deps.buildClaudeProposal ?? buildProposal;
|
|
28
|
+
const checks = [checkConfig(options.config)];
|
|
29
|
+
let backendKind = "local-worktree";
|
|
30
|
+
let backendImage;
|
|
31
|
+
if (options.config.ok) {
|
|
32
|
+
const config = options.config.value;
|
|
33
|
+
backendKind = config.backend.kind;
|
|
34
|
+
backendImage = config.backend.image;
|
|
35
|
+
const promptFields = [
|
|
36
|
+
{ field: "agent.prompt", path: config.agent.prompt },
|
|
37
|
+
{ field: "respond.prompt", path: config.respond?.prompt },
|
|
38
|
+
{ field: "triage.prompt", path: config.triage?.prompt },
|
|
39
|
+
];
|
|
40
|
+
for (const { field, path } of promptFields) {
|
|
41
|
+
if (path === undefined)
|
|
42
|
+
continue;
|
|
43
|
+
const exists = await pathExists(join(options.repoPath, path));
|
|
44
|
+
const committed = exists ? await isCommittedFn(options.repoPath, path) : false;
|
|
45
|
+
checks.push(checkPrompt({ field, path, exists, committed }));
|
|
46
|
+
}
|
|
47
|
+
const scripts = await readScripts(options.repoPath);
|
|
48
|
+
checks.push(checkGate(config.gate.commands, scripts));
|
|
49
|
+
let dockerAvailable;
|
|
50
|
+
let imagePresent;
|
|
51
|
+
if (config.backend.kind === "container" && !options.quick) {
|
|
52
|
+
dockerAvailable = await dockerAvailableFn();
|
|
53
|
+
if (dockerAvailable && config.backend.image !== undefined) {
|
|
54
|
+
imagePresent = await imagePresentFn(config.backend.image);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
checks.push(checkBackend({
|
|
58
|
+
kind: config.backend.kind,
|
|
59
|
+
image: config.backend.image,
|
|
60
|
+
quick: options.quick,
|
|
61
|
+
dockerAvailable,
|
|
62
|
+
imagePresent,
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
let missingPins = [];
|
|
66
|
+
if (options.claudeProfileDir !== undefined) {
|
|
67
|
+
const pins = options.claudePins ?? DEFAULT_CLAUDE_PINS;
|
|
68
|
+
const proposal = await proposalFn(options.claudeSourceHome, options.claudeProfileDir, pins);
|
|
69
|
+
missingPins = proposal.missingPins;
|
|
70
|
+
}
|
|
71
|
+
checks.push(checkClaudeProfile({ present: options.claudeProfileDir !== undefined, missingPins }));
|
|
72
|
+
const anthropicApiKey = options.env.ANTHROPIC_API_KEY;
|
|
73
|
+
const oauthToken = options.env.CLAUDE_CODE_OAUTH_TOKEN;
|
|
74
|
+
checks.push(checkClaudeAuthCredential(anthropicApiKey, oauthToken));
|
|
75
|
+
checks.push(checkLinearCredential(options.env.LINEAR_API_KEY));
|
|
76
|
+
checks.push(checkGithubCredential(options.env.GH_TOKEN, options.env.GITHUB_TOKEN));
|
|
77
|
+
const claudeAuthUsable = classifyCredential(anthropicApiKey) === "set" || classifyCredential(oauthToken) === "set";
|
|
78
|
+
let claudeProbeResult;
|
|
79
|
+
if (!claudeAuthUsable) {
|
|
80
|
+
claudeProbeResult = { kind: "not-run" };
|
|
81
|
+
}
|
|
82
|
+
else if (options.quick) {
|
|
83
|
+
claudeProbeResult = { kind: "skipped" };
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
claudeProbeResult = await claudeProbeFn({
|
|
87
|
+
backendKind,
|
|
88
|
+
image: backendImage,
|
|
89
|
+
env: options.env,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
checks.push(checkClaudeProbe(claudeProbeResult, backendKind));
|
|
93
|
+
const linearKeyUsable = classifyCredential(options.env.LINEAR_API_KEY) === "set";
|
|
94
|
+
let linearProbeResult;
|
|
95
|
+
if (!linearKeyUsable) {
|
|
96
|
+
linearProbeResult = { kind: "not-run" };
|
|
97
|
+
}
|
|
98
|
+
else if (options.quick) {
|
|
99
|
+
linearProbeResult = { kind: "skipped" };
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
// Safe: linearKeyUsable is only true when the key is set to a non-empty value.
|
|
103
|
+
linearProbeResult = await linearProbeFn(options.env.LINEAR_API_KEY);
|
|
104
|
+
}
|
|
105
|
+
checks.push(checkLinearProbe(linearProbeResult));
|
|
106
|
+
checks.push(checkHistory(options.historyRows));
|
|
107
|
+
return { checks };
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/doctor/run.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhF,OAAO,EAIL,YAAY,EACZ,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,WAAW,EACX,SAAS,EACT,qBAAqB,EACrB,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,eAAe,EACf,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAqCrB,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,OAAyB,EACzB,OAAmB,EAAE;IAErB,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC;IACtD,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,IAAI,kBAAkB,CAAC;IAClE,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,IAAI,iBAAiB,CAAC;IACtE,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC;IAC7D,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC;IAC9D,MAAM,aAAa,GAAG,IAAI,CAAC,e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,EAAE,CAAC;IAC1C,CAAC;SAAM,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACzB,iBAAiB,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC1C,CAAC;SAAM,CAAC;QACN,+EAA+E;QAC/E,iBAAiB,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,cAAwB,CAAC,CAAC;IAChF,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAEjD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;IAE/C,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ghostrail doctor` diagnoses a setup and names the fix. See
|
|
3
|
+
* specs/doctor-command.spec.md for the checks and their rules.
|
|
4
|
+
*/
|
|
5
|
+
export type DoctorStatus = "pass" | "warn" | "fail";
|
|
6
|
+
/** One check's outcome. `fix` is omitted for a check with nothing to do. */
|
|
7
|
+
export interface DoctorCheck {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
status: DoctorStatus;
|
|
11
|
+
detail: string;
|
|
12
|
+
fix?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DoctorReport {
|
|
15
|
+
checks: DoctorCheck[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/doctor/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpD,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/doctor/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
package/dist/loop/budget.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BudgetUsd } from "../config/schema.js";
|
|
1
2
|
/**
|
|
2
3
|
* What a tick has spent, and whether it may start another item.
|
|
3
4
|
*
|
|
@@ -29,7 +30,15 @@ export interface RunBudget {
|
|
|
29
30
|
*
|
|
30
31
|
* A `capUsd` that is not a positive finite number disables the cap rather than
|
|
31
32
|
* halting a tick that had real work to do. Config validation already rejects
|
|
32
|
-
* those
|
|
33
|
+
* those as input, except for the literal `"unlimited"`, which reaches this
|
|
34
|
+
* same disabled-cap path deliberately.
|
|
35
|
+
*
|
|
36
|
+
* `assumedUsd` of `"unlimited"` charges `$0` for an unmeasured run rather
|
|
37
|
+
* than an arbitrary number: once the per-item budget itself is unbounded,
|
|
38
|
+
* there is no upper bound left to assume. It is still counted by
|
|
39
|
+
* `unmeasured()`. One consequence worth knowing: if `capUsd` is a finite
|
|
40
|
+
* number while `assumedUsd` is `"unlimited"`, an unmeasured run then
|
|
41
|
+
* contributes nothing toward that finite cap.
|
|
33
42
|
*/
|
|
34
|
-
export declare function createRunBudget(capUsd:
|
|
43
|
+
export declare function createRunBudget(capUsd: BudgetUsd, assumedUsd: BudgetUsd): RunBudget;
|
|
35
44
|
//# sourceMappingURL=budget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"budget.d.ts","sourceRoot":"","sources":["../../src/loop/budget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,6EAA6E;IAC7E,SAAS,IAAI,OAAO,CAAC;IACrB,4EAA4E;IAC5E,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1C,+CAA+C;IAC/C,QAAQ,IAAI,MAAM,CAAC;IACnB,qEAAqE;IACrE,UAAU,IAAI,MAAM,CAAC;CACtB;AAOD
|
|
1
|
+
{"version":3,"file":"budget.d.ts","sourceRoot":"","sources":["../../src/loop/budget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB,6EAA6E;IAC7E,SAAS,IAAI,OAAO,CAAC;IACrB,4EAA4E;IAC5E,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1C,+CAA+C;IAC/C,QAAQ,IAAI,MAAM,CAAC;IACnB,qEAAqE;IACrE,UAAU,IAAI,MAAM,CAAC;CACtB;AAOD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,GAAG,SAAS,CAuBnF"}
|
package/dist/loop/budget.js
CHANGED
|
@@ -16,11 +16,21 @@ function usable(value) {
|
|
|
16
16
|
*
|
|
17
17
|
* A `capUsd` that is not a positive finite number disables the cap rather than
|
|
18
18
|
* halting a tick that had real work to do. Config validation already rejects
|
|
19
|
-
* those
|
|
19
|
+
* those as input, except for the literal `"unlimited"`, which reaches this
|
|
20
|
+
* same disabled-cap path deliberately.
|
|
21
|
+
*
|
|
22
|
+
* `assumedUsd` of `"unlimited"` charges `$0` for an unmeasured run rather
|
|
23
|
+
* than an arbitrary number: once the per-item budget itself is unbounded,
|
|
24
|
+
* there is no upper bound left to assume. It is still counted by
|
|
25
|
+
* `unmeasured()`. One consequence worth knowing: if `capUsd` is a finite
|
|
26
|
+
* number while `assumedUsd` is `"unlimited"`, an unmeasured run then
|
|
27
|
+
* contributes nothing toward that finite cap.
|
|
20
28
|
*/
|
|
21
29
|
export function createRunBudget(capUsd, assumedUsd) {
|
|
22
|
-
const
|
|
23
|
-
const
|
|
30
|
+
const resolvedCap = capUsd === "unlimited" ? undefined : capUsd;
|
|
31
|
+
const resolvedAssumed = assumedUsd === "unlimited" ? 0 : assumedUsd;
|
|
32
|
+
const cap = usable(resolvedCap) && resolvedCap > 0 ? resolvedCap : undefined;
|
|
33
|
+
const assumed = usable(resolvedAssumed) ? resolvedAssumed : 0;
|
|
24
34
|
let spent = 0;
|
|
25
35
|
let assumedRuns = 0;
|
|
26
36
|
return {
|
package/dist/loop/budget.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"budget.js","sourceRoot":"","sources":["../../src/loop/budget.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"budget.js","sourceRoot":"","sources":["../../src/loop/budget.ts"],"names":[],"mappings":"AAoBA,2DAA2D;AAC3D,SAAS,MAAM,CAAC,KAAyB;IACvC,OAAO,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,eAAe,CAAC,MAAiB,EAAE,UAAqB;IACtE,MAAM,WAAW,GAAG,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IAChE,MAAM,eAAe,GAAG,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IACpE,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IAC7E,MAAM,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,WAAW,GAAG,CAAC,CAAC;IAEpB,OAAO;QACL,0EAA0E;QAC1E,gBAAgB;QAChB,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,IAAI,GAAG;QAClD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;YAClB,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;gBACpB,KAAK,IAAI,OAAO,CAAC;gBACjB,OAAO;YACT,CAAC;YACD,KAAK,IAAI,OAAO,CAAC;YACjB,WAAW,IAAI,CAAC,CAAC;QACnB,CAAC;QACD,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK;QACrB,UAAU,EAAE,GAAG,EAAE,CAAC,WAAW;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Backend, Workspace } from "../backend/types.js";
|
|
2
|
+
import type { Comment, Logger, Source, WorkItem } from "./ports.js";
|
|
3
|
+
/** Where the run and triage passes drop an item's comment thread for the agent to read. */
|
|
4
|
+
export declare const COMMENTS_PATH = ".ghostrail/comments.md";
|
|
5
|
+
/**
|
|
6
|
+
* Render an item's comment thread, oldest first, as one markdown document. Not
|
|
7
|
+
* filtered: the bot's own past question sits next to the human's answer, and
|
|
8
|
+
* seeing both together is the whole point of writing this file.
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderComments(comments: readonly Comment[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* Write the item's comment thread into the workspace, so an agent resuming
|
|
13
|
+
* after a `blocked` hand-off sees its own past question next to the human's
|
|
14
|
+
* answer. Best-effort, same as `listTrackerComments` in `src/respond/respond.ts`:
|
|
15
|
+
* a lookup failure is logged and treated as no comments, never as a reason to
|
|
16
|
+
* fail the item. Writes nothing when there are no comments, so an item's first
|
|
17
|
+
* run, before anyone has commented, behaves exactly as before this existed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function writeCommentThread(source: Source, backend: Backend, workspace: Workspace, item: WorkItem, logger: Logger): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/loop/comments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEpE,2FAA2F;AAC3F,eAAO,MAAM,aAAa,2BAA2B,CAAC;AAEtD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,MAAM,CAGnE;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAWf"}
|