@getpaseo/server 0.1.97-beta.2 → 0.1.97

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 (35) hide show
  1. package/dist/server/server/agent/agent-manager.js +1 -1
  2. package/dist/server/server/agent/agent-response-loop.js +9 -3
  3. package/dist/server/server/agent/agent-storage.d.ts +20 -240
  4. package/dist/server/server/agent/agent-storage.js +6 -6
  5. package/dist/server/server/agent/mcp-server.js +9 -4
  6. package/dist/server/server/agent/mcp-shared.d.ts +35 -179
  7. package/dist/server/server/agent/provider-snapshot-manager.d.ts +1 -0
  8. package/dist/server/server/agent/provider-snapshot-manager.js +25 -34
  9. package/dist/server/server/agent/providers/claude/project-dir.js +9 -6
  10. package/dist/server/server/agent/providers/claude/task-notification-tool-call.d.ts +2 -22
  11. package/dist/server/server/agent/providers/codex/app-server-transport.d.ts +8 -118
  12. package/dist/server/server/agent/providers/generic-acp-agent.d.ts +1 -5
  13. package/dist/server/server/agent/providers/pi/agent.d.ts +1 -5
  14. package/dist/server/server/agent/providers/tool-call-detail-primitives.d.ts +391 -1261
  15. package/dist/server/server/agent/providers/tool-call-detail-primitives.js +26 -16
  16. package/dist/server/server/loop-service.d.ts +60 -359
  17. package/dist/server/server/migrations/backfill-workspace-id.migration.js +10 -6
  18. package/dist/server/server/package-version.d.ts +1 -7
  19. package/dist/server/server/paseo-worktree-service.js +15 -1
  20. package/dist/server/server/persisted-config.d.ts +138 -1009
  21. package/dist/server/server/persisted-config.js +1 -1
  22. package/dist/server/server/pid-lock.d.ts +1 -15
  23. package/dist/server/server/session.d.ts +6 -0
  24. package/dist/server/server/session.js +195 -25
  25. package/dist/server/server/speech/providers/local/sherpa/model-catalog.d.ts +2 -2
  26. package/dist/server/server/speech/speech-types.d.ts +9 -11
  27. package/dist/server/server/websocket-server.js +4 -0
  28. package/dist/server/server/workspace-registry.d.ts +17 -48
  29. package/dist/server/server/workspace-registry.js +9 -0
  30. package/dist/server/terminal/terminal-session-controller.d.ts +8 -0
  31. package/dist/server/terminal/terminal-session-controller.js +23 -3
  32. package/dist/server/utils/checkout-git.js +36 -76
  33. package/dist/server/utils/worktree-metadata.d.ts +7 -59
  34. package/dist/src/server/persisted-config.js +1 -1
  35. package/package.json +9 -9
@@ -82,7 +82,7 @@ function attachPersistenceCwd(handle, cwd) {
82
82
  };
83
83
  }
84
84
  const BUSY_STATUSES = new Set(["initializing", "running"]);
85
- const AgentIdSchema = z.string().uuid();
85
+ const AgentIdSchema = z.guid();
86
86
  function isAgentBusy(status) {
87
87
  return BUSY_STATUSES.has(status);
88
88
  }
@@ -1,4 +1,4 @@
1
- import { zodToJsonSchema } from "zod-to-json-schema";
1
+ import { z } from "zod";
2
2
  import Ajv from "ajv";
3
3
  export class StructuredAgentResponseError extends Error {
4
4
  constructor(message, options) {
@@ -32,8 +32,14 @@ function isZodSchema(value) {
32
32
  return typeof value?.safeParse === "function";
33
33
  }
34
34
  function buildZodValidator(schema, schemaName) {
35
- const zodToJsonSchemaAny = zodToJsonSchema;
36
- const jsonSchema = zodToJsonSchemaAny(schema, schemaName);
35
+ const jsonSchema = z.toJSONSchema(schema, {
36
+ target: "draft-07",
37
+ unrepresentable: "any",
38
+ io: "input",
39
+ });
40
+ if (typeof jsonSchema.title !== "string") {
41
+ jsonSchema.title = schemaName;
42
+ }
37
43
  return {
38
44
  jsonSchema,
39
45
  validate: (value) => {
@@ -13,7 +13,13 @@ declare const STORED_AGENT_SCHEMA: z.ZodObject<{
13
13
  lastUserMessageAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
14
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
15
  labels: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
16
- lastStatus: z.ZodDefault<z.ZodEnum<["initializing", "idle", "running", "error", "closed"]>>;
16
+ lastStatus: z.ZodDefault<z.ZodEnum<{
17
+ error: "error";
18
+ initializing: "initializing";
19
+ idle: "idle";
20
+ running: "running";
21
+ closed: "closed";
22
+ }>>;
17
23
  lastModeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
24
  config: z.ZodOptional<z.ZodNullable<z.ZodObject<{
19
25
  modeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -23,23 +29,7 @@ declare const STORED_AGENT_SCHEMA: z.ZodObject<{
23
29
  extra: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
24
30
  systemPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
31
  mcpServers: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
26
- }, "strip", z.ZodTypeAny, {
27
- modeId?: string | null | undefined;
28
- model?: string | null | undefined;
29
- thinkingOptionId?: string | null | undefined;
30
- featureValues?: Record<string, unknown> | null | undefined;
31
- extra?: Record<string, any> | null | undefined;
32
- systemPrompt?: string | null | undefined;
33
- mcpServers?: Record<string, any> | null | undefined;
34
- }, {
35
- modeId?: string | null | undefined;
36
- model?: string | null | undefined;
37
- thinkingOptionId?: string | null | undefined;
38
- featureValues?: Record<string, unknown> | null | undefined;
39
- extra?: Record<string, any> | null | undefined;
40
- systemPrompt?: string | null | undefined;
41
- mcpServers?: Record<string, any> | null | undefined;
42
- }>>>;
32
+ }, z.core.$strip>>>;
43
33
  runtimeInfo: z.ZodOptional<z.ZodObject<{
44
34
  provider: z.ZodString;
45
35
  sessionId: z.ZodNullable<z.ZodString>;
@@ -47,22 +37,8 @@ declare const STORED_AGENT_SCHEMA: z.ZodObject<{
47
37
  thinkingOptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
38
  modeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
39
  extra: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
50
- }, "strip", z.ZodTypeAny, {
51
- provider: string;
52
- sessionId: string | null;
53
- modeId?: string | null | undefined;
54
- model?: string | null | undefined;
55
- thinkingOptionId?: string | null | undefined;
56
- extra?: Record<string, unknown> | undefined;
57
- }, {
58
- provider: string;
59
- sessionId: string | null;
60
- modeId?: string | null | undefined;
61
- model?: string | null | undefined;
62
- thinkingOptionId?: string | null | undefined;
63
- extra?: Record<string, unknown> | undefined;
64
- }>>;
65
- features: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
40
+ }, z.core.$strip>>;
41
+ features: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
66
42
  type: z.ZodLiteral<"toggle">;
67
43
  id: z.ZodString;
68
44
  label: z.ZodString;
@@ -70,23 +46,7 @@ declare const STORED_AGENT_SCHEMA: z.ZodObject<{
70
46
  tooltip: z.ZodOptional<z.ZodString>;
71
47
  icon: z.ZodOptional<z.ZodString>;
72
48
  value: z.ZodBoolean;
73
- }, "strip", z.ZodTypeAny, {
74
- value: boolean;
75
- type: "toggle";
76
- id: string;
77
- label: string;
78
- description?: string | undefined;
79
- icon?: string | undefined;
80
- tooltip?: string | undefined;
81
- }, {
82
- value: boolean;
83
- type: "toggle";
84
- id: string;
85
- label: string;
86
- description?: string | undefined;
87
- icon?: string | undefined;
88
- tooltip?: string | undefined;
89
- }>, z.ZodObject<{
49
+ }, z.core.$strip>, z.ZodObject<{
90
50
  type: z.ZodLiteral<"select">;
91
51
  id: z.ZodString;
92
52
  label: z.ZodString;
@@ -100,205 +60,25 @@ declare const STORED_AGENT_SCHEMA: z.ZodObject<{
100
60
  description: z.ZodOptional<z.ZodString>;
101
61
  isDefault: z.ZodOptional<z.ZodBoolean>;
102
62
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
103
- }, "strip", z.ZodTypeAny, {
104
- id: string;
105
- label: string;
106
- description?: string | undefined;
107
- metadata?: Record<string, unknown> | undefined;
108
- isDefault?: boolean | undefined;
109
- }, {
110
- id: string;
111
- label: string;
112
- description?: string | undefined;
113
- metadata?: Record<string, unknown> | undefined;
114
- isDefault?: boolean | undefined;
115
- }>, "many">;
116
- }, "strip", z.ZodTypeAny, {
117
- value: string | null;
118
- options: {
119
- id: string;
120
- label: string;
121
- description?: string | undefined;
122
- metadata?: Record<string, unknown> | undefined;
123
- isDefault?: boolean | undefined;
124
- }[];
125
- type: "select";
126
- id: string;
127
- label: string;
128
- description?: string | undefined;
129
- icon?: string | undefined;
130
- tooltip?: string | undefined;
131
- }, {
132
- value: string | null;
133
- options: {
134
- id: string;
135
- label: string;
136
- description?: string | undefined;
137
- metadata?: Record<string, unknown> | undefined;
138
- isDefault?: boolean | undefined;
139
- }[];
140
- type: "select";
141
- id: string;
142
- label: string;
143
- description?: string | undefined;
144
- icon?: string | undefined;
145
- tooltip?: string | undefined;
146
- }>]>, "many">>;
63
+ }, z.core.$strip>>;
64
+ }, z.core.$strip>], "type">>>;
147
65
  persistence: z.ZodOptional<z.ZodNullable<z.ZodObject<{
148
66
  provider: z.ZodString;
149
67
  sessionId: z.ZodString;
150
68
  nativeHandle: z.ZodOptional<z.ZodAny>;
151
69
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
152
- }, "strip", z.ZodTypeAny, {
153
- provider: string;
154
- sessionId: string;
155
- metadata?: Record<string, any> | undefined;
156
- nativeHandle?: any;
157
- }, {
158
- provider: string;
159
- sessionId: string;
160
- metadata?: Record<string, any> | undefined;
161
- nativeHandle?: any;
162
- }>>>;
70
+ }, z.core.$strip>>>;
163
71
  lastError: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
72
  requiresAttention: z.ZodOptional<z.ZodBoolean>;
165
- attentionReason: z.ZodOptional<z.ZodNullable<z.ZodEnum<["finished", "error", "permission"]>>>;
73
+ attentionReason: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
74
+ finished: "finished";
75
+ error: "error";
76
+ permission: "permission";
77
+ }>>>;
166
78
  attentionTimestamp: z.ZodOptional<z.ZodNullable<z.ZodString>>;
167
79
  internal: z.ZodOptional<z.ZodBoolean>;
168
80
  archivedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
169
- }, "strip", z.ZodTypeAny, {
170
- cwd: string;
171
- id: string;
172
- provider: string;
173
- createdAt: string;
174
- updatedAt: string;
175
- labels: Record<string, string>;
176
- lastStatus: "error" | "idle" | "running" | "initializing" | "closed";
177
- workspaceId?: string | undefined;
178
- internal?: boolean | undefined;
179
- attentionReason?: "finished" | "error" | "permission" | null | undefined;
180
- title?: string | null | undefined;
181
- persistence?: {
182
- provider: string;
183
- sessionId: string;
184
- metadata?: Record<string, any> | undefined;
185
- nativeHandle?: any;
186
- } | null | undefined;
187
- lastActivityAt?: string | undefined;
188
- lastUserMessageAt?: string | null | undefined;
189
- lastModeId?: string | null | undefined;
190
- config?: {
191
- modeId?: string | null | undefined;
192
- model?: string | null | undefined;
193
- thinkingOptionId?: string | null | undefined;
194
- featureValues?: Record<string, unknown> | null | undefined;
195
- extra?: Record<string, any> | null | undefined;
196
- systemPrompt?: string | null | undefined;
197
- mcpServers?: Record<string, any> | null | undefined;
198
- } | null | undefined;
199
- runtimeInfo?: {
200
- provider: string;
201
- sessionId: string | null;
202
- modeId?: string | null | undefined;
203
- model?: string | null | undefined;
204
- thinkingOptionId?: string | null | undefined;
205
- extra?: Record<string, unknown> | undefined;
206
- } | undefined;
207
- features?: ({
208
- value: boolean;
209
- type: "toggle";
210
- id: string;
211
- label: string;
212
- description?: string | undefined;
213
- icon?: string | undefined;
214
- tooltip?: string | undefined;
215
- } | {
216
- value: string | null;
217
- options: {
218
- id: string;
219
- label: string;
220
- description?: string | undefined;
221
- metadata?: Record<string, unknown> | undefined;
222
- isDefault?: boolean | undefined;
223
- }[];
224
- type: "select";
225
- id: string;
226
- label: string;
227
- description?: string | undefined;
228
- icon?: string | undefined;
229
- tooltip?: string | undefined;
230
- })[] | undefined;
231
- lastError?: string | null | undefined;
232
- requiresAttention?: boolean | undefined;
233
- attentionTimestamp?: string | null | undefined;
234
- archivedAt?: string | null | undefined;
235
- }, {
236
- cwd: string;
237
- id: string;
238
- provider: string;
239
- createdAt: string;
240
- updatedAt: string;
241
- workspaceId?: string | undefined;
242
- internal?: boolean | undefined;
243
- attentionReason?: "finished" | "error" | "permission" | null | undefined;
244
- title?: string | null | undefined;
245
- persistence?: {
246
- provider: string;
247
- sessionId: string;
248
- metadata?: Record<string, any> | undefined;
249
- nativeHandle?: any;
250
- } | null | undefined;
251
- lastActivityAt?: string | undefined;
252
- lastUserMessageAt?: string | null | undefined;
253
- labels?: Record<string, string> | undefined;
254
- lastStatus?: "error" | "idle" | "running" | "initializing" | "closed" | undefined;
255
- lastModeId?: string | null | undefined;
256
- config?: {
257
- modeId?: string | null | undefined;
258
- model?: string | null | undefined;
259
- thinkingOptionId?: string | null | undefined;
260
- featureValues?: Record<string, unknown> | null | undefined;
261
- extra?: Record<string, any> | null | undefined;
262
- systemPrompt?: string | null | undefined;
263
- mcpServers?: Record<string, any> | null | undefined;
264
- } | null | undefined;
265
- runtimeInfo?: {
266
- provider: string;
267
- sessionId: string | null;
268
- modeId?: string | null | undefined;
269
- model?: string | null | undefined;
270
- thinkingOptionId?: string | null | undefined;
271
- extra?: Record<string, unknown> | undefined;
272
- } | undefined;
273
- features?: ({
274
- value: boolean;
275
- type: "toggle";
276
- id: string;
277
- label: string;
278
- description?: string | undefined;
279
- icon?: string | undefined;
280
- tooltip?: string | undefined;
281
- } | {
282
- value: string | null;
283
- options: {
284
- id: string;
285
- label: string;
286
- description?: string | undefined;
287
- metadata?: Record<string, unknown> | undefined;
288
- isDefault?: boolean | undefined;
289
- }[];
290
- type: "select";
291
- id: string;
292
- label: string;
293
- description?: string | undefined;
294
- icon?: string | undefined;
295
- tooltip?: string | undefined;
296
- })[] | undefined;
297
- lastError?: string | null | undefined;
298
- requiresAttention?: boolean | undefined;
299
- attentionTimestamp?: string | null | undefined;
300
- archivedAt?: string | null | undefined;
301
- }>;
81
+ }, z.core.$strip>;
302
82
  export type SerializableAgentConfig = Pick<AgentSessionConfig, "modeId" | "model" | "thinkingOptionId" | "featureValues" | "extra" | "systemPrompt" | "mcpServers">;
303
83
  export type StoredAgentRecord = z.infer<typeof STORED_AGENT_SCHEMA>;
304
84
  export declare function parseStoredAgentRecord(value: unknown): StoredAgentRecord;
@@ -9,10 +9,10 @@ const SERIALIZABLE_CONFIG_SCHEMA = z
9
9
  modeId: z.string().nullable().optional(),
10
10
  model: z.string().nullable().optional(),
11
11
  thinkingOptionId: z.string().nullable().optional(),
12
- featureValues: z.record(z.unknown()).nullable().optional(),
13
- extra: z.record(z.any()).nullable().optional(),
12
+ featureValues: z.record(z.string(), z.unknown()).nullable().optional(),
13
+ extra: z.record(z.string(), z.any()).nullable().optional(),
14
14
  systemPrompt: z.string().nullable().optional(),
15
- mcpServers: z.record(z.any()).nullable().optional(),
15
+ mcpServers: z.record(z.string(), z.any()).nullable().optional(),
16
16
  })
17
17
  .nullable()
18
18
  .optional();
@@ -21,7 +21,7 @@ const PERSISTENCE_HANDLE_SCHEMA = z
21
21
  provider: z.string(),
22
22
  sessionId: z.string(),
23
23
  nativeHandle: z.any().optional(),
24
- metadata: z.record(z.any()).optional(),
24
+ metadata: z.record(z.string(), z.any()).optional(),
25
25
  })
26
26
  .nullable()
27
27
  .optional();
@@ -35,7 +35,7 @@ const STORED_AGENT_SCHEMA = z.object({
35
35
  lastActivityAt: z.string().optional(),
36
36
  lastUserMessageAt: z.string().nullable().optional(),
37
37
  title: z.string().nullable().optional(),
38
- labels: z.record(z.string()).default({}),
38
+ labels: z.record(z.string(), z.string()).default({}),
39
39
  lastStatus: AgentStatusSchema.default("closed"),
40
40
  lastModeId: z.string().nullable().optional(),
41
41
  config: SERIALIZABLE_CONFIG_SCHEMA,
@@ -46,7 +46,7 @@ const STORED_AGENT_SCHEMA = z.object({
46
46
  model: z.string().nullable().optional(),
47
47
  thinkingOptionId: z.string().nullable().optional(),
48
48
  modeId: z.string().nullable().optional(),
49
- extra: z.record(z.unknown()).optional(),
49
+ extra: z.record(z.string(), z.unknown()).optional(),
50
50
  })
51
51
  .optional(),
52
52
  features: z.array(AgentFeatureSchema).optional(),
@@ -59,7 +59,9 @@ function formatStructuredContentForModel(structuredContent) {
59
59
  return summary.length > 0 ? `${summary.join("\n")}\n\n${json}` : json;
60
60
  }
61
61
  function isZodSchema(value) {
62
- return (typeof value === "object" && value !== null && "_def" in value && "safeParseAsync" in value);
62
+ return (typeof value === "object" &&
63
+ value !== null &&
64
+ typeof value.safeParseAsync === "function");
63
65
  }
64
66
  function relaxMcpOutputSchema(outputSchema) {
65
67
  if (!outputSchema) {
@@ -468,7 +470,7 @@ export async function createAgentMcpServer(options) {
468
470
  modeId: z.string().optional().describe("Session mode to configure before the first run."),
469
471
  thinkingOptionId: z.string().optional().describe("Thinking option ID."),
470
472
  features: z
471
- .record(z.unknown())
473
+ .record(z.string(), z.unknown())
472
474
  .optional()
473
475
  .describe("Provider-specific feature values, for example { fast_mode: true } for Codex."),
474
476
  })
@@ -483,7 +485,7 @@ export async function createAgentMcpServer(options) {
483
485
  .optional()
484
486
  .describe("Thinking option ID. Pass null to clear."),
485
487
  features: z
486
- .record(z.unknown())
488
+ .record(z.string(), z.unknown())
487
489
  .optional()
488
490
  .describe("Provider-specific feature values, for example { fast_mode: true } for Codex."),
489
491
  })
@@ -493,7 +495,10 @@ export async function createAgentMcpServer(options) {
493
495
  modeId: z.string().optional().describe("Draft session mode ID."),
494
496
  model: z.string().optional().describe("Draft model ID."),
495
497
  thinkingOptionId: z.string().optional().describe("Draft thinking option ID."),
496
- features: z.record(z.unknown()).optional().describe("Draft provider feature values."),
498
+ features: z
499
+ .record(z.string(), z.unknown())
500
+ .optional()
501
+ .describe("Draft provider feature values."),
497
502
  })
498
503
  .strict();
499
504
  const agentToAgentInputSchema = {