sphica 0.6.39 → 0.6.40
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/README.md +1 -0
- package/dist/mcp.js +216 -8
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://anthropic.com/claude-code/plugin.schema.json",
|
|
3
3
|
"name": "sphica",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.40",
|
|
5
5
|
"description": "Records Claude Code and Codex sessions on your machine and keeps past implementation and decisions, with their sources, for your agent to find.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "iroha924",
|
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ The database is a single SQLite file on your machine.
|
|
|
28
28
|
- **Search in Japanese and English.** Records are made with search words in both languages, so a question in either language is more likely to find them.
|
|
29
29
|
- **Find what you asked before.** Ask the agent whether you asked something like this before: `search` with `asked: true` shows your earlier messages in other sessions, the records that quote them (with what replaced them), and says "no recorded decision" when none was recorded, including a matter you raised in several sessions.
|
|
30
30
|
- **See what is live, and what needs a look.** Ask for the overview: `view: "live"` lists every active decision and constraint by the directory it applies to; `view: "look"` lists records whose file is gone or whose symbol is not found, conditions you said would bring a rejected option back, and lines in your instruction files whose record was replaced. Nothing is expired or changed on its own.
|
|
31
|
+
- **See what Sphica showed your agent.** Ask what Sphica has been showing: `view: "delivery"` (with `days`, 1 to 90, 7 by default) counts the deliveries the hooks logged by event and by main agent or subagent, lists the records shown most, and gives recent sessions with each record's key, so you can judge whether each helped. It says what the log leaves out, and marks a record "named later" only when a later reply wrote its key.
|
|
31
32
|
- **Track your own fields on records (trial).** Say in a session which extra field to keep on records (the affected tenant, a p95 figure); trace then saves a value only when the conversation writes it, with the quote. `/sphica:fields` shows each field and how many records carry a value.
|
|
32
33
|
- **Share decisions as a file.** `/sphica:export` writes the live decisions you pick, with the words quoted for them and the older decisions they replaced, to a Markdown file in your repository for people who do not run Sphica. You see the whole file before it is written, and it is never committed for you.
|
|
33
34
|
- **Rule text from records.** `/sphica:rules` drafts lines for CLAUDE.md, AGENTS.md, or `.claude/rules` from the constraints and decisions you pick, each marked with its record key so the overview flags it once the record changes. It never edits the file.
|
package/dist/mcp.js
CHANGED
|
@@ -46105,6 +46105,12 @@ function kyselyOn(connect) {
|
|
|
46105
46105
|
function openReader(file2 = dbFile()) {
|
|
46106
46106
|
return kyselyOn(() => connectReader(file2));
|
|
46107
46107
|
}
|
|
46108
|
+
var iso = (d) => {
|
|
46109
|
+
const t = new Date(d);
|
|
46110
|
+
if (Number.isNaN(t.getTime()))
|
|
46111
|
+
throw new RangeError(`Not a readable time: ${String(d)}`);
|
|
46112
|
+
return t.toISOString();
|
|
46113
|
+
};
|
|
46108
46114
|
function byUnit(rows) {
|
|
46109
46115
|
const out = new Map;
|
|
46110
46116
|
for (const r of rows) {
|
|
@@ -46828,10 +46834,6 @@ function askedText(r, known = true) {
|
|
|
46828
46834
|
`);
|
|
46829
46835
|
}
|
|
46830
46836
|
|
|
46831
|
-
// server/src/export.ts
|
|
46832
|
-
import fs5 from "node:fs";
|
|
46833
|
-
import path5 from "node:path";
|
|
46834
|
-
|
|
46835
46837
|
// server/src/frame.ts
|
|
46836
46838
|
import crypto2 from "node:crypto";
|
|
46837
46839
|
function framed(body) {
|
|
@@ -47170,7 +47172,208 @@ async function readRefs(db, projectId, refs, root) {
|
|
|
47170
47172
|
`)}${tail(next)}`);
|
|
47171
47173
|
}
|
|
47172
47174
|
|
|
47175
|
+
// server/src/delivery-view.ts
|
|
47176
|
+
var DELIVERY_DAYS = { min: 1, max: 90, default: 7 };
|
|
47177
|
+
var DELIVERY_LIMITS = {
|
|
47178
|
+
records: 20,
|
|
47179
|
+
sessions: 5,
|
|
47180
|
+
deliveries: 15,
|
|
47181
|
+
keys: 8,
|
|
47182
|
+
key: 200,
|
|
47183
|
+
path: 200,
|
|
47184
|
+
agent: 40,
|
|
47185
|
+
session: 80
|
|
47186
|
+
};
|
|
47187
|
+
var DAY_MS = 24 * 60 * 60 * 1000;
|
|
47188
|
+
var MORE_LINE = 120;
|
|
47189
|
+
var WHO = ["main", "subagent", "subagent, id unknown"];
|
|
47190
|
+
var who = (named, event, reason2) => named ? "subagent" : event === "session_start" && reason2 === "subagent" ? "subagent, id unknown" : "main";
|
|
47191
|
+
var DELIVERY_LIMITS_TEXT = [
|
|
47192
|
+
"Counted are the logged delivery rows only: since 0.6.16 a read or edit that showed nothing is not logged (older rows show it as nothing), and a delivery answered while the write lock was busy, or whose log write failed, is not either.",
|
|
47193
|
+
"A session's rows are dropped once its last delivery is older than 90 days, so a long period is not a rolling window.",
|
|
47194
|
+
"The text delivered then is not kept, only the record ids: a record shown now may have changed since.",
|
|
47195
|
+
"Outcomes suppressed and unavailable are not written today, so only emitted and nothing appear.",
|
|
47196
|
+
"Rows without an agent id count as main, as the host reported them, except a subagent start logged without one: subagent, id unknown.",
|
|
47197
|
+
"named later: a captured reply of the same session, after the delivery, writes the key whole (questions asked with AskUserQuestion are not counted). An agent may use a record without naming it, naming it does not mean it helped, a reply may be missing, cut, or redacted in capture, and it may come from any agent of the session."
|
|
47198
|
+
];
|
|
47199
|
+
var CLOSING = "Read a record by its key or u<id> before relying on it. Change a record only through /sphica:trace, with the owner's words.";
|
|
47200
|
+
var BEFORE_KEY = /[A-Za-z0-9_./:-]/;
|
|
47201
|
+
var AFTER_KEY = /[A-Za-z0-9_/-]/;
|
|
47202
|
+
var KEY_AFTER_DOT = /[A-Za-z0-9_./-]/;
|
|
47203
|
+
var QUESTION2 = /:ask:.*:q:/s;
|
|
47204
|
+
function namesKey(text2, key) {
|
|
47205
|
+
for (let i = text2.indexOf(key);i !== -1 && key; i = text2.indexOf(key, i + 1)) {
|
|
47206
|
+
const before = text2[i - 1];
|
|
47207
|
+
const after = text2[i + key.length];
|
|
47208
|
+
const next = text2[i + key.length + 1];
|
|
47209
|
+
const goesOn = after !== undefined && (AFTER_KEY.test(after) || after === "." && next !== undefined && KEY_AFTER_DOT.test(next));
|
|
47210
|
+
if ((before === undefined || !BEFORE_KEY.test(before)) && !goesOn)
|
|
47211
|
+
return true;
|
|
47212
|
+
}
|
|
47213
|
+
return false;
|
|
47214
|
+
}
|
|
47215
|
+
async function deliveryOverview(db, projectId, days, now = new Date) {
|
|
47216
|
+
const to = iso(now);
|
|
47217
|
+
const from = iso(now.getTime() - days * DAY_MS);
|
|
47218
|
+
const logged = () => db.selectFrom("delivery as d").innerJoin("session as s", "s.id", "d.session_id").where("s.project_id", "=", projectId).where("d.at", ">=", from).where("d.at", "<", to);
|
|
47219
|
+
const keyed = () => logged().where((eb) => eb.exists(eb.selectFrom("delivery_unit as k").whereRef("k.delivery_id", "=", "d.id").select("k.unit_id")));
|
|
47220
|
+
const delivered = () => db.selectFrom("delivery_unit as du").innerJoin("delivery as d", "d.id", "du.delivery_id").innerJoin("session as s", "s.id", "d.session_id").where("s.project_id", "=", projectId).where("d.at", ">=", from).where("d.at", "<", to);
|
|
47221
|
+
const [oldest, groups, top, units, recent, sessions] = await Promise.all([
|
|
47222
|
+
db.selectFrom("delivery as d").innerJoin("session as s", "s.id", "d.session_id").where("s.project_id", "=", projectId).select((eb) => eb.fn.min("d.at").as("at")).executeTakeFirst(),
|
|
47223
|
+
logged().select((eb) => [
|
|
47224
|
+
"d.event",
|
|
47225
|
+
"d.outcome",
|
|
47226
|
+
"d.reason",
|
|
47227
|
+
"d.omitted",
|
|
47228
|
+
eb("d.agent_id", "is not", null).as("named"),
|
|
47229
|
+
eb.exists(eb.selectFrom("delivery_unit as k").whereRef("k.delivery_id", "=", "d.id").select("k.unit_id")).as("keyed"),
|
|
47230
|
+
eb.fn.countAll().as("n")
|
|
47231
|
+
]).groupBy(["d.event", "d.outcome", "d.reason", "d.omitted", "named", "keyed"]).execute(),
|
|
47232
|
+
delivered().innerJoin("unit as u", "u.id", "du.unit_id").select((eb) => [
|
|
47233
|
+
"u.id",
|
|
47234
|
+
"u.key",
|
|
47235
|
+
"u.kind",
|
|
47236
|
+
"u.lifecycle",
|
|
47237
|
+
eb.fn.count("d.session_id").distinct().as("sessions"),
|
|
47238
|
+
eb.fn.countAll().as("deliveries")
|
|
47239
|
+
]).groupBy("u.id").orderBy("sessions", "desc").orderBy("deliveries", "desc").orderBy("u.id").limit(DELIVERY_LIMITS.records).execute(),
|
|
47240
|
+
delivered().select((eb) => eb.fn.count("du.unit_id").distinct().as("n")).executeTakeFirst(),
|
|
47241
|
+
keyed().select((eb) => ["s.id", "s.host", "s.external_id", "s.branch", eb.fn.max("d.at").as("last")]).groupBy("s.id").orderBy("last", "desc").orderBy("s.id").limit(DELIVERY_LIMITS.sessions).execute(),
|
|
47242
|
+
keyed().select((eb) => eb.fn.count("d.session_id").distinct().as("n")).executeTakeFirst()
|
|
47243
|
+
]);
|
|
47244
|
+
const via = top.length ? await delivered().where("du.unit_id", "in", top.map((t) => t.id)).select(["du.unit_id", "d.event"]).distinct().orderBy("d.event").execute() : [];
|
|
47245
|
+
const shown = await Promise.all(recent.map(async (r) => {
|
|
47246
|
+
const rows = keyed().where("d.session_id", "=", r.id);
|
|
47247
|
+
const [list, n] = await Promise.all([
|
|
47248
|
+
rows.select(["d.id", "d.at", "d.event", "d.agent_id", "d.reason", "d.path"]).orderBy("d.at").orderBy("d.id").limit(DELIVERY_LIMITS.deliveries).execute(),
|
|
47249
|
+
rows.select((eb) => eb.fn.countAll().as("n")).executeTakeFirst()
|
|
47250
|
+
]);
|
|
47251
|
+
return { session: r, list, total: Number(n?.n ?? 0) };
|
|
47252
|
+
}));
|
|
47253
|
+
const ids = shown.flatMap((s) => s.list.map((d) => d.id));
|
|
47254
|
+
const keys = ids.length ? await db.selectFrom("delivery_unit as du").innerJoin("unit as u", "u.id", "du.unit_id").where("du.delivery_id", "in", ids).select(["du.delivery_id", "u.id", "u.key"]).orderBy("du.delivery_id").orderBy("u.id").execute() : [];
|
|
47255
|
+
const byDelivery = new Map;
|
|
47256
|
+
for (const k of keys)
|
|
47257
|
+
byDelivery.set(k.delivery_id, [...byDelivery.get(k.delivery_id) ?? [], k]);
|
|
47258
|
+
const replies = () => db.selectFrom("source as m").where("m.kind", "=", "session_message").where("m.author_kind", "=", "assistant").where("m.created_at", "<", to);
|
|
47259
|
+
const holding = (keys2) => (eb) => eb.or(keys2.map((k) => eb(eb.fn("instr", ["m.text", eb.val(k)]), ">", 0)));
|
|
47260
|
+
const reply = (r) => !QUESTION2.test(r.external_id);
|
|
47261
|
+
const namedIn = new Map;
|
|
47262
|
+
for (const t of top) {
|
|
47263
|
+
const found = await replies().innerJoin(delivered().where("du.unit_id", "=", t.id).select((f) => ["d.session_id", f.fn.min("d.at").as("first")]).groupBy("d.session_id").as("f"), (j) => j.onRef("f.session_id", "=", "m.session_id")).whereRef("m.created_at", ">", "f.first").where(holding([t.key])).select(["m.session_id", "m.external_id", "m.text"]).execute();
|
|
47264
|
+
namedIn.set(t.id, new Set(found.filter((r) => reply(r) && namesKey(r.text, t.key)).map((r) => r.session_id)).size);
|
|
47265
|
+
}
|
|
47266
|
+
const later = new Map;
|
|
47267
|
+
for (const s of shown) {
|
|
47268
|
+
const wanted = [...new Set(s.list.flatMap((d) => (byDelivery.get(d.id) ?? []).map((k) => k.key)))];
|
|
47269
|
+
const since = s.list[0]?.at;
|
|
47270
|
+
if (since && wanted.length)
|
|
47271
|
+
later.set(s.session.id, (await replies().where("m.session_id", "=", s.session.id).where("m.created_at", ">", since).where(holding(wanted)).select(["m.external_id", "m.created_at", "m.text"]).execute()).filter(reply));
|
|
47272
|
+
}
|
|
47273
|
+
const counts = countTable(groups);
|
|
47274
|
+
const fixedTop = [
|
|
47275
|
+
`# Delivery log of the last ${days} day${days === 1 ? "" : "s"}`,
|
|
47276
|
+
`Period: from ${from} up to ${to} (UTC). Oldest delivery still logged for this project: ${oldest?.at ?? "none"}.`,
|
|
47277
|
+
"",
|
|
47278
|
+
"## Logged delivery rows",
|
|
47279
|
+
...counts,
|
|
47280
|
+
""
|
|
47281
|
+
];
|
|
47282
|
+
const fixedEnd = ["", "## Limits", ...DELIVERY_LIMITS_TEXT.map((l) => `- ${l}`), "", CLOSING];
|
|
47283
|
+
let room = READ_BUDGET - bytes(framed("")) - bytes(fixedTop.join(`
|
|
47284
|
+
`)) - bytes(fixedEnd.join(`
|
|
47285
|
+
`)) - MORE_LINE * (2 + shown.length) - 512;
|
|
47286
|
+
const fit = (lines) => {
|
|
47287
|
+
const b = lines.reduce((sum, l) => sum + bytes(l) + 1, 0);
|
|
47288
|
+
if (b > room)
|
|
47289
|
+
return false;
|
|
47290
|
+
room -= b;
|
|
47291
|
+
return true;
|
|
47292
|
+
};
|
|
47293
|
+
const events = new Map;
|
|
47294
|
+
for (const v of via)
|
|
47295
|
+
events.set(v.unit_id, [...events.get(v.unit_id) ?? [], v.event]);
|
|
47296
|
+
const topLines = [];
|
|
47297
|
+
for (const t of top) {
|
|
47298
|
+
const line = `- ${head(inline(t.key), DELIVERY_LIMITS.key)} (u${t.id}, ${t.kind}, ${t.lifecycle} now): ${t.sessions} session${Number(t.sessions) === 1 ? "" : "s"}, ${t.deliveries} deliver${Number(t.deliveries) === 1 ? "y" : "ies"}, via ${(events.get(t.id) ?? []).join(", ")}; named later in ${namedIn.get(t.id) ?? 0} of those sessions`;
|
|
47299
|
+
if (!fit([line]))
|
|
47300
|
+
break;
|
|
47301
|
+
topLines.push(line);
|
|
47302
|
+
}
|
|
47303
|
+
const recordsLeft = Number(units?.n ?? 0) - topLines.length;
|
|
47304
|
+
const sessionParts = [];
|
|
47305
|
+
let sessionsShown = 0;
|
|
47306
|
+
for (const s of shown) {
|
|
47307
|
+
const heading = `### ${inline(s.session.host)} session ${head(inline(s.session.external_id), DELIVERY_LIMITS.session)}${s.session.branch ? ` (branch ${head(inline(s.session.branch), DELIVERY_LIMITS.path)})` : ""}, last delivery with a record ${s.session.last}`;
|
|
47308
|
+
const replies2 = later.get(s.session.id) ?? [];
|
|
47309
|
+
const lines = s.list.map((d) => deliveryLine(d, byDelivery.get(d.id) ?? [], (key) => replies2.some((r) => r.created_at > d.at && namesKey(r.text, key))));
|
|
47310
|
+
if (!lines.length || !fit([heading, lines[0] ?? ""]))
|
|
47311
|
+
break;
|
|
47312
|
+
const part = [heading, lines[0] ?? ""];
|
|
47313
|
+
let n = 1;
|
|
47314
|
+
for (const l of lines.slice(1)) {
|
|
47315
|
+
if (!fit([l]))
|
|
47316
|
+
break;
|
|
47317
|
+
part.push(l);
|
|
47318
|
+
n++;
|
|
47319
|
+
}
|
|
47320
|
+
if (s.total > n)
|
|
47321
|
+
part.push(`(${s.total - n} more deliver${s.total - n === 1 ? "y" : "ies"} with records in this session not shown.)`);
|
|
47322
|
+
sessionParts.push(...part);
|
|
47323
|
+
sessionsShown++;
|
|
47324
|
+
}
|
|
47325
|
+
const sessionsLeft = Number(sessions?.n ?? 0) - sessionsShown;
|
|
47326
|
+
return [
|
|
47327
|
+
...fixedTop,
|
|
47328
|
+
"## Records delivered most",
|
|
47329
|
+
...topLines.length ? topLines : ["No record was delivered in this period."],
|
|
47330
|
+
...recordsLeft > 0 ? [`(${recordsLeft} more delivered record${recordsLeft === 1 ? "" : "s"} not shown.)`] : [],
|
|
47331
|
+
"",
|
|
47332
|
+
"## Example sessions, the most recent first",
|
|
47333
|
+
...sessionParts.length ? sessionParts : ["No session was delivered a record in this period."],
|
|
47334
|
+
...sessionsLeft > 0 ? [
|
|
47335
|
+
`(${sessionsLeft} more session${sessionsLeft === 1 ? "" : "s"} delivered records in this period, not shown.)`
|
|
47336
|
+
] : [],
|
|
47337
|
+
...fixedEnd
|
|
47338
|
+
].join(`
|
|
47339
|
+
`);
|
|
47340
|
+
}
|
|
47341
|
+
function countTable(groups) {
|
|
47342
|
+
const rows = new Map;
|
|
47343
|
+
for (const g of groups) {
|
|
47344
|
+
const id = `${g.event}\x00${g.outcome}`;
|
|
47345
|
+
const row = rows.get(id) ?? { by: new Map, keyless: 0, left: 0 };
|
|
47346
|
+
const w = who(Boolean(Number(g.named)), g.event, g.reason);
|
|
47347
|
+
const n = Number(g.n);
|
|
47348
|
+
row.by.set(w, (row.by.get(w) ?? 0) + n);
|
|
47349
|
+
if (g.outcome === "emitted" && !Number(g.keyed))
|
|
47350
|
+
row.keyless += n;
|
|
47351
|
+
row.left += Number(g.omitted) * n;
|
|
47352
|
+
rows.set(id, row);
|
|
47353
|
+
}
|
|
47354
|
+
if (!rows.size)
|
|
47355
|
+
return ["No delivery was logged for this project in this period."];
|
|
47356
|
+
return [
|
|
47357
|
+
`| event | outcome | ${WHO.join(" | ")} | emitted rows with no logged record key | left out |`,
|
|
47358
|
+
`|${" --- |".repeat(WHO.length + 4)}`,
|
|
47359
|
+
...[...rows.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([id, r]) => {
|
|
47360
|
+
const [event, outcome] = id.split("\x00");
|
|
47361
|
+
return `| ${event} | ${outcome} | ${WHO.map((w) => r.by.get(w) ?? 0).join(" | ")} | ${outcome === "emitted" ? r.keyless : "-"} | ${r.left} |`;
|
|
47362
|
+
}),
|
|
47363
|
+
"left out: the sum of the counts each row logged of what applied but was not shown; a session start also counts work items."
|
|
47364
|
+
];
|
|
47365
|
+
}
|
|
47366
|
+
function deliveryLine(d, units, namedLater) {
|
|
47367
|
+
const w = who(d.agent_id !== null, d.event, d.reason);
|
|
47368
|
+
const agent = w === "subagent" && d.agent_id ? ` ${head(inline(d.agent_id), DELIVERY_LIMITS.agent)}` : "";
|
|
47369
|
+
const named = units.slice(0, DELIVERY_LIMITS.keys).map((u) => `${head(inline(u.key), DELIVERY_LIMITS.key)} (u${u.id}${namedLater(u.key) ? ", named later" : ""})`).join(", ");
|
|
47370
|
+
const more = units.length > DELIVERY_LIMITS.keys ? ` (+${units.length - DELIVERY_LIMITS.keys} more)` : "";
|
|
47371
|
+
return `- ${d.at} ${d.event}, ${w}${agent}${d.path ? ` ${head(inline(d.path), DELIVERY_LIMITS.path)}` : ""}: ${named}${more}`;
|
|
47372
|
+
}
|
|
47373
|
+
|
|
47173
47374
|
// server/src/export.ts
|
|
47375
|
+
import fs5 from "node:fs";
|
|
47376
|
+
import path5 from "node:path";
|
|
47174
47377
|
var EXPORT_LIMITS = { records: 50, depth: 20, bytes: 60 * 1024 };
|
|
47175
47378
|
async function chosen(db, projectId, ref) {
|
|
47176
47379
|
const byId = /^u([1-9][0-9]{0,15})$/.exec(ref);
|
|
@@ -48339,15 +48542,20 @@ server.registerTool("fields", {
|
|
|
48339
48542
|
var DIFF = exports_external.string().min(1).max(2000000).describe("The change under review as a unified diff (git diff output)");
|
|
48340
48543
|
var notChecked = (e) => text2(`Decision lane: not checked. Sphica unavailable: ${head(reason(e), 300)}. Report the decision check as not run, not as passed.`, true);
|
|
48341
48544
|
server.registerTool("overview", {
|
|
48342
|
-
title: "Live decisions,
|
|
48343
|
-
description: "On request, not before every change. view live lists every active decision and constraint of the project, grouped by the directory it " + "applies to, a page at a time (pass after from the previous page). view look lists live records whose code file is gone or whose symbol " + "is not found, written conditions for reconsidering an option (for you to judge, never applied), and lines in CLAUDE.md, AGENTS.md, or " + ".claude/rules marked <!-- sphica: key --> whose record was replaced or withdrawn, a page at a time until one says Complete (pass the after it gives). " + "Read a record by its key before relying on it.",
|
|
48545
|
+
title: "Live decisions, records that need a look, and what Sphica showed",
|
|
48546
|
+
description: "On request, not before every change. view live lists every active decision and constraint of the project, grouped by the directory it " + "applies to, a page at a time (pass after from the previous page). view look lists live records whose code file is gone or whose symbol " + "is not found, written conditions for reconsidering an option (for you to judge, never applied), and lines in CLAUDE.md, AGENTS.md, or " + ".claude/rules marked <!-- sphica: key --> whose record was replaced or withdrawn, a page at a time until one says Complete (pass the after it gives). " + "view delivery shows what Sphica's hooks showed the agent over the last days (default 7): logged rows by event, the records delivered most, " + "and example sessions; use it when the user asks what Sphica has been showing. " + "Read a record by its key before relying on it.",
|
|
48344
48547
|
inputSchema: exports_external.object({
|
|
48345
|
-
view: exports_external.enum(["live", "look"]).describe("live: every active decision and constraint; look: records that need a look"),
|
|
48548
|
+
view: exports_external.enum(["live", "look", "delivery"]).describe("live: every active decision and constraint; look: records that need a look; delivery: what the hooks showed the agent"),
|
|
48346
48549
|
after: exports_external.union([exports_external.number().int().min(0), exports_external.string().min(1).max(8192)]).optional().describe("With live: the id the previous page said to continue after. With look: the cursor the previous page gave, as it is"),
|
|
48550
|
+
days: exports_external.number().int().min(DELIVERY_DAYS.min).max(DELIVERY_DAYS.max).optional().describe(`With delivery: how many days back to look, ending now (default ${DELIVERY_DAYS.default})`),
|
|
48347
48551
|
cwd: CWD
|
|
48348
48552
|
}).strict(),
|
|
48349
48553
|
annotations: READ_ONLY
|
|
48350
48554
|
}, async (a, extra) => {
|
|
48555
|
+
if (a.view !== "delivery" && a.days !== undefined)
|
|
48556
|
+
return text2("days: only with view delivery", true);
|
|
48557
|
+
if (a.view === "delivery" && a.after !== undefined)
|
|
48558
|
+
return text2("after: not with view delivery, which is one page", true);
|
|
48351
48559
|
if (a.view === "live" && typeof a.after === "string")
|
|
48352
48560
|
return text2("after: with view live, pass the id the previous page gave", true);
|
|
48353
48561
|
if (a.view === "look" && typeof a.after === "number")
|
|
@@ -48358,7 +48566,7 @@ server.registerTool("overview", {
|
|
|
48358
48566
|
const p = await projectOf(a.cwd, extra._meta);
|
|
48359
48567
|
if (typeof p === "string")
|
|
48360
48568
|
return text2(p);
|
|
48361
|
-
return text2(framed(typeof a.after === "string" || a.view === "look" ? await lookOverview(db, p.id, p.root, typeof a.after === "string" ? a.after : undefined) : await liveOverview(db, p.id, a.after ?? null)));
|
|
48569
|
+
return text2(framed(a.view === "delivery" ? await deliveryOverview(db, p.id, a.days ?? DELIVERY_DAYS.default) : typeof a.after === "string" || a.view === "look" ? await lookOverview(db, p.id, p.root, typeof a.after === "string" ? a.after : undefined) : await liveOverview(db, p.id, a.after ?? null)));
|
|
48362
48570
|
} catch (e) {
|
|
48363
48571
|
return text2(`Sphica unavailable: ${head(reason(e), 300)}`, true);
|
|
48364
48572
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sphica",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.40",
|
|
4
4
|
"description": "Records Claude Code and Codex sessions on your machine and keeps past implementation and decisions, with their sources, for your agent to find.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|