Skip to content

Commit 463b659

Browse files
committed
Merge branch 'dev'
2 parents db89ade + 31235ef commit 463b659

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@utcp/sdk",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "Universal Tool Calling Protocol SDK",
55
"main": "dist/index.cjs",
66
"module": "dist/index.js",

packages/core/src/implementations/default_variable_substitutor.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,10 @@ export class DefaultVariableSubstitutor implements VariableSubstitutor {
7777
throw new Error(`Variable namespace '${namespace}' contains invalid characters. Only alphanumeric characters and underscores are allowed.`);
7878
}
7979

80-
const objString = JSON.stringify(obj);
81-
if (objString && objString.includes('$ref')) {
82-
return obj;
83-
}
84-
8580
if (typeof obj === 'string') {
81+
if (obj.includes('$ref')) {
82+
return obj;
83+
}
8684
let currentString: string = obj;
8785
const regex = /\$\{([a-zA-Z0-9_]+)\}|\$([a-zA-Z0-9_]+)/g;
8886
let match: RegExpExecArray | null;
@@ -147,6 +145,10 @@ export class DefaultVariableSubstitutor implements VariableSubstitutor {
147145
const regex = /\$\{([a-zA-Z0-9_]+)\}|\$([a-zA-Z0-9_]+)/g;
148146

149147
if (typeof obj === 'string') {
148+
if (obj.includes('$ref')) {
149+
return [];
150+
}
151+
150152
let match;
151153
while ((match = regex.exec(obj)) !== null) {
152154
const varNameInTemplate = match[1] || match[2];

0 commit comments

Comments
 (0)