@anuma/sdk 6.33.1 → 6.33.2
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/design/index.cjs +0 -2
- package/dist/design/index.d.mts +0 -7
- package/dist/design/index.d.ts +0 -7
- package/dist/design/index.mjs +0 -2
- package/dist/expo/{chunk-XD6WOQ5I.mjs → chunk-GQBTAM6Y.mjs} +0 -70
- package/dist/expo/{consolidate-7DBUHQRK.mjs → consolidate-3H2WY3FU.mjs} +1 -8
- package/dist/expo/index.cjs +15394 -16278
- package/dist/expo/index.d.mts +5734 -6660
- package/dist/expo/index.d.ts +5734 -6660
- package/dist/expo/index.mjs +15231 -16034
- package/dist/index.cjs +2258 -2411
- package/dist/index.d.mts +914 -1054
- package/dist/index.d.ts +914 -1054
- package/dist/index.mjs +2258 -2409
- package/dist/memory/context.d.mts +0 -73
- package/dist/memory/context.d.ts +0 -73
- package/dist/next/index.cjs +1 -8
- package/dist/next/index.mjs +1 -8
- package/dist/pii/transformers.d.mts +0 -32
- package/dist/pii/transformers.d.ts +0 -32
- package/dist/react/{chunk-XNQRJBIH.mjs → chunk-UFO4W3JX.mjs} +0 -70
- package/dist/react/{consolidate-5DVINCUE.mjs → consolidate-RHIAUBT4.mjs} +1 -8
- package/dist/react/index.cjs +32415 -33395
- package/dist/react/index.d.mts +13354 -14553
- package/dist/react/index.d.ts +13354 -14553
- package/dist/react/index.mjs +32556 -33457
- package/dist/server/{chunk-KSYV7UO2.mjs → chunk-4RGGAOAJ.mjs} +835 -905
- package/dist/server/{consolidate-MCNBSUXD.mjs → consolidate-YEGACWLR.mjs} +1 -8
- package/dist/server/index.cjs +22313 -23120
- package/dist/server/index.d.mts +5353 -6300
- package/dist/server/index.d.ts +5353 -6300
- package/dist/server/index.mjs +18789 -19531
- package/dist/telemetry/index.cjs +0 -9
- package/dist/telemetry/index.d.mts +88 -198
- package/dist/telemetry/index.d.ts +88 -198
- package/dist/telemetry/index.mjs +0 -9
- package/dist/tools/index.cjs +13036 -13347
- package/dist/tools/index.d.mts +2434 -2729
- package/dist/tools/index.d.ts +2434 -2729
- package/dist/tools/index.mjs +13036 -13347
- package/dist/tools/selection/index.cjs +0 -116
- package/dist/tools/selection/index.d.mts +0 -159
- package/dist/tools/selection/index.d.ts +0 -159
- package/dist/tools/selection/index.mjs +0 -116
- package/package.json +1 -1
|
@@ -77,13 +77,6 @@ type ToolConfig = LlmapiChatCompletionTool & {
|
|
|
77
77
|
dependsOn?: string[];
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
/**
|
|
81
|
-
* Server-side tools caching module
|
|
82
|
-
*
|
|
83
|
-
* Fetches and caches tools from /api/v1/tools endpoint
|
|
84
|
-
* with configurable expiration and localStorage persistence.
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
80
|
/** Tool parameters schema */
|
|
88
81
|
interface ToolParameters {
|
|
89
82
|
properties: Record<string, unknown>;
|
|
@@ -808,23 +801,6 @@ interface SelectServerSideToolsOptions {
|
|
|
808
801
|
*/
|
|
809
802
|
declare function selectServerSideTools(options: SelectServerSideToolsOptions): Promise<Array<Record<string, unknown>>>;
|
|
810
803
|
|
|
811
|
-
/**
|
|
812
|
-
* Client-tool selection — the per-turn semantic filter over a client-tool
|
|
813
|
-
* catalog.
|
|
814
|
-
*
|
|
815
|
-
* Extracted out of `../../react/useChatStorage` (a `"use client"` React +
|
|
816
|
-
* WatermelonDB file) so the identical selection can run anywhere the engine
|
|
817
|
-
* runs: the standalone council path that bypasses the hook, Node unit tests,
|
|
818
|
-
* and the node/RN-safe `@anuma/sdk/tools/selection` subpath. The hook re-imports
|
|
819
|
-
* these — behavior is unchanged from when they lived inline.
|
|
820
|
-
*
|
|
821
|
-
* Dependency-safe by construction: `generateEmbeddings` comes from the db-free
|
|
822
|
-
* `../memoryEngine/generate` core, `RECALL_TOOL_NAME` from the
|
|
823
|
-
* dependency-free `../memory/recallConstants`, and `CONFIRM_TOOL_NAME` from the
|
|
824
|
-
* dependency-free `../../tools/confirmConstants`, so nothing here drags in the
|
|
825
|
-
* WatermelonDB data layer.
|
|
826
|
-
*/
|
|
827
|
-
|
|
828
804
|
/** Typed accessor for client tool name (handles function-call style and flat). */
|
|
829
805
|
declare function getToolName(t: LlmapiChatCompletionTool): string;
|
|
830
806
|
/** Typed accessor for client tool description. */
|
|
@@ -868,35 +844,6 @@ noEmbeddingsReason?: "short-prompt" | "error"): Promise<{
|
|
|
868
844
|
matchedSetNames: ReadonlySet<string>;
|
|
869
845
|
}>;
|
|
870
846
|
|
|
871
|
-
/**
|
|
872
|
-
* Connector tool catalog + denied-tools system-prompt rider.
|
|
873
|
-
*
|
|
874
|
-
* Granular connector access works by ALLOW/DENY-ing individual SDK tools.
|
|
875
|
-
* Denying a tool means it's never handed to the model that turn, so it
|
|
876
|
-
* physically can't be called — bypass-proof at the model layer.
|
|
877
|
-
*
|
|
878
|
-
* Consumer contract (this PR ships the foundation only — it does NOT wire
|
|
879
|
-
* anything into runtime filtering or the client; those are later phases):
|
|
880
|
-
*
|
|
881
|
-
* 1. Hide the denied tools from the model — pass the denied tool names as
|
|
882
|
-
* `createServerToolsFilter({ excludeTools })` so they're dropped from the
|
|
883
|
-
* toolset before it reaches the LLM.
|
|
884
|
-
* 2. Tell the user how to re-enable — append `buildDeniedToolsRider(denied)`
|
|
885
|
-
* to the system prompt. Because the tool is absent, the model can't name
|
|
886
|
-
* it on its own and would give a generic "I don't have access". The rider
|
|
887
|
-
* gives it the specific capability names (grouped by connector) so it can
|
|
888
|
-
* tell the user to re-enable that exact tool in Connected Apps settings.
|
|
889
|
-
*
|
|
890
|
-
* `TOOL_CATALOG` is the single source of truth for connector tool → friendly
|
|
891
|
-
* label + provider. `provider` is the canonical logical-provider identifier the
|
|
892
|
-
* portal and SDK already key on (matches `internal/oauth/providers.go` and the
|
|
893
|
-
* `createConnectorTokenGetter` call sites) — Phase 2/3 use it to group and
|
|
894
|
-
* persist per-tool denial. `connector` is the human-facing UI display string.
|
|
895
|
-
* Consumers (portal, client) read this on a version bump rather than re-encoding
|
|
896
|
-
* tool names. Labels are placeholders that will be refined later — keep them
|
|
897
|
-
* sensible.
|
|
898
|
-
*/
|
|
899
|
-
|
|
900
847
|
interface ToolCatalogEntry {
|
|
901
848
|
label: string;
|
|
902
849
|
/** Canonical logical-provider id (e.g. "gmail", "gcalendar", "gdrive"). */
|
|
@@ -956,22 +903,6 @@ interface ConnectorGuidance {
|
|
|
956
903
|
*/
|
|
957
904
|
declare function buildConnectorGuidance(input: ConnectorGuidanceInput): ConnectorGuidance;
|
|
958
905
|
|
|
959
|
-
/**
|
|
960
|
-
* `deriveActiveToolSets` — event-shape-agnostic sticky tool-set derivation
|
|
961
|
-
* (issue #702, Phase 4).
|
|
962
|
-
*
|
|
963
|
-
* Web derived sticky sets by scanning `ChatMessage[]` for two web-specific
|
|
964
|
-
* signals: synthetic tool-result user messages (`Tool "<name>" returned: …`)
|
|
965
|
-
* and `ActivityPhase.id`s shaped `server-tool-<name>-<n>`. This module keeps the
|
|
966
|
-
* exact matching logic but keys on a neutral {@link ToolActivationEvent[]}, so
|
|
967
|
-
* both apps feed it through a tiny adapter that maps their own message/activity
|
|
968
|
-
* store to events. That closes the terse-follow-up gap on mobile: a 3-char
|
|
969
|
-
* "yes" inside a slide conversation keeps the slide toolkit because the set
|
|
970
|
-
* stays sticky.
|
|
971
|
-
*
|
|
972
|
-
* Pure and node/RN-safe.
|
|
973
|
-
*/
|
|
974
|
-
|
|
975
906
|
/**
|
|
976
907
|
* A neutral activation signal derived from conversation history.
|
|
977
908
|
*
|
|
@@ -1004,26 +935,6 @@ declare function deriveActiveToolSets(events: ToolActivationEvent[], sets?: read
|
|
|
1004
935
|
*/
|
|
1005
936
|
declare function mergeActiveToolSets(current: string[], derived: string[]): string[];
|
|
1006
937
|
|
|
1007
|
-
/**
|
|
1008
|
-
* Tool-selection vocabulary — the neutral, product-agnostic types that let the
|
|
1009
|
-
* SDK own the "which tools this turn" orchestration both `apps/web` and
|
|
1010
|
-
* `apps/mobile` previously hand-duplicated (see issue #702).
|
|
1011
|
-
*
|
|
1012
|
-
* The split of ownership is deliberate:
|
|
1013
|
-
*
|
|
1014
|
-
* - The SDK owns the neutral {@link CreationIntent}→client-factory mapping
|
|
1015
|
-
* ({@link CREATION_INTENT_CLIENT_FACTORIES}) and the send-policy rules.
|
|
1016
|
-
* - Each app owns its UI→{@link ToolIntentDescriptor} mapper and injects a
|
|
1017
|
-
* {@link ServerToolCatalog} (built from its own static server-tool lists) and
|
|
1018
|
-
* {@link ../assembleClientTools.ToolSelectionAdapters | adapters}. The SDK
|
|
1019
|
-
* never imports the app's tool lists — the dependency direction stays
|
|
1020
|
-
* app→SDK.
|
|
1021
|
-
*
|
|
1022
|
-
* This module has no runtime dependency on React, the DOM, WatermelonDB, or the
|
|
1023
|
-
* generated HTTP client, so it is safe to import from the node/RN-safe
|
|
1024
|
-
* `@anuma/sdk/tools/selection` subpath.
|
|
1025
|
-
*/
|
|
1026
|
-
|
|
1027
938
|
/**
|
|
1028
939
|
* Which orchestration path a turn runs through.
|
|
1029
940
|
*
|
|
@@ -1223,27 +1134,6 @@ declare const CREATION_INTENT_CLIENT_FILTER: Record<CreationIntent, ClientToolsF
|
|
|
1223
1134
|
*/
|
|
1224
1135
|
declare const CREATION_INTENT_TOOL_SET: Partial<Record<CreationIntent, string>>;
|
|
1225
1136
|
|
|
1226
|
-
/**
|
|
1227
|
-
* `assembleClientTools` — capability-gated client-tool assembly (issue #702,
|
|
1228
|
-
* Phase 3). Given a resolved plan's `clientFactories` and a set of adapters, it
|
|
1229
|
-
* instantiates only the factories whose adapter is present and concatenates
|
|
1230
|
-
* them in a canonical order.
|
|
1231
|
-
*
|
|
1232
|
-
* The presence of an adapter GATES its factory — the generalization of
|
|
1233
|
-
* `createDocumentTools` returning `[]` when `displayDocument` is absent
|
|
1234
|
-
* (src/tools/document/index.ts). This is what lets ONE unified plan produce
|
|
1235
|
-
* web's full toolkit and mobile's subset automatically: web wires every
|
|
1236
|
-
* builder, mobile wires only the ones its RN surface supports, and the absent
|
|
1237
|
-
* ones contribute nothing.
|
|
1238
|
-
*
|
|
1239
|
-
* The SDK deliberately owns the GATING, ORDER, and filter application — not the
|
|
1240
|
-
* per-factory wiring. Each app's factory instantiation (slide auto-display,
|
|
1241
|
-
* app-lineage tracking, RN-vs-web storage, logging instrumentation) is
|
|
1242
|
-
* genuinely app-specific and stays app-side, expressed as a builder here.
|
|
1243
|
-
*
|
|
1244
|
-
* Pure and node/RN-safe.
|
|
1245
|
-
*/
|
|
1246
|
-
|
|
1247
1137
|
/** Minimal logger the assembler uses when a builder throws. */
|
|
1248
1138
|
interface SelectionLogger {
|
|
1249
1139
|
warn(message: string, context?: unknown): void;
|
|
@@ -1300,18 +1190,6 @@ declare function filterAssembledClientTools<TTool = ToolConfig>(tools: TTool[],
|
|
|
1300
1190
|
getName?: (t: TTool) => string;
|
|
1301
1191
|
}): TTool[] | Promise<TTool[]>;
|
|
1302
1192
|
|
|
1303
|
-
/**
|
|
1304
|
-
* `resolvePlan` — the single source of truth for "which tools this turn"
|
|
1305
|
-
* (issue #702, Phase 2). Given a neutral {@link ToolIntentDescriptor} and an
|
|
1306
|
-
* app-injected {@link ServerToolCatalog}, it produces a fully-resolved
|
|
1307
|
-
* {@link ToolPlanSpec} that both web and mobile consume, replacing each app's
|
|
1308
|
-
* hand-written per-mode switch.
|
|
1309
|
-
*
|
|
1310
|
-
* Pure and node/RN-safe. The plan is data — the host feeds `clientFactories`
|
|
1311
|
-
* into `assembleClientTools`, and `serverTools`/`toolChoice`/`maxToolRounds`/
|
|
1312
|
-
* `thinkingMode` into its send layer.
|
|
1313
|
-
*/
|
|
1314
|
-
|
|
1315
1193
|
/** Context for {@link resolvePlan}: the injected catalog plus host defaults. */
|
|
1316
1194
|
interface ResolvePlanContext {
|
|
1317
1195
|
/** The app-built per-intent/-lane server-tool catalog. */
|
|
@@ -1343,23 +1221,6 @@ interface ResolvePlanContext {
|
|
|
1343
1221
|
*/
|
|
1344
1222
|
declare function resolvePlan(descriptor: ToolIntentDescriptor, ctx: ResolvePlanContext): ToolPlanSpec;
|
|
1345
1223
|
|
|
1346
|
-
/**
|
|
1347
|
-
* Council tool resolution (issue #702, Phase 6).
|
|
1348
|
-
*
|
|
1349
|
-
* The council path bypasses the per-mode chat switch: each worker sees the full
|
|
1350
|
-
* semantic server-tool filter and its OWN per-worker memory tools (built from
|
|
1351
|
-
* that worker's model so a private-capable model sees `['private','shared']`
|
|
1352
|
-
* and a standard model sees `['shared']` only). The aggregation ("unify")
|
|
1353
|
-
* worker must never persist — its `memory_vault_save` is dropped.
|
|
1354
|
-
*
|
|
1355
|
-
* This module composes each worker's client-tool candidate array and runs it
|
|
1356
|
-
* through the SAME `autoFilterClientTools` the chat hook uses, so council and
|
|
1357
|
-
* chat share one selection. Building this on the exported selector is what lets
|
|
1358
|
-
* mobile council gain per-worker memory tools without re-implementing anything.
|
|
1359
|
-
*
|
|
1360
|
-
* Pure and node/RN-safe.
|
|
1361
|
-
*/
|
|
1362
|
-
|
|
1363
1224
|
/**
|
|
1364
1225
|
* Resolve the council/aggregation server-tool plan. This is the chat resolver's
|
|
1365
1226
|
* council-lane path: a semantic server-tool filter, no per-mode client toolkit,
|
|
@@ -1414,16 +1275,6 @@ declare function selectCouncilClientTools<TTool extends LlmapiChatCompletionTool
|
|
|
1414
1275
|
activatedSetNames?: ReadonlySet<string>;
|
|
1415
1276
|
}>;
|
|
1416
1277
|
|
|
1417
|
-
/**
|
|
1418
|
-
* Send-policy primitives — the per-turn `tool_choice` / `maxToolRounds` /
|
|
1419
|
-
* thinking-mode / coerced-memory-write rules, unified so web and mobile stop
|
|
1420
|
-
* hand-duplicating them (issue #702, Phase 1).
|
|
1421
|
-
*
|
|
1422
|
-
* These were previously spread across web's `useChatSetup` + `useChatSubmitHandler`
|
|
1423
|
-
* + `webChatSendMessage` and mobile's `chatModeRouting`. They are pure and
|
|
1424
|
-
* node/RN-safe.
|
|
1425
|
-
*/
|
|
1426
|
-
|
|
1427
1278
|
/** The vault-save tool name — the one client tool stripped on a coerced turn. */
|
|
1428
1279
|
declare const MEMORY_SAVE_TOOL_NAME = "memory_vault_save";
|
|
1429
1280
|
/**
|
|
@@ -1465,16 +1316,6 @@ declare function getThinkingMode(entry: ServerToolCatalogEntry | undefined, fall
|
|
|
1465
1316
|
*/
|
|
1466
1317
|
declare function stripCoercedMemoryWrite<T extends LlmapiChatCompletionTool>(clientTools: T[], toolChoice: ToolChoice): T[];
|
|
1467
1318
|
|
|
1468
|
-
/**
|
|
1469
|
-
* Server-tools policy — resolve the concrete server-tools filter for a turn
|
|
1470
|
-
* from the app-injected {@link ServerToolCatalog} (issue #702, Phase 2).
|
|
1471
|
-
*
|
|
1472
|
-
* The catalog is opaque to the SDK: each app builds it from its own static
|
|
1473
|
-
* server-tool lists (`IMAGE_SERVER_TOOLS`, `SLIDE_SERVER_TOOLS`, …) and passes
|
|
1474
|
-
* it in. This module only knows how to pick the right entry and, when the entry
|
|
1475
|
-
* is an attachment-aware factory, apply it with the turn's context.
|
|
1476
|
-
*/
|
|
1477
|
-
|
|
1478
1319
|
/**
|
|
1479
1320
|
* Look up the catalog entry for a descriptor. Chat turns key on the creation
|
|
1480
1321
|
* intent; council/aggregation turns key on the lane.
|
|
@@ -903,8 +903,6 @@ async function embedOne(text, options, outer) {
|
|
|
903
903
|
(signal) => postApiV1Embeddings({
|
|
904
904
|
baseUrl,
|
|
905
905
|
body: {
|
|
906
|
-
// Mask PII from the request body only — the cache above still keys on
|
|
907
|
-
// the original `text`, so callers keep their original values.
|
|
908
906
|
input: options.maskInput ? options.maskInput(text) : text,
|
|
909
907
|
model: model ?? DEFAULT_API_EMBEDDING_MODEL
|
|
910
908
|
},
|
|
@@ -943,7 +941,6 @@ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage,
|
|
|
943
941
|
() => withDeadline(
|
|
944
942
|
(signal) => postApiV1Embeddings({
|
|
945
943
|
baseUrl,
|
|
946
|
-
// Mask PII from the request body only; cache/order still key on originals.
|
|
947
944
|
body: { input: maskInput ? texts.map(maskInput) : texts, model },
|
|
948
945
|
headers,
|
|
949
946
|
...signal && { signal }
|
|
@@ -1546,9 +1543,7 @@ function clientToolToResponsesFormat(tool) {
|
|
|
1546
1543
|
type: "function",
|
|
1547
1544
|
name: func.name,
|
|
1548
1545
|
description: func.description,
|
|
1549
|
-
// Handle both 'parameters' and 'arguments' field names
|
|
1550
1546
|
parameters: func.parameters ?? func.arguments,
|
|
1551
|
-
// Preserve executor functions for client-side execution
|
|
1552
1547
|
...toolConfig.executor && { executor: toolConfig.executor },
|
|
1553
1548
|
...toolConfig.skipContinuation !== void 0 && {
|
|
1554
1549
|
skipContinuation: toolConfig.skipContinuation
|
|
@@ -1584,7 +1579,6 @@ function clientToolToCompletionsFormat(tool) {
|
|
|
1584
1579
|
...restFunc,
|
|
1585
1580
|
parameters: args ?? { type: "object", properties: {} }
|
|
1586
1581
|
},
|
|
1587
|
-
// Preserve executor functions for client-side execution
|
|
1588
1582
|
...toolConfig.executor && { executor: toolConfig.executor },
|
|
1589
1583
|
...toolConfig.skipContinuation !== void 0 && {
|
|
1590
1584
|
skipContinuation: toolConfig.skipContinuation
|
|
@@ -1747,17 +1741,7 @@ function scoreTools(promptEmbeddings, tools) {
|
|
|
1747
1741
|
var BUILT_IN_TOOL_SETS = [
|
|
1748
1742
|
{
|
|
1749
1743
|
name: "app-generation",
|
|
1750
|
-
// Appended to the base prompt (not replacing it) whenever this set
|
|
1751
|
-
// activates, so the App Builder guidance — including the window.app.complete
|
|
1752
|
-
// runtime-AI contract — rides in with the app-gen tools via the same
|
|
1753
|
-
// semantic selection that includes them. Collected by toolSetSystemPrompts.
|
|
1754
1744
|
systemPrompt: APP_BUILDER_PROMPT,
|
|
1755
|
-
// Must stay in sync with APP_FILE_TOOL_NAMES in src/tools/appGeneration.ts.
|
|
1756
|
-
// If a new app-gen tool ships there but isn't added here, semantic
|
|
1757
|
-
// selection will exclude it on every request — the model literally
|
|
1758
|
-
// doesn't see it. The quality tools (audit_design / critique_design /
|
|
1759
|
-
// verify_app) are non-obvious to a user prompt ("build me a kanban")
|
|
1760
|
-
// and rely entirely on set expansion to reach the model.
|
|
1761
1745
|
members: [
|
|
1762
1746
|
"create_file",
|
|
1763
1747
|
"patch_file",
|
|
@@ -1768,52 +1752,20 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
1768
1752
|
"critique_design",
|
|
1769
1753
|
"verify_app"
|
|
1770
1754
|
],
|
|
1771
|
-
// Anchors stay limited to the primary entry-point tools. Users phrase
|
|
1772
|
-
// app intent as "build / make / fix" → semantic match on create_file
|
|
1773
|
-
// or patch_file → full set pulled in. The quality tools fire later in
|
|
1774
|
-
// the workflow and don't anchor on their own; including them as
|
|
1775
|
-
// anchors would risk pulling the set in on unrelated "audit my code"
|
|
1776
|
-
// prompts that have nothing to do with app generation.
|
|
1777
1755
|
anchors: ["create_file", "patch_file"],
|
|
1778
|
-
// 0.55: above the global filter floor (0.53) so a barely-relevant match
|
|
1779
|
-
// can't pull in the whole toolkit, but no higher — and we tried higher.
|
|
1780
|
-
// create_file scores chitchat ("what's up" ~0.56, "...about programming"
|
|
1781
|
-
// ~0.57) in the SAME band as legitimate app-EDIT prompts: "Edit the app to
|
|
1782
|
-
// change the background…" measured create_file 0.56 on one e2e run. Raising
|
|
1783
|
-
// the floor to 0.575 to exclude the chitchat therefore also stripped the
|
|
1784
|
-
// file tools from real edit requests — leaving the model unable to touch the
|
|
1785
|
-
// app at all. The bands genuinely overlap; there is no clean cut. So we keep
|
|
1786
|
-
// 0.55 (max recall) and rely on two safety nets instead: APP_BUILDER_PROMPT
|
|
1787
|
-
// is conditional (it no-ops unless the user is actually asking for an app),
|
|
1788
|
-
// and very short greetings ("hey") are filtered out earlier by the
|
|
1789
|
-
// MIN_CONTENT_LENGTH_FOR_TOOLS length gate before embeddings even run.
|
|
1790
1756
|
anchorMinSimilarity: 0.55
|
|
1791
1757
|
},
|
|
1792
1758
|
{
|
|
1793
1759
|
name: "slides",
|
|
1794
1760
|
members: ["plan_deck", "add_slide", "read_slides", "patch_slides"],
|
|
1795
1761
|
anchors: ["plan_deck", "patch_slides"],
|
|
1796
|
-
// Match the client-tool floor (0.53). Short colloquial prompts like
|
|
1797
|
-
// "make me a powerpoint about X" score plan_deck around 0.535 — above
|
|
1798
|
-
// the global floor but inside any anchor gap. plan_deck and patch_slides
|
|
1799
|
-
// are specific enough names that 0.53 won't false-positive in practice.
|
|
1800
1762
|
anchorMinSimilarity: 0.53
|
|
1801
1763
|
},
|
|
1802
1764
|
{
|
|
1803
1765
|
name: "documents",
|
|
1804
|
-
// Conditional rider (no-ops unless the user actually asks for a document),
|
|
1805
|
-
// attached so the Document Builder guidance rides in with the document
|
|
1806
|
-
// tools via the same semantic selection that includes them.
|
|
1807
1766
|
systemPrompt: DOCUMENT_BUILDER_PROMPT,
|
|
1808
1767
|
members: ["create_document", "read_document", "patch_document"],
|
|
1809
|
-
// Entry-point tools anchor; read_document rides in via set expansion.
|
|
1810
1768
|
anchors: ["create_document", "patch_document"],
|
|
1811
|
-
// 0.53: match the client-tool floor. "draft me a contract", "write a cover
|
|
1812
|
-
// letter", "make a memo" should pull the set in. Like app-gen's create_file,
|
|
1813
|
-
// document intent ("write me X") overlaps generic chitchat in this band, so
|
|
1814
|
-
// the same two safety nets apply: DOCUMENT_BUILDER_PROMPT is conditional and
|
|
1815
|
-
// the MIN_CONTENT_LENGTH_FOR_TOOLS gate drops bare greetings before
|
|
1816
|
-
// embeddings run. Tune empirically against the tool-selection parity suite.
|
|
1817
1769
|
anchorMinSimilarity: 0.53
|
|
1818
1770
|
},
|
|
1819
1771
|
{
|
|
@@ -1822,11 +1774,6 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
1822
1774
|
anchors: ["github_api"],
|
|
1823
1775
|
anchorMinSimilarity: 0.55
|
|
1824
1776
|
},
|
|
1825
|
-
// Connector sets (#587). Connector chat tools belong to no set, so per-message
|
|
1826
|
-
// semantic filtering silently prunes them on vague prompts ("check my email").
|
|
1827
|
-
// Grouping each connector's tools behind a search/action anchor keeps the
|
|
1828
|
-
// whole connector reachable once any one of its tools matches. Mirrors github:
|
|
1829
|
-
// no systemPrompt rider — per-set prompt guidance is a follow-up.
|
|
1830
1777
|
{
|
|
1831
1778
|
name: "gmail",
|
|
1832
1779
|
members: [
|
|
@@ -1883,9 +1830,6 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
1883
1830
|
"slack_get_thread_replies",
|
|
1884
1831
|
"slack_post_message"
|
|
1885
1832
|
],
|
|
1886
|
-
// search is the primary entry point; list_channels also anchors so "what
|
|
1887
|
-
// channels am I in" reaches the set without going through search. post_message
|
|
1888
|
-
// anchors too so post-only prompts surface the write tool past the cutoff.
|
|
1889
1833
|
anchors: ["slack_search_messages", "slack_list_channels", "slack_post_message"],
|
|
1890
1834
|
anchorMinSimilarity: 0.53
|
|
1891
1835
|
},
|
|
@@ -1896,15 +1840,6 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
1896
1840
|
anchorMinSimilarity: 0.53
|
|
1897
1841
|
},
|
|
1898
1842
|
{
|
|
1899
|
-
// Server tools, so this set does its work through
|
|
1900
|
-
// withActiveToolSetServerTools: once any restaurant tool has run, terse
|
|
1901
|
-
// follow-ups ("okay", "same as before", "cancel it") keep every restaurant
|
|
1902
|
-
// tool — discovery, booking and cancelling. Each tool still reaches a fresh
|
|
1903
|
-
// request on its own description.
|
|
1904
|
-
// Anchors are deliberately empty (like the client's Nearby set): the set
|
|
1905
|
-
// is only for stickiness, not a new way to activate on a prompt.
|
|
1906
|
-
// prompt_user_confirm is left out of members: autoFilterClientTools always
|
|
1907
|
-
// sends it, and as a member any unrelated confirmation would pin this set.
|
|
1908
1843
|
name: "restaurant-booking",
|
|
1909
1844
|
members: [
|
|
1910
1845
|
"AnumaPaymentsMCP-anuma_find_restaurant",
|
|
@@ -1917,10 +1852,6 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
1917
1852
|
anchors: []
|
|
1918
1853
|
},
|
|
1919
1854
|
{
|
|
1920
|
-
// What a confirmed booking card narrows the rest of the turn to (see
|
|
1921
|
-
// CONFIRMED_ACTION_TOOL_SETS): the booking chain only, without the
|
|
1922
|
-
// discovery and cancel tools that restaurant-booking keeps sticky.
|
|
1923
|
-
// Anchors are empty for the same reason as restaurant-cancel below.
|
|
1924
1855
|
name: "restaurant-book",
|
|
1925
1856
|
members: [
|
|
1926
1857
|
"AnumaPaymentsMCP-anuma_find_restaurant",
|
|
@@ -1930,12 +1861,6 @@ var BUILT_IN_TOOL_SETS = [
|
|
|
1930
1861
|
anchors: []
|
|
1931
1862
|
},
|
|
1932
1863
|
{
|
|
1933
|
-
// What a confirmed cancel card narrows the rest of the turn to (see
|
|
1934
|
-
// CONFIRMED_ACTION_TOOL_SETS). Anchors are empty for the same reason as
|
|
1935
|
-
// restaurant-booking: anchors here are scored against client tools only,
|
|
1936
|
-
// so a server-tool anchor could never fire. The "cancel brings list"
|
|
1937
|
-
// edge on a fresh prompt is restaurant-cancel-lookup in
|
|
1938
|
-
// SERVER_TOOL_DEPENDENCY_SETS.
|
|
1939
1864
|
name: "restaurant-cancel",
|
|
1940
1865
|
members: [
|
|
1941
1866
|
"AnumaPaymentsMCP-anuma_list_reservations",
|
|
@@ -2059,11 +1984,6 @@ function createServerToolsFilter(options = {}) {
|
|
|
2059
1984
|
var DEFAULT_EXCLUDED_SERVER_TOOLS = [
|
|
2060
1985
|
"AnumaVisionMCP-anuma_analyze_image",
|
|
2061
1986
|
"OpenMeteoMCP-weather_forecast",
|
|
2062
|
-
// Same native-capability argument as the vision tool: modern models reason
|
|
2063
|
-
// step-by-step natively (and reasoning-mode models do it structurally), so
|
|
2064
|
-
// a server-side sequential-thinking tool is a redundant hop. Its broad
|
|
2065
|
-
// description also embeds near virtually every prompt — observed live
|
|
2066
|
-
// riding into news-search, scheduling, and chitchat requests.
|
|
2067
1987
|
"AnumaSequentialThinkingMCP-sequentialthinking"
|
|
2068
1988
|
];
|
|
2069
1989
|
var DEFAULT_SERVER_TOOLS_MATCH_OPTIONS = {
|
|
@@ -2072,10 +1992,6 @@ var DEFAULT_SERVER_TOOLS_MATCH_OPTIONS = {
|
|
|
2072
1992
|
};
|
|
2073
1993
|
var SERVER_TOOL_DEPENDENCY_SETS = [
|
|
2074
1994
|
{
|
|
2075
|
-
// search finds links; reading them is always the next step. The reader now
|
|
2076
|
-
// lives on the search server — Jina's read_url / parallel_read_url were
|
|
2077
|
-
// removed in favour of anuma_scrape_url, which takes a batch of URLs — so
|
|
2078
|
-
// this edge deliberately spans two MCP servers.
|
|
2079
1995
|
name: "web-research",
|
|
2080
1996
|
members: [
|
|
2081
1997
|
"AnumaJinaMCP-search_web",
|
|
@@ -2083,22 +1999,9 @@ var SERVER_TOOL_DEPENDENCY_SETS = [
|
|
|
2083
1999
|
"AnumaJinaMCP-parallel_search_web"
|
|
2084
2000
|
],
|
|
2085
2001
|
anchors: ["AnumaJinaMCP-search_web"],
|
|
2086
|
-
// Activation floor = the selection floor (0.5), not the 0.6 ToolSet
|
|
2087
|
-
// default. A dependency edge has different semantics from a persona-style
|
|
2088
|
-
// tool set: if the entry tool is plausibly offered at all, the chain must
|
|
2089
|
-
// ride along — "Search the web for recent news…" scores search_web in the
|
|
2090
|
-
// 0.5–0.6 band, and shipping search without read would dead-end the model.
|
|
2091
2002
|
anchorMinSimilarity: 0.5
|
|
2092
2003
|
},
|
|
2093
2004
|
{
|
|
2094
|
-
// Every OpenMeteo data tool requires latitude/longitude (verified in the
|
|
2095
|
-
// catalog schemas), but users speak in place names — geocoding is the
|
|
2096
|
-
// mandatory first hop. Members deliberately contain ONLY the dependency:
|
|
2097
|
-
// the anchor that fired is already in the semantic matches, and pulling
|
|
2098
|
-
// sibling data tools in would re-create vendor-suite over-inclusion.
|
|
2099
|
-
// Excluded tools (e.g. weather_forecast under the default filter) can't
|
|
2100
|
-
// anchor this set — createServerToolsFilter drops them before expansion —
|
|
2101
|
-
// but the non-weather data tools still deliver geocoding when they match.
|
|
2102
2005
|
name: "openmeteo-geocode",
|
|
2103
2006
|
members: ["OpenMeteoMCP-geocoding"],
|
|
2104
2007
|
anchors: [
|
|
@@ -2113,10 +2016,6 @@ var SERVER_TOOL_DEPENDENCY_SETS = [
|
|
|
2113
2016
|
anchorMinSimilarity: 0.5
|
|
2114
2017
|
},
|
|
2115
2018
|
{
|
|
2116
|
-
// The cancel tool takes its resy_token and the other values only from a
|
|
2117
|
-
// live anuma_list_reservations result in the same turn, never from
|
|
2118
|
-
// memory, so the list tool must ride in whenever cancel is offered.
|
|
2119
|
-
// Members hold only the dependency, like openmeteo-geocode.
|
|
2120
2019
|
name: "restaurant-cancel-lookup",
|
|
2121
2020
|
members: ["AnumaPaymentsMCP-anuma_list_reservations"],
|
|
2122
2021
|
anchors: ["AnumaPaymentsMCP-anuma_cancel_reservation"],
|
|
@@ -2323,11 +2222,6 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
|
|
|
2323
2222
|
limit: MAX_CLIENT_TOOLS_AFTER_FILTER,
|
|
2324
2223
|
minSimilarity: CLIENT_TOOLS_MIN_SIMILARITY,
|
|
2325
2224
|
filterAmbiguous: true,
|
|
2326
|
-
// See CLIENT_TOOLS_RELEVANCE_RATIO: 0.75 admits the second intent of a
|
|
2327
|
-
// multi-intent prompt (which lands ~75-80% of the dominant match), while
|
|
2328
|
-
// still trimming the loose tail. The earlier 0.9 made a second intent
|
|
2329
|
-
// structurally unselectable; the anchorMinSimilarity gates (0.53-0.55)
|
|
2330
|
-
// remain the guard against borderline anchors activating a whole set.
|
|
2331
2225
|
relevanceRatio: CLIENT_TOOLS_RELEVANCE_RATIO
|
|
2332
2226
|
});
|
|
2333
2227
|
const matchedNames = new Set(matches.map((m) => m.tool.name));
|
|
@@ -2356,12 +2250,10 @@ async function autoFilterClientTools(clientTools, promptEmbeddings, cache, embed
|
|
|
2356
2250
|
|
|
2357
2251
|
// src/lib/tools/toolCatalog.ts
|
|
2358
2252
|
var TOOL_CATALOG = {
|
|
2359
|
-
// Gmail (src/tools/gmail.ts)
|
|
2360
2253
|
gmail_search_messages: { label: "Search emails", provider: "gmail", connector: "Gmail" },
|
|
2361
2254
|
gmail_get_message: { label: "Read an email", provider: "gmail", connector: "Gmail" },
|
|
2362
2255
|
gmail_create_draft: { label: "Draft a reply", provider: "gmail", connector: "Gmail" },
|
|
2363
2256
|
gmail_send_message: { label: "Send an email", provider: "gmail", connector: "Gmail" },
|
|
2364
|
-
// Google Calendar (src/tools/googleCalendar.ts)
|
|
2365
2257
|
google_calendar_list_events: {
|
|
2366
2258
|
label: "Search calendar events",
|
|
2367
2259
|
provider: "gcalendar",
|
|
@@ -2377,7 +2269,6 @@ var TOOL_CATALOG = {
|
|
|
2377
2269
|
provider: "gcalendar",
|
|
2378
2270
|
connector: "Calendar"
|
|
2379
2271
|
},
|
|
2380
|
-
// Google Drive (src/tools/googleDrive.ts)
|
|
2381
2272
|
google_drive_search: { label: "Search files", provider: "gdrive", connector: "Drive" },
|
|
2382
2273
|
google_drive_list_recent: { label: "List recent files", provider: "gdrive", connector: "Drive" },
|
|
2383
2274
|
google_drive_get_content: { label: "Read file content", provider: "gdrive", connector: "Drive" },
|
|
@@ -2391,7 +2282,6 @@ var TOOL_CATALOG = {
|
|
|
2391
2282
|
provider: "gdrive",
|
|
2392
2283
|
connector: "Drive"
|
|
2393
2284
|
},
|
|
2394
|
-
// Notion (src/tools/notion.ts)
|
|
2395
2285
|
"notion-search": { label: "Search", provider: "notion", connector: "Notion" },
|
|
2396
2286
|
"notion-fetch": { label: "Read page", provider: "notion", connector: "Notion" },
|
|
2397
2287
|
"notion-create-pages": { label: "Create page", provider: "notion", connector: "Notion" },
|
|
@@ -2412,17 +2302,14 @@ var TOOL_CATALOG = {
|
|
|
2412
2302
|
connector: "Notion"
|
|
2413
2303
|
},
|
|
2414
2304
|
"notion-get-teams": { label: "List teamspaces", provider: "notion", connector: "Notion" },
|
|
2415
|
-
// GitHub (src/tools/github.ts)
|
|
2416
2305
|
github_api: { label: "Use GitHub", provider: "github", connector: "GitHub" },
|
|
2417
2306
|
github_get_authenticated_user: {
|
|
2418
2307
|
label: "Read GitHub profile",
|
|
2419
2308
|
provider: "github",
|
|
2420
2309
|
connector: "GitHub"
|
|
2421
2310
|
},
|
|
2422
|
-
// X / Twitter (src/tools/x.ts)
|
|
2423
2311
|
x_get_me: { label: "Get my X profile", provider: "x", connector: "X" },
|
|
2424
2312
|
x_get_my_posts: { label: "Read my recent posts", provider: "x", connector: "X" },
|
|
2425
|
-
// Dropbox (src/tools/dropbox.ts)
|
|
2426
2313
|
dropbox_list_folders: { label: "List files", provider: "dropbox", connector: "Dropbox" },
|
|
2427
2314
|
dropbox_get_file_content: {
|
|
2428
2315
|
label: "Read file content",
|
|
@@ -2430,7 +2317,6 @@ var TOOL_CATALOG = {
|
|
|
2430
2317
|
connector: "Dropbox"
|
|
2431
2318
|
},
|
|
2432
2319
|
dropbox_search: { label: "Search files", provider: "dropbox", connector: "Dropbox" },
|
|
2433
|
-
// Slack (src/tools/slack.ts)
|
|
2434
2320
|
slack_get_me: { label: "Get my Slack profile", provider: "slack", connector: "Slack" },
|
|
2435
2321
|
slack_list_channels: { label: "List channels", provider: "slack", connector: "Slack" },
|
|
2436
2322
|
slack_list_dms: { label: "List direct messages", provider: "slack", connector: "Slack" },
|
|
@@ -2601,8 +2487,6 @@ var CREATION_INTENT_CLIENT_FACTORIES = {
|
|
|
2601
2487
|
document: FULL_GENERATIVE_CLIENT_FACTORIES,
|
|
2602
2488
|
"web-search": FULL_GENERATIVE_CLIENT_FACTORIES,
|
|
2603
2489
|
"deep-research": FULL_GENERATIVE_CLIENT_FACTORIES,
|
|
2604
|
-
// Builder modes: restrict to their own toolkit; a `saved` toolkit rides
|
|
2605
|
-
// along on app builds (parity with web's app branch).
|
|
2606
2490
|
app: ["app", "saved"],
|
|
2607
2491
|
slides: ["slides"]
|
|
2608
2492
|
};
|