@tangle-network/sandbox-ui 0.113.6 → 0.114.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 (106) hide show
  1. package/dist/WorkflowGraph-B-NsdYz_.js +1961 -0
  2. package/dist/assets.d.ts +214 -206
  3. package/dist/assets.js +1057 -908
  4. package/dist/auth-CWe17Hly.js +37 -0
  5. package/dist/auth.d.ts +2 -30
  6. package/dist/auth.js +2 -15
  7. package/dist/chat-BOvFAe6p.js +903 -0
  8. package/dist/chat.d.ts +2 -230
  9. package/dist/chat.js +2 -34
  10. package/dist/connectors.d.ts +52 -49
  11. package/dist/connectors.js +595 -643
  12. package/dist/dashboard-CZ3VgNPR.js +4969 -0
  13. package/dist/dashboard.d.ts +4 -1297
  14. package/dist/dashboard.js +4 -152
  15. package/dist/editor.d.ts +2 -1
  16. package/dist/editor.js +2 -31
  17. package/dist/files.d.ts +2 -6
  18. package/dist/files.js +2 -33
  19. package/dist/globals.css +63 -3
  20. package/dist/hooks.d.ts +146 -148
  21. package/dist/hooks.js +222 -55
  22. package/dist/index-CKRaj1pM.d.ts +776 -0
  23. package/dist/index-CXX5IpH2.d.ts +2 -0
  24. package/dist/index-DPePq7c8.d.ts +1340 -0
  25. package/dist/index-DiyLLZuJ.d.ts +230 -0
  26. package/dist/index-DvmZLMT1.d.ts +30 -0
  27. package/dist/index-I8ZLVtHd.d.ts +330 -0
  28. package/dist/index-PRM636Ex.d.ts +86 -0
  29. package/dist/index.d.ts +21 -33
  30. package/dist/index.js +21 -701
  31. package/dist/info-panel-C9cqDzOL.js +594 -0
  32. package/dist/integrations.d.ts +133 -139
  33. package/dist/integrations.js +491 -673
  34. package/dist/markdown.d.ts +2 -1
  35. package/dist/markdown.js +2 -13
  36. package/dist/model-I-NIxeM-.js +1250 -0
  37. package/dist/model-brand-B9A4H9pJ.d.ts +98 -0
  38. package/dist/model-brand-hMyDTUqB.js +624 -0
  39. package/dist/motion-DkyBRJb9.js +37 -0
  40. package/dist/openui.d.ts +2 -1
  41. package/dist/openui.js +2 -7
  42. package/dist/pages.d.ts +307 -300
  43. package/dist/pages.js +4404 -4181
  44. package/dist/primitives-Dh1vG6J3.js +113 -0
  45. package/dist/primitives.d.ts +2 -74
  46. package/dist/primitives.js +2 -204
  47. package/dist/provider-logo-DjqmConF.js +311 -0
  48. package/dist/run.d.ts +2 -1
  49. package/dist/run.js +2 -23
  50. package/dist/sdk-hooks.d.ts +3 -4
  51. package/dist/sdk-hooks.js +3 -31
  52. package/dist/sidecar-DgH_vQ6m.d.ts +9 -0
  53. package/dist/stores.d.ts +14 -15
  54. package/dist/stores.js +13 -81
  55. package/dist/styles.css +63 -3
  56. package/dist/template-card-L-4gmjx2.d.ts +90 -0
  57. package/dist/terminal-CN9ZgHRt.js +197 -0
  58. package/dist/terminal.d.ts +60 -60
  59. package/dist/terminal.js +2 -10
  60. package/dist/tokens.css +51 -0
  61. package/dist/types.d.ts +4 -11
  62. package/dist/types.js +0 -1
  63. package/dist/use-pty-session-C8cE0adT.js +669 -0
  64. package/dist/use-sidecar-auth-CCTJcrq7.d.ts +145 -0
  65. package/dist/use-sidecar-auth-DkdcufOz.js +742 -0
  66. package/dist/utils-DzWbktWG.js +2 -0
  67. package/dist/utils.d.ts +2 -1
  68. package/dist/utils.js +2 -37
  69. package/dist/workbench-BCaCKl-J.js +8347 -0
  70. package/dist/workbench.d.ts +2 -310
  71. package/dist/workbench.js +2 -44
  72. package/dist/workflows.d.ts +341 -339
  73. package/dist/workflows.js +74 -109
  74. package/dist/workspace-B6AtI6ld.js +2510 -0
  75. package/dist/workspace.d.ts +2 -761
  76. package/dist/workspace.js +2 -51
  77. package/package.json +46 -40
  78. package/dist/WorkflowGraph-2QOORYIR.js +0 -1722
  79. package/dist/chunk-2BUPSB7O.js +0 -0
  80. package/dist/chunk-3KBNPQQF.js +0 -2697
  81. package/dist/chunk-3LIXVEEE.js +0 -279
  82. package/dist/chunk-72UF2H5H.js +0 -707
  83. package/dist/chunk-AI25G5MX.js +0 -944
  84. package/dist/chunk-ANSC5AFC.js +0 -314
  85. package/dist/chunk-AZ3AWMTM.js +0 -8
  86. package/dist/chunk-BGVEHENC.js +0 -10
  87. package/dist/chunk-CZ7CSFO4.js +0 -39
  88. package/dist/chunk-DYXXYGS4.js +0 -4700
  89. package/dist/chunk-EI44GEQ5.js +0 -6
  90. package/dist/chunk-IACRDXER.js +0 -219
  91. package/dist/chunk-IOB2PW5Z.js +0 -55
  92. package/dist/chunk-M4K7ZGR2.js +0 -24
  93. package/dist/chunk-MYZAW4RX.js +0 -665
  94. package/dist/chunk-OMUIPJQZ.js +0 -555
  95. package/dist/chunk-RQZRXKMR.js +0 -398
  96. package/dist/chunk-SOKKTB7W.js +0 -230
  97. package/dist/chunk-TADGS4Q7.js +0 -1010
  98. package/dist/chunk-UCQNOUN3.js +0 -7964
  99. package/dist/chunk-ULPLRBMF.js +0 -34
  100. package/dist/chunk-WID73FPH.js +0 -89
  101. package/dist/chunk-X3YXP7FG.js +0 -38
  102. package/dist/logo-DiAjq759.d.ts +0 -15
  103. package/dist/model-brand-BNnaUKKZ.d.ts +0 -99
  104. package/dist/ports-list-CDIvTNnX.d.ts +0 -17
  105. package/dist/sdk-hooks-Djkjq4cp.d.ts +0 -145
  106. package/dist/template-card-Bn-Bw5xC.d.ts +0 -87
@@ -0,0 +1,145 @@
1
+ import { ReasoningEffort } from "@tangle-network/agent-interface";
2
+ import { SessionMessage, SessionPart } from "@tangle-network/ui/types";
3
+ //#region src/hooks/use-session-stream.d.ts
4
+ /** Minimal session info returned by the listing API. */
5
+ interface SessionInfo {
6
+ id: string;
7
+ title: string;
8
+ parentID?: string;
9
+ }
10
+ interface UseSessionStreamOptions {
11
+ /** Base URL of the session proxy (e.g. "http://localhost:9100"). */
12
+ apiUrl: string;
13
+ /** Bearer token for authentication. */
14
+ token: string | null;
15
+ /** Session ID to stream events for. */
16
+ sessionId: string;
17
+ /** Only connect when true. Defaults to true. */
18
+ enabled?: boolean;
19
+ }
20
+ /**
21
+ * Per-message overrides forwarded to the sidecar's send-message endpoint.
22
+ * Every field is optional — omitted fields fall back to the session's
23
+ * backend configuration. Matches `SendMessageRequestSchema` on the sidecar.
24
+ */
25
+ interface SendMessageOptions {
26
+ /** Backend agent identifier override (e.g. a named opencode agent). */
27
+ agent?: string;
28
+ /** Per-turn model override; session backend supplies apiKey/baseUrl. */
29
+ model?: {
30
+ providerID: string;
31
+ modelID: string;
32
+ };
33
+ /** Per-turn system prompt override. */
34
+ system?: string;
35
+ /** Thinking-effort hint; the sidecar maps it to a thinking-token budget. The full canonical
36
+ * `ReasoningEffort` (`@tangle-network/agent-interface`) — the UI shows only the levels the
37
+ * selected harness/model actually supports (a capability filter), never a hard-coded subset. */
38
+ reasoningEffort?: ReasoningEffort;
39
+ }
40
+ /**
41
+ * A sandbox-level condition that degrades the session without ending it.
42
+ *
43
+ * Distinct from `error`, which reports a turn that failed: the session here is
44
+ * running and will answer, it is just missing something the caller asked for.
45
+ * Reported separately so it is not cleared by the next successful turn — the
46
+ * condition outlives the turn that revealed it.
47
+ */
48
+ interface SessionDegradation {
49
+ /** Which capability is degraded. A union so this can grow without a break. */
50
+ readonly kind: 'hub-connections';
51
+ /** Machine-readable cause. */
52
+ readonly reason: string;
53
+ /** Operator/user-facing sentence, authored by the sidecar. */
54
+ readonly message: string;
55
+ /**
56
+ * What the session asked for, NOT how much it lost.
57
+ *
58
+ * There is deliberately no count of missing integrations: the sidecar reaches
59
+ * this state only for an attach-all request, and the call that would
60
+ * enumerate the tenant's connections is the one that failed authentication.
61
+ * Any number rendered here would be fabricated.
62
+ */
63
+ readonly requestShape: string;
64
+ }
65
+ interface UseSessionStreamResult {
66
+ /** All messages in the session (fetched + streaming). */
67
+ messages: SessionMessage[];
68
+ /** Part map: messageId → SessionPart[]. */
69
+ partMap: Record<string, SessionPart[]>;
70
+ /** Whether the agent is currently streaming a response. */
71
+ isStreaming: boolean;
72
+ /** Send a text message to the agent, with optional per-turn overrides. */
73
+ send: (text: string, options?: SendMessageOptions) => Promise<void>;
74
+ /** Abort the current agent execution. */
75
+ abort: () => Promise<void>;
76
+ /** Refetch full message history from the API. */
77
+ refetch: () => Promise<void>;
78
+ /** Connection or stream error, if any. */
79
+ error: string | null;
80
+ /** Whether the SSE connection is active. */
81
+ connected: boolean;
82
+ /**
83
+ * The degradation currently reported for THIS session, or `null`.
84
+ *
85
+ * Today the only one is a Hub credential the sandbox could not present, which
86
+ * leaves the agent with an EMPTY toolbelt while the session otherwise runs
87
+ * normally. Without surfacing it, that state is indistinguishable to the user
88
+ * from having connected no integrations at all — so a caller that renders a
89
+ * transcript should render this too.
90
+ *
91
+ * Seeded from session status rather than derived from the live stream alone:
92
+ * the sidecar's bus never replays, so a reload — or attaching a beat after
93
+ * spawn — would otherwise show a normal-looking session with no tools and no
94
+ * explanation. Live frames update it, and a recovered credential clears it.
95
+ */
96
+ degradation: SessionDegradation | null;
97
+ }
98
+ declare class SessionStreamError extends Error {
99
+ readonly code: string;
100
+ readonly status?: number;
101
+ constructor(code: string, message: string, status?: number);
102
+ }
103
+ declare const SESSION_STREAM_RECONNECT_DELAY_MS = 1000;
104
+ /**
105
+ * Streams chat messages from a sidecar session gateway via SSE.
106
+ *
107
+ * Fetches existing message history on mount, then subscribes to SSE for
108
+ * real-time updates. Maps the sidecar's message format to agent-ui's
109
+ * SessionMessage + partMap format.
110
+ */
111
+ declare function useSessionStream({ apiUrl, token, sessionId, enabled }: UseSessionStreamOptions): UseSessionStreamResult;
112
+ //#endregion
113
+ //#region src/hooks/use-sidecar-auth.d.ts
114
+ interface UseSidecarAuthOptions {
115
+ /** Scoping key for token storage (e.g. botId, sandboxId). */
116
+ resourceId: string;
117
+ /** Base URL of the sidecar or operator API. */
118
+ apiUrl: string;
119
+ /**
120
+ * Sign a plaintext message and return the hex signature.
121
+ * Consuming apps wire this to their wallet library (e.g. wagmi's signMessageAsync).
122
+ */
123
+ signMessage: (message: string) => Promise<string>;
124
+ }
125
+ interface SidecarAuth {
126
+ token: string | null;
127
+ isAuthenticated: boolean;
128
+ isAuthenticating: boolean;
129
+ authenticate: () => Promise<string | null>;
130
+ clearCachedToken: () => void;
131
+ error: string | null;
132
+ }
133
+ /**
134
+ * Generic sidecar PASETO challenge/response auth.
135
+ *
136
+ * Flow:
137
+ * 1. POST /api/auth/challenge → { nonce, message, expires_at }
138
+ * 2. signMessage(message) → signature (provided by consuming app)
139
+ * 3. POST /api/auth/session → { token, address, expires_at }
140
+ *
141
+ * Tokens are cached in localStorage and auto-refreshed 5 minutes before expiry.
142
+ */
143
+ declare function useSidecarAuth({ resourceId, apiUrl, signMessage }: UseSidecarAuthOptions): SidecarAuth;
144
+ //#endregion
145
+ export { SendMessageOptions as a, SessionStreamError as c, useSessionStream as d, SESSION_STREAM_RECONNECT_DELAY_MS as i, UseSessionStreamOptions as l, UseSidecarAuthOptions as n, SessionDegradation as o, useSidecarAuth as r, SessionInfo as s, SidecarAuth as t, UseSessionStreamResult as u };