@cline/core 0.0.73 → 0.0.74
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/hub/client/managed-hub-build-watcher.d.ts +47 -0
- package/dist/hub/daemon/entry.js +186 -182
- package/dist/hub/daemon/shutdown-coordinator.d.ts +31 -0
- package/dist/hub/discovery/index.d.ts +28 -0
- package/dist/hub/index.d.ts +1 -0
- package/dist/hub/index.js +178 -174
- package/dist/hub/server/hub-server-options.d.ts +14 -4
- package/dist/hub/server/hub-websocket-server.d.ts +1 -1
- package/dist/index.js +176 -172
- package/dist/services/agent-events.d.ts +25 -0
- package/dist/services/telemetry/core-events.d.ts +3 -0
- package/package.json +4 -4
- package/dist/hub/daemon/shutdown-watchdog.d.ts +0 -13
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kept below the caller-side retirement wait so a current daemon exits through
|
|
3
|
+
* its own cleanup deadline before an older caller considers force retirement.
|
|
4
|
+
*/
|
|
5
|
+
export declare const HUB_DAEMON_SHUTDOWN_DEADLINE_MS = 2000;
|
|
6
|
+
export interface HubDaemonShutdownRequest {
|
|
7
|
+
reason: string;
|
|
8
|
+
exitCode: number;
|
|
9
|
+
}
|
|
10
|
+
export type HubDaemonShutdownState = "idle" | "shutting_down" | "forced" | "finished";
|
|
11
|
+
export interface HubDaemonShutdownCoordinatorOptions {
|
|
12
|
+
deadlineMs: number;
|
|
13
|
+
cleanup(): Promise<void>;
|
|
14
|
+
exit(code: number): void;
|
|
15
|
+
onCleanupError?(error: unknown): void;
|
|
16
|
+
onForcedExit?(request: HubDaemonShutdownRequest): void;
|
|
17
|
+
}
|
|
18
|
+
export interface HubDaemonShutdownCoordinator {
|
|
19
|
+
request(request: HubDaemonShutdownRequest): Promise<void>;
|
|
20
|
+
force(request: HubDaemonShutdownRequest): void;
|
|
21
|
+
getState(): HubDaemonShutdownState;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Owns the daemon's monotonic shutdown lifecycle.
|
|
25
|
+
*
|
|
26
|
+
* Every graceful trigger shares one cleanup promise. A later fatal trigger can
|
|
27
|
+
* raise the eventual exit code, but it cannot run cleanup twice. The deadline
|
|
28
|
+
* and an explicit second-signal path both use `force`, whose exit is also
|
|
29
|
+
* guarded so an injected test exit that returns cannot be called repeatedly.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createHubDaemonShutdownCoordinator(options: HubDaemonShutdownCoordinatorOptions): HubDaemonShutdownCoordinator;
|
|
@@ -8,6 +8,7 @@ export interface HubServerDiscoveryRecord {
|
|
|
8
8
|
capabilities?: readonly string[];
|
|
9
9
|
coreVersion?: string;
|
|
10
10
|
buildId?: string;
|
|
11
|
+
buildEpochMs?: number;
|
|
11
12
|
authToken: string;
|
|
12
13
|
host: string;
|
|
13
14
|
port: number;
|
|
@@ -23,6 +24,7 @@ export type HubServerProbeRecord = {
|
|
|
23
24
|
capabilities?: readonly string[];
|
|
24
25
|
coreVersion?: string;
|
|
25
26
|
buildId?: string;
|
|
27
|
+
buildEpochMs?: number;
|
|
26
28
|
host: string;
|
|
27
29
|
port: number;
|
|
28
30
|
url: string;
|
|
@@ -38,6 +40,13 @@ export interface HubOwnerContext {
|
|
|
38
40
|
}
|
|
39
41
|
export declare function createHubAuthToken(): string;
|
|
40
42
|
export declare function resolveHubBuildId(): string;
|
|
43
|
+
/**
|
|
44
|
+
* When this SDK build was produced, embedded at bundle time. Orders builds so
|
|
45
|
+
* managed-Hub handling can distinguish a newer daemon (attach and prompt the
|
|
46
|
+
* user to update) from a stale one (retire and replace). Undefined when
|
|
47
|
+
* running from unbundled sources, where no meaningful ordering exists.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveHubBuildEpochMs(): number | undefined;
|
|
41
50
|
export type ManagedHubCompatibilityResult = {
|
|
42
51
|
compatible: true;
|
|
43
52
|
} | {
|
|
@@ -56,11 +65,30 @@ export type ManagedHubCompatibilityResult = {
|
|
|
56
65
|
export declare function getManagedHubCompatibility(record: HubProtocolMetadata & {
|
|
57
66
|
buildId?: string;
|
|
58
67
|
}, expectedBuildId?: string): ManagedHubCompatibilityResult;
|
|
68
|
+
/**
|
|
69
|
+
* Whether a client may keep using a managed local Hub instead of retiring it.
|
|
70
|
+
*
|
|
71
|
+
* Same build: always reusable. Different build: reusable only when the Hub
|
|
72
|
+
* was produced *after* this client's own build (another installation
|
|
73
|
+
* upgraded the shared Hub) - the daemon is then running newer code, so
|
|
74
|
+
* replacing it would be a downgrade; the client attaches over the compatible
|
|
75
|
+
* wire protocol and the build-mismatch watcher prompts the user to update.
|
|
76
|
+
* A Hub that is older, unordered, or missing build metadata is not reusable
|
|
77
|
+
* and gets retired and replaced, preserving the stale-daemon fix.
|
|
78
|
+
*/
|
|
79
|
+
export declare function isManagedHubReusable(record: HubProtocolMetadata & {
|
|
80
|
+
buildId?: string;
|
|
81
|
+
buildEpochMs?: number;
|
|
82
|
+
}, options?: {
|
|
83
|
+
expectedBuildId?: string;
|
|
84
|
+
expectedBuildEpochMs?: number;
|
|
85
|
+
}): boolean;
|
|
59
86
|
export declare function resolveHubOwnerContext(ownerBasis?: string): HubOwnerContext;
|
|
60
87
|
export declare function createInMemoryHubOwnerContext(label?: string): HubOwnerContext;
|
|
61
88
|
export declare function readHubDiscovery(discoveryPath: string): Promise<HubServerDiscoveryRecord | undefined>;
|
|
62
89
|
export declare function writeHubDiscovery(discoveryPath: string, record: HubServerDiscoveryRecord): Promise<void>;
|
|
63
90
|
export declare function clearHubDiscovery(discoveryPath: string): Promise<void>;
|
|
91
|
+
export declare function clearHubDiscoveryIfOwned(discoveryPath: string, hubId: string): Promise<boolean>;
|
|
64
92
|
export declare function withHubStartupLock<T>(discoveryPath: string, callback: () => Promise<T>): Promise<T>;
|
|
65
93
|
export declare function probeHubServer(url: string, options?: {
|
|
66
94
|
authToken?: string;
|
package/dist/hub/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { HubScheduleService } from "../cron/service/schedule-service";
|
|
|
18
18
|
export { type ConfiguredTelemetryHandle, type CreateOpenTelemetryTelemetryServiceOptions, createConfiguredTelemetryHandle, createConfiguredTelemetryService, } from "../services/telemetry/OpenTelemetryProvider";
|
|
19
19
|
export * from "./client";
|
|
20
20
|
export * from "./client/connect";
|
|
21
|
+
export * from "./client/managed-hub-build-watcher";
|
|
21
22
|
export * from "./client/session-client";
|
|
22
23
|
export * from "./client/ui-client";
|
|
23
24
|
export * from "./daemon";
|