watashi-db 0.0.5
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/LICENSE +21 -0
- package/README.md +239 -0
- package/cowork-plugin/.claude-plugin/plugin.json +12 -0
- package/cowork-plugin/.mcp.json +8 -0
- package/cowork-plugin/agents/memory-keeper.md +48 -0
- package/cowork-plugin/skills/reflect/SKILL.md +58 -0
- package/cowork-plugin/skills/remember/SKILL.md +54 -0
- package/cowork-plugin/skills/session-start/SKILL.md +38 -0
- package/dist/constants.d.ts +9 -0
- package/dist/constants.js +43 -0
- package/dist/constants.js.map +1 -0
- package/dist/database/connection.d.ts +16 -0
- package/dist/database/connection.js +42 -0
- package/dist/database/connection.js.map +1 -0
- package/dist/database/queries.d.ts +227 -0
- package/dist/database/queries.js +730 -0
- package/dist/database/queries.js.map +1 -0
- package/dist/database/schema.d.ts +6 -0
- package/dist/database/schema.js +335 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/bootstrap-prompts.d.ts +6 -0
- package/dist/prompts/bootstrap-prompts.js +69 -0
- package/dist/prompts/bootstrap-prompts.js.map +1 -0
- package/dist/provenance.d.ts +29 -0
- package/dist/provenance.js +33 -0
- package/dist/provenance.js.map +1 -0
- package/dist/resources/context-resources.d.ts +6 -0
- package/dist/resources/context-resources.js +102 -0
- package/dist/resources/context-resources.js.map +1 -0
- package/dist/tools/claim-tools.d.ts +6 -0
- package/dist/tools/claim-tools.js +176 -0
- package/dist/tools/claim-tools.js.map +1 -0
- package/dist/tools/decision-tools.d.ts +6 -0
- package/dist/tools/decision-tools.js +117 -0
- package/dist/tools/decision-tools.js.map +1 -0
- package/dist/tools/episode-tools.d.ts +7 -0
- package/dist/tools/episode-tools.js +128 -0
- package/dist/tools/episode-tools.js.map +1 -0
- package/dist/tools/export-tools.d.ts +6 -0
- package/dist/tools/export-tools.js +104 -0
- package/dist/tools/export-tools.js.map +1 -0
- package/dist/tools/profile-tools.d.ts +6 -0
- package/dist/tools/profile-tools.js +108 -0
- package/dist/tools/profile-tools.js.map +1 -0
- package/dist/tools/query-tools.d.ts +6 -0
- package/dist/tools/query-tools.js +96 -0
- package/dist/tools/query-tools.js.map +1 -0
- package/dist/types.d.ts +444 -0
- package/dist/types.js +191 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
- package/watashi-db-cowork-plugin.zip +0 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import type { ClaimRow, ClaimHistoryRow, ClaimRelationRow, ClaimEvidenceRow, ClaimCheckRow, DecisionRow, AuditLogRow, EpisodeRow } from "../types.js";
|
|
2
|
+
import type { ProvenanceData } from "../provenance.js";
|
|
3
|
+
/**
|
|
4
|
+
* 新規Claim挿入
|
|
5
|
+
* 2026-02-11 修正: client_name, client_version追加(Provenance自動付与対応)
|
|
6
|
+
* 元の実装: source_tool/source_sessionのみ(自己申告値)
|
|
7
|
+
*/
|
|
8
|
+
export declare function insertClaim(params: {
|
|
9
|
+
subject: string;
|
|
10
|
+
predicate: string;
|
|
11
|
+
object: string;
|
|
12
|
+
category: string;
|
|
13
|
+
scope: string;
|
|
14
|
+
confidence: number;
|
|
15
|
+
evidence?: string;
|
|
16
|
+
falsifier?: string;
|
|
17
|
+
source_tool?: string;
|
|
18
|
+
source_session?: string;
|
|
19
|
+
client_name?: string | null;
|
|
20
|
+
client_version?: string | null;
|
|
21
|
+
}): ClaimRow;
|
|
22
|
+
/**
|
|
23
|
+
* Claim取得(ID指定)
|
|
24
|
+
*/
|
|
25
|
+
export declare function getClaimById(id: string): ClaimRow | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Claim更新(変更履歴付き)
|
|
28
|
+
*/
|
|
29
|
+
export declare function updateClaim(id: string, updates: Record<string, unknown>, reason: string): ClaimRow | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Claim撤回(削除ではなくステータス変更 + 履歴記録)
|
|
32
|
+
*/
|
|
33
|
+
export declare function retractClaim(id: string, reason: string): ClaimRow | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Claim置き換え(旧Claimをsuperseded化し、新旧関係を記録)
|
|
36
|
+
*/
|
|
37
|
+
export declare function supersedeClaim(oldId: string, newId: string, reason: string): {
|
|
38
|
+
oldClaim: ClaimRow;
|
|
39
|
+
newClaim: ClaimRow;
|
|
40
|
+
} | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Decision ステータス遷移(reverse / obsolete)
|
|
43
|
+
*/
|
|
44
|
+
export declare function updateDecisionStatus(id: string, newStatus: string, reason: string): DecisionRow | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Claim検索(条件指定)
|
|
47
|
+
*/
|
|
48
|
+
export declare function searchClaims(params: {
|
|
49
|
+
category?: string;
|
|
50
|
+
scope?: string;
|
|
51
|
+
status?: string;
|
|
52
|
+
query?: string;
|
|
53
|
+
limit: number;
|
|
54
|
+
}): ClaimRow[];
|
|
55
|
+
/**
|
|
56
|
+
* トピックに関連するコンテキスト検索(FTS5使用)
|
|
57
|
+
* 2026-02-11 修正: FTS5構文エラー耐性強化(サニタイズ + LIKEフォールバック)
|
|
58
|
+
* 元の実装: topic + "*" をそのまま渡していた
|
|
59
|
+
*/
|
|
60
|
+
export declare function queryContext(topic: string, scope: string | undefined, limit: number): ClaimRow[];
|
|
61
|
+
/**
|
|
62
|
+
* Claimの変更履歴を取得
|
|
63
|
+
*/
|
|
64
|
+
export declare function getClaimHistory(claimId: string): ClaimHistoryRow[];
|
|
65
|
+
/**
|
|
66
|
+
* 意思決定ログ記録
|
|
67
|
+
* 2026-02-11 修正: client_name, client_version追加(Provenance自動付与対応)
|
|
68
|
+
* 元の実装: source_toolのみ(自己申告値)
|
|
69
|
+
*/
|
|
70
|
+
export declare function insertDecision(params: {
|
|
71
|
+
title: string;
|
|
72
|
+
description: string;
|
|
73
|
+
reasoning: string;
|
|
74
|
+
alternatives: string[];
|
|
75
|
+
related_claim_ids: string[];
|
|
76
|
+
source_tool?: string;
|
|
77
|
+
client_name?: string | null;
|
|
78
|
+
client_version?: string | null;
|
|
79
|
+
}): DecisionRow;
|
|
80
|
+
/**
|
|
81
|
+
* Decision取得(ID指定)
|
|
82
|
+
*/
|
|
83
|
+
export declare function getDecisionById(id: string): DecisionRow | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Decision検索
|
|
86
|
+
*/
|
|
87
|
+
export declare function listDecisions(params: {
|
|
88
|
+
status?: string;
|
|
89
|
+
query?: string;
|
|
90
|
+
limit: number;
|
|
91
|
+
}): DecisionRow[];
|
|
92
|
+
/**
|
|
93
|
+
* データベース統計情報を取得
|
|
94
|
+
*/
|
|
95
|
+
export declare function getStats(): {
|
|
96
|
+
total_claims: number;
|
|
97
|
+
active_claims: number;
|
|
98
|
+
retracted_claims: number;
|
|
99
|
+
superseded_claims: number;
|
|
100
|
+
total_decisions: number;
|
|
101
|
+
active_decisions: number;
|
|
102
|
+
total_history_entries: number;
|
|
103
|
+
categories: Record<string, number>;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* 全アクティブClaimを取得(リソース用)
|
|
107
|
+
*/
|
|
108
|
+
export declare function getAllActiveClaims(): ClaimRow[];
|
|
109
|
+
/**
|
|
110
|
+
* 直近の意思決定を取得(リソース用)
|
|
111
|
+
*/
|
|
112
|
+
export declare function getRecentDecisions(limit?: number): DecisionRow[];
|
|
113
|
+
/**
|
|
114
|
+
* Claim間関係を記録
|
|
115
|
+
*/
|
|
116
|
+
export declare function insertClaimRelation(params: {
|
|
117
|
+
source_claim_id: string;
|
|
118
|
+
target_claim_id: string;
|
|
119
|
+
relation_type: string;
|
|
120
|
+
confidence: number;
|
|
121
|
+
reasoning?: string;
|
|
122
|
+
source_tool?: string;
|
|
123
|
+
}): ClaimRelationRow;
|
|
124
|
+
/**
|
|
125
|
+
* 特定Claimの関係を取得(source/target両方向)
|
|
126
|
+
*/
|
|
127
|
+
export declare function getClaimRelations(claimId: string): ClaimRelationRow[];
|
|
128
|
+
/**
|
|
129
|
+
* Claimの構造化根拠を記録
|
|
130
|
+
*/
|
|
131
|
+
export declare function insertClaimEvidence(params: {
|
|
132
|
+
claim_id: string;
|
|
133
|
+
evidence_type: string;
|
|
134
|
+
uri?: string;
|
|
135
|
+
span?: string;
|
|
136
|
+
content_hash?: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
source_tool?: string;
|
|
139
|
+
}): ClaimEvidenceRow;
|
|
140
|
+
/**
|
|
141
|
+
* 特定Claimの根拠一覧を取得
|
|
142
|
+
*/
|
|
143
|
+
export declare function getClaimEvidenceList(claimId: string): ClaimEvidenceRow[];
|
|
144
|
+
/**
|
|
145
|
+
* Claimの検証結果を記録
|
|
146
|
+
*/
|
|
147
|
+
export declare function insertClaimCheck(params: {
|
|
148
|
+
claim_id: string;
|
|
149
|
+
check_type: string;
|
|
150
|
+
result: string;
|
|
151
|
+
details?: string;
|
|
152
|
+
source_tool?: string;
|
|
153
|
+
}): ClaimCheckRow;
|
|
154
|
+
/**
|
|
155
|
+
* 特定Claimの検証ログを取得
|
|
156
|
+
*/
|
|
157
|
+
export declare function getClaimChecks(claimId: string): ClaimCheckRow[];
|
|
158
|
+
/**
|
|
159
|
+
* 監査ログを記録する内部ヘルパー
|
|
160
|
+
* 全書き込み操作から呼び出される
|
|
161
|
+
*/
|
|
162
|
+
export declare function insertAuditLog(params: {
|
|
163
|
+
operation: string;
|
|
164
|
+
entity_type: string;
|
|
165
|
+
entity_id: string;
|
|
166
|
+
summary: string;
|
|
167
|
+
details?: string;
|
|
168
|
+
provenance?: ProvenanceData;
|
|
169
|
+
source_tool?: string;
|
|
170
|
+
}): void;
|
|
171
|
+
/**
|
|
172
|
+
* 特定エンティティの監査ログを取得
|
|
173
|
+
*/
|
|
174
|
+
export declare function getAuditLog(entityType: string, entityId: string): AuditLogRow[];
|
|
175
|
+
/**
|
|
176
|
+
* 監査ログ検索(全エンティティ横断)
|
|
177
|
+
*/
|
|
178
|
+
export declare function searchAuditLog(params: {
|
|
179
|
+
operation?: string;
|
|
180
|
+
entity_type?: string;
|
|
181
|
+
session_id?: string;
|
|
182
|
+
limit: number;
|
|
183
|
+
}): AuditLogRow[];
|
|
184
|
+
/**
|
|
185
|
+
* Episode記録
|
|
186
|
+
* 思考パターン・意思決定エピソードを記録する。
|
|
187
|
+
* context→trigger→problems→desires→decisions→outcomes→principles の流れで格納。
|
|
188
|
+
*/
|
|
189
|
+
export declare function insertEpisode(params: {
|
|
190
|
+
title: string;
|
|
191
|
+
context?: string;
|
|
192
|
+
trigger?: string;
|
|
193
|
+
problems: string[];
|
|
194
|
+
desires: string[];
|
|
195
|
+
decisions: string[];
|
|
196
|
+
outcomes: string[];
|
|
197
|
+
principles: string[];
|
|
198
|
+
evidence_refs: string[];
|
|
199
|
+
tags: string[];
|
|
200
|
+
source_tool?: string;
|
|
201
|
+
client_name?: string | null;
|
|
202
|
+
client_version?: string | null;
|
|
203
|
+
session_id?: string | null;
|
|
204
|
+
}): EpisodeRow;
|
|
205
|
+
/**
|
|
206
|
+
* Episode取得(ID指定)
|
|
207
|
+
*/
|
|
208
|
+
export declare function getEpisodeById(id: string): EpisodeRow | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* Episode一覧取得(検索・フィルタ対応)
|
|
211
|
+
* FTS5検索 + タグフィルタ + ステータスフィルタ
|
|
212
|
+
*/
|
|
213
|
+
export declare function listEpisodes(params: {
|
|
214
|
+
status?: string;
|
|
215
|
+
query?: string;
|
|
216
|
+
tag?: string;
|
|
217
|
+
limit: number;
|
|
218
|
+
}): EpisodeRow[];
|
|
219
|
+
/**
|
|
220
|
+
* Episode統計情報を取得
|
|
221
|
+
*/
|
|
222
|
+
export declare function getEpisodeStats(): {
|
|
223
|
+
total_episodes: number;
|
|
224
|
+
active_episodes: number;
|
|
225
|
+
archived_episodes: number;
|
|
226
|
+
};
|
|
227
|
+
//# sourceMappingURL=queries.d.ts.map
|