@cline/shared 0.0.75 → 0.0.76
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/dist/agent.d.ts +38 -13
- package/dist/agents/types.d.ts +63 -6
- package/dist/db/index.js +11 -11
- package/dist/extensions/contribution-registry.d.ts +5 -0
- package/dist/hub.d.ts +73 -3
- package/dist/index.browser.d.ts +5 -4
- package/dist/index.browser.js +20 -20
- package/dist/index.d.ts +7 -6
- package/dist/index.js +62 -62
- package/dist/llms/ai-sdk-format.d.ts +5 -2
- package/dist/llms/gateway.d.ts +33 -0
- package/dist/llms/media.d.ts +59 -0
- package/dist/llms/messages.d.ts +7 -1
- package/dist/llms/model-info.d.ts +145 -3
- package/dist/llms/model-tools.d.ts +9 -3
- package/dist/llms/reasoning-options.d.ts +1 -1
- package/dist/remote-config/index.js +10 -10
- package/dist/remote-config/runtime.d.ts +6 -1
- package/dist/rpc/runtime.d.ts +26 -0
- package/dist/session/runtime-config.d.ts +3 -3
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/storage/paths.d.ts +15 -0
- package/dist/tasks.d.ts +156 -0
- package/dist/team/schema.d.ts +12 -12
- package/package.json +1 -1
package/dist/agent.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* These are the canonical type definitions consumed by `AgentRuntime`.
|
|
5
5
|
*
|
|
6
6
|
*/
|
|
7
|
+
import type { GeneratedMedia } from "./llms/media";
|
|
7
8
|
import type { ModelInfo } from "./llms/model-info";
|
|
8
9
|
import type { ToolApprovalRequest, ToolApprovalResult, ToolPolicy } from "./llms/tools";
|
|
9
10
|
import type { BasicLogger } from "./logging/logger";
|
|
@@ -28,6 +29,10 @@ export interface AgentFilePart {
|
|
|
28
29
|
path: string;
|
|
29
30
|
content: string;
|
|
30
31
|
}
|
|
32
|
+
export interface AgentMediaPart {
|
|
33
|
+
type: "media";
|
|
34
|
+
media: GeneratedMedia;
|
|
35
|
+
}
|
|
31
36
|
export interface AgentToolCallPart {
|
|
32
37
|
type: "tool-call";
|
|
33
38
|
toolCallId: string;
|
|
@@ -56,7 +61,7 @@ export interface AgentModelToolActivity {
|
|
|
56
61
|
output?: unknown;
|
|
57
62
|
isError?: boolean;
|
|
58
63
|
}
|
|
59
|
-
export type AgentMessagePart = AgentTextPart | AgentReasoningPart | AgentImagePart | AgentFilePart | AgentToolCallPart | AgentToolResultPart;
|
|
64
|
+
export type AgentMessagePart = AgentTextPart | AgentReasoningPart | AgentImagePart | AgentFilePart | AgentMediaPart | AgentToolCallPart | AgentToolResultPart;
|
|
60
65
|
export type AgentMessageRole = "user" | "assistant" | "tool";
|
|
61
66
|
export interface AgentTokenUsage {
|
|
62
67
|
inputTokens: number;
|
|
@@ -188,6 +193,9 @@ export type ProviderErrorClass = "context_window_exceeded" | "unknown";
|
|
|
188
193
|
export type AgentModelEvent = {
|
|
189
194
|
type: "text-delta";
|
|
190
195
|
text: string;
|
|
196
|
+
} | {
|
|
197
|
+
type: "media";
|
|
198
|
+
media: GeneratedMedia;
|
|
191
199
|
} | {
|
|
192
200
|
type: "reasoning-delta";
|
|
193
201
|
text: string;
|
|
@@ -206,22 +214,15 @@ export type AgentModelEvent = {
|
|
|
206
214
|
} | {
|
|
207
215
|
type: "tool-result";
|
|
208
216
|
toolCallId: string;
|
|
209
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Declared model tools carry a ModelToolName; provider-executed tools
|
|
219
|
+
* (e.g. the Claude Code CLI's own tools) carry arbitrary names.
|
|
220
|
+
*/
|
|
221
|
+
toolName: string;
|
|
210
222
|
input?: unknown;
|
|
211
223
|
output: unknown;
|
|
212
224
|
isError?: boolean;
|
|
213
225
|
execution: ModelToolExecution;
|
|
214
|
-
} | {
|
|
215
|
-
/**
|
|
216
|
-
* A model-generated file (e.g. an image from an image-output
|
|
217
|
-
* model). `data` is base64-encoded file data (or a URL for
|
|
218
|
-
* URL-referenced files). Runtimes assemble it into the assistant
|
|
219
|
-
* message (`AgentImagePart` for `image/*`, `AgentFilePart`
|
|
220
|
-
* otherwise) so a file-only turn is not treated as empty.
|
|
221
|
-
*/
|
|
222
|
-
type: "file";
|
|
223
|
-
data: string;
|
|
224
|
-
mediaType: string;
|
|
225
226
|
} | {
|
|
226
227
|
type: "usage";
|
|
227
228
|
usage: Partial<AgentUsage>;
|
|
@@ -275,6 +276,13 @@ export interface AgentBeforeToolResult {
|
|
|
275
276
|
reason?: string;
|
|
276
277
|
input?: unknown;
|
|
277
278
|
policy?: ToolPolicy;
|
|
279
|
+
/**
|
|
280
|
+
* Text to inject into the conversation as hook context (e.g. a hook's
|
|
281
|
+
* `contextModification`). Collected across hooks and appended after this
|
|
282
|
+
* iteration's tool results as a `<hook_context>` user message, so the
|
|
283
|
+
* model sees it on the next request.
|
|
284
|
+
*/
|
|
285
|
+
appendContext?: string;
|
|
278
286
|
}
|
|
279
287
|
export interface AgentAfterToolContext {
|
|
280
288
|
snapshot: AgentRuntimeStateSnapshot;
|
|
@@ -290,6 +298,13 @@ export interface AgentAfterToolResult {
|
|
|
290
298
|
stop?: boolean;
|
|
291
299
|
reason?: string;
|
|
292
300
|
result?: AgentToolResult;
|
|
301
|
+
/**
|
|
302
|
+
* Text to inject into the conversation as hook context (e.g. a hook's
|
|
303
|
+
* `contextModification`). Collected across hooks and appended after this
|
|
304
|
+
* iteration's tool results as a `<hook_context>` user message, so the
|
|
305
|
+
* model sees it on the next request.
|
|
306
|
+
*/
|
|
307
|
+
appendContext?: string;
|
|
293
308
|
}
|
|
294
309
|
export interface AgentRunLifecycleContext {
|
|
295
310
|
snapshot: AgentRuntimeStateSnapshot;
|
|
@@ -322,6 +337,11 @@ export interface AgentRuntimePlugin {
|
|
|
322
337
|
setup?: (context: AgentRuntimePluginContext) => AgentRuntimePluginSetup | undefined | Promise<AgentRuntimePluginSetup | undefined>;
|
|
323
338
|
}
|
|
324
339
|
export interface AgentRuntimeConfig {
|
|
340
|
+
/**
|
|
341
|
+
* Stable end-user distinct ID used for provider and observability metadata.
|
|
342
|
+
* This is intentionally separate from the host-owned session id.
|
|
343
|
+
*/
|
|
344
|
+
distinctId?: string;
|
|
325
345
|
/**
|
|
326
346
|
* Core/hub runtime session identifier.
|
|
327
347
|
*
|
|
@@ -398,6 +418,11 @@ export type AgentRuntimeEvent = {
|
|
|
398
418
|
accumulatedText: string;
|
|
399
419
|
redacted?: boolean;
|
|
400
420
|
metadata?: unknown;
|
|
421
|
+
} | {
|
|
422
|
+
type: "assistant-media";
|
|
423
|
+
snapshot: AgentRuntimeStateSnapshot;
|
|
424
|
+
iteration: number;
|
|
425
|
+
media: GeneratedMedia;
|
|
401
426
|
} | {
|
|
402
427
|
type: "assistant-message";
|
|
403
428
|
snapshot: AgentRuntimeStateSnapshot;
|
package/dist/agents/types.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type { AgentRuntimeHooks, AgentTool, ProviderErrorClass } from "../agent"
|
|
|
14
14
|
import type { ExtensionContext } from "../extensions/context";
|
|
15
15
|
import type { AgentExtensionApi, AgentExtensionHooks, AgentExtensionRegistry as AgentExtensionRegistryGeneric, ContributionRegistryExtension, PluginManifest, PluginSetupContext } from "../extensions/contribution-registry";
|
|
16
16
|
import type { HookControl } from "../hooks/contracts";
|
|
17
|
+
import type { GeneratedMedia } from "../llms/media";
|
|
17
18
|
import type { Message, MessageWithMetadata } from "../llms/messages";
|
|
18
19
|
import type { ModelInfo } from "../llms/model-info";
|
|
19
20
|
import type { ModelTool } from "../llms/model-tools";
|
|
@@ -27,7 +28,7 @@ import type { WorkspaceInfo } from "../session/workspace";
|
|
|
27
28
|
* Events emitted during agent execution
|
|
28
29
|
*/
|
|
29
30
|
export type AgentEvent = AgentContentStartEvent | AgentContentUpdateEvent | AgentContentEndEvent | AgentIterationStartEvent | AgentIterationEndEvent | AgentNoticeEvent | AgentUsageEvent | AgentDoneEvent | AgentErrorEvent;
|
|
30
|
-
export type AgentContentType = "text" | "reasoning" | "tool";
|
|
31
|
+
export type AgentContentType = "text" | "reasoning" | "media" | "tool";
|
|
31
32
|
export interface AgentEventMetadata {
|
|
32
33
|
/** Current ID */
|
|
33
34
|
agentId?: string;
|
|
@@ -73,6 +74,8 @@ export interface AgentContentEndEvent extends AgentEventMetadata {
|
|
|
73
74
|
text?: string;
|
|
74
75
|
/** Final reasoning/thinking text generated for this turn */
|
|
75
76
|
reasoning?: string;
|
|
77
|
+
/** Generated media returned by the model. */
|
|
78
|
+
media?: GeneratedMedia;
|
|
76
79
|
/** Name of the tool that completed */
|
|
77
80
|
toolName?: string;
|
|
78
81
|
/** Unique identifier for this tool call */
|
|
@@ -563,8 +566,8 @@ export declare const AgentResultSchema: z.ZodObject<{
|
|
|
563
566
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
564
567
|
maxInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
565
568
|
capabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
566
|
-
images: "images";
|
|
567
569
|
video: "video";
|
|
570
|
+
images: "images";
|
|
568
571
|
tools: "tools";
|
|
569
572
|
streaming: "streaming";
|
|
570
573
|
"prompt-cache": "prompt-cache";
|
|
@@ -576,11 +579,39 @@ export declare const AgentResultSchema: z.ZodObject<{
|
|
|
576
579
|
temperature: "temperature";
|
|
577
580
|
files: "files";
|
|
578
581
|
}>>>;
|
|
582
|
+
operation: z.ZodOptional<z.ZodEnum<{
|
|
583
|
+
language: "language";
|
|
584
|
+
"image-generation": "image-generation";
|
|
585
|
+
"speech-generation": "speech-generation";
|
|
586
|
+
"video-generation": "video-generation";
|
|
587
|
+
transcription: "transcription";
|
|
588
|
+
}>>;
|
|
589
|
+
operationModes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
590
|
+
streaming: "streaming";
|
|
591
|
+
batch: "batch";
|
|
592
|
+
}>>>;
|
|
593
|
+
modalities: z.ZodOptional<z.ZodObject<{
|
|
594
|
+
input: z.ZodArray<z.ZodEnum<{
|
|
595
|
+
image: "image";
|
|
596
|
+
audio: "audio";
|
|
597
|
+
video: "video";
|
|
598
|
+
text: "text";
|
|
599
|
+
pdf: "pdf";
|
|
600
|
+
}>>;
|
|
601
|
+
output: z.ZodArray<z.ZodEnum<{
|
|
602
|
+
image: "image";
|
|
603
|
+
audio: "audio";
|
|
604
|
+
video: "video";
|
|
605
|
+
text: "text";
|
|
606
|
+
pdf: "pdf";
|
|
607
|
+
}>>;
|
|
608
|
+
}, z.core.$strip>>;
|
|
579
609
|
reasoningOptions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
580
610
|
type: z.ZodLiteral<"toggle">;
|
|
581
611
|
}, z.core.$strict>, z.ZodObject<{
|
|
582
612
|
type: z.ZodLiteral<"effort">;
|
|
583
613
|
values: z.ZodArray<z.ZodNullable<z.ZodEnum<{
|
|
614
|
+
default: "default";
|
|
584
615
|
none: "none";
|
|
585
616
|
minimal: "minimal";
|
|
586
617
|
low: "low";
|
|
@@ -588,7 +619,6 @@ export declare const AgentResultSchema: z.ZodObject<{
|
|
|
588
619
|
high: "high";
|
|
589
620
|
xhigh: "xhigh";
|
|
590
621
|
max: "max";
|
|
591
|
-
default: "default";
|
|
592
622
|
}>>>;
|
|
593
623
|
}, z.core.$strict>, z.ZodObject<{
|
|
594
624
|
type: z.ZodLiteral<"budget_tokens">;
|
|
@@ -838,8 +868,8 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
838
868
|
contextWindow: z.ZodOptional<z.ZodNumber>;
|
|
839
869
|
maxInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
840
870
|
capabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
841
|
-
images: "images";
|
|
842
871
|
video: "video";
|
|
872
|
+
images: "images";
|
|
843
873
|
tools: "tools";
|
|
844
874
|
streaming: "streaming";
|
|
845
875
|
"prompt-cache": "prompt-cache";
|
|
@@ -851,11 +881,39 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
851
881
|
temperature: "temperature";
|
|
852
882
|
files: "files";
|
|
853
883
|
}>>>;
|
|
884
|
+
operation: z.ZodOptional<z.ZodEnum<{
|
|
885
|
+
language: "language";
|
|
886
|
+
"image-generation": "image-generation";
|
|
887
|
+
"speech-generation": "speech-generation";
|
|
888
|
+
"video-generation": "video-generation";
|
|
889
|
+
transcription: "transcription";
|
|
890
|
+
}>>;
|
|
891
|
+
operationModes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
892
|
+
streaming: "streaming";
|
|
893
|
+
batch: "batch";
|
|
894
|
+
}>>>;
|
|
895
|
+
modalities: z.ZodOptional<z.ZodObject<{
|
|
896
|
+
input: z.ZodArray<z.ZodEnum<{
|
|
897
|
+
image: "image";
|
|
898
|
+
audio: "audio";
|
|
899
|
+
video: "video";
|
|
900
|
+
text: "text";
|
|
901
|
+
pdf: "pdf";
|
|
902
|
+
}>>;
|
|
903
|
+
output: z.ZodArray<z.ZodEnum<{
|
|
904
|
+
image: "image";
|
|
905
|
+
audio: "audio";
|
|
906
|
+
video: "video";
|
|
907
|
+
text: "text";
|
|
908
|
+
pdf: "pdf";
|
|
909
|
+
}>>;
|
|
910
|
+
}, z.core.$strip>>;
|
|
854
911
|
reasoningOptions: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
855
912
|
type: z.ZodLiteral<"toggle">;
|
|
856
913
|
}, z.core.$strict>, z.ZodObject<{
|
|
857
914
|
type: z.ZodLiteral<"effort">;
|
|
858
915
|
values: z.ZodArray<z.ZodNullable<z.ZodEnum<{
|
|
916
|
+
default: "default";
|
|
859
917
|
none: "none";
|
|
860
918
|
minimal: "minimal";
|
|
861
919
|
low: "low";
|
|
@@ -863,7 +921,6 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
863
921
|
high: "high";
|
|
864
922
|
xhigh: "xhigh";
|
|
865
923
|
max: "max";
|
|
866
|
-
default: "default";
|
|
867
924
|
}>>>;
|
|
868
925
|
}, z.core.$strict>, z.ZodObject<{
|
|
869
926
|
type: z.ZodLiteral<"budget_tokens">;
|
|
@@ -913,7 +970,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
913
970
|
initialMessages: z.ZodOptional<z.ZodArray<z.ZodCustom<Message, Message>>>;
|
|
914
971
|
systemPrompt: z.ZodString;
|
|
915
972
|
tools: z.ZodArray<z.ZodCustom<AgentTool<unknown, unknown>, AgentTool<unknown, unknown>>>;
|
|
916
|
-
modelTools: z.ZodOptional<z.ZodArray<z.ZodCustom<
|
|
973
|
+
modelTools: z.ZodOptional<z.ZodArray<z.ZodCustom<ModelTool, ModelTool>>>;
|
|
917
974
|
maxIterations: z.ZodOptional<z.ZodNumber>;
|
|
918
975
|
maxParallelToolCalls: z.ZodDefault<z.ZodNumber>;
|
|
919
976
|
maxTokensPerTurn: z.ZodOptional<z.ZodNumber>;
|
package/dist/db/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var FZ=Object.defineProperty;var GZ=(Z)=>Z;function YZ(Z,$){this[Z]=GZ.bind(null,$)}var
|
|
1
|
+
var FZ=Object.defineProperty;var GZ=(Z)=>Z;function YZ(Z,$){this[Z]=GZ.bind(null,$)}var K0=(Z,$)=>{for(var j in $)FZ(Z,j,{get:$[j],enumerable:!0,configurable:!0,set:YZ.bind($,j)})};import{existsSync as aZ,readFileSync as eZ,renameSync as Z0}from"node:fs";import{appendFileSync as HZ,existsSync as U,mkdirSync as b,readdirSync as LZ,readFileSync as o,statSync as T}from"node:fs";import{homedir as BZ}from"node:os";import{basename as JZ,dirname as D,extname as MZ,isAbsolute as qZ,join as Q,relative as NZ,resolve as Y}from"node:path";var f="workspaces",E="chat";function OZ(Z){let $=Z.trim(),j=/^[A-Za-z]:[\\/]/.test($)||$.startsWith("\\\\"),X=$.startsWith("/");if(!j&&!X)return!1;let K=$.split(j?/[\\/]+/:/\/+/).filter(Boolean),V=K.at(-1)??"",W=K.at(-2)??"",z=K.at(-3)??"";return(K.at(-4)??"")===".cline"&&z==="data"&&W==="workspaces"&&V==="chat"}var g=".clinerules",I=".cline",m=".agents",n="agents",R="hooks",k="skills",c="rules",v="workflows",i="plugins",r="AGENTS.md";function G0(){return Q(F(),f,E)}var AZ="cline_mcp_settings.json",TZ="settings.json";function _Z(){let Z=process?.env?.HOME?.trim();if(Z&&Z!=="~")return Z;let $=process?.env?.USERPROFILE?.trim();if($)return $;let j=process?.env?.HOMEDRIVE?.trim(),X=process?.env?.HOMEPATH?.trim();if(j&&X)return`${j}${X}`;let K=BZ().trim();if(K&&K!=="~")return K;return"~"}var q=_Z(),t=!1;function Y0(Z){let $=Z.trim();if(!$)return;q=$,t=!0}function O0(Z){if(t)return;let $=Z.trim();if(!$)return;q=$}var x,a=!1;function H0(Z){let $=Z.trim();if(!$)return;x=$,a=!0}function L0(Z){if(a)return;let $=Z.trim();if(!$)return;x=$}function O(){if(x)return x;let Z=process.env.CLINE_DIR?.trim();if(Z)return Z;return Q(q,".cline")}function xZ(){return Q(q,"Documents","Cline")}function S(Z){return Q(xZ(),Z)}function F(){let Z=process.env.CLINE_DATA_DIR?.trim();if(Z)return Z;return Q(O(),"data")}function B0(){let Z=process.env.CLINE_SESSION_DATA_DIR?.trim();if(Z)return Z;return Q(F(),"sessions")}function J0(){let Z=process.env.CLINE_TEAM_DATA_DIR?.trim();if(Z)return Z;return Q(F(),"teams")}function CZ(){let Z=process.env.CLINE_CONNECTOR_DATA_DIR?.trim();if(Z)return Z;return Q(F(),"connectors")}function M0(Z,$){let j=Z.replace(/[^a-zA-Z0-9._-]+/g,"_"),X=$.replace(/[^a-zA-Z0-9._-]+/g,"_");return Q(F(),"logs","connectors",j,`${X}.log`)}function e(){let Z=process.env.CLINE_CONNECTOR_SETTINGS_PATH?.trim();if(Z)return Z;return Q(CZ(),TZ)}function y(){let Z=process.env.CLINE_DB_DATA_DIR?.trim();if(Z)return Z;return Q(F(),"db")}function ZZ(){let Z=process.env.CLINE_CONNECTORS_DB_PATH?.trim();if(Z)return Z;return Q(y(),"connectors.db")}function q0(){let Z=process.env.CLINE_CRON_DB_PATH?.trim();if(Z)return Z;return Q(y(),"cron.db")}function N0(){let Z=process.env.CLINE_TASKS_DB_PATH?.trim();if(Z)return Z;return Q(y(),"tasks.db")}function DZ(){return Q(O(),"tasks")}function IZ(Z){let $=Z.trim();if(!$)throw Error("workspaceRoot is required for workspace task scope");return Q($,".cline","tasks")}function A0(Z){let $=Z.taskSpecsDir?.trim();if($)return $;if(Z.scope==="workspace")return IZ(Z.workspaceRoot??"");return DZ()}function SZ(){return Q(O(),"cron")}function s(Z){return Q(Z,".cline","cron")}function $Z(Z){if(typeof Z==="string")return s(Z);if(Z?.cronSpecsDir?.trim())return Z.cronSpecsDir.trim();if(Z?.scope==="workspace"){let $=Z.workspaceRoot?.trim();if(!$)throw Error("workspaceRoot is required for workspace cron scope");return s($)}return SZ()}function T0(Z){return Q($Z(Z),"reports")}function _0(Z){return Q($Z(Z),"events")}function x0(){let Z=process.env.CLINE_PROVIDER_SETTINGS_PATH?.trim();if(Z)return Z;return Q(F(),"settings","providers.json")}function C0(){let Z=process.env.CLINE_GLOBAL_SETTINGS_PATH?.trim();if(Z)return Z;return Q(F(),"settings","global-settings.json")}function D0(){let Z=process.env.CLINE_MCP_SETTINGS_PATH?.trim();if(Z)return Z;return Q(F(),"settings",AZ)}function N(Z){let $=new Set,j=[];for(let X of Z){if(!X||$.has(X))continue;$.add(X),j.push(X)}return j}function fZ(Z){if(!Z)return[];return[g,I,m].map(($)=>Q(Z,$,k))}function EZ(){return Q(O(),n)}function I0(Z){return N([Z?Q(Z,I,n):"",EZ()])}function S0(Z){let $=[S("Hooks"),Q(O(),R)];if(Z)$.push(Q(Z,g,R),Q(Z,I,R));return N($)}function f0(Z){return N([...fZ(Z),Q(O(),k),Q(q,m,k)])}function RZ(){return Q(q,m,r)}function E0(Z){let $=Z?[Q(Z,g),Q(Z,I,c)]:[],j=Z?[Q(Z,r)]:[];return N([...j,...$,RZ(),Q(O(),c),S("Rules")])}function R0(Z){return N([Z?Q(Z,".clinerules",v):"",S("Workflows"),Q(O(),v),Z?Q(Z,".cline",v):""])}function v0(Z){return N([Z?Q(Z,".cline",i):"",Q(O(),i),S("Plugins")])}var jZ=new Set([".js",".ts"]),u="package.json",vZ=["index.ts","index.js"];function C(Z){let $=Z.lastIndexOf(".");if($===-1)return!1;return jZ.has(Z.slice($))}function XZ(Z){try{let $=JSON.parse(o(Z,"utf8"));if(!$.cline||typeof $.cline!=="object")return null;return $.cline}catch{return null}}function KZ(Z){let $=Z?.plugins;if(!Array.isArray($))return[];return $.flatMap((j)=>j.paths??[])}function kZ(Z){let $=Y(Z);if(!U($)||!T($).isDirectory())return null;let j=Q($,u);if(U(j)){let X=XZ(j),K=KZ(X).map((V)=>Y($,V)).filter((V)=>U(V)&&T(V).isFile()&&C(V));if(K.length>0)return K}for(let X of vZ){let K=Q($,X);if(U(K)&&T(K).isFile())return[K]}return null}function bZ(Z){try{let $=JSON.parse(o(Z,"utf8"));return typeof $.name==="string"&&$.name.trim()?$.name.trim():void 0}catch{return}}function gZ(Z,$){let j=NZ(Y(Z),Y($));return j===""||!j.startsWith("..")&&!qZ(j)}function k0(Z,$){let j=D(Z),X=Y($);while(gZ(X,j)){let K=Q(j,u);if(U(K)){let W=bZ(K);if(W)return W;break}let V=Y(j,"..");if(V===j)break;j=V}return JZ(Z,MZ(Z))}function mZ(Z){let $=Y(Z);if(!U($))return[];let j=[],X=[$];while(X.length>0){let K=X.pop();if(!K)continue;let V;try{V=LZ(K,{withFileTypes:!0})}catch{continue}for(let W of V){let z=Q(K,W.name);if(W.isDirectory()){let L=Q(z,u);if(U(L)){let B=XZ(L),l=KZ(B).map((A)=>Y(z,A)).filter((A)=>U(A)&&T(A).isFile()&&C(A));if(l.length>0){j.push(...l);continue}}X.push(z);continue}if(W.name.startsWith("."))continue;if(W.isFile()&&C(z))j.push(z)}}return j.sort((K,V)=>K.localeCompare(V))}function b0(Z,$){let j=[];for(let X of Z){let K=X.trim();if(!K)continue;let V=Y($,K);if(!U(V))throw Error(`Plugin path does not exist: ${V}`);if(T(V).isDirectory()){let z=kZ(V);if(z){j.push(...z);continue}j.push(...mZ(V));continue}if(!C(V))throw Error(`Plugin file must use a supported extension (${[...jZ].join(", ")}): ${V}`);j.push(V)}return j}function yZ(Z){let $=D(Z);if(!U($))b($,{recursive:!0})}function g0(Z){b(D(Z),{recursive:!0}),HZ(Z,"")}function m0(Z){if(Z?.trim())return yZ(Z),D(Z);let $=Q(F(),"logs");if(!U($))b($,{recursive:!0});return $}import{mkdirSync as uZ}from"node:fs";import{createRequire as wZ}from"node:module";import{dirname as PZ}from"node:path";function QZ(Z){if(Z instanceof Error)return Z.message;return String(Z)}function VZ(Z){if(Z&&typeof Z==="object"&&"code"in Z&&typeof Z.code==="string")return Z.code;return""}var pZ=3,dZ=50;function J(){return new Date().toISOString()}function _(Z){return Z?1:0}function G(Z){return typeof Z==="string"?Z:""}function w(Z){if(typeof Z!=="string")return;let $=Z.trim();return $.length>0?$:void 0}function hZ(Z){return Z===1||Z===!0}function lZ(Z){if(Z<=0)return;try{let $=new SharedArrayBuffer(4),j=new Int32Array($);Atomics.wait(j,0,0,Z)}catch{}}function cZ(Z){if(!Z||typeof Z!=="object")return!1;let $=QZ(Z),j=VZ(Z);return j==="SQLITE_BUSY"||j==="SQLITE_LOCKED"||$.includes("SQLITE_BUSY")||$.includes("SQLITE_LOCKED")||$.includes("database is locked")}function H(Z){let $=0;for(;;)try{return Z()}catch(j){if(!cZ(j)||$>=pZ)throw j;$+=1,lZ(dZ*2**($-1))}}function iZ(Z){return{prepare:($)=>{let j=Z.query($);return{run:(...X)=>H(()=>j.run(...X)),get:(...X)=>H(()=>j.get(...X)),all:(...X)=>H(()=>j.all(...X))}},exec:($)=>H(()=>Z.exec($)),close:()=>Z.close?.()}}function sZ(Z){return{prepare:($)=>{let j=Z.prepare($);return{run:(...X)=>H(()=>j.run(...X)),get:(...X)=>H(()=>j.get(...X)??null),all:(...X)=>H(()=>j.all(...X))}},exec:($)=>H(()=>Z.exec($)),close:()=>Z.close?.()}}function P(Z){uZ(PZ(Z),{recursive:!0});let $=wZ(import.meta.url);if(typeof globalThis.Bun<"u"){let{Database:X}=$("bun:sqlite");return iZ(new X(Z,{create:!0}))}let j=process.emitWarning;process.emitWarning=(X,...K)=>{if((typeof X==="string"?X:X?.message??"").includes("SQLite"))return;return j.call(process,X,...K)};try{let{DatabaseSync:X}=$(["node",":sqlite"].join(""));return sZ(new X(Z))}finally{process.emitWarning=j}}var oZ=[`CREATE TABLE IF NOT EXISTS sessions (
|
|
2
2
|
session_id TEXT PRIMARY KEY,
|
|
3
3
|
source TEXT NOT NULL,
|
|
4
4
|
pid INTEGER NOT NULL,
|
|
@@ -77,7 +77,7 @@ var FZ=Object.defineProperty;var GZ=(Z)=>Z;function YZ(Z,$){this[Z]=GZ.bind(null
|
|
|
77
77
|
FOREIGN KEY (session_id) REFERENCES sessions(session_id) ON DELETE SET NULL
|
|
78
78
|
);`,`CREATE INDEX IF NOT EXISTS idx_schedule_executions_schedule
|
|
79
79
|
ON schedule_executions(schedule_id, triggered_at DESC);`,`CREATE INDEX IF NOT EXISTS idx_schedules_next_run
|
|
80
|
-
ON schedules(enabled, next_run_at);`],
|
|
80
|
+
ON schedules(enabled, next_run_at);`],nZ=[{table:"sessions",column:"workspace_root",sql:"ALTER TABLE sessions ADD COLUMN workspace_root TEXT;"},{table:"sessions",column:"parent_session_id",sql:"ALTER TABLE sessions ADD COLUMN parent_session_id TEXT;"},{table:"sessions",column:"parent_agent_id",sql:"ALTER TABLE sessions ADD COLUMN parent_agent_id TEXT;"},{table:"sessions",column:"agent_id",sql:"ALTER TABLE sessions ADD COLUMN agent_id TEXT;"},{table:"sessions",column:"conversation_id",sql:"ALTER TABLE sessions ADD COLUMN conversation_id TEXT;"},{table:"sessions",column:"is_subagent",sql:"ALTER TABLE sessions ADD COLUMN is_subagent INTEGER NOT NULL DEFAULT 0;"},{table:"sessions",column:"messages_path",sql:"ALTER TABLE sessions ADD COLUMN messages_path TEXT;"},{table:"sessions",column:"metadata_json",sql:"ALTER TABLE sessions ADD COLUMN metadata_json TEXT;"},{table:"sessions",column:"transcript_path",sql:"ALTER TABLE sessions ADD COLUMN transcript_path TEXT NOT NULL DEFAULT '';"},{table:"schedules",column:"claim_token",sql:"ALTER TABLE schedules ADD COLUMN claim_token TEXT;"},{table:"schedules",column:"claim_started_at",sql:"ALTER TABLE schedules ADD COLUMN claim_started_at TEXT;"},{table:"schedules",column:"claim_until_at",sql:"ALTER TABLE schedules ADD COLUMN claim_until_at TEXT;"}];function rZ(Z,$){return new Set(Z.prepare(`PRAGMA table_info(${$});`).all().map((j)=>j.name))}function tZ(Z,$={}){Z.exec("PRAGMA journal_mode = WAL;"),Z.exec("PRAGMA busy_timeout = 5000;");for(let K of oZ)Z.exec(K);if(!$.includeLegacyMigrations)return;let j=new Map,X=(K)=>{let V=j.get(K);if(!V)V=rZ(Z,K),j.set(K,V);return V};for(let K of nZ)if(!X(K.table).has(K.column)){if(Z.exec(K.sql),K.column==="workspace_root")Z.exec("UPDATE sessions SET workspace_root = cwd WHERE workspace_root IS NULL OR workspace_root = '';");j.delete(K.table)}}var $0=`CREATE TABLE IF NOT EXISTS connector_configs (
|
|
81
81
|
channel TEXT PRIMARY KEY,
|
|
82
82
|
type TEXT NOT NULL,
|
|
83
83
|
values_json TEXT NOT NULL DEFAULT '{}',
|
|
@@ -85,7 +85,7 @@ var FZ=Object.defineProperty;var GZ=(Z)=>Z;function YZ(Z,$){this[Z]=GZ.bind(null
|
|
|
85
85
|
security_values_json TEXT NOT NULL DEFAULT '{}',
|
|
86
86
|
configured_at TEXT NOT NULL,
|
|
87
87
|
updated_at TEXT NOT NULL
|
|
88
|
-
);`,
|
|
88
|
+
);`,j0=`CREATE TABLE IF NOT EXISTS connector_connections (
|
|
89
89
|
channel TEXT NOT NULL,
|
|
90
90
|
instance_id TEXT NOT NULL,
|
|
91
91
|
connect_args_json TEXT NOT NULL,
|
|
@@ -94,11 +94,11 @@ var FZ=Object.defineProperty;var GZ=(Z)=>Z;function YZ(Z,$){this[Z]=GZ.bind(null
|
|
|
94
94
|
updated_at TEXT NOT NULL,
|
|
95
95
|
last_connected_at TEXT NOT NULL,
|
|
96
96
|
PRIMARY KEY (channel, instance_id)
|
|
97
|
-
);`;function UZ(Z){Z.exec("PRAGMA journal_mode = WAL;"),Z.exec("PRAGMA busy_timeout = 5000;"),Z.exec(
|
|
98
|
-
WHERE channel = ? AND instance_id = ?`).get(Z,$);return j?
|
|
97
|
+
);`;function UZ(Z){Z.exec("PRAGMA journal_mode = WAL;"),Z.exec("PRAGMA busy_timeout = 5000;"),Z.exec($0),Z.exec(j0)}function M(Z){return typeof Z==="object"&&Z!==null&&!Array.isArray(Z)}function WZ(Z){if(typeof Z!=="string"||!Z)return{};try{let $=JSON.parse(Z);if(!M($))return{};let j={};for(let[X,K]of Object.entries($))if(typeof K==="string")j[X]=K;return j}catch{return{}}}function zZ(Z){if(typeof Z!=="string"||!Z)return;try{let $=JSON.parse(Z);if(!Array.isArray($))return;return $.filter((j)=>typeof j==="string")}catch{return}}class h{dbPath;db;constructor(Z={}){this.dbPath=Z.dbPath??ZZ()}getRawDb(){if(this.db)return this.db;let Z=P(this.dbPath);return UZ(Z),this.db=Z,this.importLegacyJsonSettings(),Z}close(){this.db?.close?.(),this.db=void 0}getConfig(Z){let $=this.getRawDb().prepare("SELECT * FROM connector_configs WHERE channel = ?").get(Z);return $?p($):void 0}listConfigs(){return this.getRawDb().prepare("SELECT * FROM connector_configs ORDER BY channel ASC").all().map(p)}getConnection(Z,$){let j=this.getRawDb().prepare(`SELECT * FROM connector_connections
|
|
98
|
+
WHERE channel = ? AND instance_id = ?`).get(Z,$);return j?d(j):void 0}listConnections(Z){return(Z?this.getRawDb().prepare(`SELECT * FROM connector_connections
|
|
99
99
|
WHERE channel = ?
|
|
100
100
|
ORDER BY instance_id ASC`).all(Z):this.getRawDb().prepare(`SELECT * FROM connector_connections
|
|
101
|
-
ORDER BY channel ASC, instance_id ASC`).all()).map(
|
|
101
|
+
ORDER BY channel ASC, instance_id ASC`).all()).map(d)}upsertConfig(Z){let $=J(),j=this.getRawDb();j.exec("BEGIN IMMEDIATE;");try{let X=j.prepare("SELECT * FROM connector_configs WHERE channel = ?").get(Z.channel),K=X?p(X):void 0,W=j.prepare("SELECT * FROM connector_connections WHERE channel = ?").all(Z.channel).map(d),z=Z.updateConnectArgs&&W.length===1&&W[0]?Z.updateConnectArgs({config:K,connection:W[0]}):void 0;if(j.prepare(`INSERT INTO connector_configs (
|
|
102
102
|
channel, type, values_json, security_enabled,
|
|
103
103
|
security_values_json, configured_at, updated_at
|
|
104
104
|
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
@@ -108,9 +108,9 @@ var FZ=Object.defineProperty;var GZ=(Z)=>Z;function YZ(Z,$){this[Z]=GZ.bind(null
|
|
|
108
108
|
security_enabled = excluded.security_enabled,
|
|
109
109
|
security_values_json = excluded.security_values_json,
|
|
110
110
|
configured_at = excluded.configured_at,
|
|
111
|
-
updated_at = excluded.updated_at`).run(Z.channel,Z.type??Z.channel,JSON.stringify(Z.values),
|
|
111
|
+
updated_at = excluded.updated_at`).run(Z.channel,Z.type??Z.channel,JSON.stringify(Z.values),_(Z.security?.enabled===!0),JSON.stringify(Z.security?.values??{}),Z.configuredAt??K?.configuredAt??$,Z.updatedAt??$),z&&W[0])j.prepare(`UPDATE connector_connections
|
|
112
112
|
SET connect_args_json = ?, updated_at = ?
|
|
113
|
-
WHERE channel = ? AND instance_id = ?`).run(JSON.stringify(
|
|
113
|
+
WHERE channel = ? AND instance_id = ?`).run(JSON.stringify(z),$,Z.channel,W[0].instanceId);j.exec("COMMIT;")}catch(X){try{j.exec("ROLLBACK;")}catch{}throw X}}recordConnected(Z,$,j){let X=J();this.getRawDb().prepare(`INSERT INTO connector_connections (
|
|
114
114
|
channel, instance_id, connect_args_json,
|
|
115
115
|
last_successful_args_json, enabled, updated_at, last_connected_at
|
|
116
116
|
) VALUES (?, ?, ?, ?, 1, ?, ?)
|
|
@@ -121,7 +121,7 @@ var FZ=Object.defineProperty;var GZ=(Z)=>Z;function YZ(Z,$){this[Z]=GZ.bind(null
|
|
|
121
121
|
updated_at = excluded.updated_at,
|
|
122
122
|
last_connected_at = excluded.last_connected_at`).run(Z,$,JSON.stringify(j),JSON.stringify(j),X,X)}setEnabled(Z,$,j){if(j){this.getRawDb().prepare(`UPDATE connector_connections
|
|
123
123
|
SET enabled = ?, updated_at = ?
|
|
124
|
-
WHERE channel = ? AND instance_id = ?`).run(
|
|
124
|
+
WHERE channel = ? AND instance_id = ?`).run(_($),J(),Z,j);return}this.getRawDb().prepare(`UPDATE connector_connections
|
|
125
125
|
SET enabled = ?, updated_at = ?
|
|
126
|
-
WHERE channel = ?`).run(
|
|
127
|
-
WHERE channel = ? AND instance_id = ?`).run(Z,$).changes??0)>0}disableAll(){this.getRawDb().prepare("UPDATE connector_connections SET enabled = 0, updated_at = ?").run(J())}deleteConfig(Z){return(this.getRawDb().prepare("DELETE FROM connector_configs WHERE channel = ?").run(Z).changes??0)>0}importLegacyJsonSettings(){let Z=
|
|
126
|
+
WHERE channel = ?`).run(_($),J(),Z)}deleteConnection(Z,$){return(this.getRawDb().prepare(`DELETE FROM connector_connections
|
|
127
|
+
WHERE channel = ? AND instance_id = ?`).run(Z,$).changes??0)>0}disableAll(){this.getRawDb().prepare("UPDATE connector_connections SET enabled = 0, updated_at = ?").run(J())}deleteConfig(Z){return(this.getRawDb().prepare("DELETE FROM connector_configs WHERE channel = ?").run(Z).changes??0)>0}importLegacyJsonSettings(){let Z=e();if(!aZ(Z))return;try{let $=JSON.parse(eZ(Z,"utf8")),j=M($)&&M($.connectors)?$.connectors:{};for(let[X,K]of Object.entries(j)){if(!M(K)||this.getConfig(X))continue;let V={};if(M(K.values)){for(let[L,B]of Object.entries(K.values))if(typeof B==="string")V[L]=B}let W={},z=M(K.security)?K.security:void 0;if(z&&M(z.values)){for(let[L,B]of Object.entries(z.values))if(typeof B==="string")W[L]=B}this.upsertConfig({channel:X,type:typeof K.type==="string"?K.type:X,values:V,security:z?{enabled:z.enabled===!0,values:W}:void 0,configuredAt:typeof K.configuredAt==="string"?K.configuredAt:void 0,updatedAt:typeof K.updatedAt==="string"?K.updatedAt:void 0})}Z0(Z,`${Z}.migrated`)}catch{}}}function p(Z){let $=Z.security_enabled===1,j=WZ(Z.security_values_json),X=$||Object.keys(j).length>0;return{channel:G(Z.channel),type:G(Z.type),values:WZ(Z.values_json),security:X?{enabled:$,values:j}:void 0,configuredAt:G(Z.configured_at),updatedAt:G(Z.updated_at)}}function d(Z){return{channel:G(Z.channel),instanceId:G(Z.instance_id),connectArgs:zZ(Z.connect_args_json)??[],lastSuccessfulArgs:zZ(Z.last_successful_args_json)??[],enabled:Z.enabled===1,updatedAt:G(Z.updated_at),lastConnectedAt:w(Z.last_connected_at)??G(Z.updated_at)}}function X0(Z){let $=new h;try{return Z($)}finally{$.close()}}export{X0 as withConnectorStore,_ as toBoolInt,J as nowIso,P as loadSqliteDb,tZ as ensureSessionSchema,UZ as ensureConnectorSchema,G as asString,w as asOptionalString,hZ as asBool,h as SqliteConnectorStore};
|
|
@@ -17,6 +17,11 @@ export interface AgentExtensionRule {
|
|
|
17
17
|
id: string;
|
|
18
18
|
content: string | (() => string | Promise<string>);
|
|
19
19
|
source?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Include this rule only while the named tool is available after host,
|
|
22
|
+
* global-settings, and per-session policy filtering.
|
|
23
|
+
*/
|
|
24
|
+
whenToolAvailable?: string;
|
|
20
25
|
}
|
|
21
26
|
export interface AgentExtensionMessageBuilder<TMessage = unknown> {
|
|
22
27
|
name: string;
|
package/dist/hub.d.ts
CHANGED
|
@@ -2,11 +2,12 @@ import type { AgentMessage } from "./agent";
|
|
|
2
2
|
import type { GatewayModelSelection, JsonValue } from "./llms/gateway";
|
|
3
3
|
import type { ReasoningEffort } from "./llms/reasoning-options";
|
|
4
4
|
import type { RuntimeConfigExtensionKind } from "./session/runtime-config";
|
|
5
|
+
import type { AgendaAutomationPolicy, AgendaTaskCreateInput, AgendaTaskListInput, AgendaTaskRecord, AgendaTaskRunRecord, AgendaTaskUpdateInput } from "./tasks";
|
|
5
6
|
export type HubProtocolVersion = "v1";
|
|
6
7
|
export declare const CURRENT_HUB_PROTOCOL_VERSION: HubProtocolVersion;
|
|
7
8
|
export declare const MIN_CLIENT_HUB_PROTOCOL_VERSION: HubProtocolVersion;
|
|
8
9
|
export declare const MAX_CLIENT_HUB_PROTOCOL_VERSION: HubProtocolVersion;
|
|
9
|
-
export type HubCapabilityName = "client.register" | "client.list" | "session.create" | "session.list" | "session.get" | "session.run" | "session.abort" | "schedule.create" | "schedule.list" | "settings.get" | "settings.set" | "connector.start" | "connector.stop" | "connector.supervised";
|
|
10
|
+
export type HubCapabilityName = "client.register" | "client.list" | "session.create" | "session.list" | "session.get" | "session.run" | "session.abort" | "schedule.create" | "schedule.list" | "task.create" | "task.list" | "task.get" | "task.update" | "task.approve" | "task.cancel" | "task.run" | "task.automation.get" | "task.automation.set" | "settings.get" | "settings.set" | "connector.start" | "connector.stop" | "connector.supervised";
|
|
10
11
|
export declare const HUB_CAPABILITIES: readonly HubCapabilityName[];
|
|
11
12
|
export interface HubProtocolMetadata {
|
|
12
13
|
protocolVersion: string;
|
|
@@ -31,6 +32,8 @@ export interface ClientCapability {
|
|
|
31
32
|
scopes?: string[];
|
|
32
33
|
payloadSchema?: Record<string, unknown>;
|
|
33
34
|
}
|
|
35
|
+
/** Client capability advertised by a live user surface that can answer tool approvals. */
|
|
36
|
+
export declare const HUB_CLIENT_TOOL_APPROVAL_CAPABILITY = "approval.respond";
|
|
34
37
|
export interface HubClientRegistration {
|
|
35
38
|
clientId?: string;
|
|
36
39
|
clientType: string;
|
|
@@ -185,6 +188,7 @@ export interface ScheduleRecord {
|
|
|
185
188
|
scheduleId: string;
|
|
186
189
|
name: string;
|
|
187
190
|
cronPattern: string;
|
|
191
|
+
timezone?: string;
|
|
188
192
|
prompt: string;
|
|
189
193
|
workspaceRoot: string;
|
|
190
194
|
cwd?: string;
|
|
@@ -229,6 +233,7 @@ export declare function readHubScheduleMode(payload: Record<string, unknown> | u
|
|
|
229
233
|
export interface HubScheduleCreateInput {
|
|
230
234
|
name: string;
|
|
231
235
|
cronPattern: string;
|
|
236
|
+
timezone?: string;
|
|
232
237
|
prompt: string;
|
|
233
238
|
workspaceRoot: string;
|
|
234
239
|
cwd?: string;
|
|
@@ -248,6 +253,7 @@ export interface HubScheduleUpdateInput {
|
|
|
248
253
|
scheduleId: string;
|
|
249
254
|
name?: string;
|
|
250
255
|
cronPattern?: string;
|
|
256
|
+
timezone?: string | null;
|
|
251
257
|
prompt?: string;
|
|
252
258
|
workspaceRoot?: string;
|
|
253
259
|
cwd?: string;
|
|
@@ -263,7 +269,71 @@ export interface HubScheduleUpdateInput {
|
|
|
263
269
|
runtimeOptions?: HubSessionRuntimeOptions;
|
|
264
270
|
metadata?: Record<string, JsonValue | undefined>;
|
|
265
271
|
}
|
|
266
|
-
export
|
|
272
|
+
export interface HubTaskIdInput {
|
|
273
|
+
taskId: string;
|
|
274
|
+
}
|
|
275
|
+
export type HubTaskCreateInput = Omit<AgendaTaskCreateInput, "createdBy">;
|
|
276
|
+
export type HubTaskUpdateInput = Omit<AgendaTaskUpdateInput, "updatedBy">;
|
|
277
|
+
export interface HubTaskRevisionInput extends HubTaskIdInput {
|
|
278
|
+
expectedRevision: number;
|
|
279
|
+
}
|
|
280
|
+
export interface HubTaskCancelInput extends HubTaskRevisionInput {
|
|
281
|
+
reason?: string;
|
|
282
|
+
}
|
|
283
|
+
export interface HubTaskAutomationSetInput {
|
|
284
|
+
policy: Omit<AgendaAutomationPolicy, "updatedAt">;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Strongly typed task command payloads. This map is intentionally extensible so
|
|
288
|
+
* other Hub command families can adopt typed payloads without changing the wire
|
|
289
|
+
* envelope.
|
|
290
|
+
*/
|
|
291
|
+
export interface HubCommandInputMap {
|
|
292
|
+
"task.create": HubTaskCreateInput;
|
|
293
|
+
"task.list": AgendaTaskListInput;
|
|
294
|
+
"task.get": HubTaskIdInput;
|
|
295
|
+
"task.update": HubTaskUpdateInput;
|
|
296
|
+
"task.approve": HubTaskRevisionInput;
|
|
297
|
+
"task.cancel": HubTaskCancelInput;
|
|
298
|
+
"task.run": HubTaskRevisionInput;
|
|
299
|
+
"task.automation.get": Record<string, never>;
|
|
300
|
+
"task.automation.set": HubTaskAutomationSetInput;
|
|
301
|
+
}
|
|
302
|
+
/** Typed task command results returned in {@link HubReplyEnvelope.payload}. */
|
|
303
|
+
export interface HubCommandOutputMap {
|
|
304
|
+
"task.create": {
|
|
305
|
+
task: AgendaTaskRecord;
|
|
306
|
+
};
|
|
307
|
+
"task.list": {
|
|
308
|
+
tasks: AgendaTaskRecord[];
|
|
309
|
+
};
|
|
310
|
+
"task.get": {
|
|
311
|
+
task?: AgendaTaskRecord;
|
|
312
|
+
};
|
|
313
|
+
"task.update": {
|
|
314
|
+
task: AgendaTaskRecord;
|
|
315
|
+
};
|
|
316
|
+
"task.approve": {
|
|
317
|
+
task: AgendaTaskRecord;
|
|
318
|
+
};
|
|
319
|
+
"task.cancel": {
|
|
320
|
+
task: AgendaTaskRecord;
|
|
321
|
+
};
|
|
322
|
+
"task.run": {
|
|
323
|
+
task: AgendaTaskRecord;
|
|
324
|
+
run?: AgendaTaskRunRecord;
|
|
325
|
+
};
|
|
326
|
+
"task.automation.get": {
|
|
327
|
+
policy: AgendaAutomationPolicy;
|
|
328
|
+
};
|
|
329
|
+
"task.automation.set": {
|
|
330
|
+
policy: AgendaAutomationPolicy;
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
export type HubTypedCommandName = keyof HubCommandInputMap & HubCommandName;
|
|
334
|
+
export type HubCommandInput<TCommand extends HubTypedCommandName> = HubCommandInputMap[TCommand];
|
|
335
|
+
export type HubCommandOutput<TCommand extends HubTypedCommandName> = HubCommandOutputMap[TCommand];
|
|
336
|
+
export type HubCommandName = "client.register" | "client.update" | "client.unregister" | "client.list" | "cline.account.get_current" | "prompt_commands.list" | "prompt_commands.execute" | "mention_files.search" | "catalog.list" | "session.list" | "session.create" | "session.attach" | "session.detach" | "session.get" | "session.messages" | "session.restore" | "session.delete" | "session.update" | "session.update_connection" | "session.compaction.get" | "session.compaction.update" | "session.pending_prompts" | "session.update_pending_prompt" | "session.remove_pending_prompt" | "session.fork" | "session.hook" | "run.start" | "session.send_input" | "run.abort" | "run.proceed_while_running" | "approval.request" | "approval.respond" | "capability.request" | "capability.progress" | "capability.respond" | "peer.register" | "peer.list_sessions" | "peer.attach_session" | "peer.detach_session" | "peer.proxy_command" | "schedule.create" | "schedule.list" | "schedule.get" | "schedule.update" | "schedule.delete" | "schedule.enable" | "schedule.disable" | "schedule.trigger" | "schedule.list_executions" | "schedule.stats" | "schedule.active" | "schedule.upcoming" | "task.create" | "task.list" | "task.get" | "task.update" | "task.approve" | "task.cancel" | "task.run" | "task.automation.get" | "task.automation.set" | "settings.list" | "settings.get" | "settings.patch" | "settings.toggle" | "connector.channels" | "connector.configure" | "connector.delete_config" | "connector.start" | "connector.stop" | "connector.supervised" | "cron.event.ingest" | "cron.event.list" | "cron.event.get" | "ui.notify" | "ui.show_window";
|
|
267
337
|
export declare const HUB_DEFAULT_COMMAND_TIMEOUT_MS = 30000;
|
|
268
338
|
export declare const HUB_COMMAND_SLOW_LOG_MS = 5000;
|
|
269
339
|
export declare function getDefaultHubCommandTimeoutMs(command: HubCommandName): number | null;
|
|
@@ -288,7 +358,7 @@ export interface HubReplyEnvelope {
|
|
|
288
358
|
details?: Record<string, unknown>;
|
|
289
359
|
};
|
|
290
360
|
}
|
|
291
|
-
export type HubEventName = "hub.client.registered" | "hub.client.disconnected" | "session.created" | "session.updated" | "session.attached" | "session.detached" | "session.forked" | "session.pending_prompts" | "session.pending_prompt_submitted" | "run.started" | "run.heartbeat" | "run.aborted" | "run.completed" | "run.failed" | "iteration.started" | "iteration.finished" | "assistant.delta" | "assistant.finished" | "session.notice" | "reasoning.delta" | "reasoning.finished" | "agent.done" | "usage.updated" | "tool.started" | "tool.updated" | "tool.finished" | "approval.requested" | "approval.resolved" | "capability.requested" | "capability.resolved" | "team.progress" | "artifact.created" | "diff.created" | "spoke.started" | "spoke.failed" | "spoke.stopped" | "peer.registered" | "peer.session_attached" | "peer.session_detached" | "schedule.created" | "schedule.updated" | "schedule.deleted" | "schedule.triggered" | "schedule.execution_completed" | "schedule.execution_failed" | "settings.changed" | "ui.notify" | "ui.show_window" | "hub.client.updated";
|
|
361
|
+
export type HubEventName = "hub.client.registered" | "hub.client.disconnected" | "session.created" | "session.updated" | "session.attached" | "session.detached" | "session.forked" | "session.pending_prompts" | "session.pending_prompt_submitted" | "run.started" | "run.heartbeat" | "run.aborted" | "run.completed" | "run.failed" | "iteration.started" | "iteration.finished" | "assistant.delta" | "assistant.media" | "assistant.finished" | "session.notice" | "reasoning.delta" | "reasoning.finished" | "agent.done" | "usage.updated" | "tool.started" | "tool.updated" | "tool.finished" | "approval.requested" | "approval.resolved" | "capability.requested" | "capability.resolved" | "team.progress" | "artifact.created" | "diff.created" | "spoke.started" | "spoke.failed" | "spoke.stopped" | "peer.registered" | "peer.session_attached" | "peer.session_detached" | "schedule.created" | "schedule.updated" | "schedule.deleted" | "schedule.triggered" | "schedule.execution_completed" | "schedule.execution_failed" | "task.created" | "task.updated" | "task.deleted" | "task.run.started" | "task.run.completed" | "task.run.failed" | "task.automation.updated" | "settings.changed" | "ui.notify" | "ui.show_window" | "hub.client.updated";
|
|
292
362
|
export interface HubEventEnvelope {
|
|
293
363
|
version: HubProtocolVersion;
|
|
294
364
|
event: HubEventName;
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -18,9 +18,9 @@ export * from "./hub";
|
|
|
18
18
|
export type { AiSdkFormatterMessage, AiSdkFormatterMessageRole, AiSdkFormatterPart, AiSdkMessage, AiSdkMessagePart, } from "./llms/ai-sdk-format";
|
|
19
19
|
export { EMPTY_CONTENT_TEXT, formatMessagesForAiSdk, sanitizeSurrogates, toAiSdkToolResultOutput, } from "./llms/ai-sdk-format";
|
|
20
20
|
export * from "./llms/gateway";
|
|
21
|
-
export { createMediaBudgetState, DEFAULT_MAX_IMAGE_BASE64_BYTES, DEFAULT_MAX_IMAGE_DECODED_BYTES, DEFAULT_MAX_IMAGE_ENCODED_BYTES, DEFAULT_MAX_TOTAL_MEDIA_BYTES, IMAGE_OMITTED_PLACEHOLDER, IMAGE_UNSUPPORTED_PLACEHOLDER, type ImageMediaLimits, type ImageMediaValidationFailure, type ImageMediaValidationResult, type ImageMediaValidationSuccess, imageBase64DecodedByteLength, imageBase64EncodedByteLength, imageBase64LengthForDecodedBytes, imageFileMaxDecodedBytesForBase64Limit, isBase64Char, isCanonicalBase64, type MediaBudgetOptions, type MediaBudgetState, type ResolvedMediaBudget, reserveImageMediaBytes, resolveMediaBudget, SUPPORTED_IMAGE_MEDIA_TYPES, validateAndReserveImageMedia, validateImageMedia, } from "./llms/media";
|
|
22
|
-
export type { ContentBlock, FileContent, ImageContent, Message, MessageRole, MessageWithMetadata, RedactedThinkingContent, TextContent, ThinkingContent, ToolDefinition, ToolResultContent, ToolUseContent, } from "./llms/messages";
|
|
23
|
-
export { ApiFormat, ApiFormatSchema, type ModelCapability, ModelCapabilitySchema, type ModelInfo, ModelInfoSchema, type ModelMetadata, ModelMetadataSchema, type ModelPricing, ModelPricingSchema, type ModelStatus, ModelStatusSchema, type ThinkingConfig, ThinkingConfigSchema, } from "./llms/model-info";
|
|
21
|
+
export { type Base64MediaValidationFailure, type Base64MediaValidationResult, type Base64MediaValidationSuccess, createMediaBudgetState, DEFAULT_MAX_IMAGE_BASE64_BYTES, DEFAULT_MAX_IMAGE_DECODED_BYTES, DEFAULT_MAX_IMAGE_ENCODED_BYTES, DEFAULT_MAX_TOTAL_MEDIA_BYTES, type GeneratedMedia, type GeneratedMediaModality, GeneratedMediaModalitySchema, GeneratedMediaSchema, type GeneratedMediaSource, GeneratedMediaSourceSchema, generatedMediaModalityFromMediaType, IMAGE_OMITTED_PLACEHOLDER, IMAGE_UNSUPPORTED_PLACEHOLDER, type ImageMediaLimits, type ImageMediaValidationFailure, type ImageMediaValidationResult, type ImageMediaValidationSuccess, imageBase64DecodedByteLength, imageBase64EncodedByteLength, imageBase64LengthForDecodedBytes, imageFileMaxDecodedBytesForBase64Limit, isBase64Char, isCanonicalBase64, isGeneratedMedia, type MediaBudgetOptions, type MediaBudgetState, type ResolvedMediaBudget, reserveImageMediaBytes, resolveMediaBudget, SUPPORTED_IMAGE_MEDIA_TYPES, validateAndReserveBase64Media, validateAndReserveImageMedia, validateImageMedia, } from "./llms/media";
|
|
22
|
+
export type { ContentBlock, FileContent, ImageContent, MediaContent, Message, MessageRole, MessageWithMetadata, RedactedThinkingContent, TextContent, ThinkingContent, ToolDefinition, ToolResultContent, ToolUseContent, } from "./llms/messages";
|
|
23
|
+
export { ApiFormat, ApiFormatSchema, type ChatCompatibleModelDescriptor, type ChatModelModalities, isChatCompatibleModel, type ModelCapability, ModelCapabilitySchema, type ModelInfo, ModelInfoSchema, type ModelMetadata, ModelMetadataSchema, type ModelModalities, ModelModalitiesSchema, type ModelModality, ModelModalitySchema, type ModelOperation, type ModelOperationMode, ModelOperationModeSchema, ModelOperationSchema, type ModelPricing, ModelPricingSchema, type ModelStatus, ModelStatusSchema, modelHasCapability, modelProducesImages, modelSupportsToolCalling, supportsChatModalities, type ThinkingConfig, ThinkingConfigSchema, usesImageGenerationOperation, } from "./llms/model-info";
|
|
24
24
|
export { mergeModelOptions } from "./llms/model-options";
|
|
25
25
|
export * from "./llms/model-tools";
|
|
26
26
|
export { DEFAULT_REASONING_EFFORT, REASONING_EFFORT_RATIOS, resolveEffectiveReasoningEffort, resolveReasoningBudgetFromRatio, resolveReasoningEffortRatio, } from "./llms/reasoning-effort";
|
|
@@ -49,7 +49,7 @@ export { REMOTE_URI_SCHEME } from "./remote-config/constants";
|
|
|
49
49
|
export type { AnthropicModel, AnthropicSettings, APIKeySettings, AwsBedrockCustomModel, AwsBedrockModel, AwsBedrockSettings, EnterpriseTelemetry, GlobalInstructionsFile, LiteLLMModel, LiteLLMSettings, MCPServer, OpenAiCompatible, OpenAiCompatibleModel, PromptUploading, ProviderSettings, RemoteConfig, RemoteMCPServer, S3AccessKeySettings, VertexModel, VertexSettings, } from "./remote-config/schema";
|
|
50
50
|
export { AllowedMCPServerSchema, AnthropicModelSchema, AnthropicSchema, APIKeySchema, AwsBedrockCustomModelSchema, AwsBedrockModelSchema, AwsBedrockSettingsSchema, ClineModelSchema, ClineSettingsSchema, EnterpriseTelemetrySchema, GlobalInstructionsFileSchema, LiteLLMModelSchema, LiteLLMSchema, OpenAiCompatibleModelSchema, OpenAiCompatibleSchema, PromptUploadingSchema, RemoteConfigSchema, RemoteMCPServerSchema, S3AccessKeySettingsSchema, VertexModelSchema, VertexSettingsSchema, } from "./remote-config/schema";
|
|
51
51
|
export { CLINE_DEFAULT_RPC_ADDRESS, CLINE_DEFAULT_RPC_PORT } from "./rpc";
|
|
52
|
-
export type { AddProviderActionRequest, ChatAttachmentFile, ChatAttachments, ChatRunTurnRequest, ChatRuntimeConfig, ChatStartSessionArtifacts, ChatStartSessionRequest, ChatStartSessionResponse, ChatToolCallResult, ChatTurnResult, ClineAccountActionRequest, EnterpriseAuthenticateRequest, EnterpriseAuthenticateResponse, EnterpriseStatusRequest, EnterpriseStatusResponse, EnterpriseSyncRequest, EnterpriseSyncResponse, GetProviderModelsActionRequest, ListProvidersActionRequest, ProviderActionRequest, ProviderCapability, ProviderCatalogResponse, ProviderClient, ProviderConfigField, ProviderConfigFieldOption, ProviderConfigFieldPrimitive, ProviderConfigFieldType, ProviderListItem, ProviderModel, ProviderModelsResponse, ProviderOAuthLoginResponse, ProviderProtocol, ProviderSettingsActionRequest, RuntimeLoggerConfig, SaveProviderSettingsActionRequest, } from "./rpc/runtime";
|
|
52
|
+
export type { AddProviderActionRequest, ChatAttachmentFile, ChatAttachments, ChatRunTurnRequest, ChatRuntimeConfig, ChatStartSessionArtifacts, ChatStartSessionRequest, ChatStartSessionResponse, ChatToolCallResult, ChatTurnResult, ClineAccountActionRequest, EnterpriseAuthenticateRequest, EnterpriseAuthenticateResponse, EnterpriseStatusRequest, EnterpriseStatusResponse, EnterpriseSyncRequest, EnterpriseSyncResponse, GetProviderModelsActionRequest, ListProvidersActionRequest, ProviderActionRequest, ProviderCapability, ProviderCatalogResponse, ProviderClient, ProviderConfigField, ProviderConfigFieldOption, ProviderConfigFieldPrimitive, ProviderConfigFieldType, ProviderListItem, ProviderModel, ProviderModelFeatured, ProviderModelFeaturedTier, ProviderModelsResponse, ProviderOAuthLoginResponse, ProviderProtocol, ProviderSettingsActionRequest, RuntimeLoggerConfig, SaveProviderSettingsActionRequest, VoiceInputSelection, } from "./rpc/runtime";
|
|
53
53
|
export { ProviderCapabilitySchema, ProviderClientSchema, ProviderProtocolSchema, } from "./rpc/runtime";
|
|
54
54
|
export type { TeamProgressCounts, TeamProgressLifecycleEvent, TeamProgressMemberRole, TeamProgressMemberStatus, TeamProgressOutcomeFragmentStatus, TeamProgressOutcomeStatus, TeamProgressProjectionEvent, TeamProgressRunStatus, TeamProgressSummary, TeamProgressTaskStatus, } from "./rpc/team-progress";
|
|
55
55
|
export { TEAM_LIFECYCLE_EVENT_TYPE, TEAM_PROGRESS_EVENT_TYPE, } from "./rpc/team-progress";
|
|
@@ -69,6 +69,7 @@ export { DEFAULT_RUNTIME_CONFIG_EXTENSIONS, hasRuntimeConfigExtension, isRuntime
|
|
|
69
69
|
export type { RuntimeEnv } from "./session/runtime-env";
|
|
70
70
|
export * from "./session/workspace";
|
|
71
71
|
export { CLINE_CHAT_WORKSPACE_DIRECTORY_NAME, CLINE_WORKSPACES_DIRECTORY_NAME, isChatWorkspacePath, } from "./storage/chat-workspace-paths";
|
|
72
|
+
export * from "./tasks";
|
|
72
73
|
export * from "./team";
|
|
73
74
|
export { createTool } from "./tools/create";
|
|
74
75
|
export { AUTH_ERROR_PATTERNS, isLikelyAuthError } from "./types/auth";
|