@weaccelerateinc/agent-sdk 0.0.0-stage → 0.10.3

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.
Files changed (52) hide show
  1. package/README.md +149 -2
  2. package/approved-extension-releases/0.0.0.1.json +39 -0
  3. package/approved-extension-releases/0.0.0.2.json +32 -0
  4. package/approved-extension.d.ts +24 -0
  5. package/approved-extension.js +90 -0
  6. package/browser-connector.d.ts +87 -0
  7. package/browser-connector.js +179 -0
  8. package/browser-operations.d.ts +56 -0
  9. package/browser-operations.js +144 -0
  10. package/browser-use-host.d.ts +43 -0
  11. package/browser-use-host.js +147 -0
  12. package/checkout-diagnostics.d.ts +23 -0
  13. package/checkout-diagnostics.js +67 -0
  14. package/cli.js +102 -0
  15. package/customer.env.example +6 -0
  16. package/host-adapter.d.ts +90 -0
  17. package/host-adapter.js +353 -0
  18. package/index.d.ts +209 -0
  19. package/index.js +441 -0
  20. package/linq-messaging.d.ts +45 -0
  21. package/linq-messaging.js +123 -0
  22. package/managed-mcp.d.ts +150 -0
  23. package/managed-mcp.js +382 -0
  24. package/package.json +114 -4
  25. package/partner-starter/.env.example +11 -0
  26. package/partner-starter/README.md +48 -0
  27. package/partner-starter/gitignore.template +5 -0
  28. package/partner-starter/package.json +21 -0
  29. package/partner-starter/runtime.mjs +32 -0
  30. package/partner-starter/server.mjs +13 -0
  31. package/partner-starter/smoke.mjs +56 -0
  32. package/partner-starter/synthetic.mjs +226 -0
  33. package/partner-starter/tests/starter.test.mjs +69 -0
  34. package/partner-starter/trusted-context.example.mjs +20 -0
  35. package/partner.d.ts +27 -0
  36. package/partner.js +49 -0
  37. package/postgres-host.d.ts +14 -0
  38. package/postgres-host.js +102 -0
  39. package/private-chat.d.ts +104 -0
  40. package/private-chat.js +309 -0
  41. package/private-ingress.d.ts +46 -0
  42. package/private-ingress.js +132 -0
  43. package/starter/.env.example +19 -0
  44. package/starter/README.md +88 -0
  45. package/starter/gitignore.template +5 -0
  46. package/starter/package.json +21 -0
  47. package/starter/runtime.mjs +61 -0
  48. package/starter/server.mjs +13 -0
  49. package/starter/smoke.mjs +55 -0
  50. package/starter/synthetic.mjs +163 -0
  51. package/starter/tests/starter.test.mjs +256 -0
  52. package/starter/trusted-context.example.mjs +49 -0
package/index.d.ts ADDED
@@ -0,0 +1,209 @@
1
+ import type { BrowserOperation, BrowserResult } from './browser-operations.js';
2
+ import type { CheckoutDiagnostics } from './checkout-diagnostics.js';
3
+ export { checkoutDiagnosticsJsonSchema, validateCheckoutDiagnostics } from './checkout-diagnostics.js';
4
+ export type { CheckoutDiagnostics, CheckoutDiagnosticStage, CheckoutDiagnosticAction, CheckoutCleanupStatus } from './checkout-diagnostics.js';
5
+ export type { BrowserOperation, BrowserResult, BrowserStep, BrowserCondition } from './browser-operations.js';
6
+
7
+ export type CheckoutId = `mcs_${string}`;
8
+ export type CheckoutPurpose = 'purchase' | 'sandbox_source_comparison' | 'sandbox_fill_only';
9
+ export type CheckoutStatus = 'wallet_required' | 'selection_ready' | 'details_ready' | 'approval_required' |
10
+ 'approved' | 'ready_for_submit' | 'cancelled' | 'expired' | 'failed' | 'submit_attempted' | 'outcome_unknown';
11
+ export interface RequestOptions { signal?: AbortSignal }
12
+ export interface WaitForCheckout {
13
+ /** Return on these states, or immediately on ready_for_submit or any terminal state. GET requests only. */
14
+ statuses: readonly CheckoutStatus[];
15
+ /** Overall wait, including requests. Default 60 seconds; range 1–300000 milliseconds. */
16
+ timeoutMs?: number;
17
+ /** Delay between successful status reads. Default 1000; range 250–5000 milliseconds. Errors are never retried. */
18
+ intervalMs?: number;
19
+ }
20
+ export type AccelerateNextAction = 'check_configuration' | 'check_request' | 'check_status' | 'complete_wallet' |
21
+ 'complete_verification' | 'refresh_quote' | 'refresh_revision' | 'reconcile_order' | 'stop';
22
+ export interface AccelerateEnvironment {
23
+ /** Optional HTTPS origin; defaults to Accelerate's hosted managed service. */
24
+ ACCELERATE_BASE_URL?: string;
25
+ ACCELERATE_API_KEY?: string;
26
+ ACCELERATE_MERCHANT_ID?: string;
27
+ }
28
+ export interface AccelerateConnection {
29
+ status: 'connected';
30
+ api_version: 'v1';
31
+ merchant_id: string;
32
+ interaction_modes: ['chat', 'hosted'];
33
+ currencies: ['USD'];
34
+ }
35
+ export interface Checkout {
36
+ id: CheckoutId;
37
+ status: CheckoutStatus;
38
+ revision: number;
39
+ expires_at: string;
40
+ /** Immutable policy metadata. Omitted only by service versions predating this field. */
41
+ purpose?: CheckoutPurpose;
42
+ /** Submission is enabled only for purchase purpose; never for sandbox_fill_only. */
43
+ submit_allowed?: boolean;
44
+ /** after_fill: final customer approval follows a privately delivered masked review. */
45
+ approval_policy?: 'after_fill';
46
+ purchase_approved?: boolean;
47
+ /** Explicit v2 policy acknowledged at creation; a later explicit quote arm lets private CVV continue
48
+ * one fill under the backend lock. Does not authorize final submission. */
49
+ fill_after_verification?: true;
50
+ card?: { last4: string | null; brand: string | null };
51
+ address?: { label: string | null; city?: string | null; state?: string | null; postal_code_mask?: string | null };
52
+ quote?: { checkout_origin: string; amount_cents: number; currency: 'USD' };
53
+ submit_expires_at?: string;
54
+ retry_safe: false;
55
+ payment_confirmed: false;
56
+ /** Negotiated safe metadata; absent when connecting to an older service. */
57
+ diagnostics?: CheckoutDiagnostics;
58
+ }
59
+ export interface CreatedCheckout extends Checkout { wallet_url?: string }
60
+ /** Server-owned existing browser, resolved from the authenticated application's
61
+ * durable browser record. Never accept this binding from model arguments.
62
+ * The customer backend retains provider access; this is not private-from-creation custody. */
63
+ export interface BrowserUseBrowserBinding {
64
+ provider: 'browser_use';
65
+ browser_id: string;
66
+ custody_mode: 'customer_backend_trusted';
67
+ }
68
+ /** Registered server-side executor connector; IDs are resolved from owned backend records. */
69
+ export interface RegisteredBrowserBinding {
70
+ provider: 'connector';
71
+ connector_id: string;
72
+ browser_id: string;
73
+ custody_mode: 'customer_backend_trusted';
74
+ }
75
+ export type CustomerBrowserBinding = BrowserUseBrowserBinding | RegisteredBrowserBinding;
76
+ /** Derive every field from authenticated server ownership and its immutable browser reservation. Never expose as model input. */
77
+ export interface CreationInspectionRequest {
78
+ customer_id: string;
79
+ workspace_id: string;
80
+ conversation_id: string;
81
+ idempotency_key: string;
82
+ browser: BrowserUseBrowserBinding;
83
+ }
84
+ export type CreationInspection = { confirmed: false } | {
85
+ confirmed: true;
86
+ checkout_id: CheckoutId;
87
+ revision: 0;
88
+ purpose: 'purchase' | 'sandbox_fill_only';
89
+ creation_key_sha256: string;
90
+ retirement: { browser_provider: 'browser_use'; browser_id: string; retired: true; provider_stopped: true; private_lease_closed: true; recording_disabled: true };
91
+ };
92
+ /** Read-only proof for an already terminal, retired fill-only attempt. Never permits replay or purchase. */
93
+ export interface RetirementInspectionRequest extends CreationInspectionRequest { revision: number; }
94
+ export type RetirementInspection = { confirmed: false } | {
95
+ confirmed: true;
96
+ checkout_id: CheckoutId;
97
+ revision: number;
98
+ status: 'outcome_unknown';
99
+ purpose: 'sandbox_fill_only';
100
+ approval_policy: 'after_fill';
101
+ submit_allowed: false;
102
+ purchase_approved: false;
103
+ creation_key_sha256: string;
104
+ retirement: Extract<CreationInspection, { confirmed: true }>['retirement'];
105
+ };
106
+ export interface CreateCheckout {
107
+ /** Derive from your server's authenticated user, never model input. */
108
+ customer_id: string;
109
+ /** Derive from the authenticated workspace. */
110
+ workspace_id: string;
111
+ phone_number: string;
112
+ start_url: string;
113
+ /** Reuse only for this exact creation attempt. */
114
+ idempotency_key: string;
115
+ /** Default hosted. Chat creates no hosted wallet link or browser session capability. */
116
+ interaction_mode?: 'hosted' | 'chat';
117
+ /** Required in chat mode; derive from the authenticated messaging webhook. */
118
+ conversation_id?: string;
119
+ /** Immutable. Source comparison cannot approve/fill/submit. Fill-only uses chat and can never submit. */
120
+ purpose?: CheckoutPurpose;
121
+ /** Defaults before_fill for compatibility. after_fill requires chat and private review delivery acknowledgement. */
122
+ approval_policy?: 'before_fill' | 'after_fill';
123
+ /** Declare v2 before OTP and require its true acknowledgement. Does not arm filling until requestApproval explicitly repeats true. */
124
+ fill_after_verification?: true;
125
+ /** Explicit chat/after_fill attachment. Omit to retain Accelerate-created
126
+ * private Kernel custody. Attachment never navigates or replaces the document. */
127
+ browser?: CustomerBrowserBinding;
128
+ /** Your own provider read of `browser`, so Accelerate never needs your provider API key.
129
+ * Send it on every create. It is held in memory for this checkout and never stored. */
130
+ browser_resource?: ClientBrowserResource;
131
+ }
132
+ /** The fields of Browser Use `GET /api/v4/browsers/{id}` that Accelerate needs. */
133
+ export interface ClientBrowserResource {
134
+ id: string;
135
+ status: 'active';
136
+ cdpUrl: string;
137
+ startedAt: string;
138
+ timeoutAt: string;
139
+ recordingAvailable: false;
140
+ metadata: Record<string, string>;
141
+ extensions: [{ id: string; version: string; runtimeId: string }];
142
+ }
143
+ /** Hypothesis to inspect against the actual checkout; never a caller assertion of currency evidence. */
144
+ export interface QuoteVerificationRequest {
145
+ revision: number;
146
+ checkout_url: string;
147
+ expected_amount_cents: number;
148
+ expected_currency: 'USD';
149
+ checkout_total_selector: string;
150
+ }
151
+ /** Read-only verification of this revision. Does not authorize approval, CVV, filling or submission. */
152
+ export interface VerifiedCheckoutQuote {
153
+ checkout_id: CheckoutId;
154
+ revision: number;
155
+ verified: true;
156
+ quote: { checkout_origin: string; amount_cents: number; currency: 'USD' };
157
+ }
158
+ export interface ApprovalRequest {
159
+ checkout_url: string;
160
+ amount_cents: number;
161
+ currency: 'USD';
162
+ checkout_total_selector: string;
163
+ submit_selector: string;
164
+ /** Opt in explicitly; only chat/after_fill purchase or sandbox_fill_only.
165
+ * Successful private verification fills this exact revision without AI. */
166
+ fill_after_verification?: true;
167
+ }
168
+ export interface AccelerateClientOptions {
169
+ baseUrl: string;
170
+ apiKey: string;
171
+ merchantId: string;
172
+ fetchImpl?: typeof fetch;
173
+ /** Test servers only. Production origins must use HTTPS. */
174
+ allowLoopbackForTests?: boolean;
175
+ }
176
+ export class AccelerateError extends Error {
177
+ readonly code: string;
178
+ readonly status: number;
179
+ readonly retrySafe: false;
180
+ readonly paymentConfirmed: false;
181
+ /** Fixed local guidance only; it never authorizes or performs a payment action. */
182
+ readonly nextAction: AccelerateNextAction;
183
+ /** Opaque support correlation only, never an authorization capability. */
184
+ readonly supportReference?: string;
185
+ constructor(code?: string, status?: number, supportReference?: string);
186
+ }
187
+ export class AccelerateClient {
188
+ /** Reads process.env by default. Requires API key and merchant ID; server only. */
189
+ static fromEnv(env?: AccelerateEnvironment): AccelerateClient;
190
+ constructor(options: AccelerateClientOptions);
191
+ /** Authenticated API/configuration check only; does not qualify downstream payment readiness. */
192
+ readonly connection: { check(options?: RequestOptions): Promise<AccelerateConnection> };
193
+ readonly checkouts: {
194
+ /** Pure inspection of an exact failed creation and authoritative provider/lease retirement; never creates, cancels, verifies or fills. */
195
+ inspectCreation(input: CreationInspectionRequest, options?: RequestOptions): Promise<CreationInspection>;
196
+ inspectRetirement(id: CheckoutId, input: RetirementInspectionRequest, options?: RequestOptions): Promise<RetirementInspection>;
197
+ create(input: CreateCheckout, options?: RequestOptions): Promise<CreatedCheckout>;
198
+ get(id: CheckoutId, options?: RequestOptions): Promise<Checkout>;
199
+ /** Stops on readiness/terminal states even if not requested; inspect returned status before continuing. */
200
+ waitFor(id: CheckoutId, input: WaitForCheckout, options?: RequestOptions): Promise<Checkout>;
201
+ browser(id: CheckoutId, input: BrowserOperation, options?: RequestOptions): Promise<BrowserResult>;
202
+ applyDetails(id: CheckoutId, input: { checkout_url: string }, options?: RequestOptions): Promise<Checkout>;
203
+ verifyQuote(id: CheckoutId, input: QuoteVerificationRequest, options?: RequestOptions): Promise<VerifiedCheckoutQuote>;
204
+ requestApproval(id: CheckoutId, input: ApprovalRequest, options?: RequestOptions): Promise<Checkout>;
205
+ fill(id: CheckoutId, input: { revision: number }, options?: RequestOptions): Promise<Checkout>;
206
+ submit(id: CheckoutId, input: { revision: number }, options?: RequestOptions): Promise<Checkout>;
207
+ cancel(id: CheckoutId, options?: RequestOptions): Promise<Checkout>;
208
+ };
209
+ }