alibabacloud-agentcore-sdk 0.1.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/LICENSE +202 -0
- package/README.md +189 -0
- package/dist/access-key-CkoHq3S8.d.cts +30 -0
- package/dist/access-key-CkoHq3S8.d.ts +30 -0
- package/dist/agent-sa-token-DD1Sb8P1.d.cts +14 -0
- package/dist/agent-sa-token-DD1Sb8P1.d.ts +14 -0
- package/dist/auth/index.cjs +36 -0
- package/dist/auth/index.cjs.map +1 -0
- package/dist/auth/index.d.cts +34 -0
- package/dist/auth/index.d.ts +34 -0
- package/dist/auth/index.js +36 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/bound-credentials-C1fM0thh.d.cts +39 -0
- package/dist/bound-credentials-DqT64Q2s.d.ts +39 -0
- package/dist/chunk-2E5EWEDG.cjs +142 -0
- package/dist/chunk-2E5EWEDG.cjs.map +1 -0
- package/dist/chunk-55XZZRKO.js +220 -0
- package/dist/chunk-55XZZRKO.js.map +1 -0
- package/dist/chunk-5JXA7JPS.js +29 -0
- package/dist/chunk-5JXA7JPS.js.map +1 -0
- package/dist/chunk-5RKN46UU.cjs +139 -0
- package/dist/chunk-5RKN46UU.cjs.map +1 -0
- package/dist/chunk-5ZOLHQXO.js +296 -0
- package/dist/chunk-5ZOLHQXO.js.map +1 -0
- package/dist/chunk-7Y263YIW.js +298 -0
- package/dist/chunk-7Y263YIW.js.map +1 -0
- package/dist/chunk-A3PF2SPD.cjs +141 -0
- package/dist/chunk-A3PF2SPD.cjs.map +1 -0
- package/dist/chunk-A3WMLVJC.cjs +141 -0
- package/dist/chunk-A3WMLVJC.cjs.map +1 -0
- package/dist/chunk-BVZ7H2F5.cjs +582 -0
- package/dist/chunk-BVZ7H2F5.cjs.map +1 -0
- package/dist/chunk-EGUKJE3Z.cjs +24 -0
- package/dist/chunk-EGUKJE3Z.cjs.map +1 -0
- package/dist/chunk-EKXZKKJJ.js +24 -0
- package/dist/chunk-EKXZKKJJ.js.map +1 -0
- package/dist/chunk-GYLT23D3.js +110 -0
- package/dist/chunk-GYLT23D3.js.map +1 -0
- package/dist/chunk-IF7LMBXC.js +306 -0
- package/dist/chunk-IF7LMBXC.js.map +1 -0
- package/dist/chunk-IUCLCPVV.js +113 -0
- package/dist/chunk-IUCLCPVV.js.map +1 -0
- package/dist/chunk-JSP7ZROS.cjs +95 -0
- package/dist/chunk-JSP7ZROS.cjs.map +1 -0
- package/dist/chunk-JW62DVIC.js +238 -0
- package/dist/chunk-JW62DVIC.js.map +1 -0
- package/dist/chunk-K3TE7625.js +139 -0
- package/dist/chunk-K3TE7625.js.map +1 -0
- package/dist/chunk-LE5P3SJW.cjs +16 -0
- package/dist/chunk-LE5P3SJW.cjs.map +1 -0
- package/dist/chunk-LXHW6OT4.cjs +77 -0
- package/dist/chunk-LXHW6OT4.cjs.map +1 -0
- package/dist/chunk-MICRSJ6R.js +48 -0
- package/dist/chunk-MICRSJ6R.js.map +1 -0
- package/dist/chunk-MWAHO47B.cjs +220 -0
- package/dist/chunk-MWAHO47B.cjs.map +1 -0
- package/dist/chunk-MZ5UWGXS.js +95 -0
- package/dist/chunk-MZ5UWGXS.js.map +1 -0
- package/dist/chunk-NZL3VPJ2.js +16 -0
- package/dist/chunk-NZL3VPJ2.js.map +1 -0
- package/dist/chunk-PC4FM2RP.cjs +180 -0
- package/dist/chunk-PC4FM2RP.cjs.map +1 -0
- package/dist/chunk-PKYET77D.cjs +296 -0
- package/dist/chunk-PKYET77D.cjs.map +1 -0
- package/dist/chunk-PTJPB27L.js +31 -0
- package/dist/chunk-PTJPB27L.js.map +1 -0
- package/dist/chunk-QIZO3A4Y.cjs +306 -0
- package/dist/chunk-QIZO3A4Y.cjs.map +1 -0
- package/dist/chunk-RBAY4MO2.js +202 -0
- package/dist/chunk-RBAY4MO2.js.map +1 -0
- package/dist/chunk-RHY7Y43E.js +582 -0
- package/dist/chunk-RHY7Y43E.js.map +1 -0
- package/dist/chunk-RQRI6RCG.cjs +238 -0
- package/dist/chunk-RQRI6RCG.cjs.map +1 -0
- package/dist/chunk-RYXL25AI.js +141 -0
- package/dist/chunk-RYXL25AI.js.map +1 -0
- package/dist/chunk-RZNQGEGJ.cjs +113 -0
- package/dist/chunk-RZNQGEGJ.cjs.map +1 -0
- package/dist/chunk-S7PWSJNP.cjs +48 -0
- package/dist/chunk-S7PWSJNP.cjs.map +1 -0
- package/dist/chunk-TWEO5XVM.cjs +298 -0
- package/dist/chunk-TWEO5XVM.cjs.map +1 -0
- package/dist/chunk-UBP5CHU7.js +142 -0
- package/dist/chunk-UBP5CHU7.js.map +1 -0
- package/dist/chunk-ULJTQSLE.cjs +35 -0
- package/dist/chunk-ULJTQSLE.cjs.map +1 -0
- package/dist/chunk-UWPKFJYM.js +77 -0
- package/dist/chunk-UWPKFJYM.js.map +1 -0
- package/dist/chunk-WKZUYPDS.js +180 -0
- package/dist/chunk-WKZUYPDS.js.map +1 -0
- package/dist/chunk-YZP55W7S.cjs +29 -0
- package/dist/chunk-YZP55W7S.cjs.map +1 -0
- package/dist/chunk-ZELRQU4J.cjs +31 -0
- package/dist/chunk-ZELRQU4J.cjs.map +1 -0
- package/dist/chunk-ZLKYXRNM.js +141 -0
- package/dist/chunk-ZLKYXRNM.js.map +1 -0
- package/dist/chunk-ZLQ2IBTC.cjs +110 -0
- package/dist/chunk-ZLQ2IBTC.cjs.map +1 -0
- package/dist/chunk-ZTWLCHCO.cjs +202 -0
- package/dist/chunk-ZTWLCHCO.cjs.map +1 -0
- package/dist/chunk-ZWQBAJ5O.js +35 -0
- package/dist/chunk-ZWQBAJ5O.js.map +1 -0
- package/dist/client-DDU4-ygJ.d.cts +72 -0
- package/dist/client-pDzS7EZR.d.ts +72 -0
- package/dist/collaboration/index.cjs +44 -0
- package/dist/collaboration/index.cjs.map +1 -0
- package/dist/collaboration/index.d.cts +73 -0
- package/dist/collaboration/index.d.ts +73 -0
- package/dist/collaboration/index.js +44 -0
- package/dist/collaboration/index.js.map +1 -0
- package/dist/common-BSXkQfxI.d.cts +25 -0
- package/dist/common-BSXkQfxI.d.ts +25 -0
- package/dist/common-DRdI-75k.d.ts +8 -0
- package/dist/common-_vxreiEW.d.cts +8 -0
- package/dist/config-CMkmMtx1.d.cts +20 -0
- package/dist/config-CMkmMtx1.d.ts +20 -0
- package/dist/context-M9rOTifU.d.cts +12 -0
- package/dist/context-M9rOTifU.d.ts +12 -0
- package/dist/controller-DWs3Sy04.d.cts +9 -0
- package/dist/controller-DmI4L4sP.d.ts +9 -0
- package/dist/controlplane/index.cjs +13 -0
- package/dist/controlplane/index.cjs.map +1 -0
- package/dist/controlplane/index.d.cts +66 -0
- package/dist/controlplane/index.d.ts +66 -0
- package/dist/controlplane/index.js +13 -0
- package/dist/controlplane/index.js.map +1 -0
- package/dist/errors-BjGO6N10.d.ts +93 -0
- package/dist/errors-D9OtcR-o.d.cts +93 -0
- package/dist/event-converters-BIn8odqo.d.ts +38 -0
- package/dist/event-converters-Cn_NeGyQ.d.cts +38 -0
- package/dist/google-adk-model-N47R7GB2.js +208 -0
- package/dist/google-adk-model-N47R7GB2.js.map +1 -0
- package/dist/google-adk-model-PDBKY5YZ.cjs +208 -0
- package/dist/google-adk-model-PDBKY5YZ.cjs.map +1 -0
- package/dist/index.cjs +322 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +78 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +322 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/ai-sdk.cjs +15 -0
- package/dist/integrations/ai-sdk.cjs.map +1 -0
- package/dist/integrations/ai-sdk.d.cts +21 -0
- package/dist/integrations/ai-sdk.d.ts +21 -0
- package/dist/integrations/ai-sdk.js +15 -0
- package/dist/integrations/ai-sdk.js.map +1 -0
- package/dist/integrations/google-adk.cjs +90 -0
- package/dist/integrations/google-adk.cjs.map +1 -0
- package/dist/integrations/google-adk.d.cts +46 -0
- package/dist/integrations/google-adk.d.ts +46 -0
- package/dist/integrations/google-adk.js +90 -0
- package/dist/integrations/google-adk.js.map +1 -0
- package/dist/integrations/langchain.cjs +95 -0
- package/dist/integrations/langchain.cjs.map +1 -0
- package/dist/integrations/langchain.d.cts +52 -0
- package/dist/integrations/langchain.d.ts +52 -0
- package/dist/integrations/langchain.js +95 -0
- package/dist/integrations/langchain.js.map +1 -0
- package/dist/integrations/langgraph.cjs +30 -0
- package/dist/integrations/langgraph.cjs.map +1 -0
- package/dist/integrations/langgraph.d.cts +53 -0
- package/dist/integrations/langgraph.d.ts +53 -0
- package/dist/integrations/langgraph.js +30 -0
- package/dist/integrations/langgraph.js.map +1 -0
- package/dist/integrations/mastra.cjs +108 -0
- package/dist/integrations/mastra.cjs.map +1 -0
- package/dist/integrations/mastra.d.cts +47 -0
- package/dist/integrations/mastra.d.ts +47 -0
- package/dist/integrations/mastra.js +108 -0
- package/dist/integrations/mastra.js.map +1 -0
- package/dist/langchain-adapter-DFJdEX04.d.cts +47 -0
- package/dist/langchain-adapter-DJsyjm5V.d.ts +47 -0
- package/dist/langchain-provider-NF5GIDQV.cjs +227 -0
- package/dist/langchain-provider-NF5GIDQV.cjs.map +1 -0
- package/dist/langchain-provider-PHL4UWNF.js +227 -0
- package/dist/langchain-provider-PHL4UWNF.js.map +1 -0
- package/dist/loader-DrIQ37nm.d.ts +38 -0
- package/dist/loader-eWuJ2GSL.d.cts +38 -0
- package/dist/logging-C8GLLg1f.d.cts +9 -0
- package/dist/logging-C8GLLg1f.d.ts +9 -0
- package/dist/managed-CwLx9h4C.d.cts +32 -0
- package/dist/managed-D9eQK1ut.d.ts +32 -0
- package/dist/mcp/index.cjs +12 -0
- package/dist/mcp/index.cjs.map +1 -0
- package/dist/mcp/index.d.cts +62 -0
- package/dist/mcp/index.d.ts +62 -0
- package/dist/mcp/index.js +12 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/memory/index.cjs +12 -0
- package/dist/memory/index.cjs.map +1 -0
- package/dist/memory/index.d.cts +113 -0
- package/dist/memory/index.d.ts +113 -0
- package/dist/memory/index.js +12 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/model/index.cjs +16 -0
- package/dist/model/index.cjs.map +1 -0
- package/dist/model/index.d.cts +129 -0
- package/dist/model/index.d.ts +129 -0
- package/dist/model/index.js +16 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model-CkYHzHPk.d.cts +50 -0
- package/dist/model-CkYHzHPk.d.ts +50 -0
- package/dist/runtime/index.cjs +49 -0
- package/dist/runtime/index.cjs.map +1 -0
- package/dist/runtime/index.d.cts +73 -0
- package/dist/runtime/index.d.ts +73 -0
- package/dist/runtime/index.js +49 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/server/index.cjs +604 -0
- package/dist/server/index.cjs.map +1 -0
- package/dist/server/index.d.cts +69 -0
- package/dist/server/index.d.ts +69 -0
- package/dist/server/index.js +604 -0
- package/dist/server/index.js.map +1 -0
- package/dist/skill/index.cjs +14 -0
- package/dist/skill/index.cjs.map +1 -0
- package/dist/skill/index.d.cts +16 -0
- package/dist/skill/index.d.ts +16 -0
- package/dist/skill/index.js +14 -0
- package/dist/skill/index.js.map +1 -0
- package/package.json +292 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/integrations/common.ts
|
|
2
|
+
var Tool = class {
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.name = options.name;
|
|
9
|
+
this.description = options.description;
|
|
10
|
+
this.parameters = Object.freeze({ ...options.parameters });
|
|
11
|
+
this.call = options.invoke;
|
|
12
|
+
}
|
|
13
|
+
async invoke(arguments_) {
|
|
14
|
+
return this.call({ ...arguments_ });
|
|
15
|
+
}
|
|
16
|
+
openAISchema() {
|
|
17
|
+
return { type: "function", function: { name: this.name, description: this.description, parameters: this.parameters } };
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
exports.Tool = Tool;
|
|
24
|
+
//# sourceMappingURL=chunk-EGUKJE3Z.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/zhuoguang/Documents/Code/collaborate/hiclaw/agentcore-sdk-nodejs/dist/chunk-EGUKJE3Z.cjs","../src/integrations/common.ts"],"names":[],"mappings":"AAAA;ACQO,IAAM,KAAA,EAAN,MAAW;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACQ;AAAA,EACjB,WAAA,CAAY,OAAA,EAAsB;AAChC,IAAA,IAAA,CAAK,KAAA,EAAO,OAAA,CAAQ,IAAA;AAAM,IAAA,IAAA,CAAK,YAAA,EAAc,OAAA,CAAQ,WAAA;AACrD,IAAA,IAAA,CAAK,WAAA,EAAa,MAAA,CAAO,MAAA,CAAO,EAAE,GAAG,OAAA,CAAQ,WAAW,CAAC,CAAA;AAAG,IAAA,IAAA,CAAK,KAAA,EAAO,OAAA,CAAQ,MAAA;AAAA,EAClF;AAAA,EACA,MAAM,MAAA,CAAO,UAAA,EAA6C;AAAE,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,EAAE,GAAG,WAAW,CAAC,CAAA;AAAA,EAAG;AAAA,EACjG,YAAA,CAAA,EAAe;AACb,IAAA,OAAO,EAAE,IAAA,EAAM,UAAA,EAAqB,QAAA,EAAU,EAAE,IAAA,EAAM,IAAA,CAAK,IAAA,EAAM,WAAA,EAAa,IAAA,CAAK,WAAA,EAAa,UAAA,EAAY,IAAA,CAAK,WAAW,EAAE,CAAA;AAAA,EAChI;AACF,CAAA;ADFA;AACA;AACE;AACF,oBAAC","file":"/Users/zhuoguang/Documents/Code/collaborate/hiclaw/agentcore-sdk-nodejs/dist/chunk-EGUKJE3Z.cjs","sourcesContent":[null,"export type ToolArguments = Record<string, unknown>;\nexport interface ToolOptions {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n invoke(arguments_: ToolArguments): unknown | Promise<unknown>;\n}\n\nexport class Tool {\n readonly name: string;\n readonly description: string;\n readonly parameters: Readonly<Record<string, unknown>>;\n private readonly call: ToolOptions['invoke'];\n constructor(options: ToolOptions) {\n this.name = options.name; this.description = options.description;\n this.parameters = Object.freeze({ ...options.parameters }); this.call = options.invoke;\n }\n async invoke(arguments_: ToolArguments): Promise<unknown> { return this.call({ ...arguments_ }); }\n openAISchema() {\n return { type: 'function' as const, function: { name: this.name, description: this.description, parameters: this.parameters } };\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/integrations/common.ts
|
|
2
|
+
var Tool = class {
|
|
3
|
+
name;
|
|
4
|
+
description;
|
|
5
|
+
parameters;
|
|
6
|
+
call;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.name = options.name;
|
|
9
|
+
this.description = options.description;
|
|
10
|
+
this.parameters = Object.freeze({ ...options.parameters });
|
|
11
|
+
this.call = options.invoke;
|
|
12
|
+
}
|
|
13
|
+
async invoke(arguments_) {
|
|
14
|
+
return this.call({ ...arguments_ });
|
|
15
|
+
}
|
|
16
|
+
openAISchema() {
|
|
17
|
+
return { type: "function", function: { name: this.name, description: this.description, parameters: this.parameters } };
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
Tool
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-EKXZKKJJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/integrations/common.ts"],"sourcesContent":["export type ToolArguments = Record<string, unknown>;\nexport interface ToolOptions {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n invoke(arguments_: ToolArguments): unknown | Promise<unknown>;\n}\n\nexport class Tool {\n readonly name: string;\n readonly description: string;\n readonly parameters: Readonly<Record<string, unknown>>;\n private readonly call: ToolOptions['invoke'];\n constructor(options: ToolOptions) {\n this.name = options.name; this.description = options.description;\n this.parameters = Object.freeze({ ...options.parameters }); this.call = options.invoke;\n }\n async invoke(arguments_: ToolArguments): Promise<unknown> { return this.call({ ...arguments_ }); }\n openAISchema() {\n return { type: 'function' as const, function: { name: this.name, description: this.description, parameters: this.parameters } };\n }\n}\n"],"mappings":";AAQO,IAAM,OAAN,MAAW;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACQ;AAAA,EACjB,YAAY,SAAsB;AAChC,SAAK,OAAO,QAAQ;AAAM,SAAK,cAAc,QAAQ;AACrD,SAAK,aAAa,OAAO,OAAO,EAAE,GAAG,QAAQ,WAAW,CAAC;AAAG,SAAK,OAAO,QAAQ;AAAA,EAClF;AAAA,EACA,MAAM,OAAO,YAA6C;AAAE,WAAO,KAAK,KAAK,EAAE,GAAG,WAAW,CAAC;AAAA,EAAG;AAAA,EACjG,eAAe;AACb,WAAO,EAAE,MAAM,YAAqB,UAAU,EAAE,MAAM,KAAK,MAAM,aAAa,KAAK,aAAa,YAAY,KAAK,WAAW,EAAE;AAAA,EAChI;AACF;","names":[]}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
recallMemory,
|
|
3
|
+
recordMemory,
|
|
4
|
+
referenceText,
|
|
5
|
+
validateTopK
|
|
6
|
+
} from "./chunk-UWPKFJYM.js";
|
|
7
|
+
import {
|
|
8
|
+
skillTools
|
|
9
|
+
} from "./chunk-ZLKYXRNM.js";
|
|
10
|
+
import {
|
|
11
|
+
MemoryValidationError
|
|
12
|
+
} from "./chunk-MZ5UWGXS.js";
|
|
13
|
+
|
|
14
|
+
// src/integrations/langgraph.ts
|
|
15
|
+
import { SystemMessage } from "@langchain/core/messages";
|
|
16
|
+
|
|
17
|
+
// src/integrations/langchain-adapter.ts
|
|
18
|
+
import { tool } from "@langchain/core/tools";
|
|
19
|
+
async function model(client, options = {}) {
|
|
20
|
+
if ("languageModel" in client) {
|
|
21
|
+
const { ProviderChatModel } = await import("./langchain-provider-PHL4UWNF.js");
|
|
22
|
+
return new ProviderChatModel(client, options);
|
|
23
|
+
}
|
|
24
|
+
const { provider, model: model2, baseURL, maxTokens } = client.settings;
|
|
25
|
+
const fetch = client.httpFetch.bind(client);
|
|
26
|
+
if (provider === "anthropic") {
|
|
27
|
+
const { ChatAnthropic } = await import("@langchain/anthropic");
|
|
28
|
+
return new ChatAnthropic({
|
|
29
|
+
streamUsage: true,
|
|
30
|
+
maxTokens,
|
|
31
|
+
...options,
|
|
32
|
+
model: model2,
|
|
33
|
+
apiKey: "agentcore-transport",
|
|
34
|
+
anthropicApiUrl: baseURL,
|
|
35
|
+
maxRetries: 0,
|
|
36
|
+
clientOptions: { baseURL, fetch }
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const { ChatOpenAI } = await import("@langchain/openai");
|
|
40
|
+
return new ChatOpenAI({
|
|
41
|
+
streamUsage: true,
|
|
42
|
+
useResponsesApi: false,
|
|
43
|
+
maxTokens,
|
|
44
|
+
...options,
|
|
45
|
+
model: model2,
|
|
46
|
+
apiKey: "agentcore-transport",
|
|
47
|
+
maxRetries: 0,
|
|
48
|
+
configuration: { baseURL, fetch }
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function tools(values) {
|
|
52
|
+
return values.map((value) => tool((args) => value.invoke(args), {
|
|
53
|
+
// LangChain's JSON Schema validator annotates its schema during dereferencing.
|
|
54
|
+
name: value.name,
|
|
55
|
+
description: value.description,
|
|
56
|
+
schema: structuredClone(value.parameters)
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
function skillTools2(values, options = {}) {
|
|
60
|
+
return tools(skillTools(values, options));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/integrations/langgraph.ts
|
|
64
|
+
var AgentCoreMemoryNodes = class {
|
|
65
|
+
constructor(store, options = {}) {
|
|
66
|
+
this.store = store;
|
|
67
|
+
this.options = options;
|
|
68
|
+
this.topK = options.topK ?? 5;
|
|
69
|
+
validateTopK(this.topK);
|
|
70
|
+
}
|
|
71
|
+
store;
|
|
72
|
+
options;
|
|
73
|
+
topK;
|
|
74
|
+
async recall(state) {
|
|
75
|
+
if (state.memoryQuery === void 0) throw new MemoryValidationError("memoryQuery is required");
|
|
76
|
+
return { memoryText: await recallMemory(this.store, state.memoryQuery, state.memoryReadScope, { topK: this.topK, logger: this.options.logger }) };
|
|
77
|
+
}
|
|
78
|
+
async record(state) {
|
|
79
|
+
if (!Array.isArray(state.memoryMessages)) throw new MemoryValidationError("memoryMessages must be an array");
|
|
80
|
+
await recordMemory(this.store, state.memoryMessages, state.memoryWriteScope, { logger: this.options.logger });
|
|
81
|
+
return { memoryMessages: [] };
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
function withMemory(messages, memoryText) {
|
|
85
|
+
const result = [...messages];
|
|
86
|
+
const note = referenceText(memoryText);
|
|
87
|
+
if (!note) return result;
|
|
88
|
+
const first = result[0];
|
|
89
|
+
if (SystemMessage.isInstance(first)) {
|
|
90
|
+
result[0] = new SystemMessage({
|
|
91
|
+
id: first.id,
|
|
92
|
+
name: first.name,
|
|
93
|
+
additional_kwargs: first.additional_kwargs,
|
|
94
|
+
response_metadata: first.response_metadata,
|
|
95
|
+
content: typeof first.content === "string" ? `${first.content}
|
|
96
|
+
|
|
97
|
+
${note}` : [...first.content, { type: "text", text: note }]
|
|
98
|
+
});
|
|
99
|
+
} else result.unshift(new SystemMessage(note));
|
|
100
|
+
return result;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
model,
|
|
105
|
+
tools,
|
|
106
|
+
skillTools2 as skillTools,
|
|
107
|
+
AgentCoreMemoryNodes,
|
|
108
|
+
withMemory
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=chunk-GYLT23D3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/integrations/langgraph.ts","../src/integrations/langchain-adapter.ts"],"sourcesContent":["import { SystemMessage, type BaseMessage } from '@langchain/core/messages';\nimport { MemoryValidationError } from '../errors';\nimport type { MemoryStore, MemoryScope, MemoryMessage } from '../memory';\nimport type { Logger } from '../logging';\nimport { recallMemory, recordMemory, referenceText, validateTopK } from './memory/common';\nexport { model, tools, skillTools } from './langchain-adapter';\nexport type { LangChainModelOptions, LangChainProviderOptions } from './langchain-adapter';\n\nexport interface MemoryNodeState {\n memoryQuery?: string;\n memoryReadScope?: MemoryScope;\n memoryWriteScope?: MemoryScope;\n memoryMessages?: readonly MemoryMessage[];\n memoryText?: string;\n}\n\n/** Explicit graph nodes: the application owns state, turn boundaries and edges. */\nexport class AgentCoreMemoryNodes {\n private readonly topK: number;\n constructor(private readonly store: MemoryStore, private readonly options: { topK?: number; logger?: Logger } = {}) {\n this.topK = options.topK ?? 5; validateTopK(this.topK);\n }\n async recall(state: MemoryNodeState): Promise<{ memoryText: string }> {\n if (state.memoryQuery === undefined) throw new MemoryValidationError('memoryQuery is required');\n return { memoryText: await recallMemory(this.store, state.memoryQuery, state.memoryReadScope, { topK: this.topK, logger: this.options.logger }) };\n }\n async record(state: MemoryNodeState): Promise<{ memoryMessages: MemoryMessage[] }> {\n if (!Array.isArray(state.memoryMessages)) throw new MemoryValidationError('memoryMessages must be an array');\n await recordMemory(this.store, state.memoryMessages, state.memoryWriteScope, { logger: this.options.logger });\n return { memoryMessages: [] };\n }\n}\n\n/** Add reference data to model input without persisting it in graph history. */\nexport function withMemory(messages: readonly BaseMessage[], memoryText: string): BaseMessage[] {\n const result = [...messages]; const note = referenceText(memoryText);\n if (!note) return result;\n const first = result[0];\n if (SystemMessage.isInstance(first)) {\n result[0] = new SystemMessage({ id: first.id, name: first.name, additional_kwargs: first.additional_kwargs, response_metadata: first.response_metadata,\n content: typeof first.content === 'string' ? `${first.content}\\n\\n${note}` : [...first.content, { type: 'text', text: note }] });\n } else result.unshift(new SystemMessage(note));\n return result;\n}\nexport { LangChainEventConverter as AgentCoreConverter } from './event-converters';\n","import type { ChatOpenAIFields } from '@langchain/openai';\nimport type { ChatAnthropicInput } from '@langchain/anthropic';\nimport { tool, type StructuredToolInterface } from '@langchain/core/tools';\nimport type { JsonSchema7Type } from '@langchain/core/utils/json_schema';\nimport type { ModelClient, ProviderModelClient } from '../model';\nimport type { ProviderChatModel, LangChainProviderOptions } from './langchain-provider';\nimport type { Tool, ToolArguments } from './common';\nimport { skillTools as canonicalSkillTools, type Skill, type SkillToolsOptions } from '../skill';\n\ntype CoreOwnedFields = 'model' | 'modelName' | 'apiKey' | 'openAIApiKey' | 'anthropicApiKey'\n | 'anthropicApiUrl' | 'configuration' | 'clientOptions' | 'createClient' | 'completions' | 'responses' | 'maxRetries';\n/** Provider-specific generation options; identity and transport belong to ModelClient. */\nexport type LangChainModelOptions = Omit<ChatOpenAIFields, CoreOwnedFields> | Omit<ChatAnthropicInput, CoreOwnedFields>;\n\nexport type { LangChainProviderOptions } from './langchain-provider';\nexport function model(client: ModelClient, options?: LangChainModelOptions): Promise<import('@langchain/openai').ChatOpenAI | import('@langchain/anthropic').ChatAnthropic>;\nexport function model(client: ProviderModelClient, options?: LangChainProviderOptions): Promise<ProviderChatModel>;\nexport async function model(client: ModelClient | ProviderModelClient, options: LangChainModelOptions | LangChainProviderOptions = {}) {\n if ('languageModel' in client) {\n const { ProviderChatModel } = await import('./langchain-provider');\n return new ProviderChatModel(client, options as LangChainProviderOptions);\n }\n const { provider, model, baseURL, maxTokens } = client.settings;\n const fetch = client.httpFetch.bind(client);\n if (provider === 'anthropic') {\n const { ChatAnthropic } = await import('@langchain/anthropic');\n return new ChatAnthropic({ streamUsage: true, maxTokens,\n ...options as ChatAnthropicInput,\n model, apiKey: 'agentcore-transport', anthropicApiUrl: baseURL, maxRetries: 0,\n clientOptions: { baseURL, fetch },\n });\n }\n const { ChatOpenAI } = await import('@langchain/openai');\n return new ChatOpenAI({ streamUsage: true, useResponsesApi: false, maxTokens,\n ...options as ChatOpenAIFields,\n model, apiKey: 'agentcore-transport', maxRetries: 0, configuration: { baseURL, fetch },\n });\n}\n\n/** Keep native schema validation, ToolMessage conversion, callbacks and tool execution. */\nexport function tools(values: readonly Tool[]): StructuredToolInterface[] {\n return values.map(value => tool((args: ToolArguments) => value.invoke(args), {\n // LangChain's JSON Schema validator annotates its schema during dereferencing.\n name: value.name, description: value.description, schema: structuredClone(value.parameters) as JsonSchema7Type,\n }));\n}\nexport function skillTools(values: readonly Skill[], options: SkillToolsOptions = {}): StructuredToolInterface[] {\n return tools(canonicalSkillTools(values, options));\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,qBAAuC;;;ACEhD,SAAS,YAA0C;AAenD,eAAsB,MAAM,QAA2C,UAA4D,CAAC,GAAG;AACrI,MAAI,mBAAmB,QAAQ;AAC7B,UAAM,EAAE,kBAAkB,IAAI,MAAM,OAAO,kCAAsB;AACjE,WAAO,IAAI,kBAAkB,QAAQ,OAAmC;AAAA,EAC1E;AACA,QAAM,EAAE,UAAU,OAAAA,QAAO,SAAS,UAAU,IAAI,OAAO;AACvD,QAAM,QAAQ,OAAO,UAAU,KAAK,MAAM;AAC1C,MAAI,aAAa,aAAa;AAC5B,UAAM,EAAE,cAAc,IAAI,MAAM,OAAO,sBAAsB;AAC7D,WAAO,IAAI,cAAc;AAAA,MAAE,aAAa;AAAA,MAAM;AAAA,MAC5C,GAAG;AAAA,MACH,OAAAA;AAAA,MAAO,QAAQ;AAAA,MAAuB,iBAAiB;AAAA,MAAS,YAAY;AAAA,MAC5E,eAAe,EAAE,SAAS,MAAM;AAAA,IAClC,CAAC;AAAA,EACH;AACA,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,mBAAmB;AACvD,SAAO,IAAI,WAAW;AAAA,IAAE,aAAa;AAAA,IAAM,iBAAiB;AAAA,IAAO;AAAA,IACjE,GAAG;AAAA,IACH,OAAAA;AAAA,IAAO,QAAQ;AAAA,IAAuB,YAAY;AAAA,IAAG,eAAe,EAAE,SAAS,MAAM;AAAA,EACvF,CAAC;AACH;AAGO,SAAS,MAAM,QAAoD;AACxE,SAAO,OAAO,IAAI,WAAS,KAAK,CAAC,SAAwB,MAAM,OAAO,IAAI,GA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BAAmB,MAAM;AAAA,MAAmB,mBAAmB,MAAM;AAAA,MACnI,SAAS,OAAO,MAAM,YAAY,WAAW,GAAG,MAAM,OAAO;AAAA;AAAA,EAAO,IAAI,KAAK,CAAC,GAAG,MAAM,SAAS,EAAE,MAAM,QAAQ,MAAM,KAAK,CAAC;AAAA,IAAE,CAAC;AAAA,EACnI,MAAO,QAAO,QAAQ,IAAI,cAAc,IAAI,CAAC;AAC7C,SAAO;AACT;","names":["model","skillTools"]}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HIGH_CODE_SDK_PURPOSE
|
|
3
|
+
} from "./chunk-IUCLCPVV.js";
|
|
4
|
+
import {
|
|
5
|
+
nullLogger
|
|
6
|
+
} from "./chunk-NZL3VPJ2.js";
|
|
7
|
+
import {
|
|
8
|
+
AddMemoriesOutcomeUnknownError,
|
|
9
|
+
MemoryAPIError,
|
|
10
|
+
MemoryContractError,
|
|
11
|
+
MemoryValidationError,
|
|
12
|
+
ResourceNotConfiguredError
|
|
13
|
+
} from "./chunk-MZ5UWGXS.js";
|
|
14
|
+
|
|
15
|
+
// src/memory/transport.ts
|
|
16
|
+
import Client from "@alicloud/agentcore20260804";
|
|
17
|
+
import { $OpenApiUtil, OpenApiUtil } from "@alicloud/openapi-core";
|
|
18
|
+
import * as Dara from "@darabonba/typescript";
|
|
19
|
+
import { RuntimeOptions } from "@darabonba/typescript";
|
|
20
|
+
var GeneratedClient = typeof Client === "function" ? Client : Client.default;
|
|
21
|
+
var DaraURL = Dara.URL ?? Dara.default.URL;
|
|
22
|
+
var pathComponent = (value) => DaraURL.percentEncode(value);
|
|
23
|
+
var MemoryTransport = class {
|
|
24
|
+
constructor(store, runtime, logger = nullLogger) {
|
|
25
|
+
this.store = store;
|
|
26
|
+
this.runtime = runtime;
|
|
27
|
+
this.logger = logger;
|
|
28
|
+
}
|
|
29
|
+
store;
|
|
30
|
+
runtime;
|
|
31
|
+
logger;
|
|
32
|
+
async request(operation, method, path, map, body, query) {
|
|
33
|
+
const runtime = await this.runtime();
|
|
34
|
+
const credential = runtime.accessKeyCredential ?? await runtime.resourceSTS?.get(HIGH_CODE_SDK_PURPOSE);
|
|
35
|
+
if (!credential) throw new ResourceNotConfiguredError("AgentCore Memory data-plane credentials are not configured");
|
|
36
|
+
const url = runtime.endpoint ? new URL(runtime.endpoint.includes("://") ? runtime.endpoint : `https://${runtime.endpoint}`) : void 0;
|
|
37
|
+
const client = new GeneratedClient(new $OpenApiUtil.Config({
|
|
38
|
+
accessKeyId: credential.accessKeyId,
|
|
39
|
+
accessKeySecret: credential.accessKeySecret,
|
|
40
|
+
securityToken: credential.securityToken,
|
|
41
|
+
regionId: runtime.regionId,
|
|
42
|
+
endpoint: url?.host,
|
|
43
|
+
protocol: url?.protocol.slice(0, -1)
|
|
44
|
+
}));
|
|
45
|
+
const params = new $OpenApiUtil.Params({
|
|
46
|
+
action: operation,
|
|
47
|
+
version: "2026-08-04",
|
|
48
|
+
protocol: "HTTPS",
|
|
49
|
+
pathname: `/workspaces/${pathComponent(runtime.workspaceId)}/memorystores/${pathComponent(this.store)}${path}`,
|
|
50
|
+
method,
|
|
51
|
+
authType: "AK",
|
|
52
|
+
style: "ROA",
|
|
53
|
+
reqBodyType: body === void 0 ? "json" : "formData",
|
|
54
|
+
bodyType: "json"
|
|
55
|
+
});
|
|
56
|
+
const request = new $OpenApiUtil.OpenApiRequest({
|
|
57
|
+
headers: {},
|
|
58
|
+
query: OpenApiUtil.query(query ?? {}),
|
|
59
|
+
body: body === void 0 ? void 0 : { body: JSON.stringify(body) }
|
|
60
|
+
});
|
|
61
|
+
const add = operation === "AddMemories";
|
|
62
|
+
let raw;
|
|
63
|
+
this.logger.debug("agentcore.memory.request.started", { operation, memory_store_name: this.store });
|
|
64
|
+
try {
|
|
65
|
+
raw = await client.callApi(params, request, new RuntimeOptions({
|
|
66
|
+
autoretry: false,
|
|
67
|
+
maxAttempts: 1,
|
|
68
|
+
connectTimeout: add ? 12e4 : void 0,
|
|
69
|
+
readTimeout: add ? 12e4 : void 0
|
|
70
|
+
}));
|
|
71
|
+
} catch (cause) {
|
|
72
|
+
const details2 = errorDetails(cause);
|
|
73
|
+
const error = add && (details2.httpStatusCode === void 0 || details2.httpStatusCode >= 500) ? new AddMemoriesOutcomeUnknownError(operation, details2) : new MemoryAPIError(operation, details2);
|
|
74
|
+
this.logFailure(error);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
const response = record(raw);
|
|
78
|
+
const payload = record(response.body);
|
|
79
|
+
const details = {
|
|
80
|
+
serviceCode: text(payload.code),
|
|
81
|
+
httpStatusCode: integer(payload.httpStatusCode) ?? integer(response.statusCode),
|
|
82
|
+
requestId: text(payload.requestId) ?? text(record(response.headers)["x-acs-request-id"])
|
|
83
|
+
};
|
|
84
|
+
try {
|
|
85
|
+
if ((integer(response.statusCode) ?? 0) >= 400 || payload.success === false) {
|
|
86
|
+
throw add && (details.httpStatusCode ?? 0) >= 500 ? new AddMemoriesOutcomeUnknownError(operation, details) : new MemoryAPIError(operation, details);
|
|
87
|
+
}
|
|
88
|
+
if (payload.success !== true) throw new MemoryContractError(operation, "body.success must be true");
|
|
89
|
+
return map(payload);
|
|
90
|
+
} catch (cause) {
|
|
91
|
+
const error = add && cause instanceof MemoryContractError ? new AddMemoriesOutcomeUnknownError(operation, details) : cause;
|
|
92
|
+
if (error instanceof MemoryAPIError || error instanceof MemoryContractError) this.logFailure(error);
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
logFailure(error) {
|
|
97
|
+
this.logger.warn("agentcore.memory.request.failed", {
|
|
98
|
+
operation: error.operation,
|
|
99
|
+
memory_store_name: this.store,
|
|
100
|
+
error_type: error.name,
|
|
101
|
+
status: error instanceof MemoryAPIError ? error.httpStatusCode : void 0,
|
|
102
|
+
service_code: error instanceof MemoryAPIError ? error.serviceCode : void 0,
|
|
103
|
+
request_id: error instanceof MemoryAPIError ? error.requestId : void 0
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
function record(value) {
|
|
108
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
109
|
+
}
|
|
110
|
+
function text(value) {
|
|
111
|
+
return typeof value === "string" && value ? value : void 0;
|
|
112
|
+
}
|
|
113
|
+
function integer(value) {
|
|
114
|
+
return typeof value === "number" && Number.isInteger(value) ? value : void 0;
|
|
115
|
+
}
|
|
116
|
+
function errorDetails(error) {
|
|
117
|
+
let current = record(error);
|
|
118
|
+
const result = {};
|
|
119
|
+
for (let i = 0; i < 4; i++) {
|
|
120
|
+
const data = record(current.data);
|
|
121
|
+
const response = record(current.response);
|
|
122
|
+
result.serviceCode ??= text(current.code) ?? text(data.code) ?? text(data.Code);
|
|
123
|
+
result.httpStatusCode ??= integer(current.statusCode) ?? integer(data.statusCode) ?? integer(data.StatusCode) ?? integer(response.statusCode);
|
|
124
|
+
result.requestId ??= text(current.requestId) ?? text(data.requestId) ?? text(data.RequestId) ?? text(record(response.headers)["x-acs-request-id"]);
|
|
125
|
+
if (!current.innerException) break;
|
|
126
|
+
current = record(current.innerException);
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/memory/client.ts
|
|
132
|
+
var MemoryStore = class {
|
|
133
|
+
memoryStoreName;
|
|
134
|
+
transport;
|
|
135
|
+
constructor(name, options) {
|
|
136
|
+
this.memoryStoreName = required(name, "memoryStoreName");
|
|
137
|
+
this.transport = new MemoryTransport(name, options.runtime, options.logger);
|
|
138
|
+
}
|
|
139
|
+
async addMemories(options) {
|
|
140
|
+
const scope = validateScope(options.scope);
|
|
141
|
+
const hasText = options.text !== void 0;
|
|
142
|
+
const hasMessages = options.messages !== void 0;
|
|
143
|
+
if (hasText === hasMessages) throw new MemoryValidationError("exactly one of text or messages must be provided");
|
|
144
|
+
const text2 = hasText ? required(options.text, "text") : void 0;
|
|
145
|
+
let messages;
|
|
146
|
+
if (hasMessages) {
|
|
147
|
+
if (!Array.isArray(options.messages) || !options.messages.length) throw new MemoryValidationError("messages must be a non-empty array");
|
|
148
|
+
messages = options.messages.map((message) => ({ role: required(message?.role, "messages[].role"), content: required(message?.content, "messages[].content") }));
|
|
149
|
+
}
|
|
150
|
+
const metadata = validateMetadata(options.metadata);
|
|
151
|
+
return this.transport.request("AddMemories", "POST", "/memories", (body) => Object.freeze({ memoryIds: Object.freeze(array(record(body.data).memories, "AddMemories", "data.memories").map((item) => string(record(item).memoryId, "AddMemories", "data.memories[].memoryId", true))) }), { scope, text: text2, messages, metadata });
|
|
152
|
+
}
|
|
153
|
+
async searchMemories(query, options = {}) {
|
|
154
|
+
required(query, "query");
|
|
155
|
+
const scope = validateScope(options.scope);
|
|
156
|
+
bounded(options.topK, "topK", 50);
|
|
157
|
+
const metadata = validateMetadata(options.metadata);
|
|
158
|
+
if (options.enableRerank !== void 0 && typeof options.enableRerank !== "boolean") throw new MemoryValidationError("enableRerank must be a boolean");
|
|
159
|
+
for (const key of ["minScore", "minSimilarity"]) if (options[key] !== void 0 && (typeof options[key] !== "number" || !Number.isFinite(options[key]))) throw new MemoryValidationError(`${key} must be a finite number`);
|
|
160
|
+
return this.transport.request("SearchMemories", "POST", "/memories/search", (body) => Object.freeze({ memories: Object.freeze(array(record(body.data).memories, "SearchMemories", "data.memories").map((item) => {
|
|
161
|
+
const hit = record(item);
|
|
162
|
+
if (typeof hit.score !== "number" || typeof hit.similarity !== "number") throw new MemoryContractError("SearchMemories", "score and similarity must be numbers");
|
|
163
|
+
return Object.freeze({ memory: parseMemory(hit.memory, "SearchMemories"), score: hit.score, similarity: hit.similarity });
|
|
164
|
+
})) }), { query, scope, topK: options.topK, metadata, enableRerank: options.enableRerank, minScore: options.minScore, minSimilarity: options.minSimilarity });
|
|
165
|
+
}
|
|
166
|
+
async listMemories(options = {}) {
|
|
167
|
+
optionalScopeString(options.userId, "userId");
|
|
168
|
+
optionalScopeString(options.agentId, "agentId");
|
|
169
|
+
optionalScopeString(options.sessionId, "sessionId");
|
|
170
|
+
validatePage(options);
|
|
171
|
+
return this.transport.request(
|
|
172
|
+
"ListMemories",
|
|
173
|
+
"GET",
|
|
174
|
+
"/memories",
|
|
175
|
+
(body) => page(body, "ListMemories", (item) => parseMemory(item, "ListMemories")),
|
|
176
|
+
void 0,
|
|
177
|
+
{ userId: options.userId, agentId: options.agentId, sessionId: options.sessionId, maxResults: options.maxResults, nextToken: options.nextToken }
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
async getMemory(memoryId) {
|
|
181
|
+
required(memoryId, "memoryId");
|
|
182
|
+
return this.transport.request("GetMemory", "GET", `/memories/${pathComponent(memoryId)}`, (body) => parseMemory(body.data, "GetMemory"));
|
|
183
|
+
}
|
|
184
|
+
async updateMemory(memoryId, options) {
|
|
185
|
+
required(memoryId, "memoryId");
|
|
186
|
+
if (options.text === void 0 && options.metadata === void 0) throw new MemoryValidationError("at least one of text or metadata must be provided");
|
|
187
|
+
optional(options.text, "text");
|
|
188
|
+
const metadata = validateMetadata(options.metadata);
|
|
189
|
+
return this.transport.request("UpdateMemory", "PUT", `/memories/${pathComponent(memoryId)}`, (body) => parseMemory(body.data, "UpdateMemory"), { text: options.text, metadata });
|
|
190
|
+
}
|
|
191
|
+
async deleteMemory(memoryId) {
|
|
192
|
+
required(memoryId, "memoryId");
|
|
193
|
+
return this.transport.request("DeleteMemory", "DELETE", `/memories/${pathComponent(memoryId)}`, () => void 0);
|
|
194
|
+
}
|
|
195
|
+
async listMemorySessions(options = {}) {
|
|
196
|
+
optionalScopeString(options.userId, "userId");
|
|
197
|
+
optionalScopeString(options.agentId, "agentId");
|
|
198
|
+
validatePage(options);
|
|
199
|
+
return this.transport.request("ListMemorySessions", "GET", "/sessions", (body) => page(body, "ListMemorySessions", (item) => {
|
|
200
|
+
const session = Object.freeze({
|
|
201
|
+
agentId: optionalString(record(item).agentId, "ListMemorySessions", "items[].agentId"),
|
|
202
|
+
sessionId: optionalString(record(item).sessionId, "ListMemorySessions", "items[].sessionId"),
|
|
203
|
+
userId: optionalString(record(item).userId, "ListMemorySessions", "items[].userId")
|
|
204
|
+
});
|
|
205
|
+
if (session.userId === void 0 && session.agentId === void 0 && session.sessionId === void 0) throw new MemoryContractError("ListMemorySessions", "items[] must contain at least one scope field");
|
|
206
|
+
return session;
|
|
207
|
+
}), void 0, { userId: options.userId, agentId: options.agentId, maxResults: options.maxResults, nextToken: options.nextToken });
|
|
208
|
+
}
|
|
209
|
+
async listMemorySessionMessages(sessionId, options = {}) {
|
|
210
|
+
required(sessionId, "sessionId");
|
|
211
|
+
optionalScopeString(sessionId, "sessionId");
|
|
212
|
+
optionalScopeString(options.userId, "userId");
|
|
213
|
+
optionalScopeString(options.agentId, "agentId");
|
|
214
|
+
if (options.userId === void 0 && options.agentId === void 0) throw new MemoryValidationError("at least one of userId or agentId must be provided");
|
|
215
|
+
validatePage(options);
|
|
216
|
+
return this.transport.request(
|
|
217
|
+
"ListMemorySessionMessages",
|
|
218
|
+
"GET",
|
|
219
|
+
"/messages",
|
|
220
|
+
(body) => page(body, "ListMemorySessionMessages", (item) => Object.freeze({
|
|
221
|
+
role: string(record(item).role, "ListMemorySessionMessages", "items[].role", true),
|
|
222
|
+
content: string(record(item).content, "ListMemorySessionMessages", "items[].content", true)
|
|
223
|
+
})),
|
|
224
|
+
void 0,
|
|
225
|
+
{ userId: options.userId, agentId: options.agentId, sessionId, maxResults: options.maxResults, nextToken: options.nextToken }
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
function required(value, field) {
|
|
230
|
+
if (typeof value !== "string" || !value.trim()) throw new MemoryValidationError(`${field} must be a non-empty string`);
|
|
231
|
+
return value;
|
|
232
|
+
}
|
|
233
|
+
function optional(value, field) {
|
|
234
|
+
if (value !== void 0) required(value, field);
|
|
235
|
+
}
|
|
236
|
+
function bounded(value, field, maximum) {
|
|
237
|
+
if (value !== void 0 && (typeof value !== "number" || !Number.isInteger(value) || value < 1 || value > maximum)) throw new MemoryValidationError(`${field} must be an integer from 1 to ${maximum}`);
|
|
238
|
+
}
|
|
239
|
+
function optionalScopeString(value, field) {
|
|
240
|
+
if (value === void 0) return;
|
|
241
|
+
if (["*", "__default__"].includes(required(value, field).trim())) throw new MemoryValidationError(`${field} must not use a reserved scope value`);
|
|
242
|
+
}
|
|
243
|
+
function validateScope(scope) {
|
|
244
|
+
if (scope === void 0) return void 0;
|
|
245
|
+
if (!scope || typeof scope !== "object" || Array.isArray(scope)) throw new MemoryValidationError("scope must be a MemoryScope");
|
|
246
|
+
optionalScopeString(scope.userId, "scope.userId");
|
|
247
|
+
optionalScopeString(scope.agentId, "scope.agentId");
|
|
248
|
+
optionalScopeString(scope.sessionId, "scope.sessionId");
|
|
249
|
+
return { userId: scope.userId, agentId: scope.agentId, sessionId: scope.sessionId };
|
|
250
|
+
}
|
|
251
|
+
function validateMetadata(value) {
|
|
252
|
+
if (value === void 0) return void 0;
|
|
253
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.entries(value).some(([key, item]) => !key.trim() || typeof item !== "string")) throw new MemoryValidationError("metadata must contain non-empty string keys and string values");
|
|
254
|
+
return { ...value };
|
|
255
|
+
}
|
|
256
|
+
function validatePage(options) {
|
|
257
|
+
bounded(options.maxResults, "maxResults", 100);
|
|
258
|
+
if (options.nextToken !== void 0 && typeof options.nextToken !== "string") throw new MemoryValidationError("nextToken must be a string");
|
|
259
|
+
}
|
|
260
|
+
function array(value, operation, path) {
|
|
261
|
+
if (value === void 0 || value === null) return [];
|
|
262
|
+
if (!Array.isArray(value)) throw new MemoryContractError(operation, `${path} must be an array`);
|
|
263
|
+
return value;
|
|
264
|
+
}
|
|
265
|
+
function string(value, operation, path, nonEmpty = false) {
|
|
266
|
+
if (typeof value !== "string" || nonEmpty && !value.trim()) throw new MemoryContractError(operation, `${path} must be ${nonEmpty ? "a non-empty" : "a"} string`);
|
|
267
|
+
return value;
|
|
268
|
+
}
|
|
269
|
+
function optionalString(value, operation, path) {
|
|
270
|
+
return value === void 0 || value === null ? void 0 : string(value, operation, path);
|
|
271
|
+
}
|
|
272
|
+
function parseMemory(value, operation) {
|
|
273
|
+
const item = record(value);
|
|
274
|
+
const scope = record(item.scope);
|
|
275
|
+
const memoryId = string(item.memoryId, operation, "memory.memoryId", true);
|
|
276
|
+
const text2 = string(record(item.content).text, operation, "memory.content.text");
|
|
277
|
+
if (!item.scope || typeof item.scope !== "object" || Array.isArray(item.scope)) throw new MemoryContractError(operation, "memory.scope must be an object");
|
|
278
|
+
let metadata;
|
|
279
|
+
if (item.metadata !== void 0 && item.metadata !== null) {
|
|
280
|
+
if (typeof item.metadata !== "object" || Array.isArray(item.metadata) || Object.entries(item.metadata).some(([key, value2]) => !key.trim() || typeof value2 !== "string")) throw new MemoryContractError(operation, "memory.metadata must contain string keys and values");
|
|
281
|
+
metadata = Object.freeze({ ...item.metadata });
|
|
282
|
+
}
|
|
283
|
+
return Object.freeze({
|
|
284
|
+
memoryId,
|
|
285
|
+
content: Object.freeze({ text: text2 }),
|
|
286
|
+
scope: Object.freeze({ agentId: optionalString(scope.agentId, operation, "memory.scope.agentId"), sessionId: optionalString(scope.sessionId, operation, "memory.scope.sessionId"), userId: optionalString(scope.userId, operation, "memory.scope.userId") }),
|
|
287
|
+
metadata,
|
|
288
|
+
createdAt: optionalString(item.createdAt, operation, "memory.createdAt"),
|
|
289
|
+
updatedAt: optionalString(item.updatedAt, operation, "memory.updatedAt")
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function page(body, operation, parse) {
|
|
293
|
+
for (const key of ["maxResults", "totalCount"]) if (body[key] !== void 0 && body[key] !== null && (typeof body[key] !== "number" || !Number.isInteger(body[key]))) throw new MemoryContractError(operation, `body.${key} must be an integer`);
|
|
294
|
+
return Object.freeze({
|
|
295
|
+
items: Object.freeze(array(body.items, operation, "body.items").map(parse)),
|
|
296
|
+
maxResults: body.maxResults == null ? void 0 : body.maxResults,
|
|
297
|
+
totalCount: body.totalCount == null ? void 0 : body.totalCount,
|
|
298
|
+
nextToken: optionalString(body.nextToken, operation, "body.nextToken") || void 0
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export {
|
|
303
|
+
MemoryStore,
|
|
304
|
+
validateScope
|
|
305
|
+
};
|
|
306
|
+
//# sourceMappingURL=chunk-IF7LMBXC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/memory/transport.ts","../src/memory/client.ts"],"sourcesContent":["import Client from '@alicloud/agentcore20260804';\nimport { $OpenApiUtil, OpenApiUtil } from '@alicloud/openapi-core';\nimport * as Dara from '@darabonba/typescript';\nimport { RuntimeOptions } from '@darabonba/typescript';\nimport type { AccessKeyCredential, CredentialProvider } from '../auth/access-key';\nimport { HIGH_CODE_SDK_PURPOSE } from '../auth/resource-sts';\nimport { AddMemoriesOutcomeUnknownError, MemoryAPIError, MemoryContractError, ResourceNotConfiguredError, type MemoryErrorDetails } from '../errors';\nimport { nullLogger, type Logger } from '../logging';\n\nconst GeneratedClient = typeof Client === 'function' ? Client : (Client as unknown as { default: typeof Client }).default;\n// CJS exposes URL directly; native ESM only exposes it on module.exports/default.\nconst DaraURL = Dara.URL ?? (Dara as unknown as { default: typeof Dara }).default.URL;\nexport interface MemoryRuntime {\n workspaceId: string;\n regionId: string;\n endpoint?: string;\n accessKeyCredential?: AccessKeyCredential;\n resourceSTS?: CredentialProvider;\n}\nexport type MemoryOperation = 'AddMemories' | 'SearchMemories' | 'ListMemories' | 'GetMemory' | 'UpdateMemory' | 'DeleteMemory' | 'ListMemorySessions' | 'ListMemorySessionMessages';\nexport const pathComponent = (value: string): string => DaraURL.percentEncode(value);\n\n/** Memory methods absent from the public generated package, using its existing POP transport. */\nexport class MemoryTransport {\n constructor(private readonly store: string, private readonly runtime: () => Promise<MemoryRuntime>, private readonly logger: Logger = nullLogger) {}\n async request<T>(operation: MemoryOperation, method: string, path: string, map: (body: Record<string, unknown>) => T,\n body?: Record<string, unknown>, query?: Record<string, unknown>): Promise<T> {\n const runtime = await this.runtime();\n const credential = runtime.accessKeyCredential ?? await runtime.resourceSTS?.get(HIGH_CODE_SDK_PURPOSE);\n if (!credential) throw new ResourceNotConfiguredError('AgentCore Memory data-plane credentials are not configured');\n const url = runtime.endpoint ? new URL(runtime.endpoint.includes('://') ? runtime.endpoint : `https://${runtime.endpoint}`) : undefined;\n const client = new GeneratedClient(new $OpenApiUtil.Config({ accessKeyId: credential.accessKeyId, accessKeySecret: credential.accessKeySecret,\n securityToken: credential.securityToken, regionId: runtime.regionId, endpoint: url?.host, protocol: url?.protocol.slice(0, -1) }));\n const params = new $OpenApiUtil.Params({ action: operation, version: '2026-08-04', protocol: 'HTTPS',\n pathname: `/workspaces/${pathComponent(runtime.workspaceId)}/memorystores/${pathComponent(this.store)}${path}`,\n method, authType: 'AK', style: 'ROA', reqBodyType: body === undefined ? 'json' : 'formData', bodyType: 'json' });\n // The generated Python contract wraps JSON in the form field `body`.\n const request = new $OpenApiUtil.OpenApiRequest({ headers: {}, query: OpenApiUtil.query(query ?? {}),\n body: body === undefined ? undefined : { body: JSON.stringify(body) } });\n const add = operation === 'AddMemories';\n let raw: unknown;\n this.logger.debug('agentcore.memory.request.started', { operation, memory_store_name: this.store });\n try {\n // httpx also uses connectTimeout as socket inactivity timeout while awaiting the response.\n raw = await client.callApi(params, request, new RuntimeOptions({ autoretry: false, maxAttempts: 1,\n connectTimeout: add ? 120_000 : undefined, readTimeout: add ? 120_000 : undefined }));\n } catch (cause) {\n const details = errorDetails(cause);\n const error = add && (details.httpStatusCode === undefined || details.httpStatusCode >= 500)\n ? new AddMemoriesOutcomeUnknownError(operation, details) : new MemoryAPIError(operation, details);\n this.logFailure(error); throw error;\n }\n const response = record(raw); const payload = record(response.body);\n const details: MemoryErrorDetails = { serviceCode: text(payload.code), httpStatusCode: integer(payload.httpStatusCode) ?? integer(response.statusCode),\n requestId: text(payload.requestId) ?? text(record(response.headers)['x-acs-request-id']) };\n try {\n if ((integer(response.statusCode) ?? 0) >= 400 || payload.success === false) {\n throw add && (details.httpStatusCode ?? 0) >= 500 ? new AddMemoriesOutcomeUnknownError(operation, details) : new MemoryAPIError(operation, details);\n }\n if (payload.success !== true) throw new MemoryContractError(operation, 'body.success must be true');\n return map(payload);\n } catch (cause) {\n const error = add && cause instanceof MemoryContractError ? new AddMemoriesOutcomeUnknownError(operation, details) : cause;\n if (error instanceof MemoryAPIError || error instanceof MemoryContractError) this.logFailure(error);\n throw error;\n }\n }\n private logFailure(error: MemoryAPIError | MemoryContractError): void {\n this.logger.warn('agentcore.memory.request.failed', { operation: error.operation, memory_store_name: this.store, error_type: error.name,\n status: error instanceof MemoryAPIError ? error.httpStatusCode : undefined,\n service_code: error instanceof MemoryAPIError ? error.serviceCode : undefined,\n request_id: error instanceof MemoryAPIError ? error.requestId : undefined });\n }\n}\nexport function record(value: unknown): Record<string, unknown> { return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {}; }\nfunction text(value: unknown): string | undefined { return typeof value === 'string' && value ? value : undefined; }\nfunction integer(value: unknown): number | undefined { return typeof value === 'number' && Number.isInteger(value) ? value : undefined; }\nfunction errorDetails(error: unknown): MemoryErrorDetails {\n let current = record(error); const result: MemoryErrorDetails = {};\n for (let i = 0; i < 4; i++) {\n const data = record(current.data); const response = record(current.response);\n result.serviceCode ??= text(current.code) ?? text(data.code) ?? text(data.Code);\n result.httpStatusCode ??= integer(current.statusCode) ?? integer(data.statusCode) ?? integer(data.StatusCode) ?? integer(response.statusCode);\n result.requestId ??= text(current.requestId) ?? text(data.requestId) ?? text(data.RequestId) ?? text(record(response.headers)['x-acs-request-id']);\n if (!current.innerException) break;\n current = record(current.innerException);\n }\n return result;\n}\n","import { MemoryContractError, MemoryValidationError } from '../errors';\nimport type { Logger } from '../logging';\nimport { MemoryTransport, pathComponent, record, type MemoryRuntime, type MemoryOperation } from './transport';\nimport type { AddMemoriesOptions, AddMemoriesResult, ListMemoriesOptions, ListMemorySessionsOptions, ListMemorySessionMessagesOptions, Memory, MemoryMessage, MemoryScope, MemorySession,\n Page, PageOptions, SearchMemoriesOptions, SearchMemoriesResult, UpdateMemoryOptions } from './models';\n\n/** A local binding to an existing MemoryStore. No lookup or creation at construction. */\nexport class MemoryStore {\n readonly memoryStoreName: string;\n private readonly transport: MemoryTransport;\n constructor(name: string, options: { runtime: () => Promise<MemoryRuntime>; logger?: Logger }) {\n this.memoryStoreName = required(name, 'memoryStoreName');\n this.transport = new MemoryTransport(name, options.runtime, options.logger);\n }\n async addMemories(options: AddMemoriesOptions): Promise<AddMemoriesResult> {\n const scope = validateScope(options.scope);\n const hasText = options.text !== undefined; const hasMessages = options.messages !== undefined;\n if (hasText === hasMessages) throw new MemoryValidationError('exactly one of text or messages must be provided');\n const text = hasText ? required(options.text, 'text') : undefined;\n let messages: MemoryMessage[] | undefined;\n if (hasMessages) {\n if (!Array.isArray(options.messages) || !options.messages.length) throw new MemoryValidationError('messages must be a non-empty array');\n messages = options.messages.map((message) => ({ role: required(message?.role, 'messages[].role'), content: required(message?.content, 'messages[].content') }));\n }\n const metadata = validateMetadata(options.metadata);\n return this.transport.request('AddMemories', 'POST', '/memories', (body) => Object.freeze({ memoryIds: Object.freeze(array(record(body.data).memories, 'AddMemories', 'data.memories').map((item) =>\n string(record(item).memoryId, 'AddMemories', 'data.memories[].memoryId', true))) }), { scope, text, messages, metadata });\n }\n async searchMemories(query: string, options: SearchMemoriesOptions = {}): Promise<SearchMemoriesResult> {\n required(query, 'query'); const scope = validateScope(options.scope);\n bounded(options.topK, 'topK', 50); const metadata = validateMetadata(options.metadata);\n if (options.enableRerank !== undefined && typeof options.enableRerank !== 'boolean') throw new MemoryValidationError('enableRerank must be a boolean');\n for (const key of ['minScore', 'minSimilarity'] as const) if (options[key] !== undefined && (typeof options[key] !== 'number' || !Number.isFinite(options[key]))) throw new MemoryValidationError(`${key} must be a finite number`);\n return this.transport.request('SearchMemories', 'POST', '/memories/search', (body) => Object.freeze({ memories: Object.freeze(array(record(body.data).memories, 'SearchMemories', 'data.memories').map((item) => {\n const hit = record(item);\n if (typeof hit.score !== 'number' || typeof hit.similarity !== 'number') throw new MemoryContractError('SearchMemories', 'score and similarity must be numbers');\n return Object.freeze({ memory: parseMemory(hit.memory, 'SearchMemories'), score: hit.score, similarity: hit.similarity });\n })) }), { query, scope, topK: options.topK, metadata, enableRerank: options.enableRerank, minScore: options.minScore, minSimilarity: options.minSimilarity });\n }\n async listMemories(options: ListMemoriesOptions = {}): Promise<Page<Memory>> {\n optionalScopeString(options.userId, 'userId'); optionalScopeString(options.agentId, 'agentId'); optionalScopeString(options.sessionId, 'sessionId');\n validatePage(options);\n return this.transport.request('ListMemories', 'GET', '/memories', (body) => page(body, 'ListMemories', (item) => parseMemory(item, 'ListMemories')),\n undefined, { userId: options.userId, agentId: options.agentId, sessionId: options.sessionId, maxResults: options.maxResults, nextToken: options.nextToken });\n }\n async getMemory(memoryId: string): Promise<Memory> {\n required(memoryId, 'memoryId');\n return this.transport.request('GetMemory', 'GET', `/memories/${pathComponent(memoryId)}`, (body) => parseMemory(body.data, 'GetMemory'));\n }\n async updateMemory(memoryId: string, options: UpdateMemoryOptions): Promise<Memory> {\n required(memoryId, 'memoryId');\n if (options.text === undefined && options.metadata === undefined) throw new MemoryValidationError('at least one of text or metadata must be provided');\n optional(options.text, 'text'); const metadata = validateMetadata(options.metadata);\n return this.transport.request('UpdateMemory', 'PUT', `/memories/${pathComponent(memoryId)}`, (body) => parseMemory(body.data, 'UpdateMemory'), { text: options.text, metadata });\n }\n async deleteMemory(memoryId: string): Promise<void> {\n required(memoryId, 'memoryId');\n return this.transport.request('DeleteMemory', 'DELETE', `/memories/${pathComponent(memoryId)}`, () => undefined);\n }\n async listMemorySessions(options: ListMemorySessionsOptions = {}): Promise<Page<MemorySession>> {\n optionalScopeString(options.userId, 'userId'); optionalScopeString(options.agentId, 'agentId'); validatePage(options);\n return this.transport.request('ListMemorySessions', 'GET', '/sessions', (body) => page(body, 'ListMemorySessions', (item) => {\n const session = Object.freeze({\n agentId: optionalString(record(item).agentId, 'ListMemorySessions', 'items[].agentId'),\n sessionId: optionalString(record(item).sessionId, 'ListMemorySessions', 'items[].sessionId'),\n userId: optionalString(record(item).userId, 'ListMemorySessions', 'items[].userId'),\n });\n if (session.userId === undefined && session.agentId === undefined && session.sessionId === undefined) throw new MemoryContractError('ListMemorySessions', 'items[] must contain at least one scope field');\n return session;\n }), undefined, { userId: options.userId, agentId: options.agentId, maxResults: options.maxResults, nextToken: options.nextToken });\n }\n async listMemorySessionMessages(sessionId: string, options: ListMemorySessionMessagesOptions = {}): Promise<Page<MemoryMessage>> {\n required(sessionId, 'sessionId'); optionalScopeString(sessionId, 'sessionId');\n optionalScopeString(options.userId, 'userId'); optionalScopeString(options.agentId, 'agentId');\n if (options.userId === undefined && options.agentId === undefined) throw new MemoryValidationError('at least one of userId or agentId must be provided');\n validatePage(options);\n return this.transport.request('ListMemorySessionMessages', 'GET', '/messages',\n (body) => page(body, 'ListMemorySessionMessages', (item) => Object.freeze({\n role: string(record(item).role, 'ListMemorySessionMessages', 'items[].role', true),\n content: string(record(item).content, 'ListMemorySessionMessages', 'items[].content', true),\n })), undefined, { userId: options.userId, agentId: options.agentId, sessionId, maxResults: options.maxResults, nextToken: options.nextToken });\n }\n}\n\nfunction required(value: unknown, field: string): string {\n if (typeof value !== 'string' || !value.trim()) throw new MemoryValidationError(`${field} must be a non-empty string`);\n return value;\n}\nfunction optional(value: unknown, field: string): void { if (value !== undefined) required(value, field); }\nfunction bounded(value: unknown, field: string, maximum: number): void {\n if (value !== undefined && (typeof value !== 'number' || !Number.isInteger(value) || value < 1 || value > maximum)) throw new MemoryValidationError(`${field} must be an integer from 1 to ${maximum}`);\n}\nfunction optionalScopeString(value: unknown, field: string): void {\n if (value === undefined) return;\n if (['*', '__default__'].includes(required(value, field).trim())) throw new MemoryValidationError(`${field} must not use a reserved scope value`);\n}\nexport function validateScope(scope: MemoryScope | undefined): MemoryScope | undefined {\n if (scope === undefined) return undefined;\n if (!scope || typeof scope !== 'object' || Array.isArray(scope)) throw new MemoryValidationError('scope must be a MemoryScope');\n optionalScopeString(scope.userId, 'scope.userId'); optionalScopeString(scope.agentId, 'scope.agentId'); optionalScopeString(scope.sessionId, 'scope.sessionId');\n return { userId: scope.userId, agentId: scope.agentId, sessionId: scope.sessionId };\n}\nfunction validateMetadata(value: Readonly<Record<string, string>> | undefined): Record<string, string> | undefined {\n if (value === undefined) return undefined;\n if (!value || typeof value !== 'object' || Array.isArray(value) || Object.entries(value).some(([key, item]) => !key.trim() || typeof item !== 'string')) throw new MemoryValidationError('metadata must contain non-empty string keys and string values');\n return { ...value };\n}\nfunction validatePage(options: PageOptions): void {\n bounded(options.maxResults, 'maxResults', 100);\n if (options.nextToken !== undefined && typeof options.nextToken !== 'string') throw new MemoryValidationError('nextToken must be a string');\n}\nfunction array(value: unknown, operation: MemoryOperation, path: string): unknown[] {\n if (value === undefined || value === null) return [];\n if (!Array.isArray(value)) throw new MemoryContractError(operation, `${path} must be an array`);\n return value;\n}\nfunction string(value: unknown, operation: MemoryOperation, path: string, nonEmpty = false): string {\n if (typeof value !== 'string' || (nonEmpty && !value.trim())) throw new MemoryContractError(operation, `${path} must be ${nonEmpty ? 'a non-empty' : 'a'} string`);\n return value;\n}\nfunction optionalString(value: unknown, operation: MemoryOperation, path: string): string | undefined { return value === undefined || value === null ? undefined : string(value, operation, path); }\nfunction parseMemory(value: unknown, operation: MemoryOperation): Memory {\n const item = record(value); const scope = record(item.scope);\n const memoryId = string(item.memoryId, operation, 'memory.memoryId', true);\n const text = string(record(item.content).text, operation, 'memory.content.text');\n if (!item.scope || typeof item.scope !== 'object' || Array.isArray(item.scope)) throw new MemoryContractError(operation, 'memory.scope must be an object');\n let metadata: Readonly<Record<string, string>> | undefined;\n if (item.metadata !== undefined && item.metadata !== null) {\n if (typeof item.metadata !== 'object' || Array.isArray(item.metadata) || Object.entries(item.metadata).some(([key, value]) => !key.trim() || typeof value !== 'string')) throw new MemoryContractError(operation, 'memory.metadata must contain string keys and values');\n metadata = Object.freeze({ ...item.metadata as Record<string, string> });\n }\n return Object.freeze({ memoryId, content: Object.freeze({ text }), scope: Object.freeze({ agentId: optionalString(scope.agentId, operation, 'memory.scope.agentId'), sessionId: optionalString(scope.sessionId, operation, 'memory.scope.sessionId'), userId: optionalString(scope.userId, operation, 'memory.scope.userId') }),\n metadata, createdAt: optionalString(item.createdAt, operation, 'memory.createdAt'), updatedAt: optionalString(item.updatedAt, operation, 'memory.updatedAt') });\n}\nfunction page<T>(body: Record<string, unknown>, operation: MemoryOperation, parse: (item: unknown) => T): Page<T> {\n for (const key of ['maxResults', 'totalCount']) if (body[key] !== undefined && body[key] !== null && (typeof body[key] !== 'number' || !Number.isInteger(body[key]))) throw new MemoryContractError(operation, `body.${key} must be an integer`);\n return Object.freeze({ items: Object.freeze(array(body.items, operation, 'body.items').map(parse)), maxResults: body.maxResults == null ? undefined : body.maxResults as number,\n totalCount: body.totalCount == null ? undefined : body.totalCount as number, nextToken: optionalString(body.nextToken, operation, 'body.nextToken') || undefined });\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,YAAY;AACnB,SAAS,cAAc,mBAAmB;AAC1C,YAAY,UAAU;AACtB,SAAS,sBAAsB;AAM/B,IAAM,kBAAkB,OAAO,WAAW,aAAa,SAAU,OAAiD;AAElH,IAAM,UAAe,YAAqD,aAAQ;AAS3E,IAAM,gBAAgB,CAAC,UAA0B,QAAQ,cAAc,KAAK;AAG5E,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAA6B,OAAgC,SAAwD,SAAiB,YAAY;AAArH;AAAgC;AAAwD;AAAA,EAA8B;AAAA,EAAtH;AAAA,EAAgC;AAAA,EAAwD;AAAA,EACrH,MAAM,QAAW,WAA4B,QAAgB,MAAc,KACzE,MAAgC,OAA6C;AAC7E,UAAM,UAAU,MAAM,KAAK,QAAQ;AACnC,UAAM,aAAa,QAAQ,uBAA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