@tangle-network/agent-app 0.44.59 → 0.44.60
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/assistant/index.js +1 -1
- package/dist/chat-routes/index.js +1 -1
- package/dist/{chunk-2UDJH6QR.js → chunk-APFJITYT.js} +66 -1
- package/dist/chunk-APFJITYT.js.map +1 -0
- package/dist/{chunk-HCOROIRT.js → chunk-S4YW2Y52.js} +8 -5
- package/dist/chunk-S4YW2Y52.js.map +1 -0
- package/dist/sandbox/index.d.ts +435 -27
- package/dist/sandbox/index.js +3 -1
- package/dist/web-react/index.js +1 -1
- package/dist/web-react/terminal.d.ts +48 -3
- package/dist/web-react/terminal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2UDJH6QR.js.map +0 -1
- package/dist/chunk-HCOROIRT.js.map +0 -1
package/dist/assistant/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import "../chunk-GINKOZFD.js";
|
|
|
9
9
|
import "../chunk-YTMKRL3L.js";
|
|
10
10
|
import "../chunk-GEYACSFW.js";
|
|
11
11
|
import "../chunk-6MUJROBT.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-S4YW2Y52.js";
|
|
13
13
|
import "../chunk-QY4BRKRJ.js";
|
|
14
14
|
import "../chunk-WBHPN5DY.js";
|
|
15
15
|
import "../chunk-UXMIPX3Z.js";
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
flattenHistory,
|
|
101
101
|
readSandboxBinaryBytes,
|
|
102
102
|
statSandboxFileSize
|
|
103
|
-
} from "../chunk-
|
|
103
|
+
} from "../chunk-APFJITYT.js";
|
|
104
104
|
import "../chunk-LWSJK546.js";
|
|
105
105
|
import "../chunk-CQZSAR77.js";
|
|
106
106
|
import "../chunk-ICOHEZK6.js";
|
|
@@ -510,6 +510,70 @@ function validateTerminalSubject(subject) {
|
|
|
510
510
|
if (!subject.sandboxId) throw new Error("sandboxId is required");
|
|
511
511
|
}
|
|
512
512
|
|
|
513
|
+
// src/sandbox/terminal-connection.ts
|
|
514
|
+
var DEFAULT_TTL_MINUTES = 15;
|
|
515
|
+
var TERMINAL_SCOPE = "session-runtime";
|
|
516
|
+
function defaultResolveConnectionId(ctx) {
|
|
517
|
+
return ctx.requested;
|
|
518
|
+
}
|
|
519
|
+
function createSandboxTerminalConnectionRoute(opts) {
|
|
520
|
+
const resolveConnectionId = opts.resolveConnectionId ?? defaultResolveConnectionId;
|
|
521
|
+
return async function handleSandboxTerminalConnection(request) {
|
|
522
|
+
const user = await opts.requireUser(request);
|
|
523
|
+
if (user instanceof Response) return user;
|
|
524
|
+
let box;
|
|
525
|
+
try {
|
|
526
|
+
box = await opts.ensureSandbox(user, request);
|
|
527
|
+
} catch (err) {
|
|
528
|
+
return Response.json(
|
|
529
|
+
{ error: err instanceof Error ? err.message : "Failed to provision sandbox" },
|
|
530
|
+
{ status: 500 }
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
const runtimeUrl = box.connection?.runtimeUrl;
|
|
534
|
+
if (!runtimeUrl) {
|
|
535
|
+
return Response.json(
|
|
536
|
+
{
|
|
537
|
+
error: "Sandbox runtime not ready. The sandbox is still initializing -- retry in a few seconds.",
|
|
538
|
+
status: box.status
|
|
539
|
+
},
|
|
540
|
+
{ status: 503 }
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
const requested = new URL(request.url).searchParams.get("connectionId");
|
|
544
|
+
const connectionId = await resolveConnectionId({ request, user, box, requested });
|
|
545
|
+
if (!connectionId) {
|
|
546
|
+
return Response.json(
|
|
547
|
+
{
|
|
548
|
+
error: "connectionId is required \u2014 pass the same id TerminalView dials (tabTerminalConnectionId()) as the 'connectionId' query parameter"
|
|
549
|
+
},
|
|
550
|
+
{ status: 400 }
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
let scoped;
|
|
554
|
+
try {
|
|
555
|
+
scoped = await box.mintScopedToken({
|
|
556
|
+
scope: TERMINAL_SCOPE,
|
|
557
|
+
ttlMinutes: opts.ttlMinutes ?? DEFAULT_TTL_MINUTES,
|
|
558
|
+
sessionId: connectionId
|
|
559
|
+
});
|
|
560
|
+
} catch (err) {
|
|
561
|
+
return Response.json(
|
|
562
|
+
{ error: err instanceof Error ? err.message : "Failed to mint sandbox token" },
|
|
563
|
+
{ status: 503 }
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
return Response.json({
|
|
567
|
+
sidecarUrl: scoped.sidecarProxyUrl,
|
|
568
|
+
token: scoped.token,
|
|
569
|
+
expiresAt: scoped.expiresAt.toISOString(),
|
|
570
|
+
status: box.status,
|
|
571
|
+
sandboxId: box.id,
|
|
572
|
+
connectionId
|
|
573
|
+
});
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
|
|
513
577
|
// src/sandbox/prewarm.ts
|
|
514
578
|
function prewarmKey(scope) {
|
|
515
579
|
return `${scope.workspaceId}::${scope.harness}`;
|
|
@@ -2000,6 +2064,7 @@ export {
|
|
|
2000
2064
|
bearerToken,
|
|
2001
2065
|
bearerSubprotocolToken,
|
|
2002
2066
|
terminalTokenFromRequest,
|
|
2067
|
+
createSandboxTerminalConnectionRoute,
|
|
2003
2068
|
createSandboxPrewarmer,
|
|
2004
2069
|
DEFAULT_PREWARM_CLAIM_TABLE,
|
|
2005
2070
|
PREWARM_CLAIM_TABLE_DDL,
|
|
@@ -2049,4 +2114,4 @@ export {
|
|
|
2049
2114
|
isTerminalPromptEvent,
|
|
2050
2115
|
detectInteractiveQuestion
|
|
2051
2116
|
};
|
|
2052
|
-
//# sourceMappingURL=chunk-
|
|
2117
|
+
//# sourceMappingURL=chunk-APFJITYT.js.map
|