@kodax-ai/kodax 0.7.78 → 0.7.80

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 (126) hide show
  1. package/CHANGELOG.md +3556 -3197
  2. package/README.md +371 -277
  3. package/README_CN.md +295 -215
  4. package/config-templates/config.example.jsonc +24 -2
  5. package/config-templates/integrations/a2a.example.jsonc +23 -7
  6. package/dist/builtin/skill-creator/scripts/aggregate-benchmark.js +2 -1
  7. package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +1 -0
  8. package/dist/builtin/skill-creator/scripts/analyze-benchmark.js +4 -3
  9. package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +1 -0
  10. package/dist/builtin/skill-creator/scripts/compare-runs.js +4 -3
  11. package/dist/builtin/skill-creator/scripts/generate-review.js +2 -1
  12. package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +1 -0
  13. package/dist/builtin/skill-creator/scripts/grade-evals.js +4 -3
  14. package/dist/builtin/skill-creator/scripts/improve-description.js +2 -1
  15. package/dist/builtin/skill-creator/scripts/init-skill.d.ts +1 -0
  16. package/dist/builtin/skill-creator/scripts/init-skill.js +4 -3
  17. package/dist/builtin/skill-creator/scripts/install-skill.d.ts +1 -0
  18. package/dist/builtin/skill-creator/scripts/install-skill.js +4 -3
  19. package/dist/builtin/skill-creator/scripts/package-skill.d.ts +1 -0
  20. package/dist/builtin/skill-creator/scripts/package-skill.js +4 -3
  21. package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +1 -0
  22. package/dist/builtin/skill-creator/scripts/quick-validate.js +4 -3
  23. package/dist/builtin/skill-creator/scripts/run-eval.d.ts +1 -0
  24. package/dist/builtin/skill-creator/scripts/run-eval.js +4 -3
  25. package/dist/builtin/skill-creator/scripts/run-loop.js +2 -1
  26. package/dist/builtin/skill-creator/scripts/run-trigger-eval.js +2 -1
  27. package/dist/builtin/skill-creator/scripts/utils.d.ts +3 -0
  28. package/dist/builtin/skill-creator/scripts/utils.js +5 -1
  29. package/dist/chunks/agent-5PHGNFW3.js +2 -0
  30. package/dist/chunks/argument-completer-FXRZFMTC.js +2 -0
  31. package/dist/chunks/chunk-6UENDY33.js +89 -0
  32. package/dist/chunks/{chunk-6FOJVETH.js → chunk-BWX4YZX3.js} +7 -7
  33. package/dist/chunks/chunk-CDCCTM5I.js +278 -0
  34. package/dist/chunks/chunk-CEB5FDND.js +810 -0
  35. package/dist/chunks/{chunk-2CFHBKRE.js → chunk-E7C4DRD2.js} +2 -2
  36. package/dist/chunks/chunk-EVXIJPZ6.js +218 -0
  37. package/dist/chunks/chunk-FQ7NVMSU.js +319 -0
  38. package/dist/chunks/chunk-GC4JBMBS.js +385 -0
  39. package/dist/chunks/{chunk-Z3KFRTSB.js → chunk-HTVLCHWH.js} +1 -1
  40. package/dist/chunks/chunk-IHPH3444.js +655 -0
  41. package/dist/chunks/{chunk-YAZQTC2L.js → chunk-KHEFUT6O.js} +1 -1
  42. package/dist/chunks/{chunk-7OEBJGHK.js → chunk-PMKAG4SZ.js} +1 -1
  43. package/dist/chunks/chunk-RPF5RGWZ.js +479 -0
  44. package/dist/chunks/{chunk-UID7BLAB.js → chunk-RXXKDR6Y.js} +1 -1
  45. package/dist/chunks/chunk-T5U4OP2N.js +292 -0
  46. package/dist/chunks/chunk-TRNAWSXP.js +123 -0
  47. package/dist/chunks/chunk-UZSHBQER.js +30 -0
  48. package/dist/chunks/{chunk-TQDBTTIM.js → chunk-VECRQTSD.js} +44 -44
  49. package/dist/chunks/compaction-config-6J6XCBJS.js +2 -0
  50. package/dist/chunks/{construction-bootstrap-VQLQGWPY.js → construction-bootstrap-KPCAE3VN.js} +1 -1
  51. package/dist/chunks/dist-RWEVZOFK.js +2 -0
  52. package/dist/chunks/{dist-BFT5YIGU.js → dist-WWL2DNIJ.js} +1 -1
  53. package/dist/chunks/host-OGS2R5J4.js +2 -0
  54. package/dist/chunks/run-manager-2YMM3BOT.js +2 -0
  55. package/dist/chunks/{utils-SID4HW2Q.js → utils-2YHRUZYC.js} +1 -1
  56. package/dist/index.d.ts +21 -20
  57. package/dist/index.js +4 -4
  58. package/dist/kodax_bootstrap.js +2 -1
  59. package/dist/kodax_cli.js +1850 -1476
  60. package/dist/kodax_resume.js +570 -34
  61. package/dist/provider-capabilities.json +85 -50
  62. package/dist/runtime-worker.js +1737 -1369
  63. package/dist/sandbox-workspace-session.js +285 -19
  64. package/dist/sdk-a2a.d.ts +19 -13
  65. package/dist/sdk-a2a.js +8 -8
  66. package/dist/sdk-agent.d.ts +80 -150
  67. package/dist/sdk-agent.js +1 -1
  68. package/dist/sdk-coding.d.ts +186 -66
  69. package/dist/sdk-coding.js +1 -1
  70. package/dist/sdk-experimental-memory.d.ts +3 -3
  71. package/dist/sdk-experimental-memory.js +1 -1
  72. package/dist/sdk-llm.d.ts +7 -7
  73. package/dist/sdk-llm.js +1 -1
  74. package/dist/sdk-mcp.d.ts +1 -1
  75. package/dist/sdk-mcp.js +1 -1
  76. package/dist/sdk-media.d.ts +1 -1
  77. package/dist/sdk-media.js +1 -1
  78. package/dist/sdk-repl.d.ts +31 -213
  79. package/dist/sdk-repl.js +2 -2
  80. package/dist/sdk-runtime.d.ts +230 -31
  81. package/dist/sdk-runtime.js +1 -1
  82. package/dist/sdk-sandbox.js +1 -1
  83. package/dist/sdk-session.d.ts +8 -8
  84. package/dist/sdk-session.js +1 -1
  85. package/dist/sdk-skills.js +1 -1
  86. package/dist/semantic-worker.js +283 -18
  87. package/dist/types-chunks/{base.d-4e74xDdy.d.ts → base.d-DxG0m09Z.d.ts} +1 -1
  88. package/dist/types-chunks/{bash-prefix-extractor.d-uAe2Oqda.d.ts → bash-prefix-extractor.d-DStqKIlu.d.ts} +31 -8
  89. package/dist/types-chunks/{capability-learning.d-CVsdHw4j.d.ts → capability-learning.d-iPSiAmc_.d.ts} +1 -1
  90. package/dist/types-chunks/{capsule.d-BlSv9l3V.d.ts → capsule.d-BuFJaYxA.d.ts} +14 -21
  91. package/dist/types-chunks/{types.d-BA-Jwpfs.d.ts → controller.d-C2aHqzHj.d.ts} +344 -11
  92. package/dist/types-chunks/{guardrail.d-CXDYRgZ3.d.ts → guardrail.d-DM-OK0m3.d.ts} +187 -116
  93. package/dist/types-chunks/{history-retrieval.d-DtCy7x64.d.ts → history-retrieval.d-DImTKgO6.d.ts} +16 -3
  94. package/dist/types-chunks/{oauth-login.d-Bgb4rdLN.d.ts → oauth-login.d-6i-vidxv.d.ts} +6 -2
  95. package/dist/types-chunks/{public-api.d-B3AohsxN.d.ts → public-api.d-CewTvUKV.d.ts} +335 -38
  96. package/dist/types-chunks/{repl.d-Ie_ZXb_U.d.ts → repl.d-DvXQtgr7.d.ts} +5 -5
  97. package/dist/types-chunks/{resolver.d-iAQ9ocLB.d.ts → resolver.d-C9IW4fmU.d.ts} +5 -2
  98. package/dist/types-chunks/{run-manager.d-D1twIhF9.d.ts → run-manager.d-C6ahvZqK.d.ts} +1 -1
  99. package/dist/types-chunks/{sdk-session-DB9KksIx.d.ts → sdk-session-C59RUrri.d.ts} +3 -3
  100. package/dist/types-chunks/shell-command-sets.d-Dp4UvPLL.d.ts +297 -0
  101. package/dist/types-chunks/{side-query.d-DTuLPcC5.d.ts → side-query.d-CP1LiRiH.d.ts} +8 -2
  102. package/dist/types-chunks/{types-D3g6XUQr.d.ts → types-Bf3Y3mW-.d.ts} +1 -1
  103. package/dist/types-chunks/{types.d-BH0ZkTGf.d.ts → types.d-BzpPDBPV.d.ts} +2 -2
  104. package/dist/types-chunks/{types.d-DIpZJKUl.d.ts → types.d-CgrXrFrq.d.ts} +16 -2
  105. package/dist/types-chunks/{types.d-DVDTIfB_.d.ts → types.d-yuJzE82x.d.ts} +4 -4
  106. package/dist/types-chunks/{utils.d-CVp6bFl9.d.ts → utils.d-BpACJmzt.d.ts} +24 -6
  107. package/docs/SDK_EMBEDDER_GUIDE.md +1148 -598
  108. package/package.json +6 -3
  109. package/dist/chunks/agent-ASP4MS3X.js +0 -2
  110. package/dist/chunks/argument-completer-JYQ7FX3W.js +0 -2
  111. package/dist/chunks/chunk-35PPHOQ2.js +0 -292
  112. package/dist/chunks/chunk-43QNNDHR.js +0 -29
  113. package/dist/chunks/chunk-5GO6FH7L.js +0 -458
  114. package/dist/chunks/chunk-5NDCSFOP.js +0 -78
  115. package/dist/chunks/chunk-6XM4B6K2.js +0 -48
  116. package/dist/chunks/chunk-6YZUE6NC.js +0 -240
  117. package/dist/chunks/chunk-KQLQYHWU.js +0 -386
  118. package/dist/chunks/chunk-NXO6GWSY.js +0 -46
  119. package/dist/chunks/chunk-T2XZTLYE.js +0 -316
  120. package/dist/chunks/chunk-VAT2QYXM.js +0 -765
  121. package/dist/chunks/chunk-YVRYHC4C.js +0 -655
  122. package/dist/chunks/compaction-config-BQSSIWK5.js +0 -2
  123. package/dist/chunks/dist-PCFE24YP.js +0 -2
  124. package/dist/chunks/host-UTFXCYYM.js +0 -2
  125. package/dist/chunks/run-manager-PJU3WIFJ.js +0 -2
  126. package/dist/types-chunks/guardrail.d-BRE_ErEj.d.ts +0 -156
@@ -1,10 +1,10 @@
1
1
  import { b as McpServersConfig, M as McpConnectMode, a as McpServerConfig, c as McpTransportKind } from './config.d-CJy1WENT.js';
2
- import { K as KodaXBaseProvider } from './base.d-4e74xDdy.js';
2
+ import { K as KodaXBaseProvider } from './base.d-DxG0m09Z.js';
3
3
  import { a as CostTracker } from './cost-tracker.d-BeaenODW.js';
4
- import { dT as RunnerToolCall } from './types.d-BA-Jwpfs.js';
5
- import { d as ToolGuardrail } from './guardrail.d-BRE_ErEj.js';
6
- import { k as KodaXMessage } from './types.d-DIpZJKUl.js';
7
- import { S as SideQueryDiagnostics } from './side-query.d-DTuLPcC5.js';
4
+ import { e2 as RunnerToolCall, ez as ToolGuardrail } from './controller.d-C2aHqzHj.js';
5
+ import { k as KodaXMessage } from './types.d-CgrXrFrq.js';
6
+ import { S as SideQueryDiagnostics } from './side-query.d-CP1LiRiH.js';
7
+ import { by as ToolSideEffect } from './bash-prefix-extractor.d-DStqKIlu.js';
8
8
 
9
9
  /**
10
10
  * FEATURE_200 Phase F (v0.7.45) — MCP domain types extracted from types.ts.
@@ -54,6 +54,50 @@ declare function loadAgentsFiles(options?: LoadAgentsOptions): AgentsFile[];
54
54
  */
55
55
  declare function formatAgentsForPrompt(files: AgentsFile[]): string;
56
56
 
57
+ /**
58
+ * Parse the auto-mode classifier's output — FEATURE_092 Phase 2b.3 (v0.7.33).
59
+ *
60
+ * Preferred format:
61
+ * <decision>allow|ask</decision><hazard>...</hazard><reason>...</reason>
62
+ * Legacy `<block>` output remains parseable during the protocol rollout so a
63
+ * valid decision from an older prompt/provider cache is not misreported as an
64
+ * infrastructure failure.
65
+ *
66
+ * Robustness:
67
+ * - case-insensitive yes/no
68
+ * - whitespace inside / around tags tolerated
69
+ * - one valid decision is authoritative; hazard/reason defects are retained
70
+ * as warnings and never become a second decision mechanism
71
+ * - reasons longer than 500 chars are truncated (defense against
72
+ * pathological model outputs)
73
+ * - missing, invalid, duplicate, or mixed decisions remain contract errors;
74
+ * surrounding prose and malformed auxiliary fields are diagnostic only
75
+ */
76
+ type ClassifierDecision = {
77
+ readonly kind: 'block';
78
+ readonly reason: string;
79
+ readonly hazard?: ClassifierHazard;
80
+ readonly protocol: ClassifierProtocol;
81
+ readonly warnings?: readonly ClassifierOutputWarningCode[];
82
+ } | {
83
+ readonly kind: 'allow';
84
+ readonly reason: string;
85
+ readonly hazard?: 'none';
86
+ readonly protocol: ClassifierProtocol;
87
+ readonly warnings?: readonly ClassifierOutputWarningCode[];
88
+ } | {
89
+ readonly kind: 'unparseable';
90
+ readonly raw: string;
91
+ readonly failureCode: ClassifierParseFailureCode;
92
+ readonly observedProtocol: ClassifierObservedProtocol;
93
+ };
94
+ type ClassifierProtocol = 'structured_v2' | 'legacy_v1';
95
+ type ClassifierObservedProtocol = ClassifierProtocol | 'unknown';
96
+ type ClassifierParseFailureCode = 'missing_decision' | 'invalid_decision' | 'ambiguous_decision' | 'missing_hazard' | 'invalid_hazard' | 'decision_hazard_conflict' | 'decision_reason_conflict' | 'missing_reason' | 'structured_format_violation' | 'legacy_format_violation';
97
+ type ClassifierOutputWarningCode = Exclude<ClassifierParseFailureCode, 'missing_decision' | 'invalid_decision' | 'ambiguous_decision'>;
98
+ type ClassifierHazard = 'none' | 'protected_read' | 'outside_write' | 'destructive_loss' | 'credential_exposure' | 'network_exfiltration' | 'remote_code_execution' | 'dependency_poisoning' | 'production_change' | 'privilege_change' | 'intent_conflict';
99
+ declare function parseClassifierOutput(raw: string): ClassifierDecision;
100
+
57
101
  /**
58
102
  * Auto-Mode Rules Loader — FEATURE_092 Phase 2b.2 (v0.7.33).
59
103
  *
@@ -72,11 +116,15 @@ declare function formatAgentsForPrompt(files: AgentsFile[]): string;
72
116
  *
73
117
  * Schema (each field optional, defaults to []):
74
118
  * {
75
- * "allow": string[], // patterns the classifier defaults to allowing
76
- * "soft_deny": string[], // patterns the classifier defaults to blocking
119
+ * "allow": string[], // contextual examples supporting an allow
120
+ * "soft_deny": string[], // contextual cautions for the classifier to inspect
77
121
  * "environment": string[] // background context the classifier sees verbatim
78
122
  * }
79
123
  *
124
+ * These strings are classifier context, never independent verdicts. In
125
+ * Auto[LLM], even `soft_deny` cannot create an approval class beyond the two
126
+ * evidence-based ask classes defined by the classifier contract.
127
+ *
80
128
  * Merge: layers concatenated in order (user → project → local). Identical
81
129
  * strings deduplicated by stable insertion (later layers win position only
82
130
  * when the string is unique per layer).
@@ -136,7 +184,7 @@ declare function loadAutoRules(opts: LoadAutoRulesOptions): Promise<RulesLoadRes
136
184
  *
137
185
  * Mechanical pattern matches over a tool call. Signals are NOT verdicts;
138
186
  * the classifier consumes them as informational input alongside transcript
139
- * + user rules and produces the final decision (allow / block / escalate).
187
+ * + user rules and produces the final Auto[LLM] decision (allow / ask).
140
188
  *
141
189
  * Two invariants the producers must hold:
142
190
  *
@@ -150,10 +198,9 @@ declare function loadAutoRules(opts: LoadAutoRulesOptions): Promise<RulesLoadRes
150
198
  * so the classifier can weight signals, but the verdict is not encoded
151
199
  * here.
152
200
  *
153
- * Tier 0 (absolute deny) is a separate module signals are pre-verdict
154
- * material consumed by Tier 2 (LLM classifier). The two paths are not
155
- * coupled: Tier 0 catches a fixed catastrophic-pattern set; signals
156
- * describe a wider surface for the classifier to reason about.
201
+ * The historical Tier 0 detector is a separate module, but its matches are
202
+ * also pre-verdict facts in Auto[LLM]. Only explicit Auto[Rules] treats that
203
+ * detector as a legacy approval gate.
157
204
  *
158
205
  * Design ref: ADR-025, FEATURE_158 (docs/features/v0.7.39.md).
159
206
  */
@@ -248,6 +295,12 @@ interface PermissionIntentEvidence {
248
295
  /** Latest genuine user request, kept separate as the authoritative intent. */
249
296
  readonly currentUserContent?: string;
250
297
  readonly currentUserContentTruncated?: boolean;
298
+ /** Runtime-delegated task context; informative, never a replacement for root authority. */
299
+ readonly delegatedObjective?: string;
300
+ readonly delegatedObjectiveTruncated?: boolean;
301
+ readonly bindingConstraints?: readonly string[];
302
+ readonly scopeHint?: string;
303
+ readonly readOnly?: boolean;
251
304
  readonly content: string;
252
305
  readonly sourceBytes: number;
253
306
  readonly includedBytes: number;
@@ -371,6 +424,9 @@ interface ClassifierAttemptDiagnostics {
371
424
  readonly attempt: number;
372
425
  readonly outcome: ClassifierAttemptOutcome;
373
426
  readonly diagnostics?: SideQueryDiagnostics;
427
+ readonly observedProtocol?: ClassifierObservedProtocol;
428
+ readonly parseFailureCode?: ClassifierParseFailureCode | 'tool_use';
429
+ readonly outputWarnings?: readonly ClassifierOutputWarningCode[];
374
430
  }
375
431
  interface ClassifyDecisionDetails {
376
432
  readonly reason: string;
@@ -389,72 +445,25 @@ type ClassifyDecision = ({
389
445
  /**
390
446
  * The deadline includes connection setup, provider-side queueing, inference,
391
447
  * and any Retry-After/backoff handled by the provider adapter. Keep it bounded
392
- * so infrastructure failure degrades to an explicit user decision.
448
+ * so infrastructure failure reaches the configured Accept-edits fallback.
393
449
  */
394
- declare const DEFAULT_CLASSIFIER_TIMEOUT_MS = 20000;
450
+ declare const DEFAULT_CLASSIFIER_TIMEOUT_MS = 45000;
451
+ /** A retry gets a longer deadline because its expanded response budget can take longer to emit. */
452
+ declare const DEFAULT_CLASSIFIER_RETRY_TIMEOUT_MS = 90000;
453
+ /** The classifier returns three short XML tags; a coding-turn-sized budget is wasteful. */
454
+ declare const CLASSIFIER_MAX_OUTPUT_TOKENS = 256;
395
455
  declare function classify(opts: ClassifyOptions): Promise<ClassifyDecision>;
396
456
 
397
457
  /**
398
- * Denial TrackerFEATURE_092 Phase 2b.4 (v0.7.33).
399
- *
400
- * Tracks classifier blocks per session. When either threshold is crossed,
401
- * the auto-mode engine downgrades from `llm` to `rules` (mode stays `auto`).
402
- *
403
- * - 3 consecutive blocks → likely an unproductive loop (agent not adapting)
404
- * - 20 cumulative blocks → broader classifier-noise pattern in this session
405
- *
406
- * Both are session-scoped, shared with subagents (per design doc, to defend
407
- * against threshold-bypass via spawning).
408
- *
409
- * Pure functional API: each operation returns a new tracker. No mutation.
410
- */
411
- declare const CONSECUTIVE_THRESHOLD = 3;
412
- declare const CUMULATIVE_THRESHOLD = 20;
413
- interface DenialTracker {
414
- readonly consecutive: number;
415
- readonly cumulative: number;
416
- }
417
- declare function createDenialTracker(): DenialTracker;
418
- declare function recordBlock(t: DenialTracker): DenialTracker;
419
- declare function recordAllow(t: DenialTracker): DenialTracker;
420
- declare function shouldFallback$1(t: DenialTracker): boolean;
421
-
422
- /**
423
- * Circuit Breaker — FEATURE_092 Phase 2b.4 (v0.7.33).
424
- *
425
- * Sliding-window error counter for classifier failures (timeouts, 5xx, 429,
426
- * unparseable outputs). When ≥ 5 errors land within a 10-minute window, the
427
- * auto-mode engine downgrades from `llm` to `rules` (mode stays `auto`) so
428
- * the user is not blocked by a degraded classifier path.
458
+ * Historical Tier 0 high-impact pattern detector FEATURE_158 Step 4.
429
459
  *
430
- * Pure functional API: each operation returns a new breaker. No mutation.
431
- * Memory bound: stale timestamps are pruned on each recordError call so
432
- * the timestamps array never grows unbounded.
433
- */
434
- declare const ERROR_THRESHOLD = 5;
435
- declare const WINDOW_MS: number;
436
- interface CircuitBreaker {
437
- readonly timestamps: readonly number[];
438
- }
439
- declare function createCircuitBreaker(): CircuitBreaker;
440
- declare function recordError(b: CircuitBreaker, now: number): CircuitBreaker;
441
- declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
442
-
443
- /**
444
- * Tier 0 — Absolute Denylist — FEATURE_158 Step 4 (v0.7.39).
460
+ * The exported names remain source-compatible with FEATURE_158. Auto[LLM]
461
+ * now treats matches as deterministic facts for the classifier, whose
462
+ * decision is final. Explicit Auto[Rules] mode retains the legacy approval
463
+ * gate. The narrow list still identifies high-impact operations worth
464
+ * describing precisely:
445
465
  *
446
- * The narrowest possible set of catastrophic patterns that must NEVER reach
447
- * the LLM classifier (which is fallible / can be prompt-injected). Per
448
- * ADR-025: every entry here must satisfy BOTH gates:
449
- *
450
- * (a) "is there any legitimate context in which this should be allowed?"
451
- * — answer must be **no**.
452
- * (b) "could the LLM be convinced to allow it under prompt injection?"
453
- * — answer must be **yes** (otherwise classifier is sufficient).
454
- *
455
- * The 5-item list is **frozen** by ADR-025; adding entries requires a new
456
- * ADR addendum answering (a)+(b) again. Removing entries requires evidence
457
- * of high-volume false-positive friction.
466
+ * The detector must not expand into a second Auto[LLM] approval policy.
458
467
  *
459
468
  * Patterns:
460
469
  *
@@ -462,7 +471,7 @@ declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
462
471
  * / -fr variants). Excludes `rm -rf /tmp/foo` (which
463
472
  * is a `dangerous_pattern` signal but reaches LLM).
464
473
  * 2. mkfs_or_format — `mkfs.* /dev/sd*`, `fdisk /dev/sd*`, `format C:`.
465
- * Block formatting any disk device.
474
+ * Identifies formatting of a disk device.
466
475
  * 3. dd_disk_write — `dd of=/dev/sd*` (raw-disk write). Excludes
467
476
  * `dd of=test.bin` (file write — reaches LLM as
468
477
  * dangerous_pattern signal).
@@ -470,13 +479,12 @@ declare function shouldFallback(b: CircuitBreaker, now: number): boolean;
470
479
  * 5. user_kodax_write — write/edit to any path under `~/.kodax/`
471
480
  * (credentials zone — internal kodax config writes
472
481
  * use the TypeScript API, not bash/tools, so the
473
- * only path here is LLM-emitted shell which is
474
- * always wrong).
482
+ * only path here is normally an LLM-emitted shell).
475
483
  *
476
484
  * Layer note: bash-level `~/.kodax/` writes (e.g. `echo x > ~/.kodax/y`)
477
- * require AST path-extraction which lives in `@kodax/repl`. The REPL-side
478
- * collector wired through `extraCollectors` (Step 7) escalates those to
479
- * Tier 0 by emitting a synthetic `user_kodax_write` denial via the same
485
+ * require AST path-extraction. The REPL-side collector wired through
486
+ * `extraCollectors` (Step 7) identifies those as
487
+ * Tier 0 by emitting a synthetic `user_kodax_write` match via the same
480
488
  * `AbsoluteDenyResult` shape. This module handles the file-tool path
481
489
  * directly (the most common attack vector) and the four command-string
482
490
  * patterns that don't need path extraction.
@@ -494,13 +502,15 @@ interface AbsoluteDenyMiss {
494
502
  type AbsoluteDenyResult = AbsoluteDenyMatch | AbsoluteDenyMiss;
495
503
  type AbsoluteDenyCheck = (call: RunnerToolCall, projectRoot: string, executionCwd: string) => AbsoluteDenyResult;
496
504
  /**
497
- * Check a tool call against the Tier 0 absolute denylist. Returns the
498
- * first matching pattern, or `{ denied: false }` if no pattern fires.
505
+ * Check a tool call against the historical Tier 0 pattern list. Returns the
506
+ * first matching pattern, or `{ denied: false }` if no pattern fires. A match
507
+ * is classifier evidence in Auto[LLM] and a legacy approval gate only in
508
+ * explicit Auto[Rules].
499
509
  *
500
510
  * Order is deterministic — patterns checked in the order defined above.
501
511
  * Multiple matches would be possible (e.g. `rm -rf / ; :(){...};:`) but
502
- * we return the first hit since the guardrail acts on `denied: true`
503
- * regardless and the reason string is one-shot.
512
+ * we return the first hit because one precise fact is sufficient for the
513
+ * classifier and the reason string is one-shot.
504
514
  *
505
515
  * **Pure**: deterministic given (call, projectRoot, stable env).
506
516
  * **Fast**: ~5 regex tests + 1-2 string ops; safe to run on every
@@ -508,6 +518,54 @@ type AbsoluteDenyCheck = (call: RunnerToolCall, projectRoot: string, executionCw
508
518
  */
509
519
  declare function checkAbsoluteDeny(call: RunnerToolCall, projectRoot: string, executionCwd?: string): AbsoluteDenyResult;
510
520
 
521
+ /**
522
+ * Circuit Breaker — FEATURE_092 Phase 2b.4 (v0.7.33).
523
+ *
524
+ * Sliding-window error counter for classifier failures (timeouts, 5xx, 429,
525
+ * unparseable outputs). When ≥ 5 errors land within a 10-minute window, the
526
+ * callers temporarily skip classifier calls and apply the Accept-edits
527
+ * failure boundary. The selected Auto engine remains `llm`; health state is
528
+ * diagnostic, not a mode change.
529
+ *
530
+ * Pure functional API: each operation returns a new breaker. No mutation.
531
+ * Memory bound: stale timestamps are pruned on each recordError call so
532
+ * the timestamps array never grows unbounded.
533
+ */
534
+ declare const ERROR_THRESHOLD = 5;
535
+ declare const WINDOW_MS: number;
536
+ interface CircuitBreaker {
537
+ readonly timestamps: readonly number[];
538
+ }
539
+ declare function createCircuitBreaker(): CircuitBreaker;
540
+ declare function recordError(b: CircuitBreaker, now: number): CircuitBreaker;
541
+ declare function shouldFallback$1(b: CircuitBreaker, now: number): boolean;
542
+
543
+ /**
544
+ * Denial Tracker — FEATURE_092 Phase 2b.4 (v0.7.33).
545
+ *
546
+ * Tracks classifier blocks per session. When either threshold is crossed,
547
+ * threshold state is exposed for diagnostics and does not mutate the selected
548
+ * Auto engine.
549
+ *
550
+ * - 3 consecutive blocks → likely an unproductive loop (agent not adapting)
551
+ * - 20 cumulative blocks → broader classifier-noise pattern in this session
552
+ *
553
+ * Both are session-scoped, shared with subagents (per design doc, to defend
554
+ * against threshold-bypass via spawning).
555
+ *
556
+ * Pure functional API: each operation returns a new tracker. No mutation.
557
+ */
558
+ declare const CONSECUTIVE_THRESHOLD = 3;
559
+ declare const CUMULATIVE_THRESHOLD = 20;
560
+ interface DenialTracker {
561
+ readonly consecutive: number;
562
+ readonly cumulative: number;
563
+ }
564
+ declare function createDenialTracker(): DenialTracker;
565
+ declare function recordBlock(t: DenialTracker): DenialTracker;
566
+ declare function recordAllow(t: DenialTracker): DenialTracker;
567
+ declare function shouldFallback(t: DenialTracker): boolean;
568
+
511
569
  /**
512
570
  * AutoModeToolGuardrail — FEATURE_092 Phase 2b.6 (v0.7.33).
513
571
  *
@@ -518,12 +576,14 @@ declare function checkAbsoluteDeny(call: RunnerToolCall, projectRoot: string, ex
518
576
  *
519
577
  * Decision flow (per design doc "三层权限金字塔"):
520
578
  *
521
- * 1. Tier-0 deterministic critical match user confirmation
522
- * 2. exact safe read/workspace-temp effect → allow (zero token cost)
523
- * 3. Tool projection is '' (Tier 1) → allow
524
- * 4. Engine is rules → deterministic Tier 2, otherwise user confirms
525
- * 5. degraded classifier infrastructure Accept-edits fallback
526
- * 6. classify(...) sideQuery
579
+ * 1. exact safe read/workspace-temp effectallow (zero token cost)
580
+ * 2. Explicitly exempt empty projection → allow
581
+ * 3. Static/high-impact pattern match → classifier facts in LLM;
582
+ * legacy gate in explicit Rules
583
+ * 4. Recoverable projection/analyzer fault safe facts to classifier
584
+ * 5. Engine is rules → deterministic Tier 2, otherwise user confirms
585
+ * 6. degraded classifier infrastructure → Accept-edits fallback
586
+ * 7. classify(...) sideQuery (sole Auto[LLM] decision owner)
527
587
  * allow → allow (record allow → reset consecutive)
528
588
  * confirm → user confirmation (record concern)
529
589
  * failure → Accept-edits fallback (record error)
@@ -541,9 +601,8 @@ declare function checkAbsoluteDeny(call: RunnerToolCall, projectRoot: string, ex
541
601
  * independent.
542
602
  *
543
603
  * Provider capability checks and the explicit `supportsAutoModeClassifier`
544
- * flag are deferred to follow-up phases. Tier 2 is supplied by the Runtime
545
- * host because canonical filesystem and shell parsing live in @kodax/repl;
546
- * the guardrail remains the single decision point.
604
+ * flag are deferred to follow-up phases. Coding owns the default analyzer and
605
+ * Tier 2 evaluator so direct SDK and REPL consumers share one decision path.
547
606
  */
548
607
 
549
608
  type AutoModeEngine = 'llm' | 'rules';
@@ -555,9 +614,10 @@ interface AutoModeSharedState {
555
614
  /**
556
615
  * User answer for an escalated tool-call. The guardrail translates this into
557
616
  * the actual `GuardrailVerdict` returned to the Runner. `'block'` preserves
558
- * the original escalation reason as the verdict reason so downstream consumers
559
- * see why the tool was blocked. `'timeout'` reports that the action was not
560
- * executed and gives the main model a bounded recovery instruction.
617
+ * a clear call-local user-declined result while retaining the review reason.
618
+ * It does not create a persistent denial: a safer follow-up is reviewed as a
619
+ * new call. `'timeout'` reports that the action was not executed and gives the
620
+ * main model a bounded recovery instruction.
561
621
  */
562
622
  type AutoModeAskUserVerdict = 'allow' | 'block' | 'timeout';
563
623
  interface AutoModeDecisionDiagnostics {
@@ -589,6 +649,15 @@ interface AutoModeRulesContext {
589
649
  readonly projectRoot: string;
590
650
  readonly executionCwd: string;
591
651
  readonly signals: readonly ToolCallSignal[];
652
+ /**
653
+ * Whether shell environment aliases such as `%TEMP%` and `$env:TEMP`
654
+ * are known to resolve from this Node process. Runtime shell profiles can
655
+ * rewrite them before execution, so embedders must set this to false when
656
+ * that equivalence cannot be proven.
657
+ */
658
+ readonly trustProcessEnvironmentPathExpansion?: boolean;
659
+ /** Trusted host metadata used when a tool has no path-specific analyzer. */
660
+ readonly toolSideEffect?: ToolSideEffect;
592
661
  }
593
662
  type AutoModePermissionBoundary = 'workspace' | 'system-temp' | 'outside-workspace' | 'protected' | 'unresolved';
594
663
  interface AutoModePermissionTarget {
@@ -621,7 +690,7 @@ interface AutoModePermissionReview {
621
690
  readonly operations: readonly AutoModePermissionOperation[];
622
691
  readonly risks: readonly string[];
623
692
  }
624
- type AutoModeCallAnalyzer = (call: RunnerToolCall, context: AutoModeRulesContext) => AutoModePermissionReview | Promise<AutoModePermissionReview>;
693
+ type AutoModeCallAnalyzer = (call: RunnerToolCall, context: AutoModeRulesContext) => AutoModePermissionReview | undefined | Promise<AutoModePermissionReview | undefined>;
625
694
  type AutoModeRulesDecision = {
626
695
  readonly action: 'allow';
627
696
  } | {
@@ -667,15 +736,12 @@ interface AutoModeGuardrailConfig {
667
736
  /** Mint one exact bash call for workspace-sandboxed execution. */
668
737
  readonly admitWorkspaceSandboxCall?: (call: RunnerToolCall, review: AutoModePermissionReview) => void;
669
738
  /**
670
- * Runtime-owned deterministic Tier-2 evaluator. It is injected rather than
671
- * implemented in @kodax/coding because canonical path and shell-AST helpers
672
- * live in @kodax/repl. Omitting it preserves fail-closed SDK compatibility:
673
- * every non-Tier-1 rules call escalates.
739
+ * Override for the coding-owned deterministic Tier-2 evaluator.
674
740
  */
675
741
  readonly evaluateRulesCall?: AutoModeRulesEvaluator;
676
742
  /**
677
- * Runtime-owned compact facts used by deterministic read admission and the
678
- * LLM permission reviewer. Direct read tools fail closed when this is absent.
743
+ * Override for the coding-owned compact permission analyzer. An override may
744
+ * return undefined to decline a call and leave it on the classifier path.
679
745
  */
680
746
  readonly analyzeCall?: AutoModeCallAnalyzer;
681
747
  /**
@@ -684,6 +750,8 @@ interface AutoModeGuardrailConfig {
684
750
  * receive a metadata-only fail-closed projection rather than a Tier-1 skip.
685
751
  */
686
752
  readonly getToolProjection: (toolName: string) => ((input: unknown) => string) | undefined;
753
+ /** Optional trusted side-effect metadata for analyzer-less tools. */
754
+ readonly getToolSideEffect?: (toolName: string) => ToolSideEffect | undefined;
687
755
  /**
688
756
  * Resolve a provider name to an instance. Returns `undefined` when
689
757
  * unconfigured / unknown — the guardrail then escalates.
@@ -739,8 +807,8 @@ interface AutoModeGuardrailConfig {
739
807
  readonly initialEngine?: AutoModeEngine;
740
808
  /**
741
809
  * FEATURE_092 phase 2b.7b slice C: classifier sideQuery timeout in ms.
742
- * Defaults to 20_000. Resolved by the REPL from `~/.kodax/config.json`
743
- * `autoMode.timeoutMs`.
810
+ * Defaults to 45_000 for the first attempt and 90_000 for the retry.
811
+ * A configured value applies to both attempts.
744
812
  */
745
813
  readonly timeoutMs?: number;
746
814
  /**
@@ -749,15 +817,18 @@ interface AutoModeGuardrailConfig {
749
817
  * doesn't use it (command-string-level) but threads it for uniform
750
818
  * collector contract.
751
819
  *
752
- * Required by FEATURE_158: if omitted, the default coding-side
753
- * collectors produce no `outside_project` signal (degrades gracefully),
754
- * but **REPL-injected `extraCollectors` will likely require it**.
755
- * SDK consumers without a project root should set `projectRoot: ''`
756
- * and supply no `extraCollectors`.
820
+ * When omitted or blank, the guardrail uses `executionCwd`. If neither is
821
+ * available, path-bearing calls remain unresolved instead of borrowing the
822
+ * embedder process's ambient cwd as an authorization boundary.
757
823
  */
758
824
  readonly projectRoot?: string;
759
825
  /** Directory used to resolve relative tool paths. Defaults to projectRoot. */
760
826
  readonly executionCwd?: string;
827
+ /**
828
+ * Set to false when the shell profile or execution contract can rewrite
829
+ * process-derived path aliases such as `%TEMP%` or `$env:TEMP`.
830
+ */
831
+ readonly trustProcessEnvironmentPathExpansion?: boolean;
761
832
  /**
762
833
  * Override the default signal-collector set. When unset, defaults to
763
834
  * `[bashSignalCollector, fileSignalCollector]` — coding-side
@@ -770,17 +841,17 @@ interface AutoModeGuardrailConfig {
770
841
  readonly signalCollectors?: readonly SignalCollector[];
771
842
  /**
772
843
  * Additional signal collectors to merge with `signalCollectors`.
773
- * Primary use: REPL injects a path-aware bash collector built on its
774
- * own `extractPathsFromCommand` / `isAlwaysConfirmPath` utilities
775
- * (those live in `@kodax/repl` for historical reasons; lifting them
776
- * is out-of-scope for FEATURE_158 — see design doc layer-boundary
777
- * decision).
844
+ * Primary use: REPL injects its path-aware bash signal collector. The
845
+ * underlying shell and path permission utilities are coding-owned.
778
846
  *
779
847
  * Order: defaults run first, then extras (preserves per-collector
780
848
  * signal order).
781
849
  */
782
850
  readonly extraCollectors?: readonly SignalCollector[];
783
- /** Layer-owned Tier-0 checks that run after the coding-side frozen list. */
851
+ /**
852
+ * Layer-owned high-impact pattern checks. In LLM mode they add classifier
853
+ * evidence; in explicitly selected Rules mode they retain the legacy gate.
854
+ */
784
855
  readonly extraAbsoluteDenyChecks?: readonly AbsoluteDenyCheck[];
785
856
  /**
786
857
  * Speculative-classify quiet window (ms). When a classifier promise
@@ -836,5 +907,5 @@ interface AutoModeToolGuardrail extends ToolGuardrail {
836
907
  }
837
908
  declare function createAutoModeToolGuardrail(config: AutoModeGuardrailConfig): AutoModeToolGuardrail;
838
909
 
839
- export { createAutoModeToolGuardrail as $, CONSECUTIVE_THRESHOLD as C, DEFAULT_CLASSIFIER_TIMEOUT_MS as F, ERROR_THRESHOLD as H, WINDOW_MS as W, checkAbsoluteDeny as X, classify as Y, collectAllSignals as Z, computeRulesFingerprint as _, createCircuitBreaker as a0, createDenialTracker as a1, formatAgentsForPrompt as a2, getKodaxGlobalDir as a3, loadAgentsFiles as a4, loadAutoRules as a5, parseAutoRules as a6, readTrustState as a7, recordAllow as a8, recordBlock as a9, recordError as aa, shouldFallback$1 as ab, shouldFallback as ac, trustProjectRules as ad, CUMULATIVE_THRESHOLD as v };
840
- export type { AbsoluteDenyCheck as A, ClassifierToolProjectionResolver as B, ClassifyDecision as D, ClassifyOptions as E, DenialTracker as G, KodaXMcpServerConfig as I, KodaXMcpServersConfig as J, KodaXMcpConnectMode as K, KodaXMcpTransport as L, LoadAgentsOptions as M, LoadedRulesSource as N, RulesLoadResult as O, PermissionIntentEvidence as P, SkippedRulesSource as Q, RulesLoadError as R, SignalCollector as S, TierZeroPatternId as T, ToolCallSignal as U, TrustState as V, AbsoluteDenyMatch as a, AbsoluteDenyMiss as b, AbsoluteDenyResult as c, AgentsFile as d, AutoModeAskUser as e, AutoModeAskUserVerdict as f, AutoModeCallAnalyzer as g, AutoModeDecisionDiagnostics as h, AutoModeEngine as i, AutoModeGuardrailConfig as j, AutoModePermissionBoundary as k, AutoModePermissionOperation as l, AutoModePermissionReview as m, AutoModePermissionTarget as n, AutoModeRulesContext as o, AutoModeRulesDecision as p, AutoModeRulesEvaluator as q, AutoModeSharedState as r, AutoModeStats as s, AutoModeToolGuardrail as t, AutoRules as u, CircuitBreaker as w, ClassifierAttemptDiagnostics as x, ClassifierAttemptOutcome as y, ClassifierFailureKind as z };
910
+ export { CLASSIFIER_MAX_OUTPUT_TOKENS as C, DEFAULT_CLASSIFIER_RETRY_TIMEOUT_MS as M, DEFAULT_CLASSIFIER_TIMEOUT_MS as N, ERROR_THRESHOLD as P, WINDOW_MS as a2, checkAbsoluteDeny as a3, classify as a4, collectAllSignals as a5, computeRulesFingerprint as a6, createAutoModeToolGuardrail as a7, createCircuitBreaker as a8, createDenialTracker as a9, formatAgentsForPrompt as aa, getKodaxGlobalDir as ab, loadAgentsFiles as ac, loadAutoRules as ad, parseAutoRules as ae, parseClassifierOutput as af, readTrustState as ag, recordAllow as ah, recordBlock as ai, recordError as aj, shouldFallback as ak, shouldFallback$1 as al, trustProjectRules as am, CONSECUTIVE_THRESHOLD as v, CUMULATIVE_THRESHOLD as w };
911
+ export type { TierZeroPatternId as $, AbsoluteDenyCheck as A, ClassifierDecision as B, ClassifierFailureKind as D, ClassifierHazard as E, ClassifierObservedProtocol as F, ClassifierOutputWarningCode as G, ClassifierParseFailureCode as H, ClassifierProtocol as I, ClassifierToolProjectionResolver as J, ClassifyDecision as K, ClassifyOptions as L, DenialTracker as O, KodaXMcpConnectMode as Q, KodaXMcpServerConfig as R, KodaXMcpServersConfig as S, KodaXMcpTransport as T, LoadAgentsOptions as U, LoadedRulesSource as V, PermissionIntentEvidence as W, RulesLoadError as X, RulesLoadResult as Y, SignalCollector as Z, SkippedRulesSource as _, AbsoluteDenyMatch as a, ToolCallSignal as a0, TrustState as a1, AbsoluteDenyMiss as b, AbsoluteDenyResult as c, AgentsFile as d, AutoModeAskUser as e, AutoModeAskUserVerdict as f, AutoModeCallAnalyzer as g, AutoModeDecisionDiagnostics as h, AutoModeEngine as i, AutoModeGuardrailConfig as j, AutoModePermissionBoundary as k, AutoModePermissionOperation as l, AutoModePermissionReview as m, AutoModePermissionTarget as n, AutoModeRulesContext as o, AutoModeRulesDecision as p, AutoModeRulesEvaluator as q, AutoModeSharedState as r, AutoModeStats as s, AutoModeToolGuardrail as t, AutoRules as u, CircuitBreaker as x, ClassifierAttemptDiagnostics as y, ClassifierAttemptOutcome as z };
@@ -1,5 +1,5 @@
1
- import { k as KodaXMessage } from './types.d-DIpZJKUl.js';
2
- import { bU as KodaXSessionLineage } from './types.d-BA-Jwpfs.js';
1
+ import { k as KodaXMessage } from './types.d-CgrXrFrq.js';
2
+ import { c1 as KodaXSessionLineage } from './controller.d-C2aHqzHj.js';
3
3
 
4
4
  type KodaXSessionHistoryScope = 'compacted' | 'all';
5
5
  type KodaXSessionHistorySource = 'user' | 'assistant' | 'system' | 'tool' | 'child_task';
@@ -25,6 +25,12 @@ interface KodaXSessionHistorySearchResult {
25
25
  revision: string;
26
26
  hits: KodaXSessionHistoryHit[];
27
27
  }
28
+ /** @internal Cooperative control used by Runtime history reads. */
29
+ interface KodaXSessionHistorySearchControl {
30
+ readonly revision: string;
31
+ checkpoint(): void;
32
+ yieldControl(): Promise<void>;
33
+ }
28
34
  interface KodaXSessionHistoryReadOptions {
29
35
  entryId: string;
30
36
  revision?: string;
@@ -51,7 +57,14 @@ type KodaXSessionHistoryReadResult = {
51
57
  citation: string;
52
58
  };
53
59
  declare function searchSessionHistory(lineage: KodaXSessionLineage, options: KodaXSessionHistorySearchOptions): KodaXSessionHistorySearchResult;
60
+ /** @internal Runtime preflight; kept out of the public package barrels. */
61
+ declare function validateSessionHistorySearchQuery(query: string): void;
62
+ /**
63
+ * Runtime-facing history search that yields between bounded batches so
64
+ * timeout/cancel signals can be observed while indexing large transcripts.
65
+ */
66
+ declare function searchSessionHistoryCooperatively(lineage: KodaXSessionLineage, options: KodaXSessionHistorySearchOptions, control: KodaXSessionHistorySearchControl): Promise<KodaXSessionHistorySearchResult>;
54
67
  declare function readSessionHistoryEntry(lineage: KodaXSessionLineage, options: KodaXSessionHistoryReadOptions): KodaXSessionHistoryReadResult;
55
68
 
56
- export { readSessionHistoryEntry as r, searchSessionHistory as s };
69
+ export { searchSessionHistoryCooperatively as g, readSessionHistoryEntry as r, searchSessionHistory as s, validateSessionHistorySearchQuery as v };
57
70
  export type { KodaXSessionHistoryHit as K, KodaXSessionHistoryReadOptions as a, KodaXSessionHistoryReadResult as b, KodaXSessionHistoryScope as c, KodaXSessionHistorySearchOptions as d, KodaXSessionHistorySearchResult as e, KodaXSessionHistorySource as f };
@@ -30,6 +30,10 @@ declare class McpAuthRequiredError extends Error {
30
30
  constructor(status: number, wwwAuthenticate?: string | undefined);
31
31
  }
32
32
  type StdioFraming = 'content-length' | 'ndjson';
33
+ declare class McpTransportCleanupIncompleteError extends Error {
34
+ readonly code: "mcp_cleanup_incomplete";
35
+ constructor();
36
+ }
33
37
  interface McpTransportOptions {
34
38
  stdioFraming?: StdioFraming;
35
39
  httpResolvedTransport?: 'streamable-http' | 'sse';
@@ -170,5 +174,5 @@ declare function performOAuthLogin(options: PerformOAuthLoginOptions): Promise<O
170
174
  */
171
175
  declare function loadValidToken(serverId: string): Promise<OAuthToken | undefined>;
172
176
 
173
- export { McpAuthRequiredError as M, McpExpiredSessionError as a, createMcpTransport as f, discoverAuthorizationServerMetadata as g, discoverOAuthEndpoints as h, discoverProtectedResourceMetadata as i, extractInsufficientScope as j, extractResourceMetadataUrl as k, loadValidToken as l, performOAuthLogin as p, registerOAuthClient as r };
174
- export type { AuthorizationServerMetadata as A, DiscoveredOAuthEndpoints as D, OAuthClientInfo as O, PerformOAuthLoginOptions as P, WwwAuthenticateChallenge as W, McpTransport as b, McpTransportEvents as c, OAuthLoginConsent as d, ProtectedResourceMetadata as e };
177
+ export { McpAuthRequiredError as M, McpExpiredSessionError as a, McpTransportCleanupIncompleteError as c, createMcpTransport as g, discoverAuthorizationServerMetadata as h, discoverOAuthEndpoints as i, discoverProtectedResourceMetadata as j, extractInsufficientScope as k, extractResourceMetadataUrl as l, loadValidToken as m, performOAuthLogin as p, registerOAuthClient as r };
178
+ export type { AuthorizationServerMetadata as A, DiscoveredOAuthEndpoints as D, OAuthClientInfo as O, PerformOAuthLoginOptions as P, WwwAuthenticateChallenge as W, McpTransport as b, McpTransportEvents as d, OAuthLoginConsent as e, ProtectedResourceMetadata as f };