byterover-cli 1.7.2 → 1.8.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 (66) hide show
  1. package/README.md +17 -3
  2. package/dist/agent/core/domain/tools/constants.d.ts +0 -15
  3. package/dist/agent/core/domain/tools/constants.js +0 -15
  4. package/dist/agent/core/interfaces/i-cipher-agent.d.ts +6 -0
  5. package/dist/agent/core/interfaces/i-curate-service.d.ts +12 -0
  6. package/dist/agent/infra/llm/internal-llm-service.d.ts +13 -0
  7. package/dist/agent/infra/llm/internal-llm-service.js +61 -21
  8. package/dist/agent/infra/tools/implementations/curate-tool.d.ts +133 -0
  9. package/dist/agent/infra/tools/implementations/curate-tool.js +14 -0
  10. package/dist/agent/infra/tools/implementations/search-knowledge-service.js +91 -14
  11. package/dist/agent/infra/tools/index.d.ts +0 -4
  12. package/dist/agent/infra/tools/index.js +0 -4
  13. package/dist/agent/infra/tools/tool-registry.js +0 -113
  14. package/dist/agent/resources/prompts/curate-detail-preservation.yml +73 -0
  15. package/dist/agent/resources/prompts/system-prompt.yml +69 -3
  16. package/dist/server/core/domain/knowledge/markdown-writer.d.ts +13 -0
  17. package/dist/server/core/domain/knowledge/markdown-writer.js +116 -8
  18. package/dist/server/infra/executor/curate-executor.js +1 -1
  19. package/dist/server/infra/executor/direct-search-responder.d.ts +45 -0
  20. package/dist/server/infra/executor/direct-search-responder.js +86 -0
  21. package/dist/server/infra/executor/folder-pack-executor.d.ts +13 -5
  22. package/dist/server/infra/executor/folder-pack-executor.js +739 -39
  23. package/dist/server/infra/executor/query-executor.d.ts +49 -3
  24. package/dist/server/infra/executor/query-executor.js +194 -9
  25. package/dist/server/infra/executor/query-result-cache.d.ts +87 -0
  26. package/dist/server/infra/executor/query-result-cache.js +127 -0
  27. package/dist/server/infra/executor/query-similarity.d.ts +28 -0
  28. package/dist/server/infra/executor/query-similarity.js +41 -0
  29. package/dist/server/infra/process/agent-worker.js +9 -2
  30. package/dist/server/infra/process/inline-agent-executor.js +16 -5
  31. package/dist/server/infra/usecase/curate-use-case.js +6 -1
  32. package/dist/server/infra/usecase/query-use-case.js +10 -0
  33. package/dist/server/utils/file-validator.js +78 -1
  34. package/dist/tui/hooks/use-slash-completion.js +25 -4
  35. package/oclif.manifest.json +1 -1
  36. package/package.json +1 -1
  37. package/dist/agent/infra/tools/implementations/bash-exec-tool.d.ts +0 -13
  38. package/dist/agent/infra/tools/implementations/bash-exec-tool.js +0 -110
  39. package/dist/agent/infra/tools/implementations/bash-output-tool.d.ts +0 -12
  40. package/dist/agent/infra/tools/implementations/bash-output-tool.js +0 -43
  41. package/dist/agent/infra/tools/implementations/batch-tool.d.ts +0 -12
  42. package/dist/agent/infra/tools/implementations/batch-tool.js +0 -142
  43. package/dist/agent/infra/tools/implementations/create-knowledge-topic-tool.d.ts +0 -11
  44. package/dist/agent/infra/tools/implementations/create-knowledge-topic-tool.js +0 -149
  45. package/dist/agent/infra/tools/implementations/delete-memory-tool.d.ts +0 -12
  46. package/dist/agent/infra/tools/implementations/delete-memory-tool.js +0 -37
  47. package/dist/agent/infra/tools/implementations/edit-file-tool.d.ts +0 -13
  48. package/dist/agent/infra/tools/implementations/edit-file-tool.js +0 -50
  49. package/dist/agent/infra/tools/implementations/edit-memory-tool.d.ts +0 -13
  50. package/dist/agent/infra/tools/implementations/edit-memory-tool.js +0 -53
  51. package/dist/agent/infra/tools/implementations/kill-process-tool.d.ts +0 -12
  52. package/dist/agent/infra/tools/implementations/kill-process-tool.js +0 -55
  53. package/dist/agent/infra/tools/implementations/list-memories-tool.d.ts +0 -12
  54. package/dist/agent/infra/tools/implementations/list-memories-tool.js +0 -63
  55. package/dist/agent/infra/tools/implementations/read-memory-tool.d.ts +0 -12
  56. package/dist/agent/infra/tools/implementations/read-memory-tool.js +0 -39
  57. package/dist/agent/infra/tools/implementations/read-todos-tool.d.ts +0 -11
  58. package/dist/agent/infra/tools/implementations/read-todos-tool.js +0 -39
  59. package/dist/agent/infra/tools/implementations/search-history-tool.d.ts +0 -10
  60. package/dist/agent/infra/tools/implementations/search-history-tool.js +0 -36
  61. package/dist/agent/infra/tools/implementations/spec-analyze-tool.d.ts +0 -7
  62. package/dist/agent/infra/tools/implementations/spec-analyze-tool.js +0 -78
  63. package/dist/agent/infra/tools/implementations/write-memory-tool.d.ts +0 -13
  64. package/dist/agent/infra/tools/implementations/write-memory-tool.js +0 -52
  65. package/dist/agent/infra/tools/implementations/write-todos-tool.d.ts +0 -13
  66. package/dist/agent/infra/tools/implementations/write-todos-tool.js +0 -121
@@ -1,78 +0,0 @@
1
- import { z } from 'zod';
2
- import { ToolName } from '../../../core/domain/tools/constants.js';
3
- /**
4
- * Domain category for knowledge classification.
5
- * Domains are created dynamically based on content semantics.
6
- */
7
- const DomainCategory = z
8
- .string()
9
- .min(1)
10
- .describe('Domain category name. Create semantically meaningful domain names based on content (e.g., authentication, api_design, data_models). Use snake_case format.');
11
- /**
12
- * Text segment schema - represents a portion of the input data related to a domain
13
- */
14
- const TextSegmentSchema = z
15
- .string()
16
- .min(1)
17
- .describe('A segment of text from the input data that relates to this domain category');
18
- /**
19
- * Input schema for detect domains tool
20
- */
21
- const DetectDomainsInputSchema = z
22
- .object({
23
- /** Detected domains with metadata and related text segments */
24
- domains: z
25
- .array(z.object({
26
- category: DomainCategory.describe('Semantically meaningful domain category name (snake_case, e.g., authentication, api_design)'),
27
- textSegments: z
28
- .array(TextSegmentSchema)
29
- .min(1)
30
- .describe('Array of text segments from the input data that relate to this domain. Each segment should be a meaningful excerpt that demonstrates why this domain is relevant.'),
31
- }))
32
- .describe('Array of detected domains with their related text segments from the input data'),
33
- });
34
- /**
35
- * Execute function for detect domains tool with typed input
36
- */
37
- async function executeDetectDomains(input, _context) {
38
- const { domains } = input;
39
- return {
40
- domains,
41
- };
42
- }
43
- /**
44
- * Creates the detect domains tool.
45
- *
46
- * @returns Configured detect domains tool
47
- */
48
- export function createSpecAnalyzeTool() {
49
- return {
50
- description: `Use this tool to analyze input data and detect which knowledge domains are present. For each detected domain, you must also extract the specific text segments from the input data that relate to that domain.
51
-
52
- This tool should be the first tool to call when you want to understand new data, unless you already know what you are looking for.
53
-
54
- **Dynamic Domain Creation:**
55
- Domains are created dynamically based on the semantics of the content. Choose domain names that:
56
- - Are descriptive and semantically meaningful
57
- - Use snake_case format (1-3 words)
58
- - Group related concepts together
59
- - Examples: \`authentication\`, \`api_design\`, \`data_models\`, \`error_handling\`, \`ui_components\`, \`testing_patterns\`
60
-
61
- **For each domain you detect:**
62
- 1. Create a semantically meaningful domain category name based on the content
63
- 2. Extract relevant text segments from the input data that demonstrate why this domain is relevant
64
- 3. Each text segment should be a meaningful excerpt (not just keywords) that shows the connection to the domain
65
- 4. Only include domains that are actually present in the data
66
-
67
- **Domain Naming Guidelines:**
68
- - Use noun-based names that describe the category (e.g., \`authentication\` not \`how_to_authenticate\`)
69
- - Avoid overly generic names (e.g., \`misc\`, \`other\`, \`general\`)
70
- - Avoid overly specific names that only fit one topic
71
- - Consolidate related concepts under the same domain
72
-
73
- The text segments will be used later to create organized knowledge topics, so they should be substantial enough to provide context.`,
74
- execute: executeDetectDomains,
75
- id: ToolName.SPEC_ANALYZE,
76
- inputSchema: DetectDomainsInputSchema,
77
- };
78
- }
@@ -1,13 +0,0 @@
1
- import type { Tool } from '../../../core/domain/tools/types.js';
2
- import type { MemoryManager } from '../../memory/memory-manager.js';
3
- /**
4
- * Creates the write memory tool.
5
- *
6
- * Stores content in the agent's memory as a scratch pad for maintaining context
7
- * across tool invocations. Memories persist across sessions and can be tagged
8
- * for organization.
9
- *
10
- * @param memoryManager - Memory manager service dependency
11
- * @returns Configured write memory tool
12
- */
13
- export declare function createWriteMemoryTool(memoryManager: MemoryManager): Tool;
@@ -1,52 +0,0 @@
1
- import { z } from 'zod';
2
- import { ToolName } from '../../../core/domain/tools/constants.js';
3
- /**
4
- * Input schema for write memory tool.
5
- */
6
- const WriteMemoryInputSchema = z
7
- .object({
8
- content: z
9
- .string()
10
- .min(1, 'Memory content cannot be empty')
11
- .max(10_000, 'Memory content cannot exceed 10,000 characters')
12
- .describe('The content to store in memory'),
13
- pinned: z
14
- .boolean()
15
- .optional()
16
- .describe('Whether to pin this memory for auto-loading (default: false)'),
17
- })
18
- .strict();
19
- /**
20
- * Creates the write memory tool.
21
- *
22
- * Stores content in the agent's memory as a scratch pad for maintaining context
23
- * across tool invocations. Memories persist across sessions and can be tagged
24
- * for organization.
25
- *
26
- * @param memoryManager - Memory manager service dependency
27
- * @returns Configured write memory tool
28
- */
29
- export function createWriteMemoryTool(memoryManager) {
30
- return {
31
- description: 'Write content to agent memory as a scratch pad. Use this to store intermediate results, findings, or context that should persist across tool calls. Memories can be tagged and pinned for easy retrieval.',
32
- async execute(input, _context) {
33
- const { content, pinned } = input;
34
- // Create memory with agent source
35
- const memory = await memoryManager.create({
36
- content,
37
- metadata: {
38
- pinned: pinned ?? false,
39
- source: 'agent',
40
- },
41
- });
42
- // Return formatted result
43
- return {
44
- content: memory.content,
45
- createdAt: new Date(memory.createdAt).toISOString(),
46
- id: memory.id,
47
- };
48
- },
49
- id: ToolName.WRITE_MEMORY,
50
- inputSchema: WriteMemoryInputSchema,
51
- };
52
- }
@@ -1,13 +0,0 @@
1
- import type { Tool } from '../../../core/domain/tools/types.js';
2
- import type { ITodoStorage } from '../../../core/interfaces/i-todo-storage.js';
3
- /**
4
- * Creates the write todos tool.
5
- *
6
- * Manages a structured task list for planning-based execution.
7
- * Validates that only one task is in_progress at any time.
8
- * Stores todos in session-based storage.
9
- *
10
- * @param todoStorage - Storage service for persisting todos
11
- * @returns Configured write todos tool
12
- */
13
- export declare function createWriteTodosTool(todoStorage: ITodoStorage): Tool;
@@ -1,121 +0,0 @@
1
- import { z } from 'zod';
2
- import { TODO_STATUSES } from '../../../core/domain/todos/types.js';
3
- import { ToolName } from '../../../core/domain/tools/constants.js';
4
- /**
5
- * Schema for a single todo item.
6
- */
7
- const TodoSchema = z.object({
8
- activeForm: z
9
- .string()
10
- .min(1)
11
- .describe('Present continuous form shown during execution (e.g., "Running tests")'),
12
- content: z.string().min(1).describe('Imperative description of the task (e.g., "Run tests")'),
13
- id: z.string().min(1).describe('Unique identifier for the todo item'),
14
- status: z
15
- .enum(TODO_STATUSES)
16
- .describe('Task status: pending, in_progress (only ONE at a time), completed, or cancelled'),
17
- });
18
- /**
19
- * Input schema for write todos tool.
20
- */
21
- const WriteTodosInputSchema = z
22
- .object({
23
- todos: z.array(TodoSchema).min(1).describe('List of todo items to track'),
24
- })
25
- .strict();
26
- /**
27
- * Tool description with detailed usage guidance.
28
- * This helps the LLM understand when to use the tool and how.
29
- */
30
- const TOOL_DESCRIPTION = `Use this tool to create and manage a structured task list for the current session.`;
31
- /**
32
- * Validates that only one todo is in_progress.
33
- *
34
- * @param todos - Array of todos to validate
35
- * @returns Error message if invalid, null if valid
36
- */
37
- function validateSingleInProgress(todos) {
38
- const inProgressCount = todos.filter((todo) => todo.status === 'in_progress').length;
39
- if (inProgressCount > 1) {
40
- return `Invalid parameters: Only one task can be "in_progress" at a time. Found ${inProgressCount} tasks in progress.`;
41
- }
42
- return null;
43
- }
44
- /**
45
- * Formats the todo list for LLM response.
46
- * Uses opencode-style status icons: [✓] for completed, [ ] for others.
47
- *
48
- * @param todos - Array of todos
49
- * @returns Formatted string representation
50
- */
51
- function formatTodosForLLM(todos) {
52
- const lines = ['Todo list updated:'];
53
- for (const todo of todos) {
54
- const checkbox = todo.status === 'completed' ? '[✓]' : '[ ]';
55
- const statusLabel = todo.status === 'in_progress' ? ' (in_progress)' : '';
56
- lines.push(`${checkbox} ${todo.content}${statusLabel}`);
57
- }
58
- const stats = getTodoStats(todos);
59
- const progressLines = ['', `Progress: ${stats.completed}/${stats.total} completed`];
60
- if (stats.inProgress > 0) {
61
- const currentTask = todos.find((t) => t.status === 'in_progress');
62
- if (currentTask) {
63
- progressLines.push(`Currently: ${currentTask.activeForm}`);
64
- }
65
- }
66
- return [...lines, ...progressLines].join('\n');
67
- }
68
- /**
69
- * Gets statistics about the todo list.
70
- *
71
- * @param todos - Array of todos
72
- * @returns Statistics object
73
- */
74
- function getTodoStats(todos) {
75
- return {
76
- cancelled: todos.filter((t) => t.status === 'cancelled').length,
77
- completed: todos.filter((t) => t.status === 'completed').length,
78
- inProgress: todos.filter((t) => t.status === 'in_progress').length,
79
- pending: todos.filter((t) => t.status === 'pending').length,
80
- total: todos.length,
81
- };
82
- }
83
- /**
84
- * Creates the write todos tool.
85
- *
86
- * Manages a structured task list for planning-based execution.
87
- * Validates that only one task is in_progress at any time.
88
- * Stores todos in session-based storage.
89
- *
90
- * @param todoStorage - Storage service for persisting todos
91
- * @returns Configured write todos tool
92
- */
93
- export function createWriteTodosTool(todoStorage) {
94
- return {
95
- description: TOOL_DESCRIPTION,
96
- async execute(input, context) {
97
- const { todos } = input;
98
- // Validate only one in_progress
99
- const validationError = validateSingleInProgress(todos);
100
- if (validationError) {
101
- return validationError;
102
- }
103
- // Store todos in session storage
104
- const sessionId = context?.sessionId ?? 'default';
105
- await todoStorage.update(sessionId, todos);
106
- // Format response for LLM
107
- const llmContent = formatTodosForLLM(todos);
108
- // Calculate incomplete count for smart title
109
- const incompleteCount = todos.filter((t) => t.status !== 'completed').length;
110
- // Return both LLM content and display content with metadata
111
- return {
112
- llmContent,
113
- metadata: { todos },
114
- returnDisplay: { todos },
115
- title: `${incompleteCount} todos`,
116
- };
117
- },
118
- id: ToolName.WRITE_TODOS,
119
- inputSchema: WriteTodosInputSchema,
120
- };
121
- }