alibabacloud-agentcore-sdk 0.1.2 → 0.1.4
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/README.md +15 -2
- package/dist/auth/index.cjs +6 -7
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +5 -6
- package/dist/{chunk-RZNQGEGJ.cjs → chunk-25KH5XKG.cjs} +6 -6
- package/dist/{chunk-RZNQGEGJ.cjs.map → chunk-25KH5XKG.cjs.map} +1 -1
- package/dist/{chunk-A3WMLVJC.cjs → chunk-2TRT7RSV.cjs} +5 -7
- package/dist/chunk-2TRT7RSV.cjs.map +1 -0
- package/dist/{chunk-K3TE7625.js → chunk-3JXIMUUY.js} +2 -2
- package/dist/{chunk-UWPKFJYM.js → chunk-45S6S5WI.js} +13 -11
- package/dist/chunk-45S6S5WI.js.map +1 -0
- package/dist/{chunk-TWEO5XVM.cjs → chunk-5S55CTNM.cjs} +18 -20
- package/dist/chunk-5S55CTNM.cjs.map +1 -0
- package/dist/{chunk-JW62DVIC.js → chunk-5UQIUMSF.js} +3 -5
- package/dist/{chunk-JW62DVIC.js.map → chunk-5UQIUMSF.js.map} +1 -1
- package/dist/{chunk-ZWQBAJ5O.js → chunk-6NNPSP3O.js} +2 -2
- package/dist/{chunk-IUCLCPVV.js → chunk-76NTQYJB.js} +3 -3
- package/dist/{chunk-7Y263YIW.js → chunk-7AJ2V7RN.js} +5 -7
- package/dist/{chunk-7Y263YIW.js.map → chunk-7AJ2V7RN.js.map} +1 -1
- package/dist/{chunk-5ZOLHQXO.js → chunk-7UBN3SJI.js} +7 -9
- package/dist/{chunk-5ZOLHQXO.js.map → chunk-7UBN3SJI.js.map} +1 -1
- package/dist/{chunk-MZ5UWGXS.js → chunk-AEQ76QIO.js} +33 -5
- package/dist/chunk-AEQ76QIO.js.map +1 -0
- package/dist/{chunk-UBP5CHU7.js → chunk-AX3NM2DK.js} +5 -7
- package/dist/{chunk-UBP5CHU7.js.map → chunk-AX3NM2DK.js.map} +1 -1
- package/dist/{chunk-55XZZRKO.js → chunk-D45QSOR4.js} +4 -6
- package/dist/{chunk-55XZZRKO.js.map → chunk-D45QSOR4.js.map} +1 -1
- package/dist/{chunk-MICRSJ6R.js → chunk-EKLTJ65H.js} +2 -2
- package/dist/{chunk-RBAY4MO2.js → chunk-FG7K3EF7.js} +6 -8
- package/dist/{chunk-RBAY4MO2.js.map → chunk-FG7K3EF7.js.map} +1 -1
- package/dist/{chunk-PKYET77D.cjs → chunk-JK6KPDVW.cjs} +39 -41
- package/dist/chunk-JK6KPDVW.cjs.map +1 -0
- package/dist/{chunk-2E5EWEDG.cjs → chunk-KQTZUIMI.cjs} +10 -12
- package/dist/chunk-KQTZUIMI.cjs.map +1 -0
- package/dist/{chunk-ZLKYXRNM.js → chunk-KTKZCLYB.js} +3 -5
- package/dist/{chunk-ZLKYXRNM.js.map → chunk-KTKZCLYB.js.map} +1 -1
- package/dist/{chunk-RHY7Y43E.js → chunk-L74ASQWF.js} +8 -9
- package/dist/chunk-L74ASQWF.js.map +1 -0
- package/dist/{chunk-S7PWSJNP.cjs → chunk-LQM754U3.cjs} +5 -5
- package/dist/{chunk-S7PWSJNP.cjs.map → chunk-LQM754U3.cjs.map} +1 -1
- package/dist/{chunk-GYLT23D3.js → chunk-NI3U6RZL.js} +5 -5
- package/dist/{chunk-5JXA7JPS.js → chunk-NRYDUATX.js} +2 -2
- package/dist/{chunk-A3PF2SPD.cjs → chunk-NWWTBPYG.cjs} +5 -5
- package/dist/{chunk-A3PF2SPD.cjs.map → chunk-NWWTBPYG.cjs.map} +1 -1
- package/dist/{chunk-5RKN46UU.cjs → chunk-NXMTTQQK.cjs} +15 -15
- package/dist/{chunk-5RKN46UU.cjs.map → chunk-NXMTTQQK.cjs.map} +1 -1
- package/dist/{chunk-IF7LMBXC.js → chunk-PHVKSATD.js} +60 -16
- package/dist/chunk-PHVKSATD.js.map +1 -0
- package/dist/{chunk-RYXL25AI.js → chunk-PS3EAUMK.js} +2 -2
- package/dist/{chunk-ULJTQSLE.cjs → chunk-R7NVBTPK.cjs} +3 -3
- package/dist/{chunk-ULJTQSLE.cjs.map → chunk-R7NVBTPK.cjs.map} +1 -1
- package/dist/{chunk-YZP55W7S.cjs → chunk-RJCDBVZ6.cjs} +3 -3
- package/dist/{chunk-YZP55W7S.cjs.map → chunk-RJCDBVZ6.cjs.map} +1 -1
- package/dist/{chunk-LXHW6OT4.cjs → chunk-T26WN7TD.cjs} +19 -17
- package/dist/chunk-T26WN7TD.cjs.map +1 -0
- package/dist/{chunk-ZTWLCHCO.cjs → chunk-UKRJR66Y.cjs} +24 -26
- package/dist/chunk-UKRJR66Y.cjs.map +1 -0
- package/dist/{chunk-MWAHO47B.cjs → chunk-UMTUXOKE.cjs} +25 -27
- package/dist/chunk-UMTUXOKE.cjs.map +1 -0
- package/dist/{chunk-JSP7ZROS.cjs → chunk-V4A6MJ42.cjs} +36 -8
- package/dist/chunk-V4A6MJ42.cjs.map +1 -0
- package/dist/{chunk-BVZ7H2F5.cjs → chunk-VYOJJECB.cjs} +55 -56
- package/dist/chunk-VYOJJECB.cjs.map +1 -0
- package/dist/{chunk-ZLQ2IBTC.cjs → chunk-WRRIPTJP.cjs} +12 -12
- package/dist/{chunk-ZLQ2IBTC.cjs.map → chunk-WRRIPTJP.cjs.map} +1 -1
- package/dist/{chunk-QIZO3A4Y.cjs → chunk-ZIXZWQSP.cjs} +85 -41
- package/dist/chunk-ZIXZWQSP.cjs.map +1 -0
- package/dist/{chunk-RQRI6RCG.cjs → chunk-ZXPTDLXJ.cjs} +12 -14
- package/dist/chunk-ZXPTDLXJ.cjs.map +1 -0
- package/dist/collaboration/index.cjs +3 -3
- package/dist/collaboration/index.d.cts +2 -2
- package/dist/collaboration/index.d.ts +2 -2
- package/dist/collaboration/index.js +2 -2
- package/dist/controlplane/index.cjs +7 -8
- package/dist/controlplane/index.cjs.map +1 -1
- package/dist/controlplane/index.js +6 -7
- package/dist/{errors-D9OtcR-o.d.cts → errors-BGfCbCgs.d.cts} +4 -1
- package/dist/{errors-BjGO6N10.d.ts → errors-D_809AqR.d.ts} +4 -1
- package/dist/{google-adk-model-N47R7GB2.js → google-adk-model-V7SC6RQD.js} +3 -3
- package/dist/{google-adk-model-PDBKY5YZ.cjs → google-adk-model-WYWEQI4R.cjs} +13 -13
- package/dist/{google-adk-model-PDBKY5YZ.cjs.map → google-adk-model-WYWEQI4R.cjs.map} +1 -1
- package/dist/index.cjs +33 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -17
- package/dist/index.js.map +1 -1
- package/dist/integrations/ai-sdk.cjs +3 -3
- package/dist/integrations/ai-sdk.js +2 -2
- package/dist/integrations/google-adk.cjs +14 -15
- package/dist/integrations/google-adk.cjs.map +1 -1
- package/dist/integrations/google-adk.js +10 -11
- package/dist/integrations/google-adk.js.map +1 -1
- package/dist/integrations/langchain.cjs +18 -19
- package/dist/integrations/langchain.cjs.map +1 -1
- package/dist/integrations/langchain.d.cts +3 -2
- package/dist/integrations/langchain.d.ts +3 -2
- package/dist/integrations/langchain.js +11 -12
- package/dist/integrations/langchain.js.map +1 -1
- package/dist/integrations/langgraph.cjs +10 -11
- package/dist/integrations/langgraph.cjs.map +1 -1
- package/dist/integrations/langgraph.d.cts +3 -2
- package/dist/integrations/langgraph.d.ts +3 -2
- package/dist/integrations/langgraph.js +9 -10
- package/dist/integrations/mastra.cjs +14 -15
- package/dist/integrations/mastra.cjs.map +1 -1
- package/dist/integrations/mastra.js +8 -9
- package/dist/integrations/mastra.js.map +1 -1
- package/dist/{langchain-adapter-DJsyjm5V.d.ts → langchain-adapter-CaTCXaeo.d.ts} +4 -2
- package/dist/{langchain-adapter-DFJdEX04.d.cts → langchain-adapter-DtxU7oAi.d.cts} +4 -2
- package/dist/{langchain-provider-PHL4UWNF.js → langchain-provider-JFWLKOGL.js} +26 -2
- package/dist/langchain-provider-JFWLKOGL.js.map +1 -0
- package/dist/{langchain-provider-NF5GIDQV.cjs → langchain-provider-UKO27CQA.cjs} +38 -14
- package/dist/langchain-provider-UKO27CQA.cjs.map +1 -0
- package/dist/mcp/index.cjs +3 -4
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.js +2 -3
- package/dist/memory/index.cjs +6 -7
- package/dist/memory/index.cjs.map +1 -1
- package/dist/memory/index.d.cts +24 -2
- package/dist/memory/index.d.ts +24 -2
- package/dist/memory/index.js +5 -6
- package/dist/model/index.cjs +4 -5
- package/dist/model/index.cjs.map +1 -1
- package/dist/model/index.js +3 -4
- package/dist/runtime/index.cjs +7 -8
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.js +6 -7
- package/dist/server/index.cjs +13 -15
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +5 -7
- package/dist/server/index.js.map +1 -1
- package/dist/skill/index.cjs +4 -5
- package/dist/skill/index.cjs.map +1 -1
- package/dist/skill/index.js +3 -4
- package/package.json +1 -1
- package/dist/chunk-2E5EWEDG.cjs.map +0 -1
- package/dist/chunk-A3WMLVJC.cjs.map +0 -1
- package/dist/chunk-BVZ7H2F5.cjs.map +0 -1
- package/dist/chunk-IF7LMBXC.js.map +0 -1
- package/dist/chunk-JSP7ZROS.cjs.map +0 -1
- package/dist/chunk-LE5P3SJW.cjs +0 -16
- package/dist/chunk-LE5P3SJW.cjs.map +0 -1
- package/dist/chunk-LXHW6OT4.cjs.map +0 -1
- package/dist/chunk-MWAHO47B.cjs.map +0 -1
- package/dist/chunk-MZ5UWGXS.js.map +0 -1
- package/dist/chunk-NZL3VPJ2.js +0 -16
- package/dist/chunk-NZL3VPJ2.js.map +0 -1
- package/dist/chunk-PKYET77D.cjs.map +0 -1
- package/dist/chunk-QIZO3A4Y.cjs.map +0 -1
- package/dist/chunk-RHY7Y43E.js.map +0 -1
- package/dist/chunk-RQRI6RCG.cjs.map +0 -1
- package/dist/chunk-TWEO5XVM.cjs.map +0 -1
- package/dist/chunk-UWPKFJYM.js.map +0 -1
- package/dist/chunk-ZTWLCHCO.cjs.map +0 -1
- package/dist/langchain-provider-NF5GIDQV.cjs.map +0 -1
- package/dist/langchain-provider-PHL4UWNF.js.map +0 -1
- /package/dist/{chunk-K3TE7625.js.map → chunk-3JXIMUUY.js.map} +0 -0
- /package/dist/{chunk-ZWQBAJ5O.js.map → chunk-6NNPSP3O.js.map} +0 -0
- /package/dist/{chunk-IUCLCPVV.js.map → chunk-76NTQYJB.js.map} +0 -0
- /package/dist/{chunk-MICRSJ6R.js.map → chunk-EKLTJ65H.js.map} +0 -0
- /package/dist/{chunk-GYLT23D3.js.map → chunk-NI3U6RZL.js.map} +0 -0
- /package/dist/{chunk-5JXA7JPS.js.map → chunk-NRYDUATX.js.map} +0 -0
- /package/dist/{chunk-RYXL25AI.js.map → chunk-PS3EAUMK.js.map} +0 -0
- /package/dist/{google-adk-model-N47R7GB2.js.map → google-adk-model-V7SC6RQD.js.map} +0 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;
|
|
2
2
|
|
|
3
|
-
var _chunkLE5P3SJWcjs = require('./chunk-LE5P3SJW.cjs');
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
var _chunkJSP7ZROScjs = require('./chunk-JSP7ZROS.cjs');
|
|
5
|
+
var _chunkV4A6MJ42cjs = require('./chunk-V4A6MJ42.cjs');
|
|
8
6
|
|
|
9
7
|
// src/skill/loader.ts
|
|
10
8
|
var _crypto = require('crypto');
|
|
@@ -19,7 +17,7 @@ var Skills = (_class = class {
|
|
|
19
17
|
constructor(options = {}) {;_class.prototype.__init.call(this);
|
|
20
18
|
this.options = options;
|
|
21
19
|
this.workspace = _path.resolve.call(void 0, _nullishCoalesce(_nullishCoalesce(options.workspaceDir, () => ( process.env.AGENTCORE_SKILL_WORKSPACE_DIR)), () => ( ".skills/.agentcore-managed")));
|
|
22
|
-
this.logger = _nullishCoalesce(options.logger, () => (
|
|
20
|
+
this.logger = _nullishCoalesce(options.logger, () => ( _chunkV4A6MJ42cjs.nullLogger));
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
__init() {this.pins = /* @__PURE__ */ new Map()}
|
|
@@ -29,10 +27,10 @@ var Skills = (_class = class {
|
|
|
29
27
|
this.logger.info("agentcore.skill.local.load.started", { root });
|
|
30
28
|
try {
|
|
31
29
|
root = _path.resolve.call(void 0, root);
|
|
32
|
-
if (!(await _promises.lstat.call(void 0, root)).isDirectory()) throw new (0,
|
|
30
|
+
if (!(await _promises.lstat.call(void 0, root)).isDirectory()) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("local Skill root is not a directory");
|
|
33
31
|
const entries = await _promises.readdir.call(void 0, root, { withFileTypes: true });
|
|
34
32
|
const directories = entries.some((entry) => entry.name === "SKILL.md") ? [root] : entries.sort((a, b) => a.name.localeCompare(b.name)).flatMap((entry) => {
|
|
35
|
-
if (entry.isSymbolicLink()) throw new (0,
|
|
33
|
+
if (entry.isSymbolicLink()) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("local Skill root must not contain symbolic-link Skills");
|
|
36
34
|
return entry.isDirectory() ? [_path.join.call(void 0, root, entry.name)] : [];
|
|
37
35
|
});
|
|
38
36
|
const result = [];
|
|
@@ -47,7 +45,7 @@ var Skills = (_class = class {
|
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
async managed(name, options = {}) {
|
|
50
|
-
if (!this.options.runtime) throw new (0,
|
|
48
|
+
if (!this.options.runtime) throw new (0, _chunkV4A6MJ42cjs.ResourceNotConfiguredError)("managed Skill runtime is not configured");
|
|
51
49
|
const { workspaceId, provider } = await this.options.runtime();
|
|
52
50
|
component(name, "name");
|
|
53
51
|
component(workspaceId, "workspace ID");
|
|
@@ -88,13 +86,13 @@ var Skills = (_class = class {
|
|
|
88
86
|
}
|
|
89
87
|
}, _class);
|
|
90
88
|
function component(value, label) {
|
|
91
|
-
if (!value.trim() || /[\\/:\0]/.test(value) || value === "." || value === "..") throw new (0,
|
|
89
|
+
if (!value.trim() || /[\\/:\0]/.test(value) || value === "." || value === "..") throw new (0, _chunkV4A6MJ42cjs.ConfigError)(`managed Skill ${label} is invalid`);
|
|
92
90
|
}
|
|
93
91
|
function safePath(path) {
|
|
94
|
-
if (!path || /[\\:\0]/.test(path) || _path.posix.isAbsolute(path) || path !== _path.posix.normalize(path) || path.split("/").some((part) => part === "." || part === "..") || path === METADATA) throw new (0,
|
|
92
|
+
if (!path || /[\\:\0]/.test(path) || _path.posix.isAbsolute(path) || path !== _path.posix.normalize(path) || path.split("/").some((part) => part === "." || part === "..") || path === METADATA) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("managed Skill contains an unsafe resource path");
|
|
95
93
|
}
|
|
96
94
|
async function unpack(name, archive) {
|
|
97
|
-
if (!archive.length || archive.length > MAX_BYTES) throw new (0,
|
|
95
|
+
if (!archive.length || archive.length > MAX_BYTES) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("Skill package exceeds the 10 MiB size limit");
|
|
98
96
|
try {
|
|
99
97
|
const zip = await new Promise((accept, reject) => _yauzl.fromBuffer.call(void 0, Buffer.from(archive), { lazyEntries: true, strictFileNames: true }, (error, value) => error ? reject(error) : accept(value)));
|
|
100
98
|
const files = /* @__PURE__ */ new Map();
|
|
@@ -106,18 +104,18 @@ async function unpack(name, archive) {
|
|
|
106
104
|
void (async () => {
|
|
107
105
|
if (entry.fileName.endsWith("/")) return;
|
|
108
106
|
safePath(entry.fileName);
|
|
109
|
-
if (!entry.fileName.startsWith(`${name}/`)) throw new (0,
|
|
107
|
+
if (!entry.fileName.startsWith(`${name}/`)) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("managed Skill package must use the Skill name as its root directory");
|
|
110
108
|
const path = entry.fileName.slice(name.length + 1);
|
|
111
109
|
safePath(path);
|
|
112
|
-
if (files.has(path)) throw new (0,
|
|
113
|
-
if ((entry.externalFileAttributes >>> 16 & 61440) === 40960) throw new (0,
|
|
114
|
-
if (entry.uncompressedSize > MAX_BYTES - total) throw new (0,
|
|
110
|
+
if (files.has(path)) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("managed Skill package contains a duplicate path");
|
|
111
|
+
if ((entry.externalFileAttributes >>> 16 & 61440) === 40960) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("Skill directories must not contain symbolic links");
|
|
112
|
+
if (entry.uncompressedSize > MAX_BYTES - total) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("Skill content exceeds the 10 MiB size limit");
|
|
115
113
|
const stream = await new Promise((resolve2, reject2) => zip.openReadStream(entry, (error, stream2) => error ? reject2(error) : resolve2(stream2)));
|
|
116
114
|
const chunks = [];
|
|
117
115
|
for await (const chunk of stream) {
|
|
118
116
|
const data = Buffer.from(chunk);
|
|
119
117
|
total += data.length;
|
|
120
|
-
if (total > MAX_BYTES) throw new (0,
|
|
118
|
+
if (total > MAX_BYTES) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("Skill content exceeds the 10 MiB size limit");
|
|
121
119
|
chunks.push(data);
|
|
122
120
|
}
|
|
123
121
|
files.set(path, Buffer.concat(chunks));
|
|
@@ -128,18 +126,18 @@ async function unpack(name, archive) {
|
|
|
128
126
|
});
|
|
129
127
|
zip.readEntry();
|
|
130
128
|
});
|
|
131
|
-
if (!files.has("SKILL.md")) throw new (0,
|
|
129
|
+
if (!files.has("SKILL.md")) throw new (0, _chunkV4A6MJ42cjs.ConfigError)(`managed Skill package does not contain ${name}/SKILL.md`);
|
|
132
130
|
for (const path of files.keys()) {
|
|
133
131
|
let parent = _path.posix.dirname(path);
|
|
134
132
|
while (parent !== ".") {
|
|
135
|
-
if (files.has(parent)) throw new (0,
|
|
133
|
+
if (files.has(parent)) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("managed Skill contains a colliding resource path");
|
|
136
134
|
parent = _path.posix.dirname(parent);
|
|
137
135
|
}
|
|
138
136
|
}
|
|
139
137
|
return files;
|
|
140
138
|
} catch (error) {
|
|
141
|
-
if (error instanceof
|
|
142
|
-
throw new (0,
|
|
139
|
+
if (error instanceof _chunkV4A6MJ42cjs.ConfigError) throw error;
|
|
140
|
+
throw new (0, _chunkV4A6MJ42cjs.ConfigError)("managed Skill package is not a valid ZIP archive");
|
|
143
141
|
}
|
|
144
142
|
}
|
|
145
143
|
async function materialize(target, files, metadata) {
|
|
@@ -173,12 +171,12 @@ async function loadDirectory(root, sourceFiles) {
|
|
|
173
171
|
let total = 0;
|
|
174
172
|
async function walk(directory, prefix = "") {
|
|
175
173
|
for (const entry of (await _promises.readdir.call(void 0, directory, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
176
|
-
if (entry.isSymbolicLink()) throw new (0,
|
|
174
|
+
if (entry.isSymbolicLink()) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("Skill directories must not contain symbolic links");
|
|
177
175
|
const name = prefix + entry.name;
|
|
178
176
|
if (entry.isDirectory()) await walk(_path.join.call(void 0, directory, entry.name), `${name}/`);
|
|
179
177
|
else if (entry.isFile() && entry.name !== METADATA) {
|
|
180
178
|
total += (await _promises.lstat.call(void 0, _path.join.call(void 0, directory, entry.name))).size;
|
|
181
|
-
if (total > MAX_BYTES) throw new (0,
|
|
179
|
+
if (total > MAX_BYTES) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("Skill content exceeds the 10 MiB size limit");
|
|
182
180
|
files.push(name);
|
|
183
181
|
}
|
|
184
182
|
}
|
|
@@ -186,7 +184,7 @@ async function loadDirectory(root, sourceFiles) {
|
|
|
186
184
|
if (sourceFiles) {
|
|
187
185
|
for (const name of sourceFiles) {
|
|
188
186
|
const entry = await _promises.lstat.call(void 0, _path.join.call(void 0, root, name));
|
|
189
|
-
if (entry.isSymbolicLink() || !entry.isFile()) throw new (0,
|
|
187
|
+
if (entry.isSymbolicLink() || !entry.isFile()) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("managed Skill workspace is missing a source file");
|
|
190
188
|
files.push(name);
|
|
191
189
|
}
|
|
192
190
|
} else await walk(root);
|
|
@@ -195,18 +193,18 @@ async function loadDirectory(root, sourceFiles) {
|
|
|
195
193
|
const metadata = {};
|
|
196
194
|
if (match) {
|
|
197
195
|
const document = _yaml.parseDocument.call(void 0, match[1]);
|
|
198
|
-
if (document.errors.length) throw new (0,
|
|
196
|
+
if (document.errors.length) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("SKILL.md contains invalid YAML frontmatter");
|
|
199
197
|
let value;
|
|
200
198
|
try {
|
|
201
199
|
value = _nullishCoalesce(document.toJS({ maxAliasCount: 0 }), () => ( {}));
|
|
202
200
|
} catch (e) {
|
|
203
|
-
throw new (0,
|
|
201
|
+
throw new (0, _chunkV4A6MJ42cjs.ConfigError)("SKILL.md contains invalid YAML frontmatter");
|
|
204
202
|
}
|
|
205
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new (0,
|
|
203
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("SKILL.md frontmatter must be an object");
|
|
206
204
|
for (const key of ["name", "description", "version"]) {
|
|
207
205
|
const item = value[key];
|
|
208
206
|
if (item !== void 0 && item !== null) {
|
|
209
|
-
if (typeof item !== "string") throw new (0,
|
|
207
|
+
if (typeof item !== "string") throw new (0, _chunkV4A6MJ42cjs.ConfigError)(`SKILL.md frontmatter ${key} must be a string`);
|
|
210
208
|
metadata[key] = item;
|
|
211
209
|
}
|
|
212
210
|
}
|
|
@@ -217,4 +215,4 @@ async function loadDirectory(root, sourceFiles) {
|
|
|
217
215
|
|
|
218
216
|
|
|
219
217
|
exports.Skills = Skills;
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
218
|
+
//# sourceMappingURL=chunk-UMTUXOKE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/agentcore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AAA;AACX,IAAA;AACC,MAAA;AACN,MAAA;AACQ,MAAA;AACH,MAAA;AAAgD,QAAA;AAAgE,QAAA;AAA2E,QAAA;AAAG,MAAA;AACjO,IAAA;AACF,EAAA;AACiB,EAAA;AAEiB,IAAA;AACC,MAAA;AACA,MAAA;AAChB,MAAA;AACjB,IAAA;AACoB,EAAA;AACc,EAAA;AACtB,EAAA;AAC4B,EAAA;AAC/B,EAAA;AAC6B,IAAA;AACA,IAAA;AAClC,IAAA;AACA,IAAA;AAA0B,MAAA;AAAmC,IAAA;AAAwB,MAAA;AAA+C,IAAA;AACzG,IAAA;AACJ,IAAA;AAC0B,MAAA;AAChB,MAAA;AAAsC,QAAA;AAAuF,QAAA;AAAM,MAAA;AACxK,IAAA;AACF,EAAA;AACsC,EAAA;AACxC;ADqC0C;AACA;AACA;AACA","file":"/home/runner/work/agentcore-sdk-nodejs/agentcore-sdk-nodejs/dist/chunk-UMTUXOKE.cjs","sourcesContent":[null,"import { createHash } from 'node:crypto';\nimport { lstat, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join, posix, resolve } from 'node:path';\nimport { fromBuffer, type Entry, type ZipFile } from 'yauzl';\nimport { parseDocument } from 'yaml';\nimport type { SkillArtifact } from '../controlplane/client';\nimport { ConfigError, ResourceNotConfiguredError } from '../errors';\nimport { nullLogger, type Logger } from '../logging';\n\nconst MAX_BYTES = 10 * 1024 * 1024;\nconst METADATA = '.agentcore-skill.json';\nconst writes = new Map<string, Promise<void>>();\nexport interface Skill {\n readonly name: string;\n readonly description: string;\n readonly version: string;\n readonly instruction: string;\n readonly root: string;\n readonly files: readonly string[];\n readonly source: 'local' | 'agentcore';\n readonly digest?: string;\n readonly workspaceId?: string;\n}\nexport interface SkillProvider { getSkill(name: string, version?: string): Promise<SkillArtifact>; }\nexport interface SkillsOptions {\n workspaceDir?: string;\n runtime?: () => Promise<{ workspaceId: string; provider: SkillProvider }>;\n logger?: Logger;\n}\n\nexport class Skills {\n private readonly pins = new Map<string, Promise<Skill>>();\n private readonly workspace: string;\n private readonly logger: Logger;\n constructor(private readonly options: SkillsOptions = {}) {\n this.workspace = resolve(options.workspaceDir ?? process.env.AGENTCORE_SKILL_WORKSPACE_DIR ?? '.skills/.agentcore-managed');\n this.logger = options.logger ?? nullLogger;\n }\n async local(root: string): Promise<Skill[]> {\n this.logger.info('agentcore.skill.local.load.started', { root });\n try {\n root = resolve(root);\n if (!(await lstat(root)).isDirectory()) throw new ConfigError('local Skill root is not a directory');\n const entries = await readdir(root, { withFileTypes: true });\n const directories = entries.some((entry) => entry.name === 'SKILL.md') ? [root] : entries.sort((a, b) => a.name.localeCompare(b.name)).flatMap((entry) => {\n if (entry.isSymbolicLink()) throw new ConfigError('local Skill root must not contain symbolic-link Skills');\n return entry.isDirectory() ? [join(root, entry.name)] : [];\n });\n const result: Skill[] = [];\n for (const directory of directories) {\n if ((await readdir(directory)).includes('SKILL.md')) result.push(await loadDirectory(directory));\n }\n this.logger.info('agentcore.skill.local.load.succeeded', { root, skill_count: result.length }); return result;\n } catch (error) { this.logger.warn('agentcore.skill.local.load.failed', { root, error_type: error instanceof Error ? error.name : 'Error' }); throw error; }\n }\n async managed(name: string, options: { version?: string } = {}): Promise<Skill> {\n if (!this.options.runtime) throw new ResourceNotConfiguredError('managed Skill runtime is not configured');\n const { workspaceId, provider } = await this.options.runtime();\n component(name, 'name'); component(workspaceId, 'workspace ID');\n if (options.version !== undefined) component(options.version, 'version');\n const key = JSON.stringify([workspaceId, name, options.version]);\n const cached = this.pins.get(key); if (cached) return cached;\n const pending = (async () => {\n this.logger.info('agentcore.skill.managed.load.started', { workspace_id: workspaceId, name, version: options.version ?? 'latest' });\n const artifact = await provider.getSkill(name, options.version); component(artifact.version, 'version');\n const files = await unpack(name, artifact.archive);\n const hash = createHash('sha256');\n for (const [path, data] of [...files.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) hash.update(path).update('\\0').update(data).update('\\0');\n const digest = hash.digest('hex');\n const target = join(this.workspace, workspaceId, name, artifact.version);\n const metadata = { source: 'agentcore', workspaceId, name, version: artifact.version, digest };\n // Serialize writes to the same named version across Core instances in this process.\n const write = (writes.get(target) ?? Promise.resolve()).catch(() => undefined).then(() => materialize(target, files, metadata));\n writes.set(target, write);\n try { await write; } finally { if (writes.get(target) === write) writes.delete(target); }\n const sourceFiles = ['SKILL.md', ...[...files.keys()].filter((path) => path !== 'SKILL.md').sort()];\n const skill = Object.freeze({ ...await loadDirectory(target, sourceFiles), ...metadata, source: 'agentcore' as const });\n this.logger.info('agentcore.skill.managed.load.succeeded', { workspace_id: workspaceId, name, version: artifact.version, digest });\n return skill;\n })();\n this.pins.set(key, pending);\n try { return await pending; } catch (error) {\n this.pins.delete(key); this.logger.warn('agentcore.skill.managed.load.failed', { workspace_id: workspaceId, name, error_type: error instanceof Error ? error.name : 'Error' }); throw error;\n }\n }\n}\n\nfunction component(value: string, label: string): void {\n if (!value.trim() || /[\\\\/:\\0]/.test(value) || value === '.' || value === '..') throw new ConfigError(`managed Skill ${label} is invalid`);\n}\nfunction safePath(path: string): void {\n if (!path || /[\\\\:\\0]/.test(path) || posix.isAbsolute(path) || path !== posix.normalize(path) || path.split('/').some((part) => part === '.' || part === '..') || path === METADATA) throw new ConfigError('managed Skill contains an unsafe resource path');\n}\nasync function unpack(name: string, archive: Uint8Array): Promise<Map<string, Buffer>> {\n if (!archive.length || archive.length > MAX_BYTES) throw new ConfigError('Skill package exceeds the 10 MiB size limit');\n try {\n const zip = await new Promise<ZipFile>((accept, reject) => fromBuffer(Buffer.from(archive), { lazyEntries: true, strictFileNames: true }, (error, value) => error ? reject(error) : accept(value)));\n const files = new Map<string, Buffer>(); let total = 0;\n await new Promise<void>((accept, reject) => {\n zip.on('error', reject); zip.on('end', accept);\n zip.on('entry', (entry: Entry) => { void (async () => {\n if (entry.fileName.endsWith('/')) return;\n safePath(entry.fileName);\n if (!entry.fileName.startsWith(`${name}/`)) throw new ConfigError('managed Skill package must use the Skill name as its root directory');\n const path = entry.fileName.slice(name.length + 1); safePath(path);\n if (files.has(path)) throw new ConfigError('managed Skill package contains a duplicate path');\n if (((entry.externalFileAttributes >>> 16) & 0xf000) === 0xa000) throw new ConfigError('Skill directories must not contain symbolic links');\n if (entry.uncompressedSize > MAX_BYTES - total) throw new ConfigError('Skill content exceeds the 10 MiB size limit');\n const stream = await new Promise<NodeJS.ReadableStream>((resolve, reject) => zip.openReadStream(entry, (error, stream) => error ? reject(error) : resolve(stream)));\n const chunks: Buffer[] = [];\n for await (const chunk of stream) { const data = Buffer.from(chunk); total += data.length; if (total > MAX_BYTES) throw new ConfigError('Skill content exceeds the 10 MiB size limit'); chunks.push(data); }\n files.set(path, Buffer.concat(chunks));\n })().then(() => zip.readEntry(), (error) => { zip.close(); reject(error); }); });\n zip.readEntry();\n });\n if (!files.has('SKILL.md')) throw new ConfigError(`managed Skill package does not contain ${name}/SKILL.md`);\n for (const path of files.keys()) {\n let parent = posix.dirname(path);\n while (parent !== '.') { if (files.has(parent)) throw new ConfigError('managed Skill contains a colliding resource path'); parent = posix.dirname(parent); }\n }\n return files;\n } catch (error) { if (error instanceof ConfigError) throw error; throw new ConfigError('managed Skill package is not a valid ZIP archive'); }\n}\n\nasync function materialize(target: string, files: Map<string, Buffer>, metadata: Record<string, string>): Promise<void> {\n try {\n const stat = await lstat(target);\n if (stat.isDirectory() && !stat.isSymbolicLink()) {\n const existing: unknown = JSON.parse(await readFile(join(target, METADATA), 'utf8'));\n if (JSON.stringify(existing) === JSON.stringify(metadata)) return;\n }\n } catch (error) { if (!(error instanceof SyntaxError) && (error as NodeJS.ErrnoException).code !== 'ENOENT') throw error; }\n await mkdir(dirname(target), { recursive: true });\n const temporary = await mkdtemp(join(dirname(target), '.skill-'));\n try {\n for (const [path, content] of files) { const destination = join(temporary, path); await mkdir(dirname(destination), { recursive: true }); await writeFile(destination, content); }\n await writeFile(join(temporary, METADATA), JSON.stringify(metadata));\n await loadDirectory(temporary); // Do not replace a working version with invalid SKILL.md.\n await rm(target, { recursive: true, force: true });\n await rename(temporary, target);\n } finally { await rm(temporary, { recursive: true, force: true }); }\n}\n\nasync function loadDirectory(root: string, sourceFiles?: readonly string[]): Promise<Skill> {\n const files: string[] = []; let total = 0;\n async function walk(directory: string, prefix = ''): Promise<void> {\n for (const entry of (await readdir(directory, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name))) {\n if (entry.isSymbolicLink()) throw new ConfigError('Skill directories must not contain symbolic links');\n const name = prefix + entry.name;\n if (entry.isDirectory()) await walk(join(directory, entry.name), `${name}/`);\n else if (entry.isFile() && entry.name !== METADATA) { total += (await lstat(join(directory, entry.name))).size; if (total > MAX_BYTES) throw new ConfigError('Skill content exceeds the 10 MiB size limit'); files.push(name); }\n }\n }\n if (sourceFiles) {\n // Managed packages track source files, not files generated by command execution.\n for (const name of sourceFiles) {\n const entry = await lstat(join(root, name));\n if (entry.isSymbolicLink() || !entry.isFile()) throw new ConfigError('managed Skill workspace is missing a source file');\n files.push(name);\n }\n } else await walk(root);\n const instruction = new TextDecoder('utf8', { fatal: true }).decode(await readFile(join(root, 'SKILL.md')));\n const match = /^---\\s*\\n([\\s\\S]*?)\\n---(?:\\s*\\n|$)/.exec(instruction);\n const metadata: Record<string, string> = {};\n if (match) {\n const document = parseDocument(match[1]!);\n if (document.errors.length) throw new ConfigError('SKILL.md contains invalid YAML frontmatter');\n let value: unknown;\n try { value = document.toJS({ maxAliasCount: 0 }) ?? {}; } catch { throw new ConfigError('SKILL.md contains invalid YAML frontmatter'); }\n if (!value || typeof value !== 'object' || Array.isArray(value)) throw new ConfigError('SKILL.md frontmatter must be an object');\n for (const key of ['name', 'description', 'version']) {\n const item = (value as Record<string, unknown>)[key];\n if (item !== undefined && item !== null) { if (typeof item !== 'string') throw new ConfigError(`SKILL.md frontmatter ${key} must be a string`); metadata[key] = item; }\n }\n }\n return Object.freeze({ name: metadata.name || basename(root), description: metadata.description || '', version: metadata.version || '', instruction, root, files: Object.freeze(files), source: 'local' as const });\n}\n"]}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16;// src/
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12; var _class13; var _class14; var _class15; var _class16;// src/logging.ts
|
|
2
|
+
var nullLogger = {
|
|
3
|
+
debug() {
|
|
4
|
+
},
|
|
5
|
+
info() {
|
|
6
|
+
},
|
|
7
|
+
warn() {
|
|
8
|
+
},
|
|
9
|
+
error() {
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function safeErrorMessage(value) {
|
|
13
|
+
if (typeof value !== "string" || !value.trim()) return void 0;
|
|
14
|
+
return value.replace(/[\x00-\x1f\x7f]+/g, " ").replace(/\b(?:authorization|api[ _-]?key(?:\s+provided)?|access[_-]?key(?:[_-]?(?:id|secret))?|(?:security|access|refresh|jwt)[_-]?token|token|password|secret|text|content|query|messages|metadata|headers)["']?\s*[:=].*/i, "<redacted>").replace(/\b(?:Bearer|Basic)\s+[^\s,;]+/gi, "<redacted>").replace(/\b(?:LTAI[A-Za-z0-9]+|eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+)\b/g, "<redacted>").replace(/https?:\/\/\S+/g, "<url>").slice(0, 512);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// src/errors.ts
|
|
2
18
|
var AgentCoreError = (_class = class extends Error {
|
|
3
19
|
__init() {this.code = "AGENTCORE_ERROR"}
|
|
4
20
|
constructor(message, options) {
|
|
@@ -44,17 +60,29 @@ var MemoryValidationError = (_class13 = class extends AgentCoreError {constructo
|
|
|
44
60
|
}, _class13);
|
|
45
61
|
var MemoryAPIError = (_class14 = class extends AgentCoreError {
|
|
46
62
|
constructor(operation, details = {}) {
|
|
47
|
-
super(
|
|
63
|
+
super("");_class14.prototype.__init14.call(this);;
|
|
48
64
|
this.operation = operation;
|
|
49
65
|
this.serviceCode = details.serviceCode;
|
|
50
66
|
this.httpStatusCode = details.httpStatusCode;
|
|
51
67
|
this.requestId = details.requestId;
|
|
68
|
+
this.serviceMessage = safeErrorMessage(details.serviceMessage);
|
|
69
|
+
const diagnostics = Object.entries({
|
|
70
|
+
status: this.httpStatusCode,
|
|
71
|
+
service_code: this.serviceCode,
|
|
72
|
+
request_id: this.requestId,
|
|
73
|
+
message: this.serviceMessage
|
|
74
|
+
}).filter(([, value]) => value !== void 0).map(([key, value]) => `${key}=${value}`).join(", ");
|
|
75
|
+
this.message = this.summary(operation) + (diagnostics ? `: ${diagnostics}` : "");
|
|
52
76
|
}
|
|
53
77
|
|
|
54
78
|
__init14() {this.code = "MEMORY_API_FAILED"}
|
|
55
79
|
|
|
56
80
|
|
|
57
81
|
|
|
82
|
+
|
|
83
|
+
summary(operation) {
|
|
84
|
+
return `AgentCore Memory operation ${operation} failed`;
|
|
85
|
+
}
|
|
58
86
|
}, _class14);
|
|
59
87
|
var MemoryContractError = (_class15 = class extends AgentCoreError {
|
|
60
88
|
constructor(operation, detail) {
|
|
@@ -66,11 +94,10 @@ var MemoryContractError = (_class15 = class extends AgentCoreError {
|
|
|
66
94
|
|
|
67
95
|
__init15() {this.code = "MEMORY_RESPONSE_INVALID"}
|
|
68
96
|
}, _class15);
|
|
69
|
-
var AddMemoriesOutcomeUnknownError = (_class16 = class extends MemoryAPIError {
|
|
97
|
+
var AddMemoriesOutcomeUnknownError = (_class16 = class extends MemoryAPIError {constructor(...args13) { super(...args13); _class16.prototype.__init16.call(this); }
|
|
70
98
|
__init16() {this.code = "ADD_MEMORIES_OUTCOME_UNKNOWN"}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.message = "AgentCore Memory AddMemories outcome is unknown; the write may have succeeded";
|
|
99
|
+
summary() {
|
|
100
|
+
return "AgentCore Memory AddMemories outcome is unknown; the write may have succeeded";
|
|
74
101
|
}
|
|
75
102
|
}, _class16);
|
|
76
103
|
|
|
@@ -91,5 +118,6 @@ var AddMemoriesOutcomeUnknownError = (_class16 = class extends MemoryAPIError {
|
|
|
91
118
|
|
|
92
119
|
|
|
93
120
|
|
|
94
|
-
|
|
95
|
-
|
|
121
|
+
|
|
122
|
+
exports.nullLogger = nullLogger; exports.AgentCoreError = AgentCoreError; exports.ConfigError = ConfigError; exports.ContextError = ContextError; exports.AuthenticationError = AuthenticationError; exports.CredentialExchangeError = CredentialExchangeError; exports.WorkloadIdentityNotConfiguredError = WorkloadIdentityNotConfiguredError; exports.WorkloadAccessTokenRejectedError = WorkloadAccessTokenRejectedError; exports.ResourceNotConfiguredError = ResourceNotConfiguredError; exports.ModelConnectionNotFoundError = ModelConnectionNotFoundError; exports.MCPServerNotFoundError = MCPServerNotFoundError; exports.InvocationError = InvocationError; exports.UnsupportedFeatureError = UnsupportedFeatureError; exports.MemoryValidationError = MemoryValidationError; exports.MemoryAPIError = MemoryAPIError; exports.MemoryContractError = MemoryContractError; exports.AddMemoriesOutcomeUnknownError = AddMemoriesOutcomeUnknownError;
|
|
123
|
+
//# sourceMappingURL=chunk-V4A6MJ42.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/agentcore-sdk-nodejs/agentcore-sdk-nodejs/dist/chunk-V4A6MJ42.cjs","../src/logging.ts","../src/errors.ts"],"names":[],"mappings":"AAAA;ACSO,IAAM,WAAA,EAAqB;AAAA,EAChC,KAAA,CAAA,EAAQ;AAAA,EAAC,CAAA;AAAA,EAAG,IAAA,CAAA,EAAO;AAAA,EAAC,CAAA;AAAA,EAAG,IAAA,CAAA,EAAO;AAAA,EAAC,CAAA;AAAA,EAAG,KAAA,CAAA,EAAQ;AAAA,EAAC;AAC7C,CAAA;AAGO,SAAS,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AAA,MAAW,OAAA,EAAS,IAAA,CAAK;AAAA,IAAe,CAAC,CAAA,CACzD,MAAA,CAAO,CAAC,CAAC,EAAE,KAAK,CAAA,EAAA,GAAM,MAAA,IAAU,KAAA,CAAS,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,EAAA,GAAM,CAAA,EAAA;AACP,IAAA;AAC/D,EAAA;AARqB,EAAA;AALY,mBAAA;AACxB,EAAA;AACA,EAAA;AACA,EAAA;AACA,EAAA;AAUoC,EAAA;AAAgD,IAAA;AAAW,EAAA;AAC1G;AACwD;AAEW,EAAA;AAAqC,IAAA;AAAjF,IAAA;AAA4B,IAAA;AAAkG,EAAA;AAA9H,EAAA;AAA4B,EAAA;AADxB,mBAAA;AAE3B;AACmE;AACxC,mBAAA;AACY,EAAA;AAAS,IAAA;AAAiF,EAAA;AACjI;AFsDsE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/agentcore-sdk-nodejs/agentcore-sdk-nodejs/dist/chunk-V4A6MJ42.cjs","sourcesContent":[null,"export type LogFields = Readonly<Record<string, string | number | boolean | undefined>>;\nexport interface Logger {\n debug(event: string, fields?: LogFields): void;\n info(event: string, fields?: LogFields): void;\n warn(event: string, fields?: LogFields): void;\n error(event: string, fields?: LogFields): void;\n}\n\n// Libraries are silent unless the application supplies a logger.\nexport const nullLogger: Logger = {\n debug() {}, info() {}, warn() {}, error() {},\n};\n\n/** Render only a service message field, never a response or exception dump. */\nexport function safeErrorMessage(value: unknown): string | undefined {\n if (typeof value !== 'string' || !value.trim()) return undefined;\n return value.replace(/[\\x00-\\x1f\\x7f]+/g, ' ')\n .replace(/\\b(?:authorization|api[ _-]?key(?:\\s+provided)?|access[_-]?key(?:[_-]?(?:id|secret))?|(?:security|access|refresh|jwt)[_-]?token|token|password|secret|text|content|query|messages|metadata|headers)[\"']?\\s*[:=].*/i, '<redacted>')\n .replace(/\\b(?:Bearer|Basic)\\s+[^\\s,;]+/gi, '<redacted>')\n .replace(/\\b(?:LTAI[A-Za-z0-9]+|eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+)\\b/g, '<redacted>')\n .replace(/https?:\\/\\/\\S+/g, '<url>')\n .slice(0, 512);\n}\n","import { safeErrorMessage } from './logging';\n\nexport class AgentCoreError extends Error {\n readonly code: string = 'AGENTCORE_ERROR';\n constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = new.target.name;\n }\n}\n\nexport class ConfigError extends AgentCoreError { override readonly code: string = 'CONFIG_INVALID'; }\nexport class ContextError extends AgentCoreError { override readonly code: string = 'CONTEXT_INVALID'; }\nexport class AuthenticationError extends AgentCoreError { override readonly code: string = 'AUTHENTICATION_FAILED'; }\nexport class CredentialExchangeError extends AuthenticationError { override readonly code: string = 'CREDENTIAL_EXCHANGE_FAILED'; }\nexport class WorkloadIdentityNotConfiguredError extends AuthenticationError { override readonly code = 'WORKLOAD_IDENTITY_NOT_CONFIGURED'; }\nexport class WorkloadAccessTokenRejectedError extends CredentialExchangeError { override readonly code = 'WORKLOAD_ACCESS_TOKEN_REJECTED'; }\nexport class ResourceNotConfiguredError extends AgentCoreError { override readonly code: string = 'RESOURCE_NOT_CONFIGURED'; }\nexport class ModelConnectionNotFoundError extends ResourceNotConfiguredError { override readonly code = 'MODEL_CONNECTION_NOT_FOUND'; }\nexport class MCPServerNotFoundError extends ResourceNotConfiguredError { override readonly code = 'MCP_SERVER_NOT_FOUND'; }\nexport class InvocationError extends AgentCoreError { override readonly code = 'INVOCATION_FAILED'; }\nexport class UnsupportedFeatureError extends AgentCoreError { override readonly code = 'UNSUPPORTED_FEATURE'; }\n\nexport class MemoryValidationError extends AgentCoreError { override readonly code = 'MEMORY_VALIDATION_FAILED'; }\nexport interface MemoryErrorDetails { serviceCode?: string; httpStatusCode?: number; requestId?: string; serviceMessage?: string; }\nexport class MemoryAPIError extends AgentCoreError {\n override readonly code: string = 'MEMORY_API_FAILED';\n readonly serviceCode?: string;\n readonly httpStatusCode?: number;\n readonly requestId?: string;\n readonly serviceMessage?: string;\n constructor(readonly operation: string, details: MemoryErrorDetails = {}) {\n super('');\n this.serviceCode = details.serviceCode; this.httpStatusCode = details.httpStatusCode; this.requestId = details.requestId;\n this.serviceMessage = safeErrorMessage(details.serviceMessage);\n const diagnostics = Object.entries({ status: this.httpStatusCode, service_code: this.serviceCode,\n request_id: this.requestId, message: this.serviceMessage })\n .filter(([, value]) => value !== undefined).map(([key, value]) => `${key}=${value}`).join(', ');\n this.message = this.summary(operation) + (diagnostics ? `: ${diagnostics}` : '');\n }\n protected summary(operation: string): string { return `AgentCore Memory operation ${operation} failed`; }\n}\nexport class MemoryContractError extends AgentCoreError {\n override readonly code = 'MEMORY_RESPONSE_INVALID';\n constructor(readonly operation: string, readonly detail: string) { super(`AgentCore Memory ${operation} returned an invalid response: ${detail}`); }\n}\nexport class AddMemoriesOutcomeUnknownError extends MemoryAPIError {\n override readonly code = 'ADD_MEMORIES_OUTCOME_UNKNOWN';\n protected override summary(): string { return 'AgentCore Memory AddMemories outcome is unknown; the write may have succeeded'; }\n}\n"]}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkRJCDBVZ6cjs = require('./chunk-RJCDBVZ6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkKQTZUIMIcjs = require('./chunk-KQTZUIMI.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkNXMTTQQKcjs = require('./chunk-NXMTTQQK.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var _chunkLE5P3SJWcjs = require('./chunk-LE5P3SJW.cjs');
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
var _chunkJSP7ZROScjs = require('./chunk-JSP7ZROS.cjs');
|
|
20
|
+
var _chunkV4A6MJ42cjs = require('./chunk-V4A6MJ42.cjs');
|
|
23
21
|
|
|
24
22
|
// src/runtime/environment.ts
|
|
25
23
|
var _promises = require('fs/promises');
|
|
@@ -73,7 +71,7 @@ function parseRuntimeEnvironment(text) {
|
|
|
73
71
|
if (!match || Object.hasOwn(values, match[1])) throw new Error("invalid assignment");
|
|
74
72
|
values[match[1]] = match[2];
|
|
75
73
|
} catch (e) {
|
|
76
|
-
throw new (0,
|
|
74
|
+
throw new (0, _chunkV4A6MJ42cjs.ConfigError)(`invalid runtime env at line ${index + 1}`);
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
77
|
return values;
|
|
@@ -88,7 +86,8 @@ var RuntimeEnvironmentProvider = class {
|
|
|
88
86
|
try {
|
|
89
87
|
text = await _promises.readFile.call(void 0, this.path, "utf8");
|
|
90
88
|
} catch (cause) {
|
|
91
|
-
|
|
89
|
+
if (cause.code === "ENOENT") return {};
|
|
90
|
+
throw new (0, _chunkV4A6MJ42cjs.ConfigError)("cannot read AgentCore runtime env", { cause });
|
|
92
91
|
}
|
|
93
92
|
return parseRuntimeEnvironment(text);
|
|
94
93
|
}
|
|
@@ -96,21 +95,21 @@ var RuntimeEnvironmentProvider = class {
|
|
|
96
95
|
const values = await this.read();
|
|
97
96
|
const endpoint = values.AGENTCORE_CONTROL_ENDPOINT || process.env.AGENTCORE_CONTROL_ENDPOINT;
|
|
98
97
|
return {
|
|
99
|
-
controllerUrl:
|
|
100
|
-
agentSATokenFile:
|
|
98
|
+
controllerUrl: _chunkNXMTTQQKcjs.httpUrl.call(void 0, values.AGENTCORE_CONTROLLER_URL || values.AGENTTEAMS_CONTROLLER_URL, "runtime Controller URL"),
|
|
99
|
+
agentSATokenFile: _chunkNXMTTQQKcjs.requiredString.call(void 0, values.AGENTCORE_AUTH_TOKEN_FILE || values.AGENTTEAMS_AUTH_TOKEN_FILE, "runtime SA token file"),
|
|
101
100
|
controlPlaneEndpoint: _optionalChain([endpoint, 'optionalAccess', _ => _.trim, 'call', _2 => _2()]) || void 0
|
|
102
101
|
};
|
|
103
102
|
}
|
|
104
103
|
async value(name) {
|
|
105
|
-
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new (0,
|
|
104
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) throw new (0, _chunkV4A6MJ42cjs.ConfigError)("runtime environment name is invalid");
|
|
106
105
|
const values = await this.read();
|
|
107
|
-
return
|
|
106
|
+
return _chunkNXMTTQQKcjs.requiredString.call(void 0, values[name] || process.env[name], `runtime env ${name}`);
|
|
108
107
|
}
|
|
109
108
|
async taskServiceEndpoint() {
|
|
110
109
|
const values = await this.read();
|
|
111
110
|
const endpoint = values.AGENTCORE_TASK_SERVICE_ENDPOINT || process.env.AGENTCORE_TASK_SERVICE_ENDPOINT;
|
|
112
|
-
if (_optionalChain([endpoint, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()])) return
|
|
113
|
-
const gateway =
|
|
111
|
+
if (_optionalChain([endpoint, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()])) return _chunkNXMTTQQKcjs.httpUrl.call(void 0, endpoint, "Task Service endpoint");
|
|
112
|
+
const gateway = _chunkNXMTTQQKcjs.httpUrl.call(void 0, values.AGENTTEAMS_MATRIX_URL || process.env.AGENTTEAMS_MATRIX_URL, "Task Service endpoint");
|
|
114
113
|
return gateway.endsWith("/agentteams-app") ? gateway : `${gateway}/agentteams-app`;
|
|
115
114
|
}
|
|
116
115
|
};
|
|
@@ -143,14 +142,14 @@ var ManagedRuntimeSource = (_class = class {
|
|
|
143
142
|
this.lifetime.abort();
|
|
144
143
|
}
|
|
145
144
|
async load() {
|
|
146
|
-
const configPath = this.options.configPath || process.env.AGENTCORE_CONFIG_PATH ||
|
|
145
|
+
const configPath = this.options.configPath || process.env.AGENTCORE_CONFIG_PATH || _chunkNXMTTQQKcjs.DEFAULT_CONFIG_PATH;
|
|
147
146
|
const rawTimeout = _nullishCoalesce(process.env.AGENTCORE_CONFIG_WAIT_TIMEOUT, () => ( "10"));
|
|
148
147
|
if (!/^\d+$/.test(rawTimeout) || !Number.isSafeInteger(Number(rawTimeout))) {
|
|
149
|
-
throw new (0,
|
|
148
|
+
throw new (0, _chunkV4A6MJ42cjs.ConfigError)("AGENTCORE_CONFIG_WAIT_TIMEOUT must be a non-negative integer");
|
|
150
149
|
}
|
|
151
150
|
const deadline = performance.now() + Number(rawTimeout) * 1e3;
|
|
152
151
|
let config;
|
|
153
|
-
const logger = _nullishCoalesce(this.options.logger, () => (
|
|
152
|
+
const logger = _nullishCoalesce(this.options.logger, () => ( _chunkV4A6MJ42cjs.nullLogger));
|
|
154
153
|
for (; ; ) {
|
|
155
154
|
this.lifetime.signal.throwIfAborted();
|
|
156
155
|
let data;
|
|
@@ -159,13 +158,13 @@ var ManagedRuntimeSource = (_class = class {
|
|
|
159
158
|
} catch (cause) {
|
|
160
159
|
const remaining = deadline - performance.now();
|
|
161
160
|
if (!(cause && typeof cause === "object" && "code" in cause && cause.code === "ENOENT") || remaining <= 0) {
|
|
162
|
-
throw new (0,
|
|
161
|
+
throw new (0, _chunkV4A6MJ42cjs.ConfigError)("cannot read agent.yaml", { cause });
|
|
163
162
|
}
|
|
164
163
|
logger.info("agentcore.runtime.config.waiting_for_mount", { path: configPath, retryInMs: Math.min(500, remaining) });
|
|
165
164
|
await _promises3.setTimeout.call(void 0, Math.min(500, remaining), void 0, { signal: this.lifetime.signal });
|
|
166
165
|
continue;
|
|
167
166
|
}
|
|
168
|
-
config =
|
|
167
|
+
config = _chunkNXMTTQQKcjs.parseAgentConfig.call(void 0, data);
|
|
169
168
|
break;
|
|
170
169
|
}
|
|
171
170
|
const configuredEnv = this.options.envPath || process.env.AGENTCORE_ENV_PATH;
|
|
@@ -177,7 +176,7 @@ var ManagedRuntimeSource = (_class = class {
|
|
|
177
176
|
hasEnvironment = true;
|
|
178
177
|
} catch (cause) {
|
|
179
178
|
if (!(cause && typeof cause === "object" && "code" in cause && cause.code === "ENOENT")) {
|
|
180
|
-
throw new (0,
|
|
179
|
+
throw new (0, _chunkV4A6MJ42cjs.ConfigError)("cannot access AgentCore runtime env", { cause });
|
|
181
180
|
}
|
|
182
181
|
}
|
|
183
182
|
}
|
|
@@ -186,7 +185,7 @@ var ManagedRuntimeSource = (_class = class {
|
|
|
186
185
|
config,
|
|
187
186
|
controllerEndpoint: _optionalChain([environment, 'optionalAccess', _5 => _5.controllerUrl]),
|
|
188
187
|
controlPlaneEndpoint: _nullishCoalesce(_nullishCoalesce(this.options.controlPlaneEndpoint, () => ( _optionalChain([environment, 'optionalAccess', _6 => _6.controlPlaneEndpoint]))), () => ( process.env.AGENTCORE_CONTROL_ENDPOINT)),
|
|
189
|
-
agentSATokens: environment ? new (0,
|
|
188
|
+
agentSATokens: environment ? new (0, _chunkKQTZUIMIcjs.AgentSATokenProvider)(environment.agentSATokenFile) : void 0
|
|
190
189
|
};
|
|
191
190
|
this.lifetime.signal.throwIfAborted();
|
|
192
191
|
logger.info("agentcore.runtime.source.resolved", { mode: "managed", envLoaded: hasEnvironment, workspaceId: config.workspaceId });
|
|
@@ -202,17 +201,17 @@ var _util = require('util');
|
|
|
202
201
|
var _crypto = require('crypto');
|
|
203
202
|
var _net = require('net');
|
|
204
203
|
function objectKey(value, field) {
|
|
205
|
-
const key =
|
|
204
|
+
const key = _chunkNXMTTQQKcjs.requiredString.call(void 0, value, field);
|
|
206
205
|
if (/[\\\r\n]/.test(key) || key.split("/").some((p) => !p || p === "." || p === "..")) {
|
|
207
|
-
throw new (0,
|
|
206
|
+
throw new (0, _chunkV4A6MJ42cjs.CredentialExchangeError)(`Controller returned an invalid ${field}`);
|
|
208
207
|
}
|
|
209
208
|
return key;
|
|
210
209
|
}
|
|
211
210
|
var ControlConfigLoader = (_class2 = class {
|
|
212
211
|
constructor(endpoint, source, options = {}) {;_class2.prototype.__init2.call(this);
|
|
213
212
|
this.options = options;
|
|
214
|
-
this.controller = new (0,
|
|
215
|
-
this.logger = _nullishCoalesce(options.logger, () => (
|
|
213
|
+
this.controller = new (0, _chunkKQTZUIMIcjs.ControllerClient)(endpoint, source, options);
|
|
214
|
+
this.logger = _nullishCoalesce(options.logger, () => ( _chunkV4A6MJ42cjs.nullLogger));
|
|
216
215
|
}
|
|
217
216
|
|
|
218
217
|
|
|
@@ -223,7 +222,7 @@ var ControlConfigLoader = (_class2 = class {
|
|
|
223
222
|
async load() {
|
|
224
223
|
const credential = await this.credential();
|
|
225
224
|
const data = await this.download(credential, credential.agentConfigPath);
|
|
226
|
-
return
|
|
225
|
+
return _chunkNXMTTQQKcjs.parseAgentConfig.call(void 0, data);
|
|
227
226
|
}
|
|
228
227
|
async loadTeams() {
|
|
229
228
|
let credential = await this.credential();
|
|
@@ -250,13 +249,13 @@ var ControlConfigLoader = (_class2 = class {
|
|
|
250
249
|
}
|
|
251
250
|
async exchange() {
|
|
252
251
|
const response = await this.controller.post("/api/v1/credentials/sts", { purpose: "oss", target: "control" });
|
|
253
|
-
if (response.status === 401) throw new (0,
|
|
254
|
-
if (response.status < 200 || response.status >= 300) throw new (0,
|
|
252
|
+
if (response.status === 401) throw new (0, _chunkV4A6MJ42cjs.AuthenticationError)("Controller rejected the Agent SA token");
|
|
253
|
+
if (response.status < 200 || response.status >= 300) throw new (0, _chunkV4A6MJ42cjs.CredentialExchangeError)(`Controller control-config STS failed with HTTP ${response.status}`);
|
|
255
254
|
try {
|
|
256
|
-
const data =
|
|
257
|
-
const read = (field) =>
|
|
255
|
+
const data = _chunkNXMTTQQKcjs.object.call(void 0, response.payload, "control-config STS");
|
|
256
|
+
const read = (field) => _chunkNXMTTQQKcjs.requiredString.call(void 0, data[field], field);
|
|
258
257
|
const endpoint = read("oss_endpoint");
|
|
259
|
-
const ossEndpoint =
|
|
258
|
+
const ossEndpoint = _chunkNXMTTQQKcjs.httpUrl.call(void 0, endpoint.includes("://") ? endpoint : `https://${endpoint}`, "OSS endpoint");
|
|
260
259
|
if (new URL(ossEndpoint).pathname !== "/") throw new Error("OSS endpoint path");
|
|
261
260
|
const ossBucket = read("oss_bucket");
|
|
262
261
|
if (!/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/.test(ossBucket)) throw new Error("OSS bucket");
|
|
@@ -273,7 +272,7 @@ var ControlConfigLoader = (_class2 = class {
|
|
|
273
272
|
teamsConfigPath: data.teams_config_path == null ? void 0 : objectKey(data.teams_config_path, "teams_config_path")
|
|
274
273
|
};
|
|
275
274
|
} catch (e2) {
|
|
276
|
-
throw new (0,
|
|
275
|
+
throw new (0, _chunkV4A6MJ42cjs.CredentialExchangeError)("Controller returned an invalid control-config STS response");
|
|
277
276
|
}
|
|
278
277
|
}
|
|
279
278
|
async download(credential, key, missingOK = false) {
|
|
@@ -308,7 +307,7 @@ x-oss-security-token:${credential.securityToken}
|
|
|
308
307
|
signal: AbortSignal.any([this.lifetime.signal, AbortSignal.timeout(_nullishCoalesce(this.options.timeoutMs, () => ( 1e4)))])
|
|
309
308
|
});
|
|
310
309
|
if (response.ok) {
|
|
311
|
-
const data = await
|
|
310
|
+
const data = await _chunkRJCDBVZ6cjs.readBytes.call(void 0, response, 1024 * 1024, "runtime config");
|
|
312
311
|
this.logger.info("agentcore.control_config.download.succeeded", { host: url.host, bytes: data.length });
|
|
313
312
|
return data;
|
|
314
313
|
}
|
|
@@ -318,11 +317,11 @@ x-oss-security-token:${credential.securityToken}
|
|
|
318
317
|
this.logger.warn("agentcore.control_config.download.failed", { host: url.host, status: response.status });
|
|
319
318
|
} catch (error) {
|
|
320
319
|
this.lifetime.signal.throwIfAborted();
|
|
321
|
-
if (error instanceof
|
|
320
|
+
if (error instanceof _chunkV4A6MJ42cjs.ConfigError) throw error;
|
|
322
321
|
this.logger.warn("agentcore.control_config.download.failed", { host: url.host, reason: "transport_error" });
|
|
323
322
|
}
|
|
324
323
|
}
|
|
325
|
-
throw new (0,
|
|
324
|
+
throw new (0, _chunkV4A6MJ42cjs.ConfigError)(lastStatus ? `AgentCore configuration download failed with HTTP ${lastStatus}` : "cannot reach the AgentCore configuration store");
|
|
326
325
|
}
|
|
327
326
|
}, _class2);
|
|
328
327
|
|
|
@@ -355,21 +354,21 @@ function parseDebugToken(value) {
|
|
|
355
354
|
if (!encoded || encoded.length > 35e4 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(encoded)) throw new Error("base64");
|
|
356
355
|
const raw = Buffer.from(encoded, "base64");
|
|
357
356
|
if (raw.length > 256 * 1024) throw new Error("size");
|
|
358
|
-
const data =
|
|
357
|
+
const data = _chunkNXMTTQQKcjs.object.call(void 0, JSON.parse(new TextDecoder("utf8", { fatal: true }).decode(raw)), "debug token");
|
|
359
358
|
if (data.product !== "agentcore") throw new Error("product");
|
|
360
|
-
const controller =
|
|
359
|
+
const controller = _chunkNXMTTQQKcjs.httpUrl.call(void 0, data.controllerUrl, "controllerUrl");
|
|
361
360
|
if (new URL(controller).pathname !== "/") throw new Error("controllerUrl path");
|
|
362
361
|
return new DebugToken(
|
|
363
|
-
|
|
362
|
+
_chunkNXMTTQQKcjs.requiredString.call(void 0, data.jwtToken, "jwtToken"),
|
|
364
363
|
controller,
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
_chunkNXMTTQQKcjs.httpUrl.call(void 0, data.modelGatewayUrl, "modelGatewayUrl"),
|
|
365
|
+
_chunkNXMTTQQKcjs.httpUrl.call(void 0, data.matrixUrl, "matrixUrl")
|
|
367
366
|
);
|
|
368
367
|
} catch (e3) {
|
|
369
|
-
throw new (0,
|
|
368
|
+
throw new (0, _chunkV4A6MJ42cjs.ConfigError)("AGENTCORE_DEBUG_TOKEN is invalid");
|
|
370
369
|
}
|
|
371
370
|
}
|
|
372
|
-
var DebugTokenExchangeUnavailable = class extends
|
|
371
|
+
var DebugTokenExchangeUnavailable = class extends _chunkV4A6MJ42cjs.AuthenticationError {
|
|
373
372
|
};
|
|
374
373
|
var DebugRuntimeSource = (_class4 = class {
|
|
375
374
|
constructor(token, options = {}) {;_class4.prototype.__init4.call(this);_class4.prototype.__init5.call(this);_class4.prototype.__init6.call(this);
|
|
@@ -377,8 +376,8 @@ var DebugRuntimeSource = (_class4 = class {
|
|
|
377
376
|
this.options = options;
|
|
378
377
|
this.#jwtToken = token.jwtToken;
|
|
379
378
|
this.configLoader = new ControlConfigLoader(token.controllerUrl, this, options);
|
|
380
|
-
this.controller = new (0,
|
|
381
|
-
this.logger = _nullishCoalesce(options.logger, () => (
|
|
379
|
+
this.controller = new (0, _chunkKQTZUIMIcjs.ControllerClient)(token.controllerUrl, this, options);
|
|
380
|
+
this.logger = _nullishCoalesce(options.logger, () => ( _chunkV4A6MJ42cjs.nullLogger));
|
|
382
381
|
}
|
|
383
382
|
|
|
384
383
|
|
|
@@ -426,11 +425,11 @@ var DebugRuntimeSource = (_class4 = class {
|
|
|
426
425
|
}
|
|
427
426
|
async exchangeMatrixToken() {
|
|
428
427
|
const response = await this.controller.post("/api/v1/credentials/matrix-token");
|
|
429
|
-
if (response.status < 200 || response.status >= 300) throw new (0,
|
|
428
|
+
if (response.status < 200 || response.status >= 300) throw new (0, _chunkV4A6MJ42cjs.AuthenticationError)(`Controller Matrix token request failed with HTTP ${response.status}`);
|
|
430
429
|
try {
|
|
431
|
-
return
|
|
430
|
+
return _chunkNXMTTQQKcjs.requiredString.call(void 0, _chunkNXMTTQQKcjs.object.call(void 0, response.payload, "Matrix token").access_token, "access_token");
|
|
432
431
|
} catch (e4) {
|
|
433
|
-
throw new (0,
|
|
432
|
+
throw new (0, _chunkV4A6MJ42cjs.AuthenticationError)("Controller returned an invalid Matrix token response");
|
|
434
433
|
}
|
|
435
434
|
}
|
|
436
435
|
close() {
|
|
@@ -543,18 +542,18 @@ var DebugRuntimeSource = (_class4 = class {
|
|
|
543
542
|
await _promises3.setTimeout.call(void 0, 50 * 2 ** (attempt - 1), void 0, { signal: this.lifetime.signal });
|
|
544
543
|
continue;
|
|
545
544
|
}
|
|
546
|
-
if ([401, 403].includes(response.status)) throw new (0,
|
|
547
|
-
if (!response.ok) throw new (0,
|
|
545
|
+
if ([401, 403].includes(response.status)) throw new (0, _chunkV4A6MJ42cjs.AuthenticationError)("Controller rejected the AgentCore debug token");
|
|
546
|
+
if (!response.ok) throw new (0, _chunkV4A6MJ42cjs.AuthenticationError)(`Controller debug token exchange failed with HTTP ${response.status}`);
|
|
548
547
|
try {
|
|
549
|
-
const data =
|
|
550
|
-
const token =
|
|
551
|
-
const jwtToken =
|
|
552
|
-
const expiresAt = Date.parse(
|
|
553
|
-
const jwtExpiresAt = Date.parse(
|
|
548
|
+
const data = _chunkNXMTTQQKcjs.object.call(void 0, payload, "debug token response");
|
|
549
|
+
const token = _chunkNXMTTQQKcjs.requiredString.call(void 0, data.token, "token");
|
|
550
|
+
const jwtToken = _chunkNXMTTQQKcjs.requiredString.call(void 0, data.jwtToken, "jwtToken");
|
|
551
|
+
const expiresAt = Date.parse(_chunkNXMTTQQKcjs.requiredString.call(void 0, data.expiresAt, "expiresAt"));
|
|
552
|
+
const jwtExpiresAt = Date.parse(_chunkNXMTTQQKcjs.requiredString.call(void 0, data.jwtExpiresAt, "jwtExpiresAt"));
|
|
554
553
|
if (!(expiresAt > Date.now()) || !(jwtExpiresAt > Date.now())) throw new Error("expiry");
|
|
555
554
|
return { token, jwtToken, expiresAt, jwtExpiresAt };
|
|
556
555
|
} catch (e7) {
|
|
557
|
-
throw new (0,
|
|
556
|
+
throw new (0, _chunkV4A6MJ42cjs.AuthenticationError)("Controller returned an invalid debug token response");
|
|
558
557
|
}
|
|
559
558
|
}
|
|
560
559
|
throw new DebugTokenExchangeUnavailable("Controller debug token service is unavailable");
|
|
@@ -579,4 +578,4 @@ function createRuntimeSource(options = {}) {
|
|
|
579
578
|
|
|
580
579
|
|
|
581
580
|
exports.DEFAULT_ENV_PATH = DEFAULT_ENV_PATH; exports.parseRuntimeEnvironment = parseRuntimeEnvironment; exports.RuntimeEnvironmentProvider = RuntimeEnvironmentProvider; exports.ManagedRuntimeSource = ManagedRuntimeSource; exports.DebugToken = DebugToken; exports.parseDebugToken = parseDebugToken; exports.DebugRuntimeSource = DebugRuntimeSource; exports.createRuntimeSource = createRuntimeSource;
|
|
582
|
-
//# sourceMappingURL=chunk-
|
|
581
|
+
//# sourceMappingURL=chunk-VYOJJECB.cjs.map
|