@cortexkit/opencode-magic-context 0.49.82 → 0.49.84
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 +1 -1
- package/dist/chunk-embedding-write-worker.js +1 -1
- package/dist/{context-00f1hdz2.js → context-3sajdysh.js} +309 -98
- package/dist/{derive-budgets-2z6xxm7e.js → derive-budgets-0kcek5ex.js} +1 -1
- package/dist/features/magic-context/dreamer/map-memories-retry.d.ts +18 -0
- package/dist/features/magic-context/dreamer/map-memories-retry.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +2 -0
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts +1 -1
- package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-registry.d.ts +7 -0
- package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +9 -0
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/mural/render-trigger.d.ts +3 -3
- package/dist/features/magic-context/mural/render-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/{index-zzvd4a9z.js → index-05bm2ndp.js} +1 -1
- package/dist/{index-2xhzmwf6.js → index-0wehkw71.js} +5 -5
- package/dist/{index-zvane1rq.js → index-5wjv4c41.js} +1 -1
- package/dist/{index-twmeey4h.js → index-70cv85b0.js} +2 -2
- package/dist/{index-2q0t43fy.js → index-7j2zv9nm.js} +1 -1
- package/dist/{index-wxxcfpxh.js → index-cfy5k1pa.js} +6 -6
- package/dist/{index-b2787fk6.js → index-d028gmgp.js} +25 -9
- package/dist/{index-dg5jvh9r.js → index-k0jnsjcp.js} +3 -3
- package/dist/{index-nda0zgna.js → index-kknjvmpx.js} +2 -1
- package/dist/{index-tky3j43e.js → index-kthfyf45.js} +55 -11
- package/dist/{index-hz1xdb15.js → index-qybp04ff.js} +3 -3
- package/dist/{index-e21n48yd.js → index-rdh63md0.js} +23 -0
- package/dist/{index-x8qgqnym.js → index-skwwbcnv.js} +2 -2
- package/dist/{index-2ygw6q5s.js → index-szwrpyac.js} +2 -2
- package/dist/{index-eptthgkw.js → index-tqnvn9pa.js} +5 -5
- package/dist/{index-93rezfvc.js → index-tvbkemec.js} +37 -6
- package/dist/{index-rnyaa7cj.js → index-xd0ww0ns.js} +1 -1
- package/dist/{index-jvr9ba9y.js → index-xjfan0za.js} +210 -139
- package/dist/{index-y208s7zx.js → index-xrnhxkz7.js} +6 -1
- package/dist/index.js +21 -21
- package/dist/{message-index-bounded-cfkeyf72.js → message-index-bounded-6fr624zf.js} +3 -3
- package/dist/migration-worker.js +1 -1
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-s3qac56g.js → read-session-chunk-6wedfths.js} +2 -2
- package/dist/{recomp-orchestrator-fjdp3t1d.js → recomp-orchestrator-m2s3jpvj.js} +9 -9
- package/dist/{render-c9fjwrad.js → render-p2j7rn9a.js} +7 -7
- package/dist/{search-archive-s2jas2jb.js → search-archive-hz9xh7nh.js} +4 -4
- package/dist/{search-1jejx5cx.js → search-ksx0f1qd.js} +5 -5
- package/dist/shared/models-dev-cache.d.ts +6 -1
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/test-git-env.d.ts +3 -0
- package/dist/shared/test-git-env.d.ts.map +1 -0
- package/dist/{storage-tags-6e83pvff.js → storage-tags-y2mrb8e6.js} +1 -1
- package/dist/{store-reader-tr64nxyy.js → store-reader-tsv1w4vt.js} +1 -1
- package/dist/{store-ggrq9e14.js → store-x0swqb5c.js} +2 -2
- package/dist/{task-config-t6bpyka7.js → task-config-qt6n4bxm.js} +1 -1
- package/dist/{transform-postprocess-phase-p2egg02g.js → transform-postprocess-phase-1wb2rrr1.js} +10 -10
- package/dist/v2/auto-search-worker.js +1 -1
- package/dist/v2/chunk-embedding-write-worker.js +3 -3
- package/dist/v2/{context-gwkgh0wd.js → context-at9nje0j.js} +711 -435
- package/dist/v2/{derive-budgets-2eam671q.js → derive-budgets-xbwcap8k.js} +2 -2
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/revert-message-state.d.ts +12 -0
- package/dist/v2/hooks/revert-message-state.d.ts.map +1 -0
- package/dist/v2/hooks/storage-notice.d.ts +12 -6
- package/dist/v2/hooks/storage-notice.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-0xy4dn04.js → message-index-bounded-jqy7283g.js} +4 -4
- package/dist/v2/migration-worker.js +3 -3
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-6mt2t6dy.js → read-session-chunk-n3nhfvd7.js} +3 -3
- package/dist/v2/{recomp-orchestrator-jn39mxh0.js → recomp-orchestrator-nhef90gc.js} +13 -13
- package/dist/v2/{render-q2aj9bgy.js → render-c9r2g2jv.js} +10 -10
- package/dist/v2/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/v2/{search-archive-fj59gjv1.js → search-archive-80ckv9kq.js} +5 -5
- package/dist/v2/{search-9xn6ds9x.js → search-t06js5dc.js} +7 -7
- package/dist/v2/{server-2ktxmtbd.js → server-210rc0z9.js} +1 -1
- package/dist/v2/{server-2gcfmd47.js → server-2k8tkbhz.js} +2 -2
- package/dist/v2/{server-92g7d776.js → server-2kswss3d.js} +2 -1
- package/dist/v2/{server-c8mqs0v5.js → server-3cndh146.js} +10 -10
- package/dist/v2/{server-vt6nj2hn.js → server-3hhakg5a.js} +35 -19
- package/dist/v2/{server-53n8hv5q.js → server-863bwkga.js} +4 -4
- package/dist/v2/{server-5yfq912a.js → server-9nk5h6w6.js} +23 -0
- package/dist/v2/{server-xepx8t43.js → server-a2f1bhyj.js} +1 -1
- package/dist/v2/{server-r00xyx66.js → server-ap81bk3c.js} +28 -28
- package/dist/v2/{server-1efjj215.js → server-cce6m31c.js} +37 -6
- package/dist/v2/{server-2w1rdttn.js → server-dfesqfv1.js} +2 -2
- package/dist/v2/{server-569he5mh.js → server-hhw6rzsn.js} +1 -1
- package/dist/v2/{server-1cn3kryt.js → server-mr9rqn0y.js} +5 -5
- package/dist/v2/{server-g1a0nhtk.js → server-ry6rpspz.js} +4 -4
- package/dist/v2/{server-xdh4r20h.js → server-s15knz0w.js} +642 -627
- package/dist/v2/{server-0dmzr7f9.js → server-sxfbjdye.js} +2 -2
- package/dist/v2/{server-nqdzv8b7.js → server-sy98vksf.js} +55 -11
- package/dist/v2/{server-rp52f40v.js → server-w1jfaxas.js} +1 -1
- package/dist/v2/{server-bj779zmp.js → server-y4favn4d.js} +1 -1
- package/dist/v2/server.js +4 -4
- package/dist/v2/{storage-tags-z8j8wq34.js → storage-tags-xq81zgt2.js} +2 -2
- package/dist/v2/{store-qdgzd38f.js → store-h3s95ywe.js} +2 -2
- package/dist/v2/{store-reader-83tka051.js → store-reader-paamf0ac.js} +1 -1
- package/dist/v2/store-reader.d.ts +11 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{task-config-7md27rx8.js → task-config-ex2vajr2.js} +1 -1
- package/dist/v2/{v2-archive-reader-9z8z97db.js → v2-archive-reader-1zzteaa5.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-vd5zfp3v.js → wrapup-orchestrator-9y98qcqz.js} +13 -13
- package/dist/{v2-archive-reader-r0xpxsb1.js → v2-archive-reader-3yjxaj5z.js} +1 -1
- package/dist/{wrapup-orchestrator-k29zqfp9.js → wrapup-orchestrator-sa3a075a.js} +10 -10
- package/package.json +1 -1
- package/src/features/magic-context/dreamer/task-registry.ts +8 -0
- package/src/shared/models-dev-cache.ts +90 -21
- package/src/shared/reusable-worker.test.ts +31 -29
- package/src/shared/sqlite.test.ts +19 -6
- package/src/shared/test-db.test.ts +5 -3
- package/src/shared/test-git-env.test.ts +38 -0
- package/src/shared/test-git-env.ts +10 -0
|
@@ -156,35 +156,33 @@ describe("reusable job workers", () => {
|
|
|
156
156
|
test("a file ending with queued jobs cannot interrupt the next parallel file", () => {
|
|
157
157
|
withTestTempDir("reusable-worker-files-", (dir) => {
|
|
158
158
|
const outcomes = join(dir, "outcomes.jsonl");
|
|
159
|
+
const owner = join(dir, "owner-started");
|
|
159
160
|
writeFileSync(outcomes, "");
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
import { appendFileSync } from "node:fs";
|
|
161
|
+
// The single Bun worker visits both files, but it need not visit them
|
|
162
|
+
// in filename order. The first file to run takes the owner role.
|
|
163
|
+
const fixture = `import { expect, test } from "bun:test";
|
|
164
|
+
import { appendFileSync, existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
164
165
|
import { reuseWorker } from ${JSON.stringify(new URL("./reusable-worker.ts", import.meta.url).href)};
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
let
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
import { readFileSync } from "node:fs";
|
|
186
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
187
|
-
describe("next file", () => {
|
|
166
|
+
const owner = ${JSON.stringify(owner)};
|
|
167
|
+
if (!existsSync(owner)) {
|
|
168
|
+
test("owner finishes with queued work", async () => {
|
|
169
|
+
writeFileSync(owner, "");
|
|
170
|
+
const entry = new URL(${JSON.stringify(entry.href)});
|
|
171
|
+
const active = reuseWorker(entry, { workerData: { path: "file-exit", hang: true } });
|
|
172
|
+
active.on("error", () => {});
|
|
173
|
+
for (let id = 0; id < 3; id++) {
|
|
174
|
+
const queued = reuseWorker(entry, { workerData: { path: "file-exit", value: "queued" } });
|
|
175
|
+
let replied = false;
|
|
176
|
+
let failed = false;
|
|
177
|
+
queued.on("message", () => { replied = true; });
|
|
178
|
+
queued.on("error", () => { failed = true; });
|
|
179
|
+
queued.on("exit", code => appendFileSync(${JSON.stringify(outcomes)}, JSON.stringify({
|
|
180
|
+
id, outcome: code === 0 && replied && !failed ? "completed" : "failed",
|
|
181
|
+
}) + "\\n"));
|
|
182
|
+
}
|
|
183
|
+
await Promise.resolve();
|
|
184
|
+
});
|
|
185
|
+
} else {
|
|
188
186
|
test("still registers after every queued client settles once", () => {
|
|
189
187
|
const outcomes = readFileSync(${JSON.stringify(outcomes)}, "utf8").trim().split("\\n").filter(Boolean).map(line => JSON.parse(line));
|
|
190
188
|
expect(outcomes).toHaveLength(3);
|
|
@@ -194,8 +192,8 @@ describe("next file", () => {
|
|
|
194
192
|
expect(["completed", "failed"]).toContain(client[0].outcome);
|
|
195
193
|
}
|
|
196
194
|
});
|
|
197
|
-
}
|
|
198
|
-
);
|
|
195
|
+
}`;
|
|
196
|
+
for (const name of ["a.test.ts", "b.test.ts"]) writeFileSync(join(dir, name), fixture);
|
|
199
197
|
// The real preload owns file teardown. Bun may discard a bare file's
|
|
200
198
|
// callbacks without notifying its workers' clients during VM teardown.
|
|
201
199
|
const child = spawnSync(
|
|
@@ -212,6 +210,10 @@ describe("next file", () => {
|
|
|
212
210
|
const output = child.stdout + child.stderr;
|
|
213
211
|
expect(output).toContain("2 pass");
|
|
214
212
|
expect(output).toContain("0 fail");
|
|
213
|
+
expect(output).toContain("(pass) owner finishes with queued work");
|
|
214
|
+
expect(output).toContain(
|
|
215
|
+
"(pass) still registers after every queued client settles once",
|
|
216
|
+
);
|
|
215
217
|
expect(output).not.toContain("Unhandled error");
|
|
216
218
|
expect(child.status).toBe(0);
|
|
217
219
|
const settled = readFileSync(outcomes, "utf8").trim().split("\n").filter(Boolean);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import { spawnSync } from "node:child_process";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { copyFileSync, existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import {
|
|
7
7
|
Database,
|
|
@@ -113,11 +113,24 @@ describe("SQLite runtime selector", () => {
|
|
|
113
113
|
);
|
|
114
114
|
const path = join(directory, "context.db");
|
|
115
115
|
try {
|
|
116
|
-
const
|
|
117
|
-
writer
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
const source = join(directory, "writer.db");
|
|
117
|
+
const writer = new Database(source);
|
|
118
|
+
try {
|
|
119
|
+
expect(writer.prepare("PRAGMA journal_mode=WAL").get()).toEqual({
|
|
120
|
+
journal_mode: "wal",
|
|
121
|
+
});
|
|
122
|
+
writer.exec("CREATE TABLE sample (value INTEGER); INSERT INTO sample VALUES (42)");
|
|
123
|
+
expect(writer.prepare("PRAGMA wal_checkpoint(TRUNCATE)").get()).toEqual({
|
|
124
|
+
busy: 0,
|
|
125
|
+
log: 0,
|
|
126
|
+
checkpointed: 0,
|
|
127
|
+
});
|
|
128
|
+
} finally {
|
|
129
|
+
writer.close();
|
|
130
|
+
}
|
|
131
|
+
// Apple's SQLite may keep the sidecars after close. Copy only the
|
|
132
|
+
// fully checkpointed main file, which is still in WAL mode.
|
|
133
|
+
copyFileSync(source, path);
|
|
121
134
|
expect(existsSync(`${path}-wal`)).toBe(false);
|
|
122
135
|
expect(existsSync(`${path}-shm`)).toBe(false);
|
|
123
136
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { afterEach, expect, spyOn, test } from "bun:test";
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
2
3
|
import { tmpdir } from "node:os";
|
|
3
4
|
import { join } from "node:path";
|
|
4
5
|
import * as messageTime from "../features/magic-context/message-time-backfill";
|
|
@@ -9,7 +10,7 @@ import {
|
|
|
9
10
|
openDatabase,
|
|
10
11
|
} from "../features/magic-context/storage-db";
|
|
11
12
|
import * as warmup from "../hooks/magic-context/raw-ordinal-warmup";
|
|
12
|
-
import { setHarness } from "./harness";
|
|
13
|
+
import { _resetHarnessForTesting, setHarness } from "./harness";
|
|
13
14
|
import { openTestDatabase, openTestDb } from "./test-db";
|
|
14
15
|
import { createTestTempDirFromPath } from "./test-temp-dir";
|
|
15
16
|
|
|
@@ -18,11 +19,12 @@ afterEach(async () => {
|
|
|
18
19
|
await closeDatabase();
|
|
19
20
|
if (originalHome === undefined) delete process.env.XDG_DATA_HOME;
|
|
20
21
|
else process.env.XDG_DATA_HOME = originalHome;
|
|
21
|
-
|
|
22
|
+
_resetHarnessForTesting();
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
test("transform fixture opener opts into and joins both startup writers before returning the serving handle", async () => {
|
|
25
26
|
process.env.XDG_DATA_HOME = createTestTempDirFromPath(join(tmpdir(), "mc-startup-barrier-"));
|
|
27
|
+
_resetHarnessForTesting();
|
|
26
28
|
setHarness("opencode");
|
|
27
29
|
const ftsStarted = Promise.withResolvers<void>();
|
|
28
30
|
const releaseFts = Promise.withResolvers<void>();
|
|
@@ -66,7 +68,7 @@ test("transform fixture opener opts into and joins both startup writers before r
|
|
|
66
68
|
releaseTime.resolve();
|
|
67
69
|
const db = await opening;
|
|
68
70
|
expect(__getDatabaseStartupStateForTests(db).running).toBeInstanceOf(Promise);
|
|
69
|
-
expect(getDatabasePath(db)).toBe(dbPath[0]!.file);
|
|
71
|
+
expect(realpathSync(getDatabasePath(db))).toBe(realpathSync(dbPath[0]!.file));
|
|
70
72
|
db.exec("BEGIN IMMEDIATE; ROLLBACK");
|
|
71
73
|
await closeDatabase();
|
|
72
74
|
const next = openDatabase()!;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { devNull } from "node:os";
|
|
3
|
+
import { isolatedTestGitEnv } from "./test-git-env";
|
|
4
|
+
|
|
5
|
+
test("Git fixtures keep explicit settings without inheriting user configuration or repository paths", () => {
|
|
6
|
+
const inherited = {
|
|
7
|
+
GIT_CONFIG: "outer-config",
|
|
8
|
+
GIT_CONFIG_COUNT: "1",
|
|
9
|
+
GIT_CONFIG_KEY_0: "core.hooksPath",
|
|
10
|
+
GIT_CONFIG_VALUE_0: "outer-hooks",
|
|
11
|
+
GIT_CONFIG_PARAMETERS: "'core.hooksPath=outer-hooks'",
|
|
12
|
+
GIT_CONFIG_GLOBAL: "outer-global-config",
|
|
13
|
+
GIT_DIR: "outer-repository/.git",
|
|
14
|
+
GIT_WORK_TREE: "outer-repository",
|
|
15
|
+
GIT_INDEX_FILE: "outer-index",
|
|
16
|
+
};
|
|
17
|
+
const keys = Object.keys(inherited);
|
|
18
|
+
const original = keys.map((key) => process.env[key]);
|
|
19
|
+
Object.assign(process.env, inherited);
|
|
20
|
+
try {
|
|
21
|
+
const env = isolatedTestGitEnv({ GIT_AUTHOR_DATE: "@1 +0000" });
|
|
22
|
+
expect(
|
|
23
|
+
Object.fromEntries(Object.entries(env).filter(([key]) => key.startsWith("GIT_"))),
|
|
24
|
+
).toEqual({
|
|
25
|
+
GIT_CONFIG_GLOBAL: devNull,
|
|
26
|
+
GIT_CONFIG_NOSYSTEM: "1",
|
|
27
|
+
GIT_AUTHOR_DATE: "@1 +0000",
|
|
28
|
+
});
|
|
29
|
+
expect(env.PATH).toBe(process.env.PATH);
|
|
30
|
+
expect(process.env.GIT_DIR).toBe(inherited.GIT_DIR);
|
|
31
|
+
} finally {
|
|
32
|
+
for (const [index, key] of keys.entries()) {
|
|
33
|
+
const value = original[index];
|
|
34
|
+
if (value === undefined) delete process.env[key];
|
|
35
|
+
else process.env[key] = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { devNull } from "node:os";
|
|
2
|
+
|
|
3
|
+
/** Keep caller config, hooks, and repository paths out of fixture Git commands. */
|
|
4
|
+
export function isolatedTestGitEnv(overrides: NodeJS.ProcessEnv = {}): NodeJS.ProcessEnv {
|
|
5
|
+
const env: NodeJS.ProcessEnv = {};
|
|
6
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
7
|
+
if (!key.toUpperCase().startsWith("GIT_")) env[key] = value;
|
|
8
|
+
}
|
|
9
|
+
return { ...env, GIT_CONFIG_GLOBAL: devNull, GIT_CONFIG_NOSYSTEM: "1", ...overrides };
|
|
10
|
+
}
|