@tambo-ai/react 0.65.3 → 0.66.1
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 +120 -20
- package/dist/{providers/hoc → hoc}/with-tambo-interactable.d.ts +2 -2
- package/dist/hoc/with-tambo-interactable.d.ts.map +1 -0
- package/dist/{providers/hoc → hoc}/with-tambo-interactable.js +29 -2
- package/dist/hoc/with-tambo-interactable.js.map +1 -0
- package/dist/hoc/with-tambo-interactable.test.d.ts +2 -0
- package/dist/hoc/with-tambo-interactable.test.d.ts.map +1 -0
- package/dist/hoc/with-tambo-interactable.test.js +192 -0
- package/dist/hoc/with-tambo-interactable.test.js.map +1 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-current-message.d.ts +51 -7
- package/dist/hooks/use-current-message.d.ts.map +1 -1
- package/dist/hooks/use-current-message.js +50 -6
- package/dist/hooks/use-current-message.js.map +1 -1
- package/dist/hooks/use-current-message.test.d.ts +2 -0
- package/dist/hooks/use-current-message.test.d.ts.map +1 -0
- package/dist/hooks/use-current-message.test.js +264 -0
- package/dist/hooks/use-current-message.test.js.map +1 -0
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +2 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/mcp-hooks.d.ts +77 -6
- package/dist/mcp/mcp-hooks.d.ts.map +1 -1
- package/dist/mcp/mcp-hooks.js +104 -40
- package/dist/mcp/mcp-hooks.js.map +1 -1
- package/dist/mcp/mcp-hooks.test.js +83 -18
- package/dist/mcp/mcp-hooks.test.js.map +1 -1
- package/dist/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/dist/mcp/tambo-mcp-provider.js +2 -1
- package/dist/mcp/tambo-mcp-provider.js.map +1 -1
- package/dist/model/component-metadata.d.ts +444 -14
- package/dist/model/component-metadata.d.ts.map +1 -1
- package/dist/model/component-metadata.js.map +1 -1
- package/dist/model/generate-component-response.d.ts +12 -1
- package/dist/model/generate-component-response.d.ts.map +1 -1
- package/dist/model/generate-component-response.js.map +1 -1
- package/dist/model/resource-info.d.ts +55 -0
- package/dist/model/resource-info.d.ts.map +1 -0
- package/dist/model/resource-info.js +3 -0
- package/dist/model/resource-info.js.map +1 -0
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/tambo-component-provider.d.ts +4 -4
- package/dist/providers/tambo-component-provider.d.ts.map +1 -1
- package/dist/providers/tambo-component-provider.js.map +1 -1
- package/dist/providers/tambo-interactable-provider-partial-updates.test.js +87 -87
- package/dist/providers/tambo-interactable-provider-partial-updates.test.js.map +1 -1
- package/dist/providers/tambo-interactable-provider.d.ts +2 -3
- package/dist/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/dist/providers/tambo-interactable-provider.js +47 -41
- package/dist/providers/tambo-interactable-provider.js.map +1 -1
- package/dist/providers/tambo-interactables-additional-context-edge-cases.test.js +9 -9
- package/dist/providers/tambo-interactables-additional-context-edge-cases.test.js.map +1 -1
- package/dist/providers/tambo-interactables-additional-context.test.js +11 -11
- package/dist/providers/tambo-interactables-additional-context.test.js.map +1 -1
- package/dist/providers/tambo-registry-provider.d.ts +28 -7
- package/dist/providers/tambo-registry-provider.d.ts.map +1 -1
- package/dist/providers/tambo-registry-provider.js +70 -181
- package/dist/providers/tambo-registry-provider.js.map +1 -1
- package/dist/providers/tambo-registry-provider.test.js +152 -30
- package/dist/providers/tambo-registry-provider.test.js.map +1 -1
- package/dist/providers/tambo-registry-schema-compat.test.d.ts +2 -0
- package/dist/providers/tambo-registry-schema-compat.test.d.ts.map +1 -0
- package/dist/providers/tambo-registry-schema-compat.test.js +616 -0
- package/dist/providers/tambo-registry-schema-compat.test.js.map +1 -0
- package/dist/providers/tambo-stubs.d.ts +2 -2
- package/dist/providers/tambo-stubs.d.ts.map +1 -1
- package/dist/providers/tambo-stubs.js +5 -0
- package/dist/providers/tambo-stubs.js.map +1 -1
- package/dist/providers/tambo-thread-input-provider.d.ts +1 -0
- package/dist/providers/tambo-thread-input-provider.d.ts.map +1 -1
- package/dist/providers/tambo-thread-input-provider.js +3 -3
- package/dist/providers/tambo-thread-input-provider.js.map +1 -1
- package/dist/providers/tambo-thread-provider.d.ts.map +1 -1
- package/dist/providers/tambo-thread-provider.js.map +1 -1
- package/dist/providers/tambo-thread-provider.test.js +32 -36
- package/dist/providers/tambo-thread-provider.test.js.map +1 -1
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +18 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/json-schema.d.ts +35 -0
- package/dist/schema/json-schema.d.ts.map +1 -0
- package/dist/schema/json-schema.js +103 -0
- package/dist/schema/json-schema.js.map +1 -0
- package/dist/schema/schema.d.ts +66 -0
- package/dist/schema/schema.d.ts.map +1 -0
- package/dist/schema/schema.js +189 -0
- package/dist/schema/schema.js.map +1 -0
- package/dist/schema/schema.test.d.ts +2 -0
- package/dist/schema/schema.test.d.ts.map +1 -0
- package/dist/schema/schema.test.js +41 -0
- package/dist/schema/schema.test.js.map +1 -0
- package/dist/schema/standard-schema.d.ts +21 -0
- package/dist/schema/standard-schema.d.ts.map +1 -0
- package/dist/schema/standard-schema.js +37 -0
- package/dist/schema/standard-schema.js.map +1 -0
- package/dist/schema/validate.d.ts +14 -0
- package/dist/schema/validate.d.ts.map +1 -0
- package/dist/schema/validate.js +148 -0
- package/dist/schema/validate.js.map +1 -0
- package/dist/schema/validate.test.d.ts +2 -0
- package/dist/schema/validate.test.d.ts.map +1 -0
- package/dist/schema/validate.test.js +128 -0
- package/dist/schema/validate.test.js.map +1 -0
- package/dist/schema/zod.d.ts +54 -0
- package/dist/schema/zod.d.ts.map +1 -0
- package/dist/schema/zod.js +147 -0
- package/dist/schema/zod.js.map +1 -0
- package/dist/testing/tools.d.ts +29 -15
- package/dist/testing/tools.d.ts.map +1 -1
- package/dist/testing/tools.js +64 -19
- package/dist/testing/tools.js.map +1 -1
- package/dist/util/generate-component.d.ts.map +1 -1
- package/dist/util/generate-component.js +3 -3
- package/dist/util/generate-component.js.map +1 -1
- package/dist/util/mcp-server-utils.d.ts +23 -0
- package/dist/util/mcp-server-utils.d.ts.map +1 -0
- package/dist/util/mcp-server-utils.js +107 -0
- package/dist/util/mcp-server-utils.js.map +1 -0
- package/dist/util/mcp-server-utils.test.d.ts +2 -0
- package/dist/util/mcp-server-utils.test.d.ts.map +1 -0
- package/dist/util/mcp-server-utils.test.js +287 -0
- package/dist/util/mcp-server-utils.test.js.map +1 -0
- package/dist/util/message-builder.d.ts +2 -1
- package/dist/util/message-builder.d.ts.map +1 -1
- package/dist/util/message-builder.js +54 -36
- package/dist/util/message-builder.js.map +1 -1
- package/dist/util/message-builder.test.js +500 -13
- package/dist/util/message-builder.test.js.map +1 -1
- package/dist/util/registry-validators.d.ts +26 -0
- package/dist/util/registry-validators.d.ts.map +1 -0
- package/dist/util/registry-validators.js +105 -0
- package/dist/util/registry-validators.js.map +1 -0
- package/dist/util/registry-validators.test.d.ts +2 -0
- package/dist/util/registry-validators.test.d.ts.map +1 -0
- package/dist/util/registry-validators.test.js +235 -0
- package/dist/util/registry-validators.test.js.map +1 -0
- package/dist/util/registry.d.ts +35 -7
- package/dist/util/registry.d.ts.map +1 -1
- package/dist/util/registry.js +60 -77
- package/dist/util/registry.js.map +1 -1
- package/dist/util/registry.test.d.ts +2 -0
- package/dist/util/registry.test.d.ts.map +1 -0
- package/dist/util/registry.test.js +204 -0
- package/dist/util/registry.test.js.map +1 -0
- package/dist/util/resource-validators.d.ts +16 -0
- package/dist/util/resource-validators.d.ts.map +1 -0
- package/dist/util/resource-validators.js +34 -0
- package/dist/util/resource-validators.js.map +1 -0
- package/dist/util/tool-caller.d.ts +2 -2
- package/dist/util/tool-caller.d.ts.map +1 -1
- package/dist/util/tool-caller.js +12 -4
- package/dist/util/tool-caller.js.map +1 -1
- package/esm/{providers/hoc → hoc}/with-tambo-interactable.d.ts +2 -2
- package/esm/hoc/with-tambo-interactable.d.ts.map +1 -0
- package/esm/{providers/hoc → hoc}/with-tambo-interactable.js +29 -2
- package/esm/hoc/with-tambo-interactable.js.map +1 -0
- package/esm/hoc/with-tambo-interactable.test.d.ts +2 -0
- package/esm/hoc/with-tambo-interactable.test.d.ts.map +1 -0
- package/esm/hoc/with-tambo-interactable.test.js +187 -0
- package/esm/hoc/with-tambo-interactable.test.js.map +1 -0
- package/esm/hooks/index.d.ts +1 -1
- package/esm/hooks/index.d.ts.map +1 -1
- package/esm/hooks/index.js +1 -1
- package/esm/hooks/index.js.map +1 -1
- package/esm/hooks/use-current-message.d.ts +51 -7
- package/esm/hooks/use-current-message.d.ts.map +1 -1
- package/esm/hooks/use-current-message.js +48 -5
- package/esm/hooks/use-current-message.js.map +1 -1
- package/esm/hooks/use-current-message.test.d.ts +2 -0
- package/esm/hooks/use-current-message.test.d.ts.map +1 -0
- package/esm/hooks/use-current-message.test.js +259 -0
- package/esm/hooks/use-current-message.test.js.map +1 -0
- package/esm/index.d.ts +10 -8
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +4 -2
- package/esm/index.js.map +1 -1
- package/esm/mcp/index.d.ts +1 -1
- package/esm/mcp/index.d.ts.map +1 -1
- package/esm/mcp/index.js +1 -1
- package/esm/mcp/index.js.map +1 -1
- package/esm/mcp/mcp-hooks.d.ts +77 -6
- package/esm/mcp/mcp-hooks.d.ts.map +1 -1
- package/esm/mcp/mcp-hooks.js +103 -40
- package/esm/mcp/mcp-hooks.js.map +1 -1
- package/esm/mcp/mcp-hooks.test.js +84 -19
- package/esm/mcp/mcp-hooks.test.js.map +1 -1
- package/esm/mcp/tambo-mcp-provider.d.ts.map +1 -1
- package/esm/mcp/tambo-mcp-provider.js +2 -1
- package/esm/mcp/tambo-mcp-provider.js.map +1 -1
- package/esm/model/component-metadata.d.ts +444 -14
- package/esm/model/component-metadata.d.ts.map +1 -1
- package/esm/model/component-metadata.js.map +1 -1
- package/esm/model/generate-component-response.d.ts +12 -1
- package/esm/model/generate-component-response.d.ts.map +1 -1
- package/esm/model/generate-component-response.js.map +1 -1
- package/esm/model/resource-info.d.ts +55 -0
- package/esm/model/resource-info.d.ts.map +1 -0
- package/esm/model/resource-info.js +2 -0
- package/esm/model/resource-info.js.map +1 -0
- package/esm/providers/index.d.ts +1 -1
- package/esm/providers/index.d.ts.map +1 -1
- package/esm/providers/index.js.map +1 -1
- package/esm/providers/tambo-component-provider.d.ts +4 -4
- package/esm/providers/tambo-component-provider.d.ts.map +1 -1
- package/esm/providers/tambo-component-provider.js.map +1 -1
- package/esm/providers/tambo-interactable-provider-partial-updates.test.js +1 -1
- package/esm/providers/tambo-interactable-provider-partial-updates.test.js.map +1 -1
- package/esm/providers/tambo-interactable-provider.d.ts +2 -3
- package/esm/providers/tambo-interactable-provider.d.ts.map +1 -1
- package/esm/providers/tambo-interactable-provider.js +44 -38
- package/esm/providers/tambo-interactable-provider.js.map +1 -1
- package/esm/providers/tambo-interactables-additional-context-edge-cases.test.js +3 -3
- package/esm/providers/tambo-interactables-additional-context-edge-cases.test.js.map +1 -1
- package/esm/providers/tambo-interactables-additional-context.test.js +3 -3
- package/esm/providers/tambo-interactables-additional-context.test.js.map +1 -1
- package/esm/providers/tambo-registry-provider.d.ts +28 -7
- package/esm/providers/tambo-registry-provider.d.ts.map +1 -1
- package/esm/providers/tambo-registry-provider.js +67 -175
- package/esm/providers/tambo-registry-provider.js.map +1 -1
- package/esm/providers/tambo-registry-provider.test.js +148 -26
- package/esm/providers/tambo-registry-provider.test.js.map +1 -1
- package/esm/providers/tambo-registry-schema-compat.test.d.ts +2 -0
- package/esm/providers/tambo-registry-schema-compat.test.d.ts.map +1 -0
- package/esm/providers/tambo-registry-schema-compat.test.js +578 -0
- package/esm/providers/tambo-registry-schema-compat.test.js.map +1 -0
- package/esm/providers/tambo-stubs.d.ts +2 -2
- package/esm/providers/tambo-stubs.d.ts.map +1 -1
- package/esm/providers/tambo-stubs.js +5 -0
- package/esm/providers/tambo-stubs.js.map +1 -1
- package/esm/providers/tambo-thread-input-provider.d.ts +1 -0
- package/esm/providers/tambo-thread-input-provider.d.ts.map +1 -1
- package/esm/providers/tambo-thread-input-provider.js +3 -3
- package/esm/providers/tambo-thread-input-provider.js.map +1 -1
- package/esm/providers/tambo-thread-provider.d.ts.map +1 -1
- package/esm/providers/tambo-thread-provider.js.map +1 -1
- package/esm/providers/tambo-thread-provider.test.js +24 -28
- package/esm/providers/tambo-thread-provider.test.js.map +1 -1
- package/esm/schema/index.d.ts +6 -0
- package/esm/schema/index.d.ts.map +1 -0
- package/esm/schema/index.js +6 -0
- package/esm/schema/index.js.map +1 -0
- package/esm/schema/json-schema.d.ts +35 -0
- package/esm/schema/json-schema.d.ts.map +1 -0
- package/esm/schema/json-schema.js +98 -0
- package/esm/schema/json-schema.js.map +1 -0
- package/esm/schema/schema.d.ts +66 -0
- package/esm/schema/schema.d.ts.map +1 -0
- package/esm/schema/schema.js +182 -0
- package/esm/schema/schema.js.map +1 -0
- package/esm/schema/schema.test.d.ts +2 -0
- package/esm/schema/schema.test.d.ts.map +1 -0
- package/esm/schema/schema.test.js +39 -0
- package/esm/schema/schema.test.js.map +1 -0
- package/esm/schema/standard-schema.d.ts +21 -0
- package/esm/schema/standard-schema.d.ts.map +1 -0
- package/esm/schema/standard-schema.js +34 -0
- package/esm/schema/standard-schema.js.map +1 -0
- package/esm/schema/validate.d.ts +14 -0
- package/esm/schema/validate.d.ts.map +1 -0
- package/esm/schema/validate.js +145 -0
- package/esm/schema/validate.js.map +1 -0
- package/esm/schema/validate.test.d.ts +2 -0
- package/esm/schema/validate.test.d.ts.map +1 -0
- package/esm/schema/validate.test.js +126 -0
- package/esm/schema/validate.test.js.map +1 -0
- package/esm/schema/zod.d.ts +54 -0
- package/esm/schema/zod.d.ts.map +1 -0
- package/esm/schema/zod.js +136 -0
- package/esm/schema/zod.js.map +1 -0
- package/esm/testing/tools.d.ts +29 -15
- package/esm/testing/tools.d.ts.map +1 -1
- package/esm/testing/tools.js +62 -16
- package/esm/testing/tools.js.map +1 -1
- package/esm/util/generate-component.d.ts.map +1 -1
- package/esm/util/generate-component.js +3 -3
- package/esm/util/generate-component.js.map +1 -1
- package/esm/util/mcp-server-utils.d.ts +23 -0
- package/esm/util/mcp-server-utils.d.ts.map +1 -0
- package/esm/util/mcp-server-utils.js +102 -0
- package/esm/util/mcp-server-utils.js.map +1 -0
- package/esm/util/mcp-server-utils.test.d.ts +2 -0
- package/esm/util/mcp-server-utils.test.d.ts.map +1 -0
- package/esm/util/mcp-server-utils.test.js +285 -0
- package/esm/util/mcp-server-utils.test.js.map +1 -0
- package/esm/util/message-builder.d.ts +2 -1
- package/esm/util/message-builder.d.ts.map +1 -1
- package/esm/util/message-builder.js +54 -36
- package/esm/util/message-builder.js.map +1 -1
- package/esm/util/message-builder.test.js +500 -13
- package/esm/util/message-builder.test.js.map +1 -1
- package/esm/util/registry-validators.d.ts +26 -0
- package/esm/util/registry-validators.d.ts.map +1 -0
- package/esm/util/registry-validators.js +100 -0
- package/esm/util/registry-validators.js.map +1 -0
- package/esm/util/registry-validators.test.d.ts +2 -0
- package/esm/util/registry-validators.test.d.ts.map +1 -0
- package/esm/util/registry-validators.test.js +233 -0
- package/esm/util/registry-validators.test.js.map +1 -0
- package/esm/util/registry.d.ts +35 -7
- package/esm/util/registry.d.ts.map +1 -1
- package/esm/util/registry.js +57 -73
- package/esm/util/registry.js.map +1 -1
- package/esm/util/registry.test.d.ts +2 -0
- package/esm/util/registry.test.d.ts.map +1 -0
- package/esm/util/registry.test.js +169 -0
- package/esm/util/registry.test.js.map +1 -0
- package/esm/util/resource-validators.d.ts +16 -0
- package/esm/util/resource-validators.d.ts.map +1 -0
- package/esm/util/resource-validators.js +30 -0
- package/esm/util/resource-validators.js.map +1 -0
- package/esm/util/tool-caller.d.ts +2 -2
- package/esm/util/tool-caller.d.ts.map +1 -1
- package/esm/util/tool-caller.js +12 -4
- package/esm/util/tool-caller.js.map +1 -1
- package/package.json +13 -8
- package/dist/providers/hoc/with-tambo-interactable.d.ts.map +0 -1
- package/dist/providers/hoc/with-tambo-interactable.js.map +0 -1
- package/dist/util/validate-zod-schema.d.ts +0 -10
- package/dist/util/validate-zod-schema.d.ts.map +0 -1
- package/dist/util/validate-zod-schema.js +0 -100
- package/dist/util/validate-zod-schema.js.map +0 -1
- package/dist/util/validate-zod-schema.test.d.ts +0 -2
- package/dist/util/validate-zod-schema.test.d.ts.map +0 -1
- package/dist/util/validate-zod-schema.test.js +0 -96
- package/dist/util/validate-zod-schema.test.js.map +0 -1
- package/esm/providers/hoc/with-tambo-interactable.d.ts.map +0 -1
- package/esm/providers/hoc/with-tambo-interactable.js.map +0 -1
- package/esm/util/validate-zod-schema.d.ts +0 -10
- package/esm/util/validate-zod-schema.d.ts.map +0 -1
- package/esm/util/validate-zod-schema.js +0 -97
- package/esm/util/validate-zod-schema.js.map +0 -1
- package/esm/util/validate-zod-schema.test.d.ts +0 -2
- package/esm/util/validate-zod-schema.test.d.ts.map +0 -1
- package/esm/util/validate-zod-schema.test.js +0 -94
- package/esm/util/validate-zod-schema.test.js.map +0 -1
|
@@ -12,7 +12,7 @@ describe("buildMessageContent", () => {
|
|
|
12
12
|
...overrides,
|
|
13
13
|
});
|
|
14
14
|
it("should build content with text only", () => {
|
|
15
|
-
const result = (0, message_builder_1.buildMessageContent)("Hello world", []);
|
|
15
|
+
const result = (0, message_builder_1.buildMessageContent)("Hello world", [], {});
|
|
16
16
|
expect(result).toEqual([
|
|
17
17
|
{
|
|
18
18
|
type: "text",
|
|
@@ -24,7 +24,7 @@ describe("buildMessageContent", () => {
|
|
|
24
24
|
const image = createMockStagedImage({
|
|
25
25
|
dataUrl: "data:image/png;base64,abc123",
|
|
26
26
|
});
|
|
27
|
-
const result = (0, message_builder_1.buildMessageContent)("", [image]);
|
|
27
|
+
const result = (0, message_builder_1.buildMessageContent)("", [image], {});
|
|
28
28
|
expect(result).toEqual([
|
|
29
29
|
{
|
|
30
30
|
type: "image_url",
|
|
@@ -45,7 +45,7 @@ describe("buildMessageContent", () => {
|
|
|
45
45
|
dataUrl: "data:image/jpeg;base64,def456",
|
|
46
46
|
}),
|
|
47
47
|
];
|
|
48
|
-
const result = (0, message_builder_1.buildMessageContent)("Check these images:", images);
|
|
48
|
+
const result = (0, message_builder_1.buildMessageContent)("Check these images:", images, {});
|
|
49
49
|
expect(result).toEqual([
|
|
50
50
|
{
|
|
51
51
|
type: "text",
|
|
@@ -65,18 +65,18 @@ describe("buildMessageContent", () => {
|
|
|
65
65
|
},
|
|
66
66
|
]);
|
|
67
67
|
});
|
|
68
|
-
it("should
|
|
69
|
-
const result = (0, message_builder_1.buildMessageContent)(" Hello world ", []);
|
|
68
|
+
it("should preserve leading and trailing whitespace in text", () => {
|
|
69
|
+
const result = (0, message_builder_1.buildMessageContent)(" Hello world ", [], {});
|
|
70
70
|
expect(result).toEqual([
|
|
71
71
|
{
|
|
72
72
|
type: "text",
|
|
73
|
-
text: "Hello world",
|
|
73
|
+
text: " Hello world ",
|
|
74
74
|
},
|
|
75
75
|
]);
|
|
76
76
|
});
|
|
77
77
|
it("should skip empty text but keep images", () => {
|
|
78
78
|
const image = createMockStagedImage();
|
|
79
|
-
const result = (0, message_builder_1.buildMessageContent)(" ", [image]);
|
|
79
|
+
const result = (0, message_builder_1.buildMessageContent)(" ", [image], {});
|
|
80
80
|
expect(result).toEqual([
|
|
81
81
|
{
|
|
82
82
|
type: "image_url",
|
|
@@ -104,7 +104,7 @@ describe("buildMessageContent", () => {
|
|
|
104
104
|
dataUrl: "data:image/gif;base64,photo3data",
|
|
105
105
|
}),
|
|
106
106
|
];
|
|
107
|
-
const result = (0, message_builder_1.buildMessageContent)("Multiple images:", images);
|
|
107
|
+
const result = (0, message_builder_1.buildMessageContent)("Multiple images:", images, {});
|
|
108
108
|
expect(result).toHaveLength(4); // 1 text + 3 images
|
|
109
109
|
expect(result[0]).toEqual({
|
|
110
110
|
type: "text",
|
|
@@ -131,17 +131,17 @@ describe("buildMessageContent", () => {
|
|
|
131
131
|
});
|
|
132
132
|
it("should throw error when no content provided", () => {
|
|
133
133
|
expect(() => {
|
|
134
|
-
(0, message_builder_1.buildMessageContent)("", []);
|
|
134
|
+
(0, message_builder_1.buildMessageContent)("", [], {});
|
|
135
135
|
}).toThrow("Message must contain text or images");
|
|
136
136
|
});
|
|
137
137
|
it("should throw error when only whitespace provided", () => {
|
|
138
138
|
expect(() => {
|
|
139
|
-
(0, message_builder_1.buildMessageContent)(" \n\t ", []);
|
|
139
|
+
(0, message_builder_1.buildMessageContent)(" \n\t ", [], {});
|
|
140
140
|
}).toThrow("Message must contain text or images");
|
|
141
141
|
});
|
|
142
142
|
it("should return correct content type structure", () => {
|
|
143
143
|
const image = createMockStagedImage();
|
|
144
|
-
const result = (0, message_builder_1.buildMessageContent)("Test", [image]);
|
|
144
|
+
const result = (0, message_builder_1.buildMessageContent)("Test", [image], {});
|
|
145
145
|
// Verify the structure matches ChatCompletionContentPart interface
|
|
146
146
|
result.forEach((part) => {
|
|
147
147
|
expect(part).toHaveProperty("type");
|
|
@@ -158,7 +158,7 @@ describe("buildMessageContent", () => {
|
|
|
158
158
|
});
|
|
159
159
|
});
|
|
160
160
|
it("should handle edge case with empty array but valid text", () => {
|
|
161
|
-
const result = (0, message_builder_1.buildMessageContent)("Just text", []);
|
|
161
|
+
const result = (0, message_builder_1.buildMessageContent)("Just text", [], {});
|
|
162
162
|
expect(result).toHaveLength(1);
|
|
163
163
|
expect(result[0]).toEqual({
|
|
164
164
|
type: "text",
|
|
@@ -176,7 +176,7 @@ describe("buildMessageContent", () => {
|
|
|
176
176
|
dataUrl: "data:image/png;base64,second",
|
|
177
177
|
}),
|
|
178
178
|
];
|
|
179
|
-
const result = (0, message_builder_1.buildMessageContent)("Text content", images);
|
|
179
|
+
const result = (0, message_builder_1.buildMessageContent)("Text content", images, {});
|
|
180
180
|
expect(result[0].type).toBe("text");
|
|
181
181
|
expect(result[1].type).toBe("image_url");
|
|
182
182
|
expect(result[2].type).toBe("image_url");
|
|
@@ -187,5 +187,492 @@ describe("buildMessageContent", () => {
|
|
|
187
187
|
expect(result[2].image_url?.url).toBe("data:image/png;base64,second");
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
|
+
describe("resource parsing", () => {
|
|
191
|
+
it("should parse a single resource reference", () => {
|
|
192
|
+
const result = (0, message_builder_1.buildMessageContent)("Check @tambo-1hfs429:tambo:test://static/resource/1", [], {});
|
|
193
|
+
expect(result).toEqual([
|
|
194
|
+
{
|
|
195
|
+
type: "text",
|
|
196
|
+
text: "Check ",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: "resource",
|
|
200
|
+
resource: {
|
|
201
|
+
uri: "tambo:test://static/resource/1",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
]);
|
|
205
|
+
});
|
|
206
|
+
it("should parse resource reference at the start of text", () => {
|
|
207
|
+
const result = (0, message_builder_1.buildMessageContent)("@tambo-1hfs429:tambo:test://static/resource/1 check this", [], {});
|
|
208
|
+
expect(result).toEqual([
|
|
209
|
+
{
|
|
210
|
+
type: "resource",
|
|
211
|
+
resource: {
|
|
212
|
+
uri: "tambo:test://static/resource/1",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
type: "text",
|
|
217
|
+
text: " check this",
|
|
218
|
+
},
|
|
219
|
+
]);
|
|
220
|
+
});
|
|
221
|
+
it("should parse resource reference at the end of text", () => {
|
|
222
|
+
const result = (0, message_builder_1.buildMessageContent)("Check this @tambo-1hfs429:tambo:test://static/resource/1", [], {});
|
|
223
|
+
expect(result).toEqual([
|
|
224
|
+
{
|
|
225
|
+
type: "text",
|
|
226
|
+
text: "Check this ",
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
type: "resource",
|
|
230
|
+
resource: {
|
|
231
|
+
uri: "tambo:test://static/resource/1",
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
]);
|
|
235
|
+
});
|
|
236
|
+
it("should parse resource reference with name from resourceNames map", () => {
|
|
237
|
+
const resourceNames = {
|
|
238
|
+
"tambo-1hfs429:tambo:test://static/resource/1": "Documentation.pdf",
|
|
239
|
+
};
|
|
240
|
+
const result = (0, message_builder_1.buildMessageContent)("Check @tambo-1hfs429:tambo:test://static/resource/1", [], resourceNames);
|
|
241
|
+
expect(result).toEqual([
|
|
242
|
+
{
|
|
243
|
+
type: "text",
|
|
244
|
+
text: "Check ",
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
type: "resource",
|
|
248
|
+
resource: {
|
|
249
|
+
uri: "tambo:test://static/resource/1",
|
|
250
|
+
name: "Documentation.pdf",
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
]);
|
|
254
|
+
});
|
|
255
|
+
it("should parse resource reference without name when not in resourceNames map", () => {
|
|
256
|
+
const resourceNames = {
|
|
257
|
+
"other-server:other-uri": "Other Resource",
|
|
258
|
+
};
|
|
259
|
+
const result = (0, message_builder_1.buildMessageContent)("Check @tambo-1hfs429:tambo:test://static/resource/1", [], resourceNames);
|
|
260
|
+
expect(result).toEqual([
|
|
261
|
+
{
|
|
262
|
+
type: "text",
|
|
263
|
+
text: "Check ",
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
type: "resource",
|
|
267
|
+
resource: {
|
|
268
|
+
uri: "tambo:test://static/resource/1",
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
]);
|
|
272
|
+
});
|
|
273
|
+
it("should parse multiple resource references", () => {
|
|
274
|
+
const result = (0, message_builder_1.buildMessageContent)("Check @tambo-1hfs429:tambo:test://static/resource/1 and @tambo-1hfs429:tambo:test://static/resource/2", [], {});
|
|
275
|
+
expect(result).toEqual([
|
|
276
|
+
{
|
|
277
|
+
type: "text",
|
|
278
|
+
text: "Check ",
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
type: "resource",
|
|
282
|
+
resource: {
|
|
283
|
+
uri: "tambo:test://static/resource/1",
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
type: "text",
|
|
288
|
+
text: " and ",
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
type: "resource",
|
|
292
|
+
resource: {
|
|
293
|
+
uri: "tambo:test://static/resource/2",
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
]);
|
|
297
|
+
});
|
|
298
|
+
it("should preserve whitespace between consecutive resource references", () => {
|
|
299
|
+
const result = (0, message_builder_1.buildMessageContent)("@tambo-1hfs429:tambo:test://static/resource/1 @tambo-1hfs429:tambo:test://static/resource/2", [], {});
|
|
300
|
+
expect(result).toEqual([
|
|
301
|
+
{
|
|
302
|
+
type: "resource",
|
|
303
|
+
resource: {
|
|
304
|
+
uri: "tambo:test://static/resource/1",
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
type: "text",
|
|
309
|
+
text: " ",
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
type: "resource",
|
|
313
|
+
resource: {
|
|
314
|
+
uri: "tambo:test://static/resource/2",
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
]);
|
|
318
|
+
});
|
|
319
|
+
it("should parse resources with text before, between, and after", () => {
|
|
320
|
+
const result = (0, message_builder_1.buildMessageContent)("Before @tambo-1hfs429:tambo:test://static/resource/1 middle @linear:file://path/to/file.txt after", [], {});
|
|
321
|
+
expect(result).toEqual([
|
|
322
|
+
{
|
|
323
|
+
type: "text",
|
|
324
|
+
text: "Before ",
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
type: "resource",
|
|
328
|
+
resource: {
|
|
329
|
+
uri: "tambo:test://static/resource/1",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
type: "text",
|
|
334
|
+
text: " middle ",
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
type: "resource",
|
|
338
|
+
resource: {
|
|
339
|
+
uri: "file://path/to/file.txt",
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
type: "text",
|
|
344
|
+
text: " after",
|
|
345
|
+
},
|
|
346
|
+
]);
|
|
347
|
+
});
|
|
348
|
+
it("should parse resources from different server keys", () => {
|
|
349
|
+
const result = (0, message_builder_1.buildMessageContent)("@tambo-1hfs429:tambo:test://static/resource/1 and @linear:linear://issue/123", [], {});
|
|
350
|
+
expect(result).toEqual([
|
|
351
|
+
{
|
|
352
|
+
type: "resource",
|
|
353
|
+
resource: {
|
|
354
|
+
uri: "tambo:test://static/resource/1",
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
type: "text",
|
|
359
|
+
text: " and ",
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
type: "resource",
|
|
363
|
+
resource: {
|
|
364
|
+
uri: "linear://issue/123",
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
]);
|
|
368
|
+
});
|
|
369
|
+
it("should parse resources with various URI formats and preserve whitespace", () => {
|
|
370
|
+
const result = (0, message_builder_1.buildMessageContent)("@server1:file:///path/to/file.txt @server2:https://example.com/doc.pdf @server3:s3://bucket/key.json", [], {});
|
|
371
|
+
expect(result).toEqual([
|
|
372
|
+
{
|
|
373
|
+
type: "resource",
|
|
374
|
+
resource: {
|
|
375
|
+
uri: "file:///path/to/file.txt",
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
type: "text",
|
|
380
|
+
text: " ",
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
type: "resource",
|
|
384
|
+
resource: {
|
|
385
|
+
uri: "https://example.com/doc.pdf",
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
type: "text",
|
|
390
|
+
text: " ",
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
type: "resource",
|
|
394
|
+
resource: {
|
|
395
|
+
uri: "s3://bucket/key.json",
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
]);
|
|
399
|
+
});
|
|
400
|
+
it("should parse resources with hyphens in server key", () => {
|
|
401
|
+
const result = (0, message_builder_1.buildMessageContent)("@my-server-123:file:///path/to/file.txt", [], {});
|
|
402
|
+
expect(result).toEqual([
|
|
403
|
+
{
|
|
404
|
+
type: "resource",
|
|
405
|
+
resource: {
|
|
406
|
+
uri: "file:///path/to/file.txt",
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
]);
|
|
410
|
+
});
|
|
411
|
+
it("should parse resources with numbers in server key", () => {
|
|
412
|
+
const result = (0, message_builder_1.buildMessageContent)("@server123:tambo:test://static/resource/1", [], {});
|
|
413
|
+
expect(result).toEqual([
|
|
414
|
+
{
|
|
415
|
+
type: "resource",
|
|
416
|
+
resource: {
|
|
417
|
+
uri: "tambo:test://static/resource/1",
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
]);
|
|
421
|
+
});
|
|
422
|
+
it("should preserve whitespace in text segments around resource references", () => {
|
|
423
|
+
const result = (0, message_builder_1.buildMessageContent)(" Before @tambo-1hfs429:tambo:test://static/resource/1 After ", [], {});
|
|
424
|
+
expect(result).toEqual([
|
|
425
|
+
{
|
|
426
|
+
type: "text",
|
|
427
|
+
text: " Before ",
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
type: "resource",
|
|
431
|
+
resource: {
|
|
432
|
+
uri: "tambo:test://static/resource/1",
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
type: "text",
|
|
437
|
+
text: " After ",
|
|
438
|
+
},
|
|
439
|
+
]);
|
|
440
|
+
});
|
|
441
|
+
it("should handle resource with only whitespace text segments", () => {
|
|
442
|
+
const result = (0, message_builder_1.buildMessageContent)(" @tambo-1hfs429:tambo:test://static/resource/1 ", [], {});
|
|
443
|
+
expect(result).toEqual([
|
|
444
|
+
{
|
|
445
|
+
type: "text",
|
|
446
|
+
text: " ",
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
type: "resource",
|
|
450
|
+
resource: {
|
|
451
|
+
uri: "tambo:test://static/resource/1",
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
type: "text",
|
|
456
|
+
text: " ",
|
|
457
|
+
},
|
|
458
|
+
]);
|
|
459
|
+
});
|
|
460
|
+
it("should preserve newlines and spaces around resource references", () => {
|
|
461
|
+
const result = (0, message_builder_1.buildMessageContent)("\n @tambo-1hfs429:tambo:test://static/resource/1 text", [], {});
|
|
462
|
+
expect(result).toEqual([
|
|
463
|
+
{
|
|
464
|
+
type: "text",
|
|
465
|
+
text: "\n ",
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
type: "resource",
|
|
469
|
+
resource: {
|
|
470
|
+
uri: "tambo:test://static/resource/1",
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
type: "text",
|
|
475
|
+
text: " text",
|
|
476
|
+
},
|
|
477
|
+
]);
|
|
478
|
+
});
|
|
479
|
+
it("should parse resource-only message without text", () => {
|
|
480
|
+
const result = (0, message_builder_1.buildMessageContent)("@tambo-1hfs429:tambo:test://static/resource/1", [], {});
|
|
481
|
+
expect(result).toEqual([
|
|
482
|
+
{
|
|
483
|
+
type: "resource",
|
|
484
|
+
resource: {
|
|
485
|
+
uri: "tambo:test://static/resource/1",
|
|
486
|
+
},
|
|
487
|
+
},
|
|
488
|
+
]);
|
|
489
|
+
});
|
|
490
|
+
it("should parse multiple resources with names", () => {
|
|
491
|
+
const resourceNames = {
|
|
492
|
+
"tambo-1hfs429:tambo:test://static/resource/1": "First Resource",
|
|
493
|
+
"tambo-1hfs429:tambo:test://static/resource/2": "Second Resource",
|
|
494
|
+
};
|
|
495
|
+
const result = (0, message_builder_1.buildMessageContent)("Check @tambo-1hfs429:tambo:test://static/resource/1 and @tambo-1hfs429:tambo:test://static/resource/2", [], resourceNames);
|
|
496
|
+
expect(result).toEqual([
|
|
497
|
+
{
|
|
498
|
+
type: "text",
|
|
499
|
+
text: "Check ",
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
type: "resource",
|
|
503
|
+
resource: {
|
|
504
|
+
uri: "tambo:test://static/resource/1",
|
|
505
|
+
name: "First Resource",
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
type: "text",
|
|
510
|
+
text: " and ",
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
type: "resource",
|
|
514
|
+
resource: {
|
|
515
|
+
uri: "tambo:test://static/resource/2",
|
|
516
|
+
name: "Second Resource",
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
]);
|
|
520
|
+
});
|
|
521
|
+
it("should parse resources mixed with images", () => {
|
|
522
|
+
const images = [
|
|
523
|
+
createMockStagedImage({
|
|
524
|
+
id: "img1",
|
|
525
|
+
dataUrl: "data:image/png;base64,abc123",
|
|
526
|
+
}),
|
|
527
|
+
];
|
|
528
|
+
const result = (0, message_builder_1.buildMessageContent)("Check @tambo-1hfs429:tambo:test://static/resource/1", images, {});
|
|
529
|
+
expect(result).toEqual([
|
|
530
|
+
{
|
|
531
|
+
type: "text",
|
|
532
|
+
text: "Check ",
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
type: "resource",
|
|
536
|
+
resource: {
|
|
537
|
+
uri: "tambo:test://static/resource/1",
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
type: "image_url",
|
|
542
|
+
image_url: {
|
|
543
|
+
url: "data:image/png;base64,abc123",
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
]);
|
|
547
|
+
});
|
|
548
|
+
it("should parse resources and images with proper ordering", () => {
|
|
549
|
+
const images = [
|
|
550
|
+
createMockStagedImage({
|
|
551
|
+
id: "img1",
|
|
552
|
+
dataUrl: "data:image/png;base64,img1",
|
|
553
|
+
}),
|
|
554
|
+
createMockStagedImage({
|
|
555
|
+
id: "img2",
|
|
556
|
+
dataUrl: "data:image/jpeg;base64,img2",
|
|
557
|
+
}),
|
|
558
|
+
];
|
|
559
|
+
const result = (0, message_builder_1.buildMessageContent)("Text @tambo-1hfs429:tambo:test://static/resource/1 more text", images, {});
|
|
560
|
+
expect(result).toEqual([
|
|
561
|
+
{
|
|
562
|
+
type: "text",
|
|
563
|
+
text: "Text ",
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
type: "resource",
|
|
567
|
+
resource: {
|
|
568
|
+
uri: "tambo:test://static/resource/1",
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
type: "text",
|
|
573
|
+
text: " more text",
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
type: "image_url",
|
|
577
|
+
image_url: {
|
|
578
|
+
url: "data:image/png;base64,img1",
|
|
579
|
+
},
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
type: "image_url",
|
|
583
|
+
image_url: {
|
|
584
|
+
url: "data:image/jpeg;base64,img2",
|
|
585
|
+
},
|
|
586
|
+
},
|
|
587
|
+
]);
|
|
588
|
+
});
|
|
589
|
+
it("should parse resource reference with URI containing colons", () => {
|
|
590
|
+
const result = (0, message_builder_1.buildMessageContent)("@server:http://example.com:8080/path", [], {});
|
|
591
|
+
expect(result).toEqual([
|
|
592
|
+
{
|
|
593
|
+
type: "resource",
|
|
594
|
+
resource: {
|
|
595
|
+
uri: "http://example.com:8080/path",
|
|
596
|
+
},
|
|
597
|
+
},
|
|
598
|
+
]);
|
|
599
|
+
});
|
|
600
|
+
it("should parse resource reference with URI containing special characters", () => {
|
|
601
|
+
const result = (0, message_builder_1.buildMessageContent)("@server:file:///path/to/file%20with%20spaces.txt", [], {});
|
|
602
|
+
expect(result).toEqual([
|
|
603
|
+
{
|
|
604
|
+
type: "resource",
|
|
605
|
+
resource: {
|
|
606
|
+
uri: "file:///path/to/file%20with%20spaces.txt",
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
]);
|
|
610
|
+
});
|
|
611
|
+
it("should not parse @ symbol without server key and colon", () => {
|
|
612
|
+
const result = (0, message_builder_1.buildMessageContent)("Mention @user but not a resource", [], {});
|
|
613
|
+
expect(result).toEqual([
|
|
614
|
+
{
|
|
615
|
+
type: "text",
|
|
616
|
+
text: "Mention @user but not a resource",
|
|
617
|
+
},
|
|
618
|
+
]);
|
|
619
|
+
});
|
|
620
|
+
it("should not parse malformed resource reference missing colon", () => {
|
|
621
|
+
const result = (0, message_builder_1.buildMessageContent)("@serverkey-missing-colon resource", [], {});
|
|
622
|
+
expect(result).toEqual([
|
|
623
|
+
{
|
|
624
|
+
type: "text",
|
|
625
|
+
text: "@serverkey-missing-colon resource",
|
|
626
|
+
},
|
|
627
|
+
]);
|
|
628
|
+
});
|
|
629
|
+
it("should not parse resource reference with space before colon", () => {
|
|
630
|
+
const result = (0, message_builder_1.buildMessageContent)("@server key :uri", [], {});
|
|
631
|
+
expect(result).toEqual([
|
|
632
|
+
{
|
|
633
|
+
type: "text",
|
|
634
|
+
text: "@server key :uri",
|
|
635
|
+
},
|
|
636
|
+
]);
|
|
637
|
+
});
|
|
638
|
+
it("should preserve multiple whitespace characters between consecutive resources", () => {
|
|
639
|
+
const result = (0, message_builder_1.buildMessageContent)("@tambo-1hfs429:tambo:test://static/resource/1 @tambo-1hfs429:tambo:test://static/resource/2", [], {});
|
|
640
|
+
expect(result).toEqual([
|
|
641
|
+
{
|
|
642
|
+
type: "resource",
|
|
643
|
+
resource: {
|
|
644
|
+
uri: "tambo:test://static/resource/1",
|
|
645
|
+
},
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
type: "text",
|
|
649
|
+
text: " ",
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
type: "resource",
|
|
653
|
+
resource: {
|
|
654
|
+
uri: "tambo:test://static/resource/2",
|
|
655
|
+
},
|
|
656
|
+
},
|
|
657
|
+
]);
|
|
658
|
+
});
|
|
659
|
+
it("should parse resource with only URI and no surrounding text", () => {
|
|
660
|
+
const result = (0, message_builder_1.buildMessageContent)("@tambo-1hfs429:tambo:test://static/resource/1", [], {});
|
|
661
|
+
expect(result).toEqual([
|
|
662
|
+
{
|
|
663
|
+
type: "resource",
|
|
664
|
+
resource: {
|
|
665
|
+
uri: "tambo:test://static/resource/1",
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
]);
|
|
669
|
+
});
|
|
670
|
+
it("should throw error when only resources with empty text segments", () => {
|
|
671
|
+
// This should work - resources alone should be valid
|
|
672
|
+
const result = (0, message_builder_1.buildMessageContent)("@tambo-1hfs429:tambo:test://static/resource/1", [], {});
|
|
673
|
+
expect(result.length).toBeGreaterThan(0);
|
|
674
|
+
expect(result[0].type).toBe("resource");
|
|
675
|
+
});
|
|
676
|
+
});
|
|
190
677
|
});
|
|
191
678
|
//# sourceMappingURL=message-builder.test.js.map
|