sneakoscope 6.1.0 → 6.1.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/README.md +28 -11
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/dist/bin/fast-inline.js +18 -9
- package/dist/bin/sks-dispatch.js +2 -2
- package/dist/cli/args.js +2 -0
- package/dist/cli/command-manifest-lite.js +2 -3
- package/dist/cli/command-registry.js +3 -4
- package/dist/cli/help-fast.js +1 -1
- package/dist/cli/install-helpers.js +108 -303
- package/dist/cli/install-tool-helpers.js +287 -0
- package/dist/cli/router.js +40 -4
- package/dist/commands/codex-lb.js +51 -20
- package/dist/commands/codex.js +39 -1
- package/dist/commands/doctor.js +242 -20
- package/dist/commands/tmux.js +5 -1
- package/dist/commands/zellij-monitor-pane.js +2 -0
- package/dist/commands/zellij-viewport-pane.js +3 -1
- package/dist/commands/zellij.js +1 -1
- package/dist/config/skills-manifest.json +59 -59
- package/dist/core/agent-bridge/agent-manifest.js +48 -0
- package/dist/core/agents/agent-command-surface.js +2 -1
- package/dist/core/agents/agent-effort-policy.js +30 -38
- package/dist/core/agents/agent-plan.js +100 -21
- package/dist/core/agents/agent-role-config.js +43 -46
- package/dist/core/agents/agent-runner-codex-exec.js +16 -3
- package/dist/core/agents/agent-schema.js +3 -2
- package/dist/core/agents/native-cli-session-swarm.js +1 -1
- package/dist/core/agents/zellij-right-lane-cockpit.js +2 -2
- package/dist/core/codex/agent-config-file-repair.js +94 -193
- package/dist/core/codex/codex-cli-update.js +723 -0
- package/dist/core/codex/codex-config-guard.js +7 -2
- package/dist/core/codex/codex-project-config-policy.js +3 -6
- package/dist/core/codex/codex-startup-config-postcheck.js +52 -42
- package/dist/core/codex-adapter.js +35 -22
- package/dist/core/codex-app/codex-agent-role-sync.js +13 -54
- package/dist/core/codex-app/codex-app-launcher.js +48 -17
- package/dist/core/codex-app/codex-app-restart.js +23 -2
- package/dist/core/codex-app/sks-menubar.js +128 -2
- package/dist/core/codex-control/codex-0139-image-path-real-probe.js +15 -4
- package/dist/core/codex-control/codex-0139-web-search-probe.js +17 -6
- package/dist/core/codex-control/codex-lb-launch-recovery.js +278 -0
- package/dist/core/codex-control/codex-reliability-shield.js +89 -29
- package/dist/core/codex-control/codex-sdk-adapter.js +44 -8
- package/dist/core/codex-control/codex-task-runner.js +62 -9
- package/dist/core/codex-control/python-codex-sdk-adapter.js +30 -3
- package/dist/core/codex-exec-output-schema.js +35 -6
- package/dist/core/codex-lb/codex-lb-env.js +1 -1
- package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +291 -0
- package/dist/core/codex-native/codex-native-feature-broker.js +9 -16
- package/dist/core/codex-native/codex-native-repair-transaction.js +1 -1
- package/dist/core/codex-native/core-skill-manifest.js +8 -4
- package/dist/core/codex-runtime/codex-desktop-config-policy.js +2 -3
- package/dist/core/commands/agent-bridge-command.js +23 -2
- package/dist/core/commands/agent-command.js +19 -5
- package/dist/core/commands/basic-cli.js +47 -6
- package/dist/core/commands/command-utils.js +1 -1
- package/dist/core/commands/mad-sks-command.js +33 -8
- package/dist/core/commands/naruto-command.js +643 -1156
- package/dist/core/commands/research-command.js +293 -231
- package/dist/core/commands/run-command.js +100 -23
- package/dist/core/commands/team-command.js +2 -3
- package/dist/core/commands/team-legacy-observe-command.js +94 -359
- package/dist/core/db-safety.js +2 -2
- package/dist/core/decision-lattice.js +6 -6
- package/dist/core/doctor/codex-startup-config-repair.js +8 -3
- package/dist/core/doctor/doctor-codex-startup-repair.js +6 -141
- package/dist/core/feature-fixture-executor.js +71 -7
- package/dist/core/feature-fixture-runner.js +53 -12
- package/dist/core/feature-fixtures.js +47 -14
- package/dist/core/feature-registry.js +28 -27
- package/dist/core/harness-conflicts.js +18 -9
- package/dist/core/hooks-runtime/hook-io.js +8 -4
- package/dist/core/hooks-runtime/light-turn.js +70 -0
- package/dist/core/hooks-runtime/payload-signals.js +270 -0
- package/dist/core/hooks-runtime/team-digest.js +0 -1
- package/dist/core/hooks-runtime/tool-output-quarantine.js +93 -0
- package/dist/core/hooks-runtime.js +411 -258
- package/dist/core/init/skills.js +16 -30
- package/dist/core/init.js +144 -36
- package/dist/core/managed-assets/managed-assets-manifest.js +417 -10
- package/dist/core/mission.js +24 -1
- package/dist/core/pipeline-internals/runtime-core.js +570 -177
- package/dist/core/pipeline-internals/runtime-gates.js +174 -48
- package/dist/core/preflight/parallel-preflight-engine.js +50 -1
- package/dist/core/proof/route-proof-gate.js +7 -2
- package/dist/core/proof-field.js +1 -1
- package/dist/core/provider/model-router.js +33 -31
- package/dist/core/recallpulse/policy.js +12 -28
- package/dist/core/recallpulse.js +11 -6
- package/dist/core/release/npm-pack-proof.js +247 -0
- package/dist/core/release/package-dist-snapshot.js +151 -0
- package/dist/core/release/package-size-budget.js +5 -0
- package/dist/core/release/release-authorization-snapshot.js +115 -0
- package/dist/core/release/release-gate-affected-selector.js +14 -2
- package/dist/core/release/release-gate-cache-v2.js +30 -0
- package/dist/core/release/release-gate-contract.js +161 -0
- package/dist/core/release/release-gate-dag.js +1 -0
- package/dist/core/release/release-real-contract.js +90 -10
- package/dist/core/release-parallel-full-coverage.js +31 -143
- package/dist/core/research/claim-evidence-matrix.js +41 -6
- package/dist/core/research/experiment-plan.js +14 -10
- package/dist/core/research/falsification.js +9 -2
- package/dist/core/research/implementation-blueprint-densifier.js +82 -60
- package/dist/core/research/implementation-blueprint.js +32 -26
- package/dist/core/research/mock-result.js +122 -11
- package/dist/core/research/replication-pack.js +15 -8
- package/dist/core/research/research-adversarial-review.js +1068 -0
- package/dist/core/research/research-claim-builder.js +69 -17
- package/dist/core/research/research-claim-synthesizer.js +343 -0
- package/dist/core/research/research-cycle-runner.js +53 -3
- package/dist/core/research/research-falsification-runner.js +176 -0
- package/dist/core/research/research-final-reviewer.js +44 -125
- package/dist/core/research/research-realistic-report.js +14 -6
- package/dist/core/research/research-review-artifact-digest.js +66 -0
- package/dist/core/research/research-source-evidence.js +144 -0
- package/dist/core/research/research-source-layer-catalog.js +68 -0
- package/dist/core/research/research-source-ledger-merge.js +250 -12
- package/dist/core/research/research-source-shards.js +26 -70
- package/dist/core/research/research-stage-runner.js +237 -247
- package/dist/core/research/research-super-search.js +184 -0
- package/dist/core/research/research-synthesis-prompt.js +20 -1
- package/dist/core/research/research-synthesis-writer.js +86 -5
- package/dist/core/research/research-work-graph.js +25 -18
- package/dist/core/research/source-quality-report.js +21 -0
- package/dist/core/research.js +429 -280
- package/dist/core/routes/constants.js +1 -1
- package/dist/core/routes/dollar-manifest-lite.js +11 -11
- package/dist/core/routes.js +90 -63
- package/dist/core/runtime/task-profile.js +66 -0
- package/dist/core/runtime/verification-budget.js +12 -0
- package/dist/core/security/high-risk-contracts.js +6 -6
- package/dist/core/stop-gate/stop-gate-check.js +49 -12
- package/dist/core/subagents/agent-catalog.js +215 -0
- package/dist/core/subagents/model-policy.js +118 -0
- package/dist/core/subagents/naruto-help-contract.js +40 -0
- package/dist/core/subagents/official-subagent-config.js +488 -0
- package/dist/core/subagents/official-subagent-preparation.js +251 -0
- package/dist/core/subagents/official-subagent-prompt.js +137 -0
- package/dist/core/subagents/official-subagent-runner.js +129 -0
- package/dist/core/subagents/subagent-evidence.js +663 -0
- package/dist/core/subagents/terminology.js +16 -0
- package/dist/core/subagents/thread-budget.js +21 -0
- package/dist/core/subagents/triwiki-attention.js +65 -0
- package/dist/core/super-search/runtime-helpers.js +173 -19
- package/dist/core/super-search/runtime.js +140 -15
- package/dist/core/super-search/source-records.js +49 -8
- package/dist/core/team-review-policy.js +15 -0
- package/dist/core/triwiki/triwiki-module-card.js +1 -1
- package/dist/core/triwiki-wrongness/wrongness-ledger.js +9 -2
- package/dist/core/version-manager.js +51 -1
- package/dist/core/version.js +1 -1
- package/dist/core/work-order-ledger.js +40 -1
- package/dist/core/zellij/zellij-fake-adapter.js +3 -1
- package/dist/core/zellij/zellij-launcher.js +37 -8
- package/dist/core/zellij/zellij-layout-builder.js +14 -5
- package/dist/core/zellij/zellij-official-subagent-activity.js +477 -0
- package/dist/core/zellij/zellij-official-subagent-telemetry.js +264 -0
- package/dist/core/zellij/zellij-slot-pane-renderer.js +17 -5
- package/dist/core/zellij/zellij-slot-telemetry.js +15 -3
- package/dist/core/zellij/zellij-ui-mode.js +1 -1
- package/dist/core/zellij/zellij-viewport-binder.js +3 -0
- package/dist/scripts/agent-role-config-repair-check.js +14 -16
- package/dist/scripts/architecture-guard-check.js +8 -1
- package/dist/scripts/check-route-modularity.js +0 -1
- package/dist/scripts/check-ts-contracts.js +1 -1
- package/dist/scripts/codex-control-all-pipelines-check.js +7 -3
- package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +27 -0
- package/dist/scripts/codex-native-agent-role-content-check.js +15 -7
- package/dist/scripts/codex-native-repair-transaction-check.js +3 -1
- package/dist/scripts/codex-sdk-all-pipelines-check.js +7 -4
- package/dist/scripts/codex-sdk-research-pipeline-check.js +30 -8
- package/dist/scripts/db-route-materialization-check.js +33 -0
- package/dist/scripts/docs-truthfulness-check.js +3 -1
- package/dist/scripts/doctor-codex-startup-repair-check.js +12 -15
- package/dist/scripts/doctor-fix-production-blackbox.js +12 -2
- package/dist/scripts/doctor-startup-config-repair-blackbox.js +8 -2
- package/dist/scripts/doctor-startup-config-repair-check.js +12 -2
- package/dist/scripts/install-update-preserves-config-check.js +6 -1
- package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +0 -1
- package/dist/scripts/managed-role-manifest-parity-check.js +5 -4
- package/dist/scripts/naruto-codex-e2e-check.js +14 -7
- package/dist/scripts/naruto-shadow-clone-swarm-check.js +4 -201
- package/dist/scripts/npm-publish-performance-check.js +20 -12
- package/dist/scripts/official-subagent-workflow-check.js +145 -0
- package/dist/scripts/package-published-contract-check.js +6 -29
- package/dist/scripts/packlist-performance-check.js +17 -3
- package/dist/scripts/parallel-verification-engine-check.js +2 -2
- package/dist/scripts/prepublish-release-check-or-fast.js +23 -86
- package/dist/scripts/release-affected-selector-check.js +74 -1
- package/dist/scripts/release-check-stamp.js +153 -248
- package/dist/scripts/release-dag-full-coverage-check.js +7 -15
- package/dist/scripts/release-dynamic-presets-check.js +2 -1
- package/dist/scripts/release-gate-dag-runner-check.js +0 -1
- package/dist/scripts/release-gate-dag-runner.js +12 -1
- package/dist/scripts/release-gate-existence-audit.js +1 -2
- package/dist/scripts/release-parallel-full-coverage-check.js +12 -6
- package/dist/scripts/release-parallel-speed-budget-check.js +18 -2
- package/dist/scripts/release-real-check.js +26 -4
- package/dist/scripts/release-registry-check.js +61 -16
- package/dist/scripts/research-blueprint-densifier-check.js +2 -2
- package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +11 -7
- package/dist/scripts/sizecheck.js +2 -2
- package/dist/scripts/sks-3-1-4-directive-check-lib.js +8 -2
- package/dist/scripts/sks-3-1-5-directive-check-lib.js +3 -2
- package/dist/scripts/sks-3-1-6-directive-check-lib.js +5 -3
- package/dist/scripts/sks-menubar-install-check.js +8 -0
- package/dist/scripts/trust-fixture-check.js +32 -10
- package/dist/scripts/wrongness-fixture-check.js +1 -1
- package/dist/scripts/zellij-layout-valid-check.js +5 -5
- package/dist/scripts/zellij-spawn-on-demand-layout-check.js +3 -3
- package/docs/demo.tape +1 -1
- package/infra-harness-gates.json +1486 -0
- package/package.json +13 -10
- package/release-gates.v2.json +4060 -0
- package/runtime-required-scripts.json +9 -0
- package/dist/commands/db.js +0 -6
- package/dist/core/commands/db-command.js +0 -146
- package/dist/core/research/prompt.js +0 -15
- package/dist/scripts/codex-control-tool-call-sequence-repair-check.js +0 -14
|
@@ -1,227 +1,128 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { nowIso, readJson, writeJsonAtomic } from '../fsx.js';
|
|
4
|
+
import { backupInvalidToml, inspectOfficialSubagentToml, mergeOfficialSubagentConfig, officialSubagentConfigOwnershipProof, officialSubagentConfigWarnings, readInheritedOfficialSubagentConfigText } from '../subagents/official-subagent-config.js';
|
|
5
|
+
import { writeCodexConfigGuarded } from './codex-config-guard.js';
|
|
6
|
+
/**
|
|
7
|
+
* Compatibility entrypoint retained for doctor callers. It repairs the
|
|
8
|
+
* official project [agents] settings and removes only exact legacy SKS child
|
|
9
|
+
* tables after ownership has been proven. User-authored child tables remain.
|
|
10
|
+
*/
|
|
6
11
|
export async function repairAgentConfigFileReferences(input) {
|
|
7
12
|
const root = path.resolve(input.root);
|
|
8
13
|
const configPath = path.join(root, '.codex', 'config.toml');
|
|
9
14
|
const configExists = await fs.stat(configPath).then((stat) => stat.isFile()).catch(() => false);
|
|
10
|
-
const original = configExists ? await fs.readFile(configPath, 'utf8').catch(() => '') :
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
const original = configExists ? await fs.readFile(configPath, 'utf8').catch(() => '') : '';
|
|
16
|
+
const manifest = await readJson(path.join(root, '.sneakoscope', 'manifest.json'), null);
|
|
17
|
+
const migrationReceipt = await readJson(path.join(root, '.sneakoscope', 'update', 'migration-receipt.json'), null);
|
|
18
|
+
const ownershipProof = officialSubagentConfigOwnershipProof({
|
|
19
|
+
text: original,
|
|
20
|
+
manifest,
|
|
21
|
+
migrationReceipt
|
|
22
|
+
});
|
|
23
|
+
const originalValidation = inspectOfficialSubagentToml(original);
|
|
24
|
+
if (configExists && !originalValidation.ok) {
|
|
25
|
+
const backupPath = input.apply
|
|
26
|
+
? await backupInvalidToml(configPath, original, 'doctor-project-config-invalid')
|
|
27
|
+
: null;
|
|
28
|
+
return writeReport(input.reportPath, root, {
|
|
13
29
|
schema: 'sks.agent-config-file-repair.v1',
|
|
14
30
|
generated_at: nowIso(),
|
|
15
31
|
ok: false,
|
|
16
|
-
apply: true,
|
|
32
|
+
apply: input.apply === true,
|
|
17
33
|
config_path: configPath,
|
|
34
|
+
backup_path: backupPath,
|
|
18
35
|
repaired_paths: [],
|
|
19
36
|
created_files: [],
|
|
20
37
|
removed_unsupported_fields: [],
|
|
21
38
|
skipped_unmanaged_paths: [],
|
|
22
39
|
manual_required: true,
|
|
23
|
-
blockers: [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const repairedPaths = [];
|
|
31
|
-
const removedUnsupportedFields = [];
|
|
32
|
-
const skippedUnmanagedPaths = [];
|
|
33
|
-
const edits = [];
|
|
34
|
-
let text = original;
|
|
35
|
-
for (const block of tomlBlocks(original)) {
|
|
36
|
-
const managed = managedBlockTarget(root, block);
|
|
37
|
-
const currentConfigFile = stringValue(block.text, 'config_file');
|
|
38
|
-
if (!managed) {
|
|
39
|
-
if (currentConfigFile && !path.isAbsolute(currentConfigFile))
|
|
40
|
-
skippedUnmanagedPaths.push(currentConfigFile);
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const target = path.join(root, '.codex', 'agents', managed.file);
|
|
44
|
-
let replacement = removeKey(block.text, 'message_role_prefix', removedUnsupportedFields);
|
|
45
|
-
replacement = replaceOrInsertKey(replacement, 'config_file', `"${escapeToml(target)}"`);
|
|
46
|
-
if (replacement !== block.text) {
|
|
47
|
-
edits.push({ start: block.start, end: block.end, replacement });
|
|
48
|
-
repairedPaths.push(target);
|
|
49
|
-
}
|
|
50
|
-
if (input.apply) {
|
|
51
|
-
const exists = await fs.stat(target).then((stat) => stat.isFile()).catch(() => false);
|
|
52
|
-
if (!exists) {
|
|
53
|
-
await ensureDir(path.dirname(target));
|
|
54
|
-
await writeTextAtomic(target, managed.content);
|
|
55
|
-
createdFiles.push(target);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
40
|
+
blockers: [
|
|
41
|
+
'project_official_subagent_config_toml_parse_failed',
|
|
42
|
+
...(!ownershipProof.owned ? ['user_owned_file_without_sks_marker'] : [])
|
|
43
|
+
],
|
|
44
|
+
warnings: [],
|
|
45
|
+
ownership_proof: ownershipProof
|
|
46
|
+
});
|
|
58
47
|
}
|
|
59
|
-
if (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
configPath,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
48
|
+
if (input.apply && configExists && !ownershipProof.owned) {
|
|
49
|
+
return writeReport(input.reportPath, root, {
|
|
50
|
+
schema: 'sks.agent-config-file-repair.v1',
|
|
51
|
+
generated_at: nowIso(),
|
|
52
|
+
ok: false,
|
|
53
|
+
apply: true,
|
|
54
|
+
config_path: configPath,
|
|
55
|
+
backup_path: null,
|
|
56
|
+
repaired_paths: [],
|
|
57
|
+
created_files: [],
|
|
58
|
+
removed_unsupported_fields: [],
|
|
59
|
+
skipped_unmanaged_paths: [],
|
|
60
|
+
manual_required: true,
|
|
61
|
+
blockers: ['user_owned_file_without_sks_marker'],
|
|
62
|
+
warnings: [],
|
|
63
|
+
ownership_proof: ownershipProof
|
|
69
64
|
});
|
|
70
|
-
createdFiles.push(configPath);
|
|
71
65
|
}
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
const inheritedText = await readInheritedOfficialSubagentConfigText(configPath, {
|
|
67
|
+
...(input.home ? { home: input.home } : {}),
|
|
68
|
+
...(input.codexHome ? { codexHome: input.codexHome } : {})
|
|
69
|
+
});
|
|
70
|
+
const merged = mergeOfficialSubagentConfig(original, {
|
|
71
|
+
sksOwned: ownershipProof.owned,
|
|
72
|
+
inheritedText
|
|
73
|
+
});
|
|
74
|
+
const validation = inspectOfficialSubagentToml(merged);
|
|
75
|
+
const warnings = officialSubagentConfigWarnings(merged, inheritedText);
|
|
76
|
+
const blockers = [];
|
|
77
|
+
let changed = merged !== original;
|
|
78
|
+
let writeSucceeded = input.apply !== true;
|
|
79
|
+
let backupPath = null;
|
|
80
|
+
if (input.apply) {
|
|
81
|
+
const guarded = await writeCodexConfigGuarded({
|
|
74
82
|
root,
|
|
75
83
|
configPath,
|
|
76
84
|
before: original,
|
|
77
|
-
cause: '
|
|
78
|
-
|
|
85
|
+
cause: 'official-subagent-config-repair',
|
|
86
|
+
ownershipVerified: ownershipProof.owned,
|
|
87
|
+
mutate: () => merged
|
|
79
88
|
});
|
|
89
|
+
writeSucceeded = guarded.ok;
|
|
90
|
+
changed = guarded.ok && guarded.changed;
|
|
91
|
+
backupPath = guarded.backup_path;
|
|
92
|
+
if (!guarded.ok)
|
|
93
|
+
blockers.push(`config_write_guard:${guarded.status}`);
|
|
94
|
+
}
|
|
95
|
+
else if (!validation.ok) {
|
|
96
|
+
blockers.push('project_official_subagent_config_toml_parse_failed');
|
|
80
97
|
}
|
|
81
|
-
const effectiveText = input.apply ? await fs.readFile(configPath, 'utf8').catch(() => text) : text;
|
|
82
|
-
const missing = await missingAgentConfigFiles(effectiveText);
|
|
83
|
-
const unsupportedManagedFields = managedAgentBlocks(effectiveText)
|
|
84
|
-
.flatMap((block) => block.text.split(/\r?\n/).filter((line) => /^\s*message_role_prefix\s*=/.test(line)));
|
|
85
98
|
const report = {
|
|
86
99
|
schema: 'sks.agent-config-file-repair.v1',
|
|
87
100
|
generated_at: nowIso(),
|
|
88
|
-
ok:
|
|
101
|
+
ok: blockers.length === 0,
|
|
89
102
|
apply: input.apply === true,
|
|
90
103
|
config_path: configPath,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
backup_path: backupPath,
|
|
105
|
+
repaired_paths: changed && writeSucceeded ? [configPath] : [],
|
|
106
|
+
created_files: input.apply === true && !configExists && changed && writeSucceeded ? [configPath] : [],
|
|
107
|
+
removed_unsupported_fields: [],
|
|
108
|
+
skipped_unmanaged_paths: [],
|
|
109
|
+
manual_required: blockers.length > 0,
|
|
110
|
+
blockers,
|
|
111
|
+
warnings,
|
|
112
|
+
ownership_proof: ownershipProof
|
|
100
113
|
};
|
|
101
|
-
|
|
102
|
-
if (input.reportPath !== null)
|
|
103
|
-
await writeJsonAtomic(input.reportPath || path.join(root, '.sneakoscope', 'reports', 'agent-config-file-repair.json'), report).catch(() => undefined);
|
|
104
|
-
return report;
|
|
114
|
+
return writeReport(input.reportPath, root, report);
|
|
105
115
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
for (const file of rows) {
|
|
112
|
-
if (!path.isAbsolute(file)) {
|
|
113
|
-
missing.push(file);
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
const ok = await fs.stat(file).then((stat) => stat.isFile()).catch(() => false);
|
|
117
|
-
if (!ok)
|
|
118
|
-
missing.push(file);
|
|
119
|
-
}
|
|
120
|
-
return missing;
|
|
116
|
+
// Retained for compatibility with the startup postcheck API. Official custom
|
|
117
|
+
// agents are discovered from .codex/agents and do not require config_file
|
|
118
|
+
// references; legacy references are intentionally ignored and preserved.
|
|
119
|
+
export async function missingAgentConfigFiles(_text) {
|
|
120
|
+
return [];
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return matches.map((match, index) => {
|
|
126
|
-
const start = Number(match.index || 0) + (match[1] ? 1 : 0);
|
|
127
|
-
const next = matches[index + 1];
|
|
128
|
-
const end = next ? Number(next.index || 0) + (next[1] ? 1 : 0) : source.length;
|
|
129
|
-
return {
|
|
130
|
-
header: String(match[2] || '').trim(),
|
|
131
|
-
start,
|
|
132
|
-
end,
|
|
133
|
-
text: source.slice(start, end)
|
|
134
|
-
};
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
function managedAgentBlocks(text) {
|
|
138
|
-
return tomlBlocks(text).filter((block) => Boolean(managedBlockTarget(process.cwd(), block)));
|
|
139
|
-
}
|
|
140
|
-
function managedBlockTarget(root, block) {
|
|
141
|
-
if (!block.header.startsWith('agents.'))
|
|
142
|
-
return null;
|
|
143
|
-
const role = block.header.slice('agents.'.length);
|
|
144
|
-
const byRole = managedAgentRoleConfigForRole(role);
|
|
145
|
-
if (byRole)
|
|
146
|
-
return byRole;
|
|
147
|
-
const configFile = stringValue(block.text, 'config_file');
|
|
148
|
-
if (configFile) {
|
|
149
|
-
const content = managedAgentRoleConfigForFile(configFile);
|
|
150
|
-
if (content)
|
|
151
|
-
return { file: path.basename(configFile), content };
|
|
122
|
+
async function writeReport(reportPath, root, report) {
|
|
123
|
+
if (reportPath !== null) {
|
|
124
|
+
await writeJsonAtomic(reportPath || path.join(root, '.sneakoscope', 'reports', 'agent-config-file-repair.json'), report).catch(() => undefined);
|
|
152
125
|
}
|
|
153
|
-
|
|
154
|
-
const fallback = managedAgentRoleConfigForRole(role);
|
|
155
|
-
if (fallback)
|
|
156
|
-
return fallback;
|
|
157
|
-
}
|
|
158
|
-
void root;
|
|
159
|
-
return null;
|
|
160
|
-
}
|
|
161
|
-
function stringValue(text, key) {
|
|
162
|
-
const match = text.match(new RegExp(`^\\s*${escapeRegExp(key)}\\s*=\\s*"([^"]*)"`, 'm'));
|
|
163
|
-
return match && typeof match[1] === 'string' ? match[1] : null;
|
|
164
|
-
}
|
|
165
|
-
function removeKey(text, key, removed) {
|
|
166
|
-
return text.split(/\r?\n/).filter((line) => {
|
|
167
|
-
const match = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=`).test(line);
|
|
168
|
-
if (match)
|
|
169
|
-
removed.push(line.trim());
|
|
170
|
-
return !match;
|
|
171
|
-
}).join('\n');
|
|
172
|
-
}
|
|
173
|
-
function replaceOrInsertKey(text, key, encodedValue) {
|
|
174
|
-
const lines = text.replace(/\s*$/, '').split('\n');
|
|
175
|
-
const re = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=`);
|
|
176
|
-
const index = lines.findIndex((line) => re.test(line));
|
|
177
|
-
if (index >= 0)
|
|
178
|
-
lines[index] = `${key} = ${encodedValue}`;
|
|
179
|
-
else
|
|
180
|
-
lines.push(`${key} = ${encodedValue}`);
|
|
181
|
-
return `${lines.join('\n')}\n`;
|
|
182
|
-
}
|
|
183
|
-
function applyEdits(text, edits) {
|
|
184
|
-
return [...edits]
|
|
185
|
-
.sort((a, b) => b.start - a.start)
|
|
186
|
-
.reduce((current, edit) => `${current.slice(0, edit.start)}${edit.replacement}${current.slice(edit.end)}`, text);
|
|
187
|
-
}
|
|
188
|
-
function escapeToml(value) {
|
|
189
|
-
return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
190
|
-
}
|
|
191
|
-
function escapeRegExp(value) {
|
|
192
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
193
|
-
}
|
|
194
|
-
function minimalManagedConfigToml() {
|
|
195
|
-
return [
|
|
196
|
-
'service_tier = "fast"',
|
|
197
|
-
'',
|
|
198
|
-
'[features]',
|
|
199
|
-
'hooks = true',
|
|
200
|
-
'multi_agent = true',
|
|
201
|
-
'fast_mode = true',
|
|
202
|
-
'apps = true',
|
|
203
|
-
'',
|
|
204
|
-
'[mcp_servers.context7]',
|
|
205
|
-
'url = "https://mcp.context7.com/mcp"',
|
|
206
|
-
'',
|
|
207
|
-
agentConfigBlock('native_agent', 'SKS native agent with bounded write capability.', './agents/native-agent-intake.toml', ['Analysis', 'Mapper']),
|
|
208
|
-
'',
|
|
209
|
-
agentConfigBlock('team_consensus', 'SKS planning/debate agent with bounded write capability.', './agents/team-consensus.toml', ['Consensus', 'Atlas']),
|
|
210
|
-
'',
|
|
211
|
-
agentConfigBlock('implementation_worker', 'SKS bounded implementation worker.', './agents/implementation-worker.toml', ['Builder', 'Mason']),
|
|
212
|
-
'',
|
|
213
|
-
agentConfigBlock('db_safety_reviewer', 'DB safety reviewer with bounded write capability.', './agents/db-safety-reviewer.toml', ['Sentinel', 'Ledger']),
|
|
214
|
-
'',
|
|
215
|
-
agentConfigBlock('qa_reviewer', 'QA reviewer with bounded write capability.', './agents/qa-reviewer.toml', ['Verifier', 'Reviewer']),
|
|
216
|
-
''
|
|
217
|
-
].join('\n');
|
|
218
|
-
}
|
|
219
|
-
function agentConfigBlock(table, description, configFile, nicknames = []) {
|
|
220
|
-
return [
|
|
221
|
-
`[agents.${table}]`,
|
|
222
|
-
`description = "${description}"`,
|
|
223
|
-
`config_file = "${configFile}"`,
|
|
224
|
-
`nickname_candidates = [${nicknames.map((name) => `"${name}"`).join(', ')}]`
|
|
225
|
-
].join('\n');
|
|
126
|
+
return report;
|
|
226
127
|
}
|
|
227
128
|
//# sourceMappingURL=agent-config-file-repair.js.map
|