nexus-agents 8.8.2 → 8.9.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.
Files changed (45) hide show
  1. package/dist/chunk-2ONCHXIW.js +7 -0
  2. package/dist/{chunk-BYUVLVN7.js → chunk-3W4L63ML.js} +1 -1
  3. package/dist/chunk-3W4L63ML.js.map +1 -0
  4. package/dist/{chunk-YQUM3UWK.js → chunk-GRBOJFKA.js} +3 -3
  5. package/dist/{chunk-W6SM3MU5.js → chunk-ISE53XGS.js} +2 -2
  6. package/dist/{chunk-FBWOWMEB.js → chunk-ISUMI6BV.js} +20 -18
  7. package/dist/chunk-ISUMI6BV.js.map +1 -0
  8. package/dist/{chunk-CQCVEC7P.js → chunk-L4SJAHQF.js} +920 -1086
  9. package/dist/chunk-L4SJAHQF.js.map +1 -0
  10. package/dist/{chunk-3YKFLM2B.js → chunk-LP4W7RTH.js} +1 -1
  11. package/dist/chunk-LP4W7RTH.js.map +1 -0
  12. package/dist/{chunk-N347WXTT.js → chunk-SHE6SSTO.js} +1 -1
  13. package/dist/chunk-SHE6SSTO.js.map +1 -0
  14. package/dist/{chunk-QY3HOLGD.js → chunk-U4RQ4XPP.js} +3 -3
  15. package/dist/{chunk-MXQG3A5W.js → chunk-XTSDR3HE.js} +973 -129
  16. package/dist/chunk-XTSDR3HE.js.map +1 -0
  17. package/dist/{chunk-SQCFKQUR.js → chunk-YUKNO5ZM.js} +3 -3
  18. package/dist/cli.js +51 -33
  19. package/dist/cli.js.map +1 -1
  20. package/dist/{consensus-vote-L4CN33XE.js → consensus-vote-6NUSZPQY.js} +5 -5
  21. package/dist/{improvement-review-WTZ4JV5V.js → improvement-review-5EYOUAB6.js} +5 -5
  22. package/dist/index.d.ts +137 -14
  23. package/dist/index.js +147 -636
  24. package/dist/index.js.map +1 -1
  25. package/dist/{issue-triage-PIE3YVCV.js → issue-triage-VRELWGYY.js} +4 -4
  26. package/dist/{pr-reviewer-helpers-4VDGMGV5.js → pr-reviewer-helpers-IPC6XCRK.js} +4 -4
  27. package/dist/{setup-data-dir-NU3YBIZB.js → setup-data-dir-LM2IFTFD.js} +3 -3
  28. package/package.json +1 -1
  29. package/dist/chunk-3YKFLM2B.js.map +0 -1
  30. package/dist/chunk-BYUVLVN7.js.map +0 -1
  31. package/dist/chunk-CQCVEC7P.js.map +0 -1
  32. package/dist/chunk-FBWOWMEB.js.map +0 -1
  33. package/dist/chunk-H5DTHO7O.js +0 -7
  34. package/dist/chunk-MXQG3A5W.js.map +0 -1
  35. package/dist/chunk-N347WXTT.js.map +0 -1
  36. /package/dist/{chunk-H5DTHO7O.js.map → chunk-2ONCHXIW.js.map} +0 -0
  37. /package/dist/{chunk-YQUM3UWK.js.map → chunk-GRBOJFKA.js.map} +0 -0
  38. /package/dist/{chunk-W6SM3MU5.js.map → chunk-ISE53XGS.js.map} +0 -0
  39. /package/dist/{chunk-QY3HOLGD.js.map → chunk-U4RQ4XPP.js.map} +0 -0
  40. /package/dist/{chunk-SQCFKQUR.js.map → chunk-YUKNO5ZM.js.map} +0 -0
  41. /package/dist/{consensus-vote-L4CN33XE.js.map → consensus-vote-6NUSZPQY.js.map} +0 -0
  42. /package/dist/{improvement-review-WTZ4JV5V.js.map → improvement-review-5EYOUAB6.js.map} +0 -0
  43. /package/dist/{issue-triage-PIE3YVCV.js.map → issue-triage-VRELWGYY.js.map} +0 -0
  44. /package/dist/{pr-reviewer-helpers-4VDGMGV5.js.map → pr-reviewer-helpers-IPC6XCRK.js.map} +0 -0
  45. /package/dist/{setup-data-dir-NU3YBIZB.js.map → setup-data-dir-LM2IFTFD.js.map} +0 -0
package/dist/index.js CHANGED
@@ -349,7 +349,6 @@ import {
349
349
  createDevStageRegistry,
350
350
  createDocumentationExpert,
351
351
  createDryRunHandler,
352
- createDurableAuditSink,
353
352
  createEventBusBridge,
354
353
  createExecutionContext,
355
354
  createExecutionPlan,
@@ -553,7 +552,7 @@ import {
553
552
  withLogging,
554
553
  withRetry,
555
554
  withRetryWrapper
556
- } from "./chunk-CQCVEC7P.js";
555
+ } from "./chunk-L4SJAHQF.js";
557
556
  import {
558
557
  FALLBACK_SCANNER_DATA,
559
558
  buildPlanFromAnalysis,
@@ -580,13 +579,13 @@ import {
580
579
  loadRules,
581
580
  runAstQaRules
582
581
  } from "./chunk-3XQK4MEF.js";
583
- import "./chunk-BYUVLVN7.js";
582
+ import "./chunk-3W4L63ML.js";
584
583
  import {
585
584
  closeServer,
586
585
  connectTransport,
587
586
  createServer,
588
587
  startStdioServer
589
- } from "./chunk-QY3HOLGD.js";
588
+ } from "./chunk-U4RQ4XPP.js";
590
589
  import {
591
590
  OPENAI_MODELS,
592
591
  OPENAI_MODEL_ALIASES,
@@ -644,7 +643,7 @@ import {
644
643
  generateProposalId,
645
644
  parseAgentPairKey,
646
645
  registerConsensusVoteTool
647
- } from "./chunk-SQCFKQUR.js";
646
+ } from "./chunk-YUKNO5ZM.js";
648
647
  import "./chunk-6HETGJSB.js";
649
648
  import {
650
649
  allOf
@@ -652,27 +651,34 @@ import {
652
651
  import "./chunk-ZGHJMFQ6.js";
653
652
  import {
654
653
  AgentActionSchema,
654
+ DEFAULT_FIREWALL_POLICY_MODE,
655
+ FIREWALL_POLICY_ENV_VAR,
656
+ FirewallPolicyModeSchema,
655
657
  GitHubReviewer,
656
658
  GitHubUserInfo,
659
+ HostileInputFirewall,
657
660
  SourceCitationSchema,
658
661
  ViolationSchema,
659
662
  canInfluenceDecisions,
660
663
  canProceed,
661
- checkRuleOfTwo,
662
664
  classifyTrust,
663
665
  createFullGitHubProvider,
666
+ createGitHubAdapter,
664
667
  evaluatePolicy as evaluatePolicy2,
668
+ generateATL,
665
669
  getCorroborationRules,
666
670
  getRequiredTrustTier,
667
671
  isMutatingAction,
668
672
  isReadOnlyAction,
669
673
  mapAuthorAssociation,
674
+ parseATL,
670
675
  requiresCitation,
671
676
  requiresCorroboration,
672
677
  requiresHumanApproval,
678
+ resolveFirewallPolicyMode,
673
679
  validateAgentAction,
674
680
  validateCorroboration
675
- } from "./chunk-MXQG3A5W.js";
681
+ } from "./chunk-XTSDR3HE.js";
676
682
  import {
677
683
  GitHubProvider,
678
684
  ScmError
@@ -689,15 +695,13 @@ import {
689
695
  TRUST_TIER_NUMERIC,
690
696
  TrustTierSchema,
691
697
  assessReputation,
692
- gateWithReputation,
693
- resolveEnvMode,
694
698
  resolveReputationGatingMode,
695
699
  sanitizeInput
696
- } from "./chunk-N347WXTT.js";
700
+ } from "./chunk-SHE6SSTO.js";
697
701
  import {
698
702
  ImprovementReviewInputSchema,
699
703
  registerImprovementReviewTool
700
- } from "./chunk-W6SM3MU5.js";
704
+ } from "./chunk-ISE53XGS.js";
701
705
  import {
702
706
  AgentPerformanceSchema,
703
707
  ConsensusAlgorithmSchema,
@@ -733,13 +737,12 @@ import {
733
737
  toolSuccess,
734
738
  toolSuccessStructured,
735
739
  validateToolInput
736
- } from "./chunk-YQUM3UWK.js";
740
+ } from "./chunk-GRBOJFKA.js";
737
741
  import {
738
742
  VERSION
739
- } from "./chunk-H5DTHO7O.js";
743
+ } from "./chunk-2ONCHXIW.js";
740
744
  import {
741
745
  AuditTrail,
742
- MAX_STRIPPED_ELEMENTS_PER_EVENT,
743
746
  createAuditTrail,
744
747
  createGraphAuditBridge,
745
748
  emitCorroborationEvent,
@@ -748,7 +751,7 @@ import {
748
751
  emitReputationEvent,
749
752
  emitSanitizationEvent,
750
753
  emitTrustEvent
751
- } from "./chunk-3YKFLM2B.js";
754
+ } from "./chunk-LP4W7RTH.js";
752
755
  import {
753
756
  UnifiedAdapterRegistry,
754
757
  createUnifiedRegistry,
@@ -2591,539 +2594,47 @@ function getSafetyTaxonomySummary() {
2591
2594
  };
2592
2595
  }
2593
2596
 
2594
- // src/security/firewall/firewall-policy-mode.ts
2595
- import { z as z5 } from "zod";
2596
- var FirewallPolicyModeSchema = z5.enum(["off", "audit", "enforce"]);
2597
- var DEFAULT_FIREWALL_POLICY_MODE = "off";
2598
- var FIREWALL_POLICY_ENV_VAR = "NEXUS_FIREWALL_POLICY";
2599
- function resolveFirewallPolicyMode(env = process.env, logger11) {
2600
- return resolveEnvMode(
2601
- env[FIREWALL_POLICY_ENV_VAR],
2602
- FirewallPolicyModeSchema,
2603
- DEFAULT_FIREWALL_POLICY_MODE,
2604
- FIREWALL_POLICY_ENV_VAR,
2605
- {
2606
- ...logger11 !== void 0 ? { logger: logger11 } : {},
2607
- // An explicit-but-invalid value lands on `audit`, NOT on the unset
2608
- // default `off`. Unset means "the operator has not opted in" and `off` is
2609
- // right for it; a typo means "the operator opted in and mistyped how",
2610
- // and answering that with the most permissive mode hands them a firewall
2611
- // that refuses nothing while they believe it is on. `audit` reports
2612
- // without refusing, so it cannot break an external caller any more than
2613
- // `off` can, and it emits the `wouldRefuse` telemetry the rollout is
2614
- // supposed to be collecting — which `off` does not.
2615
- invalidFallback: "audit"
2616
- }
2617
- );
2618
- }
2619
-
2620
- // src/security/firewall/firewall-types.ts
2621
- import { z as z6 } from "zod";
2622
- var FirewallStagesSchema = z6.object({
2623
- sanitization: z6.boolean().default(true),
2624
- trustClassification: z6.boolean().default(true),
2625
- reputationAssessment: z6.boolean().default(false),
2626
- policyEnforcement: z6.boolean().default(true),
2627
- corroboration: z6.boolean().default(false),
2628
- audit: z6.boolean().default(true)
2629
- });
2630
- var FirewallConfigSchema = z6.object({
2631
- stages: FirewallStagesSchema.default(() => ({
2632
- sanitization: true,
2633
- trustClassification: true,
2634
- reputationAssessment: false,
2635
- policyEnforcement: true,
2636
- corroboration: false,
2637
- audit: true
2638
- })),
2639
- allowlistedMaintainers: z6.array(z6.string().min(1)).default([]),
2640
- maxInputLength: z6.number().int().positive().default(5e4),
2641
- context: z6.object({
2642
- hasWriteAccess: z6.boolean().default(false),
2643
- hasSecretAccess: z6.boolean().default(false)
2644
- }).default(() => ({
2645
- hasWriteAccess: false,
2646
- hasSecretAccess: false
2647
- }))
2648
- });
2649
- var ATLDataSchema = z6.object({
2650
- tier: z6.enum(["1", "2", "3", "4"]),
2651
- source: z6.string().min(1),
2652
- user: z6.string().min(1),
2653
- sanitized: z6.boolean(),
2654
- rep: z6.number().min(0).max(1).optional()
2655
- });
2656
-
2657
- // src/security/firewall/agent-trust-labels.ts
2658
- var ATL_PREFIX = "[ATL:";
2659
- var ATL_SUFFIX = "]";
2660
- var ATL_PATTERN = /^\[ATL:(.+)\]$/;
2661
- function generateATL(data) {
2662
- const validated = ATLDataSchema.parse(data);
2663
- const parts = [
2664
- `tier=${validated.tier}`,
2665
- `source=${encodeATLValue(validated.source)}`,
2666
- `user=${encodeATLValue(validated.user)}`,
2667
- `sanitized=${String(validated.sanitized)}`
2668
- ];
2669
- if (validated.rep !== void 0) {
2670
- parts.push(`rep=${validated.rep.toFixed(2)}`);
2671
- }
2672
- return `${ATL_PREFIX}${parts.join(",")}${ATL_SUFFIX}`;
2673
- }
2674
- function parseATL(atl) {
2675
- const match = ATL_PATTERN.exec(atl.trim());
2676
- if (match === null) return void 0;
2677
- const body = match[1];
2678
- if (body === void 0) return void 0;
2679
- const raw = parseKeyValuePairs(body);
2680
- if (raw === void 0) return void 0;
2681
- return validateParsedATL(raw);
2682
- }
2683
- function parseKeyValuePairs(body) {
2684
- const pairs = body.split(",");
2685
- const raw = {};
2686
- for (const pair of pairs) {
2687
- const eqIndex = pair.indexOf("=");
2688
- if (eqIndex < 1) return void 0;
2689
- raw[pair.slice(0, eqIndex)] = pair.slice(eqIndex + 1);
2690
- }
2691
- return raw;
2692
- }
2693
- function validateParsedATL(raw) {
2694
- const tier = raw["tier"];
2695
- const source = raw["source"];
2696
- const user = raw["user"];
2697
- const sanitized = raw["sanitized"];
2698
- if (tier === void 0 || source === void 0 || user === void 0 || sanitized === void 0) {
2699
- return void 0;
2700
- }
2701
- const parsed = {
2702
- tier,
2703
- source: decodeATLValue(source),
2704
- user: decodeATLValue(user),
2705
- sanitized: sanitized === "true",
2706
- ...raw["rep"] !== void 0 ? { rep: parseFloat(raw["rep"]) } : {}
2707
- };
2708
- const result = ATLDataSchema.safeParse(parsed);
2709
- return result.success ? result.data : void 0;
2710
- }
2711
- function encodeATLValue(value) {
2712
- return value.replace(/,/g, "%2C").replace(/=/g, "%3D").replace(/\]/g, "%5D");
2713
- }
2714
- function decodeATLValue(value) {
2715
- return value.replace(/%2C/g, ",").replace(/%3D/g, "=").replace(/%5D/g, "]");
2716
- }
2717
-
2718
- // src/security/firewall/firewall-pipeline.ts
2719
- var logger3 = createLogger({ component: "HostileInputFirewall" });
2720
- var HostileInputFirewall = class {
2721
- stages;
2722
- allowlisted;
2723
- maxInputLength;
2724
- adapter;
2725
- reputationCache;
2726
- auditTrail;
2727
- context;
2728
- /** #5382 rollout gate; resolved once at construction, not per call. */
2729
- policyMode;
2730
- /** #5381 reputation-demotion gate; a DIFFERENT knob from `policyMode`. */
2731
- reputationGatingMode;
2732
- /** #5405 seam: how a reputation assessment is obtained. */
2733
- assessReputationFn;
2734
- constructor(config) {
2735
- const validated = FirewallConfigSchema.parse({
2736
- stages: config.stages,
2737
- allowlistedMaintainers: config.allowlistedMaintainers,
2738
- maxInputLength: config.maxInputLength,
2739
- context: config.context
2740
- });
2741
- this.stages = validated.stages;
2742
- this.allowlisted = validated.allowlistedMaintainers;
2743
- this.maxInputLength = validated.maxInputLength;
2744
- this.adapter = config.adapter;
2745
- this.reputationCache = new ReputationCache();
2746
- this.auditTrail = createAuditTrail(
2747
- config.auditLogger !== void 0 ? createDurableAuditSink(config.auditLogger) : void 0
2748
- );
2749
- this.context = validated.context;
2750
- this.policyMode = config.policyMode ?? resolveFirewallPolicyMode(config.env ?? process.env);
2751
- this.reputationGatingMode = config.reputationGatingMode ?? resolveReputationGatingMode(config.env ?? process.env);
2752
- this.assessReputationFn = config.reputationAssessor ?? ((metadata) => assessReputation(metadata, this.reputationCache));
2753
- }
2754
- /**
2755
- * Processes untrusted input through the firewall pipeline.
2756
- * Returns a structured FirewallResult or a typed FirewallError.
2757
- */
2758
- process(input) {
2759
- const start = Date.now();
2760
- this.auditTrail.clear();
2761
- const metaResult = this.runExtraction(input);
2762
- if (!metaResult.ok) return metaResult;
2763
- const meta = metaResult.value;
2764
- const sanitized = this.runSanitization(meta);
2765
- const trust = this.runClassification(meta, sanitized);
2766
- const reputation = this.runReputation(meta, sanitized);
2767
- const { tier: effectiveTrustTier, gate: reputationGate } = this.runReputationGate(
2768
- trust.trustTier,
2769
- reputation
2770
- );
2771
- const atl = this.buildATL(meta, effectiveTrustTier, sanitized, reputation);
2772
- const ruleOfTwoViolation = this.stages.policyEnforcement ? checkRuleOfTwo({
2773
- inputTrustTier: effectiveTrustTier,
2774
- hasWriteAccess: this.context.hasWriteAccess,
2775
- hasSecretAccess: this.context.hasSecretAccess
2776
- }) : void 0;
2777
- if (ruleOfTwoViolation !== void 0) {
2778
- logger3.warn("Firewall surfaced a Rule-of-Two violation", {
2779
- user: meta.username,
2780
- effectiveTrustTier,
2781
- rule: ruleOfTwoViolation.rule
2782
- });
2783
- }
2784
- const blocking = ruleOfTwoViolation?.severity === "block";
2785
- const refusal = this.refuseIfEnforcing(ruleOfTwoViolation, meta, effectiveTrustTier);
2786
- if (refusal !== void 0) return err(refusal);
2787
- const auditEvents = this.auditTrail.query().map((e) => ({ id: e.id, type: e.type }));
2788
- return ok({
2789
- sanitized,
2790
- trust,
2791
- ...reputation !== void 0 ? { reputation } : {},
2792
- effectiveTrustTier,
2793
- ...reputationGate !== void 0 ? { reputationGate } : {},
2794
- atl,
2795
- ...ruleOfTwoViolation !== void 0 ? { ruleOfTwoViolation } : {},
2796
- policyMode: this.policyMode,
2797
- // Reached only when we did NOT refuse, so this is "audit mode saw
2798
- // something enforce would have stopped". Under `off` it stays false: the
2799
- // signal is already on `ruleOfTwoViolation`, and reporting a would-be
2800
- // refusal for a mode that has not opted in would overstate the gate.
2801
- wouldRefuse: blocking && this.policyMode === "audit",
2802
- auditEvents,
2803
- durationMs: Date.now() - start
2804
- });
2805
- }
2806
- /**
2807
- * The fail-closed half of the #5382 gate: under `enforce`, a blocking policy
2808
- * violation refuses the input instead of riding along as a signal on an
2809
- * `ok()` result that a caller checking only `result.ok` walks straight past.
2810
- *
2811
- * This gates the RESPONSE to a violation, never its detection. It cannot
2812
- * manufacture a refusal where the `policyEnforcement` stage never ran, and it
2813
- * cannot refuse a non-blocking (`warn`) violation — so `enforce` is not a
2814
- * kill switch, and an allowlisted maintainer stays served.
2815
- *
2816
- * @returns the refusal, or `undefined` when the input passes or the mode has
2817
- * not opted in.
2818
- */
2819
- refuseIfEnforcing(violation, meta, effectiveTrustTier) {
2820
- if (violation?.severity !== "block" || this.policyMode !== "enforce") return void 0;
2821
- logger3.warn("Firewall REFUSED input under enforce mode", {
2822
- user: meta.username,
2823
- effectiveTrustTier,
2824
- rule: violation.rule
2825
- });
2826
- return {
2827
- code: "POLICY_REFUSED",
2828
- message: `Refused by firewall policy: ${violation.rule} \u2014 ${violation.message}`,
2829
- stage: "policy"
2830
- };
2831
- }
2832
- /**
2833
- * Validates corroboration for a decided action (#5382).
2834
- *
2835
- * Separate from {@link process} because the two operate at different points
2836
- * in the lifecycle, which is the real shape of the divergence epic #5281
2837
- * found: `process()` is INPUT-shaped — it sanitizes, classifies and labels
2838
- * untrusted content — while corroboration is ACTION-shaped, asking whether a
2839
- * decision the consumer has now reached is backed by sources of sufficient
2840
- * tier. There is no `AgentAction` in scope during `process()`, so the
2841
- * `stages.corroboration` flag could never have been wired there; this is the
2842
- * entry point that makes it readable.
2843
- *
2844
- * It is also the shape #5383 needs: production validates corroboration per
2845
- * action (`issue-triage.ts:391`), so those callers cannot migrate onto the
2846
- * firewall unless it offers a per-action surface.
2847
- *
2848
- * Returns `evaluated: false` when the stage is disabled — never a satisfied
2849
- * verdict for a check that did not run. Under `enforce` an unsatisfied action
2850
- * is refused with `POLICY_REFUSED`; under `audit` the would-be refusal is
2851
- * reported via `wouldRefuse` and the action is allowed through.
2852
- */
2853
- validateAction(action) {
2854
- if (!this.stages.corroboration) {
2855
- return ok({
2856
- evaluated: false,
2857
- reason: "corroboration-stage-disabled",
2858
- policyMode: this.policyMode
2859
- });
2860
- }
2861
- const corroboration = validateCorroboration(action);
2862
- if (!corroboration.satisfied && this.policyMode === "enforce") {
2863
- logger3.warn("Firewall REFUSED an uncorroborated action under enforce mode", {
2864
- actionType: corroboration.actionType,
2865
- missing: corroboration.missing
2866
- });
2867
- return err({
2868
- code: "POLICY_REFUSED",
2869
- message: `Refused by firewall policy: ${corroboration.actionType} lacks required corroboration \u2014 ${corroboration.missing.join("; ")}`,
2870
- stage: "corroboration"
2871
- });
2872
- }
2873
- return ok({
2874
- evaluated: true,
2875
- satisfied: corroboration.satisfied,
2876
- missing: corroboration.missing,
2877
- corroboratingSources: corroboration.corroboratingSources,
2878
- policyMode: this.policyMode,
2879
- wouldRefuse: !corroboration.satisfied && this.policyMode === "audit"
2880
- });
2881
- }
2882
- /** Returns the internal audit trail for inspection. */
2883
- getAuditTrail() {
2884
- return this.auditTrail;
2885
- }
2886
- // ==========================================================================
2887
- // Pipeline Stages (private)
2888
- // ==========================================================================
2889
- runExtraction(input) {
2890
- try {
2891
- const meta = this.adapter.extractMetadata(input);
2892
- return ok(meta);
2893
- } catch (cause) {
2894
- const message = cause instanceof Error ? cause.message : String(cause);
2895
- return err({
2896
- code: "EXTRACTION_FAILED",
2897
- message: `Adapter extraction failed: ${message}`,
2898
- stage: "extraction"
2899
- });
2900
- }
2901
- }
2902
- runSanitization(meta) {
2903
- if (!this.stages.sanitization) {
2904
- return createPassthroughSanitized(meta);
2905
- }
2906
- const result = sanitizeInput(
2907
- meta.content,
2908
- mapAuthorAssociation(meta.authorAssociation),
2909
- meta.username,
2910
- {
2911
- allowlistedMaintainers: [...this.allowlisted],
2912
- maxInputLength: this.maxInputLength
2913
- }
2914
- );
2915
- if (this.stages.audit) {
2916
- emitSanitizationEvent(this.auditTrail, {
2917
- source: meta.sourceType,
2918
- wasModified: result.wasModified,
2919
- strippedCount: result.strippedElements.length,
2920
- injectionFlagCount: result.injectionFlags.length,
2921
- strippedElements: result.strippedElements.slice(0, MAX_STRIPPED_ELEMENTS_PER_EVENT).map((e) => ({ tag: e.tag, reason: e.reason }))
2922
- });
2923
- }
2924
- return result;
2925
- }
2926
- runClassification(meta, sanitized) {
2927
- if (!this.stages.trustClassification) {
2928
- return createPassthroughClassification(meta);
2929
- }
2930
- const result = classifyTrust({
2931
- username: meta.username,
2932
- authorAssociation: meta.authorAssociation,
2933
- sanitizedInput: sanitized,
2934
- config: {
2935
- allowlistedMaintainers: [...this.allowlisted]
2936
- }
2937
- });
2938
- if (this.stages.audit) {
2939
- emitTrustEvent(this.auditTrail, {
2940
- username: meta.username,
2941
- assignedTier: result.trustTier,
2942
- userRole: result.userRole,
2943
- isAllowlisted: result.isAllowlisted,
2944
- wasDowngraded: result.wasDowngraded,
2945
- reason: result.reason
2946
- });
2947
- }
2948
- return result;
2949
- }
2950
- /**
2951
- * Reconcile the classifier tier with reputation, under the rollout mode
2952
- * production honours (#3106 reconciliation, #5381 gating).
2953
- *
2954
- * #3106's reconciliation is demotion-only; Tier-1/allowlist wins; it equals
2955
- * the classifier tier when reputation is absent. #5381 puts it behind
2956
- * `NEXUS_REPUTATION_GATING`, so `audit` is audit-only here too — previously
2957
- * the firewall enforced unconditionally while production suppressed, on
2958
- * identical configuration.
2959
- *
2960
- * Returns no gate at all when the stage is off, so absence in the result
2961
- * means "not evaluated" rather than "evaluated, nothing suppressed" —
2962
- * `demotionSuppressed` is a required boolean and would otherwise report
2963
- * `false` for a check that never ran.
2964
- */
2965
- runReputationGate(classifierTier, reputation) {
2966
- if (!this.stages.reputationAssessment) return { tier: classifierTier };
2967
- const gate = gateWithReputation(classifierTier, reputation, this.reputationGatingMode);
2968
- return { tier: gate.enforcedTier, gate };
2969
- }
2970
- runReputation(meta, sanitized) {
2971
- if (!this.stages.reputationAssessment) return void 0;
2972
- const metadata = {
2973
- username: meta.username,
2974
- authorAssociation: meta.authorAssociation.toUpperCase(),
2975
- injectionFlags: sanitized.injectionFlags
2976
- };
2977
- const result = this.assessReputationFn(metadata);
2978
- if (this.stages.audit) {
2979
- emitReputationEvent(this.auditTrail, {
2980
- username: meta.username,
2981
- reputationScore: result.reputationScore,
2982
- isSuspicious: result.isSuspicious,
2983
- effectiveTier: result.effectiveTrustTier,
2984
- signalCount: result.suspiciousSignals.length
2985
- });
2986
- }
2987
- return result;
2988
- }
2989
- buildATL(meta, effectiveTrustTier, sanitized, reputation) {
2990
- const data = {
2991
- tier: effectiveTrustTier,
2992
- source: meta.sourceType,
2993
- user: meta.username,
2994
- sanitized: sanitized.wasModified,
2995
- ...reputation !== void 0 ? { rep: reputation.reputationScore / 100 } : {}
2996
- };
2997
- return generateATL(data);
2998
- }
2999
- };
3000
- function createPassthroughSanitized(meta) {
3001
- return {
3002
- content: meta.content,
3003
- originalLength: meta.content.length,
3004
- trustTier: "3",
3005
- userRole: mapAuthorAssociation(meta.authorAssociation),
3006
- injectionFlags: [],
3007
- strippedElements: [],
3008
- wasModified: false,
3009
- sanitizedAt: (/* @__PURE__ */ new Date()).toISOString()
3010
- };
3011
- }
3012
- function createPassthroughClassification(meta) {
3013
- return {
3014
- trustTier: "3",
3015
- userRole: mapAuthorAssociation(meta.authorAssociation),
3016
- isAllowlisted: false,
3017
- wasDowngraded: false,
3018
- reason: "Trust classification disabled \u2014 default Tier 3"
3019
- };
3020
- }
3021
-
3022
- // src/security/firewall/github-adapter.ts
3023
- import { z as z7 } from "zod";
3024
- var GitHubIssueSchema = z7.object({
3025
- type: z7.literal("issue"),
3026
- username: z7.string().min(1),
3027
- authorAssociation: z7.string().min(1),
3028
- title: z7.string().default(""),
3029
- body: z7.string().default("")
3030
- });
3031
- var GitHubCommentSchema = z7.object({
3032
- type: z7.literal("comment"),
3033
- username: z7.string().min(1),
3034
- authorAssociation: z7.string().min(1),
3035
- body: z7.string().default("")
3036
- });
3037
- var GitHubPRSchema = z7.object({
3038
- type: z7.literal("pull_request"),
3039
- username: z7.string().min(1),
3040
- authorAssociation: z7.string().min(1),
3041
- title: z7.string().default(""),
3042
- body: z7.string().default("")
3043
- });
3044
- var GitHubInputSchema = z7.discriminatedUnion("type", [
3045
- GitHubIssueSchema,
3046
- GitHubCommentSchema,
3047
- GitHubPRSchema
3048
- ]);
3049
- function toSourceType(type) {
3050
- const mapping = {
3051
- issue: "github-issue",
3052
- comment: "github-comment",
3053
- pull_request: "github-pr"
3054
- };
3055
- return mapping[type];
3056
- }
3057
- function extractContent(input) {
3058
- if (input.type === "comment") return input.body;
3059
- const title = input.title;
3060
- const body = input.body;
3061
- return title && body ? `${title}
3062
-
3063
- ${body}` : title || body;
3064
- }
3065
- function createGitHubAdapter() {
3066
- return {
3067
- platform: "github",
3068
- extractMetadata(input) {
3069
- const result = GitHubInputSchema.safeParse(input);
3070
- if (!result.success) {
3071
- const issues = result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; ");
3072
- throw new Error(`GitHub input validation failed: ${issues}`);
3073
- }
3074
- const parsed = result.data;
3075
- const role = mapAuthorAssociation(parsed.authorAssociation);
3076
- return {
3077
- username: parsed.username,
3078
- authorAssociation: role,
3079
- content: extractContent(parsed),
3080
- sourceType: toSourceType(parsed.type)
3081
- };
3082
- }
3083
- };
3084
- }
3085
-
3086
2597
  // src/orchestration/spec-parser-types.ts
3087
- import { z as z8 } from "zod";
3088
- var IssueReferenceSchema = z8.object({
2598
+ import { z as z5 } from "zod";
2599
+ var IssueReferenceSchema = z5.object({
3089
2600
  /** Issue/PR number */
3090
- number: z8.number().int().positive(),
2601
+ number: z5.number().int().positive(),
3091
2602
  /** Raw text (e.g., "#123") */
3092
- raw: z8.string()
2603
+ raw: z5.string()
3093
2604
  });
3094
- var FileReferenceSchema = z8.object({
2605
+ var FileReferenceSchema = z5.object({
3095
2606
  /** File path (e.g., "src/foo.ts") */
3096
- path: z8.string(),
2607
+ path: z5.string(),
3097
2608
  /** Optional line number */
3098
- line: z8.number().int().positive().optional()
2609
+ line: z5.number().int().positive().optional()
3099
2610
  });
3100
- var TechStackSchema = z8.object({
2611
+ var TechStackSchema = z5.object({
3101
2612
  /** Programming language */
3102
- language: z8.string().optional(),
2613
+ language: z5.string().optional(),
3103
2614
  /** Framework or library */
3104
- framework: z8.string().optional(),
2615
+ framework: z5.string().optional(),
3105
2616
  /** Package manager */
3106
- packageManager: z8.string().optional()
2617
+ packageManager: z5.string().optional()
3107
2618
  });
3108
- var ParsedSpecSchema = z8.object({
2619
+ var ParsedSpecSchema = z5.object({
3109
2620
  /** Spec title (from first H1 or H2 heading) */
3110
- title: z8.string().min(1),
2621
+ title: z5.string().min(1),
3111
2622
  /** Overview/description text */
3112
- overview: z8.string(),
2623
+ overview: z5.string(),
3113
2624
  /** List of requirements */
3114
- requirements: z8.array(z8.string()),
2625
+ requirements: z5.array(z5.string()),
3115
2626
  /** Acceptance criteria (checklist items) */
3116
- acceptanceCriteria: z8.array(z8.string()),
2627
+ acceptanceCriteria: z5.array(z5.string()),
3117
2628
  /** Constraints or limitations */
3118
- constraints: z8.array(z8.string()),
2629
+ constraints: z5.array(z5.string()),
3119
2630
  /** Issue/PR references found in the spec */
3120
- issueReferences: z8.array(IssueReferenceSchema),
2631
+ issueReferences: z5.array(IssueReferenceSchema),
3121
2632
  /** File path references found in the spec */
3122
- fileReferences: z8.array(FileReferenceSchema),
2633
+ fileReferences: z5.array(FileReferenceSchema),
3123
2634
  /** Sections that were missing from the spec */
3124
- missingSections: z8.array(z8.string()),
2635
+ missingSections: z5.array(z5.string()),
3125
2636
  /** Raw markdown source */
3126
- rawMarkdown: z8.string(),
2637
+ rawMarkdown: z5.string(),
3127
2638
  /** Inferred technology stack */
3128
2639
  techStack: TechStackSchema.optional()
3129
2640
  });
@@ -3139,136 +2650,136 @@ var KNOWN_SECTIONS = [
3139
2650
  ];
3140
2651
 
3141
2652
  // src/orchestration/spec-decomposer-types.ts
3142
- import { z as z9 } from "zod";
3143
- var SubtaskTypeSchema = z9.enum(["code", "test", "docs", "config", "refactor"]);
3144
- var ComplexityLevelSchema = z9.enum(["simple", "moderate", "complex", "expert"]);
3145
- var SubtaskNodeSchema = z9.object({
2653
+ import { z as z6 } from "zod";
2654
+ var SubtaskTypeSchema = z6.enum(["code", "test", "docs", "config", "refactor"]);
2655
+ var ComplexityLevelSchema = z6.enum(["simple", "moderate", "complex", "expert"]);
2656
+ var SubtaskNodeSchema = z6.object({
3146
2657
  /** Unique identifier for this subtask */
3147
- id: z9.string().min(1),
2658
+ id: z6.string().min(1),
3148
2659
  /** Human-readable description of what this subtask does */
3149
- description: z9.string().min(1),
2660
+ description: z6.string().min(1),
3150
2661
  /** The type of work */
3151
2662
  type: SubtaskTypeSchema,
3152
2663
  /** Estimated complexity */
3153
2664
  complexity: ComplexityLevelSchema,
3154
2665
  /** Required capabilities for the executing agent */
3155
- capabilities: z9.array(z9.string()),
2666
+ capabilities: z6.array(z6.string()),
3156
2667
  /** IDs of subtasks this depends on */
3157
- dependsOn: z9.array(z9.string()),
2668
+ dependsOn: z6.array(z6.string()),
3158
2669
  /** Source requirement text that generated this subtask */
3159
- sourceRequirement: z9.string().optional()
2670
+ sourceRequirement: z6.string().optional()
3160
2671
  });
3161
- var DagEdgeSchema = z9.object({
2672
+ var DagEdgeSchema = z6.object({
3162
2673
  /** Source subtask ID */
3163
- from: z9.string().min(1),
2674
+ from: z6.string().min(1),
3164
2675
  /** Target subtask ID */
3165
- to: z9.string().min(1)
2676
+ to: z6.string().min(1)
3166
2677
  });
3167
- var TaskDagSchema = z9.object({
2678
+ var TaskDagSchema = z6.object({
3168
2679
  /** All subtask nodes */
3169
- nodes: z9.array(SubtaskNodeSchema),
2680
+ nodes: z6.array(SubtaskNodeSchema),
3170
2681
  /** Dependency edges (from must complete before to) */
3171
- edges: z9.array(DagEdgeSchema),
2682
+ edges: z6.array(DagEdgeSchema),
3172
2683
  /** Subtask IDs that can execute in parallel (no dependencies) */
3173
- roots: z9.array(z9.string()),
2684
+ roots: z6.array(z6.string()),
3174
2685
  /** Total estimated complexity across all subtasks */
3175
2686
  totalComplexity: ComplexityLevelSchema,
3176
2687
  /** Source spec title for traceability */
3177
- specTitle: z9.string()
2688
+ specTitle: z6.string()
3178
2689
  });
3179
2690
 
3180
2691
  // src/orchestration/scenario-validator-types.ts
3181
- import { z as z10 } from "zod";
3182
- var CriterionResultSchema = z10.object({
2692
+ import { z as z7 } from "zod";
2693
+ var CriterionResultSchema = z7.object({
3183
2694
  /** The original acceptance criterion text */
3184
- criterion: z10.string(),
2695
+ criterion: z7.string(),
3185
2696
  /** Whether this criterion was satisfied */
3186
- met: z10.boolean(),
2697
+ met: z7.boolean(),
3187
2698
  /** Which result(s) matched this criterion */
3188
- matchedResults: z10.array(z10.string())
2699
+ matchedResults: z7.array(z7.string())
3189
2700
  });
3190
- var ScenarioResultSchema = z10.object({
2701
+ var ScenarioResultSchema = z7.object({
3191
2702
  /** Satisfaction score from 0 (none met) to 1 (all met) */
3192
- satisfaction: z10.number().min(0).max(1),
2703
+ satisfaction: z7.number().min(0).max(1),
3193
2704
  /** Total acceptance criteria count */
3194
- totalCriteria: z10.number().int().nonnegative(),
2705
+ totalCriteria: z7.number().int().nonnegative(),
3195
2706
  /** Number of criteria met */
3196
- metCount: z10.number().int().nonnegative(),
2707
+ metCount: z7.number().int().nonnegative(),
3197
2708
  /** Per-criterion results */
3198
- criteria: z10.array(CriterionResultSchema),
2709
+ criteria: z7.array(CriterionResultSchema),
3199
2710
  /** Whether all criteria are met */
3200
- allMet: z10.boolean()
2711
+ allMet: z7.boolean()
3201
2712
  });
3202
2713
 
3203
2714
  // src/orchestration/parallel-exploration-types.ts
3204
- import { z as z11 } from "zod";
3205
- var ParallelExplorationConfigSchema = z11.object({
2715
+ import { z as z8 } from "zod";
2716
+ var ParallelExplorationConfigSchema = z8.object({
3206
2717
  /** Max CLIs to dispatch to in parallel (default: 3) */
3207
- maxParallelClis: z11.number().int().min(1).max(4).default(3),
2718
+ maxParallelClis: z8.number().int().min(1).max(4).default(3),
3208
2719
  /** Timeout per CLI invocation in ms (default: explorationMs from centralized timeouts). */
3209
- perCliTimeoutMs: z11.number().int().min(1e3).max(3e5).default(PER_CLI_TASK_TIMEOUTS.explorationMs),
2720
+ perCliTimeoutMs: z8.number().int().min(1e3).max(3e5).default(PER_CLI_TASK_TIMEOUTS.explorationMs),
3210
2721
  /** Maximum output chars per CLI response (default: 8000, raised from 4k for exploration depth). */
3211
- maxOutputCharsPerCli: z11.number().int().min(100).max(2e4).default(8e3)
2722
+ maxOutputCharsPerCli: z8.number().int().min(100).max(2e4).default(8e3)
3212
2723
  });
3213
2724
 
3214
2725
  // src/orchestration/triangulated-review-types.ts
3215
- import { z as z12 } from "zod";
3216
- var TriangulatedReviewConfigSchema = z12.object({
2726
+ import { z as z9 } from "zod";
2727
+ var TriangulatedReviewConfigSchema = z9.object({
3217
2728
  /** Max CLIs to dispatch to (default: 3). */
3218
- maxClis: z12.number().int().min(1).max(4).default(3),
2729
+ maxClis: z9.number().int().min(1).max(4).default(3),
3219
2730
  /** Per-CLI timeout in ms (default from config/timeouts.ts, Issue #984). */
3220
- perCliTimeoutMs: z12.number().int().min(PER_CLI_TASK_TIMEOUTS.minMs).max(PER_CLI_TASK_TIMEOUTS.maxMs).default(PER_CLI_TASK_TIMEOUTS.defaultMs),
2731
+ perCliTimeoutMs: z9.number().int().min(PER_CLI_TASK_TIMEOUTS.minMs).max(PER_CLI_TASK_TIMEOUTS.maxMs).default(PER_CLI_TASK_TIMEOUTS.defaultMs),
3221
2732
  /** Max chars per CLI response (default: 8000). */
3222
- maxOutputCharsPerCli: z12.number().int().min(100).max(3e4).default(8e3),
2733
+ maxOutputCharsPerCli: z9.number().int().min(100).max(3e4).default(8e3),
3223
2734
  /** Line proximity for dedup: findings within N lines are considered same (default: 5). */
3224
- lineProximity: z12.number().int().min(0).max(50).default(5)
2735
+ lineProximity: z9.number().int().min(0).max(50).default(5)
3225
2736
  });
3226
2737
 
3227
2738
  // src/orchestration/triangulated-review.ts
3228
2739
  var moduleLogger = createLogger({ component: "triangulated-review" });
3229
2740
 
3230
2741
  // src/orchestration/consensus-plan-types.ts
3231
- import { z as z13 } from "zod";
3232
- var PlanStepSchema = z13.object({
2742
+ import { z as z10 } from "zod";
2743
+ var PlanStepSchema = z10.object({
3233
2744
  /** Step description. */
3234
- description: z13.string(),
2745
+ description: z10.string(),
3235
2746
  /** Estimated complexity: low, medium, high. */
3236
- complexity: z13.enum(["low", "medium", "high"]).default("medium"),
2747
+ complexity: z10.enum(["low", "medium", "high"]).default("medium"),
3237
2748
  /** Dependencies on other step indices. */
3238
- dependencies: z13.array(z13.number().int().min(0)).default([])
2749
+ dependencies: z10.array(z10.number().int().min(0)).default([])
3239
2750
  });
3240
- var PlanRiskSchema = z13.object({
2751
+ var PlanRiskSchema = z10.object({
3241
2752
  /** Risk description. */
3242
- description: z13.string(),
2753
+ description: z10.string(),
3243
2754
  /** Impact level. */
3244
- impact: z13.enum(["low", "medium", "high"]).default("medium"),
2755
+ impact: z10.enum(["low", "medium", "high"]).default("medium"),
3245
2756
  /** Mitigation strategy. */
3246
- mitigation: z13.string().default("")
2757
+ mitigation: z10.string().default("")
3247
2758
  });
3248
- var ConsensusPlanConfigSchema = z13.object({
2759
+ var ConsensusPlanConfigSchema = z10.object({
3249
2760
  /** Max CLIs to dispatch to (default: 3). */
3250
- maxClis: z13.number().int().min(1).max(4).default(3),
2761
+ maxClis: z10.number().int().min(1).max(4).default(3),
3251
2762
  /** Per-CLI timeout in ms (default from config/timeouts.ts, Issue #984). */
3252
- perCliTimeoutMs: z13.number().int().min(PER_CLI_TASK_TIMEOUTS.minMs).max(PER_CLI_TASK_TIMEOUTS.maxMs).default(PER_CLI_TASK_TIMEOUTS.defaultMs),
2763
+ perCliTimeoutMs: z10.number().int().min(PER_CLI_TASK_TIMEOUTS.minMs).max(PER_CLI_TASK_TIMEOUTS.maxMs).default(PER_CLI_TASK_TIMEOUTS.defaultMs),
3253
2764
  /** Max chars per CLI response (default: 8000). */
3254
- maxOutputCharsPerCli: z13.number().int().min(100).max(3e4).default(8e3)
2765
+ maxOutputCharsPerCli: z10.number().int().min(100).max(3e4).default(8e3)
3255
2766
  });
3256
2767
 
3257
2768
  // src/orchestration/consensus-plan.ts
3258
2769
  var moduleLogger2 = createLogger({ component: "consensus-plan" });
3259
2770
 
3260
2771
  // src/agents/observability/orchestration-observer-types.ts
3261
- import { z as z14 } from "zod";
3262
- var AgentStateSchema = z14.enum(["idle", "thinking", "executing", "waiting", "error"]);
3263
- var OrchestrationObserverConfigSchema = z14.object({
2772
+ import { z as z11 } from "zod";
2773
+ var AgentStateSchema = z11.enum(["idle", "thinking", "executing", "waiting", "error"]);
2774
+ var OrchestrationObserverConfigSchema = z11.object({
3264
2775
  /** Maximum routing decisions to retain in history */
3265
- maxRoutingHistory: z14.number().positive().optional().default(100),
2776
+ maxRoutingHistory: z11.number().positive().optional().default(100),
3266
2777
  /** Maximum session metrics to retain */
3267
- maxSessionHistory: z14.number().positive().optional().default(50),
2778
+ maxSessionHistory: z11.number().positive().optional().default(50),
3268
2779
  /** Metrics update interval in ms */
3269
- metricsUpdateIntervalMs: z14.number().positive().optional().default(5e3),
2780
+ metricsUpdateIntervalMs: z11.number().positive().optional().default(5e3),
3270
2781
  /** Enable detailed event logging */
3271
- verboseLogging: z14.boolean().optional().default(false),
2782
+ verboseLogging: z11.boolean().optional().default(false),
3272
2783
  /**
3273
2784
  * Per-model cost rate override, USD per 1,000 tokens (#5180).
3274
2785
  *
@@ -3287,13 +2798,13 @@ var OrchestrationObserverConfigSchema = z14.object({
3287
2798
  * defect this replaces. An operator who wants the old figures can keep their
3288
2799
  * existing scalar config and get byte-identical results.
3289
2800
  */
3290
- tokenCostRates: z14.record(
3291
- z14.string(),
3292
- z14.union([
3293
- z14.number().nonnegative(),
3294
- z14.object({
3295
- input: z14.number().nonnegative(),
3296
- output: z14.number().nonnegative()
2801
+ tokenCostRates: z11.record(
2802
+ z11.string(),
2803
+ z11.union([
2804
+ z11.number().nonnegative(),
2805
+ z11.object({
2806
+ input: z11.number().nonnegative(),
2807
+ output: z11.number().nonnegative()
3297
2808
  })
3298
2809
  ])
3299
2810
  ).optional().default({})
@@ -3522,7 +3033,7 @@ var DEFAULT_BENCHMARK_CONFIG = {
3522
3033
 
3523
3034
  // src/benchmarks/benchmark-runner.ts
3524
3035
  import { cpus, totalmem, platform, arch } from "node:os";
3525
- var logger4 = createLogger({ component: "benchmark-runner" });
3036
+ var logger3 = createLogger({ component: "benchmark-runner" });
3526
3037
  var LatencySampler = class {
3527
3038
  samples = [];
3528
3039
  startTimes = /* @__PURE__ */ new Map();
@@ -3618,11 +3129,11 @@ async function runOperationBenchmark(operation, datasetSize, fn, config = {}) {
3618
3129
  const startTime = getTimeProvider().now();
3619
3130
  const startMemory = process.memoryUsage().heapUsed;
3620
3131
  let peakMemory = startMemory;
3621
- logger4.debug("Running warmup", { operation, iterations: cfg.warmupIterations });
3132
+ logger3.debug("Running warmup", { operation, iterations: cfg.warmupIterations });
3622
3133
  for (let i = 0; i < cfg.warmupIterations; i++) {
3623
3134
  await fn();
3624
3135
  }
3625
- logger4.debug("Running measurements", { operation, iterations: cfg.measurementIterations });
3136
+ logger3.debug("Running measurements", { operation, iterations: cfg.measurementIterations });
3626
3137
  for (let i = 0; i < cfg.measurementIterations; i++) {
3627
3138
  const id = `op-${String(i)}`;
3628
3139
  sampler.start(id);
@@ -3757,7 +3268,7 @@ ${"=".repeat(60)}`);
3757
3268
  }
3758
3269
 
3759
3270
  // src/benchmarks/memory-benchmarks.ts
3760
- var logger5 = createLogger({ component: "memory-benchmarks" });
3271
+ var logger4 = createLogger({ component: "memory-benchmarks" });
3761
3272
  var DEFAULT_MEMORY_BENCHMARK_CONFIG = {
3762
3273
  ...DEFAULT_BENCHMARK_CONFIG,
3763
3274
  contentSizeBytes: 1024,
@@ -3865,9 +3376,9 @@ async function benchmarkPrune(backend, data, config) {
3865
3376
  async function runMemoryBenchmarks(backend, name, config = {}) {
3866
3377
  const cfg = { ...DEFAULT_MEMORY_BENCHMARK_CONFIG, ...config };
3867
3378
  const operations = [];
3868
- logger5.info("Starting memory benchmarks", { name, sizes: cfg.datasetSizes });
3379
+ logger4.info("Starting memory benchmarks", { name, sizes: cfg.datasetSizes });
3869
3380
  for (const size of cfg.datasetSizes) {
3870
- logger5.info("Running benchmarks for dataset size", { size });
3381
+ logger4.info("Running benchmarks for dataset size", { size });
3871
3382
  const data = generateTestData(size, cfg);
3872
3383
  try {
3873
3384
  const futureDate = new Date(getTimeProvider().now() + 365 * 24 * 60 * 60 * 1e3);
@@ -3881,7 +3392,7 @@ async function runMemoryBenchmarks(backend, name, config = {}) {
3881
3392
  }
3882
3393
  const environment = getBenchmarkEnvironment();
3883
3394
  const summary = createBenchmarkSummary(operations, cfg);
3884
- logger5.info("Benchmarks complete", {
3395
+ logger4.info("Benchmarks complete", {
3885
3396
  name,
3886
3397
  passed: summary.passed,
3887
3398
  avgP95: summary.avgP95Latency,
@@ -3927,7 +3438,7 @@ function compareBenchmarks(baseline, current) {
3927
3438
  }
3928
3439
 
3929
3440
  // src/benchmarks/token-benchmark.ts
3930
- var logger6 = createLogger({ component: "token-benchmark" });
3441
+ var logger5 = createLogger({ component: "token-benchmark" });
3931
3442
  var CHARS_PER_TOKEN = 4;
3932
3443
  function estimateTokens2(text) {
3933
3444
  return Math.ceil(text.length / CHARS_PER_TOKEN);
@@ -3945,7 +3456,7 @@ async function runTokenBenchmark(backend, config = {}) {
3945
3456
  const cfg = { ...DEFAULT_MEMORY_BENCHMARK_CONFIG, ...config };
3946
3457
  const results = [];
3947
3458
  for (const size of cfg.datasetSizes) {
3948
- logger6.info("Running token benchmark", { size });
3459
+ logger5.info("Running token benchmark", { size });
3949
3460
  const data = generateTestData(size, cfg);
3950
3461
  for (const entry of data.entries) {
3951
3462
  await backend.store(entry.key, entry.content, {
@@ -3978,15 +3489,15 @@ async function runTokenBenchmark(backend, config = {}) {
3978
3489
  }
3979
3490
 
3980
3491
  // src/benchmarks/consolidation-benchmark.ts
3981
- var logger7 = createLogger({ component: "consolidation-benchmark" });
3492
+ var logger6 = createLogger({ component: "consolidation-benchmark" });
3982
3493
  async function runConsolidationBenchmark(operations, config = {}) {
3983
3494
  const cfg = { ...DEFAULT_MEMORY_BENCHMARK_CONFIG, ...config };
3984
3495
  const benchmarks = [];
3985
- logger7.info("Starting consolidation benchmarks", {
3496
+ logger6.info("Starting consolidation benchmarks", {
3986
3497
  operationCount: operations.length
3987
3498
  });
3988
3499
  for (const op of operations) {
3989
- logger7.info("Benchmarking consolidation operation", { name: op.name });
3500
+ logger6.info("Benchmarking consolidation operation", { name: op.name });
3990
3501
  const benchmark = await runOperationBenchmark(
3991
3502
  op.name,
3992
3503
  0,
@@ -4101,7 +3612,7 @@ function formatBenchmarkReport(report) {
4101
3612
  }
4102
3613
 
4103
3614
  // src/benchmarks/adapter-latency-benchmark.ts
4104
- var logger8 = createLogger({ component: "adapter-latency-benchmark" });
3615
+ var logger7 = createLogger({ component: "adapter-latency-benchmark" });
4105
3616
  var DEFAULT_ADAPTER_LATENCY_CONFIG = {
4106
3617
  warmupIterations: 3,
4107
3618
  measurementIterations: 10,
@@ -4151,7 +3662,7 @@ async function benchmarkScenario(adapter, scenario, config) {
4151
3662
  const errors = [];
4152
3663
  let successCount = 0;
4153
3664
  let failureCount = 0;
4154
- logger8.info("Benchmarking scenario", {
3665
+ logger7.info("Benchmarking scenario", {
4155
3666
  adapter: adapter.name,
4156
3667
  scenario: scenario.name,
4157
3668
  warmup: config.warmupIterations,
@@ -4518,45 +4029,45 @@ function matchesArtifactFilter(artifact, filter) {
4518
4029
  }
4519
4030
 
4520
4031
  // src/pipeline/trace-schema.ts
4521
- import { z as z15 } from "zod";
4522
- var ExecutionTraceEntrySchema = z15.object({
4032
+ import { z as z12 } from "zod";
4033
+ var ExecutionTraceEntrySchema = z12.object({
4523
4034
  /** Unix timestamp (ms). */
4524
- timestamp: z15.number(),
4035
+ timestamp: z12.number(),
4525
4036
  /** Run identifier (typically TaskContract.id). */
4526
- runId: z15.string().min(1),
4037
+ runId: z12.string().min(1),
4527
4038
  /** Pipeline event type that produced this trace entry. */
4528
- eventType: z15.string().min(1),
4039
+ eventType: z12.string().min(1),
4529
4040
  /** Execution ID for pipeline correlation. */
4530
- executionId: z15.string().optional(),
4041
+ executionId: z12.string().optional(),
4531
4042
  /** Graph node or stage that produced this event. */
4532
- nodeId: z15.string().optional(),
4043
+ nodeId: z12.string().optional(),
4533
4044
  /** Agent that executed this step. */
4534
- agentId: z15.string().optional(),
4045
+ agentId: z12.string().optional(),
4535
4046
  /** Model used for this step. */
4536
- modelId: z15.string().optional(),
4047
+ modelId: z12.string().optional(),
4537
4048
  /** Agent role (e.g., code_expert, security_expert). */
4538
- role: z15.string().optional(),
4049
+ role: z12.string().optional(),
4539
4050
  /** Duration in milliseconds. */
4540
- durationMs: z15.number().optional(),
4051
+ durationMs: z12.number().optional(),
4541
4052
  /** Human-readable model selection reasoning. */
4542
- reasoning: z15.string().optional(),
4053
+ reasoning: z12.string().optional(),
4543
4054
  /** Routing decision path (stage:result pairs). */
4544
- decisionPath: z15.array(z15.string()).optional(),
4055
+ decisionPath: z12.array(z12.string()).optional(),
4545
4056
  /** Error classification. */
4546
- errorTaxonomy: z15.enum(["retriable", "fatal"]).optional(),
4057
+ errorTaxonomy: z12.enum(["retriable", "fatal"]).optional(),
4547
4058
  /** Error message if this is a failure event. */
4548
- error: z15.string().optional(),
4059
+ error: z12.string().optional(),
4549
4060
  /** Wave number (1-based) for wave dispatch events. */
4550
- waveNumber: z15.number().optional(),
4061
+ waveNumber: z12.number().optional(),
4551
4062
  /** Total waves in the dispatch plan. */
4552
- totalWaves: z15.number().optional(),
4063
+ totalWaves: z12.number().optional(),
4553
4064
  /** Number of workers in this wave. */
4554
- workerCount: z15.number().optional()
4065
+ workerCount: z12.number().optional()
4555
4066
  });
4556
4067
 
4557
4068
  // src/security/quality-gate-types.ts
4558
- import { z as z16 } from "zod";
4559
- var PipelineStageSchema = z16.enum([
4069
+ import { z as z13 } from "zod";
4070
+ var PipelineStageSchema = z13.enum([
4560
4071
  "research",
4561
4072
  "plan",
4562
4073
  "vote",
@@ -4565,20 +4076,20 @@ var PipelineStageSchema = z16.enum([
4565
4076
  "qa",
4566
4077
  "ship"
4567
4078
  ]);
4568
- var GateVerdictSchema = z16.enum(["pass", "fail", "skip"]);
4569
- var GateCheckResultSchema = z16.object({
4079
+ var GateVerdictSchema = z13.enum(["pass", "fail", "skip"]);
4080
+ var GateCheckResultSchema = z13.object({
4570
4081
  /** Name of the check (e.g., 'tests_pass', 'lint_clean'). */
4571
- name: z16.string().min(1),
4082
+ name: z13.string().min(1),
4572
4083
  /** Pass/fail/skip verdict. */
4573
4084
  verdict: GateVerdictSchema,
4574
4085
  /** Human-readable details. */
4575
- details: z16.string().max(500),
4086
+ details: z13.string().max(500),
4576
4087
  /** Duration of the check in ms. */
4577
- durationMs: z16.number().nonnegative().optional()
4088
+ durationMs: z13.number().nonnegative().optional()
4578
4089
  });
4579
4090
 
4580
4091
  // src/pipeline/quality-pipeline.ts
4581
- var logger9 = createLogger({ component: "quality-pipeline" });
4092
+ var logger8 = createLogger({ component: "quality-pipeline" });
4582
4093
 
4583
4094
  // src/pipeline/iterative-consensus.ts
4584
4095
  var defaultLogger = createLogger({ component: "iterative-consensus" });
@@ -4679,7 +4190,7 @@ function buildVotingInput(plan, config) {
4679
4190
  }
4680
4191
  async function executeSingleVote(plan, config, log) {
4681
4192
  try {
4682
- const { executeVoting } = await import("./consensus-vote-L4CN33XE.js");
4193
+ const { executeVoting } = await import("./consensus-vote-6NUSZPQY.js");
4683
4194
  const input = buildVotingInput(plan, config);
4684
4195
  const result = await executeVoting(input, log);
4685
4196
  return parseVotingResult(result);
@@ -4712,7 +4223,7 @@ function parseVotingResult(result) {
4712
4223
  }
4713
4224
 
4714
4225
  // src/replay/replay-executor.ts
4715
- var logger10 = createLogger({ component: "ReplayExecutor" });
4226
+ var logger9 = createLogger({ component: "ReplayExecutor" });
4716
4227
  export {
4717
4228
  ALLOWED_COMMANDS,
4718
4229
  ARTIFACT_TYPES,