laminark 0.1.0

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.
Files changed (55) hide show
  1. package/README.md +147 -0
  2. package/package.json +65 -0
  3. package/plugin/.claude-plugin/plugin.json +13 -0
  4. package/plugin/.mcp.json +12 -0
  5. package/plugin/CLAUDE.md +10 -0
  6. package/plugin/commands/recall.md +55 -0
  7. package/plugin/commands/remember.md +34 -0
  8. package/plugin/commands/resume.md +45 -0
  9. package/plugin/commands/stash.md +34 -0
  10. package/plugin/commands/status.md +33 -0
  11. package/plugin/dist/analysis/worker.d.ts +1 -0
  12. package/plugin/dist/analysis/worker.js +233 -0
  13. package/plugin/dist/analysis/worker.js.map +1 -0
  14. package/plugin/dist/config-t8LZeB-u.mjs +90 -0
  15. package/plugin/dist/config-t8LZeB-u.mjs.map +1 -0
  16. package/plugin/dist/hooks/handler.d.ts +286 -0
  17. package/plugin/dist/hooks/handler.d.ts.map +1 -0
  18. package/plugin/dist/hooks/handler.js +2413 -0
  19. package/plugin/dist/hooks/handler.js.map +1 -0
  20. package/plugin/dist/index.d.ts +447 -0
  21. package/plugin/dist/index.d.ts.map +1 -0
  22. package/plugin/dist/index.js +7334 -0
  23. package/plugin/dist/index.js.map +1 -0
  24. package/plugin/dist/observations-CorAAc1A.d.mts +192 -0
  25. package/plugin/dist/observations-CorAAc1A.d.mts.map +1 -0
  26. package/plugin/dist/tool-registry-e710BvXq.mjs +3574 -0
  27. package/plugin/dist/tool-registry-e710BvXq.mjs.map +1 -0
  28. package/plugin/hooks/hooks.json +78 -0
  29. package/plugin/laminark.db +0 -0
  30. package/plugin/package.json +17 -0
  31. package/plugin/scripts/README.md +65 -0
  32. package/plugin/scripts/bump-version.sh +42 -0
  33. package/plugin/scripts/dev-sync.sh +58 -0
  34. package/plugin/scripts/ensure-deps.sh +15 -0
  35. package/plugin/scripts/install.sh +139 -0
  36. package/plugin/scripts/local-install.sh +138 -0
  37. package/plugin/scripts/uninstall.sh +133 -0
  38. package/plugin/scripts/update.sh +39 -0
  39. package/plugin/scripts/verify-install.sh +87 -0
  40. package/plugin/skills/status/SKILL.md +6 -0
  41. package/plugin/ui/activity.js +197 -0
  42. package/plugin/ui/app.js +1612 -0
  43. package/plugin/ui/graph.js +2560 -0
  44. package/plugin/ui/help/activity-feed.png +0 -0
  45. package/plugin/ui/help/analysis-panel.png +0 -0
  46. package/plugin/ui/help/graph-toolbar.png +0 -0
  47. package/plugin/ui/help/graph-view.png +0 -0
  48. package/plugin/ui/help/settings.png +0 -0
  49. package/plugin/ui/help/timeline.png +0 -0
  50. package/plugin/ui/help.js +932 -0
  51. package/plugin/ui/index.html +756 -0
  52. package/plugin/ui/settings.js +1414 -0
  53. package/plugin/ui/styles.css +3856 -0
  54. package/plugin/ui/timeline.js +652 -0
  55. package/plugin/ui/tools.js +826 -0
@@ -0,0 +1,192 @@
1
+ import * as better_sqlite30 from "better-sqlite3";
2
+ import Database from "better-sqlite3";
3
+ import { z } from "zod";
4
+
5
+ //#region src/shared/types.d.ts
6
+ /**
7
+ * Observation -- the application-layer shape.
8
+ * Uses camelCase for idiomatic TypeScript.
9
+ * embedding is Float32Array (converted from Buffer during mapping).
10
+ */
11
+ type ObservationClassification = 'discovery' | 'problem' | 'solution' | 'noise';
12
+ type ObservationKind = 'change' | 'reference' | 'finding' | 'decision' | 'verification';
13
+ interface Observation {
14
+ rowid: number;
15
+ id: string;
16
+ projectHash: string;
17
+ content: string;
18
+ title: string | null;
19
+ source: string;
20
+ sessionId: string | null;
21
+ kind: ObservationKind;
22
+ embedding: Float32Array | null;
23
+ embeddingModel: string | null;
24
+ embeddingVersion: string | null;
25
+ classification: ObservationClassification | null;
26
+ classifiedAt: string | null;
27
+ createdAt: string;
28
+ updatedAt: string;
29
+ deletedAt: string | null;
30
+ }
31
+ /**
32
+ * ObservationInsert -- input for creating observations.
33
+ * Validated at runtime via Zod schema.
34
+ */
35
+ declare const ObservationInsertSchema: z.ZodObject<{
36
+ content: z.ZodString;
37
+ title: z.ZodDefault<z.ZodNullable<z.ZodString>>;
38
+ source: z.ZodDefault<z.ZodString>;
39
+ kind: z.ZodDefault<z.ZodString>;
40
+ sessionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
41
+ embedding: z.ZodDefault<z.ZodNullable<z.ZodCustom<Float32Array<ArrayBuffer>, Float32Array<ArrayBuffer>>>>;
42
+ embeddingModel: z.ZodDefault<z.ZodNullable<z.ZodString>>;
43
+ embeddingVersion: z.ZodDefault<z.ZodNullable<z.ZodString>>;
44
+ }, z.core.$strip>;
45
+ type ObservationInsert = z.input<typeof ObservationInsertSchema>;
46
+ interface Session {
47
+ id: string;
48
+ projectHash: string;
49
+ startedAt: string;
50
+ endedAt: string | null;
51
+ summary: string | null;
52
+ }
53
+ interface SearchResult {
54
+ observation: Observation;
55
+ score: number;
56
+ matchType: 'fts' | 'vector' | 'hybrid';
57
+ snippet: string;
58
+ }
59
+ interface DatabaseConfig {
60
+ dbPath: string;
61
+ busyTimeout: number;
62
+ }
63
+ //#endregion
64
+ //#region src/storage/observations.d.ts
65
+ /**
66
+ * Repository for observation CRUD operations.
67
+ *
68
+ * Every query is scoped to the projectHash provided at construction time.
69
+ * Callers cannot accidentally query the wrong project -- project isolation
70
+ * is baked into every prepared statement.
71
+ *
72
+ * All SQL statements are prepared once in the constructor and reused for
73
+ * every call (better-sqlite3 performance best practice).
74
+ */
75
+ declare class ObservationRepository {
76
+ private readonly db;
77
+ private readonly projectHash;
78
+ private readonly stmtInsert;
79
+ private readonly stmtGetById;
80
+ private readonly stmtGetByIdIncludingDeleted;
81
+ private readonly stmtSoftDelete;
82
+ private readonly stmtRestore;
83
+ private readonly stmtCount;
84
+ constructor(db: Database.Database, projectHash: string);
85
+ /**
86
+ * Creates a new observation scoped to this repository's project.
87
+ * Validates input with Zod at runtime.
88
+ */
89
+ create(input: ObservationInsert): Observation;
90
+ /**
91
+ * Resolves a full or prefix ID to the full 32-char ID.
92
+ * Observation IDs are 32-char hex strings. Search results display only the
93
+ * first 8 chars via shortId(). This method allows callers to pass either
94
+ * a full ID or an 8-char (or any-length) prefix and get the full ID back.
95
+ * Returns null if no unique match is found.
96
+ */
97
+ private resolveId;
98
+ /**
99
+ * Gets an observation by ID, scoped to this project.
100
+ * Accepts full 32-char IDs or shorter prefix strings (e.g. the 8-char
101
+ * display IDs shown in search results).
102
+ * Returns null if not found or soft-deleted.
103
+ */
104
+ getById(id: string): Observation | null;
105
+ /**
106
+ * Lists observations for this project, ordered by created_at DESC.
107
+ * Excludes soft-deleted observations.
108
+ */
109
+ list(options?: {
110
+ limit?: number;
111
+ offset?: number;
112
+ sessionId?: string;
113
+ since?: string;
114
+ kind?: string;
115
+ includeUnclassified?: boolean;
116
+ }): Observation[];
117
+ /**
118
+ * Updates an observation's content, embedding fields, or both.
119
+ * Always sets updated_at to current time.
120
+ * Scoped to this project; returns null if not found or soft-deleted.
121
+ */
122
+ update(id: string, updates: Partial<Pick<Observation, 'content' | 'embedding' | 'embeddingModel' | 'embeddingVersion'>>): Observation | null;
123
+ /**
124
+ * Soft-deletes an observation by setting deleted_at.
125
+ * Accepts full 32-char IDs or shorter prefix strings (e.g. the 8-char
126
+ * display IDs shown in search results).
127
+ * Returns true if the observation was found and deleted.
128
+ */
129
+ softDelete(id: string): boolean;
130
+ /**
131
+ * Restores a soft-deleted observation by clearing deleted_at.
132
+ * Accepts full 32-char IDs or shorter prefix strings (e.g. the 8-char
133
+ * display IDs shown in search results).
134
+ * Returns true if the observation was found and restored.
135
+ */
136
+ restore(id: string): boolean;
137
+ /**
138
+ * Updates the classification of an observation.
139
+ * Sets classified_at to current time. Returns true if found and updated.
140
+ */
141
+ updateClassification(id: string, classification: ObservationClassification): boolean;
142
+ /**
143
+ * Creates an observation with an initial classification (bypasses classifier).
144
+ * Used for explicit user saves that should be immediately visible.
145
+ */
146
+ createClassified(input: ObservationInsert, classification: ObservationClassification): Observation;
147
+ /**
148
+ * Fetches unclassified observations for the background classifier.
149
+ * Returns observations ordered by created_at ASC (oldest first).
150
+ */
151
+ listUnclassified(limit?: number): Observation[];
152
+ /**
153
+ * Lists unclassified observations across ALL projects.
154
+ * Used by HaikuProcessor to avoid missing observations from other projects.
155
+ */
156
+ static listAllUnclassified(db: better_sqlite30.Database, limit?: number): Observation[];
157
+ /**
158
+ * Fetches observations surrounding a given timestamp for classification context.
159
+ * Returns observations regardless of classification status.
160
+ */
161
+ listContext(aroundTime: string, windowSize?: number): Observation[];
162
+ /**
163
+ * Counts non-deleted observations for this project.
164
+ */
165
+ count(): number;
166
+ /**
167
+ * Gets an observation by ID, including soft-deleted observations.
168
+ * Accepts full 32-char IDs or shorter prefix strings (e.g. the 8-char
169
+ * display IDs shown in search results).
170
+ * Used by the recall tool for restore operations (must find purged items).
171
+ */
172
+ getByIdIncludingDeleted(id: string): Observation | null;
173
+ /**
174
+ * Lists observations for this project, including soft-deleted ones.
175
+ * Used by recall with include_purged: true to show all items.
176
+ */
177
+ listIncludingDeleted(options?: {
178
+ limit?: number;
179
+ offset?: number;
180
+ }): Observation[];
181
+ /**
182
+ * Searches observations by title substring (partial match via LIKE).
183
+ * Optionally includes soft-deleted items.
184
+ */
185
+ getByTitle(title: string, options?: {
186
+ limit?: number;
187
+ includePurged?: boolean;
188
+ }): Observation[];
189
+ }
190
+ //#endregion
191
+ export { SearchResult as a, ObservationInsert as i, DatabaseConfig as n, Session as o, Observation as r, ObservationRepository as t };
192
+ //# sourceMappingURL=observations-CorAAc1A.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observations-CorAAc1A.d.mts","names":[],"sources":["../../src/shared/types.ts","../../src/storage/observations.ts"],"mappings":";;;;;;;;;;KA0DY,yBAAA;AAAA,KAEA,eAAA;AAAA,UAEK,WAAA;EACf,KAAA;EACA,EAAA;EACA,WAAA;EACA,OAAA;EACA,KAAA;EACA,MAAA;EACA,SAAA;EACA,IAAA,EAAM,eAAA;EACN,SAAA,EAAW,YAAA;EACX,cAAA;EACA,gBAAA;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