@opencxh/domain 1.135.0 → 1.137.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.
- package/dist/entities/artifact/blocks.d.ts +168 -0
- package/dist/entities/artifact/blocks.test.d.ts +1 -0
- package/dist/entities/artifact/index.d.ts +3 -0
- package/dist/entities/artifact/markdown.d.ts +7 -0
- package/dist/entities/artifact/markdown.test.d.ts +1 -0
- package/dist/entities/artifact/types.d.ts +128 -0
- package/dist/index.cjs +14 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +745 -417
- package/dist/platform/ai-tools.d.ts +73 -0
- package/package.json +1 -1
|
@@ -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`.
|
|
@@ -107,6 +155,31 @@ export interface AiToolDescriptor extends AiTool {
|
|
|
107
155
|
export interface AiToolInvokeRequest {
|
|
108
156
|
tool: string;
|
|
109
157
|
arguments?: Record<string, unknown>;
|
|
158
|
+
/**
|
|
159
|
+
* Wat er in déze beurt al gebeurd is, voor een tool die niet alleen zijn eigen
|
|
160
|
+
* argumenten nodig heeft maar ook de context waarin hij wordt aangeroepen.
|
|
161
|
+
*
|
|
162
|
+
* Optioneel en additief, net als de extra velden op {@link AiToolDescriptor}:
|
|
163
|
+
* een tool die dit negeert gedraagt zich exact als voorheen.
|
|
164
|
+
*
|
|
165
|
+
* De aanleiding is bronvermelding die klopt. De runner verzamelt al de
|
|
166
|
+
* {@link ToolSource}s van álle tools in een beurt, maar het invoke-contract
|
|
167
|
+
* droeg alleen `{tool, arguments}` — dus een tool die iets *bewaart* (een
|
|
168
|
+
* artefact, een geheugen-item) kon niet vastleggen waar het uit is opgebouwd.
|
|
169
|
+
* Het model ernaar laten raden levert verzonnen bronvermelding op, precies wat
|
|
170
|
+
* `ToolSource` moest voorkomen.
|
|
171
|
+
*/
|
|
172
|
+
turn?: AiToolTurnContext;
|
|
173
|
+
}
|
|
174
|
+
/** Zie {@link AiToolInvokeRequest.turn}. */
|
|
175
|
+
export interface AiToolTurnContext {
|
|
176
|
+
/** Het gesprek waarin deze beurt loopt, als er een is. */
|
|
177
|
+
conversationId?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Wat er tot nu toe in deze beurt is geraadpleegd, ontdubbeld. Bevat **niet**
|
|
180
|
+
* de resultaten van deze call zelf — die bestaan nog niet.
|
|
181
|
+
*/
|
|
182
|
+
sources?: ToolSource[];
|
|
110
183
|
}
|
|
111
184
|
/** One step in the assistant's tool-use trace, persisted on the message. */
|
|
112
185
|
export interface ToolTraceEntry {
|