@bastani/atomic 0.9.85 → 0.9.86-alpha.1
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 +20 -0
- package/dist/builtin/intercom/CHANGELOG.md +15 -0
- package/dist/builtin/intercom/README.md +10 -9
- package/dist/builtin/intercom/broker/away-asks.ts +260 -0
- package/dist/builtin/intercom/broker/broker.ts +170 -9
- package/dist/builtin/intercom/broker/client.ts +5 -3
- package/dist/builtin/intercom/broker/held-reply-targets.ts +5 -0
- package/dist/builtin/intercom/broker/multinode-router.ts +16 -7
- package/dist/builtin/intercom/broker/paths.ts +5 -0
- package/dist/builtin/intercom/broker/pending-question-index.ts +119 -0
- package/dist/builtin/intercom/broker/released-asker-replies.ts +39 -0
- package/dist/builtin/intercom/broker/send-handler.ts +44 -3
- package/dist/builtin/intercom/broker/terminal-questions.ts +2 -0
- package/dist/builtin/intercom/index.bundle.mjs +799 -177
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/retry-policy.ts +1 -1
- package/dist/builtin/intercom/skills/intercom/SKILL.md +29 -35
- package/dist/builtin/intercom/types.ts +7 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +20 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/subagent/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +2765 -2719
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +12 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/authoring.d.ts +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +371 -193
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +358 -181
- package/dist/builtin/workflows/src/index.js +356 -183
- package/dist/builtin/workflows/src/local-worker-entry.mjs +358 -181
- package/dist/builtin/workflows/src/shared/worktree-restore-outcome.d.ts +16 -0
- package/dist/builtin/workflows/src/workers/workspace-binding.d.ts +13 -2
- package/dist/core/agent-session-methods.d.ts +1 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +2 -35
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +3 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +12 -5
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +14 -1
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +3 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/resume/index.d.ts +1 -1
- package/dist/core/resume/index.d.ts.map +1 -1
- package/dist/core/resume/index.js +1 -1
- package/dist/core/resume/index.js.map +1 -1
- package/dist/core/resume/path-mapping.d.ts +10 -0
- package/dist/core/resume/path-mapping.d.ts.map +1 -1
- package/dist/core/resume/path-mapping.js +20 -0
- package/dist/core/resume/path-mapping.js.map +1 -1
- package/dist/core/resume/session-resume.d.ts +5 -0
- package/dist/core/resume/session-resume.d.ts.map +1 -1
- package/dist/core/resume/session-resume.js +24 -9
- package/dist/core/resume/session-resume.js.map +1 -1
- package/dist/core/session-worktree-snapshots.d.ts +5 -8
- package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
- package/dist/core/session-worktree-snapshots.js +34 -99
- package/dist/core/session-worktree-snapshots.js.map +1 -1
- package/dist/core/skill-catalog.d.ts +11 -0
- package/dist/core/skill-catalog.d.ts.map +1 -1
- package/dist/core/skill-catalog.js +31 -0
- package/dist/core/skill-catalog.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts +2 -0
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +5 -1
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +17 -0
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +12 -6
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tasks/task-view-source.d.ts +10 -0
- package/dist/core/tasks/task-view-source.d.ts.map +1 -1
- package/dist/core/tasks/task-view-source.js +24 -1
- package/dist/core/tasks/task-view-source.js.map +1 -1
- package/dist/core/worktree-snapshot/best-restore.d.ts +45 -0
- package/dist/core/worktree-snapshot/best-restore.d.ts.map +1 -0
- package/dist/core/worktree-snapshot/best-restore.js +92 -0
- package/dist/core/worktree-snapshot/best-restore.js.map +1 -0
- package/dist/core/worktree-snapshot/git.d.ts +2 -2
- package/dist/core/worktree-snapshot/git.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/git.js +2 -5
- package/dist/core/worktree-snapshot/git.js.map +1 -1
- package/dist/core/worktree-snapshot/index.d.ts +1 -0
- package/dist/core/worktree-snapshot/index.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/index.js +1 -0
- package/dist/core/worktree-snapshot/index.js.map +1 -1
- package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/restore.js +18 -2
- package/dist/core/worktree-snapshot/restore.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/chat-autocomplete.d.ts +7 -0
- package/dist/modes/interactive/chat-autocomplete.d.ts.map +1 -0
- package/dist/modes/interactive/chat-autocomplete.js +85 -0
- package/dist/modes/interactive/chat-autocomplete.js.map +1 -0
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +8 -0
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +3 -79
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/skill-command-autocomplete.d.ts +6 -0
- package/dist/modes/interactive/skill-command-autocomplete.d.ts.map +1 -1
- package/dist/modes/interactive/skill-command-autocomplete.js +18 -2
- package/dist/modes/interactive/skill-command-autocomplete.js.map +1 -1
- package/docs/background-tasks.md +1 -1
- package/docs/intercom/operations.md +4 -4
- package/docs/intercom/reference.md +39 -8
- package/docs/intercom.md +26 -9
- package/docs/skills.md +3 -1
- package/docs/subagents.md +2 -0
- package/docs/workflows/api-reference.md +3 -3
- package/docs/workflows/operations.md +2 -2
- package/docs/worktree-snapshots.md +10 -4
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
|
@@ -3702,14 +3702,20 @@ var init_sqlite_run_journal = __esm(() => {
|
|
|
3702
3702
|
});
|
|
3703
3703
|
|
|
3704
3704
|
// dist/builtin/workflows/src/durable/worktree-snapshots.ts
|
|
3705
|
-
import {
|
|
3705
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
3706
|
+
import { isAbsolute as isAbsolute2, join as join3, relative, resolve, sep } from "node:path";
|
|
3706
3707
|
import {
|
|
3707
3708
|
canonicalizeWorktreePath,
|
|
3709
|
+
formatDegradedRestoreNotice,
|
|
3710
|
+
formatUnrestoredNotice,
|
|
3711
|
+
isGitUnavailableError,
|
|
3708
3712
|
isHeadOnlyAdvance,
|
|
3709
3713
|
isWorkspaceDriftError,
|
|
3714
|
+
isWorkspaceRestoreError,
|
|
3710
3715
|
isWorkspaceSnapshotError,
|
|
3711
3716
|
removeRestoredWorktree,
|
|
3712
|
-
|
|
3717
|
+
restoreBestWorktree,
|
|
3718
|
+
unrestoredRecord,
|
|
3713
3719
|
verifyWorktree,
|
|
3714
3720
|
WorkspaceDriftError
|
|
3715
3721
|
} from "@bastani/atomic";
|
|
@@ -3787,13 +3793,26 @@ function originalRoot(root, mappings) {
|
|
|
3787
3793
|
}
|
|
3788
3794
|
return root;
|
|
3789
3795
|
}
|
|
3796
|
+
function earlierBoundaryHeads(boundaries, root, mappings, snapshot) {
|
|
3797
|
+
const heads = [];
|
|
3798
|
+
for (const boundary of [...boundaries].reverse()) {
|
|
3799
|
+
if (originalRoot(boundary.root, mappings) !== root)
|
|
3800
|
+
continue;
|
|
3801
|
+
const head = boundary.snapshot.head;
|
|
3802
|
+
if (head !== snapshot.head && !heads.includes(head))
|
|
3803
|
+
heads.push(head);
|
|
3804
|
+
}
|
|
3805
|
+
return heads;
|
|
3806
|
+
}
|
|
3790
3807
|
async function resolveWorkflowSnapshotFrontier(journal, runId, options = {}) {
|
|
3791
3808
|
const mappings = options.mappings ?? [];
|
|
3809
|
+
const boundaries = await listWorkflowSnapshotBoundaries(journal, runId);
|
|
3792
3810
|
const latest = new Map;
|
|
3793
|
-
for (const boundary of
|
|
3811
|
+
for (const boundary of boundaries) {
|
|
3794
3812
|
latest.set(originalRoot(boundary.root, mappings), boundary);
|
|
3795
3813
|
}
|
|
3796
3814
|
const restored = [];
|
|
3815
|
+
const unrestored = [];
|
|
3797
3816
|
const announcements = [];
|
|
3798
3817
|
try {
|
|
3799
3818
|
for (const [root, { snapshot }] of latest) {
|
|
@@ -3804,11 +3823,16 @@ async function resolveWorkflowSnapshotFrontier(journal, runId, options = {}) {
|
|
|
3804
3823
|
await verifyWorktree(snapshot, mapped, { settings: options.settings, signal: options.signal });
|
|
3805
3824
|
continue;
|
|
3806
3825
|
} catch (error) {
|
|
3826
|
+
options.signal?.throwIfAborted();
|
|
3827
|
+
if (isGitUnavailableError(error)) {
|
|
3828
|
+
unrestored.push({ root, here: mapped, snapshot, reason: error });
|
|
3829
|
+
continue;
|
|
3830
|
+
}
|
|
3807
3831
|
if (isWorkspaceDriftError(error) && await isHeadOnlyAdvance(error, options.signal))
|
|
3808
3832
|
continue;
|
|
3809
3833
|
if (isWorkspaceDriftError(error))
|
|
3810
3834
|
drift = error;
|
|
3811
|
-
else if (isWorkspaceSnapshotError(error)) {
|
|
3835
|
+
else if (isWorkspaceSnapshotError(error) || isWorkspaceRestoreError(error)) {
|
|
3812
3836
|
drift = new WorkspaceDriftError({
|
|
3813
3837
|
root: mapped,
|
|
3814
3838
|
expectedHead: snapshot.head,
|
|
@@ -3822,11 +3846,17 @@ async function resolveWorkflowSnapshotFrontier(journal, runId, options = {}) {
|
|
|
3822
3846
|
}
|
|
3823
3847
|
let worktree;
|
|
3824
3848
|
try {
|
|
3825
|
-
|
|
3849
|
+
const best = await restoreBestWorktree(snapshot, {
|
|
3826
3850
|
blobs: journal.snapshotBlobs,
|
|
3827
3851
|
storeDir: options.storeDir,
|
|
3828
|
-
signal: options.signal
|
|
3852
|
+
signal: options.signal,
|
|
3853
|
+
candidates: earlierBoundaryHeads(boundaries, root, mappings, snapshot)
|
|
3829
3854
|
});
|
|
3855
|
+
if (best.status === "unrestored") {
|
|
3856
|
+
unrestored.push({ root, here: mapped, snapshot, reason: best.reason });
|
|
3857
|
+
continue;
|
|
3858
|
+
}
|
|
3859
|
+
worktree = best;
|
|
3830
3860
|
} catch (cause) {
|
|
3831
3861
|
options.signal?.throwIfAborted();
|
|
3832
3862
|
throw new WorkspaceDriftError({
|
|
@@ -3844,7 +3874,8 @@ async function resolveWorkflowSnapshotFrontier(journal, runId, options = {}) {
|
|
|
3844
3874
|
to: worktree.path,
|
|
3845
3875
|
snapshotId: snapshot.id,
|
|
3846
3876
|
tree: snapshot.tree,
|
|
3847
|
-
restoredAt: new Date().toISOString()
|
|
3877
|
+
restoredAt: new Date().toISOString(),
|
|
3878
|
+
...worktree.degraded === undefined ? {} : { degraded: worktree.degraded }
|
|
3848
3879
|
};
|
|
3849
3880
|
restored.push(mapping);
|
|
3850
3881
|
announcements.push({ mapping, warnings: worktree.warnings });
|
|
@@ -3874,8 +3905,52 @@ async function resolveWorkflowSnapshotFrontier(journal, runId, options = {}) {
|
|
|
3874
3905
|
for (const warning of warnings)
|
|
3875
3906
|
options.onWarning?.(warning, mapping);
|
|
3876
3907
|
}
|
|
3908
|
+
for (const checkout of unrestored)
|
|
3909
|
+
options.onUnrestored?.(checkout);
|
|
3877
3910
|
return restored;
|
|
3878
3911
|
}
|
|
3912
|
+
function within(root, path) {
|
|
3913
|
+
const suffix = relative(root, path);
|
|
3914
|
+
return suffix !== ".." && !suffix.startsWith(`..${sep}`) && !isAbsolute2(suffix);
|
|
3915
|
+
}
|
|
3916
|
+
function runWorktreeRestoreOutcomes(input) {
|
|
3917
|
+
const list = [];
|
|
3918
|
+
for (const mapping of input.restored) {
|
|
3919
|
+
if (mapping.degraded === undefined)
|
|
3920
|
+
continue;
|
|
3921
|
+
list.push({
|
|
3922
|
+
root: mapping.from,
|
|
3923
|
+
snapshotId: mapping.snapshotId,
|
|
3924
|
+
message: formatDegradedRestoreNotice(mapping, input.snapshots.get(mapping.snapshotId), [], "workflow run"),
|
|
3925
|
+
at: mapping.restoredAt,
|
|
3926
|
+
degraded: mapping.degraded
|
|
3927
|
+
});
|
|
3928
|
+
}
|
|
3929
|
+
const { continuing, launchCwd } = input;
|
|
3930
|
+
const leftHere = continuing !== undefined && input.unrestored.some((checkout) => within(canonicalizeWorktreePath(checkout.here), canonicalizeWorktreePath(continuing)));
|
|
3931
|
+
const launch = leftHere && launchCwd !== undefined && !existsSync2(continuing);
|
|
3932
|
+
const continuedIn = launch ? resolve(launchCwd) : undefined;
|
|
3933
|
+
for (const checkout of input.unrestored) {
|
|
3934
|
+
const record = unrestoredRecord(checkout.snapshot, checkout.reason, continuedIn ?? continuing ?? checkout.here, launch ? "launch" : "recorded");
|
|
3935
|
+
list.push({
|
|
3936
|
+
root: checkout.root,
|
|
3937
|
+
snapshotId: checkout.snapshot.id,
|
|
3938
|
+
message: formatUnrestoredNotice(checkout.root, record, "workflow run"),
|
|
3939
|
+
at: record.at,
|
|
3940
|
+
unrestored: record
|
|
3941
|
+
});
|
|
3942
|
+
}
|
|
3943
|
+
const fresh = [...list];
|
|
3944
|
+
const touched = new Set(list.map((outcome) => outcome.root));
|
|
3945
|
+
for (const outcome of input.previous) {
|
|
3946
|
+
if (outcome.degraded === undefined || touched.has(outcome.root))
|
|
3947
|
+
continue;
|
|
3948
|
+
const current = input.mappings.findLast((mapping) => mapping.from === outcome.root);
|
|
3949
|
+
if (current?.degraded !== undefined && current.snapshotId === outcome.snapshotId)
|
|
3950
|
+
list.push(outcome);
|
|
3951
|
+
}
|
|
3952
|
+
return continuedIn === undefined ? { list, fresh } : { list, fresh, continuedIn };
|
|
3953
|
+
}
|
|
3879
3954
|
var init_worktree_snapshots = __esm(() => {
|
|
3880
3955
|
init_types();
|
|
3881
3956
|
});
|
|
@@ -12299,6 +12374,7 @@ class JournalProjection {
|
|
|
12299
12374
|
...handle.repositoryRoot !== undefined ? { repositoryRoot: handle.repositoryRoot } : existing?.handle.repositoryRoot !== undefined ? { repositoryRoot: existing.handle.repositoryRoot } : {},
|
|
12300
12375
|
...handle.gitWorktreeRoot !== undefined ? { gitWorktreeRoot: handle.gitWorktreeRoot } : existing?.handle.gitWorktreeRoot !== undefined ? { gitWorktreeRoot: existing.handle.gitWorktreeRoot } : {},
|
|
12301
12376
|
...(handle.worktreeRootMappings ?? existing?.handle.worktreeRootMappings) !== undefined ? { worktreeRootMappings: handle.worktreeRootMappings ?? existing?.handle.worktreeRootMappings } : {},
|
|
12377
|
+
...(handle.worktreeRestoreOutcomes ?? existing?.handle.worktreeRestoreOutcomes) !== undefined ? { worktreeRestoreOutcomes: handle.worktreeRestoreOutcomes ?? existing?.handle.worktreeRestoreOutcomes } : {},
|
|
12302
12378
|
pendingStageMessages: handle.pendingStageMessages ?? existing?.handle.pendingStageMessages ?? [],
|
|
12303
12379
|
...handle.possibleStages !== undefined ? { possibleStages: handle.possibleStages } : existing?.handle.possibleStages !== undefined ? { possibleStages: existing.handle.possibleStages } : {},
|
|
12304
12380
|
...forkedFrom !== undefined ? { forkedFrom } : {},
|
|
@@ -12597,6 +12673,7 @@ class JournalProjection {
|
|
|
12597
12673
|
...h.gitWorktreeRoot !== undefined ? { gitWorktreeRoot: h.gitWorktreeRoot } : {},
|
|
12598
12674
|
...h.snapshots !== undefined ? { snapshots: h.snapshots } : {},
|
|
12599
12675
|
...h.worktreeRootMappings !== undefined ? { worktreeRootMappings: h.worktreeRootMappings } : {},
|
|
12676
|
+
...h.worktreeRestoreOutcomes !== undefined ? { worktreeRestoreOutcomes: h.worktreeRestoreOutcomes } : {},
|
|
12600
12677
|
...h.forkedFrom !== undefined ? { forkedFrom: h.forkedFrom } : {},
|
|
12601
12678
|
...h.workspace !== undefined ? { workspace: h.workspace } : {},
|
|
12602
12679
|
...h.snapshot !== undefined ? { snapshot: h.snapshot } : {},
|
|
@@ -13180,7 +13257,7 @@ var init_child_invocation = __esm(() => {
|
|
|
13180
13257
|
});
|
|
13181
13258
|
|
|
13182
13259
|
// dist/builtin/workflows/src/engine/run-resume-preflight.ts
|
|
13183
|
-
import { existsSync as
|
|
13260
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
13184
13261
|
import { isAbsolute as isAbsolute3 } from "node:path";
|
|
13185
13262
|
import { JsonlSessionStore, resolveSessionStore } from "@bastani/atomic";
|
|
13186
13263
|
function describeStore(store, selectedBy) {
|
|
@@ -13216,7 +13293,7 @@ async function assertWaitingStageSessionsExist(waiting, runId, storage, rootRunI
|
|
|
13216
13293
|
checked.add(stage.sessionId);
|
|
13217
13294
|
if (await opened.store.readHeader(stage.sessionId) !== undefined)
|
|
13218
13295
|
continue;
|
|
13219
|
-
if (stage.sessionFile !== undefined && isAbsolute3(stage.sessionFile) &&
|
|
13296
|
+
if (stage.sessionFile !== undefined && isAbsolute3(stage.sessionFile) && existsSync3(stage.sessionFile))
|
|
13220
13297
|
continue;
|
|
13221
13298
|
missing.push(stage.sessionId);
|
|
13222
13299
|
}
|
|
@@ -13248,7 +13325,7 @@ var init_run_resume_preflight = __esm(() => {
|
|
|
13248
13325
|
|
|
13249
13326
|
// dist/builtin/workflows/src/shared/stage-session-store.ts
|
|
13250
13327
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
13251
|
-
import { dirname as dirname3, resolve } from "node:path";
|
|
13328
|
+
import { dirname as dirname3, resolve as resolve2 } from "node:path";
|
|
13252
13329
|
import {
|
|
13253
13330
|
assertSessionBlobStore,
|
|
13254
13331
|
copySessionBlobs,
|
|
@@ -13291,11 +13368,11 @@ async function forkStageSession(store, sessionId, cwd, options, destination = st
|
|
|
13291
13368
|
async function migrateLegacyStageSession(store, sessionId, sessionFile) {
|
|
13292
13369
|
if (sessionFile === undefined || await store.readHeader(sessionId) !== undefined)
|
|
13293
13370
|
return;
|
|
13294
|
-
const location =
|
|
13371
|
+
const location = resolve2(sessionFile);
|
|
13295
13372
|
const legacy = await JsonlSessionStore2.open(dirname3(location), { exactDirectory: true, scanExisting: false });
|
|
13296
13373
|
try {
|
|
13297
13374
|
for await (const file of legacy.scanFiles()) {
|
|
13298
|
-
if (
|
|
13375
|
+
if (resolve2(file.location) !== location || file.header.id !== sessionId)
|
|
13299
13376
|
continue;
|
|
13300
13377
|
const snapshot = await file.read();
|
|
13301
13378
|
if (await store.readHeader(sessionId) === undefined)
|
|
@@ -16997,24 +17074,11 @@ var init_factory = __esm(() => {
|
|
|
16997
17074
|
});
|
|
16998
17075
|
|
|
16999
17076
|
// dist/builtin/workflows/src/durable/run-restore-preconditions.ts
|
|
17000
|
-
|
|
17001
|
-
runRestorePreconditionError,
|
|
17002
|
-
worktreeNeedsRestore
|
|
17003
|
-
} from "@bastani/atomic";
|
|
17004
|
-
async function runRestorePreconditionFailure(journal, runId, mappings, settings, signal) {
|
|
17005
|
-
const restoring = [];
|
|
17006
|
-
for (const boundary of workflowSnapshotFrontier(await listWorkflowSnapshotBoundaries(journal, runId))) {
|
|
17007
|
-
const here = mapWorkflowWorktreePath(boundary.root, mappings);
|
|
17008
|
-
if (await worktreeNeedsRestore(boundary.snapshot, here, { settings, signal })) {
|
|
17009
|
-
restoring.push({ root: boundary.root, remotes: boundary.snapshot.remotes });
|
|
17010
|
-
}
|
|
17011
|
-
}
|
|
17012
|
-
return await runRestorePreconditionError(runId, restoring);
|
|
17013
|
-
}
|
|
17014
|
-
var restorePreconditionsChecked;
|
|
17077
|
+
var restorePreconditionsChecked, resumeLaunchCwd, recordedInvocationCwd;
|
|
17015
17078
|
var init_run_restore_preconditions = __esm(() => {
|
|
17016
|
-
init_worktree_snapshots();
|
|
17017
17079
|
restorePreconditionsChecked = Symbol("restore-preconditions-checked");
|
|
17080
|
+
resumeLaunchCwd = Symbol("resume-launch-cwd");
|
|
17081
|
+
recordedInvocationCwd = Symbol("recorded-invocation-cwd");
|
|
17018
17082
|
});
|
|
17019
17083
|
|
|
17020
17084
|
// dist/builtin/workflows/src/durable/run-result.ts
|
|
@@ -17204,11 +17268,11 @@ async function transitionDurableWorkflowStatus(backend, workflowId, expectedStat
|
|
|
17204
17268
|
}
|
|
17205
17269
|
|
|
17206
17270
|
// dist/builtin/workflows/src/durable/worktree-snapshot-recorder.ts
|
|
17207
|
-
import { isAbsolute as isAbsolute4, relative as relative2, resolve as
|
|
17271
|
+
import { isAbsolute as isAbsolute4, relative as relative2, resolve as resolve3, sep as sep2 } from "node:path";
|
|
17208
17272
|
import {
|
|
17209
17273
|
canonicalizeWorktreePath as canonicalizeWorktreePath2,
|
|
17210
17274
|
captureWorktreeSnapshot,
|
|
17211
|
-
isGitUnavailableError,
|
|
17275
|
+
isGitUnavailableError as isGitUnavailableError2,
|
|
17212
17276
|
isWorkspaceGitError,
|
|
17213
17277
|
serializeWorkspaceError,
|
|
17214
17278
|
WorkspaceSnapshotError
|
|
@@ -17256,7 +17320,7 @@ function containsDirectory(root, directory) {
|
|
|
17256
17320
|
function createWorkflowSnapshotRecorder(input) {
|
|
17257
17321
|
let gitUnavailable = false;
|
|
17258
17322
|
const report = (error) => {
|
|
17259
|
-
if (
|
|
17323
|
+
if (isGitUnavailableError2(error))
|
|
17260
17324
|
gitUnavailable = true;
|
|
17261
17325
|
input.run.snapshotUnavailable ??= serializeWorkspaceError(error);
|
|
17262
17326
|
};
|
|
@@ -17273,8 +17337,8 @@ function createWorkflowSnapshotRecorder(input) {
|
|
|
17273
17337
|
signal?.throwIfAborted();
|
|
17274
17338
|
const latest = await snapshotAncestry(journal, input.rootRunId);
|
|
17275
17339
|
const snapshots = [];
|
|
17276
|
-
const workflowCwd =
|
|
17277
|
-
for (const directory of new Set([workflowCwd, ...directories.map((path) =>
|
|
17340
|
+
const workflowCwd = resolve3(input.cwd());
|
|
17341
|
+
for (const directory of new Set([workflowCwd, ...directories.map((path) => resolve3(workflowCwd, path))])) {
|
|
17278
17342
|
try {
|
|
17279
17343
|
const physical = canonicalizeWorktreePath2(directory);
|
|
17280
17344
|
const previous = [...latest.values()].filter((snapshot) => containsDirectory(snapshot.root, physical)).sort((a, b) => b.root.length - a.root.length)[0];
|
|
@@ -17721,7 +17785,7 @@ import {
|
|
|
17721
17785
|
createChildProcessEnvironment,
|
|
17722
17786
|
createGitEnvironment,
|
|
17723
17787
|
isGitProvisionError as isGitProvisionError2,
|
|
17724
|
-
isGitUnavailableError as
|
|
17788
|
+
isGitUnavailableError as isGitUnavailableError3,
|
|
17725
17789
|
isRetryableGitProvisionError,
|
|
17726
17790
|
resolveGit,
|
|
17727
17791
|
resolveGitSync
|
|
@@ -17774,7 +17838,7 @@ async function prepareTaskGit(signal) {
|
|
|
17774
17838
|
resolveGitSync();
|
|
17775
17839
|
return;
|
|
17776
17840
|
} catch (error) {
|
|
17777
|
-
const notInstalled =
|
|
17841
|
+
const notInstalled = isGitUnavailableError3(error) && error.code === "not-installed";
|
|
17778
17842
|
if (!isGitProvisionError2(error) || !(notInstalled || isRetryableGitProvisionError(error)))
|
|
17779
17843
|
return;
|
|
17780
17844
|
}
|
|
@@ -19078,7 +19142,7 @@ var init_worktree = __esm(() => {
|
|
|
19078
19142
|
|
|
19079
19143
|
// dist/builtin/workflows/src/runs/shared/worktree-cwd.ts
|
|
19080
19144
|
import { lstatSync as lstatSync6, realpathSync as realpathSync4 } from "node:fs";
|
|
19081
|
-
import { dirname as dirname10, isAbsolute as isAbsolute9, relative as relative6, resolve as
|
|
19145
|
+
import { dirname as dirname10, isAbsolute as isAbsolute9, relative as relative6, resolve as resolve10, sep as sep7 } from "node:path";
|
|
19082
19146
|
function relativePathWithin(root, candidate) {
|
|
19083
19147
|
const path = relative6(root, candidate);
|
|
19084
19148
|
return path === ".." || path.startsWith(`..${sep7}`) || isAbsolute9(path) ? undefined : path;
|
|
@@ -19097,14 +19161,14 @@ function resolveWorktreeStageCwd(cwd, setup) {
|
|
|
19097
19161
|
if (cwd === undefined || cwd.length === 0)
|
|
19098
19162
|
return;
|
|
19099
19163
|
const absoluteInput = isAbsolute9(cwd);
|
|
19100
|
-
const candidate = absoluteInput ? cwd :
|
|
19164
|
+
const candidate = absoluteInput ? cwd : resolve10(setup.cwd, cwd);
|
|
19101
19165
|
if (!absoluteInput && relativePathWithin(setup.worktreeRoot, candidate) === undefined) {
|
|
19102
19166
|
throw new Error(`atomic-workflows: relative cwd ${cwd} escapes gitWorktreeDir ${setup.worktreeRoot}; choose a cwd inside the worktree.`);
|
|
19103
19167
|
}
|
|
19104
19168
|
const candidateRealPath = existingRealPath(candidate, "cwd");
|
|
19105
19169
|
const worktreeRelative = relativePathWithin(worktreeRoot, candidateRealPath);
|
|
19106
19170
|
if (worktreeRelative !== undefined)
|
|
19107
|
-
return
|
|
19171
|
+
return resolve10(setup.worktreeRoot, worktreeRelative);
|
|
19108
19172
|
if (!isAbsolute9(cwd)) {
|
|
19109
19173
|
throw new Error(`atomic-workflows: relative cwd ${cwd} escapes gitWorktreeDir ${setup.worktreeRoot}; choose a path that remains inside the selected worktree.`);
|
|
19110
19174
|
}
|
|
@@ -19115,7 +19179,7 @@ function resolveWorktreeStageCwd(cwd, setup) {
|
|
|
19115
19179
|
if (repositoryRelative === undefined) {
|
|
19116
19180
|
throw new Error(repositoryRoot === worktreeRoot ? `atomic-workflows: cwd ${cwd} is outside gitWorktreeDir ${setup.worktreeRoot}, which belongs to a different repository than the invoking cwd; choose a cwd inside the worktree, or omit cwd.` : `atomic-workflows: cwd ${cwd} is outside gitWorktreeDir ${setup.worktreeRoot}; use a cwd inside the invoking repository so Atomic can remap it, or omit cwd.`);
|
|
19117
19181
|
}
|
|
19118
|
-
const mappedCwd =
|
|
19182
|
+
const mappedCwd = resolve10(setup.worktreeRoot, repositoryRelative);
|
|
19119
19183
|
const mappedRealPath = existingRealPath(mappedCwd, "remapped worktree cwd");
|
|
19120
19184
|
if (relativePathWithin(worktreeRoot, mappedRealPath) === undefined) {
|
|
19121
19185
|
throw new Error(`atomic-workflows: cwd ${cwd} remaps through a path that resolves outside gitWorktreeDir ${setup.worktreeRoot}; remove the escaping symlink or omit cwd.`);
|
|
@@ -19125,8 +19189,8 @@ function resolveWorktreeStageCwd(cwd, setup) {
|
|
|
19125
19189
|
var init_worktree_cwd = () => {};
|
|
19126
19190
|
|
|
19127
19191
|
// dist/builtin/workflows/src/runs/foreground/executor-task-prompts.ts
|
|
19128
|
-
import { existsSync as
|
|
19129
|
-
import { isAbsolute as isAbsolute10, resolve as
|
|
19192
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
19193
|
+
import { isAbsolute as isAbsolute10, resolve as resolve11 } from "node:path";
|
|
19130
19194
|
function normalizeTaskContexts(previous) {
|
|
19131
19195
|
if (previous === undefined)
|
|
19132
19196
|
return [];
|
|
@@ -19179,7 +19243,7 @@ function taskPrevious(options) {
|
|
|
19179
19243
|
function resolveWorkflowPath(filePath, baseDir) {
|
|
19180
19244
|
if (isAbsolute10(filePath))
|
|
19181
19245
|
return filePath;
|
|
19182
|
-
return
|
|
19246
|
+
return resolve11(baseDir ?? process.cwd(), filePath);
|
|
19183
19247
|
}
|
|
19184
19248
|
function taskBaseDir(options) {
|
|
19185
19249
|
if (typeof options.chainDir === "string" && options.chainDir.trim().length > 0) {
|
|
@@ -19195,7 +19259,7 @@ function taskReadInstruction(options, requireFiles) {
|
|
|
19195
19259
|
return "";
|
|
19196
19260
|
const baseDir = taskBaseDir(options);
|
|
19197
19261
|
const files = options.reads.map((file) => resolveWorkflowPath(file, baseDir));
|
|
19198
|
-
const missing = requireFiles ? files.find((file) => !
|
|
19262
|
+
const missing = requireFiles ? files.find((file) => !existsSync6(file)) : undefined;
|
|
19199
19263
|
if (missing !== undefined) {
|
|
19200
19264
|
throw new Error(`atomic-workflows: referenced artifact does not exist: ${missing}`);
|
|
19201
19265
|
}
|
|
@@ -19334,7 +19398,7 @@ function taskWithSharedDefaults(taskOptions, options) {
|
|
|
19334
19398
|
var init_executor_task_prompts = () => {};
|
|
19335
19399
|
|
|
19336
19400
|
// dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts
|
|
19337
|
-
import { isAbsolute as isAbsolute11, join as join13, resolve as
|
|
19401
|
+
import { isAbsolute as isAbsolute11, join as join13, resolve as resolve12 } from "node:path";
|
|
19338
19402
|
import { CONFIG_DIR_NAME, inheritWorkspace, WorkspaceBindingError as WorkspaceBindingError2 } from "@bastani/atomic";
|
|
19339
19403
|
function positiveConcurrency(value2) {
|
|
19340
19404
|
if (typeof value2 !== "number" || !Number.isFinite(value2) || value2 < 1)
|
|
@@ -19501,7 +19565,7 @@ function workflowInvocationMetadata(inputDefaults, workflowInvocationCwd, cache,
|
|
|
19501
19565
|
function resolvedTaskCwd(cwd, workflowInvocationCwd) {
|
|
19502
19566
|
if (cwd === undefined)
|
|
19503
19567
|
return;
|
|
19504
|
-
return isAbsolute11(cwd) ? cwd :
|
|
19568
|
+
return isAbsolute11(cwd) ? cwd : resolve12(workflowInvocationCwd, cwd);
|
|
19505
19569
|
}
|
|
19506
19570
|
function taskWorktreeOutputsRoot(runId) {
|
|
19507
19571
|
return join13(workflowArtifactRunPath(runId), "task-outputs");
|
|
@@ -19514,7 +19578,7 @@ function prepareTaskWorktrees(tasks, options, runId, scope, workflowInvocationCw
|
|
|
19514
19578
|
throw new Error("atomic-workflows: worktree and gitWorktreeDir are mutually exclusive; use gitWorktreeDir for a reusable worktree or worktree:true for temporary isolated worktrees.");
|
|
19515
19579
|
}
|
|
19516
19580
|
const explicitCwd = tasks.find((task) => typeof task.cwd === "string")?.cwd;
|
|
19517
|
-
const sharedCwd = explicitCwd === undefined ? workflowInvocationCwd : isAbsolute11(explicitCwd) ? explicitCwd :
|
|
19581
|
+
const sharedCwd = explicitCwd === undefined ? workflowInvocationCwd : isAbsolute11(explicitCwd) ? explicitCwd : resolve12(workflowInvocationCwd, explicitCwd);
|
|
19518
19582
|
const conflict = findWorktreeTaskCwdConflict(tasks.map((task) => ({ agent: task.name, cwd: resolvedTaskCwd(task.cwd, workflowInvocationCwd) })), sharedCwd);
|
|
19519
19583
|
if (conflict !== undefined)
|
|
19520
19584
|
throw new Error(formatWorktreeTaskCwdConflict(conflict, sharedCwd));
|
|
@@ -24124,13 +24188,13 @@ function raceAbort2(operation, signal) {
|
|
|
24124
24188
|
|
|
24125
24189
|
// dist/builtin/workflows/src/shared/possible-stages.ts
|
|
24126
24190
|
import { createHash as createHash3 } from "node:crypto";
|
|
24127
|
-
import { existsSync as
|
|
24128
|
-
import { dirname as dirname11, join as join14, relative as relative7, resolve as
|
|
24191
|
+
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
|
|
24192
|
+
import { dirname as dirname11, join as join14, relative as relative7, resolve as resolve13, sep as sep8 } from "node:path";
|
|
24129
24193
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
24130
24194
|
function scanPossibleStagesFromSource(entrySourcePath, options = {}) {
|
|
24131
24195
|
const maxDepth = options.maxDepth ?? DEFAULT_MAX_DEPTH;
|
|
24132
|
-
const scanner = new PossibleStagesScanner(maxDepth,
|
|
24133
|
-
const entryPath =
|
|
24196
|
+
const scanner = new PossibleStagesScanner(maxDepth, resolve13(entrySourcePath));
|
|
24197
|
+
const entryPath = resolve13(entrySourcePath);
|
|
24134
24198
|
scanner.scanSubtree(entryPath, "", 0, [entryPath]);
|
|
24135
24199
|
scanner.noteZeroStages(entryPath);
|
|
24136
24200
|
return {
|
|
@@ -26208,7 +26272,7 @@ function resolveRelativeSpecifier(specifier, importingFile) {
|
|
|
26208
26272
|
return candidates.find((candidate) => isFileSync(candidate));
|
|
26209
26273
|
}
|
|
26210
26274
|
function isFileSync(path) {
|
|
26211
|
-
if (!
|
|
26275
|
+
if (!existsSync7(path))
|
|
26212
26276
|
return false;
|
|
26213
26277
|
try {
|
|
26214
26278
|
readFileSync4(path, { flag: "r" });
|
|
@@ -26388,8 +26452,8 @@ var init_run_eviction = __esm(() => {
|
|
|
26388
26452
|
|
|
26389
26453
|
// dist/builtin/workflows/src/workers/pool-journal.ts
|
|
26390
26454
|
import { createHash as createHash4, randomUUID as randomUUID7 } from "node:crypto";
|
|
26391
|
-
import { existsSync as
|
|
26392
|
-
import { basename as basename5, dirname as dirname12, join as join15, resolve as
|
|
26455
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
|
|
26456
|
+
import { basename as basename5, dirname as dirname12, join as join15, resolve as resolve14 } from "node:path";
|
|
26393
26457
|
import { createChildProcessEnvironment as createChildProcessEnvironment3 } from "@bastani/atomic";
|
|
26394
26458
|
import { storageSelectionKey as storageSelectionKey2 } from "@bastani/atomic/storage";
|
|
26395
26459
|
function poolWorkerEnvironment(durable) {
|
|
@@ -26417,7 +26481,7 @@ function isReopenableSelection(selection) {
|
|
|
26417
26481
|
}
|
|
26418
26482
|
function encodeSelection(selection) {
|
|
26419
26483
|
if (selection.kind === "sqlite")
|
|
26420
|
-
return JSON.stringify({ ...selection, path:
|
|
26484
|
+
return JSON.stringify({ ...selection, path: resolve14(selection.path) });
|
|
26421
26485
|
return JSON.stringify({
|
|
26422
26486
|
...selection,
|
|
26423
26487
|
...selection.options === undefined ? {} : {
|
|
@@ -26463,7 +26527,7 @@ function coordinationDatabase(durable) {
|
|
|
26463
26527
|
return basename5(coordinationPath(durable), ".sqlite");
|
|
26464
26528
|
}
|
|
26465
26529
|
function openCoordinationJournal(path) {
|
|
26466
|
-
const file =
|
|
26530
|
+
const file = resolve14(path);
|
|
26467
26531
|
let opened = coordinationJournals.get(file);
|
|
26468
26532
|
if (opened === undefined) {
|
|
26469
26533
|
mkdirSync6(dirname12(file), { recursive: true });
|
|
@@ -26515,7 +26579,7 @@ async function poolJournalOf(journal) {
|
|
|
26515
26579
|
if (origin === undefined || !isReopenableSelection(origin.selection))
|
|
26516
26580
|
return journal;
|
|
26517
26581
|
const path = coordinationPath(poolDurableJournal(journal));
|
|
26518
|
-
if (!
|
|
26582
|
+
if (!existsSync8(path))
|
|
26519
26583
|
return journal;
|
|
26520
26584
|
const coordination = await openCoordinationJournal(path);
|
|
26521
26585
|
registerPoolJournal(journal, coordination);
|
|
@@ -67815,7 +67879,7 @@ var init_loop_until_done = __esm(() => {
|
|
|
67815
67879
|
});
|
|
67816
67880
|
|
|
67817
67881
|
// dist/builtin/workflows/builtin/open-claude-design-images.ts
|
|
67818
|
-
import { existsSync as
|
|
67882
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
67819
67883
|
import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile8 } from "node:fs/promises";
|
|
67820
67884
|
import { dirname as dirname14, join as join25 } from "node:path";
|
|
67821
67885
|
import { AuthStorage } from "@bastani/atomic";
|
|
@@ -68014,7 +68078,7 @@ async function runReferenceImagesStep(tool, request, deps = {}) {
|
|
|
68014
68078
|
return outcome.ok ? outcome.value : { status: "failed", reason: "tool-failed", paths: [] };
|
|
68015
68079
|
}
|
|
68016
68080
|
function existingReferenceImagePaths(status) {
|
|
68017
|
-
return status.status === "generated" ? status.paths.filter((path) =>
|
|
68081
|
+
return status.status === "generated" ? status.paths.filter((path) => existsSync9(path)) : [];
|
|
68018
68082
|
}
|
|
68019
68083
|
var referenceImagesStatusSchema, REFERENCE_IMAGES_DIRNAME = "references", REFERENCE_IMAGES_TOOL_TIMEOUT_MS, IMAGE_REQUEST_TIMEOUT_MS, IMAGE_REQUEST_MAX_RETRIES = 1, IMAGE_SIZE = "1536x1024", PRODUCT_EXCERPT_CHARS = 1000, DESIGN_EXCERPT_CHARS = 1500, REFERENCES_EXCERPT_CHARS = 1500, REFERENCE_IMAGE_DIRECTIONS, SURFACE_BY_OUTPUT_TYPE, GPT_IMAGE_ID, PREFERRED_VARIANTS, LOWER_TIER_VARIANTS, PREFERRED_FALLBACK_PROVIDER = "openrouter", IMAGE_EXTENSIONS;
|
|
68020
68084
|
var init_open_claude_design_images = __esm(() => {
|
|
@@ -69681,8 +69745,8 @@ var init_ralph_models = __esm(() => {
|
|
|
69681
69745
|
});
|
|
69682
69746
|
|
|
69683
69747
|
// dist/builtin/workflows/builtin/ralph-runner.ts
|
|
69684
|
-
import { existsSync as
|
|
69685
|
-
import { join as join29, resolve as
|
|
69748
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
69749
|
+
import { join as join29, resolve as resolve15 } from "node:path";
|
|
69686
69750
|
async function runRalphWorkflow(ctx, options) {
|
|
69687
69751
|
const { prompt, acceptanceCriteria, maxLoops, comparisonBaseBranch, workflowStartCwd, createPr, runId } = options;
|
|
69688
69752
|
let latestReviewReportPath;
|
|
@@ -69694,7 +69758,7 @@ async function runRalphWorkflow(ctx, options) {
|
|
|
69694
69758
|
let finalPrReport;
|
|
69695
69759
|
const workflowCwdContext = workflowCwdContextSection(workflowStartCwd);
|
|
69696
69760
|
const workflowPrompt = prompt;
|
|
69697
|
-
const workflowResearchPath =
|
|
69761
|
+
const workflowResearchPath = resolve15(workflowStartCwd, defaultResearchPath(workflowPrompt));
|
|
69698
69762
|
const implementationNotesPath = await createImplementationNotesFile(workflowPrompt, runId);
|
|
69699
69763
|
const qaVideoPath = await createQaEvidenceVideoPath(runId);
|
|
69700
69764
|
const artifactDir = await createWorkflowArtifactDirectory(runId);
|
|
@@ -69945,7 +70009,7 @@ Read it before implementation or delegation because it is the primary current im
|
|
|
69945
70009
|
if (approved)
|
|
69946
70010
|
break;
|
|
69947
70011
|
}
|
|
69948
|
-
const qaVideoAvailable =
|
|
70012
|
+
const qaVideoAvailable = existsSync10(qaVideoPath);
|
|
69949
70013
|
const unapprovedHandoff = createPr === true && !approved;
|
|
69950
70014
|
const escalationEvidence = unapprovedHandoff ? convergence_escalation_evidence(convergenceEntries) : [];
|
|
69951
70015
|
if (createPr === true) {
|
|
@@ -70304,7 +70368,7 @@ var init_tournament_prompts = __esm(() => {
|
|
|
70304
70368
|
|
|
70305
70369
|
// dist/builtin/workflows/builtin/tournament-runner.ts
|
|
70306
70370
|
import { mkdir as mkdir6, readFile as readFile6, writeFile as writeFile10 } from "node:fs/promises";
|
|
70307
|
-
import { join as join30, isAbsolute as isAbsolute12, relative as relative9, resolve as
|
|
70371
|
+
import { join as join30, isAbsolute as isAbsolute12, relative as relative9, resolve as resolve16 } from "node:path";
|
|
70308
70372
|
import { Type as Type23 } from "typebox";
|
|
70309
70373
|
function serializableObject2(value2) {
|
|
70310
70374
|
if (value2 === null || Array.isArray(value2) || typeof value2 !== "object")
|
|
@@ -70341,8 +70405,8 @@ function criterionSlug(id) {
|
|
|
70341
70405
|
}
|
|
70342
70406
|
function judgeArtifactPath(judgesDir, job, criterionIndex) {
|
|
70343
70407
|
const filename = `judge-${job.a}-${job.b}-c${criterionIndex}-${criterionSlug(job.criterionId)}-r${job.rep}.json`;
|
|
70344
|
-
const root =
|
|
70345
|
-
const path =
|
|
70408
|
+
const root = resolve16(judgesDir);
|
|
70409
|
+
const path = resolve16(judgesDir, filename);
|
|
70346
70410
|
const fromRoot = relative9(root, path);
|
|
70347
70411
|
if (fromRoot.startsWith("..") || isAbsolute12(fromRoot)) {
|
|
70348
70412
|
throw new Error(`tournament: judge artifact escaped its directory: ${path}`);
|
|
@@ -75039,7 +75103,7 @@ var init_client = __esm(() => {
|
|
|
75039
75103
|
throw new Error(`Unknown broker message type: ${brokerMessage.type}`);
|
|
75040
75104
|
}
|
|
75041
75105
|
}
|
|
75042
|
-
async disconnect() {
|
|
75106
|
+
async disconnect(options = {}) {
|
|
75043
75107
|
if (this.connectAttempt !== undefined && this._sessionId === null) {
|
|
75044
75108
|
this.connectAttempt.abort();
|
|
75045
75109
|
return;
|
|
@@ -75073,7 +75137,7 @@ var init_client = __esm(() => {
|
|
|
75073
75137
|
socket.once("close", onClose);
|
|
75074
75138
|
socket.once("error", onError);
|
|
75075
75139
|
try {
|
|
75076
|
-
writeMessage(socket, { type: "unregister" });
|
|
75140
|
+
writeMessage(socket, { type: "unregister", ...options.resumable === true ? { resumable: true } : {} });
|
|
75077
75141
|
socket.end();
|
|
75078
75142
|
} catch {
|
|
75079
75143
|
socket.destroy();
|
|
@@ -75333,7 +75397,7 @@ var init_client = __esm(() => {
|
|
|
75333
75397
|
}
|
|
75334
75398
|
return this.restoringRecipientRequest({ type: "acknowledge_released_child_wake", childName });
|
|
75335
75399
|
}
|
|
75336
|
-
acknowledgeReleasedChildReply(reply, accepted) {
|
|
75400
|
+
acknowledgeReleasedChildReply(reply, accepted, deliverToChild = false) {
|
|
75337
75401
|
if (!this.socket || this.socket.destroyed)
|
|
75338
75402
|
return false;
|
|
75339
75403
|
this.requireBrokerProtocol("released_child_reply_ack");
|
|
@@ -75341,7 +75405,8 @@ var init_client = __esm(() => {
|
|
|
75341
75405
|
type: "released_child_reply_ack",
|
|
75342
75406
|
messageId: reply.message.id,
|
|
75343
75407
|
handoffId: reply.handoffId,
|
|
75344
|
-
accepted
|
|
75408
|
+
accepted,
|
|
75409
|
+
...deliverToChild ? { deliverToChild: true } : {}
|
|
75345
75410
|
});
|
|
75346
75411
|
return true;
|
|
75347
75412
|
}
|
|
@@ -75782,7 +75847,7 @@ var init_shared_storage_setting = __esm(() => {
|
|
|
75782
75847
|
// dist/builtin/intercom/broker/spawn.ts
|
|
75783
75848
|
import { spawn } from "child_process";
|
|
75784
75849
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
75785
|
-
import { appendFileSync, chmodSync, closeSync as closeSync3, existsSync as
|
|
75850
|
+
import { appendFileSync, chmodSync, closeSync as closeSync3, existsSync as existsSync11, mkdirSync as mkdirSync9, openSync as openSync3, readFileSync as readFileSync8, readSync as readSync2, renameSync, statSync as statSync5, unlinkSync as unlinkSync4, writeFileSync as writeFileSync7 } from "fs";
|
|
75786
75851
|
import { join as join32, dirname as dirname17 } from "path";
|
|
75787
75852
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
75788
75853
|
import { createRequire as createRequire3 } from "module";
|
|
@@ -75794,7 +75859,7 @@ import {
|
|
|
75794
75859
|
processSharedStorageSelection
|
|
75795
75860
|
} from "@bastani/atomic";
|
|
75796
75861
|
function isIntercomPackageRoot(dir) {
|
|
75797
|
-
return
|
|
75862
|
+
return existsSync11(join32(dir, "package.json")) && existsSync11(join32(dir, "broker"));
|
|
75798
75863
|
}
|
|
75799
75864
|
function resolveIntercomPackageRoot(moduleHref) {
|
|
75800
75865
|
const here = dirname17(fileURLToPath5(moduleHref));
|
|
@@ -75804,7 +75869,7 @@ function resolveIntercomPackageRoot(moduleHref) {
|
|
|
75804
75869
|
}
|
|
75805
75870
|
function resolveBrokerEntrypoint(packageRoot) {
|
|
75806
75871
|
const bundled = join32(packageRoot, "broker", "broker.bundle.mjs");
|
|
75807
|
-
return
|
|
75872
|
+
return existsSync11(bundled) ? bundled : join32(packageRoot, "broker", "broker.ts");
|
|
75808
75873
|
}
|
|
75809
75874
|
function ensurePrivateDirectory(path) {
|
|
75810
75875
|
mkdirSync9(path, { recursive: true, mode: 448 });
|
|
@@ -76108,7 +76173,7 @@ async function isBrokerRunning() {
|
|
|
76108
76173
|
if (await checkSocketConnectable()) {
|
|
76109
76174
|
return true;
|
|
76110
76175
|
}
|
|
76111
|
-
if (!
|
|
76176
|
+
if (!existsSync11(getBrokerPidPath()))
|
|
76112
76177
|
return false;
|
|
76113
76178
|
try {
|
|
76114
76179
|
const pid = parseInt(readFileSync8(getBrokerPidPath(), "utf-8").trim(), 10);
|
|
@@ -76174,7 +76239,7 @@ function isProcessAlive(pid) {
|
|
|
76174
76239
|
}
|
|
76175
76240
|
}
|
|
76176
76241
|
function isSpawnLockStale(lockPath = getBrokerSpawnLockPath(), nowMs = Date.now()) {
|
|
76177
|
-
if (!
|
|
76242
|
+
if (!existsSync11(lockPath)) {
|
|
76178
76243
|
return false;
|
|
76179
76244
|
}
|
|
76180
76245
|
try {
|
|
@@ -76302,10 +76367,10 @@ var init_reply_waiter = __esm(() => {
|
|
|
76302
76367
|
});
|
|
76303
76368
|
|
|
76304
76369
|
// dist/builtin/intercom/config.ts
|
|
76305
|
-
import { existsSync as
|
|
76370
|
+
import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
|
|
76306
76371
|
import { getAgentConfigPaths } from "@bastani/atomic";
|
|
76307
76372
|
function loadConfig() {
|
|
76308
|
-
if (!
|
|
76373
|
+
if (!existsSync12(CONFIG_PATH)) {
|
|
76309
76374
|
return { ...defaults };
|
|
76310
76375
|
}
|
|
76311
76376
|
try {
|
|
@@ -76387,7 +76452,7 @@ var init_config = __esm(() => {
|
|
|
76387
76452
|
init_diagnostics();
|
|
76388
76453
|
init_reply_waiter();
|
|
76389
76454
|
CONFIG_PATHS = getAgentConfigPaths("intercom", "config.json");
|
|
76390
|
-
CONFIG_PATH = CONFIG_PATHS.find((path) =>
|
|
76455
|
+
CONFIG_PATH = CONFIG_PATHS.find((path) => existsSync12(path)) ?? CONFIG_PATHS[0];
|
|
76391
76456
|
DEFAULT_BROKER_ARGS = ["--no-install", "tsx"];
|
|
76392
76457
|
defaults = {
|
|
76393
76458
|
brokerCommand: DEFAULT_BROKER_COMMAND,
|
|
@@ -77122,11 +77187,22 @@ function childPlacement(shared, root, workspace) {
|
|
|
77122
77187
|
const binding = shared && isBoundWorkspace(workspace) ? bindingIdentity2(workspace) : root;
|
|
77123
77188
|
return binding === undefined ? {} : { workspaceBinding: binding };
|
|
77124
77189
|
}
|
|
77125
|
-
function placedExecution(execution, worktree) {
|
|
77190
|
+
function placedExecution(execution, worktree, partial) {
|
|
77126
77191
|
const workspace = execution.workspace;
|
|
77192
|
+
const outcomes = partial === undefined ? {} : {
|
|
77193
|
+
worktreeRestoreOutcomes: [
|
|
77194
|
+
...execution.worktreeRestoreOutcomes ?? [],
|
|
77195
|
+
partial
|
|
77196
|
+
]
|
|
77197
|
+
};
|
|
77127
77198
|
if (!isBoundWorkspace(workspace))
|
|
77128
|
-
return { ...execution, cwd: worktree };
|
|
77129
|
-
return {
|
|
77199
|
+
return { ...execution, cwd: worktree, ...outcomes };
|
|
77200
|
+
return {
|
|
77201
|
+
...execution,
|
|
77202
|
+
cwd: worktree,
|
|
77203
|
+
workspace: { ...workspace, worktree },
|
|
77204
|
+
...outcomes
|
|
77205
|
+
};
|
|
77130
77206
|
}
|
|
77131
77207
|
function carriedSnapshot(execution) {
|
|
77132
77208
|
return execution.workspaceSnapshot;
|
|
@@ -77811,14 +77887,14 @@ var UNATTRIBUTED_WRITE = "other";
|
|
|
77811
77887
|
var init_pool_coordination_stats = () => {};
|
|
77812
77888
|
|
|
77813
77889
|
// dist/builtin/workflows/src/workers/pooled-watch-trace.ts
|
|
77814
|
-
import { dirname as dirname18, join as join33, resolve as
|
|
77890
|
+
import { dirname as dirname18, join as join33, resolve as resolve17 } from "node:path";
|
|
77815
77891
|
import { appendDebugRecord, isDebugEnabled as isDebugEnabled2, reportDebug } from "@bastani/atomic";
|
|
77816
77892
|
function configurePooledWatchTrace(journal, processRole) {
|
|
77817
77893
|
journalPath = journal;
|
|
77818
77894
|
role = processRole;
|
|
77819
77895
|
}
|
|
77820
77896
|
function ownTraceFile(journal, setting) {
|
|
77821
|
-
return setting === "1" ? join33(dirname18(
|
|
77897
|
+
return setting === "1" ? join33(dirname18(resolve17(journal)), "pooled-watch-trace.jsonl") : resolve17(setting);
|
|
77822
77898
|
}
|
|
77823
77899
|
function tracePooledWatch(step, detail) {
|
|
77824
77900
|
if (!isDebugEnabled2("pooled-watch"))
|
|
@@ -78257,7 +78333,7 @@ function runsWhilePaused(command) {
|
|
|
78257
78333
|
if (command.kind !== "task")
|
|
78258
78334
|
return false;
|
|
78259
78335
|
const action = command.action.kind;
|
|
78260
|
-
return action === "cancel" || action === "output" || action === "detail" || action === "transcript";
|
|
78336
|
+
return action === "cancel" || action === "output" || action === "detail" || action === "transcript" || action === "commands";
|
|
78261
78337
|
}
|
|
78262
78338
|
|
|
78263
78339
|
// dist/builtin/workflows/src/workers/stage-watch-coalesce.ts
|
|
@@ -78558,9 +78634,9 @@ var init_worker_timing = __esm(() => {
|
|
|
78558
78634
|
// dist/builtin/workflows/src/workers/pool-coordinator.ts
|
|
78559
78635
|
import { fork } from "node:child_process";
|
|
78560
78636
|
import { randomUUID as randomUUID18 } from "node:crypto";
|
|
78561
|
-
import { existsSync as
|
|
78637
|
+
import { existsSync as existsSync13 } from "node:fs";
|
|
78562
78638
|
import { appendFile, mkdir as mkdir7, rm as rm4, rmdir as rmdir2 } from "node:fs/promises";
|
|
78563
|
-
import { delimiter, dirname as dirname20, isAbsolute as isAbsolute14, join as join34, resolve as
|
|
78639
|
+
import { delimiter, dirname as dirname20, isAbsolute as isAbsolute14, join as join34, resolve as resolve18 } from "node:path";
|
|
78564
78640
|
import { setTimeout as delay4 } from "node:timers/promises";
|
|
78565
78641
|
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
78566
78642
|
import { setDebugSetting } from "@bastani/atomic";
|
|
@@ -78569,7 +78645,7 @@ function unconfirmedCleanup(groups) {
|
|
|
78569
78645
|
return new WorkerCleanupUnconfirmedError({ processGroups: groups });
|
|
78570
78646
|
}
|
|
78571
78647
|
function workerLogDirectory(journalPath, root) {
|
|
78572
|
-
return join34(dirname20(
|
|
78648
|
+
return join34(dirname20(resolve18(journalPath)), "worker-logs", encodeURIComponent(root).replaceAll(".", "%2E"));
|
|
78573
78649
|
}
|
|
78574
78650
|
function traceAnchor(options) {
|
|
78575
78651
|
return options.shared === undefined ? options.journalPath : join34(options.shared.stateDirectory, "shared-pool");
|
|
@@ -79020,7 +79096,7 @@ class PoolCoordinator {
|
|
|
79020
79096
|
if (options.shared !== undefined)
|
|
79021
79097
|
this.journal ??= await this.countedJournal(await openDurableJournal(options.durable));
|
|
79022
79098
|
else {
|
|
79023
|
-
if (options.journalShard !== undefined && !
|
|
79099
|
+
if (options.journalShard !== undefined && !existsSync13(options.journalPath))
|
|
79024
79100
|
throw new JournalShardUnavailableError2({
|
|
79025
79101
|
code: "shard-missing",
|
|
79026
79102
|
shardId: options.journalShard,
|
|
@@ -80263,7 +80339,10 @@ class PoolCoordinator {
|
|
|
80263
80339
|
slot.worktree = claimed.worktree;
|
|
80264
80340
|
for (const id of this.remoteWatches.takenOver(claimed.work.id))
|
|
80265
80341
|
this.endRemoteWatch(id, "attempt_fenced");
|
|
80266
|
-
return claimed.worktree === undefined ? claimed.work : {
|
|
80342
|
+
return claimed.worktree === undefined ? claimed.work : {
|
|
80343
|
+
...claimed.work,
|
|
80344
|
+
execution: placedExecution(claimed.work.execution, claimed.worktree, claimed.partial)
|
|
80345
|
+
};
|
|
80267
80346
|
}
|
|
80268
80347
|
const held = slot.work;
|
|
80269
80348
|
if (!held)
|
|
@@ -80432,7 +80511,14 @@ class PoolCoordinator {
|
|
|
80432
80511
|
const restore = satellite.restore;
|
|
80433
80512
|
if (!chosen.restore || binding === undefined || restore === undefined)
|
|
80434
80513
|
return worktree === undefined ? { work } : { work, worktree };
|
|
80435
|
-
|
|
80514
|
+
let partial;
|
|
80515
|
+
const restored = await this.whileHolding(queue, lease, work, leaseMs, async (signal) => {
|
|
80516
|
+
const result = await restore(binding, this.restoreOptions(satellite, signal, carriedSnapshot(work.execution)));
|
|
80517
|
+
if (typeof result === "string")
|
|
80518
|
+
return result;
|
|
80519
|
+
partial = result.partial;
|
|
80520
|
+
return result.path;
|
|
80521
|
+
}, AbortSignal.any([this.closedSignal.signal, slot.exited.signal]));
|
|
80436
80522
|
if (this.closed)
|
|
80437
80523
|
return;
|
|
80438
80524
|
if ("closed" in restored) {
|
|
@@ -80441,7 +80527,7 @@ class PoolCoordinator {
|
|
|
80441
80527
|
}
|
|
80442
80528
|
if ("path" in restored) {
|
|
80443
80529
|
await this.restoreSucceeded(satellite, backoff, binding);
|
|
80444
|
-
return { work, worktree: restored.path };
|
|
80530
|
+
return partial === undefined ? { work, worktree: restored.path } : { work, worktree: restored.path, partial };
|
|
80445
80531
|
}
|
|
80446
80532
|
satellite.placementFailed(restored.error);
|
|
80447
80533
|
await queue.releaseUnplaced(lease, work);
|
|
@@ -82237,6 +82323,10 @@ class PooledStageTaskSource {
|
|
|
82237
82323
|
followTaskTranscript(id) {
|
|
82238
82324
|
return this.records.some((task) => task.ref.taskId === id && task.kind === "agent") ? { historyOnly: true } : undefined;
|
|
82239
82325
|
}
|
|
82326
|
+
async taskCommands(id) {
|
|
82327
|
+
const reply = await this.request(id, { kind: "commands" });
|
|
82328
|
+
return reply.ok && reply.value.kind === "commands" ? reply.value.catalog : undefined;
|
|
82329
|
+
}
|
|
82240
82330
|
extensionStatuses(id) {
|
|
82241
82331
|
return this.statuses.get(id) ?? NO_STATUSES;
|
|
82242
82332
|
}
|
|
@@ -83157,8 +83247,8 @@ var init_pooled_stage_registry = __esm(() => {
|
|
|
83157
83247
|
// dist/builtin/workflows/src/workers/local-pool.ts
|
|
83158
83248
|
import { fork as fork2 } from "node:child_process";
|
|
83159
83249
|
import { randomUUID as randomUUID20 } from "node:crypto";
|
|
83160
|
-
import { existsSync as
|
|
83161
|
-
import { join as join35, resolve as
|
|
83250
|
+
import { existsSync as existsSync14 } from "node:fs";
|
|
83251
|
+
import { join as join35, resolve as resolve19 } from "node:path";
|
|
83162
83252
|
import { setTimeout as delay5 } from "node:timers/promises";
|
|
83163
83253
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
83164
83254
|
import {
|
|
@@ -83402,7 +83492,7 @@ class LocalWorkerPool {
|
|
|
83402
83492
|
async prepare(root, store) {
|
|
83403
83493
|
if (this.closed)
|
|
83404
83494
|
throw new Error("Local worker pool is closed");
|
|
83405
|
-
if (this.options.journalShard !== undefined && !
|
|
83495
|
+
if (this.options.journalShard !== undefined && !existsSync14(this.options.journalPath))
|
|
83406
83496
|
throw new JournalShardUnavailableError3({
|
|
83407
83497
|
code: "shard-missing",
|
|
83408
83498
|
shardId: this.options.journalShard,
|
|
@@ -83478,7 +83568,7 @@ class LocalWorkerPool {
|
|
|
83478
83568
|
const journal = await rootRunJournal(this.backend.journal, root);
|
|
83479
83569
|
const journalPath = this.options.journalPath;
|
|
83480
83570
|
if (this.options.durable === undefined) {
|
|
83481
|
-
if (!(journal instanceof SqlRunJournal) ||
|
|
83571
|
+
if (!(journal instanceof SqlRunJournal) || resolve19(journalPath) !== resolve19(journal.path) || sqlPoolStorage(journal)?.tables.runs !== "wf_runs")
|
|
83482
83572
|
throw new Error("Local workers require the same default-prefix SQLite journal");
|
|
83483
83573
|
return journal;
|
|
83484
83574
|
}
|
|
@@ -84038,6 +84128,7 @@ class LocalWorkerPool {
|
|
|
84038
84128
|
config: options.config,
|
|
84039
84129
|
snapshots: options.snapshots,
|
|
84040
84130
|
worktreeRootMappings: options.worktreeRootMappings,
|
|
84131
|
+
worktreeRestoreOutcomes: options.worktreeRestoreOutcomes,
|
|
84041
84132
|
executionMode: options.executionMode,
|
|
84042
84133
|
workspace: options.workspace,
|
|
84043
84134
|
...childPlacement(shared, this.options.workspace, options.workspace),
|
|
@@ -84560,7 +84651,7 @@ var init_local_pool = __esm(() => {
|
|
|
84560
84651
|
var DEFAULT_POOLED_STAGE_START_MAX_LOAD_PER_CPU = 3, DEFAULT_PLACEMENT_CLAIM_WINDOW_MS = 60000;
|
|
84561
84652
|
|
|
84562
84653
|
// dist/builtin/workflows/src/workers/public-pool.ts
|
|
84563
|
-
import { resolve as
|
|
84654
|
+
import { resolve as resolve20 } from "node:path";
|
|
84564
84655
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
84565
84656
|
import { isBoundWorkspace as isBoundWorkspace3, isWorkspace, resolveWorkspace as resolveWorkspace2 } from "@bastani/atomic";
|
|
84566
84657
|
function shown(value2) {
|
|
@@ -84634,11 +84725,11 @@ function workerResources(options, context) {
|
|
|
84634
84725
|
heartbeatMs: undefined,
|
|
84635
84726
|
maxLoadPerCpu: undefined,
|
|
84636
84727
|
maxWorkerRssBytes: undefined,
|
|
84637
|
-
definitions: options.localWorkers.definitions.map((source) => ({ ...source, path:
|
|
84728
|
+
definitions: options.localWorkers.definitions.map((source) => ({ ...source, path: resolve20(cwd, source.path) }))
|
|
84638
84729
|
};
|
|
84639
84730
|
const admission = options.admission && {
|
|
84640
84731
|
...options.admission,
|
|
84641
|
-
...options.admission.userDatabase ? { userDatabase:
|
|
84732
|
+
...options.admission.userDatabase ? { userDatabase: resolve20(cwd, options.admission.userDatabase) } : {}
|
|
84642
84733
|
};
|
|
84643
84734
|
const userDatabase = admission?.userLimits && admission.userDatabase === undefined ? context.userDatabase() : undefined;
|
|
84644
84735
|
return JSON.parse(JSON.stringify({
|
|
@@ -84655,7 +84746,7 @@ function workerResources(options, context) {
|
|
|
84655
84746
|
}));
|
|
84656
84747
|
}
|
|
84657
84748
|
function poolUserDatabase(journal) {
|
|
84658
|
-
return isLocalPoolJournal(journal) ? undefined :
|
|
84749
|
+
return isLocalPoolJournal(journal) ? undefined : resolve20(coordinationPath(poolDurableJournal(journal)));
|
|
84659
84750
|
}
|
|
84660
84751
|
async function restoreWorkerOptions(backend, options) {
|
|
84661
84752
|
const source = options.continuation?.source.id ?? options.runId;
|
|
@@ -84771,13 +84862,13 @@ async function activatePublicPool(backend, options) {
|
|
|
84771
84862
|
registerPoolJournal(backend.journal, poolJournal);
|
|
84772
84863
|
}
|
|
84773
84864
|
const cwd = options.cwd ?? process.cwd();
|
|
84774
|
-
const userDatabase = options.admission?.userDatabase ?
|
|
84775
|
-
if (durable !== undefined && options.admission?.userLimits && userDatabase !== undefined && userDatabase !==
|
|
84776
|
-
throw new Error(`admission.userDatabase must be omitted, or ${
|
|
84777
|
-
const paths = (options.localWorkers?.definitions ?? []).map((source) =>
|
|
84865
|
+
const userDatabase = options.admission?.userDatabase ? resolve20(cwd, options.admission.userDatabase) : options.admission?.userDatabase;
|
|
84866
|
+
if (durable !== undefined && options.admission?.userLimits && userDatabase !== undefined && userDatabase !== resolve20(poolPath))
|
|
84867
|
+
throw new Error(`admission.userDatabase must be omitted, or ${resolve20(poolPath)}, for a journal that is not a local SQLite file`);
|
|
84868
|
+
const paths = (options.localWorkers?.definitions ?? []).map((source) => resolve20(cwd, source.path));
|
|
84778
84869
|
const digests = new Map(await Promise.all(paths.map(async (path) => [path, await definitionDigest(path)])));
|
|
84779
84870
|
const resources = workerResources(options, {
|
|
84780
|
-
userDatabase: () => durable === undefined ? undefined :
|
|
84871
|
+
userDatabase: () => durable === undefined ? undefined : resolve20(poolPath),
|
|
84781
84872
|
digestOf: (path) => digests.get(path),
|
|
84782
84873
|
coordinator: shared !== undefined || durable === undefined || !options.localWorkers ? undefined : { host: poolHostId(durable.agentDir), database: coordinationDatabase(durable) },
|
|
84783
84874
|
...recorded === undefined ? {} : { workers: recorded.placement }
|
|
@@ -89654,7 +89745,7 @@ var init_stage_runner_controller = __esm(() => {
|
|
|
89654
89745
|
// dist/builtin/workflows/src/runs/foreground/stage-runner-output.ts
|
|
89655
89746
|
import { createHash as createHash7 } from "node:crypto";
|
|
89656
89747
|
import { mkdir as mkdir8, writeFile as writeFile11 } from "node:fs/promises";
|
|
89657
|
-
import { basename as basename6, dirname as dirname22, isAbsolute as isAbsolute16, join as join37, resolve as
|
|
89748
|
+
import { basename as basename6, dirname as dirname22, isAbsolute as isAbsolute16, join as join37, resolve as resolve21 } from "node:path";
|
|
89658
89749
|
function normalizeMaxOutput2(maxOutput) {
|
|
89659
89750
|
return {
|
|
89660
89751
|
bytes: maxOutput?.bytes ?? DEFAULT_MAX_OUTPUT_BYTES,
|
|
@@ -89762,7 +89853,7 @@ function renderTranscript(messages, fallbackOutput) {
|
|
|
89762
89853
|
`);
|
|
89763
89854
|
}
|
|
89764
89855
|
function savedOutputReference(outputPath, fullOutput, transcriptPathValue, transcriptText, transcriptAvailable, warning) {
|
|
89765
|
-
const absolutePath =
|
|
89856
|
+
const absolutePath = resolve21(outputPath);
|
|
89766
89857
|
const bytes = Buffer.byteLength(fullOutput, "utf8");
|
|
89767
89858
|
const lines = countLines(fullOutput);
|
|
89768
89859
|
const transcriptBytes = Buffer.byteLength(transcriptText, "utf8");
|
|
@@ -89777,8 +89868,8 @@ function resolveOutputPath(output, runtimeCwd, requestedCwd) {
|
|
|
89777
89868
|
return;
|
|
89778
89869
|
if (isAbsolute16(output))
|
|
89779
89870
|
return output;
|
|
89780
|
-
const baseCwd = requestedCwd === undefined ? runtimeCwd : isAbsolute16(requestedCwd) ? requestedCwd :
|
|
89781
|
-
return
|
|
89871
|
+
const baseCwd = requestedCwd === undefined ? runtimeCwd : isAbsolute16(requestedCwd) ? requestedCwd : resolve21(runtimeCwd, requestedCwd);
|
|
89872
|
+
return resolve21(baseCwd, output);
|
|
89782
89873
|
}
|
|
89783
89874
|
function degenerateWarning(fullOutput) {
|
|
89784
89875
|
return fullOutput.trim().length === 0 ? "WARNING: the stage artifact is empty; search the companion transcript for this stage's work." : undefined;
|
|
@@ -91155,11 +91246,11 @@ var init_child_workflow_failure_message = __esm(() => {
|
|
|
91155
91246
|
});
|
|
91156
91247
|
|
|
91157
91248
|
// dist/builtin/workflows/src/engine/primitives/workflow.ts
|
|
91158
|
-
import { existsSync as
|
|
91249
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
91159
91250
|
import {
|
|
91160
91251
|
acquireWorkspaceWriterLease,
|
|
91161
91252
|
isBoundWorkspace as isBoundWorkspace4,
|
|
91162
|
-
isWorkspaceRestoreError,
|
|
91253
|
+
isWorkspaceRestoreError as isWorkspaceRestoreError2,
|
|
91163
91254
|
resolveWorkspace as resolveWorkspace4,
|
|
91164
91255
|
restoreWorkspace,
|
|
91165
91256
|
workspaceChangeSet as workspaceChangeSet2
|
|
@@ -91347,7 +91438,7 @@ async function bindChildWorkspace(workspace, invocation, signal, owner, restored
|
|
|
91347
91438
|
binding = recorded;
|
|
91348
91439
|
} catch (error) {
|
|
91349
91440
|
const worktree = mapWorkflowWorktreePath(recorded.worktree, restored);
|
|
91350
|
-
if (!
|
|
91441
|
+
if (!isWorkspaceRestoreError2(error) || worktree === recorded.worktree || existsSync15(recorded.worktree))
|
|
91351
91442
|
throw error;
|
|
91352
91443
|
binding = { ...recorded, worktree };
|
|
91353
91444
|
}
|
|
@@ -92302,7 +92393,7 @@ var init_run_claims = __esm(() => {
|
|
|
92302
92393
|
// dist/builtin/workflows/src/durable/fork-run.ts
|
|
92303
92394
|
import { randomUUID as randomUUID22 } from "node:crypto";
|
|
92304
92395
|
import { statSync as statSync6 } from "node:fs";
|
|
92305
|
-
import { isAbsolute as isAbsolute17, resolve as
|
|
92396
|
+
import { isAbsolute as isAbsolute17, resolve as resolve22 } from "node:path";
|
|
92306
92397
|
import {
|
|
92307
92398
|
assertSessionBlobStore as assertSessionBlobStore2,
|
|
92308
92399
|
copySessionBlobs as copySessionBlobs2,
|
|
@@ -92329,7 +92420,7 @@ function validateForkOptions(source, runId, options) {
|
|
|
92329
92420
|
let directory = false;
|
|
92330
92421
|
if (typeof options.cwd === "string" && options.cwd.length > 0) {
|
|
92331
92422
|
try {
|
|
92332
|
-
directory = statSync6(
|
|
92423
|
+
directory = statSync6(resolve22(options.cwd)).isDirectory();
|
|
92333
92424
|
} catch (error) {
|
|
92334
92425
|
cause = error;
|
|
92335
92426
|
}
|
|
@@ -92355,7 +92446,7 @@ function validateForkOptions(source, runId, options) {
|
|
|
92355
92446
|
function forkDestinationCwd(cwd, source) {
|
|
92356
92447
|
if (cwd === undefined)
|
|
92357
92448
|
return source.invocationCwd ?? process.cwd();
|
|
92358
|
-
return isAbsolute17(cwd) ? cwd :
|
|
92449
|
+
return isAbsolute17(cwd) ? cwd : resolve22(cwd);
|
|
92359
92450
|
}
|
|
92360
92451
|
function storageScope(descriptor) {
|
|
92361
92452
|
if (descriptor === undefined)
|
|
@@ -97562,6 +97653,7 @@ import {
|
|
|
97562
97653
|
resolveWorktreeSnapshotSettings as resolveWorktreeSnapshotSettings2,
|
|
97563
97654
|
scheduleSnapshotCollection,
|
|
97564
97655
|
setUpResumedRunWorktrees,
|
|
97656
|
+
withWorktreeRestoreNotices,
|
|
97565
97657
|
withWorktreeRootMappings as withWorktreeRootMappings3
|
|
97566
97658
|
} from "@bastani/atomic";
|
|
97567
97659
|
async function run(def, inputs, opts = {}) {
|
|
@@ -97599,41 +97691,46 @@ async function run(def, inputs, opts = {}) {
|
|
|
97599
97691
|
const journal = backend.snapshotJournal;
|
|
97600
97692
|
if (previous !== undefined && journal !== undefined) {
|
|
97601
97693
|
const mappings = previous.worktreeRootMappings ?? [];
|
|
97602
|
-
if (opts[restorePreconditionsChecked] !== true)
|
|
97603
|
-
|
|
97604
|
-
throw new JournalOwnershipError(runId, (await journal.leaseState(runId))?.holderId ?? null);
|
|
97605
|
-
const precondition = await runRestorePreconditionFailure(journal, runId, mappings, previous.snapshots ?? opts.snapshots, opts.signal);
|
|
97606
|
-
if (precondition !== undefined)
|
|
97607
|
-
throw precondition;
|
|
97608
|
-
}
|
|
97694
|
+
if (opts[restorePreconditionsChecked] !== true && await backend.workflowOwnership(runId) === "foreign")
|
|
97695
|
+
throw new JournalOwnershipError(runId, (await journal.leaseState(runId))?.holderId ?? null);
|
|
97609
97696
|
let warningCount = 0;
|
|
97697
|
+
const unrestored = [];
|
|
97610
97698
|
const restored = await resolveWorkflowSnapshotFrontier(journal, runId, {
|
|
97611
97699
|
mappings,
|
|
97612
97700
|
settings: previous.snapshots ?? opts.snapshots,
|
|
97613
97701
|
signal: opts.signal,
|
|
97614
|
-
onRestore: (mapping) =>
|
|
97615
|
-
|
|
97616
|
-
|
|
97617
|
-
|
|
97618
|
-
|
|
97619
|
-
|
|
97620
|
-
|
|
97621
|
-
|
|
97622
|
-
|
|
97623
|
-
|
|
97624
|
-
|
|
97625
|
-
|
|
97626
|
-
|
|
97627
|
-
|
|
97702
|
+
onRestore: (mapping) => {
|
|
97703
|
+
if (mapping.degraded !== undefined)
|
|
97704
|
+
return;
|
|
97705
|
+
activeStore.recordNotice({
|
|
97706
|
+
id: `workflow-worktree-restore:${runId}:${mapping.snapshotId}:${mapping.restoredAt}`,
|
|
97707
|
+
runId,
|
|
97708
|
+
level: "info",
|
|
97709
|
+
message: formatWorktreeRestoreNotice(mapping),
|
|
97710
|
+
createdAt: Date.now()
|
|
97711
|
+
});
|
|
97712
|
+
},
|
|
97713
|
+
onWarning: (warning, mapping) => {
|
|
97714
|
+
if (mapping.degraded !== undefined && (warning.code === "omitted-content" || warning.code === "filters"))
|
|
97715
|
+
return;
|
|
97716
|
+
activeStore.recordNotice({
|
|
97717
|
+
id: `workflow-worktree-restore-warning:${runId}:${mapping.snapshotId}:${mapping.restoredAt}:${warningCount++}`,
|
|
97718
|
+
runId,
|
|
97719
|
+
level: "warning",
|
|
97720
|
+
message: formatWorktreeRestoreWarning(warning),
|
|
97721
|
+
createdAt: Date.now()
|
|
97722
|
+
});
|
|
97723
|
+
},
|
|
97724
|
+
onUnrestored: (checkout) => unrestored.push(checkout)
|
|
97628
97725
|
});
|
|
97726
|
+
const restoreSnapshots = mappings.length > 0 || restored.length > 0 ? new Map((await listWorkflowSnapshotBoundaries(journal, runId)).map((boundary) => [
|
|
97727
|
+
boundary.snapshot.id,
|
|
97728
|
+
boundary.snapshot
|
|
97729
|
+
])) : new Map;
|
|
97629
97730
|
if (mappings.length > 0 || restored.length > 0) {
|
|
97630
|
-
const snapshots = new Map((await listWorkflowSnapshotBoundaries(journal, runId)).map((boundary) => [
|
|
97631
|
-
boundary.snapshot.id,
|
|
97632
|
-
boundary.snapshot
|
|
97633
|
-
]));
|
|
97634
97731
|
const resumeToken = crypto.randomUUID();
|
|
97635
97732
|
let blueprintNoticeCount = 0;
|
|
97636
|
-
await setUpResumedRunWorktrees({ restored, mappings, snapshots }, {
|
|
97733
|
+
await setUpResumedRunWorktrees({ restored, mappings, snapshots: restoreSnapshots }, {
|
|
97637
97734
|
signal: opts.signal,
|
|
97638
97735
|
onNotices: (notices) => {
|
|
97639
97736
|
for (const notice of notices) {
|
|
@@ -97649,15 +97746,41 @@ async function run(def, inputs, opts = {}) {
|
|
|
97649
97746
|
});
|
|
97650
97747
|
}
|
|
97651
97748
|
const allMappings = [...mappings, ...restored];
|
|
97652
|
-
|
|
97653
|
-
|
|
97749
|
+
const recordedCwd = previous.invocationCwd ?? opts.cwd;
|
|
97750
|
+
const continuing = recordedCwd === undefined ? undefined : mapWorkflowWorktreePath(recordedCwd, allMappings);
|
|
97751
|
+
const outcomes = runWorktreeRestoreOutcomes({
|
|
97752
|
+
restored,
|
|
97753
|
+
unrestored,
|
|
97754
|
+
snapshots: restoreSnapshots,
|
|
97755
|
+
continuing,
|
|
97756
|
+
launchCwd: opts[resumeLaunchCwd] ?? opts.cwd ?? process.cwd(),
|
|
97757
|
+
previous: previous.worktreeRestoreOutcomes ?? [],
|
|
97758
|
+
mappings: allMappings
|
|
97759
|
+
});
|
|
97760
|
+
for (const outcome of outcomes.fresh) {
|
|
97761
|
+
activeStore.recordNotice({
|
|
97762
|
+
id: `workflow-worktree-restore-outcome:${runId}:${outcome.snapshotId}:${outcome.at}`,
|
|
97763
|
+
runId,
|
|
97764
|
+
level: "warning",
|
|
97765
|
+
message: outcome.message,
|
|
97766
|
+
createdAt: Date.now()
|
|
97767
|
+
});
|
|
97768
|
+
}
|
|
97769
|
+
if (restored.length > 0 || outcomes.list.length > 0 || (previous.worktreeRestoreOutcomes?.length ?? 0) > 0) {
|
|
97770
|
+
await backend.commitWorkflowRegistration({
|
|
97771
|
+
...previous,
|
|
97772
|
+
...allMappings.length > 0 ? { worktreeRootMappings: allMappings } : {},
|
|
97773
|
+
...outcomes.list.length > 0 || previous.worktreeRestoreOutcomes !== undefined ? { worktreeRestoreOutcomes: outcomes.list } : {}
|
|
97774
|
+
});
|
|
97654
97775
|
}
|
|
97655
|
-
|
|
97656
|
-
|
|
97776
|
+
const cwd = outcomes.continuedIn ?? continuing;
|
|
97777
|
+
if (allMappings.length > 0 || outcomes.list.length > 0) {
|
|
97657
97778
|
opts = {
|
|
97658
97779
|
...opts,
|
|
97659
|
-
...cwd === undefined ? {} : { cwd
|
|
97660
|
-
|
|
97780
|
+
...cwd === undefined ? {} : { cwd },
|
|
97781
|
+
...outcomes.continuedIn === undefined || recordedCwd === undefined ? {} : { [recordedInvocationCwd]: recordedCwd },
|
|
97782
|
+
...allMappings.length > 0 ? { worktreeRootMappings: allMappings } : {},
|
|
97783
|
+
...outcomes.list.length > 0 ? { worktreeRestoreOutcomes: outcomes.list } : {}
|
|
97661
97784
|
};
|
|
97662
97785
|
}
|
|
97663
97786
|
}
|
|
@@ -97680,7 +97803,8 @@ async function run(def, inputs, opts = {}) {
|
|
|
97680
97803
|
bindStoreDurableBackend(activeStore, backend);
|
|
97681
97804
|
}
|
|
97682
97805
|
const admitted = () => admitWorkflowSessions(backend, { ...opts, runId }, (admittedOpts) => executeUntilSettled(def, resolvedInputs, { ...admittedOpts, store: activeStore, runId, durableBackend: backend }, evictionPolicy));
|
|
97683
|
-
|
|
97806
|
+
const restoreNotices = (opts.worktreeRestoreOutcomes ?? []).map((outcome) => outcome.message);
|
|
97807
|
+
return await withWorktreeRootMappings3(opts.worktreeRootMappings ?? [], () => withWorktreeRestoreNotices(restoreNotices, admitted));
|
|
97684
97808
|
} finally {
|
|
97685
97809
|
try {
|
|
97686
97810
|
await publicPool?.close();
|
|
@@ -97796,6 +97920,7 @@ async function executeRun(def, resolvedInputs, opts, eviction) {
|
|
|
97796
97920
|
stages: [],
|
|
97797
97921
|
toolNodes: [],
|
|
97798
97922
|
...opts.worktreeRootMappings !== undefined ? { worktreeRootMappings: opts.worktreeRootMappings } : {},
|
|
97923
|
+
...opts.worktreeRestoreOutcomes !== undefined ? { worktreeRestoreOutcomes: opts.worktreeRestoreOutcomes } : {},
|
|
97799
97924
|
pendingStageMessages: [
|
|
97800
97925
|
...pendingStageMessagesForDurableRun(rootBackend, runId, opts.parentRun?.rootRunId ?? runId)
|
|
97801
97926
|
],
|
|
@@ -98052,7 +98177,8 @@ async function executeRun(def, resolvedInputs, opts, eviction) {
|
|
|
98052
98177
|
durableBackend,
|
|
98053
98178
|
durableRootBackend: rootBackend,
|
|
98054
98179
|
snapshots: opts.snapshots,
|
|
98055
|
-
worktreeRootMappings: opts.worktreeRootMappings
|
|
98180
|
+
worktreeRootMappings: opts.worktreeRootMappings,
|
|
98181
|
+
worktreeRestoreOutcomes: opts.worktreeRestoreOutcomes
|
|
98056
98182
|
};
|
|
98057
98183
|
let evicted;
|
|
98058
98184
|
let bodySettled = false;
|
|
@@ -98634,7 +98760,8 @@ async function executeRun(def, resolvedInputs, opts, eviction) {
|
|
|
98634
98760
|
await durableBackend.commitWorkflowRegistration({
|
|
98635
98761
|
...durableRootRegistration,
|
|
98636
98762
|
modelOwner: runSnapshot.modelOwner,
|
|
98637
|
-
...workflowInvocationMetadata(inputRuntimeDefaults, workflowInvocationCwd, gitWorktreeSetupCache, runSnapshot.origin)
|
|
98763
|
+
...workflowInvocationMetadata(inputRuntimeDefaults, workflowInvocationCwd, gitWorktreeSetupCache, runSnapshot.origin),
|
|
98764
|
+
...opts[recordedInvocationCwd] === undefined ? {} : { invocationCwd: opts[recordedInvocationCwd] }
|
|
98638
98765
|
});
|
|
98639
98766
|
} else {
|
|
98640
98767
|
await durableBackend.commitWorkflowStatus(runId, "running");
|
|
@@ -99188,7 +99315,7 @@ var init_registry = () => {};
|
|
|
99188
99315
|
|
|
99189
99316
|
// dist/builtin/workflows/src/extension/discovery-loaders.ts
|
|
99190
99317
|
import { readdir as readdir2, stat as stat2 } from "node:fs/promises";
|
|
99191
|
-
import { extname, isAbsolute as isAbsolute18, join as join38, resolve as
|
|
99318
|
+
import { extname, isAbsolute as isAbsolute18, join as join38, resolve as resolve23 } from "node:path";
|
|
99192
99319
|
async function scanWorkflowDir(dir) {
|
|
99193
99320
|
try {
|
|
99194
99321
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
@@ -99232,7 +99359,7 @@ async function loadFromPaths(pathsOrMap, kind, baseCwd, diagnostics, getWorkflow
|
|
|
99232
99359
|
const all = [];
|
|
99233
99360
|
const entries = Array.isArray(pathsOrMap) ? pathsOrMap.map((p) => ({ rawPath: p })) : Object.entries(pathsOrMap).map(([name, p]) => ({ rawPath: p, configuredName: name }));
|
|
99234
99361
|
for (const { rawPath, configuredName } of entries) {
|
|
99235
|
-
const absPath = isAbsolute18(rawPath) ? rawPath :
|
|
99362
|
+
const absPath = isAbsolute18(rawPath) ? rawPath : resolve23(baseCwd, rawPath);
|
|
99236
99363
|
let pathStats;
|
|
99237
99364
|
try {
|
|
99238
99365
|
pathStats = await stat2(absPath);
|
|
@@ -99494,7 +99621,7 @@ var init_discovery = __esm(() => {
|
|
|
99494
99621
|
});
|
|
99495
99622
|
|
|
99496
99623
|
// dist/builtin/workflows/src/runs/foreground/sdk-fork.ts
|
|
99497
|
-
import { resolve as
|
|
99624
|
+
import { resolve as resolve24 } from "node:path";
|
|
99498
99625
|
function refuseAddedWorkerResources(options, saved) {
|
|
99499
99626
|
if (saved)
|
|
99500
99627
|
return;
|
|
@@ -99526,7 +99653,7 @@ function refuseChangedWorkerResources(options, handle, backend) {
|
|
|
99526
99653
|
const requested = workerResources({
|
|
99527
99654
|
localWorkers: options.localWorkers ?? saved.localWorkers,
|
|
99528
99655
|
admission: options.admission ?? saved.admission,
|
|
99529
|
-
cwd: options.cwd === undefined ? handle.invocationCwd ?? process.cwd() :
|
|
99656
|
+
cwd: options.cwd === undefined ? handle.invocationCwd ?? process.cwd() : resolve24(options.cwd)
|
|
99530
99657
|
}, {
|
|
99531
99658
|
userDatabase: () => forkUserDatabase(backend),
|
|
99532
99659
|
digestOf: (path) => digests.get(path) ?? "",
|
|
@@ -99691,23 +99818,59 @@ var init_types2 = __esm(() => {
|
|
|
99691
99818
|
|
|
99692
99819
|
// dist/builtin/workflows/src/workers/snapshot-restore.ts
|
|
99693
99820
|
import {
|
|
99694
|
-
|
|
99695
|
-
|
|
99821
|
+
formatDegradedRestoreNotice as formatDegradedRestoreNotice2,
|
|
99822
|
+
isGitUnavailableError as isGitUnavailableError4,
|
|
99823
|
+
restoreBestWorktree as restoreBestWorktree2,
|
|
99824
|
+
restoreWorktree
|
|
99696
99825
|
} from "@bastani/atomic";
|
|
99697
99826
|
function snapshotRestore(options) {
|
|
99698
|
-
const restore = options.restore ?? restoreWorktree2;
|
|
99699
99827
|
const restored = new Map;
|
|
99700
|
-
const restoreOnHost = async (binding,
|
|
99828
|
+
const restoreOnHost = async (binding, snapshot, recorded, signal) => {
|
|
99829
|
+
const shared = {
|
|
99830
|
+
blobs: options.blobs,
|
|
99831
|
+
storeDir: options.storeDir,
|
|
99832
|
+
signal,
|
|
99833
|
+
git: options.git,
|
|
99834
|
+
...options.restore === undefined ? {} : { restore: options.restore }
|
|
99835
|
+
};
|
|
99701
99836
|
try {
|
|
99702
|
-
|
|
99703
|
-
|
|
99704
|
-
|
|
99705
|
-
|
|
99706
|
-
|
|
99707
|
-
|
|
99708
|
-
|
|
99837
|
+
if (snapshot === undefined)
|
|
99838
|
+
return (await (options.restore ?? restoreWorktree)(binding, {
|
|
99839
|
+
...recorded,
|
|
99840
|
+
blobs: options.blobs,
|
|
99841
|
+
storeDir: options.storeDir,
|
|
99842
|
+
signal,
|
|
99843
|
+
git: options.git
|
|
99844
|
+
})).path;
|
|
99845
|
+
const best = await restoreBestWorktree2(snapshot, {
|
|
99846
|
+
...shared,
|
|
99847
|
+
...recorded.snapshots === undefined ? {} : { target: binding, snapshots: recorded.snapshots }
|
|
99848
|
+
});
|
|
99849
|
+
if (best.status === "unrestored")
|
|
99850
|
+
throw best.reason;
|
|
99851
|
+
if (best.degraded === undefined)
|
|
99852
|
+
return best.path;
|
|
99853
|
+
const restoredAt = new Date().toISOString();
|
|
99854
|
+
const mapping = {
|
|
99855
|
+
from: snapshot.root,
|
|
99856
|
+
to: best.path,
|
|
99857
|
+
snapshotId: snapshot.id,
|
|
99858
|
+
tree: snapshot.tree,
|
|
99859
|
+
restoredAt,
|
|
99860
|
+
degraded: best.degraded
|
|
99861
|
+
};
|
|
99862
|
+
return {
|
|
99863
|
+
path: best.path,
|
|
99864
|
+
partial: {
|
|
99865
|
+
root: snapshot.root,
|
|
99866
|
+
snapshotId: snapshot.id,
|
|
99867
|
+
message: formatDegradedRestoreNotice2(mapping, snapshot, [], "workflow run"),
|
|
99868
|
+
at: restoredAt,
|
|
99869
|
+
degraded: best.degraded
|
|
99870
|
+
}
|
|
99871
|
+
};
|
|
99709
99872
|
} catch (error) {
|
|
99710
|
-
if (signal.aborted || !
|
|
99873
|
+
if (signal.aborted || !isGitUnavailableError4(error))
|
|
99711
99874
|
throw error;
|
|
99712
99875
|
throw new WorkspaceRestoreUnavailableError("no-restore-port", workspaceBindingIdentity(binding), {
|
|
99713
99876
|
cause: error
|
|
@@ -99719,9 +99882,9 @@ function snapshotRestore(options) {
|
|
|
99719
99882
|
return restoreOnHost(binding, snapshot, {}, signal);
|
|
99720
99883
|
const key = JSON.stringify([binding.head, binding.tree]);
|
|
99721
99884
|
const snapshots = restored.get(key) ?? await options.recorded(binding);
|
|
99722
|
-
let
|
|
99885
|
+
let result;
|
|
99723
99886
|
try {
|
|
99724
|
-
|
|
99887
|
+
result = await restoreOnHost(binding, snapshots.at(-1), { snapshots }, signal);
|
|
99725
99888
|
} catch (error) {
|
|
99726
99889
|
restored.delete(key);
|
|
99727
99890
|
throw error;
|
|
@@ -99729,7 +99892,7 @@ function snapshotRestore(options) {
|
|
|
99729
99892
|
if (!restored.has(key) && restored.size >= RECORDED_SNAPSHOT_ENTRIES)
|
|
99730
99893
|
restored.clear();
|
|
99731
99894
|
restored.set(key, snapshots);
|
|
99732
|
-
return
|
|
99895
|
+
return result;
|
|
99733
99896
|
};
|
|
99734
99897
|
}
|
|
99735
99898
|
var RECORDED_SNAPSHOT_ENTRIES = 256;
|
|
@@ -99739,7 +99902,7 @@ var init_snapshot_restore = __esm(() => {
|
|
|
99739
99902
|
|
|
99740
99903
|
// dist/builtin/workflows/src/workers/worker-host.ts
|
|
99741
99904
|
import { execFile as execFile2 } from "node:child_process";
|
|
99742
|
-
import { existsSync as
|
|
99905
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
99743
99906
|
import { join as join40 } from "node:path";
|
|
99744
99907
|
import {
|
|
99745
99908
|
getAgentDir as getAgentDir9,
|
|
@@ -99817,7 +99980,7 @@ function probeGit(git) {
|
|
|
99817
99980
|
async function runnableSources(root) {
|
|
99818
99981
|
const sources = [];
|
|
99819
99982
|
for (const source of root.config.definitions) {
|
|
99820
|
-
if (!
|
|
99983
|
+
if (!existsSync16(source.path))
|
|
99821
99984
|
continue;
|
|
99822
99985
|
const digest = await definitionDigest(source.path);
|
|
99823
99986
|
if (digest === source.digest)
|
|
@@ -100091,14 +100254,24 @@ function hostRestorePort(options, git, shared, journal, agentDir) {
|
|
|
100091
100254
|
storeDir: join40(agentDir, "worktree-snapshots"),
|
|
100092
100255
|
git
|
|
100093
100256
|
});
|
|
100094
|
-
return (binding, hook) =>
|
|
100095
|
-
|
|
100096
|
-
|
|
100097
|
-
|
|
100098
|
-
|
|
100099
|
-
|
|
100100
|
-
|
|
100101
|
-
|
|
100257
|
+
return async (binding, hook) => {
|
|
100258
|
+
let result;
|
|
100259
|
+
const path = await restoreRunWorktree(hook.snapshot?.remotes, async () => {
|
|
100260
|
+
result = await restore(binding, hook);
|
|
100261
|
+
return typeof result === "string" ? result : result.path;
|
|
100262
|
+
}, {
|
|
100263
|
+
signal: hook.signal,
|
|
100264
|
+
agentDir,
|
|
100265
|
+
onNotices: (notices) => {
|
|
100266
|
+
for (const notice of notices)
|
|
100267
|
+
console.warn(`atomic-workflows: ${notice.message}`);
|
|
100268
|
+
}
|
|
100269
|
+
});
|
|
100270
|
+
if (typeof result !== "object" || result.partial === undefined)
|
|
100271
|
+
return path;
|
|
100272
|
+
console.warn(`atomic-workflows: ${result.partial.message}`);
|
|
100273
|
+
return { path, partial: result.partial };
|
|
100274
|
+
};
|
|
100102
100275
|
}
|
|
100103
100276
|
async function startWorkflowWorkerHost(options) {
|
|
100104
100277
|
validated(options);
|
|
@@ -100318,7 +100491,7 @@ __export(exports_sdk_surface, {
|
|
|
100318
100491
|
isForkSourceNotFoundError: () => isForkSourceNotFoundError,
|
|
100319
100492
|
isForkSourceOwnershipError: () => isForkSourceOwnershipError,
|
|
100320
100493
|
isForkTargetNotFoundError: () => isForkTargetNotFoundError,
|
|
100321
|
-
isGitUnavailableError: () =>
|
|
100494
|
+
isGitUnavailableError: () => isGitUnavailableError5,
|
|
100322
100495
|
isLocalWorkerOptionsError: () => isLocalWorkerOptionsError,
|
|
100323
100496
|
isLocalWorkerPoolError: () => isLocalWorkerPoolError,
|
|
100324
100497
|
isPoolAppendRefusedError: () => isPoolAppendRefusedError,
|
|
@@ -100388,7 +100561,7 @@ __export(exports_sdk_surface, {
|
|
|
100388
100561
|
isWorkspaceError: () => isWorkspaceError,
|
|
100389
100562
|
isWorkspaceGitError: () => isWorkspaceGitError3,
|
|
100390
100563
|
isWorkspacePublicationError: () => isWorkspacePublicationError,
|
|
100391
|
-
isWorkspaceRestoreError: () =>
|
|
100564
|
+
isWorkspaceRestoreError: () => isWorkspaceRestoreError3,
|
|
100392
100565
|
isWorkspaceRestoreUnavailableError: () => isWorkspaceRestoreUnavailableError,
|
|
100393
100566
|
isWorkspaceSandboxError: () => isWorkspaceSandboxError,
|
|
100394
100567
|
isWorkspaceSnapshotError: () => isWorkspaceSnapshotError2,
|
|
@@ -100467,7 +100640,7 @@ import {
|
|
|
100467
100640
|
isDecisionRequestError,
|
|
100468
100641
|
isDecisionTimeoutError,
|
|
100469
100642
|
isEventSourceError,
|
|
100470
|
-
isGitUnavailableError as
|
|
100643
|
+
isGitUnavailableError as isGitUnavailableError5,
|
|
100471
100644
|
isRetryableDecisionError,
|
|
100472
100645
|
isRetryableSubscriptionError,
|
|
100473
100646
|
isRetryableWorkspaceError,
|
|
@@ -100489,7 +100662,7 @@ import {
|
|
|
100489
100662
|
isWorkspaceError,
|
|
100490
100663
|
isWorkspaceGitError as isWorkspaceGitError3,
|
|
100491
100664
|
isWorkspacePublicationError,
|
|
100492
|
-
isWorkspaceRestoreError as
|
|
100665
|
+
isWorkspaceRestoreError as isWorkspaceRestoreError3,
|
|
100493
100666
|
isWorkspaceSandboxError,
|
|
100494
100667
|
isWorkspaceSnapshotError as isWorkspaceSnapshotError2,
|
|
100495
100668
|
isWorkspaceTimeoutError,
|
|
@@ -100757,7 +100930,7 @@ export {
|
|
|
100757
100930
|
isForkSourceNotFoundError,
|
|
100758
100931
|
isForkSourceOwnershipError,
|
|
100759
100932
|
isForkTargetNotFoundError,
|
|
100760
|
-
|
|
100933
|
+
isGitUnavailableError5 as isGitUnavailableError,
|
|
100761
100934
|
isLocalWorkerOptionsError,
|
|
100762
100935
|
isLocalWorkerPoolError,
|
|
100763
100936
|
isPoolAppendRefusedError,
|
|
@@ -100827,7 +101000,7 @@ export {
|
|
|
100827
101000
|
isWorkspaceError,
|
|
100828
101001
|
isWorkspaceGitError3 as isWorkspaceGitError,
|
|
100829
101002
|
isWorkspacePublicationError,
|
|
100830
|
-
|
|
101003
|
+
isWorkspaceRestoreError3 as isWorkspaceRestoreError,
|
|
100831
101004
|
isWorkspaceRestoreUnavailableError,
|
|
100832
101005
|
isWorkspaceSandboxError,
|
|
100833
101006
|
isWorkspaceSnapshotError2 as isWorkspaceSnapshotError,
|