@botpress/runtime 1.15.4 → 1.16.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/runtime/context/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AAgBpC,OAAO,EAAE,4BAA4B,EAAqB,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAMzD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAQxE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAS5C,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,qBAAqB,EAAE,CAAA;IACrC,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,iBAAiB,EAAE,4BAA4B,CAAA;CAChD;AAED,KAAK,WAAW,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAGjH,eAAO,MAAM,mBAAmB,GAAI,MAAM,WAAW,SAEpD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAG,GAiRtD,CAAA"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/runtime/context/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AAgBpC,OAAO,EAAE,4BAA4B,EAAqB,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAMzD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAOxE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAS5C,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,qBAAqB,EAAE,CAAA;IACrC,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,iBAAiB,EAAE,4BAA4B,CAAA;CAChD;AAED,KAAK,WAAW,GAAG,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAGjH,eAAO,MAAM,mBAAmB,GAAI,MAAM,WAAW,SAEpD,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAG,GAkQtD,CAAA"}
@@ -1,42 +1,21 @@
1
1
  /**
2
2
  * Inspector Handler
3
3
  *
4
- * Provides a debug endpoint for starting the Node.js inspector at runtime.
5
- * When a POST request is made to /__debug/inspector, this handler:
6
- * 1. Opens the Node.js inspector on a random port
7
- * 2. Fetches inspector metadata from http://127.0.0.1:[PORT]/json/list
8
- * 3. Returns the DevTools frontend URL, inspector port, and process PID
4
+ * Provides the debug endpoint for returning the bot process PID.
9
5
  *
10
- * This allows developers to attach debuggers (Chrome DevTools, VSCode) to
11
- * running bot processes for debugging with full source map support.
6
+ * - POST /__debug/inspector Returns the process PID so VS Code can attach by PID.
7
+ * The inspector is NOT started here VS Code starts it automatically when attaching.
8
+ *
9
+ * Debugging is one-way: press [d] in `adk dev` to enable, then disconnect from
10
+ * VS Code when done (or let the process restart on file changes).
12
11
  */
13
12
  export interface InspectorResponse {
14
- inspectorUrl: string | null;
15
- inspectorPort: number | null;
16
- webSocketDebuggerUrl: string | null;
17
- devtoolsFrontendUrl: string | null;
18
13
  pid: number;
19
14
  }
20
- /**
21
- * Checks if the inspector is currently active.
22
- *
23
- * @returns True if inspector is open, false otherwise
24
- */
25
- export declare function isInspectorActive(): Promise<boolean>;
26
- /**
27
- * Closes the Node.js inspector if it's currently open.
28
- *
29
- * @returns HTTP response indicating success or failure
30
- */
31
- export declare function handleInspectorDisable(): Promise<{
32
- statusCode: number;
33
- headers: Record<string, string>;
34
- body: string;
35
- }>;
36
15
  /**
37
16
  * Handles the inspector debug request.
38
- * Just returns the PID without starting the inspector.
39
- * This allows VSCode to attach and start the inspector itself.
17
+ * Returns the PID without starting the inspector — VS Code will start it
18
+ * automatically when attaching to the process by PID.
40
19
  *
41
20
  * @returns HTTP response with PID information
42
21
  */
@@ -45,15 +24,4 @@ export declare function handleInspectorRequest(): Promise<{
45
24
  headers: Record<string, string>;
46
25
  body: string;
47
26
  }>;
48
- /**
49
- * Handles Chrome DevTools open request.
50
- * Starts the inspector if not already started and returns the DevTools URL.
51
- *
52
- * @returns HTTP response with inspector connection information
53
- */
54
- export declare function handleInspectorChrome(): Promise<{
55
- statusCode: number;
56
- headers: Record<string, string>;
57
- body: string;
58
- }>;
59
27
  //# sourceMappingURL=inspector-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"inspector-handler.d.ts","sourceRoot":"","sources":["../../../src/runtime/context/inspector-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAG1D;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC;IACtD,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;CACb,CAAC,CAaD;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC;IACtD,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;CACb,CAAC,CAgBD;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;CACb,CAAC,CA+CD"}
1
+ {"version":3,"file":"inspector-handler.d.ts","sourceRoot":"","sources":["../../../src/runtime/context/inspector-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC;IACtD,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,MAAM,CAAA;CACb,CAAC,CAUD"}
package/dist/runtime.js CHANGED
@@ -48,7 +48,7 @@ var init_define_BUILD = __esm({
48
48
  var define_PACKAGE_VERSIONS_default;
49
49
  var init_define_PACKAGE_VERSIONS = __esm({
50
50
  "<define:__PACKAGE_VERSIONS__>"() {
51
- define_PACKAGE_VERSIONS_default = { runtime: "1.15.4", adk: "not-installed", sdk: "5.4.3", llmz: "0.0.54", zai: "2.6.0", cognitive: "0.3.14" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.16.1", adk: "not-installed", sdk: "5.4.3", llmz: "0.0.54", zai: "2.6.0", cognitive: "0.3.14" };
52
52
  }
53
53
  });
54
54
 
@@ -48212,75 +48212,6 @@ var init_tracked_state = __esm({
48212
48212
  }
48213
48213
  });
48214
48214
 
48215
- // src/runtime/context/inspector-handler.ts
48216
- async function handleInspectorDisable() {
48217
- const inspector = await import("inspector");
48218
- if (inspector.url()) {
48219
- inspector.close();
48220
- }
48221
- return {
48222
- statusCode: 200,
48223
- headers: { "Content-Type": "application/json" },
48224
- body: JSON.stringify({ success: true, message: "Debug mode disabled" })
48225
- };
48226
- }
48227
- async function handleInspectorRequest() {
48228
- const responseData = {
48229
- inspectorUrl: null,
48230
- inspectorPort: null,
48231
- webSocketDebuggerUrl: null,
48232
- devtoolsFrontendUrl: null,
48233
- pid: process.pid
48234
- };
48235
- return {
48236
- statusCode: 200,
48237
- headers: { "Content-Type": "application/json" },
48238
- body: JSON.stringify(responseData)
48239
- };
48240
- }
48241
- async function handleInspectorChrome() {
48242
- const inspector = await import("inspector");
48243
- if (!inspector.url()) {
48244
- inspector.open(0);
48245
- }
48246
- const inspectorUrl = inspector.url();
48247
- const portMatch = inspectorUrl?.match(/:(\d+)\//);
48248
- const inspectorPort = portMatch?.[1] ? parseInt(portMatch[1], 10) : null;
48249
- let webSocketDebuggerUrl = null;
48250
- let devtoolsFrontendUrl = null;
48251
- if (inspectorPort && inspectorUrl) {
48252
- try {
48253
- const response = await fetch(`http://127.0.0.1:${inspectorPort}/json/list`);
48254
- const data = await response.json();
48255
- if (data && data.length > 0 && data[0]) {
48256
- webSocketDebuggerUrl = data[0].webSocketDebuggerUrl || null;
48257
- devtoolsFrontendUrl = data[0].devtoolsFrontendUrl || null;
48258
- }
48259
- } catch (err) {
48260
- console.error("Failed to fetch inspector details:", err);
48261
- }
48262
- }
48263
- const responseData = {
48264
- inspectorUrl: inspectorUrl || null,
48265
- inspectorPort,
48266
- webSocketDebuggerUrl,
48267
- devtoolsFrontendUrl,
48268
- pid: process.pid
48269
- };
48270
- return {
48271
- statusCode: 200,
48272
- headers: { "Content-Type": "application/json" },
48273
- body: JSON.stringify(responseData)
48274
- };
48275
- }
48276
- var init_inspector_handler = __esm({
48277
- "src/runtime/context/inspector-handler.ts"() {
48278
- "use strict";
48279
- init_define_BUILD();
48280
- init_define_PACKAGE_VERSIONS();
48281
- }
48282
- });
48283
-
48284
48215
  // src/runtime/events.ts
48285
48216
  import { z as z27 } from "@botpress/sdk";
48286
48217
  var WorkflowCallbackEvent, WorkflowScheduleEvent, WorkflowContinueEvent, SubworkflowFinished, WorkflowDataRequestEvent2;
@@ -48358,7 +48289,6 @@ var init_handlers = __esm({
48358
48289
  init_tracing();
48359
48290
  init_heavy_imports();
48360
48291
  init_environment();
48361
- init_inspector_handler();
48362
48292
  init_events2();
48363
48293
  requestHooks = [];
48364
48294
  registerRequestHook = (hook) => {
@@ -48445,17 +48375,6 @@ var init_handlers = __esm({
48445
48375
  scheduleHeavyImport("sdk");
48446
48376
  scheduleHeavyImport("llmz");
48447
48377
  try {
48448
- if (Environment.isDevelopment()) {
48449
- if (parsed.path === "/__debug/inspector" && parsed.method === "POST") {
48450
- return await handleInspectorRequest();
48451
- }
48452
- if (parsed.path === "/__debug/inspector" && parsed.method === "DELETE") {
48453
- return await handleInspectorDisable();
48454
- }
48455
- if (parsed.path === "/__debug/inspector/chrome" && parsed.method === "POST") {
48456
- return await handleInspectorChrome();
48457
- }
48458
- }
48459
48378
  for (const hook of requestHooks) {
48460
48379
  try {
48461
48380
  await hook(request, parsed);