@tangle-network/agent-provider-tangle 4.5.0 → 4.5.2

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.
@@ -3,6 +3,7 @@ import { projectAgentTerminalRecord } from "@tangle-network/sandbox/runtime";
3
3
  import { assertCliAuthReferenceSupported, cliAuthReferenceSchema, } from "@tangle-network/sandbox/auth";
4
4
  import { agentProfileSchema, canonicalAgentProfileDigest, boundedEventContentRecordSchema, AgentExactRunControlRefSchema, AgentTurnInputSchema, ContextTransferReceiptSchema, contextTransferResultMatchesRequest, } from "@tangle-network/agent-interface";
5
5
  import { tokenUsageFromData } from "./tangle-result-values.js";
6
+ import { TangleCredentialCapacityError } from "./model-credential-capacity.js";
6
7
  import { assertBoundedJson, boundedString, PROFILE_AT_PROFILE, } from "./tangle-contract-safety.js";
7
8
  import { profileCredentialSource } from "./model-credential-source.js";
8
9
  import { tangleRuntimeAttachments } from "./tangle-runtime-attachments.js";
@@ -555,6 +556,12 @@ export function agentTurnResultFromPromptRecord(record, options = {}) {
555
556
  !contextTransferResultMatchesRequest(options.contextTransferRequest, contextTransferReceipt.data)) {
556
557
  throw new Error("Tangle prompt result context receipt does not match its request");
557
558
  }
559
+ // The harness's own subscription quota is spent: the same typed refusal the
560
+ // credential owner gives before dispatch, with when it resets.
561
+ if (!record.success && record.errorCode === "provider_quota_exhausted") {
562
+ const resetAt = record.resetAt;
563
+ throw new TangleCredentialCapacityError("provider_quota_exhausted", "exhausted", typeof resetAt === "string" && new Date(resetAt).toISOString() === resetAt ? resetAt : undefined, 429);
564
+ }
558
565
  const usage = tokenUsageFromData(record);
559
566
  const awaiting = AWAITING_STATUSES.has(record.status);
560
567
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-tangle",
3
- "version": "4.5.0",
3
+ "version": "4.5.2",
4
4
  "description": "AgentEnvironmentProvider adapter for Tangle sandboxes",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -33,7 +33,7 @@
33
33
  "LICENSE"
34
34
  ],
35
35
  "dependencies": {
36
- "@tangle-network/agent-interface": "^5.7.1"
36
+ "@tangle-network/agent-interface": "^5.10.2"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@tangle-network/sandbox": ">=0.60.88 <2.0.0"
@@ -44,7 +44,7 @@
44
44
  }
45
45
  },
46
46
  "devDependencies": {
47
- "@tangle-network/agent-provider-testkit": "0.12.0",
47
+ "@tangle-network/agent-provider-testkit": "0.12.1",
48
48
  "@tangle-network/agent-runtime": "0.349.0",
49
49
  "@tangle-network/sandbox": "0.66.4",
50
50
  "@types/node": "26.6.5",