@tokenfactory/acc-runner 0.25.0 → 0.27.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 +77 -4
- package/package.json +1 -1
- package/dist/anthropic-auth.d.ts +0 -53
- package/dist/anthropic-auth.d.ts.map +0 -1
- package/dist/anthropic-auth.js +0 -89
- package/dist/anthropic-auth.js.map +0 -1
- package/dist/bin-resolve.d.ts +0 -16
- package/dist/bin-resolve.d.ts.map +0 -1
- package/dist/bin-resolve.js +0 -35
- package/dist/bin-resolve.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -128
- package/dist/cli.js.map +0 -1
- package/dist/config.d.ts +0 -121
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -396
- package/dist/config.js.map +0 -1
- package/dist/cost-pricing.d.ts +0 -130
- package/dist/cost-pricing.d.ts.map +0 -1
- package/dist/cost-pricing.js +0 -191
- package/dist/cost-pricing.js.map +0 -1
- package/dist/doctor.d.ts +0 -37
- package/dist/doctor.d.ts.map +0 -1
- package/dist/doctor.js +0 -658
- package/dist/doctor.js.map +0 -1
- package/dist/failure-classifier.d.ts +0 -112
- package/dist/failure-classifier.d.ts.map +0 -1
- package/dist/failure-classifier.js +0 -353
- package/dist/failure-classifier.js.map +0 -1
- package/dist/gh.d.ts +0 -22
- package/dist/gh.d.ts.map +0 -1
- package/dist/gh.js +0 -48
- package/dist/gh.js.map +0 -1
- package/dist/git.d.ts +0 -50
- package/dist/git.d.ts.map +0 -1
- package/dist/git.js +0 -127
- package/dist/git.js.map +0 -1
- package/dist/github-client.d.ts +0 -133
- package/dist/github-client.d.ts.map +0 -1
- package/dist/github-client.js +0 -234
- package/dist/github-client.js.map +0 -1
- package/dist/keychain.d.ts +0 -21
- package/dist/keychain.d.ts.map +0 -1
- package/dist/keychain.js +0 -45
- package/dist/keychain.js.map +0 -1
- package/dist/login.d.ts +0 -12
- package/dist/login.d.ts.map +0 -1
- package/dist/login.js +0 -133
- package/dist/login.js.map +0 -1
- package/dist/logout.d.ts +0 -2
- package/dist/logout.d.ts.map +0 -1
- package/dist/logout.js +0 -31
- package/dist/logout.js.map +0 -1
- package/dist/mcp-spawn.d.ts +0 -30
- package/dist/mcp-spawn.d.ts.map +0 -1
- package/dist/mcp-spawn.js +0 -145
- package/dist/mcp-spawn.js.map +0 -1
- package/dist/messaging.d.ts +0 -49
- package/dist/messaging.d.ts.map +0 -1
- package/dist/messaging.js +0 -36
- package/dist/messaging.js.map +0 -1
- package/dist/pkg-version.d.ts +0 -3
- package/dist/pkg-version.d.ts.map +0 -1
- package/dist/pkg-version.js +0 -20
- package/dist/pkg-version.js.map +0 -1
- package/dist/profiles/designer-prompt.d.ts +0 -18
- package/dist/profiles/designer-prompt.d.ts.map +0 -1
- package/dist/profiles/designer-prompt.js +0 -172
- package/dist/profiles/designer-prompt.js.map +0 -1
- package/dist/profiles/developer-prompt.d.ts +0 -24
- package/dist/profiles/developer-prompt.d.ts.map +0 -1
- package/dist/profiles/developer-prompt.js +0 -24
- package/dist/profiles/developer-prompt.js.map +0 -1
- package/dist/profiles/manager-prompt.d.ts +0 -34
- package/dist/profiles/manager-prompt.d.ts.map +0 -1
- package/dist/profiles/manager-prompt.js +0 -93
- package/dist/profiles/manager-prompt.js.map +0 -1
- package/dist/profiles/tester-prompt.d.ts +0 -28
- package/dist/profiles/tester-prompt.d.ts.map +0 -1
- package/dist/profiles/tester-prompt.js +0 -165
- package/dist/profiles/tester-prompt.js.map +0 -1
- package/dist/prompt.d.ts +0 -38
- package/dist/prompt.d.ts.map +0 -1
- package/dist/prompt.js +0 -78
- package/dist/prompt.js.map +0 -1
- package/dist/runtime/cache-dir.d.ts +0 -2
- package/dist/runtime/cache-dir.d.ts.map +0 -1
- package/dist/runtime/cache-dir.js +0 -15
- package/dist/runtime/cache-dir.js.map +0 -1
- package/dist/runtime/conflict-resolver.d.ts +0 -65
- package/dist/runtime/conflict-resolver.d.ts.map +0 -1
- package/dist/runtime/conflict-resolver.js +0 -477
- package/dist/runtime/conflict-resolver.js.map +0 -1
- package/dist/runtime/expand-args.d.ts +0 -28
- package/dist/runtime/expand-args.d.ts.map +0 -1
- package/dist/runtime/expand-args.js +0 -50
- package/dist/runtime/expand-args.js.map +0 -1
- package/dist/runtime/locks.d.ts +0 -21
- package/dist/runtime/locks.d.ts.map +0 -1
- package/dist/runtime/locks.js +0 -97
- package/dist/runtime/locks.js.map +0 -1
- package/dist/runtime/provision-mutex.d.ts +0 -37
- package/dist/runtime/provision-mutex.d.ts.map +0 -1
- package/dist/runtime/provision-mutex.js +0 -67
- package/dist/runtime/provision-mutex.js.map +0 -1
- package/dist/runtime/quarantine.d.ts +0 -26
- package/dist/runtime/quarantine.d.ts.map +0 -1
- package/dist/runtime/quarantine.js +0 -50
- package/dist/runtime/quarantine.js.map +0 -1
- package/dist/runtime/resolution-integrity.d.ts +0 -86
- package/dist/runtime/resolution-integrity.d.ts.map +0 -1
- package/dist/runtime/resolution-integrity.js +0 -248
- package/dist/runtime/resolution-integrity.js.map +0 -1
- package/dist/runtime/reviewer.d.ts +0 -81
- package/dist/runtime/reviewer.d.ts.map +0 -1
- package/dist/runtime/reviewer.js +0 -374
- package/dist/runtime/reviewer.js.map +0 -1
- package/dist/runtime/rework.d.ts +0 -48
- package/dist/runtime/rework.d.ts.map +0 -1
- package/dist/runtime/rework.js +0 -136
- package/dist/runtime/rework.js.map +0 -1
- package/dist/runtime/singleton.d.ts +0 -47
- package/dist/runtime/singleton.d.ts.map +0 -1
- package/dist/runtime/singleton.js +0 -200
- package/dist/runtime/singleton.js.map +0 -1
- package/dist/runtime/version-drift.d.ts +0 -31
- package/dist/runtime/version-drift.d.ts.map +0 -1
- package/dist/runtime/version-drift.js +0 -114
- package/dist/runtime/version-drift.js.map +0 -1
- package/dist/runtime/worktree.d.ts +0 -74
- package/dist/runtime/worktree.d.ts.map +0 -1
- package/dist/runtime/worktree.js +0 -206
- package/dist/runtime/worktree.js.map +0 -1
- package/dist/secrets/inject.d.ts +0 -70
- package/dist/secrets/inject.d.ts.map +0 -1
- package/dist/secrets/inject.js +0 -102
- package/dist/secrets/inject.js.map +0 -1
- package/dist/supabase.d.ts +0 -4
- package/dist/supabase.d.ts.map +0 -1
- package/dist/supabase.js +0 -36
- package/dist/supabase.js.map +0 -1
- package/dist/task-runner.d.ts +0 -313
- package/dist/task-runner.d.ts.map +0 -1
- package/dist/task-runner.js +0 -1766
- package/dist/task-runner.js.map +0 -1
- package/dist/token-provider.d.ts +0 -50
- package/dist/token-provider.d.ts.map +0 -1
- package/dist/token-provider.js +0 -177
- package/dist/token-provider.js.map +0 -1
- package/dist/types.d.ts +0 -120
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -16
- package/dist/types.js.map +0 -1
- package/dist/version-check.d.ts +0 -17
- package/dist/version-check.d.ts.map +0 -1
- package/dist/version-check.js +0 -56
- package/dist/version-check.js.map +0 -1
- package/dist/watch.d.ts +0 -295
- package/dist/watch.d.ts.map +0 -1
- package/dist/watch.js +0 -1532
- package/dist/watch.js.map +0 -1
package/dist/secrets/inject.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runner-side `{{secret:NAME}}` placeholder expander.
|
|
3
|
-
*
|
|
4
|
-
* The runner never holds the service-role key (which would let it pull
|
|
5
|
-
* arbitrary plaintext from the vault). Instead, name→id resolution and
|
|
6
|
-
* decryption run server-side behind the user's JWT, and the runner POSTs
|
|
7
|
-
* to /api/runner/expand-secret for each unique name encountered in a
|
|
8
|
-
* tool-call argument tree.
|
|
9
|
-
*
|
|
10
|
-
* The plaintext flow is:
|
|
11
|
-
*
|
|
12
|
-
* 1. Runner extracts `{{secret:NAME}}` placeholders from the args.
|
|
13
|
-
* 2. For each unique NAME, runner POSTs `/api/runner/expand-secret`
|
|
14
|
-
* with `{ name, agent_id, tool_name }`. The endpoint uses
|
|
15
|
-
* `getAdminClient()` to call acc.resolve_secret_id_by_name (v0.7-D)
|
|
16
|
-
* then acc.fetch_secret_for_runtime (v0.7-B, frozen).
|
|
17
|
-
* 3. Plaintext is held in memory ONLY for the duration of the tool
|
|
18
|
-
* call. We never log it, never serialize it, never copy it to the
|
|
19
|
-
* DB. The pre-expansion args (still containing the literal
|
|
20
|
-
* `{{secret:…}}`) are what gets logged to telemetry.
|
|
21
|
-
* 4. Caller hands the expanded result to MCP stdio.
|
|
22
|
-
*
|
|
23
|
-
* Telemetry tripwire test: a fake secret named `TRIPWIRE_VALUE` with
|
|
24
|
-
* plaintext `tripwire-do-not-log-me` must NOT appear in any captured
|
|
25
|
-
* telemetry row. See packages/acc-runner/tests/expand-args.test.ts.
|
|
26
|
-
*
|
|
27
|
-
* Deviations from planning/v0.7-D-chat-encryption-and-visibility.md:
|
|
28
|
-
* - The planning doc imagined `import { supabaseAdmin } from '../db'`
|
|
29
|
-
* — a service-role client at the runner. That doesn't exist (and
|
|
30
|
-
* shouldn't; the runner is end-user-deployed). The /api/runner/
|
|
31
|
-
* expand-secret endpoint is the actual seam.
|
|
32
|
-
* - The planning doc's single fetch_secret_for_runtime call is split
|
|
33
|
-
* into resolve_secret_id_by_name → fetch_secret_for_runtime because
|
|
34
|
-
* v0.7-B's frozen contract takes a uuid, not a name.
|
|
35
|
-
*/
|
|
36
|
-
export declare const SECRET_PATTERN: RegExp;
|
|
37
|
-
/**
|
|
38
|
-
* Fetcher signature. Production wires this to an HTTP call against
|
|
39
|
-
* /api/runner/expand-secret; tests pass a stub.
|
|
40
|
-
*
|
|
41
|
-
* MUST throw on any failure (missing secret, locked vault, denied
|
|
42
|
-
* grant, rate-limit). MUST NOT include any secret-derived data in the
|
|
43
|
-
* error message.
|
|
44
|
-
*/
|
|
45
|
-
export type SecretFetcher = (name: string, agentId: string, toolName?: string) => Promise<string>;
|
|
46
|
-
export interface ExpandResult {
|
|
47
|
-
expanded: string;
|
|
48
|
-
consumedSecrets: string[];
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Expand `{{secret:NAME}}` placeholders in a single string. Returns the
|
|
52
|
-
* expanded string plus the list of secret names consumed (for telemetry
|
|
53
|
-
* of NAMES, never plaintexts). Throws if any required secret is
|
|
54
|
-
* unavailable — partial expansion is never returned (atomic).
|
|
55
|
-
*/
|
|
56
|
-
export declare function expandSecretsInString(raw: string, agentId: string, fetcher: SecretFetcher, toolName?: string): Promise<ExpandResult>;
|
|
57
|
-
/**
|
|
58
|
-
* Build an HTTP-backed SecretFetcher pointing at the deployed
|
|
59
|
-
* /api/runner/expand-secret endpoint. The runner wires this at startup
|
|
60
|
-
* once it has its user JWT and config.
|
|
61
|
-
*
|
|
62
|
-
* The endpoint MUST NOT echo the plaintext into any error path; this
|
|
63
|
-
* helper trusts that contract.
|
|
64
|
-
*/
|
|
65
|
-
export declare function makeHttpSecretFetcher(opts: {
|
|
66
|
-
publicUrl: string;
|
|
67
|
-
jwt: string;
|
|
68
|
-
fetchImpl?: typeof fetch;
|
|
69
|
-
}): SecretFetcher;
|
|
70
|
-
//# sourceMappingURL=inject.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../../src/secrets/inject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,eAAO,MAAM,cAAc,QAAsC,CAAC;AAElE;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAElG,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,aAAa,EACtB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,YAAY,CAAC,CA4BvB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,GAAG,aAAa,CAwBhB"}
|
package/dist/secrets/inject.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runner-side `{{secret:NAME}}` placeholder expander.
|
|
3
|
-
*
|
|
4
|
-
* The runner never holds the service-role key (which would let it pull
|
|
5
|
-
* arbitrary plaintext from the vault). Instead, name→id resolution and
|
|
6
|
-
* decryption run server-side behind the user's JWT, and the runner POSTs
|
|
7
|
-
* to /api/runner/expand-secret for each unique name encountered in a
|
|
8
|
-
* tool-call argument tree.
|
|
9
|
-
*
|
|
10
|
-
* The plaintext flow is:
|
|
11
|
-
*
|
|
12
|
-
* 1. Runner extracts `{{secret:NAME}}` placeholders from the args.
|
|
13
|
-
* 2. For each unique NAME, runner POSTs `/api/runner/expand-secret`
|
|
14
|
-
* with `{ name, agent_id, tool_name }`. The endpoint uses
|
|
15
|
-
* `getAdminClient()` to call acc.resolve_secret_id_by_name (v0.7-D)
|
|
16
|
-
* then acc.fetch_secret_for_runtime (v0.7-B, frozen).
|
|
17
|
-
* 3. Plaintext is held in memory ONLY for the duration of the tool
|
|
18
|
-
* call. We never log it, never serialize it, never copy it to the
|
|
19
|
-
* DB. The pre-expansion args (still containing the literal
|
|
20
|
-
* `{{secret:…}}`) are what gets logged to telemetry.
|
|
21
|
-
* 4. Caller hands the expanded result to MCP stdio.
|
|
22
|
-
*
|
|
23
|
-
* Telemetry tripwire test: a fake secret named `TRIPWIRE_VALUE` with
|
|
24
|
-
* plaintext `tripwire-do-not-log-me` must NOT appear in any captured
|
|
25
|
-
* telemetry row. See packages/acc-runner/tests/expand-args.test.ts.
|
|
26
|
-
*
|
|
27
|
-
* Deviations from planning/v0.7-D-chat-encryption-and-visibility.md:
|
|
28
|
-
* - The planning doc imagined `import { supabaseAdmin } from '../db'`
|
|
29
|
-
* — a service-role client at the runner. That doesn't exist (and
|
|
30
|
-
* shouldn't; the runner is end-user-deployed). The /api/runner/
|
|
31
|
-
* expand-secret endpoint is the actual seam.
|
|
32
|
-
* - The planning doc's single fetch_secret_for_runtime call is split
|
|
33
|
-
* into resolve_secret_id_by_name → fetch_secret_for_runtime because
|
|
34
|
-
* v0.7-B's frozen contract takes a uuid, not a name.
|
|
35
|
-
*/
|
|
36
|
-
export const SECRET_PATTERN = /\{\{secret:([A-Z][A-Z0-9_]*)\}\}/g;
|
|
37
|
-
/**
|
|
38
|
-
* Expand `{{secret:NAME}}` placeholders in a single string. Returns the
|
|
39
|
-
* expanded string plus the list of secret names consumed (for telemetry
|
|
40
|
-
* of NAMES, never plaintexts). Throws if any required secret is
|
|
41
|
-
* unavailable — partial expansion is never returned (atomic).
|
|
42
|
-
*/
|
|
43
|
-
export async function expandSecretsInString(raw, agentId, fetcher, toolName) {
|
|
44
|
-
const matches = [...raw.matchAll(SECRET_PATTERN)];
|
|
45
|
-
if (matches.length === 0) {
|
|
46
|
-
return { expanded: raw, consumedSecrets: [] };
|
|
47
|
-
}
|
|
48
|
-
const names = [...new Set(matches.map((m) => m[1]))];
|
|
49
|
-
const plaintexts = new Map();
|
|
50
|
-
for (const name of names) {
|
|
51
|
-
try {
|
|
52
|
-
const plaintext = await fetcher(name, agentId, toolName);
|
|
53
|
-
plaintexts.set(name, plaintext);
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
57
|
-
throw new Error(`secret_unavailable: ${name}: ${message}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const expanded = raw.replace(SECRET_PATTERN, (_match, name) => {
|
|
61
|
-
const value = plaintexts.get(name);
|
|
62
|
-
if (value === undefined) {
|
|
63
|
-
throw new Error(`secret_unavailable: ${name}: missing after fetch`);
|
|
64
|
-
}
|
|
65
|
-
return value;
|
|
66
|
-
});
|
|
67
|
-
return { expanded, consumedSecrets: names };
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Build an HTTP-backed SecretFetcher pointing at the deployed
|
|
71
|
-
* /api/runner/expand-secret endpoint. The runner wires this at startup
|
|
72
|
-
* once it has its user JWT and config.
|
|
73
|
-
*
|
|
74
|
-
* The endpoint MUST NOT echo the plaintext into any error path; this
|
|
75
|
-
* helper trusts that contract.
|
|
76
|
-
*/
|
|
77
|
-
export function makeHttpSecretFetcher(opts) {
|
|
78
|
-
const f = opts.fetchImpl ?? fetch;
|
|
79
|
-
const endpoint = `${opts.publicUrl.replace(/\/$/, "")}/api/runner/expand-secret`;
|
|
80
|
-
return async (name, agentId, toolName) => {
|
|
81
|
-
const res = await f(endpoint, {
|
|
82
|
-
method: "POST",
|
|
83
|
-
headers: {
|
|
84
|
-
Authorization: `Bearer ${opts.jwt}`,
|
|
85
|
-
"Content-Type": "application/json",
|
|
86
|
-
},
|
|
87
|
-
body: JSON.stringify({ name, agent_id: agentId, tool_name: toolName ?? null }),
|
|
88
|
-
});
|
|
89
|
-
if (!res.ok) {
|
|
90
|
-
// Read body for the error reason, but the endpoint contract is
|
|
91
|
-
// that the body NEVER contains plaintext.
|
|
92
|
-
const text = await res.text().catch(() => "");
|
|
93
|
-
throw new Error(`expand-secret HTTP ${res.status}: ${text || res.statusText}`);
|
|
94
|
-
}
|
|
95
|
-
const data = (await res.json());
|
|
96
|
-
if (typeof data.plaintext !== "string") {
|
|
97
|
-
throw new Error("expand-secret response missing plaintext");
|
|
98
|
-
}
|
|
99
|
-
return data.plaintext;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=inject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inject.js","sour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CAAC,CAAC;QACjF,CAAC;QACD,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA4B,CAAC;QAC3D,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/supabase.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { RunnerConfig } from "./config.js";
|
|
2
|
-
export declare function createRunnerClient(cfg: RunnerConfig, jwt: string): import("@supabase/supabase-js").SupabaseClient<any, "public", "acc", any, any>;
|
|
3
|
-
export type RunnerSupabaseClient = ReturnType<typeof createRunnerClient>;
|
|
4
|
-
//# sourceMappingURL=supabase.d.ts.map
|
package/dist/supabase.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../src/supabase.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,kFAoBhE;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
package/dist/supabase.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Supabase client factory for the CLI. Authenticates with the user's
|
|
3
|
-
* stored JWT (loaded from keychain) so RLS / acc.is_member() resolve
|
|
4
|
-
* correctly on every RPC.
|
|
5
|
-
*
|
|
6
|
-
* Realtime transport is pinned to the `ws` package. Node 20+ has a
|
|
7
|
-
* native WebSocket global, but Supabase's runtime detector still warns
|
|
8
|
-
* "Node.js 20 detected without native WebSocket support" because it
|
|
9
|
-
* looks for a Node-API-shaped constructor, not the WHATWG one. Passing
|
|
10
|
-
* `ws` explicitly silences the warning and is the same transport every
|
|
11
|
-
* server-side Supabase consumer uses.
|
|
12
|
-
*/
|
|
13
|
-
import { createClient } from "@supabase/supabase-js";
|
|
14
|
-
import WebSocket from "ws";
|
|
15
|
-
export function createRunnerClient(cfg, jwt) {
|
|
16
|
-
return createClient(cfg.supabaseUrl, cfg.supabaseAnonKey, {
|
|
17
|
-
db: { schema: "acc" },
|
|
18
|
-
auth: {
|
|
19
|
-
persistSession: false,
|
|
20
|
-
autoRefreshToken: false,
|
|
21
|
-
detectSessionInUrl: false,
|
|
22
|
-
},
|
|
23
|
-
global: {
|
|
24
|
-
headers: {
|
|
25
|
-
Authorization: `Bearer ${jwt}`,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
realtime: {
|
|
29
|
-
// any-allowed: ws's type matches Node, not the browser WebSocket
|
|
30
|
-
// interface Supabase's option signature is declared against.
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
-
transport: WebSocket,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=supabase.js.map
|
package/dist/supabase.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"supabase.js","sourceRoot":"","sources":["../src/supabase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,SAAS,MAAM,IAAI,CAAC;AAG3B,MAAM,UAAU,kBAAkB,CAAC,GAAiB,EAAE,GAAW;IAC/D,OAAO,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,eAAe,EAAE;QACxD,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QACrB,IAAI,EAAE;YACJ,cAAc,EAAE,KAAK;YACrB,gBAAgB,EAAE,KAAK;YACvB,kBAAkB,EAAE,KAAK;SAC1B;QACD,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,GAAG,EAAE;aAC/B;SACF;QACD,QAAQ,EAAE;YACR,iEAAiE;YACjE,6DAA6D;YAC7D,8DAA8D;YAC9D,SAAS,EAAE,SAAgB;SAC5B;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/task-runner.d.ts
DELETED
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import { type ExecaChildProcess } from "execa";
|
|
2
|
-
import { type RunnerConfig, type RunnerProfile } from "./config.js";
|
|
3
|
-
import { type NormalizedUsage } from "./cost-pricing.js";
|
|
4
|
-
import { type ClaudeExitClass } from "./failure-classifier.js";
|
|
5
|
-
import { type GitRunner } from "./git.js";
|
|
6
|
-
import { type GhRunner } from "./gh.js";
|
|
7
|
-
import { type McpConfigCleanup, type McpSpawnOptions } from "./mcp-spawn.js";
|
|
8
|
-
import { type PostRunnerStateArgs } from "./messaging.js";
|
|
9
|
-
import { type TaskLock } from "./runtime/locks.js";
|
|
10
|
-
import { type PreparedWorktree, type PrepareWorktreeOptions } from "./runtime/worktree.js";
|
|
11
|
-
import { type ConflictResolutionDeps } from "./runtime/conflict-resolver.js";
|
|
12
|
-
import { type AssertResolutionOptions, type ResolutionIntegrityDeps, type ResolutionIntegrityResult } from "./runtime/resolution-integrity.js";
|
|
13
|
-
import type { RunnerSupabaseClient } from "./supabase.js";
|
|
14
|
-
export interface CostEventPayload extends NormalizedUsage {
|
|
15
|
-
task_id: string;
|
|
16
|
-
model: string;
|
|
17
|
-
usd_cents: number;
|
|
18
|
-
runner_id?: string | null;
|
|
19
|
-
}
|
|
20
|
-
export interface RunTaskDeps {
|
|
21
|
-
supabase: RunnerSupabaseClient;
|
|
22
|
-
cfg: RunnerConfig;
|
|
23
|
-
git?: GitRunner;
|
|
24
|
-
gh?: GhRunner;
|
|
25
|
-
/** Override for tests — defaults to
|
|
26
|
-
* execa('claude', ['--print', '--dangerously-skip-permissions',
|
|
27
|
-
* '--output-format=json', '--model', modelId?]).
|
|
28
|
-
*
|
|
29
|
-
* v0.6.0 REG-296: modelId is forwarded as `--model <modelId>` when
|
|
30
|
-
* the task carries one, so cost tracking matches the actual model
|
|
31
|
-
* claude spawned with (previously the operator's default Opus was
|
|
32
|
-
* always used regardless of task.model_id). */
|
|
33
|
-
spawnClaude?: (cwd: string, modelId?: string) => ExecaChildProcess;
|
|
34
|
-
/** v0.6.0 REG-301: plain `git checkout <baseBranch>` so the task
|
|
35
|
-
* branch forks from the integration base, not whatever was checked
|
|
36
|
-
* out in cwd. Defaults to `execa('git', ['checkout', baseBranch])`.
|
|
37
|
-
* Tests inject a mock to assert the call ordering against the
|
|
38
|
-
* task-runner pre-spawn sequence. */
|
|
39
|
-
checkoutBase?: (repoPath: string, baseBranch: string) => Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Cost-event sink. Defaults to a direct `acc.record_cost_event` RPC
|
|
42
|
-
* on the runner's already-authenticated supabase client. Tests
|
|
43
|
-
* override; production callers (watch.ts) can override too if they
|
|
44
|
-
* prefer to route through /api/runner/cost-event.
|
|
45
|
-
*/
|
|
46
|
-
postCostEvent?: (event: CostEventPayload) => Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Runner session coordinates threaded down so the per-task
|
|
49
|
-
* .mcp.json can be authored before Claude Code spawns AND so the
|
|
50
|
-
* v0.6.1 claim_task_with_locks RPC can attribute the lock to the
|
|
51
|
-
* caller's runner row. v0.6.1 (REG-309 sibling): required now —
|
|
52
|
-
* watch.ts has always passed it; tests must stub it.
|
|
53
|
-
*/
|
|
54
|
-
session: {
|
|
55
|
-
accessToken: string;
|
|
56
|
-
runnerId: string;
|
|
57
|
-
};
|
|
58
|
-
/** Public URL forwarded to acc-mcp-server for telemetry POSTs. */
|
|
59
|
-
publicUrl?: string;
|
|
60
|
-
/** Override for tests; defaults to writing a real .mcp.json. */
|
|
61
|
-
writeMcpConfig?: (opts: McpSpawnOptions) => Promise<McpConfigCleanup>;
|
|
62
|
-
/**
|
|
63
|
-
* v0.11-F: per-task PID lock at `~/.cache/acc-runner/locks/<task_id>.pid`.
|
|
64
|
-
* Throws `TaskLockHeldError` when another live runner holds the lock;
|
|
65
|
-
* the caller surfaces `phase: "worktree_lock"` and bails before any
|
|
66
|
-
* worktree side-effect lands.
|
|
67
|
-
*/
|
|
68
|
-
acquireLock?: (taskId: string) => Promise<TaskLock>;
|
|
69
|
-
/**
|
|
70
|
-
* v0.11-F: provision an isolated git worktree at
|
|
71
|
-
* `~/.cache/acc-runner/work/<task_id>/`. All subsequent git ops +
|
|
72
|
-
* spawnClaude run with the worktree's path as cwd, never the
|
|
73
|
-
* operator's shared clone.
|
|
74
|
-
*/
|
|
75
|
-
prepareWorktree?: (opts: PrepareWorktreeOptions) => Promise<PreparedWorktree>;
|
|
76
|
-
/**
|
|
77
|
-
* v0.12-RESUME: cadence (ms) for the periodic
|
|
78
|
-
* `acc.update_task_signal` RPC that refreshes
|
|
79
|
-
* `acc.tasks.last_runner_signal_at` while the task is in flight.
|
|
80
|
-
* The 5-minute cron sweep uses a 5-minute cutoff, so 30s gives
|
|
81
|
-
* ~10 missed signals of margin before a still-alive runner gets
|
|
82
|
-
* its task pulled back to queued. Tests override to a sub-second
|
|
83
|
-
* cadence so the loop is observable without real-time waits.
|
|
84
|
-
*/
|
|
85
|
-
signalIntervalMs?: number;
|
|
86
|
-
/**
|
|
87
|
-
* v0.14-MESSAGING-RUNTIME-WIRE: bus sink for state transitions.
|
|
88
|
-
* Defaults to `acc.post_agent_message` on the same supabase client.
|
|
89
|
-
* Tests override to capture the call sequence. Best-effort — a
|
|
90
|
-
* failed post is logged but never bubbles past the task run.
|
|
91
|
-
*/
|
|
92
|
-
postRunnerStateMessage?: (args: PostRunnerStateArgs) => Promise<void>;
|
|
93
|
-
/**
|
|
94
|
-
* v0.14-MESSAGING-RUNTIME-WIRE: runner-profile loader. Defaults to
|
|
95
|
-
* `loadProfile()` from config.js. Returns null when no profile is
|
|
96
|
-
* selected (the v0.13 byte-identical path). Tests inject a stub so
|
|
97
|
-
* the prelude consumer can be exercised without writing a real JSON
|
|
98
|
-
* + module pair to disk.
|
|
99
|
-
*/
|
|
100
|
-
loadProfile?: () => RunnerProfile | null;
|
|
101
|
-
/**
|
|
102
|
-
* v0.14-MESSAGING-RUNTIME-WIRE: prelude-module loader. Defaults to
|
|
103
|
-
* the production dynamic-import path; tests inject a stub so the
|
|
104
|
-
* vitest/jsdom-backed environment doesn't try to route the
|
|
105
|
-
* file-URL through Vite's resolver. Returns the prelude string —
|
|
106
|
-
* empty string when the profile has no prelude or the module's
|
|
107
|
-
* default export is not a string.
|
|
108
|
-
*/
|
|
109
|
-
loadPromptPrelude?: (profile: RunnerProfile) => Promise<string>;
|
|
110
|
-
/**
|
|
111
|
-
* v0.48 T-48-5: optional dep overrides for the conflict-resolution path.
|
|
112
|
-
* Tests inject stubs to avoid real GitHub API calls. Production callers
|
|
113
|
-
* (watch.ts) leave this undefined — the defaults apply.
|
|
114
|
-
*/
|
|
115
|
-
conflictResolutionDeps?: Partial<ConflictResolutionDeps>;
|
|
116
|
-
/**
|
|
117
|
-
* v0.51 T-51-1: resolve a PR's head branch via gh when a rework task's
|
|
118
|
-
* sentinel carries an empty branch. Tests inject a stub; production
|
|
119
|
-
* defaults to `gh pr view <n> -R <repo> --json headRefName`.
|
|
120
|
-
*/
|
|
121
|
-
fetchPrHeadRef?: (repo: string, prNumber: number) => Promise<string>;
|
|
122
|
-
/**
|
|
123
|
-
* v0.63 T-63-1: authoritative env tiebreaker for a silent instant-empty
|
|
124
|
-
* claude exit. Defaults to spawning `claude --version` with a short
|
|
125
|
-
* timeout. Returns `ok: true` when the binary answers (the host is fine,
|
|
126
|
-
* so the exit was a transient `claude_unavailable` → pause + retry, NEVER
|
|
127
|
-
* quarantine) and `ok: false` when the probe itself errors / times out /
|
|
128
|
-
* exits non-zero (the binary or host is genuinely broken → upgrade to
|
|
129
|
-
* env_broken → quarantine). Tests inject a stub so they don't shell out to
|
|
130
|
-
* a real claude.
|
|
131
|
-
*/
|
|
132
|
-
healthProbe?: () => Promise<{
|
|
133
|
-
ok: boolean;
|
|
134
|
-
detail: string;
|
|
135
|
-
}>;
|
|
136
|
-
/**
|
|
137
|
-
* v0.57 T-57-2: conflict-resolution integrity guardrail. Runs before the
|
|
138
|
-
* push of a conflict-resolution task and rejects merges that left conflict
|
|
139
|
-
* markers, fail typecheck, or regressed a package version without a
|
|
140
|
-
* matching CHANGELOG entry. Defaults to `assertResolutionIntegrity` against
|
|
141
|
-
* the worktree; tests inject a stub to drive the three incident replays
|
|
142
|
-
* without a real worktree.
|
|
143
|
-
*/
|
|
144
|
-
assertResolutionIntegrity?: (workdir: string, opts: AssertResolutionOptions, deps?: ResolutionIntegrityDeps) => Promise<ResolutionIntegrityResult>;
|
|
145
|
-
}
|
|
146
|
-
export interface RunTaskController {
|
|
147
|
-
taskId: string;
|
|
148
|
-
promise: Promise<RunTaskOutcome>;
|
|
149
|
-
cancel(): void;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Failure phase tag. watch.ts pump() prints this on the stderr summary
|
|
153
|
-
* line (REG-294) so an operator can tell whether a multi-minute task
|
|
154
|
-
* died at fetch, git, claude, or push.
|
|
155
|
-
*/
|
|
156
|
-
export type RunTaskPhase = "claim_locks" | "transition_to_running" | "fetch" | "worktree_lock" | "git" | "claude_exit" | "push" | "github";
|
|
157
|
-
export interface RunTaskOutcome {
|
|
158
|
-
taskId: string;
|
|
159
|
-
status: "ok" | "failed" | "cancelled" | "capacity_paused" | "requeued";
|
|
160
|
-
prUrl?: string;
|
|
161
|
-
exitCode?: number | null;
|
|
162
|
-
error?: string;
|
|
163
|
-
/** v0.6.0 REG-294: which phase of runTask produced the failure. Set
|
|
164
|
-
* on every non-ok return so watch.ts pump() can surface a clear
|
|
165
|
-
* one-liner to the operator. */
|
|
166
|
-
phase?: RunTaskPhase;
|
|
167
|
-
/**
|
|
168
|
-
* v0.48: set when the failure classifier identifies a machine-level
|
|
169
|
-
* failure (usage_limit | auth_expired | env_broken). watch.ts uses
|
|
170
|
-
* this to quarantine the runner and NOT count the failure toward
|
|
171
|
-
* the task's retry budget.
|
|
172
|
-
*
|
|
173
|
-
* v0.56 (T-56-1): NEVER set for capacity_exhausted — capacity is a
|
|
174
|
-
* pause, not a quarantine. The capacity case sets the two fields below
|
|
175
|
-
* and status='capacity_paused' instead.
|
|
176
|
-
*/
|
|
177
|
-
quarantine_cause?: ClaudeExitClass;
|
|
178
|
-
/**
|
|
179
|
-
* v0.56 (T-56-1): true when claude exited because the Claude account hit
|
|
180
|
-
* its session/usage limit (api_error_status 429). The task is NOT
|
|
181
|
-
* transitioned to 'failed' — it is left for the stale-running sweep to
|
|
182
|
-
* return to 'queued' (runner_id cleared) losslessly — and watch.ts pauses
|
|
183
|
-
* the whole runner (tasks AND reviews) until `resume_at`. No
|
|
184
|
-
* dead-letter, no quarantine, no retry-budget burn.
|
|
185
|
-
*/
|
|
186
|
-
capacity_exhausted?: boolean;
|
|
187
|
-
/**
|
|
188
|
-
* v0.63 (T-63-1): true when claude exited with the silent instant-empty
|
|
189
|
-
* fingerprint (fast + empty, no 127, no env/auth/usage pattern) AND a
|
|
190
|
-
* `claude --version` health probe confirmed the binary still works — i.e.
|
|
191
|
-
* claude was momentarily unavailable, not the host broken. Routed exactly
|
|
192
|
-
* like capacity_exhausted: the task is left 'running' for the stale-running
|
|
193
|
-
* sweep to requeue losslessly (no dead-letter, no quarantine, no
|
|
194
|
-
* retry-budget burn) and `status` is 'capacity_paused' so watch.ts pauses
|
|
195
|
-
* the runner via the existing capacity lane. `resume_at` carries an
|
|
196
|
-
* EXPONENTIAL backoff instant (longer each consecutive silent exit). A
|
|
197
|
-
* sustained streak inside a rolling window escalates to a human INFRA alert
|
|
198
|
-
* — but NEVER quarantines.
|
|
199
|
-
*/
|
|
200
|
-
claude_unavailable?: boolean;
|
|
201
|
-
/**
|
|
202
|
-
* v0.56 (T-56-1): the stated reset instant (ISO-8601) parsed from
|
|
203
|
-
* claude's "...resets <time>" message, or null when no time was present
|
|
204
|
-
* (watch.ts then applies its default capacity backoff).
|
|
205
|
-
*
|
|
206
|
-
* v0.63 (T-63-1): also carries the exponential-backoff resume instant for a
|
|
207
|
-
* claude_unavailable pause (always non-null in that case).
|
|
208
|
-
*/
|
|
209
|
-
resume_at?: string | null;
|
|
210
|
-
/**
|
|
211
|
-
* v0.53 T-53-4: number of consecutive instant-empty claude exits that
|
|
212
|
-
* produced the quarantine_cause (only set alongside an env_broken
|
|
213
|
-
* cause). watch.ts persists it into quarantine.json's `consecutive`
|
|
214
|
-
* field. A definitive env_broken records 1; a heuristic env_broken
|
|
215
|
-
* records 2 (the runner retried the spawn and it exited instantly
|
|
216
|
-
* again). Undefined for non-env_broken causes.
|
|
217
|
-
*/
|
|
218
|
-
quarantine_consecutive?: number;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* v0.6.0 REG-296: build the argv for `claude --print`. Splitting this
|
|
222
|
-
* out keeps the model-passthrough logic unit-testable without spawning
|
|
223
|
-
* a real subprocess. modelId is forwarded as `--model <id>` when
|
|
224
|
-
* non-empty (whitespace counts as empty); otherwise omitted so claude
|
|
225
|
-
* uses the operator's default model.
|
|
226
|
-
*/
|
|
227
|
-
export declare function buildClaudeArgs(modelId?: string | null): string[];
|
|
228
|
-
/**
|
|
229
|
-
* v0.6.0 REG-295: expand `~/...` paths against $HOME so a task can
|
|
230
|
-
* carry `repo_path_hint = "~/work/foo"` from a row populated on a
|
|
231
|
-
* different machine. Absolute and relative paths pass through.
|
|
232
|
-
*/
|
|
233
|
-
export declare function expandHomePath(p: string): string;
|
|
234
|
-
/**
|
|
235
|
-
* v0.63 T-63-1: knobs for the silent-claude-unavailability response. Defaults
|
|
236
|
-
* pause + back off + retry on each silent instant-empty exit, growing the
|
|
237
|
-
* backoff exponentially, and raise a human INFRA alert only after a SUSTAINED
|
|
238
|
-
* streak inside a rolling window — never on 2, and never a quarantine.
|
|
239
|
-
*/
|
|
240
|
-
export interface ClaudeUnavailableKnobs {
|
|
241
|
-
/** Rolling window for the sustained-streak INFRA alert. */
|
|
242
|
-
windowMs: number;
|
|
243
|
-
/** Silent exits within `windowMs` that trip the INFRA alert (default ~5). */
|
|
244
|
-
alertThreshold: number;
|
|
245
|
-
/** First pause backoff; doubles each consecutive silent exit. */
|
|
246
|
-
backoffBaseMs: number;
|
|
247
|
-
/** Backoff ceiling so the ladder can't run away. */
|
|
248
|
-
backoffMaxMs: number;
|
|
249
|
-
}
|
|
250
|
-
/** v0.63 T-63-1: override the silent-unavailability knobs (used by tests). */
|
|
251
|
-
export declare function configureClaudeUnavailable(partial: Partial<ClaudeUnavailableKnobs>): void;
|
|
252
|
-
/** v0.63 T-63-1: reset both the streak and the knobs (used by tests). */
|
|
253
|
-
export declare function resetClaudeUnavailableState(): void;
|
|
254
|
-
export interface ClaudeUnavailableDecision {
|
|
255
|
-
/** Consecutive silent exits (drives the exponential backoff). */
|
|
256
|
-
streak: number;
|
|
257
|
-
/** Silent exits inside the rolling window (drives the INFRA alert). */
|
|
258
|
-
windowCount: number;
|
|
259
|
-
/** True once windowCount reaches the alert threshold — escalate to a human. */
|
|
260
|
-
alert: boolean;
|
|
261
|
-
/** Pause backoff (ms) for this exit. */
|
|
262
|
-
backoffMs: number;
|
|
263
|
-
/** Absolute resume instant (ISO-8601) = now + backoffMs. */
|
|
264
|
-
resumeAt: string;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* v0.63 T-63-1: record one silent instant-empty exit and compute the response
|
|
268
|
-
* (exponential backoff + whether the sustained-streak INFRA alert trips).
|
|
269
|
-
* Exported so the watch process and the unit suite share one definition.
|
|
270
|
-
*/
|
|
271
|
-
export declare function recordClaudeUnavailable(now: number): ClaudeUnavailableDecision;
|
|
272
|
-
/**
|
|
273
|
-
* Pull the structured report block from claude's stdout. Recognises
|
|
274
|
-
* both `--output-format=json` (extracts .result) and plain text. Falls
|
|
275
|
-
* back to the entire stdout (capped) if no `## Summary` heading is
|
|
276
|
-
* present — that way the PR body still tells the reviewer what happened.
|
|
277
|
-
*/
|
|
278
|
-
export declare function extractReportFromOutput(stdout: string): string;
|
|
279
|
-
/**
|
|
280
|
-
* v0.35-B: extract the PR number from a `gh pr create` URL. Returns null
|
|
281
|
-
* when the URL doesn't carry a `/pull/<int>` segment so the caller can
|
|
282
|
-
* fall back to the webhook-driven path. GitHub URLs encode PR ids as the
|
|
283
|
-
* last path segment; anchors and query strings are tolerated.
|
|
284
|
-
*/
|
|
285
|
-
export declare function parsePrNumber(url: string | null | undefined): number | null;
|
|
286
|
-
/**
|
|
287
|
-
* Build a cost event from claude's stdout. Always returns a payload
|
|
288
|
-
* (zero-cost when usage isn't parseable) so the cap-tracking surface
|
|
289
|
-
* stays consistent: one cost_events row per attempt.
|
|
290
|
-
*/
|
|
291
|
-
export declare function buildCostEvent(taskId: string, stdout: string, fallbackModel: string | null | undefined, runnerId: string | null | undefined): CostEventPayload;
|
|
292
|
-
/**
|
|
293
|
-
* v0.14-MESSAGING-RUNTIME-WIRE — dynamic-import the prelude module
|
|
294
|
-
* referenced by a runner profile and return its default-exported string.
|
|
295
|
-
*
|
|
296
|
-
* The prelude path in the profile JSON (e.g. `./src/profiles/developer-
|
|
297
|
-
* prompt.ts`) is interpreted from the runner package root — the parent
|
|
298
|
-
* of the runner-profiles dir where the JSON lives. In source/dev the
|
|
299
|
-
* .ts file is importable via tsx; in the npm-published artifact only
|
|
300
|
-
* `dist/` ships, so we map `src/*.ts` → `dist/*.js` when the .ts target
|
|
301
|
-
* doesn't exist. Returns empty string when no prelude is configured or
|
|
302
|
-
* the import resolves to a non-string default (v0.13 byte-identical).
|
|
303
|
-
*
|
|
304
|
-
* Exported so tests can stub the resolution + import seam via the
|
|
305
|
-
* `loadPromptPrelude` dep on RunTaskDeps — vitest's Vite-backed
|
|
306
|
-
* transform pipeline does not handle dynamic imports of arbitrary file
|
|
307
|
-
* URLs in the jsdom environment, so the production path is exercised
|
|
308
|
-
* by the runner's own unit suite (node env) rather than by the
|
|
309
|
-
* top-level integration test.
|
|
310
|
-
*/
|
|
311
|
-
export declare function loadPromptPrelude(profile: RunnerProfile): Promise<string>;
|
|
312
|
-
export declare function runTask(taskId: string, deps: RunTaskDeps): RunTaskController;
|
|
313
|
-
//# sourceMappingURL=task-runner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"task-runner.d.ts","sourceRoot":"","sources":["../src/task-runner.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAS,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAqC,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACvG,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC5B,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAIL,KAAK,sBAAsB,EAC5B,MAAM,gCAAgC,CAAC;AAOxC,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD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