dev3000 0.0.188 → 0.0.191
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/README.md +84 -12
- package/dist/cdp-monitor.d.ts +10 -0
- package/dist/cdp-monitor.d.ts.map +1 -1
- package/dist/cdp-monitor.js +28 -4
- package/dist/cdp-monitor.js.map +1 -1
- package/dist/runtime/bridge.d.ts +2 -0
- package/dist/runtime/bridge.d.ts.map +1 -1
- package/dist/runtime/bridge.js +74 -0
- package/dist/runtime/bridge.js.map +1 -1
- package/dist/runtime/browser-events.d.ts +3 -2
- package/dist/runtime/browser-events.d.ts.map +1 -1
- package/dist/runtime/browser-events.js +11 -53
- package/dist/runtime/browser-events.js.map +1 -1
- package/dist/runtime/browser-metrics.d.ts +147 -0
- package/dist/runtime/browser-metrics.d.ts.map +1 -0
- package/dist/runtime/browser-metrics.js +243 -0
- package/dist/runtime/browser-metrics.js.map +1 -0
- package/dist/runtime/chrome-isolation.d.ts +3 -2
- package/dist/runtime/chrome-isolation.d.ts.map +1 -1
- package/dist/runtime/chrome-isolation.js +23 -35
- package/dist/runtime/chrome-isolation.js.map +1 -1
- package/dist/runtime/cli.js +63 -2
- package/dist/runtime/cli.js.map +1 -1
- package/dist/runtime/desktop-mcp.d.ts +216 -0
- package/dist/runtime/desktop-mcp.d.ts.map +1 -0
- package/dist/runtime/desktop-mcp.js +258 -0
- package/dist/runtime/desktop-mcp.js.map +1 -0
- package/dist/runtime/git-identity.d.ts +17 -0
- package/dist/runtime/git-identity.d.ts.map +1 -0
- package/dist/runtime/git-identity.js +41 -0
- package/dist/runtime/git-identity.js.map +1 -0
- package/dist/runtime/github-publish.d.ts +31 -0
- package/dist/runtime/github-publish.d.ts.map +1 -0
- package/dist/runtime/github-publish.js +237 -0
- package/dist/runtime/github-publish.js.map +1 -0
- package/dist/runtime/harness.d.ts +14 -3
- package/dist/runtime/harness.d.ts.map +1 -1
- package/dist/runtime/harness.js +55 -7
- package/dist/runtime/harness.js.map +1 -1
- package/dist/runtime/mcp-stdio.d.ts +17 -0
- package/dist/runtime/mcp-stdio.d.ts.map +1 -0
- package/dist/runtime/mcp-stdio.js +99 -0
- package/dist/runtime/mcp-stdio.js.map +1 -0
- package/dist/runtime/network-evidence.d.ts +28 -0
- package/dist/runtime/network-evidence.d.ts.map +1 -0
- package/dist/runtime/network-evidence.js +291 -0
- package/dist/runtime/network-evidence.js.map +1 -0
- package/dist/runtime/runtime.d.ts +4 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +48 -17
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/sandbox-agent.d.ts +5 -0
- package/dist/runtime/sandbox-agent.d.ts.map +1 -1
- package/dist/runtime/sandbox-agent.js +32 -0
- package/dist/runtime/sandbox-agent.js.map +1 -1
- package/dist/runtime/sandbox-cleanup.d.ts +14 -0
- package/dist/runtime/sandbox-cleanup.d.ts.map +1 -0
- package/dist/runtime/sandbox-cleanup.js +49 -0
- package/dist/runtime/sandbox-cleanup.js.map +1 -0
- package/dist/runtime/sandbox-command.d.ts +1 -0
- package/dist/runtime/sandbox-command.d.ts.map +1 -1
- package/dist/runtime/sandbox-command.js +38 -8
- package/dist/runtime/sandbox-command.js.map +1 -1
- package/dist/runtime/sandbox-context.d.ts +5 -0
- package/dist/runtime/sandbox-context.d.ts.map +1 -0
- package/dist/runtime/sandbox-context.js +42 -0
- package/dist/runtime/sandbox-context.js.map +1 -0
- package/dist/runtime/sandbox-fx-resume.d.ts +11 -0
- package/dist/runtime/sandbox-fx-resume.d.ts.map +1 -0
- package/dist/runtime/sandbox-fx-resume.js +45 -0
- package/dist/runtime/sandbox-fx-resume.js.map +1 -0
- package/dist/runtime/sandbox-gateway.d.ts +17 -0
- package/dist/runtime/sandbox-gateway.d.ts.map +1 -0
- package/dist/runtime/sandbox-gateway.js +34 -0
- package/dist/runtime/sandbox-gateway.js.map +1 -0
- package/dist/runtime/sandbox-github.d.ts +10 -0
- package/dist/runtime/sandbox-github.d.ts.map +1 -0
- package/dist/runtime/sandbox-github.js +35 -0
- package/dist/runtime/sandbox-github.js.map +1 -0
- package/dist/runtime/sandbox-local-harness.d.ts +34 -0
- package/dist/runtime/sandbox-local-harness.d.ts.map +1 -0
- package/dist/runtime/sandbox-local-harness.js +138 -0
- package/dist/runtime/sandbox-local-harness.js.map +1 -0
- package/dist/runtime/sandbox-preview.d.ts +14 -0
- package/dist/runtime/sandbox-preview.d.ts.map +1 -0
- package/dist/runtime/sandbox-preview.js +96 -0
- package/dist/runtime/sandbox-preview.js.map +1 -0
- package/dist/runtime/sandbox-process.d.ts +11 -0
- package/dist/runtime/sandbox-process.d.ts.map +1 -0
- package/dist/runtime/sandbox-process.js +77 -0
- package/dist/runtime/sandbox-process.js.map +1 -0
- package/dist/runtime/sandbox-proxy.d.ts +2 -0
- package/dist/runtime/sandbox-proxy.d.ts.map +1 -1
- package/dist/runtime/sandbox-proxy.js +75 -20
- package/dist/runtime/sandbox-proxy.js.map +1 -1
- package/dist/runtime/sandbox-recovery.d.ts +4 -0
- package/dist/runtime/sandbox-recovery.d.ts.map +1 -0
- package/dist/runtime/sandbox-recovery.js +36 -0
- package/dist/runtime/sandbox-recovery.js.map +1 -0
- package/dist/runtime/sandbox-sessions.d.ts +8 -1
- package/dist/runtime/sandbox-sessions.d.ts.map +1 -1
- package/dist/runtime/sandbox-sessions.js +20 -2
- package/dist/runtime/sandbox-sessions.js.map +1 -1
- package/dist/runtime/sandbox-setup.d.ts +4 -0
- package/dist/runtime/sandbox-setup.d.ts.map +1 -0
- package/dist/runtime/sandbox-setup.js +56 -0
- package/dist/runtime/sandbox-setup.js.map +1 -0
- package/dist/runtime/sandbox-shell.d.ts +27 -0
- package/dist/runtime/sandbox-shell.d.ts.map +1 -0
- package/dist/runtime/sandbox-shell.js +169 -0
- package/dist/runtime/sandbox-shell.js.map +1 -0
- package/dist/runtime/sandbox-watch.d.ts +11 -0
- package/dist/runtime/sandbox-watch.d.ts.map +1 -0
- package/dist/runtime/sandbox-watch.js +30 -0
- package/dist/runtime/sandbox-watch.js.map +1 -0
- package/dist/runtime/sandbox-workspace.d.ts +125 -0
- package/dist/runtime/sandbox-workspace.d.ts.map +1 -0
- package/dist/runtime/sandbox-workspace.js +205 -0
- package/dist/runtime/sandbox-workspace.js.map +1 -0
- package/dist/runtime/sandbox.d.ts +21 -2
- package/dist/runtime/sandbox.d.ts.map +1 -1
- package/dist/runtime/sandbox.js +435 -198
- package/dist/runtime/sandbox.js.map +1 -1
- package/dist/runtime/session.d.ts +1 -1
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +3 -3
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/terminal.d.ts +19 -0
- package/dist/runtime/terminal.d.ts.map +1 -0
- package/dist/runtime/terminal.js +60 -0
- package/dist/runtime/terminal.js.map +1 -0
- package/dist/runtime/workspace-client.d.ts +2 -0
- package/dist/runtime/workspace-client.d.ts.map +1 -0
- package/dist/runtime/workspace-client.js +42 -0
- package/dist/runtime/workspace-client.js.map +1 -0
- package/package.json +2 -1
- package/scripts/eve/README.md +341 -0
- package/scripts/eve/agent/agent.ts +12 -0
- package/scripts/eve/agent/channels/eve.ts +23 -0
- package/scripts/eve/agent/instructions.md +53 -0
- package/scripts/eve/agent/sandbox.ts +34 -0
- package/scripts/eve/build-cache.mjs +18 -0
- package/scripts/eve/build-cache.test.mjs +32 -0
- package/scripts/eve/client.mjs +229 -0
- package/scripts/eve/connection.mjs +89 -0
- package/scripts/eve/conversation.mjs +91 -0
- package/scripts/eve/conversation.test.mjs +113 -0
- package/scripts/eve/fixture-agent.ts +101 -0
- package/scripts/eve/images.mjs +84 -0
- package/scripts/eve/launch.mjs +277 -0
- package/scripts/eve/model-command.mjs +21 -0
- package/scripts/eve/reconnect.mjs +22 -0
- package/scripts/eve/reconnect.test.mjs +41 -0
- package/scripts/eve/settings.mjs +33 -0
- package/scripts/eve/supervisor.mjs +41 -0
- package/scripts/eve/tui-client.mjs +234 -0
- package/scripts/eve/tui-input.mjs +114 -0
- package/scripts/eve/verify.mjs +575 -0
- package/skills/d3k/SKILL.md +48 -5
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SANDBOX_AGENT_DIRECTORY, SANDBOX_TOOLS } from "./sandbox-agent.js";
|
|
2
|
+
import { sandboxFxContext } from "./sandbox-context.js";
|
|
3
|
+
/** Close independent local resources together; remote cleanup shares one deadline. */
|
|
4
|
+
export async function closeSandboxResources(options) {
|
|
5
|
+
const remote = async () => {
|
|
6
|
+
const sandbox = options.sandbox;
|
|
7
|
+
if (!sandbox)
|
|
8
|
+
return;
|
|
9
|
+
const signal = AbortSignal.timeout(5000);
|
|
10
|
+
await Promise.allSettled([
|
|
11
|
+
options.fxContextInstalled
|
|
12
|
+
? sandboxFxContext(sandbox, undefined, signal).catch(() => options.log("Could not remove the sandbox fx browser context"))
|
|
13
|
+
: undefined,
|
|
14
|
+
sandbox.runCommand({
|
|
15
|
+
cmd: "rm",
|
|
16
|
+
args: ["-rf", `${SANDBOX_AGENT_DIRECTORY}/gateway.json`, `${SANDBOX_TOOLS}/harness-context`],
|
|
17
|
+
timeoutMs: 4000,
|
|
18
|
+
signal
|
|
19
|
+
}),
|
|
20
|
+
// Stopping owned compute also stops its runtime. Attached compute must stay running.
|
|
21
|
+
!options.ownsSandbox && options.remoteStarted
|
|
22
|
+
? sandbox.runCommand({
|
|
23
|
+
cmd: "node",
|
|
24
|
+
args: [`${SANDBOX_TOOLS}/node_modules/dev3000/dist/runtime/cli.js`, "stop"],
|
|
25
|
+
cwd: options.remoteWorkdir,
|
|
26
|
+
timeoutMs: 4000,
|
|
27
|
+
signal
|
|
28
|
+
})
|
|
29
|
+
: undefined
|
|
30
|
+
]);
|
|
31
|
+
if (options.ownsSandbox)
|
|
32
|
+
await sandbox.stop({ signal: AbortSignal.timeout(8000) }).catch(() => {
|
|
33
|
+
options.log(`Could not stop sandbox ${sandbox.name}; stop it with vercel sandbox stop`);
|
|
34
|
+
});
|
|
35
|
+
else if (options.originalPorts)
|
|
36
|
+
await sandbox.update({ ports: options.originalPorts }, { signal: AbortSignal.timeout(5000) }).catch(() => {
|
|
37
|
+
options.log("Could not restore attached sandbox ports");
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const waiting = setTimeout(() => options.log("Still closing the browser and sandbox session…"), 2000);
|
|
41
|
+
waiting.unref();
|
|
42
|
+
try {
|
|
43
|
+
await Promise.allSettled([options.closeProxy?.(), options.closeBrowser?.(), remote()]);
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
clearTimeout(waiting);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=sandbox-cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-cleanup.js","sourceRoot":"","sources":["../../src/runtime/sandbox-cleanup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAU3C;IACC,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC/B,IAAI,CAAC,OAAO;YAAE,OAAM;QACpB,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACxC,MAAM,OAAO,CAAC,UAAU,CAAC;YACvB,OAAO,CAAC,kBAAkB;gBACxB,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CACtD,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAC/D;gBACH,CAAC,CAAC,SAAS;YACb,OAAO,CAAC,UAAU,CAAC;gBACjB,GAA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AO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,EAAE,OAAO,CAAC,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IACxF,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,OAAO,CAAC,CAAA;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
2
|
import type { SandboxOptions } from "./sandbox.js";
|
|
3
|
+
export declare const DEFAULT_SANDBOX_TIMEOUT_MINUTES = 60;
|
|
3
4
|
/** Options shared by the explicit subcommand and the checkout-free root shorthand. */
|
|
4
5
|
export declare function addSandboxProjectOptions(command: Command): Command;
|
|
5
6
|
export declare function resolveSandboxOptions(options: SandboxOptions): SandboxOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-command.d.ts","sourceRoot":"","sources":["../../src/runtime/sandbox-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAQlD,sFAAsF;AACtF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"sandbox-command.d.ts","sourceRoot":"","sources":["../../src/runtime/sandbox-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAQlD,eAAO,MAAM,+BAA+B,KAAK,CAAA;AAEjD,sFAAsF;AACtF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CA0BlE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAoC7E;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,GAAG,SAAS,CAmCjG;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBjG;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAW7D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { parseHarness } from "./harness.js";
|
|
1
|
+
import { parseHarness, parseHarnessLocation } from "./harness.js";
|
|
2
2
|
import { formatSandboxSessions, listSandboxSessions, readSandboxSession, sandboxLauncherAlive } from "./sandbox-sessions.js";
|
|
3
|
+
export const DEFAULT_SANDBOX_TIMEOUT_MINUTES = 60;
|
|
3
4
|
/** Options shared by the explicit subcommand and the checkout-free root shorthand. */
|
|
4
5
|
export function addSandboxProjectOptions(command) {
|
|
5
6
|
return command
|
|
@@ -7,19 +8,30 @@ export function addSandboxProjectOptions(command) {
|
|
|
7
8
|
.option("--scope <team>", "Vercel team name or ID")
|
|
8
9
|
.option("--branch <ref>", "Git branch or revision to clone")
|
|
9
10
|
.option("--name <name>", "Name for a new persistent sandbox")
|
|
10
|
-
.option("--harness <name>", "Run fx, codex, or
|
|
11
|
+
.option("--harness <name>", "Run fx, codex, claude, or Eve connected to the sandbox", parseHarness, "eve")
|
|
12
|
+
.option("--harness-location <location>", "Where to run the harness: local or sandbox", parseHarnessLocation, "local")
|
|
11
13
|
.option("--resume [id]", "Resume a saved sandbox session; omit the ID to list sessions")
|
|
12
14
|
.option("--attach <name>", "Use an existing sandbox with its repository already provisioned")
|
|
13
15
|
.option("--hostname <name>", "Stable local app name, e.g. songbook for songbook.d3k.localhost")
|
|
14
16
|
.option("--region <region>", "Vercel Sandbox region")
|
|
15
|
-
.option("--timeout <minutes>", "
|
|
17
|
+
.option("--timeout <minutes>", "Sandbox compute and Gateway key lifetime", String(DEFAULT_SANDBOX_TIMEOUT_MINUTES))
|
|
16
18
|
.option("--install-command <command>", "Remote dependency install command (otherwise project setting or bun install)")
|
|
17
19
|
.option("--no-shell", "Keep the companion running without opening an interactive remote shell")
|
|
18
|
-
.option("--no-fx", "Skip fx installation")
|
|
20
|
+
.option("--no-fx", "Skip fx installation")
|
|
21
|
+
.option("--no-gateway", "Skip automatic session Gateway credentials for sandbox fx")
|
|
22
|
+
.option("--gateway-budget <usd|none>", "Gateway spending limit (Eve defaults to none; fx defaults to 5 USD)");
|
|
19
23
|
}
|
|
20
24
|
export function resolveSandboxOptions(options) {
|
|
21
25
|
if (options.harness)
|
|
22
26
|
parseHarness(options.harness);
|
|
27
|
+
if (options.harnessLocation)
|
|
28
|
+
parseHarnessLocation(options.harnessLocation);
|
|
29
|
+
if (options.harness === "eve") {
|
|
30
|
+
if (options.harnessLocation === "sandbox")
|
|
31
|
+
throw new Error("Eve runs remotely with a local client; omit --harness-location");
|
|
32
|
+
if (options.gateway === false)
|
|
33
|
+
throw new Error("The Eve harness requires its project-scoped Gateway key; omit --no-gateway");
|
|
34
|
+
}
|
|
23
35
|
if (options.harness && options.shell === false)
|
|
24
36
|
throw new Error("--harness cannot be combined with --no-shell");
|
|
25
37
|
if (!options.project)
|
|
@@ -31,12 +43,22 @@ export function resolveSandboxOptions(options) {
|
|
|
31
43
|
throw new Error("--project must be a project name/ID or team/project");
|
|
32
44
|
if (parts.length === 2 && options.scope && options.scope !== parts[0])
|
|
33
45
|
throw new Error("The team in --project conflicts with --scope; use one team selector");
|
|
34
|
-
const minutes = Number(options.timeout ??
|
|
46
|
+
const minutes = Number(options.timeout ?? DEFAULT_SANDBOX_TIMEOUT_MINUTES);
|
|
35
47
|
if (!Number.isFinite(minutes) || minutes < 1 || minutes > 1440)
|
|
36
48
|
throw new Error("Sandbox timeout must be 1–1440 minutes");
|
|
49
|
+
const gatewayBudget = options.gatewayBudget ?? (options.harness === "eve" ? undefined : "5");
|
|
50
|
+
if (gatewayBudget !== undefined &&
|
|
51
|
+
gatewayBudget !== "none" &&
|
|
52
|
+
(!Number.isFinite(Number(gatewayBudget)) || Number(gatewayBudget) < 1))
|
|
53
|
+
throw new Error("--gateway-budget must be at least 1 USD or none");
|
|
37
54
|
if (options.attach && (options.branch || options.name))
|
|
38
55
|
throw new Error("--attach uses the existing checkout; omit --branch and --name");
|
|
39
|
-
return {
|
|
56
|
+
return {
|
|
57
|
+
...options,
|
|
58
|
+
gatewayBudget,
|
|
59
|
+
project: parts[parts.length - 1],
|
|
60
|
+
scope: parts.length === 2 ? parts[0] : options.scope
|
|
61
|
+
};
|
|
40
62
|
}
|
|
41
63
|
export function resolveSandboxResume(options) {
|
|
42
64
|
if (options.resume === true) {
|
|
@@ -66,7 +88,11 @@ export function resolveSandboxResume(options) {
|
|
|
66
88
|
installCommand: record.installCommand,
|
|
67
89
|
timeout: record.timeout,
|
|
68
90
|
fx: record.fx,
|
|
69
|
-
harness: record.harness,
|
|
91
|
+
harness: options.shell === false && options.harness === undefined ? undefined : record.harness,
|
|
92
|
+
harnessLocation: record.harnessLocation,
|
|
93
|
+
gateway: record.gateway,
|
|
94
|
+
// Older Eve launchers saved the fx default here but ignored it, using a hardcoded $1 cap.
|
|
95
|
+
gatewayBudget: record.harness === "eve" && !record.gatewayBudgetConfigured ? undefined : record.gatewayBudget,
|
|
70
96
|
...options
|
|
71
97
|
});
|
|
72
98
|
}
|
|
@@ -74,8 +100,12 @@ export async function runSandboxProject(options, command) {
|
|
|
74
100
|
// Commander supplies defaults for negated flags; resume should retain saved preferences
|
|
75
101
|
// unless the user explicitly overrides them for this invocation.
|
|
76
102
|
const explicit = { ...options };
|
|
103
|
+
// The default applies to a new interactive launch, not a retained companion or
|
|
104
|
+
// a saved session's harness selection (including an older plain-shell session).
|
|
105
|
+
if (command?.getOptionValueSource("harness") === "default" && (options.resume || options.shell === false))
|
|
106
|
+
delete explicit.harness;
|
|
77
107
|
if (options.resume && command)
|
|
78
|
-
for (const key of ["fx", "shell", "timeout"])
|
|
108
|
+
for (const key of ["fx", "shell", "timeout", "gateway", "gatewayBudget", "harnessLocation"])
|
|
79
109
|
if (command.getOptionValueSource(key) === "default")
|
|
80
110
|
delete explicit[key];
|
|
81
111
|
const resolved = resolveSandboxResume(explicit);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox-command.js","sourceRoot":"","sources":["../../src/runtime/sandbox-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"sandbox-command.js","sourceRoot":"","sources":["../../src/runtime/sandbox-command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAEjE,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,uBAAuB,CAAA;AAE9B,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,CAAA;AAEjD,sFAAsF;AACtF,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,OAAO,OAAO;SACX,MAAM,CAAC,gCAAgC,EAAE,yDAAyD,CAAC;SACnG,MAAM,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;SAClD,MAAM,CAAC,gBAAgB,EAAE,iCAAiC,CAAC;SAC3D,MAAM,CAAC,eAAe,EAAE,mCAAmC,CAAC;SAC5D,MAAM,CAAC,kBAAkB,EAAE,wDAAwD,EAAE,YAAY,EAAE,KAAK,CAAC;SACzG,MAAM,CACL,+BAA+B,EAC/B,4CAA4C,EAC5C,oBAAoB,EACpB,OAAO,CACR;SACA,MAAM,CAAC,eAAe,EAAE,8DAA8D,CAAC;SACvF,MAAM,CAAC,iBAAiB,EAAE,iEAAiE,CAAC;SAC5F,MAAM,CAAC,mBAAmB,EAAE,iEAAiE,CAAC;SAC9F,MAAM,CAAC,mBAAmB,EAAE,uBAAuB,CAAC;SACpD,MAAM,CAAC,qBAAqB,EAAE,0CAA0C,EAAE,MAAM,CAAC,+B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ContextScript = "\nconst fs = require('node:fs'), path = require('node:path'), os = require('node:os');\nconst directory = path.join(os.homedir(), '.fx');\nconst file = path.join(directory, 'AGENTS.md');\nconst start = '\\n<!-- d3k-browser-context:start -->\\n';\nconst end = '\\n<!-- d3k-browser-context:end -->\\n';\nconst mode = process.argv[1];\nlet current = '';\ntry {\n if (!fs.lstatSync(file).isFile()) throw new Error('Sandbox fx instructions must be a regular file');\n current = fs.readFileSync(file, 'utf8');\n} catch (error) { if (error.code !== 'ENOENT') throw error; }\nlet body = current;\nconst begin = body.indexOf(start);\nif (begin !== -1) {\n const finish = body.indexOf(end, begin + start.length);\n if (finish === -1) throw new Error('Incomplete d3k browser context block');\n body = body.slice(0, begin) + body.slice(finish + end.length);\n}\nif (mode === 'install') body += start + process.argv[2] + end;\nelse if (mode !== 'remove') throw new Error('Unknown browser context operation');\nif (body !== current) {\n fs.mkdirSync(directory, { recursive: true });\n if (body.length === 0) fs.unlinkSync(file);\n else fs.writeFileSync(file, body, { mode: 0o600 });\n}\n";
|
|
4
|
+
export declare function sandboxFxContext(sandbox: Sandbox, context?: SandboxHarnessContext, signal?: AbortSignal): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=sandbox-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-context.d.ts","sourceRoot":"","sources":["../../src/runtime/sandbox-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAyB,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAIhF,eAAO,MAAM,sBAAsB,kqCA0BlC,CAAA;AAED,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,qBAAqB,EAC/B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CASf"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { harnessStartupContext } from "./harness.js";
|
|
2
|
+
// fx loads ~/.fx/AGENTS.md at startup, whereas --add-dir exposes skills only
|
|
3
|
+
// for optional discovery. Preload the connected skill outside the project repo.
|
|
4
|
+
export const sandboxFxContextScript = `
|
|
5
|
+
const fs = require('node:fs'), path = require('node:path'), os = require('node:os');
|
|
6
|
+
const directory = path.join(os.homedir(), '.fx');
|
|
7
|
+
const file = path.join(directory, 'AGENTS.md');
|
|
8
|
+
const start = '\\n<!-- d3k-browser-context:start -->\\n';
|
|
9
|
+
const end = '\\n<!-- d3k-browser-context:end -->\\n';
|
|
10
|
+
const mode = process.argv[1];
|
|
11
|
+
let current = '';
|
|
12
|
+
try {
|
|
13
|
+
if (!fs.lstatSync(file).isFile()) throw new Error('Sandbox fx instructions must be a regular file');
|
|
14
|
+
current = fs.readFileSync(file, 'utf8');
|
|
15
|
+
} catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
16
|
+
let body = current;
|
|
17
|
+
const begin = body.indexOf(start);
|
|
18
|
+
if (begin !== -1) {
|
|
19
|
+
const finish = body.indexOf(end, begin + start.length);
|
|
20
|
+
if (finish === -1) throw new Error('Incomplete d3k browser context block');
|
|
21
|
+
body = body.slice(0, begin) + body.slice(finish + end.length);
|
|
22
|
+
}
|
|
23
|
+
if (mode === 'install') body += start + process.argv[2] + end;
|
|
24
|
+
else if (mode !== 'remove') throw new Error('Unknown browser context operation');
|
|
25
|
+
if (body !== current) {
|
|
26
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
27
|
+
if (body.length === 0) fs.unlinkSync(file);
|
|
28
|
+
else fs.writeFileSync(file, body, { mode: 0o600 });
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
export async function sandboxFxContext(sandbox, context, signal) {
|
|
32
|
+
const note = context ? harnessStartupContext(context) : undefined;
|
|
33
|
+
const result = await sandbox.runCommand({
|
|
34
|
+
cmd: "node",
|
|
35
|
+
args: ["-e", sandboxFxContextScript, note ? "install" : "remove", ...(note ? [note] : [])],
|
|
36
|
+
timeoutMs: 5000,
|
|
37
|
+
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(6000)]) : AbortSignal.timeout(6000)
|
|
38
|
+
});
|
|
39
|
+
if (result.exitCode !== 0)
|
|
40
|
+
throw new Error("Could not update sandbox fx browser context");
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=sandbox-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-context.js","sourceRoot":"","sources":["../../src/runtime/sandbox-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAA8B,MAAM,cAAc,CAAA;AAEhF,6EAA6E;AAC7E,gFAAgF;AAChF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BrC,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgB,EAChB,OAA+B,EAC/B,MAAoB;IAEpB,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACjE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC;QACtC,GAAG,EAAE,MAAM;QACX,IAAI,EAAE,CAAC,IAAI,EAAE,sBAAsB,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC1F,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;KAClG,CAAC,CAAA;IACF,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;AAC3F,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SandboxSession } from "./sandbox-sessions.js";
|
|
2
|
+
interface FxSession {
|
|
3
|
+
workspace_root: string;
|
|
4
|
+
created_at_ms: number;
|
|
5
|
+
updated_at_ms: number;
|
|
6
|
+
}
|
|
7
|
+
/** Recover old temporary workspace identities from fx metadata, never conversation contents. */
|
|
8
|
+
export declare function legacyFxWorkspace(record: SandboxSession, records: SandboxSession[], sessions: FxSession[]): string | undefined;
|
|
9
|
+
export declare function discoverLegacyFxWorkspace(record: SandboxSession, records: SandboxSession[], invoke: (args: string[]) => Promise<string>): Promise<string | undefined>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=sandbox-fx-resume.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-fx-resume.d.ts","sourceRoot":"","sources":["../../src/runtime/sandbox-fx-resume.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,UAAU,SAAS;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,gGAAgG;AAChG,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,cAAc,EAAE,EACzB,QAAQ,EAAE,SAAS,EAAE,GACpB,MAAM,GAAG,SAAS,CA+BpB;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,cAAc,EAAE,EACzB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,GAC1C,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAmB7B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { basename, dirname, resolve } from "node:path";
|
|
4
|
+
/** Recover old temporary workspace identities from fx metadata, never conversation contents. */
|
|
5
|
+
export function legacyFxWorkspace(record, records, sessions) {
|
|
6
|
+
const start = Date.parse(record.lastUsedAt);
|
|
7
|
+
const end = Date.parse(record.closedAt || "");
|
|
8
|
+
if (!Number.isFinite(start) || !Number.isFinite(end) || end < start)
|
|
9
|
+
return undefined;
|
|
10
|
+
// Concurrent launchers make a time-based association ambiguous. Do not guess.
|
|
11
|
+
if (records.some((other) => other.id !== record.id &&
|
|
12
|
+
other.harness === "fx" &&
|
|
13
|
+
other.harnessLocation !== "sandbox" &&
|
|
14
|
+
Date.parse(other.lastUsedAt) <= end &&
|
|
15
|
+
Date.parse(other.closedAt || "9999-01-01") >= start))
|
|
16
|
+
return undefined;
|
|
17
|
+
const roots = new Set(sessions
|
|
18
|
+
.filter((session) => typeof session.workspace_root === "string" &&
|
|
19
|
+
session.created_at_ms >= start &&
|
|
20
|
+
session.updated_at_ms >= session.created_at_ms &&
|
|
21
|
+
session.updated_at_ms <= end &&
|
|
22
|
+
basename(session.workspace_root) === "control" &&
|
|
23
|
+
basename(dirname(session.workspace_root)).startsWith("d3k-sandbox-") &&
|
|
24
|
+
dirname(dirname(resolve(session.workspace_root))) === realpathSync(tmpdir()))
|
|
25
|
+
.map((session) => session.workspace_root));
|
|
26
|
+
return roots.size === 1 ? [...roots][0] : undefined;
|
|
27
|
+
}
|
|
28
|
+
export async function discoverLegacyFxWorkspace(record, records, invoke) {
|
|
29
|
+
const sessions = [];
|
|
30
|
+
let cursor;
|
|
31
|
+
for (let page = 0; page < 10; page++) {
|
|
32
|
+
const response = JSON.parse(await invoke(["sessions", "--all", "--json", "--limit", "100", ...(cursor ? ["--cursor", cursor] : [])]));
|
|
33
|
+
if (!Array.isArray(response.sessions))
|
|
34
|
+
throw new Error("fx did not return saved-session metadata");
|
|
35
|
+
sessions.push(...response.sessions);
|
|
36
|
+
if (!response.has_more)
|
|
37
|
+
return legacyFxWorkspace(record, records, sessions);
|
|
38
|
+
if (!response.next_cursor || response.next_cursor === cursor)
|
|
39
|
+
break;
|
|
40
|
+
cursor = response.next_cursor;
|
|
41
|
+
}
|
|
42
|
+
// An incomplete listing cannot establish that the association is unique.
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=sandbox-fx-resume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-fx-resume.js","sourceRoot":"","sources":["../../src/runtime/sandbox-fx-resume.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAStD,gGAAgG;AAChG,MAAM,UAAU,iBAAiB,CAC/B,MAAsB,EACtB,OAAyB,EACzB,QAAqB;IAErB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAA;IAC7C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,KAAK;QAAE,OAAO,SAAS,CAAA;IACrF,8EAA8E;IAC9E,IACE,OAAO,CAAC,IAAI,CACV,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE;QACtB,KAAK,CAAC,OAAO,KAAK,IAAI;QACtB,KAAK,CAAC,eAAe,KAAK,SAAS;QACnC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,C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AE,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAKzG,CAAA;QACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;QAClG,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACnC,IAAI,CAAC,QAAQ,CAAC,QAAQ;YAAE,OAAO,iBAAiB,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;QAC3E,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW,KAAK,MAAM;YAAE,MAAK;QACnE,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAA;IAC/B,CAAC;IACD,yEAAyE;IACzE,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Run = (binary: string, args: string[], options?: {
|
|
2
|
+
input?: string;
|
|
3
|
+
}) => Promise<string>;
|
|
4
|
+
/** The CLI authenticates locally. Only this purpose/project-restricted key goes into the VM. */
|
|
5
|
+
export declare function createSandboxGateway(run: Run, options: {
|
|
6
|
+
projectId: string;
|
|
7
|
+
teamId: string;
|
|
8
|
+
sessionId: string;
|
|
9
|
+
minutes: number;
|
|
10
|
+
budget?: number;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
id: string;
|
|
13
|
+
key: string;
|
|
14
|
+
expiresAt: number;
|
|
15
|
+
}>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=sandbox-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-gateway.d.ts","sourceRoot":"","sources":["../../src/runtime/sandbox-gateway.ts"],"names":[],"mappings":"AAAA,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;AAE5F,gGAAgG;AAChG,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,GAAG,EACR,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;;GA0CpG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The CLI authenticates locally. Only this purpose/project-restricted key goes into the VM. */
|
|
2
|
+
export async function createSandboxGateway(run, options) {
|
|
3
|
+
if (options.budget !== undefined && (!Number.isFinite(options.budget) || options.budget < 1))
|
|
4
|
+
throw new Error("Gateway budget must be at least 1 USD");
|
|
5
|
+
const expiresAt = Date.now() + options.minutes * 60000;
|
|
6
|
+
const result = JSON.parse(await run("vercel", ["api", "/v1/api-keys", "--method", "POST", "--scope", options.teamId, "--input", "-", "--raw"], {
|
|
7
|
+
input: JSON.stringify({
|
|
8
|
+
purpose: "ai-gateway",
|
|
9
|
+
projectId: options.projectId,
|
|
10
|
+
name: `d3k ${options.sessionId}`,
|
|
11
|
+
expiresAt,
|
|
12
|
+
...(options.budget === undefined
|
|
13
|
+
? {}
|
|
14
|
+
: { aiGatewayQuota: { limitAmount: options.budget, refreshPeriod: "none", includeByokInQuota: true } })
|
|
15
|
+
})
|
|
16
|
+
}));
|
|
17
|
+
const id = result.apiKey?.id;
|
|
18
|
+
const revoke = async () => {
|
|
19
|
+
if (!id)
|
|
20
|
+
return;
|
|
21
|
+
await run("vercel", ["ai-gateway", "api-keys", "revoke", id, "--scope", options.teamId, "--yes"]);
|
|
22
|
+
};
|
|
23
|
+
if (!id ||
|
|
24
|
+
!result.apiKeyString ||
|
|
25
|
+
result.apiKey?.purpose !== "ai-gateway" ||
|
|
26
|
+
result.apiKey.projectId !== options.projectId ||
|
|
27
|
+
result.apiKey.teamId !== options.teamId ||
|
|
28
|
+
result.apiKey.expiresAt !== expiresAt) {
|
|
29
|
+
await revoke();
|
|
30
|
+
throw new Error("Vercel did not return a project-scoped, expiring Gateway key");
|
|
31
|
+
}
|
|
32
|
+
return { id, key: result.apiKeyString, expiresAt };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=sandbox-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-gateway.js","sourceRoot":"","sources":["../../src/runtime/sandbox-gateway.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAQ,EACR,OAAmG;IAEnG,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC1F,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,OAAO,GAAG,KAAK,CAAA;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CACvB,MAAM,GAAG,CACP,QAAQ,EACR,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,EAC/F;QACE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;YACpB,OAAO,EAAE,YAAY;YACrB,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,IAAI,EAAE,OAAO,OAAO,CAAC,SAAS,EAAE;YAChC,SAAS;YACT,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS;gBAC9B,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,CAAC;SAC1G,CAAC;KACH,CACF,CAIF,CAAA;IACD,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAA;IAC5B,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,IAAI,CAAC,EAAE;YAAE,OAAM;QACf,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACnG,CAAC,CAAA;IACD,IACE,CAAC,EAAE;QACH,CAAC,MAAM,CAAC,YAAY;QACpB,MAAM,CAAC,MAAM,EAAE,OAAO,KAAK,YAAY;QACvC,MAAM,CAAC,MAAM,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS;QAC7C,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;QACvC,MAAM,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,EACrC,CAAC;QACD,MAAM,MAAM,EAAE,CAAA;QACd,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAA;IACjF,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,YAAY,EAAE,SAAS,EAAE,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function workspaceGithubRequest(repository: string, args: Record<string, unknown>): {
|
|
2
|
+
args: string[];
|
|
3
|
+
input: string | undefined;
|
|
4
|
+
};
|
|
5
|
+
/** Run only repository-scoped Git Data/PR operations; the credential stays local. */
|
|
6
|
+
export declare function callSandboxGithub(repository: string, args: Record<string, unknown>, options?: {
|
|
7
|
+
cwd?: string;
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
}): Promise<string>;
|
|
10
|
+
//# sourceMappingURL=sandbox-github.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-github.d.ts","sourceRoot":"","sources":["../../src/runtime/sandbox-github.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAgBpF,IAAI;IASJ,KAAK;EAER;AAED,qFAAqF;AACrF,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,mBAIrD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { runSandboxCli } from "./sandbox-process.js";
|
|
2
|
+
export function workspaceGithubRequest(repository, args) {
|
|
3
|
+
if (!/^[\w.-]+\/[\w.-]+$/.test(repository))
|
|
4
|
+
throw new Error("No linked GitHub repository");
|
|
5
|
+
const method = String(args.method);
|
|
6
|
+
const path = String(args.path);
|
|
7
|
+
if (!["GET", "POST", "PATCH"].includes(method) ||
|
|
8
|
+
!/^\/(git\/(blobs|trees|commits|refs?|matching-refs)|pulls)(\/|\?|$)[\w/?.=&%-]*$/.test(path) ||
|
|
9
|
+
path.includes("..") ||
|
|
10
|
+
path.includes("%") ||
|
|
11
|
+
path.includes("//"))
|
|
12
|
+
throw new Error("Use a supported repo-relative Git Data or pulls endpoint");
|
|
13
|
+
if (args.body && (typeof args.body !== "object" || Array.isArray(args.body)))
|
|
14
|
+
throw new Error("body must be an object");
|
|
15
|
+
if (args.body?.force)
|
|
16
|
+
throw new Error("Force pushes are not supported");
|
|
17
|
+
return {
|
|
18
|
+
args: [
|
|
19
|
+
"api",
|
|
20
|
+
"--hostname",
|
|
21
|
+
"github.com",
|
|
22
|
+
"--method",
|
|
23
|
+
method,
|
|
24
|
+
`repos/${repository}${path}`,
|
|
25
|
+
...(args.body ? ["--input", "-"] : [])
|
|
26
|
+
],
|
|
27
|
+
input: args.body ? JSON.stringify(args.body) : undefined
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Run only repository-scoped Git Data/PR operations; the credential stays local. */
|
|
31
|
+
export async function callSandboxGithub(repository, args, options = {}) {
|
|
32
|
+
const request = workspaceGithubRequest(repository, args);
|
|
33
|
+
return runSandboxCli("gh", request.args, { ...options, input: request.input, timeoutMs: 60000 });
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=sandbox-github.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-github.js","sourceRoot":"","sources":["../../src/runtime/sandbox-github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,MAAM,UAAU,sBAAsB,CAAC,UAAkB,EAAE,IAA6B;IACtF,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAC1F,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAClC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC9B,IACE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC1C,CAAC,iFAAiF,CAAC,IAAI,CAAC,IAAI,CAAC;QAC7F,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACnB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAEnB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAA;IAC7E,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC3C,IAAK,IAAI,CAAC,IAAwC,EAAE,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;IAC5G,OAAO;QACL,IAAI,EAAE;YACJ,KAAK;YACL,YAAY;YACZ,YAAY;YACZ,UAAU;YACV,MAAM;YACN,SAAS,UAAU,GAAG,IAAI,EAAE;YAC5B,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACvC;QACD,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;KACzD,CAAA;AACH,CAAC;AAED,qFAAqF;AACrF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAAkB,EAClB,IAA6B,EAC7B,OAAO,GAA2C,EAAE;IAEpD,MAAM,OAAO,GAAG,sBAAsB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IACxD,OAAO,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAA;AAClG,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Sandbox } from "@vercel/sandbox";
|
|
2
|
+
import { type Harness } from "./harness.js";
|
|
3
|
+
export { workspaceGithubRequest } from "./sandbox-github.js";
|
|
4
|
+
export declare function localWorkspaceInstructions(workdir: string, appUrl: string, helper: string): string;
|
|
5
|
+
export declare function prepareLocalSandboxHarness(harness: Harness, directory: string, connection: {
|
|
6
|
+
url: string;
|
|
7
|
+
token: string;
|
|
8
|
+
}, workdir: string, appUrl: string, resume?: boolean): {
|
|
9
|
+
binary: "claude" | "codex" | "eve" | "fx";
|
|
10
|
+
args: string[];
|
|
11
|
+
};
|
|
12
|
+
export interface LocalSandboxWorkspaceOptions {
|
|
13
|
+
directory: string;
|
|
14
|
+
sandbox: Sandbox;
|
|
15
|
+
workdir: string;
|
|
16
|
+
appUrl: string;
|
|
17
|
+
signal: AbortSignal;
|
|
18
|
+
chromePort: number;
|
|
19
|
+
sessionId: string;
|
|
20
|
+
repository?: string;
|
|
21
|
+
recover?: (args: Record<string, unknown>) => Promise<import("./sandbox-workspace.js").WorkspaceResult>;
|
|
22
|
+
}
|
|
23
|
+
/** Shared by terminal harnesses and desktop MCP; credentials stay in this process. */
|
|
24
|
+
export declare function createLocalSandboxWorkspace(options: LocalSandboxWorkspaceOptions): Promise<(name: string, args: Record<string, unknown>) => Promise<import("./sandbox-workspace.js").WorkspaceResult>>;
|
|
25
|
+
export declare function launchLocalSandboxHarness(options: LocalSandboxWorkspaceOptions & {
|
|
26
|
+
harness: Harness;
|
|
27
|
+
gateway?: {
|
|
28
|
+
key: string;
|
|
29
|
+
};
|
|
30
|
+
resume?: boolean;
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
/** A stable fx workspace must never retain a live broker credential between launches. */
|
|
33
|
+
export declare function clearLocalHarnessConnection(directory: string): void;
|
|
34
|
+
//# sourceMappingURL=sandbox-local-harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandbox-local-harness.d.ts","sourceRoot":"","sources":["../../src/runtime/sandbox-local-harness.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAI9C,OAAO,EAAE,KAAK,OAAO,EAA8C,MAA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