@getpaseo/server 0.1.97-beta.3 → 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 (33) 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/providers/claude/project-dir.js +9 -6
  8. package/dist/server/server/agent/providers/claude/task-notification-tool-call.d.ts +2 -22
  9. package/dist/server/server/agent/providers/codex/app-server-transport.d.ts +8 -118
  10. package/dist/server/server/agent/providers/generic-acp-agent.d.ts +1 -5
  11. package/dist/server/server/agent/providers/pi/agent.d.ts +1 -5
  12. package/dist/server/server/agent/providers/tool-call-detail-primitives.d.ts +391 -1261
  13. package/dist/server/server/agent/providers/tool-call-detail-primitives.js +26 -16
  14. package/dist/server/server/loop-service.d.ts +60 -359
  15. package/dist/server/server/migrations/backfill-workspace-id.migration.js +10 -6
  16. package/dist/server/server/package-version.d.ts +1 -7
  17. package/dist/server/server/paseo-worktree-service.js +15 -1
  18. package/dist/server/server/persisted-config.d.ts +138 -1009
  19. package/dist/server/server/persisted-config.js +1 -1
  20. package/dist/server/server/pid-lock.d.ts +1 -15
  21. package/dist/server/server/session.d.ts +6 -0
  22. package/dist/server/server/session.js +195 -25
  23. package/dist/server/server/speech/providers/local/sherpa/model-catalog.d.ts +2 -2
  24. package/dist/server/server/speech/speech-types.d.ts +9 -11
  25. package/dist/server/server/websocket-server.js +4 -0
  26. package/dist/server/server/workspace-registry.d.ts +17 -48
  27. package/dist/server/server/workspace-registry.js +9 -0
  28. package/dist/server/terminal/terminal-session-controller.d.ts +8 -0
  29. package/dist/server/terminal/terminal-session-controller.js +23 -3
  30. package/dist/server/utils/checkout-git.js +36 -76
  31. package/dist/server/utils/worktree-metadata.d.ts +7 -59
  32. package/dist/src/server/persisted-config.js +1 -1
  33. package/package.json +9 -9
@@ -370,7 +370,10 @@ const ToolReadOutputPathSchema = z.union([
370
370
  })),
371
371
  ]);
372
372
  export const ToolReadOutputSchema = ToolReadOutputContentSchema;
373
- export const ToolReadOutputWithPathSchema = z.union([ToolReadOutputContentSchema, ToolReadOutputPathSchema]);
373
+ export const ToolReadOutputWithPathSchema = z.union([
374
+ ToolReadOutputContentSchema,
375
+ ToolReadOutputPathSchema,
376
+ ]);
374
377
  export const ToolWriteContentSchema = z
375
378
  .object({
376
379
  content: z.string().optional(),
@@ -735,34 +738,41 @@ export function toFetchToolDetail(input, output) {
735
738
  };
736
739
  }
737
740
  export function toolDetailBranchByName(name, inputSchema, outputSchema, mapper) {
738
- const schema = z.object({
741
+ const shape = {
739
742
  name: z.literal(name),
740
- input: inputSchema.nullable(),
741
- output: outputSchema.nullable(),
742
- });
743
+ input: z.nullable(inputSchema),
744
+ output: z.nullable(outputSchema),
745
+ };
746
+ const schema = z.object(shape);
743
747
  return schema.transform((value) => {
744
- return mapper(value.input, value.output);
748
+ // Zod v4 drops generic unknown-valued shape fields from object output inference here.
749
+ const parsedValue = value;
750
+ return mapper(parsedValue.input, parsedValue.output);
745
751
  });
746
752
  }
747
753
  export function toolDetailBranchByToolName(toolName, inputSchema, outputSchema, mapper) {
748
- const schema = z.object({
754
+ const shape = {
749
755
  toolName: z.literal(toolName),
750
- input: inputSchema.nullable(),
751
- output: outputSchema.nullable(),
752
- });
756
+ input: z.nullable(inputSchema),
757
+ output: z.nullable(outputSchema),
758
+ };
759
+ const schema = z.object(shape);
753
760
  return schema.transform((value) => {
754
- return mapper(value.input, value.output);
761
+ const parsedValue = value;
762
+ return mapper(parsedValue.input, parsedValue.output);
755
763
  });
756
764
  }
757
765
  export function toolDetailBranchByNameWithCwd(name, inputSchema, outputSchema, mapper) {
758
- const schema = z.object({
766
+ const shape = {
759
767
  name: z.literal(name),
760
- input: inputSchema.nullable(),
761
- output: outputSchema.nullable(),
768
+ input: z.nullable(inputSchema),
769
+ output: z.nullable(outputSchema),
762
770
  cwd: z.string().optional().nullable(),
763
- });
771
+ };
772
+ const schema = z.object(shape);
764
773
  return schema.transform((value) => {
765
- return mapper(value.input, value.output, value.cwd ?? null);
774
+ const parsedValue = value;
775
+ return mapper(parsedValue.input, parsedValue.output, parsedValue.cwd ?? null);
766
776
  });
767
777
  }
768
778
  //# sourceMappingURL=tool-call-detail-primitives.js.map
@@ -7,24 +7,18 @@ declare const LoopLogEntrySchema: z.ZodObject<{
7
7
  seq: z.ZodNumber;
8
8
  timestamp: z.ZodString;
9
9
  iteration: z.ZodNullable<z.ZodNumber>;
10
- source: z.ZodEnum<["loop", "worker", "verifier", "verify-check"]>;
11
- level: z.ZodEnum<["info", "error"]>;
10
+ source: z.ZodEnum<{
11
+ loop: "loop";
12
+ worker: "worker";
13
+ verifier: "verifier";
14
+ "verify-check": "verify-check";
15
+ }>;
16
+ level: z.ZodEnum<{
17
+ error: "error";
18
+ info: "info";
19
+ }>;
12
20
  text: z.ZodString;
13
- }, "strip", z.ZodTypeAny, {
14
- text: string;
15
- level: "error" | "info";
16
- seq: number;
17
- timestamp: string;
18
- source: "loop" | "worker" | "verifier" | "verify-check";
19
- iteration: number | null;
20
- }, {
21
- text: string;
22
- level: "error" | "info";
23
- seq: number;
24
- timestamp: string;
25
- source: "loop" | "worker" | "verifier" | "verify-check";
26
- iteration: number | null;
27
- }>;
21
+ }, z.core.$strip>;
28
22
  declare const LoopVerifyCheckResultSchema: z.ZodObject<{
29
23
  command: z.ZodString;
30
24
  exitCode: z.ZodNumber;
@@ -33,50 +27,31 @@ declare const LoopVerifyCheckResultSchema: z.ZodObject<{
33
27
  stderr: z.ZodString;
34
28
  startedAt: z.ZodString;
35
29
  completedAt: z.ZodString;
36
- }, "strip", z.ZodTypeAny, {
37
- stdout: string;
38
- exitCode: number;
39
- command: string;
40
- stderr: string;
41
- startedAt: string;
42
- completedAt: string;
43
- passed: boolean;
44
- }, {
45
- stdout: string;
46
- exitCode: number;
47
- command: string;
48
- stderr: string;
49
- startedAt: string;
50
- completedAt: string;
51
- passed: boolean;
52
- }>;
30
+ }, z.core.$strip>;
53
31
  declare const LoopVerifyPromptResultSchema: z.ZodObject<{
54
32
  passed: z.ZodBoolean;
55
33
  reason: z.ZodString;
56
34
  verifierAgentId: z.ZodNullable<z.ZodString>;
57
35
  startedAt: z.ZodString;
58
36
  completedAt: z.ZodString;
59
- }, "strip", z.ZodTypeAny, {
60
- startedAt: string;
61
- completedAt: string;
62
- reason: string;
63
- passed: boolean;
64
- verifierAgentId: string | null;
65
- }, {
66
- startedAt: string;
67
- completedAt: string;
68
- reason: string;
69
- passed: boolean;
70
- verifierAgentId: string | null;
71
- }>;
37
+ }, z.core.$strip>;
72
38
  declare const LoopIterationRecordSchema: z.ZodObject<{
73
39
  index: z.ZodNumber;
74
40
  workerAgentId: z.ZodNullable<z.ZodString>;
75
41
  workerStartedAt: z.ZodString;
76
42
  workerCompletedAt: z.ZodNullable<z.ZodString>;
77
43
  verifierAgentId: z.ZodNullable<z.ZodString>;
78
- status: z.ZodEnum<["running", "succeeded", "failed", "stopped"]>;
79
- workerOutcome: z.ZodNullable<z.ZodEnum<["completed", "failed", "canceled"]>>;
44
+ status: z.ZodEnum<{
45
+ running: "running";
46
+ failed: "failed";
47
+ succeeded: "succeeded";
48
+ stopped: "stopped";
49
+ }>;
50
+ workerOutcome: z.ZodNullable<z.ZodEnum<{
51
+ completed: "completed";
52
+ failed: "failed";
53
+ canceled: "canceled";
54
+ }>>;
80
55
  failureReason: z.ZodNullable<z.ZodString>;
81
56
  verifyChecks: z.ZodArray<z.ZodObject<{
82
57
  command: z.ZodString;
@@ -86,93 +61,15 @@ declare const LoopIterationRecordSchema: z.ZodObject<{
86
61
  stderr: z.ZodString;
87
62
  startedAt: z.ZodString;
88
63
  completedAt: z.ZodString;
89
- }, "strip", z.ZodTypeAny, {
90
- stdout: string;
91
- exitCode: number;
92
- command: string;
93
- stderr: string;
94
- startedAt: string;
95
- completedAt: string;
96
- passed: boolean;
97
- }, {
98
- stdout: string;
99
- exitCode: number;
100
- command: string;
101
- stderr: string;
102
- startedAt: string;
103
- completedAt: string;
104
- passed: boolean;
105
- }>, "many">;
64
+ }, z.core.$strip>>;
106
65
  verifyPrompt: z.ZodNullable<z.ZodObject<{
107
66
  passed: z.ZodBoolean;
108
67
  reason: z.ZodString;
109
68
  verifierAgentId: z.ZodNullable<z.ZodString>;
110
69
  startedAt: z.ZodString;
111
70
  completedAt: z.ZodString;
112
- }, "strip", z.ZodTypeAny, {
113
- startedAt: string;
114
- completedAt: string;
115
- reason: string;
116
- passed: boolean;
117
- verifierAgentId: string | null;
118
- }, {
119
- startedAt: string;
120
- completedAt: string;
121
- reason: string;
122
- passed: boolean;
123
- verifierAgentId: string | null;
124
- }>>;
125
- }, "strip", z.ZodTypeAny, {
126
- status: "running" | "failed" | "succeeded" | "stopped";
127
- index: number;
128
- verifierAgentId: string | null;
129
- workerAgentId: string | null;
130
- workerStartedAt: string;
131
- workerCompletedAt: string | null;
132
- workerOutcome: "completed" | "failed" | "canceled" | null;
133
- failureReason: string | null;
134
- verifyChecks: {
135
- stdout: string;
136
- exitCode: number;
137
- command: string;
138
- stderr: string;
139
- startedAt: string;
140
- completedAt: string;
141
- passed: boolean;
142
- }[];
143
- verifyPrompt: {
144
- startedAt: string;
145
- completedAt: string;
146
- reason: string;
147
- passed: boolean;
148
- verifierAgentId: string | null;
149
- } | null;
150
- }, {
151
- status: "running" | "failed" | "succeeded" | "stopped";
152
- index: number;
153
- verifierAgentId: string | null;
154
- workerAgentId: string | null;
155
- workerStartedAt: string;
156
- workerCompletedAt: string | null;
157
- workerOutcome: "completed" | "failed" | "canceled" | null;
158
- failureReason: string | null;
159
- verifyChecks: {
160
- stdout: string;
161
- exitCode: number;
162
- command: string;
163
- stderr: string;
164
- startedAt: string;
165
- completedAt: string;
166
- passed: boolean;
167
- }[];
168
- verifyPrompt: {
169
- startedAt: string;
170
- completedAt: string;
171
- reason: string;
172
- passed: boolean;
173
- verifierAgentId: string | null;
174
- } | null;
175
- }>;
71
+ }, z.core.$strip>>;
72
+ }, z.core.$strip>;
176
73
  declare const LoopRecordSchema: z.ZodObject<{
177
74
  id: z.ZodString;
178
75
  name: z.ZodNullable<z.ZodString>;
@@ -187,12 +84,17 @@ declare const LoopRecordSchema: z.ZodObject<{
187
84
  verifierModel: z.ZodNullable<z.ZodString>;
188
85
  verifierModeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
189
86
  verifyPrompt: z.ZodNullable<z.ZodString>;
190
- verifyChecks: z.ZodArray<z.ZodString, "many">;
87
+ verifyChecks: z.ZodArray<z.ZodString>;
191
88
  archive: z.ZodBoolean;
192
89
  sleepMs: z.ZodNumber;
193
90
  maxIterations: z.ZodNullable<z.ZodNumber>;
194
91
  maxTimeMs: z.ZodNullable<z.ZodNumber>;
195
- status: z.ZodEnum<["running", "succeeded", "failed", "stopped"]>;
92
+ status: z.ZodEnum<{
93
+ running: "running";
94
+ failed: "failed";
95
+ succeeded: "succeeded";
96
+ stopped: "stopped";
97
+ }>;
196
98
  createdAt: z.ZodString;
197
99
  updatedAt: z.ZodString;
198
100
  startedAt: z.ZodString;
@@ -204,8 +106,17 @@ declare const LoopRecordSchema: z.ZodObject<{
204
106
  workerStartedAt: z.ZodString;
205
107
  workerCompletedAt: z.ZodNullable<z.ZodString>;
206
108
  verifierAgentId: z.ZodNullable<z.ZodString>;
207
- status: z.ZodEnum<["running", "succeeded", "failed", "stopped"]>;
208
- workerOutcome: z.ZodNullable<z.ZodEnum<["completed", "failed", "canceled"]>>;
109
+ status: z.ZodEnum<{
110
+ running: "running";
111
+ failed: "failed";
112
+ succeeded: "succeeded";
113
+ stopped: "stopped";
114
+ }>;
115
+ workerOutcome: z.ZodNullable<z.ZodEnum<{
116
+ completed: "completed";
117
+ failed: "failed";
118
+ canceled: "canceled";
119
+ }>>;
209
120
  failureReason: z.ZodNullable<z.ZodString>;
210
121
  verifyChecks: z.ZodArray<z.ZodObject<{
211
122
  command: z.ZodString;
@@ -215,246 +126,36 @@ declare const LoopRecordSchema: z.ZodObject<{
215
126
  stderr: z.ZodString;
216
127
  startedAt: z.ZodString;
217
128
  completedAt: z.ZodString;
218
- }, "strip", z.ZodTypeAny, {
219
- stdout: string;
220
- exitCode: number;
221
- command: string;
222
- stderr: string;
223
- startedAt: string;
224
- completedAt: string;
225
- passed: boolean;
226
- }, {
227
- stdout: string;
228
- exitCode: number;
229
- command: string;
230
- stderr: string;
231
- startedAt: string;
232
- completedAt: string;
233
- passed: boolean;
234
- }>, "many">;
129
+ }, z.core.$strip>>;
235
130
  verifyPrompt: z.ZodNullable<z.ZodObject<{
236
131
  passed: z.ZodBoolean;
237
132
  reason: z.ZodString;
238
133
  verifierAgentId: z.ZodNullable<z.ZodString>;
239
134
  startedAt: z.ZodString;
240
135
  completedAt: z.ZodString;
241
- }, "strip", z.ZodTypeAny, {
242
- startedAt: string;
243
- completedAt: string;
244
- reason: string;
245
- passed: boolean;
246
- verifierAgentId: string | null;
247
- }, {
248
- startedAt: string;
249
- completedAt: string;
250
- reason: string;
251
- passed: boolean;
252
- verifierAgentId: string | null;
253
- }>>;
254
- }, "strip", z.ZodTypeAny, {
255
- status: "running" | "failed" | "succeeded" | "stopped";
256
- index: number;
257
- verifierAgentId: string | null;
258
- workerAgentId: string | null;
259
- workerStartedAt: string;
260
- workerCompletedAt: string | null;
261
- workerOutcome: "completed" | "failed" | "canceled" | null;
262
- failureReason: string | null;
263
- verifyChecks: {
264
- stdout: string;
265
- exitCode: number;
266
- command: string;
267
- stderr: string;
268
- startedAt: string;
269
- completedAt: string;
270
- passed: boolean;
271
- }[];
272
- verifyPrompt: {
273
- startedAt: string;
274
- completedAt: string;
275
- reason: string;
276
- passed: boolean;
277
- verifierAgentId: string | null;
278
- } | null;
279
- }, {
280
- status: "running" | "failed" | "succeeded" | "stopped";
281
- index: number;
282
- verifierAgentId: string | null;
283
- workerAgentId: string | null;
284
- workerStartedAt: string;
285
- workerCompletedAt: string | null;
286
- workerOutcome: "completed" | "failed" | "canceled" | null;
287
- failureReason: string | null;
288
- verifyChecks: {
289
- stdout: string;
290
- exitCode: number;
291
- command: string;
292
- stderr: string;
293
- startedAt: string;
294
- completedAt: string;
295
- passed: boolean;
296
- }[];
297
- verifyPrompt: {
298
- startedAt: string;
299
- completedAt: string;
300
- reason: string;
301
- passed: boolean;
302
- verifierAgentId: string | null;
303
- } | null;
304
- }>, "many">;
136
+ }, z.core.$strip>>;
137
+ }, z.core.$strip>>;
305
138
  logs: z.ZodArray<z.ZodObject<{
306
139
  seq: z.ZodNumber;
307
140
  timestamp: z.ZodString;
308
141
  iteration: z.ZodNullable<z.ZodNumber>;
309
- source: z.ZodEnum<["loop", "worker", "verifier", "verify-check"]>;
310
- level: z.ZodEnum<["info", "error"]>;
142
+ source: z.ZodEnum<{
143
+ loop: "loop";
144
+ worker: "worker";
145
+ verifier: "verifier";
146
+ "verify-check": "verify-check";
147
+ }>;
148
+ level: z.ZodEnum<{
149
+ error: "error";
150
+ info: "info";
151
+ }>;
311
152
  text: z.ZodString;
312
- }, "strip", z.ZodTypeAny, {
313
- text: string;
314
- level: "error" | "info";
315
- seq: number;
316
- timestamp: string;
317
- source: "loop" | "worker" | "verifier" | "verify-check";
318
- iteration: number | null;
319
- }, {
320
- text: string;
321
- level: "error" | "info";
322
- seq: number;
323
- timestamp: string;
324
- source: "loop" | "worker" | "verifier" | "verify-check";
325
- iteration: number | null;
326
- }>, "many">;
153
+ }, z.core.$strip>>;
327
154
  nextLogSeq: z.ZodNumber;
328
155
  activeIteration: z.ZodNullable<z.ZodNumber>;
329
156
  activeWorkerAgentId: z.ZodNullable<z.ZodString>;
330
157
  activeVerifierAgentId: z.ZodNullable<z.ZodString>;
331
- }, "strip", z.ZodTypeAny, {
332
- cwd: string;
333
- name: string | null;
334
- id: string;
335
- status: "running" | "failed" | "succeeded" | "stopped";
336
- provider: string;
337
- createdAt: string;
338
- updatedAt: string;
339
- modeId: string | null;
340
- model: string | null;
341
- startedAt: string;
342
- completedAt: string | null;
343
- prompt: string;
344
- iterations: {
345
- status: "running" | "failed" | "succeeded" | "stopped";
346
- index: number;
347
- verifierAgentId: string | null;
348
- workerAgentId: string | null;
349
- workerStartedAt: string;
350
- workerCompletedAt: string | null;
351
- workerOutcome: "completed" | "failed" | "canceled" | null;
352
- failureReason: string | null;
353
- verifyChecks: {
354
- stdout: string;
355
- exitCode: number;
356
- command: string;
357
- stderr: string;
358
- startedAt: string;
359
- completedAt: string;
360
- passed: boolean;
361
- }[];
362
- verifyPrompt: {
363
- startedAt: string;
364
- completedAt: string;
365
- reason: string;
366
- passed: boolean;
367
- verifierAgentId: string | null;
368
- } | null;
369
- }[];
370
- verifyChecks: string[];
371
- verifyPrompt: string | null;
372
- workerProvider: string | null;
373
- workerModel: string | null;
374
- verifierProvider: string | null;
375
- verifierModel: string | null;
376
- verifierModeId: string | null;
377
- archive: boolean;
378
- sleepMs: number;
379
- maxIterations: number | null;
380
- maxTimeMs: number | null;
381
- stopRequestedAt: string | null;
382
- logs: {
383
- text: string;
384
- level: "error" | "info";
385
- seq: number;
386
- timestamp: string;
387
- source: "loop" | "worker" | "verifier" | "verify-check";
388
- iteration: number | null;
389
- }[];
390
- nextLogSeq: number;
391
- activeIteration: number | null;
392
- activeWorkerAgentId: string | null;
393
- activeVerifierAgentId: string | null;
394
- }, {
395
- cwd: string;
396
- name: string | null;
397
- id: string;
398
- status: "running" | "failed" | "succeeded" | "stopped";
399
- provider: string;
400
- createdAt: string;
401
- updatedAt: string;
402
- model: string | null;
403
- startedAt: string;
404
- completedAt: string | null;
405
- prompt: string;
406
- iterations: {
407
- status: "running" | "failed" | "succeeded" | "stopped";
408
- index: number;
409
- verifierAgentId: string | null;
410
- workerAgentId: string | null;
411
- workerStartedAt: string;
412
- workerCompletedAt: string | null;
413
- workerOutcome: "completed" | "failed" | "canceled" | null;
414
- failureReason: string | null;
415
- verifyChecks: {
416
- stdout: string;
417
- exitCode: number;
418
- command: string;
419
- stderr: string;
420
- startedAt: string;
421
- completedAt: string;
422
- passed: boolean;
423
- }[];
424
- verifyPrompt: {
425
- startedAt: string;
426
- completedAt: string;
427
- reason: string;
428
- passed: boolean;
429
- verifierAgentId: string | null;
430
- } | null;
431
- }[];
432
- verifyChecks: string[];
433
- verifyPrompt: string | null;
434
- workerProvider: string | null;
435
- workerModel: string | null;
436
- verifierProvider: string | null;
437
- verifierModel: string | null;
438
- archive: boolean;
439
- sleepMs: number;
440
- maxIterations: number | null;
441
- maxTimeMs: number | null;
442
- stopRequestedAt: string | null;
443
- logs: {
444
- text: string;
445
- level: "error" | "info";
446
- seq: number;
447
- timestamp: string;
448
- source: "loop" | "worker" | "verifier" | "verify-check";
449
- iteration: number | null;
450
- }[];
451
- nextLogSeq: number;
452
- activeIteration: number | null;
453
- activeWorkerAgentId: string | null;
454
- activeVerifierAgentId: string | null;
455
- modeId?: string | null | undefined;
456
- verifierModeId?: string | null | undefined;
457
- }>;
158
+ }, z.core.$strip>;
458
159
  export type LoopStatus = z.infer<typeof LoopRecordSchema>["status"];
459
160
  export type LoopLogEntry = z.infer<typeof LoopLogEntrySchema>;
460
161
  export type LoopVerifyCheckResult = z.infer<typeof LoopVerifyCheckResultSchema>;
@@ -12,16 +12,18 @@ import { resolve, sep } from "node:path";
12
12
  // Picks the workspace that owned `cwd` for a legacy, unstamped agent record.
13
13
  // Prefers an exact-cwd workspace (oldest wins) and otherwise attributes to the
14
14
  // deepest enclosing workspace directory, never letting the home directory own
15
- // descendants. Used only by the one-time backfill below.
16
- function resolveLegacyWorkspaceOwner(cwd, workspaces) {
15
+ // descendants. Live records only consider live workspaces; archived records can
16
+ // resolve to archived workspaces so History/restore retains legacy ownership.
17
+ // Used only by the one-time backfill below.
18
+ function resolveLegacyWorkspaceOwner(cwd, workspaces, options) {
17
19
  const normalizedCwd = resolve(cwd);
18
20
  const userHome = resolve(homedir());
19
- const activeWorkspaces = Array.from(workspaces).filter((workspace) => !workspace.archivedAt);
20
- const exactMatches = activeWorkspaces.filter((workspace) => resolve(workspace.cwd) === normalizedCwd);
21
+ const candidateWorkspaces = Array.from(workspaces).filter((workspace) => options?.includeArchived === true || !workspace.archivedAt);
22
+ const exactMatches = candidateWorkspaces.filter((workspace) => resolve(workspace.cwd) === normalizedCwd);
21
23
  if (exactMatches.length > 0) {
22
24
  return oldestWorkspace(exactMatches).workspaceId;
23
25
  }
24
- const prefixMatches = activeWorkspaces.filter((workspace) => {
26
+ const prefixMatches = candidateWorkspaces.filter((workspace) => {
25
27
  const workspaceCwd = resolve(workspace.cwd);
26
28
  if (workspaceCwd === userHome) {
27
29
  return false;
@@ -45,7 +47,9 @@ export async function backfillWorkspaceIdForLegacyAgents(options) {
45
47
  if (record.workspaceId) {
46
48
  continue;
47
49
  }
48
- const workspaceId = resolveLegacyWorkspaceOwner(record.cwd, workspaceRecords);
50
+ const workspaceId = resolveLegacyWorkspaceOwner(record.cwd, workspaceRecords, {
51
+ includeArchived: record.archivedAt != null,
52
+ });
49
53
  if (!workspaceId) {
50
54
  continue;
51
55
  }
@@ -6,13 +6,7 @@ interface ResolvePackageVersionParams {
6
6
  export declare const packageJsonSchema: z.ZodObject<{
7
7
  name: z.ZodOptional<z.ZodString>;
8
8
  version: z.ZodOptional<z.ZodString>;
9
- }, "strip", z.ZodTypeAny, {
10
- name?: string | undefined;
11
- version?: string | undefined;
12
- }, {
13
- name?: string | undefined;
14
- version?: string | undefined;
15
- }>;
9
+ }, z.core.$strip>;
16
10
  export type PackageJson = z.infer<typeof packageJsonSchema>;
17
11
  export declare class PackageVersionResolutionError extends Error {
18
12
  constructor(params: {
@@ -4,7 +4,7 @@ import { classifyDirectoryForProjectMembership, deriveProjectGroupingName, gener
4
4
  import { createWorktreeCore, } from "./worktree-core.js";
5
5
  import { validateBranchSlug } from "../utils/worktree.js";
6
6
  import { getCurrentBranch, localBranchExists, renameCurrentBranch } from "../utils/checkout-git.js";
7
- import { markPaseoWorktreeFirstAgentBranchAutoNameAttempted, readPaseoWorktreeMetadata, writePaseoWorktreeFirstAgentBranchAutoNameMetadata, } from "../utils/worktree-metadata.js";
7
+ import { markPaseoWorktreeFirstAgentBranchAutoNameAttempted, normalizeBaseRefName, readPaseoWorktreeMetadata, writePaseoWorktreeFirstAgentBranchAutoNameMetadata, } from "../utils/worktree-metadata.js";
8
8
  import { resolveFirstAgentPromptTitle } from "./agent/create-agent-title.js";
9
9
  import { buildAgentBranchNameSeed } from "./agent/prompt-attachments.js";
10
10
  export async function createPaseoWorktree(input, deps) {
@@ -15,6 +15,7 @@ export async function createPaseoWorktree(input, deps) {
15
15
  projectId: input.projectId,
16
16
  repoRoot: createdWorktree.repoRoot,
17
17
  worktree: createdWorktree.worktree,
18
+ baseBranch: resolveIntentBaseBranch(createdWorktree.intent),
18
19
  title: resolveFirstAgentPromptTitle(input.firstAgentContext),
19
20
  deps,
20
21
  });
@@ -109,6 +110,18 @@ function maybeMarkFirstAgentBranchAutoNameEligible(options) {
109
110
  placeholderBranchName: createdWorktree.worktree.branchName,
110
111
  });
111
112
  }
113
+ // The base branch is normalized to match worktree.json's baseRefName (origin/
114
+ // stripped). checkout-branch worktrees have no distinct base, so they stay null.
115
+ function resolveIntentBaseBranch(intent) {
116
+ switch (intent.kind) {
117
+ case "branch-off":
118
+ return normalizeBaseRefName(intent.baseBranch);
119
+ case "checkout-github-pr":
120
+ return normalizeBaseRefName(intent.baseRefName);
121
+ case "checkout-branch":
122
+ return null;
123
+ }
124
+ }
112
125
  async function upsertWorkspaceForWorktree(options) {
113
126
  const normalizedCwd = resolve(options.worktree.worktreePath);
114
127
  const normalizedInputCwd = resolve(options.inputCwd);
@@ -142,6 +155,7 @@ async function upsertWorkspaceForWorktree(options) {
142
155
  kind: "worktree",
143
156
  displayName: options.worktree.branchName || normalizedCwd,
144
157
  branch: options.worktree.branchName || null,
158
+ baseBranch: options.baseBranch ?? null,
145
159
  title: options.title ?? null,
146
160
  createdAt: now,
147
161
  updatedAt: now,