@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
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
/* eslint-disable complexity */
|
|
2
|
-
// Prepares Pi launch-time bootstrap extensions for Outfitter UX, login, and setup handoffs.
|
|
3
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { dirname, join, resolve } from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { createDefaultSettingsContent as createSetupDefaultSettingsContent } from './SetupCommand.js';
|
|
7
|
-
const runtimeLoginMessage = 'Outfitter will ask Pi to open `/login` automatically if Pi reports no available models after startup.';
|
|
8
|
-
const nonInteractivePiLaunchFlags = new Set(['--print', '-p', '--export', '--list-models']);
|
|
9
|
-
const nonInteractivePiModes = new Set(['json', 'print', 'rpc']);
|
|
10
|
-
export const preparePiLoginLaunchPlan = (input) => {
|
|
11
|
-
if (input.adapterId !== 'pi') {
|
|
12
|
-
return input.launchPlan;
|
|
13
|
-
}
|
|
14
|
-
// Load the Outfitter runtime extension for every interactive pi session. It brands the
|
|
15
|
-
// startup header, owns Outfitter-specific shortcuts, and registers native /outfitter
|
|
16
|
-
// onboarding after pi has started. Non-interactive launches (--print, --export, …) keep
|
|
17
|
-
// pi untouched and must not prompt, auto-submit commands, or mutate user settings.
|
|
18
|
-
let launchPlan = input.launchPlan;
|
|
19
|
-
const piConfigDirectory = input.launchPlan.env.PI_CODING_AGENT_DIR ?? join(input.homeDirectory, '.pi', 'agent');
|
|
20
|
-
const interactiveLaunch = !isNonInteractivePiLaunch(input.launchPlan.args);
|
|
21
|
-
if (!interactiveLaunch) {
|
|
22
|
-
return launchPlan;
|
|
23
|
-
}
|
|
24
|
-
// First-run onboarding intentionally passes no `--model`: pi applies its own default from the
|
|
25
|
-
// models it knows about, and the runtime extension opens `/login` when no model is available.
|
|
26
|
-
// Injecting a hardcoded model ID here would break every new user when pi rotates its catalog.
|
|
27
|
-
if (input.runtimeOnboarding?.autoOpenOutfitter === true) {
|
|
28
|
-
writeQuietPiStartupSettings(piConfigDirectory);
|
|
29
|
-
}
|
|
30
|
-
writePiOutfitterEnterpriseSupportFiles(piConfigDirectory);
|
|
31
|
-
launchPlan = addExtension(launchPlan, piConfigDirectory, 'outfitter-extension.js', createPiOutfitterExtensionContent({
|
|
32
|
-
autoOpenOutfitter: input.runtimeOnboarding?.autoOpenOutfitter === true,
|
|
33
|
-
defaultProfilesPath: input.runtimeOnboarding?.defaultProfilesPath,
|
|
34
|
-
homeDirectory: input.homeDirectory,
|
|
35
|
-
profile: input.profile,
|
|
36
|
-
projectDirectory: resolve(input.runtimeOnboarding?.projectDirectory ?? process.cwd()),
|
|
37
|
-
setupSourceUri: input.runtimeOnboarding?.setupSourceUri,
|
|
38
|
-
startupAsciiArt: input.startupAsciiArt ?? true,
|
|
39
|
-
}));
|
|
40
|
-
if (!hasConfiguredPiLoginState(piConfigDirectory)) {
|
|
41
|
-
writePiLaunchMessage(input.writeLine, runtimeLoginMessage);
|
|
42
|
-
}
|
|
43
|
-
return launchPlan;
|
|
44
|
-
};
|
|
45
|
-
const writeQuietPiStartupSettings = (piConfigDirectory) => {
|
|
46
|
-
const settingsPath = join(piConfigDirectory, 'settings.json');
|
|
47
|
-
mkdirSync(dirname(settingsPath), { recursive: true });
|
|
48
|
-
let settings = {};
|
|
49
|
-
if (existsSync(settingsPath)) {
|
|
50
|
-
try {
|
|
51
|
-
const parsed = JSON.parse(readFileSync(settingsPath, 'utf8'));
|
|
52
|
-
/* v8 ignore next -- defensive against hand-edited Pi settings with non-object JSON. */
|
|
53
|
-
settings =
|
|
54
|
-
parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)
|
|
55
|
-
? parsed
|
|
56
|
-
: {};
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
settings = {};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
writeFileSync(settingsPath, `${JSON.stringify({ ...settings, quietStartup: true }, null, 2)}\n`);
|
|
63
|
-
};
|
|
64
|
-
const addExtension = (launchPlan, piConfigDirectory, fileName, content) => {
|
|
65
|
-
const extensionPath = join(piConfigDirectory, 'outfitter', fileName);
|
|
66
|
-
mkdirSync(dirname(extensionPath), { recursive: true });
|
|
67
|
-
writeFileSync(extensionPath, content);
|
|
68
|
-
return {
|
|
69
|
-
...launchPlan,
|
|
70
|
-
args: ['--extension', extensionPath, ...launchPlan.args],
|
|
71
|
-
env: { ...launchPlan.env, PI_CODING_AGENT_DIR: piConfigDirectory },
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
const writePiOutfitterEnterpriseSupportFiles = (piConfigDirectory) => {
|
|
75
|
-
const extensionDirectory = join(piConfigDirectory, 'outfitter');
|
|
76
|
-
const supportFiles = [
|
|
77
|
-
['enterprise/pi-extension/privateCatalogOnboarding.js', 'pi-extension/privateCatalogOnboarding.js'],
|
|
78
|
-
['enterprise/shared/privateCatalogPolicy.cjs', 'shared/privateCatalogPolicy.cjs'],
|
|
79
|
-
];
|
|
80
|
-
for (const [from, to] of supportFiles) {
|
|
81
|
-
const destination = join(extensionDirectory, to);
|
|
82
|
-
mkdirSync(dirname(destination), { recursive: true });
|
|
83
|
-
writeFileSync(destination, readRepositoryCodeAsset(from));
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
// Reads a file from a sibling workspace under code/ (e.g. code/enterprise or
|
|
87
|
-
// code/pi-extension), supporting both the repository layout and the packaged npm
|
|
88
|
-
// layout where prepack copies those workspaces under the package's code/ folder.
|
|
89
|
-
const readRepositoryCodeAsset = (relativePath) => {
|
|
90
|
-
const sourcePath = fileURLToPath(new URL(`../../../../${relativePath}`, import.meta.url));
|
|
91
|
-
const packagePath = fileURLToPath(new URL(`../../../code/${relativePath}`, import.meta.url));
|
|
92
|
-
/* v8 ignore else -- packaged npm layout is exercised after build, not unit tests. */
|
|
93
|
-
if (existsSync(sourcePath)) {
|
|
94
|
-
return readFileSync(sourcePath, 'utf8');
|
|
95
|
-
}
|
|
96
|
-
/* v8 ignore next -- packaged npm layout is exercised after build, not unit tests. */
|
|
97
|
-
if (existsSync(packagePath)) {
|
|
98
|
-
return readFileSync(packagePath, 'utf8');
|
|
99
|
-
}
|
|
100
|
-
/* v8 ignore next -- defensive packaging assertion for missing repository code assets. */
|
|
101
|
-
throw new Error(`Outfitter support file '${relativePath}' was not found.`);
|
|
102
|
-
};
|
|
103
|
-
// The general Outfitter pi extension. It brands the startup header, owns
|
|
104
|
-
// Outfitter-specific interactive shortcuts, registers native /outfitter, and
|
|
105
|
-
// keeps credential entry delegated to Pi's native /login command. The extension
|
|
106
|
-
// source lives in the code/pi-extension workspace; the CLI stamps launch-time
|
|
107
|
-
// runtime values into it before handing the file to pi via --extension.
|
|
108
|
-
const createPiOutfitterExtensionContent = (input) => {
|
|
109
|
-
const runtimeValues = {
|
|
110
|
-
OUTFITTER_HOME: input.homeDirectory,
|
|
111
|
-
OUTFITTER_PROJECT: input.projectDirectory,
|
|
112
|
-
OUTFITTER_DEFAULT_PROFILES_PATH: input.defaultProfilesPath,
|
|
113
|
-
OUTFITTER_SETUP_SOURCE_URI: input.setupSourceUri,
|
|
114
|
-
OUTFITTER_AUTO_OPEN: input.autoOpenOutfitter,
|
|
115
|
-
OUTFITTER_ACTIVE_PROFILE: input.profile,
|
|
116
|
-
OUTFITTER_DEFAULT_SETTINGS_TEMPLATE: createSetupDefaultSettingsContent('__OUTFITTER_PROFILE_ID__'),
|
|
117
|
-
OUTFITTER_STARTUP_ASCII_ART: input.startupAsciiArt,
|
|
118
|
-
OUTFITTER_ASCII_ART: readFileSync(new URL('./assets/outfitter-ascii.txt', import.meta.url), 'utf8').trimEnd(),
|
|
119
|
-
};
|
|
120
|
-
return Object.entries(runtimeValues).reduce((content, [name, value]) => content.replace(`"__${name}__"`, () => String(JSON.stringify(value))), readRepositoryCodeAsset('pi-extension/src/outfitter-extension.js'));
|
|
121
|
-
};
|
|
122
|
-
const writePiLaunchMessage = (writeLine, message) => {
|
|
123
|
-
/* v8 ignore next -- console fallback is direct CLI behavior; tests inject a writer for launch messages. */
|
|
124
|
-
(writeLine ?? console.log)(message);
|
|
125
|
-
};
|
|
126
|
-
export const isNonInteractivePiLaunch = (args) => args.some((arg, index) => {
|
|
127
|
-
if (nonInteractivePiLaunchFlags.has(arg)) {
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
if (arg === '--mode') {
|
|
131
|
-
return nonInteractivePiModes.has(args[index + 1] ?? '');
|
|
132
|
-
}
|
|
133
|
-
if (arg.startsWith('--mode=')) {
|
|
134
|
-
return nonInteractivePiModes.has(arg.slice('--mode='.length));
|
|
135
|
-
}
|
|
136
|
-
return false;
|
|
137
|
-
});
|
|
138
|
-
const hasConfiguredPiLoginState = (piConfigDirectory) => hasConfiguredPiStateFile(piConfigDirectory, 'auth.json') ||
|
|
139
|
-
hasConfiguredPiStateFile(piConfigDirectory, 'models.json');
|
|
140
|
-
const hasConfiguredPiStateFile = (piConfigDirectory, fileName) => {
|
|
141
|
-
const statePath = join(piConfigDirectory, fileName);
|
|
142
|
-
if (!existsSync(statePath)) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
try {
|
|
146
|
-
return hasConfiguredPiStateEntries(JSON.parse(readFileSync(statePath, 'utf8')));
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
if (error instanceof SyntaxError) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
throw new Error(`Could not read pi login state file '${statePath}': ${String(error)}`, { cause: error });
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const hasConfiguredPiStateEntries = (value) => {
|
|
156
|
-
if (Array.isArray(value)) {
|
|
157
|
-
return value.length > 0;
|
|
158
|
-
}
|
|
159
|
-
if (value === null || typeof value !== 'object') {
|
|
160
|
-
return false;
|
|
161
|
-
}
|
|
162
|
-
const record = value;
|
|
163
|
-
const containerKeys = ['models', 'providers', 'model_providers'];
|
|
164
|
-
const presentContainers = containerKeys.filter((key) => Object.hasOwn(record, key));
|
|
165
|
-
if (presentContainers.length > 0) {
|
|
166
|
-
return presentContainers.some((key) => hasConfiguredPiStateEntries(record[key]));
|
|
167
|
-
}
|
|
168
|
-
return Object.keys(record).length > 0;
|
|
169
|
-
};
|
|
170
|
-
//# sourceMappingURL=PiLoginLaunch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PiLoginLaunch.js","sourceRoot":"","sources":["../../../src/cli/commands/PiLoginLaunch.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,4FAA4F;AAC5F,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,4BAA4B,IAAI,iCAAiC,EAAE,MAAM,mBAAmB,CAAC;AAwBtG,MAAM,mBAAmB,GACvB,uGAAuG,CAAC;AAE1G,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;AAC5F,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAEhE,MAAM,CAAC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AAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { AgentAdapter, AgentLaunchPlan } from '../../agents/AgentAdapter.js';
|
|
2
|
-
import type { CompositeProfileStateWritePrompt } from '../../compositeProfile/StatePersistence.js';
|
|
3
|
-
import type { AgentProcessLauncher } from '../../agents/AgentLaunch.js';
|
|
4
|
-
import type { CommandObject } from './CommandObject.js';
|
|
5
|
-
import type { SetupCommandDependencies } from './SetupCommand.js';
|
|
6
|
-
import { createLaunchProfileLayers, loadProfileSources } from './run/RunProfileResolution.js';
|
|
7
|
-
export { createLaunchProfileLayers, loadProfileSources };
|
|
8
|
-
export interface RunCommandInput {
|
|
9
|
-
readonly homeDirectory: string;
|
|
10
|
-
readonly projectDirectory: string;
|
|
11
|
-
readonly profileId?: string;
|
|
12
|
-
readonly agentId?: string;
|
|
13
|
-
readonly strict?: boolean;
|
|
14
|
-
readonly passThroughArgs?: readonly string[];
|
|
15
|
-
readonly forceRuntimeOnboarding?: boolean;
|
|
16
|
-
readonly setupSourceUri?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface RunCommandResult {
|
|
19
|
-
readonly profileId: string;
|
|
20
|
-
readonly agentId: string;
|
|
21
|
-
readonly launchPlan: AgentLaunchPlan;
|
|
22
|
-
readonly compositeProfileDirectory: string;
|
|
23
|
-
readonly warnings: readonly string[];
|
|
24
|
-
readonly exitCode: number;
|
|
25
|
-
}
|
|
26
|
-
export type { AgentProcessLauncher } from '../../agents/AgentLaunch.js';
|
|
27
|
-
export { resolveAgentLaunchExecutable } from '../../agents/AgentLaunch.js';
|
|
28
|
-
export interface RunCommandDependencies extends SetupCommandDependencies {
|
|
29
|
-
readonly adapter?: AgentAdapter;
|
|
30
|
-
readonly launcher?: AgentProcessLauncher;
|
|
31
|
-
readonly writeError?: (message: string) => void;
|
|
32
|
-
readonly promptStateWritePersistence?: CompositeProfileStateWritePrompt;
|
|
33
|
-
}
|
|
34
|
-
export declare const executeRunCommand: (input: RunCommandInput, dependencies?: RunCommandDependencies) => Promise<RunCommandResult>;
|
|
35
|
-
export declare const createRunCommand: (dependencies?: RunCommandDependencies) => CommandObject;
|
|
36
|
-
export declare const resolveChildExitCode: (code: number | null, signal: NodeJS.Signals | null) => number;
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
// Provides the command object for launching selected profiles.
|
|
2
|
-
import { homedir } from 'node:os';
|
|
3
|
-
import spawn from 'cross-spawn';
|
|
4
|
-
import { createAgentAdapter } from '../../agents/AgentRegistry.js';
|
|
5
|
-
import { exportSystemPromptIfEnabled } from '../../prompts/SystemPromptExport.js';
|
|
6
|
-
import { createCompositeProfileRootDirectory, writeCompositeProfile, } from '../../compositeProfile/CompositeProfileAssembler.js';
|
|
7
|
-
import { renderCompositeProfileTemplates } from '../../compositeProfile/CompositeProfileTemplate.js';
|
|
8
|
-
import { createCompositeProfileStateBaseline, detectCompositeProfileStateWrites, persistCompositeProfileStateWrite, recordProfileStatePersistenceOverride, updateCompositeProfileStateBaselinePaths, } from '../../compositeProfile/StatePersistence.js';
|
|
9
|
-
import { watchCompositeProfileInputs } from '../../compositeProfile/CompositeProfileWatcher.js';
|
|
10
|
-
import { registerCompositeProfileDirectoryCleanup, sweepStaleCompositeProfileDirectories, } from '../../compositeProfile/CompositeProfileCleanup.js';
|
|
11
|
-
import { launchAgentProcess, resolveAgentLaunchExecutable } from '../../agents/AgentLaunch.js';
|
|
12
|
-
import { preparePiLoginLaunchPlan } from './PiLoginLaunch.js';
|
|
13
|
-
import { emitLaunchSummary } from './run/RunLaunchSummary.js';
|
|
14
|
-
import { isInteractiveRunLaunch, prepareFirstRunRuntimeOnboarding, resolveRunProgressWriter, } from './run/RunFirstRunOnboarding.js';
|
|
15
|
-
import { createTerminalStateWritePrompt } from './run/RunStateWritePrompt.js';
|
|
16
|
-
import { resolveProfileSkillControls } from '../../skills/ProfileSkillResolution.js';
|
|
17
|
-
import { createFirstRunBootstrapProfile, createLaunchProfileLayers, loadProfileSources, loadResolvedProfile, materializeProfileSourcePaths, selectRunAgentId, } from './run/RunProfileResolution.js';
|
|
18
|
-
export { createLaunchProfileLayers, loadProfileSources };
|
|
19
|
-
export { resolveAgentLaunchExecutable } from '../../agents/AgentLaunch.js';
|
|
20
|
-
export const executeRunCommand = async (input, dependencies = {}) => {
|
|
21
|
-
sweepStaleCompositeProfileDirectories();
|
|
22
|
-
const runtimeOnboarding = prepareFirstRunRuntimeOnboarding(input, dependencies);
|
|
23
|
-
const loadedProfile = runtimeOnboarding === undefined ? loadResolvedProfile(input) : createFirstRunBootstrapProfile(input);
|
|
24
|
-
const adapter = dependencies.adapter ?? createAgentAdapter(selectRunAgentId(input.agentId, loadedProfile.settings.defaultAgent));
|
|
25
|
-
const compositeProfileRootDirectory = createCompositeProfileRootDirectory(loadedProfile.profile.id, adapter.id);
|
|
26
|
-
prepareCompositeProfileTeardown(input, compositeProfileRootDirectory, dependencies);
|
|
27
|
-
const resolvedProfile = resolveRunProfileSkills(loadedProfile, compositeProfileRootDirectory);
|
|
28
|
-
const compositeProfilePlan = createAdapterCompositeProfilePlan(adapter, resolvedProfile, compositeProfileRootDirectory);
|
|
29
|
-
const warnings = [...resolvedProfile.skillWarnings, ...compositeProfilePlan.warnings];
|
|
30
|
-
failStrictOnWarnings(adapter.id, warnings, input.strict);
|
|
31
|
-
emitWarnings(warnings, dependencies.writeError);
|
|
32
|
-
writeCompositeProfile(compositeProfilePlan.compositeProfile);
|
|
33
|
-
const systemPromptExport = exportSystemPromptIfEnabled({
|
|
34
|
-
profile: resolvedProfile.profile,
|
|
35
|
-
settings: resolvedProfile.settings,
|
|
36
|
-
profileLayers: resolvedProfile.profileLayers,
|
|
37
|
-
cacheDirectory: resolvedProfile.cacheDirectory,
|
|
38
|
-
warn: dependencies.writeError ?? console.error,
|
|
39
|
-
});
|
|
40
|
-
let stateBaseline = createCompositeProfileStateBaseline(compositeProfilePlan.compositeProfile.rootDirectory, compositeProfilePlan.compositeProfile.statePaths);
|
|
41
|
-
const launchPlan = preparePiLoginLaunchPlan({
|
|
42
|
-
adapterId: adapter.id,
|
|
43
|
-
homeDirectory: input.homeDirectory,
|
|
44
|
-
profile: { id: resolvedProfile.profile.id, label: resolvedProfile.profile.label },
|
|
45
|
-
launchPlan: withSystemPromptExportPath(adapter.createLaunchPlan(compositeProfilePlan.compositeProfile, resolvedProfile.profile, input.passThroughArgs ?? [], {
|
|
46
|
-
profileFolders: resolvedProfile.profileFolders,
|
|
47
|
-
profileLayers: createLaunchProfileLayers(resolvedProfile.profileLayers),
|
|
48
|
-
projectDirectory: input.projectDirectory,
|
|
49
|
-
cacheDirectory: resolvedProfile.cacheDirectory,
|
|
50
|
-
onProgress: resolveRunProgressWriter(dependencies),
|
|
51
|
-
}), systemPromptExport.outputPath),
|
|
52
|
-
runtimeOnboarding: runtimeOnboarding === undefined
|
|
53
|
-
? undefined
|
|
54
|
-
: {
|
|
55
|
-
autoOpenOutfitter: true,
|
|
56
|
-
defaultProfilesPath: runtimeOnboarding.defaultProfilesPath,
|
|
57
|
-
projectDirectory: input.projectDirectory,
|
|
58
|
-
setupSourceUri: input.setupSourceUri,
|
|
59
|
-
},
|
|
60
|
-
startupAsciiArt: resolvedProfile.settings.startup?.asciiArt,
|
|
61
|
-
writeLine: dependencies.writeLine,
|
|
62
|
-
});
|
|
63
|
-
emitLaunchSummary(resolvedProfile, adapter.id, compositeProfilePlan.compositeProfile.rootDirectory, dependencies.writeLine);
|
|
64
|
-
const watcher = watchCompositeProfileInputs({
|
|
65
|
-
compositeProfile: compositeProfilePlan.compositeProfile,
|
|
66
|
-
refreshCompositeProfile: () => {
|
|
67
|
-
const refreshedProfile = loadResolvedProfile(input);
|
|
68
|
-
exportSystemPromptIfEnabled({
|
|
69
|
-
profile: refreshedProfile.profile,
|
|
70
|
-
settings: refreshedProfile.settings,
|
|
71
|
-
profileLayers: refreshedProfile.profileLayers,
|
|
72
|
-
cacheDirectory: refreshedProfile.cacheDirectory,
|
|
73
|
-
warn: dependencies.writeError ?? console.error,
|
|
74
|
-
});
|
|
75
|
-
return createAdapterCompositeProfilePlan(adapter, refreshedProfile, compositeProfileRootDirectory)
|
|
76
|
-
.compositeProfile;
|
|
77
|
-
},
|
|
78
|
-
onCompositeProfileWritten: (compositeProfile) => {
|
|
79
|
-
stateBaseline = updateCompositeProfileStateBaselinePaths(compositeProfile.rootDirectory, stateBaseline, compositeProfile.files.map((file) => file.outputPath));
|
|
80
|
-
},
|
|
81
|
-
/* v8 ignore next -- watcher warnings are covered in CompositeProfileWatcher tests; this adapter passes the stderr writer through. */
|
|
82
|
-
warn: (message) => (dependencies.writeError ?? console.error)(message),
|
|
83
|
-
});
|
|
84
|
-
try {
|
|
85
|
-
const launcher = dependencies.launcher ??
|
|
86
|
-
/* v8 ignore next -- tests inject launchers instead of spawning pi. */ createSpawnLauncher();
|
|
87
|
-
const exitCode = await launchAgentProcess(launcher, launchPlan, adapter.id);
|
|
88
|
-
const stateWriteWarnings = await handleCompositeProfileStateWrites({
|
|
89
|
-
adapterId: adapter.id,
|
|
90
|
-
rootDirectory: compositeProfilePlan.compositeProfile.rootDirectory,
|
|
91
|
-
statePaths: compositeProfilePlan.compositeProfile.statePaths,
|
|
92
|
-
stateBaseline,
|
|
93
|
-
prompt: resolveStateWritePrompt(dependencies),
|
|
94
|
-
recordAlwaysChoice: (relativePath) => recordAlwaysStatePersistenceChoice(adapter, resolvedProfile, relativePath),
|
|
95
|
-
/* v8 ignore next -- console fallback is direct CLI behavior; tests inject a line writer. */
|
|
96
|
-
notify: dependencies.writeLine ?? console.log,
|
|
97
|
-
});
|
|
98
|
-
failStrictOnWarnings(adapter.id, stateWriteWarnings, input.strict);
|
|
99
|
-
emitWarnings(stateWriteWarnings, dependencies.writeError);
|
|
100
|
-
return {
|
|
101
|
-
profileId: resolvedProfile.profile.id,
|
|
102
|
-
agentId: adapter.id,
|
|
103
|
-
launchPlan,
|
|
104
|
-
compositeProfileDirectory: compositeProfilePlan.compositeProfile.rootDirectory,
|
|
105
|
-
warnings: [...warnings, ...stateWriteWarnings],
|
|
106
|
-
exitCode,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
finally {
|
|
110
|
-
watcher.close();
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
/* v8 ignore start -- Commander registration is exercised through CLI integration, while command behavior is unit-tested through executeRunCommand. */
|
|
114
|
-
export const createRunCommand = (dependencies = {}) => {
|
|
115
|
-
const command = {
|
|
116
|
-
name: 'run',
|
|
117
|
-
description: 'Assemble a profile compositeProfile and launch the selected agent CLI.',
|
|
118
|
-
register(program) {
|
|
119
|
-
const action = async (args, options) => {
|
|
120
|
-
const result = await executeRunCommand({
|
|
121
|
-
homeDirectory: dependencies.homeDirectory ?? homedir(),
|
|
122
|
-
projectDirectory: dependencies.projectDirectory ?? process.cwd(),
|
|
123
|
-
profileId: options.profile,
|
|
124
|
-
agentId: options.agent,
|
|
125
|
-
strict: options.strict,
|
|
126
|
-
passThroughArgs: args,
|
|
127
|
-
}, dependencies);
|
|
128
|
-
if (result.exitCode !== 0) {
|
|
129
|
-
process.exitCode = result.exitCode;
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
configureRunCommander(program.command(command.name, { isDefault: true }).description(command.description), action);
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
return command;
|
|
136
|
-
};
|
|
137
|
-
const configureRunCommander = (command, action) => {
|
|
138
|
-
command
|
|
139
|
-
.argument('[args...]')
|
|
140
|
-
.option('-p, --profile <profile>', 'Outfitter profile id to run')
|
|
141
|
-
.option('--agent <agent>', 'agent adapter to launch: pi or claude')
|
|
142
|
-
.option('--strict', 'Fail instead of warning when controls cannot be translated')
|
|
143
|
-
.allowUnknownOption(true)
|
|
144
|
-
.allowExcessArguments(true)
|
|
145
|
-
.action(action);
|
|
146
|
-
};
|
|
147
|
-
// Catalog skill IDs are resolved to generated skill directories under the composite
|
|
148
|
-
// profile root before adapters run, so adapters keep receiving plain path sources and
|
|
149
|
-
// the generated skills are removed with the composite profile at exit.
|
|
150
|
-
const resolveRunProfileSkills = (resolvedProfile, compositeProfileRootDirectory) => {
|
|
151
|
-
const resolution = resolveProfileSkillControls({
|
|
152
|
-
profile: resolvedProfile.profile,
|
|
153
|
-
profileLayers: resolvedProfile.profileLayers,
|
|
154
|
-
sourcePaths: materializeProfileSourcePaths(resolvedProfile.homeDirectory, resolvedProfile.settings.profileSources ?? []),
|
|
155
|
-
projectDirectory: resolvedProfile.projectDirectory,
|
|
156
|
-
outputDirectory: compositeProfileRootDirectory,
|
|
157
|
-
});
|
|
158
|
-
const errors = resolution.diagnostics.filter((diagnostic) => diagnostic.severity === 'error');
|
|
159
|
-
if (errors.length > 0) {
|
|
160
|
-
throw new Error(`Cannot resolve profile skills: ${errors.map((issue) => `${issue.path} ${issue.message}`).join('; ')}`);
|
|
161
|
-
}
|
|
162
|
-
return {
|
|
163
|
-
...resolvedProfile,
|
|
164
|
-
profile: resolution.profile,
|
|
165
|
-
skillWarnings: resolution.diagnostics.map((diagnostic) => diagnostic.message),
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
const failStrictOnWarnings = (adapterId, warnings, strict) => {
|
|
169
|
-
if (strict === true && warnings.length > 0) {
|
|
170
|
-
throw new Error(`Strict failed for ${adapterId}: ${warnings.join('; ')}`);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
const emitWarnings = (warnings, writeError) => {
|
|
174
|
-
const writer = writeError ?? console.error;
|
|
175
|
-
for (const warning of warnings) {
|
|
176
|
-
writer(warning);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
const createAdapterCompositeProfilePlan = (adapter, resolvedProfile, rootDirectory) => {
|
|
180
|
-
const compositeProfilePlan = adapter.createCompositeProfile(resolvedProfile.profile, {
|
|
181
|
-
rootDirectory,
|
|
182
|
-
profilePaths: resolvedProfile.profilePaths,
|
|
183
|
-
profileFolders: resolvedProfile.profileFolders,
|
|
184
|
-
profileLayers: createLaunchProfileLayers(resolvedProfile.profileLayers),
|
|
185
|
-
homeDirectory: resolvedProfile.homeDirectory,
|
|
186
|
-
cacheDirectory: resolvedProfile.cacheDirectory,
|
|
187
|
-
settings: resolvedProfile.settings,
|
|
188
|
-
projectDirectory: resolvedProfile.projectDirectory,
|
|
189
|
-
});
|
|
190
|
-
return {
|
|
191
|
-
...compositeProfilePlan,
|
|
192
|
-
compositeProfile: renderCompositeProfileTemplates({
|
|
193
|
-
compositeProfile: compositeProfilePlan.compositeProfile,
|
|
194
|
-
settings: resolvedProfile.settings,
|
|
195
|
-
settingsPaths: resolvedProfile.settingsPaths,
|
|
196
|
-
profile: resolvedProfile.profile,
|
|
197
|
-
agentId: adapter.id,
|
|
198
|
-
projectDirectory: resolvedProfile.projectDirectory,
|
|
199
|
-
}),
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
// Composite directories are removed at process exit and on handled signals. When the agent
|
|
203
|
-
// is launched with --debug the directory is kept for inspection and its path is printed.
|
|
204
|
-
const prepareCompositeProfileTeardown = (input, compositeProfileRootDirectory, dependencies) => {
|
|
205
|
-
if (isDebugRunLaunch(input.passThroughArgs)) {
|
|
206
|
-
/* v8 ignore next -- console fallback is direct CLI behavior; tests inject a line writer. */
|
|
207
|
-
(dependencies.writeLine ?? console.log)(`--debug: keeping composite profile directory ${compositeProfileRootDirectory}`);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
registerCompositeProfileDirectoryCleanup(compositeProfileRootDirectory);
|
|
211
|
-
};
|
|
212
|
-
const isDebugRunLaunch = (passThroughArgs) => (passThroughArgs ?? []).includes('--debug');
|
|
213
|
-
const handleCompositeProfileStateWrites = async (input) => {
|
|
214
|
-
const warnings = [];
|
|
215
|
-
for (const issue of detectCompositeProfileStateWrites(input.rootDirectory, input.statePaths, input.stateBaseline)) {
|
|
216
|
-
if (issue.strategy === 'error') {
|
|
217
|
-
throw new Error(formatCompositeProfileStateWriteIssue(input.adapterId, issue));
|
|
218
|
-
}
|
|
219
|
-
if (issue.strategy === 'prompt') {
|
|
220
|
-
warnings.push(...(await handlePromptStateWriteIssue(input, issue)));
|
|
221
|
-
continue;
|
|
222
|
-
}
|
|
223
|
-
warnings.push(formatCompositeProfileStateWriteIssue(input.adapterId, issue));
|
|
224
|
-
}
|
|
225
|
-
return warnings;
|
|
226
|
-
};
|
|
227
|
-
const handlePromptStateWriteIssue = async (input, issue) => {
|
|
228
|
-
if (issue.unknown) {
|
|
229
|
-
return [
|
|
230
|
-
formatCompositeProfileStateWriteIssue(input.adapterId, issue),
|
|
231
|
-
`state_persistence 'prompt' cannot persist undeclared writes; '${issue.relativePath}' was reported instead.`,
|
|
232
|
-
];
|
|
233
|
-
}
|
|
234
|
-
if (input.prompt === undefined) {
|
|
235
|
-
return [
|
|
236
|
-
formatCompositeProfileStateWriteIssue(input.adapterId, issue),
|
|
237
|
-
`state_persistence prompt for '${issue.relativePath}' skipped: non-interactive session.`,
|
|
238
|
-
];
|
|
239
|
-
}
|
|
240
|
-
const statePath = findDeclaredStatePath(input.statePaths, issue.relativePath);
|
|
241
|
-
const choice = await input.prompt({
|
|
242
|
-
agentId: input.adapterId,
|
|
243
|
-
relativePath: issue.relativePath,
|
|
244
|
-
sourcePath: statePath.sourcePath,
|
|
245
|
-
});
|
|
246
|
-
return applyPromptStateWriteChoice(input, statePath, choice);
|
|
247
|
-
};
|
|
248
|
-
const applyPromptStateWriteChoice = (input, statePath, choice) => {
|
|
249
|
-
if (choice === 'discard') {
|
|
250
|
-
input.notify(`Discarded ${input.adapterId} state write to '${statePath.relativePath}'.`);
|
|
251
|
-
return [];
|
|
252
|
-
}
|
|
253
|
-
try {
|
|
254
|
-
persistCompositeProfileStateWrite(input.rootDirectory, statePath);
|
|
255
|
-
}
|
|
256
|
-
catch (error) {
|
|
257
|
-
return [`Could not persist state path '${statePath.relativePath}': ${String(error)}`];
|
|
258
|
-
}
|
|
259
|
-
input.notify(`Persisted ${input.adapterId} state write '${statePath.relativePath}' to ${statePath.sourcePath}.`);
|
|
260
|
-
if (choice === 'always') {
|
|
261
|
-
const warning = input.recordAlwaysChoice(statePath.relativePath);
|
|
262
|
-
return warning === undefined ? [] : [warning];
|
|
263
|
-
}
|
|
264
|
-
return [];
|
|
265
|
-
};
|
|
266
|
-
const findDeclaredStatePath = (statePaths, relativePath) => {
|
|
267
|
-
const statePath = statePaths.find((candidate) => candidate.relativePath === relativePath);
|
|
268
|
-
/* v8 ignore next 3 -- declared prompt issues always originate from a declared state path. */
|
|
269
|
-
if (statePath === undefined) {
|
|
270
|
-
throw new Error(`State path '${relativePath}' is not declared by the composite profile.`);
|
|
271
|
-
}
|
|
272
|
-
return statePath;
|
|
273
|
-
};
|
|
274
|
-
// The "always" choice is recorded in the selected profile's own YAML file because profiles
|
|
275
|
-
// are the single source of truth for state_persistence policy; a parallel settings-layer
|
|
276
|
-
// override would create a second precedence system that adapter validation cannot see.
|
|
277
|
-
// Remote/cached profiles are never mutated, so the choice degrades to a one-run persist
|
|
278
|
-
// with an actionable warning.
|
|
279
|
-
const recordAlwaysStatePersistenceChoice = (adapter, resolvedProfile, relativePath) => {
|
|
280
|
-
const declaration = adapter.statePaths?.[relativePath];
|
|
281
|
-
if (declaration === undefined || !declaration.allowedStrategies.includes('symlink')) {
|
|
282
|
-
return (`Cannot always-persist '${relativePath}': the ${adapter.id} adapter does not allow 'symlink' for it; ` +
|
|
283
|
-
`the write was persisted once.`);
|
|
284
|
-
}
|
|
285
|
-
const selectedLayer = [...resolvedProfile.profileLayers]
|
|
286
|
-
.reverse()
|
|
287
|
-
.find((layer) => layer.profile.id === resolvedProfile.profile.id);
|
|
288
|
-
if (selectedLayer === undefined ||
|
|
289
|
-
selectedLayer.source.uri !== undefined ||
|
|
290
|
-
selectedLayer.source.github !== undefined) {
|
|
291
|
-
return (`Cannot record the always-persist choice for '${relativePath}' because profile ` +
|
|
292
|
-
`'${resolvedProfile.profile.id}' is not a local profile file; the write was persisted once.`);
|
|
293
|
-
}
|
|
294
|
-
recordProfileStatePersistenceOverride(selectedLayer.profilePath, relativePath, 'symlink');
|
|
295
|
-
return undefined;
|
|
296
|
-
};
|
|
297
|
-
const resolveStateWritePrompt = (dependencies) => {
|
|
298
|
-
if (!isInteractiveRunLaunch(dependencies)) {
|
|
299
|
-
return undefined;
|
|
300
|
-
}
|
|
301
|
-
return (dependencies.promptStateWritePersistence ??
|
|
302
|
-
/* v8 ignore next -- terminal prompting is direct CLI behavior; tests inject a prompt. */
|
|
303
|
-
createTerminalStateWritePrompt(dependencies.input ?? process.stdin, dependencies.output ?? process.stdout));
|
|
304
|
-
};
|
|
305
|
-
const formatCompositeProfileStateWriteIssue = (adapterId, issue) => {
|
|
306
|
-
if (issue.unknown) {
|
|
307
|
-
return `${adapterId} wrote undeclared composite profile state '${issue.relativePath}' and it was not persisted.`;
|
|
308
|
-
}
|
|
309
|
-
if (issue.strategy === 'symlink') {
|
|
310
|
-
return `${adapterId} replaced symlinked state path '${issue.relativePath}' and the change was not persisted.`;
|
|
311
|
-
}
|
|
312
|
-
return `${adapterId} wrote '${issue.relativePath}' with state_persistence '${issue.strategy}' and it was not persisted.`;
|
|
313
|
-
};
|
|
314
|
-
const withSystemPromptExportPath = (launchPlan, outputPath) => outputPath === undefined
|
|
315
|
-
? launchPlan
|
|
316
|
-
: { ...launchPlan, env: { ...launchPlan.env, OUTFITTER_SYSTEM_PROMPT_EXPORT_PATH: outputPath } };
|
|
317
|
-
/* v8 ignore start -- the real child-process launcher is direct runtime behavior; tests inject a launcher. */
|
|
318
|
-
const createSpawnLauncher = () => ({
|
|
319
|
-
launch(plan) {
|
|
320
|
-
const resolvedPlan = resolveAgentLaunchExecutable(plan);
|
|
321
|
-
return new Promise((resolve, reject) => {
|
|
322
|
-
const child = spawn(resolvedPlan.command, resolvedPlan.args, {
|
|
323
|
-
env: { ...process.env, ...resolvedPlan.env },
|
|
324
|
-
stdio: 'inherit',
|
|
325
|
-
});
|
|
326
|
-
child.on('error', reject);
|
|
327
|
-
child.on('close', (code, signal) => resolve(resolveChildExitCode(code, signal)));
|
|
328
|
-
});
|
|
329
|
-
},
|
|
330
|
-
});
|
|
331
|
-
/* v8 ignore stop */
|
|
332
|
-
export const resolveChildExitCode = (code, signal) => {
|
|
333
|
-
if (code !== null) {
|
|
334
|
-
return code;
|
|
335
|
-
}
|
|
336
|
-
if (signal !== null) {
|
|
337
|
-
return 128 + (signalNumbers[signal] ?? 1);
|
|
338
|
-
}
|
|
339
|
-
return 1;
|
|
340
|
-
};
|
|
341
|
-
const signalNumbers = {
|
|
342
|
-
SIGINT: 2,
|
|
343
|
-
SIGTERM: 15,
|
|
344
|
-
};
|
|
345
|
-
//# sourceMappingURL=RunCommand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RunCommand.js","sourceRoot":"","sources":["../../../src/cli/commands/RunCommand.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAIlC,OAAO,KAAK,MAAM,aAAa,CAAC;AAGhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EACL,mCAAmC,EACnC,qBAAqB,GACtB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AACrG,OAAO,EACL,mCAAmC,EACnC,iCAAiC,EACjC,iCAAiC,EACjC,qCAAqC,EACrC,wCAAwC,GACzC,MAAM,4CAA4C,CAAC;AAOpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAChG,OAAO,EACL,wCAAwC,EACxC,qCAAqC,GACtC,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAE/F,OAAO,EAAE,wBAAwB,EAAE,M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AI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AACH,oBAAoB;AAEpB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAmB,EAAE,MAA6B,EAAU,EAAE;IACjG,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,GAAG,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,MAAM,aAAa,GAAsD;IACvE,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,EAAE;CACZ,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type ProfileSourceReference, type RemoteSourceReference } from '../../profiles/ProfileSource.js';
|
|
2
|
-
import type { CommandObject } from './CommandObject.js';
|
|
3
|
-
export type SyncSourceStatus = 'updated' | 'unchanged' | 'skipped' | 'failed';
|
|
4
|
-
export interface SyncCommandInput {
|
|
5
|
-
readonly homeDirectory: string;
|
|
6
|
-
readonly projectDirectory: string;
|
|
7
|
-
}
|
|
8
|
-
export interface SyncSourceResult {
|
|
9
|
-
readonly uri: string;
|
|
10
|
-
readonly cachePath: string;
|
|
11
|
-
readonly status: SyncSourceStatus;
|
|
12
|
-
readonly message: string;
|
|
13
|
-
}
|
|
14
|
-
export interface SyncCommandResult {
|
|
15
|
-
readonly sources: readonly SyncSourceResult[];
|
|
16
|
-
readonly messages: readonly string[];
|
|
17
|
-
}
|
|
18
|
-
export interface UriProfileSourceSynchronizer {
|
|
19
|
-
sync(source: RemoteSourceReference, cachePath: string): SyncSourceStatus;
|
|
20
|
-
}
|
|
21
|
-
export type GitHubRepositoryVisibility = 'public' | 'private' | 'unknown';
|
|
22
|
-
export interface GitHubRepositoryVisibilityClassifier {
|
|
23
|
-
classify(repository: string): GitHubRepositoryVisibility;
|
|
24
|
-
}
|
|
25
|
-
export interface PrivateCatalogPrompt {
|
|
26
|
-
readonly interactive: boolean;
|
|
27
|
-
confirm(repository: string): boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface SyncCommandDependencies {
|
|
30
|
-
readonly synchronizer?: UriProfileSourceSynchronizer;
|
|
31
|
-
readonly repositoryVisibilityClassifier?: GitHubRepositoryVisibilityClassifier;
|
|
32
|
-
readonly privateCatalogPrompt?: PrivateCatalogPrompt;
|
|
33
|
-
readonly homeDirectory?: string;
|
|
34
|
-
readonly projectDirectory?: string;
|
|
35
|
-
readonly writeLine?: (message: string) => void;
|
|
36
|
-
}
|
|
37
|
-
export declare const executeSyncCommand: (input: SyncCommandInput, dependencies?: SyncCommandDependencies) => SyncCommandResult;
|
|
38
|
-
export declare const createSyncCommand: (dependencies?: SyncCommandDependencies) => CommandObject;
|
|
39
|
-
export declare const createGitSynchronizer: (progress?: (message: string) => void) => UriProfileSourceSynchronizer;
|
|
40
|
-
export type RemoteProfileSource = ProfileSourceReference & ({
|
|
41
|
-
readonly uri: string;
|
|
42
|
-
} | {
|
|
43
|
-
readonly github: string;
|
|
44
|
-
});
|
|
45
|
-
export declare const syncProfileSource: (homeDirectory: string, source: RemoteProfileSource, synchronizer?: UriProfileSourceSynchronizer) => SyncSourceResult;
|
|
46
|
-
export declare const createGitHubRepositoryVisibilityClassifier: () => GitHubRepositoryVisibilityClassifier;
|