sneakoscope 5.6.0 → 5.7.0
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 -1
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/crates/sks-core/src/main.rs +1 -1
- package/dist/bin/sks.js +1 -1
- package/dist/cli/command-registry.js +1 -1
- package/dist/cli/install-helpers.js +21 -15
- package/dist/commands/doctor.js +44 -22
- package/dist/config/skills-manifest.json +58 -58
- package/dist/core/codex/agent-config-file-repair.js +2 -1
- package/dist/core/codex/codex-config-guard.js +10 -0
- package/dist/core/codex-app/sks-menubar.js +113 -21
- package/dist/core/commands/run-command.js +5 -1
- package/dist/core/commands/wiki-command.js +19 -1
- package/dist/core/feature-fixtures.js +11 -11
- package/dist/core/fsx.js +1 -1
- package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +48 -0
- package/dist/core/hooks-runtime.js +4 -0
- package/dist/core/triwiki-attention.js +16 -8
- package/dist/core/triwiki-wrongness/wrongness-schema.js +18 -1
- package/dist/core/update/update-migration-state.js +178 -33
- package/dist/core/version.js +1 -1
- package/dist/scripts/codex-lb-gpt55-fast-profile-check.js +3 -2
- package/dist/scripts/packlist-performance-check.js +4 -2
- package/dist/scripts/release-metadata-1-19-check.js +12 -1
- package/dist/scripts/sks-menubar-install-check.js +83 -0
- package/package.json +14 -5
|
@@ -15,6 +15,8 @@ const MENU_ITEMS = [
|
|
|
15
15
|
'Use ChatGPT OAuth',
|
|
16
16
|
'Set codex-lb Domain and Key',
|
|
17
17
|
'Set OpenRouter Key and GLM Profiles',
|
|
18
|
+
'Fast Mode On',
|
|
19
|
+
'Fast Mode Off',
|
|
18
20
|
'Fast Check',
|
|
19
21
|
'SKS Version Check',
|
|
20
22
|
'Update SKS Now',
|
|
@@ -63,6 +65,7 @@ export async function installSksMenuBar(opts = {}) {
|
|
|
63
65
|
const nextActions = defaultNextActions();
|
|
64
66
|
let secretEnvCleanup;
|
|
65
67
|
let codexBundleId = null;
|
|
68
|
+
let lastTargetCheck;
|
|
66
69
|
if (process.platform !== 'darwin') {
|
|
67
70
|
const result = {
|
|
68
71
|
schema: 'sks.codex-app-sks-menubar.v1',
|
|
@@ -170,15 +173,11 @@ export async function installSksMenuBar(opts = {}) {
|
|
|
170
173
|
actionScriptPath: paths.action_script_path,
|
|
171
174
|
warnings
|
|
172
175
|
});
|
|
173
|
-
|
|
174
|
-
if (!target.exists
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
const actionScript = target.used_previous_script
|
|
180
|
-
? previousActionScript
|
|
181
|
-
: actionScriptSource({ nodeBin: process.execPath, sksEntry: target.resolved || target.packaged });
|
|
176
|
+
lastTargetCheck = target;
|
|
177
|
+
if (!target.exists) {
|
|
178
|
+
return await blockedResult('sks_entry_unresolved', `Resolved SKS entry does not exist: ${target.requested || target.resolved || target.packaged}`);
|
|
179
|
+
}
|
|
180
|
+
const actionScript = actionScriptSource({ nodeBin: process.execPath, sksEntry: target.resolved || target.packaged });
|
|
182
181
|
const swiftSource = swiftMenuSource({
|
|
183
182
|
actionScriptPath: paths.action_script_path,
|
|
184
183
|
buildStampPath: paths.build_stamp_path,
|
|
@@ -201,7 +200,9 @@ export async function installSksMenuBar(opts = {}) {
|
|
|
201
200
|
};
|
|
202
201
|
const previousStamp = await readJson(paths.build_stamp_path, null);
|
|
203
202
|
const appInstalled = await exists(paths.executable_path);
|
|
204
|
-
const
|
|
203
|
+
const currentActionScript = await readText(paths.action_script_path, '');
|
|
204
|
+
const actionScriptCurrent = currentActionScript === actionScript;
|
|
205
|
+
const stampMatches = appInstalled && buildStampEquals(previousStamp, stamp) && actionScriptCurrent;
|
|
205
206
|
const binaryStable = appInstalled
|
|
206
207
|
&& previousStamp?.schema === stamp.schema
|
|
207
208
|
&& previousStamp.package_version === stamp.package_version
|
|
@@ -213,7 +214,7 @@ export async function installSksMenuBar(opts = {}) {
|
|
|
213
214
|
actions.push('menubar_up_to_date');
|
|
214
215
|
}
|
|
215
216
|
else {
|
|
216
|
-
if (
|
|
217
|
+
if (currentActionScript !== actionScript) {
|
|
217
218
|
await writeTextAtomic(paths.action_script_path, actionScript);
|
|
218
219
|
actions.push(`wrote ${paths.action_script_path}`);
|
|
219
220
|
}
|
|
@@ -342,6 +343,7 @@ export async function installSksMenuBar(opts = {}) {
|
|
|
342
343
|
menu_items: MENU_ITEMS,
|
|
343
344
|
actions,
|
|
344
345
|
launch: { requested: false, method: 'none', ok: false, error: detail || reason },
|
|
346
|
+
target_check: lastTargetCheck,
|
|
345
347
|
build_stamp: null,
|
|
346
348
|
tcc_automation_status: 'unknown',
|
|
347
349
|
secret_env_cleanup: secretEnvCleanup,
|
|
@@ -394,7 +396,7 @@ async function writeDefaultMenuBarConfig(configPath, codexBundleId) {
|
|
|
394
396
|
const previous = await readMenuBarConfig(configPath);
|
|
395
397
|
const config = {
|
|
396
398
|
schema: 'sks.sks-menubar-config.v1',
|
|
397
|
-
codex_bundle_id: codexBundleId,
|
|
399
|
+
codex_bundle_id: codexBundleId || previous.codex_bundle_id,
|
|
398
400
|
quit_with_codex: previous.quit_with_codex === true
|
|
399
401
|
};
|
|
400
402
|
await writeJsonAtomic(configPath, config);
|
|
@@ -691,16 +693,15 @@ async function resolveSksEntryForInstall(input) {
|
|
|
691
693
|
if (projectLocal) {
|
|
692
694
|
input.warnings.push('sks_entry_project_local');
|
|
693
695
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
input.warnings.push('sks_entry_unresolved_kept_previous_script');
|
|
696
|
+
if (!existsResolved && await exists(input.actionScriptPath))
|
|
697
|
+
input.warnings.push('sks_entry_unresolved_stale_action_script_not_reused');
|
|
697
698
|
return {
|
|
698
699
|
requested: input.explicit ? path.resolve(input.explicit) : null,
|
|
699
700
|
resolved: existsResolved ? resolved : null,
|
|
700
701
|
packaged,
|
|
701
702
|
exists: existsResolved,
|
|
702
703
|
project_local: projectLocal,
|
|
703
|
-
used_previous_script:
|
|
704
|
+
used_previous_script: false
|
|
704
705
|
};
|
|
705
706
|
}
|
|
706
707
|
export function actionScriptSource(input) {
|
|
@@ -873,6 +874,51 @@ func clipped(_ value: String, limit: Int = 700) -> String {
|
|
|
873
874
|
return String(value.prefix(limit))
|
|
874
875
|
}
|
|
875
876
|
|
|
877
|
+
// sks commands report failures as JSON ({reason|status|error|blockers[]|guidance[]}
|
|
878
|
+
// as short snake_case codes), which read as opaque "error codes" if dumped raw into
|
|
879
|
+
// an alert. Extract the readable parts and translate known codes into plain English;
|
|
880
|
+
// unknown codes fall back to "snake_case -> Words" rather than staying cryptic, and
|
|
881
|
+
// genuinely non-JSON output (already plain text) passes through unchanged.
|
|
882
|
+
func humanizeSksFailure(_ text: String) -> String {
|
|
883
|
+
let trimmed = text.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
884
|
+
guard let data = trimmed.data(using: .utf8),
|
|
885
|
+
let obj = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else {
|
|
886
|
+
return text
|
|
887
|
+
}
|
|
888
|
+
var lines: [String] = []
|
|
889
|
+
if let reason = obj["reason"] as? String {
|
|
890
|
+
lines.append(humanizeSksCode(reason))
|
|
891
|
+
} else if let status = obj["status"] as? String, !["ok", "pass", "verified", "verified_partial"].contains(status) {
|
|
892
|
+
lines.append(humanizeSksCode(status))
|
|
893
|
+
}
|
|
894
|
+
if let errorMessage = obj["error"] as? String, !errorMessage.isEmpty {
|
|
895
|
+
lines.append(errorMessage)
|
|
896
|
+
}
|
|
897
|
+
if let blockers = obj["blockers"] as? [String], !blockers.isEmpty {
|
|
898
|
+
lines.append(contentsOf: blockers.map { "- " + humanizeSksCode($0) })
|
|
899
|
+
}
|
|
900
|
+
if let guidance = obj["guidance"] as? [String], !guidance.isEmpty {
|
|
901
|
+
lines.append("")
|
|
902
|
+
lines.append(contentsOf: guidance)
|
|
903
|
+
}
|
|
904
|
+
return lines.isEmpty ? text : lines.joined(separator: "\\n")
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
func humanizeSksCode(_ code: String) -> String {
|
|
908
|
+
let known: [String: String] = [
|
|
909
|
+
"missing_host_or_base_url": "No domain or base URL was entered.",
|
|
910
|
+
"missing_api_key": "No API key was entered.",
|
|
911
|
+
"setup_needed": "codex-lb is not configured yet.",
|
|
912
|
+
"cancelled": "Setup was cancelled.",
|
|
913
|
+
"process_only_cancelled": "Setup was cancelled (process-only mode was not confirmed).",
|
|
914
|
+
"process_only_requires_yes": "This setup would only be kept for the current session — nothing durable was saved."
|
|
915
|
+
]
|
|
916
|
+
if let mapped = known[code] { return mapped }
|
|
917
|
+
let words = code.split(separator: "_").joined(separator: " ")
|
|
918
|
+
guard let first = words.first else { return code }
|
|
919
|
+
return String(first).uppercased() + words.dropFirst()
|
|
920
|
+
}
|
|
921
|
+
|
|
876
922
|
func showAlert(_ message: String, informative: String = "") {
|
|
877
923
|
DispatchQueue.main.async {
|
|
878
924
|
NSApp.activate(ignoringOtherApps: true)
|
|
@@ -915,6 +961,11 @@ func promptChoice(title: String, message: String, options: [String]) -> String?
|
|
|
915
961
|
return popup.titleOfSelectedItem
|
|
916
962
|
}
|
|
917
963
|
|
|
964
|
+
func parseJsonObject(_ text: String) -> [String: Any]? {
|
|
965
|
+
guard let data = text.data(using: .utf8) else { return nil }
|
|
966
|
+
return (try? JSONSerialization.jsonObject(with: data, options: [])) as? [String: Any]
|
|
967
|
+
}
|
|
968
|
+
|
|
918
969
|
func runProcess(_ executable: String, _ args: [String] = [], stdinText: String? = nil, completion: ((Int32, String) -> Void)? = nil) {
|
|
919
970
|
let process = Process()
|
|
920
971
|
let output = Pipe()
|
|
@@ -1007,6 +1058,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
|
|
|
1007
1058
|
var statusLineItem: NSMenuItem!
|
|
1008
1059
|
var codexLbItem: NSMenuItem!
|
|
1009
1060
|
var oauthItem: NSMenuItem!
|
|
1061
|
+
var fastModeOnItem: NSMenuItem!
|
|
1062
|
+
var fastModeOffItem: NSMenuItem!
|
|
1010
1063
|
var timer: Timer?
|
|
1011
1064
|
var busy = false
|
|
1012
1065
|
var lastFailure = false
|
|
@@ -1032,6 +1085,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
|
|
|
1032
1085
|
add(menu, "Set codex-lb Domain and Key", #selector(setCodexLbDomainAndKey))
|
|
1033
1086
|
menu.addItem(NSMenuItem.separator())
|
|
1034
1087
|
add(menu, "Set OpenRouter Key and GLM Profiles", #selector(setOpenRouterKey))
|
|
1088
|
+
fastModeOnItem = add(menu, "Fast Mode On", #selector(fastModeOn))
|
|
1089
|
+
fastModeOffItem = add(menu, "Fast Mode Off", #selector(fastModeOff))
|
|
1035
1090
|
add(menu, "Fast Check", #selector(fastCheck))
|
|
1036
1091
|
add(menu, "SKS Version Check", #selector(sksVersionCheck))
|
|
1037
1092
|
add(menu, "Update SKS Now", #selector(updateSksNow))
|
|
@@ -1051,6 +1106,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
|
|
|
1051
1106
|
func menuWillOpen(_ menu: NSMenu) {
|
|
1052
1107
|
updateState()
|
|
1053
1108
|
updateAuthModeChecks()
|
|
1109
|
+
updateFastModeChecks()
|
|
1054
1110
|
}
|
|
1055
1111
|
|
|
1056
1112
|
func configureStatusButton(_ button: NSStatusBarButton, title: String) {
|
|
@@ -1140,7 +1196,7 @@ ${codexLifecycleSource}
|
|
|
1140
1196
|
if code == 0 {
|
|
1141
1197
|
showNotification(title, "OK\\n" + redacted)
|
|
1142
1198
|
} else {
|
|
1143
|
-
showAlert(title + " failed", informative: redacted)
|
|
1199
|
+
showAlert(title + " failed", informative: humanizeSksFailure(redacted))
|
|
1144
1200
|
}
|
|
1145
1201
|
}
|
|
1146
1202
|
completion?(code, redacted)
|
|
@@ -1152,6 +1208,15 @@ ${codexLifecycleSource}
|
|
|
1152
1208
|
runSksCapture(args, title: title, stdinText: stdinText, notify: true, completion: completion)
|
|
1153
1209
|
}
|
|
1154
1210
|
|
|
1211
|
+
func runSksSilent(_ args: [String], completion: ((Int32, String) -> Void)? = nil) {
|
|
1212
|
+
runProcess(actionScript, args) { code, output in
|
|
1213
|
+
let redacted = redactSecrets(output)
|
|
1214
|
+
DispatchQueue.main.async {
|
|
1215
|
+
completion?(code, redacted)
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1155
1220
|
func startSksDetached(_ args: [String], title: String) {
|
|
1156
1221
|
let process = Process()
|
|
1157
1222
|
process.executableURL = URL(fileURLWithPath: actionScript)
|
|
@@ -1170,15 +1235,30 @@ ${codexLifecycleSource}
|
|
|
1170
1235
|
}
|
|
1171
1236
|
|
|
1172
1237
|
func updateAuthModeChecks() {
|
|
1173
|
-
|
|
1238
|
+
runSksSilent(["codex-lb", "status", "--json"]) { [weak self] code, output in
|
|
1174
1239
|
guard let self = self else { return }
|
|
1175
|
-
let
|
|
1176
|
-
let
|
|
1240
|
+
let json = parseJsonObject(output)
|
|
1241
|
+
let selected = json?["selected"] as? Bool == true
|
|
1242
|
+
let provider = (json?["model_provider"] as? String)?.lowercased() == "codex-lb"
|
|
1243
|
+
let mode = (json?["mode"] as? String)?.lowercased() == "codex-lb"
|
|
1244
|
+
let codexLbActive = code == 0 && (selected || provider || mode)
|
|
1177
1245
|
self.codexLbItem.state = codexLbActive ? .on : .off
|
|
1178
1246
|
self.oauthItem.state = codexLbActive ? .off : .on
|
|
1179
1247
|
}
|
|
1180
1248
|
}
|
|
1181
1249
|
|
|
1250
|
+
func updateFastModeChecks() {
|
|
1251
|
+
runSksSilent(["fast-mode", "status", "--json"]) { [weak self] code, output in
|
|
1252
|
+
guard let self = self else { return }
|
|
1253
|
+
let json = parseJsonObject(output)
|
|
1254
|
+
let fastMode = json?["fast_mode"] as? Bool == true
|
|
1255
|
+
let serviceTier = (json?["service_tier"] as? String)?.lowercased()
|
|
1256
|
+
let fastActive = code == 0 && (fastMode || serviceTier == "fast" || serviceTier == "priority")
|
|
1257
|
+
self.fastModeOnItem.state = fastActive ? .on : .off
|
|
1258
|
+
self.fastModeOffItem.state = fastActive ? .off : .on
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1182
1262
|
@objc func useCodexLb() {
|
|
1183
1263
|
runSksBackground(["codex-lb", "use-codex-lb", "--json"], title: "Use codex-lb") { [weak self] code, _ in
|
|
1184
1264
|
if code == 0 { self?.updateAuthModeChecks() }
|
|
@@ -1192,7 +1272,7 @@ ${codexLifecycleSource}
|
|
|
1192
1272
|
}
|
|
1193
1273
|
|
|
1194
1274
|
@objc func setCodexLbDomainAndKey() {
|
|
1195
|
-
guard let domain = promptText(title: "Set codex-lb Domain", message: "Enter your codex-lb domain or base URL.", placeholder: "
|
|
1275
|
+
guard let domain = promptText(title: "Set codex-lb Domain", message: "Enter just your codex-lb domain or base URL — the /backend-api/codex path is added automatically.", placeholder: "lb.example.com") else { return }
|
|
1196
1276
|
guard let key = promptText(title: "Set codex-lb Key", message: "Enter your codex-lb API key.", placeholder: "sk-clb-...", secure: true) else { return }
|
|
1197
1277
|
runSksBackground(["codex-lb", "setup", "--host", domain, "--api-key-stdin", "--yes", "--json"], title: "Set codex-lb", stdinText: key + "\\n") { [weak self] code, _ in
|
|
1198
1278
|
if code == 0 { self?.updateAuthModeChecks() }
|
|
@@ -1204,6 +1284,18 @@ ${codexLifecycleSource}
|
|
|
1204
1284
|
runSksBackground(["codex-app", "set-openrouter-key", "--api-key-stdin", "--json"], title: "Set OpenRouter Key", stdinText: key + "\\n")
|
|
1205
1285
|
}
|
|
1206
1286
|
|
|
1287
|
+
@objc func fastModeOn() {
|
|
1288
|
+
runSksBackground(["fast-mode", "on", "--json"], title: "Fast Mode On") { [weak self] code, _ in
|
|
1289
|
+
if code == 0 { self?.updateFastModeChecks() }
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
@objc func fastModeOff() {
|
|
1294
|
+
runSksBackground(["fast-mode", "off", "--json"], title: "Fast Mode Off") { [weak self] code, _ in
|
|
1295
|
+
if code == 0 { self?.updateFastModeChecks() }
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1207
1299
|
@objc func fastCheck() {
|
|
1208
1300
|
runSksBackground(["codex-lb", "fast-check"], title: "SKS Fast Check")
|
|
1209
1301
|
}
|
|
@@ -256,14 +256,18 @@ async function executeRouteCommand(root, route, prompt, { auto = false } = {}) {
|
|
|
256
256
|
// that never saw the prompt cannot claim to have addressed it.
|
|
257
257
|
const isMockFallback = commandArgs.includes('--mock');
|
|
258
258
|
const promptDelivered = Boolean(prompt) && commandArgs.includes(prompt);
|
|
259
|
+
const deterministicRoute = isSafeDeterministicRoute(route.command);
|
|
259
260
|
const result = await runSks(root, commandArgs);
|
|
260
261
|
return routeExecutionResult(route, ['sks', ...commandArgs].join(' '), result, {
|
|
261
262
|
okStatus: isMockFallback ? 'verified_partial' : 'completed',
|
|
262
263
|
trustStatus: isMockFallback ? 'mock_only' : 'verified_partial',
|
|
263
|
-
executionKind: isMockFallback ? 'mock_safe' : 'live_route',
|
|
264
|
+
executionKind: isMockFallback ? 'mock_safe' : deterministicRoute ? 'safe_deterministic' : 'live_route',
|
|
264
265
|
promptDelivered,
|
|
265
266
|
});
|
|
266
267
|
}
|
|
268
|
+
function isSafeDeterministicRoute(command) {
|
|
269
|
+
return new Set(['$DB', '$Wiki', '$Fast-Mode', '$with-local-llm-on', '$Commit', '$Commit-And-Push']).has(command);
|
|
270
|
+
}
|
|
267
271
|
async function runAutoVerification(root, missionId) {
|
|
268
272
|
const trust = await runSks(root, ['trust', 'validate', missionId, '--json']);
|
|
269
273
|
const status = await runSks(root, ['status', '--json']);
|
|
@@ -17,6 +17,7 @@ import { validateImageVoxelLedger } from '../wiki-image/validation.js';
|
|
|
17
17
|
import { maybeFinalizeRoute } from '../proof/auto-finalize.js';
|
|
18
18
|
import { wikiWrongnessCommand } from '../triwiki-wrongness/wrongness-cli.js';
|
|
19
19
|
import { wrongnessContextForRoute } from '../triwiki-wrongness/wrongness-retrieval.js';
|
|
20
|
+
import { readCombinedWrongnessRecords } from '../triwiki-wrongness/wrongness-ledger.js';
|
|
20
21
|
import { recordImageWrongnessFromValidation } from '../triwiki-wrongness/image-wrongness.js';
|
|
21
22
|
import { publishSharedMemory, rebuildSharedIndexes, sharedMemorySummary, validateSharedMemory } from '../git-hygiene/shared-memory-publish.js';
|
|
22
23
|
import { scanCodebaseIndex } from '../triwiki/code-index-scanner.js';
|
|
@@ -249,6 +250,21 @@ async function wikiRefreshCode(args = []) {
|
|
|
249
250
|
/** Cheap freshness check: compares the code pack's recorded git HEAD sha (at
|
|
250
251
|
* generation time) against the current HEAD. Any uncertainty (no pack, no git,
|
|
251
252
|
* spawn failure) resolves to 'stale' rather than 'fresh', never overclaiming. */
|
|
253
|
+
/** Active-wrongness counts per TriWiki module id (from wrongness records' module_ids),
|
|
254
|
+
* so attention can hydrate frequently-wrong modules' code entries first. */
|
|
255
|
+
async function buildWrongnessByModule(root) {
|
|
256
|
+
const records = await readCombinedWrongnessRecords(root, null).catch(() => []);
|
|
257
|
+
const counts = {};
|
|
258
|
+
for (const record of records) {
|
|
259
|
+
if (record?.status && record.status !== 'active')
|
|
260
|
+
continue;
|
|
261
|
+
for (const moduleId of Array.isArray(record?.module_ids) ? record.module_ids : []) {
|
|
262
|
+
if (moduleId)
|
|
263
|
+
counts[moduleId] = (counts[moduleId] || 0) + 1;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return counts;
|
|
267
|
+
}
|
|
252
268
|
async function codePackFreshness(root) {
|
|
253
269
|
const packPath = path.join(root, '.sneakoscope', 'wiki', 'code-pack.json');
|
|
254
270
|
if (!(await exists(packPath)))
|
|
@@ -383,6 +399,7 @@ export async function writeWikiContextPack(root, args = [], opts = {}) {
|
|
|
383
399
|
const maxAnchors = Number(readFlagValue(args, '--max-anchors', role.includes('verifier') ? 48 : 32));
|
|
384
400
|
const codePackData = await readJson(path.join(root, '.sneakoscope', 'wiki', 'code-pack.json'), null).catch(() => null);
|
|
385
401
|
const codePackEntries = Array.isArray(codePackData?.entries) ? codePackData.entries : [];
|
|
402
|
+
const wrongnessByModule = await buildWrongnessByModule(root);
|
|
386
403
|
const pack = contextCapsule({
|
|
387
404
|
mission: { id: 'project-wiki', coord: { rgba: { r: 48, g: 132, b: 212, a: 240 } } },
|
|
388
405
|
role,
|
|
@@ -391,7 +408,8 @@ export async function writeWikiContextPack(root, args = [], opts = {}) {
|
|
|
391
408
|
q4: { mode: 'project-continuity', package: PACKAGE_VERSION, hydrate: 'anchor-first' },
|
|
392
409
|
q3: ['sks', 'llm-wiki', 'wiki-coordinate', 'gx', 'skills'],
|
|
393
410
|
budget: { maxWikiAnchors: maxAnchors, includeTrustSummary: true },
|
|
394
|
-
codePackEntries
|
|
411
|
+
codePackEntries,
|
|
412
|
+
wrongnessByModule
|
|
395
413
|
});
|
|
396
414
|
const wrongnessContext = await wrongnessContextForRoute(root, { route: '$Wiki', limit: 12 });
|
|
397
415
|
// buildTriWikiAttention's use_first/hydrate_first can reference code: ids that were
|
|
@@ -141,10 +141,10 @@ const FIXTURES = Object.freeze({
|
|
|
141
141
|
'route-swarm': fixture('execute_and_validate_artifacts', 'sks naruto run "fixture" --backend fake --work-items 4 --json', ['naruto-gate.json', 'work-order-ledger.json'], 'pass', { timeout_ms: 285000, reason: 'Same as route-work: naruto-command.ts never invokes the completion-proof pipeline.' }),
|
|
142
142
|
'route-plan': fixture('execute', 'sks plan "fixture" --json', [], 'pass'),
|
|
143
143
|
'route-review': fixture('execute', 'sks review --diff HEAD --json', [], 'pass'),
|
|
144
|
-
'route-shadowclone': fixture('
|
|
144
|
+
'route-shadowclone': fixture('static', '$ShadowClone alias of $Naruto shadow-clone swarm route', [], 'pass', {
|
|
145
145
|
reason: 'Pure alias of $Naruto; no independent behavior to verify beyond route-naruto\'s own execute_and_validate_artifacts fixture.'
|
|
146
146
|
}),
|
|
147
|
-
'route-kagebunshin': fixture('
|
|
147
|
+
'route-kagebunshin': fixture('static', '$Kagebunshin alias of $Naruto shadow-clone swarm route', [], 'pass', {
|
|
148
148
|
reason: 'Pure alias of $Naruto; no independent behavior to verify beyond route-naruto\'s own execute_and_validate_artifacts fixture.'
|
|
149
149
|
}),
|
|
150
150
|
'route-qa-loop': fixture('execute_and_validate_artifacts', 'sks qa-loop run latest --mock --json', ['completion-proof.json', 'qa-gate.json'], 'blocked', { timeout_ms: 180000, reason: 'qaLoopRun() resolves "latest" via the same globally-unscoped findLatestMission used everywhere else and qa-loop is a two-step prepare-then-run workflow gated between steps by an active-route-not-closed check a single fixture command cannot express.' }),
|
|
@@ -152,11 +152,11 @@ const FIXTURES = Object.freeze({
|
|
|
152
152
|
'route-ppt': fixture('mock', 'sks ppt fixture --mock --json', ['completion-proof.json', { path: 'image-voxel-ledger.json', schema: 'sks.image-voxel-ledger.v1' }, 'ppt-imagegen-review-gate.json', 'ppt-slide-issue-ledger.json'], 'pass', { reason: 'Underlying command intentionally exits non-zero and reports ok:false by honest design (mockPptFixtureGate() hardcodes a blocked mock PPT gate); it does write all four declared artifacts.' }),
|
|
153
153
|
'route-image-ux-review': fixture('mock', 'sks image-ux-review fixture --mock --json', ['completion-proof.json', { path: 'image-voxel-ledger.json', schema: 'sks.image-voxel-ledger.v1' }, 'image-ux-generated-review-ledger.json'], 'pass', { reason: 'imageUxFixture() intentionally overrides the gate to passed:false/execution_class:mock_fixture and always exits non-zero for mock fixture runs so they can never claim a real pass; it does write the declared artifacts.' }),
|
|
154
154
|
'route-computer-use': fixture('execute_and_validate_artifacts', 'sks computer-use import-fixture --mock --json', ['computer-use-evidence-ledger.json', { path: 'image-voxel-ledger.json', schema: 'sks.image-voxel-ledger.v1' }, 'completion-proof.json'], 'blocked', { reason: 'importFixture() unconditionally sets process.exitCode=1 by design (execution_class: mock_fixture) so a mock Computer Use import can never claim a real pass.' }),
|
|
155
|
-
'route-cu': fixture('
|
|
156
|
-
reason: '
|
|
155
|
+
'route-cu': fixture('execute_and_validate_artifacts', 'sks computer-use import-fixture --mock --json', ['computer-use-evidence-ledger.json', { path: 'image-voxel-ledger.json', schema: 'sks.image-voxel-ledger.v1' }, 'completion-proof.json'], 'blocked', {
|
|
156
|
+
reason: 'Same handler as route-computer-use: importFixture() unconditionally sets process.exitCode=1 by design (execution_class: mock_fixture) so a mock Computer Use import can never claim a real pass. execute_and_validate_artifacts already treats a matching claimed_status:\'blocked\' as ok (see feature-fixture-executor.ts\'s statusMatches check), so no special-casing is needed - upgraded from the previous mock registration to get real command-exit and artifact-schema verification.'
|
|
157
157
|
}),
|
|
158
158
|
'route-dfix': fixture('execute_and_validate_artifacts', 'sks dfix fixture --json', ['completion-proof.json', 'dfix-gate.json', 'dfix-verification.json'], 'pass'),
|
|
159
|
-
'route-answer': fixture('
|
|
159
|
+
'route-answer': fixture('static', '$Answer answer-only route policy', [], 'pass', {
|
|
160
160
|
reason: 'Policy-only route (answer-only conversational mode with no writes); nothing executable to run beyond static contract text.'
|
|
161
161
|
}),
|
|
162
162
|
'route-goal': fixture('mock', '$Goal bridge route', ['goal-workflow.json', 'completion-proof.json'], 'pass', {
|
|
@@ -183,24 +183,24 @@ const FIXTURES = Object.freeze({
|
|
|
183
183
|
}),
|
|
184
184
|
'route-wiki': fixture('execute_and_validate_artifacts', 'sks wiki image-ingest test/fixtures/images/one-by-one.png --json', [{ path: 'completion-proof.json', schema: 'sks.completion-proof.v1' }, { path: 'image-voxel-ledger.json', schema: 'sks.image-voxel-ledger.v1' }], 'pass'),
|
|
185
185
|
'route-gx': fixture('execute_and_validate_artifacts', 'sks gx validate fixture --mock --json', ['completion-proof.json', { path: 'image-voxel-ledger.json', schema: 'sks.image-voxel-ledger.v1' }, 'gx-validation.json'], 'blocked', { reason: 'gxValidateFixture() intentionally exits non-zero (execution_class: mock_fixture) for an honest mock/blocked result; it does write all three declared artifacts.' }),
|
|
186
|
-
'route-sks': fixture('
|
|
186
|
+
'route-sks': fixture('static', '$SKS control-surface route', ['completion-proof.json'], 'pass', {
|
|
187
187
|
reason: 'Pure control-surface alias route with no independent behavior beyond the underlying CLI command fixtures it dispatches to.'
|
|
188
188
|
}),
|
|
189
189
|
'route-fast-mode': fixture('execute', 'sks fast-mode status --json', [], 'pass'),
|
|
190
|
-
'route-fast-on': fixture('
|
|
190
|
+
'route-fast-on': fixture('static', '$Fast-On covered by hermetic fast-mode blackbox toggle test', [], 'pass', {
|
|
191
191
|
reason: 'Toggle-only dollar-command alias; behavior is covered by the hermetic fast-mode blackbox toggle test suite, not a standalone CLI invocation.'
|
|
192
192
|
}),
|
|
193
|
-
'route-fast-off': fixture('
|
|
193
|
+
'route-fast-off': fixture('static', '$Fast-Off covered by hermetic fast-mode blackbox toggle test', [], 'pass', {
|
|
194
194
|
reason: 'Toggle-only dollar-command alias; behavior is covered by the hermetic fast-mode blackbox toggle test suite, not a standalone CLI invocation.'
|
|
195
195
|
}),
|
|
196
196
|
'route-local-model': fixture('execute', 'sks with-local-llm status --json', [], 'pass'),
|
|
197
|
-
'route-with-local-llm-on': fixture('
|
|
197
|
+
'route-with-local-llm-on': fixture('static', '$with-local-llm-on covered by hermetic local-model dollar-command blackbox toggle test', [], 'pass', {
|
|
198
198
|
reason: 'Toggle-only dollar-command alias; behavior is covered by the hermetic local-model dollar-command blackbox toggle test suite, not a standalone CLI invocation.'
|
|
199
199
|
}),
|
|
200
|
-
'route-with-local-llm-off': fixture('
|
|
200
|
+
'route-with-local-llm-off': fixture('static', '$with-local-llm-off covered by hermetic local-model dollar-command blackbox toggle test', [], 'pass', {
|
|
201
201
|
reason: 'Toggle-only dollar-command alias; behavior is covered by the hermetic local-model dollar-command blackbox toggle test suite, not a standalone CLI invocation.'
|
|
202
202
|
}),
|
|
203
|
-
'route-help': fixture('
|
|
203
|
+
'route-help': fixture('static', '$Help lightweight route', [], 'pass', {
|
|
204
204
|
reason: 'Pure alias of the cli-help command; no independent behavior to verify beyond cli-help\'s own execute fixture.'
|
|
205
205
|
}),
|
|
206
206
|
'route-commit': fixture('mock', '$Commit git route', ['completion-proof.json'], 'pass', {
|
package/dist/core/fsx.js
CHANGED
|
@@ -5,7 +5,7 @@ import os from 'node:os';
|
|
|
5
5
|
import crypto from 'node:crypto';
|
|
6
6
|
import { spawn } from 'node:child_process';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
|
-
export const PACKAGE_VERSION = '5.
|
|
8
|
+
export const PACKAGE_VERSION = '5.7.0';
|
|
9
9
|
export const DEFAULT_PROCESS_TAIL_BYTES = 256 * 1024;
|
|
10
10
|
export const DEFAULT_PROCESS_TIMEOUT_MS = 30 * 60 * 1000;
|
|
11
11
|
export function nowIso() {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { exists, readJson, runProcess } from '../fsx.js';
|
|
3
|
+
/** Bounded, non-blocking code-pack staleness nudge for the user-prompt-submit hook.
|
|
4
|
+
*
|
|
5
|
+
* Returns a one-line context note when a published code pack
|
|
6
|
+
* (.sneakoscope/wiki/code-pack.json) exists but was generated against a different
|
|
7
|
+
* git HEAD than the current one — i.e. the codebase moved and the LLM-facing code
|
|
8
|
+
* summaries are now out of date. Returns null (silent) when there is no pack at all
|
|
9
|
+
* (repos that never opted into `sks wiki refresh --code` must not be nagged) or when
|
|
10
|
+
* the check can't complete cheaply. It NEVER regenerates the pack and NEVER blocks:
|
|
11
|
+
* the whole check is one JSON read plus one `git rev-parse HEAD`, wrapped in a hard
|
|
12
|
+
* timeout so it cannot blow the hook latency budget. Any failure resolves to null. */
|
|
13
|
+
export async function codePackFreshnessNote(root, opts = {}) {
|
|
14
|
+
const budgetMs = opts.budgetMs ?? 250;
|
|
15
|
+
return raceWithTimeout(computeNote(root), budgetMs).catch(() => null);
|
|
16
|
+
}
|
|
17
|
+
async function computeNote(root) {
|
|
18
|
+
const packPath = path.join(root, '.sneakoscope', 'wiki', 'code-pack.json');
|
|
19
|
+
if (!(await exists(packPath)))
|
|
20
|
+
return null;
|
|
21
|
+
const pack = await readJson(packPath, null).catch(() => null);
|
|
22
|
+
const packSha = pack?.git_head_sha || null;
|
|
23
|
+
// A pack with no recorded sha (non-git build) can't be compared; stay silent
|
|
24
|
+
// rather than nag with a comparison we can't actually make.
|
|
25
|
+
if (!packSha)
|
|
26
|
+
return null;
|
|
27
|
+
const head = await runProcess('git', ['rev-parse', 'HEAD'], { cwd: root, timeoutMs: 200 }).catch(() => null);
|
|
28
|
+
const currentSha = head && head.code === 0 ? String(head.stdout || '').trim() : null;
|
|
29
|
+
if (!currentSha || currentSha === packSha)
|
|
30
|
+
return null;
|
|
31
|
+
return 'SKS note: the codebase code pack is stale (HEAD moved since it was built). Run `sks wiki refresh --code` to refresh source-cited code context.';
|
|
32
|
+
}
|
|
33
|
+
async function raceWithTimeout(work, ms) {
|
|
34
|
+
let timer = null;
|
|
35
|
+
const timeout = new Promise((resolve) => {
|
|
36
|
+
timer = setTimeout(() => resolve(null), ms);
|
|
37
|
+
if (timer.unref)
|
|
38
|
+
timer.unref();
|
|
39
|
+
});
|
|
40
|
+
try {
|
|
41
|
+
return await Promise.race([work, timeout]);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
if (timer)
|
|
45
|
+
clearTimeout(timer);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=code-pack-freshness-preflight.js.map
|
|
@@ -18,6 +18,7 @@ import { scanAgentTextForRecursion } from './agents/agent-recursion-guard.js';
|
|
|
18
18
|
import { evaluateLoopContinuation } from './loops/loop-continuation-enforcer.js';
|
|
19
19
|
import { diagnosticPromptAllowedDuringNoQuestions } from './routes/diagnostic-allowlist.js';
|
|
20
20
|
import { maybeReconcileProjectSkillsPreflight } from './hooks-runtime/skill-reconcile-preflight.js';
|
|
21
|
+
import { codePackFreshnessNote } from './hooks-runtime/code-pack-freshness-preflight.js';
|
|
21
22
|
import { buildCompactContinue, buildPermissionRequestAllow, buildPermissionRequestDeny, buildPostToolUseBlock, buildPostToolUseContinue, buildPreToolUseContinue, buildPreToolUseDeny, buildSessionStartContinue, buildStopBlock, buildStopContinue, buildSubagentStartContinue, buildSubagentStopBlock, buildSubagentStopContinue, buildUserPromptSubmitBlock, buildUserPromptSubmitContinue } from './codex-compat/codex-hook-output-builders.js';
|
|
22
23
|
import { joinSystemMessages, teamLiveDigest } from './hooks-runtime/team-digest.js';
|
|
23
24
|
const STOP_REPEAT_GUARD_ARTIFACT = 'stop-hook-repeat-guard.json';
|
|
@@ -340,6 +341,9 @@ async function hookUserPrompt(root, state, payload, noQuestion, sessionKey = nul
|
|
|
340
341
|
contexts.push(goalOverlay);
|
|
341
342
|
if (teamDigest?.context)
|
|
342
343
|
contexts.push(teamDigest.context);
|
|
344
|
+
const codePackNote = await codePackFreshnessNote(root);
|
|
345
|
+
if (codePackNote)
|
|
346
|
+
contexts.push(codePackNote);
|
|
343
347
|
const additionalContext = contexts.filter(Boolean).join('\n\n');
|
|
344
348
|
return { continue: true, additionalContext, systemMessage: joinSystemMessages(visibleHookMessage('user-prompt-submit', additionalContext), teamDigest?.system) };
|
|
345
349
|
}
|
|
@@ -231,10 +231,12 @@ function uniqueAttentionRows(rows = [], max = 4) {
|
|
|
231
231
|
* for the same fixed slot budget would make their appearance arbitrary. Each surviving
|
|
232
232
|
* entry becomes a use_first row (bare id, no fabricated RGBA) plus a hydrate_first row
|
|
233
233
|
* pointing at its source citations, so a consumer knows which real files back it. */
|
|
234
|
-
function codePackAttentionRows(codePackEntries = [], tokenBudget = 2000) {
|
|
234
|
+
function codePackAttentionRows(codePackEntries = [], tokenBudget = 2000, wrongnessByModule = {}) {
|
|
235
|
+
const moduleWrongness = (entryId) => Number(wrongnessByModule[String(entryId || '').replace(/^code:/, '')] || 0);
|
|
235
236
|
const sorted = [...(codePackEntries || [])]
|
|
236
237
|
.filter((entry) => entry && typeof entry.id === 'string')
|
|
237
|
-
|
|
238
|
+
// Modules SKS has been wrong about before are worth re-reading first, then rank by trust.
|
|
239
|
+
.sort((a, b) => (moduleWrongness(b.id) - moduleWrongness(a.id)) || (Number(b.trust_score || 0) - Number(a.trust_score || 0)));
|
|
238
240
|
const useFirst = [];
|
|
239
241
|
const hydrateFirst = [];
|
|
240
242
|
let tokens = 0;
|
|
@@ -245,12 +247,17 @@ function codePackAttentionRows(codePackEntries = [], tokenBudget = 2000) {
|
|
|
245
247
|
tokens += cost;
|
|
246
248
|
useFirst.push([entry.id, null, null]);
|
|
247
249
|
const citationPaths = Array.isArray(entry.citations) ? entry.citations.map((c) => c?.path).filter(Boolean) : [];
|
|
248
|
-
|
|
249
|
-
|
|
250
|
+
const citationReason = citationPaths.length ? `code_citations:${citationPaths.join(',')}` : null;
|
|
251
|
+
const wrongCount = moduleWrongness(entry.id);
|
|
252
|
+
// A module with past wrongness earns a hydrate row even without citations, tagged
|
|
253
|
+
// with a wrongness:<count> signal so a consumer re-reads it before trusting recall.
|
|
254
|
+
const reason = wrongCount > 0 ? `wrongness:${wrongCount}${citationReason ? `;${citationReason}` : ''}` : citationReason;
|
|
255
|
+
if (reason)
|
|
256
|
+
hydrateFirst.push([entry.id, reason]);
|
|
250
257
|
}
|
|
251
258
|
return { useFirst, hydrateFirst };
|
|
252
259
|
}
|
|
253
|
-
export function buildTriWikiAttention({ selected = [], wiki = {}, role = 'worker', maxUse = 4, maxHydrate = 4, codePackEntries = [], codePackTokenBudget = 2000 } = {}) {
|
|
260
|
+
export function buildTriWikiAttention({ selected = [], wiki = {}, role = 'worker', maxUse = 4, maxHydrate = 4, codePackEntries = [], codePackTokenBudget = 2000, wrongnessByModule = {} } = {}) {
|
|
254
261
|
const anchors = attentionAnchorMap(wiki);
|
|
255
262
|
const ranked = [...(selected || [])]
|
|
256
263
|
.map((claim, index) => ({ claim, index }))
|
|
@@ -276,7 +283,7 @@ export function buildTriWikiAttention({ selected = [], wiki = {}, role = 'worker
|
|
|
276
283
|
...voxelRows,
|
|
277
284
|
...selectedHydrateRows
|
|
278
285
|
], maxHydrate);
|
|
279
|
-
const codeRows = codePackAttentionRows(codePackEntries, codePackTokenBudget);
|
|
286
|
+
const codeRows = codePackAttentionRows(codePackEntries, codePackTokenBudget, wrongnessByModule);
|
|
280
287
|
return {
|
|
281
288
|
mode: 'aggressive_triwiki_active_recall',
|
|
282
289
|
use_first: uniqueAttentionRows([...useFirst, ...codeRows.useFirst], maxUse + codeRows.useFirst.length),
|
|
@@ -309,7 +316,7 @@ export function geometricOffsets(max = 65536) {
|
|
|
309
316
|
out.push(x);
|
|
310
317
|
return out;
|
|
311
318
|
}
|
|
312
|
-
export function contextCapsule({ mission, role = 'worker', contractHash = null, claims = [], q4 = {}, q3 = [], budget = {}, codePackEntries = [] }) {
|
|
319
|
+
export function contextCapsule({ mission, role = 'worker', contractHash = null, claims = [], q4 = {}, q3 = [], budget = {}, codePackEntries = [], wrongnessByModule = {} }) {
|
|
313
320
|
const trustPolicy = budget.trustPolicy || DEFAULT_TRUST_POLICY;
|
|
314
321
|
const claimsWithTrust = (claims || []).map((claim) => withTrust(claim, trustPolicy));
|
|
315
322
|
const selected = selectClaims(mission, claims, { maxClaims: budget.maxClaims ?? (role.includes('verifier') ? 16 : 9), trustPolicy });
|
|
@@ -342,7 +349,8 @@ export function contextCapsule({ mission, role = 'worker', contractHash = null,
|
|
|
342
349
|
maxUse: budget.maxAttentionUse ?? (role.includes('verifier') ? 7 : 4),
|
|
343
350
|
maxHydrate: budget.maxAttentionHydrate ?? (role.includes('verifier') ? 7 : 4),
|
|
344
351
|
codePackEntries,
|
|
345
|
-
codePackTokenBudget: budget.codePackTokenBudget ?? 2000
|
|
352
|
+
codePackTokenBudget: budget.codePackTokenBudget ?? 2000,
|
|
353
|
+
wrongnessByModule
|
|
346
354
|
}),
|
|
347
355
|
claims: selected.map((c) => {
|
|
348
356
|
const anchor = anchorsById.get(c.id);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { nowIso, randomId, sha256 } from '../fsx.js';
|
|
2
|
+
import { moduleIdsForPath } from '../triwiki/triwiki-module-card.js';
|
|
2
3
|
export const WRONGNESS_RECORD_SCHEMA = 'sks.triwiki-wrongness.v1';
|
|
3
4
|
export const WRONGNESS_LEDGER_SCHEMA = 'sks.triwiki-wrongness-ledger.v1';
|
|
4
5
|
export const WRONGNESS_INDEX_SCHEMA = 'sks.triwiki-wrongness-index.v1';
|
|
@@ -122,6 +123,8 @@ export function createWrongnessRecord(input = {}) {
|
|
|
122
123
|
const avoidanceText = stringOrNull(asRecord(row.avoidance_rule).text)
|
|
123
124
|
|| stringOrNull(row.avoidance_rule)
|
|
124
125
|
|| defaultAvoidanceRule(kind, claim.text);
|
|
126
|
+
const links = normalizeLinks(row.links);
|
|
127
|
+
const moduleIds = moduleIdsForWrongness(links.files);
|
|
125
128
|
return {
|
|
126
129
|
schema: WRONGNESS_RECORD_SCHEMA,
|
|
127
130
|
id: stringOrNull(row.id) || wrongnessId(kind),
|
|
@@ -140,11 +143,25 @@ export function createWrongnessRecord(input = {}) {
|
|
|
140
143
|
corrective_action: normalizeCorrectiveAction(row.corrective_action),
|
|
141
144
|
avoidance_rule: normalizeAvoidanceRule(row.avoidance_rule, kind, avoidanceText, severity),
|
|
142
145
|
correction: normalizeCorrection(row.correction ?? row.corrected_anchor),
|
|
143
|
-
links
|
|
146
|
+
links,
|
|
147
|
+
...(moduleIds.length ? { module_ids: moduleIds } : (Array.isArray(row.module_ids) ? { module_ids: stringList(row.module_ids) } : {})),
|
|
144
148
|
...(row.rule_compiled === undefined ? {} : { rule_compiled: Boolean(row.rule_compiled) }),
|
|
145
149
|
...(row.compiled_rule_id === undefined ? {} : { compiled_rule_id: stringOrNull(row.compiled_rule_id) })
|
|
146
150
|
};
|
|
147
151
|
}
|
|
152
|
+
/** Best-effort module attribution from the wrongness's linked files. Excludes the
|
|
153
|
+
* 'unknown' sentinel moduleIdsForPath returns for unmapped paths, so a record only
|
|
154
|
+
* carries module_ids when at least one file maps to a real TriWiki module. */
|
|
155
|
+
function moduleIdsForWrongness(files) {
|
|
156
|
+
const ids = new Set();
|
|
157
|
+
for (const file of files) {
|
|
158
|
+
for (const id of moduleIdsForPath(String(file || ''))) {
|
|
159
|
+
if (id && id !== 'unknown')
|
|
160
|
+
ids.add(id);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return [...ids];
|
|
164
|
+
}
|
|
148
165
|
export function emptyWrongnessLedger(scope = 'project', missionId = null) {
|
|
149
166
|
return {
|
|
150
167
|
schema: WRONGNESS_LEDGER_SCHEMA,
|