diff --git a/apps/cli/src/runtime/interactive/session-runtime.ts b/apps/cli/src/runtime/interactive/session-runtime.ts index 29970863ad..9b7bc21fd4 100644 --- a/apps/cli/src/runtime/interactive/session-runtime.ts +++ b/apps/cli/src/runtime/interactive/session-runtime.ts @@ -642,10 +642,7 @@ export function createInteractiveSessionRuntime(input: { } const compactionState = result.compactionState; const updated = await compactionSidecar.update(() => - manager.updateSessionCompactionState( - sourceSessionId, - compactionState, - ), + manager.updateSessionCompactionState(sourceSessionId, compactionState), ); if (!updated.updated && !updated.disabled) { throw new Error("Compaction could not be saved. Try again."); diff --git a/sdk/packages/core/src/cline-core/types.ts b/sdk/packages/core/src/cline-core/types.ts index 5269d55e25..610f5eaf4b 100644 --- a/sdk/packages/core/src/cline-core/types.ts +++ b/sdk/packages/core/src/cline-core/types.ts @@ -126,10 +126,8 @@ export interface ClineCoreAutomationApi { export type ClineCoreListHistoryOptions = SessionHistoryListOptions; -export interface ClineCoreStartInput extends Omit< - StartSessionInput, - "config" | "localRuntime" -> { +export interface ClineCoreStartInput + extends Omit { config: CoreSessionConfig; localRuntime?: LocalRuntimeStartOptions; } @@ -223,7 +221,7 @@ export interface ClineCoreOptions { */ featureFlags?: FeatureFlagsService; /** - * Gets whether persisted compaction sidecar reads and writes are enabled. + * Gets whether persisted compaction sidecar reads and writes are enabled. * @internal */ isCompactionSidecarEnabled?: () => boolean; diff --git a/sdk/packages/core/src/hub/server/boundary.test.ts b/sdk/packages/core/src/hub/server/boundary.test.ts index d0b3c6a3c4..3a98ae6663 100644 --- a/sdk/packages/core/src/hub/server/boundary.test.ts +++ b/sdk/packages/core/src/hub/server/boundary.test.ts @@ -654,73 +654,73 @@ describe("HubServerTransport boundaries", () => { }, }); - await expect(answerPromise).resolves.toBe("Use hub"); - }); + await expect(answerPromise).resolves.toBe("Use hub"); + }); - it("ignores initial compaction sidecar state when the sidecar flag is off", async () => { - let capturedStartInput: StartSessionInput | undefined; - const startSession = vi.fn(async (input: StartSessionInput) => { - capturedStartInput = input; - const sessionId = input.config.sessionId?.trim() || "session-1"; - return { - sessionId, - manifest: { - version: 1, - session_id: sessionId, - source: "cli", - pid: 1, - started_at: new Date(0).toISOString(), - status: "running", - interactive: true, - provider: "cline", - model: "test-model", - cwd: "/tmp/project", - workspace_root: "/tmp/project", - enable_tools: true, - enable_spawn: true, - enable_teams: false, - }, - manifestPath: "", - messagesPath: "", - result: undefined, - }; - }); - const transport = createTransport({ - sessionHost: { startSession }, - isCompactionSidecarEnabled: () => false, - }); - const initialCompactionState = createSessionCompactionState({ - sourceMessages: [{ role: "user", content: "source" }], - compactedMessages: [{ role: "user", content: "summary" }], - conversationId: "session-1", - }); - - const reply = await transport.handleCommand({ - version: "v1", - requestId: "req-create-sidecar-off", - command: "session.create", - clientId: "client-1", - payload: { - workspaceRoot: "/tmp/project", + it("ignores initial compaction sidecar state when the sidecar flag is off", async () => { + let capturedStartInput: StartSessionInput | undefined; + const startSession = vi.fn(async (input: StartSessionInput) => { + capturedStartInput = input; + const sessionId = input.config.sessionId?.trim() || "session-1"; + return { + sessionId, + manifest: { + version: 1, + session_id: sessionId, + source: "cli", + pid: 1, + started_at: new Date(0).toISOString(), + status: "running", + interactive: true, + provider: "cline", + model: "test-model", cwd: "/tmp/project", - sessionConfig: { - sessionId: "session-1", - providerId: "cline", - modelId: "test-model", - cwd: "/tmp/project", - workspaceRoot: "/tmp/project", - systemPrompt: "system", - }, - initialCompactionState, + workspace_root: "/tmp/project", + enable_tools: true, + enable_spawn: true, + enable_teams: false, }, - }); - - expect(reply.ok).toBe(true); - expect(capturedStartInput?.initialCompactionState).toBeUndefined(); + manifestPath: "", + messagesPath: "", + result: undefined, + }; + }); + const transport = createTransport({ + sessionHost: { startSession }, + isCompactionSidecarEnabled: () => false, + }); + const initialCompactionState = createSessionCompactionState({ + sourceMessages: [{ role: "user", content: "source" }], + compactedMessages: [{ role: "user", content: "summary" }], + conversationId: "session-1", }); - it("does not transfer capability ownership to attached clients", async () => { - let createdSessionId = ""; + const reply = await transport.handleCommand({ + version: "v1", + requestId: "req-create-sidecar-off", + command: "session.create", + clientId: "client-1", + payload: { + workspaceRoot: "/tmp/project", + cwd: "/tmp/project", + sessionConfig: { + sessionId: "session-1", + providerId: "cline", + modelId: "test-model", + cwd: "/tmp/project", + workspaceRoot: "/tmp/project", + systemPrompt: "system", + }, + initialCompactionState, + }, + }); + + expect(reply.ok).toBe(true); + expect(capturedStartInput?.initialCompactionState).toBeUndefined(); + }); + + it("does not transfer capability ownership to attached clients", async () => { + let createdSessionId = ""; const startSession = vi.fn(async (input: StartSessionInput) => { createdSessionId = input.config.sessionId?.trim() || "missing-session"; return { diff --git a/sdk/packages/core/src/runtime/host/local-runtime-host.ts b/sdk/packages/core/src/runtime/host/local-runtime-host.ts index fa70545a35..177b8d5623 100644 --- a/sdk/packages/core/src/runtime/host/local-runtime-host.ts +++ b/sdk/packages/core/src/runtime/host/local-runtime-host.ts @@ -259,7 +259,7 @@ export class LocalRuntimeHost implements RuntimeHost { new RuntimeOAuthTokenManager({ providerSettingsManager: this.providerSettingsManager, telemetry: options.telemetry, - }); + }); this.defaultTelemetry = options.telemetry; this.defaultTelemetry?.setDistinctId(distinctId); this.defaultFetch = options.fetch; @@ -531,8 +531,7 @@ export class LocalRuntimeHost implements RuntimeHost { "Skipped stale session compaction state", { sessionId: activeSession.sessionId, - sourceMessageCount: - stateForSession.source_message_count, + sourceMessageCount: stateForSession.source_message_count, }, ); } @@ -559,7 +558,7 @@ export class LocalRuntimeHost implements RuntimeHost { }); }, }) - : undefined; + : undefined; const agentConfig = { sessionId,