@opencxh/domain 1.135.0 → 1.136.0

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.
@@ -44,11 +44,59 @@ export interface AiToolCall {
44
44
  name: string;
45
45
  arguments: Record<string, unknown>;
46
46
  }
47
+ /**
48
+ * Something a tool read, so the answer can say where it looked.
49
+ *
50
+ * A tool's `content` is prose written for the model, which means the provenance
51
+ * inside it — an article id, a conversation title — is only recoverable by
52
+ * parsing text the tool is free to reformat. This is the same information handed
53
+ * over as data instead.
54
+ *
55
+ * These are the things that were **consulted**, not a claim about which ones the
56
+ * answer leaned on: a search that returns five articles returns five sources
57
+ * whether the model used one of them or all five. Label them accordingly in the
58
+ * UI; asking the model to cite would be more precise and less trustworthy,
59
+ * because a model will invent a reference.
60
+ */
61
+ export interface ToolSource {
62
+ /**
63
+ * What sort of thing this is, e.g. `"kb-article"`, `"memory"`, `"interaction"`.
64
+ * Open string: an app may cite something the platform has no notion of, and a
65
+ * closed union would need a domain change per app.
66
+ */
67
+ kind: string;
68
+ /** Shown to the user. */
69
+ title: string;
70
+ /** Stable id within its kind, when there is one. */
71
+ id?: string;
72
+ /** A second line: a snippet, a date, an author. */
73
+ detail?: string;
74
+ /**
75
+ * Shell-absolute in-product route, including the `/apps/<app>` prefix — the
76
+ * source may well belong to a different app than the one showing it.
77
+ *
78
+ * Follow it with the **kernel** router (`sdk` from `@opencxh/app-sdk`), not an
79
+ * app's own: `createApp().router.navigate` prefixes the calling app's id, which
80
+ * would turn `/apps/kb/…` into `/apps/ai/apps/kb/…`.
81
+ *
82
+ * Absent when the thing has no page of its own — a memory item, for instance —
83
+ * which is a reason to show it without a link, not a reason to hide it.
84
+ */
85
+ url?: string;
86
+ }
47
87
  /** The result of executing a tool call, fed back to the model. */
48
88
  export interface AiToolResult {
49
89
  id: string;
50
90
  content: string;
51
91
  isError?: boolean;
92
+ /**
93
+ * What this call read. Optional and additive, like the fields on
94
+ * {@link AiToolDescriptor}: a tool that sets nothing behaves exactly as before.
95
+ *
96
+ * Persisted for free — `ToolTraceEntry.result` already rides along on the
97
+ * stored `AIMessage`, so the thread keeps its provenance without a new entity.
98
+ */
99
+ sources?: ToolSource[];
52
100
  }
53
101
  /**
54
102
  * Returned by an app's `GET /provider/ai-tools/describe`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.135.0",
3
+ "version": "1.136.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",