harness-dispatch 0.4.0 → 0.6.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/CHANGELOG.md +152 -0
- package/README.md +232 -87
- package/config.default.yaml +416 -397
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +2 -2
- package/dist/auth.js.map +1 -1
- package/dist/billing.d.ts +35 -4
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +48 -17
- package/dist/billing.js.map +1 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +147 -91
- package/dist/bin.js.map +1 -1
- package/dist/breaker-store.d.ts +60 -9
- package/dist/breaker-store.d.ts.map +1 -1
- package/dist/breaker-store.js +246 -50
- package/dist/breaker-store.js.map +1 -1
- package/dist/circuit-breaker.d.ts +35 -0
- package/dist/circuit-breaker.d.ts.map +1 -1
- package/dist/circuit-breaker.js +68 -11
- package/dist/circuit-breaker.js.map +1 -1
- package/dist/config/coercions.d.ts +31 -0
- package/dist/config/coercions.d.ts.map +1 -0
- package/dist/config/coercions.js +169 -0
- package/dist/config/coercions.js.map +1 -0
- package/dist/config/env-interpolation.d.ts +36 -0
- package/dist/config/env-interpolation.d.ts.map +1 -0
- package/dist/config/env-interpolation.js +73 -0
- package/dist/config/env-interpolation.js.map +1 -0
- package/dist/config/protocol.d.ts +51 -0
- package/dist/config/protocol.d.ts.map +1 -0
- package/dist/config/protocol.js +300 -0
- package/dist/config/protocol.js.map +1 -0
- package/dist/config/route-fields.d.ts +72 -0
- package/dist/config/route-fields.d.ts.map +1 -0
- package/dist/config/route-fields.js +128 -0
- package/dist/config/route-fields.js.map +1 -0
- package/dist/config/validation.d.ts +72 -0
- package/dist/config/validation.d.ts.map +1 -0
- package/dist/config/validation.js +189 -0
- package/dist/config/validation.js.map +1 -0
- package/dist/config.d.ts +19 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +214 -635
- package/dist/config.js.map +1 -1
- package/dist/configure-yaml.d.ts +23 -0
- package/dist/configure-yaml.d.ts.map +1 -0
- package/dist/configure-yaml.js +193 -0
- package/dist/configure-yaml.js.map +1 -0
- package/dist/dispatch-log.d.ts.map +1 -1
- package/dist/dispatch-log.js +2 -3
- package/dist/dispatch-log.js.map +1 -1
- package/dist/dispatchers/base.d.ts +3 -0
- package/dist/dispatchers/base.d.ts.map +1 -1
- package/dist/dispatchers/base.js.map +1 -1
- package/dist/dispatchers/generic-cli.d.ts +15 -1
- package/dist/dispatchers/generic-cli.d.ts.map +1 -1
- package/dist/dispatchers/generic-cli.js +69 -5
- package/dist/dispatchers/generic-cli.js.map +1 -1
- package/dist/dispatchers/openai-compatible.d.ts.map +1 -1
- package/dist/dispatchers/openai-compatible.js +70 -2
- package/dist/dispatchers/openai-compatible.js.map +1 -1
- package/dist/dispatchers/shared/kill-tree.d.ts +17 -4
- package/dist/dispatchers/shared/kill-tree.d.ts.map +1 -1
- package/dist/dispatchers/shared/kill-tree.js +28 -4
- package/dist/dispatchers/shared/kill-tree.js.map +1 -1
- package/dist/dispatchers/shared/rate-limit-headers.d.ts +17 -0
- package/dist/dispatchers/shared/rate-limit-headers.d.ts.map +1 -1
- package/dist/dispatchers/shared/rate-limit-headers.js +27 -0
- package/dist/dispatchers/shared/rate-limit-headers.js.map +1 -1
- package/dist/dispatchers/shared/stream-subprocess.d.ts +11 -0
- package/dist/dispatchers/shared/stream-subprocess.d.ts.map +1 -1
- package/dist/dispatchers/shared/stream-subprocess.js +62 -35
- package/dist/dispatchers/shared/stream-subprocess.js.map +1 -1
- package/dist/dispatchers/shared/subprocess.d.ts.map +1 -1
- package/dist/dispatchers/shared/subprocess.js +3 -0
- package/dist/dispatchers/shared/subprocess.js.map +1 -1
- package/dist/dispatchers/shared/which-available.d.ts.map +1 -1
- package/dist/dispatchers/shared/which-available.js +16 -2
- package/dist/dispatchers/shared/which-available.js.map +1 -1
- package/dist/file-lock.d.ts +17 -0
- package/dist/file-lock.d.ts.map +1 -0
- package/dist/file-lock.js +143 -0
- package/dist/file-lock.js.map +1 -0
- package/dist/http/parse.d.ts +64 -0
- package/dist/http/parse.d.ts.map +1 -0
- package/dist/http/parse.js +230 -0
- package/dist/http/parse.js.map +1 -0
- package/dist/http/server.d.ts +2 -0
- package/dist/http/server.d.ts.map +1 -1
- package/dist/http/server.js +249 -286
- package/dist/http/server.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/job-runner.js +23 -5
- package/dist/job-runner.js.map +1 -1
- package/dist/jobs/context.d.ts +17 -0
- package/dist/jobs/context.d.ts.map +1 -0
- package/dist/jobs/context.js +84 -0
- package/dist/jobs/context.js.map +1 -0
- package/dist/jobs/store.d.ts +80 -0
- package/dist/jobs/store.d.ts.map +1 -0
- package/dist/jobs/store.js +279 -0
- package/dist/jobs/store.js.map +1 -0
- package/dist/jobs/types.d.ts +135 -0
- package/dist/jobs/types.d.ts.map +1 -0
- package/dist/jobs/types.js +11 -0
- package/dist/jobs/types.js.map +1 -0
- package/dist/jobs.d.ts +165 -85
- package/dist/jobs.d.ts.map +1 -1
- package/dist/jobs.js +824 -208
- package/dist/jobs.js.map +1 -1
- package/dist/leaderboard.d.ts +24 -1
- package/dist/leaderboard.d.ts.map +1 -1
- package/dist/leaderboard.js +94 -2
- package/dist/leaderboard.js.map +1 -1
- package/dist/mcp/config-hot-reload.d.ts.map +1 -1
- package/dist/mcp/config-hot-reload.js +1 -1
- package/dist/mcp/config-hot-reload.js.map +1 -1
- package/dist/mcp/dispatcher-factory.d.ts +16 -1
- package/dist/mcp/dispatcher-factory.d.ts.map +1 -1
- package/dist/mcp/dispatcher-factory.js +41 -3
- package/dist/mcp/dispatcher-factory.js.map +1 -1
- package/dist/mcp/tool-schemas.d.ts +194 -0
- package/dist/mcp/tool-schemas.d.ts.map +1 -0
- package/dist/mcp/tool-schemas.js +311 -0
- package/dist/mcp/tool-schemas.js.map +1 -0
- package/dist/mcp/tools.d.ts +26 -51
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +122 -151
- package/dist/mcp/tools.js.map +1 -1
- package/dist/observability/index.d.ts +16 -3
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +23 -7
- package/dist/observability/index.js.map +1 -1
- package/dist/observability/spans.d.ts.map +1 -1
- package/dist/observability/spans.js +4 -1
- package/dist/observability/spans.js.map +1 -1
- package/dist/quota.d.ts +106 -22
- package/dist/quota.d.ts.map +1 -1
- package/dist/quota.js +198 -58
- package/dist/quota.js.map +1 -1
- package/dist/route-policy.d.ts.map +1 -1
- package/dist/route-policy.js +13 -3
- package/dist/route-policy.js.map +1 -1
- package/dist/router.d.ts +29 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +102 -40
- package/dist/router.js.map +1 -1
- package/dist/safety.d.ts.map +1 -1
- package/dist/safety.js +11 -2
- package/dist/safety.js.map +1 -1
- package/dist/state-dir.d.ts +17 -0
- package/dist/state-dir.d.ts.map +1 -0
- package/dist/state-dir.js +21 -0
- package/dist/state-dir.js.map +1 -0
- package/dist/status.d.ts +49 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +67 -4
- package/dist/status.js.map +1 -1
- package/dist/types.d.ts +74 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/working-dir.d.ts +13 -0
- package/dist/working-dir.d.ts.map +1 -1
- package/dist/working-dir.js +27 -0
- package/dist/working-dir.js.map +1 -1
- package/dist/workspace-lock.d.ts +40 -0
- package/dist/workspace-lock.d.ts.map +1 -0
- package/dist/workspace-lock.js +258 -0
- package/dist/workspace-lock.js.map +1 -0
- package/dist/workspace-resolve.d.ts +98 -0
- package/dist/workspace-resolve.d.ts.map +1 -0
- package/dist/workspace-resolve.js +382 -0
- package/dist/workspace-resolve.js.map +1 -0
- package/dist/workspaces.d.ts +16 -0
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +166 -22
- package/dist/workspaces.js.map +1 -1
- package/package.json +99 -96
- package/dist/dashboard/live.d.ts +0 -49
- package/dist/dashboard/live.d.ts.map +0 -1
- package/dist/dashboard/live.js +0 -149
- package/dist/dashboard/live.js.map +0 -1
package/dist/jobs.d.ts
CHANGED
|
@@ -10,91 +10,13 @@
|
|
|
10
10
|
* by the unit-test suite, which injects fake dispatchers a separate
|
|
11
11
|
* process could not see).
|
|
12
12
|
*/
|
|
13
|
-
import type {
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
files?: string[];
|
|
21
|
-
workingDir?: string;
|
|
22
|
-
hints?: RouteHints;
|
|
23
|
-
workspacePolicy?: WorkspacePolicy;
|
|
24
|
-
service?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Live dispatcher-event tap, used by the `dispatch` tool to forward MCP
|
|
27
|
-
* progress notifications during its inline grace window. Never serialized
|
|
28
|
-
* (the manifest lists its fields explicitly), never awaited, and a throw
|
|
29
|
-
* here must not fail the job.
|
|
30
|
-
*/
|
|
31
|
-
onEvent?: (event: DispatcherEvent) => void;
|
|
32
|
-
}
|
|
33
|
-
export interface JobStatus {
|
|
34
|
-
jobId: string;
|
|
35
|
-
/**
|
|
36
|
-
* "orphaned" is never written to disk — it's computed on read: a job
|
|
37
|
-
* whose status file says "running" but whose heartbeat (updatedAt) has
|
|
38
|
-
* gone stale means the server process that owned the background run
|
|
39
|
-
* exited (session restart, crash) and the run died with it. Reporting it
|
|
40
|
-
* as still "running" forever is a lie that makes callers poll a corpse.
|
|
41
|
-
*/
|
|
42
|
-
status: "queued" | "running" | "completed" | "failed" | "orphaned";
|
|
43
|
-
createdAt: string;
|
|
44
|
-
updatedAt: string;
|
|
45
|
-
jobDir: string;
|
|
46
|
-
service?: string;
|
|
47
|
-
route?: string;
|
|
48
|
-
success?: boolean;
|
|
49
|
-
/** Bounded copy — full text in output/stderr.log. */
|
|
50
|
-
error?: string;
|
|
51
|
-
durationMs?: number;
|
|
52
|
-
/** Suggested seconds to wait before polling action=get again. */
|
|
53
|
-
nextPollSeconds?: number;
|
|
54
|
-
/** Agent-facing guidance on how to collect the result. */
|
|
55
|
-
instructions?: string;
|
|
56
|
-
/** Set when workingDir was omitted and defaulted to the router's own cwd. */
|
|
57
|
-
warning?: string;
|
|
58
|
-
}
|
|
59
|
-
export interface JobManifest {
|
|
60
|
-
jobId: string;
|
|
61
|
-
createdAt: string;
|
|
62
|
-
workingDir: string;
|
|
63
|
-
promptPath: string;
|
|
64
|
-
files: Array<{
|
|
65
|
-
originalPath: string;
|
|
66
|
-
snapshotPath?: string;
|
|
67
|
-
sizeBytes?: number;
|
|
68
|
-
error?: string;
|
|
69
|
-
}>;
|
|
70
|
-
hints?: RouteHints;
|
|
71
|
-
workspacePolicy?: WorkspacePolicy;
|
|
72
|
-
service?: string;
|
|
73
|
-
/** Set when workingDir was omitted and defaulted to the router's own cwd. */
|
|
74
|
-
warning?: string;
|
|
75
|
-
}
|
|
76
|
-
export interface JobResultPayload {
|
|
77
|
-
jobId: string;
|
|
78
|
-
result: DispatchResult;
|
|
79
|
-
decision: RoutingDecision | null;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Config-driven retention (`retention: { jobs_days: N }` in config.yaml) —
|
|
83
|
-
* set at runtime bootstrap and on every hot reload. Precedence:
|
|
84
|
-
* HARNESS_DISPATCH_JOB_MAX_AGE_MS env > config > 7-day default.
|
|
85
|
-
*/
|
|
86
|
-
export declare function setJobRetentionDays(days: number | undefined): void;
|
|
87
|
-
export interface StartedJob {
|
|
88
|
-
status: JobStatus;
|
|
89
|
-
/**
|
|
90
|
-
* Resolves once the run has reached a terminal state on disk (result.json
|
|
91
|
-
* or a failed/orphaned status). Never rejects. In detached mode this is a
|
|
92
|
-
* disk watcher on the job directory — the run itself lives in a separate
|
|
93
|
-
* job-runner process; in in-process mode (HARNESS_DISPATCH_INPROC_JOBS=1,
|
|
94
|
-
* used by unit tests with injected fakes) it is the runJob promise itself.
|
|
95
|
-
*/
|
|
96
|
-
completion: Promise<void>;
|
|
97
|
-
}
|
|
13
|
+
import type { RouterConfig } from "./types.js";
|
|
14
|
+
import { buildContextPreamble } from "./jobs/context.js";
|
|
15
|
+
import { setJobRetentionDays } from "./jobs/store.js";
|
|
16
|
+
import type { JobDeps, JobManifest, JobResultPayload, JobStatus, StartedJob, StartJobInput } from "./jobs/types.js";
|
|
17
|
+
export { buildContextPreamble };
|
|
18
|
+
export { setJobRetentionDays };
|
|
19
|
+
export type { JobDeps, JobManifest, JobResultPayload, JobStatus, StartedJob, StartJobInput };
|
|
98
20
|
/**
|
|
99
21
|
* Rebuild a job's input from its on-disk bundle and execute it. This is the
|
|
100
22
|
* detached runner's whole job; the manifest deliberately carries everything
|
|
@@ -103,6 +25,83 @@ export interface StartedJob {
|
|
|
103
25
|
* created.
|
|
104
26
|
*/
|
|
105
27
|
export declare function executeJobDir(deps: JobDeps, jobDir: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Occupied slots: jobs actually executing right now. Counts `running` (and
|
|
30
|
+
* plain `queued` — a runner spawned but not yet started) only while the
|
|
31
|
+
* heartbeat is fresh, so a crashed runner's slot is reclaimed by the same
|
|
32
|
+
* ORPHAN_THRESHOLD_MS rule that already frees its status. Slot-queued jobs
|
|
33
|
+
* are waiting for a slot, not holding one.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* What one run of a route costs against the concurrency budget.
|
|
37
|
+
*
|
|
38
|
+
* Unknown routes count as a full 1.0 on purpose. A job that has not been
|
|
39
|
+
* routed yet (no forced `service`) has no weight to look up, and this bound
|
|
40
|
+
* exists because a measured burst of 13 concurrent CLIs exhausted memory —
|
|
41
|
+
* so the safe assumption for "might be anything" is "might be heavy".
|
|
42
|
+
*/
|
|
43
|
+
export declare function resourceWeightFor(status: JobStatus, config: RouterConfig | undefined): number;
|
|
44
|
+
/**
|
|
45
|
+
* Capacity currently in use, as a weighted sum rather than a job count.
|
|
46
|
+
*
|
|
47
|
+
* With every weight at 1.0 this is exactly the old count, so an existing
|
|
48
|
+
* `max_concurrent_runs` keeps its previous meaning.
|
|
49
|
+
*/
|
|
50
|
+
export declare function activeCapacity(statuses: Array<{
|
|
51
|
+
status: JobStatus;
|
|
52
|
+
}>, config: RouterConfig | undefined): number;
|
|
53
|
+
/**
|
|
54
|
+
* How many supervisor PROCESSES may exist, regardless of how many jobs run.
|
|
55
|
+
*
|
|
56
|
+
* Previously every job got its own detached Node process. Measured on Windows
|
|
57
|
+
* with Node 24: a bare node process is 52 MB RSS and one that has bootstrapped
|
|
58
|
+
* a runtime is 65 MB, against ~54 MB for the agent CLI it exists to supervise.
|
|
59
|
+
* So more than half the memory of a concurrent run was wrapper, and it scaled
|
|
60
|
+
* linearly — 13 concurrent jobs meant 845 MB of supervision before any agent
|
|
61
|
+
* had read a file. That is the concurrency ceiling.
|
|
62
|
+
*
|
|
63
|
+
* A supervisor is almost entirely idle: it waits on a child process and writes
|
|
64
|
+
* the result. One can watch several at once for the cost of async I/O, so
|
|
65
|
+
* wrapper memory becomes O(1) in the number of jobs instead of O(N), capped
|
|
66
|
+
* here at ~260 MB.
|
|
67
|
+
*
|
|
68
|
+
* Four rather than one purely to bound blast radius: a supervisor crash strands
|
|
69
|
+
* only the jobs it held. Those are recoverable anyway — the job directory is
|
|
70
|
+
* the source of truth and the heartbeat check already marks stranded jobs
|
|
71
|
+
* orphaned — but losing a quarter of in-flight work beats losing all of it.
|
|
72
|
+
*/
|
|
73
|
+
export declare const SUPERVISOR_POOL_SIZE = 4;
|
|
74
|
+
/**
|
|
75
|
+
* Take exclusive ownership of a job directory.
|
|
76
|
+
*
|
|
77
|
+
* `wx` fails if the file exists, atomically, on both Windows and POSIX — which
|
|
78
|
+
* is what stops two supervisors racing onto the same job. A claim left behind
|
|
79
|
+
* by a crashed supervisor is reclaimed once that job's heartbeat has gone
|
|
80
|
+
* stale, by the same ORPHAN_THRESHOLD_MS rule used everywhere else.
|
|
81
|
+
*
|
|
82
|
+
* Exported for tests: the one-winner property under concurrent reclaim is the
|
|
83
|
+
* invariant, and it is only checkable by calling this directly.
|
|
84
|
+
*/
|
|
85
|
+
export declare function claimJobDir(jobDir: string, status: JobStatus): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Supervisor main loop: claim work, run several jobs at once, exit when idle.
|
|
88
|
+
*
|
|
89
|
+
* Exiting on idle keeps the no-jobs steady state at zero processes, same as
|
|
90
|
+
* before — the pool is a way to share supervision cost while work exists, not
|
|
91
|
+
* a daemon.
|
|
92
|
+
*/
|
|
93
|
+
export declare function runSupervisor(deps: JobDeps, supervisorId?: string): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Start slot-queued jobs, oldest first, until the machine is at its limit.
|
|
96
|
+
*
|
|
97
|
+
* Deliberately has no daemon behind it: this runs on every new dispatch and
|
|
98
|
+
* again as each runner exits, which between them covers every moment a slot
|
|
99
|
+
* can free. The cost of that choice is that if every runner dies while jobs
|
|
100
|
+
* are queued, the queue resumes on the next dispatch rather than immediately.
|
|
101
|
+
* Bounded waiting was the explicit alternative and was not chosen — a queued
|
|
102
|
+
* job keeps its jobId and its artifacts either way, so nothing is lost.
|
|
103
|
+
*/
|
|
104
|
+
export declare function drainSlotQueue(config: RouterConfig | undefined, configPath: string | undefined): Promise<void>;
|
|
106
105
|
export declare function startAsyncJob(deps: JobDeps, input: StartJobInput): Promise<JobStatus>;
|
|
107
106
|
export declare function startAsyncJobTracked(deps: JobDeps, input: StartJobInput): Promise<StartedJob>;
|
|
108
107
|
export declare function getAsyncJob(jobId: string): Promise<{
|
|
@@ -113,4 +112,85 @@ export declare function getAsyncJob(jobId: string): Promise<{
|
|
|
113
112
|
partialOutput?: string;
|
|
114
113
|
}>;
|
|
115
114
|
export declare function listAsyncJobs(): Promise<JobStatus[]>;
|
|
115
|
+
/** What a cancel request actually did — the caller needs to tell these apart. */
|
|
116
|
+
export interface CancelOutcome {
|
|
117
|
+
jobId: string;
|
|
118
|
+
/**
|
|
119
|
+
* `cancelled` — it was queued and never started; stopped outright.
|
|
120
|
+
* `cancelling` — it is running; teardown requested and lands shortly.
|
|
121
|
+
* `already_finished` — it had already reached a terminal state; nothing done.
|
|
122
|
+
*/
|
|
123
|
+
outcome: "cancelled" | "cancelling" | "already_finished";
|
|
124
|
+
status: JobStatus["status"];
|
|
125
|
+
message: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Ask a job to stop.
|
|
129
|
+
*
|
|
130
|
+
* Cancellation cannot be a signal here: jobs run inside POOLED supervisors,
|
|
131
|
+
* and the only pid recorded against a job belongs to a process that is also
|
|
132
|
+
* running other jobs, so signalling it would cancel work nobody asked to
|
|
133
|
+
* cancel. Instead this writes a marker the run itself honours — it drops out
|
|
134
|
+
* of its event stream, which triggers the dispatcher's teardown (killTree on
|
|
135
|
+
* the agent CLI and its children) and releases the workspace lock through the
|
|
136
|
+
* same path a normal finish uses.
|
|
137
|
+
*
|
|
138
|
+
* Two consequences worth stating plainly, because a caller who assumes
|
|
139
|
+
* otherwise will be surprised:
|
|
140
|
+
*
|
|
141
|
+
* 1. It is not instantaneous. A running job stops within about a second;
|
|
142
|
+
* `cancelling` means requested, not done. Poll job_status to see it land.
|
|
143
|
+
* 2. Work already done is NOT undone. A cancelled agent may have already
|
|
144
|
+
* edited files in the workspace, and those edits stay. Cancelling stops
|
|
145
|
+
* further work; it is not a rollback.
|
|
146
|
+
*
|
|
147
|
+
* A cancelled run is deliberately not recorded as a failure: the route's
|
|
148
|
+
* circuit breaker and failure count never see it, because the caller changing
|
|
149
|
+
* their mind says nothing about whether the route works.
|
|
150
|
+
*/
|
|
151
|
+
export declare function cancelJob(jobId: string, reason?: string): Promise<CancelOutcome>;
|
|
152
|
+
/**
|
|
153
|
+
* Inspect or resolve the isolated workspace a finished job left behind.
|
|
154
|
+
*
|
|
155
|
+
* Looks the job up the same way job_status does, then hands off to
|
|
156
|
+
* workspace-resolve.ts. Kept here so the caller only ever needs a jobId —
|
|
157
|
+
* where the workspace lives, and which policy produced it, are details
|
|
158
|
+
* recorded in the job's own result.
|
|
159
|
+
*/
|
|
160
|
+
export declare function resolveJobWorkspace(jobId: string, action: "diff" | "apply" | "discard", opts?: {
|
|
161
|
+
force?: boolean;
|
|
162
|
+
}): Promise<unknown>;
|
|
163
|
+
export interface RetryOutcome {
|
|
164
|
+
jobId: string;
|
|
165
|
+
retryOf: string;
|
|
166
|
+
service?: string;
|
|
167
|
+
reusedFrom: {
|
|
168
|
+
prompt: boolean;
|
|
169
|
+
files: number;
|
|
170
|
+
workingDir: string;
|
|
171
|
+
};
|
|
172
|
+
message: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Run a finished job's task again.
|
|
176
|
+
*
|
|
177
|
+
* The last verb missing from the job lifecycle: you could start work, watch
|
|
178
|
+
* it, stop it, and resolve its workspace — but if it failed, reproducing it
|
|
179
|
+
* meant reconstructing the prompt, the file list, the working directory and
|
|
180
|
+
* the hints by hand, from a job record that already holds all four. The
|
|
181
|
+
* machinery to execute a job bundle existed (executeJobDir) and simply was
|
|
182
|
+
* not reachable from outside.
|
|
183
|
+
*
|
|
184
|
+
* The prompt is taken from prompt.md, which is the FROZEN prompt — including
|
|
185
|
+
* any context preamble the original dispatch rendered in. A retry therefore
|
|
186
|
+
* reproduces what the delegate actually saw, not what the caller typed.
|
|
187
|
+
*
|
|
188
|
+
* `service` retargets the attempt, which is the common case rather than an
|
|
189
|
+
* afterthought: the reason a run failed is often the route, not the task
|
|
190
|
+
* ("codex hit its usage limit — try claude"). Omit it to reuse the original
|
|
191
|
+
* route, or to let the router pick again if the original had none.
|
|
192
|
+
*/
|
|
193
|
+
export declare function retryJob(jobId: string, deps: JobDeps, opts?: {
|
|
194
|
+
service?: string;
|
|
195
|
+
}): Promise<RetryOutcome>;
|
|
116
196
|
//# sourceMappingURL=jobs.d.ts.map
|
package/dist/jobs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../src/jobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../src/jobs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,OAAO,KAAK,EAIV,YAAY,EAGb,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAcL,mBAAmB,EAOpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,UAAU,EACV,aAAa,EACd,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AAiS7F;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAchF;AAkGD;;;;;;GAMG;AACH;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CAQ7F;AAeD;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,KAAK,CAAC;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC,EACtC,MAAM,EAAE,YAAY,GAAG,SAAS,GAC/B,MAAM,CAUR;AAOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAatC;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAA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