impel-cli 0.20.31 → 0.20.32

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/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release notes
2
2
 
3
+ ## 0.20.32 — Recover transient managed access misses
4
+
5
+ - Retries one exact MCP request when the gateway reports its specific managed
6
+ virtual-key cache-miss rejection, covering catalog binding and direct-answer
7
+ calls before they become visible to the host model.
8
+ - Reuses the same native-answer idempotency key and waits only 250ms, so the
9
+ recovery cannot duplicate an Eve run or add latency to healthy requests.
10
+ - Keeps every nearby authentication and governance rejection definitive and
11
+ bounds a persistent managed-key miss to exactly two attempts.
12
+
3
13
  ## 0.20.31 — Complete embedded Tasks controls
4
14
 
5
15
  - Allows the guarded `delete_task` operation through the tenant desktop bridge
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impel-cli",
3
- "version": "0.20.31",
3
+ "version": "0.20.32",
4
4
  "description": "Prepare isolated Claude and Codex workspaces for every accessible Impel tenant",
5
5
  "type": "module",
6
6
  "bin": {
@@ -63,6 +63,8 @@ const STATE_COMMIT_LEASE_MARGIN_MS = 5_000;
63
63
  const CIBI_START_IN_PROGRESS_CODE = "eve_run_drain_start_in_progress";
64
64
  const CIBI_START_IN_PROGRESS_MESSAGE = "The durable Eve drain workflow is still being enqueued; retry this idempotent start.";
65
65
  const CTOS_START_TIMEOUT_MESSAGE = `MCP tool call failed for ${NATIVE_AGENT_START_TOOL}: The operation was aborted due to timeout: mcp tool call failed`;
66
+ const MANAGED_VIRTUAL_KEY_MISS_MESSAGE = "virtual key not found. The provided virtual key does not exist or has been revoked.";
67
+ const MANAGED_VIRTUAL_KEY_MISS_RETRY_DELAY_MS = 250;
66
68
  const MCP_TOOL_RESULT_ERROR = Symbol("native-agent MCP tool result error");
67
69
  const TERMINAL_STATUSES = new Set(["succeeded", "failed", "cancelled", "canceled"]);
68
70
 
@@ -634,6 +636,12 @@ function toolPayload(message) {
634
636
  return result;
635
637
  }
636
638
 
639
+ function retryableManagedVirtualKeyMiss(error) {
640
+ return error instanceof NativeAgentUpstreamError
641
+ && (error[MCP_TOOL_RESULT_ERROR] === true || error.code === -32000)
642
+ && error.message.includes(MANAGED_VIRTUAL_KEY_MISS_MESSAGE);
643
+ }
644
+
637
645
  export class NativeAgentUpstreamSession {
638
646
  constructor({
639
647
  gatewayUrl,
@@ -756,28 +764,38 @@ export class NativeAgentUpstreamSession {
756
764
  }
757
765
 
758
766
  async call(name, args, { signal } = {}) {
759
- const id = this.nextId++;
760
- try {
761
- const messages = await this.post({
762
- jsonrpc: "2.0",
763
- id,
764
- method: "tools/call",
765
- params: { name, arguments: args },
766
- }, { signal });
767
- return toolPayload(messages.find((message) => message?.id === id));
768
- } catch (error) {
769
- if ((name === NATIVE_AGENT_START_TOOL || name === NATIVE_AGENT_UPSTREAM_ANSWER_TOOL)
770
- && error instanceof NativeAgentUpstreamError
771
- && (error.incompleteResponse
772
- || error.code === CIBI_START_IN_PROGRESS_CODE
773
- || error.data?.code === CIBI_START_IN_PROGRESS_CODE
774
- || error.message === CIBI_START_IN_PROGRESS_MESSAGE
775
- || (error[MCP_TOOL_RESULT_ERROR] === true
776
- && error.message === CTOS_START_TIMEOUT_MESSAGE))) {
777
- error.ambiguous = true;
767
+ for (let attempt = 0; attempt < 2; attempt += 1) {
768
+ const id = this.nextId++;
769
+ try {
770
+ const messages = await this.post({
771
+ jsonrpc: "2.0",
772
+ id,
773
+ method: "tools/call",
774
+ params: { name, arguments: args },
775
+ }, { signal });
776
+ return toolPayload(messages.find((message) => message?.id === id));
777
+ } catch (error) {
778
+ if (attempt === 0 && retryableManagedVirtualKeyMiss(error)) {
779
+ // This gateway-authored miss happens before a native run can exist.
780
+ // One same-session replay repairs transient per-task governance-cache
781
+ // drift while leaving every nearby auth/policy rejection definitive.
782
+ await abortableDelay(MANAGED_VIRTUAL_KEY_MISS_RETRY_DELAY_MS, signal);
783
+ continue;
784
+ }
785
+ if ((name === NATIVE_AGENT_START_TOOL || name === NATIVE_AGENT_UPSTREAM_ANSWER_TOOL)
786
+ && error instanceof NativeAgentUpstreamError
787
+ && (error.incompleteResponse
788
+ || error.code === CIBI_START_IN_PROGRESS_CODE
789
+ || error.data?.code === CIBI_START_IN_PROGRESS_CODE
790
+ || error.message === CIBI_START_IN_PROGRESS_MESSAGE
791
+ || (error[MCP_TOOL_RESULT_ERROR] === true
792
+ && error.message === CTOS_START_TIMEOUT_MESSAGE))) {
793
+ error.ambiguous = true;
794
+ }
795
+ throw error;
778
796
  }
779
- throw error;
780
797
  }
798
+ throw new Error("native-agent MCP retry loop exhausted");
781
799
  }
782
800
  }
783
801