@strimz/shared-types 0.8.0 → 0.10.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.
- package/dist/agents.cjs +42 -13
- package/dist/agents.cjs.map +1 -1
- package/dist/agents.d.cts +37 -37
- package/dist/agents.d.ts +37 -37
- package/dist/agents.js +42 -13
- package/dist/agents.js.map +1 -1
- package/dist/analytics.cjs +1 -11
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.d.cts +78 -78
- package/dist/analytics.d.ts +78 -78
- package/dist/analytics.js +1 -11
- package/dist/analytics.js.map +1 -1
- package/dist/api-keys.cjs +1 -1
- package/dist/api-keys.cjs.map +1 -1
- package/dist/api-keys.js +1 -1
- package/dist/api-keys.js.map +1 -1
- package/dist/common.cjs +1 -1
- package/dist/common.cjs.map +1 -1
- package/dist/common.d.cts +1 -1
- package/dist/common.d.ts +1 -1
- package/dist/common.js +1 -1
- package/dist/common.js.map +1 -1
- package/dist/compliance.cjs +1 -1
- package/dist/compliance.cjs.map +1 -1
- package/dist/compliance.js +1 -1
- package/dist/compliance.js.map +1 -1
- package/dist/customers.cjs +1 -1
- package/dist/customers.cjs.map +1 -1
- package/dist/customers.js +1 -1
- package/dist/customers.js.map +1 -1
- package/dist/events.cjs +43 -24
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +90 -90
- package/dist/events.d.ts +90 -90
- package/dist/events.js +43 -24
- package/dist/events.js.map +1 -1
- package/dist/index.cjs +42 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +43 -24
- package/dist/index.js.map +1 -1
- package/dist/invoices.cjs +1 -1
- package/dist/invoices.cjs.map +1 -1
- package/dist/invoices.d.cts +5 -5
- package/dist/invoices.d.ts +5 -5
- package/dist/invoices.js +1 -1
- package/dist/invoices.js.map +1 -1
- package/dist/merchants.cjs +1 -1
- package/dist/merchants.cjs.map +1 -1
- package/dist/merchants.js +1 -1
- package/dist/merchants.js.map +1 -1
- package/dist/payment-sessions.cjs +1 -1
- package/dist/payment-sessions.cjs.map +1 -1
- package/dist/payment-sessions.d.cts +4 -4
- package/dist/payment-sessions.d.ts +4 -4
- package/dist/payment-sessions.js +1 -1
- package/dist/payment-sessions.js.map +1 -1
- package/dist/refunds.cjs +1 -1
- package/dist/refunds.cjs.map +1 -1
- package/dist/refunds.d.cts +5 -5
- package/dist/refunds.d.ts +5 -5
- package/dist/refunds.js +1 -1
- package/dist/refunds.js.map +1 -1
- package/dist/storefronts.cjs +1 -11
- package/dist/storefronts.cjs.map +1 -1
- package/dist/storefronts.d.cts +2 -2
- package/dist/storefronts.d.ts +2 -2
- package/dist/storefronts.js +1 -11
- package/dist/storefronts.js.map +1 -1
- package/dist/subscriptions.cjs +1 -12
- package/dist/subscriptions.cjs.map +1 -1
- package/dist/subscriptions.d.cts +5 -43
- package/dist/subscriptions.d.ts +5 -43
- package/dist/subscriptions.js +2 -12
- package/dist/subscriptions.js.map +1 -1
- package/dist/transactions.cjs +1 -1
- package/dist/transactions.cjs.map +1 -1
- package/dist/transactions.d.cts +3 -3
- package/dist/transactions.d.ts +3 -3
- package/dist/transactions.js +1 -1
- package/dist/transactions.js.map +1 -1
- package/dist/webhooks.cjs +1 -1
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.js +1 -1
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
- package/src/agents.ts +49 -14
- package/src/common.ts +0 -1
- package/src/subscriptions.ts +0 -13
package/dist/agents.cjs
CHANGED
|
@@ -11,7 +11,7 @@ zod.z.string().url().refine((v) => v.startsWith("https://"), {
|
|
|
11
11
|
message: "must be an https:// URL"
|
|
12
12
|
});
|
|
13
13
|
zod.z.string().url();
|
|
14
|
-
var tokenAmountSchema = zod.z.string().regex(/^[0-9]+$/, "must be a non-negative integer string (base-10)")
|
|
14
|
+
var tokenAmountSchema = zod.z.string().regex(/^[0-9]+$/, "must be a non-negative integer string (base-10)");
|
|
15
15
|
zod.z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
16
16
|
var isoTimestampSchema = zod.z.string().datetime({ offset: true, message: "must be an ISO-8601 timestamp" });
|
|
17
17
|
zod.z.string().length(2).regex(/^[A-Z]{2}$/, "must be an ISO-3166 alpha-2 country code");
|
|
@@ -49,28 +49,57 @@ var agentCapabilitySchema = zod.z.enum([
|
|
|
49
49
|
"commerce",
|
|
50
50
|
"pricing_intelligence"
|
|
51
51
|
]);
|
|
52
|
+
var enabledCapabilitiesSchema = zod.z.array(agentCapabilitySchema);
|
|
53
|
+
var recoveryGracePeriodHoursSchema = zod.z.union([zod.z.literal(24), zod.z.literal(48), zod.z.literal(72)]);
|
|
54
|
+
var recoveryStrategySchema = zod.z.enum(["once", "twice", "until_grace_ends"]);
|
|
55
|
+
var recoveryNotificationTemplateSchema = zod.z.string().max(2e3).nullable();
|
|
56
|
+
var cashflowDigestEnabledSchema = zod.z.boolean();
|
|
57
|
+
var cashflowAnomalySensitivitySchema = zod.z.enum(["low", "medium", "high"]);
|
|
58
|
+
var cashflowAutoConvertToYieldSchema = zod.z.boolean();
|
|
59
|
+
var cashflowMinimumLiquidReserveCentsSchema = zod.z.number().int().nonnegative();
|
|
60
|
+
var commerceRequireHumanApprovalAboveUsdCentsSchema = zod.z.number().int().nonnegative();
|
|
61
|
+
var commerceApprovedVendorsSchema = zod.z.array(evmAddressSchema);
|
|
62
|
+
var commerceMonthlySpendCapUsdCentsSchema = zod.z.number().int().nonnegative().nullable();
|
|
52
63
|
var agentMerchantConfigSchema = zod.z.object({
|
|
53
64
|
merchantId: idSchema,
|
|
54
|
-
enabledCapabilities:
|
|
65
|
+
enabledCapabilities: enabledCapabilitiesSchema.default([]),
|
|
55
66
|
recovery: zod.z.object({
|
|
56
|
-
gracePeriodHours:
|
|
57
|
-
strategy:
|
|
58
|
-
notificationTemplate:
|
|
67
|
+
gracePeriodHours: recoveryGracePeriodHoursSchema.default(48),
|
|
68
|
+
strategy: recoveryStrategySchema.default("twice"),
|
|
69
|
+
notificationTemplate: recoveryNotificationTemplateSchema
|
|
59
70
|
}),
|
|
60
71
|
cashflow: zod.z.object({
|
|
61
|
-
digestEnabled:
|
|
62
|
-
anomalySensitivity:
|
|
63
|
-
autoConvertToYield:
|
|
64
|
-
minimumLiquidReserveCents:
|
|
72
|
+
digestEnabled: cashflowDigestEnabledSchema.default(false),
|
|
73
|
+
anomalySensitivity: cashflowAnomalySensitivitySchema.default("medium"),
|
|
74
|
+
autoConvertToYield: cashflowAutoConvertToYieldSchema.default(false),
|
|
75
|
+
minimumLiquidReserveCents: cashflowMinimumLiquidReserveCentsSchema.default(1e5)
|
|
65
76
|
}),
|
|
66
77
|
commerce: zod.z.object({
|
|
67
|
-
requireHumanApprovalAboveUsdCents:
|
|
68
|
-
approvedVendors:
|
|
69
|
-
monthlySpendCapUsdCents:
|
|
78
|
+
requireHumanApprovalAboveUsdCents: commerceRequireHumanApprovalAboveUsdCentsSchema.default(1e5),
|
|
79
|
+
approvedVendors: commerceApprovedVendorsSchema.default([]),
|
|
80
|
+
monthlySpendCapUsdCents: commerceMonthlySpendCapUsdCentsSchema
|
|
70
81
|
}),
|
|
71
82
|
updatedAt: isoTimestampSchema
|
|
72
83
|
});
|
|
73
|
-
var updateAgentConfigInputSchema =
|
|
84
|
+
var updateAgentConfigInputSchema = zod.z.object({
|
|
85
|
+
enabledCapabilities: enabledCapabilitiesSchema.optional(),
|
|
86
|
+
recovery: zod.z.object({
|
|
87
|
+
gracePeriodHours: recoveryGracePeriodHoursSchema.optional(),
|
|
88
|
+
strategy: recoveryStrategySchema.optional(),
|
|
89
|
+
notificationTemplate: recoveryNotificationTemplateSchema.optional()
|
|
90
|
+
}).optional(),
|
|
91
|
+
cashflow: zod.z.object({
|
|
92
|
+
digestEnabled: cashflowDigestEnabledSchema.optional(),
|
|
93
|
+
anomalySensitivity: cashflowAnomalySensitivitySchema.optional(),
|
|
94
|
+
autoConvertToYield: cashflowAutoConvertToYieldSchema.optional(),
|
|
95
|
+
minimumLiquidReserveCents: cashflowMinimumLiquidReserveCentsSchema.optional()
|
|
96
|
+
}).optional(),
|
|
97
|
+
commerce: zod.z.object({
|
|
98
|
+
requireHumanApprovalAboveUsdCents: commerceRequireHumanApprovalAboveUsdCentsSchema.optional(),
|
|
99
|
+
approvedVendors: commerceApprovedVendorsSchema.optional(),
|
|
100
|
+
monthlySpendCapUsdCents: commerceMonthlySpendCapUsdCentsSchema.optional()
|
|
101
|
+
}).optional()
|
|
102
|
+
});
|
|
74
103
|
var agentActionTypeSchema = zod.z.enum([
|
|
75
104
|
"recovery_notification_sent",
|
|
76
105
|
"recovery_retry_scheduled",
|
package/dist/agents.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/agents.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5CA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0BA,KAAA,CAAE,M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EACA;AACF,CAAC;AAGM,IAAM,cAAA,GAAiBA,MAAE,MAAA,CAAO;AAAA,EACrC,EAAA,EAAI,QAAA;AAAA,EACJ,UAAA,EAAY,QAAA;AAAA;AAAA,EAEZ,YAAA,EAAcA,MAAE,MAAA,EAAO,CAAE,KAAI,CAAE,WAAA,GAAc,QAAA,EAAS;AAAA,EACtD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,KAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,MAAA,EAAQ,oBAAA;AAAA,EACR,eAAA,EAAiB,gBAAA;AAAA,EACjB,iBAAiBA,KAAAA,CACd,MAAA,GACA,KAAA,CAAM,kBAAkB,EACxB,QAAA,EAAS;AAAA,EACZ,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,aAAA,EAAe,gBAAgB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,yBAAA,GAA4BA,MAAE,MAAA,CAAO;AAAA,EAChD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,KAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,eAAA,EAAiB,iBAAiB,QAAA;AACpC,CAAC","file":"agents.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Identity ----------\n\nexport const agentIdentitySchema = z.object({\n id: idSchema,\n /** ERC-8004 on-chain identity address. */\n onchainAddress: evmAddressSchema,\n /** Public key or agent credential digest, as emitted by ERC-8004. */\n credentialDigest: z.string().regex(/^0x[a-fA-F0-9]+$/),\n name: z.string().min(1).max(120),\n version: z.string().min(1).max(40),\n reputationScore: z.number().min(0).max(100).nullable(),\n registeredAt: isoTimestampSchema,\n})\nexport type AgentIdentity = z.infer<typeof agentIdentitySchema>\n\n// ---------- Merchant config ----------\n\nexport const agentCapabilitySchema = z.enum([\n 'identity',\n 'recovery',\n 'routing',\n 'cashflow',\n 'commerce',\n 'pricing_intelligence',\n])\nexport type AgentCapability = z.infer<typeof agentCapabilitySchema>\n\nexport const agentMerchantConfigSchema = z.object({\n merchantId: idSchema,\n enabledCapabilities: z.array(agentCapabilitySchema).default([]),\n recovery: z.object({\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n strategy: z.enum(['once', 'twice', 'until_grace_ends']).default('twice'),\n notificationTemplate: z.string().max(2000).nullable(),\n }),\n cashflow: z.object({\n digestEnabled: z.boolean().default(false),\n anomalySensitivity: z.enum(['low', 'medium', 'high']).default('medium'),\n autoConvertToYield: z.boolean().default(false),\n minimumLiquidReserveCents: z.number().int().nonnegative().default(100_000),\n }),\n commerce: z.object({\n requireHumanApprovalAboveUsdCents: z.number().int().nonnegative().default(100_000),\n approvedVendors: z.array(evmAddressSchema).default([]),\n monthlySpendCapUsdCents: z.number().int().nonnegative().nullable(),\n }),\n updatedAt: isoTimestampSchema,\n})\nexport type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>\n\nexport const updateAgentConfigInputSchema = agentMerchantConfigSchema\n .omit({ merchantId: true, updatedAt: true })\n .partial()\nexport type UpdateAgentConfigInput = z.input<typeof updateAgentConfigInputSchema>\nexport type UpdateAgentConfigParsed = z.output<typeof updateAgentConfigInputSchema>\n\n// ---------- Activity log ----------\n\nexport const agentActionTypeSchema = z.enum([\n 'recovery_notification_sent',\n 'recovery_retry_scheduled',\n 'recovery_retry_executed',\n 'recovery_abandoned',\n 'routing_bridge_initiated',\n 'routing_payment_completed',\n 'cashflow_digest_sent',\n 'cashflow_anomaly_flagged',\n 'cashflow_yield_converted',\n 'commerce_job_created',\n 'commerce_job_approved',\n 'commerce_job_completed',\n 'commerce_job_disputed',\n])\nexport type AgentActionType = z.infer<typeof agentActionTypeSchema>\n\nexport const agentActionOutcomeSchema = z.enum(['success', 'failure', 'pending', 'skipped'])\nexport type AgentActionOutcome = z.infer<typeof agentActionOutcomeSchema>\n\nexport const agentActivityLogSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n capability: agentCapabilitySchema,\n actionType: agentActionTypeSchema,\n outcome: agentActionOutcomeSchema,\n subscriptionId: idSchema.nullable(),\n transactionId: idSchema.nullable(),\n jobId: idSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n})\nexport type AgentActivityLog = z.infer<typeof agentActivityLogSchema>\n\n// ---------- ERC-8183 jobs ----------\n\n// Mirrors the DB `AgentJobStatus` enum, not the contract's JobStatus.\n// `accepted` is off-chain only (merchant approved, queued for on-chain\n// creation); `resolved` and `reclaimed` are the escrow's terminal exits\n// from a dispute and from a timeout reclaim respectively.\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'funded',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\n 'resolved',\n 'reclaimed',\n])\nexport type AgentJobStatus = z.infer<typeof agentJobStatusSchema>\n\nexport const agentJobSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /** On-chain job id from StrimzAgentEscrow. */\n onchainJobId: z.number().int().nonnegative().nullable(),\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n status: agentJobStatusSchema,\n assessorAddress: evmAddressSchema,\n deliverableHash: z\n .string()\n .regex(/^0x[a-fA-F0-9]+$/)\n .nullable(),\n escrowTxHash: evmTxHashSchema.nullable(),\n releaseTxHash: evmTxHashSchema.nullable(),\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type AgentJob = z.infer<typeof agentJobSchema>\n\nexport const createAgentJobInputSchema = z.object({\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n assessorAddress: evmAddressSchema.optional(),\n})\nexport type CreateAgentJobInput = z.input<typeof createAgentJobInputSchema>\nexport type CreateAgentJobParsed = z.output<typeof createAgentJobInputSchema>\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common.ts","../src/agents.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5CA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,oBAAoBA,KAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CA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,iBAAA;AAAA,EACR,UAAUA,KAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,MAAA,EAAQ,oBAAA;AAAA,EACR,eAAA,EAAiB,gBAAA;AAAA,EACjB,iBAAiBA,KAAAA,CACd,MAAA,GACA,KAAA,CAAM,kBAAkB,EACxB,QAAA,EAAS;AAAA,EACZ,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,aAAA,EAAe,gBAAgB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,yBAAA,GAA4BA,MAAE,MAAA,CAAO;AAAA,EAChD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,KAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,eAAA,EAAiB,iBAAiB,QAAA;AACpC,CAAC","file":"agents.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Identity ----------\n\nexport const agentIdentitySchema = z.object({\n id: idSchema,\n /** ERC-8004 on-chain identity address. */\n onchainAddress: evmAddressSchema,\n /** Public key or agent credential digest, as emitted by ERC-8004. */\n credentialDigest: z.string().regex(/^0x[a-fA-F0-9]+$/),\n name: z.string().min(1).max(120),\n version: z.string().min(1).max(40),\n reputationScore: z.number().min(0).max(100).nullable(),\n registeredAt: isoTimestampSchema,\n})\nexport type AgentIdentity = z.infer<typeof agentIdentitySchema>\n\n// ---------- Merchant config ----------\n\nexport const agentCapabilitySchema = z.enum([\n 'identity',\n 'recovery',\n 'routing',\n 'cashflow',\n 'commerce',\n 'pricing_intelligence',\n])\nexport type AgentCapability = z.infer<typeof agentCapabilitySchema>\n\nconst enabledCapabilitiesSchema = z.array(agentCapabilitySchema)\nconst recoveryGracePeriodHoursSchema = z.union([z.literal(24), z.literal(48), z.literal(72)])\nconst recoveryStrategySchema = z.enum(['once', 'twice', 'until_grace_ends'])\nconst recoveryNotificationTemplateSchema = z.string().max(2000).nullable()\nconst cashflowDigestEnabledSchema = z.boolean()\nconst cashflowAnomalySensitivitySchema = z.enum(['low', 'medium', 'high'])\nconst cashflowAutoConvertToYieldSchema = z.boolean()\nconst cashflowMinimumLiquidReserveCentsSchema = z.number().int().nonnegative()\nconst commerceRequireHumanApprovalAboveUsdCentsSchema = z.number().int().nonnegative()\nconst commerceApprovedVendorsSchema = z.array(evmAddressSchema)\nconst commerceMonthlySpendCapUsdCentsSchema = z.number().int().nonnegative().nullable()\n\nexport const agentMerchantConfigSchema = z.object({\n merchantId: idSchema,\n enabledCapabilities: enabledCapabilitiesSchema.default([]),\n recovery: z.object({\n gracePeriodHours: recoveryGracePeriodHoursSchema.default(48),\n strategy: recoveryStrategySchema.default('twice'),\n notificationTemplate: recoveryNotificationTemplateSchema,\n }),\n cashflow: z.object({\n digestEnabled: cashflowDigestEnabledSchema.default(false),\n anomalySensitivity: cashflowAnomalySensitivitySchema.default('medium'),\n autoConvertToYield: cashflowAutoConvertToYieldSchema.default(false),\n minimumLiquidReserveCents: cashflowMinimumLiquidReserveCentsSchema.default(100_000),\n }),\n commerce: z.object({\n requireHumanApprovalAboveUsdCents:\n commerceRequireHumanApprovalAboveUsdCentsSchema.default(100_000),\n approvedVendors: commerceApprovedVendorsSchema.default([]),\n monthlySpendCapUsdCents: commerceMonthlySpendCapUsdCentsSchema,\n }),\n updatedAt: isoTimestampSchema,\n})\nexport type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>\n\nexport const updateAgentConfigInputSchema = z.object({\n enabledCapabilities: enabledCapabilitiesSchema.optional(),\n recovery: z\n .object({\n gracePeriodHours: recoveryGracePeriodHoursSchema.optional(),\n strategy: recoveryStrategySchema.optional(),\n notificationTemplate: recoveryNotificationTemplateSchema.optional(),\n })\n .optional(),\n cashflow: z\n .object({\n digestEnabled: cashflowDigestEnabledSchema.optional(),\n anomalySensitivity: cashflowAnomalySensitivitySchema.optional(),\n autoConvertToYield: cashflowAutoConvertToYieldSchema.optional(),\n minimumLiquidReserveCents: cashflowMinimumLiquidReserveCentsSchema.optional(),\n })\n .optional(),\n commerce: z\n .object({\n requireHumanApprovalAboveUsdCents: commerceRequireHumanApprovalAboveUsdCentsSchema.optional(),\n approvedVendors: commerceApprovedVendorsSchema.optional(),\n monthlySpendCapUsdCents: commerceMonthlySpendCapUsdCentsSchema.optional(),\n })\n .optional(),\n})\nexport type UpdateAgentConfigInput = z.input<typeof updateAgentConfigInputSchema>\nexport type UpdateAgentConfigParsed = z.output<typeof updateAgentConfigInputSchema>\n\n// ---------- Activity log ----------\n\nexport const agentActionTypeSchema = z.enum([\n 'recovery_notification_sent',\n 'recovery_retry_scheduled',\n 'recovery_retry_executed',\n 'recovery_abandoned',\n 'routing_bridge_initiated',\n 'routing_payment_completed',\n 'cashflow_digest_sent',\n 'cashflow_anomaly_flagged',\n 'cashflow_yield_converted',\n 'commerce_job_created',\n 'commerce_job_approved',\n 'commerce_job_completed',\n 'commerce_job_disputed',\n])\nexport type AgentActionType = z.infer<typeof agentActionTypeSchema>\n\nexport const agentActionOutcomeSchema = z.enum(['success', 'failure', 'pending', 'skipped'])\nexport type AgentActionOutcome = z.infer<typeof agentActionOutcomeSchema>\n\nexport const agentActivityLogSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n capability: agentCapabilitySchema,\n actionType: agentActionTypeSchema,\n outcome: agentActionOutcomeSchema,\n subscriptionId: idSchema.nullable(),\n transactionId: idSchema.nullable(),\n jobId: idSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n})\nexport type AgentActivityLog = z.infer<typeof agentActivityLogSchema>\n\n// ---------- ERC-8183 jobs ----------\n\n// Mirrors the DB `AgentJobStatus` enum, not the contract's JobStatus.\n// `accepted` is off-chain only (merchant approved, queued for on-chain\n// creation); `resolved` and `reclaimed` are the escrow's terminal exits\n// from a dispute and from a timeout reclaim respectively.\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'funded',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\n 'resolved',\n 'reclaimed',\n])\nexport type AgentJobStatus = z.infer<typeof agentJobStatusSchema>\n\nexport const agentJobSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /** On-chain job id from StrimzAgentEscrow. */\n onchainJobId: z.number().int().nonnegative().nullable(),\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n status: agentJobStatusSchema,\n assessorAddress: evmAddressSchema,\n deliverableHash: z\n .string()\n .regex(/^0x[a-fA-F0-9]+$/)\n .nullable(),\n escrowTxHash: evmTxHashSchema.nullable(),\n releaseTxHash: evmTxHashSchema.nullable(),\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type AgentJob = z.infer<typeof agentJobSchema>\n\nexport const createAgentJobInputSchema = z.object({\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n assessorAddress: evmAddressSchema.optional(),\n})\nexport type CreateAgentJobInput = z.input<typeof createAgentJobInputSchema>\nexport type CreateAgentJobParsed = z.output<typeof createAgentJobInputSchema>\n"]}
|
package/dist/agents.d.cts
CHANGED
|
@@ -123,29 +123,30 @@ declare const agentMerchantConfigSchema: z.ZodObject<{
|
|
|
123
123
|
}>;
|
|
124
124
|
type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>;
|
|
125
125
|
declare const updateAgentConfigInputSchema: z.ZodObject<{
|
|
126
|
+
enabledCapabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<["identity", "recovery", "routing", "cashflow", "commerce", "pricing_intelligence"]>, "many">>;
|
|
126
127
|
recovery: z.ZodOptional<z.ZodObject<{
|
|
127
|
-
gracePeriodHours: z.
|
|
128
|
-
strategy: z.
|
|
129
|
-
notificationTemplate: z.ZodNullable<z.ZodString
|
|
128
|
+
gracePeriodHours: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<24>, z.ZodLiteral<48>, z.ZodLiteral<72>]>>;
|
|
129
|
+
strategy: z.ZodOptional<z.ZodEnum<["once", "twice", "until_grace_ends"]>>;
|
|
130
|
+
notificationTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
130
131
|
}, "strip", z.ZodTypeAny, {
|
|
131
|
-
gracePeriodHours
|
|
132
|
-
strategy
|
|
133
|
-
notificationTemplate
|
|
132
|
+
gracePeriodHours?: 24 | 48 | 72 | undefined;
|
|
133
|
+
strategy?: "once" | "twice" | "until_grace_ends" | undefined;
|
|
134
|
+
notificationTemplate?: string | null | undefined;
|
|
134
135
|
}, {
|
|
135
|
-
notificationTemplate: string | null;
|
|
136
136
|
gracePeriodHours?: 24 | 48 | 72 | undefined;
|
|
137
137
|
strategy?: "once" | "twice" | "until_grace_ends" | undefined;
|
|
138
|
+
notificationTemplate?: string | null | undefined;
|
|
138
139
|
}>>;
|
|
139
140
|
cashflow: z.ZodOptional<z.ZodObject<{
|
|
140
|
-
digestEnabled: z.
|
|
141
|
-
anomalySensitivity: z.
|
|
142
|
-
autoConvertToYield: z.
|
|
143
|
-
minimumLiquidReserveCents: z.
|
|
141
|
+
digestEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
anomalySensitivity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
143
|
+
autoConvertToYield: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
+
minimumLiquidReserveCents: z.ZodOptional<z.ZodNumber>;
|
|
144
145
|
}, "strip", z.ZodTypeAny, {
|
|
145
|
-
digestEnabled
|
|
146
|
-
anomalySensitivity
|
|
147
|
-
autoConvertToYield
|
|
148
|
-
minimumLiquidReserveCents
|
|
146
|
+
digestEnabled?: boolean | undefined;
|
|
147
|
+
anomalySensitivity?: "low" | "medium" | "high" | undefined;
|
|
148
|
+
autoConvertToYield?: boolean | undefined;
|
|
149
|
+
minimumLiquidReserveCents?: number | undefined;
|
|
149
150
|
}, {
|
|
150
151
|
digestEnabled?: boolean | undefined;
|
|
151
152
|
anomalySensitivity?: "low" | "medium" | "high" | undefined;
|
|
@@ -153,42 +154,41 @@ declare const updateAgentConfigInputSchema: z.ZodObject<{
|
|
|
153
154
|
minimumLiquidReserveCents?: number | undefined;
|
|
154
155
|
}>>;
|
|
155
156
|
commerce: z.ZodOptional<z.ZodObject<{
|
|
156
|
-
requireHumanApprovalAboveUsdCents: z.
|
|
157
|
-
approvedVendors: z.
|
|
158
|
-
monthlySpendCapUsdCents: z.ZodNullable<z.ZodNumber
|
|
157
|
+
requireHumanApprovalAboveUsdCents: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
approvedVendors: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
159
|
+
monthlySpendCapUsdCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
159
160
|
}, "strip", z.ZodTypeAny, {
|
|
160
|
-
requireHumanApprovalAboveUsdCents
|
|
161
|
-
approvedVendors
|
|
162
|
-
monthlySpendCapUsdCents
|
|
161
|
+
requireHumanApprovalAboveUsdCents?: number | undefined;
|
|
162
|
+
approvedVendors?: string[] | undefined;
|
|
163
|
+
monthlySpendCapUsdCents?: number | null | undefined;
|
|
163
164
|
}, {
|
|
164
|
-
monthlySpendCapUsdCents: number | null;
|
|
165
165
|
requireHumanApprovalAboveUsdCents?: number | undefined;
|
|
166
166
|
approvedVendors?: string[] | undefined;
|
|
167
|
+
monthlySpendCapUsdCents?: number | null | undefined;
|
|
167
168
|
}>>;
|
|
168
|
-
enabledCapabilities: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEnum<["identity", "recovery", "routing", "cashflow", "commerce", "pricing_intelligence"]>, "many">>>;
|
|
169
169
|
}, "strip", z.ZodTypeAny, {
|
|
170
170
|
recovery?: {
|
|
171
|
-
gracePeriodHours
|
|
172
|
-
strategy
|
|
173
|
-
notificationTemplate
|
|
171
|
+
gracePeriodHours?: 24 | 48 | 72 | undefined;
|
|
172
|
+
strategy?: "once" | "twice" | "until_grace_ends" | undefined;
|
|
173
|
+
notificationTemplate?: string | null | undefined;
|
|
174
174
|
} | undefined;
|
|
175
175
|
cashflow?: {
|
|
176
|
-
digestEnabled
|
|
177
|
-
anomalySensitivity
|
|
178
|
-
autoConvertToYield
|
|
179
|
-
minimumLiquidReserveCents
|
|
176
|
+
digestEnabled?: boolean | undefined;
|
|
177
|
+
anomalySensitivity?: "low" | "medium" | "high" | undefined;
|
|
178
|
+
autoConvertToYield?: boolean | undefined;
|
|
179
|
+
minimumLiquidReserveCents?: number | undefined;
|
|
180
180
|
} | undefined;
|
|
181
181
|
commerce?: {
|
|
182
|
-
requireHumanApprovalAboveUsdCents
|
|
183
|
-
approvedVendors
|
|
184
|
-
monthlySpendCapUsdCents
|
|
182
|
+
requireHumanApprovalAboveUsdCents?: number | undefined;
|
|
183
|
+
approvedVendors?: string[] | undefined;
|
|
184
|
+
monthlySpendCapUsdCents?: number | null | undefined;
|
|
185
185
|
} | undefined;
|
|
186
186
|
enabledCapabilities?: ("identity" | "recovery" | "routing" | "cashflow" | "commerce" | "pricing_intelligence")[] | undefined;
|
|
187
187
|
}, {
|
|
188
188
|
recovery?: {
|
|
189
|
-
notificationTemplate: string | null;
|
|
190
189
|
gracePeriodHours?: 24 | 48 | 72 | undefined;
|
|
191
190
|
strategy?: "once" | "twice" | "until_grace_ends" | undefined;
|
|
191
|
+
notificationTemplate?: string | null | undefined;
|
|
192
192
|
} | undefined;
|
|
193
193
|
cashflow?: {
|
|
194
194
|
digestEnabled?: boolean | undefined;
|
|
@@ -197,9 +197,9 @@ declare const updateAgentConfigInputSchema: z.ZodObject<{
|
|
|
197
197
|
minimumLiquidReserveCents?: number | undefined;
|
|
198
198
|
} | undefined;
|
|
199
199
|
commerce?: {
|
|
200
|
-
monthlySpendCapUsdCents: number | null;
|
|
201
200
|
requireHumanApprovalAboveUsdCents?: number | undefined;
|
|
202
201
|
approvedVendors?: string[] | undefined;
|
|
202
|
+
monthlySpendCapUsdCents?: number | null | undefined;
|
|
203
203
|
} | undefined;
|
|
204
204
|
enabledCapabilities?: ("identity" | "recovery" | "routing" | "cashflow" | "commerce" | "pricing_intelligence")[] | undefined;
|
|
205
205
|
}>;
|
|
@@ -253,7 +253,7 @@ declare const agentJobSchema: z.ZodObject<{
|
|
|
253
253
|
onchainJobId: z.ZodNullable<z.ZodNumber>;
|
|
254
254
|
vendorAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
255
255
|
description: z.ZodString;
|
|
256
|
-
amount: z.
|
|
256
|
+
amount: z.ZodString;
|
|
257
257
|
currency: z.ZodEnum<["USDC", "EURC"]>;
|
|
258
258
|
status: z.ZodEnum<["proposed", "accepted", "funded", "in_progress", "delivered", "approved", "completed", "disputed", "cancelled", "resolved", "reclaimed"]>;
|
|
259
259
|
assessorAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -297,7 +297,7 @@ type AgentJob = z.infer<typeof agentJobSchema>;
|
|
|
297
297
|
declare const createAgentJobInputSchema: z.ZodObject<{
|
|
298
298
|
vendorAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
299
299
|
description: z.ZodString;
|
|
300
|
-
amount: z.
|
|
300
|
+
amount: z.ZodString;
|
|
301
301
|
currency: z.ZodEnum<["USDC", "EURC"]>;
|
|
302
302
|
assessorAddress: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
303
303
|
}, "strip", z.ZodTypeAny, {
|
package/dist/agents.d.ts
CHANGED
|
@@ -123,29 +123,30 @@ declare const agentMerchantConfigSchema: z.ZodObject<{
|
|
|
123
123
|
}>;
|
|
124
124
|
type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>;
|
|
125
125
|
declare const updateAgentConfigInputSchema: z.ZodObject<{
|
|
126
|
+
enabledCapabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<["identity", "recovery", "routing", "cashflow", "commerce", "pricing_intelligence"]>, "many">>;
|
|
126
127
|
recovery: z.ZodOptional<z.ZodObject<{
|
|
127
|
-
gracePeriodHours: z.
|
|
128
|
-
strategy: z.
|
|
129
|
-
notificationTemplate: z.ZodNullable<z.ZodString
|
|
128
|
+
gracePeriodHours: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<24>, z.ZodLiteral<48>, z.ZodLiteral<72>]>>;
|
|
129
|
+
strategy: z.ZodOptional<z.ZodEnum<["once", "twice", "until_grace_ends"]>>;
|
|
130
|
+
notificationTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
130
131
|
}, "strip", z.ZodTypeAny, {
|
|
131
|
-
gracePeriodHours
|
|
132
|
-
strategy
|
|
133
|
-
notificationTemplate
|
|
132
|
+
gracePeriodHours?: 24 | 48 | 72 | undefined;
|
|
133
|
+
strategy?: "once" | "twice" | "until_grace_ends" | undefined;
|
|
134
|
+
notificationTemplate?: string | null | undefined;
|
|
134
135
|
}, {
|
|
135
|
-
notificationTemplate: string | null;
|
|
136
136
|
gracePeriodHours?: 24 | 48 | 72 | undefined;
|
|
137
137
|
strategy?: "once" | "twice" | "until_grace_ends" | undefined;
|
|
138
|
+
notificationTemplate?: string | null | undefined;
|
|
138
139
|
}>>;
|
|
139
140
|
cashflow: z.ZodOptional<z.ZodObject<{
|
|
140
|
-
digestEnabled: z.
|
|
141
|
-
anomalySensitivity: z.
|
|
142
|
-
autoConvertToYield: z.
|
|
143
|
-
minimumLiquidReserveCents: z.
|
|
141
|
+
digestEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
142
|
+
anomalySensitivity: z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>;
|
|
143
|
+
autoConvertToYield: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
+
minimumLiquidReserveCents: z.ZodOptional<z.ZodNumber>;
|
|
144
145
|
}, "strip", z.ZodTypeAny, {
|
|
145
|
-
digestEnabled
|
|
146
|
-
anomalySensitivity
|
|
147
|
-
autoConvertToYield
|
|
148
|
-
minimumLiquidReserveCents
|
|
146
|
+
digestEnabled?: boolean | undefined;
|
|
147
|
+
anomalySensitivity?: "low" | "medium" | "high" | undefined;
|
|
148
|
+
autoConvertToYield?: boolean | undefined;
|
|
149
|
+
minimumLiquidReserveCents?: number | undefined;
|
|
149
150
|
}, {
|
|
150
151
|
digestEnabled?: boolean | undefined;
|
|
151
152
|
anomalySensitivity?: "low" | "medium" | "high" | undefined;
|
|
@@ -153,42 +154,41 @@ declare const updateAgentConfigInputSchema: z.ZodObject<{
|
|
|
153
154
|
minimumLiquidReserveCents?: number | undefined;
|
|
154
155
|
}>>;
|
|
155
156
|
commerce: z.ZodOptional<z.ZodObject<{
|
|
156
|
-
requireHumanApprovalAboveUsdCents: z.
|
|
157
|
-
approvedVendors: z.
|
|
158
|
-
monthlySpendCapUsdCents: z.ZodNullable<z.ZodNumber
|
|
157
|
+
requireHumanApprovalAboveUsdCents: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
approvedVendors: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
159
|
+
monthlySpendCapUsdCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
159
160
|
}, "strip", z.ZodTypeAny, {
|
|
160
|
-
requireHumanApprovalAboveUsdCents
|
|
161
|
-
approvedVendors
|
|
162
|
-
monthlySpendCapUsdCents
|
|
161
|
+
requireHumanApprovalAboveUsdCents?: number | undefined;
|
|
162
|
+
approvedVendors?: string[] | undefined;
|
|
163
|
+
monthlySpendCapUsdCents?: number | null | undefined;
|
|
163
164
|
}, {
|
|
164
|
-
monthlySpendCapUsdCents: number | null;
|
|
165
165
|
requireHumanApprovalAboveUsdCents?: number | undefined;
|
|
166
166
|
approvedVendors?: string[] | undefined;
|
|
167
|
+
monthlySpendCapUsdCents?: number | null | undefined;
|
|
167
168
|
}>>;
|
|
168
|
-
enabledCapabilities: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEnum<["identity", "recovery", "routing", "cashflow", "commerce", "pricing_intelligence"]>, "many">>>;
|
|
169
169
|
}, "strip", z.ZodTypeAny, {
|
|
170
170
|
recovery?: {
|
|
171
|
-
gracePeriodHours
|
|
172
|
-
strategy
|
|
173
|
-
notificationTemplate
|
|
171
|
+
gracePeriodHours?: 24 | 48 | 72 | undefined;
|
|
172
|
+
strategy?: "once" | "twice" | "until_grace_ends" | undefined;
|
|
173
|
+
notificationTemplate?: string | null | undefined;
|
|
174
174
|
} | undefined;
|
|
175
175
|
cashflow?: {
|
|
176
|
-
digestEnabled
|
|
177
|
-
anomalySensitivity
|
|
178
|
-
autoConvertToYield
|
|
179
|
-
minimumLiquidReserveCents
|
|
176
|
+
digestEnabled?: boolean | undefined;
|
|
177
|
+
anomalySensitivity?: "low" | "medium" | "high" | undefined;
|
|
178
|
+
autoConvertToYield?: boolean | undefined;
|
|
179
|
+
minimumLiquidReserveCents?: number | undefined;
|
|
180
180
|
} | undefined;
|
|
181
181
|
commerce?: {
|
|
182
|
-
requireHumanApprovalAboveUsdCents
|
|
183
|
-
approvedVendors
|
|
184
|
-
monthlySpendCapUsdCents
|
|
182
|
+
requireHumanApprovalAboveUsdCents?: number | undefined;
|
|
183
|
+
approvedVendors?: string[] | undefined;
|
|
184
|
+
monthlySpendCapUsdCents?: number | null | undefined;
|
|
185
185
|
} | undefined;
|
|
186
186
|
enabledCapabilities?: ("identity" | "recovery" | "routing" | "cashflow" | "commerce" | "pricing_intelligence")[] | undefined;
|
|
187
187
|
}, {
|
|
188
188
|
recovery?: {
|
|
189
|
-
notificationTemplate: string | null;
|
|
190
189
|
gracePeriodHours?: 24 | 48 | 72 | undefined;
|
|
191
190
|
strategy?: "once" | "twice" | "until_grace_ends" | undefined;
|
|
191
|
+
notificationTemplate?: string | null | undefined;
|
|
192
192
|
} | undefined;
|
|
193
193
|
cashflow?: {
|
|
194
194
|
digestEnabled?: boolean | undefined;
|
|
@@ -197,9 +197,9 @@ declare const updateAgentConfigInputSchema: z.ZodObject<{
|
|
|
197
197
|
minimumLiquidReserveCents?: number | undefined;
|
|
198
198
|
} | undefined;
|
|
199
199
|
commerce?: {
|
|
200
|
-
monthlySpendCapUsdCents: number | null;
|
|
201
200
|
requireHumanApprovalAboveUsdCents?: number | undefined;
|
|
202
201
|
approvedVendors?: string[] | undefined;
|
|
202
|
+
monthlySpendCapUsdCents?: number | null | undefined;
|
|
203
203
|
} | undefined;
|
|
204
204
|
enabledCapabilities?: ("identity" | "recovery" | "routing" | "cashflow" | "commerce" | "pricing_intelligence")[] | undefined;
|
|
205
205
|
}>;
|
|
@@ -253,7 +253,7 @@ declare const agentJobSchema: z.ZodObject<{
|
|
|
253
253
|
onchainJobId: z.ZodNullable<z.ZodNumber>;
|
|
254
254
|
vendorAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
255
255
|
description: z.ZodString;
|
|
256
|
-
amount: z.
|
|
256
|
+
amount: z.ZodString;
|
|
257
257
|
currency: z.ZodEnum<["USDC", "EURC"]>;
|
|
258
258
|
status: z.ZodEnum<["proposed", "accepted", "funded", "in_progress", "delivered", "approved", "completed", "disputed", "cancelled", "resolved", "reclaimed"]>;
|
|
259
259
|
assessorAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -297,7 +297,7 @@ type AgentJob = z.infer<typeof agentJobSchema>;
|
|
|
297
297
|
declare const createAgentJobInputSchema: z.ZodObject<{
|
|
298
298
|
vendorAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
299
299
|
description: z.ZodString;
|
|
300
|
-
amount: z.
|
|
300
|
+
amount: z.ZodString;
|
|
301
301
|
currency: z.ZodEnum<["USDC", "EURC"]>;
|
|
302
302
|
assessorAddress: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
303
303
|
}, "strip", z.ZodTypeAny, {
|
package/dist/agents.js
CHANGED
|
@@ -9,7 +9,7 @@ z.string().url().refine((v) => v.startsWith("https://"), {
|
|
|
9
9
|
message: "must be an https:// URL"
|
|
10
10
|
});
|
|
11
11
|
z.string().url();
|
|
12
|
-
var tokenAmountSchema = z.string().regex(/^[0-9]+$/, "must be a non-negative integer string (base-10)")
|
|
12
|
+
var tokenAmountSchema = z.string().regex(/^[0-9]+$/, "must be a non-negative integer string (base-10)");
|
|
13
13
|
z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
14
14
|
var isoTimestampSchema = z.string().datetime({ offset: true, message: "must be an ISO-8601 timestamp" });
|
|
15
15
|
z.string().length(2).regex(/^[A-Z]{2}$/, "must be an ISO-3166 alpha-2 country code");
|
|
@@ -47,28 +47,57 @@ var agentCapabilitySchema = z.enum([
|
|
|
47
47
|
"commerce",
|
|
48
48
|
"pricing_intelligence"
|
|
49
49
|
]);
|
|
50
|
+
var enabledCapabilitiesSchema = z.array(agentCapabilitySchema);
|
|
51
|
+
var recoveryGracePeriodHoursSchema = z.union([z.literal(24), z.literal(48), z.literal(72)]);
|
|
52
|
+
var recoveryStrategySchema = z.enum(["once", "twice", "until_grace_ends"]);
|
|
53
|
+
var recoveryNotificationTemplateSchema = z.string().max(2e3).nullable();
|
|
54
|
+
var cashflowDigestEnabledSchema = z.boolean();
|
|
55
|
+
var cashflowAnomalySensitivitySchema = z.enum(["low", "medium", "high"]);
|
|
56
|
+
var cashflowAutoConvertToYieldSchema = z.boolean();
|
|
57
|
+
var cashflowMinimumLiquidReserveCentsSchema = z.number().int().nonnegative();
|
|
58
|
+
var commerceRequireHumanApprovalAboveUsdCentsSchema = z.number().int().nonnegative();
|
|
59
|
+
var commerceApprovedVendorsSchema = z.array(evmAddressSchema);
|
|
60
|
+
var commerceMonthlySpendCapUsdCentsSchema = z.number().int().nonnegative().nullable();
|
|
50
61
|
var agentMerchantConfigSchema = z.object({
|
|
51
62
|
merchantId: idSchema,
|
|
52
|
-
enabledCapabilities:
|
|
63
|
+
enabledCapabilities: enabledCapabilitiesSchema.default([]),
|
|
53
64
|
recovery: z.object({
|
|
54
|
-
gracePeriodHours:
|
|
55
|
-
strategy:
|
|
56
|
-
notificationTemplate:
|
|
65
|
+
gracePeriodHours: recoveryGracePeriodHoursSchema.default(48),
|
|
66
|
+
strategy: recoveryStrategySchema.default("twice"),
|
|
67
|
+
notificationTemplate: recoveryNotificationTemplateSchema
|
|
57
68
|
}),
|
|
58
69
|
cashflow: z.object({
|
|
59
|
-
digestEnabled:
|
|
60
|
-
anomalySensitivity:
|
|
61
|
-
autoConvertToYield:
|
|
62
|
-
minimumLiquidReserveCents:
|
|
70
|
+
digestEnabled: cashflowDigestEnabledSchema.default(false),
|
|
71
|
+
anomalySensitivity: cashflowAnomalySensitivitySchema.default("medium"),
|
|
72
|
+
autoConvertToYield: cashflowAutoConvertToYieldSchema.default(false),
|
|
73
|
+
minimumLiquidReserveCents: cashflowMinimumLiquidReserveCentsSchema.default(1e5)
|
|
63
74
|
}),
|
|
64
75
|
commerce: z.object({
|
|
65
|
-
requireHumanApprovalAboveUsdCents:
|
|
66
|
-
approvedVendors:
|
|
67
|
-
monthlySpendCapUsdCents:
|
|
76
|
+
requireHumanApprovalAboveUsdCents: commerceRequireHumanApprovalAboveUsdCentsSchema.default(1e5),
|
|
77
|
+
approvedVendors: commerceApprovedVendorsSchema.default([]),
|
|
78
|
+
monthlySpendCapUsdCents: commerceMonthlySpendCapUsdCentsSchema
|
|
68
79
|
}),
|
|
69
80
|
updatedAt: isoTimestampSchema
|
|
70
81
|
});
|
|
71
|
-
var updateAgentConfigInputSchema =
|
|
82
|
+
var updateAgentConfigInputSchema = z.object({
|
|
83
|
+
enabledCapabilities: enabledCapabilitiesSchema.optional(),
|
|
84
|
+
recovery: z.object({
|
|
85
|
+
gracePeriodHours: recoveryGracePeriodHoursSchema.optional(),
|
|
86
|
+
strategy: recoveryStrategySchema.optional(),
|
|
87
|
+
notificationTemplate: recoveryNotificationTemplateSchema.optional()
|
|
88
|
+
}).optional(),
|
|
89
|
+
cashflow: z.object({
|
|
90
|
+
digestEnabled: cashflowDigestEnabledSchema.optional(),
|
|
91
|
+
anomalySensitivity: cashflowAnomalySensitivitySchema.optional(),
|
|
92
|
+
autoConvertToYield: cashflowAutoConvertToYieldSchema.optional(),
|
|
93
|
+
minimumLiquidReserveCents: cashflowMinimumLiquidReserveCentsSchema.optional()
|
|
94
|
+
}).optional(),
|
|
95
|
+
commerce: z.object({
|
|
96
|
+
requireHumanApprovalAboveUsdCents: commerceRequireHumanApprovalAboveUsdCentsSchema.optional(),
|
|
97
|
+
approvedVendors: commerceApprovedVendorsSchema.optional(),
|
|
98
|
+
monthlySpendCapUsdCents: commerceMonthlySpendCapUsdCentsSchema.optional()
|
|
99
|
+
}).optional()
|
|
100
|
+
});
|
|
72
101
|
var agentActionTypeSchema = z.enum([
|
|
73
102
|
"recovery_notification_sent",
|
|
74
103
|
"recovery_retry_scheduled",
|
package/dist/agents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/agents.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAA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,MAAM,CAAC,CAAA;AAAA,EACjC,eAAA,EAAiB,iBAAiB,QAAA;AACpC,CAAC","file":"agents.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Identity ----------\n\nexport const agentIdentitySchema = z.object({\n id: idSchema,\n /** ERC-8004 on-chain identity address. */\n onchainAddress: evmAddressSchema,\n /** Public key or agent credential digest, as emitted by ERC-8004. */\n credentialDigest: z.string().regex(/^0x[a-fA-F0-9]+$/),\n name: z.string().min(1).max(120),\n version: z.string().min(1).max(40),\n reputationScore: z.number().min(0).max(100).nullable(),\n registeredAt: isoTimestampSchema,\n})\nexport type AgentIdentity = z.infer<typeof agentIdentitySchema>\n\n// ---------- Merchant config ----------\n\nexport const agentCapabilitySchema = z.enum([\n 'identity',\n 'recovery',\n 'routing',\n 'cashflow',\n 'commerce',\n 'pricing_intelligence',\n])\nexport type AgentCapability = z.infer<typeof agentCapabilitySchema>\n\nexport const agentMerchantConfigSchema = z.object({\n merchantId: idSchema,\n enabledCapabilities: z.array(agentCapabilitySchema).default([]),\n recovery: z.object({\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n strategy: z.enum(['once', 'twice', 'until_grace_ends']).default('twice'),\n notificationTemplate: z.string().max(2000).nullable(),\n }),\n cashflow: z.object({\n digestEnabled: z.boolean().default(false),\n anomalySensitivity: z.enum(['low', 'medium', 'high']).default('medium'),\n autoConvertToYield: z.boolean().default(false),\n minimumLiquidReserveCents: z.number().int().nonnegative().default(100_000),\n }),\n commerce: z.object({\n requireHumanApprovalAboveUsdCents: z.number().int().nonnegative().default(100_000),\n approvedVendors: z.array(evmAddressSchema).default([]),\n monthlySpendCapUsdCents: z.number().int().nonnegative().nullable(),\n }),\n updatedAt: isoTimestampSchema,\n})\nexport type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>\n\nexport const updateAgentConfigInputSchema = agentMerchantConfigSchema\n .omit({ merchantId: true, updatedAt: true })\n .partial()\nexport type UpdateAgentConfigInput = z.input<typeof updateAgentConfigInputSchema>\nexport type UpdateAgentConfigParsed = z.output<typeof updateAgentConfigInputSchema>\n\n// ---------- Activity log ----------\n\nexport const agentActionTypeSchema = z.enum([\n 'recovery_notification_sent',\n 'recovery_retry_scheduled',\n 'recovery_retry_executed',\n 'recovery_abandoned',\n 'routing_bridge_initiated',\n 'routing_payment_completed',\n 'cashflow_digest_sent',\n 'cashflow_anomaly_flagged',\n 'cashflow_yield_converted',\n 'commerce_job_created',\n 'commerce_job_approved',\n 'commerce_job_completed',\n 'commerce_job_disputed',\n])\nexport type AgentActionType = z.infer<typeof agentActionTypeSchema>\n\nexport const agentActionOutcomeSchema = z.enum(['success', 'failure', 'pending', 'skipped'])\nexport type AgentActionOutcome = z.infer<typeof agentActionOutcomeSchema>\n\nexport const agentActivityLogSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n capability: agentCapabilitySchema,\n actionType: agentActionTypeSchema,\n outcome: agentActionOutcomeSchema,\n subscriptionId: idSchema.nullable(),\n transactionId: idSchema.nullable(),\n jobId: idSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n})\nexport type AgentActivityLog = z.infer<typeof agentActivityLogSchema>\n\n// ---------- ERC-8183 jobs ----------\n\n// Mirrors the DB `AgentJobStatus` enum, not the contract's JobStatus.\n// `accepted` is off-chain only (merchant approved, queued for on-chain\n// creation); `resolved` and `reclaimed` are the escrow's terminal exits\n// from a dispute and from a timeout reclaim respectively.\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'funded',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\n 'resolved',\n 'reclaimed',\n])\nexport type AgentJobStatus = z.infer<typeof agentJobStatusSchema>\n\nexport const agentJobSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /** On-chain job id from StrimzAgentEscrow. */\n onchainJobId: z.number().int().nonnegative().nullable(),\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n status: agentJobStatusSchema,\n assessorAddress: evmAddressSchema,\n deliverableHash: z\n .string()\n .regex(/^0x[a-fA-F0-9]+$/)\n .nullable(),\n escrowTxHash: evmTxHashSchema.nullable(),\n releaseTxHash: evmTxHashSchema.nullable(),\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type AgentJob = z.infer<typeof agentJobSchema>\n\nexport const createAgentJobInputSchema = z.object({\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n assessorAddress: evmAddressSchema.optional(),\n})\nexport type CreateAgentJobInput = z.input<typeof createAgentJobInputSchema>\nexport type CreateAgentJobParsed = z.output<typeof createAgentJobInputSchema>\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common.ts","../src/agents.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5C,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAA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,CAAE,WAAA,GAAc,QAAA,EAAS;AAAA,EACtD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,CAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,MAAA,EAAQ,oBAAA;AAAA,EACR,eAAA,EAAiB,gBAAA;AAAA,EACjB,iBAAiBA,CAAAA,CACd,MAAA,GACA,KAAA,CAAM,kBAAkB,EACxB,QAAA,EAAS;AAAA,EACZ,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,aAAA,EAAe,gBAAgB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,yBAAA,GAA4BA,EAAE,MAAA,CAAO;AAAA,EAChD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,CAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,eAAA,EAAiB,iBAAiB,QAAA;AACpC,CAAC","file":"agents.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Identity ----------\n\nexport const agentIdentitySchema = z.object({\n id: idSchema,\n /** ERC-8004 on-chain identity address. */\n onchainAddress: evmAddressSchema,\n /** Public key or agent credential digest, as emitted by ERC-8004. */\n credentialDigest: z.string().regex(/^0x[a-fA-F0-9]+$/),\n name: z.string().min(1).max(120),\n version: z.string().min(1).max(40),\n reputationScore: z.number().min(0).max(100).nullable(),\n registeredAt: isoTimestampSchema,\n})\nexport type AgentIdentity = z.infer<typeof agentIdentitySchema>\n\n// ---------- Merchant config ----------\n\nexport const agentCapabilitySchema = z.enum([\n 'identity',\n 'recovery',\n 'routing',\n 'cashflow',\n 'commerce',\n 'pricing_intelligence',\n])\nexport type AgentCapability = z.infer<typeof agentCapabilitySchema>\n\nconst enabledCapabilitiesSchema = z.array(agentCapabilitySchema)\nconst recoveryGracePeriodHoursSchema = z.union([z.literal(24), z.literal(48), z.literal(72)])\nconst recoveryStrategySchema = z.enum(['once', 'twice', 'until_grace_ends'])\nconst recoveryNotificationTemplateSchema = z.string().max(2000).nullable()\nconst cashflowDigestEnabledSchema = z.boolean()\nconst cashflowAnomalySensitivitySchema = z.enum(['low', 'medium', 'high'])\nconst cashflowAutoConvertToYieldSchema = z.boolean()\nconst cashflowMinimumLiquidReserveCentsSchema = z.number().int().nonnegative()\nconst commerceRequireHumanApprovalAboveUsdCentsSchema = z.number().int().nonnegative()\nconst commerceApprovedVendorsSchema = z.array(evmAddressSchema)\nconst commerceMonthlySpendCapUsdCentsSchema = z.number().int().nonnegative().nullable()\n\nexport const agentMerchantConfigSchema = z.object({\n merchantId: idSchema,\n enabledCapabilities: enabledCapabilitiesSchema.default([]),\n recovery: z.object({\n gracePeriodHours: recoveryGracePeriodHoursSchema.default(48),\n strategy: recoveryStrategySchema.default('twice'),\n notificationTemplate: recoveryNotificationTemplateSchema,\n }),\n cashflow: z.object({\n digestEnabled: cashflowDigestEnabledSchema.default(false),\n anomalySensitivity: cashflowAnomalySensitivitySchema.default('medium'),\n autoConvertToYield: cashflowAutoConvertToYieldSchema.default(false),\n minimumLiquidReserveCents: cashflowMinimumLiquidReserveCentsSchema.default(100_000),\n }),\n commerce: z.object({\n requireHumanApprovalAboveUsdCents:\n commerceRequireHumanApprovalAboveUsdCentsSchema.default(100_000),\n approvedVendors: commerceApprovedVendorsSchema.default([]),\n monthlySpendCapUsdCents: commerceMonthlySpendCapUsdCentsSchema,\n }),\n updatedAt: isoTimestampSchema,\n})\nexport type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>\n\nexport const updateAgentConfigInputSchema = z.object({\n enabledCapabilities: enabledCapabilitiesSchema.optional(),\n recovery: z\n .object({\n gracePeriodHours: recoveryGracePeriodHoursSchema.optional(),\n strategy: recoveryStrategySchema.optional(),\n notificationTemplate: recoveryNotificationTemplateSchema.optional(),\n })\n .optional(),\n cashflow: z\n .object({\n digestEnabled: cashflowDigestEnabledSchema.optional(),\n anomalySensitivity: cashflowAnomalySensitivitySchema.optional(),\n autoConvertToYield: cashflowAutoConvertToYieldSchema.optional(),\n minimumLiquidReserveCents: cashflowMinimumLiquidReserveCentsSchema.optional(),\n })\n .optional(),\n commerce: z\n .object({\n requireHumanApprovalAboveUsdCents: commerceRequireHumanApprovalAboveUsdCentsSchema.optional(),\n approvedVendors: commerceApprovedVendorsSchema.optional(),\n monthlySpendCapUsdCents: commerceMonthlySpendCapUsdCentsSchema.optional(),\n })\n .optional(),\n})\nexport type UpdateAgentConfigInput = z.input<typeof updateAgentConfigInputSchema>\nexport type UpdateAgentConfigParsed = z.output<typeof updateAgentConfigInputSchema>\n\n// ---------- Activity log ----------\n\nexport const agentActionTypeSchema = z.enum([\n 'recovery_notification_sent',\n 'recovery_retry_scheduled',\n 'recovery_retry_executed',\n 'recovery_abandoned',\n 'routing_bridge_initiated',\n 'routing_payment_completed',\n 'cashflow_digest_sent',\n 'cashflow_anomaly_flagged',\n 'cashflow_yield_converted',\n 'commerce_job_created',\n 'commerce_job_approved',\n 'commerce_job_completed',\n 'commerce_job_disputed',\n])\nexport type AgentActionType = z.infer<typeof agentActionTypeSchema>\n\nexport const agentActionOutcomeSchema = z.enum(['success', 'failure', 'pending', 'skipped'])\nexport type AgentActionOutcome = z.infer<typeof agentActionOutcomeSchema>\n\nexport const agentActivityLogSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n capability: agentCapabilitySchema,\n actionType: agentActionTypeSchema,\n outcome: agentActionOutcomeSchema,\n subscriptionId: idSchema.nullable(),\n transactionId: idSchema.nullable(),\n jobId: idSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n})\nexport type AgentActivityLog = z.infer<typeof agentActivityLogSchema>\n\n// ---------- ERC-8183 jobs ----------\n\n// Mirrors the DB `AgentJobStatus` enum, not the contract's JobStatus.\n// `accepted` is off-chain only (merchant approved, queued for on-chain\n// creation); `resolved` and `reclaimed` are the escrow's terminal exits\n// from a dispute and from a timeout reclaim respectively.\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'funded',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\n 'resolved',\n 'reclaimed',\n])\nexport type AgentJobStatus = z.infer<typeof agentJobStatusSchema>\n\nexport const agentJobSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /** On-chain job id from StrimzAgentEscrow. */\n onchainJobId: z.number().int().nonnegative().nullable(),\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n status: agentJobStatusSchema,\n assessorAddress: evmAddressSchema,\n deliverableHash: z\n .string()\n .regex(/^0x[a-fA-F0-9]+$/)\n .nullable(),\n escrowTxHash: evmTxHashSchema.nullable(),\n releaseTxHash: evmTxHashSchema.nullable(),\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type AgentJob = z.infer<typeof agentJobSchema>\n\nexport const createAgentJobInputSchema = z.object({\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n assessorAddress: evmAddressSchema.optional(),\n})\nexport type CreateAgentJobInput = z.input<typeof createAgentJobInputSchema>\nexport type CreateAgentJobParsed = z.output<typeof createAgentJobInputSchema>\n"]}
|