oricore 1.0.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 (221) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +199 -0
  3. package/dist/agent/agent/agentManager.d.ts +38 -0
  4. package/dist/agent/agent/builtin/common.d.ts +5 -0
  5. package/dist/agent/agent/builtin/explore.d.ts +5 -0
  6. package/dist/agent/agent/builtin/general-purpose.d.ts +5 -0
  7. package/dist/agent/agent/builtin/index.d.ts +5 -0
  8. package/dist/agent/agent/executor.d.ts +2 -0
  9. package/dist/agent/agent/types.d.ts +98 -0
  10. package/dist/api/engine.d.ts +213 -0
  11. package/dist/communication/index.d.ts +4 -0
  12. package/dist/communication/messageBus.d.ts +71 -0
  13. package/dist/core/at.d.ts +26 -0
  14. package/dist/core/backgroundTaskManager.d.ts +27 -0
  15. package/dist/core/compact.d.ts +9 -0
  16. package/dist/core/config.d.ts +103 -0
  17. package/dist/core/constants.d.ts +32 -0
  18. package/dist/core/context.d.ts +57 -0
  19. package/dist/core/globalData.d.ts +21 -0
  20. package/dist/core/history.d.ts +24 -0
  21. package/dist/core/ide.d.ts +103 -0
  22. package/dist/core/jsonl.d.ts +37 -0
  23. package/dist/core/llmsContext.d.ts +14 -0
  24. package/dist/core/loop.d.ts +82 -0
  25. package/dist/core/message.d.ts +132 -0
  26. package/dist/core/model.d.ts +79 -0
  27. package/dist/core/output-style/builtin/default.d.ts +2 -0
  28. package/dist/core/output-style/builtin/explanatory.d.ts +2 -0
  29. package/dist/core/output-style/builtin/index.d.ts +6 -0
  30. package/dist/core/output-style/builtin/miao.d.ts +2 -0
  31. package/dist/core/output-style/builtin/minimal.d.ts +2 -0
  32. package/dist/core/output-style/types.d.ts +6 -0
  33. package/dist/core/outputFormat.d.ts +29 -0
  34. package/dist/core/outputStyle.d.ts +43 -0
  35. package/dist/core/paths.d.ts +20 -0
  36. package/dist/core/planSystemPrompt.d.ts +5 -0
  37. package/dist/core/plugin.d.ts +138 -0
  38. package/dist/core/project.d.ts +64 -0
  39. package/dist/core/promptCache.d.ts +3 -0
  40. package/dist/core/query.d.ts +14 -0
  41. package/dist/core/rules.d.ts +8 -0
  42. package/dist/core/systemPrompt.d.ts +9 -0
  43. package/dist/core/thinking-config.d.ts +3 -0
  44. package/dist/core/usage.d.ts +14 -0
  45. package/dist/index.d.ts +16 -0
  46. package/dist/index.js +144432 -0
  47. package/dist/mcp/mcp.d.ts +49 -0
  48. package/dist/modes/builtin.d.ts +34 -0
  49. package/dist/modes/index.d.ts +8 -0
  50. package/dist/modes/registry.d.ts +18 -0
  51. package/dist/modes/types.d.ts +51 -0
  52. package/dist/platform/index.d.ts +5 -0
  53. package/dist/platform/node.d.ts +28 -0
  54. package/dist/platform/types.d.ts +41 -0
  55. package/dist/session/session.d.ts +43 -0
  56. package/dist/skill/skill.d.ts +79 -0
  57. package/dist/tools/tool.d.ts +119 -0
  58. package/dist/tools/tools/askUserQuestion.d.ts +48 -0
  59. package/dist/tools/tools/bash.d.ts +43 -0
  60. package/dist/tools/tools/edit.d.ts +9 -0
  61. package/dist/tools/tools/fetch.d.ts +9 -0
  62. package/dist/tools/tools/glob.d.ts +7 -0
  63. package/dist/tools/tools/grep.d.ts +22 -0
  64. package/dist/tools/tools/ls.d.ts +6 -0
  65. package/dist/tools/tools/read.d.ts +9 -0
  66. package/dist/tools/tools/skill.d.ts +7 -0
  67. package/dist/tools/tools/task.d.ts +14 -0
  68. package/dist/tools/tools/todo.d.ts +37 -0
  69. package/dist/tools/tools/write.d.ts +7 -0
  70. package/dist/utils/apiKeyRotation.d.ts +2 -0
  71. package/dist/utils/applyEdit.d.ts +17 -0
  72. package/dist/utils/background-detection.d.ts +2 -0
  73. package/dist/utils/dotenv.d.ts +9 -0
  74. package/dist/utils/env.d.ts +6 -0
  75. package/dist/utils/error.d.ts +11 -0
  76. package/dist/utils/execFileNoThrow.d.ts +8 -0
  77. package/dist/utils/files.d.ts +10 -0
  78. package/dist/utils/git.d.ts +163 -0
  79. package/dist/utils/ide.d.ts +27 -0
  80. package/dist/utils/ignore.d.ts +6 -0
  81. package/dist/utils/isLocal.d.ts +1 -0
  82. package/dist/utils/language.d.ts +9 -0
  83. package/dist/utils/list.d.ts +20 -0
  84. package/dist/utils/mergeSystemMessagesMiddleware.d.ts +2 -0
  85. package/dist/utils/messageNormalization.d.ts +22 -0
  86. package/dist/utils/path.d.ts +34 -0
  87. package/dist/utils/prependSystemMessageMiddleware.d.ts +2 -0
  88. package/dist/utils/project.d.ts +1 -0
  89. package/dist/utils/proxy.d.ts +18 -0
  90. package/dist/utils/randomUUID.d.ts +5 -0
  91. package/dist/utils/renderSessionMarkdown.d.ts +10 -0
  92. package/dist/utils/ripgrep.d.ts +16 -0
  93. package/dist/utils/safeFrontMatter.d.ts +11 -0
  94. package/dist/utils/safeParseJson.d.ts +1 -0
  95. package/dist/utils/safeStringify.d.ts +1 -0
  96. package/dist/utils/sanitizeAIResponse.d.ts +30 -0
  97. package/dist/utils/setTerminalTitle.d.ts +1 -0
  98. package/dist/utils/shell-execution.d.ts +44 -0
  99. package/dist/utils/string.d.ts +8 -0
  100. package/dist/utils/symbols.d.ts +14 -0
  101. package/dist/utils/system-encoding.d.ts +40 -0
  102. package/dist/utils/tokenCounter.d.ts +8 -0
  103. package/dist/utils/username.d.ts +1 -0
  104. package/package.json +106 -0
  105. package/src/agent/agent/agentManager.test.ts +124 -0
  106. package/src/agent/agent/agentManager.ts +372 -0
  107. package/src/agent/agent/builtin/common.ts +20 -0
  108. package/src/agent/agent/builtin/explore.ts +53 -0
  109. package/src/agent/agent/builtin/general-purpose.ts +38 -0
  110. package/src/agent/agent/builtin/index.ts +13 -0
  111. package/src/agent/agent/executor.test.ts +339 -0
  112. package/src/agent/agent/executor.ts +224 -0
  113. package/src/agent/agent/types.ts +119 -0
  114. package/src/api/engine.ts +466 -0
  115. package/src/communication/index.ts +18 -0
  116. package/src/communication/messageBus.ts +393 -0
  117. package/src/core/at.ts +315 -0
  118. package/src/core/backgroundTaskManager.ts +129 -0
  119. package/src/core/compact.ts +95 -0
  120. package/src/core/config.ts +441 -0
  121. package/src/core/constants.ts +82 -0
  122. package/src/core/context.ts +214 -0
  123. package/src/core/globalData.ts +77 -0
  124. package/src/core/history.ts +323 -0
  125. package/src/core/ide.ts +325 -0
  126. package/src/core/jsonl.ts +100 -0
  127. package/src/core/llmsContext.ts +117 -0
  128. package/src/core/loop.ts +638 -0
  129. package/src/core/message.ts +304 -0
  130. package/src/core/model.ts +2198 -0
  131. package/src/core/output-style/builtin/default.ts +9 -0
  132. package/src/core/output-style/builtin/explanatory.ts +22 -0
  133. package/src/core/output-style/builtin/index.ts +19 -0
  134. package/src/core/output-style/builtin/miao.ts +22 -0
  135. package/src/core/output-style/builtin/minimal.ts +8 -0
  136. package/src/core/output-style/types.ts +6 -0
  137. package/src/core/outputFormat.ts +93 -0
  138. package/src/core/outputStyle.ts +255 -0
  139. package/src/core/paths.ts +161 -0
  140. package/src/core/planSystemPrompt.ts +46 -0
  141. package/src/core/plugin.ts +299 -0
  142. package/src/core/project.ts +492 -0
  143. package/src/core/promptCache.ts +32 -0
  144. package/src/core/query.ts +46 -0
  145. package/src/core/rules.ts +56 -0
  146. package/src/core/systemPrompt.ts +176 -0
  147. package/src/core/thinking-config.ts +98 -0
  148. package/src/core/usage.ts +68 -0
  149. package/src/index.ts +39 -0
  150. package/src/mcp/mcp.ts +637 -0
  151. package/src/modes/builtin.ts +305 -0
  152. package/src/modes/index.ts +22 -0
  153. package/src/modes/registry.ts +39 -0
  154. package/src/modes/types.ts +56 -0
  155. package/src/platform/index.ts +6 -0
  156. package/src/platform/node.ts +108 -0
  157. package/src/platform/types.ts +54 -0
  158. package/src/plugins/index.ts +15 -0
  159. package/src/session/session.ts +187 -0
  160. package/src/skill/skill.ts +702 -0
  161. package/src/tools/tool.ts +378 -0
  162. package/src/tools/tools/askUserQuestion.ts +134 -0
  163. package/src/tools/tools/bash.test.ts +425 -0
  164. package/src/tools/tools/bash.ts +999 -0
  165. package/src/tools/tools/edit.ts +86 -0
  166. package/src/tools/tools/fetch.ts +129 -0
  167. package/src/tools/tools/glob.ts +69 -0
  168. package/src/tools/tools/grep.test.ts +194 -0
  169. package/src/tools/tools/grep.ts +358 -0
  170. package/src/tools/tools/ls.ts +51 -0
  171. package/src/tools/tools/read.test.ts +169 -0
  172. package/src/tools/tools/read.ts +284 -0
  173. package/src/tools/tools/skill.ts +73 -0
  174. package/src/tools/tools/task.test.ts +262 -0
  175. package/src/tools/tools/task.ts +284 -0
  176. package/src/tools/tools/todo.ts +269 -0
  177. package/src/tools/tools/write.ts +71 -0
  178. package/src/types.d.ts +18 -0
  179. package/src/utils/apiKeyRotation.test.ts +70 -0
  180. package/src/utils/apiKeyRotation.ts +24 -0
  181. package/src/utils/applyEdit.test.ts +388 -0
  182. package/src/utils/applyEdit.ts +547 -0
  183. package/src/utils/background-detection.test.ts +61 -0
  184. package/src/utils/background-detection.ts +58 -0
  185. package/src/utils/dotenv.ts +26 -0
  186. package/src/utils/env.ts +90 -0
  187. package/src/utils/error.ts +38 -0
  188. package/src/utils/execFileNoThrow.ts +49 -0
  189. package/src/utils/files.ts +93 -0
  190. package/src/utils/git.ts +1152 -0
  191. package/src/utils/ide.ts +279 -0
  192. package/src/utils/ignore.ts +275 -0
  193. package/src/utils/isLocal.ts +6 -0
  194. package/src/utils/language.ts +33 -0
  195. package/src/utils/list.ts +200 -0
  196. package/src/utils/mergeSystemMessagesMiddleware.ts +32 -0
  197. package/src/utils/messageNormalization.test.ts +401 -0
  198. package/src/utils/messageNormalization.ts +168 -0
  199. package/src/utils/path.ts +98 -0
  200. package/src/utils/prependSystemMessageMiddleware.ts +16 -0
  201. package/src/utils/project.ts +32 -0
  202. package/src/utils/proxy.ts +102 -0
  203. package/src/utils/randomUUID.ts +11 -0
  204. package/src/utils/renderSessionMarkdown.ts +175 -0
  205. package/src/utils/ripgrep.ts +189 -0
  206. package/src/utils/safeFrontMatter.test.ts +118 -0
  207. package/src/utils/safeFrontMatter.ts +68 -0
  208. package/src/utils/safeParseJson.ts +7 -0
  209. package/src/utils/safeStringify.ts +10 -0
  210. package/src/utils/sanitizeAIResponse.test.ts +135 -0
  211. package/src/utils/sanitizeAIResponse.ts +55 -0
  212. package/src/utils/setTerminalTitle.ts +7 -0
  213. package/src/utils/shell-execution.test.ts +237 -0
  214. package/src/utils/shell-execution.ts +279 -0
  215. package/src/utils/string.ts +13 -0
  216. package/src/utils/symbols.ts +18 -0
  217. package/src/utils/system-encoding.test.ts +164 -0
  218. package/src/utils/system-encoding.ts +296 -0
  219. package/src/utils/tokenCounter.test.ts +38 -0
  220. package/src/utils/tokenCounter.ts +19 -0
  221. package/src/utils/username.ts +21 -0
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ declare const TodoItemSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ content: z.ZodString;
5
+ status: z.ZodEnum<{
6
+ completed: "completed";
7
+ pending: "pending";
8
+ in_progress: "in_progress";
9
+ }>;
10
+ priority: z.ZodEnum<{
11
+ low: "low";
12
+ medium: "medium";
13
+ high: "high";
14
+ }>;
15
+ }, z.core.$strip>;
16
+ export type TodoItem = z.infer<typeof TodoItemSchema>;
17
+ export declare function createTodoTool(opts: {
18
+ filePath: string;
19
+ }): {
20
+ todoWriteTool: import("../tool").Tool<z.ZodObject<{
21
+ todos: z.ZodArray<z.ZodObject<{
22
+ id: z.ZodString;
23
+ content: z.ZodString;
24
+ status: z.ZodEnum<{
25
+ completed: "completed";
26
+ pending: "pending";
27
+ in_progress: "in_progress";
28
+ }>;
29
+ priority: z.ZodEnum<{
30
+ low: "low";
31
+ medium: "medium";
32
+ high: "high";
33
+ }>;
34
+ }, z.core.$strip>>;
35
+ }, z.core.$strip>>;
36
+ };
37
+ export {};
@@ -0,0 +1,7 @@
1
+ import { z } from 'zod';
2
+ export declare function createWriteTool(opts: {
3
+ cwd: string;
4
+ }): import("../tool").Tool<z.ZodObject<{
5
+ file_path: z.ZodString;
6
+ content: z.ZodString;
7
+ }, z.core.$strip>>;
@@ -0,0 +1,2 @@
1
+ export declare function rotateApiKey(apiKey: string): string;
2
+ export declare function resetRotationIndex(): void;
@@ -0,0 +1,17 @@
1
+ export interface Edit {
2
+ old_string: string;
3
+ new_string: string;
4
+ replace_all?: boolean;
5
+ }
6
+ export interface Hunk {
7
+ oldStart: number;
8
+ oldLines: number;
9
+ newStart: number;
10
+ newLines: number;
11
+ lines: string[];
12
+ }
13
+ export declare function applyEdits(cwd: string, filePath: string, edits: Edit[]): {
14
+ patch: any;
15
+ updatedFile: string;
16
+ startLineNumber: number;
17
+ };
@@ -0,0 +1,2 @@
1
+ export declare function getCommandRoot(command: string): string | undefined;
2
+ export declare function shouldRunInBackground(command: string, elapsedMs: number, hasOutput: boolean, isCommandCompleted: boolean, userRequested?: boolean): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Load .env file from the specified directory
3
+ * Searches for .env files in the following order:
4
+ * 1. .env.local
5
+ * 2. .env
6
+ *
7
+ * @param cwd - Current working directory
8
+ */
9
+ export declare function loadEnvFile(cwd: string): void;
@@ -0,0 +1,6 @@
1
+ export declare function getEnv(): Promise<{
2
+ hasInternetAccess: boolean;
3
+ platform: string;
4
+ nodeVersion: string;
5
+ terminal: string | null;
6
+ }>;
@@ -0,0 +1,11 @@
1
+ export declare function getErrorMessage(error: unknown): string;
2
+ export declare class MaxFileReadLengthExceededError extends Error {
3
+ readonly maxFileLength: number;
4
+ readonly fileLength: number;
5
+ constructor(fileLength: number, maxFileLength: number);
6
+ }
7
+ export declare class MaxFileReadTokenExceededError extends Error {
8
+ readonly maxTokens: number;
9
+ readonly tokenCount: number;
10
+ constructor(tokenCount: number, maxTokens: number);
11
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * execFile, but always resolves (never throws)
3
+ */
4
+ export declare function execFileNoThrow(cwd: string, file: string, args: string[], abortSignal?: AbortSignal, timeout?: number, preserveOutputOnError?: boolean): Promise<{
5
+ stdout: string;
6
+ stderr: string;
7
+ code: number;
8
+ }>;
@@ -0,0 +1,10 @@
1
+ export interface FileItem {
2
+ path: string;
3
+ type: 'file' | 'directory';
4
+ name: string;
5
+ }
6
+ export declare function getFiles(opts: {
7
+ cwd: string;
8
+ maxSize: number;
9
+ query: string;
10
+ }): Promise<FileItem[]>;
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Check if git is installed and available in PATH
3
+ */
4
+ export declare function isGitInstalled(): Promise<boolean>;
5
+ /**
6
+ * Check if the given directory is inside a git repository
7
+ */
8
+ export declare function isGitRepository(cwd: string): Promise<boolean>;
9
+ /**
10
+ * Check if git user name and email are configured
11
+ */
12
+ export declare function isGitUserConfigured(cwd: string): Promise<{
13
+ name: boolean;
14
+ email: boolean;
15
+ }>;
16
+ /**
17
+ * Check if there are uncommitted changes (staged or unstaged)
18
+ */
19
+ export declare function hasUncommittedChanges(cwd: string): Promise<boolean>;
20
+ /**
21
+ * Get list of unstaged files with their status
22
+ * Returns files that have changes not yet staged (working tree changes)
23
+ */
24
+ export declare function getUnstagedFiles(cwd: string): Promise<Array<{
25
+ status: string;
26
+ file: string;
27
+ }>>;
28
+ /**
29
+ * Check if any remote is configured
30
+ */
31
+ export declare function hasRemote(cwd: string): Promise<boolean>;
32
+ /**
33
+ * Check if origin remote is configured
34
+ */
35
+ export declare function hasOriginRemote(cwd: string): Promise<boolean>;
36
+ /**
37
+ * Check if a branch exists
38
+ */
39
+ export declare function branchExists(cwd: string, branchName: string): Promise<boolean>;
40
+ /**
41
+ * Get recent commit messages
42
+ */
43
+ export declare function getRecentCommitMessages(cwd: string, count?: number): Promise<string>;
44
+ /**
45
+ * Stage all changes
46
+ */
47
+ export declare function stageAll(cwd: string): Promise<void>;
48
+ /**
49
+ * Commit staged changes with a message
50
+ * @param cwd - Working directory
51
+ * @param message - Commit message
52
+ * @param skipHooks - Skip pre-commit hooks
53
+ * @param onOutput - Optional callback for streaming output
54
+ */
55
+ export declare function gitCommit(cwd: string, message: string, skipHooks?: boolean, onOutput?: (line: string, stream: 'stdout' | 'stderr') => void): Promise<void>;
56
+ /**
57
+ * Push changes to remote
58
+ * @param cwd - Working directory
59
+ * @param onOutput - Optional callback for streaming output
60
+ */
61
+ export declare function gitPush(cwd: string, onOutput?: (line: string, stream: 'stdout' | 'stderr') => void): Promise<void>;
62
+ /**
63
+ * Create and checkout a new branch
64
+ */
65
+ export declare function createAndCheckoutBranch(cwd: string, branchName: string): Promise<void>;
66
+ export declare function getGitStatus(opts: {
67
+ cwd: string;
68
+ }): Promise<{
69
+ branch: string;
70
+ mainBranch: string;
71
+ status: string;
72
+ log: string;
73
+ author: string;
74
+ authorLog: string;
75
+ } | null>;
76
+ export declare function getLlmGitStatus(status: Awaited<ReturnType<typeof getGitStatus>>): Promise<string | null>;
77
+ /**
78
+ * Get remote origin URL
79
+ */
80
+ export declare function getGitRemoteUrl(cwd: string): Promise<string | null>;
81
+ /**
82
+ * Get default branch from remote
83
+ */
84
+ export declare function getDefaultBranch(cwd: string): Promise<string | null>;
85
+ /**
86
+ * Check sync status with remote
87
+ */
88
+ export declare function getGitSyncStatus(cwd: string): Promise<'synced' | 'ahead' | 'behind' | 'diverged' | 'unknown'>;
89
+ /**
90
+ * Get current commit hash
91
+ */
92
+ export declare function getCurrentCommit(cwd: string): Promise<string>;
93
+ /**
94
+ * Get list of pending changes
95
+ */
96
+ export declare function getPendingChanges(cwd: string): Promise<string[]>;
97
+ /**
98
+ * Get staged file list with status
99
+ */
100
+ export declare function getStagedFileList(cwd: string): Promise<string>;
101
+ /**
102
+ * Validate git repository URL format
103
+ */
104
+ export declare function validateGitUrl(url: string): boolean;
105
+ /**
106
+ * Sanitize git URL to prevent command injection
107
+ */
108
+ export declare function sanitizeGitUrl(url: string): string;
109
+ /**
110
+ * Validate destination path security
111
+ */
112
+ export declare function validateDestinationPath(destination: string): {
113
+ valid: boolean;
114
+ error?: string;
115
+ };
116
+ /**
117
+ * Extract repository name from git URL
118
+ */
119
+ export declare function extractRepoName(url: string): string;
120
+ /**
121
+ * Parse git clone progress output
122
+ */
123
+ export interface GitCloneProgress {
124
+ percent: number;
125
+ message: string;
126
+ }
127
+ export declare class GitCloneProgressParser {
128
+ private currentStage;
129
+ private stageProgress;
130
+ private lastOverallPercent;
131
+ parse(output: string): GitCloneProgress | null;
132
+ }
133
+ /**
134
+ * Clone repository options
135
+ */
136
+ export interface CloneRepositoryOptions {
137
+ url: string;
138
+ destination: string;
139
+ onProgress?: (progress: GitCloneProgress) => void;
140
+ signal?: AbortSignal;
141
+ timeoutMinutes?: number;
142
+ }
143
+ /**
144
+ * Clone repository result
145
+ */
146
+ export interface CloneRepositoryResult {
147
+ success: boolean;
148
+ clonePath?: string;
149
+ repoName?: string;
150
+ error?: string;
151
+ errorCode?: 'CANCELLED' | 'SSH_AUTH_FAILED' | 'AUTH_REQUIRED' | 'NETWORK_ERROR' | 'REPO_NOT_FOUND' | 'TIMEOUT' | 'GIT_NOT_INSTALLED' | 'INVALID_URL' | 'DIR_EXISTS' | 'UNKNOWN';
152
+ needsCredentials?: boolean;
153
+ }
154
+ /**
155
+ * Clone a git repository
156
+ */
157
+ export declare function cloneRepository(options: CloneRepositoryOptions): Promise<CloneRepositoryResult>;
158
+ /**
159
+ * Get the staged diff while handling large files
160
+ * - Excludes common lockfiles and large file types
161
+ * - Limits diff size to prevent context overflow
162
+ */
163
+ export declare function getStagedDiff(cwd: string): Promise<string>;
@@ -0,0 +1,27 @@
1
+ export declare const vscode_extension_id = "your-org.oricore-assistant";
2
+ export interface PlatformInfo {
3
+ terminal: string | null;
4
+ platform: string;
5
+ }
6
+ export interface CommandResult {
7
+ code: number;
8
+ stdout?: string;
9
+ stderr?: string;
10
+ error?: string;
11
+ }
12
+ export interface InstallationResult {
13
+ installed: boolean;
14
+ error: string | null;
15
+ installedVersion: string | null;
16
+ }
17
+ export declare function isVSCodeBased(terminal: string | null): boolean;
18
+ export declare function isJetBrainsBased(terminal: string | null): boolean;
19
+ export declare function getMacOSVSCodePath(): string | null;
20
+ export declare function getVSCodeCommand(terminal: string | null): string | null;
21
+ export declare function isExtensionInstalled(platformInfo: PlatformInfo): Promise<boolean>;
22
+ export declare function installExtension(platformInfo: PlatformInfo, vsixPath: string): Promise<string | null>;
23
+ export declare function getCleanEnvironment(platform: string): NodeJS.ProcessEnv;
24
+ export declare function getExtensionVersion(): string;
25
+ export declare function attemptInstallation(platformInfo: PlatformInfo, vsixPath: string): Promise<InstallationResult>;
26
+ export declare function getIDEDisplayName(terminal: string): string;
27
+ export declare function isRunningInSupportedIDE(platformInfo: PlatformInfo): boolean;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if a file or directory should be ignored based on ignore rules
3
+ */
4
+ export declare function isIgnored(filePath: string, rootPath: string, productNames?: string[]): boolean;
5
+ export declare function parseProductIgnorePatterns(rootPath: string, productNames: string[]): string[];
6
+ export declare function matchesAnyPattern(filePath: string, patterns: string[]): boolean;
@@ -0,0 +1 @@
1
+ export declare function isLocal(): boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Checks if the given language is English or English-related.
3
+ */
4
+ export declare function isEnglish(language: string): boolean;
5
+ /**
6
+ * Returns the language instruction string for prompts.
7
+ * Returns empty string if the language is English.
8
+ */
9
+ export declare function getLanguageInstruction(language: string, format?: 'communicate' | 'respond'): string;
@@ -0,0 +1,20 @@
1
+ export declare const MAX_FILES = 1000;
2
+ export declare const TRUNCATED_MESSAGE = "There are more than 1000 files in the repository. Use the LS tool (passing a specific path), Bash tool, and other tools to explore nested directories. The first 1000 files and directories are included below:\n\n";
3
+ export declare function listDirectory(initialPath: string, cwd: string, maxFiles?: number): string[];
4
+ export declare function listRootDirectory(rootPath: string): string[];
5
+ type TreeNode = {
6
+ name: string;
7
+ path: string;
8
+ type: 'file' | 'directory';
9
+ children?: TreeNode[];
10
+ };
11
+ export declare function createFileTree(sortedPaths: string[]): TreeNode[];
12
+ /**
13
+ * eg.
14
+ * - src/
15
+ * - index.ts
16
+ * - utils/
17
+ * - file.ts
18
+ */
19
+ export declare function printTree(cwd: string, tree: TreeNode[], level?: number, prefix?: string): string;
20
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { LanguageModelMiddleware } from 'ai';
2
+ export declare const mergeSystemMessagesMiddleware: LanguageModelMiddleware;
@@ -0,0 +1,22 @@
1
+ import type { NormalizedMessage } from '../core/message';
2
+ /**
3
+ * Normalizes messages for compacting by filtering out tool-related content
4
+ * while preserving the conversational flow and essential information.
5
+ *
6
+ * This function transforms tool calls and results into human-readable summaries
7
+ * to make the conversation history suitable for compression without losing
8
+ * important context about what operations were performed.
9
+ *
10
+ * For assistant messages:
11
+ * - Removes tool_use parts
12
+ * - Keeps text and reasoning parts
13
+ * - If no text content exists, converts reasoning to text for readability
14
+ * - If no content remains, uses a default placeholder
15
+ *
16
+ * For tool messages:
17
+ * - Converts to user messages with tool execution summaries
18
+ *
19
+ * @param messages - Array of normalized messages to process
20
+ * @returns Array of normalized messages with tool content converted to summaries
21
+ */
22
+ export declare function normalizeMessagesForCompact(messages: NormalizedMessage[]): NormalizedMessage[];
@@ -0,0 +1,34 @@
1
+ export declare function relativeToHome(p: string): string;
2
+ export type PathValidationResult = {
3
+ resultType: 'success';
4
+ absolutePath: string;
5
+ } | {
6
+ resultType: 'emptyPath';
7
+ } | {
8
+ resultType: 'pathNotFound';
9
+ directoryPath: string;
10
+ absolutePath: string;
11
+ } | {
12
+ resultType: 'notADirectory';
13
+ directoryPath: string;
14
+ absolutePath: string;
15
+ } | {
16
+ resultType: 'alreadyInWorkingDirectory';
17
+ directoryPath: string;
18
+ workingDir: string;
19
+ };
20
+ /**
21
+ * Check if childPath is within parentPath
22
+ */
23
+ export declare function isPathWithin(childPath: string, parentPath: string): boolean;
24
+ /**
25
+ * Validate directory path
26
+ * @param inputPath Path input by user
27
+ * @param existingDirectories List of existing working directories (including cwd)
28
+ * @returns Validation result
29
+ */
30
+ export declare function validateDirectoryPath(inputPath: string, existingDirectories: string[]): PathValidationResult;
31
+ /**
32
+ * Format validation result into user-friendly message
33
+ */
34
+ export declare function formatValidationMessage(result: PathValidationResult): string;
@@ -0,0 +1,2 @@
1
+ import type { LanguageModelMiddleware } from 'ai';
2
+ export declare const prependSystemMessageMiddleware: LanguageModelMiddleware;
@@ -0,0 +1 @@
1
+ export declare function isProjectDirectory(cwd: string): boolean;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * HTTP Proxy utilities for AI model providers
3
+ * Handles proxy configuration and custom fetch implementation
4
+ */
5
+ /**
6
+ * Create a custom fetch function that uses the specified proxy
7
+ * This wraps undici's fetch with the ProxyAgent
8
+ *
9
+ * Why needed: Bun's native fetch doesn't support HTTP_PROXY env vars,
10
+ * so we use undici's fetch with ProxyAgent to handle proxy requests
11
+ *
12
+ * @param proxyUrl - Proxy URL (e.g., http://127.0.0.1:7890 or socks5://127.0.0.1:1080)
13
+ * @returns A fetch-compatible function that routes requests through the configured proxy
14
+ * @example
15
+ * const proxyFetch = createProxyFetch('http://127.0.0.1:7890');
16
+ * await proxyFetch('https://api.openai.com/v1/models');
17
+ */
18
+ export declare function createProxyFetch(proxyUrl: string): typeof fetch;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generate a random UUID v4 compatible string
3
+ * Compatible with Node.js 18+ without using crypto module
4
+ */
5
+ export declare function randomUUID(): string;
@@ -0,0 +1,10 @@
1
+ import type { NormalizedMessage } from '../core/message';
2
+ export declare function renderSessionMarkdown(opts: {
3
+ sessionId: string;
4
+ title: string;
5
+ projectPath: string;
6
+ model: string | null;
7
+ messages: NormalizedMessage[];
8
+ createdAt: Date;
9
+ updatedAt: Date;
10
+ }): string;
@@ -0,0 +1,16 @@
1
+ export interface RipGrepResult {
2
+ success: boolean;
3
+ lines: string[];
4
+ exitCode: number | null;
5
+ stderr: string;
6
+ }
7
+ export declare function ripgrepPath(): string;
8
+ export declare function ripGrep(args: string[], target: string): Promise<RipGrepResult>;
9
+ export interface SearchFilesResult {
10
+ success: boolean;
11
+ data: {
12
+ paths: string[];
13
+ truncated: boolean;
14
+ };
15
+ }
16
+ export declare function searchFiles(cwd: string, query: string, maxResults?: number): Promise<SearchFilesResult>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Safely parse frontmatter from markdown content with automatic error recovery
3
+ * Handles common YAML issues like unquoted colons in values
4
+ * @param content - The markdown content with frontmatter
5
+ * @param filePath - Optional file path for better error messages
6
+ * @returns Parsed frontmatter attributes and body
7
+ */
8
+ export declare function safeFrontMatter<T = Record<string, string>>(content: string, filePath?: string): {
9
+ attributes: T;
10
+ body: string;
11
+ };
@@ -0,0 +1 @@
1
+ export declare function safeParseJson(json: string): any;
@@ -0,0 +1 @@
1
+ export declare function safeStringify(obj: any, fallbackMessage?: string): string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Utilities for sanitizing AI text responses by removing formatting artifacts.
3
+ * Composes: stripThinkTags → stripCodeBlocks → stripInlineCode → trim
4
+ */
5
+ /**
6
+ * Removes <think>...</think> tags from AI responses.
7
+ * Handles nested tags with non-greedy matching.
8
+ */
9
+ export declare function stripThinkTags(text: string): string;
10
+ /**
11
+ * Removes markdown code block formatting (```lang\n...\n```).
12
+ * Only strips if the entire response is wrapped in a single code block.
13
+ * Preserves multi-block responses.
14
+ * Trims input to handle leading/trailing whitespace before matching.
15
+ */
16
+ export declare function stripCodeBlocks(text: string): string;
17
+ /**
18
+ * Removes inline code formatting when entire string is wrapped in backticks.
19
+ * Preserves shell backticks within commands (e.g., echo `date`).
20
+ * Only removes when exactly 2 backticks wrap the entire string.
21
+ */
22
+ export declare function stripInlineCode(text: string): string;
23
+ /**
24
+ * Main sanitization function that composes all sanitization steps.
25
+ * Order: stripThinkTags → stripCodeBlocks → stripInlineCode → trim
26
+ *
27
+ * @param text - Raw AI response text
28
+ * @returns Cleaned text with formatting removed
29
+ */
30
+ export declare function sanitizeAIResponse(text: string): string;
@@ -0,0 +1 @@
1
+ export declare function setTerminalTitle(title: string): void;
@@ -0,0 +1,44 @@
1
+ export interface ShellExecutionResult {
2
+ /** The raw, unprocessed output buffer. */
3
+ rawOutput: Buffer;
4
+ /** The combined, decoded stdout and stderr as a string. */
5
+ output: string;
6
+ /** The decoded stdout as a string. */
7
+ stdout: string;
8
+ /** The decoded stderr as a string. */
9
+ stderr: string;
10
+ /** The process exit code, or null if terminated by a signal. */
11
+ exitCode: number | null;
12
+ /** The signal that terminated the process, if any. */
13
+ signal: NodeJS.Signals | null;
14
+ /** An error object if the process failed to spawn. */
15
+ error: Error | null;
16
+ /** The process ID of the spawned shell. */
17
+ pid: number | undefined;
18
+ /** Whether the execution was cancelled due to timeout or manual termination. */
19
+ cancelled: boolean;
20
+ }
21
+ export interface ShellExecutionHandle {
22
+ /** The process ID of the spawned shell. */
23
+ pid: number | undefined;
24
+ /** A promise that resolves with the complete execution result. */
25
+ result: Promise<ShellExecutionResult>;
26
+ }
27
+ export type ShellOutputEvent = {
28
+ /** The event contains a chunk of output data. */
29
+ type: 'data';
30
+ /** The stream from which the data originated. */
31
+ stream: 'stdout' | 'stderr';
32
+ /** The decoded string chunk. */
33
+ chunk: string;
34
+ } | {
35
+ /** Signals that the output stream has been identified as binary. */
36
+ type: 'binary_detected';
37
+ } | {
38
+ /** Provides progress updates for a binary stream. */
39
+ type: 'binary_progress';
40
+ /** The total number of bytes received so far. */
41
+ bytesReceived: number;
42
+ };
43
+ export declare function shellExecute(commandToExecute: string, cwd: string, timeout: number, onOutputEvent?: (event: ShellOutputEvent) => void): ShellExecutionHandle;
44
+ export declare function isBinary(data: Buffer | null | undefined, sampleSize?: number): boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts a kebab-case string to Title Case.
3
+ * Examples:
4
+ * - "foo-bar" → "Foo Bar"
5
+ * - "review" → "Review"
6
+ * - "multi-word-command" → "Multi Word Command"
7
+ */
8
+ export declare function kebabToTitleCase(kebabString: string): string;
@@ -0,0 +1,14 @@
1
+ export declare const symbols: {
2
+ checkboxOn: string;
3
+ checkboxOff: string;
4
+ tick: string;
5
+ cross: string;
6
+ pointer: string;
7
+ arrowRight: string;
8
+ pointerSmall: string;
9
+ line: string;
10
+ bullet: string;
11
+ info: string;
12
+ warning: string;
13
+ arrowDown: string;
14
+ };
@@ -0,0 +1,40 @@
1
+ type SystemEncoding = string | null;
2
+ /**
3
+ * Reset the encoding cache - useful for testing or when system configuration changes
4
+ */
5
+ export declare function resetEncodingCache(): void;
6
+ /**
7
+ * Returns the system encoding with caching and fallback to buffer detection.
8
+ * Handles concurrent calls gracefully and provides robust error recovery.
9
+ *
10
+ * @param buffer - Buffer to analyze if system detection fails
11
+ * @returns The detected encoding or 'utf-8' as ultimate fallback
12
+ */
13
+ export declare function getCachedEncodingForBuffer(buffer: Buffer): Promise<string>;
14
+ /**
15
+ * Synchronous version for backward compatibility
16
+ * Note: This may block on first call if system encoding hasn't been cached
17
+ */
18
+ export declare function getCachedEncodingForBufferSync(buffer: Buffer): string;
19
+ /**
20
+ * Detects system encoding based on platform with improved error handling
21
+ *
22
+ * @returns The system encoding or null if detection fails
23
+ */
24
+ export declare function getSystemEncodingSync(): SystemEncoding;
25
+ /**
26
+ * Convert Windows code page to encoding with comprehensive mapping
27
+ *
28
+ * @param cp - Windows code page number
29
+ * @returns Corresponding encoding name or null if unmapped
30
+ */
31
+ export declare function windowsCodePageToEncoding(cp: number): SystemEncoding;
32
+ /**
33
+ * Detect encoding from buffer using chardet with enhanced error handling
34
+ *
35
+ * @param buffer - Buffer to analyze
36
+ * @returns Detected encoding in lowercase or null if detection fails
37
+ */
38
+ export declare function detectEncodingFromBuffer(buffer: Buffer): SystemEncoding;
39
+ export declare const getSystemEncoding: typeof getSystemEncodingSync;
40
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Count tokens in a text string using gpt-tokenizer
3
+ * Falls back to simple estimation if encoding fails
4
+ *
5
+ * @param text - The text to count tokens for
6
+ * @returns The number of tokens
7
+ */
8
+ export declare function countTokens(text: string): number;
@@ -0,0 +1 @@
1
+ export declare function getUsername(): string | undefined;