@theoremjs/web 0.3.5-next.945.g127cfdd → 0.3.5-next.948.g1059790

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- import { type MediaInputKind } from '@theoremjs/agents';
9
+ import { type ToolOutputRefPart } from '@theoremjs/agents';
10
10
  import { type Row } from './shaped-data.ts';
11
11
  /** One number that answers the call, as a stat card shows it. */
12
12
  export type ResultFigure = {
@@ -53,6 +53,7 @@ export type ResultMedia = {
53
53
  mimeType?: string;
54
54
  data?: string;
55
55
  uri?: string;
56
+ metadata?: Record<string, unknown>;
56
57
  };
57
58
  /** What a call returned to see or hear: its image parts and its audio parts. */
58
59
  export type ReturnedMedia = {
@@ -67,11 +68,7 @@ export declare function layoutResult(output: unknown): ResultLayout;
67
68
  /** The images and audio a call returned, each with its bytes; parts without them (references) are left out. */
68
69
  export declare function returnedMedia(parts: readonly ResultMedia[], imageAlt: string): ReturnedMedia;
69
70
  /** The references a call returned, which only the app's resolver turns into something to show. */
70
- export declare function referencesIn(parts: readonly ResultMedia[]): {
71
- type: MediaInputKind;
72
- mimeType: string;
73
- uri: string;
74
- }[];
71
+ export declare function referencesIn(parts: readonly ResultMedia[]): ToolOutputRefPart[];
75
72
  /** Whether the result has anything to lead with above its data. */
76
73
  export declare function hasLead(layout: ResultLayout, media: ReturnedMedia): boolean;
77
74
  /**
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- import { MEDIA_INPUT_KIND_VALUES } from '@theoremjs/agents';
9
+ import { MEDIA_INPUT_KIND_VALUES, } from '@theoremjs/agents';
10
10
  import { columnStore, fieldLabel, humanize, ISO_DATE, isPlain, isRow, printableUnit, shownEntries, storeRows, titleKey, unitsOf, unpacked, } from "./shaped-data.js";
11
11
  const MAX_FIGURES = 4;
12
12
  const MAX_CHARTS = 3;
@@ -232,7 +232,14 @@ export function returnedMedia(parts, imageAlt) {
232
232
  /** The references a call returned, which only the app's resolver turns into something to show. */
233
233
  export function referencesIn(parts) {
234
234
  return parts.flatMap((part) => part.uri !== undefined && part.mimeType !== undefined && isMediaKind(part.type)
235
- ? [{ type: part.type, mimeType: part.mimeType, uri: part.uri }]
235
+ ? [
236
+ {
237
+ type: part.type,
238
+ mimeType: part.mimeType,
239
+ uri: part.uri,
240
+ ...(part.metadata ? { metadata: part.metadata } : {}),
241
+ },
242
+ ]
236
243
  : []);
237
244
  }
238
245
  function isMediaKind(type) {
@@ -78,6 +78,7 @@ const transcriptBlock = z.discriminatedUnion('kind', [
78
78
  type: z.enum(MEDIA_INPUT_KIND_VALUES).optional(),
79
79
  fromTool: z.literal(true).optional(),
80
80
  sent: z.literal(true).optional(),
81
+ metadata: z.record(z.string(), z.unknown()).optional(),
81
82
  }),
82
83
  z.object({
83
84
  ...blockId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/web",
3
- "version": "0.3.5-next.945.g127cfdd",
3
+ "version": "0.3.5-next.948.g1059790",
4
4
  "description": "Theorem on the web platform, with no UI framework: Web-standard server handlers that serve a profile, and the browser client that talks to them.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,6 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "^4.6.5",
28
- "@theoremjs/agents": "^0.3.5-next.945.g127cfdd"
28
+ "@theoremjs/agents": "^0.3.5-next.948.g1059790"
29
29
  }
30
30
  }