@cortexkit/opencode-magic-context 0.49.70 → 0.49.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-search-worker.js +3 -3
- package/dist/chunk-embedding-write-worker.js +1 -1
- package/dist/{context-rcts8w54.js → context-830ksymq.js} +18 -18
- package/dist/{embedding-backfill-sk7agn5v.js → embedding-backfill-exnyad7d.js} +2 -2
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts +10 -2
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +2 -2
- package/dist/features/magic-context/project-embedding-registry.d.ts +1 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
- package/dist/{index-0dbc9rxd.js → index-2m1j98fj.js} +3 -3
- package/dist/{index-fcrp1k8s.js → index-3mx8math.js} +1 -1
- package/dist/{index-d0mb17q4.js → index-64qpnmjb.js} +2 -2
- package/dist/{index-gq1g9a3a.js → index-9swgykdd.js} +4 -3
- package/dist/{index-mxjdj2cz.js → index-bdnak4d0.js} +17 -3
- package/dist/{index-y664y8kq.js → index-cw3j0pwy.js} +1 -1
- package/dist/{index-5hc4kjg0.js → index-etm62gd7.js} +1 -1
- package/dist/{index-51anehwt.js → index-jeckjrh0.js} +13 -13
- package/dist/{index-cdyhpdqx.js → index-q5rcetym.js} +4 -4
- package/dist/index-q9ywd8b2.js +65 -0
- package/dist/{index-gvnt9yka.js → index-sc5segqg.js} +7 -7
- package/dist/{index-n6aye6ny.js → index-ve863q40.js} +98 -2
- package/dist/{index-mejvnav7.js → index-w8sv1v0j.js} +10 -10
- package/dist/{index-mey1nc1v.js → index-xha0yxhy.js} +1 -1
- package/dist/{index-rzxzap49.js → index-y6q5qvdz.js} +5 -5
- package/dist/{index-95475ngp.js → index-yh7hxjxm.js} +191 -121
- package/dist/{index-fm0bpxc6.js → index-yhz1w3ss.js} +1 -1
- package/dist/{index-n19pqsnh.js → index-zt6d9fag.js} +2 -2
- package/dist/index.js +21 -21
- package/dist/{message-index-bounded-n2j33x8n.js → message-index-bounded-vf70t44t.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/{project-embedding-registry-c2sfnamh.js → project-embedding-registry-n50fbax6.js} +1 -1
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-6kdtfa7k.js → read-session-chunk-9jtq1swq.js} +2 -2
- package/dist/{recomp-orchestrator-t9670x13.js → recomp-orchestrator-sa4f2mkj.js} +10 -10
- package/dist/{render-re3akx9j.js → render-qkjgrg31.js} +6 -6
- package/dist/{search-rppmngr5.js → search-0v2v9yd5.js} +8 -8
- package/dist/{search-archive-0q8rdnrd.js → search-archive-cmfs3myg.js} +4 -4
- package/dist/{storage-tags-rptkad9p.js → storage-tags-d3nqrva7.js} +1 -1
- package/dist/{transform-postprocess-phase-qtd2wr52.js → transform-postprocess-phase-ecrcsc2w.js} +11 -11
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- package/dist/v2/{context-wv122q62.js → context-q846asea.js} +188 -117
- package/dist/v2/{embedding-backfill-j2xj86zn.js → embedding-backfill-jhmn81cz.js} +2 -2
- package/dist/v2/{message-index-bounded-hfnsznj0.js → message-index-bounded-ev9sarf6.js} +3 -3
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/{project-embedding-registry-k0hjqt11.js → project-embedding-registry-07nz4qas.js} +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-qzd376gb.js → read-session-chunk-eb49qfzz.js} +2 -2
- package/dist/v2/{recomp-orchestrator-rrsbcsmc.js → recomp-orchestrator-egbf57qa.js} +9 -9
- package/dist/v2/{render-qwy9ydnb.js → render-47vjswds.js} +6 -6
- package/dist/v2/{search-q3xcyyq8.js → search-03pzsd5w.js} +7 -7
- package/dist/v2/{search-archive-gewpafej.js → search-archive-3tpaqkg4.js} +4 -4
- package/dist/v2/{server-ssdfdrpv.js → server-3jggqcpa.js} +12 -12
- package/dist/v2/{server-xxy28mq5.js → server-4nh02tdw.js} +2 -2
- package/dist/v2/{server-fczyr89c.js → server-ar3awhcy.js} +11 -11
- package/dist/v2/{server-vzrj39bj.js → server-canf6f29.js} +1 -1
- package/dist/v2/{server-vqkqv7ze.js → server-cxkb9725.js} +17 -3
- package/dist/v2/{server-07z334y6.js → server-d0ec5f7b.js} +1 -1
- package/dist/v2/{server-axmk8rr2.js → server-k8mj4ccb.js} +1 -1
- package/dist/v2/{server-d07yxksx.js → server-ndkzagjz.js} +98 -2
- package/dist/v2/server-rd7v8c8y.js +65 -0
- package/dist/v2/{server-nc4qrjde.js → server-rpdbmk63.js} +1 -1
- package/dist/v2/{server-0c7egkzr.js → server-sk08dem3.js} +2 -2
- package/dist/v2/{server-z5255w05.js → server-t091cjj4.js} +4 -3
- package/dist/v2/{server-h8y2948e.js → server-wb00e7b0.js} +3 -3
- package/dist/v2/server.js +2 -2
- package/dist/v2/{storage-tags-msa1qvk8.js → storage-tags-j4he6hwe.js} +1 -1
- package/dist/v2/{v2-archive-reader-nwaw9qph.js → v2-archive-reader-x1yvzqs8.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-xyd3r2t1.js → wrapup-orchestrator-5bccsgy0.js} +9 -9
- package/dist/{v2-archive-reader-dv00gb2a.js → v2-archive-reader-xnnwexnw.js} +1 -1
- package/dist/{wrapup-orchestrator-fzygp85w.js → wrapup-orchestrator-yrpqmwc7.js} +11 -11
- package/package.json +1 -1
- package/dist/index-zxj39ba2.js +0 -155
- package/dist/v2/server-d9aayyxk.js +0 -155
|
@@ -220,7 +220,7 @@ import {
|
|
|
220
220
|
startCompartmentAgent,
|
|
221
221
|
setRecompStarting2,
|
|
222
222
|
setRecompTerminal2
|
|
223
|
-
} from "./server-
|
|
223
|
+
} from "./server-3jggqcpa.js";
|
|
224
224
|
import {
|
|
225
225
|
resolveHistorianModel2
|
|
226
226
|
} from "./server-5kym00ag.js";
|
|
@@ -534,7 +534,7 @@ import {
|
|
|
534
534
|
adoptNullOwnerToolTag2,
|
|
535
535
|
getCandidateToolOwners2,
|
|
536
536
|
pickNearestPriorOwner2
|
|
537
|
-
} from "./server-
|
|
537
|
+
} from "./server-cxkb9725.js";
|
|
538
538
|
import {
|
|
539
539
|
textMentionsRecentCommit,
|
|
540
540
|
hasMeaningfulUserText2,
|
|
@@ -616,12 +616,12 @@ import {
|
|
|
616
616
|
readRawSessionMessageOrdinalById2,
|
|
617
617
|
readSessionChunk2,
|
|
618
618
|
readRawSessionSeedTail2
|
|
619
|
-
} from "./server-
|
|
619
|
+
} from "./server-k8mj4ccb.js";
|
|
620
620
|
import {
|
|
621
621
|
cleanSearchText,
|
|
622
622
|
matchedSearchSnippet,
|
|
623
623
|
getLastIndexedOrdinal
|
|
624
|
-
} from "./server-
|
|
624
|
+
} from "./server-d0ec5f7b.js";
|
|
625
625
|
import"./server-ds8vpfkr.js";
|
|
626
626
|
import {
|
|
627
627
|
getMessageIndexEpoch,
|
|
@@ -648,7 +648,7 @@ import {
|
|
|
648
648
|
resolveMemoriesByIdsForSearch2,
|
|
649
649
|
unifiedSearch2,
|
|
650
650
|
formatSearchResults2
|
|
651
|
-
} from "./server-
|
|
651
|
+
} from "./server-ar3awhcy.js";
|
|
652
652
|
import {
|
|
653
653
|
embedPauseBySession,
|
|
654
654
|
embedRunStateBySession,
|
|
@@ -794,7 +794,7 @@ import {
|
|
|
794
794
|
saveSourceContent,
|
|
795
795
|
replaceSourceContent,
|
|
796
796
|
getSourceContents
|
|
797
|
-
} from "./server-
|
|
797
|
+
} from "./server-canf6f29.js";
|
|
798
798
|
import {
|
|
799
799
|
startBootDeadline,
|
|
800
800
|
getUnconfirmedMigrationHolders,
|
|
@@ -810,7 +810,7 @@ import {
|
|
|
810
810
|
openDatabaseAsync,
|
|
811
811
|
isDatabasePersisted,
|
|
812
812
|
getDatabasePersistenceError
|
|
813
|
-
} from "./server-
|
|
813
|
+
} from "./server-rpdbmk63.js";
|
|
814
814
|
import {
|
|
815
815
|
V2_MEMORY_CATEGORIES,
|
|
816
816
|
CATEGORY_PRIORITY
|
|
@@ -891,7 +891,7 @@ import {
|
|
|
891
891
|
embedSessionCompartmentChunks2,
|
|
892
892
|
getEmbeddingCoverageStatus2,
|
|
893
893
|
getAutoEmbeddingSessionCoverage2
|
|
894
|
-
} from "./server-
|
|
894
|
+
} from "./server-t091cjj4.js";
|
|
895
895
|
import {
|
|
896
896
|
GIT_SWEEP_LEASE_RENEWAL_MS,
|
|
897
897
|
acquireGitSweepLease,
|
|
@@ -913,8 +913,26 @@ import {
|
|
|
913
913
|
getLocalEmbeddingNativeMemoryStats
|
|
914
914
|
} from "./server-d706s5xn.js";
|
|
915
915
|
import {
|
|
916
|
-
|
|
917
|
-
|
|
916
|
+
renderUserFacingFailure,
|
|
917
|
+
userFacingFailureCode,
|
|
918
|
+
renderCapabilityRefusal,
|
|
919
|
+
renderDreamFailure,
|
|
920
|
+
dreamFailureCode,
|
|
921
|
+
renderEmbeddingFailure,
|
|
922
|
+
cosineSimilarity,
|
|
923
|
+
recordMemoryMapping,
|
|
924
|
+
recordMemoryVerifications,
|
|
925
|
+
getUnmappedMemoryIds,
|
|
926
|
+
clearMemoryVerifications,
|
|
927
|
+
getMemoryVerifications,
|
|
928
|
+
resolveGitTopLevel,
|
|
929
|
+
readGitHead,
|
|
930
|
+
readGitChangedFilesSince,
|
|
931
|
+
readGitFileChangeTimesSince,
|
|
932
|
+
verificationFileExists,
|
|
933
|
+
normalizeVerificationFiles
|
|
934
|
+
} from "./server-ndkzagjz.js";
|
|
935
|
+
import"./server-rd7v8c8y.js";
|
|
918
936
|
import {
|
|
919
937
|
computeCueContentHash,
|
|
920
938
|
hasMuralCueColumns,
|
|
@@ -941,25 +959,6 @@ import {
|
|
|
941
959
|
archiveMemory2,
|
|
942
960
|
getMemoryCountsByStatus2
|
|
943
961
|
} from "./server-jjvbk92s.js";
|
|
944
|
-
import {
|
|
945
|
-
renderUserFacingFailure,
|
|
946
|
-
userFacingFailureCode,
|
|
947
|
-
renderCapabilityRefusal,
|
|
948
|
-
renderDreamFailure,
|
|
949
|
-
dreamFailureCode,
|
|
950
|
-
renderEmbeddingFailure,
|
|
951
|
-
recordMemoryMapping,
|
|
952
|
-
recordMemoryVerifications,
|
|
953
|
-
getUnmappedMemoryIds,
|
|
954
|
-
clearMemoryVerifications,
|
|
955
|
-
getMemoryVerifications,
|
|
956
|
-
resolveGitTopLevel,
|
|
957
|
-
readGitHead,
|
|
958
|
-
readGitChangedFilesSince,
|
|
959
|
-
readGitFileChangeTimesSince,
|
|
960
|
-
verificationFileExists,
|
|
961
|
-
normalizeVerificationFiles
|
|
962
|
-
} from "./server-d07yxksx.js";
|
|
963
962
|
import {
|
|
964
963
|
registerNotificationSink2,
|
|
965
964
|
pushNotification2,
|
|
@@ -996,14 +995,14 @@ import {
|
|
|
996
995
|
renderMessageByOrdinal2,
|
|
997
996
|
renderVerboseRangeForTool2,
|
|
998
997
|
renderItemByTag2
|
|
999
|
-
} from "./server-
|
|
998
|
+
} from "./server-sk08dem3.js";
|
|
1000
999
|
import"./server-52x68mj4.js";
|
|
1001
1000
|
import {
|
|
1002
1001
|
readV2ArchiveOffThread2
|
|
1003
|
-
} from "./server-
|
|
1002
|
+
} from "./server-wb00e7b0.js";
|
|
1004
1003
|
import {
|
|
1005
1004
|
renderSearchArchiveOffThread2
|
|
1006
|
-
} from "./server-
|
|
1005
|
+
} from "./server-4nh02tdw.js";
|
|
1007
1006
|
import {
|
|
1008
1007
|
markHostInstructionRow,
|
|
1009
1008
|
hostInstructionRow,
|
|
@@ -26157,7 +26156,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
26157
26156
|
const db = readDatabase();
|
|
26158
26157
|
if (!db)
|
|
26159
26158
|
return { ok: false, error: "db unavailable" };
|
|
26160
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
26159
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-egbf57qa.js"));
|
|
26161
26160
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-8g4r97bp.js"));
|
|
26162
26161
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
26163
26162
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -26242,7 +26241,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
26242
26241
|
const db = readDatabase();
|
|
26243
26242
|
if (!db)
|
|
26244
26243
|
return { ok: false, error: "db unavailable" };
|
|
26245
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
26244
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-5bccsgy0.js"));
|
|
26246
26245
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
26247
26246
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
26248
26247
|
const ctx = {
|
|
@@ -32896,7 +32895,7 @@ ${currentDocs?.structure ?? "(read from project)"}
|
|
|
32896
32895
|
|
|
32897
32896
|
Find claims in these sections that the diff makes wrong or incomplete. Propose one focused change per claim or section. Do not investigate unrelated areas. Read the docs and relevant source with read-only tools. These files are short maps read by every agent in every session. Describe how the system works now, never what changed or when: no change log, dates, or commit lists. One short paragraph per subsystem at most. Mechanism detail belongs in docs/architecture/; you may name a docs page for it but never move that detail into these two files. Propose a change only when code contradicts the docs or a major piece is missing. Prefer rewriting a stale sentence to adding one. Propose nothing when nothing is wrong. Keep both files within the combined budget. Never touch protected regions (<!-- mc:protected START ... --> through <!-- mc:protected END -->); preserve their bytes.
|
|
32898
32897
|
|
|
32899
|
-
Return ONLY a JSON array (or []), with each entry {"file":"ARCHITECTURE.md"|"STRUCTURE.md","action":"replace"|"add"|"remove","heading":"## Exact section heading","text":"## Full
|
|
32898
|
+
Return ONLY a JSON array (or []), with each entry {"file":"ARCHITECTURE.md"|"STRUCTURE.md","action":"replace"|"add"|"remove","heading":"## Exact section heading","text":"## Full section including heading and body (empty for remove)","reason":"one-line reason"}. A section is its heading and everything under it until the next heading of the same or a higher level outside code fences, or the end of the file. Replace, add, or remove exactly one whole section per entry, including its subsections. Additions are appended at the end of the file. Do not include entries for unmodified sections. No file writes.`;
|
|
32900
32899
|
}
|
|
32901
32900
|
function buildDreamTaskPrompt(task, args) {
|
|
32902
32901
|
switch (task) {
|
|
@@ -34076,23 +34075,35 @@ ${stat}`
|
|
|
34076
34075
|
return null;
|
|
34077
34076
|
}
|
|
34078
34077
|
}
|
|
34079
|
-
|
|
34080
|
-
|
|
34081
|
-
`);
|
|
34078
|
+
var ATX_HEADING = /^ {0,3}(#{1,6})(?=[ \t]|$)/;
|
|
34079
|
+
function sections(lines) {
|
|
34082
34080
|
const result = [];
|
|
34083
|
-
|
|
34081
|
+
const open = [];
|
|
34082
|
+
let fence;
|
|
34084
34083
|
for (let i = 0;i < lines.length; i++) {
|
|
34085
|
-
|
|
34086
|
-
|
|
34087
|
-
if (
|
|
34088
|
-
if (
|
|
34089
|
-
|
|
34090
|
-
|
|
34084
|
+
const heading = lines[i].replace(/\r$/, "");
|
|
34085
|
+
const marker = heading.match(/^ {0,3}(`{3,}|~{3,})(.*)$/);
|
|
34086
|
+
if (fence) {
|
|
34087
|
+
if (marker?.[1].startsWith(fence) && !marker[2].trim())
|
|
34088
|
+
fence = undefined;
|
|
34089
|
+
continue;
|
|
34090
|
+
}
|
|
34091
|
+
if (marker && (marker[1][0] === "~" || !marker[2].includes("`"))) {
|
|
34092
|
+
fence = marker[1];
|
|
34093
|
+
continue;
|
|
34094
|
+
}
|
|
34095
|
+
const match = heading.match(ATX_HEADING);
|
|
34096
|
+
if (!match)
|
|
34097
|
+
continue;
|
|
34098
|
+
const level = match[1].length;
|
|
34099
|
+
for (let previous = open.at(-1);previous && previous.level >= level; previous = open.at(-1)) {
|
|
34100
|
+
previous.end = i;
|
|
34101
|
+
open.pop();
|
|
34091
34102
|
}
|
|
34103
|
+
const section = { heading, level, start: i, end: lines.length };
|
|
34104
|
+
result.push(section);
|
|
34105
|
+
open.push(section);
|
|
34092
34106
|
}
|
|
34093
|
-
for (const section of result)
|
|
34094
|
-
section.text = lines.slice(section.start, section.end).join(`
|
|
34095
|
-
`);
|
|
34096
34107
|
return result;
|
|
34097
34108
|
}
|
|
34098
34109
|
function protectedBytes(text) {
|
|
@@ -34115,76 +34126,142 @@ function diff(name, before, after) {
|
|
|
34115
34126
|
}
|
|
34116
34127
|
}
|
|
34117
34128
|
function parseDocsProposalOutput(output) {
|
|
34118
|
-
|
|
34119
|
-
|
|
34129
|
+
let parsed;
|
|
34130
|
+
try {
|
|
34131
|
+
parsed = JSON.parse(output);
|
|
34132
|
+
} catch (error) {
|
|
34133
|
+
const match = output.match(/```json[ \t]*\r?\n([\s\S]*?)\r?\n[ \t]*```(?=\s|$)/) ?? output.match(/```json\s*([\s\S]*?)```/);
|
|
34134
|
+
if (!match)
|
|
34135
|
+
throw error;
|
|
34136
|
+
parsed = JSON.parse(match[1]);
|
|
34137
|
+
}
|
|
34120
34138
|
if (!Array.isArray(parsed))
|
|
34121
34139
|
throw new Error("proposal must be a JSON array");
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
|
|
34140
|
+
return parsed;
|
|
34141
|
+
}
|
|
34142
|
+
function readChange(item) {
|
|
34143
|
+
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
34144
|
+
return "expected an object";
|
|
34145
|
+
const { file, action, heading, text, reason } = item;
|
|
34146
|
+
if (file !== "ARCHITECTURE.md" && file !== "STRUCTURE.md")
|
|
34147
|
+
return "unknown proposal file";
|
|
34148
|
+
if (action !== "replace" && action !== "add" && action !== "remove")
|
|
34149
|
+
return "invalid action";
|
|
34150
|
+
if (typeof heading !== "string" || /[\r\n]/.test(heading) || !ATX_HEADING.test(heading))
|
|
34151
|
+
return "invalid section heading";
|
|
34152
|
+
if (typeof text !== "string")
|
|
34153
|
+
return "section text must be a string";
|
|
34154
|
+
if (typeof reason !== "string" || !reason.trim() || /[\r\n]/.test(reason))
|
|
34155
|
+
return "expected a one-line reason";
|
|
34156
|
+
return { file, action, heading, text, reason };
|
|
34157
|
+
}
|
|
34158
|
+
function applyChange(before, change) {
|
|
34159
|
+
const lines = before.split(`
|
|
34160
|
+
`);
|
|
34161
|
+
const existing = sections(lines);
|
|
34162
|
+
const index = existing.findIndex((item) => item.heading === change.heading);
|
|
34163
|
+
const replacement = change.action === "remove" ? [] : change.text.trimEnd().split(`
|
|
34164
|
+
`);
|
|
34165
|
+
const inserted = sections(replacement);
|
|
34166
|
+
const wholeSection = inserted[0]?.heading === change.heading && inserted[0].start === 0 && inserted[0].end === replacement.length;
|
|
34167
|
+
const expectedHeadings = existing.map((item) => item.heading);
|
|
34168
|
+
const insertedHeadings = inserted.map((item) => item.heading);
|
|
34169
|
+
let after;
|
|
34170
|
+
if (change.action === "add") {
|
|
34171
|
+
if (index !== -1 || !wholeSection)
|
|
34172
|
+
return `invalid addition ${change.heading}`;
|
|
34173
|
+
after = `${before.endsWith(`
|
|
34174
|
+
`) ? before : `${before}
|
|
34175
|
+
`}
|
|
34176
|
+
${replacement.join(`
|
|
34177
|
+
`)}
|
|
34178
|
+
`;
|
|
34179
|
+
expectedHeadings.push(...insertedHeadings);
|
|
34180
|
+
} else {
|
|
34181
|
+
if (index === -1)
|
|
34182
|
+
return `missing section ${change.heading}`;
|
|
34183
|
+
if (change.action === "replace" && !wholeSection)
|
|
34184
|
+
return `invalid replacement ${change.heading}`;
|
|
34185
|
+
const section = existing[index];
|
|
34186
|
+
const affected = existing.filter((item) => item.start >= section.start && item.start < section.end);
|
|
34187
|
+
expectedHeadings.splice(index, affected.length, ...insertedHeadings);
|
|
34188
|
+
if (change.action === "replace" && section.end === lines.length && before.endsWith(`
|
|
34189
|
+
`))
|
|
34190
|
+
replacement.push("");
|
|
34191
|
+
lines.splice(section.start, section.end - section.start, ...replacement);
|
|
34192
|
+
after = lines.join(`
|
|
34193
|
+
`);
|
|
34194
|
+
}
|
|
34195
|
+
if (JSON.stringify(protectedBytes(before)) !== JSON.stringify(protectedBytes(after)))
|
|
34196
|
+
return `protected region changed in ${change.file}`;
|
|
34197
|
+
if (JSON.stringify(sections(after.split(`
|
|
34198
|
+
`)).map((item) => item.heading)) !== JSON.stringify(expectedHeadings))
|
|
34199
|
+
return `markdown structure changed in ${change.file}`;
|
|
34200
|
+
if (after === before)
|
|
34201
|
+
return "no doc changes proposed";
|
|
34202
|
+
return { after };
|
|
34203
|
+
}
|
|
34204
|
+
function applyChanges(items, originals, overBudget) {
|
|
34205
|
+
const docs = { ...originals };
|
|
34206
|
+
const kept = [];
|
|
34207
|
+
const dropped = [];
|
|
34125
34208
|
const seen = new Set;
|
|
34126
|
-
for (const
|
|
34209
|
+
for (const [index, item] of items.entries()) {
|
|
34210
|
+
const change = overBudget.get(index) ?? readChange(item);
|
|
34211
|
+
if (typeof change === "string") {
|
|
34212
|
+
dropped.push({ index, reason: change });
|
|
34213
|
+
continue;
|
|
34214
|
+
}
|
|
34127
34215
|
const key = `${change.file}:${change.heading}`;
|
|
34128
|
-
|
|
34129
|
-
|
|
34216
|
+
const before = docs[change.file];
|
|
34217
|
+
const result = seen.has(key) ? `duplicate section change ${change.heading}` : applyChange(before, change);
|
|
34218
|
+
if (typeof result === "string") {
|
|
34219
|
+
dropped.push({ index, reason: result });
|
|
34220
|
+
continue;
|
|
34221
|
+
}
|
|
34222
|
+
kept.push({ index, change, grew: result.after.length > before.length });
|
|
34223
|
+
docs[change.file] = result.after;
|
|
34130
34224
|
seen.add(key);
|
|
34131
34225
|
}
|
|
34132
|
-
|
|
34226
|
+
const tokens = FILES.reduce((sum, file) => sum + Math.ceil(docs[file].length / 3.5), 0);
|
|
34227
|
+
return { docs, kept, dropped, tokens };
|
|
34133
34228
|
}
|
|
34134
34229
|
function validateDocsProposal(projectDir, output, budget, expected) {
|
|
34135
|
-
|
|
34230
|
+
const readDoc = (file) => {
|
|
34231
|
+
const path = join8(projectDir, file);
|
|
34232
|
+
return existsSync4(path) ? readFileSync6(path, "utf8") : "";
|
|
34233
|
+
};
|
|
34234
|
+
const originals = {
|
|
34235
|
+
"ARCHITECTURE.md": readDoc("ARCHITECTURE.md"),
|
|
34236
|
+
"STRUCTURE.md": readDoc("STRUCTURE.md")
|
|
34237
|
+
};
|
|
34238
|
+
if (Object.keys(expected).some((name) => !FILES.some((file) => file === name && hash(originals[file]) === expected[name])))
|
|
34136
34239
|
throw new Error("base drifted");
|
|
34137
|
-
const
|
|
34138
|
-
|
|
34139
|
-
|
|
34140
|
-
|
|
34141
|
-
|
|
34142
|
-
|
|
34143
|
-
|
|
34144
|
-
|
|
34145
|
-
|
|
34146
|
-
|
|
34147
|
-
|
|
34148
|
-
|
|
34149
|
-
`))
|
|
34150
|
-
throw new Error(`invalid addition ${change.heading}`);
|
|
34151
|
-
after += `${after.endsWith(`
|
|
34152
|
-
`) ? "" : `
|
|
34153
|
-
`}
|
|
34154
|
-
${change.text.trimEnd()}
|
|
34155
|
-
`;
|
|
34156
|
-
} else {
|
|
34157
|
-
if (!section)
|
|
34158
|
-
throw new Error(`missing section ${change.heading}`);
|
|
34159
|
-
if (change.action === "replace" && (!change.text.startsWith(`${change.heading}
|
|
34160
|
-
`) || sections(change.text).length !== 1))
|
|
34161
|
-
throw new Error(`invalid replacement ${change.heading}`);
|
|
34162
|
-
const lines = after.split(`
|
|
34163
|
-
`);
|
|
34164
|
-
lines.splice(section.start, section.end - section.start, ...change.action === "remove" ? [] : change.text.trimEnd().split(`
|
|
34165
|
-
`));
|
|
34166
|
-
after = lines.join(`
|
|
34167
|
-
`);
|
|
34168
|
-
}
|
|
34169
|
-
}
|
|
34170
|
-
if (JSON.stringify(protectedBytes(before)) !== JSON.stringify(protectedBytes(after)))
|
|
34171
|
-
throw new Error(`protected region changed in ${file}`);
|
|
34172
|
-
const originalHeadings = sections(before).map((item) => item.heading);
|
|
34173
|
-
const expectedHeadings = originalHeadings.filter((heading) => !changes.some((item) => item.file === file && item.action === "remove" && item.heading === heading)).concat(changes.filter((item) => item.file === file && item.action === "add").map((item) => item.heading));
|
|
34174
|
-
if (JSON.stringify(sections(after).map((item) => item.heading)) !== JSON.stringify(expectedHeadings))
|
|
34175
|
-
throw new Error(`markdown structure changed in ${file}`);
|
|
34176
|
-
tokens += Math.ceil(after.length / 3.5);
|
|
34177
|
-
if (after !== before)
|
|
34178
|
-
diffs += diff(file, before, after);
|
|
34240
|
+
const items = parseDocsProposalOutput(output);
|
|
34241
|
+
const overBudget = new Map;
|
|
34242
|
+
let result = applyChanges(items, originals, overBudget);
|
|
34243
|
+
while (result.tokens > budget && result.kept.length) {
|
|
34244
|
+
const reason = `over budget: ${result.tokens} > ${budget}`;
|
|
34245
|
+
const latestGrowth = [...result.kept].reverse().find((item) => item.grew);
|
|
34246
|
+
if (latestGrowth)
|
|
34247
|
+
overBudget.set(latestGrowth.index, reason);
|
|
34248
|
+
else
|
|
34249
|
+
for (const item of result.kept)
|
|
34250
|
+
overBudget.set(item.index, reason);
|
|
34251
|
+
result = applyChanges(items, originals, overBudget);
|
|
34179
34252
|
}
|
|
34180
|
-
|
|
34181
|
-
|
|
34182
|
-
|
|
34183
|
-
|
|
34184
|
-
|
|
34253
|
+
const diffs = FILES.filter((file) => originals[file] !== result.docs[file]).map((file) => diff(file, originals[file], result.docs[file])).join("");
|
|
34254
|
+
return {
|
|
34255
|
+
changes: result.kept.map((item) => item.change),
|
|
34256
|
+
dropped: result.dropped,
|
|
34257
|
+
tokens: result.tokens,
|
|
34258
|
+
diffs
|
|
34259
|
+
};
|
|
34185
34260
|
}
|
|
34186
34261
|
function writeDocsProposal(projectDir, output, budget, expected, head) {
|
|
34187
34262
|
const result = validateDocsProposal(projectDir, output, budget, expected);
|
|
34263
|
+
if (!result.diffs)
|
|
34264
|
+
return { path: null, dropped: result.dropped };
|
|
34188
34265
|
const dir = proposalDir(projectDir);
|
|
34189
34266
|
mkdirSync(join8(dir, "superseded"), { recursive: true });
|
|
34190
34267
|
ensureCortexKitArtifactGitignore(projectDir);
|
|
@@ -34218,7 +34295,7 @@ ${result.diffs}
|
|
|
34218
34295
|
for (const old of listPendingDocsProposals(projectDir))
|
|
34219
34296
|
if (old !== path)
|
|
34220
34297
|
renameSync(old, join8(dir, "superseded", old.split("/").at(-1) ?? "proposal.md"));
|
|
34221
|
-
return path;
|
|
34298
|
+
return { path, dropped: result.dropped };
|
|
34222
34299
|
}
|
|
34223
34300
|
|
|
34224
34301
|
// src/agents/smart-note-compiler.ts
|
|
@@ -40026,19 +40103,13 @@ async function runAgenticTask(config, ctx, helpers) {
|
|
|
40026
40103
|
recordInvocation("completed", run.output);
|
|
40027
40104
|
if (task === "maintain-docs" && docsHashes && changes) {
|
|
40028
40105
|
try {
|
|
40029
|
-
|
|
40030
|
-
|
|
40031
|
-
|
|
40032
|
-
|
|
40033
|
-
detail: "no corrections proposed",
|
|
40034
|
-
schedulePatch: { taskStateJson: JSON.stringify({ head: changes.head }) }
|
|
40035
|
-
};
|
|
40036
|
-
}
|
|
40037
|
-
const path = writeDocsProposal(docsDir, String(run.validated), config.docsMaxTokens ?? 12000, docsHashes, changes.head);
|
|
40038
|
-
helpers.recordRun("completed", null, { progress: `proposal: ${path}` });
|
|
40106
|
+
const { path, dropped } = writeDocsProposal(docsDir, String(run.validated), config.docsMaxTokens ?? 12000, docsHashes, changes.head);
|
|
40107
|
+
const outcome = path ? `proposal: ${path}` : "no corrections proposed";
|
|
40108
|
+
const detail = dropped.length ? `${outcome}; dropped ${dropped.map(({ index, reason }) => `entry ${index + 1}: ${reason}`).join("; ")}` : outcome;
|
|
40109
|
+
helpers.recordRun("completed", null, { progress: detail });
|
|
40039
40110
|
return {
|
|
40040
40111
|
status: "completed",
|
|
40041
|
-
detail
|
|
40112
|
+
detail,
|
|
40042
40113
|
schedulePatch: { taskStateJson: JSON.stringify({ head: changes.head }) }
|
|
40043
40114
|
};
|
|
40044
40115
|
} catch (error) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
yieldIndexChunk2
|
|
5
5
|
} from "./server-gzy5w8ya.js";
|
|
6
6
|
import"./server-1zx87sdm.js";
|
|
7
|
-
import"./server-
|
|
7
|
+
import"./server-cxkb9725.js";
|
|
8
8
|
import"./server-y8xjr8rx.js";
|
|
9
9
|
import"./server-pavzsdc6.js";
|
|
10
10
|
import"./server-j8376q08.js";
|
|
@@ -17,7 +17,7 @@ import"./server-1d042x6w.js";
|
|
|
17
17
|
import"./server-6ash6z8z.js";
|
|
18
18
|
import"./server-2ra6pwf3.js";
|
|
19
19
|
import"./server-3ap5dmhc.js";
|
|
20
|
-
import"./server-
|
|
20
|
+
import"./server-k8mj4ccb.js";
|
|
21
21
|
import {
|
|
22
22
|
MESSAGE_INDEX_MAX_FTS_BYTES,
|
|
23
23
|
messageIndexSkipKey,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
markMessageIndexDirty,
|
|
26
26
|
getIndexableContent,
|
|
27
27
|
indexSingleMessage
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-d0ec5f7b.js";
|
|
29
29
|
import"./server-ds8vpfkr.js";
|
|
30
30
|
import"./server-5sbsnpkn.js";
|
|
31
31
|
|
package/dist/v2/{project-embedding-registry-k0hjqt11.js → project-embedding-registry-07nz4qas.js}
RENAMED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
sweepAllRegisteredProjects2,
|
|
37
37
|
_setTestProviderFactoryForProject2,
|
|
38
38
|
_resetProjectEmbeddingRegistryForTests2
|
|
39
|
-
} from "./server-
|
|
39
|
+
} from "./server-t091cjj4.js";
|
|
40
40
|
import"./server-4dhv7mqz.js";
|
|
41
41
|
import"./server-2amn2s73.js";
|
|
42
42
|
import"./server-qt1qqasc.js";
|
|
@@ -19,7 +19,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
19
19
|
await main();
|
|
20
20
|
async function main() {
|
|
21
21
|
if (input.v2ArchiveReader) {
|
|
22
|
-
const { serveV2ArchiveReads } = await import("./v2-archive-reader-
|
|
22
|
+
const { serveV2ArchiveReads } = await import("./v2-archive-reader-x1yvzqs8.js");
|
|
23
23
|
await serveV2ArchiveReads(port, openConnections);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -51,7 +51,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
51
51
|
await runMessageFtsRowidMapBackfill(db);
|
|
52
52
|
reply = { kind: "fts-rowid-backfill" };
|
|
53
53
|
} else if (input.searchArchive) {
|
|
54
|
-
const { renderSearchArchive } = await import("./search-archive-
|
|
54
|
+
const { renderSearchArchive } = await import("./search-archive-3tpaqkg4.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-wg5zc29f.js");
|
|
56
56
|
const archive = input.searchArchive;
|
|
57
57
|
let raw;
|
|
@@ -81,7 +81,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
81
81
|
const { setHarness } = await import("./harness-e4avh192.js");
|
|
82
82
|
setHarness(input.harness ?? "opencode");
|
|
83
83
|
const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
|
|
84
|
-
import("./message-index-bounded-
|
|
84
|
+
import("./message-index-bounded-ev9sarf6.js"),
|
|
85
85
|
import("./sqlite-context-pragmas-mv9jqwjh.js")
|
|
86
86
|
]);
|
|
87
87
|
configureContextDatabasePragmas(db);
|
|
@@ -95,7 +95,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
95
95
|
measurements: result.measurements
|
|
96
96
|
};
|
|
97
97
|
} else if (input.tagRatio !== undefined) {
|
|
98
|
-
const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-
|
|
98
|
+
const { scanTagOwnerSummary, scanTagOwnerDelta } = await import("./storage-tags-j4he6hwe.js");
|
|
99
99
|
const delta = input.tagState ? scanTagOwnerDelta(db, input.sessionId, input.tagState) : null;
|
|
100
100
|
if (delta)
|
|
101
101
|
reply = { kind: "tag-delta", delta };
|
|
@@ -38,8 +38,8 @@ import {
|
|
|
38
38
|
readSessionChunk2,
|
|
39
39
|
getRawSessionMessageIdsThrough2,
|
|
40
40
|
readRawSessionSeedTail2
|
|
41
|
-
} from "./server-
|
|
42
|
-
import"./server-
|
|
41
|
+
} from "./server-k8mj4ccb.js";
|
|
42
|
+
import"./server-cxkb9725.js";
|
|
43
43
|
import"./server-1zx87sdm.js";
|
|
44
44
|
import"./server-3ap5dmhc.js";
|
|
45
45
|
import"./server-rz6g5xne.js";
|
|
@@ -7,23 +7,23 @@ import {
|
|
|
7
7
|
setRecompTerminal2,
|
|
8
8
|
buildRecompDeps2,
|
|
9
9
|
runManagedRecomp2
|
|
10
|
-
} from "./server-
|
|
10
|
+
} from "./server-3jggqcpa.js";
|
|
11
11
|
import"./server-at0v0z4t.js";
|
|
12
|
-
import"./server-
|
|
13
|
-
import"./server-
|
|
12
|
+
import"./server-ndkzagjz.js";
|
|
13
|
+
import"./server-rd7v8c8y.js";
|
|
14
14
|
import"./server-jjvbk92s.js";
|
|
15
|
-
import"./server-
|
|
15
|
+
import"./server-t091cjj4.js";
|
|
16
16
|
import"./server-4dhv7mqz.js";
|
|
17
|
-
import"./server-
|
|
17
|
+
import"./server-canf6f29.js";
|
|
18
18
|
import"./server-rbtx6q5v.js";
|
|
19
|
-
import"./server-
|
|
19
|
+
import"./server-d0ec5f7b.js";
|
|
20
20
|
import"./server-2amn2s73.js";
|
|
21
21
|
import"./server-rthnpmbp.js";
|
|
22
22
|
import"./server-aewxmvnf.js";
|
|
23
23
|
import"./server-qjff96a6.js";
|
|
24
24
|
import"./server-qt1qqasc.js";
|
|
25
|
-
import"./server-
|
|
26
|
-
import"./server-
|
|
25
|
+
import"./server-k8mj4ccb.js";
|
|
26
|
+
import"./server-cxkb9725.js";
|
|
27
27
|
import"./server-1zx87sdm.js";
|
|
28
28
|
import"./server-3ap5dmhc.js";
|
|
29
29
|
import"./server-npdey91q.js";
|
|
@@ -35,7 +35,7 @@ import"./server-rz6g5xne.js";
|
|
|
35
35
|
import"./server-jtq03rkb.js";
|
|
36
36
|
import"./server-8pdfmc27.js";
|
|
37
37
|
import"./server-x6fn9x8q.js";
|
|
38
|
-
import"./server-
|
|
38
|
+
import"./server-rpdbmk63.js";
|
|
39
39
|
import"./server-fb3zxn06.js";
|
|
40
40
|
import"./server-jn4pktdk.js";
|
|
41
41
|
import"./server-fr0wbhdn.js";
|
|
@@ -2,20 +2,20 @@ import {
|
|
|
2
2
|
renderMessageByOrdinal2,
|
|
3
3
|
renderVerboseRangeForTool2,
|
|
4
4
|
renderItemByTag2
|
|
5
|
-
} from "./server-
|
|
6
|
-
import"./server-
|
|
5
|
+
} from "./server-sk08dem3.js";
|
|
6
|
+
import"./server-canf6f29.js";
|
|
7
7
|
import"./server-rbtx6q5v.js";
|
|
8
|
-
import"./server-
|
|
8
|
+
import"./server-d0ec5f7b.js";
|
|
9
9
|
import"./server-2amn2s73.js";
|
|
10
10
|
import"./server-rthnpmbp.js";
|
|
11
|
-
import"./server-
|
|
12
|
-
import"./server-
|
|
11
|
+
import"./server-k8mj4ccb.js";
|
|
12
|
+
import"./server-cxkb9725.js";
|
|
13
13
|
import"./server-1zx87sdm.js";
|
|
14
14
|
import"./server-3ap5dmhc.js";
|
|
15
15
|
import"./server-rz6g5xne.js";
|
|
16
16
|
import"./server-8pdfmc27.js";
|
|
17
17
|
import"./server-x6fn9x8q.js";
|
|
18
|
-
import"./server-
|
|
18
|
+
import"./server-rpdbmk63.js";
|
|
19
19
|
import"./server-fb3zxn06.js";
|
|
20
20
|
import"./server-jn4pktdk.js";
|
|
21
21
|
import"./server-fr0wbhdn.js";
|
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
resolveMemoriesByIdsForSearch2,
|
|
6
6
|
unifiedSearch2,
|
|
7
7
|
formatSearchResults2
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-ar3awhcy.js";
|
|
9
9
|
import"./server-52x68mj4.js";
|
|
10
|
-
import"./server-
|
|
11
|
-
import"./server-
|
|
10
|
+
import"./server-ndkzagjz.js";
|
|
11
|
+
import"./server-rd7v8c8y.js";
|
|
12
12
|
import"./server-jjvbk92s.js";
|
|
13
|
-
import"./server-
|
|
13
|
+
import"./server-t091cjj4.js";
|
|
14
14
|
import"./server-4dhv7mqz.js";
|
|
15
15
|
import"./server-rbtx6q5v.js";
|
|
16
|
-
import"./server-
|
|
16
|
+
import"./server-d0ec5f7b.js";
|
|
17
17
|
import"./server-2amn2s73.js";
|
|
18
18
|
import"./server-qt1qqasc.js";
|
|
19
|
-
import"./server-
|
|
20
|
-
import"./server-
|
|
19
|
+
import"./server-k8mj4ccb.js";
|
|
20
|
+
import"./server-cxkb9725.js";
|
|
21
21
|
import"./server-1zx87sdm.js";
|
|
22
22
|
import"./server-3ap5dmhc.js";
|
|
23
23
|
import"./server-d706s5xn.js";
|