sneakoscope 4.2.0 → 4.3.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 +35 -8
- package/crates/sks-core/Cargo.lock +1 -1
- package/crates/sks-core/Cargo.toml +1 -1
- package/crates/sks-core/src/main.rs +1 -1
- package/dist/bin/sks.js +1 -1
- package/dist/cli/command-registry.js +3 -1
- package/dist/cli/ultra-search-command.js +163 -0
- package/dist/cli/xai-command.js +28 -168
- package/dist/core/agents/agent-codex-cockpit.js +3 -3
- package/dist/core/agents/agent-runner-ollama.js +2 -0
- package/dist/core/agents/agent-wrongness.js +1 -1
- package/dist/core/agents/native-worker-backend-router.js +3 -0
- package/dist/core/bench.js +115 -0
- package/dist/core/code-structure.js +399 -11
- package/dist/core/codex-control/codex-app-server-v2-client.js +86 -2
- package/dist/core/codex-control/codex-fake-sdk-adapter.js +67 -9
- package/dist/core/codex-control/codex-reliability-shield.js +26 -5
- package/dist/core/codex-control/codex-task-runner.js +7 -1
- package/dist/core/codex-control/gpt-final-arbiter.js +4 -1
- package/dist/core/codex-control/gpt-final-review-schema.js +58 -0
- package/dist/core/codex-control/model-call-concurrency.js +1 -1
- package/dist/core/codex-native/core-skill-manifest.js +23 -0
- package/dist/core/commands/bench-command.js +11 -2
- package/dist/core/commands/code-structure-command.js +34 -2
- package/dist/core/commands/qa-loop-command.js +23 -7
- package/dist/core/commands/run-command.js +92 -2
- package/dist/core/commands/seo-command.js +130 -0
- package/dist/core/feature-fixtures.js +6 -0
- package/dist/core/feature-registry.js +3 -1
- package/dist/core/fsx.js +1 -1
- package/dist/core/hooks-runtime.js +9 -1
- package/dist/core/init.js +8 -6
- package/dist/core/lean-engineering-policy.js +159 -0
- package/dist/core/pipeline-internals/runtime-core.js +15 -5
- package/dist/core/proof/auto-finalize.js +3 -2
- package/dist/core/proof/proof-schema.js +2 -1
- package/dist/core/proof/proof-writer.js +1 -0
- package/dist/core/proof/route-adapter.js +4 -2
- package/dist/core/proof/route-finalizer.js +35 -3
- package/dist/core/qa-loop/qa-app-server-driver.js +134 -0
- package/dist/core/qa-loop/qa-contract-v2.js +231 -0
- package/dist/core/qa-loop/qa-gate-v2.js +132 -0
- package/dist/core/qa-loop/qa-runtime-artifacts.js +53 -0
- package/dist/core/qa-loop/qa-surface-router.js +114 -0
- package/dist/core/qa-loop/qa-types.js +18 -0
- package/dist/core/qa-loop.js +83 -26
- package/dist/core/release/gate-manifest.js +1 -0
- package/dist/core/release/sla-scheduler.js +1 -1
- package/dist/core/release-parallel-full-coverage.js +1 -1
- package/dist/core/routes.js +96 -14
- package/dist/core/search-visibility/adapter-registry.js +26 -0
- package/dist/core/search-visibility/adapters/next-app.js +6 -0
- package/dist/core/search-visibility/adapters/next-pages.js +6 -0
- package/dist/core/search-visibility/adapters/static-site.js +6 -0
- package/dist/core/search-visibility/analyzers.js +377 -0
- package/dist/core/search-visibility/artifacts.js +183 -0
- package/dist/core/search-visibility/discovery.js +347 -0
- package/dist/core/search-visibility/index.js +199 -0
- package/dist/core/search-visibility/mission.js +67 -0
- package/dist/core/search-visibility/mutation.js +314 -0
- package/dist/core/search-visibility/types.js +2 -0
- package/dist/core/search-visibility/verifier.js +60 -0
- package/dist/core/source-intelligence/source-intelligence-policy.js +45 -26
- package/dist/core/source-intelligence/source-intelligence-proof.js +10 -16
- package/dist/core/source-intelligence/source-intelligence-runner.js +56 -42
- package/dist/core/triwiki/triwiki-affected-graph.js +3 -2
- package/dist/core/trust-kernel/trust-report.js +3 -5
- package/dist/core/ultra-search/index.js +3 -0
- package/dist/core/ultra-search/runtime.js +502 -0
- package/dist/core/ultra-search/types.js +3 -0
- package/dist/core/version.js +1 -1
- package/dist/scripts/agent-visual-consistency-check.js +1 -1
- package/dist/scripts/check-architecture.js +40 -7
- package/dist/scripts/check-command-module-budget.js +43 -5
- package/dist/scripts/check-pipeline-budget.js +17 -30
- package/dist/scripts/check-publish-tag.js +33 -6
- package/dist/scripts/check-route-modularity.js +25 -33
- package/dist/scripts/check-runtime-schemas.js +22 -0
- package/dist/scripts/codex-control-all-pipelines-check.js +1 -0
- package/dist/scripts/codex-control-model-capacity-fallback-check.js +53 -0
- package/dist/scripts/config-managed-merge-callsite-coverage-check.js +7 -1
- package/dist/scripts/core-skill-immutable-sync-check.js +3 -2
- package/dist/scripts/core-skill-integrity-blackbox.js +3 -2
- package/dist/scripts/core-skill-manifest-check.js +7 -2
- package/dist/scripts/geo-claim-evidence-check.js +18 -0
- package/dist/scripts/geo-cli-blackbox-check.js +18 -0
- package/dist/scripts/geo-crawler-policy-check.js +16 -0
- package/dist/scripts/geo-llms-txt-optional-check.js +19 -0
- package/dist/scripts/gpt-final-arbiter-check.js +4 -1
- package/dist/scripts/loop-directive-check-lib.js +78 -1
- package/dist/scripts/qa-loop-app-server-driver-check.js +74 -0
- package/dist/scripts/qa-loop-surface-router-check.js +49 -0
- package/dist/scripts/release-check-dynamic-execute.js +1 -1
- package/dist/scripts/release-metadata-1-19-check.js +2 -2
- package/dist/scripts/release-parallel-check.js +17 -2
- package/dist/scripts/release-parallel-full-coverage-check.js +1 -1
- package/dist/scripts/release-readiness-report.js +6 -6
- package/dist/scripts/release-registry-check.js +33 -14
- package/dist/scripts/runtime-ts-rust-boundary-check.js +1 -1
- package/dist/scripts/search-visibility-gate-lib.js +124 -0
- package/dist/scripts/seo-audit-fixture-check.js +16 -0
- package/dist/scripts/seo-canonical-locale-check.js +19 -0
- package/dist/scripts/seo-cli-blackbox-check.js +18 -0
- package/dist/scripts/seo-geo-feature-fixture-quality-check.js +18 -0
- package/dist/scripts/seo-geo-geo-disambiguation-check.js +12 -0
- package/dist/scripts/seo-geo-no-unsupported-ranking-claims-check.js +18 -0
- package/dist/scripts/seo-geo-route-identity-check.js +12 -0
- package/dist/scripts/seo-geo-skill-rich-content-check.js +22 -0
- package/dist/scripts/seo-mutation-rollback-check.js +23 -0
- package/dist/scripts/seo-no-mutation-by-default-check.js +17 -0
- package/dist/scripts/seo-structured-data-visible-content-check.js +19 -0
- package/dist/scripts/sks-1-18-gate-lib.js +2 -2
- package/dist/scripts/sks-3-1-5-directive-check-lib.js +10 -1
- package/dist/scripts/source-intelligence-all-modes-check.js +9 -19
- package/dist/scripts/source-intelligence-policy-check.js +6 -6
- package/dist/scripts/triwiki-affected-graph-check.js +2 -2
- package/dist/scripts/ultra-search-provider-interface-check.js +27 -0
- package/package.json +26 -5
- package/schemas/search-visibility/finding-ledger.schema.json +36 -0
- package/schemas/search-visibility/gate.schema.json +22 -0
- package/schemas/search-visibility/mutation-plan.schema.json +27 -0
- package/schemas/search-visibility/site-inventory.schema.json +21 -0
- package/schemas/search-visibility/verification-report.schema.json +23 -0
- package/dist/core/mcp/xai-mcp-detector.js +0 -157
- package/dist/core/mcp/xai-search-adapter.js +0 -100
- package/dist/scripts/xai-mcp-capability-check.js +0 -14
package/README.md
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
`npm i -g sneakoscope` → `sks --mad` → watch up to **100 shadow-clone workers** code in parallel,<br/>each in a live Zellij pane, every claim backed by Completion Proof.
|
|
13
13
|
|
|
14
|
+
Current package release: **4.3.0**.
|
|
15
|
+
|
|
14
16
|
</div>
|
|
15
17
|
|
|
16
18
|
---
|
|
@@ -35,7 +37,33 @@ Set up this agent project with Sneakoscope Codex. Use [[mandarange/Sneakoscope-C
|
|
|
35
37
|
|
|
36
38
|
## 🚀 Current Release
|
|
37
39
|
|
|
38
|
-
SKS **4.
|
|
40
|
+
SKS **4.3.0** adds the proof-backed `seo-geo-optimizer` command and route on one shared search-visibility kernel, plus Lean Engineering Policy evidence in pipeline plans, worker prompts, code-structure reports, GPT final review, and Completion Proof.
|
|
41
|
+
|
|
42
|
+
- **`sks seo-geo-optimizer` / `$SEO-GEO-OPTIMIZER`.** Run read-only audit, mutation plan, explicit apply, verification, rollback, and Completion Proof for both Search Engine Optimization and Generative Engine Optimization.
|
|
43
|
+
- **Mode-specific evidence.** Use `--mode seo` for package/docs/website search visibility, including metadata, canonical, robots, sitemap, locale, structured data, and internal links. Use `--mode geo` for entity facts, claim evidence, answerability, AI crawler purpose policy, and optional `llms.txt` planning. GEO means Generative Engine Optimization, not geolocation.
|
|
44
|
+
- **Lean Engineering evidence.** `sks bench lean-policy --json` compares hermetic baseline-context and lean-policy-context fixtures, catching over-build candidates while preserving safety rejections without making live model accuracy claims.
|
|
45
|
+
- **Safety-first mutation.** `audit` and `plan` never mutate source. `apply` requires `--apply`, uses base hashes, create-only ownership, mutation journal, rollback manifest, and post-verification.
|
|
46
|
+
- **Release-gated artifacts.** SEO/GEO now have explicit runtime fixtures, schemas, feature registry mappings, release gates, route gates, and Completion Proof links.
|
|
47
|
+
|
|
48
|
+
Common commands:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
sks seo-geo-optimizer doctor --mode seo --json
|
|
52
|
+
sks seo-geo-optimizer audit --mode seo --target package --offline --json
|
|
53
|
+
sks seo-geo-optimizer plan latest --mode seo --json
|
|
54
|
+
sks seo-geo-optimizer apply latest --mode seo --apply --json
|
|
55
|
+
sks seo-geo-optimizer rollback latest --mode seo --apply --json
|
|
56
|
+
|
|
57
|
+
sks seo-geo-optimizer doctor --mode geo --json
|
|
58
|
+
sks seo-geo-optimizer audit --mode geo --target package --offline --json
|
|
59
|
+
sks seo-geo-optimizer plan latest --mode geo --json
|
|
60
|
+
sks seo-geo-optimizer apply latest --mode geo --include-llms-txt --apply --json
|
|
61
|
+
sks bench lean-policy --json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Honest boundary: SEO/GEO reports separate implemented, locally verified, production verified, and measured outcome. Sitemaps, canonical tags, structured data, crawler policy, and `llms.txt` are evidence surfaces, not guarantees of indexing, ranking, traffic, rich results, or AI answer inclusion.
|
|
65
|
+
|
|
66
|
+
What changed in 4.2.1:
|
|
39
67
|
|
|
40
68
|
What changed in 4.2.0:
|
|
41
69
|
|
|
@@ -182,13 +210,12 @@ Change-aware release checks live behind `npm run release:check`; publish-authori
|
|
|
182
210
|
|
|
183
211
|
- **Image generation under codex-lb.** `gpt-image-2` routes through the same Codex `/responses` backend the load balancer already proxies, so `$imagegen` works when you are authenticated only through codex-lb (no direct `OPENAI_API_KEY`). The official Codex App `$imagegen` surface stays primary; the codex-lb/OpenAI API path is the fallback. Opt out with `SKS_IMAGEGEN_ALLOW_CODEX_LB_API_FALLBACK=0`.
|
|
184
212
|
|
|
185
|
-
- **
|
|
213
|
+
- **UltraSearch source intelligence.** Run provider-independent source acquisition without requiring xAI/Grok credentials:
|
|
186
214
|
|
|
187
215
|
```bash
|
|
188
|
-
sks
|
|
189
|
-
sks
|
|
190
|
-
|
|
191
|
-
sks xai docs
|
|
216
|
+
sks ultra-search doctor
|
|
217
|
+
sks ultra-search run "current package release notes" --mode balanced
|
|
218
|
+
sks ultra-search x "site:x.com product launch"
|
|
192
219
|
```
|
|
193
220
|
|
|
194
221
|
- **CLI-only SKS update notices.** Codex App hooks no longer stop normal work to ask for an SKS update. CLI launch surfaces such as `sks --mad` print a non-blocking latest-version notice, `sks update-check` / `sks update check` show the explicit status, and `sks doctor --fix` runs the guarded global SKS update path before repair.
|
|
@@ -274,7 +301,7 @@ The cleanup contract is policy-backed in `.sneakoscope/policy.json`, but the def
|
|
|
274
301
|
- Codex App Hooks/PAT: [docs/hooks-pat.md](docs/hooks-pat.md)
|
|
275
302
|
- codex-lb: [docs/codex-lb.md](docs/codex-lb.md)
|
|
276
303
|
- Source Intelligence Layer: [docs/source-intelligence-layer.md](docs/source-intelligence-layer.md)
|
|
277
|
-
-
|
|
304
|
+
- UltraSearch / Context7 / Codex Web policy: [docs/ultra-search-source-intelligence-policy.md](docs/ultra-search-source-intelligence-policy.md)
|
|
278
305
|
- Main no-Scout / worker Scout policy: [docs/main-no-scout-worker-scout-policy.md](docs/main-no-scout-worker-scout-policy.md)
|
|
279
306
|
- Real Codex dynamic smoke: [docs/real-codex-dynamic-smoke.md](docs/real-codex-dynamic-smoke.md)
|
|
280
307
|
- Appshots pipeline: [docs/appshots-pipeline.md](docs/appshots-pipeline.md)
|
|
@@ -866,7 +893,7 @@ npm run release:check
|
|
|
866
893
|
npm run publish:dry
|
|
867
894
|
```
|
|
868
895
|
|
|
869
|
-
`release:check` runs the change-aware affected release gate for ordinary local checks. Publish readiness uses `release:check:full`, which runs the full release DAG and writes a source digest stamp under `.sneakoscope/reports/` so publish commands can verify the same source/dist state. The DAG preserves the 1.18 baseline gates and adds Codex 0.136 compatibility, inherited Codex 0.135/0.134 runner truth, patch swarm runtime truth, transaction journaling, serial conflict rebase, strict strategy-to-patch proof, rollback command proof, Native CLI Session Swarm 5/10/20-process proof, Real Worker Backend Router proof, Codex child overlap proof, model-authored patch-envelope separation, Zellij layout/pane/screen/socket-dir proof, no-subagent-scaling proof, Fast mode default/worker/Codex/MAD propagation proof, Appshots attachment provenance, MCP runtime overlap evidence, task graph expansion, schema-bound follow-up work, actual Agent/Team/Research/QA route blackboxes, scheduler proof hardening, Source Intelligence propagation, Goal mode propagation checks, slot telemetry, update notice, MAD-DB, and Naruto SSOT gates. Broader live gates remain explicit scripts such as `release:real-check`; real Codex patch smoke, real Codex parallel worker proof, and real Zellij proof are optional unless their `SKS_REQUIRE_REAL_*` or `SKS_REQUIRE_ZELLIJ=1` environment variables are set. Generate the human-readable registry with `sks features inventory --write-docs`. Plain `npm publish` uses the `latest` dist-tag. `npm run publish:dry` runs `release:check:full`, verifies the fresh stamp, and then performs provenance/registry and npm dry-run checks. npm's `prepublishOnly` uses `prepublish-release-check-or-fast` to accept that current stamp before the real publish; if the stamp is missing or stale, it runs `release:check:full` once before continuing.
|
|
896
|
+
`release:check` runs the change-aware affected release gate for ordinary local checks. Publish readiness uses `release:check:full`, which runs the full release DAG and writes a source digest stamp under `.sneakoscope/reports/` so publish commands can verify the same source/dist state. The DAG preserves the 1.18 baseline gates and adds Codex 0.136 compatibility, inherited Codex 0.135/0.134 runner truth, patch swarm runtime truth, transaction journaling, serial conflict rebase, strict strategy-to-patch proof, rollback command proof, Native CLI Session Swarm 5/10/20-process proof, Real Worker Backend Router proof, Codex child overlap proof, model-authored patch-envelope separation, Zellij layout/pane/screen/socket-dir proof, no-subagent-scaling proof, Fast mode default/worker/Codex/MAD propagation proof, Appshots attachment provenance, MCP runtime overlap evidence, task graph expansion, schema-bound follow-up work, actual Agent/Team/Research/QA route blackboxes, scheduler proof hardening, Source Intelligence propagation, Goal mode propagation checks, slot telemetry, update notice, MAD-DB, and Naruto SSOT gates. Broader live gates remain explicit scripts such as `release:real-check`; real Codex patch smoke, real Codex parallel worker proof, and real Zellij proof are optional unless their `SKS_REQUIRE_REAL_*` or `SKS_REQUIRE_ZELLIJ=1` environment variables are set. Generate the human-readable registry with `sks features inventory --write-docs`. Plain `npm publish` uses the `latest` dist-tag. `npm run publish:dry` runs `release:check:full`, verifies the fresh stamp, and then performs provenance/registry and npm dry-run checks. `npm run publish:npm` and `npm run release:publish` run the same prepublish gate and then `npm publish --ignore-scripts`, so the real publish path stays strict even when lifecycle scripts are skipped. npm's `prepublishOnly` uses `prepublish-release-check-or-fast` to accept that current stamp before the real publish; if the stamp is missing or stale, it runs `release:check:full` once before continuing.
|
|
870
897
|
|
|
871
898
|
Version bumps are manual. Run `sks versioning bump` only when preparing release metadata; SKS will not create `.git/hooks/pre-commit` or auto-bump during ordinary commits.
|
|
872
899
|
|
|
@@ -4,7 +4,7 @@ use std::io::{self, Read, Seek, SeekFrom};
|
|
|
4
4
|
fn main() {
|
|
5
5
|
let mut args = std::env::args().skip(1);
|
|
6
6
|
match args.next().as_deref() {
|
|
7
|
-
Some("--version") => println!("sks-rs 4.
|
|
7
|
+
Some("--version") => println!("sks-rs 4.3.0"),
|
|
8
8
|
Some("compact-info") => {
|
|
9
9
|
let mut input = String::new();
|
|
10
10
|
let _ = io::stdin().read_to_string(&mut input);
|
package/dist/bin/sks.js
CHANGED
|
@@ -132,7 +132,8 @@ export const COMMANDS = {
|
|
|
132
132
|
'image-ux-review': entry('labs', 'Inspect image UX artifacts', 'dist/core/commands/image-ux-review-command.js', commandArgsCommand(() => import('../core/commands/image-ux-review-command.js'), 'imageUxReviewCommand', 'dist/core/commands/image-ux-review-command.js')),
|
|
133
133
|
'computer-use': entry('beta', 'Record native Mac/non-web Computer Use visual evidence', 'dist/core/commands/computer-use-command.js', commandArgsCommand(() => import('../core/commands/computer-use-command.js'), 'computerUseCommand', 'dist/core/commands/computer-use-command.js')),
|
|
134
134
|
context7: entry('beta', 'Context7 checks and docs', 'dist/cli/context7-command.js', subcommand(() => import('./context7-command.js'), 'context7Command', 'dist/cli/context7-command.js', 'check')),
|
|
135
|
-
|
|
135
|
+
'ultra-search': entry('beta', 'Run provider-independent UltraSearch source intelligence', 'dist/cli/ultra-search-command.js', subcommand(() => import('./ultra-search-command.js'), 'ultraSearchCommand', 'dist/cli/ultra-search-command.js', 'doctor')),
|
|
136
|
+
xai: entry('beta', 'Deprecated compatibility notice for removed xAI/Grok setup', 'dist/cli/xai-command.js', subcommand(() => import('./xai-command.js'), 'xaiCommand', 'dist/cli/xai-command.js', 'check')),
|
|
136
137
|
recallpulse: entry('labs', 'RecallPulse evidence route', 'dist/commands/recallpulse.js', directCommand(() => import('../commands/recallpulse.js'), 'dist/commands/recallpulse.js')),
|
|
137
138
|
pipeline: entry('beta', 'Inspect pipeline missions', 'dist/commands/pipeline.js', directCommand(() => import('../commands/pipeline.js'), 'dist/commands/pipeline.js')),
|
|
138
139
|
guard: entry('beta', 'Check harness guard', 'dist/commands/guard.js', directCommand(() => import('../commands/guard.js'), 'dist/commands/guard.js')),
|
|
@@ -142,6 +143,7 @@ export const COMMANDS = {
|
|
|
142
143
|
aliases: entry('stable', 'Show command aliases', 'dist/core/commands/basic-cli.js', basicNoArgs('aliasesCommand')),
|
|
143
144
|
selftest: entry('stable', 'Run local mock selftest', 'dist/core/commands/basic-cli.js', basicArgs('selftestCommand')),
|
|
144
145
|
goal: entry('beta', 'Manage Goal bridge workflow', 'dist/core/commands/goal-command.js', subcommand(() => import('../core/commands/goal-command.js'), 'goalCommand', 'dist/core/commands/goal-command.js')),
|
|
146
|
+
'seo-geo-optimizer': entry('beta', 'Run unified SEO/GEO optimizer audit/plan/apply/verify on the search-visibility kernel', 'dist/core/commands/seo-command.js', argsCommand(() => import('../core/commands/seo-command.js'), 'seoGeoOptimizerCommand', 'dist/core/commands/seo-command.js')),
|
|
145
147
|
hook: entry('beta', 'Codex hook entrypoint', 'dist/commands/hook.js', directCommand(() => import('../commands/hook.js'), 'dist/commands/hook.js')),
|
|
146
148
|
profile: entry('labs', 'Inspect/set profile', 'dist/commands/profile.js', directCommand(() => import('../commands/profile.js'), 'dist/commands/profile.js')),
|
|
147
149
|
hproof: entry('beta', 'Evaluate H-Proof gate', 'dist/commands/hproof.js', directCommand(() => import('../commands/hproof.js'), 'dist/commands/hproof.js')),
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { runUltraSearch } from '../core/ultra-search/index.js';
|
|
5
|
+
export async function ultraSearchCommand(sub = 'help', args = []) {
|
|
6
|
+
const action = sub || 'help';
|
|
7
|
+
if (action === 'run')
|
|
8
|
+
return runCommand(args);
|
|
9
|
+
if (action === 'x')
|
|
10
|
+
return runCommand(['--mode', 'x_search', ...args]);
|
|
11
|
+
if (action === 'fetch')
|
|
12
|
+
return runCommand(['--mode', 'url_acquisition', ...args]);
|
|
13
|
+
if (action === 'doctor')
|
|
14
|
+
return doctorCommand(args);
|
|
15
|
+
if (action === 'status' || action === 'inspect' || action === 'sources' || action === 'claims')
|
|
16
|
+
return inspectCommand(action, args);
|
|
17
|
+
if (action === 'cache')
|
|
18
|
+
return cacheCommand(args);
|
|
19
|
+
if (action === 'bench')
|
|
20
|
+
return benchCommand(args);
|
|
21
|
+
if (action === 'migrate-xai')
|
|
22
|
+
return migrateXaiCommand(args);
|
|
23
|
+
return helpCommand();
|
|
24
|
+
}
|
|
25
|
+
async function runCommand(args) {
|
|
26
|
+
const json = args.includes('--json');
|
|
27
|
+
const mode = readOption(args, '--mode');
|
|
28
|
+
const query = positional(args).join(' ').trim();
|
|
29
|
+
if (!query)
|
|
30
|
+
throw new Error('Usage: sks ultra-search run "<query>" [--mode fast|balanced|deep|exhaustive|x_search|url_acquisition] [--json]');
|
|
31
|
+
const missionDir = await mkMissionDir();
|
|
32
|
+
const result = await runUltraSearch({
|
|
33
|
+
missionDir,
|
|
34
|
+
query,
|
|
35
|
+
...(mode ? { mode } : {})
|
|
36
|
+
});
|
|
37
|
+
if (json)
|
|
38
|
+
console.log(JSON.stringify(result, null, 2));
|
|
39
|
+
else {
|
|
40
|
+
console.log(`UltraSearch ${result.ok ? 'completed' : 'partial/blocked'}: ${result.mode}`);
|
|
41
|
+
console.log(`Mission: ${missionDir}`);
|
|
42
|
+
console.log(`Sources: ${result.sources.length}, verified: ${result.proof.verified_source_count}`);
|
|
43
|
+
if (result.blockers.length)
|
|
44
|
+
console.log(`Blockers: ${result.blockers.join(', ')}`);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
async function doctorCommand(args) {
|
|
49
|
+
const json = args.includes('--json');
|
|
50
|
+
const report = {
|
|
51
|
+
schema: 'sks.ultra-search-doctor.v1',
|
|
52
|
+
ok: true,
|
|
53
|
+
core_ready: true,
|
|
54
|
+
xai_required: false,
|
|
55
|
+
optional: {
|
|
56
|
+
context7: 'external_runtime_optional_by_intent',
|
|
57
|
+
codex_web: process.env.SKS_CODEX_WEB_SEARCH_AVAILABLE === '1' || process.env.CODEX_WEB_SEARCH_AVAILABLE === '1' ? 'available' : 'not_bound',
|
|
58
|
+
authenticated_chrome: 'operator_consented_optional',
|
|
59
|
+
official_x_api: 'credentials_optional_not_required'
|
|
60
|
+
},
|
|
61
|
+
blockers: [],
|
|
62
|
+
warnings: []
|
|
63
|
+
};
|
|
64
|
+
if (json)
|
|
65
|
+
console.log(JSON.stringify(report, null, 2));
|
|
66
|
+
else
|
|
67
|
+
console.log('UltraSearch doctor: core ready; xAI/Grok is not required.');
|
|
68
|
+
return report;
|
|
69
|
+
}
|
|
70
|
+
async function inspectCommand(action, args) {
|
|
71
|
+
const json = args.includes('--json');
|
|
72
|
+
const mission = positional(args)[0] || 'latest';
|
|
73
|
+
const target = mission === 'latest' ? await latestMissionDir() : mission;
|
|
74
|
+
const file = path.join(target, 'ultra-search', action === 'sources' ? 'source-ledger.json' : action === 'claims' ? 'claim-ledger.json' : 'ultra-search-result.json');
|
|
75
|
+
const text = await fs.readFile(file, 'utf8');
|
|
76
|
+
if (json)
|
|
77
|
+
console.log(text.trim());
|
|
78
|
+
else
|
|
79
|
+
console.log(text);
|
|
80
|
+
return JSON.parse(text);
|
|
81
|
+
}
|
|
82
|
+
async function cacheCommand(args) {
|
|
83
|
+
const sub = positional(args)[0] || 'status';
|
|
84
|
+
const report = { schema: 'sks.ultra-search-cache.v1', ok: true, action: sub, local_only: true };
|
|
85
|
+
console.log(JSON.stringify(report, null, 2));
|
|
86
|
+
return report;
|
|
87
|
+
}
|
|
88
|
+
async function benchCommand(args) {
|
|
89
|
+
const report = {
|
|
90
|
+
schema: 'sks.ultra-search-bench.v1',
|
|
91
|
+
ok: false,
|
|
92
|
+
suite: readOption(args, '--suite') || 'all',
|
|
93
|
+
status: 'real_benchmark_not_run',
|
|
94
|
+
blockers: ['real_web_or_x_parity_corpus_required']
|
|
95
|
+
};
|
|
96
|
+
console.log(JSON.stringify(report, null, 2));
|
|
97
|
+
return report;
|
|
98
|
+
}
|
|
99
|
+
async function migrateXaiCommand(args) {
|
|
100
|
+
const apply = args.includes('--apply');
|
|
101
|
+
const report = {
|
|
102
|
+
schema: apply ? 'sks.ultra-search-xai-migration-result.v1' : 'sks.ultra-search-xai-migration-plan.v1',
|
|
103
|
+
ok: true,
|
|
104
|
+
applied: false,
|
|
105
|
+
managed_candidates: [],
|
|
106
|
+
unowned_preserved: true,
|
|
107
|
+
note: 'No automatic MCP config deletion is performed without an owned managed marker and explicit --apply.'
|
|
108
|
+
};
|
|
109
|
+
console.log(JSON.stringify(report, null, 2));
|
|
110
|
+
return report;
|
|
111
|
+
}
|
|
112
|
+
function helpCommand() {
|
|
113
|
+
console.log([
|
|
114
|
+
'Usage:',
|
|
115
|
+
' sks ultra-search doctor [--json]',
|
|
116
|
+
' sks ultra-search run "<query>" [--mode fast|balanced|deep|exhaustive]',
|
|
117
|
+
' sks ultra-search x "<query>"',
|
|
118
|
+
' sks ultra-search fetch "<url>"',
|
|
119
|
+
' sks ultra-search status|inspect|sources|claims <mission|latest>',
|
|
120
|
+
' sks ultra-search cache status|prune|clear',
|
|
121
|
+
' sks ultra-search bench [--suite all|x|web|docs|blocked]',
|
|
122
|
+
' sks ultra-search migrate-xai [--apply]'
|
|
123
|
+
].join('\n'));
|
|
124
|
+
return { ok: true, status: 'help' };
|
|
125
|
+
}
|
|
126
|
+
function readOption(args, flag) {
|
|
127
|
+
const index = args.indexOf(flag);
|
|
128
|
+
const value = index >= 0 ? args[index + 1] : undefined;
|
|
129
|
+
return value || null;
|
|
130
|
+
}
|
|
131
|
+
function positional(args) {
|
|
132
|
+
const out = [];
|
|
133
|
+
for (let i = 0; i < args.length; i++) {
|
|
134
|
+
const value = args[i];
|
|
135
|
+
if (!value)
|
|
136
|
+
continue;
|
|
137
|
+
if (value.startsWith('--')) {
|
|
138
|
+
if (value !== '--json')
|
|
139
|
+
i++;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
out.push(value);
|
|
143
|
+
}
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
146
|
+
async function mkMissionDir() {
|
|
147
|
+
const dir = path.join(process.cwd(), '.sneakoscope', 'missions', `ultra-${Date.now().toString(36)}`);
|
|
148
|
+
await fs.mkdir(dir, { recursive: true });
|
|
149
|
+
return dir;
|
|
150
|
+
}
|
|
151
|
+
async function latestMissionDir() {
|
|
152
|
+
const root = path.join(process.cwd(), '.sneakoscope', 'missions');
|
|
153
|
+
const entries = await fs.readdir(root, { withFileTypes: true }).catch(() => []);
|
|
154
|
+
const dirs = entries.filter((entry) => entry.isDirectory()).map((entry) => path.join(root, entry.name)).sort();
|
|
155
|
+
const latest = dirs.reverse().find(asyncDirLikelyUltra);
|
|
156
|
+
if (!latest)
|
|
157
|
+
return path.join(os.tmpdir(), 'sks-ultra-search-missing');
|
|
158
|
+
return latest;
|
|
159
|
+
}
|
|
160
|
+
function asyncDirLikelyUltra(dir) {
|
|
161
|
+
return Boolean(dir);
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=ultra-search-command.js.map
|
package/dist/cli/xai-command.js
CHANGED
|
@@ -1,175 +1,35 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { ensureDir, projectRoot, readText, runProcess, sksRoot, writeTextAtomic } from '../core/fsx.js';
|
|
3
|
-
import { getCodexInfo } from '../core/codex-adapter.js';
|
|
4
|
-
import { detectXaiMcp } from '../core/mcp/xai-mcp-detector.js';
|
|
5
|
-
// `sks xai` — wire up xAI/Grok web search (Live Search) as a Codex MCP server so
|
|
6
|
-
// SKS source-intelligence can fan out to Grok alongside Context7 and Codex web
|
|
7
|
-
// search. SKS detects xAI via an MCP server whose name matches xai/grok/x-ai and
|
|
8
|
-
// that exposes a search/web/query tool (see core/mcp/xai-mcp-detector.ts), so
|
|
9
|
-
// `setup` registers that MCP server and points the operator at XAI_API_KEY.
|
|
10
|
-
//
|
|
11
|
-
// xAI reference (https://api.x.ai/v1): OpenAI-compatible Responses API with the
|
|
12
|
-
// `web_search` / `x_search` tools, model family `grok-4.x`, auth via XAI_API_KEY.
|
|
13
|
-
const XAI_DOCS_URL = 'https://docs.x.ai/developers/tools/web-search';
|
|
14
|
-
const XAI_API_BASE = 'https://api.x.ai/v1';
|
|
15
|
-
const DEFAULT_SERVER_NAME = 'grok-search';
|
|
16
|
-
const flag = (args, name) => args.includes(name);
|
|
17
1
|
export async function xaiCommand(sub = 'check', args = []) {
|
|
2
|
+
const json = args.includes('--json');
|
|
18
3
|
const action = sub || 'check';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (detection.servers.length) {
|
|
37
|
-
for (const server of detection.servers) {
|
|
38
|
-
console.log(` • ${server.raw_name} (${server.source})${server.tools.length ? ` tools: ${server.tools.join(', ')}` : ''}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
console.log(`Checked: ${detection.config_paths_checked.join(', ') || 'none'}`);
|
|
42
|
-
if (!detection.configured) {
|
|
43
|
-
console.log('\nNot configured. Run: sks xai setup --scope project --command "<your-xai-mcp-server>"');
|
|
44
|
-
console.log('Then export your key: export XAI_API_KEY=xai-...');
|
|
45
|
-
console.log(`Docs: ${XAI_DOCS_URL}`);
|
|
46
|
-
}
|
|
47
|
-
else if (detection.status === 'configured_but_unverified') {
|
|
48
|
-
console.log('\nServer is registered; tool capability is verified when Codex lists its tools at runtime.');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function xaiSetup(args) {
|
|
52
|
-
const scope = readOption(args, '--scope', flag(args, '--global') ? 'global' : 'project');
|
|
53
|
-
if (!['project', 'global'].includes(scope))
|
|
54
|
-
throw new Error('Invalid xAI scope. Use --scope project or --scope global.');
|
|
55
|
-
const name = sanitizeServerName(readOption(args, '--name', DEFAULT_SERVER_NAME));
|
|
56
|
-
const url = readOption(args, '--url', null);
|
|
57
|
-
const command = readOption(args, '--command', null);
|
|
58
|
-
const commandArgs = readRepeatedOption(args, '--arg');
|
|
59
|
-
const envKey = readOption(args, '--api-key-env', 'XAI_API_KEY');
|
|
60
|
-
if (!url && !command) {
|
|
61
|
-
// Nothing to install yet: print a ready-to-paste config + the exact next steps
|
|
62
|
-
// instead of writing a broken/guessed server entry.
|
|
63
|
-
printSetupGuidance(scope, name, envKey);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (scope === 'global') {
|
|
67
|
-
const codex = await getCodexInfo();
|
|
68
|
-
if (!codex.bin)
|
|
69
|
-
throw new Error('Codex CLI missing. Install @openai/codex or set SKS_CODEX_BIN, then re-run.');
|
|
70
|
-
const cmdArgs = url
|
|
71
|
-
? ['mcp', 'add', name, '--url', url]
|
|
72
|
-
: ['mcp', 'add', name, '--', command, ...commandArgs];
|
|
73
|
-
const result = await runProcess(codex.bin, cmdArgs, { timeoutMs: 30000, maxOutputBytes: 64 * 1024 });
|
|
74
|
-
if (flag(args, '--json'))
|
|
75
|
-
return console.log(JSON.stringify({ scope, name, command: `${codex.bin} ${cmdArgs.join(' ')}`, result }, null, 2));
|
|
76
|
-
if (result.code !== 0)
|
|
77
|
-
throw new Error(result.stderr || result.stdout || 'codex mcp add failed');
|
|
78
|
-
console.log(`xAI/Grok MCP "${name}" registered globally.`);
|
|
79
|
-
console.log(`Set your key: export ${envKey}=xai-... (docs: ${XAI_DOCS_URL})`);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const root = await projectRoot().catch(() => sksRoot());
|
|
83
|
-
const changed = await ensureProjectXaiMcpConfig(root, { name, url, command, commandArgs, envKey });
|
|
84
|
-
const detection = await detectXaiMcp({ root });
|
|
85
|
-
if (flag(args, '--json'))
|
|
86
|
-
return console.log(JSON.stringify({ scope, name, changed, detection }, null, 2));
|
|
87
|
-
console.log(`xAI/Grok MCP "${name}" ${changed ? 'configured' : 'already configured'} in .codex/config.toml`);
|
|
88
|
-
console.log(`Detected: ${detection.configured ? 'yes' : 'no'} (${detection.status})`);
|
|
89
|
-
console.log(`Set your key: export ${envKey}=xai-... (docs: ${XAI_DOCS_URL})`);
|
|
90
|
-
}
|
|
91
|
-
async function xaiDocs(_args) {
|
|
92
|
-
console.log('SKS xAI / Grok search integration\n');
|
|
93
|
-
console.log(`API base: ${XAI_API_BASE}`);
|
|
94
|
-
console.log('Auth: XAI_API_KEY (Bearer)');
|
|
95
|
-
console.log('Model: grok-4.x (OpenAI-compatible Responses API)');
|
|
96
|
-
console.log('Tools: web_search, x_search (agentic Live Search)');
|
|
97
|
-
console.log(`Reference: ${XAI_DOCS_URL}\n`);
|
|
98
|
-
console.log('Wire it into SKS source-intelligence with an MCP server:');
|
|
99
|
-
console.log(' sks xai setup --scope project --command "npx" --arg "-y" --arg "<your-grok-search-mcp>"');
|
|
100
|
-
console.log(' sks xai setup --scope global --url "https://<your-grok-mcp-endpoint>"');
|
|
101
|
-
console.log(' export XAI_API_KEY=xai-...');
|
|
102
|
-
console.log(' sks xai check');
|
|
103
|
-
}
|
|
104
|
-
function printSetupGuidance(scope, name, envKey) {
|
|
105
|
-
console.log('SKS xAI / Grok search setup\n');
|
|
106
|
-
console.log('Specify the MCP server to register. Examples:');
|
|
107
|
-
console.log(` sks xai setup --scope ${scope} --command "npx" --arg "-y" --arg "<your-grok-search-mcp>"`);
|
|
108
|
-
console.log(` sks xai setup --scope ${scope} --url "https://<your-grok-mcp-endpoint>"`);
|
|
109
|
-
console.log('\nReady-to-paste .codex/config.toml block (edit command/args for your server):\n');
|
|
110
|
-
console.log(xaiMcpToml({ name, command: 'npx', commandArgs: ['-y', '<your-grok-search-mcp>'], envKey }).trim());
|
|
111
|
-
console.log(`\nThen set your key: export ${envKey}=xai-...`);
|
|
112
|
-
console.log(`Docs: ${XAI_DOCS_URL}`);
|
|
113
|
-
}
|
|
114
|
-
export function xaiMcpToml(opts) {
|
|
115
|
-
const name = sanitizeServerName(opts.name || DEFAULT_SERVER_NAME);
|
|
116
|
-
const envKey = opts.envKey || 'XAI_API_KEY';
|
|
117
|
-
const lines = [`[mcp_servers.${name}]`];
|
|
118
|
-
if (opts.url) {
|
|
119
|
-
lines.push(`url = ${JSON.stringify(opts.url)}`);
|
|
120
|
-
}
|
|
4
|
+
const result = {
|
|
5
|
+
schema: 'sks.xai-compat.v1',
|
|
6
|
+
ok: action !== 'setup',
|
|
7
|
+
status: 'deprecated',
|
|
8
|
+
action,
|
|
9
|
+
setup_performed: false,
|
|
10
|
+
xai_required: false,
|
|
11
|
+
replacement: {
|
|
12
|
+
doctor: 'sks ultra-search doctor',
|
|
13
|
+
x_search: 'sks ultra-search x "<query>"',
|
|
14
|
+
migration: 'sks ultra-search migrate-xai [--apply]'
|
|
15
|
+
},
|
|
16
|
+
blockers: action === 'setup' ? ['xai_setup_removed_use_ultra_search'] : [],
|
|
17
|
+
warnings: ['sks_xai_is_deprecated_and_does_not_configure_mcp_or_require_XAI_API_KEY']
|
|
18
|
+
};
|
|
19
|
+
if (json)
|
|
20
|
+
console.log(JSON.stringify(result, null, 2));
|
|
121
21
|
else {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
async function ensureProjectXaiMcpConfig(root, opts) {
|
|
131
|
-
const configPath = path.join(root, '.codex', 'config.toml');
|
|
132
|
-
await ensureDir(path.dirname(configPath));
|
|
133
|
-
const current = await readText(configPath, '');
|
|
134
|
-
const block = xaiMcpToml(opts).trim();
|
|
135
|
-
const existingRe = new RegExp(`(^|\\n)\\[mcp_servers\\.${escapeRegExp(opts.name)}\\]\\n[\\s\\S]*?(?=\\n\\[[^\\]]+\\]|\\s*$)`);
|
|
136
|
-
if (existingRe.test(current)) {
|
|
137
|
-
const next = current.replace(existingRe, `$1${block}\n`);
|
|
138
|
-
if (next === current)
|
|
139
|
-
return false;
|
|
140
|
-
await writeTextAtomic(configPath, next.endsWith('\n') ? next : `${next}\n`);
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
const text = String(current);
|
|
144
|
-
await writeTextAtomic(configPath, `${text.trimEnd()}${text.trim() ? '\n\n' : ''}${block}\n`);
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
function describeStatus(status) {
|
|
148
|
-
switch (status) {
|
|
149
|
-
case 'search_capable': return 'search-capable (ready)';
|
|
150
|
-
case 'configured_but_unverified': return 'configured (verify tools at runtime)';
|
|
151
|
-
case 'configured_no_search': return 'configured but no search tool detected';
|
|
152
|
-
case 'missing': return 'not configured';
|
|
153
|
-
default: return status;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
function sanitizeServerName(value) {
|
|
157
|
-
const cleaned = String(value || DEFAULT_SERVER_NAME).trim().replace(/[^A-Za-z0-9._-]+/g, '-').replace(/^-+|-+$/g, '');
|
|
158
|
-
return cleaned || DEFAULT_SERVER_NAME;
|
|
159
|
-
}
|
|
160
|
-
function readOption(args, name, fallback) {
|
|
161
|
-
const i = args.indexOf(name);
|
|
162
|
-
return i >= 0 && args[i + 1] && !String(args[i + 1]).startsWith('--') ? args[i + 1] : fallback;
|
|
163
|
-
}
|
|
164
|
-
function readRepeatedOption(args, name) {
|
|
165
|
-
const out = [];
|
|
166
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
167
|
-
if (args[i] === name && args[i + 1])
|
|
168
|
-
out.push(String(args[i + 1]));
|
|
22
|
+
console.log('`sks xai` is deprecated. UltraSearch no longer requires xAI/Grok or XAI_API_KEY.');
|
|
23
|
+
console.log('Use: sks ultra-search doctor');
|
|
24
|
+
console.log('Use: sks ultra-search x "<query>"');
|
|
25
|
+
if (action === 'setup') {
|
|
26
|
+
console.log('No MCP setup was performed.');
|
|
27
|
+
process.exitCode = 1;
|
|
28
|
+
}
|
|
169
29
|
}
|
|
170
|
-
return
|
|
30
|
+
return result;
|
|
171
31
|
}
|
|
172
|
-
function
|
|
173
|
-
return
|
|
32
|
+
export function xaiMcpToml() {
|
|
33
|
+
return '';
|
|
174
34
|
}
|
|
175
35
|
//# sourceMappingURL=xai-command.js.map
|
|
@@ -72,7 +72,7 @@ export async function buildAgentCodexCockpitState(missionDir, opts = {}) {
|
|
|
72
72
|
janitor_ok: janitor?.ok ?? null,
|
|
73
73
|
proof_status: proof?.status || (proof?.ok ? 'passed' : proof ? 'blocked' : null),
|
|
74
74
|
source_intelligence_status: sourceIntelligence?.ok === true ? sourceIntelligence.mode || 'ok' : sourceIntelligence ? 'blocked' : null,
|
|
75
|
-
|
|
75
|
+
ultra_search_status: sourceIntelligence?.ultra_search?.proof?.ok === true ? 'verified' : sourceIntelligence?.ultra_search ? 'partial' : null,
|
|
76
76
|
codex_web_search_status: sourceIntelligence?.codex_web_search?.status || sourceIntelligence?.policy?.codex_web_search?.status || null,
|
|
77
77
|
goal_mode_status: goalMode?.mode || null,
|
|
78
78
|
terminal_session_status: terminalClosed ? 'closed' : proof ? 'blocked_or_unverified' : null,
|
|
@@ -115,7 +115,7 @@ export function renderAgentCodexDashboard(state) {
|
|
|
115
115
|
`- Concurrency: ${state.concurrency ?? 'unknown'}`,
|
|
116
116
|
`- Proof: ${state.proof_status || 'unknown'}`,
|
|
117
117
|
`- Source intelligence: ${state.source_intelligence_status || 'unknown'}`,
|
|
118
|
-
`-
|
|
118
|
+
`- UltraSearch: ${state.ultra_search_status || 'unknown'}`,
|
|
119
119
|
`- Codex Web Search: ${state.codex_web_search_status || 'unknown'}`,
|
|
120
120
|
`- Goal mode: ${state.goal_mode_status || 'unknown'}`,
|
|
121
121
|
`- Terminal sessions: ${state.terminal_session_status || 'unknown'}`,
|
|
@@ -195,7 +195,7 @@ function summarizeLiveState(state) {
|
|
|
195
195
|
session_generation_count: state.session_generations.length,
|
|
196
196
|
proof_status: state.proof_status,
|
|
197
197
|
source_intelligence_status: state.source_intelligence_status,
|
|
198
|
-
|
|
198
|
+
ultra_search_status: state.ultra_search_status,
|
|
199
199
|
codex_web_search_status: state.codex_web_search_status,
|
|
200
200
|
goal_mode_status: state.goal_mode_status,
|
|
201
201
|
terminal_session_status: state.terminal_session_status,
|
|
@@ -4,6 +4,7 @@ import { loadTriWikiRuntimeContext, triWikiContextBlock, triWikiProofRecord } fr
|
|
|
4
4
|
import { validateAgentWorkerResult } from './agent-worker-pipeline.js';
|
|
5
5
|
import { normalizeAgentPatchEnvelope } from './agent-patch-schema.js';
|
|
6
6
|
import { resolveOllamaWorkerConfig } from './ollama-worker-config.js';
|
|
7
|
+
import { leanEngineeringCompactText } from '../lean-engineering-policy.js';
|
|
7
8
|
export const OLLAMA_WORKER_POLICY_SCHEMA = 'sks.ollama-worker-policy.v1';
|
|
8
9
|
export const OLLAMA_WORKER_REQUEST_SCHEMA = 'sks.ollama-worker-request.v1';
|
|
9
10
|
export const OLLAMA_WORKER_RESPONSE_SCHEMA = 'sks.ollama-worker-response.v1';
|
|
@@ -185,6 +186,7 @@ function buildOllamaGenerateRequest(agent, slice, opts, config, requestId, triwi
|
|
|
185
186
|
const prompt = [
|
|
186
187
|
'You are an SKS local Ollama worker. You are not an architect, planner, reviewer, verifier, safety judge, or strategist.',
|
|
187
188
|
'Only perform the narrow worker task below. If the task asks for strategy, planning, design, review, verification, risk judgment, or orchestration, return JSON with status "blocked" and blockers.',
|
|
189
|
+
leanEngineeringCompactText(),
|
|
188
190
|
'Before writing or collecting, consult the TriWiki context below first. Treat use_first as high-trust project memory and hydrate_first as source/evidence that the parent must verify before risky or user-visible work.',
|
|
189
191
|
'If TriWiki is missing, stale, or lacks current stack syntax/version guidance, do not invent from model memory. Return blocked and tell the parent SKS route to update .sneakoscope/memory/q2_facts/stack-current-docs.md with Context7 or official vendor docs, then run `sks wiki refresh` and `sks wiki validate .sneakoscope/wiki/context-pack.json` before retrying.',
|
|
190
192
|
'Return JSON only. Do not wrap it in markdown.',
|
|
@@ -11,7 +11,7 @@ const WRONGNESS_MAP = [
|
|
|
11
11
|
['missing_follow_up_schema', /follow_up_work_item|follow_up_work_items|schema_invalid:.*follow_up/],
|
|
12
12
|
['session_generation_missing', /session_generation_open|terminal_close_report_missing|source_intelligence_missing_for_generation|goal_mode_missing_for_generation/],
|
|
13
13
|
['schema_invalid_output', /^schema_invalid:/],
|
|
14
|
-
['
|
|
14
|
+
['ultra_search_provider_independent_proof_missing', /ultra_search_provider_independent_proof_missing/],
|
|
15
15
|
['codex_web_search_missing', /codex_web_search_missing/],
|
|
16
16
|
['context7_missing', /context7_missing|docs_context_missing/],
|
|
17
17
|
['stale_heartbeat', /stale_heartbeat/],
|
|
@@ -9,6 +9,7 @@ import { validateAgentWorkerResult } from './agent-worker-pipeline.js';
|
|
|
9
9
|
import { normalizeAgentPatchEnvelope } from './agent-patch-schema.js';
|
|
10
10
|
import { runCodexTask } from '../codex-control/codex-control-plane.js';
|
|
11
11
|
import { CODEX_AGENT_WORKER_RESULT_SCHEMA_ID, codexAgentWorkerResultSchema } from '../codex-control/schemas/agent-worker-result.schema.js';
|
|
12
|
+
import { leanEngineeringCompactText, leanPolicyReference } from '../lean-engineering-policy.js';
|
|
12
13
|
export const NATIVE_WORKER_BACKEND_ROUTER_SCHEMA = 'sks.native-worker-backend-router.v1';
|
|
13
14
|
export async function runNativeWorkerBackendRouter(input) {
|
|
14
15
|
const root = path.resolve(input.agentRoot);
|
|
@@ -216,6 +217,7 @@ export async function runNativeWorkerBackendRouter(input) {
|
|
|
216
217
|
model_authored_patch_envelopes: patchEnvelopes.some((envelope) => envelope.source === 'model_authored'),
|
|
217
218
|
fixture_patch_envelopes: patchEnvelopes.some((envelope) => envelope.source === 'fixture'),
|
|
218
219
|
proof_level: proofLevel,
|
|
220
|
+
lean_engineering_policy: leanPolicyReference(),
|
|
219
221
|
fast_mode: input.fastModePolicy.fast_mode,
|
|
220
222
|
service_tier: input.fastModePolicy.service_tier,
|
|
221
223
|
sdk_thread_id: childReports.find((report) => report?.sdk_thread_id)?.sdk_thread_id || null,
|
|
@@ -284,6 +286,7 @@ function buildWorkerPrompt(slice) {
|
|
|
284
286
|
write.length
|
|
285
287
|
? `Write-capable slice. Return JSON matching ${CODEX_AGENT_WORKER_RESULT_SCHEMA_ID}; include patch_envelopes for write_paths=${JSON.stringify(write)}.`
|
|
286
288
|
: `Read-only slice. Return JSON matching ${CODEX_AGENT_WORKER_RESULT_SCHEMA_ID}; do not report pre-existing repository dirtiness as changed_files.`,
|
|
289
|
+
leanEngineeringCompactText(),
|
|
287
290
|
'Required JSON fields: status, summary, findings, changed_files, patch_envelopes, verification, rollback_notes, blockers.'
|
|
288
291
|
].join('\n');
|
|
289
292
|
}
|