sneakoscope 0.9.11 → 0.9.13

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.
Files changed (62) hide show
  1. package/README.md +28 -2
  2. package/crates/sks-core/Cargo.lock +7 -0
  3. package/crates/sks-core/Cargo.toml +10 -0
  4. package/crates/sks-core/src/main.rs +202 -0
  5. package/package.json +15 -3
  6. package/src/cli/args.mjs +49 -0
  7. package/src/cli/command-registry.mjs +128 -0
  8. package/src/cli/feature-commands.mjs +112 -6
  9. package/src/cli/install-helpers.mjs +14 -7
  10. package/src/cli/legacy-main.mjs +4147 -0
  11. package/src/cli/main.mjs +7 -4138
  12. package/src/cli/output.mjs +9 -0
  13. package/src/cli/router.mjs +30 -0
  14. package/src/commands/all-features.mjs +6 -0
  15. package/src/commands/codex-app.mjs +30 -0
  16. package/src/commands/codex-lb.mjs +47 -0
  17. package/src/commands/db.mjs +6 -0
  18. package/src/commands/doctor.mjs +46 -0
  19. package/src/commands/features.mjs +6 -0
  20. package/src/commands/help.mjs +77 -0
  21. package/src/commands/hooks.mjs +6 -0
  22. package/src/commands/perf.mjs +91 -0
  23. package/src/commands/proof.mjs +103 -0
  24. package/src/commands/root.mjs +24 -0
  25. package/src/commands/version.mjs +5 -0
  26. package/src/commands/wiki.mjs +95 -0
  27. package/src/core/codex-lb-circuit.mjs +130 -0
  28. package/src/core/db-safety.mjs +18 -3
  29. package/src/core/feature-fixtures.mjs +103 -0
  30. package/src/core/feature-registry.mjs +117 -11
  31. package/src/core/fsx.mjs +1 -1
  32. package/src/core/hooks-runtime.mjs +17 -6
  33. package/src/core/language-preference.mjs +106 -0
  34. package/src/core/pipeline.mjs +24 -0
  35. package/src/core/proof/claim-ledger.mjs +9 -0
  36. package/src/core/proof/command-ledger.mjs +17 -0
  37. package/src/core/proof/evidence-collector.mjs +33 -0
  38. package/src/core/proof/file-change-ledger.mjs +6 -0
  39. package/src/core/proof/proof-reader.mjs +30 -0
  40. package/src/core/proof/proof-redaction.test-helper.mjs +9 -0
  41. package/src/core/proof/proof-schema.mjs +42 -0
  42. package/src/core/proof/proof-writer.mjs +81 -0
  43. package/src/core/proof/route-adapter.mjs +74 -0
  44. package/src/core/proof/route-proof-gate.mjs +33 -0
  45. package/src/core/proof/route-proof-policy.mjs +96 -0
  46. package/src/core/proof/selftest-proof-fixtures.mjs +54 -0
  47. package/src/core/proof/validation.mjs +20 -0
  48. package/src/core/routes.mjs +4 -3
  49. package/src/core/rust-accelerator.mjs +55 -3
  50. package/src/core/secret-redaction.mjs +69 -0
  51. package/src/core/version-manager.mjs +11 -7
  52. package/src/core/version.mjs +1 -0
  53. package/src/core/wiki-image/bbox.mjs +10 -0
  54. package/src/core/wiki-image/callout-parser.mjs +16 -0
  55. package/src/core/wiki-image/computer-use-ledger.mjs +38 -0
  56. package/src/core/wiki-image/image-hash.mjs +42 -0
  57. package/src/core/wiki-image/image-relation.mjs +2 -0
  58. package/src/core/wiki-image/image-voxel-ledger.mjs +147 -0
  59. package/src/core/wiki-image/image-voxel-schema.mjs +16 -0
  60. package/src/core/wiki-image/proof-linker.mjs +12 -0
  61. package/src/core/wiki-image/validation.mjs +53 -0
  62. package/src/core/wiki-image/visual-anchor.mjs +42 -0
@@ -10,6 +10,7 @@ import { initProject, installSkills } from '../core/init.mjs';
10
10
  import { context7ConfigToml, DOLLAR_SKILL_NAMES, GETDESIGN_REFERENCE, hasContext7ConfigText, RECOMMENDED_SKILLS } from '../core/routes.mjs';
11
11
  import { codexLaunchCommand, platformTmuxInstallHint, tmuxReadiness } from '../core/tmux-ui.mjs';
12
12
  import { reconcileCodexAppUpgradeProcesses } from '../core/codex-app.mjs';
13
+ import { recordCodexLbHealthEvent } from '../core/codex-lb-circuit.mjs';
13
14
 
14
15
  const DEFAULT_CODEX_APP_PLUGINS = [
15
16
  ['browser', 'openai-bundled'],
@@ -513,10 +514,10 @@ export async function checkCodexLbResponseChain(status = {}, opts = {}) {
513
514
  const env = opts.env || process.env;
514
515
  if (!codexLbChainCheckEnabled(env) && !opts.force) return { ok: true, status: 'skipped', skipped: true, reason: 'SKS_CODEX_LB_CHAIN_CHECK=0' };
515
516
  const endpoint = codexLbResponsesEndpoint(opts.baseUrl || status.base_url);
516
- if (!endpoint) return { ok: false, status: 'missing_base_url', chain_unhealthy: true };
517
+ if (!endpoint) return recordCodexLbChainHealth({ ok: false, status: 'missing_base_url', chain_unhealthy: true }, opts);
517
518
  const home = opts.home || env.HOME || os.homedir();
518
519
  const apiKey = opts.apiKey || parseCodexLbEnvKey(await readText(opts.envPath || status.env_path || codexLbEnvPath(home), ''));
519
- if (!apiKey) return { ok: false, status: 'missing_env_key', chain_unhealthy: true };
520
+ if (!apiKey) return recordCodexLbChainHealth({ ok: false, status: 'missing_env_key', chain_unhealthy: true }, opts);
520
521
  const cached = await readCodexLbChainCache({ endpoint, home, opts, env });
521
522
  if (cached) return cached;
522
523
  const fetchImpl = opts.fetch || globalThis.fetch;
@@ -535,19 +536,19 @@ export async function checkCodexLbResponseChain(status = {}, opts = {}) {
535
536
  };
536
537
  const first = await fetchCodexLbResponse(fetchImpl, endpoint, apiKey, baseBody, timeoutMs);
537
538
  if (!first.ok || !first.response_id) {
538
- return writeCodexLbChainCache({
539
+ return recordCodexLbChainHealth(await writeCodexLbChainCache({
539
540
  ok: false,
540
541
  status: first.ok ? 'missing_response_id' : 'first_request_failed',
541
542
  chain_unhealthy: true,
542
543
  endpoint,
543
544
  http_status: first.status,
544
545
  error: redactSecretText(first.error_payload?.error?.message || first.error_payload?.response?.error?.message || first.text || 'codex-lb first Responses request failed', [apiKey])
545
- }, { endpoint, home, opts, env });
546
+ }, { endpoint, home, opts, env }), opts);
546
547
  }
547
548
  const second = await fetchCodexLbResponse(fetchImpl, endpoint, apiKey, { ...baseBody, previous_response_id: first.response_id }, timeoutMs);
548
- if (second.ok) return writeCodexLbChainCache({ ok: true, status: 'chain_ok', endpoint, response_id: first.response_id, chained_response_id: second.response_id || null, http_status: second.status }, { endpoint, home, opts, env });
549
+ if (second.ok) return recordCodexLbChainHealth(await writeCodexLbChainCache({ ok: true, status: 'chain_ok', endpoint, response_id: first.response_id, chained_response_id: second.response_id || null, http_status: second.status }, { endpoint, home, opts, env }), opts);
549
550
  const previousMissing = isPreviousResponseNotFound(second.error_payload || second.json || second.text);
550
- return writeCodexLbChainCache({
551
+ return recordCodexLbChainHealth(await writeCodexLbChainCache({
551
552
  ok: false,
552
553
  status: previousMissing ? 'previous_response_not_found' : 'second_request_failed',
553
554
  chain_unhealthy: true,
@@ -555,7 +556,13 @@ export async function checkCodexLbResponseChain(status = {}, opts = {}) {
555
556
  response_id: first.response_id,
556
557
  http_status: second.status,
557
558
  error: redactSecretText(second.error_payload?.error?.message || second.error_payload?.response?.error?.message || second.text || 'codex-lb chained Responses request failed', [apiKey])
558
- }, { endpoint, home, opts, env });
559
+ }, { endpoint, home, opts, env }), opts);
560
+ }
561
+
562
+ async function recordCodexLbChainHealth(result, opts = {}) {
563
+ if (!result || result.skipped || opts.recordCircuit === false) return result;
564
+ await recordCodexLbHealthEvent(packageRoot(), result).catch(() => null);
565
+ return result;
559
566
  }
560
567
 
561
568
  function hasTopLevelCodexLbSelected(text = '') {