opencode-swarm 7.139.0 → 7.139.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +15 -0
  2. package/README.md +7 -6
  3. package/dist/cli/{config-doctor-aszp7z1h.js → config-doctor-hrb61yqe.js} +2 -2
  4. package/dist/cli/{core-3s832mxx.js → core-g2dfh9fq.js} +1 -1
  5. package/dist/cli/{curation-policy-a3hs73f7.js → curation-policy-4tp0mbcb.js} +7 -7
  6. package/dist/cli/{curator-drift-jpap6hv4.js → curator-drift-vfh07mqy.js} +5 -2
  7. package/dist/cli/{curator-llm-factory-e8ngwyjm.js → curator-llm-factory-hvw13hmr.js} +28 -28
  8. package/dist/cli/{curator-zxjqcc8r.js → curator-vpcs1p1v.js} +28 -28
  9. package/dist/cli/{evidence-summary-service-qfhjfxdz.js → evidence-summary-service-kzxr71yd.js} +9 -9
  10. package/dist/cli/{gate-evidence-m2grv70v.js → gate-evidence-z2b1ymnw.js} +5 -5
  11. package/dist/cli/{guardrail-explain-rqpmzxyy.js → guardrail-explain-k62h3c92.js} +29 -29
  12. package/dist/cli/{guardrail-log-vd4a0ng5.js → guardrail-log-2ftew0p3.js} +3 -3
  13. package/dist/cli/{hive-promoter-jc5vym27.js → hive-promoter-mpf0cfkk.js} +28 -28
  14. package/dist/cli/{index-4ft523nb.js → index-0wp67gqj.js} +143 -89
  15. package/dist/cli/{index-ymszzvnr.js → index-3eddtgxt.js} +1 -1
  16. package/dist/cli/{index-67yqywan.js → index-3radty3f.js} +2 -2
  17. package/dist/cli/{index-p2dz85tv.js → index-4xbyy6aw.js} +2 -2
  18. package/dist/cli/{index-a614s16f.js → index-5j6chvj8.js} +1 -1
  19. package/dist/cli/{index-tcdcj1g2.js → index-5w7ekpy3.js} +2 -2
  20. package/dist/cli/{index-nbgw5dxa.js → index-5zyk8qgv.js} +2 -2
  21. package/dist/cli/{index-tyh0p5e8.js → index-668dpw5e.js} +1 -1
  22. package/dist/cli/{index-6q240xgm.js → index-6c5f309q.js} +2 -2
  23. package/dist/cli/{index-s428dmy6.js → index-6w1re1qn.js} +2 -2
  24. package/dist/cli/{index-nsnfvckc.js → index-8gftfvpp.js} +1 -1
  25. package/dist/cli/{index-rtetrxxq.js → index-8p9pasnp.js} +8 -3
  26. package/dist/cli/{index-85hstja2.js → index-a12906mj.js} +1 -1
  27. package/dist/cli/{index-chvqee1j.js → index-a5eba0t8.js} +2 -2
  28. package/dist/cli/{index-r3pth9a7.js → index-a7nh382r.js} +508 -441
  29. package/dist/cli/{index-t31cc7kv.js → index-cyw81ngh.js} +7 -7
  30. package/dist/cli/{index-kv36s0x0.js → index-e9tx99ds.js} +6 -3
  31. package/dist/cli/{index-fsrp8wp3.js → index-ed5ykebp.js} +25 -2
  32. package/dist/cli/{index-0tsetsxs.js → index-ffpmqx30.js} +4 -4
  33. package/dist/cli/{index-nc544sfw.js → index-gvhvz176.js} +2 -2
  34. package/dist/cli/{index-3nr2sn32.js → index-ktagrqxw.js} +3 -3
  35. package/dist/cli/{index-t26nfmcs.js → index-prmb5qfp.js} +2 -2
  36. package/dist/cli/{index-q3qtgtd0.js → index-q11t5erh.js} +1 -1
  37. package/dist/cli/{index-x20cgr2q.js → index-q7ezzgwq.js} +16 -2
  38. package/dist/cli/{index-z1tkxzq4.js → index-s608d3hw.js} +2 -2
  39. package/dist/cli/{index-y46anh5e.js → index-se8xc78k.js} +30 -30
  40. package/dist/cli/{index-84s6x604.js → index-w71cq27a.js} +5 -5
  41. package/dist/cli/{index-ddmnhv4h.js → index-wrt6m5ze.js} +1 -1
  42. package/dist/cli/{index-4qzeef9h.js → index-x9q4bbhd.js} +1 -1
  43. package/dist/cli/{index-zd15ya1w.js → index-y47dwge1.js} +1 -1
  44. package/dist/cli/{index-5bkpyvdf.js → index-y64jv2pe.js} +1 -1
  45. package/dist/cli/{index-gytyqv1d.js → index-yr6x707c.js} +2 -2
  46. package/dist/cli/index.js +28 -28
  47. package/dist/cli/{knowledge-escalator-6473ey4c.js → knowledge-escalator-n9pmx4qr.js} +8 -8
  48. package/dist/cli/{knowledge-events-wwzpz8m4.js → knowledge-events-raevm18w.js} +6 -6
  49. package/dist/cli/{knowledge-link-trfydkzm.js → knowledge-link-3tq8w6gs.js} +5 -5
  50. package/dist/cli/{knowledge-store-99gd42jy.js → knowledge-store-bcfqz8fr.js} +6 -6
  51. package/dist/cli/{knowledge-validator-v2eevvdg.js → knowledge-validator-jxqj96cx.js} +9 -9
  52. package/dist/cli/{pending-delegations-p6n83x67.js → pending-delegations-tmyf18p4.js} +5 -5
  53. package/dist/cli/{pr-subscriptions-xbrfr51c.js → pr-subscriptions-hhx6yk24.js} +5 -5
  54. package/dist/cli/{runner-9an52tmz.js → runner-w30gazew.js} +6 -6
  55. package/dist/cli/{scan-cursor-39zxpw34.js → scan-cursor-ah5swtyh.js} +7 -7
  56. package/dist/cli/{schema-xhfwr6b2.js → schema-f7jgrtxj.js} +3 -1
  57. package/dist/cli/{scope-persistence-nsa6ra9s.js → scope-persistence-3f0d4fwv.js} +4 -4
  58. package/dist/cli/{skill-generator-5px81476.js → skill-generator-hp7as46c.js} +10 -10
  59. package/dist/cli/{telemetry-7nt7zhyp.js → telemetry-4tgrfhaz.js} +1 -1
  60. package/dist/cli/{worktree-collision-ownership-9x4s4890.js → worktree-collision-ownership-vexb0b6r.js} +38 -8
  61. package/dist/config/context-window.d.ts +210 -0
  62. package/dist/config/schema.d.ts +18 -0
  63. package/dist/evaluation/ephemeral-agent-dispatcher.d.ts +18 -0
  64. package/dist/evaluation/model-dispatcher.d.ts +1 -0
  65. package/dist/hooks/delegate-ack-collector.d.ts +1 -1
  66. package/dist/hooks/delegation-gate/worktree-collision-ownership.d.ts +7 -0
  67. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +2 -1
  68. package/dist/hooks/delegation-gate/worktree-provisioning-owner.d.ts +6 -0
  69. package/dist/hooks/index.d.ts +2 -2
  70. package/dist/hooks/init-orphan-recovery.d.ts +4 -1
  71. package/dist/hooks/knowledge-application-gate.d.ts +2 -1
  72. package/dist/hooks/knowledge-application.d.ts +5 -4
  73. package/dist/hooks/knowledge-injector.d.ts +16 -0
  74. package/dist/hooks/knowledge-types.d.ts +1 -1
  75. package/dist/hooks/messages-transform.d.ts +18 -0
  76. package/dist/hooks/model-limits.d.ts +88 -30
  77. package/dist/hooks/pr-workflow-gate.d.ts +8 -1
  78. package/dist/index.js +455 -452
  79. package/dist/memory/injector.d.ts +2 -0
  80. package/dist/services/context-budget-service.d.ts +6 -1
  81. package/dist/services/status-service.d.ts +14 -0
  82. package/dist/state.d.ts +37 -0
  83. package/dist/tools/context-status.d.ts +3 -1
  84. package/dist/turbo/lean/runner.d.ts +10 -0
  85. package/dist/utils/ephemeral-session-teardown.d.ts +98 -0
  86. package/dist/utils/path-security.d.ts +75 -5
  87. package/dist/utils/swarm-artifact-cache.d.ts +13 -0
  88. package/dist/worktree/index.d.ts +1 -1
  89. package/dist/worktree/merge.d.ts +36 -3
  90. package/package.json +1 -1
@@ -18,8 +18,9 @@ import * as fs from 'node:fs';
18
18
  import { scanDelegationFallbacksForRecovery, scanDelegationsForRecovery } from '../background/pending-delegations.js';
19
19
  import { isLocked, listActiveLocks, tryAcquireLock } from '../parallel/file-locks';
20
20
  import { removeWorktree } from '../worktree/core';
21
+ import { scanRegisteredWorktreeLiveness } from '../worktree/merge';
21
22
  import { scanWorktreeMergeFailuresForRecovery } from './delegation-gate/worktree-merge-status';
22
- import { scanWorktreeProvisioningOwnersForRecovery } from './delegation-gate/worktree-provisioning-owner';
23
+ import { removeWorktreeProvisioningOwner, scanWorktreeProvisioningOwnersForRecovery } from './delegation-gate/worktree-provisioning-owner';
23
24
  type OwnershipTagSessionScan = {
24
25
  status: 'ok';
25
26
  sessionIds: string[];
@@ -49,6 +50,8 @@ export declare const _internals: {
49
50
  scanDelegationFallbacksForRecovery: typeof scanDelegationFallbacksForRecovery;
50
51
  scanWorktreeMergeFailuresForRecovery: typeof scanWorktreeMergeFailuresForRecovery;
51
52
  scanWorktreeProvisioningOwnersForRecovery: typeof scanWorktreeProvisioningOwnersForRecovery;
53
+ scanRegisteredWorktreeLiveness: typeof scanRegisteredWorktreeLiveness;
54
+ removeWorktreeProvisioningOwner: typeof removeWorktreeProvisioningOwner;
52
55
  };
53
56
  export interface InitOrphanRecoveryResult {
54
57
  attempted: boolean;
@@ -4,7 +4,8 @@
4
4
  * Two integration points:
5
5
  *
6
6
  * 1. `experimental.chat.messages.transform` — scans the latest
7
- * architect-authored message for `KNOWLEDGE_APPLIED|IGNORED|VIOLATED`
7
+ * architect-authored message for
8
+ * `KNOWLEDGE_APPLIED|IGNORED|CONTRADICTED|VIOLATED`
8
9
  * markers and records them via `recordAcknowledgmentDeduped`. This
9
10
  * runs BEFORE the architect's next tool call so the toolBefore gate
10
11
  * sees the ack.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Knowledge application tracking — distinguishes shown / acknowledged / applied
3
- * / ignored / violated outcomes for injected knowledge directives.
3
+ * / ignored / contradicted / violated outcomes for injected knowledge directives.
4
4
  *
5
5
  * Writes one JSONL line per outcome to `.swarm/knowledge-application.jsonl`,
6
6
  * and updates per-entry retrieval-outcome counters on the source knowledge file.
@@ -13,12 +13,13 @@ export declare const MAX_LEGACY_APPLICATION_LOG_ENTRIES = 5000;
13
13
  * Recognised forms (case-insensitive, line-anchored or inline):
14
14
  * KNOWLEDGE_APPLIED: <id>
15
15
  * KNOWLEDGE_IGNORED: <id> reason=<reason>
16
+ * KNOWLEDGE_CONTRADICTED: <id> reason=<observable conflict>
16
17
  * KNOWLEDGE_VIOLATED: <id> reason=<reason>
17
18
  * KNOWLEDGE_N_A: <id> reason=<reason> (delegate contract, Change 1)
18
19
  */
19
20
  export interface ParsedAcknowledgment {
20
21
  id: string;
21
- result: 'applied' | 'ignored' | 'violated' | 'n_a';
22
+ result: 'applied' | 'ignored' | 'contradicted' | 'violated' | 'n_a';
22
23
  reason?: string;
23
24
  }
24
25
  export declare function parseAcknowledgments(text: string): ParsedAcknowledgment[];
@@ -32,7 +33,7 @@ export interface RecordContext {
32
33
  }
33
34
  /** Record one or more knowledge IDs as "shown" (injected into context). */
34
35
  export declare function recordKnowledgeShown(directory: string, ids: string[], ctx: RecordContext): Promise<void>;
35
- /** Record an explicit acknowledgment outcome (applied / ignored / violated).
36
+ /** Record an explicit acknowledgment outcome (applied / ignored / contradicted / violated).
36
37
  * Per-(sessionId, knowledgeId, result) dedup is enforced by the
37
38
  * caller via swarmState.knowledgeAckDedup; this fn always records when
38
39
  * invoked, so test code can trigger duplicates if needed. The runtime
@@ -57,7 +58,7 @@ export interface ShownNotAppliedQuery {
57
58
  }
58
59
  /**
59
60
  * Returns the subset of `knowledgeIds` that have at least one "shown" record
60
- * in the audit log without a subsequent "applied"/"ignored"/"violated" record
61
+ * in the audit log without a subsequent "applied"/"ignored"/"contradicted"/"violated" record
61
62
  * in the same task or phase scope.
62
63
  */
63
64
  export declare function getShownButNotAcknowledged(directory: string, q: ShownNotAppliedQuery): Promise<string[]>;
@@ -92,6 +92,10 @@ export declare function defaultExpectedToolsForAgent(agentName: string): string[
92
92
  * are stripped on both sides so `mega_coder` matches a bare `coder`.
93
93
  */
94
94
  export declare function matchesDelegateScope(entry: Pick<RankedEntry, 'applies_to_agents' | 'applies_to_tools'>, role: string, expectedTools: readonly string[]): boolean;
95
+ /** Inserts the knowledge block just before the last user message (recency position). */
96
+ declare function injectKnowledgeMessage(output: {
97
+ messages?: MessageWithParts[];
98
+ }, text: string): void;
95
99
  /**
96
100
  * Creates a knowledge injection hook that injects relevant knowledge into the
97
101
  * architect's message context at phase start. Supports caching for re-injection
@@ -114,3 +118,15 @@ export declare const _internals: {
114
118
  recordLessonsShown: typeof recordLessonsShown;
115
119
  confirmEntriesPhase: typeof confirmEntriesPhase;
116
120
  };
121
+ /**
122
+ * Tier-0 test seam (see `.opencode/skills/writing-tests/SKILL.md`). Exposes the
123
+ * real injection primitive and its sentinel so the
124
+ * `consolidateSystemMessages` interaction test (issue #1619) exercises the
125
+ * production splice position and message shape instead of a hand-copied fixture
126
+ * that could silently drift from this module.
127
+ */
128
+ export declare const _test_exports: {
129
+ injectKnowledgeMessage: typeof injectKnowledgeMessage;
130
+ INJECTION_SENTINEL: string;
131
+ };
132
+ export {};
@@ -549,7 +549,7 @@ export interface KnowledgeRetrievalContext {
549
549
  planConstraints?: string[];
550
550
  mode?: RetrievalMode;
551
551
  }
552
- export type KnowledgeApplicationResult = 'shown' | 'acknowledged' | 'applied' | 'ignored' | 'violated';
552
+ export type KnowledgeApplicationResult = 'shown' | 'acknowledged' | 'applied' | 'ignored' | 'contradicted' | 'violated';
553
553
  /** One line of .swarm/knowledge-application.jsonl. */
554
554
  export interface KnowledgeApplicationRecord {
555
555
  timestamp: string;
@@ -31,4 +31,22 @@ type PartsMessage = {
31
31
  };
32
32
  export type Message = FlatMessage | PartsMessage;
33
33
  export declare function consolidateSystemMessages(messages: Message[]): Message[];
34
+ /**
35
+ * In-place variant of {@link consolidateSystemMessages} for use inside an
36
+ * `experimental.chat.messages.transform` handler.
37
+ *
38
+ * The OpenCode host invokes each plugin hook as `M(input, output)`, **discards
39
+ * the handler's return value**, and afterwards reads its OWN local message
40
+ * array (host binary offset ~100,667,665:
41
+ * `yield* d.trigger("experimental.chat.messages.transform",{},{messages:C})`
42
+ * followed by `Me.toModelMessagesEffect(C,Z)`). Therefore
43
+ * `output.messages = consolidateSystemMessages(output.messages)` is a *rebind*
44
+ * that the host never observes — it silently did nothing in production from the
45
+ * day it was written until issue #1619. Only mutating the array the host handed
46
+ * us is observable.
47
+ *
48
+ * The consolidated result is computed BEFORE the array is cleared, because
49
+ * `consolidateSystemMessages` reads the same array it is passed.
50
+ */
51
+ export declare function consolidateSystemMessagesInPlace(messages: Message[]): void;
34
52
  export {};
@@ -1,19 +1,41 @@
1
1
  /**
2
- * Provider-Aware Model Limit Resolution
2
+ * Provider-Aware Model Limit Resolution — STATIC FALLBACK ONLY.
3
3
  *
4
- * Resolves context window limits based on the model and provider platform.
5
- * The same model has different context limits depending on the provider:
6
- * - Claude Sonnet 4.6: 200k native, 128k on Copilot
7
- * - GPT-5: 400k native, 128k on Copilot
8
- * - Copilot caps ALL models at 128k prompt, regardless of native limit
4
+ * > **The two tables below are a last resort, not the source of truth.**
5
+ * > The authoritative context window is the live `model.limit.context` the host
6
+ * > hands to `experimental.chat.system.transform`, resolved through
7
+ * > `src/config/context-window.ts`. That value is already provider-specific:
8
+ * > the host's model catalog is keyed `providers[providerID].models[modelID]`,
9
+ * > and the on-disk catalog shows `github-copilot`'s `claude-sonnet-4.5` and
10
+ * > `anthropic`'s `claude-sonnet-4-5` carrying different `limit.context`
11
+ * > values. These tables are consulted only when no live value reached the
12
+ * > call site (the `experimental.chat.messages.transform` paths on the very
13
+ * > first turn of a session, before any `system.transform` has run).
14
+ *
15
+ * **These tables are known-stale and are deliberately NOT used to cap the live
16
+ * value.** `PROVIDER_CAPS` claims Copilot caps everything at 128 000; the live
17
+ * catalog shows Copilot Claude entries at 200 000 (`claude-sonnet-4.5`,
18
+ * `claude-sonnet-4.6`) and 1 000 000 (`claude-fable-5`), with only `gpt-4.1`
19
+ * actually at 128 000. Min-capping a correct live value against that would
20
+ * reintroduce the too-small denominator the live derivation exists to remove.
21
+ * `NATIVE_MODEL_LIMITS` is stale in the same direction (`claude-sonnet-4` is
22
+ * listed at 200 000; the catalog reports 216 000).
23
+ *
24
+ * Do not "refresh" these tables by hand — that is the maintenance treadmill the
25
+ * live derivation replaced. They exist so a first-turn `messages.transform`
26
+ * consumer degrades to a plausible number instead of the flat 128 000 floor.
9
27
  */
10
28
  /**
11
29
  * Native model context limits (in tokens) when used on their native platform.
30
+ *
31
+ * Static fallback only — see the module header.
12
32
  */
13
33
  export declare const NATIVE_MODEL_LIMITS: Record<string, number>;
14
34
  /**
15
35
  * Provider-specific context caps that override native limits.
16
- * These are typically lower than native limits (e.g., Copilot caps at 128k).
36
+ *
37
+ * Static fallback only, and known-stale — see the module header. This is NOT
38
+ * applied as a ceiling over the live `model.limit.context`.
17
39
  */
18
40
  export declare const PROVIDER_CAPS: Record<string, number>;
19
41
  /**
@@ -51,46 +73,82 @@ export declare function extractModelInfo(messages: MessageWithParts[]): {
51
73
  modelID?: string;
52
74
  providerID?: string;
53
75
  };
76
+ /**
77
+ * Extracts the sessionID from a `experimental.chat.messages.transform` message
78
+ * array, scanning newest-first.
79
+ *
80
+ * The messages hooks receive no `input.sessionID` (the plugin type declares
81
+ * `input: {}`), but every message's `info` carries one. This is the key used to
82
+ * look up the live `model.limit.context` that the `system.transform` hook
83
+ * recorded for the session — see `getLiveContextWindow` in `src/state.ts`.
84
+ *
85
+ * @returns the sessionID, or `undefined` when no message carries one.
86
+ */
87
+ export declare function extractSessionId(messages: MessageWithParts[] | undefined): string | undefined;
88
+ /**
89
+ * Static-table lookup used as `fallbackLookup` for
90
+ * {@link resolveContextWindow}. Preserves the historical precedence of
91
+ * the two tables relative to each other (provider cap first, then a
92
+ * longest-prefix native match), and is reachable only when no live
93
+ * `model.limit.context` was available.
94
+ */
95
+ export declare function lookupStaticModelLimit(modelID?: string, providerID?: string): number | undefined;
54
96
  /**
55
97
  * Resolves the context limit for a given model/provider combination.
56
98
  *
57
- * Resolution order (first match wins):
58
- * 1. Check configOverrides["provider/model"] (e.g., "copilot/claude-sonnet-4-6": 200000)
59
- * 2. Check configOverrides[modelID] (e.g., "claude-sonnet-4-6": 200000)
60
- * 3. Check PROVIDER_CAPS[providerID] (e.g., copilot 128000)
61
- * 4. Check NATIVE_MODEL_LIMITS with prefix matching (e.g., "claude-sonnet-4" matches "claude-sonnet-4-6-20260301")
62
- * 5. Check configOverrides.default
63
- * 6. Fall back to 128000
99
+ * Thin adapter over the single derivation in `src/config/context-window.ts` —
100
+ * this function exists so the `experimental.chat.messages.transform` consumers
101
+ * (`context-budget.ts`, `knowledge-injector.ts`, `tools/context-status.ts`)
102
+ * keep their existing `(modelID, providerID, overrides)` call shape. All
103
+ * ordering logic lives in the shared resolver; see its module header.
104
+ *
105
+ * Resolution order (first usable value wins):
106
+ * 1. `configOverrides["<providerID>/<modelID>"]`
107
+ * 2. `configOverrides["<modelID>"]`
108
+ * 3. `configOverrides.default`
109
+ * 4. `liveContextLimit` — the host's live `model.limit.context` for this session
110
+ * 5. `PROVIDER_CAPS[providerID]`, else a longest-prefix `NATIVE_MODEL_LIMITS`
111
+ * match (both known-stale; see the module header)
112
+ * 6. `DEFAULT_MODEL_CONTEXT_TOKENS` (128000)
113
+ *
114
+ * Two ordering changes vs. the pre-#1619 implementation, both deliberate:
115
+ * - `configOverrides.default` moved from below the static tables to above
116
+ * them. An explicitly authored user value losing to a hardcoded table was a
117
+ * defect; it is now consistent with the compound and model-only keys, which
118
+ * already outranked the tables.
119
+ * - The live `model.limit.context` was inserted above both tables, which is
120
+ * the entire point of this change.
121
+ *
122
+ * Any value that is not a finite number ≥ 1000 is skipped rather than used, so
123
+ * a malformed override or a catalog entry with `limit.context: 0` can never
124
+ * produce a `NaN` / `Infinity` percentage.
64
125
  *
65
126
  * @param modelID - The model identifier (e.g., "claude-sonnet-4-6", "gpt-5")
66
- * @param providerID - The provider identifier (e.g., "copilot", "anthropic")
67
- * @param configOverrides - User configuration overrides
127
+ * @param providerID - The provider identifier (e.g., "github-copilot", "anthropic")
128
+ * @param configOverrides - User configuration overrides (`context_budget.model_limits`)
129
+ * @param liveContextLimit - The live `model.limit.context` recorded for this
130
+ * session by the `system.transform` hook, when one has been seen
68
131
  * @returns The resolved context limit in tokens
69
132
  *
70
133
  * @example
71
- * // Provider cap (copilot)
72
- * resolveModelLimit("claude-sonnet-4-6", "copilot", {})
73
- * // Returns: 128000
74
- *
75
- * @example
76
- * // Native limit (anthropic)
77
- * resolveModelLimit("claude-sonnet-4-6", "anthropic", {})
134
+ * // Live value wins over the stale static tables
135
+ * resolveModelLimit("claude-sonnet-4-6", "github-copilot", {}, 200000)
78
136
  * // Returns: 200000
79
137
  *
80
138
  * @example
81
- * // Override beats cap
82
- * resolveModelLimit("gpt-5", "copilot", { "copilot/gpt-5": 200000 })
83
- * // Returns: 200000
139
+ * // Explicit user override beats the live value
140
+ * resolveModelLimit("gpt-5", "github-copilot", { "github-copilot/gpt-5": 60000 }, 400000)
141
+ * // Returns: 60000
84
142
  *
85
143
  * @example
86
- * // Prefix match for model variants
144
+ * // No live value: falls back to the static table (prefix match)
87
145
  * resolveModelLimit("claude-sonnet-4-6-20260301", "anthropic", {})
88
146
  * // Returns: 200000
89
147
  *
90
148
  * @example
91
- * // Full fallback
92
- * resolveModelLimit(undefined, undefined, {})
149
+ * // Malformed live value is ignored, not divided by
150
+ * resolveModelLimit(undefined, undefined, {}, 0)
93
151
  * // Returns: 128000
94
152
  */
95
- export declare function resolveModelLimit(modelID?: string, providerID?: string, configOverrides?: Record<string, number>): number;
153
+ export declare function resolveModelLimit(modelID?: string, providerID?: string, configOverrides?: Record<string, number>, liveContextLimit?: unknown): number;
96
154
  export {};
@@ -283,6 +283,13 @@ export interface PrWorkflowGateState {
283
283
  /** Canonical ordered semantic ledger frozen by the first micro dispatch. */
284
284
  prReviewTriggerLedger?: PrReviewInlineTriggerRow[];
285
285
  prReviewTriggerEvalPath?: string;
286
+ /**
287
+ * The run_id bound to the trigger-evaluation receipt at first consumption.
288
+ * Mirrors `prReviewArtifactRunId`: once set, a subsequent receipt under a
289
+ * different run_id is rejected, and it must agree with the findings artifact
290
+ * run_id (both live under `.swarm/pr-review/<run_id>/`). Closes issue #2124.
291
+ */
292
+ prReviewTriggerEvalRunId?: string;
286
293
  prReviewValidationBatches?: PrReviewValidationBatchRecord[];
287
294
  /** Keyed by validation batch id. See `PrReviewBatchCoherenceRecord`. */
288
295
  prReviewBatchCoherence?: Record<string, PrReviewBatchCoherenceRecord>;
@@ -465,7 +472,7 @@ export declare function recordPrFeedbackGateBatch(directory: string, sessionID:
465
472
  export declare function assertPrFeedbackGatePhaseSettled(directory: string, sessionID: string, phase: PrFeedbackGatePhase): Promise<PrWorkflowGateState>;
466
473
  /** Require every ordered feedback gate on one unchanged revision. */
467
474
  export declare function assertPrFeedbackReadyToPublish(directory: string, sessionID: string): Promise<PrWorkflowGateState>;
468
- export declare function markPrReviewTriggerEvaluationComplete(directory: string, sessionID: string, artifactPath: string): Promise<PrWorkflowGateState>;
475
+ export declare function markPrReviewTriggerEvaluationComplete(directory: string, sessionID: string, runId: string, artifactPath: string): Promise<PrWorkflowGateState>;
469
476
  /** Freeze one exact inline trigger ledger across every micro dispatch. */
470
477
  export declare function bindPrReviewTriggerLedger(directory: string, sessionID: string, input: unknown): Promise<PrWorkflowGateState>;
471
478
  export declare function assertPrReviewArtifactBoundary(directory: string, sessionID: string, runId: string, boundary: PrReviewArtifactBoundary, findingIds: string[]): Promise<PrWorkflowGateState>;