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.
- package/LICENSE +21 -0
- package/README.md +199 -0
- package/dist/agent/agent/agentManager.d.ts +38 -0
- package/dist/agent/agent/builtin/common.d.ts +5 -0
- package/dist/agent/agent/builtin/explore.d.ts +5 -0
- package/dist/agent/agent/builtin/general-purpose.d.ts +5 -0
- package/dist/agent/agent/builtin/index.d.ts +5 -0
- package/dist/agent/agent/executor.d.ts +2 -0
- package/dist/agent/agent/types.d.ts +98 -0
- package/dist/api/engine.d.ts +213 -0
- package/dist/communication/index.d.ts +4 -0
- package/dist/communication/messageBus.d.ts +71 -0
- package/dist/core/at.d.ts +26 -0
- package/dist/core/backgroundTaskManager.d.ts +27 -0
- package/dist/core/compact.d.ts +9 -0
- package/dist/core/config.d.ts +103 -0
- package/dist/core/constants.d.ts +32 -0
- package/dist/core/context.d.ts +57 -0
- package/dist/core/globalData.d.ts +21 -0
- package/dist/core/history.d.ts +24 -0
- package/dist/core/ide.d.ts +103 -0
- package/dist/core/jsonl.d.ts +37 -0
- package/dist/core/llmsContext.d.ts +14 -0
- package/dist/core/loop.d.ts +82 -0
- package/dist/core/message.d.ts +132 -0
- package/dist/core/model.d.ts +79 -0
- package/dist/core/output-style/builtin/default.d.ts +2 -0
- package/dist/core/output-style/builtin/explanatory.d.ts +2 -0
- package/dist/core/output-style/builtin/index.d.ts +6 -0
- package/dist/core/output-style/builtin/miao.d.ts +2 -0
- package/dist/core/output-style/builtin/minimal.d.ts +2 -0
- package/dist/core/output-style/types.d.ts +6 -0
- package/dist/core/outputFormat.d.ts +29 -0
- package/dist/core/outputStyle.d.ts +43 -0
- package/dist/core/paths.d.ts +20 -0
- package/dist/core/planSystemPrompt.d.ts +5 -0
- package/dist/core/plugin.d.ts +138 -0
- package/dist/core/project.d.ts +64 -0
- package/dist/core/promptCache.d.ts +3 -0
- package/dist/core/query.d.ts +14 -0
- package/dist/core/rules.d.ts +8 -0
- package/dist/core/systemPrompt.d.ts +9 -0
- package/dist/core/thinking-config.d.ts +3 -0
- package/dist/core/usage.d.ts +14 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +144432 -0
- package/dist/mcp/mcp.d.ts +49 -0
- package/dist/modes/builtin.d.ts +34 -0
- package/dist/modes/index.d.ts +8 -0
- package/dist/modes/registry.d.ts +18 -0
- package/dist/modes/types.d.ts +51 -0
- package/dist/platform/index.d.ts +5 -0
- package/dist/platform/node.d.ts +28 -0
- package/dist/platform/types.d.ts +41 -0
- package/dist/session/session.d.ts +43 -0
- package/dist/skill/skill.d.ts +79 -0
- package/dist/tools/tool.d.ts +119 -0
- package/dist/tools/tools/askUserQuestion.d.ts +48 -0
- package/dist/tools/tools/bash.d.ts +43 -0
- package/dist/tools/tools/edit.d.ts +9 -0
- package/dist/tools/tools/fetch.d.ts +9 -0
- package/dist/tools/tools/glob.d.ts +7 -0
- package/dist/tools/tools/grep.d.ts +22 -0
- package/dist/tools/tools/ls.d.ts +6 -0
- package/dist/tools/tools/read.d.ts +9 -0
- package/dist/tools/tools/skill.d.ts +7 -0
- package/dist/tools/tools/task.d.ts +14 -0
- package/dist/tools/tools/todo.d.ts +37 -0
- package/dist/tools/tools/write.d.ts +7 -0
- package/dist/utils/apiKeyRotation.d.ts +2 -0
- package/dist/utils/applyEdit.d.ts +17 -0
- package/dist/utils/background-detection.d.ts +2 -0
- package/dist/utils/dotenv.d.ts +9 -0
- package/dist/utils/env.d.ts +6 -0
- package/dist/utils/error.d.ts +11 -0
- package/dist/utils/execFileNoThrow.d.ts +8 -0
- package/dist/utils/files.d.ts +10 -0
- package/dist/utils/git.d.ts +163 -0
- package/dist/utils/ide.d.ts +27 -0
- package/dist/utils/ignore.d.ts +6 -0
- package/dist/utils/isLocal.d.ts +1 -0
- package/dist/utils/language.d.ts +9 -0
- package/dist/utils/list.d.ts +20 -0
- package/dist/utils/mergeSystemMessagesMiddleware.d.ts +2 -0
- package/dist/utils/messageNormalization.d.ts +22 -0
- package/dist/utils/path.d.ts +34 -0
- package/dist/utils/prependSystemMessageMiddleware.d.ts +2 -0
- package/dist/utils/project.d.ts +1 -0
- package/dist/utils/proxy.d.ts +18 -0
- package/dist/utils/randomUUID.d.ts +5 -0
- package/dist/utils/renderSessionMarkdown.d.ts +10 -0
- package/dist/utils/ripgrep.d.ts +16 -0
- package/dist/utils/safeFrontMatter.d.ts +11 -0
- package/dist/utils/safeParseJson.d.ts +1 -0
- package/dist/utils/safeStringify.d.ts +1 -0
- package/dist/utils/sanitizeAIResponse.d.ts +30 -0
- package/dist/utils/setTerminalTitle.d.ts +1 -0
- package/dist/utils/shell-execution.d.ts +44 -0
- package/dist/utils/string.d.ts +8 -0
- package/dist/utils/symbols.d.ts +14 -0
- package/dist/utils/system-encoding.d.ts +40 -0
- package/dist/utils/tokenCounter.d.ts +8 -0
- package/dist/utils/username.d.ts +1 -0
- package/package.json +106 -0
- package/src/agent/agent/agentManager.test.ts +124 -0
- package/src/agent/agent/agentManager.ts +372 -0
- package/src/agent/agent/builtin/common.ts +20 -0
- package/src/agent/agent/builtin/explore.ts +53 -0
- package/src/agent/agent/builtin/general-purpose.ts +38 -0
- package/src/agent/agent/builtin/index.ts +13 -0
- package/src/agent/agent/executor.test.ts +339 -0
- package/src/agent/agent/executor.ts +224 -0
- package/src/agent/agent/types.ts +119 -0
- package/src/api/engine.ts +466 -0
- package/src/communication/index.ts +18 -0
- package/src/communication/messageBus.ts +393 -0
- package/src/core/at.ts +315 -0
- package/src/core/backgroundTaskManager.ts +129 -0
- package/src/core/compact.ts +95 -0
- package/src/core/config.ts +441 -0
- package/src/core/constants.ts +82 -0
- package/src/core/context.ts +214 -0
- package/src/core/globalData.ts +77 -0
- package/src/core/history.ts +323 -0
- package/src/core/ide.ts +325 -0
- package/src/core/jsonl.ts +100 -0
- package/src/core/llmsContext.ts +117 -0
- package/src/core/loop.ts +638 -0
- package/src/core/message.ts +304 -0
- package/src/core/model.ts +2198 -0
- package/src/core/output-style/builtin/default.ts +9 -0
- package/src/core/output-style/builtin/explanatory.ts +22 -0
- package/src/core/output-style/builtin/index.ts +19 -0
- package/src/core/output-style/builtin/miao.ts +22 -0
- package/src/core/output-style/builtin/minimal.ts +8 -0
- package/src/core/output-style/types.ts +6 -0
- package/src/core/outputFormat.ts +93 -0
- package/src/core/outputStyle.ts +255 -0
- package/src/core/paths.ts +161 -0
- package/src/core/planSystemPrompt.ts +46 -0
- package/src/core/plugin.ts +299 -0
- package/src/core/project.ts +492 -0
- package/src/core/promptCache.ts +32 -0
- package/src/core/query.ts +46 -0
- package/src/core/rules.ts +56 -0
- package/src/core/systemPrompt.ts +176 -0
- package/src/core/thinking-config.ts +98 -0
- package/src/core/usage.ts +68 -0
- package/src/index.ts +39 -0
- package/src/mcp/mcp.ts +637 -0
- package/src/modes/builtin.ts +305 -0
- package/src/modes/index.ts +22 -0
- package/src/modes/registry.ts +39 -0
- package/src/modes/types.ts +56 -0
- package/src/platform/index.ts +6 -0
- package/src/platform/node.ts +108 -0
- package/src/platform/types.ts +54 -0
- package/src/plugins/index.ts +15 -0
- package/src/session/session.ts +187 -0
- package/src/skill/skill.ts +702 -0
- package/src/tools/tool.ts +378 -0
- package/src/tools/tools/askUserQuestion.ts +134 -0
- package/src/tools/tools/bash.test.ts +425 -0
- package/src/tools/tools/bash.ts +999 -0
- package/src/tools/tools/edit.ts +86 -0
- package/src/tools/tools/fetch.ts +129 -0
- package/src/tools/tools/glob.ts +69 -0
- package/src/tools/tools/grep.test.ts +194 -0
- package/src/tools/tools/grep.ts +358 -0
- package/src/tools/tools/ls.ts +51 -0
- package/src/tools/tools/read.test.ts +169 -0
- package/src/tools/tools/read.ts +284 -0
- package/src/tools/tools/skill.ts +73 -0
- package/src/tools/tools/task.test.ts +262 -0
- package/src/tools/tools/task.ts +284 -0
- package/src/tools/tools/todo.ts +269 -0
- package/src/tools/tools/write.ts +71 -0
- package/src/types.d.ts +18 -0
- package/src/utils/apiKeyRotation.test.ts +70 -0
- package/src/utils/apiKeyRotation.ts +24 -0
- package/src/utils/applyEdit.test.ts +388 -0
- package/src/utils/applyEdit.ts +547 -0
- package/src/utils/background-detection.test.ts +61 -0
- package/src/utils/background-detection.ts +58 -0
- package/src/utils/dotenv.ts +26 -0
- package/src/utils/env.ts +90 -0
- package/src/utils/error.ts +38 -0
- package/src/utils/execFileNoThrow.ts +49 -0
- package/src/utils/files.ts +93 -0
- package/src/utils/git.ts +1152 -0
- package/src/utils/ide.ts +279 -0
- package/src/utils/ignore.ts +275 -0
- package/src/utils/isLocal.ts +6 -0
- package/src/utils/language.ts +33 -0
- package/src/utils/list.ts +200 -0
- package/src/utils/mergeSystemMessagesMiddleware.ts +32 -0
- package/src/utils/messageNormalization.test.ts +401 -0
- package/src/utils/messageNormalization.ts +168 -0
- package/src/utils/path.ts +98 -0
- package/src/utils/prependSystemMessageMiddleware.ts +16 -0
- package/src/utils/project.ts +32 -0
- package/src/utils/proxy.ts +102 -0
- package/src/utils/randomUUID.ts +11 -0
- package/src/utils/renderSessionMarkdown.ts +175 -0
- package/src/utils/ripgrep.ts +189 -0
- package/src/utils/safeFrontMatter.test.ts +118 -0
- package/src/utils/safeFrontMatter.ts +68 -0
- package/src/utils/safeParseJson.ts +7 -0
- package/src/utils/safeStringify.ts +10 -0
- package/src/utils/sanitizeAIResponse.test.ts +135 -0
- package/src/utils/sanitizeAIResponse.ts +55 -0
- package/src/utils/setTerminalTitle.ts +7 -0
- package/src/utils/shell-execution.test.ts +237 -0
- package/src/utils/shell-execution.ts +279 -0
- package/src/utils/string.ts +13 -0
- package/src/utils/symbols.ts +18 -0
- package/src/utils/system-encoding.test.ts +164 -0
- package/src/utils/system-encoding.ts +296 -0
- package/src/utils/tokenCounter.test.ts +38 -0
- package/src/utils/tokenCounter.ts +19 -0
- 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,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,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,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,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 @@
|
|
|
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,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,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 @@
|
|
|
1
|
+
export declare function getUsername(): string | undefined;
|