@getpaseo/server 0.1.100 → 0.1.101
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/executable-resolution/windows.js +3 -0
- package/dist/server/server/agent/agent-manager.d.ts +10 -0
- package/dist/server/server/agent/agent-manager.js +65 -27
- package/dist/server/server/agent/agent-sdk-types.d.ts +8 -0
- package/dist/server/server/agent/mcp-server.d.ts +2 -45
- package/dist/server/server/agent/mcp-server.js +45 -1985
- package/dist/server/server/agent/prompt-attachments.js +6 -2
- package/dist/server/server/agent/provider-snapshot-manager.d.ts +4 -0
- package/dist/server/server/agent/provider-snapshot-manager.js +58 -13
- package/dist/server/server/agent/providers/acp-agent.d.ts +20 -1
- package/dist/server/server/agent/providers/acp-agent.js +170 -26
- package/dist/server/server/agent/providers/claude/agent.js +60 -10
- package/dist/server/server/agent/providers/codex-app-server-agent.js +6 -57
- package/dist/server/server/agent/providers/diagnostic-utils.d.ts +1 -0
- package/dist/server/server/agent/providers/diagnostic-utils.js +1 -1
- package/dist/server/server/agent/providers/generic-acp-agent.d.ts +3 -0
- package/dist/server/server/agent/providers/generic-acp-agent.js +41 -23
- package/dist/server/server/agent/providers/mock-load-test-agent.js +4 -2
- package/dist/server/server/agent/providers/pi/agent.d.ts +2 -1
- package/dist/server/server/agent/providers/pi/agent.js +3 -0
- package/dist/server/server/agent/providers/provider-image-output.d.ts +5 -0
- package/dist/server/server/agent/providers/provider-image-output.js +55 -0
- package/dist/server/server/agent/tools/paseo-tools.d.ts +48 -0
- package/dist/server/server/agent/tools/paseo-tools.js +2121 -0
- package/dist/server/server/agent/tools/types.d.ts +36 -0
- package/dist/server/server/agent/tools/types.js +2 -0
- package/dist/server/server/bootstrap.js +71 -62
- package/dist/server/server/persisted-config.d.ts +5 -0
- package/dist/server/server/persisted-config.js +10 -2
- package/dist/server/server/session/agent-updates/agent-updates-service.d.ts +59 -0
- package/dist/server/server/session/agent-updates/agent-updates-service.js +220 -0
- package/dist/server/server/session/checkout/checkout-session.d.ts +13 -15
- package/dist/server/server/session/checkout/checkout-session.js +18 -16
- package/dist/server/server/session/checkout/git-metadata-generator.d.ts +53 -0
- package/dist/server/server/session/checkout/git-metadata-generator.js +159 -0
- package/dist/server/server/session/daemon/daemon-session.d.ts +14 -0
- package/dist/server/server/session/daemon/daemon-session.js +38 -0
- package/dist/server/server/session/daemon/diagnostics.d.ts +41 -0
- package/dist/server/server/session/daemon/diagnostics.js +421 -0
- package/dist/server/server/session/git-mutation/git-mutation-service.d.ts +34 -0
- package/dist/server/server/session/git-mutation/git-mutation-service.js +71 -0
- package/dist/server/server/session/workspace-git-observer/workspace-git-observer-service.d.ts +36 -0
- package/dist/server/server/session/workspace-git-observer/workspace-git-observer-service.js +134 -0
- package/dist/server/server/session/workspace-provisioning/workspace-provisioning-service.d.ts +34 -0
- package/dist/server/server/session/workspace-provisioning/workspace-provisioning-service.js +190 -0
- package/dist/server/server/session/workspace-scripts/workspace-scripts-service.d.ts +41 -0
- package/dist/server/server/session/workspace-scripts/workspace-scripts-service.js +100 -0
- package/dist/server/server/session.d.ts +7 -51
- package/dist/server/server/session.js +113 -938
- package/dist/server/server/speech/providers/openai/config.d.ts +1 -2
- package/dist/server/server/speech/providers/openai/config.js +13 -9
- package/dist/server/server/speech/providers/openai/runtime.js +2 -16
- package/dist/server/server/speech/providers/openai/stt.d.ts +1 -0
- package/dist/server/server/speech/providers/openai/stt.js +4 -2
- package/dist/server/server/speech/providers/openai/tts.d.ts +1 -0
- package/dist/server/server/speech/providers/openai/tts.js +1 -0
- package/dist/server/server/websocket/runtime-metrics.d.ts +20 -0
- package/dist/server/server/websocket-server.d.ts +1 -2
- package/dist/server/server/websocket-server.js +26 -21
- package/dist/server/server/worktree-bootstrap.d.ts +1 -1
- package/dist/server/server/worktree-branch-name-generator.js +3 -1
- package/dist/server/utils/checkout-git.js +51 -26
- package/dist/src/executable-resolution/windows.js +3 -0
- package/dist/src/server/persisted-config.js +10 -2
- package/package.json +5 -5
- package/dist/server/server/speech/providers/openai/realtime-transcription-session.d.ts +0 -42
- package/dist/server/server/speech/providers/openai/realtime-transcription-session.js +0 -168
|
@@ -14,16 +14,18 @@ import { expandTilde } from "../../../utils/path.js";
|
|
|
14
14
|
* merge/pull/push/stash and the GitHub-PR operations).
|
|
15
15
|
*
|
|
16
16
|
* Command operations keep the live diff in sync by calling scheduleDiffRefresh()
|
|
17
|
-
* and refresh the workspace git snapshot through
|
|
17
|
+
* and refresh the workspace git snapshot through gitMutation.notifyGitMutation(); the
|
|
18
18
|
* workspace git observer streams branch changes through emitStatusUpdate().
|
|
19
19
|
*/
|
|
20
20
|
export class CheckoutSession {
|
|
21
21
|
constructor(options) {
|
|
22
22
|
this.diffSubscriptions = new Map();
|
|
23
23
|
this.host = options.host;
|
|
24
|
+
this.gitMutation = options.gitMutation;
|
|
24
25
|
this.workspaceGitService = options.workspaceGitService;
|
|
25
26
|
this.github = options.github;
|
|
26
27
|
this.checkoutDiffManager = options.checkoutDiffManager;
|
|
28
|
+
this.gitMetadataGenerator = options.gitMetadataGenerator;
|
|
27
29
|
this.paseoHome = options.paseoHome;
|
|
28
30
|
this.worktreesRoot = options.worktreesRoot;
|
|
29
31
|
this.logger = options.logger;
|
|
@@ -252,7 +254,7 @@ export class CheckoutSession {
|
|
|
252
254
|
async handleCheckoutSwitchBranchRequest(msg) {
|
|
253
255
|
const { cwd, branch, requestId } = msg;
|
|
254
256
|
try {
|
|
255
|
-
const checkoutResult = await this.
|
|
257
|
+
const checkoutResult = await this.gitMutation.checkoutExistingBranch(cwd, branch);
|
|
256
258
|
this.scheduleDiffRefresh(cwd);
|
|
257
259
|
// Push a workspace_update immediately so the sidebar/header reflect
|
|
258
260
|
// the new branch name without waiting for the background git watcher.
|
|
@@ -300,7 +302,7 @@ export class CheckoutSession {
|
|
|
300
302
|
}
|
|
301
303
|
try {
|
|
302
304
|
const result = await this.host.renameCurrentBranch(cwd, branch);
|
|
303
|
-
await this.
|
|
305
|
+
await this.gitMutation.notifyGitMutation(cwd, "rename-branch", { invalidateGithub: true });
|
|
304
306
|
this.scheduleDiffRefresh(cwd);
|
|
305
307
|
this.host.handleWorkspaceGitBranchSnapshot(cwd, result.currentBranch);
|
|
306
308
|
// Branch is a git fact derived per-descriptor from each workspace's own
|
|
@@ -344,7 +346,7 @@ export class CheckoutSession {
|
|
|
344
346
|
await execCommand("git", ["stash", "push", "--include-untracked", "-m", message], {
|
|
345
347
|
cwd,
|
|
346
348
|
});
|
|
347
|
-
await this.
|
|
349
|
+
await this.gitMutation.notifyGitMutation(cwd, "stash-push");
|
|
348
350
|
this.scheduleDiffRefresh(cwd);
|
|
349
351
|
this.host.emit({
|
|
350
352
|
type: "stash_save_response",
|
|
@@ -364,7 +366,7 @@ export class CheckoutSession {
|
|
|
364
366
|
await execCommand("git", ["stash", "pop", `stash@{${stashIndex}}`], {
|
|
365
367
|
cwd,
|
|
366
368
|
});
|
|
367
|
-
await this.
|
|
369
|
+
await this.gitMutation.notifyGitMutation(cwd, "stash-pop");
|
|
368
370
|
this.scheduleDiffRefresh(cwd);
|
|
369
371
|
this.host.emit({
|
|
370
372
|
type: "stash_pop_response",
|
|
@@ -400,7 +402,7 @@ export class CheckoutSession {
|
|
|
400
402
|
try {
|
|
401
403
|
let message = msg.message?.trim() ?? "";
|
|
402
404
|
if (!message) {
|
|
403
|
-
message = await this.
|
|
405
|
+
message = await this.gitMetadataGenerator.generateCommitMessage(cwd);
|
|
404
406
|
}
|
|
405
407
|
if (!message) {
|
|
406
408
|
throw new Error("Commit message is required");
|
|
@@ -409,7 +411,7 @@ export class CheckoutSession {
|
|
|
409
411
|
message,
|
|
410
412
|
addAll: msg.addAll ?? true,
|
|
411
413
|
});
|
|
412
|
-
await this.
|
|
414
|
+
await this.gitMutation.notifyGitMutation(cwd, "commit-changes");
|
|
413
415
|
this.scheduleDiffRefresh(cwd);
|
|
414
416
|
this.host.emit({
|
|
415
417
|
type: "checkout_commit_response",
|
|
@@ -457,8 +459,8 @@ export class CheckoutSession {
|
|
|
457
459
|
mode: msg.strategy === "squash" ? "squash" : "merge",
|
|
458
460
|
}, { paseoHome: this.paseoHome, worktreesRoot: this.worktreesRoot });
|
|
459
461
|
await Promise.all([
|
|
460
|
-
this.
|
|
461
|
-
...(mutatedCwd !== cwd ? [this.
|
|
462
|
+
this.gitMutation.notifyGitMutation(mutatedCwd, "merge-to-base", { invalidateGithub: true }),
|
|
463
|
+
...(mutatedCwd !== cwd ? [this.gitMutation.notifyGitMutation(cwd, "merge-to-base")] : []),
|
|
462
464
|
]);
|
|
463
465
|
this.scheduleDiffRefresh(cwd);
|
|
464
466
|
this.host.emit({
|
|
@@ -496,7 +498,7 @@ export class CheckoutSession {
|
|
|
496
498
|
baseRef: msg.baseRef,
|
|
497
499
|
requireCleanTarget: msg.requireCleanTarget ?? true,
|
|
498
500
|
});
|
|
499
|
-
await this.
|
|
501
|
+
await this.gitMutation.notifyGitMutation(cwd, "merge-from-base", { invalidateGithub: true });
|
|
500
502
|
this.scheduleDiffRefresh(cwd);
|
|
501
503
|
this.host.emit({
|
|
502
504
|
type: "checkout_merge_from_base_response",
|
|
@@ -524,7 +526,7 @@ export class CheckoutSession {
|
|
|
524
526
|
const { cwd, requestId } = msg;
|
|
525
527
|
try {
|
|
526
528
|
await pullCurrentBranch(cwd);
|
|
527
|
-
await this.
|
|
529
|
+
await this.gitMutation.notifyGitMutation(cwd, "pull", { invalidateGithub: true });
|
|
528
530
|
this.scheduleDiffRefresh(cwd);
|
|
529
531
|
this.host.emit({
|
|
530
532
|
type: "checkout_pull_response",
|
|
@@ -552,7 +554,7 @@ export class CheckoutSession {
|
|
|
552
554
|
const { cwd, requestId } = msg;
|
|
553
555
|
try {
|
|
554
556
|
await pushCurrentBranch(cwd);
|
|
555
|
-
await this.
|
|
557
|
+
await this.gitMutation.notifyGitMutation(cwd, "push", { invalidateGithub: true });
|
|
556
558
|
this.host.emit({
|
|
557
559
|
type: "checkout_push_response",
|
|
558
560
|
payload: {
|
|
@@ -581,7 +583,7 @@ export class CheckoutSession {
|
|
|
581
583
|
let title = msg.title?.trim() ?? "";
|
|
582
584
|
let body = msg.body?.trim() ?? "";
|
|
583
585
|
if (!title || !body) {
|
|
584
|
-
const generated = await this.
|
|
586
|
+
const generated = await this.gitMetadataGenerator.generatePullRequestText(cwd, msg.baseRef);
|
|
585
587
|
if (!title)
|
|
586
588
|
title = generated.title;
|
|
587
589
|
if (!body)
|
|
@@ -592,7 +594,7 @@ export class CheckoutSession {
|
|
|
592
594
|
body,
|
|
593
595
|
base: msg.baseRef,
|
|
594
596
|
}, this.github);
|
|
595
|
-
await this.
|
|
597
|
+
await this.gitMutation.notifyGitMutation(cwd, "create-pr", { invalidateGithub: true });
|
|
596
598
|
this.host.emit({
|
|
597
599
|
type: "checkout_pr_create_response",
|
|
598
600
|
payload: {
|
|
@@ -632,7 +634,7 @@ export class CheckoutSession {
|
|
|
632
634
|
mergeMethod: msg.mergeMethod,
|
|
633
635
|
status: pullRequest,
|
|
634
636
|
});
|
|
635
|
-
await this.
|
|
637
|
+
await this.gitMutation.notifyGitMutation(cwd, "merge-pr", { invalidateGithub: true });
|
|
636
638
|
this.host.emit({
|
|
637
639
|
type: "checkout_pr_merge_response",
|
|
638
640
|
payload: {
|
|
@@ -695,7 +697,7 @@ export class CheckoutSession {
|
|
|
695
697
|
status: pullRequest,
|
|
696
698
|
});
|
|
697
699
|
}
|
|
698
|
-
await this.
|
|
700
|
+
await this.gitMutation.notifyGitMutation(cwd, msg.enabled ? "enable-pr-auto-merge" : "disable-pr-auto-merge", {
|
|
699
701
|
invalidateGithub: true,
|
|
700
702
|
});
|
|
701
703
|
this.host.emit({
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AgentManager } from "../../agent/agent-manager.js";
|
|
3
|
+
import type { ProviderSnapshotManager } from "../../agent/provider-snapshot-manager.js";
|
|
4
|
+
import { type ResolveStructuredGenerationProvidersOptions, type StructuredGenerationDaemonConfig } from "../../agent/structured-generation-providers.js";
|
|
5
|
+
import type { WorkspaceGitService } from "../../workspace-git-service.js";
|
|
6
|
+
export interface PullRequestText {
|
|
7
|
+
title: string;
|
|
8
|
+
body: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Generates a workspace's commit message and pull-request text from its git diff
|
|
12
|
+
* via the agent LLM. The checkout subsystem is the only consumer; it owns the
|
|
13
|
+
* commit/PR commands and asks this for the wording when the user left it blank.
|
|
14
|
+
*/
|
|
15
|
+
export interface GitMetadataGenerator {
|
|
16
|
+
generateCommitMessage(cwd: string): Promise<string>;
|
|
17
|
+
generatePullRequestText(cwd: string, baseRef?: string): Promise<PullRequestText>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The LLM boundary, injected so the generator's prompt-building and fallback
|
|
21
|
+
* behaviour is unit-testable with a fake. Production wires
|
|
22
|
+
* createAgentStructuredTextGeneration (resolve providers → run structured
|
|
23
|
+
* generation); a failed generation throws StructuredAgent*Error, which the
|
|
24
|
+
* generator catches and turns into the product fallback text.
|
|
25
|
+
*/
|
|
26
|
+
export interface StructuredTextGeneration {
|
|
27
|
+
generate<T>(request: StructuredTextGenerationRequest<T>): Promise<T>;
|
|
28
|
+
}
|
|
29
|
+
export interface StructuredTextGenerationRequest<T> {
|
|
30
|
+
cwd: string;
|
|
31
|
+
prompt: string;
|
|
32
|
+
schema: z.ZodType<T>;
|
|
33
|
+
schemaName: string;
|
|
34
|
+
agentTitle: string;
|
|
35
|
+
}
|
|
36
|
+
type GitMetadataDiffSource = Pick<WorkspaceGitService, "getCheckoutDiff" | "resolveRepoRoot">;
|
|
37
|
+
export declare function createGitMetadataGenerator(deps: {
|
|
38
|
+
workspaceGitService: GitMetadataDiffSource;
|
|
39
|
+
generation: StructuredTextGeneration;
|
|
40
|
+
}): GitMetadataGenerator;
|
|
41
|
+
/**
|
|
42
|
+
* Production StructuredTextGeneration: resolve the structured-generation providers
|
|
43
|
+
* for the cwd, then run the agent with a 2-retry fallback as an internal,
|
|
44
|
+
* non-persisted session.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createAgentStructuredTextGeneration(deps: {
|
|
47
|
+
agentManager: AgentManager;
|
|
48
|
+
providerSnapshotManager: Pick<ProviderSnapshotManager, "listProviders">;
|
|
49
|
+
readDaemonConfig: () => StructuredGenerationDaemonConfig;
|
|
50
|
+
getFocusedSelection: (cwd: string) => ResolveStructuredGenerationProvidersOptions["currentSelection"];
|
|
51
|
+
}): StructuredTextGeneration;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=git-metadata-generator.d.ts.map
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { StructuredAgentFallbackError, StructuredAgentResponseError, generateStructuredAgentResponseWithFallback, } from "../../agent/agent-response-loop.js";
|
|
3
|
+
import { resolveStructuredGenerationProviders, } from "../../agent/structured-generation-providers.js";
|
|
4
|
+
import { buildMetadataPrompt, } from "../../../utils/build-metadata-prompt.js";
|
|
5
|
+
const COMMIT_MESSAGE_SCHEMA = z.object({
|
|
6
|
+
message: z
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.max(72)
|
|
10
|
+
.describe("Concise git commit message, imperative mood, no trailing period."),
|
|
11
|
+
});
|
|
12
|
+
const PULL_REQUEST_SCHEMA = z.object({
|
|
13
|
+
title: z.string().min(1).max(72),
|
|
14
|
+
body: z.string().min(1),
|
|
15
|
+
});
|
|
16
|
+
const COMMIT_MESSAGE_FALLBACK = "Update files";
|
|
17
|
+
const PULL_REQUEST_FALLBACK = {
|
|
18
|
+
title: "Update changes",
|
|
19
|
+
body: "Automated PR generated by Paseo.",
|
|
20
|
+
};
|
|
21
|
+
const MAX_COMMIT_PATCH_CHARS = 120000;
|
|
22
|
+
const MAX_PULL_REQUEST_PATCH_CHARS = 200000;
|
|
23
|
+
export function createGitMetadataGenerator(deps) {
|
|
24
|
+
const { workspaceGitService, generation } = deps;
|
|
25
|
+
async function buildPromptForDiff(input) {
|
|
26
|
+
const diff = await workspaceGitService.getCheckoutDiff(input.cwd, input.diffOptions);
|
|
27
|
+
const fileList = renderFileList(diff.structured);
|
|
28
|
+
const patch = truncatePatch(diff.diff, input.maxPatchChars);
|
|
29
|
+
return buildMetadataPrompt({
|
|
30
|
+
cwd: input.cwd,
|
|
31
|
+
workspaceGitService,
|
|
32
|
+
contract: input.contract,
|
|
33
|
+
styles: [{ configKey: input.styleConfigKey, default: input.styleDefault }],
|
|
34
|
+
after: [
|
|
35
|
+
input.jsonFieldsHint,
|
|
36
|
+
"",
|
|
37
|
+
fileList,
|
|
38
|
+
"",
|
|
39
|
+
patch.length > 0 ? patch : "(No diff available)",
|
|
40
|
+
].join("\n"),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
async generateCommitMessage(cwd) {
|
|
45
|
+
const prompt = await buildPromptForDiff({
|
|
46
|
+
cwd,
|
|
47
|
+
diffOptions: { mode: "uncommitted", includeStructured: true },
|
|
48
|
+
maxPatchChars: MAX_COMMIT_PATCH_CHARS,
|
|
49
|
+
contract: "Write a concise git commit message for the changes below.",
|
|
50
|
+
styleConfigKey: "commitMessage",
|
|
51
|
+
styleDefault: "Concise, imperative mood, no trailing period.",
|
|
52
|
+
jsonFieldsHint: "Return JSON only with a single field 'message'.",
|
|
53
|
+
});
|
|
54
|
+
try {
|
|
55
|
+
const result = await generation.generate({
|
|
56
|
+
cwd,
|
|
57
|
+
prompt,
|
|
58
|
+
schema: COMMIT_MESSAGE_SCHEMA,
|
|
59
|
+
schemaName: "CommitMessage",
|
|
60
|
+
agentTitle: "Commit generator",
|
|
61
|
+
});
|
|
62
|
+
return result.message;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (isStructuredGenerationFailure(error)) {
|
|
66
|
+
return COMMIT_MESSAGE_FALLBACK;
|
|
67
|
+
}
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
async generatePullRequestText(cwd, baseRef) {
|
|
72
|
+
const prompt = await buildPromptForDiff({
|
|
73
|
+
cwd,
|
|
74
|
+
diffOptions: { mode: "base", baseRef, includeStructured: true },
|
|
75
|
+
maxPatchChars: MAX_PULL_REQUEST_PATCH_CHARS,
|
|
76
|
+
contract: "Write a pull request title and body for the changes below.",
|
|
77
|
+
styleConfigKey: "pullRequest",
|
|
78
|
+
styleDefault: "Clear, descriptive title; body explaining what changed and why.",
|
|
79
|
+
jsonFieldsHint: "Return JSON only with fields 'title' and 'body'.",
|
|
80
|
+
});
|
|
81
|
+
try {
|
|
82
|
+
return await generation.generate({
|
|
83
|
+
cwd,
|
|
84
|
+
prompt,
|
|
85
|
+
schema: PULL_REQUEST_SCHEMA,
|
|
86
|
+
schemaName: "PullRequest",
|
|
87
|
+
agentTitle: "PR generator",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (isStructuredGenerationFailure(error)) {
|
|
92
|
+
return PULL_REQUEST_FALLBACK;
|
|
93
|
+
}
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Production StructuredTextGeneration: resolve the structured-generation providers
|
|
101
|
+
* for the cwd, then run the agent with a 2-retry fallback as an internal,
|
|
102
|
+
* non-persisted session.
|
|
103
|
+
*/
|
|
104
|
+
export function createAgentStructuredTextGeneration(deps) {
|
|
105
|
+
return {
|
|
106
|
+
async generate({ cwd, prompt, schema, schemaName, agentTitle }) {
|
|
107
|
+
const providers = await resolveStructuredGenerationProviders({
|
|
108
|
+
cwd,
|
|
109
|
+
providerSnapshotManager: deps.providerSnapshotManager,
|
|
110
|
+
daemonConfig: deps.readDaemonConfig(),
|
|
111
|
+
currentSelection: deps.getFocusedSelection(cwd),
|
|
112
|
+
});
|
|
113
|
+
return generateStructuredAgentResponseWithFallback({
|
|
114
|
+
manager: deps.agentManager,
|
|
115
|
+
cwd,
|
|
116
|
+
prompt,
|
|
117
|
+
schema,
|
|
118
|
+
schemaName,
|
|
119
|
+
maxRetries: 2,
|
|
120
|
+
providers,
|
|
121
|
+
persistSession: false,
|
|
122
|
+
agentConfigOverrides: {
|
|
123
|
+
title: agentTitle,
|
|
124
|
+
internal: true,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function renderFileList(structured) {
|
|
131
|
+
if (!structured || structured.length === 0) {
|
|
132
|
+
return "Files changed: (unknown)";
|
|
133
|
+
}
|
|
134
|
+
return [
|
|
135
|
+
"Files changed:",
|
|
136
|
+
...structured.map((file) => {
|
|
137
|
+
const changeType = diffChangeTypeFor(file);
|
|
138
|
+
const status = file.status && file.status !== "ok" ? ` [${file.status}]` : "";
|
|
139
|
+
return `${changeType}\t${file.path}\t(+${file.additions} -${file.deletions})${status}`;
|
|
140
|
+
}),
|
|
141
|
+
].join("\n");
|
|
142
|
+
}
|
|
143
|
+
function truncatePatch(patch, maxPatchChars) {
|
|
144
|
+
if (patch.length <= maxPatchChars) {
|
|
145
|
+
return patch;
|
|
146
|
+
}
|
|
147
|
+
return `${patch.slice(0, maxPatchChars)}\n\n... (diff truncated to ${maxPatchChars} chars)\n`;
|
|
148
|
+
}
|
|
149
|
+
function diffChangeTypeFor(file) {
|
|
150
|
+
if (file.isNew)
|
|
151
|
+
return "A";
|
|
152
|
+
if (file.isDeleted)
|
|
153
|
+
return "D";
|
|
154
|
+
return "M";
|
|
155
|
+
}
|
|
156
|
+
function isStructuredGenerationFailure(error) {
|
|
157
|
+
return (error instanceof StructuredAgentResponseError || error instanceof StructuredAgentFallbackError);
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=git-metadata-generator.js.map
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type pino from "pino";
|
|
2
2
|
import type { ProviderAvailability } from "../../agent/agent-manager.js";
|
|
3
3
|
import type { SessionInboundMessage, SessionOutboundMessage } from "../../messages.js";
|
|
4
|
+
import { type DaemonWebSocketRuntimeDiagnosticSnapshot } from "./diagnostics.js";
|
|
5
|
+
import type { ManagedAgent } from "../../agent/agent-manager.js";
|
|
6
|
+
import type { PersistedProjectRecord, PersistedWorkspaceRecord } from "../../workspace-registry.js";
|
|
4
7
|
export interface DaemonRuntimeConfig {
|
|
5
8
|
listen: string | null;
|
|
6
9
|
appBaseUrl?: string;
|
|
@@ -21,7 +24,11 @@ export interface DaemonSessionOptions {
|
|
|
21
24
|
serverId: string | undefined;
|
|
22
25
|
daemonVersion: string | undefined;
|
|
23
26
|
daemonRuntimeConfig: DaemonRuntimeConfig | undefined;
|
|
27
|
+
listAgents: () => ManagedAgent[];
|
|
28
|
+
listProjects: () => Promise<PersistedProjectRecord[]>;
|
|
29
|
+
listWorkspaces: () => Promise<PersistedWorkspaceRecord[]>;
|
|
24
30
|
listProviderAvailability: () => Promise<ProviderAvailability[]>;
|
|
31
|
+
getWebSocketRuntimeMetrics?: () => DaemonWebSocketRuntimeDiagnosticSnapshot | null;
|
|
25
32
|
logger: pino.Logger;
|
|
26
33
|
}
|
|
27
34
|
/**
|
|
@@ -37,7 +44,11 @@ export declare class DaemonSession {
|
|
|
37
44
|
private readonly serverId;
|
|
38
45
|
private readonly daemonVersion;
|
|
39
46
|
private readonly daemonRuntimeConfig;
|
|
47
|
+
private readonly listAgents;
|
|
48
|
+
private readonly listProjects;
|
|
49
|
+
private readonly listWorkspaces;
|
|
40
50
|
private readonly listProviderAvailability;
|
|
51
|
+
private readonly getWebSocketRuntimeMetrics;
|
|
41
52
|
private readonly logger;
|
|
42
53
|
constructor(options: DaemonSessionOptions);
|
|
43
54
|
handleGetStatusRequest(msg: Extract<SessionInboundMessage, {
|
|
@@ -46,5 +57,8 @@ export declare class DaemonSession {
|
|
|
46
57
|
handleGetPairingOfferRequest(msg: Extract<SessionInboundMessage, {
|
|
47
58
|
type: "daemon.get_pairing_offer.request";
|
|
48
59
|
}>): Promise<void>;
|
|
60
|
+
handleDiagnosticsRequest(msg: Extract<SessionInboundMessage, {
|
|
61
|
+
type: "diagnostics.request";
|
|
62
|
+
}>): Promise<void>;
|
|
49
63
|
}
|
|
50
64
|
//# sourceMappingURL=daemon-session.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getPidLockInfo } from "../../pid-lock.js";
|
|
2
2
|
import { generateLocalPairingOffer } from "../../pairing-offer.js";
|
|
3
|
+
import { collectDaemonDiagnostics, } from "./diagnostics.js";
|
|
3
4
|
/**
|
|
4
5
|
* A client's read surface for the daemon process itself: its runtime status
|
|
5
6
|
* (pid-lock start time, listen address, relay config, provider availability) and
|
|
@@ -14,7 +15,11 @@ export class DaemonSession {
|
|
|
14
15
|
this.serverId = options.serverId;
|
|
15
16
|
this.daemonVersion = options.daemonVersion;
|
|
16
17
|
this.daemonRuntimeConfig = options.daemonRuntimeConfig;
|
|
18
|
+
this.listAgents = options.listAgents;
|
|
19
|
+
this.listProjects = options.listProjects;
|
|
20
|
+
this.listWorkspaces = options.listWorkspaces;
|
|
17
21
|
this.listProviderAvailability = options.listProviderAvailability;
|
|
22
|
+
this.getWebSocketRuntimeMetrics = options.getWebSocketRuntimeMetrics ?? (() => null);
|
|
18
23
|
this.logger = options.logger;
|
|
19
24
|
}
|
|
20
25
|
async handleGetStatusRequest(msg) {
|
|
@@ -94,5 +99,38 @@ export class DaemonSession {
|
|
|
94
99
|
});
|
|
95
100
|
}
|
|
96
101
|
}
|
|
102
|
+
async handleDiagnosticsRequest(msg) {
|
|
103
|
+
try {
|
|
104
|
+
const diagnostic = await collectDaemonDiagnostics({
|
|
105
|
+
paseoHome: this.paseoHome,
|
|
106
|
+
serverId: this.serverId,
|
|
107
|
+
daemonVersion: this.daemonVersion,
|
|
108
|
+
daemonRuntimeConfig: this.daemonRuntimeConfig,
|
|
109
|
+
listAgents: this.listAgents,
|
|
110
|
+
listProjects: this.listProjects,
|
|
111
|
+
listWorkspaces: this.listWorkspaces,
|
|
112
|
+
listProviderAvailability: this.listProviderAvailability,
|
|
113
|
+
getWebSocketRuntimeMetrics: this.getWebSocketRuntimeMetrics,
|
|
114
|
+
logger: this.logger,
|
|
115
|
+
});
|
|
116
|
+
this.host.emit({
|
|
117
|
+
type: "diagnostics.response",
|
|
118
|
+
payload: {
|
|
119
|
+
requestId: msg.requestId,
|
|
120
|
+
diagnostic,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
this.logger.error({ err: error }, "Failed to handle diagnostics request");
|
|
126
|
+
this.host.emit({
|
|
127
|
+
type: "diagnostics.response",
|
|
128
|
+
payload: {
|
|
129
|
+
requestId: msg.requestId,
|
|
130
|
+
diagnostic: `Paseo diagnostics\n Error: ${error instanceof Error ? error.message : String(error)}`,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
97
135
|
}
|
|
98
136
|
//# sourceMappingURL=daemon-session.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type pino from "pino";
|
|
2
|
+
import type { ManagedAgent, ProviderAvailability } from "../../agent/agent-manager.js";
|
|
3
|
+
import type { WebSocketRuntimeDiagnosticSnapshot } from "../../websocket/runtime-metrics.js";
|
|
4
|
+
import type { PersistedProjectRecord, PersistedWorkspaceRecord } from "../../workspace-registry.js";
|
|
5
|
+
import type { DaemonRuntimeConfig } from "./daemon-session.js";
|
|
6
|
+
export interface DaemonDiagnosticsOptions {
|
|
7
|
+
paseoHome: string;
|
|
8
|
+
serverId: string | undefined;
|
|
9
|
+
daemonVersion: string | undefined;
|
|
10
|
+
daemonRuntimeConfig: DaemonRuntimeConfig | undefined;
|
|
11
|
+
listAgents: () => ManagedAgent[];
|
|
12
|
+
listProjects: () => Promise<PersistedProjectRecord[]>;
|
|
13
|
+
listWorkspaces: () => Promise<PersistedWorkspaceRecord[]>;
|
|
14
|
+
listProviderAvailability: () => Promise<ProviderAvailability[]>;
|
|
15
|
+
getWebSocketRuntimeMetrics: () => DaemonWebSocketRuntimeDiagnosticSnapshot | null;
|
|
16
|
+
logger: pino.Logger;
|
|
17
|
+
}
|
|
18
|
+
interface DiagnosticWebSocketRuntimeMetrics {
|
|
19
|
+
terminalDirectorySubscriptionCount: number;
|
|
20
|
+
terminalSubscriptionCount: number;
|
|
21
|
+
inflightRequests: number;
|
|
22
|
+
peakInflightRequests: number;
|
|
23
|
+
checkoutDiffTargetCount: number;
|
|
24
|
+
checkoutDiffSubscriptionCount: number;
|
|
25
|
+
checkoutDiffWatcherCount: number;
|
|
26
|
+
checkoutDiffFallbackRefreshTargetCount: number;
|
|
27
|
+
}
|
|
28
|
+
interface DiagnosticAgentRuntimeMetrics {
|
|
29
|
+
total: number;
|
|
30
|
+
byLifecycle: Record<string, number>;
|
|
31
|
+
withActiveForegroundTurn: number;
|
|
32
|
+
timelineStats: {
|
|
33
|
+
totalItems: number;
|
|
34
|
+
maxItemsPerAgent: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export type DaemonWebSocketRuntimeDiagnosticSnapshot = WebSocketRuntimeDiagnosticSnapshot<DiagnosticWebSocketRuntimeMetrics, DiagnosticAgentRuntimeMetrics>;
|
|
38
|
+
export declare function collectDaemonDiagnostics(options: DaemonDiagnosticsOptions): Promise<string>;
|
|
39
|
+
export declare function redactDiagnostic(value: string, options?: Partial<DaemonDiagnosticsOptions>): string;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|