@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,363 +0,0 @@
|
|
|
1
|
-
// Provides the pi adapter for composite profile generation and native pi launch plans.
|
|
2
|
-
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
3
|
-
import { homedir } from 'node:os';
|
|
4
|
-
import { delimiter, dirname, isAbsolute, join, relative } from 'node:path';
|
|
5
|
-
import { genericControlNames, mergeAgentSpecificControls, supportedControlNames } from '../AdapterProfileControls.js';
|
|
6
|
-
import { createOutfitterPluginCompositeFiles, outfitterPluginSkillCompositeRelativePath } from '../OutfitterSkill.js';
|
|
7
|
-
import { createDeclaredStatePaths, findProfileStateSource } from '../AdapterStatePaths.js';
|
|
8
|
-
import { filterPiSettingsPackagesDuplicatingExtensions } from './PiSettingsMergePolicy.js';
|
|
9
|
-
import { resolveAppendSystemPromptControl } from '../../profiles/PromptIncludes.js';
|
|
10
|
-
import { createCompositeProfile } from '../../compositeProfile/CompositeProfile.js';
|
|
11
|
-
import { createCompositeProfileFile } from '../../compositeProfile/CompositeProfileFile.js';
|
|
12
|
-
import { createPiArgs } from './PiArgs.js';
|
|
13
|
-
import { createPiMcpConfigFile } from './PiMcpConfig.js';
|
|
14
|
-
import { materializePiExtensionSources } from './PiExtensionCache.js';
|
|
15
|
-
import { createPiSkillSources } from './PiSkillSources.js';
|
|
16
|
-
const piControlNames = new Set([
|
|
17
|
-
...[...genericControlNames].filter((controlName) => controlName !== 'pi' && controlName !== 'claude'),
|
|
18
|
-
'allowExternalDeepWorkJobs',
|
|
19
|
-
'allow_external_deepwork_jobs',
|
|
20
|
-
]);
|
|
21
|
-
const piStatePathDeclarations = {
|
|
22
|
-
'auth.json': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'error', 'prompt'] },
|
|
23
|
-
'settings.json': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'warn', 'error', 'prompt'] },
|
|
24
|
-
'keybindings.json': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'warn', 'error', 'prompt'] },
|
|
25
|
-
'mcp.json': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'warn', 'error', 'prompt'] },
|
|
26
|
-
'models.json': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'warn', 'error', 'prompt'] },
|
|
27
|
-
'trust.json': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'warn', 'error', 'prompt'] },
|
|
28
|
-
'plugins/': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'discard', 'warn', 'error', 'prompt'] },
|
|
29
|
-
'cache/': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'discard', 'warn', 'error'] },
|
|
30
|
-
'sessions/': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'discard', 'warn', 'error'] },
|
|
31
|
-
'npm/': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'discard', 'warn', 'error'] },
|
|
32
|
-
'git/': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'discard', 'warn', 'error'] },
|
|
33
|
-
'tmp/': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'discard'] },
|
|
34
|
-
'utilities/': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'discard', 'warn', 'error'] },
|
|
35
|
-
'bin/': { defaultStrategy: 'symlink', allowedStrategies: ['symlink', 'discard', 'warn', 'error'] },
|
|
36
|
-
unknown: { defaultStrategy: 'warn', allowedStrategies: ['discard', 'warn', 'error', 'prompt'] },
|
|
37
|
-
};
|
|
38
|
-
export const createPiAdapter = () => ({
|
|
39
|
-
id: 'pi',
|
|
40
|
-
supportedControls: supportedControlNames(piControlNames),
|
|
41
|
-
statePaths: piStatePathDeclarations,
|
|
42
|
-
createCompositeProfile(profile, input) {
|
|
43
|
-
const statePaths = createPiStatePaths(profile, input);
|
|
44
|
-
const transformedSettingsFile = createPiSettingsTransformFile(profile, input, statePaths);
|
|
45
|
-
const transformedKeybindingsFile = createPiKeybindingsTransformFile(input, statePaths);
|
|
46
|
-
const transformedStatePaths = markPiTransformedStatePathsDiscarded(statePaths, [
|
|
47
|
-
...(transformedSettingsFile === undefined ? [] : ['settings.json']),
|
|
48
|
-
'keybindings.json',
|
|
49
|
-
]);
|
|
50
|
-
const compositeProfile = createCompositeProfile(input.rootDirectory, [
|
|
51
|
-
createCompositeProfileFile({
|
|
52
|
-
rootDirectory: input.rootDirectory,
|
|
53
|
-
relativePath: 'outfitter/profile.json',
|
|
54
|
-
content: `${JSON.stringify({ id: profile.id, label: profile.label, controls: profile.controls }, null, 2)}\n`,
|
|
55
|
-
sourceInputs: input.profilePaths,
|
|
56
|
-
strategy: 'transform',
|
|
57
|
-
}),
|
|
58
|
-
createPiMcpConfigFile(input.rootDirectory, input.profileFolders),
|
|
59
|
-
transformedSettingsFile,
|
|
60
|
-
transformedKeybindingsFile,
|
|
61
|
-
...createOutfitterPluginCompositeFiles(input.rootDirectory),
|
|
62
|
-
].filter((file) => file !== undefined), transformedStatePaths);
|
|
63
|
-
return {
|
|
64
|
-
compositeProfile,
|
|
65
|
-
warnings: [
|
|
66
|
-
...this.getUnsupportedControls(profile).map((controlName) => `pi adapter cannot translate requested control '${controlName}'.`),
|
|
67
|
-
...createMissingNamedDeepWorkJobWarnings(input.profileLayers ?? []),
|
|
68
|
-
...resolveAppendSystemPromptControl({
|
|
69
|
-
fallback: mergePiControls(profile.controls).appendSystemPrompt,
|
|
70
|
-
profileLayers: input.profileLayers,
|
|
71
|
-
agentKey: 'pi',
|
|
72
|
-
projectDirectory: input.projectDirectory,
|
|
73
|
-
}).diagnostics.map((diagnostic) => `pi ${diagnostic.message} (${diagnostic.path})`),
|
|
74
|
-
],
|
|
75
|
-
};
|
|
76
|
-
},
|
|
77
|
-
createLaunchPlan(compositeProfile, profile, passThroughArgs = [], context = {}) {
|
|
78
|
-
const controls = mergePiControls(profile?.controls ?? {});
|
|
79
|
-
const profileFolders = context.profileFolders ?? [];
|
|
80
|
-
const deepWorkJobsFolders = createDeepWorkAdditionalJobsFolders(controls, profileFolders, context.profileLayers ?? []);
|
|
81
|
-
const skillSources = createPiSkillSources({
|
|
82
|
-
builtInOutfitterSkill: join(compositeProfile.rootDirectory, outfitterPluginSkillCompositeRelativePath),
|
|
83
|
-
controls,
|
|
84
|
-
profileFolders,
|
|
85
|
-
profileLayers: context.profileLayers ?? [],
|
|
86
|
-
});
|
|
87
|
-
const appendPrompt = resolveAppendSystemPromptControl({
|
|
88
|
-
fallback: controls.appendSystemPrompt,
|
|
89
|
-
profileLayers: context.profileLayers,
|
|
90
|
-
agentKey: 'pi',
|
|
91
|
-
projectDirectory: context.projectDirectory,
|
|
92
|
-
});
|
|
93
|
-
return {
|
|
94
|
-
command: 'pi',
|
|
95
|
-
args: [
|
|
96
|
-
...createPiArgs({
|
|
97
|
-
...controls,
|
|
98
|
-
extensions: materializePiExtensionSources(controls.extensions, {
|
|
99
|
-
cacheDirectory: context.cacheDirectory,
|
|
100
|
-
onProgress: context.onProgress,
|
|
101
|
-
}),
|
|
102
|
-
skills: skillSources,
|
|
103
|
-
appendSystemPrompt: appendPrompt.prompts,
|
|
104
|
-
}),
|
|
105
|
-
...passThroughArgs,
|
|
106
|
-
],
|
|
107
|
-
env: {
|
|
108
|
-
...controls.environment,
|
|
109
|
-
...(deepWorkJobsFolders === undefined ? {} : { DEEPWORK_ADDITIONAL_JOBS_FOLDERS: deepWorkJobsFolders }),
|
|
110
|
-
PI_CODING_AGENT_DIR: compositeProfile.rootDirectory,
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
|
-
getUnsupportedControls(profile) {
|
|
115
|
-
return findUnsupportedControls(profile.controls);
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
const markPiTransformedStatePathsDiscarded = (statePaths, transformedRelativePaths) => {
|
|
119
|
-
const transformedRelativePathSet = new Set(transformedRelativePaths);
|
|
120
|
-
return statePaths.map((statePath) => transformedRelativePathSet.has(statePath.relativePath)
|
|
121
|
-
? { relativePath: statePath.relativePath, strategy: 'discard', directory: statePath.directory }
|
|
122
|
-
: statePath);
|
|
123
|
-
};
|
|
124
|
-
const createPiSettingsTransformFile = (profile, input, statePaths) => {
|
|
125
|
-
if (input.homeDirectory === undefined) {
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
const controls = mergePiControls(profile.controls);
|
|
129
|
-
const extensionSources = controls.extensions ?? [];
|
|
130
|
-
if (extensionSources.length === 0) {
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
const settingsStatePath = statePaths.find((statePath) => statePath.relativePath === 'settings.json');
|
|
134
|
-
if (settingsStatePath?.sourcePath === undefined || !existsSync(settingsStatePath.sourcePath)) {
|
|
135
|
-
return undefined;
|
|
136
|
-
}
|
|
137
|
-
const settings = readPiSettingsDocument(settingsStatePath.sourcePath);
|
|
138
|
-
if (settings === undefined || !Array.isArray(settings.packages)) {
|
|
139
|
-
return undefined;
|
|
140
|
-
}
|
|
141
|
-
const filteredPackages = filterPiSettingsPackagesDuplicatingExtensions(settings.packages, extensionSources);
|
|
142
|
-
if (filteredPackages.length === settings.packages.length) {
|
|
143
|
-
return undefined;
|
|
144
|
-
}
|
|
145
|
-
return createCompositeProfileFile({
|
|
146
|
-
rootDirectory: input.rootDirectory,
|
|
147
|
-
relativePath: 'settings.json',
|
|
148
|
-
content: `${JSON.stringify({ ...settings, packages: filteredPackages }, null, 2)}\n`,
|
|
149
|
-
sourceInputs: [settingsStatePath.sourcePath, ...input.profilePaths],
|
|
150
|
-
strategy: 'transform',
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
const readPiSettingsDocument = (settingsPath) => {
|
|
154
|
-
let content;
|
|
155
|
-
try {
|
|
156
|
-
content = readFileSync(settingsPath, 'utf8');
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
throw new Error(`Could not read pi settings file '${settingsPath}': ${String(error)}`, { cause: error });
|
|
160
|
-
}
|
|
161
|
-
try {
|
|
162
|
-
const parsed = JSON.parse(content);
|
|
163
|
-
return isPiSettingsDocument(parsed) ? parsed : undefined;
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
return undefined;
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
const isPiSettingsDocument = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
170
|
-
const piModeCycleKey = 'shift+tab';
|
|
171
|
-
const piThinkingCycleKey = 'ctrl+shift+t';
|
|
172
|
-
const piThinkingCycleKeybindingId = 'app.thinking.cycle';
|
|
173
|
-
const legacyPiKeybindingIds = {
|
|
174
|
-
cycleThinkingLevel: piThinkingCycleKeybindingId,
|
|
175
|
-
};
|
|
176
|
-
const createPiKeybindingsTransformFile = (input, statePaths) => {
|
|
177
|
-
const keybindingsStatePath = statePaths.find((statePath) => statePath.relativePath === 'keybindings.json');
|
|
178
|
-
const sourcePath = keybindingsStatePath?.sourcePath;
|
|
179
|
-
const shouldReadSource = sourcePath !== undefined && existsSync(sourcePath) && shouldReadPiKeybindingsSource(sourcePath, input);
|
|
180
|
-
const sourceInputs = [...(shouldReadSource ? [sourcePath] : []), ...input.profilePaths];
|
|
181
|
-
const keybindings = rewritePiKeybindingsForOutfitterModeSwitch(shouldReadSource ? readPiKeybindingsDocument(sourcePath) : {});
|
|
182
|
-
return createCompositeProfileFile({
|
|
183
|
-
rootDirectory: input.rootDirectory,
|
|
184
|
-
relativePath: 'keybindings.json',
|
|
185
|
-
content: `${JSON.stringify(keybindings, null, 2)}\n`,
|
|
186
|
-
sourceInputs,
|
|
187
|
-
strategy: 'transform',
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
/* v8 ignore next -- fallback source discovery is exercised by adapter integration fixtures. */
|
|
191
|
-
const shouldReadPiKeybindingsSource = (sourcePath, input) => input.homeDirectory !== undefined || (input.profileFolders ?? []).some((folder) => isPathInside(sourcePath, folder));
|
|
192
|
-
const isPathInside = (path, directory) => {
|
|
193
|
-
const relativePath = relative(directory, path);
|
|
194
|
-
return relativePath === '' || (!relativePath.startsWith('..') && !isAbsolute(relativePath));
|
|
195
|
-
};
|
|
196
|
-
const readPiKeybindingsDocument = (keybindingsPath) => {
|
|
197
|
-
let content;
|
|
198
|
-
try {
|
|
199
|
-
content = readFileSync(keybindingsPath, 'utf8');
|
|
200
|
-
}
|
|
201
|
-
catch (error) {
|
|
202
|
-
throw new Error(`Could not read pi keybindings file '${keybindingsPath}': ${String(error)}`, { cause: error });
|
|
203
|
-
}
|
|
204
|
-
try {
|
|
205
|
-
const parsed = JSON.parse(content);
|
|
206
|
-
if (!isPiKeybindingsDocument(parsed)) {
|
|
207
|
-
throw new Error(`Pi keybindings file '${keybindingsPath}' must contain a JSON object.`);
|
|
208
|
-
}
|
|
209
|
-
return parsed;
|
|
210
|
-
}
|
|
211
|
-
catch (error) {
|
|
212
|
-
if (error instanceof SyntaxError) {
|
|
213
|
-
throw new Error(`Could not parse pi keybindings file '${keybindingsPath}': ${error.message}`, { cause: error });
|
|
214
|
-
}
|
|
215
|
-
throw error;
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
const isPiKeybindingsDocument = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
219
|
-
const rewritePiKeybindingsForOutfitterModeSwitch = (keybindings) => {
|
|
220
|
-
const rewritten = {};
|
|
221
|
-
for (const [keybindingId, binding] of Object.entries(keybindings)) {
|
|
222
|
-
if (!isPiKeybindingValue(binding)) {
|
|
223
|
-
continue;
|
|
224
|
-
}
|
|
225
|
-
const normalizedKeybindingId = normalizePiKeybindingId(keybindingId);
|
|
226
|
-
rewritten[normalizedKeybindingId] = appendUniquePiKeys(toPiKeybindingArray(rewritten[normalizedKeybindingId] ?? []), filterReservedOutfitterKeys(toPiKeybindingArray(binding)));
|
|
227
|
-
}
|
|
228
|
-
rewritten[piThinkingCycleKeybindingId] = appendUniquePiKeys(filterReservedOutfitterKeys(toPiKeybindingArray(rewritten[piThinkingCycleKeybindingId] ?? [])), [piThinkingCycleKey]);
|
|
229
|
-
return rewritten;
|
|
230
|
-
};
|
|
231
|
-
const normalizePiKeybindingId = (keybindingId) => keybindingId in legacyPiKeybindingIds
|
|
232
|
-
? legacyPiKeybindingIds[keybindingId]
|
|
233
|
-
: keybindingId;
|
|
234
|
-
const isPiKeybindingValue = (value) => typeof value === 'string' || (Array.isArray(value) && value.every((entry) => typeof entry === 'string'));
|
|
235
|
-
const toPiKeybindingArray = (value) => typeof value === 'string' ? [value] : [...value];
|
|
236
|
-
const filterReservedOutfitterKeys = (keys) => keys.filter((key) => !keysMatchIgnoringModifierOrder(key, piModeCycleKey) && !keysMatchIgnoringModifierOrder(key, piThinkingCycleKey));
|
|
237
|
-
const appendUniquePiKeys = (existingKeys, nextKeys) => {
|
|
238
|
-
const existingKeySet = new Set(existingKeys.map(normalizePiKey));
|
|
239
|
-
const mergedKeys = [...existingKeys];
|
|
240
|
-
for (const key of nextKeys) {
|
|
241
|
-
const normalizedKey = normalizePiKey(key);
|
|
242
|
-
if (existingKeySet.has(normalizedKey)) {
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
existingKeySet.add(normalizedKey);
|
|
246
|
-
mergedKeys.push(key);
|
|
247
|
-
}
|
|
248
|
-
return mergedKeys;
|
|
249
|
-
};
|
|
250
|
-
const keysMatchIgnoringModifierOrder = (left, right) => normalizePiKey(left) === normalizePiKey(right);
|
|
251
|
-
const normalizePiKey = (key) => {
|
|
252
|
-
const parts = key
|
|
253
|
-
.toLowerCase()
|
|
254
|
-
.split('+')
|
|
255
|
-
.map((part) => part.trim())
|
|
256
|
-
.filter((part) => part.length > 0);
|
|
257
|
-
/* v8 ignore next -- empty keybinding strings are schema-invalid defensive input. */
|
|
258
|
-
const keyName = parts.at(-1) ?? '';
|
|
259
|
-
const modifiers = new Set(parts.slice(0, -1));
|
|
260
|
-
const sortedModifiers = ['ctrl', 'shift', 'alt'].filter((modifier) => modifiers.has(modifier));
|
|
261
|
-
return [...sortedModifiers, keyName].join('+');
|
|
262
|
-
};
|
|
263
|
-
const createPiStatePaths = (profile, input) => {
|
|
264
|
-
return createDeclaredStatePaths({
|
|
265
|
-
adapterId: 'pi',
|
|
266
|
-
declarations: piStatePathDeclarations,
|
|
267
|
-
profile,
|
|
268
|
-
resolveSourcePath: (relativePath, directory) => resolvePiStateSourcePath(input.profileFolders ?? [], input.homeDirectory, input.cacheDirectory, relativePath, directory),
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
const resolvePiStateSourcePath = (profileFolders, homeDirectory, cacheDirectory, relativePath, directory) => {
|
|
272
|
-
const normalizedRelativePath = directory ? relativePath.slice(0, -1) : relativePath;
|
|
273
|
-
const configuredCacheDirectory = cacheDirectory ??
|
|
274
|
-
join(
|
|
275
|
-
/* v8 ignore next -- run command always passes homeDirectory; the os fallback is defensive. */
|
|
276
|
-
homeDirectory ?? homedir(), '.outfitter', 'cache');
|
|
277
|
-
if (relativePath === 'utilities/' || relativePath === 'bin/') {
|
|
278
|
-
return join(configuredCacheDirectory, 'utilities');
|
|
279
|
-
}
|
|
280
|
-
const profileSource = findProfileStateSource(profileFolders, 'pi', relativePath, directory);
|
|
281
|
-
if (profileSource !== undefined) {
|
|
282
|
-
return profileSource;
|
|
283
|
-
}
|
|
284
|
-
return join(
|
|
285
|
-
/* v8 ignore next -- run command always passes homeDirectory; the os fallback is defensive. */
|
|
286
|
-
homeDirectory ?? homedir(), '.pi', 'agent', normalizedRelativePath);
|
|
287
|
-
};
|
|
288
|
-
const deepWorkAdditionalJobsFoldersEnv = 'DEEPWORK_ADDITIONAL_JOBS_FOLDERS';
|
|
289
|
-
const createDeepWorkAdditionalJobsFolders = (controls, profileFolders, profileLayers) => {
|
|
290
|
-
const profileJobFolders = [
|
|
291
|
-
...new Set(profileFolders.flatMap(deepWorkJobsFoldersForProfile).filter(isExistingDeepWorkJobsFolder)),
|
|
292
|
-
];
|
|
293
|
-
const namedJobFolders = resolveNamedDeepWorkJobFolders(profileLayers);
|
|
294
|
-
const existingValue = allowExternalDeepWorkJobs(controls)
|
|
295
|
-
? (controls.environment?.[deepWorkAdditionalJobsFoldersEnv] ?? process.env[deepWorkAdditionalJobsFoldersEnv])
|
|
296
|
-
: undefined;
|
|
297
|
-
const jobFolders = [...new Set([...splitPathList(existingValue), ...namedJobFolders, ...profileJobFolders])];
|
|
298
|
-
return jobFolders.length === 0 ? undefined : jobFolders.join(delimiter);
|
|
299
|
-
};
|
|
300
|
-
const resolveNamedDeepWorkJobFolders = (profileLayers) => [
|
|
301
|
-
...new Set(profileLayers.flatMap((profileLayer) => (profileLayer.profile.controls.deepwork?.jobs ?? []).flatMap((jobName) => resolveNamedDeepWorkJobFolder(profileLayer, jobName)))),
|
|
302
|
-
];
|
|
303
|
-
const resolveNamedDeepWorkJobFolder = (profileLayer, jobName) => sharedDeepWorkJobRootsForLayer(profileLayer).filter((jobsFolder) => isFile(join(jobsFolder, jobName, 'job.yml')));
|
|
304
|
-
/* v8 ignore next -- warning-only DeepWork job absence is covered by higher-level run command behavior. */
|
|
305
|
-
const createMissingNamedDeepWorkJobWarnings = (profileLayers) => profileLayers.flatMap((profileLayer) => (profileLayer.profile.controls.deepwork?.jobs ?? []).flatMap((jobName) => resolveNamedDeepWorkJobFolder(profileLayer, jobName).length === 0
|
|
306
|
-
? [`pi adapter could not find DeepWork job '${jobName}' for profile '${profileLayer.profile.id}'.`]
|
|
307
|
-
: []));
|
|
308
|
-
const sharedDeepWorkJobRootsForLayer = (profileLayer) => {
|
|
309
|
-
/* v8 ignore next -- source-less synthetic layers do not expose shared DeepWork jobs. */
|
|
310
|
-
if (profileLayer.sourceRootPath === undefined) {
|
|
311
|
-
return [];
|
|
312
|
-
}
|
|
313
|
-
return [
|
|
314
|
-
join(dirname(profileLayer.sourceRootPath), 'deepwork', 'jobs'),
|
|
315
|
-
join(profileLayer.sourceRootPath, 'deepwork', 'jobs'),
|
|
316
|
-
join(profileLayer.sourceRootPath, '.outfitter', 'deepwork', 'jobs'),
|
|
317
|
-
];
|
|
318
|
-
};
|
|
319
|
-
const allowExternalDeepWorkJobs = (controls) => controls.allowExternalDeepWorkJobs === true || controls.allow_external_deepwork_jobs === true;
|
|
320
|
-
const deepWorkJobsFoldersForProfile = (profileFolder) => [
|
|
321
|
-
join(profileFolder, 'deepwork', 'jobs'),
|
|
322
|
-
join(profileFolder, 'cli_specific', 'pi', 'deepwork', 'jobs'),
|
|
323
|
-
];
|
|
324
|
-
const isExistingDeepWorkJobsFolder = (folderPath) => readOptionalDirectoryEntries(folderPath, 'profile DeepWork jobs folder').some(isDeepWorkJobEntry(folderPath));
|
|
325
|
-
const isDeepWorkJobEntry = (folderPath) => (entry) => entry.isDirectory() && isFile(join(folderPath, entry.name, 'job.yml'));
|
|
326
|
-
const readOptionalDirectoryEntries = (folderPath, description) => {
|
|
327
|
-
try {
|
|
328
|
-
return readdirSync(folderPath, { withFileTypes: true });
|
|
329
|
-
}
|
|
330
|
-
catch (error) {
|
|
331
|
-
if (isMissingPathError(error)) {
|
|
332
|
-
return [];
|
|
333
|
-
}
|
|
334
|
-
throw new Error(`Could not read ${description} '${folderPath}': ${formatFilesystemError(error)}`, {
|
|
335
|
-
cause: error,
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
const isFile = (path) => {
|
|
340
|
-
try {
|
|
341
|
-
return statSync(path).isFile();
|
|
342
|
-
}
|
|
343
|
-
catch (error) {
|
|
344
|
-
if (isMissingPathError(error)) {
|
|
345
|
-
return false;
|
|
346
|
-
}
|
|
347
|
-
throw new Error(`Could not inspect file '${path}': ${formatFilesystemError(error)}`, { cause: error });
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
const isMissingPathError = (error) => error !== null && typeof error === 'object' && 'code' in error && error.code === 'ENOENT';
|
|
351
|
-
const formatFilesystemError = (error) => String(error);
|
|
352
|
-
const splitPathList = (value) => value === undefined || value === '' ? [] : value.split(delimiter).filter((entry) => entry !== '');
|
|
353
|
-
const mergePiControls = (controls) => mergeAgentSpecificControls(controls, 'pi');
|
|
354
|
-
const findUnsupportedControls = (controls) => {
|
|
355
|
-
const unsupported = Object.keys(controls).filter((controlName) => !genericControlNames.has(controlName));
|
|
356
|
-
if (controls.pi !== undefined) {
|
|
357
|
-
unsupported.push(...Object.keys(controls.pi)
|
|
358
|
-
.filter((controlName) => !piControlNames.has(controlName))
|
|
359
|
-
.map((controlName) => `pi.${controlName}`));
|
|
360
|
-
}
|
|
361
|
-
return unsupported;
|
|
362
|
-
};
|
|
363
|
-
//# sourceMappingURL=PiAdapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PiAdapter.js","sourceRoot":"","sources":["../../../src/agents/pi/PiAdapter.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAe,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAS3E,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACtH,OAAO,EAAE,mCAAmC,EAAE,yCAAyC,EAAE,MAAM,sBAAsB,CAAC;AACtH,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,6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AAM,uBAAuB,GAAG,CAAC,QAAyB,EAAqB,EAAE;IAC/E,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;IAEzG,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,WAAW,CAAC,IAAI,CACd,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;aACxB,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;aACzD,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,MAAM,WAAW,EAAE,CAAC,CAC7C,CAAC;IACJ,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC"}
|
package/dist/agents/pi/PiArgs.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Builds pi CLI argv from resolved Pi profile controls.
|
|
2
|
-
import { flagValue, repeatFlag, repeatFlagValue } from '../AdapterProfileControls.js';
|
|
3
|
-
export const createPiArgs = (controls) => [
|
|
4
|
-
...flagValue('--model', controls.model),
|
|
5
|
-
...flagValue('--provider', controls.provider),
|
|
6
|
-
...flagValue('--thinking', controls.thinking),
|
|
7
|
-
...flagValue('--session-dir', controls.sessionDirectory),
|
|
8
|
-
...flagValue('--prompt-template', controls.promptTemplate),
|
|
9
|
-
...flagValue('--system-prompt', controls.systemPrompt),
|
|
10
|
-
...repeatFlagValue('--append-system-prompt', controls.appendSystemPrompt),
|
|
11
|
-
...repeatFlag('--extension', controls.extensions),
|
|
12
|
-
...repeatFlag('--skill', (controls.skills ?? []).filter((source) => typeof source === 'string')),
|
|
13
|
-
...(controls.args ?? []),
|
|
14
|
-
];
|
|
15
|
-
//# sourceMappingURL=PiArgs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PiArgs.js","sourceRoot":"","sources":["../../../src/agents/pi/PiArgs.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGtF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAA2B,EAAqB,EAAE,CAAC;IAC9E,GAAG,SAAS,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC;IACvC,GAAG,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7C,GAAG,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7C,GAAG,SAAS,CAAC,eAAe,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IACxD,GAAG,SAAS,CAAC,mBAAmB,EAAE,QAAQ,CAAC,cAAc,CAAC;IAC1D,GAAG,SAAS,CAAC,iBAAiB,EAAE,QAAQ,CAAC,YAAY,CAAC;IACtD,GAAG,eAAe,CAAC,wBAAwB,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IACzE,GAAG,UAAU,CAAC,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjD,GAAG,UAAU,CACX,SAAS,EACT,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAoB,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CACzF;IACD,GAAG,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;CACzB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Defines pi-specific compositeProfile path metadata.
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
export const createPiCompositeProfilePaths = (agentDirectory) => ({
|
|
4
|
-
agentDirectory,
|
|
5
|
-
profileMetadataPath: join(agentDirectory, 'outfitter', 'profile.json'),
|
|
6
|
-
});
|
|
7
|
-
//# sourceMappingURL=PiCompositeProfileWriter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PiCompositeProfileWriter.js","sourceRoot":"","sources":["../../../src/agents/pi/PiCompositeProfileWriter.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOjC,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,cAAsB,EAA2B,EAAE,CAAC,CAAC;IACjG,cAAc;IACd,mBAAmB,EAAE,IAAI,CAAC,cAAc,EAAE,WAAW,EAAE,cAAc,CAAC;CACvE,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface PiExtensionCacheOptions {
|
|
2
|
-
readonly cacheDirectory?: string;
|
|
3
|
-
readonly onProgress?: (message: string) => void;
|
|
4
|
-
}
|
|
5
|
-
export declare const materializePiExtensionSources: (sources: readonly string[] | undefined, options?: PiExtensionCacheOptions) => readonly string[] | undefined;
|
|
6
|
-
export interface PiExtensionCacheRefreshResult {
|
|
7
|
-
readonly source: string;
|
|
8
|
-
readonly cachePath: string;
|
|
9
|
-
readonly status: 'refreshed' | 'unchanged' | 'pinned' | 'failed';
|
|
10
|
-
readonly message: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const refreshPiExtensionCaches: (cacheDirectory: string, options?: Pick<PiExtensionCacheOptions, "onProgress">) => readonly PiExtensionCacheRefreshResult[];
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
// Caches remote Pi extension packages as local directories before launch.
|
|
2
|
-
//
|
|
3
|
-
// Refresh policy: caches for `#ref`-pinned sources are immutable once created. Caches for
|
|
4
|
-
// branch-tracking (ref-less) sources are refreshed by `outfitter sync` through
|
|
5
|
-
// refreshPiExtensionCaches, which fast-forwards the shallow clone and reinstalls dependencies
|
|
6
|
-
// when the tip moved. Launch-time materialization never refreshes an existing cache.
|
|
7
|
-
import { createHash } from 'node:crypto';
|
|
8
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
9
|
-
import { dirname, join } from 'node:path';
|
|
10
|
-
import spawn from 'cross-spawn';
|
|
11
|
-
export const materializePiExtensionSources = (sources, options = {}) => {
|
|
12
|
-
if (sources === undefined || options.cacheDirectory === undefined) {
|
|
13
|
-
return sources;
|
|
14
|
-
}
|
|
15
|
-
const { cacheDirectory } = options;
|
|
16
|
-
return sources.map((source) => materializePiExtensionSource(source, cacheDirectory, options.onProgress));
|
|
17
|
-
};
|
|
18
|
-
const materializePiExtensionSource = (source, cacheDirectory, onProgress) => {
|
|
19
|
-
const gitSource = parseGitExtensionSource(source);
|
|
20
|
-
if (gitSource === undefined) {
|
|
21
|
-
return source;
|
|
22
|
-
}
|
|
23
|
-
const cachePath = join(cacheDirectory, 'extensions', 'git', encodeCacheKey(source));
|
|
24
|
-
if (!existsSync(cachePath)) {
|
|
25
|
-
try {
|
|
26
|
-
onProgress?.(`outfitter: caching extension ${source}…`);
|
|
27
|
-
cloneGitExtension(gitSource, cachePath);
|
|
28
|
-
installGitExtensionDependencies(cachePath, source, onProgress);
|
|
29
|
-
writeCacheSourceMetadata(cachePath, source, gitSource.ref);
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
rmSync(cachePath, { recursive: true, force: true });
|
|
33
|
-
rmSync(cacheSourceMetadataPath(cachePath), { force: true });
|
|
34
|
-
throw error;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return cachePath;
|
|
38
|
-
};
|
|
39
|
-
// Refreshes branch-tracking git-extension caches under `<cacheDirectory>/extensions/git`.
|
|
40
|
-
// `#ref`-pinned entries are reported as pinned and left untouched. Entries without source
|
|
41
|
-
// metadata (created before metadata existed) are skipped silently.
|
|
42
|
-
export const refreshPiExtensionCaches = (cacheDirectory, options = {}) => {
|
|
43
|
-
const gitCacheRoot = join(cacheDirectory, 'extensions', 'git');
|
|
44
|
-
if (!existsSync(gitCacheRoot)) {
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
47
|
-
return readdirSync(gitCacheRoot)
|
|
48
|
-
.filter((entryName) => entryName.endsWith(cacheSourceMetadataSuffix))
|
|
49
|
-
.sort()
|
|
50
|
-
.flatMap((entryName) => {
|
|
51
|
-
const result = refreshPiExtensionCache(gitCacheRoot, entryName, options.onProgress);
|
|
52
|
-
return result === undefined ? [] : [result];
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
const refreshPiExtensionCache = (gitCacheRoot, metadataFileName, onProgress) => {
|
|
56
|
-
const cachePath = join(gitCacheRoot, metadataFileName.slice(0, -cacheSourceMetadataSuffix.length));
|
|
57
|
-
const metadata = readCacheSourceMetadata(join(gitCacheRoot, metadataFileName));
|
|
58
|
-
if (metadata === undefined || !existsSync(cachePath)) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
if (metadata.ref !== undefined) {
|
|
62
|
-
return {
|
|
63
|
-
source: metadata.source,
|
|
64
|
-
cachePath,
|
|
65
|
-
status: 'pinned',
|
|
66
|
-
message: `pinned to #${metadata.ref}; cache left unchanged`,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
onProgress?.(`outfitter: refreshing extension ${metadata.source}…`);
|
|
70
|
-
return pullBranchTrackingExtensionCache(metadata.source, cachePath, onProgress);
|
|
71
|
-
};
|
|
72
|
-
const pullBranchTrackingExtensionCache = (source, cachePath, onProgress) => {
|
|
73
|
-
const headBeforePull = readCacheHead(cachePath);
|
|
74
|
-
const pullResult = runCommand('git', ['pull', '--ff-only'], cachePath);
|
|
75
|
-
if (pullResult.status !== 0) {
|
|
76
|
-
return {
|
|
77
|
-
source,
|
|
78
|
-
cachePath,
|
|
79
|
-
status: 'failed',
|
|
80
|
-
message: commandError('git', ['pull', '--ff-only'], pullResult).message,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
const headAfterPull = readCacheHead(cachePath);
|
|
84
|
-
if (headAfterPull === headBeforePull) {
|
|
85
|
-
return { source, cachePath, status: 'unchanged', message: 'already up to date' };
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
installGitExtensionDependencies(cachePath, source, onProgress);
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
return { source, cachePath, status: 'failed', message: error instanceof Error ? error.message : String(error) };
|
|
92
|
-
}
|
|
93
|
-
return { source, cachePath, status: 'refreshed', message: `updated to ${headAfterPull}` };
|
|
94
|
-
};
|
|
95
|
-
const cacheSourceMetadataSuffix = '.source.json';
|
|
96
|
-
const cacheSourceMetadataPath = (cachePath) => `${cachePath}${cacheSourceMetadataSuffix}`;
|
|
97
|
-
const writeCacheSourceMetadata = (cachePath, source, ref) => {
|
|
98
|
-
writeFileSync(cacheSourceMetadataPath(cachePath), `${JSON.stringify({ source, ref }, null, 2)}\n`);
|
|
99
|
-
};
|
|
100
|
-
const readCacheSourceMetadata = (metadataPath) => {
|
|
101
|
-
try {
|
|
102
|
-
const parsed = JSON.parse(readFileSync(metadataPath, 'utf8'));
|
|
103
|
-
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
const record = parsed;
|
|
107
|
-
if (typeof record.source !== 'string') {
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
return { source: record.source, ref: typeof record.ref === 'string' ? record.ref : undefined };
|
|
111
|
-
}
|
|
112
|
-
catch {
|
|
113
|
-
return undefined;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
const readCacheHead = (cachePath) => {
|
|
117
|
-
const result = runCommand('git', ['rev-parse', 'HEAD'], cachePath);
|
|
118
|
-
return result.status === 0 ? String(result.stdout).trim() : '';
|
|
119
|
-
};
|
|
120
|
-
const parseGitExtensionSource = (source) => {
|
|
121
|
-
const trimmed = source.trim();
|
|
122
|
-
if (isNonGitExtensionSource(trimmed)) {
|
|
123
|
-
return undefined;
|
|
124
|
-
}
|
|
125
|
-
const { sourceWithoutRef, ref } = splitGitRef(trimmed);
|
|
126
|
-
const cloneUrl = resolveGitCloneUrl(sourceWithoutRef);
|
|
127
|
-
return cloneUrl === undefined ? undefined : { cloneUrl, ref };
|
|
128
|
-
};
|
|
129
|
-
const isNonGitExtensionSource = (source) => source.startsWith('npm:') || source.startsWith('.') || source.startsWith('/') || source.startsWith('file:');
|
|
130
|
-
const resolveGitCloneUrl = (sourceWithoutRef) => {
|
|
131
|
-
if (sourceWithoutRef.startsWith('github:')) {
|
|
132
|
-
return ensureGitSuffix(`https://github.com/${sourceWithoutRef.slice('github:'.length)}`);
|
|
133
|
-
}
|
|
134
|
-
if (sourceWithoutRef.startsWith('git+')) {
|
|
135
|
-
return sourceWithoutRef.slice('git+'.length);
|
|
136
|
-
}
|
|
137
|
-
if (sourceWithoutRef.startsWith('git:')) {
|
|
138
|
-
return resolveGitPrefixCloneUrl(sourceWithoutRef.slice('git:'.length));
|
|
139
|
-
}
|
|
140
|
-
return isExplicitGitCloneUrl(sourceWithoutRef) ? sourceWithoutRef : undefined;
|
|
141
|
-
};
|
|
142
|
-
const resolveGitPrefixCloneUrl = (source) => source.startsWith('github.com/') ? ensureGitSuffix(`https://${source}`) : source;
|
|
143
|
-
const isExplicitGitCloneUrl = (source) => source.startsWith('https://') ||
|
|
144
|
-
source.startsWith('http://') ||
|
|
145
|
-
source.startsWith('ssh://') ||
|
|
146
|
-
source.startsWith('git@');
|
|
147
|
-
const splitGitRef = (source) => {
|
|
148
|
-
const hashIndex = source.lastIndexOf('#');
|
|
149
|
-
if (hashIndex !== -1) {
|
|
150
|
-
return { sourceWithoutRef: source.slice(0, hashIndex), ref: source.slice(hashIndex + 1) };
|
|
151
|
-
}
|
|
152
|
-
return { sourceWithoutRef: source };
|
|
153
|
-
};
|
|
154
|
-
const ensureGitSuffix = (source) => (source.endsWith('.git') ? source : `${source}.git`);
|
|
155
|
-
const cloneGitExtension = (source, cachePath) => {
|
|
156
|
-
mkdirSync(dirname(cachePath), { recursive: true });
|
|
157
|
-
const cloneArgs = source.ref === undefined
|
|
158
|
-
? ['clone', '--depth', '1', '--', source.cloneUrl, cachePath]
|
|
159
|
-
: ['clone', '--depth', '1', '--branch', source.ref, '--', source.cloneUrl, cachePath];
|
|
160
|
-
const cloneResult = runCommand('git', cloneArgs);
|
|
161
|
-
if (cloneResult.status === 0) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (source.ref === undefined) {
|
|
165
|
-
throw commandError('git', cloneArgs, cloneResult);
|
|
166
|
-
}
|
|
167
|
-
const fallbackCloneArgs = ['clone', '--', source.cloneUrl, cachePath];
|
|
168
|
-
const fallbackCloneResult = runCommand('git', fallbackCloneArgs);
|
|
169
|
-
if (fallbackCloneResult.status !== 0) {
|
|
170
|
-
throw commandError('git', cloneArgs, cloneResult);
|
|
171
|
-
}
|
|
172
|
-
const checkoutArgs = ['-C', cachePath, 'checkout', source.ref];
|
|
173
|
-
const checkoutResult = runCommand('git', checkoutArgs);
|
|
174
|
-
if (checkoutResult.status !== 0) {
|
|
175
|
-
throw commandError('git', checkoutArgs, checkoutResult);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
const installGitExtensionDependencies = (cachePath, source, onProgress) => {
|
|
179
|
-
if (!existsSync(join(cachePath, 'package.json'))) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
onProgress?.(`outfitter: installing dependencies for extension ${source}…`);
|
|
183
|
-
const npmArgs = existsSync(join(cachePath, 'package-lock.json')) ? ['ci', '--omit=dev'] : ['install', '--omit=dev'];
|
|
184
|
-
const result = runCommand('npm', npmArgs, cachePath);
|
|
185
|
-
if (result.status !== 0) {
|
|
186
|
-
throw commandError('npm', npmArgs, result);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
const runCommand = (command, args, cwd) => spawn.sync(command, args, { cwd, stdio: 'pipe', encoding: 'utf8' });
|
|
190
|
-
const commandError = (command, args, result) => {
|
|
191
|
-
const output = result.stderr || result.stdout || `${command} ${args.join(' ')} failed`;
|
|
192
|
-
return new Error(String(output).trim());
|
|
193
|
-
};
|
|
194
|
-
const encodeCacheKey = (source) => createHash('sha256').update(source).digest('hex').slice(0, 16);
|
|
195
|
-
//# sourceMappingURL=PiExtensionCache.js.map
|