@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
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
isRustMarkerAdmissionFenced,
|
|
40
40
|
readReplayEnvelope,
|
|
41
41
|
readReplayDocument,
|
|
42
|
+
updateReplayDocument,
|
|
42
43
|
writeReplayDocument,
|
|
43
44
|
describeProtectedTailDrainBudgetSkip,
|
|
44
45
|
loadProtectedTailMeta,
|
|
@@ -69,6 +70,7 @@ import {
|
|
|
69
70
|
serializeStrippedPlaceholderState,
|
|
70
71
|
THINKING_BINDING_RECOVERY_FROZEN_PREFIX,
|
|
71
72
|
THINKING_BINDING_STRIP_ORDER_END_MARKER,
|
|
73
|
+
COMPACTION_OFF_THINKING_FROZEN_PREFIX,
|
|
72
74
|
getMergedReasoningStrippedIds,
|
|
73
75
|
addMergedReasoningStrippedIds,
|
|
74
76
|
parseProcessedImageMarkers,
|
|
@@ -95,7 +97,7 @@ import {
|
|
|
95
97
|
getRawSessionTagKeysThrough2,
|
|
96
98
|
getLegacyProtectedTailStartOrdinal2,
|
|
97
99
|
readSessionChunk2
|
|
98
|
-
} from "./index-
|
|
100
|
+
} from "./index-x4k3f4mf.js";
|
|
99
101
|
import {
|
|
100
102
|
getHarness2,
|
|
101
103
|
harnessOwnsOpenCodeStore2
|
|
@@ -109,7 +111,7 @@ import {
|
|
|
109
111
|
sanitizeDiagnosticText,
|
|
110
112
|
log2,
|
|
111
113
|
sessionLog2
|
|
112
|
-
} from "./index-
|
|
114
|
+
} from "./index-h7tgn49j.js";
|
|
113
115
|
import {
|
|
114
116
|
createScanner,
|
|
115
117
|
parseTree,
|
|
@@ -132,7 +134,7 @@ import {
|
|
|
132
134
|
deriveTriggerBudget2,
|
|
133
135
|
resolveHistorianProducerLimits2,
|
|
134
136
|
producerSourceLocalBudget2
|
|
135
|
-
} from "./index-
|
|
137
|
+
} from "./index-spwjbkc7.js";
|
|
136
138
|
import {
|
|
137
139
|
withContentLanguageDirective,
|
|
138
140
|
buildPrimaryLanguageDirective,
|
|
@@ -155,14 +157,14 @@ import {
|
|
|
155
157
|
hasMeaningfulUserText2,
|
|
156
158
|
estimateTokens,
|
|
157
159
|
estimateFixedPromptTokens
|
|
158
|
-
} from "./index-
|
|
160
|
+
} from "./index-b88dwwrh.js";
|
|
159
161
|
import {
|
|
160
162
|
FAIL_CLOSED_DOCTOR_COMMAND,
|
|
161
163
|
getSchemaFenceRejection,
|
|
162
164
|
LATEST_SUPPORTED_VERSION,
|
|
163
165
|
getPersistedSchemaVersion,
|
|
164
166
|
openDatabase
|
|
165
|
-
} from "./index-
|
|
167
|
+
} from "./index-rmd0069m.js";
|
|
166
168
|
import {
|
|
167
169
|
inRootAsyncContext2,
|
|
168
170
|
Database2,
|
|
@@ -170,20 +172,20 @@ import {
|
|
|
170
172
|
withSqliteBackgroundWriter2,
|
|
171
173
|
withoutSqliteTransformPass2,
|
|
172
174
|
beginSqliteWriterAsync2
|
|
173
|
-
} from "./index-
|
|
175
|
+
} from "./index-1zx2pa5d.js";
|
|
174
176
|
import {
|
|
175
177
|
shouldSkipHomeProjectMemory,
|
|
176
178
|
resolveProjectIdentity
|
|
177
|
-
} from "./index-
|
|
179
|
+
} from "./index-vkc1ca9p.js";
|
|
178
180
|
import {
|
|
179
181
|
isPidAlive
|
|
180
|
-
} from "./index-
|
|
182
|
+
} from "./index-c7phnbvk.js";
|
|
181
183
|
import {
|
|
182
184
|
isStrictGapHealingMessage2,
|
|
183
185
|
noteRawSessionSummaryRowWritten2,
|
|
184
186
|
RawOrdinalsNotReady2,
|
|
185
187
|
runSessionWarmupWorker
|
|
186
|
-
} from "./index-
|
|
188
|
+
} from "./index-35qc6606.js";
|
|
187
189
|
import {
|
|
188
190
|
layoutLkgPrefix,
|
|
189
191
|
assembleLkgPrefix,
|
|
@@ -194,10 +196,10 @@ import {
|
|
|
194
196
|
resolveStoredPathWorkspaceIdentity,
|
|
195
197
|
sourceNameForMemory,
|
|
196
198
|
computeWorkspaceEpochFingerprint
|
|
197
|
-
} from "./index-
|
|
199
|
+
} from "./index-pnjwa6qa.js";
|
|
198
200
|
import {
|
|
199
201
|
getTableColumnNames
|
|
200
|
-
} from "./index-
|
|
202
|
+
} from "./index-x9k3mqrf.js";
|
|
201
203
|
import {
|
|
202
204
|
V2_MEMORY_CATEGORIES,
|
|
203
205
|
CATEGORY_PRIORITY,
|
|
@@ -211,7 +213,7 @@ import {
|
|
|
211
213
|
} from "./index-58e3y90n.js";
|
|
212
214
|
import {
|
|
213
215
|
getMeasuredToolDefinitionTokens
|
|
214
|
-
} from "./index-
|
|
216
|
+
} from "./index-j76ah6d7.js";
|
|
215
217
|
import {
|
|
216
218
|
invalidateAutoEmbedSession,
|
|
217
219
|
drainBackgroundBatches,
|
|
@@ -220,17 +222,17 @@ import {
|
|
|
220
222
|
getProjectChunkEmbeddingModelId2,
|
|
221
223
|
getProjectEmbeddingMaxInputTokens2,
|
|
222
224
|
embedItemsForProject2
|
|
223
|
-
} from "./index-
|
|
225
|
+
} from "./index-2yhtnfcf.js";
|
|
224
226
|
import {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
} from "./index-
|
|
227
|
+
buildCanonicalChunkTextFromFts2,
|
|
228
|
+
buildCompartmentSummaryFallbackText2,
|
|
229
|
+
canonicalizeInMemoryChunkTextForEmbedding2,
|
|
230
|
+
chunkCanonicalText2,
|
|
231
|
+
chunkEmbeddingWindowsAreCurrent2,
|
|
232
|
+
replaceCompartmentChunkEmbeddings2,
|
|
233
|
+
deleteChunkEmbedBackoffForSession2,
|
|
234
|
+
chunkWindowSourceKey2
|
|
235
|
+
} from "./index-153r2q6z.js";
|
|
234
236
|
import {
|
|
235
237
|
BoundedSessionMap,
|
|
236
238
|
clearCompressionDepth,
|
|
@@ -247,7 +249,7 @@ import {
|
|
|
247
249
|
toMessageIndexSource2,
|
|
248
250
|
clearIndexedMessagesInTransaction2,
|
|
249
251
|
indexSourcesAfterOrdinal2
|
|
250
|
-
} from "./index-
|
|
252
|
+
} from "./index-48stjd56.js";
|
|
251
253
|
import {
|
|
252
254
|
stripWellFormedLeadingTagPrefix,
|
|
253
255
|
stripTagPrefix,
|
|
@@ -260,12 +262,12 @@ import {
|
|
|
260
262
|
foldShrunkPartTags2,
|
|
261
263
|
getTagNumberByMessageId2,
|
|
262
264
|
getActiveTagsBySession2
|
|
263
|
-
} from "./index-
|
|
265
|
+
} from "./index-305y133n.js";
|
|
264
266
|
import {
|
|
265
267
|
openCodeDbExists,
|
|
266
268
|
withReadOnlySessionDb,
|
|
267
269
|
getMessageTimesFromOpenCodeDb
|
|
268
|
-
} from "./index-
|
|
270
|
+
} from "./index-11zf2wwc.js";
|
|
269
271
|
import {
|
|
270
272
|
renderUserFacingFailure,
|
|
271
273
|
userFacingFailureCode,
|
|
@@ -274,7 +276,7 @@ import {
|
|
|
274
276
|
insertPrimerCandidates,
|
|
275
277
|
promoteSessionFactsDurable,
|
|
276
278
|
embedPromotedFacts
|
|
277
|
-
} from "./index-
|
|
279
|
+
} from "./index-1pefp8ar.js";
|
|
278
280
|
import {
|
|
279
281
|
pushNotification2
|
|
280
282
|
} from "./index-x8a7jmkh.js";
|
|
@@ -285,16 +287,16 @@ import {
|
|
|
285
287
|
getMemoriesByProject2,
|
|
286
288
|
getMemoriesByProjects2,
|
|
287
289
|
getMaxMemoryIdForProjects2
|
|
288
|
-
} from "./index-
|
|
290
|
+
} from "./index-y4a3nhtk.js";
|
|
289
291
|
import {
|
|
290
292
|
isMarkerCandidateBasisCurrent2,
|
|
291
293
|
invalidateMarkerCandidateBasis2,
|
|
292
294
|
readMarkerCandidateBasis2,
|
|
293
295
|
prepareMarkerCandidateBasis2
|
|
294
|
-
} from "./index-
|
|
296
|
+
} from "./index-616rsjrv.js";
|
|
295
297
|
import {
|
|
296
298
|
sendStatusNotification2
|
|
297
|
-
} from "./index-
|
|
299
|
+
} from "./index-kc9pn495.js";
|
|
298
300
|
import {
|
|
299
301
|
isCompactionEnabled,
|
|
300
302
|
migrateLegacyAgentEnabledInMemory
|
|
@@ -312,7 +314,7 @@ import {
|
|
|
312
314
|
import {
|
|
313
315
|
logSlowWriteTransaction,
|
|
314
316
|
WriteTransactionSteps
|
|
315
|
-
} from "./index-
|
|
317
|
+
} from "./index-t5pck3ss.js";
|
|
316
318
|
import {
|
|
317
319
|
ensureStorageDirectorySync,
|
|
318
320
|
writeStorageFileAtomicSync
|
|
@@ -6436,6 +6438,34 @@ function noteLkgCapturedPrefix(sessionId) {
|
|
|
6436
6438
|
if (!sessions.has(sessionId))
|
|
6437
6439
|
sessions.set(sessionId, {});
|
|
6438
6440
|
}
|
|
6441
|
+
function readPersistedLkgUntaggedInputIds(db, sessionId) {
|
|
6442
|
+
try {
|
|
6443
|
+
const saved = readReplayEnvelope(db, sessionId, "read").lkgUntaggedInputIds;
|
|
6444
|
+
return Array.isArray(saved) ? saved.filter((id) => typeof id === "string" && id.length > 0) : [];
|
|
6445
|
+
} catch (error) {
|
|
6446
|
+
sessionLog2(sessionId, "LKG untagged-input record unreadable:", error);
|
|
6447
|
+
return [];
|
|
6448
|
+
}
|
|
6449
|
+
}
|
|
6450
|
+
function persistLkgUntaggedInputIds(db, sessionId, ids) {
|
|
6451
|
+
const next = [...new Set(ids)].sort();
|
|
6452
|
+
try {
|
|
6453
|
+
return updateReplayDocument(db, sessionId, (doc) => {
|
|
6454
|
+
const saved = Array.isArray(doc.lkgUntaggedInputIds) ? doc.lkgUntaggedInputIds : [];
|
|
6455
|
+
if (JSON.stringify(saved) === JSON.stringify(next))
|
|
6456
|
+
return false;
|
|
6457
|
+
doc.version = 2;
|
|
6458
|
+
if (next.length > 0)
|
|
6459
|
+
doc.lkgUntaggedInputIds = next;
|
|
6460
|
+
else
|
|
6461
|
+
delete doc.lkgUntaggedInputIds;
|
|
6462
|
+
return true;
|
|
6463
|
+
});
|
|
6464
|
+
} catch (error) {
|
|
6465
|
+
sessionLog2(sessionId, "LKG untagged-input record write failed:", error);
|
|
6466
|
+
return false;
|
|
6467
|
+
}
|
|
6468
|
+
}
|
|
6439
6469
|
function noteLkgRecoveryPrefix(args) {
|
|
6440
6470
|
const digests = [
|
|
6441
6471
|
...args.entry.entryContentDigests,
|
|
@@ -6446,19 +6476,23 @@ function noteLkgRecoveryPrefix(args) {
|
|
|
6446
6476
|
const ids = args.entry.entryInputIds;
|
|
6447
6477
|
if (ids.some((id) => !id) || new Set(ids).size !== ids.length)
|
|
6448
6478
|
return false;
|
|
6479
|
+
const untaggedInputIds = new Set([
|
|
6480
|
+
...sessions.get(args.sessionId)?.prefix?.untaggedInputIds ?? [],
|
|
6481
|
+
...args.db ? readPersistedLkgUntaggedInputIds(args.db, args.sessionId) : [],
|
|
6482
|
+
...ids.slice(args.entry.anchorIndex + 1)
|
|
6483
|
+
]);
|
|
6449
6484
|
sessions.set(args.sessionId, {
|
|
6450
6485
|
fenceRevision: sessions.get(args.sessionId)?.fenceRevision,
|
|
6451
6486
|
prefix: {
|
|
6452
6487
|
inputs: ids.map((id, index) => ({ id, digest: digests[index] })),
|
|
6453
6488
|
json: JSON.stringify(args.messages),
|
|
6454
|
-
untaggedInputIds
|
|
6455
|
-
...sessions.get(args.sessionId)?.prefix?.untaggedInputIds ?? [],
|
|
6456
|
-
...ids.slice(args.entry.anchorIndex + 1)
|
|
6457
|
-
]),
|
|
6489
|
+
untaggedInputIds,
|
|
6458
6490
|
modelKey: args.modelKey,
|
|
6459
6491
|
providerKey: args.providerKey
|
|
6460
6492
|
}
|
|
6461
6493
|
});
|
|
6494
|
+
if (args.db)
|
|
6495
|
+
persistLkgUntaggedInputIds(args.db, args.sessionId, untaggedInputIds);
|
|
6462
6496
|
return true;
|
|
6463
6497
|
}
|
|
6464
6498
|
function readLkgRecoveryPrefix(sessionId, inputs, messages, db) {
|
|
@@ -7463,11 +7497,15 @@ function clonePiContentDecisions(raw, filter) {
|
|
|
7463
7497
|
])}`);
|
|
7464
7498
|
continue;
|
|
7465
7499
|
}
|
|
7466
|
-
|
|
7467
|
-
|
|
7500
|
+
const thinkingPrefix = [
|
|
7501
|
+
THINKING_BINDING_RECOVERY_FROZEN_PREFIX,
|
|
7502
|
+
COMPACTION_OFF_THINKING_FROZEN_PREFIX
|
|
7503
|
+
].find((prefix) => entry.startsWith(prefix));
|
|
7504
|
+
if (thinkingPrefix) {
|
|
7505
|
+
const messageId = entry.slice(thinkingPrefix.length);
|
|
7468
7506
|
if (messageId.length === 0 || !filter.includeMessageId(messageId))
|
|
7469
7507
|
continue;
|
|
7470
|
-
copied.push(`${
|
|
7508
|
+
copied.push(`${thinkingPrefix}${mapMessageId(filter, messageId) ?? messageId}`);
|
|
7471
7509
|
continue;
|
|
7472
7510
|
}
|
|
7473
7511
|
if (entry.startsWith(MERGED_REASONING_PARTS_PREFIX) || entry.startsWith("pi-content-replay-"))
|
|
@@ -8877,9 +8915,33 @@ var promptFailureDetails = new WeakMap;
|
|
|
8877
8915
|
function isHostTimeoutError(error) {
|
|
8878
8916
|
return error !== null && typeof error === "object" && error.name === "TimeoutError";
|
|
8879
8917
|
}
|
|
8918
|
+
|
|
8919
|
+
class ModelProducedNoOutputError extends Error {
|
|
8920
|
+
waitedMs;
|
|
8921
|
+
constructor(waitedMs) {
|
|
8922
|
+
super(`prompt timed out after ${waitedMs}ms with no model output`);
|
|
8923
|
+
this.waitedMs = waitedMs;
|
|
8924
|
+
this.name = "ModelProducedNoOutputError";
|
|
8925
|
+
}
|
|
8926
|
+
}
|
|
8927
|
+
var modelActivityBySignal = new WeakMap;
|
|
8928
|
+
function noteModelActivityMonitored(signal) {
|
|
8929
|
+
const activity = signal ? modelActivityBySignal.get(signal) : undefined;
|
|
8930
|
+
if (activity)
|
|
8931
|
+
activity.monitored = true;
|
|
8932
|
+
}
|
|
8933
|
+
function noteModelOutputReceived(signal) {
|
|
8934
|
+
const activity = signal ? modelActivityBySignal.get(signal) : undefined;
|
|
8935
|
+
if (activity) {
|
|
8936
|
+
activity.monitored = true;
|
|
8937
|
+
activity.received = true;
|
|
8938
|
+
}
|
|
8939
|
+
}
|
|
8880
8940
|
function isPromptTimeoutError(error) {
|
|
8881
8941
|
if (isHostTimeoutError(error))
|
|
8882
8942
|
return true;
|
|
8943
|
+
if (error instanceof ModelProducedNoOutputError)
|
|
8944
|
+
return true;
|
|
8883
8945
|
return error instanceof Error && /^prompt timed out after \d+ms$/.test(error.message);
|
|
8884
8946
|
}
|
|
8885
8947
|
function getPromptFailureDetail(error) {
|
|
@@ -8957,12 +9019,22 @@ function raceWithSignal(work, signal) {
|
|
|
8957
9019
|
work.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
8958
9020
|
});
|
|
8959
9021
|
}
|
|
8960
|
-
async function promptWithTimeout(client, args, timeoutMs, signal, transport) {
|
|
9022
|
+
async function promptWithTimeout(client, args, timeoutMs, signal, transport, firstOutputTimeoutMs) {
|
|
8961
9023
|
if (signal?.aborted) {
|
|
8962
9024
|
throw new Error(externalAbortMessage(signal));
|
|
8963
9025
|
}
|
|
8964
9026
|
const controller = new AbortController;
|
|
8965
9027
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
9028
|
+
const activity = { monitored: false, received: false };
|
|
9029
|
+
modelActivityBySignal.set(controller.signal, activity);
|
|
9030
|
+
let silent = false;
|
|
9031
|
+
const firstOutputTimer = firstOutputTimeoutMs !== undefined && firstOutputTimeoutMs < timeoutMs ? setTimeout(() => {
|
|
9032
|
+
if (!activity.monitored || activity.received)
|
|
9033
|
+
return;
|
|
9034
|
+
silent = true;
|
|
9035
|
+
controller.abort(new ModelProducedNoOutputError(firstOutputTimeoutMs));
|
|
9036
|
+
}, firstOutputTimeoutMs) : undefined;
|
|
9037
|
+
const timeoutError = () => silent && firstOutputTimeoutMs !== undefined ? new ModelProducedNoOutputError(firstOutputTimeoutMs) : new Error(`prompt timed out after ${timeoutMs}ms`);
|
|
8966
9038
|
const onExternalAbort = () => controller.abort();
|
|
8967
9039
|
signal?.addEventListener("abort", onExternalAbort);
|
|
8968
9040
|
try {
|
|
@@ -8985,7 +9057,7 @@ async function promptWithTimeout(client, args, timeoutMs, signal, transport) {
|
|
|
8985
9057
|
if (!transport || transport.childSessionId) {
|
|
8986
9058
|
await abortChildRun(client, transport?.childSessionId ?? args.path.id);
|
|
8987
9059
|
}
|
|
8988
|
-
throw
|
|
9060
|
+
throw timeoutError();
|
|
8989
9061
|
}
|
|
8990
9062
|
if (isHostTimeoutError(error)) {
|
|
8991
9063
|
if (!transport || transport.childSessionId) {
|
|
@@ -8995,13 +9067,15 @@ async function promptWithTimeout(client, args, timeoutMs, signal, transport) {
|
|
|
8995
9067
|
throw error;
|
|
8996
9068
|
} finally {
|
|
8997
9069
|
clearTimeout(timeout);
|
|
9070
|
+
if (firstOutputTimer)
|
|
9071
|
+
clearTimeout(firstOutputTimer);
|
|
8998
9072
|
signal?.removeEventListener("abort", onExternalAbort);
|
|
8999
9073
|
}
|
|
9000
9074
|
if (signal?.aborted || controller.signal.aborted) {
|
|
9001
9075
|
if (!transport || transport.childSessionId) {
|
|
9002
9076
|
await abortChildRun(client, transport?.childSessionId ?? args.path.id);
|
|
9003
9077
|
}
|
|
9004
|
-
throw
|
|
9078
|
+
throw signal?.aborted ? new Error(externalAbortMessage(signal)) : timeoutError();
|
|
9005
9079
|
}
|
|
9006
9080
|
}
|
|
9007
9081
|
async function abortChildRun(client, sessionId) {
|
|
@@ -9019,6 +9093,8 @@ async function abortChildRun(client, sessionId) {
|
|
|
9019
9093
|
function isNonRetryable(error, externalSignal) {
|
|
9020
9094
|
if (externalSignal?.aborted || error instanceof HiddenCompletionRefusal && error.terminal || error instanceof HiddenAgentStepLimit || error instanceof DreamTokenBudgetExceeded)
|
|
9021
9095
|
return true;
|
|
9096
|
+
if (error instanceof ModelProducedNoOutputError)
|
|
9097
|
+
return false;
|
|
9022
9098
|
if (error instanceof Error) {
|
|
9023
9099
|
if (error.name === "AbortError")
|
|
9024
9100
|
return true;
|
|
@@ -9050,7 +9126,7 @@ function classifyPromptFailure(error, phase, externalSignal) {
|
|
|
9050
9126
|
if (externalSignal?.aborted || message === "prompt aborted by external signal") {
|
|
9051
9127
|
return "child_aborted";
|
|
9052
9128
|
}
|
|
9053
|
-
if (/^prompt timed out after \d+ms$/.test(message) || isHostTimeoutError(error)) {
|
|
9129
|
+
if (error instanceof ModelProducedNoOutputError || /^prompt timed out after \d+ms$/.test(message) || isHostTimeoutError(error)) {
|
|
9054
9130
|
return "provider_timeout";
|
|
9055
9131
|
}
|
|
9056
9132
|
if (phase === "validation") {
|
|
@@ -9085,11 +9161,11 @@ function throwWithPromptFailure(legacyError, failedAttempts, args, timeoutMs, tr
|
|
|
9085
9161
|
});
|
|
9086
9162
|
throw error;
|
|
9087
9163
|
}
|
|
9088
|
-
async function attemptOnce(client, args, timeoutMs, signal, callContext, label, transport, allowModelSuggestions = true) {
|
|
9164
|
+
async function attemptOnce(client, args, timeoutMs, signal, callContext, label, transport, allowModelSuggestions = true, firstOutputTimeoutMs) {
|
|
9089
9165
|
const originalBody = { ...args.body };
|
|
9090
9166
|
const attemptArgs = copyPromptArgs(args, originalBody);
|
|
9091
9167
|
try {
|
|
9092
|
-
await promptWithTimeout(client, attemptArgs, timeoutMs, signal, transport);
|
|
9168
|
+
await promptWithTimeout(client, attemptArgs, timeoutMs, signal, transport, firstOutputTimeoutMs);
|
|
9093
9169
|
return;
|
|
9094
9170
|
} catch (error) {
|
|
9095
9171
|
if (isNonRetryable(error, signal) || !allowModelSuggestions)
|
|
@@ -9108,9 +9184,30 @@ async function attemptOnce(client, args, timeoutMs, signal, callContext, label,
|
|
|
9108
9184
|
providerID: suggestion.providerID,
|
|
9109
9185
|
modelID: suggestion.suggestion
|
|
9110
9186
|
}
|
|
9111
|
-
}), timeoutMs, signal, transport);
|
|
9187
|
+
}), timeoutMs, signal, transport, firstOutputTimeoutMs);
|
|
9112
9188
|
}
|
|
9113
9189
|
}
|
|
9190
|
+
function createChainClock(options, timeoutMs) {
|
|
9191
|
+
const fallbacks = options.fallbackModels ?? [];
|
|
9192
|
+
const hasValidFallbackFrom = (index) => fallbacks.slice(index).some((fallback) => {
|
|
9193
|
+
const entry = toModelEntry(fallback);
|
|
9194
|
+
return entry ? parseProviderModel(entry.model) !== null : false;
|
|
9195
|
+
});
|
|
9196
|
+
let silentSpentMs = 0;
|
|
9197
|
+
return {
|
|
9198
|
+
budget(nextFallbackIndex) {
|
|
9199
|
+
const attemptTimeoutMs = Math.max(1, timeoutMs - silentSpentMs);
|
|
9200
|
+
if (options.firstOutputTimeoutMs === undefined || !hasValidFallbackFrom(nextFallbackIndex))
|
|
9201
|
+
return { timeoutMs: attemptTimeoutMs };
|
|
9202
|
+
const bound = Math.min(options.firstOutputTimeoutMs, Math.floor(attemptTimeoutMs / 2));
|
|
9203
|
+
return bound > 0 ? { timeoutMs: attemptTimeoutMs, firstOutputTimeoutMs: bound } : { timeoutMs: attemptTimeoutMs };
|
|
9204
|
+
},
|
|
9205
|
+
settle(error, startedAt) {
|
|
9206
|
+
if (error instanceof ModelProducedNoOutputError)
|
|
9207
|
+
silentSpentMs += Date.now() - startedAt;
|
|
9208
|
+
}
|
|
9209
|
+
};
|
|
9210
|
+
}
|
|
9114
9211
|
async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
9115
9212
|
const timeoutMs = options.timeoutMs ?? 300000;
|
|
9116
9213
|
const callContext = options.callContext ?? "subagent";
|
|
@@ -9119,11 +9216,15 @@ async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
|
9119
9216
|
const baseArgs = copyPromptArgs(args, baseBody);
|
|
9120
9217
|
const explicitPrimaryLabel = baseBody.model?.providerID && baseBody.model.modelID ? `${baseBody.model.providerID}/${baseBody.model.modelID}` : "primary";
|
|
9121
9218
|
let lastError = null;
|
|
9219
|
+
const clock = createChainClock(options, timeoutMs);
|
|
9220
|
+
const primaryStartedAt = Date.now();
|
|
9122
9221
|
try {
|
|
9123
|
-
|
|
9222
|
+
const budget = clock.budget(0);
|
|
9223
|
+
await attemptOnce(client, baseArgs, budget.timeoutMs, options.signal, callContext, explicitPrimaryLabel, options.transport, options.allowModelSuggestions, budget.firstOutputTimeoutMs);
|
|
9124
9224
|
return;
|
|
9125
9225
|
} catch (error) {
|
|
9126
9226
|
lastError = error;
|
|
9227
|
+
clock.settle(error, primaryStartedAt);
|
|
9127
9228
|
if (isNonRetryable(error, options.signal))
|
|
9128
9229
|
throw error;
|
|
9129
9230
|
if (fallbacks.length === 0) {
|
|
@@ -9145,12 +9246,15 @@ async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
|
9145
9246
|
model: parsed,
|
|
9146
9247
|
...fallback?.qualifier ? { variant: fallback.qualifier } : {}
|
|
9147
9248
|
});
|
|
9249
|
+
const attemptStartedAt = Date.now();
|
|
9148
9250
|
try {
|
|
9149
|
-
|
|
9251
|
+
const budget = clock.budget(i + 1);
|
|
9252
|
+
await attemptOnce(client, attemptArgs, budget.timeoutMs, options.signal, callContext, label, options.transport, options.allowModelSuggestions, budget.firstOutputTimeoutMs);
|
|
9150
9253
|
log2(`[${callContext}] fallback succeeded with ${label} (attempt ${i + 2}/${fallbacks.length + 1})`);
|
|
9151
9254
|
return;
|
|
9152
9255
|
} catch (error) {
|
|
9153
9256
|
lastError = error;
|
|
9257
|
+
clock.settle(error, attemptStartedAt);
|
|
9154
9258
|
if (isNonRetryable(error, options.signal))
|
|
9155
9259
|
throw error;
|
|
9156
9260
|
const remaining = fallbacks.length - i - 1;
|
|
@@ -9162,9 +9266,9 @@ async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
|
|
|
9162
9266
|
log2(`[${callContext}] all models exhausted; tried: ${[explicitPrimaryLabel, ...fallbacks.map((fallback) => toModelEntry(fallback)?.model ?? String(fallback))].join(", ")}; last error: ${shortErr(lastError)}`);
|
|
9163
9267
|
throw lastError ?? new Error("All fallback models failed");
|
|
9164
9268
|
}
|
|
9165
|
-
async function attemptAndValidate(client, args, timeoutMs, signal, callContext, attempt, options) {
|
|
9269
|
+
async function attemptAndValidate(client, args, timeoutMs, signal, callContext, attempt, options, firstOutputTimeoutMs) {
|
|
9166
9270
|
try {
|
|
9167
|
-
await attemptOnce(client, args, timeoutMs, signal, callContext, attempt.label, options.transport, options.allowModelSuggestions);
|
|
9271
|
+
await attemptOnce(client, args, timeoutMs, signal, callContext, attempt.label, options.transport, options.allowModelSuggestions, firstOutputTimeoutMs);
|
|
9168
9272
|
} catch (error) {
|
|
9169
9273
|
throw {
|
|
9170
9274
|
error,
|
|
@@ -9226,6 +9330,8 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
9226
9330
|
let firstError = null;
|
|
9227
9331
|
let lastError = null;
|
|
9228
9332
|
const cooledPrimary = primaryQuotaFailure(explicitPrimaryLabel);
|
|
9333
|
+
const clock = createChainClock(options, timeoutMs);
|
|
9334
|
+
const primaryStartedAt = Date.now();
|
|
9229
9335
|
try {
|
|
9230
9336
|
if (cooledPrimary)
|
|
9231
9337
|
throw {
|
|
@@ -9240,16 +9346,18 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
9240
9346
|
skipped: true
|
|
9241
9347
|
}
|
|
9242
9348
|
};
|
|
9243
|
-
|
|
9349
|
+
const budget = clock.budget(0);
|
|
9350
|
+
return await attemptAndValidate(client, baseArgs, budget.timeoutMs, options.signal, callContext, {
|
|
9244
9351
|
label: explicitPrimaryLabel,
|
|
9245
9352
|
attemptIndex: 0,
|
|
9246
9353
|
isFallback: false,
|
|
9247
9354
|
totalAttempts,
|
|
9248
9355
|
model: baseBody.model
|
|
9249
|
-
}, options);
|
|
9356
|
+
}, options, budget.firstOutputTimeoutMs);
|
|
9250
9357
|
} catch (caught) {
|
|
9251
9358
|
const failure = caught;
|
|
9252
9359
|
failedAttempts.push(failure);
|
|
9360
|
+
clock.settle(failure.error, primaryStartedAt);
|
|
9253
9361
|
firstError = failure.error;
|
|
9254
9362
|
lastError = failure.error;
|
|
9255
9363
|
if (failure.error instanceof DreamerProviderOutputFailureError && failure.error.quotaResetAt !== undefined)
|
|
@@ -9287,13 +9395,16 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
9287
9395
|
totalAttempts,
|
|
9288
9396
|
model: parsed
|
|
9289
9397
|
};
|
|
9398
|
+
const attemptStartedAt = Date.now();
|
|
9290
9399
|
try {
|
|
9291
|
-
const
|
|
9400
|
+
const budget = clock.budget(i + 1);
|
|
9401
|
+
const result = await attemptAndValidate(client, attemptArgs, budget.timeoutMs, options.signal, callContext, attempt, options, budget.firstOutputTimeoutMs);
|
|
9292
9402
|
log2(`[${callContext}] fallback succeeded with ${label} (attempt ${i + 2}/${fallbacks.length + 1})`);
|
|
9293
9403
|
return result;
|
|
9294
9404
|
} catch (caught) {
|
|
9295
9405
|
const failure = caught;
|
|
9296
9406
|
failedAttempts.push(failure);
|
|
9407
|
+
clock.settle(failure.error, attemptStartedAt);
|
|
9297
9408
|
lastError = failure.error;
|
|
9298
9409
|
if (isNonRetryable(failure.error, options.signal)) {
|
|
9299
9410
|
throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs, options.transport);
|
|
@@ -9334,6 +9445,152 @@ function normalizeSDKResponse(response, fallback, options) {
|
|
|
9334
9445
|
return fallback;
|
|
9335
9446
|
}
|
|
9336
9447
|
// src/features/magic-context/subagent-token-capture.ts
|
|
9448
|
+
var warnedUnknownModels = new Set;
|
|
9449
|
+
var loggedModelReroutes = new Set;
|
|
9450
|
+
var MAX_SUBAGENT_INVOCATION_ERROR_CHARS = 1000;
|
|
9451
|
+
var invocationErrorDetails = new WeakMap;
|
|
9452
|
+
function annotateSubagentInvocationError(error, details) {
|
|
9453
|
+
if (error && typeof error === "object") {
|
|
9454
|
+
const previous = invocationErrorDetails.get(error) ?? {};
|
|
9455
|
+
invocationErrorDetails.set(error, {
|
|
9456
|
+
...previous,
|
|
9457
|
+
...details,
|
|
9458
|
+
hostError: details.hostError ?? previous.hostError
|
|
9459
|
+
});
|
|
9460
|
+
}
|
|
9461
|
+
return error;
|
|
9462
|
+
}
|
|
9463
|
+
function errorDetailsOf(error) {
|
|
9464
|
+
const seen = new Set;
|
|
9465
|
+
const visit = (value, depth) => {
|
|
9466
|
+
if (!value || typeof value !== "object" || depth > 4 || seen.has(value))
|
|
9467
|
+
return {};
|
|
9468
|
+
seen.add(value);
|
|
9469
|
+
const direct = invocationErrorDetails.get(value) ?? {};
|
|
9470
|
+
const record = value;
|
|
9471
|
+
const nested = visit(record.hostError, depth + 1);
|
|
9472
|
+
const cause = visit(record.cause, depth + 1);
|
|
9473
|
+
return {
|
|
9474
|
+
...cause,
|
|
9475
|
+
...nested,
|
|
9476
|
+
...direct,
|
|
9477
|
+
hostError: direct.hostError ?? nested.hostError ?? cause.hostError ?? record.hostError
|
|
9478
|
+
};
|
|
9479
|
+
};
|
|
9480
|
+
return visit(error, 0);
|
|
9481
|
+
}
|
|
9482
|
+
function modelRef(value) {
|
|
9483
|
+
const reference = typeof value === "string" ? value : value?.model;
|
|
9484
|
+
return typeof reference === "string" && reference.trim().length > 0 ? reference.trim() : undefined;
|
|
9485
|
+
}
|
|
9486
|
+
function splitModelRef(value) {
|
|
9487
|
+
if (!value)
|
|
9488
|
+
return { providerId: null, modelId: null };
|
|
9489
|
+
const slash = value.indexOf("/");
|
|
9490
|
+
return slash > 0 && slash < value.length - 1 ? { providerId: value.slice(0, slash), modelId: value.slice(slash + 1) } : { providerId: null, modelId: value };
|
|
9491
|
+
}
|
|
9492
|
+
function cleanOneLine(value) {
|
|
9493
|
+
const oneLine = sanitizeDiagnosticText(value).replaceAll("\r", " ").replaceAll(`
|
|
9494
|
+
`, " ").replaceAll("\t", " ").replace(/\s+/g, " ").trim();
|
|
9495
|
+
return oneLine.length <= MAX_SUBAGENT_INVOCATION_ERROR_CHARS ? oneLine : `${oneLine.slice(0, MAX_SUBAGENT_INVOCATION_ERROR_CHARS - 1)}…`;
|
|
9496
|
+
}
|
|
9497
|
+
function recordMessage(error) {
|
|
9498
|
+
if (typeof error === "string")
|
|
9499
|
+
return error;
|
|
9500
|
+
if (!error || typeof error !== "object")
|
|
9501
|
+
return String(error ?? "");
|
|
9502
|
+
const record = error;
|
|
9503
|
+
const data = record.data && typeof record.data === "object" ? record.data : undefined;
|
|
9504
|
+
const message = typeof data?.message === "string" ? data.message : typeof record.message === "string" ? record.message : typeof record.description === "string" ? record.description : "";
|
|
9505
|
+
const name = typeof record.name === "string" ? record.name : typeof record.type === "string" ? record.type : "";
|
|
9506
|
+
return [name, message].filter(Boolean).join(": ") || "The host reported an error without a message.";
|
|
9507
|
+
}
|
|
9508
|
+
function modelNotFoundDetail(error, attemptedModel) {
|
|
9509
|
+
const seen = new Set;
|
|
9510
|
+
const visit = (value, depth) => {
|
|
9511
|
+
if (typeof value === "string") {
|
|
9512
|
+
const modelMatch = value.match(/model not found:\s*(.+?)(?=(?:\.?\s*did you mean|$))/i);
|
|
9513
|
+
if (!modelMatch)
|
|
9514
|
+
return null;
|
|
9515
|
+
const model = modelMatch[1].trim().replace(/[.,;(]+$/, "");
|
|
9516
|
+
const suggestion = value.match(/did you mean:?\s*\(?\s*([^?);]+)/i)?.[1]?.trim();
|
|
9517
|
+
const message = `Model not found: ${model}${suggestion ? ` (did you mean ${suggestion}?)` : ""}`;
|
|
9518
|
+
return { model, ...suggestion ? { suggestion } : {}, message };
|
|
9519
|
+
}
|
|
9520
|
+
if (!value || typeof value !== "object" || depth > 4 || seen.has(value))
|
|
9521
|
+
return null;
|
|
9522
|
+
seen.add(value);
|
|
9523
|
+
const record = value;
|
|
9524
|
+
const data = record.data && typeof record.data === "object" ? record.data : undefined;
|
|
9525
|
+
const modelRecord = data?.model ?? record.model;
|
|
9526
|
+
const modelId = (typeof data?.modelID === "string" ? data.modelID : undefined) ?? (typeof modelRecord?.modelID === "string" ? modelRecord.modelID : undefined) ?? (typeof modelRecord?.id === "string" ? modelRecord.id : undefined);
|
|
9527
|
+
const providerId = (typeof data?.providerID === "string" ? data.providerID : undefined) ?? (typeof modelRecord?.providerID === "string" ? modelRecord.providerID : undefined);
|
|
9528
|
+
const suggestions = data?.suggestions;
|
|
9529
|
+
const suggestion = Array.isArray(suggestions) && typeof suggestions[0] === "string" ? suggestions[0] : typeof data?.suggestion === "string" ? data.suggestion : undefined;
|
|
9530
|
+
const rawMessage = recordMessage(value);
|
|
9531
|
+
const fromMessage = visit(rawMessage, depth + 1);
|
|
9532
|
+
if (fromMessage)
|
|
9533
|
+
return fromMessage.suggestion || !suggestion ? fromMessage : {
|
|
9534
|
+
...fromMessage,
|
|
9535
|
+
suggestion,
|
|
9536
|
+
message: `Model not found: ${fromMessage.model} (did you mean ${suggestion}?)`
|
|
9537
|
+
};
|
|
9538
|
+
const name = `${String(record.name ?? "")} ${String(record.type ?? "")}`;
|
|
9539
|
+
if (/ProviderModelNotFoundError|model not found/i.test(name) && modelId) {
|
|
9540
|
+
const model = providerId ? `${providerId}/${modelId}` : modelId;
|
|
9541
|
+
const detail = `Model not found: ${model}${suggestion ? ` (did you mean ${suggestion}?)` : ""}`;
|
|
9542
|
+
return { model, ...suggestion ? { suggestion } : {}, message: detail };
|
|
9543
|
+
}
|
|
9544
|
+
for (const key of ["data", "error", "cause", "hostError"]) {
|
|
9545
|
+
const match = visit(record[key], depth + 1);
|
|
9546
|
+
if (match)
|
|
9547
|
+
return match;
|
|
9548
|
+
}
|
|
9549
|
+
return null;
|
|
9550
|
+
};
|
|
9551
|
+
const found = visit(error, 0);
|
|
9552
|
+
if (!found && attemptedModel && (typeof error === "string" && /ProviderModelNotFoundError/i.test(error) || error !== null && typeof error === "object" && /ProviderModelNotFoundError/i.test(`${String(error.name ?? "")} ${String(error.type ?? "")}`))) {
|
|
9553
|
+
return { model: attemptedModel, message: `Model not found: ${attemptedModel}` };
|
|
9554
|
+
}
|
|
9555
|
+
return found;
|
|
9556
|
+
}
|
|
9557
|
+
function hostLabel(harness) {
|
|
9558
|
+
switch (harness) {
|
|
9559
|
+
case "opencode2":
|
|
9560
|
+
return "OpenCode 2";
|
|
9561
|
+
case "opencode":
|
|
9562
|
+
return "OpenCode";
|
|
9563
|
+
case "pi":
|
|
9564
|
+
return "Pi";
|
|
9565
|
+
case "omp":
|
|
9566
|
+
return "Oh My Pi";
|
|
9567
|
+
}
|
|
9568
|
+
}
|
|
9569
|
+
function invocationErrorText(input, details, attemptedModel) {
|
|
9570
|
+
if (input.error == null && input.hostError == null && details.hostError == null)
|
|
9571
|
+
return null;
|
|
9572
|
+
const rawHostError = input.hostError ?? details.hostError;
|
|
9573
|
+
const modelError = modelNotFoundDetail(rawHostError ?? input.error, attemptedModel);
|
|
9574
|
+
if (modelError) {
|
|
9575
|
+
return cleanOneLine(`No reply: ${hostLabel(input.harness)} refused the model: ${modelError.message}`);
|
|
9576
|
+
}
|
|
9577
|
+
if (rawHostError != null) {
|
|
9578
|
+
return cleanOneLine(`No reply: ${hostLabel(input.harness)} reported a child-session error: ${recordMessage(rawHostError)}`);
|
|
9579
|
+
}
|
|
9580
|
+
return cleanOneLine(describeError(input.error).brief);
|
|
9581
|
+
}
|
|
9582
|
+
function warnUnknownModel(input, details, attemptedModel, modelConfigKey) {
|
|
9583
|
+
if (!attemptedModel)
|
|
9584
|
+
return;
|
|
9585
|
+
const issue = modelNotFoundDetail(input.hostError ?? details.hostError ?? input.error, attemptedModel);
|
|
9586
|
+
if (!issue || warnedUnknownModels.has(attemptedModel))
|
|
9587
|
+
return;
|
|
9588
|
+
if (!modelConfigKey)
|
|
9589
|
+
return;
|
|
9590
|
+
warnedUnknownModels.add(attemptedModel);
|
|
9591
|
+
const suggestion = issue.suggestion ? `provider suggests ${cleanOneLine(issue.suggestion)}` : "provider gave no model suggestion";
|
|
9592
|
+
log2(`[magic-context] WARNING: ${modelConfigKey} configured ${attemptedModel}, but ${hostLabel(input.harness)} does not know that model; ${suggestion}`);
|
|
9593
|
+
}
|
|
9337
9594
|
function asNumber(value) {
|
|
9338
9595
|
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
9339
9596
|
}
|
|
@@ -9404,8 +9661,11 @@ function sumTokensFromChildMessages(messages) {
|
|
|
9404
9661
|
function findLastAssistantModel(messages) {
|
|
9405
9662
|
for (let index = messages.length - 1;index >= 0; index -= 1) {
|
|
9406
9663
|
const message = messages[index];
|
|
9407
|
-
if (isAssistantMessage(message))
|
|
9408
|
-
|
|
9664
|
+
if (isAssistantMessage(message)) {
|
|
9665
|
+
const model = modelFromMessage(message);
|
|
9666
|
+
if (model.providerId || model.modelId)
|
|
9667
|
+
return model;
|
|
9668
|
+
}
|
|
9409
9669
|
}
|
|
9410
9670
|
return { providerId: null, modelId: null };
|
|
9411
9671
|
}
|
|
@@ -9414,10 +9674,25 @@ function recordChildInvocation(input) {
|
|
|
9414
9674
|
return null;
|
|
9415
9675
|
const tokens = input.tokens ?? sumTokensFromChildMessages(input.messages ?? []);
|
|
9416
9676
|
const observedModel = findLastAssistantModel(input.messages ?? []);
|
|
9677
|
+
const details = errorDetailsOf(input.error);
|
|
9678
|
+
const attemptedModel = details.attemptedModel ?? modelRef(input.attemptedModel);
|
|
9679
|
+
const attemptConfig = [input.attemptedModel, ...input.configuredModels ?? []].find((candidate) => modelRef(candidate) === attemptedModel);
|
|
9680
|
+
const modelConfigKey = details.modelConfigKey ?? input.modelConfigKey ?? (typeof attemptConfig === "object" ? attemptConfig?.sourceConfigKey : undefined);
|
|
9681
|
+
const attemptedParts = splitModelRef(attemptedModel);
|
|
9417
9682
|
const model = {
|
|
9418
|
-
providerId: input.providerId ??
|
|
9419
|
-
modelId: input.modelId ??
|
|
9683
|
+
providerId: observedModel.providerId ?? input.providerId ?? attemptedParts.providerId,
|
|
9684
|
+
modelId: observedModel.modelId ?? input.modelId ?? attemptedParts.modelId
|
|
9420
9685
|
};
|
|
9686
|
+
const reportedModelRef = observedModel.providerId && observedModel.modelId ? `${observedModel.providerId}/${observedModel.modelId}` : input.providerId && input.modelId ? `${input.providerId}/${input.modelId}` : undefined;
|
|
9687
|
+
if (attemptedModel && reportedModelRef && attemptedModel !== reportedModelRef && (observedModel.providerId !== null || input.providerId !== undefined)) {
|
|
9688
|
+
const rerouteKey = `${input.harness}\x00${attemptedModel}\x00${reportedModelRef}`;
|
|
9689
|
+
if (!loggedModelReroutes.has(rerouteKey)) {
|
|
9690
|
+
loggedModelReroutes.add(rerouteKey);
|
|
9691
|
+
sessionLog2(input.parentSessionId, `subagent model rerouted by host: attempted=${attemptedModel} reported=${reportedModelRef}`);
|
|
9692
|
+
}
|
|
9693
|
+
}
|
|
9694
|
+
warnUnknownModel(input, details, attemptedModel, modelConfigKey);
|
|
9695
|
+
const errorText = invocationErrorText(input, details, attemptedModel);
|
|
9421
9696
|
try {
|
|
9422
9697
|
return recordSubagentInvocation(input.db, {
|
|
9423
9698
|
sessionId: input.parentSessionId,
|
|
@@ -9433,7 +9708,7 @@ function recordChildInvocation(input) {
|
|
|
9433
9708
|
outputTokens: tokens.output,
|
|
9434
9709
|
cacheReadTokens: tokens.cacheRead,
|
|
9435
9710
|
cacheWriteTokens: tokens.cacheWrite,
|
|
9436
|
-
error:
|
|
9711
|
+
error: errorText,
|
|
9437
9712
|
parentInvocationId: input.parentInvocationId ?? null
|
|
9438
9713
|
});
|
|
9439
9714
|
} catch (error) {
|
|
@@ -9467,6 +9742,17 @@ var HOST_SESSION_ERROR = Symbol("promptAsyncHostSessionError");
|
|
|
9467
9742
|
function isHostSessionError(error) {
|
|
9468
9743
|
return error !== null && typeof error === "object" && error[HOST_SESSION_ERROR] === true;
|
|
9469
9744
|
}
|
|
9745
|
+
function hostSessionErrorOf(error) {
|
|
9746
|
+
if (!isHostSessionError(error))
|
|
9747
|
+
return;
|
|
9748
|
+
return error.hostError;
|
|
9749
|
+
}
|
|
9750
|
+
function requestModelRef(request) {
|
|
9751
|
+
const model = request.body?.model;
|
|
9752
|
+
if (model && typeof model.providerID === "string" && typeof model.modelID === "string")
|
|
9753
|
+
return `${model.providerID}/${model.modelID}`;
|
|
9754
|
+
return;
|
|
9755
|
+
}
|
|
9470
9756
|
function supportsPromptAsync(client) {
|
|
9471
9757
|
const session = sessionApi(client);
|
|
9472
9758
|
return typeof session?.promptAsync === "function" && typeof session?.status === "function" && typeof session?.messages === "function";
|
|
@@ -9515,6 +9801,24 @@ function isTerminalAssistant(message) {
|
|
|
9515
9801
|
const info = infoOf(message);
|
|
9516
9802
|
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"));
|
|
9517
9803
|
}
|
|
9804
|
+
function showsModelOutput(message) {
|
|
9805
|
+
if (infoOf(message).role !== "assistant")
|
|
9806
|
+
return false;
|
|
9807
|
+
const tokens = sumTokensFromChildMessages([message]);
|
|
9808
|
+
if (tokens.input + tokens.output + tokens.cacheRead + tokens.cacheWrite > 0)
|
|
9809
|
+
return true;
|
|
9810
|
+
const parts = message?.parts;
|
|
9811
|
+
if (!Array.isArray(parts))
|
|
9812
|
+
return false;
|
|
9813
|
+
return parts.some((part) => {
|
|
9814
|
+
if (!part || typeof part !== "object")
|
|
9815
|
+
return false;
|
|
9816
|
+
const { type, text } = part;
|
|
9817
|
+
if (type === "tool")
|
|
9818
|
+
return true;
|
|
9819
|
+
return (type === "text" || type === "reasoning") && typeof text === "string" && text.trim().length > 0;
|
|
9820
|
+
});
|
|
9821
|
+
}
|
|
9518
9822
|
function unwrapData(response) {
|
|
9519
9823
|
if (response && typeof response === "object" && "data" in response) {
|
|
9520
9824
|
return response.data;
|
|
@@ -9603,15 +9907,35 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
9603
9907
|
const initialBaseline = new Set(completionBaseline);
|
|
9604
9908
|
activeSessionErrors.set(sessionId, undefined);
|
|
9605
9909
|
try {
|
|
9606
|
-
|
|
9910
|
+
let sent;
|
|
9911
|
+
try {
|
|
9912
|
+
sent = await session.promptAsync?.(request);
|
|
9913
|
+
} catch (error) {
|
|
9914
|
+
annotateSubagentInvocationError(error, {
|
|
9915
|
+
attemptedModel: requestModelRef(request),
|
|
9916
|
+
modelConfigKey: options.modelConfigKey,
|
|
9917
|
+
hostError: error
|
|
9918
|
+
});
|
|
9919
|
+
throw error;
|
|
9920
|
+
}
|
|
9607
9921
|
if (sent && typeof sent === "object" && "error" in sent) {
|
|
9608
9922
|
const rejection = sent.error;
|
|
9609
9923
|
if (rejection) {
|
|
9610
|
-
|
|
9924
|
+
const error = new Error(`prompt_async was rejected: ${describeRejection(rejection)}`, {
|
|
9925
|
+
cause: rejection
|
|
9926
|
+
});
|
|
9927
|
+
annotateSubagentInvocationError(error, {
|
|
9928
|
+
attemptedModel: requestModelRef(request),
|
|
9929
|
+
modelConfigKey: options.modelConfigKey,
|
|
9930
|
+
hostError: rejection
|
|
9931
|
+
});
|
|
9932
|
+
throw error;
|
|
9611
9933
|
}
|
|
9612
9934
|
}
|
|
9613
9935
|
let sentAt = Date.now();
|
|
9614
9936
|
let sawBusy = false;
|
|
9937
|
+
noteModelActivityMonitored(signal);
|
|
9938
|
+
let sawOutput = false;
|
|
9615
9939
|
for (;; ) {
|
|
9616
9940
|
await sleep(pollIntervalMs, signal);
|
|
9617
9941
|
const hostError = activeSessionErrors.get(sessionId);
|
|
@@ -9620,12 +9944,25 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
9620
9944
|
Object.assign(error, {
|
|
9621
9945
|
name: "DreamerProviderOutputFailureError",
|
|
9622
9946
|
transient: true,
|
|
9623
|
-
[HOST_SESSION_ERROR]: true
|
|
9947
|
+
[HOST_SESSION_ERROR]: true,
|
|
9948
|
+
hostError
|
|
9949
|
+
});
|
|
9950
|
+
annotateSubagentInvocationError(error, {
|
|
9951
|
+
attemptedModel: requestModelRef(request),
|
|
9952
|
+
modelConfigKey: options.modelConfigKey,
|
|
9953
|
+
hostError
|
|
9624
9954
|
});
|
|
9625
9955
|
throw error;
|
|
9626
9956
|
}
|
|
9627
9957
|
const status = await readStatus(session, sessionId, dir, signal);
|
|
9628
9958
|
const messages = await readMessages(session, sessionId, dir, signal);
|
|
9959
|
+
if (!sawOutput && messages.some((message) => {
|
|
9960
|
+
const id = messageId2(message);
|
|
9961
|
+
return id !== null && !initialBaseline.has(id) && showsModelOutput(message);
|
|
9962
|
+
})) {
|
|
9963
|
+
sawOutput = true;
|
|
9964
|
+
noteModelOutputReceived(signal);
|
|
9965
|
+
}
|
|
9629
9966
|
if (budget) {
|
|
9630
9967
|
const latest = messages.at(-1);
|
|
9631
9968
|
const latestId = messageId2(latest);
|
|
@@ -17136,6 +17473,8 @@ function resolveHiddenCompletionExecutor(executor, client, db, directory, entryP
|
|
|
17136
17473
|
}
|
|
17137
17474
|
function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
17138
17475
|
const historianChildren = new Set;
|
|
17476
|
+
const hostErrors = new Map;
|
|
17477
|
+
const runIdentities = new Map;
|
|
17139
17478
|
return {
|
|
17140
17479
|
capabilities: { tools: true, harness: "opencode" },
|
|
17141
17480
|
async open(run) {
|
|
@@ -17152,23 +17491,49 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
|
17152
17491
|
preferResponseOnMissingData: true
|
|
17153
17492
|
});
|
|
17154
17493
|
const id = typeof created?.id === "string" ? created.id : "";
|
|
17155
|
-
if (id)
|
|
17494
|
+
if (id) {
|
|
17156
17495
|
rememberV1HiddenRun(id, run);
|
|
17496
|
+
runIdentities.set(id, run);
|
|
17497
|
+
}
|
|
17157
17498
|
if (id && run.kind !== "dreamer-task") {
|
|
17158
17499
|
historianChildren.add(id);
|
|
17159
17500
|
rememberHistorianOutputCap(id, run.maxOutputTokens);
|
|
17160
17501
|
}
|
|
17161
|
-
|
|
17502
|
+
const configured = toModelEntry(run.model);
|
|
17503
|
+
return {
|
|
17504
|
+
id,
|
|
17505
|
+
childSessionId: id || undefined,
|
|
17506
|
+
...configured ? { attemptedModel: configured.model } : {},
|
|
17507
|
+
...configured?.sourceConfigKey ? { modelConfigKey: configured.sourceConfigKey } : {}
|
|
17508
|
+
};
|
|
17162
17509
|
},
|
|
17163
17510
|
async attempt(handle, request) {
|
|
17164
17511
|
if (!client)
|
|
17165
17512
|
throw new Error("Hidden completion client is unavailable");
|
|
17513
|
+
const identity = runIdentities.get(handle.id);
|
|
17514
|
+
const requestedModel = request.body?.model;
|
|
17515
|
+
const requestedRef = requestedModel && typeof requestedModel.providerID === "string" && typeof requestedModel.modelID === "string" ? `${requestedModel.providerID}/${requestedModel.modelID}` : undefined;
|
|
17516
|
+
const matchingConfigured = (identity?.configuredModels ?? []).map(toModelEntry).find((entry) => entry?.model === requestedRef);
|
|
17517
|
+
const configured = matchingConfigured ?? (requestedRef && identity?.model && toModelEntry(identity.model)?.model === requestedRef ? toModelEntry(identity.model) : toModelEntry(identity?.model));
|
|
17518
|
+
handle.attemptedModel = requestedRef ?? configured?.model ?? handle.attemptedModel;
|
|
17519
|
+
handle.modelConfigKey = configured?.sourceConfigKey ?? handle.modelConfigKey;
|
|
17166
17520
|
if (supportsPromptAsync(client)) {
|
|
17167
17521
|
try {
|
|
17168
|
-
await promptAsyncAndWaitForIdle(client, request
|
|
17522
|
+
await promptAsyncAndWaitForIdle(client, request, {
|
|
17523
|
+
modelConfigKey: handle.modelConfigKey
|
|
17524
|
+
});
|
|
17169
17525
|
} catch (error) {
|
|
17170
|
-
if (
|
|
17171
|
-
|
|
17526
|
+
if (isHostSessionError(error)) {
|
|
17527
|
+
const hostError = hostSessionErrorOf(error);
|
|
17528
|
+
hostErrors.set(handle.id, hostError);
|
|
17529
|
+
annotateSubagentInvocationError(error, {
|
|
17530
|
+
attemptedModel: handle.attemptedModel,
|
|
17531
|
+
modelConfigKey: handle.modelConfigKey,
|
|
17532
|
+
hostError
|
|
17533
|
+
});
|
|
17534
|
+
if (historianChildren.has(handle.id))
|
|
17535
|
+
return;
|
|
17536
|
+
}
|
|
17172
17537
|
throw error;
|
|
17173
17538
|
}
|
|
17174
17539
|
return;
|
|
@@ -17186,9 +17551,16 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
|
17186
17551
|
preferResponseOnMissingData: true
|
|
17187
17552
|
});
|
|
17188
17553
|
const assistantFailure = extractLatestAssistantFailure(messages);
|
|
17554
|
+
const hostError = hostErrors.get(handle.id);
|
|
17189
17555
|
if (assistantFailure) {
|
|
17190
17556
|
const finish = assistantFailure.finish ? ` (finish=${assistantFailure.finish})` : "";
|
|
17191
|
-
|
|
17557
|
+
const error = new Error(`Historian host recorded an assistant error${finish}: ${describeAssistantFailure(assistantFailure.error)}`, hostError === undefined ? undefined : { cause: hostError });
|
|
17558
|
+
annotateSubagentInvocationError(error, {
|
|
17559
|
+
attemptedModel: handle.attemptedModel,
|
|
17560
|
+
modelConfigKey: handle.modelConfigKey,
|
|
17561
|
+
hostError
|
|
17562
|
+
});
|
|
17563
|
+
throw error;
|
|
17192
17564
|
}
|
|
17193
17565
|
const text = extractLatestAssistantText(messages);
|
|
17194
17566
|
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;
|
|
@@ -17199,13 +17571,18 @@ function createV1HiddenCompletionExecutor(client, db, directory) {
|
|
|
17199
17571
|
reasoning: text ? null : extractLatestHistorianReasoning(messages),
|
|
17200
17572
|
lengthCapped: hasLengthCappedOutput(messages),
|
|
17201
17573
|
usage: sumTokensFromChildMessages(messages),
|
|
17202
|
-
tokenLog: runTokenLog(info.tokens, undefined, info.finish ?? info.finish_reason ?? info.finishReason)
|
|
17574
|
+
tokenLog: runTokenLog(info.tokens, undefined, info.finish ?? info.finish_reason ?? info.finishReason),
|
|
17575
|
+
attemptedModel: handle.attemptedModel,
|
|
17576
|
+
modelConfigKey: handle.modelConfigKey,
|
|
17577
|
+
...hostError === undefined ? {} : { hostError }
|
|
17203
17578
|
};
|
|
17204
17579
|
},
|
|
17205
17580
|
async close(handle, settlement) {
|
|
17206
17581
|
if (handle?.id) {
|
|
17207
17582
|
rememberV1HiddenRun(handle.id, undefined);
|
|
17208
17583
|
historianChildren.delete(handle.id);
|
|
17584
|
+
hostErrors.delete(handle.id);
|
|
17585
|
+
runIdentities.delete(handle.id);
|
|
17209
17586
|
forgetHistorianOutputCap(handle.id);
|
|
17210
17587
|
}
|
|
17211
17588
|
if (!client)
|
|
@@ -17360,7 +17737,8 @@ async function runHistorianPrompt(args) {
|
|
|
17360
17737
|
if (invocationRecorded)
|
|
17361
17738
|
return null;
|
|
17362
17739
|
invocationRecorded = true;
|
|
17363
|
-
const
|
|
17740
|
+
const configuredModel = toModelEntry(modelOverride);
|
|
17741
|
+
const actualModelRef = completion?.providerId && completion.modelId ? `${completion.providerId}/${completion.modelId}` : handle?.attemptedModel ?? configuredModel?.model ?? null;
|
|
17364
17742
|
const usedConfiguredFallback = actualModelRef !== null && (fallbackModels ?? []).some((candidate) => toModelEntry(candidate)?.model === actualModelRef);
|
|
17365
17743
|
return recordChildInvocation({
|
|
17366
17744
|
db: openDatabase(),
|
|
@@ -17376,6 +17754,10 @@ async function runHistorianPrompt(args) {
|
|
|
17376
17754
|
providerId: completion.providerId,
|
|
17377
17755
|
modelId: completion.modelId
|
|
17378
17756
|
} : {},
|
|
17757
|
+
attemptedModel: handle?.attemptedModel ?? modelOverride,
|
|
17758
|
+
configuredModels: fallbackModels,
|
|
17759
|
+
modelConfigKey: handle?.modelConfigKey ?? configuredModel?.sourceConfigKey,
|
|
17760
|
+
hostError: params.hostError ?? completion?.hostError,
|
|
17379
17761
|
error: params.error,
|
|
17380
17762
|
parentInvocationId: agentId === HISTORIAN_EDITOR_AGENT ? parentInvocationId ?? null : null
|
|
17381
17763
|
});
|
|
@@ -17489,7 +17871,8 @@ async function runHistorianPrompt(args) {
|
|
|
17489
17871
|
const invocationId = recordInvocation({
|
|
17490
17872
|
status: emptyError ? "empty" : "completed",
|
|
17491
17873
|
messages: completion.messages,
|
|
17492
|
-
error: emptyError
|
|
17874
|
+
error: emptyError,
|
|
17875
|
+
hostError: completion.hostError
|
|
17493
17876
|
});
|
|
17494
17877
|
if (emptyError && (!reasoningResult || lengthCapped)) {
|
|
17495
17878
|
return {
|
|
@@ -17696,19 +18079,19 @@ async function embedAndStoreCompartmentChunks(db, sessionId, projectPath, compar
|
|
|
17696
18079
|
const maxInputTokens = getProjectEmbeddingMaxInputTokens2(projectPath);
|
|
17697
18080
|
for (const compartment of compartments) {
|
|
17698
18081
|
try {
|
|
17699
|
-
const fromMemory = compartment.sourceChunkText ?
|
|
17700
|
-
const mappedText = fromMemory ? fromMemory :
|
|
18082
|
+
const fromMemory = compartment.sourceChunkText ? canonicalizeInMemoryChunkTextForEmbedding2(compartment.sourceChunkText, compartment.startMessage, compartment.endMessage) : "";
|
|
18083
|
+
const mappedText = fromMemory ? fromMemory : buildCanonicalChunkTextFromFts2(db, sessionId, compartment.startMessage, compartment.endMessage);
|
|
17701
18084
|
if (mappedText === null)
|
|
17702
18085
|
continue;
|
|
17703
|
-
const canonicalText = mappedText ||
|
|
18086
|
+
const canonicalText = mappedText || buildCompartmentSummaryFallbackText2(db, compartment.id);
|
|
17704
18087
|
if (canonicalText.length === 0)
|
|
17705
18088
|
continue;
|
|
17706
|
-
const windows =
|
|
18089
|
+
const windows = chunkCanonicalText2(canonicalText, compartment.startMessage, compartment.endMessage, maxInputTokens);
|
|
17707
18090
|
if (windows.length === 0)
|
|
17708
18091
|
continue;
|
|
17709
|
-
const windowSourceKey =
|
|
18092
|
+
const windowSourceKey = chunkWindowSourceKey2(canonicalText, compartment.startMessage, compartment.endMessage, maxInputTokens);
|
|
17710
18093
|
const currentModelId = getProjectChunkEmbeddingModelId2(projectPath);
|
|
17711
|
-
if (currentModelId !== "off" &&
|
|
18094
|
+
if (currentModelId !== "off" && chunkEmbeddingWindowsAreCurrent2(db, compartment.id, currentModelId, windows, projectPath)) {
|
|
17712
18095
|
continue;
|
|
17713
18096
|
}
|
|
17714
18097
|
const result = await embedItemsForProject2(projectPath, windows.map((window) => ({
|
|
@@ -17718,7 +18101,7 @@ async function embedAndStoreCompartmentChunks(db, sessionId, projectPath, compar
|
|
|
17718
18101
|
})), undefined, db, sessionId);
|
|
17719
18102
|
if (!result)
|
|
17720
18103
|
continue;
|
|
17721
|
-
if (
|
|
18104
|
+
if (chunkEmbeddingWindowsAreCurrent2(db, compartment.id, currentModelId, windows, projectPath)) {
|
|
17722
18105
|
continue;
|
|
17723
18106
|
}
|
|
17724
18107
|
const rows = [];
|
|
@@ -17736,7 +18119,7 @@ async function embedAndStoreCompartmentChunks(db, sessionId, projectPath, compar
|
|
|
17736
18119
|
});
|
|
17737
18120
|
}
|
|
17738
18121
|
if (rows.length === windows.length) {
|
|
17739
|
-
|
|
18122
|
+
replaceCompartmentChunkEmbeddings2(db, rows, windowSourceKey);
|
|
17740
18123
|
enqueueShadowEmbeddingItems2(projectPath, "chunk", [String(compartment.id)]);
|
|
17741
18124
|
}
|
|
17742
18125
|
} catch (error) {
|
|
@@ -19189,7 +19572,8 @@ function resolveProtectedTailBoundary(ctx) {
|
|
|
19189
19572
|
break;
|
|
19190
19573
|
}
|
|
19191
19574
|
livePromptFloor.ordinal = lastMeaningfulUserOrdinal || null;
|
|
19192
|
-
|
|
19575
|
+
livePromptFloor.messageId = boundaryMessageId(index, lastMeaningfulUserOrdinal);
|
|
19576
|
+
if (!ctx.liftLivePromptFloor && lastMeaningfulUserOrdinal >= offset) {
|
|
19193
19577
|
protectedTailStart = Math.min(protectedTailStart, lastMeaningfulUserOrdinal);
|
|
19194
19578
|
}
|
|
19195
19579
|
}
|
|
@@ -19317,6 +19701,7 @@ function resolveBoundaryContext(args) {
|
|
|
19317
19701
|
protectedTailPolicyVersion: meta.protectedTailPolicyVersion,
|
|
19318
19702
|
migrationFloorActive,
|
|
19319
19703
|
emergencyTailScale: args.emergencyTailScale,
|
|
19704
|
+
liftLivePromptFloor: args.liftLivePromptFloor,
|
|
19320
19705
|
providerShapeVersion: args.providerShapeVersion ?? "opencode-v1",
|
|
19321
19706
|
cacheNamespace: args.cacheNamespace ?? `opencode:${args.sessionId}`,
|
|
19322
19707
|
storedTokenTotalsForMessages,
|
|
@@ -20428,7 +20813,7 @@ function promoteRecompStagingWithM0Mutation(db, sessionId, holderId) {
|
|
|
20428
20813
|
finished = true;
|
|
20429
20814
|
return null;
|
|
20430
20815
|
}
|
|
20431
|
-
|
|
20816
|
+
deleteChunkEmbedBackoffForSession2(db, sessionId);
|
|
20432
20817
|
db.prepare("DELETE FROM compartments WHERE session_id = ?").run(sessionId);
|
|
20433
20818
|
db.prepare("DELETE FROM session_facts WHERE session_id = ?").run(sessionId);
|
|
20434
20819
|
insertRecompCompartmentRows(db, sessionId, staging.compartments, now);
|
|
@@ -21378,4 +21763,4 @@ async function executeContextRecomp(deps, options = {}) {
|
|
|
21378
21763
|
return (await executeContextRecompWithResult(deps, options)).message;
|
|
21379
21764
|
}
|
|
21380
21765
|
|
|
21381
|
-
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, 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, createDbLkgPersistence, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, registerLkgPersistence, 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, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, sumTokensFromChildMessages, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|
|
21766
|
+
export { denyTaskRoutingToCallerAgents, buildHiddenAgentRegistrations, buildZenReadAgentRegistrations, buildHiddenAgentConfig, getMagicContextBuiltinCommands, formatConfigParseStatusLine, claimConfigParseFailuresOnce, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, migrateMagicContextConfigLocations, getProtectedTokensTierOverrides, loadPluginConfigDetailed, historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, createDreamerOutputCapSampler, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, 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, createDbLkgPersistence, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, registerLkgPersistence, 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, createChildSessionWithFence, HiddenCompletionRefusal, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, HIDDEN_RUN_DISPOSED_REASON, noteChildOfDisposedInstance, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, ModelProducedNoOutputError, noteModelActivityMonitored, noteModelOutputReceived, isPromptTimeoutError, getPromptFailureDetail, raceWithSignal, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, annotateSubagentInvocationError, failedInvocationStatus, sumTokensFromChildMessages, recordChildInvocation, recordPromptSessionError, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, systemPromptFingerprint, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, setKeepSubagents, teardownChildSession, getCompartmentEvents, runTokenLog, formatRunTokenLog, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, readCoordinateGeneration, readCoordinateRebaseNotice, formatCoordinateRebaseNotice, rebaseSessionCoordinatesAsync, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, omitIncompleteFileTokenTotals, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, noteTransformPassForExactOrdinalReads, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, executeContextRecomp };
|