@tangle-network/agent-app 0.44.56 → 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.
@@ -901,9 +901,16 @@ interface StoppedSandboxResumeRecovery {
901
901
  replacementBoxKey: string;
902
902
  restore?: SandboxRestoreSpec | null;
903
903
  }
904
+ /**
905
+ * Default ERE passed to `pgrep -f` when a liveness probe does not override the
906
+ * harness-process matcher. It covers the platform process names used by the
907
+ * fleet's shared OpenCode, Claude Code, and Codex terminal path; products with
908
+ * another harness can override it.
909
+ */
910
+ declare const DEFAULT_SIDECAR_PROCESS_PATTERN = "opencode|claude|codex";
904
911
  /** Define configuration for liveness probes including sidecar process pattern and optional timeouts */
905
912
  interface LivenessProbeConfig {
906
- sidecarProcessPattern: (harness: Harness) => string;
913
+ sidecarProcessPattern?: (harness: Harness) => string;
907
914
  execTimeoutMs?: number;
908
915
  psTimeoutMs?: number;
909
916
  }
@@ -1332,4 +1339,4 @@ declare function isTerminalPromptEvent(event: unknown): boolean;
1332
1339
  /** Resolve the interactive question text from a structured event or return null if none found */
1333
1340
  declare function detectInteractiveQuestion(event: unknown): string | null;
1334
1341
 
1335
- export { type AppToolDescriptor, type AuthenticatedSandboxUser, type BuildAppToolMcpServersOptions, type BuildSandboxToolFileMountsOptions, type D1PrewarmClaimStoreOptions, DEFAULT_PREWARM_CLAIM_TABLE, DEFAULT_SANDBOX_RESOURCES, type DriveSandboxTurnOptions, ENV_TOTAL_MAX_BYTES, ENV_VALUE_MAX_BYTES, type EnsureWorkspaceSandboxOptions, type LivenessProbeConfig, type MemberSyncSeam, type ModelSelection, type ModelSelectionError, type ModelSelectionFailure, type ModelSelectionSource, type Outcome, PREWARM_CLAIM_TABLE_DDL, PROVISION_PAYLOAD_MAX_BYTES, type PeekWorkspaceSandboxOutcome, type PrewarmClaimD1Like, type PrewarmClaimStore, type PrewarmDecision, type PrewarmEvent, type PrewarmOutcome, type PrewarmResult, type ProfileComposeOptions, type PromptInputPart, type ProviderResolutionConfig, type ProvisionPayloadSections, type ProvisionProfileSection, type ResolveSandboxClientCredentialsOptions, type ResolvedModel, type SandboxApiCredentials, type SandboxBuildContext, type SandboxClientCredentials, type SandboxCredentialEnvironment, SandboxEgressPolicyMismatchError, type SandboxEgressPolicySource, type SandboxExecChannel, type SandboxExecOptions, type SandboxExistingBoxStage, type SandboxFileBytesOutcome, type SandboxFileSizeOutcome, SandboxModelResolutionError, type SandboxPermissionLevel, type SandboxPrewarmScope, type SandboxPrewarmer, type SandboxPrewarmerOptions, type SandboxReadiness, SandboxRecoveryFailedError, type SandboxRecoveryPhase, type SandboxResourceConfig, type SandboxRestoreSpec, SandboxRuntimeAuthRefreshError, type SandboxRuntimeConfig, type SandboxRuntimeConnection, type SandboxScope, type SandboxStepTransition, type SandboxTerminalTokenOptions, type SandboxTerminalTokenResult, type SandboxTerminalTokenSubject, type SandboxTerminalWsMatch, type SandboxToolPathOptions, type SandboxToolSpec, type ScopedTokenResult, type SecretStore, type StoppedSandboxResumeFailure, type StoppedSandboxResumeRecovery, type StreamSandboxPromptOptions, type TerminalProxyIdentity, type TerminalUpgradeResponseLike, type WorkspaceSandboxConnectionArgs, type WorkspaceSandboxConnectionHandlerOptions, type WorkspaceSandboxEnsureContext, type WorkspaceSandboxInstanceLike, type WorkspaceSandboxManager, type WorkspaceSandboxManagerOptions, type WorkspaceSandboxRuntimeProxyArgs, type WorkspaceSandboxRuntimeProxyHandlerOptions, type WorkspaceSandboxTerminalUpgradeHandlerOptions, type WriteProfileFilesOptions, assertEnvWithinLimits, assertProvisionPayloadWithinCap, attachReasoningEffort, bearerSubprotocolToken, bearerToken, buildAppToolMcpServers, buildSandboxRuntimeProxyHeaders, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, collectSandboxPromptText, createD1PrewarmClaimStore, createSandboxPrewarmer, createSandboxTerminalToken, createWorkspaceSandboxConnectionHandler, createWorkspaceSandboxManager, createWorkspaceSandboxRuntimeProxyHandler, createWorkspaceSandboxTerminalUpgradeHandler, deferredCorpusHash, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, encodeSandboxRuntimePath, ensureWorkspaceSandbox, flattenHistory, getClient, isSandboxTerminalWsUpgrade, isTerminalPromptEvent, matchSandboxTerminalWsPath, mergeExtraMcp, mergeHistoryIntoParts, mintSandboxScopedToken, mintTerminalProxyToken, peekWorkspaceSandbox, readSandboxBinaryBytes, readSecret, requireTransportableModel, resetClientCache, resolveModel, resolveModelSelection, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxSidecarProxyUrl, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, selectedBearerSubprotocol, shellQuote, splitDeferredProfileFiles, statSandboxFileSize, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, terminalTokenFromRequest, terminalUpgradeSubprotocolEcho, verifySandboxTerminalToken, verifyTerminalProxyToken, writeProfileFilesToBox };
1342
+ export { type AppToolDescriptor, type AuthenticatedSandboxUser, type BuildAppToolMcpServersOptions, type BuildSandboxToolFileMountsOptions, type D1PrewarmClaimStoreOptions, DEFAULT_PREWARM_CLAIM_TABLE, DEFAULT_SANDBOX_RESOURCES, DEFAULT_SIDECAR_PROCESS_PATTERN, type DriveSandboxTurnOptions, ENV_TOTAL_MAX_BYTES, ENV_VALUE_MAX_BYTES, type EnsureWorkspaceSandboxOptions, type LivenessProbeConfig, type MemberSyncSeam, type ModelSelection, type ModelSelectionError, type ModelSelectionFailure, type ModelSelectionSource, type Outcome, PREWARM_CLAIM_TABLE_DDL, PROVISION_PAYLOAD_MAX_BYTES, type PeekWorkspaceSandboxOutcome, type PrewarmClaimD1Like, type PrewarmClaimStore, type PrewarmDecision, type PrewarmEvent, type PrewarmOutcome, type PrewarmResult, type ProfileComposeOptions, type PromptInputPart, type ProviderResolutionConfig, type ProvisionPayloadSections, type ProvisionProfileSection, type ResolveSandboxClientCredentialsOptions, type ResolvedModel, type SandboxApiCredentials, type SandboxBuildContext, type SandboxClientCredentials, type SandboxCredentialEnvironment, SandboxEgressPolicyMismatchError, type SandboxEgressPolicySource, type SandboxExecChannel, type SandboxExecOptions, type SandboxExistingBoxStage, type SandboxFileBytesOutcome, type SandboxFileSizeOutcome, SandboxModelResolutionError, type SandboxPermissionLevel, type SandboxPrewarmScope, type SandboxPrewarmer, type SandboxPrewarmerOptions, type SandboxReadiness, SandboxRecoveryFailedError, type SandboxRecoveryPhase, type SandboxResourceConfig, type SandboxRestoreSpec, SandboxRuntimeAuthRefreshError, type SandboxRuntimeConfig, type SandboxRuntimeConnection, type SandboxScope, type SandboxStepTransition, type SandboxTerminalTokenOptions, type SandboxTerminalTokenResult, type SandboxTerminalTokenSubject, type SandboxTerminalWsMatch, type SandboxToolPathOptions, type SandboxToolSpec, type ScopedTokenResult, type SecretStore, type StoppedSandboxResumeFailure, type StoppedSandboxResumeRecovery, type StreamSandboxPromptOptions, type TerminalProxyIdentity, type TerminalUpgradeResponseLike, type WorkspaceSandboxConnectionArgs, type WorkspaceSandboxConnectionHandlerOptions, type WorkspaceSandboxEnsureContext, type WorkspaceSandboxInstanceLike, type WorkspaceSandboxManager, type WorkspaceSandboxManagerOptions, type WorkspaceSandboxRuntimeProxyArgs, type WorkspaceSandboxRuntimeProxyHandlerOptions, type WorkspaceSandboxTerminalUpgradeHandlerOptions, type WriteProfileFilesOptions, assertEnvWithinLimits, assertProvisionPayloadWithinCap, attachReasoningEffort, bearerSubprotocolToken, bearerToken, buildAppToolMcpServers, buildSandboxRuntimeProxyHeaders, buildSandboxToolFileMounts, buildSandboxToolPathSetupScript, classifySeveredStream, collectSandboxPromptText, createD1PrewarmClaimStore, createSandboxPrewarmer, createSandboxTerminalToken, createWorkspaceSandboxConnectionHandler, createWorkspaceSandboxManager, createWorkspaceSandboxRuntimeProxyHandler, createWorkspaceSandboxTerminalUpgradeHandler, deferredCorpusHash, deleteSecret, detectInteractiveQuestion, driveSandboxTurn, encodeSandboxRuntimePath, ensureWorkspaceSandbox, flattenHistory, getClient, isSandboxTerminalWsUpgrade, isTerminalPromptEvent, matchSandboxTerminalWsPath, mergeExtraMcp, mergeHistoryIntoParts, mintSandboxScopedToken, mintTerminalProxyToken, peekWorkspaceSandbox, readSandboxBinaryBytes, readSecret, requireTransportableModel, resetClientCache, resolveModel, resolveModelSelection, resolveSandboxClientCredentials, runSandboxPrompt, runSandboxToolPathSetup, sandboxSidecarProxyUrl, sandboxToolBinDir, sandboxToolPath, sandboxToolRootDir, secretStoreFromClient, selectedBearerSubprotocol, shellQuote, splitDeferredProfileFiles, statSandboxFileSize, storeSecret, streamSandboxPrompt, syncSandboxMemberAdd, syncSandboxMemberRemove, syncSandboxMemberRole, terminalTokenFromRequest, terminalUpgradeSubprotocolEcho, verifySandboxTerminalToken, verifyTerminalProxyToken, writeProfileFilesToBox };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  DEFAULT_PREWARM_CLAIM_TABLE,
3
3
  DEFAULT_SANDBOX_RESOURCES,
4
+ DEFAULT_SIDECAR_PROCESS_PATTERN,
4
5
  ENV_TOTAL_MAX_BYTES,
5
6
  ENV_VALUE_MAX_BYTES,
6
7
  PREWARM_CLAIM_TABLE_DDL,
@@ -71,7 +72,7 @@ import {
71
72
  verifySandboxTerminalToken,
72
73
  verifyTerminalProxyToken,
73
74
  writeProfileFilesToBox
74
- } from "../chunk-6W5Y4J2X.js";
75
+ } from "../chunk-2UDJH6QR.js";
75
76
  import "../chunk-LWSJK546.js";
76
77
  import "../chunk-CQZSAR77.js";
77
78
  import "../chunk-ICOHEZK6.js";
@@ -82,6 +83,7 @@ import "../chunk-JML7WKWU.js";
82
83
  export {
83
84
  DEFAULT_PREWARM_CLAIM_TABLE,
84
85
  DEFAULT_SANDBOX_RESOURCES,
86
+ DEFAULT_SIDECAR_PROCESS_PATTERN,
85
87
  ENV_TOTAL_MAX_BYTES,
86
88
  ENV_VALUE_MAX_BYTES,
87
89
  PREWARM_CLAIM_TABLE_DDL,
@@ -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 { S as SandboxTerminalConnection, a as SandboxTerminalConnectionResponse, U as UseSandboxTerminalConnectionOptions, b as UseSandboxTerminalConnectionResult, t as tabTerminalConnectionId, u as useSandboxTerminalConnection } from '../sandbox-terminal-ChNEdHF8.js';
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
- import { S as SandboxTerminalConnection } from '../sandbox-terminal-ChNEdHF8.js';
2
- export { a as SandboxTerminalConnectionResponse, U as UseSandboxTerminalConnectionOptions, b as UseSandboxTerminalConnectionResult, t as tabTerminalConnectionId, u as useSandboxTerminalConnection } from '../sandbox-terminal-ChNEdHF8.js';
3
- import { ReactNode } from 'react';
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
- * `WorkspaceTerminalPanel` the shared sandbox-terminal surface: a header with
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
- * Pair it with {@link useSandboxTerminalConnection} (the `connection` prop) and
14
- * {@link tabTerminalConnectionId} (the `connectionId` prop) so reloads restore
15
- * the same PTY and separate tabs don't evict each other.
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
- * Styling matches the rest of `web-react`: Tailwind over the shared design
18
- * tokens; glyphs inline; no icon/UI library.
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 TerminalStatusTone = 'idle' | 'connecting' | 'connected' | 'error';
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":["../../src/web-react/workspace-terminal-panel.tsx"],"sourcesContent":["/**\n * `WorkspaceTerminalPanel` — the shared sandbox-terminal surface: a header with\n * a status badge, connect/provisioning/error states with a retry, and the lazy\n * `TerminalView` (from `@tangle-network/sandbox-ui`) mounted only once the\n * connection is live. creative-agent and gtm-agent each hand-roll a structurally\n * identical panel; only the copy and the status-tone map are app-specific, so\n * those are props and everything else lives here.\n *\n * Pair it with {@link useSandboxTerminalConnection} (the `connection` prop) and\n * {@link tabTerminalConnectionId} (the `connectionId` prop) so reloads restore\n * the same PTY and separate tabs don't evict each other.\n *\n * Styling matches the rest of `web-react`: Tailwind over the shared design\n * tokens; glyphs inline; no icon/UI library.\n */\n\nimport { lazy, Suspense, type ReactNode } from 'react'\n\nimport type { SandboxTerminalConnection } from './sandbox-terminal'\n\nconst TerminalView = lazy(() =>\n import('@tangle-network/sandbox-ui/terminal').then((m) => ({ default: m.TerminalView })),\n)\n\nexport type TerminalStatusTone = 'idle' | 'connecting' | 'connected' | 'error'\n\nexport interface TerminalStatusDisplay {\n tone: TerminalStatusTone\n label: string\n}\n\nexport interface WorkspaceTerminalPanelProps {\n /** Live connection state (from {@link useSandboxTerminalConnection}). */\n connection: SandboxTerminalConnection\n /** Stable per-tab id (from {@link tabTerminalConnectionId}) so the sidecar\n * restores the same PTY across remounts and tabs don't collide. */\n connectionId?: string\n /** Header title. Default \"Terminal\". */\n title?: string\n /** Header subtitle / sandbox label. */\n subtitle?: string\n /** Whether the terminal tab is visible (forwarded to `TerminalView` for fit). */\n isActive?: boolean\n /** Reconnect handler — wire to the hook's `connect`. Shown on idle/error. */\n onRetry?: () => void\n /** Map a `connection.status` to a badge tone + label. The default covers\n * idle/provisioning/running/error; override for app-specific vocabulary. */\n statusDisplay?: (connection: SandboxTerminalConnection) => TerminalStatusDisplay\n /** Extra header content, right-aligned (actions, sandbox id, …). */\n headerExtra?: ReactNode\n className?: string\n}\n\nconst TONE_DOT: Record<TerminalStatusTone, string> = {\n idle: 'bg-muted-foreground/50',\n connecting: 'animate-pulse bg-warning',\n connected: 'bg-success',\n error: 'bg-destructive',\n}\n\nfunction defaultStatusDisplay(conn: SandboxTerminalConnection): TerminalStatusDisplay {\n if (conn.error) return { tone: 'error', label: 'Disconnected' }\n if (conn.runtimeUrl && conn.token) return { tone: 'connected', label: 'Connected' }\n if (conn.loading) return { tone: 'connecting', label: conn.status === 'provisioning' ? 'Provisioning…' : 'Connecting…' }\n return { tone: 'idle', label: 'Idle' }\n}\n\nexport function WorkspaceTerminalPanel({\n connection,\n connectionId,\n title = 'Terminal',\n subtitle,\n isActive,\n onRetry,\n statusDisplay,\n headerExtra,\n className,\n}: WorkspaceTerminalPanelProps): ReactNode {\n const status = (statusDisplay ?? defaultStatusDisplay)(connection)\n const apiUrl = connection.runtimeUrl ?? connection.sidecarUrl\n const ready = Boolean(apiUrl && connection.token)\n\n return (\n <div className={`flex h-full min-h-0 flex-col overflow-hidden rounded-xl border border-border bg-card ${className ?? ''}`}>\n <div className=\"flex items-center justify-between gap-3 border-b border-border px-4 py-2.5\">\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-medium text-foreground\">{title}</p>\n {subtitle && <p className=\"truncate text-xs text-muted-foreground\">{subtitle}</p>}\n </div>\n <div className=\"flex items-center gap-2\">\n <span className=\"flex items-center gap-1.5 text-xs text-muted-foreground\">\n <span className={`h-1.5 w-1.5 rounded-full ${TONE_DOT[status.tone]}`} aria-hidden />\n {status.label}\n </span>\n {headerExtra}\n </div>\n </div>\n\n <div className=\"relative min-h-0 flex-1\">\n {ready ? (\n <Suspense fallback={<TerminalMessage>Loading terminal…</TerminalMessage>}>\n <TerminalView\n apiUrl={apiUrl as string}\n token={connection.token as string}\n connectionId={connectionId}\n title={title}\n subtitle={subtitle}\n isActive={isActive}\n />\n </Suspense>\n ) : (\n <TerminalMessage>\n {connection.error ? (\n <>\n <p className=\"text-sm text-destructive\">{connection.error}</p>\n {onRetry && (\n <button\n type=\"button\"\n onClick={onRetry}\n 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\"\n >\n Reconnect\n </button>\n )}\n </>\n ) : connection.loading ? (\n <p className=\"text-sm text-muted-foreground\">\n {connection.status === 'provisioning' ? 'Provisioning sandbox…' : 'Connecting…'}\n </p>\n ) : (\n <>\n <p className=\"text-sm text-muted-foreground\">Terminal not connected.</p>\n {onRetry && (\n <button\n type=\"button\"\n onClick={onRetry}\n 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\"\n >\n Connect\n </button>\n )}\n </>\n )}\n </TerminalMessage>\n )}\n </div>\n </div>\n )\n}\n\nfunction TerminalMessage({ children }: { children: ReactNode }): ReactNode {\n return <div className=\"absolute inset-0 flex flex-col items-center justify-center p-6 text-center\">{children}</div>\n}\n"],"mappings":";;;;;;AAgBA,SAAS,MAAM,gBAAgC;AAqEvC,SA4BM,UA3BJ,KADF;AAjER,IAAM,eAAe;AAAA,EAAK,MACxB,OAAO,qCAAqC,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE;AACzF;AA+BA,IAAM,WAA+C;AAAA,EACnD,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,OAAO;AACT;AAEA,SAAS,qBAAqB,MAAwD;AACpF,MAAI,KAAK,MAAO,QAAO,EAAE,MAAM,SAAS,OAAO,eAAe;AAC9D,MAAI,KAAK,cAAc,KAAK,MAAO,QAAO,EAAE,MAAM,aAAa,OAAO,YAAY;AAClF,MAAI,KAAK,QAAS,QAAO,EAAE,MAAM,cAAc,OAAO,KAAK,WAAW,iBAAiB,uBAAkB,mBAAc;AACvH,SAAO,EAAE,MAAM,QAAQ,OAAO,OAAO;AACvC;AAEO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA2C;AACzC,QAAM,UAAU,iBAAiB,sBAAsB,UAAU;AACjE,QAAM,SAAS,WAAW,cAAc,WAAW;AACnD,QAAM,QAAQ,QAAQ,UAAU,WAAW,KAAK;AAEhD,SACE,qBAAC,SAAI,WAAW,wFAAwF,aAAa,EAAE,IACrH;AAAA,yBAAC,SAAI,WAAU,8EACb;AAAA,2BAAC,SAAI,WAAU,WACb;AAAA,4BAAC,OAAE,WAAU,gDAAgD,iBAAM;AAAA,QAClE,YAAY,oBAAC,OAAE,WAAU,0CAA0C,oBAAS;AAAA,SAC/E;AAAA,MACA,qBAAC,SAAI,WAAU,2BACb;AAAA,6BAAC,UAAK,WAAU,2DACd;AAAA,8BAAC,UAAK,WAAW,4BAA4B,SAAS,OAAO,IAAI,CAAC,IAAI,eAAW,MAAC;AAAA,UACjF,OAAO;AAAA,WACV;AAAA,QACC;AAAA,SACH;AAAA,OACF;AAAA,IAEA,oBAAC,SAAI,WAAU,2BACZ,kBACC,oBAAC,YAAS,UAAU,oBAAC,mBAAgB,oCAAiB,GACpD;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO,WAAW;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF,GACF,IAEA,oBAAC,mBACE,qBAAW,QACV,iCACE;AAAA,0BAAC,OAAE,WAAU,4BAA4B,qBAAW,OAAM;AAAA,MACzD,WACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,OAEJ,IACE,WAAW,UACb,oBAAC,OAAE,WAAU,iCACV,qBAAW,WAAW,iBAAiB,+BAA0B,oBACpE,IAEA,iCACE;AAAA,0BAAC,OAAE,WAAU,iCAAgC,qCAAuB;AAAA,MACnE,WACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,SAAS;AAAA,UACT,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,OAEJ,GAEJ,GAEJ;AAAA,KACF;AAEJ;AAEA,SAAS,gBAAgB,EAAE,SAAS,GAAuC;AACzE,SAAO,oBAAC,SAAI,WAAU,8EAA8E,UAAS;AAC/G;","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.44.56",
3
+ "version": "0.44.58",
4
4
  "packageManager": "pnpm@11.17.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [