@clinebot/core 0.0.0 → 0.0.3
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/README.md +7 -7
- package/dist/default-tools/definitions.d.ts +1 -1
- package/dist/default-tools/executors/index.d.ts +1 -1
- package/dist/default-tools/index.d.ts +2 -1
- package/dist/default-tools/model-tool-routing.d.ts +33 -0
- package/dist/default-tools/schemas.d.ts +13 -7
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.js +220 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +47 -47
- package/dist/index.node.d.ts +36 -0
- package/dist/index.node.js +622 -0
- package/dist/providers/local-provider-service.d.ts +37 -0
- package/dist/session/default-session-manager.d.ts +3 -1
- package/dist/session/session-host.d.ts +2 -2
- package/dist/session/session-manager.d.ts +8 -0
- package/dist/session/unified-session-persistence-service.d.ts +1 -1
- package/dist/session/utils/helpers.d.ts +11 -0
- package/dist/session/utils/types.d.ts +42 -0
- package/dist/session/utils/usage.d.ts +9 -0
- package/dist/storage/provider-settings-manager.d.ts +2 -0
- package/dist/types/config.d.ts +8 -1
- package/dist/types.d.ts +1 -1
- package/package.json +11 -32
- package/src/default-tools/definitions.test.ts +130 -1
- package/src/default-tools/definitions.ts +7 -3
- package/src/default-tools/executors/editor.ts +10 -9
- package/src/default-tools/executors/file-read.test.ts +1 -1
- package/src/default-tools/executors/file-read.ts +11 -6
- package/src/default-tools/executors/index.ts +1 -1
- package/src/default-tools/index.ts +6 -1
- package/src/default-tools/model-tool-routing.test.ts +86 -0
- package/src/default-tools/model-tool-routing.ts +132 -0
- package/src/default-tools/schemas.ts +49 -52
- package/src/index.browser.ts +1 -0
- package/src/{server/index.ts → index.node.ts} +51 -109
- package/src/index.ts +41 -2
- package/src/input/file-indexer.ts +28 -2
- package/src/providers/local-provider-service.ts +591 -0
- package/src/runtime/runtime-builder.test.ts +69 -0
- package/src/runtime/runtime-builder.ts +20 -0
- package/src/runtime/runtime-parity.test.ts +20 -9
- package/src/session/default-session-manager.e2e.test.ts +11 -1
- package/src/session/default-session-manager.test.ts +270 -0
- package/src/session/default-session-manager.ts +109 -191
- package/src/session/index.ts +7 -2
- package/src/session/session-host.ts +30 -18
- package/src/session/session-manager.ts +11 -0
- package/src/session/unified-session-persistence-service.ts +11 -5
- package/src/session/utils/helpers.ts +148 -0
- package/src/session/utils/types.ts +46 -0
- package/src/session/utils/usage.ts +32 -0
- package/src/storage/provider-settings-legacy-migration.test.ts +3 -3
- package/src/storage/provider-settings-manager.test.ts +34 -0
- package/src/storage/provider-settings-manager.ts +22 -1
- package/src/types/config.ts +13 -0
- package/src/types.ts +1 -0
- package/dist/server/index.d.ts +0 -47
- package/dist/server/index.js +0 -641
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_MODEL_TOOL_ROUTING_RULES,
|
|
4
|
+
resolveToolRoutingConfig,
|
|
5
|
+
} from "./model-tool-routing.js";
|
|
6
|
+
|
|
7
|
+
describe("model tool routing", () => {
|
|
8
|
+
it("applies default codex/gpt routing in act mode", () => {
|
|
9
|
+
const config = resolveToolRoutingConfig(
|
|
10
|
+
"openai",
|
|
11
|
+
"openai/gpt-5.4",
|
|
12
|
+
"act",
|
|
13
|
+
DEFAULT_MODEL_TOOL_ROUTING_RULES,
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(config.enableApplyPatch).toBe(true);
|
|
17
|
+
expect(config.enableEditor).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("does not apply default codex/gpt routing in plan mode", () => {
|
|
21
|
+
const config = resolveToolRoutingConfig(
|
|
22
|
+
"openai",
|
|
23
|
+
"openai/gpt-5.4",
|
|
24
|
+
"plan",
|
|
25
|
+
DEFAULT_MODEL_TOOL_ROUTING_RULES,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
expect(config).toEqual({});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("applies matching custom rules in order", () => {
|
|
32
|
+
const config = resolveToolRoutingConfig(
|
|
33
|
+
"anthropic",
|
|
34
|
+
"claude-sonnet-4-6",
|
|
35
|
+
"act",
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
name: "claude-editor-off",
|
|
39
|
+
mode: "act",
|
|
40
|
+
modelIdIncludes: ["claude"],
|
|
41
|
+
disableTools: ["editor"],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "claude-apply-patch-on",
|
|
45
|
+
mode: "act",
|
|
46
|
+
modelIdIncludes: ["claude"],
|
|
47
|
+
enableTools: ["apply_patch"],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
expect(config.enableEditor).toBe(false);
|
|
53
|
+
expect(config.enableApplyPatch).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("returns empty config when no rules match", () => {
|
|
57
|
+
const config = resolveToolRoutingConfig(
|
|
58
|
+
"anthropic",
|
|
59
|
+
"claude-sonnet-4-6",
|
|
60
|
+
"act",
|
|
61
|
+
[
|
|
62
|
+
{
|
|
63
|
+
mode: "act",
|
|
64
|
+
modelIdIncludes: ["gpt"],
|
|
65
|
+
enableTools: ["apply_patch"],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
expect(config).toEqual({});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("can match provider-only rules", () => {
|
|
74
|
+
const config = resolveToolRoutingConfig("openai", "o4-mini", "act", [
|
|
75
|
+
{
|
|
76
|
+
mode: "act",
|
|
77
|
+
providerIdIncludes: ["openai"],
|
|
78
|
+
enableTools: ["apply_patch"],
|
|
79
|
+
disableTools: ["editor"],
|
|
80
|
+
},
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
expect(config.enableApplyPatch).toBe(true);
|
|
84
|
+
expect(config.enableEditor).toBe(false);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { CoreAgentMode } from "../types/config";
|
|
2
|
+
import type { DefaultToolName, DefaultToolsConfig } from "./types.js";
|
|
3
|
+
|
|
4
|
+
export interface ToolRoutingRule {
|
|
5
|
+
/**
|
|
6
|
+
* Optional rule label for debugging and logs.
|
|
7
|
+
*/
|
|
8
|
+
name?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Which mode the rule applies to.
|
|
11
|
+
* @default "any"
|
|
12
|
+
*/
|
|
13
|
+
mode?: CoreAgentMode | "any";
|
|
14
|
+
/**
|
|
15
|
+
* Case-insensitive substrings that must match the model ID.
|
|
16
|
+
* When omitted/empty, the rule is not constrained by model ID.
|
|
17
|
+
*/
|
|
18
|
+
modelIdIncludes?: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Case-insensitive substrings that must match the provider ID.
|
|
21
|
+
* When omitted/empty, the rule is not constrained by provider ID.
|
|
22
|
+
*/
|
|
23
|
+
providerIdIncludes?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Enable these tools when the rule matches.
|
|
26
|
+
*/
|
|
27
|
+
enableTools?: DefaultToolName[];
|
|
28
|
+
/**
|
|
29
|
+
* Disable these tools when the rule matches.
|
|
30
|
+
*/
|
|
31
|
+
disableTools?: DefaultToolName[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const TOOL_NAME_TO_FLAG: Record<
|
|
35
|
+
DefaultToolName,
|
|
36
|
+
keyof Pick<
|
|
37
|
+
DefaultToolsConfig,
|
|
38
|
+
| "enableReadFiles"
|
|
39
|
+
| "enableSearch"
|
|
40
|
+
| "enableBash"
|
|
41
|
+
| "enableWebFetch"
|
|
42
|
+
| "enableApplyPatch"
|
|
43
|
+
| "enableEditor"
|
|
44
|
+
| "enableSkills"
|
|
45
|
+
| "enableAskQuestion"
|
|
46
|
+
>
|
|
47
|
+
> = {
|
|
48
|
+
read_files: "enableReadFiles",
|
|
49
|
+
search_codebase: "enableSearch",
|
|
50
|
+
run_commands: "enableBash",
|
|
51
|
+
fetch_web_content: "enableWebFetch",
|
|
52
|
+
apply_patch: "enableApplyPatch",
|
|
53
|
+
editor: "enableEditor",
|
|
54
|
+
skills: "enableSkills",
|
|
55
|
+
ask_question: "enableAskQuestion",
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const DEFAULT_MODEL_TOOL_ROUTING_RULES: ToolRoutingRule[] = [
|
|
59
|
+
{
|
|
60
|
+
name: "openai-native-use-apply-patch",
|
|
61
|
+
mode: "act",
|
|
62
|
+
providerIdIncludes: ["openai-native"],
|
|
63
|
+
enableTools: ["apply_patch"],
|
|
64
|
+
disableTools: ["editor"],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "codex-and-gpt-use-apply-patch",
|
|
68
|
+
mode: "act",
|
|
69
|
+
modelIdIncludes: ["codex", "gpt"],
|
|
70
|
+
enableTools: ["apply_patch"],
|
|
71
|
+
disableTools: ["editor"],
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
function matchesModelId(
|
|
76
|
+
modelId: string,
|
|
77
|
+
includes: string[] | undefined,
|
|
78
|
+
): boolean {
|
|
79
|
+
if (!includes || includes.length === 0) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
const normalizedModelId = modelId.toLowerCase();
|
|
83
|
+
return includes.some((value) =>
|
|
84
|
+
normalizedModelId.includes(value.toLowerCase()),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function matchesRule(
|
|
89
|
+
rule: ToolRoutingRule,
|
|
90
|
+
providerId: string,
|
|
91
|
+
modelId: string,
|
|
92
|
+
mode: CoreAgentMode,
|
|
93
|
+
): boolean {
|
|
94
|
+
if (rule.mode && rule.mode !== "any" && rule.mode !== mode) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return (
|
|
98
|
+
matchesModelId(providerId, rule.providerIdIncludes) &&
|
|
99
|
+
matchesModelId(modelId, rule.modelIdIncludes)
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function resolveToolRoutingConfig(
|
|
104
|
+
providerId: string,
|
|
105
|
+
modelId: string,
|
|
106
|
+
mode: CoreAgentMode,
|
|
107
|
+
rules: ToolRoutingRule[] | undefined,
|
|
108
|
+
): Partial<DefaultToolsConfig> {
|
|
109
|
+
if (!rules || rules.length === 0) {
|
|
110
|
+
return {};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const toggles = new Map<DefaultToolName, boolean>();
|
|
114
|
+
|
|
115
|
+
for (const rule of rules) {
|
|
116
|
+
if (!matchesRule(rule, providerId, modelId, mode)) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
for (const toolName of rule.disableTools ?? []) {
|
|
120
|
+
toggles.set(toolName, false);
|
|
121
|
+
}
|
|
122
|
+
for (const toolName of rule.enableTools ?? []) {
|
|
123
|
+
toggles.set(toolName, true);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const config: Partial<DefaultToolsConfig> = {};
|
|
128
|
+
for (const [toolName, enabled] of toggles.entries()) {
|
|
129
|
+
config[TOOL_NAME_TO_FLAG[toolName]] = enabled;
|
|
130
|
+
}
|
|
131
|
+
return config;
|
|
132
|
+
}
|
|
@@ -18,8 +18,16 @@ const AbsolutePath = z
|
|
|
18
18
|
* Schema for read_files tool input
|
|
19
19
|
*/
|
|
20
20
|
export const ReadFilesInputSchema = z.object({
|
|
21
|
-
file_paths: z
|
|
21
|
+
file_paths: z
|
|
22
|
+
.array(AbsolutePath)
|
|
23
|
+
.describe(
|
|
24
|
+
"Array of absolute file paths to get full content from. Prefer this tool over running terminal command to get file content for better performance and reliability.",
|
|
25
|
+
),
|
|
22
26
|
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Union schema for read_files tool input, allowing either a single string, an array of strings, or the full object schema
|
|
30
|
+
*/
|
|
23
31
|
export const ReadFilesInputUnionSchema = z.union([
|
|
24
32
|
ReadFilesInputSchema,
|
|
25
33
|
z.array(z.string()),
|
|
@@ -42,8 +50,12 @@ const CommandInputSchema = z.string();
|
|
|
42
50
|
export const RunCommandsInputSchema = z.object({
|
|
43
51
|
commands: z
|
|
44
52
|
.array(CommandInputSchema)
|
|
45
|
-
.describe("Array of shell commands to execute"),
|
|
53
|
+
.describe("Array of shell commands to execute."),
|
|
46
54
|
});
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Union schema for run_commands tool input. More flexible.
|
|
58
|
+
*/
|
|
47
59
|
export const RunCommandsInputUnionSchema = z.union([
|
|
48
60
|
RunCommandsInputSchema,
|
|
49
61
|
z.array(CommandInputSchema),
|
|
@@ -54,7 +66,7 @@ export const RunCommandsInputUnionSchema = z.union([
|
|
|
54
66
|
* Schema for a single web fetch request
|
|
55
67
|
*/
|
|
56
68
|
export const WebFetchRequestSchema = z.object({
|
|
57
|
-
url: z.
|
|
69
|
+
url: z.string().describe("The URL to fetch"),
|
|
58
70
|
prompt: z.string().min(2).describe("Analysis prompt for the fetched content"),
|
|
59
71
|
});
|
|
60
72
|
|
|
@@ -64,7 +76,7 @@ export const WebFetchRequestSchema = z.object({
|
|
|
64
76
|
export const FetchWebContentInputSchema = z.object({
|
|
65
77
|
requests: z
|
|
66
78
|
.array(WebFetchRequestSchema)
|
|
67
|
-
.describe("Array of web fetch requests"),
|
|
79
|
+
.describe("Array of the URLs for the web fetch requests"),
|
|
68
80
|
});
|
|
69
81
|
|
|
70
82
|
/**
|
|
@@ -74,62 +86,43 @@ export const EditFileInputSchema = z
|
|
|
74
86
|
.object({
|
|
75
87
|
command: z
|
|
76
88
|
.enum(["create", "str_replace", "insert"])
|
|
77
|
-
.describe(
|
|
78
|
-
"Editor command to execute: create, str_replace, insert, or undo_edit",
|
|
79
|
-
),
|
|
89
|
+
.describe("Editor command to execute: create, str_replace, insert"),
|
|
80
90
|
path: z.string().min(1).describe("Absolute file path"),
|
|
81
91
|
file_text: z
|
|
82
92
|
.string()
|
|
83
|
-
.
|
|
84
|
-
.describe("Full file content
|
|
93
|
+
.nullish()
|
|
94
|
+
.describe("Full file content required for 'create' command"),
|
|
85
95
|
old_str: z
|
|
86
96
|
.string()
|
|
87
|
-
.
|
|
88
|
-
.describe(
|
|
89
|
-
|
|
97
|
+
.nullish()
|
|
98
|
+
.describe(
|
|
99
|
+
"Exact text to replace (must match exactly once) for 'str_replace' command",
|
|
100
|
+
),
|
|
101
|
+
new_str: z
|
|
102
|
+
.string()
|
|
103
|
+
.nullish()
|
|
104
|
+
.describe("Replacement text for 'str_replace' or 'insert' commands"),
|
|
90
105
|
insert_line: z
|
|
91
106
|
.number()
|
|
92
107
|
.int()
|
|
93
|
-
.
|
|
94
|
-
.describe("
|
|
108
|
+
.nullish()
|
|
109
|
+
.describe("Optional one-based line index for 'insert' command"),
|
|
95
110
|
})
|
|
96
|
-
.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
path: ["old_str"],
|
|
112
|
-
message: "old_str is required for command=str_replace",
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
break;
|
|
116
|
-
case "insert":
|
|
117
|
-
if (value.insert_line === undefined) {
|
|
118
|
-
ctx.addIssue({
|
|
119
|
-
code: z.ZodIssueCode.custom,
|
|
120
|
-
path: ["insert_line"],
|
|
121
|
-
message: "insert_line is required for command=insert",
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
if (value.new_str === undefined) {
|
|
125
|
-
ctx.addIssue({
|
|
126
|
-
code: z.ZodIssueCode.custom,
|
|
127
|
-
path: ["new_str"],
|
|
128
|
-
message: "new_str is required for command=insert",
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
111
|
+
.refine((v) => v.command !== "create" || v.file_text != null, {
|
|
112
|
+
path: ["file_text"],
|
|
113
|
+
message: "file_text is required for command=create",
|
|
114
|
+
})
|
|
115
|
+
.refine((v) => v.command !== "str_replace" || v.old_str != null, {
|
|
116
|
+
path: ["old_str"],
|
|
117
|
+
message: "old_str is required for command=str_replace",
|
|
118
|
+
})
|
|
119
|
+
.refine((v) => v.command !== "insert" || v.insert_line != null, {
|
|
120
|
+
path: ["insert_line"],
|
|
121
|
+
message: "insert_line is required for command=insert",
|
|
122
|
+
})
|
|
123
|
+
.refine((v) => v.command !== "insert" || v.new_str != null, {
|
|
124
|
+
path: ["new_str"],
|
|
125
|
+
message: "new_str is required for command=insert",
|
|
133
126
|
});
|
|
134
127
|
|
|
135
128
|
/**
|
|
@@ -156,7 +149,11 @@ export const SkillsInputSchema = z.object({
|
|
|
156
149
|
.describe(
|
|
157
150
|
'The skill name. E.g., "commit", "review-pr", "pdf", or "ms-office-suite:pdf"',
|
|
158
151
|
),
|
|
159
|
-
args: z
|
|
152
|
+
args: z
|
|
153
|
+
.string()
|
|
154
|
+
.nullable()
|
|
155
|
+
.optional()
|
|
156
|
+
.describe("Arguments for the skill; use null when omitted"),
|
|
160
157
|
});
|
|
161
158
|
|
|
162
159
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./index";
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @clinebot/core/server
|
|
3
|
-
*
|
|
4
|
-
* Node/runtime services for host applications (CLI, desktop runtime, servers).
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
type ClineAccountBalance,
|
|
9
|
-
type ClineAccountOperations,
|
|
10
|
-
type ClineAccountOrganization,
|
|
11
|
-
type ClineAccountOrganizationBalance,
|
|
12
|
-
type ClineAccountOrganizationUsageTransaction,
|
|
13
|
-
type ClineAccountPaymentTransaction,
|
|
14
|
-
ClineAccountService,
|
|
15
|
-
type ClineAccountServiceOptions,
|
|
16
|
-
type ClineAccountUsageTransaction,
|
|
17
|
-
type ClineAccountUser,
|
|
18
|
-
executeRpcClineAccountAction,
|
|
19
|
-
isRpcClineAccountActionRequest,
|
|
20
|
-
RpcClineAccountService,
|
|
21
|
-
type RpcProviderActionExecutor,
|
|
22
|
-
} from "../account";
|
|
23
1
|
export type {
|
|
24
2
|
AgentConfigWatcher,
|
|
25
3
|
AgentConfigWatcherEvent,
|
|
@@ -49,7 +27,7 @@ export type {
|
|
|
49
27
|
UserInstructionConfigWatcher,
|
|
50
28
|
UserInstructionConfigWatcherEvent,
|
|
51
29
|
WorkflowConfig,
|
|
52
|
-
} from "
|
|
30
|
+
} from "./agents";
|
|
53
31
|
export {
|
|
54
32
|
createAgentConfigDefinition,
|
|
55
33
|
createAgentConfigWatcher,
|
|
@@ -86,17 +64,17 @@ export {
|
|
|
86
64
|
toPartialAgentConfig,
|
|
87
65
|
UnifiedConfigFileWatcher,
|
|
88
66
|
WORKFLOWS_CONFIG_DIRECTORY_NAME,
|
|
89
|
-
} from "
|
|
67
|
+
} from "./agents";
|
|
90
68
|
export {
|
|
91
69
|
createOAuthClientCallbacks,
|
|
92
70
|
type OAuthClientCallbacksOptions,
|
|
93
|
-
} from "
|
|
71
|
+
} from "./auth/client";
|
|
94
72
|
export {
|
|
95
73
|
createClineOAuthProvider,
|
|
96
74
|
getValidClineCredentials,
|
|
97
75
|
loginClineOAuth,
|
|
98
76
|
refreshClineToken,
|
|
99
|
-
} from "
|
|
77
|
+
} from "./auth/cline";
|
|
100
78
|
export {
|
|
101
79
|
getValidOpenAICodexCredentials,
|
|
102
80
|
isOpenAICodexTokenExpired,
|
|
@@ -104,7 +82,7 @@ export {
|
|
|
104
82
|
normalizeOpenAICodexCredentials,
|
|
105
83
|
openaiCodexOAuthProvider,
|
|
106
84
|
refreshOpenAICodexToken,
|
|
107
|
-
} from "
|
|
85
|
+
} from "./auth/codex";
|
|
108
86
|
export {
|
|
109
87
|
createOcaOAuthProvider,
|
|
110
88
|
createOcaRequestHeaders,
|
|
@@ -121,8 +99,8 @@ export {
|
|
|
121
99
|
loginOcaOAuth,
|
|
122
100
|
OCI_HEADER_OPC_REQUEST_ID,
|
|
123
101
|
refreshOcaToken,
|
|
124
|
-
} from "
|
|
125
|
-
export { startLocalOAuthServer } from "
|
|
102
|
+
} from "./auth/oca";
|
|
103
|
+
export { startLocalOAuthServer } from "./auth/server";
|
|
126
104
|
export type {
|
|
127
105
|
OAuthCredentials,
|
|
128
106
|
OAuthLoginCallbacks,
|
|
@@ -134,127 +112,100 @@ export type {
|
|
|
134
112
|
OcaOAuthEnvironmentConfig,
|
|
135
113
|
OcaOAuthProviderOptions,
|
|
136
114
|
OcaTokenResolution,
|
|
137
|
-
} from "
|
|
138
|
-
export
|
|
139
|
-
ALL_DEFAULT_TOOL_NAMES,
|
|
140
|
-
type AskQuestionExecutor,
|
|
141
|
-
type CreateBuiltinToolsOptions,
|
|
142
|
-
type CreateDefaultToolsOptions,
|
|
143
|
-
createBuiltinTools,
|
|
144
|
-
createDefaultExecutors,
|
|
145
|
-
createDefaultTools,
|
|
146
|
-
createDefaultToolsWithPreset,
|
|
147
|
-
createToolPoliciesWithPreset,
|
|
148
|
-
type DefaultExecutorsOptions,
|
|
149
|
-
type DefaultToolName,
|
|
150
|
-
DefaultToolNames,
|
|
151
|
-
type DefaultToolsConfig,
|
|
152
|
-
type ToolExecutors,
|
|
153
|
-
type ToolPolicyPresetName,
|
|
154
|
-
type ToolPresetName,
|
|
155
|
-
ToolPresets,
|
|
156
|
-
} from "../default-tools";
|
|
115
|
+
} from "./auth/types";
|
|
116
|
+
export * from "./index";
|
|
157
117
|
export type {
|
|
158
118
|
FastFileIndexOptions,
|
|
159
119
|
MentionEnricherOptions,
|
|
160
120
|
MentionEnrichmentResult,
|
|
161
|
-
} from "
|
|
121
|
+
} from "./input";
|
|
162
122
|
export {
|
|
163
123
|
enrichPromptWithMentions,
|
|
164
124
|
getFileIndex,
|
|
165
125
|
prewarmFileIndex,
|
|
166
|
-
} from "
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
McpSettingsFile,
|
|
179
|
-
McpSseTransportConfig,
|
|
180
|
-
McpStdioTransportConfig,
|
|
181
|
-
McpStreamableHttpTransportConfig,
|
|
182
|
-
RegisterMcpServersFromSettingsOptions,
|
|
183
|
-
} from "../mcp";
|
|
184
|
-
export {
|
|
185
|
-
hasMcpSettingsFile,
|
|
186
|
-
InMemoryMcpManager,
|
|
187
|
-
loadMcpSettingsFile,
|
|
188
|
-
registerMcpServersFromSettingsFile,
|
|
189
|
-
resolveDefaultMcpSettingsPath,
|
|
190
|
-
resolveMcpServerRegistrations,
|
|
191
|
-
} from "../mcp";
|
|
126
|
+
} from "./input";
|
|
127
|
+
export {
|
|
128
|
+
addLocalProvider,
|
|
129
|
+
ensureCustomProvidersLoaded,
|
|
130
|
+
getLocalProviderModels,
|
|
131
|
+
listLocalProviders,
|
|
132
|
+
loginLocalProvider,
|
|
133
|
+
normalizeOAuthProvider,
|
|
134
|
+
resolveLocalClineAuthToken,
|
|
135
|
+
saveLocalProviderOAuthCredentials,
|
|
136
|
+
saveLocalProviderSettings,
|
|
137
|
+
} from "./providers/local-provider-service";
|
|
192
138
|
export {
|
|
193
139
|
formatRulesForSystemPrompt,
|
|
194
140
|
isRuleEnabled,
|
|
195
141
|
listEnabledRulesFromWatcher,
|
|
196
142
|
loadRulesForSystemPromptFromWatcher,
|
|
197
|
-
} from "
|
|
143
|
+
} from "./runtime/rules";
|
|
198
144
|
export {
|
|
199
145
|
createTeamName,
|
|
200
146
|
DefaultRuntimeBuilder,
|
|
201
|
-
} from "
|
|
147
|
+
} from "./runtime/runtime-builder";
|
|
202
148
|
export {
|
|
203
149
|
type SandboxCallOptions,
|
|
204
150
|
SubprocessSandbox,
|
|
205
151
|
type SubprocessSandboxOptions,
|
|
206
|
-
} from "
|
|
152
|
+
} from "./runtime/sandbox/subprocess-sandbox";
|
|
207
153
|
export type {
|
|
208
154
|
BuiltRuntime,
|
|
209
155
|
RuntimeBuilder,
|
|
210
156
|
RuntimeBuilderInput,
|
|
211
157
|
SessionRuntime,
|
|
212
|
-
} from "
|
|
158
|
+
} from "./runtime/session-runtime";
|
|
213
159
|
export {
|
|
214
160
|
type DesktopToolApprovalOptions,
|
|
215
161
|
requestDesktopToolApproval,
|
|
216
|
-
} from "
|
|
217
|
-
export type { AvailableWorkflow } from "
|
|
162
|
+
} from "./runtime/tool-approval";
|
|
163
|
+
export type { AvailableWorkflow } from "./runtime/workflows";
|
|
218
164
|
export {
|
|
219
165
|
listAvailableWorkflowsFromWatcher,
|
|
220
166
|
resolveWorkflowSlashCommandFromWatcher,
|
|
221
|
-
} from "
|
|
222
|
-
export { DefaultSessionManager } from "
|
|
223
|
-
export { RpcCoreSessionService } from "
|
|
167
|
+
} from "./runtime/workflows";
|
|
168
|
+
export { DefaultSessionManager } from "./session/default-session-manager";
|
|
169
|
+
export { RpcCoreSessionService } from "./session/rpc-session-service";
|
|
224
170
|
export {
|
|
225
171
|
deriveSubsessionStatus,
|
|
226
172
|
makeSubSessionId,
|
|
227
173
|
makeTeamTaskSubSessionId,
|
|
228
174
|
sanitizeSessionToken,
|
|
229
|
-
} from "
|
|
175
|
+
} from "./session/session-graph";
|
|
230
176
|
export type {
|
|
231
177
|
CreateSessionHostOptions,
|
|
178
|
+
SessionBackend,
|
|
232
179
|
SessionHost,
|
|
233
|
-
} from "
|
|
234
|
-
export {
|
|
180
|
+
} from "./session/session-host";
|
|
181
|
+
export {
|
|
182
|
+
createSessionHost,
|
|
183
|
+
resolveSessionBackend,
|
|
184
|
+
} from "./session/session-host";
|
|
235
185
|
export type {
|
|
236
186
|
SendSessionInput,
|
|
187
|
+
SessionAccumulatedUsage,
|
|
237
188
|
SessionManager,
|
|
238
189
|
StartSessionInput,
|
|
239
190
|
StartSessionResult,
|
|
240
|
-
} from "
|
|
241
|
-
export type { SessionManifest } from "
|
|
191
|
+
} from "./session/session-manager";
|
|
192
|
+
export type { SessionManifest } from "./session/session-manifest";
|
|
242
193
|
export type {
|
|
243
194
|
CreateRootSessionWithArtifactsInput,
|
|
244
195
|
RootSessionArtifacts,
|
|
245
|
-
} from "
|
|
246
|
-
export { CoreSessionService } from "
|
|
196
|
+
} from "./session/session-service";
|
|
197
|
+
export { CoreSessionService } from "./session/session-service";
|
|
247
198
|
export {
|
|
248
199
|
createSqliteRpcSessionBackend,
|
|
249
200
|
SqliteRpcSessionBackend,
|
|
250
201
|
type SqliteRpcSessionBackendOptions,
|
|
251
|
-
} from "
|
|
202
|
+
} from "./session/sqlite-rpc-session-backend";
|
|
252
203
|
export type {
|
|
253
204
|
WorkspaceManager,
|
|
254
205
|
WorkspaceManagerEvent,
|
|
255
|
-
} from "
|
|
256
|
-
export { InMemoryWorkspaceManager } from "
|
|
257
|
-
export type { WorkspaceManifest } from "
|
|
206
|
+
} from "./session/workspace-manager";
|
|
207
|
+
export { InMemoryWorkspaceManager } from "./session/workspace-manager";
|
|
208
|
+
export type { WorkspaceManifest } from "./session/workspace-manifest";
|
|
258
209
|
export {
|
|
259
210
|
buildWorkspaceMetadata,
|
|
260
211
|
emptyWorkspaceManifest,
|
|
@@ -263,20 +214,11 @@ export {
|
|
|
263
214
|
upsertWorkspaceInfo,
|
|
264
215
|
WorkspaceInfoSchema,
|
|
265
216
|
WorkspaceManifestSchema,
|
|
266
|
-
} from "
|
|
217
|
+
} from "./session/workspace-manifest";
|
|
267
218
|
export {
|
|
268
219
|
type MigrateLegacyProviderSettingsOptions,
|
|
269
220
|
type MigrateLegacyProviderSettingsResult,
|
|
270
221
|
migrateLegacyProviderSettings,
|
|
271
|
-
} from "
|
|
272
|
-
export { ProviderSettingsManager } from "
|
|
273
|
-
export { SqliteSessionStore } from "
|
|
274
|
-
export type { SessionStatus } from "../types/common";
|
|
275
|
-
export { SESSION_STATUSES, SessionSource } from "../types/common";
|
|
276
|
-
export type {
|
|
277
|
-
CoreAgentMode,
|
|
278
|
-
CoreModelConfig,
|
|
279
|
-
CoreRuntimeFeatures,
|
|
280
|
-
CoreSessionConfig,
|
|
281
|
-
} from "../types/config";
|
|
282
|
-
export type { WorkspaceInfo } from "../types/workspace";
|
|
222
|
+
} from "./storage/provider-settings-legacy-migration";
|
|
223
|
+
export { ProviderSettingsManager } from "./storage/provider-settings-manager";
|
|
224
|
+
export { SqliteSessionStore } from "./storage/sqlite-session-store";
|