@tangle-network/agent-app 0.44.57 → 0.44.58
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.
|
@@ -11,7 +11,7 @@ import '../use-file-mentions-CZ-Ua_sb.js';
|
|
|
11
11
|
import '../agent-activity-C8ZG0F0M.js';
|
|
12
12
|
import '../flow-types-CJxEmaRy.js';
|
|
13
13
|
import '../queue-VTBA5ONX.js';
|
|
14
|
-
import '../
|
|
14
|
+
import '../web-react/terminal.js';
|
|
15
15
|
import '../billing-BibxgALe.js';
|
|
16
16
|
import '../billing/index.js';
|
|
17
17
|
import '../session-shell/index.js';
|
|
@@ -15,7 +15,7 @@ import { S as StepAgentActivity } from '../agent-activity-C8ZG0F0M.js';
|
|
|
15
15
|
import { F as FlowTrace } from '../flow-types-CJxEmaRy.js';
|
|
16
16
|
import { a as ReviewQueueItem, c as ReviewQueueState } from '../queue-VTBA5ONX.js';
|
|
17
17
|
export { p as parseReviewQueueItem } from '../queue-VTBA5ONX.js';
|
|
18
|
-
export {
|
|
18
|
+
export { SandboxTerminalConnection, SandboxTerminalConnectionResponse, UseSandboxTerminalConnectionOptions, UseSandboxTerminalConnectionResult, tabTerminalConnectionId, useSandboxTerminalConnection } from './terminal.js';
|
|
19
19
|
import { i as ProductSeatOffer } from '../billing-BibxgALe.js';
|
|
20
20
|
import { SessionSort, SessionPage, SessionSummary, SessionRailAction } from '../session-shell/index.js';
|
|
21
21
|
import { CatalogModel } from '../catalog/index.js';
|
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/** Define the connection details and status for a sandbox terminal session */
|
|
2
|
+
interface SandboxTerminalConnection {
|
|
3
|
+
runtimeUrl: string | null;
|
|
4
|
+
sidecarUrl: string | null;
|
|
5
|
+
token: string | null;
|
|
6
|
+
expiresAt: string | null;
|
|
7
|
+
status: string;
|
|
8
|
+
error: string | null;
|
|
9
|
+
loading: boolean;
|
|
10
|
+
sandboxId?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Define the response structure for a sandbox terminal connection including URLs, token, status, and errors */
|
|
13
|
+
interface SandboxTerminalConnectionResponse {
|
|
14
|
+
runtimeUrl?: string;
|
|
15
|
+
sidecarUrl?: string;
|
|
16
|
+
token?: string;
|
|
17
|
+
expiresAt?: string;
|
|
18
|
+
status?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
sandboxId?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Define options for configuring a sandbox terminal connection including workspace ID and connection parameters */
|
|
23
|
+
interface UseSandboxTerminalConnectionOptions {
|
|
24
|
+
workspaceId: string;
|
|
25
|
+
connectionUrl?: string | ((workspaceId: string) => string);
|
|
26
|
+
fetcher?: typeof fetch;
|
|
27
|
+
provisionPollIntervalMs?: number;
|
|
28
|
+
provisionPollTimeoutMs?: number;
|
|
29
|
+
tokenRefreshSkewMs?: number;
|
|
30
|
+
}
|
|
31
|
+
/** Resolve sandbox terminal connection status and provide a method to initiate the connection */
|
|
32
|
+
interface UseSandboxTerminalConnectionResult extends SandboxTerminalConnection {
|
|
33
|
+
connect: () => Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/** Manage and maintain a sandbox terminal connection with automatic polling and token refresh handling */
|
|
36
|
+
declare function useSandboxTerminalConnection(opts: UseSandboxTerminalConnectionOptions): UseSandboxTerminalConnectionResult;
|
|
5
37
|
/**
|
|
6
|
-
*
|
|
7
|
-
* a status badge, connect/provisioning/error states with a retry, and the lazy
|
|
8
|
-
* `TerminalView` (from `@tangle-network/sandbox-ui`) mounted only once the
|
|
9
|
-
* connection is live. creative-agent and gtm-agent each hand-roll a structurally
|
|
10
|
-
* identical panel; only the copy and the status-tone map are app-specific, so
|
|
11
|
-
* those are props and everything else lives here.
|
|
38
|
+
* Stable-per-tab, unique-per-client terminal connection id.
|
|
12
39
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
40
|
+
* Persists in `sessionStorage` so a reload in the same tab reuses the id (the
|
|
41
|
+
* sidecar restores the same PTY session via `TerminalView.connectionId`), while
|
|
42
|
+
* separate tabs/windows each get a distinct id. Pass the result as
|
|
43
|
+
* `TerminalView`'s `connectionId`. Without it (e.g. gtm-agent today) every tab
|
|
44
|
+
* shares one connection id and their reconnects evict each other.
|
|
16
45
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
46
|
+
* Falls back to an ephemeral id when `sessionStorage` is unavailable (SSR,
|
|
47
|
+
* privacy mode) — still unique per call, just not reload-stable.
|
|
19
48
|
*/
|
|
49
|
+
declare function tabTerminalConnectionId(storageKey?: string): string;
|
|
20
50
|
|
|
21
|
-
type
|
|
22
|
-
interface TerminalStatusDisplay {
|
|
23
|
-
tone: TerminalStatusTone;
|
|
24
|
-
label: string;
|
|
25
|
-
}
|
|
26
|
-
interface WorkspaceTerminalPanelProps {
|
|
27
|
-
/** Live connection state (from {@link useSandboxTerminalConnection}). */
|
|
28
|
-
connection: SandboxTerminalConnection;
|
|
29
|
-
/** Stable per-tab id (from {@link tabTerminalConnectionId}) so the sidecar
|
|
30
|
-
* restores the same PTY across remounts and tabs don't collide. */
|
|
31
|
-
connectionId?: string;
|
|
32
|
-
/** Header title. Default "Terminal". */
|
|
33
|
-
title?: string;
|
|
34
|
-
/** Header subtitle / sandbox label. */
|
|
35
|
-
subtitle?: string;
|
|
36
|
-
/** Whether the terminal tab is visible (forwarded to `TerminalView` for fit). */
|
|
37
|
-
isActive?: boolean;
|
|
38
|
-
/** Reconnect handler — wire to the hook's `connect`. Shown on idle/error. */
|
|
39
|
-
onRetry?: () => void;
|
|
40
|
-
/** Map a `connection.status` to a badge tone + label. The default covers
|
|
41
|
-
* idle/provisioning/running/error; override for app-specific vocabulary. */
|
|
42
|
-
statusDisplay?: (connection: SandboxTerminalConnection) => TerminalStatusDisplay;
|
|
43
|
-
/** Extra header content, right-aligned (actions, sandbox id, …). */
|
|
44
|
-
headerExtra?: ReactNode;
|
|
45
|
-
className?: string;
|
|
46
|
-
}
|
|
47
|
-
declare function WorkspaceTerminalPanel({ connection, connectionId, title, subtitle, isActive, onRetry, statusDisplay, headerExtra, className, }: WorkspaceTerminalPanelProps): ReactNode;
|
|
48
|
-
|
|
49
|
-
export { SandboxTerminalConnection, type TerminalStatusDisplay, type TerminalStatusTone, WorkspaceTerminalPanel, type WorkspaceTerminalPanelProps };
|
|
51
|
+
export { type SandboxTerminalConnection, type SandboxTerminalConnectionResponse, type UseSandboxTerminalConnectionOptions, type UseSandboxTerminalConnectionResult, tabTerminalConnectionId, useSandboxTerminalConnection };
|
|
@@ -2,93 +2,7 @@ import {
|
|
|
2
2
|
tabTerminalConnectionId,
|
|
3
3
|
useSandboxTerminalConnection
|
|
4
4
|
} from "../chunk-HCOROIRT.js";
|
|
5
|
-
|
|
6
|
-
// src/web-react/workspace-terminal-panel.tsx
|
|
7
|
-
import { lazy, Suspense } from "react";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
var TerminalView = lazy(
|
|
10
|
-
() => import("@tangle-network/sandbox-ui/terminal").then((m) => ({ default: m.TerminalView }))
|
|
11
|
-
);
|
|
12
|
-
var TONE_DOT = {
|
|
13
|
-
idle: "bg-muted-foreground/50",
|
|
14
|
-
connecting: "animate-pulse bg-warning",
|
|
15
|
-
connected: "bg-success",
|
|
16
|
-
error: "bg-destructive"
|
|
17
|
-
};
|
|
18
|
-
function defaultStatusDisplay(conn) {
|
|
19
|
-
if (conn.error) return { tone: "error", label: "Disconnected" };
|
|
20
|
-
if (conn.runtimeUrl && conn.token) return { tone: "connected", label: "Connected" };
|
|
21
|
-
if (conn.loading) return { tone: "connecting", label: conn.status === "provisioning" ? "Provisioning\u2026" : "Connecting\u2026" };
|
|
22
|
-
return { tone: "idle", label: "Idle" };
|
|
23
|
-
}
|
|
24
|
-
function WorkspaceTerminalPanel({
|
|
25
|
-
connection,
|
|
26
|
-
connectionId,
|
|
27
|
-
title = "Terminal",
|
|
28
|
-
subtitle,
|
|
29
|
-
isActive,
|
|
30
|
-
onRetry,
|
|
31
|
-
statusDisplay,
|
|
32
|
-
headerExtra,
|
|
33
|
-
className
|
|
34
|
-
}) {
|
|
35
|
-
const status = (statusDisplay ?? defaultStatusDisplay)(connection);
|
|
36
|
-
const apiUrl = connection.runtimeUrl ?? connection.sidecarUrl;
|
|
37
|
-
const ready = Boolean(apiUrl && connection.token);
|
|
38
|
-
return /* @__PURE__ */ jsxs("div", { className: `flex h-full min-h-0 flex-col overflow-hidden rounded-xl border border-border bg-card ${className ?? ""}`, children: [
|
|
39
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 border-b border-border px-4 py-2.5", children: [
|
|
40
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
41
|
-
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium text-foreground", children: title }),
|
|
42
|
-
subtitle && /* @__PURE__ */ jsx("p", { className: "truncate text-xs text-muted-foreground", children: subtitle })
|
|
43
|
-
] }),
|
|
44
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
45
|
-
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
46
|
-
/* @__PURE__ */ jsx("span", { className: `h-1.5 w-1.5 rounded-full ${TONE_DOT[status.tone]}`, "aria-hidden": true }),
|
|
47
|
-
status.label
|
|
48
|
-
] }),
|
|
49
|
-
headerExtra
|
|
50
|
-
] })
|
|
51
|
-
] }),
|
|
52
|
-
/* @__PURE__ */ jsx("div", { className: "relative min-h-0 flex-1", children: ready ? /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(TerminalMessage, { children: "Loading terminal\u2026" }), children: /* @__PURE__ */ jsx(
|
|
53
|
-
TerminalView,
|
|
54
|
-
{
|
|
55
|
-
apiUrl,
|
|
56
|
-
token: connection.token,
|
|
57
|
-
connectionId,
|
|
58
|
-
title,
|
|
59
|
-
subtitle,
|
|
60
|
-
isActive
|
|
61
|
-
}
|
|
62
|
-
) }) : /* @__PURE__ */ jsx(TerminalMessage, { children: connection.error ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
63
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: connection.error }),
|
|
64
|
-
onRetry && /* @__PURE__ */ jsx(
|
|
65
|
-
"button",
|
|
66
|
-
{
|
|
67
|
-
type: "button",
|
|
68
|
-
onClick: onRetry,
|
|
69
|
-
className: "mt-3 inline-flex items-center justify-center rounded-lg border border-border px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-muted",
|
|
70
|
-
children: "Reconnect"
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
] }) : connection.loading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: connection.status === "provisioning" ? "Provisioning sandbox\u2026" : "Connecting\u2026" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Terminal not connected." }),
|
|
75
|
-
onRetry && /* @__PURE__ */ jsx(
|
|
76
|
-
"button",
|
|
77
|
-
{
|
|
78
|
-
type: "button",
|
|
79
|
-
onClick: onRetry,
|
|
80
|
-
className: "mt-3 inline-flex items-center justify-center rounded-lg border border-border px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-muted",
|
|
81
|
-
children: "Connect"
|
|
82
|
-
}
|
|
83
|
-
)
|
|
84
|
-
] }) }) })
|
|
85
|
-
] });
|
|
86
|
-
}
|
|
87
|
-
function TerminalMessage({ children }) {
|
|
88
|
-
return /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex flex-col items-center justify-center p-6 text-center", children });
|
|
89
|
-
}
|
|
90
5
|
export {
|
|
91
|
-
WorkspaceTerminalPanel,
|
|
92
6
|
tabTerminalConnectionId,
|
|
93
7
|
useSandboxTerminalConnection
|
|
94
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/** Define the connection details and status for a sandbox terminal session */
|
|
2
|
-
interface SandboxTerminalConnection {
|
|
3
|
-
runtimeUrl: string | null;
|
|
4
|
-
sidecarUrl: string | null;
|
|
5
|
-
token: string | null;
|
|
6
|
-
expiresAt: string | null;
|
|
7
|
-
status: string;
|
|
8
|
-
error: string | null;
|
|
9
|
-
loading: boolean;
|
|
10
|
-
sandboxId?: string;
|
|
11
|
-
}
|
|
12
|
-
/** Define the response structure for a sandbox terminal connection including URLs, token, status, and errors */
|
|
13
|
-
interface SandboxTerminalConnectionResponse {
|
|
14
|
-
runtimeUrl?: string;
|
|
15
|
-
sidecarUrl?: string;
|
|
16
|
-
token?: string;
|
|
17
|
-
expiresAt?: string;
|
|
18
|
-
status?: string;
|
|
19
|
-
error?: string;
|
|
20
|
-
sandboxId?: string;
|
|
21
|
-
}
|
|
22
|
-
/** Define options for configuring a sandbox terminal connection including workspace ID and connection parameters */
|
|
23
|
-
interface UseSandboxTerminalConnectionOptions {
|
|
24
|
-
workspaceId: string;
|
|
25
|
-
connectionUrl?: string | ((workspaceId: string) => string);
|
|
26
|
-
fetcher?: typeof fetch;
|
|
27
|
-
provisionPollIntervalMs?: number;
|
|
28
|
-
provisionPollTimeoutMs?: number;
|
|
29
|
-
tokenRefreshSkewMs?: number;
|
|
30
|
-
}
|
|
31
|
-
/** Resolve sandbox terminal connection status and provide a method to initiate the connection */
|
|
32
|
-
interface UseSandboxTerminalConnectionResult extends SandboxTerminalConnection {
|
|
33
|
-
connect: () => Promise<void>;
|
|
34
|
-
}
|
|
35
|
-
/** Manage and maintain a sandbox terminal connection with automatic polling and token refresh handling */
|
|
36
|
-
declare function useSandboxTerminalConnection(opts: UseSandboxTerminalConnectionOptions): UseSandboxTerminalConnectionResult;
|
|
37
|
-
/**
|
|
38
|
-
* Stable-per-tab, unique-per-client terminal connection id.
|
|
39
|
-
*
|
|
40
|
-
* Persists in `sessionStorage` so a reload in the same tab reuses the id (the
|
|
41
|
-
* sidecar restores the same PTY session via `TerminalView.connectionId`), while
|
|
42
|
-
* separate tabs/windows each get a distinct id. Pass the result as
|
|
43
|
-
* `TerminalView`'s `connectionId`. Without it (e.g. gtm-agent today) every tab
|
|
44
|
-
* shares one connection id and their reconnects evict each other.
|
|
45
|
-
*
|
|
46
|
-
* Falls back to an ephemeral id when `sessionStorage` is unavailable (SSR,
|
|
47
|
-
* privacy mode) — still unique per call, just not reload-stable.
|
|
48
|
-
*/
|
|
49
|
-
declare function tabTerminalConnectionId(storageKey?: string): string;
|
|
50
|
-
|
|
51
|
-
export { type SandboxTerminalConnection as S, type UseSandboxTerminalConnectionOptions as U, type SandboxTerminalConnectionResponse as a, type UseSandboxTerminalConnectionResult as b, tabTerminalConnectionId as t, useSandboxTerminalConnection as u };
|