@pi-unipi/core 0.1.7 → 0.1.10

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,11 @@ 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",
36
+ MILESTONE: "@pi-unipi/milestone",
37
+ KANBOARD: "@pi-unipi/kanboard",
33
38
  } as const;
34
39
 
35
40
  /** Workflow command names */
@@ -48,6 +53,12 @@ export const WORKFLOW_COMMANDS = {
48
53
  DOCUMENT: "document",
49
54
  SCAN_ISSUES: "scan-issues",
50
55
  AUTO: "auto",
56
+ DEBUG: "debug",
57
+ FIX: "fix",
58
+ QUICK_FIX: "quick-fix",
59
+ RESEARCH: "research",
60
+ CHORE_CREATE: "chore-create",
61
+ CHORE_EXECUTE: "chore-execute",
51
62
  } as const;
52
63
 
53
64
  /** Ralph command names */
@@ -77,8 +88,11 @@ export const UNIPI_DIRS = {
77
88
  PLANS: ".unipi/docs/plans",
78
89
  GENERATED: ".unipi/docs/generated",
79
90
  REVIEWS: ".unipi/docs/reviews",
91
+ DEBUG: ".unipi/docs/debug",
92
+ FIX: ".unipi/docs/fix",
93
+ QUICK_WORK: ".unipi/docs/quick-work",
94
+ CHORE: ".unipi/docs/chore",
80
95
  MEMORY: ".unipi/memory",
81
- QUICK_WORK: ".unipi/quick-work",
82
96
  } as const;
83
97
 
84
98
  /** Memory tool names */
@@ -139,11 +153,32 @@ export const RALPH_STATUS_ICONS = {
139
153
  /** Utility command names */
140
154
  export const UTILITY_COMMANDS = {
141
155
  CONTINUE: "continue",
156
+ RELOAD: "reload",
157
+ STATUS: "status",
158
+ CLEANUP: "cleanup",
159
+ ENV: "env",
160
+ DOCTOR: "doctor",
161
+ NAME_BADGE: "name-badge",
162
+ BADGE_GEN: "badge-gen",
163
+ BADGE_TOGGLE: "badge-toggle",
142
164
  } as const;
143
165
 
144
166
  /** Utility tool names */
145
167
  export const UTILITY_TOOLS = {
146
168
  CONTINUE: "continue_task",
169
+ BATCH: "ctx_batch",
170
+ ENV: "ctx_env",
171
+ SET_SESSION_NAME: "set_session_name",
172
+ } as const;
173
+
174
+ /** Badge config path */
175
+ export const BADGE_CONFIG_FILE = ".unipi/config/badge.json" as const;
176
+
177
+ /** Utility directory paths */
178
+ export const UTILITY_DIRS = {
179
+ CACHE: "~/.unipi/cache",
180
+ ANALYTICS: "~/.unipi/analytics",
181
+ TEMP: "/tmp/unipi",
147
182
  } as const;
148
183
 
149
184
  /** Ask-user tool names */
@@ -174,3 +209,99 @@ export const MCP_DEFAULTS = {
174
209
  MAX_SERVERS: 20,
175
210
  TOOL_NAME_SEPARATOR: "__",
176
211
  } as const;
212
+
213
+ /** Compactor tool names */
214
+ export const COMPACTOR_TOOLS = {
215
+ COMPACT: "compact",
216
+ VCC_RECALL: "vcc_recall",
217
+ CTX_EXECUTE: "ctx_execute",
218
+ CTX_EXECUTE_FILE: "ctx_execute_file",
219
+ CTX_BATCH_EXECUTE: "ctx_batch_execute",
220
+ CTX_INDEX: "ctx_index",
221
+ CTX_SEARCH: "ctx_search",
222
+ CTX_FETCH_AND_INDEX: "ctx_fetch_and_index",
223
+ CTX_STATS: "ctx_stats",
224
+ CTX_DOCTOR: "ctx_doctor",
225
+ } as const;
226
+
227
+ /** Compactor command names */
228
+ export const COMPACTOR_COMMANDS = {
229
+ COMPACT: "compact",
230
+ COMPACT_RECALL: "compact-recall",
231
+ COMPACT_STATS: "compact-stats",
232
+ COMPACT_DOCTOR: "compact-doctor",
233
+ COMPACT_SETTINGS: "compact-settings",
234
+ COMPACT_PRESET: "compact-preset",
235
+ COMPACT_INDEX: "compact-index",
236
+ COMPACT_SEARCH: "compact-search",
237
+ COMPACT_PURGE: "compact-purge",
238
+ } as const;
239
+
240
+ /** Compactor directory paths */
241
+ export const COMPACTOR_DIRS = {
242
+ CONFIG: "~/.unipi/config/compactor",
243
+ DB: "~/.unipi/db/compactor",
244
+ } as const;
245
+
246
+ /** Kanboard command names */
247
+ export const KANBOARD_COMMANDS = {
248
+ KANBOARD: "kanboard",
249
+ KANBOARD_DOCTOR: "kanboard-doctor",
250
+ NAME_GEN: "name-gen",
251
+ } as const;
252
+
253
+ /** Kanboard directory paths */
254
+ export const KANBOARD_DIRS = {
255
+ UI_STATIC: "ui/static",
256
+ PID_FILE: ".unipi/kanboard.pid",
257
+ } as const;
258
+
259
+ /** Kanboard defaults */
260
+ export const KANBOARD_DEFAULTS = {
261
+ PORT: 8165,
262
+ MAX_PORT: 8175,
263
+ } as const;
264
+
265
+ /** Notify command names */
266
+ export const NOTIFY_COMMANDS = {
267
+ SETTINGS: "notify-settings",
268
+ SET_GOTIFY: "notify-set-gotify",
269
+ SET_TG: "notify-set-tg",
270
+ TEST: "notify-test",
271
+ } as const;
272
+
273
+ /** Notify tool names */
274
+ export const NOTIFY_TOOLS = {
275
+ NOTIFY_USER: "notify_user",
276
+ } as const;
277
+
278
+ /** Notify directory paths */
279
+ export const NOTIFY_DIRS = {
280
+ CONFIG: "~/.unipi/config/notify",
281
+ } as const;
282
+
283
+ /** Milestone command names */
284
+ export const MILESTONE_COMMANDS = {
285
+ ONBOARD: "milestone-onboard",
286
+ UPDATE: "milestone-update",
287
+ } as const;
288
+
289
+ /** Milestone directory paths */
290
+ export const MILESTONE_DIRS = {
291
+ MILESTONES: ".unipi/docs/MILESTONES.md",
292
+ } as const;
293
+
294
+ /** Compactor defaults */
295
+ export const COMPACTOR_DEFAULTS = {
296
+ MAX_EVENTS_PER_SESSION: 1000,
297
+ DEDUP_WINDOW: 5,
298
+ MAX_RESUME_BYTES: 2048,
299
+ BRIEF_MAX_LINES: 120,
300
+ COMPACT_BRIEF_LINES: 60,
301
+ MINIMAL_BRIEF_LINES: 20,
302
+ OUTPUT_CAP_MB: 100,
303
+ DEFAULT_TIMEOUT_MS: 30000,
304
+ SESSION_TTL_DAYS: 7,
305
+ CACHE_TTL_HOURS: 24,
306
+ FTS5_CHUNK_SIZE: 4096,
307
+ } as const;
package/events.ts CHANGED
@@ -55,6 +55,29 @@ 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",
78
+
79
+ /** Badge generation requested (from kanboard or other module) */
80
+ BADGE_GENERATE_REQUEST: "unipi:badge:generate:request",
58
81
  } as const;
59
82
 
60
83
  /** Payload for MODULE_READY / MODULE_GONE */
@@ -211,6 +234,90 @@ export interface UnipiMcpCatalogSyncedEvent {
211
234
  source: string;
212
235
  }
213
236
 
237
+ /** Payload for COMPACTOR compaction completed */
238
+ export interface UnipiCompactionEvent {
239
+ /** Session ID */
240
+ sessionId: string;
241
+ /** Messages summarized */
242
+ summarized: number;
243
+ /** Messages kept */
244
+ kept: number;
245
+ /** Estimated tokens saved */
246
+ tokensSaved: number;
247
+ /** Compression ratio string, e.g. "56:1" */
248
+ compressionRatio: string;
249
+ }
250
+
251
+ /** Payload for COMPACTOR stats update */
252
+ export interface UnipiCompactorStatsEvent {
253
+ /** Session events count */
254
+ sessionEvents: number;
255
+ /** Compactions count */
256
+ compactions: number;
257
+ /** Tokens saved total */
258
+ tokensSaved: number;
259
+ /** Indexed documents count */
260
+ indexedDocs: number;
261
+ /** Sandbox executions count */
262
+ sandboxRuns: number;
263
+ /** Search queries count */
264
+ searchQueries: number;
265
+ }
266
+
267
+ /** Payload for UTILITY_CLEANUP_START / UTILITY_CLEANUP_DONE */
268
+ export interface UnipiUtilityCleanupEvent {
269
+ /** Whether this is a dry run */
270
+ dryRun: boolean;
271
+ /** Categories being cleaned */
272
+ categories: string[];
273
+ /** Results (present on DONE) */
274
+ results?: Array<{
275
+ category: string;
276
+ removed: number;
277
+ bytesFreed: number;
278
+ }>;
279
+ }
280
+
281
+ /** Payload for UTILITY_DIAGNOSTICS_START / UTILITY_DIAGNOSTICS_DONE */
282
+ export interface UnipiUtilityDiagnosticsEvent {
283
+ /** Overall health status */
284
+ overall: "healthy" | "warning" | "error" | "unknown";
285
+ /** Number of checks run */
286
+ checkCount: number;
287
+ /** Report (present on DONE) */
288
+ report?: unknown;
289
+ }
290
+
291
+ /** Payload for UTILITY_LIFECYCLE_STATE */
292
+ export interface UnipiUtilityLifecycleEvent {
293
+ /** New lifecycle state */
294
+ state: "running" | "shutting_down" | "orphaned" | "error";
295
+ /** Previous state */
296
+ previousState?: string;
297
+ /** Reason for state change */
298
+ reason?: string;
299
+ }
300
+
301
+ /** Payload for BADGE_GENERATE_REQUEST */
302
+ export interface UnipiBadgeGenerateRequestEvent {
303
+ /** Source of the request (e.g., "kanboard", "input-hook") */
304
+ source: string;
305
+ /** First user message for context (optional) */
306
+ conversationSummary?: string;
307
+ }
308
+
309
+ /** Payload for NOTIFICATION_SENT */
310
+ export interface UnipiNotificationSentEvent {
311
+ /** Event type that triggered notification */
312
+ eventType: string;
313
+ /** Platforms sent to */
314
+ platforms: string[];
315
+ /** Whether all platforms succeeded */
316
+ success: boolean;
317
+ /** ISO timestamp */
318
+ timestamp: string;
319
+ }
320
+
214
321
  /** Union of all unipi event payloads */
215
322
  export type UnipiEventPayload =
216
323
  | UnipiModuleEvent
@@ -227,4 +334,11 @@ export type UnipiEventPayload =
227
334
  | UnipiInfoDataEvent
228
335
  | UnipiMcpServerEvent
229
336
  | UnipiMcpToolsEvent
230
- | UnipiMcpCatalogSyncedEvent;
337
+ | UnipiMcpCatalogSyncedEvent
338
+ | UnipiCompactionEvent
339
+ | UnipiCompactorStatsEvent
340
+ | UnipiUtilityCleanupEvent
341
+ | UnipiUtilityDiagnosticsEvent
342
+ | UnipiUtilityLifecycleEvent
343
+ | UnipiNotificationSentEvent
344
+ | UnipiBadgeGenerateRequestEvent;
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.10",
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
  /**