sphica 0.6.18 → 0.6.21
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/db/migrations/0008.check.sql +33 -0
- package/db/migrations/0008.sql +53 -0
- package/db/schema.sql +16 -1
- package/dist/capture.js +58 -22
- package/dist/cli.js +1184 -619
- package/dist/deliver.js +56 -22
- package/dist/mcp-record.js +67 -33
- package/dist/mcp.js +694 -584
- package/package.json +1 -1
package/dist/deliver.js
CHANGED
|
@@ -101,6 +101,7 @@ var QUESTION = new Set([
|
|
|
101
101
|
...["add", "get", "make", "have", "has", "not", "no", "yes", "reason"],
|
|
102
102
|
...["理由", "仕組", "何", "方", "場合", "今", "件"]
|
|
103
103
|
]);
|
|
104
|
+
var FOLDED_QUESTION = new Set([...QUESTION].flatMap((w) => terms(w)));
|
|
104
105
|
var sha256 = (s) => crypto.createHash("sha256").update(s).digest();
|
|
105
106
|
function uuidFrom(...parts) {
|
|
106
107
|
const b = crypto.createHash("sha256").update(parts.join("\x00")).digest().subarray(0, 16);
|
|
@@ -11134,7 +11135,7 @@ var HOST_MARKS = new Set([".orphaned_at", ".in_use"]);
|
|
|
11134
11135
|
|
|
11135
11136
|
// server/src/sqlite.ts
|
|
11136
11137
|
var SCHEMA_GENERATION = 2;
|
|
11137
|
-
var SCHEMA_REVISION =
|
|
11138
|
+
var SCHEMA_REVISION = 8;
|
|
11138
11139
|
var sphicaHome = () => process.env.SPHICA_HOME || path3.join(os.homedir(), ".sphica");
|
|
11139
11140
|
var dbFile = () => process.env.SPHICA_DB || path3.join(sphicaHome(), "sphica.db");
|
|
11140
11141
|
function requireRuntime() {
|
|
@@ -11511,7 +11512,7 @@ import fs3 from "node:fs";
|
|
|
11511
11512
|
import path4 from "node:path";
|
|
11512
11513
|
var localFile = () => path4.join(sphicaHome(), "projects.json");
|
|
11513
11514
|
var LOCAL_KEY = /^[a-z0-9][a-z0-9._-]*$/;
|
|
11514
|
-
function
|
|
11515
|
+
function legacyRemote(url) {
|
|
11515
11516
|
const raw = String(url ?? "").trim();
|
|
11516
11517
|
if (!raw)
|
|
11517
11518
|
return null;
|
|
@@ -11528,6 +11529,15 @@ function normalizeRemote(url) {
|
|
|
11528
11529
|
return null;
|
|
11529
11530
|
}
|
|
11530
11531
|
}
|
|
11532
|
+
var fold = (s) => s.replace(/[A-Z]+/g, (m) => m.toLowerCase());
|
|
11533
|
+
function normalizeKey(key) {
|
|
11534
|
+
if (!key.startsWith("git:"))
|
|
11535
|
+
return key;
|
|
11536
|
+
const rest = key.slice(4);
|
|
11537
|
+
const cut = rest.indexOf("/");
|
|
11538
|
+
const host = fold(cut < 0 ? rest : rest.slice(0, cut));
|
|
11539
|
+
return host === "github.com" ? fold(key) : `git:${host}${cut < 0 ? "" : rest.slice(cut)}`;
|
|
11540
|
+
}
|
|
11531
11541
|
var git = (dir, ...args) => {
|
|
11532
11542
|
try {
|
|
11533
11543
|
return execFileSync("git", ["-C", dir, ...args], {
|
|
@@ -11562,14 +11572,17 @@ function identify(dir) {
|
|
|
11562
11572
|
const given = path4.resolve(dir);
|
|
11563
11573
|
const top = git(given, "rev-parse", "--show-toplevel");
|
|
11564
11574
|
const root = top || given;
|
|
11565
|
-
const
|
|
11566
|
-
if (
|
|
11567
|
-
|
|
11575
|
+
const legacy = top ? legacyRemote(git(root, "remote", "get-url", "origin")) : null;
|
|
11576
|
+
if (legacy) {
|
|
11577
|
+
const key = normalizeKey(`git:${legacy}`);
|
|
11578
|
+
const remote = key.slice(4);
|
|
11579
|
+
return { key, legacyKey: `git:${legacy}`, root, name: remote.split("/").slice(1).join("/") || remote };
|
|
11580
|
+
}
|
|
11568
11581
|
const map = localMap();
|
|
11569
11582
|
for (let d = root;; d = path4.dirname(d)) {
|
|
11570
11583
|
const local = map[d];
|
|
11571
11584
|
if (local && LOCAL_KEY.test(local))
|
|
11572
|
-
return { key: `local:${local}`, root: d, name: local };
|
|
11585
|
+
return { key: `local:${local}`, legacyKey: `local:${local}`, root: d, name: local };
|
|
11573
11586
|
if (top || path4.dirname(d) === d)
|
|
11574
11587
|
return null;
|
|
11575
11588
|
}
|
|
@@ -11665,6 +11678,8 @@ var HOLD_MAX = 1000;
|
|
|
11665
11678
|
var baselineDir = () => path6.join(sphicaHome(), "worktree");
|
|
11666
11679
|
function current(raw) {
|
|
11667
11680
|
const r = raw;
|
|
11681
|
+
if (typeof r.project !== "string")
|
|
11682
|
+
throw new Error("queue record without a project key");
|
|
11668
11683
|
if (r.v === 2)
|
|
11669
11684
|
return raw;
|
|
11670
11685
|
if (r.v !== 1)
|
|
@@ -11845,7 +11860,7 @@ function onHook(host, input) {
|
|
|
11845
11860
|
v: 2,
|
|
11846
11861
|
host,
|
|
11847
11862
|
session: String(input.session_id),
|
|
11848
|
-
project: place.
|
|
11863
|
+
project: place.legacyKey,
|
|
11849
11864
|
branch: branchOf(place.root),
|
|
11850
11865
|
turn,
|
|
11851
11866
|
at
|
|
@@ -11977,17 +11992,33 @@ var BATCH = 500;
|
|
|
11977
11992
|
var FLUSH_BUDGET_MS = 30000;
|
|
11978
11993
|
var ROWS = 1000;
|
|
11979
11994
|
var chunks = (xs, n = ROWS) => Array.from({ length: Math.ceil(xs.length / n) }, (_, i) => xs.slice(i * n, (i + 1) * n));
|
|
11980
|
-
async function
|
|
11995
|
+
async function projectsOf(trx, keys) {
|
|
11996
|
+
if (!keys.length)
|
|
11997
|
+
return new Map;
|
|
11998
|
+
const all = await trx.selectFrom("project").select(["id", "key"]).execute();
|
|
11999
|
+
const exact = new Map(all.map((p) => [p.key, p.id]));
|
|
12000
|
+
const normal = Map.groupBy(all, (p) => normalizeKey(p.key));
|
|
12001
|
+
const found = new Map;
|
|
12002
|
+
for (const k of keys) {
|
|
12003
|
+
const same = normal.get(normalizeKey(k));
|
|
12004
|
+
const id = exact.get(k) ?? (same?.length === 1 ? same[0]?.id : undefined);
|
|
12005
|
+
if (id !== undefined)
|
|
12006
|
+
found.set(k, id);
|
|
12007
|
+
}
|
|
12008
|
+
return found;
|
|
12009
|
+
}
|
|
12010
|
+
async function write(db, batch) {
|
|
11981
12011
|
return inTransaction(db, async (trx) => {
|
|
12012
|
+
const projects = await projectsOf(trx, batch.map((r) => r.project));
|
|
11982
12013
|
const sessions = new Map;
|
|
11983
12014
|
for (const r of batch) {
|
|
11984
12015
|
const p = projects.get(r.project);
|
|
11985
|
-
if (
|
|
12016
|
+
if (p === undefined)
|
|
11986
12017
|
continue;
|
|
11987
|
-
const id = sessionId(p
|
|
12018
|
+
const id = sessionId(p, r.host, r.session);
|
|
11988
12019
|
const prev = sessions.get(id);
|
|
11989
12020
|
if (!prev || Date.parse(r.at) < Date.parse(prev.at))
|
|
11990
|
-
sessions.set(id, { project: p
|
|
12021
|
+
sessions.set(id, { project: p, host: r.host, session: r.session, branch: r.branch, at: r.at });
|
|
11991
12022
|
}
|
|
11992
12023
|
for (const part of chunks([...sessions]))
|
|
11993
12024
|
await trx.insertInto("capture_session").values(part.map(([id, v]) => ({
|
|
@@ -12000,9 +12031,9 @@ async function write(db, batch, projects) {
|
|
|
12000
12031
|
}))).execute();
|
|
12001
12032
|
const messages = batch.flatMap((m) => {
|
|
12002
12033
|
const p = m.kind === "message" ? projects.get(m.project) : undefined;
|
|
12003
|
-
if (m.kind !== "message" ||
|
|
12034
|
+
if (m.kind !== "message" || p === undefined)
|
|
12004
12035
|
return [];
|
|
12005
|
-
return [{ m, session: sessionId(p
|
|
12036
|
+
return [{ m, session: sessionId(p, m.host, m.session) }];
|
|
12006
12037
|
});
|
|
12007
12038
|
const present = async () => {
|
|
12008
12039
|
let n = 0;
|
|
@@ -12030,11 +12061,11 @@ async function write(db, batch, projects) {
|
|
|
12030
12061
|
const after = await present();
|
|
12031
12062
|
const edits = batch.flatMap((r) => {
|
|
12032
12063
|
const p = r.kind === "edit" ? projects.get(r.project) : undefined;
|
|
12033
|
-
if (r.kind !== "edit" ||
|
|
12064
|
+
if (r.kind !== "edit" || p === undefined)
|
|
12034
12065
|
return [];
|
|
12035
12066
|
return [
|
|
12036
12067
|
{
|
|
12037
|
-
session_id: sessionId(p
|
|
12068
|
+
session_id: sessionId(p, r.host, r.session),
|
|
12038
12069
|
turn_id: r.turn,
|
|
12039
12070
|
tool_event_id: r.event,
|
|
12040
12071
|
path: r.path,
|
|
@@ -12045,7 +12076,7 @@ async function write(db, batch, projects) {
|
|
|
12045
12076
|
});
|
|
12046
12077
|
for (const part of chunks(edits))
|
|
12047
12078
|
await trx.insertInto("capture_edit").values(part).execute();
|
|
12048
|
-
return after - before;
|
|
12079
|
+
return { sent: after - before, strayed: new Set(batch.filter((r) => !projects.has(r.project))) };
|
|
12049
12080
|
});
|
|
12050
12081
|
}
|
|
12051
12082
|
var REJECTED = new Set([18, 19, 20, 25]);
|
|
@@ -12074,19 +12105,22 @@ async function sendBatch(db, names) {
|
|
|
12074
12105
|
else
|
|
12075
12106
|
fs5.rmSync(path6.join(from, name), { force: true });
|
|
12076
12107
|
}
|
|
12077
|
-
const projects = new Map((await db.selectFrom("project").select(["id", "key", "name"]).where("key", "in", [...new Set(records.map((x) => x.r.project))]).execute()).map((p) => [p.key, { id: p.id, name: p.name }]));
|
|
12078
|
-
const known = records.filter((x) => projects.has(x.r.project));
|
|
12079
|
-
const strayed = records.filter((x) => !projects.has(x.r.project));
|
|
12080
12108
|
let sent = 0;
|
|
12109
|
+
let strayed = [];
|
|
12081
12110
|
const bad = [];
|
|
12082
12111
|
try {
|
|
12083
|
-
|
|
12112
|
+
const out = await write(db, records.map((x) => x.r));
|
|
12113
|
+
sent = out.sent;
|
|
12114
|
+
strayed = records.filter((x) => out.strayed.has(x.r));
|
|
12084
12115
|
} catch (e) {
|
|
12085
12116
|
if (!rejected(e))
|
|
12086
12117
|
throw e;
|
|
12087
|
-
for (const x of
|
|
12118
|
+
for (const x of records) {
|
|
12088
12119
|
try {
|
|
12089
|
-
|
|
12120
|
+
const out = await write(db, [x.r]);
|
|
12121
|
+
sent += out.sent;
|
|
12122
|
+
if (out.strayed.size)
|
|
12123
|
+
strayed.push(x);
|
|
12090
12124
|
} catch (e2) {
|
|
12091
12125
|
if (!rejected(e2))
|
|
12092
12126
|
throw e2;
|
package/dist/mcp-record.js
CHANGED
|
@@ -45614,6 +45614,7 @@ var QUESTION = new Set([
|
|
|
45614
45614
|
...["add", "get", "make", "have", "has", "not", "no", "yes", "reason"],
|
|
45615
45615
|
...["理由", "仕組", "何", "方", "場合", "今", "件"]
|
|
45616
45616
|
]);
|
|
45617
|
+
var FOLDED_QUESTION = new Set([...QUESTION].flatMap((w) => terms(w)));
|
|
45617
45618
|
var sha256 = (s) => crypto.createHash("sha256").update(s).digest();
|
|
45618
45619
|
function uuidFrom(...parts) {
|
|
45619
45620
|
const b = crypto.createHash("sha256").update(parts.join("\x00")).digest().subarray(0, 16);
|
|
@@ -45869,7 +45870,7 @@ var HOST_MARKS = new Set([".orphaned_at", ".in_use"]);
|
|
|
45869
45870
|
|
|
45870
45871
|
// server/src/sqlite.ts
|
|
45871
45872
|
var SCHEMA_GENERATION = 2;
|
|
45872
|
-
var SCHEMA_REVISION =
|
|
45873
|
+
var SCHEMA_REVISION = 8;
|
|
45873
45874
|
var sphicaHome = () => process.env.SPHICA_HOME || path2.join(os.homedir(), ".sphica");
|
|
45874
45875
|
var dbFile = () => process.env.SPHICA_DB || path2.join(sphicaHome(), "sphica.db");
|
|
45875
45876
|
function requireRuntime() {
|
|
@@ -46342,7 +46343,7 @@ ${l}`).join("");
|
|
|
46342
46343
|
// server/src/project.ts
|
|
46343
46344
|
var localFile = () => path4.join(sphicaHome(), "projects.json");
|
|
46344
46345
|
var LOCAL_KEY = /^[a-z0-9][a-z0-9._-]*$/;
|
|
46345
|
-
function
|
|
46346
|
+
function legacyRemote(url2) {
|
|
46346
46347
|
const raw = String(url2 ?? "").trim();
|
|
46347
46348
|
if (!raw)
|
|
46348
46349
|
return null;
|
|
@@ -46359,6 +46360,15 @@ function normalizeRemote(url2) {
|
|
|
46359
46360
|
return null;
|
|
46360
46361
|
}
|
|
46361
46362
|
}
|
|
46363
|
+
var fold = (s) => s.replace(/[A-Z]+/g, (m) => m.toLowerCase());
|
|
46364
|
+
function normalizeKey(key) {
|
|
46365
|
+
if (!key.startsWith("git:"))
|
|
46366
|
+
return key;
|
|
46367
|
+
const rest = key.slice(4);
|
|
46368
|
+
const cut = rest.indexOf("/");
|
|
46369
|
+
const host = fold(cut < 0 ? rest : rest.slice(0, cut));
|
|
46370
|
+
return host === "github.com" ? fold(key) : `git:${host}${cut < 0 ? "" : rest.slice(cut)}`;
|
|
46371
|
+
}
|
|
46362
46372
|
var git = (dir, ...args) => {
|
|
46363
46373
|
try {
|
|
46364
46374
|
return execFileSync("git", ["-C", dir, ...args], {
|
|
@@ -46393,14 +46403,17 @@ function identify(dir) {
|
|
|
46393
46403
|
const given = path4.resolve(dir);
|
|
46394
46404
|
const top = git(given, "rev-parse", "--show-toplevel");
|
|
46395
46405
|
const root = top || given;
|
|
46396
|
-
const
|
|
46397
|
-
if (
|
|
46398
|
-
|
|
46406
|
+
const legacy = top ? legacyRemote(git(root, "remote", "get-url", "origin")) : null;
|
|
46407
|
+
if (legacy) {
|
|
46408
|
+
const key = normalizeKey(`git:${legacy}`);
|
|
46409
|
+
const remote = key.slice(4);
|
|
46410
|
+
return { key, legacyKey: `git:${legacy}`, root, name: remote.split("/").slice(1).join("/") || remote };
|
|
46411
|
+
}
|
|
46399
46412
|
const map3 = localMap();
|
|
46400
46413
|
for (let d = root;; d = path4.dirname(d)) {
|
|
46401
46414
|
const local = map3[d];
|
|
46402
46415
|
if (local && LOCAL_KEY.test(local))
|
|
46403
|
-
return { key: `local:${local}`, root: d, name: local };
|
|
46416
|
+
return { key: `local:${local}`, legacyKey: `local:${local}`, root: d, name: local };
|
|
46404
46417
|
if (top || path4.dirname(d) === d)
|
|
46405
46418
|
return null;
|
|
46406
46419
|
}
|
|
@@ -46516,6 +46529,8 @@ var HOLD_MAX = 1000;
|
|
|
46516
46529
|
var baselineDir = () => path6.join(sphicaHome(), "worktree");
|
|
46517
46530
|
function current(raw) {
|
|
46518
46531
|
const r = raw;
|
|
46532
|
+
if (typeof r.project !== "string")
|
|
46533
|
+
throw new Error("queue record without a project key");
|
|
46519
46534
|
if (r.v === 2)
|
|
46520
46535
|
return raw;
|
|
46521
46536
|
if (r.v !== 1)
|
|
@@ -46696,7 +46711,7 @@ function onHook(host, input2) {
|
|
|
46696
46711
|
v: 2,
|
|
46697
46712
|
host,
|
|
46698
46713
|
session: String(input2.session_id),
|
|
46699
|
-
project: place.
|
|
46714
|
+
project: place.legacyKey,
|
|
46700
46715
|
branch: branchOf(place.root),
|
|
46701
46716
|
turn,
|
|
46702
46717
|
at
|
|
@@ -46829,17 +46844,33 @@ var FLUSH_BUDGET_MS = 30000;
|
|
|
46829
46844
|
var TOOL_FLUSH_BUDGET_MS = 2000;
|
|
46830
46845
|
var ROWS = 1000;
|
|
46831
46846
|
var chunks = (xs, n = ROWS) => Array.from({ length: Math.ceil(xs.length / n) }, (_, i) => xs.slice(i * n, (i + 1) * n));
|
|
46832
|
-
async function
|
|
46847
|
+
async function projectsOf(trx, keys) {
|
|
46848
|
+
if (!keys.length)
|
|
46849
|
+
return new Map;
|
|
46850
|
+
const all = await trx.selectFrom("project").select(["id", "key"]).execute();
|
|
46851
|
+
const exact = new Map(all.map((p) => [p.key, p.id]));
|
|
46852
|
+
const normal = Map.groupBy(all, (p) => normalizeKey(p.key));
|
|
46853
|
+
const found = new Map;
|
|
46854
|
+
for (const k of keys) {
|
|
46855
|
+
const same = normal.get(normalizeKey(k));
|
|
46856
|
+
const id = exact.get(k) ?? (same?.length === 1 ? same[0]?.id : undefined);
|
|
46857
|
+
if (id !== undefined)
|
|
46858
|
+
found.set(k, id);
|
|
46859
|
+
}
|
|
46860
|
+
return found;
|
|
46861
|
+
}
|
|
46862
|
+
async function write(db, batch) {
|
|
46833
46863
|
return inTransaction(db, async (trx) => {
|
|
46864
|
+
const projects = await projectsOf(trx, batch.map((r) => r.project));
|
|
46834
46865
|
const sessions = new Map;
|
|
46835
46866
|
for (const r of batch) {
|
|
46836
46867
|
const p = projects.get(r.project);
|
|
46837
|
-
if (
|
|
46868
|
+
if (p === undefined)
|
|
46838
46869
|
continue;
|
|
46839
|
-
const id = sessionId(p
|
|
46870
|
+
const id = sessionId(p, r.host, r.session);
|
|
46840
46871
|
const prev = sessions.get(id);
|
|
46841
46872
|
if (!prev || Date.parse(r.at) < Date.parse(prev.at))
|
|
46842
|
-
sessions.set(id, { project: p
|
|
46873
|
+
sessions.set(id, { project: p, host: r.host, session: r.session, branch: r.branch, at: r.at });
|
|
46843
46874
|
}
|
|
46844
46875
|
for (const part of chunks([...sessions]))
|
|
46845
46876
|
await trx.insertInto("capture_session").values(part.map(([id, v]) => ({
|
|
@@ -46852,9 +46883,9 @@ async function write(db, batch, projects) {
|
|
|
46852
46883
|
}))).execute();
|
|
46853
46884
|
const messages = batch.flatMap((m) => {
|
|
46854
46885
|
const p = m.kind === "message" ? projects.get(m.project) : undefined;
|
|
46855
|
-
if (m.kind !== "message" ||
|
|
46886
|
+
if (m.kind !== "message" || p === undefined)
|
|
46856
46887
|
return [];
|
|
46857
|
-
return [{ m, session: sessionId(p
|
|
46888
|
+
return [{ m, session: sessionId(p, m.host, m.session) }];
|
|
46858
46889
|
});
|
|
46859
46890
|
const present = async () => {
|
|
46860
46891
|
let n = 0;
|
|
@@ -46882,11 +46913,11 @@ async function write(db, batch, projects) {
|
|
|
46882
46913
|
const after = await present();
|
|
46883
46914
|
const edits = batch.flatMap((r) => {
|
|
46884
46915
|
const p = r.kind === "edit" ? projects.get(r.project) : undefined;
|
|
46885
|
-
if (r.kind !== "edit" ||
|
|
46916
|
+
if (r.kind !== "edit" || p === undefined)
|
|
46886
46917
|
return [];
|
|
46887
46918
|
return [
|
|
46888
46919
|
{
|
|
46889
|
-
session_id: sessionId(p
|
|
46920
|
+
session_id: sessionId(p, r.host, r.session),
|
|
46890
46921
|
turn_id: r.turn,
|
|
46891
46922
|
tool_event_id: r.event,
|
|
46892
46923
|
path: r.path,
|
|
@@ -46897,7 +46928,7 @@ async function write(db, batch, projects) {
|
|
|
46897
46928
|
});
|
|
46898
46929
|
for (const part of chunks(edits))
|
|
46899
46930
|
await trx.insertInto("capture_edit").values(part).execute();
|
|
46900
|
-
return after - before;
|
|
46931
|
+
return { sent: after - before, strayed: new Set(batch.filter((r) => !projects.has(r.project))) };
|
|
46901
46932
|
});
|
|
46902
46933
|
}
|
|
46903
46934
|
var REJECTED = new Set([18, 19, 20, 25]);
|
|
@@ -46926,19 +46957,22 @@ async function sendBatch(db, names) {
|
|
|
46926
46957
|
else
|
|
46927
46958
|
fs6.rmSync(path6.join(from, name), { force: true });
|
|
46928
46959
|
}
|
|
46929
|
-
const projects = new Map((await db.selectFrom("project").select(["id", "key", "name"]).where("key", "in", [...new Set(records.map((x) => x.r.project))]).execute()).map((p) => [p.key, { id: p.id, name: p.name }]));
|
|
46930
|
-
const known = records.filter((x) => projects.has(x.r.project));
|
|
46931
|
-
const strayed = records.filter((x) => !projects.has(x.r.project));
|
|
46932
46960
|
let sent = 0;
|
|
46961
|
+
let strayed = [];
|
|
46933
46962
|
const bad = [];
|
|
46934
46963
|
try {
|
|
46935
|
-
|
|
46964
|
+
const out = await write(db, records.map((x) => x.r));
|
|
46965
|
+
sent = out.sent;
|
|
46966
|
+
strayed = records.filter((x) => out.strayed.has(x.r));
|
|
46936
46967
|
} catch (e) {
|
|
46937
46968
|
if (!rejected(e))
|
|
46938
46969
|
throw e;
|
|
46939
|
-
for (const x of
|
|
46970
|
+
for (const x of records) {
|
|
46940
46971
|
try {
|
|
46941
|
-
|
|
46972
|
+
const out = await write(db, [x.r]);
|
|
46973
|
+
sent += out.sent;
|
|
46974
|
+
if (out.strayed.size)
|
|
46975
|
+
strayed.push(x);
|
|
46942
46976
|
} catch (e2) {
|
|
46943
46977
|
if (!rejected(e2))
|
|
46944
46978
|
throw e2;
|
|
@@ -49264,20 +49298,20 @@ var RECORD = exports_external.record(exports_external.string(), exports_external
|
|
|
49264
49298
|
server.registerTool("trace_pending", {
|
|
49265
49299
|
title: "Sessions not traced yet",
|
|
49266
49300
|
description: "Lists this project's captured sessions with owner messages no trace has looked at, then apart those whose last owner message is over 30 days old.",
|
|
49267
|
-
inputSchema: { cwd: CWD },
|
|
49301
|
+
inputSchema: exports_external.object({ cwd: CWD }).strict(),
|
|
49268
49302
|
annotations: READ
|
|
49269
49303
|
}, async (a, extra) => tool(async () => pendingText(conn(), (await projectOf(a.cwd, extra._meta)).projectId)));
|
|
49270
49304
|
server.registerTool("trace_begin", {
|
|
49271
49305
|
title: "Begin tracing a session",
|
|
49272
49306
|
description: "Binds a run to one captured session of this project and returns its id. session is an id from trace_pending, or this session's id.",
|
|
49273
|
-
inputSchema: { session: exports_external.string().min(1).max(200).optional(), cwd: CWD },
|
|
49307
|
+
inputSchema: exports_external.object({ session: exports_external.string().min(1).max(200).optional(), cwd: CWD }).strict(),
|
|
49274
49308
|
annotations: WRITE
|
|
49275
49309
|
}, async (a, extra) => tool(async () => `run: ${await beginTrace(conn(), (await projectOf(a.cwd, extra._meta)).projectId, a.session)}
|
|
49276
49310
|
Next: record_context with this run.`));
|
|
49277
49311
|
server.registerTool("harvest_begin", {
|
|
49278
49312
|
title: "Begin harvesting a pull request",
|
|
49279
49313
|
description: "Reads a pull request of this repository and the issues it closes through gh (read only), keeps them as sources, and returns a run id.",
|
|
49280
|
-
inputSchema: { pr: exports_external.number().int().positive(), cwd: CWD },
|
|
49314
|
+
inputSchema: exports_external.object({ pr: exports_external.number().int().positive(), cwd: CWD }).strict(),
|
|
49281
49315
|
annotations: { ...WRITE, openWorldHint: true }
|
|
49282
49316
|
}, async (a, extra) => tool(async () => {
|
|
49283
49317
|
const p = await projectOf(a.cwd, extra._meta);
|
|
@@ -49291,14 +49325,14 @@ ${r.sources} sources kept. Next: record_context with this run.`;
|
|
|
49291
49325
|
server.registerTool("glean_begin", {
|
|
49292
49326
|
title: "Begin gleaning",
|
|
49293
49327
|
description: "Binds a run to this session, whose owner messages are the evidence glean cites, and returns its id. session is this session's id.",
|
|
49294
|
-
inputSchema: { session: exports_external.string().min(1).max(200).optional(), cwd: CWD },
|
|
49328
|
+
inputSchema: exports_external.object({ session: exports_external.string().min(1).max(200).optional(), cwd: CWD }).strict(),
|
|
49295
49329
|
annotations: WRITE
|
|
49296
49330
|
}, async (a, extra) => tool(async () => `run: ${await beginGlean(conn(), (await projectOf(a.cwd, extra._meta)).projectId, a.session)}
|
|
49297
49331
|
Next: record_context with this run.`));
|
|
49298
49332
|
server.registerTool("glean_fetch", {
|
|
49299
49333
|
title: "Keep an issue or pull request the owner named",
|
|
49300
49334
|
description: "Reads a GitHub issue or pull request URL of this repository through gh (read only), keeps it as sources, and lists their refs.",
|
|
49301
|
-
inputSchema: { run: RUN, url: exports_external.string().url().max(500), cwd: CWD },
|
|
49335
|
+
inputSchema: exports_external.object({ run: RUN, url: exports_external.string().url().max(500), cwd: CWD }).strict(),
|
|
49302
49336
|
annotations: { ...WRITE, openWorldHint: true }
|
|
49303
49337
|
}, async (a, extra) => tool(async () => {
|
|
49304
49338
|
const p = await projectOf(a.cwd, extra._meta);
|
|
@@ -49307,11 +49341,11 @@ server.registerTool("glean_fetch", {
|
|
|
49307
49341
|
server.registerTool("record_context", {
|
|
49308
49342
|
title: "What a run may cite",
|
|
49309
49343
|
description: "Prints the run's sources with their refs (s<id>) and this project's live records, a page at a time. A page that ends with " + "'call record_context with after' names the after to pass for the next one. Saving counts as looked at only the sources shown " + "and those the record quotes.",
|
|
49310
|
-
inputSchema: {
|
|
49344
|
+
inputSchema: exports_external.object({
|
|
49311
49345
|
run: RUN,
|
|
49312
49346
|
after: exports_external.string().regex(/^s[1-9][0-9]{0,15}$/, "the ref the previous page named, such as s12").optional().describe("The ref the previous page named, to read the next page"),
|
|
49313
49347
|
cwd: CWD
|
|
49314
|
-
},
|
|
49348
|
+
}).strict(),
|
|
49315
49349
|
annotations: READ
|
|
49316
49350
|
}, async (a, extra) => tool(async () => {
|
|
49317
49351
|
const p = await projectOf(a.cwd, extra._meta);
|
|
@@ -49320,7 +49354,7 @@ server.registerTool("record_context", {
|
|
|
49320
49354
|
server.registerTool("record_check", {
|
|
49321
49355
|
title: "Check a record",
|
|
49322
49356
|
description: "Checks a record against the run's retained text without saving it.",
|
|
49323
|
-
inputSchema: { run: RUN, record: RECORD, cwd: CWD },
|
|
49357
|
+
inputSchema: exports_external.object({ run: RUN, record: RECORD, cwd: CWD }).strict(),
|
|
49324
49358
|
annotations: READ
|
|
49325
49359
|
}, async (a, extra) => tool(async () => {
|
|
49326
49360
|
const p = await projectOf(a.cwd, extra._meta);
|
|
@@ -49329,7 +49363,7 @@ server.registerTool("record_check", {
|
|
|
49329
49363
|
server.registerTool("record_save", {
|
|
49330
49364
|
title: "Save a record",
|
|
49331
49365
|
description: "Checks and saves a record for the run in one transaction. A run saves once.",
|
|
49332
|
-
inputSchema: { run: RUN, record: RECORD, cwd: CWD },
|
|
49366
|
+
inputSchema: exports_external.object({ run: RUN, record: RECORD, cwd: CWD }).strict(),
|
|
49333
49367
|
annotations: WRITE
|
|
49334
49368
|
}, async (a, extra) => tool(async () => {
|
|
49335
49369
|
const p = await projectOf(a.cwd, extra._meta);
|
|
@@ -49341,7 +49375,7 @@ var ANSWER_MS = 10 * 60 * 1000;
|
|
|
49341
49375
|
server.registerTool("forget_preview", {
|
|
49342
49376
|
title: "What forgetting sources would do",
|
|
49343
49377
|
description: "Shows which sources would be removed and which records would lose citations or leave active. Changes nothing. Never shows the text.",
|
|
49344
|
-
inputSchema: { sources: SOURCES, cwd: CWD },
|
|
49378
|
+
inputSchema: exports_external.object({ sources: SOURCES, cwd: CWD }).strict(),
|
|
49345
49379
|
annotations: READ
|
|
49346
49380
|
}, async (a, extra) => tool(async () => {
|
|
49347
49381
|
const p = await projectOf(a.cwd, extra._meta);
|
|
@@ -49350,7 +49384,7 @@ server.registerTool("forget_preview", {
|
|
|
49350
49384
|
server.registerTool("forget_apply", {
|
|
49351
49385
|
title: "Forget sources",
|
|
49352
49386
|
description: "Asks the owner in the host to confirm by typing the number of sources, then removes them, their index entries, and the bytes left in the file, and judges the records that cited them again. Nothing is removed without that answer.",
|
|
49353
|
-
inputSchema: { sources: SOURCES, cwd: CWD },
|
|
49387
|
+
inputSchema: exports_external.object({ sources: SOURCES, cwd: CWD }).strict(),
|
|
49354
49388
|
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false }
|
|
49355
49389
|
}, async (a, extra) => tool(async () => {
|
|
49356
49390
|
const p = await projectOf(a.cwd, extra._meta);
|