@absolutejs/mcp 0.20.1 → 0.21.0

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,5 +1,6 @@
1
1
  import type { McpToolRegistry } from "./types";
2
2
  export type ActionReview = {
3
+ maxCredits?: number;
3
4
  /** Set by the tool factory from the available confirmation capability. */
4
5
  canConfirm?: boolean;
5
6
  actionId: string;
@@ -14,8 +15,15 @@ export type ActionReview = {
14
15
  export type ActionConfirmation = {
15
16
  actionId: string;
16
17
  expectedRevision: string;
18
+ maxCredits?: number;
17
19
  };
18
20
  export type ActionJob = {
21
+ creditUsage?: {
22
+ workId: string;
23
+ maxCredits: number;
24
+ creditsCharged: number;
25
+ status: "reserved" | "settled";
26
+ };
19
27
  actionId: string;
20
28
  status: "awaiting_approval" | "queued" | "running" | "succeeded" | "failed" | "unknown" | "denied" | "expired";
21
29
  title: string;
@@ -29,7 +37,8 @@ export declare const projectActionJob: (value: unknown) => ActionJob;
29
37
  * Every draft writer must refuse edits after that claim. Never send inline.
30
38
  * Job reads/resume only reattach to saved work, including ambiguous outcomes. */
31
39
  export declare const createActionWorkflowTools: (adapter: {
32
- review: (actionId: string) => Promise<ActionReview>;
40
+ requiresBudget?: boolean;
41
+ review: (actionId: string, maxCredits?: number) => Promise<ActionReview>;
33
42
  job: (actionId: string) => Promise<ActionJob>;
34
43
  confirm?: (request: ActionConfirmation) => Promise<ActionJob>;
35
44
  }) => McpToolRegistry;
package/docs/mcp-apps.md CHANGED
@@ -127,3 +127,18 @@ and summaries; do not expose raw provider errors, credentials or queue internals
127
127
  The text-only path carries the same review and status; host support does not
128
128
  expand authorization or commerce eligibility. Review bodies are bounded at
129
129
  100,000 characters, subjects at 2,000, and recipient lists at 100.
130
+
131
+ ### Deferred prepaid action budgets
132
+
133
+ Action review accepts optional `maxCredits`; confirmation echoes that exact value.
134
+ A `requiresBudget` adapter exposes approval only for a review containing an explicit
135
+ positive safe-integer budget and marks confirmation as `paid_access` for
136
+ `usage_credits`. Existing server-bound host commerce policy still applies.
137
+ The consumer must bind the budget into its revision, atomically reserve with the
138
+ outbox, and transfer metering to its durable worker. Never interpret a review read
139
+ as spending permission. Missing or changed budgets must fail confirmation.
140
+
141
+ The shared App displays the hold, charge ceiling and uncertain-outcome behavior
142
+ before approval, then carries the budget unchanged to confirmation. Job results
143
+ may show projected `creditUsage` (work ID, maximum, charged amount and reserved or
144
+ settled state). Read/resume/refresh never reserve, settle or retry execution.
package/package.json CHANGED
@@ -90,5 +90,5 @@
90
90
  "canary:checkout": "bun canary/checkout.ts"
91
91
  },
92
92
  "types": "./dist/src/index.d.ts",
93
- "version": "0.20.1"
93
+ "version": "0.21.0"
94
94
  }