@principles/core 1.279.0 → 1.279.2
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/dist/evolution-store.d.ts +17 -6
- package/dist/evolution-store.d.ts.map +1 -1
- package/dist/evolution-store.js +26 -27
- package/dist/evolution-store.js.map +1 -1
- package/dist/evolution-store.test.js +40 -41
- package/dist/evolution-store.test.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime-v2/__tests__/trajectory-store.test.js +28 -12
- package/dist/runtime-v2/__tests__/trajectory-store.test.js.map +1 -1
- package/dist/runtime-v2/config/__tests__/pd-config-contract.test.js +19 -0
- package/dist/runtime-v2/config/__tests__/pd-config-contract.test.js.map +1 -1
- package/dist/runtime-v2/config/pd-config-effective.d.ts.map +1 -1
- package/dist/runtime-v2/config/pd-config-effective.js +10 -4
- package/dist/runtime-v2/config/pd-config-effective.js.map +1 -1
- package/dist/runtime-v2/config/pd-config-feature-flags.d.ts.map +1 -1
- package/dist/runtime-v2/config/pd-config-feature-flags.js +9 -3
- package/dist/runtime-v2/config/pd-config-feature-flags.js.map +1 -1
- package/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js +2 -2
- package/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js +18 -9
- package/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
- package/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js +25 -28
- package/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js.map +1 -1
- package/dist/runtime-v2/feature-flags/plugin-surface-registry.d.ts.map +1 -1
- package/dist/runtime-v2/feature-flags/plugin-surface-registry.js +0 -18
- package/dist/runtime-v2/feature-flags/plugin-surface-registry.js.map +1 -1
- package/dist/runtime-v2/index.d.ts +2 -1
- package/dist/runtime-v2/index.d.ts.map +1 -1
- package/dist/runtime-v2/index.js +2 -0
- package/dist/runtime-v2/index.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js +75 -5
- package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +1 -1
- package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +1 -1
- package/dist/runtime-v2/internalization/__tests__/evaluator-host-alias-replay.test.d.ts +2 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-host-alias-replay.test.d.ts.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-host-alias-replay.test.js +279 -0
- package/dist/runtime-v2/internalization/__tests__/evaluator-host-alias-replay.test.js.map +1 -0
- package/dist/runtime-v2/internalization/__tests__/tool-semantic-registry.test.js +43 -0
- package/dist/runtime-v2/internalization/__tests__/tool-semantic-registry.test.js.map +1 -1
- package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +36 -2
- package/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artificer-prompt-builder.js +64 -7
- package/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
- package/dist/runtime-v2/internalization/artificer-runner.d.ts +10 -1
- package/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/artificer-runner.js +6 -0
- package/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/context-manifests.d.ts +3 -1
- package/dist/runtime-v2/internalization/context-manifests.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/context-manifests.js +3 -1
- package/dist/runtime-v2/internalization/context-manifests.js.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts +31 -0
- package/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/evaluator-runner.js +93 -1
- package/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/dist/runtime-v2/internalization/index.d.ts +2 -1
- package/dist/runtime-v2/internalization/index.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/index.js +2 -0
- package/dist/runtime-v2/internalization/index.js.map +1 -1
- package/dist/runtime-v2/internalization/tool-semantic-registry.d.ts +7 -0
- package/dist/runtime-v2/internalization/tool-semantic-registry.d.ts.map +1 -1
- package/dist/runtime-v2/internalization/tool-semantic-registry.js +9 -0
- package/dist/runtime-v2/internalization/tool-semantic-registry.js.map +1 -1
- package/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.d.ts +14 -8
- package/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.d.ts.map +1 -1
- package/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.js +14 -8
- package/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.js.map +1 -1
- package/dist/runtime-v2/runner/peer-runner-types.d.ts +4 -1
- package/dist/runtime-v2/runner/peer-runner-types.d.ts.map +1 -1
- package/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts.map +1 -1
- package/dist/runtime-v2/tools/artificer-l2-tool-contract.js +6 -0
- package/dist/runtime-v2/tools/artificer-l2-tool-contract.js.map +1 -1
- package/dist/telemetry-event.d.ts +2 -2
- package/dist/telemetry-event.d.ts.map +1 -1
- package/dist/telemetry-event.js +4 -0
- package/dist/telemetry-event.js.map +1 -1
- package/dist/trajectory-store.d.ts +59 -4
- package/dist/trajectory-store.d.ts.map +1 -1
- package/dist/trajectory-store.js +162 -31
- package/dist/trajectory-store.js.map +1 -1
- package/dist/trajectory-store.test.js +30 -20
- package/dist/trajectory-store.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-manifests.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/context-manifests.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context-manifests.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/context-manifests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,eAuB9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,eA8B7B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,eAkChC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,yBAAyB,EAAE,eAgCvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,yBAAyB,EAAE,eA2CvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,yBAAyB,EAAE,eAMvC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAOvD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAElD,CAAC"}
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
*
|
|
27
27
|
* budgetTokens semantics (design §6.2.1 / §6.3): the budget covers ONLY these
|
|
28
28
|
* manifest-declared injection fields. It does NOT include core grounding text
|
|
29
|
-
* (
|
|
29
|
+
* (grounding is injected unconditionally via the runners' `coreGrounding: true`
|
|
30
|
+
* default — the `internalization_core_grounding` flag is a disconnected
|
|
31
|
+
* control with no runtime readers, PRI-752), runner
|
|
30
32
|
* base instructions, or output-schema descriptions. `usedTokens <= budgetTokens`
|
|
31
33
|
* is therefore an injection-field budget ceiling, NOT a prompt-total-length
|
|
32
34
|
* hard cap. If prompt-total-length control is ever needed, a separate total
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-manifests.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/context-manifests.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"context-manifests.js","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/context-manifests.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC/C,UAAU,EAAE,YAAY;IACxB,aAAa,EAAE,+BAA+B;IAC9C,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,CAAC,uBAAuB,EAAE,4BAA4B,CAAC;IAC9D,KAAK,EAAE;QACL,uBAAuB;QACvB,uBAAuB;QACvB,0BAA0B;QAC1B,6BAA6B;QAC7B,sCAAsC;KACvC;IACD,KAAK,EAAE,EAAE;IACT,YAAY,EAAE,IAAI;IAClB,QAAQ,EAAE;QACR,6BAA6B;QAC7B,0BAA0B;QAC1B,uBAAuB;QACvB,uBAAuB;QACvB,sCAAsC;QACtC,uBAAuB;QACvB,4BAA4B;KAC7B;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,UAAU,EAAE,WAAW;IACvB,aAAa,EAAE,+BAA+B;IAC9C,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,CAAC,8BAA8B,EAAE,yCAAyC,CAAC;IAClF,KAAK,EAAE;QACL,4BAA4B;QAC5B,oCAAoC;QACpC,oCAAoC;QACpC,gEAAgE;QAChE,4CAA4C;QAC5C,+CAA+C;QAC/C,0CAA0C;QAC1C,0CAA0C;QAC1C,qDAAqD;KACtD;IACD,KAAK,EAAE,EAAE;IACT,YAAY,EAAE,IAAI;IAClB,QAAQ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AI;IAClB,QAAQ,EAAE,CAAC,GAAG,yBAAyB,CAAC,QAAQ,EAAE,wBAAwB,EAAE,4BAA4B,CAAC;CAC1G,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA+B;IAC3D,gBAAgB;IAChB,eAAe;IACf,kBAAkB;IAClB,yBAAyB;IACzB,yBAAyB;IACzB,yBAAyB;CAC1B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAsB,KAAK,CAAC,IAAI,CAChE,IAAI,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CACpD,CAAC"}
|
|
@@ -30,6 +30,7 @@ import type { TaskRecord } from '../task-status.js';
|
|
|
30
30
|
import { type PDErrorCategory } from '../error-categories.js';
|
|
31
31
|
import { type RepairPayload } from './pitask-metadata.js';
|
|
32
32
|
import { type PreviousEvaluationContext, type HostToolCatalogFacts } from './evaluator-prompt-builder.js';
|
|
33
|
+
import type { ArtificerHostSemanticContext } from './artificer-prompt-builder.js';
|
|
33
34
|
import { type InternalizationChannel, type ArtifactRef } from './peer-runner-contracts.js';
|
|
34
35
|
import { BasePeerRunner } from '../runner/base-peer-runner.js';
|
|
35
36
|
import type { PeerRunnerOptions, PeerRunnerDeps, PeerRunnerResult, PeerRunnerValidationResult } from '../runner/peer-runner-types.js';
|
|
@@ -89,6 +90,13 @@ export interface EvaluatorRunnerOptions extends PeerRunnerOptions {
|
|
|
89
90
|
* 工具名差异不得成为 hard blocker。
|
|
90
91
|
*/
|
|
91
92
|
readonly hostToolCatalog?: HostToolCatalogFacts;
|
|
93
|
+
/**
|
|
94
|
+
* PRI-741: host semantic projection (real host tool names + kinds from the
|
|
95
|
+
* SAME registry provenance as gateDeps). Used ONLY to generate the
|
|
96
|
+
* host-name parity replay case — the prompt itself is unchanged. Undefined =
|
|
97
|
+
* no host-alias case is generated (observable skip event).
|
|
98
|
+
*/
|
|
99
|
+
readonly hostSemanticContext?: ArtificerHostSemanticContext;
|
|
92
100
|
/**
|
|
93
101
|
* PR B (ADR-0019 pattern, mirrors ArtificerRunner): effective config for
|
|
94
102
|
* feature flag resolution. Without it the evaluator's flag helpers
|
|
@@ -193,6 +201,8 @@ export declare class EvaluatorRunner extends BasePeerRunner<EvaluatorContext, Ev
|
|
|
193
201
|
private readonly repairTaskSeeder;
|
|
194
202
|
/** PRI-630: runtime-authoritative tool facts; null = catalog unavailable (degraded rule in prompt) */
|
|
195
203
|
private readonly hostToolCatalog;
|
|
204
|
+
/** PRI-741: host semantic projection for the host-name parity replay case; null = skipped. */
|
|
205
|
+
private readonly hostSemanticContext;
|
|
196
206
|
/**
|
|
197
207
|
* PRI-714: owner's preferred language for review fields, forwarded into
|
|
198
208
|
* the evaluator prompt (language directive on summary/concerns/…).
|
|
@@ -467,6 +477,27 @@ export declare class EvaluatorRunner extends BasePeerRunner<EvaluatorContext, Ev
|
|
|
467
477
|
* never trust unvalidated candidates).
|
|
468
478
|
*/
|
|
469
479
|
private extractPositiveCases;
|
|
480
|
+
/**
|
|
481
|
+
* PRI-741: host-name parity case. The author's golden trace uses their own
|
|
482
|
+
* tool-name vocabulary (often generic LLM baseline names); the rule must
|
|
483
|
+
* reach the SAME decision when the real host dispatches one of ITS names
|
|
484
|
+
* with the same canonicalKind. The base case is the first NEGATIVE (block)
|
|
485
|
+
* case — a rule matching by author tool-NAME equality silently never fires
|
|
486
|
+
* under the host's real name, which shows up exactly as a missed block;
|
|
487
|
+
* an allow-expectation variant would pass trivially. The host name comes
|
|
488
|
+
* from the host semantic projection (options.hostSemanticContext — the same
|
|
489
|
+
* registry provenance as gateDeps); the author kind comes from the core
|
|
490
|
+
* baseline canonicalizer, so no second semantic truth is introduced.
|
|
491
|
+
*
|
|
492
|
+
* Returns null when no variant applies. All skips EXCEPT one are observable
|
|
493
|
+
* (skip event with structured reason + nextAction, rc-9): a host projection
|
|
494
|
+
* that is absent/empty, golden cases that are missing or structurally
|
|
495
|
+
* invalid, a base case without a usable tool name, and no host tool sharing
|
|
496
|
+
* the author's kind all emit `host_alias_case_skipped`. When the author's
|
|
497
|
+
* name is ALREADY host-real the variant is redundant (the replay already
|
|
498
|
+
* exercises the host surface), so that path returns null silently.
|
|
499
|
+
*/
|
|
500
|
+
private generateHostAliasCase;
|
|
470
501
|
/**
|
|
471
502
|
* PRI-485 Phase 6: derive the v2 adversarial case spec from the Artificer
|
|
472
503
|
* artifact and generate the 5 canonical v2 cases.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator-runner.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/internalization/evaluator-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EACV,iBAAiB,EAEjB,kBAAkB,EAInB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAkB,KAAK,eAAe,EAAqB,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAA+F,KAAK,aAAa,EAAqE,MAAM,sBAAsB,CAAC;AAQ1N,OAAO,EAAmD,KAAK,yBAAyB,EAAE,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC3J,OAAO,EAAwB,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACjH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,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iCjC;;;;;;;;;;;;OAYG;IACH;;;;;;;;;;;;;;;;OAgBG;IACH;;;;;OAKG;YACW,oCAAoC;YAiBpC,sBAAsB;YAiDtB,wBAAwB;IAkNtC;;;;;;;OAOG;IACH,UAAmB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAoBhH;IAED,UAAmB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAKvF;IAED;;;OAGG;IACH,UAAmB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CASpH;IAID;;;;;;;;;;;;;;;;;;OAkBG;YAEW,oBAAoB;IA+BlC;;;;;;;;OAQG;YAEW,0BAA0B;IA+NxC;;;OAGG;IAEH,OAAO,CAAC,sBAAsB;IAyB9B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,MAAM,CAAC,8BAA8B;IA8B7C;;;;;;OAMG;IAEH,OAAO,CAAC,oBAAoB;IAO5B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,qBAAqB;IA0D7B;;;;;;;;;;;;;;;OAeG;IAEH,OAAO,CAAC,4BAA4B;IAmFpC;;;;;;;;;OASG;IAEH,OAAO,CAAC,cAAc;IA0DtB;;;;;;;;;;OAUG;YAEW,oBAAoB;IAkNlC;;;;;;;;;;OAUG;YACW,8BAA8B;IAmE5C;;;OAGG;IAEH,OAAO,CAAC,wBAAwB;IAwBhC,OAAO,CAAC,MAAM,CAAC,QAAQ;IAIvB;;;;;;;;;;;OAWG;YACW,oCAAoC;CA+BnD"}
|
|
@@ -20,6 +20,15 @@ import { buildGoldenTraceFromArtificer } from '../golden-trace.js';
|
|
|
20
20
|
// alias/path/combination) to defend against false-positive blocks.
|
|
21
21
|
import { generateV2ContextAdversarialCases } from './v2-adversarial-cases.js';
|
|
22
22
|
import { canonicalizeToolKind } from './rule-context-v2.js';
|
|
23
|
+
/** PRI-741: length of the shared case-insensitive prefix of two tool names. */
|
|
24
|
+
function commonPrefixLength(a, b) {
|
|
25
|
+
const x = a.toLowerCase();
|
|
26
|
+
const y = b.toLowerCase();
|
|
27
|
+
let i = 0;
|
|
28
|
+
while (i < x.length && i < y.length && x[i] === y[i])
|
|
29
|
+
i += 1;
|
|
30
|
+
return i;
|
|
31
|
+
}
|
|
23
32
|
function isRecordValue(value) {
|
|
24
33
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
25
34
|
}
|
|
@@ -197,6 +206,8 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
197
206
|
repairTaskSeeder;
|
|
198
207
|
/** PRI-630: runtime-authoritative tool facts; null = catalog unavailable (degraded rule in prompt) */
|
|
199
208
|
hostToolCatalog;
|
|
209
|
+
/** PRI-741: host semantic projection for the host-name parity replay case; null = skipped. */
|
|
210
|
+
hostSemanticContext;
|
|
200
211
|
/**
|
|
201
212
|
* PRI-714: owner's preferred language for review fields, forwarded into
|
|
202
213
|
* the evaluator prompt (language directive on summary/concerns/…).
|
|
@@ -218,6 +229,7 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
218
229
|
this.repairLoopEnabledResolver = deps.isRepairLoopEnabled ?? null;
|
|
219
230
|
this.repairTaskSeeder = deps.seedArtificerRepairTask ?? null;
|
|
220
231
|
this.hostToolCatalog = options.hostToolCatalog ?? null;
|
|
232
|
+
this.hostSemanticContext = options.hostSemanticContext ?? null;
|
|
221
233
|
this.outputLanguage = options.outputLanguage;
|
|
222
234
|
}
|
|
223
235
|
/**
|
|
@@ -2152,7 +2164,14 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
2152
2164
|
// set below then relies entirely on the auto-generated v2 cases.
|
|
2153
2165
|
const llmCases = isEvaluatorOutputV2(output) ? (output.adversarialCases ?? []) : [];
|
|
2154
2166
|
const v2Cases = this.generateV2CasesFromArtificer(affectedTools, positiveCases, taskId, runId);
|
|
2155
|
-
|
|
2167
|
+
// PRI-741: host-name parity case — the rule must reach the same decision
|
|
2168
|
+
// under the REAL host tool name as under the author's vocabulary.
|
|
2169
|
+
const hostAliasCase = this.generateHostAliasCase(goldenTraceCases, taskId, runId);
|
|
2170
|
+
const mergedAdversarialCases = [
|
|
2171
|
+
...v2Cases,
|
|
2172
|
+
...(hostAliasCase !== null ? [hostAliasCase] : []),
|
|
2173
|
+
...llmCases,
|
|
2174
|
+
];
|
|
2156
2175
|
// (4) No adversarial cases (neither v2-generated nor LLM-supplied) →
|
|
2157
2176
|
// nothing to replay. codeReview may still be present (passive review only).
|
|
2158
2177
|
// Previously a silent return (PRI-634 A3 hole #3); now observable (R9).
|
|
@@ -2358,6 +2377,79 @@ export class EvaluatorRunner extends BasePeerRunner {
|
|
|
2358
2377
|
return [];
|
|
2359
2378
|
return buildResult.trace.cases.filter((c) => c.kind === 'positive');
|
|
2360
2379
|
}
|
|
2380
|
+
/**
|
|
2381
|
+
* PRI-741: host-name parity case. The author's golden trace uses their own
|
|
2382
|
+
* tool-name vocabulary (often generic LLM baseline names); the rule must
|
|
2383
|
+
* reach the SAME decision when the real host dispatches one of ITS names
|
|
2384
|
+
* with the same canonicalKind. The base case is the first NEGATIVE (block)
|
|
2385
|
+
* case — a rule matching by author tool-NAME equality silently never fires
|
|
2386
|
+
* under the host's real name, which shows up exactly as a missed block;
|
|
2387
|
+
* an allow-expectation variant would pass trivially. The host name comes
|
|
2388
|
+
* from the host semantic projection (options.hostSemanticContext — the same
|
|
2389
|
+
* registry provenance as gateDeps); the author kind comes from the core
|
|
2390
|
+
* baseline canonicalizer, so no second semantic truth is introduced.
|
|
2391
|
+
*
|
|
2392
|
+
* Returns null when no variant applies. All skips EXCEPT one are observable
|
|
2393
|
+
* (skip event with structured reason + nextAction, rc-9): a host projection
|
|
2394
|
+
* that is absent/empty, golden cases that are missing or structurally
|
|
2395
|
+
* invalid, a base case without a usable tool name, and no host tool sharing
|
|
2396
|
+
* the author's kind all emit `host_alias_case_skipped`. When the author's
|
|
2397
|
+
* name is ALREADY host-real the variant is redundant (the replay already
|
|
2398
|
+
* exercises the host surface), so that path returns null silently.
|
|
2399
|
+
*/
|
|
2400
|
+
generateHostAliasCase(rawGoldenCases, taskId, runId) {
|
|
2401
|
+
const hostContext = this.hostSemanticContext;
|
|
2402
|
+
const skip = (reason, nextAction) => {
|
|
2403
|
+
this.emitEvent('host_alias_case_skipped', taskId, { runId, reason, nextAction });
|
|
2404
|
+
return null;
|
|
2405
|
+
};
|
|
2406
|
+
if (hostContext === null || hostContext.tools.length === 0) {
|
|
2407
|
+
return skip('no_host_semantic_context', 'wire_host_semantic_context_from_the_workspace_host_declaration');
|
|
2408
|
+
}
|
|
2409
|
+
if (!Array.isArray(rawGoldenCases) || rawGoldenCases.length === 0) {
|
|
2410
|
+
return skip('no_validated_golden_case', 'verify_artificer_emitted_structurally_valid_golden_trace_cases');
|
|
2411
|
+
}
|
|
2412
|
+
const build = buildGoldenTraceFromArtificer({ cases: rawGoldenCases });
|
|
2413
|
+
if (!build.ok || build.trace.cases.length === 0) {
|
|
2414
|
+
return skip('no_validated_golden_case', 'verify_artificer_emitted_structurally_valid_golden_trace_cases');
|
|
2415
|
+
}
|
|
2416
|
+
const { cases } = build.trace;
|
|
2417
|
+
const base = cases.find((c) => c.kind === 'negative' && c.expectedDecision === 'block') ?? cases[0];
|
|
2418
|
+
if (!base || typeof base.toolName !== 'string' || base.toolName.trim() === '') {
|
|
2419
|
+
return skip('no_base_case_tool_name', 'verify_artificer_emitted_at_least_one_golden_trace_case');
|
|
2420
|
+
}
|
|
2421
|
+
const authorNameIsHostReal = hostContext.tools.some((tool) => tool.rawToolName === base.toolName);
|
|
2422
|
+
if (authorNameIsHostReal) {
|
|
2423
|
+
// Normal outcome for post-v5 artifacts (the prompt requires host-real
|
|
2424
|
+
// case names) — emitted so operators can distinguish "parity already
|
|
2425
|
+
// covered" from a silent skip.
|
|
2426
|
+
return skip('author_name_already_host_real', 'none — the replay already exercises the host dispatch surface');
|
|
2427
|
+
}
|
|
2428
|
+
const authorKind = canonicalizeToolKind(base.toolName);
|
|
2429
|
+
// Among same-kind host tools, prefer the name most similar to the
|
|
2430
|
+
// author's (longest common prefix): edit_file → edit, write_file → write.
|
|
2431
|
+
// A rule may legitimately discriminate tools within a kind, so the first
|
|
2432
|
+
// same-kind mapping is not always a faithful substitute.
|
|
2433
|
+
const sameKind = hostContext.tools.filter((tool) => tool.canonicalKind === authorKind && tool.rawToolName !== base.toolName);
|
|
2434
|
+
let hostCandidate;
|
|
2435
|
+
for (const tool of sameKind) {
|
|
2436
|
+
if (hostCandidate === undefined || commonPrefixLength(tool.rawToolName, base.toolName) > commonPrefixLength(hostCandidate.rawToolName, base.toolName)) {
|
|
2437
|
+
hostCandidate = tool;
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
if (hostCandidate === undefined) {
|
|
2441
|
+
return skip(`no_host_tool_with_kind:${authorKind}`, 'verify_the_host_declaration_covers_the_kind_the_rule_targets');
|
|
2442
|
+
}
|
|
2443
|
+
return {
|
|
2444
|
+
caseId: 'v2-host-alias',
|
|
2445
|
+
attackType: 'boundary',
|
|
2446
|
+
toolName: hostCandidate.rawToolName,
|
|
2447
|
+
params: base.params,
|
|
2448
|
+
expectedDecision: base.expectedDecision,
|
|
2449
|
+
rationale: `PRI-741 host-name parity: the same action dispatched under the real host tool name '${hostCandidate.rawToolName}' (${hostCandidate.canonicalKind}) must reach the same decision ('${base.expectedDecision}') as under the author's vocabulary '${base.toolName}' — match by canonicalKind, not by author tool-name equality.`,
|
|
2450
|
+
...(base.ruleContext !== undefined ? { ruleContext: base.ruleContext } : {}),
|
|
2451
|
+
};
|
|
2452
|
+
}
|
|
2361
2453
|
/**
|
|
2362
2454
|
* PRI-485 Phase 6: derive the v2 adversarial case spec from the Artificer
|
|
2363
2455
|
* artifact and generate the 5 canonical v2 cases.
|