@pi-unipi/core 0.1.7 → 0.1.8

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/constants.ts CHANGED
@@ -30,6 +30,9 @@ export const MODULES = {
30
30
  SETTINGS: "@pi-unipi/settings",
31
31
  UTILITY: "@pi-unipi/utility",
32
32
  ASK_USER: "@pi-unipi/ask-user",
33
+ COMPACTOR: "@pi-unipi/compactor",
34
+ NOTIFY: "@pi-unipi/notify",
35
+ BTW: "@pi-unipi/btw",
33
36
  } as const;
34
37
 
35
38
  /** Workflow command names */
@@ -48,6 +51,12 @@ export const WORKFLOW_COMMANDS = {
48
51
  DOCUMENT: "document",
49
52
  SCAN_ISSUES: "scan-issues",
50
53
  AUTO: "auto",
54
+ DEBUG: "debug",
55
+ FIX: "fix",
56
+ QUICK_FIX: "quick-fix",
57
+ RESEARCH: "research",
58
+ CHORE_CREATE: "chore-create",
59
+ CHORE_EXECUTE: "chore-execute",
51
60
  } as const;
52
61
 
53
62
  /** Ralph command names */
@@ -77,8 +86,11 @@ export const UNIPI_DIRS = {
77
86
  PLANS: ".unipi/docs/plans",
78
87
  GENERATED: ".unipi/docs/generated",
79
88
  REVIEWS: ".unipi/docs/reviews",
89
+ DEBUG: ".unipi/docs/debug",
90
+ FIX: ".unipi/docs/fix",
91
+ QUICK_WORK: ".unipi/docs/quick-work",
92
+ CHORE: ".unipi/docs/chore",
80
93
  MEMORY: ".unipi/memory",
81
- QUICK_WORK: ".unipi/quick-work",
82
94
  } as const;
83
95
 
84
96
  /** Memory tool names */
@@ -139,11 +151,25 @@ export const RALPH_STATUS_ICONS = {
139
151
  /** Utility command names */
140
152
  export const UTILITY_COMMANDS = {
141
153
  CONTINUE: "continue",
154
+ RELOAD: "reload",
155
+ STATUS: "status",
156
+ CLEANUP: "cleanup",
157
+ ENV: "env",
158
+ DOCTOR: "doctor",
142
159
  } as const;
143
160
 
144
161
  /** Utility tool names */
145
162
  export const UTILITY_TOOLS = {
146
163
  CONTINUE: "continue_task",
164
+ BATCH: "ctx_batch",
165
+ ENV: "ctx_env",
166
+ } as const;
167
+
168
+ /** Utility directory paths */
169
+ export const UTILITY_DIRS = {
170
+ CACHE: "~/.unipi/cache",
171
+ ANALYTICS: "~/.unipi/analytics",
172
+ TEMP: "/tmp/unipi",
147
173
  } as const;
148
174
 
149
175
  /** Ask-user tool names */
@@ -174,3 +200,69 @@ export const MCP_DEFAULTS = {
174
200
  MAX_SERVERS: 20,
175
201
  TOOL_NAME_SEPARATOR: "__",
176
202
  } as const;
203
+
204
+ /** Compactor tool names */
205
+ export const COMPACTOR_TOOLS = {
206
+ COMPACT: "compact",
207
+ VCC_RECALL: "vcc_recall",
208
+ CTX_EXECUTE: "ctx_execute",
209
+ CTX_EXECUTE_FILE: "ctx_execute_file",
210
+ CTX_BATCH_EXECUTE: "ctx_batch_execute",
211
+ CTX_INDEX: "ctx_index",
212
+ CTX_SEARCH: "ctx_search",
213
+ CTX_FETCH_AND_INDEX: "ctx_fetch_and_index",
214
+ CTX_STATS: "ctx_stats",
215
+ CTX_DOCTOR: "ctx_doctor",
216
+ } as const;
217
+
218
+ /** Compactor command names */
219
+ export const COMPACTOR_COMMANDS = {
220
+ COMPACT: "compact",
221
+ COMPACT_RECALL: "compact-recall",
222
+ COMPACT_STATS: "compact-stats",
223
+ COMPACT_DOCTOR: "compact-doctor",
224
+ COMPACT_SETTINGS: "compact-settings",
225
+ COMPACT_PRESET: "compact-preset",
226
+ COMPACT_INDEX: "compact-index",
227
+ COMPACT_SEARCH: "compact-search",
228
+ COMPACT_PURGE: "compact-purge",
229
+ } as const;
230
+
231
+ /** Compactor directory paths */
232
+ export const COMPACTOR_DIRS = {
233
+ CONFIG: "~/.unipi/config/compactor",
234
+ DB: "~/.unipi/db/compactor",
235
+ } as const;
236
+
237
+ /** Notify command names */
238
+ export const NOTIFY_COMMANDS = {
239
+ SETTINGS: "notify-settings",
240
+ SET_GOTIFY: "notify-set-gotify",
241
+ SET_TG: "notify-set-tg",
242
+ TEST: "notify-test",
243
+ } as const;
244
+
245
+ /** Notify tool names */
246
+ export const NOTIFY_TOOLS = {
247
+ NOTIFY_USER: "notify_user",
248
+ } as const;
249
+
250
+ /** Notify directory paths */
251
+ export const NOTIFY_DIRS = {
252
+ CONFIG: "~/.unipi/config/notify",
253
+ } as const;
254
+
255
+ /** Compactor defaults */
256
+ export const COMPACTOR_DEFAULTS = {
257
+ MAX_EVENTS_PER_SESSION: 1000,
258
+ DEDUP_WINDOW: 5,
259
+ MAX_RESUME_BYTES: 2048,
260
+ BRIEF_MAX_LINES: 120,
261
+ COMPACT_BRIEF_LINES: 60,
262
+ MINIMAL_BRIEF_LINES: 20,
263
+ OUTPUT_CAP_MB: 100,
264
+ DEFAULT_TIMEOUT_MS: 30000,
265
+ SESSION_TTL_DAYS: 7,
266
+ CACHE_TTL_HOURS: 24,
267
+ FTS5_CHUNK_SIZE: 4096,
268
+ } as const;
package/events.ts CHANGED
@@ -55,6 +55,26 @@ export const UNIPI_EVENTS = {
55
55
  MCP_TOOLS_UNREGISTERED: "unipi:mcp:tools:unregistered",
56
56
  /** MCP catalog synced */
57
57
  MCP_CATALOG_SYNCED: "unipi:mcp:catalog:synced",
58
+
59
+ /** Compactor: compaction completed */
60
+ COMPACTOR_COMPACTED: "unipi:compactor:compacted",
61
+ /** Compactor: stats updated */
62
+ COMPACTOR_STATS_UPDATED: "unipi:compactor:stats:updated",
63
+ /** Utility module cleanup started */
64
+ UTILITY_CLEANUP_START: "unipi:utility:cleanup:start",
65
+ /** Utility module cleanup completed */
66
+ UTILITY_CLEANUP_DONE: "unipi:utility:cleanup:done",
67
+ /** Utility diagnostics started */
68
+ UTILITY_DIAGNOSTICS_START: "unipi:utility:diagnostics:start",
69
+ /** Utility diagnostics completed */
70
+ UTILITY_DIAGNOSTICS_DONE: "unipi:utility:diagnostics:done",
71
+ /** Utility cache invalidated */
72
+ UTILITY_CACHE_INVALIDATED: "unipi:utility:cache:invalidated",
73
+ /** Utility lifecycle state changed */
74
+ UTILITY_LIFECYCLE_STATE: "unipi:utility:lifecycle:state",
75
+
76
+ /** Notification sent */
77
+ NOTIFICATION_SENT: "unipi:notify:sent",
58
78
  } as const;
59
79
 
60
80
  /** Payload for MODULE_READY / MODULE_GONE */
@@ -211,6 +231,82 @@ export interface UnipiMcpCatalogSyncedEvent {
211
231
  source: string;
212
232
  }
213
233
 
234
+ /** Payload for COMPACTOR compaction completed */
235
+ export interface UnipiCompactionEvent {
236
+ /** Session ID */
237
+ sessionId: string;
238
+ /** Messages summarized */
239
+ summarized: number;
240
+ /** Messages kept */
241
+ kept: number;
242
+ /** Estimated tokens saved */
243
+ tokensSaved: number;
244
+ /** Compression ratio string, e.g. "56:1" */
245
+ compressionRatio: string;
246
+ }
247
+
248
+ /** Payload for COMPACTOR stats update */
249
+ export interface UnipiCompactorStatsEvent {
250
+ /** Session events count */
251
+ sessionEvents: number;
252
+ /** Compactions count */
253
+ compactions: number;
254
+ /** Tokens saved total */
255
+ tokensSaved: number;
256
+ /** Indexed documents count */
257
+ indexedDocs: number;
258
+ /** Sandbox executions count */
259
+ sandboxRuns: number;
260
+ /** Search queries count */
261
+ searchQueries: number;
262
+ }
263
+
264
+ /** Payload for UTILITY_CLEANUP_START / UTILITY_CLEANUP_DONE */
265
+ export interface UnipiUtilityCleanupEvent {
266
+ /** Whether this is a dry run */
267
+ dryRun: boolean;
268
+ /** Categories being cleaned */
269
+ categories: string[];
270
+ /** Results (present on DONE) */
271
+ results?: Array<{
272
+ category: string;
273
+ removed: number;
274
+ bytesFreed: number;
275
+ }>;
276
+ }
277
+
278
+ /** Payload for UTILITY_DIAGNOSTICS_START / UTILITY_DIAGNOSTICS_DONE */
279
+ export interface UnipiUtilityDiagnosticsEvent {
280
+ /** Overall health status */
281
+ overall: "healthy" | "warning" | "error" | "unknown";
282
+ /** Number of checks run */
283
+ checkCount: number;
284
+ /** Report (present on DONE) */
285
+ report?: unknown;
286
+ }
287
+
288
+ /** Payload for UTILITY_LIFECYCLE_STATE */
289
+ export interface UnipiUtilityLifecycleEvent {
290
+ /** New lifecycle state */
291
+ state: "running" | "shutting_down" | "orphaned" | "error";
292
+ /** Previous state */
293
+ previousState?: string;
294
+ /** Reason for state change */
295
+ reason?: string;
296
+ }
297
+
298
+ /** Payload for NOTIFICATION_SENT */
299
+ export interface UnipiNotificationSentEvent {
300
+ /** Event type that triggered notification */
301
+ eventType: string;
302
+ /** Platforms sent to */
303
+ platforms: string[];
304
+ /** Whether all platforms succeeded */
305
+ success: boolean;
306
+ /** ISO timestamp */
307
+ timestamp: string;
308
+ }
309
+
214
310
  /** Union of all unipi event payloads */
215
311
  export type UnipiEventPayload =
216
312
  | UnipiModuleEvent
@@ -227,4 +323,10 @@ export type UnipiEventPayload =
227
323
  | UnipiInfoDataEvent
228
324
  | UnipiMcpServerEvent
229
325
  | UnipiMcpToolsEvent
230
- | UnipiMcpCatalogSyncedEvent;
326
+ | UnipiMcpCatalogSyncedEvent
327
+ | UnipiCompactionEvent
328
+ | UnipiCompactorStatsEvent
329
+ | UnipiUtilityCleanupEvent
330
+ | UnipiUtilityDiagnosticsEvent
331
+ | UnipiUtilityLifecycleEvent
332
+ | UnipiNotificationSentEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/core",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Shared utilities, event types, and constants for Unipi extension suite",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/sandbox.ts CHANGED
@@ -40,6 +40,12 @@ const COMMAND_SANDBOX: Record<string, SandboxLevel> = {
40
40
  [WORKFLOW_COMMANDS.DOCUMENT]: "write_unipi",
41
41
  [WORKFLOW_COMMANDS.SCAN_ISSUES]: "read_only",
42
42
  [WORKFLOW_COMMANDS.AUTO]: "full",
43
+ [WORKFLOW_COMMANDS.DEBUG]: "read_only",
44
+ [WORKFLOW_COMMANDS.FIX]: "full",
45
+ [WORKFLOW_COMMANDS.QUICK_FIX]: "full",
46
+ [WORKFLOW_COMMANDS.RESEARCH]: "read_only",
47
+ [WORKFLOW_COMMANDS.CHORE_CREATE]: "write_unipi",
48
+ [WORKFLOW_COMMANDS.CHORE_EXECUTE]: "full",
43
49
  };
44
50
 
45
51
  /**