clearotron 0.5.1-beta.2 → 0.6.0-beta.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/.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 +49 -18
- 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 +147 -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/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/compare.mjs +1 -1
- package/driver/config-inventory.mjs +6 -79
- package/driver/consumption-ledger.mjs +2 -1
- 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/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 +8 -37
- 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 +6 -6
- 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 +10 -6
- 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/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 +511 -9265
- 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 +78 -2592
- package/driver/portal-static.mjs +3 -1
- package/driver/predelivery-lint.mjs +92 -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 +3 -1
- 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 +5 -5
- 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 +31 -92
- 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 +8 -18
- 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 +88 -283
- 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 +922 -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 +831 -0
- package/driver/steps/synthesis.mjs +261 -0
- package/driver/steps/verdict-gate.mjs +968 -0
- package/driver/suite-census.json +403 -91
- 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/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 +1 -1
- 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/package.json +2 -1
- package/portal-ui/dist/assets/{index-fPqAU0sx.js → index-D5rkCjDc.js} +26 -14
- package/portal-ui/dist/index.html +1 -1
- 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/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 +1 -1
- 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/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/node_modules/exceljs/README.md +0 -3023
package/driver/driver.config.mjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { join, dirname, basename, isAbsolute, win32 } from "node:path";
|
|
11
11
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
12
|
-
import { readdirSync, existsSync, accessSync, statSync, statfsSync,
|
|
12
|
+
import { readdirSync, existsSync, accessSync, statSync, statfsSync, realpathSync, openSync, readSync, closeSync, constants as FS } from "node:fs";
|
|
13
13
|
import { homedir } from "node:os";
|
|
14
14
|
import { isWsl } from "../shared/wsl.mjs"; // — the one answer to "is this Linux under Windows", which decides the /mnt/<drive> skip
|
|
15
15
|
import { envFrom } from "../shared/env-aliases.mjs"; // — an operator-facing name is the one an operator sets, and it has to work where they set it; — envFrom is the resolver that reads every spelling of it
|
|
@@ -17,6 +17,13 @@ import { invoke } from "../shared/invocation.mjs"; // — name a command the r
|
|
|
17
17
|
import { sepClass, notSepClass, hasSep } from "../shared/path-seps.mjs"; // a Windows path is built with "\"
|
|
18
18
|
import { envFileRead } from "../shared/env-local.mjs"; // — WHICH file to set it in, measured; null for a service that read none
|
|
19
19
|
import { numericSetting, resolveNumericSetting } from "./numeric-setting.mjs"; import { STUDIO_SEGMENTS, STUDIO_SEGMENT_RE, studioSegmentFor } from "../shared/pre-rename-spellings.mjs"; export { STUDIO_SEGMENTS, STUDIO_SEGMENT_RE, studioSegmentFor }; // the studio segment an install keeps its runs under // — a number, or a refusal that names the variable; never NaN
|
|
20
|
+
import { adapter as corsearchAdapter } from "../providers/corsearch/src/adapter.js";
|
|
21
|
+
import { adapter as clarivateAdapter } from "../providers/clarivate/src/adapter.js";
|
|
22
|
+
import { adapter as signaAdapter } from "../providers/signa/src/adapter.js";
|
|
23
|
+
import { adapter as euipoAdapter } from "../providers/euipo/src/adapter.js";
|
|
24
|
+
import { adapter as usptoLocalAdapter } from "../providers/uspto-local/src/adapter.js";
|
|
25
|
+
import { adapter as freeTierAdapter } from "../providers/free-tier/src/adapter.js";
|
|
26
|
+
import { readJson } from "./run-record.mjs";
|
|
20
27
|
|
|
21
28
|
const { X_OK } = FS;
|
|
22
29
|
|
|
@@ -80,28 +87,6 @@ export const envOn = (name, env = process.env) => {
|
|
|
80
87
|
return v != null && v !== "" && !OFF_WORDS.has(String(v).trim().toLowerCase());
|
|
81
88
|
};
|
|
82
89
|
|
|
83
|
-
/** ONE reader for `CLEAROTRON_NATIVE_LANGUAGE_<CODE>`, and the reason it is not just `envGateOn` is the `env` argument.
|
|
84
|
-
*
|
|
85
|
-
* FAIL-OPEN BY DOCTRINE, not by preference: kill switches are retired, availability is BUILT-only, and
|
|
86
|
-
* the switches that remain fail open (search-policy.mjs states it — "`CLEAROTRON_NATIVE_LANGUAGE_<code>` is fail-OPEN
|
|
87
|
-
* by construction (`?? "1"` — on unless explicitly \"0\")"). A built lane arms unless somebody
|
|
88
|
-
* explicitly silenced it.
|
|
89
|
-
*
|
|
90
|
-
* — this exists because the flag had FOUR readers and one of them defaulted the other way.
|
|
91
|
-
* jx-units.mjs and jx.mjs each carried a private `laneEnvOn` (default ON) while the slice-statement
|
|
92
|
-
* path at jx.mjs:104/121 used the default-OFF `envOn`. With CLEAROTRON_NATIVE_LANGUAGE_ZH unset — which is its state
|
|
93
|
-
* on every box — the executor armed the lane, dispatched 42 SERP cells and got a provider quota
|
|
94
|
-
* refusal, while the delivered coverage statement said the lane was "off in this run's own
|
|
95
|
-
* environment". Same value, computed twice, two answers, and the false one is the one that rendered.
|
|
96
|
-
*
|
|
97
|
-
* Takes `env` because deriveJxSliceStatement is pure and threads one; `envGateOn` reads process.env
|
|
98
|
-
* directly and cannot serve a pure caller.
|
|
99
|
-
*/
|
|
100
|
-
export const laneArmed = (lane, env = process.env) => {
|
|
101
|
-
const v = env?.[`CLEAROTRON_NATIVE_LANGUAGE_${String(lane ?? "").toUpperCase()}`];
|
|
102
|
-
return v == null || v === "" || !OFF_WORDS.has(String(v).trim().toLowerCase());
|
|
103
|
-
};
|
|
104
|
-
|
|
105
90
|
/** Default-ON gate (`X=0` / `X=off` disables it). Unset or empty ⇒ true. */
|
|
106
91
|
export const envGateOn = (name) => {
|
|
107
92
|
const v = process.env[name];
|
|
@@ -541,10 +526,10 @@ export const config = {
|
|
|
541
526
|
//
|
|
542
527
|
// THE SINGLE-MEMBER ASSEMBLY STAYS, and item 8's instruction to delete it with the switch does not
|
|
543
528
|
// survive contact with the code. The flag was never the only thing that reached it: the split also
|
|
544
|
-
// self-disarms on a single-term grid (nothing to partition)
|
|
545
|
-
//
|
|
546
|
-
//
|
|
547
|
-
//
|
|
529
|
+
// self-disarms on a single-term grid (nothing to partition), a disclosed decision recorded on
|
|
530
|
+
// ctx.clSplitDecision with its own reason, and deleting the assembly would break it. (A resume of a
|
|
531
|
+
// pre-split run reached it too, until runs from an earlier build stopped being resumed.) What goes is
|
|
532
|
+
// the switch and the branch that read it.
|
|
548
533
|
|
|
549
534
|
// B2 — hard ceiling on a `.processing` claim's age, measured from the `.pid` sidecar's mtime (written
|
|
550
535
|
// fresh at every claim/takeover — NOT the marker's mtime, which rename(2) preserves from enqueue, so a
|
|
@@ -953,689 +938,13 @@ export const UNREACHABLE_SENIOR_POLICY = (process.env.CLEAROTRON_UNREACHABLE_SEN
|
|
|
953
938
|
// Omission is still CAUGHT rather than trusted: registry-fidelity's `fetchedWithoutRecord` compares the
|
|
954
939
|
// run's record set against the record_fetch rows in the (still global) call ledger, so bodies that went
|
|
955
940
|
// to the wrong address surface as a failure, not as a clean zero.
|
|
956
|
-
// The free tier's REQUIRED variables, in one place: the PROVIDERS adapters below and preflightCredentials
|
|
957
|
-
// must not drift apart on which ones matter.
|
|
958
|
-
//
|
|
959
|
-
// USPTO_LOCAL_DB left this list with and is deliberately not checked here. These guards front the
|
|
960
|
-
// driver-side record/count calls, and those route BY OFFICE — an EU record fetch on a box with no US
|
|
961
|
-
// index is a call the free tier can serve perfectly well, and refusing it because a variable the call
|
|
962
|
-
// never touches is unset would turn a disclosed US deferral into a run that also cannot cite its EU
|
|
963
|
-
// evidence. The US half's absence is stated once, at plan compile, as a deferred coverage row; a member
|
|
964
|
-
// that IS asked for and is not configured refuses inside its own core, naming its own variable.
|
|
965
|
-
function freeTierMissing(env = process.env) {
|
|
966
|
-
return ["EUIPO_CLIENT_ID", "EUIPO_CLIENT_SECRET"]
|
|
967
|
-
.filter((k) => !String(env[k] ?? "").trim());
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
// ── The record-listing shim ( part 5) ───────────────────────────────────────────────────────────
|
|
971
|
-
//
|
|
972
|
-
// Every provider core already answers a search with normalized rows, and every core's row vocabulary is
|
|
973
|
-
// the same flat corsearch-shaped one (`record_id`, `mark_text`, `owner_name`, `classes`, `status`) —
|
|
974
|
-
// euipo/row.js states that key naming IS the contract, and uspto-local follows it. So the driver-side
|
|
975
|
-
// listing needs no new core: it is doSearch, parsed, with the errors read the way every other kernel
|
|
976
|
-
// reads them.
|
|
977
|
-
//
|
|
978
|
-
// ONE COPY, because the five adapters below would otherwise carry five copies of the same parse and the
|
|
979
|
-
// same ERROR-prefix check, and a provider whose copy drifted would report a failed fetch as an empty
|
|
980
|
-
// list of filings — the exact "absence reads as a finding" defect this lane exists to avoid.
|
|
981
|
-
//
|
|
982
|
-
// THE URL IS BUILT HERE, not in the renderer, because it is provider knowledge: a row that already
|
|
983
|
-
// carries a resolved link keeps it, and otherwise the provider's own public origin is joined to the
|
|
984
|
-
// record ref. A provider with no public record URL yields null, and the surfaces print the reference
|
|
985
|
-
// without a link rather than inventing an address.
|
|
986
|
-
function recordsFromSearch(run, { origin = null } = {}) {
|
|
987
|
-
return async (params, tctx) => {
|
|
988
|
-
let r;
|
|
989
|
-
try { r = await run(params, tctx); }
|
|
990
|
-
catch (e) { return { ok: false, records: null, reason: `record listing threw: ${e.message}` }; }
|
|
991
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
992
|
-
if (r?.isError || text.startsWith("ERROR")) return { ok: false, records: null, reason: text.slice(0, 300) || "provider error" };
|
|
993
|
-
let parsed;
|
|
994
|
-
try { parsed = JSON.parse(text); }
|
|
995
|
-
catch { return { ok: false, records: null, reason: "unparseable search response on the record listing" }; }
|
|
996
|
-
if (!Array.isArray(parsed?.results))
|
|
997
|
-
return { ok: false, records: null, reason: "the search response carried no results[], so nothing was listed — which is not the same as no filings" };
|
|
998
|
-
const link = (row) => {
|
|
999
|
-
const resolved = row?.resolved_link ?? row?.record_url ?? null;
|
|
1000
|
-
if (typeof resolved === "string" && /^https?:\/\//i.test(resolved)) return resolved;
|
|
1001
|
-
const ref = row?.record_id;
|
|
1002
|
-
return (origin && typeof ref === "string" && ref.startsWith("/")) ? `${origin}${ref}` : null;
|
|
1003
|
-
};
|
|
1004
|
-
return {
|
|
1005
|
-
ok: true,
|
|
1006
|
-
records: parsed.results.map((row) => ({ ...row, record_url: link(row) })),
|
|
1007
|
-
// NULL, never the row count, when the body carried no integer. `fetched` under a null `total` is
|
|
1008
|
-
// an honest "we do not know how many more there are"; under a minted total it is a lie about
|
|
1009
|
-
// completeness — the count kernel's one rule, applied to the listing.
|
|
1010
|
-
total: Number.isFinite(parsed?.total_hits) ? parsed.total_hits : null,
|
|
1011
|
-
};
|
|
1012
|
-
};
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
941
|
export const PROVIDERS = {
|
|
1016
|
-
corsearch:
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
// WP-receipts W2: the public per-record origin (publicRecordOrigin + /mark/<jur>/<id> is a working
|
|
1023
|
-
// link) — replaces the fragile resolved-link-origin inference at render for receipt-carrying runs.
|
|
1024
|
-
publicRecordOrigin: "https://tm.corsearch.com",
|
|
1025
|
-
async recordFetch(uri, { agentId, sessionKey, recordLog = null }) {
|
|
1026
|
-
if (!process.env.CORSEARCH_SESSION_KEY) return { ok: false, cause: "CORSEARCH_SESSION_KEY absent from driver env" };
|
|
1027
|
-
let doRecordFetch;
|
|
1028
|
-
try { ({ doRecordFetch } = await import("../providers/corsearch/src/core.js")); }
|
|
1029
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1030
|
-
try {
|
|
1031
|
-
const r = await doRecordFetch(process.env.CORSEARCH_SESSION_KEY,
|
|
1032
|
-
{ record_id: uri }, { kind: "record_fetch", agentId, sessionKey, sessionId: null, recordLog });
|
|
1033
|
-
const err = typeof r?.text === "string" && r.text.startsWith("ERROR") ? r.text : null;
|
|
1034
|
-
return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
|
|
1035
|
-
} catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
|
|
1036
|
-
},
|
|
1037
|
-
// Depth 2 (knockout-register): "how many filings match this name?" and nothing else. Same lazy
|
|
1038
|
-
// import + credential guard as recordFetch above; the counting itself is the shared kernel
|
|
1039
|
-
// (providers/_shared/count.mjs), so every provider answers in one shape. ONE BILLABLE SEARCH per
|
|
1040
|
-
// call on this provider (the count rides page 0 — capabilities.countProbe "cheap").
|
|
1041
|
-
async countHits({ name, matchMode, classes, regions }, { agentId, sessionKey, recordLog = null }) {
|
|
1042
|
-
if (!process.env.CORSEARCH_SESSION_KEY) return { ok: false, total: null, reason: "CORSEARCH_SESSION_KEY absent from driver env" };
|
|
1043
|
-
let doCountHits;
|
|
1044
|
-
try { ({ doCountHits } = await import("../providers/corsearch/src/core.js")); }
|
|
1045
|
-
catch (e) { return { ok: false, total: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1046
|
-
try {
|
|
1047
|
-
return await doCountHits(process.env.CORSEARCH_SESSION_KEY,
|
|
1048
|
-
{ name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
|
|
1049
|
-
{ kind: "count_hits", agentId, sessionKey, sessionId: null, recordLog });
|
|
1050
|
-
} catch (e) { return { ok: false, total: null, reason: `count threw: ${e.message}` }; }
|
|
1051
|
-
},
|
|
1052
|
-
// part 5 — the FILINGS behind the narrow counts. A SECOND billable search per term, and it
|
|
1053
|
-
// cannot be folded into the count above: that call rides `cheapCountParams` (`limit:1,
|
|
1054
|
-
// fields:["uri"]`, the smallest response the API gives) and makeEnumerate builds the same probe, so
|
|
1055
|
-
// widening it to carry rows would change what every enumerate call fetches. The listing pays its
|
|
1056
|
-
// own way and the receipts ledger stamps `stage:"records"` on it so the two are told apart.
|
|
1057
|
-
async listRecords({ name, matchMode, classes, regions, limit }, { agentId, sessionKey, recordLog = null }) {
|
|
1058
|
-
if (!process.env.CORSEARCH_SESSION_KEY) return { ok: false, records: null, reason: "CORSEARCH_SESSION_KEY absent from driver env" };
|
|
1059
|
-
let doSearch;
|
|
1060
|
-
try { ({ doSearch } = await import("../providers/corsearch/src/core.js")); }
|
|
1061
|
-
catch (e) { return { ok: false, records: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1062
|
-
return recordsFromSearch(
|
|
1063
|
-
(p, t) => doSearch(process.env.CORSEARCH_SESSION_KEY, p, t),
|
|
1064
|
-
{ origin: "https://tm.corsearch.com" },
|
|
1065
|
-
)({ name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}), limit },
|
|
1066
|
-
{ kind: "record_list", agentId, sessionKey, sessionId: null, recordLog });
|
|
1067
|
-
},
|
|
1068
|
-
// Repair-first (2026-07-05): the fan-in plan-direct-execute repair. Re-runs ONLY the dictated qids
|
|
1069
|
-
// that own no band block, as pure code at the gate (no agent turn, no gateway lane) — the tool's
|
|
1070
|
-
// qid-ownership merge preserves every untargeted/judgment block, and the chunked doEnumerate under
|
|
1071
|
-
// it is the same executor the initial gather used. Corsearch-only today: providers without an
|
|
1072
|
-
// executePlan adapter fall back to the LLM followup at the gate. (Corsearch + Clarivate carry one
|
|
1073
|
-
// as of phase 5, 2026-07-21; Signa does not — it has no enumerate/execute surface yet.)
|
|
1074
|
-
async executePlan({ planPath, axis, outputPath, qids }, { agentId, sessionKey, recordLog = null, reaskTimedOut = false }) {
|
|
1075
|
-
if (!process.env.CORSEARCH_SESSION_KEY) return { ok: false, cause: "CORSEARCH_SESSION_KEY absent from driver env" };
|
|
1076
|
-
let doExecutePlan;
|
|
1077
|
-
try { ({ doExecutePlan } = await import("../providers/corsearch/src/core.js")); }
|
|
1078
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1079
|
-
try {
|
|
1080
|
-
const r = await doExecutePlan(process.env.CORSEARCH_SESSION_KEY,
|
|
1081
|
-
{ plan_path: planPath, axis, output_path: outputPath, ...(Array.isArray(qids) && qids.length ? { qids } : {}) },
|
|
1082
|
-
{ kind: "execute_plan", agentId, sessionKey, sessionId: null, recordLog, ...(reaskTimedOut ? { reaskTimedOut: true } : {}) });
|
|
1083
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
1084
|
-
if (text.startsWith("ERROR")) return { ok: false, cause: text.slice(0, 200) };
|
|
1085
|
-
try { const summary = JSON.parse(text); return { ok: true, states: summary.states ?? {}, executed: summary.executed, skipped: summary.skipped ?? [] }; }
|
|
1086
|
-
catch { return { ok: false, cause: `unparseable execute_plan summary: ${text.slice(0, 120)}` }; }
|
|
1087
|
-
} catch (e) { return { ok: false, cause: `execute_plan threw: ${e.message}` }; }
|
|
1088
|
-
},
|
|
1089
|
-
},
|
|
1090
|
-
clarivate: {
|
|
1091
|
-
id: "clarivate",
|
|
1092
|
-
label: "Clarivate Compumark",
|
|
1093
|
-
credEnv: "CLARIVATE_API_KEY",
|
|
1094
|
-
skillDoc: "skills/clearance-register/providers/clarivate.md",
|
|
1095
|
-
hasPublicRecordUrl: false, // Compumark Content has no public record URL — cite the office register
|
|
1096
|
-
//, ruling 2026-08-20 — WHAT A CARD SHOWS WHERE A LINK CANNOT GO. A UI exists for this
|
|
1097
|
-
// provider and we do not know its per-record URL, so the card says so and says it is unfinished.
|
|
1098
|
-
// "placeholder" is the reader-facing admission; anything else would read as a citation.
|
|
1099
|
-
recordCitation: "placeholder",
|
|
1100
|
-
async recordFetch(uri, { agentId, sessionKey, recordLog = null }) {
|
|
1101
|
-
if (!process.env.CLARIVATE_API_KEY) return { ok: false, cause: "CLARIVATE_API_KEY absent from driver env" };
|
|
1102
|
-
let doRecordFetch, DEFAULT_BASE;
|
|
1103
|
-
try { ({ doRecordFetch, DEFAULT_BASE } = await import("../providers/clarivate/src/core.js")); }
|
|
1104
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1105
|
-
const base = process.env.CLARIVATE_API_BASE || DEFAULT_BASE;
|
|
1106
|
-
try {
|
|
1107
|
-
const r = await doRecordFetch(process.env.CLARIVATE_API_KEY, base,
|
|
1108
|
-
{ record_ids: [uri] }, { kind: "record_fetch", agentId, sessionKey, sessionId: null, recordLog });
|
|
1109
|
-
const err = typeof r?.text === "string" && r.text.startsWith("ERROR") ? r.text : null;
|
|
1110
|
-
return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
|
|
1111
|
-
} catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
|
|
1112
|
-
},
|
|
1113
|
-
// Depth 2's count, same contract as corsearch's (see above). A TRUE count-only call here: POST
|
|
1114
|
-
// /count fetches no records and works at any magnitude. regions[] is mandatory on this provider,
|
|
1115
|
-
// so a worldwide count is a disclosed capability gap rather than a number — register-count.mjs
|
|
1116
|
-
// refuses the run up front instead of letting every mark fail one at a time.
|
|
1117
|
-
async countHits({ name, matchMode, classes, regions }, { agentId, sessionKey, recordLog = null }) {
|
|
1118
|
-
if (!process.env.CLARIVATE_API_KEY) return { ok: false, total: null, reason: "CLARIVATE_API_KEY absent from driver env" };
|
|
1119
|
-
let doCountHits, DEFAULT_BASE;
|
|
1120
|
-
try { ({ doCountHits, DEFAULT_BASE } = await import("../providers/clarivate/src/core.js")); }
|
|
1121
|
-
catch (e) { return { ok: false, total: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1122
|
-
const base = process.env.CLARIVATE_API_BASE || DEFAULT_BASE;
|
|
1123
|
-
try {
|
|
1124
|
-
return await doCountHits(process.env.CLARIVATE_API_KEY, base,
|
|
1125
|
-
{ ...(Array.isArray(name) ? { names: name } : { name }), match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
|
|
1126
|
-
{ kind: "count_hits", agentId, sessionKey, sessionId: null, recordLog });
|
|
1127
|
-
} catch (e) { return { ok: false, total: null, reason: `count threw: ${e.message}` }; }
|
|
1128
|
-
},
|
|
1129
|
-
// part 5 — TWO calls, not a per-record bill. Compumark's POST /search answers with record
|
|
1130
|
-
// IDENTIFIERS and nothing else (normalizeSearchResponse fills mark_text, classes, status and
|
|
1131
|
-
// owner_name with null on every row, by construction), so the fields a filings list prints have to
|
|
1132
|
-
// be fetched. But the fetch is a BATCH: TEXT_BATCH_MAX is 100 ids per call and POST /text hydrates
|
|
1133
|
-
// every id in the call. A 100-filing listing for one name is ONE search plus ONE screen call.
|
|
1134
|
-
//
|
|
1135
|
-
// An earlier draft of this method refused here and priced the listing at "up to 100 extra billed
|
|
1136
|
-
// calls per name". That was wrong by the batch factor, and it mattered: clarivate is the register
|
|
1137
|
-
// wired on the test deployment, so the refusal would have shipped this whole part inert on the one
|
|
1138
|
-
// provider that runs. `screenSource: "billed-record-fetch"` states that the fields cost a fetch —
|
|
1139
|
-
// it does not state that the fetch is per record, and doRecordFetch chunks at the same 100.
|
|
1140
|
-
//
|
|
1141
|
-
// THE CAP IS APPLIED TO THE IDS, BEFORE THE SCREEN, because this provider's search is single-shot:
|
|
1142
|
-
// capabilities.pageParams is empty and POST /search returns the COMPLETE guid set up to the 30000
|
|
1143
|
-
// ceiling. Screening whatever came back would be exactly the runaway the cap exists to prevent.
|
|
1144
|
-
//
|
|
1145
|
-
// Class scope comes from the SEARCH (`classFilter: "native"`), as on every other provider here.
|
|
1146
|
-
// `in_scope_classes` is deliberately NOT sent to the screen: there it drives `screen_verdict`, a
|
|
1147
|
-
// keep/drop judgment, and this lane adds none — it prints what the register said.
|
|
1148
|
-
async listRecords({ name, matchMode, classes, regions, limit }, { agentId, sessionKey, recordLog = null }) {
|
|
1149
|
-
if (!process.env.CLARIVATE_API_KEY) return { ok: false, records: null, reason: "CLARIVATE_API_KEY absent from driver env" };
|
|
1150
|
-
let doSearch, doBatchScreen, DEFAULT_BASE;
|
|
1151
|
-
try { ({ doSearch, doBatchScreen, DEFAULT_BASE } = await import("../providers/clarivate/src/core.js")); }
|
|
1152
|
-
catch (e) { return { ok: false, records: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1153
|
-
const base = process.env.CLARIVATE_API_BASE || DEFAULT_BASE;
|
|
1154
|
-
const tctx = { kind: "record_list", agentId, sessionKey, sessionId: null, recordLog };
|
|
1155
|
-
const readJson = (r, what) => {
|
|
1156
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
1157
|
-
if (r?.isError || text.startsWith("ERROR")) return { err: text.slice(0, 300) || `provider error on the ${what}` };
|
|
1158
|
-
try { return { doc: JSON.parse(text) }; }
|
|
1159
|
-
catch { return { err: `unparseable ${what} response on the record listing` }; }
|
|
1160
|
-
};
|
|
1161
|
-
let ids, total;
|
|
1162
|
-
try {
|
|
1163
|
-
const { doc, err } = readJson(await doSearch(process.env.CLARIVATE_API_KEY, base,
|
|
1164
|
-
{ name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) }, tctx), "search");
|
|
1165
|
-
if (err) return { ok: false, records: null, reason: err };
|
|
1166
|
-
if (!Array.isArray(doc?.results))
|
|
1167
|
-
return { ok: false, records: null, reason: "the search response carried no results[], so nothing was listed — which is not the same as no filings" };
|
|
1168
|
-
// NULL, never the id count: the same rule the rest of this lane runs on.
|
|
1169
|
-
total = Number.isFinite(doc?.total_hits) ? doc.total_hits : null;
|
|
1170
|
-
const want = Number.isFinite(limit) && limit >= 1 ? Math.floor(limit) : doc.results.length;
|
|
1171
|
-
ids = doc.results.map((row) => row?.record_id).filter((u) => typeof u === "string" && u).slice(0, want);
|
|
1172
|
-
} catch (e) { return { ok: false, records: null, reason: `record listing threw: ${e.message}` }; }
|
|
1173
|
-
// Nothing to hydrate is a real, answered zero — and it keeps the screen call unmade.
|
|
1174
|
-
if (!ids.length) return { ok: true, records: [], total };
|
|
1175
|
-
try {
|
|
1176
|
-
const { doc, err } = readJson(await doBatchScreen(process.env.CLARIVATE_API_KEY, base, { uris: ids }, tctx), "screen");
|
|
1177
|
-
if (err) return { ok: false, records: null, reason: err };
|
|
1178
|
-
if (!Array.isArray(doc?.rows))
|
|
1179
|
-
return { ok: false, records: null, reason: "the screen response carried no rows[], so nothing was listed — which is not the same as no filings" };
|
|
1180
|
-
// A PARTIAL HYDRATE IS NOT A LISTING. doBatchScreen only hard-errors when EVERY chunk failed;
|
|
1181
|
-
// one failed chunk among several comes back as rows plus a populated `errors`, and returning
|
|
1182
|
-
// those rows would present a short list as the whole answer — the same lie the count lane
|
|
1183
|
-
// refuses when it declines to sum a partial variant sweep. Fewer rows than ids with NO errors is
|
|
1184
|
-
// a different thing (an id the register no longer resolves) and rides through as a real result.
|
|
1185
|
-
if (Array.isArray(doc.errors) && doc.errors.length)
|
|
1186
|
-
return { ok: false, records: null, reason: `the hydrate failed on ${doc.errors.length} of ${Math.ceil(ids.length / 100)} batch(es), so this listing would be short without saying so: ${String(doc.errors[0]).slice(0, 200)}` };
|
|
1187
|
-
return { ok: true, total, records: doc.rows.map((row) => ({
|
|
1188
|
-
record_id: row?.uri ?? null,
|
|
1189
|
-
mark_text: row?.mark_text ?? null,
|
|
1190
|
-
// The screen row names this `owner`; the neutral record reads `owner_name`. Mapped here so the
|
|
1191
|
-
// seam is in one place rather than as a second spelling inside register-records.mjs.
|
|
1192
|
-
owner_name: row?.owner ?? null,
|
|
1193
|
-
owner_country: row?.owner_country ?? null,
|
|
1194
|
-
status: row?.status ?? null,
|
|
1195
|
-
classes: Array.isArray(row?.classes) ? row.classes : null,
|
|
1196
|
-
office: row?.office ?? null,
|
|
1197
|
-
application_date: row?.application_date ?? null,
|
|
1198
|
-
registration_date: row?.registration_date ?? null,
|
|
1199
|
-
// The office's own numbers: publish addresses the filing at the office's page from these, the
|
|
1200
|
-
// way it does for this register's clearance findings. Compumark states no filing route or IR
|
|
1201
|
-
// number of its own, so a Madrid designation is addressed as the national filing it is listed as.
|
|
1202
|
-
application_number: row?.application_number ?? null,
|
|
1203
|
-
registration_number: row?.registration_number ?? null,
|
|
1204
|
-
// hasPublicRecordUrl:false on this provider — there is no per-record page to link, and a
|
|
1205
|
-
// fabricated one would be worse than none.
|
|
1206
|
-
record_url: null,
|
|
1207
|
-
})) };
|
|
1208
|
-
} catch (e) { return { ok: false, records: null, reason: `record hydrate threw: ${e.message}` }; }
|
|
1209
|
-
},
|
|
1210
|
-
// The repair-first plan-direct-execute lane, same contract as corsearch's (see above). Without it
|
|
1211
|
-
// Clarivate would silently fall back to the LLM followup at the fan-in gate — a model turn doing
|
|
1212
|
-
// what code can do deterministically, which is the transcription lane this whole design closes.
|
|
1213
|
-
// Signature note: the clarivate core takes (apiKey, base, params, tctx), not corsearch's
|
|
1214
|
-
// (sessionKey, params, tctx) — the base is threaded explicitly here.
|
|
1215
|
-
async executePlan({ planPath, axis, outputPath, qids }, { agentId, sessionKey, recordLog = null, reaskTimedOut = false }) {
|
|
1216
|
-
if (!process.env.CLARIVATE_API_KEY) return { ok: false, cause: "CLARIVATE_API_KEY absent from driver env" };
|
|
1217
|
-
let doExecutePlan, DEFAULT_BASE;
|
|
1218
|
-
try { ({ doExecutePlan, DEFAULT_BASE } = await import("../providers/clarivate/src/core.js")); }
|
|
1219
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1220
|
-
const base = process.env.CLARIVATE_API_BASE || DEFAULT_BASE;
|
|
1221
|
-
try {
|
|
1222
|
-
const r = await doExecutePlan(process.env.CLARIVATE_API_KEY, base,
|
|
1223
|
-
{ plan_path: planPath, axis, output_path: outputPath, ...(Array.isArray(qids) && qids.length ? { qids } : {}) },
|
|
1224
|
-
{ kind: "execute_plan", agentId, sessionKey, sessionId: null, recordLog, ...(reaskTimedOut ? { reaskTimedOut: true } : {}) });
|
|
1225
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
1226
|
-
if (text.startsWith("ERROR")) return { ok: false, cause: text.slice(0, 200) };
|
|
1227
|
-
try { const summary = JSON.parse(text); return { ok: true, states: summary.states ?? {}, executed: summary.executed, skipped: summary.skipped ?? [] }; }
|
|
1228
|
-
catch { return { ok: false, cause: `unparseable execute_plan summary: ${text.slice(0, 120)}` }; }
|
|
1229
|
-
} catch (e) { return { ok: false, cause: `execute_plan threw: ${e.message}` }; }
|
|
1230
|
-
},
|
|
1231
|
-
},
|
|
1232
|
-
signa: {
|
|
1233
|
-
id: "signa",
|
|
1234
|
-
label: "Signa",
|
|
1235
|
-
credEnv: "SIGNA_API_KEY",
|
|
1236
|
-
skillDoc: "skills/clearance-register/providers/signa.md",
|
|
1237
|
-
hasPublicRecordUrl: false, // Signa exposes no per-record public URL — cite the office register
|
|
1238
|
-
//, ruling 2026-08-20 — no register UI exists to link to at all, so the card points at
|
|
1239
|
-
// the artifact that DOES carry the record: the audit workbook. Naming it is the whole of this
|
|
1240
|
-
// branch; constructing a per-record URL for a provider that publishes none would be a fabricated
|
|
1241
|
-
// citation on a legal deliverable, and the ruling forbids it in those words.
|
|
1242
|
-
recordCitation: "workbook",
|
|
1243
|
-
async recordFetch(uri, { agentId, sessionKey, recordLog = null }) {
|
|
1244
|
-
if (!process.env.SIGNA_API_KEY) return { ok: false, cause: "SIGNA_API_KEY absent from driver env" };
|
|
1245
|
-
let doRecordFetch, DEFAULT_BASE;
|
|
1246
|
-
try { ({ doRecordFetch, DEFAULT_BASE } = await import("../providers/signa/src/core.js")); }
|
|
1247
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1248
|
-
const base = process.env.SIGNA_BASE_URL || DEFAULT_BASE;
|
|
1249
|
-
try {
|
|
1250
|
-
const r = await doRecordFetch(process.env.SIGNA_API_KEY, base,
|
|
1251
|
-
{ record_id: uri }, { kind: "record_fetch", agentId, sessionKey, sessionId: null, recordLog });
|
|
1252
|
-
const err = typeof r?.text === "string" && r.text.startsWith("ERROR") ? r.text : null;
|
|
1253
|
-
return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
|
|
1254
|
-
} catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
|
|
1255
|
-
},
|
|
1256
|
-
// ── the three adapters that make this a code-driven provider ─────────────────────────
|
|
1257
|
-
//
|
|
1258
|
-
// Until these existed signa declared `recordFetch` alone, `planExec` resolved to null, and a run
|
|
1259
|
-
// fell to the agent lane — a model asked to page a register by hand. Preflight refuses that
|
|
1260
|
-
// outright now, so signa was unrunnable end to end until this landed.
|
|
1261
|
-
async countHits({ name, matchMode, classes, regions }, { agentId, sessionKey, recordLog = null }) {
|
|
1262
|
-
if (!process.env.SIGNA_API_KEY) return { ok: false, cause: "SIGNA_API_KEY absent from driver env" };
|
|
1263
|
-
let core;
|
|
1264
|
-
try { core = await import("../providers/signa/src/core.js"); }
|
|
1265
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1266
|
-
const base = process.env.SIGNA_BASE_URL || core.DEFAULT_BASE;
|
|
1267
|
-
try {
|
|
1268
|
-
// THROUGH toSignaParams, not around it. `strategies: [matchMode]` is the same defect
|
|
1269
|
-
// fixed one layer down: `contains`, `starts_with` and `ends_with` are DETERMINISTIC
|
|
1270
|
-
// modes, not strategies, and the API rejects them in the strategies array. These wrappers
|
|
1271
|
-
// hand-built the vendor shape and so were untouched by that fix — the translator is the one
|
|
1272
|
-
// place that knows which mode rides which request shape, and every caller must go through it.
|
|
1273
|
-
// A MODE THIS PROVIDER CANNOT EXPRESS REFUSES THE CELL, rather than being answered by a
|
|
1274
|
-
// different predicate's number. The translator names it; this turns it into an honest unknown,
|
|
1275
|
-
// which the count kernel already treats as a disclosed gap. The alternative is what this
|
|
1276
|
-
// issue was: a narrower query answering under the wider query's label, invisibly.
|
|
1277
|
-
const signaParams = core.toSignaParams({ name, match_mode: matchMode || "exact", nice_classes: classes, regions });
|
|
1278
|
-
if (signaParams.unsupported_match_mode) {
|
|
1279
|
-
return { ok: false, total: null, unsupported: true,
|
|
1280
|
-
cause: `this register provider cannot express the "${signaParams.unsupported_match_mode}" match mode, so this count is UNKNOWN — it is not answered with a different predicate's number` };
|
|
1281
|
-
}
|
|
1282
|
-
const r = await core.doCountHits(process.env.SIGNA_API_KEY, base, signaParams,
|
|
1283
|
-
{ kind: "count", agentId, sessionKey, sessionId: null, recordLog });
|
|
1284
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
1285
|
-
if (text.startsWith("ERROR")) return { ok: false, cause: text.slice(0, 200) };
|
|
1286
|
-
const p = JSON.parse(text);
|
|
1287
|
-
// The total is REAL now: `options.include_total` puts the register's own corpus total
|
|
1288
|
-
// on the search response, so this no longer has to answer `present` and nothing else. It is
|
|
1289
|
-
// still null whenever the vendor would only approximate it — and null there means UNKNOWN,
|
|
1290
|
-
// which is the whole reason the field may never be filled in with a figure from anywhere else.
|
|
1291
|
-
// `floor` rides beside `approximate` because the two are one fact: the register answered, and the
|
|
1292
|
-
// answer is "more than this". Without the number the disclosure is not usable — "approximate"
|
|
1293
|
-
// alone says no more than "unknown" does, which is the state this replaces.
|
|
1294
|
-
return { ok: true, total: Number.isFinite(p.total_hits) ? p.total_hits : null,
|
|
1295
|
-
approximate: p.total_approximate === true, floor: Number.isFinite(p.total_floor) ? p.total_floor : null,
|
|
1296
|
-
present: p.present === true, note: p.note };
|
|
1297
|
-
} catch (e) { return { ok: false, cause: `countHits threw: ${e.message}` }; }
|
|
1298
|
-
},
|
|
1299
|
-
// `reason`, not `cause`, on every refusal: the listing reads `reason` (register-records.mjs), so a
|
|
1300
|
-
// Signa search that failed reached the workbook as "the search did not run", its cause dropped.
|
|
1301
|
-
async listRecords({ name, matchMode, classes, regions, limit }, { agentId, sessionKey, recordLog = null }) {
|
|
1302
|
-
if (!process.env.SIGNA_API_KEY) return { ok: false, records: null, reason: "SIGNA_API_KEY absent from driver env" };
|
|
1303
|
-
let core;
|
|
1304
|
-
try { core = await import("../providers/signa/src/core.js"); }
|
|
1305
|
-
catch (e) { return { ok: false, records: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1306
|
-
const base = process.env.SIGNA_BASE_URL || core.DEFAULT_BASE;
|
|
1307
|
-
try {
|
|
1308
|
-
// The listing takes the same refusal as the count above, and for the same reason one level on:
|
|
1309
|
-
// a narrower search here returns FEWER records under the wider query's name, so the listing
|
|
1310
|
-
// would under-report and read as complete.
|
|
1311
|
-
const signaListParams = core.toSignaParams({ name, match_mode: matchMode || "exact", nice_classes: classes, regions });
|
|
1312
|
-
if (signaListParams.unsupported_match_mode) {
|
|
1313
|
-
return { ok: false, records: null,
|
|
1314
|
-
reason: `this register provider cannot express the "${signaListParams.unsupported_match_mode}" match mode, so this listing was not taken — it is not answered with a narrower search` };
|
|
1315
|
-
}
|
|
1316
|
-
const r = await core.doSearch(process.env.SIGNA_API_KEY, base,
|
|
1317
|
-
{ ...signaListParams, limit },
|
|
1318
|
-
{ kind: "search", agentId, sessionKey, sessionId: null, recordLog });
|
|
1319
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
1320
|
-
if (text.startsWith("ERROR")) return { ok: false, records: null, reason: text.slice(0, 200) };
|
|
1321
|
-
const p = JSON.parse(text);
|
|
1322
|
-
// THE SEARCH ROW IS NOT THE LISTING'S RECORD. The row names the owner `owner`, the classes
|
|
1323
|
-
// `nice_classes` and the filing date `filing_date`; the listing reads `owner_name`, `classes` and
|
|
1324
|
-
// `application_date`. Handed over unmapped, every Signa filing reached the knockout with no owner,
|
|
1325
|
-
// no classes and no filing date. Mapped here, as clarivate's adapter above maps its screen row.
|
|
1326
|
-
//
|
|
1327
|
-
// The office's own numbers come off the full record Signa returns on search, through the
|
|
1328
|
-
// provider's own normaliser, so publish can address the office's page for each filing
|
|
1329
|
-
// (publish/office-record-links.mjs) instead of showing the handle.
|
|
1330
|
-
//
|
|
1331
|
-
// THE TOTAL RIDES THE SAME ANSWER and is carried, not dropped: `include_total` puts the register's
|
|
1332
|
-
// own count for this exact question on every search, so the listing of a term already holds the
|
|
1333
|
-
// figure the count lane would ask for separately. An approximation stays one: no number in
|
|
1334
|
-
// `total`, the floor beside it — the count lane's rule, unchanged.
|
|
1335
|
-
return { ok: true,
|
|
1336
|
-
total: Number.isFinite(p.total_hits) ? p.total_hits : null,
|
|
1337
|
-
...(p.total_approximate === true ? { approximate: true, floor: Number.isFinite(p.total_floor) ? p.total_floor : null } : {}),
|
|
1338
|
-
// The register's own notes on this answer, carried whole as the clearance sweep carries them —
|
|
1339
|
-
// `expanded_fallback` among them, which says the total counts records rather than marks. The
|
|
1340
|
-
// knockout listing dropped them, so a knockout run could not show what a clearance run shows.
|
|
1341
|
-
...(Array.isArray(p.warnings) && p.warnings.length ? { warnings: p.warnings } : {}),
|
|
1342
|
-
records: (Array.isArray(p.results) ? p.results : []).map((row) => {
|
|
1343
|
-
const rec = row?.raw && typeof row.raw === "object" ? core.normalizeRecord(row.raw, row.office || null) : null;
|
|
1344
|
-
return {
|
|
1345
|
-
record_id: row?.record_id ?? null,
|
|
1346
|
-
mark_text: row?.mark_text ?? null,
|
|
1347
|
-
owner_name: rec?.owner ?? row?.owner ?? null,
|
|
1348
|
-
owner_country: rec?.ownerCountry ?? null,
|
|
1349
|
-
status: row?.status ?? null,
|
|
1350
|
-
classes: Array.isArray(row?.nice_classes) ? row.nice_classes : null,
|
|
1351
|
-
office: row?.office || null,
|
|
1352
|
-
application_date: row?.filing_date ?? null,
|
|
1353
|
-
registration_date: row?.registration_date ?? null,
|
|
1354
|
-
application_number: rec?.applicationNumber ?? null,
|
|
1355
|
-
registration_number: rec?.registrationNumber ?? null,
|
|
1356
|
-
ir_number: rec?.irNumber ?? null,
|
|
1357
|
-
filing_route: rec?.filingRoute ?? null,
|
|
1358
|
-
// No page per record at Signa (hasPublicRecordUrl: false above), and none is made up here.
|
|
1359
|
-
record_url: null,
|
|
1360
|
-
// The office's own page as the register gives it, for publish to fall back on where it cannot
|
|
1361
|
-
// address the office's page from the numbers above (office-record-links.mjs).
|
|
1362
|
-
office_url: rec?.officeUrl ?? null,
|
|
1363
|
-
};
|
|
1364
|
-
}) };
|
|
1365
|
-
} catch (e) { return { ok: false, records: null, reason: `listRecords threw: ${e.message}` }; }
|
|
1366
|
-
},
|
|
1367
|
-
async executePlan({ planPath, axis, outputPath, qids }, { agentId, sessionKey, recordLog = null, reaskTimedOut = false }) {
|
|
1368
|
-
if (!process.env.SIGNA_API_KEY) return { ok: false, cause: "SIGNA_API_KEY absent from driver env" };
|
|
1369
|
-
let core;
|
|
1370
|
-
try { core = await import("../providers/signa/src/core.js"); }
|
|
1371
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1372
|
-
const base = process.env.SIGNA_BASE_URL || core.DEFAULT_BASE;
|
|
1373
|
-
try {
|
|
1374
|
-
const r = await core.doExecutePlan({ apiKey: process.env.SIGNA_API_KEY, base },
|
|
1375
|
-
{ plan_path: planPath, axis, output_path: outputPath, qids },
|
|
1376
|
-
{ kind: "execute_plan", agentId, sessionKey, sessionId: null, recordLog, ...(reaskTimedOut ? { reaskTimedOut: true } : {}) });
|
|
1377
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
1378
|
-
if (text.startsWith("ERROR")) return { ok: false, cause: text.slice(0, 200) };
|
|
1379
|
-
try { const summary = JSON.parse(text); return { ok: true, states: summary.states ?? {}, executed: summary.executed, skipped: summary.skipped ?? [] }; }
|
|
1380
|
-
catch { return { ok: false, cause: `unparseable execute_plan summary: ${text.slice(0, 120)}` }; }
|
|
1381
|
-
} catch (e) { return { ok: false, cause: `executePlan threw: ${e.message}` }; }
|
|
1382
|
-
},
|
|
1383
|
-
},
|
|
1384
|
-
// ── EUIPO — the first FREE register provider ─────────────────────────────────────────────
|
|
1385
|
-
// Everything above is a paid vendor with a global sweep. This one covers ONE office (the EU register:
|
|
1386
|
-
// EUTMs plus international registrations designating the EU) and is free to query, which is what
|
|
1387
|
-
// makes an open-source install possible at all.
|
|
1388
|
-
//
|
|
1389
|
-
// The auth object is a credential PAIR plus an environment, not a single key — hence the shape
|
|
1390
|
-
// difference below. `environment` is load-bearing and not a preference: sandbox and production are
|
|
1391
|
-
// separate deployments holding different corpora, and a sandbox cross-check must never be read as a
|
|
1392
|
-
// live one. The core refuses an unknown value rather than falling back.
|
|
1393
|
-
euipo: {
|
|
1394
|
-
id: "euipo",
|
|
1395
|
-
label: "EUIPO",
|
|
1396
|
-
credEnv: "EUIPO_CLIENT_ID",
|
|
1397
|
-
// The ONLY provider with more than one required variable. preflightCredentials checks the whole
|
|
1398
|
-
// list — without this, an instance holding the id and no secret passes preflight and dies on the
|
|
1399
|
-
// first token request, after model spend and reported as a provider fault.
|
|
1400
|
-
credEnvAlso: ["EUIPO_CLIENT_SECRET"],
|
|
1401
|
-
skillDoc: "skills/clearance-register/providers/euipo.md",
|
|
1402
|
-
hasPublicRecordUrl: true,
|
|
1403
|
-
publicRecordOrigin: "https://euipo.europa.eu",
|
|
1404
|
-
async recordFetch(uri, { agentId, sessionKey, recordLog = null }) {
|
|
1405
|
-
if (!process.env.EUIPO_CLIENT_ID || !process.env.EUIPO_CLIENT_SECRET) {
|
|
1406
|
-
return { ok: false, cause: "EUIPO_CLIENT_ID / EUIPO_CLIENT_SECRET absent from driver env" };
|
|
1407
|
-
}
|
|
1408
|
-
let doRecordFetch;
|
|
1409
|
-
try { ({ doRecordFetch } = await import("../providers/euipo/src/core.js")); }
|
|
1410
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1411
|
-
try {
|
|
1412
|
-
const r = await doRecordFetch(null, // null ⇒ the core reads the credential pair from env
|
|
1413
|
-
{ record_id: uri }, { kind: "record_fetch", agentId, sessionKey, sessionId: null, recordLog });
|
|
1414
|
-
const err = typeof r?.text === "string" && r.text.startsWith("ERROR") ? r.text : null;
|
|
1415
|
-
return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
|
|
1416
|
-
} catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
|
|
1417
|
-
},
|
|
1418
|
-
// countProbe "cheap": the total rides page 0 of an ordinary search, so this is ONE call — free in
|
|
1419
|
-
// money terms, but it still spends the daily request allowance.
|
|
1420
|
-
async countHits({ name, matchMode, classes, regions }, { agentId, sessionKey, recordLog = null }) {
|
|
1421
|
-
if (!process.env.EUIPO_CLIENT_ID || !process.env.EUIPO_CLIENT_SECRET) {
|
|
1422
|
-
return { ok: false, total: null, reason: "EUIPO_CLIENT_ID / EUIPO_CLIENT_SECRET absent from driver env" };
|
|
1423
|
-
}
|
|
1424
|
-
let doCountHits;
|
|
1425
|
-
try { ({ doCountHits } = await import("../providers/euipo/src/core.js")); }
|
|
1426
|
-
catch (e) { return { ok: false, total: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1427
|
-
try {
|
|
1428
|
-
return await doCountHits(null,
|
|
1429
|
-
{ name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
|
|
1430
|
-
{ kind: "count_hits", agentId, sessionKey, sessionId: null, recordLog });
|
|
1431
|
-
} catch (e) { return { ok: false, total: null, reason: `count threw: ${e.message}` }; }
|
|
1432
|
-
},
|
|
1433
|
-
// part 5. Free in money, one request against the daily allowance per term. The page knob is
|
|
1434
|
-
// `size`, not `limit` — this API has no `limit` at all, which is the exact trap the count kernel's
|
|
1435
|
-
// own header warns about, so the neutral cap is translated here rather than passed through.
|
|
1436
|
-
async listRecords({ name, matchMode, classes, regions, limit }, { agentId, sessionKey, recordLog = null }) {
|
|
1437
|
-
if (!process.env.EUIPO_CLIENT_ID || !process.env.EUIPO_CLIENT_SECRET) {
|
|
1438
|
-
return { ok: false, records: null, reason: "EUIPO_CLIENT_ID / EUIPO_CLIENT_SECRET absent from driver env" };
|
|
1439
|
-
}
|
|
1440
|
-
let doSearch;
|
|
1441
|
-
try { ({ doSearch } = await import("../providers/euipo/src/core.js")); }
|
|
1442
|
-
catch (e) { return { ok: false, records: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1443
|
-
return recordsFromSearch((p, t) => doSearch(null, p, t))(
|
|
1444
|
-
{ name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}), size: limit, page: 0 },
|
|
1445
|
-
{ kind: "record_list", agentId, sessionKey, sessionId: null, recordLog });
|
|
1446
|
-
},
|
|
1447
|
-
async executePlan({ planPath, axis, outputPath, qids }, { agentId, sessionKey, recordLog = null, reaskTimedOut = false }) {
|
|
1448
|
-
if (!process.env.EUIPO_CLIENT_ID || !process.env.EUIPO_CLIENT_SECRET) {
|
|
1449
|
-
return { ok: false, cause: "EUIPO_CLIENT_ID / EUIPO_CLIENT_SECRET absent from driver env" };
|
|
1450
|
-
}
|
|
1451
|
-
let doExecutePlan;
|
|
1452
|
-
try { ({ doExecutePlan } = await import("../providers/euipo/src/core.js")); }
|
|
1453
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1454
|
-
try {
|
|
1455
|
-
const r = await doExecutePlan(null,
|
|
1456
|
-
{ plan_path: planPath, axis, output_path: outputPath, ...(Array.isArray(qids) && qids.length ? { qids } : {}) },
|
|
1457
|
-
{ kind: "execute_plan", agentId, sessionKey, sessionId: null, recordLog, ...(reaskTimedOut ? { reaskTimedOut: true } : {}) });
|
|
1458
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
1459
|
-
return text.startsWith("ERROR") ? { ok: false, cause: text.slice(0, 200) } : { ok: true, summary: text.slice(0, 400) };
|
|
1460
|
-
} catch (e) { return { ok: false, cause: `executePlan threw: ${e.message}` }; }
|
|
1461
|
-
},
|
|
1462
|
-
},
|
|
1463
|
-
"uspto-local": {
|
|
1464
|
-
id: "uspto-local",
|
|
1465
|
-
label: "USPTO (local index)",
|
|
1466
|
-
credEnv: "USPTO_LOCAL_DB",
|
|
1467
|
-
skillDoc: "skills/clearance-register/providers/uspto-local.md",
|
|
1468
|
-
hasPublicRecordUrl: true,
|
|
1469
|
-
// TSDR publishes a page per serial, so a finding can cite an address the reader can open. The
|
|
1470
|
-
// record ref is /mark/us/<serial>, and the core builds the full statusSearch link on the record.
|
|
1471
|
-
publicRecordOrigin: "https://tsdr.uspto.gov",
|
|
1472
|
-
async recordFetch(uri, { agentId, sessionKey, recordLog = null }) {
|
|
1473
|
-
if (!process.env.USPTO_LOCAL_DB) return { ok: false, cause: "USPTO_LOCAL_DB absent from driver env" };
|
|
1474
|
-
let doRecordFetch;
|
|
1475
|
-
try { ({ doRecordFetch } = await import("../providers/uspto-local/src/core.js")); }
|
|
1476
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1477
|
-
try {
|
|
1478
|
-
const r = await doRecordFetch({ dbPath: process.env.USPTO_LOCAL_DB },
|
|
1479
|
-
{ record_id: uri }, { kind: "record_fetch", agentId, sessionKey, sessionId: null, recordLog });
|
|
1480
|
-
const err = typeof r?.text === "string" && r.text.startsWith("ERROR") ? r.text : null;
|
|
1481
|
-
return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
|
|
1482
|
-
} catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
|
|
1483
|
-
},
|
|
1484
|
-
// Depth 2's count. A true count-only call — `SELECT count(*)` fetches no rows and works at any
|
|
1485
|
-
// magnitude — but see the freshness note above: this is also the seam where a stale index refuses.
|
|
1486
|
-
async countHits({ name, matchMode, classes, regions }, { agentId, sessionKey, recordLog = null }) {
|
|
1487
|
-
if (!process.env.USPTO_LOCAL_DB) return { ok: false, total: null, reason: "USPTO_LOCAL_DB absent from driver env" };
|
|
1488
|
-
let doCountHits;
|
|
1489
|
-
try { ({ doCountHits } = await import("../providers/uspto-local/src/core.js")); }
|
|
1490
|
-
catch (e) { return { ok: false, total: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1491
|
-
try {
|
|
1492
|
-
// `regions` is accepted and NOT forwarded: this source holds one office, and the plan resolved
|
|
1493
|
-
// its territorial scope against capabilities.offices.covered before ever reaching here — a
|
|
1494
|
-
// jurisdiction other than US is already a deferred gap upstream. Forwarding it would let a
|
|
1495
|
-
// caller believe it had narrowed a search that has nothing to narrow.
|
|
1496
|
-
return await doCountHits({ dbPath: process.env.USPTO_LOCAL_DB },
|
|
1497
|
-
{ name, match_mode: matchMode, nice_classes: classes ?? [] },
|
|
1498
|
-
{ kind: "count_hits", agentId, sessionKey, sessionId: null, recordLog });
|
|
1499
|
-
} catch (e) { return { ok: false, total: null, reason: `count threw: ${e.message}` }; }
|
|
1500
|
-
},
|
|
1501
|
-
// part 5. Free — a local SQLite read. `regions` is accepted and NOT forwarded for the same
|
|
1502
|
-
// reason the count above does not forward it: this source holds one office.
|
|
1503
|
-
async listRecords({ name, matchMode, classes, limit }, { agentId, sessionKey, recordLog = null }) {
|
|
1504
|
-
if (!process.env.USPTO_LOCAL_DB) return { ok: false, records: null, reason: "USPTO_LOCAL_DB absent from driver env" };
|
|
1505
|
-
let doSearch;
|
|
1506
|
-
try { ({ doSearch } = await import("../providers/uspto-local/src/core.js")); }
|
|
1507
|
-
catch (e) { return { ok: false, records: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1508
|
-
return recordsFromSearch(
|
|
1509
|
-
(p, t) => doSearch({ dbPath: process.env.USPTO_LOCAL_DB }, p, t),
|
|
1510
|
-
{ origin: "https://tsdr.uspto.gov" },
|
|
1511
|
-
)({ name, match_mode: matchMode, nice_classes: classes ?? [], limit },
|
|
1512
|
-
{ kind: "record_list", agentId, sessionKey, sessionId: null, recordLog });
|
|
1513
|
-
},
|
|
1514
|
-
// The repair-first plan-direct-execute lane. Without it this provider would fall back to the LLM
|
|
1515
|
-
// followup at the fan-in gate — a model turn doing what code does deterministically.
|
|
1516
|
-
async executePlan({ planPath, axis, outputPath, qids }, { agentId, sessionKey, recordLog = null, reaskTimedOut = false }) {
|
|
1517
|
-
if (!process.env.USPTO_LOCAL_DB) return { ok: false, cause: "USPTO_LOCAL_DB absent from driver env" };
|
|
1518
|
-
let doExecutePlan;
|
|
1519
|
-
try { ({ doExecutePlan } = await import("../providers/uspto-local/src/core.js")); }
|
|
1520
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1521
|
-
try {
|
|
1522
|
-
const r = await doExecutePlan({ dbPath: process.env.USPTO_LOCAL_DB },
|
|
1523
|
-
{ plan_path: planPath, axis, output_path: outputPath, ...(Array.isArray(qids) && qids.length ? { qids } : {}) },
|
|
1524
|
-
{ kind: "execute_plan", agentId, sessionKey, sessionId: null, recordLog, ...(reaskTimedOut ? { reaskTimedOut: true } : {}) });
|
|
1525
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
1526
|
-
if (text.startsWith("ERROR")) return { ok: false, cause: text.slice(0, 200) };
|
|
1527
|
-
try { const summary = JSON.parse(text); return { ok: true, states: summary.states ?? {}, executed: summary.executed, skipped: summary.skipped ?? [] }; }
|
|
1528
|
-
catch { return { ok: false, cause: `unparseable execute_plan summary: ${text.slice(0, 120)}` }; }
|
|
1529
|
-
} catch (e) { return { ok: false, cause: `execute_plan threw: ${e.message}` }; }
|
|
1530
|
-
},
|
|
1531
|
-
},
|
|
1532
|
-
// ──: the free tier — EUIPO + the local US index as ONE register ──────────────────────────────
|
|
1533
|
-
//
|
|
1534
|
-
// WHAT PREFLIGHT REQUIRES IS THE EU HALF, NOT BOTH HALVES.
|
|
1535
|
-
//
|
|
1536
|
-
// This list used to carry USPTO_LOCAL_DB, and the argument was that joinPlanToBands has three outcomes
|
|
1537
|
-
// per qid — executed, missing, deferred — with no shape for "half of this ran", so a two-office slice
|
|
1538
|
-
// whose US half is unconfigured would defer WHOLE and take its EU coverage with it. Refusing up front
|
|
1539
|
-
// looked like the only honest answer.
|
|
1540
|
-
//
|
|
1541
|
-
// That invariant is real and is unchanged. What was wrong is where it was enforced. The two offices
|
|
1542
|
-
// now part company at PLAN COMPILE (driver/register-availability.mjs → compileRegisterPlan), so every
|
|
1543
|
-
// qid the executor sees is already single-office: every entry is EU-only, and nothing is ever
|
|
1544
|
-
// half-run. With the split early, refusing the whole run buys nothing and costs the EU coverage the
|
|
1545
|
-
// box genuinely has.
|
|
1546
|
-
//
|
|
1547
|
-
// CORRECTED 2026-08-11. This paragraph used to say "the US entry is a disclosed `deferred_coverage`
|
|
1548
|
-
// row". THERE IS NO US ENTRY — the unreachable office produces no plan entry at all, which is exactly
|
|
1549
|
-
// why every surviving qid is single-office. The distinction was not pedantic: nothing a reader sees
|
|
1550
|
-
// was reading `deferred_coverage`, so the run shipped an EU-only clean with no row saying the US
|
|
1551
|
-
// register was never searched, and this comment was the argument for dropping the variable from the
|
|
1552
|
-
// list above. The disclosure now exists — coverage-form.mjs reads `plan.deferred_coverage` and emits
|
|
1553
|
-
// an `open` row per active axis — so the reasoning below stands on something real. Before that it did
|
|
1554
|
-
// not, and this list was right for the wrong reason.
|
|
1555
|
-
//
|
|
1556
|
-
// It also gated the wrong thing in practice. The US index is the one piece of this tier an operator
|
|
1557
|
-
// cannot get in a minute — it is a 41.5 GB build over two bulk products, behind an account with ID.me
|
|
1558
|
-
// identity verification, and it takes hours — so requiring it made the free tier unusable for exactly
|
|
1559
|
-
// the person it exists for. That CODE was merged; the INDEX is what no box had, and that was enough
|
|
1560
|
-
// to keep and from ever being exercised.
|
|
1561
|
-
//
|
|
1562
|
-
// The EU pair stays REQUIRED: a free tier with no configured member at all is not degraded, it is
|
|
1563
|
-
// unconfigured, and it must refuse by name rather than produce a register layer with nothing in it.
|
|
1564
|
-
// credEnvAlso is still what makes that a whole check — a single credEnv string cannot express a
|
|
1565
|
-
// two-variable OAuth provider, and the half-check that reads credEnv alone is a known second site.
|
|
1566
|
-
"free-tier": {
|
|
1567
|
-
id: "free-tier",
|
|
1568
|
-
label: "Free tier (EUIPO + USPTO local index)",
|
|
1569
|
-
credEnv: "EUIPO_CLIENT_ID",
|
|
1570
|
-
credEnvAlso: ["EUIPO_CLIENT_SECRET"],
|
|
1571
|
-
skillDoc: "skills/clearance-register/providers/free-tier.md",
|
|
1572
|
-
hasPublicRecordUrl: true,
|
|
1573
|
-
// NULL, deliberately: the two members have DIFFERENT public origins (euipo.europa.eu and the USPTO),
|
|
1574
|
-
// so a single origin string here would stamp one office's host onto the other's citations. The
|
|
1575
|
-
// record-level link is built from the record itself; publish/index.mjs reads this only as a prefix
|
|
1576
|
-
// and treats null as "no prefix", which is the honest answer for a two-office register.
|
|
1577
|
-
publicRecordOrigin: null,
|
|
1578
|
-
// — WHICH HOSTS THIS PROVIDER MAY LEGITIMATELY PRODUCE. The record-URL gate reads origins
|
|
1579
|
-
// through recordOriginsFor(), and a composite's are its MEMBERS'. Keyed on the null above: a gate
|
|
1580
|
-
// that took `publicRecordOrigin` at face value here would resolve to an EMPTY allow-list and refuse
|
|
1581
|
-
// every free-tier delivery — every one of whose record links is legitimately a EUIPO or a USPTO one.
|
|
1582
|
-
composedOf: ["euipo", "uspto-local"],
|
|
1583
|
-
async recordFetch(uri, { agentId, sessionKey, recordLog = null }) {
|
|
1584
|
-
const missing = freeTierMissing();
|
|
1585
|
-
if (missing.length) return { ok: false, cause: `${missing.join(" + ")} absent from driver env` };
|
|
1586
|
-
let doRecordFetch;
|
|
1587
|
-
try { ({ doRecordFetch } = await import("../providers/free-tier/src/core.js")); }
|
|
1588
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1589
|
-
try {
|
|
1590
|
-
const r = await doRecordFetch(null, { record_id: uri },
|
|
1591
|
-
{ kind: "record_fetch", agentId, sessionKey, sessionId: null, recordLog });
|
|
1592
|
-
const err = typeof r?.text === "string" && r.text.startsWith("ERROR") ? r.text : null;
|
|
1593
|
-
return err ? { ok: false, cause: err.slice(0, 140) } : { ok: true };
|
|
1594
|
-
} catch (e) { return { ok: false, cause: `fetch threw: ${e.message}` }; }
|
|
1595
|
-
},
|
|
1596
|
-
// countProbe "cheap" — the WEAKEST member's mode. EUIPO's total rides page 0 of an ordinary search,
|
|
1597
|
-
// so the composite pays that price even though the US index has a true count endpoint.
|
|
1598
|
-
async countHits({ name, matchMode, classes, regions }, { agentId, sessionKey, recordLog = null }) {
|
|
1599
|
-
const missing = freeTierMissing();
|
|
1600
|
-
if (missing.length) return { ok: false, total: null, reason: `${missing.join(" + ")} absent from driver env` };
|
|
1601
|
-
let doCountHits;
|
|
1602
|
-
try { ({ doCountHits } = await import("../providers/free-tier/src/core.js")); }
|
|
1603
|
-
catch (e) { return { ok: false, total: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1604
|
-
try {
|
|
1605
|
-
return await doCountHits(null,
|
|
1606
|
-
{ name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}) },
|
|
1607
|
-
{ kind: "count_hits", agentId, sessionKey, sessionId: null, recordLog });
|
|
1608
|
-
} catch (e) { return { ok: false, total: null, reason: `count threw: ${e.message}` }; }
|
|
1609
|
-
},
|
|
1610
|
-
// part 5. Free on both members. `size` AND `limit` ride together on purpose: this composite
|
|
1611
|
-
// fans out to EUIPO (which pages on `size`) and to the local US index (which pages on `limit`), and
|
|
1612
|
-
// its own doSearch hands each member the params it understands. Sending one knob would silently
|
|
1613
|
-
// give the other member its default page size — a listing capped somewhere nobody chose.
|
|
1614
|
-
async listRecords({ name, matchMode, classes, regions, limit }, { agentId, sessionKey, recordLog = null }) {
|
|
1615
|
-
const missing = freeTierMissing();
|
|
1616
|
-
if (missing.length) return { ok: false, records: null, reason: `${missing.join(" + ")} absent from driver env` };
|
|
1617
|
-
let doSearch;
|
|
1618
|
-
try { ({ doSearch } = await import("../providers/free-tier/src/core.js")); }
|
|
1619
|
-
catch (e) { return { ok: false, records: null, reason: `plugin core unavailable: ${e.message}` }; }
|
|
1620
|
-
return recordsFromSearch((p, t) => doSearch(null, p, t))(
|
|
1621
|
-
{ name, match_mode: matchMode, nice_classes: classes ?? [], ...(regions?.length ? { regions } : {}), size: limit, limit, page: 0 },
|
|
1622
|
-
{ kind: "record_list", agentId, sessionKey, sessionId: null, recordLog });
|
|
1623
|
-
},
|
|
1624
|
-
async executePlan({ planPath, axis, outputPath, qids }, { agentId, sessionKey, recordLog = null, reaskTimedOut = false }) {
|
|
1625
|
-
const missing = freeTierMissing();
|
|
1626
|
-
if (missing.length) return { ok: false, cause: `${missing.join(" + ")} absent from driver env` };
|
|
1627
|
-
let doExecutePlan;
|
|
1628
|
-
try { ({ doExecutePlan } = await import("../providers/free-tier/src/core.js")); }
|
|
1629
|
-
catch (e) { return { ok: false, cause: `plugin core unavailable: ${e.message}` }; }
|
|
1630
|
-
try {
|
|
1631
|
-
const r = await doExecutePlan(null,
|
|
1632
|
-
{ plan_path: planPath, axis, output_path: outputPath, ...(Array.isArray(qids) && qids.length ? { qids } : {}) },
|
|
1633
|
-
{ kind: "execute_plan", agentId, sessionKey, sessionId: null, recordLog, ...(reaskTimedOut ? { reaskTimedOut: true } : {}) });
|
|
1634
|
-
const text = typeof r?.text === "string" ? r.text : "";
|
|
1635
|
-
return text.startsWith("ERROR") ? { ok: false, cause: text.slice(0, 200) } : { ok: true, summary: text.slice(0, 400) };
|
|
1636
|
-
} catch (e) { return { ok: false, cause: `executePlan threw: ${e.message}` }; }
|
|
1637
|
-
},
|
|
1638
|
-
},
|
|
942
|
+
corsearch: corsearchAdapter,
|
|
943
|
+
clarivate: clarivateAdapter,
|
|
944
|
+
signa: signaAdapter,
|
|
945
|
+
euipo: euipoAdapter,
|
|
946
|
+
"uspto-local": usptoLocalAdapter,
|
|
947
|
+
"free-tier": freeTierAdapter,
|
|
1639
948
|
};
|
|
1640
949
|
|
|
1641
950
|
// — AN ENVIRONMENT MAY BE PASSED, AND THEN IT IS THE ONE THAT DECIDES.
|
|
@@ -1810,14 +1119,16 @@ export const RESEARCH_PROVIDERS = {
|
|
|
1810
1119
|
// safety that replaces the forcing lives in providers/jx/src/turn-envelope.mjs: an answer the parser
|
|
1811
1120
|
// cannot read is a DEGRADE with a cause, never an empty result. Without that, an unreadable judge reply
|
|
1812
1121
|
// would have meant every SERP hit came back unclassified, which a report reads as no adverse hits.
|
|
1813
|
-
|
|
1122
|
+
// `runDir` is the run the lane serves: a run that recorded its engine at its start keeps it here as its stages
|
|
1123
|
+
// do, so a run's lanes and stages never split across engines (engine/run-choices.mjs).
|
|
1124
|
+
async function jxRunner(runDir) {
|
|
1814
1125
|
const { makeJxTurnRunner } = await import("./engine/jx-turn.mjs");
|
|
1815
|
-
return makeJxTurnRunner();
|
|
1126
|
+
return makeJxTurnRunner({ runDir });
|
|
1816
1127
|
}
|
|
1817
1128
|
|
|
1818
1129
|
/** One lane's dispatch: resolve the engine, lazy-import the pure core, run it on the turn. */
|
|
1819
|
-
async function jxLane(kind, mod, call) {
|
|
1820
|
-
const runner = await jxRunner();
|
|
1130
|
+
async function jxLane(kind, mod, call, runDir = null) {
|
|
1131
|
+
const runner = await jxRunner(runDir);
|
|
1821
1132
|
if (runner.error) return { ok: false, cause: `jx ${kind}: ${runner.error}` };
|
|
1822
1133
|
let core;
|
|
1823
1134
|
try { core = await import(mod); }
|
|
@@ -1828,22 +1139,22 @@ async function jxLane(kind, mod, call) {
|
|
|
1828
1139
|
|
|
1829
1140
|
export const JX_PROVIDERS = {
|
|
1830
1141
|
completions: {
|
|
1831
|
-
generate: ({ mark, productContext, lane }) =>
|
|
1142
|
+
generate: ({ mark, productContext, lane, runDir }) =>
|
|
1832
1143
|
jxLane("completions", "../providers/jx/src/core.js",
|
|
1833
|
-
(core, turn) => core.generateCandidates({ mark, productContext, lane, turn })),
|
|
1144
|
+
(core, turn) => core.generateCandidates({ mark, productContext, lane, turn }), runDir),
|
|
1834
1145
|
},
|
|
1835
1146
|
// Phase 4 slice 2 — the SERP-grid hit judge (classification only; retrieval is code-side).
|
|
1836
1147
|
judge: {
|
|
1837
|
-
judge: ({ mark, hits }) =>
|
|
1148
|
+
judge: ({ mark, hits, runDir }) =>
|
|
1838
1149
|
jxLane("judge", "../providers/jx/src/judge.js",
|
|
1839
|
-
(mod, turn) => mod.judgeHits({ mark, hits, turn })),
|
|
1150
|
+
(mod, turn) => mod.judgeHits({ mark, hits, turn }), runDir),
|
|
1840
1151
|
},
|
|
1841
1152
|
// Phase 4 slice 3 — the nativeread lane (reads the code-inlined zh evidence slice, returns structured
|
|
1842
1153
|
// flags; severity_hint never sets a band).
|
|
1843
1154
|
nativeread: {
|
|
1844
|
-
read: ({ mark, lane, payload }) =>
|
|
1155
|
+
read: ({ mark, lane, payload, runDir }) =>
|
|
1845
1156
|
jxLane("nativeread", "../providers/jx/src/nativeread.js",
|
|
1846
|
-
(mod, turn) => mod.generateReadItems({ mark, lane, payload, turn })),
|
|
1157
|
+
(mod, turn) => mod.generateReadItems({ mark, lane, payload, turn }), runDir),
|
|
1847
1158
|
},
|
|
1848
1159
|
};
|
|
1849
1160
|
|
|
@@ -1881,7 +1192,7 @@ export const SERP_PROVIDERS = {
|
|
|
1881
1192
|
// citation ships UNVERIFIED — a degradation that must surface at run START (and on resume), never be
|
|
1882
1193
|
// discovered at delivery (the teal-bastion cascade: a resume inherited artifacts but not CORSEARCH_SESSION_KEY).
|
|
1883
1194
|
// Provider-agnostic — reads the active adapter's `credEnv`, never a baked-in provider name. Throws; the
|
|
1884
|
-
// caller (
|
|
1195
|
+
// caller (the run's opening, `steps/open-run.mjs`) lets it abort the run before any model spend.
|
|
1885
1196
|
/**
|
|
1886
1197
|
* Which of a provider's required credential variables are missing. EVERY variable, not just `credEnv`.
|
|
1887
1198
|
*
|
|
@@ -1977,7 +1288,7 @@ export function preflightCredentials(env = process.env) {
|
|
|
1977
1288
|
// note on missingCredentials above says one predicate exists so they cannot drift apart again.
|
|
1978
1289
|
/**
|
|
1979
1290
|
* Refuse, before any spend, a product whose unregistered-use half cannot run. Throws, like
|
|
1980
|
-
* preflightCredentials, and is called at the same door in
|
|
1291
|
+
* preflightCredentials, and is called at the same door in the run's opening (`steps/open-run.mjs`) — before buildRunContext, so the
|
|
1981
1292
|
* throw rides the queue-level `intake-<base>.prerun-failed` packet lane with no run dir behind it.
|
|
1982
1293
|
*
|
|
1983
1294
|
* Takes the resolved POLICY rather than the product string: the caller already has it (it computes the
|
|
@@ -2289,7 +1600,7 @@ const isExecFile = (p, platform = process.platform) => {
|
|
|
2289
1600
|
} catch { return false; }
|
|
2290
1601
|
};
|
|
2291
1602
|
const realOrNull = (p) => { try { return realpathSync(p); } catch { return null; } };
|
|
2292
|
-
const readPackage = (dir) => { try { return
|
|
1603
|
+
const readPackage = (dir) => { try { return readJson(join(dir, "package.json")); } catch { return null; } };
|
|
2293
1604
|
|
|
2294
1605
|
/**
|
|
2295
1606
|
* Whether the kernel runs this file ITSELF: a native executable (ELF, Mach-O, a Windows PE) or a `#!` script.
|
|
@@ -2464,7 +1775,7 @@ export function resolveEngineProgram(engine, { env = process.env, enginesDir = u
|
|
|
2464
1775
|
/**
|
|
2465
1776
|
* Refuse a run whose engine program cannot be found or run, or is written as a relative path.
|
|
2466
1777
|
*
|
|
2467
|
-
* Throws, like preflightCredentials, and is called at the same door —
|
|
1778
|
+
* Throws, like preflightCredentials, and is called at the same door — the run's opening, before the run
|
|
2468
1779
|
* context is built. Returns {engine, binEnv, bin, resolved, source, version} when the program is usable:
|
|
2469
1780
|
* the answer of resolveEngineProgram above, which every other reader asks too.
|
|
2470
1781
|
*
|
|
@@ -2632,7 +1943,7 @@ export function freeSpacePlan({ freeBytes, needBytes, path }) {
|
|
|
2632
1943
|
|
|
2633
1944
|
/**
|
|
2634
1945
|
* Refuse a run that has nowhere to write. Throws, like preflightCredentials and preflightEngineBinary,
|
|
2635
|
-
* and is called at the same door —
|
|
1946
|
+
* and is called at the same door — the run's opening, before the run context is built.
|
|
2636
1947
|
*
|
|
2637
1948
|
* UNCONDITIONAL, like preflightEngineBinary and unlike preflightCredentials. Every lane writes a run
|
|
2638
1949
|
* directory: a knockout does, a run with an injected recordFetcher does, a resume does. There is no
|