@cortexkit/opencode-magic-context 0.49.18 → 0.49.20
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 +53 -10
- package/dist/chunk-embedding-write-worker.js +30 -23
- package/dist/{compaction-marker-candidates-n4krhat4.js → compaction-marker-candidates-b2q30cft.js} +3 -3
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/compartment-chunk-embedding-va090as0.js +65 -0
- package/dist/config/schema/magic-context.d.ts +6 -6
- package/dist/{conflict-warning-hook-4pmz879v.js → conflict-warning-hook-frp3z2wk.js} +9 -8
- package/dist/{context-m897gfp9.js → context-mkece1db.js} +460 -135
- package/dist/{derive-budgets-zn7yzd2d.js → derive-budgets-pqybnx09.js} +2 -2
- package/dist/embedding-backfill-gy3p78py.js +25 -0
- package/dist/embedding-worker-process.js +2 -2
- package/dist/embedding-worker.js +5 -5
- package/dist/features/magic-context/chunk-embedding-writer.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +44 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/classify.d.ts +3 -0
- package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +11 -0
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +3 -0
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +2 -0
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts +3 -0
- 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-local.d.ts +1 -0
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/local-embedding-pooling.d.ts +22 -0
- package/dist/features/magic-context/memory/local-embedding-pooling.d.ts.map +1 -0
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +2 -0
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +27 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +14 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts +20 -0
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/{history-owner-xp3pngv7.js → history-owner-36wp3mkb.js} +2 -2
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-embed-session.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-hint.d.ts +7 -1
- package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +33 -6
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-evaluation.fixture.d.ts +2 -0
- package/dist/hooks/magic-context/auto-search-worker-evaluation.fixture.d.ts.map +1 -0
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +5 -2
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +5 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/diagnostic-log-state.d.ts +4 -0
- package/dist/hooks/magic-context/diagnostic-log-state.d.ts.map +1 -0
- package/dist/hooks/magic-context/execute-reclaim.d.ts +35 -0
- package/dist/hooks/magic-context/execute-reclaim.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +1 -3
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts +8 -0
- package/dist/hooks/magic-context/latest-assistant-turn.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts +5 -0
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts +13 -0
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts.map +1 -1
- package/dist/hooks/magic-context/nudge-evaluation-log.d.ts +3 -0
- package/dist/hooks/magic-context/nudge-evaluation-log.d.ts.map +1 -0
- package/dist/hooks/magic-context/pending-drop-eligibility.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +4 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-date-refresh.d.ts +15 -2
- package/dist/hooks/magic-context/system-date-refresh.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-sticky-date.d.ts +10 -0
- package/dist/hooks/magic-context/system-prompt-sticky-date.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +23 -6
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-bjcnntmz.js → index-0wthn7fp.js} +468 -18
- package/dist/{index-kq82mtg0.js → index-11zf2wwc.js} +3 -3
- package/dist/{index-b5vqckbw.js → index-153r2q6z.js} +314 -127
- package/dist/{index-v8awdgvd.js → index-1pefp8ar.js} +5 -5
- package/dist/{v2/server-beht37jy.js → index-1zx2pa5d.js} +1 -1
- package/dist/{index-ze7mvk54.js → index-2yhtnfcf.js} +75 -57
- package/dist/{index-cf74k5ak.js → index-305y133n.js} +4 -4
- package/dist/{index-s734jcsr.js → index-35qc6606.js} +9 -3
- package/dist/{index-x4njr8df.js → index-48stjd56.js} +105 -19
- package/dist/{index-24jbw52d.js → index-4n7w9rad.js} +6 -6
- package/dist/{index-kee4kn5j.js → index-4pnsgvfk.js} +1 -1
- package/dist/{v2/server-8cd2j99z.js → index-5kym00ag.js} +32 -13
- package/dist/{index-4s3t0nd0.js → index-616rsjrv.js} +2 -2
- package/dist/{index-e4xv8890.js → index-67nyj0gy.js} +507 -210
- package/dist/{index-6x57ar45.js → index-adk2z5d8.js} +3 -3
- package/dist/{index-c5pytzne.js → index-b88dwwrh.js} +1 -1
- package/dist/{index-rr2bb45z.js → index-c4b76d4t.js} +2 -2
- package/dist/{index-nj7yykkx.js → index-c7phnbvk.js} +1 -1
- package/dist/index-cpjk5jd2.js +82 -0
- package/dist/{index-6s5941tm.js → index-d6rp4dxh.js} +5 -5
- package/dist/{index-s7j8tvhv.js → index-dc8hy95c.js} +69 -17
- package/dist/{index-j75v2476.js → index-h7tgn49j.js} +12 -15
- package/dist/{index-ke416mdc.js → index-j76ah6d7.js} +2 -2
- package/dist/{index-r4nkrs05.js → index-jfh3cktr.js} +4 -4
- package/dist/{index-a6mc0v4d.js → index-jmycsey7.js} +3 -3
- package/dist/{index-24fezq97.js → index-jr5na10t.js} +4 -4
- package/dist/{index-s74zqahq.js → index-kc9pn495.js} +4 -4
- package/dist/{index-p5y3k4g7.js → index-nda0zgna.js} +2 -1
- package/dist/{index-jn12fvvh.js → index-neb2jaed.js} +3 -3
- package/dist/{index-qn7xstt2.js → index-pnjwa6qa.js} +6 -7
- package/dist/{index-fgncb0ng.js → index-rmd0069m.js} +11 -11
- package/dist/{index-y9f76s3f.js → index-rrv26qjz.js} +1 -1
- package/dist/{index-v10f1rjv.js → index-spwjbkc7.js} +1 -1
- package/dist/{index-k29z4aqh.js → index-t5pck3ss.js} +1 -1
- package/dist/{index-936py2wm.js → index-t7hx3qcb.js} +361 -113
- package/dist/{index-s1ex9y6p.js → index-v7r4td4c.js} +464 -79
- package/dist/{index-2vxtcb95.js → index-vkc1ca9p.js} +2 -2
- package/dist/{index-rmwykbbb.js → index-x4k3f4mf.js} +33 -10
- package/dist/{index-bp5083x2.js → index-x9k3mqrf.js} +1 -1
- package/dist/{index-n37sebck.js → index-y4a3nhtk.js} +1 -1
- package/dist/index.js +57 -50
- package/dist/{logger-jm3sqqzr.js → logger-94kew5wm.js} +1 -1
- package/dist/{message-fts-rowid-map-17s0dfn4.js → message-fts-rowid-map-22tevnnj.js} +6 -5
- package/dist/{message-index-66jv6fh4.js → message-index-5qxcz6h7.js} +16 -15
- package/dist/{message-index-bounded-n1frdn85.js → message-index-bounded-n0m0t7tv.js} +16 -15
- package/dist/{message-time-backfill-73mmm76q.js → message-time-backfill-0myx7fz3.js} +3 -3
- package/dist/migration-worker.js +13 -12
- package/dist/{model-resolution-nx97z3x7.js → model-resolution-280gmqvd.js} +1 -1
- package/dist/plugin/embedding-bootstrap.d.ts +3 -1
- package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +8 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/subagent-tool-policy.d.ts +9 -0
- package/dist/plugin/subagent-tool-policy.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{project-embedding-registry-z74mhqkf.js → project-embedding-registry-s2pqgec9.js} +13 -12
- package/dist/raw-ordinal-warmup-worker.js +136 -101
- package/dist/{read-session-chunk-v06g3vka.js → read-session-chunk-0a8vdyqp.js} +11 -10
- package/dist/{read-session-raw-rsc8c7qy.js → read-session-raw-y5cszf0b.js} +4 -3
- package/dist/recomp-orchestrator-61vyha9j.js +62 -0
- package/dist/{safe-notification-target-1szv1k5k.js → safe-notification-target-mkr9yzvr.js} +2 -2
- package/dist/{search-archive-4d53y23e.js → search-archive-8q9s49p5.js} +12 -11
- package/dist/{search-nkf271d4.js → search-v1y9ejws.js} +25 -24
- package/dist/{send-session-notification-6ve0e8p4.js → send-session-notification-0k6qzydk.js} +7 -6
- package/dist/shared/logger.d.ts.map +1 -1
- package/dist/shared/model-resolution.d.ts +2 -0
- package/dist/shared/model-resolution.d.ts.map +1 -1
- package/dist/shared/model-suggestion-retry.d.ts +30 -1
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/prompt-async-transport.d.ts +3 -0
- package/dist/shared/prompt-async-transport.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +7 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts +1 -1
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/subagent-runner.d.ts +2 -0
- package/dist/shared/subagent-runner.d.ts.map +1 -1
- package/dist/shared/worker-shutdown.d.ts +68 -0
- package/dist/shared/worker-shutdown.d.ts.map +1 -0
- package/dist/shared/worker-shutdown.fixture.d.ts +2 -0
- package/dist/shared/worker-shutdown.fixture.d.ts.map +1 -0
- package/dist/{sqlite-zf72c52d.js → sqlite-1rpvw2rj.js} +1 -1
- package/dist/{storage-memory-y3qmy00r.js → storage-memory-nm7v82mj.js} +2 -2
- package/dist/{storage-tags-r7k9tjcv.js → storage-tags-r6nk29n4.js} +5 -5
- package/dist/{task-config-x3qmayd2.js → task-config-t6bpyka7.js} +2 -2
- package/dist/tools/ctx-expand/rust-mode-tag.test-support.d.ts +15 -0
- package/dist/tools/ctx-expand/rust-mode-tag.test-support.d.ts.map +1 -0
- package/dist/tools/ctx-expand/tools.d.ts +11 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-zpgav0h7.js → transform-postprocess-phase-vtrgb7m6.js} +34 -31
- package/dist/v2/auto-search-worker.js +53 -10
- package/dist/v2/chunk-embedding-write-worker.js +30 -23
- package/dist/v2/{compaction-marker-candidates-ebx3388k.js → compaction-marker-candidates-cfab70cs.js} +3 -3
- package/dist/v2/compaction-marker-candidates-worker.js +2 -2
- package/dist/v2/compartment-chunk-embedding-nbdqx1td.js +64 -0
- package/dist/v2/{context-f2xh7ba4.js → context-cc33tv2z.js} +1259 -404
- package/dist/v2/{derive-budgets-2zh4gm2c.js → derive-budgets-knf763tt.js} +3 -3
- package/dist/v2/embedding-backfill-yxv2h5mc.js +24 -0
- package/dist/v2/embedding-worker-process.js +2 -2
- package/dist/v2/embedding-worker.js +5 -5
- package/dist/v2/hidden-child-record.d.ts +2 -0
- package/dist/v2/hidden-child-record.d.ts.map +1 -1
- package/dist/v2/hidden-completion.d.ts +2 -0
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/hidden-model-activity.d.ts +7 -0
- package/dist/v2/hidden-model-activity.d.ts.map +1 -0
- package/dist/v2/{history-owner-42e16w0n.js → history-owner-ad0crnrn.js} +2 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/generate.d.ts +36 -1
- package/dist/v2/hooks/generate.d.ts.map +1 -1
- package/dist/v2/hooks/lkg-system.d.ts +35 -4
- package/dist/v2/hooks/lkg-system.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts +16 -1
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/tools.d.ts.map +1 -1
- package/dist/v2/{logger-7qt02bnb.js → logger-p34mjtja.js} +1 -1
- package/dist/v2/{message-fts-rowid-map-wfx67gfd.js → message-fts-rowid-map-dg12wymk.js} +6 -5
- package/dist/v2/{message-index-bounded-w3hfm29z.js → message-index-bounded-f4e01xk0.js} +16 -15
- package/dist/v2/{message-index-48f7hw7a.js → message-index-ydzrp6y6.js} +16 -15
- package/dist/v2/{message-time-backfill-04t0km1z.js → message-time-backfill-ddh8n9gy.js} +3 -3
- package/dist/v2/migration-worker.js +13 -12
- package/dist/v2/{model-resolution-nx97z3x7.js → model-resolution-280gmqvd.js} +1 -1
- package/dist/v2/{project-embedding-registry-gnkj56xp.js → project-embedding-registry-deza9ksw.js} +13 -12
- package/dist/v2/raw-ordinal-warmup-worker.js +136 -101
- package/dist/v2/{read-session-chunk-zpgmxwte.js → read-session-chunk-8cxfagky.js} +11 -10
- package/dist/v2/{read-session-raw-yaegtjzh.js → read-session-raw-1nrrecvx.js} +4 -3
- package/dist/v2/recomp-orchestrator-47m4hv5g.js +61 -0
- package/dist/v2/{safe-notification-target-qg7n2s77.js → safe-notification-target-khnzg57c.js} +2 -2
- package/dist/v2/{search-archive-vv48s2aa.js → search-archive-e80cvc09.js} +12 -11
- package/dist/v2/{search-kza414f0.js → search-fjz746zr.js} +25 -24
- package/dist/v2/{send-session-notification-3pxn658x.js → send-session-notification-nwvrv34d.js} +7 -6
- package/dist/v2/{server-8by8qfec.js → server-0epqaxhd.js} +75 -57
- package/dist/v2/{server-pwv4ezb0.js → server-168pb207.js} +1 -1
- package/dist/v2/{server-h0410h0v.js → server-1bw1wcbp.js} +1 -1
- package/dist/{index-beht37jy.js → v2/server-1zx2pa5d.js} +1 -1
- package/dist/v2/{server-a9xqj88f.js → server-230fnbws.js} +4 -4
- package/dist/v2/{server-tbe1femw.js → server-29qp8nz4.js} +1 -1
- package/dist/v2/{server-tgnbmwah.js → server-3mz2qh5a.js} +1 -1
- package/dist/v2/{server-hy3d3vsx.js → server-4nw4fqhr.js} +2 -2
- package/dist/v2/{server-qv7f0hhe.js → server-4sxjs6hn.js} +5 -5
- package/dist/v2/{server-34kwfsr4.js → server-53eh1r8r.js} +2 -2
- package/dist/v2/{server-xj136kt8.js → server-55rgxfrw.js} +9 -3
- package/dist/v2/{server-nj659894.js → server-5arr9ecn.js} +2 -2
- package/dist/{index-8cd2j99z.js → v2/server-5kym00ag.js} +32 -13
- package/dist/v2/{server-2ehj0bw7.js → server-63fqdghs.js} +106 -20
- package/dist/v2/{server-f2xf5gcb.js → server-6495nmn9.js} +12 -15
- package/dist/v2/{server-qd11g795.js → server-92g7d776.js} +2 -1
- package/dist/v2/{server-gpvay0xz.js → server-9x0kmta4.js} +6 -7
- package/dist/v2/{server-27gq4mfz.js → server-a3dwxfgd.js} +4 -4
- package/dist/v2/{server-6tmj0s7j.js → server-af2pght7.js} +3 -3
- package/dist/v2/{server-1wy7b9de.js → server-br1x0tev.js} +3 -3
- package/dist/v2/{server-n1prf1g6.js → server-brj8j2gk.js} +2 -2
- package/dist/v2/{server-bfpda1tb.js → server-c7dxxsj7.js} +466 -81
- package/dist/v2/server-cpjk5jd2.js +82 -0
- package/dist/v2/{server-g3qma5c0.js → server-dj7tz4ph.js} +2 -2
- package/dist/v2/{server-xhab8jx8.js → server-ej96a39v.js} +33 -10
- package/dist/v2/{server-6pmqg9m4.js → server-gyy4k6mf.js} +1 -1
- package/dist/v2/{server-a2eqhkxr.js → server-hqzyq8n4.js} +11 -11
- package/dist/v2/{server-h1v0pyxb.js → server-j4jnp9b5.js} +468 -18
- package/dist/v2/{server-da07v4xp.js → server-k3t06fxr.js} +1 -1
- package/dist/v2/{server-1nyybqan.js → server-m91f9m5s.js} +69 -17
- package/dist/v2/{server-rmygf5pn.js → server-ne8arh8t.js} +2 -2
- package/dist/v2/{server-my7k4eds.js → server-vn2nwcv6.js} +5 -5
- package/dist/v2/{server-46neh5fa.js → server-wyawsa88.js} +314 -127
- package/dist/v2/{server-zzkj2fch.js → server-xsryvyf6.js} +4 -4
- package/dist/v2/{server-n37sebck.js → server-y4a3nhtk.js} +1 -1
- package/dist/v2/{server-d04vrx0j.js → server-ygtykank.js} +2 -2
- package/dist/v2/server.js +6 -6
- package/dist/v2/{sqlite-zf72c52d.js → sqlite-1rpvw2rj.js} +1 -1
- package/dist/v2/{storage-memory-y3qmy00r.js → storage-memory-nm7v82mj.js} +2 -2
- package/dist/v2/{storage-tags-3wdb8zph.js → storage-tags-ss08kj5r.js} +5 -5
- package/dist/v2/store-reader.d.ts +8 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{task-config-nvz8mapa.js → task-config-7md27rx8.js} +2 -2
- package/dist/v2/{wrapup-orchestrator-psqz7yh0.js → wrapup-orchestrator-639whfhq.js} +32 -31
- package/dist/wrapup-orchestrator-mnvt2g8m.js +49 -0
- package/package.json +1 -1
- package/src/config/index.test.ts +28 -6
- package/src/shared/logger.test.ts +42 -1
- package/src/shared/logger.ts +11 -13
- package/src/shared/model-resolution.test.ts +67 -12
- package/src/shared/model-resolution.ts +43 -16
- package/src/shared/model-suggestion-retry.test.ts +166 -0
- package/src/shared/model-suggestion-retry.ts +165 -14
- package/src/shared/prompt-async-transport.test.ts +107 -0
- package/src/shared/prompt-async-transport.ts +86 -3
- package/src/shared/rpc-types.ts +7 -0
- package/src/shared/sqlite-busy-budget-review.test.ts +6 -1
- package/src/shared/sqlite.ts +4 -2
- package/src/shared/subagent-runner.ts +2 -0
- package/src/shared/worker-shutdown-fence.test.ts +87 -0
- package/src/shared/worker-shutdown.fixture.ts +25 -0
- package/src/shared/worker-shutdown.test.ts +127 -0
- package/src/shared/worker-shutdown.ts +160 -0
- package/dist/embedding-backfill-fmz50tsy.js +0 -24
- package/dist/recomp-orchestrator-ghpk2dtq.js +0 -61
- package/dist/v2/embedding-backfill-7c7yr69y.js +0 -23
- package/dist/v2/recomp-orchestrator-4vfxej9t.js +0 -60
- package/dist/wrapup-orchestrator-s9zc5b00.js +0 -48
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
sanitizeDiagnosticText,
|
|
10
10
|
log2,
|
|
11
11
|
sessionLog2
|
|
12
|
-
} from "./server-
|
|
12
|
+
} from "./server-6495nmn9.js";
|
|
13
13
|
import {
|
|
14
14
|
parseTree,
|
|
15
15
|
parseJsoncRecovering,
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
cortexKitProjectConfigBasePath,
|
|
19
19
|
resolveLegacyConfigSourcesForHarness,
|
|
20
20
|
loadPluginConfigDetailed
|
|
21
|
-
} from "./server-
|
|
21
|
+
} from "./server-5arr9ecn.js";
|
|
22
22
|
import {
|
|
23
23
|
catalogOutputReserve,
|
|
24
24
|
getSdkContextLimit,
|
|
25
25
|
modelSupportsVision,
|
|
26
26
|
getSdkOutputLimit
|
|
27
|
-
} from "./server-
|
|
27
|
+
} from "./server-29qp8nz4.js";
|
|
28
28
|
import {
|
|
29
29
|
withContentLanguageDirective,
|
|
30
30
|
buildPrimaryLanguageDirective,
|
|
@@ -40,12 +40,12 @@ import {
|
|
|
40
40
|
getProjectChunkEmbeddingModelId2,
|
|
41
41
|
getProjectEmbeddingMaxInputTokens2,
|
|
42
42
|
embedItemsForProject2
|
|
43
|
-
} from "./server-
|
|
43
|
+
} from "./server-0epqaxhd.js";
|
|
44
44
|
import {
|
|
45
45
|
hasMeaningfulUserText2,
|
|
46
46
|
estimateTokens,
|
|
47
47
|
estimateFixedPromptTokens
|
|
48
|
-
} from "./server-
|
|
48
|
+
} from "./server-3mz2qh5a.js";
|
|
49
49
|
import {
|
|
50
50
|
inRootAsyncContext2,
|
|
51
51
|
Database2,
|
|
@@ -53,26 +53,26 @@ import {
|
|
|
53
53
|
withSqliteBackgroundWriter2,
|
|
54
54
|
withoutSqliteTransformPass2,
|
|
55
55
|
beginSqliteWriterAsync2
|
|
56
|
-
} from "./server-
|
|
56
|
+
} from "./server-1zx2pa5d.js";
|
|
57
57
|
import {
|
|
58
58
|
isStrictGapHealingMessage2,
|
|
59
59
|
noteRawSessionSummaryRowWritten2,
|
|
60
60
|
RawOrdinalsNotReady2,
|
|
61
61
|
runSessionWarmupWorker
|
|
62
|
-
} from "./server-
|
|
62
|
+
} from "./server-55rgxfrw.js";
|
|
63
63
|
import {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
} from "./server-
|
|
64
|
+
buildCanonicalChunkTextFromFts2,
|
|
65
|
+
buildCompartmentSummaryFallbackText2,
|
|
66
|
+
canonicalizeInMemoryChunkTextForEmbedding2,
|
|
67
|
+
chunkCanonicalText2,
|
|
68
|
+
chunkEmbeddingWindowsAreCurrent2,
|
|
69
|
+
replaceCompartmentChunkEmbeddings2,
|
|
70
|
+
deleteChunkEmbedBackoffForSession2,
|
|
71
|
+
chunkWindowSourceKey2
|
|
72
|
+
} from "./server-wyawsa88.js";
|
|
73
73
|
import {
|
|
74
74
|
isPidAlive
|
|
75
|
-
} from "./server-
|
|
75
|
+
} from "./server-k3t06fxr.js";
|
|
76
76
|
import {
|
|
77
77
|
BoundedSessionMap,
|
|
78
78
|
clearCompressionDepth,
|
|
@@ -89,7 +89,7 @@ import {
|
|
|
89
89
|
toMessageIndexSource2,
|
|
90
90
|
clearIndexedMessagesInTransaction2,
|
|
91
91
|
indexSourcesAfterOrdinal2
|
|
92
|
-
} from "./server-
|
|
92
|
+
} from "./server-63fqdghs.js";
|
|
93
93
|
import {
|
|
94
94
|
detectOverflow,
|
|
95
95
|
SESSION_META_SELECT_COLUMNS,
|
|
@@ -130,6 +130,7 @@ import {
|
|
|
130
130
|
isRustMarkerAdmissionFenced,
|
|
131
131
|
readReplayEnvelope,
|
|
132
132
|
readReplayDocument,
|
|
133
|
+
updateReplayDocument,
|
|
133
134
|
writeReplayDocument,
|
|
134
135
|
describeProtectedTailDrainBudgetSkip,
|
|
135
136
|
loadProtectedTailMeta,
|
|
@@ -160,6 +161,7 @@ import {
|
|
|
160
161
|
serializeStrippedPlaceholderState,
|
|
161
162
|
THINKING_BINDING_RECOVERY_FROZEN_PREFIX,
|
|
162
163
|
THINKING_BINDING_STRIP_ORDER_END_MARKER,
|
|
164
|
+
COMPACTION_OFF_THINKING_FROZEN_PREFIX,
|
|
163
165
|
getMergedReasoningStrippedIds,
|
|
164
166
|
addMergedReasoningStrippedIds,
|
|
165
167
|
parseProcessedImageMarkers,
|
|
@@ -185,17 +187,17 @@ import {
|
|
|
185
187
|
getRawSessionTagKeysThrough2,
|
|
186
188
|
getLegacyProtectedTailStartOrdinal2,
|
|
187
189
|
readSessionChunk2
|
|
188
|
-
} from "./server-
|
|
190
|
+
} from "./server-ej96a39v.js";
|
|
189
191
|
import {
|
|
190
192
|
getTableColumnNames
|
|
191
|
-
} from "./server-
|
|
193
|
+
} from "./server-168pb207.js";
|
|
192
194
|
import {
|
|
193
195
|
FAIL_CLOSED_DOCTOR_COMMAND,
|
|
194
196
|
getSchemaFenceRejection,
|
|
195
197
|
LATEST_SUPPORTED_VERSION,
|
|
196
198
|
getPersistedSchemaVersion,
|
|
197
199
|
openDatabase
|
|
198
|
-
} from "./server-
|
|
200
|
+
} from "./server-hqzyq8n4.js";
|
|
199
201
|
import {
|
|
200
202
|
providerMass,
|
|
201
203
|
calibrationForModelKey,
|
|
@@ -213,7 +215,7 @@ import {
|
|
|
213
215
|
foldShrunkPartTags2,
|
|
214
216
|
getTagNumberByMessageId2,
|
|
215
217
|
getActiveTagsBySession2
|
|
216
|
-
} from "./server-
|
|
218
|
+
} from "./server-a3dwxfgd.js";
|
|
217
219
|
import {
|
|
218
220
|
resolveOpenCodeDbPath,
|
|
219
221
|
assertOpenCodeStoreGeneration,
|
|
@@ -224,10 +226,10 @@ import {
|
|
|
224
226
|
openCodeDbExists,
|
|
225
227
|
withReadOnlySessionDb,
|
|
226
228
|
getMessageTimesFromOpenCodeDb
|
|
227
|
-
} from "./server-
|
|
229
|
+
} from "./server-brj8j2gk.js";
|
|
228
230
|
import {
|
|
229
231
|
getMeasuredToolDefinitionTokens
|
|
230
|
-
} from "./server-
|
|
232
|
+
} from "./server-dj7tz4ph.js";
|
|
231
233
|
import {
|
|
232
234
|
V2_MEMORY_CATEGORIES,
|
|
233
235
|
CATEGORY_PRIORITY,
|
|
@@ -243,11 +245,11 @@ import {
|
|
|
243
245
|
resolveStoredPathWorkspaceIdentity,
|
|
244
246
|
sourceNameForMemory,
|
|
245
247
|
computeWorkspaceEpochFingerprint
|
|
246
|
-
} from "./server-
|
|
248
|
+
} from "./server-9x0kmta4.js";
|
|
247
249
|
import {
|
|
248
250
|
shouldSkipHomeProjectMemory,
|
|
249
251
|
resolveProjectIdentity
|
|
250
|
-
} from "./server-
|
|
252
|
+
} from "./server-ne8arh8t.js";
|
|
251
253
|
import {
|
|
252
254
|
getSessionNotes,
|
|
253
255
|
getReadySmartNotes,
|
|
@@ -256,13 +258,13 @@ import {
|
|
|
256
258
|
userFacingFailureCode,
|
|
257
259
|
promoteSessionFactsDurable,
|
|
258
260
|
embedPromotedFacts
|
|
259
|
-
} from "./server-
|
|
261
|
+
} from "./server-vn2nwcv6.js";
|
|
260
262
|
import {
|
|
261
263
|
isMarkerCandidateBasisCurrent2,
|
|
262
264
|
invalidateMarkerCandidateBasis2,
|
|
263
265
|
readMarkerCandidateBasis2,
|
|
264
266
|
prepareMarkerCandidateBasis2
|
|
265
|
-
} from "./server-
|
|
267
|
+
} from "./server-ygtykank.js";
|
|
266
268
|
import {
|
|
267
269
|
computeCueContentHash,
|
|
268
270
|
getMuralCueState,
|
|
@@ -270,7 +272,7 @@ import {
|
|
|
270
272
|
getMemoriesByProject2,
|
|
271
273
|
getMemoriesByProjects2,
|
|
272
274
|
getMaxMemoryIdForProjects2
|
|
273
|
-
} from "./server-
|
|
275
|
+
} from "./server-y4a3nhtk.js";
|
|
274
276
|
import {
|
|
275
277
|
pushNotification2
|
|
276
278
|
} from "./server-x8a7jmkh.js";
|
|
@@ -278,10 +280,10 @@ import {
|
|
|
278
280
|
deriveTriggerBudget2,
|
|
279
281
|
resolveHistorianProducerLimits2,
|
|
280
282
|
producerSourceLocalBudget2
|
|
281
|
-
} from "./server-
|
|
283
|
+
} from "./server-53eh1r8r.js";
|
|
282
284
|
import {
|
|
283
285
|
sendStatusNotification2
|
|
284
|
-
} from "./server-
|
|
286
|
+
} from "./server-230fnbws.js";
|
|
285
287
|
import {
|
|
286
288
|
piModelRefToCanonical
|
|
287
289
|
} from "./server-avwt563y.js";
|
|
@@ -295,7 +297,7 @@ import {
|
|
|
295
297
|
import {
|
|
296
298
|
logSlowWriteTransaction,
|
|
297
299
|
WriteTransactionSteps
|
|
298
|
-
} from "./server-
|
|
300
|
+
} from "./server-gyy4k6mf.js";
|
|
299
301
|
|
|
300
302
|
// src/config/live-snapshot.ts
|
|
301
303
|
import { createHash } from "node:crypto";
|
|
@@ -2521,6 +2523,34 @@ function noteLkgCapturedPrefix(sessionId) {
|
|
|
2521
2523
|
if (!sessions.has(sessionId))
|
|
2522
2524
|
sessions.set(sessionId, {});
|
|
2523
2525
|
}
|
|
2526
|
+
function readPersistedLkgUntaggedInputIds(db, sessionId) {
|
|
2527
|
+
try {
|
|
2528
|
+
const saved = readReplayEnvelope(db, sessionId, "read").lkgUntaggedInputIds;
|
|
2529
|
+
return Array.isArray(saved) ? saved.filter((id) => typeof id === "string" && id.length > 0) : [];
|
|
2530
|
+
} catch (error) {
|
|
2531
|
+
sessionLog2(sessionId, "LKG untagged-input record unreadable:", error);
|
|
2532
|
+
return [];
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
function persistLkgUntaggedInputIds(db, sessionId, ids) {
|
|
2536
|
+
const next = [...new Set(ids)].sort();
|
|
2537
|
+
try {
|
|
2538
|
+
return updateReplayDocument(db, sessionId, (doc) => {
|
|
2539
|
+
const saved = Array.isArray(doc.lkgUntaggedInputIds) ? doc.lkgUntaggedInputIds : [];
|
|
2540
|
+
if (JSON.stringify(saved) === JSON.stringify(next))
|
|
2541
|
+
return false;
|
|
2542
|
+
doc.version = 2;
|
|
2543
|
+
if (next.length > 0)
|
|
2544
|
+
doc.lkgUntaggedInputIds = next;
|
|
2545
|
+
else
|
|
2546
|
+
delete doc.lkgUntaggedInputIds;
|
|
2547
|
+
return true;
|
|
2548
|
+
});
|
|
2549
|
+
} catch (error) {
|
|
2550
|
+
sessionLog2(sessionId, "LKG untagged-input record write failed:", error);
|
|
2551
|
+
return false;
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2524
2554
|
function noteLkgRecoveryPrefix(args) {
|
|
2525
2555
|
const digests = [
|
|
2526
2556
|
...args.entry.entryContentDigests,
|
|
@@ -2531,19 +2561,23 @@ function noteLkgRecoveryPrefix(args) {
|
|
|
2531
2561
|
const ids = args.entry.entryInputIds;
|
|
2532
2562
|
if (ids.some((id) => !id) || new Set(ids).size !== ids.length)
|
|
2533
2563
|
return false;
|
|
2564
|
+
const untaggedInputIds = new Set([
|
|
2565
|
+
...sessions.get(args.sessionId)?.prefix?.untaggedInputIds ?? [],
|
|
2566
|
+
...args.db ? readPersistedLkgUntaggedInputIds(args.db, args.sessionId) : [],
|
|
2567
|
+
...ids.slice(args.entry.anchorIndex + 1)
|
|
2568
|
+
]);
|
|
2534
2569
|
sessions.set(args.sessionId, {
|
|
2535
2570
|
fenceRevision: sessions.get(args.sessionId)?.fenceRevision,
|
|
2536
2571
|
prefix: {
|
|
2537
2572
|
inputs: ids.map((id, index) => ({ id, digest: digests[index] })),
|
|
2538
2573
|
json: JSON.stringify(args.messages),
|
|
2539
|
-
untaggedInputIds
|
|
2540
|
-
...sessions.get(args.sessionId)?.prefix?.untaggedInputIds ?? [],
|
|
2541
|
-
...ids.slice(args.entry.anchorIndex + 1)
|
|
2542
|
-
]),
|
|
2574
|
+
untaggedInputIds,
|
|
2543
2575
|
modelKey: args.modelKey,
|
|
2544
2576
|
providerKey: args.providerKey
|
|
2545
2577
|
}
|
|
2546
2578
|
});
|
|
2579
|
+
if (args.db)
|
|
2580
|
+
persistLkgUntaggedInputIds(args.db, args.sessionId, untaggedInputIds);
|
|
2547
2581
|
return true;
|
|
2548
2582
|
}
|
|
2549
2583
|
function readLkgRecoveryPrefix(sessionId, inputs, messages, db) {
|
|
@@ -3543,11 +3577,15 @@ function clonePiContentDecisions(raw, filter) {
|
|
|
3543
3577
|
])}`);
|
|
3544
3578
|
continue;
|
|
3545
3579
|
}
|
|
3546
|
-
|
|
3547
|
-
|
|
3580
|
+
const thinkingPrefix = [
|
|
3581
|
+
THINKING_BINDING_RECOVERY_FROZEN_PREFIX,
|
|
3582
|
+
COMPACTION_OFF_THINKING_FROZEN_PREFIX
|
|
3583
|
+
].find((prefix) => entry.startsWith(prefix));
|
|
3584
|
+
if (thinkingPrefix) {
|
|
3585
|
+
const messageId = entry.slice(thinkingPrefix.length);
|
|
3548
3586
|
if (messageId.length === 0 || !filter.includeMessageId(messageId))
|
|
3549
3587
|
continue;
|
|
3550
|
-
copied.push(`${
|
|
3588
|
+
copied.push(`${thinkingPrefix}${mapMessageId(filter, messageId) ?? messageId}`);
|
|
3551
3589
|
continue;
|
|
3552
3590
|
}
|
|
3553
3591
|
if (entry.startsWith(MERGED_REASONING_PARTS_PREFIX) || entry.startsWith("pi-content-replay-"))
|
|
@@ -5580,19 +5618,19 @@ async function embedAndStoreCompartmentChunks(db, sessionId, projectPath, compar
|
|
|
5580
5618
|
const maxInputTokens = getProjectEmbeddingMaxInputTokens2(projectPath);
|
|
5581
5619
|
for (const compartment of compartments) {
|
|
5582
5620
|
try {
|
|
5583
|
-
const fromMemory = compartment.sourceChunkText ?
|
|
5584
|
-
const mappedText = fromMemory ? fromMemory :
|
|
5621
|
+
const fromMemory = compartment.sourceChunkText ? canonicalizeInMemoryChunkTextForEmbedding2(compartment.sourceChunkText, compartment.startMessage, compartment.endMessage) : "";
|
|
5622
|
+
const mappedText = fromMemory ? fromMemory : buildCanonicalChunkTextFromFts2(db, sessionId, compartment.startMessage, compartment.endMessage);
|
|
5585
5623
|
if (mappedText === null)
|
|
5586
5624
|
continue;
|
|
5587
|
-
const canonicalText = mappedText ||
|
|
5625
|
+
const canonicalText = mappedText || buildCompartmentSummaryFallbackText2(db, compartment.id);
|
|
5588
5626
|
if (canonicalText.length === 0)
|
|
5589
5627
|
continue;
|
|
5590
|
-
const windows =
|
|
5628
|
+
const windows = chunkCanonicalText2(canonicalText, compartment.startMessage, compartment.endMessage, maxInputTokens);
|
|
5591
5629
|
if (windows.length === 0)
|
|
5592
5630
|
continue;
|
|
5593
|
-
const windowSourceKey =
|
|
5631
|
+
const windowSourceKey = chunkWindowSourceKey2(canonicalText, compartment.startMessage, compartment.endMessage, maxInputTokens);
|
|
5594
5632
|
const currentModelId = getProjectChunkEmbeddingModelId2(projectPath);
|
|
5595
|
-
if (currentModelId !== "off" &&
|
|
5633
|
+
if (currentModelId !== "off" && chunkEmbeddingWindowsAreCurrent2(db, compartment.id, currentModelId, windows, projectPath)) {
|
|
5596
5634
|
continue;
|
|
5597
5635
|
}
|
|
5598
5636
|
const result = await embedItemsForProject2(projectPath, windows.map((window) => ({
|
|
@@ -5602,7 +5640,7 @@ async function embedAndStoreCompartmentChunks(db, sessionId, projectPath, compar
|
|
|
5602
5640
|
})), undefined, db, sessionId);
|
|
5603
5641
|
if (!result)
|
|
5604
5642
|
continue;
|
|
5605
|
-
if (
|
|
5643
|
+
if (chunkEmbeddingWindowsAreCurrent2(db, compartment.id, currentModelId, windows, projectPath)) {
|
|
5606
5644
|
continue;
|
|
5607
5645
|
}
|
|
5608
5646
|
const rows = [];
|
|
@@ -5620,7 +5658,7 @@ async function embedAndStoreCompartmentChunks(db, sessionId, projectPath, compar
|
|
|
5620
5658
|
});
|
|
5621
5659
|
}
|
|
5622
5660
|
if (rows.length === windows.length) {
|
|
5623
|
-
|
|
5661
|
+
replaceCompartmentChunkEmbeddings2(db, rows, windowSourceKey);
|
|
5624
5662
|
enqueueShadowEmbeddingItems2(projectPath, "chunk", [String(compartment.id)]);
|
|
5625
5663
|
}
|
|
5626
5664
|
} catch (error) {
|
|
@@ -6466,9 +6504,33 @@ var promptFailureDetails = new WeakMap;
|
|
|
6466
6504
|
function isHostTimeoutError(error) {
|
|
6467
6505
|
return error !== null && typeof error === "object" && error.name === "TimeoutError";
|
|
6468
6506
|
}
|
|
6507
|
+
|
|
6508
|
+
class ModelProducedNoOutputError extends Error {
|
|
6509
|
+
waitedMs;
|
|
6510
|
+
constructor(waitedMs) {
|
|
6511
|
+
super(`prompt timed out after ${waitedMs}ms with no model output`);
|
|
6512
|
+
this.waitedMs = waitedMs;
|
|
6513
|
+
this.name = "ModelProducedNoOutputError";
|
|
6514
|
+
}
|
|
6515
|
+
}
|
|
6516
|
+
var modelActivityBySignal = new WeakMap;
|
|
6517
|
+
function noteModelActivityMonitored(signal) {
|
|
6518
|
+
const activity = signal ? modelActivityBySignal.get(signal) : undefined;
|
|
6519
|
+
if (activity)
|
|
6520
|
+
activity.monitored = true;
|
|
6521
|
+
}
|
|
6522
|
+
function noteModelOutputReceived(signal) {
|
|
6523
|
+
const activity = signal ? modelActivityBySignal.get(signal) : undefined;
|
|
6524
|
+
if (activity) {
|
|
6525
|
+
activity.monitored = true;
|
|
6526
|
+
activity.received = true;
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6469
6529
|
function isPromptTimeoutError(error) {
|
|
6470
6530
|
if (isHostTimeoutError(error))
|
|
6471
6531
|
return true;
|
|
6532
|
+
if (error instanceof ModelProducedNoOutputError)
|
|
6533
|
+
return true;
|
|
6472
6534
|
return error instanceof Error && /^prompt timed out after \d+ms$/.test(error.message);
|
|
6473
6535
|
}
|
|
6474
6536
|
function getPromptFailureDetail(error) {
|
|
@@ -6546,12 +6608,22 @@ function raceWithSignal(work, signal) {
|
|
|
6546
6608
|
work.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
6547
6609
|
});
|
|
6548
6610
|
}
|
|
6549
|
-
async function promptWithTimeout(client, args, timeoutMs, signal, transport) {
|
|
6611
|
+
async function promptWithTimeout(client, args, timeoutMs, signal, transport, firstOutputTimeoutMs) {
|
|
6550
6612
|
if (signal?.aborted) {
|
|
6551
6613
|
throw new Error(externalAbortMessage(signal));
|
|
6552
6614
|
}
|
|
6553
6615
|
const controller = new AbortController;
|
|
6554
6616
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
6617
|
+
const activity = { monitored: false, received: false };
|
|
6618
|
+
modelActivityBySignal.set(controller.signal, activity);
|
|
6619
|
+
let silent = false;
|
|
6620
|
+
const firstOutputTimer = firstOutputTimeoutMs !== undefined && firstOutputTimeoutMs < timeoutMs ? setTimeout(() => {
|
|
6621
|
+
if (!activity.monitored || activity.received)
|
|
6622
|
+
return;
|
|
6623
|
+
silent = true;
|
|
6624
|
+
controller.abort(new ModelProducedNoOutputError(firstOutputTimeoutMs));
|
|
6625
|
+
}, firstOutputTimeoutMs) : undefined;
|
|
6626
|
+
const timeoutError = () => silent && firstOutputTimeoutMs !== undefined ? new ModelProducedNoOutputError(firstOutputTimeoutMs) : new Error(`prompt timed out after ${timeoutMs}ms`);
|
|
6555
6627
|
const onExternalAbort = () => controller.abort();
|
|
6556
6628
|
signal?.addEventListener("abort", onExternalAbort);
|
|
6557
6629
|
try {
|
|
@@ -6574,7 +6646,7 @@ async function promptWithTimeout(client, args, timeoutMs, signal, transport) {
|
|
|
6574
6646
|
if (!transport || transport.childSessionId) {
|
|
6575
6647
|
await abortChildRun(client, transport?.childSessionId ?? args.path.id);
|
|
6576
6648
|
}
|
|
6577
|
-
throw
|
|
6649
|
+
throw timeoutError();
|
|
6578
6650
|
}
|
|
6579
6651
|
if (isHostTimeoutError(error)) {
|
|
6580
6652
|
if (!transport || transport.childSessionId) {
|
|
@@ -6584,13 +6656,15 @@ async function promptWithTimeout(client, args, timeoutMs, signal, transport) {
|
|
|
6584
6656
|
throw error;
|
|
6585
6657
|
} finally {
|
|
6586
6658
|
clearTimeout(timeout);
|
|
6659
|
+
if (firstOutputTimer)
|
|
6660
|
+
clearTimeout(firstOutputTimer);
|
|
6587
6661
|
signal?.removeEventListener("abort", onExternalAbort);
|
|
6588
6662
|
}
|
|
6589
6663
|
if (signal?.aborted || controller.signal.aborted) {
|
|
6590
6664
|
if (!transport || transport.childSessionId) {
|
|
6591
6665
|
await abortChildRun(client, transport?.childSessionId ?? args.path.id);
|
|
6592
6666
|
}
|
|
6593
|
-
throw
|
|
6667
|
+
throw signal?.aborted ? new Error(externalAbortMessage(signal)) : timeoutError();
|
|
6594
6668
|
}
|
|
6595
6669
|
}
|
|
6596
6670
|
async function abortChildRun(client, sessionId) {
|
|
@@ -6608,6 +6682,8 @@ async function abortChildRun(client, sessionId) {
|
|
|
6608
6682
|
function isNonRetryable(error, externalSignal) {
|
|
6609
6683
|
if (externalSignal?.aborted || error instanceof HiddenCompletionRefusal && error.terminal || error instanceof HiddenAgentStepLimit || error instanceof DreamTokenBudgetExceeded)
|
|
6610
6684
|
return true;
|
|
6685
|
+
if (error instanceof ModelProducedNoOutputError)
|
|
6686
|
+
return false;
|
|
6611
6687
|
if (error instanceof Error) {
|
|
6612
6688
|
if (error.name === "AbortError")
|
|
6613
6689
|
return true;
|
|
@@ -6639,7 +6715,7 @@ function classifyPromptFailure(error, phase, externalSignal) {
|
|
|
6639
6715
|
if (externalSignal?.aborted || message === "prompt aborted by external signal") {
|
|
6640
6716
|
return "child_aborted";
|
|
6641
6717
|
}
|
|
6642
|
-
if (/^prompt timed out after \d+ms$/.test(message) || isHostTimeoutError(error)) {
|
|
6718
|
+
if (error instanceof ModelProducedNoOutputError || /^prompt timed out after \d+ms$/.test(message) || isHostTimeoutError(error)) {
|
|
6643
6719
|
return "provider_timeout";
|
|
6644
6720
|
}
|
|
6645
6721
|
if (phase === "validation") {
|
|
@@ -6674,11 +6750,11 @@ function throwWithPromptFailure(legacyError, failedAttempts, args, timeoutMs, tr
|
|
|
6674
6750
|
});
|
|
6675
6751
|
throw error;
|
|
6676
6752
|
}
|
|
6677
|
-
async function attemptOnce(client, args, timeoutMs, signal, callContext, label, transport, allowModelSuggestions = true) {
|
|
6753
|
+
async function attemptOnce(client, args, timeoutMs, signal, callContext, label, transport, allowModelSuggestions = true, firstOutputTimeoutMs) {
|
|
6678
6754
|
const originalBody = { ...args.body };
|
|
6679
6755
|
const attemptArgs = copyPromptArgs(args, originalBody);
|
|
6680
6756
|
try {
|
|
6681
|
-
await promptWithTimeout(client, attemptArgs, timeoutMs, signal, transport);
|
|
6757
|
+
await promptWithTimeout(client, attemptArgs, timeoutMs, signal, transport, firstOutputTimeoutMs);
|
|
6682
6758
|
return;
|
|
6683
6759
|
} catch (error) {
|
|
6684
6760
|
if (isNonRetryable(error, signal) || !allowModelSuggestions)
|
|
@@ -6697,9 +6773,30 @@ async function attemptOnce(client, args, timeoutMs, signal, callContext, label,
|
|
|
6697
6773
|
providerID: suggestion.providerID,
|
|
6698
6774
|
modelID: suggestion.suggestion
|
|
6699
6775
|
}
|
|
6700
|
-
}), timeoutMs, signal, transport);
|
|
6776
|
+
}), timeoutMs, signal, transport, firstOutputTimeoutMs);
|
|
6701
6777
|
}
|
|
6702
6778
|
}
|
|
6779
|
+
function createChainClock(options, timeoutMs) {
|
|
6780
|
+
const fallbacks = options.fallbackModels ?? [];
|
|
6781
|
+
const hasValidFallbackFrom = (index) => fallbacks.slice(index).some((fallback) => {
|
|
6782
|
+
const entry = toModelEntry(fallback);
|
|
6783
|
+
return entry ? parseProviderModel(entry.model) !== null : false;
|
|
6784
|
+
});
|
|
6785
|
+
let silentSpentMs = 0;
|
|
6786
|
+
return {
|
|
6787
|
+
budget(nextFallbackIndex) {
|
|
6788
|
+
const attemptTimeoutMs = Math.max(1, timeoutMs - silentSpentMs);
|
|
6789
|
+
if (options.firstOutputTimeoutMs === undefined || !hasValidFallbackFrom(nextFallbackIndex))
|
|
6790
|
+
return { timeoutMs: attemptTimeoutMs };
|
|
6791
|
+
const bound = Math.min(options.firstOutputTimeoutMs, Math.floor(attemptTimeoutMs / 2));
|
|
6792
|
+
return bound > 0 ? { timeoutMs: attemptTimeoutMs, firstOutputTimeoutMs: bound } : { timeoutMs: attemptTimeoutMs };
|
|
6793
|
+
},
|
|
6794
|
+
settle(error, startedAt) {
|
|
6795
|
+
if (error instanceof ModelProducedNoOutputError)
|
|
6796
|
+
silentSpentMs += Date.now() - startedAt;
|
|
6797
|
+
}
|
|
6798
|
+
};
|
|
6799
|
+
}
|
|
6703
6800
|
async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
6704
6801
|
const timeoutMs = options.timeoutMs ?? 300000;
|
|
6705
6802
|
const callContext = options.callContext ?? "subagent";
|
|
@@ -6708,11 +6805,15 @@ async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
|
6708
6805
|
const baseArgs = copyPromptArgs(args, baseBody);
|
|
6709
6806
|
const explicitPrimaryLabel = baseBody.model?.providerID && baseBody.model.modelID ? `${baseBody.model.providerID}/${baseBody.model.modelID}` : "primary";
|
|
6710
6807
|
let lastError = null;
|
|
6808
|
+
const clock = createChainClock(options, timeoutMs);
|
|
6809
|
+
const primaryStartedAt = Date.now();
|
|
6711
6810
|
try {
|
|
6712
|
-
|
|
6811
|
+
const budget = clock.budget(0);
|
|
6812
|
+
await attemptOnce(client, baseArgs, budget.timeoutMs, options.signal, callContext, explicitPrimaryLabel, options.transport, options.allowModelSuggestions, budget.firstOutputTimeoutMs);
|
|
6713
6813
|
return;
|
|
6714
6814
|
} catch (error) {
|
|
6715
6815
|
lastError = error;
|
|
6816
|
+
clock.settle(error, primaryStartedAt);
|
|
6716
6817
|
if (isNonRetryable(error, options.signal))
|
|
6717
6818
|
throw error;
|
|
6718
6819
|
if (fallbacks.length === 0) {
|
|
@@ -6734,12 +6835,15 @@ async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
|
6734
6835
|
model: parsed,
|
|
6735
6836
|
...fallback?.qualifier ? { variant: fallback.qualifier } : {}
|
|
6736
6837
|
});
|
|
6838
|
+
const attemptStartedAt = Date.now();
|
|
6737
6839
|
try {
|
|
6738
|
-
|
|
6840
|
+
const budget = clock.budget(i + 1);
|
|
6841
|
+
await attemptOnce(client, attemptArgs, budget.timeoutMs, options.signal, callContext, label, options.transport, options.allowModelSuggestions, budget.firstOutputTimeoutMs);
|
|
6739
6842
|
log2(`[${callContext}] fallback succeeded with ${label} (attempt ${i + 2}/${fallbacks.length + 1})`);
|
|
6740
6843
|
return;
|
|
6741
6844
|
} catch (error) {
|
|
6742
6845
|
lastError = error;
|
|
6846
|
+
clock.settle(error, attemptStartedAt);
|
|
6743
6847
|
if (isNonRetryable(error, options.signal))
|
|
6744
6848
|
throw error;
|
|
6745
6849
|
const remaining = fallbacks.length - i - 1;
|
|
@@ -6751,9 +6855,9 @@ async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
|
6751
6855
|
log2(`[${callContext}] all models exhausted; tried: ${[explicitPrimaryLabel, ...fallbacks.map((fallback) => toModelEntry(fallback)?.model ?? String(fallback))].join(", ")}; last error: ${shortErr(lastError)}`);
|
|
6752
6856
|
throw lastError ?? new Error("All fallback models failed");
|
|
6753
6857
|
}
|
|
6754
|
-
async function attemptAndValidate(client, args, timeoutMs, signal, callContext, attempt, options) {
|
|
6858
|
+
async function attemptAndValidate(client, args, timeoutMs, signal, callContext, attempt, options, firstOutputTimeoutMs) {
|
|
6755
6859
|
try {
|
|
6756
|
-
await attemptOnce(client, args, timeoutMs, signal, callContext, attempt.label, options.transport, options.allowModelSuggestions);
|
|
6860
|
+
await attemptOnce(client, args, timeoutMs, signal, callContext, attempt.label, options.transport, options.allowModelSuggestions, firstOutputTimeoutMs);
|
|
6757
6861
|
} catch (error) {
|
|
6758
6862
|
throw {
|
|
6759
6863
|
error,
|
|
@@ -6815,6 +6919,8 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
6815
6919
|
let firstError = null;
|
|
6816
6920
|
let lastError = null;
|
|
6817
6921
|
const cooledPrimary = primaryQuotaFailure(explicitPrimaryLabel);
|
|
6922
|
+
const clock = createChainClock(options, timeoutMs);
|
|
6923
|
+
const primaryStartedAt = Date.now();
|
|
6818
6924
|
try {
|
|
6819
6925
|
if (cooledPrimary)
|
|
6820
6926
|
throw {
|
|
@@ -6829,16 +6935,18 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
6829
6935
|
skipped: true
|
|
6830
6936
|
}
|
|
6831
6937
|
};
|
|
6832
|
-
|
|
6938
|
+
const budget = clock.budget(0);
|
|
6939
|
+
return await attemptAndValidate(client, baseArgs, budget.timeoutMs, options.signal, callContext, {
|
|
6833
6940
|
label: explicitPrimaryLabel,
|
|
6834
6941
|
attemptIndex: 0,
|
|
6835
6942
|
isFallback: false,
|
|
6836
6943
|
totalAttempts,
|
|
6837
6944
|
model: baseBody.model
|
|
6838
|
-
}, options);
|
|
6945
|
+
}, options, budget.firstOutputTimeoutMs);
|
|
6839
6946
|
} catch (caught) {
|
|
6840
6947
|
const failure = caught;
|
|
6841
6948
|
failedAttempts.push(failure);
|
|
6949
|
+
clock.settle(failure.error, primaryStartedAt);
|
|
6842
6950
|
firstError = failure.error;
|
|
6843
6951
|
lastError = failure.error;
|
|
6844
6952
|
if (failure.error instanceof DreamerProviderOutputFailureError && failure.error.quotaResetAt !== undefined)
|
|
@@ -6876,13 +6984,16 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
6876
6984
|
totalAttempts,
|
|
6877
6985
|
model: parsed
|
|
6878
6986
|
};
|
|
6987
|
+
const attemptStartedAt = Date.now();
|
|
6879
6988
|
try {
|
|
6880
|
-
const
|
|
6989
|
+
const budget = clock.budget(i + 1);
|
|
6990
|
+
const result = await attemptAndValidate(client, attemptArgs, budget.timeoutMs, options.signal, callContext, attempt, options, budget.firstOutputTimeoutMs);
|
|
6881
6991
|
log2(`[${callContext}] fallback succeeded with ${label} (attempt ${i + 2}/${fallbacks.length + 1})`);
|
|
6882
6992
|
return result;
|
|
6883
6993
|
} catch (caught) {
|
|
6884
6994
|
const failure = caught;
|
|
6885
6995
|
failedAttempts.push(failure);
|
|
6996
|
+
clock.settle(failure.error, attemptStartedAt);
|
|
6886
6997
|
lastError = failure.error;
|
|
6887
6998
|
if (isNonRetryable(failure.error, options.signal)) {
|
|
6888
6999
|
throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs, options.transport);
|
|
@@ -7059,6 +7170,152 @@ function buildHiddenAgentRegistrations(args) {
|
|
|
7059
7170
|
}
|
|
7060
7171
|
|
|
7061
7172
|
// src/features/magic-context/subagent-token-capture.ts
|
|
7173
|
+
var warnedUnknownModels = new Set;
|
|
7174
|
+
var loggedModelReroutes = new Set;
|
|
7175
|
+
var MAX_SUBAGENT_INVOCATION_ERROR_CHARS = 1000;
|
|
7176
|
+
var invocationErrorDetails = new WeakMap;
|
|
7177
|
+
function annotateSubagentInvocationError(error, details) {
|
|
7178
|
+
if (error && typeof error === "object") {
|
|
7179
|
+
const previous = invocationErrorDetails.get(error) ?? {};
|
|
7180
|
+
invocationErrorDetails.set(error, {
|
|
7181
|
+
...previous,
|
|
7182
|
+
...details,
|
|
7183
|
+
hostError: details.hostError ?? previous.hostError
|
|
7184
|
+
});
|
|
7185
|
+
}
|
|
7186
|
+
return error;
|
|
7187
|
+
}
|
|
7188
|
+
function errorDetailsOf(error) {
|
|
7189
|
+
const seen = new Set;
|
|
7190
|
+
const visit = (value, depth) => {
|
|
7191
|
+
if (!value || typeof value !== "object" || depth > 4 || seen.has(value))
|
|
7192
|
+
return {};
|
|
7193
|
+
seen.add(value);
|
|
7194
|
+
const direct = invocationErrorDetails.get(value) ?? {};
|
|
7195
|
+
const record = value;
|
|
7196
|
+
const nested = visit(record.hostError, depth + 1);
|
|
7197
|
+
const cause = visit(record.cause, depth + 1);
|
|
7198
|
+
return {
|
|
7199
|
+
...cause,
|
|
7200
|
+
...nested,
|
|
7201
|
+
...direct,
|
|
7202
|
+
hostError: direct.hostError ?? nested.hostError ?? cause.hostError ?? record.hostError
|
|
7203
|
+
};
|
|
7204
|
+
};
|
|
7205
|
+
return visit(error, 0);
|
|
7206
|
+
}
|
|
7207
|
+
function modelRef(value) {
|
|
7208
|
+
const reference = typeof value === "string" ? value : value?.model;
|
|
7209
|
+
return typeof reference === "string" && reference.trim().length > 0 ? reference.trim() : undefined;
|
|
7210
|
+
}
|
|
7211
|
+
function splitModelRef(value) {
|
|
7212
|
+
if (!value)
|
|
7213
|
+
return { providerId: null, modelId: null };
|
|
7214
|
+
const slash = value.indexOf("/");
|
|
7215
|
+
return slash > 0 && slash < value.length - 1 ? { providerId: value.slice(0, slash), modelId: value.slice(slash + 1) } : { providerId: null, modelId: value };
|
|
7216
|
+
}
|
|
7217
|
+
function cleanOneLine(value) {
|
|
7218
|
+
const oneLine = sanitizeDiagnosticText(value).replaceAll("\r", " ").replaceAll(`
|
|
7219
|
+
`, " ").replaceAll("\t", " ").replace(/\s+/g, " ").trim();
|
|
7220
|
+
return oneLine.length <= MAX_SUBAGENT_INVOCATION_ERROR_CHARS ? oneLine : `${oneLine.slice(0, MAX_SUBAGENT_INVOCATION_ERROR_CHARS - 1)}…`;
|
|
7221
|
+
}
|
|
7222
|
+
function recordMessage(error) {
|
|
7223
|
+
if (typeof error === "string")
|
|
7224
|
+
return error;
|
|
7225
|
+
if (!error || typeof error !== "object")
|
|
7226
|
+
return String(error ?? "");
|
|
7227
|
+
const record = error;
|
|
7228
|
+
const data = record.data && typeof record.data === "object" ? record.data : undefined;
|
|
7229
|
+
const message = typeof data?.message === "string" ? data.message : typeof record.message === "string" ? record.message : typeof record.description === "string" ? record.description : "";
|
|
7230
|
+
const name = typeof record.name === "string" ? record.name : typeof record.type === "string" ? record.type : "";
|
|
7231
|
+
return [name, message].filter(Boolean).join(": ") || "The host reported an error without a message.";
|
|
7232
|
+
}
|
|
7233
|
+
function modelNotFoundDetail(error, attemptedModel) {
|
|
7234
|
+
const seen = new Set;
|
|
7235
|
+
const visit = (value, depth) => {
|
|
7236
|
+
if (typeof value === "string") {
|
|
7237
|
+
const modelMatch = value.match(/model not found:\s*(.+?)(?=(?:\.?\s*did you mean|$))/i);
|
|
7238
|
+
if (!modelMatch)
|
|
7239
|
+
return null;
|
|
7240
|
+
const model = modelMatch[1].trim().replace(/[.,;(]+$/, "");
|
|
7241
|
+
const suggestion = value.match(/did you mean:?\s*\(?\s*([^?);]+)/i)?.[1]?.trim();
|
|
7242
|
+
const message = `Model not found: ${model}${suggestion ? ` (did you mean ${suggestion}?)` : ""}`;
|
|
7243
|
+
return { model, ...suggestion ? { suggestion } : {}, message };
|
|
7244
|
+
}
|
|
7245
|
+
if (!value || typeof value !== "object" || depth > 4 || seen.has(value))
|
|
7246
|
+
return null;
|
|
7247
|
+
seen.add(value);
|
|
7248
|
+
const record = value;
|
|
7249
|
+
const data = record.data && typeof record.data === "object" ? record.data : undefined;
|
|
7250
|
+
const modelRecord = data?.model ?? record.model;
|
|
7251
|
+
const modelId = (typeof data?.modelID === "string" ? data.modelID : undefined) ?? (typeof modelRecord?.modelID === "string" ? modelRecord.modelID : undefined) ?? (typeof modelRecord?.id === "string" ? modelRecord.id : undefined);
|
|
7252
|
+
const providerId = (typeof data?.providerID === "string" ? data.providerID : undefined) ?? (typeof modelRecord?.providerID === "string" ? modelRecord.providerID : undefined);
|
|
7253
|
+
const suggestions = data?.suggestions;
|
|
7254
|
+
const suggestion = Array.isArray(suggestions) && typeof suggestions[0] === "string" ? suggestions[0] : typeof data?.suggestion === "string" ? data.suggestion : undefined;
|
|
7255
|
+
const rawMessage = recordMessage(value);
|
|
7256
|
+
const fromMessage = visit(rawMessage, depth + 1);
|
|
7257
|
+
if (fromMessage)
|
|
7258
|
+
return fromMessage.suggestion || !suggestion ? fromMessage : {
|
|
7259
|
+
...fromMessage,
|
|
7260
|
+
suggestion,
|
|
7261
|
+
message: `Model not found: ${fromMessage.model} (did you mean ${suggestion}?)`
|
|
7262
|
+
};
|
|
7263
|
+
const name = `${String(record.name ?? "")} ${String(record.type ?? "")}`;
|
|
7264
|
+
if (/ProviderModelNotFoundError|model not found/i.test(name) && modelId) {
|
|
7265
|
+
const model = providerId ? `${providerId}/${modelId}` : modelId;
|
|
7266
|
+
const detail = `Model not found: ${model}${suggestion ? ` (did you mean ${suggestion}?)` : ""}`;
|
|
7267
|
+
return { model, ...suggestion ? { suggestion } : {}, message: detail };
|
|
7268
|
+
}
|
|
7269
|
+
for (const key of ["data", "error", "cause", "hostError"]) {
|
|
7270
|
+
const match = visit(record[key], depth + 1);
|
|
7271
|
+
if (match)
|
|
7272
|
+
return match;
|
|
7273
|
+
}
|
|
7274
|
+
return null;
|
|
7275
|
+
};
|
|
7276
|
+
const found = visit(error, 0);
|
|
7277
|
+
if (!found && attemptedModel && (typeof error === "string" && /ProviderModelNotFoundError/i.test(error) || error !== null && typeof error === "object" && /ProviderModelNotFoundError/i.test(`${String(error.name ?? "")} ${String(error.type ?? "")}`))) {
|
|
7278
|
+
return { model: attemptedModel, message: `Model not found: ${attemptedModel}` };
|
|
7279
|
+
}
|
|
7280
|
+
return found;
|
|
7281
|
+
}
|
|
7282
|
+
function hostLabel(harness) {
|
|
7283
|
+
switch (harness) {
|
|
7284
|
+
case "opencode2":
|
|
7285
|
+
return "OpenCode 2";
|
|
7286
|
+
case "opencode":
|
|
7287
|
+
return "OpenCode";
|
|
7288
|
+
case "pi":
|
|
7289
|
+
return "Pi";
|
|
7290
|
+
case "omp":
|
|
7291
|
+
return "Oh My Pi";
|
|
7292
|
+
}
|
|
7293
|
+
}
|
|
7294
|
+
function invocationErrorText(input, details, attemptedModel) {
|
|
7295
|
+
if (input.error == null && input.hostError == null && details.hostError == null)
|
|
7296
|
+
return null;
|
|
7297
|
+
const rawHostError = input.hostError ?? details.hostError;
|
|
7298
|
+
const modelError = modelNotFoundDetail(rawHostError ?? input.error, attemptedModel);
|
|
7299
|
+
if (modelError) {
|
|
7300
|
+
return cleanOneLine(`No reply: ${hostLabel(input.harness)} refused the model: ${modelError.message}`);
|
|
7301
|
+
}
|
|
7302
|
+
if (rawHostError != null) {
|
|
7303
|
+
return cleanOneLine(`No reply: ${hostLabel(input.harness)} reported a child-session error: ${recordMessage(rawHostError)}`);
|
|
7304
|
+
}
|
|
7305
|
+
return cleanOneLine(describeError(input.error).brief);
|
|
7306
|
+
}
|
|
7307
|
+
function warnUnknownModel(input, details, attemptedModel, modelConfigKey) {
|
|
7308
|
+
if (!attemptedModel)
|
|
7309
|
+
return;
|
|
7310
|
+
const issue = modelNotFoundDetail(input.hostError ?? details.hostError ?? input.error, attemptedModel);
|
|
7311
|
+
if (!issue || warnedUnknownModels.has(attemptedModel))
|
|
7312
|
+
return;
|
|
7313
|
+
if (!modelConfigKey)
|
|
7314
|
+
return;
|
|
7315
|
+
warnedUnknownModels.add(attemptedModel);
|
|
7316
|
+
const suggestion = issue.suggestion ? `provider suggests ${cleanOneLine(issue.suggestion)}` : "provider gave no model suggestion";
|
|
7317
|
+
log2(`[magic-context] WARNING: ${modelConfigKey} configured ${attemptedModel}, but ${hostLabel(input.harness)} does not know that model; ${suggestion}`);
|
|
7318
|
+
}
|
|
7062
7319
|
function asNumber(value) {
|
|
7063
7320
|
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
7064
7321
|
}
|
|
@@ -7129,8 +7386,11 @@ function sumTokensFromChildMessages(messages) {
|
|
|
7129
7386
|
function findLastAssistantModel(messages) {
|
|
7130
7387
|
for (let index = messages.length - 1;index >= 0; index -= 1) {
|
|
7131
7388
|
const message = messages[index];
|
|
7132
|
-
if (isAssistantMessage(message))
|
|
7133
|
-
|
|
7389
|
+
if (isAssistantMessage(message)) {
|
|
7390
|
+
const model = modelFromMessage(message);
|
|
7391
|
+
if (model.providerId || model.modelId)
|
|
7392
|
+
return model;
|
|
7393
|
+
}
|
|
7134
7394
|
}
|
|
7135
7395
|
return { providerId: null, modelId: null };
|
|
7136
7396
|
}
|
|
@@ -7139,10 +7399,25 @@ function recordChildInvocation(input) {
|
|
|
7139
7399
|
return null;
|
|
7140
7400
|
const tokens = input.tokens ?? sumTokensFromChildMessages(input.messages ?? []);
|
|
7141
7401
|
const observedModel = findLastAssistantModel(input.messages ?? []);
|
|
7402
|
+
const details = errorDetailsOf(input.error);
|
|
7403
|
+
const attemptedModel = details.attemptedModel ?? modelRef(input.attemptedModel);
|
|
7404
|
+
const attemptConfig = [input.attemptedModel, ...input.configuredModels ?? []].find((candidate) => modelRef(candidate) === attemptedModel);
|
|
7405
|
+
const modelConfigKey = details.modelConfigKey ?? input.modelConfigKey ?? (typeof attemptConfig === "object" ? attemptConfig?.sourceConfigKey : undefined);
|
|
7406
|
+
const attemptedParts = splitModelRef(attemptedModel);
|
|
7142
7407
|
const model = {
|
|
7143
|
-
providerId: input.providerId ??
|
|
7144
|
-
modelId: input.modelId ??
|
|
7408
|
+
providerId: observedModel.providerId ?? input.providerId ?? attemptedParts.providerId,
|
|
7409
|
+
modelId: observedModel.modelId ?? input.modelId ?? attemptedParts.modelId
|
|
7145
7410
|
};
|
|
7411
|
+
const reportedModelRef = observedModel.providerId && observedModel.modelId ? `${observedModel.providerId}/${observedModel.modelId}` : input.providerId && input.modelId ? `${input.providerId}/${input.modelId}` : undefined;
|
|
7412
|
+
if (attemptedModel && reportedModelRef && attemptedModel !== reportedModelRef && (observedModel.providerId !== null || input.providerId !== undefined)) {
|
|
7413
|
+
const rerouteKey = `${input.harness}\x00${attemptedModel}\x00${reportedModelRef}`;
|
|
7414
|
+
if (!loggedModelReroutes.has(rerouteKey)) {
|
|
7415
|
+
loggedModelReroutes.add(rerouteKey);
|
|
7416
|
+
sessionLog2(input.parentSessionId, `subagent model rerouted by host: attempted=${attemptedModel} reported=${reportedModelRef}`);
|
|
7417
|
+
}
|
|
7418
|
+
}
|
|
7419
|
+
warnUnknownModel(input, details, attemptedModel, modelConfigKey);
|
|
7420
|
+
const errorText = invocationErrorText(input, details, attemptedModel);
|
|
7146
7421
|
try {
|
|
7147
7422
|
return recordSubagentInvocation(input.db, {
|
|
7148
7423
|
sessionId: input.parentSessionId,
|
|
@@ -7158,7 +7433,7 @@ function recordChildInvocation(input) {
|
|
|
7158
7433
|
outputTokens: tokens.output,
|
|
7159
7434
|
cacheReadTokens: tokens.cacheRead,
|
|
7160
7435
|
cacheWriteTokens: tokens.cacheWrite,
|
|
7161
|
-
error:
|
|
7436
|
+
error: errorText,
|
|
7162
7437
|
parentInvocationId: input.parentInvocationId ?? null
|
|
7163
7438
|
});
|
|
7164
7439
|
} catch (error) {
|
|
@@ -7186,6 +7461,17 @@ var HOST_SESSION_ERROR = Symbol("promptAsyncHostSessionError");
|
|
|
7186
7461
|
function isHostSessionError(error) {
|
|
7187
7462
|
return error !== null && typeof error === "object" && error[HOST_SESSION_ERROR] === true;
|
|
7188
7463
|
}
|
|
7464
|
+
function hostSessionErrorOf(error) {
|
|
7465
|
+
if (!isHostSessionError(error))
|
|
7466
|
+
return;
|
|
7467
|
+
return error.hostError;
|
|
7468
|
+
}
|
|
7469
|
+
function requestModelRef(request) {
|
|
7470
|
+
const model = request.body?.model;
|
|
7471
|
+
if (model && typeof model.providerID === "string" && typeof model.modelID === "string")
|
|
7472
|
+
return `${model.providerID}/${model.modelID}`;
|
|
7473
|
+
return;
|
|
7474
|
+
}
|
|
7189
7475
|
function supportsPromptAsync(client) {
|
|
7190
7476
|
const session = sessionApi(client);
|
|
7191
7477
|
return typeof session?.promptAsync === "function" && typeof session?.status === "function" && typeof session?.messages === "function";
|
|
@@ -7234,6 +7520,24 @@ function isTerminalAssistant(message) {
|
|
|
7234
7520
|
const info = infoOf(message);
|
|
7235
7521
|
return isSettledAssistant(message) && info.finish !== "tool-calls" && info.finish !== "tool_use" && !(message && typeof message === "object" && Array.isArray(message.parts) && message.parts.some((part) => part.type === "tool"));
|
|
7236
7522
|
}
|
|
7523
|
+
function showsModelOutput(message) {
|
|
7524
|
+
if (infoOf(message).role !== "assistant")
|
|
7525
|
+
return false;
|
|
7526
|
+
const tokens = sumTokensFromChildMessages([message]);
|
|
7527
|
+
if (tokens.input + tokens.output + tokens.cacheRead + tokens.cacheWrite > 0)
|
|
7528
|
+
return true;
|
|
7529
|
+
const parts = message?.parts;
|
|
7530
|
+
if (!Array.isArray(parts))
|
|
7531
|
+
return false;
|
|
7532
|
+
return parts.some((part) => {
|
|
7533
|
+
if (!part || typeof part !== "object")
|
|
7534
|
+
return false;
|
|
7535
|
+
const { type, text } = part;
|
|
7536
|
+
if (type === "tool")
|
|
7537
|
+
return true;
|
|
7538
|
+
return (type === "text" || type === "reasoning") && typeof text === "string" && text.trim().length > 0;
|
|
7539
|
+
});
|
|
7540
|
+
}
|
|
7237
7541
|
function unwrapData(response) {
|
|
7238
7542
|
if (response && typeof response === "object" && "data" in response) {
|
|
7239
7543
|
return response.data;
|
|
@@ -7322,15 +7626,35 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
7322
7626
|
const initialBaseline = new Set(completionBaseline);
|
|
7323
7627
|
activeSessionErrors.set(sessionId, undefined);
|
|
7324
7628
|
try {
|
|
7325
|
-
|
|
7629
|
+
let sent;
|
|
7630
|
+
try {
|
|
7631
|
+
sent = await session.promptAsync?.(request);
|
|
7632
|
+
} catch (error) {
|
|
7633
|
+
annotateSubagentInvocationError(error, {
|
|
7634
|
+
attemptedModel: requestModelRef(request),
|
|
7635
|
+
modelConfigKey: options.modelConfigKey,
|
|
7636
|
+
hostError: error
|
|
7637
|
+
});
|
|
7638
|
+
throw error;
|
|
7639
|
+
}
|
|
7326
7640
|
if (sent && typeof sent === "object" && "error" in sent) {
|
|
7327
7641
|
const rejection = sent.error;
|
|
7328
7642
|
if (rejection) {
|
|
7329
|
-
|
|
7643
|
+
const error = new Error(`prompt_async was rejected: ${describeRejection(rejection)}`, {
|
|
7644
|
+
cause: rejection
|
|
7645
|
+
});
|
|
7646
|
+
annotateSubagentInvocationError(error, {
|
|
7647
|
+
attemptedModel: requestModelRef(request),
|
|
7648
|
+
modelConfigKey: options.modelConfigKey,
|
|
7649
|
+
hostError: rejection
|
|
7650
|
+
});
|
|
7651
|
+
throw error;
|
|
7330
7652
|
}
|
|
7331
7653
|
}
|
|
7332
7654
|
let sentAt = Date.now();
|
|
7333
7655
|
let sawBusy = false;
|
|
7656
|
+
noteModelActivityMonitored(signal);
|
|
7657
|
+
let sawOutput = false;
|
|
7334
7658
|
for (;; ) {
|
|
7335
7659
|
await sleep(pollIntervalMs, signal);
|
|
7336
7660
|
const hostError = activeSessionErrors.get(sessionId);
|
|
@@ -7339,12 +7663,25 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
7339
7663
|
Object.assign(error, {
|
|
7340
7664
|
name: "DreamerProviderOutputFailureError",
|
|
7341
7665
|
transient: true,
|
|
7342
|
-
[HOST_SESSION_ERROR]: true
|
|
7666
|
+
[HOST_SESSION_ERROR]: true,
|
|
7667
|
+
hostError
|
|
7668
|
+
});
|
|
7669
|
+
annotateSubagentInvocationError(error, {
|
|
7670
|
+
attemptedModel: requestModelRef(request),
|
|
7671
|
+
modelConfigKey: options.modelConfigKey,
|
|
7672
|
+
hostError
|
|
7343
7673
|
});
|
|
7344
7674
|
throw error;
|
|
7345
7675
|
}
|
|
7346
7676
|
const status = await readStatus(session, sessionId, dir, signal);
|
|
7347
7677
|
const messages = await readMessages(session, sessionId, dir, signal);
|
|
7678
|
+
if (!sawOutput && messages.some((message) => {
|
|
7679
|
+
const id = messageId2(message);
|
|
7680
|
+
return id !== null && !initialBaseline.has(id) && showsModelOutput(message);
|
|
7681
|
+
})) {
|
|
7682
|
+
sawOutput = true;
|
|
7683
|
+
noteModelOutputReceived(signal);
|
|
7684
|
+
}
|
|
7348
7685
|
if (budget) {
|
|
7349
7686
|
const latest = messages.at(-1);
|
|
7350
7687
|
const latestId = messageId2(latest);
|
|
@@ -15085,6 +15422,8 @@ function resolveHiddenCompletionExecutor(executor, client, db, directory, entryP
|
|
|
15085
15422
|
}
|
|
15086
15423
|
function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
15087
15424
|
const historianChildren = new Set;
|
|
15425
|
+
const hostErrors = new Map;
|
|
15426
|
+
const runIdentities = new Map;
|
|
15088
15427
|
return {
|
|
15089
15428
|
capabilities: { tools: true, harness: "opencode" },
|
|
15090
15429
|
async open(run) {
|
|
@@ -15101,23 +15440,49 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
|
15101
15440
|
preferResponseOnMissingData: true
|
|
15102
15441
|
});
|
|
15103
15442
|
const id = typeof created?.id === "string" ? created.id : "";
|
|
15104
|
-
if (id)
|
|
15443
|
+
if (id) {
|
|
15105
15444
|
rememberV1HiddenRun(id, run);
|
|
15445
|
+
runIdentities.set(id, run);
|
|
15446
|
+
}
|
|
15106
15447
|
if (id && run.kind !== "dreamer-task") {
|
|
15107
15448
|
historianChildren.add(id);
|
|
15108
15449
|
rememberHistorianOutputCap(id, run.maxOutputTokens);
|
|
15109
15450
|
}
|
|
15110
|
-
|
|
15451
|
+
const configured = toModelEntry(run.model);
|
|
15452
|
+
return {
|
|
15453
|
+
id,
|
|
15454
|
+
childSessionId: id || undefined,
|
|
15455
|
+
...configured ? { attemptedModel: configured.model } : {},
|
|
15456
|
+
...configured?.sourceConfigKey ? { modelConfigKey: configured.sourceConfigKey } : {}
|
|
15457
|
+
};
|
|
15111
15458
|
},
|
|
15112
15459
|
async attempt(handle, request) {
|
|
15113
15460
|
if (!client)
|
|
15114
15461
|
throw new Error("Hidden completion client is unavailable");
|
|
15462
|
+
const identity = runIdentities.get(handle.id);
|
|
15463
|
+
const requestedModel = request.body?.model;
|
|
15464
|
+
const requestedRef = requestedModel && typeof requestedModel.providerID === "string" && typeof requestedModel.modelID === "string" ? `${requestedModel.providerID}/${requestedModel.modelID}` : undefined;
|
|
15465
|
+
const matchingConfigured = (identity?.configuredModels ?? []).map(toModelEntry).find((entry) => entry?.model === requestedRef);
|
|
15466
|
+
const configured = matchingConfigured ?? (requestedRef && identity?.model && toModelEntry(identity.model)?.model === requestedRef ? toModelEntry(identity.model) : toModelEntry(identity?.model));
|
|
15467
|
+
handle.attemptedModel = requestedRef ?? configured?.model ?? handle.attemptedModel;
|
|
15468
|
+
handle.modelConfigKey = configured?.sourceConfigKey ?? handle.modelConfigKey;
|
|
15115
15469
|
if (supportsPromptAsync(client)) {
|
|
15116
15470
|
try {
|
|
15117
|
-
await promptAsyncAndWaitForIdle(client, request
|
|
15471
|
+
await promptAsyncAndWaitForIdle(client, request, {
|
|
15472
|
+
modelConfigKey: handle.modelConfigKey
|
|
15473
|
+
});
|
|
15118
15474
|
} catch (error) {
|
|
15119
|
-
if (
|
|
15120
|
-
|
|
15475
|
+
if (isHostSessionError(error)) {
|
|
15476
|
+
const hostError = hostSessionErrorOf(error);
|
|
15477
|
+
hostErrors.set(handle.id, hostError);
|
|
15478
|
+
annotateSubagentInvocationError(error, {
|
|
15479
|
+
attemptedModel: handle.attemptedModel,
|
|
15480
|
+
modelConfigKey: handle.modelConfigKey,
|
|
15481
|
+
hostError
|
|
15482
|
+
});
|
|
15483
|
+
if (historianChildren.has(handle.id))
|
|
15484
|
+
return;
|
|
15485
|
+
}
|
|
15121
15486
|
throw error;
|
|
15122
15487
|
}
|
|
15123
15488
|
return;
|
|
@@ -15135,9 +15500,16 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
|
15135
15500
|
preferResponseOnMissingData: true
|
|
15136
15501
|
});
|
|
15137
15502
|
const assistantFailure = extractLatestAssistantFailure(messages);
|
|
15503
|
+
const hostError = hostErrors.get(handle.id);
|
|
15138
15504
|
if (assistantFailure) {
|
|
15139
15505
|
const finish = assistantFailure.finish ? ` (finish=${assistantFailure.finish})` : "";
|
|
15140
|
-
|
|
15506
|
+
const error = new Error(`Historian host recorded an assistant error${finish}: ${describeAssistantFailure(assistantFailure.error)}`, hostError === undefined ? undefined : { cause: hostError });
|
|
15507
|
+
annotateSubagentInvocationError(error, {
|
|
15508
|
+
attemptedModel: handle.attemptedModel,
|
|
15509
|
+
modelConfigKey: handle.modelConfigKey,
|
|
15510
|
+
hostError
|
|
15511
|
+
});
|
|
15512
|
+
throw error;
|
|
15141
15513
|
}
|
|
15142
15514
|
const text = extractLatestAssistantText(messages);
|
|
15143
15515
|
const latest = Array.isArray(messages) ? messages.filter((message) => isRecord(message) && isRecord(message.info) && message.info.role === "assistant").sort((left, right) => historianMessageCreatedAt(right) - historianMessageCreatedAt(left))[0] : undefined;
|
|
@@ -15148,13 +15520,18 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
|
15148
15520
|
reasoning: text ? null : extractLatestHistorianReasoning(messages),
|
|
15149
15521
|
lengthCapped: hasLengthCappedOutput(messages),
|
|
15150
15522
|
usage: sumTokensFromChildMessages(messages),
|
|
15151
|
-
tokenLog: runTokenLog(info.tokens, undefined, info.finish ?? info.finish_reason ?? info.finishReason)
|
|
15523
|
+
tokenLog: runTokenLog(info.tokens, undefined, info.finish ?? info.finish_reason ?? info.finishReason),
|
|
15524
|
+
attemptedModel: handle.attemptedModel,
|
|
15525
|
+
modelConfigKey: handle.modelConfigKey,
|
|
15526
|
+
...hostError === undefined ? {} : { hostError }
|
|
15152
15527
|
};
|
|
15153
15528
|
},
|
|
15154
15529
|
async close(handle, settlement) {
|
|
15155
15530
|
if (handle?.id) {
|
|
15156
15531
|
rememberV1HiddenRun(handle.id, undefined);
|
|
15157
15532
|
historianChildren.delete(handle.id);
|
|
15533
|
+
hostErrors.delete(handle.id);
|
|
15534
|
+
runIdentities.delete(handle.id);
|
|
15158
15535
|
forgetHistorianOutputCap(handle.id);
|
|
15159
15536
|
}
|
|
15160
15537
|
if (!client)
|
|
@@ -15309,7 +15686,8 @@ async function runHistorianPrompt(args) {
|
|
|
15309
15686
|
if (invocationRecorded)
|
|
15310
15687
|
return null;
|
|
15311
15688
|
invocationRecorded = true;
|
|
15312
|
-
const
|
|
15689
|
+
const configuredModel = toModelEntry(modelOverride);
|
|
15690
|
+
const actualModelRef = completion?.providerId && completion.modelId ? `${completion.providerId}/${completion.modelId}` : handle?.attemptedModel ?? configuredModel?.model ?? null;
|
|
15313
15691
|
const usedConfiguredFallback = actualModelRef !== null && (fallbackModels ?? []).some((candidate) => toModelEntry(candidate)?.model === actualModelRef);
|
|
15314
15692
|
return recordChildInvocation({
|
|
15315
15693
|
db: openDatabase(),
|
|
@@ -15325,6 +15703,10 @@ async function runHistorianPrompt(args) {
|
|
|
15325
15703
|
providerId: completion.providerId,
|
|
15326
15704
|
modelId: completion.modelId
|
|
15327
15705
|
} : {},
|
|
15706
|
+
attemptedModel: handle?.attemptedModel ?? modelOverride,
|
|
15707
|
+
configuredModels: fallbackModels,
|
|
15708
|
+
modelConfigKey: handle?.modelConfigKey ?? configuredModel?.sourceConfigKey,
|
|
15709
|
+
hostError: params.hostError ?? completion?.hostError,
|
|
15328
15710
|
error: params.error,
|
|
15329
15711
|
parentInvocationId: agentId === HISTORIAN_EDITOR_AGENT ? parentInvocationId ?? null : null
|
|
15330
15712
|
});
|
|
@@ -15438,7 +15820,8 @@ async function runHistorianPrompt(args) {
|
|
|
15438
15820
|
const invocationId = recordInvocation({
|
|
15439
15821
|
status: emptyError ? "empty" : "completed",
|
|
15440
15822
|
messages: completion.messages,
|
|
15441
|
-
error: emptyError
|
|
15823
|
+
error: emptyError,
|
|
15824
|
+
hostError: completion.hostError
|
|
15442
15825
|
});
|
|
15443
15826
|
if (emptyError && (!reasoningResult || lengthCapped)) {
|
|
15444
15827
|
return {
|
|
@@ -16344,7 +16727,8 @@ function resolveProtectedTailBoundary(ctx) {
|
|
|
16344
16727
|
break;
|
|
16345
16728
|
}
|
|
16346
16729
|
livePromptFloor.ordinal = lastMeaningfulUserOrdinal || null;
|
|
16347
|
-
|
|
16730
|
+
livePromptFloor.messageId = boundaryMessageId(index, lastMeaningfulUserOrdinal);
|
|
16731
|
+
if (!ctx.liftLivePromptFloor && lastMeaningfulUserOrdinal >= offset) {
|
|
16348
16732
|
protectedTailStart = Math.min(protectedTailStart, lastMeaningfulUserOrdinal);
|
|
16349
16733
|
}
|
|
16350
16734
|
}
|
|
@@ -16472,6 +16856,7 @@ function resolveBoundaryContext(args) {
|
|
|
16472
16856
|
protectedTailPolicyVersion: meta.protectedTailPolicyVersion,
|
|
16473
16857
|
migrationFloorActive,
|
|
16474
16858
|
emergencyTailScale: args.emergencyTailScale,
|
|
16859
|
+
liftLivePromptFloor: args.liftLivePromptFloor,
|
|
16475
16860
|
providerShapeVersion: args.providerShapeVersion ?? "opencode-v1",
|
|
16476
16861
|
cacheNamespace: args.cacheNamespace ?? `opencode:${args.sessionId}`,
|
|
16477
16862
|
storedTokenTotalsForMessages,
|
|
@@ -17583,7 +17968,7 @@ function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
|
17583
17968
|
finished = true;
|
|
17584
17969
|
return null;
|
|
17585
17970
|
}
|
|
17586
|
-
|
|
17971
|
+
deleteChunkEmbedBackoffForSession2(db, sessionId);
|
|
17587
17972
|
db.prepare("DELETE FROM compartments WHERE session_id = ?").run(sessionId);
|
|
17588
17973
|
db.prepare("DELETE FROM session_facts WHERE session_id = ?").run(sessionId);
|
|
17589
17974
|
insertRecompCompartmentRows(db, sessionId, staging.compartments, now);
|
|
@@ -18658,4 +19043,4 @@ ${failure}`;
|
|
|
18658
19043
|
}
|
|
18659
19044
|
}
|
|
18660
19045
|
|
|
18661
|
-
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, 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, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, 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, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, 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 };
|
|
19046
|
+
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, 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, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, 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, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, 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 };
|