@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,35 +0,0 @@
1
- interface ProfileSourceFilters {
2
- readonly only?: readonly string[];
3
- readonly except?: readonly string[];
4
- }
5
- export type RemoteSourceReference = {
6
- readonly uri: string;
7
- readonly github?: never;
8
- readonly ref?: string;
9
- readonly path?: string;
10
- } | {
11
- readonly github: string;
12
- readonly uri?: never;
13
- readonly ref?: string;
14
- readonly path?: string;
15
- };
16
- export type ProfileSourceReference = (ProfileSourceFilters & {
17
- readonly path: string;
18
- readonly uri?: never;
19
- readonly github?: never;
20
- readonly ref?: never;
21
- }) | (ProfileSourceFilters & {
22
- readonly uri: string;
23
- readonly github?: never;
24
- readonly ref?: string;
25
- readonly path?: string;
26
- }) | (ProfileSourceFilters & {
27
- readonly github: string;
28
- readonly uri?: never;
29
- readonly ref?: string;
30
- readonly path?: string;
31
- });
32
- export declare const createLocalProfileSource: (path: string) => ProfileSourceReference;
33
- export declare const createUriProfileSource: (uri: string) => ProfileSourceReference;
34
- export declare const normalizeRemoteSourceUri: (source: RemoteSourceReference) => string;
35
- export {};
@@ -1,13 +0,0 @@
1
- export const createLocalProfileSource = (path) => ({
2
- path,
3
- });
4
- export const createUriProfileSource = (uri) => ({
5
- uri,
6
- });
7
- export const normalizeRemoteSourceUri = (source) => {
8
- if (source.uri !== undefined) {
9
- return source.uri;
10
- }
11
- return `git+https://github.com/${source.github}.git`;
12
- };
13
- //# sourceMappingURL=ProfileSource.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProfileSource.js","sourceRoot":"","sources":["../../src/profiles/ProfileSource.ts"],"names":[],"mappings":"AA8BA,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAA0B,EAAE,CAAC,CAAC;IACjF,IAAI;CACL,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAA0B,EAAE,CAAC,CAAC;IAC9E,GAAG;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,MAA6B,EAAU,EAAE;IAChF,IAAI,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC,GAAG,CAAC;IACpB,CAAC;IAED,OAAO,0BAA0B,MAAM,CAAC,MAAM,MAAM,CAAC;AACvD,CAAC,CAAC"}
@@ -1,32 +0,0 @@
1
- import type { AgentLaunchProfileLayer } from '../agents/AgentAdapter.js';
2
- import type { AppendSystemPromptControl, AppendSystemPromptEntry } from './Profile.js';
3
- import type { LoadedProfile } from './ProfileLoader.js';
4
- export interface PromptIncludeDiagnostic {
5
- readonly severity: 'error' | 'warning';
6
- readonly profileId: string;
7
- readonly path: string;
8
- readonly message: string;
9
- }
10
- export interface ResolvedAppendPromptResult {
11
- readonly prompts: readonly string[];
12
- readonly diagnostics: readonly PromptIncludeDiagnostic[];
13
- }
14
- export declare const isPromptFileInclude: (value: unknown) => value is {
15
- readonly file: string;
16
- };
17
- export declare const isPromptRepoFileInclude: (value: unknown) => value is {
18
- readonly repo_file: string;
19
- };
20
- export declare const normalizeAppendSystemPromptEntries: (value: AppendSystemPromptControl | undefined) => readonly AppendSystemPromptEntry[] | undefined;
21
- export declare const inferProfileIncludeSourceRoot: (input: {
22
- readonly sourceRootPath?: string;
23
- readonly profilePath: string;
24
- }) => string | undefined;
25
- export declare const resolveAppendSystemPromptControl: (input: {
26
- readonly fallback: AppendSystemPromptControl | undefined;
27
- readonly profileLayers?: readonly AgentLaunchProfileLayer[];
28
- readonly agentKey?: "pi" | "claude";
29
- readonly projectDirectory?: string;
30
- }) => ResolvedAppendPromptResult;
31
- export declare const createPromptIncludeDiagnostics: (profileLayers: readonly LoadedProfile[], projectDirectory?: string) => readonly PromptIncludeDiagnostic[];
32
- export declare const looksLikePromptFilePath: (value: string) => boolean;
@@ -1,147 +0,0 @@
1
- // Resolves typed append-system-prompt file includes against declaring profile source roots.
2
- import { existsSync, readFileSync } from 'node:fs';
3
- import { homedir } from 'node:os';
4
- import { basename, dirname, isAbsolute, join, normalize, resolve } from 'node:path';
5
- export const isPromptFileInclude = (value) => value !== null &&
6
- typeof value === 'object' &&
7
- !Array.isArray(value) &&
8
- Object.keys(value).length === 1 &&
9
- typeof value.file === 'string';
10
- export const isPromptRepoFileInclude = (value) => value !== null &&
11
- typeof value === 'object' &&
12
- !Array.isArray(value) &&
13
- Object.keys(value).length === 1 &&
14
- typeof value.repo_file === 'string';
15
- export const normalizeAppendSystemPromptEntries = (value) => {
16
- if (value === undefined) {
17
- return undefined;
18
- }
19
- return typeof value === 'string' || isPromptFileInclude(value) || isPromptRepoFileInclude(value) ? [value] : value;
20
- };
21
- export const inferProfileIncludeSourceRoot = (input) => {
22
- const conventionalRoot = findConventionalOutfitterRoot(input.profilePath);
23
- return conventionalRoot ?? input.sourceRootPath;
24
- };
25
- export const resolveAppendSystemPromptControl = (input) => {
26
- const layeredEntries = collectLayeredPromptEntries(input.profileLayers ?? [], input.agentKey);
27
- if (layeredEntries.length === 0) {
28
- return resolvePromptEntries({
29
- entries: normalizeAppendSystemPromptEntries(input.fallback) ?? [],
30
- projectDirectory: input.projectDirectory,
31
- });
32
- }
33
- const diagnostics = [];
34
- const prompts = [];
35
- for (const entry of layeredEntries) {
36
- const resolved = resolvePromptEntries({
37
- entries: [entry.value],
38
- layer: entry.layer,
39
- projectDirectory: input.projectDirectory,
40
- });
41
- diagnostics.push(...resolved.diagnostics);
42
- prompts.push(...resolved.prompts);
43
- }
44
- return { prompts, diagnostics };
45
- };
46
- export const createPromptIncludeDiagnostics = (profileLayers, projectDirectory) => profileLayers.flatMap((layer) => {
47
- const launchLayer = toLaunchLayer(layer);
48
- return [
49
- ...resolvePromptEntries({
50
- entries: readPromptEntries(layer.profile.controls.appendSystemPrompt),
51
- layer: launchLayer,
52
- projectDirectory,
53
- }).diagnostics,
54
- ...resolvePromptEntries({
55
- entries: readPromptEntries(layer.profile.controls.pi?.appendSystemPrompt),
56
- layer: launchLayer,
57
- projectDirectory,
58
- }).diagnostics,
59
- ...resolvePromptEntries({
60
- entries: readPromptEntries(layer.profile.controls.claude?.appendSystemPrompt),
61
- layer: launchLayer,
62
- projectDirectory,
63
- }).diagnostics,
64
- ];
65
- });
66
- const collectLayeredPromptEntries = (profileLayers, agentKey) => [...profileLayers]
67
- .reverse()
68
- .flatMap((layer) => readPromptEntries(selectLayerAppendPrompt(layer, agentKey)).map((value) => ({ layer, value })));
69
- const selectLayerAppendPrompt = (layer, agentKey) => {
70
- const agentPrompt = agentKey === undefined ? undefined : layer.profile.controls[agentKey]?.appendSystemPrompt;
71
- return agentPrompt ?? layer.profile.controls.appendSystemPrompt;
72
- };
73
- const resolvePromptEntries = (input) => {
74
- const diagnostics = [];
75
- const prompts = [];
76
- for (const [index, entry] of input.entries.entries()) {
77
- if (isPromptFileInclude(entry) || isPromptRepoFileInclude(entry)) {
78
- const declaredFile = isPromptFileInclude(entry) ? entry.file : entry.repo_file;
79
- const resolvedFile = isPromptFileInclude(entry)
80
- ? resolvePromptIncludePath(input.layer, declaredFile)
81
- : resolveRepoPromptIncludePath(input.projectDirectory, declaredFile);
82
- const includeType = isPromptFileInclude(entry) ? 'file' : 'repo_file';
83
- if (resolvedFile === undefined || !existsSync(resolvedFile)) {
84
- diagnostics.push(createDiagnostic(input.layer, index, `Prompt ${includeType} include '${declaredFile}' was not found.`));
85
- }
86
- else {
87
- prompts.push(readFileSync(resolvedFile, 'utf8'));
88
- }
89
- }
90
- else {
91
- if (looksLikePromptFilePath(entry)) {
92
- diagnostics.push(createDiagnostic(input.layer, index, `Raw append_system_prompt entry looks like a file path; use { file: '${entry}' }.`));
93
- }
94
- prompts.push(entry);
95
- }
96
- }
97
- return { prompts, diagnostics };
98
- };
99
- const readPromptEntries = (value) => normalizeAppendSystemPromptEntries(value) ?? [];
100
- const resolvePromptIncludePath = (layer, filePath) => {
101
- if (isAbsolute(filePath)) {
102
- return normalize(filePath);
103
- }
104
- const sourceRoot = layer?.sourceRootPath === undefined ? undefined : inferProfileIncludeSourceRoot(layer);
105
- return sourceRoot === undefined ? undefined : resolve(sourceRoot, filePath);
106
- };
107
- const resolveRepoPromptIncludePath = (projectDirectory, filePath) => {
108
- if (isAbsolute(filePath)) {
109
- return normalize(filePath);
110
- }
111
- return projectDirectory === undefined ? undefined : resolve(projectDirectory, filePath);
112
- };
113
- const createDiagnostic = (layer, index, message) => ({
114
- severity: 'warning',
115
- profileId: layer?.profile.id ?? '<merged>',
116
- path: `${layer?.profilePath ?? '<profile>'}#/controls/append_system_prompt/${index}`,
117
- message,
118
- });
119
- export const looksLikePromptFilePath = (value) => {
120
- const trimmed = value.trim();
121
- if (trimmed.includes('\n') || trimmed.includes(' ')) {
122
- return false;
123
- }
124
- return /^(\.?\.?\/|~\/).+/u.test(trimmed) || /.+\/.+\.(md|markdown|txt|prompt)$/iu.test(trimmed);
125
- };
126
- const findConventionalOutfitterRoot = (profilePath) => {
127
- let current = dirname(profilePath);
128
- while (current !== dirname(current)) {
129
- const name = basename(current);
130
- if (name === '.outfitter') {
131
- return normalize(current) === normalize(join(homedir(), '.outfitter')) ? current : dirname(current);
132
- }
133
- if (name === 'outfitter') {
134
- return dirname(current);
135
- }
136
- current = dirname(current);
137
- }
138
- return undefined;
139
- };
140
- const toLaunchLayer = (loadedProfile) => ({
141
- profile: loadedProfile.profile,
142
- profilePath: loadedProfile.profilePath,
143
- sourceRootPath: loadedProfile.sourceRootPath,
144
- resourceRootPath: loadedProfile.resourceRootPath,
145
- layout: loadedProfile.layout,
146
- });
147
- //# sourceMappingURL=PromptIncludes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PromptIncludes.js","sourceRoot":"","sources":["../../src/profiles/PromptIncludes.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAc,EAAsC,EAAE,CACxF,KAAK,KAAK,IAA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AAoB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,qCAAqC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnG,CAAC,CAAC;AAEF,MAAM,6BAA6B,GAAG,CAAC,WAAmB,EAAsB,EAAE;IAChF,IAAI,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QAE/B,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACtG,CAAC;QAED,IAAI,IAAI,KAAK,WAAW,EAAE,CAAC;YACzB,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;QAED,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CAAC,aAA4B,EAA2B,EAAE,CAAC,CAAC;IAChF,OAAO,EAAE,aAAa,CAAC,OAAO;IAC9B,WAAW,EAAE,aAAa,CAAC,WAAW;IACtC,cAAc,EAAE,aAAa,CAAC,cAAc;IAC5C,gBAAgB,EAAE,aAAa,CAAC,gBAAgB;IAChD,MAAM,EAAE,aAAa,CAAC,MAAM;CAC7B,CAAC,CAAC"}
@@ -1,16 +0,0 @@
1
- import type { Profile } from '../profiles/Profile.js';
2
- import type { LoadedProfile } from '../profiles/ProfileLoader.js';
3
- import type { Settings } from '../settings/Settings.js';
4
- export interface SystemPromptExportInput {
5
- readonly profile: Profile;
6
- readonly settings: Settings;
7
- readonly profileLayers: readonly LoadedProfile[];
8
- readonly cacheDirectory: string;
9
- readonly warn: (message: string) => void;
10
- }
11
- export interface SystemPromptExportResult {
12
- readonly outputPath?: string;
13
- }
14
- export declare const exportSystemPromptIfEnabled: (input: SystemPromptExportInput) => SystemPromptExportResult;
15
- export declare const isSystemPromptExportEnabled: (profile: Profile, settings: Settings) => boolean;
16
- export declare const renderGeneratedSystemPrompt: (profile: Profile) => string;
@@ -1,81 +0,0 @@
1
- // Prepares opt-in generated Pi system prompt snapshots next to the selected profile.
2
- import { mkdirSync, writeFileSync } from 'node:fs';
3
- import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
4
- import { mergeAgentSpecificControls } from '../agents/AdapterProfileControls.js';
5
- import { normalizeAppendSystemPromptEntries } from '../profiles/PromptIncludes.js';
6
- /* v8 ignore start -- rare skip/error branches are defensive around external profile ownership; main export behavior is unit covered. */
7
- export const exportSystemPromptIfEnabled = (input) => {
8
- if (!isSystemPromptExportEnabled(input.profile, input.settings)) {
9
- return {};
10
- }
11
- const owner = findSelectedProfileOwner(input.profile, input.profileLayers);
12
- if (owner === undefined) {
13
- input.warn(`System prompt export skipped for profile '${input.profile.id}' because no source profile was found.`);
14
- return {};
15
- }
16
- if (isCacheBackedProfile(owner, input.cacheDirectory)) {
17
- input.warn(`System prompt export skipped for profile '${input.profile.id}' because its source is cache-backed. ` +
18
- 'Copy or symlink the profile into a local profile source to export generated prompts.');
19
- return {};
20
- }
21
- const outputPath = resolveSystemPromptExportPath(input.profile, owner);
22
- mkdirSync(dirname(outputPath), { recursive: true });
23
- writeFileSync(outputPath, renderGeneratedSystemPrompt(input.profile));
24
- return { outputPath };
25
- };
26
- /* v8 ignore stop */
27
- /* v8 ignore next -- fallback precedence is schema-level behavior; enabled/disabled outcomes are covered. */
28
- export const isSystemPromptExportEnabled = (profile, settings) => profile.profileExport ?? settings.profileExport ?? false;
29
- export const renderGeneratedSystemPrompt = (profile) => {
30
- const controls = mergeAgentSpecificControls(profile.controls, 'pi');
31
- const appendPrompts = normalizeAppendSystemPrompt(controls.appendSystemPrompt);
32
- return [
33
- '<!-- Generated by Outfitter before Pi runtime capture. The Pi launch extension overwrites this with ctx.getSystemPrompt(). -->',
34
- '# Generated Pi prompt fallback',
35
- '',
36
- `Profile: ${profile.id}`,
37
- 'Prompt source: Pi launch controls',
38
- '',
39
- '## system_prompt',
40
- '',
41
- controls.systemPrompt ?? '(none)',
42
- '',
43
- ...appendPrompts.flatMap((prompt, index) => [`## append_system_prompt[${index}]`, '', prompt, '']),
44
- ...(appendPrompts.length === 0 ? ['## append_system_prompt', '', '(none)', ''] : []),
45
- ].join('\n');
46
- };
47
- const normalizeAppendSystemPrompt = (value) => {
48
- if (value === undefined) {
49
- return [];
50
- }
51
- return (normalizeAppendSystemPromptEntries(value) ?? []).filter((entry) => typeof entry === 'string');
52
- };
53
- const findSelectedProfileOwner = (profile, profileLayers) => profileLayers.filter((layer) => layer.profile.id === profile.id).at(-1);
54
- const resolveSystemPromptExportPath = (profile, owner) => {
55
- const root = owner.resourceRootPath ?? dirname(owner.profilePath);
56
- const outputPath = owner.layout === 'flat-file'
57
- ? join(root, `${profile.id}.generated-system-prompt.md`)
58
- : join(root, 'generated-system-prompt.md');
59
- return assertInsideRoot(root, outputPath);
60
- };
61
- /* v8 ignore start -- path escape protection is defensive; normal generated output path behavior is unit covered. */
62
- const assertInsideRoot = (root, path) => {
63
- const resolvedRoot = resolve(root);
64
- const resolvedPath = resolve(path);
65
- const relativePath = relative(resolvedRoot, resolvedPath);
66
- if (relativePath === '' || !isRelativePathInsideRoot(relativePath)) {
67
- throw new Error(`System prompt export path '${resolvedPath}' must stay inside profile root '${resolvedRoot}'.`);
68
- }
69
- return resolvedPath;
70
- };
71
- const isRelativePathInsideRoot = (relativePath) => relativePath !== '..' && !relativePath.startsWith(`..${sep}`) && !isAbsolute(relativePath);
72
- /* v8 ignore stop */
73
- const isCacheBackedProfile = (owner, cacheDirectory) => {
74
- /* v8 ignore next -- remote-source ownership is a defensive skip path for generated prompt export. */
75
- if (owner.source.uri !== undefined || owner.source.github !== undefined) {
76
- return true;
77
- }
78
- const relativePath = relative(resolve(cacheDirectory), resolve(owner.profilePath));
79
- return relativePath !== '' && isRelativePathInsideRoot(relativePath);
80
- };
81
- //# sourceMappingURL=SystemPromptExport.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SystemPromptExport.js","sourceRoot":"","sources":["../../src/prompts/SystemPromptExport.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,OAAO,EAAE,kCAAkC,EAAE,MAAM,+BAA+B,CAAC;AAgBnF,wIAAwI;AACxI,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,KAA8B,EAA4B,EAAE;IACtG,IAAI,CAAC,2BAA2B,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,KAAK,GAAG,wBAAwB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAE3E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,6CAA6C,KAAK,CAAC,OAAO,CAAC,EAAE,wCAAwC,CAAC,CAAC;QAClH,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC;QACtD,KAAK,CAAC,IAAI,CACR,6CAA6C,KAAK,CAAC,OAAO,CAAC,EAAE,wCAAwC;YACnG,sFAAsF,CACzF,CAAC;QACF,OAAO,EAAE,CA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E,YAAY,CAAC,CAAC;IAE1D,IAAI,YAAY,KAAK,EAAE,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC,EAAE,CAAC;QACnE,MAAM,IAAI,KAAK,CAAC,8BAA8B,YAAY,oCAAoC,YAAY,IAAI,CAAC,CAAC;IAClH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,YAAoB,EAAW,EAAE,CACjE,YAAY,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAE7F,oBAAoB;AACpB,MAAM,oBAAoB,GAAG,CAAC,KAAoB,EAAE,cAAsB,EAAW,EAAE;IACrF,qGAAqG;IACrG,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACnF,OAAO,YAAY,KAAK,EAAE,IAAI,wBAAwB,CAAC,YAAY,CAAC,CAAC;AACvE,CAAC,CAAC"}
@@ -1,29 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://outfitter.dev/schemas/profile-source.schema.json",
4
- "title": "Outfitter profile source",
5
- "type": "object",
6
- "oneOf": [
7
- {
8
- "required": ["path"],
9
- "not": { "anyOf": [{ "required": ["uri"] }, { "required": ["github"] }, { "required": ["ref"] }] }
10
- },
11
- { "required": ["uri"], "not": { "required": ["github"] } },
12
- { "required": ["github"], "not": { "required": ["uri"] } }
13
- ],
14
- "properties": {
15
- "path": { "type": "string", "minLength": 1 },
16
- "uri": { "type": "string", "minLength": 1 },
17
- "github": { "type": "string", "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$" },
18
- "ref": { "type": "string", "minLength": 1 },
19
- "only": {
20
- "type": "array",
21
- "items": { "type": "string", "minLength": 1 }
22
- },
23
- "except": {
24
- "type": "array",
25
- "items": { "type": "string", "minLength": 1 }
26
- }
27
- },
28
- "additionalProperties": false
29
- }
@@ -1,200 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://outfitter.dev/schemas/profile.schema.json",
4
- "title": "Outfitter profile",
5
- "type": "object",
6
- "properties": {
7
- "id": {
8
- "type": "string",
9
- "pattern": "^[a-z0-9][a-z0-9._-]*[a-z0-9]$|^[a-z0-9]$"
10
- },
11
- "label": { "type": "string" },
12
- "description": { "type": "string" },
13
- "template": { "type": "boolean" },
14
- "inherits": {
15
- "type": "array",
16
- "items": {
17
- "type": "string",
18
- "pattern": "^[a-z0-9][a-z0-9._-]*[a-z0-9]$|^[a-z0-9]$"
19
- }
20
- },
21
- "profile_export": { "type": "boolean" },
22
- "state_persistence": {
23
- "type": "object",
24
- "additionalProperties": {
25
- "enum": ["symlink", "discard", "warn", "error", "prompt"]
26
- }
27
- },
28
- "controls": {
29
- "type": "object",
30
- "properties": {
31
- "model": { "type": "string" },
32
- "provider": { "type": "string" },
33
- "thinking": { "type": "string" },
34
- "args": {
35
- "type": "array",
36
- "items": { "type": "string" }
37
- },
38
- "session_directory": { "type": "string" },
39
- "extensions": {
40
- "type": "array",
41
- "items": { "type": "string" }
42
- },
43
- "skills": {
44
- "type": "array",
45
- "items": { "$ref": "#/$defs/skillEntry" }
46
- },
47
- "prompt_template": { "type": "string" },
48
- "system_prompt": { "type": "string" },
49
- "append_system_prompt": { "$ref": "#/$defs/appendSystemPrompt" },
50
- "environment": {
51
- "type": "object",
52
- "additionalProperties": { "type": "string" }
53
- },
54
- "deepwork": {
55
- "type": "object",
56
- "properties": {
57
- "jobs": {
58
- "type": "array",
59
- "items": {
60
- "type": "string",
61
- "pattern": "^[a-z][a-z0-9_]*$"
62
- }
63
- }
64
- },
65
- "additionalProperties": true
66
- },
67
- "pi": {
68
- "type": "object",
69
- "properties": {
70
- "model": { "type": "string" },
71
- "provider": { "type": "string" },
72
- "thinking": { "type": "string" },
73
- "args": {
74
- "type": "array",
75
- "items": { "type": "string" }
76
- },
77
- "session_directory": { "type": "string" },
78
- "extensions": {
79
- "type": "array",
80
- "items": { "type": "string" }
81
- },
82
- "skills": {
83
- "type": "array",
84
- "items": { "$ref": "#/$defs/skillEntry" }
85
- },
86
- "prompt_template": { "type": "string" },
87
- "system_prompt": { "type": "string" },
88
- "append_system_prompt": { "$ref": "#/$defs/appendSystemPrompt" },
89
- "allow_external_deepwork_jobs": { "type": "boolean" },
90
- "environment": {
91
- "type": "object",
92
- "additionalProperties": { "type": "string" }
93
- }
94
- },
95
- "additionalProperties": true
96
- },
97
- "claude": {
98
- "type": "object",
99
- "properties": {
100
- "model": { "type": "string" },
101
- "provider": { "type": "string" },
102
- "thinking": { "type": "string" },
103
- "args": {
104
- "type": "array",
105
- "items": { "type": "string" }
106
- },
107
- "session_directory": { "type": "string" },
108
- "extensions": {
109
- "type": "array",
110
- "items": { "type": "string" }
111
- },
112
- "skills": {
113
- "type": "array",
114
- "items": { "$ref": "#/$defs/skillEntry" }
115
- },
116
- "prompt_template": { "type": "string" },
117
- "system_prompt": { "type": "string" },
118
- "append_system_prompt": { "$ref": "#/$defs/appendSystemPrompt" },
119
- "environment": {
120
- "type": "object",
121
- "additionalProperties": { "type": "string" }
122
- }
123
- },
124
- "additionalProperties": true
125
- }
126
- },
127
- "additionalProperties": true
128
- }
129
- },
130
- "additionalProperties": true,
131
- "$defs": {
132
- "skillReference": {
133
- "oneOf": [
134
- {
135
- "type": "object",
136
- "required": ["file"],
137
- "properties": {
138
- "file": { "type": "string" }
139
- },
140
- "additionalProperties": false
141
- },
142
- {
143
- "type": "object",
144
- "required": ["repo_file"],
145
- "properties": {
146
- "repo_file": { "type": "string" }
147
- },
148
- "additionalProperties": false
149
- }
150
- ]
151
- },
152
- "skillEntry": {
153
- "oneOf": [
154
- { "type": "string" },
155
- {
156
- "type": "object",
157
- "required": ["id"],
158
- "properties": {
159
- "id": { "type": "string" },
160
- "references": {
161
- "type": "array",
162
- "items": { "$ref": "#/$defs/skillReference" }
163
- }
164
- },
165
- "additionalProperties": false
166
- }
167
- ]
168
- },
169
- "appendSystemPromptEntry": {
170
- "oneOf": [
171
- { "type": "string" },
172
- {
173
- "type": "object",
174
- "required": ["file"],
175
- "properties": {
176
- "file": { "type": "string" }
177
- },
178
- "additionalProperties": false
179
- },
180
- {
181
- "type": "object",
182
- "required": ["repo_file"],
183
- "properties": {
184
- "repo_file": { "type": "string" }
185
- },
186
- "additionalProperties": false
187
- }
188
- ]
189
- },
190
- "appendSystemPrompt": {
191
- "oneOf": [
192
- { "$ref": "#/$defs/appendSystemPromptEntry" },
193
- {
194
- "type": "array",
195
- "items": { "$ref": "#/$defs/appendSystemPromptEntry" }
196
- }
197
- ]
198
- }
199
- }
200
- }
@@ -1,21 +0,0 @@
1
- import type { LoadedProfile } from '../profiles/ProfileLoader.js';
2
- import type { Profile } from '../profiles/Profile.js';
3
- import { type SkillResolutionDiagnostic } from './SkillResolution.js';
4
- export interface ProfileSkillResolutionInput {
5
- readonly profile: Profile;
6
- readonly profileLayers: readonly LoadedProfile[];
7
- /** Materialized configured profile-source paths, in configured order. */
8
- readonly sourcePaths: readonly string[];
9
- readonly projectDirectory: string;
10
- /** Composite profile root; generated skills are written beneath `outfitter/skills/`. */
11
- readonly outputDirectory?: string;
12
- }
13
- export interface ProfileSkillResolutionResult {
14
- readonly profile: Profile;
15
- readonly diagnostics: readonly SkillResolutionDiagnostic[];
16
- }
17
- /**
18
- * Resolves catalog skill IDs in `controls.skills` (generic and adapter-scoped) to
19
- * generated skill directories, so adapters keep receiving plain path sources.
20
- */
21
- export declare const resolveProfileSkillControls: (input: ProfileSkillResolutionInput) => ProfileSkillResolutionResult;