sphica 0.6.56 → 0.6.57
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/0013.sql +61 -0
- package/db/schema.sql +33 -2
- package/dist/capture.js +3 -1
- package/dist/cli.js +5 -2
- package/dist/deliver.js +3 -1
- package/dist/mcp-record.js +15 -7
- package/dist/mcp.js +4 -7
- 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.57",
|
|
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",
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
-- Copyright (c) 2026 iroha924 and contributors
|
|
2
|
+
-- SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
-- Revision 12 → 13 of generation 2: a withdrawal an answer caused keeps the record that answered (unit_answer). Earlier withdrawals name
|
|
5
|
+
-- the answer only in their reason, so each is copied when exactly one record its run saved has the key the reason names; the others are
|
|
6
|
+
-- listed and left without a row. Every statement that stays is the same as in the schema at revision 13.
|
|
7
|
+
|
|
8
|
+
create temp table sphica_migration_note (rule text, item text, action text);
|
|
9
|
+
|
|
10
|
+
create table unit_answer (
|
|
11
|
+
state_id integer primary key not null references unit_state (id) on delete cascade,
|
|
12
|
+
answer_unit integer not null references unit (id) on delete cascade
|
|
13
|
+
) strict;
|
|
14
|
+
create index unit_answer_unit on unit_answer (answer_unit);
|
|
15
|
+
create trigger unit_answer_check before insert on unit_answer begin
|
|
16
|
+
select raise(abort, 'an answer is written for the withdrawal of a question')
|
|
17
|
+
where not exists (select 1 from unit_state t join unit q on q.id = t.unit_id
|
|
18
|
+
where t.id = new.state_id and t.to_state = 'withdrawn' and q.kind = 'question');
|
|
19
|
+
select raise(abort, 'a question does not answer another')
|
|
20
|
+
where (select kind from unit where id = new.answer_unit) is 'question';
|
|
21
|
+
select raise(abort, 'answer and question belong to different projects')
|
|
22
|
+
where (select project_id from unit where id = new.answer_unit)
|
|
23
|
+
is not (select q.project_id from unit_state t join unit q on q.id = t.unit_id where t.id = new.state_id);
|
|
24
|
+
select raise(abort, 'a question is closed by a record the withdrawal''s own run saved')
|
|
25
|
+
where (select run_id from unit where id = new.answer_unit) is not (select run_id from unit_state where id = new.state_id);
|
|
26
|
+
end;
|
|
27
|
+
create trigger unit_answer_frozen before update on unit_answer begin
|
|
28
|
+
select raise(abort, 'an answer is never changed');
|
|
29
|
+
end;
|
|
30
|
+
create trigger unit_answer_no_delete before delete on unit_answer
|
|
31
|
+
when exists (select 1 from unit_state where id = old.state_id) and exists (select 1 from unit where id = old.answer_unit) begin
|
|
32
|
+
select raise(abort, 'an answer goes only with its withdrawal or its record');
|
|
33
|
+
end;
|
|
34
|
+
-- Made before the copy below, so each copied row raises the revision of its question and of its answer as a saved one does
|
|
35
|
+
create trigger unit_rev_answer_i after insert on unit_answer begin
|
|
36
|
+
update unit set revision = revision + 1
|
|
37
|
+
where id in (new.answer_unit, (select unit_id from unit_state where id = new.state_id));
|
|
38
|
+
end;
|
|
39
|
+
|
|
40
|
+
-- The reason is compared with whole keys, not cut at a separator: a key's own characters cannot end it early. substr, not like, since
|
|
41
|
+
-- a key's _ would match any character there. Only pairs the insert trigger accepts are picked, so the copy never stops the migration
|
|
42
|
+
insert into unit_answer (state_id, answer_unit)
|
|
43
|
+
select t.id, min(a.id)
|
|
44
|
+
from unit_state t
|
|
45
|
+
join unit q on q.id = t.unit_id
|
|
46
|
+
join unit a on a.project_id = q.project_id and a.run_id = t.run_id and a.kind <> 'question'
|
|
47
|
+
and (t.reason = 'answered by ' || a.key
|
|
48
|
+
or substr(t.reason, 1, length('answered by ' || a.key || ' (through ')) = 'answered by ' || a.key || ' (through ')
|
|
49
|
+
where t.to_state = 'withdrawn' and q.kind = 'question'
|
|
50
|
+
group by t.id
|
|
51
|
+
having count(*) = 1;
|
|
52
|
+
|
|
53
|
+
insert into sphica_migration_note
|
|
54
|
+
select 'a withdrawal whose reason names an answer, with no single record of its save to match', q.key || ' (state ' || t.id || ')',
|
|
55
|
+
'left without its answer; a timeline of the answering record does not tell this withdrawal'
|
|
56
|
+
from unit_state t join unit q on q.id = t.unit_id
|
|
57
|
+
where t.to_state = 'withdrawn' and substr(t.reason, 1, 12) = 'answered by '
|
|
58
|
+
and not exists (select 1 from unit_answer w where w.state_id = t.id)
|
|
59
|
+
order by t.id;
|
|
60
|
+
|
|
61
|
+
pragma user_version = 13;
|
package/db/schema.sql
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
-- Four boundaries:
|
|
9
9
|
-- captured sources session, source, artifact_link, edit_observation: what was said or written, never rewritten
|
|
10
10
|
-- (the owner can forget chosen sources: forget_batch and source_forgotten keep what was removed, without its text)
|
|
11
|
-
-- extracted units unit and its option, evidence, adoption, link, state, anchor, alias tables: what was decided or implemented
|
|
11
|
+
-- extracted units unit and its option, evidence, adoption, link, state, answer, anchor, alias tables: what was decided or implemented
|
|
12
12
|
-- processing extraction_run, source_processing, harvest_run_source: what has been looked at and saved, so gaps are counted
|
|
13
13
|
-- work and delivery work, delivery, delivery_unit: the current work status and what the hooks injected
|
|
14
14
|
-- Every table is STRICT and every primary key is not null. Times are ISO 8601 UTC (`Date#toISOString()`); `strftime(...) is column` rejects others.
|
|
@@ -660,6 +660,33 @@ create trigger unit_state_apply after insert on unit_state begin
|
|
|
660
660
|
update unit set lifecycle = new.to_state, revision = revision + 1 where id = new.unit_id;
|
|
661
661
|
end;
|
|
662
662
|
|
|
663
|
+
-- Why a question was withdrawn: the record whose answer closed it, written with the withdrawal's state row. A withdrawal the owner
|
|
664
|
+
-- asked for has no row. The answering record is one the withdrawal's own run saved, so a save closes questions only with what it wrote.
|
|
665
|
+
create table unit_answer (
|
|
666
|
+
state_id integer primary key not null references unit_state (id) on delete cascade,
|
|
667
|
+
answer_unit integer not null references unit (id) on delete cascade
|
|
668
|
+
) strict;
|
|
669
|
+
create index unit_answer_unit on unit_answer (answer_unit);
|
|
670
|
+
create trigger unit_answer_check before insert on unit_answer begin
|
|
671
|
+
select raise(abort, 'an answer is written for the withdrawal of a question')
|
|
672
|
+
where not exists (select 1 from unit_state t join unit q on q.id = t.unit_id
|
|
673
|
+
where t.id = new.state_id and t.to_state = 'withdrawn' and q.kind = 'question');
|
|
674
|
+
select raise(abort, 'a question does not answer another')
|
|
675
|
+
where (select kind from unit where id = new.answer_unit) is 'question';
|
|
676
|
+
select raise(abort, 'answer and question belong to different projects')
|
|
677
|
+
where (select project_id from unit where id = new.answer_unit)
|
|
678
|
+
is not (select q.project_id from unit_state t join unit q on q.id = t.unit_id where t.id = new.state_id);
|
|
679
|
+
select raise(abort, 'a question is closed by a record the withdrawal''s own run saved')
|
|
680
|
+
where (select run_id from unit where id = new.answer_unit) is not (select run_id from unit_state where id = new.state_id);
|
|
681
|
+
end;
|
|
682
|
+
create trigger unit_answer_frozen before update on unit_answer begin
|
|
683
|
+
select raise(abort, 'an answer is never changed');
|
|
684
|
+
end;
|
|
685
|
+
create trigger unit_answer_no_delete before delete on unit_answer
|
|
686
|
+
when exists (select 1 from unit_state where id = old.state_id) and exists (select 1 from unit where id = old.answer_unit) begin
|
|
687
|
+
select raise(abort, 'an answer goes only with its withdrawal or its record');
|
|
688
|
+
end;
|
|
689
|
+
|
|
663
690
|
-- Where a unit applies in code, or code cited as evidence. Validated against the working tree when served, never cached here.
|
|
664
691
|
create table unit_anchor (
|
|
665
692
|
id integer primary key autoincrement not null,
|
|
@@ -1052,6 +1079,10 @@ end;
|
|
|
1052
1079
|
create trigger unit_rev_link_u after update on unit_link begin
|
|
1053
1080
|
update unit set revision = revision + 1 where id in (new.from_unit, new.to_unit);
|
|
1054
1081
|
end;
|
|
1082
|
+
create trigger unit_rev_answer_i after insert on unit_answer begin
|
|
1083
|
+
update unit set revision = revision + 1
|
|
1084
|
+
where id in (new.answer_unit, (select unit_id from unit_state where id = new.state_id));
|
|
1085
|
+
end;
|
|
1055
1086
|
create trigger unit_rev_anchor_i after insert on unit_anchor begin update unit set revision = revision + 1 where id = new.unit_id; end;
|
|
1056
1087
|
create trigger unit_rev_anchor_u after update on unit_anchor begin update unit set revision = revision + 1 where id = new.unit_id; end;
|
|
1057
1088
|
create trigger unit_rev_retirement_i after insert on unit_anchor_retirement begin
|
|
@@ -1270,4 +1301,4 @@ create trigger capture_delivery_prune_insert instead of insert on capture_delive
|
|
|
1270
1301
|
order by d.at, d.id limit 200);
|
|
1271
1302
|
end;
|
|
1272
1303
|
|
|
1273
|
-
pragma user_version =
|
|
1304
|
+
pragma user_version = 13;
|
package/dist/capture.js
CHANGED
|
@@ -11587,7 +11587,7 @@ var HOST_MARKS = new Set([".orphaned_at", ".in_use"]);
|
|
|
11587
11587
|
|
|
11588
11588
|
// server/src/sqlite.ts
|
|
11589
11589
|
var SCHEMA_GENERATION = 2;
|
|
11590
|
-
var SCHEMA_REVISION =
|
|
11590
|
+
var SCHEMA_REVISION = 13;
|
|
11591
11591
|
var sphicaHome = () => process.env.SPHICA_HOME || path4.join(os2.homedir(), ".sphica");
|
|
11592
11592
|
var dbFile = () => process.env.SPHICA_DB || path4.join(sphicaHome(), "sphica.db");
|
|
11593
11593
|
function requireRuntime() {
|
|
@@ -11795,6 +11795,7 @@ var INGEST_INSERTS = new Set([
|
|
|
11795
11795
|
"unit_adoption",
|
|
11796
11796
|
"unit_link",
|
|
11797
11797
|
"unit_state",
|
|
11798
|
+
"unit_answer",
|
|
11798
11799
|
"unit_replacement",
|
|
11799
11800
|
"unit_anchor",
|
|
11800
11801
|
"unit_anchor_retirement",
|
|
@@ -11836,6 +11837,7 @@ var INGEST_TRIGGER_WRITES = {
|
|
|
11836
11837
|
"adoption_d",
|
|
11837
11838
|
"link_i",
|
|
11838
11839
|
"link_u",
|
|
11840
|
+
"answer_i",
|
|
11839
11841
|
"replacement_i",
|
|
11840
11842
|
"replacement_u",
|
|
11841
11843
|
"anchor_i",
|
package/dist/cli.js
CHANGED
|
@@ -5082,7 +5082,7 @@ ${indent}${caution(note)}` : ""}`);
|
|
|
5082
5082
|
|
|
5083
5083
|
// server/src/sqlite.ts
|
|
5084
5084
|
var SCHEMA_GENERATION = 2;
|
|
5085
|
-
var SCHEMA_REVISION =
|
|
5085
|
+
var SCHEMA_REVISION = 13;
|
|
5086
5086
|
var sphicaHome = () => process.env.SPHICA_HOME || path4.join(os3.homedir(), ".sphica");
|
|
5087
5087
|
var dbFile = () => process.env.SPHICA_DB || path4.join(sphicaHome(), "sphica.db");
|
|
5088
5088
|
function requireRuntime() {
|
|
@@ -16175,6 +16175,7 @@ var INGEST_INSERTS = new Set([
|
|
|
16175
16175
|
"unit_adoption",
|
|
16176
16176
|
"unit_link",
|
|
16177
16177
|
"unit_state",
|
|
16178
|
+
"unit_answer",
|
|
16178
16179
|
"unit_replacement",
|
|
16179
16180
|
"unit_anchor",
|
|
16180
16181
|
"unit_anchor_retirement",
|
|
@@ -16216,6 +16217,7 @@ var INGEST_TRIGGER_WRITES = {
|
|
|
16216
16217
|
"adoption_d",
|
|
16217
16218
|
"link_i",
|
|
16218
16219
|
"link_u",
|
|
16220
|
+
"answer_i",
|
|
16219
16221
|
"replacement_i",
|
|
16220
16222
|
"replacement_u",
|
|
16221
16223
|
"anchor_i",
|
|
@@ -17900,7 +17902,8 @@ function planOf(rows, asked) {
|
|
|
17900
17902
|
const gone = ended.get(t2.unit);
|
|
17901
17903
|
const reason2 = t2.from === null ? "first judged" : t2.to === "withdrawn" ? withdraw.get(t2.unit)?.reason ?? "withdrawn" : t2.to === "superseded" ? `superseded by ${keys.get(holder)}` : t2.from === "superseded" ? `${gone !== undefined ? keys.get(gone) : "its successor"} no longer replaces it` : t2.to === "active" ? hint?.reason ?? "support complete" : `${asked.because ?? "support lost"}: ${waitText(judged, t2.unit, loaded, intentOf.get(t2.unit))}`;
|
|
17902
17904
|
const source = t2.to === "withdrawn" ? withdraw.get(t2.unit)?.source ?? null : t2.to === "superseded" ? asked.hints?.get(holder)?.source ?? null : hint?.source ?? null;
|
|
17903
|
-
|
|
17905
|
+
const answer = t2.to === "withdrawn" ? withdraw.get(t2.unit)?.answer ?? null : null;
|
|
17906
|
+
writes2.push({ op: "state", unit: t2.unit, from: t2.from, to: t2.to, reason: reason2, source, answer });
|
|
17904
17907
|
}
|
|
17905
17908
|
return { judged, loaded, writes: writes2, redundant, intentOf };
|
|
17906
17909
|
}
|
package/dist/deliver.js
CHANGED
|
@@ -11650,7 +11650,7 @@ var HOST_MARKS = new Set([".orphaned_at", ".in_use"]);
|
|
|
11650
11650
|
|
|
11651
11651
|
// server/src/sqlite.ts
|
|
11652
11652
|
var SCHEMA_GENERATION = 2;
|
|
11653
|
-
var SCHEMA_REVISION =
|
|
11653
|
+
var SCHEMA_REVISION = 13;
|
|
11654
11654
|
var sphicaHome = () => process.env.SPHICA_HOME || path5.join(os2.homedir(), ".sphica");
|
|
11655
11655
|
var dbFile = () => process.env.SPHICA_DB || path5.join(sphicaHome(), "sphica.db");
|
|
11656
11656
|
function requireRuntime() {
|
|
@@ -11893,6 +11893,7 @@ var INGEST_INSERTS = new Set([
|
|
|
11893
11893
|
"unit_adoption",
|
|
11894
11894
|
"unit_link",
|
|
11895
11895
|
"unit_state",
|
|
11896
|
+
"unit_answer",
|
|
11896
11897
|
"unit_replacement",
|
|
11897
11898
|
"unit_anchor",
|
|
11898
11899
|
"unit_anchor_retirement",
|
|
@@ -11934,6 +11935,7 @@ var INGEST_TRIGGER_WRITES = {
|
|
|
11934
11935
|
"adoption_d",
|
|
11935
11936
|
"link_i",
|
|
11936
11937
|
"link_u",
|
|
11938
|
+
"answer_i",
|
|
11937
11939
|
"replacement_i",
|
|
11938
11940
|
"replacement_u",
|
|
11939
11941
|
"anchor_i",
|
package/dist/mcp-record.js
CHANGED
|
@@ -46365,7 +46365,7 @@ var HOST_MARKS = new Set([".orphaned_at", ".in_use"]);
|
|
|
46365
46365
|
|
|
46366
46366
|
// server/src/sqlite.ts
|
|
46367
46367
|
var SCHEMA_GENERATION = 2;
|
|
46368
|
-
var SCHEMA_REVISION =
|
|
46368
|
+
var SCHEMA_REVISION = 13;
|
|
46369
46369
|
var sphicaHome = () => process.env.SPHICA_HOME || path3.join(os2.homedir(), ".sphica");
|
|
46370
46370
|
var dbFile = () => process.env.SPHICA_DB || path3.join(sphicaHome(), "sphica.db");
|
|
46371
46371
|
function requireRuntime() {
|
|
@@ -46587,6 +46587,7 @@ var INGEST_INSERTS = new Set([
|
|
|
46587
46587
|
"unit_adoption",
|
|
46588
46588
|
"unit_link",
|
|
46589
46589
|
"unit_state",
|
|
46590
|
+
"unit_answer",
|
|
46590
46591
|
"unit_replacement",
|
|
46591
46592
|
"unit_anchor",
|
|
46592
46593
|
"unit_anchor_retirement",
|
|
@@ -46628,6 +46629,7 @@ var INGEST_TRIGGER_WRITES = {
|
|
|
46628
46629
|
"adoption_d",
|
|
46629
46630
|
"link_i",
|
|
46630
46631
|
"link_u",
|
|
46632
|
+
"answer_i",
|
|
46631
46633
|
"replacement_i",
|
|
46632
46634
|
"replacement_u",
|
|
46633
46635
|
"anchor_i",
|
|
@@ -48641,7 +48643,8 @@ function planOf(rows, asked) {
|
|
|
48641
48643
|
const gone = ended.get(t.unit);
|
|
48642
48644
|
const reason2 = t.from === null ? "first judged" : t.to === "withdrawn" ? withdraw.get(t.unit)?.reason ?? "withdrawn" : t.to === "superseded" ? `superseded by ${keys.get(holder)}` : t.from === "superseded" ? `${gone !== undefined ? keys.get(gone) : "its successor"} no longer replaces it` : t.to === "active" ? hint?.reason ?? "support complete" : `${asked.because ?? "support lost"}: ${waitText(judged, t.unit, loaded, intentOf.get(t.unit))}`;
|
|
48643
48645
|
const source = t.to === "withdrawn" ? withdraw.get(t.unit)?.source ?? null : t.to === "superseded" ? asked.hints?.get(holder)?.source ?? null : hint?.source ?? null;
|
|
48644
|
-
|
|
48646
|
+
const answer = t.to === "withdrawn" ? withdraw.get(t.unit)?.answer ?? null : null;
|
|
48647
|
+
writes2.push({ op: "state", unit: t.unit, from: t.from, to: t.to, reason: reason2, source, answer });
|
|
48645
48648
|
}
|
|
48646
48649
|
return { judged, loaded, writes: writes2, redundant, intentOf };
|
|
48647
48650
|
}
|
|
@@ -48724,8 +48727,8 @@ async function reconcile(trx, seeds, cause, asked = {}) {
|
|
|
48724
48727
|
await trx.updateTable("unit_replacement").set({ ended_at: sql`max(${at}, started_at)`, end_reason: w.reason, ...endBy }).where("from_unit", "=", w.from).where("to_unit", "=", w.to).where("ended_at", "is", null).execute();
|
|
48725
48728
|
else if (w.op === "open")
|
|
48726
48729
|
await trx.insertInto("unit_replacement").values({ from_unit: w.from, to_unit: w.to, ...by, started_at: at }).execute();
|
|
48727
|
-
else
|
|
48728
|
-
await trx.insertInto("unit_state").values({
|
|
48730
|
+
else {
|
|
48731
|
+
const state = await trx.insertInto("unit_state").values({
|
|
48729
48732
|
unit_id: w.unit,
|
|
48730
48733
|
from_state: w.from,
|
|
48731
48734
|
to_state: w.to,
|
|
@@ -48733,7 +48736,10 @@ async function reconcile(trx, seeds, cause, asked = {}) {
|
|
|
48733
48736
|
reason: w.reason,
|
|
48734
48737
|
source_id: w.source,
|
|
48735
48738
|
...by
|
|
48736
|
-
}).
|
|
48739
|
+
}).returning("id").executeTakeFirstOrThrow();
|
|
48740
|
+
if (w.answer !== null)
|
|
48741
|
+
await trx.insertInto("unit_answer").values({ state_id: state.id, answer_unit: w.answer }).execute();
|
|
48742
|
+
}
|
|
48737
48743
|
}
|
|
48738
48744
|
proveSettled(await rowsOf(trx, ids));
|
|
48739
48745
|
return settled(planned);
|
|
@@ -49482,6 +49488,7 @@ async function closeAnswered(trx, runId, units, saved) {
|
|
|
49482
49488
|
const questions = new Map((await trx.selectFrom("unit").select(["id", "key", "lifecycle"]).where("id", "in", [...new Set(answering.flatMap((p) => p.answers))]).execute()).map((q) => [q.id, q]));
|
|
49483
49489
|
const withdraw = new Map;
|
|
49484
49490
|
const by = new Map;
|
|
49491
|
+
const written = new Map(saved.written.map((w) => [w.key, w.id]));
|
|
49485
49492
|
const root = new Map;
|
|
49486
49493
|
const left = new Map;
|
|
49487
49494
|
for (const p of answering) {
|
|
@@ -49495,7 +49502,7 @@ async function closeAnswered(trx, runId, units, saved) {
|
|
|
49495
49502
|
else if (why !== null || p.grounds === null)
|
|
49496
49503
|
left.set(id, left.get(id) ?? `${q.key}: left open: ${why}`);
|
|
49497
49504
|
else {
|
|
49498
|
-
withdraw.set(id, { reason: `answered by ${p.key}`, source: p.grounds });
|
|
49505
|
+
withdraw.set(id, { reason: `answered by ${p.key}`, source: p.grounds, answer: written.get(p.key) });
|
|
49499
49506
|
by.set(id, p.key);
|
|
49500
49507
|
root.set(id, id);
|
|
49501
49508
|
}
|
|
@@ -49520,7 +49527,8 @@ async function closeAnswered(trx, runId, units, saved) {
|
|
|
49520
49527
|
const answer = by.get(l.from_unit);
|
|
49521
49528
|
next.set(l.to_unit, {
|
|
49522
49529
|
reason: `answered by ${answer} (through ${settled2.keys.get(l.from_unit)})`,
|
|
49523
|
-
source: from.source
|
|
49530
|
+
source: from.source,
|
|
49531
|
+
answer: from.answer
|
|
49524
49532
|
});
|
|
49525
49533
|
by.set(l.to_unit, answer);
|
|
49526
49534
|
through.set(l.to_unit, settled2.keys.get(l.from_unit) ?? `u${l.from_unit}`);
|
package/dist/mcp.js
CHANGED
|
@@ -46269,7 +46269,7 @@ var HOST_MARKS = new Set([".orphaned_at", ".in_use"]);
|
|
|
46269
46269
|
|
|
46270
46270
|
// server/src/sqlite.ts
|
|
46271
46271
|
var SCHEMA_GENERATION = 2;
|
|
46272
|
-
var SCHEMA_REVISION =
|
|
46272
|
+
var SCHEMA_REVISION = 13;
|
|
46273
46273
|
var sphicaHome = () => process.env.SPHICA_HOME || path3.join(os2.homedir(), ".sphica");
|
|
46274
46274
|
var dbFile = () => process.env.SPHICA_DB || path3.join(sphicaHome(), "sphica.db");
|
|
46275
46275
|
function requireRuntime() {
|
|
@@ -48993,7 +48993,7 @@ async function linesOf(db, projectId2, entry) {
|
|
|
48993
48993
|
const units = await db.selectFrom("unit").select(["id", "key", "kind", "stance", "text", "why", "created_at", "run_id"]).where("project_id", "=", projectId2).where("id", "in", ids).execute();
|
|
48994
48994
|
const unit = new Map(units.map((u) => [u.id, u]));
|
|
48995
48995
|
const runs = [...new Set(units.map((u) => u.run_id))];
|
|
48996
|
-
const [intents, rows, gaps, states, evidence, adoption, anchors, conflicts, sameRun,
|
|
48996
|
+
const [intents, rows, gaps, states, evidence, adoption, anchors, conflicts, sameRun, answered] = await Promise.all([
|
|
48997
48997
|
db.selectFrom("unit_link").select(["from_unit", "to_unit", "added_at"]).where("kind", "=", "supersedes").where("from_unit", "in", ids).where("to_unit", "in", ids).execute(),
|
|
48998
48998
|
db.selectFrom("unit_replacement").select(["id", "from_unit", "to_unit", "started_at", "ended_at", "end_reason"]).where("from_unit", "in", ids).where("to_unit", "in", ids).execute(),
|
|
48999
48999
|
db.selectFrom("unit_replacement_gap").select(["from_unit", "to_unit"]).where("from_unit", "in", ids).where("to_unit", "in", ids).execute(),
|
|
@@ -49046,10 +49046,7 @@ async function linesOf(db, projectId2, entry) {
|
|
|
49046
49046
|
"b.key as to_key"
|
|
49047
49047
|
]).where("l.kind", "=", "conflicts").where((eb) => eb.or([eb("l.from_unit", "in", ids), eb("l.to_unit", "in", ids)])).execute(),
|
|
49048
49048
|
db.selectFrom("unit").select(["id", "key", "kind", "text", "created_at"]).where("project_id", "=", projectId2).where("extraction", "=", "supported").where("kind", "in", ["finding", "dead_end", "question"]).where("run_id", "in", runs).where("id", "not in", ids).orderBy("created_at", "desc").orderBy("id", "desc").limit(RELATED_READ + 1).execute(),
|
|
49049
|
-
db.selectFrom("unit_state as t").innerJoin("unit as o", "o.id", "t.unit_id").select(["t.id", "t.at", "t.to_state", "t.reason", "o.id as unit", "o.key"]).where("o.project_id", "=", projectId2).where("
|
|
49050
|
-
eb("o.run_id", "<>", eb.ref("t.run_id")),
|
|
49051
|
-
eb("t.to_state", "in", ["superseded", "withdrawn"])
|
|
49052
|
-
])).execute()
|
|
49049
|
+
db.selectFrom("unit_answer as w").innerJoin("unit_state as t", "t.id", "w.state_id").innerJoin("unit as o", "o.id", "t.unit_id").select(["t.id", "t.at", "t.to_state", "t.reason", "o.id as unit", "o.key"]).where("o.project_id", "=", projectId2).where("w.answer_unit", "in", ids).where("o.id", "not in", ids).execute()
|
|
49053
49050
|
]);
|
|
49054
49051
|
const everyPlace = [
|
|
49055
49052
|
...new Map(anchors.filter((a) => a.retired_at === null).sort((a, b) => a.id - b.id).map((a) => [JSON.stringify([a.path, a.symbol]), a])).values()
|
|
@@ -49223,7 +49220,7 @@ async function linesOf(db, projectId2, entry) {
|
|
|
49223
49220
|
text: `${pair}: resolved, ${cut2(c.resolution)}`
|
|
49224
49221
|
});
|
|
49225
49222
|
}
|
|
49226
|
-
for (const o of
|
|
49223
|
+
for (const o of answered)
|
|
49227
49224
|
lines2.push({
|
|
49228
49225
|
at: o.at,
|
|
49229
49226
|
order: ORDER.state,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sphica",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.57",
|
|
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",
|