@absolutejs/agent 0.22.3 → 0.23.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.
@@ -0,0 +1,77 @@
1
+ import { type EffectAdapterCredentialInstallation, type EffectAdapterExecutionEnvelope, type EffectAdapterInstallationRegistry, type EffectStore, type ExecutionSqlClient } from "@absolutejs/execution";
2
+ import type { AgentSpendRequest, SpendRequestResult, SpendMandate } from "@absolutejs/wallet";
3
+ export type AgentPurchaseIntentStatus = "drafted" | "pending_approval" | "mandate_ready" | "installation_ready" | "enqueued" | "cancelled";
4
+ export type AgentPurchaseIntentInput<Payload = unknown> = {
5
+ actionId: string;
6
+ adapterId: string;
7
+ agentId: string;
8
+ allowanceId: string;
9
+ amountMinor: number;
10
+ category?: string;
11
+ credentials?: ReadonlyArray<EffectAdapterCredentialInstallation>;
12
+ currency: string;
13
+ destination?: string;
14
+ effect: string;
15
+ expiresAt: string;
16
+ handler: string;
17
+ idempotencyKey: string;
18
+ installationId: string;
19
+ merchantId: string;
20
+ ownerId: string;
21
+ payload: Payload;
22
+ purchaseId: string;
23
+ refundable?: boolean;
24
+ tenantId: string;
25
+ };
26
+ export type AgentPurchaseIntent<Payload = unknown> = {
27
+ createdAt: number;
28
+ effectId: string;
29
+ envelope: EffectAdapterExecutionEnvelope<Payload>;
30
+ input: AgentPurchaseIntentInput<Payload>;
31
+ inputDigest: string;
32
+ mandate?: Omit<SpendMandate, "signature">;
33
+ mandateId: string;
34
+ status: AgentPurchaseIntentStatus;
35
+ updatedAt: number;
36
+ };
37
+ export type AgentPurchaseIntentStore = {
38
+ get: (tenantId: string, purchaseId: string) => Promise<AgentPurchaseIntent | undefined>;
39
+ getByIdempotencyKey: (tenantId: string, idempotencyKey: string) => Promise<AgentPurchaseIntent | undefined>;
40
+ list: (input: {
41
+ limit: number;
42
+ ownerId?: string;
43
+ status?: AgentPurchaseIntentStatus;
44
+ tenantId?: string;
45
+ }) => Promise<AgentPurchaseIntent[]>;
46
+ save: (intent: AgentPurchaseIntent) => Promise<void>;
47
+ };
48
+ export declare class AgentPurchaseIntentError extends Error {
49
+ }
50
+ export declare const createMemoryAgentPurchaseIntentStore: () => AgentPurchaseIntentStore;
51
+ export declare const agentPurchaseIntentsPostgresSchemaSql: (namespace?: string) => string;
52
+ export declare const createPostgresAgentPurchaseIntentStore: (options: {
53
+ client: ExecutionSqlClient;
54
+ namespace?: string;
55
+ }) => AgentPurchaseIntentStore;
56
+ type PurchaseWallet = {
57
+ cancelSpend: (mandateId: string) => Promise<unknown>;
58
+ requestSpend: (request: AgentSpendRequest, options?: {
59
+ mandateId?: string;
60
+ }) => Promise<SpendRequestResult>;
61
+ };
62
+ export declare const createAgentPurchaseOrchestrator: (options: {
63
+ effects: Pick<EffectStore, "enqueue" | "getByIdempotencyKey">;
64
+ installations: Pick<EffectAdapterInstallationRegistry, "disable" | "enable" | "put">;
65
+ now?: () => number;
66
+ store: AgentPurchaseIntentStore;
67
+ wallet: PurchaseWallet;
68
+ }) => {
69
+ list: (input: {
70
+ limit: number;
71
+ ownerId?: string;
72
+ status?: AgentPurchaseIntentStatus;
73
+ tenantId?: string;
74
+ }) => Promise<AgentPurchaseIntent[]>;
75
+ submit: <Payload>(input: AgentPurchaseIntentInput<Payload>) => Promise<AgentPurchaseIntent<Payload>>;
76
+ };
77
+ export {};
@@ -0,0 +1,246 @@
1
+ // @bun
2
+ // src/commerce.ts
3
+ import {
4
+ effectAdapterExecutionInputDigest
5
+ } from "@absolutejs/execution";
6
+
7
+ class AgentPurchaseIntentError extends Error {
8
+ }
9
+ var keyOf = (tenantId, purchaseId) => `${tenantId}\x00${purchaseId}`;
10
+ var createMemoryAgentPurchaseIntentStore = () => {
11
+ const records = new Map;
12
+ return {
13
+ get: async (tenantId, purchaseId) => {
14
+ const value = records.get(keyOf(tenantId, purchaseId));
15
+ return value ? structuredClone(value) : undefined;
16
+ },
17
+ getByIdempotencyKey: async (tenantId, idempotencyKey) => {
18
+ const value = [...records.values()].find((intent) => intent.input.tenantId === tenantId && intent.input.idempotencyKey === idempotencyKey);
19
+ return value ? structuredClone(value) : undefined;
20
+ },
21
+ list: async (input) => [...records.values()].filter(({ input: intent, status }) => (!input.tenantId || intent.tenantId === input.tenantId) && (!input.ownerId || intent.ownerId === input.ownerId) && (!input.status || status === input.status)).sort((left, right) => right.createdAt - left.createdAt).slice(0, input.limit).map((value) => structuredClone(value)),
22
+ save: async (intent) => {
23
+ const key = keyOf(intent.input.tenantId, intent.input.purchaseId);
24
+ const existing = records.get(key);
25
+ if (existing && existing.inputDigest !== intent.inputDigest)
26
+ throw new AgentPurchaseIntentError("Purchase identity belongs to another immutable request");
27
+ const idempotent = [...records.values()].find(({ input }) => input.tenantId === intent.input.tenantId && input.idempotencyKey === intent.input.idempotencyKey);
28
+ if (idempotent && idempotent.input.purchaseId !== intent.input.purchaseId)
29
+ throw new AgentPurchaseIntentError("Purchase idempotency key belongs to another request");
30
+ records.set(key, structuredClone(intent));
31
+ }
32
+ };
33
+ };
34
+ var namespaceOf = (namespace) => {
35
+ if (!/^[a-z_][a-z0-9_]*$/.test(namespace))
36
+ throw new AgentPurchaseIntentError("Purchase intent namespace must be a simple identifier");
37
+ return namespace;
38
+ };
39
+ var agentPurchaseIntentsPostgresSchemaSql = (namespace = "agent_commerce") => {
40
+ const ns = namespaceOf(namespace);
41
+ return `CREATE SCHEMA IF NOT EXISTS ${ns};
42
+ CREATE TABLE IF NOT EXISTS ${ns}.purchase_intents (
43
+ purchase_id text PRIMARY KEY,
44
+ tenant_id text NOT NULL,
45
+ owner_id text NOT NULL,
46
+ idempotency_key text NOT NULL,
47
+ status text NOT NULL,
48
+ input_digest text NOT NULL,
49
+ data jsonb NOT NULL,
50
+ created_at bigint NOT NULL,
51
+ updated_at bigint NOT NULL,
52
+ UNIQUE (tenant_id, idempotency_key),
53
+ UNIQUE (tenant_id, purchase_id)
54
+ );
55
+ CREATE INDEX IF NOT EXISTS purchase_intents_inventory_idx ON ${ns}.purchase_intents (tenant_id, created_at DESC);
56
+ CREATE INDEX IF NOT EXISTS purchase_intents_owner_idx ON ${ns}.purchase_intents (owner_id, created_at DESC);`;
57
+ };
58
+ var parseRow = (row) => {
59
+ if (!row)
60
+ return;
61
+ return typeof row.data === "string" ? JSON.parse(row.data) : row.data;
62
+ };
63
+ var createPostgresAgentPurchaseIntentStore = (options) => {
64
+ const ns = namespaceOf(options.namespace ?? "agent_commerce");
65
+ return {
66
+ get: async (tenantId, purchaseId) => parseRow((await options.client.query(`SELECT data FROM ${ns}.purchase_intents WHERE tenant_id = $1 AND purchase_id = $2`, [tenantId, purchaseId])).rows[0]),
67
+ getByIdempotencyKey: async (tenantId, idempotencyKey) => parseRow((await options.client.query(`SELECT data FROM ${ns}.purchase_intents WHERE tenant_id = $1 AND idempotency_key = $2`, [tenantId, idempotencyKey])).rows[0]),
68
+ list: async (input) => {
69
+ const clauses = [];
70
+ const values = [];
71
+ if (input.tenantId) {
72
+ values.push(input.tenantId);
73
+ clauses.push(`tenant_id = $${values.length}`);
74
+ }
75
+ if (input.ownerId) {
76
+ values.push(input.ownerId);
77
+ clauses.push(`owner_id = $${values.length}`);
78
+ }
79
+ if (input.status) {
80
+ values.push(input.status);
81
+ clauses.push(`status = $${values.length}`);
82
+ }
83
+ values.push(input.limit);
84
+ const where = clauses.length > 0 ? ` WHERE ${clauses.join(" AND ")}` : "";
85
+ const result = await options.client.query(`SELECT data FROM ${ns}.purchase_intents${where} ORDER BY created_at DESC LIMIT $${values.length}`, values);
86
+ return result.rows.map((row) => parseRow(row));
87
+ },
88
+ save: async (intent) => {
89
+ const result = await options.client.query(`INSERT INTO ${ns}.purchase_intents
90
+ (purchase_id, tenant_id, owner_id, idempotency_key, status, input_digest, data, created_at, updated_at)
91
+ VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb, $8, $9)
92
+ ON CONFLICT (purchase_id) DO UPDATE SET
93
+ status = excluded.status,
94
+ data = excluded.data,
95
+ updated_at = excluded.updated_at
96
+ WHERE ${ns}.purchase_intents.tenant_id = excluded.tenant_id
97
+ AND ${ns}.purchase_intents.input_digest = excluded.input_digest
98
+ AND ${ns}.purchase_intents.idempotency_key = excluded.idempotency_key
99
+ RETURNING purchase_id`, [
100
+ intent.input.purchaseId,
101
+ intent.input.tenantId,
102
+ intent.input.ownerId,
103
+ intent.input.idempotencyKey,
104
+ intent.status,
105
+ intent.inputDigest,
106
+ JSON.stringify(intent),
107
+ intent.createdAt,
108
+ intent.updatedAt
109
+ ]);
110
+ if (result.rows.length !== 1)
111
+ throw new AgentPurchaseIntentError("Purchase identity belongs to another immutable request");
112
+ }
113
+ };
114
+ };
115
+ var createAgentPurchaseOrchestrator = (options) => {
116
+ const now = options.now ?? Date.now;
117
+ const saveStatus = async (intent, status, mandate) => {
118
+ let mandateSummary;
119
+ if (mandate) {
120
+ const { signature, ...summary } = mandate;
121
+ mandateSummary = summary;
122
+ }
123
+ const next = {
124
+ ...intent,
125
+ ...mandateSummary ? { mandate: mandateSummary } : {},
126
+ status,
127
+ updatedAt: now()
128
+ };
129
+ await options.store.save(next);
130
+ return next;
131
+ };
132
+ const submit = async (input) => {
133
+ if (!input.purchaseId.trim() || !input.idempotencyKey.trim())
134
+ throw new AgentPurchaseIntentError("Purchase and idempotency identities are required");
135
+ if (!Number.isSafeInteger(input.amountMinor) || input.amountMinor <= 0)
136
+ throw new AgentPurchaseIntentError("Purchase amount must be positive integer minor units");
137
+ const mandateId = `mandate:purchase:${input.purchaseId}`;
138
+ const effectId = `purchase:${input.purchaseId}`;
139
+ const envelope = {
140
+ currency: input.currency,
141
+ ...input.destination ? { destination: input.destination } : {},
142
+ effect: input.effect,
143
+ installationId: input.installationId,
144
+ mandateId,
145
+ payload: input.payload,
146
+ spendMinor: input.amountMinor
147
+ };
148
+ const inputDigest = await effectAdapterExecutionInputDigest(envelope);
149
+ const existing = await options.store.get(input.tenantId, input.purchaseId);
150
+ const idempotent = await options.store.getByIdempotencyKey(input.tenantId, input.idempotencyKey);
151
+ const prior = existing ?? idempotent;
152
+ if (prior) {
153
+ if (prior.input.purchaseId !== input.purchaseId || prior.inputDigest !== inputDigest)
154
+ throw new AgentPurchaseIntentError("Purchase identity belongs to another immutable request");
155
+ if (prior.status === "enqueued" || prior.status === "cancelled")
156
+ return prior;
157
+ }
158
+ let intent = prior ?? {
159
+ createdAt: now(),
160
+ effectId,
161
+ envelope,
162
+ input,
163
+ inputDigest,
164
+ mandateId,
165
+ status: "drafted",
166
+ updatedAt: now()
167
+ };
168
+ await options.store.save(intent);
169
+ const spendRequest = {
170
+ action: input.effect,
171
+ agentId: input.agentId,
172
+ allowanceId: input.allowanceId,
173
+ amountCents: input.amountMinor,
174
+ cartHash: inputDigest,
175
+ ...input.category ? { category: input.category } : {},
176
+ currency: input.currency,
177
+ expiresAt: input.expiresAt,
178
+ idempotencyKey: `purchase:${input.idempotencyKey}`,
179
+ merchantId: input.merchantId,
180
+ ...input.refundable === undefined ? {} : { refundable: input.refundable }
181
+ };
182
+ const requested = await options.wallet.requestSpend(spendRequest, {
183
+ mandateId
184
+ });
185
+ if (requested.mandate.status === "pending_approval")
186
+ return await saveStatus(intent, "pending_approval", requested.mandate);
187
+ if (requested.mandate.status !== "active")
188
+ throw new AgentPurchaseIntentError(`Purchase mandate is ${requested.mandate.status}`);
189
+ intent = await saveStatus(intent, "mandate_ready", requested.mandate);
190
+ await options.installations.put({
191
+ adapterId: input.adapterId,
192
+ installationId: input.installationId,
193
+ policy: {
194
+ credentials: input.credentials ?? [],
195
+ destinations: input.destination ? [input.destination] : [],
196
+ effects: [input.effect],
197
+ spend: {
198
+ currency: input.currency,
199
+ mandateId,
200
+ maxMinorPerEffect: input.amountMinor
201
+ }
202
+ },
203
+ tenantId: input.tenantId
204
+ });
205
+ await options.installations.enable(input.tenantId, input.installationId);
206
+ intent = await saveStatus(intent, "installation_ready");
207
+ const timestamp = now();
208
+ const effect = {
209
+ actionId: input.actionId,
210
+ attempts: 0,
211
+ availableAt: timestamp,
212
+ createdAt: timestamp,
213
+ effectId,
214
+ handler: input.handler,
215
+ idempotencyKey: `purchase:${input.idempotencyKey}`,
216
+ input: envelope,
217
+ inputDigest,
218
+ status: "pending",
219
+ tenantId: input.tenantId,
220
+ updatedAt: timestamp
221
+ };
222
+ if (!await options.effects.enqueue(effect)) {
223
+ const duplicate = await options.effects.getByIdempotencyKey(input.tenantId, effect.idempotencyKey);
224
+ if (!duplicate || duplicate.effectId !== effect.effectId || duplicate.inputDigest !== effect.inputDigest) {
225
+ await options.installations.disable(input.tenantId, input.installationId);
226
+ await options.wallet.cancelSpend(mandateId);
227
+ throw new AgentPurchaseIntentError("Purchase effect idempotency key belongs to another request");
228
+ }
229
+ }
230
+ return await saveStatus(intent, "enqueued");
231
+ };
232
+ return {
233
+ list: options.store.list,
234
+ submit
235
+ };
236
+ };
237
+ export {
238
+ createPostgresAgentPurchaseIntentStore,
239
+ createMemoryAgentPurchaseIntentStore,
240
+ createAgentPurchaseOrchestrator,
241
+ agentPurchaseIntentsPostgresSchemaSql,
242
+ AgentPurchaseIntentError
243
+ };
244
+
245
+ //# debugId=F297EAB59F6D4D2764756E2164756E21
246
+ //# sourceMappingURL=commerce.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/commerce.ts"],
4
+ "sourcesContent": [
5
+ "import {\n effectAdapterExecutionInputDigest,\n type EffectAdapterCredentialInstallation,\n type EffectAdapterExecutionEnvelope,\n type EffectAdapterInstallationRegistry,\n type EffectRecord,\n type EffectStore,\n type ExecutionSqlClient,\n} from \"@absolutejs/execution\";\nimport type {\n AgentSpendRequest,\n SpendRequestResult,\n SpendMandate,\n} from \"@absolutejs/wallet\";\n\nexport type AgentPurchaseIntentStatus =\n | \"drafted\"\n | \"pending_approval\"\n | \"mandate_ready\"\n | \"installation_ready\"\n | \"enqueued\"\n | \"cancelled\";\n\nexport type AgentPurchaseIntentInput<Payload = unknown> = {\n actionId: string;\n adapterId: string;\n agentId: string;\n allowanceId: string;\n amountMinor: number;\n category?: string;\n credentials?: ReadonlyArray<EffectAdapterCredentialInstallation>;\n currency: string;\n destination?: string;\n effect: string;\n expiresAt: string;\n handler: string;\n idempotencyKey: string;\n installationId: string;\n merchantId: string;\n ownerId: string;\n payload: Payload;\n purchaseId: string;\n refundable?: boolean;\n tenantId: string;\n};\n\nexport type AgentPurchaseIntent<Payload = unknown> = {\n createdAt: number;\n effectId: string;\n envelope: EffectAdapterExecutionEnvelope<Payload>;\n input: AgentPurchaseIntentInput<Payload>;\n inputDigest: string;\n mandate?: Omit<SpendMandate, \"signature\">;\n mandateId: string;\n status: AgentPurchaseIntentStatus;\n updatedAt: number;\n};\n\nexport type AgentPurchaseIntentStore = {\n get: (\n tenantId: string,\n purchaseId: string,\n ) => Promise<AgentPurchaseIntent | undefined>;\n getByIdempotencyKey: (\n tenantId: string,\n idempotencyKey: string,\n ) => Promise<AgentPurchaseIntent | undefined>;\n list: (input: {\n limit: number;\n ownerId?: string;\n status?: AgentPurchaseIntentStatus;\n tenantId?: string;\n }) => Promise<AgentPurchaseIntent[]>;\n save: (intent: AgentPurchaseIntent) => Promise<void>;\n};\n\nexport class AgentPurchaseIntentError extends Error {}\n\nconst keyOf = (tenantId: string, purchaseId: string) =>\n `${tenantId}\\u0000${purchaseId}`;\n\nexport const createMemoryAgentPurchaseIntentStore =\n (): AgentPurchaseIntentStore => {\n const records = new Map<string, AgentPurchaseIntent>();\n return {\n get: async (tenantId, purchaseId) => {\n const value = records.get(keyOf(tenantId, purchaseId));\n return value ? structuredClone(value) : undefined;\n },\n getByIdempotencyKey: async (tenantId, idempotencyKey) => {\n const value = [...records.values()].find(\n (intent) =>\n intent.input.tenantId === tenantId &&\n intent.input.idempotencyKey === idempotencyKey,\n );\n return value ? structuredClone(value) : undefined;\n },\n list: async (input) =>\n [...records.values()]\n .filter(\n ({ input: intent, status }) =>\n (!input.tenantId || intent.tenantId === input.tenantId) &&\n (!input.ownerId || intent.ownerId === input.ownerId) &&\n (!input.status || status === input.status),\n )\n .sort((left, right) => right.createdAt - left.createdAt)\n .slice(0, input.limit)\n .map((value) => structuredClone(value)),\n save: async (intent) => {\n const key = keyOf(intent.input.tenantId, intent.input.purchaseId);\n const existing = records.get(key);\n if (existing && existing.inputDigest !== intent.inputDigest)\n throw new AgentPurchaseIntentError(\n \"Purchase identity belongs to another immutable request\",\n );\n const idempotent = [...records.values()].find(\n ({ input }) =>\n input.tenantId === intent.input.tenantId &&\n input.idempotencyKey === intent.input.idempotencyKey,\n );\n if (\n idempotent &&\n idempotent.input.purchaseId !== intent.input.purchaseId\n )\n throw new AgentPurchaseIntentError(\n \"Purchase idempotency key belongs to another request\",\n );\n records.set(key, structuredClone(intent));\n },\n };\n };\n\nconst namespaceOf = (namespace: string) => {\n if (!/^[a-z_][a-z0-9_]*$/.test(namespace))\n throw new AgentPurchaseIntentError(\n \"Purchase intent namespace must be a simple identifier\",\n );\n return namespace;\n};\n\nexport const agentPurchaseIntentsPostgresSchemaSql = (\n namespace = \"agent_commerce\",\n) => {\n const ns = namespaceOf(namespace);\n return `CREATE SCHEMA IF NOT EXISTS ${ns};\nCREATE TABLE IF NOT EXISTS ${ns}.purchase_intents (\n purchase_id text PRIMARY KEY,\n tenant_id text NOT NULL,\n owner_id text NOT NULL,\n idempotency_key text NOT NULL,\n status text NOT NULL,\n input_digest text NOT NULL,\n data jsonb NOT NULL,\n created_at bigint NOT NULL,\n updated_at bigint NOT NULL,\n UNIQUE (tenant_id, idempotency_key),\n UNIQUE (tenant_id, purchase_id)\n);\nCREATE INDEX IF NOT EXISTS purchase_intents_inventory_idx ON ${ns}.purchase_intents (tenant_id, created_at DESC);\nCREATE INDEX IF NOT EXISTS purchase_intents_owner_idx ON ${ns}.purchase_intents (owner_id, created_at DESC);`;\n};\n\ntype AgentPurchaseIntentRow = { data: AgentPurchaseIntent | string };\nconst parseRow = (row: AgentPurchaseIntentRow | undefined) => {\n if (!row) return undefined;\n return (\n typeof row.data === \"string\" ? JSON.parse(row.data) : row.data\n ) as AgentPurchaseIntent;\n};\n\nexport const createPostgresAgentPurchaseIntentStore = (options: {\n client: ExecutionSqlClient;\n namespace?: string;\n}): AgentPurchaseIntentStore => {\n const ns = namespaceOf(options.namespace ?? \"agent_commerce\");\n return {\n get: async (tenantId, purchaseId) =>\n parseRow(\n (\n await options.client.query<AgentPurchaseIntentRow>(\n `SELECT data FROM ${ns}.purchase_intents WHERE tenant_id = $1 AND purchase_id = $2`,\n [tenantId, purchaseId],\n )\n ).rows[0],\n ),\n getByIdempotencyKey: async (tenantId, idempotencyKey) =>\n parseRow(\n (\n await options.client.query<AgentPurchaseIntentRow>(\n `SELECT data FROM ${ns}.purchase_intents WHERE tenant_id = $1 AND idempotency_key = $2`,\n [tenantId, idempotencyKey],\n )\n ).rows[0],\n ),\n list: async (input) => {\n const clauses: string[] = [];\n const values: unknown[] = [];\n if (input.tenantId) {\n values.push(input.tenantId);\n clauses.push(`tenant_id = $${values.length}`);\n }\n if (input.ownerId) {\n values.push(input.ownerId);\n clauses.push(`owner_id = $${values.length}`);\n }\n if (input.status) {\n values.push(input.status);\n clauses.push(`status = $${values.length}`);\n }\n values.push(input.limit);\n const where = clauses.length > 0 ? ` WHERE ${clauses.join(\" AND \")}` : \"\";\n const result = await options.client.query<AgentPurchaseIntentRow>(\n `SELECT data FROM ${ns}.purchase_intents${where} ORDER BY created_at DESC LIMIT $${values.length}`,\n values,\n );\n return result.rows.map((row) => parseRow(row)!);\n },\n save: async (intent) => {\n const result = await options.client.query<{ purchase_id: string }>(\n `INSERT INTO ${ns}.purchase_intents\n (purchase_id, tenant_id, owner_id, idempotency_key, status, input_digest, data, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb, $8, $9)\n ON CONFLICT (purchase_id) DO UPDATE SET\n status = excluded.status,\n data = excluded.data,\n updated_at = excluded.updated_at\n WHERE ${ns}.purchase_intents.tenant_id = excluded.tenant_id\n AND ${ns}.purchase_intents.input_digest = excluded.input_digest\n AND ${ns}.purchase_intents.idempotency_key = excluded.idempotency_key\n RETURNING purchase_id`,\n [\n intent.input.purchaseId,\n intent.input.tenantId,\n intent.input.ownerId,\n intent.input.idempotencyKey,\n intent.status,\n intent.inputDigest,\n JSON.stringify(intent),\n intent.createdAt,\n intent.updatedAt,\n ],\n );\n if (result.rows.length !== 1)\n throw new AgentPurchaseIntentError(\n \"Purchase identity belongs to another immutable request\",\n );\n },\n };\n};\n\ntype PurchaseWallet = {\n cancelSpend: (mandateId: string) => Promise<unknown>;\n requestSpend: (\n request: AgentSpendRequest,\n options?: { mandateId?: string },\n ) => Promise<SpendRequestResult>;\n};\n\nexport const createAgentPurchaseOrchestrator = (options: {\n effects: Pick<EffectStore, \"enqueue\" | \"getByIdempotencyKey\">;\n installations: Pick<\n EffectAdapterInstallationRegistry,\n \"disable\" | \"enable\" | \"put\"\n >;\n now?: () => number;\n store: AgentPurchaseIntentStore;\n wallet: PurchaseWallet;\n}) => {\n const now = options.now ?? Date.now;\n\n const saveStatus = async (\n intent: AgentPurchaseIntent,\n status: AgentPurchaseIntentStatus,\n mandate?: SpendMandate,\n ) => {\n let mandateSummary: Omit<SpendMandate, \"signature\"> | undefined;\n if (mandate) {\n const { signature, ...summary } = mandate;\n void signature;\n mandateSummary = summary;\n }\n const next: AgentPurchaseIntent = {\n ...intent,\n ...(mandateSummary ? { mandate: mandateSummary } : {}),\n status,\n updatedAt: now(),\n };\n await options.store.save(next);\n return next;\n };\n\n const submit = async <Payload>(\n input: AgentPurchaseIntentInput<Payload>,\n ): Promise<AgentPurchaseIntent<Payload>> => {\n if (!input.purchaseId.trim() || !input.idempotencyKey.trim())\n throw new AgentPurchaseIntentError(\n \"Purchase and idempotency identities are required\",\n );\n if (!Number.isSafeInteger(input.amountMinor) || input.amountMinor <= 0)\n throw new AgentPurchaseIntentError(\n \"Purchase amount must be positive integer minor units\",\n );\n const mandateId = `mandate:purchase:${input.purchaseId}`;\n const effectId = `purchase:${input.purchaseId}`;\n const envelope: EffectAdapterExecutionEnvelope<Payload> = {\n currency: input.currency,\n ...(input.destination ? { destination: input.destination } : {}),\n effect: input.effect,\n installationId: input.installationId,\n mandateId,\n payload: input.payload,\n spendMinor: input.amountMinor,\n };\n const inputDigest = await effectAdapterExecutionInputDigest(envelope);\n const existing = await options.store.get(input.tenantId, input.purchaseId);\n const idempotent = await options.store.getByIdempotencyKey(\n input.tenantId,\n input.idempotencyKey,\n );\n const prior = existing ?? idempotent;\n if (prior) {\n if (\n prior.input.purchaseId !== input.purchaseId ||\n prior.inputDigest !== inputDigest\n )\n throw new AgentPurchaseIntentError(\n \"Purchase identity belongs to another immutable request\",\n );\n if (prior.status === \"enqueued\" || prior.status === \"cancelled\")\n return prior as AgentPurchaseIntent<Payload>;\n }\n let intent = (prior ?? {\n createdAt: now(),\n effectId,\n envelope,\n input,\n inputDigest,\n mandateId,\n status: \"drafted\" as const,\n updatedAt: now(),\n }) as AgentPurchaseIntent<Payload>;\n await options.store.save(intent);\n\n const spendRequest: AgentSpendRequest = {\n action: input.effect,\n agentId: input.agentId,\n allowanceId: input.allowanceId,\n amountCents: input.amountMinor,\n cartHash: inputDigest,\n ...(input.category ? { category: input.category } : {}),\n currency: input.currency,\n expiresAt: input.expiresAt,\n idempotencyKey: `purchase:${input.idempotencyKey}`,\n merchantId: input.merchantId,\n ...(input.refundable === undefined\n ? {}\n : { refundable: input.refundable }),\n };\n const requested = await options.wallet.requestSpend(spendRequest, {\n mandateId,\n });\n if (requested.mandate.status === \"pending_approval\")\n return (await saveStatus(\n intent,\n \"pending_approval\",\n requested.mandate,\n )) as AgentPurchaseIntent<Payload>;\n if (requested.mandate.status !== \"active\")\n throw new AgentPurchaseIntentError(\n `Purchase mandate is ${requested.mandate.status}`,\n );\n intent = (await saveStatus(\n intent,\n \"mandate_ready\",\n requested.mandate,\n )) as AgentPurchaseIntent<Payload>;\n\n await options.installations.put({\n adapterId: input.adapterId,\n installationId: input.installationId,\n policy: {\n credentials: input.credentials ?? [],\n destinations: input.destination ? [input.destination] : [],\n effects: [input.effect],\n spend: {\n currency: input.currency,\n mandateId,\n maxMinorPerEffect: input.amountMinor,\n },\n },\n tenantId: input.tenantId,\n });\n await options.installations.enable(input.tenantId, input.installationId);\n intent = (await saveStatus(\n intent,\n \"installation_ready\",\n )) as AgentPurchaseIntent<Payload>;\n\n const timestamp = now();\n const effect: EffectRecord = {\n actionId: input.actionId,\n attempts: 0,\n availableAt: timestamp,\n createdAt: timestamp,\n effectId,\n handler: input.handler,\n idempotencyKey: `purchase:${input.idempotencyKey}`,\n input: envelope,\n inputDigest,\n status: \"pending\",\n tenantId: input.tenantId,\n updatedAt: timestamp,\n };\n if (!(await options.effects.enqueue(effect))) {\n const duplicate = await options.effects.getByIdempotencyKey(\n input.tenantId,\n effect.idempotencyKey,\n );\n if (\n !duplicate ||\n duplicate.effectId !== effect.effectId ||\n duplicate.inputDigest !== effect.inputDigest\n ) {\n await options.installations.disable(\n input.tenantId,\n input.installationId,\n );\n await options.wallet.cancelSpend(mandateId);\n throw new AgentPurchaseIntentError(\n \"Purchase effect idempotency key belongs to another request\",\n );\n }\n }\n return (await saveStatus(\n intent,\n \"enqueued\",\n )) as AgentPurchaseIntent<Payload>;\n };\n\n return {\n list: options.store.list,\n submit,\n };\n};\n"
6
+ ],
7
+ "mappings": ";;AAAA;AAAA;AAAA;AAAA;AA4EO,MAAM,iCAAiC,MAAM;AAAC;AAErD,IAAM,QAAQ,CAAC,UAAkB,eAC/B,GAAG,eAAiB;AAEf,IAAM,uCACX,MAAgC;AAAA,EAC9B,MAAM,UAAU,IAAI;AAAA,EACpB,OAAO;AAAA,IACL,KAAK,OAAO,UAAU,eAAe;AAAA,MACnC,MAAM,QAAQ,QAAQ,IAAI,MAAM,UAAU,UAAU,CAAC;AAAA,MACrD,OAAO,QAAQ,gBAAgB,KAAK,IAAI;AAAA;AAAA,IAE1C,qBAAqB,OAAO,UAAU,mBAAmB;AAAA,MACvD,MAAM,QAAQ,CAAC,GAAG,QAAQ,OAAO,CAAC,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A,IAAI,CAAE,MAAM,QAAQ,QAAQ,QAAQ,MAAM,GAAI;AAAA,MAC5C,MAAM,YAAY,MAAM,QAAQ,QAAQ,oBACtC,MAAM,UACN,OAAO,cACT;AAAA,MACA,IACE,CAAC,aACD,UAAU,aAAa,OAAO,YAC9B,UAAU,gBAAgB,OAAO,aACjC;AAAA,QACA,MAAM,QAAQ,cAAc,QAC1B,MAAM,UACN,MAAM,cACR;AAAA,QACA,MAAM,QAAQ,OAAO,YAAY,SAAS;AAAA,QAC1C,MAAM,IAAI,yBACR,4DACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,OAAQ,MAAM,WACZ,QACA,UACF;AAAA;AAAA,EAGF,OAAO;AAAA,IACL,MAAM,QAAQ,MAAM;AAAA,IACpB;AAAA,EACF;AAAA;",
8
+ "debugId": "F297EAB59F6D4D2764756E2164756E21",
9
+ "names": []
10
+ }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const AGENT_STACK_PACKAGES: {
3
3
  readonly actions: "@absolutejs/agency";
4
4
  readonly auth: "@absolutejs/auth";
5
5
  readonly conformance: "@absolutejs/agent-conformance";
6
+ readonly commerce: "@absolutejs/agent/commerce";
6
7
  readonly control: "@absolutejs/agent-control";
7
8
  readonly discovery: "@absolutejs/agent-discovery";
8
9
  readonly execution: "@absolutejs/execution";
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ var AGENT_STACK_PACKAGES = {
5
5
  actions: "@absolutejs/agency",
6
6
  auth: "@absolutejs/auth",
7
7
  conformance: "@absolutejs/agent-conformance",
8
+ commerce: "@absolutejs/agent/commerce",
8
9
  control: "@absolutejs/agent-control",
9
10
  discovery: "@absolutejs/agent-discovery",
10
11
  execution: "@absolutejs/execution",
@@ -75,5 +76,5 @@ export {
75
76
  AGENT_STACK_PACKAGES
76
77
  };
77
78
 
78
- //# debugId=5BFDDCA85E68177464756E2164756E21
79
+ //# debugId=7D0FD7A8890B50CE64756E2164756E21
79
80
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": [
5
- "export const AGENT_STACK_PACKAGES = {\n a2a: \"@absolutejs/a2a\",\n actions: \"@absolutejs/agency\",\n auth: \"@absolutejs/auth\",\n conformance: \"@absolutejs/agent-conformance\",\n control: \"@absolutejs/agent-control\",\n discovery: \"@absolutejs/agent-discovery\",\n execution: \"@absolutejs/execution\",\n inbox: \"@absolutejs/agent-inbox\",\n mcp: \"@absolutejs/mcp\",\n memory: \"@absolutejs/agent-memory\",\n policy: \"@absolutejs/policy\",\n runtime: \"@absolutejs/agent-runtime\",\n sandbox: \"@absolutejs/agent-sandbox\",\n trust: \"@absolutejs/agent-trust\",\n wallet: \"@absolutejs/wallet\",\n} as const;\n\nexport const PRODUCTION_AGENT_CAPABILITIES = [\n \"identity\",\n \"authorization\",\n \"durability\",\n \"sandbox\",\n \"trust\",\n \"memory\",\n \"triggers\",\n \"discovery\",\n \"interoperability\",\n \"spend\",\n \"operations\",\n \"conformance\",\n] as const;\n\nexport type ProductionAgentCapability =\n (typeof PRODUCTION_AGENT_CAPABILITIES)[number];\n\nexport type AgentStackComponent<Instance = unknown> = {\n capability: ProductionAgentCapability;\n instance: Instance;\n name: string;\n productionReady?: () => boolean | Promise<boolean>;\n};\n\nexport type AgentStack<Components extends readonly AgentStackComponent[]> = {\n components: Components;\n get: <Name extends Components[number][\"name\"]>(\n name: Name,\n ) => Extract<Components[number], { name: Name }>[\"instance\"];\n readiness: () => Promise<AgentStackReadiness>;\n};\n\nexport type AgentStackReadiness = {\n capabilities: Record<ProductionAgentCapability, boolean>;\n missing: ProductionAgentCapability[];\n ready: boolean;\n};\n\nconst readinessOf = async (\n components: readonly AgentStackComponent[],\n): Promise<AgentStackReadiness> => {\n const capabilities = Object.fromEntries(\n PRODUCTION_AGENT_CAPABILITIES.map((capability) => [capability, false]),\n ) as Record<ProductionAgentCapability, boolean>;\n for (const component of components) {\n if ((await component.productionReady?.()) === false) continue;\n capabilities[component.capability] = true;\n }\n const missing = PRODUCTION_AGENT_CAPABILITIES.filter(\n (capability) => !capabilities[capability],\n );\n\n return { capabilities, missing, ready: missing.length === 0 };\n};\n\nexport const defineAgentStack = <\n const Components extends readonly AgentStackComponent[],\n>(\n components: Components,\n): AgentStack<Components> => {\n const names = new Set<string>();\n for (const component of components) {\n if (names.has(component.name)) {\n throw new Error(`Duplicate agent stack component: ${component.name}`);\n }\n names.add(component.name);\n }\n\n return {\n components,\n get: (name) => {\n const component = components.find((candidate) => candidate.name === name);\n if (component === undefined) {\n throw new Error(`Unknown agent stack component: ${String(name)}`);\n }\n\n return component.instance as Extract<\n Components[number],\n { name: typeof name }\n >[\"instance\"];\n },\n readiness: () => readinessOf(components),\n };\n};\n\nexport const assertProductionReady = async (\n stack: Pick<AgentStack<readonly AgentStackComponent[]>, \"readiness\">,\n) => {\n const readiness = await stack.readiness();\n if (!readiness.ready) {\n throw new Error(\n `Agent stack is missing production capabilities: ${readiness.missing.join(\", \")}`,\n );\n }\n\n return readiness;\n};\n"
5
+ "export const AGENT_STACK_PACKAGES = {\n a2a: \"@absolutejs/a2a\",\n actions: \"@absolutejs/agency\",\n auth: \"@absolutejs/auth\",\n conformance: \"@absolutejs/agent-conformance\",\n commerce: \"@absolutejs/agent/commerce\",\n control: \"@absolutejs/agent-control\",\n discovery: \"@absolutejs/agent-discovery\",\n execution: \"@absolutejs/execution\",\n inbox: \"@absolutejs/agent-inbox\",\n mcp: \"@absolutejs/mcp\",\n memory: \"@absolutejs/agent-memory\",\n policy: \"@absolutejs/policy\",\n runtime: \"@absolutejs/agent-runtime\",\n sandbox: \"@absolutejs/agent-sandbox\",\n trust: \"@absolutejs/agent-trust\",\n wallet: \"@absolutejs/wallet\",\n} as const;\n\nexport const PRODUCTION_AGENT_CAPABILITIES = [\n \"identity\",\n \"authorization\",\n \"durability\",\n \"sandbox\",\n \"trust\",\n \"memory\",\n \"triggers\",\n \"discovery\",\n \"interoperability\",\n \"spend\",\n \"operations\",\n \"conformance\",\n] as const;\n\nexport type ProductionAgentCapability =\n (typeof PRODUCTION_AGENT_CAPABILITIES)[number];\n\nexport type AgentStackComponent<Instance = unknown> = {\n capability: ProductionAgentCapability;\n instance: Instance;\n name: string;\n productionReady?: () => boolean | Promise<boolean>;\n};\n\nexport type AgentStack<Components extends readonly AgentStackComponent[]> = {\n components: Components;\n get: <Name extends Components[number][\"name\"]>(\n name: Name,\n ) => Extract<Components[number], { name: Name }>[\"instance\"];\n readiness: () => Promise<AgentStackReadiness>;\n};\n\nexport type AgentStackReadiness = {\n capabilities: Record<ProductionAgentCapability, boolean>;\n missing: ProductionAgentCapability[];\n ready: boolean;\n};\n\nconst readinessOf = async (\n components: readonly AgentStackComponent[],\n): Promise<AgentStackReadiness> => {\n const capabilities = Object.fromEntries(\n PRODUCTION_AGENT_CAPABILITIES.map((capability) => [capability, false]),\n ) as Record<ProductionAgentCapability, boolean>;\n for (const component of components) {\n if ((await component.productionReady?.()) === false) continue;\n capabilities[component.capability] = true;\n }\n const missing = PRODUCTION_AGENT_CAPABILITIES.filter(\n (capability) => !capabilities[capability],\n );\n\n return { capabilities, missing, ready: missing.length === 0 };\n};\n\nexport const defineAgentStack = <\n const Components extends readonly AgentStackComponent[],\n>(\n components: Components,\n): AgentStack<Components> => {\n const names = new Set<string>();\n for (const component of components) {\n if (names.has(component.name)) {\n throw new Error(`Duplicate agent stack component: ${component.name}`);\n }\n names.add(component.name);\n }\n\n return {\n components,\n get: (name) => {\n const component = components.find((candidate) => candidate.name === name);\n if (component === undefined) {\n throw new Error(`Unknown agent stack component: ${String(name)}`);\n }\n\n return component.instance as Extract<\n Components[number],\n { name: typeof name }\n >[\"instance\"];\n },\n readiness: () => readinessOf(components),\n };\n};\n\nexport const assertProductionReady = async (\n stack: Pick<AgentStack<readonly AgentStackComponent[]>, \"readiness\">,\n) => {\n const readiness = await stack.readiness();\n if (!readiness.ready) {\n throw new Error(\n `Agent stack is missing production capabilities: ${readiness.missing.join(\", \")}`,\n );\n }\n\n return readiness;\n};\n"
6
6
  ],
7
- "mappings": ";;AAAO,IAAM,uBAAuB;AAAA,EAClC,KAAK;AAAA,EACL,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS;AAAA,EACT,WAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,QAAQ;AACV;AAEO,IAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA0BA,IAAM,cAAc,OAClB,eACiC;AAAA,EACjC,MAAM,eAAe,OAAO,YAC1B,8BAA8B,IAAI,CAAC,eAAe,CAAC,YAAY,KAAK,CAAC,CACvE;AAAA,EACA,WAAW,aAAa,YAAY;AAAA,IAClC,IAAK,MAAM,UAAU,kBAAkB,MAAO;AAAA,MAAO;AAAA,IACrD,aAAa,UAAU,cAAc;AAAA,EACvC;AAAA,EACA,MAAM,UAAU,8BAA8B,OAC5C,CAAC,eAAe,CAAC,aAAa,WAChC;AAAA,EAEA,OAAO,EAAE,cAAc,SAAS,OAAO,QAAQ,WAAW,EAAE;AAAA;AAGvD,IAAM,mBAAmB,CAG9B,eAC2B;AAAA,EAC3B,MAAM,QAAQ,IAAI;AAAA,EAClB,WAAW,aAAa,YAAY;AAAA,IAClC,IAAI,MAAM,IAAI,UAAU,IAAI,GAAG;AAAA,MAC7B,MAAM,IAAI,MAAM,oCAAoC,UAAU,MAAM;AAAA,IACtE;AAAA,IACA,MAAM,IAAI,UAAU,IAAI;AAAA,EAC1B;AAAA,EAEA,OAAO;AAAA,IACL;AAAA,IACA,KAAK,CAAC,SAAS;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ACA,MAAM,UAAU,8BAA8B,OAC5C,CAAC,eAAe,CAAC,aAAa,WAChC;AAAA,EAEA,OAAO,EAAE,cAAc,SAAS,OAAO,QAAQ,WAAW,EAAE;AAAA;AAGvD,IAAM,mBAAmB,CAG9B,eAC2B;AAAA,EAC3B,MAAM,QAAQ,IAAI;AAAA,EAClB,WAAW,aAAa,YAAY;AAAA,IAClC,IAAI,MAAM,IAAI,UAAU,IAAI,GAAG;AAAA,MAC7B,MAAM,IAAI,MAAM,oCAAoC,UAAU,MAAM;AAAA,IACtE;AAAA,IACA,MAAM,IAAI,UAAU,IAAI;AAAA,EAC1B;AAAA,EAEA,OAAO;AAAA,IACL;AAAA,IACA,KAAK,CAAC,SAAS;AAAA,MACb,MAAM,YAAY,WAAW,KAAK,CAAC,cAAc,UAAU,SAAS,IAAI;AAAA,MACxE,IAAI,cAAc,WAAW;AAAA,QAC3B,MAAM,IAAI,MAAM,kCAAkC,OAAO,IAAI,GAAG;AAAA,MAClE;AAAA,MAEA,OAAO,UAAU;AAAA;AAAA,IAKnB,WAAW,MAAM,YAAY,UAAU;AAAA,EACzC;AAAA;AAGK,IAAM,wBAAwB,OACnC,UACG;AAAA,EACH,MAAM,YAAY,MAAM,MAAM,UAAU;AAAA,EACxC,IAAI,CAAC,UAAU,OAAO;AAAA,IACpB,MAAM,IAAI,MACR,mDAAmD,UAAU,QAAQ,KAAK,IAAI,GAChF;AAAA,EACF;AAAA,EAEA,OAAO;AAAA;",
8
+ "debugId": "7D0FD7A8890B50CE64756E2164756E21",
9
9
  "names": []
10
10
  }
package/dist/manifest.js CHANGED
@@ -10,7 +10,8 @@ var manifest = defineManifest()({
10
10
  intents: [
11
11
  "build an agent-first application",
12
12
  "audit an agent stack",
13
- "compose agent infrastructure"
13
+ "compose agent infrastructure",
14
+ "orchestrate a durable agent purchase"
14
15
  ],
15
16
  keywords: [
16
17
  "agents",
@@ -18,7 +19,8 @@ var manifest = defineManifest()({
18
19
  "identity",
19
20
  "orchestration",
20
21
  "security",
21
- "interoperability"
22
+ "interoperability",
23
+ "commerce"
22
24
  ],
23
25
  protocols: ["OAuth 2.0", "MCP", "A2A 1.0", "Arazzo 1.1", "WebMCP"]
24
26
  },
@@ -77,5 +79,5 @@ export {
77
79
  manifest
78
80
  };
79
81
 
80
- //# debugId=D17F69DEA5E7DCF964756E2164756E21
82
+ //# debugId=419D832CDDB84C0964756E2164756E21
81
83
  //# sourceMappingURL=manifest.js.map
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/manifest.ts"],
4
4
  "sourcesContent": [
5
- "import { defineManifest, toolFactory } from \"@absolutejs/manifest\";\nimport { Type } from \"@sinclair/typebox\";\n\nconst tool = toolFactory<never>();\n\nexport const manifest = defineManifest<Record<string, never>, never>()({\n contract: 2,\n discovery: {\n audiences: [\"agent-hosts\", \"application-developers\"],\n intents: [\n \"build an agent-first application\",\n \"audit an agent stack\",\n \"compose agent infrastructure\",\n ],\n keywords: [\n \"agents\",\n \"absolutejs\",\n \"identity\",\n \"orchestration\",\n \"security\",\n \"interoperability\",\n ],\n protocols: [\"OAuth 2.0\", \"MCP\", \"A2A 1.0\", \"Arazzo 1.1\", \"WebMCP\"],\n },\n identity: {\n accent: \"#111827\",\n category: \"ai\",\n description:\n \"The discoverable production agent stack for AbsoluteJS: auth.md identity and delegation, policy-gated actions, certified tenant-scoped effect adapters, durable execution, sandboxing, trust, memory, triggers, MCP, A2A, Arazzo, WebMCP, spend controls, operations, and conformance.\",\n docsUrl: \"https://github.com/absolutejs/agent\",\n name: \"@absolutejs/agent\",\n tagline: \"Build agents that can safely act, persist, pay, and be found.\",\n },\n settings: Type.Object({}),\n tools: {\n inspect_agent_stack: tool.workspace({\n annotations: { readOnlyHint: true },\n capabilities: [\"read\", \"glob\"],\n description:\n \"Inspect an AbsoluteJS project for the production agent stack and report missing safety or discoverability packages.\",\n input: Type.Object({}),\n handler: async (_input, workspace) => {\n const packageFiles = (await workspace.glob?.(\"**/package.json\")) ?? [];\n const packageFile = packageFiles.find(\n (file) => !file.includes(\"node_modules\"),\n );\n if (packageFile === undefined) return \"No package.json found.\";\n const source = (await workspace.read(packageFile)) ?? \"\";\n if (source.includes('\"@absolutejs/agent\"')) {\n return \"The @absolutejs/agent production stack is installed.\";\n }\n const expected = [\n \"@absolutejs/auth\",\n \"@absolutejs/agency\",\n \"@absolutejs/agent-runtime\",\n \"@absolutejs/agent-sandbox\",\n \"@absolutejs/agent-trust\",\n \"@absolutejs/agent-discovery\",\n \"@absolutejs/agent-conformance\",\n ];\n const missing = expected.filter((name) => !source.includes(name));\n\n return missing.length === 0\n ? \"Core production agent packages are present.\"\n : `Missing production agent packages: ${missing.join(\", \")}`;\n },\n }),\n },\n wiring: [\n {\n description:\n \"Import the typed stack composer and add each production capability explicitly.\",\n id: \"default\",\n server: {\n code: \"defineAgentStack([])\",\n imports: [{ from: \"@absolutejs/agent\", names: [\"defineAgentStack\"] }],\n placement: \"module-scope\",\n },\n title: \"Production agent stack\",\n },\n ],\n});\n"
5
+ "import { defineManifest, toolFactory } from \"@absolutejs/manifest\";\nimport { Type } from \"@sinclair/typebox\";\n\nconst tool = toolFactory<never>();\n\nexport const manifest = defineManifest<Record<string, never>, never>()({\n contract: 2,\n discovery: {\n audiences: [\"agent-hosts\", \"application-developers\"],\n intents: [\n \"build an agent-first application\",\n \"audit an agent stack\",\n \"compose agent infrastructure\",\n \"orchestrate a durable agent purchase\",\n ],\n keywords: [\n \"agents\",\n \"absolutejs\",\n \"identity\",\n \"orchestration\",\n \"security\",\n \"interoperability\",\n \"commerce\",\n ],\n protocols: [\"OAuth 2.0\", \"MCP\", \"A2A 1.0\", \"Arazzo 1.1\", \"WebMCP\"],\n },\n identity: {\n accent: \"#111827\",\n category: \"ai\",\n description:\n \"The discoverable production agent stack for AbsoluteJS: auth.md identity and delegation, policy-gated actions, certified tenant-scoped effect adapters, durable execution, sandboxing, trust, memory, triggers, MCP, A2A, Arazzo, WebMCP, spend controls, operations, and conformance.\",\n docsUrl: \"https://github.com/absolutejs/agent\",\n name: \"@absolutejs/agent\",\n tagline: \"Build agents that can safely act, persist, pay, and be found.\",\n },\n settings: Type.Object({}),\n tools: {\n inspect_agent_stack: tool.workspace({\n annotations: { readOnlyHint: true },\n capabilities: [\"read\", \"glob\"],\n description:\n \"Inspect an AbsoluteJS project for the production agent stack and report missing safety or discoverability packages.\",\n input: Type.Object({}),\n handler: async (_input, workspace) => {\n const packageFiles = (await workspace.glob?.(\"**/package.json\")) ?? [];\n const packageFile = packageFiles.find(\n (file) => !file.includes(\"node_modules\"),\n );\n if (packageFile === undefined) return \"No package.json found.\";\n const source = (await workspace.read(packageFile)) ?? \"\";\n if (source.includes('\"@absolutejs/agent\"')) {\n return \"The @absolutejs/agent production stack is installed.\";\n }\n const expected = [\n \"@absolutejs/auth\",\n \"@absolutejs/agency\",\n \"@absolutejs/agent-runtime\",\n \"@absolutejs/agent-sandbox\",\n \"@absolutejs/agent-trust\",\n \"@absolutejs/agent-discovery\",\n \"@absolutejs/agent-conformance\",\n ];\n const missing = expected.filter((name) => !source.includes(name));\n\n return missing.length === 0\n ? \"Core production agent packages are present.\"\n : `Missing production agent packages: ${missing.join(\", \")}`;\n },\n }),\n },\n wiring: [\n {\n description:\n \"Import the typed stack composer and add each production capability explicitly.\",\n id: \"default\",\n server: {\n code: \"defineAgentStack([])\",\n imports: [{ from: \"@absolutejs/agent\", names: [\"defineAgentStack\"] }],\n placement: \"module-scope\",\n },\n title: \"Production agent stack\",\n },\n ],\n});\n"
6
6
  ],
7
- "mappings": ";;AAAA;AACA;AAEA,IAAM,OAAO,YAAmB;AAEzB,IAAM,WAAW,eAA6C,EAAE;AAAA,EACrE,UAAU;AAAA,EACV,WAAW;AAAA,IACT,WAAW,CAAC,eAAe,wBAAwB;AAAA,IACnD,SAAS;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA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OAAO;AAAA,QACT;AAAA,QACA,MAAM,WAAW;AAAA,UACf;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QACA,MAAM,UAAU,SAAS,OAAO,CAAC,SAAS,CAAC,OAAO,SAAS,IAAI,CAAC;AAAA,QAEhE,OAAO,QAAQ,WAAW,IACtB,gDACA,sCAAsC,QAAQ,KAAK,IAAI;AAAA;AAAA,IAE/D,CAAC;AAAA,EACH;AAAA,EACA,QAAQ;AAAA,IACN;AAAA,MACE,aACE;AAAA,MACF,IAAI;AAAA,MACJ,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,SAAS,CAAC,EAAE,MAAM,qBAAqB,OAAO,CAAC,kBAAkB,EAAE,CAAC;AAAA,QACpE,WAAW;AAAA,MACb;AAAA,MACA,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;",
8
+ "debugId": "419D832CDDB84C0964756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -8,7 +8,8 @@
8
8
  "intents": [
9
9
  "build an agent-first application",
10
10
  "audit an agent stack",
11
- "compose agent infrastructure"
11
+ "compose agent infrastructure",
12
+ "orchestrate a durable agent purchase"
12
13
  ],
13
14
  "keywords": [
14
15
  "agents",
@@ -16,7 +17,8 @@
16
17
  "identity",
17
18
  "orchestration",
18
19
  "security",
19
- "interoperability"
20
+ "interoperability",
21
+ "commerce"
20
22
  ],
21
23
  "protocols": [
22
24
  "OAuth 2.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/agent",
3
- "version": "0.22.3",
3
+ "version": "0.23.1",
4
4
  "description": "The production-grade, provider-neutral agent stack for AbsoluteJS: auth, actions, runtime, sandboxing, trust, memory, inbox, discovery, MCP, A2A, policy, wallet limits, controls, and conformance.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -47,6 +47,11 @@
47
47
  "import": "./dist/conformance.js",
48
48
  "default": "./dist/conformance.js"
49
49
  },
50
+ "./commerce": {
51
+ "types": "./dist/commerce.d.ts",
52
+ "import": "./dist/commerce.js",
53
+ "default": "./dist/commerce.js"
54
+ },
50
55
  "./control": {
51
56
  "types": "./dist/control.d.ts",
52
57
  "import": "./dist/control.js",
@@ -143,11 +148,11 @@
143
148
  "@absolutejs/agent-trust": "^0.2.0",
144
149
  "@absolutejs/arazzo": "^0.1.2",
145
150
  "@absolutejs/auth": "^0.56.14",
146
- "@absolutejs/execution": "^0.13.1",
151
+ "@absolutejs/execution": "^0.14.0",
147
152
  "@absolutejs/manifest": "^0.3.0",
148
153
  "@absolutejs/mcp": "^0.11.0",
149
154
  "@absolutejs/policy": "^0.2.0",
150
- "@absolutejs/wallet": "^0.8.2",
155
+ "@absolutejs/wallet": "^0.8.3",
151
156
  "@absolutejs/webmcp": "^0.1.3",
152
157
  "@sinclair/typebox": "^0.34.0"
153
158
  },