clearotron 0.5.0-beta.6 → 0.5.0-beta.8
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 +9 -1
- package/INSTALL.md +1 -1
- package/THIRD-PARTY-NOTICES.md +122 -96
- package/bin/signa-sync.mjs +1 -1
- package/build-info.json +2 -2
- package/docs/architecture/04-configuration-reference.md +2 -1
- package/docs/configuration.md +1 -1
- package/driver/CHANGELOG.md +18 -0
- package/driver/accepted-order.mjs +139 -0
- package/driver/contract-e3-backlog.mjs +31 -30
- package/driver/contract-vocabulary.mjs +1 -1
- package/driver/corrections-feedforward.mjs +29 -10
- package/driver/coverage-form.mjs +4 -3
- package/driver/coverage-ledger.mjs +6 -2
- package/driver/declination-duty.mjs +24 -2
- package/driver/declination-tool.mjs +10 -1
- package/driver/derived-state.mjs +104 -0
- package/driver/engine/CONTRACT.md +2 -2
- package/driver/engine/mcp/correction-positions.mjs +18 -0
- package/driver/engine/mcp/gather-config.mjs +7 -3
- package/driver/engine/mcp/recording-server.mjs +8 -4
- package/driver/engine/openai-agent.mjs +3 -2
- package/driver/finding-citations.mjs +38 -0
- package/driver/findings-model.mjs +4 -2
- package/driver/gateway.mjs +26 -16
- package/driver/goods-evidence.mjs +37 -1
- package/driver/narrative-refutation-record.mjs +36 -4
- package/driver/not-searched-sentences.mjs +118 -0
- package/driver/package.json +1 -1
- package/driver/pipeline.mjs +435 -82
- package/driver/predelivery-lint.mjs +72 -17
- package/driver/publish/audit-from-spine.mjs +8 -2
- package/driver/publish/email-conditions.mjs +21 -0
- package/driver/publish/index.mjs +19 -5
- package/driver/register-plan.mjs +8 -44
- package/driver/repair-composers.mjs +62 -20
- package/driver/repair-targets.mjs +11 -31
- package/driver/replay-archive.mjs +2 -2
- package/driver/research-answers.mjs +47 -2
- package/driver/skeptic-search.mjs +4 -2
- package/driver/skills/clearance-register/SKILL.md +4 -10
- package/driver/skills/clearance-register/providers/signa.md +6 -4
- package/driver/skills/clearance-search/SKILL.md +2 -2
- package/driver/skills/clearance-search/phase2-execution.md +1 -1
- package/driver/skills/narrative-refutation/SKILL.md +7 -10
- package/driver/stage-context.mjs +47 -3
- package/driver/stages.mjs +63 -7
- package/driver/suite-census.json +109 -19
- package/driver/synthesis-record.mjs +165 -33
- package/driver/verify.mjs +11 -1
- package/mcp-server/CHANGELOG.md +8 -0
- package/mcp-server/package.json +1 -1
- package/node_modules/@isaacs/nonrecursive-glob-match/LICENSE.md +55 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/README.md +333 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts +114 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js +762 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.min.js.map +7 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/package.json +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts +4 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js +142 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts +114 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js +758 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/index.min.js.map +7 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/package.json +3 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts +4 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.d.ts.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js +138 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/dist/esm/parse-class.js.map +1 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/package.json +56 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/src/index.ts +900 -0
- package/node_modules/@isaacs/nonrecursive-glob-match/src/parse-class.ts +158 -0
- package/node_modules/balanced-match/LICENSE.md +3 -1
- package/node_modules/balanced-match/README.md +15 -55
- package/node_modules/balanced-match/dist/commonjs/index.d.ts +9 -0
- package/node_modules/balanced-match/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
- package/node_modules/balanced-match/dist/commonjs/index.js.map +1 -0
- package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
- package/node_modules/balanced-match/dist/esm/index.d.ts +9 -0
- package/node_modules/balanced-match/dist/esm/index.d.ts.map +1 -0
- package/node_modules/balanced-match/dist/esm/index.js +54 -0
- package/node_modules/balanced-match/dist/esm/index.js.map +1 -0
- package/node_modules/balanced-match/dist/esm/package.json +3 -0
- package/node_modules/balanced-match/package.json +48 -28
- package/node_modules/brace-expansion/LICENSE +3 -1
- package/node_modules/brace-expansion/README.md +10 -56
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts +12 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/brace-expansion/dist/commonjs/index.js +333 -0
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -0
- package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
- package/node_modules/brace-expansion/dist/esm/index.d.ts +12 -0
- package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -0
- package/node_modules/brace-expansion/dist/esm/index.js +329 -0
- package/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
- package/node_modules/brace-expansion/dist/esm/package.json +3 -0
- package/node_modules/brace-expansion/package.json +52 -37
- package/node_modules/minimatch/LICENSE.md +55 -0
- package/node_modules/minimatch/README.md +388 -109
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
- package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
- package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts +185 -0
- package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/index.js +1550 -0
- package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
- package/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
- package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
- package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
- package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
- package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/escape.js +26 -0
- package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
- package/node_modules/minimatch/dist/esm/index.d.ts +185 -0
- package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/index.js +1539 -0
- package/node_modules/minimatch/dist/esm/index.js.map +1 -0
- package/node_modules/minimatch/dist/esm/package.json +3 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
- package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
- package/node_modules/minimatch/dist/esm/unescape.js +34 -0
- package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
- package/node_modules/minimatch/package.json +58 -17
- package/package.json +1 -1
- package/portal-ui/package.json +1 -1
- package/providers/README.md +1 -1
- package/providers/_shared/execute-plan.mjs +22 -2
- package/providers/clarivate/src/core.js +13 -3
- package/providers/euipo/src/core.js +3 -2
- package/providers/oauth-mcp-bridge/CHANGELOG.md +8 -0
- package/providers/oauth-mcp-bridge/package.json +1 -1
- package/providers/signa/src/offices.generated.js +15 -13
- package/scripts/e2e-first-time.mjs +1 -1
- package/scripts/freeze-example-run.mjs +6 -6
- package/scripts/release-notes-lint.mjs +5 -3
- package/scripts/third-party-notices.mjs +12 -0
- package/shared/names-in-force.mjs +1 -0
- package/shared/register-selection.mjs +2 -2
- package/node_modules/balanced-match/.github/FUNDING.yml +0 -2
- package/node_modules/balanced-match/index.js +0 -62
- package/node_modules/brace-expansion/index.js +0 -438
- package/node_modules/concat-map/.travis.yml +0 -4
- package/node_modules/concat-map/LICENSE +0 -18
- package/node_modules/concat-map/README.markdown +0 -62
- package/node_modules/concat-map/example/map.js +0 -6
- package/node_modules/concat-map/index.js +0 -13
- package/node_modules/concat-map/package.json +0 -43
- package/node_modules/concat-map/test/map.js +0 -39
- package/node_modules/minimatch/LICENSE +0 -15
- package/node_modules/minimatch/minimatch.js +0 -1005
- package/node_modules/readdir-glob/node_modules/brace-expansion/.github/FUNDING.yml +0 -2
- package/node_modules/readdir-glob/node_modules/brace-expansion/LICENSE +0 -21
- package/node_modules/readdir-glob/node_modules/brace-expansion/README.md +0 -157
- package/node_modules/readdir-glob/node_modules/brace-expansion/index.js +0 -394
- package/node_modules/readdir-glob/node_modules/brace-expansion/package.json +0 -49
- package/node_modules/readdir-glob/node_modules/minimatch/LICENSE +0 -15
- package/node_modules/readdir-glob/node_modules/minimatch/README.md +0 -296
- package/node_modules/readdir-glob/node_modules/minimatch/lib/path.js +0 -4
- package/node_modules/readdir-glob/node_modules/minimatch/minimatch.js +0 -996
- package/node_modules/readdir-glob/node_modules/minimatch/package.json +0 -35
package/.env.example
CHANGED
|
@@ -191,6 +191,14 @@ CLEAROTRON_DATABASE=clarivate
|
|
|
191
191
|
# effect: tuning
|
|
192
192
|
CLEAROTRON_GATHER_SEND_UNTIL_MS=
|
|
193
193
|
#
|
|
194
|
+
# The records a correction's flags name, as a JSON list: the writer's save may add a finding for an
|
|
195
|
+
# excluded position that holds one of them. The driver writes it into the tool servers' env when it
|
|
196
|
+
# dispatches the correction and the correction's re-emit, and leaves it out of every other dispatch.
|
|
197
|
+
# Leave it empty: a stage's program starts with a listed environment that does not carry this name
|
|
198
|
+
# (driver/engine/engine-env.mjs), so a value set here reaches no tool server.
|
|
199
|
+
# effect: silent-output-change
|
|
200
|
+
CLEAROTRON_CORRECTION_POSITIONS=
|
|
201
|
+
#
|
|
194
202
|
# THERE IS NO RETENTION SETTING AND NO CLEANUP JOB. CLEAROTRON_REGISTER_LEDGER_MAX_BYTES,
|
|
195
203
|
# CLEAROTRON_REGISTER_LEDGER_KEEP and `npm run prune:ledger` are gone with the rotation tool, because the
|
|
196
204
|
# thing they bounded no longer grows: RECORD BODIES ARE WRITTEN INTO THE RUN'S OWN DIRECTORY
|
|
@@ -279,7 +287,7 @@ OPENAI_API_KEY=
|
|
|
279
287
|
# reason worth knowing before you leave it unset: an unset variable took Corsearch in silence, and the
|
|
280
288
|
# credential guard could not catch it because both boxes carried CORSEARCH_SESSION_KEY.
|
|
281
289
|
#
|
|
282
|
-
# ADR-0001 recommends Signa, not Corsearch: one self-serve key, US + EU + WIPO and
|
|
290
|
+
# ADR-0001 recommends Signa, not Corsearch: one self-serve key, US + EU + WIPO and ten more offices.
|
|
283
291
|
#
|
|
284
292
|
# Corsearch.
|
|
285
293
|
CORSEARCH_SESSION_KEY=changeme
|
package/INSTALL.md
CHANGED
|
@@ -117,7 +117,7 @@ run is [mcp-server/CONNECT.md](mcp-server/CONNECT.md), and why something is the
|
|
|
117
117
|
Which register you pick is the first real decision, and the tiers are not equally easy to reach.
|
|
118
118
|
[providers/README.md](providers/README.md) is the canonical ladder and
|
|
119
119
|
[ADR-0001](docs/decisions/0001-register-ladder.md) is the reasoning. The short version: **Signa** is
|
|
120
|
-
the recommended route (one self-serve key,
|
|
120
|
+
the recommended route (one self-serve key, thirteen offices), **`free-tier`** is EU + US with no vendor
|
|
121
121
|
contract but a 41.5 GB build for the US half (§3a), and **Corsearch / Clarivate** are the widest
|
|
122
122
|
coverage on a vendor-issued credential. Whatever the chosen register cannot reach becomes a disclosed
|
|
123
123
|
deferred-coverage row rather than a silent gap, at every tier.
|
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -9,7 +9,7 @@ file rather than a courtesy.
|
|
|
9
9
|
production tree; `--check` fails when it no longer matches. Development dependencies are excluded:
|
|
10
10
|
they are not distributed, so they carry no obligation for anyone who installs this.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
176 packages.
|
|
13
13
|
|
|
14
14
|
> **Declared but NOT INSTALLED, so not distributed and not attributed below:** `@cfworker/json-schema`.
|
|
15
15
|
> npm lists these with no version and no path — an unmet or optional peer. Recorded because a name
|
|
@@ -110,6 +110,69 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
110
110
|
SOFTWARE.
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
## @isaacs/nonrecursive-glob-match@1.0.3
|
|
114
|
+
|
|
115
|
+
- **Licence declared:** `BlueOak-1.0.0`
|
|
116
|
+
- **Licence file:** `LICENSE.md`
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
# Blue Oak Model License
|
|
120
|
+
|
|
121
|
+
Version 1.0.0
|
|
122
|
+
|
|
123
|
+
## Purpose
|
|
124
|
+
|
|
125
|
+
This license gives everyone as much permission to work with
|
|
126
|
+
this software as possible, while protecting contributors
|
|
127
|
+
from liability.
|
|
128
|
+
|
|
129
|
+
## Acceptance
|
|
130
|
+
|
|
131
|
+
In order to receive this license, you must agree to its
|
|
132
|
+
rules. The rules of this license are both obligations
|
|
133
|
+
under that agreement and conditions to your license.
|
|
134
|
+
You must not do anything with this software that triggers
|
|
135
|
+
a rule that you cannot or will not follow.
|
|
136
|
+
|
|
137
|
+
## Copyright
|
|
138
|
+
|
|
139
|
+
Each contributor licenses you to do everything with this
|
|
140
|
+
software that would otherwise infringe that contributor's
|
|
141
|
+
copyright in it.
|
|
142
|
+
|
|
143
|
+
## Notices
|
|
144
|
+
|
|
145
|
+
You must ensure that everyone who gets a copy of
|
|
146
|
+
any part of this software from you, with or without
|
|
147
|
+
changes, also gets the text of this license or a link to
|
|
148
|
+
<https://blueoakcouncil.org/license/1.0.0>.
|
|
149
|
+
|
|
150
|
+
## Excuse
|
|
151
|
+
|
|
152
|
+
If anyone notifies you in writing that you have not
|
|
153
|
+
complied with [Notices](#notices), you can keep your
|
|
154
|
+
license by taking all practical steps to comply within 30
|
|
155
|
+
days after the notice. If you do not do so, your license
|
|
156
|
+
ends immediately.
|
|
157
|
+
|
|
158
|
+
## Patent
|
|
159
|
+
|
|
160
|
+
Each contributor licenses you to do everything with this
|
|
161
|
+
software that would otherwise infringe any patent claims
|
|
162
|
+
they can license or become able to license.
|
|
163
|
+
|
|
164
|
+
## Reliability
|
|
165
|
+
|
|
166
|
+
No contributor can revoke this license.
|
|
167
|
+
|
|
168
|
+
## No Liability
|
|
169
|
+
|
|
170
|
+
***As far as the law allows, this software comes as is,
|
|
171
|
+
without any warranty or condition, and no contributor
|
|
172
|
+
will be liable to anyone for any damages related to this
|
|
173
|
+
software or this license, under any kind of legal claim.***
|
|
174
|
+
```
|
|
175
|
+
|
|
113
176
|
## @modelcontextprotocol/sdk@1.32.1
|
|
114
177
|
|
|
115
178
|
- **Licence declared:** `MIT`
|
|
@@ -383,7 +446,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
383
446
|
THE SOFTWARE.
|
|
384
447
|
```
|
|
385
448
|
|
|
386
|
-
## balanced-match@
|
|
449
|
+
## balanced-match@4.0.4
|
|
387
450
|
|
|
388
451
|
- **Licence declared:** `MIT`
|
|
389
452
|
- **Repository:** git://github.com/juliangruber/balanced-match
|
|
@@ -392,7 +455,9 @@ THE SOFTWARE.
|
|
|
392
455
|
```
|
|
393
456
|
(MIT)
|
|
394
457
|
|
|
395
|
-
|
|
458
|
+
Original code Copyright Julian Gruber <julian@juliangruber.com>
|
|
459
|
+
|
|
460
|
+
Port to TypeScript Copyright Isaac Z. Schlueter <i@izs.me>
|
|
396
461
|
|
|
397
462
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
398
463
|
this software and associated documentation files (the "Software"), to deal in
|
|
@@ -566,46 +631,18 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
566
631
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
567
632
|
```
|
|
568
633
|
|
|
569
|
-
## brace-expansion@
|
|
634
|
+
## brace-expansion@5.0.12
|
|
570
635
|
|
|
571
636
|
- **Licence declared:** `MIT`
|
|
572
|
-
- **Repository:**
|
|
637
|
+
- **Repository:** https://github.com/juliangruber/brace-expansion
|
|
573
638
|
- **Licence file:** `LICENSE`
|
|
574
639
|
|
|
575
640
|
```
|
|
576
641
|
MIT License
|
|
577
642
|
|
|
578
|
-
Copyright
|
|
643
|
+
Copyright Julian Gruber <julian@juliangruber.com>
|
|
579
644
|
|
|
580
|
-
|
|
581
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
582
|
-
in the Software without restriction, including without limitation the rights
|
|
583
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
584
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
585
|
-
furnished to do so, subject to the following conditions:
|
|
586
|
-
|
|
587
|
-
The above copyright notice and this permission notice shall be included in all
|
|
588
|
-
copies or substantial portions of the Software.
|
|
589
|
-
|
|
590
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
591
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
592
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
593
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
594
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
595
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
596
|
-
SOFTWARE.
|
|
597
|
-
```
|
|
598
|
-
|
|
599
|
-
## brace-expansion@2.1.7
|
|
600
|
-
|
|
601
|
-
- **Licence declared:** `MIT`
|
|
602
|
-
- **Repository:** git://github.com/juliangruber/brace-expansion
|
|
603
|
-
- **Licence file:** `LICENSE`
|
|
604
|
-
|
|
605
|
-
```
|
|
606
|
-
MIT License
|
|
607
|
-
|
|
608
|
-
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
|
645
|
+
TypeScript port Copyright Isaac Z. Schlueter <i@izs.me>
|
|
609
646
|
|
|
610
647
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
611
648
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -843,33 +880,6 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
843
880
|
OTHER DEALINGS IN THE SOFTWARE.
|
|
844
881
|
```
|
|
845
882
|
|
|
846
|
-
## concat-map@0.0.1
|
|
847
|
-
|
|
848
|
-
- **Licence declared:** `MIT`
|
|
849
|
-
- **Repository:** git://github.com/substack/node-concat-map
|
|
850
|
-
- **Licence file:** `LICENSE`
|
|
851
|
-
|
|
852
|
-
```
|
|
853
|
-
This software is released under the MIT license:
|
|
854
|
-
|
|
855
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
856
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
857
|
-
the Software without restriction, including without limitation the rights to
|
|
858
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
859
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
860
|
-
subject to the following conditions:
|
|
861
|
-
|
|
862
|
-
The above copyright notice and this permission notice shall be included in all
|
|
863
|
-
copies or substantial portions of the Software.
|
|
864
|
-
|
|
865
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
866
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
867
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
868
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
869
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
870
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
871
|
-
```
|
|
872
|
-
|
|
873
883
|
## content-disposition@1.1.0
|
|
874
884
|
|
|
875
885
|
- **Licence declared:** `MIT`
|
|
@@ -4415,52 +4425,68 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
4415
4425
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
4416
4426
|
```
|
|
4417
4427
|
|
|
4418
|
-
## minimatch@
|
|
4428
|
+
## minimatch@11.0.3
|
|
4419
4429
|
|
|
4420
|
-
- **Licence declared:** `
|
|
4421
|
-
- **Repository:** git
|
|
4422
|
-
- **Licence file:** `LICENSE`
|
|
4430
|
+
- **Licence declared:** `BlueOak-1.0.0`
|
|
4431
|
+
- **Repository:** git@github.com:isaacs/minimatch
|
|
4432
|
+
- **Licence file:** `LICENSE.md`
|
|
4423
4433
|
|
|
4424
4434
|
```
|
|
4425
|
-
|
|
4435
|
+
# Blue Oak Model License
|
|
4426
4436
|
|
|
4427
|
-
|
|
4437
|
+
Version 1.0.0
|
|
4428
4438
|
|
|
4429
|
-
|
|
4430
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
4431
|
-
copyright notice and this permission notice appear in all copies.
|
|
4439
|
+
## Purpose
|
|
4432
4440
|
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
4437
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
4438
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
4439
|
-
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
4440
|
-
```
|
|
4441
|
+
This license gives everyone as much permission to work with
|
|
4442
|
+
this software as possible, while protecting contributors
|
|
4443
|
+
from liability.
|
|
4441
4444
|
|
|
4442
|
-
##
|
|
4445
|
+
## Acceptance
|
|
4443
4446
|
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
+
In order to receive this license, you must agree to its
|
|
4448
|
+
rules. The rules of this license are both obligations
|
|
4449
|
+
under that agreement and conditions to your license.
|
|
4450
|
+
You must not do anything with this software that triggers
|
|
4451
|
+
a rule that you cannot or will not follow.
|
|
4447
4452
|
|
|
4448
|
-
|
|
4449
|
-
The ISC License
|
|
4453
|
+
## Copyright
|
|
4450
4454
|
|
|
4451
|
-
|
|
4455
|
+
Each contributor licenses you to do everything with this
|
|
4456
|
+
software that would otherwise infringe that contributor's
|
|
4457
|
+
copyright in it.
|
|
4452
4458
|
|
|
4453
|
-
|
|
4454
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
4455
|
-
copyright notice and this permission notice appear in all copies.
|
|
4459
|
+
## Notices
|
|
4456
4460
|
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4461
|
+
You must ensure that everyone who gets a copy of
|
|
4462
|
+
any part of this software from you, with or without
|
|
4463
|
+
changes, also gets the text of this license or a link to
|
|
4464
|
+
<https://blueoakcouncil.org/license/1.0.0>.
|
|
4465
|
+
|
|
4466
|
+
## Excuse
|
|
4467
|
+
|
|
4468
|
+
If anyone notifies you in writing that you have not
|
|
4469
|
+
complied with [Notices](#notices), you can keep your
|
|
4470
|
+
license by taking all practical steps to comply within 30
|
|
4471
|
+
days after the notice. If you do not do so, your license
|
|
4472
|
+
ends immediately.
|
|
4473
|
+
|
|
4474
|
+
## Patent
|
|
4475
|
+
|
|
4476
|
+
Each contributor licenses you to do everything with this
|
|
4477
|
+
software that would otherwise infringe any patent claims
|
|
4478
|
+
they can license or become able to license.
|
|
4479
|
+
|
|
4480
|
+
## Reliability
|
|
4481
|
+
|
|
4482
|
+
No contributor can revoke this license.
|
|
4483
|
+
|
|
4484
|
+
## No Liability
|
|
4485
|
+
|
|
4486
|
+
**_As far as the law allows, this software comes as is,
|
|
4487
|
+
without any warranty or condition, and no contributor
|
|
4488
|
+
will be liable to anyone for any damages related to this
|
|
4489
|
+
software or this license, under any kind of legal claim._**
|
|
4464
4490
|
```
|
|
4465
4491
|
|
|
4466
4492
|
## minimist@1.2.8
|
package/bin/signa-sync.mjs
CHANGED
|
@@ -104,7 +104,7 @@ if (!live.length) die(`${offices.length} office(s) returned and NONE is status:l
|
|
|
104
104
|
const stamp = String(process.env.SIGNA_SYNC_STAMP ?? "").trim() || new Date().toISOString();
|
|
105
105
|
|
|
106
106
|
const body = `// SPDX-License-Identifier: AGPL-3.0-only
|
|
107
|
-
// Copyright 2026 Cordillera Sàrl
|
|
107
|
+
// Copyright 2026 Cordillera Sàrl. Additional terms under section 7 of the AGPL-3.0 apply — see ADDITIONAL-TERMS.md
|
|
108
108
|
// GENERATED by bin/signa-sync.mjs — do not edit by hand.
|
|
109
109
|
//
|
|
110
110
|
// This is the vendor's own office list, fetched and committed so that a change in what we claim to
|
package/build-info.json
CHANGED
|
@@ -78,7 +78,7 @@ does after the stage's full retry ladder fails ([03 §5](03-run-lifecycle.md#5--
|
|
|
78
78
|
| 3 | `blind-frame` | opus · high | 600 / 450 | `blind-frame-model.json` (strict-parsed; the prose twin was retired 2026-08-03 — nothing read it) | non-fatal (frame-diff skipped this run) |
|
|
79
79
|
| 4 | `common-law` | haiku · low | 2250 / 1100 | `common-law-findings.md` (+ grid ledger, plugin-written) | fatal at fan-in |
|
|
80
80
|
| 5 | `common-law-half` | per seat: `COMMON_LAW_SEAT_TIER` — halves `a`/`b` haiku · low; meaning seat `m` `CLEAROTRON_MEANING_SEAT_MODEL` \|\| haiku · low | 2250 / 1100 | `common-law-findings.half-{a,b,m}.md` (+ per-seat grid ledgers) | fatal at fan-in; one-half transient quarantine allowed |
|
|
81
|
-
| 6 | `register-unit` | per axis: `
|
|
81
|
+
| 6 | `register-unit` | per axis: `primary-sweep` opus · adaptive (`PRIMARY_SWEEP_TIER`, from 2026-10-30); `transliteration-numeric` and `incumbent-class` sonnet · adaptive; `saturation-probe` haiku · off | 1500 / 1100 | `register-units/<axis>.md` + `<axis>-band.json` (plan mode: tool-written, qid-stamped) | fatal at fan-in (after band-vocabulary quarantine / collapsed-band repair) |
|
|
82
82
|
| 7 | `placement-inquiry` | opus · high | 2700 / 600 | `placement-recommendations.md` | fatal |
|
|
83
83
|
| 8 | `register-digest` | opus · **low** (was high until 2026-08-01 — 3.49× wall/output against a 1.03× fixed-effort control, with no detectable effect on which records it tiers; override an arm with `CLEAROTRON_STAGE_THINKING`) | 2400 / 900 | `register-findings.md` (coverage-ledger JSON is code-derived from its prose) | fatal (every digest pass) |
|
|
84
84
|
| 9 | `skeptic` | sonnet · high | 600 / 600 | `skeptic-flags.md` (verbatim `ESCALATE: <axis>` lines) | non-fatal (no escalation on failure) |
|
|
@@ -375,6 +375,7 @@ cannot be read as one list.
|
|
|
375
375
|
| `CLEAROTRON_GATHER_SESSION_KEY` / `CLEAROTRON_GATHER_AGENT` / `CLEAROTRON_GATHER_SESSION_ID` | set per stage | Telemetry attribution into the provider-call ledger (set by the gather config; not operator-set). |
|
|
376
376
|
| `CLEAROTRON_GATHER_SEND_UNTIL_MS` | set per turn | When a turn's register tools stop sending new questions: a quarter of the turn, at most five minutes, ahead of its deadline (set by the gather config; not operator-set). |
|
|
377
377
|
| `CLEAROTRON_RECORD_AXIS` | set per dispatch (unset ⇒ the stage is not fanned out) | Binds one fan-out turn of a recording stage to the single member it may write. `stageOnce` suffixes a fan-out stage's label with its axis, the gather config resolves `<stage>:<axis>` back to the base stage's tool group, and this carries the axis to the recording server. A call whose payload names a different member than the turn is bound to is REFUSED, so a seat cannot write into a sibling's file — without the binding every turn of the fan-out would record over member one. Set by the driver; not operator-set. |
|
|
378
|
+
| `CLEAROTRON_CORRECTION_POSITIONS` | set per dispatch (unset ⇒ the dispatch is not a correction's) | The excluded positions named by the review flags a correction answers, as a JSON list of record ids, carried to the recording server for that correction's dispatch and its retries. The writer's save may add a finding for one of those positions; on any other dispatch it adds none (set by the gather config; not operator-set). |
|
|
378
379
|
| `PORTAL_READ_MODEL` | `sonnet` | The model the portal's own compose-read turn uses. Distinct from the pipeline's tiers: this is a portal surface, not a stage. |
|
|
379
380
|
| `CLEAROTRON_ORDER_PROBE_SEED` | unset | Seed for `scripts/band-shape-probe.mjs`, so an ordering probe can be replayed. A diagnostic script's knob, not a run's. |
|
|
380
381
|
| `PROBE_TERM` | `DELTA` | The mark word `providers/uspto-local/bin/verify-index.mjs` searches when verifying a built local USPTO index. A diagnostic script's knob, not a run's. Change it when a row reports MEASURES NOTHING: that means the term had no exact hit, so the row's timing is not a result. |
|
package/docs/configuration.md
CHANGED
|
@@ -22,7 +22,7 @@ that:
|
|
|
22
22
|
|
|
23
23
|
| | Provider | How you get it | Coverage |
|
|
24
24
|
|---|---|---|---|
|
|
25
|
-
| **1 — recommended** | `signa` | **Self-serve API key**, issued from the vendor's site. No sales call |
|
|
25
|
+
| **1 — recommended** | `signa` | **Self-serve API key**, issued from the vendor's site. No sales call | 13 offices: US, EU, WIPO/Madrid + 10 |
|
|
26
26
|
| **2 — free, with real limits** | `free-tier` (`euipo` + `uspto-local`) | Two free accounts, and a 41.5 GB local build for the US half | EU + US, and nothing else. No sound-alike search |
|
|
27
27
|
| **3 — widest coverage** | `corsearch`, `clarivate` | Credential issued by the vendor | Global; Clarivate reaches 186 offices |
|
|
28
28
|
|
package/driver/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# clearotron-driver
|
|
2
2
|
|
|
3
|
+
## 0.5.0-beta.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed: A conflict the reviewing step sends back for correction can now be reported as a finding; the correction could previously change only findings already in the report.
|
|
8
|
+
- New: Searches on the Signa register now reach Spain and Mexico, so an order naming either country is searched there rather than reported as not covered.
|
|
9
|
+
|
|
10
|
+
## 0.5.0-beta.7
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Fixed: When deciding whether a wider register search is worth running, the engine now uses its strongest model, so a conflict found only by a wider search is no longer skipped.
|
|
15
|
+
- Fixed: A search the register refused is now recorded with the register's own reason, and a search the engine itself declined to send is no longer reported as a register error.
|
|
16
|
+
- Fixed: A run repaired after a failure now keeps the original order, including who sent it and their instructions, instead of rebuilding a partial one.
|
|
17
|
+
- Fixed: An overview that cites a finding no longer in the report is now sent back for correction before delivery, and flagged for the reviewing lawyer if the citation remains.
|
|
18
|
+
- Fixed: The audit now states in plain words why each unsearched question was not carried out.
|
|
19
|
+
- Fixed: The reviewing step now sees every conflict the writer set aside, with the writer's reason, and can send one back for correction.
|
|
20
|
+
|
|
3
21
|
## 0.5.0-beta.6
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
//
|
|
4
|
+
// accepted-order.mjs — the order a run was accepted on, kept with the run from intake, and the job a resume or a
|
|
5
|
+
// stage replay rebuilds from it.
|
|
6
|
+
//
|
|
7
|
+
// THE DEFECT. The queue entry carrying an order is consumed when its run starts, and the run kept only what status.json
|
|
8
|
+
// and the instructed scope hold: its identity, the marks by name, the goods, the applicant and the territories. A run
|
|
9
|
+
// repaired with `--resume` was rebuilt without the order's delivery routing, so its delivery packet named no forwarder
|
|
10
|
+
// address and no message to answer, and a stage replayed with `--experiment` lost the stated use, the campaign facts and
|
|
11
|
+
// the requester's instructions. A run that failed before delivering keeps the routing nowhere else, and that is the run
|
|
12
|
+
// a resume repairs.
|
|
13
|
+
//
|
|
14
|
+
// SO THE RUN KEEPS ITS ORDER WHOLE, at intake, before any stage can fail: `_driver/accepted-order.json`, written once and
|
|
15
|
+
// never rewritten. A resume or replay that is given no job file reconstructs the order from it. An order given again
|
|
16
|
+
// explicitly, by a resume with `--job`, that differs from the original is kept beside it as an amendment; the original
|
|
17
|
+
// stays. The file is private run data like the rest of the run directory. No stage's context lists it: no model needs
|
|
18
|
+
// the routing.
|
|
19
|
+
//
|
|
20
|
+
// AN OLDER RUN HAS NO SUCH FILE. For it the order is taken from the run's own queue entry where that survives, matched
|
|
21
|
+
// by the order's id and checked against the run's frozen scope and account: a conflict refuses the queue entry whole,
|
|
22
|
+
// never field by field. Taken from there, it is kept as the run's accepted order, so the run no longer depends on the
|
|
23
|
+
// queue entry. Where neither survives, the job is rebuilt from status as before, and the fields only the order held are
|
|
24
|
+
// named as unrecovered, internally: nothing is invented in their place, no address is borrowed from the account or
|
|
25
|
+
// another order, and a replay on such a job is not a faithful one.
|
|
26
|
+
|
|
27
|
+
import { existsSync, readFileSync, appendFileSync } from "node:fs";
|
|
28
|
+
import { join } from "node:path";
|
|
29
|
+
import { driverDir, ensureDriverDir } from "../shared/driver-dir.mjs";
|
|
30
|
+
import { atomicWrite } from "./progress.mjs";
|
|
31
|
+
|
|
32
|
+
export const ACCEPTED_ORDER_FILE = "accepted-order.json";
|
|
33
|
+
export const ORDER_AMENDMENTS_FILE = "order-amendments.jsonl";
|
|
34
|
+
export const ORDER_RECOVERY_FILE = "order-recovery.json";
|
|
35
|
+
|
|
36
|
+
/** The fields only the order holds: what a rebuild from status cannot say. Each mark entry's own `ref` and `classes`
|
|
37
|
+
* are named as `marks[].ref` and `marks[].classes`. */
|
|
38
|
+
export const ORDER_ONLY_FIELDS = Object.freeze(["forwarderEmail", "msgId", "conversationId", "clientPrincipal",
|
|
39
|
+
"priorUse", "campaignShape", "upfrontInstructions", "marks[].ref", "marks[].classes"]);
|
|
40
|
+
|
|
41
|
+
/** A copy of the order as it was accepted, untouched by anything the run does to its job later. null for no order. PURE. */
|
|
42
|
+
export function orderSnapshot(job) {
|
|
43
|
+
if (!job || typeof job !== "object" || Array.isArray(job)) return null;
|
|
44
|
+
try { return JSON.parse(JSON.stringify(job)); } catch { return null; }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const readJson = (file) => { try { return existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : null; } catch { return null; } };
|
|
48
|
+
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
49
|
+
|
|
50
|
+
/** The order this run was accepted on, or null when the run holds none (an older run, or an unreadable file). */
|
|
51
|
+
export function readAcceptedOrder(runDir) {
|
|
52
|
+
const rec = readJson(driverDir(String(runDir ?? ""), ACCEPTED_ORDER_FILE));
|
|
53
|
+
return rec?.order && typeof rec.order === "object" ? rec.order : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Keep the order with the run. The first order a run is given is written and never rewritten. A later order changes
|
|
58
|
+
* nothing unless it was given explicitly (`explicit`, a job file on a resume) and differs from the original and from
|
|
59
|
+
* the last amendment; then it is appended as an amendment. A job rebuilt by this run's own resume is never kept as the
|
|
60
|
+
* accepted order (`rebuilt`): a reconstruction is not the order. `from` names where a written order came from.
|
|
61
|
+
* Returns what it did: "written", "amended", "kept", or "not-kept".
|
|
62
|
+
*/
|
|
63
|
+
export function retainAcceptedOrder(runDir, order, { explicit = false, rebuilt = false, from = "intake", now = () => new Date().toISOString() } = {}) {
|
|
64
|
+
if (!runDir || !order) return "not-kept";
|
|
65
|
+
const file = driverDir(runDir, ACCEPTED_ORDER_FILE);
|
|
66
|
+
const original = readAcceptedOrder(runDir);
|
|
67
|
+
if (!original) {
|
|
68
|
+
if (rebuilt || existsSync(file)) return "not-kept"; // an unreadable file is the run's record still: never replaced
|
|
69
|
+
ensureDriverDir(runDir);
|
|
70
|
+
atomicWrite(file, JSON.stringify({ ts: now(), from, order }, null, 2) + "\n");
|
|
71
|
+
return "written";
|
|
72
|
+
}
|
|
73
|
+
if (!explicit || rebuilt || same(order, original)) return "kept";
|
|
74
|
+
const amendments = driverDir(runDir, ORDER_AMENDMENTS_FILE);
|
|
75
|
+
let last = null;
|
|
76
|
+
try { last = readFileSync(amendments, "utf8").split("\n").filter(Boolean).map((l) => JSON.parse(l)).pop()?.order ?? null; } catch { /* none yet */ }
|
|
77
|
+
if (last && same(order, last)) return "kept";
|
|
78
|
+
appendFileSync(amendments, JSON.stringify({ ts: now(), order }) + "\n");
|
|
79
|
+
return "amended";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** The run's retained queue entry for order `id`: a finished one (`.done`) or a failed one (`.failed`). null when
|
|
83
|
+
* neither survives or it does not hold that order. */
|
|
84
|
+
export function retainedQueueOrder(queueDir, id) {
|
|
85
|
+
if (!queueDir || !id || /[\\/]/.test(String(id))) return null;
|
|
86
|
+
for (const end of [".done", ".failed"]) {
|
|
87
|
+
const order = readJson(join(queueDir, `${id}${end}`));
|
|
88
|
+
if (order && typeof order === "object" && order.id === id) return order;
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Why a retained queue entry is not this run's order, or null when it agrees with everything the run froze of its
|
|
95
|
+
* order: its identity in status, its instructed scope (read through `scopeOf`, the run's own reading of a job), and the
|
|
96
|
+
* account in its frozen profile where the order named one. PURE.
|
|
97
|
+
*/
|
|
98
|
+
export function queueOrderConflict(order, { status = null, scope = null, profile = null, scopeOf } = {}) {
|
|
99
|
+
for (const k of ["id", "ref", "markName"])
|
|
100
|
+
if (status?.[k] != null && order?.[k] != null && String(status[k]) !== String(order[k])) return `its ${k} differs from the run's`;
|
|
101
|
+
if (scope && typeof scopeOf === "function") {
|
|
102
|
+
const theirs = scopeOf(order);
|
|
103
|
+
for (const k of ["marks", "classes", "jurisdictions", "goods", "customer"])
|
|
104
|
+
if (!same(theirs?.[k] ?? null, scope?.[k] ?? null)) return `its ${k === "customer" ? "applicant" : k} differs from the run's instructed scope`;
|
|
105
|
+
}
|
|
106
|
+
if (typeof order?.profileKey === "string" && order.profileKey && typeof profile?.profileKey === "string" && profile.profileKey
|
|
107
|
+
&& order.profileKey !== profile.profileKey) return "its account differs from the run's frozen profile";
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The job a resume or replay given no job file runs on, and where it came from:
|
|
113
|
+
* - "accepted-order": the order the run kept at intake, whole;
|
|
114
|
+
* - "queue-order": an older run's retained queue entry, matched and checked, then kept as the run's accepted order;
|
|
115
|
+
* - "status": neither survives, or the queue entry conflicts; the job is `fromStatus()`, and `unrecovered` names the
|
|
116
|
+
* fields only the order held.
|
|
117
|
+
* `conflict` says why a queue entry was refused. A resume (`write`) records the answer in `_driver/order-recovery.json`,
|
|
118
|
+
* field names and never values, and keeps a matched queue entry as the run's order; a stage replay writes nothing into
|
|
119
|
+
* the run it studies, and its receipt carries the answer instead.
|
|
120
|
+
*/
|
|
121
|
+
export function rebuildRunOrder({ runDir, status = null, scope = null, profile = null, queueDir = null, scopeOf, fromStatus, write = true, now = () => new Date().toISOString() }) {
|
|
122
|
+
let out;
|
|
123
|
+
const accepted = readAcceptedOrder(runDir);
|
|
124
|
+
if (accepted) out = { job: accepted, source: "accepted-order", unrecovered: [], conflict: null };
|
|
125
|
+
else {
|
|
126
|
+
const queued = retainedQueueOrder(queueDir, status?.id);
|
|
127
|
+
const conflict = queued ? queueOrderConflict(queued, { status, scope, profile, scopeOf }) : null;
|
|
128
|
+
if (queued && !conflict) {
|
|
129
|
+
if (write) retainAcceptedOrder(runDir, orderSnapshot(queued), { from: "queue-order", now });
|
|
130
|
+
out = { job: queued, source: "queue-order", unrecovered: [], conflict: null };
|
|
131
|
+
} else out = { job: fromStatus(), source: "status", unrecovered: [...ORDER_ONLY_FIELDS], conflict };
|
|
132
|
+
}
|
|
133
|
+
if (write) try {
|
|
134
|
+
ensureDriverDir(runDir);
|
|
135
|
+
atomicWrite(driverDir(runDir, ORDER_RECOVERY_FILE), JSON.stringify({ ts: now(), source: out.source,
|
|
136
|
+
unrecovered: out.unrecovered, conflict: out.conflict, faithful: out.unrecovered.length === 0 }, null, 2) + "\n");
|
|
137
|
+
} catch { /* the caller says where the job came from either way */ }
|
|
138
|
+
return out;
|
|
139
|
+
}
|