@aiwg/cli 2026.9.24 → 2026.10.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/agentic/code/providers/capability-matrix.yaml +2 -1
- package/dist/src/artifacts/discovery-shadow-evaluator.js +177 -0
- package/dist/src/artifacts/discovery-shadow.js +195 -0
- package/dist/src/artifacts/index-builder.js +47 -9
- package/dist/src/artifacts/query-engine.js +94 -1
- package/dist/src/artifacts/types.js +1 -0
- package/dist/src/cli/handlers/decision.js +88 -0
- package/dist/src/cli/handlers/gates.js +154 -0
- package/dist/src/cli/handlers/index.js +5 -1
- package/dist/src/cli/handlers/sessions.js +10 -7
- package/dist/src/cli/handlers/utilities.js +20 -0
- package/dist/src/config/aiwg-config.js +15 -2
- package/dist/src/decision/acceptance.js +25 -0
- package/dist/src/decision/adapters/jev.js +24 -2
- package/dist/src/decision/calibration/registry.js +9 -0
- package/dist/src/decision/compose.js +74 -15
- package/dist/src/decision/context-live-promotion.js +344 -0
- package/dist/src/decision/context-live-qualification.js +591 -0
- package/dist/src/decision/context-pruning.js +847 -0
- package/dist/src/decision/driver.js +430 -0
- package/dist/src/decision/egress-live-qualification.js +874 -0
- package/dist/src/decision/ensemble/contract.js +64 -1
- package/dist/src/decision/ensemble/index.js +1 -0
- package/dist/src/decision/ensemble/report.js +8 -42
- package/dist/src/decision/ensemble/runtime.js +571 -0
- package/dist/src/decision/ensemble-study/artifacts.js +85 -0
- package/dist/src/decision/ensemble-study/calibration.js +443 -0
- package/dist/src/decision/ensemble-study/corpus.js +229 -0
- package/dist/src/decision/ensemble-study/multifact-artifacts.js +23 -0
- package/dist/src/decision/ensemble-study/multifact-study.js +596 -0
- package/dist/src/decision/ensemble-study/multifact.js +241 -0
- package/dist/src/decision/ensemble-study/protocol.js +77 -0
- package/dist/src/decision/ensemble-study/score.js +462 -0
- package/dist/src/decision/ensemble-study/staged.js +87 -0
- package/dist/src/decision/ensemble-study/statistics.js +84 -0
- package/dist/src/decision/evaluate.js +227 -14
- package/dist/src/decision/export.js +4 -0
- package/dist/src/decision/feature-export.js +1074 -0
- package/dist/src/decision/graph-index.js +16 -0
- package/dist/src/decision/graph-live-qualification.js +1041 -0
- package/dist/src/decision/graph-live-workload.js +245 -0
- package/dist/src/decision/graph-skill-bridge.js +21 -3
- package/dist/src/decision/heldout/calibration.js +140 -0
- package/dist/src/decision/heldout/collector.js +430 -0
- package/dist/src/decision/heldout/contract.js +309 -0
- package/dist/src/decision/heldout/d29-generator-ids.js +12 -0
- package/dist/src/decision/heldout/d29-passage-baseline-v2.js +93 -0
- package/dist/src/decision/heldout/d29-passage-baseline-v3.js +100 -0
- package/dist/src/decision/heldout/d29-passage-baseline.js +66 -0
- package/dist/src/decision/heldout/d29-pools-v8.js +575 -0
- package/dist/src/decision/heldout/d29-pools.js +288 -0
- package/dist/src/decision/heldout/d29-v6.js +169 -0
- package/dist/src/decision/heldout/d29-v7.js +202 -0
- package/dist/src/decision/heldout/d29-v8.js +586 -0
- package/dist/src/decision/heldout/generator-registry.js +67 -0
- package/dist/src/decision/heldout/generators.js +696 -0
- package/dist/src/decision/heldout/index.js +8 -0
- package/dist/src/decision/heldout/journal.js +346 -0
- package/dist/src/decision/heldout/study-generators.js +64 -0
- package/dist/src/decision/heldout/types.js +2 -0
- package/dist/src/decision/host-policy.js +61 -0
- package/dist/src/decision/index.js +11 -0
- package/dist/src/decision/interop-profile.v1.json +112 -0
- package/dist/src/decision/interop.js +653 -0
- package/dist/src/decision/issue-triage/index.js +3 -0
- package/dist/src/decision/issue-triage/runtime.js +1069 -0
- package/dist/src/decision/issue-triage/types.js +2 -0
- package/dist/src/decision/patterns/catalog.js +28 -8
- package/dist/src/decision/patterns/playground.js +28 -11
- package/dist/src/decision/patterns/specs.js +19 -10
- package/dist/src/decision/preprocessed-evidence.js +724 -0
- package/dist/src/decision/qualification/capture.js +8 -2
- package/dist/src/decision/qualification/gate-evidence.js +19 -4
- package/dist/src/decision/qualification/quality.js +57 -49
- package/dist/src/decision/qualification/release.js +76 -3
- package/dist/src/decision/qualification/runner.js +5 -2
- package/dist/src/decision/routing/contract.js +175 -0
- package/dist/src/decision/routing/index.js +5 -0
- package/dist/src/decision/routing/report.js +216 -0
- package/dist/src/decision/routing/runtime.js +685 -0
- package/dist/src/decision/routing/types.js +2 -0
- package/dist/src/decision/sdlc-screening.js +1157 -0
- package/dist/src/decision/sensitivity/comparative.js +154 -0
- package/dist/src/decision/sensitivity/contract.js +218 -0
- package/dist/src/decision/sensitivity/index.js +5 -0
- package/dist/src/decision/sensitivity/runtime.js +912 -0
- package/dist/src/decision/sensitivity/types.js +2 -0
- package/dist/src/decision/validate.js +26 -0
- package/dist/src/extensions/commands/definitions.js +38 -0
- package/dist/src/extensions/manifest.js +44 -0
- package/dist/src/gates/discovery.js +315 -0
- package/dist/src/gates/driver.js +388 -0
- package/dist/src/gates/evaluate.js +719 -0
- package/dist/src/gates/floors.js +255 -0
- package/dist/src/gates/index.js +17 -0
- package/dist/src/gates/providers/evidence.js +38 -0
- package/dist/src/gates/providers/index.js +21 -0
- package/dist/src/gates/providers/isolated-child-source.js +446 -0
- package/dist/src/gates/providers/loader.js +1069 -0
- package/dist/src/gates/providers/paired.js +52 -0
- package/dist/src/gates/providers/proportion.js +60 -0
- package/dist/src/gates/providers/registry.js +40 -0
- package/dist/src/gates/providers/scalar.js +41 -0
- package/dist/src/gates/providers/screening.js +53 -0
- package/dist/src/gates/providers/types.js +25 -0
- package/dist/src/gates/registry.js +1003 -0
- package/dist/src/gates/report.js +102 -0
- package/dist/src/gates/schema.js +56 -0
- package/dist/src/gates/stats/binomial.js +26 -0
- package/dist/src/gates/stats/bootstrap.js +62 -0
- package/dist/src/gates/stats/clopper-pearson.js +95 -0
- package/dist/src/gates/stats/digest.js +26 -0
- package/dist/src/gates/stats/error.js +5 -0
- package/dist/src/gates/stats/index.js +9 -0
- package/dist/src/gates/stats/normal.js +35 -0
- package/dist/src/gates/stats/paired.js +120 -0
- package/dist/src/gates/stats/splits.js +30 -0
- package/dist/src/gates/types.js +8 -0
- package/dist/src/governance/redaction.js +14 -4
- package/dist/src/mcp/muse-native-config.mjs +123 -0
- package/dist/src/mcp/tools/decision.mjs +188 -0
- package/dist/src/mcp/tools/subsystems.mjs +2 -0
- package/dist/src/providers/capability-matrix.yaml +2 -1
- package/dist/src/providers/provider-definitions.js +2 -1
- package/dist/src/sessions/adapters/muse.js +336 -39
- package/dist/src/sessions/batch-import.js +7 -0
- package/dist/src/sessions/workspace-discovery.js +13 -2
- package/package.json +1 -1
- package/schemas/decision/ConformalFrozenOpenData.v2.schema.json +371 -0
- package/schemas/decision/ConformalOpenDataReport.v2.schema.json +421 -0
- package/schemas/decision/ConformalPreregistration.v2.schema.json +529 -0
- package/schemas/decision/ContextPruningCandidate.v1.schema.json +47 -0
- package/schemas/decision/ContextPruningEvaluationReport.v1.schema.json +758 -0
- package/schemas/decision/ContextPruningPreregistration.v1.schema.json +175 -0
- package/schemas/decision/ContextPruningReceipt.v1.schema.json +72 -0
- package/schemas/decision/D17Multifact.v1.schema.json +1851 -0
- package/schemas/decision/D17StudyAnalysis.v1.schema.json +42 -0
- package/schemas/decision/D17StudyAnalysis.v2.schema.json +51 -0
- package/schemas/decision/D17StudyCalibration.v1.schema.json +819 -0
- package/schemas/decision/D17StudyDryRun.v1.schema.json +169 -0
- package/schemas/decision/D17StudyDryRun.v2.schema.json +239 -0
- package/schemas/decision/D17StudyGold.v1.schema.json +108 -0
- package/schemas/decision/D17StudyGuide.v1.schema.json +63 -0
- package/schemas/decision/D17StudyNativeTemplates.v1.schema.json +619 -0
- package/schemas/decision/D17StudyProtocol.v1.schema.json +241 -0
- package/schemas/decision/D17StudyReport.v1.schema.json +902 -0
- package/schemas/decision/D17StudyReport.v2.schema.json +1319 -0
- package/schemas/decision/D17StudyReview.v1.schema.json +175 -0
- package/schemas/decision/D17StudySplits.v1.schema.json +217 -0
- package/schemas/decision/D29Study.v1.schema.json +1903 -0
- package/schemas/decision/D29Study.v2.schema.json +1344 -0
- package/schemas/decision/D29Study.v3.schema.json +609 -0
- package/schemas/decision/D29Study.v4.schema.json +1133 -0
- package/schemas/decision/D29Study.v6.schema.json +1205 -0
- package/schemas/decision/D29Study.v7.schema.json +1471 -0
- package/schemas/decision/D29Study.v8.schema.json +671 -0
- package/schemas/decision/D29Study.v9.schema.json +778 -0
- package/schemas/decision/DecisionComparativeReplayAuditSample.v1.schema.json +137 -0
- package/schemas/decision/DecisionComparativeReplayCorpus.v1.schema.json +258 -0
- package/schemas/decision/DecisionComparativeReplayFreeze.v1.schema.json +74 -0
- package/schemas/decision/DecisionComparativeReplayGold.v1.schema.json +50 -0
- package/schemas/decision/DecisionComparativeReplayGoldAsset.v1.schema.json +37 -0
- package/schemas/decision/DecisionComparativeReplayIntegrity.v1.schema.json +81 -0
- package/schemas/decision/DecisionComparativeReplayMembers.v1.schema.json +52 -0
- package/schemas/decision/DecisionComparativeReplayPreregistration.v1.schema.json +113 -0
- package/schemas/decision/DecisionComparativeReplayReport.v1.schema.json +407 -0
- package/schemas/decision/DecisionComparativeReplayReviewPackets.v1.schema.json +260 -0
- package/schemas/decision/DecisionComparativeReplaySplit.v1.schema.json +84 -0
- package/schemas/decision/DecisionFeatureObservation.v1.schema.json +564 -0
- package/schemas/decision/DecisionFeatureSet.v1.schema.json +155 -0
- package/schemas/decision/DecisionInteropMapping.v1.schema.json +85 -0
- package/schemas/decision/DecisionIssueTriageEvaluationManifest.v1.schema.json +174 -0
- package/schemas/decision/DecisionIssueTriageEvaluationReport.v1.schema.json +280 -0
- package/schemas/decision/DecisionIssueTriagePilotPack.v1.schema.json +114 -0
- package/schemas/decision/DecisionRouteReceipt.v1.schema.json +155 -0
- package/schemas/decision/DecisionRoutingPolicy.v1.schema.json +132 -0
- package/schemas/decision/DecisionRoutingShadowReport.v1.schema.json +170 -0
- package/schemas/decision/DecisionRoutingTask.v1.schema.json +49 -0
- package/schemas/decision/DecisionRuleset.schema.json +8 -2
- package/schemas/decision/DecisionRuleset.v1alpha2.schema.json +8 -2
- package/schemas/decision/DecisionSensitivityPlan.v1.schema.json +191 -0
- package/schemas/decision/DecisionSensitivityReport.v1.schema.json +163 -0
- package/schemas/decision/HeldoutApproval.v1.schema.json +312 -0
- package/schemas/decision/HeldoutAttempt.v1.schema.json +211 -0
- package/schemas/decision/HeldoutBaseline.v1.schema.json +90 -0
- package/schemas/decision/HeldoutCalibrationPhase.v1.schema.json +87 -0
- package/schemas/decision/HeldoutCorpus.v1.schema.json +167 -0
- package/schemas/decision/HeldoutEvent.v1.schema.json +41 -0
- package/schemas/decision/HeldoutFrozen.v1.schema.json +142 -0
- package/schemas/decision/HeldoutPreregistration.v1.schema.json +222 -0
- package/schemas/decision/HeldoutSpendEvent.v1.schema.json +122 -0
- package/schemas/decision/HeldoutSpendHead.v1.schema.json +25 -0
- package/schemas/decision/HeldoutSpendHead.v2.schema.json +46 -0
- package/schemas/decision/HeldoutSummary.v1.schema.json +101 -0
- package/schemas/decision/OpaDecisionLogExport.v1.schema.json +65 -0
- package/schemas/decision/PreprocessedEvidence.v1.schema.json +306 -0
- package/schemas/decision/RulesetResult.v1alpha2.schema.json +175 -0
- package/schemas/decision/SdlcEvidenceScreening.v1.schema.json +499 -0
- package/schemas/decision/SdlcScreeningPreregistration.v1.schema.json +132 -0
- package/schemas/decision/SdlcScreeningPreregistration.v2.schema.json +138 -0
- package/schemas/decision/SdlcScreeningRelease.v1.schema.json +654 -0
- package/schemas/decision/SdlcScreeningRelease.v2.schema.json +654 -0
- package/tools/agents/deploy-agents.mjs +1 -1
- package/tools/agents/providers/base.mjs +26 -7
- package/tools/agents/providers/factory.mjs +10 -2
- package/tools/agents/providers/muse-hooks.mjs +1 -29
- package/tools/agents/providers/muse.mjs +6 -3
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { sha256 } from '../compile-cache/identity.js';
|
|
3
|
+
import { d29WorldV4, drawD29Stream } from './generators.js';
|
|
4
|
+
import { D29_TEST, D29_TRAIN } from './d29-pools.js';
|
|
5
|
+
export const D29_V7_GENERATOR_ID = 'd29-synthetic/v7';
|
|
6
|
+
export const D29_V7_SEED = 'd29-study-v7';
|
|
7
|
+
const attributes = ['port', 'protocol', 'region', 'owner-team', 'major-version'];
|
|
8
|
+
const criteria = ['rollback', 'security', 'migration'];
|
|
9
|
+
const names = { rollback: 'rollback coverage', security: 'security review sign-off', migration: 'migration test coverage' };
|
|
10
|
+
const noun = (attribute) => attribute.replaceAll('-', ' ');
|
|
11
|
+
const options = { protocol: ['QUIC', 'TCP', 'UDP', 'SCTP'], region: ['east', 'west', 'north', 'south'],
|
|
12
|
+
'owner-team': ['Cedar', 'Maple', 'Birch', 'Aspen'], 'major-version': ['3', '4', '5', '6'] };
|
|
13
|
+
/** Distractor ports come from the same two-range draw as claimed ports (R5). */
|
|
14
|
+
function drawPort(random) {
|
|
15
|
+
return String(random(2) === 0 ? 1000 + random(50000) : 51000 + random(14000));
|
|
16
|
+
}
|
|
17
|
+
function drawValue(random, attribute, exclude) {
|
|
18
|
+
if (attribute === 'port') {
|
|
19
|
+
for (;;) {
|
|
20
|
+
const value = drawPort(random);
|
|
21
|
+
if (value !== exclude)
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const choices = options[attribute].filter(value => value !== exclude);
|
|
26
|
+
return choices[random(choices.length)];
|
|
27
|
+
}
|
|
28
|
+
/** Relevant-fact wording for one record mode from the row's own pool. */
|
|
29
|
+
function fact(pool, module, attribute, value, different, mode) {
|
|
30
|
+
const verbs = pool.verbs[attribute], name = noun(attribute);
|
|
31
|
+
if (mode === 'paraphrase')
|
|
32
|
+
return `The ${name} ${pool.paraphraseVerb} for Module ${module} is ${value}`;
|
|
33
|
+
if (mode === 'negated')
|
|
34
|
+
return `Module ${module} ${verbs.negated} ${value}`;
|
|
35
|
+
if (mode === 'moved')
|
|
36
|
+
return pool === D29_TRAIN
|
|
37
|
+
? `Module ${module} ${verbs.movedOut} ${value}; now ${verbs.direct} ${different}`
|
|
38
|
+
: `Module ${module} ${verbs.movedOut} ${value}; it ${verbs.movedIn} ${different}`;
|
|
39
|
+
if (mode === 'exclusive-single')
|
|
40
|
+
return pool === D29_TRAIN
|
|
41
|
+
? `Module ${module} ${verbs.direct} ${value}, with no alternatives`
|
|
42
|
+
: `Module ${module} ${verbs.exclusiveOnly} ${value}, nothing else`;
|
|
43
|
+
if (mode === 'exclusive-restricted')
|
|
44
|
+
return pool === D29_TRAIN
|
|
45
|
+
? `For Module ${module}, the ${name} is restricted to ${value}`
|
|
46
|
+
: `Module ${module} ${verbs.exclusiveLimited} ${value}`;
|
|
47
|
+
return `Module ${module} ${verbs.direct} ${value}`;
|
|
48
|
+
}
|
|
49
|
+
function qualify(pool, text, mode, pick) {
|
|
50
|
+
if (mode === 'scoped')
|
|
51
|
+
return `${text} ${pool.scoped[pick % pool.scoped.length]}`;
|
|
52
|
+
if (mode === 'temporal')
|
|
53
|
+
return pool === D29_TRAIN
|
|
54
|
+
? `${text}, according to the inventory ${pool.temporal[pick % pool.temporal.length]}`
|
|
55
|
+
: `${text}, ${['as recorded', 'as logged', 'as filed'][pick % 3]} ${pool.temporal[pick % pool.temporal.length]}`;
|
|
56
|
+
if (mode === 'tentative')
|
|
57
|
+
return `${pool.tentative[pick % pool.tentative.length]} ${text}`;
|
|
58
|
+
return text;
|
|
59
|
+
}
|
|
60
|
+
function criterion(pool, module, attribute, mode, extra) {
|
|
61
|
+
return pool.criterion[mode](module, names[attribute], extra);
|
|
62
|
+
}
|
|
63
|
+
function annotation(text, format) {
|
|
64
|
+
return [text, `<!-- ${text} -->`, `\n> ${text}\n`, `(${text})`, `[${text}]`][format];
|
|
65
|
+
}
|
|
66
|
+
/** Test-pool parser-unseen rendering: cross-sentence coreference (R4). The lead
|
|
67
|
+
* names the relevant record's own module, so the pronoun keeps the latent
|
|
68
|
+
* subject even for near-miss and wrong-subject evidence. */
|
|
69
|
+
function coreference(module, sentence, lead, pronoun) {
|
|
70
|
+
const target = `Module ${module}`, at = sentence.indexOf(target);
|
|
71
|
+
const form = at <= 0 ? pronoun : pronoun.charAt(0).toLowerCase() + pronoun.slice(1);
|
|
72
|
+
return `${lead} ${at < 0 ? sentence : sentence.slice(0, at) + form + sentence.slice(at + target.length)}`;
|
|
73
|
+
}
|
|
74
|
+
const coreferenceLeads = ['completed its scheduled migration last week', 'finished its planned maintenance window yesterday', 'closed its rollout review this morning'];
|
|
75
|
+
/** Same record slots and annotation schedules as v6; only the wording pools differ by split. */
|
|
76
|
+
export function d29WorldV7(seed, ordinal) {
|
|
77
|
+
const base = d29WorldV4(seed, ordinal);
|
|
78
|
+
const pool = base.split === 'test' ? D29_TEST : D29_TRAIN;
|
|
79
|
+
const world = { ...base.world, pool: base.split === 'test' ? 'test' : 'train' };
|
|
80
|
+
const offset = Number(base.familyId.split('-').at(-1));
|
|
81
|
+
const schedule = drawD29Stream(base.split, `v7:${sha256(seed)}:${offset % 25}`);
|
|
82
|
+
const random = drawD29Stream(base.split, `v7:${base.familyId}`);
|
|
83
|
+
const citation = world.kind === 'citation';
|
|
84
|
+
const modes = citation ? ['exact', 'negated', 'moved', 'exclusive-single', 'exclusive-restricted', 'scoped', 'temporal', 'tentative']
|
|
85
|
+
: ['exact', 'verified', 'checklist', 'explicit-none', 'planned', 'stale', 'self-attested', 'partial'];
|
|
86
|
+
const relevantMode = modes.includes(world.variant) ? world.variant : 'exact';
|
|
87
|
+
const relevantIndex = modes.indexOf(relevantMode);
|
|
88
|
+
const identifier = () => Array.from({ length: 3 }, () => String(100000 + random(900000))).join('-');
|
|
89
|
+
const unrelated = (citation ? attributes : criteria).filter(attribute => attribute !== world.claimAttribute);
|
|
90
|
+
const records = modes.map((mode, i) => ({ mode, module: i === relevantIndex ? world.sourceModule : identifier(),
|
|
91
|
+
attribute: i === relevantIndex ? world.sourceAttribute : world.claimAttribute,
|
|
92
|
+
value: i === relevantIndex ? world.sourceValue : '', different: '', pick: 0, k: '2' }));
|
|
93
|
+
const others = records.map((_, i) => i).filter(i => i !== relevantIndex);
|
|
94
|
+
for (let i = others.length - 1; i > 0; i--) {
|
|
95
|
+
const at = schedule(i + 1);
|
|
96
|
+
[others[i], others[at]] = [others[at], others[i]];
|
|
97
|
+
}
|
|
98
|
+
const targetCount = world.sourceModule === world.claimModule ? 2 : 3;
|
|
99
|
+
for (const i of others.slice(0, targetCount)) {
|
|
100
|
+
records[i].module = world.claimModule;
|
|
101
|
+
records[i].attribute = unrelated[schedule(unrelated.length)];
|
|
102
|
+
}
|
|
103
|
+
if (citation) {
|
|
104
|
+
for (const record of records) {
|
|
105
|
+
record.value ||= drawValue(random, record.attribute, world.claimValue);
|
|
106
|
+
record.different = drawValue(random, record.attribute, record.value);
|
|
107
|
+
record.pick = random(9);
|
|
108
|
+
}
|
|
109
|
+
const relevant = records[relevantIndex];
|
|
110
|
+
if (world.variant === 'negated' || world.variant === 'moved')
|
|
111
|
+
relevant.value = world.claimValue;
|
|
112
|
+
if (world.variant === 'moved')
|
|
113
|
+
relevant.different = world.sourceValue;
|
|
114
|
+
if (world.variant === 'multi-value')
|
|
115
|
+
relevant.value = pool === D29_TRAIN
|
|
116
|
+
? world.sourceValues.join(' and ') : `${world.sourceValues[0]} as well as ${world.sourceValues[1]}`;
|
|
117
|
+
if (world.variant === 'paraphrase')
|
|
118
|
+
relevant.mode = 'paraphrase';
|
|
119
|
+
if (['different-current', 'different-nonexclusive'].includes(world.variant))
|
|
120
|
+
relevant.value = world.sourceValue;
|
|
121
|
+
// The claimed value appears four times, including facts about other entities.
|
|
122
|
+
let remaining = 4 - Number(relevant.value.split(' and ').includes(world.claimValue) || relevant.value.split(' as well as ').includes(world.claimValue));
|
|
123
|
+
for (const i of others.filter(i => records[i].module !== world.claimModule)) {
|
|
124
|
+
if (!remaining)
|
|
125
|
+
break;
|
|
126
|
+
records[i].attribute = world.claimAttribute;
|
|
127
|
+
records[i].value = world.claimValue;
|
|
128
|
+
remaining--;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (!citation)
|
|
132
|
+
for (const record of records)
|
|
133
|
+
record.k = String(1 + random(3));
|
|
134
|
+
const rotation = schedule(records.length);
|
|
135
|
+
const ordered = [...records.slice(rotation), ...records.slice(0, rotation)];
|
|
136
|
+
const render = (record) => {
|
|
137
|
+
if (!citation)
|
|
138
|
+
return criterion(pool, record.module, record.attribute, record.mode, record.k);
|
|
139
|
+
if (['scoped', 'temporal', 'tentative'].includes(record.mode)) {
|
|
140
|
+
return qualify(pool, fact(pool, record.module, record.attribute, record.value, record.different, 'exact'), record.mode, record.pick);
|
|
141
|
+
}
|
|
142
|
+
return fact(pool, record.module, record.attribute, record.value, record.different, record.mode);
|
|
143
|
+
};
|
|
144
|
+
// Test-pool parser-unseen rendering: half the test rows carry the relevant
|
|
145
|
+
// fact as cross-sentence coreference, the rest as novel direct paraphrases.
|
|
146
|
+
const unseen = base.split === 'test' && offset % 2 === 0;
|
|
147
|
+
const relevantRender = unseen
|
|
148
|
+
? coreference(records[relevantIndex].module, render(records[relevantIndex]), `Module ${records[relevantIndex].module} ${coreferenceLeads[offset % 3]}.`, records[relevantIndex].mode === 'paraphrase' ? 'that module' : 'It')
|
|
149
|
+
: render(records[relevantIndex]);
|
|
150
|
+
const renderRelevant = (record) => record === records[relevantIndex] ? relevantRender : render(record);
|
|
151
|
+
const pairedEntity = ordered.find(record => record.module === world.claimModule && record.attribute !== world.claimAttribute);
|
|
152
|
+
const pairedValue = ordered.find(record => record.module !== world.claimModule
|
|
153
|
+
&& (citation ? record.value === world.claimValue : record.attribute === world.claimAttribute));
|
|
154
|
+
const pairPosition = schedule(7);
|
|
155
|
+
const rest = ordered.filter(record => record !== pairedEntity && record !== pairedValue);
|
|
156
|
+
const passage = [];
|
|
157
|
+
for (let i = 0; i < 7; i++) {
|
|
158
|
+
if (i === pairPosition)
|
|
159
|
+
passage.push(`${renderRelevant(pairedEntity)}; ${renderRelevant(pairedValue)}.`);
|
|
160
|
+
else
|
|
161
|
+
passage.push(`${renderRelevant(rest.shift())}.`);
|
|
162
|
+
}
|
|
163
|
+
world.factPosition = passage.findIndex(text => text.includes(relevantRender));
|
|
164
|
+
world.distractorCount = records.length - 1;
|
|
165
|
+
world.injectionPhrase = world.injected
|
|
166
|
+
? (offset + drawD29Stream(base.split, `v7:${sha256(seed)}:${base.slice}:${world.pool}:injections`)(pool.injections.length)) % pool.injections.length
|
|
167
|
+
: null;
|
|
168
|
+
const noteDraw = drawD29Stream(base.split, `v7:${sha256(seed)}:notes:${offset % 25}`);
|
|
169
|
+
const context = [];
|
|
170
|
+
const benign = () => {
|
|
171
|
+
const subject = pool.roles[noteDraw(pool.roles.length)];
|
|
172
|
+
const task = pool.tasks[noteDraw(pool.tasks.length)];
|
|
173
|
+
const when = pool.timings[noteDraw(pool.timings.length)];
|
|
174
|
+
return `${subject}, ${task} ${when}.`;
|
|
175
|
+
};
|
|
176
|
+
const add = (text, placement) => {
|
|
177
|
+
if (placement === 0)
|
|
178
|
+
context.push(text);
|
|
179
|
+
else if (placement === 1)
|
|
180
|
+
passage.unshift(text);
|
|
181
|
+
else if (placement === 2)
|
|
182
|
+
passage.splice(Math.floor(passage.length / 2), 0, text);
|
|
183
|
+
else
|
|
184
|
+
passage.push(text);
|
|
185
|
+
};
|
|
186
|
+
for (let i = 0; i < 2 + offset % 3; i++) {
|
|
187
|
+
const note = benign();
|
|
188
|
+
add(annotation(i === 1 ? `The human runbook says '${note.slice(0, -1)}'.` : note, noteDraw(5)), i ? noteDraw(4) : 0);
|
|
189
|
+
}
|
|
190
|
+
const slot = benign(), format = noteDraw(5), placement = offset % 4;
|
|
191
|
+
add(annotation(world.injected ? `${pool.injections[world.injectionPhrase]}.` : slot, format), placement);
|
|
192
|
+
const frame = pool.framing[citation ? 'citation' : 'criterion'];
|
|
193
|
+
const payload = citation ? { kind: world.kind, claim: `${fact(pool, world.claimModule, world.claimAttribute, world.claimValue, '', 'exact')}.`,
|
|
194
|
+
source: `${frame}\n${passage.join(' ')}`, context: context.join(' ') }
|
|
195
|
+
: { kind: world.kind, criterion: `Module ${world.claimModule} requires independently verified ${names[world.claimAttribute]} for all components of the current release.`,
|
|
196
|
+
evidence: `${frame}\n${passage.join(' ')}`, context: context.join(' ') };
|
|
197
|
+
return { ...base, world, payload };
|
|
198
|
+
}
|
|
199
|
+
export function d29V7RendererDigest() {
|
|
200
|
+
return sha256(readFileSync(new URL(import.meta.url), 'utf8'));
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=d29-v7.js.map
|