sneakoscope 9.0.6 → 9.1.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 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.6** — its own identity, read from `package.json` and subject to release-gate verification, not advice about what to install.
25
+ This README documents package **SKS 9.1.0** — 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
 
@@ -259,7 +259,7 @@ dependencies = [
259
259
 
260
260
  [[package]]
261
261
  name = "sks-core"
262
- version = "9.0.6"
262
+ version = "9.1.0"
263
263
  dependencies = [
264
264
  "globset",
265
265
  "grep-matcher",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "sks-core"
3
- version = "9.0.6"
3
+ version = "9.1.0"
4
4
  edition = "2021"
5
5
 
6
6
  [dependencies]
@@ -302,6 +302,9 @@ export function safeReadOnlySubcommand(command, args) {
302
302
  if (command === 'mcp' && sub === 'config' && ['list', 'test', 'backups', 'show'].includes(nested)) {
303
303
  return !args.some((arg) => ['--fix', '--yes', '-y', '--write', '--apply', '--execute', '--force', '--real'].includes(String(arg)));
304
304
  }
305
+ if (command === 'codex-app' && sub === 'context-1m' && (nested === 'status' || nested === '' || nested.startsWith('--'))) {
306
+ return !args.some((arg) => ['--fix', '--yes', '-y', '--write', '--apply', '--execute', '--force', '--real'].includes(String(arg)));
307
+ }
305
308
  if (command === 'remote' && ['readiness', 'status', 'show'].includes(sub)) {
306
309
  return !args.some((arg) => ['--fix', '--yes', '-y', '--write', '--apply', '--execute', '--force', '--real'].includes(String(arg)));
307
310
  }
@@ -16,6 +16,35 @@ export async function run(_command, args = []) {
16
16
  const action = args[0] || 'check';
17
17
  if (action === 'restart')
18
18
  return printCodexAppResult(args, await restartCodexApp());
19
+ if (action === 'context-1m') {
20
+ const { codexContext1mCommand } = await import('../core/codex-app/codex-context-window.js');
21
+ const result = await codexContext1mCommand(args.slice(1));
22
+ if (flag(args, '--json')) {
23
+ printJson(result);
24
+ if (!result.ok)
25
+ process.exitCode = 1;
26
+ return;
27
+ }
28
+ console.log(`Codex 1M Context: ${result.enabled ? 'enabled' : 'disabled'}`);
29
+ console.log(`Config: ${result.config_path}`);
30
+ console.log(`Model: ${result.model || 'not set'} (documented for ${result.expected_model})`);
31
+ for (const [key, target] of Object.entries(result.target)) {
32
+ const state = result.keys[key];
33
+ const detail = state?.present ? `${state.value ?? 'unparsed'}${state.managed ? ' (SKS-managed)' : ''}` : 'not set';
34
+ console.log(`${key}: ${detail} · target ${target}`);
35
+ }
36
+ if (result.restart)
37
+ console.log(`Restart: ${result.restart.status}${result.restart.reason ? ` (${result.restart.reason})` : ''}`);
38
+ for (const note of result.notes)
39
+ console.log(`Note: ${note}`);
40
+ for (const warning of result.warnings)
41
+ console.log(`- warning: ${warning}`);
42
+ for (const blocker of result.blockers)
43
+ console.log(`- blocker: ${blocker}`);
44
+ if (!result.ok)
45
+ process.exitCode = 1;
46
+ return;
47
+ }
19
48
  if (action === 'remote-control' || action === 'remote')
20
49
  return codexAppRemoteControlCommand(args.slice(1));
21
50
  if (action === 'harness-matrix') {
@@ -108,7 +137,7 @@ export async function run(_command, args = []) {
108
137
  process.exitCode = 1;
109
138
  return;
110
139
  }
111
- console.error('Usage: sks codex-app check|status|restart|harness-matrix|skill-sync|agent-role-sync|init-deep|hook-lifecycle|execution-profile|role-models|set-role-model --role <name> [--provider <id>] --model <catalog-slug> --reasoning <effort>|reset-role-model --role <name>|product-design [--check-only]|ensure-product-design|chrome-extension|pat status|remote-control [--json]');
140
+ console.error('Usage: sks codex-app check|status|restart|context-1m [status|on|off] [--no-restart]|harness-matrix|skill-sync|agent-role-sync|init-deep|hook-lifecycle|execution-profile|role-models|set-role-model --role <name> [--provider <id>] --model <catalog-slug> --reasoning <effort>|reset-role-model --role <name>|product-design [--check-only]|ensure-product-design|chrome-extension|pat status|remote-control [--json]');
112
141
  console.error('Provider routing moved to: sks bridge provider configure|validate|enable; sks bridge catalog sync; sks bridge route set-default.');
113
142
  process.exitCode = 1;
114
143
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "sks.skills-manifest.v1",
3
- "package_version": "9.0.6",
3
+ "package_version": "9.1.0",
4
4
  "skills": [
5
5
  {
6
6
  "canonical_name": "sks",
@@ -0,0 +1,227 @@
1
+ import { exists, readText } from '../fsx.js';
2
+ import { escapeRegExp } from '../text/regex.js';
3
+ import { safeWriteCodexConfigToml } from '../codex-runtime/codex-desktop-config-policy.js';
4
+ import { codexUserConfigPath, readTopLevelTomlString } from './codex-model-catalog.js';
5
+ import { isCodexAppRunningByBundleId } from './menubar/config.js';
6
+ import { restartCodexApp } from './codex-app-restart.js';
7
+ export const CODEX_CONTEXT_1M_SCHEMA = 'sks.codex-context-1m.v1';
8
+ export const CODEX_CONTEXT_1M_MARKER = 'sks-codex-context-1m';
9
+ export const CODEX_CONTEXT_1M_TARGETS = {
10
+ model_context_window: 1_000_000,
11
+ model_auto_compact_token_limit: 900_000
12
+ };
13
+ export const CODEX_CONTEXT_1M_MODEL = 'gpt-5.6-sol';
14
+ const MANAGED_KEYS = Object.keys(CODEX_CONTEXT_1M_TARGETS);
15
+ function topLevelRegionEnd(lines) {
16
+ const first = lines.findIndex((line) => /^\s*\[.+\]\s*$/.test(line));
17
+ return first === -1 ? lines.length : first;
18
+ }
19
+ function managedLine(key, previous) {
20
+ return `${key} = ${CODEX_CONTEXT_1M_TARGETS[key]} # ${CODEX_CONTEXT_1M_MARKER} prev=${previous}`;
21
+ }
22
+ function inspectKeyLines(lines, key) {
23
+ const end = topLevelRegionEnd(lines);
24
+ const keyPattern = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=`);
25
+ const managedPattern = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=\\s*(\\d+)\\s*#\\s*${escapeRegExp(CODEX_CONTEXT_1M_MARKER)}\\s+prev=(unset|\\d+)\\s*$`);
26
+ const valuePattern = new RegExp(`^\\s*${escapeRegExp(key)}\\s*=\\s*(\\d+)\\s*(?:#.*)?$`);
27
+ let state = null;
28
+ let duplicate = false;
29
+ for (let index = 0; index < end; index += 1) {
30
+ const line = lines[index] || '';
31
+ if (!keyPattern.test(line))
32
+ continue;
33
+ if (state) {
34
+ duplicate = true;
35
+ continue;
36
+ }
37
+ const managed = line.match(managedPattern);
38
+ const value = line.match(valuePattern);
39
+ state = {
40
+ present: true,
41
+ managed: Boolean(managed),
42
+ value: managed ? Number(managed[1]) : value ? Number(value[1]) : null,
43
+ previous: managed ? (managed[2] === 'unset' ? 'unset' : Number(managed[2])) : null,
44
+ duplicate: false,
45
+ lineIndex: index
46
+ };
47
+ }
48
+ if (!state)
49
+ return { present: false, managed: false, value: null, previous: null, duplicate: false, lineIndex: -1 };
50
+ return { ...state, duplicate };
51
+ }
52
+ export function inspectCodexContext1m(text) {
53
+ const lines = String(text || '').split('\n');
54
+ const warnings = [];
55
+ const keys = {};
56
+ for (const key of MANAGED_KEYS) {
57
+ const { lineIndex: _lineIndex, ...state } = inspectKeyLines(lines, key);
58
+ keys[key] = state;
59
+ if (state.duplicate)
60
+ warnings.push(`codex_context_duplicate_key:${key}`);
61
+ if (state.managed && state.value !== CODEX_CONTEXT_1M_TARGETS[key])
62
+ warnings.push(`codex_context_managed_value_drift:${key}`);
63
+ }
64
+ const enabled = MANAGED_KEYS.every((key) => keys[key].managed && keys[key].value === CODEX_CONTEXT_1M_TARGETS[key]);
65
+ return { enabled, model: readTopLevelTomlString(String(text || ''), 'model'), keys, warnings };
66
+ }
67
+ export function enableCodexContext1m(text) {
68
+ const source = String(text || '');
69
+ const lines = source.split('\n');
70
+ const blockers = [];
71
+ const previous = {};
72
+ for (const key of MANAGED_KEYS) {
73
+ const state = inspectKeyLines(lines, key);
74
+ if (state.duplicate)
75
+ blockers.push(`codex_context_duplicate_key:${key}`);
76
+ if (state.present && !state.managed && state.value === null)
77
+ blockers.push(`codex_context_unparseable_value:${key}`);
78
+ }
79
+ if (blockers.length)
80
+ return { next: source, changed: false, previous: {}, restored: {}, blockers, warnings: [] };
81
+ for (const key of MANAGED_KEYS) {
82
+ const state = inspectKeyLines(lines, key);
83
+ if (state.present) {
84
+ const prior = state.managed ? (state.previous ?? 'unset') : state.value;
85
+ previous[key] = prior;
86
+ lines[state.lineIndex] = managedLine(key, prior);
87
+ }
88
+ else {
89
+ previous[key] = 'unset';
90
+ lines.splice(topLevelRegionEnd(lines), 0, managedLine(key, 'unset'));
91
+ }
92
+ }
93
+ const next = lines.join('\n').replace(/^\n+/, '').replace(/\n{3,}/g, '\n\n');
94
+ return { next, changed: next !== source, previous, restored: {}, blockers: [], warnings: [] };
95
+ }
96
+ export function disableCodexContext1m(text) {
97
+ const source = String(text || '');
98
+ const lines = source.split('\n');
99
+ const warnings = [];
100
+ const restored = {};
101
+ for (const key of MANAGED_KEYS) {
102
+ const state = inspectKeyLines(lines, key);
103
+ if (state.duplicate) {
104
+ return { next: source, changed: false, previous: {}, restored: {}, blockers: [`codex_context_duplicate_key:${key}`], warnings: [] };
105
+ }
106
+ if (!state.present)
107
+ continue;
108
+ if (!state.managed) {
109
+ warnings.push(`codex_context_unmanaged_key_left:${key}`);
110
+ continue;
111
+ }
112
+ const prior = state.previous ?? 'unset';
113
+ restored[key] = prior;
114
+ if (prior === 'unset')
115
+ lines.splice(state.lineIndex, 1);
116
+ else
117
+ lines[state.lineIndex] = `${key} = ${prior}`;
118
+ }
119
+ const next = lines.join('\n').replace(/^\n+/, '').replace(/\n{3,}/g, '\n\n');
120
+ return { next, changed: next !== source, previous: {}, restored, blockers: [], warnings };
121
+ }
122
+ export function normalizeCodexContext1mAction(value) {
123
+ const text = String(value || 'status').toLowerCase();
124
+ if (['on', 'enable', 'enabled', '1m'].includes(text))
125
+ return 'on';
126
+ if (['off', 'disable', 'disabled', 'default'].includes(text))
127
+ return 'off';
128
+ return 'status';
129
+ }
130
+ export async function codexContext1mCommand(args = [], opts = {}) {
131
+ const env = opts.env || process.env;
132
+ const action = normalizeCodexContext1mAction(args[0]);
133
+ const noRestart = args.includes('--no-restart');
134
+ const configPath = codexUserConfigPath({ env, ...(opts.home ? { home: opts.home } : {}) });
135
+ const before = String(await readText(configPath, ''));
136
+ const fileExists = await exists(configPath);
137
+ const blockers = [];
138
+ const warnings = [];
139
+ let write = null;
140
+ let changed = false;
141
+ let afterText = before;
142
+ let mutation = null;
143
+ if (action === 'on' || action === 'off') {
144
+ mutation = action === 'on' ? enableCodexContext1m(before) : disableCodexContext1m(before);
145
+ blockers.push(...mutation.blockers);
146
+ warnings.push(...mutation.warnings);
147
+ if (!blockers.length && mutation.changed) {
148
+ write = await safeWriteCodexConfigToml(configPath, before, mutation.next, 'codex-context-1m', {
149
+ verifyUnchangedBeforeWrite: true,
150
+ expectedBeforeExists: fileExists
151
+ });
152
+ if (!write.ok) {
153
+ blockers.push(`codex_config_write_${write.status}`);
154
+ }
155
+ else {
156
+ changed = write.changed;
157
+ afterText = write.expected_after?.text ?? mutation.next;
158
+ }
159
+ }
160
+ }
161
+ const inspection = inspectCodexContext1m(afterText);
162
+ warnings.push(...inspection.warnings);
163
+ if (action === 'on' || inspection.enabled) {
164
+ if (!inspection.model)
165
+ warnings.push('codex_context_model_line_missing');
166
+ else if (inspection.model !== CODEX_CONTEXT_1M_MODEL)
167
+ warnings.push(`codex_context_active_model_not_${CODEX_CONTEXT_1M_MODEL}:${inspection.model}`);
168
+ }
169
+ let restart = null;
170
+ if ((action === 'on' || action === 'off') && !blockers.length) {
171
+ restart = await maybeRestartCodexApp({
172
+ env,
173
+ changed,
174
+ noRestart,
175
+ ...(opts.root === undefined ? {} : { root: opts.root }),
176
+ ...(opts.isRunningImpl === undefined ? {} : { isRunningImpl: opts.isRunningImpl }),
177
+ ...(opts.restartImpl === undefined ? {} : { restartImpl: opts.restartImpl })
178
+ });
179
+ if (restart.attempted && !restart.ok)
180
+ warnings.push('codex_restart_failed_manual_restart_required');
181
+ }
182
+ return {
183
+ schema: CODEX_CONTEXT_1M_SCHEMA,
184
+ ok: blockers.length === 0,
185
+ action,
186
+ enabled: inspection.enabled,
187
+ config_path: configPath,
188
+ model: inspection.model,
189
+ expected_model: CODEX_CONTEXT_1M_MODEL,
190
+ target: { ...CODEX_CONTEXT_1M_TARGETS },
191
+ keys: inspection.keys,
192
+ previous: mutation && action === 'on' ? mutation.previous : null,
193
+ restored: mutation && action === 'off' ? mutation.restored : null,
194
+ changed,
195
+ write: write ? { status: write.status, backup_path: write.backup_path } : null,
196
+ restart,
197
+ blockers,
198
+ warnings,
199
+ notes: [
200
+ 'Only new Codex sessions pick up context-window changes; existing conversations keep their previous limits.',
201
+ 'Requests with more than 272K input tokens are billed at the long-context rate (2x input / 1.5x output) for the entire request.'
202
+ ],
203
+ cli_commands: {
204
+ status: 'sks codex-app context-1m status',
205
+ on: 'sks codex-app context-1m on',
206
+ off: 'sks codex-app context-1m off'
207
+ }
208
+ };
209
+ }
210
+ async function maybeRestartCodexApp(input) {
211
+ const skippedOutcome = (reason) => ({ attempted: false, running: null, status: 'skipped', reason, ok: true, blockers: [] });
212
+ if (input.noRestart)
213
+ return skippedOutcome('no_restart_flag');
214
+ if (!input.changed)
215
+ return skippedOutcome('config_unchanged');
216
+ if (input.env.SKS_SKIP_CODEX_APP_RESTART === '1')
217
+ return skippedOutcome('SKS_SKIP_CODEX_APP_RESTART');
218
+ if (process.platform !== 'darwin')
219
+ return skippedOutcome('not_macos');
220
+ const bundleId = String(input.env.SKS_CODEX_APP_BUNDLE_ID || 'com.openai.codex');
221
+ const running = await (input.isRunningImpl || isCodexAppRunningByBundleId)(bundleId, input.env);
222
+ if (!running) {
223
+ return { attempted: false, running: false, status: 'skipped', reason: 'codex_not_running', ok: true, blockers: [] };
224
+ }
225
+ const result = await (input.restartImpl || restartCodexApp)({ env: input.env, ...(input.root ? { root: input.root } : {}) });
226
+ return { attempted: true, running: true, status: result.status, reason: null, ok: result.ok, blockers: result.blockers };
227
+ }
@@ -644,7 +644,7 @@ export const COMMAND_CATALOG = [
644
644
  { name: 'uninstall', usage: 'sks uninstall [--dry-run] [--yes] [--keep-config] [--keep-data] [--purge-projects] [--json]', description: 'Remove SKS global skills, hooks, menu bar, state, temp files, and optional project residue while preserving user-owned content by default.' },
645
645
  { name: 'deps', usage: 'sks deps check [--json] [--yes]', description: 'Check Node/npm and Codex CLI readiness; pass --yes to repair missing Codex CLI tooling when supported.' },
646
646
  { name: 'codex', usage: 'sks codex compatibility|version|update-status [--refresh]|update|doctor|schema|current [--json]', description: 'Check Codex CLI compatibility/version/update status, run the official `codex update`, and inspect current manifest, capability, and hook-schema evidence.' },
647
- { name: 'codex-app', usage: 'sks codex-app [check|status|restart|product-design|chrome-extension|pat status|remote-control]', description: 'Check Codex App integration, Desktop Bridge readiness, Product Design plugin readiness, Codex Chrome Extension web verification readiness, PAT-safe status, first-party MCP/plugin readiness, and Codex CLI remote-control availability. Provider routing is managed only by sks bridge.' },
647
+ { name: 'codex-app', usage: 'sks codex-app [check|status|restart|context-1m [status|on|off]|product-design|chrome-extension|pat status|remote-control]', description: 'Check Codex App integration, Desktop Bridge readiness, Product Design plugin readiness, Codex Chrome Extension web verification readiness, PAT-safe status, first-party MCP/plugin readiness, Codex CLI remote-control availability, and the opt-in GPT-5.6 Sol 1M context window toggle with automatic Codex restart. Provider routing is managed only by sks bridge.' },
648
648
  { name: 'codex-native', usage: 'sks codex-native status|feature-broker|invocation-plan|init-deep [--json]', description: 'Inspect Codex Native feature broker readiness, invocation routing, pattern evidence, and managed memory setup.' },
649
649
  { name: 'hooks', usage: 'sks hooks explain|status|trust-report|replay|codex-validate|warning-check ... [--json]', description: 'Explain Codex hook events, validate current vendored event output schemas, replay fixtures, and enforce warning-zero SKS hook policies.' },
650
650
  { name: 'remote', usage: 'sks remote readiness|machines|worker ... [--json]', description: 'Inspect official Codex Remote readiness and the allowlisted proof-aware SSH stdio worker surface.' },
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '9.0.6';
1
+ export const PACKAGE_VERSION = '9.1.0';
@@ -30,7 +30,7 @@ final class ControlCenterWindowController: NSWindowController, NSTableViewDataSo
30
30
  .providers: ProvidersViewController(processClient: processClient, operations: operations),
31
31
  .remoteCoding: RemoteCodingViewController(),
32
32
  .diagnostics: DiagnosticsViewController(processClient: processClient, operations: operations),
33
- .settings: SettingsViewController(notifications: notifications)
33
+ .settings: SettingsViewController(processClient: processClient, operations: operations, notifications: notifications)
34
34
  ]
35
35
  let window = NSWindow(
36
36
  contentRect: NSRect(x: 0, y: 0, width: 860, height: 560),
@@ -8,22 +8,41 @@ final class SettingsViewController: NSViewController, ControlCenterPage {
8
8
  case malformed
9
9
  }
10
10
 
11
+ private let processClient: ProcessClient
12
+ private let operations: OperationCoordinator
11
13
  private let notifications: NotificationCoordinator
12
14
  private let followCodexLifecycle = NSButton(checkboxWithTitle: "Show SKS Menu only while Codex is running", target: nil, action: nil)
13
15
  private let status = NativeView.detail("Settings use the native app configuration file.")
16
+ private let contextStatus = NativeView.detail("Codex 1M context: checking current state…")
14
17
  private var notificationButton: NSButton!
15
- init(notifications: NotificationCoordinator) { self.notifications = notifications; super.init(nibName: nil, bundle: nil) }
18
+ private var contextToggleButton: NSButton!
19
+ private var contextEnabled: Bool?
20
+ private var contextBusy = false
21
+ private var contextGeneration = 0
22
+ init(processClient: ProcessClient, operations: OperationCoordinator, notifications: NotificationCoordinator) {
23
+ self.processClient = processClient
24
+ self.operations = operations
25
+ self.notifications = notifications
26
+ super.init(nibName: nil, bundle: nil)
27
+ }
16
28
  required init?(coder: NSCoder) { nil }
17
29
 
18
30
  override func loadView() {
19
31
  followCodexLifecycle.target = self; followCodexLifecycle.action = #selector(save)
20
32
  followCodexLifecycle.setAccessibilityLabel("Show SKS Menu only while Codex is running")
21
33
  notificationButton = NativeView.button("Enable Notifications", target: self, action: #selector(enableNotifications))
34
+ contextToggleButton = NativeView.button("Enable 1M Context", target: self, action: #selector(toggleContext1m))
35
+ contextToggleButton.isEnabled = false
22
36
  let lifecycleCard = NativeView.card(
23
37
  title: "Codex lifecycle",
24
38
  subtitle: "On keeps a lightweight observer running, hides the icon when Codex is closed, and shows it automatically when Codex opens.",
25
39
  views: [followCodexLifecycle]
26
40
  )
41
+ let contextCard = NativeView.card(
42
+ title: "Codex 1M Context",
43
+ subtitle: "Opt Codex into the documented 1,000,000-token context window for GPT-5.6 Sol (model_context_window = 1000000, model_auto_compact_token_limit = 900000 in ~/.codex/config.toml). Requests beyond 272K input tokens bill the entire request at the long-context rate, only new sessions pick up the change, and Codex restarts automatically when it is running. Off restores the previous value.",
44
+ views: [NativeView.row([contextToggleButton]), contextStatus]
45
+ )
27
46
  let notificationsCard = NativeView.card(
28
47
  title: "Notifications",
29
48
  subtitle: "Operation results always stay available in Control Center, even when notifications are denied.",
@@ -31,11 +50,12 @@ final class SettingsViewController: NSViewController, ControlCenterPage {
31
50
  )
32
51
  view = NativeView.page([
33
52
  ControlKit.header("Settings", "These options stay on this Mac. Notification permission and Codex lifecycle behavior never leave the machine."),
34
- lifecycleCard, notificationsCard
53
+ lifecycleCard, contextCard, notificationsCard
35
54
  ])
36
55
  }
37
56
 
38
57
  func refreshOnAppear() {
58
+ refreshContext1m()
39
59
  let configResult = readConfig()
40
60
  switch configResult {
41
61
  case .loaded(let config):
@@ -67,6 +87,101 @@ final class SettingsViewController: NSViewController, ControlCenterPage {
67
87
  }
68
88
  }
69
89
 
90
+ private func refreshContext1m(preserveStatusText: Bool = false) {
91
+ contextGeneration += 1
92
+ let requestGeneration = contextGeneration
93
+ processClient.run(["codex-app", "context-1m", "status", "--json"], timeout: NativeView.statusTimeout) { [weak self] result in
94
+ guard let self = self, self.contextGeneration == requestGeneration, !self.contextBusy else { return }
95
+ guard let json = self.json(result.output),
96
+ json["schema"] as? String == "sks.codex-context-1m.v1",
97
+ json["ok"] as? Bool == true,
98
+ let enabled = json["enabled"] as? Bool else {
99
+ self.contextEnabled = nil
100
+ self.contextToggleButton.isEnabled = false
101
+ if !preserveStatusText {
102
+ self.contextStatus.stringValue = "Codex 1M context state unavailable · update SKS, then reopen Settings."
103
+ self.contextStatus.textColor = .systemOrange
104
+ }
105
+ return
106
+ }
107
+ self.contextEnabled = enabled
108
+ self.contextToggleButton.isEnabled = true
109
+ self.contextToggleButton.title = enabled ? "Disable 1M Context" : "Enable 1M Context"
110
+ guard !preserveStatusText else { return }
111
+ let model = json["model"] as? String
112
+ var text = enabled
113
+ ? "Enabled · window 1,000,000 · auto-compact 900,000 · applies to new sessions only."
114
+ : "Disabled · Codex uses its tuned default context window."
115
+ var tone: NSColor = enabled ? .systemGreen : .secondaryLabelColor
116
+ if enabled, let model = model, model != "gpt-5.6-sol" {
117
+ text += " Active model is \(model); the 1M window is documented for gpt-5.6-sol."
118
+ tone = .systemOrange
119
+ }
120
+ self.contextStatus.stringValue = text
121
+ self.contextStatus.textColor = tone
122
+ }
123
+ }
124
+
125
+ @objc private func toggleContext1m() {
126
+ guard !contextBusy, let enabled = contextEnabled else { return }
127
+ let verb = enabled ? "off" : "on"
128
+ guard let snapshot = operations.begin(
129
+ kind: "codex-context-1m",
130
+ mutationGroup: "codex-config",
131
+ summary: enabled ? "Disable Codex 1M context" : "Enable Codex 1M context"
132
+ ) else {
133
+ contextStatus.stringValue = "Another guarded mutation is running. Try again after it completes."
134
+ contextStatus.textColor = .systemOrange
135
+ return
136
+ }
137
+ contextBusy = true
138
+ contextToggleButton.isEnabled = false
139
+ contextStatus.stringValue = enabled ? "Disabling 1M context…" : "Enabling 1M context and restarting Codex if it is running…"
140
+ contextStatus.textColor = .secondaryLabelColor
141
+ _ = operations.update(snapshot, state: .running, stage: "applying", progress: nil, summary: contextStatus.stringValue)
142
+ processClient.run(["codex-app", "context-1m", verb, "--json"], timeout: NativeView.mutationTimeout) { [weak self] result in
143
+ guard let self = self else { return }
144
+ self.contextBusy = false
145
+ self.contextToggleButton.isEnabled = true
146
+ let json = self.json(result.output)
147
+ let ok = result.code == 0
148
+ && json?["schema"] as? String == "sks.codex-context-1m.v1"
149
+ && json?["ok"] as? Bool == true
150
+ let summary: String
151
+ if ok {
152
+ let restart = json?["restart"] as? [String: Any]
153
+ let applied = verb == "on" ? "1M context enabled" : "1M context disabled"
154
+ if restart?["status"] as? String == "restarted" {
155
+ summary = "\(applied) · Codex restarted — start a new session to apply it."
156
+ } else if restart?["reason"] as? String == "codex_not_running" {
157
+ summary = "\(applied) · Codex is not running — the change applies on its next launch."
158
+ } else if restart?["reason"] as? String == "config_unchanged" {
159
+ summary = "\(applied) · configuration already matched; nothing restarted."
160
+ } else {
161
+ summary = "\(applied) · restart Codex manually, then start a new session."
162
+ }
163
+ } else {
164
+ let blocker = (json?["blockers"] as? [String])?.first
165
+ summary = blocker.map { "1M context change failed · \($0)" } ?? "1M context change failed · unexpected CLI response."
166
+ }
167
+ _ = self.operations.update(snapshot, state: ok ? .succeeded : .failed, stage: "complete", progress: 1, summary: summary)
168
+ self.contextStatus.stringValue = summary
169
+ self.contextStatus.textColor = ok ? .systemGreen : .systemRed
170
+ self.refreshContext1m(preserveStatusText: true)
171
+ }
172
+ }
173
+
174
+ private func json(_ text: String) -> [String: Any]? {
175
+ guard let data = text.data(using: .utf8) else { return nil }
176
+ if let object = try? JSONSerialization.jsonObject(with: data) as? [String: Any] { return object }
177
+ // Child processes may print banner lines before JSON; prefer the last
178
+ // top-level object payload, matching the Overview parser.
179
+ guard let start = text.range(of: "{", options: [.backwards])?.lowerBound else { return nil }
180
+ let slice = String(text[start...])
181
+ guard let sliced = slice.data(using: .utf8) else { return nil }
182
+ return try? JSONSerialization.jsonObject(with: sliced) as? [String: Any]
183
+ }
184
+
70
185
  @objc private func enableNotifications() {
71
186
  if notifications.authorizationDenied {
72
187
  guard openSystemSettings() else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sneakoscope",
3
3
  "displayName": "ㅅㅋㅅ",
4
- "version": "9.0.6",
4
+ "version": "9.1.0",
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",