sneakoscope 10.3.0 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,7 +16,7 @@
16
16
  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.
17
17
  <!-- END SKS SEARCH VISIBILITY MARKETING -->
18
18
 
19
- Current package: **SKS 10.3.0**. Install the latest stable release from npm.
19
+ Current package: **SKS 10.3.1**. Install the latest stable release from npm.
20
20
 
21
21
  [Quick start](#install-in-one-command) · [Commands](#everyday-commands) · [SKS Center](#sks-center-macos) · [Documentation](#documentation) · [Changelog](CHANGELOG.md)
22
22
 
@@ -259,7 +259,7 @@ dependencies = [
259
259
 
260
260
  [[package]]
261
261
  name = "sks-core"
262
- version = "10.3.0"
262
+ version = "10.3.1"
263
263
  dependencies = [
264
264
  "globset",
265
265
  "grep-matcher",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "sks-core"
3
- version = "10.3.0"
3
+ version = "10.3.1"
4
4
  edition = "2021"
5
5
 
6
6
  [dependencies]
@@ -4,6 +4,14 @@ import { escapeRegExp } from '../core/text/regex.js';
4
4
  export const DESKTOP_BRIDGE_MANAGED_MARKER = '# sks-desktop-bridge-managed';
5
5
  export const DESKTOP_BRIDGE_MANAGED_BASE_URL_MARKER = '# sks-desktop-bridge-managed-base-url';
6
6
  export const DESKTOP_BRIDGE_MANAGED_MODEL_CATALOG_MARKER = '# sks-desktop-bridge-managed-model-catalog';
7
+ export function bindCodexClientProvider(text, provider) {
8
+ const selected = topLevelTomlString(text, 'model_provider');
9
+ if (selected && selected !== 'openai' && selected !== 'codex-lb')
10
+ return text;
11
+ if (selected === provider)
12
+ return text;
13
+ return upsertTopLevelTomlString(String(text || ''), 'model_provider', provider);
14
+ }
7
15
  export function upsertDesktopBridgeManagedConfig(text, input) {
8
16
  const bridgeBaseUrl = normalizeManagedBridgeBaseUrl(input.bridgeBaseUrl);
9
17
  const combinedCatalogPath = String(input.combinedCatalogPath || '').trim();
@@ -16,7 +24,8 @@ export function upsertDesktopBridgeManagedConfig(text, input) {
16
24
  const orphanCleanup = removeDesktopBridgeOrphanManagedMarkers(String(text || ''));
17
25
  let next = orphanCleanup.text;
18
26
  const selectedProvider = topLevelTomlString(next, 'model_provider');
19
- if (selectedProvider && (selectedProvider !== 'openai'
27
+ const managedProvider = selectedProvider === 'codex-lb' || selectedProvider === 'openai';
28
+ if (selectedProvider && (!managedProvider
20
29
  || !topLevelHasLine(next, DESKTOP_BRIDGE_MANAGED_MARKER))) {
21
30
  throw new Error('historical_user_owned_config_conflict:model_provider');
22
31
  }
@@ -30,8 +39,9 @@ export function upsertDesktopBridgeManagedConfig(text, input) {
30
39
  if (existingCatalog && !catalogOwned) {
31
40
  throw new Error('historical_user_owned_config_conflict:model_catalog_json');
32
41
  }
42
+ const keepCodexLb = selectedProvider === 'codex-lb';
33
43
  next = removeManagedBridgeTopLevelBindings(next);
34
- next = upsertTopLevelTomlString(next, 'model_provider', 'openai');
44
+ next = upsertTopLevelTomlString(next, 'model_provider', keepCodexLb ? 'codex-lb' : 'openai');
35
45
  next = addTopLevelMarkerBeforeKey(next, 'model_provider', DESKTOP_BRIDGE_MANAGED_MARKER);
36
46
  next = upsertTopLevelTomlString(next, 'openai_base_url', bridgeBaseUrl);
37
47
  next = addTopLevelMarkerBeforeKey(next, 'openai_base_url', DESKTOP_BRIDGE_MANAGED_BASE_URL_MARKER);
@@ -45,7 +55,7 @@ export function removeDesktopBridgeManagedConfig(text) {
45
55
  const baseUrl = topLevelTomlString(next, 'openai_base_url');
46
56
  const catalog = topLevelTomlString(next, 'model_catalog_json');
47
57
  const owned = [
48
- [DESKTOP_BRIDGE_MANAGED_MARKER, 'model_provider', selectedProvider === 'openai'],
58
+ [DESKTOP_BRIDGE_MANAGED_MARKER, 'model_provider', selectedProvider === 'openai' || selectedProvider === 'codex-lb'],
49
59
  [DESKTOP_BRIDGE_MANAGED_BASE_URL_MARKER, 'openai_base_url', Boolean(baseUrl)],
50
60
  [DESKTOP_BRIDGE_MANAGED_MODEL_CATALOG_MARKER, 'model_catalog_json', Boolean(catalog)]
51
61
  ];
@@ -67,7 +77,7 @@ export function removeDesktopBridgeOrphanManagedMarkers(text) {
67
77
  const source = String(text || '');
68
78
  const selectedProvider = topLevelTomlString(source, 'model_provider');
69
79
  const markerTargets = [
70
- [DESKTOP_BRIDGE_MANAGED_MARKER, selectedProvider === 'openai'],
80
+ [DESKTOP_BRIDGE_MANAGED_MARKER, selectedProvider === 'openai' || selectedProvider === 'codex-lb'],
71
81
  [DESKTOP_BRIDGE_MANAGED_BASE_URL_MARKER, Boolean(topLevelTomlString(source, 'openai_base_url'))],
72
82
  [DESKTOP_BRIDGE_MANAGED_MODEL_CATALOG_MARKER, Boolean(topLevelTomlString(source, 'model_catalog_json'))]
73
83
  ];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "sks.skills-manifest.v1",
3
- "package_version": "10.3.0",
3
+ "package_version": "10.3.1",
4
4
  "skills": [
5
5
  {
6
6
  "canonical_name": "sks",
@@ -1,3 +1,6 @@
1
+ import { bindCodexClientProvider } from '../../../cli/install-helpers-codex-lb-config.js';
2
+ import { safeWriteCodexConfigToml } from '../../codex-runtime/codex-desktop-config-policy.js';
3
+ import { readText } from '../../fsx.js';
1
4
  import { testOpenRouterConnection } from '../../providers/openrouter/openrouter-account.js';
2
5
  import { openRouterSecretPaths } from '../../providers/openrouter/openrouter-secret-store.js';
3
6
  import { codexLbEnvPath, codexLbMetadataPath, readCodexLbModelCatalog } from '../codex-lb-env.js';
@@ -108,6 +111,12 @@ export async function setProviderState(providerId, enabled, operation, options)
108
111
  });
109
112
  }
110
113
  }
114
+ if (providerId === 'codex-lb') {
115
+ const current = await readText(paths.configPath, '');
116
+ const next = bindCodexClientProvider(current, enabled ? 'codex-lb' : 'openai');
117
+ if (next !== current)
118
+ await safeWriteCodexConfigToml(paths.configPath, current, next, 'codex-lb-client-provider');
119
+ }
111
120
  const status = await desktopBridgeStatusV3(options);
112
121
  return commandResult(operation, true, status, { provider_id: providerId, enabled }, [], options);
113
122
  }
@@ -128,6 +128,41 @@ async function decideOfficialSubagentPreparationInner(input, started) {
128
128
  overrides?.observe?.({ mode: config.mode, eligible: true, compiled, receipt });
129
129
  return result;
130
130
  }
131
+ export async function consultJevTurnModel(input) {
132
+ const overrides = activeOverrides();
133
+ const env = input.env || process.env;
134
+ const config = overrides?.config ?? await readDecisionConfig(env);
135
+ if (!jevEnabled(config))
136
+ return { called: false, model: null, reason: 'off' };
137
+ const resolved = await resolveOpenRouterApiKey({ env });
138
+ if (!resolved.key)
139
+ return { called: false, model: null, reason: 'missing_key' };
140
+ const prompt = String(input.prompt || '').trim();
141
+ if (!prompt)
142
+ return { called: false, model: null, reason: 'empty_prompt' };
143
+ const bundle = buildDecisionBundle({
144
+ projectId: sha256(input.root).slice(0, 32),
145
+ workflowRunId: 'turn',
146
+ workflowRevision: 'turn',
147
+ sourceDigest: 'turn',
148
+ graphDigest: null,
149
+ goal: prompt,
150
+ routingCandidates: [{ id: 'turn', summary: prompt.slice(0, 240) }]
151
+ });
152
+ const transport = await requestOpenRouterDecision(bundle, {
153
+ env,
154
+ deadlineMs: DESIGN_DEFAULTS.deadlineMs,
155
+ ...(overrides?.fetchImpl ? { fetchImpl: overrides.fetchImpl } : {})
156
+ });
157
+ if (!transport.ok)
158
+ return { called: true, model: null, reason: transport.reason };
159
+ const compiled = compileDecision(bundle, transport.response);
160
+ if (compiled.kind !== 'apply')
161
+ return { called: true, model: null, reason: compiled.reason };
162
+ const selected = assembleRoutingSelection(compiled.effects.flatMap((effect) => (effect.kind === 'select_routing' ? [{ roleId: effect.roleId, model: effect.model }] : [])));
163
+ const model = selected?.models.turn || null;
164
+ return { called: true, model, reason: model ? 'applied' : 'keep_baseline' };
165
+ }
131
166
  export function effectAlreadyConsumed(identity) {
132
167
  return appliedEffects.has(identity);
133
168
  }
@@ -22,6 +22,7 @@ import { codePackFreshnessNote } from './hooks-runtime/code-pack-freshness-prefl
22
22
  import { claimHookInvocation } from './hooks-runtime/hook-invocation-dedupe.js';
23
23
  import { armLightTurnStopBypass, clearLightTurnStopBypass, consumeLightTurnStopBypass, hasMatchingLightTurnStopBypass } from './hooks-runtime/light-turn.js';
24
24
  import { evaluateHookNarutoDecisionGate, looksLikeActiveContinuationPrompt } from './hooks-runtime/naruto-decision-gate.js';
25
+ import { consultJevTurnModel } from './decisions/integration.js';
25
26
  import { ensureOfficialSubagentArtifactDirConfined, inspectActiveOfficialSubagentWorkflow, recordOfficialSubagentLifecycleCaptureFailure, officialSubagentArtifactDir, recordAndRefreshSubagentEvidence, refreshOfficialSubagentCompletionArtifacts } from './hooks-runtime/official-subagent-lifecycle.js';
26
27
  import { finalizationRepeatDecision } from './hooks-runtime/stop-repeat-guard.js';
27
28
  import { armCodexGitActionStopBypass, consumeCodexGitActionStopBypass, consumeLightRouteStop, hasCompletionSummary, hasDfixLightCompletion, hasHonestMode, hasHonestModeUnresolvedGap, honestModeLoopbackBudgetExhausted, recordHonestModeLoopback, recordHonestModeTerminalUnverified, resolveHonestModeLoopback, shouldLoopBackAfterHonestMode, successfulAppNarutoStopNeedsVisibleSummary } from './hooks-runtime/stop-finalization.js';
@@ -120,7 +121,8 @@ export async function evaluateHookPayload(name, payload = {}, opts = {}) {
120
121
  const withNarutoDecision = (result) => ({ ...result, sksNarutoDecision });
121
122
  if (name === 'user-prompt-submit') {
122
123
  const result = await hookUserPrompt(root, state, payload, noQuestion, sessionKey);
123
- const withSkillContext = await attachAuthoritativeSksSkillContext(root, state, payload, result);
124
+ const withJev = await attachJevTurnRouting(root, payload, result);
125
+ const withSkillContext = await attachAuthoritativeSksSkillContext(root, state, payload, withJev);
124
126
  return withNarutoDecision(attachOfficialSubagentSpawnCompatibilityContext(state, payload, withSkillContext));
125
127
  }
126
128
  if (name === 'session-start' || name === 'pre-compact' || name === 'post-compact') {
@@ -233,6 +235,28 @@ async function hookSubagentStart(root, state, payload = {}, sessionKey = null) {
233
235
  const additionalContext = [coreEngineeringDirectiveReferenceText(), resourceGuard, routingContext, active, skillContext].filter(Boolean).join('\n\n');
234
236
  return { continue: true, additionalContext, ...(skillBlockers.length ? { silent: true } : {}) };
235
237
  }
238
+ async function attachJevTurnRouting(root, payload, result) {
239
+ if (!result || result.decision === 'block')
240
+ return result;
241
+ const prompt = stripVisibleDecisionAnswerBlocks(extractUserPrompt(payload));
242
+ if (!String(prompt || '').trim())
243
+ return result;
244
+ const decision = await consultJevTurnModel({ root, prompt }).catch(() => null);
245
+ if (!decision?.called)
246
+ return result;
247
+ const line = decision.model
248
+ ? `Jev sealed this turn to ${decision.model}. Use that sealed model and do not reclassify it.`
249
+ : '';
250
+ if (!line)
251
+ return { ...result, jev_turn: decision };
252
+ const additionalContext = [result.additionalContext, line].filter(Boolean).join('\n\n');
253
+ return {
254
+ ...result,
255
+ additionalContext,
256
+ jev_turn: decision,
257
+ ...(result.systemMessage ? { systemMessage: visibleHookMessage('user-prompt-submit', additionalContext) } : {})
258
+ };
259
+ }
236
260
  async function hookUserPrompt(root, state, payload, noQuestion, sessionKey = null) {
237
261
  await clearLightTurnStopBypass(root, { sessionKey }).catch(() => undefined);
238
262
  const submittedPrompt = stripVisibleDecisionAnswerBlocks(extractUserPrompt(payload));
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '10.3.0';
1
+ export const PACKAGE_VERSION = '10.3.1';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sneakoscope",
3
3
  "displayName": "ㅅㅋㅅ",
4
- "version": "10.3.0",
4
+ "version": "10.3.1",
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",