@cortexkit/opencode-magic-context 0.49.49 → 0.49.51
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/auto-search-worker.js +3 -3
- package/dist/chunk-embedding-write-worker.js +1 -1
- 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/{context-bwf57gnh.js → context-r77d4fdy.js} +37 -23
- package/dist/{embedding-backfill-d9x9q2e2.js → embedding-backfill-3wdjzrvs.js} +4 -4
- package/dist/embedding-worker.js +2 -2
- 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/search-rerank.d.ts +2 -2
- package/dist/features/magic-context/search-rerank.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/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/{index-qb75tv9j.js → index-07rp6xcn.js} +1 -1
- package/dist/{index-5bksfv58.js → index-30sf7e5k.js} +27 -9
- package/dist/{index-7n2n3v92.js → index-5dptmnvd.js} +2 -2
- package/dist/{index-arxg51bj.js → index-8d7gkgjs.js} +4 -3
- package/dist/{index-wdmfnmv1.js → index-97bjd14c.js} +4 -4
- package/dist/{index-0mdh2cke.js → index-bamnjp2t.js} +20 -4
- package/dist/{index-5850zme4.js → index-ct3ettqt.js} +3 -3
- package/dist/{index-3n9ee4jh.js → index-cwj6qhmf.js} +1 -1
- package/dist/{index-j7verehm.js → index-gv7dwx5b.js} +36 -27
- package/dist/{index-va9x7y48.js → index-h8g08nxs.js} +135 -81
- package/dist/{index-jedbxq6n.js → index-hkveze74.js} +1 -1
- package/dist/{index-4dpvnp8k.js → index-jjy5a5w0.js} +3 -0
- package/dist/{index-h3p558ec.js → index-mjh63zvw.js} +1 -1
- package/dist/{index-vyv4tame.js → index-n0twfvah.js} +53 -2
- package/dist/{index-tj5gz396.js → index-rbs27k1d.js} +4 -2
- package/dist/{index-cs7pmwt6.js → index-s131svmx.js} +1 -1
- package/dist/{index-vbmh68fb.js → index-v4a1pnny.js} +4 -4
- package/dist/{index-k47v0tmk.js → index-wr2t8zb0.js} +8 -8
- package/dist/{index-agfh931z.js → index-z4832qfe.js} +4 -2
- package/dist/index.js +22 -22
- package/dist/{message-index-bounded-2shxmht9.js → message-index-bounded-k0ebpy3y.js} +3 -3
- package/dist/migration-worker.js +1 -1
- 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-nzgkq61z.js → project-embedding-registry-5dwh5zfn.js} +3 -3
- package/dist/raw-ordinal-warmup-worker.js +3 -3
- package/dist/{read-session-chunk-c15y8yg6.js → read-session-chunk-6712p893.js} +2 -2
- package/dist/{recomp-orchestrator-gfxqqpph.js → recomp-orchestrator-8ebydg5j.js} +11 -11
- package/dist/{render-5tx8r0me.js → render-dtc4qkq4.js} +6 -6
- package/dist/{search-k2n5bvsk.js → search-75bj2430.js} +9 -9
- package/dist/{search-archive-6tgh88xp.js → search-archive-f6hjbnsa.js} +4 -4
- 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/test-preload.d.ts +2 -0
- package/dist/test-preload.d.ts.map +1 -0
- package/dist/{transform-postprocess-phase-36dw4kxb.js → transform-postprocess-phase-1bg25094.js} +12 -12
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- package/dist/v2/{context-td3jyze3.js → context-cpbhpxks.js} +47 -30
- package/dist/v2/{embedding-backfill-5dqdm3ff.js → embedding-backfill-x1zpc04f.js} +4 -4
- package/dist/v2/embedding-worker.js +2 -2
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- 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/{message-index-bounded-j1jskn8a.js → message-index-bounded-a36rw93p.js} +3 -3
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/{project-embedding-registry-swm4mw1t.js → project-embedding-registry-v2fxrs8b.js} +3 -3
- package/dist/v2/raw-ordinal-warmup-worker.js +3 -3
- package/dist/v2/{read-session-chunk-carzw3m8.js → read-session-chunk-hzhxvhyv.js} +2 -2
- package/dist/v2/{recomp-orchestrator-e7vrs932.js → recomp-orchestrator-yzr49pd0.js} +11 -11
- package/dist/v2/{render-e9mh9y1d.js → render-rhaevxv1.js} +6 -6
- package/dist/v2/{search-sr23g316.js → search-3yrdpr38.js} +8 -8
- package/dist/v2/{search-archive-j3kb9ggd.js → search-archive-9924fyk8.js} +4 -4
- package/dist/v2/{server-z7n3n1ra.js → server-016a1whm.js} +134 -81
- package/dist/v2/{server-4y2pcckw.js → server-0k586y7d.js} +3 -3
- package/dist/v2/{server-p9s40wfa.js → server-0ms13pc8.js} +3 -0
- package/dist/v2/{server-c5kq8d5n.js → server-16kfxcxj.js} +1 -1
- package/dist/v2/{server-2qxt6qv0.js → server-3bfc26r7.js} +1 -1
- package/dist/v2/{server-fw49gc57.js → server-4h4acntc.js} +20 -4
- package/dist/v2/{server-yxe0gh3v.js → server-88yvx6r9.js} +53 -2
- package/dist/v2/{server-1ppcpsdw.js → server-brsx45r6.js} +4 -2
- package/dist/v2/{server-e20kfytm.js → server-eznem83k.js} +26 -8
- package/dist/v2/{server-y7q8cds3.js → server-jxrqsn84.js} +1 -1
- package/dist/v2/{server-t5cgb15n.js → server-q93jdtz8.js} +2 -2
- package/dist/v2/{server-ttrrh27h.js → server-sb55ddgn.js} +3 -2
- package/dist/v2/{server-e14c3hd6.js → server-scp3y4dh.js} +4 -2
- package/dist/v2/{server-0qxb8r8q.js → server-sgn61hht.js} +1 -1
- package/dist/v2/{server-r7y35vm9.js → server-vjadwb3j.js} +4 -3
- package/dist/v2/server.js +4 -4
- package/dist/v2/{v2-archive-reader-jnzjavzr.js → v2-archive-reader-5ggewg8q.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-jw4nre49.js → wrapup-orchestrator-36c5wyvq.js} +11 -11
- package/dist/{v2-archive-reader-b76tfeje.js → v2-archive-reader-gx5ke1d7.js} +1 -1
- package/dist/{wrapup-orchestrator-fhfazjkq.js → wrapup-orchestrator-ya31knav.js} +12 -12
- 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/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
|
@@ -10,14 +10,14 @@ import"./server-pavzsdc6.js";
|
|
|
10
10
|
import"./server-bb6kf05j.js";
|
|
11
11
|
import"./server-z4p0ry94.js";
|
|
12
12
|
import"./server-ww7xbxxf.js";
|
|
13
|
-
import"./server-
|
|
13
|
+
import"./server-0ms13pc8.js";
|
|
14
14
|
import"./server-v0p37hm2.js";
|
|
15
15
|
import"./server-96ztjvkn.js";
|
|
16
16
|
import"./server-1d042x6w.js";
|
|
17
17
|
import"./server-rz5jnhnv.js";
|
|
18
18
|
import"./server-2ra6pwf3.js";
|
|
19
19
|
import"./server-7vrtk78d.js";
|
|
20
|
-
import"./server-
|
|
20
|
+
import"./server-3bfc26r7.js";
|
|
21
21
|
import"./server-kgq2e2hh.js";
|
|
22
22
|
import {
|
|
23
23
|
MESSAGE_INDEX_MAX_FTS_BYTES,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
markMessageIndexDirty,
|
|
27
27
|
getIndexableContent,
|
|
28
28
|
indexSingleMessage
|
|
29
|
-
} from "./server-
|
|
29
|
+
} from "./server-16kfxcxj.js";
|
|
30
30
|
import"./server-966dq3pd.js";
|
|
31
31
|
import"./server-np27dgyt.js";
|
|
32
32
|
|
package/dist/v2/{project-embedding-registry-swm4mw1t.js → project-embedding-registry-v2fxrs8b.js}
RENAMED
|
@@ -35,12 +35,12 @@ import {
|
|
|
35
35
|
sweepAllRegisteredProjects2,
|
|
36
36
|
_setTestProviderFactoryForProject2,
|
|
37
37
|
_resetProjectEmbeddingRegistryForTests2
|
|
38
|
-
} from "./server-
|
|
38
|
+
} from "./server-4h4acntc.js";
|
|
39
39
|
import"./server-4dhv7mqz.js";
|
|
40
40
|
import"./server-2amn2s73.js";
|
|
41
41
|
import"./server-qt1qqasc.js";
|
|
42
|
-
import"./server-
|
|
43
|
-
import"./server-
|
|
42
|
+
import"./server-brsx45r6.js";
|
|
43
|
+
import"./server-0ms13pc8.js";
|
|
44
44
|
import"./server-qp5sj6n5.js";
|
|
45
45
|
import"./server-g61hgy1y.js";
|
|
46
46
|
import"./server-mxsy9h1d.js";
|
|
@@ -19,7 +19,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
19
19
|
await main();
|
|
20
20
|
async function main() {
|
|
21
21
|
if (input.v2ArchiveReader) {
|
|
22
|
-
const { serveV2ArchiveReads } = await import("./v2-archive-reader-
|
|
22
|
+
const { serveV2ArchiveReads } = await import("./v2-archive-reader-5ggewg8q.js");
|
|
23
23
|
await serveV2ArchiveReads(port, openConnections);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -51,7 +51,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
51
51
|
await runMessageFtsRowidMapBackfill(db);
|
|
52
52
|
reply = { kind: "fts-rowid-backfill" };
|
|
53
53
|
} else if (input.searchArchive) {
|
|
54
|
-
const { renderSearchArchive } = await import("./search-archive-
|
|
54
|
+
const { renderSearchArchive } = await import("./search-archive-9924fyk8.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-3e482h3c.js");
|
|
56
56
|
const archive = input.searchArchive;
|
|
57
57
|
let raw;
|
|
@@ -81,7 +81,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
81
81
|
const { setHarness } = await import("./harness-e4avh192.js");
|
|
82
82
|
setHarness(input.harness ?? "opencode");
|
|
83
83
|
const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
|
|
84
|
-
import("./message-index-bounded-
|
|
84
|
+
import("./message-index-bounded-a36rw93p.js"),
|
|
85
85
|
import("./sqlite-context-pragmas-mv9jqwjh.js")
|
|
86
86
|
]);
|
|
87
87
|
configureContextDatabasePragmas(db);
|
|
@@ -38,11 +38,11 @@ import {
|
|
|
38
38
|
readSessionChunk2,
|
|
39
39
|
getRawSessionMessageIdsThrough2,
|
|
40
40
|
readRawSessionSeedTail2
|
|
41
|
-
} from "./server-
|
|
41
|
+
} from "./server-3bfc26r7.js";
|
|
42
42
|
import"./server-rcchadw0.js";
|
|
43
43
|
import"./server-1zx87sdm.js";
|
|
44
44
|
import"./server-7vrtk78d.js";
|
|
45
|
-
import"./server-
|
|
45
|
+
import"./server-0ms13pc8.js";
|
|
46
46
|
import"./server-kgq2e2hh.js";
|
|
47
47
|
import"./server-ww7xbxxf.js";
|
|
48
48
|
import"./server-rz5jnhnv.js";
|
|
@@ -7,35 +7,35 @@ import {
|
|
|
7
7
|
setRecompTerminal2,
|
|
8
8
|
buildRecompDeps2,
|
|
9
9
|
runManagedRecomp2
|
|
10
|
-
} from "./server-
|
|
10
|
+
} from "./server-016a1whm.js";
|
|
11
11
|
import"./server-c8z2grq0.js";
|
|
12
|
-
import"./server-
|
|
13
|
-
import"./server-
|
|
12
|
+
import"./server-sgn61hht.js";
|
|
13
|
+
import"./server-vjadwb3j.js";
|
|
14
14
|
import"./server-jjvbk92s.js";
|
|
15
|
-
import"./server-
|
|
15
|
+
import"./server-4h4acntc.js";
|
|
16
16
|
import"./server-4dhv7mqz.js";
|
|
17
|
-
import"./server-
|
|
17
|
+
import"./server-88yvx6r9.js";
|
|
18
18
|
import"./server-t8n27rbt.js";
|
|
19
|
-
import"./server-
|
|
19
|
+
import"./server-16kfxcxj.js";
|
|
20
20
|
import"./server-2amn2s73.js";
|
|
21
21
|
import"./server-rthnpmbp.js";
|
|
22
22
|
import"./server-5kgesxck.js";
|
|
23
23
|
import"./server-vqq3g1t7.js";
|
|
24
24
|
import"./server-qt1qqasc.js";
|
|
25
|
-
import"./server-
|
|
25
|
+
import"./server-3bfc26r7.js";
|
|
26
26
|
import"./server-rcchadw0.js";
|
|
27
27
|
import"./server-1zx87sdm.js";
|
|
28
28
|
import"./server-7vrtk78d.js";
|
|
29
29
|
import"./server-91gb0vh8.js";
|
|
30
|
-
import"./server-
|
|
30
|
+
import"./server-sb55ddgn.js";
|
|
31
31
|
import"./server-sa1fdt41.js";
|
|
32
32
|
import"./server-x8a7jmkh.js";
|
|
33
|
-
import"./server-
|
|
34
|
-
import"./server-
|
|
33
|
+
import"./server-brsx45r6.js";
|
|
34
|
+
import"./server-0ms13pc8.js";
|
|
35
35
|
import"./server-qp5sj6n5.js";
|
|
36
36
|
import"./server-g61hgy1y.js";
|
|
37
37
|
import"./server-mxsy9h1d.js";
|
|
38
|
-
import"./server-
|
|
38
|
+
import"./server-scp3y4dh.js";
|
|
39
39
|
import"./server-fb3zxn06.js";
|
|
40
40
|
import"./server-58h6rrnx.js";
|
|
41
41
|
import"./server-fr0wbhdn.js";
|
|
@@ -2,20 +2,20 @@ import {
|
|
|
2
2
|
renderMessageByOrdinal2,
|
|
3
3
|
renderVerboseRangeForTool2,
|
|
4
4
|
renderItemByTag2
|
|
5
|
-
} from "./server-
|
|
6
|
-
import"./server-
|
|
5
|
+
} from "./server-jxrqsn84.js";
|
|
6
|
+
import"./server-88yvx6r9.js";
|
|
7
7
|
import"./server-t8n27rbt.js";
|
|
8
|
-
import"./server-
|
|
8
|
+
import"./server-16kfxcxj.js";
|
|
9
9
|
import"./server-2amn2s73.js";
|
|
10
10
|
import"./server-rthnpmbp.js";
|
|
11
|
-
import"./server-
|
|
11
|
+
import"./server-3bfc26r7.js";
|
|
12
12
|
import"./server-rcchadw0.js";
|
|
13
13
|
import"./server-1zx87sdm.js";
|
|
14
14
|
import"./server-7vrtk78d.js";
|
|
15
|
-
import"./server-
|
|
15
|
+
import"./server-0ms13pc8.js";
|
|
16
16
|
import"./server-g61hgy1y.js";
|
|
17
17
|
import"./server-mxsy9h1d.js";
|
|
18
|
-
import"./server-
|
|
18
|
+
import"./server-scp3y4dh.js";
|
|
19
19
|
import"./server-fb3zxn06.js";
|
|
20
20
|
import"./server-58h6rrnx.js";
|
|
21
21
|
import"./server-fr0wbhdn.js";
|
|
@@ -5,23 +5,23 @@ import {
|
|
|
5
5
|
resolveMemoriesByIdsForSearch2,
|
|
6
6
|
unifiedSearch2,
|
|
7
7
|
formatSearchResults2
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-eznem83k.js";
|
|
9
9
|
import"./server-kaqs6h31.js";
|
|
10
|
-
import"./server-
|
|
11
|
-
import"./server-
|
|
10
|
+
import"./server-sgn61hht.js";
|
|
11
|
+
import"./server-vjadwb3j.js";
|
|
12
12
|
import"./server-jjvbk92s.js";
|
|
13
|
-
import"./server-
|
|
13
|
+
import"./server-4h4acntc.js";
|
|
14
14
|
import"./server-4dhv7mqz.js";
|
|
15
15
|
import"./server-t8n27rbt.js";
|
|
16
|
-
import"./server-
|
|
16
|
+
import"./server-16kfxcxj.js";
|
|
17
17
|
import"./server-2amn2s73.js";
|
|
18
18
|
import"./server-qt1qqasc.js";
|
|
19
|
-
import"./server-
|
|
19
|
+
import"./server-3bfc26r7.js";
|
|
20
20
|
import"./server-rcchadw0.js";
|
|
21
21
|
import"./server-1zx87sdm.js";
|
|
22
22
|
import"./server-7vrtk78d.js";
|
|
23
|
-
import"./server-
|
|
24
|
-
import"./server-
|
|
23
|
+
import"./server-brsx45r6.js";
|
|
24
|
+
import"./server-0ms13pc8.js";
|
|
25
25
|
import"./server-qp5sj6n5.js";
|
|
26
26
|
import"./server-g61hgy1y.js";
|
|
27
27
|
import"./server-mxsy9h1d.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderSearchArchive2,
|
|
3
3
|
renderSearchArchiveOffThread2
|
|
4
|
-
} from "./server-
|
|
5
|
-
import"./server-
|
|
4
|
+
} from "./server-q93jdtz8.js";
|
|
5
|
+
import"./server-0k586y7d.js";
|
|
6
6
|
import"./server-kaqs6h31.js";
|
|
7
|
-
import"./server-
|
|
7
|
+
import"./server-3bfc26r7.js";
|
|
8
8
|
import"./server-rcchadw0.js";
|
|
9
9
|
import"./server-1zx87sdm.js";
|
|
10
10
|
import"./server-7vrtk78d.js";
|
|
11
|
-
import"./server-
|
|
11
|
+
import"./server-0ms13pc8.js";
|
|
12
12
|
import"./server-kgq2e2hh.js";
|
|
13
13
|
import"./server-ww7xbxxf.js";
|
|
14
14
|
import"./server-rz5jnhnv.js";
|
|
@@ -20,7 +20,7 @@ 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,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
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,
|
|
@@ -152,7 +152,7 @@ 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
158
|
} from "./server-kgq2e2hh.js";
|
|
@@ -162,7 +162,7 @@ import {
|
|
|
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";
|
|
@@ -241,7 +241,7 @@ import {
|
|
|
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,
|
|
@@ -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({
|
|
@@ -16184,4 +16237,4 @@ ${failure}`;
|
|
|
16184
16237
|
}
|
|
16185
16238
|
}
|
|
16186
16239
|
|
|
16187
|
-
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 };
|