@anuma/sdk 6.11.0 → 6.12.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/{chunk-ZO7S3TBT.mjs → chunk-732ZLOLA.mjs} +11 -8
- package/dist/expo/index.cjs +77 -31
- package/dist/expo/index.d.mts +83 -0
- package/dist/expo/index.d.ts +83 -0
- package/dist/expo/index.mjs +66 -24
- package/dist/expo/{recall-OALPGL3H.mjs → recall-PIATJ336.mjs} +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.d.mts +31 -3
- package/dist/index.d.ts +31 -3
- package/dist/index.mjs +5 -1
- package/dist/react/{chunk-HNQ2ZEFF.mjs → chunk-6IBFFWCE.mjs} +11 -8
- package/dist/react/index.cjs +85 -33
- package/dist/react/index.d.mts +98 -6
- package/dist/react/index.d.ts +98 -6
- package/dist/react/index.mjs +74 -26
- package/dist/react/{recall-F5DBVCU2.mjs → recall-QUWN7DJ7.mjs} +1 -1
- package/dist/server/{chunk-BKB6AT7Z.mjs → chunk-7YTEE6JT.mjs} +11 -8
- package/dist/server/index.cjs +61 -27
- package/dist/server/index.d.mts +98 -6
- package/dist/server/index.d.ts +98 -6
- package/dist/server/index.mjs +50 -20
- package/dist/server/{recall-HVIEAH7J.mjs → recall-HOVWMT4Q.mjs} +1 -1
- package/dist/tools/selection/index.cjs +25 -2
- package/dist/tools/selection/index.d.mts +72 -7
- package/dist/tools/selection/index.d.ts +72 -7
- package/dist/tools/selection/index.mjs +23 -2
- package/package.json +1 -1
package/dist/expo/index.mjs
CHANGED
|
@@ -132,7 +132,7 @@ import {
|
|
|
132
132
|
upsertMessageOp,
|
|
133
133
|
useEncryption,
|
|
134
134
|
vaultMemoryToStored
|
|
135
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-732ZLOLA.mjs";
|
|
136
136
|
import {
|
|
137
137
|
PII_PATTERNS,
|
|
138
138
|
PiiRedactor,
|
|
@@ -8131,11 +8131,13 @@ Respond with ONLY a single JSON object conforming to this JSON Schema, with no p
|
|
|
8131
8131
|
${JSON.stringify(
|
|
8132
8132
|
options.responseSchema
|
|
8133
8133
|
)}` : basePrompt;
|
|
8134
|
-
const userMessage =
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8134
|
+
const userMessage = [
|
|
8135
|
+
`Question:
|
|
8136
|
+
${trimmed}`,
|
|
8137
|
+
...options.userInstructions ? [options.userInstructions] : [],
|
|
8138
|
+
`Memories (use only these as evidence):
|
|
8139
|
+
${evidence}`
|
|
8140
|
+
].join("\n\n");
|
|
8139
8141
|
const maxTokens = options.maxTokens ?? DEFAULT_MAX_TOKENS;
|
|
8140
8142
|
const fetchImpl = options.fetchFn ?? fetch;
|
|
8141
8143
|
const log = getLogger();
|
|
@@ -8149,7 +8151,13 @@ ${evidence}`;
|
|
|
8149
8151
|
try {
|
|
8150
8152
|
response = await fetchImpl(`${baseUrl}/api/v1/chat/completions`, {
|
|
8151
8153
|
method: "POST",
|
|
8152
|
-
|
|
8154
|
+
// No task type unless the caller named one — an undeclared task adds no
|
|
8155
|
+
// header at all, which is what keeps user-facing reflect() unlabelled.
|
|
8156
|
+
headers: {
|
|
8157
|
+
...authHeaders,
|
|
8158
|
+
...taskTypeHeader(options.taskType),
|
|
8159
|
+
"Content-Type": "application/json"
|
|
8160
|
+
},
|
|
8153
8161
|
body: JSON.stringify({
|
|
8154
8162
|
model,
|
|
8155
8163
|
// Modern OpenAI field; the portal reads only `max_completion_tokens`
|
|
@@ -8589,10 +8597,15 @@ async function synthesizeFacet(facet, ctx, options, prior) {
|
|
|
8589
8597
|
limit,
|
|
8590
8598
|
types: ["fact"],
|
|
8591
8599
|
maxTokens: DEFAULT_FACET_MAX_TOKENS,
|
|
8592
|
-
// Profile-facet synthesis is a background op, so it marks its own prompt
|
|
8593
|
-
// reflect() itself must
|
|
8594
|
-
// and that traffic is chat, not an internal flow. See
|
|
8595
|
-
|
|
8600
|
+
// Profile-facet synthesis is a background op, so it marks its own prompt AND
|
|
8601
|
+
// names its own task. reflect() itself must do neither — it also serves the
|
|
8602
|
+
// user's own questions, and that traffic is chat, not an internal flow. See
|
|
8603
|
+
// ../internalFlowMarker and ReflectOptions.taskType.
|
|
8604
|
+
taskType: "memory_profile_synth",
|
|
8605
|
+
systemPrompt: withInternalFlowMarker(FACET_SYSTEM_PROMPT),
|
|
8606
|
+
// The facet's label/guidance/response-fields, on the user turn — what keeps
|
|
8607
|
+
// the system half fixed and therefore server-ownable.
|
|
8608
|
+
userInstructions: buildFacetUserInstructions(facet),
|
|
8596
8609
|
responseSchema: facetResponseSchema(facet.key),
|
|
8597
8610
|
memories
|
|
8598
8611
|
});
|
|
@@ -8650,19 +8663,22 @@ function fallbackSection(facet, prior) {
|
|
|
8650
8663
|
stale: true
|
|
8651
8664
|
};
|
|
8652
8665
|
}
|
|
8653
|
-
|
|
8654
|
-
const structuredField = FACET_STRUCTURED_RESPONSE_HINT[facet.key] ?? "";
|
|
8655
|
-
return `You are writing the "${facet.label}" section of a person's shareable profile, using their private memories (supplied as evidence) as the only source of truth.
|
|
8656
|
-
|
|
8657
|
-
Task for this section:
|
|
8658
|
-
${facet.guidance}
|
|
8666
|
+
var FACET_SYSTEM_PROMPT = `You are writing one section of a person's shareable profile, using their private memories (supplied as evidence) as the only source of truth. The user turn names the section, states the task for it, and gives the exact JSON shape to respond in.
|
|
8659
8667
|
|
|
8660
8668
|
Rules:
|
|
8661
8669
|
- Ground every claim in the supplied memories \u2014 never invent, infer beyond, or embellish what they support.
|
|
8662
8670
|
- If the memories don't cover this section, return an empty summary with hasEvidence=false. Do not pad or guess.
|
|
8663
8671
|
- Write in third person about the person, in a natural voice suitable for a public profile (no "I"/"you", no name repetition).
|
|
8664
8672
|
- Be concise and specific; no preamble, hedging, or meta-commentary.
|
|
8665
|
-
- Respond as JSON
|
|
8673
|
+
- Respond as JSON in exactly the shape the user turn states, with no extra fields.`;
|
|
8674
|
+
function buildFacetUserInstructions(facet) {
|
|
8675
|
+
const structuredField = FACET_STRUCTURED_RESPONSE_HINT[facet.key] ?? "";
|
|
8676
|
+
return `Section: "${facet.label}"
|
|
8677
|
+
|
|
8678
|
+
Task for this section:
|
|
8679
|
+
${facet.guidance}
|
|
8680
|
+
|
|
8681
|
+
Respond as JSON: { "summary": <the section text, or "">, "hasEvidence": <true|false>${structuredField} }.`;
|
|
8666
8682
|
}
|
|
8667
8683
|
function extractFacetText(structured) {
|
|
8668
8684
|
if (structured && typeof structured === "object") {
|
|
@@ -9946,6 +9962,20 @@ function clientToolToCompletionsFormat(tool) {
|
|
|
9946
9962
|
}
|
|
9947
9963
|
var TOOL_SEARCH_TOOL_TYPE = "tool_search_tool_regex_20251119";
|
|
9948
9964
|
var TOOL_SEARCH_TOOL_NAME = "tool_search_tool_regex";
|
|
9965
|
+
function resolveDeferredServerTools(allServerTools, serverToolsFilter, config) {
|
|
9966
|
+
const allowed = serverToolsFilter === void 0 || typeof serverToolsFilter === "function" ? allServerTools : filterServerTools(allServerTools, [...serverToolsFilter]);
|
|
9967
|
+
const excluded = new Set(config.excludeTools ?? []);
|
|
9968
|
+
if (typeof serverToolsFilter === "function") {
|
|
9969
|
+
for (const name of serverToolsFilter.excludeTools ?? []) excluded.add(name);
|
|
9970
|
+
}
|
|
9971
|
+
if (excluded.size === 0) return allowed;
|
|
9972
|
+
return allowed.filter((tool) => !excluded.has(tool.name));
|
|
9973
|
+
}
|
|
9974
|
+
function deferFormattingConfig(serverToolsFilter, config) {
|
|
9975
|
+
if (!config?.enabled) return config;
|
|
9976
|
+
const isExplicitList = serverToolsFilter !== void 0 && typeof serverToolsFilter !== "function";
|
|
9977
|
+
return isExplicitList ? void 0 : config;
|
|
9978
|
+
}
|
|
9949
9979
|
function byNameAscending(a, b) {
|
|
9950
9980
|
if (a.name < b.name) return -1;
|
|
9951
9981
|
if (a.name > b.name) return 1;
|
|
@@ -10272,7 +10302,7 @@ function createServerToolsFilter(options = {}) {
|
|
|
10272
10302
|
const exclude = new Set(options.excludeTools ?? []);
|
|
10273
10303
|
const sets = options.toolSets ?? [];
|
|
10274
10304
|
const matchOpts = options.matchOptions;
|
|
10275
|
-
|
|
10305
|
+
const filter = (embeddings, tools) => {
|
|
10276
10306
|
const matches = findMatchingTools(embeddings, tools, matchOpts);
|
|
10277
10307
|
if (matches.length === 0) return [];
|
|
10278
10308
|
const matchedNames = new Set(matches.map((m) => m.tool.name));
|
|
@@ -10290,6 +10320,10 @@ function createServerToolsFilter(options = {}) {
|
|
|
10290
10320
|
for (const name of exclude) finalNames.delete(name);
|
|
10291
10321
|
return [...finalNames];
|
|
10292
10322
|
};
|
|
10323
|
+
return Object.defineProperty(filter, "excludeTools", {
|
|
10324
|
+
value: Object.freeze([...exclude]),
|
|
10325
|
+
enumerable: false
|
|
10326
|
+
});
|
|
10293
10327
|
}
|
|
10294
10328
|
var DEFAULT_EXCLUDED_SERVER_TOOLS = [
|
|
10295
10329
|
"AnumaVisionMCP-anuma_analyze_image",
|
|
@@ -11289,7 +11323,11 @@ function useChatStorage(options) {
|
|
|
11289
11323
|
cache: serverToolsConfig?.cache
|
|
11290
11324
|
});
|
|
11291
11325
|
if (serverToolsConfig?.deferLoading?.enabled) {
|
|
11292
|
-
filteredServerTools2 =
|
|
11326
|
+
filteredServerTools2 = resolveDeferredServerTools(
|
|
11327
|
+
allServerTools,
|
|
11328
|
+
serverToolsFilter,
|
|
11329
|
+
serverToolsConfig.deferLoading
|
|
11330
|
+
);
|
|
11293
11331
|
} else if (isServerToolsFunction2) {
|
|
11294
11332
|
if (messageContent.length >= MIN_CONTENT_LENGTH_FOR_TOOLS) {
|
|
11295
11333
|
skipUserEmbedding = await embedToolText(
|
|
@@ -11348,7 +11386,7 @@ function useChatStorage(options) {
|
|
|
11348
11386
|
filteredServerTools2,
|
|
11349
11387
|
narrowedClientTools2,
|
|
11350
11388
|
effectiveApiType2,
|
|
11351
|
-
serverToolsConfig?.deferLoading
|
|
11389
|
+
deferFormattingConfig(serverToolsFilter, serverToolsConfig?.deferLoading)
|
|
11352
11390
|
);
|
|
11353
11391
|
}
|
|
11354
11392
|
if (onToolSelection) {
|
|
@@ -11561,7 +11599,11 @@ function useChatStorage(options) {
|
|
|
11561
11599
|
if ("error" in settledTools) throw settledTools.error;
|
|
11562
11600
|
const allServerTools = settledTools.tools;
|
|
11563
11601
|
if (serverToolsConfig?.deferLoading?.enabled && effectiveApiType === "responses") {
|
|
11564
|
-
filteredServerTools =
|
|
11602
|
+
filteredServerTools = resolveDeferredServerTools(
|
|
11603
|
+
allServerTools,
|
|
11604
|
+
serverToolsFilter,
|
|
11605
|
+
serverToolsConfig.deferLoading
|
|
11606
|
+
);
|
|
11565
11607
|
} else if (isServerToolsFunction) {
|
|
11566
11608
|
if (contentForStorage.length >= MIN_CONTENT_LENGTH_FOR_TOOLS) {
|
|
11567
11609
|
const settledEmbedding = await (userMessageEmbeddingPromise ?? embedForToolsSettled(getTokenRef.current));
|
|
@@ -11581,7 +11623,7 @@ function useChatStorage(options) {
|
|
|
11581
11623
|
filteredServerTools,
|
|
11582
11624
|
clientTools,
|
|
11583
11625
|
effectiveApiType,
|
|
11584
|
-
serverToolsConfig?.deferLoading
|
|
11626
|
+
deferFormattingConfig(serverToolsFilter, serverToolsConfig?.deferLoading)
|
|
11585
11627
|
);
|
|
11586
11628
|
}
|
|
11587
11629
|
} catch (error) {
|
|
@@ -11622,7 +11664,7 @@ function useChatStorage(options) {
|
|
|
11622
11664
|
filteredServerTools,
|
|
11623
11665
|
narrowedClientTools,
|
|
11624
11666
|
effectiveApiType,
|
|
11625
|
-
serverToolsConfig?.deferLoading
|
|
11667
|
+
deferFormattingConfig(serverToolsFilter, serverToolsConfig?.deferLoading)
|
|
11626
11668
|
) : void 0;
|
|
11627
11669
|
} catch (error) {
|
|
11628
11670
|
getLogger().warn("[useChatStorage] client tool filtering failed:", error);
|
package/dist/index.cjs
CHANGED
|
@@ -2293,7 +2293,7 @@ function createServerToolsFilter(options = {}) {
|
|
|
2293
2293
|
const exclude = new Set(options.excludeTools ?? []);
|
|
2294
2294
|
const sets = options.toolSets ?? [];
|
|
2295
2295
|
const matchOpts = options.matchOptions;
|
|
2296
|
-
|
|
2296
|
+
const filter = (embeddings, tools) => {
|
|
2297
2297
|
const matches = findMatchingTools(embeddings, tools, matchOpts);
|
|
2298
2298
|
if (matches.length === 0) return [];
|
|
2299
2299
|
const matchedNames = new Set(matches.map((m) => m.tool.name));
|
|
@@ -2311,6 +2311,10 @@ function createServerToolsFilter(options = {}) {
|
|
|
2311
2311
|
for (const name of exclude) finalNames.delete(name);
|
|
2312
2312
|
return [...finalNames];
|
|
2313
2313
|
};
|
|
2314
|
+
return Object.defineProperty(filter, "excludeTools", {
|
|
2315
|
+
value: Object.freeze([...exclude]),
|
|
2316
|
+
enumerable: false
|
|
2317
|
+
});
|
|
2314
2318
|
}
|
|
2315
2319
|
var DEFAULT_EXCLUDED_SERVER_TOOLS = [
|
|
2316
2320
|
"AnumaVisionMCP-anuma_analyze_image",
|
package/dist/index.d.mts
CHANGED
|
@@ -7900,7 +7900,7 @@ interface CreateServerToolsFilterOptions {
|
|
|
7900
7900
|
* });
|
|
7901
7901
|
* ```
|
|
7902
7902
|
*/
|
|
7903
|
-
declare function createServerToolsFilter(options?: CreateServerToolsFilterOptions):
|
|
7903
|
+
declare function createServerToolsFilter(options?: CreateServerToolsFilterOptions): ServerToolsFilterFunction;
|
|
7904
7904
|
/**
|
|
7905
7905
|
* Default exclusions baked into `defaultServerToolsFilter`.
|
|
7906
7906
|
*
|
|
@@ -7941,7 +7941,21 @@ declare const DEFAULT_SERVER_TOOLS_MATCH_OPTIONS: ToolMatchOptions;
|
|
|
7941
7941
|
* If you need to customize (extra excludes, different limits, opt into
|
|
7942
7942
|
* tool-set expansion), call `createServerToolsFilter` directly.
|
|
7943
7943
|
*/
|
|
7944
|
-
declare const defaultServerToolsFilter:
|
|
7944
|
+
declare const defaultServerToolsFilter: ServerToolsFilterFunction;
|
|
7945
|
+
/**
|
|
7946
|
+
* Type for a server-tools filter — a function that takes prompt embeddings
|
|
7947
|
+
* and the full server tool catalog and returns the names of tools to keep.
|
|
7948
|
+
* Matches `useChatStorage`'s `serverTools` callback signature.
|
|
7949
|
+
*/
|
|
7950
|
+
type ServerToolsFilterFunction = ((embeddings: number[] | number[][], tools: ServerTool[]) => string[]) & {
|
|
7951
|
+
/**
|
|
7952
|
+
* The unconditional exclusions this filter applies, exposed by
|
|
7953
|
+
* {@link createServerToolsFilter} so defer-loading can honour them without the caller
|
|
7954
|
+
* repeating the list — see {@link resolveDeferredServerTools}. Absent on a hand-written
|
|
7955
|
+
* filter, or on one wrapped in a plain closure.
|
|
7956
|
+
*/
|
|
7957
|
+
readonly excludeTools?: readonly string[];
|
|
7958
|
+
};
|
|
7945
7959
|
/**
|
|
7946
7960
|
* Options for selectServerSideTools
|
|
7947
7961
|
*/
|
|
@@ -8916,6 +8930,20 @@ declare function decryptConversationTitle(encryptedTitle: string, address: strin
|
|
|
8916
8930
|
* `AllTaskTypes` on the portal side, and see ai-portal
|
|
8917
8931
|
* `docs/BACKEND_OWNED_TASK_PROMPTS.md` for the rollout.
|
|
8918
8932
|
*
|
|
8933
|
+
* ⚠ RELEASE ORDER. This union is a PUBLIC type, so a split is breaking in both
|
|
8934
|
+
* directions and has to be sequenced:
|
|
8935
|
+
*
|
|
8936
|
+
* 1. merge + publish this package;
|
|
8937
|
+
* 2. bump `@anuma/sdk` in the consumer and switch its call sites to the new
|
|
8938
|
+
* names in the same commit.
|
|
8939
|
+
*
|
|
8940
|
+
* A consumer on the OLD version cannot compile the new names, and a consumer on
|
|
8941
|
+
* the NEW version cannot compile the retired ones (`app_inspiration` is gone
|
|
8942
|
+
* here, replaced by the three `app_inspiration_*` names). Both halves of that
|
|
8943
|
+
* are type-only — the wire itself always degrades safely, because the portal
|
|
8944
|
+
* drops any value it does not recognise. Concretely: ai-memoryless-client#5782
|
|
8945
|
+
* is blocked on this publish for exactly that reason.
|
|
8946
|
+
*
|
|
8919
8947
|
* Deliberately ABSENT: agent personas, `reflect()` when it answers the user, and
|
|
8920
8948
|
* the app-idea chat. Those carry an open conversation with the user, so a fixed
|
|
8921
8949
|
* server-owned prompt would be wrong rather than merely premature — the same
|
|
@@ -8923,7 +8951,7 @@ declare function decryptConversationTitle(encryptedTitle: string, address: strin
|
|
|
8923
8951
|
*
|
|
8924
8952
|
* @public
|
|
8925
8953
|
*/
|
|
8926
|
-
type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "
|
|
8954
|
+
type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
|
|
8927
8955
|
/**
|
|
8928
8956
|
* HTTP header naming the Class-B task a request performs.
|
|
8929
8957
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -7900,7 +7900,7 @@ interface CreateServerToolsFilterOptions {
|
|
|
7900
7900
|
* });
|
|
7901
7901
|
* ```
|
|
7902
7902
|
*/
|
|
7903
|
-
declare function createServerToolsFilter(options?: CreateServerToolsFilterOptions):
|
|
7903
|
+
declare function createServerToolsFilter(options?: CreateServerToolsFilterOptions): ServerToolsFilterFunction;
|
|
7904
7904
|
/**
|
|
7905
7905
|
* Default exclusions baked into `defaultServerToolsFilter`.
|
|
7906
7906
|
*
|
|
@@ -7941,7 +7941,21 @@ declare const DEFAULT_SERVER_TOOLS_MATCH_OPTIONS: ToolMatchOptions;
|
|
|
7941
7941
|
* If you need to customize (extra excludes, different limits, opt into
|
|
7942
7942
|
* tool-set expansion), call `createServerToolsFilter` directly.
|
|
7943
7943
|
*/
|
|
7944
|
-
declare const defaultServerToolsFilter:
|
|
7944
|
+
declare const defaultServerToolsFilter: ServerToolsFilterFunction;
|
|
7945
|
+
/**
|
|
7946
|
+
* Type for a server-tools filter — a function that takes prompt embeddings
|
|
7947
|
+
* and the full server tool catalog and returns the names of tools to keep.
|
|
7948
|
+
* Matches `useChatStorage`'s `serverTools` callback signature.
|
|
7949
|
+
*/
|
|
7950
|
+
type ServerToolsFilterFunction = ((embeddings: number[] | number[][], tools: ServerTool[]) => string[]) & {
|
|
7951
|
+
/**
|
|
7952
|
+
* The unconditional exclusions this filter applies, exposed by
|
|
7953
|
+
* {@link createServerToolsFilter} so defer-loading can honour them without the caller
|
|
7954
|
+
* repeating the list — see {@link resolveDeferredServerTools}. Absent on a hand-written
|
|
7955
|
+
* filter, or on one wrapped in a plain closure.
|
|
7956
|
+
*/
|
|
7957
|
+
readonly excludeTools?: readonly string[];
|
|
7958
|
+
};
|
|
7945
7959
|
/**
|
|
7946
7960
|
* Options for selectServerSideTools
|
|
7947
7961
|
*/
|
|
@@ -8916,6 +8930,20 @@ declare function decryptConversationTitle(encryptedTitle: string, address: strin
|
|
|
8916
8930
|
* `AllTaskTypes` on the portal side, and see ai-portal
|
|
8917
8931
|
* `docs/BACKEND_OWNED_TASK_PROMPTS.md` for the rollout.
|
|
8918
8932
|
*
|
|
8933
|
+
* ⚠ RELEASE ORDER. This union is a PUBLIC type, so a split is breaking in both
|
|
8934
|
+
* directions and has to be sequenced:
|
|
8935
|
+
*
|
|
8936
|
+
* 1. merge + publish this package;
|
|
8937
|
+
* 2. bump `@anuma/sdk` in the consumer and switch its call sites to the new
|
|
8938
|
+
* names in the same commit.
|
|
8939
|
+
*
|
|
8940
|
+
* A consumer on the OLD version cannot compile the new names, and a consumer on
|
|
8941
|
+
* the NEW version cannot compile the retired ones (`app_inspiration` is gone
|
|
8942
|
+
* here, replaced by the three `app_inspiration_*` names). Both halves of that
|
|
8943
|
+
* are type-only — the wire itself always degrades safely, because the portal
|
|
8944
|
+
* drops any value it does not recognise. Concretely: ai-memoryless-client#5782
|
|
8945
|
+
* is blocked on this publish for exactly that reason.
|
|
8946
|
+
*
|
|
8919
8947
|
* Deliberately ABSENT: agent personas, `reflect()` when it answers the user, and
|
|
8920
8948
|
* the app-idea chat. Those carry an open conversation with the user, so a fixed
|
|
8921
8949
|
* server-owned prompt would be wrong rather than merely premature — the same
|
|
@@ -8923,7 +8951,7 @@ declare function decryptConversationTitle(encryptedTitle: string, address: strin
|
|
|
8923
8951
|
*
|
|
8924
8952
|
* @public
|
|
8925
8953
|
*/
|
|
8926
|
-
type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "
|
|
8954
|
+
type TaskType = "title" | "commit_message" | "memory_extract" | "memory_dedup" | "memory_decay" | "memory_injection_check" | "memory_verify_support" | "memory_autosort" | "memory_topic" | "memory_consolidate" | "memory_decompose" | "memory_profile_synth" | "memory_graph" | "folder_context" | "selection_memory" | "summarize" | "style_analysis" | "classify_search" | "app_inspiration_generate" | "app_inspiration_trends" | "app_inspiration_remix" | "spotlight_image" | "slide_image" | "slide_video" | "slide_music" | "slide_sfx" | "media_video" | "media_audio" | "media_bg_removal" | "media_image_preset" | "tool_app_builder" | "tool_document_builder" | "tool_slides" | "tool_slides_image_gen" | "connector_guidance" | "cf_task" | "xbot_intent" | "xbot_council" | "scheduled_task";
|
|
8927
8955
|
/**
|
|
8928
8956
|
* HTTP header naming the Class-B task a request performs.
|
|
8929
8957
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -2091,7 +2091,7 @@ function createServerToolsFilter(options = {}) {
|
|
|
2091
2091
|
const exclude = new Set(options.excludeTools ?? []);
|
|
2092
2092
|
const sets = options.toolSets ?? [];
|
|
2093
2093
|
const matchOpts = options.matchOptions;
|
|
2094
|
-
|
|
2094
|
+
const filter = (embeddings, tools) => {
|
|
2095
2095
|
const matches = findMatchingTools(embeddings, tools, matchOpts);
|
|
2096
2096
|
if (matches.length === 0) return [];
|
|
2097
2097
|
const matchedNames = new Set(matches.map((m) => m.tool.name));
|
|
@@ -2109,6 +2109,10 @@ function createServerToolsFilter(options = {}) {
|
|
|
2109
2109
|
for (const name of exclude) finalNames.delete(name);
|
|
2110
2110
|
return [...finalNames];
|
|
2111
2111
|
};
|
|
2112
|
+
return Object.defineProperty(filter, "excludeTools", {
|
|
2113
|
+
value: Object.freeze([...exclude]),
|
|
2114
|
+
enumerable: false
|
|
2115
|
+
});
|
|
2112
2116
|
}
|
|
2113
2117
|
var DEFAULT_EXCLUDED_SERVER_TOOLS = [
|
|
2114
2118
|
"AnumaVisionMCP-anuma_analyze_image",
|
|
@@ -5439,6 +5439,9 @@ async function decomposeQuery(query, options) {
|
|
|
5439
5439
|
...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
|
|
5440
5440
|
model: options.model ?? DEFAULT_MODEL,
|
|
5441
5441
|
systemPrompt: SYSTEM_PROMPT,
|
|
5442
|
+
// The query itself rides the user turn below, so SYSTEM_PROMPT is the whole
|
|
5443
|
+
// fixed instruction — which is what lets the portal own it outright.
|
|
5444
|
+
taskType: "memory_decompose",
|
|
5442
5445
|
// Wrap the bare query in a task framing so the model treats it as
|
|
5443
5446
|
// input to classify, not as a question to answer conversationally.
|
|
5444
5447
|
// Bare-query inputs caused Anthropic models to respond with prose
|
|
@@ -7166,7 +7169,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
|
|
|
7166
7169
|
subQueries = decomp.subQueries;
|
|
7167
7170
|
}
|
|
7168
7171
|
}
|
|
7169
|
-
const { recall: recall2 } = await import("./recall-
|
|
7172
|
+
const { recall: recall2 } = await import("./recall-QUWN7DJ7.mjs");
|
|
7170
7173
|
let recallDegraded = [];
|
|
7171
7174
|
const result = await recall2(
|
|
7172
7175
|
query,
|
|
@@ -7419,29 +7422,29 @@ async function traverseGraphLane(query, entityCtx, options = {}) {
|
|
|
7419
7422
|
var DEFAULT_REFINER_MODEL = "inclusionai/ling-2.6-flash";
|
|
7420
7423
|
var DEFAULT_REFINER_ATTEMPTS = 1;
|
|
7421
7424
|
var DEFAULT_REFINER_TOTAL_TIMEOUT_MS = 8e3;
|
|
7425
|
+
var REFINER_SYSTEM_PROMPT = `You help a memory-retrieval system decide which related topics to explore.
|
|
7426
|
+
|
|
7427
|
+
Given a user's question and a numbered list of candidate topics/entities linked to memories found so far, pick the ones most likely to lead to memories that help ANSWER the question. Never return more than the maximum the user turn asks for. Prefer topics semantically related to the question; ignore incidental ones.
|
|
7428
|
+
|
|
7429
|
+
Output strict JSON, no prose: { "expand": [<entity names to expand, verbatim from the list>] }`;
|
|
7422
7430
|
function createLlmNeighborRefiner(options) {
|
|
7423
7431
|
return {
|
|
7424
7432
|
async refine(query, candidates, limit) {
|
|
7425
7433
|
if (candidates.length === 0) return [];
|
|
7426
7434
|
const numbered = candidates.map((name, i) => `[${i + 1}] ${name}`).join("\n");
|
|
7427
|
-
const systemPrompt = `You help a memory-retrieval system decide which related topics to explore.
|
|
7428
|
-
|
|
7429
|
-
Given a user's question and a numbered list of candidate topics/entities linked to memories found so far, pick the ones most likely to lead to memories that help ANSWER the question. Choose at most ${limit}. Prefer topics semantically related to the question; ignore incidental ones.
|
|
7430
|
-
|
|
7431
|
-
Output strict JSON, no prose: { "expand": [<entity names to expand, verbatim from the list>] }`;
|
|
7432
7435
|
const parsed = await callPortalJsonCompletion({
|
|
7433
7436
|
...options.apiKey !== void 0 && { apiKey: options.apiKey },
|
|
7434
7437
|
...options.getToken !== void 0 && { getToken: options.getToken },
|
|
7435
7438
|
...options.baseUrl !== void 0 && { baseUrl: options.baseUrl },
|
|
7436
7439
|
taskType: "memory_graph",
|
|
7437
7440
|
model: options.model ?? DEFAULT_REFINER_MODEL,
|
|
7438
|
-
systemPrompt,
|
|
7441
|
+
systemPrompt: REFINER_SYSTEM_PROMPT,
|
|
7439
7442
|
userMessage: `Question: ${query}
|
|
7440
7443
|
|
|
7441
7444
|
Candidate topics:
|
|
7442
7445
|
${numbered}
|
|
7443
7446
|
|
|
7444
|
-
Which should be expanded
|
|
7447
|
+
Which should be expanded? Choose at most ${limit}.`,
|
|
7445
7448
|
tag: "memory/graph-refine",
|
|
7446
7449
|
maxAttempts: options.maxAttempts ?? DEFAULT_REFINER_ATTEMPTS,
|
|
7447
7450
|
totalTimeoutMs: options.totalTimeoutMs ?? DEFAULT_REFINER_TOTAL_TIMEOUT_MS,
|