@cortexkit/opencode-magic-context 0.49.103 → 0.49.105
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 +5 -5
- package/dist/chunk-embedding-write-worker.js +8 -5
- package/dist/{context-jk7bgc3s.js → context-wtnrsjkp.js} +116 -139
- package/dist/{embedding-backfill-anty7zdf.js → embedding-backfill-kqwx0vhj.js} +6 -6
- package/dist/{v2/embedding-cache-dveynq4m.js → embedding-cache-fhdkn9nc.js} +3 -1
- package/dist/embedding-worker.js +1 -1
- package/dist/features/magic-context/chunk-embedding-write-worker-install-failure.fixture.d.ts +2 -0
- package/dist/features/magic-context/chunk-embedding-write-worker-install-failure.fixture.d.ts.map +1 -0
- package/dist/features/magic-context/chunk-scope-repair-revision.d.ts +16 -1
- package/dist/features/magic-context/chunk-scope-repair-revision.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-checkout.d.ts +2 -0
- package/dist/features/magic-context/dreamer/verify-checkout.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-cache.d.ts +1 -0
- package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-loop.d.ts +9 -1
- package/dist/features/magic-context/memory/embedding-worker-loop.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-observer.fixture.d.ts +26 -0
- package/dist/features/magic-context/memory/embedding-worker-observer.fixture.d.ts.map +1 -0
- package/dist/features/magic-context/message-fts-rowid-map-startup-worker-test-support.d.ts +2 -0
- package/dist/features/magic-context/message-fts-rowid-map-startup-worker-test-support.d.ts.map +1 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts +5 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/search-pool-fixture.d.ts +15 -0
- package/dist/features/magic-context/search-pool-fixture.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +4 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/history-boundary-repair.d.ts +7 -2
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +1 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +1 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-3nxhxeeg.js → index-1j4q0bd6.js} +4 -4
- package/dist/{index-fd3hkyk1.js → index-42fsf88t.js} +1 -1
- package/dist/{v2/server-qbydvfev.js → index-6xg55350.js} +15 -11
- package/dist/{index-jjxpmypb.js → index-7z5cvfpg.js} +1 -1
- package/dist/{index-jg5whyrd.js → index-8vv7axxg.js} +3 -3
- package/dist/{index-42fg6tzz.js → index-92p5yfpp.js} +4 -4
- package/dist/{index-7jvc0rhh.js → index-9m2b5mwf.js} +21 -8
- package/dist/{index-9mxkvdtp.js → index-a3t1ck7g.js} +8 -8
- package/dist/{index-vhx6yph7.js → index-as8bg7eh.js} +367 -115
- package/dist/{index-jyj9jg9f.js → index-cxh5g5bt.js} +2 -2
- package/dist/{index-vegw385y.js → index-cy5fn70d.js} +89 -1
- package/dist/{index-4dywj733.js → index-dzb1yc9w.js} +1 -1
- package/dist/{index-t2h3484a.js → index-edafv9d7.js} +5 -5
- package/dist/{index-6t6v8prs.js → index-ff1hqh4a.js} +3 -3
- package/dist/{index-ke0mkz7g.js → index-g1h1efr0.js} +1 -1
- package/dist/{index-f455a0g3.js → index-k37h4yrb.js} +5 -3
- package/dist/{index-mes48s7a.js → index-mg6cwqw2.js} +220 -27
- package/dist/{index-nyjztqyj.js → index-p5ey52j9.js} +32 -5
- package/dist/{index-pw1f07vg.js → index-srpghrje.js} +1 -1
- package/dist/{index-4536jdzj.js → index-xzs1fxzz.js} +2 -2
- package/dist/{index-hyvxmz3e.js → index-y1875y4h.js} +1 -1
- package/dist/{index-4v50y0jr.js → index-ydevzvfs.js} +1 -1
- package/dist/{index-ab86c21b.js → index-zj0ra8vs.js} +1 -1
- package/dist/index.js +53 -62
- package/dist/migration-worker.js +3 -3
- package/dist/{project-embedding-registry-4cv7n37m.js → project-embedding-registry-0z0nd73p.js} +5 -5
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{recomp-orchestrator-vg4cxyp7.js → recomp-orchestrator-zagjzbz5.js} +15 -15
- package/dist/{render-f32trg2t.js → render-vwp72qd0.js} +6 -6
- package/dist/{search-ygtyb91s.js → search-7e1rcqb7.js} +12 -12
- package/dist/{search-archive-yh6xtvrx.js → search-archive-6tr0gcf7.js} +2 -2
- package/dist/shared/sqlite-busy-test-support.d.ts +21 -0
- package/dist/shared/sqlite-busy-test-support.d.ts.map +1 -0
- package/dist/shared/sqlite-write-locker-test-support.d.ts +12 -0
- package/dist/shared/sqlite-write-locker-test-support.d.ts.map +1 -1
- package/dist/{storage-memory-p91f7b5h.js → storage-memory-24hsvzy8.js} +2 -2
- package/dist/{store-wpx314rk.js → store-4eeezg83.js} +2 -2
- package/dist/{store-reader-c5fwa9qx.js → store-reader-g8w2wp88.js} +1 -1
- package/dist/{transform-postprocess-phase-958fmjs5.js → transform-postprocess-phase-v3p3q2gf.js} +16 -16
- package/dist/v2/auto-search-worker.js +5 -5
- package/dist/v2/chunk-embedding-write-worker.js +8 -5
- package/dist/v2/{context-3g3jvxg8.js → context-fbdac7qt.js} +166 -150
- package/dist/v2/{embedding-backfill-ra9gbbs4.js → embedding-backfill-e44pv5db.js} +6 -6
- package/dist/{embedding-cache-dveynq4m.js → v2/embedding-cache-fhdkn9nc.js} +3 -1
- package/dist/v2/embedding-worker.js +1 -1
- package/dist/v2/event-subscription.fixture.d.ts +9 -0
- package/dist/v2/event-subscription.fixture.d.ts.map +1 -0
- package/dist/v2/hidden-model-activity.d.ts +13 -0
- package/dist/v2/hidden-model-activity.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts +1 -0
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/dream-trigger.d.ts +2 -1
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/event-subscription-worker.d.ts +11 -0
- package/dist/v2/hooks/event-subscription-worker.d.ts.map +1 -0
- package/dist/v2/hooks/types.d.ts +1 -0
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/hooks/update-check.d.ts +1 -0
- package/dist/v2/hooks/update-check.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-j1sxtefe.js → message-index-bounded-nwqfb1p5.js} +3 -3
- package/dist/v2/migration-worker.js +3 -3
- package/dist/v2/{project-embedding-registry-gdaqb7h0.js → project-embedding-registry-rhzjnypp.js} +5 -5
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-p6z3kmdj.js → read-session-chunk-brqatg83.js} +2 -2
- package/dist/v2/{recomp-orchestrator-29m3cc5b.js → recomp-orchestrator-1ech6k2n.js} +17 -17
- package/dist/v2/{render-jpj43axy.js → render-pfe3smhx.js} +10 -10
- package/dist/v2/{search-archive-wbhxp0p1.js → search-archive-r8krrz47.js} +5 -5
- package/dist/v2/{search-ybyc7vmx.js → search-sffewrs4.js} +15 -15
- package/dist/v2/{server-kx5egpt7.js → server-16115spd.js} +4 -4
- package/dist/v2/server-28jqb7s0.js +6 -0
- package/dist/v2/{server-qg8jyfxa.js → server-5xx10mqe.js} +1 -1
- package/dist/{index-qbydvfev.js → v2/server-6xg55350.js} +15 -11
- package/dist/v2/{server-t45hgcsg.js → server-7jw608jk.js} +2 -2
- package/dist/v2/{server-8f92sd2r.js → server-7pxjk184.js} +6 -4
- package/dist/v2/{server-3mb205v9.js → server-83rjf4df.js} +1 -1
- package/dist/v2/{server-df5scn4q.js → server-9t4yjj20.js} +27 -12
- package/dist/v2/{server-ga6y57vh.js → server-c32505fr.js} +6 -4
- package/dist/v2/{server-8m5wk6aq.js → server-cpb7b1f9.js} +5 -5
- package/dist/v2/{server-qdpd8h27.js → server-fn6k1ack.js} +1 -1
- package/dist/v2/{server-1qxdyz4p.js → server-ghb2q1z9.js} +2 -2
- package/dist/v2/{server-pqgnjf38.js → server-gkb0y83n.js} +32 -5
- package/dist/v2/{server-r851hxn5.js → server-hqcdvs2n.js} +13 -13
- package/dist/v2/{server-9ms9b75c.js → server-j00jprwm.js} +4 -6
- package/dist/v2/{server-xpy46ddq.js → server-jtd5vq5e.js} +3 -3
- package/dist/v2/{server-b01a7dhj.js → server-kk2kbzq3.js} +1 -1
- package/dist/v2/{server-mc5t7k8v.js → server-ma0qhqg9.js} +1 -1
- package/dist/v2/{server-x22jtpna.js → server-n3bfqd0j.js} +4 -2
- package/dist/v2/{server-fagcnt6j.js → server-pjvqyg6g.js} +367 -115
- package/dist/v2/{server-jrs4gny6.js → server-qtajgx1e.js} +89 -1
- package/dist/v2/{server-pw1f07vg.js → server-srpghrje.js} +1 -1
- package/dist/v2/server-t104h957.js +177 -0
- package/dist/v2/{server-j09jx1n9.js → server-v2r04xds.js} +1 -1
- package/dist/v2/{server-7c5p0bh1.js → server-z77hman6.js} +1 -1
- package/dist/v2/server.js +31 -40
- package/dist/v2/{storage-memory-p91f7b5h.js → storage-memory-24hsvzy8.js} +2 -2
- package/dist/v2/{storage-tags-s7nvvyg8.js → storage-tags-ee72g2zv.js} +1 -1
- package/dist/v2/{store-mba47sxn.js → store-9rsrj5pt.js} +2 -2
- package/dist/v2/{store-reader-w7w8vfsy.js → store-reader-tb0f9621.js} +1 -1
- package/dist/v2/store-reader.d.ts +1 -1
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/tui/index.d.ts.map +1 -1
- package/dist/v2/{v2-archive-reader-5njmg3a3.js → v2-archive-reader-0xysfgxh.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-ahkq8a61.js → wrapup-orchestrator-8d4ak3x3.js} +17 -17
- package/dist/{v2-archive-reader-y38khjax.js → v2-archive-reader-fac1zmhj.js} +1 -1
- package/dist/{wrapup-orchestrator-gjqaac65.js → wrapup-orchestrator-wz10b94c.js} +16 -16
- package/package.json +1 -1
- package/src/config/migrate-config-location.test.ts +41 -29
- package/src/shared/model-suggestion-retry.test.ts +137 -90
- package/src/shared/off-thread-migration-clock.test.ts +19 -9
- package/src/shared/prompt-async-transport.test.ts +125 -42
- package/src/shared/rpc-async-probes.test.ts +56 -36
- package/src/shared/rpc-client.test.ts +51 -18
- package/src/shared/sqlite-acquisition-routing.test.ts +79 -22
- package/src/shared/sqlite-busy-budget-review.test.ts +129 -111
- package/src/shared/sqlite-busy-test-support.ts +154 -0
- package/src/shared/sqlite-foreground-wait.test.ts +213 -156
- package/src/shared/sqlite-pass-scope.test.ts +142 -105
- package/src/shared/sqlite-turn-deadline.test.ts +149 -124
- package/src/shared/sqlite-write-locker-test-support.ts +44 -12
- package/src/shared/stable-json-linear.test.ts +29 -11
- package/src/shared/startup-maintenance-policy.test.ts +72 -2
- package/src/shared/storage-busy.test.ts +45 -18
- package/src/shared/storage-file-mutex-review.test.ts +65 -51
- package/src/shared/tui-preferences.test.ts +15 -5
- package/src/shared/worker-shutdown.test.ts +26 -20
- package/src/tui/data/notification-socket.test.ts +220 -108
- package/src/v2/tui/index.ts +5 -1
- package/src/v2/tui/status-dialog-fallback.test.ts +23 -1
- package/dist/v2/server-84w6rvvf.js +0 -14
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
readSearchBackfillCursor2,
|
|
11
11
|
writeSearchBackfillCursor2,
|
|
12
12
|
embedItemsWindowBounded2
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-as8bg7eh.js";
|
|
14
14
|
import {
|
|
15
15
|
saveEmbeddingIfHashMatches
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-6xg55350.js";
|
|
17
17
|
|
|
18
18
|
// src/features/magic-context/memory/embedding-backfill.ts
|
|
19
19
|
var SEARCH_BACKFILL_LIMIT = 50;
|
|
@@ -8,6 +8,9 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
inRootAsyncContext2
|
|
10
10
|
} from "./index-gzy5w8ya.js";
|
|
11
|
+
import {
|
|
12
|
+
isKnownAutocommit
|
|
13
|
+
} from "./index-8ajstryz.js";
|
|
11
14
|
import {
|
|
12
15
|
projectDirectoryKey
|
|
13
16
|
} from "./index-knvkbfvh.js";
|
|
@@ -737,4 +740,89 @@ function setBootQuietPeriodForTests(startAtMs) {
|
|
|
737
740
|
bootQuietUntilMs = startAtMs === null ? 0 : startAtMs + BOOT_QUIET_MS;
|
|
738
741
|
}
|
|
739
742
|
|
|
740
|
-
|
|
743
|
+
// src/features/magic-context/chunk-scope-repair-revision.ts
|
|
744
|
+
var revisions = new WeakMap;
|
|
745
|
+
var installedAtSchema = new WeakMap;
|
|
746
|
+
var warned = new WeakSet;
|
|
747
|
+
var BINDING_KEY = "chunk_scope_repair_binding_revision";
|
|
748
|
+
var ROW_KEY = "chunk_scope_repair_row_revision";
|
|
749
|
+
var missingBinding = `NOT EXISTS (SELECT 1 FROM session_projects WHERE session_id = NEW.session_id
|
|
750
|
+
AND harness = NEW.harness AND project_path = NEW.project_path)`;
|
|
751
|
+
var bump = (key, where = "") => `INSERT INTO schema_migrations_meta(key, value) SELECT '${key}', lower(hex(randomblob(16))) ${where}
|
|
752
|
+
ON CONFLICT(key) DO UPDATE SET value = excluded.value;`;
|
|
753
|
+
function installChunkScopeRepairTriggers(db) {
|
|
754
|
+
if (installedAtSchema.has(db))
|
|
755
|
+
return;
|
|
756
|
+
const { schema_version } = db.prepare("PRAGMA main.schema_version").get();
|
|
757
|
+
const bumpBinding = bump(BINDING_KEY);
|
|
758
|
+
db.exec(`CREATE TEMP TRIGGER IF NOT EXISTS mc_chunk_scope_binding_bi
|
|
759
|
+
BEFORE INSERT ON main.session_projects WHEN ${missingBinding}
|
|
760
|
+
BEGIN ${bumpBinding} END;
|
|
761
|
+
CREATE TEMP TRIGGER IF NOT EXISTS mc_chunk_scope_binding_au
|
|
762
|
+
AFTER UPDATE ON main.session_projects
|
|
763
|
+
WHEN OLD.session_id IS NOT NEW.session_id OR OLD.harness IS NOT NEW.harness
|
|
764
|
+
OR OLD.project_path IS NOT NEW.project_path
|
|
765
|
+
BEGIN ${bumpBinding} END;
|
|
766
|
+
CREATE TEMP TRIGGER IF NOT EXISTS mc_chunk_scope_rows_bi
|
|
767
|
+
BEFORE INSERT ON main.compartment_chunk_embeddings
|
|
768
|
+
BEGIN
|
|
769
|
+
${bump(ROW_KEY)}
|
|
770
|
+
${bump(BINDING_KEY, `WHERE ${missingBinding}`)}
|
|
771
|
+
END;
|
|
772
|
+
CREATE TEMP TRIGGER IF NOT EXISTS mc_chunk_scope_rows_au
|
|
773
|
+
AFTER UPDATE OF project_path, session_id, harness ON main.compartment_chunk_embeddings
|
|
774
|
+
WHEN ${missingBinding}
|
|
775
|
+
BEGIN ${bumpBinding} END;`);
|
|
776
|
+
installedAtSchema.set(db, schema_version);
|
|
777
|
+
}
|
|
778
|
+
function tryInstallChunkScopeRepairTriggers(db) {
|
|
779
|
+
try {
|
|
780
|
+
installChunkScopeRepairTriggers(db);
|
|
781
|
+
} catch (error) {
|
|
782
|
+
forgetAndWarn(db, error);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
function forgetAndWarn(db, error) {
|
|
786
|
+
revisions.delete(db);
|
|
787
|
+
installedAtSchema.delete(db);
|
|
788
|
+
if (warned.has(db))
|
|
789
|
+
return;
|
|
790
|
+
warned.add(db);
|
|
791
|
+
log2("[magic-context] chunk scope repair revision unreadable; checking without the memo", error);
|
|
792
|
+
}
|
|
793
|
+
function readChunkScopeRepairRevision(db) {
|
|
794
|
+
if (!isKnownAutocommit(db))
|
|
795
|
+
return null;
|
|
796
|
+
try {
|
|
797
|
+
return readRevision(db);
|
|
798
|
+
} catch (error) {
|
|
799
|
+
forgetAndWarn(db, error);
|
|
800
|
+
return null;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
function readRevision(db) {
|
|
804
|
+
let statement = revisions.get(db);
|
|
805
|
+
if (!statement) {
|
|
806
|
+
if (!db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = 'schema_migrations_meta'").get())
|
|
807
|
+
return null;
|
|
808
|
+
installChunkScopeRepairTriggers(db);
|
|
809
|
+
statement = db.prepare(`SELECT
|
|
810
|
+
(SELECT value FROM schema_migrations_meta WHERE key = '${BINDING_KEY}') AS binding,
|
|
811
|
+
(SELECT value FROM schema_migrations_meta WHERE key = '${ROW_KEY}') AS rows,
|
|
812
|
+
(SELECT data_version FROM pragma_data_version) AS external,
|
|
813
|
+
(SELECT schema_version FROM pragma_schema_version) AS schemaVersion`);
|
|
814
|
+
revisions.set(db, statement);
|
|
815
|
+
}
|
|
816
|
+
const row = statement.get();
|
|
817
|
+
if (!row || !Number.isInteger(row.schemaVersion) || !Number.isInteger(row.external)) {
|
|
818
|
+
return null;
|
|
819
|
+
}
|
|
820
|
+
if (installedAtSchema.get(db) !== row.schemaVersion) {
|
|
821
|
+
revisions.delete(db);
|
|
822
|
+
installedAtSchema.delete(db);
|
|
823
|
+
return readRevision(db);
|
|
824
|
+
}
|
|
825
|
+
return row;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
export { pruneMissingProjectIdentities, setHomeProjectPermission, shouldSkipHomeProjectMemory, ProjectIdentityError, directoryFallback, resolveProjectIdentityStrict, takeDubiousOwnershipProjectIdentityWarning, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, describeUnresolvedProjectIdentity, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, bootQuietRemainingMs, scheduleAfterBootQuiet, setBootQuietPeriodForTests, tryInstallChunkScopeRepairTriggers, readChunkScopeRepairRevision };
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
saveSourceContent,
|
|
220
220
|
replaceSourceContent,
|
|
221
221
|
getSourceContents
|
|
222
|
-
} from "./index-
|
|
222
|
+
} from "./index-xzs1fxzz.js";
|
|
223
223
|
import {
|
|
224
224
|
cleanSearchText,
|
|
225
225
|
matchedSearchSnippet
|
|
@@ -268,18 +268,18 @@ import {
|
|
|
268
268
|
getProjectEmbeddingSnapshot2,
|
|
269
269
|
embedTextForProject2,
|
|
270
270
|
embedBatchForProject2
|
|
271
|
-
} from "./index-
|
|
271
|
+
} from "./index-as8bg7eh.js";
|
|
272
272
|
import {
|
|
273
273
|
isEmbeddingHostBusy2
|
|
274
274
|
} from "./index-qt1qqasc.js";
|
|
275
275
|
import {
|
|
276
276
|
userFacingFailureCode
|
|
277
|
-
} from "./index-
|
|
277
|
+
} from "./index-92p5yfpp.js";
|
|
278
278
|
import {
|
|
279
279
|
getMessageIndexEpoch,
|
|
280
280
|
isMessageIndexSearchable,
|
|
281
281
|
createAutoSearchDiagnostics
|
|
282
|
-
} from "./index-
|
|
282
|
+
} from "./index-ydevzvfs.js";
|
|
283
283
|
import {
|
|
284
284
|
compareOpenCodeMessagesByCanonicalOrder,
|
|
285
285
|
startCompactionMarkerCandidatePreparation,
|
|
@@ -301,7 +301,7 @@ import {
|
|
|
301
301
|
peekNoteNudgeText,
|
|
302
302
|
markNoteNudgeDelivered,
|
|
303
303
|
getActiveCompartmentRun
|
|
304
|
-
} from "./index-
|
|
304
|
+
} from "./index-9m2b5mwf.js";
|
|
305
305
|
import {
|
|
306
306
|
canonicalModelIdentity,
|
|
307
307
|
piModelRefToCanonical,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getCompartments,
|
|
10
10
|
getLastCompartmentEndMessage,
|
|
11
11
|
requestPendingMaterialization
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-xzs1fxzz.js";
|
|
13
13
|
import {
|
|
14
14
|
inRootAsyncContext2
|
|
15
15
|
} from "./index-gzy5w8ya.js";
|
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
getActiveCompartmentRun,
|
|
36
36
|
markActiveCompartmentRunPublished,
|
|
37
37
|
registerActiveCompartmentRun
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-9m2b5mwf.js";
|
|
39
39
|
import {
|
|
40
40
|
sendStatusNotification2
|
|
41
41
|
} from "./index-61a853ky.js";
|
|
42
42
|
import {
|
|
43
43
|
setRecompStarting2,
|
|
44
44
|
setRecompTerminal2
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-8vv7axxg.js";
|
|
46
46
|
|
|
47
47
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
48
48
|
import * as crypto from "node:crypto";
|
|
@@ -152,7 +152,7 @@ function decode(row) {
|
|
|
152
152
|
}
|
|
153
153
|
function fileIdentity(path) {
|
|
154
154
|
const stat = statSync(path);
|
|
155
|
-
return `${stat.
|
|
155
|
+
return `${stat.ino}:${stat.birthtimeMs}`;
|
|
156
156
|
}
|
|
157
157
|
function openConfirmed(path, identity) {
|
|
158
158
|
const db = new Database2(path, { readonly: true, fileMustExist: true });
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
withPrivilegedWriter2
|
|
13
13
|
} from "./index-gzy5w8ya.js";
|
|
14
14
|
import {
|
|
15
|
-
scheduleAfterBootQuiet
|
|
16
|
-
|
|
15
|
+
scheduleAfterBootQuiet,
|
|
16
|
+
tryInstallChunkScopeRepairTriggers
|
|
17
|
+
} from "./index-cy5fn70d.js";
|
|
17
18
|
import {
|
|
18
19
|
getHarness2,
|
|
19
20
|
harnessOwnsOpenCodeStore2
|
|
@@ -65,7 +66,7 @@ import {
|
|
|
65
66
|
hasPendingMigrations,
|
|
66
67
|
getMainThreadMigrationBodyCount,
|
|
67
68
|
runMigrations
|
|
68
|
-
} from "./index-
|
|
69
|
+
} from "./index-y1875y4h.js";
|
|
69
70
|
import {
|
|
70
71
|
installTagIdentityRevisionTrigger,
|
|
71
72
|
ensureColumn,
|
|
@@ -1063,6 +1064,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1063
1064
|
closeQuietly(db);
|
|
1064
1065
|
return null;
|
|
1065
1066
|
}
|
|
1067
|
+
tryInstallChunkScopeRepairTriggers(db);
|
|
1066
1068
|
healWedgedChannel2Claims(db);
|
|
1067
1069
|
if (!explicitDbPath && scheduleStartupMaintenanceOnOpen) {
|
|
1068
1070
|
const readsOpenCodeStore = harnessOwnsOpenCodeStore2();
|
|
@@ -87,7 +87,7 @@ import {
|
|
|
87
87
|
storedPathBelongsToIdentity,
|
|
88
88
|
beginBootQuietPeriod,
|
|
89
89
|
scheduleAfterBootQuiet
|
|
90
|
-
} from "./index-
|
|
90
|
+
} from "./index-cy5fn70d.js";
|
|
91
91
|
import {
|
|
92
92
|
recordSessionProjectIdentity,
|
|
93
93
|
hasRecordedSessionProjectIdentity,
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
markGitSweepSuccessAndRelease,
|
|
98
98
|
parkGitSweepNonIndexable,
|
|
99
99
|
releaseGitSweepLease
|
|
100
|
-
} from "./index-
|
|
100
|
+
} from "./index-42fsf88t.js";
|
|
101
101
|
import {
|
|
102
102
|
CTX_MEMORY_TOOL_NAME,
|
|
103
103
|
CTX_MEMORY_LIST_TOOL_NAME,
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
snapRangeToCompartments,
|
|
220
220
|
getActiveCompartmentRun,
|
|
221
221
|
startCompartmentAgent
|
|
222
|
-
} from "./index-
|
|
222
|
+
} from "./index-9m2b5mwf.js";
|
|
223
223
|
import {
|
|
224
224
|
formatWindowDerivationLine,
|
|
225
225
|
getSdkWindowGeometry,
|
|
@@ -475,7 +475,7 @@ import {
|
|
|
475
475
|
runSqliteOptimize,
|
|
476
476
|
openDatabase,
|
|
477
477
|
openCurrentDatabase
|
|
478
|
-
} from "./index-
|
|
478
|
+
} from "./index-k37h4yrb.js";
|
|
479
479
|
import {
|
|
480
480
|
unescapeXml,
|
|
481
481
|
resolveWorkspaceShareCategories,
|
|
@@ -484,7 +484,7 @@ import {
|
|
|
484
484
|
resolveStoredPathWorkspaceIdentity,
|
|
485
485
|
storedPathBelongsToWorkspace,
|
|
486
486
|
computeWorkspaceEpochFingerprint
|
|
487
|
-
} from "./index-
|
|
487
|
+
} from "./index-y1875y4h.js";
|
|
488
488
|
import {
|
|
489
489
|
V2_MEMORY_CATEGORIES,
|
|
490
490
|
CATEGORY_PRIORITY
|
|
@@ -594,7 +594,7 @@ import {
|
|
|
594
594
|
GLOBAL_USER_PROFILE_PROJECT_PATH,
|
|
595
595
|
getProjectState,
|
|
596
596
|
bumpProjectUserProfileVersion
|
|
597
|
-
} from "./index-
|
|
597
|
+
} from "./index-xzs1fxzz.js";
|
|
598
598
|
import {
|
|
599
599
|
getLastIndexedOrdinal
|
|
600
600
|
} from "./index-p8nc9axh.js";
|
|
@@ -623,7 +623,7 @@ import {
|
|
|
623
623
|
createPrimer,
|
|
624
624
|
updatePrimerSupport,
|
|
625
625
|
updatePrimerAnswer
|
|
626
|
-
} from "./index-
|
|
626
|
+
} from "./index-zj0ra8vs.js";
|
|
627
627
|
import {
|
|
628
628
|
registerNotificationSink2,
|
|
629
629
|
pushNotification2,
|
|
@@ -635,7 +635,7 @@ import {
|
|
|
635
635
|
getCachedLocalEmbeddingPooling,
|
|
636
636
|
preflightLocalEmbeddingPooling,
|
|
637
637
|
getLocalEmbeddingNativeMemoryStats
|
|
638
|
-
} from "./index-
|
|
638
|
+
} from "./index-p5ey52j9.js";
|
|
639
639
|
import {
|
|
640
640
|
withQueryEmbeddingDeadline,
|
|
641
641
|
describeShadowBackfillWriteRefusal2,
|
|
@@ -656,12 +656,12 @@ import {
|
|
|
656
656
|
embedSessionCompartmentChunks2,
|
|
657
657
|
getEmbeddingCoverageStatus2,
|
|
658
658
|
getAutoEmbeddingSessionCoverage2
|
|
659
|
-
} from "./index-
|
|
659
|
+
} from "./index-as8bg7eh.js";
|
|
660
660
|
import {
|
|
661
661
|
saveEmbeddingIfHashMatches,
|
|
662
662
|
invalidateProject2,
|
|
663
663
|
invalidateMemory2
|
|
664
|
-
} from "./index-
|
|
664
|
+
} from "./index-6xg55350.js";
|
|
665
665
|
import {
|
|
666
666
|
renderUserFacingFailure,
|
|
667
667
|
userFacingFailureCode,
|
|
@@ -682,7 +682,7 @@ import {
|
|
|
682
682
|
readGitFileChangeTimesSince,
|
|
683
683
|
verificationFileExists,
|
|
684
684
|
normalizeVerificationFiles
|
|
685
|
-
} from "./index-
|
|
685
|
+
} from "./index-92p5yfpp.js";
|
|
686
686
|
import {
|
|
687
687
|
computeCueContentHash,
|
|
688
688
|
hasMuralCueColumns,
|
|
@@ -709,7 +709,7 @@ import {
|
|
|
709
709
|
archiveMemory2,
|
|
710
710
|
getMemoryCount2,
|
|
711
711
|
getMemoryCountsByStatus2
|
|
712
|
-
} from "./index-
|
|
712
|
+
} from "./index-srpghrje.js";
|
|
713
713
|
import {
|
|
714
714
|
renderSingleStoreMigrationRequiredRefusal,
|
|
715
715
|
SingleStoreMigrationRequiredError,
|
|
@@ -730,13 +730,13 @@ import {
|
|
|
730
730
|
resolveMemoriesByIdsForSearch2,
|
|
731
731
|
unifiedSearch2,
|
|
732
732
|
formatSearchResults2
|
|
733
|
-
} from "./index-
|
|
733
|
+
} from "./index-a3t1ck7g.js";
|
|
734
734
|
import {
|
|
735
735
|
scheduleReconciliation,
|
|
736
736
|
scheduleIncrementalIndex,
|
|
737
737
|
getMessageIndexQueueHeapStats,
|
|
738
738
|
clearSessionTracking
|
|
739
|
-
} from "./index-
|
|
739
|
+
} from "./index-ydevzvfs.js";
|
|
740
740
|
import {
|
|
741
741
|
resolveModelCacheTtl,
|
|
742
742
|
resolveContextWindowGeometry,
|
|
@@ -835,7 +835,7 @@ import {
|
|
|
835
835
|
abortSessionFailClosed2,
|
|
836
836
|
evaluateEmergencyFailClosed2,
|
|
837
837
|
runPostTransformPhase2
|
|
838
|
-
} from "./index-
|
|
838
|
+
} from "./index-edafv9d7.js";
|
|
839
839
|
import {
|
|
840
840
|
flushIgnoredMessages2,
|
|
841
841
|
clearIgnoredMessages2,
|
|
@@ -845,7 +845,7 @@ import {
|
|
|
845
845
|
import {
|
|
846
846
|
setRecompStarting2,
|
|
847
847
|
setRecompTerminal2
|
|
848
|
-
} from "./index-
|
|
848
|
+
} from "./index-8vv7axxg.js";
|
|
849
849
|
import {
|
|
850
850
|
ANNOUNCEMENT_VERSION2,
|
|
851
851
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -863,11 +863,11 @@ import {
|
|
|
863
863
|
} from "./index-zh683xh2.js";
|
|
864
864
|
import {
|
|
865
865
|
readV2ArchiveOffThread2
|
|
866
|
-
} from "./index-
|
|
866
|
+
} from "./index-1j4q0bd6.js";
|
|
867
867
|
import {
|
|
868
868
|
unresolvedLiveTailRefusal2,
|
|
869
869
|
renderSearchArchiveOffThread2
|
|
870
|
-
} from "./index-
|
|
870
|
+
} from "./index-7z5cvfpg.js";
|
|
871
871
|
import {
|
|
872
872
|
takeCoveredInstructionRows,
|
|
873
873
|
cloneKeepingCoveredInstructionMarks
|
|
@@ -10088,6 +10088,35 @@ function recordInvocation4(args, startedAt, params) {
|
|
|
10088
10088
|
});
|
|
10089
10089
|
}
|
|
10090
10090
|
|
|
10091
|
+
// src/features/magic-context/dreamer/verify-checkout.ts
|
|
10092
|
+
import { execFile as execFile4 } from "node:child_process";
|
|
10093
|
+
import { promisify as promisify4 } from "node:util";
|
|
10094
|
+
var exec2 = promisify4(execFile4);
|
|
10095
|
+
var MAX_VERIFY_COMMITS_BEHIND = 10;
|
|
10096
|
+
async function verifyCheckoutSkipReason(directory) {
|
|
10097
|
+
const options = {
|
|
10098
|
+
cwd: directory,
|
|
10099
|
+
encoding: "utf8",
|
|
10100
|
+
timeout: 5000,
|
|
10101
|
+
maxBuffer: 4096,
|
|
10102
|
+
windowsHide: true
|
|
10103
|
+
};
|
|
10104
|
+
try {
|
|
10105
|
+
const head = await exec2("git", ["rev-parse", "--abbrev-ref", "HEAD"], options);
|
|
10106
|
+
if (head.stdout.trim() === "HEAD")
|
|
10107
|
+
return "project checkout has a detached HEAD";
|
|
10108
|
+
const result = await exec2("git", ["rev-list", "--count", "HEAD..@{upstream}"], options);
|
|
10109
|
+
const count = result.stdout.trim();
|
|
10110
|
+
if (!/^\d+$/.test(count))
|
|
10111
|
+
return;
|
|
10112
|
+
const behind = Number(count);
|
|
10113
|
+
if (Number.isSafeInteger(behind) && behind > MAX_VERIFY_COMMITS_BEHIND) {
|
|
10114
|
+
return `project checkout is ${behind} commits behind its upstream branch`;
|
|
10115
|
+
}
|
|
10116
|
+
} catch {}
|
|
10117
|
+
return;
|
|
10118
|
+
}
|
|
10119
|
+
|
|
10091
10120
|
// src/features/magic-context/dreamer/task-executor.ts
|
|
10092
10121
|
function dreamRunFailureDetail(error) {
|
|
10093
10122
|
const prompt = getPromptFailureDetail(error);
|
|
@@ -10370,14 +10399,16 @@ function createDreamTaskExecutor(deps) {
|
|
|
10370
10399
|
...refused === undefined ? {} : { refused: Math.max(0, refused) }
|
|
10371
10400
|
});
|
|
10372
10401
|
};
|
|
10373
|
-
|
|
10402
|
+
const checkoutSkipReason = config.task === "verify" || config.task === "verify-broad" ? await verifyCheckoutSkipReason(deps.sessionDirectory) : undefined;
|
|
10403
|
+
if (!checkoutSkipReason)
|
|
10404
|
+
reportProgress(0);
|
|
10374
10405
|
const incompleteMessage = (remaining) => {
|
|
10375
10406
|
const processed = processedDreamTaskItems(backlogAtStart.pending, remaining);
|
|
10376
10407
|
return `${config.task} incomplete: ${remaining} remain (was ${backlogAtStart.pending} at run start; processed ${processed} this run)`;
|
|
10377
10408
|
};
|
|
10378
10409
|
const migrationRequired = projectNeedsSingleStoreMigration(db, projectIdentity);
|
|
10379
10410
|
let moduleRoute;
|
|
10380
|
-
if (!migrationRequired && !config.modelChainUnavailable && (config.task === "curate" || config.task === "map-memories" || config.task === "compress-cues" || config.task === "classify-memories" || config.task === "verify" || config.task === "verify-broad" || config.task === "retrospective")) {
|
|
10411
|
+
if (!checkoutSkipReason && !migrationRequired && !config.modelChainUnavailable && (config.task === "curate" || config.task === "map-memories" || config.task === "compress-cues" || config.task === "classify-memories" || config.task === "verify" || config.task === "verify-broad" || config.task === "retrospective")) {
|
|
10381
10412
|
try {
|
|
10382
10413
|
moduleRoute = await resolveDreamerModuleRoute({
|
|
10383
10414
|
db,
|
|
@@ -10391,7 +10422,7 @@ function createDreamTaskExecutor(deps) {
|
|
|
10391
10422
|
throw new DreamerModuleFailureError("store admission", error);
|
|
10392
10423
|
}
|
|
10393
10424
|
}
|
|
10394
|
-
const parent = migrationRequired || config.modelChainUnavailable ? deps.parentSessionId : await resolveParentSessionId(deadline);
|
|
10425
|
+
const parent = checkoutSkipReason || migrationRequired || config.modelChainUnavailable ? deps.parentSessionId : await resolveParentSessionId(deadline);
|
|
10395
10426
|
if (!leaseOwnershipMatches(db, holderId, leaseAcquisition.generation, leaseKey)) {
|
|
10396
10427
|
throw new Error("Dream lease lost during executor setup");
|
|
10397
10428
|
}
|
|
@@ -10494,6 +10525,8 @@ function createDreamTaskExecutor(deps) {
|
|
|
10494
10525
|
recordRun("skipped", reason);
|
|
10495
10526
|
return { status: "skipped", detail: reason };
|
|
10496
10527
|
};
|
|
10528
|
+
if (checkoutSkipReason)
|
|
10529
|
+
return skip(checkoutSkipReason);
|
|
10497
10530
|
if (config.modelChainUnavailable)
|
|
10498
10531
|
return skip("Pi model chain is empty (no configured model resolves in Pi)");
|
|
10499
10532
|
if (migrationRequired)
|
|
@@ -16524,7 +16557,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16524
16557
|
const db = readDatabase();
|
|
16525
16558
|
if (!db)
|
|
16526
16559
|
return { ok: false, error: "db unavailable" };
|
|
16527
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16560
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-zagjzbz5.js"));
|
|
16528
16561
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-tfhs4dbc.js"));
|
|
16529
16562
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16530
16563
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -16609,7 +16642,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16609
16642
|
const db = readDatabase();
|
|
16610
16643
|
if (!db)
|
|
16611
16644
|
return { ok: false, error: "db unavailable" };
|
|
16612
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16645
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-wz10b94c.js"));
|
|
16613
16646
|
const model = await args.readSelectedSessionModel?.(sessionId) ?? liveSessionState.liveModelBySession.get(sessionId);
|
|
16614
16647
|
const window = resolveOpenCodeWrapupWindow(db, sessionId, model);
|
|
16615
16648
|
if (!window)
|
|
@@ -24783,6 +24816,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
24783
24816
|
return {
|
|
24784
24817
|
client: args.client,
|
|
24785
24818
|
hiddenCompletionExecutor: args.hiddenCompletionExecutor,
|
|
24819
|
+
isHistorianInstanceDisposed: args.isHistorianInstanceDisposed,
|
|
24786
24820
|
compactionMarkerStrategy: args.compactionMarkerStrategy,
|
|
24787
24821
|
db: args.db,
|
|
24788
24822
|
sessionId: args.sessionId,
|
|
@@ -24930,6 +24964,7 @@ async function runCompartmentPhaseImpl(args) {
|
|
|
24930
24964
|
startCompartmentAgent({
|
|
24931
24965
|
client: args.client,
|
|
24932
24966
|
hiddenCompletionExecutor: args.hiddenCompletionExecutor,
|
|
24967
|
+
isHistorianInstanceDisposed: args.isHistorianInstanceDisposed,
|
|
24933
24968
|
compactionMarkerStrategy: args.compactionMarkerStrategy,
|
|
24934
24969
|
db: args.db,
|
|
24935
24970
|
sessionId: args.sessionId,
|
|
@@ -25890,6 +25925,7 @@ function createTransform(deps) {
|
|
|
25890
25925
|
startCompartmentAgent({
|
|
25891
25926
|
client: deps.client,
|
|
25892
25927
|
hiddenCompletionExecutor: deps.hiddenCompletionExecutor,
|
|
25928
|
+
isHistorianInstanceDisposed: deps.isHistorianInstanceDisposed,
|
|
25893
25929
|
compactionMarkerStrategy: deps.compactionMarkerStrategy,
|
|
25894
25930
|
db,
|
|
25895
25931
|
sessionId,
|
|
@@ -26238,6 +26274,7 @@ ${notice}`, notificationParams));
|
|
|
26238
26274
|
const tCompartmentPhase = performance.now();
|
|
26239
26275
|
const compartmentPhase = await runCompartmentPhase({
|
|
26240
26276
|
hiddenCompletionExecutor: deps.hiddenCompletionExecutor,
|
|
26277
|
+
isHistorianInstanceDisposed: deps.isHistorianInstanceDisposed,
|
|
26241
26278
|
compactionMarkerStrategy: deps.compactionMarkerStrategy,
|
|
26242
26279
|
canRunCompartments,
|
|
26243
26280
|
fullFeatureMode,
|
|
@@ -29501,9 +29538,9 @@ function isMissingError(error) {
|
|
|
29501
29538
|
}
|
|
29502
29539
|
|
|
29503
29540
|
// ../retina-local-fs/src/provider.ts
|
|
29504
|
-
import { execFile as
|
|
29505
|
-
import { promisify as
|
|
29506
|
-
var execFileAsync3 =
|
|
29541
|
+
import { execFile as execFile5 } from "node:child_process";
|
|
29542
|
+
import { promisify as promisify5 } from "node:util";
|
|
29543
|
+
var execFileAsync3 = promisify5(execFile5);
|
|
29507
29544
|
function parseSemver(value) {
|
|
29508
29545
|
const match = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(value);
|
|
29509
29546
|
if (!match) {
|
|
@@ -31075,4 +31112,160 @@ function applyHiddenSubagentTemperature(input, output, log) {
|
|
|
31075
31112
|
output.temperature = temperature;
|
|
31076
31113
|
}
|
|
31077
31114
|
|
|
31078
|
-
|
|
31115
|
+
// src/v2/hidden-model-activity.ts
|
|
31116
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
31117
|
+
var OUTPUT_EVENT_TYPES = [
|
|
31118
|
+
"session.text.delta",
|
|
31119
|
+
"session.reasoning.delta",
|
|
31120
|
+
"session.tool.input.delta",
|
|
31121
|
+
"session.text.ended",
|
|
31122
|
+
"session.reasoning.ended",
|
|
31123
|
+
"session.tool.input.started"
|
|
31124
|
+
];
|
|
31125
|
+
var STABLE_EVENT_SUBSCRIPTION_MS = 30000;
|
|
31126
|
+
async function waitForEventSubscriptionRetry(signal, subscribedAt, retry) {
|
|
31127
|
+
if (Date.now() - subscribedAt >= STABLE_EVENT_SUBSCRIPTION_MS)
|
|
31128
|
+
retry = 0;
|
|
31129
|
+
const ceiling = Math.min(30000, 250 * 2 ** retry);
|
|
31130
|
+
try {
|
|
31131
|
+
await delay(ceiling * (0.5 + Math.random() * 0.5), undefined, { signal });
|
|
31132
|
+
} catch (error) {
|
|
31133
|
+
if (!signal.aborted)
|
|
31134
|
+
throw error;
|
|
31135
|
+
}
|
|
31136
|
+
return Math.min(retry + 1, 7);
|
|
31137
|
+
}
|
|
31138
|
+
|
|
31139
|
+
class HiddenModelActivity {
|
|
31140
|
+
event;
|
|
31141
|
+
watchers = new Map;
|
|
31142
|
+
controller;
|
|
31143
|
+
loggedFailure = false;
|
|
31144
|
+
disposed = false;
|
|
31145
|
+
constructor(event) {
|
|
31146
|
+
this.event = event;
|
|
31147
|
+
}
|
|
31148
|
+
watch(sessionID, onOutput) {
|
|
31149
|
+
if (this.disposed)
|
|
31150
|
+
return () => {};
|
|
31151
|
+
this.watchers.set(sessionID, onOutput);
|
|
31152
|
+
if (!this.controller) {
|
|
31153
|
+
this.controller = new AbortController;
|
|
31154
|
+
const { signal } = this.controller;
|
|
31155
|
+
this.consume(signal).catch((error) => {
|
|
31156
|
+
if (!signal.aborted)
|
|
31157
|
+
this.warn(error);
|
|
31158
|
+
});
|
|
31159
|
+
}
|
|
31160
|
+
return () => {
|
|
31161
|
+
if (this.watchers.get(sessionID) === onOutput)
|
|
31162
|
+
this.watchers.delete(sessionID);
|
|
31163
|
+
if (this.watchers.size === 0) {
|
|
31164
|
+
this.controller?.abort();
|
|
31165
|
+
this.controller = undefined;
|
|
31166
|
+
}
|
|
31167
|
+
};
|
|
31168
|
+
}
|
|
31169
|
+
dispose() {
|
|
31170
|
+
this.disposed = true;
|
|
31171
|
+
this.watchers.clear();
|
|
31172
|
+
this.controller?.abort();
|
|
31173
|
+
this.controller = undefined;
|
|
31174
|
+
}
|
|
31175
|
+
warn(error) {
|
|
31176
|
+
if (this.loggedFailure)
|
|
31177
|
+
return;
|
|
31178
|
+
this.loggedFailure = true;
|
|
31179
|
+
log2("[magic-context] v2 hidden output subscription ended unexpectedly; retrying while watched", error);
|
|
31180
|
+
}
|
|
31181
|
+
async consume(signal) {
|
|
31182
|
+
let retry = 0;
|
|
31183
|
+
while (!signal.aborted) {
|
|
31184
|
+
const subscribedAt = Date.now();
|
|
31185
|
+
try {
|
|
31186
|
+
for await (const event of this.event.subscribe({
|
|
31187
|
+
signal,
|
|
31188
|
+
types: OUTPUT_EVENT_TYPES
|
|
31189
|
+
})) {
|
|
31190
|
+
if (signal.aborted)
|
|
31191
|
+
break;
|
|
31192
|
+
this.observe(event);
|
|
31193
|
+
}
|
|
31194
|
+
if (!signal.aborted)
|
|
31195
|
+
this.warn();
|
|
31196
|
+
} catch (error) {
|
|
31197
|
+
if (!signal.aborted)
|
|
31198
|
+
this.warn(error);
|
|
31199
|
+
}
|
|
31200
|
+
if (!signal.aborted)
|
|
31201
|
+
retry = await waitForEventSubscriptionRetry(signal, subscribedAt, retry);
|
|
31202
|
+
}
|
|
31203
|
+
}
|
|
31204
|
+
observe(event) {
|
|
31205
|
+
if (!isRecord(event) || typeof event.type !== "string" || !OUTPUT_EVENT_TYPES.includes(event.type))
|
|
31206
|
+
return;
|
|
31207
|
+
if (!isRecord(event.data))
|
|
31208
|
+
return;
|
|
31209
|
+
const { sessionID, delta, text } = event.data;
|
|
31210
|
+
if (typeof sessionID !== "string")
|
|
31211
|
+
return;
|
|
31212
|
+
const streamed = event.type.endsWith(".delta") && typeof delta === "string" && delta.length > 0;
|
|
31213
|
+
const ended = event.type.endsWith(".ended") && typeof text === "string" && text.length > 0;
|
|
31214
|
+
if (streamed || ended || event.type === "session.tool.input.started") {
|
|
31215
|
+
this.watchers.get(sessionID)?.();
|
|
31216
|
+
}
|
|
31217
|
+
}
|
|
31218
|
+
}
|
|
31219
|
+
|
|
31220
|
+
// src/v2/hooks/event-subscription-worker.ts
|
|
31221
|
+
function startEventSubscriptionWorker(event, types, diagnostics, handle) {
|
|
31222
|
+
const controller = new AbortController;
|
|
31223
|
+
const { signal } = controller;
|
|
31224
|
+
const handlerFailures = new Set;
|
|
31225
|
+
const done = (async () => {
|
|
31226
|
+
let retry = 0;
|
|
31227
|
+
let loggedOutage = false;
|
|
31228
|
+
while (!signal.aborted) {
|
|
31229
|
+
const subscribedAt = Date.now();
|
|
31230
|
+
let streamError;
|
|
31231
|
+
try {
|
|
31232
|
+
for await (const value of event.subscribe({ signal, types })) {
|
|
31233
|
+
if (signal.aborted)
|
|
31234
|
+
break;
|
|
31235
|
+
try {
|
|
31236
|
+
if (await handle(value, signal))
|
|
31237
|
+
handlerFailures.clear();
|
|
31238
|
+
} catch (error) {
|
|
31239
|
+
if (signal.aborted)
|
|
31240
|
+
break;
|
|
31241
|
+
const cause = error instanceof Error ? `${error.name}: ${error.message}` : error;
|
|
31242
|
+
if (!handlerFailures.has(cause)) {
|
|
31243
|
+
handlerFailures.add(cause);
|
|
31244
|
+
diagnostics.handlerFailed(error);
|
|
31245
|
+
}
|
|
31246
|
+
}
|
|
31247
|
+
}
|
|
31248
|
+
} catch (error) {
|
|
31249
|
+
streamError = error;
|
|
31250
|
+
}
|
|
31251
|
+
if (signal.aborted)
|
|
31252
|
+
break;
|
|
31253
|
+
if (Date.now() - subscribedAt >= STABLE_EVENT_SUBSCRIPTION_MS)
|
|
31254
|
+
loggedOutage = false;
|
|
31255
|
+
if (!loggedOutage) {
|
|
31256
|
+
loggedOutage = true;
|
|
31257
|
+
diagnostics.subscriptionEnded(streamError);
|
|
31258
|
+
}
|
|
31259
|
+
retry = await waitForEventSubscriptionRetry(signal, subscribedAt, retry);
|
|
31260
|
+
}
|
|
31261
|
+
})();
|
|
31262
|
+
return {
|
|
31263
|
+
done,
|
|
31264
|
+
async dispose() {
|
|
31265
|
+
controller.abort();
|
|
31266
|
+
await done;
|
|
31267
|
+
}
|
|
31268
|
+
};
|
|
31269
|
+
}
|
|
31270
|
+
|
|
31271
|
+
export { logConfigDependencyNotesOnce, openOpenCodeDb, DREAMER_SYSTEM_PROMPT, runSessionProjectBackfill, SMART_NOTE_COMPILER_SYSTEM_PROMPT, createLiveSessionState, RETROSPECTIVE_MAX_USER_MESSAGE_CHARS, RETROSPECTIVE_MESSAGE_TRUNCATION_MARKER, OpenCodeRetrospectiveRawProvider, createDreamTaskExecutor, runManualDream, runDueTasksForProject, startDreamScheduleTimer, createDreamTimerModuleClient, ensureProjectRegisteredFromOpenCodeDirectory, describeStorageUnavailability, resolveSessionCacheTtl, runEmbedHistoryDrain, pauseEmbedHistoryDrain, formatEmbedStatusText, getSessionProperties, getSessionCreatedInfo, getMessageUpdatedAssistantInfo, getMessageUpdatedInfo, getSessionErrorInfo, getMessageRemovedInfo, summarizeManualDream, createMagicContextCommandHandler, getLiveNotificationParams, createChatMessageHook, createEventHook, createCommandExecuteBeforeHook, createToolExecuteAfterHook, recordHiddenVariantWarning, buildStatusDetail, isDebugRpcEnabled, registerRpcHandlers, recordHostSqliteRuntime, maybeAutoEmbedSessionBackfill, clearTransformDecisionSession, scheduleOpenCodeTransformDecisionWrite, stageOpenCodeV2TransformDecision, bindOpenCodeV2TransformDecision, maybeDeliverChannel2, PROVIDER_OVERFLOW_NOTICE, noteServedRecoveryForOverflowHint, holdOverflowResendHint, ProviderRefusalCounts, snapshotRefusalHistory, pushRefusalFields, withProviderRefusalPass, createM0RenderOptions, lkgReplayLimit, measureLkgReplay, moduleRawBlockMappings, STORAGE_BUSY_MESSAGE, StorageBusyRefusalError, bindSystemDateRequestIdentity, bindSystemDateOutput, registerSystemDateRefresh, rustWrapupHistorianFields, isClearlyOverWindow, UnmanagedOverWindowError, UnresolvedHistoryBoundaryError, clearMessageTokensCache, rendersCompartmentHistory, createTransform, createSubcModuleClient, createModuleToolBackends, createRustRefusalRecovery, createSystemPromptHashHandler, tryMessagesTransformLkgReplay, createMessagesTransformHandler, primaryOnlyToolIds, subagentToolRefusal, guardSubagentTools, hideSubagentTools, removePrimaryOnlyTools, storedSubagentMode, createCtxExpandTools, CTX_MEMORY_ACTIONS, createCtxMemoryTools, createDreamerMemoryTools, CTX_NOTE_DESCRIPTION, withoutSmartNoteText, createCtxNoteTools, createCtxReduceTools, createCtxSearchTools, parameterDescriptionsFor, applyJsonSchemaParameterDescriptions, MagicContextRpcServer, subagentTemperature, applyHiddenSubagentTemperature, waitForEventSubscriptionRetry, HiddenModelActivity, startEventSubscriptionWorker };
|