clearotron 0.7.0 → 0.8.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/THIRD-PARTY-NOTICES.md +71 -2
- package/build-info.json +2 -2
- package/demo/multi-country-focus-search/run/common-law-grid.json +1 -1
- package/docs/CLIENT-MCP.md +17 -0
- package/docs/assets/README.md +19 -3
- package/docs/assets/portal-clearance-report.jpg +0 -0
- package/docs/assets/portal-conflict-landscape.jpg +0 -0
- package/docs/assets/portal-new-clearance.png +0 -0
- package/driver/CHANGELOG.md +48 -0
- package/driver/config-inventory.mjs +15 -2
- package/driver/dev-portal.mjs +2 -0
- package/driver/effort-model.mjs +34 -4
- package/driver/engine/CONTRACT.md +8 -0
- package/driver/engine/anthropic-agent.mjs +74 -16
- package/driver/engine/jx-turn.mjs +11 -3
- package/driver/engine/openai-agent.mjs +33 -7
- package/driver/engine/run-choices.mjs +28 -7
- package/driver/engine/speed.mjs +107 -0
- package/driver/enqueue-schema.mjs +8 -0
- package/driver/enqueue.mjs +14 -2
- package/driver/jx-units.mjs +2 -2
- package/driver/jx.mjs +1 -1
- package/driver/knockout-plain-language.mjs +96 -0
- package/driver/ladder/attempt-record.mjs +14 -2
- package/driver/ladder/dispatch.mjs +2 -2
- package/driver/ladder/form-repair.mjs +1 -1
- package/driver/ladder/stage.mjs +7 -1
- package/driver/mark-logos.mjs +6 -1
- package/driver/order-receipt.mjs +184 -0
- package/driver/package.json +4 -1
- package/driver/picture-shrink-worker.mjs +21 -0
- package/driver/picture-thumbnail.mjs +132 -0
- package/driver/pipeline-knockout.mjs +14 -0
- package/driver/portal-confirmation.mjs +3 -0
- package/driver/portal-report.mjs +44 -1
- package/driver/portal-routes/run.mjs +19 -9
- package/driver/portal-runs.mjs +118 -63
- package/driver/portal-service.mjs +17 -2
- package/driver/predelivery-lint.mjs +3 -3
- package/driver/progress.mjs +33 -5
- package/driver/publish/column-queries.mjs +86 -0
- package/driver/publish/index.mjs +4 -4
- package/driver/publish/knockout.mjs +35 -8
- package/driver/publish/page-shell.mjs +5 -1
- package/driver/publish/read-document.mjs +3 -0
- package/driver/publish/render-knockout.mjs +61 -16
- package/driver/publish/render.mjs +171 -30
- package/driver/publish/search-depth.mjs +45 -1
- package/driver/publish/strings.mjs +23 -0
- package/driver/publish/templates/report.css +73 -0
- package/driver/research-answers.mjs +17 -6
- package/driver/research-checks.mjs +22 -4
- package/driver/research-records.mjs +81 -0
- package/driver/run-quote.mjs +3 -0
- package/driver/run-speed.mjs +89 -0
- package/driver/runner.mjs +50 -21
- package/driver/saved-register-pages.mjs +23 -22
- package/driver/stage-freshness.mjs +5 -0
- package/driver/stages.mjs +2 -2
- package/driver/steps/open-run.mjs +12 -1
- package/driver/suite-census.json +199 -37
- package/driver/tokens.mjs +3 -0
- package/driver/urgent-count.mjs +54 -0
- package/driver/usage-ledger.mjs +8 -2
- package/driver/web-pictures.mjs +532 -0
- package/mcp-server/CHANGELOG.md +16 -0
- package/mcp-server/lib/document-reads.mjs +28 -0
- package/mcp-server/lib/events.mjs +21 -12
- package/mcp-server/lib/findings.mjs +2 -1
- package/mcp-server/lib/knockout.mjs +3 -2
- package/mcp-server/lib/ops.mjs +103 -6
- package/mcp-server/lib/options.mjs +4 -0
- package/mcp-server/lib/plan.mjs +38 -4
- package/mcp-server/lib/result-shapes.mjs +66 -0
- package/mcp-server/lib/runs.mjs +46 -44
- package/mcp-server/lib/urgent.mjs +29 -0
- package/mcp-server/package.json +1 -1
- package/mcp-server/result-shapes.json +2978 -0
- package/mcp-server/server.mjs +67 -14
- package/package.json +4 -1
- package/portal-ui/dist/assets/{index-qNDhqCw9.js → index-DEkVU2FD.js} +1909 -766
- package/portal-ui/dist/assets/{index-CxAkJXIT.css → index-W6SAoDkS.css} +238 -1
- package/portal-ui/dist/index.html +2 -2
- package/portal-ui/package.json +1 -1
- package/providers/jx/src/turn-envelope.mjs +3 -1
- package/providers/oauth-mcp-bridge/CHANGELOG.md +4 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/signa/src/core.js +54 -12
- package/scripts/README.md +3 -0
- package/scripts/e2e-first-time.mjs +2 -2
- package/scripts/mint-result-shapes.mjs +199 -0
- package/scripts/readme-pictures.mjs +227 -0
- package/scripts/render-check.mjs +4 -1
- package/scripts/report-sections-render-check.mjs +191 -0
- package/scripts/settings-render-check.mjs +68 -11
- package/shared/brand.mjs +8 -0
- package/skills/clearotron-account/SKILL.md +24 -0
- package/skills/clearotron-ops/SKILL.md +23 -9
package/mcp-server/lib/runs.mjs
CHANGED
|
@@ -6,25 +6,13 @@
|
|
|
6
6
|
// importing it, so the MCP stays a pure additive consumer (no edit to the shared driver file the parallel
|
|
7
7
|
// skill work may also touch). Keep SKIP_DIRS in sync with progress.mjs if that walk ever changes.
|
|
8
8
|
|
|
9
|
-
import { readdirSync
|
|
10
|
-
import { join } from "node:path";
|
|
9
|
+
import { readdirSync } from "node:fs";
|
|
10
|
+
import { basename, join } from "node:path";
|
|
11
11
|
import { channelPackage } from "../../shared/permanent-install.mjs"; // — the check a reader is sent to, on this install's channel
|
|
12
12
|
import { config, paths, reportIdentityFor } from "./driver.mjs";
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const SKIP_DIRS = new Set([DRIVER_DIR, "register-units", "queue", "_history", "_experiments"]);
|
|
17
|
-
const MAX_DEPTH = 6; // studioRoot → [archive/<YYYY-MM>/]<slug>/<date>-<codename>/status.json
|
|
18
|
-
|
|
19
|
-
function findStatusFiles(root, depth, acc) {
|
|
20
|
-
if (depth < 0) return;
|
|
21
|
-
let entries;
|
|
22
|
-
try { entries = readdirSync(root, { withFileTypes: true }); } catch { return; }
|
|
23
|
-
for (const e of entries) {
|
|
24
|
-
if (e.isFile() && e.name === "status.json") acc.push(join(root, e.name));
|
|
25
|
-
else if (e.isDirectory() && !SKIP_DIRS.has(e.name)) findStatusFiles(join(root, e.name), depth - 1, acc);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
13
|
+
import { readJson, readJsonOrNull } from "../../driver/run-record.mjs";
|
|
14
|
+
import { walkRuns, queuedStep } from "../../driver/portal-runs.mjs"; // THE one walk of the runs, shared with the portal
|
|
15
|
+
import { batchMarkName } from "../../driver/mark-name.mjs";
|
|
28
16
|
|
|
29
17
|
/**
|
|
30
18
|
* NOTHING TO READ IS NOT "NO RUNS", and the difference is what an assistant tells its user.
|
|
@@ -77,24 +65,10 @@ export function unreadableRunsReason({ workSet, workRoot, workExists, poolSet, w
|
|
|
77
65
|
}
|
|
78
66
|
|
|
79
67
|
// Every workspace-<agent>/studio/clearance-search root under the live workspace root.
|
|
80
|
-
export function studioRoots() {
|
|
81
|
-
const out = [];
|
|
82
|
-
let names = [];
|
|
83
|
-
try { names = readdirSync(config.workspaceRoot); } catch { /* workspaceRoot may be absent in test envs */ }
|
|
84
|
-
for (const name of names) {
|
|
85
|
-
const agent = config.agentIdFromWorkspaceName(name);
|
|
86
|
-
if (agent == null) continue;
|
|
87
|
-
const root = config.studioRootForAgent(agent);
|
|
88
|
-
if (existsSync(root)) out.push({ agent, root });
|
|
89
|
-
}
|
|
90
|
-
return out;
|
|
91
|
-
}
|
|
92
68
|
|
|
93
69
|
|
|
94
70
|
// Build a Run summary from a status.json path. runDir = its parent; location from the path (archive vs live).
|
|
95
|
-
function
|
|
96
|
-
const runDir = statusFile.slice(0, -"/status.json".length);
|
|
97
|
-
const s = readJsonOrNull(statusFile);
|
|
71
|
+
function runFromStatus(runDir, s, agent) {
|
|
98
72
|
if (!s || !s.slug || !s.codename) return null; // a torn/partial status.json is skipped, never thrown
|
|
99
73
|
return {
|
|
100
74
|
runId: s.runId ?? `${s.slug}-${s.date}-${s.codename}`,
|
|
@@ -152,20 +126,22 @@ function markMatches(run, mark) {
|
|
|
152
126
|
}
|
|
153
127
|
|
|
154
128
|
// All runs (newest-first), optionally filtered by agent / state / slug / mark.
|
|
155
|
-
|
|
129
|
+
//
|
|
130
|
+
// `listed` asks for the run LIST, which leaves out a run retired from the portal's list (the pool's archive tags):
|
|
131
|
+
// retiring a run takes it out of discovery on both faces. Every other caller resolves runs, and a retired run stays
|
|
132
|
+
// readable by an already-authorised caller who names it, so links already sent keep working.
|
|
133
|
+
export function enumerateRuns({ agent, state, slug, mark, listed = false } = {}) {
|
|
156
134
|
const runs = [];
|
|
157
|
-
|
|
135
|
+
const walk = walkRuns({ poolRoot: listed ? config.poolRootOrNull : null, workspaceRoot: config.workspaceRoot, archive: true, orders: false });
|
|
136
|
+
for (const { dir, agent: a, status } of walk.runs) {
|
|
158
137
|
if (agent && a !== agent) continue;
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (mark && !markMatches(r, mark)) continue;
|
|
167
|
-
runs.push(r);
|
|
168
|
-
}
|
|
138
|
+
const r = runFromStatus(dir, status, a);
|
|
139
|
+
if (!r) continue;
|
|
140
|
+
if (state && r.state !== state) continue;
|
|
141
|
+
if (slug && r.slug !== slug) continue;
|
|
142
|
+
if (mark && !markMatches(r, mark)) continue;
|
|
143
|
+
if (listed && (walk.retired.has(r.runId) || walk.retired.has(basename(dir)))) continue;
|
|
144
|
+
runs.push(r);
|
|
169
145
|
}
|
|
170
146
|
const seen = new Set();
|
|
171
147
|
return runs
|
|
@@ -173,6 +149,32 @@ export function enumerateRuns({ agent, state, slug, mark } = {}) {
|
|
|
173
149
|
.filter((r) => (seen.has(r.runId) ? false : seen.add(r.runId)));
|
|
174
150
|
}
|
|
175
151
|
|
|
152
|
+
/**
|
|
153
|
+
* THE ORDERS NO WORKER HAS CLAIMED YET, from the same walk the portal lists them from. A company that has just
|
|
154
|
+
* ordered a search sees it here as the portal shows it: queued, waiting to start. Each carries its owner, so the
|
|
155
|
+
* account gate drops another company's order exactly as it drops another company's run. Newest first.
|
|
156
|
+
*
|
|
157
|
+
* Read only for the run list: every run-addressed tool resolves runs, and an order is not one until it is claimed.
|
|
158
|
+
*/
|
|
159
|
+
export function queuedOrders({ agent, mark } = {}) {
|
|
160
|
+
const walk = walkRuns({ workspaceRoot: config.workspaceRoot, queueDirs: config.queueDirs });
|
|
161
|
+
const needle = String(mark ?? "").trim().toLowerCase();
|
|
162
|
+
const out = [];
|
|
163
|
+
for (const { lane, file, job, mtimeMs } of walk.queued) {
|
|
164
|
+
const laneAgent = config.agentIdFromQueueDir(lane) ?? config.defaultAgent;
|
|
165
|
+
if (agent && laneAgent !== agent) continue;
|
|
166
|
+
const markName = batchMarkName(job.marks, typeof job.markName === "string" && job.markName ? job.markName : undefined) ?? null;
|
|
167
|
+
const projectKey = typeof job.projectKey === "string" && job.projectKey ? job.projectKey : null;
|
|
168
|
+
if (needle && ![markName, projectKey].some((v) => String(v ?? "").toLowerCase().includes(needle))) continue;
|
|
169
|
+
const queuedAt = new Date(mtimeMs).toISOString();
|
|
170
|
+
out.push({ runId: job.id ?? file.replace(/\.json$/, ""), agent: laneAgent, account: job.profileKey ?? "generic",
|
|
171
|
+
organisation: typeof job.tenant === "string" && job.tenant ? job.tenant : null, markName, projectKey,
|
|
172
|
+
product: typeof job.product === "string" ? job.product : null, ref: job.ref ?? null, classes: job.classes ?? null,
|
|
173
|
+
queuedAt, step: queuedStep(walk.draining) });
|
|
174
|
+
}
|
|
175
|
+
return out.sort((a, b) => b.queuedAt.localeCompare(a.queuedAt));
|
|
176
|
+
}
|
|
177
|
+
|
|
176
178
|
// Resolve a run by full runId, else codename, else slug (newest match). Returns the Run + paths(P), or null.
|
|
177
179
|
export function resolveRun(idOrCodename) {
|
|
178
180
|
if (!idOrCodename) return null;
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
// lib/urgent.mjs — whether THIS installation can run an Urgent order, asked the way the run itself asks it.
|
|
4
|
+
//
|
|
5
|
+
// One answer, and it is the wall's: driver/urgent-count.mjs `urgentRunsHere`, the decision the run records at its
|
|
6
|
+
// start (steps/open-run.mjs) and admission counts by, from the engine this machine selects and the way that engine is
|
|
7
|
+
// billed. So what an assistant is told before it orders, what it is charged and how the run runs cannot differ.
|
|
8
|
+
//
|
|
9
|
+
// THE SENTENCE IS THE BOARD'S, byte for byte (the urgent-clearance board inventory, board 2): an order this
|
|
10
|
+
// installation cannot run starts at Standard, counts as one search, and its reply says so in these words.
|
|
11
|
+
import { urgentRunsHere } from "../../driver/urgent-count.mjs";
|
|
12
|
+
|
|
13
|
+
export const URGENT_UNAVAILABLE = "Not available with this installation's AI service. Searches run at Standard.";
|
|
14
|
+
|
|
15
|
+
/** `{ available }` for this installation: the wall's own answer. An engine or billing it cannot read answers no. */
|
|
16
|
+
export function urgentHere() {
|
|
17
|
+
return { available: urgentRunsHere() };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The order as this installation will run it. An Urgent order it cannot run is written as Standard, so it runs and
|
|
22
|
+
* counts as one search, and the reply carries the board's sentence. Anything other than `true` is left as sent for the
|
|
23
|
+
* shared validator to refuse or pass.
|
|
24
|
+
*/
|
|
25
|
+
export function orderUrgency(job) {
|
|
26
|
+
if (job?.urgent !== true) return { job, warnings: [] };
|
|
27
|
+
if (urgentHere().available) return { job, warnings: [] };
|
|
28
|
+
return { job: { ...job, urgent: false }, warnings: [URGENT_UNAVAILABLE] };
|
|
29
|
+
}
|
package/mcp-server/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trademark-artifacts-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-beta.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"private": true,
|
|
6
6
|
"description": "MCP server to interrogate clearotron trademark-clearance runs — list/read artifacts, trace the full decision flow, telemetry/cost, coverage, single-run search, and a gated single-step what-if. Imports the clearotron-driver read-only; touches no driver/template/deploy files.",
|