@getpaseo/client 0.1.109 → 0.2.0-beta.1
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/daemon-client.d.ts +39 -5
- package/dist/daemon-client.js +155 -3
- package/package.json +3 -3
package/dist/daemon-client.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
2
|
import { type ClientCapability } from "@getpaseo/protocol/client-capabilities";
|
|
3
3
|
import { AgentRefreshedStatusPayloadSchema, CheckoutRenameBranchResponseSchema, RenameTerminalResponseSchema, RestartRequestedStatusPayloadSchema, ShutdownRequestedStatusPayloadSchema, DaemonUpdateResponseSchema, type ServerInfoStatusPayload } from "@getpaseo/protocol/messages";
|
|
4
|
-
import type { AgentStreamEventPayload, AgentSnapshotPayload, ProjectPlacementPayload, AgentPermissionResolvedMessage, CreateAgentRequestMessage, CreatePaseoWorktreeRequest, FileDownloadTokenResponse, FileUploadResponse, FileExplorerResponse, FetchAgentTimelineResponseMessage, AgentForkContextResponseMessage, GitSetupOptions, CheckoutStatusResponse, CheckoutCommitResponse, CheckoutMergeResponse, CheckoutMergeFromBaseResponse, CheckoutPullResponse, CheckoutPushResponse, CheckoutRefreshResponse, CheckoutPrCreateResponse, CheckoutPrMergeResponse, CheckoutPrMergeMethod, CheckoutGithubSetAutoMergeResponse, CheckoutGithubGetCheckDetailsResponse, CheckoutPrStatusResponse, PullRequestTimelineResponse, CheckoutSwitchBranchResponse, StashSaveResponse, StashPopResponse, StashListResponse, ValidateBranchResponse, BranchSuggestionsResponse, GitHubSearchResponse, GitHubSearchRequest, DirectorySuggestionsResponse, PaseoWorktreeListResponse, PaseoWorktreeArchiveResponse, ProjectIconResponse, ProjectAddResponse, ProjectCreateDirectoryResponse, OpenProjectResponseMessage, WorkspaceGithubSearchRepositoriesResponse, ProjectGithubCloneProtocol, ProjectGithubCloneResponse, ArchiveWorkspaceResponseMessage, WorkspaceSetupStatusResponseMessage, ListCommandsResponse, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ListProviderModesResponseMessage, ListAvailableProvidersResponse, GetProvidersSnapshotResponseMessage, RefreshProvidersSnapshotResponseMessage, ProviderDiagnosticResponseMessage, ProviderUsageListResponseMessage, DaemonGetStatusResponse, DaemonGetPairingOfferResponse, DiagnosticsResponse, AgentRewindResponseMessage, ListTerminalsResponse, CreateTerminalResponse, SubscribeTerminalResponse, SubscribeTerminalRequest, CloseItemsResponse, KillTerminalResponse, CaptureTerminalResponse, TerminalInput, SessionInboundMessage, SessionOutboundMessage, SendAgentMessageRequest, PaseoConfigRaw, PaseoConfigRevision, WorkspaceCreateRequest } from "@getpaseo/protocol/messages";
|
|
4
|
+
import type { AgentStreamEventPayload, AgentSnapshotPayload, ProjectPlacementPayload, AgentPermissionResolvedMessage, CreateAgentRequestMessage, CreatePaseoWorktreeRequest, FileDownloadTokenResponse, FileUploadResponse, FileExplorerResponse, FetchAgentTimelineResponseMessage, AgentForkContextResponseMessage, GitSetupOptions, CheckoutStatusResponse, CheckoutCommit, ParsedDiffFile, CheckoutCommitResponse, CheckoutMergeResponse, CheckoutMergeFromBaseResponse, CheckoutPullResponse, CheckoutPushResponse, CheckoutRefreshResponse, CheckoutPrCreateResponse, CheckoutPrMergeResponse, CheckoutPrMergeMethod, CheckoutForgeSetAutoMergeResponse, CheckoutGithubSetAutoMergeResponse, CheckoutForgeGetCheckDetailsResponse, CheckoutGithubGetCheckDetailsResponse, CheckoutPrStatusResponse, PullRequestTimelineResponse, CheckoutSwitchBranchResponse, StashSaveResponse, StashPopResponse, StashListResponse, ValidateBranchResponse, BranchSuggestionsResponse, ForgeSearchResponse, ForgeSearchRequest, GitHubSearchResponse, GitHubSearchRequest, DirectorySuggestionsResponse, PaseoWorktreeListResponse, PaseoWorktreeArchiveResponse, ProjectIconResponse, ProjectAddResponse, ProjectCreateDirectoryResponse, OpenProjectResponseMessage, WorkspaceGithubSearchRepositoriesResponse, ProjectGithubCloneProtocol, ProjectGithubCloneResponse, ArchiveWorkspaceResponseMessage, WorkspaceSetupStatusResponseMessage, ListCommandsResponse, ListProviderFeaturesResponseMessage, ListProviderModelsResponseMessage, ListProviderModesResponseMessage, ListAvailableProvidersResponse, GetProvidersSnapshotResponseMessage, RefreshProvidersSnapshotResponseMessage, ProviderDiagnosticResponseMessage, ProviderUsageListResponseMessage, DaemonGetStatusResponse, DaemonGetPairingOfferResponse, DiagnosticsResponse, AgentRewindResponseMessage, ListTerminalsResponse, CreateTerminalResponse, SubscribeTerminalResponse, SubscribeTerminalRequest, CloseItemsResponse, KillTerminalResponse, CaptureTerminalResponse, TerminalInput, SessionInboundMessage, SessionOutboundMessage, SendAgentMessageRequest, PaseoConfigRaw, PaseoConfigRevision, WorkspaceCreateRequest, WorkspaceRecoveryState } from "@getpaseo/protocol/messages";
|
|
5
5
|
import type { AgentPermissionRequest, AgentPermissionResponse, AgentPersistenceHandle, AgentProviderNotice, AgentProvider, AgentSessionConfig } from "@getpaseo/protocol/agent-types";
|
|
6
6
|
import type { MutableDaemonConfig, MutableDaemonConfigPatch } from "@getpaseo/protocol/messages";
|
|
7
7
|
import { type DaemonTransportFactory, type WebSocketFactory } from "./daemon-client-transport.js";
|
|
@@ -15,6 +15,7 @@ export interface Logger {
|
|
|
15
15
|
}
|
|
16
16
|
interface ImportAgentInputBase {
|
|
17
17
|
cwd?: string;
|
|
18
|
+
workspaceId?: string;
|
|
18
19
|
labels?: Record<string, string>;
|
|
19
20
|
}
|
|
20
21
|
export type ImportAgentInput = (ImportAgentInputBase & {
|
|
@@ -146,7 +147,7 @@ export interface CreateAgentRequestOptions extends AgentConfigOverrides {
|
|
|
146
147
|
requestId?: string;
|
|
147
148
|
labels?: Record<string, string>;
|
|
148
149
|
}
|
|
149
|
-
export interface CreatePaseoWorktreeInput extends Pick<CreatePaseoWorktreeRequest, "cwd" | "projectId" | "worktreeSlug" | "firstAgentContext" | "refName" | "action" | "githubPrNumber"> {
|
|
150
|
+
export interface CreatePaseoWorktreeInput extends Pick<CreatePaseoWorktreeRequest, "cwd" | "projectId" | "worktreeSlug" | "firstAgentContext" | "refName" | "action" | "checkoutSource" | "githubPrNumber"> {
|
|
150
151
|
}
|
|
151
152
|
type CheckoutStatusPayload = CheckoutStatusResponse["payload"];
|
|
152
153
|
type SubscribeCheckoutDiffPayload = Extract<SessionOutboundMessage, {
|
|
@@ -161,7 +162,9 @@ type CheckoutPushPayload = CheckoutPushResponse["payload"];
|
|
|
161
162
|
type CheckoutRefreshPayload = CheckoutRefreshResponse["payload"];
|
|
162
163
|
type CheckoutPrCreatePayload = CheckoutPrCreateResponse["payload"];
|
|
163
164
|
type CheckoutPrMergePayload = CheckoutPrMergeResponse["payload"];
|
|
165
|
+
type CheckoutForgeSetAutoMergePayload = CheckoutForgeSetAutoMergeResponse["payload"];
|
|
164
166
|
type CheckoutGithubSetAutoMergePayload = CheckoutGithubSetAutoMergeResponse["payload"];
|
|
167
|
+
type CheckoutForgeGetCheckDetailsPayload = CheckoutForgeGetCheckDetailsResponse["payload"];
|
|
165
168
|
type CheckoutGithubGetCheckDetailsPayload = CheckoutGithubGetCheckDetailsResponse["payload"];
|
|
166
169
|
type CheckoutPrStatusPayload = CheckoutPrStatusResponse["payload"];
|
|
167
170
|
type PullRequestTimelinePayload = PullRequestTimelineResponse["payload"];
|
|
@@ -172,6 +175,7 @@ type StashPopPayload = StashPopResponse["payload"];
|
|
|
172
175
|
type StashListPayload = StashListResponse["payload"];
|
|
173
176
|
type ValidateBranchPayload = ValidateBranchResponse["payload"];
|
|
174
177
|
type BranchSuggestionsPayload = BranchSuggestionsResponse["payload"];
|
|
178
|
+
type ForgeSearchPayload = ForgeSearchResponse["payload"];
|
|
175
179
|
type GitHubSearchPayload = GitHubSearchResponse["payload"];
|
|
176
180
|
type DirectorySuggestionsPayload = DirectorySuggestionsResponse["payload"];
|
|
177
181
|
type PaseoWorktreeListPayload = PaseoWorktreeListResponse["payload"];
|
|
@@ -733,6 +737,8 @@ export declare class DaemonClient {
|
|
|
733
737
|
setWorkspacePinned(workspaceId: string, pinned: boolean, requestId?: string): Promise<{
|
|
734
738
|
pinnedAt: string | null;
|
|
735
739
|
}>;
|
|
740
|
+
inspectWorkspaceRecovery(workspaceId: string, requestId?: string): Promise<WorkspaceRecoveryState>;
|
|
741
|
+
restoreWorkspace(workspaceId: string, requestId?: string): Promise<void>;
|
|
736
742
|
resumeAgent(handle: AgentPersistenceHandle, overrides?: Partial<AgentSessionConfig>): Promise<AgentSnapshotPayload>;
|
|
737
743
|
importAgent(input: ImportAgentInput): Promise<AgentSnapshotPayload>;
|
|
738
744
|
refreshAgent(agentId: string, requestId?: string): Promise<AgentRefreshedStatusPayload>;
|
|
@@ -799,6 +805,13 @@ export declare class DaemonClient {
|
|
|
799
805
|
checkoutPull(cwd: string, requestId?: string): Promise<CheckoutPullPayload>;
|
|
800
806
|
checkoutPush(cwd: string, requestId?: string): Promise<CheckoutPushPayload>;
|
|
801
807
|
checkoutRefresh(cwd: string, requestId?: string): Promise<CheckoutRefreshPayload>;
|
|
808
|
+
listCheckoutCommits(cwd: string, requestId?: string): Promise<{
|
|
809
|
+
baseRef: string | null;
|
|
810
|
+
commits: CheckoutCommit[];
|
|
811
|
+
}>;
|
|
812
|
+
getCommitFileDiff(cwd: string, sha: string, path: string, requestId?: string): Promise<{
|
|
813
|
+
file: ParsedDiffFile | null;
|
|
814
|
+
}>;
|
|
802
815
|
checkoutPrCreate(cwd: string, input: {
|
|
803
816
|
title?: string;
|
|
804
817
|
body?: string;
|
|
@@ -807,17 +820,31 @@ export declare class DaemonClient {
|
|
|
807
820
|
checkoutPrMerge(cwd: string, input: {
|
|
808
821
|
method: CheckoutPrMergeMethod;
|
|
809
822
|
}, requestId?: string): Promise<CheckoutPrMergePayload>;
|
|
823
|
+
checkoutForgeSetAutoMerge(cwd: string, input: {
|
|
824
|
+
enabled: true;
|
|
825
|
+
method: CheckoutPrMergeMethod;
|
|
826
|
+
} | {
|
|
827
|
+
enabled: false;
|
|
828
|
+
}, requestId?: string): Promise<CheckoutForgeSetAutoMergePayload>;
|
|
810
829
|
checkoutGithubSetAutoMerge(cwd: string, input: {
|
|
811
830
|
enabled: true;
|
|
812
831
|
method: CheckoutPrMergeMethod;
|
|
813
832
|
} | {
|
|
814
833
|
enabled: false;
|
|
815
834
|
}, requestId?: string): Promise<CheckoutGithubSetAutoMergePayload>;
|
|
835
|
+
checkoutForgeGetCheckDetails(input: {
|
|
836
|
+
cwd: string;
|
|
837
|
+
repoOwner?: string;
|
|
838
|
+
repoName?: string;
|
|
839
|
+
checkRunId?: number;
|
|
840
|
+
workflowRunId?: number;
|
|
841
|
+
changeRequestNumber?: number;
|
|
842
|
+
}, requestId?: string): Promise<CheckoutForgeGetCheckDetailsPayload>;
|
|
816
843
|
checkoutGithubGetCheckDetails(input: {
|
|
817
844
|
cwd: string;
|
|
818
|
-
repoOwner
|
|
819
|
-
repoName
|
|
820
|
-
checkRunId
|
|
845
|
+
repoOwner?: string;
|
|
846
|
+
repoName?: string;
|
|
847
|
+
checkRunId?: number;
|
|
821
848
|
workflowRunId?: number;
|
|
822
849
|
}, requestId?: string): Promise<CheckoutGithubGetCheckDetailsPayload>;
|
|
823
850
|
checkoutPrStatus(cwd: string, requestId?: string): Promise<CheckoutPrStatusPayload>;
|
|
@@ -862,6 +889,12 @@ export declare class DaemonClient {
|
|
|
862
889
|
query?: string;
|
|
863
890
|
limit?: number;
|
|
864
891
|
}, requestId?: string): Promise<BranchSuggestionsPayload>;
|
|
892
|
+
searchForge(options: {
|
|
893
|
+
cwd: string;
|
|
894
|
+
query: string;
|
|
895
|
+
limit?: number;
|
|
896
|
+
kinds?: ForgeSearchRequest["kinds"];
|
|
897
|
+
}, requestId?: string): Promise<ForgeSearchPayload>;
|
|
865
898
|
searchGitHub(options: {
|
|
866
899
|
cwd: string;
|
|
867
900
|
query: string;
|
|
@@ -1015,6 +1048,7 @@ export declare class DaemonClient {
|
|
|
1015
1048
|
private recordLivenessFailure;
|
|
1016
1049
|
private handleSessionMessage;
|
|
1017
1050
|
private resolveWaiters;
|
|
1051
|
+
private rejectWaitersForRequestId;
|
|
1018
1052
|
private clearWaiters;
|
|
1019
1053
|
private toEvent;
|
|
1020
1054
|
private waitForWithCancel;
|
package/dist/daemon-client.js
CHANGED
|
@@ -24,6 +24,34 @@ function normalizePassword(value) {
|
|
|
24
24
|
}
|
|
25
25
|
return value.length > 0 ? value : null;
|
|
26
26
|
}
|
|
27
|
+
function extractCorrelatedResponseIdentity(input) {
|
|
28
|
+
if (!input || typeof input !== "object") {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const envelope = input;
|
|
32
|
+
if (envelope.type !== "session" || !envelope.message || typeof envelope.message !== "object") {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const message = envelope.message;
|
|
36
|
+
if (typeof message.type !== "string" ||
|
|
37
|
+
!(message.type === "rpc_error" ||
|
|
38
|
+
message.type.endsWith("_response") ||
|
|
39
|
+
message.type.endsWith(".response") ||
|
|
40
|
+
message.type.endsWith("/response"))) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
if (!message.payload || typeof message.payload !== "object") {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const payload = message.payload;
|
|
47
|
+
if (typeof payload.requestId !== "string") {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
requestId: payload.requestId,
|
|
52
|
+
responseType: message.type,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
27
55
|
// COMPAT(daemon-client-object-options): added in v0.1.102; remove after
|
|
28
56
|
// 2026-12-29 once SDK callers have migrated to object parameters.
|
|
29
57
|
function normalizeFetchAgentOptions(input, legacyOptions) {
|
|
@@ -58,6 +86,16 @@ class DaemonRpcError extends Error {
|
|
|
58
86
|
this.code = params.code;
|
|
59
87
|
}
|
|
60
88
|
}
|
|
89
|
+
class DaemonProtocolError extends Error {
|
|
90
|
+
constructor(identity) {
|
|
91
|
+
const responseLabel = identity.responseType ?? "unknown response";
|
|
92
|
+
super(`Response validation failed for ${responseLabel}`);
|
|
93
|
+
this.code = "invalid_response";
|
|
94
|
+
this.name = "DaemonProtocolError";
|
|
95
|
+
this.requestId = identity.requestId;
|
|
96
|
+
this.responseType = identity.responseType;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
61
99
|
class PingTimeoutError extends Error {
|
|
62
100
|
constructor(timeoutMs) {
|
|
63
101
|
super(`Ping timed out (${timeoutMs}ms)`);
|
|
@@ -645,7 +683,7 @@ export class DaemonClient {
|
|
|
645
683
|
return null;
|
|
646
684
|
}
|
|
647
685
|
return { kind: "ok", value };
|
|
648
|
-
}, timeout, params.options);
|
|
686
|
+
}, timeout, { ...params.options, requestId: params.requestId });
|
|
649
687
|
try {
|
|
650
688
|
await this.sendSessionMessageOrThrow(params.message);
|
|
651
689
|
}
|
|
@@ -1339,6 +1377,29 @@ export class DaemonClient {
|
|
|
1339
1377
|
}
|
|
1340
1378
|
return { pinnedAt: payload.pinnedAt };
|
|
1341
1379
|
}
|
|
1380
|
+
async inspectWorkspaceRecovery(workspaceId, requestId) {
|
|
1381
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
1382
|
+
requestId,
|
|
1383
|
+
message: {
|
|
1384
|
+
type: "workspace.recovery.inspect.request",
|
|
1385
|
+
workspaceId,
|
|
1386
|
+
},
|
|
1387
|
+
});
|
|
1388
|
+
return payload.state;
|
|
1389
|
+
}
|
|
1390
|
+
async restoreWorkspace(workspaceId, requestId) {
|
|
1391
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
1392
|
+
requestId,
|
|
1393
|
+
message: {
|
|
1394
|
+
type: "workspace.recovery.restore.request",
|
|
1395
|
+
workspaceId,
|
|
1396
|
+
},
|
|
1397
|
+
timeout: 150000,
|
|
1398
|
+
});
|
|
1399
|
+
if (!payload.accepted) {
|
|
1400
|
+
throw new Error(payload.error ?? "Workspace recovery was rejected by the host");
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1342
1403
|
async resumeAgent(handle, overrides) {
|
|
1343
1404
|
const requestId = this.createRequestId();
|
|
1344
1405
|
const message = SessionInboundMessageSchema.parse({
|
|
@@ -1373,6 +1434,7 @@ export class DaemonClient {
|
|
|
1373
1434
|
? { providerId: input.providerId, providerHandleId: input.providerHandleId }
|
|
1374
1435
|
: { provider: input.provider, sessionId: input.sessionId }),
|
|
1375
1436
|
...(input.cwd ? { cwd: input.cwd } : {}),
|
|
1437
|
+
...(input.workspaceId ? { workspaceId: input.workspaceId } : {}),
|
|
1376
1438
|
...(input.labels && Object.keys(input.labels).length > 0 ? { labels: input.labels } : {}),
|
|
1377
1439
|
});
|
|
1378
1440
|
const status = await this.sendRequest({
|
|
@@ -2197,6 +2259,36 @@ export class DaemonClient {
|
|
|
2197
2259
|
responseType: "checkout.refresh.response",
|
|
2198
2260
|
});
|
|
2199
2261
|
}
|
|
2262
|
+
async listCheckoutCommits(cwd, requestId) {
|
|
2263
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
2264
|
+
requestId,
|
|
2265
|
+
message: {
|
|
2266
|
+
type: "checkout.commits.list.request",
|
|
2267
|
+
cwd,
|
|
2268
|
+
},
|
|
2269
|
+
timeout: 60000,
|
|
2270
|
+
});
|
|
2271
|
+
if (payload.error) {
|
|
2272
|
+
throw new Error(payload.error.message);
|
|
2273
|
+
}
|
|
2274
|
+
return { baseRef: payload.baseRef, commits: payload.commits };
|
|
2275
|
+
}
|
|
2276
|
+
async getCommitFileDiff(cwd, sha, path, requestId) {
|
|
2277
|
+
const payload = await this.sendNamespacedCorrelatedSessionRequest({
|
|
2278
|
+
requestId,
|
|
2279
|
+
message: {
|
|
2280
|
+
type: "checkout.commits.file_diff.request",
|
|
2281
|
+
cwd,
|
|
2282
|
+
sha,
|
|
2283
|
+
path,
|
|
2284
|
+
},
|
|
2285
|
+
timeout: 60000,
|
|
2286
|
+
});
|
|
2287
|
+
if (payload.error) {
|
|
2288
|
+
throw new Error(payload.error.message);
|
|
2289
|
+
}
|
|
2290
|
+
return { file: payload.file };
|
|
2291
|
+
}
|
|
2200
2292
|
async checkoutPrCreate(cwd, input, requestId) {
|
|
2201
2293
|
return this.sendCorrelatedSessionRequest({
|
|
2202
2294
|
requestId,
|
|
@@ -2221,6 +2313,18 @@ export class DaemonClient {
|
|
|
2221
2313
|
responseType: "checkout_pr_merge_response",
|
|
2222
2314
|
});
|
|
2223
2315
|
}
|
|
2316
|
+
async checkoutForgeSetAutoMerge(cwd, input, requestId) {
|
|
2317
|
+
return this.sendNamespacedCorrelatedSessionRequest({
|
|
2318
|
+
requestId,
|
|
2319
|
+
message: {
|
|
2320
|
+
type: "checkout.forge.set_auto_merge.request",
|
|
2321
|
+
cwd,
|
|
2322
|
+
enabled: input.enabled,
|
|
2323
|
+
...(input.enabled ? { mergeMethod: input.method } : {}),
|
|
2324
|
+
},
|
|
2325
|
+
timeout: 60000,
|
|
2326
|
+
});
|
|
2327
|
+
}
|
|
2224
2328
|
async checkoutGithubSetAutoMerge(cwd, input, requestId) {
|
|
2225
2329
|
return this.sendNamespacedCorrelatedSessionRequest({
|
|
2226
2330
|
requestId,
|
|
@@ -2232,6 +2336,21 @@ export class DaemonClient {
|
|
|
2232
2336
|
},
|
|
2233
2337
|
});
|
|
2234
2338
|
}
|
|
2339
|
+
async checkoutForgeGetCheckDetails(input, requestId) {
|
|
2340
|
+
return this.sendNamespacedCorrelatedSessionRequest({
|
|
2341
|
+
requestId,
|
|
2342
|
+
message: {
|
|
2343
|
+
type: "checkout.forge.get_check_details.request",
|
|
2344
|
+
cwd: input.cwd,
|
|
2345
|
+
repoOwner: input.repoOwner,
|
|
2346
|
+
repoName: input.repoName,
|
|
2347
|
+
checkRunId: input.checkRunId,
|
|
2348
|
+
workflowRunId: input.workflowRunId,
|
|
2349
|
+
changeRequestNumber: input.changeRequestNumber,
|
|
2350
|
+
},
|
|
2351
|
+
timeout: 60000,
|
|
2352
|
+
});
|
|
2353
|
+
}
|
|
2235
2354
|
async checkoutGithubGetCheckDetails(input, requestId) {
|
|
2236
2355
|
return this.sendNamespacedCorrelatedSessionRequest({
|
|
2237
2356
|
requestId,
|
|
@@ -2361,6 +2480,7 @@ export class DaemonClient {
|
|
|
2361
2480
|
: {}),
|
|
2362
2481
|
...(input.refName !== undefined ? { refName: input.refName } : {}),
|
|
2363
2482
|
...(input.action !== undefined ? { action: input.action } : {}),
|
|
2483
|
+
...(input.checkoutSource !== undefined ? { checkoutSource: input.checkoutSource } : {}),
|
|
2364
2484
|
...(input.githubPrNumber !== undefined ? { githubPrNumber: input.githubPrNumber } : {}),
|
|
2365
2485
|
},
|
|
2366
2486
|
responseType: "create_paseo_worktree_response",
|
|
@@ -2403,6 +2523,20 @@ export class DaemonClient {
|
|
|
2403
2523
|
responseType: "branch_suggestions_response",
|
|
2404
2524
|
});
|
|
2405
2525
|
}
|
|
2526
|
+
async searchForge(options, requestId) {
|
|
2527
|
+
return this.sendCorrelatedSessionRequest({
|
|
2528
|
+
requestId,
|
|
2529
|
+
message: {
|
|
2530
|
+
type: "forge.search.request",
|
|
2531
|
+
cwd: options.cwd,
|
|
2532
|
+
query: options.query,
|
|
2533
|
+
limit: options.limit,
|
|
2534
|
+
kinds: options.kinds,
|
|
2535
|
+
},
|
|
2536
|
+
responseType: "forge.search.response",
|
|
2537
|
+
timeout: 15000,
|
|
2538
|
+
});
|
|
2539
|
+
}
|
|
2406
2540
|
async searchGitHub(options, requestId) {
|
|
2407
2541
|
return this.sendCorrelatedSessionRequest({
|
|
2408
2542
|
requestId,
|
|
@@ -3427,13 +3561,18 @@ export class DaemonClient {
|
|
|
3427
3561
|
}
|
|
3428
3562
|
const parsed = validateWSOutboundMessage(parsedJson);
|
|
3429
3563
|
if (!parsed.success) {
|
|
3430
|
-
const
|
|
3564
|
+
const responseIdentity = extractCorrelatedResponseIdentity(parsedJson);
|
|
3565
|
+
const envelopeType = parsedJson != null &&
|
|
3431
3566
|
typeof parsedJson === "object" &&
|
|
3432
3567
|
"type" in parsedJson &&
|
|
3433
3568
|
typeof parsedJson.type === "string"
|
|
3434
3569
|
? parsedJson.type
|
|
3435
3570
|
: "unknown";
|
|
3571
|
+
const msgType = responseIdentity?.responseType ?? envelopeType;
|
|
3436
3572
|
this.logger.warn({ msgType, error: parsed.error.message }, "Message validation failed");
|
|
3573
|
+
if (responseIdentity) {
|
|
3574
|
+
this.rejectWaitersForRequestId(responseIdentity.requestId, new DaemonProtocolError(responseIdentity));
|
|
3575
|
+
}
|
|
3437
3576
|
return;
|
|
3438
3577
|
}
|
|
3439
3578
|
this.consecutiveLivenessFailures = 0;
|
|
@@ -3707,6 +3846,18 @@ export class DaemonClient {
|
|
|
3707
3846
|
}
|
|
3708
3847
|
}
|
|
3709
3848
|
}
|
|
3849
|
+
rejectWaitersForRequestId(requestId, error) {
|
|
3850
|
+
for (const waiter of Array.from(this.waiters)) {
|
|
3851
|
+
if (waiter.requestId !== requestId) {
|
|
3852
|
+
continue;
|
|
3853
|
+
}
|
|
3854
|
+
this.waiters.delete(waiter);
|
|
3855
|
+
if (waiter.timeoutHandle) {
|
|
3856
|
+
clearTimeout(waiter.timeoutHandle);
|
|
3857
|
+
}
|
|
3858
|
+
waiter.reject(error);
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3710
3861
|
clearWaiters(error) {
|
|
3711
3862
|
for (const waiter of Array.from(this.waiters)) {
|
|
3712
3863
|
if (waiter.timeoutHandle) {
|
|
@@ -3771,7 +3922,7 @@ export class DaemonClient {
|
|
|
3771
3922
|
return null;
|
|
3772
3923
|
}
|
|
3773
3924
|
}
|
|
3774
|
-
waitForWithCancel(predicate, timeout = 30000,
|
|
3925
|
+
waitForWithCancel(predicate, timeout = 30000, options) {
|
|
3775
3926
|
// Capture stack trace at call site, not inside setTimeout
|
|
3776
3927
|
const timeoutError = new Error(`Timeout waiting for message (${timeout}ms)`);
|
|
3777
3928
|
let waiter = null;
|
|
@@ -3804,6 +3955,7 @@ export class DaemonClient {
|
|
|
3804
3955
|
resolve: wrappedResolve,
|
|
3805
3956
|
reject: wrappedReject,
|
|
3806
3957
|
timeoutHandle,
|
|
3958
|
+
requestId: options?.requestId,
|
|
3807
3959
|
};
|
|
3808
3960
|
this.waiters.add(waiter);
|
|
3809
3961
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpaseo/client",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.0-beta.1",
|
|
4
4
|
"description": "Paseo client SDK package",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"test": "vitest run"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@getpaseo/protocol": "0.1
|
|
39
|
-
"@getpaseo/relay": "0.1
|
|
38
|
+
"@getpaseo/protocol": "0.2.0-beta.1",
|
|
39
|
+
"@getpaseo/relay": "0.2.0-beta.1",
|
|
40
40
|
"zod": "^4.4.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|