@vibetasks/core 0.5.8 → 0.5.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/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { SupabaseClient } from '@supabase/supabase-js';
2
+ import { TaskFilter, TaskPriority, TaskStatus, EnergyLevel, Task as Task$2 } from '@vibetasks/shared';
3
+ export { TaskFilter, TaskPriority, TaskStatus } from '@vibetasks/shared';
2
4
 
3
5
  interface TaskFlowConfig {
4
6
  supabase_url?: string;
@@ -149,10 +151,6 @@ declare function createSupabaseClient(config: SupabaseConfig): SupabaseClient<an
149
151
  */
150
152
  declare function createSupabaseClientFromEnv(): SupabaseClient<any, "public", "vibetasks", any, any>;
151
153
 
152
- type TaskFilter = 'all' | 'today' | 'upcoming' | 'completed' | 'archived';
153
- type TaskPriority = 'none' | 'low' | 'medium' | 'high';
154
- type TaskStatus = 'todo' | 'vibing' | 'done' | 'paused' | 'archived';
155
- type EnergyLevel = 'low' | 'medium' | 'high';
156
154
  type ChangeType = 'created' | 'status_changed' | 'title_changed' | 'description_changed' | 'context_updated' | 'priority_changed' | 'due_date_changed' | 'subtask_added' | 'subtask_removed' | 'subtask_done' | 'subtask_undone' | 'tag_added' | 'tag_removed' | 'workspace_moved' | 'handoff' | 'revert' | 'archived' | 'restored';
157
155
  interface TaskChange {
158
156
  id: string;
@@ -168,13 +166,23 @@ interface TaskChange {
168
166
  reverted_change_id?: string;
169
167
  created_at: string;
170
168
  }
169
+ /**
170
+ * Workspace interface
171
+ *
172
+ * FLAT WORKSPACE MODEL (2026):
173
+ * - Workspaces = top-level projects only (git repos or named cloud projects)
174
+ * - Sub-organization within a workspace uses tags, not nested workspaces
175
+ * - Git remote URL is the stable identifier
176
+ */
171
177
  interface Workspace {
172
178
  id: string;
173
179
  user_id: string;
174
180
  slug: string;
175
181
  display_name: string;
176
182
  full_path: string;
183
+ /** @deprecated Use tags for sub-organization within workspace */
177
184
  parent_id?: string;
185
+ /** @deprecated Workspaces are flat now, depth should be 0 */
178
186
  depth: number;
179
187
  color?: string;
180
188
  description?: string;
@@ -219,7 +227,7 @@ interface Attachment {
219
227
  * Task interface - comprehensive type matching @vibetasks/shared
220
228
  * All fields are optional except id and title for flexibility in operations
221
229
  */
222
- interface Task {
230
+ interface Task$1 {
223
231
  id: string;
224
232
  user_id?: string;
225
233
  title: string;
@@ -242,7 +250,7 @@ interface Task {
242
250
  updated_at?: string;
243
251
  tags?: Tag[];
244
252
  attachments?: Attachment[];
245
- subtasks?: Task[];
253
+ subtasks?: Task$1[];
246
254
  subtasks_json?: Subtask[];
247
255
  status?: TaskStatus;
248
256
  project_tag?: string;
@@ -250,6 +258,8 @@ interface Task {
250
258
  context_notes?: string;
251
259
  energy_required?: EnergyLevel;
252
260
  source_type?: SourceType;
261
+ workspace_id?: string;
262
+ a2a_task_id?: string;
253
263
  github_issue_id?: number | string;
254
264
  github_issue_number?: number;
255
265
  github_repo?: string;
@@ -287,6 +297,14 @@ interface Task {
287
297
  captured_at: string;
288
298
  capture_source?: 'paste' | 'clipboard' | 'terminal' | 'browser' | 'sentry' | 'ci';
289
299
  };
300
+ /** OpenAI embedding vector (1536-dim) for semantic similarity search */
301
+ semantic_vector?: number[];
302
+ /** Extracted intent from first session message (e.g., "Implement OAuth flow for Apple Sign-In") */
303
+ intent?: string;
304
+ /** Auto-generated semantic tags (3-5 per task) for context grouping */
305
+ context_tags?: string[];
306
+ /** Flag indicating semantic_vector needs regeneration (internal) */
307
+ needs_embedding_update?: boolean;
290
308
  }
291
309
  /**
292
310
  * TaskOperations class provides a high-level API for task management
@@ -294,42 +312,118 @@ interface Task {
294
312
  */
295
313
  declare class TaskOperations {
296
314
  private supabase;
297
- constructor(supabase: SupabaseClient<any, any, any>);
315
+ private workspaceId?;
316
+ constructor(supabase: SupabaseClient<any, any, any>, workspaceId?: string);
298
317
  private currentSessionId?;
299
318
  /**
300
319
  * Set the current session ID for change tracking
301
320
  */
302
321
  setSessionId(sessionId: string): void;
322
+ /**
323
+ * Set the workspace ID for workspace isolation
324
+ * 🔒 WORKSPACE ISOLATION: Filter all queries by workspace
325
+ */
326
+ setWorkspaceId(workspaceId: string): void;
327
+ /**
328
+ * Get current workspace ID
329
+ */
330
+ getWorkspaceId(): string | undefined;
303
331
  /**
304
332
  * Create TaskOperations from AuthManager
305
333
  * Automatically refreshes expired tokens
334
+ * 🔒 WORKSPACE ISOLATION: Accepts optional workspaceId parameter
306
335
  */
307
- static fromAuthManager(authManager: AuthManager): Promise<TaskOperations>;
308
- getTasks(filter?: TaskFilter, includeArchived?: boolean): Promise<Task[]>;
309
- getTask(taskId: string): Promise<Task>;
310
- createTask(task: Partial<Task>): Promise<Task>;
311
- updateTask(taskId: string, updates: Partial<Task>, logChanges?: boolean): Promise<Task>;
336
+ static fromAuthManager(authManager: AuthManager, workspaceId?: string): Promise<TaskOperations>;
337
+ getTasks(filter?: TaskFilter, includeArchived?: boolean): Promise<Task$1[]>;
338
+ getTask(taskId: string): Promise<Task$1>;
339
+ createTask(task: Partial<Task$1>): Promise<Task$1>;
340
+ updateTask(taskId: string, updates: Partial<Task$1>, logChanges?: boolean): Promise<Task$1>;
312
341
  deleteTask(taskId: string): Promise<void>;
313
- completeTask(taskId: string): Promise<Task>;
314
- uncompleteTask(taskId: string): Promise<Task>;
342
+ completeTask(taskId: string): Promise<Task$1>;
343
+ uncompleteTask(taskId: string): Promise<Task$1>;
315
344
  /**
316
345
  * Archive a task - moves it to archived status
317
346
  * Typically used for completed tasks you want to hide from views
318
347
  */
319
- archiveTask(taskId: string): Promise<Task>;
348
+ archiveTask(taskId: string): Promise<Task$1>;
320
349
  /**
321
350
  * Unarchive a task - restores it to its previous state (done by default)
322
351
  */
323
- unarchiveTask(taskId: string, restoreStatus?: TaskStatus): Promise<Task>;
352
+ unarchiveTask(taskId: string, restoreStatus?: TaskStatus): Promise<Task$1>;
324
353
  /**
325
354
  * Get all archived tasks
326
355
  */
327
- getArchivedTasks(limit?: number): Promise<Task[]>;
356
+ getArchivedTasks(limit?: number): Promise<Task$1[]>;
357
+ /**
358
+ * Get tasks ready to work on (no blockers, not deferred)
359
+ */
360
+ getReadyTasks(options?: {
361
+ status?: string;
362
+ limit?: number;
363
+ }): Promise<Task$1[]>;
364
+ /**
365
+ * Fallback for ready tasks when RPC function doesn't exist
366
+ */
367
+ private getReadyTasksFallback;
368
+ /**
369
+ * Get stale tasks (not updated in X days)
370
+ */
371
+ getStaleTasks(options?: {
372
+ days?: number;
373
+ status?: string;
374
+ limit?: number;
375
+ }): Promise<Task$1[]>;
376
+ /**
377
+ * Fallback for stale tasks when RPC function doesn't exist
378
+ */
379
+ private getStaleTasksFallback;
380
+ /**
381
+ * Get orphaned tasks (incomplete tasks from old AI sessions)
382
+ */
383
+ getOrphanedTasks(options?: {
384
+ currentSessionId?: string;
385
+ limit?: number;
386
+ }): Promise<Task$1[]>;
387
+ /**
388
+ * Fallback for orphaned tasks when RPC function doesn't exist
389
+ */
390
+ private getOrphanedTasksFallback;
391
+ /**
392
+ * Get blocked tasks (tasks with open dependencies)
393
+ */
394
+ getBlockedTasks(options?: {
395
+ limit?: number;
396
+ }): Promise<Task$1[]>;
397
+ /**
398
+ * Fallback for blocked tasks when RPC function doesn't exist
399
+ */
400
+ private getBlockedTasksFallback;
401
+ /**
402
+ * Get tasks eligible for compaction (completed, old, not yet compacted)
403
+ */
404
+ getCompactableTasks(options?: {
405
+ minDaysOld?: number;
406
+ maxCompactionLevel?: number;
407
+ limit?: number;
408
+ }): Promise<Task$1[]>;
409
+ /**
410
+ * Update a task with compaction results
411
+ */
412
+ applyCompaction(taskId: string, summary: string): Promise<Task$1>;
413
+ /**
414
+ * Get compaction statistics for the user
415
+ */
416
+ getCompactionStats(): Promise<{
417
+ totalCompleted: number;
418
+ compacted: number;
419
+ eligible: number;
420
+ savedBytes: number;
421
+ }>;
328
422
  getTags(): Promise<Tag[]>;
329
423
  createTag(name: string, color?: string): Promise<Tag>;
330
424
  linkTaskTags(taskId: string, tagIds: string[]): Promise<void>;
331
425
  unlinkAllTaskTags(taskId: string): Promise<void>;
332
- searchTasks(query: string, limit?: number, includeArchived?: boolean): Promise<Task[]>;
426
+ searchTasks(query: string, limit?: number, includeArchived?: boolean): Promise<Task$1[]>;
333
427
  /**
334
428
  * Find tag by name (case-insensitive), create if doesn't exist
335
429
  */
@@ -358,7 +452,7 @@ declare class TaskOperations {
358
452
  priority?: TaskPriority | TaskPriority[];
359
453
  unacknowledged_only?: boolean;
360
454
  limit?: number;
361
- }): Promise<Task[]>;
455
+ }): Promise<Task$1[]>;
362
456
  /**
363
457
  * Get inbox statistics
364
458
  */
@@ -393,6 +487,16 @@ declare class TaskOperations {
393
487
  search?: string;
394
488
  limit?: number;
395
489
  }): Promise<any[]>;
490
+ /**
491
+ * Log an action to the current AI session
492
+ */
493
+ logSessionAction(sessionId: string, action: {
494
+ action_type: string;
495
+ description: string;
496
+ task_id?: string;
497
+ doc_id?: string;
498
+ metadata?: Record<string, unknown>;
499
+ }): Promise<void>;
396
500
  /**
397
501
  * Log a change to a task (like a git commit)
398
502
  */
@@ -439,10 +543,17 @@ declare class TaskOperations {
439
543
  searchChanges(query: string, limit?: number): Promise<TaskChange[]>;
440
544
  /**
441
545
  * Create a workspace
546
+ *
547
+ * FLAT WORKSPACE MODEL (2026):
548
+ * - Workspaces are top-level only (no parent/child hierarchy)
549
+ * - full_path = display_name (no hierarchy separator needed)
550
+ * - depth is always 0
551
+ * - Use tags for sub-organization within a workspace
442
552
  */
443
553
  createWorkspace(input: {
444
554
  slug: string;
445
555
  displayName: string;
556
+ /** @deprecated Workspaces are flat now - this parameter is ignored */
446
557
  parentId?: string;
447
558
  color?: string;
448
559
  description?: string;
@@ -456,7 +567,12 @@ declare class TaskOperations {
456
567
  */
457
568
  getWorkspaceByPath(fullPath: string): Promise<Workspace | null>;
458
569
  /**
459
- * Get or create workspace from a project_tag (auto-creates hierarchy)
570
+ * Get or create workspace from a project_tag
571
+ *
572
+ * FLAT WORKSPACE MODEL (2026):
573
+ * - Only creates top-level workspace from the LAST segment of the tag
574
+ * - Legacy hierarchical tags like "sparktory > vibetasks > web" → creates "web" workspace
575
+ * - For new code, just pass the workspace name directly
460
576
  */
461
577
  getOrCreateWorkspace(projectTag: string): Promise<Workspace>;
462
578
  /**
@@ -481,15 +597,46 @@ declare class TaskOperations {
481
597
  /**
482
598
  * Pause a task
483
599
  */
484
- pauseTask(taskId: string, reason?: string): Promise<Task>;
600
+ pauseTask(taskId: string, reason?: string): Promise<Task$1>;
485
601
  /**
486
602
  * Resume a paused task
487
603
  */
488
- resumeTask(taskId: string): Promise<Task>;
604
+ resumeTask(taskId: string): Promise<Task$1>;
489
605
  /**
490
606
  * Restore a task from archive
491
607
  */
492
- restoreTask(taskId: string, toStatus?: TaskStatus): Promise<Task>;
608
+ restoreTask(taskId: string, toStatus?: TaskStatus): Promise<Task$1>;
609
+ /**
610
+ * Get meetings for the current user
611
+ */
612
+ getMeetings(options?: {
613
+ workspace_id?: string;
614
+ limit?: number;
615
+ since?: string;
616
+ }): Promise<any[]>;
617
+ /**
618
+ * Create a custom skill
619
+ */
620
+ createSkill(skill: {
621
+ name: string;
622
+ description: string;
623
+ category: string;
624
+ trigger_phrases: string[];
625
+ steps: Array<{
626
+ action: string;
627
+ tool?: string;
628
+ params?: Record<string, any>;
629
+ }>;
630
+ workspace_id?: string;
631
+ }): Promise<any>;
632
+ /**
633
+ * List user's skills
634
+ */
635
+ getSkills(options?: {
636
+ workspace_id?: string;
637
+ category?: string;
638
+ enabled_only?: boolean;
639
+ }): Promise<any[]>;
493
640
  }
494
641
 
495
642
  /**
@@ -531,6 +678,10 @@ interface SyncResult {
531
678
  previousStatus?: TaskStatus;
532
679
  /** New status (if updated) */
533
680
  newStatus?: TaskStatus;
681
+ /** Match type: exact (A2A ID) or fuzzy (string similarity) */
682
+ matchType?: 'exact' | 'fuzzy';
683
+ /** A2A task ID (for debugging/logging) */
684
+ a2aTaskId?: string;
534
685
  /** Error message if any */
535
686
  error?: string;
536
687
  }
@@ -561,6 +712,10 @@ interface SyncOptions {
561
712
  matchThreshold?: number;
562
713
  /** Whether to sync 'pending' todos as 'todo' status (default: true) */
563
714
  syncPending?: boolean;
715
+ /** Workspace ID for A2A task ID generation */
716
+ workspaceId?: string;
717
+ /** Created by (user ID or session ID) for A2A task ID generation */
718
+ createdBy?: string;
564
719
  }
565
720
  /**
566
721
  * Claude Sync class for managing TodoWrite synchronization
@@ -571,7 +726,7 @@ declare class ClaudeSync {
571
726
  /**
572
727
  * Sync a single Claude todo item with VibeTasks
573
728
  */
574
- syncTodo(todo: ClaudeTodoItem, existingTasks?: Task[], options?: SyncOptions): Promise<SyncResult>;
729
+ syncTodo(todo: ClaudeTodoItem, existingTasks?: Task$1[], options?: SyncOptions): Promise<SyncResult>;
575
730
  /**
576
731
  * Sync all Claude todos with VibeTasks
577
732
  */
@@ -579,15 +734,15 @@ declare class ClaudeSync {
579
734
  /**
580
735
  * Get current vibing tasks (for comparison with Claude's in_progress)
581
736
  */
582
- getVibingTasks(): Promise<Task[]>;
737
+ getVibingTasks(): Promise<Task$1[]>;
583
738
  /**
584
739
  * Auto-start vibing on a task when Claude marks it as in_progress
585
740
  */
586
- startVibing(taskId: string): Promise<Task>;
741
+ startVibing(taskId: string): Promise<Task$1>;
587
742
  /**
588
743
  * Complete a task when Claude marks it as completed
589
744
  */
590
- completeTask(taskId: string): Promise<Task>;
745
+ completeTask(taskId: string): Promise<Task$1>;
591
746
  }
592
747
  /**
593
748
  * MCP Tool: sync_claude_todos
@@ -597,4 +752,649 @@ declare class ClaudeSync {
597
752
  */
598
753
  declare function syncClaudeTodos(taskOps: TaskOperations, todos: ClaudeTodoItem[], options?: SyncOptions): Promise<SyncAllResult>;
599
754
 
600
- export { type Attachment, AuthManager, type ChangeType, ClaudeSync, type ClaudeTodoItem, ConfigManager, type SourceType, type Subtask, type SupabaseConfig, type SyncAllResult, type SyncOptions, type SyncResult, type Tag, type Task, type TaskChange, type TaskFilter, type TaskFlowConfig, TaskOperations, type TaskPriority, type TaskStatus, type Workspace, createSupabaseClient, createSupabaseClientFromEnv, syncClaudeTodos };
755
+ /**
756
+ * Integration Sync Service
757
+ * Handles two-way sync with external integrations (Sentry, GitHub, etc.)
758
+ *
759
+ * When a task is completed in VibeTasks:
760
+ * - If it came from Sentry → resolve the issue in Sentry
761
+ * - If it came from GitHub → close the issue in GitHub
762
+ */
763
+
764
+ interface IntegrationSyncResult {
765
+ success: boolean;
766
+ integration: 'sentry' | 'github' | 'slack' | 'email';
767
+ action: string;
768
+ externalId?: string;
769
+ externalUrl?: string;
770
+ error?: string;
771
+ }
772
+ interface Task {
773
+ id: string;
774
+ user_id: string;
775
+ title?: string;
776
+ status?: string;
777
+ sentry_issue_id?: string;
778
+ sentry_project?: string;
779
+ sentry_url?: string;
780
+ github_issue_id?: number;
781
+ github_issue_number?: number;
782
+ github_repo?: string;
783
+ github_url?: string;
784
+ source_type?: string;
785
+ }
786
+ declare class IntegrationSyncService {
787
+ private supabase;
788
+ constructor(supabase: SupabaseClient);
789
+ /**
790
+ * Sync task completion to external integrations
791
+ * Called when a task is marked as done
792
+ */
793
+ syncTaskComplete(task: Task): Promise<IntegrationSyncResult[]>;
794
+ /**
795
+ * Resolve a Sentry issue when the task is completed
796
+ */
797
+ private resolveSentryIssue;
798
+ /**
799
+ * Close a GitHub issue when the task is completed
800
+ */
801
+ private closeGitHubIssue;
802
+ /**
803
+ * Log sync attempt for debugging and auditing
804
+ */
805
+ private logSyncAttempt;
806
+ /**
807
+ * Sync task reopen to external integrations
808
+ * Called when a task is moved back to todo/vibing from done
809
+ */
810
+ syncTaskReopen(task: Task): Promise<IntegrationSyncResult[]>;
811
+ /**
812
+ * Unresolve a Sentry issue when the task is reopened
813
+ */
814
+ private unresolveSentryIssue;
815
+ /**
816
+ * Reopen a GitHub issue when the task is reopened
817
+ */
818
+ private reopenGitHubIssue;
819
+ }
820
+
821
+ /**
822
+ * Generate semantic vector (embedding) for task content
823
+ *
824
+ * @param title - Task title
825
+ * @param notes - Task notes/description (optional)
826
+ * @param intent - Extracted intent from first session message (optional)
827
+ * @returns 1536-dimensional embedding vector
828
+ */
829
+ declare function generateTaskEmbedding(input: {
830
+ title: string;
831
+ notes?: string;
832
+ intent?: string;
833
+ }): Promise<number[]>;
834
+ /**
835
+ * Generate context tags for a task using simple keyword extraction
836
+ *
837
+ * For now uses a simple heuristic approach. In the future, could use:
838
+ * - GPT-4o-mini for intelligent tag generation
839
+ * - TF-IDF for keyword extraction
840
+ * - Domain-specific dictionaries
841
+ *
842
+ * @param title - Task title
843
+ * @param notes - Task notes (optional)
844
+ * @returns Array of 3-5 semantic tags
845
+ */
846
+ declare function generateContextTags(input: {
847
+ title: string;
848
+ notes?: string;
849
+ projectTag?: string;
850
+ }): string[];
851
+ /**
852
+ * Extract intent from task title and notes
853
+ *
854
+ * Intent is a concise statement of what the user is trying to accomplish.
855
+ * Used for RLM context propagation.
856
+ *
857
+ * @param title - Task title
858
+ * @param notes - Task notes (optional)
859
+ * @returns Extracted intent (up to 200 chars)
860
+ */
861
+ declare function extractIntent(input: {
862
+ title: string;
863
+ notes?: string;
864
+ description?: string;
865
+ }): string;
866
+
867
+ /**
868
+ * AI-based semantic analysis for RLM integration
869
+ * Uses RECOMMENDED_MODELS for cost-optimized intent extraction and tag generation
870
+ */
871
+ /**
872
+ * Extract semantic intent from task using Claude
873
+ */
874
+ declare function extractIntentWithClaude(input: {
875
+ title: string;
876
+ notes?: string;
877
+ description?: string;
878
+ }): Promise<string>;
879
+ /**
880
+ * Generate semantic context tags using Claude
881
+ */
882
+ declare function generateContextTagsWithClaude(input: {
883
+ title: string;
884
+ notes?: string;
885
+ projectTag?: string;
886
+ }): Promise<string[]>;
887
+ /**
888
+ * Generate task embedding using Voyage AI (Anthropic-recommended)
889
+ *
890
+ * Uses voyage-code-3 model optimized for code and technical content.
891
+ * Produces 1024-dimensional embeddings for semantic similarity search.
892
+ */
893
+ declare function generateTaskEmbeddingWithClaude(input: {
894
+ title: string;
895
+ notes?: string;
896
+ intent?: string;
897
+ }): Promise<number[]>;
898
+ /**
899
+ * Batch process multiple tasks with Claude
900
+ * Includes rate limiting to avoid API throttling
901
+ */
902
+ declare function batchProcessTasksWithClaude(tasks: Array<{
903
+ id: string;
904
+ title: string;
905
+ notes?: string;
906
+ description?: string;
907
+ }>, onProgress?: (completed: number, total: number) => void): Promise<Array<{
908
+ id: string;
909
+ intent: string;
910
+ contextTags: string[];
911
+ embedding: number[];
912
+ }>>;
913
+
914
+ /**
915
+ * Recursive Language Model (RLM) Engine
916
+ *
917
+ * Based on MIT's RLM paper: https://arxiv.org/abs/2512.24601v1
918
+ * Enables LLMs to process 10M+ token contexts by treating context as
919
+ * an external environment that can be programmatically explored.
920
+ *
921
+ * Key concepts:
922
+ * - Context stored as variable in REPL environment (not in prompt)
923
+ * - LLM writes Python code to search/filter/chunk context
924
+ * - Recursive llm_query() calls for sub-problems
925
+ * - 3x cheaper and 29% more accurate than traditional approaches
926
+ *
927
+ * Uses RECOMMENDED_MODELS for cost-optimized model selection.
928
+ */
929
+ interface RLMConfig {
930
+ apiKey: string;
931
+ model?: string;
932
+ maxDepth?: number;
933
+ subLLMModel?: string;
934
+ timeout?: number;
935
+ verbose?: boolean;
936
+ }
937
+ interface RLMResult {
938
+ answer: string;
939
+ totalCost: number;
940
+ tokensUsed: {
941
+ input: number;
942
+ output: number;
943
+ };
944
+ callCount: number;
945
+ depth: number;
946
+ executionTime: number;
947
+ }
948
+ declare class RLMEngine {
949
+ private client;
950
+ private config;
951
+ private currentDepth;
952
+ private callCount;
953
+ private totalTokens;
954
+ private startTime;
955
+ private logs;
956
+ constructor(config: RLMConfig);
957
+ /**
958
+ * Main RLM completion function
959
+ * Replaces traditional llm.completion(prompt) calls
960
+ */
961
+ completion(query: string, context: string): Promise<RLMResult>;
962
+ /**
963
+ * Recursive query function - core of RLM
964
+ */
965
+ private recursiveQuery;
966
+ /**
967
+ * Create REPL environment with context and tools
968
+ */
969
+ private createREPLEnvironment;
970
+ /**
971
+ * Execute Python code in sandboxed VM
972
+ */
973
+ private executeREPLCode;
974
+ /**
975
+ * Base LLM query without recursion (for depth limit or simple queries)
976
+ */
977
+ private baseLLMQuery;
978
+ /**
979
+ * Build system prompt teaching LLM how to use RLM
980
+ */
981
+ private buildSystemPrompt;
982
+ /**
983
+ * Build prompt for REPL interaction
984
+ */
985
+ private buildREPLPrompt;
986
+ /**
987
+ * Extract code blocks from LLM response
988
+ */
989
+ private extractCodeBlocks;
990
+ /**
991
+ * Extract final answer from FINAL() or FINAL_VAR()
992
+ */
993
+ private extractFinalAnswer;
994
+ /**
995
+ * Calculate total cost based on token usage
996
+ */
997
+ private calculateCost;
998
+ /**
999
+ * Logging helper
1000
+ */
1001
+ private log;
1002
+ /**
1003
+ * Get execution logs
1004
+ */
1005
+ getLogs(): string[];
1006
+ }
1007
+
1008
+ /**
1009
+ * RLM Context Loader
1010
+ *
1011
+ * Loads codebase files into a massive context string for RLM processing.
1012
+ * Integrates with existing VibeTasks file system and context engine.
1013
+ */
1014
+ interface CodebaseContext {
1015
+ content: string;
1016
+ fileCount: number;
1017
+ totalSize: number;
1018
+ files: {
1019
+ path: string;
1020
+ size: number;
1021
+ lines: number;
1022
+ }[];
1023
+ metadata: {
1024
+ generatedAt: Date;
1025
+ rootPath: string;
1026
+ excludePatterns: string[];
1027
+ };
1028
+ }
1029
+ interface ContextLoaderOptions {
1030
+ rootPath: string;
1031
+ excludePatterns?: string[];
1032
+ includePatterns?: string[];
1033
+ maxFileSize?: number;
1034
+ addFileHeaders?: boolean;
1035
+ addLineNumbers?: boolean;
1036
+ }
1037
+ declare class RLMContextLoader {
1038
+ private defaultExcludePatterns;
1039
+ private defaultIncludePatterns;
1040
+ /**
1041
+ * Load entire codebase into single context string
1042
+ */
1043
+ loadCodebase(options: ContextLoaderOptions): Promise<CodebaseContext>;
1044
+ /**
1045
+ * Load specific files or directories
1046
+ */
1047
+ loadPaths(rootPath: string, paths: string[], options?: Partial<ContextLoaderOptions>): Promise<CodebaseContext>;
1048
+ /**
1049
+ * Find files matching patterns
1050
+ */
1051
+ private findFiles;
1052
+ /**
1053
+ * Create a focused context for specific query
1054
+ * Uses existing context engine's semantic search to pre-filter
1055
+ */
1056
+ loadFocusedContext(rootPath: string, query: string, options?: {
1057
+ maxFiles?: number;
1058
+ semanticSearch?: boolean;
1059
+ }): Promise<CodebaseContext>;
1060
+ /**
1061
+ * Extract keywords from query for relevance scoring
1062
+ */
1063
+ private extractKeywords;
1064
+ /**
1065
+ * Stream large codebase in chunks (for progressive loading)
1066
+ */
1067
+ streamCodebase(options: ContextLoaderOptions, chunkSize?: number): AsyncGenerator<{
1068
+ chunk: string;
1069
+ progress: number;
1070
+ }>;
1071
+ /**
1072
+ * Get context statistics without loading full content
1073
+ */
1074
+ getCodebaseStats(options: ContextLoaderOptions): Promise<{
1075
+ fileCount: number;
1076
+ totalSize: number;
1077
+ estimatedTokens: number;
1078
+ topFileTypes: {
1079
+ ext: string;
1080
+ count: number;
1081
+ }[];
1082
+ }>;
1083
+ }
1084
+
1085
+ /**
1086
+ * RLM MCP Tool
1087
+ *
1088
+ * Exposes RLM capabilities as MCP tools for VibeTasks agents.
1089
+ * Enables AI to query massive codebases (10M+ tokens) using recursive search.
1090
+ */
1091
+
1092
+ interface RLMQueryInput {
1093
+ query: string;
1094
+ workspacePath?: string;
1095
+ focused?: boolean;
1096
+ maxFiles?: number;
1097
+ verbose?: boolean;
1098
+ maxDepth?: number;
1099
+ }
1100
+ interface RLMQueryOutput extends RLMResult {
1101
+ contextUsed: {
1102
+ fileCount: number;
1103
+ totalSize: number;
1104
+ estimatedTokens: number;
1105
+ };
1106
+ logs?: string[];
1107
+ }
1108
+ declare class RLMMCPTool {
1109
+ private engine;
1110
+ private contextLoader;
1111
+ private contextCache;
1112
+ constructor(anthropicApiKey: string);
1113
+ /**
1114
+ * Main RLM query tool
1115
+ */
1116
+ queryCodebase(input: RLMQueryInput): Promise<RLMQueryOutput>;
1117
+ /**
1118
+ * Get codebase statistics (fast, no LLM calls)
1119
+ */
1120
+ getCodebaseStats(workspacePath?: string): Promise<{
1121
+ fileCount: number;
1122
+ totalSize: number;
1123
+ estimatedTokens: number;
1124
+ estimatedCost: number;
1125
+ topFileTypes: {
1126
+ ext: string;
1127
+ count: number;
1128
+ }[];
1129
+ }>;
1130
+ /**
1131
+ * Clear context cache
1132
+ */
1133
+ clearCache(): void;
1134
+ /**
1135
+ * Prefetch and cache codebase context
1136
+ */
1137
+ prefetchContext(workspacePath?: string, focused?: boolean): Promise<void>;
1138
+ }
1139
+ /**
1140
+ * MCP Tool Schema for registration
1141
+ */
1142
+ declare const RLM_MCP_TOOLS: ({
1143
+ name: string;
1144
+ description: string;
1145
+ inputSchema: {
1146
+ type: string;
1147
+ properties: {
1148
+ query: {
1149
+ type: string;
1150
+ description: string;
1151
+ };
1152
+ focused: {
1153
+ type: string;
1154
+ description: string;
1155
+ default: boolean;
1156
+ };
1157
+ maxFiles: {
1158
+ type: string;
1159
+ description: string;
1160
+ default: number;
1161
+ };
1162
+ verbose: {
1163
+ type: string;
1164
+ description: string;
1165
+ default: boolean;
1166
+ };
1167
+ };
1168
+ required: string[];
1169
+ };
1170
+ } | {
1171
+ name: string;
1172
+ description: string;
1173
+ inputSchema: {
1174
+ type: string;
1175
+ properties: {
1176
+ query?: undefined;
1177
+ focused?: undefined;
1178
+ maxFiles?: undefined;
1179
+ verbose?: undefined;
1180
+ };
1181
+ required?: undefined;
1182
+ };
1183
+ })[];
1184
+
1185
+ /**
1186
+ * Task Compaction Service
1187
+ *
1188
+ * AI-powered summarization of old completed tasks to reduce context size
1189
+ * while preserving important information for future reference.
1190
+ *
1191
+ * Inspired by beads' haiku compaction system.
1192
+ */
1193
+
1194
+ /**
1195
+ * Compaction result for a task
1196
+ */
1197
+ interface CompactionResult {
1198
+ taskId: string;
1199
+ originalSize: number;
1200
+ compactedSize: number;
1201
+ summary: string;
1202
+ success: boolean;
1203
+ error?: string;
1204
+ }
1205
+ /**
1206
+ * Options for running compaction
1207
+ */
1208
+ interface CompactionOptions {
1209
+ /** Minimum days since completion before compacting (default: 7) */
1210
+ minDaysOld?: number;
1211
+ /** Maximum number of tasks to compact in one run (default: 10) */
1212
+ limit?: number;
1213
+ /** Dry run - don't actually update tasks (default: false) */
1214
+ dryRun?: boolean;
1215
+ /** Only compact tasks at this compaction level or below (default: 0) */
1216
+ maxCompactionLevel?: number;
1217
+ }
1218
+ /**
1219
+ * Task Compaction Service
1220
+ *
1221
+ * Summarizes old completed tasks using AI to reduce context size.
1222
+ */
1223
+ declare class TaskCompactionService {
1224
+ private anthropic;
1225
+ private model;
1226
+ constructor(apiKey?: string);
1227
+ /**
1228
+ * Compact a single task by generating a summary
1229
+ */
1230
+ compactTask(task: Task$2): Promise<CompactionResult>;
1231
+ /**
1232
+ * Build the full content of a task for summarization
1233
+ */
1234
+ private buildTaskContent;
1235
+ /**
1236
+ * Generate summary with exponential backoff retry
1237
+ */
1238
+ private generateSummaryWithRetry;
1239
+ /**
1240
+ * Generate the actual summary using Claude
1241
+ */
1242
+ private generateSummary;
1243
+ /**
1244
+ * Build the compaction prompt
1245
+ */
1246
+ private buildPrompt;
1247
+ /**
1248
+ * Check if an error is retryable
1249
+ */
1250
+ private isRetryable;
1251
+ private sleep;
1252
+ }
1253
+ /**
1254
+ * Create a task compaction service
1255
+ */
1256
+ declare function createCompactionService(apiKey?: string): TaskCompactionService;
1257
+
1258
+ /**
1259
+ * Task Auto-Complete Detection
1260
+ *
1261
+ * Detects task references from multiple sources:
1262
+ * - Branch names: feature/VT-42-description
1263
+ * - Commit messages: "Fixes VT-42, closes VT-43"
1264
+ * - PR titles: "[VT-42] Add login feature"
1265
+ * - PR bodies: "Closes VT-42, VT-43, VT-44"
1266
+ *
1267
+ * Uses the issue-parser library (2M+ weekly downloads) from semantic-release.
1268
+ *
1269
+ * @see https://github.com/semantic-release/issue-parser
1270
+ */
1271
+ type TaskRefAction = 'close' | 'progress';
1272
+ type TaskRefSource = 'commit_message' | 'branch_name' | 'pr_title' | 'pr_body' | 'issue_body';
1273
+ interface TaskReference {
1274
+ /** The task short ID (e.g., "42") */
1275
+ taskId: string;
1276
+ /** What action to take: close the task or mark as in progress */
1277
+ action: TaskRefAction;
1278
+ /** Where the reference was found */
1279
+ source: TaskRefSource;
1280
+ /** The raw matched text (e.g., "VT-42", "#42") */
1281
+ raw: string;
1282
+ /** The prefix used (e.g., "VT-", "#") */
1283
+ prefix?: string;
1284
+ }
1285
+ interface GitHubCommit {
1286
+ id: string;
1287
+ message: string;
1288
+ author?: {
1289
+ name?: string;
1290
+ email?: string;
1291
+ username?: string;
1292
+ };
1293
+ timestamp?: string;
1294
+ url?: string;
1295
+ }
1296
+ interface GitHubPullRequest {
1297
+ number: number;
1298
+ title: string;
1299
+ body: string | null;
1300
+ html_url: string;
1301
+ head: {
1302
+ ref: string;
1303
+ };
1304
+ merged: boolean;
1305
+ merged_by?: {
1306
+ login: string;
1307
+ };
1308
+ }
1309
+ interface ExtractTaskRefsOptions {
1310
+ /** Array of commit objects with message field */
1311
+ commits?: GitHubCommit[];
1312
+ /** Branch name (e.g., "feature/VT-42-fix-login") */
1313
+ branchName?: string;
1314
+ /** PR title */
1315
+ prTitle?: string;
1316
+ /** PR body/description */
1317
+ prBody?: string;
1318
+ }
1319
+ interface AutoCompleteResult {
1320
+ /** Tasks to mark as complete */
1321
+ tasksToClose: TaskReference[];
1322
+ /** Tasks to mark as in progress */
1323
+ tasksToProgress: TaskReference[];
1324
+ /** All unique task IDs referenced */
1325
+ allTaskIds: string[];
1326
+ }
1327
+ /**
1328
+ * Extract task IDs from a branch name.
1329
+ */
1330
+ declare function extractFromBranch(branchName: string): TaskReference | null;
1331
+ /**
1332
+ * Extract task references from a single text (commit message, PR title, etc.)
1333
+ */
1334
+ declare function extractFromText(text: string, source: TaskRefSource): TaskReference[];
1335
+ /**
1336
+ * Extract task references from all provided sources.
1337
+ *
1338
+ * @example
1339
+ * ```typescript
1340
+ * const refs = extractTaskRefs({
1341
+ * commits: [{ message: "Fix VT-42, closes VT-43" }],
1342
+ * branchName: "feature/VT-42-fix-login",
1343
+ * prTitle: "[VT-42] Fix login bug",
1344
+ * prBody: "This PR fixes VT-42 and also addresses VT-44",
1345
+ * });
1346
+ * ```
1347
+ */
1348
+ declare function extractTaskRefs(options: ExtractTaskRefsOptions): TaskReference[];
1349
+ /**
1350
+ * Process extracted refs into a structured result.
1351
+ */
1352
+ declare function processTaskRefs(options: ExtractTaskRefsOptions): AutoCompleteResult;
1353
+ /**
1354
+ * Create a standardized branch name from a task.
1355
+ *
1356
+ * @example
1357
+ * ```typescript
1358
+ * createBranchName({ short_id: 42, title: "Fix Login Bug!" }, "fix")
1359
+ * // => "fix/VT-42-fix-login-bug"
1360
+ * ```
1361
+ */
1362
+ declare function createBranchName(task: {
1363
+ short_id: number;
1364
+ title: string;
1365
+ }, type?: 'feature' | 'fix' | 'bugfix' | 'hotfix' | 'chore' | 'refactor' | 'docs' | 'test'): string;
1366
+ /**
1367
+ * Check if a branch name contains a task reference.
1368
+ */
1369
+ declare function branchHasTaskRef(branchName: string): boolean;
1370
+ /**
1371
+ * Get the task ID from a branch name, if present.
1372
+ */
1373
+ declare function getTaskIdFromBranch(branchName: string): string | null;
1374
+ /**
1375
+ * Process a GitHub push event to extract task references from all commits.
1376
+ */
1377
+ declare function processGitHubPush(payload: {
1378
+ ref: string;
1379
+ commits: GitHubCommit[];
1380
+ }): AutoCompleteResult;
1381
+ /**
1382
+ * Process a GitHub pull_request event to extract task references.
1383
+ */
1384
+ declare function processGitHubPullRequest(payload: {
1385
+ action: string;
1386
+ pull_request: GitHubPullRequest;
1387
+ }): AutoCompleteResult;
1388
+ /**
1389
+ * Generate completion notes for a task closed via GitHub.
1390
+ */
1391
+ declare function generateCompletionNotes(options: {
1392
+ source: 'push' | 'pr_merged';
1393
+ prNumber?: number;
1394
+ prUrl?: string;
1395
+ mergedBy?: string;
1396
+ commitId?: string;
1397
+ branchName?: string;
1398
+ }): string;
1399
+
1400
+ export { type Attachment, AuthManager, type AutoCompleteResult, type ChangeType, ClaudeSync, type ClaudeTodoItem, type CodebaseContext, type CompactionOptions, type CompactionResult, ConfigManager, type ContextLoaderOptions, type ExtractTaskRefsOptions, type GitHubCommit, type GitHubPullRequest, type IntegrationSyncResult, IntegrationSyncService, type RLMConfig, RLMContextLoader, RLMEngine, RLMMCPTool, type RLMQueryInput, type RLMQueryOutput, type RLMResult, RLM_MCP_TOOLS, type SourceType, type Subtask, type SupabaseConfig, type SyncAllResult, type SyncOptions, type SyncResult, type Tag, type Task$1 as Task, type TaskChange, TaskCompactionService, type TaskFlowConfig, TaskOperations, type TaskRefAction, type TaskRefSource, type TaskReference, type Workspace, batchProcessTasksWithClaude, branchHasTaskRef, createBranchName, createCompactionService, createSupabaseClient, createSupabaseClientFromEnv, extractFromBranch, extractFromText, extractIntent, extractIntentWithClaude, extractTaskRefs, generateCompletionNotes, generateContextTags, generateContextTagsWithClaude, generateTaskEmbedding, generateTaskEmbeddingWithClaude, getTaskIdFromBranch, processGitHubPullRequest, processGitHubPush, processTaskRefs, syncClaudeTodos };