@cortexkit/opencode-magic-context 0.49.48 → 0.49.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{announcement-g789dmt6.js → announcement-9pr71hd5.js} +3 -2
- package/dist/auto-search-worker.js +5 -5
- package/dist/chunk-embedding-write-worker.js +14 -15
- package/dist/{compaction-marker-candidates-dkfp1q9j.js → compaction-marker-candidates-8hazqfvj.js} +2 -3
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/{compartment-chunk-embedding-snj51nmg.js → compartment-chunk-embedding-gfd093f8.js} +7 -8
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +10 -0
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-w1aw6w5t.js → conflict-warning-hook-56qpq7ws.js} +7 -8
- package/dist/{context-8r125qv3.js → context-4js5qnnm.js} +61 -49
- package/dist/{derive-budgets-nkw09vq7.js → derive-budgets-z53424qx.js} +2 -3
- package/dist/embedding-backfill-3wdjzrvs.js +27 -0
- package/dist/embedding-worker-process.js +2 -3
- package/dist/embedding-worker.js +6 -7
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +5 -7
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-openai.d.ts +4 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-probe.d.ts +10 -0
- package/dist/features/magic-context/memory/embedding-probe.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +14 -0
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +2 -0
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/{history-owner-0z620wgz.js → history-owner-n50e0e8y.js} +2 -3
- 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/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +5 -3
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-rvmhyk89.js → index-07rp6xcn.js} +9 -9
- package/dist/{index-txs8tce6.js → index-0k283v27.js} +2 -4
- package/dist/{index-ak11t3gm.js → index-0tz2fzpq.js} +1 -1
- package/dist/{index-2qbtqg1w.js → index-25tm250q.js} +1 -1
- package/dist/{index-h9m41624.js → index-2ny9xwdn.js} +2 -2
- package/dist/{index-xa9mmq6c.js → index-36wseasx.js} +1 -1
- package/dist/{index-cgzpbz78.js → index-5dptmnvd.js} +5 -5
- package/dist/{index-q41sm60t.js → index-5g6npyw5.js} +89 -63
- package/dist/{index-qsyx931k.js → index-5t1mr0bt.js} +13 -15
- package/dist/{index-jrfre9ah.js → index-82dfe8en.js} +146 -5
- package/dist/{index-d4qw2h43.js → index-8d7gkgjs.js} +6 -5
- package/dist/{index-gn6gfz4y.js → index-90z05d0p.js} +1 -1
- package/dist/{index-trkxkgmd.js → index-97bjd14c.js} +5 -5
- package/dist/{index-9wnbnx8f.js → index-a6aqpfp6.js} +1 -1
- package/dist/{index-s79g172v.js → index-bamnjp2t.js} +29 -13
- package/dist/{index-4wpfbzks.js → index-bkg4hdyh.js} +3 -3
- package/dist/{index-gp3kcpc4.js → index-cd3vp8xa.js} +1 -1
- package/dist/{index-vk6srk5r.js → index-ct3ettqt.js} +3 -3
- package/dist/{index-sd2s4t4p.js → index-cwj6qhmf.js} +2 -2
- package/dist/{index-brj6was5.js → index-em92bp7f.js} +2 -2
- package/dist/{index-2p37txes.js → index-ga5q492k.js} +1 -1
- package/dist/{index-8cfnaagj.js → index-gapnh6tk.js} +2 -4
- package/dist/{index-fw42ms3m.js → index-gz001bx7.js} +1 -1
- package/dist/{index-zetm0ayn.js → index-h8g08nxs.js} +164 -106
- package/dist/{index-qcz1fy7h.js → index-hexdee98.js} +4 -4
- package/dist/{index-fgft4qjn.js → index-hkveze74.js} +4 -4
- package/dist/{index-smtbdmc3.js → index-hsv31e69.js} +2 -2
- package/dist/{index-dj2p8653.js → index-hsyczpn7.js} +2 -2
- package/dist/{index-4dpvnp8k.js → index-jjy5a5w0.js} +3 -0
- package/dist/{index-1hwn96x1.js → index-kn1bx21r.js} +3 -3
- package/dist/{index-t6s0tsp7.js → index-mjh63zvw.js} +3 -3
- package/dist/{index-ta87fpfs.js → index-n0twfvah.js} +64 -15
- package/dist/{index-nj360hcs.js → index-pb8ysnq2.js} +4 -4
- package/dist/{index-jz5bk7xd.js → index-qperbvjn.js} +2 -2
- package/dist/{index-25ka1jza.js → index-r9agn061.js} +4 -4
- package/dist/{index-hkh8x221.js → index-rbs27k1d.js} +7 -7
- package/dist/{index-hacf2tyx.js → index-reyws9fy.js} +1 -1
- package/dist/{index-cgsmttyj.js → index-s131svmx.js} +4 -4
- package/dist/{index-fxbk7gk3.js → index-tad3can2.js} +1 -1
- package/dist/{index-8ka0ne8t.js → index-v4a1pnny.js} +6 -6
- package/dist/{index-xh3jyejb.js → index-wr2t8zb0.js} +17 -19
- package/dist/{index-q6pjqm49.js → index-z4832qfe.js} +14 -14
- package/dist/index.js +54 -56
- package/dist/{logger-qwnbcfj9.js → logger-sw7z6sjz.js} +1 -2
- package/dist/{message-fts-rowid-map-msffhkve.js → message-fts-rowid-map-kx1bsdyg.js} +4 -5
- package/dist/{message-index-bounded-0q7sy04w.js → message-index-bounded-k0ebpy3y.js} +12 -13
- package/dist/{message-time-backfill-39bm498k.js → message-time-backfill-hp2jgn49.js} +2 -3
- package/dist/migration-worker.js +12 -13
- package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -1
- package/dist/plugin/embedding-routing.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{project-embedding-registry-r6xfsrbe.js → project-embedding-registry-5dwh5zfn.js} +12 -13
- package/dist/raw-ordinal-warmup-worker.js +8 -8
- package/dist/{read-session-chunk-7fmg9p5m.js → read-session-chunk-6712p893.js} +10 -11
- package/dist/{read-session-raw-x7a9b3jm.js → read-session-raw-04ger9zt.js} +2 -3
- package/dist/{recomp-orchestrator-jqa5z4ar.js → recomp-orchestrator-8ebydg5j.js} +31 -32
- package/dist/render-dtc4qkq4.js +43 -0
- package/dist/{safe-notification-target-wztd7bgk.js → safe-notification-target-mx5khyxf.js} +2 -3
- package/dist/{search-archive-df09r8qn.js → search-archive-f6hjbnsa.js} +12 -13
- package/dist/{search-kt764afk.js → search-edv0gy1d.js} +24 -25
- package/dist/{send-session-notification-j93pn2hn.js → send-session-notification-gamjee2f.js} +5 -6
- package/dist/shared/data-path.d.ts +7 -13
- package/dist/shared/data-path.d.ts.map +1 -1
- package/dist/shared/hidden-model-cooldown.d.ts +23 -0
- package/dist/shared/hidden-model-cooldown.d.ts.map +1 -0
- package/dist/shared/model-suggestion-retry.d.ts +0 -2
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/provider-response-completion.d.ts +10 -0
- package/dist/shared/provider-response-completion.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +1 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/status-summary.d.ts +1 -0
- package/dist/shared/status-summary.d.ts.map +1 -1
- package/dist/shared/status-view-check.d.ts.map +1 -1
- package/dist/shared/status-view.d.ts +1 -0
- package/dist/shared/status-view.d.ts.map +1 -1
- package/dist/shared/test-db.d.ts +13 -0
- package/dist/shared/test-db.d.ts.map +1 -0
- package/dist/{storage-tags-96vyd6ra.js → storage-tags-kdb4qsyq.js} +4 -5
- package/dist/test-preload.d.ts +2 -0
- package/dist/test-preload.d.ts.map +1 -0
- package/dist/{transform-postprocess-phase-a7ety10n.js → transform-postprocess-phase-1bg25094.js} +32 -33
- package/dist/v2/auto-search-worker.js +5 -5
- package/dist/v2/chunk-embedding-write-worker.js +14 -14
- package/dist/v2/{compaction-marker-candidates-y737qb1v.js → compaction-marker-candidates-re14353a.js} +2 -2
- package/dist/v2/compaction-marker-candidates-worker.js +1 -1
- package/dist/v2/{compartment-chunk-embedding-nj5nrnbj.js → compartment-chunk-embedding-0pxsrzrt.js} +7 -7
- package/dist/v2/{context-9x7mnb7x.js → context-qkr7z6d0.js} +99 -63
- package/dist/v2/{derive-budgets-b5cgrtp8.js → derive-budgets-w0815q82.js} +3 -3
- package/dist/v2/embedding-backfill-x1zpc04f.js +27 -0
- package/dist/v2/embedding-worker-process.js +1 -1
- package/dist/v2/embedding-worker.js +5 -5
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/{history-owner-fpka43cn.js → history-owner-ep91wgqj.js} +2 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/usage-persist.d.ts +1 -1
- package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
- package/dist/v2/hooks/usage-reading.d.ts +3 -0
- package/dist/v2/hooks/usage-reading.d.ts.map +1 -1
- package/dist/v2/{logger-4cj6d03m.js → logger-xnscpj6w.js} +1 -1
- package/dist/v2/{message-fts-rowid-map-qe7cpksd.js → message-fts-rowid-map-57jh6xpb.js} +4 -4
- package/dist/v2/{message-index-bounded-hctgp22r.js → message-index-bounded-a36rw93p.js} +12 -12
- package/dist/v2/{message-time-backfill-0c4h7sg6.js → message-time-backfill-baxebka0.js} +2 -2
- package/dist/v2/migration-worker.js +11 -11
- package/dist/v2/{project-embedding-registry-ek0cy0d5.js → project-embedding-registry-v2fxrs8b.js} +12 -12
- package/dist/v2/raw-ordinal-warmup-worker.js +8 -8
- package/dist/v2/{read-session-chunk-zknadvjr.js → read-session-chunk-hzhxvhyv.js} +10 -10
- package/dist/v2/{read-session-raw-yss2ev98.js → read-session-raw-3e482h3c.js} +2 -2
- package/dist/v2/{recomp-orchestrator-m5w0eqke.js → recomp-orchestrator-yzr49pd0.js} +32 -32
- package/dist/v2/{render-89asy54r.js → render-rhaevxv1.js} +21 -21
- package/dist/v2/{safe-notification-target-gphhast7.js → safe-notification-target-9r79xnbt.js} +2 -2
- package/dist/v2/{search-archive-axz2gbdb.js → search-archive-9924fyk8.js} +12 -12
- package/dist/v2/{search-kdtja5rx.js → search-ggvexvv7.js} +23 -23
- package/dist/v2/{send-session-notification-na3q825m.js → send-session-notification-95p89k7q.js} +5 -5
- package/dist/v2/{server-yyqmvbvv.js → server-016a1whm.js} +161 -102
- package/dist/v2/{server-z3tyd1mx.js → server-0k586y7d.js} +3 -3
- package/dist/v2/{server-p9s40wfa.js → server-0ms13pc8.js} +3 -0
- package/dist/v2/{server-e3m10ds0.js → server-16kfxcxj.js} +4 -4
- package/dist/v2/{server-nn4hbymt.js → server-3bfc26r7.js} +9 -9
- package/dist/v2/{server-7vb38e51.js → server-3jc6qmdz.js} +1 -1
- package/dist/v2/{server-jra7awr5.js → server-3qf9n5ck.js} +11 -11
- package/dist/v2/{server-69m30b21.js → server-3yk44ddz.js} +1 -1
- package/dist/v2/{server-2gjqhmn9.js → server-4h4acntc.js} +27 -11
- package/dist/v2/{server-3schkz95.js → server-58h6rrnx.js} +4 -4
- package/dist/v2/{server-af1rmkyn.js → server-5kgesxck.js} +2 -2
- package/dist/v2/{server-mfn1yf9d.js → server-7vrtk78d.js} +1 -1
- package/dist/v2/{server-27kccwe7.js → server-88yvx6r9.js} +63 -12
- package/dist/v2/{server-f0j864ma.js → server-91gb0vh8.js} +1 -1
- package/dist/v2/{server-131h608x.js → server-966dq3pd.js} +2 -2
- package/dist/v2/{server-jb6tjyeb.js → server-bb6kf05j.js} +23 -20
- package/dist/v2/{server-sg2qjkrb.js → server-brsx45r6.js} +6 -4
- package/dist/v2/{server-gwxys0d0.js → server-c8z2grq0.js} +1 -1
- package/dist/v2/{server-y8n33d9j.js → server-g61hgy1y.js} +4 -4
- package/dist/v2/{server-zahgxer8.js → server-jxrqsn84.js} +3 -3
- package/dist/v2/{server-2j87594q.js → server-kgq2e2hh.js} +2 -2
- package/dist/v2/{server-ddw42d76.js → server-mxsy9h1d.js} +2 -2
- package/dist/v2/{server-qmmkhz2z.js → server-np27dgyt.js} +1 -1
- package/dist/v2/{server-jqn7q7tm.js → server-q93jdtz8.js} +5 -5
- package/dist/v2/{server-dcws5831.js → server-qp5sj6n5.js} +2 -2
- package/dist/v2/{server-7be0ersd.js → server-rcchadw0.js} +3 -3
- package/dist/v2/{server-b3r080cm.js → server-rz5jnhnv.js} +1 -1
- package/dist/v2/{server-zt1m5rwj.js → server-sa1fdt41.js} +1 -1
- package/dist/v2/{server-wa4qhryh.js → server-sb55ddgn.js} +5 -4
- package/dist/v2/{server-4x7n5qz7.js → server-scp3y4dh.js} +13 -11
- package/dist/v2/{server-pej5rnye.js → server-sgn61hht.js} +2 -2
- package/dist/v2/{server-ypf1ap0v.js → server-t8n27rbt.js} +1 -1
- package/dist/v2/{server-sefxj8k1.js → server-tmf0ayqp.js} +1 -1
- package/dist/v2/{server-sr8tf5dt.js → server-vjadwb3j.js} +6 -5
- package/dist/v2/{server-bez34e60.js → server-vqq3g1t7.js} +4 -4
- package/dist/v2/{server-tpt7bwq8.js → server-ww7xbxxf.js} +1 -1
- package/dist/v2/server.js +6 -6
- package/dist/v2/{storage-tags-xq8hjqkf.js → storage-tags-rzv7y0n3.js} +4 -4
- package/dist/v2/{v2-archive-reader-ky1wqcws.js → v2-archive-reader-5ggewg8q.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-6wt67saz.js → wrapup-orchestrator-36c5wyvq.js} +32 -32
- package/dist/{v2-archive-reader-665x2x4d.js → v2-archive-reader-gx5ke1d7.js} +1 -1
- package/dist/wrapup-orchestrator-ya31knav.js +55 -0
- package/package.json +1 -1
- package/src/config/index.test.ts +20 -0
- package/src/config/project-security.test.ts +5 -1
- package/src/config/project-security.ts +4 -0
- package/src/config/schema/magic-context.test.ts +43 -0
- package/src/config/schema/magic-context.ts +19 -0
- package/src/shared/data-path.test.ts +104 -56
- package/src/shared/data-path.ts +30 -30
- package/src/shared/hidden-model-cooldown.test.ts +117 -0
- package/src/shared/hidden-model-cooldown.ts +123 -0
- package/src/shared/model-suggestion-retry.test.ts +53 -76
- package/src/shared/model-suggestion-retry.ts +38 -53
- package/src/shared/provider-response-completion.test.ts +49 -0
- package/src/shared/provider-response-completion.ts +64 -0
- package/src/shared/rpc-types.ts +1 -0
- package/src/shared/startup-maintenance-policy.test.ts +115 -0
- package/src/shared/status-detail-text.test.ts +7 -0
- package/src/shared/status-summary.ts +3 -0
- package/src/shared/status-view-check.ts +1 -0
- package/src/shared/status-view.test.ts +15 -0
- package/src/shared/status-view.ts +11 -1
- package/src/shared/test-db.test.ts +84 -0
- package/src/shared/test-db.ts +36 -0
- package/dist/embedding-backfill-kpy5shsa.js +0 -28
- package/dist/index-g2q4htwp.js +0 -146
- package/dist/render-mnqc74ar.js +0 -44
- package/dist/v2/embedding-backfill-360efh1t.js +0 -27
- package/dist/wrapup-orchestrator-7kmb3jf9.js +0 -56
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getProjectMagicContextHistorianDir,
|
|
8
8
|
log2,
|
|
9
9
|
sessionLog2
|
|
10
|
-
} from "./server-
|
|
10
|
+
} from "./server-bb6kf05j.js";
|
|
11
11
|
import {
|
|
12
12
|
sanitizeDiagnosticText
|
|
13
13
|
} from "./server-z4p0ry94.js";
|
|
@@ -20,20 +20,20 @@ import {
|
|
|
20
20
|
cortexKitProjectConfigBasePath,
|
|
21
21
|
resolveLegacyConfigSourcesForHarness,
|
|
22
22
|
loadPluginConfigDetailed
|
|
23
|
-
} from "./server-
|
|
23
|
+
} from "./server-sb55ddgn.js";
|
|
24
24
|
import {
|
|
25
25
|
catalogOutputReserve,
|
|
26
26
|
getSdkContextLimit,
|
|
27
27
|
modelSupportsVision,
|
|
28
28
|
getSdkOutputLimit
|
|
29
|
-
} from "./server-
|
|
29
|
+
} from "./server-sa1fdt41.js";
|
|
30
30
|
import {
|
|
31
31
|
withContentLanguageDirective,
|
|
32
32
|
buildPrimaryLanguageDirective,
|
|
33
33
|
resolvePromptSurface,
|
|
34
34
|
DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
35
35
|
LIVE_RELOAD_CONFIG_PATHS
|
|
36
|
-
} from "./server-
|
|
36
|
+
} from "./server-0ms13pc8.js";
|
|
37
37
|
import {
|
|
38
38
|
inRootAsyncContext2,
|
|
39
39
|
Database2,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
RawOrdinalsNotReady2,
|
|
49
49
|
dropRawSessionOrdinalCheckpoints2,
|
|
50
50
|
runSessionWarmupWorker
|
|
51
|
-
} from "./server-
|
|
51
|
+
} from "./server-rz5jnhnv.js";
|
|
52
52
|
import {
|
|
53
53
|
providerMass,
|
|
54
54
|
calibrationForModelKey,
|
|
@@ -64,12 +64,12 @@ import {
|
|
|
64
64
|
foldShrunkPartTags2,
|
|
65
65
|
getTagNumberByMessageId2,
|
|
66
66
|
getActiveTagsBySession2
|
|
67
|
-
} from "./server-
|
|
67
|
+
} from "./server-rcchadw0.js";
|
|
68
68
|
import {
|
|
69
69
|
hasMeaningfulUserText2,
|
|
70
70
|
estimateTokens,
|
|
71
71
|
estimateFixedPromptTokens
|
|
72
|
-
} from "./server-
|
|
72
|
+
} from "./server-3jc6qmdz.js";
|
|
73
73
|
import {
|
|
74
74
|
resolveOpenCodeDbPath,
|
|
75
75
|
assertOpenCodeStoreGeneration,
|
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
openCodeDbExists,
|
|
81
81
|
withReadOnlySessionDb,
|
|
82
82
|
getMessageTimesFromOpenCodeDb
|
|
83
|
-
} from "./server-
|
|
83
|
+
} from "./server-7vrtk78d.js";
|
|
84
84
|
import {
|
|
85
85
|
removeUnsupportedCommitHashes,
|
|
86
86
|
completedToolArcCrossesBoundary,
|
|
@@ -152,17 +152,17 @@ import {
|
|
|
152
152
|
getRawSessionTagKeysThrough2,
|
|
153
153
|
getLegacyProtectedTailStartOrdinal2,
|
|
154
154
|
readSessionChunk2
|
|
155
|
-
} from "./server-
|
|
155
|
+
} from "./server-3bfc26r7.js";
|
|
156
156
|
import {
|
|
157
157
|
BoundedSessionMap
|
|
158
|
-
} from "./server-
|
|
158
|
+
} from "./server-kgq2e2hh.js";
|
|
159
159
|
import {
|
|
160
160
|
clearCompressionDepth,
|
|
161
161
|
clearCompressionDepthRange,
|
|
162
162
|
toMessageIndexSource,
|
|
163
163
|
clearIndexedMessagesInTransaction,
|
|
164
164
|
indexSourcesAfterOrdinal
|
|
165
|
-
} from "./server-
|
|
165
|
+
} from "./server-16kfxcxj.js";
|
|
166
166
|
import {
|
|
167
167
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
168
168
|
getCompartmentLeaseBlocker,
|
|
@@ -206,7 +206,7 @@ import {
|
|
|
206
206
|
getProjectState,
|
|
207
207
|
recordSubagentInvocation,
|
|
208
208
|
getLatestHistorianInvocationId
|
|
209
|
-
} from "./server-
|
|
209
|
+
} from "./server-88yvx6r9.js";
|
|
210
210
|
import {
|
|
211
211
|
invalidateAutoEmbedSession
|
|
212
212
|
} from "./server-2amn2s73.js";
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
replaceCompartmentChunkEmbeddings2,
|
|
220
220
|
deleteChunkEmbedBackoffForSession2,
|
|
221
221
|
chunkWindowSourceKey2
|
|
222
|
-
} from "./server-
|
|
222
|
+
} from "./server-g61hgy1y.js";
|
|
223
223
|
import {
|
|
224
224
|
isMarkerCandidateBasisCurrent2,
|
|
225
225
|
invalidateMarkerCandidateBasis2,
|
|
@@ -230,18 +230,18 @@ import {
|
|
|
230
230
|
certifiedMarkerReferenceFloor2,
|
|
231
231
|
readMarkerReferenceRows2,
|
|
232
232
|
readKnownMarkerReferenceRows2
|
|
233
|
-
} from "./server-
|
|
233
|
+
} from "./server-c8z2grq0.js";
|
|
234
234
|
import {
|
|
235
235
|
shouldSkipHomeProjectMemory,
|
|
236
236
|
resolveProjectIdentity
|
|
237
|
-
} from "./server-
|
|
237
|
+
} from "./server-3yk44ddz.js";
|
|
238
238
|
import {
|
|
239
239
|
contentSha2562,
|
|
240
240
|
enqueueShadowEmbeddingItems2,
|
|
241
241
|
getProjectChunkEmbeddingModelId2,
|
|
242
242
|
getProjectEmbeddingMaxInputTokens2,
|
|
243
243
|
embedItemsForProject2
|
|
244
|
-
} from "./server-
|
|
244
|
+
} from "./server-4h4acntc.js";
|
|
245
245
|
import {
|
|
246
246
|
V2_MEMORY_CATEGORIES,
|
|
247
247
|
CATEGORY_PRIORITY,
|
|
@@ -260,13 +260,13 @@ import {
|
|
|
260
260
|
userFacingFailureCode,
|
|
261
261
|
promoteSessionFactsDurable,
|
|
262
262
|
embedPromotedFacts
|
|
263
|
-
} from "./server-
|
|
263
|
+
} from "./server-sgn61hht.js";
|
|
264
264
|
import {
|
|
265
265
|
getSchemaFenceRejection,
|
|
266
266
|
LATEST_SUPPORTED_VERSION,
|
|
267
267
|
getPersistedSchemaVersion,
|
|
268
268
|
openDatabase
|
|
269
|
-
} from "./server-
|
|
269
|
+
} from "./server-scp3y4dh.js";
|
|
270
270
|
import {
|
|
271
271
|
parseCompartmentOutput,
|
|
272
272
|
resolveWorkspaceShareCategories,
|
|
@@ -275,7 +275,7 @@ import {
|
|
|
275
275
|
resolveStoredPathWorkspaceIdentity,
|
|
276
276
|
sourceNameForMemory,
|
|
277
277
|
computeWorkspaceEpochFingerprint
|
|
278
|
-
} from "./server-
|
|
278
|
+
} from "./server-58h6rrnx.js";
|
|
279
279
|
import {
|
|
280
280
|
FAIL_CLOSED_DOCTOR_COMMAND
|
|
281
281
|
} from "./server-468mya5v.js";
|
|
@@ -283,7 +283,7 @@ import {
|
|
|
283
283
|
getSessionNotes,
|
|
284
284
|
getReadySmartNotes,
|
|
285
285
|
insertPrimerCandidates
|
|
286
|
-
} from "./server-
|
|
286
|
+
} from "./server-t8n27rbt.js";
|
|
287
287
|
import {
|
|
288
288
|
pushNotification2
|
|
289
289
|
} from "./server-x8a7jmkh.js";
|
|
@@ -291,10 +291,10 @@ import {
|
|
|
291
291
|
deriveTriggerBudget2,
|
|
292
292
|
resolveHistorianProducerLimits2,
|
|
293
293
|
producerSourceLocalBudget2
|
|
294
|
-
} from "./server-
|
|
294
|
+
} from "./server-5kgesxck.js";
|
|
295
295
|
import {
|
|
296
296
|
sendStatusNotification2
|
|
297
|
-
} from "./server-
|
|
297
|
+
} from "./server-vqq3g1t7.js";
|
|
298
298
|
import {
|
|
299
299
|
retreatPastHostUnservedRows,
|
|
300
300
|
snapTerminalCompartmentToServedRow,
|
|
@@ -314,7 +314,7 @@ import {
|
|
|
314
314
|
import {
|
|
315
315
|
logSlowWriteTransaction,
|
|
316
316
|
WriteTransactionSteps
|
|
317
|
-
} from "./server-
|
|
317
|
+
} from "./server-np27dgyt.js";
|
|
318
318
|
|
|
319
319
|
// src/config/live-snapshot.ts
|
|
320
320
|
import { createHash } from "node:crypto";
|
|
@@ -2598,7 +2598,6 @@ function parseUserMemoryRow(row) {
|
|
|
2598
2598
|
};
|
|
2599
2599
|
}
|
|
2600
2600
|
// src/features/magic-context/dreamer/provider-output-failure.ts
|
|
2601
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2602
2601
|
import { createHash as createHash4 } from "node:crypto";
|
|
2603
2602
|
var MAX_NEAR_ZERO_OUTPUT_TOKENS = 32;
|
|
2604
2603
|
|
|
@@ -2606,52 +2605,18 @@ class DreamerProviderOutputFailureError extends Error {
|
|
|
2606
2605
|
fingerprint;
|
|
2607
2606
|
outputTokens;
|
|
2608
2607
|
reasoningTokens;
|
|
2609
|
-
quotaResetAt;
|
|
2610
2608
|
transient = true;
|
|
2611
|
-
constructor(fingerprint, outputTokens, reasoningTokens, responseText
|
|
2609
|
+
constructor(fingerprint, outputTokens, reasoningTokens, responseText) {
|
|
2612
2610
|
const preview = responseText.trim().replace(/\s+/g, " ").slice(0, 160);
|
|
2613
|
-
super(
|
|
2611
|
+
super(`dreamer provider-outage completion (output_tokens=${outputTokens}, reasoning_tokens=${reasoningTokens}): ${JSON.stringify(preview)}`);
|
|
2614
2612
|
this.fingerprint = fingerprint;
|
|
2615
2613
|
this.outputTokens = outputTokens;
|
|
2616
2614
|
this.reasoningTokens = reasoningTokens;
|
|
2617
|
-
this.quotaResetAt = quotaResetAt;
|
|
2618
2615
|
this.name = "DreamerProviderOutputFailureError";
|
|
2619
2616
|
}
|
|
2620
2617
|
}
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
return primaryQuotas.getStore() ? run() : primaryQuotas.run(new Map, run);
|
|
2624
|
-
}
|
|
2625
|
-
function rememberPrimaryQuota(model, error) {
|
|
2626
|
-
const quotas = primaryQuotas.getStore();
|
|
2627
|
-
if (!quotas || model === "primary" || !(error instanceof DreamerProviderOutputFailureError) || error.quotaResetAt === undefined || error.quotaResetAt <= Date.now())
|
|
2628
|
-
return null;
|
|
2629
|
-
const cached = new DreamerProviderOutputFailureError(error.fingerprint, error.outputTokens, error.reasoningTokens, "", error.quotaResetAt);
|
|
2630
|
-
cached.message = error.message;
|
|
2631
|
-
quotas.set(model, cached);
|
|
2632
|
-
return error;
|
|
2633
|
-
}
|
|
2634
|
-
function primaryQuotaFailure(model) {
|
|
2635
|
-
const quotas = primaryQuotas.getStore();
|
|
2636
|
-
const error = quotas?.get(model);
|
|
2637
|
-
if (!error)
|
|
2638
|
-
return null;
|
|
2639
|
-
if (error.quotaResetAt === undefined || error.quotaResetAt <= Date.now()) {
|
|
2640
|
-
quotas?.delete(model);
|
|
2641
|
-
return null;
|
|
2642
|
-
}
|
|
2643
|
-
const failure = new DreamerProviderOutputFailureError(error.fingerprint, error.outputTokens, error.reasoningTokens, "", error.quotaResetAt);
|
|
2644
|
-
failure.message = error.message;
|
|
2645
|
-
return failure;
|
|
2646
|
-
}
|
|
2647
|
-
function quotaResetAt(responseText, now) {
|
|
2648
|
-
const notice = /^All [1-9]\d* account\(s\) rate-limited for [\w.-]+\. Quota resets in ((?:\d+[hms] ?)+)\. Add more accounts with `opencode auth login` or wait and retry\.$/.exec(responseText.trim());
|
|
2649
|
-
if (!notice)
|
|
2650
|
-
return;
|
|
2651
|
-
const units = { h: 3600000, m: 60000, s: 1000 };
|
|
2652
|
-
const duration = [...notice[1].matchAll(/(\d+)([hms])/g)].reduce((sum, match) => sum + Number(match[1]) * units[match[2]], 0);
|
|
2653
|
-
const resetAt = now + duration;
|
|
2654
|
-
return duration > 0 && Number.isSafeInteger(resetAt) && resetAt < 8640000000000000 ? resetAt : undefined;
|
|
2618
|
+
function isAccountPoolQuotaNotice(responseText) {
|
|
2619
|
+
return /^All [1-9]\d* account\(s\) rate-limited for [\w.-]+\. Quota resets in (?:\d+[hms] ?)+\. Add more accounts with `opencode auth login` or wait and retry\.$/.test(responseText.trim());
|
|
2655
2620
|
}
|
|
2656
2621
|
function finiteTokenCount(value) {
|
|
2657
2622
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
|
|
@@ -2683,7 +2648,7 @@ function latestAssistantCompletion(messages) {
|
|
|
2683
2648
|
}
|
|
2684
2649
|
return latest;
|
|
2685
2650
|
}
|
|
2686
|
-
function providerOutputFailureFromInvalidManifest(messages, responseText
|
|
2651
|
+
function providerOutputFailureFromInvalidManifest(messages, responseText) {
|
|
2687
2652
|
const completion = latestAssistantCompletion(messages);
|
|
2688
2653
|
if (completion?.finish?.toLowerCase() !== "stop")
|
|
2689
2654
|
return null;
|
|
@@ -2693,11 +2658,10 @@ function providerOutputFailureFromInvalidManifest(messages, responseText, now =
|
|
|
2693
2658
|
const normalized = responseText.trim().replace(/\s+/g, " ").toLowerCase();
|
|
2694
2659
|
if (!normalized)
|
|
2695
2660
|
return null;
|
|
2696
|
-
|
|
2697
|
-
if (resetAt === undefined && completion.outputTokens > MAX_NEAR_ZERO_OUTPUT_TOKENS)
|
|
2661
|
+
if (!isAccountPoolQuotaNotice(responseText) && completion.outputTokens > MAX_NEAR_ZERO_OUTPUT_TOKENS)
|
|
2698
2662
|
return null;
|
|
2699
2663
|
const fingerprint = createHash4("sha256").update(normalized).digest("hex").slice(0, 16);
|
|
2700
|
-
return new DreamerProviderOutputFailureError(fingerprint, completion.outputTokens, completion.reasoningTokens, responseText
|
|
2664
|
+
return new DreamerProviderOutputFailureError(fingerprint, completion.outputTokens, completion.reasoningTokens, responseText);
|
|
2701
2665
|
}
|
|
2702
2666
|
|
|
2703
2667
|
// src/v2/hooks/hidden-child.ts
|
|
@@ -3252,6 +3216,94 @@ function toModelEntry(spec) {
|
|
|
3252
3216
|
return spec;
|
|
3253
3217
|
}
|
|
3254
3218
|
|
|
3219
|
+
// src/shared/hidden-model-cooldown.ts
|
|
3220
|
+
var MAX_SKIP_MS = 7 * 24 * 60 * 60 * 1000;
|
|
3221
|
+
var MIN_SKIP_MS = 60000;
|
|
3222
|
+
var RETRY_LATER_REASON = "provider said to retry later";
|
|
3223
|
+
|
|
3224
|
+
class HiddenModelCooldowns {
|
|
3225
|
+
now;
|
|
3226
|
+
entries = new Map;
|
|
3227
|
+
constructor(now = () => Date.now()) {
|
|
3228
|
+
this.now = now;
|
|
3229
|
+
}
|
|
3230
|
+
record(model, error) {
|
|
3231
|
+
if (!model?.includes("/"))
|
|
3232
|
+
return;
|
|
3233
|
+
const now = this.now();
|
|
3234
|
+
const delay = retryDelay(error, now);
|
|
3235
|
+
if (delay === undefined || !Number.isFinite(delay) || delay <= MIN_SKIP_MS)
|
|
3236
|
+
return;
|
|
3237
|
+
this.entries.set(model, {
|
|
3238
|
+
model,
|
|
3239
|
+
until: now + Math.min(delay, MAX_SKIP_MS),
|
|
3240
|
+
reason: RETRY_LATER_REASON
|
|
3241
|
+
});
|
|
3242
|
+
}
|
|
3243
|
+
succeeded(model) {
|
|
3244
|
+
if (model)
|
|
3245
|
+
this.entries.delete(model);
|
|
3246
|
+
}
|
|
3247
|
+
live() {
|
|
3248
|
+
const now = this.now();
|
|
3249
|
+
for (const [model, entry] of this.entries) {
|
|
3250
|
+
if (entry.until <= now)
|
|
3251
|
+
this.entries.delete(model);
|
|
3252
|
+
}
|
|
3253
|
+
return [...this.entries.values()];
|
|
3254
|
+
}
|
|
3255
|
+
startIndex(models, log) {
|
|
3256
|
+
const live = new Map(this.live().map((entry) => [entry.model, entry]));
|
|
3257
|
+
let start = models.findIndex((model) => !live.has(model));
|
|
3258
|
+
if (start < 0) {
|
|
3259
|
+
start = 0;
|
|
3260
|
+
for (let i = 1;i < models.length; i++) {
|
|
3261
|
+
if ((live.get(models[i])?.until ?? Infinity) < (live.get(models[start])?.until ?? Infinity))
|
|
3262
|
+
start = i;
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
const logged = new Set;
|
|
3266
|
+
for (const model of models.slice(0, start)) {
|
|
3267
|
+
const entry = live.get(model);
|
|
3268
|
+
if (entry && !logged.has(model)) {
|
|
3269
|
+
log(`skipping ${model} until ${new Date(entry.until).toISOString()}: provider said to retry later`);
|
|
3270
|
+
logged.add(model);
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
return start;
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
function retryDelay(error, now, depth = 0) {
|
|
3277
|
+
if (!isRecord(error) || depth > 4)
|
|
3278
|
+
return;
|
|
3279
|
+
const data = typeof error.statusCode === "number" || typeof error.status === "number" ? error : isRecord(error.data) ? error.data : error;
|
|
3280
|
+
const status = data.statusCode ?? data.status;
|
|
3281
|
+
if (status === 412 || status === 429 || status === 503) {
|
|
3282
|
+
if (typeof data.retryAfterMs === "number")
|
|
3283
|
+
return data.retryAfterMs;
|
|
3284
|
+
const headers = data.responseHeaders;
|
|
3285
|
+
if (isRecord(headers)) {
|
|
3286
|
+
const value = Object.entries(headers).find(([name]) => name.toLowerCase() === "retry-after")?.[1];
|
|
3287
|
+
if (typeof value === "string") {
|
|
3288
|
+
const text = value.trim();
|
|
3289
|
+
if (/^\d+$/.test(text))
|
|
3290
|
+
return Number(text) * 1000;
|
|
3291
|
+
if (/^(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} [A-Z][a-z]{2} \d{4} \d{2}:\d{2}:\d{2} GMT|(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), \d{2}-[A-Z][a-z]{2}-\d{2} \d{2}:\d{2}:\d{2} GMT|(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) [A-Z][a-z]{2} [ \d]\d \d{2}:\d{2}:\d{2} \d{4})$/.test(text))
|
|
3292
|
+
return Date.parse(text) - now;
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
return retryDelay(error.hostError ?? error.cause, now, depth + 1);
|
|
3297
|
+
}
|
|
3298
|
+
var hiddenModelCooldowns = new HiddenModelCooldowns;
|
|
3299
|
+
function selectHiddenModelStart(primary, fallbacks = [], note) {
|
|
3300
|
+
if (!primary)
|
|
3301
|
+
return { primary, fallbacks };
|
|
3302
|
+
const chain = [primary, ...fallbacks];
|
|
3303
|
+
const start = hiddenModelCooldowns.startIndex(chain.map((entry) => toModelEntry(entry)?.model ?? ""), note);
|
|
3304
|
+
return { primary: chain[start], fallbacks: chain.slice(start + 1) };
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3255
3307
|
// src/shared/model-suggestion-retry.ts
|
|
3256
3308
|
var ABORT_CALL_TIMEOUT_MS = 3000;
|
|
3257
3309
|
function copyPromptArgs(args, body) {
|
|
@@ -3490,14 +3542,11 @@ function throwWithPromptFailure(legacyError, failedAttempts, args, timeoutMs, tr
|
|
|
3490
3542
|
const error = legacyError instanceof Error ? legacyError : new Error(extractMessage(legacyError));
|
|
3491
3543
|
const last = failedAttempts.at(-1);
|
|
3492
3544
|
const failureClass = last?.failureClass ?? "unknown";
|
|
3493
|
-
const
|
|
3494
|
-
if (quota && error !== quota && !error.message.includes(quota.message))
|
|
3495
|
-
error.message = `${quota.message}; ${error.message}`;
|
|
3496
|
-
const providerError = failureClass === "provider_error" || quota ? sanitizeDiagnosticText(`${quota ? `${quota.message}; ` : ""}${shortErr(last?.error ?? legacyError)}`).slice(0, 500) : null;
|
|
3545
|
+
const providerError = failureClass === "provider_error" ? sanitizeDiagnosticText(shortErr(last?.error ?? legacyError)).slice(0, 500) : null;
|
|
3497
3546
|
promptFailureDetails.set(error, {
|
|
3498
3547
|
failureClass,
|
|
3499
3548
|
modelAttempted: last?.attempt.label ?? null,
|
|
3500
|
-
modelsTried: failedAttempts.
|
|
3549
|
+
modelsTried: failedAttempts.map((failure) => failure.attempt.label),
|
|
3501
3550
|
providerError,
|
|
3502
3551
|
timeoutMs: failureClass === "provider_timeout" ? timeoutMs : null,
|
|
3503
3552
|
childSessionId: transport ? transport.childSessionId ?? null : args.path.id || null,
|
|
@@ -3514,6 +3563,8 @@ async function attemptOnce(client, args, timeoutMs, signal, callContext, label,
|
|
|
3514
3563
|
await promptWithTimeout(client, attemptArgs, timeoutMs, signal, transport, firstOutputTimeoutMs);
|
|
3515
3564
|
return;
|
|
3516
3565
|
} catch (error) {
|
|
3566
|
+
if (!signal?.aborted && !isPromptTimeoutError(error))
|
|
3567
|
+
hiddenModelCooldowns.record(label, error);
|
|
3517
3568
|
if (isNonRetryable(error, signal) || !allowModelSuggestions)
|
|
3518
3569
|
throw error;
|
|
3519
3570
|
const suggestion = parseModelSuggestion(error);
|
|
@@ -3554,7 +3605,19 @@ function createChainClock(options, timeoutMs) {
|
|
|
3554
3605
|
}
|
|
3555
3606
|
};
|
|
3556
3607
|
}
|
|
3608
|
+
function cooldownStart(args, options) {
|
|
3609
|
+
const model = args.body.model;
|
|
3610
|
+
if (!model)
|
|
3611
|
+
return { args, options };
|
|
3612
|
+
const selected = selectHiddenModelStart({ model: `${model.providerID}/${model.modelID}`, qualifier: args.body.variant }, options.fallbackModels, log2);
|
|
3613
|
+
const { variant: _variant, ...body } = args.body;
|
|
3614
|
+
return {
|
|
3615
|
+
args: copyPromptArgs(args, { ...body, ...modelBodyField(selected.primary) }),
|
|
3616
|
+
options: { ...options, fallbackModels: selected.fallbacks }
|
|
3617
|
+
};
|
|
3618
|
+
}
|
|
3557
3619
|
async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
3620
|
+
({ args, options } = cooldownStart(args, options));
|
|
3558
3621
|
const timeoutMs = options.timeoutMs ?? 300000;
|
|
3559
3622
|
const callContext = options.callContext ?? "subagent";
|
|
3560
3623
|
const fallbacks = options.fallbackModels ?? [];
|
|
@@ -3626,6 +3689,8 @@ async function attemptAndValidate(client, args, timeoutMs, signal, callContext,
|
|
|
3626
3689
|
try {
|
|
3627
3690
|
output = await raceWithSignal(options.fetchOutput(args, attempt), options.signal);
|
|
3628
3691
|
} catch (error) {
|
|
3692
|
+
if (!signal?.aborted && !isPromptTimeoutError(error))
|
|
3693
|
+
hiddenModelCooldowns.record(attempt.label, error);
|
|
3629
3694
|
throw {
|
|
3630
3695
|
error,
|
|
3631
3696
|
failureClass: classifyPromptFailure(error, "output", signal),
|
|
@@ -3637,7 +3702,7 @@ async function attemptAndValidate(client, args, timeoutMs, signal, callContext,
|
|
|
3637
3702
|
const text = extractLatestAssistantText(messages);
|
|
3638
3703
|
if (text) {
|
|
3639
3704
|
const failure = providerOutputFailureFromInvalidManifest(messages, text);
|
|
3640
|
-
if (failure
|
|
3705
|
+
if (failure && isAccountPoolQuotaNotice(text))
|
|
3641
3706
|
throw failure;
|
|
3642
3707
|
}
|
|
3643
3708
|
if (!extractLatestAssistantText(output)) {
|
|
@@ -3646,11 +3711,14 @@ async function attemptAndValidate(client, args, timeoutMs, signal, callContext,
|
|
|
3646
3711
|
const error = new Error(`Host recorded assistant error: ${describeAssistantError(assistantFailure.error)}`);
|
|
3647
3712
|
Object.assign(error, {
|
|
3648
3713
|
name: "DreamerProviderOutputFailureError",
|
|
3649
|
-
transient: true
|
|
3714
|
+
transient: true,
|
|
3715
|
+
hostError: assistantFailure.error
|
|
3650
3716
|
});
|
|
3717
|
+
hiddenModelCooldowns.record(attempt.label, assistantFailure.error);
|
|
3651
3718
|
throw error;
|
|
3652
3719
|
}
|
|
3653
3720
|
}
|
|
3721
|
+
hiddenModelCooldowns.succeeded(attempt.label);
|
|
3654
3722
|
const validated = await options.validateOutput(output, attempt);
|
|
3655
3723
|
return { output, validated, attempt };
|
|
3656
3724
|
} catch (error) {
|
|
@@ -3665,6 +3733,7 @@ async function attemptAndValidate(client, args, timeoutMs, signal, callContext,
|
|
|
3665
3733
|
}
|
|
3666
3734
|
}
|
|
3667
3735
|
async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
3736
|
+
({ args, options } = cooldownStart(args, options));
|
|
3668
3737
|
const timeoutMs = options.timeoutMs ?? 300000;
|
|
3669
3738
|
const callContext = options.callContext ?? "subagent";
|
|
3670
3739
|
const fallbacks = options.fallbackModels ?? [];
|
|
@@ -3675,23 +3744,9 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
3675
3744
|
const failedAttempts = [];
|
|
3676
3745
|
let firstError = null;
|
|
3677
3746
|
let lastError = null;
|
|
3678
|
-
const cooledPrimary = primaryQuotaFailure(explicitPrimaryLabel);
|
|
3679
3747
|
const clock = createChainClock(options, timeoutMs);
|
|
3680
3748
|
const primaryStartedAt = Date.now();
|
|
3681
3749
|
try {
|
|
3682
|
-
if (cooledPrimary)
|
|
3683
|
-
throw {
|
|
3684
|
-
error: cooledPrimary,
|
|
3685
|
-
failureClass: "provider_error",
|
|
3686
|
-
attempt: {
|
|
3687
|
-
label: explicitPrimaryLabel,
|
|
3688
|
-
attemptIndex: 0,
|
|
3689
|
-
isFallback: false,
|
|
3690
|
-
totalAttempts,
|
|
3691
|
-
model: baseBody.model,
|
|
3692
|
-
skipped: true
|
|
3693
|
-
}
|
|
3694
|
-
};
|
|
3695
3750
|
const budget = clock.budget(0);
|
|
3696
3751
|
return await attemptAndValidate(client, baseArgs, budget.timeoutMs, options.signal, callContext, {
|
|
3697
3752
|
label: explicitPrimaryLabel,
|
|
@@ -3706,19 +3761,13 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
3706
3761
|
clock.settle(failure.error, primaryStartedAt);
|
|
3707
3762
|
firstError = failure.error;
|
|
3708
3763
|
lastError = failure.error;
|
|
3709
|
-
if (failure.error instanceof DreamerProviderOutputFailureError && failure.error.quotaResetAt !== undefined)
|
|
3710
|
-
failure.error.message = failure.error.message.replace(/^provider quota exhausted/, "primary quota exhausted");
|
|
3711
|
-
const quota = !cooledPrimary && rememberPrimaryQuota(explicitPrimaryLabel, failure.error);
|
|
3712
|
-
if (quota)
|
|
3713
|
-
log2(`[${callContext}] ${quota.message}; skipping ${explicitPrimaryLabel} for this run until reset`);
|
|
3714
3764
|
if (isNonRetryable(failure.error, options.signal)) {
|
|
3715
3765
|
throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs, options.transport);
|
|
3716
3766
|
}
|
|
3717
3767
|
if (fallbacks.length === 0) {
|
|
3718
3768
|
throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs, options.transport);
|
|
3719
3769
|
}
|
|
3720
|
-
|
|
3721
|
-
log2(`[${callContext}] primary (${explicitPrimaryLabel}) failed validation/prompt: ${shortErr(failure.error)}; ${fallbacks.length} fallback(s) configured, subject to remaining budget`);
|
|
3770
|
+
log2(`[${callContext}] primary (${explicitPrimaryLabel}) failed validation/prompt: ${shortErr(failure.error)}; ${fallbacks.length} fallback(s) configured, subject to remaining budget`);
|
|
3722
3771
|
}
|
|
3723
3772
|
for (let i = 0;i < fallbacks.length; i += 1) {
|
|
3724
3773
|
const fallback = toModelEntry(fallbacks[i]);
|
|
@@ -12476,7 +12525,7 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
|
12476
12525
|
preferResponseOnMissingData: true
|
|
12477
12526
|
});
|
|
12478
12527
|
const assistantFailure = extractLatestAssistantFailure(messages);
|
|
12479
|
-
const hostError = hostErrors.get(handle.id);
|
|
12528
|
+
const hostError = assistantFailure?.error ?? hostErrors.get(handle.id);
|
|
12480
12529
|
if (assistantFailure || hostError !== undefined) {
|
|
12481
12530
|
const finish = assistantFailure?.finish ? ` (finish=${assistantFailure.finish})` : "";
|
|
12482
12531
|
const error = new Error(`Historian host recorded an assistant error${finish}: ${describeAssistantFailure(assistantFailure?.error ?? hostError)}`, hostError === undefined ? undefined : { cause: hostError });
|
|
@@ -12525,6 +12574,8 @@ function historianReasoningBudgetDiagnostic(outputTokens, tokens) {
|
|
|
12525
12574
|
return `historian ran out of output budget while reasoning (length-capped at ${outputTokens} tokens, no text${tokens ? `; ${formatRunTokenLog(tokens)}` : ""}) — set historian.maxTokens or route historian.model to a low-reasoning lane/variant`;
|
|
12526
12575
|
}
|
|
12527
12576
|
async function runValidatedHistorianPass(args) {
|
|
12577
|
+
const selected = selectHiddenModelStart(args.model, args.fallbackModels, (message) => sessionLog2(args.parentSessionId, message));
|
|
12578
|
+
args = { ...args, model: selected.primary, fallbackModels: selected.fallbacks };
|
|
12528
12579
|
const firstRun = await runHistorianPrompt({
|
|
12529
12580
|
...args,
|
|
12530
12581
|
dumpLabel: `${args.dumpLabelBase}-initial`,
|
|
@@ -12783,6 +12834,7 @@ async function runHistorianPrompt(args) {
|
|
|
12783
12834
|
}
|
|
12784
12835
|
}
|
|
12785
12836
|
completion = await executor.collect(handle, 50);
|
|
12837
|
+
hiddenModelCooldowns.succeeded(handle.attemptedModel ?? toModelEntry(modelOverride)?.model);
|
|
12786
12838
|
const lengthCapped = completion.lengthCapped;
|
|
12787
12839
|
const tokens = {
|
|
12788
12840
|
...runTokenLog(undefined, args.maxOutputTokens),
|
|
@@ -12819,6 +12871,7 @@ async function runHistorianPrompt(args) {
|
|
|
12819
12871
|
const dumpPath = dumpHistorianResponse(parentSessionId, sessionDirectory, dumpLabel ?? "historian-response", result);
|
|
12820
12872
|
return { ok: true, result, dumpPath, invocationId: invocationId ?? undefined };
|
|
12821
12873
|
} catch (modelError) {
|
|
12874
|
+
hiddenModelCooldowns.record(handle?.attemptedModel ?? toModelEntry(modelOverride)?.model, modelError);
|
|
12822
12875
|
const desc = describeError(modelError);
|
|
12823
12876
|
sessionLog2(parentSessionId, `historian prompt failed: ${desc.brief} promptLength=${prompt.length}${desc.stackHead ? ` stackHead="${desc.stackHead}"` : ""}`);
|
|
12824
12877
|
recordInvocation({
|
|
@@ -13418,10 +13471,6 @@ var FORCE80_MAX_CAP = 500000;
|
|
|
13418
13471
|
var FORCE95_MAX_CAP = 750000;
|
|
13419
13472
|
var NORMAL_HYSTERESIS_TOKENS = 256;
|
|
13420
13473
|
var RECOVERY_NO_HEAD_LIMIT = 2;
|
|
13421
|
-
var MIN_FORCE_ELIGIBLE_TOKENS_CAP = 1000;
|
|
13422
|
-
function deriveMinForceEligibleTokens(scaledN) {
|
|
13423
|
-
return Math.min(MIN_FORCE_ELIGIBLE_TOKENS_CAP, Math.max(1, Math.floor(scaledN / 8)));
|
|
13424
|
-
}
|
|
13425
13474
|
function clampPercentage(value) {
|
|
13426
13475
|
if (!Number.isFinite(value))
|
|
13427
13476
|
return 0;
|
|
@@ -13666,6 +13715,7 @@ function resolveProtectedTailBoundary(ctx) {
|
|
|
13666
13715
|
priorBoundaryOrdinal: ctx.priorBoundaryOrdinal,
|
|
13667
13716
|
migrationFloorActive: ctx.migrationFloorActive,
|
|
13668
13717
|
emergencyTailScale: ctx.emergencyTailScale,
|
|
13718
|
+
recovery: ctx.recovery,
|
|
13669
13719
|
providerShapeVersion: ctx.providerShapeVersion,
|
|
13670
13720
|
cacheNamespace: ctx.cacheNamespace,
|
|
13671
13721
|
createdAt,
|
|
@@ -13710,6 +13760,7 @@ function resolveProtectedTailBoundary(ctx) {
|
|
|
13710
13760
|
priorBoundaryOrdinal: ctx.priorBoundaryOrdinal,
|
|
13711
13761
|
migrationFloorActive: false,
|
|
13712
13762
|
emergencyTailScale: ctx.emergencyTailScale,
|
|
13763
|
+
recovery: ctx.recovery,
|
|
13713
13764
|
providerShapeVersion: ctx.providerShapeVersion,
|
|
13714
13765
|
cacheNamespace: ctx.cacheNamespace,
|
|
13715
13766
|
createdAt,
|
|
@@ -13825,6 +13876,7 @@ function resolveProtectedTailBoundary(ctx) {
|
|
|
13825
13876
|
priorBoundaryOrdinal: ctx.priorBoundaryOrdinal,
|
|
13826
13877
|
migrationFloorActive: ctx.migrationFloorActive,
|
|
13827
13878
|
emergencyTailScale: ctx.emergencyTailScale,
|
|
13879
|
+
recovery: ctx.recovery,
|
|
13828
13880
|
liftLivePromptFloor: ctx.liftLivePromptFloor === true ? true : undefined,
|
|
13829
13881
|
providerShapeVersion: ctx.providerShapeVersion,
|
|
13830
13882
|
cacheNamespace: ctx.cacheNamespace,
|
|
@@ -13903,6 +13955,7 @@ function resolveBoundaryContext(args) {
|
|
|
13903
13955
|
protectedTailPolicyVersion: meta.protectedTailPolicyVersion,
|
|
13904
13956
|
migrationFloorActive,
|
|
13905
13957
|
emergencyTailScale: args.emergencyTailScale,
|
|
13958
|
+
recovery: args.recovery,
|
|
13906
13959
|
liftLivePromptFloor: args.liftLivePromptFloor,
|
|
13907
13960
|
providerShapeVersion: args.providerShapeVersion ?? "opencode-v1",
|
|
13908
13961
|
cacheNamespace: args.cacheNamespace ?? `opencode:${args.sessionId}`,
|
|
@@ -14083,9 +14136,11 @@ function hasRunnableCompartmentWindow(snapshot) {
|
|
|
14083
14136
|
return false;
|
|
14084
14137
|
if (snapshot.eligibleEndOrdinal <= snapshot.offset)
|
|
14085
14138
|
return false;
|
|
14139
|
+
if (snapshot.recovery || snapshot.usagePercentage >= 95 || snapshot.mode === "manual-wrapup" || snapshot.mode === "manual-full-recomp")
|
|
14140
|
+
return true;
|
|
14086
14141
|
const forceMaterializationPercentage = escalationBands(snapshot.executeThresholdPercentage).forceMaterializationPercentage;
|
|
14087
14142
|
if (snapshot.usagePercentage >= forceMaterializationPercentage || snapshot.emergencyTailScale) {
|
|
14088
|
-
return snapshot.
|
|
14143
|
+
return snapshot.summaryRemovedEligibleTokens >= snapshot.contextLimit * 0.02;
|
|
14089
14144
|
}
|
|
14090
14145
|
return snapshot.eligibleEndOrdinal > snapshot.offset;
|
|
14091
14146
|
}
|
|
@@ -14547,7 +14602,7 @@ async function runCompartmentAgent(deps) {
|
|
|
14547
14602
|
return;
|
|
14548
14603
|
}
|
|
14549
14604
|
if (!validation.ok && validation.reason === "stale_snapshot") {
|
|
14550
|
-
const
|
|
14605
|
+
const refreshedBoundary = deps.refreshBoundarySnapshot ? deps.refreshBoundarySnapshot(boundarySnapshot, validation) : resolveOpenCodeProtectedTailBoundary({
|
|
14551
14606
|
db,
|
|
14552
14607
|
sessionId,
|
|
14553
14608
|
mode: "incremental-runner",
|
|
@@ -14561,6 +14616,10 @@ async function runCompartmentAgent(deps) {
|
|
|
14561
14616
|
emergencyTailScale: boundarySnapshot.emergencyTailScale,
|
|
14562
14617
|
liftLivePromptFloor: boundarySnapshot.liftLivePromptFloor === true
|
|
14563
14618
|
});
|
|
14619
|
+
const refreshed = refreshedBoundary ? {
|
|
14620
|
+
...refreshedBoundary,
|
|
14621
|
+
recovery: boundarySnapshot.recovery || deps.forceDrainQuota
|
|
14622
|
+
} : null;
|
|
14564
14623
|
if (refreshed && hasRunnableCompartmentWindow(refreshed)) {
|
|
14565
14624
|
sessionLog2(sessionId, `historian: refreshed stale protected-tail snapshot at run time (was: ${validation.detail ?? "stale"}) — eligible head ${refreshed.offset}-${refreshed.eligibleEndOrdinal - 1}`);
|
|
14566
14625
|
boundarySnapshot = refreshed;
|
|
@@ -16178,4 +16237,4 @@ ${failure}`;
|
|
|
16178
16237
|
}
|
|
16179
16238
|
}
|
|
16180
16239
|
|
|
16181
|
-
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError,
|
|
16240
|
+
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, hiddenModelCooldowns, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, emptyTokenTotals, sumTokensFromChildMessages, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, stripMemoryMuralBlock, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, headMessagesForSizing, rawTailAfterNewestCompartment, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
|
|
@@ -139,9 +139,9 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
139
139
|
import("./sqlite-zdgm52sv.js"),
|
|
140
140
|
import("./store-reader-yaxtdy6f.js"),
|
|
141
141
|
import("./store-skkhh3rd.js"),
|
|
142
|
-
import("./read-session-chunk-
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
142
|
+
import("./read-session-chunk-hzhxvhyv.js"),
|
|
143
|
+
import("./render-rhaevxv1.js"),
|
|
144
|
+
import("./search-archive-9924fyk8.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -6880,6 +6880,7 @@ var BaseEmbeddingConfigSchema = object({
|
|
|
6880
6880
|
query_instruction: union([string(), literal(false)]).optional().describe("OpenAI-compatible query prefix override. A string is prepended verbatim to search queries; false disables the built-in model-family instruction. Qwen3-Embedding, gte-Qwen instruct, e5 instruct, and Nomic families have built-in recipes. Query-only changes do not re-embed stored content. User-level only; project values are ignored."),
|
|
6881
6881
|
document_prefix: string().optional().describe("OpenAI-compatible stored-document prefix override, prepended verbatim. Defaults to the model-family recipe (empty for Qwen3/gte/e5 instruct; 'search_document: ' for Nomic). Changing it changes stored vectors and triggers re-embedding. User-level only; project values are ignored."),
|
|
6882
6882
|
truncate: string().optional().describe("Optional truncate mode sent in the embedding request body (e.g. NVIDIA NIM accepts 'NONE' | 'START' | 'END'). Omitted from the request when unset."),
|
|
6883
|
+
dimensions: number().int().min(1).max(8192).optional().describe("Optional output width for Matryoshka embedding models (e.g. Qwen3-Embedding-8B accepts 768 | 1024 | 2048 | 4096; OpenAI text-embedding-3-* accept smaller widths than native). Sent as the OpenAI-compatible `dimensions` request field. Omitted from the request when unset, so the endpoint default applies. Changing it changes the produced vectors and folds into the embedding model identity, so switching widths re-embeds rather than mixing vector spaces. Not supported for the local provider, and ignored from project config like the other embedding fields (a repository cannot choose how private text is embedded)."),
|
|
6883
6884
|
max_input_tokens: number().int().positive().optional().describe("Optional maximum input tokens for chunk embeddings. Defaults conservatively to 512 when omitted."),
|
|
6884
6885
|
local_runtime: _enum(["auto", "native", "wasm"]).default("auto").describe("Local provider only: ONNX runtime selection. 'auto' uses native under Node and uses WASM under Bun versions before 1.4.0, where Bun's NAPI teardown race can panic on quit; native is restored automatically on Bun 1.4.0+. Inference runs in a dedicated worker after disabling POSIX telemetry in the native process environment. Compiled Bun hosts and hosts without a verified in-process opt-out use a subprocess instead. Windows native ONNX emits OS-controlled ETW diagnostics, not direct uploads. On Bun before 1.4.0, even explicit 'native' uses WASM because native worker teardown can crash the process. Set 'wasm' to avoid loading the native addon on newer hosts too."),
|
|
6885
6886
|
local_dtype: _enum([
|
|
@@ -6928,6 +6929,7 @@ var EmbeddingConfigSchema = BaseEmbeddingConfigSchema.transform((data) => {
|
|
|
6928
6929
|
...model ? { model } : {},
|
|
6929
6930
|
...endpoint ? { endpoint } : {},
|
|
6930
6931
|
...apiKey ? { api_key: apiKey } : {},
|
|
6932
|
+
...data.dimensions ? { dimensions: data.dimensions } : {},
|
|
6931
6933
|
...inputType ? { input_type: inputType } : {},
|
|
6932
6934
|
...queryInputType ? { query_input_type: queryInputType } : {},
|
|
6933
6935
|
...data.query_instruction !== undefined ? { query_instruction: data.query_instruction } : {},
|
|
@@ -6954,6 +6956,7 @@ var EmbeddingConfigSchema = BaseEmbeddingConfigSchema.transform((data) => {
|
|
|
6954
6956
|
provider: "openai-compatible",
|
|
6955
6957
|
model: data.model?.trim() ?? "",
|
|
6956
6958
|
endpoint: data.endpoint?.trim() ?? "",
|
|
6959
|
+
...data.dimensions ? { dimensions: data.dimensions } : {},
|
|
6957
6960
|
...apiKey ? { api_key: apiKey } : {},
|
|
6958
6961
|
...inputType ? { input_type: inputType } : {},
|
|
6959
6962
|
...queryInputType ? { query_input_type: queryInputType } : {},
|