@paybond/kit 0.11.11 → 0.12.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.
- package/completion-presets/catalog.json +10 -5
- package/completion-presets/catalog.sha256 +1 -1
- package/dist/agent/evidence.d.ts +10 -0
- package/dist/agent/evidence.js +16 -0
- package/dist/agent/index.d.ts +3 -2
- package/dist/agent/index.js +2 -1
- package/dist/agent/interceptor.d.ts +9 -0
- package/dist/agent/interceptor.js +181 -1
- package/dist/agent/receipt-client.d.ts +64 -0
- package/dist/agent/receipt-client.js +45 -0
- package/dist/agent/registry.js +1 -0
- package/dist/agent/run.d.ts +5 -0
- package/dist/agent/run.js +52 -0
- package/dist/agent/types.d.ts +70 -0
- package/dist/agent-mandate.d.ts +103 -0
- package/dist/agent-mandate.js +423 -0
- package/dist/agent-receipt-external-attestations.d.ts +56 -0
- package/dist/agent-receipt-external-attestations.js +185 -0
- package/dist/agent-receipt-pdf-export.d.ts +43 -0
- package/dist/agent-receipt-pdf-export.js +109 -0
- package/dist/agent-receipt-prevalidate.d.ts +7 -0
- package/dist/agent-receipt-prevalidate.js +63 -0
- package/dist/agent-receipt.d.ts +154 -0
- package/dist/agent-receipt.js +639 -0
- package/dist/audit/exports.d.ts +15 -1
- package/dist/audit/exports.js +55 -8
- package/dist/audit/index.d.ts +2 -2
- package/dist/audit/wire.d.ts +12 -0
- package/dist/audit/wire.js +13 -1
- package/dist/cli/command-spec.js +54 -3
- package/dist/cli/commands/dev.js +10 -3
- package/dist/cli/commands/discovery.js +17 -6
- package/dist/cli/commands/setup.js +19 -1
- package/dist/cli/commands/shopify.d.ts +53 -0
- package/dist/cli/commands/shopify.js +808 -0
- package/dist/cli/help.d.ts +1 -1
- package/dist/cli/help.js +15 -5
- package/dist/cli/router.js +15 -1
- package/dist/commerce-binding.d.ts +59 -0
- package/dist/commerce-binding.js +129 -0
- package/dist/completion-catalog-digest.d.ts +1 -1
- package/dist/completion-catalog-digest.js +1 -1
- package/dist/doctor-completion.d.ts +16 -0
- package/dist/doctor-completion.js +157 -1
- package/dist/index.d.ts +108 -7
- package/dist/index.js +221 -18
- package/dist/mcp-receipt-resource.d.ts +10 -0
- package/dist/mcp-receipt-resource.js +32 -0
- package/dist/mcp-server.d.ts +7 -0
- package/dist/mcp-server.js +81 -1
- package/dist/mpp-commercial.d.ts +19 -0
- package/dist/mpp-commercial.js +34 -0
- package/dist/mpp-funding.d.ts +71 -0
- package/dist/mpp-funding.js +192 -0
- package/dist/payment-transport.d.ts +30 -0
- package/dist/payment-transport.js +56 -0
- package/dist/policy/intent-spec.js +2 -0
- package/dist/policy/presets.d.ts +1 -1
- package/dist/policy/presets.js +1 -0
- package/dist/principal-intent.d.ts +1 -1
- package/dist/principal-intent.js +4 -1
- package/dist/project-init.d.ts +1 -1
- package/dist/project-init.js +1 -0
- package/dist/protocol-receipt.d.ts +129 -0
- package/dist/protocol-receipt.js +620 -0
- package/dist/shopify/checkout.d.ts +29 -0
- package/dist/shopify/checkout.js +79 -0
- package/dist/shopify/evidence.d.ts +13 -0
- package/dist/shopify/evidence.js +85 -0
- package/dist/shopify/index.d.ts +8 -0
- package/dist/shopify/index.js +6 -0
- package/dist/shopify/instrument.d.ts +61 -0
- package/dist/shopify/instrument.js +52 -0
- package/dist/shopify/order.d.ts +8 -0
- package/dist/shopify/order.js +110 -0
- package/dist/shopify/types.d.ts +82 -0
- package/dist/shopify/types.js +4 -0
- package/dist/solutions/catalog.d.ts +1 -1
- package/dist/solutions/catalog.js +1 -1
- package/dist/stripe-commerce/evidence.d.ts +13 -0
- package/dist/stripe-commerce/evidence.js +164 -0
- package/dist/stripe-commerce/index.d.ts +3 -0
- package/dist/stripe-commerce/index.js +2 -0
- package/dist/stripe-commerce/metadata.d.ts +11 -0
- package/dist/stripe-commerce/metadata.js +34 -0
- package/dist/stripe-commerce/types.d.ts +38 -0
- package/dist/stripe-commerce/types.js +1 -0
- package/dist/template-init.d.ts +1 -1
- package/dist/template-init.js +6 -1
- package/package.json +1 -1
- package/policy/presets/stripe-commerce.yaml +19 -0
- package/solutions/stripe-commerce.json +19 -0
- package/templates/manifest.json +82 -10
- package/templates/openai-shopping-agent/package-lock.json +13 -13
- package/templates/openai-shopping-agent/src/paybond.config.ts +1 -1
- package/templates/paybond-aws-operator/package-lock.json +7 -7
- package/templates/paybond-aws-operator/src/paybond.config.ts +1 -1
- package/templates/paybond-claude-agents-demo/package-lock.json +10 -10
- package/templates/paybond-claude-agents-demo/src/paybond.config.ts +1 -1
- package/templates/paybond-mastra-travel-agent/package-lock.json +33 -33
- package/templates/paybond-mastra-travel-agent/src/paybond.config.ts +1 -1
- package/templates/paybond-mcp-coding-agent/package-lock.json +7 -7
- package/templates/paybond-mcp-coding-agent/src/paybond.config.ts +1 -1
- package/templates/paybond-openai-agents-demo/package-lock.json +13 -13
- package/templates/paybond-openai-agents-demo/src/paybond.config.ts +1 -1
- package/templates/paybond-procurement-agent/package-lock.json +7 -7
- package/templates/paybond-procurement-agent/src/paybond.config.ts +1 -1
- package/templates/paybond-shopify-shopping-agent/.env.example +3 -0
- package/templates/paybond-shopify-shopping-agent/.github/workflows/smoke.yml +20 -0
- package/templates/paybond-shopify-shopping-agent/LICENSE +201 -0
- package/templates/paybond-shopify-shopping-agent/README.md +29 -0
- package/templates/paybond-shopify-shopping-agent/package-lock.json +223 -0
- package/templates/paybond-shopify-shopping-agent/package.json +20 -0
- package/templates/paybond-shopify-shopping-agent/paybond.policy.yaml +22 -0
- package/templates/paybond-shopify-shopping-agent/src/index.ts +54 -0
- package/templates/paybond-shopify-shopping-agent/src/paybond.config.ts +51 -0
- package/templates/paybond-shopify-shopping-agent/tsconfig.json +13 -0
- package/templates/paybond-stripe-agent-demo/.env.example +9 -0
- package/templates/paybond-stripe-agent-demo/.github/workflows/smoke.yml +20 -0
- package/templates/paybond-stripe-agent-demo/LICENSE +201 -0
- package/templates/paybond-stripe-agent-demo/README.md +50 -0
- package/templates/paybond-stripe-agent-demo/package-lock.json +223 -0
- package/templates/paybond-stripe-agent-demo/package.json +20 -0
- package/templates/paybond-stripe-agent-demo/paybond.policy.yaml +22 -0
- package/templates/paybond-stripe-agent-demo/src/charge-customer.ts +237 -0
- package/templates/paybond-stripe-agent-demo/src/index.ts +78 -0
- package/templates/paybond-stripe-agent-demo/src/paybond.config.ts +51 -0
- package/templates/paybond-stripe-agent-demo/tsconfig.json +13 -0
- package/templates/paybond-travel-agent/package-lock.json +13 -13
- package/templates/paybond-travel-agent/src/paybond.config.ts +1 -1
- package/templates/paybond-vercel-shopping-agent/package-lock.json +7 -7
- package/templates/paybond-vercel-shopping-agent/src/paybond.config.ts +1 -1
package/dist/audit/exports.js
CHANGED
|
@@ -34,22 +34,28 @@ export class GatewayAuditExportsClient {
|
|
|
34
34
|
async getJson(path) {
|
|
35
35
|
return this.requestJSON("GET", path);
|
|
36
36
|
}
|
|
37
|
+
async postJson(path, body) {
|
|
38
|
+
return this.requestJSON("POST", path, body);
|
|
39
|
+
}
|
|
37
40
|
async deleteJson(path) {
|
|
38
41
|
return this.requestJSON("DELETE", path);
|
|
39
42
|
}
|
|
40
|
-
async requestJSON(method, path) {
|
|
43
|
+
async requestJSON(method, path, body) {
|
|
41
44
|
const url = `${this.base}${path.replace(/^\//, "")}`;
|
|
42
45
|
let lastErr;
|
|
43
46
|
for (let attempt = 0; attempt < this.maxRetries; attempt++) {
|
|
44
47
|
let res;
|
|
45
48
|
try {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
const headers = {
|
|
50
|
+
accept: "application/json",
|
|
51
|
+
authorization: `Bearer ${this.bearerToken}`,
|
|
52
|
+
};
|
|
53
|
+
const init = { method, headers };
|
|
54
|
+
if (method === "POST") {
|
|
55
|
+
headers["content-type"] = "application/json";
|
|
56
|
+
init.body = JSON.stringify(body ?? {});
|
|
57
|
+
}
|
|
58
|
+
res = await fetch(url, init);
|
|
53
59
|
}
|
|
54
60
|
catch (err) {
|
|
55
61
|
lastErr = err;
|
|
@@ -80,6 +86,36 @@ export class GatewayAuditExportsClient {
|
|
|
80
86
|
throw lastErr instanceof Error ? lastErr : new Error(String(lastErr));
|
|
81
87
|
}
|
|
82
88
|
}
|
|
89
|
+
function buildAuditExportCreateBody(params) {
|
|
90
|
+
const filter = {};
|
|
91
|
+
const f = params.filter;
|
|
92
|
+
if (f.time_start?.trim()) {
|
|
93
|
+
filter.time_start = f.time_start.trim();
|
|
94
|
+
}
|
|
95
|
+
if (f.time_end?.trim()) {
|
|
96
|
+
filter.time_end = f.time_end.trim();
|
|
97
|
+
}
|
|
98
|
+
if (f.intent_id?.trim()) {
|
|
99
|
+
filter.intent_id = f.intent_id.trim();
|
|
100
|
+
}
|
|
101
|
+
if (f.case_id?.trim()) {
|
|
102
|
+
filter.case_id = f.case_id.trim();
|
|
103
|
+
}
|
|
104
|
+
if (f.operator_did?.trim()) {
|
|
105
|
+
filter.operator_did = f.operator_did.trim();
|
|
106
|
+
}
|
|
107
|
+
if (f.includes && f.includes.length > 0) {
|
|
108
|
+
filter.includes = [...f.includes];
|
|
109
|
+
}
|
|
110
|
+
const body = {
|
|
111
|
+
filter,
|
|
112
|
+
disclosure_tier: params.disclosureTier ?? "standard",
|
|
113
|
+
};
|
|
114
|
+
if (params.retentionHours != null && params.retentionHours > 0) {
|
|
115
|
+
body.retention_hours = params.retentionHours;
|
|
116
|
+
}
|
|
117
|
+
return body;
|
|
118
|
+
}
|
|
83
119
|
/**
|
|
84
120
|
* SDK surface for compliance audit export jobs and local bundle verification.
|
|
85
121
|
*/
|
|
@@ -111,6 +147,17 @@ export class PaybondAuditExports {
|
|
|
111
147
|
const body = await this.gateway.getJson(`/v1/compliance/audit-exports/${encodeURIComponent(jobId)}${query}`);
|
|
112
148
|
return parseAuditExportJobGet(body);
|
|
113
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Create a compliance audit export job (`POST /v1/compliance/audit-exports`).
|
|
152
|
+
* Tenant scope comes from the API key — never pass a tenant id.
|
|
153
|
+
*/
|
|
154
|
+
async create(params) {
|
|
155
|
+
if (!this.gateway.postJson) {
|
|
156
|
+
throw new Error("audit export create is not supported by this gateway adapter");
|
|
157
|
+
}
|
|
158
|
+
const body = await this.gateway.postJson("/v1/compliance/audit-exports", buildAuditExportCreateBody(params));
|
|
159
|
+
return parseAuditExportJobGet(body);
|
|
160
|
+
}
|
|
114
161
|
async delete(jobId) {
|
|
115
162
|
if (!this.gateway.deleteJson) {
|
|
116
163
|
throw new Error("audit export delete is not supported by this gateway adapter");
|
package/dist/audit/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { GatewayAuditExportsClient, PaybondAudit, PaybondAuditExports, type AuditExportsGateway, type GatewayAuditExportsClientOptions, type PaybondAuditExportsGetParams, type PaybondAuditExportsListParams, } from "./exports.js";
|
|
1
|
+
export { GatewayAuditExportsClient, PaybondAudit, PaybondAuditExports, type AuditExportsGateway, type GatewayAuditExportsClientOptions, type PaybondAuditExportsCreateParams, type PaybondAuditExportsGetParams, type PaybondAuditExportsListParams, } from "./exports.js";
|
|
2
2
|
export { auditVerifyResult, buildManifestCore, manifestCoreBytes, readManifestFromBundle, verifyAuditBundleLocal, verifyAuditManifest, MANIFEST_CORE_FIELD_ORDER, } from "./verify.js";
|
|
3
|
-
export { parseAuditExportJobGet, parseAuditExportList, type AuditExportJobDetail, type AuditExportJobGetResponse, type AuditExportJobSummary, type AuditExportListPage, type AuditVerifyResult, } from "./wire.js";
|
|
3
|
+
export { parseAuditExportJobGet, parseAuditExportList, type AuditExportCreateFilter, type AuditExportJobDetail, type AuditExportJobGetResponse, type AuditExportJobSummary, type AuditExportListPage, type AuditVerifyResult, } from "./wire.js";
|
package/dist/audit/wire.d.ts
CHANGED
|
@@ -14,6 +14,14 @@ export type AuditExportListPage = Readonly<{
|
|
|
14
14
|
jobs: ReadonlyArray<AuditExportJobSummary>;
|
|
15
15
|
next_cursor?: string;
|
|
16
16
|
}>;
|
|
17
|
+
export type AuditExportCreateFilter = Readonly<{
|
|
18
|
+
time_start?: string;
|
|
19
|
+
time_end?: string;
|
|
20
|
+
intent_id?: string;
|
|
21
|
+
case_id?: string;
|
|
22
|
+
operator_did?: string;
|
|
23
|
+
includes?: ReadonlyArray<string>;
|
|
24
|
+
}>;
|
|
17
25
|
export type AuditExportJobDetail = Readonly<{
|
|
18
26
|
id: string;
|
|
19
27
|
status: string;
|
|
@@ -25,6 +33,10 @@ export type AuditExportJobDetail = Readonly<{
|
|
|
25
33
|
manifest_sha256: string;
|
|
26
34
|
bundle_sha256: string;
|
|
27
35
|
download_token?: string;
|
|
36
|
+
/** Present on `POST /v1/compliance/audit-exports` create responses. */
|
|
37
|
+
bundle_size_bytes?: number;
|
|
38
|
+
download_token_expires?: string;
|
|
39
|
+
download_path?: string;
|
|
28
40
|
}>;
|
|
29
41
|
export type AuditExportJobGetResponse = Readonly<{
|
|
30
42
|
job: AuditExportJobDetail;
|
package/dist/audit/wire.js
CHANGED
|
@@ -52,17 +52,29 @@ export function parseAuditExportJobGet(json) {
|
|
|
52
52
|
assertJsonObject(json);
|
|
53
53
|
const jobRaw = json.job ?? json;
|
|
54
54
|
assertJsonObject(jobRaw);
|
|
55
|
+
const bundleSize = typeof jobRaw.bundle_size_bytes === "number" && Number.isFinite(jobRaw.bundle_size_bytes)
|
|
56
|
+
? jobRaw.bundle_size_bytes
|
|
57
|
+
: undefined;
|
|
58
|
+
const downloadTokenExpires = typeof jobRaw.download_token_expires === "string" && jobRaw.download_token_expires
|
|
59
|
+
? jobRaw.download_token_expires
|
|
60
|
+
: typeof jobRaw.download_token_expires_at === "string" && jobRaw.download_token_expires_at
|
|
61
|
+
? jobRaw.download_token_expires_at
|
|
62
|
+
: undefined;
|
|
63
|
+
const downloadPath = typeof jobRaw.download_path === "string" && jobRaw.download_path ? jobRaw.download_path : undefined;
|
|
55
64
|
const job = {
|
|
56
65
|
id: readString(jobRaw.id ?? jobRaw.job_id, "job.id"),
|
|
57
66
|
status: readString(jobRaw.status, "job.status"),
|
|
58
67
|
tenant_realm_id: readString(jobRaw.tenant_realm_id, "job.tenant_realm_id"),
|
|
59
68
|
disclosure_tier: readString(jobRaw.disclosure_tier, "job.disclosure_tier"),
|
|
60
|
-
created_at:
|
|
69
|
+
created_at: typeof jobRaw.created_at === "string" ? jobRaw.created_at : "",
|
|
61
70
|
expires_at: readString(jobRaw.expires_at, "job.expires_at"),
|
|
62
71
|
error: typeof jobRaw.error === "string" ? jobRaw.error : "",
|
|
63
72
|
manifest_sha256: typeof jobRaw.manifest_sha256 === "string" ? jobRaw.manifest_sha256 : "",
|
|
64
73
|
bundle_sha256: typeof jobRaw.bundle_sha256 === "string" ? jobRaw.bundle_sha256 : "",
|
|
65
74
|
download_token: typeof jobRaw.download_token === "string" && jobRaw.download_token ? jobRaw.download_token : undefined,
|
|
75
|
+
bundle_size_bytes: bundleSize,
|
|
76
|
+
download_token_expires: downloadTokenExpires,
|
|
77
|
+
download_path: downloadPath,
|
|
66
78
|
};
|
|
67
79
|
return { job };
|
|
68
80
|
}
|
package/dist/cli/command-spec.js
CHANGED
|
@@ -29,6 +29,16 @@ export const COMMAND_PATHS = [
|
|
|
29
29
|
"dev trace",
|
|
30
30
|
"dev loop",
|
|
31
31
|
"dev up",
|
|
32
|
+
"shopify doctor",
|
|
33
|
+
"shopify link",
|
|
34
|
+
"shopify dev",
|
|
35
|
+
"shopify webhook trigger",
|
|
36
|
+
"shopify checkout smoke",
|
|
37
|
+
"shopify order show",
|
|
38
|
+
"shopify capture ready",
|
|
39
|
+
"shopify payments doctor",
|
|
40
|
+
"shopify payments smoke",
|
|
41
|
+
"shopify payments session show",
|
|
32
42
|
"version",
|
|
33
43
|
"diagnose",
|
|
34
44
|
"config get",
|
|
@@ -196,7 +206,8 @@ export const COMMAND_EXAMPLES = {
|
|
|
196
206
|
],
|
|
197
207
|
"doctor": [
|
|
198
208
|
"paybond doctor",
|
|
199
|
-
"paybond doctor --agent --format json"
|
|
209
|
+
"paybond doctor --agent --format json",
|
|
210
|
+
"paybond doctor --shopify"
|
|
200
211
|
],
|
|
201
212
|
"dev": [
|
|
202
213
|
"paybond dev smoke --offline",
|
|
@@ -216,6 +227,7 @@ export const COMMAND_EXAMPLES = {
|
|
|
216
227
|
"dev loop": [
|
|
217
228
|
"paybond dev loop",
|
|
218
229
|
"paybond dev loop --offline",
|
|
230
|
+
"paybond dev loop --preset shopping --shopify",
|
|
219
231
|
"paybond dev loop --format json"
|
|
220
232
|
],
|
|
221
233
|
"dev up": [
|
|
@@ -223,6 +235,43 @@ export const COMMAND_EXAMPLES = {
|
|
|
223
235
|
"paybond dev up --port 18089",
|
|
224
236
|
"paybond dev up --down"
|
|
225
237
|
],
|
|
238
|
+
"shopify doctor": [
|
|
239
|
+
"paybond shopify doctor",
|
|
240
|
+
"paybond shopify doctor --format json"
|
|
241
|
+
],
|
|
242
|
+
"shopify link": [
|
|
243
|
+
"paybond shopify link"
|
|
244
|
+
],
|
|
245
|
+
"shopify dev": [
|
|
246
|
+
"paybond shopify dev",
|
|
247
|
+
"paybond shopify dev --tunnel https://example.ngrok-free.app"
|
|
248
|
+
],
|
|
249
|
+
"shopify webhook trigger": [
|
|
250
|
+
"paybond shopify webhook trigger --topic orders/paid --gateway https://api.paybond.ai",
|
|
251
|
+
"paybond shopify webhook trigger --address http://127.0.0.1:8081/webhooks/sandbox/shopify --dry-run"
|
|
252
|
+
],
|
|
253
|
+
"shopify checkout smoke": [
|
|
254
|
+
"paybond shopify checkout smoke --shop paybond-agent-commerce-dev.myshopify.com",
|
|
255
|
+
"paybond shopify checkout smoke --offline --format json"
|
|
256
|
+
],
|
|
257
|
+
"shopify order show": [
|
|
258
|
+
"paybond shopify order show gid://shopify/Order/123 --shop paybond-agent-commerce-dev.myshopify.com"
|
|
259
|
+
],
|
|
260
|
+
"shopify capture ready": [
|
|
261
|
+
"paybond shopify capture ready",
|
|
262
|
+
"paybond shopify capture ready --format json"
|
|
263
|
+
],
|
|
264
|
+
"shopify payments doctor": [
|
|
265
|
+
"paybond shopify payments doctor",
|
|
266
|
+
"paybond shopify payments doctor --format json"
|
|
267
|
+
],
|
|
268
|
+
"shopify payments smoke": [
|
|
269
|
+
"paybond shopify payments smoke --shop paybond-agent-commerce-dev.myshopify.com",
|
|
270
|
+
"paybond shopify payments smoke --offline --format json"
|
|
271
|
+
],
|
|
272
|
+
"shopify payments session show": [
|
|
273
|
+
"paybond shopify payments session show paybond-smoke-payment-session --shop paybond-agent-commerce-dev.myshopify.com"
|
|
274
|
+
],
|
|
226
275
|
"version": [
|
|
227
276
|
"paybond version",
|
|
228
277
|
"paybond version --verbose --format json"
|
|
@@ -296,10 +345,12 @@ export const COMMAND_EXAMPLES = {
|
|
|
296
345
|
"paybond signal fraud --did did:example:alice"
|
|
297
346
|
],
|
|
298
347
|
"receipts get": [
|
|
299
|
-
"paybond receipts get receipt-123"
|
|
348
|
+
"paybond receipts get receipt-123",
|
|
349
|
+
"paybond receipts get sha256:abc... --kind agent --format json"
|
|
300
350
|
],
|
|
301
351
|
"receipts verify": [
|
|
302
|
-
"paybond receipts verify receipt-123"
|
|
352
|
+
"paybond receipts verify receipt-123",
|
|
353
|
+
"paybond receipts verify sha256:abc... --kind agent --format json"
|
|
303
354
|
],
|
|
304
355
|
"mandates verify": [
|
|
305
356
|
"paybond mandates verify --body mandate.json"
|
package/dist/cli/commands/dev.js
CHANGED
|
@@ -11,6 +11,7 @@ import { CliError } from "../types.js";
|
|
|
11
11
|
import { handleAgentSandboxSmoke } from "./agent.js";
|
|
12
12
|
import { handleLogin } from "./setup.js";
|
|
13
13
|
import { handlePolicyInit, handlePolicyValidateTools } from "./policy.js";
|
|
14
|
+
import { buildShopifyNextStepsBanner } from "./shopify.js";
|
|
14
15
|
import { scheduleCliCommandTelemetry } from "../telemetry.js";
|
|
15
16
|
function devCliError(message, options) {
|
|
16
17
|
return new CliError(message, {
|
|
@@ -229,6 +230,10 @@ export async function handleDevLoop(ctx, argv) {
|
|
|
229
230
|
rest = offlineFlag.rest;
|
|
230
231
|
const policyFlag = consumeFlag(rest, "--policy-file");
|
|
231
232
|
rest = policyFlag.rest;
|
|
233
|
+
const presetFlag = consumeFlag(rest, "--preset");
|
|
234
|
+
rest = presetFlag.rest;
|
|
235
|
+
const shopifyFlag = consumeBooleanFlag(rest, "--shopify");
|
|
236
|
+
rest = shopifyFlag.rest;
|
|
232
237
|
const noLoginFlag = consumeBooleanFlag(rest, "--no-login");
|
|
233
238
|
rest = noLoginFlag.rest;
|
|
234
239
|
if (rest.length > 0) {
|
|
@@ -237,6 +242,7 @@ export async function handleDevLoop(ctx, argv) {
|
|
|
237
242
|
category: "usage",
|
|
238
243
|
});
|
|
239
244
|
}
|
|
245
|
+
const preset = presetFlag.value?.trim() || DEV_DEFAULT_PRESET;
|
|
240
246
|
const policyFile = policyFlag.value?.trim() || DEV_DEFAULT_POLICY_FILE;
|
|
241
247
|
const steps = [];
|
|
242
248
|
const bannerLines = buildDevStartupBannerLines();
|
|
@@ -279,7 +285,7 @@ export async function handleDevLoop(ctx, argv) {
|
|
|
279
285
|
}
|
|
280
286
|
const initResult = await handlePolicyInit(activeCtx, [
|
|
281
287
|
"--preset",
|
|
282
|
-
|
|
288
|
+
preset,
|
|
283
289
|
"--out",
|
|
284
290
|
policyFile,
|
|
285
291
|
"--force",
|
|
@@ -303,13 +309,14 @@ export async function handleDevLoop(ctx, argv) {
|
|
|
303
309
|
details: { steps },
|
|
304
310
|
});
|
|
305
311
|
}
|
|
306
|
-
const smokeResult = await runDevSmokeCore(activeCtx,
|
|
312
|
+
const smokeResult = await runDevSmokeCore(activeCtx, preset, offlineFlag.present);
|
|
307
313
|
steps.push({ name: "smoke", ok: true, data: smokeResult.data });
|
|
308
314
|
const traceUrl = String(smokeResult.data.trace_url ?? devTraceUrl());
|
|
309
315
|
const auditLog = String(smokeResult.data.audit_log ?? resolve(ctx.cwd, ".paybond/dev-audit.jsonl"));
|
|
310
316
|
const smokeChecklist = Array.isArray(smokeResult.data.checklist_lines)
|
|
311
317
|
? smokeResult.data.checklist_lines
|
|
312
318
|
: [];
|
|
319
|
+
const shopifyBanner = shopifyFlag.present ? buildShopifyNextStepsBanner() : [];
|
|
313
320
|
scheduleCliCommandTelemetry(activeCtx, {
|
|
314
321
|
commandPath: "dev loop",
|
|
315
322
|
offline: offlineFlag.present,
|
|
@@ -321,7 +328,7 @@ export async function handleDevLoop(ctx, argv) {
|
|
|
321
328
|
smoke: smokeResult.data,
|
|
322
329
|
trace_url: traceUrl,
|
|
323
330
|
audit_log: auditLog,
|
|
324
|
-
banner_lines: bannerLines,
|
|
331
|
+
banner_lines: [...bannerLines, ...shopifyBanner],
|
|
325
332
|
checklist_lines: appendDevLoopTraceLine(smokeChecklist, traceUrl, ctx.globals),
|
|
326
333
|
},
|
|
327
334
|
warnings: smokeResult.warnings,
|
|
@@ -7,10 +7,8 @@ import { consumeBooleanFlag, consumeFlag } from "../globals.js";
|
|
|
7
7
|
import { CliError } from "../types.js";
|
|
8
8
|
export async function handleSignal(ctx, subcommand, argv) {
|
|
9
9
|
return withGateway(ctx, async (gateway) => {
|
|
10
|
-
const principal = await gateway.getJson("/v1/auth/principal");
|
|
11
|
-
const tenantId = String(principal.tenant_id ?? "");
|
|
12
10
|
if (subcommand === "portfolio") {
|
|
13
|
-
const body = await gateway.getJson(
|
|
11
|
+
const body = await gateway.getJson("/signal/v1/portfolio/summary");
|
|
14
12
|
return { data: body };
|
|
15
13
|
}
|
|
16
14
|
const didFlag = consumeFlag(argv, "--did");
|
|
@@ -18,11 +16,11 @@ export async function handleSignal(ctx, subcommand, argv) {
|
|
|
18
16
|
throw new CliError(`signal ${subcommand} requires --did`, { category: "usage", code: "cli.usage.missing_did" });
|
|
19
17
|
}
|
|
20
18
|
if (subcommand === "reputation") {
|
|
21
|
-
const body = await gateway.getJson(`/
|
|
19
|
+
const body = await gateway.getJson(`/reputation/${encodeURIComponent(didFlag.value)}`);
|
|
22
20
|
return { data: body };
|
|
23
21
|
}
|
|
24
22
|
if (subcommand === "fraud") {
|
|
25
|
-
const body = await gateway.getJson(`/
|
|
23
|
+
const body = await gateway.getJson(`/signal/v1/operators/${encodeURIComponent(didFlag.value)}/review-status`);
|
|
26
24
|
return { data: body };
|
|
27
25
|
}
|
|
28
26
|
throw new CliError(`unknown signal subcommand: ${subcommand}`, { category: "usage", code: "cli.usage.unknown_command" });
|
|
@@ -30,10 +28,23 @@ export async function handleSignal(ctx, subcommand, argv) {
|
|
|
30
28
|
}
|
|
31
29
|
export async function handleReceipts(ctx, subcommand, argv) {
|
|
32
30
|
return withGateway(ctx, async (gateway) => {
|
|
31
|
+
const kindFlag = consumeFlag(argv, "--kind");
|
|
32
|
+
const kind = (kindFlag.value ?? "protocol").trim().toLowerCase();
|
|
33
33
|
const receiptId = argv[0];
|
|
34
34
|
if (!receiptId) {
|
|
35
35
|
throw new CliError(`receipts ${subcommand} requires <receipt_id>`, { category: "usage", code: "cli.usage.missing_receipt_id" });
|
|
36
36
|
}
|
|
37
|
+
if (kind === "agent") {
|
|
38
|
+
if (subcommand === "get") {
|
|
39
|
+
const body = await gateway.getJson(`/protocol/v2/agent-receipts/${encodeURIComponent(receiptId)}`);
|
|
40
|
+
return { data: body };
|
|
41
|
+
}
|
|
42
|
+
if (subcommand === "verify") {
|
|
43
|
+
const fetched = await gateway.getJson(`/protocol/v2/agent-receipts/${encodeURIComponent(receiptId)}`);
|
|
44
|
+
const body = await gateway.postJson("/protocol/v2/agent-receipts/verify", fetched);
|
|
45
|
+
return { data: body };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
37
48
|
if (subcommand === "get") {
|
|
38
49
|
const body = await gateway.getJson(`/protocol/v2/receipts/${encodeURIComponent(receiptId)}`);
|
|
39
50
|
return { data: body };
|
|
@@ -55,7 +66,7 @@ export async function handleMandates(ctx, subcommand, argv) {
|
|
|
55
66
|
return { data: body };
|
|
56
67
|
}
|
|
57
68
|
if (subcommand === "import") {
|
|
58
|
-
const body = await gateway.postJson("/protocol/v2/mandates
|
|
69
|
+
const body = await gateway.postJson("/protocol/v2/mandates", payload);
|
|
59
70
|
return { data: body };
|
|
60
71
|
}
|
|
61
72
|
throw new CliError(`unknown mandates subcommand: ${subcommand}`, { category: "usage", code: "cli.usage.unknown_command" });
|
|
@@ -22,6 +22,7 @@ import { copyTemplateToDirectory, normalizeTemplateId, templateInitUsage, } from
|
|
|
22
22
|
import { parseArgs as parseLoginArgs, runLogin } from "../../login.js";
|
|
23
23
|
import { main as runMcpServerMain } from "../../mcp-server.js";
|
|
24
24
|
import { PaybondMCPServer } from "../../mcp-server.js";
|
|
25
|
+
import { runShopifyDoctorChecks } from "./shopify.js";
|
|
25
26
|
async function readJsonFile(filePath) {
|
|
26
27
|
return readJsonBody(filePath, process.stdin);
|
|
27
28
|
}
|
|
@@ -124,6 +125,19 @@ export async function handleInitWizard(ctx, argv) {
|
|
|
124
125
|
});
|
|
125
126
|
return { data: result };
|
|
126
127
|
}
|
|
128
|
+
if (parsed.solution === "shopping" && parsed.framework === "shopify") {
|
|
129
|
+
const result = await copyTemplateToDirectory({
|
|
130
|
+
cwd: ctx.cwd,
|
|
131
|
+
templateId: normalizeTemplateId("shopify-shopping-agent"),
|
|
132
|
+
force: parsed.force,
|
|
133
|
+
writeStdout(line) {
|
|
134
|
+
if (ctx.globals.format !== "json") {
|
|
135
|
+
ctx.stdout.write(`${line}\n`);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
return { data: result };
|
|
140
|
+
}
|
|
127
141
|
const { template: _template, ...wizardOptions } = parsed;
|
|
128
142
|
const result = await runProjectInit({
|
|
129
143
|
cwd: ctx.cwd,
|
|
@@ -353,7 +367,8 @@ export async function handleMcpVerifyConfig(ctx, argv) {
|
|
|
353
367
|
}
|
|
354
368
|
export async function handleDoctor(ctx, argv) {
|
|
355
369
|
const agentFlag = consumeBooleanFlag(argv, "--agent");
|
|
356
|
-
const
|
|
370
|
+
const shopifyFlag = consumeBooleanFlag(agentFlag.rest, "--shopify");
|
|
371
|
+
const hostFlag = consumeFlag(shopifyFlag.rest, "--host");
|
|
357
372
|
const checks = [];
|
|
358
373
|
const defaults = resolvedDefaultsForDoctor(ctx.globals);
|
|
359
374
|
checks.push({
|
|
@@ -436,6 +451,9 @@ export async function handleDoctor(ctx, argv) {
|
|
|
436
451
|
});
|
|
437
452
|
}
|
|
438
453
|
}
|
|
454
|
+
if (shopifyFlag.present) {
|
|
455
|
+
checks.push(...(await runShopifyDoctorChecks(ctx)));
|
|
456
|
+
}
|
|
439
457
|
const completionChecks = await runCompletionCatalogDoctorChecks({
|
|
440
458
|
cwd: ctx.cwd,
|
|
441
459
|
gateway: apiKey
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CliContext } from "../context.js";
|
|
2
|
+
import { type CommandResult } from "../types.js";
|
|
3
|
+
export type ShopifyDoctorCheck = {
|
|
4
|
+
name: string;
|
|
5
|
+
ok: boolean;
|
|
6
|
+
message: string;
|
|
7
|
+
details?: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
type ExternalCommandResult = {
|
|
10
|
+
code: number;
|
|
11
|
+
stdout: string;
|
|
12
|
+
stderr: string;
|
|
13
|
+
};
|
|
14
|
+
type ShopifyCommandHooks = {
|
|
15
|
+
whichExecutable?: (name: string) => Promise<string | null>;
|
|
16
|
+
runCommand?: (command: string, args: string[]) => Promise<ExternalCommandResult>;
|
|
17
|
+
};
|
|
18
|
+
/** Test hook: override external CLI discovery and execution. */
|
|
19
|
+
export declare function setShopifyCommandHooks(hooks: ShopifyCommandHooks): void;
|
|
20
|
+
export type ShopifyAppTomlInfo = {
|
|
21
|
+
exists: boolean;
|
|
22
|
+
clientId?: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Parse `client_id` from a linked `shopify.app.toml` in the working directory. */
|
|
26
|
+
export declare function readShopifyAppToml(cwd: string): Promise<ShopifyAppTomlInfo>;
|
|
27
|
+
export declare function formatShopifyDoctorChecklist(checks: ShopifyDoctorCheck[], useColor: boolean): string[];
|
|
28
|
+
export declare function buildShopifyNextStepsBanner(shopDomain?: string): string[];
|
|
29
|
+
/** Resolve a Paybond gateway origin to the Shopify sandbox webhook path. */
|
|
30
|
+
export declare function resolveShopifyWebhookAddress(gatewayBase: string, tunnel?: string): string;
|
|
31
|
+
export declare function buildShopifyWebhookTriggerCommand(input: {
|
|
32
|
+
topic: string;
|
|
33
|
+
address: string;
|
|
34
|
+
clientId?: string;
|
|
35
|
+
}): string[];
|
|
36
|
+
/** Locate a Paybond Payments `shopify.app.toml` for local dev (cwd or monorepo app path). */
|
|
37
|
+
export declare function readShopifyPaymentsAppToml(cwd: string): Promise<ShopifyAppTomlInfo>;
|
|
38
|
+
export declare function buildShopifyPaymentsNextStepsBanner(shopDomain?: string): string[];
|
|
39
|
+
/** Readiness checks for Paybond + Shopify local development. */
|
|
40
|
+
export declare function runShopifyDoctorChecks(ctx: CliContext): Promise<ShopifyDoctorCheck[]>;
|
|
41
|
+
export declare function handleShopifyDoctor(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
42
|
+
export declare function handleShopifyLink(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
43
|
+
export declare function handleShopifyDev(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
44
|
+
export declare function handleShopifyWebhookTrigger(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
45
|
+
export declare function handleShopifyCheckoutSmoke(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
46
|
+
export declare function handleShopifyOrderShow(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
47
|
+
export declare function handleShopifyCaptureReady(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
48
|
+
export declare function runShopifyPaymentsDoctorChecks(ctx: CliContext): Promise<ShopifyDoctorCheck[]>;
|
|
49
|
+
export declare function handleShopifyPaymentsDoctor(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
50
|
+
export declare function handleShopifyPaymentsSmoke(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
51
|
+
export declare function handleShopifyPaymentsSessionShow(ctx: CliContext, argv: string[]): Promise<CommandResult>;
|
|
52
|
+
export declare function handleShopify(ctx: CliContext, subcommand: string, third: string | undefined, fourth: string | undefined, argv: string[]): Promise<CommandResult>;
|
|
53
|
+
export {};
|