@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.
- package/CHANGELOG.md +31 -0
- package/README.md +19 -15
- package/dist/chunk-CXBZ6WLZ.js +636 -0
- package/dist/chunk-CXBZ6WLZ.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/plugins/truefoundry-agent-server-adapter/index.d.ts +81 -35
- package/dist/plugins/truefoundry-agent-server-adapter/index.js +3 -1
- package/dist/server/index.d.ts +2 -2
- package/dist/{types-DbNsU075.d.ts → types-6yWuWHzK.d.ts} +109 -28
- package/package.json +1 -1
- package/src/convertTurnMessages.ts +4 -0
- package/src/draft/truefoundryDraftThreadListAdapter.ts +4 -1
- package/src/harness.temp.ts +85 -0
- package/src/index.ts +27 -0
- package/src/plugins/truefoundry-agent-server-adapter/README.md +83 -44
- package/src/plugins/truefoundry-agent-server-adapter/chatServer.ts +365 -0
- package/src/plugins/truefoundry-agent-server-adapter/cp.test.ts +444 -0
- package/src/plugins/truefoundry-agent-server-adapter/cp.ts +482 -0
- package/src/plugins/truefoundry-agent-server-adapter/createTrueFoundryAgentUIServer.ts +94 -0
- package/src/plugins/truefoundry-agent-server-adapter/guards.ts +1 -1
- package/src/plugins/truefoundry-agent-server-adapter/index.ts +20 -391
- package/src/plugins/truefoundry-agent-server-adapter/normalizeAgentSpec.test.ts +85 -0
- package/src/plugins/truefoundry-agent-server-adapter/normalizeAgentSpec.ts +84 -0
- package/src/plugins/truefoundry-agent-server-adapter/types.ts +1 -1
- package/src/server/index.ts +20 -0
- package/src/server/types.ts +125 -28
- package/src/streamTurn.test.ts +27 -27
- package/src/streamTurn.ts +2 -2
- package/src/truefoundryOwnedSessionsThreadListAdapter.ts +4 -1
- package/src/truefoundryThreadListAdapter.test.ts +22 -0
- package/src/truefoundryThreadListAdapter.ts +4 -1
- package/src/useTrueFoundryAgentMessages.test.tsx +1 -1
- package/dist/chunk-SQDOTGP2.js +0 -292
- package/dist/chunk-SQDOTGP2.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentSessionClient } from 'truefoundry-gateway-sdk/agents';
|
|
2
2
|
import { PrivateAgentSessionClient } from 'truefoundry-gateway-sdk/agents/private';
|
|
3
|
-
import { A as AgentSpec,
|
|
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-6yWuWHzK.js';
|
|
4
4
|
import { TruefoundryGatewayApi } from 'truefoundry-gateway-sdk';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -77,11 +77,89 @@ type TfyFinishReason = TruefoundryGatewayApi.FinishReason;
|
|
|
77
77
|
type TfyThreadState = TruefoundryGatewayApi.ThreadState;
|
|
78
78
|
type TfyMcpServerInitInfo = TruefoundryGatewayApi.McpServerInitInfo;
|
|
79
79
|
|
|
80
|
+
type CreateTrueFoundryChatServerOptions = {
|
|
81
|
+
apiKey: string;
|
|
82
|
+
baseUrl: string;
|
|
83
|
+
/** Optional override — otherwise constructed from apiKey/baseUrl. */
|
|
84
|
+
client?: AgentSessionClient;
|
|
85
|
+
privateClient?: PrivateAgentSessionClient;
|
|
86
|
+
deleteSession?: (req: {
|
|
87
|
+
sessionId: string;
|
|
88
|
+
}) => Promise<void>;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Only the spec is generic. Session/Turn/list-params are the concrete Tfy*
|
|
92
|
+
* types because the adapter builds them as fixed object literals — a generic
|
|
93
|
+
* there would type fields that nothing ever populates. The spec is safe: the
|
|
94
|
+
* gateway SDK serializes with `unrecognizedObjectKeys: "passthrough"`, so
|
|
95
|
+
* host-added spec fields survive the round trip.
|
|
96
|
+
*/
|
|
97
|
+
type TrueFoundryChatServer<TSpec extends TfyAgentSpec = TfyAgentSpec> = AgentChatServer<TSpec, TfySession<TSpec>, TfyCreateSessionRequest<TSpec>, TfyListSessionsParams, UpdateSessionRequest<TSpec>, TfyTurn> & {
|
|
98
|
+
/** Escape hatch for hosts that still need raw gateway clients. */
|
|
99
|
+
getGatewayClients(): {
|
|
100
|
+
client: AgentSessionClient;
|
|
101
|
+
privateClient: PrivateAgentSessionClient;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Wraps TrueFoundry gateway clients into a flat `AgentChatServer`.
|
|
106
|
+
* Named vs draft routing is fully internal — an in-memory session-type cache
|
|
107
|
+
* (populated by createSession/listSessions) determines which gateway client
|
|
108
|
+
* to call, falling back to a one-time probe for ids seen only in a URL.
|
|
109
|
+
*/
|
|
110
|
+
declare function createTrueFoundryChatServer<TSpec extends TfyAgentSpec = TfyAgentSpec>(opts: CreateTrueFoundryChatServerOptions): TrueFoundryChatServer<TSpec>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Control Plane HTTP for builder catalog lists + gateway URL resolution.
|
|
114
|
+
*
|
|
115
|
+
* Wire shapes are host/CP contracts (not Fern / gateway SDK). Paths match
|
|
116
|
+
* ai.tf cpApi usage — expect drift; keep normalizers defensive.
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
interface TfyModelSelectorEntry extends ModelSelectorEntry {
|
|
120
|
+
/** Write into AgentSpec.model.name (model_fqn). */
|
|
121
|
+
apiModel: string;
|
|
122
|
+
modelId: string;
|
|
123
|
+
providerAccount?: string;
|
|
124
|
+
id?: string;
|
|
125
|
+
}
|
|
126
|
+
interface TfySkillSelectorEntry extends SkillSelectorEntry {
|
|
127
|
+
/** Version FQN — mount as RegisteredSkillMount.fqn. */
|
|
128
|
+
fqn: string;
|
|
129
|
+
}
|
|
130
|
+
interface TfyConnectorSelectorEntry extends ConnectorSelectorEntry {
|
|
131
|
+
/** Mount as RegisteredMcpServer.name. */
|
|
132
|
+
mcpName: string;
|
|
133
|
+
serverId?: string | null;
|
|
134
|
+
authenticated?: boolean;
|
|
135
|
+
}
|
|
136
|
+
type TfyAgentSelectorEntry = AgentSelectorEntry;
|
|
137
|
+
|
|
138
|
+
type CreateTrueFoundryAgentUIServerOptions = {
|
|
139
|
+
apiKey: string;
|
|
140
|
+
/** Control Plane base URL (builder lists + optional /session for gateway resolve). */
|
|
141
|
+
cpURL: string;
|
|
142
|
+
/**
|
|
143
|
+
* Gateway base URL. When omitted, resolved via
|
|
144
|
+
* `GET {cpURL}/api/svc/v1/session` → `{cpURL}{env.LLM_GATEWAY_URL ?? "/api/llm"}/{tenantName}`.
|
|
145
|
+
* Session failure throws (no silent public-gateway fallback).
|
|
146
|
+
*/
|
|
147
|
+
gatewayURL?: string;
|
|
148
|
+
};
|
|
149
|
+
type TrueFoundryAgentUIServer<TSpec extends TfyAgentSpec = TfyAgentSpec> = TrueFoundryChatServer<TSpec> & AgentBuilderServer<TSpec, TfyModelSelectorEntry, TfySkillSelectorEntry, TfyConnectorSelectorEntry, TfyAgentSelectorEntry, unknown>;
|
|
150
|
+
/**
|
|
151
|
+
* Full pack: gateway chat + Control Plane builder lists.
|
|
152
|
+
*
|
|
153
|
+
* Same `apiKey` bearer is used for CP and gateway. Concurrent calls with the
|
|
154
|
+
* same credentials share one in-flight promise (React Strict Mode safe).
|
|
155
|
+
*/
|
|
156
|
+
declare function createTrueFoundryAgentUIServer<TSpec extends TfyAgentSpec = TfyAgentSpec>(opts: CreateTrueFoundryAgentUIServerOptions): Promise<TrueFoundryAgentUIServer<TSpec>>;
|
|
157
|
+
|
|
80
158
|
/**
|
|
81
159
|
* Point-of-use narrowing for the event half of the gateway protocol.
|
|
82
160
|
*
|
|
83
161
|
* `AgentChatServer` hardcodes the runtime's event types on listEvents,
|
|
84
|
-
* listTurnEvents, subscribeToTurn and
|
|
162
|
+
* listTurnEvents, subscribeToTurn and createTurn — there is no
|
|
85
163
|
* generic to override them from here. So instead of typing those channels,
|
|
86
164
|
* hosts call these guards on the values they receive.
|
|
87
165
|
*
|
|
@@ -124,36 +202,4 @@ declare function getTfyMcpInitServers(event: {
|
|
|
124
202
|
mcpServers?: unknown;
|
|
125
203
|
} | null | undefined): TfyMcpServerInitInfo[] | undefined;
|
|
126
204
|
|
|
127
|
-
type CreateTrueFoundryChatServerOptions
|
|
128
|
-
apiKey: string;
|
|
129
|
-
baseUrl: string;
|
|
130
|
-
/** Optional override — otherwise constructed from apiKey/baseUrl. */
|
|
131
|
-
client?: AgentSessionClient;
|
|
132
|
-
privateClient?: PrivateAgentSessionClient;
|
|
133
|
-
deleteSession?: (req: {
|
|
134
|
-
sessionId: string;
|
|
135
|
-
}) => Promise<void>;
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* Only the spec is generic. Session/Turn/list-params are the concrete Tfy*
|
|
139
|
-
* types because the adapter builds them as fixed object literals — a generic
|
|
140
|
-
* there would type fields that nothing ever populates. The spec is safe: the
|
|
141
|
-
* gateway SDK serializes with `unrecognizedObjectKeys: "passthrough"`, so
|
|
142
|
-
* host-added spec fields survive the round trip.
|
|
143
|
-
*/
|
|
144
|
-
type TrueFoundryChatServer<TSpec extends TfyAgentSpec = TfyAgentSpec> = AgentChatServer<TSpec, TfySession<TSpec>, TfyCreateSessionRequest<TSpec>, TfyListSessionsParams, UpdateSessionRequest<TSpec>, TfyTurn> & {
|
|
145
|
-
/** Escape hatch for hosts that still need raw gateway clients. */
|
|
146
|
-
getGatewayClients(): {
|
|
147
|
-
client: AgentSessionClient;
|
|
148
|
-
privateClient: PrivateAgentSessionClient;
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Wraps TrueFoundry gateway clients into a flat `AgentChatServer`.
|
|
153
|
-
* Named vs draft routing is fully internal — an in-memory session-type cache
|
|
154
|
-
* (populated by createSession/listSessions) determines which gateway client
|
|
155
|
-
* to call, falling back to a one-time probe for ids seen only in a URL.
|
|
156
|
-
*/
|
|
157
|
-
declare function createTrueFoundryChatServer<TSpec extends TfyAgentSpec = TfyAgentSpec>(opts: CreateTrueFoundryChatServerOptions): TrueFoundryChatServer<TSpec>;
|
|
158
|
-
|
|
159
|
-
export { type CreateTrueFoundryChatServerOptions, type RequireApprovalToolSelectorItem, type RequireApprovalToolsSelectorTag, type TfyAgentSpec, type TfyCreateSessionRequest, type TfyFinishReason, type TfyListSessionsParams, type TfyMcpServerInitInfo, type TfyMcpServerMount, type TfyMcpToolInfo, type TfyModelMessageUsage, type TfyModelParams, type TfyResponseFormat, type TfyRuntimeConfig, type TfySession, type TfySkillMount, type TfySubject, type TfySystemToolInfo, type TfyThreadState, type TfyToolInfo, type TfyTurn, type TfyTurnCancelledReason, type TfyTurnState, type TfyTurnStateDoneOutput, type ToolsSelectorItem, type ToolsSelectorTag, type TrueFoundryChatServer, createTrueFoundryChatServer, getTfyMcpInitServers, getTfyThreadState, getTfyUsage, isTfyMcpToolInfo, isTfySystemToolInfo, isTfyToolInfo };
|
|
205
|
+
export { type CreateTrueFoundryAgentUIServerOptions, type CreateTrueFoundryChatServerOptions, type RequireApprovalToolSelectorItem, type RequireApprovalToolsSelectorTag, type TfyAgentSelectorEntry, type TfyAgentSpec, type TfyConnectorSelectorEntry, type TfyCreateSessionRequest, type TfyFinishReason, type TfyListSessionsParams, type TfyMcpServerInitInfo, type TfyMcpServerMount, type TfyMcpToolInfo, type TfyModelMessageUsage, type TfyModelParams, type TfyModelSelectorEntry, type TfyResponseFormat, type TfyRuntimeConfig, type TfySession, type TfySkillMount, type TfySkillSelectorEntry, type TfySubject, type TfySystemToolInfo, type TfyThreadState, type TfyToolInfo, type TfyTurn, type TfyTurnCancelledReason, type TfyTurnState, type TfyTurnStateDoneOutput, type ToolsSelectorItem, type ToolsSelectorTag, type TrueFoundryAgentUIServer, type TrueFoundryChatServer, createTrueFoundryAgentUIServer, createTrueFoundryChatServer, getTfyMcpInitServers, getTfyThreadState, getTfyUsage, isTfyMcpToolInfo, isTfySystemToolInfo, isTfyToolInfo };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
createTrueFoundryAgentUIServer,
|
|
2
3
|
createTrueFoundryChatServer,
|
|
3
4
|
getTfyMcpInitServers,
|
|
4
5
|
getTfyThreadState,
|
|
@@ -6,8 +7,9 @@ import {
|
|
|
6
7
|
isTfyMcpToolInfo,
|
|
7
8
|
isTfySystemToolInfo,
|
|
8
9
|
isTfyToolInfo
|
|
9
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-CXBZ6WLZ.js";
|
|
10
11
|
export {
|
|
12
|
+
createTrueFoundryAgentUIServer,
|
|
11
13
|
createTrueFoundryChatServer,
|
|
12
14
|
getTfyMcpInitServers,
|
|
13
15
|
getTfyThreadState,
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { aa as TurnStreamingEvent, ak as DeltaEvents, T as TurnEvent } from '../types-6yWuWHzK.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-6yWuWHzK.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Local implementations of streaming delta helpers.
|
|
@@ -231,6 +231,7 @@ type DeltaEvents = ModelMessageDeltaEvent;
|
|
|
231
231
|
interface ModelSelectorEntry {
|
|
232
232
|
name: string;
|
|
233
233
|
provider: string;
|
|
234
|
+
reasoningEfforts?: string[];
|
|
234
235
|
}
|
|
235
236
|
/** Skill selector row. Host extends for fqn, preload, etc. */
|
|
236
237
|
interface SkillSelectorEntry {
|
|
@@ -398,7 +399,7 @@ interface AgentChatServer<TSpec extends AgentSpec = AgentSpec, TSession extends
|
|
|
398
399
|
sessionId: string;
|
|
399
400
|
}): Promise<TSession>;
|
|
400
401
|
updateSession(req: TUpdate): Promise<TSession>;
|
|
401
|
-
|
|
402
|
+
createTurn(req: {
|
|
402
403
|
sessionId: string;
|
|
403
404
|
input?: TurnInputItem[];
|
|
404
405
|
previousTurnId?: PreviousTurnIdInput;
|
|
@@ -532,28 +533,35 @@ interface ModelCatalogServer<TModel extends ModelEntry = ModelEntry, TProvider e
|
|
|
532
533
|
interface ToolBase {
|
|
533
534
|
id: string;
|
|
534
535
|
name: string;
|
|
536
|
+
description: string;
|
|
535
537
|
}
|
|
536
|
-
/**
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
*/
|
|
545
|
-
interface ConnectorAuth<TType extends ConnectorAuthType = ConnectorAuthType> {
|
|
546
|
-
type: TType;
|
|
538
|
+
/** Strict auth type id. Hosts widen branches via intersection + re-union. */
|
|
539
|
+
type ConnectorAuthType = "dcr" | "header" | "none";
|
|
540
|
+
type ConnectorAuthOAuth = {
|
|
541
|
+
type: "dcr";
|
|
542
|
+
authUrl?: string;
|
|
543
|
+
};
|
|
544
|
+
type ConnectorAuthApiKey = {
|
|
545
|
+
type: "header";
|
|
547
546
|
apiKey?: string;
|
|
548
547
|
headerName?: string;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
548
|
+
};
|
|
549
|
+
type ConnectorAuthNone = {
|
|
550
|
+
type: "none";
|
|
551
|
+
};
|
|
552
|
+
type ConnectorAuth = ConnectorAuthOAuth | ConnectorAuthApiKey | ConnectorAuthNone;
|
|
553
|
+
type ConnectorAuthPublicOAuth = {
|
|
554
|
+
type: "dcr";
|
|
555
|
+
authUrl: string;
|
|
556
|
+
};
|
|
557
|
+
type ConnectorAuthPublicApiKey = {
|
|
558
|
+
type: "header";
|
|
555
559
|
headerName?: string;
|
|
556
|
-
}
|
|
560
|
+
};
|
|
561
|
+
type ConnectorAuthPublicNone = {
|
|
562
|
+
type: "none";
|
|
563
|
+
};
|
|
564
|
+
type ConnectorAuthPublic = ConnectorAuthPublicOAuth | ConnectorAuthPublicApiKey | ConnectorAuthPublicNone;
|
|
557
565
|
/**
|
|
558
566
|
* MCP / connector create-edit config. Host extends for extra fields, etc.
|
|
559
567
|
*/
|
|
@@ -572,6 +580,8 @@ interface ConnectorBase<TTool extends ToolBase = ToolBase, TAuth extends Connect
|
|
|
572
580
|
description: string;
|
|
573
581
|
url: string;
|
|
574
582
|
auth: TAuth;
|
|
583
|
+
/** When true, UI should not show Disconnect. */
|
|
584
|
+
requiresAuth: boolean;
|
|
575
585
|
authenticated: boolean;
|
|
576
586
|
tools: TTool[];
|
|
577
587
|
}
|
|
@@ -597,7 +607,10 @@ interface ConnectorCatalogServer<TTool extends ToolBase = ToolBase, TAuthWrite e
|
|
|
597
607
|
createConnector(req: TCreate): Promise<TConnector>;
|
|
598
608
|
/** Full replace update keyed by connector `id`. */
|
|
599
609
|
updateConnector(req: TUpdate): Promise<TConnector>;
|
|
600
|
-
/**
|
|
610
|
+
/**
|
|
611
|
+
* Start connector auth (e.g. OAuth).
|
|
612
|
+
* For oauth, the returned connector's `auth.authUrl` is the authorize URL.
|
|
613
|
+
*/
|
|
601
614
|
authenticateConnector(req: {
|
|
602
615
|
id: string;
|
|
603
616
|
}): Promise<TConnector>;
|
|
@@ -615,12 +628,36 @@ interface SkillBase {
|
|
|
615
628
|
name: string;
|
|
616
629
|
description: string;
|
|
617
630
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
631
|
+
interface RegistrySkill extends SkillBase {
|
|
632
|
+
/** `SkillCatalogEntry.id` this skill was created from. */
|
|
633
|
+
catalogId: string;
|
|
634
|
+
}
|
|
635
|
+
interface GithubSkill extends SkillBase {
|
|
636
|
+
}
|
|
637
|
+
type DefinedSkill = RegistrySkill | GithubSkill;
|
|
638
|
+
/** Git source fields shared by catalog entries and create requests. */
|
|
639
|
+
interface SkillConfigBase {
|
|
640
|
+
name: string;
|
|
641
|
+
description: string;
|
|
642
|
+
repoURL: string;
|
|
643
|
+
path: string;
|
|
644
|
+
ref: string;
|
|
645
|
+
}
|
|
646
|
+
interface SkillCatalogEntry extends SkillConfigBase {
|
|
647
|
+
id: string;
|
|
648
|
+
}
|
|
649
|
+
/** Create-skill base. Hosts may intersect extra fields and re-union. */
|
|
650
|
+
interface CreateSkillRequestBase extends SkillConfigBase {
|
|
651
|
+
}
|
|
652
|
+
interface SelectRegistrySkillRequest extends CreateSkillRequestBase {
|
|
653
|
+
/** `SkillCatalogEntry.id`, persisted so the created skill links back to it. */
|
|
654
|
+
catalogId: string;
|
|
655
|
+
}
|
|
656
|
+
interface ImportGithubSkillRequest extends CreateSkillRequestBase {
|
|
622
657
|
}
|
|
623
|
-
|
|
658
|
+
type CreateSkillRequest = SelectRegistrySkillRequest | ImportGithubSkillRequest;
|
|
659
|
+
interface SkillCatalogServer<TSkill extends SkillBase = SkillBase, TCatalogEntry extends SkillCatalogEntry = SkillCatalogEntry, TCreate extends CreateSkillRequest = CreateSkillRequest> {
|
|
660
|
+
getSkillCatalog(): Promise<TCatalogEntry[]>;
|
|
624
661
|
listSkills(req?: {
|
|
625
662
|
query?: string;
|
|
626
663
|
}): Promise<TSkill[]>;
|
|
@@ -629,15 +666,59 @@ interface SkillCatalogServer<TSkill extends SkillBase = SkillBase, TCreate exten
|
|
|
629
666
|
id: string;
|
|
630
667
|
}): Promise<void>;
|
|
631
668
|
}
|
|
669
|
+
/** Mutable sandbox settings shared by catalog rows, create, and update. */
|
|
670
|
+
interface SandboxConfig {
|
|
671
|
+
snapshotName: string;
|
|
672
|
+
execTimeoutMs: number;
|
|
673
|
+
autoStopIntervalInMinutes: number;
|
|
674
|
+
autoArchiveIntervalInMinutes: number;
|
|
675
|
+
autoDeleteIntervalInMinutes: number;
|
|
676
|
+
}
|
|
677
|
+
interface SandboxCatalogEntry extends SandboxConfig {
|
|
678
|
+
id: string;
|
|
679
|
+
name: string;
|
|
680
|
+
type: string;
|
|
681
|
+
}
|
|
682
|
+
interface SandboxBase {
|
|
683
|
+
id: string;
|
|
684
|
+
name: string;
|
|
685
|
+
catalogId: string;
|
|
686
|
+
isConnected: boolean;
|
|
687
|
+
}
|
|
688
|
+
interface CreateSandboxRequest extends SandboxConfig {
|
|
689
|
+
/** `SandboxCatalogEntry.id` used to create this sandbox. */
|
|
690
|
+
catalogId: string;
|
|
691
|
+
name: string;
|
|
692
|
+
type: string;
|
|
693
|
+
apiKey: string;
|
|
694
|
+
}
|
|
695
|
+
interface UpdateSandboxRequest extends SandboxConfig {
|
|
696
|
+
id: string;
|
|
697
|
+
apiKey: string;
|
|
698
|
+
}
|
|
699
|
+
interface SandboxCatalogServer<TSandbox extends SandboxBase = SandboxBase, TCatalogEntry extends SandboxCatalogEntry = SandboxCatalogEntry, TCreate extends CreateSandboxRequest = CreateSandboxRequest, TUpdate extends UpdateSandboxRequest = UpdateSandboxRequest> {
|
|
700
|
+
getSandboxCatalog(): Promise<TCatalogEntry[]>;
|
|
701
|
+
listSandboxes(req?: {
|
|
702
|
+
query?: string;
|
|
703
|
+
}): Promise<TSandbox[]>;
|
|
704
|
+
createSandbox(req: TCreate): Promise<TSandbox>;
|
|
705
|
+
updateSandbox(req: TUpdate): Promise<TSandbox>;
|
|
706
|
+
deleteSandbox(req: {
|
|
707
|
+
id: string;
|
|
708
|
+
}): Promise<void>;
|
|
709
|
+
}
|
|
632
710
|
/**
|
|
633
|
-
* Settings management aggregate — modelCatalog + connectorCatalog + optional
|
|
711
|
+
* Settings management aggregate — modelCatalog + connectorCatalog + optional
|
|
712
|
+
* skill and sandbox catalogs.
|
|
634
713
|
* Hosts may pass the whole object to an app shell, or a focused sub-port to a page.
|
|
635
714
|
*/
|
|
636
|
-
interface CatalogServer<TModelCatalog extends ModelCatalogServer = ModelCatalogServer, TConnectorCatalog extends ConnectorCatalogServer = ConnectorCatalogServer, TSkillCatalog extends SkillCatalogServer = SkillCatalogServer> {
|
|
715
|
+
interface CatalogServer<TModelCatalog extends ModelCatalogServer = ModelCatalogServer, TConnectorCatalog extends ConnectorCatalogServer = ConnectorCatalogServer, TSkillCatalog extends SkillCatalogServer = SkillCatalogServer, TSandboxCatalog extends SandboxCatalogServer = SandboxCatalogServer> {
|
|
637
716
|
modelCatalog: TModelCatalog;
|
|
638
717
|
connectorCatalog: TConnectorCatalog;
|
|
639
718
|
/** Optional — omit when the host has no skills settings surface. */
|
|
640
719
|
skillCatalog?: TSkillCatalog;
|
|
720
|
+
/** Optional — omit when the host has no sandboxes settings surface. */
|
|
721
|
+
sandboxCatalog?: TSandboxCatalog;
|
|
641
722
|
}
|
|
642
723
|
/**
|
|
643
724
|
* Composed host port: chat + builder + optional settings catalog.
|
|
@@ -652,4 +733,4 @@ type AgentUIServerPort<TChat extends AgentChatServer = AgentChatServer, TBuilder
|
|
|
652
733
|
catalog?: TCatalog;
|
|
653
734
|
};
|
|
654
735
|
|
|
655
|
-
export type {
|
|
736
|
+
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 };
|
package/package.json
CHANGED
|
@@ -516,6 +516,10 @@ function attachRunningTurn(
|
|
|
516
516
|
if (runningTurn == null) {
|
|
517
517
|
return snapshot;
|
|
518
518
|
}
|
|
519
|
+
// Session-level history excludes the running turn. Apply continuation inputs
|
|
520
|
+
// from the turn listing so answered approvals / ask-user prompts are not
|
|
521
|
+
// restored as pending while reconnecting to that turn after a refresh.
|
|
522
|
+
applyUserToolResponsesToFold(snapshot.fold, runningTurn.input ?? []);
|
|
519
523
|
const pendingUserText = extractTurnUserText(runningTurn.input);
|
|
520
524
|
return replaceSessionSnapshot(snapshot, {
|
|
521
525
|
runningTurn,
|
|
@@ -61,7 +61,10 @@ export function createTrueFoundryDraftThreadListAdapter(options: {
|
|
|
61
61
|
async rename() {},
|
|
62
62
|
async archive() {},
|
|
63
63
|
async unarchive() {},
|
|
64
|
-
async delete() {
|
|
64
|
+
async delete(remoteId) {
|
|
65
|
+
if (typeof server.deleteSession !== "function") return;
|
|
66
|
+
await server.deleteSession({ sessionId: remoteId });
|
|
67
|
+
},
|
|
65
68
|
|
|
66
69
|
async generateTitle() {
|
|
67
70
|
return new ReadableStream();
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TEMP — Harness / backend wire shapes for model-provider and MCP catalogs.
|
|
3
|
+
*
|
|
4
|
+
* Not part of the published FE contract. The gateway adapter (and these types)
|
|
5
|
+
* will live outside this repo; keep this file only as a scratch reference for
|
|
6
|
+
* hosts mapping wire → FE `CatalogServer` bases in `server/types.ts`.
|
|
7
|
+
*
|
|
8
|
+
* Do not import from package public exports.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { ProviderType } from "./server/types.js";
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Models — harness wire
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
export interface HarnessModelProperties {
|
|
18
|
+
contextLength: number;
|
|
19
|
+
maxOutputTokens: number;
|
|
20
|
+
reasoningEfforts?: string[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Model row as returned/accepted by the harness model-provider APIs. */
|
|
24
|
+
export interface HarnessModelEntry {
|
|
25
|
+
modelId: string;
|
|
26
|
+
name: string;
|
|
27
|
+
properties: HarnessModelProperties;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type HarnessModelProviderAuthWrite = { apiKey: string };
|
|
31
|
+
export type HarnessModelProviderAuthRead = { apiKeySet: true };
|
|
32
|
+
|
|
33
|
+
export interface HarnessModelProviderCatalogEntry {
|
|
34
|
+
/** Builtin catalog type — never `"custom"`. */
|
|
35
|
+
type: ProviderType;
|
|
36
|
+
name: string;
|
|
37
|
+
models: HarnessModelEntry[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface HarnessModelProviderBase {
|
|
41
|
+
type: ProviderType;
|
|
42
|
+
name: string;
|
|
43
|
+
/** Present iff `type === "custom"`. */
|
|
44
|
+
baseUrl?: string;
|
|
45
|
+
models: HarnessModelEntry[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type HarnessUpdateModelProviderRequest = HarnessModelProviderBase & {
|
|
49
|
+
auth: HarnessModelProviderAuthWrite;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type HarnessModelProvider = HarnessModelProviderBase & {
|
|
53
|
+
auth: HarnessModelProviderAuthRead;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** Flat FQN read view for GET /models. */
|
|
57
|
+
export interface HarnessCatalogModel {
|
|
58
|
+
/** `${providerName}/${model.name}` */
|
|
59
|
+
name: string;
|
|
60
|
+
modelId: string;
|
|
61
|
+
properties: HarnessModelProperties;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// MCP — harness wire
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
export type HarnessMcpServerAuth = { type: "dcr" };
|
|
69
|
+
|
|
70
|
+
export interface HarnessMcpServerCatalogEntry {
|
|
71
|
+
provider: string;
|
|
72
|
+
name: string;
|
|
73
|
+
url: string;
|
|
74
|
+
auth?: HarnessMcpServerAuth;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type HarnessMcpServerAuthStatus =
|
|
78
|
+
| { status: "authenticated" }
|
|
79
|
+
| { status: "authRequired"; authorizationUrl: string };
|
|
80
|
+
|
|
81
|
+
export interface HarnessConfiguredMcpServer extends HarnessMcpServerCatalogEntry {
|
|
82
|
+
authStatus: HarnessMcpServerAuthStatus;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export type HarnessUpdateMcpServerRequest = HarnessMcpServerCatalogEntry;
|
package/src/index.ts
CHANGED
|
@@ -101,7 +101,13 @@ export type {
|
|
|
101
101
|
ModelCatalogServer,
|
|
102
102
|
ToolBase,
|
|
103
103
|
ConnectorAuthType,
|
|
104
|
+
ConnectorAuthOAuth,
|
|
105
|
+
ConnectorAuthApiKey,
|
|
106
|
+
ConnectorAuthNone,
|
|
104
107
|
ConnectorAuth,
|
|
108
|
+
ConnectorAuthPublicOAuth,
|
|
109
|
+
ConnectorAuthPublicApiKey,
|
|
110
|
+
ConnectorAuthPublicNone,
|
|
105
111
|
ConnectorAuthPublic,
|
|
106
112
|
ConnectorConfigBase,
|
|
107
113
|
ConnectorBase,
|
|
@@ -110,8 +116,22 @@ export type {
|
|
|
110
116
|
UpdateConnectorRequest,
|
|
111
117
|
ConnectorCatalogServer,
|
|
112
118
|
SkillBase,
|
|
119
|
+
RegistrySkill,
|
|
120
|
+
GithubSkill,
|
|
121
|
+
DefinedSkill,
|
|
122
|
+
SkillConfigBase,
|
|
123
|
+
SkillCatalogEntry,
|
|
124
|
+
CreateSkillRequestBase,
|
|
125
|
+
SelectRegistrySkillRequest,
|
|
126
|
+
ImportGithubSkillRequest,
|
|
113
127
|
CreateSkillRequest,
|
|
114
128
|
SkillCatalogServer,
|
|
129
|
+
SandboxConfig,
|
|
130
|
+
SandboxCatalogEntry,
|
|
131
|
+
SandboxBase,
|
|
132
|
+
CreateSandboxRequest,
|
|
133
|
+
UpdateSandboxRequest,
|
|
134
|
+
SandboxCatalogServer,
|
|
115
135
|
CatalogServer,
|
|
116
136
|
AgentUIServerPort,
|
|
117
137
|
} from "./server/index.js";
|
|
@@ -136,8 +156,15 @@ export { isEventDelta, mergeEventDelta } from "./server/index.js";
|
|
|
136
156
|
|
|
137
157
|
export {
|
|
138
158
|
createTrueFoundryChatServer,
|
|
159
|
+
createTrueFoundryAgentUIServer,
|
|
139
160
|
type CreateTrueFoundryChatServerOptions,
|
|
140
161
|
type TrueFoundryChatServer,
|
|
162
|
+
type CreateTrueFoundryAgentUIServerOptions,
|
|
163
|
+
type TrueFoundryAgentUIServer,
|
|
164
|
+
type TfyModelSelectorEntry,
|
|
165
|
+
type TfySkillSelectorEntry,
|
|
166
|
+
type TfyConnectorSelectorEntry,
|
|
167
|
+
type TfyAgentSelectorEntry,
|
|
141
168
|
type TfyAgentSpec,
|
|
142
169
|
type TfySkillMount,
|
|
143
170
|
type TfyMcpServerMount,
|