@jeffober/thatch 0.1.48 → 0.2.1
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/README.md +43 -4
- package/artifacts/skills/thatch-fact-extractor.md +1 -1
- package/artifacts/skills/thatch-memory-verify.md +2 -2
- package/bin/thatch +31 -16
- package/docs/dev/README.md +39 -13
- package/docs/dev/features/behavior-engine.md +3 -2
- package/docs/dev/features/cicd.md +1 -1
- package/docs/dev/features/compaction-recovery.md +1 -1
- package/docs/dev/features/cross-session-chat.md +12 -3
- package/docs/dev/features/extraction.md +10 -2
- package/docs/dev/features/hygiene.md +3 -1
- package/docs/dev/features/memory-store.md +1 -1
- package/docs/dev/features/multi-host.md +4 -2
- package/docs/dev/features/notifications.md +121 -4
- package/docs/dev/features/nudge-pipeline.md +16 -2
- package/docs/dev/features/opencode-plugin.md +133 -0
- package/docs/dev/features/qa-system.md +43 -0
- package/docs/dev/features/repo-identity.md +1 -1
- package/docs/dev/features/session-lifecycle.md +6 -3
- package/docs/dev/features/watchers.md +12 -5
- package/docs/dev/gotchas.md +94 -4
- package/docs/dev/mcp-parity.md +4 -3
- package/docs/dev/setup-and-hooks.md +7 -2
- package/docs/plans/llm-alerts.md +287 -0
- package/docs/plans/prediction-consolidation.md +3 -3
- package/docs/user/README.md +8 -4
- package/docs/user/memory.md +1 -1
- package/docs/user/notifications.md +63 -4
- package/docs/user/setup.md +4 -0
- package/docs/user/watchers.md +15 -7
- package/package.json +3 -1
- package/src/alerts.ts +360 -0
- package/src/capabilities.ts +174 -0
- package/src/chat.ts +80 -5
- package/src/commands.ts +44 -5
- package/src/config.ts +32 -1
- package/src/db.ts +157 -12
- package/src/embeddings.ts +43 -0
- package/src/extraction.ts +210 -0
- package/src/index.ts +77 -1339
- package/src/opencode/v1.ts +54 -0
- package/src/opencode/v2.ts +605 -0
- package/src/os-args.ts +99 -0
- package/src/prompts.ts +181 -31
- package/src/runtime.ts +2004 -0
- package/src/seed-behaviors.ts +1 -1
- package/src/session-db.ts +32 -0
- package/src/tool-defs.ts +340 -46
- package/src/tools.ts +16 -35
- package/src/watchers.ts +109 -14
package/src/seed-behaviors.ts
CHANGED
|
@@ -30,7 +30,7 @@ interface DefaultBehavior {
|
|
|
30
30
|
* (2) a user-codified behavior that happens to match a seed situation
|
|
31
31
|
* would be found and silently deleted.
|
|
32
32
|
*
|
|
33
|
-
* Called by both the opencode plugin (src/
|
|
33
|
+
* Called by both the opencode plugin (src/runtime.ts) and the MCP server
|
|
34
34
|
* (src/mcp.ts) at startup, after DB and model initialization.
|
|
35
35
|
*/
|
|
36
36
|
const DEFAULT_BEHAVIORS: DefaultBehavior[] = [
|
package/src/session-db.ts
CHANGED
|
@@ -54,6 +54,38 @@ export function resolveOpencodeDbPath(): string | null {
|
|
|
54
54
|
return existsSync(path) ? path : null;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Resolves the session `opencode -c` continues: the most recently updated
|
|
59
|
+
* top-level session in the directory, read straight from the session
|
|
60
|
+
* database - the same pick the TUI makes from client.session.list(), which
|
|
61
|
+
* the v2 plugin context cannot call (its session domain has no list) and
|
|
62
|
+
* which would arrive too late for the runtime's synchronous rehydration
|
|
63
|
+
* partition regardless. Null when the db is unavailable or no top-level
|
|
64
|
+
* session exists in the directory.
|
|
65
|
+
*/
|
|
66
|
+
export function mostRecentTopLevelSessionId(directory: string): string | null {
|
|
67
|
+
const dbPath = resolveOpencodeDbPath();
|
|
68
|
+
if (!dbPath) return null;
|
|
69
|
+
let db: Database;
|
|
70
|
+
try {
|
|
71
|
+
db = new Database(dbPath, { readonly: true });
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const row = db
|
|
77
|
+
.query(
|
|
78
|
+
"SELECT id FROM session WHERE directory = ? AND (parent_id IS NULL OR parent_id = '') ORDER BY time_updated DESC LIMIT 1",
|
|
79
|
+
)
|
|
80
|
+
.get(directory) as { id: string } | undefined;
|
|
81
|
+
return row?.id ?? null;
|
|
82
|
+
} catch {
|
|
83
|
+
return null;
|
|
84
|
+
} finally {
|
|
85
|
+
db.close();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
57
89
|
export interface SessionRow {
|
|
58
90
|
id: string;
|
|
59
91
|
title: string;
|