@bastani/atomic 0.9.38-alpha.6 → 0.9.38-alpha.7
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 +31 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +120 -121
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +19 -0
- package/dist/builtin/workflows/builtin/{chunk-q7dx7kh7.js → chunk-85mx6wcf.js} +6 -6
- package/dist/builtin/workflows/builtin/{chunk-neszcj53.js → chunk-8kkv04hz.js} +15 -15
- package/dist/builtin/workflows/builtin/{chunk-g1a4hw0s.js → chunk-8x61e0s7.js} +13 -25
- package/dist/builtin/workflows/builtin/{chunk-2qgfyvzs.js → chunk-y45tkftg.js} +7 -7
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +4 -4
- package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/durable/journal/internal.d.ts +0 -19
- package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +3 -11
- package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +15 -9
- package/dist/builtin/workflows/src/durable/journal/types.d.ts +3 -93
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +992 -756
- package/dist/builtin/workflows/src/index.js +547 -394
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +1 -1
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +29 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/session-picker.d.ts +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +2 -2
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +6 -1
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +4 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +44 -4
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -4
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +0 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.js +1 -3
- package/dist/core/compaction/pi-summary-fallback.js.map +1 -1
- package/dist/core/extensions/loader-api.js +1 -1
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +7 -1
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/fast-model-routing.js +1 -1
- package/dist/core/fast-model-routing.js.map +1 -1
- package/dist/core/model-config.d.ts +765 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +46 -24
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver-defaults.js +1 -1
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/resource-loader-reload.js +1 -1
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +1 -1
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/sdk-types.d.ts +4 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +48 -19
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-lifecycle-work.d.ts +3 -0
- package/dist/core/session-lifecycle-work.d.ts.map +1 -1
- package/dist/core/session-lifecycle-work.js +2 -0
- package/dist/core/session-lifecycle-work.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +7 -4
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +149 -41
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +7 -7
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-storage.d.ts +3 -2
- package/dist/core/session-manager-storage.d.ts.map +1 -1
- package/dist/core/session-manager-storage.js +25 -9
- package/dist/core/session-manager-storage.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +1 -1
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/session-manager.d.ts +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-resume-args.d.ts +4 -0
- package/dist/core/session-resume-args.d.ts.map +1 -0
- package/dist/core/session-resume-args.js +9 -0
- package/dist/core/session-resume-args.js.map +1 -0
- package/dist/core/session-storage.d.ts +26 -0
- package/dist/core/session-storage.d.ts.map +1 -0
- package/dist/core/session-storage.js +155 -0
- package/dist/core/session-storage.js.map +1 -0
- package/dist/core/session-store-list.d.ts +4 -0
- package/dist/core/session-store-list.d.ts.map +1 -0
- package/dist/core/session-store-list.js +28 -0
- package/dist/core/session-store-list.js.map +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts +0 -1
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +0 -5
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-merge.d.ts.map +1 -1
- package/dist/core/settings-merge.js +5 -0
- package/dist/core/settings-merge.js.map +1 -1
- package/dist/core/settings-schema.d.ts +74 -3
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +28 -14
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/storage/errors.d.ts +1 -0
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/storage/index.d.ts +4 -0
- package/dist/core/storage/index.d.ts.map +1 -1
- package/dist/core/storage/index.js +3 -0
- package/dist/core/storage/index.js.map +1 -1
- package/dist/core/storage/provider.d.ts +58 -0
- package/dist/core/storage/provider.d.ts.map +1 -0
- package/dist/core/storage/provider.js +243 -0
- package/dist/core/storage/provider.js.map +1 -0
- package/dist/core/storage/run-journal.d.ts +93 -0
- package/dist/core/storage/run-journal.d.ts.map +1 -0
- package/dist/core/storage/run-journal.js +15 -0
- package/dist/core/storage/run-journal.js.map +1 -0
- package/dist/core/storage/selection.d.ts +16 -0
- package/dist/core/storage/selection.d.ts.map +1 -0
- package/dist/core/storage/selection.js +87 -0
- package/dist/core/storage/selection.js.map +1 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts +2 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/jsonl-session-store.js +58 -29
- package/dist/core/storage/session/jsonl-session-store.js.map +1 -1
- package/dist/core/storage/session/legacy-format.d.ts +18 -0
- package/dist/core/storage/session/legacy-format.d.ts.map +1 -0
- package/dist/core/storage/session/legacy-format.js +63 -0
- package/dist/core/storage/session/legacy-format.js.map +1 -0
- package/dist/core/storage/session/memory-session-store.d.ts +3 -1
- package/dist/core/storage/session/memory-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/memory-session-store.js +9 -2
- package/dist/core/storage/session/memory-session-store.js.map +1 -1
- package/dist/core/storage/session/sql-session-store.d.ts +4 -1
- package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/sql-session-store.js +25 -6
- package/dist/core/storage/session/sql-session-store.js.map +1 -1
- package/dist/core/storage/session/types.d.ts +4 -0
- package/dist/core/storage/session/types.d.ts.map +1 -1
- package/dist/core/storage/session/types.js.map +1 -1
- package/dist/core/tools/read-url.d.ts.map +1 -1
- package/dist/core/tools/read-url.js +6 -1
- package/dist/core/tools/read-url.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +13 -0
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/herdr/index.d.ts.map +1 -1
- package/dist/extensions/herdr/index.js +5 -3
- package/dist/extensions/herdr/index.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts +5 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +106 -45
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +49 -15
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +3 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +15 -7
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts +4 -4
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +13 -12
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +16 -5
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +6 -2
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +19 -7
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +3 -1
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.js +8 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-args.js +5 -1
- package/dist/modes/interactive-engine/engine-args.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +21 -15
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +3 -1
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +1 -1
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-terminal-drain.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-terminal-drain.js +11 -2
- package/dist/modes/rpc/rpc-terminal-drain.js.map +1 -1
- package/dist/utils/canonical-path.d.ts +5 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +26 -0
- package/dist/utils/canonical-path.js.map +1 -0
- package/dist/utils/paths.d.ts +1 -7
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +1 -15
- package/dist/utils/paths.js.map +1 -1
- package/docs/codemode.md +2 -0
- package/docs/compaction.md +2 -2
- package/docs/docs.json +1 -0
- package/docs/environment-variables.md +6 -2
- package/docs/getting-started/installation.md +1 -1
- package/docs/models/reference.md +2 -0
- package/docs/models-configuration.md +206 -0
- package/docs/models.md +11 -1
- package/docs/providers.md +2 -2
- package/docs/reference/cli.md +4 -0
- package/docs/sdk/web-server.md +3 -3
- package/docs/sdk.md +40 -3
- package/docs/session-format.md +30 -25
- package/docs/sessions.md +41 -17
- package/docs/settings.md +31 -9
- package/docs/storage.md +85 -2
- package/docs/workflows/api-reference.md +23 -15
- package/docs/workflows/operations.md +3 -3
- package/docs/workflows/reliable-design.md +16 -16
- package/npm-shrinkwrap.json +53 -53
- package/package.json +7 -6
- package/schemas/models.schema.json +62 -29
- package/schemas/settings.schema.json +136 -31
|
@@ -6944,7 +6944,7 @@ var require_public_api = __commonJS(function(exports) {
|
|
|
6944
6944
|
});
|
|
6945
6945
|
|
|
6946
6946
|
// dist/builtin/subagents/src/extension/index.ts
|
|
6947
|
-
import * as
|
|
6947
|
+
import * as fs21 from "node:fs";
|
|
6948
6948
|
import * as os8 from "node:os";
|
|
6949
6949
|
import * as path23 from "node:path";
|
|
6950
6950
|
import {
|
|
@@ -10781,7 +10781,7 @@ function cancelledEnvelope(session, spec, stats) {
|
|
|
10781
10781
|
progressPath: spec.progressPath,
|
|
10782
10782
|
assistantText: lastNonEmptyAssistantText(session?.messages, outputFor(session)),
|
|
10783
10783
|
toolCount: stats.toolCalls,
|
|
10784
|
-
sessionPath: session?.sessionFile ?? spec.
|
|
10784
|
+
sessionPath: session?.sessionFile ?? spec.sessionManager?.getSessionFile(),
|
|
10785
10785
|
...spec.progressArtifactPath ? { progressArtifactPath: spec.progressArtifactPath } : {},
|
|
10786
10786
|
...spec.outputArtifactPath ? { outputArtifactPath: spec.outputArtifactPath } : {}
|
|
10787
10787
|
}).text;
|
|
@@ -10874,14 +10874,14 @@ class AdmittedChild {
|
|
|
10874
10874
|
spec;
|
|
10875
10875
|
policy;
|
|
10876
10876
|
sessionDir;
|
|
10877
|
-
|
|
10877
|
+
sessionManager;
|
|
10878
10878
|
control;
|
|
10879
10879
|
constructor(input) {
|
|
10880
10880
|
this.identity = input.identity;
|
|
10881
10881
|
this.spec = input.spec;
|
|
10882
10882
|
this.policy = input.policy;
|
|
10883
10883
|
this.sessionDir = input.sessionDir;
|
|
10884
|
-
this.
|
|
10884
|
+
this.sessionManager = input.sessionManager;
|
|
10885
10885
|
this.control = input.control;
|
|
10886
10886
|
}
|
|
10887
10887
|
static create(input) {
|
|
@@ -10926,7 +10926,7 @@ class SubagentControlRuntime {
|
|
|
10926
10926
|
return refusal(native);
|
|
10927
10927
|
const identity = native.child;
|
|
10928
10928
|
const childModePolicy = resolveChildModePolicy(spec);
|
|
10929
|
-
const sessionDir = spec.
|
|
10929
|
+
const sessionDir = spec.sessionManager?.getSessionDir() || sessionDirectory(this.sessionRoot, identity.path);
|
|
10930
10930
|
mkdirSync4(sessionDir, { recursive: true });
|
|
10931
10931
|
return {
|
|
10932
10932
|
admitted: AdmittedChild.create({
|
|
@@ -10947,7 +10947,7 @@ class SubagentControlRuntime {
|
|
|
10947
10947
|
depth: identity.depth
|
|
10948
10948
|
},
|
|
10949
10949
|
sessionDir,
|
|
10950
|
-
|
|
10950
|
+
sessionManager: spec.sessionManager,
|
|
10951
10951
|
control: this
|
|
10952
10952
|
})
|
|
10953
10953
|
};
|
|
@@ -11062,9 +11062,7 @@ class SubagentControlRuntime {
|
|
|
11062
11062
|
});
|
|
11063
11063
|
try {
|
|
11064
11064
|
const workflow = workflowMetadataFromContext(admitted.spec.parent?.orchestrationContext);
|
|
11065
|
-
|
|
11066
|
-
mkdirSync4(dirname7(admitted.sessionFile), { recursive: true });
|
|
11067
|
-
const sessionManager = admitted.sessionFile ? await SessionManager.open(admitted.sessionFile, admitted.sessionDir, admitted.policy.cwd) : await SessionManager.create(admitted.policy.cwd, admitted.sessionDir, workflow ? { internal: true, workflow } : { internal: true });
|
|
11065
|
+
const sessionManager = admitted.sessionManager ? await SessionManager.open(admitted.sessionManager.getSessionStore(), admitted.sessionManager.getSessionId(), admitted.policy.cwd) : await SessionManager.create(admitted.policy.cwd, admitted.sessionDir, workflow ? { internal: true, workflow } : { internal: true });
|
|
11068
11066
|
taskHooks?.bindTranscript?.(sessionManager);
|
|
11069
11067
|
if (workflow)
|
|
11070
11068
|
await sessionManager.markSessionInternal(workflow);
|
|
@@ -12522,7 +12520,7 @@ function createExecutionBurstDispatcher(input) {
|
|
|
12522
12520
|
|
|
12523
12521
|
// dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts
|
|
12524
12522
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
12525
|
-
import * as
|
|
12523
|
+
import * as fs12 from "node:fs";
|
|
12526
12524
|
import * as path13 from "node:path";
|
|
12527
12525
|
|
|
12528
12526
|
// dist/builtin/subagents/src/agents/agent-scope.ts
|
|
@@ -12533,67 +12531,71 @@ function resolveExecutionAgentScope(scope) {
|
|
|
12533
12531
|
}
|
|
12534
12532
|
|
|
12535
12533
|
// dist/builtin/subagents/src/shared/fork-context.ts
|
|
12536
|
-
import * as fs11 from "node:fs";
|
|
12537
12534
|
import { SessionManager as SessionManager2 } from "@bastani/atomic";
|
|
12535
|
+
|
|
12536
|
+
class SubagentForkContextError extends Error {
|
|
12537
|
+
parentSessionId;
|
|
12538
|
+
reason;
|
|
12539
|
+
constructor(parentSessionId, reason, options) {
|
|
12540
|
+
super(`Cannot fork subagent session ${JSON.stringify(parentSessionId)}: ${reason}`, options);
|
|
12541
|
+
this.parentSessionId = parentSessionId;
|
|
12542
|
+
this.reason = reason;
|
|
12543
|
+
this.name = "SubagentForkContextError";
|
|
12544
|
+
}
|
|
12545
|
+
}
|
|
12538
12546
|
function resolveSubagentContext(value) {
|
|
12539
12547
|
return value === "fork" ? "fork" : "fresh";
|
|
12540
12548
|
}
|
|
12541
|
-
function createForkContextResolver(sessionManager, requestedContext
|
|
12549
|
+
function createForkContextResolver(sessionManager, requestedContext) {
|
|
12542
12550
|
if (resolveSubagentContext(requestedContext) !== "fork") {
|
|
12543
|
-
return {
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
}
|
|
12547
|
-
};
|
|
12548
|
-
}
|
|
12549
|
-
const parentSessionFile = sessionManager.getSessionFile();
|
|
12550
|
-
if (!parentSessionFile) {
|
|
12551
|
-
throw new Error("Forked subagent context requires a persisted parent session.");
|
|
12551
|
+
return { sessionManagerForIndex: async () => {
|
|
12552
|
+
return;
|
|
12553
|
+
} };
|
|
12552
12554
|
}
|
|
12555
|
+
const parentSessionId = sessionManager.getSessionId();
|
|
12556
|
+
const store = sessionManager.getSessionStore();
|
|
12557
|
+
const cwd = sessionManager.getCwd();
|
|
12553
12558
|
const leafId = sessionManager.getLeafId();
|
|
12554
|
-
if (
|
|
12555
|
-
throw new
|
|
12556
|
-
|
|
12557
|
-
const openSession = options.openSession ?? sessionManager.openSession ?? ((file, dir) => SessionManager2.open(file, dir));
|
|
12558
|
-
const sessionDir = sessionManager.getSessionDir?.();
|
|
12559
|
-
const cachedSessionFiles = new Map;
|
|
12559
|
+
if (leafId === null)
|
|
12560
|
+
throw new SubagentForkContextError(parentSessionId, "no_leaf");
|
|
12561
|
+
const children = new Map;
|
|
12560
12562
|
return {
|
|
12561
|
-
|
|
12562
|
-
const cached =
|
|
12563
|
-
if (cached)
|
|
12563
|
+
sessionManagerForIndex(index = 0) {
|
|
12564
|
+
const cached = children.get(index);
|
|
12565
|
+
if (cached !== undefined)
|
|
12564
12566
|
return cached;
|
|
12565
|
-
|
|
12566
|
-
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
throw new
|
|
12573
|
-
}
|
|
12574
|
-
if (!fs11.existsSync(sessionFile)) {
|
|
12575
|
-
throw new Error(`Session manager returned a forked session file that does not exist: ${sessionFile}`);
|
|
12567
|
+
const child = (async () => {
|
|
12568
|
+
try {
|
|
12569
|
+
const source = await SessionManager2.open(store, parentSessionId, cwd);
|
|
12570
|
+
await source.createBranchedSession(leafId);
|
|
12571
|
+
return source;
|
|
12572
|
+
} catch (cause) {
|
|
12573
|
+
children.delete(index);
|
|
12574
|
+
throw new SubagentForkContextError(parentSessionId, "fork_failed", { cause });
|
|
12576
12575
|
}
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
const cause = error instanceof Error ? error : new Error(String(error));
|
|
12581
|
-
throw new Error(`Failed to create forked subagent session: ${cause.message}`, { cause });
|
|
12582
|
-
}
|
|
12576
|
+
})();
|
|
12577
|
+
children.set(index, child);
|
|
12578
|
+
return child;
|
|
12583
12579
|
}
|
|
12584
12580
|
};
|
|
12585
12581
|
}
|
|
12586
12582
|
|
|
12587
12583
|
// dist/builtin/subagents/src/shared/session-identity.ts
|
|
12584
|
+
class SubagentSessionIdentityError extends Error {
|
|
12585
|
+
constructor() {
|
|
12586
|
+
super("Current session identity is unavailable.");
|
|
12587
|
+
this.name = "SubagentSessionIdentityError";
|
|
12588
|
+
}
|
|
12589
|
+
}
|
|
12588
12590
|
function resolveCurrentSessionId(sessionManager) {
|
|
12589
|
-
const sessionId = sessionManager.
|
|
12590
|
-
if (
|
|
12591
|
-
throw new
|
|
12591
|
+
const sessionId = sessionManager.getSessionId();
|
|
12592
|
+
if (sessionId === undefined || sessionId === null)
|
|
12593
|
+
throw new SubagentSessionIdentityError;
|
|
12592
12594
|
return sessionId;
|
|
12593
12595
|
}
|
|
12594
12596
|
|
|
12595
12597
|
// dist/builtin/subagents/src/shared/settings.ts
|
|
12596
|
-
import * as
|
|
12598
|
+
import * as fs11 from "node:fs";
|
|
12597
12599
|
import * as path12 from "node:path";
|
|
12598
12600
|
function normalizeOutputOverride(output) {
|
|
12599
12601
|
return output === "false" ? false : output;
|
|
@@ -12633,8 +12635,8 @@ function buildReadInstruction(reads, cwd) {
|
|
|
12633
12635
|
return `[Read from: ${files.join(", ")}]`;
|
|
12634
12636
|
}
|
|
12635
12637
|
function writeInitialProgressFile(progressDir) {
|
|
12636
|
-
|
|
12637
|
-
|
|
12638
|
+
fs11.mkdirSync(progressDir, { recursive: true });
|
|
12639
|
+
fs11.writeFileSync(path12.join(progressDir, "progress.md"), INITIAL_PROGRESS_CONTENT);
|
|
12638
12640
|
}
|
|
12639
12641
|
function injectSingleProgressInstruction(task, progressDir) {
|
|
12640
12642
|
return `${task}
|
|
@@ -12750,11 +12752,9 @@ function prepareExecutionContext(input) {
|
|
|
12750
12752
|
|
|
12751
12753
|
${effectiveParams.task ?? ""}` };
|
|
12752
12754
|
}
|
|
12753
|
-
let
|
|
12754
|
-
return;
|
|
12755
|
-
};
|
|
12755
|
+
let sessionManagerForIndex;
|
|
12756
12756
|
try {
|
|
12757
|
-
|
|
12757
|
+
sessionManagerForIndex = createForkContextResolver(ctx.sessionManager, effectiveParams.context).sessionManagerForIndex;
|
|
12758
12758
|
} catch (error) {
|
|
12759
12759
|
return { error: toExecutionErrorResult(effectiveParams, error) };
|
|
12760
12760
|
}
|
|
@@ -12772,7 +12772,7 @@ ${effectiveParams.task ?? ""}` };
|
|
|
12772
12772
|
sessionRoot = path13.join(baseSessionRoot, runId);
|
|
12773
12773
|
}
|
|
12774
12774
|
try {
|
|
12775
|
-
|
|
12775
|
+
fs12.mkdirSync(sessionRoot, { recursive: true });
|
|
12776
12776
|
} catch (error) {
|
|
12777
12777
|
const message = error instanceof Error ? error.message : String(error);
|
|
12778
12778
|
return {
|
|
@@ -12780,7 +12780,6 @@ ${effectiveParams.task ?? ""}` };
|
|
|
12780
12780
|
};
|
|
12781
12781
|
}
|
|
12782
12782
|
const sessionDirForIndex = (idx) => path13.join(sessionRoot, `run-${idx ?? 0}`);
|
|
12783
|
-
const childSessionFileForIndex = async (idx) => await sessionFileForIndex(idx) ?? path13.join(sessionDirForIndex(idx), "session.jsonl");
|
|
12784
12783
|
const onUpdateWithContext = onUpdate ? (r) => onUpdate(withForkContext(r, effectiveParams.context)) : undefined;
|
|
12785
12784
|
const execData = {
|
|
12786
12785
|
params: effectiveParams,
|
|
@@ -12794,7 +12793,7 @@ ${effectiveParams.task ?? ""}` };
|
|
|
12794
12793
|
shareEnabled,
|
|
12795
12794
|
sessionRoot,
|
|
12796
12795
|
sessionDirForIndex,
|
|
12797
|
-
|
|
12796
|
+
sessionManagerForIndex,
|
|
12798
12797
|
artifactConfig,
|
|
12799
12798
|
artifactsDir,
|
|
12800
12799
|
parentDepth: depth,
|
|
@@ -12997,7 +12996,7 @@ async function routeSubagentModel(input) {
|
|
|
12997
12996
|
}
|
|
12998
12997
|
|
|
12999
12998
|
// dist/builtin/subagents/src/runs/shared/run-history.ts
|
|
13000
|
-
import * as
|
|
12999
|
+
import * as fs13 from "node:fs";
|
|
13001
13000
|
import * as os6 from "node:os";
|
|
13002
13001
|
import * as path14 from "node:path";
|
|
13003
13002
|
import { getAgentConfigPaths as getAgentConfigPaths4 } from "@bastani/atomic";
|
|
@@ -13012,14 +13011,14 @@ function recordRun(agent, task, status, durationMs) {
|
|
|
13012
13011
|
status,
|
|
13013
13012
|
duration: durationMs
|
|
13014
13013
|
};
|
|
13015
|
-
|
|
13016
|
-
|
|
13014
|
+
fs13.mkdirSync(path14.dirname(HISTORY_PATH), { recursive: true });
|
|
13015
|
+
fs13.appendFileSync(HISTORY_PATH, `${JSON.stringify(entry)}
|
|
13017
13016
|
`);
|
|
13018
13017
|
} catch {}
|
|
13019
13018
|
}
|
|
13020
13019
|
|
|
13021
13020
|
// dist/builtin/subagents/src/runs/shared/single-output.ts
|
|
13022
|
-
import * as
|
|
13021
|
+
import * as fs14 from "node:fs";
|
|
13023
13022
|
import * as path15 from "node:path";
|
|
13024
13023
|
function normalizeSingleOutputOverride(output, defaultOutput) {
|
|
13025
13024
|
if (output === false || output === "false")
|
|
@@ -13085,7 +13084,7 @@ function captureSingleOutputSnapshot(outputPath) {
|
|
|
13085
13084
|
if (!outputPath)
|
|
13086
13085
|
return;
|
|
13087
13086
|
try {
|
|
13088
|
-
const stat =
|
|
13087
|
+
const stat = fs14.statSync(outputPath);
|
|
13089
13088
|
return { exists: true, mtimeMs: stat.mtimeMs, size: stat.size };
|
|
13090
13089
|
} catch {
|
|
13091
13090
|
return { exists: false };
|
|
@@ -13095,8 +13094,8 @@ function persistSingleOutput(outputPath, fullOutput) {
|
|
|
13095
13094
|
if (!outputPath)
|
|
13096
13095
|
return {};
|
|
13097
13096
|
try {
|
|
13098
|
-
|
|
13099
|
-
|
|
13097
|
+
fs14.mkdirSync(path15.dirname(outputPath), { recursive: true });
|
|
13098
|
+
fs14.writeFileSync(outputPath, fullOutput, "utf-8");
|
|
13100
13099
|
return { savedPath: outputPath };
|
|
13101
13100
|
} catch (err) {
|
|
13102
13101
|
return { error: err instanceof Error ? err.message : String(err) };
|
|
@@ -13107,7 +13106,7 @@ function resolveSingleOutput(outputPath, fallbackOutput, beforeRun) {
|
|
|
13107
13106
|
return { fullOutput: fallbackOutput };
|
|
13108
13107
|
let changedSinceStart = false;
|
|
13109
13108
|
try {
|
|
13110
|
-
const stat =
|
|
13109
|
+
const stat = fs14.statSync(outputPath);
|
|
13111
13110
|
changedSinceStart = !beforeRun?.exists || stat.mtimeMs !== beforeRun.mtimeMs || stat.size !== beforeRun.size;
|
|
13112
13111
|
} catch (error) {
|
|
13113
13112
|
const code = error && typeof error === "object" && "code" in error ? error.code : undefined;
|
|
@@ -13120,7 +13119,7 @@ function resolveSingleOutput(outputPath, fallbackOutput, beforeRun) {
|
|
|
13120
13119
|
}
|
|
13121
13120
|
if (changedSinceStart) {
|
|
13122
13121
|
try {
|
|
13123
|
-
return { fullOutput:
|
|
13122
|
+
return { fullOutput: fs14.readFileSync(outputPath, "utf-8"), savedPath: outputPath };
|
|
13124
13123
|
} catch (error) {
|
|
13125
13124
|
return {
|
|
13126
13125
|
fullOutput: fallbackOutput,
|
|
@@ -13157,13 +13156,13 @@ ${params.saveError}`;
|
|
|
13157
13156
|
|
|
13158
13157
|
// dist/builtin/subagents/src/runs/shared/worktree.ts
|
|
13159
13158
|
import { spawnSync } from "node:child_process";
|
|
13160
|
-
import * as
|
|
13159
|
+
import * as fs17 from "node:fs";
|
|
13161
13160
|
import * as os7 from "node:os";
|
|
13162
13161
|
import * as path18 from "node:path";
|
|
13163
13162
|
import { createChildProcessEnvironment as createChildProcessEnvironment3, createGitEnvironment } from "@bastani/atomic";
|
|
13164
13163
|
|
|
13165
13164
|
// dist/builtin/subagents/src/runs/shared/worktree-post-create.ts
|
|
13166
|
-
import * as
|
|
13165
|
+
import * as fs15 from "node:fs";
|
|
13167
13166
|
import * as path16 from "node:path";
|
|
13168
13167
|
function tracked(runGit, repo, relativePath) {
|
|
13169
13168
|
return runGit(repo, ["ls-files", "--error-unmatch", "--", relativePath]).status === 0;
|
|
@@ -13182,10 +13181,10 @@ function hasTrackedPathComponent(runGit, repo, relativePath) {
|
|
|
13182
13181
|
function copySettings(runGit, mainRoot, worktreeRoot, relativePath) {
|
|
13183
13182
|
const source = path16.join(mainRoot, relativePath);
|
|
13184
13183
|
const destination = path16.join(worktreeRoot, relativePath);
|
|
13185
|
-
if (!
|
|
13184
|
+
if (!fs15.existsSync(source) || fs15.existsSync(destination) || hasTrackedPathComponent(runGit, worktreeRoot, relativePath))
|
|
13186
13185
|
return false;
|
|
13187
|
-
|
|
13188
|
-
|
|
13186
|
+
fs15.mkdirSync(path16.dirname(destination), { recursive: true });
|
|
13187
|
+
fs15.copyFileSync(source, destination);
|
|
13189
13188
|
return true;
|
|
13190
13189
|
}
|
|
13191
13190
|
function configureHooks(runGit, mainRoot) {
|
|
@@ -13193,12 +13192,12 @@ function configureHooks(runGit, mainRoot) {
|
|
|
13193
13192
|
const ordinary = path16.join(mainRoot, ".git", "hooks");
|
|
13194
13193
|
let desired;
|
|
13195
13194
|
try {
|
|
13196
|
-
if (
|
|
13195
|
+
if (fs15.statSync(husky).isDirectory())
|
|
13197
13196
|
desired = husky;
|
|
13198
13197
|
} catch {}
|
|
13199
13198
|
if (!desired) {
|
|
13200
13199
|
try {
|
|
13201
|
-
if (
|
|
13200
|
+
if (fs15.readdirSync(ordinary, { withFileTypes: true }).some((entry) => entry.isFile() && !entry.name.endsWith(".sample")))
|
|
13202
13201
|
desired = ordinary;
|
|
13203
13202
|
} catch {}
|
|
13204
13203
|
}
|
|
@@ -13212,7 +13211,7 @@ function configureHooks(runGit, mainRoot) {
|
|
|
13212
13211
|
throw new Error(result.stderr.trim() || "failed to configure shared core.hooksPath");
|
|
13213
13212
|
}
|
|
13214
13213
|
function copyIncludes(runGit, mainRoot, worktreeRoot) {
|
|
13215
|
-
if (!
|
|
13214
|
+
if (!fs15.existsSync(path16.join(mainRoot, ".worktreeinclude")))
|
|
13216
13215
|
return;
|
|
13217
13216
|
const ignored = runGit(mainRoot, ["ls-files", "--others", "--ignored", "--exclude-standard"]);
|
|
13218
13217
|
const included = runGit(mainRoot, ["ls-files", "--others", "--ignored", "--exclude-from=.worktreeinclude"]);
|
|
@@ -13225,10 +13224,10 @@ function copyIncludes(runGit, mainRoot, worktreeRoot) {
|
|
|
13225
13224
|
const source = path16.join(mainRoot, relativePath);
|
|
13226
13225
|
const destination = path16.join(worktreeRoot, relativePath);
|
|
13227
13226
|
try {
|
|
13228
|
-
if (!
|
|
13227
|
+
if (!fs15.statSync(source).isFile() || fs15.existsSync(destination))
|
|
13229
13228
|
continue;
|
|
13230
|
-
|
|
13231
|
-
|
|
13229
|
+
fs15.mkdirSync(path16.dirname(destination), { recursive: true });
|
|
13230
|
+
fs15.copyFileSync(source, destination);
|
|
13232
13231
|
} catch {}
|
|
13233
13232
|
}
|
|
13234
13233
|
}
|
|
@@ -13242,9 +13241,9 @@ function performPostCreationSetup(runGit, mainRoot, worktreeRoot) {
|
|
|
13242
13241
|
configureHooks(runGit, mainRoot);
|
|
13243
13242
|
const source = path16.join(mainRoot, "node_modules");
|
|
13244
13243
|
const destination = path16.join(worktreeRoot, "node_modules");
|
|
13245
|
-
if (
|
|
13244
|
+
if (fs15.existsSync(source) && !fs15.existsSync(destination) && !tracked(runGit, worktreeRoot, "node_modules")) {
|
|
13246
13245
|
try {
|
|
13247
|
-
|
|
13246
|
+
fs15.symlinkSync(source, destination, process.platform === "win32" ? "junction" : undefined);
|
|
13248
13247
|
synthetic.push("node_modules");
|
|
13249
13248
|
} catch {}
|
|
13250
13249
|
}
|
|
@@ -13253,19 +13252,19 @@ function performPostCreationSetup(runGit, mainRoot, worktreeRoot) {
|
|
|
13253
13252
|
}
|
|
13254
13253
|
|
|
13255
13254
|
// dist/builtin/subagents/src/runs/shared/worktree-root.ts
|
|
13256
|
-
import * as
|
|
13255
|
+
import * as fs16 from "node:fs";
|
|
13257
13256
|
import * as path17 from "node:path";
|
|
13258
13257
|
function readText(file) {
|
|
13259
13258
|
try {
|
|
13260
|
-
return
|
|
13259
|
+
return fs16.readFileSync(file, "utf8");
|
|
13261
13260
|
} catch {
|
|
13262
13261
|
return;
|
|
13263
13262
|
}
|
|
13264
13263
|
}
|
|
13265
13264
|
function samePath(left, right) {
|
|
13266
13265
|
try {
|
|
13267
|
-
const a =
|
|
13268
|
-
const b =
|
|
13266
|
+
const a = fs16.realpathSync.native(left);
|
|
13267
|
+
const b = fs16.realpathSync.native(right);
|
|
13269
13268
|
return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
13270
13269
|
} catch {
|
|
13271
13270
|
return false;
|
|
@@ -13274,14 +13273,14 @@ function samePath(left, right) {
|
|
|
13274
13273
|
function findGitRoot(cwd) {
|
|
13275
13274
|
let current = path17.resolve(cwd);
|
|
13276
13275
|
try {
|
|
13277
|
-
if (!
|
|
13276
|
+
if (!fs16.statSync(current).isDirectory())
|
|
13278
13277
|
current = path17.dirname(current);
|
|
13279
13278
|
} catch {
|
|
13280
13279
|
return;
|
|
13281
13280
|
}
|
|
13282
13281
|
while (true) {
|
|
13283
13282
|
try {
|
|
13284
|
-
const entry =
|
|
13283
|
+
const entry = fs16.statSync(path17.join(current, ".git"));
|
|
13285
13284
|
if (entry.isDirectory() || entry.isFile())
|
|
13286
13285
|
return current;
|
|
13287
13286
|
} catch {}
|
|
@@ -13295,7 +13294,7 @@ function resolveMainRepoRoot(repoRoot) {
|
|
|
13295
13294
|
const gitEntry = path17.join(repoRoot, ".git");
|
|
13296
13295
|
let stats;
|
|
13297
13296
|
try {
|
|
13298
|
-
stats =
|
|
13297
|
+
stats = fs16.statSync(gitEntry);
|
|
13299
13298
|
} catch {
|
|
13300
13299
|
return;
|
|
13301
13300
|
}
|
|
@@ -13382,7 +13381,7 @@ function resolveRepoState(cwd) {
|
|
|
13382
13381
|
function normalizeComparableCwd(cwd) {
|
|
13383
13382
|
const resolved = path18.resolve(cwd);
|
|
13384
13383
|
try {
|
|
13385
|
-
return
|
|
13384
|
+
return fs17.realpathSync(resolved);
|
|
13386
13385
|
} catch {
|
|
13387
13386
|
return resolved;
|
|
13388
13387
|
}
|
|
@@ -13417,8 +13416,8 @@ function buildWorktreePath(mainRoot, runId, index) {
|
|
|
13417
13416
|
}
|
|
13418
13417
|
function ensureWorktreeIgnore(mainRoot) {
|
|
13419
13418
|
const root = path18.join(mainRoot, ".atomic", "worktrees");
|
|
13420
|
-
|
|
13421
|
-
|
|
13419
|
+
fs17.mkdirSync(root, { recursive: true });
|
|
13420
|
+
fs17.writeFileSync(path18.join(root, ".gitignore"), `*
|
|
13422
13421
|
`, "utf8");
|
|
13423
13422
|
}
|
|
13424
13423
|
function resolveRepoCwdRelative(cwd) {
|
|
@@ -13454,10 +13453,10 @@ function resolveWorktreeSetupHook(repoRoot, config) {
|
|
|
13454
13453
|
} else {
|
|
13455
13454
|
throw new Error("worktree setup hook must be an absolute path or a repo-relative path");
|
|
13456
13455
|
}
|
|
13457
|
-
if (!
|
|
13456
|
+
if (!fs17.existsSync(resolvedPath)) {
|
|
13458
13457
|
throw new Error(`worktree setup hook not found: ${resolvedPath}`);
|
|
13459
13458
|
}
|
|
13460
|
-
if (
|
|
13459
|
+
if (fs17.statSync(resolvedPath).isDirectory()) {
|
|
13461
13460
|
throw new Error(`worktree setup hook must be a file, got directory: ${resolvedPath}`);
|
|
13462
13461
|
}
|
|
13463
13462
|
return {
|
|
@@ -13604,7 +13603,7 @@ function removeSyntheticPath(worktree, syntheticPath) {
|
|
|
13604
13603
|
}
|
|
13605
13604
|
let stat;
|
|
13606
13605
|
try {
|
|
13607
|
-
stat =
|
|
13606
|
+
stat = fs17.lstatSync(resolved);
|
|
13608
13607
|
} catch (error) {
|
|
13609
13608
|
const code = error && typeof error === "object" && "code" in error ? error.code : undefined;
|
|
13610
13609
|
if (code === "ENOENT")
|
|
@@ -13612,14 +13611,14 @@ function removeSyntheticPath(worktree, syntheticPath) {
|
|
|
13612
13611
|
throw error;
|
|
13613
13612
|
}
|
|
13614
13613
|
if (stat.isSymbolicLink()) {
|
|
13615
|
-
|
|
13614
|
+
fs17.unlinkSync(resolved);
|
|
13616
13615
|
return;
|
|
13617
13616
|
}
|
|
13618
13617
|
if (stat.isDirectory()) {
|
|
13619
|
-
|
|
13618
|
+
fs17.rmSync(resolved, { recursive: true, force: true });
|
|
13620
13619
|
return;
|
|
13621
13620
|
}
|
|
13622
|
-
|
|
13621
|
+
fs17.rmSync(resolved, { force: true });
|
|
13623
13622
|
}
|
|
13624
13623
|
function removeSyntheticPathsBeforeDiff(worktree) {
|
|
13625
13624
|
if (worktree.syntheticPaths.length === 0)
|
|
@@ -13668,7 +13667,7 @@ function captureWorktreeDiff(setup, worktree, agent, patchPath) {
|
|
|
13668
13667
|
const diffStat = runGitChecked(worktree.path, ["diff", "--cached", "--stat", setup.baseCommit]).trim();
|
|
13669
13668
|
const patch = runGitChecked(worktree.path, ["diff", "--cached", setup.baseCommit]);
|
|
13670
13669
|
const numstat = runGitChecked(worktree.path, ["diff", "--cached", "--numstat", setup.baseCommit]);
|
|
13671
|
-
|
|
13670
|
+
fs17.writeFileSync(patchPath, patch, "utf-8");
|
|
13672
13671
|
if (!patch.trim()) {
|
|
13673
13672
|
return emptyDiff(worktree.index, agent, worktree.branch, patchPath);
|
|
13674
13673
|
}
|
|
@@ -13686,7 +13685,7 @@ function captureWorktreeDiff(setup, worktree, agent, patchPath) {
|
|
|
13686
13685
|
}
|
|
13687
13686
|
function writeEmptyPatch(patchPath) {
|
|
13688
13687
|
try {
|
|
13689
|
-
|
|
13688
|
+
fs17.writeFileSync(patchPath, "", "utf-8");
|
|
13690
13689
|
} catch {}
|
|
13691
13690
|
}
|
|
13692
13691
|
function hasWorktreeChanges(diff) {
|
|
@@ -13709,7 +13708,7 @@ function createWorktrees(cwd, runId, count, options) {
|
|
|
13709
13708
|
}
|
|
13710
13709
|
function diffWorktrees(setup, agents, diffsDir) {
|
|
13711
13710
|
try {
|
|
13712
|
-
|
|
13711
|
+
fs17.mkdirSync(diffsDir, { recursive: true });
|
|
13713
13712
|
} catch {
|
|
13714
13713
|
return [];
|
|
13715
13714
|
}
|
|
@@ -13936,7 +13935,7 @@ async function runForegroundParallelTasks(input) {
|
|
|
13936
13935
|
runId: input.runId,
|
|
13937
13936
|
index,
|
|
13938
13937
|
sessionDir: input.sessionDirForIndex(index),
|
|
13939
|
-
|
|
13938
|
+
sessionManager: await input.sessionManagerForIndex(index),
|
|
13940
13939
|
share: input.shareEnabled,
|
|
13941
13940
|
artifactsDir: input.artifactConfig.enabled ? input.artifactsDir : undefined,
|
|
13942
13941
|
artifactConfig: input.artifactConfig,
|
|
@@ -14509,7 +14508,7 @@ async function runParallelPath(data, deps) {
|
|
|
14509
14508
|
signal,
|
|
14510
14509
|
runId,
|
|
14511
14510
|
sessionDirForIndex,
|
|
14512
|
-
|
|
14511
|
+
sessionManagerForIndex,
|
|
14513
14512
|
shareEnabled,
|
|
14514
14513
|
artifactConfig,
|
|
14515
14514
|
artifactsDir,
|
|
@@ -14661,7 +14660,7 @@ async function runParallelPath(data, deps) {
|
|
|
14661
14660
|
signal,
|
|
14662
14661
|
runId,
|
|
14663
14662
|
sessionDirForIndex,
|
|
14664
|
-
|
|
14663
|
+
sessionManagerForIndex,
|
|
14665
14664
|
shareEnabled,
|
|
14666
14665
|
artifactConfig,
|
|
14667
14666
|
artifactsDir,
|
|
@@ -14783,7 +14782,7 @@ ${worktreeSuffix}` : childContent;
|
|
|
14783
14782
|
}
|
|
14784
14783
|
|
|
14785
14784
|
// dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts
|
|
14786
|
-
import { existsSync as
|
|
14785
|
+
import { existsSync as existsSync14, statSync as statSync9 } from "node:fs";
|
|
14787
14786
|
import { join as join20 } from "node:path";
|
|
14788
14787
|
|
|
14789
14788
|
// dist/builtin/subagents/src/runs/shared/model-candidate-filter.ts
|
|
@@ -15092,7 +15091,7 @@ function noSpawnableCandidatesResult(agent, task, skippedAttempts) {
|
|
|
15092
15091
|
}
|
|
15093
15092
|
async function runSingleInProcess(runtimeCwd, agent, task, options) {
|
|
15094
15093
|
const cwd = options.cwd ?? runtimeCwd;
|
|
15095
|
-
if (!
|
|
15094
|
+
if (!existsSync14(cwd))
|
|
15096
15095
|
return refusedResult(agent, task, `cwd does not exist: ${cwd}`);
|
|
15097
15096
|
if (!statSync9(cwd).isDirectory())
|
|
15098
15097
|
return refusedResult(agent, task, `cwd is not a directory: ${cwd}`);
|
|
@@ -15153,7 +15152,7 @@ ${task}`);
|
|
|
15153
15152
|
agent,
|
|
15154
15153
|
cwd,
|
|
15155
15154
|
testSession,
|
|
15156
|
-
|
|
15155
|
+
sessionManager: options.sessionManager,
|
|
15157
15156
|
...options.progressPath ? { progressPath: options.progressPath } : {},
|
|
15158
15157
|
...options.progressArtifactPath ? { progressArtifactPath: options.progressArtifactPath } : options.progressPath && artifactsDir ? { progressArtifactPath: options.progressPath } : {},
|
|
15159
15158
|
...artifactPaths?.outputPath ? { outputArtifactPath: artifactPaths.outputPath } : {},
|
|
@@ -15398,7 +15397,7 @@ function resolveSubagentExecutorRuntimeDeps(overrides) {
|
|
|
15398
15397
|
}
|
|
15399
15398
|
|
|
15400
15399
|
// dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts
|
|
15401
|
-
import * as
|
|
15400
|
+
import * as fs18 from "node:fs";
|
|
15402
15401
|
import * as path20 from "node:path";
|
|
15403
15402
|
function formatFailedSingleRunOutput(result, displayOutput) {
|
|
15404
15403
|
const error = result.error || "Failed";
|
|
@@ -15417,7 +15416,7 @@ function cleanupTransientProgress(progressDir, artifactsEnabled) {
|
|
|
15417
15416
|
if (!progressDir || artifactsEnabled)
|
|
15418
15417
|
return;
|
|
15419
15418
|
try {
|
|
15420
|
-
|
|
15419
|
+
fs18.rmSync(progressDir, { recursive: true, force: true });
|
|
15421
15420
|
} catch {}
|
|
15422
15421
|
}
|
|
15423
15422
|
function createForwardSingleUpdate(onUpdate, foregroundControl, agent, index) {
|
|
@@ -15450,7 +15449,7 @@ async function runSinglePath(data, deps) {
|
|
|
15450
15449
|
signal,
|
|
15451
15450
|
runId,
|
|
15452
15451
|
sessionDirForIndex,
|
|
15453
|
-
|
|
15452
|
+
sessionManagerForIndex,
|
|
15454
15453
|
shareEnabled,
|
|
15455
15454
|
artifactConfig,
|
|
15456
15455
|
artifactsDir,
|
|
@@ -15547,7 +15546,7 @@ async function runSinglePath(data, deps) {
|
|
|
15547
15546
|
intercomEvents: deps.pi.events,
|
|
15548
15547
|
runId,
|
|
15549
15548
|
sessionDir: sessionDirForIndex(0),
|
|
15550
|
-
|
|
15549
|
+
sessionManager: await sessionManagerForIndex(0),
|
|
15551
15550
|
share: shareEnabled,
|
|
15552
15551
|
artifactsDir: artifactConfig.enabled ? artifactsDir : undefined,
|
|
15553
15552
|
artifactConfig,
|
|
@@ -17515,13 +17514,13 @@ function renderSubagentResult(result, options, theme) {
|
|
|
17515
17514
|
return appendParentAskOutput(c, handoffOutput, theme);
|
|
17516
17515
|
}
|
|
17517
17516
|
// dist/builtin/subagents/src/extension/config.ts
|
|
17518
|
-
import * as
|
|
17517
|
+
import * as fs19 from "node:fs";
|
|
17519
17518
|
import { getAgentConfigPaths as getAgentConfigPaths5 } from "@bastani/atomic";
|
|
17520
17519
|
function loadConfig() {
|
|
17521
17520
|
for (const configPath of getAgentConfigPaths5("extensions", "subagent", "config.json")) {
|
|
17522
17521
|
try {
|
|
17523
|
-
if (
|
|
17524
|
-
return JSON.parse(
|
|
17522
|
+
if (fs19.existsSync(configPath)) {
|
|
17523
|
+
return JSON.parse(fs19.readFileSync(configPath, "utf-8"));
|
|
17525
17524
|
}
|
|
17526
17525
|
} catch (error) {
|
|
17527
17526
|
console.error(`Failed to load subagent config from '${configPath}':`, error);
|
|
@@ -17953,11 +17952,11 @@ function getApiScopedSet(pi, key) {
|
|
|
17953
17952
|
import * as path22 from "node:path";
|
|
17954
17953
|
|
|
17955
17954
|
// dist/builtin/subagents/src/runs/inprocess/runtime-support/temp-cleanup.ts
|
|
17956
|
-
import * as
|
|
17955
|
+
import * as fs20 from "node:fs";
|
|
17957
17956
|
import * as path21 from "node:path";
|
|
17958
17957
|
var SUBAGENT_RUNTIME_TEMP_DIR = path21.join(TEMP_ROOT_DIR, "nested-subagent-events");
|
|
17959
17958
|
function hasEntryNewerThan(filePath, cutoff) {
|
|
17960
|
-
const stat =
|
|
17959
|
+
const stat = fs20.statSync(filePath);
|
|
17961
17960
|
if (stat.mtimeMs >= cutoff)
|
|
17962
17961
|
return true;
|
|
17963
17962
|
if (!stat.isDirectory())
|
|
@@ -17967,14 +17966,14 @@ function hasEntryNewerThan(filePath, cutoff) {
|
|
|
17967
17966
|
function directoryHasEntryNewerThan(dirPath, cutoff) {
|
|
17968
17967
|
let entries;
|
|
17969
17968
|
try {
|
|
17970
|
-
entries =
|
|
17969
|
+
entries = fs20.readdirSync(dirPath);
|
|
17971
17970
|
} catch {
|
|
17972
17971
|
return false;
|
|
17973
17972
|
}
|
|
17974
17973
|
for (const entry of entries) {
|
|
17975
17974
|
const childPath = path21.join(dirPath, entry);
|
|
17976
17975
|
try {
|
|
17977
|
-
const stat =
|
|
17976
|
+
const stat = fs20.statSync(childPath);
|
|
17978
17977
|
if (stat.mtimeMs >= cutoff)
|
|
17979
17978
|
return true;
|
|
17980
17979
|
if (stat.isDirectory() && directoryHasEntryNewerThan(childPath, cutoff))
|
|
@@ -17986,7 +17985,7 @@ function directoryHasEntryNewerThan(dirPath, cutoff) {
|
|
|
17986
17985
|
function cleanupOldSubdirectories(root, maxAgeDays) {
|
|
17987
17986
|
let entries;
|
|
17988
17987
|
try {
|
|
17989
|
-
entries =
|
|
17988
|
+
entries = fs20.readdirSync(root);
|
|
17990
17989
|
} catch (error) {
|
|
17991
17990
|
if (error.code === "ENOENT")
|
|
17992
17991
|
return;
|
|
@@ -17997,7 +17996,7 @@ function cleanupOldSubdirectories(root, maxAgeDays) {
|
|
|
17997
17996
|
const entryPath = path21.join(root, entry);
|
|
17998
17997
|
try {
|
|
17999
17998
|
if (!hasEntryNewerThan(entryPath, cutoff))
|
|
18000
|
-
|
|
17999
|
+
fs20.rmSync(entryPath, { recursive: true, force: true });
|
|
18001
18000
|
} catch {}
|
|
18002
18001
|
}
|
|
18003
18002
|
}
|
|
@@ -18102,7 +18101,7 @@ function getSubagentSessionRoot(parentSessionFile) {
|
|
|
18102
18101
|
const sessionsDir = path23.dirname(parentSessionFile);
|
|
18103
18102
|
return path23.join(sessionsDir, baseName);
|
|
18104
18103
|
}
|
|
18105
|
-
return
|
|
18104
|
+
return fs21.mkdtempSync(path23.join(os8.tmpdir(), `${APP_NAME3}-subagent-session-`));
|
|
18106
18105
|
}
|
|
18107
18106
|
function expandTilde2(p) {
|
|
18108
18107
|
return p.startsWith("~/") ? path23.join(os8.homedir(), p.slice(2)) : p;
|