@aiwg/cli 2026.10.19 → 2026.11.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/README.md +1 -0
- package/agentic/code/providers/flue/README.md +2 -1
- package/dist/src/artifacts/cli.js +3 -2
- package/dist/src/artifacts/discover-facets.js +2 -0
- package/dist/src/artifacts/discover-session-facets.js +14 -0
- package/dist/src/artifacts/fortemi-core-query-adapter.js +4 -4
- package/dist/src/artifacts/framework-capabilities.js +7 -3
- package/dist/src/artifacts/index-builder.js +2 -3
- package/dist/src/artifacts/query-engine-discover-output.js +3 -3
- package/dist/src/artifacts/query-engine-discover.js +61 -14
- package/dist/src/artifacts/query-engine-entries.js +52 -9
- package/dist/src/artifacts/query-engine-installation.js +27 -0
- package/dist/src/artifacts/query-engine-rules.js +1 -2
- package/dist/src/artifacts/query-engine-scoring.js +33 -31
- package/dist/src/artifacts/query-engine-show-card.js +6 -2
- package/dist/src/artifacts/query-engine-show.js +2 -2
- package/dist/src/artifacts/relations.js +17 -10
- package/dist/src/cli/handlers/bundle-declaration.js +55 -0
- package/dist/src/cli/handlers/bundle-deployment-mode.js +71 -0
- package/dist/src/cli/handlers/bundle-hash-prune.js +37 -0
- package/dist/src/cli/handlers/bundle-reconciliation.js +140 -0
- package/dist/src/cli/handlers/checkpoint.js +143 -0
- package/dist/src/cli/handlers/help.js +1 -0
- package/dist/src/cli/handlers/index.js +4 -2
- package/dist/src/cli/handlers/models-resource-sample.js +7 -3
- package/dist/src/cli/handlers/ralph-launcher.js +1 -1
- package/dist/src/cli/handlers/refresh-bundles.js +35 -0
- package/dist/src/cli/handlers/refresh-rule-inventory.js +10 -0
- package/dist/src/cli/handlers/refresh.js +15 -52
- package/dist/src/cli/handlers/remove-bundled.js +7 -4
- package/dist/src/cli/handlers/remove-flue-modules.js +19 -0
- package/dist/src/cli/handlers/remove-historical-bundle.js +18 -0
- package/dist/src/cli/handlers/remove.js +8 -0
- package/dist/src/cli/handlers/script-runner.js +12 -1
- package/dist/src/cli/handlers/steward-signing.js +44 -0
- package/dist/src/cli/handlers/steward.js +5 -0
- package/dist/src/cli/handlers/subcommands-list-format.js +4 -4
- package/dist/src/cli/handlers/update.js +18 -8
- package/dist/src/cli/handlers/use-additive-bundles.js +87 -0
- package/dist/src/cli/handlers/use-bundle-counts.js +5 -1
- package/dist/src/cli/handlers/use-owned-counts.js +75 -0
- package/dist/src/cli/handlers/use-provider-results.js +17 -0
- package/dist/src/cli/handlers/use.js +53 -114
- package/dist/src/cli/router.js +12 -2
- package/dist/src/cli/services/deployment-verification.js +2 -1
- package/dist/src/cli/user-scope-mirror.js +3 -1
- package/dist/src/config/aiwg-config.js +15 -6
- package/dist/src/config/cli.js +1 -0
- package/dist/src/config/delivery-validation.js +21 -0
- package/dist/src/config/framework-aliases.js +14 -0
- package/dist/src/config/host-resource-report.d.mts +1 -1
- package/dist/src/config/host-resource-report.mjs +23 -4
- package/dist/src/config/host-resource-runtime.d.mts +8 -0
- package/dist/src/config/host-resource-runtime.mjs +67 -24
- package/dist/src/config/index-graph-overrides.js +4 -0
- package/dist/src/config/installed-selection.js +9 -1
- package/dist/src/config/installed-validation.js +35 -0
- package/dist/src/config/worker-attribution.d.mts +7 -0
- package/dist/src/config/worker-attribution.mjs +44 -0
- package/dist/src/delivery/git.js +62 -0
- package/dist/src/delivery/pr.js +149 -0
- package/dist/src/delivery/tracker.js +33 -0
- package/dist/src/discovery/interview.js +1 -1
- package/dist/src/extensions/claude-hooks-installer.js +1 -0
- package/dist/src/extensions/loader.js +2 -1
- package/dist/src/extensions/project-local-doctor.js +1 -1
- package/dist/src/extensions/project-local-remove.js +3 -3
- package/dist/src/issues/cli.js +12 -3
- package/dist/src/issues/external-cli.js +76 -0
- package/dist/src/issues/live.js +18 -1
- package/dist/src/issues/tracker-policy.js +17 -0
- package/dist/src/mcp/cli.mjs +12 -7
- package/dist/src/mcp/helpers.mjs +5 -1
- package/dist/src/mcp/http-options.mjs +101 -0
- package/dist/src/mcp/http-tools.mjs +51 -0
- package/dist/src/mcp/http-transport.mjs +201 -0
- package/dist/src/mcp/server.mjs +9 -7
- package/dist/src/mcp/tool-context.mjs +25 -0
- package/dist/src/mcp/tools/orchestration.mjs +2 -1
- package/dist/src/mcp/tools/worker-invoke.mjs +2 -1
- package/dist/src/mcp/tools/worker-stdin-runtime.mjs +12 -0
- package/dist/src/models/conductor-data-policy.d.mts +3 -2
- package/dist/src/models/conductor-data-policy.mjs +94 -5
- package/dist/src/models/worker-plan.js +3 -3
- package/dist/src/models/worker-selection-policy.js +2 -1
- package/dist/src/providers/deployment-lock.js +77 -0
- package/dist/src/providers/deployment-ownership.d.mts +12 -2
- package/dist/src/providers/deployment-ownership.mjs +127 -19
- package/dist/src/providers/deployment-preservation.d.mts +6 -0
- package/dist/src/providers/deployment-preservation.mjs +113 -0
- package/dist/src/providers/deployment-removal.js +4 -2
- package/dist/src/providers/flue-package-mode.js +19 -0
- package/dist/src/providers/provider-definitions.js +4 -0
- package/dist/src/providers/skill-ownership.mjs +1 -0
- package/dist/src/research/reference-match.js +4 -0
- package/dist/src/serve/worker-invocation-preparation.js +3 -1
- package/dist/src/serve/worker-invocation.js +2 -0
- package/dist/src/skills/run.js +5 -0
- package/dist/src/smiths/hook-bridge/codex-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/hermes-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +6 -0
- package/package.json +5 -2
- package/schemas/models/model-config-compatibility.v1.schema.json +4 -0
- package/tools/agents/deploy-agents.mjs +21 -1
- package/tools/agents/deploy-options.mjs +2 -0
- package/tools/agents/providers/base-contract.mjs +7 -1
- package/tools/agents/providers/base-inventory.mjs +41 -14
- package/tools/agents/providers/base-kernel-skills.mjs +9 -5
- package/tools/agents/providers/base-migrations.mjs +1 -0
- package/tools/agents/providers/base-skill-copy.mjs +9 -1
- package/tools/agents/providers/base.mjs +1 -1
- package/tools/agents/providers/claude.mjs +2 -1
- package/tools/agents/providers/codex.mjs +5 -1
- package/tools/agents/providers/conductor-data-guard.mjs +35 -11
- package/tools/agents/providers/flue-bundles.mjs +42 -0
- package/tools/agents/providers/flue-cloudflare.mjs +20 -0
- package/tools/agents/providers/flue-project.mjs +45 -6
- package/tools/agents/providers/flue-skill-copy.mjs +25 -0
- package/tools/agents/providers/flue-skills.mjs +45 -0
- package/tools/agents/providers/flue-specialists.mjs +36 -18
- package/tools/agents/providers/flue-validation.mjs +14 -0
- package/tools/agents/providers/flue.mjs +12 -8
- package/tools/agents/providers/hermes-skill-lifecycle.mjs +1 -0
- package/tools/agents/providers/muse-hooks.mjs +4 -0
- package/tools/agents/providers/muse-prompt-discovery.mjs +22 -0
- package/tools/agents/providers/provider-prepare-coordinator.mjs +15 -10
- package/tools/agents/providers/rule-delivery-surface.mjs +18 -1
- package/tools/agents/providers/rule-deployment-commit.mjs +24 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +4 -0
- package/tools/agents/providers/skill-copy-prune.mjs +49 -0
- package/tools/agents/providers/stale-artifact-prune.mjs +10 -8
- package/tools/ralph-external/lib/worker-capture.mjs +157 -0
- package/tools/ralph-external/lib/worker-health.mjs +3 -0
- package/tools/ralph-external/lib/worker-invocation-processes.mjs +9 -6
- package/tools/ralph-external/lib/worker-launch-cli.mjs +10 -1
- package/tools/ralph-external/lib/worker-process-identity.mjs +30 -0
- package/tools/ralph-external/lib/worker-retry-evidence.mjs +87 -6
- package/tools/ralph-external/lib/worker-termination.mjs +56 -6
- package/tools/ralph-external/process-monitor.mjs +12 -18
- package/tools/ralph-external/session-launcher.mjs +43 -29
- package/tools/skills/codex-skill-metadata.mjs +22 -0
- package/tools/skills/deploy-skills-codex.mjs +8 -7
- package/vscode-extension/schemas/aiwg.config.v1.json +59 -19
|
@@ -51,10 +51,10 @@ export { assertManagedWorkerLaunch } from './lib/managed-worker-attempt.mjs';
|
|
|
51
51
|
import { buildSessionEnvironment } from './lib/session-environment.mjs';
|
|
52
52
|
import { withWorkerPath, boundedPrivateRead } from './lib/worker-inputs.mjs';
|
|
53
53
|
import { collectWorkerFinal } from './lib/worker-final.mjs';
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
54
|
+
import { prepareWorkerRetry, workerRetryRecordFields } from './lib/worker-retry-evidence.mjs';
|
|
55
|
+
import { settleWorkerTermination, terminationRemedy } from './lib/worker-termination.mjs';
|
|
56
|
+
import { WorkerCaptureOwner, assertWorkerCapturePathsAvailable } from './lib/worker-capture.mjs';
|
|
57
|
+
import { buildWorkerInvocationEnvironment } from './lib/worker-invocation-processes.mjs';
|
|
58
58
|
import { launcherRecoveryEvidence, observeLauncherRecoveryOutcome, recordLauncherRecoveryHint } from './lib/launcher-recovery-evidence.mjs';
|
|
59
59
|
export { observeLauncherRecoveryOutcome } from './lib/launcher-recovery-evidence.mjs';
|
|
60
60
|
import { publishWorkerUnitExit, readRecordedWorkerUnitStop } from './lib/worker-unit-cleanup.mjs';
|
|
@@ -426,12 +426,8 @@ async function launchOneWorker(owner, options) {
|
|
|
426
426
|
// `writableRoots` is already computed above for the run-directory check)
|
|
427
427
|
// is what it takes to pass the SAME production-resolved roots into this
|
|
428
428
|
// check too.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
const exitRecord = await verifyRetryPredecessor(await resolveRetryReference(options.retryOf, { inspect }),
|
|
432
|
-
{ newInvocationPath: options?.invocationPath, inspect, workerWritableRoots: writableRoots, checkDescendants: options.checkDescendants });
|
|
433
|
-
verifiedPreviousAttemptId = exitRecord.invocationId;
|
|
434
|
-
}
|
|
429
|
+
options = { ...options, retryEvidence: await prepareWorkerRetry(options, { saved, inspect, workerWritableRoots: writableRoots }) };
|
|
430
|
+
const verifiedPreviousAttemptId = options.retryEvidence?.previousAttemptId ?? null;
|
|
435
431
|
const paths = (await importImpl(import.meta.url, 'serve/worker-invocation-paths.js')).workerOutputPaths(invocation);
|
|
436
432
|
if (new Set(Object.values(paths)).size !== Object.keys(paths).length || Object.values(paths).some(filename =>
|
|
437
433
|
filename === options.invocationPath || filename === invocation.briefPath
|
|
@@ -440,6 +436,7 @@ async function launchOneWorker(owner, options) {
|
|
|
440
436
|
'stdout.log', 'stdout.events.jsonl', 'stderr.log', '.launch-owner'].some(name => filename === join(runDir, name)))) {
|
|
441
437
|
throw new Error('Worker output paths must be distinct from trusted metadata, capture files and artifact- paths');
|
|
442
438
|
}
|
|
439
|
+
await assertWorkerCapturePathsAvailable(paths, inspect, { runDir, writableRoots: [invocation.cwd, ...writableRoots] });
|
|
443
440
|
for (const filename of Object.values(paths)) {
|
|
444
441
|
if (await inspect(filename, 'output')) throw new Error('Fresh worker output paths are required');
|
|
445
442
|
if (!await inspect(dirname(filename), 'directory')) throw new Error('Worker output parent is missing');
|
|
@@ -517,7 +514,7 @@ async function launchOneWorker(owner, options) {
|
|
|
517
514
|
// unconditionally here is exactly as safe as computing it conditionally
|
|
518
515
|
// was unsafe — this file no longer has two places that both decide
|
|
519
516
|
// "is this gated" and can disagree.
|
|
520
|
-
const taskDigest = await stableTaskChainDigest(saved.request, invocation.briefDigest);
|
|
517
|
+
const taskDigest = options.retryEvidence?.taskDigest ?? await stableTaskChainDigest(saved.request, invocation.briefDigest);
|
|
521
518
|
const dispatchClockNow = () => options.scopedBreaker?.nowMs?.() ?? Number(process.hrtime.bigint()) / 1e6;
|
|
522
519
|
const dispatchGuard = options.dispatchGuard ?? {
|
|
523
520
|
nowMs: dispatchClockNow,
|
|
@@ -639,7 +636,8 @@ async function launchOneWorker(owner, options) {
|
|
|
639
636
|
const profile = inputs.drivers[invocation.selected.cli].qualification.adapter.invocationProfiles[invocation.selected.profileRef];
|
|
640
637
|
const captures = { stdout: join(runDir, profile.health?.outputFraming === 'jsonl' ? 'stdout.events.jsonl' : 'stdout.log'),
|
|
641
638
|
stderr: join(runDir, 'stderr.log') };
|
|
642
|
-
const
|
|
639
|
+
const captureOwner = new WorkerCaptureOwner({ runDir, paths, captures, inspect, invocationId });
|
|
640
|
+
const writeRecord = captureOwner.writer(options.publishRecord ?? publishWorkerRecord, publishWorkerRecord);
|
|
643
641
|
const publishFailures = [];
|
|
644
642
|
let publishing = Promise.resolve();
|
|
645
643
|
// Each write must stay independent: one rejected publish must never block
|
|
@@ -685,6 +683,7 @@ async function launchOneWorker(owner, options) {
|
|
|
685
683
|
// owned, launcher-written, confirmed-terminal evidence for this exact
|
|
686
684
|
// task — never from an unverified caller claim.
|
|
687
685
|
previousAttemptId: verifiedPreviousAttemptId,
|
|
686
|
+
...workerRetryRecordFields(options.retryEvidence),
|
|
688
687
|
requestId: invocationId, taskDigest, role: saved.request.role,
|
|
689
688
|
...(options.managedAdmission ? { attempt: options.attempt } : {}),
|
|
690
689
|
selected: invocation.selected, planDigest: qualificationDigest(saved), invocationDigest: qualificationDigest(invocation),
|
|
@@ -695,7 +694,7 @@ async function launchOneWorker(owner, options) {
|
|
|
695
694
|
executedArgvDigest: qualificationDigest(artifacts.argv),
|
|
696
695
|
artifacts: (invocation.artifacts ?? []).map(artifact => ({ name: artifact.name,
|
|
697
696
|
byteLength: Buffer.byteLength(artifact.content), sha256: bytesDigest(artifact.content) })),
|
|
698
|
-
envNames:
|
|
697
|
+
envNames: buildWorkerInvocationEnvironment(invocation.envNames, invocationId, {}, invocation).envNames, stdin: invocation.stdin,
|
|
699
698
|
prompt: { path: invocation.briefPath, digest: invocation.briefDigest }, cwd: invocation.cwd,
|
|
700
699
|
worktree: { path: invocation.cwd, baseRevision: null }, paths, captures, outputFraming: profile.health?.outputFraming ?? 'opaque',
|
|
701
700
|
health: invocation.health ?? null, transport: invocation.transport,
|
|
@@ -706,7 +705,7 @@ async function launchOneWorker(owner, options) {
|
|
|
706
705
|
// All captures (including the reserved final) open successfully BEFORE spawn.
|
|
707
706
|
for (const filename of [...Object.values(paths), ...Object.values(captures)]) {
|
|
708
707
|
const handle = await withWorkerPath(filename, target => (options.openCapture ?? open)(target, constants.O_RDWR | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600));
|
|
709
|
-
handles.push(handle);
|
|
708
|
+
handles.push(handle); await captureOwner.reserveOutput(filename);
|
|
710
709
|
}
|
|
711
710
|
// Recheck policy, prompt, installation and exact bindings after file preparation.
|
|
712
711
|
inputs = await loadInputs();
|
|
@@ -715,7 +714,7 @@ async function launchOneWorker(owner, options) {
|
|
|
715
714
|
paths: await Promise.all([invocation.cwd, runDir].map(workerDispatchPath)) });
|
|
716
715
|
if (!gate.ok) throw workerDispatchRefusal(gate);
|
|
717
716
|
if (bytesDigest(await boundedPrivateRead(invocation.briefPath, 262144, inspect)) !== invocation.briefDigest) throw new Error('Worker prompt changed before spawn');
|
|
718
|
-
const environment = buildWorkerInvocationEnvironment(invocation.envNames, invocationId);
|
|
717
|
+
const environment = buildWorkerInvocationEnvironment(invocation.envNames, invocationId, process.env, invocation);
|
|
719
718
|
const baselineContent = await sampleOwnedWorktreeContent(invocation.cwd, { files: options.healthArtifacts });
|
|
720
719
|
// #2915 round 8 (D2, replaces the former "debit immediately before this
|
|
721
720
|
// call" comment): the ledger debit now happens INSIDE the dispatch-
|
|
@@ -909,6 +908,7 @@ async function launchOneWorker(owner, options) {
|
|
|
909
908
|
await inspect(runDir, 'directory');
|
|
910
909
|
await withWorkerPath(runDir, async target => { const handle = await open(target, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
911
910
|
try { await handle.chmod(0o700); } finally { await handle.close(); } });
|
|
911
|
+
await captureOwner.finish();
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
914
|
}
|
|
@@ -949,7 +949,8 @@ async function captureOneWorker(owner, ctx) {
|
|
|
949
949
|
const { child, outcome, invocation, invocationId, supervisor, launchTime, monotonicStart, publish, paths, handles, options,
|
|
950
950
|
canaryDeadlineMs = null, canaryNowMs = () => Date.now(), recoveryGated = false } = ctx;
|
|
951
951
|
const hasTransport = outcome.mode === 'systemd-unit' || outcome.transportSupervisor;
|
|
952
|
-
|
|
952
|
+
// Spawn-time capture keeps a fast-exiting worker's identity (#3835).
|
|
953
|
+
const sampleIdentity = options.sampleIdentity ?? (pid => sampleWorkerIdentity(pid, { includeExited: true }));
|
|
953
954
|
// Separate hook from `sampleIdentity` (the worker-side sampler): this one
|
|
954
955
|
// samples the launcher's own trusted transport child, never a worker PID,
|
|
955
956
|
// and tests need to control the two independently (e.g. the transport
|
|
@@ -1138,8 +1139,10 @@ async function captureOneWorker(owner, ctx) {
|
|
|
1138
1139
|
const native = outcome.unit ? readNative() ?? readRecordedWorkerUnitStop(outcome, { native: true }) : null;
|
|
1139
1140
|
const members = identity ? sampleWorkerGroup(identity.pgid) : null;
|
|
1140
1141
|
// Require positive kernel evidence of owned containment being empty.
|
|
1141
|
-
const
|
|
1142
|
-
|
|
1142
|
+
const terminationEvidence = outcome.mode !== 'systemd-unit' && child.pid === undefined
|
|
1143
|
+
? { confirmed: true, missing: null } : await settleWorkerTermination({ mode: outcome.mode, native,
|
|
1144
|
+
workerExited: sawExit, identity, supervisor, invocationId });
|
|
1145
|
+
const confirmed = terminationEvidence.confirmed;
|
|
1143
1146
|
// `worker-exit.json`/`worker-identity.json` are written into a directory
|
|
1144
1147
|
// the worker itself can reach (same UID, no filesystem confinement), so a
|
|
1145
1148
|
// worker can plant either file before the trusted transport ever writes
|
|
@@ -1175,7 +1178,7 @@ async function captureOneWorker(owner, ctx) {
|
|
|
1175
1178
|
: outcome.mode === 'systemd-unit' && native?.execMainCode === 1 ? native.execMainStatus : waitCode;
|
|
1176
1179
|
const result = { invocationId, exitCode, signal: resultSignal,
|
|
1177
1180
|
endedAt: new Date().toISOString(), termination: confirmed ? 'confirmed' : 'uncertain',
|
|
1178
|
-
descendants: confirmed ? 'none' : 'unknown', timedOut: resultTimedOut,
|
|
1181
|
+
terminationMissing: terminationEvidence.missing, descendants: confirmed ? 'none' : 'unknown', timedOut: resultTimedOut,
|
|
1179
1182
|
cancelled: stopReason === 'CANCELLED', stopReason, errorCode: errorCode ?? null, capturedBytes: Math.min(total, output.length),
|
|
1180
1183
|
// Unauthenticated: reported by the worker-writable transport record, not
|
|
1181
1184
|
// kernel-observed. Never used above for exitCode/signal/termination.
|
|
@@ -1547,7 +1550,8 @@ async function launchOneWorkerBaseline(owner, options, ctx) {
|
|
|
1547
1550
|
const profile = inputs.drivers[invocation.selected.cli].qualification.adapter.invocationProfiles[invocation.selected.profileRef];
|
|
1548
1551
|
const captures = { stdout: join(runDir, profile.health?.outputFraming === 'jsonl' ? 'stdout.events.jsonl' : 'stdout.log'),
|
|
1549
1552
|
stderr: join(runDir, 'stderr.log') };
|
|
1550
|
-
const
|
|
1553
|
+
const captureOwner = new WorkerCaptureOwner({ runDir, paths, captures, inspect, invocationId });
|
|
1554
|
+
const writeRecord = captureOwner.writer(options.publishRecord ?? publishWorkerRecord, publishWorkerRecord);
|
|
1551
1555
|
const publishFailures = [];
|
|
1552
1556
|
let publishing = Promise.resolve();
|
|
1553
1557
|
const artifactLifecycle = new WorkerArtifactLifecycle(invocation, invocationId);
|
|
@@ -1565,7 +1569,8 @@ async function launchOneWorkerBaseline(owner, options, ctx) {
|
|
|
1565
1569
|
artifacts = await materializeWorkerArtifacts(invocation, runDir);
|
|
1566
1570
|
const displayArgv = artifacts.argv.map((token, i) => i === 0 ? token : `<argument:${bytesDigest(token)}>`);
|
|
1567
1571
|
await publish('invocation.json', { version: 1, origin: 'launcher', invocationId, attemptId: invocationId,
|
|
1568
|
-
previousAttemptId: verifiedPreviousAttemptId ?? null, requestId: options.managedAdmission?.requestId ?? invocationId, taskDigest: qualificationDigest(saved.request), role: saved.request.role,
|
|
1572
|
+
previousAttemptId: verifiedPreviousAttemptId ?? null, requestId: options.managedAdmission?.requestId ?? invocationId, taskDigest: options.retryEvidence?.taskDigest ?? qualificationDigest(saved.request), role: saved.request.role,
|
|
1573
|
+
...workerRetryRecordFields(options.retryEvidence),
|
|
1569
1574
|
...(options.managedAdmission ? { attempt: options.attempt } : {}),
|
|
1570
1575
|
selected: invocation.selected, planDigest: qualificationDigest(saved), invocationDigest: qualificationDigest(invocation),
|
|
1571
1576
|
policyDigest: invocation.policyDigest, catalogDigest: invocation.catalogDigest, profileDigest: invocation.profileDigest,
|
|
@@ -1575,7 +1580,7 @@ async function launchOneWorkerBaseline(owner, options, ctx) {
|
|
|
1575
1580
|
executedArgvDigest: qualificationDigest(artifacts.argv),
|
|
1576
1581
|
artifacts: (invocation.artifacts ?? []).map(artifact => ({ name: artifact.name,
|
|
1577
1582
|
byteLength: Buffer.byteLength(artifact.content), sha256: bytesDigest(artifact.content) })),
|
|
1578
|
-
envNames:
|
|
1583
|
+
envNames: buildWorkerInvocationEnvironment(invocation.envNames, invocationId, {}, invocation).envNames, stdin: invocation.stdin,
|
|
1579
1584
|
prompt: { path: invocation.briefPath, digest: invocation.briefDigest }, cwd: invocation.cwd,
|
|
1580
1585
|
worktree: { path: invocation.cwd, baseRevision: null }, paths, captures, outputFraming: profile.health?.outputFraming ?? 'opaque',
|
|
1581
1586
|
health: invocation.health ?? null, transport: invocation.transport,
|
|
@@ -1586,7 +1591,7 @@ async function launchOneWorkerBaseline(owner, options, ctx) {
|
|
|
1586
1591
|
// All captures (including the reserved final) open successfully BEFORE spawn.
|
|
1587
1592
|
for (const filename of [...Object.values(paths), ...Object.values(captures)]) {
|
|
1588
1593
|
const handle = await withWorkerPath(filename, target => (options.openCapture ?? open)(target, constants.O_RDWR | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600));
|
|
1589
|
-
handles.push(handle);
|
|
1594
|
+
handles.push(handle); await captureOwner.reserveOutput(filename);
|
|
1590
1595
|
}
|
|
1591
1596
|
// Recheck policy, prompt, installation and exact bindings after file preparation.
|
|
1592
1597
|
inputs = await loadInputs();
|
|
@@ -1595,7 +1600,7 @@ async function launchOneWorkerBaseline(owner, options, ctx) {
|
|
|
1595
1600
|
paths: await Promise.all([invocation.cwd, runDir].map(workerDispatchPath)) });
|
|
1596
1601
|
if (!localGate.ok) throw workerDispatchRefusal(localGate);
|
|
1597
1602
|
if (bytesDigest(await boundedPrivateRead(invocation.briefPath, 262144, inspect)) !== invocation.briefDigest) throw new Error('Worker prompt changed before spawn');
|
|
1598
|
-
const environment = buildWorkerInvocationEnvironment(invocation.envNames, invocationId);
|
|
1603
|
+
const environment = buildWorkerInvocationEnvironment(invocation.envNames, invocationId, process.env, invocation);
|
|
1599
1604
|
const baselineContent = await sampleOwnedWorktreeContent(invocation.cwd, { files: options.healthArtifacts });
|
|
1600
1605
|
// The real `launchIsolatedWorker`, called with no `onDispatchCommit`
|
|
1601
1606
|
// (never passed anywhere in this frozen function), is synchronous —
|
|
@@ -1637,6 +1642,7 @@ async function launchOneWorkerBaseline(owner, options, ctx) {
|
|
|
1637
1642
|
await inspect(runDir, 'directory');
|
|
1638
1643
|
await withWorkerPath(runDir, async target => { const handle = await open(target, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW);
|
|
1639
1644
|
try { await handle.chmod(0o700); } finally { await handle.close(); } });
|
|
1645
|
+
await captureOwner.finish();
|
|
1640
1646
|
}
|
|
1641
1647
|
}
|
|
1642
1648
|
}
|
|
@@ -1644,7 +1650,8 @@ async function launchOneWorkerBaseline(owner, options, ctx) {
|
|
|
1644
1650
|
async function captureOneWorkerBaseline(owner, ctx) {
|
|
1645
1651
|
const { child, outcome, invocation, invocationId, supervisor, launchTime, monotonicStart, publish, paths, handles, options } = ctx;
|
|
1646
1652
|
const hasTransport = outcome.mode === 'systemd-unit' || outcome.transportSupervisor;
|
|
1647
|
-
|
|
1653
|
+
// Spawn-time capture keeps a fast-exiting worker's identity (#3835).
|
|
1654
|
+
const sampleIdentity = options.sampleIdentity ?? (pid => sampleWorkerIdentity(pid, { includeExited: true }));
|
|
1648
1655
|
const sampleNativeSupervisor = options.sampleNativeSupervisor ?? sampleWorkerIdentity;
|
|
1649
1656
|
// For our own detached child, spawn waits through setsid/exec; one owned leader sample suffices.
|
|
1650
1657
|
const immediate = !hasTransport ? sampleIdentity(child.pid) : null;
|
|
@@ -1807,8 +1814,10 @@ async function captureOneWorkerBaseline(owner, ctx) {
|
|
|
1807
1814
|
// evidence is used wherever it is available.
|
|
1808
1815
|
const native = outcome.unit ? readNative() ?? readRecordedWorkerUnitStop(outcome, { native: true }) : null;
|
|
1809
1816
|
const members = identity ? sampleWorkerGroup(identity.pgid) : null;
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1817
|
+
const terminationEvidence = outcome.mode !== 'systemd-unit' && child.pid === undefined
|
|
1818
|
+
? { confirmed: true, missing: null } : await settleWorkerTermination({ mode: outcome.mode, native,
|
|
1819
|
+
workerExited: sawExit, identity, supervisor, invocationId });
|
|
1820
|
+
const confirmed = terminationEvidence.confirmed;
|
|
1812
1821
|
const workerExit = hasTransport ? await transportRecord('worker-exit.json') : null;
|
|
1813
1822
|
if (!identity && hasTransport && nativeSupervisor) {
|
|
1814
1823
|
const workerStart = await transportRecord('worker-identity.json');
|
|
@@ -1827,7 +1836,7 @@ async function captureOneWorkerBaseline(owner, ctx) {
|
|
|
1827
1836
|
const result = { invocationId, exitCode, signal: resultSignal,
|
|
1828
1837
|
...(options.managedAdmission ? { managedAdmission: options.managedAdmission } : {}),
|
|
1829
1838
|
endedAt: new Date().toISOString(), termination: confirmed ? 'confirmed' : 'uncertain',
|
|
1830
|
-
descendants: confirmed ? 'none' : 'unknown', timedOut: resultTimedOut,
|
|
1839
|
+
terminationMissing: terminationEvidence.missing, descendants: confirmed ? 'none' : 'unknown', timedOut: resultTimedOut,
|
|
1831
1840
|
cancelled: stopReason === 'CANCELLED', stopReason, errorCode: errorCode ?? null, capturedBytes: Math.min(total, output.length),
|
|
1832
1841
|
workerTermination: hasTransport ? workerExit && !workerExit.errorCode ? 'confirmed' : 'uncertain' : sawExit ? 'confirmed' : 'uncertain',
|
|
1833
1842
|
workerReportedExit: workerExit ? { exitCode: workerExit.exitCode, signal: workerExit.signal, errorCode: workerExit.errorCode ?? null } : null,
|
|
@@ -2037,7 +2046,7 @@ export const UNBOUND_RETRY_EVIDENCE_CODE = 'UNBOUND_RETRY_EVIDENCE';
|
|
|
2037
2046
|
* retry and is surfaced with a code the conductor can act on — it must never
|
|
2038
2047
|
* silently spawn a duplicate writer.
|
|
2039
2048
|
*/
|
|
2040
|
-
export function stopBeforeRetryGate(previousResult, { expectedInvocationId = null, runDir, missing } = {}) {
|
|
2049
|
+
export function stopBeforeRetryGate(previousResult, { expectedInvocationId = null, runDir, missing = previousResult?.terminationMissing } = {}) {
|
|
2041
2050
|
if (previousResult?.termination !== 'confirmed') {
|
|
2042
2051
|
return {
|
|
2043
2052
|
ok: false,
|
|
@@ -4969,6 +4978,11 @@ export function planDirectWorkerLaunch({
|
|
|
4969
4978
|
// for the not-gated/disabled-CLI paths below, which must stay
|
|
4970
4979
|
// synchronous and byte-for-byte legacy — passing `undefined` through to
|
|
4971
4980
|
// `launchIsolatedWorker` is the dual-mode contract that keeps it so.
|
|
4981
|
+
if (invocation?.cwd && invocation?.selected?.group) {
|
|
4982
|
+
invocationId ??= invocation.invocationId ?? randomUUID();
|
|
4983
|
+
const marked = buildWorkerInvocationEnvironment(envNames ?? [], invocationId, env ?? process.env, invocation);
|
|
4984
|
+
envNames = marked.envNames; env = marked.env;
|
|
4985
|
+
}
|
|
4972
4986
|
let dispatchAttempt;
|
|
4973
4987
|
const launch = (onDispatchCommit) => launchIsolatedWorker({ name, memoryMaxGb, command, args, cwd, logFile, stdinPath, stdoutPath, stderrPath,
|
|
4974
4988
|
gate, config, allowDegraded, attached, ownedGroup,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Update Codex's generated metadata with the same integrity receipts as skill payloads.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { contentHash, readSidecarManifest, writeSidecarManifest } from '../agents/providers/base-files.mjs';
|
|
5
|
+
export function writeCodexSkillMetadata(skillDir, content) {
|
|
6
|
+
const relative = 'agents/openai.yaml';
|
|
7
|
+
const file = path.join(skillDir, relative);
|
|
8
|
+
const receipt = readSidecarManifest(skillDir) || { managed: {} };
|
|
9
|
+
const record = receipt.managed?.[relative];
|
|
10
|
+
if (fs.existsSync(file)) {
|
|
11
|
+
const current = fs.readFileSync(file, 'utf8');
|
|
12
|
+
if (record?.hash ? record.hash !== `sha256:${contentHash(current)}` : current !== content) {
|
|
13
|
+
console.warn(`${file}: kept (operator-edited or unrecorded metadata)`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
18
|
+
fs.writeFileSync(file, content, 'utf8');
|
|
19
|
+
receipt.managed ??= {};
|
|
20
|
+
receipt.managed[relative] = { ...record, hash: `sha256:${contentHash(content)}` };
|
|
21
|
+
writeSidecarManifest(skillDir, receipt, false);
|
|
22
|
+
}
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* --force Overwrite existing files
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
+
import { removeSkillCopy } from '../agents/providers/skill-copy-prune.mjs';
|
|
33
34
|
import realFs from 'fs';
|
|
34
35
|
import { createRequire } from 'module';
|
|
35
36
|
const _require = createRequire(import.meta.url);
|
|
@@ -40,6 +41,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
40
41
|
import os from 'os';
|
|
41
42
|
import { deploySkillDir, getFrameworksForMode, normalizeDeploymentMode, isKernelSkill } from '../agents/providers/base.mjs';
|
|
42
43
|
|
|
44
|
+
import { writeCodexSkillMetadata } from './codex-skill-metadata.mjs';
|
|
43
45
|
import { stripWrappingQuotes, transformToCodexSkill } from './codex-skill-transform.mjs';
|
|
44
46
|
const LEGACY_RENAMED_SKILLS = new Set(['aiwg-mcp']);
|
|
45
47
|
|
|
@@ -131,6 +133,7 @@ function parseArgs(args, homeDir) {
|
|
|
131
133
|
else if (a === '--mode' && args[i + 1]) cfg.mode = String(args[++i]).toLowerCase();
|
|
132
134
|
else if (a === '--dry-run') cfg.dryRun = true;
|
|
133
135
|
else if (a === '--force') cfg.force = true;
|
|
136
|
+
else if (a === '--index-mode') cfg.indexMode = true;
|
|
134
137
|
else if (a === '--copy-all' || a === '--copy-standard-skills') cfg.copyStandardSkills = true;
|
|
135
138
|
else if (a === '--listing-cap' && args[i + 1]) { cfg.listingCap = Math.max(0, Number(args[++i]) || 0); cfg.listingCapExplicit = true; }
|
|
136
139
|
else if (a === '--standard-target' && args[i + 1]) cfg.standardTarget = path.resolve(args[++i]);
|
|
@@ -172,7 +175,6 @@ function findSkillDirs(baseDir) {
|
|
|
172
175
|
function deploySkill(skill, targetDir, opts) {
|
|
173
176
|
const { force = false, dryRun = false } = opts;
|
|
174
177
|
const skillDir = path.join(targetDir, skill.name);
|
|
175
|
-
const metadataPath = path.join(skillDir, 'agents', 'openai.yaml');
|
|
176
178
|
|
|
177
179
|
if (dryRun) {
|
|
178
180
|
console.log(` [dry-run] deploy: ${skill.name}`);
|
|
@@ -186,12 +188,11 @@ function deploySkill(skill, targetDir, opts) {
|
|
|
186
188
|
|
|
187
189
|
// Use the same whole-folder copier and ownership receipt as other providers.
|
|
188
190
|
const deployed = deploySkillDir(path.dirname(skill.sourcePath), targetDir, {
|
|
189
|
-
force, dryRun, provider: 'codex', skillName: skill.name,
|
|
191
|
+
...opts, force, dryRun, provider: 'codex', skillName: skill.name,
|
|
190
192
|
transformSkillMd: () => skill.content,
|
|
191
193
|
});
|
|
192
194
|
if (deployed === false) return { action: 'skip', reason: 'ownership' };
|
|
193
|
-
|
|
194
|
-
fs.writeFileSync(metadataPath, skill.metadataContent, 'utf8');
|
|
195
|
+
writeCodexSkillMetadata(skillDir, skill.metadataContent);
|
|
195
196
|
console.log(` deployed: ${skill.name}`);
|
|
196
197
|
|
|
197
198
|
return { action: 'deploy', reason: 'success' };
|
|
@@ -376,7 +377,7 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
376
377
|
console.log(`\n${item.label} (${planned.filter((p) => p.label === item.label).length} skills):`);
|
|
377
378
|
}
|
|
378
379
|
const demoted = budget.demoted.has(item);
|
|
379
|
-
const result = deploySkill(item.skill, demoted ? standardTarget : target, { force, dryRun });
|
|
380
|
+
const result = deploySkill(item.skill, demoted ? standardTarget : target, { force, dryRun, copyStandardSkills, copyMode: copyStandardSkills && !cfg.indexMode });
|
|
380
381
|
if (demoted) console.log(` ↳ standard tier (${path.relative(process.cwd(), standardTarget) || standardTarget}) — startup listing budget`);
|
|
381
382
|
if (result.action === 'deploy') totalDeployed++;
|
|
382
383
|
else totalSkipped++;
|
|
@@ -406,7 +407,7 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
406
407
|
// skills can delete the kernel skills installed by the preceding full-root
|
|
407
408
|
// Codex pass, leaving `.agents/skills/` empty while `aiwg use` still exits 0.
|
|
408
409
|
let totalPruned = 0;
|
|
409
|
-
if (fs.existsSync(target)) {
|
|
410
|
+
if ((!copyStandardSkills || cfg.indexMode) && fs.existsSync(target)) {
|
|
410
411
|
const targetEntries = fs.readdirSync(target, { withFileTypes: true });
|
|
411
412
|
for (const entry of targetEntries) {
|
|
412
413
|
if (!entry.isDirectory()) continue;
|
|
@@ -445,7 +446,7 @@ export async function main(args = process.argv.slice(2), internal = {}) {
|
|
|
445
446
|
if (dryRun) {
|
|
446
447
|
console.log(` [dry-run] would prune stale skill: ${name}`);
|
|
447
448
|
} else {
|
|
448
|
-
|
|
449
|
+
if (!removeSkillCopy(full, { ...cfg, copyMode: copyStandardSkills && !cfg.indexMode })) continue;
|
|
449
450
|
}
|
|
450
451
|
totalPruned++;
|
|
451
452
|
}
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
},
|
|
155
155
|
"installed": {
|
|
156
156
|
"type": "object",
|
|
157
|
-
"description": "
|
|
157
|
+
"description": "Declared bundles per provider, including pending deployments",
|
|
158
158
|
"additionalProperties": {
|
|
159
159
|
"$ref": "#/definitions/InstalledFramework"
|
|
160
160
|
}
|
|
@@ -516,6 +516,11 @@
|
|
|
516
516
|
],
|
|
517
517
|
"description": "How agents deliver code. direct = commit/push to default_branch; feature-branch = push branch, no PR; pr-required = branch + PR (default)"
|
|
518
518
|
},
|
|
519
|
+
"merge": {
|
|
520
|
+
"type": "string",
|
|
521
|
+
"enum": ["local-signed", "local", "tracker"],
|
|
522
|
+
"description": "Merge execution route. Defaults to tracker; local-signed is optional and requires signing configuration."
|
|
523
|
+
},
|
|
519
524
|
"default_branch": {
|
|
520
525
|
"type": "string",
|
|
521
526
|
"description": "Default branch name. Defaults to 'main'."
|
|
@@ -2486,6 +2491,16 @@
|
|
|
2486
2491
|
"type": "object",
|
|
2487
2492
|
"additionalProperties": false,
|
|
2488
2493
|
"properties": {
|
|
2494
|
+
"credential": {
|
|
2495
|
+
"type": "object",
|
|
2496
|
+
"additionalProperties": false,
|
|
2497
|
+
"properties": {
|
|
2498
|
+
"store": { "type": "string", "minLength": 1, "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$" },
|
|
2499
|
+
"env": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" }
|
|
2500
|
+
},
|
|
2501
|
+
"oneOf": [{ "required": ["store"], "properties": { "store": {} } }, { "required": ["env"], "properties": { "env": {} } }],
|
|
2502
|
+
"description": "Sensitive-input reference only; never a literal token."
|
|
2503
|
+
},
|
|
2489
2504
|
"login": {
|
|
2490
2505
|
"type": "string",
|
|
2491
2506
|
"description": "Forge login that should author delivery writes."
|
|
@@ -3231,29 +3246,54 @@
|
|
|
3231
3246
|
},
|
|
3232
3247
|
"InstalledFramework": {
|
|
3233
3248
|
"type": "object",
|
|
3234
|
-
"description": "
|
|
3249
|
+
"description": "A bundle declaration; empty provider counts mean pending deployment",
|
|
3250
|
+
"required": ["deployedTo"],
|
|
3235
3251
|
"properties": {
|
|
3236
|
-
"version": {
|
|
3237
|
-
|
|
3238
|
-
|
|
3252
|
+
"version": { "type": "string" },
|
|
3253
|
+
"source": { "type": "string" },
|
|
3254
|
+
"installedAt": { "type": "string", "format": "date-time" },
|
|
3255
|
+
"manifestHash": { "type": "string" },
|
|
3256
|
+
"localPath": { "type": "string" },
|
|
3257
|
+
"localType": { "type": "string" },
|
|
3258
|
+
"manifestVersion": { "type": "string" },
|
|
3259
|
+
"artifactHashes": { "type": "object", "additionalProperties": { "type": "string" } },
|
|
3260
|
+
"deployedArtifactHashes": {
|
|
3261
|
+
"type": "object",
|
|
3262
|
+
"additionalProperties": { "type": "object", "additionalProperties": { "type": "string" } }
|
|
3239
3263
|
},
|
|
3240
|
-
"
|
|
3241
|
-
"type": "
|
|
3242
|
-
"
|
|
3243
|
-
"
|
|
3244
|
-
"type": "
|
|
3264
|
+
"deployedTo": {
|
|
3265
|
+
"type": "object",
|
|
3266
|
+
"allOf": [{ "patternProperties": { "^(?!flue$)": { "type": "object", "properties": { "package": false } } } }],
|
|
3267
|
+
"additionalProperties": {
|
|
3268
|
+
"type": "object",
|
|
3269
|
+
"properties": {
|
|
3270
|
+
"agents": { "type": "integer", "minimum": 0 },
|
|
3271
|
+
"commands": { "type": "integer", "minimum": 0 },
|
|
3272
|
+
"skills": { "type": "integer", "minimum": 0 },
|
|
3273
|
+
"rules": { "type": "integer", "minimum": 0 },
|
|
3274
|
+
"entries": { "type": "object" },
|
|
3275
|
+
"skipUtils": { "type": "boolean", "description": "Effective --no-utils flag at deployment" },
|
|
3276
|
+
"kernelOnly": { "type": "boolean", "description": "Effective kernel-only deployment scope" },
|
|
3277
|
+
"copy": { "type": "boolean", "description": "Keep project copies during refresh/update; only explicit remove deletes them" },
|
|
3278
|
+
"package": { "type": "boolean", "description": "Import Flue skills from @aiwg/flue instead of copying them" }
|
|
3279
|
+
},
|
|
3280
|
+
"additionalProperties": false,
|
|
3281
|
+
"anyOf": [
|
|
3282
|
+
{ "propertyNames": { "enum": ["copy", "package", "skipUtils", "kernelOnly"] } },
|
|
3283
|
+
{ "required": ["agents", "commands", "skills", "rules"], "properties": { "agents": {}, "commands": {}, "skills": {}, "rules": {} } }
|
|
3284
|
+
]
|
|
3245
3285
|
}
|
|
3246
|
-
},
|
|
3247
|
-
"installedAt": {
|
|
3248
|
-
"type": "string",
|
|
3249
|
-
"format": "date-time",
|
|
3250
|
-
"description": "ISO 8601 timestamp of installation"
|
|
3251
|
-
},
|
|
3252
|
-
"source": {
|
|
3253
|
-
"type": "string",
|
|
3254
|
-
"description": "Source registry or path"
|
|
3255
3286
|
}
|
|
3256
3287
|
},
|
|
3288
|
+
"anyOf": [
|
|
3289
|
+
{
|
|
3290
|
+
"properties": {
|
|
3291
|
+
"version": false, "source": false, "installedAt": false,
|
|
3292
|
+
"deployedTo": { "type": "object", "additionalProperties": { "type": "object", "propertyNames": { "enum": ["copy", "package", "skipUtils", "kernelOnly"] } } }
|
|
3293
|
+
}
|
|
3294
|
+
},
|
|
3295
|
+
{ "required": ["version", "source", "installedAt"], "properties": { "version": {}, "source": {}, "installedAt": {} } }
|
|
3296
|
+
],
|
|
3257
3297
|
"additionalProperties": false
|
|
3258
3298
|
}
|
|
3259
3299
|
}
|