@alquimia-ai/tools 2.5.0 → 2.7.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/README.md +527 -23
- package/dist/actions/index.d.mts +1 -1
- package/dist/actions/index.d.ts +1 -1
- package/dist/hooks/index.d.mts +3 -3
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +62 -6
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +62 -6
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/next/index.js +4 -1
- package/dist/next/index.js.map +1 -1
- package/dist/next/index.mjs +4 -1
- package/dist/next/index.mjs.map +1 -1
- package/dist/providers/index.d.mts +3 -3
- package/dist/providers/index.d.ts +3 -3
- package/dist/{providers-DiR9cgyo.d.mts → providers-B4IOiGfr.d.mts} +1 -1
- package/dist/{providers-b5_yMyMo.d.ts → providers-mx21gNgZ.d.ts} +1 -1
- package/dist/proxy.js +4 -1
- package/dist/proxy.js.map +1 -1
- package/dist/proxy.mjs +4 -1
- package/dist/proxy.mjs.map +1 -1
- package/dist/sdk/index.d.mts +37 -4
- package/dist/sdk/index.d.ts +37 -4
- package/dist/sdk/index.js +43 -6
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/index.mjs +43 -6
- package/dist/sdk/index.mjs.map +1 -1
- package/dist/services/index.d.mts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/{type-DqX3-9QS.d.mts → type-61gaZga-.d.mts} +45 -1
- package/dist/{type-xksRnBUW.d.ts → type-D-JaSMkV.d.ts} +45 -1
- package/dist/types/index.d.mts +6 -4
- package/dist/types/index.d.ts +6 -4
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/{types-C-6fgK1_.d.mts → types-lOliroPw.d.mts} +1 -1
- package/dist/{types-C-6fgK1_.d.ts → types-lOliroPw.d.ts} +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/worklog/index.d.mts +2 -2
- package/dist/worklog/index.d.ts +2 -2
- package/dist/worklog/index.js +19 -0
- package/dist/worklog/index.js.map +1 -1
- package/dist/worklog/index.mjs +19 -0
- package/dist/worklog/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/hooks/index.js
CHANGED
|
@@ -48,6 +48,9 @@ var AlquimiaSDK = class {
|
|
|
48
48
|
this.streamId = null;
|
|
49
49
|
// W3C traceparent for the current turn, so infer and stream share one trace.
|
|
50
50
|
this.traceParent = null;
|
|
51
|
+
// Registry version tag resolved by the runtime for this task (v0.5.1), so
|
|
52
|
+
// the tool-completion half of the turn lands on the same agentspace version.
|
|
53
|
+
this.versionTag = null;
|
|
51
54
|
this.tools = [];
|
|
52
55
|
this.extraInstructions = null;
|
|
53
56
|
this.assistantConfig = null;
|
|
@@ -128,6 +131,19 @@ var AlquimiaSDK = class {
|
|
|
128
131
|
this.userId = userId;
|
|
129
132
|
return this;
|
|
130
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Pin inference to a cached registry version. Sent as the `version_tag`
|
|
136
|
+
* query parameter, which `POST /event/infer/{assistant_id}` accepts from
|
|
137
|
+
* **runtime v0.5.2** onward; older runtimes ignore it.
|
|
138
|
+
*
|
|
139
|
+
* Works on every version: pass a versioned assistant ref
|
|
140
|
+
* (`<agentspace>/<assistant>[:<tag>]`) as the `assistantId` instead — the
|
|
141
|
+
* runtime parses the tag out of the path itself.
|
|
142
|
+
*/
|
|
143
|
+
withVersionTag(versionTag) {
|
|
144
|
+
this.versionTag = versionTag;
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
131
147
|
getEnforceCharacterization() {
|
|
132
148
|
return this.enforceCharacterization ?? true;
|
|
133
149
|
}
|
|
@@ -143,19 +159,29 @@ var AlquimiaSDK = class {
|
|
|
143
159
|
}
|
|
144
160
|
return this.whisperProvider.speechToText(audio);
|
|
145
161
|
}
|
|
146
|
-
async sendMessage(query,
|
|
162
|
+
async sendMessage(query, options = {}) {
|
|
147
163
|
if (!this.conversationId) {
|
|
148
164
|
throw new Error(
|
|
149
165
|
"Conversation not initialized. Call withConversationId() before sendMessage()"
|
|
150
166
|
);
|
|
151
167
|
}
|
|
152
|
-
const
|
|
168
|
+
const opts = typeof options === "string" ? { traceParent: options } : options;
|
|
169
|
+
if (query === void 0 && !opts.inputAudio) {
|
|
170
|
+
throw new Error(
|
|
171
|
+
"AlquimiaSDK: sendMessage needs a query, an inputAudio blob, or both"
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
const baseInferUrl = this.adapter.resolveInferUrl(this.assistantId);
|
|
175
|
+
const inferUrl = this.versionTag ? `${baseInferUrl}${baseInferUrl.includes("?") ? "&" : "?"}version_tag=${encodeURIComponent(this.versionTag)}` : baseInferUrl;
|
|
153
176
|
const adapterHeaders = this.adapter.getHeaders?.() ?? {};
|
|
154
177
|
const hasClientTools = Array.isArray(this.tools) && this.tools.length > 0;
|
|
155
178
|
const initMessage = {
|
|
156
|
-
query,
|
|
179
|
+
...query !== void 0 && { query },
|
|
157
180
|
session_id: this.conversationId,
|
|
158
181
|
user_id: this.userId,
|
|
182
|
+
...opts.inputAudio && { input_audio: opts.inputAudio },
|
|
183
|
+
// Only sent when set: the runtime defaults `output_audio` to true.
|
|
184
|
+
...opts.outputAudio !== void 0 && { output_audio: opts.outputAudio },
|
|
159
185
|
...this.extraInstructions && { extra_instructions: this.extraInstructions },
|
|
160
186
|
...this.assistantConfig && { config: this.assistantConfig },
|
|
161
187
|
...hasClientTools && {
|
|
@@ -168,13 +194,14 @@ var AlquimiaSDK = class {
|
|
|
168
194
|
const result = (await this.axiosInstance.post(inferUrl, initMessage, {
|
|
169
195
|
headers: {
|
|
170
196
|
"Content-Type": "application/json",
|
|
171
|
-
...traceParent && { "x-trace-parent": traceParent },
|
|
197
|
+
...opts.traceParent && { "x-trace-parent": opts.traceParent },
|
|
172
198
|
...adapterHeaders,
|
|
173
199
|
...this.buildIdentityHeaders()
|
|
174
200
|
}
|
|
175
201
|
})).data;
|
|
176
|
-
this.traceParent = traceParent ?? null;
|
|
202
|
+
this.traceParent = opts.traceParent ?? null;
|
|
177
203
|
this.streamId = result.taskid ?? null;
|
|
204
|
+
this.versionTag = result.versiontag ?? this.versionTag;
|
|
178
205
|
this.attachmentResponses = result.attachments ?? [];
|
|
179
206
|
this.attachments = [];
|
|
180
207
|
return this;
|
|
@@ -201,6 +228,7 @@ var AlquimiaSDK = class {
|
|
|
201
228
|
...this.streamId && { taskid: this.streamId },
|
|
202
229
|
...this.conversationId && { sessionid: this.conversationId },
|
|
203
230
|
...this.userId && { userid: this.userId },
|
|
231
|
+
...this.versionTag && { versiontag: this.versionTag },
|
|
204
232
|
...adapterHeaders
|
|
205
233
|
};
|
|
206
234
|
await this.axiosInstance.post(url, response, { headers });
|
|
@@ -243,18 +271,23 @@ var AlquimiaSDK = class {
|
|
|
243
271
|
getAttachmentResponses() {
|
|
244
272
|
return this.attachmentResponses;
|
|
245
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Upload a file into the session context. Returns the runtime {@link RuntimeBlob},
|
|
276
|
+
* which is what `sendMessage`'s `inputAudio` expects for audio inference.
|
|
277
|
+
*/
|
|
246
278
|
async uploadAttachment(file, _attachmentId) {
|
|
247
279
|
const url = this.adapter.resolveBlobUploadUrl();
|
|
248
280
|
const adapterHeaders = this.adapter.getHeaders?.() ?? {};
|
|
249
281
|
const formData = new FormData();
|
|
250
282
|
formData.append("file", file);
|
|
251
|
-
await this.axiosInstance.post(url, formData, {
|
|
283
|
+
const response = await this.axiosInstance.post(url, formData, {
|
|
252
284
|
headers: {
|
|
253
285
|
"Content-Type": "multipart/form-data",
|
|
254
286
|
...adapterHeaders,
|
|
255
287
|
...this.buildIdentityHeaders()
|
|
256
288
|
}
|
|
257
289
|
});
|
|
290
|
+
return response.data;
|
|
258
291
|
}
|
|
259
292
|
/**
|
|
260
293
|
* Identity headers (kebab-case) required by `/context/blob/upload` and
|
|
@@ -285,6 +318,10 @@ var AlquimiaSDK = class {
|
|
|
285
318
|
getTaskId() {
|
|
286
319
|
return this.streamId;
|
|
287
320
|
}
|
|
321
|
+
/** Registry version tag resolved by the runtime for the current task, if any. */
|
|
322
|
+
getVersionTag() {
|
|
323
|
+
return this.versionTag;
|
|
324
|
+
}
|
|
288
325
|
};
|
|
289
326
|
var alquimia_sdk_default = AlquimiaSDK;
|
|
290
327
|
|
|
@@ -389,6 +426,14 @@ var agentTitle = (r) => {
|
|
|
389
426
|
return typeof name === "string" && name.length > 0 ? `Agent: ${name}` : "Agent-to-agent";
|
|
390
427
|
};
|
|
391
428
|
var constTitle = (label) => () => label;
|
|
429
|
+
var shieldBlockTitle = (r) => {
|
|
430
|
+
const id = asRecord(r.data).shield_id;
|
|
431
|
+
return typeof id === "string" && id.length > 0 ? `Blocked by ${id}` : "Blocked by safeguard";
|
|
432
|
+
};
|
|
433
|
+
var knowledgeTitle = (r) => {
|
|
434
|
+
const query = asRecord(r.data).query;
|
|
435
|
+
return typeof query === "string" && query.length > 0 ? `Knowledge: ${query}` : "Knowledge retrieval";
|
|
436
|
+
};
|
|
392
437
|
var EVENT_REGISTRY = {
|
|
393
438
|
// Run envelope
|
|
394
439
|
AssistantInference: { kind: "answer", role: "run-open", title: constTitle("Inference started") },
|
|
@@ -396,6 +441,9 @@ var EVENT_REGISTRY = {
|
|
|
396
441
|
// Safeguard
|
|
397
442
|
ShieldInference: { kind: "safeguard", role: "open", title: constTitle("Safeguard") },
|
|
398
443
|
ShieldInferenceResponse: { kind: "safeguard", role: "close", title: constTitle("Safeguard") },
|
|
444
|
+
// Emitted when a shield enforcement decision blocks the request (core 0.5.x).
|
|
445
|
+
// Response-only: the reducer opens it already closed when no command matched.
|
|
446
|
+
ShieldBlockedResponse: { kind: "safeguard", role: "close", title: shieldBlockTitle },
|
|
399
447
|
// Reasoning
|
|
400
448
|
ResponseInference: { kind: "reasoning", role: "open", title: constTitle("Reasoning") },
|
|
401
449
|
ResponseInferenceResponse: { kind: "reasoning", role: "close", title: constTitle("Reasoning") },
|
|
@@ -413,6 +461,14 @@ var EVENT_REGISTRY = {
|
|
|
413
461
|
A2AInference: { kind: "a2a", role: "open", title: agentTitle },
|
|
414
462
|
AgentDiscovery: { kind: "a2a", role: "open", title: constTitle("Agent discovery") },
|
|
415
463
|
AgentDiscoveryResponse: { kind: "a2a", role: "close", title: constTitle("Agent discovery") },
|
|
464
|
+
// Knowledge retrieval (RAG) — core 0.5.x
|
|
465
|
+
KnowledgeRetrieval: { kind: "knowledge", role: "open", title: knowledgeTitle },
|
|
466
|
+
KnowledgeRetrievalResponse: { kind: "knowledge", role: "close", title: knowledgeTitle },
|
|
467
|
+
// Speech pipeline — core 0.5.x
|
|
468
|
+
SpeechTranscription: { kind: "speech", role: "open", title: constTitle("Speech-to-text") },
|
|
469
|
+
SpeechTranscriptionResponse: { kind: "speech", role: "close", title: constTitle("Speech-to-text") },
|
|
470
|
+
SpeechSynthesis: { kind: "speech", role: "open", title: constTitle("Text-to-speech") },
|
|
471
|
+
SpeechSynthesisResponse: { kind: "speech", role: "close", title: constTitle("Text-to-speech") },
|
|
416
472
|
// Memory / persistence
|
|
417
473
|
ContextPersistence: { kind: "memory", role: "open", title: constTitle("Memory persistence") },
|
|
418
474
|
ContextFlush: { kind: "memory", role: "open", title: constTitle("Memory flush") },
|