@probelabs/probe 0.6.0-rc135 → 0.6.0-rc137
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/build/agent/fileSpanExporter.js +1 -3
- package/build/agent/index.js +42 -14
- package/build/agent/schemaUtils.js +5 -2
- package/build/agent/telemetry.js +5 -11
- package/build/index.js +7 -1
- package/cjs/agent/ProbeAgent.cjs +1043 -1229
- package/cjs/agent/simpleTelemetry.cjs +250 -0
- package/cjs/agent/telemetry.cjs +358 -0
- package/cjs/index.cjs +1620 -1180
- package/index.d.ts +155 -0
- package/package.json +5 -1
- package/src/agent/fileSpanExporter.js +1 -3
- package/src/agent/schemaUtils.js +5 -2
- package/src/agent/telemetry.js +5 -11
- package/src/index.js +7 -1
package/build/agent/index.js
CHANGED
|
@@ -9386,6 +9386,31 @@ var init_simpleTelemetry = __esm({
|
|
|
9386
9386
|
}
|
|
9387
9387
|
});
|
|
9388
9388
|
|
|
9389
|
+
// src/agent/fileSpanExporter.js
|
|
9390
|
+
import { createWriteStream as createWriteStream2 } from "fs";
|
|
9391
|
+
var init_fileSpanExporter = __esm({
|
|
9392
|
+
"src/agent/fileSpanExporter.js"() {
|
|
9393
|
+
"use strict";
|
|
9394
|
+
}
|
|
9395
|
+
});
|
|
9396
|
+
|
|
9397
|
+
// src/agent/telemetry.js
|
|
9398
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
|
|
9399
|
+
import { dirname as dirname2 } from "path";
|
|
9400
|
+
var init_telemetry = __esm({
|
|
9401
|
+
"src/agent/telemetry.js"() {
|
|
9402
|
+
"use strict";
|
|
9403
|
+
init_fileSpanExporter();
|
|
9404
|
+
}
|
|
9405
|
+
});
|
|
9406
|
+
|
|
9407
|
+
// src/agent/appTracer.js
|
|
9408
|
+
var init_appTracer = __esm({
|
|
9409
|
+
"src/agent/appTracer.js"() {
|
|
9410
|
+
"use strict";
|
|
9411
|
+
}
|
|
9412
|
+
});
|
|
9413
|
+
|
|
9389
9414
|
// node_modules/balanced-match/index.js
|
|
9390
9415
|
var require_balanced_match = __commonJS({
|
|
9391
9416
|
"node_modules/balanced-match/index.js"(exports2, module2) {
|
|
@@ -16384,6 +16409,8 @@ var init_index = __esm({
|
|
|
16384
16409
|
init_bash();
|
|
16385
16410
|
init_ProbeAgent();
|
|
16386
16411
|
init_simpleTelemetry();
|
|
16412
|
+
init_telemetry();
|
|
16413
|
+
init_appTracer();
|
|
16387
16414
|
init_probeTool();
|
|
16388
16415
|
init_storage();
|
|
16389
16416
|
init_hooks();
|
|
@@ -47256,7 +47283,7 @@ ${fixedContent}
|
|
|
47256
47283
|
};
|
|
47257
47284
|
}
|
|
47258
47285
|
}
|
|
47259
|
-
var HTML_ENTITY_MAP, JsonFixingAgent, MermaidFixingAgent;
|
|
47286
|
+
var HTML_ENTITY_MAP, sessionIdCounter, JsonFixingAgent, MermaidFixingAgent;
|
|
47260
47287
|
var init_schemaUtils = __esm({
|
|
47261
47288
|
"src/agent/schemaUtils.js"() {
|
|
47262
47289
|
"use strict";
|
|
@@ -47272,11 +47299,12 @@ var init_schemaUtils = __esm({
|
|
|
47272
47299
|
// Also handle XML/HTML5 apostrophe entity
|
|
47273
47300
|
" ": " "
|
|
47274
47301
|
};
|
|
47302
|
+
sessionIdCounter = 0;
|
|
47275
47303
|
JsonFixingAgent = class {
|
|
47276
47304
|
constructor(options = {}) {
|
|
47277
47305
|
this.ProbeAgent = null;
|
|
47278
47306
|
this.options = {
|
|
47279
|
-
sessionId: options.sessionId || `json-fixer-${Date.now()}`,
|
|
47307
|
+
sessionId: options.sessionId || `json-fixer-${Date.now()}-${sessionIdCounter++}`,
|
|
47280
47308
|
path: options.path || process.cwd(),
|
|
47281
47309
|
provider: options.provider,
|
|
47282
47310
|
model: options.model,
|
|
@@ -47426,7 +47454,7 @@ Provide only the corrected JSON without any markdown formatting or explanations.
|
|
|
47426
47454
|
constructor(options = {}) {
|
|
47427
47455
|
this.ProbeAgent = null;
|
|
47428
47456
|
this.options = {
|
|
47429
|
-
sessionId: options.sessionId || `mermaid-fixer-${Date.now()}`,
|
|
47457
|
+
sessionId: options.sessionId || `mermaid-fixer-${Date.now()}-${sessionIdCounter++}`,
|
|
47430
47458
|
path: options.path || process.cwd(),
|
|
47431
47459
|
provider: options.provider,
|
|
47432
47460
|
model: options.model,
|
|
@@ -47607,15 +47635,15 @@ Provide only the corrected Mermaid diagram within a mermaid code block. Do not a
|
|
|
47607
47635
|
});
|
|
47608
47636
|
|
|
47609
47637
|
// src/agent/mcp/config.js
|
|
47610
|
-
import { readFileSync, existsSync as
|
|
47611
|
-
import { join as join2, dirname as
|
|
47638
|
+
import { readFileSync, existsSync as existsSync4, mkdirSync as mkdirSync3, writeFileSync } from "fs";
|
|
47639
|
+
import { join as join2, dirname as dirname3 } from "path";
|
|
47612
47640
|
import { homedir } from "os";
|
|
47613
47641
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
47614
47642
|
function loadMCPConfigurationFromPath(configPath) {
|
|
47615
47643
|
if (!configPath) {
|
|
47616
47644
|
throw new Error("Config path is required");
|
|
47617
47645
|
}
|
|
47618
|
-
if (!
|
|
47646
|
+
if (!existsSync4(configPath)) {
|
|
47619
47647
|
throw new Error(`MCP configuration file not found: ${configPath}`);
|
|
47620
47648
|
}
|
|
47621
47649
|
try {
|
|
@@ -47644,7 +47672,7 @@ function loadMCPConfiguration() {
|
|
|
47644
47672
|
].filter(Boolean);
|
|
47645
47673
|
let config = null;
|
|
47646
47674
|
for (const configPath of configPaths) {
|
|
47647
|
-
if (
|
|
47675
|
+
if (existsSync4(configPath)) {
|
|
47648
47676
|
try {
|
|
47649
47677
|
const content = readFileSync(configPath, "utf8");
|
|
47650
47678
|
config = JSON.parse(content);
|
|
@@ -47747,7 +47775,7 @@ var init_config = __esm({
|
|
|
47747
47775
|
"src/agent/mcp/config.js"() {
|
|
47748
47776
|
"use strict";
|
|
47749
47777
|
__filename4 = fileURLToPath6(import.meta.url);
|
|
47750
|
-
__dirname4 =
|
|
47778
|
+
__dirname4 = dirname3(__filename4);
|
|
47751
47779
|
DEFAULT_CONFIG = {
|
|
47752
47780
|
mcpServers: {
|
|
47753
47781
|
// Example probe server configuration
|
|
@@ -48376,9 +48404,9 @@ import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
|
|
|
48376
48404
|
import { streamText } from "ai";
|
|
48377
48405
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
48378
48406
|
import { EventEmitter as EventEmitter3 } from "events";
|
|
48379
|
-
import { existsSync as
|
|
48407
|
+
import { existsSync as existsSync5 } from "fs";
|
|
48380
48408
|
import { readFile, stat } from "fs/promises";
|
|
48381
|
-
import { resolve as resolve3, isAbsolute, dirname as
|
|
48409
|
+
import { resolve as resolve3, isAbsolute, dirname as dirname4 } from "path";
|
|
48382
48410
|
var MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, SUPPORTED_IMAGE_EXTENSIONS, MAX_IMAGE_FILE_SIZE, ProbeAgent;
|
|
48383
48411
|
var init_ProbeAgent = __esm({
|
|
48384
48412
|
"src/agent/ProbeAgent.js"() {
|
|
@@ -48763,7 +48791,7 @@ var init_ProbeAgent = __esm({
|
|
|
48763
48791
|
let match2;
|
|
48764
48792
|
while ((match2 = fileHeaderPattern.exec(content)) !== null) {
|
|
48765
48793
|
const filePath = match2[1].trim();
|
|
48766
|
-
const dir =
|
|
48794
|
+
const dir = dirname4(filePath);
|
|
48767
48795
|
if (dir && dir !== ".") {
|
|
48768
48796
|
directories.push(dir);
|
|
48769
48797
|
if (this.debug) {
|
|
@@ -50310,7 +50338,7 @@ import {
|
|
|
50310
50338
|
ListToolsRequestSchema,
|
|
50311
50339
|
McpError
|
|
50312
50340
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
50313
|
-
import { readFileSync as readFileSync2, existsSync as
|
|
50341
|
+
import { readFileSync as readFileSync2, existsSync as existsSync6 } from "fs";
|
|
50314
50342
|
import { resolve as resolve4 } from "path";
|
|
50315
50343
|
|
|
50316
50344
|
// src/agent/acp/server.js
|
|
@@ -50984,7 +51012,7 @@ function readInputContent(input) {
|
|
|
50984
51012
|
if (!input) return null;
|
|
50985
51013
|
try {
|
|
50986
51014
|
const resolvedPath = resolve4(input);
|
|
50987
|
-
if (
|
|
51015
|
+
if (existsSync6(resolvedPath)) {
|
|
50988
51016
|
return readFileSync2(resolvedPath, "utf-8").trim();
|
|
50989
51017
|
}
|
|
50990
51018
|
} catch (error) {
|
|
@@ -51536,7 +51564,7 @@ async function main() {
|
|
|
51536
51564
|
bashConfig.timeout = timeout;
|
|
51537
51565
|
}
|
|
51538
51566
|
if (config.bashWorkingDir) {
|
|
51539
|
-
if (!
|
|
51567
|
+
if (!existsSync6(config.bashWorkingDir)) {
|
|
51540
51568
|
console.error(`Error: Bash working directory does not exist: ${config.bashWorkingDir}`);
|
|
51541
51569
|
process.exit(1);
|
|
51542
51570
|
}
|
|
@@ -765,6 +765,9 @@ Ensure all Mermaid diagrams are properly formatted within \`\`\`mermaid code blo
|
|
|
765
765
|
return prompt;
|
|
766
766
|
}
|
|
767
767
|
|
|
768
|
+
// Counter to ensure unique session IDs even when created in the same millisecond
|
|
769
|
+
let sessionIdCounter = 0;
|
|
770
|
+
|
|
768
771
|
/**
|
|
769
772
|
* Specialized JSON fixing agent
|
|
770
773
|
* Uses a separate ProbeAgent instance optimized for JSON syntax correction
|
|
@@ -774,7 +777,7 @@ export class JsonFixingAgent {
|
|
|
774
777
|
// Import ProbeAgent dynamically to avoid circular dependencies
|
|
775
778
|
this.ProbeAgent = null;
|
|
776
779
|
this.options = {
|
|
777
|
-
sessionId: options.sessionId || `json-fixer-${Date.now()}`,
|
|
780
|
+
sessionId: options.sessionId || `json-fixer-${Date.now()}-${sessionIdCounter++}`,
|
|
778
781
|
path: options.path || process.cwd(),
|
|
779
782
|
provider: options.provider,
|
|
780
783
|
model: options.model,
|
|
@@ -1001,7 +1004,7 @@ export class MermaidFixingAgent {
|
|
|
1001
1004
|
// Import ProbeAgent dynamically to avoid circular dependencies
|
|
1002
1005
|
this.ProbeAgent = null;
|
|
1003
1006
|
this.options = {
|
|
1004
|
-
sessionId: options.sessionId || `mermaid-fixer-${Date.now()}`,
|
|
1007
|
+
sessionId: options.sessionId || `mermaid-fixer-${Date.now()}-${sessionIdCounter++}`,
|
|
1005
1008
|
path: options.path || process.cwd(),
|
|
1006
1009
|
provider: options.provider,
|
|
1007
1010
|
model: options.model,
|
package/build/agent/telemetry.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
2
|
+
import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
3
|
+
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';
|
|
4
4
|
import { trace, context, SpanStatusCode } from '@opentelemetry/api';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
6
|
+
import { BatchSpanProcessor, ConsoleSpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
7
7
|
|
|
8
8
|
import { existsSync, mkdirSync } from 'fs';
|
|
9
9
|
import { dirname } from 'path';
|
|
10
10
|
import { FileSpanExporter } from './fileSpanExporter.js';
|
|
11
11
|
|
|
12
|
-
const { NodeSDK } = nodeSDKPkg;
|
|
13
|
-
const { resourceFromAttributes } = resourcesPkg;
|
|
14
|
-
const { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } = semanticConventionsPkg;
|
|
15
|
-
const { OTLPTraceExporter } = otlpPkg;
|
|
16
|
-
const { BatchSpanProcessor, ConsoleSpanExporter } = spanPkg;
|
|
17
|
-
|
|
18
12
|
/**
|
|
19
13
|
* Custom OpenTelemetry configuration for probe-agent
|
|
20
14
|
*/
|
package/build/index.js
CHANGED
|
@@ -35,6 +35,8 @@ import { searchTool, queryTool, extractTool, delegateTool } from './tools/vercel
|
|
|
35
35
|
import { bashTool } from './tools/bash.js';
|
|
36
36
|
import { ProbeAgent } from './agent/ProbeAgent.js';
|
|
37
37
|
import { SimpleTelemetry, SimpleAppTracer, initializeSimpleTelemetryFromOptions } from './agent/simpleTelemetry.js';
|
|
38
|
+
import { TelemetryConfig, initializeTelemetryFromOptions } from './agent/telemetry.js';
|
|
39
|
+
import { AppTracer } from './agent/appTracer.js';
|
|
38
40
|
import { listFilesToolInstance, searchFilesToolInstance } from './agent/probeTool.js';
|
|
39
41
|
import { StorageAdapter, InMemoryStorageAdapter } from './agent/storage/index.js';
|
|
40
42
|
import { HookManager, HOOK_TYPES } from './agent/hooks/index.js';
|
|
@@ -58,10 +60,14 @@ export {
|
|
|
58
60
|
// Export hooks
|
|
59
61
|
HookManager,
|
|
60
62
|
HOOK_TYPES,
|
|
61
|
-
// Export telemetry classes
|
|
63
|
+
// Export simple telemetry classes (no OpenTelemetry dependencies)
|
|
62
64
|
SimpleTelemetry,
|
|
63
65
|
SimpleAppTracer,
|
|
64
66
|
initializeSimpleTelemetryFromOptions,
|
|
67
|
+
// Export full OpenTelemetry telemetry classes
|
|
68
|
+
TelemetryConfig,
|
|
69
|
+
AppTracer,
|
|
70
|
+
initializeTelemetryFromOptions,
|
|
65
71
|
// Export tool generators directly
|
|
66
72
|
searchTool,
|
|
67
73
|
queryTool,
|