@getpaseo/server 0.1.99 → 0.1.100

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.
Files changed (22) hide show
  1. package/dist/server/server/agent/provider-registry.js +1 -0
  2. package/dist/server/server/agent/providers/acp-agent.d.ts +19 -1
  3. package/dist/server/server/agent/providers/acp-agent.js +117 -0
  4. package/dist/server/server/agent/providers/claude/agent.js +36 -52
  5. package/dist/server/server/agent/providers/copilot-acp-agent.d.ts +2 -1
  6. package/dist/server/server/agent/providers/copilot-acp-agent.js +10 -0
  7. package/dist/server/server/agent/providers/opencode/server-manager.d.ts +14 -11
  8. package/dist/server/server/agent/providers/opencode/server-manager.js +149 -91
  9. package/dist/server/server/agent/providers/opencode/test-server-manager.d.ts +6 -5
  10. package/dist/server/server/agent/providers/opencode/test-server-manager.js +13 -3
  11. package/dist/server/server/agent/providers/opencode/test-utils/{test-opencode-runtime.d.ts → test-opencode-harness.d.ts} +11 -11
  12. package/dist/server/server/agent/providers/opencode/test-utils/{test-opencode-runtime.js → test-opencode-harness.js} +23 -10
  13. package/dist/server/server/agent/providers/opencode-agent.d.ts +9 -3
  14. package/dist/server/server/agent/providers/opencode-agent.js +26 -38
  15. package/dist/server/server/agent/providers/pi/agent.d.ts +2 -1
  16. package/dist/server/server/agent/providers/pi/agent.js +5 -3
  17. package/dist/server/server/agent/providers/pi/cli-runtime.d.ts +3 -0
  18. package/dist/server/server/agent/providers/pi/cli-runtime.js +6 -3
  19. package/dist/server/server/agent/providers/pi/rpc-types.d.ts +2 -1
  20. package/package.json +5 -5
  21. package/dist/server/server/agent/providers/opencode/runtime.d.ts +0 -28
  22. package/dist/server/server/agent/providers/opencode/runtime.js +0 -5
@@ -1,3 +1,4 @@
1
+ import { createOpencodeClient, } from "@opencode-ai/sdk/v2/client";
1
2
  import { createPathEquivalenceMatcher } from "../../../utils/path.js";
2
3
  import pLimit from "p-limit";
3
4
  import { z } from "zod";
@@ -9,12 +10,11 @@ import { withTimeout } from "../../../utils/promise-timeout.js";
9
10
  import { execCommand } from "../../../utils/spawn.js";
10
11
  import { buildToolCallDisplayModel } from "@getpaseo/protocol/tool-call-display";
11
12
  import { mapOpencodeToolCall } from "./opencode/tool-call-mapper.js";
12
- import { OpenCodeServerManager } from "./opencode/server-manager.js";
13
+ import { OpenCodeServerManager, } from "./opencode/server-manager.js";
13
14
  import { formatProviderDiagnostic, formatProviderDiagnosticError, buildBinaryDiagnosticRows, buildCommandResolutionDiagnosticRows, toDiagnosticErrorMessage, } from "./diagnostic-utils.js";
14
15
  import { runProviderTurn } from "./provider-runner.js";
15
16
  import { renderPromptAttachmentAsText } from "../prompt-attachments.js";
16
17
  import { composeSystemPromptParts } from "../system-prompt.js";
17
- import { createSdkOpenCodeClient, } from "./opencode/runtime.js";
18
18
  import { normalizeProviderReplayTimestamp } from "../provider-history-timestamps.js";
19
19
  import { revertOpenCodeConversationAndFiles } from "./opencode/rewind.js";
20
20
  const OPENCODE_CAPABILITIES = {
@@ -851,22 +851,8 @@ export const __openCodeInternals = {
851
851
  return OpenCodeAgentSession;
852
852
  },
853
853
  };
854
- class ProductionOpenCodeRuntime {
855
- constructor(serverManager) {
856
- this.serverManager = serverManager;
857
- }
858
- async acquireServer(options) {
859
- return this.serverManager.acquire(options);
860
- }
861
- async ensureServerRunning() {
862
- return this.serverManager.ensureRunning();
863
- }
864
- createClient(options) {
865
- return createSdkOpenCodeClient(options);
866
- }
867
- async shutdown() {
868
- await this.serverManager.shutdown();
869
- }
854
+ function createSdkOpenCodeClient(options) {
855
+ return createOpencodeClient(options);
870
856
  }
871
857
  export class OpenCodeAgentClient {
872
858
  constructor(logger, runtimeSettings, deps = {}) {
@@ -877,20 +863,20 @@ export class OpenCodeAgentClient {
877
863
  this.modelContextWindows = new Map();
878
864
  this.logger = logger.child({ module: "agent", provider: "opencode" });
879
865
  this.runtimeSettings = runtimeSettings;
880
- this.runtime =
881
- deps.runtime ??
882
- new ProductionOpenCodeRuntime(OpenCodeServerManager.getInstance(this.logger, runtimeSettings, {
866
+ this.serverManager =
867
+ deps.serverManager ??
868
+ OpenCodeServerManager.getInstance(this.logger, runtimeSettings, {
883
869
  managedProcesses: deps.managedProcesses,
884
- }));
870
+ });
871
+ this.createOpenCodeClient = deps.createClient ?? createSdkOpenCodeClient;
885
872
  }
886
873
  async createSession(config, launchContext, options) {
887
874
  const openCodeConfig = this.assertConfig(config);
888
- const acquisition = await this.runtime.acquireServer({
889
- force: false,
890
- env: launchContext?.env,
891
- });
875
+ const acquisition = launchContext?.env
876
+ ? await this.serverManager.acquireDedicated(launchContext.env)
877
+ : await this.serverManager.acquireCurrent();
892
878
  const { url } = acquisition.server;
893
- const client = this.runtime.createClient({
879
+ const client = this.createOpenCodeClient({
894
880
  baseUrl: url,
895
881
  directory: openCodeConfig.cwd,
896
882
  });
@@ -924,9 +910,9 @@ export class OpenCodeAgentClient {
924
910
  cwd,
925
911
  };
926
912
  const openCodeConfig = this.assertConfig(config);
927
- const acquisition = await this.runtime.acquireServer({ force: false });
913
+ const acquisition = await this.serverManager.acquireCurrent();
928
914
  const { url } = acquisition.server;
929
- const client = this.runtime.createClient({
915
+ const client = this.createOpenCodeClient({
930
916
  baseUrl: url,
931
917
  directory: openCodeConfig.cwd,
932
918
  });
@@ -940,10 +926,12 @@ export class OpenCodeAgentClient {
940
926
  }
941
927
  }
942
928
  async fetchCatalog(options) {
943
- const acquisition = await this.runtime.acquireServer({ force: options.force });
929
+ const acquisition = options.force
930
+ ? await this.serverManager.acquireNew()
931
+ : await this.serverManager.acquireCurrent();
944
932
  const { url } = acquisition.server;
945
933
  const directory = options.cwd;
946
- const client = this.runtime.createClient({ baseUrl: url, directory });
934
+ const client = this.createOpenCodeClient({ baseUrl: url, directory });
947
935
  try {
948
936
  const [models, modes] = await Promise.all([
949
937
  this.fetchModelsFromClient(client, directory),
@@ -957,9 +945,9 @@ export class OpenCodeAgentClient {
957
945
  }
958
946
  async listCommands(config) {
959
947
  const openCodeConfig = this.assertConfig(config);
960
- const acquisition = await this.runtime.acquireServer({ force: false });
948
+ const acquisition = await this.serverManager.acquireCurrent();
961
949
  const { url } = acquisition.server;
962
- const client = this.runtime.createClient({
950
+ const client = this.createOpenCodeClient({
963
951
  baseUrl: url,
964
952
  directory: openCodeConfig.cwd,
965
953
  });
@@ -974,9 +962,9 @@ export class OpenCodeAgentClient {
974
962
  return [buildOpenCodeAutoAcceptFeature(this.assertConfig(config))];
975
963
  }
976
964
  async listImportableSessions(options) {
977
- const acquisition = await this.runtime.acquireServer({ force: false });
965
+ const acquisition = await this.serverManager.acquireCurrent();
978
966
  const { url } = acquisition.server;
979
- const client = this.runtime.createClient({
967
+ const client = this.createOpenCodeClient({
980
968
  baseUrl: url,
981
969
  directory: options?.cwd ?? "",
982
970
  });
@@ -988,9 +976,9 @@ export class OpenCodeAgentClient {
988
976
  }
989
977
  }
990
978
  async importSession(input, context) {
991
- const acquisition = await this.runtime.acquireServer({ force: false });
979
+ const acquisition = await this.serverManager.acquireCurrent();
992
980
  const { url } = acquisition.server;
993
- const client = this.runtime.createClient({
981
+ const client = this.createOpenCodeClient({
994
982
  baseUrl: url,
995
983
  directory: input.cwd,
996
984
  });
@@ -1031,7 +1019,7 @@ export class OpenCodeAgentClient {
1031
1019
  return availability.available;
1032
1020
  }
1033
1021
  async shutdown() {
1034
- await this.runtime.shutdown();
1022
+ await this.serverManager.shutdown();
1035
1023
  }
1036
1024
  async getDiagnostic() {
1037
1025
  try {
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  import { type AgentCapabilityFlags, type AgentClient, type AgentLaunchContext, type AgentMode, type AgentModelDefinition, type AgentPermissionRequest, type AgentPermissionResponse, type AgentPersistenceHandle, type AgentPromptInput, type AgentRunOptions, type AgentRunResult, type AgentRuntimeInfo, type AgentSession, type AgentSessionConfig, type AgentSlashCommand, type AgentStreamEvent, type FetchCatalogOptions, type ImportableProviderSession, type ImportProviderSessionContext, type ImportProviderSessionInput, type ListImportableSessionsOptions, type ProviderCatalog } from "../../agent-sdk-types.js";
4
4
  import { type ProviderRuntimeSettings } from "../../provider-launch-config.js";
5
5
  import type { PiRuntime, PiRuntimeSession } from "./runtime.js";
6
- import type { PiSessionState } from "./rpc-types.js";
6
+ import type { PiCommandsRpcType, PiSessionState } from "./rpc-types.js";
7
7
  export declare const PiProviderParamsSchema: z.ZodObject<{
8
8
  sessionDir: z.ZodOptional<z.ZodString>;
9
9
  }, z.core.$strict>;
@@ -11,6 +11,7 @@ interface PiRpcAgentClientOptions {
11
11
  logger: Logger;
12
12
  runtimeSettings?: ProviderRuntimeSettings;
13
13
  providerParams?: unknown;
14
+ commandsRpcType?: PiCommandsRpcType;
14
15
  runtime?: PiRuntime;
15
16
  }
16
17
  interface StartTurnResult {
@@ -685,8 +685,8 @@ function mapPiModel(model) {
685
685
  defaultThinkingOptionId: model.reasoning ? DEFAULT_PI_THINKING_LEVEL : undefined,
686
686
  };
687
687
  }
688
- function createRuntime(logger, runtimeSettings) {
689
- return new PiCliRuntime({ logger, runtimeSettings });
688
+ function createRuntime(logger, runtimeSettings, commandsRpcType) {
689
+ return new PiCliRuntime({ logger, runtimeSettings, commandsRpcType });
690
690
  }
691
691
  export class PiRpcAgentSession {
692
692
  constructor(options) {
@@ -1458,7 +1458,9 @@ export class PiRpcAgentClient {
1458
1458
  this.logger = options.logger;
1459
1459
  this.runtimeSettings = options.runtimeSettings;
1460
1460
  this.providerParams = PiProviderParamsSchema.parse(options.providerParams ?? {});
1461
- this.runtime = options.runtime ?? createRuntime(options.logger, options.runtimeSettings);
1461
+ this.runtime =
1462
+ options.runtime ??
1463
+ createRuntime(options.logger, options.runtimeSettings, options.commandsRpcType);
1462
1464
  }
1463
1465
  async createSession(config, launchContext) {
1464
1466
  const mcpConfig = await this.prepareMcpConfig(config.cwd, config.mcpServers);
@@ -2,15 +2,18 @@ import { type ChildProcessWithoutNullStreams } from "node:child_process";
2
2
  import type { Logger } from "pino";
3
3
  import type { ProviderRuntimeSettings } from "../../provider-launch-config.js";
4
4
  import { type PiRuntime, type PiRuntimeLaunch, type PiRuntimeSession, type PiStartSessionInput } from "./runtime.js";
5
+ import type { PiCommandsRpcType } from "./rpc-types.js";
5
6
  export interface PiCliRuntimeOptions {
6
7
  logger: Logger;
7
8
  runtimeSettings?: ProviderRuntimeSettings;
8
9
  command?: [string, ...string[]];
10
+ commandsRpcType?: PiCommandsRpcType;
9
11
  spawnProcess?: (launch: PiRuntimeLaunch) => ChildProcessWithoutNullStreams;
10
12
  }
11
13
  export declare class PiCliRuntime implements PiRuntime {
12
14
  private readonly options;
13
15
  private readonly command;
16
+ private readonly commandsRpcType;
14
17
  private readonly spawnProcess;
15
18
  constructor(options: PiCliRuntimeOptions);
16
19
  startSession(input: PiStartSessionInput): Promise<PiRuntimeSession>;
@@ -5,6 +5,7 @@ const DEFAULT_PI_COMMAND = [
5
5
  process.env.PI_COMMAND ?? process.env.PI_ACP_PI_COMMAND ?? "pi",
6
6
  ];
7
7
  const DEFAULT_TIMEOUT_MS = 30000;
8
+ const DEFAULT_COMMANDS_RPC_TYPE = "get_commands";
8
9
  const STDERR_BUFFER_LIMIT = 8192;
9
10
  const GRACEFUL_SHUTDOWN_TIMEOUT_MS = 2000;
10
11
  const FORCE_SHUTDOWN_TIMEOUT_MS = 1000;
@@ -17,6 +18,7 @@ export class PiCliRuntime {
17
18
  constructor(options) {
18
19
  this.options = options;
19
20
  this.command = options.command ?? DEFAULT_PI_COMMAND;
21
+ this.commandsRpcType = options.commandsRpcType ?? DEFAULT_COMMANDS_RPC_TYPE;
20
22
  this.spawnProcess =
21
23
  options.spawnProcess ??
22
24
  ((launch) => {
@@ -36,13 +38,14 @@ export class PiCliRuntime {
36
38
  runtimeSettings: this.options.runtimeSettings,
37
39
  session: input,
38
40
  });
39
- return new PiCliRuntimeSession(launch, this.spawnProcess(launch), this.options.logger);
41
+ return new PiCliRuntimeSession(launch, this.spawnProcess(launch), this.options.logger, this.commandsRpcType);
40
42
  }
41
43
  }
42
44
  class PiCliRuntimeSession {
43
- constructor(_launch, child, logger) {
45
+ constructor(_launch, child, logger, commandsRpcType) {
44
46
  this.child = child;
45
47
  this.logger = logger;
48
+ this.commandsRpcType = commandsRpcType;
46
49
  this.pending = new Map();
47
50
  this.subscribers = new Set();
48
51
  this.stderrBuffer = "";
@@ -109,7 +112,7 @@ class PiCliRuntimeSession {
109
112
  return (await this.request({ type: "get_session_stats" }));
110
113
  }
111
114
  async getCommands() {
112
- const data = (await this.request({ type: "get_commands" }));
115
+ const data = (await this.request({ type: this.commandsRpcType }));
113
116
  return data.commands ?? [];
114
117
  }
115
118
  respondToExtensionUiRequest(id, response) {
@@ -94,6 +94,7 @@ export interface PiRpcSlashCommand {
94
94
  source: "extension" | "prompt" | "skill";
95
95
  sourceInfo?: Record<string, unknown>;
96
96
  }
97
+ export type PiCommandsRpcType = "get_commands" | "get_available_commands";
97
98
  export type PiRpcCommand = {
98
99
  id?: string;
99
100
  type: "prompt";
@@ -133,7 +134,7 @@ export type PiRpcCommand = {
133
134
  type: "get_session_stats";
134
135
  } | {
135
136
  id?: string;
136
- type: "get_commands";
137
+ type: PiCommandsRpcType;
137
138
  };
138
139
  export interface PiRpcResponse {
139
140
  id?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpaseo/server",
3
- "version": "0.1.99",
3
+ "version": "0.1.100",
4
4
  "description": "Paseo backend server",
5
5
  "files": [
6
6
  "dist/server",
@@ -65,10 +65,10 @@
65
65
  "@agentclientprotocol/sdk": "^0.17.1",
66
66
  "@anthropic-ai/claude-agent-sdk": "^0.3.181",
67
67
  "@anthropic-ai/sdk": "^0.104.2",
68
- "@getpaseo/client": "0.1.99",
69
- "@getpaseo/highlight": "0.1.99",
70
- "@getpaseo/protocol": "0.1.99",
71
- "@getpaseo/relay": "0.1.99",
68
+ "@getpaseo/client": "0.1.100",
69
+ "@getpaseo/highlight": "0.1.100",
70
+ "@getpaseo/protocol": "0.1.100",
71
+ "@getpaseo/relay": "0.1.100",
72
72
  "@isaacs/ttlcache": "^2.1.4",
73
73
  "@modelcontextprotocol/sdk": "^1.20.1",
74
74
  "@opencode-ai/sdk": "1.14.46",
@@ -1,28 +0,0 @@
1
- import { type OpencodeClient } from "@opencode-ai/sdk/v2/client";
2
- export interface OpenCodeServerAcquisition {
3
- server: {
4
- port: number;
5
- url: string;
6
- };
7
- release: () => void;
8
- }
9
- export interface OpenCodeRuntime {
10
- acquireServer(options: {
11
- force: boolean;
12
- env?: Record<string, string>;
13
- }): Promise<OpenCodeServerAcquisition>;
14
- ensureServerRunning(): Promise<{
15
- port: number;
16
- url: string;
17
- }>;
18
- createClient(options: {
19
- baseUrl: string;
20
- directory: string;
21
- }): OpencodeClient;
22
- shutdown(): Promise<void>;
23
- }
24
- export declare function createSdkOpenCodeClient(options: {
25
- baseUrl: string;
26
- directory: string;
27
- }): OpencodeClient;
28
- //# sourceMappingURL=runtime.d.ts.map
@@ -1,5 +0,0 @@
1
- import { createOpencodeClient, } from "@opencode-ai/sdk/v2/client";
2
- export function createSdkOpenCodeClient(options) {
3
- return createOpencodeClient(options);
4
- }
5
- //# sourceMappingURL=runtime.js.map