@truefoundry/assistant-ui-runtime 0.1.7 → 0.1.9

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 (36) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +19 -15
  3. package/dist/chunk-CXBZ6WLZ.js +636 -0
  4. package/dist/chunk-CXBZ6WLZ.js.map +1 -0
  5. package/dist/index.d.ts +3 -3
  6. package/dist/index.js +14 -5
  7. package/dist/index.js.map +1 -1
  8. package/dist/plugins/truefoundry-agent-server-adapter/index.d.ts +81 -35
  9. package/dist/plugins/truefoundry-agent-server-adapter/index.js +3 -1
  10. package/dist/server/index.d.ts +2 -2
  11. package/dist/{types-DbNsU075.d.ts → types-6yWuWHzK.d.ts} +109 -28
  12. package/package.json +1 -1
  13. package/src/convertTurnMessages.ts +4 -0
  14. package/src/draft/truefoundryDraftThreadListAdapter.ts +4 -1
  15. package/src/harness.temp.ts +85 -0
  16. package/src/index.ts +27 -0
  17. package/src/plugins/truefoundry-agent-server-adapter/README.md +83 -44
  18. package/src/plugins/truefoundry-agent-server-adapter/chatServer.ts +365 -0
  19. package/src/plugins/truefoundry-agent-server-adapter/cp.test.ts +444 -0
  20. package/src/plugins/truefoundry-agent-server-adapter/cp.ts +482 -0
  21. package/src/plugins/truefoundry-agent-server-adapter/createTrueFoundryAgentUIServer.ts +94 -0
  22. package/src/plugins/truefoundry-agent-server-adapter/guards.ts +1 -1
  23. package/src/plugins/truefoundry-agent-server-adapter/index.ts +20 -391
  24. package/src/plugins/truefoundry-agent-server-adapter/normalizeAgentSpec.test.ts +85 -0
  25. package/src/plugins/truefoundry-agent-server-adapter/normalizeAgentSpec.ts +84 -0
  26. package/src/plugins/truefoundry-agent-server-adapter/types.ts +1 -1
  27. package/src/server/index.ts +20 -0
  28. package/src/server/types.ts +125 -28
  29. package/src/streamTurn.test.ts +27 -27
  30. package/src/streamTurn.ts +2 -2
  31. package/src/truefoundryOwnedSessionsThreadListAdapter.ts +4 -1
  32. package/src/truefoundryThreadListAdapter.test.ts +22 -0
  33. package/src/truefoundryThreadListAdapter.ts +4 -1
  34. package/src/useTrueFoundryAgentMessages.test.tsx +1 -1
  35. package/dist/chunk-SQDOTGP2.js +0 -292
  36. package/dist/chunk-SQDOTGP2.js.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ ## 0.1.9
4
+
5
+ ### Added
6
+
7
+ - **Sandboxes catalog** — new `SandboxCatalogServer` port and DTOs (`SandboxConfig`, `SandboxCatalogEntry`, `SandboxBase`, `CreateSandboxRequest`, `UpdateSandboxRequest`). Exposed as the optional `CatalogServer.sandboxCatalog` sub-port. `SandboxConfig` holds the mutable settings (`snapshotName`, `execTimeoutMs`, `autoStopIntervalInMinutes`, `autoArchiveIntervalInMinutes`, `autoDeleteIntervalInMinutes`) shared by catalog rows, create, and update; create adds `apiKey`.
8
+ - **Skills catalog** — `SkillCatalogServer.getSkillCatalog()` plus registry/github skill DTOs (`RegistrySkill`, `GithubSkill`, `DefinedSkill`, `SkillConfigBase`, `SkillCatalogEntry`, `CreateSkillRequestBase`, `SelectRegistrySkillRequest`, `ImportGithubSkillRequest`). Registry vs github is distinguished by `catalogId` presence, not a `type` field.
9
+ - **`ModelSelectorEntry.reasoningEfforts?: string[]`** and **`ToolBase.description: string`**.
10
+
11
+ ## 0.1.8
12
+
13
+ ### Breaking
14
+
15
+ - **`AgentChatServer.prepareAndExecuteTurn` → `createTurn`**
16
+ Rename the method on every `AgentChatServer` implementation and mock. Signature and return type are unchanged.
17
+
18
+ - **`ConnectorAuthType` is now `"dcr" | "header" | "none"`**
19
+ Previously an open `string` with documented display labels (`"None"`, `"OAuth"`, `"API Key"`). Map host/wire values to these literals.
20
+
21
+ - **`ConnectorAuth` / `ConnectorAuthPublic` are discriminated unions**
22
+ - Write: `{ type: "dcr"; authUrl?: string } | { type: "header"; apiKey?: string; headerName?: string } | { type: "none" }`
23
+ - Public: dcr branch requires `authUrl: string` (no secrets).
24
+ Branch types (`ConnectorAuthOAuth`, `ConnectorAuthPublicOAuth`, …) are exported so hosts can intersect extras and re-union, e.g. `ConnectorAuthPublicOAuth & { custom: string }`.
25
+
26
+ - **`ConnectorBase.requiresAuth: boolean`**
27
+ Required alongside existing `authenticated`. When `requiresAuth` is true, UI should not show Disconnect.
28
+
29
+ ### Notes
30
+
31
+ - After `authenticateConnector`, the authorize URL is on `connector.auth.authUrl` when `auth.type === "dcr"` (not a separate widened return field).
package/README.md CHANGED
@@ -53,14 +53,15 @@ The fastest path is a TrueFoundry gateway server + the runtime hook + your Threa
53
53
 
54
54
  import { AssistantRuntimeProvider } from "@assistant-ui/react";
55
55
  import {
56
- createTrueFoundryChatServer,
56
+ createTrueFoundryAgentUIServer,
57
57
  useTrueFoundryAgentRuntime,
58
58
  } from "@truefoundry/assistant-ui-runtime";
59
59
  import { Thread } from "@/components/assistant-ui/thread";
60
60
 
61
- const server = createTrueFoundryChatServer({
61
+ const server = await createTrueFoundryAgentUIServer({
62
62
  apiKey: process.env.TFY_API_KEY!,
63
- baseUrl: process.env.TFY_GATEWAY_URL!,
63
+ cpURL: process.env.TFY_CP_URL!,
64
+ // gatewayURL: process.env.TFY_GATEWAY_URL, // optional
64
65
  });
65
66
 
66
67
  export function MyAssistant() {
@@ -206,9 +207,9 @@ const pending = trueFoundryExtras.use((e) => e.pendingApprovals, []);
206
207
 
207
208
  ## Server port (`AgentChatServer`)
208
209
 
209
- The runtime never holds credentials. It accepts any object implementing `AgentChatServer` — a flat, stateless port with methods like `createSession`, `listSessions`, `prepareAndExecuteTurn`, etc.
210
+ The runtime never holds credentials. It accepts any object implementing `AgentChatServer` — a flat, stateless port with methods like `createSession`, `listSessions`, `createTurn`, etc.
210
211
 
211
- **First-party:** use [`createTrueFoundryChatServer`](#truefoundry-gateway-plugin) (requires `truefoundry-gateway-sdk`).
212
+ **First-party:** use [`createTrueFoundryAgentUIServer`](#truefoundry-agent-ui-server-plugin) (requires `truefoundry-gateway-sdk`). Chat-only: `createTrueFoundryChatServer`.
212
213
 
213
214
  **Your own backend:**
214
215
 
@@ -228,7 +229,7 @@ const server: AgentChatServer = {
228
229
  updateSession: async (req) => {
229
230
  /* … */
230
231
  },
231
- prepareAndExecuteTurn: (req) => {
232
+ createTurn: (req) => {
232
233
  /* return AsyncIterable<TurnStreamData> */
233
234
  },
234
235
  cancelSession: async (req) => {
@@ -250,22 +251,24 @@ const server: AgentChatServer = {
250
251
 
251
252
  ---
252
253
 
253
- ## TrueFoundry gateway plugin
254
+ ## TrueFoundry agent UI server plugin
254
255
 
255
- `createTrueFoundryChatServer` wraps `truefoundry-gateway-sdk` into an `AgentChatServer`. Import from the main entry or the isolated subpath (no React):
256
+ `createTrueFoundryAgentUIServer` builds gateway chat + Control Plane builder lists from `{ apiKey, cpURL, gatewayURL? }`. Same bearer for CP and gateway.
256
257
 
257
258
  ```tsx
258
- import { createTrueFoundryChatServer } from "@truefoundry/assistant-ui-runtime";
259
+ import { createTrueFoundryAgentUIServer } from "@truefoundry/assistant-ui-runtime";
259
260
  // or
260
- import { createTrueFoundryChatServer } from "@truefoundry/assistant-ui-runtime/plugins/truefoundry-agent-server-adapter";
261
+ import { createTrueFoundryAgentUIServer } from "@truefoundry/assistant-ui-runtime/plugins/truefoundry-agent-server-adapter";
261
262
 
262
- const server = createTrueFoundryChatServer({
263
+ const server = await createTrueFoundryAgentUIServer({
263
264
  apiKey: process.env.TFY_API_KEY!,
264
- baseUrl: process.env.TFY_GATEWAY_URL!,
265
+ cpURL: process.env.TFY_CP_URL!,
265
266
  });
266
267
  ```
267
268
 
268
- See the [plugin README](./src/plugins/truefoundry-agent-server-adapter/README.md) for options, named vs draft routing, `Tfy*` types, type guards, and host-spec extension.
269
+ Chat-only escape hatch: `createTrueFoundryChatServer({ apiKey, baseUrl })`.
270
+
271
+ See the [plugin README](./src/plugins/truefoundry-agent-server-adapter/README.md) for gateway URL resolution, builder CP paths, `Tfy*` types, and host-spec extension.
269
272
 
270
273
  ---
271
274
 
@@ -274,7 +277,8 @@ See the [plugin README](./src/plugins/truefoundry-agent-server-adapter/README.md
274
277
  | Export | Kind | Purpose |
275
278
  | ------ | ---- | ------- |
276
279
  | `useTrueFoundryAgentRuntime` | Hook | Root runtime — wires external-store + thread list |
277
- | `createTrueFoundryChatServer` | Function | TrueFoundry gateway `AgentChatServer` (also via plugin subpath) |
280
+ | `createTrueFoundryAgentUIServer` | Function | Full pack: gateway chat + CP builder (also via plugin subpath) |
281
+ | `createTrueFoundryChatServer` | Function | Chat-only gateway → `AgentChatServer` |
278
282
  | `trueFoundryAttachmentAdapter` | Adapter | Opt-in composer attachments |
279
283
  | `trueFoundryExtras` | Namespace | Low-level extras access |
280
284
  | `useTrueFoundryApprovals` / `ToolResponses` / `McpAuth` / … | Hooks | Pending state + actions |
@@ -298,7 +302,7 @@ For contributors working inside this package. Source lives in `src/`; the publis
298
302
  | `truefoundryExtras.ts` / `hooks.ts` | Extras namespace + consumer hooks |
299
303
  | `convertTurnMessages.ts` | Pure projection from snapshot → thread messages |
300
304
  | `foldPeerThreads.ts` | Nest peer/sub-agent threads under spawning tool calls |
301
- | `plugins/truefoundry-agent-server-adapter/` | Gateway SDK → `AgentChatServer` |
305
+ | `plugins/truefoundry-agent-server-adapter/` | Gateway chat + CP builder → `AgentUIServerPort` |
302
306
 
303
307
  ### Invariants
304
308