@agentuity/cli 2.0.11 → 2.0.12
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/cache/resource-region.d.ts.map +1 -1
- package/dist/cache/resource-region.js +48 -25
- package/dist/cache/resource-region.js.map +1 -1
- package/dist/cmd/build/vite/bun-dev-server.d.ts +20 -0
- package/dist/cmd/build/vite/bun-dev-server.d.ts.map +1 -1
- package/dist/cmd/build/vite/bun-dev-server.js +62 -4
- package/dist/cmd/build/vite/bun-dev-server.js.map +1 -1
- package/dist/cmd/build/vite/index.d.ts +0 -1
- package/dist/cmd/build/vite/index.d.ts.map +1 -1
- package/dist/cmd/build/vite/index.js +0 -1
- package/dist/cmd/build/vite/index.js.map +1 -1
- package/dist/cmd/build/vite/static-renderer.d.ts +17 -0
- package/dist/cmd/build/vite/static-renderer.d.ts.map +1 -1
- package/dist/cmd/build/vite/static-renderer.js +18 -6
- package/dist/cmd/build/vite/static-renderer.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.js +34 -27
- package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server.d.ts +9 -0
- package/dist/cmd/build/vite/vite-asset-server.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server.js +5 -1
- package/dist/cmd/build/vite/vite-asset-server.js.map +1 -1
- package/dist/cmd/build/vite/vite-builder.d.ts.map +1 -1
- package/dist/cmd/build/vite/vite-builder.js +12 -1
- package/dist/cmd/build/vite/vite-builder.js.map +1 -1
- package/dist/cmd/build/vite/ws-proxy.d.ts +15 -1
- package/dist/cmd/build/vite/ws-proxy.d.ts.map +1 -1
- package/dist/cmd/build/vite/ws-proxy.js +33 -0
- package/dist/cmd/build/vite/ws-proxy.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +98 -39
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/create.js +3 -4
- package/dist/cmd/cloud/sandbox/checkpoint/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/delete.js +3 -4
- package/dist/cmd/cloud/sandbox/checkpoint/delete.js.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/list.js +3 -4
- package/dist/cmd/cloud/sandbox/checkpoint/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/restore.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/restore.js +3 -4
- package/dist/cmd/cloud/sandbox/checkpoint/restore.js.map +1 -1
- package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/create.js +13 -4
- package/dist/cmd/cloud/sandbox/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/delete.js +3 -4
- package/dist/cmd/cloud/sandbox/delete.js.map +1 -1
- package/dist/cmd/cloud/sandbox/env.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/env.js +3 -5
- package/dist/cmd/cloud/sandbox/env.js.map +1 -1
- package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/exec.js +114 -41
- package/dist/cmd/cloud/sandbox/exec.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/list.js +3 -5
- package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/cp.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/cp.js +61 -113
- package/dist/cmd/cloud/sandbox/fs/cp.js.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/download.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/download.js +11 -22
- package/dist/cmd/cloud/sandbox/fs/download.js.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/ls.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/ls.js +3 -5
- package/dist/cmd/cloud/sandbox/fs/ls.js.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/mkdir.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/mkdir.js +3 -5
- package/dist/cmd/cloud/sandbox/fs/mkdir.js.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/rm.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/rm.js +3 -5
- package/dist/cmd/cloud/sandbox/fs/rm.js.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/rmdir.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/rmdir.js +3 -5
- package/dist/cmd/cloud/sandbox/fs/rmdir.js.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/fs/upload.js +7 -8
- package/dist/cmd/cloud/sandbox/fs/upload.js.map +1 -1
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +21 -7
- package/dist/cmd/cloud/sandbox/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/job/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/job/create.js +3 -4
- package/dist/cmd/cloud/sandbox/job/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/job/destroy.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/job/destroy.js +3 -4
- package/dist/cmd/cloud/sandbox/job/destroy.js.map +1 -1
- package/dist/cmd/cloud/sandbox/job/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/job/get.js +3 -4
- package/dist/cmd/cloud/sandbox/job/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/job/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/job/list.js +3 -4
- package/dist/cmd/cloud/sandbox/job/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/job/logs.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/job/logs.js +4 -4
- package/dist/cmd/cloud/sandbox/job/logs.js.map +1 -1
- package/dist/cmd/cloud/sandbox/pause.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/pause.js +21 -5
- package/dist/cmd/cloud/sandbox/pause.js.map +1 -1
- package/dist/cmd/cloud/sandbox/resume.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/resume.js +3 -4
- package/dist/cmd/cloud/sandbox/resume.js.map +1 -1
- package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/run.js +36 -7
- package/dist/cmd/cloud/sandbox/run.js.map +1 -1
- package/dist/cmd/cloud/sandbox/util.d.ts +19 -0
- package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/util.js +40 -2
- package/dist/cmd/cloud/sandbox/util.js.map +1 -1
- package/dist/cmd/coder/create.js +7 -7
- package/dist/cmd/coder/create.js.map +1 -1
- package/dist/cmd/coder/start.d.ts.map +1 -1
- package/dist/cmd/coder/start.js +3 -0
- package/dist/cmd/coder/start.js.map +1 -1
- package/dist/cmd/coder/tui-init.js +1 -1
- package/dist/cmd/coder/tui-init.js.map +1 -1
- package/dist/cmd/coder/update.js +8 -8
- package/dist/cmd/coder/update.js.map +1 -1
- package/dist/cmd/coder/workspace/create.d.ts.map +1 -1
- package/dist/cmd/coder/workspace/create.js +49 -21
- package/dist/cmd/coder/workspace/create.js.map +1 -1
- package/dist/cmd/coder/workspace/index.d.ts.map +1 -1
- package/dist/cmd/coder/workspace/index.js +1 -1
- package/dist/cmd/coder/workspace/index.js.map +1 -1
- package/dist/cmd/dev/dev-lock.d.ts.map +1 -1
- package/dist/cmd/dev/dev-lock.js +43 -17
- package/dist/cmd/dev/dev-lock.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +211 -125
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/dev/process-manager.d.ts +41 -1
- package/dist/cmd/dev/process-manager.d.ts.map +1 -1
- package/dist/cmd/dev/process-manager.js +160 -31
- package/dist/cmd/dev/process-manager.js.map +1 -1
- package/dist/cmd/project/create.d.ts.map +1 -1
- package/dist/cmd/project/create.js +0 -2
- package/dist/cmd/project/create.js.map +1 -1
- package/dist/cmd/project/index.d.ts.map +1 -1
- package/dist/cmd/project/index.js +0 -3
- package/dist/cmd/project/index.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts +0 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +1 -124
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/package.json +7 -7
- package/src/cache/resource-region.ts +68 -44
- package/src/cmd/ai/prompt/web.md +43 -17
- package/src/cmd/build/vite/bun-dev-server.ts +92 -6
- package/src/cmd/build/vite/index.ts +0 -1
- package/src/cmd/build/vite/static-renderer.ts +18 -7
- package/src/cmd/build/vite/vite-asset-server-config.ts +37 -27
- package/src/cmd/build/vite/vite-asset-server.ts +5 -1
- package/src/cmd/build/vite/vite-builder.ts +12 -1
- package/src/cmd/build/vite/ws-proxy.ts +52 -3
- package/src/cmd/cloud/deploy.ts +117 -49
- package/src/cmd/cloud/sandbox/checkpoint/create.ts +10 -4
- package/src/cmd/cloud/sandbox/checkpoint/delete.ts +10 -4
- package/src/cmd/cloud/sandbox/checkpoint/list.ts +10 -4
- package/src/cmd/cloud/sandbox/checkpoint/restore.ts +10 -4
- package/src/cmd/cloud/sandbox/create.ts +14 -4
- package/src/cmd/cloud/sandbox/delete.ts +10 -4
- package/src/cmd/cloud/sandbox/env.ts +10 -5
- package/src/cmd/cloud/sandbox/exec.ts +157 -42
- package/src/cmd/cloud/sandbox/execution/list.ts +10 -5
- package/src/cmd/cloud/sandbox/fs/cp.ts +94 -126
- package/src/cmd/cloud/sandbox/fs/download.ts +18 -25
- package/src/cmd/cloud/sandbox/fs/ls.ts +10 -5
- package/src/cmd/cloud/sandbox/fs/mkdir.ts +10 -5
- package/src/cmd/cloud/sandbox/fs/rm.ts +10 -5
- package/src/cmd/cloud/sandbox/fs/rmdir.ts +10 -5
- package/src/cmd/cloud/sandbox/fs/upload.ts +14 -8
- package/src/cmd/cloud/sandbox/get.ts +28 -7
- package/src/cmd/cloud/sandbox/job/create.ts +10 -4
- package/src/cmd/cloud/sandbox/job/destroy.ts +10 -4
- package/src/cmd/cloud/sandbox/job/get.ts +10 -4
- package/src/cmd/cloud/sandbox/job/list.ts +10 -4
- package/src/cmd/cloud/sandbox/job/logs.ts +11 -4
- package/src/cmd/cloud/sandbox/pause.ts +31 -5
- package/src/cmd/cloud/sandbox/resume.ts +10 -4
- package/src/cmd/cloud/sandbox/run.ts +49 -11
- package/src/cmd/cloud/sandbox/util.ts +63 -2
- package/src/cmd/coder/create.ts +8 -8
- package/src/cmd/coder/start.ts +3 -0
- package/src/cmd/coder/tui-init.ts +1 -1
- package/src/cmd/coder/update.ts +7 -7
- package/src/cmd/coder/workspace/create.ts +77 -26
- package/src/cmd/coder/workspace/index.ts +3 -1
- package/src/cmd/dev/dev-lock.ts +50 -16
- package/src/cmd/dev/index.ts +249 -134
- package/src/cmd/dev/process-manager.ts +173 -33
- package/src/cmd/project/create.ts +0 -2
- package/src/cmd/project/index.ts +0 -3
- package/src/cmd/project/template-flow.ts +0 -147
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts +0 -45
- package/dist/cmd/build/vite/public-asset-path-plugin.d.ts.map +0 -1
- package/dist/cmd/build/vite/public-asset-path-plugin.js +0 -166
- package/dist/cmd/build/vite/public-asset-path-plugin.js.map +0 -1
- package/dist/cmd/project/auth/generate.d.ts +0 -5
- package/dist/cmd/project/auth/generate.d.ts.map +0 -1
- package/dist/cmd/project/auth/generate.js +0 -102
- package/dist/cmd/project/auth/generate.js.map +0 -1
- package/dist/cmd/project/auth/index.d.ts +0 -2
- package/dist/cmd/project/auth/index.d.ts.map +0 -1
- package/dist/cmd/project/auth/index.js +0 -21
- package/dist/cmd/project/auth/index.js.map +0 -1
- package/dist/cmd/project/auth/init.d.ts +0 -2
- package/dist/cmd/project/auth/init.d.ts.map +0 -1
- package/dist/cmd/project/auth/init.js +0 -213
- package/dist/cmd/project/auth/init.js.map +0 -1
- package/dist/cmd/project/auth/shared.d.ts +0 -93
- package/dist/cmd/project/auth/shared.d.ts.map +0 -1
- package/dist/cmd/project/auth/shared.js +0 -475
- package/dist/cmd/project/auth/shared.js.map +0 -1
- package/src/cmd/build/vite/public-asset-path-plugin.ts +0 -209
- package/src/cmd/project/auth/generate.ts +0 -116
- package/src/cmd/project/auth/index.ts +0 -21
- package/src/cmd/project/auth/init.ts +0 -256
- package/src/cmd/project/auth/shared.ts +0 -591
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { createWriteStream } from 'node:fs';
|
|
3
|
+
import { dirname } from 'node:path';
|
|
4
|
+
import { mkdir } from 'node:fs/promises';
|
|
5
|
+
import { pipeline } from 'node:stream/promises';
|
|
6
|
+
import { Readable } from 'node:stream';
|
|
3
7
|
import { createCommand } from '../../../../types';
|
|
4
8
|
import * as tui from '../../../../tui';
|
|
5
|
-
import { createSandboxClient } from '../util';
|
|
9
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
6
10
|
import { getCommand } from '../../../../command-prefix';
|
|
7
|
-
import { sandboxDownloadArchive
|
|
11
|
+
import { sandboxDownloadArchive } from '@agentuity/server';
|
|
8
12
|
|
|
9
13
|
export const downloadSubcommand = createCommand({
|
|
10
14
|
name: 'download',
|
|
@@ -48,9 +52,14 @@ export const downloadSubcommand = createCommand({
|
|
|
48
52
|
async handler(ctx) {
|
|
49
53
|
const { args, opts, options, auth, logger, apiClient } = ctx;
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
56
|
+
logger,
|
|
57
|
+
auth,
|
|
58
|
+
apiClient,
|
|
59
|
+
args.sandboxId,
|
|
60
|
+
ctx.config?.name ?? 'production',
|
|
61
|
+
ctx.config
|
|
62
|
+
);
|
|
54
63
|
|
|
55
64
|
const client = createSandboxClient(logger, auth, region);
|
|
56
65
|
|
|
@@ -62,25 +71,9 @@ export const downloadSubcommand = createCommand({
|
|
|
62
71
|
format,
|
|
63
72
|
orgId,
|
|
64
73
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
while (true) {
|
|
70
|
-
const { done, value } = await reader.read();
|
|
71
|
-
if (done) break;
|
|
72
|
-
chunks.push(value);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const totalBytes = chunks.reduce((acc, chunk) => acc + chunk.length, 0);
|
|
76
|
-
const buffer = new Uint8Array(totalBytes);
|
|
77
|
-
let offset = 0;
|
|
78
|
-
for (const chunk of chunks) {
|
|
79
|
-
buffer.set(chunk, offset);
|
|
80
|
-
offset += chunk.length;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
writeFileSync(args.output, buffer);
|
|
74
|
+
await mkdir(dirname(args.output), { recursive: true });
|
|
75
|
+
await pipeline(Readable.fromWeb(stream), createWriteStream(args.output));
|
|
76
|
+
const totalBytes = Bun.file(args.output).size;
|
|
84
77
|
|
|
85
78
|
if (!options.json) {
|
|
86
79
|
tui.success(`Downloaded ${formatSize(totalBytes)} to ${args.output}`);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
5
5
|
import { getCommand } from '../../../../command-prefix';
|
|
6
|
-
import { sandboxListFiles
|
|
6
|
+
import { sandboxListFiles } from '@agentuity/server';
|
|
7
7
|
|
|
8
8
|
const FileInfoSchema = z.object({
|
|
9
9
|
path: z.string(),
|
|
@@ -63,9 +63,14 @@ export const lsSubcommand = createCommand({
|
|
|
63
63
|
async handler(ctx) {
|
|
64
64
|
const { args, opts, options, auth, logger, apiClient } = ctx;
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
67
|
+
logger,
|
|
68
|
+
auth,
|
|
69
|
+
apiClient,
|
|
70
|
+
args.sandboxId,
|
|
71
|
+
ctx.config?.name ?? 'production',
|
|
72
|
+
ctx.config
|
|
73
|
+
);
|
|
69
74
|
|
|
70
75
|
const client = createSandboxClient(logger, auth, region);
|
|
71
76
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
5
5
|
import { getCommand } from '../../../../command-prefix';
|
|
6
|
-
import { sandboxMkDir
|
|
6
|
+
import { sandboxMkDir } from '@agentuity/server';
|
|
7
7
|
|
|
8
8
|
const MkDirResponseSchema = z.object({
|
|
9
9
|
success: z.boolean(),
|
|
@@ -46,9 +46,14 @@ export const mkdirSubcommand = createCommand({
|
|
|
46
46
|
async handler(ctx) {
|
|
47
47
|
const { args, opts, options, auth, logger, apiClient } = ctx;
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
50
|
+
logger,
|
|
51
|
+
auth,
|
|
52
|
+
apiClient,
|
|
53
|
+
args.sandboxId,
|
|
54
|
+
ctx.config?.name ?? 'production',
|
|
55
|
+
ctx.config
|
|
56
|
+
);
|
|
52
57
|
|
|
53
58
|
const client = createSandboxClient(logger, auth, region);
|
|
54
59
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
5
5
|
import { getCommand } from '../../../../command-prefix';
|
|
6
|
-
import { sandboxRmFile
|
|
6
|
+
import { sandboxRmFile } from '@agentuity/server';
|
|
7
7
|
|
|
8
8
|
const RmFileResponseSchema = z.object({
|
|
9
9
|
success: z.boolean(),
|
|
@@ -35,9 +35,14 @@ export const rmSubcommand = createCommand({
|
|
|
35
35
|
async handler(ctx) {
|
|
36
36
|
const { args, options, auth, logger, apiClient } = ctx;
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
39
|
+
logger,
|
|
40
|
+
auth,
|
|
41
|
+
apiClient,
|
|
42
|
+
args.sandboxId,
|
|
43
|
+
ctx.config?.name ?? 'production',
|
|
44
|
+
ctx.config
|
|
45
|
+
);
|
|
41
46
|
|
|
42
47
|
const client = createSandboxClient(logger, auth, region);
|
|
43
48
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
5
5
|
import { getCommand } from '../../../../command-prefix';
|
|
6
|
-
import { sandboxRmDir
|
|
6
|
+
import { sandboxRmDir } from '@agentuity/server';
|
|
7
7
|
|
|
8
8
|
const RmDirResponseSchema = z.object({
|
|
9
9
|
success: z.boolean(),
|
|
@@ -47,9 +47,14 @@ export const rmdirSubcommand = createCommand({
|
|
|
47
47
|
async handler(ctx) {
|
|
48
48
|
const { args, opts, options, auth, logger, apiClient } = ctx;
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
51
|
+
logger,
|
|
52
|
+
auth,
|
|
53
|
+
apiClient,
|
|
54
|
+
args.sandboxId,
|
|
55
|
+
ctx.config?.name ?? 'production',
|
|
56
|
+
ctx.config
|
|
57
|
+
);
|
|
53
58
|
|
|
54
59
|
const client = createSandboxClient(logger, auth, region);
|
|
55
60
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { createReadStream, statSync } from 'node:fs';
|
|
3
|
+
import { Readable } from 'node:stream';
|
|
3
4
|
import { createCommand } from '../../../../types';
|
|
4
5
|
import * as tui from '../../../../tui';
|
|
5
|
-
import { createSandboxClient } from '../util';
|
|
6
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
6
7
|
import { getCommand } from '../../../../command-prefix';
|
|
7
|
-
import { sandboxUploadArchive
|
|
8
|
+
import { sandboxUploadArchive } from '@agentuity/server';
|
|
8
9
|
|
|
9
10
|
export const uploadSubcommand = createCommand({
|
|
10
11
|
name: 'upload',
|
|
@@ -47,9 +48,14 @@ export const uploadSubcommand = createCommand({
|
|
|
47
48
|
async handler(ctx) {
|
|
48
49
|
const { args, opts, options, auth, logger, apiClient } = ctx;
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
52
|
+
logger,
|
|
53
|
+
auth,
|
|
54
|
+
apiClient,
|
|
55
|
+
args.sandboxId,
|
|
56
|
+
ctx.config?.name ?? 'production',
|
|
57
|
+
ctx.config
|
|
58
|
+
);
|
|
53
59
|
|
|
54
60
|
const client = createSandboxClient(logger, auth, region);
|
|
55
61
|
|
|
@@ -58,8 +64,8 @@ export const uploadSubcommand = createCommand({
|
|
|
58
64
|
logger.fatal(`${args.archive} is not a file`);
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
const
|
|
62
|
-
const
|
|
67
|
+
const bytes = stat.size;
|
|
68
|
+
const content = Readable.toWeb(createReadStream(args.archive)) as ReadableStream<Uint8Array>;
|
|
63
69
|
|
|
64
70
|
const format = opts.format ?? detectFormat(args.archive);
|
|
65
71
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
|
-
import {
|
|
4
|
+
import { cacheSandboxTarget, createSandboxClient, resolveSandboxTarget } from './util';
|
|
5
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
|
-
import { sandboxGet
|
|
6
|
+
import { sandboxGet } from '@agentuity/server';
|
|
7
7
|
|
|
8
8
|
const SandboxResourcesSchema = z.object({
|
|
9
9
|
memory: z.string().optional().describe('Memory limit (e.g., "512Mi", "1Gi")'),
|
|
@@ -62,6 +62,19 @@ export const getSubcommand = createCommand({
|
|
|
62
62
|
},
|
|
63
63
|
],
|
|
64
64
|
schema: {
|
|
65
|
+
options: z.object({
|
|
66
|
+
waitForStatus: z
|
|
67
|
+
.array(z.string())
|
|
68
|
+
.optional()
|
|
69
|
+
.describe('Wait for one of these statuses before returning'),
|
|
70
|
+
waitMs: z
|
|
71
|
+
.number()
|
|
72
|
+
.int()
|
|
73
|
+
.nonnegative()
|
|
74
|
+
.max(60000)
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('Maximum time in milliseconds to wait for a desired status'),
|
|
77
|
+
}),
|
|
65
78
|
args: z.object({
|
|
66
79
|
sandboxId: z.string().describe('Sandbox ID'),
|
|
67
80
|
}),
|
|
@@ -69,10 +82,16 @@ export const getSubcommand = createCommand({
|
|
|
69
82
|
},
|
|
70
83
|
|
|
71
84
|
async handler(ctx) {
|
|
72
|
-
const { args, options, auth, logger, config, apiClient } = ctx;
|
|
85
|
+
const { args, opts, options, auth, logger, config, apiClient } = ctx;
|
|
73
86
|
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
const sandboxInfo = await resolveSandboxTarget(
|
|
88
|
+
logger,
|
|
89
|
+
auth,
|
|
90
|
+
apiClient,
|
|
91
|
+
args.sandboxId,
|
|
92
|
+
config?.name ?? 'production',
|
|
93
|
+
config
|
|
94
|
+
);
|
|
76
95
|
|
|
77
96
|
// Create regional client and get full sandbox details
|
|
78
97
|
const client = createSandboxClient(logger, auth, sandboxInfo.region);
|
|
@@ -80,11 +99,13 @@ export const getSubcommand = createCommand({
|
|
|
80
99
|
sandboxId: args.sandboxId,
|
|
81
100
|
orgId: sandboxInfo.orgId,
|
|
82
101
|
includeDeleted: true,
|
|
102
|
+
waitForStatus: opts.waitForStatus,
|
|
103
|
+
waitMs: opts.waitMs,
|
|
83
104
|
});
|
|
84
105
|
|
|
85
|
-
// Cache
|
|
106
|
+
// Cache routing context for future lookups
|
|
86
107
|
if (result.region) {
|
|
87
|
-
await
|
|
108
|
+
await cacheSandboxTarget(config?.name, args.sandboxId, result.region, sandboxInfo.orgId);
|
|
88
109
|
}
|
|
89
110
|
|
|
90
111
|
if (!options.json) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
5
5
|
import { getCommand } from '../../../../command-prefix';
|
|
6
|
-
import { jobCreate
|
|
6
|
+
import { jobCreate } from '@agentuity/server';
|
|
7
7
|
|
|
8
8
|
export const createSubcommand = createCommand({
|
|
9
9
|
name: 'create',
|
|
@@ -33,8 +33,14 @@ export const createSubcommand = createCommand({
|
|
|
33
33
|
async handler(ctx) {
|
|
34
34
|
const { args, options, auth, logger, apiClient } = ctx;
|
|
35
35
|
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
37
|
+
logger,
|
|
38
|
+
auth,
|
|
39
|
+
apiClient,
|
|
40
|
+
args.sandboxId,
|
|
41
|
+
ctx.config?.name ?? 'production',
|
|
42
|
+
ctx.config
|
|
43
|
+
);
|
|
38
44
|
|
|
39
45
|
const client = createSandboxClient(logger, auth, region);
|
|
40
46
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
5
5
|
import { getCommand } from '../../../../command-prefix';
|
|
6
|
-
import { jobStop
|
|
6
|
+
import { jobStop } from '@agentuity/server';
|
|
7
7
|
|
|
8
8
|
export const destroySubcommand = createCommand({
|
|
9
9
|
name: 'destroy',
|
|
@@ -38,8 +38,14 @@ export const destroySubcommand = createCommand({
|
|
|
38
38
|
async handler(ctx) {
|
|
39
39
|
const { args, opts, options, auth, logger, apiClient } = ctx;
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
|
|
41
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
42
|
+
logger,
|
|
43
|
+
auth,
|
|
44
|
+
apiClient,
|
|
45
|
+
args.sandboxId,
|
|
46
|
+
ctx.config?.name ?? 'production',
|
|
47
|
+
ctx.config
|
|
48
|
+
);
|
|
43
49
|
|
|
44
50
|
const client = createSandboxClient(logger, auth, region);
|
|
45
51
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
5
|
-
import { jobGet
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
5
|
+
import { jobGet } from '@agentuity/server';
|
|
6
6
|
|
|
7
7
|
export const getSubcommand = createCommand({
|
|
8
8
|
name: 'get',
|
|
@@ -22,8 +22,14 @@ export const getSubcommand = createCommand({
|
|
|
22
22
|
async handler(ctx) {
|
|
23
23
|
const { args, options, auth, logger, apiClient } = ctx;
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
26
|
+
logger,
|
|
27
|
+
auth,
|
|
28
|
+
apiClient,
|
|
29
|
+
args.sandboxId,
|
|
30
|
+
ctx.config?.name ?? 'production',
|
|
31
|
+
ctx.config
|
|
32
|
+
);
|
|
27
33
|
|
|
28
34
|
const client = createSandboxClient(logger, auth, region);
|
|
29
35
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
5
|
-
import { jobList
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
5
|
+
import { jobList } from '@agentuity/server';
|
|
6
6
|
|
|
7
7
|
export const listSubcommand = createCommand({
|
|
8
8
|
name: 'list',
|
|
@@ -28,8 +28,14 @@ export const listSubcommand = createCommand({
|
|
|
28
28
|
async handler(ctx) {
|
|
29
29
|
const { args, opts, options, auth, logger, apiClient } = ctx;
|
|
30
30
|
|
|
31
|
-
const
|
|
32
|
-
|
|
31
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
32
|
+
logger,
|
|
33
|
+
auth,
|
|
34
|
+
apiClient,
|
|
35
|
+
args.sandboxId,
|
|
36
|
+
ctx.config?.name ?? 'production',
|
|
37
|
+
ctx.config
|
|
38
|
+
);
|
|
33
39
|
|
|
34
40
|
const client = createSandboxClient(logger, auth, region);
|
|
35
41
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createSubcommand } from '../../../../types';
|
|
3
3
|
import * as tui from '../../../../tui';
|
|
4
|
-
import { createSandboxClient } from '../util';
|
|
5
|
-
import { jobGet
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from '../util';
|
|
5
|
+
import { jobGet } from '@agentuity/server';
|
|
6
6
|
import { getCommand } from '../../../../command-prefix';
|
|
7
7
|
import { streamUrlToWritable } from '../../../../utils/stream-url';
|
|
8
8
|
|
|
@@ -64,8 +64,14 @@ export const logsSubcommand = createSubcommand({
|
|
|
64
64
|
async handler(ctx) {
|
|
65
65
|
const { args, opts, options, auth, logger, apiClient } = ctx;
|
|
66
66
|
|
|
67
|
-
const
|
|
68
|
-
|
|
67
|
+
const { region, orgId } = await resolveSandboxTarget(
|
|
68
|
+
logger,
|
|
69
|
+
auth,
|
|
70
|
+
apiClient,
|
|
71
|
+
args.sandboxId,
|
|
72
|
+
ctx.config?.name ?? 'production',
|
|
73
|
+
ctx.config
|
|
74
|
+
);
|
|
69
75
|
|
|
70
76
|
const client = createSandboxClient(logger, auth, region);
|
|
71
77
|
|
|
@@ -121,6 +127,7 @@ export const logsSubcommand = createSubcommand({
|
|
|
121
127
|
tail: opts.tail,
|
|
122
128
|
json: isJson,
|
|
123
129
|
label: opts.stderr ? 'stderr' : 'stdout',
|
|
130
|
+
v2: true,
|
|
124
131
|
});
|
|
125
132
|
|
|
126
133
|
return {
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
|
-
import { createSandboxClient } from './util';
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from './util';
|
|
5
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
|
-
import { sandboxPause
|
|
6
|
+
import { sandboxPause } from '@agentuity/server';
|
|
7
7
|
|
|
8
8
|
const SandboxPauseResponseSchema = z.object({
|
|
9
9
|
success: z.boolean().describe('Whether the operation succeeded'),
|
|
10
10
|
sandboxId: z.string().describe('Sandbox ID'),
|
|
11
11
|
durationMs: z.number().describe('Operation duration in milliseconds'),
|
|
12
|
+
terminatesAt: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe(
|
|
16
|
+
'ISO 8601 timestamp when sandbox will auto-terminate if not resumed (omitted if no paused timeout)'
|
|
17
|
+
),
|
|
12
18
|
});
|
|
13
19
|
|
|
14
20
|
export const pauseSubcommand = createCommand({
|
|
@@ -37,22 +43,42 @@ export const pauseSubcommand = createCommand({
|
|
|
37
43
|
|
|
38
44
|
const started = Date.now();
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
const sandboxInfo = await resolveSandboxTarget(
|
|
47
|
+
logger,
|
|
48
|
+
auth,
|
|
49
|
+
apiClient,
|
|
50
|
+
args.sandboxId,
|
|
51
|
+
ctx.config?.name ?? 'production',
|
|
52
|
+
ctx.config
|
|
53
|
+
);
|
|
42
54
|
|
|
43
55
|
const client = createSandboxClient(logger, auth, sandboxInfo.region);
|
|
44
56
|
|
|
45
|
-
await sandboxPause(client, {
|
|
57
|
+
const result = await sandboxPause(client, {
|
|
58
|
+
sandboxId: args.sandboxId,
|
|
59
|
+
orgId: sandboxInfo.orgId,
|
|
60
|
+
});
|
|
46
61
|
const durationMs = Date.now() - started;
|
|
47
62
|
|
|
48
63
|
if (!options.json) {
|
|
49
64
|
tui.success(`paused sandbox ${tui.bold(args.sandboxId)} in ${durationMs}ms`);
|
|
65
|
+
if (result.terminatesAt) {
|
|
66
|
+
const terminateDate = new Date(result.terminatesAt);
|
|
67
|
+
if (!Number.isNaN(terminateDate.getTime())) {
|
|
68
|
+
tui.info(
|
|
69
|
+
`this sandbox will auto-terminate at ${tui.bold(terminateDate.toLocaleString())} if not resumed`
|
|
70
|
+
);
|
|
71
|
+
} else {
|
|
72
|
+
tui.info('this sandbox has a paused timeout and will auto-terminate if not resumed');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
50
75
|
}
|
|
51
76
|
|
|
52
77
|
return {
|
|
53
78
|
success: true,
|
|
54
79
|
sandboxId: args.sandboxId,
|
|
55
80
|
durationMs,
|
|
81
|
+
terminatesAt: result.terminatesAt,
|
|
56
82
|
};
|
|
57
83
|
},
|
|
58
84
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { createCommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
|
-
import { createSandboxClient } from './util';
|
|
4
|
+
import { createSandboxClient, resolveSandboxTarget } from './util';
|
|
5
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
|
-
import { sandboxResume
|
|
6
|
+
import { sandboxResume } from '@agentuity/server';
|
|
7
7
|
|
|
8
8
|
const SandboxResumeResponseSchema = z.object({
|
|
9
9
|
success: z.boolean().describe('Whether the operation succeeded'),
|
|
@@ -37,8 +37,14 @@ export const resumeSubcommand = createCommand({
|
|
|
37
37
|
|
|
38
38
|
const started = Date.now();
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const sandboxInfo = await resolveSandboxTarget(
|
|
41
|
+
logger,
|
|
42
|
+
auth,
|
|
43
|
+
apiClient,
|
|
44
|
+
args.sandboxId,
|
|
45
|
+
ctx.config?.name ?? 'production',
|
|
46
|
+
ctx.config
|
|
47
|
+
);
|
|
42
48
|
|
|
43
49
|
const client = createSandboxClient(logger, auth, sandboxInfo.region);
|
|
44
50
|
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
3
|
import { createCommand } from '../../../types';
|
|
4
4
|
import * as tui from '../../../tui';
|
|
5
|
-
import { createSandboxClient,
|
|
5
|
+
import { cacheSandboxTarget, createSandboxClient, detectNullStream, parseFileArgs } from './util';
|
|
6
6
|
import { getCommand } from '../../../command-prefix';
|
|
7
7
|
import { sandboxRun } from '@agentuity/server';
|
|
8
8
|
import { validateAptDependencies } from '../../../utils/apt-validator';
|
|
@@ -59,6 +59,11 @@ export const runSubcommand = createCommand({
|
|
|
59
59
|
.default(false)
|
|
60
60
|
.optional()
|
|
61
61
|
.describe('Include timestamps in output (default: true)'),
|
|
62
|
+
quiet: z
|
|
63
|
+
.boolean()
|
|
64
|
+
.default(false)
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('Suppress output (do not create stdout/stderr streams)'),
|
|
62
67
|
snapshot: z.string().optional().describe('Snapshot ID or tag to restore from'),
|
|
63
68
|
dependency: z
|
|
64
69
|
.array(z.string())
|
|
@@ -149,13 +154,46 @@ export const runSubcommand = createCommand({
|
|
|
149
154
|
// Determine if we have stdin data (not a TTY means piped input)
|
|
150
155
|
const hasStdin = !process.stdin.isTTY;
|
|
151
156
|
|
|
152
|
-
//
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
// Detect if stdout/stderr are redirected to /dev/null
|
|
158
|
+
const stdoutIsNull = detectNullStream(1);
|
|
159
|
+
const stderrIsNull = detectNullStream(2);
|
|
160
|
+
|
|
161
|
+
// Detect stream configuration based on TTY status and flags
|
|
162
|
+
const streamConfig: {
|
|
163
|
+
timestamps?: boolean;
|
|
164
|
+
stdin?: string;
|
|
165
|
+
stdout?: string;
|
|
166
|
+
stderr?: string;
|
|
167
|
+
} = {
|
|
168
|
+
timestamps: opts.timestamps,
|
|
169
|
+
// Skip stdin stream when no stdin data available
|
|
170
|
+
stdin: hasStdin ? undefined : 'ignore',
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// --quiet: suppress all output streams (no server streams, no local capture)
|
|
174
|
+
if (opts.quiet) {
|
|
175
|
+
streamConfig.stdout = 'ignore';
|
|
176
|
+
streamConfig.stderr = 'ignore';
|
|
177
|
+
} else if (!options.json) {
|
|
178
|
+
// Auto-detect /dev/null redirection (only when not in JSON mode)
|
|
179
|
+
// In JSON mode we need output for the response, so keep streams even if redirected
|
|
180
|
+
if (stdoutIsNull) {
|
|
181
|
+
streamConfig.stdout = 'ignore';
|
|
182
|
+
}
|
|
183
|
+
if (stderrIsNull) {
|
|
184
|
+
streamConfig.stderr = 'ignore';
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// For JSON output or quiet mode, we need to capture output instead of streaming to process
|
|
189
|
+
const stdout =
|
|
190
|
+
options.json || opts.quiet || stdoutIsNull
|
|
191
|
+
? createCaptureStream((chunk) => outputChunks.push(chunk))
|
|
192
|
+
: process.stdout;
|
|
193
|
+
const stderr =
|
|
194
|
+
options.json || opts.quiet || stderrIsNull
|
|
195
|
+
? createCaptureStream((chunk) => outputChunks.push(chunk))
|
|
196
|
+
: process.stderr;
|
|
159
197
|
|
|
160
198
|
try {
|
|
161
199
|
const result = await sandboxRun(client, {
|
|
@@ -180,7 +218,7 @@ export const runSubcommand = createCommand({
|
|
|
180
218
|
network: opts.network ? { enabled: true } : undefined,
|
|
181
219
|
timeout: opts.timeout ? { execution: opts.timeout } : undefined,
|
|
182
220
|
env: Object.keys(envMap).length > 0 ? envMap : undefined,
|
|
183
|
-
stream:
|
|
221
|
+
stream: streamConfig,
|
|
184
222
|
snapshot: opts.snapshot,
|
|
185
223
|
dependencies: opts.dependency,
|
|
186
224
|
scopes: opts.scope,
|
|
@@ -195,8 +233,8 @@ export const runSubcommand = createCommand({
|
|
|
195
233
|
logger,
|
|
196
234
|
});
|
|
197
235
|
|
|
198
|
-
// Cache
|
|
199
|
-
await
|
|
236
|
+
// Cache routing context for follow-up lookup/debug flows during execution.
|
|
237
|
+
await cacheSandboxTarget(config?.name, result.sandboxId, region, orgId);
|
|
200
238
|
|
|
201
239
|
const duration = Date.now() - started;
|
|
202
240
|
const output = outputChunks.join('');
|