@clinebot/shared 0.0.14 → 0.0.16

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.
@@ -2,29 +2,83 @@ import { z } from "zod";
2
2
  export declare const ConnectorHookEventNameSchema: z.ZodEnum<{
3
3
  "connector.started": "connector.started";
4
4
  "connector.stopping": "connector.stopping";
5
+ "session.authorize": "session.authorize";
5
6
  "message.received": "message.received";
7
+ "message.denied": "message.denied";
6
8
  "message.completed": "message.completed";
7
9
  "message.failed": "message.failed";
8
10
  "session.started": "session.started";
9
11
  "session.reused": "session.reused";
10
- "thread.reset": "thread.reset";
12
+ "session.reset": "session.reset";
11
13
  "schedule.delivery.started": "schedule.delivery.started";
12
14
  "schedule.delivery.sent": "schedule.delivery.sent";
13
15
  "schedule.delivery.failed": "schedule.delivery.failed";
14
16
  }>;
15
17
  export type ConnectorHookEventName = z.infer<typeof ConnectorHookEventNameSchema>;
18
+ export declare const ConnectorEventActorSchema: z.ZodObject<{
19
+ id: z.ZodOptional<z.ZodString>;
20
+ label: z.ZodOptional<z.ZodString>;
21
+ role: z.ZodOptional<z.ZodString>;
22
+ participantKey: z.ZodOptional<z.ZodString>;
23
+ participantLabel: z.ZodOptional<z.ZodString>;
24
+ platformUserId: z.ZodOptional<z.ZodString>;
25
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
26
+ }, z.core.$strip>;
27
+ export declare const ConnectorEventContextSchema: z.ZodObject<{
28
+ source: z.ZodString;
29
+ sourceEvent: z.ZodString;
30
+ threadId: z.ZodString;
31
+ channelId: z.ZodString;
32
+ isDM: z.ZodBoolean;
33
+ sessionId: z.ZodOptional<z.ZodString>;
34
+ workspaceRoot: z.ZodOptional<z.ZodString>;
35
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
36
+ }, z.core.$strip>;
37
+ export declare const ConnectorAuthorizationRequestSchema: z.ZodObject<{
38
+ actor: z.ZodObject<{
39
+ id: z.ZodOptional<z.ZodString>;
40
+ label: z.ZodOptional<z.ZodString>;
41
+ role: z.ZodOptional<z.ZodString>;
42
+ participantKey: z.ZodOptional<z.ZodString>;
43
+ participantLabel: z.ZodOptional<z.ZodString>;
44
+ platformUserId: z.ZodOptional<z.ZodString>;
45
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
46
+ }, z.core.$strip>;
47
+ context: z.ZodObject<{
48
+ source: z.ZodString;
49
+ sourceEvent: z.ZodString;
50
+ threadId: z.ZodString;
51
+ channelId: z.ZodString;
52
+ isDM: z.ZodBoolean;
53
+ sessionId: z.ZodOptional<z.ZodString>;
54
+ workspaceRoot: z.ZodOptional<z.ZodString>;
55
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
56
+ }, z.core.$strip>;
57
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
58
+ }, z.core.$strip>;
59
+ export declare const ConnectorAuthorizationDecisionSchema: z.ZodObject<{
60
+ action: z.ZodDefault<z.ZodEnum<{
61
+ allow: "allow";
62
+ deny: "deny";
63
+ }>>;
64
+ message: z.ZodOptional<z.ZodString>;
65
+ reason: z.ZodOptional<z.ZodString>;
66
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
67
+ }, z.core.$strip>;
16
68
  export declare const ConnectorHookEventSchema: z.ZodObject<{
17
69
  adapter: z.ZodString;
18
70
  botUserName: z.ZodOptional<z.ZodString>;
19
71
  event: z.ZodEnum<{
20
72
  "connector.started": "connector.started";
21
73
  "connector.stopping": "connector.stopping";
74
+ "session.authorize": "session.authorize";
22
75
  "message.received": "message.received";
76
+ "message.denied": "message.denied";
23
77
  "message.completed": "message.completed";
24
78
  "message.failed": "message.failed";
25
79
  "session.started": "session.started";
26
80
  "session.reused": "session.reused";
27
- "thread.reset": "thread.reset";
81
+ "session.reset": "session.reset";
28
82
  "schedule.delivery.started": "schedule.delivery.started";
29
83
  "schedule.delivery.sent": "schedule.delivery.sent";
30
84
  "schedule.delivery.failed": "schedule.delivery.failed";
@@ -33,3 +87,7 @@ export declare const ConnectorHookEventSchema: z.ZodObject<{
33
87
  ts: z.ZodString;
34
88
  }, z.core.$strip>;
35
89
  export type ConnectorHookEvent = z.infer<typeof ConnectorHookEventSchema>;
90
+ export type ConnectorEventActor = z.infer<typeof ConnectorEventActorSchema>;
91
+ export type ConnectorEventContext = z.infer<typeof ConnectorEventContextSchema>;
92
+ export type ConnectorAuthorizationRequest = z.infer<typeof ConnectorAuthorizationRequestSchema>;
93
+ export type ConnectorAuthorizationDecision = z.infer<typeof ConnectorAuthorizationDecisionSchema>;
package/dist/db/index.js CHANGED
@@ -1,4 +1,4 @@
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 (
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),close:()=>S.close?.()}}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),close:()=>S.close?.()}}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,
@@ -8,6 +8,7 @@ export type SqliteStatement = {
8
8
  export type SqliteDb = {
9
9
  prepare: (sql: string) => SqliteStatement;
10
10
  exec: (sql: string) => void;
11
+ close?: () => void;
11
12
  };
12
13
  export declare function nowIso(): string;
13
14
  export declare function toBoolInt(value: boolean): number;
@@ -1,8 +1,8 @@
1
1
  export type { OAuthProviderId } from "./auth/constants";
2
2
  export { AUTH_ERROR_PATTERNS, isLikelyAuthError, isOAuthProviderId, OAUTH_PROVIDER_IDS, } from "./auth/constants";
3
3
  export type * from "./connectors/adapters";
4
- export type { ConnectorHookEvent, ConnectorHookEventName, } from "./connectors/events";
5
- export { ConnectorHookEventNameSchema, ConnectorHookEventSchema, } from "./connectors/events";
4
+ export type { ConnectorAuthorizationDecision, ConnectorAuthorizationRequest, ConnectorEventActor, ConnectorEventContext, ConnectorHookEvent, ConnectorHookEventName, } from "./connectors/events";
5
+ export { ConnectorAuthorizationDecisionSchema, ConnectorAuthorizationRequestSchema, ConnectorEventActorSchema, ConnectorEventContextSchema, ConnectorHookEventNameSchema, ConnectorHookEventSchema, } from "./connectors/events";
6
6
  export { MODELS_DEV_PROVIDER_KEY_ENTRIES, MODELS_DEV_PROVIDER_KEY_MAP, resolveProviderModelCatalogKeys, } from "./llms/model-id";
7
7
  export type { Tool, ToolApprovalRequest, ToolApprovalResult, ToolCallRecord, ToolContext, ToolPolicy, } from "./llms/tools";
8
8
  export { ToolCallRecordSchema, ToolContextSchema } from "./llms/tools";
@@ -11,6 +11,8 @@ export { parseJsonStream, safeJsonStringify } from "./parse/json";
11
11
  export { formatHumanReadableDate } from "./parse/time";
12
12
  export { validateWithZod, zodToJsonSchema } from "./parse/zod";
13
13
  export { formatFileContentBlock, formatUserInputBlock, normalizeUserInput, xmlTagsRemoval, } from "./prompt/format";
14
+ export * from "./remote-config/constants";
15
+ export * from "./remote-config/schema";
14
16
  export { CLINE_DEFAULT_RPC_ADDRESS, CLINE_DEFAULT_RPC_PORT } from "./rpc";
15
17
  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";
16
18
  export type { TeamProgressCounts, TeamProgressLifecycleEvent, TeamProgressMemberRole, TeamProgressMemberStatus, TeamProgressOutcomeFragmentStatus, TeamProgressOutcomeStatus, TeamProgressProjectionEvent, TeamProgressRunStatus, TeamProgressSummary, TeamProgressTaskStatus, } from "./rpc/team-progress";