@ai-outfitter/outfitter 0.11.0 → 1.0.2
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/.outfitter/skills/outfitter/SKILL.md +67 -37
- package/README.md +63 -35
- package/code/enterprise/cli/privateCatalogSettings.cjs +2 -2
- package/code/enterprise/pi-extension/privateCatalogOnboarding.js +5 -8
- package/code/enterprise/shared/privateCatalogPolicy.cjs +5 -5
- package/code/pi-extension/src/outfitter-extension.js +353 -553
- package/code/pi-extension/src/outfitter-runtime-extension.js +160 -0
- package/dist/agents/AgentLaunch.d.ts +9 -1
- package/dist/agents/AgentLaunch.js +19 -0
- package/dist/agents/AgentLaunch.js.map +1 -1
- package/dist/agents/PiCredentialPersistence.d.ts +6 -0
- package/dist/agents/PiCredentialPersistence.js +33 -0
- package/dist/agents/PiCredentialPersistence.js.map +1 -0
- package/dist/cli/OutfitterCli.js +10 -18
- package/dist/cli/OutfitterCli.js.map +1 -1
- package/dist/cli/commands/CommandObject.d.ts +0 -5
- package/dist/cli/commands/CommandObject.js +1 -4
- package/dist/cli/commands/CommandObject.js.map +1 -1
- package/dist/cli/commands/DumpCommand.d.ts +19 -0
- package/dist/cli/commands/DumpCommand.js +54 -0
- package/dist/cli/commands/DumpCommand.js.map +1 -0
- package/dist/cli/commands/ListCommand.d.ts +17 -0
- package/dist/cli/commands/ListCommand.js +77 -0
- package/dist/cli/commands/ListCommand.js.map +1 -0
- package/dist/cli/commands/PiRuntimeLaunch.d.ts +8 -0
- package/dist/cli/commands/PiRuntimeLaunch.js +47 -0
- package/dist/cli/commands/PiRuntimeLaunch.js.map +1 -0
- package/dist/cli/commands/ProcessDefaults.d.ts +2 -0
- package/dist/cli/commands/ProcessDefaults.js +5 -0
- package/dist/cli/commands/ProcessDefaults.js.map +1 -0
- package/dist/cli/commands/RunAgentCommand.d.ts +46 -0
- package/dist/cli/commands/RunAgentCommand.js +176 -0
- package/dist/cli/commands/RunAgentCommand.js.map +1 -0
- package/dist/cli/commands/SetupCommand.d.ts +38 -6
- package/dist/cli/commands/SetupCommand.js +194 -232
- package/dist/cli/commands/SetupCommand.js.map +1 -1
- package/dist/cli/commands/ValidateCommand.d.ts +20 -0
- package/dist/cli/commands/ValidateCommand.js +54 -0
- package/dist/cli/commands/ValidateCommand.js.map +1 -0
- package/dist/composer/Composer.d.ts +11 -0
- package/dist/composer/Composer.js +72 -0
- package/dist/composer/Composer.js.map +1 -0
- package/dist/composer/Composition.d.ts +33 -0
- package/dist/composer/Composition.js +2 -0
- package/dist/composer/Composition.js.map +1 -0
- package/dist/dump/Containment.d.ts +8 -0
- package/dist/dump/Containment.js +22 -0
- package/dist/dump/Containment.js.map +1 -0
- package/dist/dump/Dump.d.ts +8 -0
- package/dist/dump/Dump.js +182 -0
- package/dist/dump/Dump.js.map +1 -0
- package/dist/extensions/PiExtensionCache.d.ts +30 -0
- package/dist/extensions/PiExtensionCache.js +92 -0
- package/dist/extensions/PiExtensionCache.js.map +1 -0
- package/dist/fs/TypeConflict.d.ts +6 -0
- package/dist/fs/TypeConflict.js +21 -0
- package/dist/fs/TypeConflict.js.map +1 -0
- package/dist/paths/OutfitterCache.d.ts +6 -0
- package/dist/paths/OutfitterCache.js +17 -0
- package/dist/paths/OutfitterCache.js.map +1 -0
- package/dist/projection/Materialize.d.ts +24 -0
- package/dist/projection/Materialize.js +83 -0
- package/dist/projection/Materialize.js.map +1 -0
- package/dist/projection/ProjectHarness.d.ts +5 -0
- package/dist/projection/ProjectHarness.js +77 -0
- package/dist/projection/ProjectHarness.js.map +1 -0
- package/dist/projection/Projection.d.ts +23 -0
- package/dist/projection/Projection.js +2 -0
- package/dist/projection/Projection.js.map +1 -0
- package/dist/resolver/AgentDefinition.d.ts +30 -0
- package/dist/resolver/AgentDefinition.js +123 -0
- package/dist/resolver/AgentDefinition.js.map +1 -0
- package/dist/resolver/Layer.d.ts +12 -0
- package/dist/resolver/Layer.js +30 -0
- package/dist/resolver/Layer.js.map +1 -0
- package/dist/resolver/Resolver.d.ts +3 -0
- package/dist/resolver/Resolver.js +163 -0
- package/dist/resolver/Resolver.js.map +1 -0
- package/dist/resolver/ResolverContext.d.ts +15 -0
- package/dist/resolver/ResolverContext.js +11 -0
- package/dist/resolver/ResolverContext.js.map +1 -0
- package/dist/resolver/ResolverValidation.d.ts +11 -0
- package/dist/resolver/ResolverValidation.js +112 -0
- package/dist/resolver/ResolverValidation.js.map +1 -0
- package/dist/resolver/Resource.d.ts +88 -0
- package/dist/resolver/Resource.js +34 -0
- package/dist/resolver/Resource.js.map +1 -0
- package/dist/schemas/agent.schema.json +48 -0
- package/dist/schemas/settings.schema.json +32 -9
- package/dist/settings/Settings.d.ts +34 -5
- package/dist/settings/Settings.js +3 -1
- package/dist/settings/Settings.js.map +1 -1
- package/dist/settings/SettingsLoader.d.ts +1 -1
- package/dist/settings/SettingsLoader.js +23 -22
- package/dist/settings/SettingsLoader.js.map +1 -1
- package/dist/settings/SettingsMerger.js +12 -10
- package/dist/settings/SettingsMerger.js.map +1 -1
- package/dist/setup/DefaultCatalog.d.ts +20 -0
- package/dist/setup/DefaultCatalog.js +89 -0
- package/dist/setup/DefaultCatalog.js.map +1 -0
- package/dist/setup/Setup.d.ts +43 -0
- package/dist/setup/Setup.js +261 -0
- package/dist/setup/Setup.js.map +1 -0
- package/dist/skills/SkillDocument.d.ts +6 -1
- package/dist/skills/SkillDocument.js.map +1 -1
- package/dist/sources/SourceCache.d.ts +19 -0
- package/dist/{profiles/ProfileCache.js → sources/SourceCache.js} +22 -18
- package/dist/sources/SourceCache.js.map +1 -0
- package/dist/validation/SchemaValidator.d.ts +1 -1
- package/dist/validation/SchemaValidator.js +4 -13
- package/dist/validation/SchemaValidator.js.map +1 -1
- package/docs/architecture/state_writeback_strategy.md +54 -122
- package/docs/documentation/README.md +33 -12
- package/docs/documentation/actions.md +35 -52
- package/docs/documentation/agents.md +109 -0
- package/docs/documentation/best-practices.md +25 -63
- package/docs/documentation/catalogs.md +126 -0
- package/docs/documentation/cli.md +39 -41
- package/docs/documentation/concepts.md +66 -23
- package/docs/documentation/dump-and-bake.md +30 -0
- package/docs/documentation/first-time-cli-agent-users.md +8 -8
- package/docs/documentation/getting-started.md +28 -8
- package/docs/documentation/hooks.md +20 -0
- package/docs/documentation/iterating-on-profiles.md +56 -70
- package/docs/documentation/local-development.md +84 -0
- package/docs/documentation/migration.md +39 -0
- package/docs/documentation/personas.md +41 -0
- package/docs/documentation/porting-claude.md +54 -0
- package/docs/documentation/profiles.md +16 -169
- package/docs/documentation/settings.md +61 -0
- package/docs/documentation/skills.md +93 -334
- package/docs/documentation/state.md +24 -62
- package/docs/documentation/subagents.md +37 -0
- package/docs/documentation/support-matrix.md +40 -35
- package/docs/documentation/switching-to-outfitter.md +75 -81
- package/docs/documentation/tasks.md +13 -0
- package/docs/documentation/usecases/engineering.md +67 -84
- package/docs/documentation/usecases/organization-profile-catalog.md +83 -111
- package/docs/documentation/usecases/persona-reviews.md +133 -139
- package/docs/philosophy.md +2 -2
- package/package.json +3 -3
- package/src/schemas/agent.schema.json +48 -0
- package/src/schemas/settings.schema.json +32 -9
- package/dist/agents/AdapterProfileControls.d.ts +0 -21
- package/dist/agents/AdapterProfileControls.js +0 -76
- package/dist/agents/AdapterProfileControls.js.map +0 -1
- package/dist/agents/AdapterStatePaths.d.ts +0 -12
- package/dist/agents/AdapterStatePaths.js +0 -46
- package/dist/agents/AdapterStatePaths.js.map +0 -1
- package/dist/agents/AgentAdapter.d.ts +0 -44
- package/dist/agents/AgentAdapter.js +0 -2
- package/dist/agents/AgentAdapter.js.map +0 -1
- package/dist/agents/AgentRegistry.d.ts +0 -6
- package/dist/agents/AgentRegistry.js +0 -17
- package/dist/agents/AgentRegistry.js.map +0 -1
- package/dist/agents/LaunchResources.d.ts +0 -17
- package/dist/agents/LaunchResources.js +0 -61
- package/dist/agents/LaunchResources.js.map +0 -1
- package/dist/agents/OutfitterSkill.d.ts +0 -11
- package/dist/agents/OutfitterSkill.js +0 -128
- package/dist/agents/OutfitterSkill.js.map +0 -1
- package/dist/agents/ResourceIdentity.d.ts +0 -2
- package/dist/agents/ResourceIdentity.js +0 -51
- package/dist/agents/ResourceIdentity.js.map +0 -1
- package/dist/agents/claude/ClaudeAdapter.d.ts +0 -2
- package/dist/agents/claude/ClaudeAdapter.js +0 -148
- package/dist/agents/claude/ClaudeAdapter.js.map +0 -1
- package/dist/agents/claude/ClaudeCompositeProfileWriter.d.ts +0 -5
- package/dist/agents/claude/ClaudeCompositeProfileWriter.js +0 -7
- package/dist/agents/claude/ClaudeCompositeProfileWriter.js.map +0 -1
- package/dist/agents/pi/PiAdapter.d.ts +0 -2
- package/dist/agents/pi/PiAdapter.js +0 -363
- package/dist/agents/pi/PiAdapter.js.map +0 -1
- package/dist/agents/pi/PiArgs.d.ts +0 -2
- package/dist/agents/pi/PiArgs.js +0 -15
- package/dist/agents/pi/PiArgs.js.map +0 -1
- package/dist/agents/pi/PiCompositeProfileWriter.d.ts +0 -5
- package/dist/agents/pi/PiCompositeProfileWriter.js +0 -7
- package/dist/agents/pi/PiCompositeProfileWriter.js.map +0 -1
- package/dist/agents/pi/PiExtensionCache.d.ts +0 -12
- package/dist/agents/pi/PiExtensionCache.js +0 -195
- package/dist/agents/pi/PiExtensionCache.js.map +0 -1
- package/dist/agents/pi/PiMcpConfig.d.ts +0 -2
- package/dist/agents/pi/PiMcpConfig.js +0 -114
- package/dist/agents/pi/PiMcpConfig.js.map +0 -1
- package/dist/agents/pi/PiSettingsMergePolicy.d.ts +0 -17
- package/dist/agents/pi/PiSettingsMergePolicy.js +0 -59
- package/dist/agents/pi/PiSettingsMergePolicy.js.map +0 -1
- package/dist/agents/pi/PiSkillSources.d.ts +0 -8
- package/dist/agents/pi/PiSkillSources.js +0 -73
- package/dist/agents/pi/PiSkillSources.js.map +0 -1
- package/dist/cli/commands/FirstRunWelcomeProfile.d.ts +0 -11
- package/dist/cli/commands/FirstRunWelcomeProfile.js +0 -110
- package/dist/cli/commands/FirstRunWelcomeProfile.js.map +0 -1
- package/dist/cli/commands/PiLoginLaunch.d.ts +0 -22
- package/dist/cli/commands/PiLoginLaunch.js +0 -170
- package/dist/cli/commands/PiLoginLaunch.js.map +0 -1
- package/dist/cli/commands/RunCommand.d.ts +0 -36
- package/dist/cli/commands/RunCommand.js +0 -345
- package/dist/cli/commands/RunCommand.js.map +0 -1
- package/dist/cli/commands/SyncCommand.d.ts +0 -46
- package/dist/cli/commands/SyncCommand.js +0 -244
- package/dist/cli/commands/SyncCommand.js.map +0 -1
- package/dist/cli/commands/WelcomeCommand.d.ts +0 -56
- package/dist/cli/commands/WelcomeCommand.js +0 -224
- package/dist/cli/commands/WelcomeCommand.js.map +0 -1
- package/dist/cli/commands/assets/outfitter-ascii.txt +0 -5
- package/dist/cli/commands/profile/Command.d.ts +0 -7
- package/dist/cli/commands/profile/Command.js +0 -24
- package/dist/cli/commands/profile/Command.js.map +0 -1
- package/dist/cli/commands/profile/CreateCommand.d.ts +0 -19
- package/dist/cli/commands/profile/CreateCommand.js +0 -115
- package/dist/cli/commands/profile/CreateCommand.js.map +0 -1
- package/dist/cli/commands/profile/LintCommand.d.ts +0 -19
- package/dist/cli/commands/profile/LintCommand.js +0 -155
- package/dist/cli/commands/profile/LintCommand.js.map +0 -1
- package/dist/cli/commands/profile/ListCommand.d.ts +0 -19
- package/dist/cli/commands/profile/ListCommand.js +0 -91
- package/dist/cli/commands/profile/ListCommand.js.map +0 -1
- package/dist/cli/commands/profile/Shared.d.ts +0 -9
- package/dist/cli/commands/profile/Shared.js +0 -10
- package/dist/cli/commands/profile/Shared.js.map +0 -1
- package/dist/cli/commands/run/RunFirstRunOnboarding.d.ts +0 -7
- package/dist/cli/commands/run/RunFirstRunOnboarding.js +0 -52
- package/dist/cli/commands/run/RunFirstRunOnboarding.js.map +0 -1
- package/dist/cli/commands/run/RunLaunchSummary.d.ts +0 -2
- package/dist/cli/commands/run/RunLaunchSummary.js +0 -35
- package/dist/cli/commands/run/RunLaunchSummary.js.map +0 -1
- package/dist/cli/commands/run/RunProfileResolution.d.ts +0 -39
- package/dist/cli/commands/run/RunProfileResolution.js +0 -128
- package/dist/cli/commands/run/RunProfileResolution.js.map +0 -1
- package/dist/cli/commands/run/RunStateWritePrompt.d.ts +0 -2
- package/dist/cli/commands/run/RunStateWritePrompt.js +0 -29
- package/dist/cli/commands/run/RunStateWritePrompt.js.map +0 -1
- package/dist/cli/commands/setup/SetupPrompts.d.ts +0 -14
- package/dist/cli/commands/setup/SetupPrompts.js +0 -296
- package/dist/cli/commands/setup/SetupPrompts.js.map +0 -1
- package/dist/cli/commands/setup/SetupSourceImport.d.ts +0 -5
- package/dist/cli/commands/setup/SetupSourceImport.js +0 -177
- package/dist/cli/commands/setup/SetupSourceImport.js.map +0 -1
- package/dist/cli/commands/setup/SetupSourceLaunch.d.ts +0 -4
- package/dist/cli/commands/setup/SetupSourceLaunch.js +0 -65
- package/dist/cli/commands/setup/SetupSourceLaunch.js.map +0 -1
- package/dist/cli/commands/setup/SetupStarterSource.d.ts +0 -21
- package/dist/cli/commands/setup/SetupStarterSource.js +0 -133
- package/dist/cli/commands/setup/SetupStarterSource.js.map +0 -1
- package/dist/cli/commands/setup/SetupTypes.d.ts +0 -91
- package/dist/cli/commands/setup/SetupTypes.js +0 -26
- package/dist/cli/commands/setup/SetupTypes.js.map +0 -1
- package/dist/compositeProfile/CompositeProfile.d.ts +0 -8
- package/dist/compositeProfile/CompositeProfile.js +0 -6
- package/dist/compositeProfile/CompositeProfile.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileAssembler.d.ts +0 -12
- package/dist/compositeProfile/CompositeProfileAssembler.js +0 -32
- package/dist/compositeProfile/CompositeProfileAssembler.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileCleanup.d.ts +0 -9
- package/dist/compositeProfile/CompositeProfileCleanup.js +0 -87
- package/dist/compositeProfile/CompositeProfileCleanup.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileFile.d.ts +0 -16
- package/dist/compositeProfile/CompositeProfileFile.js +0 -16
- package/dist/compositeProfile/CompositeProfileFile.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileTemplate.d.ts +0 -15
- package/dist/compositeProfile/CompositeProfileTemplate.js +0 -65
- package/dist/compositeProfile/CompositeProfileTemplate.js.map +0 -1
- package/dist/compositeProfile/CompositeProfileWatcher.d.ts +0 -18
- package/dist/compositeProfile/CompositeProfileWatcher.js +0 -46
- package/dist/compositeProfile/CompositeProfileWatcher.js.map +0 -1
- package/dist/compositeProfile/StatePersistence.d.ts +0 -39
- package/dist/compositeProfile/StatePersistence.js +0 -249
- package/dist/compositeProfile/StatePersistence.js.map +0 -1
- package/dist/fs/SafeSymlink.d.ts +0 -13
- package/dist/fs/SafeSymlink.js +0 -50
- package/dist/fs/SafeSymlink.js.map +0 -1
- package/dist/profiles/Profile.d.ts +0 -60
- package/dist/profiles/Profile.js +0 -7
- package/dist/profiles/Profile.js.map +0 -1
- package/dist/profiles/ProfileCache.d.ts +0 -8
- package/dist/profiles/ProfileCache.js.map +0 -1
- package/dist/profiles/ProfileLoader.d.ts +0 -28
- package/dist/profiles/ProfileLoader.js +0 -299
- package/dist/profiles/ProfileLoader.js.map +0 -1
- package/dist/profiles/ProfileMerger.d.ts +0 -19
- package/dist/profiles/ProfileMerger.js +0 -112
- package/dist/profiles/ProfileMerger.js.map +0 -1
- package/dist/profiles/ProfileSource.d.ts +0 -35
- package/dist/profiles/ProfileSource.js +0 -13
- package/dist/profiles/ProfileSource.js.map +0 -1
- package/dist/profiles/PromptIncludes.d.ts +0 -32
- package/dist/profiles/PromptIncludes.js +0 -147
- package/dist/profiles/PromptIncludes.js.map +0 -1
- package/dist/prompts/SystemPromptExport.d.ts +0 -16
- package/dist/prompts/SystemPromptExport.js +0 -81
- package/dist/prompts/SystemPromptExport.js.map +0 -1
- package/dist/schemas/profile-source.schema.json +0 -29
- package/dist/schemas/profile.schema.json +0 -200
- package/dist/skills/ProfileSkillResolution.d.ts +0 -21
- package/dist/skills/ProfileSkillResolution.js +0 -88
- package/dist/skills/ProfileSkillResolution.js.map +0 -1
- package/dist/skills/SkillCatalog.d.ts +0 -41
- package/dist/skills/SkillCatalog.js +0 -119
- package/dist/skills/SkillCatalog.js.map +0 -1
- package/dist/skills/SkillResolution.d.ts +0 -34
- package/dist/skills/SkillResolution.js +0 -369
- package/dist/skills/SkillResolution.js.map +0 -1
- package/docs/documentation/profile-repository.md +0 -179
- package/src/schemas/SchemaDocument.ts +0 -20
- package/src/schemas/profile-source.schema.json +0 -29
- package/src/schemas/profile.schema.json +0 -200
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Materializes a CompositionPlan into a runtime configuration directory the harness launches from.
|
|
2
|
+
import { copyFileSync, lstatSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { escapesRoots } from '../dump/Containment.js';
|
|
5
|
+
import { removeTargetTypeConflict } from '../fs/TypeConflict.js';
|
|
6
|
+
/** Recursively copies a directory, skipping symlinked entries so no path escapes the tree. */
|
|
7
|
+
const copyDirectory = (sourceDir, targetDir) => {
|
|
8
|
+
removeTargetTypeConflict(targetDir, 'directory');
|
|
9
|
+
mkdirSync(targetDir, { recursive: true });
|
|
10
|
+
for (const entry of readdirSync(sourceDir, { withFileTypes: true })) {
|
|
11
|
+
const sourcePath = join(sourceDir, entry.name);
|
|
12
|
+
if (lstatSync(sourcePath).isSymbolicLink()) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (entry.isDirectory()) {
|
|
16
|
+
copyDirectory(sourcePath, join(targetDir, entry.name));
|
|
17
|
+
}
|
|
18
|
+
else if (entry.isFile()) {
|
|
19
|
+
const targetPath = join(targetDir, entry.name);
|
|
20
|
+
removeTargetTypeConflict(targetPath, 'file');
|
|
21
|
+
copyFileSync(sourcePath, targetPath);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const writeGeneratedFile = (path, content) => {
|
|
26
|
+
removeTargetTypeConflict(path, 'file');
|
|
27
|
+
writeFileSync(path, content);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Overlays native harness configuration into the runtime root. Inputs arrive highest precedence
|
|
31
|
+
* first, so copying in reverse order lets higher layers replace matching files. Symlinked overlay
|
|
32
|
+
* roots and entries are skipped so a catalog cannot make projection read outside its layer.
|
|
33
|
+
*/
|
|
34
|
+
export const materializeConfigurationOverlays = (sourceDirectories, rootDirectory) => {
|
|
35
|
+
mkdirSync(rootDirectory, { recursive: true });
|
|
36
|
+
for (const sourceDirectory of [...sourceDirectories].reverse()) {
|
|
37
|
+
if (lstatSync(sourceDirectory).isSymbolicLink())
|
|
38
|
+
continue;
|
|
39
|
+
copyDirectory(sourceDirectory, rootDirectory);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const materializeSkill = (skill, rootDirectory) => {
|
|
43
|
+
const sourceDir = dirname(skill.winner.path);
|
|
44
|
+
// A skill whose directory resolves outside its layer cannot be materialized safely.
|
|
45
|
+
if (escapesRoots(sourceDir, [skill.winner.layer.root])) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
const targetDir = join(rootDirectory, 'skills', skill.slug);
|
|
49
|
+
copyDirectory(sourceDir, targetDir);
|
|
50
|
+
return targetDir;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Writes the composed identity and skills into `rootDirectory`. The base `system-prompt.md` becomes
|
|
54
|
+
* the system prompt; shared `agents.md` context and the agent body are appended in order. Each
|
|
55
|
+
* selected skill directory (SKILL.md + scripts/assets) is copied so the harness has real content.
|
|
56
|
+
*/
|
|
57
|
+
export const materializeComposition = (composition, rootDirectory) => {
|
|
58
|
+
mkdirSync(rootDirectory, { recursive: true });
|
|
59
|
+
const systemPromptPath = join(rootDirectory, 'system-prompt.md');
|
|
60
|
+
writeGeneratedFile(systemPromptPath, composition.identity.systemPrompt ?? '');
|
|
61
|
+
const appendPromptPaths = [];
|
|
62
|
+
if (composition.identity.sharedContext !== undefined) {
|
|
63
|
+
const contextPath = join(rootDirectory, 'agents.md');
|
|
64
|
+
writeGeneratedFile(contextPath, composition.identity.sharedContext);
|
|
65
|
+
appendPromptPaths.push(contextPath);
|
|
66
|
+
}
|
|
67
|
+
const agentBodyPath = join(rootDirectory, 'agent.md');
|
|
68
|
+
writeGeneratedFile(agentBodyPath, composition.identity.agentBody);
|
|
69
|
+
appendPromptPaths.push(agentBodyPath);
|
|
70
|
+
const skillDirectories = [];
|
|
71
|
+
const skippedSkills = [];
|
|
72
|
+
for (const skill of composition.loadout.skills) {
|
|
73
|
+
const materialized = materializeSkill(skill, rootDirectory);
|
|
74
|
+
if (materialized === undefined) {
|
|
75
|
+
skippedSkills.push(skill.slug);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
skillDirectories.push(materialized);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return { rootDirectory, systemPromptPath, appendPromptPaths, skillDirectories, skippedSkills };
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=Materialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Materialize.js","sourceRoot":"","sources":["../../src/projection/Materialize.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAejE,8FAA8F;AAC9F,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAE,SAAiB,EAAQ,EAAE;IACnE,wBAAwB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACjD,SAAS,CAAC,SAAS,EAAE,E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AAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACtD,kBAAkB,CAAC,aAAa,EAAE,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAClE,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAEtC,MAAM,gBAAgB,GAAa,EAAE,CAAC;IACtC,MAAM,aAAa,GAAa,EAAE,CAAC;IAEnC,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/C,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAC5D,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC;AACjG,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CompositionPlan } from '../composer/Composition.js';
|
|
2
|
+
import type { AgentProjectionPlan, ProjectionInput } from './Projection.js';
|
|
3
|
+
export declare const unsupportedElements: (composition: CompositionPlan, input: ProjectionInput) => readonly string[];
|
|
4
|
+
/** Materializes the composition into the runtime root and builds the harness launch plan. */
|
|
5
|
+
export declare const projectComposition: (composition: CompositionPlan, input: ProjectionInput) => AgentProjectionPlan;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { materializeComposition, materializeConfigurationOverlays } from './Materialize.js';
|
|
2
|
+
// Loadout elements a projection actually maps to native config. Anything else is reported
|
|
3
|
+
// unsupported so `--strict` catches silently-dropped selections. Baseline for both harnesses is
|
|
4
|
+
// identity + skills + model + thinking; pi additionally projects `extensions` once the run path has
|
|
5
|
+
// resolved their install dirs (`extensionLoadDirs`). subagents/mcp/plugins/tools remain unsupported
|
|
6
|
+
// pending incremental parity (#183).
|
|
7
|
+
const supportedElements = (input) => {
|
|
8
|
+
const baseline = ['skills', 'model', 'thinking'];
|
|
9
|
+
return input.harness === 'pi' && input.extensionLoadDirs !== undefined ? [...baseline, 'extensions'] : baseline;
|
|
10
|
+
};
|
|
11
|
+
const loadoutElementsInUse = (composition) => {
|
|
12
|
+
const { loadout } = composition;
|
|
13
|
+
const present = [];
|
|
14
|
+
if (loadout.skills.length > 0)
|
|
15
|
+
present.push('skills');
|
|
16
|
+
if (loadout.subagents.length > 0)
|
|
17
|
+
present.push('subagents');
|
|
18
|
+
if (loadout.extensions.length > 0)
|
|
19
|
+
present.push('extensions');
|
|
20
|
+
if (loadout.plugins.length > 0)
|
|
21
|
+
present.push('plugins');
|
|
22
|
+
if (loadout.mcp.length > 0)
|
|
23
|
+
present.push('mcp');
|
|
24
|
+
if (loadout.model !== undefined)
|
|
25
|
+
present.push('model');
|
|
26
|
+
if (loadout.thinking !== undefined)
|
|
27
|
+
present.push('thinking');
|
|
28
|
+
if (loadout.tools !== undefined)
|
|
29
|
+
present.push('tools');
|
|
30
|
+
return present;
|
|
31
|
+
};
|
|
32
|
+
export const unsupportedElements = (composition, input) => loadoutElementsInUse(composition).filter((element) => !supportedElements(input).includes(element));
|
|
33
|
+
const promptArgs = (systemPromptPath, appendPromptPaths) => [
|
|
34
|
+
'--system-prompt',
|
|
35
|
+
systemPromptPath,
|
|
36
|
+
...appendPromptPaths.flatMap((path) => ['--append-system-prompt', path]),
|
|
37
|
+
];
|
|
38
|
+
const modelArgs = (composition, harness) => {
|
|
39
|
+
const args = [];
|
|
40
|
+
if (composition.loadout.model !== undefined) {
|
|
41
|
+
args.push('--model', composition.loadout.model);
|
|
42
|
+
}
|
|
43
|
+
if (composition.loadout.thinking !== undefined) {
|
|
44
|
+
args.push(harness === 'pi' ? '--thinking' : '--effort', composition.loadout.thinking);
|
|
45
|
+
}
|
|
46
|
+
return args;
|
|
47
|
+
};
|
|
48
|
+
const buildLaunchPlan = (composition, input, systemPromptPath, appendPromptPaths) => {
|
|
49
|
+
const isPi = input.harness === 'pi';
|
|
50
|
+
const skillArgs = isPi ? composition.loadout.skills.flatMap((skill) => ['--skill', skill.slug]) : [];
|
|
51
|
+
const extensionArgs = isPi ? (input.extensionLoadDirs ?? []).flatMap((dir) => ['--extension', dir]) : [];
|
|
52
|
+
return {
|
|
53
|
+
command: isPi ? 'pi' : 'claude',
|
|
54
|
+
args: [
|
|
55
|
+
...promptArgs(systemPromptPath, appendPromptPaths),
|
|
56
|
+
...skillArgs,
|
|
57
|
+
...extensionArgs,
|
|
58
|
+
...modelArgs(composition, input.harness),
|
|
59
|
+
...(input.passThroughArgs ?? []),
|
|
60
|
+
],
|
|
61
|
+
env: isPi ? { PI_CODING_AGENT_DIR: input.rootDirectory } : { CLAUDE_CONFIG_DIR: input.rootDirectory },
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/** Materializes the composition into the runtime root and builds the harness launch plan. */
|
|
65
|
+
export const projectComposition = (composition, input) => {
|
|
66
|
+
if (input.harness === 'pi') {
|
|
67
|
+
materializeConfigurationOverlays(input.configurationOverlayDirectories ?? [], input.rootDirectory);
|
|
68
|
+
}
|
|
69
|
+
const materialized = materializeComposition(composition, input.rootDirectory);
|
|
70
|
+
const launch = buildLaunchPlan(composition, input, materialized.systemPromptPath, materialized.appendPromptPaths);
|
|
71
|
+
const unsupported = [
|
|
72
|
+
...unsupportedElements(composition, input),
|
|
73
|
+
...materialized.skippedSkills.map((slug) => `skill:${slug} (escaping symlink)`),
|
|
74
|
+
];
|
|
75
|
+
return { rootDirectory: input.rootDirectory, launch, unsupported };
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=ProjectHarness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectHarness.js","sourceRoot":"","sources":["../../src/projection/ProjectHarness.ts"],"names":[],"mappings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,CAAC,CAAC;IACrG,CAAC;IACD,MAAM,YAAY,GAAG,sBAAsB,CAAC,WAAW,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC9E,MAAM,MAAM,GAAG,eAAe,CAAC,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,gBAAgB,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC;IAClH,MAAM,WAAW,GAAG;QAClB,GAAG,mBAAmB,CAAC,WAAW,EAAE,KAAK,CAAC;QAC1C,GAAG,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,IAAI,qBAAqB,CAAC;KAChF,CAAC;IAEF,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACrE,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Harness } from '../settings/Settings.js';
|
|
2
|
+
export interface AgentLaunchPlan {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly args: readonly string[];
|
|
5
|
+
readonly env: Readonly<Record<string, string>>;
|
|
6
|
+
}
|
|
7
|
+
export interface AgentProjectionPlan {
|
|
8
|
+
/** Absolute path to the materialized runtime configuration root for this run. */
|
|
9
|
+
readonly rootDirectory: string;
|
|
10
|
+
readonly launch: AgentLaunchPlan;
|
|
11
|
+
/** Composition elements the selected harness cannot project. */
|
|
12
|
+
readonly unsupported: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ProjectionInput {
|
|
15
|
+
readonly harness: Harness;
|
|
16
|
+
readonly rootDirectory: string;
|
|
17
|
+
readonly homeDirectory: string;
|
|
18
|
+
readonly passThroughArgs?: readonly string[];
|
|
19
|
+
/** Local pi extension install directories to load with `--extension` (pi only). */
|
|
20
|
+
readonly extensionLoadDirs?: readonly string[];
|
|
21
|
+
/** Harness-native configuration directories, highest precedence first, overlaid into the root. */
|
|
22
|
+
readonly configurationOverlayDirectories?: readonly string[];
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Projection.js","sourceRoot":"","sources":["../../src/projection/Projection.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Loadout } from './Resource.js';
|
|
2
|
+
export interface AgentDefinition {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly description?: string;
|
|
5
|
+
/** Markdown body after the frontmatter — the agent's identity prose. */
|
|
6
|
+
readonly body: string;
|
|
7
|
+
readonly loadout: Loadout;
|
|
8
|
+
}
|
|
9
|
+
export interface AgentDefinitionIssue {
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const isAgentDefinitionIssue: <T extends object>(value: T | AgentDefinitionIssue) => value is AgentDefinitionIssue;
|
|
14
|
+
/** Loadout fields a per-agent config.json may override; identity fields (`name`) are frontmatter-only. */
|
|
15
|
+
export declare const loadoutKeys: readonly ["skills", "subagents", "mcp", "extensions", "plugins", "model", "thinking", "tools"];
|
|
16
|
+
/** Restricts an arbitrary record to the loadout keys config.json is allowed to supply. */
|
|
17
|
+
export declare const pickLoadoutKeys: (record: Readonly<Record<string, unknown>>) => Record<string, unknown>;
|
|
18
|
+
interface FrontmatterSplit {
|
|
19
|
+
readonly frontmatter: string;
|
|
20
|
+
readonly body: string;
|
|
21
|
+
}
|
|
22
|
+
/** Splits leading `---` YAML frontmatter from the markdown body. */
|
|
23
|
+
export declare const splitFrontmatter: (content: string) => FrontmatterSplit | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Parses an agent definition. `configPaths` are highest-precedence first; each is a loadout-only
|
|
26
|
+
* override that JSON-merges by key across layers over the frontmatter loadout.
|
|
27
|
+
*/
|
|
28
|
+
export declare const parseAgentDefinition: (content: string, configPaths: readonly string[], agentPath: string) => AgentDefinition | AgentDefinitionIssue;
|
|
29
|
+
export declare const readAgentDefinition: (agentPath: string, configPaths?: readonly string[]) => AgentDefinition | AgentDefinitionIssue;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Parses `agents/<id>/agent.md` frontmatter and merges per-layer config.json loadout overrides.
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { validateSchema } from '../validation/SchemaValidator.js';
|
|
4
|
+
import { parseYamlDocument } from '../validation/YamlDocument.js';
|
|
5
|
+
import { emptyLoadout } from './Resource.js';
|
|
6
|
+
export const isAgentDefinitionIssue = (value) => 'message' in value;
|
|
7
|
+
/** Loadout fields a per-agent config.json may override; identity fields (`name`) are frontmatter-only. */
|
|
8
|
+
export const loadoutKeys = [
|
|
9
|
+
'skills',
|
|
10
|
+
'subagents',
|
|
11
|
+
'mcp',
|
|
12
|
+
'extensions',
|
|
13
|
+
'plugins',
|
|
14
|
+
'model',
|
|
15
|
+
'thinking',
|
|
16
|
+
'tools',
|
|
17
|
+
];
|
|
18
|
+
/** Restricts an arbitrary record to the loadout keys config.json is allowed to supply. */
|
|
19
|
+
export const pickLoadoutKeys = (record) => Object.fromEntries(loadoutKeys.filter((key) => key in record).map((key) => [key, record[key]]));
|
|
20
|
+
/** Splits leading `---` YAML frontmatter from the markdown body. */
|
|
21
|
+
export const splitFrontmatter = (content) => {
|
|
22
|
+
const lines = content.split('\n');
|
|
23
|
+
if (lines[0]?.trimEnd() !== '---') {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const closingIndex = lines.findIndex((line, index) => index > 0 && line.trimEnd() === '---');
|
|
27
|
+
if (closingIndex === -1) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
frontmatter: lines.slice(1, closingIndex).join('\n'),
|
|
32
|
+
body: lines
|
|
33
|
+
.slice(closingIndex + 1)
|
|
34
|
+
.join('\n')
|
|
35
|
+
.replace(/^\n/, ''),
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const asStringArray = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === 'string') : [];
|
|
39
|
+
const asString = (value) => (typeof value === 'string' ? value : undefined);
|
|
40
|
+
const loadoutFromRecord = (record) => {
|
|
41
|
+
const tools = record.tools;
|
|
42
|
+
return {
|
|
43
|
+
...emptyLoadout(),
|
|
44
|
+
skills: asStringArray(record.skills),
|
|
45
|
+
subagents: asStringArray(record.subagents),
|
|
46
|
+
mcp: asStringArray(record.mcp),
|
|
47
|
+
extensions: asStringArray(record.extensions),
|
|
48
|
+
plugins: asStringArray(record.plugins),
|
|
49
|
+
model: asString(record.model),
|
|
50
|
+
thinking: asString(record.thinking),
|
|
51
|
+
tools: tools === undefined ? undefined : { allow: asStringArray(tools.allow), deny: asStringArray(tools.deny) },
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/** Reads one config.json, restricting it to loadout keys; parse/read/non-object failures are issues. */
|
|
55
|
+
const readConfigLoadout = (configPath) => {
|
|
56
|
+
let parsed;
|
|
57
|
+
try {
|
|
58
|
+
parsed = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
return { path: configPath, message: `config.json is not readable JSON: ${String(error)}` };
|
|
62
|
+
}
|
|
63
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
64
|
+
return { path: configPath, message: 'config.json must be a JSON object of loadout overrides.' };
|
|
65
|
+
}
|
|
66
|
+
return pickLoadoutKeys(parsed);
|
|
67
|
+
};
|
|
68
|
+
const parseFrontmatterRecord = (content, agentPath) => {
|
|
69
|
+
const split = splitFrontmatter(content);
|
|
70
|
+
if (split === undefined) {
|
|
71
|
+
return { path: agentPath, message: 'agent.md must start with a `---` YAML frontmatter block.' };
|
|
72
|
+
}
|
|
73
|
+
const parsed = parseYamlDocument(split.frontmatter, agentPath);
|
|
74
|
+
if (!parsed.ok) {
|
|
75
|
+
return { path: agentPath, message: `agent.md frontmatter is not valid YAML: ${parsed.issue.message}` };
|
|
76
|
+
}
|
|
77
|
+
if (parsed.document === null || typeof parsed.document !== 'object' || Array.isArray(parsed.document)) {
|
|
78
|
+
return { path: agentPath, message: 'agent.md frontmatter must be a YAML mapping.' };
|
|
79
|
+
}
|
|
80
|
+
// Validate the frontmatter on its own so config.json cannot supply required identity fields.
|
|
81
|
+
const validation = validateSchema('agent', parsed.document);
|
|
82
|
+
if (!validation.valid) {
|
|
83
|
+
// An invalid document always yields at least one issue.
|
|
84
|
+
return { path: agentPath, message: `agent.md is invalid: ${validation.issues[0].message}` };
|
|
85
|
+
}
|
|
86
|
+
return { record: parsed.document, body: split.body };
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Parses an agent definition. `configPaths` are highest-precedence first; each is a loadout-only
|
|
90
|
+
* override that JSON-merges by key across layers over the frontmatter loadout.
|
|
91
|
+
*/
|
|
92
|
+
export const parseAgentDefinition = (content, configPaths, agentPath) => {
|
|
93
|
+
const frontmatter = parseFrontmatterRecord(content, agentPath);
|
|
94
|
+
if (isAgentDefinitionIssue(frontmatter)) {
|
|
95
|
+
return frontmatter;
|
|
96
|
+
}
|
|
97
|
+
let merged = { ...frontmatter.record };
|
|
98
|
+
// Apply lowest precedence first so higher layers win per key.
|
|
99
|
+
for (const configPath of [...configPaths].reverse()) {
|
|
100
|
+
const config = readConfigLoadout(configPath);
|
|
101
|
+
if (isAgentDefinitionIssue(config)) {
|
|
102
|
+
return config;
|
|
103
|
+
}
|
|
104
|
+
merged = { ...merged, ...config };
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
name: frontmatter.record.name,
|
|
108
|
+
description: asString(frontmatter.record.description),
|
|
109
|
+
body: frontmatter.body,
|
|
110
|
+
loadout: loadoutFromRecord(merged),
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
export const readAgentDefinition = (agentPath, configPaths = []) => {
|
|
114
|
+
let content;
|
|
115
|
+
try {
|
|
116
|
+
content = readFileSync(agentPath, 'utf8');
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
return { path: agentPath, message: `Could not read agent.md: ${String(error)}` };
|
|
120
|
+
}
|
|
121
|
+
return parseAgentDefinition(content, configPaths, agentPath);
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=AgentDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentDefinition.js","sourceRoot":"","sources":["../../src/resolver/AgentDefinition.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAe7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,KAA+B,EACA,EAAE,CAAC,SAAS,IAAI,KAAK,CAAC;AAEvD,0GAA0G;AAC1G,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,QAAQ;IACR,WAAW;IACX,KAAK;IACL,YAAY;IACZ,SAAS;IACT,OAAO;IACP,UAAU;IACV,OAAO;CACC,CAAC;AAEX,0FAA0F;AAC1F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAyC,EAA2B,EAAE,CACpG,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAOlG,oEAAoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAgC,EAAE;IAChF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,IAAI,KAAK,CAAC,CAAC,CAA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interface LayerDiscoveryInput {
|
|
4
|
+
readonly homeDirectory: string;
|
|
5
|
+
readonly projectDirectory: string;
|
|
6
|
+
readonly settings: Settings;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Orders layers highest precedence first: workspace `.agents`, then global `~/.agents`,
|
|
10
|
+
* then configured sources in order. Only layers whose root exists on disk are included.
|
|
11
|
+
*/
|
|
12
|
+
export declare const discoverLayers: (input: LayerDiscoveryInput) => readonly Layer[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Builds the ordered `.agents` layer stack (workspace over global over remote sources) from settings.
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { encodeRemoteSource, resolveRemoteRepositorySubpath } from '../sources/SourceCache.js';
|
|
5
|
+
const agentsRoot = (directory) => join(directory, '.agents');
|
|
6
|
+
// Remote sources cache under the configured cache_directory, defaulting to ~/.agents/cache.
|
|
7
|
+
const cacheRoot = (input) => input.settings.cacheDirectory ?? join(input.homeDirectory, '.agents', 'cache');
|
|
8
|
+
const sourceLayer = (input, source) => {
|
|
9
|
+
if (source.path !== undefined && source.uri === undefined && source.github === undefined) {
|
|
10
|
+
return { root: source.path, origin: 'source', label: source.path };
|
|
11
|
+
}
|
|
12
|
+
const remote = source;
|
|
13
|
+
const repositoryPath = join(cacheRoot(input), 'repos', encodeRemoteSource(remote));
|
|
14
|
+
const root = source.path === undefined ? repositoryPath : resolveRemoteRepositorySubpath(repositoryPath, source.path);
|
|
15
|
+
const label = remote.uri ?? `github:${remote.github}`;
|
|
16
|
+
return { root, origin: 'source', label };
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Orders layers highest precedence first: workspace `.agents`, then global `~/.agents`,
|
|
20
|
+
* then configured sources in order. Only layers whose root exists on disk are included.
|
|
21
|
+
*/
|
|
22
|
+
export const discoverLayers = (input) => {
|
|
23
|
+
const candidates = [
|
|
24
|
+
{ root: agentsRoot(input.projectDirectory), origin: 'workspace', label: 'workspace' },
|
|
25
|
+
{ root: agentsRoot(input.homeDirectory), origin: 'global', label: 'global' },
|
|
26
|
+
...(input.settings.sources ?? []).map((source) => sourceLayer(input, source)),
|
|
27
|
+
];
|
|
28
|
+
return candidates.filter((layer) => existsSync(layer.root));
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=Layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Layer.js","sourceRoot":"","sources":["../../src/resolver/Layer.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAU/F,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAU,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAE7E,4FAA4F;AAC5F,MAAM,SAAS,GAAG,CAAC,KAA0B,EAAU,EAAE,CACvD,KAAK,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAEjF,MAAM,WAAW,GAAG,CAAC,KAA0B,EAAE,MAAuB,EAAS,EAAE;IACjF,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACzF,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IACrE,CAAC;IAED,MAAM,MAAM,GAAG,MAAoF,CAAC;IACpG,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,MAAe,CAAC,CAAC,CAAC;IAC5F,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,8BAA8B,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACtH,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,IAAI,UAAU,MAAM,CAAC,MAAM,EAAE,CAAC;IAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAoB,EAAE;IAC7E,MAAM,UAAU,GAAY;QAC1B,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;QACrF,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QAC5E,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;KAC9E,CAAC;IAEF,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Resolves protocol resources from layered `.agents` trees into one immutable effective resource set.
|
|
2
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
3
|
+
import { join, posix, relative, sep } from 'node:path';
|
|
4
|
+
import { agentLocalKinds, compareSlugs, resourceKinds } from './Resource.js';
|
|
5
|
+
/** True when the path resolves (following symlinks) to a directory; false for broken links. */
|
|
6
|
+
const resolvesToDirectory = (path) => {
|
|
7
|
+
try {
|
|
8
|
+
return statSync(path).isDirectory();
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/** True when the path resolves (following symlinks) to a file; false for broken links. */
|
|
15
|
+
const resolvesToFile = (path) => {
|
|
16
|
+
try {
|
|
17
|
+
return statSync(path).isFile();
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const directoryResourceKinds = new Map([
|
|
24
|
+
['agent', 'agents'],
|
|
25
|
+
['skill', 'skills'],
|
|
26
|
+
]);
|
|
27
|
+
const entryFileByKind = new Map([
|
|
28
|
+
['agent', 'agent.md'],
|
|
29
|
+
['skill', 'SKILL.md'],
|
|
30
|
+
]);
|
|
31
|
+
const fileTreeResourceKinds = new Map([
|
|
32
|
+
['knowledge', 'knowledge'],
|
|
33
|
+
['command', 'commands'],
|
|
34
|
+
]);
|
|
35
|
+
// Symlinked directories are followed (matching the skill catalog), so a resource can be a link.
|
|
36
|
+
const listSubdirectories = (directory) => {
|
|
37
|
+
if (!existsSync(directory)) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
return readdirSync(directory, { withFileTypes: true })
|
|
41
|
+
.filter((entry) => resolvesToDirectory(join(directory, entry.name)))
|
|
42
|
+
.map((entry) => entry.name);
|
|
43
|
+
};
|
|
44
|
+
const listFilesRecursively = (root) => {
|
|
45
|
+
if (!existsSync(root)) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
const files = [];
|
|
49
|
+
for (const entry of readdirSync(root, { withFileTypes: true })) {
|
|
50
|
+
const entryPath = join(root, entry.name);
|
|
51
|
+
if (resolvesToDirectory(entryPath)) {
|
|
52
|
+
files.push(...listFilesRecursively(entryPath));
|
|
53
|
+
}
|
|
54
|
+
else if (resolvesToFile(entryPath)) {
|
|
55
|
+
files.push(entryPath);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return files;
|
|
59
|
+
};
|
|
60
|
+
const toSlug = (root, entryPath) => relative(root, entryPath).split(sep).join(posix.sep);
|
|
61
|
+
// `base` is the directory the kind's container sits under: a layer root for catalog-wide resources,
|
|
62
|
+
// or `<layer.root>/agents/<owner>` for agent-local ones. Attribution (`layer`) is separate from it.
|
|
63
|
+
const discoverDirectoryResources = (layer, kind, base = layer.root) => {
|
|
64
|
+
const container = join(base, directoryResourceKinds.get(kind));
|
|
65
|
+
const entryFile = entryFileByKind.get(kind);
|
|
66
|
+
return listSubdirectories(container)
|
|
67
|
+
.filter((slug) => resolvesToFile(join(container, slug, entryFile)))
|
|
68
|
+
.map((slug) => ({ kind, slug, layer, path: join(container, slug, entryFile) }));
|
|
69
|
+
};
|
|
70
|
+
// Existing `agents/<slug>/<...>` files across every layer that defines the agent, highest first.
|
|
71
|
+
const collectAgentFiles = (layers, slug, ...segments) => layers.map((layer) => join(layer.root, 'agents', slug, ...segments)).filter((path) => resolvesToFile(path));
|
|
72
|
+
const isNonEmptyDirectory = (directory) => {
|
|
73
|
+
try {
|
|
74
|
+
return statSync(directory).isDirectory() && readdirSync(directory).length > 0;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// Non-empty `agents/<slug>/hooks/` directories across layers (reserved namespace; surfaced, not resolved).
|
|
81
|
+
const collectAgentHookDirs = (layers, slug) => layers.map((layer) => join(layer.root, 'agents', slug, 'hooks')).filter(isNonEmptyDirectory);
|
|
82
|
+
// Existing harness-native Pi configuration directories across layers, highest precedence first.
|
|
83
|
+
// Empty directories are retained because they are still valid overlays and deterministic inputs.
|
|
84
|
+
const collectAgentPiConfigDirs = (layers, slug) => layers.map((layer) => join(layer.root, 'agents', slug, 'pi')).filter(resolvesToDirectory);
|
|
85
|
+
const withAgentResourcePaths = (layers, agents) => new Map([...agents.entries()].map(([slug, resource]) => [
|
|
86
|
+
slug,
|
|
87
|
+
{
|
|
88
|
+
...resource,
|
|
89
|
+
configPaths: collectAgentFiles(layers, slug, 'config.json'),
|
|
90
|
+
mcpPaths: collectAgentFiles(layers, slug, 'mcp.json'),
|
|
91
|
+
hookPaths: collectAgentHookDirs(layers, slug),
|
|
92
|
+
piConfigDirectories: collectAgentPiConfigDirs(layers, slug),
|
|
93
|
+
},
|
|
94
|
+
]));
|
|
95
|
+
const discoverFileResources = (layer, kind, base = layer.root) => {
|
|
96
|
+
const container = join(base, fileTreeResourceKinds.get(kind));
|
|
97
|
+
return listFilesRecursively(container).map((path) => ({ kind, slug: toSlug(container, path), layer, path }));
|
|
98
|
+
};
|
|
99
|
+
const discoverLayerResources = (layer, kind, base = layer.root) => directoryResourceKinds.has(kind)
|
|
100
|
+
? discoverDirectoryResources(layer, kind, base)
|
|
101
|
+
: discoverFileResources(layer, kind, base);
|
|
102
|
+
// Agent-local discovery of kind K = catalog discovery of K, re-rooted under `agents/<owner>/` and
|
|
103
|
+
// attributed to the real layer. One generic path serves skills, knowledge, and commands.
|
|
104
|
+
const discoverAgentResources = (layer) => {
|
|
105
|
+
const agentsDirectory = join(layer.root, 'agents');
|
|
106
|
+
return listSubdirectories(agentsDirectory).flatMap((ownerAgent) => {
|
|
107
|
+
const agentBase = join(agentsDirectory, ownerAgent);
|
|
108
|
+
return agentLocalKinds.flatMap((kind) => discoverLayerResources(layer, kind, agentBase).map((definition) => ({ ...definition, ownerAgent })));
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const resolveDefinitions = (definitions) => {
|
|
112
|
+
const bySlug = new Map();
|
|
113
|
+
for (const definition of definitions) {
|
|
114
|
+
const existing = bySlug.get(definition.slug);
|
|
115
|
+
if (existing === undefined) {
|
|
116
|
+
bySlug.set(definition.slug, { winner: definition, shadowed: [] });
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
existing.shadowed.push(definition);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return new Map([...bySlug.entries()].map(([slug, entry]) => [
|
|
123
|
+
slug,
|
|
124
|
+
{ kind: entry.winner.kind, slug, winner: entry.winner, shadowed: entry.shadowed },
|
|
125
|
+
]));
|
|
126
|
+
};
|
|
127
|
+
const resolveKind = (layers, kind) => {
|
|
128
|
+
// Layers are ordered highest precedence first, so the first definition of a slug wins.
|
|
129
|
+
return resolveDefinitions(layers.flatMap((layer) => discoverLayerResources(layer, kind)));
|
|
130
|
+
};
|
|
131
|
+
// Groups one agent's local definitions by kind, then resolves each kind's slug precedence.
|
|
132
|
+
const resolveAgentKinds = (definitions) => {
|
|
133
|
+
const byKind = new Map();
|
|
134
|
+
for (const definition of definitions) {
|
|
135
|
+
const kindDefinitions = byKind.get(definition.kind) ?? [];
|
|
136
|
+
kindDefinitions.push(definition);
|
|
137
|
+
byKind.set(definition.kind, kindDefinitions);
|
|
138
|
+
}
|
|
139
|
+
return new Map([...byKind.entries()].map(([kind, kindDefinitions]) => [kind, resolveDefinitions(kindDefinitions)]));
|
|
140
|
+
};
|
|
141
|
+
const resolveAgentResources = (layers) => {
|
|
142
|
+
const definitionsByAgent = new Map();
|
|
143
|
+
for (const layer of layers) {
|
|
144
|
+
for (const definition of discoverAgentResources(layer)) {
|
|
145
|
+
const definitions = definitionsByAgent.get(definition.ownerAgent) ?? [];
|
|
146
|
+
definitions.push(definition);
|
|
147
|
+
definitionsByAgent.set(definition.ownerAgent, definitions);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return new Map([...definitionsByAgent.entries()]
|
|
151
|
+
.sort(([left], [right]) => compareSlugs(left, right))
|
|
152
|
+
.map(([agentSlug, definitions]) => [agentSlug, resolveAgentKinds(definitions)]));
|
|
153
|
+
};
|
|
154
|
+
/** Produces the single effective resource set consumed by list, validate, run, and dump. */
|
|
155
|
+
export const resolveResources = (layers) => {
|
|
156
|
+
const resources = new Map();
|
|
157
|
+
for (const kind of resourceKinds) {
|
|
158
|
+
const resolved = resolveKind(layers, kind);
|
|
159
|
+
resources.set(kind, kind === 'agent' ? withAgentResourcePaths(layers, resolved) : resolved);
|
|
160
|
+
}
|
|
161
|
+
return { layers, resources, agentResources: resolveAgentResources(layers) };
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=Resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Resolver.js","sourceRoot":"","sources":["../../src/resolver/Resolver.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE7E,+FAA+F;AAC/F,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAW,EAAE;IACpD,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,0FAA0F;AAC1F,MAAM,cAAc,GAAG,CAAC,IAAY,EAAW,EAAE;IAC/C,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAsC,IAAI,GAAG,CAAC;IACxE,CAAC,OAAO,EAAE,QAAQ,CAAC;IACnB,CAAC,OAAO,EAAE,QAAQ,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,eAAe,GAAsC,IAAI,GAAG,CAAC;IACjE,CAAC,OA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,KAAK,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SACpD,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC,CAClF,CAAC;AACJ,CAAC,CAAC;AAEF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAwB,EAAwB,EAAE;IACjF,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuD,CAAC;IAEjF,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC3C,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;AAC9E,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SettingsLoadIssue } from '../settings/SettingsLoader.js';
|
|
2
|
+
import type { Settings } from '../settings/Settings.js';
|
|
3
|
+
import type { EffectiveResourceSet } from './Resource.js';
|
|
4
|
+
export interface ResolveInput {
|
|
5
|
+
readonly homeDirectory: string;
|
|
6
|
+
readonly projectDirectory: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ResolveResult {
|
|
9
|
+
readonly set: EffectiveResourceSet;
|
|
10
|
+
/** The merged settings loaded during resolution, so callers need not reload them. */
|
|
11
|
+
readonly settings: Settings;
|
|
12
|
+
readonly settingsIssues: readonly SettingsLoadIssue[];
|
|
13
|
+
}
|
|
14
|
+
/** The single shared resolution path used by list, validate, run, and dump. */
|
|
15
|
+
export declare const resolveEffectiveSet: (input: ResolveInput) => ResolveResult;
|