@drisp/cli 0.3.39 → 0.4.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.
@@ -470,6 +470,9 @@ var ConsoleAdapter = class {
470
470
  idempotencyKey: msg.idempotencyKey,
471
471
  text: msg.text
472
472
  };
473
+ writeGatewayTrace(
474
+ `consoleAdapter send message.out runner=${this.opts.runnerId} workspace=${frame.address.workspaceId ?? ""} conversation=${frame.address.conversationId ?? ""} thread=${frame.address.threadId ?? ""} user=${frame.address.userId ?? ""} textLength=${msg.text.length} idempotencyKey=${msg.idempotencyKey}`
475
+ );
473
476
  client.sendFrame(frame);
474
477
  return {
475
478
  providerMessageId: messageId,
@@ -2097,7 +2100,7 @@ var cachedVersion = null;
2097
2100
  function readVersion() {
2098
2101
  if (cachedVersion !== null) return cachedVersion;
2099
2102
  try {
2100
- const injected = "0.3.39";
2103
+ const injected = "0.4.1";
2101
2104
  if (typeof injected === "string" && injected.length > 0) {
2102
2105
  cachedVersion = injected;
2103
2106
  return cachedVersion;
@@ -2669,6 +2672,9 @@ var Dispatcher = class {
2669
2672
  }
2670
2673
  async handleTurnComplete(payload) {
2671
2674
  const current = this.registry.getCurrent();
2675
+ writeGatewayTrace(
2676
+ `dispatcher turn.complete received runtimeId=${payload.runtimeId} dispatchId=${payload.dispatchId} channel=${payload.location.channelId} account=${payload.location.accountId} thread=${payload.location.thread?.id ?? ""} textLength=${payload.text.length}`
2677
+ );
2672
2678
  if (!current || current.runtimeId !== payload.runtimeId) {
2673
2679
  throw new Error("runtime mismatch on session.turn.complete");
2674
2680
  }
@@ -2677,15 +2683,24 @@ var Dispatcher = class {
2677
2683
  entry = this.registry.completeDispatch(payload.dispatchId);
2678
2684
  } catch (err) {
2679
2685
  if (err instanceof UnknownDispatchError) {
2686
+ writeGatewayTrace(
2687
+ `dispatcher turn.complete unknown dispatchId=${payload.dispatchId}`
2688
+ );
2680
2689
  return { delivered: false };
2681
2690
  }
2682
2691
  throw err;
2683
2692
  }
2693
+ writeGatewayTrace(
2694
+ `dispatcher sendOutbound channel=${entry.location.channelId} dispatchId=${payload.dispatchId} parkedAccount=${entry.location.accountId} parkedThread=${entry.location.thread?.id ?? ""}`
2695
+ );
2684
2696
  const result = await this.sendOutbound(entry.location.channelId, {
2685
2697
  location: payload.location,
2686
2698
  text: payload.text,
2687
2699
  idempotencyKey: payload.idempotencyKey
2688
2700
  });
2701
+ writeGatewayTrace(
2702
+ `dispatcher sendOutbound delivered dispatchId=${payload.dispatchId} providerMessageId=${result.providerMessageId}`
2703
+ );
2689
2704
  return {
2690
2705
  delivered: true,
2691
2706
  providerMessageId: result.providerMessageId
package/dist/cli.js CHANGED
@@ -12062,6 +12062,9 @@ var SessionBridge = class {
12062
12062
  }
12063
12063
  async completeTurn(input) {
12064
12064
  const client = await this.requireConnectedClient();
12065
+ writeGatewayTrace(
12066
+ `sessionBridge completeTurn request runtimeId=${this.opts.runtimeId} dispatchId=${input.dispatchId} channel=${input.location.channelId} account=${input.location.accountId} thread=${input.location.thread?.id ?? ""} textLength=${input.text.length}`
12067
+ );
12065
12068
  const req = {
12066
12069
  runtimeId: this.opts.runtimeId,
12067
12070
  dispatchId: input.dispatchId,
@@ -12069,7 +12072,11 @@ var SessionBridge = class {
12069
12072
  text: input.text,
12070
12073
  idempotencyKey: input.idempotencyKey
12071
12074
  };
12072
- return client.request("session.turn.complete", req);
12075
+ const res = await client.request("session.turn.complete", req);
12076
+ writeGatewayTrace(
12077
+ `sessionBridge completeTurn response runtimeId=${this.opts.runtimeId} dispatchId=${input.dispatchId} delivered=${res.delivered} providerMessageId=${res.providerMessageId ?? ""}`
12078
+ );
12079
+ return res;
12073
12080
  }
12074
12081
  async relayPermission(req) {
12075
12082
  writeGatewayTrace(
@@ -23928,6 +23935,9 @@ function AppContent({
23928
23935
  location: payload.inbound.location,
23929
23936
  feedEventCountAtDispatch: feedEvents.length
23930
23937
  };
23938
+ writeGatewayTrace(
23939
+ `AppShell dispatch received dispatchId=${payload.dispatchId} channel=${payload.inbound.location.channelId} account=${payload.inbound.location.accountId} thread=${payload.inbound.location.thread?.id ?? ""} feedCount=${feedEvents.length}`
23940
+ );
23931
23941
  addMessage("user", text);
23932
23942
  const sessionToResume = currentSessionId ?? initialSessionRef.current;
23933
23943
  const continuation = sessionToResume ? { mode: "resume", handle: sessionToResume } : { mode: "fresh" };
@@ -23978,6 +23988,9 @@ function AppContent({
23978
23988
  if (!text || text.length === 0) return;
23979
23989
  pendingDispatchRef.current = null;
23980
23990
  const idempotencyKey = `dispatch:${pending.dispatchId}`;
23991
+ writeGatewayTrace(
23992
+ `AppShell completing dispatchId=${pending.dispatchId} channel=${pending.location.channelId} account=${pending.location.accountId} thread=${pending.location.thread?.id ?? ""} replySeq=${reply.seq} replyLength=${text.length}`
23993
+ );
23981
23994
  void sessionBridge.completeTurn({
23982
23995
  dispatchId: pending.dispatchId,
23983
23996
  location: pending.location,
@@ -27399,7 +27412,7 @@ var cachedVersion = null;
27399
27412
  function readPackageVersion() {
27400
27413
  if (cachedVersion !== null) return cachedVersion;
27401
27414
  try {
27402
- const injected = "0.3.39";
27415
+ const injected = "0.4.1";
27403
27416
  if (typeof injected === "string" && injected.length > 0) {
27404
27417
  cachedVersion = injected;
27405
27418
  return cachedVersion;
@@ -27762,13 +27775,50 @@ async function runDashboardCommand(input, deps = {}) {
27762
27775
  pairedAt: now()
27763
27776
  };
27764
27777
  writeConfig(config);
27778
+ const pairedRunner = parsed.runners?.[0];
27779
+ let reloadResult;
27780
+ if (pairedRunner) {
27781
+ const consoleConfig = {
27782
+ broker_url: consoleBrokerUrl(origin, pairedRunner.runnerId),
27783
+ runner_id: pairedRunner.runnerId,
27784
+ dashboard_config: true
27785
+ };
27786
+ writeConsoleConfig(consoleConfig);
27787
+ if (!flags.json) {
27788
+ logOut(
27789
+ `dashboard: console linked runner ${pairedRunner.runnerId} to ${origin}`
27790
+ );
27791
+ }
27792
+ reloadResult = await reloadGatewayChannels();
27793
+ if (reloadResult.ok) {
27794
+ if (!flags.json) {
27795
+ logOut(
27796
+ `dashboard: gateway channels reloaded (${reloadResult.message})`
27797
+ );
27798
+ }
27799
+ } else {
27800
+ logError(`dashboard: gateway reload skipped: ${reloadResult.message}`);
27801
+ if (!flags.json) {
27802
+ logOut(
27803
+ "dashboard: start or reload the gateway before using the Console tab."
27804
+ );
27805
+ }
27806
+ }
27807
+ }
27765
27808
  if (flags.json) {
27766
27809
  logOut(
27767
27810
  JSON.stringify({
27768
27811
  ok: true,
27769
27812
  instanceId: parsed.instanceId,
27770
27813
  dashboardUrl: origin,
27771
- configPath: configPath()
27814
+ configPath: configPath(),
27815
+ ...parsed.runners ? { runners: parsed.runners } : {},
27816
+ ...reloadResult ? {
27817
+ gatewayReload: {
27818
+ ok: reloadResult.ok,
27819
+ message: reloadResult.message
27820
+ }
27821
+ } : {}
27772
27822
  })
27773
27823
  );
27774
27824
  } else {
@@ -28052,6 +28102,13 @@ function parsePairResponse(raw) {
28052
28102
  return {
28053
28103
  instanceId,
28054
28104
  refreshToken,
28105
+ ...Array.isArray(obj["runners"]) ? {
28106
+ runners: obj["runners"].map((entry) => {
28107
+ if (typeof entry !== "object" || entry === null) return null;
28108
+ const runnerId = entry["runnerId"];
28109
+ return typeof runnerId === "string" && runnerId.length > 0 ? { runnerId } : null;
28110
+ }).filter((entry) => entry !== null)
28111
+ } : {},
28055
28112
  ...typeof obj["jti"] === "string" ? { jti: obj["jti"] } : {},
28056
28113
  ...typeof obj["accessToken"] === "string" ? { accessToken: obj["accessToken"] } : {},
28057
28114
  ...typeof obj["expiresInSec"] === "number" ? { expiresInSec: obj["expiresInSec"] } : {}
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "hooks",
18
18
  "dashboard"
19
19
  ],
20
- "version": "0.3.39",
20
+ "version": "0.4.1",
21
21
  "license": "MIT",
22
22
  "bin": {
23
23
  "drisp": "dist/cli.js",