@cortexkit/opencode-magic-context 0.49.107 → 0.49.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/{context-ywdwfzg5.js → context-v7jc2hf4.js} +5 -5
- package/dist/{derive-budgets-vbv0fwsd.js → derive-budgets-jpmkxtpy.js} +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +12 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts +29 -5
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts.map +1 -1
- package/dist/{index-e4szqthq.js → index-3e21p6aw.js} +7 -7
- package/dist/{index-h1qh9n8b.js → index-b5gvqs6v.js} +50 -2
- package/dist/{index-5phmpcme.js → index-cnc012ye.js} +2 -2
- package/dist/{index-xa8jgw6w.js → index-g8mnadxa.js} +238 -60
- package/dist/{index-3p08zzfq.js → index-r0cthscw.js} +1 -1
- package/dist/{index-20e7w8v8.js → index-xstjfxv0.js} +2 -2
- package/dist/index.js +9 -9
- package/dist/{recomp-orchestrator-7sf94073.js → recomp-orchestrator-4bmq5v13.js} +3 -3
- package/dist/shared/hidden-model-cooldown.d.ts +4 -2
- package/dist/shared/hidden-model-cooldown.d.ts.map +1 -1
- package/dist/shared/models-dev-cache.d.ts +4 -0
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-vd9rckyd.js → transform-postprocess-phase-wke30603.js} +3 -3
- package/dist/v2/{context-6g9j3tq9.js → context-wkwh795k.js} +7 -7
- package/dist/v2/{derive-budgets-9237wmq5.js → derive-budgets-cteq4emg.js} +2 -2
- package/dist/v2/{recomp-orchestrator-j84xfa80.js → recomp-orchestrator-ht8yx0k9.js} +4 -4
- package/dist/v2/{server-v60f6dk3.js → server-76t9kh02.js} +241 -63
- package/dist/v2/{server-d4h86y7v.js → server-jm1dty9b.js} +50 -2
- package/dist/v2/{server-0b3ms151.js → server-pr35mfmv.js} +1 -1
- package/dist/v2/{server-cc58mckk.js → server-qa349ht8.js} +1 -1
- package/dist/v2/server.js +4 -4
- package/dist/v2/{wrapup-orchestrator-m1ymvccg.js → wrapup-orchestrator-a4kxe6fn.js} +4 -4
- package/dist/{wrapup-orchestrator-k7azmnym.js → wrapup-orchestrator-7g9jcdqz.js} +4 -4
- package/package.json +1 -1
- package/src/shared/hidden-model-cooldown.ts +12 -4
- package/src/shared/models-dev-cache.test.ts +136 -0
- package/src/shared/models-dev-cache.ts +61 -1
package/README.md
CHANGED
|
@@ -62,6 +62,8 @@ npx @cortexkit/magic-context@latest setup
|
|
|
62
62
|
|
|
63
63
|
Auto-detects which harnesses you have installed (OpenCode, Pi, OMP, or any combination) and configures each one: it registers the plugin, turns off the host's built-in compaction, helps you pick models for the historian and dreamer, and resolves conflicts with other context-management plugins. Restart the harness afterwards to load Magic Context. Target a specific harness with `--harness opencode`, `--harness pi`, or `--harness omp`.
|
|
64
64
|
|
|
65
|
+
Run `npx @cortexkit/magic-context@latest --help` to list the CLI commands. Add `--help` or `-h` to any command or subcommand to see its options without running it. Unknown or mistyped options stop the command before it does any work.
|
|
66
|
+
|
|
65
67
|
> **Why disable built-in compaction?** Magic Context manages context itself. The host's compaction would interfere with its cache-aware deferred operations and double-compress.
|
|
66
68
|
|
|
67
69
|
### Manual setup (OpenCode)
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
clearNoteNudgeTriggerOnly,
|
|
55
55
|
nonNarrativeStoredGapRanges,
|
|
56
56
|
getActiveCompartmentRun
|
|
57
|
-
} from "./index-
|
|
57
|
+
} from "./index-g8mnadxa.js";
|
|
58
58
|
import"./index-sd3egckz.js";
|
|
59
59
|
import {
|
|
60
60
|
getHarness2
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
deriveHistorianChunkTokens2,
|
|
78
78
|
resolveKnownHistorianContextLimit2,
|
|
79
79
|
resolveHistorianContextLimit2
|
|
80
|
-
} from "./index-
|
|
80
|
+
} from "./index-b5gvqs6v.js";
|
|
81
81
|
import {
|
|
82
82
|
isDreamerRunnable,
|
|
83
83
|
isSmartNoteSurfaceAvailable,
|
|
@@ -156,7 +156,7 @@ import {
|
|
|
156
156
|
waitForEventSubscriptionRetry,
|
|
157
157
|
HiddenModelActivity,
|
|
158
158
|
startEventSubscriptionWorker
|
|
159
|
-
} from "./index-
|
|
159
|
+
} from "./index-3e21p6aw.js";
|
|
160
160
|
import {
|
|
161
161
|
invalidateAutoEmbedSession,
|
|
162
162
|
clearEmbedSessionState
|
|
@@ -359,7 +359,7 @@ import {
|
|
|
359
359
|
servedHeadChanged,
|
|
360
360
|
noteHostCheckpointCommit,
|
|
361
361
|
isSyntheticHeadMessage2
|
|
362
|
-
} from "./index-
|
|
362
|
+
} from "./index-cnc012ye.js";
|
|
363
363
|
import"./index-qxzk5s30.js";
|
|
364
364
|
import"./index-qt1qqasc.js";
|
|
365
365
|
import {
|
|
@@ -382,7 +382,7 @@ import {
|
|
|
382
382
|
import"./index-y5f5yg5a.js";
|
|
383
383
|
import"./index-61a853ky.js";
|
|
384
384
|
import"./index-a3t1ck7g.js";
|
|
385
|
-
import"./index-
|
|
385
|
+
import"./index-r0cthscw.js";
|
|
386
386
|
import"./index-cayqdwf9.js";
|
|
387
387
|
import {
|
|
388
388
|
detectConflicts
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import type { SubagentKind } from "../../features/magic-context/storage-subagent-invocations";
|
|
2
2
|
import type { PluginContext } from "../../plugin/types";
|
|
3
|
-
import type { ModelInput } from "../../shared/model-resolution";
|
|
3
|
+
import type { ModelInput, ResolvedModelEntry } from "../../shared/model-resolution";
|
|
4
4
|
import { type RunTokenLog } from "../../shared/run-token-log";
|
|
5
5
|
import type { Database } from "../../shared/sqlite";
|
|
6
6
|
import type { HiddenCompletionExecutor, HistorianProgressCallbacks, StoredCompartmentRange, ValidatedHistorianPassResult } from "./compartment-runner-types";
|
|
7
7
|
import { type HistorianValidationChunk } from "./compartment-runner-validation";
|
|
8
|
+
import { type HistorianWindowSkip } from "./historian-prompt-fit";
|
|
8
9
|
export declare function resolveHiddenCompletionExecutor(executor: HiddenCompletionExecutor | undefined, client: PluginContext["client"] | undefined, db: Database, directory: string, entryPoint: string): HiddenCompletionExecutor;
|
|
9
10
|
export declare function createV1HiddenCompletionExecutor(client: PluginContext["client"] | undefined, db: Database, directory: string): HiddenCompletionExecutor;
|
|
10
11
|
export declare function historianReasoningBudgetDiagnostic(outputTokens: number, tokens?: RunTokenLog): string;
|
|
12
|
+
export declare function configuredHistorianFallbacks(args: {
|
|
13
|
+
model?: ModelInput;
|
|
14
|
+
fallbackModels?: readonly ModelInput[];
|
|
15
|
+
}): ResolvedModelEntry[] | undefined;
|
|
16
|
+
interface HistorianWindowDecisions {
|
|
17
|
+
skipped?: ReadonlyMap<number, HistorianWindowSkip>;
|
|
18
|
+
unfitHints?: ReadonlyMap<number, HistorianWindowSkip>;
|
|
19
|
+
}
|
|
11
20
|
export declare function runValidatedHistorianPass(args: {
|
|
12
21
|
client: PluginContext["client"] | undefined;
|
|
13
22
|
hiddenCompletionExecutor?: HiddenCompletionExecutor;
|
|
@@ -33,6 +42,7 @@ export declare function runValidatedHistorianPass(args: {
|
|
|
33
42
|
* only when no historian primary was configured.
|
|
34
43
|
*/
|
|
35
44
|
fallbackModels?: readonly ModelInput[];
|
|
45
|
+
windowDecisions?: HistorianWindowDecisions;
|
|
36
46
|
callbacks?: HistorianProgressCallbacks;
|
|
37
47
|
/** When true, run a second editor pass after successful historian output
|
|
38
48
|
* to clean low-signal U: lines and cross-compartment duplicates. If editor
|
|
@@ -42,4 +52,5 @@ export declare function runValidatedHistorianPass(args: {
|
|
|
42
52
|
agentId?: string;
|
|
43
53
|
language?: string;
|
|
44
54
|
}): Promise<ValidatedHistorianPassResult>;
|
|
55
|
+
export {};
|
|
45
56
|
//# sourceMappingURL=compartment-runner-historian.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compartment-runner-historian.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-historian.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAER,YAAY,EACf,MAAM,2DAA2D,CAAC;AAOnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAaxD,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"compartment-runner-historian.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-historian.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAER,YAAY,EACf,MAAM,2DAA2D,CAAC;AAOnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAaxD,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAIpF,OAAO,EAAqB,KAAK,WAAW,EAAe,MAAM,4BAA4B,CAAC;AAC9F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAQpD,OAAO,KAAK,EAER,wBAAwB,EAExB,0BAA0B,EAE1B,sBAAsB,EACtB,4BAA4B,EAC/B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAEH,KAAK,wBAAwB,EAEhC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACH,KAAK,mBAAmB,EAI3B,MAAM,wBAAwB,CAAC;AAsFhC,wBAAgB,+BAA+B,CAC3C,QAAQ,EAAE,wBAAwB,GAAG,SAAS,EAC9C,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS,EAC3C,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACnB,wBAAwB,CAI1B;AAED,wBAAgB,gCAAgC,CAC5C,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,SAAS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AwB,CAAC;IAC3C,SAAS,CAAC,EAAE,0BAA0B,CAAC;IACvC;;yEAEqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAgIxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compartment-runner-incremental.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-incremental.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compartment-runner-incremental.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-incremental.ts"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAyE9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAkCxE;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,QAAiB,CAAC;AAwBpE;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAI/E;AA4BD,MAAM,WAAW,2BAA2B;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;+EAC+E;AAC/E,wBAAgB,+BAA+B,CAC3C,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC,EACF,aAAa,GAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAkC,GAC5F,2BAA2B,GAAG,IAAI,CAkBpC;AAED,+DAA+D;AAC/D,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAKhE;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAy7C1F"}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import type { Memory } from "../../features/magic-context/memory/types";
|
|
26
26
|
import type { ModelInput } from "../../shared/model-resolution";
|
|
27
|
+
import { type ModelLimit } from "../../shared/models-dev-cache";
|
|
27
28
|
import type { Database } from "../../shared/sqlite";
|
|
28
29
|
import { type ReferenceCompartment } from "./reference-retrieval";
|
|
29
30
|
/**
|
|
@@ -44,6 +45,12 @@ export interface HistorianProducerWindow {
|
|
|
44
45
|
inputLimitTokens?: number;
|
|
45
46
|
/** Output tokens reserved inside a shared context window. */
|
|
46
47
|
maxOutputTokens: number;
|
|
48
|
+
/** Catalog output limit for diagnostics; the actual reserve can differ. */
|
|
49
|
+
publishedOutputTokens?: number;
|
|
50
|
+
/** Live below-floor metadata can inform a skip, but must never size a prompt. */
|
|
51
|
+
belowFloorHint?: ModelLimit & {
|
|
52
|
+
reserve: number;
|
|
53
|
+
};
|
|
47
54
|
}
|
|
48
55
|
/**
|
|
49
56
|
* The window that the OpenCode historian checks a prompt against before sending
|
|
@@ -51,18 +58,24 @@ export interface HistorianProducerWindow {
|
|
|
51
58
|
* passes that check. `fallbackContextLimit` stands in when the model catalog
|
|
52
59
|
* knows no window for the model.
|
|
53
60
|
*/
|
|
54
|
-
export declare function resolveHistorianProducerWindow(modelKey: string | undefined, configuredMaxOutputTokens: number | undefined, fallbackContextLimit?: number): HistorianProducerWindow;
|
|
61
|
+
export declare function resolveHistorianProducerWindow(modelKey: string | undefined, configuredMaxOutputTokens: number | undefined, fallbackContextLimit?: number, readBelowFloorHint?: boolean): HistorianProducerWindow;
|
|
62
|
+
export declare function withHistorianHintReserve(hint: ModelLimit, configuredMaxOutputTokens: number | undefined): NonNullable<HistorianProducerWindow["belowFloorHint"]>;
|
|
55
63
|
export interface HistorianPromptFitArgs {
|
|
56
64
|
window: HistorianProducerWindow;
|
|
57
65
|
/**
|
|
58
66
|
* The other models the same prompt may be sent to, in chain order (the
|
|
59
67
|
* configured fallbacks, or the session model when no historian primary is
|
|
60
|
-
* configured). Every
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* prompt on its own. Models with an unknown window add no limit.
|
|
68
|
+
* configured). Every fallback sends the bytes built once from this fit.
|
|
69
|
+
* Only known fallback windows that can hold the minimum prompt affect
|
|
70
|
+
* sizing. Unknown and hinted windows do not constrain it.
|
|
64
71
|
*/
|
|
65
72
|
fallbackWindows?: readonly HistorianProducerWindow[];
|
|
73
|
+
/** Additional limits for sizing only, not models eligible for dispatch. */
|
|
74
|
+
sizingOnlyWindows?: readonly HistorianProducerWindow[];
|
|
75
|
+
/** Only callers that dispatch the same explicit chain can skip its candidates. */
|
|
76
|
+
skipUnfitCandidates?: boolean;
|
|
77
|
+
/** Report unfit hints separately when dispatch selects a suffix after sizing. */
|
|
78
|
+
deferHintSkips?: boolean;
|
|
66
79
|
systemPrompt: string;
|
|
67
80
|
/** Chunk budget the caller would use without a window, in local tokens. */
|
|
68
81
|
requestedChunkTokens: number;
|
|
@@ -110,6 +123,8 @@ export type HistorianPromptFit = {
|
|
|
110
123
|
/** True when any fixed context was dropped to make room. */
|
|
111
124
|
trimmed: boolean;
|
|
112
125
|
kept: HistorianPromptFitKept;
|
|
126
|
+
skipped?: ReadonlyMap<number, HistorianWindowSkip>;
|
|
127
|
+
unfitHints?: ReadonlyMap<number, HistorianWindowSkip>;
|
|
113
128
|
} | {
|
|
114
129
|
ok: false;
|
|
115
130
|
reason: string;
|
|
@@ -134,5 +149,14 @@ export declare function fitRecompHistorianPrompt(args: {
|
|
|
134
149
|
export declare function describeHistorianPromptTrim(fit: Extract<HistorianPromptFit, {
|
|
135
150
|
ok: true;
|
|
136
151
|
}>): string;
|
|
152
|
+
export interface HistorianWindowSkip {
|
|
153
|
+
reason: string;
|
|
154
|
+
modelKey?: string;
|
|
155
|
+
published: ModelLimit;
|
|
156
|
+
belowFloor: boolean;
|
|
157
|
+
}
|
|
158
|
+
/** Report skips once the chain reaches the next attempt, not for unused fallbacks. */
|
|
159
|
+
export declare function logSkippedHistorianWindows(sessionId: string, skipped: ReadonlyMap<number, HistorianWindowSkip> | undefined, nextIndex: number, nextModel: string): void;
|
|
160
|
+
export declare function logSkippedHistorianWindow(sessionId: string, { modelKey, published, belowFloor, reason }: HistorianWindowSkip, nextModel: string): void;
|
|
137
161
|
export declare function fitHistorianPrompt(args: HistorianPromptFitArgs): HistorianPromptFit;
|
|
138
162
|
//# sourceMappingURL=historian-prompt-fit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"historian-prompt-fit.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/historian-prompt-fit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"historian-prompt-fit.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/historian-prompt-fit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAGH,KAAK,UAAU,EAClB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAgBpD,OAAO,EACH,KAAK,oBAAoB,EAK5B,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,8BAA8B,OAAQ,CAAC;AASpD;;;;GAIG;AACH,eAAO,MAAM,mCAAmC,QACc,CAAC;AAE/D,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AAC,EAAE,UAAU,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,oBAAoB,EAAE,CAAC;CAC/C,GAAG,kBAAkB,CAcrB;AAED,wDAAwD;AACxD,wBAAgB,2BAA2B,CACvC,GAAG,EAAE,OAAO,CAAC,kBAAkB,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,GAC/C,MAAM,CAGR;AAUD,MAAM,WAAW,mBAAmB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,UAAU,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;CACvB;AAID,sFAAsF;AACtF,wBAAgB,0BAA0B,CACtC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,SAAS,EAC7D,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAClB,IAAI,CAON;AAED,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,MAAM,EACjB,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,mBAAmB,EAChE,SAAS,EAAE,MAAM,GAClB,IAAI,CAQN;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB,CAmQnF"}
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
snapRangeToCompartments,
|
|
220
220
|
getActiveCompartmentRun,
|
|
221
221
|
startCompartmentAgent
|
|
222
|
-
} from "./index-
|
|
222
|
+
} from "./index-g8mnadxa.js";
|
|
223
223
|
import {
|
|
224
224
|
formatWindowDerivationLine,
|
|
225
225
|
getSdkWindowGeometry,
|
|
@@ -228,7 +228,7 @@ import {
|
|
|
228
228
|
deriveTriggerBudget2,
|
|
229
229
|
resolveKnownHistorianContextLimit2,
|
|
230
230
|
resolveHistorianProducerLimits2
|
|
231
|
-
} from "./index-
|
|
231
|
+
} from "./index-b5gvqs6v.js";
|
|
232
232
|
import {
|
|
233
233
|
resolveModelCalibration,
|
|
234
234
|
calibrateBuckets,
|
|
@@ -837,7 +837,7 @@ import {
|
|
|
837
837
|
abortSessionFailClosed2,
|
|
838
838
|
evaluateEmergencyFailClosed2,
|
|
839
839
|
runPostTransformPhase2
|
|
840
|
-
} from "./index-
|
|
840
|
+
} from "./index-cnc012ye.js";
|
|
841
841
|
import {
|
|
842
842
|
flushIgnoredMessages2,
|
|
843
843
|
clearIgnoredMessages2,
|
|
@@ -847,7 +847,7 @@ import {
|
|
|
847
847
|
import {
|
|
848
848
|
setRecompStarting2,
|
|
849
849
|
setRecompTerminal2
|
|
850
|
-
} from "./index-
|
|
850
|
+
} from "./index-r0cthscw.js";
|
|
851
851
|
import {
|
|
852
852
|
ANNOUNCEMENT_VERSION2,
|
|
853
853
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -16507,7 +16507,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16507
16507
|
return { count: buildCompartmentCount(db, sessionId, moduleStatus) };
|
|
16508
16508
|
});
|
|
16509
16509
|
const buildManagedCtx = async (db) => {
|
|
16510
|
-
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-
|
|
16510
|
+
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-jpmkxtpy.js"));
|
|
16511
16511
|
const { resolveHistorianModel } = await importPluginModule(() => import("./model-resolution-280gmqvd.js"));
|
|
16512
16512
|
const { userObservationCollectionEnabled, userObservationsRequested } = await importPluginModule(() => import("./task-config-vrebjxyy.js"));
|
|
16513
16513
|
const DEFAULT_HISTORIAN_TIMEOUT_MS = 10 * 60 * 1000;
|
|
@@ -16559,7 +16559,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16559
16559
|
const db = readDatabase();
|
|
16560
16560
|
if (!db)
|
|
16561
16561
|
return { ok: false, error: "db unavailable" };
|
|
16562
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16562
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-4bmq5v13.js"));
|
|
16563
16563
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-tfhs4dbc.js"));
|
|
16564
16564
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16565
16565
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -16644,7 +16644,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16644
16644
|
const db = readDatabase();
|
|
16645
16645
|
if (!db)
|
|
16646
16646
|
return { ok: false, error: "db unavailable" };
|
|
16647
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16647
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-7g9jcdqz.js"));
|
|
16648
16648
|
const model = await args.readSelectedSessionModel?.(sessionId) ?? liveSessionState.liveModelBySession.get(sessionId);
|
|
16649
16649
|
const window = resolveOpenCodeWrapupWindow(db, sessionId, model);
|
|
16650
16650
|
if (!window)
|
|
@@ -222,6 +222,21 @@ var MAX_SANE_LIMIT = 3000000;
|
|
|
222
222
|
function isSaneLimit(limit) {
|
|
223
223
|
return typeof limit === "number" && limit >= MIN_SANE_LIMIT && limit <= MAX_SANE_LIMIT;
|
|
224
224
|
}
|
|
225
|
+
function belowFloorProducerHint(limit) {
|
|
226
|
+
if (isSaneLimit(limit?.context) || isSaneLimit(limit?.input))
|
|
227
|
+
return;
|
|
228
|
+
const small = (value) => value !== undefined && Number.isInteger(value) && value > 0 && value < MIN_SANE_LIMIT;
|
|
229
|
+
const context = small(limit?.context) ? limit.context : undefined;
|
|
230
|
+
const input = small(limit?.input) ? limit.input : undefined;
|
|
231
|
+
if (context === undefined && input === undefined)
|
|
232
|
+
return;
|
|
233
|
+
const output = limit?.output;
|
|
234
|
+
return {
|
|
235
|
+
context,
|
|
236
|
+
input,
|
|
237
|
+
output: output !== undefined && Number.isInteger(output) && output > 0 ? output : undefined
|
|
238
|
+
};
|
|
239
|
+
}
|
|
225
240
|
var SEPARATE_OUTPUT_QUOTA_PROVIDERS = new Set([
|
|
226
241
|
"google",
|
|
227
242
|
"google-antigravity",
|
|
@@ -232,6 +247,8 @@ var OUTPUT_RESERVE_CAP_RATIO2 = 0.25;
|
|
|
232
247
|
var outputReserveConfig;
|
|
233
248
|
var reserveClampLogSeen = new Set;
|
|
234
249
|
var apiCache = null;
|
|
250
|
+
var producerHints = new Map;
|
|
251
|
+
var producerModeHints = new Map;
|
|
235
252
|
var apiLoadedAt = 0;
|
|
236
253
|
var v2DraftModelLimits = new Map;
|
|
237
254
|
var v2DraftModelLimitLogged = new Set;
|
|
@@ -447,12 +464,24 @@ async function refreshModelLimitsOnce(client, merge = false, draftOnlyModelKey)
|
|
|
447
464
|
return false;
|
|
448
465
|
}
|
|
449
466
|
const map = new Map;
|
|
467
|
+
const hints = new Map;
|
|
468
|
+
const modeHints = new Map;
|
|
450
469
|
for (const entry of providers) {
|
|
451
470
|
const p = entry;
|
|
452
471
|
if (!p?.id || !p.models || typeof p.models !== "object")
|
|
453
472
|
continue;
|
|
454
473
|
for (const [modelId, model] of Object.entries(p.models)) {
|
|
455
|
-
|
|
474
|
+
const key = `${p.id}/${modelId}`;
|
|
475
|
+
setCachedModelMetadata(map, key, model, merge);
|
|
476
|
+
if (key === draftOnlyModelKey)
|
|
477
|
+
continue;
|
|
478
|
+
const hint = belowFloorProducerHint(model?.limit) ?? null;
|
|
479
|
+
hints.set(key, hint);
|
|
480
|
+
const modes = model?.experimental?.modes;
|
|
481
|
+
if (modes && typeof modes === "object") {
|
|
482
|
+
for (const mode of Object.keys(modes))
|
|
483
|
+
modeHints.set(`${key}-${mode}`, hint);
|
|
484
|
+
}
|
|
456
485
|
}
|
|
457
486
|
}
|
|
458
487
|
const previousSize = apiCache?.size ?? null;
|
|
@@ -462,6 +491,16 @@ async function refreshModelLimitsOnce(client, merge = false, draftOnlyModelKey)
|
|
|
462
491
|
apiCache = map;
|
|
463
492
|
v2DraftModelLimits.clear();
|
|
464
493
|
}
|
|
494
|
+
if (merge) {
|
|
495
|
+
for (const [key, hint] of hints)
|
|
496
|
+
producerHints.set(key, apiCache?.has(key) ? null : hint);
|
|
497
|
+
for (const [key, hint] of modeHints) {
|
|
498
|
+
producerModeHints.set(key, apiCache?.has(key) ? null : hint);
|
|
499
|
+
}
|
|
500
|
+
} else {
|
|
501
|
+
producerHints = hints;
|
|
502
|
+
producerModeHints = modeHints;
|
|
503
|
+
}
|
|
465
504
|
apiLoadedAt = Date.now();
|
|
466
505
|
persistApiCache();
|
|
467
506
|
const size = apiCache?.size ?? 0;
|
|
@@ -575,6 +614,15 @@ function getSdkOutputLimit(providerID, modelID) {
|
|
|
575
614
|
loadPersistedApiCacheOnce();
|
|
576
615
|
return lookupMetadataWithTagFallback(apiCache, providerID, modelID)?.outputLimit;
|
|
577
616
|
}
|
|
617
|
+
function getSdkBelowFloorProducerHint(providerID, modelID) {
|
|
618
|
+
const exact = `${providerID}/${modelID}`;
|
|
619
|
+
const hintFor = (key) => producerHints.has(key) ? producerHints.get(key) : producerModeHints.get(key);
|
|
620
|
+
const hint = hintFor(exact);
|
|
621
|
+
if (hint !== undefined)
|
|
622
|
+
return hint ?? undefined;
|
|
623
|
+
const colon = modelID.lastIndexOf(":");
|
|
624
|
+
return colon > 0 ? hintFor(`${providerID}/${modelID.slice(0, colon)}`) ?? undefined : undefined;
|
|
625
|
+
}
|
|
578
626
|
function getSdkInputLimit(providerID, modelID) {
|
|
579
627
|
loadPersistedApiCacheOnce();
|
|
580
628
|
if (!apiCache)
|
|
@@ -675,4 +723,4 @@ function producerSourceLocalBudget2(providerTokens, modelKey) {
|
|
|
675
723
|
return ratio === 1 ? providerTokens : localBudget(providerTokens, ratio);
|
|
676
724
|
}
|
|
677
725
|
|
|
678
|
-
export { catalogOutputReserve, hasTrustedAbsoluteWall, applyProvenInputFloor, formatWindowDerivationLine, isSaneLimit, setOutputReserveConfig, resolveLimit, refreshModelLimitsFromApi, refreshModelLimitsAfterAuthOnce, useV2DraftModelLimits, getSdkWindowGeometry, getSdkContextLimit, modelSupportsVision, getSdkOutputLimit, getModelsDevCacheState, deriveTriggerBudget2, deriveHistorianChunkTokens2, resolveKnownHistorianContextLimit2, resolveHistorianProducerLimits2, resolveHistorianContextLimit2, producerSourceLocalBudget2 };
|
|
726
|
+
export { catalogOutputReserve, hasTrustedAbsoluteWall, applyProvenInputFloor, formatWindowDerivationLine, isSaneLimit, setOutputReserveConfig, resolveLimit, refreshModelLimitsFromApi, refreshModelLimitsAfterAuthOnce, useV2DraftModelLimits, getSdkWindowGeometry, getSdkContextLimit, modelSupportsVision, getSdkOutputLimit, getSdkBelowFloorProducerHint, getModelsDevCacheState, deriveTriggerBudget2, deriveHistorianChunkTokens2, resolveKnownHistorianContextLimit2, resolveHistorianProducerLimits2, resolveHistorianContextLimit2, producerSourceLocalBudget2 };
|
|
@@ -263,7 +263,7 @@ import {
|
|
|
263
263
|
isSaneLimit,
|
|
264
264
|
getSdkWindowGeometry,
|
|
265
265
|
getSdkContextLimit
|
|
266
|
-
} from "./index-
|
|
266
|
+
} from "./index-b5gvqs6v.js";
|
|
267
267
|
import {
|
|
268
268
|
getProjectEmbeddingSnapshot2,
|
|
269
269
|
embedTextForProject2,
|
|
@@ -301,7 +301,7 @@ import {
|
|
|
301
301
|
peekNoteNudgeText,
|
|
302
302
|
markNoteNudgeDelivered,
|
|
303
303
|
getActiveCompartmentRun
|
|
304
|
-
} from "./index-
|
|
304
|
+
} from "./index-g8mnadxa.js";
|
|
305
305
|
import {
|
|
306
306
|
canonicalModelIdentity,
|
|
307
307
|
piModelRefToCanonical,
|