@probelabs/probe 0.6.0-rc237 → 0.6.0-rc238
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/bin/binaries/probe-v0.6.0-rc238-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc238-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc238-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc238-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc238-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/dsl/environment.js +26 -1
- package/build/agent/index.js +18 -1
- package/cjs/agent/ProbeAgent.cjs +18 -1
- package/cjs/index.cjs +18 -1
- package/package.json +1 -1
- package/src/agent/dsl/environment.js +26 -1
- package/bin/binaries/probe-v0.6.0-rc237-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc237-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc237-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc237-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc237-x86_64-unknown-linux-musl.tar.gz +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -117,6 +117,23 @@ function traceToolCall(toolName, fn, tracer, logFn) {
|
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Try to parse a string as JSON if it looks like a JSON object or array.
|
|
122
|
+
* Checks if the first non-whitespace character is '{' or '[' before attempting parse.
|
|
123
|
+
* Returns the original string if it's not JSON.
|
|
124
|
+
*
|
|
125
|
+
* @param {string} text - The text to try parsing
|
|
126
|
+
* @returns {any} Parsed JSON value, or the original string
|
|
127
|
+
*/
|
|
128
|
+
function tryParseJSONValue(text) {
|
|
129
|
+
if (typeof text !== 'string') return text;
|
|
130
|
+
const firstChar = text.trimStart()[0];
|
|
131
|
+
if (firstChar === '{' || firstChar === '[') {
|
|
132
|
+
try { return JSON.parse(text); } catch (_) { /* not valid JSON */ }
|
|
133
|
+
}
|
|
134
|
+
return text;
|
|
135
|
+
}
|
|
136
|
+
|
|
120
137
|
/**
|
|
121
138
|
* Generate sandbox globals that bridge DSL function calls to real tool implementations.
|
|
122
139
|
*
|
|
@@ -195,7 +212,15 @@ export function generateSandboxGlobals(options) {
|
|
|
195
212
|
if (mcpBridge) {
|
|
196
213
|
for (const [name, tool] of Object.entries(mcpTools)) {
|
|
197
214
|
const rawMcpFn = async (params = {}) => {
|
|
198
|
-
|
|
215
|
+
const result = await tool.execute(params);
|
|
216
|
+
// Extract text from MCP response envelope: { content: [{ type: 'text', text: '...' }] }
|
|
217
|
+
const text = result?.content?.[0]?.text;
|
|
218
|
+
if (text === undefined) {
|
|
219
|
+
// No envelope — if raw result is a JSON-like string, try parsing it
|
|
220
|
+
if (typeof result === 'string') return tryParseJSONValue(result);
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
return tryParseJSONValue(text);
|
|
199
224
|
};
|
|
200
225
|
globals[name] = traceToolCall(name, rawMcpFn, tracer, logFn);
|
|
201
226
|
}
|
package/build/agent/index.js
CHANGED
|
@@ -21763,6 +21763,17 @@ function traceToolCall(toolName, fn, tracer, logFn) {
|
|
|
21763
21763
|
}
|
|
21764
21764
|
};
|
|
21765
21765
|
}
|
|
21766
|
+
function tryParseJSONValue(text) {
|
|
21767
|
+
if (typeof text !== "string") return text;
|
|
21768
|
+
const firstChar = text.trimStart()[0];
|
|
21769
|
+
if (firstChar === "{" || firstChar === "[") {
|
|
21770
|
+
try {
|
|
21771
|
+
return JSON.parse(text);
|
|
21772
|
+
} catch (_) {
|
|
21773
|
+
}
|
|
21774
|
+
}
|
|
21775
|
+
return text;
|
|
21776
|
+
}
|
|
21766
21777
|
function generateSandboxGlobals(options) {
|
|
21767
21778
|
const {
|
|
21768
21779
|
toolImplementations = {},
|
|
@@ -21814,7 +21825,13 @@ function generateSandboxGlobals(options) {
|
|
|
21814
21825
|
if (mcpBridge) {
|
|
21815
21826
|
for (const [name, tool5] of Object.entries(mcpTools)) {
|
|
21816
21827
|
const rawMcpFn = async (params = {}) => {
|
|
21817
|
-
|
|
21828
|
+
const result = await tool5.execute(params);
|
|
21829
|
+
const text = result?.content?.[0]?.text;
|
|
21830
|
+
if (text === void 0) {
|
|
21831
|
+
if (typeof result === "string") return tryParseJSONValue(result);
|
|
21832
|
+
return result;
|
|
21833
|
+
}
|
|
21834
|
+
return tryParseJSONValue(text);
|
|
21818
21835
|
};
|
|
21819
21836
|
globals[name] = traceToolCall(name, rawMcpFn, tracer, logFn);
|
|
21820
21837
|
}
|
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -51212,6 +51212,17 @@ function traceToolCall(toolName, fn, tracer, logFn) {
|
|
|
51212
51212
|
}
|
|
51213
51213
|
};
|
|
51214
51214
|
}
|
|
51215
|
+
function tryParseJSONValue(text) {
|
|
51216
|
+
if (typeof text !== "string") return text;
|
|
51217
|
+
const firstChar = text.trimStart()[0];
|
|
51218
|
+
if (firstChar === "{" || firstChar === "[") {
|
|
51219
|
+
try {
|
|
51220
|
+
return JSON.parse(text);
|
|
51221
|
+
} catch (_) {
|
|
51222
|
+
}
|
|
51223
|
+
}
|
|
51224
|
+
return text;
|
|
51225
|
+
}
|
|
51215
51226
|
function generateSandboxGlobals(options) {
|
|
51216
51227
|
const {
|
|
51217
51228
|
toolImplementations = {},
|
|
@@ -51263,7 +51274,13 @@ function generateSandboxGlobals(options) {
|
|
|
51263
51274
|
if (mcpBridge) {
|
|
51264
51275
|
for (const [name14, tool5] of Object.entries(mcpTools)) {
|
|
51265
51276
|
const rawMcpFn = async (params = {}) => {
|
|
51266
|
-
|
|
51277
|
+
const result = await tool5.execute(params);
|
|
51278
|
+
const text = result?.content?.[0]?.text;
|
|
51279
|
+
if (text === void 0) {
|
|
51280
|
+
if (typeof result === "string") return tryParseJSONValue(result);
|
|
51281
|
+
return result;
|
|
51282
|
+
}
|
|
51283
|
+
return tryParseJSONValue(text);
|
|
51267
51284
|
};
|
|
51268
51285
|
globals[name14] = traceToolCall(name14, rawMcpFn, tracer, logFn);
|
|
51269
51286
|
}
|
package/cjs/index.cjs
CHANGED
|
@@ -112627,6 +112627,17 @@ function traceToolCall(toolName, fn, tracer, logFn) {
|
|
|
112627
112627
|
}
|
|
112628
112628
|
};
|
|
112629
112629
|
}
|
|
112630
|
+
function tryParseJSONValue(text) {
|
|
112631
|
+
if (typeof text !== "string") return text;
|
|
112632
|
+
const firstChar = text.trimStart()[0];
|
|
112633
|
+
if (firstChar === "{" || firstChar === "[") {
|
|
112634
|
+
try {
|
|
112635
|
+
return JSON.parse(text);
|
|
112636
|
+
} catch (_) {
|
|
112637
|
+
}
|
|
112638
|
+
}
|
|
112639
|
+
return text;
|
|
112640
|
+
}
|
|
112630
112641
|
function generateSandboxGlobals(options) {
|
|
112631
112642
|
const {
|
|
112632
112643
|
toolImplementations = {},
|
|
@@ -112678,7 +112689,13 @@ function generateSandboxGlobals(options) {
|
|
|
112678
112689
|
if (mcpBridge) {
|
|
112679
112690
|
for (const [name14, tool5] of Object.entries(mcpTools)) {
|
|
112680
112691
|
const rawMcpFn = async (params = {}) => {
|
|
112681
|
-
|
|
112692
|
+
const result = await tool5.execute(params);
|
|
112693
|
+
const text = result?.content?.[0]?.text;
|
|
112694
|
+
if (text === void 0) {
|
|
112695
|
+
if (typeof result === "string") return tryParseJSONValue(result);
|
|
112696
|
+
return result;
|
|
112697
|
+
}
|
|
112698
|
+
return tryParseJSONValue(text);
|
|
112682
112699
|
};
|
|
112683
112700
|
globals[name14] = traceToolCall(name14, rawMcpFn, tracer, logFn);
|
|
112684
112701
|
}
|
package/package.json
CHANGED
|
@@ -117,6 +117,23 @@ function traceToolCall(toolName, fn, tracer, logFn) {
|
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Try to parse a string as JSON if it looks like a JSON object or array.
|
|
122
|
+
* Checks if the first non-whitespace character is '{' or '[' before attempting parse.
|
|
123
|
+
* Returns the original string if it's not JSON.
|
|
124
|
+
*
|
|
125
|
+
* @param {string} text - The text to try parsing
|
|
126
|
+
* @returns {any} Parsed JSON value, or the original string
|
|
127
|
+
*/
|
|
128
|
+
function tryParseJSONValue(text) {
|
|
129
|
+
if (typeof text !== 'string') return text;
|
|
130
|
+
const firstChar = text.trimStart()[0];
|
|
131
|
+
if (firstChar === '{' || firstChar === '[') {
|
|
132
|
+
try { return JSON.parse(text); } catch (_) { /* not valid JSON */ }
|
|
133
|
+
}
|
|
134
|
+
return text;
|
|
135
|
+
}
|
|
136
|
+
|
|
120
137
|
/**
|
|
121
138
|
* Generate sandbox globals that bridge DSL function calls to real tool implementations.
|
|
122
139
|
*
|
|
@@ -195,7 +212,15 @@ export function generateSandboxGlobals(options) {
|
|
|
195
212
|
if (mcpBridge) {
|
|
196
213
|
for (const [name, tool] of Object.entries(mcpTools)) {
|
|
197
214
|
const rawMcpFn = async (params = {}) => {
|
|
198
|
-
|
|
215
|
+
const result = await tool.execute(params);
|
|
216
|
+
// Extract text from MCP response envelope: { content: [{ type: 'text', text: '...' }] }
|
|
217
|
+
const text = result?.content?.[0]?.text;
|
|
218
|
+
if (text === undefined) {
|
|
219
|
+
// No envelope — if raw result is a JSON-like string, try parsing it
|
|
220
|
+
if (typeof result === 'string') return tryParseJSONValue(result);
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
return tryParseJSONValue(text);
|
|
199
224
|
};
|
|
200
225
|
globals[name] = traceToolCall(name, rawMcpFn, tracer, logFn);
|
|
201
226
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|