sneakoscope 9.0.5 → 9.0.6
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/dist/commands/doctor.js +97 -98
- package/dist/config/skills-manifest.json +1 -1
- package/dist/core/codex-lb/desktop-bridge/http-forward.js +7 -1
- package/dist/core/commands/basic-cli.js +5 -0
- package/dist/core/doctor/desktop-bridge-catalog-repair.js +102 -0
- package/dist/core/update/update-migration-state/current-public-surface-stage.js +67 -0
- package/dist/core/update/update-migration-state/desktop-bridge-catalog-repair-stage.js +45 -0
- package/dist/core/update/update-migration-state.js +7 -65
- package/dist/core/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Proof-first orchestration for Codex CLI, ChatGPT Desktop, AI coding agents, mult
|
|
|
22
22
|
Sneakoscope Codex (`sks`) is an open-source trust layer for Codex CLI and ChatGPT Desktop. It coordinates bounded AI coding agents, records machine-verifiable evidence, preserves project memory, and blocks release claims that are not supported by current tests or artifacts. Search visibility outcomes are measured separately; SKS does not promise rankings or traffic.
|
|
23
23
|
<!-- END SKS SEARCH VISIBILITY MARKETING -->
|
|
24
24
|
|
|
25
|
-
This README documents package **SKS 9.0.
|
|
25
|
+
This README documents package **SKS 9.0.6** — its own identity, read from `package.json` and subject to release-gate verification, not advice about what to install.
|
|
26
26
|
|
|
27
27
|
Use the official latest stable SKS and Codex CLI releases. The Codex compatibility SSOT is always the **current latest stable** host; capability probes measure what that host can actually do. Product docs do not crown a fixed `0.x.y` string as SSOT (release pins and schema directories are measured artifacts for the current package, not a permanent product version claim). Menu Bar / Center induce updates to the latest stable build. Run `sks update-check` for what is installed and read the capability report for what is supported. Install SSOT is npm `sneakoscope@latest`; PATH `sks` and Menu Bar stamped generation must match that version or gates fail. It resolves managed SKS skills from the authoritative global install, preserves a runnable Naruto child slot when `max_threads=2`, and keeps Menu Bar repair transactional so stamped generations remain verifiable. Naruto uses stable opt-in multi-agent V2 when the host exposes it (Codex official multi-agent wrap-only; SKS does not reimplement a parallel runtime). Local code search is mode-separated (`sks search files|text|structure|symbol|context`); `context` is answered by the compiled TriWiki Context Graph (`context-graph.json` is exhaustive authority; `context-pack.json` and managed `AGENTS.md` are bounded projections) — see [docs/architecture/context-graph.md](https://github.com/mandarange/Sneakoscope-Codex/blob/main/docs/architecture/context-graph.md) and [docs/PRODUCT-CONTRACT.md](https://github.com/mandarange/Sneakoscope-Codex/blob/main/docs/PRODUCT-CONTRACT.md). See [CHANGELOG.md](https://github.com/mandarange/Sneakoscope-Codex/blob/main/CHANGELOG.md).
|
|
28
28
|
|
package/dist/commands/doctor.js
CHANGED
|
@@ -7,10 +7,8 @@ import { ui as cliUi } from '../cli/cli-theme.js';
|
|
|
7
7
|
import { getCodexInfo } from '../core/codex-adapter.js';
|
|
8
8
|
import { rustInfo } from '../core/rust-accelerator.js';
|
|
9
9
|
import { codexAppIntegrationStatus } from '../core/codex-app.js';
|
|
10
|
-
import { desktopBridgeStatusV3
|
|
11
|
-
import {
|
|
12
|
-
import { desktopBridgeRuntimeVersion, desktopBridgeRuntimeVersionStale } from '../core/codex-lb/desktop-bridge/state.js';
|
|
13
|
-
import { PACKAGE_VERSION } from '../core/version.js';
|
|
10
|
+
import { desktopBridgeStatusV3 } from '../core/codex-lb/desktop-controller-v3.js';
|
|
11
|
+
import { repairDoctorDesktopBridgeCatalog } from '../core/doctor/desktop-bridge-catalog-repair.js';
|
|
14
12
|
import { inspectCodexConfigReadability } from '../core/codex/codex-config-readability.js';
|
|
15
13
|
import { inspectOAuthCallbackPortConflict, oauthCallbackDoctorGuidance } from '../core/codex/oauth-callback-port-diagnostic.js';
|
|
16
14
|
import { inventoryCodexPermissionProfiles } from '../core/codex/codex-permission-profiles.js';
|
|
@@ -37,29 +35,7 @@ export { buildCodexAppUiDiagnosticFailure, buildRuntimeReadiness, formatCodexDoc
|
|
|
37
35
|
export function doctorArgWarnings(args = []) {
|
|
38
36
|
return baseDoctorArgWarnings(args);
|
|
39
37
|
}
|
|
40
|
-
export
|
|
41
|
-
if (process.env.SKS_TEST_ISOLATION === '1' || process.env.SKS_RELEASE_UPGRADE_SMOKE === '1') {
|
|
42
|
-
return { restarted: false, warnings: [], blockers: [] };
|
|
43
|
-
}
|
|
44
|
-
const service = await desktopBridgeServiceStatus({ home: input.home }).catch(() => null);
|
|
45
|
-
if (!service?.running || !desktopBridgeRuntimeVersionStale(service.state)) {
|
|
46
|
-
return { restarted: false, warnings: [], blockers: [] };
|
|
47
|
-
}
|
|
48
|
-
const running = desktopBridgeRuntimeVersion(service.state) || 'pre-8.6.2';
|
|
49
|
-
if (!input.fix) {
|
|
50
|
-
return {
|
|
51
|
-
restarted: false,
|
|
52
|
-
warnings: [],
|
|
53
|
-
blockers: [`desktop_bridge_runtime_version_stale:${running}:${PACKAGE_VERSION}`]
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
const restarted = await bootstrapExistingDesktopBridgeService({ home: input.home }).catch(() => null);
|
|
57
|
-
const nowRunning = restarted?.running === true && !desktopBridgeRuntimeVersionStale(restarted.state);
|
|
58
|
-
return nowRunning
|
|
59
|
-
? { restarted: true, warnings: [`desktop_bridge_runtime_restarted:${running}:${PACKAGE_VERSION}`], blockers: [] }
|
|
60
|
-
: { restarted: false, warnings: [], blockers: [`desktop_bridge_runtime_version_stale:${running}:${PACKAGE_VERSION}`] };
|
|
61
|
-
}
|
|
62
|
-
export const CATALOG_REPAIR_MAX_ATTEMPTS = 2;
|
|
38
|
+
export { CATALOG_REPAIR_MAX_ATTEMPTS, repairDoctorDesktopBridgeCatalog, restartStaleDesktopBridgeRuntime } from '../core/doctor/desktop-bridge-catalog-repair.js';
|
|
63
39
|
export function deferCommandAliasCleanupToMigrationReceipt(result) {
|
|
64
40
|
const observedBlockers = Array.isArray(result?.blockers)
|
|
65
41
|
? result.blockers.map(String).filter(Boolean)
|
|
@@ -214,19 +190,41 @@ export async function executeDoctorGlobalOnlyFix(args = [], root, deps = {}) {
|
|
|
214
190
|
status: 'failed',
|
|
215
191
|
error: err?.message || String(err)
|
|
216
192
|
}));
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
193
|
+
const doctorProfile = doctorProfileFromArgs(args, true);
|
|
194
|
+
const menuBarPolicy = doctorMenuBarInstallPolicy(args, true, doctorEnv);
|
|
195
|
+
const menuBar = menuBarPolicy.phase_enabled
|
|
196
|
+
? await installMenuBarImpl({
|
|
197
|
+
home,
|
|
198
|
+
root: home,
|
|
199
|
+
apply: true,
|
|
200
|
+
launch: !sksMenuBarRestartDeferred(doctorEnv),
|
|
201
|
+
env: doctorEnv,
|
|
202
|
+
quiet: flag(args, '--json') || flag(args, '--machine-only')
|
|
203
|
+
}).catch((err) => ({
|
|
204
|
+
schema: 'sks.codex-app-sks-menubar.v1',
|
|
205
|
+
ok: false,
|
|
206
|
+
status: 'blocked',
|
|
207
|
+
blockers: [err?.message || String(err)],
|
|
208
|
+
warnings: []
|
|
209
|
+
}))
|
|
210
|
+
: {
|
|
211
|
+
schema: 'sks.codex-app-sks-menubar.v1',
|
|
212
|
+
ok: true,
|
|
213
|
+
status: 'skipped_by_profile',
|
|
214
|
+
skipped: true,
|
|
215
|
+
blockers: [],
|
|
216
|
+
warnings: [`sks_menubar_phase_skipped_for_profile:${doctorProfile}`]
|
|
217
|
+
};
|
|
218
|
+
const desktopBridgeRepairImpl = deps.desktopBridgeRepairImpl || repairDoctorDesktopBridgeCatalog;
|
|
219
|
+
const desktopBridgeRepair = await desktopBridgeRepairImpl({ fix: true }).catch((err) => ({
|
|
220
|
+
id: 'desktop_bridge_catalog_repair',
|
|
226
221
|
ok: false,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
222
|
+
repaired: false,
|
|
223
|
+
required_for_ready: false,
|
|
224
|
+
manual_required: false,
|
|
225
|
+
warnings: [],
|
|
226
|
+
blockers: [`desktop_bridge_catalog_repair_failed:${err?.message || String(err)}`],
|
|
227
|
+
rollback_evidence: 'combined_catalog_previous_generation_preserved'
|
|
230
228
|
}));
|
|
231
229
|
const desktopBridge = await inspectDoctorDesktopBridgeStatus({
|
|
232
230
|
home,
|
|
@@ -238,15 +236,54 @@ export async function executeDoctorGlobalOnlyFix(args = [], root, deps = {}) {
|
|
|
238
236
|
const globalFastModeReady = globalFastMode?.status !== 'failed'
|
|
239
237
|
&& globalFastMode?.ok !== false;
|
|
240
238
|
const menuBarReady = menuBar?.ok !== false;
|
|
241
|
-
const
|
|
239
|
+
const migrationScopeBlockers = [...new Set([
|
|
242
240
|
...(!globalSkillsReady ? [`global_skills_reconcile_failed:${globalSkills?.error || 'core_skill_integrity'}`] : []),
|
|
243
241
|
...(currentSurface?.ok !== true ? (currentSurface?.blockers || ['global_current_surface_reconcile_failed']) : []),
|
|
244
|
-
...(!globalFastModeReady ? [`global_fast_mode_repair_failed:${globalFastMode?.error || globalFastMode?.status || 'unknown'}`] : [])
|
|
245
|
-
|
|
242
|
+
...(!globalFastModeReady ? [`global_fast_mode_repair_failed:${globalFastMode?.error || globalFastMode?.status || 'unknown'}`] : [])
|
|
243
|
+
].map(String).filter(Boolean))];
|
|
244
|
+
const bridgeBlockers = [...new Set([
|
|
245
|
+
...(desktopBridgeRepair?.ok === false
|
|
246
|
+
? (desktopBridgeRepair?.blockers?.length ? desktopBridgeRepair.blockers : ['desktop_bridge_catalog_repair_failed'])
|
|
247
|
+
: []),
|
|
246
248
|
...(desktopBridge.ok === false
|
|
247
249
|
? (desktopBridge.blockers || ['desktop_bridge_unavailable'])
|
|
248
250
|
: [])
|
|
249
251
|
].map(String).filter(Boolean))];
|
|
252
|
+
const bridgeReadinessRequired = doctorProfileRequiresDesktopBridgeReadiness(doctorProfile);
|
|
253
|
+
let migrationReceipt = null;
|
|
254
|
+
if (doctorProfile === 'migration') {
|
|
255
|
+
const writeReceiptImpl = deps.writeProjectUpdateMigrationReceiptImpl || writeProjectUpdateMigrationReceipt;
|
|
256
|
+
migrationReceipt = await writeReceiptImpl({
|
|
257
|
+
root: home,
|
|
258
|
+
source: `doctor-${doctorProfile}`,
|
|
259
|
+
blockers: migrationScopeBlockers,
|
|
260
|
+
warnings: ['global_only_home_scope_migration_receipt'],
|
|
261
|
+
...(migrationScopeBlockers.length ? { status: 'blocked' } : {})
|
|
262
|
+
}).catch((err) => ({
|
|
263
|
+
schema: 'sks.project-migration-receipt.v2',
|
|
264
|
+
status: 'blocked',
|
|
265
|
+
sks_version: null,
|
|
266
|
+
root: home,
|
|
267
|
+
source: `doctor-${doctorProfile}`,
|
|
268
|
+
generated_at: new Date().toISOString(),
|
|
269
|
+
blockers: [`migration_receipt_failed:${err?.message || String(err)}`],
|
|
270
|
+
warnings: []
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
273
|
+
const migrationReceiptBlockers = migrationReceipt && !isUpdateMigrationReceiptCurrent(migrationReceipt)
|
|
274
|
+
? ((migrationReceipt.blockers || []).length ? migrationReceipt.blockers : ['global_migration_receipt_not_current'])
|
|
275
|
+
: [];
|
|
276
|
+
const blockers = [...new Set([
|
|
277
|
+
...migrationScopeBlockers,
|
|
278
|
+
...(!menuBarReady ? (menuBar?.blockers || ['sks_menubar_repair_failed']) : []),
|
|
279
|
+
...(bridgeReadinessRequired ? bridgeBlockers : []),
|
|
280
|
+
...migrationReceiptBlockers
|
|
281
|
+
].map(String).filter(Boolean))];
|
|
282
|
+
const warnings = [...new Set([
|
|
283
|
+
...(!bridgeReadinessRequired ? bridgeBlockers.map((blocker) => `migration_optional_blocker:${blocker}`) : []),
|
|
284
|
+
...(desktopBridgeRepair?.warnings || []),
|
|
285
|
+
...(desktopBridge?.warnings || [])
|
|
286
|
+
].map(String).filter(Boolean))];
|
|
250
287
|
const ok = blockers.length === 0;
|
|
251
288
|
const projectRootAliasDetected = path.resolve(root) === home;
|
|
252
289
|
return {
|
|
@@ -257,6 +294,7 @@ export async function executeDoctorGlobalOnlyFix(args = [], root, deps = {}) {
|
|
|
257
294
|
diagnostic_depth: 'global-only',
|
|
258
295
|
global_only: true,
|
|
259
296
|
install_scope: 'global',
|
|
297
|
+
doctor_profile: doctorProfile,
|
|
260
298
|
root,
|
|
261
299
|
home,
|
|
262
300
|
project_root_alias_detected: projectRootAliasDetected,
|
|
@@ -268,20 +306,26 @@ export async function executeDoctorGlobalOnlyFix(args = [], root, deps = {}) {
|
|
|
268
306
|
'project_supabase_mcp_repair',
|
|
269
307
|
'project_hook_trust_repair',
|
|
270
308
|
'project_command_alias_cleanup',
|
|
271
|
-
'project_migration_receipt'
|
|
309
|
+
...(migrationReceipt ? [] : ['project_migration_receipt'])
|
|
272
310
|
],
|
|
273
311
|
skills: { global: globalSkills, project: { skipped: true, reason: 'global_only_doctor' } },
|
|
274
312
|
current_public_surface: currentSurface,
|
|
275
313
|
codex_app_fast_mode: globalFastMode,
|
|
276
314
|
openrouter_provider: desktopBridge.providers?.openrouter || null,
|
|
277
315
|
sks_menubar: menuBar,
|
|
316
|
+
desktop_bridge_repair: desktopBridgeRepair,
|
|
278
317
|
desktop_bridge: desktopBridge,
|
|
318
|
+
...(migrationReceipt ? { migration_receipt: migrationReceipt } : {}),
|
|
279
319
|
blockers,
|
|
320
|
+
warnings,
|
|
280
321
|
next_actions: [
|
|
281
322
|
...(projectRootAliasDetected
|
|
282
323
|
? ['Project checks were skipped because this directory is your home folder. Run them from your project: cd <your-project> && sks doctor --fix']
|
|
283
324
|
: []),
|
|
284
325
|
...(desktopBridge.ok === false ? desktopBridge.recovery_actions || [] : []),
|
|
326
|
+
...(!bridgeReadinessRequired && bridgeBlockers.length
|
|
327
|
+
? ['Desktop Bridge still reports blockers: run `sks doctor --fix` to repair the bridge catalog.']
|
|
328
|
+
: []),
|
|
285
329
|
'Run `sks doctor --fix --json` from a specific project directory when project-scoped repair is required.'
|
|
286
330
|
]
|
|
287
331
|
};
|
|
@@ -300,10 +344,19 @@ async function runDoctorGlobalOnlyFix(args = [], root, deps = {}) {
|
|
|
300
344
|
printJson(result);
|
|
301
345
|
}
|
|
302
346
|
else {
|
|
347
|
+
const bridgeRepair = result.desktop_bridge_repair;
|
|
303
348
|
console.log(`SKS Doctor global repair: ${result.ok ? 'ok' : 'blocked'}`);
|
|
304
349
|
console.log(`Global skills: ${result.skills.global?.error ? 'blocked' : 'reconciled'}`);
|
|
305
350
|
console.log(`SKS menu bar: ${result.sks_menubar?.status || (result.sks_menubar?.ok ? 'ok' : 'blocked')}`);
|
|
351
|
+
console.log(`Desktop Bridge repair: ${bridgeRepair?.skipped_reason
|
|
352
|
+
? bridgeRepair.skipped_reason
|
|
353
|
+
: bridgeRepair?.repaired
|
|
354
|
+
? 'repaired'
|
|
355
|
+
: bridgeRepair?.ok === false ? 'failed' : 'nothing_to_repair'}`);
|
|
306
356
|
console.log(`Desktop Bridge: ${result.desktop_bridge.ok ? 'ready' : 'blocked'} (${result.desktop_bridge.status?.readiness?.state || 'unavailable'})`);
|
|
357
|
+
if (result.migration_receipt) {
|
|
358
|
+
console.log(`Migration receipt: ${result.migration_receipt.status} (${result.home})`);
|
|
359
|
+
}
|
|
307
360
|
for (const blocker of result.blockers)
|
|
308
361
|
console.log(`- blocker: ${blocker}`);
|
|
309
362
|
for (const action of result.next_actions)
|
|
@@ -1027,61 +1080,7 @@ async function runDoctor(args = [], root, doctorFix, deps = {}) {
|
|
|
1027
1080
|
{
|
|
1028
1081
|
id: 'desktop_bridge_catalog_repair',
|
|
1029
1082
|
required_for_ready: false,
|
|
1030
|
-
run: async () => {
|
|
1031
|
-
const base = {
|
|
1032
|
-
id: 'desktop_bridge_catalog_repair',
|
|
1033
|
-
required_for_ready: false,
|
|
1034
|
-
manual_required: false,
|
|
1035
|
-
warnings: [],
|
|
1036
|
-
rollback_evidence: 'combined_catalog_previous_generation_preserved'
|
|
1037
|
-
};
|
|
1038
|
-
try {
|
|
1039
|
-
const bridgeHome = path.resolve(process.env.HOME || os.homedir());
|
|
1040
|
-
const restarted = await restartStaleDesktopBridgeRuntime({
|
|
1041
|
-
home: bridgeHome,
|
|
1042
|
-
fix: doctorFix,
|
|
1043
|
-
});
|
|
1044
|
-
const status = await desktopBridgeStatusV3({ home: bridgeHome, env: process.env });
|
|
1045
|
-
const blockers = (status?.readiness?.blockers || []).map(String);
|
|
1046
|
-
const stale = blockers.filter((blocker) => blocker.endsWith('_catalog_stale'));
|
|
1047
|
-
if (!status?.management?.managed || stale.length === 0) {
|
|
1048
|
-
return {
|
|
1049
|
-
...base,
|
|
1050
|
-
ok: restarted.blockers.length === 0,
|
|
1051
|
-
repaired: restarted.restarted,
|
|
1052
|
-
warnings: restarted.warnings,
|
|
1053
|
-
blockers: restarted.blockers
|
|
1054
|
-
};
|
|
1055
|
-
}
|
|
1056
|
-
const attempts = [];
|
|
1057
|
-
let syncedAndVerified = false;
|
|
1058
|
-
for (let attempt = 1; attempt <= CATALOG_REPAIR_MAX_ATTEMPTS; attempt += 1) {
|
|
1059
|
-
const sync = await executeDesktopBridgeCommandV3({ operation: 'catalog.sync' }, { home: bridgeHome, env: process.env });
|
|
1060
|
-
const commandOk = sync?.ok === true && sync?.execution?.ok === true;
|
|
1061
|
-
const after = await desktopBridgeStatusV3({ home: bridgeHome, env: process.env });
|
|
1062
|
-
const stillStale = (after?.readiness?.blockers || [])
|
|
1063
|
-
.map(String).filter((blocker) => blocker.endsWith('_catalog_stale'));
|
|
1064
|
-
if (commandOk && stillStale.length === 0) {
|
|
1065
|
-
syncedAndVerified = true;
|
|
1066
|
-
break;
|
|
1067
|
-
}
|
|
1068
|
-
attempts.push(`catalog_sync_attempt_${attempt}:${commandOk ? `still_stale:${stillStale.join(',')}` : (sync?.execution?.blockers || ['failed']).map(String).join(',')}`);
|
|
1069
|
-
}
|
|
1070
|
-
return {
|
|
1071
|
-
...base,
|
|
1072
|
-
ok: syncedAndVerified && restarted.blockers.length === 0,
|
|
1073
|
-
repaired: syncedAndVerified || restarted.restarted,
|
|
1074
|
-
warnings: [...restarted.warnings, ...(syncedAndVerified ? attempts : [])],
|
|
1075
|
-
blockers: [
|
|
1076
|
-
...(syncedAndVerified ? [] : ['desktop_bridge_catalog_still_stale_after_repair', ...attempts]),
|
|
1077
|
-
...restarted.blockers
|
|
1078
|
-
]
|
|
1079
|
-
};
|
|
1080
|
-
}
|
|
1081
|
-
catch (error) {
|
|
1082
|
-
return { ...base, ok: false, repaired: false, blockers: [String(error?.message || 'desktop_bridge_catalog_sync_failed')] };
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1083
|
+
run: async () => repairDoctorDesktopBridgeCatalog({ fix: doctorFix })
|
|
1085
1084
|
}
|
|
1086
1085
|
].filter((phase) => doctorPhaseIds.includes(phase.id))
|
|
1087
1086
|
}).catch((err) => ({
|
|
@@ -274,7 +274,13 @@ export async function forwardHttp(req, res, config, prepared, authenticatedLocal
|
|
|
274
274
|
const statusCode = response.statusCode || 502;
|
|
275
275
|
if (statusCode >= 400) {
|
|
276
276
|
void readRedactedUpstreamError(response).then(({ body, upstreamCode, upstreamType }) => {
|
|
277
|
-
const transientMislabel = statusCode === 404
|
|
277
|
+
const transientMislabel = statusCode === 404
|
|
278
|
+
&& (upstreamType === 'upstream_error' || upstreamCode === 'upstream_error');
|
|
279
|
+
if (transientMislabel && replayable && !useFreshConnection) {
|
|
280
|
+
responseStarted = true;
|
|
281
|
+
finish(new StalePooledSocketFailure(new DesktopBridgeError('bridge_upstream_transient_mislabel')));
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
278
284
|
const clientStatus = transientMislabel ? 503 : statusCode;
|
|
279
285
|
logHttpRejection({
|
|
280
286
|
code: transientMislabel
|
|
@@ -255,6 +255,11 @@ export async function updateCommand(sub = 'now', args = []) {
|
|
|
255
255
|
console.log(`New version: ${result.new_version}`);
|
|
256
256
|
if (result.project_receipt)
|
|
257
257
|
console.log(`Migration receipt: ${result.project_receipt.root} (${result.migration_current ? 'current' : 'not current'})`);
|
|
258
|
+
for (const warning of (result.project_receipt?.optional_warnings || [])
|
|
259
|
+
.filter((entry) => String(entry).includes('sks doctor --fix'))
|
|
260
|
+
.slice(0, 3)) {
|
|
261
|
+
console.log(`Follow-up: ${warning}`);
|
|
262
|
+
}
|
|
258
263
|
if (result.sks_menubar)
|
|
259
264
|
console.log(`SKS menu bar: ${result.sks_menubar.status}${result.sks_menubar.app_path ? ` (${result.sks_menubar.app_path})` : ''}`);
|
|
260
265
|
if (result.operation_receipt_path)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { desktopBridgeStatusV3, executeDesktopBridgeCommandV3 } from '../codex-lb/desktop-controller-v3.js';
|
|
4
|
+
import { bootstrapExistingDesktopBridgeService, desktopBridgeServiceStatus } from '../codex-lb/desktop-service.js';
|
|
5
|
+
import { desktopBridgeRuntimeVersion, desktopBridgeRuntimeVersionStale } from '../codex-lb/desktop-bridge/state.js';
|
|
6
|
+
import { PACKAGE_VERSION } from '../version.js';
|
|
7
|
+
export async function restartStaleDesktopBridgeRuntime(input) {
|
|
8
|
+
if (process.env.SKS_TEST_ISOLATION === '1' || process.env.SKS_RELEASE_UPGRADE_SMOKE === '1') {
|
|
9
|
+
return { restarted: false, warnings: [], blockers: [] };
|
|
10
|
+
}
|
|
11
|
+
const service = await desktopBridgeServiceStatus({ home: input.home }).catch(() => null);
|
|
12
|
+
if (!service?.running || !desktopBridgeRuntimeVersionStale(service.state)) {
|
|
13
|
+
return { restarted: false, warnings: [], blockers: [] };
|
|
14
|
+
}
|
|
15
|
+
const running = desktopBridgeRuntimeVersion(service.state) || 'pre-8.6.2';
|
|
16
|
+
if (!input.fix) {
|
|
17
|
+
return {
|
|
18
|
+
restarted: false,
|
|
19
|
+
warnings: [],
|
|
20
|
+
blockers: [`desktop_bridge_runtime_version_stale:${running}:${PACKAGE_VERSION}`]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const restarted = await bootstrapExistingDesktopBridgeService({ home: input.home }).catch(() => null);
|
|
24
|
+
const nowRunning = restarted?.running === true && !desktopBridgeRuntimeVersionStale(restarted.state);
|
|
25
|
+
return nowRunning
|
|
26
|
+
? { restarted: true, warnings: [`desktop_bridge_runtime_restarted:${running}:${PACKAGE_VERSION}`], blockers: [] }
|
|
27
|
+
: { restarted: false, warnings: [], blockers: [`desktop_bridge_runtime_version_stale:${running}:${PACKAGE_VERSION}`] };
|
|
28
|
+
}
|
|
29
|
+
export const CATALOG_REPAIR_MAX_ATTEMPTS = 2;
|
|
30
|
+
export async function repairDoctorDesktopBridgeCatalog(input, deps = {}) {
|
|
31
|
+
const base = {
|
|
32
|
+
id: 'desktop_bridge_catalog_repair',
|
|
33
|
+
required_for_ready: false,
|
|
34
|
+
manual_required: false,
|
|
35
|
+
warnings: [],
|
|
36
|
+
rollback_evidence: 'combined_catalog_previous_generation_preserved'
|
|
37
|
+
};
|
|
38
|
+
const usingRealImpls = !deps.restartStaleDesktopBridgeRuntimeImpl
|
|
39
|
+
&& !deps.desktopBridgeStatusImpl
|
|
40
|
+
&& !deps.executeDesktopBridgeCommandImpl;
|
|
41
|
+
if (usingRealImpls
|
|
42
|
+
&& (process.env.NODE_TEST_CONTEXT !== undefined
|
|
43
|
+
|| process.env.SKS_TEST_ISOLATION === '1'
|
|
44
|
+
|| process.env.SKS_RELEASE_UPGRADE_SMOKE === '1')) {
|
|
45
|
+
return {
|
|
46
|
+
...base,
|
|
47
|
+
ok: true,
|
|
48
|
+
repaired: false,
|
|
49
|
+
blockers: [],
|
|
50
|
+
skipped_reason: 'desktop_bridge_catalog_repair_skipped_under_tests'
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const restartImpl = deps.restartStaleDesktopBridgeRuntimeImpl || restartStaleDesktopBridgeRuntime;
|
|
54
|
+
const statusImpl = deps.desktopBridgeStatusImpl || desktopBridgeStatusV3;
|
|
55
|
+
const executeImpl = deps.executeDesktopBridgeCommandImpl || executeDesktopBridgeCommandV3;
|
|
56
|
+
try {
|
|
57
|
+
const bridgeHome = path.resolve(process.env.HOME || os.homedir());
|
|
58
|
+
const restarted = await restartImpl({
|
|
59
|
+
home: bridgeHome,
|
|
60
|
+
fix: input.fix
|
|
61
|
+
});
|
|
62
|
+
const status = await statusImpl({ home: bridgeHome, env: process.env });
|
|
63
|
+
const blockers = (status?.readiness?.blockers || []).map(String);
|
|
64
|
+
const stale = blockers.filter((blocker) => blocker.endsWith('_catalog_stale'));
|
|
65
|
+
if (!status?.management?.managed || stale.length === 0) {
|
|
66
|
+
return {
|
|
67
|
+
...base,
|
|
68
|
+
ok: restarted.blockers.length === 0,
|
|
69
|
+
repaired: restarted.restarted,
|
|
70
|
+
warnings: restarted.warnings,
|
|
71
|
+
blockers: restarted.blockers
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const attempts = [];
|
|
75
|
+
let syncedAndVerified = false;
|
|
76
|
+
for (let attempt = 1; attempt <= CATALOG_REPAIR_MAX_ATTEMPTS; attempt += 1) {
|
|
77
|
+
const sync = await executeImpl({ operation: 'catalog.sync' }, { home: bridgeHome, env: process.env });
|
|
78
|
+
const commandOk = sync?.ok === true && sync?.execution?.ok === true;
|
|
79
|
+
const after = await statusImpl({ home: bridgeHome, env: process.env });
|
|
80
|
+
const stillStale = (after?.readiness?.blockers || [])
|
|
81
|
+
.map(String).filter((blocker) => blocker.endsWith('_catalog_stale'));
|
|
82
|
+
if (commandOk && stillStale.length === 0) {
|
|
83
|
+
syncedAndVerified = true;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
attempts.push(`catalog_sync_attempt_${attempt}:${commandOk ? `still_stale:${stillStale.join(',')}` : (sync?.execution?.blockers || ['failed']).map(String).join(',')}`);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
...base,
|
|
90
|
+
ok: syncedAndVerified && restarted.blockers.length === 0,
|
|
91
|
+
repaired: syncedAndVerified || restarted.restarted,
|
|
92
|
+
warnings: [...restarted.warnings, ...(syncedAndVerified ? attempts : [])],
|
|
93
|
+
blockers: [
|
|
94
|
+
...(syncedAndVerified ? [] : ['desktop_bridge_catalog_still_stale_after_repair', ...attempts]),
|
|
95
|
+
...restarted.blockers
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return { ...base, ok: false, repaired: false, blockers: [String(error?.message || 'desktop_bridge_catalog_sync_failed')] };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
export async function runCurrentPublicSurfaceReconcileStage(root) {
|
|
4
|
+
const [{ runDoctorCommandAliasCleanup }, { migrateSksProfilesToPerFile }, { cleanupRetiredRemoteBridgeLaunchAgent, quarantineRetiredRemoteBridgeBindings }] = await Promise.all([
|
|
5
|
+
import('../../doctor/command-alias-cleanup.js'),
|
|
6
|
+
import('../../auto-review.js'),
|
|
7
|
+
import('../../codex-app/menubar/migration.js')
|
|
8
|
+
]);
|
|
9
|
+
const home = path.resolve(process.env.HOME || os.homedir());
|
|
10
|
+
const globalRuntimeRoot = path.resolve(process.env.SKS_GLOBAL_ROOT || path.join(home, '.sneakoscope-global'));
|
|
11
|
+
const publicSurface = await runDoctorCommandAliasCleanup({
|
|
12
|
+
root,
|
|
13
|
+
home,
|
|
14
|
+
globalRuntimeRoot,
|
|
15
|
+
fix: true,
|
|
16
|
+
managedGenerationAlreadyConverged: true
|
|
17
|
+
});
|
|
18
|
+
const profileMigration = await migrateSksProfilesToPerFile({ env: process.env }).catch((err) => ({
|
|
19
|
+
error: err?.message || String(err),
|
|
20
|
+
retired_profile_table_count: 0,
|
|
21
|
+
retired_profile_file_removed_count: 0
|
|
22
|
+
}));
|
|
23
|
+
const retiredLaunchAgent = await cleanupRetiredRemoteBridgeLaunchAgent({ home, env: process.env });
|
|
24
|
+
const retiredBindings = await quarantineRetiredRemoteBridgeBindings(root);
|
|
25
|
+
const remainingCount = Number(publicSurface.cleanup?.remaining_count || 0)
|
|
26
|
+
+ Number(publicSurface.cleanup?.managed_runtime?.remaining_managed_artifact_count || 0)
|
|
27
|
+
+ Number(publicSurface.cleanup?.project_guidance?.remaining_count || 0);
|
|
28
|
+
const blockers = [
|
|
29
|
+
...(publicSurface.ok === true ? [] : ['public_surface_reconcile_failed']),
|
|
30
|
+
...(retiredLaunchAgent.ok ? [] : retiredLaunchAgent.blockers),
|
|
31
|
+
...(retiredBindings.ok ? [] : retiredBindings.blockers),
|
|
32
|
+
...(profileMigration.error ? [`retired_profile_migration_failed:${profileMigration.error}`] : []),
|
|
33
|
+
...(remainingCount > 0 ? [`public_surface_remaining:${remainingCount}`] : [])
|
|
34
|
+
];
|
|
35
|
+
return {
|
|
36
|
+
ok: blockers.length === 0,
|
|
37
|
+
status: blockers.length ? 'failed' : 'ok',
|
|
38
|
+
actions: [
|
|
39
|
+
'reconciled_current_public_surface',
|
|
40
|
+
...(retiredLaunchAgent.status === 'removed' ? ['retired_remote_bridge_launch_agent_removed'] : []),
|
|
41
|
+
...(retiredBindings.status === 'quarantined' ? ['retired_remote_bridge_bindings_quarantined'] : [])
|
|
42
|
+
],
|
|
43
|
+
blockers,
|
|
44
|
+
warnings: [
|
|
45
|
+
...(publicSurface.warnings || []),
|
|
46
|
+
...retiredLaunchAgent.warnings,
|
|
47
|
+
...retiredBindings.warnings
|
|
48
|
+
],
|
|
49
|
+
detail: {
|
|
50
|
+
removed_skill_count: Number(publicSurface.cleanup?.removed_count || 0),
|
|
51
|
+
quarantined_skill_collision_count: Number(publicSurface.cleanup?.preserved_user_collision_count || 0),
|
|
52
|
+
removed_runtime_artifact_count: Number(publicSurface.cleanup?.managed_runtime?.removed_managed_artifact_count || 0),
|
|
53
|
+
quarantined_runtime_collision_count: Number(publicSurface.cleanup?.managed_runtime?.preserved_user_file_count || 0),
|
|
54
|
+
reconciled_guidance_count: Number(publicSurface.cleanup?.project_guidance?.reconciled_count || 0),
|
|
55
|
+
quarantined_guidance_collision_count: Number(publicSurface.cleanup?.project_guidance?.preserved_user_file_count || 0),
|
|
56
|
+
removed_retired_role_count: 0,
|
|
57
|
+
quarantined_retired_role_collision_count: 0,
|
|
58
|
+
retired_profile_table_count: Number(profileMigration.retired_profile_table_count || 0),
|
|
59
|
+
retired_profile_file_removed_count: Number(profileMigration.retired_profile_file_removed_count || 0),
|
|
60
|
+
retired_remote_bridge_launch_agent_status: retiredLaunchAgent.status,
|
|
61
|
+
retired_remote_bridge_binding_status: retiredBindings.status,
|
|
62
|
+
retired_remote_bridge_binding_count: retiredBindings.retired_binding_count,
|
|
63
|
+
retired_remote_bridge_binding_quarantine_path: retiredBindings.quarantine_path,
|
|
64
|
+
remaining_count: remainingCount
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { exists } from '../../fsx.js';
|
|
4
|
+
import { desktopBridgeServicePaths } from '../../codex-lb/desktop-service.js';
|
|
5
|
+
import { repairDoctorDesktopBridgeCatalog } from '../../doctor/desktop-bridge-catalog-repair.js';
|
|
6
|
+
export async function runDesktopBridgeCatalogRepairStage() {
|
|
7
|
+
const skip = (reason) => ({ ok: true, status: 'ok', actions: [reason], blockers: [], warnings: [] });
|
|
8
|
+
if (process.platform !== 'darwin')
|
|
9
|
+
return skip('desktop_bridge_catalog_repair_not_macos');
|
|
10
|
+
if (process.env.NODE_TEST_CONTEXT !== undefined)
|
|
11
|
+
return skip('desktop_bridge_catalog_repair_skipped_under_tests');
|
|
12
|
+
if (process.env.SKS_TEST_ISOLATION === '1')
|
|
13
|
+
return skip('desktop_bridge_catalog_repair_skipped_under_tests');
|
|
14
|
+
if (process.env.SKS_SKIP_BRIDGE_CATALOG_REPAIR === '1')
|
|
15
|
+
return skip('desktop_bridge_catalog_repair_disabled');
|
|
16
|
+
const home = path.resolve(process.env.HOME || os.homedir());
|
|
17
|
+
if (!(await exists(desktopBridgeServicePaths(home).settings_path))) {
|
|
18
|
+
return skip('desktop_bridge_catalog_repair_no_managed_bridge');
|
|
19
|
+
}
|
|
20
|
+
const repair = await repairDoctorDesktopBridgeCatalog({ fix: true }).catch((error) => ({
|
|
21
|
+
ok: false,
|
|
22
|
+
repaired: false,
|
|
23
|
+
warnings: [],
|
|
24
|
+
blockers: [`desktop_bridge_catalog_repair_failed:${error?.message || String(error)}`]
|
|
25
|
+
}));
|
|
26
|
+
if (repair.ok) {
|
|
27
|
+
return {
|
|
28
|
+
ok: true,
|
|
29
|
+
status: 'ok',
|
|
30
|
+
actions: [repair.repaired ? 'desktop_bridge_catalog_repaired' : 'desktop_bridge_catalog_clean'],
|
|
31
|
+
blockers: [],
|
|
32
|
+
warnings: repair.warnings || []
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
ok: true,
|
|
37
|
+
status: 'ok',
|
|
38
|
+
actions: [],
|
|
39
|
+
blockers: [],
|
|
40
|
+
warnings: [
|
|
41
|
+
...(repair.blockers || []).map((blocker) => `desktop_bridge_catalog_repair_incomplete:${blocker}`),
|
|
42
|
+
'Desktop Bridge catalog still needs repair: run `sks doctor --fix`'
|
|
43
|
+
]
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -10,6 +10,8 @@ import { enforceRetention } from '../retention.js';
|
|
|
10
10
|
import { COMMANDS } from '../../cli/command-registry.js';
|
|
11
11
|
import { reconcileLegacyManagedGeneration } from '../init/legacy-generation-convergence.js';
|
|
12
12
|
import { runConfigFastModeNormalizeStage } from './update-migration-state/fast-mode-config.js';
|
|
13
|
+
import { runCurrentPublicSurfaceReconcileStage } from './update-migration-state/current-public-surface-stage.js';
|
|
14
|
+
import { runDesktopBridgeCatalogRepairStage } from './update-migration-state/desktop-bridge-catalog-repair-stage.js';
|
|
13
15
|
import { runDesktopBridgeRestageStage } from './update-migration-state/desktop-bridge-restage.js';
|
|
14
16
|
import { runSessionStateSplitStage } from './update-migration-state/session-state-split.js';
|
|
15
17
|
import { runHookTrustRefreshStage, runOtherHarnessCleanupStage } from './update-migration-state/simple-stages.js';
|
|
@@ -264,73 +266,13 @@ const UPDATE_MIGRATION_STAGES = [
|
|
|
264
266
|
id: 'desktop-bridge-restage',
|
|
265
267
|
min_from_version: '0.0.0',
|
|
266
268
|
run: runDesktopBridgeRestageStage
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
id: 'desktop-bridge-catalog-repair',
|
|
272
|
+
min_from_version: '0.0.0',
|
|
273
|
+
run: runDesktopBridgeCatalogRepairStage
|
|
267
274
|
}
|
|
268
275
|
];
|
|
269
|
-
async function runCurrentPublicSurfaceReconcileStage(root) {
|
|
270
|
-
const [{ runDoctorCommandAliasCleanup }, { migrateSksProfilesToPerFile }, { cleanupRetiredRemoteBridgeLaunchAgent, quarantineRetiredRemoteBridgeBindings }] = await Promise.all([
|
|
271
|
-
import('../doctor/command-alias-cleanup.js'),
|
|
272
|
-
import('../auto-review.js'),
|
|
273
|
-
import('../codex-app/menubar/migration.js')
|
|
274
|
-
]);
|
|
275
|
-
const home = path.resolve(process.env.HOME || os.homedir());
|
|
276
|
-
const globalRuntimeRoot = path.resolve(process.env.SKS_GLOBAL_ROOT || path.join(home, '.sneakoscope-global'));
|
|
277
|
-
const publicSurface = await runDoctorCommandAliasCleanup({
|
|
278
|
-
root,
|
|
279
|
-
home,
|
|
280
|
-
globalRuntimeRoot,
|
|
281
|
-
fix: true,
|
|
282
|
-
managedGenerationAlreadyConverged: true
|
|
283
|
-
});
|
|
284
|
-
const profileMigration = await migrateSksProfilesToPerFile({ env: process.env }).catch((err) => ({
|
|
285
|
-
error: err?.message || String(err),
|
|
286
|
-
retired_profile_table_count: 0,
|
|
287
|
-
retired_profile_file_removed_count: 0
|
|
288
|
-
}));
|
|
289
|
-
const retiredLaunchAgent = await cleanupRetiredRemoteBridgeLaunchAgent({ home, env: process.env });
|
|
290
|
-
const retiredBindings = await quarantineRetiredRemoteBridgeBindings(root);
|
|
291
|
-
const remainingCount = Number(publicSurface.cleanup?.remaining_count || 0)
|
|
292
|
-
+ Number(publicSurface.cleanup?.managed_runtime?.remaining_managed_artifact_count || 0)
|
|
293
|
-
+ Number(publicSurface.cleanup?.project_guidance?.remaining_count || 0);
|
|
294
|
-
const blockers = [
|
|
295
|
-
...(publicSurface.ok === true ? [] : ['public_surface_reconcile_failed']),
|
|
296
|
-
...(retiredLaunchAgent.ok ? [] : retiredLaunchAgent.blockers),
|
|
297
|
-
...(retiredBindings.ok ? [] : retiredBindings.blockers),
|
|
298
|
-
...(profileMigration.error ? [`retired_profile_migration_failed:${profileMigration.error}`] : []),
|
|
299
|
-
...(remainingCount > 0 ? [`public_surface_remaining:${remainingCount}`] : [])
|
|
300
|
-
];
|
|
301
|
-
return {
|
|
302
|
-
ok: blockers.length === 0,
|
|
303
|
-
status: blockers.length ? 'failed' : 'ok',
|
|
304
|
-
actions: [
|
|
305
|
-
'reconciled_current_public_surface',
|
|
306
|
-
...(retiredLaunchAgent.status === 'removed' ? ['retired_remote_bridge_launch_agent_removed'] : []),
|
|
307
|
-
...(retiredBindings.status === 'quarantined' ? ['retired_remote_bridge_bindings_quarantined'] : [])
|
|
308
|
-
],
|
|
309
|
-
blockers,
|
|
310
|
-
warnings: [
|
|
311
|
-
...(publicSurface.warnings || []),
|
|
312
|
-
...retiredLaunchAgent.warnings,
|
|
313
|
-
...retiredBindings.warnings
|
|
314
|
-
],
|
|
315
|
-
detail: {
|
|
316
|
-
removed_skill_count: Number(publicSurface.cleanup?.removed_count || 0),
|
|
317
|
-
quarantined_skill_collision_count: Number(publicSurface.cleanup?.preserved_user_collision_count || 0),
|
|
318
|
-
removed_runtime_artifact_count: Number(publicSurface.cleanup?.managed_runtime?.removed_managed_artifact_count || 0),
|
|
319
|
-
quarantined_runtime_collision_count: Number(publicSurface.cleanup?.managed_runtime?.preserved_user_file_count || 0),
|
|
320
|
-
reconciled_guidance_count: Number(publicSurface.cleanup?.project_guidance?.reconciled_count || 0),
|
|
321
|
-
quarantined_guidance_collision_count: Number(publicSurface.cleanup?.project_guidance?.preserved_user_file_count || 0),
|
|
322
|
-
removed_retired_role_count: 0,
|
|
323
|
-
quarantined_retired_role_collision_count: 0,
|
|
324
|
-
retired_profile_table_count: Number(profileMigration.retired_profile_table_count || 0),
|
|
325
|
-
retired_profile_file_removed_count: Number(profileMigration.retired_profile_file_removed_count || 0),
|
|
326
|
-
retired_remote_bridge_launch_agent_status: retiredLaunchAgent.status,
|
|
327
|
-
retired_remote_bridge_binding_status: retiredBindings.status,
|
|
328
|
-
retired_remote_bridge_binding_count: retiredBindings.retired_binding_count,
|
|
329
|
-
retired_remote_bridge_binding_quarantine_path: retiredBindings.quarantine_path,
|
|
330
|
-
remaining_count: remainingCount
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
276
|
export async function runUpdateMigrationStages(root, opts = {}) {
|
|
335
277
|
const fromVersion = opts.fromVersion || null;
|
|
336
278
|
const runs = [];
|
package/dist/core/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '9.0.
|
|
1
|
+
export const PACKAGE_VERSION = '9.0.6';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sneakoscope",
|
|
3
3
|
"displayName": "ㅅㅋㅅ",
|
|
4
|
-
"version": "9.0.
|
|
4
|
+
"version": "9.0.6",
|
|
5
5
|
"description": "Sneakoscope Codex (`sks`) is an open-source trust layer for Codex CLI and ChatGPT Desktop. It coordinates bounded AI coding agents, records machine-verifiable evidence, preserves project memory, and blocks release claims that are not supported by current tests or artifacts. Search visibility outcomes are measured separately; SKS does not promise rankings or traffic.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"homepage": "https://github.com/mandarange/Sneakoscope-Codex#readme",
|