@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.
Files changed (70) hide show
  1. package/README.md +198 -401
  2. package/dist/chunk-3A2EPLQG.js +93 -0
  3. package/dist/chunk-3A2EPLQG.js.map +1 -0
  4. package/dist/chunk-Q2SHKMLM.js +270 -0
  5. package/dist/chunk-Q2SHKMLM.js.map +1 -0
  6. package/dist/index.d.ts +24 -29
  7. package/dist/index.js +264 -237
  8. package/dist/index.js.map +1 -1
  9. package/dist/plugins/truefoundry-agent-server-adapter/index.d.ts +162 -0
  10. package/dist/plugins/truefoundry-agent-server-adapter/index.js +19 -0
  11. package/dist/plugins/truefoundry-agent-server-adapter/index.js.map +1 -0
  12. package/dist/server/index.d.ts +17 -0
  13. package/dist/server/index.js +9 -0
  14. package/dist/server/index.js.map +1 -0
  15. package/dist/types-BfiFf8O1.d.ts +468 -0
  16. package/package.json +19 -6
  17. package/src/askUserQuestion.ts +3 -3
  18. package/src/buildEditedUserMessageContent.test.ts +2 -2
  19. package/src/collectPending.ts +1 -1
  20. package/src/convertTurnMessages.test.ts +141 -196
  21. package/src/convertTurnMessages.ts +130 -76
  22. package/src/createSubAgent.ts +1 -1
  23. package/src/draftAgentConfig.test.ts +26 -29
  24. package/src/extractTurnUserText.ts +1 -1
  25. package/src/foldPeerThreads.test.ts +1 -1
  26. package/src/foldPeerThreads.ts +3 -2
  27. package/src/index.ts +80 -4
  28. package/src/listPages.ts +21 -0
  29. package/src/loadSessionSnapshot.test.ts +9 -8
  30. package/src/loadSessionSnapshot.ts +9 -14
  31. package/src/mcpAuth.ts +6 -3
  32. package/src/messageCustomMetadata.ts +1 -1
  33. package/src/modelMessageContent.ts +1 -1
  34. package/src/modelMessageImageContent.test.ts +1 -1
  35. package/src/modelMessageImageContent.ts +7 -6
  36. package/src/plugins/truefoundry-agent-server-adapter/README.md +178 -0
  37. package/src/plugins/truefoundry-agent-server-adapter/guards.test.ts +113 -0
  38. package/src/plugins/truefoundry-agent-server-adapter/guards.ts +130 -0
  39. package/src/plugins/truefoundry-agent-server-adapter/index.ts +359 -0
  40. package/src/plugins/truefoundry-agent-server-adapter/types.ts +135 -0
  41. package/src/plugins/truefoundry-agent-server-adapter/types.typecheck.ts +164 -0
  42. package/src/private/agentSpec.ts +8 -3
  43. package/src/private/draftSessionBridge.ts +14 -13
  44. package/src/private/truefoundryDraftThreadListAdapter.test.ts +44 -49
  45. package/src/private/truefoundryDraftThreadListAdapter.ts +22 -16
  46. package/src/requiredActionInputs.ts +1 -1
  47. package/src/requiredActionsFromActiveUpdate.test.ts +1 -1
  48. package/src/server/eventUtils.ts +120 -0
  49. package/src/server/events.ts +246 -0
  50. package/src/server/index.ts +66 -0
  51. package/src/server/types.ts +319 -0
  52. package/src/sessionSnapshot.ts +1 -1
  53. package/src/sessions.ts +5 -21
  54. package/src/streamTurn.test.ts +172 -155
  55. package/src/streamTurn.ts +51 -48
  56. package/src/toolApproval.ts +4 -4
  57. package/src/toolResponse.ts +4 -4
  58. package/src/truefoundryExtras.ts +1 -1
  59. package/src/truefoundryOwnedSessionsThreadListAdapter.test.ts +26 -29
  60. package/src/truefoundryOwnedSessionsThreadListAdapter.ts +18 -23
  61. package/src/truefoundryThreadListAdapter.test.ts +16 -18
  62. package/src/truefoundryThreadListAdapter.ts +7 -7
  63. package/src/turnEventHelpers.ts +1 -1
  64. package/src/types.ts +2 -16
  65. package/src/useTrueFoundryAgentMessages.test.tsx +38 -70
  66. package/src/useTrueFoundryAgentMessages.ts +32 -44
  67. package/src/useTrueFoundryAgentRuntime.ts +11 -28
  68. package/src/private/bindDraftAgentSession.test.ts +0 -54
  69. package/src/private/bindDraftAgentSession.ts +0 -28
  70. 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.5",
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.5"
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.5",
79
+ "truefoundry-gateway-sdk": "0.4.0-rc.6",
67
80
  "tsup": "^8.5.0",
68
81
  "typescript": "^5.9.3",
69
- "vitest": "^4.1.9"
82
+ "vitest": "4.1.9"
70
83
  }
71
- }
84
+ }
@@ -1,11 +1,11 @@
1
- import type { ToolCall } from "truefoundry-gateway-sdk/agents";
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.type === "truefoundry-system" &&
8
- toolCall.toolInfo.name === "ask_user_question"
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 \"none\" for the first turn", () => {
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")).toBe("none");
19
+ expect(resolveBranchPreviousTurnId(turns, "a")).toBeNull();
20
20
  });
21
21
 
22
22
  it("resolveBranchPreviousTurnId returns the prior turn id", () => {
@@ -1,5 +1,5 @@
1
1
  import type { ThreadAssistantMessagePart, ThreadMessage } from "@assistant-ui/core";
2
- import type { McpAuthRequiredEvent } from "truefoundry-gateway-sdk/agents";
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";