sneakoscope 10.7.2 → 10.7.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 CHANGED
@@ -17,7 +17,7 @@
17
17
  Sneakoscope Codex (`sks`) is an open-source local tool for the Codex CLI and Codex desktop app. It adds a macOS control center, bounded agent workflows, repository context, and evidence checks for SKS releases.
18
18
  <!-- END SKS SEARCH VISIBILITY MARKETING -->
19
19
 
20
- Current package: **SKS 10.7.2**, prepared for npm publication.
20
+ Current package: **SKS 10.7.3**, prepared for npm publication.
21
21
  [Latest release notes](https://github.com/mandarange/Sneakoscope-Codex/releases/latest)
22
22
  · [npm package](https://www.npmjs.com/package/sneakoscope)
23
23
  · [Changelog](CHANGELOG.md). Install the latest stable release from npm.
@@ -259,7 +259,7 @@ dependencies = [
259
259
 
260
260
  [[package]]
261
261
  name = "sks-core"
262
- version = "10.7.2"
262
+ version = "10.7.3"
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.7.2"
3
+ version = "10.7.3"
4
4
  edition = "2021"
5
5
 
6
6
  [dependencies]
@@ -36,13 +36,13 @@ export async function run(_command, args = []) {
36
36
  process.exitCode = 1;
37
37
  return;
38
38
  }
39
- console.log(`Codex 1M Context: ${result.enabled ? 'enabled' : 'disabled'}`);
39
+ console.log(`Codex 1M Context: ${result.enabled === null ? 'unavailable' : result.enabled ? 'enabled' : 'disabled'}`);
40
40
  console.log(`Config: ${result.config_path}`);
41
41
  const window = result.model_window;
42
- console.log(`Model: ${result.model || 'not set'}${window.effective_window ? ` · window ${window.effective_window} (default ${window.default_window ?? 'unknown'}, max ${window.max_window ?? 'uncapped'})` : ' · window unknown'}`);
42
+ console.log(`Model: ${result.enabled === null ? 'unavailable' : result.model || 'not set'}${window.effective_window ? ` · window ${window.effective_window} (default ${window.default_window ?? 'unknown'}, max ${window.max_window ?? 'uncapped'})` : ' · window unknown'}`);
43
43
  if (result.larger_window_models.length)
44
44
  console.log(`Models with a larger window: ${result.larger_window_models.join(', ')}`);
45
- for (const [key, target] of Object.entries(result.target)) {
45
+ for (const [key, target] of result.keys ? Object.entries(result.target) : []) {
46
46
  const state = result.keys[key];
47
47
  const detail = state?.present ? `${state.value ?? 'unparsed'}${state.managed ? ' (SKS-managed)' : ''}` : 'not set';
48
48
  console.log(`${key}: ${detail} · target ${target}`);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schema": "sks.skills-manifest.v1",
3
- "package_version": "10.7.2",
3
+ "package_version": "10.7.3",
4
4
  "skills": [
5
5
  {
6
6
  "canonical_name": "sks",
@@ -1,5 +1,5 @@
1
1
  import path from 'node:path';
2
- import { exists, readText } from '../fsx.js';
2
+ import { readText } from '../fsx.js';
3
3
  import { escapeRegExp } from '../text/regex.js';
4
4
  import { safeWriteCodexConfigToml } from '../codex-runtime/codex-desktop-config-policy.js';
5
5
  import { codexHomePath, codexUserConfigPath, readTopLevelTomlString } from './codex-model-catalog.js';
@@ -177,15 +177,28 @@ export async function codexContext1mCommand(args = [], opts = {}) {
177
177
  const action = normalizeCodexContext1mAction(args[0]);
178
178
  const noRestart = args.includes('--no-restart');
179
179
  const configPath = codexUserConfigPath({ env, ...(opts.home ? { home: opts.home } : {}) });
180
- const before = String(await readText(configPath, ''));
181
- const fileExists = await exists(configPath);
182
180
  const blockers = [];
183
181
  const warnings = [];
182
+ let before = '';
183
+ let fileExists = true;
184
+ let configReadable = true;
185
+ try {
186
+ before = await readText(configPath);
187
+ }
188
+ catch (error) {
189
+ if (error?.code === 'ENOENT') {
190
+ fileExists = false;
191
+ }
192
+ else {
193
+ configReadable = false;
194
+ blockers.push('codex_context_config_unreadable');
195
+ }
196
+ }
184
197
  let write = null;
185
198
  let changed = false;
186
199
  let afterText = before;
187
200
  let mutation = null;
188
- if (action === 'on' || action === 'off') {
201
+ if (configReadable && (action === 'on' || action === 'off')) {
189
202
  mutation = action === 'on' ? enableCodexContext1m(before) : disableCodexContext1m(before);
190
203
  blockers.push(...mutation.blockers);
191
204
  warnings.push(...mutation.warnings);
@@ -205,9 +218,11 @@ export async function codexContext1mCommand(args = [], opts = {}) {
205
218
  }
206
219
  const inspection = inspectCodexContext1m(afterText);
207
220
  warnings.push(...inspection.warnings);
208
- const windowRows = await readCodexModelWindows({ env, ...(opts.home ? { home: opts.home } : {}) });
221
+ const windowRows = configReadable
222
+ ? await readCodexModelWindows({ env, ...(opts.home ? { home: opts.home } : {}) })
223
+ : [];
209
224
  const modelWindow = codexContextModelWindow(windowRows, inspection.model);
210
- if (action === 'on' || inspection.enabled) {
225
+ if (configReadable && (action === 'on' || inspection.enabled)) {
211
226
  if (!inspection.model)
212
227
  warnings.push('codex_context_model_line_missing');
213
228
  else if (modelWindow.source === 'unknown')
@@ -235,7 +250,7 @@ export async function codexContext1mCommand(args = [], opts = {}) {
235
250
  schema: CODEX_CONTEXT_1M_SCHEMA,
236
251
  ok: blockers.length === 0,
237
252
  action,
238
- enabled: inspection.enabled,
253
+ enabled: configReadable ? inspection.enabled : null,
239
254
  config_path: configPath,
240
255
  model: inspection.model,
241
256
  model_window: modelWindow,
@@ -243,7 +258,7 @@ export async function codexContext1mCommand(args = [], opts = {}) {
243
258
  .filter((row) => row.listed && row.max_window !== null && row.default_window !== null && row.max_window > row.default_window)
244
259
  .map((row) => row.slug),
245
260
  target: { ...CODEX_CONTEXT_1M_TARGETS },
246
- keys: inspection.keys,
261
+ keys: configReadable ? inspection.keys : null,
247
262
  previous: mutation && action === 'on' ? mutation.previous : null,
248
263
  restored: mutation && action === 'off' ? mutation.restored : null,
249
264
  changed,
@@ -83,15 +83,16 @@ class ModelCallSemaphoreImpl {
83
83
  }
84
84
  this.queued += 1;
85
85
  await new Promise((resolve) => this.waiters.push(resolve));
86
- this.queued = Math.max(0, this.queued - 1);
87
- this.active += 1;
88
- this.maxObserved = Math.max(this.maxObserved, this.active);
89
86
  }
90
87
  release() {
91
- this.active = Math.max(0, this.active - 1);
92
88
  const next = this.waiters.shift();
93
- if (next)
89
+ if (next) {
90
+ this.queued -= 1;
94
91
  next();
92
+ }
93
+ else {
94
+ this.active = Math.max(0, this.active - 1);
95
+ }
95
96
  }
96
97
  }
97
98
  function envInt(name, fallback) {
@@ -67,23 +67,47 @@ function adviseSseEvents(events, onAdvised) {
67
67
  return Buffer.from(parts.join(''));
68
68
  }
69
69
  export function modelCapacityAdvisingSse(onAdvised) {
70
+ const maxEventBytes = 1024 * 1024;
70
71
  let carry = Buffer.alloc(0);
71
- return new Transform({
72
+ let passthrough = false;
73
+ let endingBytes = 0;
74
+ const stream = new Transform({
72
75
  transform(chunk, _encoding, done) {
73
- const data = carry.length ? Buffer.concat([carry, chunk]) : chunk;
74
- const lf = data.lastIndexOf('\n\n');
75
- const crlf = data.lastIndexOf('\r\n\r\n');
76
- const end = Math.max(lf === -1 ? -1 : lf + 2, crlf === -1 ? -1 : crlf + 4);
77
- if (end === -1) {
78
- carry = data;
79
- done();
80
- return;
76
+ let advised = false;
77
+ let start = 0;
78
+ for (let index = 0; index < chunk.length; index += 1) {
79
+ endingBytes = ((endingBytes << 8) | chunk[index]) >>> 0;
80
+ if ((endingBytes & 0xffff) !== 0x0a0a && endingBytes !== 0x0d0a0d0a)
81
+ continue;
82
+ append(chunk.subarray(start, index + 1));
83
+ if (!passthrough)
84
+ this.push(adviseSseEvents(carry, () => { advised = true; }));
85
+ carry = Buffer.alloc(0);
86
+ passthrough = false;
87
+ endingBytes = 0;
88
+ start = index + 1;
81
89
  }
82
- carry = data.subarray(end);
83
- done(null, adviseSseEvents(data.subarray(0, end), onAdvised));
90
+ if (start < chunk.length)
91
+ append(chunk.subarray(start));
92
+ if (advised)
93
+ onAdvised();
94
+ done();
84
95
  },
85
96
  flush(done) {
86
97
  done(null, carry.length ? adviseSseEvents(carry, onAdvised) : null);
87
98
  },
88
99
  });
100
+ function append(part) {
101
+ if (passthrough || carry.length + part.length > maxEventBytes) {
102
+ if (carry.length)
103
+ stream.push(carry);
104
+ carry = Buffer.alloc(0);
105
+ passthrough = true;
106
+ stream.push(part);
107
+ }
108
+ else {
109
+ carry = carry.length ? Buffer.concat([carry, part]) : Buffer.from(part);
110
+ }
111
+ }
112
+ return stream;
89
113
  }
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = '10.7.2';
1
+ export const PACKAGE_VERSION = '10.7.3';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sneakoscope",
3
3
  "displayName": "ㅅㅋㅅ",
4
- "version": "10.7.2",
4
+ "version": "10.7.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",