@bastani/atomic 0.9.31 → 0.9.32-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 +6 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +6 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +8 -9
- package/dist/builtin/workflows/src/index.js +8 -9
- package/dist/core/builtin-resource-loader.d.ts.map +1 -1
- package/dist/core/builtin-resource-loader.js +1 -1
- package/dist/core/builtin-resource-loader.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +1 -0
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/docs/sdk.md +3 -1
- package/docs/workflows/api-reference.md +2 -0
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.9.32-alpha.1] - 2026-10-10
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Fixed workflow stages in SDK-hosted sessions losing extensions supplied through `additionalExtensionPaths` and `extensionFactories`, and using the host process directory instead of the owning session's working directory when no stage `cwd` is set. Stage reports use that same resolved directory ([#3551](https://github.com/bastani-inc/atomic/issues/3551)).
|
|
10
|
+
|
|
5
11
|
## [0.9.31] - 2026-10-09
|
|
6
12
|
|
|
7
13
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/intercom",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.32-alpha.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
|
|
6
6
|
"contributors": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/subagents",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.32-alpha.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
|
|
6
6
|
"contributors": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/web-access",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.32-alpha.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
|
|
6
6
|
"contributors": [
|
|
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.9.32-alpha.1] - 2026-10-10
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed stages without an explicit `cwd` running in the host process directory instead of the workflow invocation directory in SDK-hosted sessions. Stage reports now use the same resolved directory as their sessions, including adapter and session-manager overrides ([#3551](https://github.com/bastani-inc/atomic/issues/3551)).
|
|
14
|
+
|
|
9
15
|
## [0.9.29] - 2026-10-09
|
|
10
16
|
|
|
11
17
|
### Added
|
|
@@ -106564,7 +106564,7 @@ class StageSessionController {
|
|
|
106564
106564
|
restoreSavedModel: resumeOptions?.restoreSavedModel,
|
|
106565
106565
|
reattachSessionFile: this.reattachSessionFile,
|
|
106566
106566
|
sharedModelRuntime: this.sharedModelRuntime,
|
|
106567
|
-
defaultCwd:
|
|
106567
|
+
defaultCwd: this.opts.defaultCwd
|
|
106568
106568
|
});
|
|
106569
106569
|
if (stageOptions && this.modelRoute)
|
|
106570
106570
|
stageOptions.isFallbackModelAllowed = this.modelRoute.allowsModel;
|
|
@@ -107125,6 +107125,7 @@ ${reference}`;
|
|
|
107125
107125
|
// dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts
|
|
107126
107126
|
function createStageContext2(opts) {
|
|
107127
107127
|
const { stageId, stageName, adapters, runId, workflowIntercomGroup, signal, stageOptions, executionMode } = opts;
|
|
107128
|
+
const stageCwd = stageOptions?.cwd ?? stageOptions?.sessionManager?.getCwd() ?? agentSessionAdapterDefaultCwd(adapters.agentSession) ?? opts.defaultCwd ?? process.cwd();
|
|
107128
107129
|
const structuredOutputCapture = stageOptions?.schema ? createStructuredOutputCapture() : undefined;
|
|
107129
107130
|
const structuredOutputExecutionCapture = stageOptions?.schema ? {} : undefined;
|
|
107130
107131
|
const effectiveStageOptions = stageOptionsWithStructuredOutput(stageOptions, structuredOutputCapture, structuredOutputExecutionCapture);
|
|
@@ -107137,7 +107138,7 @@ function createStageContext2(opts) {
|
|
|
107137
107138
|
stageOptions: effectiveStageOptions,
|
|
107138
107139
|
executionMode
|
|
107139
107140
|
};
|
|
107140
|
-
const controller = new StageSessionController(opts, meta, effectiveStageOptions, structuredOutputCapture);
|
|
107141
|
+
const controller = new StageSessionController({ ...opts, defaultCwd: stageCwd }, meta, effectiveStageOptions, structuredOutputCapture);
|
|
107141
107142
|
let lastAssistantText;
|
|
107142
107143
|
let lastFinalizedOutput;
|
|
107143
107144
|
let lastFinalizedMessageCount;
|
|
@@ -107150,15 +107151,12 @@ function createStageContext2(opts) {
|
|
|
107150
107151
|
async function exportArtifact() {
|
|
107151
107152
|
const text = assistantArtifactTextForGeneration(controller.outputGenerationMessages());
|
|
107152
107153
|
if (text !== artifactText || lastFinalizedOutput === undefined) {
|
|
107153
|
-
lastFinalizedOutput = await finalizePromptOutput(text, artifactOptions,
|
|
107154
|
+
lastFinalizedOutput = await finalizePromptOutput(text, artifactOptions, stageCwd, runId, controller.currentSession?.messages);
|
|
107154
107155
|
artifactText = text;
|
|
107155
107156
|
lastAssistantText = lastFinalizedOutput;
|
|
107156
107157
|
}
|
|
107157
107158
|
return lastFinalizedOutput;
|
|
107158
107159
|
}
|
|
107159
|
-
function runtimeCwd() {
|
|
107160
|
-
return typeof effectiveStageOptions?.cwd === "string" ? effectiveStageOptions.cwd : process.cwd();
|
|
107161
|
-
}
|
|
107162
107160
|
function finalizedOutputIsCurrent() {
|
|
107163
107161
|
if (lastFinalizedOutput === undefined)
|
|
107164
107162
|
return false;
|
|
@@ -107199,7 +107197,7 @@ function createStageContext2(opts) {
|
|
|
107199
107197
|
if (typeof rawText !== "string")
|
|
107200
107198
|
return rawText;
|
|
107201
107199
|
adapterMessages = assistantMessage(rawText);
|
|
107202
|
-
lastAssistantText = await finalizePromptOutput(rawText, outputOptions,
|
|
107200
|
+
lastAssistantText = await finalizePromptOutput(rawText, outputOptions, stageCwd, runId, adapterMessages);
|
|
107203
107201
|
lastFinalizedOutput = lastAssistantText;
|
|
107204
107202
|
lastFinalizedMessageCount = controller.currentSession?.messages.length;
|
|
107205
107203
|
return lastAssistantText;
|
|
@@ -107241,7 +107239,7 @@ ${nextPrompt}`;
|
|
|
107241
107239
|
throw new Error("atomic-workflows: structured_output completed without an execution snapshot; the successful tool call could not be paired with its result.");
|
|
107242
107240
|
}
|
|
107243
107241
|
const rawOutputText = hasOutputArtifact ? assistantArtifactTextForToolCall(sessionMessages ?? [], executionSnapshot.toolCallId) ?? "" : stringifyStructuredOutputValue(executionSnapshot.value);
|
|
107244
|
-
lastAssistantText = await finalizePromptOutput(rawOutputText, outputOptions,
|
|
107242
|
+
lastAssistantText = await finalizePromptOutput(rawOutputText, outputOptions, stageCwd, runId, sessionMessages);
|
|
107245
107243
|
lastFinalizedOutput = lastAssistantText;
|
|
107246
107244
|
lastFinalizedMessageCount = controller.currentSession?.messages.length;
|
|
107247
107245
|
if (hasOutputArtifact)
|
|
@@ -107252,7 +107250,7 @@ ${nextPrompt}`;
|
|
|
107252
107250
|
if (artifactOptions)
|
|
107253
107251
|
return await exportArtifact();
|
|
107254
107252
|
const rawText = controller.lastAssistantText(lastAssistantText) ?? "";
|
|
107255
|
-
lastAssistantText = await finalizePromptOutput(rawText, outputOptions,
|
|
107253
|
+
lastAssistantText = await finalizePromptOutput(rawText, outputOptions, stageCwd, runId, controller.currentSession?.messages);
|
|
107256
107254
|
lastFinalizedOutput = lastAssistantText;
|
|
107257
107255
|
lastFinalizedMessageCount = controller.currentSession?.messages.length;
|
|
107258
107256
|
return lastAssistantText;
|
|
@@ -107604,6 +107602,7 @@ function createWorkflowStageFactory(input) {
|
|
|
107604
107602
|
models: input.opts.models,
|
|
107605
107603
|
executionMode: input.opts.executionMode,
|
|
107606
107604
|
defaultSessionDir: input.opts.defaultSessionDir,
|
|
107605
|
+
defaultCwd: input.workflowInvocationCwd,
|
|
107607
107606
|
onStartupChange(startup) {
|
|
107608
107607
|
const current = input.activeStore.runs().find((run) => run.id === input.runId);
|
|
107609
107608
|
if (!current?.stages.includes(stageSnapshot))
|
|
@@ -55750,7 +55750,7 @@ class StageSessionController {
|
|
|
55750
55750
|
restoreSavedModel: resumeOptions?.restoreSavedModel,
|
|
55751
55751
|
reattachSessionFile: this.reattachSessionFile,
|
|
55752
55752
|
sharedModelRuntime: this.sharedModelRuntime,
|
|
55753
|
-
defaultCwd:
|
|
55753
|
+
defaultCwd: this.opts.defaultCwd
|
|
55754
55754
|
});
|
|
55755
55755
|
if (stageOptions && this.modelRoute)
|
|
55756
55756
|
stageOptions.isFallbackModelAllowed = this.modelRoute.allowsModel;
|
|
@@ -56311,6 +56311,7 @@ ${reference}`;
|
|
|
56311
56311
|
// dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts
|
|
56312
56312
|
function createStageContext2(opts) {
|
|
56313
56313
|
const { stageId, stageName, adapters, runId, workflowIntercomGroup, signal, stageOptions, executionMode } = opts;
|
|
56314
|
+
const stageCwd = stageOptions?.cwd ?? stageOptions?.sessionManager?.getCwd() ?? agentSessionAdapterDefaultCwd(adapters.agentSession) ?? opts.defaultCwd ?? process.cwd();
|
|
56314
56315
|
const structuredOutputCapture = stageOptions?.schema ? createStructuredOutputCapture() : undefined;
|
|
56315
56316
|
const structuredOutputExecutionCapture = stageOptions?.schema ? {} : undefined;
|
|
56316
56317
|
const effectiveStageOptions = stageOptionsWithStructuredOutput(stageOptions, structuredOutputCapture, structuredOutputExecutionCapture);
|
|
@@ -56323,7 +56324,7 @@ function createStageContext2(opts) {
|
|
|
56323
56324
|
stageOptions: effectiveStageOptions,
|
|
56324
56325
|
executionMode
|
|
56325
56326
|
};
|
|
56326
|
-
const controller = new StageSessionController(opts, meta, effectiveStageOptions, structuredOutputCapture);
|
|
56327
|
+
const controller = new StageSessionController({ ...opts, defaultCwd: stageCwd }, meta, effectiveStageOptions, structuredOutputCapture);
|
|
56327
56328
|
let lastAssistantText;
|
|
56328
56329
|
let lastFinalizedOutput;
|
|
56329
56330
|
let lastFinalizedMessageCount;
|
|
@@ -56336,15 +56337,12 @@ function createStageContext2(opts) {
|
|
|
56336
56337
|
async function exportArtifact() {
|
|
56337
56338
|
const text = assistantArtifactTextForGeneration(controller.outputGenerationMessages());
|
|
56338
56339
|
if (text !== artifactText || lastFinalizedOutput === undefined) {
|
|
56339
|
-
lastFinalizedOutput = await finalizePromptOutput(text, artifactOptions,
|
|
56340
|
+
lastFinalizedOutput = await finalizePromptOutput(text, artifactOptions, stageCwd, runId, controller.currentSession?.messages);
|
|
56340
56341
|
artifactText = text;
|
|
56341
56342
|
lastAssistantText = lastFinalizedOutput;
|
|
56342
56343
|
}
|
|
56343
56344
|
return lastFinalizedOutput;
|
|
56344
56345
|
}
|
|
56345
|
-
function runtimeCwd() {
|
|
56346
|
-
return typeof effectiveStageOptions?.cwd === "string" ? effectiveStageOptions.cwd : process.cwd();
|
|
56347
|
-
}
|
|
56348
56346
|
function finalizedOutputIsCurrent() {
|
|
56349
56347
|
if (lastFinalizedOutput === undefined)
|
|
56350
56348
|
return false;
|
|
@@ -56385,7 +56383,7 @@ function createStageContext2(opts) {
|
|
|
56385
56383
|
if (typeof rawText !== "string")
|
|
56386
56384
|
return rawText;
|
|
56387
56385
|
adapterMessages = assistantMessage(rawText);
|
|
56388
|
-
lastAssistantText = await finalizePromptOutput(rawText, outputOptions,
|
|
56386
|
+
lastAssistantText = await finalizePromptOutput(rawText, outputOptions, stageCwd, runId, adapterMessages);
|
|
56389
56387
|
lastFinalizedOutput = lastAssistantText;
|
|
56390
56388
|
lastFinalizedMessageCount = controller.currentSession?.messages.length;
|
|
56391
56389
|
return lastAssistantText;
|
|
@@ -56427,7 +56425,7 @@ ${nextPrompt}`;
|
|
|
56427
56425
|
throw new Error("atomic-workflows: structured_output completed without an execution snapshot; the successful tool call could not be paired with its result.");
|
|
56428
56426
|
}
|
|
56429
56427
|
const rawOutputText = hasOutputArtifact ? assistantArtifactTextForToolCall(sessionMessages ?? [], executionSnapshot.toolCallId) ?? "" : stringifyStructuredOutputValue(executionSnapshot.value);
|
|
56430
|
-
lastAssistantText = await finalizePromptOutput(rawOutputText, outputOptions,
|
|
56428
|
+
lastAssistantText = await finalizePromptOutput(rawOutputText, outputOptions, stageCwd, runId, sessionMessages);
|
|
56431
56429
|
lastFinalizedOutput = lastAssistantText;
|
|
56432
56430
|
lastFinalizedMessageCount = controller.currentSession?.messages.length;
|
|
56433
56431
|
if (hasOutputArtifact)
|
|
@@ -56438,7 +56436,7 @@ ${nextPrompt}`;
|
|
|
56438
56436
|
if (artifactOptions)
|
|
56439
56437
|
return await exportArtifact();
|
|
56440
56438
|
const rawText = controller.lastAssistantText(lastAssistantText) ?? "";
|
|
56441
|
-
lastAssistantText = await finalizePromptOutput(rawText, outputOptions,
|
|
56439
|
+
lastAssistantText = await finalizePromptOutput(rawText, outputOptions, stageCwd, runId, controller.currentSession?.messages);
|
|
56442
56440
|
lastFinalizedOutput = lastAssistantText;
|
|
56443
56441
|
lastFinalizedMessageCount = controller.currentSession?.messages.length;
|
|
56444
56442
|
return lastAssistantText;
|
|
@@ -56790,6 +56788,7 @@ function createWorkflowStageFactory(input) {
|
|
|
56790
56788
|
models: input.opts.models,
|
|
56791
56789
|
executionMode: input.opts.executionMode,
|
|
56792
56790
|
defaultSessionDir: input.opts.defaultSessionDir,
|
|
56791
|
+
defaultCwd: input.workflowInvocationCwd,
|
|
56793
56792
|
onStartupChange(startup) {
|
|
56794
56793
|
const current = input.activeStore.runs().find((run) => run.id === input.runId);
|
|
56795
56794
|
if (!current?.stages.includes(stageSnapshot))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-resource-loader.d.ts","sourceRoot":"","sources":["../../src/core/builtin-resource-loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEX,cAAc,EAGd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"builtin-resource-loader.d.ts","sourceRoot":"","sources":["../../src/core/builtin-resource-loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEX,cAAc,EAGd,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA+RpD,wBAAsB,yBAAyB,CAC9C,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,EAClD,wBAAwB,UAAQ,GAC9B,OAAO,CAAC,cAAc,CAAC,CAWzB"}
|
|
@@ -117,7 +117,7 @@ class BuiltinResourceLoader {
|
|
|
117
117
|
get: () => mergeWorkflows(this.delegate.getWorkflowResources?.() ?? []),
|
|
118
118
|
refresh: async () => mergeWorkflows((await this.delegate.refreshWorkflowResources?.()) ?? this.delegate.getWorkflowResources?.() ?? []),
|
|
119
119
|
getMcpServers: () => this.delegate.getMcpServerContributions?.() ?? [],
|
|
120
|
-
}, target.runtime);
|
|
120
|
+
}, target.runtime, () => this.delegate.getInheritanceSnapshot?.() ?? {});
|
|
121
121
|
for (const extension of loaded.extensions)
|
|
122
122
|
markTrustedMandatoryRuntimeExtension(extension);
|
|
123
123
|
this.extensions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-resource-loader.js","sourceRoot":"","sources":["../../src/core/builtin-resource-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE5G,OAAO,EAAE,oCAAoC,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAyB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAQ7D,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACxH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,SAAS,SAAS,CAAC,IAAY;IAC9B,IAAI,CAAC;QACJ,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAED,4FAA4F;AAC5F,MAAM,qBAAqB;IAClB,UAAU,CAAwB;IAClC,MAA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EAAE,KAAK;QAEjF,OAAO,MAAM,CAAC;IACf,MAAM,QAAQ,GAAG,IAAI,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,wBAAwB,CAAC,CAAC;IACtG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC5B,OAAO,QAAQ,CAAC;AACjB,CAAC","sourcesContent":["import { realpathSync } from \"node:fs\";\nimport { isAbsolute, relative, sep } from \"node:path\";\nimport { getAllBuiltinPackageLocations, getBuiltinPackageLocations } from \"./builtin-packages.ts\";\nimport { getExtensionRuntimeEventBus, instantiateExtensions, loadExtensions } from \"./extensions/loader.ts\";\nimport type { LoadExtensionsResult } from \"./extensions/types.ts\";\nimport { markTrustedMandatoryRuntimeExtension } from \"./mandatory-runtime-tools.ts\";\nimport { DefaultPackageManager, type ResolvedResource } from \"./package-manager.ts\";\nimport { DefaultResourceLoader } from \"./resource-loader.ts\";\nimport type {\n\tResourceExtensionPaths,\n\tResourceLoader,\n\tResourceLoaderReloadOptions,\n\tResourceLoaderReloadTransaction,\n} from \"./resource-loader-types.ts\";\nimport type { AtomicBuiltin } from \"./sdk-types.ts\";\nimport { lifecycleScopeForOwner, sessionLifecycleCreation, sessionLifecycleScopes } from \"./session-lifecycle-scope.ts\";\nimport { SettingsManager } from \"./settings-manager.ts\";\nimport { buildSkillCatalog } from \"./skill-catalog.ts\";\nimport { BUILTIN_PATH_PREFIX } from \"./source-info.ts\";\n\nfunction canonical(path: string): string {\n\ttry {\n\t\treturn realpathSync(path);\n\t} catch {\n\t\treturn path;\n\t}\n}\n\n/** Adds shipped resources without changing the caller's loader or its discovery options. */\nclass BuiltinResourceLoader implements ResourceLoader {\n\tprivate extensions!: LoadExtensionsResult;\n\tprivate assets: DefaultResourceLoader;\n\tprivate readonly delegate: ResourceLoader;\n\tprivate readonly cwd: string;\n\tprivate readonly agentDir: string;\n\tprivate readonly builtins: Partial<Record<AtomicBuiltin, boolean>>;\n\tprivate readonly disabledRoots: string[];\n\tprivate readonly disableWorkflowExtension: boolean;\n\tprivate readonly ownsDiscovery: boolean;\n\tprivate isDisabledPath(path: string): boolean {\n\t\treturn this.disabledRoots.some((root) => {\n\t\t\tconst child = relative(root, canonical(path));\n\t\t\treturn child !== \"..\" && !child.startsWith(`..${sep}`) && !isAbsolute(child);\n\t\t});\n\t}\n\tconstructor(\n\t\tdelegate: ResourceLoader,\n\t\tcwd: string,\n\t\tagentDir: string,\n\t\tbuiltins?: Partial<Record<AtomicBuiltin, boolean>>,\n\t\tdisableWorkflowExtension = false,\n\t\townsDiscovery?: boolean,\n\t) {\n\t\tconst scope = sessionLifecycleCreation.getStore()?.scope;\n\t\tthis.ownsDiscovery =\n\t\t\townsDiscovery ??\n\t\t\t(scope !== undefined && sessionLifecycleScopes.get(delegate.getExtensions().runtime) === scope);\n\t\tthis.disableWorkflowExtension = disableWorkflowExtension;\n\t\tthis.delegate = delegate;\n\t\tthis.cwd = cwd;\n\t\tthis.agentDir = agentDir;\n\t\tthis.builtins = {};\n\t\tfor (const name of [\"workflows\", \"subagents\", \"mcp\", \"web-access\", \"intercom\"] as const) {\n\t\t\tif (builtins && name in builtins) this.builtins[name] = builtins[name];\n\t\t}\n\t\tthis.disabledRoots = getAllBuiltinPackageLocations()\n\t\t\t.filter((location) => this.builtins[location.distDirName] === false)\n\t\t\t.map((location) => canonical(location.packageDir));\n\t\tthis.assets = new DefaultResourceLoader({\n\t\t\tcwd,\n\t\t\tagentDir,\n\t\t\tsettingsManager: SettingsManager.inMemory(),\n\t\t\tnoExtensions: true,\n\t\t\tnoSkills: true,\n\t\t\tnoPromptTemplates: true,\n\t\t\tnoThemes: true,\n\t\t\tnoContextFiles: true,\n\t\t});\n\t}\n\tasync initialize(): Promise<void> {\n\t\tconst locations = getBuiltinPackageLocations(true, this.builtins);\n\t\tconst discovered = this.delegate.getExtensions();\n\t\tconst scope = lifecycleScopeForOwner(this);\n\t\tconst identities = new Set<string>();\n\t\tconst inlineBuiltinPaths = new Set<string>();\n\t\tconst selected = discovered.extensions.filter((extension) => {\n\t\t\tif (extension.path.startsWith(BUILTIN_PATH_PREFIX)) {\n\t\t\t\tif (inlineBuiltinPaths.has(extension.path)) return false;\n\t\t\t\tinlineBuiltinPaths.add(extension.path);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (this.isDisabledPath(extension.resolvedPath)) return false;\n\t\t\tconst path = canonical(extension.resolvedPath);\n\t\t\tconst builtin = locations.find((location) => {\n\t\t\t\tconst child = relative(canonical(location.packageDir), path);\n\t\t\t\treturn child !== \"..\" && !child.startsWith(`..${sep}`) && !isAbsolute(child);\n\t\t\t});\n\t\t\tif (!builtin) return true;\n\t\t\tif (this.disableWorkflowExtension && builtin.distDirName === \"workflows\") return false;\n\t\t\tif (identities.has(builtin.packageName)) return false;\n\t\t\tidentities.add(builtin.packageName);\n\t\t\treturn true;\n\t\t});\n\t\tconst discovery = { ...discovered, extensions: selected };\n\t\tconst target =\n\t\t\tsessionLifecycleScopes.get(discovered.runtime) === scope\n\t\t\t\t? discovery\n\t\t\t\t: await sessionLifecycleCreation.run({ scope, claimed: true }, () =>\n\t\t\t\t\t\tinstantiateExtensions(discovery, this.cwd),\n\t\t\t\t\t);\n\t\tconst manager = new DefaultPackageManager({\n\t\t\tcwd: this.cwd,\n\t\t\tagentDir: this.agentDir,\n\t\t\tsettingsManager: SettingsManager.inMemory(),\n\t\t});\n\t\tconst resources = await manager.resolveExtensionSources(\n\t\t\tlocations.map((location) => location.packageDir),\n\t\t\t{ temporary: true },\n\t\t);\n\t\tconst paths = resources.extensions.filter(\n\t\t\t(resource) =>\n\t\t\t\tresource.enabled &&\n\t\t\t\t!locations.some(\n\t\t\t\t\t(location) =>\n\t\t\t\t\t\t(identities.has(location.packageName) ||\n\t\t\t\t\t\t\t(this.disableWorkflowExtension && location.distDirName === \"workflows\")) &&\n\t\t\t\t\t\tcanonical(resource.path).startsWith(`${canonical(location.packageDir)}${sep}`),\n\t\t\t\t),\n\t\t);\n\t\tconst mergeWorkflows = (caller: ResolvedResource[]) => {\n\t\t\tconst workflows = new Map<string, ResolvedResource>();\n\t\t\tfor (const resource of [...resources.workflows, ...caller]) {\n\t\t\t\tif (!this.isDisabledPath(resource.path)) workflows.set(canonical(resource.path), resource);\n\t\t\t}\n\t\t\treturn [...workflows.values()];\n\t\t};\n\t\tconst loaded = await loadExtensions(\n\t\t\tpaths.map((resource) => resource.path),\n\t\t\tthis.cwd,\n\t\t\tgetExtensionRuntimeEventBus(target.runtime),\n\t\t\t{\n\t\t\t\tget: () => mergeWorkflows(this.delegate.getWorkflowResources?.() ?? []),\n\t\t\t\trefresh: async () =>\n\t\t\t\t\tmergeWorkflows(\n\t\t\t\t\t\t(await this.delegate.refreshWorkflowResources?.()) ?? this.delegate.getWorkflowResources?.() ?? [],\n\t\t\t\t\t),\n\t\t\t\tgetMcpServers: () => this.delegate.getMcpServerContributions?.() ?? [],\n\t\t\t},\n\t\t\ttarget.runtime,\n\t\t);\n\t\tfor (const extension of loaded.extensions) markTrustedMandatoryRuntimeExtension(extension);\n\t\tthis.extensions = {\n\t\t\t...target,\n\t\t\textensions: [...target.extensions, ...loaded.extensions],\n\t\t\terrors: [...target.errors, ...loaded.errors],\n\t\t};\n\t\tconst entries = (items: ResolvedResource[]) =>\n\t\t\titems\n\t\t\t\t.filter((item) => item.enabled)\n\t\t\t\t.map((item) => ({\n\t\t\t\t\tpath: item.path,\n\t\t\t\t\tmetadata: { ...item.metadata, configurationOrigin: \"bundled\" as const },\n\t\t\t\t}));\n\t\tawait this.assets.extendResources({\n\t\t\tskillPaths: entries(resources.skills),\n\t\t\tpromptPaths: entries(resources.prompts),\n\t\t\tthemePaths: entries(resources.themes),\n\t\t});\n\t}\n\tgetExtensions() {\n\t\treturn this.extensions;\n\t}\n\tgetSkills(): ReturnType<ResourceLoader[\"getSkills\"]> {\n\t\tconst caller = this.delegate.getSkills();\n\t\tconst builtin = this.assets.getSkills();\n\t\tconst skills = caller.skills.filter((skill) => !this.isDisabledPath(skill.filePath));\n\t\tconst paths = new Set(skills.map((skill) => canonical(skill.filePath)));\n\t\treturn {\n\t\t\tskills: [...skills, ...builtin.skills.filter((skill) => !paths.has(canonical(skill.filePath)))],\n\t\t\tdiagnostics: [...caller.diagnostics, ...builtin.diagnostics],\n\t\t};\n\t}\n\tgetSkillCatalog() {\n\t\treturn buildSkillCatalog(this.getSkills().skills);\n\t}\n\tgetPrompts(): ReturnType<ResourceLoader[\"getPrompts\"]> {\n\t\tconst caller = this.delegate.getPrompts();\n\t\tconst builtin = this.assets.getPrompts();\n\t\tconst prompts = caller.prompts.filter((prompt) => !this.isDisabledPath(prompt.filePath));\n\t\tconst paths = new Set(prompts.map((prompt) => canonical(prompt.filePath)));\n\t\treturn {\n\t\t\tprompts: [...prompts, ...builtin.prompts.filter((prompt) => !paths.has(canonical(prompt.filePath)))],\n\t\t\tdiagnostics: [...caller.diagnostics, ...builtin.diagnostics],\n\t\t};\n\t}\n\tgetThemes(): ReturnType<ResourceLoader[\"getThemes\"]> {\n\t\tconst caller = this.delegate.getThemes();\n\t\tconst builtin = this.assets.getThemes();\n\t\treturn {\n\t\t\tthemes: [\n\t\t\t\t...caller.themes.filter((theme) => !theme.sourcePath || !this.isDisabledPath(theme.sourcePath)),\n\t\t\t\t...builtin.themes,\n\t\t\t],\n\t\t\tdiagnostics: [...caller.diagnostics, ...builtin.diagnostics],\n\t\t};\n\t}\n\tgetAgentsFiles() {\n\t\treturn this.delegate.getAgentsFiles();\n\t}\n\tgetSystemPrompt() {\n\t\treturn this.delegate.getSystemPrompt();\n\t}\n\tgetSystemPromptSource() {\n\t\treturn this.delegate.getSystemPromptSource();\n\t}\n\tgetAppendSystemPrompt() {\n\t\treturn this.delegate.getAppendSystemPrompt();\n\t}\n\tgetAppendSystemPromptSources() {\n\t\treturn this.delegate.getAppendSystemPromptSources();\n\t}\n\tasync extendResources(paths: ResourceExtensionPaths): Promise<void> {\n\t\tconst bundled: ResourceExtensionPaths = {};\n\t\tconst caller: ResourceExtensionPaths = {};\n\t\tfor (const kind of [\"skillPaths\", \"promptPaths\", \"themePaths\"] as const) {\n\t\t\tbundled[kind] = paths[kind]?.filter(\n\t\t\t\t(entry) => !this.isDisabledPath(entry.path) && entry.metadata.configurationOrigin === \"bundled\",\n\t\t\t);\n\t\t\tcaller[kind] = paths[kind]?.filter(\n\t\t\t\t(entry) => !this.isDisabledPath(entry.path) && entry.metadata.configurationOrigin !== \"bundled\",\n\t\t\t);\n\t\t}\n\t\tif (this.ownsDiscovery) {\n\t\t\tawait this.delegate.extendResources(caller);\n\t\t} else {\n\t\t\t// Extension-discovered assets belong to this session, not borrowed discovery.\n\t\t\tfor (const kind of [\"skillPaths\", \"promptPaths\", \"themePaths\"] as const) {\n\t\t\t\tbundled[kind] = [...(bundled[kind] ?? []), ...(caller[kind] ?? [])];\n\t\t\t}\n\t\t}\n\t\tawait this.assets.extendResources(bundled);\n\t}\n\tasync reload(options?: ResourceLoaderReloadOptions): Promise<void> {\n\t\tawait this.delegate.reload(options);\n\t\tthis.assets = new DefaultResourceLoader({\n\t\t\tcwd: this.cwd,\n\t\t\tagentDir: this.agentDir,\n\t\t\tsettingsManager: SettingsManager.inMemory(),\n\t\t\tnoContextFiles: true,\n\t\t});\n\t\tawait this.initialize();\n\t}\n\tsupportsTransactionalReload(): boolean {\n\t\treturn this.delegate.prepareReload !== undefined && this.delegate.supportsTransactionalReload?.() !== false;\n\t}\n\tasync prepareReload(\n\t\tsettings: SettingsManager,\n\t\toptions?: ResourceLoaderReloadOptions,\n\t): Promise<ResourceLoaderReloadTransaction> {\n\t\tif (!this.delegate.prepareReload) throw new Error(\"Resource loader does not support transactional reload\");\n\t\tconst transaction = await this.delegate.prepareReload(settings, options);\n\t\tconst candidate = new BuiltinResourceLoader(\n\t\t\ttransaction.loader,\n\t\t\tthis.cwd,\n\t\t\tthis.agentDir,\n\t\t\tthis.builtins,\n\t\t\tthis.disableWorkflowExtension,\n\t\t\ttrue,\n\t\t);\n\t\tsessionLifecycleScopes.set(candidate, lifecycleScopeForOwner(this));\n\t\tawait candidate.initialize();\n\t\tconst publish = () => {\n\t\t\tthis.extensions = candidate.extensions;\n\t\t\tthis.assets = candidate.assets;\n\t\t};\n\t\treturn {\n\t\t\t...transaction,\n\t\t\tloader: candidate,\n\t\t\t...(transaction.prepareCommit\n\t\t\t\t? {\n\t\t\t\t\t\tprepareCommit: () => {\n\t\t\t\t\t\t\tconst prepared = transaction.prepareCommit!();\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tcommit: () => {\n\t\t\t\t\t\t\t\t\tprepared.commit();\n\t\t\t\t\t\t\t\t\tpublish();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\trollback: () => prepared.rollback(),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\tcommit: () => {\n\t\t\t\ttransaction.commit();\n\t\t\t\tpublish();\n\t\t\t},\n\t\t};\n\t}\n}\n\nexport async function withBuiltinResourceLoader(\n\tloader: ResourceLoader,\n\tcwd: string,\n\tagentDir: string,\n\tbuiltins?: Partial<Record<AtomicBuiltin, boolean>>,\n\tdisableWorkflowExtension = false,\n): Promise<ResourceLoader> {\n\tif (\n\t\tloader instanceof BuiltinResourceLoader &&\n\t\tbuiltins === undefined &&\n\t\t!disableWorkflowExtension &&\n\t\tsessionLifecycleScopes.get(loader) === sessionLifecycleCreation.getStore()?.scope\n\t)\n\t\treturn loader;\n\tconst composed = new BuiltinResourceLoader(loader, cwd, agentDir, builtins, disableWorkflowExtension);\n\tawait composed.initialize();\n\treturn composed;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"builtin-resource-loader.js","sourceRoot":"","sources":["../../src/core/builtin-resource-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAA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,MAAM,CAAC;QAChC,CAAC,CAAC;QACF,OAAO;YACN,GAAG,WAAW;YACd,MAAM,EAAE,SAAS;YACjB,GAAG,CAAC,WAAW,CAAC,aAAa;gBAC5B,CAAC,CAAC;oBACA,aAAa,EAAE,GAAG,EAAE;wBACnB,MAAM,QAAQ,GAAG,WAAW,CAAC,aAAc,EAAE,CAAC;wBAC9C,OAAO;4BACN,MAAM,EAAE,GAAG,EAAE;gCACZ,QAAQ,CAAC,MAAM,EAAE,CAAC;gCAClB,OAAO,EAAE,CAAC;4BACX,CAAC;4BACD,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE;yBACnC,CAAC;oBACH,CAAC;iBACD;gBACF,CAAC,CAAC,EAAE,CAAC;YACN,MAAM,EAAE,GAAG,EAAE;gBACZ,WAAW,CAAC,MAAM,EAAE,CAAC;gBACrB,OAAO,EAAE,CAAC;YACX,CAAC;SACD,CAAC;IACH,CAAC;CACD;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC9C,MAAsB,EACtB,GAAW,EACX,QAAgB,EAChB,QAAkD,EAClD,wBAAwB,GAAG,KAAK;IAEhC,IACC,MAAM,YAAY,qBAAqB;QACvC,QAAQ,KAAK,SAAS;QACtB,CAAC,wBAAwB;QACzB,sBAAsB,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,wBAAwB,CAAC,QAAQ,EAAE,EAAE,KAAK;QAEjF,OAAO,MAAM,CAAC;IACf,MAAM,QAAQ,GAAG,IAAI,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,wBAAwB,CAAC,CAAC;IACtG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC5B,OAAO,QAAQ,CAAC;AACjB,CAAC","sourcesContent":["import { realpathSync } from \"node:fs\";\nimport { isAbsolute, relative, sep } from \"node:path\";\nimport { getAllBuiltinPackageLocations, getBuiltinPackageLocations } from \"./builtin-packages.ts\";\nimport { getExtensionRuntimeEventBus, instantiateExtensions, loadExtensions } from \"./extensions/loader.ts\";\nimport type { LoadExtensionsResult } from \"./extensions/types.ts\";\nimport { markTrustedMandatoryRuntimeExtension } from \"./mandatory-runtime-tools.ts\";\nimport { DefaultPackageManager, type ResolvedResource } from \"./package-manager.ts\";\nimport { DefaultResourceLoader } from \"./resource-loader.ts\";\nimport type {\n\tResourceExtensionPaths,\n\tResourceLoader,\n\tResourceLoaderReloadOptions,\n\tResourceLoaderReloadTransaction,\n} from \"./resource-loader-types.ts\";\nimport type { AtomicBuiltin } from \"./sdk-types.ts\";\nimport { lifecycleScopeForOwner, sessionLifecycleCreation, sessionLifecycleScopes } from \"./session-lifecycle-scope.ts\";\nimport { SettingsManager } from \"./settings-manager.ts\";\nimport { buildSkillCatalog } from \"./skill-catalog.ts\";\nimport { BUILTIN_PATH_PREFIX } from \"./source-info.ts\";\n\nfunction canonical(path: string): string {\n\ttry {\n\t\treturn realpathSync(path);\n\t} catch {\n\t\treturn path;\n\t}\n}\n\n/** Adds shipped resources without changing the caller's loader or its discovery options. */\nclass BuiltinResourceLoader implements ResourceLoader {\n\tprivate extensions!: LoadExtensionsResult;\n\tprivate assets: DefaultResourceLoader;\n\tprivate readonly delegate: ResourceLoader;\n\tprivate readonly cwd: string;\n\tprivate readonly agentDir: string;\n\tprivate readonly builtins: Partial<Record<AtomicBuiltin, boolean>>;\n\tprivate readonly disabledRoots: string[];\n\tprivate readonly disableWorkflowExtension: boolean;\n\tprivate readonly ownsDiscovery: boolean;\n\tprivate isDisabledPath(path: string): boolean {\n\t\treturn this.disabledRoots.some((root) => {\n\t\t\tconst child = relative(root, canonical(path));\n\t\t\treturn child !== \"..\" && !child.startsWith(`..${sep}`) && !isAbsolute(child);\n\t\t});\n\t}\n\tconstructor(\n\t\tdelegate: ResourceLoader,\n\t\tcwd: string,\n\t\tagentDir: string,\n\t\tbuiltins?: Partial<Record<AtomicBuiltin, boolean>>,\n\t\tdisableWorkflowExtension = false,\n\t\townsDiscovery?: boolean,\n\t) {\n\t\tconst scope = sessionLifecycleCreation.getStore()?.scope;\n\t\tthis.ownsDiscovery =\n\t\t\townsDiscovery ??\n\t\t\t(scope !== undefined && sessionLifecycleScopes.get(delegate.getExtensions().runtime) === scope);\n\t\tthis.disableWorkflowExtension = disableWorkflowExtension;\n\t\tthis.delegate = delegate;\n\t\tthis.cwd = cwd;\n\t\tthis.agentDir = agentDir;\n\t\tthis.builtins = {};\n\t\tfor (const name of [\"workflows\", \"subagents\", \"mcp\", \"web-access\", \"intercom\"] as const) {\n\t\t\tif (builtins && name in builtins) this.builtins[name] = builtins[name];\n\t\t}\n\t\tthis.disabledRoots = getAllBuiltinPackageLocations()\n\t\t\t.filter((location) => this.builtins[location.distDirName] === false)\n\t\t\t.map((location) => canonical(location.packageDir));\n\t\tthis.assets = new DefaultResourceLoader({\n\t\t\tcwd,\n\t\t\tagentDir,\n\t\t\tsettingsManager: SettingsManager.inMemory(),\n\t\t\tnoExtensions: true,\n\t\t\tnoSkills: true,\n\t\t\tnoPromptTemplates: true,\n\t\t\tnoThemes: true,\n\t\t\tnoContextFiles: true,\n\t\t});\n\t}\n\tasync initialize(): Promise<void> {\n\t\tconst locations = getBuiltinPackageLocations(true, this.builtins);\n\t\tconst discovered = this.delegate.getExtensions();\n\t\tconst scope = lifecycleScopeForOwner(this);\n\t\tconst identities = new Set<string>();\n\t\tconst inlineBuiltinPaths = new Set<string>();\n\t\tconst selected = discovered.extensions.filter((extension) => {\n\t\t\tif (extension.path.startsWith(BUILTIN_PATH_PREFIX)) {\n\t\t\t\tif (inlineBuiltinPaths.has(extension.path)) return false;\n\t\t\t\tinlineBuiltinPaths.add(extension.path);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (this.isDisabledPath(extension.resolvedPath)) return false;\n\t\t\tconst path = canonical(extension.resolvedPath);\n\t\t\tconst builtin = locations.find((location) => {\n\t\t\t\tconst child = relative(canonical(location.packageDir), path);\n\t\t\t\treturn child !== \"..\" && !child.startsWith(`..${sep}`) && !isAbsolute(child);\n\t\t\t});\n\t\t\tif (!builtin) return true;\n\t\t\tif (this.disableWorkflowExtension && builtin.distDirName === \"workflows\") return false;\n\t\t\tif (identities.has(builtin.packageName)) return false;\n\t\t\tidentities.add(builtin.packageName);\n\t\t\treturn true;\n\t\t});\n\t\tconst discovery = { ...discovered, extensions: selected };\n\t\tconst target =\n\t\t\tsessionLifecycleScopes.get(discovered.runtime) === scope\n\t\t\t\t? discovery\n\t\t\t\t: await sessionLifecycleCreation.run({ scope, claimed: true }, () =>\n\t\t\t\t\t\tinstantiateExtensions(discovery, this.cwd),\n\t\t\t\t\t);\n\t\tconst manager = new DefaultPackageManager({\n\t\t\tcwd: this.cwd,\n\t\t\tagentDir: this.agentDir,\n\t\t\tsettingsManager: SettingsManager.inMemory(),\n\t\t});\n\t\tconst resources = await manager.resolveExtensionSources(\n\t\t\tlocations.map((location) => location.packageDir),\n\t\t\t{ temporary: true },\n\t\t);\n\t\tconst paths = resources.extensions.filter(\n\t\t\t(resource) =>\n\t\t\t\tresource.enabled &&\n\t\t\t\t!locations.some(\n\t\t\t\t\t(location) =>\n\t\t\t\t\t\t(identities.has(location.packageName) ||\n\t\t\t\t\t\t\t(this.disableWorkflowExtension && location.distDirName === \"workflows\")) &&\n\t\t\t\t\t\tcanonical(resource.path).startsWith(`${canonical(location.packageDir)}${sep}`),\n\t\t\t\t),\n\t\t);\n\t\tconst mergeWorkflows = (caller: ResolvedResource[]) => {\n\t\t\tconst workflows = new Map<string, ResolvedResource>();\n\t\t\tfor (const resource of [...resources.workflows, ...caller]) {\n\t\t\t\tif (!this.isDisabledPath(resource.path)) workflows.set(canonical(resource.path), resource);\n\t\t\t}\n\t\t\treturn [...workflows.values()];\n\t\t};\n\t\tconst loaded = await loadExtensions(\n\t\t\tpaths.map((resource) => resource.path),\n\t\t\tthis.cwd,\n\t\t\tgetExtensionRuntimeEventBus(target.runtime),\n\t\t\t{\n\t\t\t\tget: () => mergeWorkflows(this.delegate.getWorkflowResources?.() ?? []),\n\t\t\t\trefresh: async () =>\n\t\t\t\t\tmergeWorkflows(\n\t\t\t\t\t\t(await this.delegate.refreshWorkflowResources?.()) ?? this.delegate.getWorkflowResources?.() ?? [],\n\t\t\t\t\t),\n\t\t\t\tgetMcpServers: () => this.delegate.getMcpServerContributions?.() ?? [],\n\t\t\t},\n\t\t\ttarget.runtime,\n\t\t\t() => this.delegate.getInheritanceSnapshot?.() ?? {},\n\t\t);\n\t\tfor (const extension of loaded.extensions) markTrustedMandatoryRuntimeExtension(extension);\n\t\tthis.extensions = {\n\t\t\t...target,\n\t\t\textensions: [...target.extensions, ...loaded.extensions],\n\t\t\terrors: [...target.errors, ...loaded.errors],\n\t\t};\n\t\tconst entries = (items: ResolvedResource[]) =>\n\t\t\titems\n\t\t\t\t.filter((item) => item.enabled)\n\t\t\t\t.map((item) => ({\n\t\t\t\t\tpath: item.path,\n\t\t\t\t\tmetadata: { ...item.metadata, configurationOrigin: \"bundled\" as const },\n\t\t\t\t}));\n\t\tawait this.assets.extendResources({\n\t\t\tskillPaths: entries(resources.skills),\n\t\t\tpromptPaths: entries(resources.prompts),\n\t\t\tthemePaths: entries(resources.themes),\n\t\t});\n\t}\n\tgetExtensions() {\n\t\treturn this.extensions;\n\t}\n\tgetSkills(): ReturnType<ResourceLoader[\"getSkills\"]> {\n\t\tconst caller = this.delegate.getSkills();\n\t\tconst builtin = this.assets.getSkills();\n\t\tconst skills = caller.skills.filter((skill) => !this.isDisabledPath(skill.filePath));\n\t\tconst paths = new Set(skills.map((skill) => canonical(skill.filePath)));\n\t\treturn {\n\t\t\tskills: [...skills, ...builtin.skills.filter((skill) => !paths.has(canonical(skill.filePath)))],\n\t\t\tdiagnostics: [...caller.diagnostics, ...builtin.diagnostics],\n\t\t};\n\t}\n\tgetSkillCatalog() {\n\t\treturn buildSkillCatalog(this.getSkills().skills);\n\t}\n\tgetPrompts(): ReturnType<ResourceLoader[\"getPrompts\"]> {\n\t\tconst caller = this.delegate.getPrompts();\n\t\tconst builtin = this.assets.getPrompts();\n\t\tconst prompts = caller.prompts.filter((prompt) => !this.isDisabledPath(prompt.filePath));\n\t\tconst paths = new Set(prompts.map((prompt) => canonical(prompt.filePath)));\n\t\treturn {\n\t\t\tprompts: [...prompts, ...builtin.prompts.filter((prompt) => !paths.has(canonical(prompt.filePath)))],\n\t\t\tdiagnostics: [...caller.diagnostics, ...builtin.diagnostics],\n\t\t};\n\t}\n\tgetThemes(): ReturnType<ResourceLoader[\"getThemes\"]> {\n\t\tconst caller = this.delegate.getThemes();\n\t\tconst builtin = this.assets.getThemes();\n\t\treturn {\n\t\t\tthemes: [\n\t\t\t\t...caller.themes.filter((theme) => !theme.sourcePath || !this.isDisabledPath(theme.sourcePath)),\n\t\t\t\t...builtin.themes,\n\t\t\t],\n\t\t\tdiagnostics: [...caller.diagnostics, ...builtin.diagnostics],\n\t\t};\n\t}\n\tgetAgentsFiles() {\n\t\treturn this.delegate.getAgentsFiles();\n\t}\n\tgetSystemPrompt() {\n\t\treturn this.delegate.getSystemPrompt();\n\t}\n\tgetSystemPromptSource() {\n\t\treturn this.delegate.getSystemPromptSource();\n\t}\n\tgetAppendSystemPrompt() {\n\t\treturn this.delegate.getAppendSystemPrompt();\n\t}\n\tgetAppendSystemPromptSources() {\n\t\treturn this.delegate.getAppendSystemPromptSources();\n\t}\n\tasync extendResources(paths: ResourceExtensionPaths): Promise<void> {\n\t\tconst bundled: ResourceExtensionPaths = {};\n\t\tconst caller: ResourceExtensionPaths = {};\n\t\tfor (const kind of [\"skillPaths\", \"promptPaths\", \"themePaths\"] as const) {\n\t\t\tbundled[kind] = paths[kind]?.filter(\n\t\t\t\t(entry) => !this.isDisabledPath(entry.path) && entry.metadata.configurationOrigin === \"bundled\",\n\t\t\t);\n\t\t\tcaller[kind] = paths[kind]?.filter(\n\t\t\t\t(entry) => !this.isDisabledPath(entry.path) && entry.metadata.configurationOrigin !== \"bundled\",\n\t\t\t);\n\t\t}\n\t\tif (this.ownsDiscovery) {\n\t\t\tawait this.delegate.extendResources(caller);\n\t\t} else {\n\t\t\t// Extension-discovered assets belong to this session, not borrowed discovery.\n\t\t\tfor (const kind of [\"skillPaths\", \"promptPaths\", \"themePaths\"] as const) {\n\t\t\t\tbundled[kind] = [...(bundled[kind] ?? []), ...(caller[kind] ?? [])];\n\t\t\t}\n\t\t}\n\t\tawait this.assets.extendResources(bundled);\n\t}\n\tasync reload(options?: ResourceLoaderReloadOptions): Promise<void> {\n\t\tawait this.delegate.reload(options);\n\t\tthis.assets = new DefaultResourceLoader({\n\t\t\tcwd: this.cwd,\n\t\t\tagentDir: this.agentDir,\n\t\t\tsettingsManager: SettingsManager.inMemory(),\n\t\t\tnoContextFiles: true,\n\t\t});\n\t\tawait this.initialize();\n\t}\n\tsupportsTransactionalReload(): boolean {\n\t\treturn this.delegate.prepareReload !== undefined && this.delegate.supportsTransactionalReload?.() !== false;\n\t}\n\tasync prepareReload(\n\t\tsettings: SettingsManager,\n\t\toptions?: ResourceLoaderReloadOptions,\n\t): Promise<ResourceLoaderReloadTransaction> {\n\t\tif (!this.delegate.prepareReload) throw new Error(\"Resource loader does not support transactional reload\");\n\t\tconst transaction = await this.delegate.prepareReload(settings, options);\n\t\tconst candidate = new BuiltinResourceLoader(\n\t\t\ttransaction.loader,\n\t\t\tthis.cwd,\n\t\t\tthis.agentDir,\n\t\t\tthis.builtins,\n\t\t\tthis.disableWorkflowExtension,\n\t\t\ttrue,\n\t\t);\n\t\tsessionLifecycleScopes.set(candidate, lifecycleScopeForOwner(this));\n\t\tawait candidate.initialize();\n\t\tconst publish = () => {\n\t\t\tthis.extensions = candidate.extensions;\n\t\t\tthis.assets = candidate.assets;\n\t\t};\n\t\treturn {\n\t\t\t...transaction,\n\t\t\tloader: candidate,\n\t\t\t...(transaction.prepareCommit\n\t\t\t\t? {\n\t\t\t\t\t\tprepareCommit: () => {\n\t\t\t\t\t\t\tconst prepared = transaction.prepareCommit!();\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tcommit: () => {\n\t\t\t\t\t\t\t\t\tprepared.commit();\n\t\t\t\t\t\t\t\t\tpublish();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\trollback: () => prepared.rollback(),\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\tcommit: () => {\n\t\t\t\ttransaction.commit();\n\t\t\t\tpublish();\n\t\t\t},\n\t\t};\n\t}\n}\n\nexport async function withBuiltinResourceLoader(\n\tloader: ResourceLoader,\n\tcwd: string,\n\tagentDir: string,\n\tbuiltins?: Partial<Record<AtomicBuiltin, boolean>>,\n\tdisableWorkflowExtension = false,\n): Promise<ResourceLoader> {\n\tif (\n\t\tloader instanceof BuiltinResourceLoader &&\n\t\tbuiltins === undefined &&\n\t\t!disableWorkflowExtension &&\n\t\tsessionLifecycleScopes.get(loader) === sessionLifecycleCreation.getStore()?.scope\n\t)\n\t\treturn loader;\n\tconst composed = new BuiltinResourceLoader(loader, cwd, agentDir, builtins, disableWorkflowExtension);\n\tawait composed.initialize();\n\treturn composed;\n}\n"]}
|
|
@@ -63,6 +63,7 @@ export interface ResourceLoaderReloadTransaction {
|
|
|
63
63
|
}
|
|
64
64
|
export interface ResourceLoader {
|
|
65
65
|
getExtensions(): LoadExtensionsResult;
|
|
66
|
+
getInheritanceSnapshot?(): DefaultResourceLoaderInheritanceSnapshot;
|
|
66
67
|
getWorkflowResources?(): ResolvedResource[];
|
|
67
68
|
refreshWorkflowResources?(): Promise<ResolvedResource[]>;
|
|
68
69
|
getMcpServerContributions?(): McpServerContribution[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-loader-types.d.ts","sourceRoot":"","sources":["../../src/core/resource-loader-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAA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,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;CAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-loader-types.js","sourceRoot":"","sources":["../../src/core/resource-loader-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Theme } from \"../modes/interactive/theme/theme.js\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport type { EventBus } from \"./event-bus.js\";\nimport type { InlineExtension, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport type { McpServerContribution } from \"./mcp-servers.ts\";\nimport type { PathMetadata, ResolvedResource } from \"./package-manager.ts\";\nimport type { PromptTemplate } from \"./prompt-templates.ts\";\nimport type { PackageSource, SettingsManager } from \"./settings-manager.ts\";\nimport type { SkillCatalog } from \"./skill-catalog.ts\";\nimport type { Skill } from \"./skills.ts\";\n\nexport interface ResourceExtensionPaths {\n\tskillPaths?: Array<{ path: string; metadata: PathMetadata }>;\n\tpromptPaths?: Array<{ path: string; metadata: PathMetadata }>;\n\tthemePaths?: Array<{ path: string; metadata: PathMetadata }>;\n}\n\nexport interface ResourceLoaderReloadOptions {\n\t/**\n\t * Skip loading extension code during this reload, leaving the loader with an\n\t * empty extension set. Skills, prompts, themes, context files, and prompt\n\t * files still load. A later full reload() picks up extensions.\n\t */\n\tdeferExtensions?: boolean;\n\t/**\n\t * Skip all resource discovery and loading during this reload. This is used by\n\t * interactive first-paint startup only when no CLI/startup input can observe\n\t * resources before a later full reload() completes.\n\t */\n\tdeferResources?: boolean;\n\t/** Publish trust-safe extensions now; complete trust after binding a live session and UI. */\n\tdeferProjectTrust?: (complete: () => Promise<void>) => void;\n\tresolveProjectTrust?: (options: { extensionsResult: LoadExtensionsResult }) => boolean | Promise<boolean>;\n\tresolveBorrowedProjectTrust?: (options: {\n\t\tsource: string;\n\t\tresources: ResolvedResource[];\n\t\textensionsResult: LoadExtensionsResult;\n\t}) => boolean | Promise<boolean>;\n\tonProjectTrustResolved?: () => void;\n}\nexport interface PreparedResourceLoaderCommit {\n\tcommit(): void;\n\trollback(): void;\n}\n\nexport interface ResourceLoaderReloadTransaction {\n\t/** Fully loaded candidate. Live readers must not observe it before commit. */\n\treadonly loader: ResourceLoader;\n\t/** Rebind the candidate to the live settings identity immediately before commit. */\n\tactivate(settingsManager: SettingsManager): void;\n\t/** Prepare fallible publication work without exposing candidate behavior. */\n\tprepareCommit?(): PreparedResourceLoaderCommit;\n\t/** Publish synchronously after all candidate work has succeeded. */\n\tcommit(): void;\n}\n\nexport interface ResourceLoader {\n\tgetExtensions(): LoadExtensionsResult;\n\tgetWorkflowResources?(): ResolvedResource[];\n\trefreshWorkflowResources?(): Promise<ResolvedResource[]>;\n\tgetMcpServerContributions?(): McpServerContribution[];\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] };\n\tgetSkillCatalog?(): SkillCatalog;\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] };\n\tgetThemes(): { themes: Theme[]; diagnostics: ResourceDiagnostic[] };\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> };\n\tgetSystemPrompt(): string | undefined;\n\tgetSystemPromptSource(): { path: string } | undefined;\n\tgetAppendSystemPrompt(): string[];\n\tgetAppendSystemPromptSources(): Array<{ path: string }>;\n\textendResources(paths: ResourceExtensionPaths): Promise<void>;\n\treload(options?: ResourceLoaderReloadOptions): Promise<void>;\n\tsupportsTransactionalReload?(): boolean;\n\tprepareReload?(\n\t\tsettingsManager: SettingsManager,\n\t\toptions?: ResourceLoaderReloadOptions,\n\t): Promise<ResourceLoaderReloadTransaction>;\n}\n\nexport interface DefaultResourceLoaderInheritanceSnapshot {\n\treadonly projectTrusted?: boolean;\n\treadonly additionalExtensionPaths?: readonly string[];\n\treadonly additionalSkillPaths?: readonly string[];\n\treadonly additionalPromptTemplatePaths?: readonly string[];\n\treadonly additionalThemePaths?: readonly string[];\n\treadonly builtinPackagePaths?: readonly PackageSource[];\n\treadonly extensionFactories?: readonly InlineExtension[];\n\treadonly noExtensions?: boolean;\n\treadonly disabledBuiltinExtensions?: readonly string[];\n\treadonly noSkills?: boolean;\n\treadonly noPromptTemplates?: boolean;\n\treadonly noThemes?: boolean;\n\treadonly noContextFiles?: boolean;\n\treadonly systemPrompt?: string;\n\treadonly appendSystemPrompt?: readonly string[];\n\treadonly trustedBorrowedProjectLocalSources?: readonly string[];\n}\n\nexport interface DefaultResourceLoaderOptions {\n\tcwd: string;\n\tagentDir: string;\n\tsettingsManager?: SettingsManager;\n\teventBus?: EventBus;\n\tresourceLoaderInheritanceSnapshot?: DefaultResourceLoaderInheritanceSnapshot;\n\tadditionalExtensionPaths?: string[];\n\tadditionalSkillPaths?: string[];\n\tadditionalPromptTemplatePaths?: string[];\n\tadditionalThemePaths?: string[];\n\tbuiltinPackagePaths?: PackageSource[];\n\textensionFactories?: InlineExtension[];\n\tnoExtensions?: boolean;\n\tdisabledBuiltinExtensions?: string[];\n\tnoSkills?: boolean;\n\tnoPromptTemplates?: boolean;\n\tnoThemes?: boolean;\n\tnoContextFiles?: boolean;\n\tsystemPrompt?: string;\n\tappendSystemPrompt?: string[];\n\textensionsOverride?: (base: LoadExtensionsResult) => LoadExtensionsResult;\n\tskillsOverride?: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tpromptsOverride?: (base: { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tprompts: PromptTemplate[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tthemesOverride?: (base: { themes: Theme[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tthemes: Theme[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tagentsFilesOverride?: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tsystemPromptOverride?: (base: string | undefined) => string | undefined;\n\tappendSystemPromptOverride?: (base: string[]) => string[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"resource-loader-types.js","sourceRoot":"","sources":["../../src/core/resource-loader-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Theme } from \"../modes/interactive/theme/theme.js\";\nimport type { ResourceDiagnostic } from \"./diagnostics.ts\";\nimport type { EventBus } from \"./event-bus.js\";\nimport type { InlineExtension, LoadExtensionsResult } from \"./extensions/types.ts\";\nimport type { McpServerContribution } from \"./mcp-servers.ts\";\nimport type { PathMetadata, ResolvedResource } from \"./package-manager.ts\";\nimport type { PromptTemplate } from \"./prompt-templates.ts\";\nimport type { PackageSource, SettingsManager } from \"./settings-manager.ts\";\nimport type { SkillCatalog } from \"./skill-catalog.ts\";\nimport type { Skill } from \"./skills.ts\";\n\nexport interface ResourceExtensionPaths {\n\tskillPaths?: Array<{ path: string; metadata: PathMetadata }>;\n\tpromptPaths?: Array<{ path: string; metadata: PathMetadata }>;\n\tthemePaths?: Array<{ path: string; metadata: PathMetadata }>;\n}\n\nexport interface ResourceLoaderReloadOptions {\n\t/**\n\t * Skip loading extension code during this reload, leaving the loader with an\n\t * empty extension set. Skills, prompts, themes, context files, and prompt\n\t * files still load. A later full reload() picks up extensions.\n\t */\n\tdeferExtensions?: boolean;\n\t/**\n\t * Skip all resource discovery and loading during this reload. This is used by\n\t * interactive first-paint startup only when no CLI/startup input can observe\n\t * resources before a later full reload() completes.\n\t */\n\tdeferResources?: boolean;\n\t/** Publish trust-safe extensions now; complete trust after binding a live session and UI. */\n\tdeferProjectTrust?: (complete: () => Promise<void>) => void;\n\tresolveProjectTrust?: (options: { extensionsResult: LoadExtensionsResult }) => boolean | Promise<boolean>;\n\tresolveBorrowedProjectTrust?: (options: {\n\t\tsource: string;\n\t\tresources: ResolvedResource[];\n\t\textensionsResult: LoadExtensionsResult;\n\t}) => boolean | Promise<boolean>;\n\tonProjectTrustResolved?: () => void;\n}\nexport interface PreparedResourceLoaderCommit {\n\tcommit(): void;\n\trollback(): void;\n}\n\nexport interface ResourceLoaderReloadTransaction {\n\t/** Fully loaded candidate. Live readers must not observe it before commit. */\n\treadonly loader: ResourceLoader;\n\t/** Rebind the candidate to the live settings identity immediately before commit. */\n\tactivate(settingsManager: SettingsManager): void;\n\t/** Prepare fallible publication work without exposing candidate behavior. */\n\tprepareCommit?(): PreparedResourceLoaderCommit;\n\t/** Publish synchronously after all candidate work has succeeded. */\n\tcommit(): void;\n}\n\nexport interface ResourceLoader {\n\tgetExtensions(): LoadExtensionsResult;\n\tgetInheritanceSnapshot?(): DefaultResourceLoaderInheritanceSnapshot;\n\tgetWorkflowResources?(): ResolvedResource[];\n\trefreshWorkflowResources?(): Promise<ResolvedResource[]>;\n\tgetMcpServerContributions?(): McpServerContribution[];\n\tgetSkills(): { skills: Skill[]; diagnostics: ResourceDiagnostic[] };\n\tgetSkillCatalog?(): SkillCatalog;\n\tgetPrompts(): { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] };\n\tgetThemes(): { themes: Theme[]; diagnostics: ResourceDiagnostic[] };\n\tgetAgentsFiles(): { agentsFiles: Array<{ path: string; content: string }> };\n\tgetSystemPrompt(): string | undefined;\n\tgetSystemPromptSource(): { path: string } | undefined;\n\tgetAppendSystemPrompt(): string[];\n\tgetAppendSystemPromptSources(): Array<{ path: string }>;\n\textendResources(paths: ResourceExtensionPaths): Promise<void>;\n\treload(options?: ResourceLoaderReloadOptions): Promise<void>;\n\tsupportsTransactionalReload?(): boolean;\n\tprepareReload?(\n\t\tsettingsManager: SettingsManager,\n\t\toptions?: ResourceLoaderReloadOptions,\n\t): Promise<ResourceLoaderReloadTransaction>;\n}\n\nexport interface DefaultResourceLoaderInheritanceSnapshot {\n\treadonly projectTrusted?: boolean;\n\treadonly additionalExtensionPaths?: readonly string[];\n\treadonly additionalSkillPaths?: readonly string[];\n\treadonly additionalPromptTemplatePaths?: readonly string[];\n\treadonly additionalThemePaths?: readonly string[];\n\treadonly builtinPackagePaths?: readonly PackageSource[];\n\treadonly extensionFactories?: readonly InlineExtension[];\n\treadonly noExtensions?: boolean;\n\treadonly disabledBuiltinExtensions?: readonly string[];\n\treadonly noSkills?: boolean;\n\treadonly noPromptTemplates?: boolean;\n\treadonly noThemes?: boolean;\n\treadonly noContextFiles?: boolean;\n\treadonly systemPrompt?: string;\n\treadonly appendSystemPrompt?: readonly string[];\n\treadonly trustedBorrowedProjectLocalSources?: readonly string[];\n}\n\nexport interface DefaultResourceLoaderOptions {\n\tcwd: string;\n\tagentDir: string;\n\tsettingsManager?: SettingsManager;\n\teventBus?: EventBus;\n\tresourceLoaderInheritanceSnapshot?: DefaultResourceLoaderInheritanceSnapshot;\n\tadditionalExtensionPaths?: string[];\n\tadditionalSkillPaths?: string[];\n\tadditionalPromptTemplatePaths?: string[];\n\tadditionalThemePaths?: string[];\n\tbuiltinPackagePaths?: PackageSource[];\n\textensionFactories?: InlineExtension[];\n\tnoExtensions?: boolean;\n\tdisabledBuiltinExtensions?: string[];\n\tnoSkills?: boolean;\n\tnoPromptTemplates?: boolean;\n\tnoThemes?: boolean;\n\tnoContextFiles?: boolean;\n\tsystemPrompt?: string;\n\tappendSystemPrompt?: string[];\n\textensionsOverride?: (base: LoadExtensionsResult) => LoadExtensionsResult;\n\tskillsOverride?: (base: { skills: Skill[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tskills: Skill[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tpromptsOverride?: (base: { prompts: PromptTemplate[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tprompts: PromptTemplate[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tthemesOverride?: (base: { themes: Theme[]; diagnostics: ResourceDiagnostic[] }) => {\n\t\tthemes: Theme[];\n\t\tdiagnostics: ResourceDiagnostic[];\n\t};\n\tagentsFilesOverride?: (base: { agentsFiles: Array<{ path: string; content: string }> }) => {\n\t\tagentsFiles: Array<{ path: string; content: string }>;\n\t};\n\tsystemPromptOverride?: (base: string | undefined) => string | undefined;\n\tappendSystemPromptOverride?: (base: string[]) => string[];\n}\n"]}
|
package/docs/sdk.md
CHANGED
|
@@ -353,13 +353,15 @@ Observation can start before the workflows package has finished loading; the fir
|
|
|
353
353
|
|
|
354
354
|
Children inherit the invoking session's model/auth runtime, settings, agent directory, human-input callbacks, and diagnostic sink. Choosing a child model or fallback does not switch to global credentials.
|
|
355
355
|
|
|
356
|
+
Workflow stages also inherit extensions supplied to the parent's `DefaultResourceLoader` through `additionalExtensionPaths` and `extensionFactories`. Factories run again for each stage. Keep parent-only setup in a session callback such as `session_start`, and return early from that callback when `ctx.subagentPolicy` is set. This skips the setup, not factory construction or handler registration. Do not rely on `pi.subagentPolicy` during factory construction: stage resources can load before the session policy is attached.
|
|
357
|
+
|
|
356
358
|
The child working directory resolves in this order:
|
|
357
359
|
|
|
358
360
|
1. Explicit child `cwd`.
|
|
359
361
|
2. A supplied child `sessionManager.getCwd()`.
|
|
360
362
|
3. The invoking session's directory.
|
|
361
363
|
|
|
362
|
-
|
|
364
|
+
Child-relative paths, including workflow report outputs, use the resolved child directory without changing the process working directory.
|
|
363
365
|
|
|
364
366
|
Omitted or `undefined` child options retain inherited configuration, including individual builtin flags and host bindings. Use `humanInput: null` to withdraw input explicitly; empty arrays and other explicit values keep their normal meanings, subject to the parent's capability ceiling.
|
|
365
367
|
|
|
@@ -763,6 +763,8 @@ readonly agentDir?: string;
|
|
|
763
763
|
|
|
764
764
|
Select the stage working directory and agent configuration directory. Worktree-enabled cwd values are remapped and contained by the rules above.
|
|
765
765
|
|
|
766
|
+
Without a stage `cwd`, stages use the workflow invocation directory. For workflows launched from an SDK session, this is the owning session's `cwd`, even when the host process runs elsewhere. A `cwd` configured through `createAgentSessionAdapter()` takes precedence over that default.
|
|
767
|
+
|
|
766
768
|
### Host-supplied SDK seams
|
|
767
769
|
|
|
768
770
|
```typescript
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.32-alpha.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@bastani/atomic",
|
|
9
|
-
"version": "0.9.
|
|
9
|
+
"version": "0.9.32-alpha.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@bastani/atomic-natives": "0.9.
|
|
13
|
-
"@bastani/pi-ai": "0.9.
|
|
12
|
+
"@bastani/atomic-natives": "0.9.32-alpha.1",
|
|
13
|
+
"@bastani/pi-ai": "0.9.32-alpha.1",
|
|
14
14
|
"@dbos-inc/dbos-sdk": "4.25.14",
|
|
15
15
|
"@earendil-works/pi-agent-core": "1.1.0",
|
|
16
16
|
"@earendil-works/pi-client": "1.1.0",
|
|
@@ -432,18 +432,18 @@
|
|
|
432
432
|
}
|
|
433
433
|
},
|
|
434
434
|
"node_modules/@bastani/atomic-natives": {
|
|
435
|
-
"version": "0.9.
|
|
436
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.
|
|
435
|
+
"version": "0.9.32-alpha.1",
|
|
436
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.32-alpha.1.tgz",
|
|
437
437
|
"license": "MIT",
|
|
438
438
|
"optionalDependencies": {
|
|
439
|
-
"@bastani/atomic-natives-darwin-arm64": "0.9.
|
|
440
|
-
"@bastani/atomic-natives-darwin-x64": "0.9.
|
|
441
|
-
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.
|
|
442
|
-
"@bastani/atomic-natives-linux-arm64-musl": "0.9.
|
|
443
|
-
"@bastani/atomic-natives-linux-x64-gnu": "0.9.
|
|
444
|
-
"@bastani/atomic-natives-linux-x64-musl": "0.9.
|
|
445
|
-
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.
|
|
446
|
-
"@bastani/atomic-natives-win32-x64-msvc": "0.9.
|
|
439
|
+
"@bastani/atomic-natives-darwin-arm64": "0.9.32-alpha.1",
|
|
440
|
+
"@bastani/atomic-natives-darwin-x64": "0.9.32-alpha.1",
|
|
441
|
+
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.32-alpha.1",
|
|
442
|
+
"@bastani/atomic-natives-linux-arm64-musl": "0.9.32-alpha.1",
|
|
443
|
+
"@bastani/atomic-natives-linux-x64-gnu": "0.9.32-alpha.1",
|
|
444
|
+
"@bastani/atomic-natives-linux-x64-musl": "0.9.32-alpha.1",
|
|
445
|
+
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.32-alpha.1",
|
|
446
|
+
"@bastani/atomic-natives-win32-x64-msvc": "0.9.32-alpha.1"
|
|
447
447
|
},
|
|
448
448
|
"engines": {
|
|
449
449
|
"bun": ">=1.4.2",
|
|
@@ -451,8 +451,8 @@
|
|
|
451
451
|
}
|
|
452
452
|
},
|
|
453
453
|
"node_modules/@bastani/atomic-natives-darwin-arm64": {
|
|
454
|
-
"version": "0.9.
|
|
455
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.
|
|
454
|
+
"version": "0.9.32-alpha.1",
|
|
455
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.32-alpha.1.tgz",
|
|
456
456
|
"license": "MIT",
|
|
457
457
|
"os": [
|
|
458
458
|
"darwin"
|
|
@@ -463,8 +463,8 @@
|
|
|
463
463
|
"optional": true
|
|
464
464
|
},
|
|
465
465
|
"node_modules/@bastani/atomic-natives-darwin-x64": {
|
|
466
|
-
"version": "0.9.
|
|
467
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.
|
|
466
|
+
"version": "0.9.32-alpha.1",
|
|
467
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.32-alpha.1.tgz",
|
|
468
468
|
"license": "MIT",
|
|
469
469
|
"os": [
|
|
470
470
|
"darwin"
|
|
@@ -475,8 +475,8 @@
|
|
|
475
475
|
"optional": true
|
|
476
476
|
},
|
|
477
477
|
"node_modules/@bastani/atomic-natives-linux-arm64-gnu": {
|
|
478
|
-
"version": "0.9.
|
|
479
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.
|
|
478
|
+
"version": "0.9.32-alpha.1",
|
|
479
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.32-alpha.1.tgz",
|
|
480
480
|
"license": "MIT",
|
|
481
481
|
"os": [
|
|
482
482
|
"linux"
|
|
@@ -490,8 +490,8 @@
|
|
|
490
490
|
"optional": true
|
|
491
491
|
},
|
|
492
492
|
"node_modules/@bastani/atomic-natives-linux-arm64-musl": {
|
|
493
|
-
"version": "0.9.
|
|
494
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.
|
|
493
|
+
"version": "0.9.32-alpha.1",
|
|
494
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.32-alpha.1.tgz",
|
|
495
495
|
"license": "MIT",
|
|
496
496
|
"os": [
|
|
497
497
|
"linux"
|
|
@@ -505,8 +505,8 @@
|
|
|
505
505
|
"optional": true
|
|
506
506
|
},
|
|
507
507
|
"node_modules/@bastani/atomic-natives-linux-x64-gnu": {
|
|
508
|
-
"version": "0.9.
|
|
509
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.
|
|
508
|
+
"version": "0.9.32-alpha.1",
|
|
509
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.32-alpha.1.tgz",
|
|
510
510
|
"license": "MIT",
|
|
511
511
|
"os": [
|
|
512
512
|
"linux"
|
|
@@ -520,8 +520,8 @@
|
|
|
520
520
|
"optional": true
|
|
521
521
|
},
|
|
522
522
|
"node_modules/@bastani/atomic-natives-linux-x64-musl": {
|
|
523
|
-
"version": "0.9.
|
|
524
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.
|
|
523
|
+
"version": "0.9.32-alpha.1",
|
|
524
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.32-alpha.1.tgz",
|
|
525
525
|
"license": "MIT",
|
|
526
526
|
"os": [
|
|
527
527
|
"linux"
|
|
@@ -535,8 +535,8 @@
|
|
|
535
535
|
"optional": true
|
|
536
536
|
},
|
|
537
537
|
"node_modules/@bastani/atomic-natives-win32-arm64-msvc": {
|
|
538
|
-
"version": "0.9.
|
|
539
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.
|
|
538
|
+
"version": "0.9.32-alpha.1",
|
|
539
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.32-alpha.1.tgz",
|
|
540
540
|
"license": "MIT",
|
|
541
541
|
"os": [
|
|
542
542
|
"win32"
|
|
@@ -547,8 +547,8 @@
|
|
|
547
547
|
"optional": true
|
|
548
548
|
},
|
|
549
549
|
"node_modules/@bastani/atomic-natives-win32-x64-msvc": {
|
|
550
|
-
"version": "0.9.
|
|
551
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.
|
|
550
|
+
"version": "0.9.32-alpha.1",
|
|
551
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.32-alpha.1.tgz",
|
|
552
552
|
"license": "MIT",
|
|
553
553
|
"os": [
|
|
554
554
|
"win32"
|
|
@@ -559,8 +559,8 @@
|
|
|
559
559
|
"optional": true
|
|
560
560
|
},
|
|
561
561
|
"node_modules/@bastani/pi-ai": {
|
|
562
|
-
"version": "0.9.
|
|
563
|
-
"resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.
|
|
562
|
+
"version": "0.9.32-alpha.1",
|
|
563
|
+
"resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.32-alpha.1.tgz",
|
|
564
564
|
"license": "MIT",
|
|
565
565
|
"dependencies": {
|
|
566
566
|
"@anthropic-ai/sdk": "0.129.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.32-alpha.1",
|
|
4
4
|
"description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"atomicConfig": {
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"prepublishOnly": "bun run clean && bun run build && bun run shrinkwrap"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@bastani/atomic-natives": "0.9.
|
|
86
|
-
"@bastani/pi-ai": "0.9.
|
|
85
|
+
"@bastani/atomic-natives": "0.9.32-alpha.1",
|
|
86
|
+
"@bastani/pi-ai": "0.9.32-alpha.1",
|
|
87
87
|
"@dbos-inc/dbos-sdk": "4.25.14",
|
|
88
88
|
"@earendil-works/pi-agent-core": "1.1.0",
|
|
89
89
|
"@earendil-works/pi-client": "1.1.0",
|