@scotthuang/agent-knock-knock 0.8.0 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.1 - 2026-08-03
4
+
5
+ ### Fixed
6
+
7
+ - Keep automatic and manual callback retries config-routed when no durable Gateway token exists, instead of restoring a tokenless explicit URL that OpenClaw rejects.
8
+ - Preserve persisted, explicitly authenticated Gateway URL and token pairs across retries without copying credentials into callback delivery state.
9
+
3
10
  ## 0.8.0 - 2026-08-01
4
11
 
5
12
  ### Changed
package/dist/src/cli.js CHANGED
@@ -5400,6 +5400,13 @@ function runCallbackRetryMonitor(options) {
5400
5400
  }
5401
5401
  return;
5402
5402
  }
5403
+ const gatewayRoute = resolveCallbackGatewayRoute({
5404
+ gatewayUrl: callbackDelivery.gateway_url,
5405
+ token: callbackDelivery.gateway_token
5406
+ }, {
5407
+ gatewayUrl: conversation.gateway_url,
5408
+ token: conversation.gateway_token
5409
+ });
5403
5410
  try {
5404
5411
  runCallbackTransaction({
5405
5412
  statePath,
@@ -5408,8 +5415,8 @@ function runCallbackRetryMonitor(options) {
5408
5415
  gatewaySession: stringValue(callbackDelivery.gateway_session) ?? conversation.gateway_session,
5409
5416
  openclawSession: conversation.openclaw_session,
5410
5417
  openclawBin: stringValue(callbackDelivery.openclaw_bin) ?? conversation.openclaw_bin,
5411
- gatewayUrl: stringValue(callbackDelivery.gateway_url) ?? conversation.gateway_url,
5412
- token: conversation.gateway_token,
5418
+ gatewayUrl: gatewayRoute.gatewayUrl,
5419
+ token: gatewayRoute.token,
5413
5420
  closeTerminalBridgeOnDone: callbackDelivery.close_terminal_bridge_on_done === true,
5414
5421
  retryPending: true,
5415
5422
  disableCallbackRetry: true
@@ -7414,6 +7421,16 @@ function runRetryCallback(options) {
7414
7421
  if (!callbackDelivery || !isRecord(callbackDelivery.message)) {
7415
7422
  throw new Error(`cannot retry callback for ${conversation.conversation_id}; pending callback is missing`);
7416
7423
  }
7424
+ const gatewayRoute = resolveCallbackGatewayRoute({
7425
+ gatewayUrl: options.gatewayUrl,
7426
+ token: options.token
7427
+ }, {
7428
+ gatewayUrl: callbackDelivery.gateway_url,
7429
+ token: callbackDelivery.gateway_token
7430
+ }, {
7431
+ gatewayUrl: conversation.gateway_url,
7432
+ token: conversation.gateway_token
7433
+ });
7417
7434
  runCallbackTransaction({
7418
7435
  ...options,
7419
7436
  statePath,
@@ -7422,12 +7439,28 @@ function runRetryCallback(options) {
7422
7439
  gatewaySession: stringValue(callbackDelivery.gateway_session) ?? conversation.gateway_session,
7423
7440
  openclawSession: conversation.openclaw_session,
7424
7441
  openclawBin: stringValue(callbackDelivery.openclaw_bin) ?? conversation.openclaw_bin,
7425
- gatewayUrl: stringValue(callbackDelivery.gateway_url) ?? conversation.gateway_url,
7426
- token: stringValue(callbackDelivery.gateway_token) ?? conversation.gateway_token,
7442
+ gatewayUrl: gatewayRoute.gatewayUrl,
7443
+ token: gatewayRoute.token,
7427
7444
  closeTerminalBridgeOnDone: callbackDelivery.close_terminal_bridge_on_done === true,
7428
7445
  retryPending: true
7429
7446
  });
7430
7447
  }
7448
+ function resolveCallbackGatewayRoute(...candidates) {
7449
+ for (const candidate of candidates) {
7450
+ const token = stringValue(candidate?.token);
7451
+ if (!token || token === "<token>") {
7452
+ continue;
7453
+ }
7454
+ return {
7455
+ gatewayUrl: stringValue(candidate?.gatewayUrl),
7456
+ token
7457
+ };
7458
+ }
7459
+ return {
7460
+ gatewayUrl: undefined,
7461
+ token: undefined
7462
+ };
7463
+ }
7431
7464
  function runCallbackTransaction(options) {
7432
7465
  const releaseLock = acquireFileLock(`${options.statePath}.lock`);
7433
7466
  let prepared;
@@ -7446,6 +7479,10 @@ function prepareLockedCallback(options) {
7446
7479
  ? options.conversationOverride
7447
7480
  : loadState(options.statePath);
7448
7481
  const executor = executorForConversation(conversation);
7482
+ const persistedGatewayRoute = resolveCallbackGatewayRoute({
7483
+ gatewayUrl: options.gatewayUrl,
7484
+ token: options.token
7485
+ });
7449
7486
  const message = options.retryPending === true || options.preserveMessageId === true
7450
7487
  ? parseMessageJson(messageInput)
7451
7488
  : extractStructuredMessage({
@@ -7555,7 +7592,7 @@ function prepareLockedCallback(options) {
7555
7592
  last_attempt_at: now,
7556
7593
  gateway_method: options.gatewayMethod,
7557
7594
  gateway_session: options.gatewaySession ?? options.openclawSession ?? conversation.openclaw_session,
7558
- gateway_url: options.gatewayUrl ?? conversation.gateway_url,
7595
+ gateway_url: persistedGatewayRoute.gatewayUrl,
7559
7596
  openclaw_bin: options.openclawBin ?? conversation.openclaw_bin,
7560
7597
  close_terminal_bridge_on_done: closeTerminalBridgeOnDone,
7561
7598
  track_delivery: true,