@anuma/sdk 6.28.0 → 6.28.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/dist/expo/index.cjs +14773 -14737
- package/dist/expo/index.mjs +14721 -14687
- package/dist/react/index.cjs +16602 -16568
- package/dist/react/index.mjs +16579 -16545
- package/dist/server/index.cjs +38 -0
- package/dist/server/index.mjs +38 -0
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -32758,6 +32758,9 @@ function createDurableAutoExtractor(options) {
|
|
|
32758
32758
|
};
|
|
32759
32759
|
}
|
|
32760
32760
|
|
|
32761
|
+
// src/tools/confirmConstants.ts
|
|
32762
|
+
var CONFIRM_TOOL_NAME = "prompt_user_confirm";
|
|
32763
|
+
|
|
32761
32764
|
// src/tools/appBuilderPrompt.ts
|
|
32762
32765
|
var APP_BUILDER_PROMPT = `App Builder tools (create_file, patch_file, and the rest described below) are available this turn, but they are OPTIONAL \u2014 having them does not mean you should build anything.
|
|
32763
32766
|
|
|
@@ -33050,6 +33053,7 @@ function filterServerTools(serverTools, includeNames) {
|
|
|
33050
33053
|
const includeSet = new Set(includeNames);
|
|
33051
33054
|
return serverTools.filter((tool) => includeSet.has(tool.name));
|
|
33052
33055
|
}
|
|
33056
|
+
var TOOL_SEARCH_TOOL_NAME = "tool_search_tool_regex";
|
|
33053
33057
|
function resolveDeferredServerTools(allServerTools, serverToolsFilter, config) {
|
|
33054
33058
|
const allowed = serverToolsFilter === void 0 || typeof serverToolsFilter === "function" ? allServerTools : filterServerTools(allServerTools, [...serverToolsFilter]);
|
|
33055
33059
|
const excluded = new Set(config.excludeTools ?? []);
|
|
@@ -33302,6 +33306,11 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
33302
33306
|
anchors: []
|
|
33303
33307
|
}
|
|
33304
33308
|
];
|
|
33309
|
+
var CONFIRMED_ACTION_TOOL_SETS = /* @__PURE__ */ new Map([
|
|
33310
|
+
["book_restaurant", "restaurant-booking"],
|
|
33311
|
+
["anuma_book_restaurant", "restaurant-booking"],
|
|
33312
|
+
["anumapaymentsmcp-anuma_book_restaurant", "restaurant-booking"]
|
|
33313
|
+
]);
|
|
33305
33314
|
function expandToolSetsAdditive(matchedNames, availableNames, scores, toolSets, activeSetNames) {
|
|
33306
33315
|
const result = new Set(matchedNames);
|
|
33307
33316
|
for (const ts of toolSets) {
|
|
@@ -37263,6 +37272,22 @@ function getToolName(tool) {
|
|
|
37263
37272
|
if (typeof flatName === "string") return flatName;
|
|
37264
37273
|
return void 0;
|
|
37265
37274
|
}
|
|
37275
|
+
function toolsAfterConfirmation(apiTools, executionResults) {
|
|
37276
|
+
const members = /* @__PURE__ */ new Set();
|
|
37277
|
+
for (const r of executionResults) {
|
|
37278
|
+
if (r.name !== CONFIRM_TOOL_NAME) continue;
|
|
37279
|
+
const answer = r.result;
|
|
37280
|
+
if (answer?.confirmed !== true || typeof answer.action !== "string") continue;
|
|
37281
|
+
const setName = CONFIRMED_ACTION_TOOL_SETS.get(answer.action.trim().toLowerCase());
|
|
37282
|
+
const set = BUILT_IN_TOOL_SETS.find((s) => s.name === setName);
|
|
37283
|
+
for (const member of set?.members ?? []) members.add(member);
|
|
37284
|
+
}
|
|
37285
|
+
if (!apiTools.some((t) => members.has(getToolName(t) ?? ""))) return void 0;
|
|
37286
|
+
return apiTools.filter((t) => {
|
|
37287
|
+
const name = getToolName(t) ?? "";
|
|
37288
|
+
return members.has(name) || name === CONFIRM_TOOL_NAME || name === TOOL_SEARCH_TOOL_NAME;
|
|
37289
|
+
});
|
|
37290
|
+
}
|
|
37266
37291
|
var STREAM_RESUMABLE_HEADER = "X-Stream-Resumable";
|
|
37267
37292
|
var INFERENCE_ID_HEADER = "X-Inference-ID";
|
|
37268
37293
|
var CONVERSATION_ID_HEADER = "X-Conversation-ID";
|
|
@@ -37948,6 +37973,19 @@ Executing tool: ${toolInfo}
|
|
|
37948
37973
|
}
|
|
37949
37974
|
}
|
|
37950
37975
|
}
|
|
37976
|
+
if (apiTools) {
|
|
37977
|
+
const confirmedTools = toolsAfterConfirmation(apiTools, executionResults);
|
|
37978
|
+
if (confirmedTools) {
|
|
37979
|
+
const kept = new Set(confirmedTools.map(getToolName));
|
|
37980
|
+
if (typeof toolChoice === "string" && !kept.has(toolChoice) && apiTools.some((t) => getToolName(t) === toolChoice)) {
|
|
37981
|
+
toolChoice = "auto";
|
|
37982
|
+
}
|
|
37983
|
+
apiTools = confirmedTools;
|
|
37984
|
+
for (const [name] of executorMap) {
|
|
37985
|
+
if (!kept.has(name)) executorMap.delete(name);
|
|
37986
|
+
}
|
|
37987
|
+
}
|
|
37988
|
+
}
|
|
37951
37989
|
if (onThinking) {
|
|
37952
37990
|
const thinkingResults = executionResults.filter(
|
|
37953
37991
|
(r) => !r.name || executorMap.get(r.name)?.skipContinuation !== true
|
package/dist/server/index.mjs
CHANGED
|
@@ -31023,6 +31023,9 @@ function createDurableAutoExtractor(options) {
|
|
|
31023
31023
|
};
|
|
31024
31024
|
}
|
|
31025
31025
|
|
|
31026
|
+
// src/tools/confirmConstants.ts
|
|
31027
|
+
var CONFIRM_TOOL_NAME = "prompt_user_confirm";
|
|
31028
|
+
|
|
31026
31029
|
// src/tools/appBuilderPrompt.ts
|
|
31027
31030
|
var APP_BUILDER_PROMPT = `App Builder tools (create_file, patch_file, and the rest described below) are available this turn, but they are OPTIONAL \u2014 having them does not mean you should build anything.
|
|
31028
31031
|
|
|
@@ -31314,6 +31317,7 @@ function filterServerTools(serverTools, includeNames) {
|
|
|
31314
31317
|
const includeSet = new Set(includeNames);
|
|
31315
31318
|
return serverTools.filter((tool) => includeSet.has(tool.name));
|
|
31316
31319
|
}
|
|
31320
|
+
var TOOL_SEARCH_TOOL_NAME = "tool_search_tool_regex";
|
|
31317
31321
|
function resolveDeferredServerTools(allServerTools, serverToolsFilter, config) {
|
|
31318
31322
|
const allowed = serverToolsFilter === void 0 || typeof serverToolsFilter === "function" ? allServerTools : filterServerTools(allServerTools, [...serverToolsFilter]);
|
|
31319
31323
|
const excluded = new Set(config.excludeTools ?? []);
|
|
@@ -31566,6 +31570,11 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
31566
31570
|
anchors: []
|
|
31567
31571
|
}
|
|
31568
31572
|
];
|
|
31573
|
+
var CONFIRMED_ACTION_TOOL_SETS = /* @__PURE__ */ new Map([
|
|
31574
|
+
["book_restaurant", "restaurant-booking"],
|
|
31575
|
+
["anuma_book_restaurant", "restaurant-booking"],
|
|
31576
|
+
["anumapaymentsmcp-anuma_book_restaurant", "restaurant-booking"]
|
|
31577
|
+
]);
|
|
31569
31578
|
function expandToolSetsAdditive(matchedNames, availableNames, scores, toolSets, activeSetNames) {
|
|
31570
31579
|
const result = new Set(matchedNames);
|
|
31571
31580
|
for (const ts of toolSets) {
|
|
@@ -35509,6 +35518,22 @@ function getToolName(tool) {
|
|
|
35509
35518
|
if (typeof flatName === "string") return flatName;
|
|
35510
35519
|
return void 0;
|
|
35511
35520
|
}
|
|
35521
|
+
function toolsAfterConfirmation(apiTools, executionResults) {
|
|
35522
|
+
const members = /* @__PURE__ */ new Set();
|
|
35523
|
+
for (const r of executionResults) {
|
|
35524
|
+
if (r.name !== CONFIRM_TOOL_NAME) continue;
|
|
35525
|
+
const answer = r.result;
|
|
35526
|
+
if (answer?.confirmed !== true || typeof answer.action !== "string") continue;
|
|
35527
|
+
const setName = CONFIRMED_ACTION_TOOL_SETS.get(answer.action.trim().toLowerCase());
|
|
35528
|
+
const set = BUILT_IN_TOOL_SETS.find((s) => s.name === setName);
|
|
35529
|
+
for (const member of set?.members ?? []) members.add(member);
|
|
35530
|
+
}
|
|
35531
|
+
if (!apiTools.some((t) => members.has(getToolName(t) ?? ""))) return void 0;
|
|
35532
|
+
return apiTools.filter((t) => {
|
|
35533
|
+
const name = getToolName(t) ?? "";
|
|
35534
|
+
return members.has(name) || name === CONFIRM_TOOL_NAME || name === TOOL_SEARCH_TOOL_NAME;
|
|
35535
|
+
});
|
|
35536
|
+
}
|
|
35512
35537
|
var STREAM_RESUMABLE_HEADER = "X-Stream-Resumable";
|
|
35513
35538
|
var INFERENCE_ID_HEADER = "X-Inference-ID";
|
|
35514
35539
|
var CONVERSATION_ID_HEADER = "X-Conversation-ID";
|
|
@@ -36194,6 +36219,19 @@ Executing tool: ${toolInfo}
|
|
|
36194
36219
|
}
|
|
36195
36220
|
}
|
|
36196
36221
|
}
|
|
36222
|
+
if (apiTools) {
|
|
36223
|
+
const confirmedTools = toolsAfterConfirmation(apiTools, executionResults);
|
|
36224
|
+
if (confirmedTools) {
|
|
36225
|
+
const kept = new Set(confirmedTools.map(getToolName));
|
|
36226
|
+
if (typeof toolChoice === "string" && !kept.has(toolChoice) && apiTools.some((t) => getToolName(t) === toolChoice)) {
|
|
36227
|
+
toolChoice = "auto";
|
|
36228
|
+
}
|
|
36229
|
+
apiTools = confirmedTools;
|
|
36230
|
+
for (const [name] of executorMap) {
|
|
36231
|
+
if (!kept.has(name)) executorMap.delete(name);
|
|
36232
|
+
}
|
|
36233
|
+
}
|
|
36234
|
+
}
|
|
36197
36235
|
if (onThinking) {
|
|
36198
36236
|
const thinkingResults = executionResults.filter(
|
|
36199
36237
|
(r) => !r.name || executorMap.get(r.name)?.skipContinuation !== true
|