sneakoscope 8.6.0 → 8.6.3
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 +33 -1
- package/dist/config/skills-manifest.json +1 -1
- package/dist/core/codex/agent-config-file-repair.js +26 -1
- package/dist/core/codex/codex-config-guard.js +7 -1
- package/dist/core/codex-lb/desktop-bridge/rejection-log.js +74 -0
- package/dist/core/codex-lb/desktop-bridge/security.js +0 -3
- package/dist/core/codex-lb/desktop-bridge/server.js +23 -6
- package/dist/core/codex-lb/desktop-bridge/state.js +11 -0
- package/dist/core/codex-lb/desktop-service.js +5 -0
- package/dist/core/release/publish-registry-auth.js +104 -0
- package/dist/core/subagents/wave-lifecycle.js +8 -2
- package/dist/core/version.js +1 -1
- package/dist/scripts/publish-preflight.js +26 -2
- 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 8.6.
|
|
25
|
+
This README documents package **SKS 8.6.3** — 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
|
@@ -8,6 +8,9 @@ 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
10
|
import { desktopBridgeStatusV3, executeDesktopBridgeCommandV3 } from '../core/codex-lb/desktop-controller-v3.js';
|
|
11
|
+
import { bootstrapExistingDesktopBridgeService, desktopBridgeServiceStatus } from '../core/codex-lb/desktop-service.js';
|
|
12
|
+
import { desktopBridgeRuntimeVersion, desktopBridgeRuntimeVersionStale } from '../core/codex-lb/desktop-bridge/state.js';
|
|
13
|
+
import { PACKAGE_VERSION } from '../core/version.js';
|
|
11
14
|
import { inspectCodexConfigReadability } from '../core/codex/codex-config-readability.js';
|
|
12
15
|
import { inspectOAuthCallbackPortConflict, oauthCallbackDoctorGuidance } from '../core/codex/oauth-callback-port-diagnostic.js';
|
|
13
16
|
import { inventoryCodexPermissionProfiles } from '../core/codex/codex-permission-profiles.js';
|
|
@@ -34,6 +37,28 @@ export { buildCodexAppUiDiagnosticFailure, buildRuntimeReadiness, formatCodexDoc
|
|
|
34
37
|
export function doctorArgWarnings(args = []) {
|
|
35
38
|
return baseDoctorArgWarnings(args);
|
|
36
39
|
}
|
|
40
|
+
export async function restartStaleDesktopBridgeRuntime(input) {
|
|
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
|
+
}
|
|
37
62
|
export function deferCommandAliasCleanupToMigrationReceipt(result) {
|
|
38
63
|
const observedBlockers = Array.isArray(result?.blockers)
|
|
39
64
|
? result.blockers.map(String).filter(Boolean)
|
|
@@ -1008,11 +1033,18 @@ async function runDoctor(args = [], root, doctorFix, deps = {}) {
|
|
|
1008
1033
|
rollback_evidence: 'combined_catalog_previous_generation_preserved'
|
|
1009
1034
|
};
|
|
1010
1035
|
try {
|
|
1036
|
+
const restarted = await restartStaleDesktopBridgeRuntime({ home: root, fix: doctorFix });
|
|
1011
1037
|
const status = await desktopBridgeStatusV3({ home: root, env: process.env });
|
|
1012
1038
|
const blockers = (status?.readiness?.blockers || []).map(String);
|
|
1013
1039
|
const stale = blockers.filter((blocker) => blocker.endsWith('_catalog_stale'));
|
|
1014
1040
|
if (!status?.management?.managed || stale.length === 0) {
|
|
1015
|
-
return {
|
|
1041
|
+
return {
|
|
1042
|
+
...base,
|
|
1043
|
+
ok: restarted.blockers.length === 0,
|
|
1044
|
+
repaired: restarted.restarted,
|
|
1045
|
+
warnings: restarted.warnings,
|
|
1046
|
+
blockers: restarted.blockers
|
|
1047
|
+
};
|
|
1016
1048
|
}
|
|
1017
1049
|
const sync = await executeDesktopBridgeCommandV3({ operation: 'catalog.sync' }, { home: root, env: process.env });
|
|
1018
1050
|
const synced = sync?.ok === true && sync?.execution?.ok === true;
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { nowIso, readJson, writeJsonAtomic } from '../fsx.js';
|
|
4
4
|
import { SKS_MANAGED_CODEX_CONFIG_MARKER, backupInvalidToml, inspectOfficialSubagentToml, mergeOfficialSubagentConfigResult, officialSubagentConfigOwnershipProof, officialSubagentConfigWarnings, readInheritedOfficialSubagentConfigText } from '../subagents/official-subagent-config.js';
|
|
5
|
-
import { writeCodexConfigGuarded } from './codex-config-guard.js';
|
|
5
|
+
import { isCodexHomeConfigPath, writeCodexConfigGuarded } from './codex-config-guard.js';
|
|
6
6
|
function unmanagedConfigOperatorAction(configPath) {
|
|
7
7
|
return `Refused to modify ${configPath}: no SKS ownership proof. `
|
|
8
8
|
+ `If SKS owns this file, add the line \`${SKS_MANAGED_CODEX_CONFIG_MARKER}\` as its first line `
|
|
@@ -11,6 +11,31 @@ function unmanagedConfigOperatorAction(configPath) {
|
|
|
11
11
|
export async function repairAgentConfigFileReferences(input) {
|
|
12
12
|
const root = path.resolve(input.root);
|
|
13
13
|
const configPath = path.join(root, '.codex', 'config.toml');
|
|
14
|
+
if (isCodexHomeConfigPath(configPath, {
|
|
15
|
+
...(input.home ? { home: input.home } : {}),
|
|
16
|
+
...(input.codexHome ? { codexHome: input.codexHome } : {})
|
|
17
|
+
})) {
|
|
18
|
+
return writeReport(input.reportPath, root, {
|
|
19
|
+
schema: 'sks.agent-config-file-repair.v1',
|
|
20
|
+
generated_at: nowIso(),
|
|
21
|
+
ok: true,
|
|
22
|
+
apply: input.apply === true,
|
|
23
|
+
config_path: configPath,
|
|
24
|
+
backup_path: null,
|
|
25
|
+
repaired_paths: [],
|
|
26
|
+
created_files: [],
|
|
27
|
+
removed_unsupported_fields: [],
|
|
28
|
+
skipped_unmanaged_paths: [configPath],
|
|
29
|
+
manual_required: false,
|
|
30
|
+
blockers: [],
|
|
31
|
+
warnings: ['project_config_is_codex_home_noop'],
|
|
32
|
+
operator_actions: [
|
|
33
|
+
`${configPath} is the global Codex config, not a project config — SKS left it untouched. `
|
|
34
|
+
+ 'Run `sks doctor` from a project directory so the project config is repaired instead.'
|
|
35
|
+
],
|
|
36
|
+
ownership_proof: { owned: false, reasons: [] }
|
|
37
|
+
});
|
|
38
|
+
}
|
|
14
39
|
const configExists = await fs.stat(configPath).then((stat) => stat.isFile()).catch(() => false);
|
|
15
40
|
const original = configExists ? await fs.readFile(configPath, 'utf8').catch(() => '') : '';
|
|
16
41
|
const manifest = await readJson(path.join(root, '.sneakoscope', 'manifest.json'), null);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import fsp from 'node:fs/promises';
|
|
3
4
|
import { randomBytes } from 'node:crypto';
|
|
4
|
-
import { appendJsonl, ensureDir, nowIso, readText, sha256, writeTextAtomic } from '../fsx.js';
|
|
5
|
+
import { appendJsonl, ensureDir, nowIso, readText, sameFilesystemPathSync, sha256, writeTextAtomic } from '../fsx.js';
|
|
5
6
|
import { diffCodexAppUiSnapshots, snapshotCodexAppUiState } from '../codex-app/codex-app-ui-state-snapshot.js';
|
|
6
7
|
import { cleanupCodexConfigBackups, validateCodexConfigRoundTrip } from './codex-config-toml.js';
|
|
7
8
|
import { hasManagedAgentsConfigFingerprint } from '../subagents/official-subagent-config.js';
|
|
@@ -574,6 +575,11 @@ export function ensureTrailingNewline(text = '') {
|
|
|
574
575
|
export function isProjectCodexConfig(root, configPath) {
|
|
575
576
|
return path.resolve(configPath) === path.resolve(root, '.codex', 'config.toml');
|
|
576
577
|
}
|
|
578
|
+
export function isCodexHomeConfigPath(configPath, opts = {}) {
|
|
579
|
+
const home = opts.home || process.env.HOME || os.homedir();
|
|
580
|
+
const codexHome = opts.codexHome || process.env.CODEX_HOME || path.join(home, '.codex');
|
|
581
|
+
return sameFilesystemPathSync(path.resolve(configPath), path.resolve(codexHome, 'config.toml'));
|
|
582
|
+
}
|
|
577
583
|
export function hasSksManagedCodexConfigMarker(text) {
|
|
578
584
|
const source = String(text || '');
|
|
579
585
|
return hasExplicitSksManagedCodexConfigMarker(source)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { PACKAGE_VERSION } from '../../version.js';
|
|
2
|
+
export const DESKTOP_BRIDGE_LOG_SCHEMA = 'sks.desktop-bridge-log.v2';
|
|
3
|
+
export const REJECTION_LOG_BURST = 5;
|
|
4
|
+
export const REJECTION_LOG_SUMMARY_INTERVAL_MS = 60_000;
|
|
5
|
+
function safePathname(url) {
|
|
6
|
+
const raw = String(url || '').trim();
|
|
7
|
+
if (!raw.startsWith('/'))
|
|
8
|
+
return null;
|
|
9
|
+
const pathname = raw.split(/[?#]/)[0] || '';
|
|
10
|
+
if (!pathname || pathname.length > 512 || /[\r\n\0]/.test(pathname))
|
|
11
|
+
return null;
|
|
12
|
+
return pathname
|
|
13
|
+
.split('/')
|
|
14
|
+
.map((segment) => (segment.length >= 24 && /^[A-Za-z0-9_-]+$/.test(segment) ? '<redacted>' : segment))
|
|
15
|
+
.join('/');
|
|
16
|
+
}
|
|
17
|
+
function safeMethod(method) {
|
|
18
|
+
const value = String(method || '').trim().toUpperCase();
|
|
19
|
+
return /^[A-Z]{3,10}$/.test(value) ? value : null;
|
|
20
|
+
}
|
|
21
|
+
export function createDesktopBridgeRejectionLogger(options = {}) {
|
|
22
|
+
const write = options.write || ((line) => process.stdout.write(line));
|
|
23
|
+
const now = options.now || (() => Date.now());
|
|
24
|
+
const burst = Math.max(1, options.burst ?? REJECTION_LOG_BURST);
|
|
25
|
+
const summaryIntervalMs = Math.max(1_000, options.summaryIntervalMs ?? REJECTION_LOG_SUMMARY_INTERVAL_MS);
|
|
26
|
+
const windows = new Map();
|
|
27
|
+
function emit(payload) {
|
|
28
|
+
try {
|
|
29
|
+
write(`${JSON.stringify({
|
|
30
|
+
schema: DESKTOP_BRIDGE_LOG_SCHEMA,
|
|
31
|
+
sks_version: PACKAGE_VERSION,
|
|
32
|
+
secret_fields_redacted: true,
|
|
33
|
+
...payload,
|
|
34
|
+
})}\n`);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return function logRejection(event) {
|
|
40
|
+
const code = String(event.code || 'bridge_rejected').slice(0, 128).replace(/[\r\n\0]/g, '');
|
|
41
|
+
const at = now();
|
|
42
|
+
const window = windows.get(code) || { emitted: 0, suppressed: 0, windowStartedMs: at };
|
|
43
|
+
if (at - window.windowStartedMs >= summaryIntervalMs) {
|
|
44
|
+
if (window.suppressed > 0) {
|
|
45
|
+
emit({
|
|
46
|
+
event: 'sks.desktop_bridge.rejected_summary',
|
|
47
|
+
code,
|
|
48
|
+
suppressed: window.suppressed,
|
|
49
|
+
window_ms: at - window.windowStartedMs,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
window.emitted = 0;
|
|
53
|
+
window.suppressed = 0;
|
|
54
|
+
window.windowStartedMs = at;
|
|
55
|
+
}
|
|
56
|
+
if (window.emitted >= burst) {
|
|
57
|
+
window.suppressed += 1;
|
|
58
|
+
windows.set(code, window);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
window.emitted += 1;
|
|
62
|
+
windows.set(code, window);
|
|
63
|
+
const pathname = safePathname(event.url);
|
|
64
|
+
const method = safeMethod(event.method);
|
|
65
|
+
emit({
|
|
66
|
+
event: 'sks.desktop_bridge.rejected',
|
|
67
|
+
code,
|
|
68
|
+
transport: event.transport,
|
|
69
|
+
...(method ? { method } : {}),
|
|
70
|
+
...(pathname ? { pathname } : {}),
|
|
71
|
+
...(Number.isInteger(event.status) ? { status: event.status } : {}),
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -106,9 +106,6 @@ export function resolveCodexSessionIdentity(headers, payload = null) {
|
|
|
106
106
|
], 'session');
|
|
107
107
|
if (sessionId && !threadId)
|
|
108
108
|
throw new DesktopBridgeError('bridge_codex_thread_id_missing');
|
|
109
|
-
if (threadId && sessionId && threadId !== sessionId) {
|
|
110
|
-
throw new DesktopBridgeError('bridge_codex_session_identity_mismatch');
|
|
111
|
-
}
|
|
112
109
|
return { thread_id: threadId, session_id: sessionId };
|
|
113
110
|
}
|
|
114
111
|
function comparableOrigin(value, referer) {
|
|
@@ -2,6 +2,7 @@ import { createHash, randomInt, timingSafeEqual } from 'node:crypto';
|
|
|
2
2
|
import http, {} from 'node:http';
|
|
3
3
|
import net, {} from 'node:net';
|
|
4
4
|
import { forwardHttp, prepareDesktopBridgeRequest } from './http-forward.js';
|
|
5
|
+
import { createDesktopBridgeRejectionLogger } from './rejection-log.js';
|
|
5
6
|
import { assertAllowedOrigin, assertAllowedPath, assertLoopbackPeer, assertLoopbackListenHost, assertWebSocketUpgrade, prepareDesktopBridgeConfig, safeBridgeErrorCode, validatePreparedDesktopBridgeConfig, } from './security.js';
|
|
6
7
|
import { createDesktopBridgePublicState, desktopBridgeListenOrigin, desktopBridgeStatePath, refreshDesktopBridgeState, removeDesktopBridgeStateIfOwned, writeDesktopBridgeState, } from './state.js';
|
|
7
8
|
import { DesktopBridgeError } from './types.js';
|
|
@@ -103,12 +104,21 @@ function rejectionStatusText(status) {
|
|
|
103
104
|
return 'Service Unavailable';
|
|
104
105
|
return 'Bad Request';
|
|
105
106
|
}
|
|
106
|
-
|
|
107
|
+
const logBridgeRejection = createDesktopBridgeRejectionLogger();
|
|
108
|
+
function writeBridgeRejection(res, error, req) {
|
|
109
|
+
const rejectedCode = safeBridgeErrorCode(error);
|
|
110
|
+
logBridgeRejection({
|
|
111
|
+
code: rejectedCode,
|
|
112
|
+
transport: 'http',
|
|
113
|
+
method: req?.method,
|
|
114
|
+
url: req?.url,
|
|
115
|
+
status: rejectionStatus(rejectedCode),
|
|
116
|
+
});
|
|
107
117
|
if (res.headersSent) {
|
|
108
118
|
res.destroy(error instanceof Error ? error : undefined);
|
|
109
119
|
return;
|
|
110
120
|
}
|
|
111
|
-
const code =
|
|
121
|
+
const code = rejectedCode;
|
|
112
122
|
res.writeHead(rejectionStatus(code), {
|
|
113
123
|
'content-type': 'application/json',
|
|
114
124
|
'cache-control': 'no-store',
|
|
@@ -116,7 +126,14 @@ function writeBridgeRejection(res, error) {
|
|
|
116
126
|
});
|
|
117
127
|
res.end(JSON.stringify({ error: { type: 'sks_bridge_rejection', code, message: code } }));
|
|
118
128
|
}
|
|
119
|
-
function writeUpgradeRejection(socket, error) {
|
|
129
|
+
function writeUpgradeRejection(socket, error, req) {
|
|
130
|
+
logBridgeRejection({
|
|
131
|
+
code: safeBridgeErrorCode(error),
|
|
132
|
+
transport: 'websocket',
|
|
133
|
+
method: req?.method,
|
|
134
|
+
url: req?.url,
|
|
135
|
+
status: rejectionStatus(safeBridgeErrorCode(error)),
|
|
136
|
+
});
|
|
120
137
|
socket.on('error', () => undefined);
|
|
121
138
|
if (socket.destroyed || socket.writableEnded)
|
|
122
139
|
return;
|
|
@@ -235,7 +252,7 @@ export async function startPreparedDesktopBridge(input, options = {}) {
|
|
|
235
252
|
if (!req.complete)
|
|
236
253
|
req.destroy();
|
|
237
254
|
});
|
|
238
|
-
writeBridgeRejection(res, error);
|
|
255
|
+
writeBridgeRejection(res, error, req);
|
|
239
256
|
}
|
|
240
257
|
finally {
|
|
241
258
|
if (admitted)
|
|
@@ -266,10 +283,10 @@ export async function startPreparedDesktopBridge(input, options = {}) {
|
|
|
266
283
|
return;
|
|
267
284
|
}
|
|
268
285
|
assertAllowedPath(authenticated.pathname, input.allowedPathPrefixes);
|
|
269
|
-
void forwardWebSocket(req, socket, head, input, `${desktopBridgeListenOrigin(input)}${authenticated.clientBasePath}`).catch((error) => writeUpgradeRejection(socket, error));
|
|
286
|
+
void forwardWebSocket(req, socket, head, input, `${desktopBridgeListenOrigin(input)}${authenticated.clientBasePath}`).catch((error) => writeUpgradeRejection(socket, error, req));
|
|
270
287
|
}
|
|
271
288
|
catch (error) {
|
|
272
|
-
writeUpgradeRejection(socket, error);
|
|
289
|
+
writeUpgradeRejection(socket, error, req);
|
|
273
290
|
}
|
|
274
291
|
});
|
|
275
292
|
await listenExact(server, input.listenHost, input.listenPort);
|
|
@@ -2,6 +2,7 @@ import { createHash, randomUUID } from 'node:crypto';
|
|
|
2
2
|
import fsp from 'node:fs/promises';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
+
import { PACKAGE_VERSION } from '../../version.js';
|
|
5
6
|
import { DESKTOP_BRIDGE_STATE_SCHEMA, DesktopBridgeError } from './types.js';
|
|
6
7
|
const DEFAULT_FRESHNESS_MS = 5 * 60_000;
|
|
7
8
|
export function desktopBridgeStatePath(home = os.homedir()) {
|
|
@@ -38,8 +39,18 @@ export function createDesktopBridgePublicState(config, options = {}) {
|
|
|
38
39
|
provider_registry_generation: registry.generation, route_policy_generation: config.routePolicy.policy_generation,
|
|
39
40
|
catalog_generation: config.routePolicy.catalog_generation, enabled_providers: enabled,
|
|
40
41
|
provider_credential_generations: credentialGenerations, last_verified_probe_ids: [], config_generation: desktopBridgeConfigGeneration(config),
|
|
42
|
+
sks_version: PACKAGE_VERSION,
|
|
41
43
|
};
|
|
42
44
|
}
|
|
45
|
+
export function desktopBridgeRuntimeVersion(state) {
|
|
46
|
+
const version = state?.sks_version;
|
|
47
|
+
return typeof version === 'string' && version.trim() ? version.trim() : null;
|
|
48
|
+
}
|
|
49
|
+
export function desktopBridgeRuntimeVersionStale(state, installed = PACKAGE_VERSION) {
|
|
50
|
+
if (!state)
|
|
51
|
+
return false;
|
|
52
|
+
return desktopBridgeRuntimeVersion(state) !== installed;
|
|
53
|
+
}
|
|
43
54
|
function isGeneration(value) { return typeof value === 'string' && value.length > 0 && value.length <= 256 && !/[\r\n\0]/.test(value); }
|
|
44
55
|
export function isDesktopBridgePublicState(value) {
|
|
45
56
|
if (!value || typeof value !== 'object')
|
|
@@ -9,6 +9,8 @@ import { loadCodexLbEnv } from './codex-lb-env.js';
|
|
|
9
9
|
import { resolveOpenRouterApiKey } from '../providers/openrouter/openrouter-secret-store.js';
|
|
10
10
|
import { cleanupRetiredDesktopBridgeRuntime, prepareRetiredDesktopBridgeRuntime, } from './desktop-bridge-migration/retired-runtime-cleanup.js';
|
|
11
11
|
import { canonicalizeBridgeModelId, normalizeBridgeUpstreamModelId, sha256Stable } from './route-index.js';
|
|
12
|
+
import { desktopBridgeRuntimeVersion, desktopBridgeRuntimeVersionStale } from './desktop-bridge/state.js';
|
|
13
|
+
import { PACKAGE_VERSION } from '../version.js';
|
|
12
14
|
import { DESKTOP_BRIDGE_ALLOWED_PATH_PREFIXES, DESKTOP_BRIDGE_LAUNCHD_LABEL, desktopBridgeConfigGeneration, desktopBridgeLaunchdPlistPath, desktopBridgeProcessExists, desktopBridgeStatePath, getDesktopBridgeStatus, preflightDesktopBridge, readDesktopBridgeState, safeBridgeErrorCode, writeDesktopBridgeLaunchdPlist, selectAvailableDesktopBridgePort, startPreparedDesktopBridge, DESKTOP_BRIDGE_STATE_SCHEMA, DesktopBridgeError, } from './desktop-bridge/index.js';
|
|
13
15
|
export const DEFAULT_DESKTOP_BRIDGE_HOST = '127.0.0.1';
|
|
14
16
|
export const DEFAULT_DESKTOP_BRIDGE_PORT = 49_152;
|
|
@@ -307,6 +309,9 @@ export async function desktopBridgeServiceStatus(options = {}) {
|
|
|
307
309
|
blockers.push(bridgeStatusBlocker(bridge));
|
|
308
310
|
if (launchd.loaded && !launchd.running)
|
|
309
311
|
blockers.push('desktop_bridge_launchd_not_running');
|
|
312
|
+
if (bridge.status === 'running' && desktopBridgeRuntimeVersionStale(bridge.state)) {
|
|
313
|
+
blockers.push(`desktop_bridge_runtime_version_stale:${desktopBridgeRuntimeVersion(bridge.state) || 'pre-8.6.2'}:${PACKAGE_VERSION}`);
|
|
314
|
+
}
|
|
310
315
|
return { schema: DESKTOP_BRIDGE_SERVICE_SCHEMA, ok: bridge.status === 'running' && blockers.length === 0, supported: true, installed: await exists(paths.launch_agent_path), loaded: launchd.loaded, running: bridge.status === 'running', status: !settings ? 'settings_missing' : blockers.some((b) => b.includes('credential')) ? 'credentials_unavailable' : bridge.status, service, paths, state: bridge.state, settings, expected_config_generation: expected, credential_source: source, credential_sources: sources, blockers: [...new Set(blockers.filter(Boolean))] };
|
|
311
316
|
}
|
|
312
317
|
export async function installAndStartDesktopBridgeService(options = {}) {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
export const NPM_REGISTRY = 'https://registry.npmjs.org/';
|
|
5
|
+
function npmBinary() {
|
|
6
|
+
return process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
7
|
+
}
|
|
8
|
+
function registryReadEnv() {
|
|
9
|
+
const env = {};
|
|
10
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
11
|
+
if (/^npm_config_/i.test(key) && !/^npm_config_(?:registry|cache|userconfig|globalconfig|prefix)$/i.test(key))
|
|
12
|
+
continue;
|
|
13
|
+
if (/^npm_(?:command|lifecycle_event|package_)/i.test(key))
|
|
14
|
+
continue;
|
|
15
|
+
env[key] = value;
|
|
16
|
+
}
|
|
17
|
+
env.npm_config_registry = NPM_REGISTRY;
|
|
18
|
+
env.npm_config_cache = process.env.SKS_RELEASE_NPM_CACHE || path.join(os.tmpdir(), 'sneakoscope-npm-cache');
|
|
19
|
+
return env;
|
|
20
|
+
}
|
|
21
|
+
function runNpm(args, timeoutMs = 30_000) {
|
|
22
|
+
return spawnSync(npmBinary(), [...args], {
|
|
23
|
+
encoding: 'utf8',
|
|
24
|
+
timeout: timeoutMs,
|
|
25
|
+
env: registryReadEnv(),
|
|
26
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function normalizeNpmUser(value) {
|
|
30
|
+
const user = String(value || '').trim().split('\n').pop()?.trim() || '';
|
|
31
|
+
return /^[A-Za-z0-9._~-]{1,128}$/.test(user) ? user : null;
|
|
32
|
+
}
|
|
33
|
+
function maintainerLogins(raw) {
|
|
34
|
+
try {
|
|
35
|
+
const parsed = JSON.parse(raw);
|
|
36
|
+
const rows = Array.isArray(parsed) ? parsed : [parsed];
|
|
37
|
+
return rows
|
|
38
|
+
.map((row) => (typeof row === 'string' ? row.split('<')[0] : row?.name))
|
|
39
|
+
.map((login) => String(login || '').trim())
|
|
40
|
+
.filter(Boolean);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function inspectPublishRegistryAuth(input = {}) {
|
|
47
|
+
const base = {
|
|
48
|
+
schema: 'sks.publish-registry-auth.v1',
|
|
49
|
+
registry: NPM_REGISTRY,
|
|
50
|
+
package: input.packageName || null,
|
|
51
|
+
npm_user: null,
|
|
52
|
+
maintainers: [],
|
|
53
|
+
blockers: [],
|
|
54
|
+
operator_actions: []
|
|
55
|
+
};
|
|
56
|
+
if (input.publishing === false) {
|
|
57
|
+
return { ...base, ok: true, status: 'skipped_not_publishing' };
|
|
58
|
+
}
|
|
59
|
+
if (String(process.env.SKS_PUBLISH_AUTH_MODE || 'token').trim().toLowerCase() === 'trusted-publisher') {
|
|
60
|
+
return { ...base, ok: true, status: 'skipped_trusted_publisher' };
|
|
61
|
+
}
|
|
62
|
+
if (process.env.SKS_SKIP_REGISTRY_NETWORK_CHECK === '1') {
|
|
63
|
+
return { ...base, ok: true, status: 'skipped_offline' };
|
|
64
|
+
}
|
|
65
|
+
const whoami = runNpm(['whoami', '--registry', NPM_REGISTRY]);
|
|
66
|
+
const user = whoami.status === 0 ? normalizeNpmUser(whoami.stdout) : null;
|
|
67
|
+
if (!user) {
|
|
68
|
+
return {
|
|
69
|
+
...base,
|
|
70
|
+
ok: false,
|
|
71
|
+
status: 'unauthenticated',
|
|
72
|
+
blockers: ['npm_publish_auth_missing_or_expired'],
|
|
73
|
+
operator_actions: [
|
|
74
|
+
`Not authenticated to ${NPM_REGISTRY}. Run \`npm login --registry ${NPM_REGISTRY}\` and publish again.`,
|
|
75
|
+
'npm answers an unauthorized publish with 404, not 401, so this would otherwise surface as '
|
|
76
|
+
+ '"404 Not Found - PUT" after the whole tarball had already been built.'
|
|
77
|
+
]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const maintainers = input.packageName
|
|
81
|
+
? maintainerLogins(runNpm(['view', input.packageName, 'maintainers', '--json', '--registry', NPM_REGISTRY]).stdout || '')
|
|
82
|
+
: [];
|
|
83
|
+
if (maintainers.length > 0 && !maintainers.includes(user)) {
|
|
84
|
+
return {
|
|
85
|
+
...base,
|
|
86
|
+
ok: false,
|
|
87
|
+
status: 'not_a_maintainer',
|
|
88
|
+
npm_user: user,
|
|
89
|
+
maintainers,
|
|
90
|
+
blockers: ['npm_publish_user_is_not_a_maintainer'],
|
|
91
|
+
operator_actions: [
|
|
92
|
+
`Authenticated as \`${user}\`, who is not a maintainer of ${input.packageName} `
|
|
93
|
+
+ `(${maintainers.join(', ')}). Log in as a maintainer, or have an owner run `
|
|
94
|
+
+ `\`npm owner add ${user} ${input.packageName}\`.`
|
|
95
|
+
]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return { ...base, ok: true, status: 'authenticated', npm_user: user, maintainers };
|
|
99
|
+
}
|
|
100
|
+
export function isRealNpmPublish(env = process.env) {
|
|
101
|
+
if (String(env.npm_command || '').trim() !== 'publish')
|
|
102
|
+
return false;
|
|
103
|
+
return String(env.npm_config_dry_run || '').trim() !== 'true';
|
|
104
|
+
}
|
|
@@ -156,11 +156,17 @@ export async function refreshSubagentWaveLifecycle(artifactDir, input = {}) {
|
|
|
156
156
|
const targetSubagents = countPolicy === 'exact' && existing
|
|
157
157
|
? requestedTargetSubagents
|
|
158
158
|
: Math.min(automaticSubagentTargetCap(plan), Math.max(requestedTargetSubagents, normalizeCount(existing?.target_subagents), startedCount));
|
|
159
|
-
const
|
|
160
|
-
|
|
159
|
+
const capacityController = plan.capacity_controller;
|
|
160
|
+
const plannedWaveFloor = positiveCount(plan.first_wave)
|
|
161
|
+
|| positiveCount(capacityController?.selected_capacity)
|
|
161
162
|
|| positiveCount(existing?.wave_capacity)
|
|
162
163
|
|| positiveCount(plan.max_threads)
|
|
163
164
|
|| targetSubagents;
|
|
165
|
+
const liveThreadSlots = positiveCount(capacityController?.available_thread_slots);
|
|
166
|
+
const configuredThreadCap = positiveCount(plan.max_threads) || targetSubagents;
|
|
167
|
+
const waveCapacity = targetSubagents > planRequestedSubagents
|
|
168
|
+
? Math.min(configuredThreadCap, Math.max(plannedWaveFloor, liveThreadSlots ? Math.min(liveThreadSlots, targetSubagents) : targetSubagents))
|
|
169
|
+
: plannedWaveFloor;
|
|
164
170
|
const next = projectLifecycle(existing || createSubagentWaveLifecycle({
|
|
165
171
|
workflowRunId,
|
|
166
172
|
targetSubagents,
|
package/dist/core/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = '8.6.
|
|
1
|
+
export const PACKAGE_VERSION = '8.6.3';
|
|
@@ -1,15 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { fileURLToPath } from 'node:url';
|
|
4
5
|
import { inspectPublishPreflight } from '../core/release/publish-preflight.js';
|
|
6
|
+
import { inspectPublishRegistryAuth, isRealNpmPublish } from '../core/release/publish-registry-auth.js';
|
|
5
7
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
6
8
|
const report = inspectPublishPreflight({
|
|
7
9
|
root,
|
|
8
10
|
requireReleaseTag: false,
|
|
9
11
|
requirePhysicalReleaseGates: false,
|
|
10
12
|
});
|
|
11
|
-
|
|
13
|
+
const publishing = isRealNpmPublish();
|
|
14
|
+
const packageName = (() => {
|
|
15
|
+
try {
|
|
16
|
+
return String(JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).name || '') || null;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
})();
|
|
22
|
+
const registryAuth = inspectPublishRegistryAuth({ packageName, publishing });
|
|
23
|
+
const combined = {
|
|
24
|
+
...report,
|
|
25
|
+
registry_auth: registryAuth,
|
|
26
|
+
ok: report.ok && registryAuth.ok,
|
|
27
|
+
blockers: [...report.blockers, ...registryAuth.blockers],
|
|
28
|
+
};
|
|
29
|
+
console.log(JSON.stringify(combined, null, 2));
|
|
12
30
|
if (!report.ok) {
|
|
13
31
|
console.error(`npm publish blocked by reproducibility preflight: ${report.blockers.join(', ')}`);
|
|
14
|
-
process.exitCode = 1;
|
|
15
32
|
}
|
|
33
|
+
if (!registryAuth.ok) {
|
|
34
|
+
console.error(`npm publish blocked by registry auth: ${registryAuth.blockers.join(', ')}`);
|
|
35
|
+
for (const action of registryAuth.operator_actions)
|
|
36
|
+
console.error(action);
|
|
37
|
+
}
|
|
38
|
+
if (!combined.ok)
|
|
39
|
+
process.exitCode = 1;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sneakoscope",
|
|
3
3
|
"displayName": "ㅅㅋㅅ",
|
|
4
|
-
"version": "8.6.
|
|
4
|
+
"version": "8.6.3",
|
|
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",
|