clearotron 0.5.1 → 0.6.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +7 -7
- package/INSTALL.md +10 -10
- package/QUICKSTART.md +6 -6
- package/README.md +2 -2
- package/THIRD-PARTY-NOTICES.md +4 -4
- package/bin/README.md +2 -2
- package/bin/clearotron.mjs +1 -1
- package/bin/connect.mjs +1 -1
- package/bin/disconnect.mjs +1 -1
- package/bin/example.mjs +2 -2
- package/bin/grant.mjs +1 -1
- package/bin/onboard.mjs +78 -23
- package/bin/start.mjs +88 -33
- package/bin/update.mjs +13 -3
- package/build-info.json +2 -2
- package/docs/DELIVERY.md +1 -1
- package/docs/PORTAL.md +1 -1
- package/docs/RELEASES.md +1 -1
- package/docs/architecture/02-architecture.md +10 -2
- package/docs/architecture/03-run-lifecycle.md +6 -2
- package/docs/architecture/04-configuration-reference.md +3 -3
- package/docs/architecture/05-config-governance.md +5 -4
- package/docs/architecture/08-development-guide.md +4 -4
- package/docs/architecture/09-security-and-data.md +1 -1
- package/{driver/skills/clearance-search/SKILL.md → docs/architecture/retired-manuals/clearance-search-spine.md} +17 -30
- package/{driver/skills/clearance-search/templates/email/generic.md → docs/architecture/retired-manuals/email-generic.md} +1 -1
- package/{driver/skills/clearance-search → docs/architecture/retired-manuals}/template-formatting.md +3 -4
- package/docs/configuration.md +1 -1
- package/docs/decisions/0002-no-dark-functionality.md +5 -0
- package/driver/CHANGELOG.md +69 -0
- package/driver/README.md +11 -1
- package/driver/accepted-order.mjs +13 -5
- package/driver/attempt-rows.mjs +64 -0
- package/driver/attributed-span.mjs +1 -1
- package/driver/authority-trees.mjs +1 -1
- package/driver/band-shape.mjs +21 -3
- package/driver/best-draft.mjs +3 -3
- package/driver/blind-frame-record.mjs +2 -2
- package/driver/cancel.mjs +3 -2
- package/driver/carry-through.mjs +2 -2
- package/driver/citation-census.json +3 -3
- package/driver/clearance-variants-record.mjs +4 -10
- package/driver/common-law-coverage-status.mjs +3 -3
- package/driver/common-law-receipts.mjs +2 -2
- package/driver/commonlaw-carry-floor.json +3 -3
- package/driver/compare.mjs +1 -1
- package/driver/config-inventory.mjs +6 -79
- package/driver/consumption-ledger.mjs +2 -1
- package/driver/contract-arm2-baseline.json +2 -3
- package/driver/contract-dictation-registry.mjs +5 -0
- package/driver/contract-e3-backlog.mjs +45 -66
- package/driver/contract-e3-baseline.json +16 -16
- package/driver/contract-vocabulary.mjs +8 -6
- package/driver/corrections-feedforward.mjs +3 -1
- package/driver/coverage-form-io.mjs +7 -8
- package/driver/coverage-tool.mjs +1 -1
- package/driver/declination-tool.mjs +2 -2
- package/driver/degraded-parts.mjs +9 -9
- package/driver/demo-container.mjs +5 -4
- package/driver/demo-posture.mjs +17 -0
- package/driver/deploy-live-run-guard.mjs +19 -7
- package/driver/derived-state.mjs +2 -2
- package/driver/dev-portal.mjs +2 -1
- package/driver/dispatch-record.mjs +1 -1
- package/driver/disposition-tool.mjs +2 -1
- package/driver/doubt-closure-tool.mjs +2 -2
- package/driver/driver.config.mjs +35 -724
- package/driver/e2e-rounds.mjs +3 -4
- package/driver/engine/CONTRACT.md +3 -0
- package/driver/engine/README.md +2 -0
- package/driver/engine/anthropic-agent.mjs +13 -42
- package/driver/engine/auth.mjs +74 -0
- package/driver/engine/child-record.mjs +1 -1
- package/driver/engine/deny-authority-write.mjs +2 -2
- package/driver/engine/jx-turn.mjs +10 -2
- package/driver/engine/mcp/README.md +1 -1
- package/driver/engine/mcp/band-server.mjs +20 -13
- package/driver/engine/mcp/codex-config.mjs +1 -1
- package/driver/engine/mcp/declination-server.mjs +2 -3
- package/driver/engine/mcp/dispositions-server.mjs +3 -3
- package/driver/engine/mcp/gather-config.mjs +24 -19
- package/driver/engine/mcp/grid-provenance.mjs +1 -1
- package/driver/engine/mcp/held-answers.mjs +5 -5
- package/driver/engine/mcp/perplexity-server.mjs +16 -7
- package/driver/engine/mcp/recording-server.mjs +7 -6
- package/driver/engine/mcp/register-server.mjs +29 -0
- package/driver/engine/mcp/stdio-server.mjs +5 -5
- package/driver/engine/mcp/supplemental.mjs +9 -9
- package/driver/engine/openai-agent.mjs +5 -2
- package/driver/engine/registry.mjs +103 -0
- package/driver/engine/run-choices.mjs +162 -0
- package/driver/engine/stamps.mjs +35 -0
- package/driver/enqueue-schema.mjs +4 -4
- package/driver/envelope-settle.mjs +3 -2
- package/driver/feedback-issues.mjs +1 -1
- package/driver/feedback-mint.mjs +3 -2
- package/driver/feedback-store.mjs +3 -2
- package/driver/findings-model.mjs +1 -1
- package/driver/flag-snapshot.mjs +5 -4
- package/driver/floor-duty.mjs +3 -3
- package/driver/foreign-record-links.mjs +1 -1
- package/driver/frame-diff-record.mjs +2 -8
- package/driver/framework.mjs +1 -1
- package/driver/gate-metrics.mjs +10 -11
- package/driver/gateway.mjs +220 -839
- package/driver/goods-evidence.mjs +26 -14
- package/driver/jx-lanes.mjs +3 -3
- package/driver/jx-units.mjs +31 -37
- package/driver/jx.mjs +44 -59
- package/driver/knockout-assess-record.mjs +3 -3
- package/driver/knockout-caveats.mjs +21 -0
- package/driver/knockout-correction-record.mjs +58 -28
- package/driver/knockout-frame-record.mjs +2 -2
- package/driver/knockout-register-read.mjs +38 -21
- package/driver/knockout-register-record.mjs +5 -6
- package/driver/knockout-review-record.mjs +12 -11
- package/driver/ladder/model-gauge.mjs +88 -0
- package/driver/ladder/next-rung.mjs +296 -0
- package/driver/ladder/rescue.mjs +146 -0
- package/driver/ladder/stage-tools.mjs +57 -0
- package/driver/ladder/turn-failure.mjs +166 -0
- package/driver/log.mjs +2 -2
- package/driver/matter-frame-record.mjs +4 -4
- package/driver/methodology-witness.mjs +2 -2
- package/driver/named-band.mjs +60 -3
- package/driver/narrative-refutation-record.mjs +145 -42
- package/driver/one-build-per-run.mjs +62 -0
- package/driver/outbox-backoff.mjs +4 -4
- package/driver/owner-screen.mjs +0 -10
- package/driver/owner-use-check.mjs +2 -28
- package/driver/package.json +1 -1
- package/driver/partial-payload-baseline.json +1 -1
- package/driver/parts-not-completed.mjs +1 -1
- package/driver/pipeline-knockout.mjs +1015 -1001
- package/driver/pipeline.mjs +714 -9351
- package/driver/placement-decisions.mjs +2 -2
- package/driver/placement-form-io.mjs +7 -9
- package/driver/placement-union.mjs +0 -6
- package/driver/plan-stability.mjs +7 -10
- package/driver/portal-acks.mjs +3 -2
- package/driver/portal-confirmation.mjs +48 -0
- package/driver/portal-families.mjs +3 -2
- package/driver/portal-local-auth.mjs +1 -2
- package/driver/portal-routes/README.md +24 -0
- package/driver/portal-routes/admin.mjs +425 -0
- package/driver/portal-routes/compose.mjs +66 -0
- package/driver/portal-routes/config.mjs +118 -0
- package/driver/portal-routes/connect.mjs +283 -0
- package/driver/portal-routes/feedback.mjs +178 -0
- package/driver/portal-routes/me.mjs +165 -0
- package/driver/portal-routes/queue.mjs +64 -0
- package/driver/portal-routes/report.mjs +106 -0
- package/driver/portal-routes/run.mjs +508 -0
- package/driver/portal-routes/runs.mjs +127 -0
- package/driver/portal-routes/usage.mjs +82 -0
- package/driver/portal-runs.mjs +588 -0
- package/driver/portal-service.mjs +82 -2593
- package/driver/portal-static.mjs +3 -1
- package/driver/predelivery-lint.mjs +101 -9
- package/driver/production-pool-guard.mjs +1 -1
- package/driver/profiles.mjs +5 -4
- package/driver/progress.mjs +29 -24
- package/driver/publish/README.md +10 -5
- package/driver/publish/archive-tags.mjs +3 -2
- package/driver/publish/demo-marking.mjs +2 -2
- package/driver/publish/index.mjs +215 -140
- package/driver/publish/knockout.mjs +153 -107
- package/driver/publish/office-record-links.mjs +22 -0
- package/driver/publish/parse.mjs +20 -5
- package/driver/publish/pool-admin.mjs +9 -3
- package/driver/publish/render.mjs +11 -3
- package/driver/publish/report-dates.mjs +3 -4
- package/driver/publish/report-registry.mjs +7 -10
- package/driver/publish/seed-pool.mjs +3 -2
- package/driver/publish/shell.mjs +106 -0
- package/driver/publish/templates/report.css +9 -7
- package/driver/queue-order.mjs +4 -3
- package/driver/record-carry.mjs +0 -9
- package/driver/record-discard.mjs +1 -4
- package/driver/record-fold.mjs +3 -3
- package/driver/record-goods.mjs +79 -23
- package/driver/reference-score.mjs +2 -3
- package/driver/register-capabilities.mjs +0 -6
- package/driver/register-count.mjs +3 -2
- package/driver/register-digest-record.mjs +7 -7
- package/driver/register-fixture-marker.mjs +3 -3
- package/driver/register-plan.mjs +2 -2
- package/driver/register-records.mjs +2 -2
- package/driver/register-taint.mjs +3 -3
- package/driver/register-unit-record.mjs +48 -9
- package/driver/register-unreachable.mjs +4 -3
- package/driver/registry-fidelity.mjs +79 -34
- package/driver/repair-composers.mjs +14 -9
- package/driver/repair-digest.mjs +4 -6
- package/driver/repair-scope.mjs +3 -3
- package/driver/repair-targets.mjs +24 -9
- package/driver/repairs.mjs +44 -58
- package/driver/replay-archive.mjs +7 -7
- package/driver/report-card-record.mjs +3 -3
- package/driver/report-overview-record.mjs +4 -4
- package/driver/research-answers.mjs +38 -6
- package/driver/research-checks.mjs +4 -4
- package/driver/result-noun-fields.mjs +28 -11
- package/driver/review-addresses.mjs +163 -0
- package/driver/rule-shape.mjs +1 -1
- package/driver/run-delivered.mjs +340 -0
- package/driver/run-economics.mjs +8 -26
- package/driver/run-failed.mjs +545 -0
- package/driver/run-integrity.mjs +1 -1
- package/driver/run-outcome.mjs +314 -0
- package/driver/run-park.mjs +23 -0
- package/driver/run-quote.mjs +32 -0
- package/driver/run-record.mjs +352 -0
- package/driver/run-requirements.mjs +22 -0
- package/driver/run-shell.mjs +55 -0
- package/driver/runner.mjs +71 -33
- package/driver/saved-register-pages.mjs +4 -4
- package/driver/score-redaction.mjs +2 -2
- package/driver/search-policy.mjs +12 -13
- package/driver/settle-stamp.mjs +4 -3
- package/driver/skeptic-record.mjs +2 -2
- package/driver/skeptic-search.mjs +1 -1
- package/driver/skills/README.md +7 -7
- package/driver/skills/blind-frame/SKILL.md +1 -2
- package/driver/skills/case-law-citation/SKILL.md +9 -37
- package/driver/skills/case-law-citation/sources/courtlistener.md +1 -3
- package/driver/skills/case-law-citation/sources/eurlex.md +8 -11
- package/driver/skills/case-law-citation/sources/legaldatahunter.md +1 -1
- package/driver/skills/clearance-common-law/SKILL.md +45 -111
- package/driver/skills/clearance-common-law/perplexity-prompts.md +7 -79
- package/driver/skills/clearance-register/SKILL.md +15 -33
- package/driver/skills/clearance-register/digest.md +35 -96
- package/driver/skills/clearance-register/providers/clarivate.md +2 -2
- package/driver/skills/clearance-register/providers/corsearch.md +5 -5
- package/driver/skills/clearance-register/providers/euipo.md +1 -2
- package/driver/skills/clearance-register/providers/free-tier.md +0 -19
- package/driver/skills/clearance-register/providers/signa.md +6 -25
- package/driver/skills/clearance-register/providers/uspto-local.md +0 -24
- package/driver/skills/clearance-register/register-recipes.md +8 -15
- package/driver/skills/clearance-register/status-rules.md +6 -24
- package/driver/skills/clearance-register/unit.md +11 -20
- package/driver/skills/clearance-search/delivery-contract.md +24 -120
- package/driver/skills/clearance-search/field-doctrine-pharma.md +1 -5
- package/driver/skills/clearance-search/firm-wide-reasoning.md +24 -43
- package/driver/skills/clearance-search/phase2-execution.md +29 -77
- package/driver/skills/clearance-search/report-prose.md +3 -4
- package/driver/skills/clearance-search/risk-framework-demo.md +1 -1
- package/driver/skills/clearance-search/risk-framework-triage.manifest.json +3 -3
- package/driver/skills/clearance-search/risk-framework-triage.md +7 -9
- package/driver/skills/clearance-search/risk-framework.manifest.json +1 -1
- package/driver/skills/clearance-search/risk-framework.md +1 -1
- package/driver/skills/clearance-search/synthesis-rules.md +30 -107
- package/driver/skills/clearance-search/worked-examples.md +5 -5
- package/driver/skills/clearance-variants/SKILL.md +46 -45
- package/driver/skills/clearance-variants/transliteration-scripts.md +4 -4
- package/driver/skills/frame-diff/SKILL.md +1 -1
- package/driver/skills/knockout-assess/SKILL.md +6 -14
- package/driver/skills/knockout-frame/SKILL.md +1 -1
- package/driver/skills/matter-frame/SKILL.md +7 -12
- package/driver/skills/matter-frame/watchlist-reference.md +1 -4
- package/driver/skills/narrative-refutation/SKILL.md +20 -30
- package/driver/skills/placement-inquiry/SKILL.md +10 -20
- package/driver/skills-store-provenance.mjs +1 -1
- package/driver/stage-context.mjs +32 -35
- package/driver/stage-freshness.mjs +127 -11
- package/driver/stages-knockout.mjs +49 -22
- package/driver/stages.mjs +89 -288
- package/driver/status-snapshot.mjs +2 -1
- package/driver/steps/correction-cycle.mjs +311 -0
- package/driver/steps/corrections.mjs +644 -0
- package/driver/steps/delivery.mjs +1287 -0
- package/driver/steps/frame-comparison.mjs +927 -0
- package/driver/steps/intake.mjs +84 -0
- package/driver/steps/open-run.mjs +419 -0
- package/driver/steps/overview-and-cards.mjs +899 -0
- package/driver/steps/placement-and-digest.mjs +23 -0
- package/driver/steps/register-sweep.mjs +1563 -0
- package/driver/steps/skeptic-and-follow-up.mjs +836 -0
- package/driver/steps/synthesis.mjs +261 -0
- package/driver/steps/verdict-gate.mjs +968 -0
- package/driver/suite-census.json +456 -96
- package/driver/surface-exit-verdict.mjs +0 -8
- package/driver/synthesis-record.mjs +72 -6
- package/driver/terminal-clamp.mjs +10 -0
- package/driver/tokens.mjs +8 -62
- package/driver/tool-calls.mjs +2 -2
- package/driver/unexecuted-asserts.json +2 -2
- package/driver/unit-state-verdict.mjs +1 -1
- package/driver/usage-ledger.mjs +2 -1
- package/driver/verify-knockout.mjs +20 -35
- package/driver/verify.mjs +47 -36
- package/driver/web-grid.mjs +3 -4
- package/driver/whatif-memo-run.mjs +2 -2
- package/driver/whatif-queue.mjs +4 -3
- package/driver/withheld-families.mjs +14 -15
- package/driver/worker-heartbeat.mjs +3 -2
- package/driver/write-up-form.mjs +0 -3
- package/mcp-server/CHANGELOG.md +8 -0
- package/mcp-server/http-server.mjs +11 -12
- package/mcp-server/lib/brief.mjs +22 -4
- package/mcp-server/lib/events.mjs +2 -2
- package/mcp-server/lib/evidence.mjs +3 -2
- package/mcp-server/lib/findings.mjs +2 -1
- package/mcp-server/lib/knockout.mjs +9 -10
- package/mcp-server/lib/ops.mjs +9 -9
- package/mcp-server/lib/runs.mjs +9 -10
- package/mcp-server/lib/trace.mjs +1 -1
- package/mcp-server/lib/whatif.mjs +2 -3
- package/mcp-server/package.json +1 -1
- package/mcp-server/server.mjs +5 -5
- package/node_modules/buffers/package.json +1 -1
- package/package.json +2 -1
- package/portal-ui/dist/assets/{index-fPqAU0sx.js → index-CYaO2ygd.js} +26 -14
- package/portal-ui/dist/assets/{index-AtB9ZpDH.css → index-izLa9apq.css} +2 -2
- package/portal-ui/dist/index.html +4 -4
- package/portal-ui/package.json +3 -3
- package/providers/README.md +1 -1
- package/providers/_shared/answer-memory.mjs +4 -5
- package/providers/_shared/execute-plan.mjs +48 -1
- package/providers/_shared/records-from-search.mjs +46 -0
- package/providers/clarivate/README.md +2 -2
- package/providers/clarivate/src/adapter.js +147 -0
- package/providers/clarivate/src/core.js +1 -14
- package/{driver/engine/mcp/clarivate-server.mjs → providers/clarivate/src/mount.js} +5 -10
- package/providers/corsearch/README.md +3 -3
- package/providers/corsearch/src/adapter.js +80 -0
- package/providers/corsearch/src/core.js +14 -11
- package/{driver/engine/mcp/corsearch-server.mjs → providers/corsearch/src/mount.js} +5 -10
- package/providers/euipo/README.md +2 -2
- package/providers/euipo/src/adapter.js +85 -0
- package/providers/euipo/src/core.js +1 -1
- package/providers/euipo/src/euipo-client.js +1 -2
- package/{driver/engine/mcp/euipo-server.mjs → providers/euipo/src/mount.js} +5 -10
- package/providers/free-tier/README.md +2 -2
- package/providers/free-tier/src/adapter.js +127 -0
- package/{driver/engine/mcp/free-tier-server.mjs → providers/free-tier/src/mount.js} +5 -10
- package/providers/jx-subclass/coverage.mjs +1 -6
- package/providers/jx-subclass/score-truth.mjs +2 -1
- package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/perplexity/src/core.js +2 -2
- package/providers/signa/README.md +2 -2
- package/providers/signa/src/adapter.js +157 -0
- package/providers/signa/src/capabilities.js +0 -3
- package/providers/signa/src/core.js +2 -2
- package/{driver/engine/mcp/signa-server.mjs → providers/signa/src/mount.js} +7 -12
- package/providers/signa/src/offices.generated.js +17 -15
- package/providers/uspto-local/README.md +1 -1
- package/providers/uspto-local/bin/verify-index.mjs +1 -1
- package/providers/uspto-local/src/adapter.js +75 -0
- package/{driver/engine/mcp/uspto-local-server.mjs → providers/uspto-local/src/mount.js} +5 -10
- package/scripts/band-shape-probe.mjs +2 -2
- package/scripts/citation-line-check.mjs +7 -7
- package/scripts/compare.mjs +1 -1
- package/scripts/dead-names.mjs +2 -2
- package/scripts/e2e-first-time.mjs +19 -7
- package/scripts/e2e.mjs +13 -13
- package/scripts/engine-probe.mjs +1 -1
- package/scripts/env-audit.mjs +7 -4
- package/scripts/env-classify.mjs +5 -1
- package/scripts/feedback-mint.mjs +1 -1
- package/scripts/freeze-example-run.mjs +7 -7
- package/scripts/mint-suite-census.mjs +2 -2
- package/scripts/nightly-notice.mjs +1 -1
- package/scripts/release-cut-decision.mjs +7 -2
- package/scripts/release-note-required.mjs +26 -9
- package/scripts/release-notes-lint.mjs +3 -2
- package/scripts/release-version-pr-checks.mjs +1 -1
- package/scripts/render-check.mjs +1 -1
- package/scripts/settings-render-check.mjs +23 -3
- package/scripts/test-run.mjs +5 -5
- package/scripts/travelling-predicates.mjs +1 -1
- package/scripts/undeclared-field-census.mjs +1 -1
- package/scripts/unexecuted-asserts.mjs +3 -3
- package/scripts/verify-publishable.mjs +1 -1
- package/shared/client-door.mjs +1 -1
- package/shared/connect-clients.mjs +1 -1
- package/shared/connector-signin-probe.mjs +1 -1
- package/shared/customer-store.mjs +3 -2
- package/shared/env-aliases.mjs +1 -1
- package/shared/invocation.mjs +14 -2
- package/shared/names-in-force.mjs +2 -0
- package/shared/register-selection.mjs +2 -2
- package/shared/store-in-repo.mjs +3 -3
- package/shared/summary-blocks.mjs +0 -3
- package/shared/trigger-lane.mjs +1 -1
- package/shared/vacuous-pass.mjs +2 -2
- package/shared/verb-shim.mjs +4 -2
- package/vendor/buffers/package.json +1 -1
- package/node_modules/exceljs/README.md +0 -3023
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { dirname, join } from "node:path";
|
|
12
12
|
import { requireRegisterProvider } from "../../driver.config.mjs";
|
|
13
|
+
import { recordedRegister } from "../run-choices.mjs"; // the register a run recorded, which serves it
|
|
13
14
|
import { fixtureRecordsDir } from "../../register-fixture-marker.mjs";
|
|
14
15
|
import { ledgerPath, runRecordLogPath } from "../../../providers/_shared/ledger-path.mjs";
|
|
15
16
|
import { CORRECTION_POSITIONS_ENV } from "./correction-positions.mjs"; // the positions a correction hands its save
|
|
@@ -55,14 +56,14 @@ const REGISTER_TOOLS = [
|
|
|
55
56
|
// names exist" and the INTERSECTION for "what every provider grants", without re-introducing the
|
|
56
57
|
// default deleted.
|
|
57
58
|
export const REGISTER_SERVERS = {
|
|
58
|
-
corsearch: { script: "
|
|
59
|
+
corsearch: { script: "register-server.mjs", args: ["corsearch"], tools: REGISTER_TOOLS },
|
|
59
60
|
// clarivate: 7 of the 8. `register_expand_phoneme` is ABSENT ON PURPOSE — the ranked-similarity
|
|
60
61
|
// surface that would preview phoneme variants is not available on this provider (HTTP 403),
|
|
61
62
|
// and doctrine 2 forbids stubbing it with something weaker. Phonetic SEARCH still works
|
|
62
63
|
// (match_mode:"phonetic"); only the variant PREVIEW is unavailable. The gap is declared in
|
|
63
64
|
// providers/clarivate/src/capabilities.js (phonemeExpansion:false) and pinned by
|
|
64
65
|
// test/engine.gather.test.mjs, so it can never become a silent omission.
|
|
65
|
-
clarivate: { script: "
|
|
66
|
+
clarivate: { script: "register-server.mjs", args: ["clarivate"], tools: REGISTER_TOOLS.filter((t) => t !== "register_expand_phoneme") },
|
|
66
67
|
// signa: 5 of the 8, and the grant is what the server SERVES. It was 2 until and 4 until.
|
|
67
68
|
// The 2 was set on 2026-07-21 by 7ef96c7c when signa really was the thin provider — and it never
|
|
68
69
|
// moved again. The five
|
|
@@ -118,7 +119,7 @@ export const REGISTER_SERVERS = {
|
|
|
118
119
|
// " signa's core still carries NO figurative data" in driver/test/register-capabilities.test.mjs
|
|
119
120
|
// reds if a vienna/figurative field appears in providers/signa/src or if hasPublicRecordUrl goes
|
|
120
121
|
// true. If it reds, re-read this reason before you touch the test.
|
|
121
|
-
signa: { script: "
|
|
122
|
+
signa: { script: "register-server.mjs", args: ["signa"],
|
|
122
123
|
tools: ["register_search", "register_record_fetch", "register_enumerate", "register_execute_plan",
|
|
123
124
|
"register_propose_supplemental"] },
|
|
124
125
|
// euipo: 7 of the 8, the same count as clarivate and for the same missing tool.
|
|
@@ -132,7 +133,7 @@ export const REGISTER_SERVERS = {
|
|
|
132
133
|
// only {imageFormat, viennaClasses} with no bytes and no URL, which reads like an empty field.
|
|
133
134
|
// `GET /trademarks/{n}/image` answers 200 with real image bytes. The tool serves the Vienna
|
|
134
135
|
// figurative-element codes — the comparable data — rather than the bytes.
|
|
135
|
-
euipo: { script: "
|
|
136
|
+
euipo: { script: "register-server.mjs", args: ["euipo"], tools: REGISTER_TOOLS.filter((t) => t !== "register_expand_phoneme") },
|
|
136
137
|
// uspto-local: 6 of the 8, and the only provider here that is a FILE rather than an API — the guard
|
|
137
138
|
// it fails on is USPTO_LOCAL_DB, not a key. Two tools are absent on purpose, neither stubbed:
|
|
138
139
|
// register_image_fetch — the USPTO bulk product is text. It carries the drawing CODE (hence
|
|
@@ -142,7 +143,7 @@ export const REGISTER_SERVERS = {
|
|
|
142
143
|
// slice is stamped unsupported at compile time and disclosed as a deferred coverage row.
|
|
143
144
|
// Both gaps are declared in providers/uspto-local/src/capabilities.js and the exact six are pinned by
|
|
144
145
|
// test/engine.gather.test.mjs, so neither can become a silent omission.
|
|
145
|
-
"uspto-local": { script: "
|
|
146
|
+
"uspto-local": { script: "register-server.mjs", args: ["uspto-local"],
|
|
146
147
|
tools: REGISTER_TOOLS.filter((t) => t !== "register_expand_phoneme" && t !== "register_image_fetch") },
|
|
147
148
|
// free-tier: EUIPO + the local US index as ONE register — 7 of the 8. The surface is the UNION
|
|
148
149
|
// of what its members can serve, not the intersection, because a tool one member serves is still a
|
|
@@ -153,7 +154,7 @@ export const REGISTER_SERVERS = {
|
|
|
153
154
|
// register_expand_phoneme — ABSENT, and here the intersection and the union agree: NEITHER member
|
|
154
155
|
// has a phonetic surface, so predicates.phonetic is null and a phonetic slice defers rather than
|
|
155
156
|
// degrading into a contains under the phonetic name.
|
|
156
|
-
"free-tier": { script: "
|
|
157
|
+
"free-tier": { script: "register-server.mjs", args: ["free-tier"],
|
|
157
158
|
tools: REGISTER_TOOLS.filter((t) => t !== "register_expand_phoneme") },
|
|
158
159
|
};
|
|
159
160
|
|
|
@@ -793,19 +794,19 @@ export function providerUnavailableRegisterTools(provider = null) {
|
|
|
793
794
|
return new Set(REGISTER_TOOLS.filter((t) => !served.has(t)));
|
|
794
795
|
}
|
|
795
796
|
|
|
796
|
-
function registerEntry() {
|
|
797
|
+
function registerEntry(register = null) {
|
|
797
798
|
// `|| "corsearch"` lived here too — a SECOND silent default, behind the first one, so fixing
|
|
798
799
|
// driver.config alone would have left the gather stages resolving to a vendor we hold no licence
|
|
799
800
|
// with. requireRegisterProvider throws instead, with the same message the driver gives.
|
|
800
|
-
const p = requireRegisterProvider();
|
|
801
|
+
const p = register ?? requireRegisterProvider();
|
|
801
802
|
const entry = REGISTER_SERVERS[p];
|
|
802
|
-
if (!entry) throw new Error(`[gather-config] no MCP server built for REGISTER_PROVIDER="${p}" yet — wrap providers/${p}/src/core like corsearch
|
|
803
|
+
if (!entry) throw new Error(`[gather-config] no MCP server built for REGISTER_PROVIDER="${p}" yet — wrap providers/${p}/src/core in a mount.js like corsearch's (pure glue, exposing the register_* names), then add it to REGISTER_SERVERS.`);
|
|
803
804
|
return entry;
|
|
804
805
|
}
|
|
805
806
|
|
|
806
807
|
// Resolve a local key to its {script, tools}. `register` is dynamic; everything else is static LOCAL.
|
|
807
|
-
function localEntry(key) {
|
|
808
|
-
return key === "register" ? registerEntry() : LOCAL[key];
|
|
808
|
+
function localEntry(key, register = null) {
|
|
809
|
+
return key === "register" ? registerEntry(register) : LOCAL[key];
|
|
809
810
|
}
|
|
810
811
|
|
|
811
812
|
// group → { localKeys[], bridgeKeys[], extraTools[] }
|
|
@@ -879,7 +880,7 @@ export const claudeToolAnswerBytes = (env = process.env) =>
|
|
|
879
880
|
// The mcp-config server env carries ONLY the per-run, non-secret values (session key + ledger paths +
|
|
880
881
|
// agent + the run dir the band tools serve, and the answer size above). Creds (CORSEARCH_SESSION_KEY /
|
|
881
882
|
// PERPLEXITY_API_KEY / EUIPO_*) are inherited from the engine env.
|
|
882
|
-
function serverEnv({ sessionKey, agent, runDir, recordAxis, bandGroups = false, correctionPositions = null }) {
|
|
883
|
+
function serverEnv({ sessionKey, agent, runDir, recordAxis, bandGroups = false, correctionPositions = null, register = null }) {
|
|
883
884
|
const e = {};
|
|
884
885
|
// — see buildGatherMcpConfig: a register server without a run is refused there, so by the time
|
|
885
886
|
// the record-log line below runs, `runDir` is present for every config that could use it.
|
|
@@ -898,7 +899,10 @@ function serverEnv({ sessionKey, agent, runDir, recordAxis, bandGroups = false,
|
|
|
898
899
|
// — THE RUN'S REGISTER, so a recording tool gates a record link at the call as verify.mjs gates the
|
|
899
900
|
// saved file (record-origins.mjs). Handed over explicitly: Codex gives a server only its own `env` and
|
|
900
901
|
// the names it forwards, so a value left to inheritance reaches a Claude server and never a Codex one.
|
|
901
|
-
|
|
902
|
+
// The run's recorded register (engine/run-choices.mjs), which each tool server reads as its own; the machine's, as
|
|
903
|
+
// before, for a run with no record.
|
|
904
|
+
const reg = register ?? process.env.CLEAROTRON_DATABASE;
|
|
905
|
+
if (reg) e.CLEAROTRON_DATABASE = reg;
|
|
902
906
|
// — the ledger paths are RESOLVED HERE and handed to the child explicitly, not forwarded as raw
|
|
903
907
|
// env. Two reasons, and the second is the one that kept this rename parked for months:
|
|
904
908
|
// · the old line was `if (process.env[v]) e[v] = …`, and NO box sets those vars — prod, test and dev
|
|
@@ -948,7 +952,8 @@ export function withSendUntil(mcpConfigJson, sendUntilMs) {
|
|
|
948
952
|
return JSON.stringify(cfg);
|
|
949
953
|
}
|
|
950
954
|
|
|
951
|
-
export function buildGatherMcpConfig(groups = [], { sessionKey, agent, runDir, recordAxis, bandGroups = false, correctionPositions = null
|
|
955
|
+
export function buildGatherMcpConfig(groups = [], { sessionKey, agent, runDir, recordAxis, bandGroups = false, correctionPositions = null,
|
|
956
|
+
register = recordedRegister(runDir) } = {}) {
|
|
952
957
|
const localKeys = new Set(), bridgeKeys = new Set();
|
|
953
958
|
for (const g of groups) { const r = resolveGroup(g); r.local.forEach((k) => localKeys.add(k)); r.bridges.forEach((k) => bridgeKeys.add(k)); }
|
|
954
959
|
const mcpServers = {};
|
|
@@ -972,14 +977,14 @@ export function buildGatherMcpConfig(groups = [], { sessionKey, agent, runDir, r
|
|
|
972
977
|
// is the more fundamental refusal and the one an operator acts on, so it must still come out ahead of
|
|
973
978
|
// this one — a box with neither a provider nor a run should be told about the provider.
|
|
974
979
|
if (localKeys.has("register")) {
|
|
975
|
-
localEntry("register");
|
|
980
|
+
localEntry("register", register);
|
|
976
981
|
if (!runDir) {
|
|
977
982
|
throw new Error("gather-config: a register server needs the run it is fetching for — record bodies "
|
|
978
983
|
+ "belong to their run, and the box-global ledger is retired. Pass runDir.");
|
|
979
984
|
}
|
|
980
985
|
}
|
|
981
|
-
const env = serverEnv({ sessionKey, agent, runDir, recordAxis, bandGroups, correctionPositions });
|
|
982
|
-
for (const k of localKeys) mcpServers[k] = { command: NODE, args: [join(MCP_DIR, localEntry(k).script)], env };
|
|
986
|
+
const env = serverEnv({ sessionKey, agent, runDir, recordAxis, bandGroups, correctionPositions, register });
|
|
987
|
+
for (const k of localKeys) mcpServers[k] = { command: NODE, args: [join(MCP_DIR, localEntry(k, register).script), ...(localEntry(k, register).args ?? [])], env };
|
|
983
988
|
// A FIXTURE RUN NEVER REACHES A LIVE REGISTER, and its job says so: the same key serves its canned answers.
|
|
984
989
|
if (localKeys.has("register") && runDir && fixtureRecordsDir(runDir)) mcpServers.register.args = [join(MCP_DIR, "fixture-register-server.mjs")];
|
|
985
990
|
// — THE BRIDGES GET THE AUDIT ENV, AND ONLY THAT. Until now they were spawned with no env at
|
|
@@ -1518,7 +1523,7 @@ export const RECORDING_STAGES_KEEPING_RETRIEVAL = Object.freeze(
|
|
|
1518
1523
|
Object.keys(RECORDING).filter((k) => RECORDING[k].keepsRetrieval === true).sort(),
|
|
1519
1524
|
);
|
|
1520
1525
|
|
|
1521
|
-
export function allowedToolsFor(groups = []) {
|
|
1526
|
+
export function allowedToolsFor(groups = [], { register = null } = {}) {
|
|
1522
1527
|
// — THE SEED IS NO LONGER UNCONDITIONAL. `Read` always; `Write`/`Edit` only where some group's seat
|
|
1523
1528
|
// still authors a file. A recording row that declares `seatWrites: false` has its artifact written by the
|
|
1524
1529
|
// driver, so the hand-write tools are a superseded path left executable — and this is the seeding that
|
|
@@ -1535,7 +1540,7 @@ export function allowedToolsFor(groups = []) {
|
|
|
1535
1540
|
const tools = seatWritesForGroups(groups) ? new Set(["Read", "Write", "Edit"]) : new Set(["Read"]);
|
|
1536
1541
|
for (const g of groups) {
|
|
1537
1542
|
const r = resolveGroup(g);
|
|
1538
|
-
for (const k of r.local) (r.only ?? localEntry(k).tools).forEach((t) => tools.add(`mcp__${k}__${t}`));
|
|
1543
|
+
for (const k of r.local) (r.only ?? localEntry(k, register).tools).forEach((t) => tools.add(`mcp__${k}__${t}`));
|
|
1539
1544
|
for (const k of r.bridges) tools.add(`mcp__${k}__*`); // whole bridge server (its tools are namespaced)
|
|
1540
1545
|
r.extra.forEach((t) => tools.add(t));
|
|
1541
1546
|
}
|
|
@@ -28,7 +28,7 @@ export function gridProvenancePath(outputPath) {
|
|
|
28
28
|
*/
|
|
29
29
|
export function gridProvenanceRecord({ ran, present, requested, model = null }) {
|
|
30
30
|
return {
|
|
31
|
-
_what: "
|
|
31
|
+
_what: "which provider served common-law-grid.json, written beside it because the ledger itself is saved verbatim.",
|
|
32
32
|
provider: "perplexity",
|
|
33
33
|
surface: "agent API, sandbox tool",
|
|
34
34
|
tool: "perplexity_research",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
// close asks it once more (execute-plan.mjs, timedOutBefore). An answer in a slice the run took out of its band
|
|
19
19
|
// because a check could not prove it ran is asked again too, whatever wrote the band since.
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { readdirSync, statSync } from "node:fs";
|
|
22
22
|
import { join } from "node:path";
|
|
23
|
-
import {
|
|
23
|
+
import { paths, readJson } from "../../run-record.mjs";
|
|
24
24
|
import { OUTSTANDING_REASON } from "../../../providers/_shared/follow-up-searches.mjs";
|
|
25
25
|
import { awaitsReadingTurn } from "../../../providers/_shared/plan-guards.mjs";
|
|
26
26
|
import { releasedFamilyQids } from "../../withheld-families.mjs";
|
|
@@ -57,7 +57,7 @@ function readBlocks(path) {
|
|
|
57
57
|
if (hit && hit.stamp === stamp) return hit.blocks;
|
|
58
58
|
let blocks = [];
|
|
59
59
|
try {
|
|
60
|
-
const j =
|
|
60
|
+
const j = readJson(path);
|
|
61
61
|
blocks = (Array.isArray(j) ? j : []).filter((b) => b?.qid).map((b) => ({
|
|
62
62
|
qid: b.qid, state: b.state ?? null, error: b.error === true, total_hits: b.total_hits ?? null,
|
|
63
63
|
count: b.count ?? (Array.isArray(b.records) ? b.records.length : null),
|
|
@@ -97,7 +97,7 @@ function readRunQuestions(runDir) {
|
|
|
97
97
|
const units = join(runDir, "register-units");
|
|
98
98
|
const blocksByQid = new Map();
|
|
99
99
|
const plans = [];
|
|
100
|
-
try { plans.push({ axis: null, plan:
|
|
100
|
+
try { plans.push({ axis: null, plan: readJson(paths(runDir).registerPlan) }); } catch { /* no frozen plan */ }
|
|
101
101
|
let files = [];
|
|
102
102
|
try { files = readdirSync(units); } catch { files = []; }
|
|
103
103
|
const takenOut = slicesTakenOutByAxis(runDir);
|
|
@@ -107,7 +107,7 @@ function readRunQuestions(runDir) {
|
|
|
107
107
|
for (const b of blocks) if (b?.qid) blocksByQid.set(String(b.qid), b);
|
|
108
108
|
}
|
|
109
109
|
if (f.endsWith("-supplemental-plan.json")) {
|
|
110
|
-
try { plans.push({ axis: f.slice(0, -"-supplemental-plan.json".length), plan:
|
|
110
|
+
try { plans.push({ axis: f.slice(0, -"-supplemental-plan.json".length), plan: readJson(join(units, f)) }); } catch { /* torn: skipped */ }
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
return { plans, blocksByQid };
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// spec.output_path itself (never round-trips the grid through the model's bounded turn output).
|
|
8
8
|
import { existsSync, readFileSync, writeFileSync, mkdirSync, appendFileSync } from "node:fs";
|
|
9
9
|
import { dirname, basename } from "node:path";
|
|
10
|
-
import { driverDir } from "
|
|
10
|
+
import { driverDir, paths, readJson } from "../../run-record.mjs"; //
|
|
11
11
|
import { underStudioSegment } from "../../../shared/path-seps.mjs"; // Windows builds the path with "\"
|
|
12
12
|
import { serve } from "./stdio-server.mjs";
|
|
13
13
|
import { answerBudget } from "../../../shared/answer-parts.mjs";
|
|
@@ -30,7 +30,7 @@ import { parsePrRiskResults, connotationObligations, renderConnotationObligation
|
|
|
30
30
|
import { obligationsSidecarPath } from "../../disposition-tool.mjs";
|
|
31
31
|
import { writeGridProvenance } from "./grid-provenance.mjs"; // — what served the grid, beside the ledger
|
|
32
32
|
import { insideRun } from "../../../shared/inside-run.mjs"; // a path a tool is handed is served only inside this run
|
|
33
|
-
import { keepResearchAnswer, isResearchAnswer, replayAnswersFrom, researchReplayOn, savedResearchAnswer } from "../../research-answers.mjs"; // each answer's text, kept for a later attempt of its stage; a replay answers from them
|
|
33
|
+
import { keepResearchAnswer, isResearchAnswer, replayAnswersFrom, researchReplayOn, savedResearchAnswer, researchRequestKey, heldAnswerToRequest } from "../../research-answers.mjs"; // each answer's text, kept for a later attempt of its stage, which is answered from it; a replay answers from them
|
|
34
34
|
|
|
35
35
|
const API_KEY = process.env.PERPLEXITY_API_KEY || "";
|
|
36
36
|
|
|
@@ -68,7 +68,7 @@ const AGENT = process.env.CLEAROTRON_GATHER_AGENT || "";
|
|
|
68
68
|
function logCall(tool, args, result) {
|
|
69
69
|
if (!RUN_DIR) return;
|
|
70
70
|
try {
|
|
71
|
-
const p =
|
|
71
|
+
const p = paths(RUN_DIR).readingLog;
|
|
72
72
|
mkdirSync(dirname(p), { recursive: true });
|
|
73
73
|
appendFileSync(p, JSON.stringify({
|
|
74
74
|
ts: new Date().toISOString(), tool, args, ...result,
|
|
@@ -85,7 +85,7 @@ function logCall(tool, args, result) {
|
|
|
85
85
|
const PINNED_QUESTION_PRESET = (() => {
|
|
86
86
|
if (!RUN_DIR) return null;
|
|
87
87
|
try {
|
|
88
|
-
const p =
|
|
88
|
+
const p = readJson(paths(RUN_DIR).searchPolicy)?.web?.questionPreset;
|
|
89
89
|
return typeof p === "string" && isKnownPreset(p) ? p : null;
|
|
90
90
|
} catch { return null; }
|
|
91
91
|
})();
|
|
@@ -238,7 +238,7 @@ async function research(params) {
|
|
|
238
238
|
if (RUN_DIR && !insideRun(RUN_DIR, grid_spec_path))
|
|
239
239
|
return "ERROR: grid_spec_path is outside this run's folder. The driver writes the spec inside the run; use the path it gave you.";
|
|
240
240
|
let spec;
|
|
241
|
-
try { spec = validateGridSpec(
|
|
241
|
+
try { spec = validateGridSpec(readJson(grid_spec_path)); }
|
|
242
242
|
catch (err) { return `ERROR: grid_spec_path unreadable/invalid (${err.message}). The driver writes this file; do not hand-author it.`; }
|
|
243
243
|
if (RUN_DIR && !insideRun(RUN_DIR, spec.output_path))
|
|
244
244
|
return requiredLedgerRefusal("ERROR: the grid spec's output_path is outside this run's folder. The driver writes the spec inside the run; use the path it gave you.", { spec, gridSpecPath: grid_spec_path });
|
|
@@ -307,8 +307,17 @@ async function research(params) {
|
|
|
307
307
|
// setting decided it rather than the question.
|
|
308
308
|
const asked = { task, depth: depth ?? null, preset, ...(PINNED_QUESTION_PRESET ? { pinned: true } : {}), allow_fetch, enable_sandbox,
|
|
309
309
|
...(domain_filter ? { domain_filter } : {}), ...(modelOverride ? { model: modelOverride } : {}) };
|
|
310
|
+
const body = buildRequestBody({ task, preset, allowFetch: allow_fetch, domainFilter: domain_filter, modelOverride, enableSandbox: enable_sandbox, responseSchema: response_schema, schemaName: schema_name });
|
|
311
|
+
// A QUESTION THIS STAGE ALREADY GOT AN ANSWER TO IS NOT SENT AGAIN (research-answers.mjs): the same request, from
|
|
312
|
+
// this stage or a retry of it, answered by what the run kept. It is logged as a lookup is, marked as reused, so the
|
|
313
|
+
// run's record says which questions were paid for on this pass.
|
|
314
|
+
const request = researchRequestKey(body);
|
|
315
|
+
const held = heldAnswerToRequest(RUN_DIR, SESSION, request);
|
|
316
|
+
if (held) {
|
|
317
|
+
logCall("perplexity_research", asked, { ok: true, bytes: held.text.length, reused: true });
|
|
318
|
+
return held.text;
|
|
319
|
+
}
|
|
310
320
|
try {
|
|
311
|
-
const body = buildRequestBody({ task, preset, allowFetch: allow_fetch, domainFilter: domain_filter, modelOverride, enableSandbox: enable_sandbox, responseSchema: response_schema, schemaName: schema_name });
|
|
312
321
|
const data = await callAgentAPI(API_KEY, body);
|
|
313
322
|
keepRaw("question", { task, preset }, data);
|
|
314
323
|
const text = enable_sandbox ? formatSandboxResponse(data, preset) : formatResponse(data, preset);
|
|
@@ -317,7 +326,7 @@ async function research(params) {
|
|
|
317
326
|
logCall("perplexity_research", asked, isResearchAnswer(text)
|
|
318
327
|
? { ok: true, bytes: String(text ?? "").length, citations: citationCount(data) }
|
|
319
328
|
: { ok: false, error: String(text ?? "").slice(0, 200) });
|
|
320
|
-
keepResearchAnswer(RUN_DIR, { session: SESSION, agent: AGENT, task, preset, text });
|
|
329
|
+
keepResearchAnswer(RUN_DIR, { session: SESSION, agent: AGENT, task, preset, request, text });
|
|
321
330
|
return text;
|
|
322
331
|
} catch (err) {
|
|
323
332
|
// A FAILED LOOKUP IS LOGGED TOO, and that is the half that matters most: without it, "the search
|
|
@@ -58,7 +58,7 @@ import { recordClosures } from "../../doubt-closure-tool.mjs";
|
|
|
58
58
|
import { MAX_CLOSURES_PER_CALL, CLOSURE_KINDS } from "../../doubt-closure-call.mjs";
|
|
59
59
|
import { readFileSync, existsSync } from "node:fs"; import { FROZEN_METHOD_FILE } from "../../framework-method.mjs";
|
|
60
60
|
import { join } from "node:path";
|
|
61
|
-
import { driverDir } from "
|
|
61
|
+
import { driverDir, readJson } from "../../run-record.mjs"; //
|
|
62
62
|
import { VARIANT_CATEGORIES } from "../../variant-manifest-model.mjs";
|
|
63
63
|
import { DIFF_LAYERS, DIFF_SEVERITIES } from "../../frame-diff-model.mjs";
|
|
64
64
|
import { REGISTER_AXES } from "../../coverage-ledger.mjs";
|
|
@@ -207,7 +207,7 @@ const CLOSURE_SPEC = "doubt-closure-spec.json";
|
|
|
207
207
|
* file disagreeing is the whole failure this transport exists to remove.
|
|
208
208
|
*/
|
|
209
209
|
function loadClosureSpec(runDir) {
|
|
210
|
-
const spec =
|
|
210
|
+
const spec = readJson(driverDir(runDir, CLOSURE_SPEC));
|
|
211
211
|
const allowedFiles = Array.isArray(spec?.allowedFiles) ? spec.allowedFiles : [];
|
|
212
212
|
const fileTexts = {};
|
|
213
213
|
for (const name of allowedFiles) {
|
|
@@ -1022,7 +1022,8 @@ serve({
|
|
|
1022
1022
|
kind: { type: "string", enum: [...CORRECTION_KINDS], description: "Which kind of defect this is. You declare it from your own read; code only partitions the closed set, never a keyword grep over your prose." },
|
|
1023
1023
|
text: { type: "string", description: "One line, naming the file and the exact claim. A flag that opens as a list item or heading is refused — the driver renders the list." },
|
|
1024
1024
|
fix: { type: "string", description: "Optional. One line describing the targeted edit that would settle it." },
|
|
1025
|
-
on: { type: "array", items: { type: "integer" }, description: "The finding ordinals this flag is about, 1-based. Omit for a flag about the document rather than a finding." },
|
|
1025
|
+
on: { type: "array", items: { type: "integer" }, description: "The finding ordinals this flag is about, 1-based. Omit for a flag about the document rather than a finding. An ordinal that names no finding this review was handed is refused." },
|
|
1026
|
+
lines: { type: "array", items: { type: "string" }, description: "The address of each part of the report this flag is about that is not a finding: a coverage line, an action, a mark assessment read or a narrative section. Copy each address from the address list in the dispatch. An address not on that list is refused. If none of the flag's targets has a listed address, omit `lines` and name the targets in `text`." },
|
|
1026
1027
|
positions: { type: "array", items: { type: "string" }, description: "The record id of each excluded position this flag is about, exactly as the writer's exclusions list names it. A flag about an exclusion needs no finding ordinal." },
|
|
1027
1028
|
},
|
|
1028
1029
|
},
|
|
@@ -1258,7 +1259,7 @@ serve({
|
|
|
1258
1259
|
registerEstimate: { type: "string" },
|
|
1259
1260
|
parodyNote: { type: ["string", "null"] },
|
|
1260
1261
|
crowdedField: { type: "boolean" },
|
|
1261
|
-
purpleNotes: { type: "array", items: { type: "string" }, description: "
|
|
1262
|
+
purpleNotes: { type: "array", items: { type: "string" }, description: "The report never prints a note; it reaches the audit workbook and the assistant." },
|
|
1262
1263
|
// — DECLARED HERE OR IT IS FOLKLORE.
|
|
1263
1264
|
//
|
|
1264
1265
|
// Both fields were built end to end for — instructed in the dispatch,
|
|
@@ -1445,8 +1446,8 @@ serve({
|
|
|
1445
1446
|
schemaNow: (schema) => knockoutAssessSchemaFor(schema, process.env.CLEAROTRON_BAND_RUN_DIR),
|
|
1446
1447
|
description:
|
|
1447
1448
|
"Hand back your repair of the defects you were given, as VALUES, sending only what changes. The driver merges it onto " +
|
|
1448
|
-
"the chunk it holds and checks the result as it checks a rated chunk. It refuses a change to a name no defect concerns, " +
|
|
1449
|
-
"a moved finding no answer accounts for, and a rating that moves without its dependent answers. A repair turn may send " +
|
|
1449
|
+
"the chunk it holds and checks the result as it checks a rated chunk. It refuses a change to a name no defect concerns, except a finding a defect names that also stands on that name. " +
|
|
1450
|
+
"It refuses a moved finding no answer accounts for, and a rating that moves without its dependent answers. A repair turn may send " +
|
|
1450
1451
|
"only what it corrects, and what it has repaired is kept.",
|
|
1451
1452
|
inputSchema: {
|
|
1452
1453
|
type: "object",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
4
|
+
// register-server.mjs — the one MCP server for every trademark register, mounting the provider it is named.
|
|
5
|
+
//
|
|
6
|
+
// node register-server.mjs <provider>
|
|
7
|
+
//
|
|
8
|
+
// A provider states its tools in `providers/<provider>/src/mount.js`: their names, descriptions, schemas and
|
|
9
|
+
// handlers. What every register shares stays here and reaches the mount as arguments, so a provider folder
|
|
10
|
+
// imports nothing from the driver. gather-config names the provider on the command line, from the same row
|
|
11
|
+
// that says which tools a stage is granted.
|
|
12
|
+
import { dirname, join } from "node:path";
|
|
13
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
14
|
+
import { serve } from "./stdio-server.mjs";
|
|
15
|
+
import { crowdNoteFor } from "./crowd-note.mjs"; // how the unit decides on a crowd, beside an answer that carries one
|
|
16
|
+
import { proposeSupplemental } from "./supplemental.mjs";
|
|
17
|
+
import { narrowingFields } from "./proposal-fields.mjs";
|
|
18
|
+
import { CLARIVATE_PROPOSE_TOOL } from "./clarivate-propose-tool.mjs";
|
|
19
|
+
|
|
20
|
+
const provider = process.argv[2] ?? "";
|
|
21
|
+
if (!/^[a-z][a-z-]*$/.test(provider)) {
|
|
22
|
+
process.stderr.write(`[mcp:register] needs a provider name as its argument, and was given ${JSON.stringify(provider)}\n`);
|
|
23
|
+
process.exit(2);
|
|
24
|
+
}
|
|
25
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const { mount } = await import(pathToFileURL(join(here, "..", "..", "..", "providers", provider, "src", "mount.js")).href);
|
|
27
|
+
const { version, tools } = mount({ proposeSupplemental, narrowingFields, CLARIVATE_PROPOSE_TOOL });
|
|
28
|
+
|
|
29
|
+
serve({ name: "register", version, noteFor: crowdNoteFor, tools });
|
|
@@ -11,7 +11,7 @@ import "./http-dispatcher.mjs"; // side effect: raise undici headersTimeout fo
|
|
|
11
11
|
import { createInterface } from "node:readline";
|
|
12
12
|
import { appendFileSync, mkdirSync } from "node:fs";
|
|
13
13
|
import { dirname } from "node:path";
|
|
14
|
-
import {
|
|
14
|
+
import { paths } from "../../run-record.mjs"; //
|
|
15
15
|
import { answerBudget, answerPieces, servedPart, partNotHeld, takePart, heldAnswers, withAnswerPart } from "../../../shared/answer-parts.mjs";
|
|
16
16
|
|
|
17
17
|
// ── half 2 — THE TOOL CALL LOG, so a killed call is a FACT and not an inference ────────────────
|
|
@@ -38,7 +38,7 @@ import { answerBudget, answerPieces, servedPart, partNotHeld, takePart, heldAnsw
|
|
|
38
38
|
// failed write costs this diagnostic and nothing else.
|
|
39
39
|
const toolLogPath = () => {
|
|
40
40
|
const dir = process.env.CLEAROTRON_BAND_RUN_DIR;
|
|
41
|
-
return dir ?
|
|
41
|
+
return dir ? paths(dir).toolCalls : null;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
// WHAT GOES IN: the tool's name, the sequence number that pairs the two lines, and — for the plan tools
|
|
@@ -106,9 +106,9 @@ export function serve({ name, version = "0.1.0", tools = [], noteFor = null }) {
|
|
|
106
106
|
// reaches the open world. A stock server carries them on every tool; ours carried none.
|
|
107
107
|
//
|
|
108
108
|
// ✕ THIS IS NOT THE ESTABLISHED CAUSE OF THE CODEX REFUSALS, and nothing here may be read as one. The
|
|
109
|
-
// universal claim — "codex cannot call any MCP tool" — was WITHDRAWN
|
|
110
|
-
//
|
|
111
|
-
//
|
|
109
|
+
// universal claim — "codex cannot call any MCP tool" — was WITHDRAWN by those who made it: real
|
|
110
|
+
// codex completed 1,292 MCP calls across three pre-rebuild runs. What differs after the 2026-08-24
|
|
111
|
+
// rebuild is still open. The probe below is ONE measurement on ONE CLI
|
|
112
112
|
// version, recorded so nobody re-derives it. It is a candidate, not a finding, and this fix does not
|
|
113
113
|
// rest on it.
|
|
114
114
|
//
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
// widening need none. The reading step decides now; every proposal is minted or refused on its own
|
|
27
27
|
// merits. `mintSupplementalEntries` still takes a cap from a caller that sets one, and none does.
|
|
28
28
|
//
|
|
29
|
-
// Pure orchestration with injected IO/executor (deps) so it tests offline; the corsearch
|
|
29
|
+
// Pure orchestration with injected IO/executor (deps) so it tests offline; the corsearch mount's handler
|
|
30
30
|
// binds the live doExecutePlan.
|
|
31
31
|
|
|
32
|
-
import {
|
|
32
|
+
import { writeFileSync, renameSync, existsSync, mkdirSync } from "node:fs";
|
|
33
33
|
import { dirname, join } from "node:path";
|
|
34
|
-
import {
|
|
34
|
+
import { paths, readJson } from "../../run-record.mjs"; //
|
|
35
35
|
import { PLAN_PREDICATES, PLAN_MAX_OR_WIDTH, PLAN_MAX_NAME_LENGTH, planExactOrWidth, planPhoneticOrWidth, fingerprint, exactOperatorEntries, ownerIntersectionGap, goodsTextGap, resolveRegions, houseElementOf, withoutHouseElementTerms, containsFormSubstitution } from "../../register-plan.mjs";
|
|
36
36
|
import { entryTermIssues } from "../../../providers/_shared/term-shape.mjs";
|
|
37
37
|
import { OUTSTANDING_REASON, runDriverDirOf } from "../../../providers/_shared/follow-up-searches.mjs";
|
|
@@ -416,7 +416,7 @@ export async function proposeSupplemental(params, tctx, deps) {
|
|
|
416
416
|
// unchanged.
|
|
417
417
|
let planRegions = [], planClasses = [], house = null, bound = { addedClasses: [], addedClassQuestions: [] }, scriptMarkets = null, scriptQuestionsAsked = [];
|
|
418
418
|
try {
|
|
419
|
-
const frozen =
|
|
419
|
+
const frozen = readJson(paths(dirname(dirname(outPath))).registerPlan);
|
|
420
420
|
house = houseElementOf(frozen);
|
|
421
421
|
bound = addedClassBound(frozen);
|
|
422
422
|
if (Array.isArray(frozen?.script_markets)) { scriptMarkets = frozen.script_markets; scriptQuestionsAsked = Array.isArray(frozen?.script_questions_asked) ? frozen.script_questions_asked : []; }
|
|
@@ -429,7 +429,7 @@ export async function proposeSupplemental(params, tctx, deps) {
|
|
|
429
429
|
let supp = { schema: "register-plan/1", plan_version: 1, derived_from: { job_key: `supplemental:${axis}`, variants_fingerprint: "supplemental" }, regions: planRegions, entries: [] };
|
|
430
430
|
if (existsSync(suppPath)) {
|
|
431
431
|
try {
|
|
432
|
-
const prior =
|
|
432
|
+
const prior = readJson(suppPath);
|
|
433
433
|
if (prior && Array.isArray(prior.entries)) supp = { ...prior, regions: (Array.isArray(prior.regions) && prior.regions.length) ? prior.regions : planRegions };
|
|
434
434
|
} catch { /* a torn supplemental file is rebuilt — minted qids are deterministic, nothing is lost */ }
|
|
435
435
|
}
|
|
@@ -558,7 +558,7 @@ export async function proposeSupplemental(params, tctx, deps) {
|
|
|
558
558
|
// inheritance above — the executor reads suppPath FROM DISK, so an in-memory-only backfill would
|
|
559
559
|
// leave a reused-qid re-execution running region-less again.
|
|
560
560
|
const staleOnDisk = existsSync(suppPath) && planRegions.length && !(() => {
|
|
561
|
-
try { const d =
|
|
561
|
+
try { const d = readJson(suppPath); return Array.isArray(d?.regions) && d.regions.length; }
|
|
562
562
|
catch { return false; }
|
|
563
563
|
})();
|
|
564
564
|
// PR-6 (C1 — persist what evaporates): rejections used to live ONLY in this tool's response text.
|
|
@@ -586,7 +586,7 @@ export async function proposeSupplemental(params, tctx, deps) {
|
|
|
586
586
|
let reusedHeld = [];
|
|
587
587
|
try {
|
|
588
588
|
const own = new Map();
|
|
589
|
-
const { blocks } = bandWithSlicesOut(
|
|
589
|
+
const { blocks } = bandWithSlicesOut(readJson(outPath), slicesTakenOutByAxis(dirname(dirname(outPath))).get(axis));
|
|
590
590
|
for (const b of blocks) if (b?.qid) own.set(String(b.qid), b);
|
|
591
591
|
reusedHeld = reused.filter((q) => { const b = own.get(String(q)); return b && b.error !== true && !enrichedQids.includes(q) && !staleOnDisk; });
|
|
592
592
|
} catch { reusedHeld = []; }
|
|
@@ -610,7 +610,7 @@ export async function proposeSupplemental(params, tctx, deps) {
|
|
|
610
610
|
const refusedHere = outstanding.filter((q) => mintedHere.has(q));
|
|
611
611
|
if (refusedHere.length) {
|
|
612
612
|
let cur = supp;
|
|
613
|
-
try { cur =
|
|
613
|
+
try { cur = readJson(suppPath); } catch { /* the in-memory plan is what was written */ }
|
|
614
614
|
const gone = new Set(refusedHere);
|
|
615
615
|
cur = withRejected({ ...cur, entries: (Array.isArray(cur?.entries) ? cur.entries : []).filter((e) => !gone.has(e?.qid)) },
|
|
616
616
|
// The markets and goods ride on the row: the ask ledger keeps one ask per (issue, proposal), and the compact
|
|
@@ -627,7 +627,7 @@ export async function proposeSupplemental(params, tctx, deps) {
|
|
|
627
627
|
// read the results BACK FROM THE BAND — the reasoning payload is never model-transcribed
|
|
628
628
|
const results = {};
|
|
629
629
|
try {
|
|
630
|
-
const band =
|
|
630
|
+
const band = readJson(outPath);
|
|
631
631
|
const blocks = Array.isArray(band) ? band : [];
|
|
632
632
|
for (const b of blocks) {
|
|
633
633
|
if (!b || typeof b !== "object" || !b.qid || !(qids.includes(b.qid) || reusedHeld.includes(b.qid))) continue;
|
|
@@ -911,6 +911,9 @@ function errResult(t0, e, resumeRef) {
|
|
|
911
911
|
|
|
912
912
|
export const openaiAgentEngine = {
|
|
913
913
|
name: "openai-agent",
|
|
914
|
+
// A home that lasts for one stage, so its repair turns can resume the session. An engine with no such need omits both.
|
|
915
|
+
makeStageHome: (stage) => makeCodexHome(`stage-${String(stage).replace(/[^a-z0-9-]/gi, "_")}-`),
|
|
916
|
+
releaseStageHome: releaseCodexHome,
|
|
914
917
|
// — WHAT THIS ENGINE GUARANTEES ABOUT SEAT WRITES: NOTHING, and the record now says so.
|
|
915
918
|
// The boundary is a `claude -p` PreToolUse hook and codex has no PreToolUse — an absence by
|
|
916
919
|
// construction, not a misconfiguration. The stage's permission profile grants the whole run folder,
|
|
@@ -926,7 +929,7 @@ export const openaiAgentEngine = {
|
|
|
926
929
|
// Honest provenance for the telemetry stamp: on an openai run, `modelUsed` must be the GPT id, NOT the
|
|
927
930
|
// anthropic-catalog resolution. Non-throwing (unknown → the input) so a stray alias never breaks logging.
|
|
928
931
|
resolveModelId(model) { try { return openaiModel(model) ?? model; } catch { return model; } },
|
|
929
|
-
// — `
|
|
932
|
+
// — `stageHome` is the CALLER'S if it passes one, and the caller then owns its lifetime.
|
|
930
933
|
//
|
|
931
934
|
// codex stores sessions under $CODEX_HOME/sessions/ and resolves `resume <id>` against them. Creating
|
|
932
935
|
// and deleting a home per TURN meant every warm resume pointed at a directory that had never heard of
|
|
@@ -934,7 +937,7 @@ export const openaiAgentEngine = {
|
|
|
934
937
|
// `thread/resume failed: no rollout found for thread id ... (code -32600)`, exit 1 — with the control
|
|
935
938
|
// (same id, same binary, its own home) resuming cleanly. So every warm-patch retry and every
|
|
936
939
|
// form-repair sub-turn on the codex arm has been failing.
|
|
937
|
-
async runTurn({ message, model, thinking, timeoutSec, resumeRef, mcpConfig, allowedTools, cwd, skillsDir, skillsGrantRoots, profilesDir, resolveSkill, runDir, stallSec,
|
|
940
|
+
async runTurn({ message, model, thinking, timeoutSec, resumeRef, mcpConfig, allowedTools, cwd, skillsDir, skillsGrantRoots, profilesDir, resolveSkill, runDir, stallSec, stageHome: providedHome, streamFile = null } = {}) {
|
|
938
941
|
if (!message) throw new Error("openai-agent.runTurn: message is required");
|
|
939
942
|
const t0 = Date.now();
|
|
940
943
|
let codexHome;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
3
|
+
// registry.mjs — which engine adapters this driver ships, and which one this activation runs.
|
|
4
|
+
//
|
|
5
|
+
// The gateway asks this module and names no engine itself, so an engine is added here and in its own
|
|
6
|
+
// adapter, and the stage ladder does not change.
|
|
7
|
+
|
|
8
|
+
import { resolveModel } from "../driver.config.mjs";
|
|
9
|
+
import { anthropicAgentEngine } from "./anthropic-agent.mjs";
|
|
10
|
+
import { openaiAgentEngine } from "./openai-agent.mjs";
|
|
11
|
+
import { RUN_CHOICES_FILE, readRunChoices } from "./run-choices.mjs";
|
|
12
|
+
|
|
13
|
+
// ── Engine seam (CLEAROTRON_AI) ──────────────────────────────────────────────────────────────────
|
|
14
|
+
// The 14 stages run on the anthropic-agent engine (`claude -p` off-gateway with the stall-watchdog; see
|
|
15
|
+
// engine/CONTRACT.md). Its runTurn() returns the normalized tuple runStage consumes
|
|
16
|
+
// ({code,killed,wall,stdout,stderr,laneWaitMs,json,usage,sessionRef,signals}); all the
|
|
17
|
+
// classification/retry/warm logic below is engine-agnostic. There is no second exec path beside it —
|
|
18
|
+
// the comms one-shots that used to have one now write outbox packets and spawn nothing.
|
|
19
|
+
//
|
|
20
|
+
// Engine registry (provider adapters). The driver orchestration + the classification/retry/warm ladder are
|
|
21
|
+
// ENGINE-AGNOSTIC: everything provider-specific lives behind an engine's runTurn() → the normalized tuple. So
|
|
22
|
+
// provider CHOICE (e.g. Anthropic → OpenAI) = which adapter is registered and selected via CLEAROTRON_AI —
|
|
23
|
+
// NOT a model-name swap: each provider needs its own agentic-runtime adapter (MCP/tools/skills/streaming/resume).
|
|
24
|
+
// One is implemented today: `anthropic-agent` (`claude -p`, off-gateway). Adding e.g. `openai-agent` = write
|
|
25
|
+
// engine/openai-agent.mjs implementing the same runTurn() contract (engine/CONTRACT.md §1), registerEngine() it,
|
|
26
|
+
// and select it via CLEAROTRON_AI — runStage is untouched. (The legacy gateway-bin engine removed in the
|
|
27
|
+
// extraction was a *runtime*, not a provider choice, and coupled the driver to one integrator platform.) An
|
|
28
|
+
// unknown CLEAROTRON_AI fails loud — no silent wrong-provider run. There are no comms stages: every
|
|
29
|
+
// requester-facing event is an outbox packet (docs/DELIVERY.md).
|
|
30
|
+
const ENGINES = new Map([
|
|
31
|
+
[anthropicAgentEngine.name, anthropicAgentEngine],
|
|
32
|
+
[openaiAgentEngine.name, openaiAgentEngine], // second provider adapter (codex exec) — CLEAROTRON_AI=openai-agent
|
|
33
|
+
]);
|
|
34
|
+
export const DEFAULT_ENGINE = anthropicAgentEngine.name; // "anthropic-agent" — production default UNCHANGED
|
|
35
|
+
/**
|
|
36
|
+
* The ids this registry actually holds — read-only, so a SECOND list can be pinned against the first
|
|
37
|
+
* rather than drifting away from it in silence. `ENGINE_BINARIES` in driver.config names the
|
|
38
|
+
* binary variable per engine and the wizard builds its menu from it; without this, "the wizard offers
|
|
39
|
+
* an engine the driver does not ship" and "the driver ships an engine setup cannot reach" are both
|
|
40
|
+
* invisible until a reader picks the row that does not exist. Same guarantee the register-provider
|
|
41
|
+
* list already has (onboard-wizard.test.mjs, "a new adapter must not be invisible to setup").
|
|
42
|
+
*/
|
|
43
|
+
export function registeredEngines() { return [...ENGINES.keys()]; }
|
|
44
|
+
export function registerEngine(engine) {
|
|
45
|
+
if (!engine?.name || typeof engine.runTurn !== "function") throw new Error("registerEngine: expected an { name, runTurn } engine adapter");
|
|
46
|
+
ENGINES.set(engine.name.toLowerCase(), engine);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The machine's engine: the one a run STARTS on. PROCESS-WIDE, and the missing parameter is the point. A run
|
|
51
|
+
* that has started serves its turns from the engine it recorded then (`engineForRun` below, reading engine/run-choices.mjs), so
|
|
52
|
+
* a later change to `CLEAROTRON_AI` reaches new runs only.
|
|
53
|
+
*
|
|
54
|
+
* This took a `_stageName` it ignored, under a call-site comment reading "per-stage: CLEAROTRON_AI base,
|
|
55
|
+
* comms forced to the gateway, override-able". None of that existed: no per-stage override, no comms
|
|
56
|
+
* forcing, no per-job override. `CLEAROTRON_AI` is read from the process env at every activation and
|
|
57
|
+
* governs every stage of every job in it.
|
|
58
|
+
*
|
|
59
|
+
* A comment describing a capability that does not exist is worse than no comment — it gets believed and
|
|
60
|
+
* planned against, and the plan only fails once someone tries to use it. Corrected rather than built:
|
|
61
|
+
* per-stage selection is an architecture change (a job spec would have to carry the engine, and the
|
|
62
|
+
* routing would have to survive resume), not a comment fix.
|
|
63
|
+
*
|
|
64
|
+
* WHAT THE ABSENCE COSTS, stated so a round plan does not discover it mid-round: **an A/B cannot run
|
|
65
|
+
* both engines concurrently on one instance.** Comparing codex against anthropic means flipping
|
|
66
|
+
* CLEAROTRON_AI and running sequentially, or standing up a second instance with its own env, pool and
|
|
67
|
+
* ports. The same absence blocks routing the refutation reviewer to a different engine for family
|
|
68
|
+
* diversity (ENGINE-OPENAI-ADAPTER §6). Recorded in docs/E2E.md, which is where a round plan looks.
|
|
69
|
+
*/
|
|
70
|
+
/** The registered adapter for one engine name, or null: no fallback to the machine's engine. */
|
|
71
|
+
export function engineNamed(id) { return ENGINES.get(String(id ?? "").trim().toLowerCase()) ?? null; }
|
|
72
|
+
|
|
73
|
+
export function selectEngine() {
|
|
74
|
+
const id = (process.env.CLEAROTRON_AI || DEFAULT_ENGINE).toLowerCase();
|
|
75
|
+
const engine = ENGINES.get(id);
|
|
76
|
+
if (!engine) throw new Error(`CLEAROTRON_AI="${id}" is not a registered engine adapter (available: ${[...ENGINES.keys()].join(", ")}). Implement one and registerEngine() it — see engine/CONTRACT.md.`);
|
|
77
|
+
return engine;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The engine that serves this run's turns. A run with a record gets its recorded engine whatever the machine's
|
|
82
|
+
* setting now says; a run with none gets the machine's engine, as every run did before the record existed.
|
|
83
|
+
* A recorded engine this driver cannot serve, or a record that does not read back, throws by name: the run's
|
|
84
|
+
* turns never fall through to a different engine.
|
|
85
|
+
*/
|
|
86
|
+
export function engineForRun(runDir) {
|
|
87
|
+
const rec = readRunChoices(runDir);
|
|
88
|
+
if (rec.state === "none") return selectEngine();
|
|
89
|
+
if (rec.state === "unreadable")
|
|
90
|
+
throw new Error(`this run's engine record (_driver/${RUN_CHOICES_FILE}) ${rec.detail}, so its turns are not run on the machine's engine in its place`);
|
|
91
|
+
const engine = engineNamed(rec.engine);
|
|
92
|
+
if (!engine)
|
|
93
|
+
throw new Error(`this run started on the "${rec.engine}" engine, which this driver does not have registered (${registeredEngines().join(", ")}); it keeps that engine rather than switch to ${String(process.env.CLEAROTRON_AI ?? "").trim().toLowerCase() || DEFAULT_ENGINE}`);
|
|
94
|
+
return engine;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The model id a turn's rows record as asked for: the engine's own `resolveModelId`, or, for an adapter
|
|
99
|
+
* that declares none, Claude's catalog (`resolveModel`), which is what every such row has carried.
|
|
100
|
+
*/
|
|
101
|
+
export function modelIdOf(engine, model) {
|
|
102
|
+
return engine.resolveModelId ? engine.resolveModelId(model) : resolveModel(model);
|
|
103
|
+
}
|