@c3-oss/prosa 0.3.2 → 0.5.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.
package/dist/index.d.ts CHANGED
@@ -51,7 +51,7 @@ declare function runMigrations(db: Db): {
51
51
  declare function currentSchemaVersion(db: Db): number;
52
52
 
53
53
  declare const PROSA_PARSER_VERSION = "0.1.0";
54
- declare const PROSA_SCHEMA_VERSION = 2;
54
+ declare const PROSA_SCHEMA_VERSION = 4;
55
55
 
56
56
  type Compression = 'zstd' | 'none';
57
57
 
@@ -238,6 +238,8 @@ interface SearchIndexStatus {
238
238
  indexed_doc_count: number;
239
239
  updated_at: string;
240
240
  error_message: string | null;
241
+ last_indexed_rowid: number | null;
242
+ schema_fingerprint: string | null;
241
243
  }
242
244
  declare function enableFts5Triggers(bundle: Bundle): void;
243
245
  declare function disableFts5Triggers(bundle: Bundle): void;
@@ -245,10 +247,17 @@ declare function getSearchIndexStatuses(bundle: Bundle): SearchIndexStatus[];
245
247
  declare function getSearchIndexStatus(bundle: Bundle, engine: SearchEngine): SearchIndexStatus | null;
246
248
  declare function markIndexesAfterImport(bundle: Bundle, options: {
247
249
  changed: boolean;
248
- fts5Deferred: boolean;
249
250
  }): void;
250
251
  declare function rebuildFts5Index(bundle: Bundle): SearchIndexStatus;
251
- declare function rebuildTantivyIndex(bundle: Bundle): Promise<SearchIndexStatus>;
252
+ interface RebuildTantivyOptions {
253
+ /**
254
+ * Force a full re-index even when an incremental run would be valid.
255
+ * Surfaced by the `--overwrite` flag on `prosa index tantivy` and on
256
+ * `prosa compile`.
257
+ */
258
+ overwrite?: boolean;
259
+ }
260
+ declare function rebuildTantivyIndex(bundle: Bundle, options?: RebuildTantivyOptions): Promise<SearchIndexStatus>;
252
261
 
253
262
  interface SearchHit {
254
263
  doc_id: string;
@@ -311,6 +320,7 @@ interface CompileImportSummary {
311
320
  importedAny: boolean;
312
321
  tantivy: TantivyCompileSummary | null;
313
322
  tantivyError: string | null;
323
+ fts5Error: string | null;
314
324
  }
315
325
  interface ParquetCompileSummary {
316
326
  outDir: string;
@@ -325,8 +335,14 @@ declare function resolveCompilePath(p: string): string;
325
335
  declare function runCompileImports(options: {
326
336
  bundle: Bundle;
327
337
  providers: CompileProviderConfig[];
328
- deferIndex: boolean;
329
338
  sessionsPath?: string;
339
+ /**
340
+ * Force a full rebuild of derived indexes after import. Tantivy is the
341
+ * only sidecar with an incremental path today, so this currently flips
342
+ * Tantivy to a from-scratch rebuild; FTS5 and Parquet are always
343
+ * full-rewrite. Surfaced by `prosa compile … --overwrite`.
344
+ */
345
+ overwrite?: boolean;
330
346
  logger?: CompileLogger;
331
347
  onProviderComplete?: (summary: ProviderCompileSummary) => void;
332
348
  onTantivyComplete?: (summary: TantivyCompileSummary) => void;
@@ -336,15 +352,10 @@ declare function exportCompileParquet(options: {
336
352
  logger?: CompileLogger;
337
353
  }): Promise<ParquetCompileSummary>;
338
354
 
339
- /**
340
- * Render a session into Markdown. Big tool outputs aren't dumped inline:
341
- * we show a preview line plus a `[object: blake3:…]` reference, leaving the
342
- * raw bytes in the CAS for downstream tools.
343
- */
344
- declare function exportSessionMarkdown(bundle: Bundle, sessionId: string): Promise<string>;
345
-
346
355
  declare const PARQUET_TABLES: readonly ["objects", "source_files", "import_batches", "raw_records", "import_errors", "uncertainties", "projects", "sessions", "turns", "events", "messages", "content_blocks", "tool_calls", "tool_results", "artifacts", "edges", "search_docs"];
356
+ declare const ANALYTICS_VIEWS: readonly ["session_facts", "tool_usage_facts", "error_facts", "model_usage", "project_activity"];
347
357
  type ParquetTable = (typeof PARQUET_TABLES)[number];
358
+ type AnalyticsView = (typeof ANALYTICS_VIEWS)[number];
348
359
  interface ParquetExportOptions {
349
360
  bundlePath: string;
350
361
  outDir?: string;
@@ -366,6 +377,71 @@ interface DuckDbQueryResult {
366
377
  declare function exportBundleParquet(options: ParquetExportOptions): Promise<ParquetExportResult>;
367
378
  declare function queryDuckDbParquet(options: DuckDbQueryOptions): Promise<DuckDbQueryResult>;
368
379
 
380
+ declare const ANALYTICS_REPORTS: readonly ["sessions", "tools", "errors", "models", "projects"];
381
+ type AnalyticsReport = (typeof ANALYTICS_REPORTS)[number];
382
+ type AnalyticsDialect = 'sqlite' | 'duckdb';
383
+ interface AnalyticsReportFilters {
384
+ source?: string;
385
+ since?: string;
386
+ until?: string;
387
+ limit?: number;
388
+ toolName?: string;
389
+ canonicalType?: string;
390
+ errorsOnly?: boolean;
391
+ category?: string;
392
+ model?: string;
393
+ project?: string;
394
+ sessionId?: string;
395
+ sourcePathSubstring?: string;
396
+ }
397
+ interface AnalyticsReportOptions {
398
+ parquetDir: string;
399
+ report: AnalyticsReport;
400
+ filters?: AnalyticsReportFilters;
401
+ }
402
+ interface AnalyticsBundleReportOptions {
403
+ bundle: Bundle;
404
+ report: AnalyticsReport;
405
+ filters?: AnalyticsReportFilters;
406
+ }
407
+ declare function runAnalyticsReport(options: AnalyticsReportOptions): Promise<DuckDbQueryResult>;
408
+ declare function runAnalyticsReportFromBundle(options: AnalyticsBundleReportOptions): DuckDbQueryResult;
409
+
410
+ type ToolCallEntity = 'tool_call' | 'artifact';
411
+ interface ToolCallEvidence {
412
+ entity_type: ToolCallEntity;
413
+ session_id: string | null;
414
+ tool_call_id: string | null;
415
+ artifact_id: string | null;
416
+ tool_name: string | null;
417
+ canonical_tool_type: string | null;
418
+ command: string | null;
419
+ path: string | null;
420
+ status: string | null;
421
+ timestamp_start: string | null;
422
+ is_error: 0 | 1 | null;
423
+ exit_code: number | null;
424
+ preview: string | null;
425
+ }
426
+ interface ToolCallFilters {
427
+ sessionId?: string;
428
+ toolName?: string;
429
+ canonicalType?: string;
430
+ pathSubstring?: string;
431
+ errorsOnly?: boolean;
432
+ sinceIso?: string;
433
+ untilIso?: string;
434
+ limit?: number;
435
+ }
436
+ declare function listToolCalls(bundle: Bundle, filters?: ToolCallFilters): ToolCallEvidence[];
437
+
438
+ /**
439
+ * Render a session into Markdown. Big tool outputs aren't dumped inline:
440
+ * we show a preview line plus a `[object: blake3:…]` reference, leaving the
441
+ * raw bytes in the CAS for downstream tools.
442
+ */
443
+ declare function exportSessionMarkdown(bundle: Bundle, sessionId: string): Promise<string>;
444
+
369
445
  interface CompileResult$3 {
370
446
  batch: ImportBatch;
371
447
  counts: ImportCounts;
@@ -390,4 +466,4 @@ interface CompileResult {
390
466
  }
391
467
  declare function compileCursor(bundle: Bundle, root: string, options?: CompileOptions): Promise<CompileResult>;
392
468
 
393
- export { type Bundle, type BundleManifest, COMPILE_PROVIDERS, type CanonicalToolType, type CompileResult$2 as ClaudeCompileResult, type CompileResult$3 as CodexCompileResult, type CompileImportSummary, type CompileLogger, type CompileOptions, type CompileProviderConfig, type Confidence, type CompileResult as CursorCompileResult, type DuckDbQueryOptions, type DuckDbQueryResult, type EdgeType, type CompileResult$1 as GeminiCompileResult, type ImportBatch, type ImportCounts, type MessageRole, type ObjectId, type ObjectMeta, PARQUET_TABLES, PROSA_PARSER_VERSION, PROSA_SCHEMA_VERSION, type ParquetCompileSummary, type ParquetExportOptions, type ParquetExportResult, type ParquetTable, type ProviderCompileSummary, type RegisterResult, type SearchEngine, type SearchHit, type SearchIndexStatus, type SearchOptions, type SessionDetail, type SessionDetailEvent, type SessionListFilters, type SessionRow, type SessionRowFull, type SourceFileRow, type SourceTool, type TantivyCompileSummary, type ToolCallStatus, closeBundle, compileClaude, compileCodex, compileCursor, compileGemini, countSessions, currentSchemaVersion, defaultBundlePath, disableFts5Triggers, emptyCounts, enableFts5Triggers, exportBundleParquet, exportCompileParquet, exportSessionMarkdown, finishBatch, getBytes, getCompileProvider, getJson, getObjectMeta, getSearchIndexStatus, getSearchIndexStatuses, getSession, getText, initBundle, listSessions, markIndexesAfterImport, openBundle, openOrInitBundle, putBytes, putJson, putText, queryDuckDbParquet, rebuildFts5Index, rebuildTantivyIndex, recordError, registerSourceFile, resolveCompilePath, runCompileImports, runMigrations, searchFullText, startBatch };
469
+ export { ANALYTICS_REPORTS, ANALYTICS_VIEWS, type AnalyticsBundleReportOptions, type AnalyticsDialect, type AnalyticsReport, type AnalyticsReportFilters, type AnalyticsReportOptions, type AnalyticsView, type Bundle, type BundleManifest, COMPILE_PROVIDERS, type CanonicalToolType, type CompileResult$2 as ClaudeCompileResult, type CompileResult$3 as CodexCompileResult, type CompileImportSummary, type CompileLogger, type CompileOptions, type CompileProviderConfig, type Confidence, type CompileResult as CursorCompileResult, type DuckDbQueryOptions, type DuckDbQueryResult, type EdgeType, type CompileResult$1 as GeminiCompileResult, type ImportBatch, type ImportCounts, type MessageRole, type ObjectId, type ObjectMeta, PARQUET_TABLES, PROSA_PARSER_VERSION, PROSA_SCHEMA_VERSION, type ParquetCompileSummary, type ParquetExportOptions, type ParquetExportResult, type ParquetTable, type ProviderCompileSummary, type RegisterResult, type SearchEngine, type SearchHit, type SearchIndexStatus, type SearchOptions, type SessionDetail, type SessionDetailEvent, type SessionListFilters, type SessionRow, type SessionRowFull, type SourceFileRow, type SourceTool, type TantivyCompileSummary, type ToolCallEntity, type ToolCallEvidence, type ToolCallFilters, type ToolCallStatus, closeBundle, compileClaude, compileCodex, compileCursor, compileGemini, countSessions, currentSchemaVersion, defaultBundlePath, disableFts5Triggers, emptyCounts, enableFts5Triggers, exportBundleParquet, exportCompileParquet, exportSessionMarkdown, finishBatch, getBytes, getCompileProvider, getJson, getObjectMeta, getSearchIndexStatus, getSearchIndexStatuses, getSession, getText, initBundle, listSessions, listToolCalls, markIndexesAfterImport, openBundle, openOrInitBundle, putBytes, putJson, putText, queryDuckDbParquet, rebuildFts5Index, rebuildTantivyIndex, recordError, registerSourceFile, resolveCompilePath, runAnalyticsReport, runAnalyticsReportFromBundle, runCompileImports, runMigrations, searchFullText, startBatch };