@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.
Files changed (308) hide show
  1. package/.outfitter/skills/outfitter/SKILL.md +67 -37
  2. package/README.md +63 -35
  3. package/code/enterprise/cli/privateCatalogSettings.cjs +2 -2
  4. package/code/enterprise/pi-extension/privateCatalogOnboarding.js +5 -8
  5. package/code/enterprise/shared/privateCatalogPolicy.cjs +5 -5
  6. package/code/pi-extension/src/outfitter-extension.js +353 -553
  7. package/code/pi-extension/src/outfitter-runtime-extension.js +160 -0
  8. package/dist/agents/AgentLaunch.d.ts +9 -1
  9. package/dist/agents/AgentLaunch.js +19 -0
  10. package/dist/agents/AgentLaunch.js.map +1 -1
  11. package/dist/agents/PiCredentialPersistence.d.ts +6 -0
  12. package/dist/agents/PiCredentialPersistence.js +33 -0
  13. package/dist/agents/PiCredentialPersistence.js.map +1 -0
  14. package/dist/cli/OutfitterCli.js +10 -18
  15. package/dist/cli/OutfitterCli.js.map +1 -1
  16. package/dist/cli/commands/CommandObject.d.ts +0 -5
  17. package/dist/cli/commands/CommandObject.js +1 -4
  18. package/dist/cli/commands/CommandObject.js.map +1 -1
  19. package/dist/cli/commands/DumpCommand.d.ts +19 -0
  20. package/dist/cli/commands/DumpCommand.js +54 -0
  21. package/dist/cli/commands/DumpCommand.js.map +1 -0
  22. package/dist/cli/commands/ListCommand.d.ts +17 -0
  23. package/dist/cli/commands/ListCommand.js +77 -0
  24. package/dist/cli/commands/ListCommand.js.map +1 -0
  25. package/dist/cli/commands/PiRuntimeLaunch.d.ts +8 -0
  26. package/dist/cli/commands/PiRuntimeLaunch.js +47 -0
  27. package/dist/cli/commands/PiRuntimeLaunch.js.map +1 -0
  28. package/dist/cli/commands/ProcessDefaults.d.ts +2 -0
  29. package/dist/cli/commands/ProcessDefaults.js +5 -0
  30. package/dist/cli/commands/ProcessDefaults.js.map +1 -0
  31. package/dist/cli/commands/RunAgentCommand.d.ts +46 -0
  32. package/dist/cli/commands/RunAgentCommand.js +176 -0
  33. package/dist/cli/commands/RunAgentCommand.js.map +1 -0
  34. package/dist/cli/commands/SetupCommand.d.ts +38 -6
  35. package/dist/cli/commands/SetupCommand.js +194 -232
  36. package/dist/cli/commands/SetupCommand.js.map +1 -1
  37. package/dist/cli/commands/ValidateCommand.d.ts +20 -0
  38. package/dist/cli/commands/ValidateCommand.js +54 -0
  39. package/dist/cli/commands/ValidateCommand.js.map +1 -0
  40. package/dist/composer/Composer.d.ts +11 -0
  41. package/dist/composer/Composer.js +72 -0
  42. package/dist/composer/Composer.js.map +1 -0
  43. package/dist/composer/Composition.d.ts +33 -0
  44. package/dist/composer/Composition.js +2 -0
  45. package/dist/composer/Composition.js.map +1 -0
  46. package/dist/dump/Containment.d.ts +8 -0
  47. package/dist/dump/Containment.js +22 -0
  48. package/dist/dump/Containment.js.map +1 -0
  49. package/dist/dump/Dump.d.ts +8 -0
  50. package/dist/dump/Dump.js +182 -0
  51. package/dist/dump/Dump.js.map +1 -0
  52. package/dist/extensions/PiExtensionCache.d.ts +30 -0
  53. package/dist/extensions/PiExtensionCache.js +92 -0
  54. package/dist/extensions/PiExtensionCache.js.map +1 -0
  55. package/dist/fs/TypeConflict.d.ts +6 -0
  56. package/dist/fs/TypeConflict.js +21 -0
  57. package/dist/fs/TypeConflict.js.map +1 -0
  58. package/dist/paths/OutfitterCache.d.ts +6 -0
  59. package/dist/paths/OutfitterCache.js +17 -0
  60. package/dist/paths/OutfitterCache.js.map +1 -0
  61. package/dist/projection/Materialize.d.ts +24 -0
  62. package/dist/projection/Materialize.js +83 -0
  63. package/dist/projection/Materialize.js.map +1 -0
  64. package/dist/projection/ProjectHarness.d.ts +5 -0
  65. package/dist/projection/ProjectHarness.js +77 -0
  66. package/dist/projection/ProjectHarness.js.map +1 -0
  67. package/dist/projection/Projection.d.ts +23 -0
  68. package/dist/projection/Projection.js +2 -0
  69. package/dist/projection/Projection.js.map +1 -0
  70. package/dist/resolver/AgentDefinition.d.ts +30 -0
  71. package/dist/resolver/AgentDefinition.js +123 -0
  72. package/dist/resolver/AgentDefinition.js.map +1 -0
  73. package/dist/resolver/Layer.d.ts +12 -0
  74. package/dist/resolver/Layer.js +30 -0
  75. package/dist/resolver/Layer.js.map +1 -0
  76. package/dist/resolver/Resolver.d.ts +3 -0
  77. package/dist/resolver/Resolver.js +163 -0
  78. package/dist/resolver/Resolver.js.map +1 -0
  79. package/dist/resolver/ResolverContext.d.ts +15 -0
  80. package/dist/resolver/ResolverContext.js +11 -0
  81. package/dist/resolver/ResolverContext.js.map +1 -0
  82. package/dist/resolver/ResolverValidation.d.ts +11 -0
  83. package/dist/resolver/ResolverValidation.js +112 -0
  84. package/dist/resolver/ResolverValidation.js.map +1 -0
  85. package/dist/resolver/Resource.d.ts +88 -0
  86. package/dist/resolver/Resource.js +34 -0
  87. package/dist/resolver/Resource.js.map +1 -0
  88. package/dist/schemas/agent.schema.json +48 -0
  89. package/dist/schemas/settings.schema.json +32 -9
  90. package/dist/settings/Settings.d.ts +34 -5
  91. package/dist/settings/Settings.js +3 -1
  92. package/dist/settings/Settings.js.map +1 -1
  93. package/dist/settings/SettingsLoader.d.ts +1 -1
  94. package/dist/settings/SettingsLoader.js +23 -22
  95. package/dist/settings/SettingsLoader.js.map +1 -1
  96. package/dist/settings/SettingsMerger.js +12 -10
  97. package/dist/settings/SettingsMerger.js.map +1 -1
  98. package/dist/setup/DefaultCatalog.d.ts +20 -0
  99. package/dist/setup/DefaultCatalog.js +89 -0
  100. package/dist/setup/DefaultCatalog.js.map +1 -0
  101. package/dist/setup/Setup.d.ts +43 -0
  102. package/dist/setup/Setup.js +261 -0
  103. package/dist/setup/Setup.js.map +1 -0
  104. package/dist/skills/SkillDocument.d.ts +6 -1
  105. package/dist/skills/SkillDocument.js.map +1 -1
  106. package/dist/sources/SourceCache.d.ts +19 -0
  107. package/dist/{profiles/ProfileCache.js → sources/SourceCache.js} +22 -18
  108. package/dist/sources/SourceCache.js.map +1 -0
  109. package/dist/validation/SchemaValidator.d.ts +1 -1
  110. package/dist/validation/SchemaValidator.js +4 -13
  111. package/dist/validation/SchemaValidator.js.map +1 -1
  112. package/docs/architecture/state_writeback_strategy.md +54 -122
  113. package/docs/documentation/README.md +33 -12
  114. package/docs/documentation/actions.md +35 -52
  115. package/docs/documentation/agents.md +109 -0
  116. package/docs/documentation/best-practices.md +25 -63
  117. package/docs/documentation/catalogs.md +126 -0
  118. package/docs/documentation/cli.md +39 -41
  119. package/docs/documentation/concepts.md +66 -23
  120. package/docs/documentation/dump-and-bake.md +30 -0
  121. package/docs/documentation/first-time-cli-agent-users.md +8 -8
  122. package/docs/documentation/getting-started.md +28 -8
  123. package/docs/documentation/hooks.md +20 -0
  124. package/docs/documentation/iterating-on-profiles.md +56 -70
  125. package/docs/documentation/local-development.md +84 -0
  126. package/docs/documentation/migration.md +39 -0
  127. package/docs/documentation/personas.md +41 -0
  128. package/docs/documentation/porting-claude.md +54 -0
  129. package/docs/documentation/profiles.md +16 -169
  130. package/docs/documentation/settings.md +61 -0
  131. package/docs/documentation/skills.md +93 -334
  132. package/docs/documentation/state.md +24 -62
  133. package/docs/documentation/subagents.md +37 -0
  134. package/docs/documentation/support-matrix.md +40 -35
  135. package/docs/documentation/switching-to-outfitter.md +75 -81
  136. package/docs/documentation/tasks.md +13 -0
  137. package/docs/documentation/usecases/engineering.md +67 -84
  138. package/docs/documentation/usecases/organization-profile-catalog.md +83 -111
  139. package/docs/documentation/usecases/persona-reviews.md +133 -139
  140. package/docs/philosophy.md +2 -2
  141. package/package.json +3 -3
  142. package/src/schemas/agent.schema.json +48 -0
  143. package/src/schemas/settings.schema.json +32 -9
  144. package/dist/agents/AdapterProfileControls.d.ts +0 -21
  145. package/dist/agents/AdapterProfileControls.js +0 -76
  146. package/dist/agents/AdapterProfileControls.js.map +0 -1
  147. package/dist/agents/AdapterStatePaths.d.ts +0 -12
  148. package/dist/agents/AdapterStatePaths.js +0 -46
  149. package/dist/agents/AdapterStatePaths.js.map +0 -1
  150. package/dist/agents/AgentAdapter.d.ts +0 -44
  151. package/dist/agents/AgentAdapter.js +0 -2
  152. package/dist/agents/AgentAdapter.js.map +0 -1
  153. package/dist/agents/AgentRegistry.d.ts +0 -6
  154. package/dist/agents/AgentRegistry.js +0 -17
  155. package/dist/agents/AgentRegistry.js.map +0 -1
  156. package/dist/agents/LaunchResources.d.ts +0 -17
  157. package/dist/agents/LaunchResources.js +0 -61
  158. package/dist/agents/LaunchResources.js.map +0 -1
  159. package/dist/agents/OutfitterSkill.d.ts +0 -11
  160. package/dist/agents/OutfitterSkill.js +0 -128
  161. package/dist/agents/OutfitterSkill.js.map +0 -1
  162. package/dist/agents/ResourceIdentity.d.ts +0 -2
  163. package/dist/agents/ResourceIdentity.js +0 -51
  164. package/dist/agents/ResourceIdentity.js.map +0 -1
  165. package/dist/agents/claude/ClaudeAdapter.d.ts +0 -2
  166. package/dist/agents/claude/ClaudeAdapter.js +0 -148
  167. package/dist/agents/claude/ClaudeAdapter.js.map +0 -1
  168. package/dist/agents/claude/ClaudeCompositeProfileWriter.d.ts +0 -5
  169. package/dist/agents/claude/ClaudeCompositeProfileWriter.js +0 -7
  170. package/dist/agents/claude/ClaudeCompositeProfileWriter.js.map +0 -1
  171. package/dist/agents/pi/PiAdapter.d.ts +0 -2
  172. package/dist/agents/pi/PiAdapter.js +0 -363
  173. package/dist/agents/pi/PiAdapter.js.map +0 -1
  174. package/dist/agents/pi/PiArgs.d.ts +0 -2
  175. package/dist/agents/pi/PiArgs.js +0 -15
  176. package/dist/agents/pi/PiArgs.js.map +0 -1
  177. package/dist/agents/pi/PiCompositeProfileWriter.d.ts +0 -5
  178. package/dist/agents/pi/PiCompositeProfileWriter.js +0 -7
  179. package/dist/agents/pi/PiCompositeProfileWriter.js.map +0 -1
  180. package/dist/agents/pi/PiExtensionCache.d.ts +0 -12
  181. package/dist/agents/pi/PiExtensionCache.js +0 -195
  182. package/dist/agents/pi/PiExtensionCache.js.map +0 -1
  183. package/dist/agents/pi/PiMcpConfig.d.ts +0 -2
  184. package/dist/agents/pi/PiMcpConfig.js +0 -114
  185. package/dist/agents/pi/PiMcpConfig.js.map +0 -1
  186. package/dist/agents/pi/PiSettingsMergePolicy.d.ts +0 -17
  187. package/dist/agents/pi/PiSettingsMergePolicy.js +0 -59
  188. package/dist/agents/pi/PiSettingsMergePolicy.js.map +0 -1
  189. package/dist/agents/pi/PiSkillSources.d.ts +0 -8
  190. package/dist/agents/pi/PiSkillSources.js +0 -73
  191. package/dist/agents/pi/PiSkillSources.js.map +0 -1
  192. package/dist/cli/commands/FirstRunWelcomeProfile.d.ts +0 -11
  193. package/dist/cli/commands/FirstRunWelcomeProfile.js +0 -110
  194. package/dist/cli/commands/FirstRunWelcomeProfile.js.map +0 -1
  195. package/dist/cli/commands/PiLoginLaunch.d.ts +0 -22
  196. package/dist/cli/commands/PiLoginLaunch.js +0 -170
  197. package/dist/cli/commands/PiLoginLaunch.js.map +0 -1
  198. package/dist/cli/commands/RunCommand.d.ts +0 -36
  199. package/dist/cli/commands/RunCommand.js +0 -345
  200. package/dist/cli/commands/RunCommand.js.map +0 -1
  201. package/dist/cli/commands/SyncCommand.d.ts +0 -46
  202. package/dist/cli/commands/SyncCommand.js +0 -244
  203. package/dist/cli/commands/SyncCommand.js.map +0 -1
  204. package/dist/cli/commands/WelcomeCommand.d.ts +0 -56
  205. package/dist/cli/commands/WelcomeCommand.js +0 -224
  206. package/dist/cli/commands/WelcomeCommand.js.map +0 -1
  207. package/dist/cli/commands/assets/outfitter-ascii.txt +0 -5
  208. package/dist/cli/commands/profile/Command.d.ts +0 -7
  209. package/dist/cli/commands/profile/Command.js +0 -24
  210. package/dist/cli/commands/profile/Command.js.map +0 -1
  211. package/dist/cli/commands/profile/CreateCommand.d.ts +0 -19
  212. package/dist/cli/commands/profile/CreateCommand.js +0 -115
  213. package/dist/cli/commands/profile/CreateCommand.js.map +0 -1
  214. package/dist/cli/commands/profile/LintCommand.d.ts +0 -19
  215. package/dist/cli/commands/profile/LintCommand.js +0 -155
  216. package/dist/cli/commands/profile/LintCommand.js.map +0 -1
  217. package/dist/cli/commands/profile/ListCommand.d.ts +0 -19
  218. package/dist/cli/commands/profile/ListCommand.js +0 -91
  219. package/dist/cli/commands/profile/ListCommand.js.map +0 -1
  220. package/dist/cli/commands/profile/Shared.d.ts +0 -9
  221. package/dist/cli/commands/profile/Shared.js +0 -10
  222. package/dist/cli/commands/profile/Shared.js.map +0 -1
  223. package/dist/cli/commands/run/RunFirstRunOnboarding.d.ts +0 -7
  224. package/dist/cli/commands/run/RunFirstRunOnboarding.js +0 -52
  225. package/dist/cli/commands/run/RunFirstRunOnboarding.js.map +0 -1
  226. package/dist/cli/commands/run/RunLaunchSummary.d.ts +0 -2
  227. package/dist/cli/commands/run/RunLaunchSummary.js +0 -35
  228. package/dist/cli/commands/run/RunLaunchSummary.js.map +0 -1
  229. package/dist/cli/commands/run/RunProfileResolution.d.ts +0 -39
  230. package/dist/cli/commands/run/RunProfileResolution.js +0 -128
  231. package/dist/cli/commands/run/RunProfileResolution.js.map +0 -1
  232. package/dist/cli/commands/run/RunStateWritePrompt.d.ts +0 -2
  233. package/dist/cli/commands/run/RunStateWritePrompt.js +0 -29
  234. package/dist/cli/commands/run/RunStateWritePrompt.js.map +0 -1
  235. package/dist/cli/commands/setup/SetupPrompts.d.ts +0 -14
  236. package/dist/cli/commands/setup/SetupPrompts.js +0 -296
  237. package/dist/cli/commands/setup/SetupPrompts.js.map +0 -1
  238. package/dist/cli/commands/setup/SetupSourceImport.d.ts +0 -5
  239. package/dist/cli/commands/setup/SetupSourceImport.js +0 -177
  240. package/dist/cli/commands/setup/SetupSourceImport.js.map +0 -1
  241. package/dist/cli/commands/setup/SetupSourceLaunch.d.ts +0 -4
  242. package/dist/cli/commands/setup/SetupSourceLaunch.js +0 -65
  243. package/dist/cli/commands/setup/SetupSourceLaunch.js.map +0 -1
  244. package/dist/cli/commands/setup/SetupStarterSource.d.ts +0 -21
  245. package/dist/cli/commands/setup/SetupStarterSource.js +0 -133
  246. package/dist/cli/commands/setup/SetupStarterSource.js.map +0 -1
  247. package/dist/cli/commands/setup/SetupTypes.d.ts +0 -91
  248. package/dist/cli/commands/setup/SetupTypes.js +0 -26
  249. package/dist/cli/commands/setup/SetupTypes.js.map +0 -1
  250. package/dist/compositeProfile/CompositeProfile.d.ts +0 -8
  251. package/dist/compositeProfile/CompositeProfile.js +0 -6
  252. package/dist/compositeProfile/CompositeProfile.js.map +0 -1
  253. package/dist/compositeProfile/CompositeProfileAssembler.d.ts +0 -12
  254. package/dist/compositeProfile/CompositeProfileAssembler.js +0 -32
  255. package/dist/compositeProfile/CompositeProfileAssembler.js.map +0 -1
  256. package/dist/compositeProfile/CompositeProfileCleanup.d.ts +0 -9
  257. package/dist/compositeProfile/CompositeProfileCleanup.js +0 -87
  258. package/dist/compositeProfile/CompositeProfileCleanup.js.map +0 -1
  259. package/dist/compositeProfile/CompositeProfileFile.d.ts +0 -16
  260. package/dist/compositeProfile/CompositeProfileFile.js +0 -16
  261. package/dist/compositeProfile/CompositeProfileFile.js.map +0 -1
  262. package/dist/compositeProfile/CompositeProfileTemplate.d.ts +0 -15
  263. package/dist/compositeProfile/CompositeProfileTemplate.js +0 -65
  264. package/dist/compositeProfile/CompositeProfileTemplate.js.map +0 -1
  265. package/dist/compositeProfile/CompositeProfileWatcher.d.ts +0 -18
  266. package/dist/compositeProfile/CompositeProfileWatcher.js +0 -46
  267. package/dist/compositeProfile/CompositeProfileWatcher.js.map +0 -1
  268. package/dist/compositeProfile/StatePersistence.d.ts +0 -39
  269. package/dist/compositeProfile/StatePersistence.js +0 -249
  270. package/dist/compositeProfile/StatePersistence.js.map +0 -1
  271. package/dist/fs/SafeSymlink.d.ts +0 -13
  272. package/dist/fs/SafeSymlink.js +0 -50
  273. package/dist/fs/SafeSymlink.js.map +0 -1
  274. package/dist/profiles/Profile.d.ts +0 -60
  275. package/dist/profiles/Profile.js +0 -7
  276. package/dist/profiles/Profile.js.map +0 -1
  277. package/dist/profiles/ProfileCache.d.ts +0 -8
  278. package/dist/profiles/ProfileCache.js.map +0 -1
  279. package/dist/profiles/ProfileLoader.d.ts +0 -28
  280. package/dist/profiles/ProfileLoader.js +0 -299
  281. package/dist/profiles/ProfileLoader.js.map +0 -1
  282. package/dist/profiles/ProfileMerger.d.ts +0 -19
  283. package/dist/profiles/ProfileMerger.js +0 -112
  284. package/dist/profiles/ProfileMerger.js.map +0 -1
  285. package/dist/profiles/ProfileSource.d.ts +0 -35
  286. package/dist/profiles/ProfileSource.js +0 -13
  287. package/dist/profiles/ProfileSource.js.map +0 -1
  288. package/dist/profiles/PromptIncludes.d.ts +0 -32
  289. package/dist/profiles/PromptIncludes.js +0 -147
  290. package/dist/profiles/PromptIncludes.js.map +0 -1
  291. package/dist/prompts/SystemPromptExport.d.ts +0 -16
  292. package/dist/prompts/SystemPromptExport.js +0 -81
  293. package/dist/prompts/SystemPromptExport.js.map +0 -1
  294. package/dist/schemas/profile-source.schema.json +0 -29
  295. package/dist/schemas/profile.schema.json +0 -200
  296. package/dist/skills/ProfileSkillResolution.d.ts +0 -21
  297. package/dist/skills/ProfileSkillResolution.js +0 -88
  298. package/dist/skills/ProfileSkillResolution.js.map +0 -1
  299. package/dist/skills/SkillCatalog.d.ts +0 -41
  300. package/dist/skills/SkillCatalog.js +0 -119
  301. package/dist/skills/SkillCatalog.js.map +0 -1
  302. package/dist/skills/SkillResolution.d.ts +0 -34
  303. package/dist/skills/SkillResolution.js +0 -369
  304. package/dist/skills/SkillResolution.js.map +0 -1
  305. package/docs/documentation/profile-repository.md +0 -179
  306. package/src/schemas/SchemaDocument.ts +0 -20
  307. package/src/schemas/profile-source.schema.json +0 -29
  308. package/src/schemas/profile.schema.json +0 -200
@@ -1,13 +0,0 @@
1
- import { symlinkSync } from 'node:fs';
2
- export interface SafeSymlinkInput {
3
- readonly sourcePath: string;
4
- readonly outputPath: string;
5
- readonly directory: boolean;
6
- readonly label: string;
7
- }
8
- export interface SafeSymlinkDependencies {
9
- readonly symlink?: typeof symlinkSync;
10
- readonly warn?: (message: string) => void;
11
- readonly platform?: NodeJS.Platform;
12
- }
13
- export declare const createSafeSymlink: (input: SafeSymlinkInput, dependencies?: SafeSymlinkDependencies) => void;
@@ -1,50 +0,0 @@
1
- // Creates symlinks with a Windows-only fallback for environments that deny symlink creation.
2
- import { copyFileSync, cpSync, symlinkSync } from 'node:fs';
3
- import { resolve } from 'node:path';
4
- // Windows without Developer Mode rejects symlink creation with EPERM. Directories fall
5
- // back to junctions, which need no privilege but require an absolute target; files (and
6
- // directories whose junction also fails) fall back to a one-way copy with a warning
7
- // because agent writes to the copy cannot persist back to the source. On POSIX platforms
8
- // a permission error is a real filesystem problem, so it is rethrown instead of being
9
- // silently downgraded to a copy.
10
- export const createSafeSymlink = (input, dependencies = {}) => {
11
- const symlink = dependencies.symlink ?? symlinkSync;
12
- /* v8 ignore next -- the process platform default is direct runtime behavior; tests inject a platform. */
13
- const platform = dependencies.platform ?? process.platform;
14
- try {
15
- symlink(input.sourcePath, input.outputPath, input.directory ? 'dir' : 'file');
16
- }
17
- catch (error) {
18
- if (platform !== 'win32' || !isSymlinkPermissionError(error)) {
19
- throw error;
20
- }
21
- createWindowsSafeSymlinkFallback(symlink, input, dependencies.warn);
22
- }
23
- };
24
- const createWindowsSafeSymlinkFallback = (symlink, input, warn) => {
25
- if (input.directory) {
26
- try {
27
- symlink(resolve(input.sourcePath), input.outputPath, 'junction');
28
- return;
29
- }
30
- catch (error) {
31
- if (!isSymlinkPermissionError(error)) {
32
- throw error;
33
- }
34
- }
35
- }
36
- copySafeSymlinkFallback(input, warn);
37
- };
38
- const copySafeSymlinkFallback = (input, warn) => {
39
- if (input.directory) {
40
- cpSync(input.sourcePath, input.outputPath, { recursive: true });
41
- }
42
- else {
43
- copyFileSync(input.sourcePath, input.outputPath);
44
- }
45
- /* v8 ignore next -- console fallback is direct CLI behavior; tests inject a warn writer. */
46
- (warn ?? console.error)(`${input.label} could not be symlinked (symlinks are unavailable on this platform); ` +
47
- `copied '${input.sourcePath}' instead, so writes to it will not persist back.`);
48
- };
49
- const isSymlinkPermissionError = (error) => error instanceof Error && 'code' in error && (error.code === 'EPERM' || error.code === 'EACCES');
50
- //# sourceMappingURL=SafeSymlink.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SafeSymlink.js","sourceRoot":"","sources":["../../src/fs/SafeSymlink.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,uFAAuF;AACvF,wFAAwF;AACxF,oFAAoF;AACpF,yFAAyF;AACzF,sFAAsF;AACtF,iCAAiC;AACjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAuB,EAAE,eAAwC,EAAE,EAAQ,EAAE;IAC7G,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,IAAI,WAAW,CAAC;IACpD,yGAAyG;IACzG,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IAE3D,IAAI,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAChF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,QAAQ,KAAK,OAAO,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7D,MAAM,KAAK,CAAC;QACd,CAAC;QAED,gCAAgC,CAAC,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,gCAAgC,GAAG,CACvC,OAA2B,EAC3B,KAAuB,EACvB,IAA6C,EACvC,EAAE;IACR,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACpB,IAAI,CAAC;YACH,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrC,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IAED,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,KAAuB,EAAE,IAA6C,EAAQ,EAAE;IAC/G,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACpB,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,4FAA4F;IAC5F,CAAC,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,CACrB,GAAG,KAAK,CAAC,KAAK,uEAAuE;QACnF,WAAW,KAAK,CAAC,UAAU,mDAAmD,CACjF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,KAAc,EAAW,EAAE,CAC3D,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC"}
@@ -1,60 +0,0 @@
1
- import type { StatePersistenceStrategy } from '../compositeProfile/StatePersistence.js';
2
- export type StatePersistenceOverrides = Readonly<Record<string, StatePersistenceStrategy>>;
3
- export interface PromptFileInclude {
4
- readonly file: string;
5
- }
6
- export interface PromptRepoFileInclude {
7
- readonly repo_file: string;
8
- }
9
- export type AppendSystemPromptEntry = string | PromptFileInclude | PromptRepoFileInclude;
10
- export type AppendSystemPromptControl = AppendSystemPromptEntry | readonly AppendSystemPromptEntry[];
11
- export interface SkillFileReference {
12
- readonly file: string;
13
- }
14
- export interface SkillRepoFileReference {
15
- readonly repo_file: string;
16
- }
17
- export type SkillReference = SkillFileReference | SkillRepoFileReference;
18
- /** Expanded `controls.skills` entry appending profile-owned references to a selected skill. */
19
- export interface SkillSelection {
20
- readonly id: string;
21
- readonly references?: readonly SkillReference[];
22
- }
23
- export type SkillControlEntry = string | SkillSelection;
24
- export interface DeepWorkProfileControls {
25
- readonly jobs?: readonly string[];
26
- }
27
- interface BaseProfileControls {
28
- readonly [controlName: string]: unknown;
29
- readonly model?: string;
30
- readonly provider?: string;
31
- readonly thinking?: string;
32
- readonly environment?: Readonly<Record<string, string>>;
33
- readonly args?: readonly string[];
34
- readonly sessionDirectory?: string;
35
- readonly extensions?: readonly string[];
36
- readonly skills?: readonly SkillControlEntry[];
37
- readonly promptTemplate?: string;
38
- readonly systemPrompt?: string;
39
- readonly appendSystemPrompt?: AppendSystemPromptControl;
40
- readonly deepwork?: DeepWorkProfileControls;
41
- }
42
- export type AgentSpecificProfileControls = BaseProfileControls;
43
- export type PiProfileControls = AgentSpecificProfileControls;
44
- export type ClaudeProfileControls = AgentSpecificProfileControls;
45
- export interface ProfileControls extends BaseProfileControls {
46
- readonly pi?: PiProfileControls;
47
- readonly claude?: ClaudeProfileControls;
48
- }
49
- export interface Profile {
50
- readonly id: string;
51
- readonly label?: string;
52
- readonly description?: string;
53
- readonly template?: boolean;
54
- readonly inherits: readonly string[];
55
- readonly controls: ProfileControls;
56
- readonly statePersistence?: StatePersistenceOverrides;
57
- readonly profileExport?: boolean;
58
- }
59
- export declare const createEmptyProfile: (id: string) => Profile;
60
- export {};
@@ -1,7 +0,0 @@
1
- export const createEmptyProfile = (id) => ({
2
- id,
3
- inherits: [],
4
- controls: {},
5
- statePersistence: {},
6
- });
7
- //# sourceMappingURL=Profile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Profile.js","sourceRoot":"","sources":["../../src/profiles/Profile.ts"],"names":[],"mappings":"AAoEA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAW,EAAE,CAAC,CAAC;IAC1D,EAAE;IACF,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,gBAAgB,EAAE,EAAE;CACrB,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { type RemoteSourceReference } from './ProfileSource.js';
2
- export declare const encodeProfileSourceUri: (uri: string) => string;
3
- export declare const encodeRemoteSource: (source: RemoteSourceReference) => string;
4
- export declare const createProfileSourceCachePath: (homeDirectory: string, uri: string) => string;
5
- export declare const createRemoteRepositoryCachePath: (homeDirectory: string, source: RemoteSourceReference) => string;
6
- export declare const resolveRemoteRepositorySubpath: (repositoryPath: string, subpath?: string) => string;
7
- export declare const redactProfileSourceUriCredentials: (uri: string) => string;
8
- export declare const normalizeGitUri: (uri: string) => string;
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProfileCache.js","sourceRoot":"","sources":["../../src/profiles/ProfileCache.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEhE,OAAO,EAAE,wBAAwB,EAA8B,MAAM,oBAAoB,CAAC;AAE1F,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAU,EAAE,CAC5D,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAA6B,EAAU,EAAE,CAC1E,sBAAs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aAAa,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAE3C,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;QAEzC,IAAI,SAAS,CAAC,QAAQ,KAAK,EAAE,IAAI,SAAS,CAAC,QAAQ,KAAK,EAAE,EAAE,CAAC;YAC3D,OAAO,GAAG,CAAC;QACb,CAAC;QAED,SAAS,CAAC,QAAQ,GAAG,UAAU,CAAC;QAChC,SAAS,CAAC,QAAQ,GAAG,EAAE,CAAC;QACxB,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;IACtD,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC"}
@@ -1,28 +0,0 @@
1
- import type { ValidationIssue } from '../validation/SchemaValidator.js';
2
- import type { Profile } from './Profile.js';
3
- import type { ProfileSourceReference } from './ProfileSource.js';
4
- export interface ProfileLoadPlan {
5
- readonly sources: readonly ProfileSourceReference[];
6
- }
7
- export type ProfileLoadIssue = ValidationIssue;
8
- export type ProfileLayout = 'directory' | 'flat-file';
9
- export interface LoadedProfile {
10
- readonly source: ProfileSourceReference;
11
- readonly folderPath: string;
12
- readonly profilePath: string;
13
- readonly profile: Profile;
14
- readonly sourceRootPath?: string;
15
- readonly resourceRootPath?: string;
16
- readonly layout?: ProfileLayout;
17
- }
18
- export interface ProfileLoadResult {
19
- readonly profiles: readonly LoadedProfile[];
20
- readonly issues: readonly ProfileLoadIssue[];
21
- }
22
- export declare const createProfileLoadPlan: (sources: readonly ProfileSourceReference[]) => ProfileLoadPlan;
23
- export declare const isValidProfileId: (profileId: string) => boolean;
24
- export declare const isProfileIncludedBySource: (profileId: string, source: ProfileSourceReference) => boolean;
25
- export declare const parseProfileDocument: (document: unknown, fallbackId: string) => Profile | ProfileLoadIssue;
26
- export declare const parseProfileYaml: (content: string, fallbackId: string) => Profile | ProfileLoadIssue;
27
- export declare const loadLocalProfileSource: (source: ProfileSourceReference) => ProfileLoadResult;
28
- export declare const readErrorMessage: (error: unknown) => string;
@@ -1,299 +0,0 @@
1
- // Loads local profile folders and parses profile.yml documents.
2
- import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- import { validateSchema } from '../validation/SchemaValidator.js';
5
- import { parseYamlDocument } from '../validation/YamlDocument.js';
6
- import { isSkillReference } from '../skills/SkillDocument.js';
7
- import { isPromptFileInclude, isPromptRepoFileInclude } from './PromptIncludes.js';
8
- const profileIdPattern = /^[a-z0-9][a-z0-9._-]*[a-z0-9]$|^[a-z0-9]$/u;
9
- const flatProfileFilePattern = /^(?<slug>.+)\.ya?ml$/u;
10
- const directoryProfileFileName = 'profile.yml';
11
- export const createProfileLoadPlan = (sources) => ({
12
- sources,
13
- });
14
- export const isValidProfileId = (profileId) => profileIdPattern.test(profileId);
15
- export const isProfileIncludedBySource = (profileId, source) => (source.only === undefined || source.only.includes(profileId)) &&
16
- (source.except === undefined || !source.except.includes(profileId));
17
- export const parseProfileDocument = (document, fallbackId) => {
18
- const record = readObject(document);
19
- if (record === undefined) {
20
- return { path: '/', message: 'Profile document must be a mapping.' };
21
- }
22
- const id = readString(record.id, fallbackId);
23
- const validationIssue = validateProfileRecord({ ...record, id });
24
- if (validationIssue !== undefined) {
25
- return validationIssue;
26
- }
27
- const statePersistence = readStatePersistence(record.state_persistence);
28
- return omitUndefined({
29
- id,
30
- label: readOptionalString(record.label),
31
- description: readOptionalString(record.description),
32
- template: readOptionalBoolean(record.template),
33
- inherits: readStringArray(record.inherits),
34
- controls: readControls(record.controls),
35
- statePersistence: Object.keys(statePersistence).length > 0 ? statePersistence : undefined,
36
- profileExport: readOptionalBoolean(record.profile_export),
37
- });
38
- };
39
- export const parseProfileYaml = (content, fallbackId) => {
40
- const parsed = parseYamlDocument(content, '/profile.yml');
41
- if (!parsed.ok) {
42
- return parsed.issue;
43
- }
44
- return parseProfileDocument(parsed.document, fallbackId);
45
- };
46
- export const loadLocalProfileSource = (source) => {
47
- if (source.path === undefined) {
48
- return {
49
- profiles: [],
50
- issues: [{ path: '<uri-source>', message: 'Only local profile sources can be loaded directly.' }],
51
- };
52
- }
53
- const sourceEntries = readProfileSourceEntries(source.path);
54
- if (!Array.isArray(sourceEntries)) {
55
- return { profiles: [], issues: [sourceEntries] };
56
- }
57
- const profiles = [];
58
- const issues = [];
59
- for (const { entryName, entryPath, entry } of sourceEntries) {
60
- if (entry.isDirectory()) {
61
- const profilePath = join(entryPath, directoryProfileFileName);
62
- if (existsSync(profilePath)) {
63
- addProfileFromPath({
64
- source,
65
- sourceRootPath: source.path,
66
- fallbackId: entryName,
67
- folderPath: entryPath,
68
- profilePath,
69
- resourceRootPath: entryPath,
70
- layout: 'directory',
71
- profiles,
72
- issues,
73
- });
74
- }
75
- continue;
76
- }
77
- if (entry.isFile()) {
78
- const fallbackId = readFlatProfileSlug(entryName);
79
- /* v8 ignore next -- flat file fallback slug rejection is covered by schema-level profile-source validation. */
80
- if (fallbackId !== undefined) {
81
- addProfileFromPath({
82
- source,
83
- sourceRootPath: source.path,
84
- fallbackId,
85
- folderPath: source.path,
86
- profilePath: entryPath,
87
- layout: 'flat-file',
88
- profiles,
89
- issues,
90
- });
91
- }
92
- }
93
- }
94
- return { profiles, issues };
95
- };
96
- const readProfileSourceEntries = (sourcePath) => {
97
- let sourceDirectory;
98
- try {
99
- sourceDirectory = existsSync(sourcePath) ? statSync(sourcePath) : undefined;
100
- }
101
- catch (error) {
102
- return { path: sourcePath, message: `Could not inspect profile source: ${String(error)}` };
103
- }
104
- if (sourceDirectory === undefined || !sourceDirectory.isDirectory()) {
105
- return { path: sourcePath, message: 'Profile source must be an existing directory.' };
106
- }
107
- try {
108
- return readdirSync(sourcePath)
109
- .sort()
110
- .map((entryName) => {
111
- const entryPath = join(sourcePath, entryName);
112
- return { entryName, entryPath, entry: statSync(entryPath) };
113
- });
114
- }
115
- catch (error) {
116
- return { path: sourcePath, message: `Could not read profile source entries: ${String(error)}` };
117
- }
118
- };
119
- const readFlatProfileSlug = (entryName) => {
120
- const match = flatProfileFilePattern.exec(entryName);
121
- if (match?.groups?.slug === undefined || match.groups.slug === 'profile') {
122
- return undefined;
123
- }
124
- return match.groups.slug;
125
- };
126
- const addProfileFromPath = (input) => {
127
- if (!isValidProfileId(input.fallbackId)) {
128
- input.issues.push({
129
- path: input.profilePath,
130
- message: `Profile slug '${input.fallbackId}' is not a filesystem-safe Outfitter profile id.`,
131
- });
132
- return;
133
- }
134
- let content;
135
- try {
136
- content = readFileSync(input.profilePath, 'utf8');
137
- }
138
- catch (error) {
139
- input.issues.push({ path: input.profilePath, message: `Could not read profile YAML: ${String(error)}` });
140
- return;
141
- }
142
- const profile = parseProfileYaml(content, input.fallbackId);
143
- if ('message' in profile) {
144
- input.issues.push({ path: `${input.profilePath}#${profile.path}`, message: profile.message });
145
- }
146
- else if (isProfileIncludedBySource(profile.id, input.source)) {
147
- input.profiles.push({
148
- source: input.source,
149
- folderPath: input.folderPath,
150
- profilePath: input.profilePath,
151
- profile,
152
- sourceRootPath: input.sourceRootPath,
153
- resourceRootPath: input.resourceRootPath,
154
- layout: input.layout,
155
- });
156
- }
157
- };
158
- const validateProfileRecord = (record) => {
159
- const validation = validateSchema('profile', record);
160
- if (validation.valid) {
161
- return undefined;
162
- }
163
- return validation.issues[0];
164
- };
165
- const readObject = (value) => {
166
- if (typeof value !== 'object' || value === null || Array.isArray(value)) {
167
- return undefined;
168
- }
169
- return value;
170
- };
171
- const readString = (value, fallback) => {
172
- if (typeof value === 'string') {
173
- return value;
174
- }
175
- return fallback;
176
- };
177
- const readOptionalString = (value) => {
178
- if (typeof value === 'string') {
179
- return value;
180
- }
181
- return undefined;
182
- };
183
- const readOptionalBoolean = (value) => {
184
- if (typeof value === 'boolean') {
185
- return value;
186
- }
187
- return undefined;
188
- };
189
- const readStringArray = (value) => {
190
- if (Array.isArray(value)) {
191
- return value.filter((item) => typeof item === 'string');
192
- }
193
- return [];
194
- };
195
- const readOptionalStringArray = (value) => {
196
- if (Array.isArray(value)) {
197
- return value.filter((item) => typeof item === 'string');
198
- }
199
- return undefined;
200
- };
201
- const isSkillSelection = (value) => {
202
- if (value === null || typeof value !== 'object' || Array.isArray(value)) {
203
- return false;
204
- }
205
- const record = value;
206
- return (typeof record.id === 'string' &&
207
- Object.keys(record).every((key) => key === 'id' || key === 'references') &&
208
- (record.references === undefined || (Array.isArray(record.references) && record.references.every(isSkillReference))));
209
- };
210
- const readOptionalSkillControlEntries = (value) => {
211
- if (!Array.isArray(value)) {
212
- return undefined;
213
- }
214
- return value.filter((item) => typeof item === 'string' || isSkillSelection(item));
215
- };
216
- const readOptionalAppendSystemPrompt = (value) => {
217
- if (typeof value === 'string' || isPromptFileInclude(value) || isPromptRepoFileInclude(value)) {
218
- return value;
219
- }
220
- if (Array.isArray(value)) {
221
- return value.filter((item) => typeof item === 'string' || isPromptFileInclude(item) || isPromptRepoFileInclude(item));
222
- }
223
- return undefined;
224
- };
225
- const readControls = (value) => {
226
- const controls = readObject(value);
227
- if (controls === undefined) {
228
- return {};
229
- }
230
- return omitUndefined({
231
- ...controls,
232
- model: readOptionalString(controls.model),
233
- provider: readOptionalString(controls.provider),
234
- thinking: readOptionalString(controls.thinking),
235
- environment: readEnvironment(controls.environment),
236
- args: readOptionalStringArray(controls.args),
237
- sessionDirectory: readOptionalString(controls.session_directory),
238
- extensions: readOptionalStringArray(controls.extensions),
239
- skills: readOptionalSkillControlEntries(controls.skills),
240
- promptTemplate: readOptionalString(controls.prompt_template),
241
- systemPrompt: readOptionalString(controls.system_prompt),
242
- appendSystemPrompt: readOptionalAppendSystemPrompt(controls.append_system_prompt),
243
- deepwork: readDeepWorkControls(controls.deepwork),
244
- pi: readAgentSpecificControls(controls.pi),
245
- claude: readAgentSpecificControls(controls.claude),
246
- });
247
- };
248
- const readDeepWorkControls = (value) => {
249
- const controls = readObject(value);
250
- if (controls === undefined) {
251
- return undefined;
252
- }
253
- return omitUndefined({
254
- ...controls,
255
- jobs: readOptionalStringArray(controls.jobs),
256
- });
257
- };
258
- const readAgentSpecificControls = (value) => {
259
- const controls = readObject(value);
260
- if (controls === undefined) {
261
- return undefined;
262
- }
263
- return omitUndefined({
264
- ...controls,
265
- model: readOptionalString(controls.model),
266
- provider: readOptionalString(controls.provider),
267
- thinking: readOptionalString(controls.thinking),
268
- environment: readEnvironment(controls.environment),
269
- args: readOptionalStringArray(controls.args),
270
- sessionDirectory: readOptionalString(controls.session_directory),
271
- extensions: readOptionalStringArray(controls.extensions),
272
- skills: readOptionalSkillControlEntries(controls.skills),
273
- promptTemplate: readOptionalString(controls.prompt_template),
274
- systemPrompt: readOptionalString(controls.system_prompt),
275
- appendSystemPrompt: readOptionalAppendSystemPrompt(controls.append_system_prompt),
276
- });
277
- };
278
- const omitUndefined = (record) => Object.fromEntries(Object.entries(record).filter((entry) => entry[1] !== undefined));
279
- const readStatePersistence = (value) => {
280
- const statePersistence = readObject(value);
281
- if (statePersistence === undefined) {
282
- return {};
283
- }
284
- return Object.fromEntries(Object.entries(statePersistence).filter((entry) => typeof entry[1] === 'string'));
285
- };
286
- const readEnvironment = (value) => {
287
- const environment = readObject(value);
288
- if (environment === undefined) {
289
- return undefined;
290
- }
291
- return Object.fromEntries(Object.entries(environment).filter((entry) => typeof entry[1] === 'string'));
292
- };
293
- export const readErrorMessage = (error) => {
294
- if (error instanceof Error) {
295
- return error.message;
296
- }
297
- return String(error);
298
- };
299
- //# sourceMappingURL=ProfileLoader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file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KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAM,CAAC;AAE5F,MAAM,oBAAoB,GAAG,CAAC,KAAc,EAA6B,EAAE;IACzE,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAE3C,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,MAAM,CACrC,CAAC,KAAK,EAAwD,EAAE,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAC9F,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,KAAc,EAAgD,EAAE;IACvF,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAEtC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAA6B,EAAE,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CACvG,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAc,EAAU,EAAE;IACzD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC,CAAC"}
@@ -1,19 +0,0 @@
1
- import type { Profile } from './Profile.js';
2
- import type { LoadedProfile } from './ProfileLoader.js';
3
- export type NonEmptyProfileStack = readonly [Profile, ...Profile[]];
4
- export interface ProfileResolutionInput {
5
- /** Profiles ordered from lowest precedence to highest precedence. */
6
- readonly profiles: readonly LoadedProfile[];
7
- readonly profileId: string;
8
- }
9
- export interface ProfileResolutionIssue {
10
- readonly path: string;
11
- readonly message: string;
12
- }
13
- export interface ProfileResolutionResult {
14
- readonly profile?: Profile;
15
- readonly profileStack: readonly Profile[];
16
- readonly issues: readonly ProfileResolutionIssue[];
17
- }
18
- export declare const mergeProfileStack: (profileStack: NonEmptyProfileStack) => Profile;
19
- export declare const resolveProfile: (input: ProfileResolutionInput) => ProfileResolutionResult;
@@ -1,112 +0,0 @@
1
- import { mergeObjectsWithPolicy } from '../merge/SettingsValueMerger.js';
2
- import { normalizeExtensionResourceIdentity } from '../agents/ResourceIdentity.js';
3
- import { skillControlEntryIdentity } from '../agents/LaunchResources.js';
4
- export const mergeProfileStack = (profileStack) => {
5
- const [baseProfile, ...higherPrecedenceProfiles] = profileStack;
6
- const mergedProfile = higherPrecedenceProfiles.reduce((mergedProfile, profile) => mergeObjectsWithPolicy(mergedProfile, profile, { arrayPolicyForPath: profileArrayPolicy }), baseProfile);
7
- return withProfileTemplateFromTopProfile(mergedProfile, profileStack[profileStack.length - 1]);
8
- };
9
- const withProfileTemplateFromTopProfile = (profile, topProfile) => {
10
- if (topProfile.template === true) {
11
- return { ...profile, template: true };
12
- }
13
- return Object.fromEntries(Object.entries(profile).filter(([key]) => key !== 'template'));
14
- };
15
- const profileArrayPolicy = (path) => {
16
- const pathKey = path.join('.');
17
- if (pathKey === 'inherits') {
18
- return 'replace';
19
- }
20
- if (['controls.args', 'controls.pi.args', 'controls.claude.args'].includes(pathKey)) {
21
- return 'prepend';
22
- }
23
- if (isAppendSystemPromptPath(pathKey)) {
24
- return 'prependList';
25
- }
26
- if (pathKey === 'controls.deepwork.jobs') {
27
- return 'appendUnique';
28
- }
29
- if (['controls.extensions', 'controls.pi.extensions', 'controls.claude.extensions'].includes(pathKey)) {
30
- return {
31
- mode: 'uniqueBy',
32
- order: 'prepend',
33
- winner: 'first',
34
- key: (source) => normalizeExtensionResourceIdentity(String(source)),
35
- };
36
- }
37
- if (['controls.skills', 'controls.pi.skills', 'controls.claude.skills'].includes(pathKey)) {
38
- return {
39
- mode: 'uniqueBy',
40
- order: 'prepend',
41
- winner: 'first',
42
- key: (source) => skillControlEntryIdentity(source),
43
- };
44
- }
45
- return undefined;
46
- };
47
- const isAppendSystemPromptPath = (pathKey) => [
48
- 'controls.appendSystemPrompt',
49
- 'controls.append_system_prompt',
50
- 'controls.pi.appendSystemPrompt',
51
- 'controls.pi.append_system_prompt',
52
- 'controls.claude.appendSystemPrompt',
53
- 'controls.claude.append_system_prompt',
54
- ].includes(pathKey);
55
- export const resolveProfile = (input) => {
56
- const definitions = createProfileDefinitions(input.profiles);
57
- const issues = [];
58
- const profileStack = uniqueProfileStack(resolveProfileStack(input.profileId, definitions, [], issues));
59
- return {
60
- profile: issues.length === 0 && profileStack.length > 0
61
- ? mergeProfileStack(profileStack)
62
- : undefined,
63
- profileStack,
64
- issues,
65
- };
66
- };
67
- const createProfileDefinitions = (profiles) => {
68
- const groupedProfiles = new Map();
69
- for (const loadedProfile of profiles) {
70
- const profileStack = groupedProfiles.get(loadedProfile.profile.id);
71
- groupedProfiles.set(loadedProfile.profile.id, profileStack === undefined ? [loadedProfile.profile] : [...profileStack, loadedProfile.profile]);
72
- }
73
- return new Map([...groupedProfiles.entries()].map(([profileId, profileStack]) => [
74
- profileId,
75
- mergeSameIdProfileDefinitions(profileStack),
76
- ]));
77
- };
78
- const mergeSameIdProfileDefinitions = (profileStack) => {
79
- const highestPrecedenceProfile = profileStack[profileStack.length - 1];
80
- return {
81
- ...mergeProfileStack(profileStack),
82
- inherits: highestPrecedenceProfile.inherits,
83
- };
84
- };
85
- const resolveProfileStack = (profileId, definitions, ancestry, issues) => {
86
- if (ancestry.includes(profileId)) {
87
- issues.push({
88
- path: `/profiles/${profileId}/inherits`,
89
- message: `Profile inheritance cycle detected: ${[...ancestry, profileId].join(' -> ')}`,
90
- });
91
- return [];
92
- }
93
- const profile = definitions.get(profileId);
94
- if (profile === undefined) {
95
- issues.push({ path: `/profiles/${profileId}`, message: `Profile '${profileId}' was not found.` });
96
- return [];
97
- }
98
- const inheritedProfiles = profile.inherits.flatMap((inheritedProfileId) => resolveProfileStack(inheritedProfileId, definitions, [...ancestry, profileId], issues));
99
- return uniqueProfileStack([...inheritedProfiles, profile]);
100
- };
101
- const uniqueProfileStack = (profileStack) => {
102
- const profilesById = new Set();
103
- const uniqueProfiles = [];
104
- for (const profile of profileStack) {
105
- if (!profilesById.has(profile.id)) {
106
- profilesById.add(profile.id);
107
- uniqueProfiles.push(profile);
108
- }
109
- }
110
- return uniqueProfiles;
111
- };
112
- //# sourceMappingURL=ProfileMerger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProfileMerger.js","sourceRoot":"","sources":["../../src/profiles/ProfileMerger.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,kCAAkC,EAAE,MAAM,+BAA+B,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAuBzE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAAkC,EAAW,EAAE;IAC/E,MAAM,CAAC,WAAW,EAAE,GAAG,wBAAwB,CAAC,GAAG,YAAY,CAAC;IAChE,MAAM,aAAa,GAAG,wBAAwB,CAAC,MAAM,CACnD,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE,CACzB,sBAAsB,CAAC,aAAa,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC,EAC5F,WAAW,CACZ,CAAC;IAEF,OAAO,iCAAiC,CAAC,aAAa,EAAE,YAAY,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AACjG,CAAC,CAAC;AAEF,MAAM,iCAAiC,GAAG,CAAC,OAAgB,EAAE,UAAmB,EAAW,EAAE;IAC3F,IAAI,UAAU,CAAC,QAAQ,KAAK,IAAI,EAAE,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