@aiwg/cli 2026.11.1 → 2026.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agentic/code/addons/aiwg-hooks/canonical/aiwg-prompt-discovery.yaml +9 -0
- package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +136 -0
- package/agentic/code/providers/model-capabilities.v1.json +27 -23
- package/agentic/code/providers/model-catalog.v1.json +3 -3
- package/dist/src/artifacts/cli.js +10 -11
- package/dist/src/artifacts/discover-cli-help.js +25 -0
- package/dist/src/artifacts/discover-session-facets.js +2 -1
- package/dist/src/artifacts/fortemi-core-prebuilt-freshness.js +28 -0
- package/dist/src/artifacts/fortemi-core-sync.js +3 -0
- package/dist/src/artifacts/framework-capabilities.js +4 -0
- package/dist/src/artifacts/framework-source-digest.js +1 -1
- package/dist/src/artifacts/index-builder.js +10 -10
- package/dist/src/artifacts/index-dependencies.js +72 -0
- package/dist/src/artifacts/query-engine-discover-output.js +13 -5
- package/dist/src/artifacts/query-engine-discover.js +49 -21
- package/dist/src/artifacts/query-engine-entries.js +56 -2
- package/dist/src/artifacts/query-engine-options.js +14 -1
- package/dist/src/artifacts/query-engine-scoring.js +8 -4
- package/dist/src/artifacts/query-engine-show-card.js +2 -0
- package/dist/src/artifacts/query-engine-show-load.js +1 -1
- package/dist/src/artifacts/query-engine-show.js +3 -1
- package/dist/src/artifacts/query-engine-templates.js +33 -0
- package/dist/src/artifacts/query-engine-verbose.js +25 -0
- package/dist/src/artifacts/relations-builder.js +49 -4
- package/dist/src/artifacts/relations.js +9 -0
- package/dist/src/artifacts/template-references.js +42 -0
- package/dist/src/artifacts/types.js +1 -1
- package/dist/src/cli/handlers/bundle-reconciliation.js +7 -3
- package/dist/src/cli/handlers/checkpoint-handoff.js +48 -0
- package/dist/src/cli/handlers/checkpoint-record.js +20 -0
- package/dist/src/cli/handlers/checkpoint.js +50 -17
- package/dist/src/cli/handlers/decision.js +1 -1
- package/dist/src/cli/handlers/doctor-args.js +3 -1
- package/dist/src/cli/handlers/doctor-help.js +2 -1
- package/dist/src/cli/handlers/help.js +1 -1
- package/dist/src/cli/handlers/refresh-bundles.js +2 -1
- package/dist/src/cli/handlers/refresh-managed-deployment.js +196 -0
- package/dist/src/cli/handlers/refresh.js +10 -2
- package/dist/src/cli/handlers/subcommands-discovery.js +8 -1
- package/dist/src/cli/handlers/use.js +10 -3
- package/dist/src/cli/services/deployment-verification.js +11 -7
- package/dist/src/config/worker-write.js +4 -10
- package/dist/src/decision/ledger.js +15 -15
- package/dist/src/decision/offload.js +6 -7
- package/dist/src/delivery/pr.js +2 -0
- package/dist/src/delivery/template-sections.js +56 -0
- package/dist/src/extensions/claude-hooks-installer.js +61 -53
- package/dist/src/extensions/managed-hook-script-state.js +48 -0
- package/dist/src/extensions/muse-managed-hooks.js +49 -0
- package/dist/src/issues/cli.js +3 -0
- package/dist/src/issues/external-cli.js +4 -1
- package/dist/src/issues/live.js +9 -2
- package/dist/src/issues/local.js +5 -1
- package/dist/src/issues/tracker-policy.js +11 -1
- package/dist/src/mcp/json-document.d.mts +2 -0
- package/dist/src/models/model-capabilities.v1.json +27 -23
- package/dist/src/models/model-catalog.v1.json +3 -3
- package/dist/src/models/provider-policy.js +8 -0
- package/dist/src/models/worker-health-readiness.js +20 -4
- package/dist/src/models/worker-health-snapshot.js +29 -0
- package/dist/src/models/worker-installation.d.mts +5 -1
- package/dist/src/models/worker-installation.mjs +11 -5
- package/dist/src/models/worker-qualification-policy.js +54 -0
- package/dist/src/providers/skill-ownership.d.mts +1 -0
- package/dist/src/providers/transformation-receipt-integration.js +4 -2
- package/dist/src/providers/transformation-receipt.js +4 -2
- package/dist/src/serve/worker-invocation.js +4 -2
- package/dist/src/smiths/context-pipeline/workspace-audit.js +34 -17
- package/dist/src/smiths/context-pipeline/workspace-context-shared.js +12 -6
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +44 -4
- package/dist/src/smiths/context-pipeline/workspace-document.js +5 -2
- package/dist/src/smiths/context-pipeline/workspace-migration.js +2 -1
- package/dist/src/smiths/hook-bridge/codex-translator.js +150 -94
- package/dist/src/smiths/hook-bridge/codex-trust.js +50 -0
- package/dist/src/smiths/hook-bridge/factory-hook-config.js +132 -0
- package/dist/src/smiths/hook-bridge/factory-translator.js +88 -33
- package/dist/src/smiths/hook-bridge/index.js +3 -3
- package/dist/src/smiths/hook-bridge/loader.js +10 -2
- package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +0 -1
- package/dist/src/storage/workspace-permissions-health.js +64 -0
- package/dist/src/storage/workspace-permissions.js +51 -0
- package/package.json +6 -1
- package/tools/agents/providers/base-files.mjs +2 -1
- package/tools/agents/providers/base-flat-artifacts.mjs +6 -3
- package/tools/agents/providers/base-models-platforms.mjs +3 -3
- package/tools/agents/providers/base-skill-copy.mjs +2 -0
- package/tools/agents/providers/bound-rules-pointer.mjs +21 -0
- package/tools/agents/providers/claude-post-deploy.mjs +9 -5
- package/tools/agents/providers/codex-post-deploy.mjs +10 -0
- package/tools/agents/providers/factory-hooks.mjs +43 -0
- package/tools/agents/providers/factory.mjs +4 -91
- package/tools/agents/providers/muse-hooks.mjs +4 -43
- package/tools/agents/providers/muse-prompt-discovery.mjs +3 -7
- package/tools/agents/providers/packaged-codex-agents.mjs +48 -0
- package/tools/agents/providers/rule-delivery-surface.mjs +4 -4
- package/tools/agents/providers/rule-presentation.mjs +6 -5
- package/tools/agents/providers/rule-projection.mjs +10 -2
- package/tools/agents/providers/rule-startup.mjs +8 -1
- package/tools/cli/decision-offload-report.mjs +7 -2
- package/tools/plugin/issue-template-copies.mjs +24 -0
- package/tools/plugin/package-plugins.mjs +11 -3
- package/tools/ralph-external/lib/factory-adapter.mjs +7 -8
- package/tools/ralph-external/lib/worker-artifacts.mjs +4 -2
- package/tools/ralph-external/lib/worker-final.mjs +43 -8
- package/tools/ralph-external/lib/worker-launch-cli.mjs +10 -1
- package/tools/ralph-external/lib/worker-prompt.mjs +35 -0
- package/tools/ralph-external/lib/worker-run-directory-refusal.mjs +8 -0
- package/tools/ralph-external/session-launcher.mjs +10 -7
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Install Factory user preflight and project discovery through the existing hook bridge.
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { importImpl } from '../../_resolve-impl.mjs';
|
|
6
|
+
|
|
7
|
+
export async function deployFactoryHooks(dryRun, projectPath) {
|
|
8
|
+
const config = await importImpl(import.meta.url, 'smiths/hook-bridge/factory-hook-config.js');
|
|
9
|
+
const { managedFactoryHooks, installFactoryPromptDiscovery } = await importImpl(import.meta.url, 'smiths/hook-bridge/factory-translator.js');
|
|
10
|
+
const { captureDeploymentOutputs, recordDeploymentOutputs } = await importImpl(import.meta.url, 'providers/deployment-ownership.mjs');
|
|
11
|
+
const home = process.env.HOME || process.env.USERPROFILE;
|
|
12
|
+
if (home) {
|
|
13
|
+
const directory = path.join(home, '.factory');
|
|
14
|
+
for (const file of [directory, path.join(directory, 'hooks'), ...['hooks.json', 'settings.json', 'hooks/hooks.json'].map(name => path.join(directory, name))]) {
|
|
15
|
+
if (fs.existsSync(file) && fs.lstatSync(file).isSymbolicLink()) throw new Error(`Refusing symlinked Factory hook target: ${file}`);
|
|
16
|
+
}
|
|
17
|
+
const state = config.factoryHookDocuments(directory);
|
|
18
|
+
const roots = [state.file, state.settingsFile, state.legacyFile, path.join(directory, '.aiwg-manifest.json')];
|
|
19
|
+
const before = dryRun ? undefined : captureDeploymentOutputs(roots);
|
|
20
|
+
const removed = config.removeFactoryManaged(state.doc, 'aiwg-session');
|
|
21
|
+
// A project deploy carries the preflight in the project hooks.json; user scope only
|
|
22
|
+
// migrates AIWG's old copy away, so the session hook never runs twice.
|
|
23
|
+
if (!projectPath) {
|
|
24
|
+
const hook = managedFactoryHooks()[0];
|
|
25
|
+
((state.doc.hooks ??= {})[hook.event] ??= []).push({ matcher: '*', hooks: [{
|
|
26
|
+
type: 'command', command: hook.command, _aiwg_managed: true, _aiwg_id: hook.id,
|
|
27
|
+
}] });
|
|
28
|
+
}
|
|
29
|
+
// Only touch user files when there is something to migrate or install: creating
|
|
30
|
+
// ~/.factory/hooks.json would shadow the user's settings.json hooks fallback.
|
|
31
|
+
const changed = removed || state.migratedSettings || fs.existsSync(state.legacyFile) || !projectPath;
|
|
32
|
+
if (dryRun) { if (changed) console.log(`[dry-run] Would update Factory user hooks in ${state.file}`); }
|
|
33
|
+
else if (changed) {
|
|
34
|
+
config.saveFactoryHooks(state);
|
|
35
|
+
recordDeploymentOutputs(before, roots, { frameworkSlug: 'aiwg-hooks', claimUnchangedSettings: false, writtenFiles: [state.file] });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (projectPath) {
|
|
39
|
+
const frameworkRoot = fileURLToPath(new URL('../../../', import.meta.url));
|
|
40
|
+
const result = await installFactoryPromptDiscovery({ projectPath, frameworkRoot, dryRun });
|
|
41
|
+
for (const warning of result.warnings) console.warn(warning);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -710,95 +710,8 @@ export function enableFactoryCustomDroids(dryRun) {
|
|
|
710
710
|
// Factory Hooks
|
|
711
711
|
// ============================================================================
|
|
712
712
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
*
|
|
716
|
-
* Writes a SessionStart hook to ~/.factory/settings.json that runs
|
|
717
|
-
* `aiwg sync --dry-run --quiet` on every new session. Preserves
|
|
718
|
-
* existing hooks and settings.
|
|
719
|
-
*/
|
|
720
|
-
export function deployFactoryHooks(dryRun) {
|
|
721
|
-
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
722
|
-
if (!homeDir) {
|
|
723
|
-
console.warn('Could not determine home directory, skipping Factory hooks configuration');
|
|
724
|
-
return;
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
const settingsDir = path.join(homeDir, '.factory');
|
|
728
|
-
const settingsPath = path.join(settingsDir, 'settings.json');
|
|
729
|
-
|
|
730
|
-
let settings = {};
|
|
731
|
-
let originalContent = '';
|
|
732
|
-
let hasExistingFile = false;
|
|
733
|
-
|
|
734
|
-
// Read existing settings if present
|
|
735
|
-
if (fs.existsSync(settingsPath)) {
|
|
736
|
-
hasExistingFile = true;
|
|
737
|
-
try {
|
|
738
|
-
originalContent = fs.readFileSync(settingsPath, 'utf8');
|
|
739
|
-
const jsonContent = stripJsonComments(originalContent);
|
|
740
|
-
settings = JSON.parse(jsonContent);
|
|
741
|
-
} catch (err) {
|
|
742
|
-
console.warn(`Warning: Could not parse Factory settings.json for hooks: ${err.message}`);
|
|
743
|
-
console.warn('Skipping hook deployment to avoid corrupting settings file.');
|
|
744
|
-
return;
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
// Define the AIWG pre-flight hook
|
|
749
|
-
const aiwgHook = {
|
|
750
|
-
type: 'command',
|
|
751
|
-
command: 'aiwg sync --dry-run --quiet'
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
const aiwgMatcher = {
|
|
755
|
-
matcher: '*',
|
|
756
|
-
hooks: [aiwgHook]
|
|
757
|
-
};
|
|
758
|
-
|
|
759
|
-
// Initialize hooks structure if missing
|
|
760
|
-
if (!settings.hooks) {
|
|
761
|
-
settings.hooks = {};
|
|
762
|
-
}
|
|
763
|
-
if (!settings.hooks.SessionStart) {
|
|
764
|
-
settings.hooks.SessionStart = [];
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
// Check if AIWG hook already exists (by command string)
|
|
768
|
-
const alreadyInstalled = settings.hooks.SessionStart.some(entry =>
|
|
769
|
-
entry.hooks?.some(h => h.command && h.command.includes('aiwg sync'))
|
|
770
|
-
);
|
|
771
|
-
|
|
772
|
-
if (alreadyInstalled) {
|
|
773
|
-
console.log('Factory SessionStart hook already installed for AIWG pre-flight');
|
|
774
|
-
return;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
// Add the hook
|
|
778
|
-
settings.hooks.SessionStart.push(aiwgMatcher);
|
|
779
|
-
|
|
780
|
-
if (dryRun) {
|
|
781
|
-
console.log(`[dry-run] Would add SessionStart hook to ${settingsPath}`);
|
|
782
|
-
console.log(`[dry-run] Hook: aiwg sync --dry-run --quiet`);
|
|
783
|
-
} else {
|
|
784
|
-
if (!fs.existsSync(settingsDir)) {
|
|
785
|
-
fs.mkdirSync(settingsDir, { recursive: true });
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
// Parsed successfully, so the merge is safe to write back. It is written
|
|
789
|
-
// as canonical JSON, which drops operator comments and formatting, so
|
|
790
|
-
// keep a timestamped copy of a hand-edited user-global file first.
|
|
791
|
-
const updatedContent = JSON.stringify(settings, null, 2) + '\n';
|
|
792
|
-
if (hasExistingFile && originalContent !== JSON.stringify(JSON.parse(stripJsonComments(originalContent)), null, 2) + '\n') {
|
|
793
|
-
const backupPath = `${settingsPath}.aiwg-backup-${new Date().toISOString().replace(/[:.]/g, '-')}`;
|
|
794
|
-
fs.copyFileSync(settingsPath, backupPath);
|
|
795
|
-
console.log(`Backed up ${settingsPath} to ${backupPath} (comments and formatting are not preserved)`);
|
|
796
|
-
}
|
|
797
|
-
fs.writeFileSync(settingsPath, updatedContent, 'utf8');
|
|
798
|
-
console.log(`Deployed SessionStart hook to ${settingsPath}`);
|
|
799
|
-
console.log('Hook: aiwg sync --dry-run --quiet (runs on every new Factory session)');
|
|
800
|
-
}
|
|
801
|
-
}
|
|
713
|
+
export { deployFactoryHooks } from './factory-hooks.mjs';
|
|
714
|
+
import { deployFactoryHooks } from './factory-hooks.mjs';
|
|
802
715
|
|
|
803
716
|
// ============================================================================
|
|
804
717
|
// Post-Deployment
|
|
@@ -812,7 +725,7 @@ export async function postDeploy(targetDir, opts) {
|
|
|
812
725
|
enableFactoryCustomDroids(opts.dryRun);
|
|
813
726
|
|
|
814
727
|
// Deploy SessionStart hook for AIWG pre-flight checks
|
|
815
|
-
deployFactoryHooks(opts.dryRun);
|
|
728
|
+
if (opts.hooks !== false) await deployFactoryHooks(opts.dryRun, opts.scope === 'user' ? undefined : targetDir);
|
|
816
729
|
|
|
817
730
|
// Create/update AGENTS.md if requested
|
|
818
731
|
if (opts.createAgentsMd) {
|
|
@@ -901,7 +814,7 @@ export function generatePluginBundle(targetDir, opts) {
|
|
|
901
814
|
hooks: [
|
|
902
815
|
{
|
|
903
816
|
type: 'command',
|
|
904
|
-
command: 'aiwg
|
|
817
|
+
command: 'aiwg refresh --dry-run --quiet'
|
|
905
818
|
}
|
|
906
819
|
]
|
|
907
820
|
}
|
|
@@ -54,9 +54,11 @@ import path from 'node:path';
|
|
|
54
54
|
import { randomUUID } from 'node:crypto';
|
|
55
55
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
56
56
|
import { stripJsonComments } from './base.mjs';
|
|
57
|
-
import {
|
|
57
|
+
import { deployPromptDiscovery } from './muse-prompt-discovery.mjs';
|
|
58
58
|
import { resolveMuseXdgSkillsDir, museXdgSkillsDirRemediation } from './muse-paths.mjs';
|
|
59
59
|
|
|
60
|
+
const { AIWG_MANAGED_HOOKS } = await importImpl(import.meta.url, 'extensions/muse-managed-hooks.js');
|
|
61
|
+
|
|
60
62
|
const { assertConfigDestination, writeConfigAtomic, writeConfigTransaction } = await importImpl(import.meta.url, 'mcp/config-file.mjs');
|
|
61
63
|
|
|
62
64
|
// ---------------------------------------------------------------------------
|
|
@@ -180,48 +182,7 @@ export const MUSE_HOOK_EVENTS = [
|
|
|
180
182
|
'SessionEnd',
|
|
181
183
|
];
|
|
182
184
|
|
|
183
|
-
|
|
184
|
-
* The AIWG-managed hook set. Each entry carries a stated reason (why this
|
|
185
|
-
* hook runs on the operator's machine, outside the agent sandbox) and a
|
|
186
|
-
* removal path (how the operator takes it back out).
|
|
187
|
-
*
|
|
188
|
-
* SessionEnd is intentionally *not* installed yet: Muse documents SessionEnd
|
|
189
|
-
* as observational-only (its output cannot block termination or inject
|
|
190
|
-
* context), and AIWG has no session-catalog note command to invoke — wiring
|
|
191
|
-
* a hook to a command that does not exist would fail every session end.
|
|
192
|
-
* When a real catalog-note command lands, it slots in here with its own
|
|
193
|
-
* reason + removal path.
|
|
194
|
-
*/
|
|
195
|
-
export const AIWG_MANAGED_HOOKS = [
|
|
196
|
-
{
|
|
197
|
-
id: 'aiwg-session-start',
|
|
198
|
-
event: 'SessionStart',
|
|
199
|
-
// Muse matcher groups take ONLY `hooks` + optional `matcher`; no
|
|
200
|
-
// in-band AIWG tags (they would break the group).
|
|
201
|
-
//
|
|
202
|
-
// Muse Code 1.4.0 parses hook stdout as hook output: empty output, plain
|
|
203
|
-
// text, and `{"hookSpecificOutput": ...}` are accepted, but any other
|
|
204
|
-
// JSON key fails the hook ("unsupported `deploymentFailures` in output of
|
|
205
|
-
// SessionStart hook output"). `aiwg refresh --quiet` prints its JSON
|
|
206
|
-
// report, so stdout is discarded; the exit status still records a failed
|
|
207
|
-
// drift check in Muse's hook log. `--provider muse` is required because
|
|
208
|
-
// provider detection is fail-closed for muse and would resolve `claude`.
|
|
209
|
-
// Hook commands run through a shell, so the redirect is honored.
|
|
210
|
-
group: {
|
|
211
|
-
matcher: '*',
|
|
212
|
-
hooks: [{ type: 'command', command: 'aiwg refresh --dry-run --quiet --provider muse > /dev/null', timeout: 60 }],
|
|
213
|
-
},
|
|
214
|
-
reason:
|
|
215
|
-
'Session-start drift check. Runs a read-only `aiwg refresh --dry-run --provider muse` ' +
|
|
216
|
-
'and records its exit status in the Muse hook log. Dry-run by construction: it ' +
|
|
217
|
-
'never mutates the repo, and its report is not injected into the session.',
|
|
218
|
-
removal:
|
|
219
|
-
'Delete this matcher group from `.muse/hooks.json` (the one whose command is ' +
|
|
220
|
-
'`aiwg refresh --dry-run --quiet --provider muse > /dev/null`), or run `aiwg use --provider muse --no-hooks` ' +
|
|
221
|
-
'to stop AIWG managing hooks for this project.',
|
|
222
|
-
},
|
|
223
|
-
promptDiscoveryHook,
|
|
224
|
-
];
|
|
185
|
+
export { AIWG_MANAGED_HOOKS };
|
|
225
186
|
|
|
226
187
|
/** Canonical group payloads keyed by hook id, for merge/prune identity. */
|
|
227
188
|
function managedGroupsById() {
|
|
@@ -3,13 +3,9 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
group: { matcher: '*', hooks: [{ type: 'command', command: 'node .muse/hooks/aiwg-prompt-discovery.cjs', timeout: 2 }] },
|
|
10
|
-
reason: 'Discover the top three AIWG capabilities and inject next steps on each substantive prompt; bounded and fail open.',
|
|
11
|
-
removal: 'Set AIWG_PROMPT_DISCOVERY=0, or remove this group from .muse/hooks.json.',
|
|
12
|
-
};
|
|
6
|
+
import { importImpl } from '../../_resolve-impl.mjs';
|
|
7
|
+
|
|
8
|
+
export const { promptDiscoveryHook } = await importImpl(import.meta.url, 'extensions/muse-managed-hooks.js');
|
|
13
9
|
|
|
14
10
|
export function deployPromptDiscovery(targetDir) {
|
|
15
11
|
const directory = path.join(targetDir, '.muse', 'hooks');
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Render packaged Codex agents with the same final bindings and marker as deploy.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { importImpl } from '../../_resolve-impl.mjs';
|
|
5
|
+
import { addManagedMarker, injectBoundRules, listMdFiles } from './base.mjs';
|
|
6
|
+
import { transformAgent } from './codex.mjs';
|
|
7
|
+
import { projectCodexAgentBindings } from './bound-rules-pointer.mjs';
|
|
8
|
+
import { resolveDeliveryRuleBindings } from './rule-binding-targets.mjs';
|
|
9
|
+
const { parseRuleFrontmatter } = await importImpl(import.meta.url, 'rules/activation.mjs');
|
|
10
|
+
const { collectRuleBindingEntries } = await importImpl(import.meta.url, 'artifacts/index-builder.js');
|
|
11
|
+
const { resolveDeployVersion } = await importImpl(import.meta.url, 'providers/deploy-version.mjs');
|
|
12
|
+
|
|
13
|
+
export function packagedRuleSources(root) {
|
|
14
|
+
const code = path.join(root, 'agentic/code');
|
|
15
|
+
const roots = [code];
|
|
16
|
+
for (const kind of ['frameworks', 'addons', 'extensions', 'plugins']) {
|
|
17
|
+
const dir = path.join(code, kind);
|
|
18
|
+
if (fs.existsSync(dir)) roots.push(...fs.readdirSync(dir, { withFileTypes: true })
|
|
19
|
+
.filter(entry => entry.isDirectory()).map(entry => path.join(dir, entry.name)));
|
|
20
|
+
}
|
|
21
|
+
return roots.flatMap(dir => {
|
|
22
|
+
const behaviors = path.join(dir, 'behaviors');
|
|
23
|
+
return [...listMdFiles(path.join(dir, 'rules')).filter(file => !/^RULES-(INDEX|ONDEMAND)\.md$/.test(path.basename(file))), ...(fs.existsSync(behaviors)
|
|
24
|
+
? fs.readdirSync(behaviors, { recursive: true, withFileTypes: true }).filter(entry => entry.isFile() && entry.name === 'BEHAVIOR.md')
|
|
25
|
+
.map(entry => path.join(entry.parentPath, entry.name)) : [])];
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function createPackagedCodexRenderer(root, { target = root, ruleSources = packagedRuleSources(root) } = {}) {
|
|
30
|
+
const rules = ruleSources.flatMap(file => {
|
|
31
|
+
const content = fs.readFileSync(file, 'utf8');
|
|
32
|
+
const parsed = parseRuleFrontmatter(content);
|
|
33
|
+
if (!parsed.valid) throw new Error(`Invalid rule frontmatter: ${file}`);
|
|
34
|
+
if (!parsed.rule?.tagged || !parsed.rule.bound_to.agents.length) return [];
|
|
35
|
+
return [{ ...parsed.rule, file, content, body: parsed.body,
|
|
36
|
+
name: path.basename(file) === 'BEHAVIOR.md' ? `behavior/${path.basename(path.dirname(file))}` : parsed.data.name || path.basename(file, '.md'),
|
|
37
|
+
bound_to: { agents: parsed.rule.bound_to.agents, skills: [], flows: [] } }];
|
|
38
|
+
});
|
|
39
|
+
const bindingEntries = rules.length ? await collectRuleBindingEntries(root, 'agentic/code') : [];
|
|
40
|
+
const delivery = await resolveDeliveryRuleBindings({ srcRoot: root, target, bindingEntries }, rules,
|
|
41
|
+
{ project: {}, user: {} }, root, null);
|
|
42
|
+
const deployVersion = resolveDeployVersion(root, undefined, () => {});
|
|
43
|
+
return (source, content = fs.readFileSync(source, 'utf8'), opts = {}) => {
|
|
44
|
+
const transformed = transformAgent(source, injectBoundRules(content, source, { ruleDelivery: delivery }), opts);
|
|
45
|
+
const targets = delivery.targets.filter(entry => entry.source === path.resolve(source));
|
|
46
|
+
return projectCodexAgentBindings(addManagedMarker(transformed, deployVersion, 'bundled', 'line-comment'), targets);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
ruleEnforcementLevel,
|
|
15
15
|
} from './base.mjs';
|
|
16
16
|
import { resolveDeliveryRuleBindings } from './rule-binding-targets.mjs';
|
|
17
|
+
import { boundRuleAnchor, renderBoundRulesPointer } from './bound-rules-pointer.mjs';
|
|
17
18
|
import { inlineStartup, nativePathLoader, ruleDirectory } from './rule-projection.mjs';
|
|
18
19
|
|
|
19
20
|
export const { parseRuleFrontmatter, inferRuleActivation, readCoreBody, validateCoreSet, formatRuleFrontmatterError } = await importImpl(import.meta.url, 'rules/activation.mjs');
|
|
@@ -202,7 +203,7 @@ export function finishBindings(opts, provider) {
|
|
|
202
203
|
const files = [...new Set(roots.flatMap(walk))];
|
|
203
204
|
const indexRel = provider.name === 'copilot' ? '.github/RULES-BOUND.md' : provider.name === 'flue' ? '.agents/.aiwg/RULES-BOUND.md' : `.${provider.name}/RULES-BOUND.md`;
|
|
204
205
|
const indexFile = path.join(opts.target, indexRel);
|
|
205
|
-
const anchor =
|
|
206
|
+
const anchor = boundRuleAnchor;
|
|
206
207
|
const sections = new Map();
|
|
207
208
|
const targetsBySource = new Map();
|
|
208
209
|
for (const target of opts.ruleDelivery.targets) {
|
|
@@ -256,15 +257,14 @@ export function finishBindings(opts, provider) {
|
|
|
256
257
|
const bound = opts.ruleDelivery.bindings.get(target.source) || [];
|
|
257
258
|
const unique = [...new Map(bound.map(rule => [rule.name, rule])).values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
258
259
|
if (unique.length) sections.set(anchor(target), `## ${anchor(target)}\n\n` + unique.map(rule =>
|
|
259
|
-
`- ${rule.name} — ${rule.summary} Fetch
|
|
260
|
+
`- ${rule.name} — ${rule.summary} Fetch when a task or discovered component needs it: \`aiwg show rule ${rule.name} --body\`.`).join('\n'));
|
|
260
261
|
}
|
|
261
262
|
// Skills must carry exact fetch commands themselves: a section pointer
|
|
262
263
|
// alone loses the invocation contract in clean installs (#3473).
|
|
263
264
|
const fetch = skill ? [...new Map(rules.map(rule => [rule.name, rule])).values()]
|
|
264
265
|
.sort((a, b) => a.name.localeCompare(b.name))
|
|
265
266
|
.map(rule => `${rule.summary}\nFetch and follow before governed work: \`aiwg show rule ${rule.name} --body\`.`).join('\n') : '';
|
|
266
|
-
return
|
|
267
|
-
`\`${indexRel}#${anchor(target)}\``).join('; ')}.\n${fetch ? fetch + '\n' : ''}<!-- AIWG:bound-rules:end -->\n`;
|
|
267
|
+
return renderBoundRulesPointer(body, identities, indexRel, { fetch, compact: provider.name === 'codex' && !skill });
|
|
268
268
|
};
|
|
269
269
|
if (file.endsWith('.toml')) content = content.replace(/^developer_instructions = (".*")$/m, (_, value) => `developer_instructions = ${JSON.stringify(pointer(JSON.parse(value)))}`);
|
|
270
270
|
else content = pointer(content);
|
|
@@ -27,15 +27,16 @@ export function renderRuleKernelIndex(rules, nativePaths = false, perRuleFetch =
|
|
|
27
27
|
if (!summary.length && !paths.length && !kernels.length) return '';
|
|
28
28
|
const lines = ['# Rule kernel index', ''];
|
|
29
29
|
// RULES-INDEX receipts are parsed by deployment accounting; retain their command format.
|
|
30
|
-
|
|
31
|
-
if (
|
|
30
|
+
// #3900: "fetch before governed work" made Muse read every rule before discovery; fetch on need.
|
|
31
|
+
if (!perRuleFetch) lines.push("Fetch a rule's full body when a task or discovered component needs it: `aiwg show rule <name> --body`.", '');
|
|
32
|
+
if (kernelFile && kernels.length) lines.push("Kernel rules bind every task and subagent task. On a new task, first run discovery for the request (`aiwg discover --stdin <<'AIWG_REQUEST'`, the request, then `AIWG_REQUEST`) before reading any file below; then read a kernel file before work its subject covers.", '');
|
|
32
33
|
for (const rule of kernels) lines.push(kernelFile
|
|
33
|
-
? `- ${rule.name} — ${rule.summary || '
|
|
34
|
+
? `- ${rule.name} — ${rule.summary || 'Binding kernel rule.'} Full rule: [${kernelFile(rule)}](./${kernelFile(rule)}).`
|
|
34
35
|
: perRuleFetch
|
|
35
|
-
? `- ${rule.name} — ${rule.summary || '
|
|
36
|
+
? `- ${rule.name} — ${rule.summary || 'Binding kernel rule.'} Full rule: \`aiwg show rule ${rule.name} --body\`.`
|
|
36
37
|
: `- ${rule.name}${rule.summary ? ` — ${rule.summary}` : ''}`, '');
|
|
37
38
|
for (const rule of summary) lines.push(perRuleFetch
|
|
38
|
-
? `- ${rule.name} — ${rule.summary} Fetch
|
|
39
|
+
? `- ${rule.name} — ${rule.summary} Fetch when a task or discovered component needs it: \`aiwg show rule ${rule.name} --body\`.`
|
|
39
40
|
: `- ${rule.name}${rule.summary ? ` — ${rule.summary}` : ''}`, '');
|
|
40
41
|
if (paths.length) {
|
|
41
42
|
lines.push(nativePaths ? '## Path rules (native)' : '## Path rules (prompt emulation)', '',
|
|
@@ -56,7 +56,13 @@ export function projectRules(opts, provider) {
|
|
|
56
56
|
const tagged = rules.filter(rule => rule.tagged);
|
|
57
57
|
const extension = provider.name === 'cursor' ? '.mdc' : '.md';
|
|
58
58
|
const managed = content => addManagedMarker(content, opts.deployVersion, opts.deploySource || 'bundled');
|
|
59
|
-
const
|
|
59
|
+
const deployedSources = new Map();
|
|
60
|
+
const writeRule = (rule, content) => {
|
|
61
|
+
const name = `${ruleName(rule, provider)}${extension}`;
|
|
62
|
+
put(path.join(rulesDir, name), managed(content));
|
|
63
|
+
// Keep the source before reference rewriting, pinning, and native transforms.
|
|
64
|
+
deployedSources.set(name, opts.ruleDelivery.rules.find(original => original.file === rule.file));
|
|
65
|
+
};
|
|
60
66
|
for (const file of walk(rulesDir)) {
|
|
61
67
|
if (/\.(md|mdc)$/.test(file) && /aiwg:managed/.test(read(file))) fs.rmSync(file);
|
|
62
68
|
}
|
|
@@ -115,7 +121,9 @@ export function projectRules(opts, provider) {
|
|
|
115
121
|
manifest.managed ||= {};
|
|
116
122
|
for (const file of walk(rulesDir).filter(file => /\.(md|mdc)$/.test(file) && /aiwg:managed/.test(read(file)))) {
|
|
117
123
|
const name = path.relative(rulesDir, file);
|
|
118
|
-
|
|
124
|
+
const source = deployedSources.get(name);
|
|
125
|
+
manifest.managed[name] = { ...manifest.managed[name], hash: `sha256:${contentHash(read(file))}`,
|
|
126
|
+
...(source ? { sourceHash: `sha256:${contentHash(source.content)}` } : {}) };
|
|
119
127
|
}
|
|
120
128
|
for (const name of Object.keys(manifest.managed)) if (!fs.existsSync(path.join(rulesDir, name))) delete manifest.managed[name];
|
|
121
129
|
put(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
@@ -61,7 +61,14 @@ export function projectStartup(opts, provider, coreSection, indexFile) {
|
|
|
61
61
|
if (provider.name !== 'flue' || coreSection) content = section(content, 'rule-core', coreSection.replace(/<!-- AIWG:(?:core-rules|rule-core):(?:start|end) -->\n?/g, '').trimEnd());
|
|
62
62
|
const logical = opts.logicalOutputPath || (file => file);
|
|
63
63
|
const location = path.relative(logical(opts.target), logical(indexFile)).replaceAll('\\', '/');
|
|
64
|
-
|
|
64
|
+
let hook = `${provider.name}: Before every task and subagent task, read and follow \`${location}\`; read every listed kernel file and fetch matching full rules before governed work.`;
|
|
65
|
+
// droid exec runs no prompt hooks, so the Factory line carries discovery itself (#3942).
|
|
66
|
+
// The request goes through a quoted heredoc so the shell never expands it (#3946).
|
|
67
|
+
if (provider.name === 'factory') hook += " On every new request, your first tool call must be the shell command \`aiwg discover --stdin <<'AIWG_REQUEST'\` "
|
|
68
|
+
+ "with the request text on the next lines and \`AIWG_REQUEST\` on the last line; never put request text in quotes on a command line. Answer from its result. "
|
|
69
|
+
+ "Answering or declining without running it violates the skill-discovery rule. Use the \`aiwg\` CLI, not droid's built-in Skill tool. "
|
|
70
|
+
+ "Before writing an issue, comment, PR, report or SDLC artifact, run the same heredoc command with \`--type template\` and \`<output> template\` as the text, "
|
|
71
|
+
+ "read the chosen template with \`aiwg show template <name> --body\`, and fill every required section.";
|
|
65
72
|
content = section(content, `rule-hook-${provider.name}`, hook);
|
|
66
73
|
fs.mkdirSync(path.dirname(startup), { recursive: true });
|
|
67
74
|
writeContextFileSync(startup, content);
|
|
@@ -2,10 +2,13 @@ import { fileURLToPath } from 'node:url';
|
|
|
2
2
|
import { importImpl } from '../_resolve-impl.mjs';
|
|
3
3
|
|
|
4
4
|
/** Offline inspection only: never probes a service or records an opportunity. */
|
|
5
|
-
export async function collectDecisionOffloadReport(projectRoot) {
|
|
5
|
+
export async function collectDecisionOffloadReport(projectRoot, { fix = false } = {}) {
|
|
6
6
|
try {
|
|
7
7
|
const { buildDecisionOffloadSnapshot } = await importImpl(import.meta.url, 'decision/offload.js');
|
|
8
|
-
|
|
8
|
+
const { inspectWorkspacePermissions } = await importImpl(import.meta.url, 'storage/workspace-permissions-health.js');
|
|
9
|
+
const permissions = await inspectWorkspacePermissions(projectRoot, fix);
|
|
10
|
+
const snapshot = await buildDecisionOffloadSnapshot({ projectRoot, frameworkRoot: fileURLToPath(new URL('../../', import.meta.url)) });
|
|
11
|
+
return { ...snapshot, permissions };
|
|
9
12
|
} catch {
|
|
10
13
|
// An unavailable reader must not be interpreted as healthy adoption, nor
|
|
11
14
|
// leak exception details that can include private paths or stored values.
|
|
@@ -19,6 +22,8 @@ export function formatDecisionOffloadReport(snapshot) {
|
|
|
19
22
|
lines.push(' Observation: unknown (report unavailable).');
|
|
20
23
|
return lines;
|
|
21
24
|
}
|
|
25
|
+
for (const journal of snapshot.permissions?.journals ?? []) lines.push(` Journal permissions: ${journal.state} (${journal.path})`);
|
|
26
|
+
for (const finding of snapshot.permissions?.findings ?? []) lines.push(` Permissions: ${finding.reason} (${finding.path}); ${finding.repaired ? 'repaired' : finding.repair}`);
|
|
22
27
|
const calls = snapshot.calls?.organic;
|
|
23
28
|
const opportunities = snapshot.opportunities?.organic;
|
|
24
29
|
lines.push(` Scope: ${snapshot.scope?.mode ?? 'unknown'}${snapshot.scope?.sessionId ? ` (${snapshot.scope.sessionId})` : ''}`);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Synchronize tracker issue forms from the owning aiwg-utils bundle.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
const templates = ['bug-report', 'feature-request', 'tester-report', 'imported-report'];
|
|
6
|
+
|
|
7
|
+
export function syncIssueTemplateCopies(root, { check = false, dryRun = false } = {}) {
|
|
8
|
+
const differences = [];
|
|
9
|
+
for (const name of templates) {
|
|
10
|
+
const source = path.join(root, 'agentic/code/addons/aiwg-utils/templates/issues', `${name}.md`);
|
|
11
|
+
const canonical = fs.readFileSync(source);
|
|
12
|
+
for (const tracker of ['.gitea', '.github']) {
|
|
13
|
+
const relative = `${tracker}/ISSUE_TEMPLATE/${name}.md`;
|
|
14
|
+
const target = path.join(root, relative);
|
|
15
|
+
if (!fs.existsSync(target)) differences.push(`Missing: ${relative}`);
|
|
16
|
+
else if (!fs.readFileSync(target).equals(canonical)) differences.push(`Changed: ${relative}`);
|
|
17
|
+
if (!check && !dryRun) {
|
|
18
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
19
|
+
fs.writeFileSync(target, canonical);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return differences;
|
|
24
|
+
}
|
|
@@ -19,6 +19,7 @@ import os from 'os';
|
|
|
19
19
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
20
20
|
import { importImpl } from '../_resolve-impl.mjs';
|
|
21
21
|
import { rewritePublishedMarkdown, reportPluginLinks } from './plugin-links.mjs';
|
|
22
|
+
import { syncIssueTemplateCopies } from './issue-template-copies.mjs';
|
|
22
23
|
|
|
23
24
|
const __filename = fileURLToPath(import.meta.url);
|
|
24
25
|
const __dirname = path.dirname(__filename);
|
|
@@ -41,6 +42,7 @@ const PLUGIN_CONFIGS = {
|
|
|
41
42
|
skills: 'agentic/code/frameworks/sdlc-complete/skills'
|
|
42
43
|
},
|
|
43
44
|
extraCopy: [
|
|
45
|
+
{ from: 'agentic/code/frameworks/sdlc-complete/templates/issue-comments', to: 'templates/issue-comments' },
|
|
44
46
|
...['threat-assessment.mjs', 'threat-assessment'].map(name => ({ from: `tools/security/${name}`, to: `tools/security/${name}` })),
|
|
45
47
|
{ from: 'agentic/code/frameworks/sdlc-complete/flows/flow-architecture-evolution.playbook.yaml', to: 'flows/flow-architecture-evolution.playbook.yaml' },
|
|
46
48
|
{ from: 'agentic/code/frameworks/sdlc-complete/flows/flow-release.playbook.yaml', to: 'flows/flow-release.playbook.yaml' }
|
|
@@ -240,7 +242,11 @@ Writing quality validation and AI pattern detection.
|
|
|
240
242
|
{ from: 'agentic/code/addons/aiwg-utils/rules/skill-discovery.md', to: 'rules/skill-discovery.md' },
|
|
241
243
|
{ from: 'agentic/code/addons/aiwg-utils/rules/skill-discovery-guidance.md', to: 'rules/skill-discovery-guidance.md' },
|
|
242
244
|
{ from: 'agentic/code/addons/aiwg-utils/rules/cli-secondary.md', to: 'rules/cli-secondary.md' },
|
|
243
|
-
|
|
245
|
+
...['artifact-output-policy', 'artifact-output-policy-guidance'].map(name =>
|
|
246
|
+
({ from: `agentic/code/addons/aiwg-utils/rules/${name}.md`, to: `rules/${name}.md` })),
|
|
247
|
+
{ from: 'agentic/code/addons/aiwg-utils/templates/subagent-brief.md', to: 'templates/subagent-brief.md' },
|
|
248
|
+
{ from: 'agentic/code/addons/aiwg-utils/templates/issues', to: 'templates/issues' },
|
|
249
|
+
{ from: 'agentic/code/addons/aiwg-utils/templates/pull-requests', to: 'templates/pull-requests' }
|
|
244
250
|
],
|
|
245
251
|
readme: `# AIWG Utilities
|
|
246
252
|
|
|
@@ -294,6 +300,7 @@ Core AIWG utilities for context regeneration and workspace management.
|
|
|
294
300
|
skills: 'agentic/code/frameworks/sdlc-complete/skills'
|
|
295
301
|
},
|
|
296
302
|
extraCopy: [
|
|
303
|
+
{ from: 'agentic/code/frameworks/sdlc-complete/templates/issue-comments', to: 'templates/issue-comments' },
|
|
297
304
|
{ from: 'agentic/code/frameworks/sdlc-complete/flows/flow-architecture-evolution.playbook.yaml', to: 'flows/flow-architecture-evolution.playbook.yaml' },
|
|
298
305
|
{ from: 'agentic/code/frameworks/sdlc-complete/flows/flow-release.playbook.yaml', to: 'flows/flow-release.playbook.yaml' }
|
|
299
306
|
],
|
|
@@ -1192,9 +1199,9 @@ function writeCodexMarketplaceManifest(options) {
|
|
|
1192
1199
|
// rewrites and skill pruning. Only default Claude-owned paths are checked:
|
|
1193
1200
|
// provider-native metadata and separately maintained templates are preserved.
|
|
1194
1201
|
export function checkPackagedPlugins({ pluginsDir = PLUGINS_DIR,
|
|
1195
|
-
marketplacePath = path.join(ROOT_DIR, '.claude-plugin/marketplace.json') } = {}) {
|
|
1202
|
+
marketplacePath = path.join(ROOT_DIR, '.claude-plugin/marketplace.json'), trackerRoot = ROOT_DIR } = {}) {
|
|
1196
1203
|
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), 'aiwg-plugin-check-'));
|
|
1197
|
-
const differences =
|
|
1204
|
+
const differences = syncIssueTemplateCopies(trackerRoot, { check: true });
|
|
1198
1205
|
function files(root) {
|
|
1199
1206
|
if (!fs.existsSync(root)) return [];
|
|
1200
1207
|
if (!fs.statSync(root).isDirectory()) return [''];
|
|
@@ -1338,6 +1345,7 @@ async function main() {
|
|
|
1338
1345
|
}
|
|
1339
1346
|
|
|
1340
1347
|
// Package for each (provider, plugin) combination
|
|
1348
|
+
if (options.all) syncIssueTemplateCopies(ROOT_DIR, options);
|
|
1341
1349
|
for (const provider of providersToRun) {
|
|
1342
1350
|
for (const [name, config] of pluginsToPackage) {
|
|
1343
1351
|
// Provider-specific bundles are not part of another provider's catalog.
|
|
@@ -35,16 +35,15 @@ const MODEL_MAP = {
|
|
|
35
35
|
/**
|
|
36
36
|
* Version-bound direct-worker surface (roctinam/aiwg#2902, B-OG-37).
|
|
37
37
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* .
|
|
41
|
-
* qualification):
|
|
38
|
+
* Help-verified on titan with droid-cli 1.0.0 (2026-11-06 eval).
|
|
39
|
+
* Stdin brief echoed in the first stream-json message; live result pending
|
|
40
|
+
* (402 No active subscription). This is not live qualification:
|
|
42
41
|
*
|
|
43
42
|
* droid exec [--auto low] -m M -r E --cwd W --output-format stream-json < briefPath
|
|
44
43
|
*
|
|
45
44
|
* `exec` is Droid's non-interactive mode ("Run non-interactively (for
|
|
46
45
|
* scripts/automation)"); `-m/--model`, `-r/--reasoning-effort`, `--auto`,
|
|
47
|
-
* `--cwd` and `-o/--output-format` are all `exec`-level flags on 0.
|
|
46
|
+
* `--cwd` and `-o/--output-format` are all `exec`-level flags on 1.0.0
|
|
48
47
|
* `exec --help`. There is no file-output flag (`-o` selects the *format*,
|
|
49
48
|
* not a destination path): the final is read from the captured stdout
|
|
50
49
|
* stream instead, never a separate file. There is no positional `prompt`
|
|
@@ -71,8 +70,8 @@ const MODEL_MAP = {
|
|
|
71
70
|
* required and the CLI's per-model default is never inherited.
|
|
72
71
|
*
|
|
73
72
|
* `--output-format stream-json` and the terminal `json` object shape are
|
|
74
|
-
* doc-sourced
|
|
75
|
-
*
|
|
73
|
+
* doc-sourced; stdin ingestion alone does not verify a successful
|
|
74
|
+
* result: https://docs.factory.com/droid-exec/overview documents
|
|
76
75
|
* `--output-format json` producing exactly one terminal object,
|
|
77
76
|
* `{"type":"result","subtype":"success","is_error":false,"duration_ms":N,
|
|
78
77
|
* "num_turns":N,"result":"...","session_id":"..."}`, and
|
|
@@ -97,7 +96,7 @@ const MODEL_MAP = {
|
|
|
97
96
|
* Ralph-loop registry only; the direct worker profile loads through the
|
|
98
97
|
* installed loader.
|
|
99
98
|
*/
|
|
100
|
-
export const FACTORY_SUPPORTED_VERSIONS = Object.freeze(['0.
|
|
99
|
+
export const FACTORY_SUPPORTED_VERSIONS = Object.freeze(['1.0.0']);
|
|
101
100
|
/** Union of every reasoning-effort label observed across models in
|
|
102
101
|
* `exec --help`'s "Model details" section (including `none`, the sole
|
|
103
102
|
* level for "Auto Model" and one of the levels for GPT-6 Sol/Luna and
|
|
@@ -3,12 +3,14 @@ import { constants } from 'node:fs';
|
|
|
3
3
|
import { open, mkdir, mkdtemp, lstat, readdir, unlink, rmdir, rename } from 'node:fs/promises';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { importImpl } from '../../_resolve-impl.mjs';
|
|
6
|
+
import { workerPromptArtifacts } from './worker-prompt.mjs';
|
|
6
7
|
|
|
7
8
|
const { validateWorkerArtifacts } = await importImpl(import.meta.url, 'serve/worker-artifacts.mjs');
|
|
8
9
|
const directoryFlags = constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW;
|
|
9
10
|
const sameFile = (a, b) => a.dev === b.dev && a.ino === b.ino;
|
|
10
11
|
|
|
11
|
-
export async function materializeWorkerArtifacts(invocation, runDir) {
|
|
12
|
+
export async function materializeWorkerArtifacts(invocation, runDir, prompt) {
|
|
13
|
+
invocation = workerPromptArtifacts(invocation, prompt);
|
|
12
14
|
const artifacts = validateWorkerArtifacts(invocation);
|
|
13
15
|
const targets = new Map(artifacts.map(artifact => [artifact.name, artifact.location === 'workspace-relative'
|
|
14
16
|
? path.join(invocation.cwd, artifact.relativePath) : path.join(runDir, `artifact-${artifact.name}`)]));
|
|
@@ -172,7 +174,7 @@ export async function materializeWorkerArtifacts(invocation, runDir) {
|
|
|
172
174
|
await handle.writeFile(artifact.content); await handle.sync();
|
|
173
175
|
if (chain) await verifyPath(invocation.cwd, chain, leaf, identity);
|
|
174
176
|
}
|
|
175
|
-
return { argv, cleanup };
|
|
177
|
+
return { argv, cleanup, declarations: artifacts };
|
|
176
178
|
} catch (error) {
|
|
177
179
|
try { await cleanup(); } catch (cleanupError) { throw new AggregateError([error, cleanupError], `${error.message}; worker artifact creation and cleanup failed`); }
|
|
178
180
|
throw error;
|