@probelabs/probe 0.6.0-rc336 → 0.6.0-rc339

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.
@@ -2488,7 +2488,6 @@ export class ProbeAgent {
2488
2488
  this.engine = await createCodexEngine({
2489
2489
  agent: this, // Pass reference to ProbeAgent for tool access
2490
2490
  systemPrompt: systemPrompt,
2491
- customPrompt: this.customPrompt,
2492
2491
  sessionId: this.options?.sessionId,
2493
2492
  debug: this.debug,
2494
2493
  allowedTools: this.allowedTools, // Pass tool filtering configuration
@@ -3337,7 +3336,7 @@ ${extractGuidance2}
3337
3336
  const { prompt } = this._prepareGovernedAnswerPrompt(message, options);
3338
3337
  const systemPrompt = await this._getCachedCodexNativeSystemPrompt();
3339
3338
  const { previewGovernedCodexInitialDispatch } = await import('./engines/codex.js');
3340
- return previewGovernedCodexInitialDispatch({ systemPrompt, customPrompt: this.customPrompt, prompt });
3339
+ return previewGovernedCodexInitialDispatch({ systemPrompt, prompt });
3341
3340
  }
3342
3341
 
3343
3342
  /**
@@ -7,6 +7,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
7
7
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
8
8
  import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
9
9
  import { WebSocketClientTransport } from '@modelcontextprotocol/sdk/client/websocket.js';
10
+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
10
11
  import { loadMCPConfiguration, parseEnabledServers, DEFAULT_TIMEOUT } from './config.js';
11
12
 
12
13
  /**
@@ -89,71 +90,24 @@ export function createTransport(serverConfig) {
89
90
  }
90
91
 
91
92
  case 'http':
92
- case 'streamable':
93
- // For HTTP, we'll use a custom implementation since the SDK
94
- // doesn't provide a direct HTTP transport yet
93
+ case 'streamable': {
95
94
  if (!url) {
96
95
  throw new Error('HTTP transport requires a URL');
97
96
  }
98
- // Return a custom HTTP transport wrapper
99
- return createHttpTransport(url);
97
+ const requestInit = {};
98
+ if (serverConfig.headers && typeof serverConfig.headers === 'object') {
99
+ requestInit.headers = { ...serverConfig.headers };
100
+ }
101
+ return new StreamableHTTPClientTransport(new URL(url), {
102
+ requestInit: Object.keys(requestInit).length > 0 ? requestInit : undefined,
103
+ });
104
+ }
100
105
 
101
106
  default:
102
107
  throw new Error(`Unknown transport type: ${transport}`);
103
108
  }
104
109
  }
105
110
 
106
- /**
107
- * Create a custom HTTP transport wrapper
108
- * This simulates MCP over HTTP REST endpoints
109
- */
110
- function createHttpTransport(url) {
111
- // This is a simplified HTTP transport
112
- // In practice, you'd implement the full MCP protocol over HTTP
113
- return {
114
- async start() {
115
- // Initialize HTTP connection
116
- const response = await fetch(`${url}/initialize`, {
117
- method: 'POST',
118
- headers: { 'Content-Type': 'application/json' },
119
- body: JSON.stringify({
120
- protocolVersion: '2024-11-05',
121
- capabilities: {}
122
- })
123
- });
124
-
125
- if (!response.ok) {
126
- throw new Error(`HTTP initialization failed: ${response.statusText}`);
127
- }
128
-
129
- return response.json();
130
- },
131
-
132
- async send(message) {
133
- const response = await fetch(`${url}/message`, {
134
- method: 'POST',
135
- headers: { 'Content-Type': 'application/json' },
136
- body: JSON.stringify(message)
137
- });
138
-
139
- if (!response.ok) {
140
- throw new Error(`HTTP request failed: ${response.statusText}`);
141
- }
142
-
143
- return response.json();
144
- },
145
-
146
- async close() {
147
- // Close HTTP connection
148
- await fetch(`${url}/close`, {
149
- method: 'POST'
150
- }).catch(() => {
151
- // Ignore close errors
152
- });
153
- }
154
- };
155
- }
156
-
157
111
  /**
158
112
  * MCP Client Manager - manages multiple MCP server connections
159
113
  */
@@ -96596,51 +96596,23 @@ function createTransport(serverConfig) {
96596
96596
  throw new Error(`Invalid WebSocket URL: ${url2}`);
96597
96597
  }
96598
96598
  case "http":
96599
- case "streamable":
96599
+ case "streamable": {
96600
96600
  if (!url2) {
96601
96601
  throw new Error("HTTP transport requires a URL");
96602
96602
  }
96603
- return createHttpTransport(url2);
96604
- default:
96605
- throw new Error(`Unknown transport type: ${transport}`);
96606
- }
96607
- }
96608
- function createHttpTransport(url2) {
96609
- return {
96610
- async start() {
96611
- const response = await fetch(`${url2}/initialize`, {
96612
- method: "POST",
96613
- headers: { "Content-Type": "application/json" },
96614
- body: JSON.stringify({
96615
- protocolVersion: "2024-11-05",
96616
- capabilities: {}
96617
- })
96618
- });
96619
- if (!response.ok) {
96620
- throw new Error(`HTTP initialization failed: ${response.statusText}`);
96603
+ const requestInit = {};
96604
+ if (serverConfig.headers && typeof serverConfig.headers === "object") {
96605
+ requestInit.headers = { ...serverConfig.headers };
96621
96606
  }
96622
- return response.json();
96623
- },
96624
- async send(message) {
96625
- const response = await fetch(`${url2}/message`, {
96626
- method: "POST",
96627
- headers: { "Content-Type": "application/json" },
96628
- body: JSON.stringify(message)
96629
- });
96630
- if (!response.ok) {
96631
- throw new Error(`HTTP request failed: ${response.statusText}`);
96632
- }
96633
- return response.json();
96634
- },
96635
- async close() {
96636
- await fetch(`${url2}/close`, {
96637
- method: "POST"
96638
- }).catch(() => {
96607
+ return new import_streamableHttp.StreamableHTTPClientTransport(new URL(url2), {
96608
+ requestInit: Object.keys(requestInit).length > 0 ? requestInit : void 0
96639
96609
  });
96640
96610
  }
96641
- };
96611
+ default:
96612
+ throw new Error(`Unknown transport type: ${transport}`);
96613
+ }
96642
96614
  }
96643
- var import_client, import_stdio, import_sse, import_websocket, MCPClientManager;
96615
+ var import_client, import_stdio, import_sse, import_websocket, import_streamableHttp, MCPClientManager;
96644
96616
  var init_client = __esm({
96645
96617
  "src/agent/mcp/client.js"() {
96646
96618
  "use strict";
@@ -96648,6 +96620,7 @@ var init_client = __esm({
96648
96620
  import_stdio = require("@modelcontextprotocol/sdk/client/stdio.js");
96649
96621
  import_sse = require("@modelcontextprotocol/sdk/client/sse.js");
96650
96622
  import_websocket = require("@modelcontextprotocol/sdk/client/websocket.js");
96623
+ import_streamableHttp = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
96651
96624
  init_config2();
96652
96625
  MCPClientManager = class {
96653
96626
  constructor(options = {}) {
@@ -97349,7 +97322,7 @@ function abortable(promise2, signal) {
97349
97322
  });
97350
97323
  });
97351
97324
  }
97352
- var import_http, import_events2, import_crypto6, import_server, import_sse2, import_streamableHttp, import_ai5, import_types5, TOOL_DESCRIPTORS, ARGUMENT_DOMAIN, GOVERNED_CODEX_PROFILE_V2, GOVERNED_CALL_LIMIT, InMemoryEventStore, BuiltInMCPServer;
97325
+ var import_http, import_events2, import_crypto6, import_server, import_sse2, import_streamableHttp2, import_ai5, import_types5, TOOL_DESCRIPTORS, ARGUMENT_DOMAIN, GOVERNED_CODEX_PROFILE_V2, GOVERNED_CALL_LIMIT, InMemoryEventStore, BuiltInMCPServer;
97353
97326
  var init_built_in_server = __esm({
97354
97327
  "src/agent/mcp/built-in-server.js"() {
97355
97328
  "use strict";
@@ -97358,7 +97331,7 @@ var init_built_in_server = __esm({
97358
97331
  import_crypto6 = require("crypto");
97359
97332
  import_server = require("@modelcontextprotocol/sdk/server/index.js");
97360
97333
  import_sse2 = require("@modelcontextprotocol/sdk/server/sse.js");
97361
- import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
97334
+ import_streamableHttp2 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
97362
97335
  import_ai5 = require("ai");
97363
97336
  init_common();
97364
97337
  import_types5 = require("@modelcontextprotocol/sdk/types.js");
@@ -97612,7 +97585,7 @@ var init_built_in_server = __esm({
97612
97585
  console.log("[MCP] Creating new Streamable HTTP transport for initialization");
97613
97586
  }
97614
97587
  const eventStore = new InMemoryEventStore();
97615
- transport = new import_streamableHttp.StreamableHTTPServerTransport({
97588
+ transport = new import_streamableHttp2.StreamableHTTPServerTransport({
97616
97589
  sessionIdGenerator: () => (0, import_crypto6.randomUUID)(),
97617
97590
  eventStore,
97618
97591
  // Enable resumability
@@ -110322,7 +110295,6 @@ var init_ProbeAgent = __esm({
110322
110295
  agent: this,
110323
110296
  // Pass reference to ProbeAgent for tool access
110324
110297
  systemPrompt,
110325
- customPrompt: this.customPrompt,
110326
110298
  sessionId: this.options?.sessionId,
110327
110299
  debug: this.debug,
110328
110300
  allowedTools: this.allowedTools,
@@ -111031,7 +111003,7 @@ Workspace: ${this.allowedFolders.join(", ")}`;
111031
111003
  const { prompt } = this._prepareGovernedAnswerPrompt(message, options);
111032
111004
  const systemPrompt = await this._getCachedCodexNativeSystemPrompt();
111033
111005
  const { previewGovernedCodexInitialDispatch: previewGovernedCodexInitialDispatch2 } = await Promise.resolve().then(() => (init_codex(), codex_exports));
111034
- return previewGovernedCodexInitialDispatch2({ systemPrompt, customPrompt: this.customPrompt, prompt });
111006
+ return previewGovernedCodexInitialDispatch2({ systemPrompt, prompt });
111035
111007
  }
111036
111008
  /**
111037
111009
  * Get the system message with instructions for the AI (XML Tool Format)
package/cjs/index.cjs CHANGED
@@ -96542,51 +96542,23 @@ function createTransport(serverConfig) {
96542
96542
  throw new Error(`Invalid WebSocket URL: ${url2}`);
96543
96543
  }
96544
96544
  case "http":
96545
- case "streamable":
96545
+ case "streamable": {
96546
96546
  if (!url2) {
96547
96547
  throw new Error("HTTP transport requires a URL");
96548
96548
  }
96549
- return createHttpTransport(url2);
96550
- default:
96551
- throw new Error(`Unknown transport type: ${transport}`);
96552
- }
96553
- }
96554
- function createHttpTransport(url2) {
96555
- return {
96556
- async start() {
96557
- const response = await fetch(`${url2}/initialize`, {
96558
- method: "POST",
96559
- headers: { "Content-Type": "application/json" },
96560
- body: JSON.stringify({
96561
- protocolVersion: "2024-11-05",
96562
- capabilities: {}
96563
- })
96564
- });
96565
- if (!response.ok) {
96566
- throw new Error(`HTTP initialization failed: ${response.statusText}`);
96549
+ const requestInit = {};
96550
+ if (serverConfig.headers && typeof serverConfig.headers === "object") {
96551
+ requestInit.headers = { ...serverConfig.headers };
96567
96552
  }
96568
- return response.json();
96569
- },
96570
- async send(message) {
96571
- const response = await fetch(`${url2}/message`, {
96572
- method: "POST",
96573
- headers: { "Content-Type": "application/json" },
96574
- body: JSON.stringify(message)
96575
- });
96576
- if (!response.ok) {
96577
- throw new Error(`HTTP request failed: ${response.statusText}`);
96578
- }
96579
- return response.json();
96580
- },
96581
- async close() {
96582
- await fetch(`${url2}/close`, {
96583
- method: "POST"
96584
- }).catch(() => {
96553
+ return new import_streamableHttp.StreamableHTTPClientTransport(new URL(url2), {
96554
+ requestInit: Object.keys(requestInit).length > 0 ? requestInit : void 0
96585
96555
  });
96586
96556
  }
96587
- };
96557
+ default:
96558
+ throw new Error(`Unknown transport type: ${transport}`);
96559
+ }
96588
96560
  }
96589
- var import_client, import_stdio, import_sse, import_websocket, MCPClientManager;
96561
+ var import_client, import_stdio, import_sse, import_websocket, import_streamableHttp, MCPClientManager;
96590
96562
  var init_client = __esm({
96591
96563
  "src/agent/mcp/client.js"() {
96592
96564
  "use strict";
@@ -96594,6 +96566,7 @@ var init_client = __esm({
96594
96566
  import_stdio = require("@modelcontextprotocol/sdk/client/stdio.js");
96595
96567
  import_sse = require("@modelcontextprotocol/sdk/client/sse.js");
96596
96568
  import_websocket = require("@modelcontextprotocol/sdk/client/websocket.js");
96569
+ import_streamableHttp = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
96597
96570
  init_config2();
96598
96571
  MCPClientManager = class {
96599
96572
  constructor(options = {}) {
@@ -97295,7 +97268,7 @@ function abortable(promise2, signal) {
97295
97268
  });
97296
97269
  });
97297
97270
  }
97298
- var import_http, import_events2, import_crypto5, import_server, import_sse2, import_streamableHttp, import_ai5, import_types5, TOOL_DESCRIPTORS, ARGUMENT_DOMAIN, GOVERNED_CODEX_PROFILE_V2, GOVERNED_CALL_LIMIT, InMemoryEventStore, BuiltInMCPServer;
97271
+ var import_http, import_events2, import_crypto5, import_server, import_sse2, import_streamableHttp2, import_ai5, import_types5, TOOL_DESCRIPTORS, ARGUMENT_DOMAIN, GOVERNED_CODEX_PROFILE_V2, GOVERNED_CALL_LIMIT, InMemoryEventStore, BuiltInMCPServer;
97299
97272
  var init_built_in_server = __esm({
97300
97273
  "src/agent/mcp/built-in-server.js"() {
97301
97274
  "use strict";
@@ -97304,7 +97277,7 @@ var init_built_in_server = __esm({
97304
97277
  import_crypto5 = require("crypto");
97305
97278
  import_server = require("@modelcontextprotocol/sdk/server/index.js");
97306
97279
  import_sse2 = require("@modelcontextprotocol/sdk/server/sse.js");
97307
- import_streamableHttp = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
97280
+ import_streamableHttp2 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
97308
97281
  import_ai5 = require("ai");
97309
97282
  init_common();
97310
97283
  import_types5 = require("@modelcontextprotocol/sdk/types.js");
@@ -97558,7 +97531,7 @@ var init_built_in_server = __esm({
97558
97531
  console.log("[MCP] Creating new Streamable HTTP transport for initialization");
97559
97532
  }
97560
97533
  const eventStore = new InMemoryEventStore();
97561
- transport = new import_streamableHttp.StreamableHTTPServerTransport({
97534
+ transport = new import_streamableHttp2.StreamableHTTPServerTransport({
97562
97535
  sessionIdGenerator: () => (0, import_crypto5.randomUUID)(),
97563
97536
  eventStore,
97564
97537
  // Enable resumability
@@ -110268,7 +110241,6 @@ var init_ProbeAgent = __esm({
110268
110241
  agent: this,
110269
110242
  // Pass reference to ProbeAgent for tool access
110270
110243
  systemPrompt,
110271
- customPrompt: this.customPrompt,
110272
110244
  sessionId: this.options?.sessionId,
110273
110245
  debug: this.debug,
110274
110246
  allowedTools: this.allowedTools,
@@ -110977,7 +110949,7 @@ Workspace: ${this.allowedFolders.join(", ")}`;
110977
110949
  const { prompt } = this._prepareGovernedAnswerPrompt(message, options);
110978
110950
  const systemPrompt = await this._getCachedCodexNativeSystemPrompt();
110979
110951
  const { previewGovernedCodexInitialDispatch: previewGovernedCodexInitialDispatch2 } = await Promise.resolve().then(() => (init_codex(), codex_exports));
110980
- return previewGovernedCodexInitialDispatch2({ systemPrompt, customPrompt: this.customPrompt, prompt });
110952
+ return previewGovernedCodexInitialDispatch2({ systemPrompt, prompt });
110981
110953
  }
110982
110954
  /**
110983
110955
  * Get the system message with instructions for the AI (XML Tool Format)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc336",
3
+ "version": "0.6.0-rc339",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -2488,7 +2488,6 @@ export class ProbeAgent {
2488
2488
  this.engine = await createCodexEngine({
2489
2489
  agent: this, // Pass reference to ProbeAgent for tool access
2490
2490
  systemPrompt: systemPrompt,
2491
- customPrompt: this.customPrompt,
2492
2491
  sessionId: this.options?.sessionId,
2493
2492
  debug: this.debug,
2494
2493
  allowedTools: this.allowedTools, // Pass tool filtering configuration
@@ -3337,7 +3336,7 @@ ${extractGuidance2}
3337
3336
  const { prompt } = this._prepareGovernedAnswerPrompt(message, options);
3338
3337
  const systemPrompt = await this._getCachedCodexNativeSystemPrompt();
3339
3338
  const { previewGovernedCodexInitialDispatch } = await import('./engines/codex.js');
3340
- return previewGovernedCodexInitialDispatch({ systemPrompt, customPrompt: this.customPrompt, prompt });
3339
+ return previewGovernedCodexInitialDispatch({ systemPrompt, prompt });
3341
3340
  }
3342
3341
 
3343
3342
  /**
@@ -7,6 +7,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
7
7
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
8
8
  import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
9
9
  import { WebSocketClientTransport } from '@modelcontextprotocol/sdk/client/websocket.js';
10
+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
10
11
  import { loadMCPConfiguration, parseEnabledServers, DEFAULT_TIMEOUT } from './config.js';
11
12
 
12
13
  /**
@@ -89,71 +90,24 @@ export function createTransport(serverConfig) {
89
90
  }
90
91
 
91
92
  case 'http':
92
- case 'streamable':
93
- // For HTTP, we'll use a custom implementation since the SDK
94
- // doesn't provide a direct HTTP transport yet
93
+ case 'streamable': {
95
94
  if (!url) {
96
95
  throw new Error('HTTP transport requires a URL');
97
96
  }
98
- // Return a custom HTTP transport wrapper
99
- return createHttpTransport(url);
97
+ const requestInit = {};
98
+ if (serverConfig.headers && typeof serverConfig.headers === 'object') {
99
+ requestInit.headers = { ...serverConfig.headers };
100
+ }
101
+ return new StreamableHTTPClientTransport(new URL(url), {
102
+ requestInit: Object.keys(requestInit).length > 0 ? requestInit : undefined,
103
+ });
104
+ }
100
105
 
101
106
  default:
102
107
  throw new Error(`Unknown transport type: ${transport}`);
103
108
  }
104
109
  }
105
110
 
106
- /**
107
- * Create a custom HTTP transport wrapper
108
- * This simulates MCP over HTTP REST endpoints
109
- */
110
- function createHttpTransport(url) {
111
- // This is a simplified HTTP transport
112
- // In practice, you'd implement the full MCP protocol over HTTP
113
- return {
114
- async start() {
115
- // Initialize HTTP connection
116
- const response = await fetch(`${url}/initialize`, {
117
- method: 'POST',
118
- headers: { 'Content-Type': 'application/json' },
119
- body: JSON.stringify({
120
- protocolVersion: '2024-11-05',
121
- capabilities: {}
122
- })
123
- });
124
-
125
- if (!response.ok) {
126
- throw new Error(`HTTP initialization failed: ${response.statusText}`);
127
- }
128
-
129
- return response.json();
130
- },
131
-
132
- async send(message) {
133
- const response = await fetch(`${url}/message`, {
134
- method: 'POST',
135
- headers: { 'Content-Type': 'application/json' },
136
- body: JSON.stringify(message)
137
- });
138
-
139
- if (!response.ok) {
140
- throw new Error(`HTTP request failed: ${response.statusText}`);
141
- }
142
-
143
- return response.json();
144
- },
145
-
146
- async close() {
147
- // Close HTTP connection
148
- await fetch(`${url}/close`, {
149
- method: 'POST'
150
- }).catch(() => {
151
- // Ignore close errors
152
- });
153
- }
154
- };
155
- }
156
-
157
111
  /**
158
112
  * MCP Client Manager - manages multiple MCP server connections
159
113
  */