@truefoundry/assistant-ui-runtime 0.1.5 → 0.1.6
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/README.md +198 -401
- package/dist/chunk-3A2EPLQG.js +93 -0
- package/dist/chunk-3A2EPLQG.js.map +1 -0
- package/dist/chunk-Q2SHKMLM.js +270 -0
- package/dist/chunk-Q2SHKMLM.js.map +1 -0
- package/dist/index.d.ts +24 -29
- package/dist/index.js +264 -237
- package/dist/index.js.map +1 -1
- package/dist/plugins/truefoundry-agent-server-adapter/index.d.ts +162 -0
- package/dist/plugins/truefoundry-agent-server-adapter/index.js +19 -0
- package/dist/plugins/truefoundry-agent-server-adapter/index.js.map +1 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.js +9 -0
- package/dist/server/index.js.map +1 -0
- package/dist/types-BfiFf8O1.d.ts +468 -0
- package/package.json +19 -6
- package/src/askUserQuestion.ts +3 -3
- package/src/buildEditedUserMessageContent.test.ts +2 -2
- package/src/collectPending.ts +1 -1
- package/src/convertTurnMessages.test.ts +141 -196
- package/src/convertTurnMessages.ts +130 -76
- package/src/createSubAgent.ts +1 -1
- package/src/draftAgentConfig.test.ts +26 -29
- package/src/extractTurnUserText.ts +1 -1
- package/src/foldPeerThreads.test.ts +1 -1
- package/src/foldPeerThreads.ts +3 -2
- package/src/index.ts +80 -4
- package/src/listPages.ts +21 -0
- package/src/loadSessionSnapshot.test.ts +9 -8
- package/src/loadSessionSnapshot.ts +9 -14
- package/src/mcpAuth.ts +6 -3
- package/src/messageCustomMetadata.ts +1 -1
- package/src/modelMessageContent.ts +1 -1
- package/src/modelMessageImageContent.test.ts +1 -1
- package/src/modelMessageImageContent.ts +7 -6
- package/src/plugins/truefoundry-agent-server-adapter/README.md +178 -0
- package/src/plugins/truefoundry-agent-server-adapter/guards.test.ts +113 -0
- package/src/plugins/truefoundry-agent-server-adapter/guards.ts +130 -0
- package/src/plugins/truefoundry-agent-server-adapter/index.ts +359 -0
- package/src/plugins/truefoundry-agent-server-adapter/types.ts +135 -0
- package/src/plugins/truefoundry-agent-server-adapter/types.typecheck.ts +164 -0
- package/src/private/agentSpec.ts +8 -3
- package/src/private/draftSessionBridge.ts +14 -13
- package/src/private/truefoundryDraftThreadListAdapter.test.ts +44 -49
- package/src/private/truefoundryDraftThreadListAdapter.ts +22 -16
- package/src/requiredActionInputs.ts +1 -1
- package/src/requiredActionsFromActiveUpdate.test.ts +1 -1
- package/src/server/eventUtils.ts +120 -0
- package/src/server/events.ts +246 -0
- package/src/server/index.ts +66 -0
- package/src/server/types.ts +319 -0
- package/src/sessionSnapshot.ts +1 -1
- package/src/sessions.ts +5 -21
- package/src/streamTurn.test.ts +172 -155
- package/src/streamTurn.ts +51 -48
- package/src/toolApproval.ts +4 -4
- package/src/toolResponse.ts +4 -4
- package/src/truefoundryExtras.ts +1 -1
- package/src/truefoundryOwnedSessionsThreadListAdapter.test.ts +26 -29
- package/src/truefoundryOwnedSessionsThreadListAdapter.ts +18 -23
- package/src/truefoundryThreadListAdapter.test.ts +16 -18
- package/src/truefoundryThreadListAdapter.ts +7 -7
- package/src/turnEventHelpers.ts +1 -1
- package/src/types.ts +2 -16
- package/src/useTrueFoundryAgentMessages.test.tsx +38 -70
- package/src/useTrueFoundryAgentMessages.ts +32 -44
- package/src/useTrueFoundryAgentRuntime.ts +11 -28
- package/src/private/bindDraftAgentSession.test.ts +0 -54
- package/src/private/bindDraftAgentSession.ts +0 -28
- package/src/private/getGatewayFromPrivateClient.ts +0 -13
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truefoundry/assistant-ui-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "TrueFoundry Gateway agent runtime adapter for assistant-ui",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/truefoundry/truefoundry-agents-assistant-ui-runtime"
|
|
8
|
+
"url": "git+https://github.com/truefoundry/truefoundry-agents-assistant-ui-runtime.git"
|
|
9
9
|
},
|
|
10
10
|
"homepage": "https://github.com/truefoundry/truefoundry-agents-assistant-ui-runtime#readme",
|
|
11
11
|
"keywords": [
|
|
@@ -26,6 +26,16 @@
|
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
27
|
"import": "./dist/index.js",
|
|
28
28
|
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./server": {
|
|
31
|
+
"types": "./dist/server/index.d.ts",
|
|
32
|
+
"import": "./dist/server/index.js",
|
|
33
|
+
"default": "./dist/server/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./plugins/truefoundry-agent-server-adapter": {
|
|
36
|
+
"types": "./dist/plugins/truefoundry-agent-server-adapter/index.d.ts",
|
|
37
|
+
"import": "./dist/plugins/truefoundry-agent-server-adapter/index.js",
|
|
38
|
+
"default": "./dist/plugins/truefoundry-agent-server-adapter/index.js"
|
|
29
39
|
}
|
|
30
40
|
},
|
|
31
41
|
"main": "./dist/index.js",
|
|
@@ -50,11 +60,14 @@
|
|
|
50
60
|
"peerDependencies": {
|
|
51
61
|
"@types/react": "*",
|
|
52
62
|
"react": "^18 || ^19",
|
|
53
|
-
"truefoundry-gateway-sdk": "^0.4.0-rc.
|
|
63
|
+
"truefoundry-gateway-sdk": "^0.4.0-rc.6"
|
|
54
64
|
},
|
|
55
65
|
"peerDependenciesMeta": {
|
|
56
66
|
"@types/react": {
|
|
57
67
|
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"truefoundry-gateway-sdk": {
|
|
70
|
+
"optional": true
|
|
58
71
|
}
|
|
59
72
|
},
|
|
60
73
|
"devDependencies": {
|
|
@@ -63,9 +76,9 @@
|
|
|
63
76
|
"@types/react": "^19.2.17",
|
|
64
77
|
"jsdom": "^29.1.1",
|
|
65
78
|
"react": "^19.2.4",
|
|
66
|
-
"truefoundry-gateway-sdk": "0.4.0-rc.
|
|
79
|
+
"truefoundry-gateway-sdk": "0.4.0-rc.6",
|
|
67
80
|
"tsup": "^8.5.0",
|
|
68
81
|
"typescript": "^5.9.3",
|
|
69
|
-
"vitest": "
|
|
82
|
+
"vitest": "4.1.9"
|
|
70
83
|
}
|
|
71
|
-
}
|
|
84
|
+
}
|
package/src/askUserQuestion.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ToolCall } from "
|
|
1
|
+
import type { ToolCall } from "./server/index.js";
|
|
2
2
|
|
|
3
3
|
export function isAskUserQuestionToolCall(
|
|
4
4
|
toolCall: Pick<ToolCall, "toolInfo">,
|
|
5
5
|
): boolean {
|
|
6
6
|
return (
|
|
7
|
-
toolCall.toolInfo
|
|
8
|
-
toolCall.toolInfo
|
|
7
|
+
toolCall.toolInfo?.type === "truefoundry-system" &&
|
|
8
|
+
toolCall.toolInfo?.name === "ask_user_question"
|
|
9
9
|
);
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -12,11 +12,11 @@ describe("user message branch helpers", () => {
|
|
|
12
12
|
expect(parseTurnIdFromMessageId("turn-abc-user")).toBe("turn-abc");
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
it("resolveBranchPreviousTurnId returns
|
|
15
|
+
it("resolveBranchPreviousTurnId returns null for the first turn", () => {
|
|
16
16
|
const turns: SessionTurnRecord[] = [
|
|
17
17
|
{ id: "a", createdAt: "", state: { status: "done", requiredActions: [], completedAt: "" } },
|
|
18
18
|
];
|
|
19
|
-
expect(resolveBranchPreviousTurnId(turns, "a")).
|
|
19
|
+
expect(resolveBranchPreviousTurnId(turns, "a")).toBeNull();
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
it("resolveBranchPreviousTurnId returns the prior turn id", () => {
|
package/src/collectPending.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ThreadAssistantMessagePart, ThreadMessage } from "@assistant-ui/core";
|
|
2
|
-
import type { McpAuthRequiredEvent } from "
|
|
2
|
+
import type { McpAuthRequiredEvent } from "./server/index.js";
|
|
3
3
|
|
|
4
4
|
import { ROOT_THREAD_ID } from "./constants.js";
|
|
5
5
|
import type { TrueFoundryMessageCustomMetadata } from "./messageCustomMetadata.js";
|