@damn-dev/cli 0.13.8 → 0.13.10
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/package.json
CHANGED
|
@@ -7858,6 +7858,7 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
7858
7858
|
exports2.registerInProcessTool = registerInProcessTool;
|
|
7859
7859
|
exports2.assertSafeUrl = assertSafeUrl;
|
|
7860
7860
|
exports2.substituteSecrets = substituteSecrets;
|
|
7861
|
+
exports2.extractPathParamNames = extractPathParamNames;
|
|
7861
7862
|
exports2.substituteParams = substituteParams;
|
|
7862
7863
|
exports2.loadSkillTool = loadSkillTool;
|
|
7863
7864
|
exports2.resolveAllSecrets = resolveAllSecrets;
|
|
@@ -7983,6 +7984,17 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
7983
7984
|
const out = template.replace(/\$\{([A-Z][A-Z0-9_]{0,63})\}/g, (_, key) => secrets.get(key) ?? "");
|
|
7984
7985
|
return { ok: true, value: out };
|
|
7985
7986
|
}
|
|
7987
|
+
function extractPathParamNames(template) {
|
|
7988
|
+
const names = /* @__PURE__ */ new Set();
|
|
7989
|
+
const re = /<([A-Za-z_][A-Za-z0-9_]*)>|\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
7990
|
+
let m;
|
|
7991
|
+
while ((m = re.exec(template)) !== null) {
|
|
7992
|
+
const key = m[1] ?? m[2];
|
|
7993
|
+
if (key)
|
|
7994
|
+
names.add(key);
|
|
7995
|
+
}
|
|
7996
|
+
return names;
|
|
7997
|
+
}
|
|
7986
7998
|
function substituteParams(template, params) {
|
|
7987
7999
|
return template.replace(/<([A-Za-z_][A-Za-z0-9_]*)>|\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, angle, curly) => {
|
|
7988
8000
|
const key = angle ?? curly;
|
|
@@ -8148,6 +8160,7 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
8148
8160
|
if (!endpointAfterSecrets.ok) {
|
|
8149
8161
|
return { ok: false, error: `Missing workspace secret: ${endpointAfterSecrets.missing.join(", ")}`, code: "missing_secret" };
|
|
8150
8162
|
}
|
|
8163
|
+
const pathParamNames = extractPathParamNames(endpointAfterSecrets.value);
|
|
8151
8164
|
const endpointAfterParams = substituteParams(endpointAfterSecrets.value, req.params);
|
|
8152
8165
|
const safety = await assertSafeUrl(endpointAfterParams);
|
|
8153
8166
|
if (!safety.ok) {
|
|
@@ -8160,6 +8173,20 @@ var require_skillToolDispatcher = __commonJS({
|
|
|
8160
8173
|
return { ok: false, error: safety.reason, code: safety.code };
|
|
8161
8174
|
}
|
|
8162
8175
|
let url = safety.url;
|
|
8176
|
+
const declaredParams = new Set(tool.parameters.map((p) => p.name));
|
|
8177
|
+
if (tool.method === "GET" || tool.method === "DELETE" || tool.method === "HEAD") {
|
|
8178
|
+
for (const [k, v] of Object.entries(req.params)) {
|
|
8179
|
+
if (pathParamNames.has(k))
|
|
8180
|
+
continue;
|
|
8181
|
+
if (!declaredParams.has(k))
|
|
8182
|
+
continue;
|
|
8183
|
+
if (v === void 0 || v === null)
|
|
8184
|
+
continue;
|
|
8185
|
+
if (typeof v === "object")
|
|
8186
|
+
continue;
|
|
8187
|
+
url.searchParams.set(k, String(v));
|
|
8188
|
+
}
|
|
8189
|
+
}
|
|
8163
8190
|
const headers = new Headers({ "user-agent": "damn-dev-skill-dispatcher/1.0" });
|
|
8164
8191
|
if (tool.auth) {
|
|
8165
8192
|
const authValue = substituteSecrets(tool.auth.value, secrets);
|
|
@@ -30913,7 +30940,7 @@ var require_package = __commonJS({
|
|
|
30913
30940
|
module2.exports = {
|
|
30914
30941
|
name: "backend",
|
|
30915
30942
|
private: true,
|
|
30916
|
-
version: "0.13.
|
|
30943
|
+
version: "0.13.10",
|
|
30917
30944
|
scripts: {
|
|
30918
30945
|
dev: "tsx watch src/server.ts",
|
|
30919
30946
|
build: "tsc && rm -rf dist/resources && cp -r resources dist/resources",
|