@clinebot/shared 0.0.12 → 0.0.14
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 +1 -1
- package/dist/connectors/adapters.d.ts +143 -0
- package/dist/db/index.js +2 -2
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.js +18 -18
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -18
- package/dist/remote-config/constants.d.ts +5 -0
- package/dist/remote-config/schema.d.ts +426 -0
- package/dist/rpc/index.d.ts +4 -0
- package/package.json +10 -3
- package/src/connectors/adapters.ts +152 -0
- package/src/db/sqlite-db.ts +11 -4
- package/src/index.browser.ts +2 -0
- package/src/index.ts +2 -0
- package/src/remote-config/constants.ts +5 -0
- package/src/remote-config/schema.test.ts +1004 -0
- package/src/remote-config/schema.ts +263 -0
- package/src/rpc/index.ts +4 -0
package/README.md
CHANGED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export type ConnectWhatsAppOptions = {
|
|
2
|
+
userName: string;
|
|
3
|
+
phoneNumberId?: string;
|
|
4
|
+
accessToken?: string;
|
|
5
|
+
appSecret?: string;
|
|
6
|
+
verifyToken?: string;
|
|
7
|
+
apiVersion?: string;
|
|
8
|
+
cwd: string;
|
|
9
|
+
model?: string;
|
|
10
|
+
provider?: string;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
systemPrompt?: string;
|
|
13
|
+
mode: "act" | "plan";
|
|
14
|
+
interactive: boolean;
|
|
15
|
+
maxIterations?: number;
|
|
16
|
+
enableTools: boolean;
|
|
17
|
+
rpcAddress: string;
|
|
18
|
+
hookCommand?: string;
|
|
19
|
+
port: number;
|
|
20
|
+
host: string;
|
|
21
|
+
baseUrl: string;
|
|
22
|
+
};
|
|
23
|
+
export type WhatsAppConnectorState = {
|
|
24
|
+
instanceKey: string;
|
|
25
|
+
userName: string;
|
|
26
|
+
phoneNumberId?: string;
|
|
27
|
+
pid: number;
|
|
28
|
+
rpcAddress: string;
|
|
29
|
+
port: number;
|
|
30
|
+
baseUrl: string;
|
|
31
|
+
startedAt: string;
|
|
32
|
+
};
|
|
33
|
+
export type ConnectTelegramOptions = {
|
|
34
|
+
botToken: string;
|
|
35
|
+
botUsername: string;
|
|
36
|
+
cwd: string;
|
|
37
|
+
model?: string;
|
|
38
|
+
provider?: string;
|
|
39
|
+
apiKey?: string;
|
|
40
|
+
systemPrompt?: string;
|
|
41
|
+
mode: "act" | "plan";
|
|
42
|
+
interactive: boolean;
|
|
43
|
+
maxIterations?: number;
|
|
44
|
+
enableTools: boolean;
|
|
45
|
+
rpcAddress: string;
|
|
46
|
+
hookCommand?: string;
|
|
47
|
+
};
|
|
48
|
+
export type TelegramConnectorState = {
|
|
49
|
+
botUsername: string;
|
|
50
|
+
pid: number;
|
|
51
|
+
rpcAddress: string;
|
|
52
|
+
startedAt: string;
|
|
53
|
+
};
|
|
54
|
+
export type ConnectSlackOptions = {
|
|
55
|
+
userName: string;
|
|
56
|
+
botToken?: string;
|
|
57
|
+
signingSecret?: string;
|
|
58
|
+
clientId?: string;
|
|
59
|
+
clientSecret?: string;
|
|
60
|
+
encryptionKey?: string;
|
|
61
|
+
installationKeyPrefix?: string;
|
|
62
|
+
cwd: string;
|
|
63
|
+
model?: string;
|
|
64
|
+
provider?: string;
|
|
65
|
+
apiKey?: string;
|
|
66
|
+
systemPrompt?: string;
|
|
67
|
+
mode: "act" | "plan";
|
|
68
|
+
interactive: boolean;
|
|
69
|
+
maxIterations?: number;
|
|
70
|
+
enableTools: boolean;
|
|
71
|
+
rpcAddress: string;
|
|
72
|
+
hookCommand?: string;
|
|
73
|
+
port: number;
|
|
74
|
+
host: string;
|
|
75
|
+
baseUrl: string;
|
|
76
|
+
};
|
|
77
|
+
export type SlackConnectorState = {
|
|
78
|
+
userName: string;
|
|
79
|
+
pid: number;
|
|
80
|
+
rpcAddress: string;
|
|
81
|
+
port: number;
|
|
82
|
+
baseUrl: string;
|
|
83
|
+
startedAt: string;
|
|
84
|
+
};
|
|
85
|
+
export type ConnectGoogleChatOptions = {
|
|
86
|
+
userName: string;
|
|
87
|
+
cwd: string;
|
|
88
|
+
model?: string;
|
|
89
|
+
provider?: string;
|
|
90
|
+
apiKey?: string;
|
|
91
|
+
systemPrompt?: string;
|
|
92
|
+
mode: "act" | "plan";
|
|
93
|
+
interactive: boolean;
|
|
94
|
+
maxIterations?: number;
|
|
95
|
+
enableTools: boolean;
|
|
96
|
+
rpcAddress: string;
|
|
97
|
+
hookCommand?: string;
|
|
98
|
+
port: number;
|
|
99
|
+
host: string;
|
|
100
|
+
baseUrl: string;
|
|
101
|
+
pubsubTopic?: string;
|
|
102
|
+
impersonateUser?: string;
|
|
103
|
+
useApplicationDefaultCredentials: boolean;
|
|
104
|
+
credentialsJson?: string;
|
|
105
|
+
};
|
|
106
|
+
export type GoogleChatConnectorState = {
|
|
107
|
+
userName: string;
|
|
108
|
+
pid: number;
|
|
109
|
+
rpcAddress: string;
|
|
110
|
+
port: number;
|
|
111
|
+
baseUrl: string;
|
|
112
|
+
startedAt: string;
|
|
113
|
+
};
|
|
114
|
+
export type ConnectLinearOptions = {
|
|
115
|
+
userName: string;
|
|
116
|
+
apiKey?: string;
|
|
117
|
+
clientId?: string;
|
|
118
|
+
clientSecret?: string;
|
|
119
|
+
accessToken?: string;
|
|
120
|
+
webhookSecret: string;
|
|
121
|
+
cwd: string;
|
|
122
|
+
model?: string;
|
|
123
|
+
provider?: string;
|
|
124
|
+
apiProviderKey?: string;
|
|
125
|
+
systemPrompt?: string;
|
|
126
|
+
mode: "act" | "plan";
|
|
127
|
+
interactive: boolean;
|
|
128
|
+
maxIterations?: number;
|
|
129
|
+
enableTools: boolean;
|
|
130
|
+
rpcAddress: string;
|
|
131
|
+
hookCommand?: string;
|
|
132
|
+
port: number;
|
|
133
|
+
host: string;
|
|
134
|
+
baseUrl: string;
|
|
135
|
+
};
|
|
136
|
+
export type LinearConnectorState = {
|
|
137
|
+
userName: string;
|
|
138
|
+
pid: number;
|
|
139
|
+
rpcAddress: string;
|
|
140
|
+
port: number;
|
|
141
|
+
baseUrl: string;
|
|
142
|
+
startedAt: string;
|
|
143
|
+
};
|
package/dist/db/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var I=Object.defineProperty;var J=(S)=>S;function K(S,x){this[S]=J.bind(null,x)}var _=(S,x)=>{for(var B in x)I(S,B,{get:x[B],enumerable:!0,configurable:!0,set:K.bind(x,B)})};import{mkdirSync as Q}from"node:fs";import{createRequire as U}from"node:module";import{dirname as V}from"node:path";function W(){return new Date().toISOString()}function X(S){return S?1:0}function Z(S){return typeof S==="string"?S:""}function $(S){if(typeof S!=="string")return;let x=S.trim();return x.length>0?x:void 0}function k(S){return S===1||S===!0}function y(S){return{prepare:(x)=>S.query(x),exec:(x)=>S.exec(x)}}function F(S){return{prepare:(x)=>{let B=S.prepare(x);return{run:(...j)=>B.run(...j),get:(...j)=>B.get(...j)??null,all:(...j)=>B.all(...j)}},exec:(x)=>S.exec(x)}}function H(S){Q(V(S),{recursive:!0});let x=U(import.meta.url);if(typeof globalThis.Bun<"u"){let{Database:B}=x("bun:sqlite");return y(new B(S,{create:!0}))}try{let B=process.emitWarning;process.emitWarning=(O,...z)=>{if((typeof O==="string"?O:O?.message??"").includes("SQLite"))return;return B.call(process,O,...z)};let{DatabaseSync:j}=x(["node",":sqlite"].join(""));return process.emitWarning=B,F(new j(S))}catch{}try{return new(x(["better","-sqlite3"].join("")))(S)}catch(B){throw Error("SQLite requires Node's built-in sqlite support or the optional dependency better-sqlite3. Install better-sqlite3 when running on older Node versions without node:sqlite.",{cause:B})}}var L=[`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,4 +77,4 @@ var J=Object.defineProperty;var K=(S)=>S;function Q(S,x){this[S]=K.bind(null,x)}
|
|
|
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);`],Y=[{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:"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 D(S,x){return new Set(S.prepare(`PRAGMA table_info(${x});`).all().map((B)=>B.name))}function G(S,x={}){S.exec("PRAGMA journal_mode = WAL;"),S.exec("PRAGMA busy_timeout = 5000;");for(let O of L)S.exec(O);if(!x.includeLegacyMigrations)return;let B=new Map,j=(O)=>{let z=B.get(O);if(!z)z=D(S,O),B.set(O,z);return z};for(let O of Y)if(!j(O.table).has(O.column)){if(S.exec(O.sql),O.column==="workspace_root")S.exec("UPDATE sessions SET workspace_root = cwd WHERE workspace_root IS NULL OR workspace_root = '';")}}export{X as toBoolInt,W as nowIso,H as loadSqliteDb,G as ensureSessionSchema,Z as asString,$ as asOptionalString,k as asBool};
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { OAuthProviderId } from "./auth/constants";
|
|
2
2
|
export { AUTH_ERROR_PATTERNS, isLikelyAuthError, isOAuthProviderId, OAUTH_PROVIDER_IDS, } from "./auth/constants";
|
|
3
|
+
export type * from "./connectors/adapters";
|
|
3
4
|
export type { ConnectorHookEvent, ConnectorHookEventName, } from "./connectors/events";
|
|
4
5
|
export { ConnectorHookEventNameSchema, ConnectorHookEventSchema, } from "./connectors/events";
|
|
5
6
|
export { MODELS_DEV_PROVIDER_KEY_ENTRIES, MODELS_DEV_PROVIDER_KEY_MAP, resolveProviderModelCatalogKeys, } from "./llms/model-id";
|
|
@@ -10,6 +11,7 @@ export { parseJsonStream, safeJsonStringify } from "./parse/json";
|
|
|
10
11
|
export { formatHumanReadableDate } from "./parse/time";
|
|
11
12
|
export { validateWithZod, zodToJsonSchema } from "./parse/zod";
|
|
12
13
|
export { formatFileContentBlock, formatUserInputBlock, normalizeUserInput, xmlTagsRemoval, } from "./prompt/format";
|
|
14
|
+
export { CLINE_DEFAULT_RPC_ADDRESS, CLINE_DEFAULT_RPC_PORT } from "./rpc";
|
|
13
15
|
export type { RpcAddProviderActionRequest, RpcAgentMode, RpcChatAttachmentFile, RpcChatAttachments, RpcChatMessage, RpcChatRunTurnRequest, RpcChatRuntimeConfigBase, RpcChatRuntimeLoggerConfig, RpcChatStartSessionArtifacts, RpcChatStartSessionRequest, RpcChatStartSessionResponse, RpcChatToolCallResult, RpcChatTurnResult, RpcClineAccountActionRequest, RpcClineAccountBalance, RpcClineAccountOrganization, RpcClineAccountOrganizationBalance, RpcClineAccountOrganizationUsageTransaction, RpcClineAccountPaymentTransaction, RpcClineAccountUsageTransaction, RpcClineAccountUser, RpcGetProviderModelsActionRequest, RpcListProvidersActionRequest, RpcOAuthProviderId, RpcProviderActionRequest, RpcProviderCapability, RpcProviderCatalogResponse, RpcProviderListItem, RpcProviderModel, RpcProviderModelsResponse, RpcProviderOAuthLoginResponse, RpcProviderSettingsActionRequest, RpcSaveProviderSettingsActionRequest, RpcSessionStorageOptions, } from "./rpc/runtime";
|
|
14
16
|
export type { TeamProgressCounts, TeamProgressLifecycleEvent, TeamProgressMemberRole, TeamProgressMemberStatus, TeamProgressOutcomeFragmentStatus, TeamProgressOutcomeStatus, TeamProgressProjectionEvent, TeamProgressRunStatus, TeamProgressSummary, TeamProgressTaskStatus, } from "./rpc/team-progress";
|
|
15
17
|
export { RPC_TEAM_LIFECYCLE_EVENT_TYPE, RPC_TEAM_PROGRESS_EVENT_TYPE, } from "./rpc/team-progress";
|