dexto 1.14.5 → 2.0.0-beta.0
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/cli/auth/billing.d.ts +0 -6
- package/dist/cli/auth/billing.d.ts.map +1 -1
- package/dist/cli/auth/billing.js +0 -23
- package/dist/cli/auth/constants.d.ts +3 -31
- package/dist/cli/auth/constants.d.ts.map +1 -1
- package/dist/cli/auth/constants.js +9 -33
- package/dist/cli/auth/index.d.ts +2 -9
- package/dist/cli/auth/index.d.ts.map +1 -1
- package/dist/cli/auth/index.js +2 -7
- package/dist/cli/auth/sign-in-runtime.d.ts +12 -0
- package/dist/cli/auth/sign-in-runtime.d.ts.map +1 -0
- package/dist/cli/auth/sign-in-runtime.js +59 -0
- package/dist/cli/cloud/app-scopes.d.ts +4 -0
- package/dist/cli/cloud/app-scopes.d.ts.map +1 -0
- package/dist/cli/cloud/app-scopes.js +19 -0
- package/dist/cli/cloud/command.d.ts +143 -0
- package/dist/cli/cloud/command.d.ts.map +1 -0
- package/dist/cli/cloud/command.js +202 -0
- package/dist/cli/cloud/commands/account.d.ts +11 -0
- package/dist/cli/cloud/commands/account.d.ts.map +1 -0
- package/dist/cli/cloud/commands/account.js +128 -0
- package/dist/cli/cloud/commands/agents.d.ts +3 -0
- package/dist/cli/cloud/commands/agents.d.ts.map +1 -0
- package/dist/cli/cloud/commands/agents.js +524 -0
- package/dist/cli/cloud/commands/api.d.ts +3 -0
- package/dist/cli/cloud/commands/api.d.ts.map +1 -0
- package/dist/cli/cloud/commands/api.js +26 -0
- package/dist/cli/cloud/commands/app-files.d.ts +29 -0
- package/dist/cli/cloud/commands/app-files.d.ts.map +1 -0
- package/dist/cli/cloud/commands/app-files.js +72 -0
- package/dist/cli/cloud/commands/automations.d.ts +3 -0
- package/dist/cli/cloud/commands/automations.d.ts.map +1 -0
- package/dist/cli/cloud/commands/automations.js +232 -0
- package/dist/cli/cloud/commands/chats.d.ts +3 -0
- package/dist/cli/cloud/commands/chats.d.ts.map +1 -0
- package/dist/cli/cloud/commands/chats.js +189 -0
- package/dist/cli/cloud/commands/data-deletions.d.ts +3 -0
- package/dist/cli/cloud/commands/data-deletions.d.ts.map +1 -0
- package/dist/cli/cloud/commands/data-deletions.js +54 -0
- package/dist/cli/cloud/commands/deploys.d.ts +10 -0
- package/dist/cli/cloud/commands/deploys.d.ts.map +1 -0
- package/dist/cli/cloud/commands/deploys.js +223 -0
- package/dist/cli/cloud/commands/drive.d.ts +12 -0
- package/dist/cli/cloud/commands/drive.d.ts.map +1 -0
- package/dist/cli/cloud/commands/drive.js +320 -0
- package/dist/cli/cloud/commands/files.d.ts +24 -0
- package/dist/cli/cloud/commands/files.d.ts.map +1 -0
- package/dist/cli/cloud/commands/files.js +282 -0
- package/dist/cli/cloud/commands/find.d.ts +3 -0
- package/dist/cli/cloud/commands/find.d.ts.map +1 -0
- package/dist/cli/cloud/commands/find.js +63 -0
- package/dist/cli/cloud/commands/models.d.ts +3 -0
- package/dist/cli/cloud/commands/models.d.ts.map +1 -0
- package/dist/cli/cloud/commands/models.js +248 -0
- package/dist/cli/cloud/commands/profile.d.ts +3 -0
- package/dist/cli/cloud/commands/profile.d.ts.map +1 -0
- package/dist/cli/cloud/commands/profile.js +119 -0
- package/dist/cli/cloud/commands/projects.d.ts +5 -0
- package/dist/cli/cloud/commands/projects.d.ts.map +1 -0
- package/dist/cli/cloud/commands/projects.js +66 -0
- package/dist/cli/cloud/commands/publish.d.ts +3 -0
- package/dist/cli/cloud/commands/publish.d.ts.map +1 -0
- package/dist/cli/cloud/commands/publish.js +138 -0
- package/dist/cli/cloud/commands/sandboxes.d.ts +3 -0
- package/dist/cli/cloud/commands/sandboxes.d.ts.map +1 -0
- package/dist/cli/cloud/commands/sandboxes.js +265 -0
- package/dist/cli/cloud/commands/secrets.d.ts +3 -0
- package/dist/cli/cloud/commands/secrets.d.ts.map +1 -0
- package/dist/cli/cloud/commands/secrets.js +110 -0
- package/dist/cli/cloud/commands/skills.d.ts +3 -0
- package/dist/cli/cloud/commands/skills.d.ts.map +1 -0
- package/dist/cli/cloud/commands/skills.js +202 -0
- package/dist/cli/cloud/commands/web.d.ts +3 -0
- package/dist/cli/cloud/commands/web.d.ts.map +1 -0
- package/dist/cli/cloud/commands/web.js +53 -0
- package/dist/cli/cloud/commands/workspace-apps.d.ts +58 -0
- package/dist/cli/cloud/commands/workspace-apps.d.ts.map +1 -0
- package/dist/cli/cloud/commands/workspace-apps.js +656 -0
- package/dist/cli/cloud/commands/workspace.d.ts +36 -0
- package/dist/cli/cloud/commands/workspace.d.ts.map +1 -0
- package/dist/cli/cloud/commands/workspace.js +279 -0
- package/dist/cli/cloud/connection.d.ts +33 -0
- package/dist/cli/cloud/connection.d.ts.map +1 -0
- package/dist/cli/cloud/connection.js +38 -0
- package/dist/cli/cloud/events.d.ts +63 -0
- package/dist/cli/cloud/events.d.ts.map +1 -0
- package/dist/cli/cloud/events.js +72 -0
- package/dist/cli/cloud/host.d.ts +9 -0
- package/dist/cli/cloud/host.d.ts.map +1 -0
- package/dist/cli/cloud/host.js +105 -0
- package/dist/cli/cloud/local-chats.d.ts +73 -0
- package/dist/cli/cloud/local-chats.d.ts.map +1 -0
- package/dist/cli/cloud/local-chats.js +441 -0
- package/dist/cli/cloud/output.d.ts +34 -0
- package/dist/cli/cloud/output.d.ts.map +1 -0
- package/dist/cli/cloud/output.js +76 -0
- package/dist/cli/cloud/run.d.ts +26 -0
- package/dist/cli/cloud/run.d.ts.map +1 -0
- package/dist/cli/cloud/run.js +444 -0
- package/dist/cli/cloud/runtime.d.ts +33 -0
- package/dist/cli/cloud/runtime.d.ts.map +1 -0
- package/dist/cli/cloud/runtime.js +86 -0
- package/dist/cli/cloud/tar.d.ts +9 -0
- package/dist/cli/cloud/tar.d.ts.map +1 -0
- package/dist/cli/cloud/tar.js +69 -0
- package/dist/cli/cloud/transfer.d.ts +13 -0
- package/dist/cli/cloud/transfer.d.ts.map +1 -0
- package/dist/cli/cloud/transfer.js +35 -0
- package/dist/cli/cloud/v1.d.ts +19 -0
- package/dist/cli/cloud/v1.d.ts.map +1 -0
- package/dist/cli/cloud/v1.js +65 -0
- package/dist/cli/cloud/zip.d.ts +8 -0
- package/dist/cli/cloud/zip.d.ts.map +1 -0
- package/dist/cli/cloud/zip.js +66 -0
- package/dist/cli/commands/auth/sign-in-commands.d.ts +62 -0
- package/dist/cli/commands/auth/sign-in-commands.d.ts.map +1 -0
- package/dist/cli/commands/auth/sign-in-commands.js +247 -0
- package/dist/cli/commands/auth/sign-in-context.d.ts +16 -0
- package/dist/cli/commands/auth/sign-in-context.d.ts.map +1 -0
- package/dist/cli/commands/auth/sign-in-context.js +68 -0
- package/dist/cli/commands/cloud/register.d.ts +5 -0
- package/dist/cli/commands/cloud/register.d.ts.map +1 -1
- package/dist/cli/commands/cloud/register.js +42 -24
- package/dist/cli/commands/create-app.js +5 -6
- package/dist/cli/commands/create-image.d.ts.map +1 -1
- package/dist/cli/commands/create-image.js +9 -10
- package/dist/cli/commands/index.d.ts +0 -2
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +0 -2
- package/dist/cli/commands/init.d.ts +0 -2
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +5 -26
- package/dist/cli/commands/run/headless.js +2 -2
- package/dist/cli/commands/run/output.d.ts +29 -10
- package/dist/cli/commands/run/output.d.ts.map +1 -1
- package/dist/cli/commands/run/output.js +44 -22
- package/dist/cli/commands/run/register.d.ts.map +1 -1
- package/dist/cli/commands/run/register.js +21 -9
- package/dist/cli/commands/session/register.d.ts.map +1 -1
- package/dist/cli/commands/session/register.js +51 -21
- package/dist/cli/commands/session-commands.js +1 -1
- package/dist/cli/commands/setup.js +17 -14
- package/dist/cli/help-json.d.ts +22 -0
- package/dist/cli/help-json.d.ts.map +1 -0
- package/dist/cli/help-json.js +20 -0
- package/dist/cli/modes/cli.d.ts.map +1 -1
- package/dist/cli/modes/cli.js +42 -9
- package/dist/cli/modes/server.js +8 -8
- package/dist/cli/modes/web.js +3 -3
- package/dist/cli/utils/dexto-auth-check.d.ts +1 -1
- package/dist/cli/utils/dexto-auth-check.d.ts.map +1 -1
- package/dist/cli/utils/dexto-auth-check.js +4 -5
- package/dist/cli/utils/dexto-setup.d.ts +4 -5
- package/dist/cli/utils/dexto-setup.d.ts.map +1 -1
- package/dist/cli/utils/dexto-setup.js +17 -14
- package/dist/cli/utils/provider-setup.js +1 -1
- package/dist/cli/utils/scaffolding-utils.d.ts +9 -3
- package/dist/cli/utils/scaffolding-utils.d.ts.map +1 -1
- package/dist/cli/utils/scaffolding-utils.js +48 -40
- package/dist/cli/utils/version-check.d.ts.map +1 -1
- package/dist/cli/utils/version-check.js +2 -1
- package/dist/index-main.js +33 -65
- package/dist/webui/assets/index-D9xiOs62.js +1649 -0
- package/dist/webui/index.html +1 -1
- package/package.json +15 -14
- package/dist/cli/auth/api-client.d.ts +0 -125
- package/dist/cli/auth/api-client.d.ts.map +0 -1
- package/dist/cli/auth/api-client.js +0 -585
- package/dist/cli/auth/device.d.ts +0 -14
- package/dist/cli/auth/device.d.ts.map +0 -1
- package/dist/cli/auth/device.js +0 -84
- package/dist/cli/auth/dexto-api-key.d.ts +0 -34
- package/dist/cli/auth/dexto-api-key.d.ts.map +0 -1
- package/dist/cli/auth/dexto-api-key.js +0 -160
- package/dist/cli/auth/login-persistence.d.ts +0 -15
- package/dist/cli/auth/login-persistence.d.ts.map +0 -1
- package/dist/cli/auth/login-persistence.js +0 -72
- package/dist/cli/auth/oauth.d.ts +0 -39
- package/dist/cli/auth/oauth.d.ts.map +0 -1
- package/dist/cli/auth/oauth.js +0 -434
- package/dist/cli/auth/service.d.ts +0 -24
- package/dist/cli/auth/service.d.ts.map +0 -1
- package/dist/cli/auth/service.js +0 -161
- package/dist/cli/auth/types.d.ts +0 -11
- package/dist/cli/auth/types.d.ts.map +0 -1
- package/dist/cli/auth/types.js +0 -1
- package/dist/cli/cloud-chat.d.ts +0 -18
- package/dist/cli/cloud-chat.d.ts.map +0 -1
- package/dist/cli/cloud-chat.js +0 -734
- package/dist/cli/commands/auth/index.d.ts +0 -4
- package/dist/cli/commands/auth/index.d.ts.map +0 -1
- package/dist/cli/commands/auth/index.js +0 -4
- package/dist/cli/commands/auth/login.d.ts +0 -12
- package/dist/cli/commands/auth/login.d.ts.map +0 -1
- package/dist/cli/commands/auth/login.js +0 -153
- package/dist/cli/commands/auth/logout.d.ts +0 -5
- package/dist/cli/commands/auth/logout.d.ts.map +0 -1
- package/dist/cli/commands/auth/logout.js +0 -81
- package/dist/cli/commands/auth/register.d.ts +0 -3
- package/dist/cli/commands/auth/register.d.ts.map +0 -1
- package/dist/cli/commands/auth/register.js +0 -96
- package/dist/cli/commands/auth/status.d.ts +0 -2
- package/dist/cli/commands/auth/status.d.ts.map +0 -1
- package/dist/cli/commands/auth/status.js +0 -22
- package/dist/cli/commands/billing/index.d.ts +0 -2
- package/dist/cli/commands/billing/index.d.ts.map +0 -1
- package/dist/cli/commands/billing/index.js +0 -2
- package/dist/cli/commands/billing/register.d.ts +0 -3
- package/dist/cli/commands/billing/register.d.ts.map +0 -1
- package/dist/cli/commands/billing/register.js +0 -20
- package/dist/cli/commands/billing/status.d.ts +0 -8
- package/dist/cli/commands/billing/status.d.ts.map +0 -1
- package/dist/cli/commands/billing/status.js +0 -71
- package/dist/cli/commands/cloud/discovery.d.ts +0 -17
- package/dist/cli/commands/cloud/discovery.d.ts.map +0 -1
- package/dist/cli/commands/cloud/discovery.js +0 -88
- package/dist/cli/commands/deploy/client.d.ts +0 -113
- package/dist/cli/commands/deploy/client.d.ts.map +0 -1
- package/dist/cli/commands/deploy/client.js +0 -519
- package/dist/cli/commands/deploy/config.d.ts +0 -37
- package/dist/cli/commands/deploy/config.d.ts.map +0 -1
- package/dist/cli/commands/deploy/config.js +0 -144
- package/dist/cli/commands/deploy/entry-agent.d.ts +0 -3
- package/dist/cli/commands/deploy/entry-agent.d.ts.map +0 -1
- package/dist/cli/commands/deploy/entry-agent.js +0 -70
- package/dist/cli/commands/deploy/index.d.ts +0 -12
- package/dist/cli/commands/deploy/index.d.ts.map +0 -1
- package/dist/cli/commands/deploy/index.js +0 -370
- package/dist/cli/commands/deploy/links.d.ts +0 -3
- package/dist/cli/commands/deploy/links.d.ts.map +0 -1
- package/dist/cli/commands/deploy/links.js +0 -53
- package/dist/cli/commands/deploy/register.d.ts +0 -6
- package/dist/cli/commands/deploy/register.d.ts.map +0 -1
- package/dist/cli/commands/deploy/register.js +0 -128
- package/dist/cli/commands/deploy/snapshot.d.ts +0 -12
- package/dist/cli/commands/deploy/snapshot.d.ts.map +0 -1
- package/dist/cli/commands/deploy/snapshot.js +0 -76
- package/dist/cli/commands/deploy/state.d.ts +0 -13
- package/dist/cli/commands/deploy/state.d.ts.map +0 -1
- package/dist/cli/commands/deploy/state.js +0 -122
- package/dist/cli/commands/span/register.d.ts +0 -6
- package/dist/cli/commands/span/register.d.ts.map +0 -1
- package/dist/cli/commands/span/register.js +0 -25
- package/dist/cli/commands/trace/client.d.ts +0 -98
- package/dist/cli/commands/trace/client.d.ts.map +0 -1
- package/dist/cli/commands/trace/client.js +0 -150
- package/dist/cli/commands/trace/format.d.ts +0 -5
- package/dist/cli/commands/trace/format.d.ts.map +0 -1
- package/dist/cli/commands/trace/format.js +0 -58
- package/dist/cli/commands/trace/index.d.ts +0 -21
- package/dist/cli/commands/trace/index.d.ts.map +0 -1
- package/dist/cli/commands/trace/index.js +0 -49
- package/dist/cli/commands/trace/register.d.ts +0 -6
- package/dist/cli/commands/trace/register.d.ts.map +0 -1
- package/dist/cli/commands/trace/register.js +0 -71
- package/dist/webui/assets/index-DEfRFmFT.js +0 -1667
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import type { StreamingEvent } from '@dexto/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import type { DeployAgent } from './config.js';
|
|
4
|
-
declare const CloudAgentStateSchema: z.ZodObject<{
|
|
5
|
-
status: z.ZodString;
|
|
6
|
-
}, z.core.$loose>;
|
|
7
|
-
declare const CloudChatContentPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
8
|
-
type: z.ZodLiteral<"text">;
|
|
9
|
-
text: z.ZodString;
|
|
10
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
11
|
-
type: z.ZodLiteral<"image">;
|
|
12
|
-
image: z.ZodString;
|
|
13
|
-
mimeType: z.ZodOptional<z.ZodString>;
|
|
14
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
15
|
-
type: z.ZodLiteral<"file">;
|
|
16
|
-
data: z.ZodString;
|
|
17
|
-
mimeType: z.ZodString;
|
|
18
|
-
filename: z.ZodOptional<z.ZodString>;
|
|
19
|
-
}, z.core.$strict>], "type">;
|
|
20
|
-
export interface DeployCloudAgentResult {
|
|
21
|
-
cloudAgentId: string;
|
|
22
|
-
agentUrl: string;
|
|
23
|
-
state: z.output<typeof CloudAgentStateSchema>;
|
|
24
|
-
}
|
|
25
|
-
export interface CloudAgentStatusResult {
|
|
26
|
-
cloudAgentId: string;
|
|
27
|
-
agentUrl: string;
|
|
28
|
-
state: z.output<typeof CloudAgentStateSchema>;
|
|
29
|
-
stale: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface CloudAgentListItemResult {
|
|
32
|
-
cloudAgentId: string;
|
|
33
|
-
name: string | null;
|
|
34
|
-
agentUrl: string;
|
|
35
|
-
state: z.output<typeof CloudAgentStateSchema>;
|
|
36
|
-
}
|
|
37
|
-
export interface CloudAgentStopResult {
|
|
38
|
-
cloudAgentId: string;
|
|
39
|
-
agentUrl: string;
|
|
40
|
-
stopped: boolean;
|
|
41
|
-
alreadyStopped: boolean;
|
|
42
|
-
snapshotStatus: string;
|
|
43
|
-
}
|
|
44
|
-
export interface CloudAgentDeleteResult {
|
|
45
|
-
cloudAgentId: string;
|
|
46
|
-
agentUrl: string;
|
|
47
|
-
}
|
|
48
|
-
export interface CloudChatSessionResult {
|
|
49
|
-
id: string;
|
|
50
|
-
createdAt: number | null;
|
|
51
|
-
lastActivity: number | null;
|
|
52
|
-
messageCount: number;
|
|
53
|
-
title: string | null;
|
|
54
|
-
workspaceId: string | null;
|
|
55
|
-
parentSessionId: string | null;
|
|
56
|
-
}
|
|
57
|
-
export interface CloudChatHistoryMessageResult {
|
|
58
|
-
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
59
|
-
content: z.output<typeof CloudChatContentPartSchema>[];
|
|
60
|
-
timestamp?: number;
|
|
61
|
-
name?: string;
|
|
62
|
-
toolCallId?: string;
|
|
63
|
-
success?: boolean;
|
|
64
|
-
reasoning?: string;
|
|
65
|
-
model?: string;
|
|
66
|
-
provider?: string;
|
|
67
|
-
}
|
|
68
|
-
export interface CloudChatHistoryResult {
|
|
69
|
-
history: CloudChatHistoryMessageResult[];
|
|
70
|
-
isBusy: boolean;
|
|
71
|
-
stale: boolean;
|
|
72
|
-
}
|
|
73
|
-
export interface CloudChatApprovalDecision {
|
|
74
|
-
status: 'approved' | 'denied' | 'cancelled';
|
|
75
|
-
formData?: Record<string, unknown>;
|
|
76
|
-
rememberChoice?: boolean;
|
|
77
|
-
reason?: string;
|
|
78
|
-
message?: string;
|
|
79
|
-
}
|
|
80
|
-
export declare function resolveSandboxBaseUrl(): string;
|
|
81
|
-
export declare function createDeployClient(): {
|
|
82
|
-
deployWorkspace(input: {
|
|
83
|
-
agent: DeployAgent;
|
|
84
|
-
snapshotPath: string;
|
|
85
|
-
cloudAgentId?: string;
|
|
86
|
-
}): Promise<DeployCloudAgentResult>;
|
|
87
|
-
getCloudAgent(cloudAgentId: string): Promise<CloudAgentStatusResult>;
|
|
88
|
-
listCloudAgents(): Promise<CloudAgentListItemResult[]>;
|
|
89
|
-
stopCloudAgent(cloudAgentId: string): Promise<CloudAgentStopResult>;
|
|
90
|
-
deleteCloudAgent(cloudAgentId: string): Promise<CloudAgentDeleteResult>;
|
|
91
|
-
listCloudAgentSessions(cloudAgentId: string): Promise<CloudChatSessionResult[]>;
|
|
92
|
-
createCloudAgentSession(cloudAgentId: string, input?: {
|
|
93
|
-
sessionId?: string;
|
|
94
|
-
}): Promise<CloudChatSessionResult>;
|
|
95
|
-
getCloudAgentSessionHistory(cloudAgentId: string, sessionId: string): Promise<CloudChatHistoryResult>;
|
|
96
|
-
resetCloudAgentSession(cloudAgentId: string, sessionId: string): Promise<void>;
|
|
97
|
-
clearCloudAgentSessionContext(cloudAgentId: string, sessionId: string): Promise<void>;
|
|
98
|
-
deleteCloudAgentSession(cloudAgentId: string, sessionId: string): Promise<void>;
|
|
99
|
-
generateCloudAgentSessionTitle(cloudAgentId: string, sessionId: string): Promise<{
|
|
100
|
-
title: string | null;
|
|
101
|
-
sessionId: string;
|
|
102
|
-
} | null>;
|
|
103
|
-
cancelCloudAgentSessionRun(cloudAgentId: string, sessionId: string): Promise<void>;
|
|
104
|
-
listCloudAgentApprovals(cloudAgentId: string, sessionId: string): Promise<unknown[]>;
|
|
105
|
-
submitCloudAgentApproval(cloudAgentId: string, approvalId: string, decision: CloudChatApprovalDecision): Promise<void>;
|
|
106
|
-
streamCloudAgentMessage(cloudAgentId: string, input: {
|
|
107
|
-
sessionId: string;
|
|
108
|
-
content: string;
|
|
109
|
-
signal?: AbortSignal;
|
|
110
|
-
}): Promise<AsyncIterableIterator<StreamingEvent>>;
|
|
111
|
-
};
|
|
112
|
-
export {};
|
|
113
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/deploy/client.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,519 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { createMessageStream } from '@dexto/client-sdk';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
import { getAuthToken, getDextoApiKey, loadAuth } from '../../auth/service.js';
|
|
6
|
-
const SANDBOX_URL_ENV_VAR = 'DEXTO_SANDBOX_URL';
|
|
7
|
-
const DEFAULT_SANDBOX_URL = 'https://sandbox.dexto.ai';
|
|
8
|
-
const CloudAgentStateSchema = z
|
|
9
|
-
.object({
|
|
10
|
-
status: z.string(),
|
|
11
|
-
})
|
|
12
|
-
.passthrough();
|
|
13
|
-
const CloudAgentSummarySchema = z
|
|
14
|
-
.object({
|
|
15
|
-
runId: z.string(),
|
|
16
|
-
agentUrl: z.string(),
|
|
17
|
-
hostUrl: z.string().nullable().optional(),
|
|
18
|
-
state: CloudAgentStateSchema,
|
|
19
|
-
})
|
|
20
|
-
.passthrough();
|
|
21
|
-
const CloudAgentListItemSchema = z
|
|
22
|
-
.object({
|
|
23
|
-
cloudAgentId: z.string(),
|
|
24
|
-
name: z.string().nullable().optional(),
|
|
25
|
-
agentUrl: z.string(),
|
|
26
|
-
hostUrl: z.string().nullable().optional(),
|
|
27
|
-
state: CloudAgentStateSchema,
|
|
28
|
-
})
|
|
29
|
-
.passthrough();
|
|
30
|
-
const DeployResponseSchema = z
|
|
31
|
-
.object({
|
|
32
|
-
success: z.boolean(),
|
|
33
|
-
error: z.string().optional(),
|
|
34
|
-
data: z
|
|
35
|
-
.object({
|
|
36
|
-
cloudAgentId: z.string(),
|
|
37
|
-
agentUrl: z.string(),
|
|
38
|
-
cloudAgent: CloudAgentSummarySchema,
|
|
39
|
-
})
|
|
40
|
-
.passthrough()
|
|
41
|
-
.optional(),
|
|
42
|
-
})
|
|
43
|
-
.passthrough();
|
|
44
|
-
const StatusResponseSchema = z
|
|
45
|
-
.object({
|
|
46
|
-
success: z.boolean(),
|
|
47
|
-
error: z.string().optional(),
|
|
48
|
-
data: z
|
|
49
|
-
.object({
|
|
50
|
-
cloudAgentId: z.string(),
|
|
51
|
-
agentUrl: z.string(),
|
|
52
|
-
cloudAgent: CloudAgentSummarySchema,
|
|
53
|
-
stale: z.boolean().optional(),
|
|
54
|
-
})
|
|
55
|
-
.passthrough()
|
|
56
|
-
.optional(),
|
|
57
|
-
})
|
|
58
|
-
.passthrough();
|
|
59
|
-
const ListResponseSchema = z
|
|
60
|
-
.object({
|
|
61
|
-
success: z.boolean(),
|
|
62
|
-
error: z.string().optional(),
|
|
63
|
-
data: z
|
|
64
|
-
.object({
|
|
65
|
-
cloudAgents: z.array(CloudAgentListItemSchema),
|
|
66
|
-
})
|
|
67
|
-
.passthrough()
|
|
68
|
-
.optional(),
|
|
69
|
-
})
|
|
70
|
-
.passthrough();
|
|
71
|
-
const StopResponseSchema = z
|
|
72
|
-
.object({
|
|
73
|
-
success: z.boolean(),
|
|
74
|
-
error: z.string().optional(),
|
|
75
|
-
data: z
|
|
76
|
-
.object({
|
|
77
|
-
cloudAgentId: z.string(),
|
|
78
|
-
agentUrl: z.string(),
|
|
79
|
-
stopped: z.boolean(),
|
|
80
|
-
alreadyStopped: z.boolean(),
|
|
81
|
-
snapshotStatus: z.string(),
|
|
82
|
-
})
|
|
83
|
-
.passthrough()
|
|
84
|
-
.optional(),
|
|
85
|
-
})
|
|
86
|
-
.passthrough();
|
|
87
|
-
const DeleteResponseSchema = z
|
|
88
|
-
.object({
|
|
89
|
-
success: z.boolean(),
|
|
90
|
-
error: z.string().optional(),
|
|
91
|
-
data: z
|
|
92
|
-
.object({
|
|
93
|
-
cloudAgentId: z.string(),
|
|
94
|
-
agentUrl: z.string(),
|
|
95
|
-
})
|
|
96
|
-
.passthrough()
|
|
97
|
-
.optional(),
|
|
98
|
-
})
|
|
99
|
-
.passthrough();
|
|
100
|
-
const CloudChatContentPartSchema = z
|
|
101
|
-
.discriminatedUnion('type', [
|
|
102
|
-
z
|
|
103
|
-
.object({
|
|
104
|
-
type: z.literal('text'),
|
|
105
|
-
text: z.string(),
|
|
106
|
-
})
|
|
107
|
-
.strict(),
|
|
108
|
-
z
|
|
109
|
-
.object({
|
|
110
|
-
type: z.literal('image'),
|
|
111
|
-
image: z.string(),
|
|
112
|
-
mimeType: z.string().optional(),
|
|
113
|
-
})
|
|
114
|
-
.strict(),
|
|
115
|
-
z
|
|
116
|
-
.object({
|
|
117
|
-
type: z.literal('file'),
|
|
118
|
-
data: z.string(),
|
|
119
|
-
mimeType: z.string(),
|
|
120
|
-
filename: z.string().optional(),
|
|
121
|
-
})
|
|
122
|
-
.strict(),
|
|
123
|
-
])
|
|
124
|
-
.describe('Cloud chat content part');
|
|
125
|
-
const CloudChatSessionSchema = z
|
|
126
|
-
.object({
|
|
127
|
-
id: z.string(),
|
|
128
|
-
createdAt: z.number().nullable().optional(),
|
|
129
|
-
lastActivity: z.number().nullable().optional(),
|
|
130
|
-
messageCount: z.number().int().nonnegative().optional(),
|
|
131
|
-
title: z.string().nullable().optional(),
|
|
132
|
-
workspaceId: z.string().nullable().optional(),
|
|
133
|
-
parentSessionId: z.string().nullable().optional(),
|
|
134
|
-
})
|
|
135
|
-
.passthrough();
|
|
136
|
-
const CloudChatSessionListResponseSchema = z
|
|
137
|
-
.object({
|
|
138
|
-
sessions: z.array(CloudChatSessionSchema),
|
|
139
|
-
})
|
|
140
|
-
.passthrough();
|
|
141
|
-
const CloudChatSessionResponseSchema = z
|
|
142
|
-
.object({
|
|
143
|
-
session: CloudChatSessionSchema,
|
|
144
|
-
})
|
|
145
|
-
.passthrough();
|
|
146
|
-
const CloudChatHistoryMessageSchema = z
|
|
147
|
-
.object({
|
|
148
|
-
role: z.enum(['user', 'assistant', 'system', 'tool']),
|
|
149
|
-
content: z.array(CloudChatContentPartSchema),
|
|
150
|
-
timestamp: z.number().optional(),
|
|
151
|
-
name: z.string().optional(),
|
|
152
|
-
toolCallId: z.string().optional(),
|
|
153
|
-
success: z.boolean().optional(),
|
|
154
|
-
reasoning: z.string().optional(),
|
|
155
|
-
model: z.string().optional(),
|
|
156
|
-
provider: z.string().optional(),
|
|
157
|
-
displayData: z.unknown().optional(),
|
|
158
|
-
presentationSnapshot: z.unknown().optional(),
|
|
159
|
-
})
|
|
160
|
-
.passthrough();
|
|
161
|
-
const CloudChatHistoryResponseSchema = z
|
|
162
|
-
.object({
|
|
163
|
-
history: z.array(CloudChatHistoryMessageSchema),
|
|
164
|
-
isBusy: z.boolean().optional(),
|
|
165
|
-
stale: z.boolean().optional(),
|
|
166
|
-
})
|
|
167
|
-
.passthrough();
|
|
168
|
-
const CloudChatApprovalsResponseSchema = z
|
|
169
|
-
.object({
|
|
170
|
-
approvals: z.array(z.unknown()).default([]),
|
|
171
|
-
})
|
|
172
|
-
.passthrough();
|
|
173
|
-
function normalizeCloudChatSession(session) {
|
|
174
|
-
return {
|
|
175
|
-
id: session.id,
|
|
176
|
-
createdAt: session.createdAt ?? null,
|
|
177
|
-
lastActivity: session.lastActivity ?? null,
|
|
178
|
-
messageCount: session.messageCount ?? 0,
|
|
179
|
-
title: session.title ?? null,
|
|
180
|
-
workspaceId: session.workspaceId ?? null,
|
|
181
|
-
parentSessionId: session.parentSessionId ?? null,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
class SandboxApiError extends Error {
|
|
185
|
-
status;
|
|
186
|
-
constructor(message, status) {
|
|
187
|
-
super(message);
|
|
188
|
-
Object.setPrototypeOf(this, SandboxApiError.prototype);
|
|
189
|
-
this.name = 'SandboxApiError';
|
|
190
|
-
this.status = status;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
export function resolveSandboxBaseUrl() {
|
|
194
|
-
const explicit = process.env[SANDBOX_URL_ENV_VAR]?.trim();
|
|
195
|
-
if (explicit && explicit.length > 0) {
|
|
196
|
-
return explicit.replace(/\/+$/, '');
|
|
197
|
-
}
|
|
198
|
-
const apiUrl = process.env.DEXTO_API_URL?.trim();
|
|
199
|
-
if (apiUrl?.startsWith('http://localhost:')) {
|
|
200
|
-
return 'http://localhost:3004';
|
|
201
|
-
}
|
|
202
|
-
return DEFAULT_SANDBOX_URL;
|
|
203
|
-
}
|
|
204
|
-
async function resolveAccessToken() {
|
|
205
|
-
const auth = await loadAuth();
|
|
206
|
-
const storedDextoApiKey = auth?.dextoApiKey?.trim();
|
|
207
|
-
if (storedDextoApiKey && storedDextoApiKey.length > 0) {
|
|
208
|
-
return storedDextoApiKey;
|
|
209
|
-
}
|
|
210
|
-
const authToken = await getAuthToken();
|
|
211
|
-
if (authToken && authToken.trim().length > 0) {
|
|
212
|
-
return authToken.trim();
|
|
213
|
-
}
|
|
214
|
-
const dextoApiKey = await getDextoApiKey();
|
|
215
|
-
if (dextoApiKey && dextoApiKey.trim().length > 0) {
|
|
216
|
-
return dextoApiKey.trim();
|
|
217
|
-
}
|
|
218
|
-
throw new Error('Authentication required. Run `dexto login` before using `dexto deploy`.');
|
|
219
|
-
}
|
|
220
|
-
async function parseJsonResponse(response) {
|
|
221
|
-
const contentType = response.headers.get('content-type') ?? '';
|
|
222
|
-
if (!contentType.toLowerCase().includes('application/json')) {
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
return response.json().catch(() => null);
|
|
226
|
-
}
|
|
227
|
-
async function request(pathName, init) {
|
|
228
|
-
const accessToken = await resolveAccessToken();
|
|
229
|
-
const headers = new globalThis.Headers(init.headers);
|
|
230
|
-
headers.set('Authorization', `Bearer ${accessToken}`);
|
|
231
|
-
return fetch(`${resolveSandboxBaseUrl()}/api${pathName}`, {
|
|
232
|
-
...init,
|
|
233
|
-
headers,
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
function requireSuccessData(payload, response, schema) {
|
|
237
|
-
const parsed = schema.parse(payload);
|
|
238
|
-
if (!parsed.success || !parsed.data) {
|
|
239
|
-
throw new SandboxApiError(parsed.error ?? 'Sandbox request failed', response.status);
|
|
240
|
-
}
|
|
241
|
-
return parsed.data;
|
|
242
|
-
}
|
|
243
|
-
async function throwApiError(response) {
|
|
244
|
-
const payload = await parseJsonResponse(response);
|
|
245
|
-
const parsed = payload && typeof payload === 'object' && payload !== null && 'error' in payload
|
|
246
|
-
? z
|
|
247
|
-
.object({
|
|
248
|
-
error: z.string().optional(),
|
|
249
|
-
hint: z.string().optional(),
|
|
250
|
-
})
|
|
251
|
-
.passthrough()
|
|
252
|
-
.safeParse(payload)
|
|
253
|
-
: null;
|
|
254
|
-
const errorMessage = parsed?.success && parsed.data.error
|
|
255
|
-
? parsed.data.hint
|
|
256
|
-
? `${parsed.data.error} (${parsed.data.hint})`
|
|
257
|
-
: parsed.data.error
|
|
258
|
-
: `Sandbox request failed with status ${response.status}`;
|
|
259
|
-
throw new SandboxApiError(errorMessage, response.status);
|
|
260
|
-
}
|
|
261
|
-
export function createDeployClient() {
|
|
262
|
-
return {
|
|
263
|
-
async deployWorkspace(input) {
|
|
264
|
-
const snapshotBuffer = await fs.readFile(input.snapshotPath);
|
|
265
|
-
const formData = new globalThis.FormData();
|
|
266
|
-
formData.set('agentType', input.agent.type);
|
|
267
|
-
if (input.agent.type === 'workspace') {
|
|
268
|
-
formData.set('entryAgent', input.agent.path);
|
|
269
|
-
}
|
|
270
|
-
if (input.cloudAgentId && input.cloudAgentId.trim().length > 0) {
|
|
271
|
-
formData.set('cloudAgentId', input.cloudAgentId.trim());
|
|
272
|
-
}
|
|
273
|
-
formData.set('workspaceSnapshot', new globalThis.File([new Uint8Array(snapshotBuffer)], path.basename(input.snapshotPath), {
|
|
274
|
-
type: 'application/gzip',
|
|
275
|
-
}));
|
|
276
|
-
const response = await request('/cloud-agents/deploy', {
|
|
277
|
-
method: 'POST',
|
|
278
|
-
body: formData,
|
|
279
|
-
});
|
|
280
|
-
if (!response.ok) {
|
|
281
|
-
await throwApiError(response);
|
|
282
|
-
}
|
|
283
|
-
const payload = await parseJsonResponse(response);
|
|
284
|
-
const data = requireSuccessData(payload, response, DeployResponseSchema);
|
|
285
|
-
return {
|
|
286
|
-
cloudAgentId: data.cloudAgentId,
|
|
287
|
-
agentUrl: data.agentUrl,
|
|
288
|
-
state: data.cloudAgent.state,
|
|
289
|
-
};
|
|
290
|
-
},
|
|
291
|
-
async getCloudAgent(cloudAgentId) {
|
|
292
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}`, {
|
|
293
|
-
method: 'GET',
|
|
294
|
-
});
|
|
295
|
-
if (!response.ok) {
|
|
296
|
-
await throwApiError(response);
|
|
297
|
-
}
|
|
298
|
-
const payload = await parseJsonResponse(response);
|
|
299
|
-
const data = requireSuccessData(payload, response, StatusResponseSchema);
|
|
300
|
-
return {
|
|
301
|
-
cloudAgentId: data.cloudAgentId,
|
|
302
|
-
agentUrl: data.agentUrl,
|
|
303
|
-
state: data.cloudAgent.state,
|
|
304
|
-
stale: data.stale === true,
|
|
305
|
-
};
|
|
306
|
-
},
|
|
307
|
-
async listCloudAgents() {
|
|
308
|
-
const response = await request('/cloud-agents/list', {
|
|
309
|
-
method: 'GET',
|
|
310
|
-
});
|
|
311
|
-
if (!response.ok) {
|
|
312
|
-
await throwApiError(response);
|
|
313
|
-
}
|
|
314
|
-
const payload = await parseJsonResponse(response);
|
|
315
|
-
const data = requireSuccessData(payload, response, ListResponseSchema);
|
|
316
|
-
return data.cloudAgents.map((cloudAgent) => ({
|
|
317
|
-
cloudAgentId: cloudAgent.cloudAgentId,
|
|
318
|
-
name: cloudAgent.name ?? null,
|
|
319
|
-
agentUrl: cloudAgent.agentUrl,
|
|
320
|
-
state: cloudAgent.state,
|
|
321
|
-
}));
|
|
322
|
-
},
|
|
323
|
-
async stopCloudAgent(cloudAgentId) {
|
|
324
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/stop`, {
|
|
325
|
-
method: 'POST',
|
|
326
|
-
headers: {
|
|
327
|
-
'Content-Type': 'application/json',
|
|
328
|
-
},
|
|
329
|
-
body: JSON.stringify({}),
|
|
330
|
-
});
|
|
331
|
-
if (!response.ok) {
|
|
332
|
-
await throwApiError(response);
|
|
333
|
-
}
|
|
334
|
-
const payload = await parseJsonResponse(response);
|
|
335
|
-
const data = requireSuccessData(payload, response, StopResponseSchema);
|
|
336
|
-
return {
|
|
337
|
-
cloudAgentId: data.cloudAgentId,
|
|
338
|
-
agentUrl: data.agentUrl,
|
|
339
|
-
stopped: data.stopped,
|
|
340
|
-
alreadyStopped: data.alreadyStopped,
|
|
341
|
-
snapshotStatus: data.snapshotStatus,
|
|
342
|
-
};
|
|
343
|
-
},
|
|
344
|
-
async deleteCloudAgent(cloudAgentId) {
|
|
345
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}`, {
|
|
346
|
-
method: 'DELETE',
|
|
347
|
-
});
|
|
348
|
-
if (!response.ok) {
|
|
349
|
-
await throwApiError(response);
|
|
350
|
-
}
|
|
351
|
-
const payload = await parseJsonResponse(response);
|
|
352
|
-
const data = requireSuccessData(payload, response, DeleteResponseSchema);
|
|
353
|
-
return {
|
|
354
|
-
cloudAgentId: data.cloudAgentId,
|
|
355
|
-
agentUrl: data.agentUrl,
|
|
356
|
-
};
|
|
357
|
-
},
|
|
358
|
-
async listCloudAgentSessions(cloudAgentId) {
|
|
359
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/sessions`, {
|
|
360
|
-
method: 'GET',
|
|
361
|
-
});
|
|
362
|
-
if (!response.ok) {
|
|
363
|
-
await throwApiError(response);
|
|
364
|
-
}
|
|
365
|
-
const payload = CloudChatSessionListResponseSchema.parse(await response.json());
|
|
366
|
-
return payload.sessions.map(normalizeCloudChatSession);
|
|
367
|
-
},
|
|
368
|
-
async createCloudAgentSession(cloudAgentId, input) {
|
|
369
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/sessions`, {
|
|
370
|
-
method: 'POST',
|
|
371
|
-
headers: {
|
|
372
|
-
'Content-Type': 'application/json',
|
|
373
|
-
},
|
|
374
|
-
body: JSON.stringify(input ?? {}),
|
|
375
|
-
});
|
|
376
|
-
if (!response.ok) {
|
|
377
|
-
await throwApiError(response);
|
|
378
|
-
}
|
|
379
|
-
const payload = CloudChatSessionResponseSchema.parse(await response.json());
|
|
380
|
-
return normalizeCloudChatSession(payload.session);
|
|
381
|
-
},
|
|
382
|
-
async getCloudAgentSessionHistory(cloudAgentId, sessionId) {
|
|
383
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/sessions/${encodeURIComponent(sessionId)}/history`, {
|
|
384
|
-
method: 'GET',
|
|
385
|
-
});
|
|
386
|
-
if (!response.ok) {
|
|
387
|
-
await throwApiError(response);
|
|
388
|
-
}
|
|
389
|
-
const payload = CloudChatHistoryResponseSchema.parse(await response.json());
|
|
390
|
-
return {
|
|
391
|
-
history: payload.history.map((entry) => ({
|
|
392
|
-
role: entry.role,
|
|
393
|
-
content: entry.content,
|
|
394
|
-
...(entry.timestamp !== undefined ? { timestamp: entry.timestamp } : {}),
|
|
395
|
-
...(entry.name !== undefined ? { name: entry.name } : {}),
|
|
396
|
-
...(entry.toolCallId !== undefined ? { toolCallId: entry.toolCallId } : {}),
|
|
397
|
-
...(entry.success !== undefined ? { success: entry.success } : {}),
|
|
398
|
-
...(entry.reasoning !== undefined ? { reasoning: entry.reasoning } : {}),
|
|
399
|
-
...(entry.model !== undefined ? { model: entry.model } : {}),
|
|
400
|
-
...(entry.provider !== undefined ? { provider: entry.provider } : {}),
|
|
401
|
-
})),
|
|
402
|
-
isBusy: payload.isBusy ?? false,
|
|
403
|
-
stale: payload.stale === true,
|
|
404
|
-
};
|
|
405
|
-
},
|
|
406
|
-
async resetCloudAgentSession(cloudAgentId, sessionId) {
|
|
407
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/sessions/${encodeURIComponent(sessionId)}/reset`, {
|
|
408
|
-
method: 'POST',
|
|
409
|
-
});
|
|
410
|
-
if (!response.ok) {
|
|
411
|
-
await throwApiError(response);
|
|
412
|
-
}
|
|
413
|
-
},
|
|
414
|
-
async clearCloudAgentSessionContext(cloudAgentId, sessionId) {
|
|
415
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/sessions/${encodeURIComponent(sessionId)}/clear-context`, {
|
|
416
|
-
method: 'POST',
|
|
417
|
-
});
|
|
418
|
-
if (!response.ok) {
|
|
419
|
-
await throwApiError(response);
|
|
420
|
-
}
|
|
421
|
-
},
|
|
422
|
-
async deleteCloudAgentSession(cloudAgentId, sessionId) {
|
|
423
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/sessions/${encodeURIComponent(sessionId)}`, {
|
|
424
|
-
method: 'DELETE',
|
|
425
|
-
});
|
|
426
|
-
if (!response.ok) {
|
|
427
|
-
await throwApiError(response);
|
|
428
|
-
}
|
|
429
|
-
},
|
|
430
|
-
async generateCloudAgentSessionTitle(cloudAgentId, sessionId) {
|
|
431
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/sessions/${encodeURIComponent(sessionId)}/generate-title`, {
|
|
432
|
-
method: 'POST',
|
|
433
|
-
});
|
|
434
|
-
if (!response.ok) {
|
|
435
|
-
await throwApiError(response);
|
|
436
|
-
}
|
|
437
|
-
const payload = z
|
|
438
|
-
.object({
|
|
439
|
-
title: z.string().nullable().optional(),
|
|
440
|
-
sessionId: z.string().optional(),
|
|
441
|
-
})
|
|
442
|
-
.passthrough()
|
|
443
|
-
.parse(await response.json());
|
|
444
|
-
return {
|
|
445
|
-
title: payload.title ?? null,
|
|
446
|
-
sessionId: payload.sessionId ?? sessionId,
|
|
447
|
-
};
|
|
448
|
-
},
|
|
449
|
-
async cancelCloudAgentSessionRun(cloudAgentId, sessionId) {
|
|
450
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/sessions/${encodeURIComponent(sessionId)}/cancel`, {
|
|
451
|
-
method: 'POST',
|
|
452
|
-
});
|
|
453
|
-
if (!response.ok) {
|
|
454
|
-
await throwApiError(response);
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
async listCloudAgentApprovals(cloudAgentId, sessionId) {
|
|
458
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/approvals?sessionId=${encodeURIComponent(sessionId)}`, {
|
|
459
|
-
method: 'GET',
|
|
460
|
-
});
|
|
461
|
-
if (!response.ok) {
|
|
462
|
-
await throwApiError(response);
|
|
463
|
-
}
|
|
464
|
-
const payload = CloudChatApprovalsResponseSchema.parse(await response.json());
|
|
465
|
-
return payload.approvals;
|
|
466
|
-
},
|
|
467
|
-
async submitCloudAgentApproval(cloudAgentId, approvalId, decision) {
|
|
468
|
-
const response = await request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/approvals/${encodeURIComponent(approvalId)}`, {
|
|
469
|
-
method: 'POST',
|
|
470
|
-
headers: {
|
|
471
|
-
'Content-Type': 'application/json',
|
|
472
|
-
},
|
|
473
|
-
body: JSON.stringify({
|
|
474
|
-
status: decision.status,
|
|
475
|
-
...(decision.formData !== undefined ? { formData: decision.formData } : {}),
|
|
476
|
-
...(decision.rememberChoice !== undefined
|
|
477
|
-
? { rememberChoice: decision.rememberChoice }
|
|
478
|
-
: {}),
|
|
479
|
-
...(decision.reason !== undefined ? { reason: decision.reason } : {}),
|
|
480
|
-
...(decision.message !== undefined ? { message: decision.message } : {}),
|
|
481
|
-
}),
|
|
482
|
-
});
|
|
483
|
-
if (!response.ok) {
|
|
484
|
-
await throwApiError(response);
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
async streamCloudAgentMessage(cloudAgentId, input) {
|
|
488
|
-
const responsePromise = request(`/cloud-agents/${encodeURIComponent(cloudAgentId)}/agent/message-stream`, {
|
|
489
|
-
method: 'POST',
|
|
490
|
-
headers: {
|
|
491
|
-
'Content-Type': 'application/json',
|
|
492
|
-
Accept: 'text/event-stream',
|
|
493
|
-
},
|
|
494
|
-
body: JSON.stringify({
|
|
495
|
-
sessionId: input.sessionId,
|
|
496
|
-
content: input.content,
|
|
497
|
-
}),
|
|
498
|
-
...(input.signal ? { signal: input.signal } : {}),
|
|
499
|
-
});
|
|
500
|
-
const response = await responsePromise;
|
|
501
|
-
if (response.status === 202 &&
|
|
502
|
-
response.headers.get('content-type')?.includes('application/json')) {
|
|
503
|
-
const busyPayload = await response.json().catch(() => null);
|
|
504
|
-
const parsed = z
|
|
505
|
-
.object({
|
|
506
|
-
hint: z.string().optional(),
|
|
507
|
-
})
|
|
508
|
-
.passthrough()
|
|
509
|
-
.safeParse(busyPayload);
|
|
510
|
-
throw new Error(parsed.success
|
|
511
|
-
? (parsed.data.hint ?? 'Cloud session is busy')
|
|
512
|
-
: 'Cloud session is busy');
|
|
513
|
-
}
|
|
514
|
-
return createMessageStream(Promise.resolve(response), {
|
|
515
|
-
...(input.signal ? { signal: input.signal } : {}),
|
|
516
|
-
});
|
|
517
|
-
},
|
|
518
|
-
};
|
|
519
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const DEPLOY_CONFIG_RELATIVE_PATH: string;
|
|
3
|
-
export declare const DEFAULT_DEPLOY_EXCLUDES: readonly [".git", "node_modules", "dist", ".next", ".turbo", ".env*"];
|
|
4
|
-
export declare function normalizeWorkspaceRelativePath(value: string): string;
|
|
5
|
-
declare const WorkspaceDeployAgentSchema: z.ZodObject<{
|
|
6
|
-
type: z.ZodLiteral<"workspace">;
|
|
7
|
-
path: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
8
|
-
}, z.core.$strict>;
|
|
9
|
-
export declare const DeployAgentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
-
type: z.ZodLiteral<"cloud-default">;
|
|
11
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
12
|
-
type: z.ZodLiteral<"workspace">;
|
|
13
|
-
path: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
14
|
-
}, z.core.$strict>], "type">;
|
|
15
|
-
export declare const DeployConfigSchema: z.ZodObject<{
|
|
16
|
-
version: z.ZodDefault<z.ZodLiteral<1>>;
|
|
17
|
-
agent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
18
|
-
type: z.ZodLiteral<"cloud-default">;
|
|
19
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
20
|
-
type: z.ZodLiteral<"workspace">;
|
|
21
|
-
path: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
22
|
-
}, z.core.$strict>], "type">;
|
|
23
|
-
exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
24
|
-
}, z.core.$strict>;
|
|
25
|
-
export type DeployConfig = z.output<typeof DeployConfigSchema>;
|
|
26
|
-
export type DeployConfigInput = z.input<typeof DeployConfigSchema>;
|
|
27
|
-
export type DeployAgent = z.output<typeof DeployAgentSchema>;
|
|
28
|
-
export type WorkspaceDeployAgent = z.output<typeof WorkspaceDeployAgentSchema>;
|
|
29
|
-
export declare function getDeployConfigPath(workspaceRoot: string): string;
|
|
30
|
-
export declare function loadDeployConfig(workspaceRoot: string): Promise<DeployConfig | null>;
|
|
31
|
-
export declare function saveDeployConfig(workspaceRoot: string, config: DeployConfigInput): Promise<DeployConfig>;
|
|
32
|
-
export declare function createCloudDefaultDeployConfig(exclude?: readonly string[]): DeployConfig;
|
|
33
|
-
export declare function createWorkspaceDeployConfig(agentPath: string, exclude?: readonly string[]): DeployConfig;
|
|
34
|
-
export declare function isWorkspaceDeployAgent(agent: DeployAgent): agent is WorkspaceDeployAgent;
|
|
35
|
-
export declare function resolveWorkspaceDeployAgentPath(workspaceRoot: string, agentPath: string): string;
|
|
36
|
-
export {};
|
|
37
|
-
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/deploy/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,2BAA2B,QAAqC,CAAC;AAE9E,eAAO,MAAM,uBAAuB,uEAO1B,CAAC;AAEX,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAkBpE;AAwBD,QAAA,MAAM,0BAA0B;;;kBAOnB,CAAC;AAEd,eAAO,MAAM,iBAAiB;;;;;4BAG5B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;kBAMlB,CAAC;AAYd,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACnE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC7D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE/E,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAmB1F;AAED,wBAAsB,gBAAgB,CAClC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,iBAAiB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAMvB;AAgBD,wBAAgB,8BAA8B,CAC1C,OAAO,GAAE,SAAS,MAAM,EAA4B,GACrD,YAAY,CAQd;AAED,wBAAgB,2BAA2B,CACvC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,SAAS,MAAM,EAA4B,GACrD,YAAY,CASd;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,IAAI,oBAAoB,CAExF;AAED,wBAAgB,+BAA+B,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAahG"}
|