@truefoundry/assistant-ui-runtime 0.1.10 → 0.1.13

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.
@@ -1,13 +1,13 @@
1
1
  import { AgentSessionClient } from 'truefoundry-gateway-sdk/agents';
2
2
  import { PrivateAgentSessionClient } from 'truefoundry-gateway-sdk/agents/private';
3
- import { A as AgentSpec, x as CreateSessionRequest, B as ListSessionsParams, S as Session, d as Turn, a7 as TurnState, a as AgentChatServer, ae as UpdateSessionRequest, ag as AgentSelectorEntry, ah as ConnectorSelectorEntry, ai as ModelSelectorEntry, aj as SkillSelectorEntry, f as AgentBuilderServer } from '../../types-Bb8Kaf1h.js';
3
+ import { A as AgentSpec, K as CreateSessionRequest, W as ListSessionsParams, S as Session, d as Turn, az as TurnState, a as AgentChatServer, aH as UpdateSessionRequest, i as AgentSelectorEntry, E as ConnectorSelectorEntry, a6 as ModelSelectorEntry, au as SkillSelectorEntry, g as AgentBuilderServer } from '../../types-BE-F3vCD.js';
4
4
  import { TruefoundryGatewayApi } from 'truefoundry-gateway-sdk';
5
5
 
6
6
  /**
7
7
  * TrueFoundry-specific type extensions over the runtime's generic bases.
8
8
  *
9
- * The runtime defines minimal bases (SkillMount = {id,name}, McpServerMount =
10
- * {id,name}, AgentSpec.config = unknown, etc.) that hosts extend via generics.
9
+ * The runtime defines opaque mount bases (`SkillMount` / `McpServerMount` =
10
+ * `object`) that hosts intersect with gateway shapes via generics.
11
11
  *
12
12
  * This file builds the concrete TrueFoundry types by:
13
13
  * - Importing the runtime's AgentSpec as the base to extend.
@@ -121,7 +121,6 @@ interface TfyModelSelectorEntry extends ModelSelectorEntry {
121
121
  apiModel: string;
122
122
  modelId: string;
123
123
  providerAccount?: string;
124
- id?: string;
125
124
  }
126
125
  interface TfySkillSelectorEntry extends SkillSelectorEntry {
127
126
  /** Version FQN — mount as RegisteredSkillMount.fqn. */
@@ -7,7 +7,7 @@ import {
7
7
  isTfyMcpToolInfo,
8
8
  isTfySystemToolInfo,
9
9
  isTfyToolInfo
10
- } from "../../chunk-6ZOGBD7E.js";
10
+ } from "../../chunk-XYGEKRA2.js";
11
11
  export {
12
12
  createTrueFoundryAgentUIServer,
13
13
  createTrueFoundryChatServer,
@@ -1,5 +1,5 @@
1
- import { aa as TurnStreamingEvent, ak as DeltaEvents, T as TurnEvent } from '../types-Bb8Kaf1h.js';
2
- export { al as ActionRequiredEvent, f as AgentBuilderServer, a as AgentChatServer, am as AgentInfo, an as AgentParent, ag as AgentSelectorEntry, A as AgentSpec, g as AgentUIServerPort, ao as ApprovalDecision, C as CatalogServer, ap as ChunkDeltaToolCall, h as ConnectorAuth, i as ConnectorAuthApiKey, j as ConnectorAuthNone, k as ConnectorAuthOAuth, l as ConnectorAuthPublic, m as ConnectorAuthPublicApiKey, n as ConnectorAuthPublicNone, o as ConnectorAuthPublicOAuth, p as ConnectorAuthType, q as ConnectorBase, r as ConnectorCatalogEntry, s as ConnectorCatalogServer, t as ConnectorConfigBase, ah as ConnectorSelectorEntry, u as CreateConnectorRequest, v as CreateModelProviderRequest, w as CreateSandboxRequest, x as CreateSessionRequest, y as CreateSkillRequest, z as CreateSkillRequestBase, D as DefinedSkill, G as GithubSkill, I as ImportGithubSkillRequest, L as ListResult, aq as ListSessionsOrder, B as ListSessionsParams, M as McpAuthRequiredEvent, ar as McpInitializeEvent, as as McpServerAuthInfo, at as McpServerMount, au as Model, E as ModelCatalogServer, F as ModelEntry, av as ModelMessageContentPart, aw as ModelMessageDeltaEvent, H as ModelMessageEvent, ax as ModelParams, J as ModelProviderBase, K as ModelProviderCatalogEntry, N as ModelProviderConfigBase, ai as ModelSelectorEntry, ay as PageParams, P as PreviousTurnIdInput, O as ProviderType, R as RegistrySkill, Q as SandboxBase, V as SandboxCatalogEntry, W as SandboxCatalogServer, X as SandboxConfig, Y as SandboxCreatedEvent, az as SearchAgentSelectorParams, Z as SelectRegistrySkillRequest, S as Session, _ as SessionEventItem, $ as SkillBase, a0 as SkillCatalogEntry, a1 as SkillCatalogServer, a2 as SkillConfigBase, aA as SkillMount, aj as SkillSelectorEntry, b as ThreadCreatedEvent, aB as ThreadDoneEvent, a3 as ToolApprovalRequiredEvent, a4 as ToolBase, a5 as ToolCall, aC as ToolCallFunction, aD as ToolCallRef, aE as ToolInfo, aF as ToolResponseEvent, a6 as ToolResponseRequiredEvent, d as Turn, aG as TurnCreatedEvent, aH as TurnDoneEvent, e as TurnInputItem, a7 as TurnState, aI as TurnStateCancelled, a8 as TurnStateDone, aJ as TurnStateError, aK as TurnStateRunning, a9 as TurnStreamData, ab as UpdateConnectorRequest, ac as UpdateModelProviderRequest, ad as UpdateSandboxRequest, ae as UpdateSessionRequest, af as UserMessage, aL as UserMessageContent, c as UserToolApprovalEvent, U as UserToolResponseEvent } from '../types-Bb8Kaf1h.js';
1
+ import { aC as TurnStreamingEvent, aJ as DeltaEvents, T as TurnEvent } from '../types-BE-F3vCD.js';
2
+ export { aK as ActionRequiredEvent, f as AgentBuilderCapabilitiesResponse, g as AgentBuilderServer, a as AgentChatServer, aL as AgentInfo, h as AgentLibraryEntry, aM as AgentParent, i as AgentSelectorEntry, j as AgentSkill, A as AgentSpec, k as AgentUIServer, l as AgentUIServerPort, m as ApprovalDecision, n as AuthenticateConnectorRequest, C as CatalogServer, aN as ChunkDeltaToolCall, o as ConnectorAuth, p as ConnectorAuthApiKey, q as ConnectorAuthNone, r as ConnectorAuthOAuth, s as ConnectorAuthPublic, t as ConnectorAuthPublicApiKey, u as ConnectorAuthPublicNone, v as ConnectorAuthPublicOAuth, w as ConnectorAuthType, x as ConnectorAuthenticationResult, y as ConnectorBase, z as ConnectorCatalogEntry, B as ConnectorCatalogServer, D as ConnectorConfigBase, E as ConnectorSelectorEntry, F as ConnectorState, G as CreateConnectorRequest, H as CreateModelProviderRequest, I as CreateSandboxProviderRequest, J as CreateSandboxRequest, K as CreateSessionRequest, L as CreateSkillRequest, N as CreateSkillRequestBase, O as DefinedSkill, P as GithubSkill, Q as ImportGithubSkillRequest, R as ListResult, V as ListSessionsOrder, W as ListSessionsParams, M as McpAuthRequiredEvent, aO as McpInitializeEvent, aP as McpServerAuthInfo, X as McpServerMount, Y as Model, Z as ModelCatalogServer, _ as ModelEntry, aQ as ModelMessageContentPart, aR as ModelMessageDeltaEvent, $ as ModelMessageEvent, a0 as ModelParams, a1 as ModelProperties, a2 as ModelProviderBase, a3 as ModelProviderCatalogEntry, a4 as ModelProviderConfigBase, a5 as ModelSelection, a6 as ModelSelectorEntry, a7 as PageParams, a8 as PreviousTurnIdInput, a9 as ProviderEntry, aa as ProviderType, ab as RegistrySkill, ac as SandboxBase, ad as SandboxCatalogEntry, ae as SandboxCatalogServer, af as SandboxConfig, ag as SandboxCreatedEvent, ah as SandboxProviderBase, ai as SandboxProviderCatalogEntry, aj as SandboxProviderConfig, ak as SaveAgentRequest, al as SearchAgentSelectorParams, am as SearchAgentsParams, an as SelectRegistrySkillRequest, S as Session, ao as SessionEventItem, ap as SkillBase, aq as SkillCatalogEntry, ar as SkillCatalogServer, as as SkillConfigBase, at as SkillMount, au as SkillSelectorEntry, b as ThreadCreatedEvent, aS as ThreadDoneEvent, av as ToolApprovalRequiredEvent, aw as ToolBase, ax as ToolCall, aT as ToolCallFunction, aU as ToolCallRef, aV as ToolInfo, aW as ToolResponseEvent, ay as ToolResponseRequiredEvent, d as Turn, aX as TurnCreatedEvent, aY as TurnDoneEvent, e as TurnInputItem, az as TurnState, aZ as TurnStateCancelled, aA as TurnStateDone, a_ as TurnStateError, a$ as TurnStateRunning, aB as TurnStreamData, aD as UpdateConnectorRequest, aE as UpdateModelProviderRequest, aF as UpdateSandboxProviderRequest, aG as UpdateSandboxRequest, aH as UpdateSessionRequest, aI as UserMessage, b0 as UserMessageContent, c as UserToolApprovalEvent, U as UserToolResponseEvent } from '../types-BE-F3vCD.js';
3
3
 
4
4
  /**
5
5
  * Local implementations of streaming delta helpers.
@@ -227,12 +227,20 @@ type DeltaEvents = ModelMessageDeltaEvent;
227
227
  * No dependency on truefoundry-gateway-sdk.
228
228
  */
229
229
 
230
- /** Model selector row. Host extends for apiModel, modelId, pricing, etc. */
231
- interface ModelSelectorEntry {
230
+ interface ProviderEntry {
232
231
  name: string;
233
- provider: string;
232
+ logo?: string;
233
+ }
234
+ interface ModelProperties {
234
235
  reasoningEfforts?: string[];
235
236
  }
237
+ /** Model selector row. Host extends for apiModel, modelId, pricing, etc. */
238
+ interface ModelSelectorEntry<TProvider extends ProviderEntry = ProviderEntry, TProperties extends ModelProperties = ModelProperties> {
239
+ name: string;
240
+ id: string;
241
+ provider: TProvider;
242
+ properties: TProperties;
243
+ }
236
244
  /** Skill selector row. Host extends for fqn, preload, etc. */
237
245
  interface SkillSelectorEntry {
238
246
  id: string;
@@ -244,6 +252,10 @@ interface ConnectorSelectorEntry {
244
252
  id: string;
245
253
  name: string;
246
254
  description?: string;
255
+ /** When true, the connector must be authenticated before use. Omitted when the host does not report auth. */
256
+ requiresAuth?: boolean;
257
+ /** When true, the connector is already authenticated. Omitted when the host does not report auth. */
258
+ authenticated?: boolean;
247
259
  }
248
260
  /** Agent selector row. Host extends for metadata; `agentSpec` enables Edit. */
249
261
  interface AgentSelectorEntry {
@@ -259,19 +271,19 @@ type SearchAgentSelectorParams = {
259
271
  offset?: number;
260
272
  };
261
273
  /**
262
- * Mounts written to AgentSpec.skills[] / AgentSpec.mcpServers[].
263
- *
264
- * These are opaque to the runtime — it stores and forwards them but never reads
265
- * a field, and the backend owns the shape (the gateway identifies a skill by
266
- * `fqn`, with no `id` or `name` anywhere). So the base constrains only that a
267
- * mount is an object; hosts intersect their concrete mount type over it, as
268
- * `TfySkillMount` / `TfyMcpServerMount` do in the gateway adapter.
269
- *
270
- * Naming a field here would not just be unread, it would be wrong: a base with
271
- * required fields rejects the backend's own payloads, and one with only optional
272
- * fields is a weak type, which TypeScript rejects for a source that shares no
273
- * property with it — the gateway's registry skill shares none.
274
- */
274
+ * Mounts written to AgentSpec.skills[] / AgentSpec.mcpServers[].
275
+ *
276
+ * These are opaque to the runtime — it stores and forwards them but never reads
277
+ * a field, and the backend owns the shape (the gateway identifies a skill by
278
+ * `fqn`, with no `id` or `name` anywhere). So the base constrains only that a
279
+ * mount is an object; hosts intersect their concrete mount type over it, as
280
+ * `TfySkillMount` / `TfyMcpServerMount` do in the gateway adapter.
281
+ *
282
+ * Naming a field here would not just be unread, it would be wrong: a base with
283
+ * required fields rejects the backend's own payloads, and one with only optional
284
+ * fields is a weak type, which TypeScript rejects for a source that shares no
285
+ * property with it — the gateway's registry skill shares none.
286
+ */
275
287
  type SkillMount = object;
276
288
  type McpServerMount = object;
277
289
  interface ModelParams {
@@ -283,10 +295,10 @@ interface Model {
283
295
  params?: ModelParams;
284
296
  }
285
297
  /**
286
- * SDK-owned agent definition — fields the FE reads/writes.
287
- * Host widens `model` / `skills` / `mcpServers` via type params, and adds
288
- * extra fields via `TSpec extends AgentSpec<...>`.
289
- */
298
+ * SDK-owned agent definition — fields the FE reads/writes.
299
+ * Host widens `model` / `skills` / `mcpServers` via type params, and adds
300
+ * extra fields via `TSpec extends AgentSpec<...>`.
301
+ */
290
302
  interface AgentSpec<TModel extends Model = Model, TSkill extends SkillMount = SkillMount, TMcp extends McpServerMount = McpServerMount> {
291
303
  model: TModel;
292
304
  skills?: TSkill[];
@@ -330,7 +342,7 @@ interface ListSessionsParams extends PageParams {
330
342
  /** Host-specific filter (e.g. TFY startTimestamp). */
331
343
  startTimestamp?: string;
332
344
  }
333
- type PreviousTurnIdInput = "auto" | string;
345
+ type PreviousTurnIdInput = "auto" | "none" | string;
334
346
  type UserMessageContent = string | Array<{
335
347
  type: "text";
336
348
  text: string;
@@ -392,11 +404,11 @@ interface Turn {
392
404
  createdAt: string;
393
405
  }
394
406
  /**
395
- * Chat / session port — the runtime calls these.
396
- *
397
- * All session ops are flat (sessionId param). No gateway client dependency.
398
- * `createTrueFoundryServer` is one possible implementation (TFY adapter).
399
- */
407
+ * Chat / session port — the runtime calls these.
408
+ *
409
+ * All session ops are flat (sessionId param). No gateway client dependency.
410
+ * `createTrueFoundryServer` is one possible implementation (TFY adapter).
411
+ */
400
412
  interface AgentChatServer<TSpec extends AgentSpec = AgentSpec, TSession extends Session<TSpec> = Session<TSpec>, TCreate extends CreateSessionRequest<TSpec> = CreateSessionRequest<TSpec>, TList extends ListSessionsParams = ListSessionsParams, TUpdate extends UpdateSessionRequest<TSpec> = UpdateSessionRequest<TSpec>, TTurn extends Turn = Turn> {
401
413
  createSession(req: TCreate): Promise<TSession>;
402
414
  listSessions(req?: TList): Promise<ListResult<TSession>>;
@@ -459,43 +471,63 @@ interface AgentChatServer<TSpec extends AgentSpec = AgentSpec, TSession extends
459
471
  path: string;
460
472
  }): Promise<Blob>;
461
473
  }
474
+ /** Request body for `AgentBuilderServer.saveAgent`. */
475
+ interface SaveAgentRequest<TSpec extends AgentSpec = AgentSpec> {
476
+ agentName: string;
477
+ agentSpec: TSpec;
478
+ }
462
479
  /**
463
- * Builder catalog + persist port — atoms call these.
464
- * Passed separately from the runtime's chat server.
480
+ * Builder feature flags — atoms gate sandbox / skill / settings surfaces on these.
465
481
  */
466
- interface AgentBuilderServer<TSpec extends AgentSpec = AgentSpec, TModel extends ModelSelectorEntry = ModelSelectorEntry, TSkill extends SkillSelectorEntry = SkillSelectorEntry, TMcp extends ConnectorSelectorEntry = ConnectorSelectorEntry, TAgent extends AgentSelectorEntry = AgentSelectorEntry, TSave = unknown> {
482
+ interface AgentBuilderCapabilitiesResponse {
483
+ data: {
484
+ sandbox: {
485
+ enabled: boolean;
486
+ };
487
+ skill: {
488
+ enabled: boolean;
489
+ reason?: string;
490
+ };
491
+ settings?: {
492
+ enabled: boolean;
493
+ };
494
+ };
495
+ }
496
+ /**
497
+ * Builder catalog + persist port — atoms call these.
498
+ * Passed separately from the runtime's chat server.
499
+ */
500
+ interface AgentBuilderServer<TSpec extends AgentSpec = AgentSpec, TModel extends ModelSelectorEntry = ModelSelectorEntry, TSkill extends SkillSelectorEntry = SkillSelectorEntry, TMcp extends ConnectorSelectorEntry = ConnectorSelectorEntry, TAgent extends AgentSelectorEntry = AgentSelectorEntry, TSave = unknown, TCapabilities extends AgentBuilderCapabilitiesResponse = AgentBuilderCapabilitiesResponse> {
501
+ getCapabilities(): Promise<TCapabilities>;
467
502
  getModels(): Promise<TModel[]>;
468
503
  getSkills(): Promise<TSkill[]>;
469
504
  getMcp(): Promise<TMcp[]>;
470
505
  searchAgents(req?: SearchAgentSelectorParams): Promise<TAgent[]>;
471
- saveAgent(req: {
472
- agentName: string;
473
- agentSpec: TSpec;
474
- }): Promise<TSave>;
506
+ saveAgent(req: SaveAgentRequest<TSpec>): Promise<TSave>;
475
507
  deleteAgent?(req: {
476
508
  agentName: string;
477
509
  }): Promise<void>;
478
510
  }
479
511
  /**
480
- * Provider type id. Reserved literal: `"custom"` for user-defined providers;
481
- * any other string is a builtin (e.g. `"openai"`, `"anthropic"`).
482
- *
483
- * Note: `string | "custom"` is useless in TypeScript (`"custom"` ⊆ `string`),
484
- * so this stays `string` and `"custom"` is a documented convention.
485
- */
512
+ * Provider type id. Reserved literal: `"custom"` for user-defined providers;
513
+ * any other string is a builtin (e.g. `"openai"`, `"anthropic"`).
514
+ *
515
+ * Note: `string | "custom"` is useless in TypeScript (`"custom"` ⊆ `string`),
516
+ * so this stays `string` and `"custom"` is a documented convention.
517
+ */
486
518
  type ProviderType = string;
487
519
  /**
488
- * Model row — form "Model ID" + "Display name".
489
- * Host extends for properties, etc.
490
- */
520
+ * Model row — form "Model ID" + "Display name".
521
+ * Host extends for properties, etc.
522
+ */
491
523
  interface ModelEntry {
492
524
  id: string;
493
525
  name: string;
494
526
  }
495
527
  /**
496
- * Write config for create/update (custom form + catalog "Save key").
497
- * Host extends. `baseUrl` present iff `type === "custom"`.
498
- */
528
+ * Write config for create/update (custom form + catalog "Save key").
529
+ * Host extends. `baseUrl` present iff `type === "custom"`.
530
+ */
499
531
  interface ModelProviderConfigBase<TModel extends ModelEntry = ModelEntry> {
500
532
  type: ProviderType;
501
533
  name: string;
@@ -505,9 +537,9 @@ interface ModelProviderConfigBase<TModel extends ModelEntry = ModelEntry> {
505
537
  models: TModel[];
506
538
  }
507
539
  /**
508
- * Configured provider card (list/read). No raw `apiKey`.
509
- * Host extends for apiKeySet, timestamps, etc.
510
- */
540
+ * Configured provider card (list/read). No raw `apiKey`.
541
+ * Host extends for apiKeySet, timestamps, etc.
542
+ */
511
543
  interface ModelProviderBase<TModel extends ModelEntry = ModelEntry> {
512
544
  id: string;
513
545
  type: ProviderType;
@@ -517,14 +549,16 @@ interface ModelProviderBase<TModel extends ModelEntry = ModelEntry> {
517
549
  models: TModel[];
518
550
  }
519
551
  /**
520
- * Discovery-only catalog provider (AVAILABLE list).
521
- * `type` must not be `"custom"` — custom providers use the custom form.
522
- * Host extends for richer model rows.
523
- */
552
+ * Discovery-only catalog provider (AVAILABLE list).
553
+ * `type` must not be `"custom"` — custom providers use the custom form.
554
+ * Host extends for richer model rows.
555
+ */
524
556
  interface ModelProviderCatalogEntry<TModel extends ModelEntry = ModelEntry> {
525
557
  type: ProviderType;
526
558
  name: string;
527
559
  models: TModel[];
560
+ supportedReasoningEfforts?: string[];
561
+ logo?: string;
528
562
  }
529
563
  /** Create — no `id`; server assigns it. Catalog path = entry + apiKey. */
530
564
  type CreateModelProviderRequest<TModel extends ModelEntry = ModelEntry> = ModelProviderConfigBase<TModel>;
@@ -565,7 +599,7 @@ type ConnectorAuthNone = {
565
599
  type ConnectorAuth = ConnectorAuthOAuth | ConnectorAuthApiKey | ConnectorAuthNone;
566
600
  type ConnectorAuthPublicOAuth = {
567
601
  type: "dcr";
568
- authUrl: string;
602
+ authUrl?: string;
569
603
  };
570
604
  type ConnectorAuthPublicApiKey = {
571
605
  type: "header";
@@ -576,18 +610,19 @@ type ConnectorAuthPublicNone = {
576
610
  };
577
611
  type ConnectorAuthPublic = ConnectorAuthPublicOAuth | ConnectorAuthPublicApiKey | ConnectorAuthPublicNone;
578
612
  /**
579
- * MCP / connector create-edit config. Host extends for extra fields, etc.
580
- */
613
+ * MCP / connector create-edit config. Host extends for extra fields, etc.
614
+ */
581
615
  interface ConnectorConfigBase<TAuth extends ConnectorAuth = ConnectorAuth> {
582
616
  name: string;
583
617
  url: string;
584
618
  auth: TAuth;
585
619
  }
586
620
  /**
587
- * Connected connector row (settings/connectors). No raw `apiKey`.
621
+ * Connected connector row (settings/connectors). No raw `apiKey` or tools.
622
+ * Tools are fetched separately with `getToolsByConnectorId`.
588
623
  * Host extends.
589
624
  */
590
- interface ConnectorBase<TTool extends ToolBase = ToolBase, TAuth extends ConnectorAuthPublic = ConnectorAuthPublic> {
625
+ interface ConnectorBase<TAuth extends ConnectorAuthPublic = ConnectorAuthPublic> {
591
626
  id: string;
592
627
  name: string;
593
628
  description: string;
@@ -596,7 +631,6 @@ interface ConnectorBase<TTool extends ToolBase = ToolBase, TAuth extends Connect
596
631
  /** When true, UI should not show Disconnect. */
597
632
  requiresAuth: boolean;
598
633
  authenticated: boolean;
599
- tools: TTool[];
600
634
  }
601
635
  /** Discovery catalog entry for "+ Add MCP server". Host extends. */
602
636
  interface ConnectorCatalogEntry<TAuth extends ConnectorAuthPublic = ConnectorAuthPublic> {
@@ -605,6 +639,7 @@ interface ConnectorCatalogEntry<TAuth extends ConnectorAuthPublic = ConnectorAut
605
639
  description?: string;
606
640
  url: string;
607
641
  auth: TAuth;
642
+ logo?: string;
608
643
  }
609
644
  /** Create connector — no `id`; server assigns it. Host extends. */
610
645
  type CreateConnectorRequest<TAuth extends ConnectorAuth = ConnectorAuth> = ConnectorConfigBase<TAuth>;
@@ -612,21 +647,36 @@ type CreateConnectorRequest<TAuth extends ConnectorAuth = ConnectorAuth> = Conne
612
647
  type UpdateConnectorRequest<TAuth extends ConnectorAuth = ConnectorAuth> = ConnectorConfigBase<TAuth> & {
613
648
  id: string;
614
649
  };
615
- interface ConnectorCatalogServer<TTool extends ToolBase = ToolBase, TAuthWrite extends ConnectorAuth = ConnectorAuth, TAuthPublic extends ConnectorAuthPublic = ConnectorAuthPublic, TConnector extends ConnectorBase<TTool, TAuthPublic> = ConnectorBase<TTool, TAuthPublic>, TCatalogEntry extends ConnectorCatalogEntry<TAuthPublic> = ConnectorCatalogEntry<TAuthPublic>, TCreate extends CreateConnectorRequest<TAuthWrite> = CreateConnectorRequest<TAuthWrite>, TUpdate extends UpdateConnectorRequest<TAuthWrite> = UpdateConnectorRequest<TAuthWrite>> {
650
+ interface AuthenticateConnectorRequest {
651
+ id: string;
652
+ /** OAuth callback page owned by the host application. */
653
+ redirectURL?: string;
654
+ }
655
+ interface ConnectorAuthenticationResult<TConnector extends ConnectorBase = ConnectorBase> {
656
+ connector?: TConnector;
657
+ status?: string;
658
+ authorization_endpoint?: string | undefined;
659
+ }
660
+ interface ConnectorCatalogServer<TTool extends ToolBase = ToolBase, TAuthWrite extends ConnectorAuth = ConnectorAuth, TAuthPublic extends ConnectorAuthPublic = ConnectorAuthPublic, TConnector extends ConnectorBase<TAuthPublic> = ConnectorBase<TAuthPublic>, TCatalogEntry extends ConnectorCatalogEntry<TAuthPublic> = ConnectorCatalogEntry<TAuthPublic>, TCreate extends CreateConnectorRequest<TAuthWrite> = CreateConnectorRequest<TAuthWrite>, TUpdate extends UpdateConnectorRequest<TAuthWrite> = UpdateConnectorRequest<TAuthWrite>> {
616
661
  getConnectorCatalog(): Promise<TCatalogEntry[]>;
662
+ getConnector(req: {
663
+ id: string;
664
+ }): Promise<TConnector>;
617
665
  listConnectors(req?: {
618
666
  query?: string;
619
667
  }): Promise<TConnector[]>;
668
+ getToolsByConnectorId(req: {
669
+ id: string;
670
+ }): Promise<TTool[]>;
620
671
  createConnector(req: TCreate): Promise<TConnector>;
621
672
  /** Full replace update keyed by connector `id`. */
622
673
  updateConnector(req: TUpdate): Promise<TConnector>;
623
674
  /**
624
675
  * Start connector auth (e.g. OAuth).
625
- * For oauth, the returned connector's `auth.authUrl` is the authorize URL.
676
+ * May return a connector (already authenticated / with `auth.authUrl`) or a
677
+ * result carrying `authorization_endpoint` for the popup flow.
626
678
  */
627
- authenticateConnector(req: {
628
- id: string;
629
- }): Promise<TConnector>;
679
+ authenticateConnector(req: AuthenticateConnectorRequest): Promise<TConnector | ConnectorAuthenticationResult<TConnector>>;
630
680
  /** Clear connector auth. */
631
681
  disconnectConnector(req: {
632
682
  id: string;
@@ -679,7 +729,7 @@ interface SkillCatalogServer<TSkill extends SkillBase = SkillBase, TCatalogEntry
679
729
  id: string;
680
730
  }): Promise<void>;
681
731
  }
682
- /** Mutable sandbox settings shared by catalog rows, create, and update. */
732
+ /** Mutable sandbox provider settings shared by catalog rows, create, and update. */
683
733
  interface SandboxConfig {
684
734
  snapshotName: string;
685
735
  execTimeoutMs: number;
@@ -692,14 +742,18 @@ interface SandboxCatalogEntry extends SandboxConfig {
692
742
  name: string;
693
743
  type: string;
694
744
  }
695
- interface SandboxBase {
745
+ /**
746
+ * Connected sandbox provider row (settings/sandboxes). No raw `apiKey`.
747
+ * Includes last-saved config so update forms can show previous values.
748
+ */
749
+ interface SandboxBase extends SandboxConfig {
696
750
  id: string;
697
751
  name: string;
698
752
  catalogId: string;
699
753
  isConnected: boolean;
700
754
  }
701
755
  interface CreateSandboxRequest extends SandboxConfig {
702
- /** `SandboxCatalogEntry.id` used to create this sandbox. */
756
+ /** `SandboxCatalogEntry.id` used to create this sandbox provider. */
703
757
  catalogId: string;
704
758
  name: string;
705
759
  type: string;
@@ -707,24 +761,37 @@ interface CreateSandboxRequest extends SandboxConfig {
707
761
  }
708
762
  interface UpdateSandboxRequest extends SandboxConfig {
709
763
  id: string;
710
- apiKey: string;
764
+ /** Omit to keep the existing key; send a value to rotate. */
765
+ apiKey?: string;
711
766
  }
712
- interface SandboxCatalogServer<TSandbox extends SandboxBase = SandboxBase, TCatalogEntry extends SandboxCatalogEntry = SandboxCatalogEntry, TCreate extends CreateSandboxRequest = CreateSandboxRequest, TUpdate extends UpdateSandboxRequest = UpdateSandboxRequest> {
713
- getSandboxCatalog(): Promise<TCatalogEntry[]>;
714
- listSandboxes(req?: {
767
+ /** Host-facing aliases (trueforge-ui public names). */
768
+ type SandboxProviderConfig = SandboxConfig;
769
+ type SandboxProviderCatalogEntry = SandboxCatalogEntry;
770
+ type SandboxProviderBase = SandboxBase;
771
+ type CreateSandboxProviderRequest = CreateSandboxRequest;
772
+ type UpdateSandboxProviderRequest = UpdateSandboxRequest;
773
+ interface SandboxCatalogServer<TProvider extends SandboxBase = SandboxBase, TCatalogEntry extends SandboxCatalogEntry = SandboxCatalogEntry, TCreate extends CreateSandboxRequest = CreateSandboxRequest, TUpdate extends UpdateSandboxRequest = UpdateSandboxRequest> {
774
+ getSandboxProviderCatalog(): Promise<TCatalogEntry[]>;
775
+ listSandboxProviders(req?: {
715
776
  query?: string;
716
- }): Promise<TSandbox[]>;
717
- createSandbox(req: TCreate): Promise<TSandbox>;
718
- updateSandbox(req: TUpdate): Promise<TSandbox>;
719
- deleteSandbox(req: {
777
+ }): Promise<TProvider[]>;
778
+ createSandboxProvider(req: TCreate): Promise<TProvider>;
779
+ updateSandboxProvider(req: TUpdate): Promise<TProvider>;
780
+ deleteSandboxProvider?(req: {
720
781
  id: string;
721
782
  }): Promise<void>;
722
783
  }
784
+ /** Host-facing selector / compose aliases (trueforge-ui public names). */
785
+ type ModelSelection = ModelSelectorEntry;
786
+ type AgentSkill = SkillSelectorEntry;
787
+ type ConnectorState = ConnectorSelectorEntry;
788
+ type AgentLibraryEntry = AgentSelectorEntry;
789
+ type SearchAgentsParams = SearchAgentSelectorParams;
723
790
  /**
724
- * Settings management aggregate — modelCatalog + connectorCatalog + optional
725
- * skill and sandbox catalogs.
726
- * Hosts may pass the whole object to an app shell, or a focused sub-port to a page.
727
- */
791
+ * Settings management aggregate — modelCatalog + connectorCatalog + optional
792
+ * skill and sandbox catalogs.
793
+ * Hosts may pass the whole object to an app shell, or a focused sub-port to a page.
794
+ */
728
795
  interface CatalogServer<TModelCatalog extends ModelCatalogServer = ModelCatalogServer, TConnectorCatalog extends ConnectorCatalogServer = ConnectorCatalogServer, TSkillCatalog extends SkillCatalogServer = SkillCatalogServer, TSandboxCatalog extends SandboxCatalogServer = SandboxCatalogServer> {
729
796
  modelCatalog: TModelCatalog;
730
797
  connectorCatalog: TConnectorCatalog;
@@ -735,15 +802,17 @@ interface CatalogServer<TModelCatalog extends ModelCatalogServer = ModelCatalogS
735
802
  }
736
803
  /**
737
804
  * Composed host port: chat + builder + optional settings catalog.
738
- * Agent-ui's `AgentUIServer` mirrors this shape; named differently here to
739
- * avoid colliding with that package's local type name.
740
805
  *
741
806
  * `catalog` is optional — if the host passes it, settings UI can call
742
807
  * `useCatalogServer()` / show modelCatalog, connectorCatalog, and skillCatalog;
743
808
  * if omitted, those surfaces stay hidden.
809
+ *
810
+ * trueforge-ui re-exports this as `AgentUIServer`.
744
811
  */
745
812
  type AgentUIServerPort<TChat extends AgentChatServer = AgentChatServer, TBuilder extends AgentBuilderServer = AgentBuilderServer, TCatalog extends CatalogServer = CatalogServer> = TChat & TBuilder & {
746
813
  catalog?: TCatalog;
747
814
  };
815
+ /** Host-facing alias used by trueforge-ui. */
816
+ type AgentUIServer = AgentUIServerPort;
748
817
 
749
- export type { SkillBase as $, AgentSpec as A, ListSessionsParams as B, CatalogServer as C, DefinedSkill as D, ModelCatalogServer as E, ModelEntry as F, GithubSkill as G, ModelMessageEvent as H, ImportGithubSkillRequest as I, ModelProviderBase as J, ModelProviderCatalogEntry as K, ListResult as L, McpAuthRequiredEvent as M, ModelProviderConfigBase as N, ProviderType as O, PreviousTurnIdInput as P, SandboxBase as Q, RegistrySkill as R, Session as S, TurnEvent as T, UserToolResponseEvent as U, SandboxCatalogEntry as V, SandboxCatalogServer as W, SandboxConfig as X, SandboxCreatedEvent as Y, SelectRegistrySkillRequest as Z, SessionEventItem as _, AgentChatServer as a, SkillCatalogEntry as a0, SkillCatalogServer as a1, SkillConfigBase as a2, ToolApprovalRequiredEvent as a3, ToolBase as a4, ToolCall as a5, ToolResponseRequiredEvent as a6, TurnState as a7, TurnStateDone as a8, TurnStreamData as a9, SkillMount as aA, ThreadDoneEvent as aB, ToolCallFunction as aC, ToolCallRef as aD, ToolInfo as aE, ToolResponseEvent as aF, TurnCreatedEvent as aG, TurnDoneEvent as aH, TurnStateCancelled as aI, TurnStateError as aJ, TurnStateRunning as aK, UserMessageContent as aL, TurnStreamingEvent as aa, UpdateConnectorRequest as ab, UpdateModelProviderRequest as ac, UpdateSandboxRequest as ad, UpdateSessionRequest as ae, UserMessage as af, AgentSelectorEntry as ag, ConnectorSelectorEntry as ah, ModelSelectorEntry as ai, SkillSelectorEntry as aj, DeltaEvents as ak, ActionRequiredEvent as al, AgentInfo as am, AgentParent as an, ApprovalDecision as ao, ChunkDeltaToolCall as ap, ListSessionsOrder as aq, McpInitializeEvent as ar, McpServerAuthInfo as as, McpServerMount as at, Model as au, ModelMessageContentPart as av, ModelMessageDeltaEvent as aw, ModelParams as ax, PageParams as ay, SearchAgentSelectorParams as az, ThreadCreatedEvent as b, UserToolApprovalEvent as c, Turn as d, TurnInputItem as e, AgentBuilderServer as f, AgentUIServerPort as g, ConnectorAuth as h, ConnectorAuthApiKey as i, ConnectorAuthNone as j, ConnectorAuthOAuth as k, ConnectorAuthPublic as l, ConnectorAuthPublicApiKey as m, ConnectorAuthPublicNone as n, ConnectorAuthPublicOAuth as o, ConnectorAuthType as p, ConnectorBase as q, ConnectorCatalogEntry as r, ConnectorCatalogServer as s, ConnectorConfigBase as t, CreateConnectorRequest as u, CreateModelProviderRequest as v, CreateSandboxRequest as w, CreateSessionRequest as x, CreateSkillRequest as y, CreateSkillRequestBase as z };
818
+ export type { ModelMessageEvent as $, AgentSpec as A, ConnectorCatalogServer as B, CatalogServer as C, ConnectorConfigBase as D, ConnectorSelectorEntry as E, ConnectorState as F, CreateConnectorRequest as G, CreateModelProviderRequest as H, CreateSandboxProviderRequest as I, CreateSandboxRequest as J, CreateSessionRequest as K, CreateSkillRequest as L, McpAuthRequiredEvent as M, CreateSkillRequestBase as N, DefinedSkill as O, GithubSkill as P, ImportGithubSkillRequest as Q, ListResult as R, Session as S, TurnEvent as T, UserToolResponseEvent as U, ListSessionsOrder as V, ListSessionsParams as W, McpServerMount as X, Model as Y, ModelCatalogServer as Z, ModelEntry as _, AgentChatServer as a, TurnStateRunning as a$, ModelParams as a0, ModelProperties as a1, ModelProviderBase as a2, ModelProviderCatalogEntry as a3, ModelProviderConfigBase as a4, ModelSelection as a5, ModelSelectorEntry as a6, PageParams as a7, PreviousTurnIdInput as a8, ProviderEntry as a9, TurnStateDone as aA, TurnStreamData as aB, TurnStreamingEvent as aC, UpdateConnectorRequest as aD, UpdateModelProviderRequest as aE, UpdateSandboxProviderRequest as aF, UpdateSandboxRequest as aG, UpdateSessionRequest as aH, UserMessage as aI, DeltaEvents as aJ, ActionRequiredEvent as aK, AgentInfo as aL, AgentParent as aM, ChunkDeltaToolCall as aN, McpInitializeEvent as aO, McpServerAuthInfo as aP, ModelMessageContentPart as aQ, ModelMessageDeltaEvent as aR, ThreadDoneEvent as aS, ToolCallFunction as aT, ToolCallRef as aU, ToolInfo as aV, ToolResponseEvent as aW, TurnCreatedEvent as aX, TurnDoneEvent as aY, TurnStateCancelled as aZ, TurnStateError as a_, ProviderType as aa, RegistrySkill as ab, SandboxBase as ac, SandboxCatalogEntry as ad, SandboxCatalogServer as ae, SandboxConfig as af, SandboxCreatedEvent as ag, SandboxProviderBase as ah, SandboxProviderCatalogEntry as ai, SandboxProviderConfig as aj, SaveAgentRequest as ak, SearchAgentSelectorParams as al, SearchAgentsParams as am, SelectRegistrySkillRequest as an, SessionEventItem as ao, SkillBase as ap, SkillCatalogEntry as aq, SkillCatalogServer as ar, SkillConfigBase as as, SkillMount as at, SkillSelectorEntry as au, ToolApprovalRequiredEvent as av, ToolBase as aw, ToolCall as ax, ToolResponseRequiredEvent as ay, TurnState as az, ThreadCreatedEvent as b, UserMessageContent as b0, UserToolApprovalEvent as c, Turn as d, TurnInputItem as e, AgentBuilderCapabilitiesResponse as f, AgentBuilderServer as g, AgentLibraryEntry as h, AgentSelectorEntry as i, AgentSkill as j, AgentUIServer as k, AgentUIServerPort as l, ApprovalDecision as m, AuthenticateConnectorRequest as n, ConnectorAuth as o, ConnectorAuthApiKey as p, ConnectorAuthNone as q, ConnectorAuthOAuth as r, ConnectorAuthPublic as s, ConnectorAuthPublicApiKey as t, ConnectorAuthPublicNone as u, ConnectorAuthPublicOAuth as v, ConnectorAuthType as w, ConnectorAuthenticationResult as x, ConnectorBase as y, ConnectorCatalogEntry as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truefoundry/assistant-ui-runtime",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "TrueFoundry Gateway agent runtime adapter for assistant-ui",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -472,6 +472,7 @@ describe("convertTurnMessages", () => {
472
472
  it("advances the turn id when a continuation reuses the existing message", () => {
473
473
  const existing = turnStreamUpdateToAssistantMessage("turn-1", {
474
474
  content: [{ type: "text", text: "first" }],
475
+ metadata: { custom: { sandboxId: "sbx-123" } },
475
476
  });
476
477
  const updated = turnStreamUpdateToAssistantMessage(
477
478
  "turn-2",
@@ -480,6 +481,7 @@ describe("convertTurnMessages", () => {
480
481
  );
481
482
  expect(updated.id).toBe("turn-1-assistant");
482
483
  expect(updated.metadata.custom.turnId).toBe("turn-2");
484
+ expect(updated.metadata.custom.sandboxId).toBe("sbx-123");
483
485
  });
484
486
  });
485
487
 
@@ -625,6 +627,127 @@ describe("convertTurnMessages", () => {
625
627
  expect(assistant.metadata.custom.turnId).toBe("turn-2");
626
628
  });
627
629
 
630
+ it("keeps the sandboxId when an ask-user continuation is merged", async () => {
631
+ const firstTurn = mockTurn({
632
+ id: "turn-1",
633
+ createdAt,
634
+ input: [{ type: "user.message", content: "create a file" }],
635
+ events: [
636
+ sandboxCreated({ id: "sandbox-evt", sandboxId: "sbx-123" }),
637
+ modelMessage({
638
+ id: "m1",
639
+ threadId: ROOT_THREAD_ID,
640
+ content: "Which format?",
641
+ }),
642
+ ],
643
+ });
644
+ const continuationTurn = mockTurn({
645
+ id: "turn-2",
646
+ createdAt,
647
+ input: [
648
+ {
649
+ type: "user.tool_response",
650
+ threadId: ROOT_THREAD_ID,
651
+ toolCallId: "ask-1",
652
+ content: "Markdown",
653
+ },
654
+ ],
655
+ events: [
656
+ modelMessage({
657
+ id: "m2",
658
+ threadId: ROOT_THREAD_ID,
659
+ content: "Done",
660
+ }),
661
+ ],
662
+ });
663
+
664
+ const result = await convertTurnsToThreadMessages(
665
+ mockServerWithTurns([continuationTurn, firstTurn]),
666
+ SESSION_ID,
667
+ );
668
+
669
+ expect(result.messages[1]).toMatchObject({
670
+ role: "assistant",
671
+ metadata: {
672
+ custom: {
673
+ sandboxId: "sbx-123",
674
+ turnId: "turn-2",
675
+ },
676
+ },
677
+ });
678
+ });
679
+
680
+ it("clears pendingMcpAuth when an MCP auth continuation is merged", async () => {
681
+ const mcpServers = [
682
+ {
683
+ id: "github-auth",
684
+ name: "github",
685
+ authUrl: "https://example.com/auth",
686
+ },
687
+ ];
688
+ const pausedTurn = mockTurn({
689
+ id: "turn-1",
690
+ createdAt,
691
+ input: [{ type: "user.message", content: "use github" }],
692
+ state: {
693
+ status: "done",
694
+ output: undefined,
695
+ requiredActions: [
696
+ {
697
+ type: "mcp.auth_required",
698
+ id: "mcp-auth",
699
+ createdAt,
700
+ mcpServers,
701
+ },
702
+ ] as never,
703
+ completedAt: createdAt,
704
+ },
705
+ events: [
706
+ sandboxCreated({ id: "sandbox-evt", sandboxId: "sbx-123" }),
707
+ modelMessage({
708
+ id: "m1",
709
+ threadId: ROOT_THREAD_ID,
710
+ content: "Need auth",
711
+ }),
712
+ {
713
+ type: "mcp.auth_required",
714
+ id: "mcp-auth",
715
+ createdAt,
716
+ mcpServers,
717
+ },
718
+ ],
719
+ });
720
+ const continuationTurn = mockTurn({
721
+ id: "turn-2",
722
+ createdAt,
723
+ input: [],
724
+ events: [
725
+ modelMessage({
726
+ id: "m2",
727
+ threadId: ROOT_THREAD_ID,
728
+ content: "Authorized",
729
+ }),
730
+ ],
731
+ });
732
+
733
+ const result = await convertTurnsToThreadMessages(
734
+ mockServerWithTurns([continuationTurn, pausedTurn]),
735
+ SESSION_ID,
736
+ );
737
+
738
+ const assistant = result.messages[1];
739
+ expect(assistant?.role).toBe("assistant");
740
+ if (assistant?.role !== "assistant") {
741
+ return;
742
+ }
743
+ expect(assistant.status).toEqual({ type: "complete", reason: "stop" });
744
+ expect(assistant.metadata.custom).toEqual({
745
+ sandboxId: "sbx-123",
746
+ turnId: "turn-2",
747
+ });
748
+ expect(assistant.metadata.custom.pendingMcpAuth).toBeUndefined();
749
+ });
750
+
628
751
  it("preserves requires-action on reload when a turn ends awaiting tool approval", async () => {
629
752
  const pausedTurn = mockTurn({
630
753
  id: "turn-approval",