@clinebot/core 0.0.2 → 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 +6 -6
- 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 +1 -1
- package/dist/index.js +220 -0
- package/dist/index.node.d.ts +35 -0
- package/dist/index.node.js +449 -47
- package/dist/providers/local-provider-service.d.ts +37 -0
- package/package.json +8 -28
- package/src/default-tools/definitions.ts +1 -1
- package/src/default-tools/executors/index.ts +1 -1
- package/src/default-tools/index.ts +1 -1
- package/src/index.node.ts +223 -0
- package/src/providers/local-provider-service.ts +591 -0
- package/dist/server/index.d.ts +0 -49
- package/dist/server/index.js +0 -693
- package/src/server/index.ts +0 -321
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { providers as LlmsProviders } from "@clinebot/llms";
|
|
2
|
+
import type { RpcAddProviderActionRequest, RpcOAuthProviderId, RpcProviderListItem, RpcProviderModel, RpcSaveProviderSettingsActionRequest } from "@clinebot/shared";
|
|
3
|
+
import type { ProviderSettingsManager } from "../storage/provider-settings-manager";
|
|
4
|
+
export declare function ensureCustomProvidersLoaded(manager: ProviderSettingsManager): Promise<void>;
|
|
5
|
+
export declare function addLocalProvider(manager: ProviderSettingsManager, request: RpcAddProviderActionRequest): Promise<{
|
|
6
|
+
providerId: string;
|
|
7
|
+
settingsPath: string;
|
|
8
|
+
modelsPath: string;
|
|
9
|
+
modelsCount: number;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function listLocalProviders(manager: ProviderSettingsManager): Promise<{
|
|
12
|
+
providers: RpcProviderListItem[];
|
|
13
|
+
settingsPath: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function getLocalProviderModels(providerId: string): Promise<{
|
|
16
|
+
providerId: string;
|
|
17
|
+
models: RpcProviderModel[];
|
|
18
|
+
}>;
|
|
19
|
+
export declare function saveLocalProviderSettings(manager: ProviderSettingsManager, request: RpcSaveProviderSettingsActionRequest): {
|
|
20
|
+
providerId: string;
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
settingsPath: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function normalizeOAuthProvider(provider: string): RpcOAuthProviderId;
|
|
25
|
+
export declare function loginLocalProvider(providerId: RpcOAuthProviderId, existing: LlmsProviders.ProviderSettings | undefined, openUrl: (url: string) => void): Promise<{
|
|
26
|
+
access: string;
|
|
27
|
+
refresh: string;
|
|
28
|
+
expires: number;
|
|
29
|
+
accountId?: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare function saveLocalProviderOAuthCredentials(manager: ProviderSettingsManager, providerId: RpcOAuthProviderId, existing: LlmsProviders.ProviderSettings | undefined, credentials: {
|
|
32
|
+
access: string;
|
|
33
|
+
refresh: string;
|
|
34
|
+
expires: number;
|
|
35
|
+
accountId?: string;
|
|
36
|
+
}): LlmsProviders.ProviderSettings;
|
|
37
|
+
export declare function resolveLocalClineAuthToken(settings: LlmsProviders.ProviderSettings | undefined): string | undefined;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clinebot/core",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"main": "dist/index.
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@clinebot/agents": "0.0.
|
|
7
|
-
"@clinebot/llms": "0.0.
|
|
6
|
+
"@clinebot/agents": "0.0.3",
|
|
7
|
+
"@clinebot/llms": "0.0.3",
|
|
8
8
|
"nanoid": "^5.1.7",
|
|
9
9
|
"simple-git": "^3.32.3",
|
|
10
10
|
"yaml": "^2.8.2",
|
|
@@ -13,34 +13,14 @@
|
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
15
|
"browser": "./dist/index.browser.js",
|
|
16
|
-
"development": "./dist/index.
|
|
17
|
-
"types": "./dist/index.
|
|
18
|
-
"import": "./dist/index.
|
|
19
|
-
},
|
|
20
|
-
"./node": {
|
|
21
|
-
"development": "./src/index.node.ts",
|
|
22
|
-
"types": "./dist/index.node.d.ts",
|
|
23
|
-
"import": "./dist/index.node.js"
|
|
16
|
+
"development": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
24
19
|
},
|
|
25
20
|
"./browser": {
|
|
26
21
|
"development": "./dist/index.browser.js",
|
|
27
22
|
"types": "./dist/index.browser.d.ts",
|
|
28
23
|
"import": "./dist/index.browser.js"
|
|
29
|
-
},
|
|
30
|
-
"./server": {
|
|
31
|
-
"development": "./dist/server/index.js",
|
|
32
|
-
"types": "./dist/server/index.d.ts",
|
|
33
|
-
"import": "./dist/server/index.js"
|
|
34
|
-
},
|
|
35
|
-
"./server/node": {
|
|
36
|
-
"development": "./dist/server/index.js",
|
|
37
|
-
"types": "./dist/server/index.d.ts",
|
|
38
|
-
"import": "./dist/server/index.js"
|
|
39
|
-
},
|
|
40
|
-
"./server/browser": {
|
|
41
|
-
"development": "./dist/server/index.js",
|
|
42
|
-
"types": "./dist/server.browser.d.ts",
|
|
43
|
-
"import": "./dist/server.browser.js"
|
|
44
24
|
}
|
|
45
25
|
},
|
|
46
26
|
"description": "State-aware orchestration for Cline Agent runtimes",
|
|
@@ -58,5 +38,5 @@
|
|
|
58
38
|
"test:watch": "vitest --config vitest.config.ts"
|
|
59
39
|
},
|
|
60
40
|
"type": "module",
|
|
61
|
-
"types": "dist/index.
|
|
41
|
+
"types": "./dist/index.d.ts"
|
|
62
42
|
}
|
|
@@ -547,7 +547,7 @@ export function createAskQuestionTool(
|
|
|
547
547
|
* @example
|
|
548
548
|
* ```typescript
|
|
549
549
|
* import { Agent } from "@clinebot/agents"
|
|
550
|
-
* import { createDefaultTools } from "@clinebot/core/
|
|
550
|
+
* import { createDefaultTools } from "@clinebot/core/node"
|
|
551
551
|
* import * as fs from "fs/promises"
|
|
552
552
|
* import { exec } from "child_process"
|
|
553
553
|
*
|
|
@@ -48,7 +48,7 @@ export interface DefaultExecutorsOptions {
|
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
50
|
* ```typescript
|
|
51
|
-
* import { createDefaultTools, createDefaultExecutors } from "@clinebot/core/
|
|
51
|
+
* import { createDefaultTools, createDefaultExecutors } from "@clinebot/core/node"
|
|
52
52
|
*
|
|
53
53
|
* const executors = createDefaultExecutors({
|
|
54
54
|
* bash: { timeoutMs: 60000 },
|
|
@@ -126,7 +126,7 @@ export interface CreateBuiltinToolsOptions
|
|
|
126
126
|
* @example
|
|
127
127
|
* ```typescript
|
|
128
128
|
* import { Agent } from "@clinebot/agents"
|
|
129
|
-
* import { createBuiltinTools } from "@clinebot/core/
|
|
129
|
+
* import { createBuiltinTools } from "@clinebot/core/node"
|
|
130
130
|
*
|
|
131
131
|
* const tools = createBuiltinTools({
|
|
132
132
|
* cwd: "/path/to/project",
|
package/src/index.node.ts
CHANGED
|
@@ -1 +1,224 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
AgentConfigWatcher,
|
|
3
|
+
AgentConfigWatcherEvent,
|
|
4
|
+
AgentYamlConfig,
|
|
5
|
+
BuildAgentConfigOverridesOptions,
|
|
6
|
+
CreateAgentConfigWatcherOptions,
|
|
7
|
+
CreateInstructionWatcherOptions,
|
|
8
|
+
CreateRulesConfigDefinitionOptions,
|
|
9
|
+
CreateSkillsConfigDefinitionOptions,
|
|
10
|
+
CreateUserInstructionConfigWatcherOptions,
|
|
11
|
+
CreateWorkflowsConfigDefinitionOptions,
|
|
12
|
+
HookConfigFileEntry,
|
|
13
|
+
LoadAgentPluginFromPathOptions,
|
|
14
|
+
ParseMarkdownFrontmatterResult,
|
|
15
|
+
ParseYamlFrontmatterResult,
|
|
16
|
+
ResolveAgentPluginPathsOptions,
|
|
17
|
+
RuleConfig,
|
|
18
|
+
SkillConfig,
|
|
19
|
+
UnifiedConfigDefinition,
|
|
20
|
+
UnifiedConfigFileCandidate,
|
|
21
|
+
UnifiedConfigFileContext,
|
|
22
|
+
UnifiedConfigRecord,
|
|
23
|
+
UnifiedConfigWatcherEvent,
|
|
24
|
+
UnifiedConfigWatcherOptions,
|
|
25
|
+
UserInstructionConfig,
|
|
26
|
+
UserInstructionConfigType,
|
|
27
|
+
UserInstructionConfigWatcher,
|
|
28
|
+
UserInstructionConfigWatcherEvent,
|
|
29
|
+
WorkflowConfig,
|
|
30
|
+
} from "./agents";
|
|
31
|
+
export {
|
|
32
|
+
createAgentConfigDefinition,
|
|
33
|
+
createAgentConfigWatcher,
|
|
34
|
+
createRulesConfigDefinition,
|
|
35
|
+
createSkillsConfigDefinition,
|
|
36
|
+
createUserInstructionConfigWatcher,
|
|
37
|
+
createWorkflowsConfigDefinition,
|
|
38
|
+
discoverPluginModulePaths,
|
|
39
|
+
HOOK_CONFIG_FILE_EVENT_MAP,
|
|
40
|
+
HOOKS_CONFIG_DIRECTORY_NAME,
|
|
41
|
+
HookConfigFileName,
|
|
42
|
+
listHookConfigFiles,
|
|
43
|
+
loadAgentPluginFromPath,
|
|
44
|
+
loadAgentPluginsFromPaths,
|
|
45
|
+
parseAgentConfigFromYaml,
|
|
46
|
+
parsePartialAgentConfigFromYaml,
|
|
47
|
+
parseRuleConfigFromMarkdown,
|
|
48
|
+
parseSkillConfigFromMarkdown,
|
|
49
|
+
parseWorkflowConfigFromMarkdown,
|
|
50
|
+
RULES_CONFIG_DIRECTORY_NAME,
|
|
51
|
+
resolveAgentPluginPaths,
|
|
52
|
+
resolveAgentTools,
|
|
53
|
+
resolveAndLoadAgentPlugins,
|
|
54
|
+
resolveDocumentsHooksDirectoryPath,
|
|
55
|
+
resolveDocumentsRulesDirectoryPath,
|
|
56
|
+
resolveDocumentsWorkflowsDirectoryPath,
|
|
57
|
+
resolveHooksConfigSearchPaths,
|
|
58
|
+
resolvePluginConfigSearchPaths,
|
|
59
|
+
resolveRulesConfigSearchPaths,
|
|
60
|
+
resolveSkillsConfigSearchPaths,
|
|
61
|
+
resolveWorkflowsConfigSearchPaths,
|
|
62
|
+
SKILLS_CONFIG_DIRECTORY_NAME,
|
|
63
|
+
toHookConfigFileName,
|
|
64
|
+
toPartialAgentConfig,
|
|
65
|
+
UnifiedConfigFileWatcher,
|
|
66
|
+
WORKFLOWS_CONFIG_DIRECTORY_NAME,
|
|
67
|
+
} from "./agents";
|
|
68
|
+
export {
|
|
69
|
+
createOAuthClientCallbacks,
|
|
70
|
+
type OAuthClientCallbacksOptions,
|
|
71
|
+
} from "./auth/client";
|
|
72
|
+
export {
|
|
73
|
+
createClineOAuthProvider,
|
|
74
|
+
getValidClineCredentials,
|
|
75
|
+
loginClineOAuth,
|
|
76
|
+
refreshClineToken,
|
|
77
|
+
} from "./auth/cline";
|
|
78
|
+
export {
|
|
79
|
+
getValidOpenAICodexCredentials,
|
|
80
|
+
isOpenAICodexTokenExpired,
|
|
81
|
+
loginOpenAICodex,
|
|
82
|
+
normalizeOpenAICodexCredentials,
|
|
83
|
+
openaiCodexOAuthProvider,
|
|
84
|
+
refreshOpenAICodexToken,
|
|
85
|
+
} from "./auth/codex";
|
|
86
|
+
export {
|
|
87
|
+
createOcaOAuthProvider,
|
|
88
|
+
createOcaRequestHeaders,
|
|
89
|
+
DEFAULT_EXTERNAL_IDCS_CLIENT_ID,
|
|
90
|
+
DEFAULT_EXTERNAL_IDCS_SCOPES,
|
|
91
|
+
DEFAULT_EXTERNAL_IDCS_URL,
|
|
92
|
+
DEFAULT_EXTERNAL_OCA_BASE_URL,
|
|
93
|
+
DEFAULT_INTERNAL_IDCS_CLIENT_ID,
|
|
94
|
+
DEFAULT_INTERNAL_IDCS_SCOPES,
|
|
95
|
+
DEFAULT_INTERNAL_IDCS_URL,
|
|
96
|
+
DEFAULT_INTERNAL_OCA_BASE_URL,
|
|
97
|
+
generateOcaOpcRequestId,
|
|
98
|
+
getValidOcaCredentials,
|
|
99
|
+
loginOcaOAuth,
|
|
100
|
+
OCI_HEADER_OPC_REQUEST_ID,
|
|
101
|
+
refreshOcaToken,
|
|
102
|
+
} from "./auth/oca";
|
|
103
|
+
export { startLocalOAuthServer } from "./auth/server";
|
|
104
|
+
export type {
|
|
105
|
+
OAuthCredentials,
|
|
106
|
+
OAuthLoginCallbacks,
|
|
107
|
+
OAuthPrompt,
|
|
108
|
+
OAuthProviderInterface,
|
|
109
|
+
OcaClientMetadata,
|
|
110
|
+
OcaMode,
|
|
111
|
+
OcaOAuthConfig,
|
|
112
|
+
OcaOAuthEnvironmentConfig,
|
|
113
|
+
OcaOAuthProviderOptions,
|
|
114
|
+
OcaTokenResolution,
|
|
115
|
+
} from "./auth/types";
|
|
1
116
|
export * from "./index";
|
|
117
|
+
export type {
|
|
118
|
+
FastFileIndexOptions,
|
|
119
|
+
MentionEnricherOptions,
|
|
120
|
+
MentionEnrichmentResult,
|
|
121
|
+
} from "./input";
|
|
122
|
+
export {
|
|
123
|
+
enrichPromptWithMentions,
|
|
124
|
+
getFileIndex,
|
|
125
|
+
prewarmFileIndex,
|
|
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";
|
|
138
|
+
export {
|
|
139
|
+
formatRulesForSystemPrompt,
|
|
140
|
+
isRuleEnabled,
|
|
141
|
+
listEnabledRulesFromWatcher,
|
|
142
|
+
loadRulesForSystemPromptFromWatcher,
|
|
143
|
+
} from "./runtime/rules";
|
|
144
|
+
export {
|
|
145
|
+
createTeamName,
|
|
146
|
+
DefaultRuntimeBuilder,
|
|
147
|
+
} from "./runtime/runtime-builder";
|
|
148
|
+
export {
|
|
149
|
+
type SandboxCallOptions,
|
|
150
|
+
SubprocessSandbox,
|
|
151
|
+
type SubprocessSandboxOptions,
|
|
152
|
+
} from "./runtime/sandbox/subprocess-sandbox";
|
|
153
|
+
export type {
|
|
154
|
+
BuiltRuntime,
|
|
155
|
+
RuntimeBuilder,
|
|
156
|
+
RuntimeBuilderInput,
|
|
157
|
+
SessionRuntime,
|
|
158
|
+
} from "./runtime/session-runtime";
|
|
159
|
+
export {
|
|
160
|
+
type DesktopToolApprovalOptions,
|
|
161
|
+
requestDesktopToolApproval,
|
|
162
|
+
} from "./runtime/tool-approval";
|
|
163
|
+
export type { AvailableWorkflow } from "./runtime/workflows";
|
|
164
|
+
export {
|
|
165
|
+
listAvailableWorkflowsFromWatcher,
|
|
166
|
+
resolveWorkflowSlashCommandFromWatcher,
|
|
167
|
+
} from "./runtime/workflows";
|
|
168
|
+
export { DefaultSessionManager } from "./session/default-session-manager";
|
|
169
|
+
export { RpcCoreSessionService } from "./session/rpc-session-service";
|
|
170
|
+
export {
|
|
171
|
+
deriveSubsessionStatus,
|
|
172
|
+
makeSubSessionId,
|
|
173
|
+
makeTeamTaskSubSessionId,
|
|
174
|
+
sanitizeSessionToken,
|
|
175
|
+
} from "./session/session-graph";
|
|
176
|
+
export type {
|
|
177
|
+
CreateSessionHostOptions,
|
|
178
|
+
SessionBackend,
|
|
179
|
+
SessionHost,
|
|
180
|
+
} from "./session/session-host";
|
|
181
|
+
export {
|
|
182
|
+
createSessionHost,
|
|
183
|
+
resolveSessionBackend,
|
|
184
|
+
} from "./session/session-host";
|
|
185
|
+
export type {
|
|
186
|
+
SendSessionInput,
|
|
187
|
+
SessionAccumulatedUsage,
|
|
188
|
+
SessionManager,
|
|
189
|
+
StartSessionInput,
|
|
190
|
+
StartSessionResult,
|
|
191
|
+
} from "./session/session-manager";
|
|
192
|
+
export type { SessionManifest } from "./session/session-manifest";
|
|
193
|
+
export type {
|
|
194
|
+
CreateRootSessionWithArtifactsInput,
|
|
195
|
+
RootSessionArtifacts,
|
|
196
|
+
} from "./session/session-service";
|
|
197
|
+
export { CoreSessionService } from "./session/session-service";
|
|
198
|
+
export {
|
|
199
|
+
createSqliteRpcSessionBackend,
|
|
200
|
+
SqliteRpcSessionBackend,
|
|
201
|
+
type SqliteRpcSessionBackendOptions,
|
|
202
|
+
} from "./session/sqlite-rpc-session-backend";
|
|
203
|
+
export type {
|
|
204
|
+
WorkspaceManager,
|
|
205
|
+
WorkspaceManagerEvent,
|
|
206
|
+
} from "./session/workspace-manager";
|
|
207
|
+
export { InMemoryWorkspaceManager } from "./session/workspace-manager";
|
|
208
|
+
export type { WorkspaceManifest } from "./session/workspace-manifest";
|
|
209
|
+
export {
|
|
210
|
+
buildWorkspaceMetadata,
|
|
211
|
+
emptyWorkspaceManifest,
|
|
212
|
+
generateWorkspaceInfo,
|
|
213
|
+
normalizeWorkspacePath,
|
|
214
|
+
upsertWorkspaceInfo,
|
|
215
|
+
WorkspaceInfoSchema,
|
|
216
|
+
WorkspaceManifestSchema,
|
|
217
|
+
} from "./session/workspace-manifest";
|
|
218
|
+
export {
|
|
219
|
+
type MigrateLegacyProviderSettingsOptions,
|
|
220
|
+
type MigrateLegacyProviderSettingsResult,
|
|
221
|
+
migrateLegacyProviderSettings,
|
|
222
|
+
} from "./storage/provider-settings-legacy-migration";
|
|
223
|
+
export { ProviderSettingsManager } from "./storage/provider-settings-manager";
|
|
224
|
+
export { SqliteSessionStore } from "./storage/sqlite-session-store";
|