@cline/core 0.0.74 → 0.0.75
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/ClineCore.d.ts +13 -3
- package/dist/cline-core/types.d.ts +2 -2
- package/dist/extensions/plugin/plugin-sandbox.d.ts +8 -0
- package/dist/extensions/plugin-sandbox-bootstrap.js +1 -1
- package/dist/extensions/tools/runtime.d.ts +1 -0
- package/dist/hub/client/index.d.ts +15 -0
- package/dist/hub/client/managed-hub-build-watcher.d.ts +10 -3
- package/dist/hub/client/session-client.d.ts +2 -2
- package/dist/hub/daemon/entry.js +189 -189
- package/dist/hub/daemon/index.d.ts +19 -0
- package/dist/hub/discovery/index.d.ts +42 -13
- package/dist/hub/discovery/workspace.d.ts +9 -0
- package/dist/hub/index.js +176 -176
- package/dist/hub/runtime-host/hub-runtime-host.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +177 -177
- package/dist/runtime/host/local-runtime-host.d.ts +2 -2
- package/dist/runtime/host/runtime-host-support.d.ts +1 -1
- package/dist/runtime/host/runtime-host.d.ts +4 -4
- package/dist/runtime/orchestration/runtime-event-adapter.d.ts +1 -1
- package/dist/runtime/orchestration/session-runtime.d.ts +2 -1
- package/dist/runtime/tools/subprocess-sandbox-lifecycle.d.ts +9 -0
- package/dist/runtime/tools/subprocess-sandbox.d.ts +19 -0
- package/dist/services/global-settings.d.ts +13 -1
- package/dist/services/telemetry/index.js +1 -1
- package/dist/session/checkpoint-restore.d.ts +4 -4
- package/dist/session/display-messages.d.ts +28 -0
- package/dist/session/persisted-tool-result-content.d.ts +8 -0
- package/dist/session/services/persistence-service.d.ts +2 -2
- package/dist/session/session-snapshot.d.ts +2 -2
- package/dist/session/session-versioning-service.d.ts +4 -4
- package/dist/session/stores/session-manifest-store.d.ts +1 -1
- package/dist/session/team/team-child-session-manager.d.ts +2 -2
- package/dist/types.d.ts +2 -3
- package/package.json +4 -4
package/dist/ClineCore.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ClineCoreAutomationApi, ClineCoreListHistoryOptions, ClineCoreOptions, ClineCoreSettingsApi, ClineCoreStartInput, CompareCheckpointInput, CompareCheckpointResult, RestoreInput, RestoreResult } from "./cline-core/types";
|
|
2
2
|
import type { PendingPromptsServiceApi, RuntimeHost, RuntimeHostSubscribeOptions, SessionConnectionRuntimeService, SessionModelRuntimeService, SessionUsageRuntimeService, StartSessionInput, StartSessionResult } from "./runtime/host/runtime-host";
|
|
3
3
|
import { FeatureFlagsService } from "./services/feature-flags";
|
|
4
|
+
import { type SessionDisplayMessage } from "./session/display-messages";
|
|
4
5
|
import type { CoreSessionEvent } from "./types/events";
|
|
5
6
|
import type { SessionHistoryRecord } from "./types/sessions";
|
|
6
7
|
export type { ClineAutomationEventIngressResult, ClineAutomationEventLog, ClineAutomationEventSuppression, ClineAutomationListEventsOptions, ClineAutomationListRunsOptions, ClineAutomationListSpecsOptions, ClineAutomationRun, ClineAutomationRunStatus, ClineAutomationSpec, ClineCoreAutomationApi, ClineCoreAutomationOptions, ClineCoreListHistoryOptions, ClineCoreOptions, ClineCoreSettingsApi, ClineCoreStartInput, CompareCheckpointInput, CompareCheckpointResult, HubOptions, RemoteOptions, RestoreInput, RestoreOptions, RestoreResult, RuntimeHostMode, StartSessionBootstrap, } from "./cline-core/types";
|
|
@@ -229,10 +230,12 @@ export declare class ClineCore {
|
|
|
229
230
|
*/
|
|
230
231
|
readSessionCompactionState: RuntimeHost["readSessionCompactionState"];
|
|
231
232
|
/**
|
|
232
|
-
* Reads message history for a session.
|
|
233
|
+
* Reads the canonical message history for a session.
|
|
233
234
|
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
235
|
+
* This is the model/replay representation used by resume, fork, and
|
|
236
|
+
* compaction. Provider-owned model-tool activity remains observational
|
|
237
|
+
* metadata here. Use {@link readDisplayMessages} for a UI transcript with
|
|
238
|
+
* that activity projected into ordinary tool blocks.
|
|
236
239
|
*
|
|
237
240
|
* @example
|
|
238
241
|
* ```ts
|
|
@@ -243,6 +246,13 @@ export declare class ClineCore {
|
|
|
243
246
|
* ```
|
|
244
247
|
*/
|
|
245
248
|
readMessages: RuntimeHost["readSessionMessages"];
|
|
249
|
+
/**
|
|
250
|
+
* Reads a transcript projected for presentation. Observational model-tool
|
|
251
|
+
* activity is represented with the same tool blocks as ordinary local tools.
|
|
252
|
+
*
|
|
253
|
+
* Use {@link readMessages} for resume, fork, compaction, or model replay.
|
|
254
|
+
*/
|
|
255
|
+
readDisplayMessages(sessionId: string): Promise<SessionDisplayMessage[]>;
|
|
246
256
|
/**
|
|
247
257
|
* Reads message history for a session, preferring the live in-memory
|
|
248
258
|
* conversation when the session is still resident in this host.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MessageWithMetadata } from "@cline/llms";
|
|
2
2
|
import type { AgentConfig, AutomationEventEnvelope, BasicLogger, ITelemetryService } from "@cline/shared";
|
|
3
3
|
import type { CronEventSuppression } from "../cron/events/cron-event-ingress";
|
|
4
4
|
import type { CronEventLogRecord, CronRunRecord, CronSpecRecord } from "../cron/store/sqlite-cron-store";
|
|
@@ -119,7 +119,7 @@ export interface RestoreInput {
|
|
|
119
119
|
export interface RestoreResult {
|
|
120
120
|
sessionId?: string;
|
|
121
121
|
startResult?: StartSessionResult;
|
|
122
|
-
messages?:
|
|
122
|
+
messages?: MessageWithMetadata[];
|
|
123
123
|
checkpoint: CheckpointEntry;
|
|
124
124
|
}
|
|
125
125
|
export interface CompareCheckpointInput {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { AgentConfig, PluginSetupContext, WorkspaceInfo } from "@cline/shared";
|
|
2
2
|
import type { PluginLoadDiagnostics } from "./plugin-load-report";
|
|
3
3
|
import type { PluginTargeting } from "./plugin-targeting";
|
|
4
|
+
export declare const CLINE_PLUGIN_IDLE_TIMEOUT_MS_ENV = "CLINE_PLUGIN_IDLE_TIMEOUT_MS";
|
|
5
|
+
export declare const DEFAULT_PLUGIN_SANDBOX_IDLE_TIMEOUT_MS: number;
|
|
4
6
|
export type SandboxedPluginSetupContext = Pick<PluginSetupContext, "session" | "client" | "user" | "workspaceInfo" | "logger">;
|
|
5
7
|
export interface PluginSandboxOptions extends PluginTargeting {
|
|
6
8
|
pluginPaths: string[];
|
|
@@ -14,6 +16,12 @@ export interface PluginSandboxOptions extends PluginTargeting {
|
|
|
14
16
|
importTimeoutMs?: number;
|
|
15
17
|
hookTimeoutMs?: number;
|
|
16
18
|
contributionTimeoutMs?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Reclaim the plugin subprocess after this much time with no calls in
|
|
21
|
+
* flight. Defaults to 30 minutes and can be overridden with
|
|
22
|
+
* `CLINE_PLUGIN_IDLE_TIMEOUT_MS`.
|
|
23
|
+
*/
|
|
24
|
+
idleTimeoutMs?: number;
|
|
17
25
|
onEvent?: (event: {
|
|
18
26
|
name: string;
|
|
19
27
|
payload?: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as QG}from"node:module";var UG=QG(import.meta.url);import{normalizePluginManifest as BG}from"@cline/shared";import{existsSync as _,readFileSync as C}from"node:fs";import{builtinModules as XG,createRequire as R}from"node:module";import{dirname as J,extname as I,isAbsolute as YG,resolve as q}from"node:path";import{fileURLToPath as h}from"node:url";import{PLUGIN_FILE_EXTENSIONS as ZG}from"@cline/shared";var m=J(h(import.meta.url)),$G=R(import.meta.url),KG=q(m,"..","..","..","..",".."),T=_G(KG),qG=["@cline/sdk","@cline/agents","@cline/core","@cline/core/hub","@cline/core/hub/daemon-entry","@cline/core/telemetry","@cline/llms","@cline/llms/browser","@cline/shared","@cline/shared/automation","@cline/shared/browser","@cline/shared/storage","@cline/shared/db","@cline/shared/types"],k=new Set(XG.flatMap((G)=>[G,G.replace(/^node:/,"")])),j=new Set(ZG),WG=["development","node","import","require","default"];function _G(G){let Q={},U={"@cline/sdk":q(G,"packages/sdk/src/index.ts"),"@cline/agents":q(G,"packages/agents/src/index.ts"),"@cline/core":q(G,"packages/core/src/index.ts"),"@cline/llms":q(G,"packages/llms/src/index.ts"),"@cline/shared":q(G,"packages/shared/src/index.ts"),"@cline/shared/storage":q(G,"packages/shared/src/storage/index.ts"),"@cline/shared/db":q(G,"packages/shared/src/db/index.ts")};for(let[Y,Z]of Object.entries(U))if(_(Z))Q[Y]=Z;for(let Y of["agents","core","llms","shared"]){let Z=q(G,"packages",Y),$=q(Z,"package.json");if(!_($))continue;try{let X=JSON.parse(C($,"utf8"));if(typeof X.name!=="string"||!X.exports)continue;if(typeof X.exports==="string"){let K=q(Z,X.exports);if(_(K))Q[X.name]=K;continue}if(typeof X.exports!=="object")continue;for(let[K,A]of Object.entries(X.exports)){let L=wG(Z,A);if(!L)continue;let w=K==="."?X.name:`${X.name}/${K.replace(/^\.\//,"")}`;Q[w]=L}}catch{}}return Q}function wG(G,Q){let U=v(Q);if(!U)return null;let Y=d(G,U);for(let Z of Y)if(_(Z))return Z;return null}function v(G,Q=new Set){if(typeof G==="string")return G;if(!G||typeof G!=="object")return null;if(Q.has(G))return null;Q.add(G);let U=G;for(let Y of WG){let Z=v(U[Y],Q);if(Z)return Z}return null}function d(G,Q){let U=Q.replace(/^\.\//,""),Y=[q(G,Q)];if(U.startsWith("dist/")){let Z=U.replace(/^dist\//,"src/").replace(/\.(mjs|cjs|js)$/,"");return[q(G,`${Z}.ts`),q(G,`${Z}.tsx`),q(G,`${Z}.mts`),q(G,`${Z}.cts`),...Y]}return Y}function AG(G){return Object.fromEntries(Object.entries(G).sort(([Q],[U])=>U.length-Q.length))}function H(G){return!(G.startsWith(".")||G.startsWith("/")||G.startsWith("file:")||G.startsWith("data:")||G.startsWith("http:")||G.startsWith("https:"))}function M(G){if(G.startsWith("@")){let[Q,U]=G.split("/",3);return U?`${Q}/${U}`:G}return G.split("/",1)[0]??G}function LG(G){let Q=M(G);if(G===Q)return".";return`.${G.slice(Q.length)}`}function u(G){return M(G).startsWith("@cline/")}function y(G,Q){let U=M(Q),Y=J(G);while(!0){let Z=q(Y,"node_modules",U);if(_(Z)||_(q(Z,"package.json")))return!0;let $=q(Y,"..");if($===Y)return!1;Y=$}}function P(G){return b(G)!==null}function b(G){try{return $G.resolve(G)}catch{}return FG(G)}function FG(G){let Q=M(G),U=c(Q);if(!U)return null;let Y=q(U,"package.json");try{let Z=JSON.parse(C(Y,"utf8")),$=LG(G),X=$==="."&&typeof Z.exports==="string"?Z.exports:Z.exports&&typeof Z.exports==="object"&&Object.hasOwn(Z.exports,$)?Z.exports[$]:void 0,K=v(X)??($==="."&&typeof Z.main==="string"?Z.main:null);if(!K)return null;let A=q(U,K),L=[A,...d(U,K).filter((w)=>w!==A)];for(let w of L)if(_(w))return w;return null}catch{return null}}function JG(){let G=[m],Q=process.env.CLINE_WRAPPER_PATH?.trim();if(Q)G.push(J(J(Q)));let U=process.execPath?.trim();if(U)G.push(J(U));return[...new Set(G.map((Y)=>q(Y)))]}function zG(G,Q){let U=G;while(!0){let Y=q(U,"package.json");if(_(Y))try{if(JSON.parse(C(Y,"utf8")).name===Q)return U}catch{}let Z=q(U,"node_modules",Q,"package.json");if(_(Z))return J(Z);let $=q(U,"..");if($===U)return null;U=$}}function c(G){for(let Q of JG()){let U=zG(Q,G);if(U)return U}return null}function MG(G){let U=J(G);for(let Y=0;Y<4;Y++){let Z=q(U,"package.json");if(_(Z))try{let X=JSON.parse(C(Z,"utf8"));return X!=null&&typeof X==="object"&&"cline"in X}catch{return!1}let $=q(U,"..");if($===U)return!1;U=$}return!1}function l(G,Q){let U=Q.startsWith("file:")?h(Q):YG(Q)?Q:q(J(G),Q);if(_(U)&&j.has(I(U)))return U;for(let Y of j){let Z=`${U}${Y}`;if(_(Z))return Z}for(let Y of j){let Z=q(U,`index${Y}`);if(_(Z))return Z}return null}function g(G){let Q=new Set,U=[/\bimport\s+(?:type\s+)?[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bexport\s+[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bimport\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g,/\brequire\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g];for(let Y of U)for(let Z of G.matchAll(Y)){let $=Z[1];if($)Q.add($)}return[...Q]}function CG(G){return I(G)!==".ts"}function n(G,Q,U=new Set){if(U.has(G)||!_(G))return;if(U.add(G),!j.has(I(G)))return;let Y=C(G,"utf8"),Z=CG(G);for(let $ of g(Y)){if($.startsWith("node:")||k.has($))continue;if(H($)){if(!Z)continue;if(Object.hasOwn(T,$)||Object.hasOwn(T,M($))||y(G,$)||u($)&&P($)||Q&&P($))continue;throw Error(`Cannot find module '${M($)}'`)}let X=l(G,$);if(X)n(X,Q,U)}}function o(G,Q=new Set,U=new Set){if(Q.has(G)||!_(G))return U;if(Q.add(G),!j.has(I(G)))return U;let Y=C(G,"utf8");for(let Z of g(Y)){if(U.add(Z),H(Z))continue;let $=l(G,Z);if($)o($,Q,U)}return U}function OG(G,Q){let U=R(G),Y={},Z=o(G),$=new Set(qG);for(let[X,K]of Object.entries(T)){try{U.resolve(X);continue}catch{}Y[X]=K}for(let X of Z)if(H(X)&&(u(X)||Q))$.add(X);for(let X of $){if(Object.hasOwn(Y,X)||y(G,X))continue;let K=b(X);if(K)Y[X]=K}if(!Q)return Y;for(let X of Z){if(!H(X)||Object.hasOwn(Y,X)||y(G,X)||X.startsWith("node:")||k.has(X))continue;let K=b(X);if(K)Y[X]=K}return Y}function jG(G){let Q=I(G);return Q===".ts"||Q===".tsx"||Q===".mts"||Q===".cts"}var z;function IG(){if(z!==void 0)return z;let G=c("jiti");if(!G)return z=null,null;let Q=q(G,"dist","babel.cjs");if(!_(Q))return z=null,null;try{let Y=R(Q)(Q);z=typeof Y==="function"?Y:null}catch{z=null}return z}async function p(G,Q={}){let U=!MG(G);n(G,U);let Y=OG(G,U),Z=AG(Y),$=await import("jiti"),X=typeof $==="function"?$:typeof $.default==="function"?$.default:void 0;if(!X)throw Error("Unable to load jiti");let K=Object.entries(Z).filter(([,W])=>jG(W)).map(([W])=>W),A=IG(),L=A?(W)=>A({...W,interopDefault:!0}):void 0;return await X(G,{alias:Z,cache:Q.useCache,requireCache:Q.useCache,esmResolve:!0,interopDefault:!1,nativeModules:[...k],transformModules:K,tryNative:!1,...L?{transform:L}:{}}).import(G,{})}function s(G,Q){if(!G)return!0;if(G.providerIds?.length){if(!Q?.providerId||!G.providerIds.includes(Q.providerId))return!1}if(G.modelIds?.length){if(!Q?.modelId||!G.modelIds.includes(Q.modelId))return!1}return!0}function F(G){return typeof G==="object"&&G!==null}function t(G){return Array.isArray(G)&&G.every((Q)=>typeof Q==="string")}function DG(G,Q){if(!F(G))throw Error(`Invalid plugin module: ${Q}`);if(typeof G.name!=="string"||!G.name)throw Error(`Invalid plugin name: ${Q}`);if(!F(G.manifest))throw Error(`Invalid plugin manifest: ${Q}`);if(Object.hasOwn(G.manifest,"providerIds")&&!t(G.manifest.providerIds))throw Error(`Invalid plugin manifest.providerIds: ${Q}`);if(Object.hasOwn(G.manifest,"modelIds")&&!t(G.manifest.modelIds))throw Error(`Invalid plugin manifest.modelIds: ${Q}`)}function HG(G){if(!F(G))throw Error("Plugin setup context must be an object");if(G.session!==void 0&&!F(G.session))throw Error("Plugin setup context session must be an object");if(G.client!==void 0&&!F(G.client))throw Error("Plugin setup context client must be an object");if(G.user!==void 0&&!F(G.user))throw Error("Plugin setup context user must be an object");if(G.workspaceInfo!==void 0&&!F(G.workspaceInfo))throw Error("Plugin setup context workspaceInfo must be an object");if(G.automation!==void 0&&!F(G.automation))throw Error("Plugin setup context automation must be an object");if(G.automation!==void 0&&typeof G.automation.ingestEvent!=="function")throw Error("Plugin setup context automation.ingestEvent must be a function");if(G.logger!==void 0&&!F(G.logger))throw Error("Plugin setup context logger must be an object")}var i=0,N=new Map,f=new Map;function NG(G){let Q=G instanceof Error?G.message:String(G),U=G instanceof Error?G.stack:void 0;return{message:Q,stack:U}}function x(G,Q,U,Y){if(!process.send)return;process.send({type:"response",id:G,ok:Q,result:U,error:Y})}function E(G,Q){if(!process.send)return;process.send({type:"event",name:G,payload:Q})}globalThis.__clinePluginHost={emitEvent:E};globalThis.__clineSessionEnv={cwd:void 0,workspaceInfo:void 0};function r(G){if(!G||typeof G!=="object")return{};return G}function S(G){if(!G||typeof G!=="object")return;let Q={...G};if(Q.error instanceof Error)Q.error={name:Q.error.name,message:Q.error.message,stack:Q.error.stack};return Q}function SG(G){let Q=(U,Y,Z)=>{E("plugin_log",{level:U,pluginName:G,message:Y,metadata:S(Z)})};return{debug:(U,Y)=>Q("debug",U,Y),log:(U,Y)=>Q("log",U,Y),error:(U,Y)=>Q("error",U,Y)}}function EG(G){let Q=(Z)=>{E("plugin_telemetry",{pluginName:G,...Z})},U=(Z)=>($,X,K,A,L)=>{Q({kind:"metric",metric:Z,name:$,value:X,attributes:S(K),description:A,required:L})},Y=()=>{};return{capture:(Z)=>{Q({kind:"event",event:Z?.event,properties:S(Z?.properties)})},captureRequired:(Z,$)=>{Q({kind:"event",event:Z,properties:S($),required:!0})},recordCounter:U("counter"),recordHistogram:U("histogram"),recordGauge:U("gauge"),isEnabled:()=>!0,setDistinctId:Y,setMetadata:Y,updateMetadata:Y,setCommonProperties:Y,updateCommonProperties:Y,flush:async()=>{},dispose:async()=>{}}}function O(G,Q){let U=`${G}:${Q}`,Y=(f.get(U)??0)+1;return f.set(U,Y),`${G}_${Q}_${Y}`}function VG(G){let Q=typeof G.eventType==="string"?G.eventType.trim():"",U=typeof G.source==="string"?G.source.trim():"";if(!Q)throw Error("Automation event type contribution requires eventType");if(!U)throw Error("Automation event type contribution requires source");return{...G,eventType:Q,source:U,examples:G.examples?[...G.examples]:void 0,metadata:G.metadata?r(G.metadata):void 0}}function B(G){let Q=N.get(G);if(!Q)throw Error(`Unknown sandbox plugin id: ${G}`);return Q}async function TG(G){let Q;try{let U=await p(G.pluginPath);if(Q=U.default??U[G.exportName],DG(Q,G.pluginPath),Q.manifest=BG(Q.manifest),!s(Q.manifest,G.targeting))return{type:"skipped"};let Y={tools:[],commands:[],rules:[],messageBuilders:[],providers:[],automationEventTypes:[],mcpServers:[],shortcuts:[],flags:[]},Z={tools:new Map,commands:new Map,rules:new Map,messageBuilders:new Map},$={registerTool:(X)=>{let K=O(G.pluginId,"tool");Z.tools.set(K,X.execute),Y.tools.push({id:K,name:X.name,description:X.description,inputSchema:X.inputSchema,timeoutMs:X.timeoutMs,retryable:X.retryable})},registerCommand:(X)=>{let K=O(G.pluginId,"command");if(typeof X.handler==="function")Z.commands.set(K,X.handler);Y.commands.push({id:K,name:X.name,description:X.description})},registerRule:(X)=>{let K=O(G.pluginId,"rule");if(typeof X.content==="function"){Z.rules.set(K,X.content),Y.rules.push({id:K,ruleId:X.id,source:X.source,hasContentHandler:!0});return}Y.rules.push({id:K,ruleId:X.id,content:X.content,source:X.source})},registerMessageBuilder:(X)=>{let K=O(G.pluginId,"builder");Z.messageBuilders.set(K,X.build),Y.messageBuilders.push({id:K,name:X.name})},registerProvider:(X)=>{Y.providers.push({id:O(G.pluginId,"provider"),name:X.name,description:X.description,metadata:r(X.metadata)})},registerAutomationEventType:(X)=>{Y.automationEventTypes.push({id:O(G.pluginId,"automation_event"),...VG(X)})},registerMcpServer:(X)=>{Y.mcpServers.push(X)}};if(typeof Q.setup==="function")try{let X={...G.setupCtxBase,...G.telemetryEnabled?{telemetry:EG(Q.name)}:{},...G.loggerEnabled?{logger:SG(Q.name)}:{},...Q.manifest.capabilities.includes("automationEvents")?{automation:{ingestEvent:(K)=>{E("automation_event",K)}}}:{}};HG(X),await Q.setup($,X)}catch(X){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q.name,phase:"setup",message:X instanceof Error?X.message:String(X),stack:X instanceof Error?X.stack:void 0}}}return{type:"loaded",state:{plugin:Q,handlers:Z},descriptor:{pluginId:G.pluginId,pluginPath:G.pluginPath,name:Q.name,manifest:Q.manifest,hooks:Q.hooks?Object.entries(Q.hooks).filter(([,X])=>typeof X==="function").map(([X])=>X):void 0,contributions:Y}}}catch(U){return{type:"failure",failure:{pluginPath:G.pluginPath,pluginName:Q?.name,phase:"load",message:U instanceof Error?U.message:String(U),stack:U instanceof Error?U.stack:void 0}}}}async function yG(G){if(N.clear(),i=0,f.clear(),G.cwd)try{process.chdir(G.cwd)}catch{}let Q=globalThis.__clineSessionEnv;if(Q)Q.cwd=G.cwd,Q.workspaceInfo=G.workspaceInfo;let U=[],Y=[],Z=[],$=G.exportName||"plugin",X=new Map,K={providerId:G.providerId,modelId:G.modelId},A={session:G.session,client:G.client,user:G.user,workspaceInfo:G.workspaceInfo},L=await Promise.all((G.pluginPaths||[]).map((w)=>{let W=`plugin_${++i}`;return TG({pluginPath:w,pluginId:W,exportName:$,targeting:K,setupCtxBase:A,loggerEnabled:G.loggerEnabled,telemetryEnabled:G.telemetryEnabled})}));for(let w of L){if(w.type==="skipped")continue;if(w.type==="failure"){Y.push(w.failure);continue}let{descriptor:W,state:a}=w,V=X.get(W.name);if(V!==void 0){let D=U[V];if(!D)X.delete(W.name);else{Z.push({type:"duplicate_plugin_override",pluginName:W.name,pluginPath:W.pluginPath,overriddenPluginPath:D.pluginPath,message:`Plugin "${W.name}" from ${W.pluginPath} overrides ${D.pluginPath}`}),N.delete(D.pluginId),U.splice(V,1),X.clear();for(let[e,GG]of U.entries())X.set(GG.name,e)}}N.set(W.pluginId,a),X.set(W.name,U.length),U.push(W)}return{plugins:U,failures:Y,warnings:Z}}async function bG(G){let U=B(G.pluginId).plugin.hooks?.[G.hookName];if(typeof U!=="function")return;return await U(G.payload)}async function RG(G){let U=B(G.pluginId).handlers.tools.get(G.contributionId);if(typeof U!=="function")throw Error("Unknown sandbox tool contribution");return await U(G.input,G.context)}async function kG(G){let U=B(G.pluginId).handlers.commands.get(G.contributionId);if(typeof U!=="function")return"";return await U(G.input)}async function vG(G){let U=B(G.pluginId).handlers.messageBuilders.get(G.contributionId);if(typeof U!=="function")return[];return await U(G.messages)}async function xG(G){let U=B(G.pluginId).handlers.rules.get(G.contributionId);if(typeof U!=="function")return"";return await U()}var fG={initialize:yG,invokeHook:bG,executeTool:RG,executeCommand:kG,buildMessages:vG,resolveRuleContent:xG};process.on("message",async(G)=>{if(!G||G.type!=="call")return;let Q=fG[G.method];if(!Q){x(G.id,!1,void 0,{message:`Unknown method: ${String(G.method)}`});return}try{let U=await Q(G.args||{});x(G.id,!0,U)}catch(U){x(G.id,!1,void 0,NG(U))}});
|
|
1
|
+
import{createRequire as XQ}from"node:module";var YQ=XQ(import.meta.url);import{normalizePluginManifest as DQ}from"@cline/shared";function P(Q=process){Q.once("disconnect",()=>Q.exit(0))}import{existsSync as _,readFileSync as O}from"node:fs";import{builtinModules as ZQ,createRequire as R}from"node:module";import{dirname as J,extname as I,isAbsolute as $Q,resolve as q}from"node:path";import{fileURLToPath as m}from"node:url";import{PLUGIN_FILE_EXTENSIONS as GQ}from"@cline/shared";var d=J(m(import.meta.url)),KQ=R(import.meta.url),qQ=q(d,"..","..","..","..",".."),T=wQ(qQ),WQ=["@cline/sdk","@cline/agents","@cline/core","@cline/core/hub","@cline/core/hub/daemon-entry","@cline/core/telemetry","@cline/llms","@cline/llms/browser","@cline/shared","@cline/shared/automation","@cline/shared/browser","@cline/shared/storage","@cline/shared/db","@cline/shared/types"],k=new Set(ZQ.flatMap((Q)=>[Q,Q.replace(/^node:/,"")])),B=new Set(GQ),_Q=["development","node","import","require","default"];function wQ(Q){let U={},X={"@cline/sdk":q(Q,"packages/sdk/src/index.ts"),"@cline/agents":q(Q,"packages/agents/src/index.ts"),"@cline/core":q(Q,"packages/core/src/index.ts"),"@cline/llms":q(Q,"packages/llms/src/index.ts"),"@cline/shared":q(Q,"packages/shared/src/index.ts"),"@cline/shared/storage":q(Q,"packages/shared/src/storage/index.ts"),"@cline/shared/db":q(Q,"packages/shared/src/db/index.ts")};for(let[Z,$]of Object.entries(X))if(_($))U[Z]=$;for(let Z of["agents","core","llms","shared"]){let $=q(Q,"packages",Z),G=q($,"package.json");if(!_(G))continue;try{let Y=JSON.parse(O(G,"utf8"));if(typeof Y.name!=="string"||!Y.exports)continue;if(typeof Y.exports==="string"){let K=q($,Y.exports);if(_(K))U[Y.name]=K;continue}if(typeof Y.exports!=="object")continue;for(let[K,A]of Object.entries(Y.exports)){let L=AQ($,A);if(!L)continue;let w=K==="."?Y.name:`${Y.name}/${K.replace(/^\.\//,"")}`;U[w]=L}}catch{}}return U}function AQ(Q,U){let X=v(U);if(!X)return null;let Z=u(Q,X);for(let $ of Z)if(_($))return $;return null}function v(Q,U=new Set){if(typeof Q==="string")return Q;if(!Q||typeof Q!=="object")return null;if(U.has(Q))return null;U.add(Q);let X=Q;for(let Z of _Q){let $=v(X[Z],U);if($)return $}return null}function u(Q,U){let X=U.replace(/^\.\//,""),Z=[q(Q,U)];if(X.startsWith("dist/")){let $=X.replace(/^dist\//,"src/").replace(/\.(mjs|cjs|js)$/,"");return[q(Q,`${$}.ts`),q(Q,`${$}.tsx`),q(Q,`${$}.mts`),q(Q,`${$}.cts`),...Z]}return Z}function LQ(Q){return Object.fromEntries(Object.entries(Q).sort(([U],[X])=>X.length-U.length))}function N(Q){return!(Q.startsWith(".")||Q.startsWith("/")||Q.startsWith("file:")||Q.startsWith("data:")||Q.startsWith("http:")||Q.startsWith("https:"))}function C(Q){if(Q.startsWith("@")){let[U,X]=Q.split("/",3);return X?`${U}/${X}`:Q}return Q.split("/",1)[0]??Q}function FQ(Q){let U=C(Q);if(Q===U)return".";return`.${Q.slice(U.length)}`}function c(Q){return C(Q).startsWith("@cline/")}function y(Q,U){let X=C(U),Z=J(Q);while(!0){let $=q(Z,"node_modules",X);if(_($)||_(q($,"package.json")))return!0;let G=q(Z,"..");if(G===Z)return!1;Z=G}}function h(Q){return b(Q)!==null}function b(Q){try{return KQ.resolve(Q)}catch{}return JQ(Q)}function JQ(Q){let U=C(Q),X=l(U);if(!X)return null;let Z=q(X,"package.json");try{let $=JSON.parse(O(Z,"utf8")),G=FQ(Q),Y=G==="."&&typeof $.exports==="string"?$.exports:$.exports&&typeof $.exports==="object"&&Object.hasOwn($.exports,G)?$.exports[G]:void 0,K=v(Y)??(G==="."&&typeof $.main==="string"?$.main:null);if(!K)return null;let A=q(X,K),L=[A,...u(X,K).filter((w)=>w!==A)];for(let w of L)if(_(w))return w;return null}catch{return null}}function zQ(){let Q=[d],U=process.env.CLINE_WRAPPER_PATH?.trim();if(U)Q.push(J(J(U)));let X=process.execPath?.trim();if(X)Q.push(J(X));return[...new Set(Q.map((Z)=>q(Z)))]}function CQ(Q,U){let X=Q;while(!0){let Z=q(X,"package.json");if(_(Z))try{if(JSON.parse(O(Z,"utf8")).name===U)return X}catch{}let $=q(X,"node_modules",U,"package.json");if(_($))return J($);let G=q(X,"..");if(G===X)return null;X=G}}function l(Q){for(let U of zQ()){let X=CQ(U,Q);if(X)return X}return null}function OQ(Q){let X=J(Q);for(let Z=0;Z<4;Z++){let $=q(X,"package.json");if(_($))try{let Y=JSON.parse(O($,"utf8"));return Y!=null&&typeof Y==="object"&&"cline"in Y}catch{return!1}let G=q(X,"..");if(G===X)return!1;X=G}return!1}function g(Q,U){let X=U.startsWith("file:")?m(U):$Q(U)?U:q(J(Q),U);if(_(X)&&B.has(I(X)))return X;for(let Z of B){let $=`${X}${Z}`;if(_($))return $}for(let Z of B){let $=q(X,`index${Z}`);if(_($))return $}return null}function n(Q){let U=new Set,X=[/\bimport\s+(?:type\s+)?[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bexport\s+[^"'`]*?\bfrom\s*["'`]([^"'`]+)["'`]/g,/\bimport\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g,/\brequire\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g];for(let Z of X)for(let $ of Q.matchAll(Z)){let G=$[1];if(G)U.add(G)}return[...U]}function jQ(Q){return I(Q)!==".ts"}function o(Q,U,X=new Set){if(X.has(Q)||!_(Q))return;if(X.add(Q),!B.has(I(Q)))return;let Z=O(Q,"utf8"),$=jQ(Q);for(let G of n(Z)){if(G.startsWith("node:")||k.has(G))continue;if(N(G)){if(!$)continue;if(Object.hasOwn(T,G)||Object.hasOwn(T,C(G))||y(Q,G)||c(G)&&h(G)||U&&h(G))continue;throw Error(`Cannot find module '${C(G)}'`)}let Y=g(Q,G);if(Y)o(Y,U,X)}}function p(Q,U=new Set,X=new Set){if(U.has(Q)||!_(Q))return X;if(U.add(Q),!B.has(I(Q)))return X;let Z=O(Q,"utf8");for(let $ of n(Z)){if(X.add($),N($))continue;let G=g(Q,$);if(G)p(G,U,X)}return X}function BQ(Q,U){let X=R(Q),Z={},$=p(Q),G=new Set(WQ);for(let[Y,K]of Object.entries(T)){try{X.resolve(Y);continue}catch{}Z[Y]=K}for(let Y of $)if(N(Y)&&(c(Y)||U))G.add(Y);for(let Y of G){if(Object.hasOwn(Z,Y)||y(Q,Y))continue;let K=b(Y);if(K)Z[Y]=K}if(!U)return Z;for(let Y of $){if(!N(Y)||Object.hasOwn(Z,Y)||y(Q,Y)||Y.startsWith("node:")||k.has(Y))continue;let K=b(Y);if(K)Z[Y]=K}return Z}function IQ(Q){let U=I(Q);return U===".ts"||U===".tsx"||U===".mts"||U===".cts"}var z;function HQ(){if(z!==void 0)return z;let Q=l("jiti");if(!Q)return z=null,null;let U=q(Q,"dist","babel.cjs");if(!_(U))return z=null,null;try{let Z=R(U)(U);z=typeof Z==="function"?Z:null}catch{z=null}return z}async function s(Q,U={}){let X=!OQ(Q);o(Q,X);let Z=BQ(Q,X),$=LQ(Z),G=await import("jiti"),Y=typeof G==="function"?G:typeof G.default==="function"?G.default:void 0;if(!Y)throw Error("Unable to load jiti");let K=Object.entries($).filter(([,W])=>IQ(W)).map(([W])=>W),A=HQ(),L=A?(W)=>A({...W,interopDefault:!0}):void 0;return await Y(Q,{alias:$,cache:U.useCache,requireCache:U.useCache,esmResolve:!0,interopDefault:!1,nativeModules:[...k],transformModules:K,tryNative:!1,...L?{transform:L}:{}}).import(Q,{})}function i(Q,U){if(!Q)return!0;if(Q.providerIds?.length){if(!U?.providerId||!Q.providerIds.includes(U.providerId))return!1}if(Q.modelIds?.length){if(!U?.modelId||!Q.modelIds.includes(U.modelId))return!1}return!0}function F(Q){return typeof Q==="object"&&Q!==null}function r(Q){return Array.isArray(Q)&&Q.every((U)=>typeof U==="string")}function NQ(Q,U){if(!F(Q))throw Error(`Invalid plugin module: ${U}`);if(typeof Q.name!=="string"||!Q.name)throw Error(`Invalid plugin name: ${U}`);if(!F(Q.manifest))throw Error(`Invalid plugin manifest: ${U}`);if(Object.hasOwn(Q.manifest,"providerIds")&&!r(Q.manifest.providerIds))throw Error(`Invalid plugin manifest.providerIds: ${U}`);if(Object.hasOwn(Q.manifest,"modelIds")&&!r(Q.manifest.modelIds))throw Error(`Invalid plugin manifest.modelIds: ${U}`)}function SQ(Q){if(!F(Q))throw Error("Plugin setup context must be an object");if(Q.session!==void 0&&!F(Q.session))throw Error("Plugin setup context session must be an object");if(Q.client!==void 0&&!F(Q.client))throw Error("Plugin setup context client must be an object");if(Q.user!==void 0&&!F(Q.user))throw Error("Plugin setup context user must be an object");if(Q.workspaceInfo!==void 0&&!F(Q.workspaceInfo))throw Error("Plugin setup context workspaceInfo must be an object");if(Q.automation!==void 0&&!F(Q.automation))throw Error("Plugin setup context automation must be an object");if(Q.automation!==void 0&&typeof Q.automation.ingestEvent!=="function")throw Error("Plugin setup context automation.ingestEvent must be a function");if(Q.logger!==void 0&&!F(Q.logger))throw Error("Plugin setup context logger must be an object")}var t=0,S=new Map,f=new Map;function MQ(Q){let U=Q instanceof Error?Q.message:String(Q),X=Q instanceof Error?Q.stack:void 0;return{message:U,stack:X}}function x(Q,U,X,Z){if(!process.send)return;process.send({type:"response",id:Q,ok:U,result:X,error:Z})}function V(Q,U){if(!process.send)return;process.send({type:"event",name:Q,payload:U})}globalThis.__clinePluginHost={emitEvent:V};globalThis.__clineSessionEnv={cwd:void 0,workspaceInfo:void 0};function a(Q){if(!Q||typeof Q!=="object")return{};return Q}function M(Q){if(!Q||typeof Q!=="object")return;let U={...Q};if(U.error instanceof Error)U.error={name:U.error.name,message:U.error.message,stack:U.error.stack};return U}function VQ(Q){let U=(X,Z,$)=>{V("plugin_log",{level:X,pluginName:Q,message:Z,metadata:M($)})};return{debug:(X,Z)=>U("debug",X,Z),log:(X,Z)=>U("log",X,Z),error:(X,Z)=>U("error",X,Z)}}function EQ(Q){let U=($)=>{V("plugin_telemetry",{pluginName:Q,...$})},X=($)=>(G,Y,K,A,L)=>{U({kind:"metric",metric:$,name:G,value:Y,attributes:M(K),description:A,required:L})},Z=()=>{};return{capture:($)=>{U({kind:"event",event:$?.event,properties:M($?.properties)})},captureRequired:($,G)=>{U({kind:"event",event:$,properties:M(G),required:!0})},recordCounter:X("counter"),recordHistogram:X("histogram"),recordGauge:X("gauge"),isEnabled:()=>!0,setDistinctId:Z,setMetadata:Z,updateMetadata:Z,setCommonProperties:Z,updateCommonProperties:Z,flush:async()=>{},dispose:async()=>{}}}function j(Q,U){let X=`${Q}:${U}`,Z=(f.get(X)??0)+1;return f.set(X,Z),`${Q}_${U}_${Z}`}function TQ(Q){let U=typeof Q.eventType==="string"?Q.eventType.trim():"",X=typeof Q.source==="string"?Q.source.trim():"";if(!U)throw Error("Automation event type contribution requires eventType");if(!X)throw Error("Automation event type contribution requires source");return{...Q,eventType:U,source:X,examples:Q.examples?[...Q.examples]:void 0,metadata:Q.metadata?a(Q.metadata):void 0}}function H(Q){let U=S.get(Q);if(!U)throw Error(`Unknown sandbox plugin id: ${Q}`);return U}async function yQ(Q){let U;try{let X=await s(Q.pluginPath);if(U=X.default??X[Q.exportName],NQ(U,Q.pluginPath),U.manifest=DQ(U.manifest),!i(U.manifest,Q.targeting))return{type:"skipped"};let Z={tools:[],commands:[],rules:[],messageBuilders:[],providers:[],automationEventTypes:[],mcpServers:[],shortcuts:[],flags:[]},$={tools:new Map,commands:new Map,rules:new Map,messageBuilders:new Map},G={registerTool:(Y)=>{let K=j(Q.pluginId,"tool");$.tools.set(K,Y.execute),Z.tools.push({id:K,name:Y.name,description:Y.description,inputSchema:Y.inputSchema,timeoutMs:Y.timeoutMs,retryable:Y.retryable})},registerCommand:(Y)=>{let K=j(Q.pluginId,"command");if(typeof Y.handler==="function")$.commands.set(K,Y.handler);Z.commands.push({id:K,name:Y.name,description:Y.description})},registerRule:(Y)=>{let K=j(Q.pluginId,"rule");if(typeof Y.content==="function"){$.rules.set(K,Y.content),Z.rules.push({id:K,ruleId:Y.id,source:Y.source,hasContentHandler:!0});return}Z.rules.push({id:K,ruleId:Y.id,content:Y.content,source:Y.source})},registerMessageBuilder:(Y)=>{let K=j(Q.pluginId,"builder");$.messageBuilders.set(K,Y.build),Z.messageBuilders.push({id:K,name:Y.name})},registerProvider:(Y)=>{Z.providers.push({id:j(Q.pluginId,"provider"),name:Y.name,description:Y.description,metadata:a(Y.metadata)})},registerAutomationEventType:(Y)=>{Z.automationEventTypes.push({id:j(Q.pluginId,"automation_event"),...TQ(Y)})},registerMcpServer:(Y)=>{Z.mcpServers.push(Y)}};if(typeof U.setup==="function")try{let Y={...Q.setupCtxBase,...Q.telemetryEnabled?{telemetry:EQ(U.name)}:{},...Q.loggerEnabled?{logger:VQ(U.name)}:{},...U.manifest.capabilities.includes("automationEvents")?{automation:{ingestEvent:(K)=>{V("automation_event",K)}}}:{}};SQ(Y),await U.setup(G,Y)}catch(Y){return{type:"failure",failure:{pluginPath:Q.pluginPath,pluginName:U.name,phase:"setup",message:Y instanceof Error?Y.message:String(Y),stack:Y instanceof Error?Y.stack:void 0}}}return{type:"loaded",state:{plugin:U,handlers:$},descriptor:{pluginId:Q.pluginId,pluginPath:Q.pluginPath,name:U.name,manifest:U.manifest,hooks:U.hooks?Object.entries(U.hooks).filter(([,Y])=>typeof Y==="function").map(([Y])=>Y):void 0,contributions:Z}}}catch(X){return{type:"failure",failure:{pluginPath:Q.pluginPath,pluginName:U?.name,phase:"load",message:X instanceof Error?X.message:String(X),stack:X instanceof Error?X.stack:void 0}}}}async function bQ(Q){if(S.clear(),t=0,f.clear(),Q.cwd)try{process.chdir(Q.cwd)}catch{}let U=globalThis.__clineSessionEnv;if(U)U.cwd=Q.cwd,U.workspaceInfo=Q.workspaceInfo;let X=[],Z=[],$=[],G=Q.exportName||"plugin",Y=new Map,K={providerId:Q.providerId,modelId:Q.modelId},A={session:Q.session,client:Q.client,user:Q.user,workspaceInfo:Q.workspaceInfo},L=await Promise.all((Q.pluginPaths||[]).map((w)=>{let W=`plugin_${++t}`;return yQ({pluginPath:w,pluginId:W,exportName:G,targeting:K,setupCtxBase:A,loggerEnabled:Q.loggerEnabled,telemetryEnabled:Q.telemetryEnabled})}));for(let w of L){if(w.type==="skipped")continue;if(w.type==="failure"){Z.push(w.failure);continue}let{descriptor:W,state:e}=w,E=Y.get(W.name);if(E!==void 0){let D=X[E];if(!D)Y.delete(W.name);else{$.push({type:"duplicate_plugin_override",pluginName:W.name,pluginPath:W.pluginPath,overriddenPluginPath:D.pluginPath,message:`Plugin "${W.name}" from ${W.pluginPath} overrides ${D.pluginPath}`}),S.delete(D.pluginId),X.splice(E,1),Y.clear();for(let[QQ,UQ]of X.entries())Y.set(UQ.name,QQ)}}S.set(W.pluginId,e),Y.set(W.name,X.length),X.push(W)}return{plugins:X,failures:Z,warnings:$}}async function RQ(Q){let X=H(Q.pluginId).plugin.hooks?.[Q.hookName];if(typeof X!=="function")return;return await X(Q.payload)}async function kQ(Q){let X=H(Q.pluginId).handlers.tools.get(Q.contributionId);if(typeof X!=="function")throw Error("Unknown sandbox tool contribution");return await X(Q.input,Q.context)}async function vQ(Q){let X=H(Q.pluginId).handlers.commands.get(Q.contributionId);if(typeof X!=="function")return"";return await X(Q.input)}async function xQ(Q){let X=H(Q.pluginId).handlers.messageBuilders.get(Q.contributionId);if(typeof X!=="function")return[];return await X(Q.messages)}async function fQ(Q){let X=H(Q.pluginId).handlers.rules.get(Q.contributionId);if(typeof X!=="function")return"";return await X()}var PQ={initialize:bQ,invokeHook:RQ,executeTool:kQ,executeCommand:vQ,buildMessages:xQ,resolveRuleContent:fQ};P();process.on("message",async(Q)=>{if(!Q||Q.type!=="call")return;let U=PQ[Q.method];if(!U){x(Q.id,!1,void 0,{message:`Unknown method: ${String(Q.method)}`});return}try{let X=await U(Q.args||{});x(Q.id,!0,X)}catch(X){x(Q.id,!1,void 0,MQ(X))}});
|
|
@@ -12,6 +12,7 @@ export interface BuiltinToolAvailabilityContext {
|
|
|
12
12
|
enableSpawnAgent?: boolean;
|
|
13
13
|
enableAgentTeams?: boolean;
|
|
14
14
|
disabledToolIds?: ReadonlySet<string>;
|
|
15
|
+
enabledModelToolIds?: ReadonlySet<string>;
|
|
15
16
|
}
|
|
16
17
|
export declare function getCoreBuiltinToolCatalog(context?: BuiltinToolAvailabilityContext): ToolCatalogEntry[];
|
|
17
18
|
export declare function getCoreDefaultEnabledToolIds(context?: BuiltinToolAvailabilityContext): string[];
|
|
@@ -80,6 +80,21 @@ export declare class NodeHubClient {
|
|
|
80
80
|
}
|
|
81
81
|
export declare function normalizeHubWebSocketUrl(url: string): string;
|
|
82
82
|
export declare function verifyHubConnection(url: string, options?: Pick<HubClientOptions, "workspaceRoot" | "cwd" | "authToken">): Promise<boolean>;
|
|
83
|
+
/**
|
|
84
|
+
* Whether any client is attached to a session on the hub - the one signal
|
|
85
|
+
* that cannot go stale, because participants are live socket subscriptions
|
|
86
|
+
* the hub drops the moment a client's connection closes.
|
|
87
|
+
*
|
|
88
|
+
* Deliberately NOT based on session status: a client that dies without
|
|
89
|
+
* stopping its session leaves the hub-side runtime behind in a non-terminal
|
|
90
|
+
* status forever, and counting those "ghost" sessions as busy pins an
|
|
91
|
+
* outdated hub as "serving sessions" until the machine reboots. The cost of
|
|
92
|
+
* ignoring status is that a participant-less background run executing at the
|
|
93
|
+
* exact moment of a hub swap dies with the old hub - rare, and its next
|
|
94
|
+
* scheduled tick runs normally on the replacement.
|
|
95
|
+
*/
|
|
96
|
+
export declare function hasActiveHubSessions(payload: unknown): boolean;
|
|
97
|
+
export declare function localHubHasNoActiveSessions(url: string, authToken?: string, options?: Pick<HubClientOptions, "workspaceRoot" | "cwd">): Promise<boolean>;
|
|
83
98
|
export declare function resolveCompatibleLocalHubUrl(options?: LocalHubResolutionOptions): Promise<string | undefined>;
|
|
84
99
|
export declare function ensureCompatibleLocalHubUrl(options?: LocalHubResolutionOptions): Promise<string | undefined>;
|
|
85
100
|
export declare function requestHubShutdown(url: string, authToken?: string): Promise<boolean>;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
export interface ManagedHubBuildMismatchEvent {
|
|
2
2
|
/** WebSocket URL of the live managed Hub that does not match this build. */
|
|
3
3
|
url: string;
|
|
4
|
-
/**
|
|
5
|
-
* client
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Why client and Hub disagree:
|
|
6
|
+
* - `build_mismatch`: the running Hub is a newer build this client stays
|
|
7
|
+
* attached to, and updating this client resolves it.
|
|
8
|
+
* - `unsupported_protocol`: this client cannot speak the Hub's protocol.
|
|
9
|
+
* - `outdated_hub`: this client is the newer build, but the running Hub was
|
|
10
|
+
* left in place because it is still serving sessions. Nothing to install;
|
|
11
|
+
* the Hub is replaced once those sessions end.
|
|
12
|
+
*/
|
|
13
|
+
reason: "unsupported_protocol" | "build_mismatch" | "outdated_hub";
|
|
7
14
|
/** Build identity reported by the running Hub, when it reports one. */
|
|
8
15
|
hubBuildId?: string;
|
|
9
16
|
/** Core package version reported by the running Hub. */
|
|
@@ -44,7 +44,7 @@ export interface HubRestoreResponse {
|
|
|
44
44
|
manifestPath: string;
|
|
45
45
|
messagesPath: string;
|
|
46
46
|
};
|
|
47
|
-
messages?: LlmsProviders.
|
|
47
|
+
messages?: LlmsProviders.MessageWithMetadata[];
|
|
48
48
|
checkpoint: CheckpointEntry;
|
|
49
49
|
}
|
|
50
50
|
export interface HubEventStreamHandlers {
|
|
@@ -83,7 +83,7 @@ export declare class HubSessionClient {
|
|
|
83
83
|
updated: boolean;
|
|
84
84
|
}>;
|
|
85
85
|
getSession(sessionId: string): Promise<HubSessionRow | undefined>;
|
|
86
|
-
readMessages(sessionId: string): Promise<LlmsProviders.
|
|
86
|
+
readMessages(sessionId: string): Promise<LlmsProviders.MessageWithMetadata[]>;
|
|
87
87
|
restore(input: HubRestoreRequest): Promise<HubRestoreResponse>;
|
|
88
88
|
listSessions(input?: {
|
|
89
89
|
limit?: number;
|