@absolutejs/mcp 0.20.1 → 0.22.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,11 @@
1
1
  import type { McpToolRegistry } from "./types";
2
2
  export type ActionReview = {
3
+ /** Complete action-specific terms; adapters bind these to the reviewed revision. */
4
+ details?: Array<{
5
+ label: string;
6
+ value: string;
7
+ }>;
8
+ maxCredits?: number;
3
9
  /** Set by the tool factory from the available confirmation capability. */
4
10
  canConfirm?: boolean;
5
11
  actionId: string;
@@ -14,8 +20,15 @@ export type ActionReview = {
14
20
  export type ActionConfirmation = {
15
21
  actionId: string;
16
22
  expectedRevision: string;
23
+ maxCredits?: number;
17
24
  };
18
25
  export type ActionJob = {
26
+ creditUsage?: {
27
+ workId: string;
28
+ maxCredits: number;
29
+ creditsCharged: number;
30
+ status: "reserved" | "settled";
31
+ };
19
32
  actionId: string;
20
33
  status: "awaiting_approval" | "queued" | "running" | "succeeded" | "failed" | "unknown" | "denied" | "expired";
21
34
  title: string;
@@ -29,7 +42,8 @@ export declare const projectActionJob: (value: unknown) => ActionJob;
29
42
  * Every draft writer must refuse edits after that claim. Never send inline.
30
43
  * Job reads/resume only reattach to saved work, including ambiguous outcomes. */
31
44
  export declare const createActionWorkflowTools: (adapter: {
32
- review: (actionId: string) => Promise<ActionReview>;
45
+ requiresBudget?: boolean;
46
+ review: (actionId: string, maxCredits?: number) => Promise<ActionReview>;
33
47
  job: (actionId: string) => Promise<ActionJob>;
34
48
  confirm?: (request: ActionConfirmation) => Promise<ActionJob>;
35
49
  }) => McpToolRegistry;
package/docs/mcp-apps.md CHANGED
@@ -127,3 +127,31 @@ 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.
145
+
146
+ ### Action-specific approval terms
147
+
148
+ `ActionReview.details` carries bounded, labeled terms such as a calendar's exact
149
+ start/end times, target calendar and conference choice. Both structured/text
150
+ results and the shared review App include every term. Labels and values render
151
+ as text. The adapter must bind these terms to `revision` and use the same terms
152
+ at execution; the App cannot validate a provider-specific action for it.
153
+
154
+ An adapter may return `canConfirm: false` for an individual action even when it
155
+ implements confirmation for other kinds. The factory preserves that restriction
156
+ and still enforces the adapter's general capability and explicit prepaid budget.
157
+ The adapter must independently reject disabled kinds at confirmation time.
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.22.0"
94
94
  }