@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
|
@@ -72,22 +72,20 @@ import {
|
|
|
72
72
|
getRawSessionTagKeysThrough2,
|
|
73
73
|
getLegacyProtectedTailStartOrdinal2,
|
|
74
74
|
readSessionChunk2
|
|
75
|
-
} from "./index-
|
|
75
|
+
} from "./index-07rp6xcn.js";
|
|
76
76
|
import {
|
|
77
77
|
getHarness2,
|
|
78
78
|
harnessOwnsOpenCodeStore2
|
|
79
79
|
} from "./index-pavzsdc6.js";
|
|
80
80
|
import {
|
|
81
81
|
ensureCortexKitArtifactGitignore,
|
|
82
|
-
getProjectMagicContextHistorianDir
|
|
83
|
-
|
|
82
|
+
getProjectMagicContextHistorianDir,
|
|
83
|
+
log2,
|
|
84
|
+
sessionLog2
|
|
85
|
+
} from "./index-82dfe8en.js";
|
|
84
86
|
import {
|
|
85
87
|
sanitizeDiagnosticText
|
|
86
88
|
} from "./index-z4p0ry94.js";
|
|
87
|
-
import {
|
|
88
|
-
log2,
|
|
89
|
-
sessionLog2
|
|
90
|
-
} from "./index-jrfre9ah.js";
|
|
91
89
|
import {
|
|
92
90
|
createScanner,
|
|
93
91
|
parseTree,
|
|
@@ -110,7 +108,7 @@ import {
|
|
|
110
108
|
deriveTriggerBudget2,
|
|
111
109
|
resolveHistorianProducerLimits2,
|
|
112
110
|
producerSourceLocalBudget2
|
|
113
|
-
} from "./index-
|
|
111
|
+
} from "./index-gapnh6tk.js";
|
|
114
112
|
import {
|
|
115
113
|
withContentLanguageDirective,
|
|
116
114
|
buildPrimaryLanguageDirective,
|
|
@@ -123,7 +121,7 @@ import {
|
|
|
123
121
|
ConfigProfilesSchema,
|
|
124
122
|
MagicContextConfigSchema,
|
|
125
123
|
LIVE_RELOAD_CONFIG_PATHS
|
|
126
|
-
} from "./index-
|
|
124
|
+
} from "./index-jjy5a5w0.js";
|
|
127
125
|
import {
|
|
128
126
|
providerMass,
|
|
129
127
|
calibrationForModelKey,
|
|
@@ -133,7 +131,7 @@ import {
|
|
|
133
131
|
hasMeaningfulUserText2,
|
|
134
132
|
estimateTokens,
|
|
135
133
|
estimateFixedPromptTokens
|
|
136
|
-
} from "./index-
|
|
134
|
+
} from "./index-0tz2fzpq.js";
|
|
137
135
|
import {
|
|
138
136
|
FAIL_CLOSED_DOCTOR_COMMAND
|
|
139
137
|
} from "./index-wh9fxds5.js";
|
|
@@ -147,13 +145,13 @@ import {
|
|
|
147
145
|
import {
|
|
148
146
|
shouldSkipHomeProjectMemory,
|
|
149
147
|
resolveProjectIdentity
|
|
150
|
-
} from "./index-
|
|
148
|
+
} from "./index-0k283v27.js";
|
|
151
149
|
import {
|
|
152
150
|
getSchemaFenceRejection,
|
|
153
151
|
LATEST_SUPPORTED_VERSION,
|
|
154
152
|
getPersistedSchemaVersion,
|
|
155
153
|
openDatabase
|
|
156
|
-
} from "./index-
|
|
154
|
+
} from "./index-z4832qfe.js";
|
|
157
155
|
import {
|
|
158
156
|
areRustHistorianSyntheticParts2,
|
|
159
157
|
isStrictGapHealingMessage2,
|
|
@@ -161,7 +159,7 @@ import {
|
|
|
161
159
|
RawOrdinalsNotReady2,
|
|
162
160
|
dropRawSessionOrdinalCheckpoints2,
|
|
163
161
|
runSessionWarmupWorker
|
|
164
|
-
} from "./index-
|
|
162
|
+
} from "./index-36wseasx.js";
|
|
165
163
|
import {
|
|
166
164
|
parseCompartmentOutput,
|
|
167
165
|
resolveWorkspaceShareCategories,
|
|
@@ -170,7 +168,7 @@ import {
|
|
|
170
168
|
resolveStoredPathWorkspaceIdentity,
|
|
171
169
|
sourceNameForMemory,
|
|
172
170
|
computeWorkspaceEpochFingerprint
|
|
173
|
-
} from "./index-
|
|
171
|
+
} from "./index-pb8ysnq2.js";
|
|
174
172
|
import {
|
|
175
173
|
V2_MEMORY_CATEGORIES,
|
|
176
174
|
CATEGORY_PRIORITY,
|
|
@@ -184,7 +182,7 @@ import {
|
|
|
184
182
|
} from "./index-58e3y90n.js";
|
|
185
183
|
import {
|
|
186
184
|
BoundedSessionMap
|
|
187
|
-
} from "./index-
|
|
185
|
+
} from "./index-hsv31e69.js";
|
|
188
186
|
import {
|
|
189
187
|
invalidateAutoEmbedSession
|
|
190
188
|
} from "./index-2amn2s73.js";
|
|
@@ -197,7 +195,7 @@ import {
|
|
|
197
195
|
replaceCompartmentChunkEmbeddings2,
|
|
198
196
|
deleteChunkEmbedBackoffForSession2,
|
|
199
197
|
chunkWindowSourceKey2
|
|
200
|
-
} from "./index-
|
|
198
|
+
} from "./index-hexdee98.js";
|
|
201
199
|
import {
|
|
202
200
|
COMPARTMENT_LEASE_RENEWAL_MS,
|
|
203
201
|
getCompartmentLeaseBlocker,
|
|
@@ -239,14 +237,14 @@ import {
|
|
|
239
237
|
getProjectState,
|
|
240
238
|
recordSubagentInvocation,
|
|
241
239
|
getLatestHistorianInvocationId
|
|
242
|
-
} from "./index-
|
|
240
|
+
} from "./index-n0twfvah.js";
|
|
243
241
|
import {
|
|
244
242
|
clearCompressionDepth,
|
|
245
243
|
clearCompressionDepthRange,
|
|
246
244
|
toMessageIndexSource,
|
|
247
245
|
clearIndexedMessagesInTransaction,
|
|
248
246
|
indexSourcesAfterOrdinal
|
|
249
|
-
} from "./index-
|
|
247
|
+
} from "./index-hkveze74.js";
|
|
250
248
|
import {
|
|
251
249
|
stripWellFormedLeadingTagPrefix,
|
|
252
250
|
peelLeadingMcTagNotation,
|
|
@@ -257,17 +255,17 @@ import {
|
|
|
257
255
|
foldShrunkPartTags2,
|
|
258
256
|
getTagNumberByMessageId2,
|
|
259
257
|
getActiveTagsBySession2
|
|
260
|
-
} from "./index-
|
|
258
|
+
} from "./index-bkg4hdyh.js";
|
|
261
259
|
import {
|
|
262
260
|
openCodeDbExists,
|
|
263
261
|
withReadOnlySessionDb,
|
|
264
262
|
getMessageTimesFromOpenCodeDb
|
|
265
|
-
} from "./index-
|
|
263
|
+
} from "./index-em92bp7f.js";
|
|
266
264
|
import {
|
|
267
265
|
getSessionNotes,
|
|
268
266
|
getReadySmartNotes,
|
|
269
267
|
insertPrimerCandidates
|
|
270
|
-
} from "./index-
|
|
268
|
+
} from "./index-25tm250q.js";
|
|
271
269
|
import {
|
|
272
270
|
pushNotification2
|
|
273
271
|
} from "./index-x8a7jmkh.js";
|
|
@@ -285,13 +283,13 @@ import {
|
|
|
285
283
|
getProjectChunkEmbeddingModelId2,
|
|
286
284
|
getProjectEmbeddingMaxInputTokens2,
|
|
287
285
|
embedItemsForProject2
|
|
288
|
-
} from "./index-
|
|
286
|
+
} from "./index-bamnjp2t.js";
|
|
289
287
|
import {
|
|
290
288
|
renderUserFacingFailure,
|
|
291
289
|
userFacingFailureCode,
|
|
292
290
|
promoteSessionFactsDurable,
|
|
293
291
|
embedPromotedFacts
|
|
294
|
-
} from "./index-
|
|
292
|
+
} from "./index-cwj6qhmf.js";
|
|
295
293
|
import {
|
|
296
294
|
isMarkerCandidateBasisCurrent2,
|
|
297
295
|
invalidateMarkerCandidateBasis2,
|
|
@@ -302,10 +300,10 @@ import {
|
|
|
302
300
|
certifiedMarkerReferenceFloor2,
|
|
303
301
|
readMarkerReferenceRows2,
|
|
304
302
|
readKnownMarkerReferenceRows2
|
|
305
|
-
} from "./index-
|
|
303
|
+
} from "./index-90z05d0p.js";
|
|
306
304
|
import {
|
|
307
305
|
sendStatusNotification2
|
|
308
|
-
} from "./index-
|
|
306
|
+
} from "./index-r9agn061.js";
|
|
309
307
|
import {
|
|
310
308
|
isCompactionEnabled,
|
|
311
309
|
migrateLegacyAgentEnabledInMemory
|
|
@@ -329,7 +327,7 @@ import {
|
|
|
329
327
|
import {
|
|
330
328
|
logSlowWriteTransaction,
|
|
331
329
|
WriteTransactionSteps
|
|
332
|
-
} from "./index-
|
|
330
|
+
} from "./index-tad3can2.js";
|
|
333
331
|
import {
|
|
334
332
|
ensureStorageDirectorySync,
|
|
335
333
|
writeStorageFileAtomicSync
|
|
@@ -1515,7 +1513,8 @@ var EMBEDDING_USER_ONLY_FIELDS = [
|
|
|
1515
1513
|
"provider",
|
|
1516
1514
|
"fallback_provider",
|
|
1517
1515
|
"query_instruction",
|
|
1518
|
-
"document_prefix"
|
|
1516
|
+
"document_prefix",
|
|
1517
|
+
"dimensions"
|
|
1519
1518
|
];
|
|
1520
1519
|
var PERCENTAGE_THRESHOLD_REASON = "security: a repository may only raise compaction thresholds above the user's effective value; it cannot force earlier historian work or cloned-repo cost escalation.";
|
|
1521
1520
|
var TOKEN_THRESHOLD_REASON = "security: a repository may only raise execute_threshold_tokens above the user's trusted token threshold; it cannot force earlier historian work or cloned-repo cost escalation.";
|
|
@@ -4577,7 +4576,6 @@ class HiddenCompletionRefusal extends Error {
|
|
|
4577
4576
|
}
|
|
4578
4577
|
}
|
|
4579
4578
|
// src/features/magic-context/dreamer/provider-output-failure.ts
|
|
4580
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4581
4579
|
import { createHash as createHash2 } from "node:crypto";
|
|
4582
4580
|
var MAX_NEAR_ZERO_OUTPUT_TOKENS = 32;
|
|
4583
4581
|
|
|
@@ -4585,52 +4583,18 @@ class DreamerProviderOutputFailureError extends Error {
|
|
|
4585
4583
|
fingerprint;
|
|
4586
4584
|
outputTokens;
|
|
4587
4585
|
reasoningTokens;
|
|
4588
|
-
quotaResetAt;
|
|
4589
4586
|
transient = true;
|
|
4590
|
-
constructor(fingerprint, outputTokens, reasoningTokens, responseText
|
|
4587
|
+
constructor(fingerprint, outputTokens, reasoningTokens, responseText) {
|
|
4591
4588
|
const preview = responseText.trim().replace(/\s+/g, " ").slice(0, 160);
|
|
4592
|
-
super(
|
|
4589
|
+
super(`dreamer provider-outage completion (output_tokens=${outputTokens}, reasoning_tokens=${reasoningTokens}): ${JSON.stringify(preview)}`);
|
|
4593
4590
|
this.fingerprint = fingerprint;
|
|
4594
4591
|
this.outputTokens = outputTokens;
|
|
4595
4592
|
this.reasoningTokens = reasoningTokens;
|
|
4596
|
-
this.quotaResetAt = quotaResetAt;
|
|
4597
4593
|
this.name = "DreamerProviderOutputFailureError";
|
|
4598
4594
|
}
|
|
4599
4595
|
}
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
return primaryQuotas.getStore() ? run() : primaryQuotas.run(new Map, run);
|
|
4603
|
-
}
|
|
4604
|
-
function rememberPrimaryQuota(model, error) {
|
|
4605
|
-
const quotas = primaryQuotas.getStore();
|
|
4606
|
-
if (!quotas || model === "primary" || !(error instanceof DreamerProviderOutputFailureError) || error.quotaResetAt === undefined || error.quotaResetAt <= Date.now())
|
|
4607
|
-
return null;
|
|
4608
|
-
const cached = new DreamerProviderOutputFailureError(error.fingerprint, error.outputTokens, error.reasoningTokens, "", error.quotaResetAt);
|
|
4609
|
-
cached.message = error.message;
|
|
4610
|
-
quotas.set(model, cached);
|
|
4611
|
-
return error;
|
|
4612
|
-
}
|
|
4613
|
-
function primaryQuotaFailure(model) {
|
|
4614
|
-
const quotas = primaryQuotas.getStore();
|
|
4615
|
-
const error = quotas?.get(model);
|
|
4616
|
-
if (!error)
|
|
4617
|
-
return null;
|
|
4618
|
-
if (error.quotaResetAt === undefined || error.quotaResetAt <= Date.now()) {
|
|
4619
|
-
quotas?.delete(model);
|
|
4620
|
-
return null;
|
|
4621
|
-
}
|
|
4622
|
-
const failure = new DreamerProviderOutputFailureError(error.fingerprint, error.outputTokens, error.reasoningTokens, "", error.quotaResetAt);
|
|
4623
|
-
failure.message = error.message;
|
|
4624
|
-
return failure;
|
|
4625
|
-
}
|
|
4626
|
-
function quotaResetAt(responseText, now) {
|
|
4627
|
-
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());
|
|
4628
|
-
if (!notice)
|
|
4629
|
-
return;
|
|
4630
|
-
const units = { h: 3600000, m: 60000, s: 1000 };
|
|
4631
|
-
const duration = [...notice[1].matchAll(/(\d+)([hms])/g)].reduce((sum, match) => sum + Number(match[1]) * units[match[2]], 0);
|
|
4632
|
-
const resetAt = now + duration;
|
|
4633
|
-
return duration > 0 && Number.isSafeInteger(resetAt) && resetAt < 8640000000000000 ? resetAt : undefined;
|
|
4596
|
+
function isAccountPoolQuotaNotice(responseText) {
|
|
4597
|
+
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());
|
|
4634
4598
|
}
|
|
4635
4599
|
function finiteTokenCount(value) {
|
|
4636
4600
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : null;
|
|
@@ -4662,7 +4626,7 @@ function latestAssistantCompletion(messages) {
|
|
|
4662
4626
|
}
|
|
4663
4627
|
return latest;
|
|
4664
4628
|
}
|
|
4665
|
-
function providerOutputFailureFromInvalidManifest(messages, responseText
|
|
4629
|
+
function providerOutputFailureFromInvalidManifest(messages, responseText) {
|
|
4666
4630
|
const completion = latestAssistantCompletion(messages);
|
|
4667
4631
|
if (completion?.finish?.toLowerCase() !== "stop")
|
|
4668
4632
|
return null;
|
|
@@ -4672,11 +4636,10 @@ function providerOutputFailureFromInvalidManifest(messages, responseText, now =
|
|
|
4672
4636
|
const normalized = responseText.trim().replace(/\s+/g, " ").toLowerCase();
|
|
4673
4637
|
if (!normalized)
|
|
4674
4638
|
return null;
|
|
4675
|
-
|
|
4676
|
-
if (resetAt === undefined && completion.outputTokens > MAX_NEAR_ZERO_OUTPUT_TOKENS)
|
|
4639
|
+
if (!isAccountPoolQuotaNotice(responseText) && completion.outputTokens > MAX_NEAR_ZERO_OUTPUT_TOKENS)
|
|
4677
4640
|
return null;
|
|
4678
4641
|
const fingerprint = createHash2("sha256").update(normalized).digest("hex").slice(0, 16);
|
|
4679
|
-
return new DreamerProviderOutputFailureError(fingerprint, completion.outputTokens, completion.reasoningTokens, responseText
|
|
4642
|
+
return new DreamerProviderOutputFailureError(fingerprint, completion.outputTokens, completion.reasoningTokens, responseText);
|
|
4680
4643
|
}
|
|
4681
4644
|
|
|
4682
4645
|
// src/v2/hooks/hidden-child.ts
|
|
@@ -5203,6 +5166,94 @@ function toModelEntry(spec) {
|
|
|
5203
5166
|
return spec;
|
|
5204
5167
|
}
|
|
5205
5168
|
|
|
5169
|
+
// src/shared/hidden-model-cooldown.ts
|
|
5170
|
+
var MAX_SKIP_MS = 7 * 24 * 60 * 60 * 1000;
|
|
5171
|
+
var MIN_SKIP_MS = 60000;
|
|
5172
|
+
var RETRY_LATER_REASON = "provider said to retry later";
|
|
5173
|
+
|
|
5174
|
+
class HiddenModelCooldowns {
|
|
5175
|
+
now;
|
|
5176
|
+
entries = new Map;
|
|
5177
|
+
constructor(now = () => Date.now()) {
|
|
5178
|
+
this.now = now;
|
|
5179
|
+
}
|
|
5180
|
+
record(model, error) {
|
|
5181
|
+
if (!model?.includes("/"))
|
|
5182
|
+
return;
|
|
5183
|
+
const now = this.now();
|
|
5184
|
+
const delay = retryDelay(error, now);
|
|
5185
|
+
if (delay === undefined || !Number.isFinite(delay) || delay <= MIN_SKIP_MS)
|
|
5186
|
+
return;
|
|
5187
|
+
this.entries.set(model, {
|
|
5188
|
+
model,
|
|
5189
|
+
until: now + Math.min(delay, MAX_SKIP_MS),
|
|
5190
|
+
reason: RETRY_LATER_REASON
|
|
5191
|
+
});
|
|
5192
|
+
}
|
|
5193
|
+
succeeded(model) {
|
|
5194
|
+
if (model)
|
|
5195
|
+
this.entries.delete(model);
|
|
5196
|
+
}
|
|
5197
|
+
live() {
|
|
5198
|
+
const now = this.now();
|
|
5199
|
+
for (const [model, entry] of this.entries) {
|
|
5200
|
+
if (entry.until <= now)
|
|
5201
|
+
this.entries.delete(model);
|
|
5202
|
+
}
|
|
5203
|
+
return [...this.entries.values()];
|
|
5204
|
+
}
|
|
5205
|
+
startIndex(models, log) {
|
|
5206
|
+
const live = new Map(this.live().map((entry) => [entry.model, entry]));
|
|
5207
|
+
let start = models.findIndex((model) => !live.has(model));
|
|
5208
|
+
if (start < 0) {
|
|
5209
|
+
start = 0;
|
|
5210
|
+
for (let i = 1;i < models.length; i++) {
|
|
5211
|
+
if ((live.get(models[i])?.until ?? Infinity) < (live.get(models[start])?.until ?? Infinity))
|
|
5212
|
+
start = i;
|
|
5213
|
+
}
|
|
5214
|
+
}
|
|
5215
|
+
const logged = new Set;
|
|
5216
|
+
for (const model of models.slice(0, start)) {
|
|
5217
|
+
const entry = live.get(model);
|
|
5218
|
+
if (entry && !logged.has(model)) {
|
|
5219
|
+
log(`skipping ${model} until ${new Date(entry.until).toISOString()}: provider said to retry later`);
|
|
5220
|
+
logged.add(model);
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5223
|
+
return start;
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
function retryDelay(error, now, depth = 0) {
|
|
5227
|
+
if (!isRecord(error) || depth > 4)
|
|
5228
|
+
return;
|
|
5229
|
+
const data = typeof error.statusCode === "number" || typeof error.status === "number" ? error : isRecord(error.data) ? error.data : error;
|
|
5230
|
+
const status = data.statusCode ?? data.status;
|
|
5231
|
+
if (status === 412 || status === 429 || status === 503) {
|
|
5232
|
+
if (typeof data.retryAfterMs === "number")
|
|
5233
|
+
return data.retryAfterMs;
|
|
5234
|
+
const headers = data.responseHeaders;
|
|
5235
|
+
if (isRecord(headers)) {
|
|
5236
|
+
const value = Object.entries(headers).find(([name]) => name.toLowerCase() === "retry-after")?.[1];
|
|
5237
|
+
if (typeof value === "string") {
|
|
5238
|
+
const text = value.trim();
|
|
5239
|
+
if (/^\d+$/.test(text))
|
|
5240
|
+
return Number(text) * 1000;
|
|
5241
|
+
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))
|
|
5242
|
+
return Date.parse(text) - now;
|
|
5243
|
+
}
|
|
5244
|
+
}
|
|
5245
|
+
}
|
|
5246
|
+
return retryDelay(error.hostError ?? error.cause, now, depth + 1);
|
|
5247
|
+
}
|
|
5248
|
+
var hiddenModelCooldowns = new HiddenModelCooldowns;
|
|
5249
|
+
function selectHiddenModelStart(primary, fallbacks = [], note) {
|
|
5250
|
+
if (!primary)
|
|
5251
|
+
return { primary, fallbacks };
|
|
5252
|
+
const chain = [primary, ...fallbacks];
|
|
5253
|
+
const start = hiddenModelCooldowns.startIndex(chain.map((entry) => toModelEntry(entry)?.model ?? ""), note);
|
|
5254
|
+
return { primary: chain[start], fallbacks: chain.slice(start + 1) };
|
|
5255
|
+
}
|
|
5256
|
+
|
|
5206
5257
|
// src/shared/model-suggestion-retry.ts
|
|
5207
5258
|
var ABORT_CALL_TIMEOUT_MS = 3000;
|
|
5208
5259
|
function copyPromptArgs(args, body) {
|
|
@@ -5441,14 +5492,11 @@ function throwWithPromptFailure(legacyError, failedAttempts, args, timeoutMs, tr
|
|
|
5441
5492
|
const error = legacyError instanceof Error ? legacyError : new Error(extractMessage(legacyError));
|
|
5442
5493
|
const last = failedAttempts.at(-1);
|
|
5443
5494
|
const failureClass = last?.failureClass ?? "unknown";
|
|
5444
|
-
const
|
|
5445
|
-
if (quota && error !== quota && !error.message.includes(quota.message))
|
|
5446
|
-
error.message = `${quota.message}; ${error.message}`;
|
|
5447
|
-
const providerError = failureClass === "provider_error" || quota ? sanitizeDiagnosticText(`${quota ? `${quota.message}; ` : ""}${shortErr(last?.error ?? legacyError)}`).slice(0, 500) : null;
|
|
5495
|
+
const providerError = failureClass === "provider_error" ? sanitizeDiagnosticText(shortErr(last?.error ?? legacyError)).slice(0, 500) : null;
|
|
5448
5496
|
promptFailureDetails.set(error, {
|
|
5449
5497
|
failureClass,
|
|
5450
5498
|
modelAttempted: last?.attempt.label ?? null,
|
|
5451
|
-
modelsTried: failedAttempts.
|
|
5499
|
+
modelsTried: failedAttempts.map((failure) => failure.attempt.label),
|
|
5452
5500
|
providerError,
|
|
5453
5501
|
timeoutMs: failureClass === "provider_timeout" ? timeoutMs : null,
|
|
5454
5502
|
childSessionId: transport ? transport.childSessionId ?? null : args.path.id || null,
|
|
@@ -5465,6 +5513,8 @@ async function attemptOnce(client, args, timeoutMs, signal, callContext, label,
|
|
|
5465
5513
|
await promptWithTimeout(client, attemptArgs, timeoutMs, signal, transport, firstOutputTimeoutMs);
|
|
5466
5514
|
return;
|
|
5467
5515
|
} catch (error) {
|
|
5516
|
+
if (!signal?.aborted && !isPromptTimeoutError(error))
|
|
5517
|
+
hiddenModelCooldowns.record(label, error);
|
|
5468
5518
|
if (isNonRetryable(error, signal) || !allowModelSuggestions)
|
|
5469
5519
|
throw error;
|
|
5470
5520
|
const suggestion = parseModelSuggestion(error);
|
|
@@ -5505,7 +5555,19 @@ function createChainClock(options, timeoutMs) {
|
|
|
5505
5555
|
}
|
|
5506
5556
|
};
|
|
5507
5557
|
}
|
|
5558
|
+
function cooldownStart(args, options) {
|
|
5559
|
+
const model = args.body.model;
|
|
5560
|
+
if (!model)
|
|
5561
|
+
return { args, options };
|
|
5562
|
+
const selected = selectHiddenModelStart({ model: `${model.providerID}/${model.modelID}`, qualifier: args.body.variant }, options.fallbackModels, log2);
|
|
5563
|
+
const { variant: _variant, ...body } = args.body;
|
|
5564
|
+
return {
|
|
5565
|
+
args: copyPromptArgs(args, { ...body, ...modelBodyField(selected.primary) }),
|
|
5566
|
+
options: { ...options, fallbackModels: selected.fallbacks }
|
|
5567
|
+
};
|
|
5568
|
+
}
|
|
5508
5569
|
async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
5570
|
+
({ args, options } = cooldownStart(args, options));
|
|
5509
5571
|
const timeoutMs = options.timeoutMs ?? 300000;
|
|
5510
5572
|
const callContext = options.callContext ?? "subagent";
|
|
5511
5573
|
const fallbacks = options.fallbackModels ?? [];
|
|
@@ -5577,6 +5639,8 @@ async function attemptAndValidate(client, args, timeoutMs, signal, callContext,
|
|
|
5577
5639
|
try {
|
|
5578
5640
|
output = await raceWithSignal(options.fetchOutput(args, attempt), options.signal);
|
|
5579
5641
|
} catch (error) {
|
|
5642
|
+
if (!signal?.aborted && !isPromptTimeoutError(error))
|
|
5643
|
+
hiddenModelCooldowns.record(attempt.label, error);
|
|
5580
5644
|
throw {
|
|
5581
5645
|
error,
|
|
5582
5646
|
failureClass: classifyPromptFailure(error, "output", signal),
|
|
@@ -5588,7 +5652,7 @@ async function attemptAndValidate(client, args, timeoutMs, signal, callContext,
|
|
|
5588
5652
|
const text = extractLatestAssistantText(messages);
|
|
5589
5653
|
if (text) {
|
|
5590
5654
|
const failure = providerOutputFailureFromInvalidManifest(messages, text);
|
|
5591
|
-
if (failure
|
|
5655
|
+
if (failure && isAccountPoolQuotaNotice(text))
|
|
5592
5656
|
throw failure;
|
|
5593
5657
|
}
|
|
5594
5658
|
if (!extractLatestAssistantText(output)) {
|
|
@@ -5597,11 +5661,14 @@ async function attemptAndValidate(client, args, timeoutMs, signal, callContext,
|
|
|
5597
5661
|
const error = new Error(`Host recorded assistant error: ${describeAssistantError(assistantFailure.error)}`);
|
|
5598
5662
|
Object.assign(error, {
|
|
5599
5663
|
name: "DreamerProviderOutputFailureError",
|
|
5600
|
-
transient: true
|
|
5664
|
+
transient: true,
|
|
5665
|
+
hostError: assistantFailure.error
|
|
5601
5666
|
});
|
|
5667
|
+
hiddenModelCooldowns.record(attempt.label, assistantFailure.error);
|
|
5602
5668
|
throw error;
|
|
5603
5669
|
}
|
|
5604
5670
|
}
|
|
5671
|
+
hiddenModelCooldowns.succeeded(attempt.label);
|
|
5605
5672
|
const validated = await options.validateOutput(output, attempt);
|
|
5606
5673
|
return { output, validated, attempt };
|
|
5607
5674
|
} catch (error) {
|
|
@@ -5616,6 +5683,7 @@ async function attemptAndValidate(client, args, timeoutMs, signal, callContext,
|
|
|
5616
5683
|
}
|
|
5617
5684
|
}
|
|
5618
5685
|
async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
5686
|
+
({ args, options } = cooldownStart(args, options));
|
|
5619
5687
|
const timeoutMs = options.timeoutMs ?? 300000;
|
|
5620
5688
|
const callContext = options.callContext ?? "subagent";
|
|
5621
5689
|
const fallbacks = options.fallbackModels ?? [];
|
|
@@ -5626,23 +5694,9 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
5626
5694
|
const failedAttempts = [];
|
|
5627
5695
|
let firstError = null;
|
|
5628
5696
|
let lastError = null;
|
|
5629
|
-
const cooledPrimary = primaryQuotaFailure(explicitPrimaryLabel);
|
|
5630
5697
|
const clock = createChainClock(options, timeoutMs);
|
|
5631
5698
|
const primaryStartedAt = Date.now();
|
|
5632
5699
|
try {
|
|
5633
|
-
if (cooledPrimary)
|
|
5634
|
-
throw {
|
|
5635
|
-
error: cooledPrimary,
|
|
5636
|
-
failureClass: "provider_error",
|
|
5637
|
-
attempt: {
|
|
5638
|
-
label: explicitPrimaryLabel,
|
|
5639
|
-
attemptIndex: 0,
|
|
5640
|
-
isFallback: false,
|
|
5641
|
-
totalAttempts,
|
|
5642
|
-
model: baseBody.model,
|
|
5643
|
-
skipped: true
|
|
5644
|
-
}
|
|
5645
|
-
};
|
|
5646
5700
|
const budget = clock.budget(0);
|
|
5647
5701
|
return await attemptAndValidate(client, baseArgs, budget.timeoutMs, options.signal, callContext, {
|
|
5648
5702
|
label: explicitPrimaryLabel,
|
|
@@ -5657,19 +5711,13 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
5657
5711
|
clock.settle(failure.error, primaryStartedAt);
|
|
5658
5712
|
firstError = failure.error;
|
|
5659
5713
|
lastError = failure.error;
|
|
5660
|
-
if (failure.error instanceof DreamerProviderOutputFailureError && failure.error.quotaResetAt !== undefined)
|
|
5661
|
-
failure.error.message = failure.error.message.replace(/^provider quota exhausted/, "primary quota exhausted");
|
|
5662
|
-
const quota = !cooledPrimary && rememberPrimaryQuota(explicitPrimaryLabel, failure.error);
|
|
5663
|
-
if (quota)
|
|
5664
|
-
log2(`[${callContext}] ${quota.message}; skipping ${explicitPrimaryLabel} for this run until reset`);
|
|
5665
5714
|
if (isNonRetryable(failure.error, options.signal)) {
|
|
5666
5715
|
throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs, options.transport);
|
|
5667
5716
|
}
|
|
5668
5717
|
if (fallbacks.length === 0) {
|
|
5669
5718
|
throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs, options.transport);
|
|
5670
5719
|
}
|
|
5671
|
-
|
|
5672
|
-
log2(`[${callContext}] primary (${explicitPrimaryLabel}) failed validation/prompt: ${shortErr(failure.error)}; ${fallbacks.length} fallback(s) configured, subject to remaining budget`);
|
|
5720
|
+
log2(`[${callContext}] primary (${explicitPrimaryLabel}) failed validation/prompt: ${shortErr(failure.error)}; ${fallbacks.length} fallback(s) configured, subject to remaining budget`);
|
|
5673
5721
|
}
|
|
5674
5722
|
for (let i = 0;i < fallbacks.length; i += 1) {
|
|
5675
5723
|
const fallback = toModelEntry(fallbacks[i]);
|
|
@@ -14523,7 +14571,7 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
|
14523
14571
|
preferResponseOnMissingData: true
|
|
14524
14572
|
});
|
|
14525
14573
|
const assistantFailure = extractLatestAssistantFailure(messages);
|
|
14526
|
-
const hostError = hostErrors.get(handle.id);
|
|
14574
|
+
const hostError = assistantFailure?.error ?? hostErrors.get(handle.id);
|
|
14527
14575
|
if (assistantFailure || hostError !== undefined) {
|
|
14528
14576
|
const finish = assistantFailure?.finish ? ` (finish=${assistantFailure.finish})` : "";
|
|
14529
14577
|
const error = new Error(`Historian host recorded an assistant error${finish}: ${describeAssistantFailure(assistantFailure?.error ?? hostError)}`, hostError === undefined ? undefined : { cause: hostError });
|
|
@@ -14572,6 +14620,8 @@ function historianReasoningBudgetDiagnostic(outputTokens, tokens) {
|
|
|
14572
14620
|
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`;
|
|
14573
14621
|
}
|
|
14574
14622
|
async function runValidatedHistorianPass(args) {
|
|
14623
|
+
const selected = selectHiddenModelStart(args.model, args.fallbackModels, (message) => sessionLog2(args.parentSessionId, message));
|
|
14624
|
+
args = { ...args, model: selected.primary, fallbackModels: selected.fallbacks };
|
|
14575
14625
|
const firstRun = await runHistorianPrompt({
|
|
14576
14626
|
...args,
|
|
14577
14627
|
dumpLabel: `${args.dumpLabelBase}-initial`,
|
|
@@ -14830,6 +14880,7 @@ async function runHistorianPrompt(args) {
|
|
|
14830
14880
|
}
|
|
14831
14881
|
}
|
|
14832
14882
|
completion = await executor.collect(handle, 50);
|
|
14883
|
+
hiddenModelCooldowns.succeeded(handle.attemptedModel ?? toModelEntry(modelOverride)?.model);
|
|
14833
14884
|
const lengthCapped = completion.lengthCapped;
|
|
14834
14885
|
const tokens = {
|
|
14835
14886
|
...runTokenLog(undefined, args.maxOutputTokens),
|
|
@@ -14866,6 +14917,7 @@ async function runHistorianPrompt(args) {
|
|
|
14866
14917
|
const dumpPath = dumpHistorianResponse(parentSessionId, sessionDirectory, dumpLabel ?? "historian-response", result);
|
|
14867
14918
|
return { ok: true, result, dumpPath, invocationId: invocationId ?? undefined };
|
|
14868
14919
|
} catch (modelError) {
|
|
14920
|
+
hiddenModelCooldowns.record(handle?.attemptedModel ?? toModelEntry(modelOverride)?.model, modelError);
|
|
14869
14921
|
const desc = describeError(modelError);
|
|
14870
14922
|
sessionLog2(parentSessionId, `historian prompt failed: ${desc.brief} promptLength=${prompt.length}${desc.stackHead ? ` stackHead="${desc.stackHead}"` : ""}`);
|
|
14871
14923
|
recordInvocation({
|
|
@@ -16302,10 +16354,6 @@ var FORCE80_MAX_CAP = 500000;
|
|
|
16302
16354
|
var FORCE95_MAX_CAP = 750000;
|
|
16303
16355
|
var NORMAL_HYSTERESIS_TOKENS = 256;
|
|
16304
16356
|
var RECOVERY_NO_HEAD_LIMIT = 2;
|
|
16305
|
-
var MIN_FORCE_ELIGIBLE_TOKENS_CAP = 1000;
|
|
16306
|
-
function deriveMinForceEligibleTokens(scaledN) {
|
|
16307
|
-
return Math.min(MIN_FORCE_ELIGIBLE_TOKENS_CAP, Math.max(1, Math.floor(scaledN / 8)));
|
|
16308
|
-
}
|
|
16309
16357
|
function clampPercentage(value) {
|
|
16310
16358
|
if (!Number.isFinite(value))
|
|
16311
16359
|
return 0;
|
|
@@ -16550,6 +16598,7 @@ function resolveProtectedTailBoundary(ctx) {
|
|
|
16550
16598
|
priorBoundaryOrdinal: ctx.priorBoundaryOrdinal,
|
|
16551
16599
|
migrationFloorActive: ctx.migrationFloorActive,
|
|
16552
16600
|
emergencyTailScale: ctx.emergencyTailScale,
|
|
16601
|
+
recovery: ctx.recovery,
|
|
16553
16602
|
providerShapeVersion: ctx.providerShapeVersion,
|
|
16554
16603
|
cacheNamespace: ctx.cacheNamespace,
|
|
16555
16604
|
createdAt,
|
|
@@ -16594,6 +16643,7 @@ function resolveProtectedTailBoundary(ctx) {
|
|
|
16594
16643
|
priorBoundaryOrdinal: ctx.priorBoundaryOrdinal,
|
|
16595
16644
|
migrationFloorActive: false,
|
|
16596
16645
|
emergencyTailScale: ctx.emergencyTailScale,
|
|
16646
|
+
recovery: ctx.recovery,
|
|
16597
16647
|
providerShapeVersion: ctx.providerShapeVersion,
|
|
16598
16648
|
cacheNamespace: ctx.cacheNamespace,
|
|
16599
16649
|
createdAt,
|
|
@@ -16709,6 +16759,7 @@ function resolveProtectedTailBoundary(ctx) {
|
|
|
16709
16759
|
priorBoundaryOrdinal: ctx.priorBoundaryOrdinal,
|
|
16710
16760
|
migrationFloorActive: ctx.migrationFloorActive,
|
|
16711
16761
|
emergencyTailScale: ctx.emergencyTailScale,
|
|
16762
|
+
recovery: ctx.recovery,
|
|
16712
16763
|
liftLivePromptFloor: ctx.liftLivePromptFloor === true ? true : undefined,
|
|
16713
16764
|
providerShapeVersion: ctx.providerShapeVersion,
|
|
16714
16765
|
cacheNamespace: ctx.cacheNamespace,
|
|
@@ -16787,6 +16838,7 @@ function resolveBoundaryContext(args) {
|
|
|
16787
16838
|
protectedTailPolicyVersion: meta.protectedTailPolicyVersion,
|
|
16788
16839
|
migrationFloorActive,
|
|
16789
16840
|
emergencyTailScale: args.emergencyTailScale,
|
|
16841
|
+
recovery: args.recovery,
|
|
16790
16842
|
liftLivePromptFloor: args.liftLivePromptFloor,
|
|
16791
16843
|
providerShapeVersion: args.providerShapeVersion ?? "opencode-v1",
|
|
16792
16844
|
cacheNamespace: args.cacheNamespace ?? `opencode:${args.sessionId}`,
|
|
@@ -16967,9 +17019,11 @@ function hasRunnableCompartmentWindow(snapshot) {
|
|
|
16967
17019
|
return false;
|
|
16968
17020
|
if (snapshot.eligibleEndOrdinal <= snapshot.offset)
|
|
16969
17021
|
return false;
|
|
17022
|
+
if (snapshot.recovery || snapshot.usagePercentage >= 95 || snapshot.mode === "manual-wrapup" || snapshot.mode === "manual-full-recomp")
|
|
17023
|
+
return true;
|
|
16970
17024
|
const forceMaterializationPercentage = escalationBands(snapshot.executeThresholdPercentage).forceMaterializationPercentage;
|
|
16971
17025
|
if (snapshot.usagePercentage >= forceMaterializationPercentage || snapshot.emergencyTailScale) {
|
|
16972
|
-
return snapshot.
|
|
17026
|
+
return snapshot.summaryRemovedEligibleTokens >= snapshot.contextLimit * 0.02;
|
|
16973
17027
|
}
|
|
16974
17028
|
return snapshot.eligibleEndOrdinal > snapshot.offset;
|
|
16975
17029
|
}
|
|
@@ -17431,7 +17485,7 @@ async function runCompartmentAgent(deps) {
|
|
|
17431
17485
|
return;
|
|
17432
17486
|
}
|
|
17433
17487
|
if (!validation.ok && validation.reason === "stale_snapshot") {
|
|
17434
|
-
const
|
|
17488
|
+
const refreshedBoundary = deps.refreshBoundarySnapshot ? deps.refreshBoundarySnapshot(boundarySnapshot, validation) : resolveOpenCodeProtectedTailBoundary({
|
|
17435
17489
|
db,
|
|
17436
17490
|
sessionId,
|
|
17437
17491
|
mode: "incremental-runner",
|
|
@@ -17445,6 +17499,10 @@ async function runCompartmentAgent(deps) {
|
|
|
17445
17499
|
emergencyTailScale: boundarySnapshot.emergencyTailScale,
|
|
17446
17500
|
liftLivePromptFloor: boundarySnapshot.liftLivePromptFloor === true
|
|
17447
17501
|
});
|
|
17502
|
+
const refreshed = refreshedBoundary ? {
|
|
17503
|
+
...refreshedBoundary,
|
|
17504
|
+
recovery: boundarySnapshot.recovery || deps.forceDrainQuota
|
|
17505
|
+
} : null;
|
|
17448
17506
|
if (refreshed && hasRunnableCompartmentWindow(refreshed)) {
|
|
17449
17507
|
sessionLog2(sessionId, `historian: refreshed stale protected-tail snapshot at run time (was: ${validation.detail ?? "stale"}) — eligible head ${refreshed.offset}-${refreshed.eligibleEndOrdinal - 1}`);
|
|
17450
17508
|
boundarySnapshot = refreshed;
|
|
@@ -18937,4 +18995,4 @@ async function executeContextRecomp(deps, options = {}) {
|
|
|
18937
18995
|
return (await executeContextRecompWithResult(deps, options)).message;
|
|
18938
18996
|
}
|
|
18939
18997
|
|
|
18940
|
-
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, isCommitRetentionPaused, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError,
|
|
18998
|
+
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, isCommitRetentionPaused, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, providerOutputFailureFromInvalidManifest, 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, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, v2ToolDefinitionsHash, v2RequestToolsFingerprint, classifyRequestToolsChange, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, startCompactionMarkerCandidatePreparation, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, 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, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, shouldWaitForNewHistorianHistory, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenEstimatorFingerprint,
|
|
3
3
|
estimateTokens
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-0tz2fzpq.js";
|
|
5
5
|
import {
|
|
6
6
|
getHarness2
|
|
7
7
|
} from "./index-pavzsdc6.js";
|
|
8
8
|
import {
|
|
9
9
|
log2
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-82dfe8en.js";
|
|
11
11
|
import {
|
|
12
12
|
isSynapseEmbeddingTruncated
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-hsyczpn7.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped2
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-2ny9xwdn.js";
|
|
17
17
|
import {
|
|
18
18
|
isKnownAutocommit
|
|
19
19
|
} from "./index-8ajstryz.js";
|
|
@@ -6,19 +6,19 @@ import {
|
|
|
6
6
|
removeNestedBlocks,
|
|
7
7
|
hasMeaningfulUserText2,
|
|
8
8
|
extractTexts2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-0tz2fzpq.js";
|
|
10
10
|
import {
|
|
11
11
|
cleanUserText2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-07rp6xcn.js";
|
|
13
13
|
import {
|
|
14
14
|
recordMessageFtsRowid2,
|
|
15
15
|
recordIndexedMessageTime2,
|
|
16
16
|
messageFtsOrdinalRangeIsMapped2,
|
|
17
17
|
deleteUnmappedMessageFtsRows2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-2ny9xwdn.js";
|
|
19
19
|
import {
|
|
20
20
|
logSlowWriteTransaction
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-tad3can2.js";
|
|
22
22
|
|
|
23
23
|
// src/features/magic-context/compression-depth-storage.ts
|
|
24
24
|
var incrementDepthStatements = new WeakMap;
|