@ai-outfitter/outfitter 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/PiSessionDirectory.d.ts +16 -0
- package/dist/agents/PiSessionDirectory.js +41 -0
- package/dist/agents/PiSessionDirectory.js.map +1 -0
- package/dist/cli/commands/DumpCommand.js +1 -1
- package/dist/cli/commands/DumpCommand.js.map +1 -1
- package/dist/cli/commands/RunAgentCommand.js +11 -3
- package/dist/cli/commands/RunAgentCommand.js.map +1 -1
- package/dist/cli/commands/ValidateCommand.js +1 -1
- package/dist/cli/commands/ValidateCommand.js.map +1 -1
- package/dist/composer/Composer.d.ts +7 -5
- package/dist/composer/Composer.js +280 -64
- package/dist/composer/Composer.js.map +1 -1
- package/dist/composer/Composition.d.ts +34 -3
- package/dist/composer/PromptSource.d.ts +44 -0
- package/dist/composer/PromptSource.js +113 -0
- package/dist/composer/PromptSource.js.map +1 -0
- package/dist/dump/Dump.d.ts +1 -1
- package/dist/dump/Dump.js +111 -20
- package/dist/dump/Dump.js.map +1 -1
- package/dist/projection/Materialize.d.ts +1 -5
- package/dist/projection/Materialize.js +57 -13
- package/dist/projection/Materialize.js.map +1 -1
- package/dist/projection/ProjectHarness.js +19 -4
- package/dist/projection/ProjectHarness.js.map +1 -1
- package/dist/projection/Projection.d.ts +2 -0
- package/dist/resolver/AgentDefinition.d.ts +9 -0
- package/dist/resolver/AgentDefinition.js +17 -0
- package/dist/resolver/AgentDefinition.js.map +1 -1
- package/dist/resolver/ResolverValidation.d.ts +1 -1
- package/dist/resolver/ResolverValidation.js +25 -15
- package/dist/resolver/ResolverValidation.js.map +1 -1
- package/dist/schemas/agent.schema.json +32 -0
- package/docs/documentation/agents.md +81 -26
- package/docs/documentation/migration.md +18 -9
- package/docs/documentation/profiles.md +24 -7
- package/docs/documentation/state.md +28 -1
- package/package.json +1 -1
- package/src/schemas/agent.schema.json +32 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pi's session-storage environment override. pi resolves the session directory as
|
|
3
|
+
* `--session-dir` → `PI_CODING_AGENT_SESSION_DIR` → `sessionDir` in settings.json, so a
|
|
4
|
+
* pass-through `-- --session-dir <dir>` still wins over the default Outfitter sets here.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PI_SESSION_DIRECTORY_ENV = "PI_CODING_AGENT_SESSION_DIR";
|
|
7
|
+
/** pi's durable session folder for one project: `~/.pi/agent/sessions/--<encoded project>--`. */
|
|
8
|
+
export declare const resolvePiUserSessionDirectory: (homeDirectory: string, projectDirectory: string) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Session directory for a pi launch, or `undefined` when the launch should keep whatever
|
|
11
|
+
* `PI_CODING_AGENT_SESSION_DIR` it inherits — an explicitly configured store, such as a resident
|
|
12
|
+
* agent's workspace/PVC path, stays in control. `env`, `homeDirectory`, and `projectDirectory` are
|
|
13
|
+
* injected so the resolution stays unit-testable; `projectDirectory` is the directory pi runs in
|
|
14
|
+
* (`process.cwd()`), which is what makes the result pi's own folder for the project.
|
|
15
|
+
*/
|
|
16
|
+
export declare const resolvePiSessionDirectory: (env: Readonly<Record<string, string | undefined>>, homeDirectory: string, projectDirectory: string) => string | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Keeps pi session transcripts durable across runs. Outfitter launches pi with PI_CODING_AGENT_DIR
|
|
2
|
+
// pointed at a per-run projection root that is deleted once the child exits, and pi stores sessions
|
|
3
|
+
// under `<agent dir>/sessions/<encoded cwd>` by default (pi-coding-agent core/session-manager.js:
|
|
4
|
+
// getDefaultSessionDirPath()). Left alone every transcript dies with the projection, so
|
|
5
|
+
// `pi --continue`/`--resume` can never find the previous conversation (#223).
|
|
6
|
+
//
|
|
7
|
+
// Outfitter therefore points pi at the same per-project folder under pi's durable agent directory
|
|
8
|
+
// that a standalone pi already writes to, so history is shared between `outfitter run` and a bare
|
|
9
|
+
// `pi` in the same project, and `--continue` keeps pi's fast path instead of scanning every
|
|
10
|
+
// project's transcripts.
|
|
11
|
+
import { join, resolve } from 'node:path';
|
|
12
|
+
import { resolvePiUserAgentDirectory } from './PiCredentialPersistence.js';
|
|
13
|
+
/**
|
|
14
|
+
* pi's session-storage environment override. pi resolves the session directory as
|
|
15
|
+
* `--session-dir` → `PI_CODING_AGENT_SESSION_DIR` → `sessionDir` in settings.json, so a
|
|
16
|
+
* pass-through `-- --session-dir <dir>` still wins over the default Outfitter sets here.
|
|
17
|
+
*/
|
|
18
|
+
export const PI_SESSION_DIRECTORY_ENV = 'PI_CODING_AGENT_SESSION_DIR';
|
|
19
|
+
// pi's own encoding of a project directory into a single session folder name: absolute path,
|
|
20
|
+
// leading separator dropped, remaining separators and drive colons flattened to '-', wrapped in
|
|
21
|
+
// '--'. Mirrored here so Outfitter runs share pi's native per-project folder rather than starting a
|
|
22
|
+
// parallel layout.
|
|
23
|
+
const encodeProjectDirectory = (projectDirectory) => `--${resolve(projectDirectory)
|
|
24
|
+
.replace(/^[/\\]/u, '')
|
|
25
|
+
.replace(/[/\\:]/gu, '-')}--`;
|
|
26
|
+
/** pi's durable session folder for one project: `~/.pi/agent/sessions/--<encoded project>--`. */
|
|
27
|
+
export const resolvePiUserSessionDirectory = (homeDirectory, projectDirectory) => join(resolvePiUserAgentDirectory(homeDirectory), 'sessions', encodeProjectDirectory(projectDirectory));
|
|
28
|
+
/**
|
|
29
|
+
* Session directory for a pi launch, or `undefined` when the launch should keep whatever
|
|
30
|
+
* `PI_CODING_AGENT_SESSION_DIR` it inherits — an explicitly configured store, such as a resident
|
|
31
|
+
* agent's workspace/PVC path, stays in control. `env`, `homeDirectory`, and `projectDirectory` are
|
|
32
|
+
* injected so the resolution stays unit-testable; `projectDirectory` is the directory pi runs in
|
|
33
|
+
* (`process.cwd()`), which is what makes the result pi's own folder for the project.
|
|
34
|
+
*/
|
|
35
|
+
export const resolvePiSessionDirectory = (env, homeDirectory, projectDirectory) => {
|
|
36
|
+
const inherited = env[PI_SESSION_DIRECTORY_ENV];
|
|
37
|
+
if (inherited !== undefined && inherited.trim() !== '')
|
|
38
|
+
return undefined;
|
|
39
|
+
return resolvePiUserSessionDirectory(homeDirectory, projectDirectory);
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=PiSessionDirectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PiSessionDirectory.js","sourceRoot":"","sources":["../../src/agents/PiSessionDirectory.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,oGAAoG;AACpG,kGAAkG;AAClG,wFAAwF;AACxF,8EAA8E;AAC9E,EAAE;AACF,kGAAkG;AAClG,kGAAkG;AAClG,4FAA4F;AAC5F,yBAAyB;AACzB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAE3E;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,6BAA6B,CAAC;AAEtE,6FAA6F;AAC7F,gGAAgG;AAChG,oGAAoG;AACpG,mBAAmB;AACnB,MAAM,sBAAsB,GAAG,CAAC,gBAAwB,EAAU,EAAE,CAClE,KAAK,OAAO,CAAC,gBAAgB,CAAC;KAC3B,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;KACtB,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC;AAElC,iGAAiG;AACjG,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,aAAqB,EAAE,gBAAwB,EAAU,EAAE,CACvG,IAAI,CAAC,2BAA2B,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEzG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,GAAiD,EACjD,aAAqB,EACrB,gBAAwB,EACJ,EAAE;IACtB,MAAM,SAAS,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAChD,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAEzE,OAAO,6BAA6B,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;AACxE,CAAC,CAAC"}
|
|
@@ -19,7 +19,7 @@ export const executeDumpCommand = (input) => {
|
|
|
19
19
|
}
|
|
20
20
|
const syncWarnings = warnings.map((warning) => `warning: ${warning}`);
|
|
21
21
|
const agentSlug = resolveAgentSlug(settings, input.agent);
|
|
22
|
-
const result = dumpAgent(set, agentSlug, input.out);
|
|
22
|
+
const result = dumpAgent(set, agentSlug, input.out, input.projectDirectory);
|
|
23
23
|
const ok = result.errors.length === 0;
|
|
24
24
|
const messages = ok
|
|
25
25
|
? [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DumpCommand.js","sourceRoot":"","sources":["../../../src/cli/commands/DumpCommand.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAqBrF,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAE,SAA6B,EAAU,EAAE;IACrF,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,QAAQ,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,QAAQ,CAAC,YAAY,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAgB,EAAqB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,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,eAAwC,EAAE,EAAiB,EAAE,CAAC,CAAC;IAC/F,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,8DAA8D;IAC3E,QAAQ,CAAC,OAAgB;QACvB,OAAO,CAAC,UAAU,CAChB,IAAI,OAAO,CAAC,MAAM,CAAC;aAChB,WAAW,CAAC,8DAA8D,CAAC;aAC3E,MAAM,CAAC,cAAc,EAAE,uDAAuD,CAAC;aAC/E,MAAM,CAAC,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,CAAC;aAC9D,MAAM,CAAC,CAAC,OAAwC,EAAE,EAAE;YACnD,MAAM,MAAM,GAAG,kBAAkB,CAAC;gBAChC,+FAA+F;gBAC/F,aAAa,EAAE,oBAAoB,CAAC,YAAY,CAAC,aAAa,CAAC;gBAC/D,gBAAgB,EAAE,uBAAuB,CAAC,YAAY,CAAC,gBAAgB,CAAC;gBACxE,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,GAAG,EAAE,OAAO,CAAC,GAAG;aACjB,CAAC,CAAC;YAEH,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACtC,uFAAuF;gBACvF,CAAC,YAAY,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;YACnD,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;gBACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACvB,CAAC;QACH,CAAC,CAAC,CACL,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { join } from 'node:path';
|
|
|
5
5
|
import { Option } from 'commander';
|
|
6
6
|
import { launchThroughSpawn, spawnLauncher } from '../../agents/AgentLaunch.js';
|
|
7
7
|
import { persistPiCredentials, resolvePiUserAgentDirectory, seedPiCredentials, } from '../../agents/PiCredentialPersistence.js';
|
|
8
|
+
import { resolvePiSessionDirectory } from '../../agents/PiSessionDirectory.js';
|
|
8
9
|
import { compose } from '../../composer/Composer.js';
|
|
9
10
|
import { ensurePiExtensions } from '../../extensions/PiExtensionCache.js';
|
|
10
11
|
import { resolveOutfitterCacheDir } from '../../paths/OutfitterCache.js';
|
|
@@ -51,6 +52,10 @@ const launchWithCredentialPersistence = async (input, harness, rootDirectory, la
|
|
|
51
52
|
persistPiCredentials(rootDirectory, piUserAgentDirectory);
|
|
52
53
|
return exitCode;
|
|
53
54
|
};
|
|
55
|
+
// pi writes sessions inside PI_CODING_AGENT_DIR — the projection root Outfitter deletes after the
|
|
56
|
+
// run — so resolve pi's durable per-project store instead and let `--continue` outlive the run. An
|
|
57
|
+
// inherited PI_CODING_AGENT_SESSION_DIR keeps precedence (undefined), as do non-pi harnesses.
|
|
58
|
+
const resolveSessionDirectory = (input, harness) => harness === 'pi' ? resolvePiSessionDirectory(process.env, input.homeDirectory, input.projectDirectory) : undefined;
|
|
54
59
|
// Installs/caches the pi extensions for the composed agent (pi only) so they load at launch.
|
|
55
60
|
const resolvePiExtensions = async (input, harness, extensionSpecs) => {
|
|
56
61
|
if (harness !== 'pi')
|
|
@@ -61,6 +66,7 @@ const resolvePiExtensions = async (input, harness, extensionSpecs) => {
|
|
|
61
66
|
spawn: input.extensionInstallSpawner,
|
|
62
67
|
});
|
|
63
68
|
};
|
|
69
|
+
const piConfigurationOverlays = (plan, selectedAgent) => [...(plan.contributingAgents ?? [selectedAgent])].reverse().flatMap((agent) => agent.piConfigDirectories ?? []);
|
|
64
70
|
export const executeRunAgentCommand = async (input) => {
|
|
65
71
|
// Flush messages to the terminal (before launch); they are also returned so callers can inspect them.
|
|
66
72
|
const emit = (messages) => {
|
|
@@ -86,25 +92,27 @@ export const executeRunAgentCommand = async (input) => {
|
|
|
86
92
|
const { set, settings } = resolved;
|
|
87
93
|
const agentSlug = resolveAgentSlug(settings.defaultAgent, input.agent);
|
|
88
94
|
const harness = resolveHarness(settings.defaultHarness, input.harness);
|
|
89
|
-
const composed = compose(set, agentSlug);
|
|
95
|
+
const composed = compose(set, agentSlug, { projectDirectory: input.projectDirectory });
|
|
90
96
|
if (composed.plan === undefined) {
|
|
91
|
-
const messages = [...setupMessages, ...composed.errors];
|
|
97
|
+
const messages = [...setupMessages, ...composed.warnings, ...composed.errors];
|
|
92
98
|
emit(messages);
|
|
93
99
|
return { exitCode: 1, messages };
|
|
94
100
|
}
|
|
95
101
|
// Install/cache the pi extensions into a shared XDG cache and load them at launch (pi only).
|
|
96
102
|
const extensions = await resolvePiExtensions(input, harness, composed.plan.loadout.extensions);
|
|
97
103
|
const selectedAgent = findResource(set, 'agent', agentSlug);
|
|
104
|
+
const configurationOverlays = piConfigurationOverlays(composed.plan, selectedAgent);
|
|
98
105
|
const rootDirectory = mkdtempSync(join(tmpdir(), `outfitter-${agentSlug}-${harness}-`));
|
|
99
106
|
try {
|
|
100
107
|
const projection = projectComposition(composed.plan, {
|
|
101
108
|
harness,
|
|
102
109
|
rootDirectory,
|
|
103
110
|
homeDirectory: input.homeDirectory,
|
|
111
|
+
sessionDirectory: resolveSessionDirectory(input, harness),
|
|
104
112
|
passThroughArgs: input.passThroughArgs,
|
|
105
113
|
extensionLoadDirs: harness === 'pi' ? extensions.loadDirs : undefined,
|
|
106
114
|
// ProjectHarness only overlays these for the pi harness, so pass them through unconditionally.
|
|
107
|
-
configurationOverlayDirectories:
|
|
115
|
+
configurationOverlayDirectories: configurationOverlays,
|
|
108
116
|
});
|
|
109
117
|
// Composition warnings, unsupported harness elements, and extension-install failures are all
|
|
110
118
|
// advisory; --strict makes the combined set fatal before launch.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunAgentCommand.js","sourceRoot":"","sources":["../../../src/cli/commands/RunAgentCommand.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,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CAAC;CACF,CAAC,CAAC"}
|
|
@@ -10,7 +10,7 @@ export const executeValidateCommand = (input) => {
|
|
|
10
10
|
const findings = [
|
|
11
11
|
...settingsFindings(settingsIssues.map(formatSettingsIssue)),
|
|
12
12
|
...warnings.map((message) => ({ severity: 'warning', resource: 'settings', message })),
|
|
13
|
-
...validateEffectiveSet(set),
|
|
13
|
+
...validateEffectiveSet(set, input.projectDirectory),
|
|
14
14
|
];
|
|
15
15
|
const hasErrors = findings.some((finding) => finding.severity === 'error');
|
|
16
16
|
const hasWarnings = findings.some((finding) => finding.severity === 'warning');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidateCommand.js","sourceRoot":"","sources":["../../../src/cli/commands/ValidateCommand.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAqBrF,MAAM,gBAAgB,GAAG,CAAC,QAA2B,EAAgC,EAAE,CACrF,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AAE7F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAoB,EAAkB,EAAE;IAC7E,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG;QACf,GAAG,gBAAgB,CAAC,cAAc,CAAC,GAAG,CAAC,mBAAmB,CAAC,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AC;AAC/E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,eAA4C,EAAE,EAAiB,EAAE,CAAC,CAAC;IACvG,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,4EAA4E;IACzF,QAAQ,CAAC,OAAgB;QACvB,OAAO,CAAC,UAAU,CAChB,IAAI,OAAO,CAAC,UAAU,CAAC;aACpB,WAAW,CAAC,4EAA4E,CAAC;aACzF,MAAM,CAAC,UAAU,EAAE,4DAA4D,CAAC;aAChF,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC;aAC1C,MAAM,CAAC,CAAC,OAA6C,EAAE,EAAE;YACxD,+FAA+F;YAC/F,MAAM,aAAa,GAAG,oBAAoB,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;YACvE,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;YAChF,MAAM,MAAM,GAAG,sBAAsB,CAAC;gBACpC,aAAa;gBACb,gBAAgB;gBAChB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB,CAAC,CAAC;YAEH,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACtC,uFAAuF;gBACvF,CAAC,YAAY,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;YACnD,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;gBACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACvB,CAAC;QACH,CAAC,CAAC,CACL,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { EffectiveResourceSet } from '../resolver/Resource.js';
|
|
2
2
|
import type { CompositionPlan } from './Composition.js';
|
|
3
|
+
export interface ComposeOptions {
|
|
4
|
+
/** Active repository root for `repo_file` prompt references. */
|
|
5
|
+
readonly projectDirectory?: string;
|
|
6
|
+
}
|
|
3
7
|
export interface ComposeResult {
|
|
4
8
|
readonly plan?: CompositionPlan;
|
|
5
9
|
readonly errors: readonly string[];
|
|
10
|
+
readonly warnings: readonly string[];
|
|
6
11
|
}
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
* resolve or its definition is invalid; loadout slugs that do not resolve are non-fatal warnings.
|
|
10
|
-
*/
|
|
11
|
-
export declare const compose: (set: EffectiveResourceSet, agentSlug: string) => ComposeResult;
|
|
12
|
+
/** Composes one selected agent from the shared effective resource set. */
|
|
13
|
+
export declare const compose: (set: EffectiveResourceSet, agentSlug: string, options?: ComposeOptions) => ComposeResult;
|
|
@@ -4,22 +4,148 @@ import { join } from 'node:path';
|
|
|
4
4
|
import { escapesRoots } from '../dump/Containment.js';
|
|
5
5
|
import { isAgentDefinitionIssue, readAgentDefinition } from '../resolver/AgentDefinition.js';
|
|
6
6
|
import { findLoadoutResource, findResource } from '../resolver/Resource.js';
|
|
7
|
+
import { agentBodyFragment, promptSourceKey, resolvePromptSource, rootPromptFragment } from './PromptSource.js';
|
|
7
8
|
/** Reads the highest-precedence tree-root file (e.g. system-prompt.md) across layers, or undefined. */
|
|
8
9
|
const readRootFile = (set, fileName) => {
|
|
9
10
|
for (const layer of set.layers) {
|
|
10
11
|
const candidate = join(layer.root, fileName);
|
|
11
12
|
if (existsSync(candidate)) {
|
|
12
|
-
return readFileSync(candidate, 'utf8');
|
|
13
|
+
return rootPromptFragment({ fileName, layer, content: readFileSync(candidate, 'utf8') });
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
return undefined;
|
|
16
17
|
};
|
|
17
|
-
const
|
|
18
|
+
const readValidAgent = (agent) => {
|
|
19
|
+
const definition = readAgentDefinition(agent.winner.path, agent.configPaths);
|
|
20
|
+
if (isAgentDefinitionIssue(definition))
|
|
21
|
+
return definition.message;
|
|
22
|
+
if (definition.name !== agent.slug)
|
|
23
|
+
return `agent.md name '${definition.name}' must match its directory.`;
|
|
24
|
+
return definition;
|
|
25
|
+
};
|
|
26
|
+
const resolveInheritanceChain = (set, agentSlug) => {
|
|
27
|
+
const entries = [];
|
|
28
|
+
const composed = new Set();
|
|
29
|
+
const visiting = [];
|
|
30
|
+
const errors = [];
|
|
31
|
+
const visit = (slug) => {
|
|
32
|
+
if (composed.has(slug))
|
|
33
|
+
return;
|
|
34
|
+
const cycleIndex = visiting.indexOf(slug);
|
|
35
|
+
if (cycleIndex !== -1) {
|
|
36
|
+
errors.push(`Agent inheritance cycle detected: ${[...visiting.slice(cycleIndex), slug].join(' -> ')}.`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const resource = findResource(set, 'agent', slug);
|
|
40
|
+
if (resource === undefined) {
|
|
41
|
+
errors.push(`Agent inheritance references unknown parent '${slug}' in chain ${[...visiting, slug].join(' -> ')}.`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const definition = readValidAgent(resource);
|
|
45
|
+
if (typeof definition === 'string') {
|
|
46
|
+
errors.push(`Agent '${slug}' is invalid: ${definition}`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
visiting.push(slug);
|
|
50
|
+
for (const parent of definition.inherits)
|
|
51
|
+
visit(parent);
|
|
52
|
+
visiting.pop();
|
|
53
|
+
if (!composed.has(slug)) {
|
|
54
|
+
composed.add(slug);
|
|
55
|
+
entries.push({ resource, definition });
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
visit(agentSlug);
|
|
59
|
+
return errors.length > 0 ? { errors } : { entries, errors: [] };
|
|
60
|
+
};
|
|
61
|
+
const stablePush = (items, keySet, key, value) => {
|
|
62
|
+
if (!keySet.has(key)) {
|
|
63
|
+
keySet.add(key);
|
|
64
|
+
items.push(value);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const union = (values = [], next = []) => {
|
|
68
|
+
const merged = [];
|
|
69
|
+
const seen = new Set();
|
|
70
|
+
for (const value of [...values, ...next])
|
|
71
|
+
stablePush(merged, seen, value, value);
|
|
72
|
+
return merged.length > 0 ? merged : undefined;
|
|
73
|
+
};
|
|
74
|
+
const uniqueStrings = (values) => [...new Set(values)];
|
|
75
|
+
const declaredSelections = (chain, select) => {
|
|
76
|
+
const selections = [];
|
|
77
|
+
const seen = new Set();
|
|
78
|
+
for (const entry of chain) {
|
|
79
|
+
for (const slug of select(entry.definition)) {
|
|
80
|
+
stablePush(selections, seen, slug, { slug, owner: entry.resource.slug });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return selections;
|
|
84
|
+
};
|
|
85
|
+
const appendPromptSelections = (chain) => {
|
|
86
|
+
const selections = [];
|
|
87
|
+
const seen = new Set();
|
|
88
|
+
for (const entry of chain) {
|
|
89
|
+
entry.definition.promptControls.appendSystemPrompt.forEach((source, index) => {
|
|
90
|
+
stablePush(selections, seen, promptSourceKey(source), { source, owner: entry.resource.slug, index });
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return selections;
|
|
94
|
+
};
|
|
95
|
+
const nearest = (chain, select) => {
|
|
96
|
+
for (const entry of [...chain].reverse()) {
|
|
97
|
+
const value = select(entry.definition);
|
|
98
|
+
if (value !== undefined)
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
return undefined;
|
|
102
|
+
};
|
|
103
|
+
const composeTools = (chain) => {
|
|
104
|
+
const allow = union([], chain.flatMap((entry) => entry.definition.loadout.tools?.allow ?? []));
|
|
105
|
+
const deny = union([], chain.flatMap((entry) => entry.definition.loadout.tools?.deny ?? []));
|
|
106
|
+
return allow === undefined && deny === undefined ? undefined : { allow, deny };
|
|
107
|
+
};
|
|
108
|
+
const nearestPrompt = (chain, select) => {
|
|
109
|
+
for (const entry of [...chain].reverse()) {
|
|
110
|
+
const source = select(entry.definition);
|
|
111
|
+
if (source !== undefined)
|
|
112
|
+
return { source, owner: entry.resource.slug };
|
|
113
|
+
}
|
|
114
|
+
return undefined;
|
|
115
|
+
};
|
|
116
|
+
const composeEffectiveControls = (chain) => {
|
|
117
|
+
const skills = declaredSelections(chain, (definition) => definition.loadout.skills);
|
|
118
|
+
const subagents = declaredSelections(chain, (definition) => definition.loadout.subagents);
|
|
119
|
+
const mcp = declaredSelections(chain, (definition) => definition.loadout.mcp);
|
|
120
|
+
const model = nearest(chain, (definition) => definition.loadout.model);
|
|
121
|
+
const thinking = nearest(chain, (definition) => definition.loadout.thinking);
|
|
122
|
+
return {
|
|
123
|
+
skillSelections: skills,
|
|
124
|
+
subagentSelections: subagents,
|
|
125
|
+
mcpSelections: mcp,
|
|
126
|
+
appendPromptSelections: appendPromptSelections(chain),
|
|
127
|
+
systemPrompt: nearestPrompt(chain, (definition) => definition.promptControls.systemPrompt),
|
|
128
|
+
promptTemplate: nearestPrompt(chain, (definition) => definition.promptControls.promptTemplate),
|
|
129
|
+
label: nearest(chain, (definition) => definition.label),
|
|
130
|
+
description: nearest(chain, (definition) => definition.description),
|
|
131
|
+
loadout: {
|
|
132
|
+
skills: skills.map((selection) => selection.slug),
|
|
133
|
+
subagents: subagents.map((selection) => selection.slug),
|
|
134
|
+
mcp: mcp.map((selection) => selection.slug),
|
|
135
|
+
extensions: uniqueStrings(chain.flatMap((entry) => entry.definition.loadout.extensions)),
|
|
136
|
+
plugins: uniqueStrings(chain.flatMap((entry) => entry.definition.loadout.plugins)),
|
|
137
|
+
model,
|
|
138
|
+
thinking,
|
|
139
|
+
tools: composeTools(chain),
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
const resolveDeclaredSlugs = (set, kind, reference, selections, warnings) => {
|
|
18
144
|
const resolved = [];
|
|
19
|
-
for (const
|
|
20
|
-
const resource = findLoadoutResource(set,
|
|
145
|
+
for (const selection of selections) {
|
|
146
|
+
const resource = findLoadoutResource(set, selection.owner, kind, selection.slug);
|
|
21
147
|
if (resource === undefined) {
|
|
22
|
-
warnings.push(`${reference} references unknown ${kind} '${slug}'.`);
|
|
148
|
+
warnings.push(`${reference} references unknown ${kind} '${selection.slug}'.`);
|
|
23
149
|
}
|
|
24
150
|
else {
|
|
25
151
|
resolved.push(resource);
|
|
@@ -45,33 +171,47 @@ const readMcpServers = (path, warnings) => {
|
|
|
45
171
|
}
|
|
46
172
|
return servers;
|
|
47
173
|
};
|
|
48
|
-
const composeMcpServers = (set,
|
|
49
|
-
if (
|
|
174
|
+
const composeMcpServers = (set, selections, warnings) => {
|
|
175
|
+
if (selections.length === 0)
|
|
50
176
|
return {};
|
|
51
|
-
}
|
|
52
177
|
const rootPaths = set.layers.map((layer) => join(layer.root, 'mcp.json')).filter((path) => existsSync(path));
|
|
53
|
-
const pathsByPrecedence = [
|
|
54
|
-
...rootPaths.reverse(),
|
|
55
|
-
// Resolver annotates every agent resource with mcpPaths, including an empty array.
|
|
56
|
-
...[...agent.mcpPaths].reverse(),
|
|
57
|
-
];
|
|
58
|
-
const available = {};
|
|
59
178
|
const roots = set.layers.map((layer) => layer.root);
|
|
60
|
-
|
|
179
|
+
const cache = new Map();
|
|
180
|
+
const serversAt = (path) => {
|
|
181
|
+
const cached = cache.get(path);
|
|
182
|
+
if (cached !== undefined)
|
|
183
|
+
return cached;
|
|
184
|
+
let servers;
|
|
61
185
|
if (escapesRoots(path, roots)) {
|
|
62
186
|
warnings.push(`MCP configuration '${path}' resolves outside the resource layers and was skipped.`);
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
Object.assign(available, readMcpServers(path, warnings));
|
|
66
|
-
}
|
|
67
|
-
const selected = {};
|
|
68
|
-
for (const id of selectedIds) {
|
|
69
|
-
if (Object.hasOwn(available, id)) {
|
|
70
|
-
selected[id] = available[id];
|
|
187
|
+
servers = {};
|
|
71
188
|
}
|
|
72
189
|
else {
|
|
73
|
-
|
|
190
|
+
servers = readMcpServers(path, warnings);
|
|
191
|
+
}
|
|
192
|
+
cache.set(path, servers);
|
|
193
|
+
return servers;
|
|
194
|
+
};
|
|
195
|
+
const selected = {};
|
|
196
|
+
for (const selection of selections) {
|
|
197
|
+
// MCP selections are created only from entries in the resolved inheritance chain.
|
|
198
|
+
const owner = findResource(set, 'agent', selection.owner);
|
|
199
|
+
// Root definitions are shared; only the declaring agent's overlays may override its selection.
|
|
200
|
+
const ownerPaths = [...owner.mcpPaths].reverse();
|
|
201
|
+
const pathsByPrecedence = [...rootPaths].reverse().concat(ownerPaths);
|
|
202
|
+
let definition;
|
|
203
|
+
let found = false;
|
|
204
|
+
for (const path of pathsByPrecedence) {
|
|
205
|
+
const servers = serversAt(path);
|
|
206
|
+
if (Object.hasOwn(servers, selection.slug)) {
|
|
207
|
+
definition = servers[selection.slug];
|
|
208
|
+
found = true;
|
|
209
|
+
}
|
|
74
210
|
}
|
|
211
|
+
if (found)
|
|
212
|
+
selected[selection.slug] = definition;
|
|
213
|
+
else
|
|
214
|
+
warnings.push(`loadout mcp references unknown server '${selection.slug}'.`);
|
|
75
215
|
}
|
|
76
216
|
return selected;
|
|
77
217
|
};
|
|
@@ -80,14 +220,15 @@ const resolveDelegateSkills = (set, subagents, leaderSkills, warnings) => {
|
|
|
80
220
|
const delegateSkills = [];
|
|
81
221
|
const roots = set.layers.map((layer) => layer.root);
|
|
82
222
|
for (const subagent of subagents) {
|
|
83
|
-
|
|
223
|
+
// Resolver annotates every agent resource with configPaths, including an empty array.
|
|
224
|
+
const definitionPaths = [subagent.winner.path, ...subagent.configPaths];
|
|
84
225
|
if (definitionPaths.some((path) => escapesRoots(path, roots)))
|
|
85
226
|
continue;
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
227
|
+
const chain = resolveInheritanceChain(set, subagent.slug);
|
|
228
|
+
if (chain.entries === undefined)
|
|
88
229
|
continue;
|
|
89
|
-
|
|
90
|
-
for (const skill of
|
|
230
|
+
const controls = composeEffectiveControls(chain.entries);
|
|
231
|
+
for (const skill of resolveDeclaredSlugs(set, 'skill', `subagent '${subagent.slug}' loadout skills`, controls.skillSelections, warnings)) {
|
|
91
232
|
const selected = skills.get(skill.slug);
|
|
92
233
|
if (selected === undefined) {
|
|
93
234
|
skills.set(skill.slug, skill);
|
|
@@ -100,54 +241,129 @@ const resolveDelegateSkills = (set, subagents, leaderSkills, warnings) => {
|
|
|
100
241
|
}
|
|
101
242
|
return delegateSkills;
|
|
102
243
|
};
|
|
103
|
-
const composeLoadout = (set,
|
|
104
|
-
const subagents =
|
|
105
|
-
const skills =
|
|
244
|
+
const composeLoadout = (set, controls, warnings) => {
|
|
245
|
+
const subagents = resolveDeclaredSlugs(set, 'agent', 'loadout subagents', controls.subagentSelections, warnings);
|
|
246
|
+
const skills = resolveDeclaredSlugs(set, 'skill', 'loadout skills', controls.skillSelections, warnings);
|
|
106
247
|
return {
|
|
107
248
|
skills,
|
|
108
249
|
delegateSkills: resolveDelegateSkills(set, subagents, skills, warnings),
|
|
109
250
|
subagents,
|
|
110
|
-
mcp: loadout.mcp,
|
|
111
|
-
mcpServers: composeMcpServers(set,
|
|
112
|
-
extensions: loadout.extensions,
|
|
113
|
-
plugins: loadout.plugins,
|
|
114
|
-
model: loadout.model,
|
|
115
|
-
thinking: loadout.thinking,
|
|
116
|
-
tools: loadout.tools,
|
|
251
|
+
mcp: controls.loadout.mcp,
|
|
252
|
+
mcpServers: composeMcpServers(set, controls.mcpSelections, warnings),
|
|
253
|
+
extensions: controls.loadout.extensions,
|
|
254
|
+
plugins: controls.loadout.plugins,
|
|
255
|
+
model: controls.loadout.model,
|
|
256
|
+
thinking: controls.loadout.thinking,
|
|
257
|
+
tools: controls.loadout.tools,
|
|
117
258
|
};
|
|
118
259
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
260
|
+
const resolvePromptSelection = (set, selection, options, label, warnings, errors) => {
|
|
261
|
+
// Prompt selections are created only from entries in the resolved inheritance chain.
|
|
262
|
+
const owner = findResource(set, 'agent', selection.owner);
|
|
263
|
+
const resolved = resolvePromptSource({
|
|
264
|
+
source: selection.source,
|
|
265
|
+
declaringAgent: selection.owner,
|
|
266
|
+
layer: owner.winner.layer,
|
|
267
|
+
projectDirectory: options.projectDirectory,
|
|
268
|
+
optionalRepoFile: true,
|
|
269
|
+
label,
|
|
270
|
+
});
|
|
271
|
+
if (resolved.warning !== undefined)
|
|
272
|
+
warnings.push(resolved.warning);
|
|
273
|
+
if (resolved.error !== undefined)
|
|
274
|
+
errors.push(resolved.error);
|
|
275
|
+
return resolved.fragment;
|
|
276
|
+
};
|
|
277
|
+
const resolveOptionalPrompt = (set, selection, options, label, warnings, errors) => selection === undefined ? undefined : resolvePromptSelection(set, selection, options, label, warnings, errors);
|
|
278
|
+
const composeIdentity = (set, chain, controls, options, warnings, errors) => {
|
|
279
|
+
const declaredSystemPrompt = resolveOptionalPrompt(set, controls.systemPrompt, options, 'system-prompt', warnings, errors);
|
|
280
|
+
if (declaredSystemPrompt?.kind === 'repo_file') {
|
|
281
|
+
warnings.push(`agent '${controls.systemPrompt.owner}' uses untrusted repo_file '${declaredSystemPrompt.reference}' as system_prompt.`);
|
|
127
282
|
}
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
283
|
+
const systemPrompt = declaredSystemPrompt ?? readRootFile(set, 'system-prompt.md');
|
|
284
|
+
const sharedContext = readRootFile(set, 'agents.md');
|
|
285
|
+
const appendSystemPrompts = controls.appendPromptSelections
|
|
286
|
+
.map((selection) => resolvePromptSelection(set, selection, options, `append-${selection.owner}-${selection.index + 1}`, warnings, errors))
|
|
287
|
+
.filter((fragment) => fragment !== undefined);
|
|
288
|
+
const promptTemplate = resolveOptionalPrompt(set, controls.promptTemplate, options, 'prompt-template', warnings, errors);
|
|
289
|
+
const agentBodies = chain.map((entry) => agentBodyFragment({
|
|
290
|
+
agent: entry.resource.slug,
|
|
291
|
+
layer: entry.resource.winner.layer,
|
|
292
|
+
path: entry.resource.winner.path,
|
|
293
|
+
content: entry.definition.body,
|
|
294
|
+
}));
|
|
295
|
+
return {
|
|
296
|
+
systemPrompt: systemPrompt?.content,
|
|
297
|
+
systemPromptFragment: systemPrompt,
|
|
298
|
+
sharedContext: sharedContext?.content,
|
|
299
|
+
sharedContextFragment: sharedContext,
|
|
300
|
+
appendSystemPrompts,
|
|
301
|
+
agentBodies,
|
|
302
|
+
promptTemplate,
|
|
303
|
+
agentBody: agentBodies.map((fragment) => fragment.content).join('\n'),
|
|
304
|
+
label: controls.label,
|
|
305
|
+
description: controls.description,
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
const composeSubagents = (set, subagents, options, warnings, errors) => {
|
|
309
|
+
const composed = [];
|
|
310
|
+
const roots = set.layers.map((layer) => layer.root);
|
|
311
|
+
for (const resource of subagents) {
|
|
312
|
+
const definitionPaths = [resource.winner.path, ...resource.configPaths];
|
|
313
|
+
if (definitionPaths.some((path) => escapesRoots(path, roots)))
|
|
314
|
+
continue;
|
|
315
|
+
const chainResult = resolveInheritanceChain(set, resource.slug);
|
|
316
|
+
if (chainResult.entries === undefined) {
|
|
317
|
+
errors.push(...chainResult.errors.map((error) => `Subagent '${resource.slug}' is invalid: ${error}`));
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
const controls = composeEffectiveControls(chainResult.entries);
|
|
321
|
+
const identity = composeIdentity(set, chainResult.entries, controls, options, warnings, errors);
|
|
322
|
+
const skills = resolveDeclaredSlugs(set, 'skill', `subagent '${resource.slug}' loadout skills`, controls.skillSelections, warnings);
|
|
323
|
+
composed.push({
|
|
324
|
+
resource,
|
|
325
|
+
identity,
|
|
326
|
+
skills,
|
|
327
|
+
extensions: controls.loadout.extensions,
|
|
328
|
+
model: controls.loadout.model,
|
|
329
|
+
thinking: controls.loadout.thinking,
|
|
330
|
+
tools: controls.loadout.tools,
|
|
331
|
+
});
|
|
131
332
|
}
|
|
132
|
-
|
|
133
|
-
|
|
333
|
+
return composed;
|
|
334
|
+
};
|
|
335
|
+
/** Composes one selected agent from the shared effective resource set. */
|
|
336
|
+
export const compose = (set, agentSlug, options = {}) => {
|
|
337
|
+
if (findResource(set, 'agent', agentSlug) === undefined) {
|
|
134
338
|
return {
|
|
135
|
-
errors: [`
|
|
339
|
+
errors: [`Unknown agent '${agentSlug}'. Run 'outfitter list agents' to see resolvable agents.`],
|
|
340
|
+
warnings: [],
|
|
136
341
|
};
|
|
137
342
|
}
|
|
343
|
+
const chainResult = resolveInheritanceChain(set, agentSlug);
|
|
344
|
+
if (chainResult.entries === undefined)
|
|
345
|
+
return { errors: chainResult.errors, warnings: [] };
|
|
346
|
+
const chain = chainResult.entries;
|
|
138
347
|
const warnings = [];
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
348
|
+
const errors = [];
|
|
349
|
+
const controls = composeEffectiveControls(chain);
|
|
350
|
+
const identity = composeIdentity(set, chain, controls, options, warnings, errors);
|
|
351
|
+
const loadout = composeLoadout(set, controls, warnings);
|
|
352
|
+
const composedSubagents = composeSubagents(set, loadout.subagents, options, warnings, errors);
|
|
353
|
+
const uniqueWarnings = uniqueStrings(warnings);
|
|
354
|
+
if (errors.length > 0)
|
|
355
|
+
return { errors, warnings: uniqueWarnings };
|
|
356
|
+
return {
|
|
357
|
+
plan: {
|
|
358
|
+
agent: agentSlug,
|
|
359
|
+
identity,
|
|
360
|
+
loadout: { ...loadout, composedSubagents },
|
|
361
|
+
contributingAgents: chain.map((entry) => entry.resource),
|
|
362
|
+
inheritanceChain: chain.map((entry) => entry.resource.slug),
|
|
363
|
+
warnings: uniqueWarnings,
|
|
147
364
|
},
|
|
148
|
-
|
|
149
|
-
warnings,
|
|
365
|
+
errors: [],
|
|
366
|
+
warnings: uniqueWarnings,
|
|
150
367
|
};
|
|
151
|
-
return { plan, errors: [] };
|
|
152
368
|
};
|
|
153
369
|
//# sourceMappingURL=Composer.js.map
|