@getpaseo/server 0.11.0-beta.4 → 0.11.0-beta.5

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 (43) hide show
  1. package/dist/scripts/supervisor.js +10 -0
  2. package/dist/server/builtin-plugins/antigravity-provider/server/internal/process.ts +4 -3
  3. package/dist/server/builtin-plugins/antigravity-provider/server/internal/signals.ts +2 -5
  4. package/dist/server/builtin-plugins/claude-usage-source/server/usage.ts +5 -2
  5. package/dist/server/builtin-plugins/codex-usage-source/server/usage.ts +7 -1
  6. package/dist/server/builtin-plugins/muse-provider/server/catalog.ts +1 -4
  7. package/dist/server/builtin-plugins/muse-provider/server/connection.ts +41 -14
  8. package/dist/server/builtin-plugins/muse-provider/server/provider.ts +12 -13
  9. package/dist/server/builtin-plugins/muse-provider/server/session.ts +20 -19
  10. package/dist/server/builtin-plugins/muse-provider/server/sessions.ts +4 -1
  11. package/dist/server/builtin-plugins/muse-provider/server/usage.ts +20 -7
  12. package/dist/server/builtin-plugins/muse-provider/server/wire.ts +15 -8
  13. package/dist/server/builtin-plugins/package.json +1 -1
  14. package/dist/server/executable-resolution/executable-resolution.d.ts +0 -1
  15. package/dist/server/executable-resolution/executable-resolution.js +0 -3
  16. package/dist/server/server/agent/providers/claude/agent.js +30 -12
  17. package/dist/server/server/agent/providers/jsonl-rpc-process.d.ts +2 -2
  18. package/dist/server/server/agent/providers/jsonl-rpc-process.js +9 -11
  19. package/dist/server/server/agent/providers/omp/agent.d.ts +1 -0
  20. package/dist/server/server/agent/providers/omp/agent.js +24 -4
  21. package/dist/server/server/agent/providers/omp/cli-runtime.js +4 -4
  22. package/dist/server/server/agent/providers/omp/rpc-types.d.ts +365 -0
  23. package/dist/server/server/agent/providers/omp/rpc-types.js +54 -0
  24. package/dist/server/server/plugins/bundle-evaluator.js +2 -1
  25. package/dist/server/server/plugins/index.d.ts +21 -0
  26. package/dist/server/server/plugins/usage-sources/index.js +54 -22
  27. package/dist/server/server/session/daemon/npm-global-cli.js +4 -2
  28. package/dist/server/utils/spawn.d.ts +1 -1
  29. package/dist/server/utils/spawn.js +5 -33
  30. package/dist/server/web-ui/_expo/static/js/web/{index-244720b41ed4a2ce25809182e2510d6d.js → index-88d552b322a98d03fa394582d599904b.js} +24 -24
  31. package/dist/server/web-ui/_expo/static/js/web/index-88d552b322a98d03fa394582d599904b.js.br +0 -0
  32. package/dist/server/web-ui/_expo/static/js/web/index-88d552b322a98d03fa394582d599904b.js.gz +0 -0
  33. package/dist/server/web-ui/index.html +10 -1
  34. package/dist/server/web-ui/index.html.br +0 -0
  35. package/dist/server/web-ui/index.html.gz +0 -0
  36. package/dist/src/executable-resolution/executable-resolution.js +0 -3
  37. package/dist/src/utils/spawn.js +5 -33
  38. package/package.json +6 -6
  39. package/dist/server/utils/windows-command.d.ts +0 -15
  40. package/dist/server/utils/windows-command.js +0 -41
  41. package/dist/server/web-ui/_expo/static/js/web/index-244720b41ed4a2ce25809182e2510d6d.js.br +0 -0
  42. package/dist/server/web-ui/_expo/static/js/web/index-244720b41ed4a2ce25809182e2510d6d.js.gz +0 -0
  43. package/dist/src/utils/windows-command.js +0 -41
@@ -37,6 +37,13 @@ const OmpUserMessageSchema = z
37
37
  content: z.union([z.string(), z.array(z.union([OmpTextContentSchema, OmpImageContentSchema]))]),
38
38
  })
39
39
  .passthrough();
40
+ // OMP injects hidden developer messages, such as rule-violation reminders, into a run.
41
+ const OmpDeveloperMessageSchema = z
42
+ .object({
43
+ role: z.literal("developer"),
44
+ content: z.union([z.string(), z.array(z.union([OmpTextContentSchema, OmpImageContentSchema]))]),
45
+ })
46
+ .passthrough();
40
47
  const OmpCustomMessageSchema = z
41
48
  .object({
42
49
  role: z.literal("custom"),
@@ -75,12 +82,29 @@ const OmpBashExecutionMessageSchema = z
75
82
  timestamp: z.number(),
76
83
  })
77
84
  .passthrough();
85
+ // Roles Paseo does not render. They are listed so that a frame carrying one, such as
86
+ // agent_end, still parses; every role in OMP's RPC AgentMessage must appear in the union.
87
+ const OmpPythonExecutionMessageSchema = z
88
+ .object({ role: z.literal("pythonExecution") })
89
+ .passthrough();
90
+ const OmpHookMessageSchema = z.object({ role: z.literal("hookMessage") }).passthrough();
91
+ const OmpBranchSummaryMessageSchema = z.object({ role: z.literal("branchSummary") }).passthrough();
92
+ const OmpCompactionSummaryMessageSchema = z
93
+ .object({ role: z.literal("compactionSummary") })
94
+ .passthrough();
95
+ const OmpFileMentionMessageSchema = z.object({ role: z.literal("fileMention") }).passthrough();
78
96
  export const OmpAgentMessageSchema = z.discriminatedUnion("role", [
79
97
  OmpUserMessageSchema,
98
+ OmpDeveloperMessageSchema,
80
99
  OmpCustomMessageSchema,
81
100
  OmpAssistantMessageSchema,
82
101
  OmpToolResultMessageSchema,
83
102
  OmpBashExecutionMessageSchema,
103
+ OmpPythonExecutionMessageSchema,
104
+ OmpHookMessageSchema,
105
+ OmpBranchSummaryMessageSchema,
106
+ OmpCompactionSummaryMessageSchema,
107
+ OmpFileMentionMessageSchema,
84
108
  ]);
85
109
  export const OmpModelThinkingSchema = z
86
110
  .object({
@@ -460,6 +484,8 @@ export const OmpRuntimeEventSchema = z.discriminatedUnion("type", [
460
484
  type: z.literal("prompt_result"),
461
485
  id: z.string().optional(),
462
486
  agentInvoked: z.boolean().optional(),
487
+ status: z.string().optional(),
488
+ error: z.object({ message: z.string() }).passthrough().optional(),
463
489
  })
464
490
  .passthrough(),
465
491
  z.object({ type: z.literal("process_exit"), error: z.string() }).passthrough(),
@@ -561,4 +587,32 @@ export const OmpBranchMessagesResultSchema = z
561
587
  messages: z.array(z.object({ entryId: z.string(), text: z.string() }).passthrough()).optional(),
562
588
  })
563
589
  .passthrough();
590
+ /**
591
+ * COMPAT(ompLatePromptRejection): added in v0.11.0, remove after 2027-04-05 once the
592
+ * minimum supported OMP version emits prompt_result errors.
593
+ * OMP 18.3 reports a prompt it rejects after acknowledging it, such as one whose model has
594
+ * no API key, only as a second failed `response` frame for the prompt id. Later releases
595
+ * report the same outcome as a `prompt_result` with `status: "error"`.
596
+ */
597
+ const OmpLatePromptRejectionSchema = z.object({
598
+ type: z.literal("response"),
599
+ command: z.literal("prompt"),
600
+ id: z.string(),
601
+ success: z.literal(false),
602
+ error: z.string(),
603
+ });
604
+ export function parseOmpRuntimeEvent(message) {
605
+ const rejection = OmpLatePromptRejectionSchema.safeParse(message);
606
+ if (rejection.success) {
607
+ return {
608
+ type: "prompt_result",
609
+ id: rejection.data.id,
610
+ agentInvoked: false,
611
+ status: "error",
612
+ error: { message: rejection.data.error },
613
+ };
614
+ }
615
+ const event = OmpRuntimeEventSchema.safeParse(message);
616
+ return event.success ? event.data : null;
617
+ }
564
618
  //# sourceMappingURL=rpc-types.js.map
@@ -3,6 +3,7 @@ import * as pluginSharedRuntime from "@getpaseo/plugin";
3
3
  import * as pluginProviderRuntime from "@getpaseo/plugin/server/provider";
4
4
  import * as pluginAcpRuntime from "@getpaseo/plugin/server/acp";
5
5
  import * as pluginUsageRuntime from "@getpaseo/plugin/server/usage";
6
+ import * as pluginServerRuntime from "@getpaseo/plugin/server";
6
7
  import * as zod from "zod";
7
8
  import { isPluginClientOnlySdkSpecifier } from "./plugin-sdk-specifiers.js";
8
9
  const nodeRequire = createRequire(import.meta.url);
@@ -13,7 +14,7 @@ function runtimeRequire(name) {
13
14
  if (name === "@getpaseo/plugin")
14
15
  return pluginSharedRuntime;
15
16
  if (name === "@getpaseo/plugin/server")
16
- return {};
17
+ return pluginServerRuntime;
17
18
  if (name === "@getpaseo/plugin/server/provider")
18
19
  return pluginProviderRuntime;
19
20
  if (name === "@getpaseo/plugin/server/acp")
@@ -125,6 +125,27 @@ export declare class PluginService {
125
125
  error: string;
126
126
  };
127
127
  icon?: string | undefined;
128
+ loginErrors?: {
129
+ harness: string;
130
+ report: {
131
+ status: "unavailable";
132
+ problem: {
133
+ kind: "expired";
134
+ expiresAt: string;
135
+ refreshedBy?: string | undefined;
136
+ } | {
137
+ kind: "rejected";
138
+ status: number;
139
+ refreshedBy?: string | undefined;
140
+ } | {
141
+ kind: "no_quota";
142
+ detail: string;
143
+ };
144
+ } | {
145
+ status: "error";
146
+ error: string;
147
+ };
148
+ }[] | undefined;
128
149
  }[]>;
129
150
  listLegacyUsage(): Promise<{
130
151
  fetchedAt: string;
@@ -1,3 +1,4 @@
1
+ import { createHash } from "node:crypto";
1
2
  import { z } from "zod";
2
3
  import { UsageReportSchema, } from "@getpaseo/protocol/messages";
3
4
  /** Owns account identity, ordered logins for each account, and the five-minute fetch cache. */
@@ -36,14 +37,19 @@ export class UsageSourceRegistry {
36
37
  for (const key of this.cache.keys())
37
38
  if (key.startsWith(`${id}:`))
38
39
  this.cache.delete(key);
40
+ for (const key of this.pending.keys())
41
+ if (key.startsWith(`${id}:`))
42
+ this.pending.delete(key);
39
43
  }
40
44
  async listReports(options = {}) {
41
45
  if (options.agentId !== undefined && options.reportIds !== undefined)
42
46
  throw new Error("agentId and reportIds cannot be combined");
43
47
  this.pruneAgents();
44
48
  let ids;
49
+ let reports = this.known;
45
50
  if (options.agentId !== undefined) {
46
51
  ids = await this.discoverAgent(options.agentId);
52
+ reports = this.byAgent.get(options.agentId)?.reports ?? new Map();
47
53
  }
48
54
  else if (options.reportIds !== undefined) {
49
55
  ids = options.reportIds;
@@ -54,7 +60,7 @@ export class UsageSourceRegistry {
54
60
  ids = [...this.known.keys()];
55
61
  }
56
62
  return Promise.all([...new Set(ids)].flatMap((id) => {
57
- const known = this.known.get(id);
63
+ const known = reports.get(id);
58
64
  if (!known)
59
65
  return [];
60
66
  return [
@@ -112,10 +118,14 @@ export class UsageSourceRegistry {
112
118
  if (this.sources.get(report.source.id) !== report.source)
113
119
  continue;
114
120
  const known = this.known.get(id);
115
- if (known)
116
- known.inputs.push(...report.inputs);
117
- else
118
- this.known.set(id, { ...report, inputs: [...report.inputs] });
121
+ if (!known) {
122
+ this.known.set(id, { ...report, logins: [...report.logins] });
123
+ continue;
124
+ }
125
+ for (const login of report.logins) {
126
+ if (!known.logins.some((existing) => loginKey(existing) === loginKey(login)))
127
+ known.logins.push(login);
128
+ }
119
129
  }
120
130
  }
121
131
  }
@@ -127,16 +137,21 @@ export class UsageSourceRegistry {
127
137
  .array(z.object({
128
138
  key: z.string().regex(/^[A-Za-z0-9._-]{1,128}$/),
129
139
  label: z.string().optional(),
140
+ harness: z.string().min(1).optional(),
130
141
  input: z.json(),
131
142
  }))
132
143
  .parse(await source.discover(scope));
133
144
  for (const account of accounts) {
134
145
  const id = `${source.id}:${account.key}`;
135
146
  const known = reports.get(id);
136
- if (known)
137
- known.inputs.push(account.input);
147
+ // COMPAT(usageLoginHarness): added in v0.11.0, remove after 2027-04-05 once plugin floor >= v0.11.0.
148
+ const login = { input: account.input, harness: account.harness ?? source.label };
149
+ if (known) {
150
+ if (!known.logins.some((existing) => loginKey(existing) === loginKey(login)))
151
+ known.logins.push(login);
152
+ }
138
153
  else
139
- reports.set(id, { source, inputs: [account.input], label: account.label });
154
+ reports.set(id, { source, logins: [login], label: account.label });
140
155
  }
141
156
  }
142
157
  catch (error) {
@@ -173,10 +188,14 @@ export class UsageSourceRegistry {
173
188
  };
174
189
  }
175
190
  fetchId(id, known, forceRefresh = false) {
176
- const cached = this.cache.get(id);
191
+ // Account identity groups cards; the ordered login set identifies a fetch result.
192
+ const cacheKey = `${id}:${createHash("sha256")
193
+ .update(JSON.stringify([known.label, known.logins.map(loginKey)]))
194
+ .digest("hex")}`;
195
+ const cached = this.cache.get(cacheKey);
177
196
  if (!forceRefresh && cached && this.now() - cached.at < this.ttlMs)
178
197
  return Promise.resolve(cached.entry);
179
- const pending = this.pending.get(id);
198
+ const pending = this.pending.get(cacheKey);
180
199
  if (pending)
181
200
  return pending;
182
201
  const request = (async () => {
@@ -187,15 +206,16 @@ export class UsageSourceRegistry {
187
206
  icon: known.source.icon,
188
207
  account: { label: known.label },
189
208
  fetchedAt: new Date(this.now()).toISOString(),
190
- report: await this.fetchBeforeDeadline(known),
209
+ ...(await this.fetchWithFallback(known)),
191
210
  };
192
- this.writeCache(id, entry);
211
+ if (this.sources.get(known.source.id) === known.source)
212
+ this.writeCache(cacheKey, entry);
193
213
  return entry;
194
214
  })();
195
- this.pending.set(id, request);
215
+ this.pending.set(cacheKey, request);
196
216
  void request.finally(() => {
197
- if (this.pending.get(id) === request)
198
- this.pending.delete(id);
217
+ if (this.pending.get(cacheKey) === request)
218
+ this.pending.delete(cacheKey);
199
219
  });
200
220
  return request;
201
221
  }
@@ -207,26 +227,32 @@ export class UsageSourceRegistry {
207
227
  }
208
228
  this.cache.set(id, { at, entry });
209
229
  }
210
- async fetchBeforeDeadline(known) {
230
+ async fetchBeforeDeadline(source, input) {
211
231
  let timer;
212
232
  const deadline = new Promise((resolve) => {
213
233
  timer = setTimeout(() => resolve({ status: "error", error: "Usage fetch timed out" }), this.deadlineMs);
214
234
  });
215
235
  try {
216
- return await Promise.race([this.fetchWithFallback(known), deadline]);
236
+ return await Promise.race([this.fetchLogin(source, input), deadline]);
217
237
  }
218
238
  finally {
219
239
  clearTimeout(timer);
220
240
  }
221
241
  }
222
242
  async fetchWithFallback(known) {
223
- let report = await this.fetchLogin(known.source, known.inputs[0]);
224
- for (const input of known.inputs.slice(1)) {
243
+ // Start each login within the same deadline window, then prefer discovery order.
244
+ // Sequential deadlines can exceed the client's RPC timeout before all errors arrive.
245
+ const attempts = known.logins.map((login) => this.fetchBeforeDeadline(known.source, login.input));
246
+ const loginErrors = [];
247
+ for (const [index, login] of known.logins.entries()) {
248
+ const report = await attempts[index];
225
249
  if (report.status === "available")
226
- break;
227
- report = await this.fetchLogin(known.source, input);
250
+ return { report };
251
+ loginErrors.push({ harness: login.harness, report });
228
252
  }
229
- return report;
253
+ // COMPAT(usageLoginErrors): added in v0.11.0, remove after 2027-04-05 once app floor >= v0.11.0.
254
+ // Keep the final single report so older apps still parse and display failed accounts.
255
+ return { report: loginErrors[loginErrors.length - 1].report, loginErrors };
230
256
  }
231
257
  async fetchLogin(source, input) {
232
258
  try {
@@ -266,4 +292,10 @@ function legacyError(report, now) {
266
292
  return legacyProblem(report.problem, now);
267
293
  return null;
268
294
  }
295
+ // Inputs are opaque JSON locators. Canonical equality deduplicates discovery across scopes.
296
+ function loginKey(login) {
297
+ return JSON.stringify(login, (_key, value) => value !== null && typeof value === "object" && !Array.isArray(value)
298
+ ? Object.fromEntries(Object.entries(value).sort(([a], [b]) => a.localeCompare(b)))
299
+ : value);
300
+ }
269
301
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,4 @@
1
+ import { lstatSync } from "node:fs";
1
2
  import { getErrorMessage } from "@getpaseo/protocol/error-utils";
2
3
  import { z } from "zod";
3
4
  import { execCommand } from "../../../utils/spawn.js";
@@ -15,7 +16,6 @@ const NpmGlobalCliPackageSchema = z
15
16
  .object({
16
17
  version: z.string(),
17
18
  path: z.string(),
18
- link: z.boolean().optional(),
19
19
  })
20
20
  .passthrough();
21
21
  const CommandErrorSchema = z
@@ -66,7 +66,9 @@ function parseNpmGlobalPaseoInstall(stdout) {
66
66
  version: cliPackage.data.version,
67
67
  packagePath: cliPackage.data.path,
68
68
  globalRootPath: list.data.path ?? null,
69
- isLinked: cliPackage.data.link === true,
69
+ // npm links an install by making its node_modules entry a symlink (a junction
70
+ // on Windows), and `npm ls --json` reports no flag for it.
71
+ isLinked: lstatSync(cliPackage.data.path).isSymbolicLink(),
70
72
  };
71
73
  }
72
74
  export class DefaultNpmGlobalPaseoCli {
@@ -1,4 +1,4 @@
1
- import { type ChildProcess, type SpawnOptions } from "node:child_process";
1
+ import type { ChildProcess, SpawnOptions } from "node:child_process";
2
2
  import { type ProcessEnvRecord } from "../server/paseo-env.js";
3
3
  interface ExternalEnvOptions {
4
4
  baseEnv?: ProcessEnvRecord;
@@ -1,60 +1,32 @@
1
- import { execFile, spawn } from "node:child_process";
2
- import { extname } from "node:path";
3
- import { promisify } from "node:util";
1
+ import { spawnProcess as spawnCli, execCommand as execCli } from "@getpaseo/plugin/server";
4
2
  import { createExternalCommandProcessEnv } from "../server/paseo-env.js";
5
- import { isWindowsCommandScript, quoteWindowsArgument, quoteWindowsCommand, } from "./windows-command.js";
6
- const execFileAsync = promisify(execFile);
7
- function hasPathSeparator(value) {
8
- return value.includes("/") || value.includes("\\");
9
- }
10
- function shouldUseWindowsShell(command, requestedShell) {
11
- if (isWindowsCommandScript(command)) {
12
- return true;
13
- }
14
- if (requestedShell !== undefined) {
15
- return requestedShell;
16
- }
17
- return process.platform === "win32" && !hasPathSeparator(command) && !extname(command);
18
- }
19
3
  export function spawnProcess(command, args, options) {
20
4
  const { baseEnv, env, envOverlay, ...spawnOptions } = options ?? {};
21
5
  const resolvedBaseEnv = env ?? baseEnv ?? process.env;
22
- const isWindows = process.platform === "win32";
23
- const shell = shouldUseWindowsShell(command, spawnOptions.shell);
24
- const shouldQuoteForShell = isWindows && shell !== false;
25
- const resolvedCommand = shouldQuoteForShell ? quoteWindowsCommand(command) : command;
26
- const resolvedArgs = shouldQuoteForShell ? args.map(quoteWindowsArgument) : args;
27
6
  const childEnv = options?.envMode === "internal"
28
7
  ? { ...resolvedBaseEnv, ...envOverlay }
29
8
  : createExternalCommandProcessEnv(command, resolvedBaseEnv, ...(envOverlay ? [envOverlay] : []));
30
- return spawn(resolvedCommand, resolvedArgs, {
9
+ return spawnCli(command, args, {
31
10
  ...spawnOptions,
32
11
  env: childEnv,
33
- shell,
34
12
  signal: options?.signal,
35
- windowsHide: true,
36
13
  });
37
14
  }
38
15
  export async function execCommand(command, args, options) {
39
16
  const { baseEnv, env, envOverlay } = options ?? {};
40
17
  const resolvedBaseEnv = env ?? baseEnv ?? process.env;
41
- const isWindows = process.platform === "win32";
42
- const shell = shouldUseWindowsShell(command, options?.shell);
43
- const shouldQuoteForShell = isWindows && shell !== false;
44
- const resolvedCommand = shouldQuoteForShell ? quoteWindowsCommand(command) : command;
45
- const resolvedArgs = shouldQuoteForShell ? args.map(quoteWindowsArgument) : args;
46
18
  const childEnv = options?.envMode === "internal"
47
19
  ? { ...resolvedBaseEnv, ...envOverlay }
48
20
  : createExternalCommandProcessEnv(command, resolvedBaseEnv, ...(envOverlay ? [envOverlay] : []));
49
- return execFileAsync(resolvedCommand, resolvedArgs, {
21
+ return execCli(command, args, {
50
22
  cwd: options?.cwd,
51
23
  env: childEnv,
24
+ shell: options?.shell,
52
25
  encoding: options?.encoding ?? "utf8",
26
+ signal: options?.signal,
53
27
  killSignal: options?.killSignal,
54
28
  timeout: options?.timeout,
55
29
  maxBuffer: options?.maxBuffer,
56
- shell,
57
- windowsHide: true,
58
30
  });
59
31
  }
60
32
  //# sourceMappingURL=spawn.js.map