@anuma/sdk 6.36.0 → 6.37.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/expo/index.cjs +299 -181
- package/dist/expo/index.d.mts +30 -1
- package/dist/expo/index.d.ts +30 -1
- package/dist/expo/index.mjs +306 -189
- package/dist/index.cjs +150 -74
- package/dist/index.d.mts +30 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.mjs +149 -74
- package/dist/react/index.cjs +344 -226
- package/dist/react/index.d.mts +30 -1
- package/dist/react/index.d.ts +30 -1
- package/dist/react/index.mjs +351 -234
- package/dist/server/index.cjs +43 -1
- package/dist/server/index.mjs +43 -1
- package/dist/tools/index.cjs +74 -12
- package/dist/tools/index.d.mts +16 -3
- package/dist/tools/index.d.ts +16 -3
- package/dist/tools/index.mjs +73 -12
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -20350,6 +20350,46 @@ init_clientConfig();
|
|
|
20350
20350
|
|
|
20351
20351
|
// src/tools/confirmConstants.ts
|
|
20352
20352
|
var CONFIRM_TOOL_NAME = "prompt_user_confirm";
|
|
20353
|
+
var BOOK_RESTAURANT = {
|
|
20354
|
+
tool: "AnumaPaymentsMCP-anuma_book_restaurant",
|
|
20355
|
+
status: "confirmed_not_booked",
|
|
20356
|
+
fields: ["venue_id", "config_id", "party_size", "day", "venue_name", "time"]
|
|
20357
|
+
};
|
|
20358
|
+
var CANCEL_RESERVATION = {
|
|
20359
|
+
tool: "AnumaPaymentsMCP-anuma_cancel_reservation",
|
|
20360
|
+
status: "confirmed_not_cancelled",
|
|
20361
|
+
fields: [
|
|
20362
|
+
"reservation_id",
|
|
20363
|
+
"venue_name",
|
|
20364
|
+
"day",
|
|
20365
|
+
"time",
|
|
20366
|
+
"party_size",
|
|
20367
|
+
"fee_applies",
|
|
20368
|
+
"fee_amount"
|
|
20369
|
+
]
|
|
20370
|
+
};
|
|
20371
|
+
var CONFIRM_REQUIRED_FIELDS = /* @__PURE__ */ new Map([
|
|
20372
|
+
["book_restaurant", BOOK_RESTAURANT],
|
|
20373
|
+
["anuma_book_restaurant", BOOK_RESTAURANT],
|
|
20374
|
+
["anumapaymentsmcp-anuma_book_restaurant", BOOK_RESTAURANT],
|
|
20375
|
+
["cancel_reservation", CANCEL_RESERVATION],
|
|
20376
|
+
["anuma_cancel_reservation", CANCEL_RESERVATION],
|
|
20377
|
+
["anumapaymentsmcp-anuma_cancel_reservation", CANCEL_RESERVATION]
|
|
20378
|
+
]);
|
|
20379
|
+
function confirmRequirement(action) {
|
|
20380
|
+
if (typeof action !== "string") return void 0;
|
|
20381
|
+
return CONFIRM_REQUIRED_FIELDS.get(action.trim().toLowerCase());
|
|
20382
|
+
}
|
|
20383
|
+
function missingConfirmFields(action, parameters) {
|
|
20384
|
+
const requirement = confirmRequirement(action);
|
|
20385
|
+
if (!requirement) return [];
|
|
20386
|
+
const shown = /* @__PURE__ */ new Set();
|
|
20387
|
+
for (const parameter of Array.isArray(parameters) ? parameters : []) {
|
|
20388
|
+
const { name, value } = parameter ?? {};
|
|
20389
|
+
if (typeof name === "string" && typeof value === "string" && value.trim()) shown.add(name);
|
|
20390
|
+
}
|
|
20391
|
+
return requirement.fields.filter((field10) => !shown.has(field10));
|
|
20392
|
+
}
|
|
20353
20393
|
|
|
20354
20394
|
// src/lib/chat/toolLoop.ts
|
|
20355
20395
|
init_redactor();
|
|
@@ -23219,6 +23259,7 @@ function getToolName(tool) {
|
|
|
23219
23259
|
}
|
|
23220
23260
|
function toolsAfterConfirmation(apiTools, executionResults) {
|
|
23221
23261
|
const members = /* @__PURE__ */ new Set();
|
|
23262
|
+
let keepConfirm = false;
|
|
23222
23263
|
for (const r of executionResults) {
|
|
23223
23264
|
if (r.name !== CONFIRM_TOOL_NAME) continue;
|
|
23224
23265
|
const answer = r.result;
|
|
@@ -23226,11 +23267,12 @@ function toolsAfterConfirmation(apiTools, executionResults) {
|
|
|
23226
23267
|
const setName = CONFIRMED_ACTION_TOOL_SETS.get(answer.action.trim().toLowerCase());
|
|
23227
23268
|
const set = BUILT_IN_TOOL_SETS.find((s) => s.name === setName);
|
|
23228
23269
|
for (const member of set?.members ?? []) members.add(member);
|
|
23270
|
+
if (missingConfirmFields(answer.action, answer.parameters).length > 0) keepConfirm = true;
|
|
23229
23271
|
}
|
|
23230
23272
|
if (!apiTools.some((t) => members.has(getToolName(t) ?? ""))) return void 0;
|
|
23231
23273
|
return apiTools.filter((t) => {
|
|
23232
23274
|
const name = getToolName(t) ?? "";
|
|
23233
|
-
return members.has(name) || name ===
|
|
23275
|
+
return members.has(name) || name === TOOL_SEARCH_TOOL_NAME || keepConfirm && name === CONFIRM_TOOL_NAME;
|
|
23234
23276
|
});
|
|
23235
23277
|
}
|
|
23236
23278
|
var STREAM_RESUMABLE_HEADER = "X-Stream-Resumable";
|
package/dist/server/index.mjs
CHANGED
|
@@ -18687,6 +18687,46 @@ function createCryptoPricePreProcessor(options = {}) {
|
|
|
18687
18687
|
|
|
18688
18688
|
// src/tools/confirmConstants.ts
|
|
18689
18689
|
var CONFIRM_TOOL_NAME = "prompt_user_confirm";
|
|
18690
|
+
var BOOK_RESTAURANT = {
|
|
18691
|
+
tool: "AnumaPaymentsMCP-anuma_book_restaurant",
|
|
18692
|
+
status: "confirmed_not_booked",
|
|
18693
|
+
fields: ["venue_id", "config_id", "party_size", "day", "venue_name", "time"]
|
|
18694
|
+
};
|
|
18695
|
+
var CANCEL_RESERVATION = {
|
|
18696
|
+
tool: "AnumaPaymentsMCP-anuma_cancel_reservation",
|
|
18697
|
+
status: "confirmed_not_cancelled",
|
|
18698
|
+
fields: [
|
|
18699
|
+
"reservation_id",
|
|
18700
|
+
"venue_name",
|
|
18701
|
+
"day",
|
|
18702
|
+
"time",
|
|
18703
|
+
"party_size",
|
|
18704
|
+
"fee_applies",
|
|
18705
|
+
"fee_amount"
|
|
18706
|
+
]
|
|
18707
|
+
};
|
|
18708
|
+
var CONFIRM_REQUIRED_FIELDS = /* @__PURE__ */ new Map([
|
|
18709
|
+
["book_restaurant", BOOK_RESTAURANT],
|
|
18710
|
+
["anuma_book_restaurant", BOOK_RESTAURANT],
|
|
18711
|
+
["anumapaymentsmcp-anuma_book_restaurant", BOOK_RESTAURANT],
|
|
18712
|
+
["cancel_reservation", CANCEL_RESERVATION],
|
|
18713
|
+
["anuma_cancel_reservation", CANCEL_RESERVATION],
|
|
18714
|
+
["anumapaymentsmcp-anuma_cancel_reservation", CANCEL_RESERVATION]
|
|
18715
|
+
]);
|
|
18716
|
+
function confirmRequirement(action) {
|
|
18717
|
+
if (typeof action !== "string") return void 0;
|
|
18718
|
+
return CONFIRM_REQUIRED_FIELDS.get(action.trim().toLowerCase());
|
|
18719
|
+
}
|
|
18720
|
+
function missingConfirmFields(action, parameters) {
|
|
18721
|
+
const requirement = confirmRequirement(action);
|
|
18722
|
+
if (!requirement) return [];
|
|
18723
|
+
const shown = /* @__PURE__ */ new Set();
|
|
18724
|
+
for (const parameter of Array.isArray(parameters) ? parameters : []) {
|
|
18725
|
+
const { name, value } = parameter ?? {};
|
|
18726
|
+
if (typeof name === "string" && typeof value === "string" && value.trim()) shown.add(name);
|
|
18727
|
+
}
|
|
18728
|
+
return requirement.fields.filter((field10) => !shown.has(field10));
|
|
18729
|
+
}
|
|
18690
18730
|
|
|
18691
18731
|
// src/lib/storage/mcpImages.ts
|
|
18692
18732
|
var IMAGE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
@@ -21548,6 +21588,7 @@ function getToolName(tool) {
|
|
|
21548
21588
|
}
|
|
21549
21589
|
function toolsAfterConfirmation(apiTools, executionResults) {
|
|
21550
21590
|
const members = /* @__PURE__ */ new Set();
|
|
21591
|
+
let keepConfirm = false;
|
|
21551
21592
|
for (const r of executionResults) {
|
|
21552
21593
|
if (r.name !== CONFIRM_TOOL_NAME) continue;
|
|
21553
21594
|
const answer = r.result;
|
|
@@ -21555,11 +21596,12 @@ function toolsAfterConfirmation(apiTools, executionResults) {
|
|
|
21555
21596
|
const setName = CONFIRMED_ACTION_TOOL_SETS.get(answer.action.trim().toLowerCase());
|
|
21556
21597
|
const set = BUILT_IN_TOOL_SETS.find((s) => s.name === setName);
|
|
21557
21598
|
for (const member of set?.members ?? []) members.add(member);
|
|
21599
|
+
if (missingConfirmFields(answer.action, answer.parameters).length > 0) keepConfirm = true;
|
|
21558
21600
|
}
|
|
21559
21601
|
if (!apiTools.some((t) => members.has(getToolName(t) ?? ""))) return void 0;
|
|
21560
21602
|
return apiTools.filter((t) => {
|
|
21561
21603
|
const name = getToolName(t) ?? "";
|
|
21562
|
-
return members.has(name) || name ===
|
|
21604
|
+
return members.has(name) || name === TOOL_SEARCH_TOOL_NAME || keepConfirm && name === CONFIRM_TOOL_NAME;
|
|
21563
21605
|
});
|
|
21564
21606
|
}
|
|
21565
21607
|
var STREAM_RESUMABLE_HEADER = "X-Stream-Resumable";
|
package/dist/tools/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
AgentresError: () => AgentresError,
|
|
36
36
|
AgentresPathError: () => AgentresPathError,
|
|
37
37
|
AnumaJsxError: () => AnumaJsxError,
|
|
38
|
+
CHOICE_TOOL_NAME: () => CHOICE_TOOL_NAME,
|
|
38
39
|
CONNECTOR_ERROR_MARKER: () => CONNECTOR_ERROR_MARKER,
|
|
39
40
|
CREATE_DOCUMENT_SCHEMA: () => CREATE_DOCUMENT_SCHEMA,
|
|
40
41
|
CREATE_FILE_SCHEMA: () => CREATE_FILE_SCHEMA,
|
|
@@ -2596,9 +2597,10 @@ function createChartTool(options) {
|
|
|
2596
2597
|
}
|
|
2597
2598
|
|
|
2598
2599
|
// src/tools/choice.ts
|
|
2600
|
+
var CHOICE_TOOL_NAME = "prompt_user_choice";
|
|
2599
2601
|
function createChoiceTool(options) {
|
|
2600
2602
|
return createInteractiveTool(options, {
|
|
2601
|
-
name:
|
|
2603
|
+
name: CHOICE_TOOL_NAME,
|
|
2602
2604
|
description: "Show a clickable choice menu when the user needs to pick between specific options. Examples: choosing a restaurant for dinner or selecting a travel destination.",
|
|
2603
2605
|
parameters: {
|
|
2604
2606
|
type: "object",
|
|
@@ -2660,10 +2662,59 @@ function createChoiceTool(options) {
|
|
|
2660
2662
|
|
|
2661
2663
|
// src/tools/confirmConstants.ts
|
|
2662
2664
|
var CONFIRM_TOOL_NAME = "prompt_user_confirm";
|
|
2665
|
+
var BOOK_RESTAURANT = {
|
|
2666
|
+
tool: "AnumaPaymentsMCP-anuma_book_restaurant",
|
|
2667
|
+
status: "confirmed_not_booked",
|
|
2668
|
+
fields: ["venue_id", "config_id", "party_size", "day", "venue_name", "time"]
|
|
2669
|
+
};
|
|
2670
|
+
var CANCEL_RESERVATION = {
|
|
2671
|
+
tool: "AnumaPaymentsMCP-anuma_cancel_reservation",
|
|
2672
|
+
status: "confirmed_not_cancelled",
|
|
2673
|
+
fields: [
|
|
2674
|
+
"reservation_id",
|
|
2675
|
+
"venue_name",
|
|
2676
|
+
"day",
|
|
2677
|
+
"time",
|
|
2678
|
+
"party_size",
|
|
2679
|
+
"fee_applies",
|
|
2680
|
+
"fee_amount"
|
|
2681
|
+
]
|
|
2682
|
+
};
|
|
2683
|
+
var CONFIRM_REQUIRED_FIELDS = /* @__PURE__ */ new Map([
|
|
2684
|
+
["book_restaurant", BOOK_RESTAURANT],
|
|
2685
|
+
["anuma_book_restaurant", BOOK_RESTAURANT],
|
|
2686
|
+
["anumapaymentsmcp-anuma_book_restaurant", BOOK_RESTAURANT],
|
|
2687
|
+
["cancel_reservation", CANCEL_RESERVATION],
|
|
2688
|
+
["anuma_cancel_reservation", CANCEL_RESERVATION],
|
|
2689
|
+
["anumapaymentsmcp-anuma_cancel_reservation", CANCEL_RESERVATION]
|
|
2690
|
+
]);
|
|
2691
|
+
function confirmRequirement(action) {
|
|
2692
|
+
if (typeof action !== "string") return void 0;
|
|
2693
|
+
return CONFIRM_REQUIRED_FIELDS.get(action.trim().toLowerCase());
|
|
2694
|
+
}
|
|
2695
|
+
function missingConfirmFields(action, parameters) {
|
|
2696
|
+
const requirement = confirmRequirement(action);
|
|
2697
|
+
if (!requirement) return [];
|
|
2698
|
+
const shown = /* @__PURE__ */ new Set();
|
|
2699
|
+
for (const parameter of Array.isArray(parameters) ? parameters : []) {
|
|
2700
|
+
const { name, value } = parameter ?? {};
|
|
2701
|
+
if (typeof name === "string" && typeof value === "string" && value.trim()) shown.add(name);
|
|
2702
|
+
}
|
|
2703
|
+
return requirement.fields.filter((field) => !shown.has(field));
|
|
2704
|
+
}
|
|
2663
2705
|
|
|
2664
2706
|
// src/tools/confirm.ts
|
|
2707
|
+
function isWellFormedCard(args) {
|
|
2708
|
+
const { title, action, parameters } = args;
|
|
2709
|
+
if (typeof title !== "string" || !title) return false;
|
|
2710
|
+
if (typeof action !== "string" || !action) return false;
|
|
2711
|
+
if (!Array.isArray(parameters) || parameters.length === 0) return false;
|
|
2712
|
+
return parameters.every((parameter) => {
|
|
2713
|
+
return typeof parameter?.name === "string" && !!parameter.name && typeof parameter.label === "string" && !!parameter.label && typeof parameter.value === "string";
|
|
2714
|
+
});
|
|
2715
|
+
}
|
|
2665
2716
|
function createConfirmTool(options) {
|
|
2666
|
-
|
|
2717
|
+
const tool = createInteractiveTool(options, {
|
|
2667
2718
|
name: CONFIRM_TOOL_NAME,
|
|
2668
2719
|
description: "Ask the user to approve a specific action before it happens. Use before anything that spends money or is hard to undo, such as booking or cancelling a restaurant table, or placing an order. List every parameter of the action, with the exact values you are about to use \u2014 the user approves what this card shows, and nothing else. Returns whether they confirmed. Do not use for ordinary yes/no questions; use prompt_user_choice for those.",
|
|
2669
2720
|
parameters: {
|
|
@@ -2707,25 +2758,35 @@ function createConfirmTool(options) {
|
|
|
2707
2758
|
required: ["title", "action", "parameters"]
|
|
2708
2759
|
},
|
|
2709
2760
|
interactionType: "confirm",
|
|
2710
|
-
validate:
|
|
2711
|
-
const { title, action, parameters } = args;
|
|
2712
|
-
if (typeof title !== "string" || !title) return false;
|
|
2713
|
-
if (typeof action !== "string" || !action) return false;
|
|
2714
|
-
if (!Array.isArray(parameters) || parameters.length === 0) return false;
|
|
2715
|
-
return parameters.every((parameter) => {
|
|
2716
|
-
return typeof parameter?.name === "string" && !!parameter.name && typeof parameter.label === "string" && !!parameter.label && typeof parameter.value === "string";
|
|
2717
|
-
});
|
|
2718
|
-
},
|
|
2761
|
+
validate: isWellFormedCard,
|
|
2719
2762
|
mapResult: (result, args) => {
|
|
2720
2763
|
if (typeof result.confirmed !== "boolean") return { cancelled: true };
|
|
2764
|
+
const requirement = result.confirmed ? confirmRequirement(args.action) : void 0;
|
|
2721
2765
|
return {
|
|
2722
2766
|
confirmed: result.confirmed,
|
|
2723
2767
|
action: args.action,
|
|
2724
2768
|
parameters: args.parameters,
|
|
2725
|
-
answeredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2769
|
+
answeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2770
|
+
...requirement && {
|
|
2771
|
+
status: requirement.status,
|
|
2772
|
+
next_step: `call ${requirement.tool} now with these exact values`
|
|
2773
|
+
}
|
|
2726
2774
|
};
|
|
2727
2775
|
}
|
|
2728
2776
|
});
|
|
2777
|
+
const showCard = tool.executor;
|
|
2778
|
+
return {
|
|
2779
|
+
...tool,
|
|
2780
|
+
executor: (args, signal) => {
|
|
2781
|
+
const missing = missingConfirmFields(args.action, args.parameters);
|
|
2782
|
+
if (missing.length > 0) {
|
|
2783
|
+
return Promise.resolve({
|
|
2784
|
+
error: `card is missing ${missing.join(", ")}; look them up and call ${CONFIRM_TOOL_NAME} again with every field`
|
|
2785
|
+
});
|
|
2786
|
+
}
|
|
2787
|
+
return showCard?.(args, signal);
|
|
2788
|
+
}
|
|
2789
|
+
};
|
|
2729
2790
|
}
|
|
2730
2791
|
|
|
2731
2792
|
// src/tools/connectorOffer.ts
|
|
@@ -13839,6 +13900,7 @@ function createXTools(callProxy) {
|
|
|
13839
13900
|
AgentresError,
|
|
13840
13901
|
AgentresPathError,
|
|
13841
13902
|
AnumaJsxError,
|
|
13903
|
+
CHOICE_TOOL_NAME,
|
|
13842
13904
|
CONNECTOR_ERROR_MARKER,
|
|
13843
13905
|
CREATE_DOCUMENT_SCHEMA,
|
|
13844
13906
|
CREATE_FILE_SCHEMA,
|
package/dist/tools/index.d.mts
CHANGED
|
@@ -1411,6 +1411,8 @@ type DisplayChartResult = {
|
|
|
1411
1411
|
*/
|
|
1412
1412
|
declare function createChartTool(options: CreateUIToolsOptions): ToolConfig;
|
|
1413
1413
|
|
|
1414
|
+
/** Tool name surfaced to the LLM. */
|
|
1415
|
+
declare const CHOICE_TOOL_NAME = "prompt_user_choice";
|
|
1414
1416
|
type ChoiceOption = {
|
|
1415
1417
|
/** Unique identifier for this option */
|
|
1416
1418
|
value: string;
|
|
@@ -1448,8 +1450,9 @@ type ConfirmParameter = {
|
|
|
1448
1450
|
value: string;
|
|
1449
1451
|
};
|
|
1450
1452
|
/**
|
|
1451
|
-
* What the tool returns: the user's answer,
|
|
1452
|
-
*
|
|
1453
|
+
* What the tool returns: the user's answer, `{ cancelled: true }` when nobody
|
|
1454
|
+
* answered, or `{ error }` when a restaurant card lacked a required field and
|
|
1455
|
+
* was never shown.
|
|
1453
1456
|
*/
|
|
1454
1457
|
type ConfirmToolResult = {
|
|
1455
1458
|
/** True when the user agreed, false when they declined. */
|
|
@@ -1460,6 +1463,16 @@ type ConfirmToolResult = {
|
|
|
1460
1463
|
parameters: ConfirmParameter[];
|
|
1461
1464
|
/** ISO-8601 timestamp of the answer, for a server-side freshness window. */
|
|
1462
1465
|
answeredAt: string;
|
|
1466
|
+
/**
|
|
1467
|
+
* On an approved restaurant action: `confirmed_not_booked` or
|
|
1468
|
+
* `confirmed_not_cancelled`. Approval alone changes nothing.
|
|
1469
|
+
*/
|
|
1470
|
+
status?: "confirmed_not_booked" | "confirmed_not_cancelled";
|
|
1471
|
+
/** On an approved restaurant action: the call that carries it out. */
|
|
1472
|
+
next_step?: string;
|
|
1473
|
+
} | {
|
|
1474
|
+
/** Why no card was shown, worded for the model. */
|
|
1475
|
+
error: string;
|
|
1463
1476
|
} | {
|
|
1464
1477
|
/** Timed out, cleared, never shown, or the card replied without a decision. */
|
|
1465
1478
|
cancelled: true;
|
|
@@ -2826,4 +2839,4 @@ interface XGetMyPostsArgs {
|
|
|
2826
2839
|
*/
|
|
2827
2840
|
declare function createXTools(callProxy: XProxyCaller): Record<string, ToolConfig>;
|
|
2828
2841
|
|
|
2829
|
-
export { ADD_SLIDE_SCHEMA, APP_BUILDER_PROMPT, APP_COMPLETE_CONNECT_ACK_TYPE, APP_COMPLETE_CONNECT_TYPE, APP_COMPLETE_DEFAULT_TIMEOUT_MS, APP_COMPLETE_IFRAME_SHIM_SCRIPT, APP_COMPLETE_REQUEST_TYPE, APP_COMPLETE_RESPONSE_TYPE, APP_COMPLETE_STUB_SCRIPT, APP_FILE_TOOL_NAMES, APP_PREVIEW_BASELINE_CSS, AUDIT_DESIGN_SCHEMA, type AgentresAccount, type AgentresClient, type AgentresClientOptions, AgentresError, type AgentresErrorCode, type AgentresLinkStatus, type AgentresLinkStep, AgentresPathError, type AnchorMatch, type AnumaChild, AnumaJsxError, type AnumaNode, type AppCompleteBridge, type AppCompleteBridgeOptions, type AppFileRecord, type AppFileStorage, type AttrValue, type AuditIssue, type AuditIssueType, type AuditResult, type AuditSeverity, type AuditTokens, type BuildSlideSystemPromptOptions, CONNECTOR_ERROR_MARKER, CREATE_DOCUMENT_SCHEMA, CREATE_FILE_SCHEMA, CRITIQUE_DESIGN_SCHEMA, type CalendarEvent, type ChartDataPoint, type ChoiceOption, type ConfirmParameter, type ConfirmToolResult, type ConnectorErrorCode, type ConnectorMintError, type ConnectorMintResult, type ConnectorTokenGetterOpts, type ConnectorTokenSource, type CreateAppGenerationToolsOptions, type CreateDocumentToolsOptions, type CreateEventArgs, type CreateFileArgs, type CreateSlideToolsOptions, type CreateUIToolsOptions, type CreateWeatherToolOptions, DEFAULT_DESIGN_CRITIQUE_RUBRIC, DEFAULT_DOCUMENT_ID, DEFAULT_MAX_CONVERSATIONS, DEFAULT_MAX_DOCUMENT_CONVERSATIONS, DELETE_FILE_SCHEMA, DOCUMENT_BUILDER_PROMPT, DOCUMENT_TOOL_NAMES, type DisplayChartResult, type DisplayConnectorResult, type DisplayPhoneCallOfferResult, type DisplayToolConfig, type DisplayToolMigrations, type DisplayWeatherResult, type DocAttrValue, type DocChild, DocDslError, type DocNode, type DriveFile, type DropboxRequestAccess, type DropboxTokenGetter, type ExportAppOptions, FONT_LIBRARY, FONT_PRESETS, type FileChangeEvent, type FileSnippet, type FontCategory, type FontPreset, type FontSpec, type ForecastDay, type FormField, type FormFieldOption, type FormFieldType, type GetFileContentArgs, type GmailGetMessageArgs, type GmailMessageDetail, type GmailMessageSummary, type GmailRequestAccess, type GmailSearchArgs, type GmailSendMessageArgs, type GmailTokenGetter, type InteractiveToolConfig, type KnownTag, LAYOUT_MODES, LIST_FILES_SCHEMA, type LayoutMode, type LegacyDeckJson, type ListEventsArgs, type ListRecentFilesArgs, MapFileStorage, type NotionCreatePagesArgs, type NotionFetchArgs, type NotionMcpCaller, type NotionMovePagesArgs, type NotionSearchArgs, type NotionUpdatePageArgs, PATCH_DOCUMENT_SCHEMA, PATCH_FILE_SCHEMA, PATCH_SLIDES_SCHEMA, PLAN_DECK_SCHEMA, type PatchFailure, type PatchFailureReason, type PdfTag, READ_DOCUMENT_SCHEMA, READ_FILE_SCHEMA, READ_SLIDES_SCHEMA, RUNTIME_ERROR_OVERLAY_SCRIPT, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, type SearchFilesArgs, SiwxChallengeError, SiwxUnsupportedError, type SlackGetChannelHistoryArgs, type SlackGetThreadRepliesArgs, type SlackListChannelsArgs, type SlackListDmsArgs, type SlackListUsersArgs, type SlackPostMessageArgs, type SlackProxyCaller, type SlackSearchMessagesArgs, type SlideToolSet, type SolanaSignMessageFn, THEME_ATTRS, type ThemeAttr, type ToolConfig, type ToolExecutionErrorType, type ToolExecutionResult, type UIInteractionContext, type UpdateEventArgs, type UpdateFileArgs, VERIFY_APP_SCHEMA, type VerifyAppResult, type XGetMeArgs, type XGetMyPostsArgs, type XProxyCaller, applyPatches, auditDesign, buildAppFileManifest, buildAppSystemPrompt, buildConnectorErrorResult, buildDocumentSystemPrompt, buildFontsUrl, buildSlideSystemPrompt, callNotionMCPTool, connectorMintErrorToToolResult, convertLegacyDeckJson, createAgentresClient, createAppCompleteBridge, createAppGenerationTools, createChartTool, createChatTools, createChoiceTool, createConfirmTool, createConnectorOfferTool, createConnectorTokenGetter, createDisplayTool, createDocumentTools, createDriveTools, createDropboxTools, createFormTool, createGitHubTools, createGmailTools, createGoogleCalendarCreateEventTool, createGoogleCalendarTool, createGoogleCalendarUpdateEventTool, createGoogleDriveCreateFileTool, createGoogleDriveGetContentTool, createGoogleDriveListRecentTool, createGoogleDriveSearchTool, createGoogleDriveUpdateFileTool, createInteractiveTool, createNotionCreateCommentTool, createNotionCreateDatabaseTool, createNotionCreatePagesTool, createNotionDuplicatePageTool, createNotionFetchTool, createNotionGetCommentsTool, createNotionGetTeamsTool, createNotionGetUsersTool, createNotionMovePagesTool, createNotionProxyTools, createNotionSearchTool, createNotionTools, createNotionUpdateDataSourceTool, createNotionUpdatePageTool, createPhoneCallOfferTool, createSlackTools, createSlideTools, createWeatherTool, createXTools, documentPath, exportAppToHtml, findById, findParentOfId, getFontByName, getId, getMCPEndpoints, getNumberAttr, getStringAttr, insertAfterId, insertChild, installAppCompleteIframeShim, isAnumaTag, isHtmlTag, isKnownFont, isLegacyDeckJson, isPdfTag, migrateDisplayResult, normalizePath, parseDocumentDsl, parseJsx, pdfStyleKeys, pdfTags, removeById, replaceById, serializeJsx, truncateContent, updateAttrs, walk };
|
|
2842
|
+
export { ADD_SLIDE_SCHEMA, APP_BUILDER_PROMPT, APP_COMPLETE_CONNECT_ACK_TYPE, APP_COMPLETE_CONNECT_TYPE, APP_COMPLETE_DEFAULT_TIMEOUT_MS, APP_COMPLETE_IFRAME_SHIM_SCRIPT, APP_COMPLETE_REQUEST_TYPE, APP_COMPLETE_RESPONSE_TYPE, APP_COMPLETE_STUB_SCRIPT, APP_FILE_TOOL_NAMES, APP_PREVIEW_BASELINE_CSS, AUDIT_DESIGN_SCHEMA, type AgentresAccount, type AgentresClient, type AgentresClientOptions, AgentresError, type AgentresErrorCode, type AgentresLinkStatus, type AgentresLinkStep, AgentresPathError, type AnchorMatch, type AnumaChild, AnumaJsxError, type AnumaNode, type AppCompleteBridge, type AppCompleteBridgeOptions, type AppFileRecord, type AppFileStorage, type AttrValue, type AuditIssue, type AuditIssueType, type AuditResult, type AuditSeverity, type AuditTokens, type BuildSlideSystemPromptOptions, CHOICE_TOOL_NAME, CONNECTOR_ERROR_MARKER, CREATE_DOCUMENT_SCHEMA, CREATE_FILE_SCHEMA, CRITIQUE_DESIGN_SCHEMA, type CalendarEvent, type ChartDataPoint, type ChoiceOption, type ConfirmParameter, type ConfirmToolResult, type ConnectorErrorCode, type ConnectorMintError, type ConnectorMintResult, type ConnectorTokenGetterOpts, type ConnectorTokenSource, type CreateAppGenerationToolsOptions, type CreateDocumentToolsOptions, type CreateEventArgs, type CreateFileArgs, type CreateSlideToolsOptions, type CreateUIToolsOptions, type CreateWeatherToolOptions, DEFAULT_DESIGN_CRITIQUE_RUBRIC, DEFAULT_DOCUMENT_ID, DEFAULT_MAX_CONVERSATIONS, DEFAULT_MAX_DOCUMENT_CONVERSATIONS, DELETE_FILE_SCHEMA, DOCUMENT_BUILDER_PROMPT, DOCUMENT_TOOL_NAMES, type DisplayChartResult, type DisplayConnectorResult, type DisplayPhoneCallOfferResult, type DisplayToolConfig, type DisplayToolMigrations, type DisplayWeatherResult, type DocAttrValue, type DocChild, DocDslError, type DocNode, type DriveFile, type DropboxRequestAccess, type DropboxTokenGetter, type ExportAppOptions, FONT_LIBRARY, FONT_PRESETS, type FileChangeEvent, type FileSnippet, type FontCategory, type FontPreset, type FontSpec, type ForecastDay, type FormField, type FormFieldOption, type FormFieldType, type GetFileContentArgs, type GmailGetMessageArgs, type GmailMessageDetail, type GmailMessageSummary, type GmailRequestAccess, type GmailSearchArgs, type GmailSendMessageArgs, type GmailTokenGetter, type InteractiveToolConfig, type KnownTag, LAYOUT_MODES, LIST_FILES_SCHEMA, type LayoutMode, type LegacyDeckJson, type ListEventsArgs, type ListRecentFilesArgs, MapFileStorage, type NotionCreatePagesArgs, type NotionFetchArgs, type NotionMcpCaller, type NotionMovePagesArgs, type NotionSearchArgs, type NotionUpdatePageArgs, PATCH_DOCUMENT_SCHEMA, PATCH_FILE_SCHEMA, PATCH_SLIDES_SCHEMA, PLAN_DECK_SCHEMA, type PatchFailure, type PatchFailureReason, type PdfTag, READ_DOCUMENT_SCHEMA, READ_FILE_SCHEMA, READ_SLIDES_SCHEMA, RUNTIME_ERROR_OVERLAY_SCRIPT, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, type SearchFilesArgs, SiwxChallengeError, SiwxUnsupportedError, type SlackGetChannelHistoryArgs, type SlackGetThreadRepliesArgs, type SlackListChannelsArgs, type SlackListDmsArgs, type SlackListUsersArgs, type SlackPostMessageArgs, type SlackProxyCaller, type SlackSearchMessagesArgs, type SlideToolSet, type SolanaSignMessageFn, THEME_ATTRS, type ThemeAttr, type ToolConfig, type ToolExecutionErrorType, type ToolExecutionResult, type UIInteractionContext, type UpdateEventArgs, type UpdateFileArgs, VERIFY_APP_SCHEMA, type VerifyAppResult, type XGetMeArgs, type XGetMyPostsArgs, type XProxyCaller, applyPatches, auditDesign, buildAppFileManifest, buildAppSystemPrompt, buildConnectorErrorResult, buildDocumentSystemPrompt, buildFontsUrl, buildSlideSystemPrompt, callNotionMCPTool, connectorMintErrorToToolResult, convertLegacyDeckJson, createAgentresClient, createAppCompleteBridge, createAppGenerationTools, createChartTool, createChatTools, createChoiceTool, createConfirmTool, createConnectorOfferTool, createConnectorTokenGetter, createDisplayTool, createDocumentTools, createDriveTools, createDropboxTools, createFormTool, createGitHubTools, createGmailTools, createGoogleCalendarCreateEventTool, createGoogleCalendarTool, createGoogleCalendarUpdateEventTool, createGoogleDriveCreateFileTool, createGoogleDriveGetContentTool, createGoogleDriveListRecentTool, createGoogleDriveSearchTool, createGoogleDriveUpdateFileTool, createInteractiveTool, createNotionCreateCommentTool, createNotionCreateDatabaseTool, createNotionCreatePagesTool, createNotionDuplicatePageTool, createNotionFetchTool, createNotionGetCommentsTool, createNotionGetTeamsTool, createNotionGetUsersTool, createNotionMovePagesTool, createNotionProxyTools, createNotionSearchTool, createNotionTools, createNotionUpdateDataSourceTool, createNotionUpdatePageTool, createPhoneCallOfferTool, createSlackTools, createSlideTools, createWeatherTool, createXTools, documentPath, exportAppToHtml, findById, findParentOfId, getFontByName, getId, getMCPEndpoints, getNumberAttr, getStringAttr, insertAfterId, insertChild, installAppCompleteIframeShim, isAnumaTag, isHtmlTag, isKnownFont, isLegacyDeckJson, isPdfTag, migrateDisplayResult, normalizePath, parseDocumentDsl, parseJsx, pdfStyleKeys, pdfTags, removeById, replaceById, serializeJsx, truncateContent, updateAttrs, walk };
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1411,6 +1411,8 @@ type DisplayChartResult = {
|
|
|
1411
1411
|
*/
|
|
1412
1412
|
declare function createChartTool(options: CreateUIToolsOptions): ToolConfig;
|
|
1413
1413
|
|
|
1414
|
+
/** Tool name surfaced to the LLM. */
|
|
1415
|
+
declare const CHOICE_TOOL_NAME = "prompt_user_choice";
|
|
1414
1416
|
type ChoiceOption = {
|
|
1415
1417
|
/** Unique identifier for this option */
|
|
1416
1418
|
value: string;
|
|
@@ -1448,8 +1450,9 @@ type ConfirmParameter = {
|
|
|
1448
1450
|
value: string;
|
|
1449
1451
|
};
|
|
1450
1452
|
/**
|
|
1451
|
-
* What the tool returns: the user's answer,
|
|
1452
|
-
*
|
|
1453
|
+
* What the tool returns: the user's answer, `{ cancelled: true }` when nobody
|
|
1454
|
+
* answered, or `{ error }` when a restaurant card lacked a required field and
|
|
1455
|
+
* was never shown.
|
|
1453
1456
|
*/
|
|
1454
1457
|
type ConfirmToolResult = {
|
|
1455
1458
|
/** True when the user agreed, false when they declined. */
|
|
@@ -1460,6 +1463,16 @@ type ConfirmToolResult = {
|
|
|
1460
1463
|
parameters: ConfirmParameter[];
|
|
1461
1464
|
/** ISO-8601 timestamp of the answer, for a server-side freshness window. */
|
|
1462
1465
|
answeredAt: string;
|
|
1466
|
+
/**
|
|
1467
|
+
* On an approved restaurant action: `confirmed_not_booked` or
|
|
1468
|
+
* `confirmed_not_cancelled`. Approval alone changes nothing.
|
|
1469
|
+
*/
|
|
1470
|
+
status?: "confirmed_not_booked" | "confirmed_not_cancelled";
|
|
1471
|
+
/** On an approved restaurant action: the call that carries it out. */
|
|
1472
|
+
next_step?: string;
|
|
1473
|
+
} | {
|
|
1474
|
+
/** Why no card was shown, worded for the model. */
|
|
1475
|
+
error: string;
|
|
1463
1476
|
} | {
|
|
1464
1477
|
/** Timed out, cleared, never shown, or the card replied without a decision. */
|
|
1465
1478
|
cancelled: true;
|
|
@@ -2826,4 +2839,4 @@ interface XGetMyPostsArgs {
|
|
|
2826
2839
|
*/
|
|
2827
2840
|
declare function createXTools(callProxy: XProxyCaller): Record<string, ToolConfig>;
|
|
2828
2841
|
|
|
2829
|
-
export { ADD_SLIDE_SCHEMA, APP_BUILDER_PROMPT, APP_COMPLETE_CONNECT_ACK_TYPE, APP_COMPLETE_CONNECT_TYPE, APP_COMPLETE_DEFAULT_TIMEOUT_MS, APP_COMPLETE_IFRAME_SHIM_SCRIPT, APP_COMPLETE_REQUEST_TYPE, APP_COMPLETE_RESPONSE_TYPE, APP_COMPLETE_STUB_SCRIPT, APP_FILE_TOOL_NAMES, APP_PREVIEW_BASELINE_CSS, AUDIT_DESIGN_SCHEMA, type AgentresAccount, type AgentresClient, type AgentresClientOptions, AgentresError, type AgentresErrorCode, type AgentresLinkStatus, type AgentresLinkStep, AgentresPathError, type AnchorMatch, type AnumaChild, AnumaJsxError, type AnumaNode, type AppCompleteBridge, type AppCompleteBridgeOptions, type AppFileRecord, type AppFileStorage, type AttrValue, type AuditIssue, type AuditIssueType, type AuditResult, type AuditSeverity, type AuditTokens, type BuildSlideSystemPromptOptions, CONNECTOR_ERROR_MARKER, CREATE_DOCUMENT_SCHEMA, CREATE_FILE_SCHEMA, CRITIQUE_DESIGN_SCHEMA, type CalendarEvent, type ChartDataPoint, type ChoiceOption, type ConfirmParameter, type ConfirmToolResult, type ConnectorErrorCode, type ConnectorMintError, type ConnectorMintResult, type ConnectorTokenGetterOpts, type ConnectorTokenSource, type CreateAppGenerationToolsOptions, type CreateDocumentToolsOptions, type CreateEventArgs, type CreateFileArgs, type CreateSlideToolsOptions, type CreateUIToolsOptions, type CreateWeatherToolOptions, DEFAULT_DESIGN_CRITIQUE_RUBRIC, DEFAULT_DOCUMENT_ID, DEFAULT_MAX_CONVERSATIONS, DEFAULT_MAX_DOCUMENT_CONVERSATIONS, DELETE_FILE_SCHEMA, DOCUMENT_BUILDER_PROMPT, DOCUMENT_TOOL_NAMES, type DisplayChartResult, type DisplayConnectorResult, type DisplayPhoneCallOfferResult, type DisplayToolConfig, type DisplayToolMigrations, type DisplayWeatherResult, type DocAttrValue, type DocChild, DocDslError, type DocNode, type DriveFile, type DropboxRequestAccess, type DropboxTokenGetter, type ExportAppOptions, FONT_LIBRARY, FONT_PRESETS, type FileChangeEvent, type FileSnippet, type FontCategory, type FontPreset, type FontSpec, type ForecastDay, type FormField, type FormFieldOption, type FormFieldType, type GetFileContentArgs, type GmailGetMessageArgs, type GmailMessageDetail, type GmailMessageSummary, type GmailRequestAccess, type GmailSearchArgs, type GmailSendMessageArgs, type GmailTokenGetter, type InteractiveToolConfig, type KnownTag, LAYOUT_MODES, LIST_FILES_SCHEMA, type LayoutMode, type LegacyDeckJson, type ListEventsArgs, type ListRecentFilesArgs, MapFileStorage, type NotionCreatePagesArgs, type NotionFetchArgs, type NotionMcpCaller, type NotionMovePagesArgs, type NotionSearchArgs, type NotionUpdatePageArgs, PATCH_DOCUMENT_SCHEMA, PATCH_FILE_SCHEMA, PATCH_SLIDES_SCHEMA, PLAN_DECK_SCHEMA, type PatchFailure, type PatchFailureReason, type PdfTag, READ_DOCUMENT_SCHEMA, READ_FILE_SCHEMA, READ_SLIDES_SCHEMA, RUNTIME_ERROR_OVERLAY_SCRIPT, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, type SearchFilesArgs, SiwxChallengeError, SiwxUnsupportedError, type SlackGetChannelHistoryArgs, type SlackGetThreadRepliesArgs, type SlackListChannelsArgs, type SlackListDmsArgs, type SlackListUsersArgs, type SlackPostMessageArgs, type SlackProxyCaller, type SlackSearchMessagesArgs, type SlideToolSet, type SolanaSignMessageFn, THEME_ATTRS, type ThemeAttr, type ToolConfig, type ToolExecutionErrorType, type ToolExecutionResult, type UIInteractionContext, type UpdateEventArgs, type UpdateFileArgs, VERIFY_APP_SCHEMA, type VerifyAppResult, type XGetMeArgs, type XGetMyPostsArgs, type XProxyCaller, applyPatches, auditDesign, buildAppFileManifest, buildAppSystemPrompt, buildConnectorErrorResult, buildDocumentSystemPrompt, buildFontsUrl, buildSlideSystemPrompt, callNotionMCPTool, connectorMintErrorToToolResult, convertLegacyDeckJson, createAgentresClient, createAppCompleteBridge, createAppGenerationTools, createChartTool, createChatTools, createChoiceTool, createConfirmTool, createConnectorOfferTool, createConnectorTokenGetter, createDisplayTool, createDocumentTools, createDriveTools, createDropboxTools, createFormTool, createGitHubTools, createGmailTools, createGoogleCalendarCreateEventTool, createGoogleCalendarTool, createGoogleCalendarUpdateEventTool, createGoogleDriveCreateFileTool, createGoogleDriveGetContentTool, createGoogleDriveListRecentTool, createGoogleDriveSearchTool, createGoogleDriveUpdateFileTool, createInteractiveTool, createNotionCreateCommentTool, createNotionCreateDatabaseTool, createNotionCreatePagesTool, createNotionDuplicatePageTool, createNotionFetchTool, createNotionGetCommentsTool, createNotionGetTeamsTool, createNotionGetUsersTool, createNotionMovePagesTool, createNotionProxyTools, createNotionSearchTool, createNotionTools, createNotionUpdateDataSourceTool, createNotionUpdatePageTool, createPhoneCallOfferTool, createSlackTools, createSlideTools, createWeatherTool, createXTools, documentPath, exportAppToHtml, findById, findParentOfId, getFontByName, getId, getMCPEndpoints, getNumberAttr, getStringAttr, insertAfterId, insertChild, installAppCompleteIframeShim, isAnumaTag, isHtmlTag, isKnownFont, isLegacyDeckJson, isPdfTag, migrateDisplayResult, normalizePath, parseDocumentDsl, parseJsx, pdfStyleKeys, pdfTags, removeById, replaceById, serializeJsx, truncateContent, updateAttrs, walk };
|
|
2842
|
+
export { ADD_SLIDE_SCHEMA, APP_BUILDER_PROMPT, APP_COMPLETE_CONNECT_ACK_TYPE, APP_COMPLETE_CONNECT_TYPE, APP_COMPLETE_DEFAULT_TIMEOUT_MS, APP_COMPLETE_IFRAME_SHIM_SCRIPT, APP_COMPLETE_REQUEST_TYPE, APP_COMPLETE_RESPONSE_TYPE, APP_COMPLETE_STUB_SCRIPT, APP_FILE_TOOL_NAMES, APP_PREVIEW_BASELINE_CSS, AUDIT_DESIGN_SCHEMA, type AgentresAccount, type AgentresClient, type AgentresClientOptions, AgentresError, type AgentresErrorCode, type AgentresLinkStatus, type AgentresLinkStep, AgentresPathError, type AnchorMatch, type AnumaChild, AnumaJsxError, type AnumaNode, type AppCompleteBridge, type AppCompleteBridgeOptions, type AppFileRecord, type AppFileStorage, type AttrValue, type AuditIssue, type AuditIssueType, type AuditResult, type AuditSeverity, type AuditTokens, type BuildSlideSystemPromptOptions, CHOICE_TOOL_NAME, CONNECTOR_ERROR_MARKER, CREATE_DOCUMENT_SCHEMA, CREATE_FILE_SCHEMA, CRITIQUE_DESIGN_SCHEMA, type CalendarEvent, type ChartDataPoint, type ChoiceOption, type ConfirmParameter, type ConfirmToolResult, type ConnectorErrorCode, type ConnectorMintError, type ConnectorMintResult, type ConnectorTokenGetterOpts, type ConnectorTokenSource, type CreateAppGenerationToolsOptions, type CreateDocumentToolsOptions, type CreateEventArgs, type CreateFileArgs, type CreateSlideToolsOptions, type CreateUIToolsOptions, type CreateWeatherToolOptions, DEFAULT_DESIGN_CRITIQUE_RUBRIC, DEFAULT_DOCUMENT_ID, DEFAULT_MAX_CONVERSATIONS, DEFAULT_MAX_DOCUMENT_CONVERSATIONS, DELETE_FILE_SCHEMA, DOCUMENT_BUILDER_PROMPT, DOCUMENT_TOOL_NAMES, type DisplayChartResult, type DisplayConnectorResult, type DisplayPhoneCallOfferResult, type DisplayToolConfig, type DisplayToolMigrations, type DisplayWeatherResult, type DocAttrValue, type DocChild, DocDslError, type DocNode, type DriveFile, type DropboxRequestAccess, type DropboxTokenGetter, type ExportAppOptions, FONT_LIBRARY, FONT_PRESETS, type FileChangeEvent, type FileSnippet, type FontCategory, type FontPreset, type FontSpec, type ForecastDay, type FormField, type FormFieldOption, type FormFieldType, type GetFileContentArgs, type GmailGetMessageArgs, type GmailMessageDetail, type GmailMessageSummary, type GmailRequestAccess, type GmailSearchArgs, type GmailSendMessageArgs, type GmailTokenGetter, type InteractiveToolConfig, type KnownTag, LAYOUT_MODES, LIST_FILES_SCHEMA, type LayoutMode, type LegacyDeckJson, type ListEventsArgs, type ListRecentFilesArgs, MapFileStorage, type NotionCreatePagesArgs, type NotionFetchArgs, type NotionMcpCaller, type NotionMovePagesArgs, type NotionSearchArgs, type NotionUpdatePageArgs, PATCH_DOCUMENT_SCHEMA, PATCH_FILE_SCHEMA, PATCH_SLIDES_SCHEMA, PLAN_DECK_SCHEMA, type PatchFailure, type PatchFailureReason, type PdfTag, READ_DOCUMENT_SCHEMA, READ_FILE_SCHEMA, READ_SLIDES_SCHEMA, RUNTIME_ERROR_OVERLAY_SCRIPT, SLIDES_FILE_PATH, SLIDE_CANVAS_HEIGHT, SLIDE_CANVAS_WIDTH, type SearchFilesArgs, SiwxChallengeError, SiwxUnsupportedError, type SlackGetChannelHistoryArgs, type SlackGetThreadRepliesArgs, type SlackListChannelsArgs, type SlackListDmsArgs, type SlackListUsersArgs, type SlackPostMessageArgs, type SlackProxyCaller, type SlackSearchMessagesArgs, type SlideToolSet, type SolanaSignMessageFn, THEME_ATTRS, type ThemeAttr, type ToolConfig, type ToolExecutionErrorType, type ToolExecutionResult, type UIInteractionContext, type UpdateEventArgs, type UpdateFileArgs, VERIFY_APP_SCHEMA, type VerifyAppResult, type XGetMeArgs, type XGetMyPostsArgs, type XProxyCaller, applyPatches, auditDesign, buildAppFileManifest, buildAppSystemPrompt, buildConnectorErrorResult, buildDocumentSystemPrompt, buildFontsUrl, buildSlideSystemPrompt, callNotionMCPTool, connectorMintErrorToToolResult, convertLegacyDeckJson, createAgentresClient, createAppCompleteBridge, createAppGenerationTools, createChartTool, createChatTools, createChoiceTool, createConfirmTool, createConnectorOfferTool, createConnectorTokenGetter, createDisplayTool, createDocumentTools, createDriveTools, createDropboxTools, createFormTool, createGitHubTools, createGmailTools, createGoogleCalendarCreateEventTool, createGoogleCalendarTool, createGoogleCalendarUpdateEventTool, createGoogleDriveCreateFileTool, createGoogleDriveGetContentTool, createGoogleDriveListRecentTool, createGoogleDriveSearchTool, createGoogleDriveUpdateFileTool, createInteractiveTool, createNotionCreateCommentTool, createNotionCreateDatabaseTool, createNotionCreatePagesTool, createNotionDuplicatePageTool, createNotionFetchTool, createNotionGetCommentsTool, createNotionGetTeamsTool, createNotionGetUsersTool, createNotionMovePagesTool, createNotionProxyTools, createNotionSearchTool, createNotionTools, createNotionUpdateDataSourceTool, createNotionUpdatePageTool, createPhoneCallOfferTool, createSlackTools, createSlideTools, createWeatherTool, createXTools, documentPath, exportAppToHtml, findById, findParentOfId, getFontByName, getId, getMCPEndpoints, getNumberAttr, getStringAttr, insertAfterId, insertChild, installAppCompleteIframeShim, isAnumaTag, isHtmlTag, isKnownFont, isLegacyDeckJson, isPdfTag, migrateDisplayResult, normalizePath, parseDocumentDsl, parseJsx, pdfStyleKeys, pdfTags, removeById, replaceById, serializeJsx, truncateContent, updateAttrs, walk };
|
package/dist/tools/index.mjs
CHANGED
|
@@ -2440,9 +2440,10 @@ function createChartTool(options) {
|
|
|
2440
2440
|
}
|
|
2441
2441
|
|
|
2442
2442
|
// src/tools/choice.ts
|
|
2443
|
+
var CHOICE_TOOL_NAME = "prompt_user_choice";
|
|
2443
2444
|
function createChoiceTool(options) {
|
|
2444
2445
|
return createInteractiveTool(options, {
|
|
2445
|
-
name:
|
|
2446
|
+
name: CHOICE_TOOL_NAME,
|
|
2446
2447
|
description: "Show a clickable choice menu when the user needs to pick between specific options. Examples: choosing a restaurant for dinner or selecting a travel destination.",
|
|
2447
2448
|
parameters: {
|
|
2448
2449
|
type: "object",
|
|
@@ -2504,10 +2505,59 @@ function createChoiceTool(options) {
|
|
|
2504
2505
|
|
|
2505
2506
|
// src/tools/confirmConstants.ts
|
|
2506
2507
|
var CONFIRM_TOOL_NAME = "prompt_user_confirm";
|
|
2508
|
+
var BOOK_RESTAURANT = {
|
|
2509
|
+
tool: "AnumaPaymentsMCP-anuma_book_restaurant",
|
|
2510
|
+
status: "confirmed_not_booked",
|
|
2511
|
+
fields: ["venue_id", "config_id", "party_size", "day", "venue_name", "time"]
|
|
2512
|
+
};
|
|
2513
|
+
var CANCEL_RESERVATION = {
|
|
2514
|
+
tool: "AnumaPaymentsMCP-anuma_cancel_reservation",
|
|
2515
|
+
status: "confirmed_not_cancelled",
|
|
2516
|
+
fields: [
|
|
2517
|
+
"reservation_id",
|
|
2518
|
+
"venue_name",
|
|
2519
|
+
"day",
|
|
2520
|
+
"time",
|
|
2521
|
+
"party_size",
|
|
2522
|
+
"fee_applies",
|
|
2523
|
+
"fee_amount"
|
|
2524
|
+
]
|
|
2525
|
+
};
|
|
2526
|
+
var CONFIRM_REQUIRED_FIELDS = /* @__PURE__ */ new Map([
|
|
2527
|
+
["book_restaurant", BOOK_RESTAURANT],
|
|
2528
|
+
["anuma_book_restaurant", BOOK_RESTAURANT],
|
|
2529
|
+
["anumapaymentsmcp-anuma_book_restaurant", BOOK_RESTAURANT],
|
|
2530
|
+
["cancel_reservation", CANCEL_RESERVATION],
|
|
2531
|
+
["anuma_cancel_reservation", CANCEL_RESERVATION],
|
|
2532
|
+
["anumapaymentsmcp-anuma_cancel_reservation", CANCEL_RESERVATION]
|
|
2533
|
+
]);
|
|
2534
|
+
function confirmRequirement(action) {
|
|
2535
|
+
if (typeof action !== "string") return void 0;
|
|
2536
|
+
return CONFIRM_REQUIRED_FIELDS.get(action.trim().toLowerCase());
|
|
2537
|
+
}
|
|
2538
|
+
function missingConfirmFields(action, parameters) {
|
|
2539
|
+
const requirement = confirmRequirement(action);
|
|
2540
|
+
if (!requirement) return [];
|
|
2541
|
+
const shown = /* @__PURE__ */ new Set();
|
|
2542
|
+
for (const parameter of Array.isArray(parameters) ? parameters : []) {
|
|
2543
|
+
const { name, value } = parameter ?? {};
|
|
2544
|
+
if (typeof name === "string" && typeof value === "string" && value.trim()) shown.add(name);
|
|
2545
|
+
}
|
|
2546
|
+
return requirement.fields.filter((field) => !shown.has(field));
|
|
2547
|
+
}
|
|
2507
2548
|
|
|
2508
2549
|
// src/tools/confirm.ts
|
|
2550
|
+
function isWellFormedCard(args) {
|
|
2551
|
+
const { title, action, parameters } = args;
|
|
2552
|
+
if (typeof title !== "string" || !title) return false;
|
|
2553
|
+
if (typeof action !== "string" || !action) return false;
|
|
2554
|
+
if (!Array.isArray(parameters) || parameters.length === 0) return false;
|
|
2555
|
+
return parameters.every((parameter) => {
|
|
2556
|
+
return typeof parameter?.name === "string" && !!parameter.name && typeof parameter.label === "string" && !!parameter.label && typeof parameter.value === "string";
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2509
2559
|
function createConfirmTool(options) {
|
|
2510
|
-
|
|
2560
|
+
const tool = createInteractiveTool(options, {
|
|
2511
2561
|
name: CONFIRM_TOOL_NAME,
|
|
2512
2562
|
description: "Ask the user to approve a specific action before it happens. Use before anything that spends money or is hard to undo, such as booking or cancelling a restaurant table, or placing an order. List every parameter of the action, with the exact values you are about to use \u2014 the user approves what this card shows, and nothing else. Returns whether they confirmed. Do not use for ordinary yes/no questions; use prompt_user_choice for those.",
|
|
2513
2563
|
parameters: {
|
|
@@ -2551,25 +2601,35 @@ function createConfirmTool(options) {
|
|
|
2551
2601
|
required: ["title", "action", "parameters"]
|
|
2552
2602
|
},
|
|
2553
2603
|
interactionType: "confirm",
|
|
2554
|
-
validate:
|
|
2555
|
-
const { title, action, parameters } = args;
|
|
2556
|
-
if (typeof title !== "string" || !title) return false;
|
|
2557
|
-
if (typeof action !== "string" || !action) return false;
|
|
2558
|
-
if (!Array.isArray(parameters) || parameters.length === 0) return false;
|
|
2559
|
-
return parameters.every((parameter) => {
|
|
2560
|
-
return typeof parameter?.name === "string" && !!parameter.name && typeof parameter.label === "string" && !!parameter.label && typeof parameter.value === "string";
|
|
2561
|
-
});
|
|
2562
|
-
},
|
|
2604
|
+
validate: isWellFormedCard,
|
|
2563
2605
|
mapResult: (result, args) => {
|
|
2564
2606
|
if (typeof result.confirmed !== "boolean") return { cancelled: true };
|
|
2607
|
+
const requirement = result.confirmed ? confirmRequirement(args.action) : void 0;
|
|
2565
2608
|
return {
|
|
2566
2609
|
confirmed: result.confirmed,
|
|
2567
2610
|
action: args.action,
|
|
2568
2611
|
parameters: args.parameters,
|
|
2569
|
-
answeredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2612
|
+
answeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2613
|
+
...requirement && {
|
|
2614
|
+
status: requirement.status,
|
|
2615
|
+
next_step: `call ${requirement.tool} now with these exact values`
|
|
2616
|
+
}
|
|
2570
2617
|
};
|
|
2571
2618
|
}
|
|
2572
2619
|
});
|
|
2620
|
+
const showCard = tool.executor;
|
|
2621
|
+
return {
|
|
2622
|
+
...tool,
|
|
2623
|
+
executor: (args, signal) => {
|
|
2624
|
+
const missing = missingConfirmFields(args.action, args.parameters);
|
|
2625
|
+
if (missing.length > 0) {
|
|
2626
|
+
return Promise.resolve({
|
|
2627
|
+
error: `card is missing ${missing.join(", ")}; look them up and call ${CONFIRM_TOOL_NAME} again with every field`
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
return showCard?.(args, signal);
|
|
2631
|
+
}
|
|
2632
|
+
};
|
|
2573
2633
|
}
|
|
2574
2634
|
|
|
2575
2635
|
// src/tools/connectorOffer.ts
|
|
@@ -13682,6 +13742,7 @@ export {
|
|
|
13682
13742
|
AgentresError,
|
|
13683
13743
|
AgentresPathError,
|
|
13684
13744
|
AnumaJsxError,
|
|
13745
|
+
CHOICE_TOOL_NAME,
|
|
13685
13746
|
CONNECTOR_ERROR_MARKER,
|
|
13686
13747
|
CREATE_DOCUMENT_SCHEMA,
|
|
13687
13748
|
CREATE_FILE_SCHEMA,
|