@agentworkforce/deploy 0.0.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.
Files changed (65) hide show
  1. package/dist/bundle.d.ts +22 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +132 -0
  4. package/dist/bundle.js.map +1 -0
  5. package/dist/bundle.test.d.ts +2 -0
  6. package/dist/bundle.test.d.ts.map +1 -0
  7. package/dist/bundle.test.js +92 -0
  8. package/dist/bundle.test.js.map +1 -0
  9. package/dist/connect.d.ts +81 -0
  10. package/dist/connect.d.ts.map +1 -0
  11. package/dist/connect.js +127 -0
  12. package/dist/connect.js.map +1 -0
  13. package/dist/deploy.d.ts +50 -0
  14. package/dist/deploy.d.ts.map +1 -0
  15. package/dist/deploy.js +172 -0
  16. package/dist/deploy.js.map +1 -0
  17. package/dist/deploy.test.d.ts +2 -0
  18. package/dist/deploy.test.d.ts.map +1 -0
  19. package/dist/deploy.test.js +293 -0
  20. package/dist/deploy.test.js.map +1 -0
  21. package/dist/index.d.ts +11 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +10 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/io.d.ts +22 -0
  26. package/dist/io.d.ts.map +1 -0
  27. package/dist/io.js +76 -0
  28. package/dist/io.js.map +1 -0
  29. package/dist/login.d.ts +24 -0
  30. package/dist/login.d.ts.map +1 -0
  31. package/dist/login.js +27 -0
  32. package/dist/login.js.map +1 -0
  33. package/dist/modes/cloud.d.ts +18 -0
  34. package/dist/modes/cloud.d.ts.map +1 -0
  35. package/dist/modes/cloud.js +21 -0
  36. package/dist/modes/cloud.js.map +1 -0
  37. package/dist/modes/dev.d.ts +12 -0
  38. package/dist/modes/dev.d.ts.map +1 -0
  39. package/dist/modes/dev.js +153 -0
  40. package/dist/modes/dev.js.map +1 -0
  41. package/dist/modes/sandbox-client.d.ts +63 -0
  42. package/dist/modes/sandbox-client.d.ts.map +1 -0
  43. package/dist/modes/sandbox-client.js +177 -0
  44. package/dist/modes/sandbox-client.js.map +1 -0
  45. package/dist/modes/sandbox-client.test.d.ts +2 -0
  46. package/dist/modes/sandbox-client.test.d.ts.map +1 -0
  47. package/dist/modes/sandbox-client.test.js +177 -0
  48. package/dist/modes/sandbox-client.test.js.map +1 -0
  49. package/dist/modes/sandbox.d.ts +50 -0
  50. package/dist/modes/sandbox.d.ts.map +1 -0
  51. package/dist/modes/sandbox.js +131 -0
  52. package/dist/modes/sandbox.js.map +1 -0
  53. package/dist/modes/sandbox.test.d.ts +2 -0
  54. package/dist/modes/sandbox.test.d.ts.map +1 -0
  55. package/dist/modes/sandbox.test.js +95 -0
  56. package/dist/modes/sandbox.test.js.map +1 -0
  57. package/dist/preflight.d.ts +14 -0
  58. package/dist/preflight.d.ts.map +1 -0
  59. package/dist/preflight.js +78 -0
  60. package/dist/preflight.js.map +1 -0
  61. package/dist/types.d.ts +140 -0
  62. package/dist/types.d.ts.map +1 -0
  63. package/dist/types.js +2 -0
  64. package/dist/types.js.map +1 -0
  65. package/package.json +40 -0
@@ -0,0 +1,24 @@
1
+ import type { DeployIO } from './types.js';
2
+ /**
3
+ * Workspace authentication primitives. The CLI layer plugs in real
4
+ * implementations that talk to relayauth + the workforce cloud API; the
5
+ * deploy package itself stays SDK-free so the contract is easy to mock.
6
+ */
7
+ export interface WorkspaceAuth {
8
+ /** Resolve the active workspace, prompting the user to pick one if needed. */
9
+ resolveWorkspace(args: {
10
+ override?: string;
11
+ io: DeployIO;
12
+ }): Promise<{
13
+ workspace: string;
14
+ /** Workspace-scoped token usable for gateway + cloud API calls. */
15
+ token: string;
16
+ }>;
17
+ }
18
+ /**
19
+ * Environment-backed fallback resolver: reads `WORKFORCE_WORKSPACE_ID`
20
+ * and `WORKFORCE_WORKSPACE_TOKEN` from `process.env`. Useful in CI and as
21
+ * a sane default before the CLI wires up the OAuth flow.
22
+ */
23
+ export declare function envWorkspaceAuth(): WorkspaceAuth;
24
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,gBAAgB,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;QACnE,SAAS,EAAE,MAAM,CAAC;QAClB,mEAAmE;QACnE,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;CACJ;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAwBhD"}
package/dist/login.js ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Environment-backed fallback resolver: reads `WORKFORCE_WORKSPACE_ID`
3
+ * and `WORKFORCE_WORKSPACE_TOKEN` from `process.env`. Useful in CI and as
4
+ * a sane default before the CLI wires up the OAuth flow.
5
+ */
6
+ export function envWorkspaceAuth() {
7
+ return {
8
+ async resolveWorkspace({ override, io }) {
9
+ // Normalize whitespace-only values to "missing" — a token of `" "`
10
+ // is no more usable than an empty string, and silently passing one
11
+ // through produces a confusing 401 later instead of a clear setup
12
+ // error here.
13
+ const workspace = (override ?? process.env.WORKFORCE_WORKSPACE_ID ?? '').trim();
14
+ const token = (process.env.WORKFORCE_WORKSPACE_TOKEN ?? '').trim();
15
+ if (!workspace) {
16
+ io.error('no workspace resolved: pass --workspace, set WORKFORCE_WORKSPACE_ID, or run `workforce login`');
17
+ throw new Error('workspace is required for deploy');
18
+ }
19
+ if (!token) {
20
+ io.error('no workspace token resolved: set WORKFORCE_WORKSPACE_TOKEN, or run `workforce login` to mint one');
21
+ throw new Error('workspace token is required for deploy');
22
+ }
23
+ return { workspace, token };
24
+ }
25
+ };
26
+ }
27
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,KAAK,CAAC,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;YACrC,oEAAoE;YACpE,mEAAmE;YACnE,kEAAkE;YAClE,cAAc;YACd,MAAM,SAAS,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YAChF,MAAM,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YACnE,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,EAAE,CAAC,KAAK,CACN,+FAA+F,CAChG,CAAC;gBACF,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;YACtD,CAAC;YACD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,EAAE,CAAC,KAAK,CACN,kGAAkG,CACnG,CAAC;gBACF,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;YAC5D,CAAC;YACD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { ModeLauncher } from '../types.js';
2
+ /**
3
+ * Workforce-cloud-hosted deploy mode. Uploads the bundle to the workforce
4
+ * cloud deployments endpoint and lets the cloud runtime host the agent.
5
+ *
6
+ * The endpoint (`POST /api/v1/workspaces/:id/deployments`) is part of the
7
+ * proactive-runtime backend roadmap and is not yet live. Until it is,
8
+ * `--mode cloud` returns a clean error that points users at the working
9
+ * modes (`--mode sandbox` and `--mode dev`).
10
+ *
11
+ * When the endpoint ships, the implementation flow is:
12
+ * 1. POST persona.json + agent.bundle.mjs + runner.mjs as multipart.
13
+ * 2. Receive `{ deploymentId, statusUrl }`.
14
+ * 3. Poll `statusUrl` until the cloud reports `running`.
15
+ * 4. Return a handle whose `stop()` calls DELETE on the deployment.
16
+ */
17
+ export declare const cloudLauncher: ModeLauncher;
18
+ //# sourceMappingURL=cloud.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud.d.ts","sourceRoot":"","sources":["../../src/modes/cloud.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,EAAE,YAM3B,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Workforce-cloud-hosted deploy mode. Uploads the bundle to the workforce
3
+ * cloud deployments endpoint and lets the cloud runtime host the agent.
4
+ *
5
+ * The endpoint (`POST /api/v1/workspaces/:id/deployments`) is part of the
6
+ * proactive-runtime backend roadmap and is not yet live. Until it is,
7
+ * `--mode cloud` returns a clean error that points users at the working
8
+ * modes (`--mode sandbox` and `--mode dev`).
9
+ *
10
+ * When the endpoint ships, the implementation flow is:
11
+ * 1. POST persona.json + agent.bundle.mjs + runner.mjs as multipart.
12
+ * 2. Receive `{ deploymentId, statusUrl }`.
13
+ * 3. Poll `statusUrl` until the cloud reports `running`.
14
+ * 4. Return a handle whose `stop()` calls DELETE on the deployment.
15
+ */
16
+ export const cloudLauncher = {
17
+ async launch(_input) {
18
+ throw new Error('--mode cloud is not yet available: the workforce cloud deployments endpoint is in progress. Use --mode sandbox (Daytona) or --mode dev (local) today.');
19
+ }
20
+ };
21
+ //# sourceMappingURL=cloud.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud.js","sourceRoot":"","sources":["../../src/modes/cloud.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC,KAAK,CAAC,MAAM,CAAC,MAAuB;QAClC,MAAM,IAAI,KAAK,CACb,uJAAuJ,CACxJ,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ModeLauncher } from '../types.js';
2
+ /**
3
+ * Local dev-mode launcher. Spawns `node <bundle.runnerPath>` as a child
4
+ * process, forwards line-buffered stdout/stderr through the supplied
5
+ * DeployIO, and resolves `done` when the child exits.
6
+ *
7
+ * `stop()` sends SIGTERM and escalates to SIGKILL after 5s if the child
8
+ * hasn't exited cleanly. The parent's SIGINT/SIGTERM are forwarded too
9
+ * so Ctrl-C in `--mode dev` produces an orderly shutdown.
10
+ */
11
+ export declare const devLauncher: ModeLauncher;
12
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/modes/dev.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,aAAa,CAAC;AAMrB;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,YAkGzB,CAAC"}
@@ -0,0 +1,153 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { createRequire } from 'node:module';
3
+ import { mkdir, rm, symlink } from 'node:fs/promises';
4
+ import path from 'node:path';
5
+ const SIGTERM_TO_SIGKILL_MS = 5_000;
6
+ const RUNTIME_PACKAGES = ['@agentworkforce/runtime', '@agentworkforce/persona-kit'];
7
+ /**
8
+ * Local dev-mode launcher. Spawns `node <bundle.runnerPath>` as a child
9
+ * process, forwards line-buffered stdout/stderr through the supplied
10
+ * DeployIO, and resolves `done` when the child exits.
11
+ *
12
+ * `stop()` sends SIGTERM and escalates to SIGKILL after 5s if the child
13
+ * hasn't exited cleanly. The parent's SIGINT/SIGTERM are forwarded too
14
+ * so Ctrl-C in `--mode dev` produces an orderly shutdown.
15
+ */
16
+ export const devLauncher = {
17
+ async launch(input) {
18
+ const runnerPath = input.bundle.runnerPath;
19
+ const cwd = path.dirname(runnerPath);
20
+ // The generated runner imports `@agentworkforce/runtime`. In dev
21
+ // mode we resolve the package out of the parent workforce install
22
+ // and symlink it into the bundle's local node_modules so node's
23
+ // ESM resolver finds it without an `npm install` step. The link is
24
+ // idempotent: stale links are replaced on every launch.
25
+ await linkRuntimePackages(cwd);
26
+ const env = {
27
+ ...process.env,
28
+ ...(input.env ?? {}),
29
+ WORKFORCE_WORKSPACE_ID: input.workspace,
30
+ WORKFORCE_PERSONA_ID: input.persona.id
31
+ };
32
+ const child = spawn(process.execPath, [runnerPath], {
33
+ cwd,
34
+ env,
35
+ stdio: ['pipe', 'pipe', 'pipe']
36
+ });
37
+ // Bridge the parent process's stdin into the child runner. The
38
+ // runner reads NDJSON envelopes from its stdin, so any envelopes the
39
+ // user pipes into `workforce deploy --mode dev` flow straight into
40
+ // the runner without an intermediate file.
41
+ if (child.stdin) {
42
+ process.stdin.pipe(child.stdin);
43
+ // When the parent's stdin closes (EOF / piped input drained), end
44
+ // the child's stdin too so the runner's for-await loop terminates.
45
+ process.stdin.once('end', () => {
46
+ child.stdin?.end();
47
+ });
48
+ }
49
+ if (child.pid === undefined) {
50
+ throw new Error('dev launcher: failed to spawn runner (no pid assigned)');
51
+ }
52
+ forwardLines(child.stdout, (line) => input.io.info(`[runtime] ${line}`));
53
+ forwardLines(child.stderr, (line) => input.io.warn(`[runtime] ${line}`));
54
+ const done = new Promise((resolveDone) => {
55
+ child.once('exit', (code, signal) => {
56
+ const exitCode = typeof code === 'number' ? code : signal ? signalExit(signal) : 0;
57
+ resolveDone({ code: exitCode });
58
+ });
59
+ });
60
+ let stopping = false;
61
+ const stop = async () => {
62
+ if (stopping) {
63
+ await done;
64
+ return;
65
+ }
66
+ stopping = true;
67
+ child.stdin?.end();
68
+ child.kill('SIGTERM');
69
+ // `child.killed` flips true the moment `kill()` delivers the signal,
70
+ // regardless of whether the child has actually exited. To detect a
71
+ // stuck child we have to look at the real lifecycle markers — both
72
+ // exitCode and signalCode stay null until the OS reaps the process.
73
+ const escalation = setTimeout(() => {
74
+ if (child.exitCode === null && child.signalCode === null) {
75
+ child.kill('SIGKILL');
76
+ }
77
+ }, SIGTERM_TO_SIGKILL_MS).unref();
78
+ try {
79
+ await done;
80
+ }
81
+ finally {
82
+ clearTimeout(escalation);
83
+ }
84
+ };
85
+ // Bridge parent-process signal handlers so Ctrl-C in --mode dev
86
+ // produces a clean child shutdown (and not an orphaned runner).
87
+ const forwardParentSignal = (signal) => {
88
+ void stop().catch(() => {
89
+ /* stop already drained */
90
+ });
91
+ process.off('SIGINT', forwardParentSignal);
92
+ process.off('SIGTERM', forwardParentSignal);
93
+ // Re-raise so the parent's normal exit semantics take over after
94
+ // the child closes down.
95
+ process.kill(process.pid, signal);
96
+ };
97
+ process.once('SIGINT', forwardParentSignal);
98
+ process.once('SIGTERM', forwardParentSignal);
99
+ return {
100
+ id: `pid:${child.pid}`,
101
+ stop,
102
+ done
103
+ };
104
+ }
105
+ };
106
+ function forwardLines(stream, write) {
107
+ let buffered = '';
108
+ stream.setEncoding('utf8');
109
+ stream.on('data', (chunk) => {
110
+ buffered += chunk;
111
+ let nl = buffered.indexOf('\n');
112
+ while (nl !== -1) {
113
+ const line = buffered.slice(0, nl).replace(/\r$/, '');
114
+ buffered = buffered.slice(nl + 1);
115
+ if (line.length > 0)
116
+ write(line);
117
+ nl = buffered.indexOf('\n');
118
+ }
119
+ });
120
+ stream.on('end', () => {
121
+ const tail = buffered.trim();
122
+ if (tail.length > 0)
123
+ write(tail);
124
+ });
125
+ }
126
+ async function linkRuntimePackages(bundleDir) {
127
+ const nodeModulesDir = path.join(bundleDir, 'node_modules');
128
+ const scopeDir = path.join(nodeModulesDir, '@agentworkforce');
129
+ await mkdir(scopeDir, { recursive: true });
130
+ // Resolve each package's installed root by asking node where its
131
+ // `package.json` lives, then symlink that root into our bundle's
132
+ // node_modules. Using `require.resolve` guarantees we point at the
133
+ // package the deploy package itself imports — no env var dance.
134
+ const localRequire = createRequire(import.meta.url);
135
+ for (const pkg of RUNTIME_PACKAGES) {
136
+ const manifestPath = localRequire.resolve(`${pkg}/package.json`);
137
+ const packageRoot = path.dirname(manifestPath);
138
+ const linkPath = path.join(scopeDir, pkg.slice('@agentworkforce/'.length));
139
+ await rm(linkPath, { recursive: true, force: true });
140
+ await symlink(packageRoot, linkPath, 'dir');
141
+ }
142
+ }
143
+ function signalExit(signal) {
144
+ // Match the POSIX convention for terminated children.
145
+ const SIGNAL_MAP = {
146
+ SIGINT: 130,
147
+ SIGTERM: 143,
148
+ SIGKILL: 137,
149
+ SIGHUP: 129
150
+ };
151
+ return SIGNAL_MAP[signal] ?? 1;
152
+ }
153
+ //# sourceMappingURL=dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/modes/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAQ7B,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAEpC,MAAM,gBAAgB,GAAG,CAAC,yBAAyB,EAAE,6BAA6B,CAAU,CAAC;AAE7F;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,KAAK,CAAC,MAAM,CAAC,KAAsB;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;QAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAErC,iEAAiE;QACjE,kEAAkE;QAClE,gEAAgE;QAChE,mEAAmE;QACnE,wDAAwD;QACxD,MAAM,mBAAmB,CAAC,GAAG,CAAC,CAAC;QAE/B,MAAM,GAAG,GAAsB;YAC7B,GAAG,OAAO,CAAC,GAAG;YACd,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC;Y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,OAAO,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { BundleResult } from '../types.js';
2
+ /**
3
+ * Working directory the runner is invoked from inside the sandbox. Same
4
+ * mount root cloud's DaytonaRuntime defaults to, so persona authors get
5
+ * consistent paths whether they run under workforce or cloud workflows.
6
+ */
7
+ export declare const SANDBOX_BUNDLE_DIR = "/home/daytona/bundle";
8
+ export interface SandboxExecResult {
9
+ exitCode: number;
10
+ output: string;
11
+ }
12
+ /**
13
+ * Abstraction over the two paths workforce uses to drive a sandbox:
14
+ * - BYO — the user's `DAYTONA_API_KEY` is in env; we talk to Daytona
15
+ * directly via the SDK.
16
+ * - Proxy — workforce cloud holds the org Daytona credentials; we
17
+ * POST `/workspaces/:id/sandboxes` to mint a sandbox and then
18
+ * send `exec` and `files` calls through cloud's per-sandbox
19
+ * proxy URLs.
20
+ *
21
+ * Both implementations satisfy the same interface so the launcher stays
22
+ * mode-agnostic. `mint()` is required up front; the rest of the methods
23
+ * operate on the returned handle.
24
+ */
25
+ export interface SandboxClient {
26
+ mint(args: MintArgs): Promise<SandboxHandle>;
27
+ uploadBundle(handle: SandboxHandle, bundle: BundleResult): Promise<void>;
28
+ exec(handle: SandboxHandle, command: string, opts?: ExecOptions): Promise<SandboxExecResult>;
29
+ destroy(handle: SandboxHandle): Promise<void>;
30
+ }
31
+ export interface MintArgs {
32
+ label: string;
33
+ env?: Record<string, string>;
34
+ /** Cap the create call itself; not the sandbox lifetime. */
35
+ createTimeoutSeconds?: number;
36
+ }
37
+ export interface ExecOptions {
38
+ cwd?: string;
39
+ env?: Record<string, string>;
40
+ timeoutSeconds?: number;
41
+ }
42
+ export interface SandboxHandle {
43
+ /** Mode-tagged id (`byo:<sandboxId>` / `proxy:<sandboxId>`). */
44
+ id: string;
45
+ sandboxId: string;
46
+ mode: 'byo' | 'proxy';
47
+ }
48
+ export interface ByoSandboxClientOptions {
49
+ apiKey?: string;
50
+ jwtToken?: string;
51
+ organizationId?: string;
52
+ }
53
+ export declare function createByoSandboxClient(opts: ByoSandboxClientOptions): SandboxClient;
54
+ export interface ProxySandboxClientOptions {
55
+ cloudUrl: string;
56
+ workspaceId: string;
57
+ workspaceToken: string;
58
+ personaId: string;
59
+ /** Defaults to global fetch; tests pass a stub. */
60
+ fetchImpl?: typeof fetch;
61
+ }
62
+ export declare function createProxySandboxClient(opts: ProxySandboxClientOptions): SandboxClient;
63
+ //# sourceMappingURL=sandbox-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-client.d.ts","sourceRoot":"","sources":["../../src/modes/sandbox-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAEzD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7C,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC7F,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,4DAA4D;IAC5D,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;CACvB;AAID,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAOD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,uBAAuB,GAAG,aAAa,CA2DnF;AAID,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAQD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,yBAAyB,GAAG,aAAa,CAgHvF"}
@@ -0,0 +1,177 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { Daytona } from '@daytonaio/sdk';
3
+ /**
4
+ * Working directory the runner is invoked from inside the sandbox. Same
5
+ * mount root cloud's DaytonaRuntime defaults to, so persona authors get
6
+ * consistent paths whether they run under workforce or cloud workflows.
7
+ */
8
+ export const SANDBOX_BUNDLE_DIR = '/home/daytona/bundle';
9
+ export function createByoSandboxClient(opts) {
10
+ if (!opts.apiKey && !opts.jwtToken) {
11
+ throw new Error('BYO sandbox client requires DAYTONA_API_KEY (or DAYTONA_JWT_TOKEN + DAYTONA_ORGANIZATION_ID) in env');
12
+ }
13
+ const daytona = new Daytona(opts);
14
+ return {
15
+ async mint(args) {
16
+ const sandbox = await daytona.create({
17
+ language: 'typescript',
18
+ name: args.label,
19
+ ...(args.env ? { envVars: args.env } : {})
20
+ });
21
+ const handle = {
22
+ id: `byo:${sandbox.id}`,
23
+ sandboxId: sandbox.id,
24
+ mode: 'byo',
25
+ sandbox
26
+ };
27
+ return handle;
28
+ },
29
+ async uploadBundle(handle, bundle) {
30
+ const internal = handle;
31
+ const files = await readBundleFiles(bundle);
32
+ await internal.sandbox.fs.uploadFiles(files);
33
+ // Same offline-friendly npm install pattern as the proxy path so
34
+ // the bundle's runtime dep resolves consistently across modes.
35
+ const install = await internal.sandbox.process.executeCommand('npm install --prefer-offline --no-audit --no-fund --loglevel=error', SANDBOX_BUNDLE_DIR, undefined, 600);
36
+ if ((install.exitCode ?? 0) !== 0) {
37
+ throw new Error(`sandbox(byo): npm install failed (exit ${install.exitCode}): ${install.result?.slice(0, 400) ?? ''}`);
38
+ }
39
+ },
40
+ async exec(handle, command, options) {
41
+ const internal = handle;
42
+ const result = await internal.sandbox.process.executeCommand(command, options?.cwd, options?.env, options?.timeoutSeconds);
43
+ return {
44
+ exitCode: result.exitCode ?? 0,
45
+ output: result.result ?? ''
46
+ };
47
+ },
48
+ async destroy(handle) {
49
+ const internal = handle;
50
+ await internal.sandbox.delete();
51
+ }
52
+ };
53
+ }
54
+ export function createProxySandboxClient(opts) {
55
+ const fetchImpl = opts.fetchImpl ?? fetch;
56
+ const base = `${opts.cloudUrl.replace(/\/$/, '')}/api/v1/workspaces/${encodeURIComponent(opts.workspaceId)}`;
57
+ function headers(extra = {}) {
58
+ return {
59
+ authorization: `Bearer ${opts.workspaceToken}`,
60
+ 'user-agent': 'workforce-deploy',
61
+ ...extra
62
+ };
63
+ }
64
+ return {
65
+ async mint(args) {
66
+ const response = await fetchImpl(`${base}/sandboxes`, {
67
+ method: 'POST',
68
+ headers: headers({ 'content-type': 'application/json' }),
69
+ body: JSON.stringify({
70
+ purpose: 'workforce-deploy',
71
+ personaId: opts.personaId,
72
+ label: args.label,
73
+ env: args.env,
74
+ // `timeoutSeconds` on the mint contract caps the *create call*,
75
+ // not the sandbox lifetime. Default to 120s which matches the
76
+ // cloud-side MAX_CREATE_TIMEOUT_SECONDS clamp.
77
+ timeoutSeconds: args.createTimeoutSeconds ?? 120
78
+ })
79
+ });
80
+ if (!response.ok) {
81
+ throw await toError(response, 'sandbox(proxy).mint');
82
+ }
83
+ const body = (await response.json());
84
+ if (!body?.sandboxId || !body.execUrl || !body.filesUrl) {
85
+ throw new Error(`sandbox(proxy).mint: cloud response missing sandboxId/execUrl/filesUrl: ${JSON.stringify(body)}`);
86
+ }
87
+ const handle = {
88
+ id: `proxy:${body.sandboxId}`,
89
+ sandboxId: body.sandboxId,
90
+ mode: 'proxy',
91
+ execUrl: absoluteUrl(opts.cloudUrl, body.execUrl),
92
+ filesUrl: absoluteUrl(opts.cloudUrl, body.filesUrl)
93
+ };
94
+ return handle;
95
+ },
96
+ async uploadBundle(handle, bundle) {
97
+ const internal = handle;
98
+ const files = await readBundleFiles(bundle);
99
+ const response = await fetchImpl(internal.filesUrl, {
100
+ method: 'PUT',
101
+ headers: headers({ 'content-type': 'application/json' }),
102
+ body: JSON.stringify({
103
+ entries: files.map((file) => ({
104
+ source: file.source.toString('base64'),
105
+ destination: file.destination
106
+ }))
107
+ })
108
+ });
109
+ if (!response.ok) {
110
+ throw await toError(response, 'sandbox(proxy).uploadBundle');
111
+ }
112
+ // Cloud's `files` endpoint only uploads — the install step still
113
+ // has to go through `exec` after the files land.
114
+ const install = await this.exec(handle, 'npm install --prefer-offline --no-audit --no-fund --loglevel=error', {
115
+ cwd: SANDBOX_BUNDLE_DIR,
116
+ timeoutSeconds: 600
117
+ });
118
+ if (install.exitCode !== 0) {
119
+ throw new Error(`sandbox(proxy): npm install failed (exit ${install.exitCode}): ${install.output.slice(0, 400)}`);
120
+ }
121
+ },
122
+ async exec(handle, command, options) {
123
+ const internal = handle;
124
+ const response = await fetchImpl(internal.execUrl, {
125
+ method: 'POST',
126
+ headers: headers({ 'content-type': 'application/json' }),
127
+ body: JSON.stringify({
128
+ command,
129
+ ...(options?.cwd ? { cwd: options.cwd } : {}),
130
+ ...(options?.env ? { env: options.env } : {}),
131
+ timeoutSeconds: options?.timeoutSeconds ?? 600
132
+ })
133
+ });
134
+ if (!response.ok) {
135
+ throw await toError(response, 'sandbox(proxy).exec');
136
+ }
137
+ const body = (await response.json());
138
+ return { exitCode: body.exitCode ?? 0, output: body.output ?? '' };
139
+ },
140
+ async destroy(handle) {
141
+ const response = await fetchImpl(`${base}/sandboxes/${encodeURIComponent(handle.sandboxId)}`, {
142
+ method: 'DELETE',
143
+ headers: headers()
144
+ });
145
+ if (!response.ok && response.status !== 404) {
146
+ throw await toError(response, 'sandbox(proxy).destroy');
147
+ }
148
+ }
149
+ };
150
+ }
151
+ // ─── Shared helpers ─────────────────────────────────────────────────────
152
+ async function readBundleFiles(bundle) {
153
+ return Promise.all([
154
+ fileUpload(bundle.runnerPath, `${SANDBOX_BUNDLE_DIR}/runner.mjs`),
155
+ fileUpload(bundle.bundlePath, `${SANDBOX_BUNDLE_DIR}/agent.bundle.mjs`),
156
+ fileUpload(bundle.personaCopyPath, `${SANDBOX_BUNDLE_DIR}/persona.json`),
157
+ fileUpload(bundle.packageJsonPath, `${SANDBOX_BUNDLE_DIR}/package.json`)
158
+ ]);
159
+ }
160
+ async function fileUpload(localPath, remotePath) {
161
+ const source = await readFile(localPath);
162
+ return { source, destination: remotePath };
163
+ }
164
+ function absoluteUrl(cloudBase, maybeRelative) {
165
+ if (/^https?:\/\//.test(maybeRelative))
166
+ return maybeRelative;
167
+ // Cloud sometimes returns relative paths (`/api/v1/...`); attach the
168
+ // configured base so the workforce CLI can call them outside the
169
+ // cloud's own hostname.
170
+ return `${cloudBase.replace(/\/$/, '')}${maybeRelative.startsWith('/') ? '' : '/'}${maybeRelative}`;
171
+ }
172
+ async function toError(response, label) {
173
+ const body = await response.text().catch(() => '');
174
+ const excerpt = body.length > 400 ? `${body.slice(0, 400)}…` : body;
175
+ return new Error(`${label}: ${response.status} ${response.statusText}${excerpt ? ` — ${excerpt}` : ''}`);
176
+ }
177
+ //# sourceMappingURL=sandbox-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-client.js","sourceRoot":"","sources":["../../src/modes/sandbox-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAkC,MAAM,gBAAgB,CAAC;AAGzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AA4DzD,MAAM,UAAU,sBAAsB,CAAC,IAA6B;IAClE,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,qGAAqG,CACtG,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,IAAI;YACb,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC;gBACnC,QAAQ,EAAE,YAAY;gBACtB,IAAI,EAAE,IAAI,CAAC,KAAK;gBAChB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC3C,CAAC,CAAC;YACH,MAAM,MAAM,GAAsB;gBAChC,EAAE,EAAE,OAAO,OAAO,CAAC,EAAE,EAAE;gBACvB,SAAS,EAAE,OAAO,CAAC,EAAE;gBACrB,IAAI,EAAE,KAAK;gBACX,OAAO;aACR,CAAC;YACF,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM;YAC/B,MAAM,QAAQ,GAAG,MAA2B,C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AAE,EAAE,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,aAAa,EAAE,CAAC;AACtG,CAAC;AAED,KAAK,UAAU,OAAO,CAAC,QAAkB,EAAE,KAAa;IACtD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IACpE,OAAO,IAAI,KAAK,CACd,GAAG,KAAK,KAAK,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACvF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sandbox-client.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-client.test.d.ts","sourceRoot":"","sources":["../../src/modes/sandbox-client.test.ts"],"names":[],"mappings":""}