@getpaseo/server 0.1.88 → 0.1.89
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.
- package/dist/server/server/agent/agent-manager.js +4 -1
- package/dist/server/server/agent/agent-storage.d.ts +22 -22
- package/dist/server/server/agent/create-agent/create.d.ts +2 -0
- package/dist/server/server/agent/create-agent/create.js +16 -5
- package/dist/server/server/agent/create-agent-lifecycle-dispatch.d.ts +1 -0
- package/dist/server/server/agent/create-agent-lifecycle-dispatch.js +4 -0
- package/dist/server/server/agent/mcp-server.d.ts +1 -0
- package/dist/server/server/agent/mcp-server.js +113 -70
- package/dist/server/server/agent/providers/pi/agent.js +13 -0
- package/dist/server/server/agent/providers/pi/rpc-types.d.ts +3 -0
- package/dist/server/server/auto-archive-on-merge/archive-if-safe.d.ts +1 -0
- package/dist/server/server/auto-archive-on-merge/archive-if-safe.js +6 -1
- package/dist/server/server/bootstrap.d.ts +7 -2
- package/dist/server/server/bootstrap.js +152 -115
- package/dist/server/server/config.js +41 -0
- package/dist/server/server/loop-service.d.ts +22 -22
- package/dist/server/server/package-version.d.ts +2 -2
- package/dist/server/server/paseo-worktree-archive-service.d.ts +2 -0
- package/dist/server/server/paseo-worktree-archive-service.js +28 -9
- package/dist/server/server/persisted-config.d.ts +84 -28
- package/dist/server/server/persisted-config.js +17 -0
- package/dist/server/server/pid-lock.d.ts +2 -2
- package/dist/server/server/script-health-monitor.d.ts +4 -4
- package/dist/server/server/script-health-monitor.js +6 -6
- package/dist/server/server/script-proxy.d.ts +2 -39
- package/dist/server/server/script-proxy.js +1 -244
- package/dist/server/server/script-route-branch-handler.d.ts +2 -2
- package/dist/server/server/script-route-branch-handler.js +3 -37
- package/dist/server/server/script-status-projection.d.ts +6 -4
- package/dist/server/server/script-status-projection.js +85 -37
- package/dist/server/server/service-proxy.d.ts +237 -0
- package/dist/server/server/service-proxy.js +714 -0
- package/dist/server/server/session.d.ts +7 -3
- package/dist/server/server/session.js +22 -10
- package/dist/server/server/websocket-server.d.ts +7 -4
- package/dist/server/server/websocket-server.js +9 -4
- package/dist/server/server/workspace-directory.js +4 -0
- package/dist/server/server/workspace-git-service.d.ts +3 -0
- package/dist/server/server/workspace-git-service.js +53 -12
- package/dist/server/server/workspace-registry.d.ts +2 -2
- package/dist/server/server/workspace-service-env.d.ts +1 -0
- package/dist/server/server/workspace-service-env.js +23 -18
- package/dist/server/server/worktree/commands.d.ts +2 -0
- package/dist/server/server/worktree/commands.js +4 -1
- package/dist/server/server/worktree-bootstrap.d.ts +4 -3
- package/dist/server/server/worktree-bootstrap.js +14 -13
- package/dist/server/server/worktree-core.d.ts +1 -0
- package/dist/server/server/worktree-core.js +2 -0
- package/dist/server/server/worktree-session.d.ts +6 -2
- package/dist/server/server/worktree-session.js +3 -0
- package/dist/server/services/github-service.d.ts +1 -0
- package/dist/server/services/github-service.js +7 -1
- package/dist/server/utils/checkout-git.d.ts +6 -2
- package/dist/server/utils/checkout-git.js +17 -7
- package/dist/server/utils/worktree.d.ts +17 -12
- package/dist/server/utils/worktree.js +39 -22
- package/dist/src/server/persisted-config.js +17 -0
- package/package.json +5 -5
- package/dist/server/utils/script-hostname.d.ts +0 -8
- package/dist/server/utils/script-hostname.js +0 -14
|
@@ -10,16 +10,16 @@ declare const LoopLogEntrySchema: z.ZodObject<{
|
|
|
10
10
|
level: z.ZodEnum<["info", "error"]>;
|
|
11
11
|
text: z.ZodString;
|
|
12
12
|
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
text: string;
|
|
13
14
|
level: "error" | "info";
|
|
14
15
|
source: "worker" | "loop" | "verifier" | "verify-check";
|
|
15
|
-
text: string;
|
|
16
16
|
timestamp: string;
|
|
17
17
|
seq: number;
|
|
18
18
|
iteration: number | null;
|
|
19
19
|
}, {
|
|
20
|
+
text: string;
|
|
20
21
|
level: "error" | "info";
|
|
21
22
|
source: "worker" | "loop" | "verifier" | "verify-check";
|
|
22
|
-
text: string;
|
|
23
23
|
timestamp: string;
|
|
24
24
|
seq: number;
|
|
25
25
|
iteration: number | null;
|
|
@@ -33,16 +33,16 @@ declare const LoopVerifyCheckResultSchema: z.ZodObject<{
|
|
|
33
33
|
startedAt: z.ZodString;
|
|
34
34
|
completedAt: z.ZodString;
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
command: string;
|
|
37
36
|
exitCode: number;
|
|
37
|
+
command: string;
|
|
38
38
|
stdout: string;
|
|
39
39
|
stderr: string;
|
|
40
40
|
startedAt: string;
|
|
41
41
|
completedAt: string;
|
|
42
42
|
passed: boolean;
|
|
43
43
|
}, {
|
|
44
|
-
command: string;
|
|
45
44
|
exitCode: number;
|
|
45
|
+
command: string;
|
|
46
46
|
stdout: string;
|
|
47
47
|
stderr: string;
|
|
48
48
|
startedAt: string;
|
|
@@ -86,16 +86,16 @@ declare const LoopIterationRecordSchema: z.ZodObject<{
|
|
|
86
86
|
startedAt: z.ZodString;
|
|
87
87
|
completedAt: z.ZodString;
|
|
88
88
|
}, "strip", z.ZodTypeAny, {
|
|
89
|
-
command: string;
|
|
90
89
|
exitCode: number;
|
|
90
|
+
command: string;
|
|
91
91
|
stdout: string;
|
|
92
92
|
stderr: string;
|
|
93
93
|
startedAt: string;
|
|
94
94
|
completedAt: string;
|
|
95
95
|
passed: boolean;
|
|
96
96
|
}, {
|
|
97
|
-
command: string;
|
|
98
97
|
exitCode: number;
|
|
98
|
+
command: string;
|
|
99
99
|
stdout: string;
|
|
100
100
|
stderr: string;
|
|
101
101
|
startedAt: string;
|
|
@@ -131,8 +131,8 @@ declare const LoopIterationRecordSchema: z.ZodObject<{
|
|
|
131
131
|
workerOutcome: "completed" | "failed" | "canceled" | null;
|
|
132
132
|
failureReason: string | null;
|
|
133
133
|
verifyChecks: {
|
|
134
|
-
command: string;
|
|
135
134
|
exitCode: number;
|
|
135
|
+
command: string;
|
|
136
136
|
stdout: string;
|
|
137
137
|
stderr: string;
|
|
138
138
|
startedAt: string;
|
|
@@ -156,8 +156,8 @@ declare const LoopIterationRecordSchema: z.ZodObject<{
|
|
|
156
156
|
workerOutcome: "completed" | "failed" | "canceled" | null;
|
|
157
157
|
failureReason: string | null;
|
|
158
158
|
verifyChecks: {
|
|
159
|
-
command: string;
|
|
160
159
|
exitCode: number;
|
|
160
|
+
command: string;
|
|
161
161
|
stdout: string;
|
|
162
162
|
stderr: string;
|
|
163
163
|
startedAt: string;
|
|
@@ -215,16 +215,16 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
215
215
|
startedAt: z.ZodString;
|
|
216
216
|
completedAt: z.ZodString;
|
|
217
217
|
}, "strip", z.ZodTypeAny, {
|
|
218
|
-
command: string;
|
|
219
218
|
exitCode: number;
|
|
219
|
+
command: string;
|
|
220
220
|
stdout: string;
|
|
221
221
|
stderr: string;
|
|
222
222
|
startedAt: string;
|
|
223
223
|
completedAt: string;
|
|
224
224
|
passed: boolean;
|
|
225
225
|
}, {
|
|
226
|
-
command: string;
|
|
227
226
|
exitCode: number;
|
|
227
|
+
command: string;
|
|
228
228
|
stdout: string;
|
|
229
229
|
stderr: string;
|
|
230
230
|
startedAt: string;
|
|
@@ -260,8 +260,8 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
260
260
|
workerOutcome: "completed" | "failed" | "canceled" | null;
|
|
261
261
|
failureReason: string | null;
|
|
262
262
|
verifyChecks: {
|
|
263
|
-
command: string;
|
|
264
263
|
exitCode: number;
|
|
264
|
+
command: string;
|
|
265
265
|
stdout: string;
|
|
266
266
|
stderr: string;
|
|
267
267
|
startedAt: string;
|
|
@@ -285,8 +285,8 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
285
285
|
workerOutcome: "completed" | "failed" | "canceled" | null;
|
|
286
286
|
failureReason: string | null;
|
|
287
287
|
verifyChecks: {
|
|
288
|
-
command: string;
|
|
289
288
|
exitCode: number;
|
|
289
|
+
command: string;
|
|
290
290
|
stdout: string;
|
|
291
291
|
stderr: string;
|
|
292
292
|
startedAt: string;
|
|
@@ -309,16 +309,16 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
309
309
|
level: z.ZodEnum<["info", "error"]>;
|
|
310
310
|
text: z.ZodString;
|
|
311
311
|
}, "strip", z.ZodTypeAny, {
|
|
312
|
+
text: string;
|
|
312
313
|
level: "error" | "info";
|
|
313
314
|
source: "worker" | "loop" | "verifier" | "verify-check";
|
|
314
|
-
text: string;
|
|
315
315
|
timestamp: string;
|
|
316
316
|
seq: number;
|
|
317
317
|
iteration: number | null;
|
|
318
318
|
}, {
|
|
319
|
+
text: string;
|
|
319
320
|
level: "error" | "info";
|
|
320
321
|
source: "worker" | "loop" | "verifier" | "verify-check";
|
|
321
|
-
text: string;
|
|
322
322
|
timestamp: string;
|
|
323
323
|
seq: number;
|
|
324
324
|
iteration: number | null;
|
|
@@ -328,12 +328,12 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
328
328
|
activeWorkerAgentId: z.ZodNullable<z.ZodString>;
|
|
329
329
|
activeVerifierAgentId: z.ZodNullable<z.ZodString>;
|
|
330
330
|
}, "strip", z.ZodTypeAny, {
|
|
331
|
-
status: "running" | "failed" | "succeeded" | "stopped";
|
|
332
331
|
cwd: string;
|
|
333
332
|
name: string | null;
|
|
334
|
-
createdAt: string;
|
|
335
333
|
id: string;
|
|
334
|
+
status: "running" | "failed" | "succeeded" | "stopped";
|
|
336
335
|
provider: string;
|
|
336
|
+
createdAt: string;
|
|
337
337
|
updatedAt: string;
|
|
338
338
|
modeId: string | null;
|
|
339
339
|
model: string | null;
|
|
@@ -350,8 +350,8 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
350
350
|
workerOutcome: "completed" | "failed" | "canceled" | null;
|
|
351
351
|
failureReason: string | null;
|
|
352
352
|
verifyChecks: {
|
|
353
|
-
command: string;
|
|
354
353
|
exitCode: number;
|
|
354
|
+
command: string;
|
|
355
355
|
stdout: string;
|
|
356
356
|
stderr: string;
|
|
357
357
|
startedAt: string;
|
|
@@ -379,9 +379,9 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
379
379
|
maxTimeMs: number | null;
|
|
380
380
|
stopRequestedAt: string | null;
|
|
381
381
|
logs: {
|
|
382
|
+
text: string;
|
|
382
383
|
level: "error" | "info";
|
|
383
384
|
source: "worker" | "loop" | "verifier" | "verify-check";
|
|
384
|
-
text: string;
|
|
385
385
|
timestamp: string;
|
|
386
386
|
seq: number;
|
|
387
387
|
iteration: number | null;
|
|
@@ -391,12 +391,12 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
391
391
|
activeWorkerAgentId: string | null;
|
|
392
392
|
activeVerifierAgentId: string | null;
|
|
393
393
|
}, {
|
|
394
|
-
status: "running" | "failed" | "succeeded" | "stopped";
|
|
395
394
|
cwd: string;
|
|
396
395
|
name: string | null;
|
|
397
|
-
createdAt: string;
|
|
398
396
|
id: string;
|
|
397
|
+
status: "running" | "failed" | "succeeded" | "stopped";
|
|
399
398
|
provider: string;
|
|
399
|
+
createdAt: string;
|
|
400
400
|
updatedAt: string;
|
|
401
401
|
model: string | null;
|
|
402
402
|
startedAt: string;
|
|
@@ -412,8 +412,8 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
412
412
|
workerOutcome: "completed" | "failed" | "canceled" | null;
|
|
413
413
|
failureReason: string | null;
|
|
414
414
|
verifyChecks: {
|
|
415
|
-
command: string;
|
|
416
415
|
exitCode: number;
|
|
416
|
+
command: string;
|
|
417
417
|
stdout: string;
|
|
418
418
|
stderr: string;
|
|
419
419
|
startedAt: string;
|
|
@@ -440,9 +440,9 @@ declare const LoopRecordSchema: z.ZodObject<{
|
|
|
440
440
|
maxTimeMs: number | null;
|
|
441
441
|
stopRequestedAt: string | null;
|
|
442
442
|
logs: {
|
|
443
|
+
text: string;
|
|
443
444
|
level: "error" | "info";
|
|
444
445
|
source: "worker" | "loop" | "verifier" | "verify-check";
|
|
445
|
-
text: string;
|
|
446
446
|
timestamp: string;
|
|
447
447
|
seq: number;
|
|
448
448
|
iteration: number | null;
|
|
@@ -7,11 +7,11 @@ export declare const packageJsonSchema: z.ZodObject<{
|
|
|
7
7
|
name: z.ZodOptional<z.ZodString>;
|
|
8
8
|
version: z.ZodOptional<z.ZodString>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
version?: string | undefined;
|
|
11
10
|
name?: string | undefined;
|
|
12
|
-
}, {
|
|
13
11
|
version?: string | undefined;
|
|
12
|
+
}, {
|
|
14
13
|
name?: string | undefined;
|
|
14
|
+
version?: string | undefined;
|
|
15
15
|
}>;
|
|
16
16
|
export type PackageJson = z.infer<typeof packageJsonSchema>;
|
|
17
17
|
export declare class PackageVersionResolutionError extends Error {
|
|
@@ -6,6 +6,7 @@ import type { GitHubService } from "../services/github-service.js";
|
|
|
6
6
|
import type { TerminalManager } from "../terminal/terminal-manager.js";
|
|
7
7
|
export interface ArchivePaseoWorktreeDependencies {
|
|
8
8
|
paseoHome?: string;
|
|
9
|
+
worktreesRoot?: string;
|
|
9
10
|
github: GitHubService;
|
|
10
11
|
workspaceGitService: Pick<WorkspaceGitService, "getSnapshot">;
|
|
11
12
|
agentManager: Pick<AgentManager, "listAgents" | "archiveAgent" | "archiveSnapshot">;
|
|
@@ -33,6 +34,7 @@ export declare function archivePaseoWorktree(dependencies: ArchivePaseoWorktreeD
|
|
|
33
34
|
targetPath: string;
|
|
34
35
|
repoRoot: string | null;
|
|
35
36
|
worktreesRoot?: string;
|
|
37
|
+
worktreesBaseRoot?: string;
|
|
36
38
|
requestId: string;
|
|
37
39
|
}): Promise<string[]>;
|
|
38
40
|
export declare function killTerminalsUnderPath(dependencies: KillTerminalsUnderPathDependencies, rootPath: string): Promise<void>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { normalizeWorkspaceId as normalizePersistedWorkspaceId } from "./workspace-registry-model.js";
|
|
2
|
-
import { deletePaseoWorktree, resolvePaseoWorktreeRootForCwd } from "../utils/worktree.js";
|
|
2
|
+
import { deletePaseoWorktree, resolvePaseoWorktreeRootForCwd, WorktreeTeardownError, } from "../utils/worktree.js";
|
|
3
3
|
export async function archivePaseoWorktree(dependencies, options) {
|
|
4
4
|
let targetPath = options.targetPath;
|
|
5
5
|
const resolvedWorktree = await resolvePaseoWorktreeRootForCwd(targetPath, {
|
|
6
6
|
paseoHome: dependencies.paseoHome,
|
|
7
|
+
worktreesRoot: options.worktreesBaseRoot ?? dependencies.worktreesRoot,
|
|
7
8
|
});
|
|
8
9
|
if (resolvedWorktree) {
|
|
9
10
|
targetPath = resolvedWorktree.worktreePath;
|
|
@@ -50,13 +51,26 @@ export async function archivePaseoWorktree(dependencies, options) {
|
|
|
50
51
|
dependencies.sessionLogger?.warn({ err: result.reason, targetPath }, "Worktree archive teardown step failed; continuing");
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
let teardownError = null;
|
|
55
|
+
try {
|
|
56
|
+
await deletePaseoWorktree({
|
|
57
|
+
cwd: options.repoRoot,
|
|
58
|
+
worktreePath: targetPath,
|
|
59
|
+
worktreesRoot: options.worktreesRoot,
|
|
60
|
+
paseoHome: dependencies.paseoHome,
|
|
61
|
+
worktreesBaseRoot: options.worktreesBaseRoot ?? dependencies.worktreesRoot,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (error instanceof WorktreeTeardownError) {
|
|
66
|
+
teardownError = error;
|
|
67
|
+
dependencies.sessionLogger?.warn({ err: error, targetPath }, "Worktree teardown failed during archive; archiving workspace record anyway");
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
throw error;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!teardownError && options.repoRoot) {
|
|
60
74
|
try {
|
|
61
75
|
await dependencies.workspaceGitService.getSnapshot(options.repoRoot, {
|
|
62
76
|
force: true,
|
|
@@ -75,9 +89,14 @@ export async function archivePaseoWorktree(dependencies, options) {
|
|
|
75
89
|
await dependencies.archiveWorkspaceRecord(workspaceId);
|
|
76
90
|
}
|
|
77
91
|
catch (error) {
|
|
78
|
-
dependencies.sessionLogger?.warn({ err: error, workspaceId },
|
|
92
|
+
dependencies.sessionLogger?.warn({ err: error, workspaceId }, teardownError
|
|
93
|
+
? "Failed to archive workspace record after teardown failed"
|
|
94
|
+
: "Failed to archive workspace record; worktree FS already removed");
|
|
79
95
|
}
|
|
80
96
|
}));
|
|
97
|
+
if (teardownError) {
|
|
98
|
+
throw teardownError;
|
|
99
|
+
}
|
|
81
100
|
}
|
|
82
101
|
finally {
|
|
83
102
|
dependencies.clearWorkspaceArchiving(affectedWorkspaceIdList);
|
|
@@ -46,6 +46,19 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
46
46
|
useTls?: boolean | undefined;
|
|
47
47
|
publicUseTls?: boolean | undefined;
|
|
48
48
|
}>>;
|
|
49
|
+
serviceProxy: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
listen: z.ZodOptional<z.ZodString>;
|
|
52
|
+
publicBaseUrl: z.ZodOptional<z.ZodString>;
|
|
53
|
+
}, "strict", z.ZodTypeAny, {
|
|
54
|
+
publicBaseUrl?: string | undefined;
|
|
55
|
+
enabled?: boolean | undefined;
|
|
56
|
+
listen?: string | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
publicBaseUrl?: string | undefined;
|
|
59
|
+
enabled?: boolean | undefined;
|
|
60
|
+
listen?: string | undefined;
|
|
61
|
+
}>>;
|
|
49
62
|
auth: z.ZodOptional<z.ZodObject<{
|
|
50
63
|
password: z.ZodOptional<z.ZodString>;
|
|
51
64
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -76,6 +89,11 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
76
89
|
useTls?: boolean | undefined;
|
|
77
90
|
publicUseTls?: boolean | undefined;
|
|
78
91
|
} | undefined;
|
|
92
|
+
serviceProxy?: {
|
|
93
|
+
publicBaseUrl?: string | undefined;
|
|
94
|
+
enabled?: boolean | undefined;
|
|
95
|
+
listen?: string | undefined;
|
|
96
|
+
} | undefined;
|
|
79
97
|
}, {
|
|
80
98
|
auth?: {
|
|
81
99
|
password?: string | undefined;
|
|
@@ -99,6 +117,11 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
99
117
|
useTls?: boolean | undefined;
|
|
100
118
|
publicUseTls?: boolean | undefined;
|
|
101
119
|
} | undefined;
|
|
120
|
+
serviceProxy?: {
|
|
121
|
+
publicBaseUrl?: string | undefined;
|
|
122
|
+
enabled?: boolean | undefined;
|
|
123
|
+
listen?: string | undefined;
|
|
124
|
+
} | undefined;
|
|
102
125
|
}>, {
|
|
103
126
|
auth?: {
|
|
104
127
|
password?: string | undefined;
|
|
@@ -121,6 +144,11 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
121
144
|
useTls?: boolean | undefined;
|
|
122
145
|
publicUseTls?: boolean | undefined;
|
|
123
146
|
} | undefined;
|
|
147
|
+
serviceProxy?: {
|
|
148
|
+
publicBaseUrl?: string | undefined;
|
|
149
|
+
enabled?: boolean | undefined;
|
|
150
|
+
listen?: string | undefined;
|
|
151
|
+
} | undefined;
|
|
124
152
|
}, {
|
|
125
153
|
auth?: {
|
|
126
154
|
password?: string | undefined;
|
|
@@ -144,6 +172,11 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
144
172
|
useTls?: boolean | undefined;
|
|
145
173
|
publicUseTls?: boolean | undefined;
|
|
146
174
|
} | undefined;
|
|
175
|
+
serviceProxy?: {
|
|
176
|
+
publicBaseUrl?: string | undefined;
|
|
177
|
+
enabled?: boolean | undefined;
|
|
178
|
+
listen?: string | undefined;
|
|
179
|
+
} | undefined;
|
|
147
180
|
}>>;
|
|
148
181
|
app: z.ZodOptional<z.ZodObject<{
|
|
149
182
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -182,6 +215,13 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
182
215
|
apiKey?: string | undefined;
|
|
183
216
|
} | undefined;
|
|
184
217
|
}>>;
|
|
218
|
+
worktrees: z.ZodOptional<z.ZodObject<{
|
|
219
|
+
root: z.ZodOptional<z.ZodString>;
|
|
220
|
+
}, "strict", z.ZodTypeAny, {
|
|
221
|
+
root?: string | undefined;
|
|
222
|
+
}, {
|
|
223
|
+
root?: string | undefined;
|
|
224
|
+
}>>;
|
|
185
225
|
agents: z.ZodOptional<z.ZodObject<{
|
|
186
226
|
providers: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
187
227
|
extends: z.ZodOptional<z.ZodString>;
|
|
@@ -793,7 +833,34 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
793
833
|
format?: "json" | "pretty" | undefined;
|
|
794
834
|
}>>;
|
|
795
835
|
}, "strict", z.ZodTypeAny, {
|
|
796
|
-
|
|
836
|
+
daemon?: {
|
|
837
|
+
auth?: {
|
|
838
|
+
password?: string | undefined;
|
|
839
|
+
} | undefined;
|
|
840
|
+
mcp?: z.objectOutputType<{
|
|
841
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
842
|
+
injectIntoAgents: z.ZodOptional<z.ZodBoolean>;
|
|
843
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
844
|
+
listen?: string | undefined;
|
|
845
|
+
hostnames?: true | string[] | undefined;
|
|
846
|
+
autoArchiveAfterMerge?: boolean | undefined;
|
|
847
|
+
appendSystemPrompt?: string | undefined;
|
|
848
|
+
cors?: {
|
|
849
|
+
allowedOrigins?: string[] | undefined;
|
|
850
|
+
} | undefined;
|
|
851
|
+
relay?: {
|
|
852
|
+
enabled?: boolean | undefined;
|
|
853
|
+
endpoint?: string | undefined;
|
|
854
|
+
publicEndpoint?: string | undefined;
|
|
855
|
+
useTls?: boolean | undefined;
|
|
856
|
+
publicUseTls?: boolean | undefined;
|
|
857
|
+
} | undefined;
|
|
858
|
+
serviceProxy?: {
|
|
859
|
+
publicBaseUrl?: string | undefined;
|
|
860
|
+
enabled?: boolean | undefined;
|
|
861
|
+
listen?: string | undefined;
|
|
862
|
+
} | undefined;
|
|
863
|
+
} | undefined;
|
|
797
864
|
features?: {
|
|
798
865
|
dictation?: {
|
|
799
866
|
enabled?: boolean | undefined;
|
|
@@ -827,6 +894,10 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
827
894
|
} | undefined;
|
|
828
895
|
} | undefined;
|
|
829
896
|
} | undefined;
|
|
897
|
+
version?: 1 | undefined;
|
|
898
|
+
worktrees?: {
|
|
899
|
+
root?: string | undefined;
|
|
900
|
+
} | undefined;
|
|
830
901
|
log?: {
|
|
831
902
|
level?: "error" | "fatal" | "warn" | "info" | "debug" | "trace" | undefined;
|
|
832
903
|
console?: {
|
|
@@ -897,16 +968,18 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
897
968
|
apiKey?: string | undefined;
|
|
898
969
|
} | undefined;
|
|
899
970
|
} | undefined;
|
|
971
|
+
}, {
|
|
900
972
|
daemon?: {
|
|
901
973
|
auth?: {
|
|
902
974
|
password?: string | undefined;
|
|
903
975
|
} | undefined;
|
|
904
|
-
mcp?: z.
|
|
976
|
+
mcp?: z.objectInputType<{
|
|
905
977
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
906
978
|
injectIntoAgents: z.ZodOptional<z.ZodBoolean>;
|
|
907
979
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
908
980
|
listen?: string | undefined;
|
|
909
981
|
hostnames?: true | string[] | undefined;
|
|
982
|
+
allowedHosts?: true | string[] | undefined;
|
|
910
983
|
autoArchiveAfterMerge?: boolean | undefined;
|
|
911
984
|
appendSystemPrompt?: string | undefined;
|
|
912
985
|
cors?: {
|
|
@@ -919,9 +992,12 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
919
992
|
useTls?: boolean | undefined;
|
|
920
993
|
publicUseTls?: boolean | undefined;
|
|
921
994
|
} | undefined;
|
|
995
|
+
serviceProxy?: {
|
|
996
|
+
publicBaseUrl?: string | undefined;
|
|
997
|
+
enabled?: boolean | undefined;
|
|
998
|
+
listen?: string | undefined;
|
|
999
|
+
} | undefined;
|
|
922
1000
|
} | undefined;
|
|
923
|
-
}, {
|
|
924
|
-
version?: 1 | undefined;
|
|
925
1001
|
features?: {
|
|
926
1002
|
dictation?: {
|
|
927
1003
|
enabled?: boolean | undefined;
|
|
@@ -955,6 +1031,10 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
955
1031
|
} | undefined;
|
|
956
1032
|
} | undefined;
|
|
957
1033
|
} | undefined;
|
|
1034
|
+
version?: 1 | undefined;
|
|
1035
|
+
worktrees?: {
|
|
1036
|
+
root?: string | undefined;
|
|
1037
|
+
} | undefined;
|
|
958
1038
|
log?: {
|
|
959
1039
|
level?: "error" | "fatal" | "warn" | "info" | "debug" | "trace" | undefined;
|
|
960
1040
|
console?: {
|
|
@@ -992,30 +1072,6 @@ export declare const PersistedConfigSchema: z.ZodObject<{
|
|
|
992
1072
|
apiKey?: string | undefined;
|
|
993
1073
|
} | undefined;
|
|
994
1074
|
} | undefined;
|
|
995
|
-
daemon?: {
|
|
996
|
-
auth?: {
|
|
997
|
-
password?: string | undefined;
|
|
998
|
-
} | undefined;
|
|
999
|
-
mcp?: z.objectInputType<{
|
|
1000
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
1001
|
-
injectIntoAgents: z.ZodOptional<z.ZodBoolean>;
|
|
1002
|
-
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1003
|
-
listen?: string | undefined;
|
|
1004
|
-
hostnames?: true | string[] | undefined;
|
|
1005
|
-
allowedHosts?: true | string[] | undefined;
|
|
1006
|
-
autoArchiveAfterMerge?: boolean | undefined;
|
|
1007
|
-
appendSystemPrompt?: string | undefined;
|
|
1008
|
-
cors?: {
|
|
1009
|
-
allowedOrigins?: string[] | undefined;
|
|
1010
|
-
} | undefined;
|
|
1011
|
-
relay?: {
|
|
1012
|
-
enabled?: boolean | undefined;
|
|
1013
|
-
endpoint?: string | undefined;
|
|
1014
|
-
publicEndpoint?: string | undefined;
|
|
1015
|
-
useTls?: boolean | undefined;
|
|
1016
|
-
publicUseTls?: boolean | undefined;
|
|
1017
|
-
} | undefined;
|
|
1018
|
-
} | undefined;
|
|
1019
1075
|
}>;
|
|
1020
1076
|
type PersistedConfigSchemaOutput = z.infer<typeof PersistedConfigSchema>;
|
|
1021
1077
|
export type PersistedConfig = Omit<PersistedConfigSchemaOutput, "agents"> & {
|
|
@@ -49,6 +49,11 @@ const ProvidersSchema = z
|
|
|
49
49
|
local: LocalSpeechProviderSchema.optional(),
|
|
50
50
|
})
|
|
51
51
|
.strict();
|
|
52
|
+
const WorktreesConfigSchema = z
|
|
53
|
+
.object({
|
|
54
|
+
root: z.string().min(1).optional(),
|
|
55
|
+
})
|
|
56
|
+
.strict();
|
|
52
57
|
const BcryptHashSchema = z.string().regex(/^\$2[aby]\$\d{2}\$[./A-Za-z0-9]{53}$/, {
|
|
53
58
|
message: "Expected a bcrypt hash",
|
|
54
59
|
});
|
|
@@ -197,6 +202,17 @@ export const PersistedConfigSchema = z
|
|
|
197
202
|
})
|
|
198
203
|
.strict()
|
|
199
204
|
.optional(),
|
|
205
|
+
serviceProxy: z
|
|
206
|
+
.object({
|
|
207
|
+
// COMPAT(serviceProxyEnabled): added 2026-06-02, remove after 2026-12-02.
|
|
208
|
+
// Parsed only to suppress optional public/listen layers for old configs;
|
|
209
|
+
// localhost service proxying remains always enabled.
|
|
210
|
+
enabled: z.boolean().optional(),
|
|
211
|
+
listen: z.string().optional(),
|
|
212
|
+
publicBaseUrl: z.string().url().optional(),
|
|
213
|
+
})
|
|
214
|
+
.strict()
|
|
215
|
+
.optional(),
|
|
200
216
|
auth: DaemonAuthSchema.optional(),
|
|
201
217
|
})
|
|
202
218
|
.strict()
|
|
@@ -212,6 +228,7 @@ export const PersistedConfigSchema = z
|
|
|
212
228
|
.strict()
|
|
213
229
|
.optional(),
|
|
214
230
|
providers: ProvidersSchema.optional(),
|
|
231
|
+
worktrees: WorktreesConfigSchema.optional(),
|
|
215
232
|
agents: z
|
|
216
233
|
.object({
|
|
217
234
|
providers: z.preprocess(normalizeAgentProviders, ProviderOverridesSchema).optional(),
|
|
@@ -7,15 +7,15 @@ export declare const pidLockInfoSchema: z.ZodObject<{
|
|
|
7
7
|
listen: z.ZodNullable<z.ZodString>;
|
|
8
8
|
desktopManaged: z.ZodOptional<z.ZodBoolean>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
uid: number;
|
|
11
10
|
hostname: string;
|
|
11
|
+
uid: number;
|
|
12
12
|
startedAt: string;
|
|
13
13
|
listen: string | null;
|
|
14
14
|
pid: number;
|
|
15
15
|
desktopManaged?: boolean | undefined;
|
|
16
16
|
}, {
|
|
17
|
-
uid: number;
|
|
18
17
|
hostname: string;
|
|
18
|
+
uid: number;
|
|
19
19
|
startedAt: string;
|
|
20
20
|
listen: string | null;
|
|
21
21
|
pid: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ServiceProxySubsystem } from "./service-proxy.js";
|
|
2
2
|
export type ScriptHealthState = "pending" | "healthy" | "unhealthy";
|
|
3
3
|
export interface ScriptHealthEntry {
|
|
4
4
|
scriptName: string;
|
|
@@ -7,7 +7,7 @@ export interface ScriptHealthEntry {
|
|
|
7
7
|
health: ScriptHealthState;
|
|
8
8
|
}
|
|
9
9
|
export declare class ScriptHealthMonitor {
|
|
10
|
-
private readonly
|
|
10
|
+
private readonly serviceProxy;
|
|
11
11
|
private readonly onChange;
|
|
12
12
|
private readonly pollIntervalMs;
|
|
13
13
|
private readonly probeTimeoutMs;
|
|
@@ -17,8 +17,8 @@ export declare class ScriptHealthMonitor {
|
|
|
17
17
|
private readonly lastEmittedSnapshots;
|
|
18
18
|
private intervalHandle;
|
|
19
19
|
private pollInFlight;
|
|
20
|
-
constructor({
|
|
21
|
-
|
|
20
|
+
constructor({ serviceProxy, onChange, pollIntervalMs, probeTimeoutMs, graceMs, failuresBeforeStopped, }: {
|
|
21
|
+
serviceProxy: ServiceProxySubsystem;
|
|
22
22
|
onChange: (workspaceId: string, scripts: ScriptHealthEntry[]) => void;
|
|
23
23
|
pollIntervalMs?: number;
|
|
24
24
|
probeTimeoutMs?: number;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import net from "node:net";
|
|
2
2
|
export class ScriptHealthMonitor {
|
|
3
|
-
constructor({
|
|
3
|
+
constructor({ serviceProxy, onChange, pollIntervalMs = 3000, probeTimeoutMs = 500, graceMs = 5000, failuresBeforeStopped = 2, }) {
|
|
4
4
|
this.routeStates = new Map();
|
|
5
5
|
this.lastEmittedSnapshots = new Map();
|
|
6
6
|
this.intervalHandle = null;
|
|
7
7
|
this.pollInFlight = false;
|
|
8
|
-
this.
|
|
8
|
+
this.serviceProxy = serviceProxy;
|
|
9
9
|
this.onChange = onChange;
|
|
10
10
|
this.pollIntervalMs = pollIntervalMs;
|
|
11
11
|
this.probeTimeoutMs = probeTimeoutMs;
|
|
@@ -17,7 +17,7 @@ export class ScriptHealthMonitor {
|
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const now = Date.now();
|
|
20
|
-
for (const route of this.
|
|
20
|
+
for (const route of this.serviceProxy.getHealthCheckTargets()) {
|
|
21
21
|
this.getOrCreateState(route, now);
|
|
22
22
|
}
|
|
23
23
|
this.intervalHandle = setInterval(() => {
|
|
@@ -45,7 +45,7 @@ export class ScriptHealthMonitor {
|
|
|
45
45
|
}
|
|
46
46
|
this.pollInFlight = true;
|
|
47
47
|
try {
|
|
48
|
-
const routes = this.
|
|
48
|
+
const routes = this.serviceProxy.getHealthCheckTargets();
|
|
49
49
|
const activeHostnames = new Set(routes.map((route) => route.hostname));
|
|
50
50
|
const changedWorkspaceIds = new Set();
|
|
51
51
|
const now = Date.now();
|
|
@@ -110,7 +110,7 @@ export class ScriptHealthMonitor {
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
buildWorkspaceScriptList(workspaceId) {
|
|
113
|
-
return this.
|
|
113
|
+
return this.serviceProxy.getWorkspaceHealthTargets(workspaceId).flatMap((route) => {
|
|
114
114
|
const state = this.routeStates.get(route.hostname);
|
|
115
115
|
if (!state) {
|
|
116
116
|
return [];
|
|
@@ -123,7 +123,7 @@ export class ScriptHealthMonitor {
|
|
|
123
123
|
if (state) {
|
|
124
124
|
return state.health;
|
|
125
125
|
}
|
|
126
|
-
const route = this.
|
|
126
|
+
const route = this.serviceProxy.getHealthTargetForHostname(hostname);
|
|
127
127
|
if (!route) {
|
|
128
128
|
return null;
|
|
129
129
|
}
|
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { Logger } from "pino";
|
|
4
|
-
import type { RequestHandler } from "express";
|
|
5
|
-
export interface ScriptRoute {
|
|
6
|
-
hostname: string;
|
|
7
|
-
port: number;
|
|
8
|
-
}
|
|
9
|
-
export interface ScriptRouteEntry extends ScriptRoute {
|
|
10
|
-
workspaceId: string;
|
|
11
|
-
projectSlug: string;
|
|
12
|
-
scriptName: string;
|
|
13
|
-
}
|
|
14
|
-
export declare class ScriptRouteStore {
|
|
15
|
-
private routes;
|
|
16
|
-
private workspaceHostnames;
|
|
17
|
-
registerRoute(entry: ScriptRouteEntry): void;
|
|
18
|
-
removeRoute(hostname: string): void;
|
|
19
|
-
removeRouteForWorkspaceScript(params: {
|
|
20
|
-
workspaceId: string;
|
|
21
|
-
scriptName: string;
|
|
22
|
-
}): void;
|
|
23
|
-
removeRoutesForPort(port: number): void;
|
|
24
|
-
findRoute(host: string): ScriptRoute | null;
|
|
25
|
-
getRouteEntry(hostname: string): ScriptRouteEntry | null;
|
|
26
|
-
listRoutes(): ScriptRouteEntry[];
|
|
27
|
-
listRoutesForWorkspace(workspaceId: string): ScriptRouteEntry[];
|
|
28
|
-
private addHostnameToWorkspaceIndex;
|
|
29
|
-
private removeHostnameFromWorkspaceIndex;
|
|
30
|
-
}
|
|
31
|
-
export declare function createScriptProxyMiddleware({ routeStore, logger, }: {
|
|
32
|
-
routeStore: ScriptRouteStore;
|
|
33
|
-
logger: Logger;
|
|
34
|
-
}): RequestHandler;
|
|
35
|
-
export declare function createScriptProxyUpgradeHandler({ routeStore, logger, }: {
|
|
36
|
-
routeStore: ScriptRouteStore;
|
|
37
|
-
logger: Logger;
|
|
38
|
-
}): (req: IncomingMessage, socket: net.Socket, head: Buffer) => void;
|
|
39
|
-
export declare function findFreePort(): Promise<number>;
|
|
1
|
+
export { createScriptProxyMiddleware, createScriptProxyUpgradeHandler, findFreePort, ScriptRouteStore, } from "./service-proxy.js";
|
|
2
|
+
export type { ScriptRoute, ScriptRouteEntry } from "./service-proxy.js";
|
|
40
3
|
//# sourceMappingURL=script-proxy.d.ts.map
|