@ai-outfitter/outfitter 0.6.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +20 -50
- package/README.md +41 -280
- package/code/enterprise/LICENSE +35 -0
- package/code/enterprise/README.md +7 -0
- package/code/enterprise/cli/privateCatalogGate.cjs +134 -0
- package/code/enterprise/cli/privateCatalogSettings.cjs +59 -0
- package/code/enterprise/pi-extension/privateCatalogOnboarding.js +89 -0
- package/code/enterprise/private-catalog-boundary.json +9 -0
- package/code/enterprise/privateCatalog.js +24 -0
- package/code/enterprise/shared/privateCatalogPolicy.cjs +66 -0
- package/dist/agents/AdapterProfileControls.d.ts +2 -2
- package/dist/agents/AdapterProfileControls.js +8 -1
- package/dist/agents/AdapterProfileControls.js.map +1 -1
- package/dist/agents/AgentAdapter.d.ts +11 -0
- package/dist/agents/AgentLaunch.d.ts +6 -0
- package/dist/agents/AgentLaunch.js +89 -0
- package/dist/agents/AgentLaunch.js.map +1 -0
- package/dist/agents/claude/ClaudeAdapter.js +18 -3
- package/dist/agents/claude/ClaudeAdapter.js.map +1 -1
- package/dist/agents/pi/PiAdapter.js +162 -33
- package/dist/agents/pi/PiAdapter.js.map +1 -1
- package/dist/agents/pi/PiArgs.d.ts +2 -0
- package/dist/agents/pi/PiArgs.js +15 -0
- package/dist/agents/pi/PiArgs.js.map +1 -0
- package/dist/agents/pi/PiExtensionCache.d.ts +4 -0
- package/dist/agents/pi/PiExtensionCache.js +105 -0
- package/dist/agents/pi/PiExtensionCache.js.map +1 -0
- package/dist/cli/commands/PiLoginLaunch.d.ts +9 -2
- package/dist/cli/commands/PiLoginLaunch.js +817 -75
- package/dist/cli/commands/PiLoginLaunch.js.map +1 -1
- package/dist/cli/commands/RunCommand.d.ts +22 -3
- package/dist/cli/commands/RunCommand.js +104 -20
- package/dist/cli/commands/RunCommand.js.map +1 -1
- package/dist/cli/commands/SetupCommand.d.ts +19 -2
- package/dist/cli/commands/SetupCommand.js +281 -57
- package/dist/cli/commands/SetupCommand.js.map +1 -1
- package/dist/cli/commands/SyncCommand.d.ts +19 -1
- package/dist/cli/commands/SyncCommand.js +47 -6
- package/dist/cli/commands/SyncCommand.js.map +1 -1
- package/dist/cli/commands/WelcomeCommand.js +1 -1
- package/dist/cli/commands/WelcomeCommand.js.map +1 -1
- package/dist/cli/commands/assets/outfitter-ascii.txt +5 -0
- package/dist/cli/commands/profile/Command.d.ts +1 -0
- package/dist/cli/commands/profile/Command.js +3 -0
- package/dist/cli/commands/profile/Command.js.map +1 -1
- package/dist/cli/commands/profile/LintCommand.d.ts +19 -0
- package/dist/cli/commands/profile/LintCommand.js +123 -0
- package/dist/cli/commands/profile/LintCommand.js.map +1 -0
- package/dist/cli.js +8 -2
- package/dist/cli.js.map +1 -1
- package/dist/merge/ArrayMergePolicy.js.map +1 -1
- package/dist/merge/SettingsValueMerger.js.map +1 -1
- package/dist/profiles/Profile.d.ts +13 -1
- package/dist/profiles/Profile.js.map +1 -1
- package/dist/profiles/ProfileLoader.d.ts +4 -0
- package/dist/profiles/ProfileLoader.js +117 -17
- package/dist/profiles/ProfileLoader.js.map +1 -1
- package/dist/profiles/ProfileMerger.js +3 -0
- package/dist/profiles/ProfileMerger.js.map +1 -1
- package/dist/profiles/PromptIncludes.d.ts +32 -0
- package/dist/profiles/PromptIncludes.js +147 -0
- package/dist/profiles/PromptIncludes.js.map +1 -0
- package/dist/prompts/SystemPromptExport.d.ts +16 -0
- package/dist/prompts/SystemPromptExport.js +81 -0
- package/dist/prompts/SystemPromptExport.js.map +1 -0
- package/dist/schemas/profile.schema.json +37 -2
- package/dist/schemas/settings.schema.json +23 -0
- package/dist/settings/Settings.d.ts +9 -0
- package/dist/settings/Settings.js.map +1 -1
- package/dist/settings/SettingsLoader.js +5 -0
- package/dist/settings/SettingsLoader.js.map +1 -1
- package/dist/settings/SettingsMerger.js +11 -0
- package/dist/settings/SettingsMerger.js.map +1 -1
- package/package.json +7 -11
- package/src/schemas/profile.schema.json +37 -2
- package/src/schemas/settings.schema.json +23 -0
- package/doc/.deepreview +0 -30
- package/doc/architecture.md +0 -856
- package/doc/controllable-elements.md +0 -162
- package/doc/file_structure.md +0 -141
- package/doc/integration_test_system.md +0 -214
- package/doc/specs/validating_requirements_with_rules.md +0 -55
- package/doc/state_writeback_strategy.md +0 -342
- package/requirements/OFTR-001-project-foundation.md +0 -53
- package/requirements/OFTR-002-settings.md +0 -65
- package/requirements/OFTR-003-profiles.md +0 -60
- package/requirements/OFTR-004-sync-and-setup.md +0 -67
- package/requirements/OFTR-005-run-and-composite-profile.md +0 -60
- package/requirements/OFTR-006-agent-adapters.md +0 -66
- package/requirements/OFTR-007-controllable-elements.md +0 -32
- package/requirements/OFTR-008-requirements-governance.md +0 -42
- package/requirements/OFTR-009-release-publishing.md +0 -35
- package/requirements/OFTR-010-onboarding-welcome.md +0 -48
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import privateCatalogPolicy from '../shared/privateCatalogPolicy.cjs';
|
|
2
|
+
|
|
3
|
+
const { formatPrivateCatalogPiPromptTitle, privateCatalogPiPromptItems } = privateCatalogPolicy;
|
|
4
|
+
|
|
5
|
+
const importRuntime = (specifier) =>
|
|
6
|
+
typeof globalThis.__outfitterImport === 'function' ? globalThis.__outfitterImport(specifier) : import(specifier);
|
|
7
|
+
|
|
8
|
+
export const confirmPrivateCatalog = async (ctx, selectDescribedOption, repository) => {
|
|
9
|
+
const title = formatPrivateCatalogPiPromptTitle(repository);
|
|
10
|
+
const selected =
|
|
11
|
+
typeof ctx.ui.custom === 'function'
|
|
12
|
+
? await selectDescribedOption(ctx, title, privateCatalogPiPromptItems, 'enable')
|
|
13
|
+
: await ctx.ui.select(
|
|
14
|
+
title.join('\n'),
|
|
15
|
+
privateCatalogPiPromptItems.map((item) => item.label),
|
|
16
|
+
);
|
|
17
|
+
return selected === 'enable' || selected === 'Enable and continue';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const readPrivateProfileCatalogsEnabled = (fs, settingsPath) => {
|
|
21
|
+
if (!fs.existsSync(settingsPath)) return false;
|
|
22
|
+
const content = fs.readFileSync(settingsPath, 'utf8');
|
|
23
|
+
return /^enterprise:\s*(?:\n\s+[A-Za-z0-9_-]+:\s*[^\n]*)*\n\s+private_profile_catalogs:\s*true\s*$/mu.test(content);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const writePrivateProfileCatalogsEnabled = (fs, settingsPath) => {
|
|
27
|
+
fs.mkdirSync(fs.dirname(settingsPath), { recursive: true });
|
|
28
|
+
const content = fs.existsSync(settingsPath) ? fs.readFileSync(settingsPath, 'utf8') : '';
|
|
29
|
+
if (/^\s*private_profile_catalogs:\s*(?:true|false)\s*$/mu.test(content)) {
|
|
30
|
+
fs.writeFileSync(
|
|
31
|
+
settingsPath,
|
|
32
|
+
content.replace(/^\s*private_profile_catalogs:\s*(?:true|false)\s*$/gmu, ' private_profile_catalogs: true'),
|
|
33
|
+
);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (/^enterprise:\s*$/mu.test(content)) {
|
|
37
|
+
fs.writeFileSync(
|
|
38
|
+
settingsPath,
|
|
39
|
+
content.replace(/^enterprise:\s*$/mu, 'enterprise:\n private_profile_catalogs: true'),
|
|
40
|
+
);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
fs.writeFileSync(settingsPath, content.replace(/\s*$/u, '\n') + 'enterprise:\n private_profile_catalogs: true\n');
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const classifyGitHubRepositoryVisibility = async (repository) => {
|
|
47
|
+
const [owner, repo] = repository.split('/');
|
|
48
|
+
if (!owner || !repo) return 'unknown';
|
|
49
|
+
try {
|
|
50
|
+
const { request } = await importRuntime('node:https');
|
|
51
|
+
return await new Promise((resolve) => {
|
|
52
|
+
const req = request(
|
|
53
|
+
{
|
|
54
|
+
hostname: 'api.github.com',
|
|
55
|
+
path: '/repos/' + encodeURIComponent(owner) + '/' + encodeURIComponent(repo),
|
|
56
|
+
headers: { Accept: 'application/vnd.github+json', 'User-Agent': 'ai-outfitter-pi' },
|
|
57
|
+
timeout: 2000,
|
|
58
|
+
},
|
|
59
|
+
(response) => {
|
|
60
|
+
let body = '';
|
|
61
|
+
response.setEncoding('utf8');
|
|
62
|
+
response.on('data', (chunk) => {
|
|
63
|
+
body += chunk;
|
|
64
|
+
});
|
|
65
|
+
response.on('end', () => {
|
|
66
|
+
if (response.statusCode !== 200) {
|
|
67
|
+
resolve('unknown');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const document = JSON.parse(body);
|
|
72
|
+
resolve(document.private === true ? 'private' : document.private === false ? 'public' : 'unknown');
|
|
73
|
+
} catch {
|
|
74
|
+
resolve('unknown');
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
req.on('timeout', () => {
|
|
80
|
+
req.destroy();
|
|
81
|
+
resolve('unknown');
|
|
82
|
+
});
|
|
83
|
+
req.on('error', () => resolve('unknown'));
|
|
84
|
+
req.end();
|
|
85
|
+
});
|
|
86
|
+
} catch {
|
|
87
|
+
return 'unknown';
|
|
88
|
+
}
|
|
89
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"featureId": "enterprise-private-profile-catalog",
|
|
3
|
+
"visibility": "private",
|
|
4
|
+
"credentialPolicy": "ambient-git-only",
|
|
5
|
+
"runtimeSupport": "license-boundary-info-notice-no-credential-enforcement",
|
|
6
|
+
"strictPrivateRepositoryBlocking": false,
|
|
7
|
+
"privateCatalogInfoSeverity": "info",
|
|
8
|
+
"privateCatalogRequiresEnterpriseLicense": true
|
|
9
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import privateCatalogPolicy from './shared/privateCatalogPolicy.cjs';
|
|
2
|
+
|
|
3
|
+
export const ENTERPRISE_PRIVATE_CATALOG_FEATURE_ID = privateCatalogPolicy.ENTERPRISE_PRIVATE_CATALOG_FEATURE_ID;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Enterprise/private catalog capability policy.
|
|
7
|
+
*
|
|
8
|
+
* This module is intentionally licensed from code/enterprise/**. Public Outfitter
|
|
9
|
+
* can continue to clone public and private repositories through the user's
|
|
10
|
+
* ambient git configuration; this object defines the commercial boundary for
|
|
11
|
+
* private-catalog support without adding runtime credential enforcement.
|
|
12
|
+
*/
|
|
13
|
+
export const enterprisePrivateCatalogBoundary = privateCatalogPolicy.enterprisePrivateCatalogBoundary;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Returns true when a profile catalog capability belongs to the enterprise
|
|
17
|
+
* licensing boundary. This is a policy marker, not a runtime access check: git
|
|
18
|
+
* may still succeed or fail according to the user's local credentials. A
|
|
19
|
+
* confirmed private GitHub catalog should receive informational license
|
|
20
|
+
* guidance, never warning/error output or blocking behavior.
|
|
21
|
+
*
|
|
22
|
+
* @param {{ readonly visibility?: 'public' | 'private' | 'unknown' }} catalog
|
|
23
|
+
*/
|
|
24
|
+
export const requiresEnterprisePrivateCatalogLicense = privateCatalogPolicy.requiresEnterprisePrivateCatalogLicense;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const ENTERPRISE_PRIVATE_CATALOG_FEATURE_ID = 'enterprise-private-profile-catalog';
|
|
2
|
+
|
|
3
|
+
const enterprisePrivateCatalogBoundary = Object.freeze({
|
|
4
|
+
featureId: ENTERPRISE_PRIVATE_CATALOG_FEATURE_ID,
|
|
5
|
+
visibility: 'private',
|
|
6
|
+
credentialPolicy: 'ambient-git-only',
|
|
7
|
+
runtimeSupport: 'license-boundary-info-notice-no-credential-enforcement',
|
|
8
|
+
strictPrivateRepositoryBlocking: false,
|
|
9
|
+
privateCatalogInfoSeverity: 'info',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const requiresEnterprisePrivateCatalogLicense = (catalog) => catalog.visibility !== 'public';
|
|
13
|
+
|
|
14
|
+
const formatPrivateCatalogCliPrompt = (repository) =>
|
|
15
|
+
[
|
|
16
|
+
`Private GitHub profile catalog detected: ${repository}.`,
|
|
17
|
+
'',
|
|
18
|
+
'Private profile catalog support is covered by the Outfitter Enterprise license.',
|
|
19
|
+
'Review code/enterprise/LICENSE or your enterprise agreement before enabling.',
|
|
20
|
+
'',
|
|
21
|
+
'Enable private profile catalogs in ~/.outfitter/settings.yml? [y/N] ',
|
|
22
|
+
].join('\n');
|
|
23
|
+
|
|
24
|
+
const formatPrivateCatalogSkippedMessage = (repository, interactive) =>
|
|
25
|
+
interactive
|
|
26
|
+
? `info: Private profile catalog setup was skipped for ${repository}; no settings were changed.`
|
|
27
|
+
: `info: Private GitHub profile catalog detected: ${repository}. Enable enterprise.private_profile_catalogs in ~/.outfitter/settings.yml after reviewing code/enterprise/LICENSE or your enterprise agreement.`;
|
|
28
|
+
|
|
29
|
+
const privateCatalogEnabledMessage = 'info: Enabled private profile catalogs in ~/.outfitter/settings.yml.';
|
|
30
|
+
|
|
31
|
+
const formatPrivateCatalogSkipResultMessage = (repository) =>
|
|
32
|
+
`Private profile catalog setup was skipped for ${repository}; no settings were changed.`;
|
|
33
|
+
|
|
34
|
+
const privateCatalogPiPromptItems = Object.freeze([
|
|
35
|
+
Object.freeze({
|
|
36
|
+
value: 'enable',
|
|
37
|
+
label: 'Enable and continue',
|
|
38
|
+
description: 'Write enterprise.private_profile_catalogs: true to ~/.outfitter/settings.yml and save this catalog.',
|
|
39
|
+
}),
|
|
40
|
+
Object.freeze({
|
|
41
|
+
value: 'cancel',
|
|
42
|
+
label: 'Cancel private catalog setup',
|
|
43
|
+
description: 'Leave settings unchanged and do not save this private catalog.',
|
|
44
|
+
}),
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
const formatPrivateCatalogPiPromptTitle = (repository) => [
|
|
48
|
+
`Private GitHub profile catalog detected: ${repository}.`,
|
|
49
|
+
'',
|
|
50
|
+
'Private profile catalog support is covered by the Outfitter Enterprise license.',
|
|
51
|
+
'Review code/enterprise/LICENSE or your enterprise agreement before enabling.',
|
|
52
|
+
'',
|
|
53
|
+
'Enable private profile catalogs in ~/.outfitter/settings.yml and use this catalog?',
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
module.exports = {
|
|
57
|
+
ENTERPRISE_PRIVATE_CATALOG_FEATURE_ID,
|
|
58
|
+
enterprisePrivateCatalogBoundary,
|
|
59
|
+
formatPrivateCatalogCliPrompt,
|
|
60
|
+
formatPrivateCatalogPiPromptTitle,
|
|
61
|
+
formatPrivateCatalogSkippedMessage,
|
|
62
|
+
formatPrivateCatalogSkipResultMessage,
|
|
63
|
+
privateCatalogEnabledMessage,
|
|
64
|
+
privateCatalogPiPromptItems,
|
|
65
|
+
requiresEnterprisePrivateCatalogLicense,
|
|
66
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProfileControls } from '../profiles/Profile.js';
|
|
1
|
+
import type { AppendSystemPromptControl, ProfileControls } from '../profiles/Profile.js';
|
|
2
2
|
export declare const genericControlNames: Set<string>;
|
|
3
3
|
export declare const supportedControlNames: (controls: ReadonlySet<string>) => readonly string[];
|
|
4
4
|
export declare const controlAliases: readonly [{
|
|
@@ -17,5 +17,5 @@ export declare const controlAliases: readonly [{
|
|
|
17
17
|
export declare const mergeAgentSpecificControls: <T extends ProfileControls>(controls: ProfileControls, agentKey: "pi" | "claude") => T;
|
|
18
18
|
export declare const flagValue: (flag: string, value: string | undefined) => readonly string[];
|
|
19
19
|
export declare const repeatFlag: (flag: string, values: readonly string[] | undefined) => readonly string[];
|
|
20
|
-
export declare const repeatFlagValue: (flag: string, value:
|
|
20
|
+
export declare const repeatFlagValue: (flag: string, value: AppendSystemPromptControl | undefined) => readonly string[];
|
|
21
21
|
export declare const findUnsupportedControlNames: (controls: Readonly<Record<string, unknown>>, supportedControls: ReadonlySet<string>, knownControls?: ReadonlySet<string>) => string[];
|
|
@@ -15,6 +15,7 @@ export const genericControlNames = new Set([
|
|
|
15
15
|
'system_prompt',
|
|
16
16
|
'appendSystemPrompt',
|
|
17
17
|
'append_system_prompt',
|
|
18
|
+
'deepwork',
|
|
18
19
|
'pi',
|
|
19
20
|
'claude',
|
|
20
21
|
]);
|
|
@@ -42,7 +43,13 @@ export const repeatFlagValue = (flag, value) => {
|
|
|
42
43
|
if (value === undefined) {
|
|
43
44
|
return [];
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
if (typeof value === 'string') {
|
|
47
|
+
return [flag, value];
|
|
48
|
+
}
|
|
49
|
+
if (!Array.isArray(value)) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
return repeatFlag(flag, value.filter((entry) => typeof entry === 'string'));
|
|
46
53
|
};
|
|
47
54
|
export const findUnsupportedControlNames = (controls, supportedControls, knownControls = genericControlNames) => {
|
|
48
55
|
const controlNames = new Set(Object.keys(controls));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdapterProfileControls.js","sourceRoot":"","sources":["../../src/agents/AdapterProfileControls.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IACzC,OAAO;IACP,UAAU;IACV,UAAU;IACV,aAAa;IACb,MAAM;IACN,kBAAkB;IAClB,mBAAmB;IACnB,YAAY;IACZ,QAAQ;IACR,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,oBAAoB;IACpB,sBAAsB;IACtB,IAAI;IACJ,QAAQ;CACT,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAA6B,EAAqB,EAAE,CACxF,CAAC,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,WAAW,KAAK,IAAI,IAAI,WA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C;AAEF,MAAM,eAAe,GAAG,CAAC,QAA2C,EAA4B,EAAE;IAChG,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;AAChG,CAAC,CAAC"}
|
|
@@ -7,8 +7,18 @@ export interface AgentLaunchPlan {
|
|
|
7
7
|
readonly args: readonly string[];
|
|
8
8
|
readonly env: Readonly<Record<string, string>>;
|
|
9
9
|
}
|
|
10
|
+
export interface AgentLaunchProfileLayer {
|
|
11
|
+
readonly profile: Profile;
|
|
12
|
+
readonly profilePath: string;
|
|
13
|
+
readonly sourceRootPath?: string;
|
|
14
|
+
readonly resourceRootPath?: string;
|
|
15
|
+
readonly layout?: 'directory' | 'flat-file';
|
|
16
|
+
}
|
|
10
17
|
export interface AgentLaunchContext {
|
|
11
18
|
readonly profileFolders?: readonly string[];
|
|
19
|
+
readonly profileLayers?: readonly AgentLaunchProfileLayer[];
|
|
20
|
+
readonly projectDirectory?: string;
|
|
21
|
+
readonly cacheDirectory?: string;
|
|
12
22
|
}
|
|
13
23
|
export interface AgentCompositeProfilePlan {
|
|
14
24
|
readonly compositeProfile: CompositeProfile;
|
|
@@ -22,6 +32,7 @@ export interface AgentAdapter {
|
|
|
22
32
|
readonly rootDirectory: string;
|
|
23
33
|
readonly profilePaths: readonly string[];
|
|
24
34
|
readonly profileFolders?: readonly string[];
|
|
35
|
+
readonly profileLayers?: readonly AgentLaunchProfileLayer[];
|
|
25
36
|
readonly homeDirectory?: string;
|
|
26
37
|
readonly cacheDirectory?: string;
|
|
27
38
|
readonly settings?: Settings;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AgentLaunchPlan } from './AgentAdapter.js';
|
|
2
|
+
export interface AgentProcessLauncher {
|
|
3
|
+
launch(plan: AgentLaunchPlan): Promise<number>;
|
|
4
|
+
}
|
|
5
|
+
export declare const launchAgentProcess: (launcher: AgentProcessLauncher, launchPlan: AgentLaunchPlan, agentId: string) => Promise<number>;
|
|
6
|
+
export declare const resolveAgentLaunchExecutable: (launchPlan: AgentLaunchPlan) => AgentLaunchPlan;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Turns a logical agent launch plan into an actual launched process: resolves the bundled pi
|
|
2
|
+
// binary, runs the launcher, and translates a missing agent CLI into actionable install guidance.
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
export const launchAgentProcess = async (launcher, launchPlan, agentId) => {
|
|
7
|
+
try {
|
|
8
|
+
return await launcher.launch(launchPlan);
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
if (isCommandNotFoundError(error)) {
|
|
12
|
+
throw new Error(formatMissingAgentCliMessage(agentId, launchPlan.command), { cause: error });
|
|
13
|
+
}
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
// Pi is bundled with Outfitter, so prefer the bundled binary launched through the current Node
|
|
18
|
+
// runtime. This avoids the `spawn pi ENOENT` first-run crash when pi is not on PATH. Other agents
|
|
19
|
+
// (e.g. claude) are still resolved from PATH and fall back to actionable install guidance. This is
|
|
20
|
+
// a launch-mechanism detail applied by the real spawn launcher; the reported launch plan stays
|
|
21
|
+
// logical (`pi <args>`).
|
|
22
|
+
export const resolveAgentLaunchExecutable = (launchPlan) => {
|
|
23
|
+
if (launchPlan.command !== 'pi') {
|
|
24
|
+
return launchPlan;
|
|
25
|
+
}
|
|
26
|
+
const bundledPiLaunch = resolveBundledPiLaunch();
|
|
27
|
+
/* v8 ignore next 3 -- defensive: pi is a bundled dependency, so resolution succeeds in practice. */
|
|
28
|
+
if (bundledPiLaunch === undefined) {
|
|
29
|
+
return launchPlan;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
...launchPlan,
|
|
33
|
+
command: bundledPiLaunch.command,
|
|
34
|
+
args: [...bundledPiLaunch.prefixArgs, ...launchPlan.args],
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const isCommandNotFoundError = (error) => error !== null && typeof error === 'object' && 'code' in error && error.code === 'ENOENT';
|
|
38
|
+
const agentCliInstallHints = {
|
|
39
|
+
pi: 'Install Pi with `npm install -g @earendil-works/pi-coding-agent` (see https://pi.dev).',
|
|
40
|
+
claude: 'Install Claude Code from https://claude.com/claude-code, then rerun with `--agent claude`.',
|
|
41
|
+
};
|
|
42
|
+
const formatMissingAgentCliMessage = (agentId, command) => {
|
|
43
|
+
const installHint = agentCliInstallHints[agentId];
|
|
44
|
+
const baseMessage = `Could not launch the '${agentId}' agent CLI: '${command}' is not installed or not on your PATH.`;
|
|
45
|
+
return installHint === undefined ? baseMessage : `${baseMessage} ${installHint}`;
|
|
46
|
+
};
|
|
47
|
+
const piPackageName = '@earendil-works/pi-coding-agent';
|
|
48
|
+
const resolveBundledPiLaunch = () => {
|
|
49
|
+
const binPath = resolveBundledPiBinPath();
|
|
50
|
+
/* v8 ignore next 3 -- defensive: pi is a bundled dependency, so its bin resolves in practice. */
|
|
51
|
+
if (binPath === undefined) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return { command: process.execPath, prefixArgs: [binPath] };
|
|
55
|
+
};
|
|
56
|
+
// Resolve the pi bin from its bundled package. Any failure (pi missing, malformed manifest, bin
|
|
57
|
+
// file absent) throws and is caught so the caller falls back to a PATH lookup. Pi is ESM-only with
|
|
58
|
+
// a restricted `exports` map, so the package directory is located by resolving its main entry and
|
|
59
|
+
// walking up to the nearest package.json; its `bin.pi` then names the launchable script.
|
|
60
|
+
const resolveBundledPiBinPath = () => {
|
|
61
|
+
try {
|
|
62
|
+
const packageRoot = findPiPackageRoot(fileURLToPath(import.meta.resolve(piPackageName)));
|
|
63
|
+
const manifest = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'));
|
|
64
|
+
const binPath = join(packageRoot, manifest.bin.pi);
|
|
65
|
+
/* v8 ignore next 3 -- defensive: a resolved pi bin path exists on disk. */
|
|
66
|
+
if (!existsSync(binPath)) {
|
|
67
|
+
throw new Error(`Bundled pi bin '${binPath}' is missing.`);
|
|
68
|
+
}
|
|
69
|
+
return binPath;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
/* v8 ignore next -- defensive: resolution falls back to a PATH lookup when pi cannot be located. */
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
// The resolved entry lives inside the pi package, so the nearest ancestor package.json is pi's own.
|
|
77
|
+
const findPiPackageRoot = (resolvedEntryPath) => {
|
|
78
|
+
let directory = dirname(resolvedEntryPath);
|
|
79
|
+
while (!existsSync(join(directory, 'package.json'))) {
|
|
80
|
+
const parentDirectory = dirname(directory);
|
|
81
|
+
/* v8 ignore next 3 -- defensive: a resolved entry always has an ancestor package.json. */
|
|
82
|
+
if (parentDirectory === directory) {
|
|
83
|
+
throw new Error('Could not locate the bundled pi package root.');
|
|
84
|
+
}
|
|
85
|
+
directory = parentDirectory;
|
|
86
|
+
}
|
|
87
|
+
return directory;
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=AgentLaunch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentLaunch.js","sourceRoot":"","sources":["../../src/agents/AgentLaunch.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,kGAAkG;AAClG,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAQzC,MAAM,CAAC,M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OAAO,eAAe,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,oGAAoG;QACpG,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAEF,oGAAoG;AACpG,MAAM,iBAAiB,GAAG,CAAC,iBAAyB,EAAU,EAAE;IAC9D,IAAI,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAE3C,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QACpD,MAAM,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAE3C,0FAA0F;QAC1F,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QAED,SAAS,GAAG,eAAe,CAAC;IAC9B,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { findUnsupportedControlNames, flagValue, mergeAgentSpecificControls, repeatFlag, repeatFlagValue, supportedControlNames, } from '../AdapterProfileControls.js';
|
|
4
4
|
import { createDeclaredStatePaths, findProfileStateSource } from '../AdapterStatePaths.js';
|
|
5
|
+
import { resolveAppendSystemPromptControl } from '../../profiles/PromptIncludes.js';
|
|
5
6
|
import { createCompositeProfile } from '../../compositeProfile/CompositeProfile.js';
|
|
6
7
|
import { createCompositeProfileFile } from '../../compositeProfile/CompositeProfileFile.js';
|
|
7
8
|
const supportedClaudeGenericControls = new Set([
|
|
@@ -58,14 +59,28 @@ export const createClaudeAdapter = () => ({
|
|
|
58
59
|
], createClaudeStatePaths(profile, input));
|
|
59
60
|
return {
|
|
60
61
|
compositeProfile,
|
|
61
|
-
warnings:
|
|
62
|
+
warnings: [
|
|
63
|
+
...this.getUnsupportedControls(profile).map((controlName) => `claude adapter cannot translate requested control '${controlName}'.`),
|
|
64
|
+
...resolveAppendSystemPromptControl({
|
|
65
|
+
fallback: mergeClaudeControls(profile.controls).appendSystemPrompt,
|
|
66
|
+
profileLayers: input.profileLayers,
|
|
67
|
+
agentKey: 'claude',
|
|
68
|
+
projectDirectory: input.projectDirectory,
|
|
69
|
+
}).diagnostics.map((diagnostic) => `claude ${diagnostic.message} (${diagnostic.path})`),
|
|
70
|
+
],
|
|
62
71
|
};
|
|
63
72
|
},
|
|
64
|
-
createLaunchPlan(compositeProfile, profile, passThroughArgs = []) {
|
|
73
|
+
createLaunchPlan(compositeProfile, profile, passThroughArgs = [], context = {}) {
|
|
65
74
|
const controls = mergeClaudeControls(profile?.controls ?? {});
|
|
75
|
+
const appendPrompt = resolveAppendSystemPromptControl({
|
|
76
|
+
fallback: controls.appendSystemPrompt,
|
|
77
|
+
profileLayers: context.profileLayers,
|
|
78
|
+
agentKey: 'claude',
|
|
79
|
+
projectDirectory: context.projectDirectory,
|
|
80
|
+
});
|
|
66
81
|
return {
|
|
67
82
|
command: 'claude',
|
|
68
|
-
args: [...createClaudeArgs(controls), ...passThroughArgs],
|
|
83
|
+
args: [...createClaudeArgs({ ...controls, appendSystemPrompt: appendPrompt.prompts }), ...passThroughArgs],
|
|
69
84
|
env: {
|
|
70
85
|
...controls.environment,
|
|
71
86
|
CLAUDE_CONFIG_DIR: compositeProfile.rootDirectory,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClaudeAdapter.js","sourceRoot":"","sources":["../../../src/agents/claude/ClaudeAdapter.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EACL,2BAA2B,EAC3B,SAAS,EACT,0BAA0B,EAC1B,UAAU,EACV,eAAe,EACf,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,y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