@helix-agent/core 0.1.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.
Files changed (82) hide show
  1. package/README.md +22 -0
  2. package/dist/engine/bus.d.ts +12 -0
  3. package/dist/engine/bus.d.ts.map +1 -0
  4. package/dist/engine/bus.js +39 -0
  5. package/dist/engine/bus.js.map +1 -0
  6. package/dist/engine/evaluate.d.ts +3 -0
  7. package/dist/engine/evaluate.d.ts.map +1 -0
  8. package/dist/engine/evaluate.js +22 -0
  9. package/dist/engine/evaluate.js.map +1 -0
  10. package/dist/engine/gene-map.d.ts +19 -0
  11. package/dist/engine/gene-map.d.ts.map +1 -0
  12. package/dist/engine/gene-map.js +130 -0
  13. package/dist/engine/gene-map.js.map +1 -0
  14. package/dist/engine/pcec.d.ts +35 -0
  15. package/dist/engine/pcec.d.ts.map +1 -0
  16. package/dist/engine/pcec.js +253 -0
  17. package/dist/engine/pcec.js.map +1 -0
  18. package/dist/engine/types.d.ts +83 -0
  19. package/dist/engine/types.d.ts.map +1 -0
  20. package/dist/engine/types.js +33 -0
  21. package/dist/engine/types.js.map +1 -0
  22. package/dist/engine/wrap.d.ts +6 -0
  23. package/dist/engine/wrap.d.ts.map +1 -0
  24. package/dist/engine/wrap.js +74 -0
  25. package/dist/engine/wrap.js.map +1 -0
  26. package/dist/index.d.ts +10 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +11 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/platforms/generic/index.d.ts +3 -0
  31. package/dist/platforms/generic/index.d.ts.map +1 -0
  32. package/dist/platforms/generic/index.js +3 -0
  33. package/dist/platforms/generic/index.js.map +1 -0
  34. package/dist/platforms/generic/perceive.d.ts +3 -0
  35. package/dist/platforms/generic/perceive.d.ts.map +1 -0
  36. package/dist/platforms/generic/perceive.js +20 -0
  37. package/dist/platforms/generic/perceive.js.map +1 -0
  38. package/dist/platforms/generic/strategies.d.ts +3 -0
  39. package/dist/platforms/generic/strategies.d.ts.map +1 -0
  40. package/dist/platforms/generic/strategies.js +16 -0
  41. package/dist/platforms/generic/strategies.js.map +1 -0
  42. package/dist/platforms/index.d.ts +7 -0
  43. package/dist/platforms/index.d.ts.map +1 -0
  44. package/dist/platforms/index.js +36 -0
  45. package/dist/platforms/index.js.map +1 -0
  46. package/dist/platforms/privy/index.d.ts +3 -0
  47. package/dist/platforms/privy/index.d.ts.map +1 -0
  48. package/dist/platforms/privy/index.js +3 -0
  49. package/dist/platforms/privy/index.js.map +1 -0
  50. package/dist/platforms/privy/perceive.d.ts +3 -0
  51. package/dist/platforms/privy/perceive.d.ts.map +1 -0
  52. package/dist/platforms/privy/perceive.js +28 -0
  53. package/dist/platforms/privy/perceive.js.map +1 -0
  54. package/dist/platforms/privy/strategies.d.ts +3 -0
  55. package/dist/platforms/privy/strategies.d.ts.map +1 -0
  56. package/dist/platforms/privy/strategies.js +39 -0
  57. package/dist/platforms/privy/strategies.js.map +1 -0
  58. package/dist/platforms/stripe/index.d.ts +3 -0
  59. package/dist/platforms/stripe/index.d.ts.map +1 -0
  60. package/dist/platforms/stripe/index.js +3 -0
  61. package/dist/platforms/stripe/index.js.map +1 -0
  62. package/dist/platforms/stripe/perceive.d.ts +3 -0
  63. package/dist/platforms/stripe/perceive.d.ts.map +1 -0
  64. package/dist/platforms/stripe/perceive.js +14 -0
  65. package/dist/platforms/stripe/perceive.js.map +1 -0
  66. package/dist/platforms/stripe/strategies.d.ts +3 -0
  67. package/dist/platforms/stripe/strategies.d.ts.map +1 -0
  68. package/dist/platforms/stripe/strategies.js +6 -0
  69. package/dist/platforms/stripe/strategies.js.map +1 -0
  70. package/dist/platforms/tempo/index.d.ts +3 -0
  71. package/dist/platforms/tempo/index.d.ts.map +1 -0
  72. package/dist/platforms/tempo/index.js +3 -0
  73. package/dist/platforms/tempo/index.js.map +1 -0
  74. package/dist/platforms/tempo/perceive.d.ts +3 -0
  75. package/dist/platforms/tempo/perceive.d.ts.map +1 -0
  76. package/dist/platforms/tempo/perceive.js +35 -0
  77. package/dist/platforms/tempo/perceive.js.map +1 -0
  78. package/dist/platforms/tempo/strategies.d.ts +3 -0
  79. package/dist/platforms/tempo/strategies.d.ts.map +1 -0
  80. package/dist/platforms/tempo/strategies.js +68 -0
  81. package/dist/platforms/tempo/strategies.js.map +1 -0
  82. package/package.json +50 -0
@@ -0,0 +1,83 @@
1
+ export type ErrorCode = 'payment-required' | 'payment-insufficient' | 'payment-expired' | 'verification-failed' | 'method-unsupported' | 'malformed-credential' | 'invalid-challenge' | 'tx-reverted' | 'swap-reverted' | 'token-uninitialized' | 'tip-403' | 'policy-violation' | 'cascade-failure' | 'offramp-failed' | 'rate-limited' | 'server-error' | 'timeout' | 'unknown';
2
+ export type FailureCategory = 'balance' | 'session' | 'currency' | 'signature' | 'batch' | 'service' | 'dex' | 'compliance' | 'cascade' | 'offramp' | 'network' | 'policy' | 'auth' | 'unknown';
3
+ export type Severity = 'low' | 'medium' | 'high' | 'critical';
4
+ export type Platform = 'tempo' | 'privy' | 'stripe' | 'generic' | 'unknown';
5
+ export interface FailureClassification {
6
+ code: ErrorCode;
7
+ category: FailureCategory;
8
+ severity: Severity;
9
+ platform: Platform;
10
+ details: string;
11
+ timestamp: number;
12
+ actualBalance?: number;
13
+ requiredAmount?: number;
14
+ chainId?: number;
15
+ walletAddress?: string;
16
+ }
17
+ export interface RepairCandidate {
18
+ id: string;
19
+ strategy: string;
20
+ description: string;
21
+ estimatedCostUsd: number;
22
+ estimatedSpeedMs: number;
23
+ requirements: string[];
24
+ score: number;
25
+ successProbability: number;
26
+ platform: Platform;
27
+ }
28
+ export interface GeneCapsule {
29
+ id?: number;
30
+ failureCode: ErrorCode;
31
+ category: FailureCategory;
32
+ strategy: string;
33
+ params: Record<string, unknown>;
34
+ successCount: number;
35
+ avgRepairMs: number;
36
+ platforms: Platform[];
37
+ createdAt?: string;
38
+ lastUsedAt?: string;
39
+ }
40
+ export interface RepairResult {
41
+ success: boolean;
42
+ failure: FailureClassification;
43
+ candidates: RepairCandidate[];
44
+ winner: RepairCandidate | null;
45
+ gene: GeneCapsule | null;
46
+ immune: boolean;
47
+ totalMs: number;
48
+ revenueProtected: number;
49
+ }
50
+ export interface PlatformAdapter {
51
+ name: Platform;
52
+ perceive(error: Error, context?: Record<string, unknown>): FailureClassification | null;
53
+ construct(failure: FailureClassification): RepairCandidate[];
54
+ }
55
+ export type SseEventType = 'perceive' | 'construct' | 'evaluate' | 'commit' | 'gene' | 'immune' | 'error' | 'stats' | 'retry';
56
+ export interface SseEvent {
57
+ type: SseEventType;
58
+ agentId: string;
59
+ timestamp: number;
60
+ data: Record<string, unknown>;
61
+ }
62
+ export interface HelixConfig {
63
+ projectName: string;
64
+ walletAddress: string;
65
+ stablecoins: string[];
66
+ monthlyBudget: number;
67
+ maxRetries: number;
68
+ timeoutMs: number;
69
+ dashboardPort: number;
70
+ verbose: boolean;
71
+ geneMapPath: string;
72
+ }
73
+ export interface WrapOptions {
74
+ agentId?: string;
75
+ maxRetries?: number;
76
+ verbose?: boolean;
77
+ geneMapPath?: string;
78
+ platforms?: string[];
79
+ config?: Partial<HelixConfig>;
80
+ }
81
+ export declare const REVENUE_AT_RISK: Record<string, number>;
82
+ export declare const DEFAULT_CONFIG: HelixConfig;
83
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/engine/types.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAEjB,kBAAkB,GAClB,sBAAsB,GACtB,iBAAiB,GACjB,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,mBAAmB,GAEnB,aAAa,GACb,eAAe,GACf,qBAAqB,GAErB,SAAS,GACT,kBAAkB,GAElB,iBAAiB,GACjB,gBAAgB,GAEhB,cAAc,GACd,cAAc,GACd,SAAS,GAET,SAAS,CAAC;AAMd,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,SAAS,GACT,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AAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/B;AAID,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAelD,CAAC;AAIF,eAAO,MAAM,cAAc,EAAE,WAU5B,CAAC"}
@@ -0,0 +1,33 @@
1
+ // ── Error Codes ──────────────────────────────────────────────────
2
+ // Platform-agnostic error codes. Each platform's perceive() maps
3
+ // platform-specific errors to these universal codes.
4
+ // ── Revenue estimates per category ──────────────────────────────
5
+ export const REVENUE_AT_RISK = {
6
+ balance: 150,
7
+ session: 50,
8
+ currency: 200,
9
+ signature: 100,
10
+ batch: 500,
11
+ service: 300,
12
+ dex: 175,
13
+ compliance: 250,
14
+ cascade: 1000,
15
+ offramp: 400,
16
+ network: 100,
17
+ policy: 200,
18
+ auth: 50,
19
+ unknown: 50,
20
+ };
21
+ // ── Default Config ──────────────────────────────────────────────
22
+ export const DEFAULT_CONFIG = {
23
+ projectName: 'helix-agent',
24
+ walletAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18',
25
+ stablecoins: ['USDC', 'USDT', 'DAI'],
26
+ monthlyBudget: 10000,
27
+ maxRetries: 3,
28
+ timeoutMs: 30000,
29
+ dashboardPort: 7842,
30
+ verbose: true,
31
+ geneMapPath: './helix-genes.db',
32
+ };
33
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/engine/types.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,iEAAiE;AACjE,qDAAqD;AA6JrD,mEAAmE;AAEnE,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,GAAG;IACb,SAAS,EAAE,GAAG;IACd,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,GAAG;IACZ,GAAG,EAAE,GAAG;IACR,UAAU,EAAE,GAAG;IACf,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,mEAAmE;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAgB;IACzC,WAAW,EAAE,aAAa;IAC1B,aAAa,EAAE,4CAA4C;IAC3D,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;IACpC,aAAa,EAAE,KAAK;IACpB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,kBAAkB;CAChC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { PcecEngine } from './pcec.js';
2
+ import type { WrapOptions } from './types.js';
3
+ export declare function createEngine(options?: WrapOptions): PcecEngine;
4
+ export declare function wrap<TArgs extends unknown[], TResult>(fn: (...args: TArgs) => Promise<TResult>, options?: WrapOptions): (...args: TArgs) => Promise<TResult>;
5
+ export declare function shutdown(): void;
6
+ //# sourceMappingURL=wrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../src/engine/wrap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,YAAY,CAAC;AAO5D,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAW9D;AAmBD,wBAAgB,IAAI,CAAC,KAAK,SAAS,OAAO,EAAE,EAAE,OAAO,EACnD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,EACxC,OAAO,CAAC,EAAE,WAAW,GACpB,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CA6CtC;AAED,wBAAgB,QAAQ,IAAI,IAAI,CAI/B"}
@@ -0,0 +1,74 @@
1
+ import { bus } from './bus.js';
2
+ import { GeneMap } from './gene-map.js';
3
+ import { PcecEngine } from './pcec.js';
4
+ import { DEFAULT_CONFIG } from './types.js';
5
+ import { defaultAdapters } from '../platforms/index.js';
6
+ let _defaultEngine = null;
7
+ let _defaultGeneMap = null;
8
+ export function createEngine(options) {
9
+ const geneMap = new GeneMap(options?.geneMapPath ?? options?.config?.geneMapPath ?? DEFAULT_CONFIG.geneMapPath);
10
+ const engine = new PcecEngine(geneMap, options?.agentId ?? options?.config?.projectName ?? 'default');
11
+ for (const adapter of defaultAdapters) {
12
+ if (!options?.platforms || options.platforms.includes(adapter.name) || adapter.name === 'generic') {
13
+ engine.registerAdapter(adapter);
14
+ }
15
+ }
16
+ return engine;
17
+ }
18
+ function getDefaultEngine(options) {
19
+ if (!_defaultEngine) {
20
+ const geneMap = new GeneMap(options?.geneMapPath ?? options?.config?.geneMapPath ?? DEFAULT_CONFIG.geneMapPath);
21
+ const engine = new PcecEngine(geneMap, options?.agentId ?? 'default');
22
+ for (const adapter of defaultAdapters) {
23
+ if (!options?.platforms || options.platforms.includes(adapter.name) || adapter.name === 'generic') {
24
+ engine.registerAdapter(adapter);
25
+ }
26
+ }
27
+ _defaultEngine = engine;
28
+ _defaultGeneMap = geneMap;
29
+ }
30
+ return { engine: _defaultEngine, geneMap: _defaultGeneMap };
31
+ }
32
+ export function wrap(fn, options) {
33
+ const maxRetries = options?.maxRetries ?? options?.config?.maxRetries ?? DEFAULT_CONFIG.maxRetries;
34
+ const verbose = options?.verbose ?? options?.config?.verbose ?? DEFAULT_CONFIG.verbose;
35
+ const agentId = options?.agentId ?? 'wrapped';
36
+ return async (...args) => {
37
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
38
+ try {
39
+ return await fn(...args);
40
+ }
41
+ catch (error) {
42
+ if (attempt === maxRetries) {
43
+ if (verbose) {
44
+ console.error(`\x1b[31m[helix] All ${maxRetries} repair attempts exhausted\x1b[0m`);
45
+ }
46
+ throw error;
47
+ }
48
+ const { engine } = getDefaultEngine(options);
49
+ if (verbose) {
50
+ console.log(`\x1b[33m[helix] Payment failed (attempt ${attempt + 1}/${maxRetries}), engaging PCEC...\x1b[0m`);
51
+ }
52
+ bus.emit('retry', agentId, { attempt: attempt + 1, maxRetries });
53
+ const result = await engine.repair(error);
54
+ if (!result.success) {
55
+ if (verbose) {
56
+ console.error(`\x1b[31m[helix] PCEC repair failed, retrying...\x1b[0m`);
57
+ }
58
+ }
59
+ else if (verbose) {
60
+ const tag = result.immune ? '\x1b[36m⚡ IMMUNE' : '\x1b[32m✓ REPAIRED';
61
+ console.log(`${tag}\x1b[0m via ${result.winner?.strategy} in ${result.totalMs}ms ` +
62
+ `($${result.revenueProtected} protected)`);
63
+ }
64
+ }
65
+ }
66
+ throw new Error('Helix: unexpected repair loop exit');
67
+ };
68
+ }
69
+ export function shutdown() {
70
+ _defaultGeneMap?.close();
71
+ _defaultGeneMap = null;
72
+ _defaultEngine = null;
73
+ }
74
+ //# sourceMappingURL=wrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../src/engine/wrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CA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AA4B,CACjG,CAAC;gBACJ,CAAC;gBAED,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;gBAEjE,MAAM,MAAM,GAAiB,MAAM,MAAM,CAAC,MAAM,CAAC,KAAc,CAAC,CAAC;gBAEjE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;oBACpB,IAAI,OAAO,EAAE,CAAC;wBACZ,OAAO,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;oBAC1E,CAAC;gBACH,CAAC;qBAAM,IAAI,OAAO,EAAE,CAAC;oBACnB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,oBAAoB,CAAC;oBACtE,OAAO,CAAC,GAAG,CACT,GAAG,GAAG,eAAe,MAAM,CAAC,MAAM,EAAE,QAAQ,OAAO,MAAM,CAAC,OAAO,KAAK;wBACpE,KAAK,MAAM,CAAC,gBAAgB,aAAa,CAC5C,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,eAAe,EAAE,KAAK,EAAE,CAAC;IACzB,eAAe,GAAG,IAAI,CAAC;IACvB,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { wrap, createEngine, shutdown } from './engine/wrap.js';
2
+ export type { WrapOptions } from './engine/types.js';
3
+ export type { FailureClassification, RepairCandidate, GeneCapsule, RepairResult, PlatformAdapter, ErrorCode, FailureCategory, Platform, Severity, SseEvent, SseEventType, HelixConfig, } from './engine/types.js';
4
+ export { REVENUE_AT_RISK, DEFAULT_CONFIG } from './engine/types.js';
5
+ export { tempoAdapter, privyAdapter, genericAdapter, stripeAdapter, defaultAdapters } from './platforms/index.js';
6
+ export { PcecEngine } from './engine/pcec.js';
7
+ export { GeneMap } from './engine/gene-map.js';
8
+ export { EventBus, bus } from './engine/bus.js';
9
+ export { evaluate } from './engine/evaluate.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EACV,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGlH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ // ── Public API ──
2
+ export { wrap, createEngine, shutdown } from './engine/wrap.js';
3
+ export { REVENUE_AT_RISK, DEFAULT_CONFIG } from './engine/types.js';
4
+ // ── Platform adapters (for advanced users) ──
5
+ export { tempoAdapter, privyAdapter, genericAdapter, stripeAdapter, defaultAdapters } from './platforms/index.js';
6
+ // ── Engine internals (for advanced users) ──
7
+ export { PcecEngine } from './engine/pcec.js';
8
+ export { GeneMap } from './engine/gene-map.js';
9
+ export { EventBus, bus } from './engine/bus.js';
10
+ export { evaluate } from './engine/evaluate.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAmBhE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEpE,+CAA+C;AAC/C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAElH,8CAA8C;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { genericPerceive } from './perceive.js';
2
+ export { genericConstruct } from './strategies.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platforms/generic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { genericPerceive } from './perceive.js';
2
+ export { genericConstruct } from './strategies.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platforms/generic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { FailureClassification } from '../../engine/types.js';
2
+ export declare function genericPerceive(error: Error, _context?: Record<string, unknown>): FailureClassification | null;
3
+ //# sourceMappingURL=perceive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perceive.d.ts","sourceRoot":"","sources":["../../../src/platforms/generic/perceive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,qBAAqB,GAAG,IAAI,CAwB9G"}
@@ -0,0 +1,20 @@
1
+ export function genericPerceive(error, _context) {
2
+ const msg = error.message;
3
+ // 429 Rate Limited
4
+ if (msg.includes('429') || msg.includes('rate limit') || msg.includes('Too Many Requests'))
5
+ return { code: 'rate-limited', category: 'auth', severity: 'medium', platform: 'generic', details: msg, timestamp: Date.now() };
6
+ // 500/502/503 Server Error
7
+ if (msg.includes('500') || msg.includes('502') || msg.includes('503') || msg.includes('Internal Server Error'))
8
+ return { code: 'server-error', category: 'service', severity: 'high', platform: 'generic', details: msg, timestamp: Date.now() };
9
+ // Timeout
10
+ if (msg.includes('timeout') || msg.includes('ETIMEDOUT') || msg.includes('ECONNRESET') || msg.includes('exceeded'))
11
+ return { code: 'timeout', category: 'service', severity: 'medium', platform: 'generic', details: msg, timestamp: Date.now() };
12
+ // JSON parse error (malformed response)
13
+ if (msg.includes('JSON') || msg.includes('Unexpected token'))
14
+ return { code: 'malformed-credential', category: 'service', severity: 'medium', platform: 'generic', details: msg, timestamp: Date.now() };
15
+ // Connection refused
16
+ if (msg.includes('ECONNREFUSED') || msg.includes('connect'))
17
+ return { code: 'server-error', category: 'service', severity: 'high', platform: 'generic', details: msg, timestamp: Date.now() };
18
+ return null;
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,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAEhI,wCAAwC;IACxC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAC1D,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAE7I,qBAAqB;IACrB,IAAI,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC;QACzD,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAEnI,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { FailureClassification, RepairCandidate } from '../../engine/types.js';
2
+ export declare function genericConstruct(failure: FailureClassification): RepairCandidate[];
3
+ //# sourceMappingURL=strategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../../../src/platforms/generic/strategies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEpF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,EAAE,CAclF"}
@@ -0,0 +1,16 @@
1
+ export function genericConstruct(failure) {
2
+ if (failure.category === 'auth') {
3
+ return [
4
+ { id: 'backoff_retry', strategy: 'backoff_retry', description: 'Exponential backoff and retry', estimatedCostUsd: 0, estimatedSpeedMs: 2000, requirements: [], score: 0, successProbability: 0.85, platform: 'generic' },
5
+ { id: 'switch_endpoint', strategy: 'switch_endpoint', description: 'Switch to backup API endpoint', estimatedCostUsd: 0, estimatedSpeedMs: 100, requirements: ['alt_endpoint'], score: 0, successProbability: 0.80, platform: 'generic' },
6
+ ];
7
+ }
8
+ if (failure.category === 'service') {
9
+ return [
10
+ { id: 'retry', strategy: 'retry', description: 'Simple retry after delay', estimatedCostUsd: 0, estimatedSpeedMs: 1000, requirements: [], score: 0, successProbability: 0.70, platform: 'generic' },
11
+ { id: 'switch_provider', strategy: 'switch_provider', description: 'Switch to backup service provider', estimatedCostUsd: 0, estimatedSpeedMs: 200, requirements: ['alt_provider'], score: 0, successProbability: 0.85, platform: 'generic' },
12
+ ];
13
+ }
14
+ return [];
15
+ }
16
+ //# sourceMappingURL=strategies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategies.js","sourceRoot":"","sources":["../../../src/platforms/generic/strategies.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,OAA8B;IAC7D,IAAI,OAAO,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QAChC,OAAO;YACL,EAAE,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE;YACxN,EAAE,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,WAAW,EAAE,+BAA+B,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE;SAC1O,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO;YACL,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE;YACnM,EAAE,EAAE,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,WAAW,EAAE,mCAAmC,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE;SAC9O,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { PlatformAdapter } from '../engine/types.js';
2
+ export declare const tempoAdapter: PlatformAdapter;
3
+ export declare const privyAdapter: PlatformAdapter;
4
+ export declare const genericAdapter: PlatformAdapter;
5
+ export declare const stripeAdapter: PlatformAdapter;
6
+ export declare const defaultAdapters: PlatformAdapter[];
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platforms/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAU1D,eAAO,MAAM,YAAY,EAAE,eAI1B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,eAI1B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,eAI5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,eAI3B,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,eAAe,EAK5C,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { tempoPerceive } from './tempo/perceive.js';
2
+ import { tempoConstruct } from './tempo/strategies.js';
3
+ import { privyPerceive } from './privy/perceive.js';
4
+ import { privyConstruct } from './privy/strategies.js';
5
+ import { genericPerceive } from './generic/perceive.js';
6
+ import { genericConstruct } from './generic/strategies.js';
7
+ import { stripePerceive } from './stripe/perceive.js';
8
+ import { stripeConstruct } from './stripe/strategies.js';
9
+ export const tempoAdapter = {
10
+ name: 'tempo',
11
+ perceive: tempoPerceive,
12
+ construct: tempoConstruct,
13
+ };
14
+ export const privyAdapter = {
15
+ name: 'privy',
16
+ perceive: privyPerceive,
17
+ construct: privyConstruct,
18
+ };
19
+ export const genericAdapter = {
20
+ name: 'generic',
21
+ perceive: genericPerceive,
22
+ construct: genericConstruct,
23
+ };
24
+ export const stripeAdapter = {
25
+ name: 'stripe',
26
+ perceive: stripePerceive,
27
+ construct: stripeConstruct,
28
+ };
29
+ // Default adapter chain: Tempo → Privy → Stripe → Generic (fallback)
30
+ export const defaultAdapters = [
31
+ tempoAdapter,
32
+ privyAdapter,
33
+ stripeAdapter,
34
+ genericAdapter, // always last — catches everything
35
+ ];
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platforms/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,CAAC,MAAM,YAAY,GAAoB;IAC3C,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,cAAc;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAoB;IAC3C,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,cAAc;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC7C,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,eAAe;IACzB,SAAS,EAAE,gBAAgB;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAoB;IAC5C,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,cAAc;IACxB,SAAS,EAAE,eAAe;CAC3B,CAAC;AAEF,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,YAAY;IACZ,YAAY;IACZ,aAAa;IACb,cAAc,EAAE,mCAAmC;CACpD,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { privyPerceive } from './perceive.js';
2
+ export { privyConstruct } from './strategies.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platforms/privy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { privyPerceive } from './perceive.js';
2
+ export { privyConstruct } from './strategies.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platforms/privy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { FailureClassification } from '../../engine/types.js';
2
+ export declare function privyPerceive(error: Error, _context?: Record<string, unknown>): FailureClassification | null;
3
+ //# sourceMappingURL=perceive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perceive.d.ts","sourceRoot":"","sources":["../../../src/platforms/privy/perceive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAKnE,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,qBAAqB,GAAG,IAAI,CAgC5G"}
@@ -0,0 +1,28 @@
1
+ // ONLY client-side failures that Helix can actually fix.
2
+ // Server-side Privy infra failures (TEE down, signing timeout) are NOT included.
3
+ export function privyPerceive(error, _context) {
4
+ const msg = error.message;
5
+ // Policy spending limit — Helix can split transaction
6
+ if (msg.includes('policy') && (msg.includes('AMOUNT_EXCEEDS_LIMIT') || msg.includes('spending limit') || msg.includes('policy violation')))
7
+ return { code: 'policy-violation', category: 'policy', severity: 'high', platform: 'privy', details: msg, timestamp: Date.now() };
8
+ // Nonce desync — wallet internal nonce != chain nonce
9
+ if (msg.includes('nonce') && msg.includes('mismatch') && (msg.includes('wallet') || msg.includes('internal')))
10
+ return { code: 'verification-failed', category: 'signature', severity: 'high', platform: 'privy', details: msg, timestamp: Date.now() };
11
+ // Gas sponsor exhausted — Privy auto-sponsor ran out
12
+ if (msg.includes('gas sponsorship') || (msg.includes('sponsor') && msg.includes('depleted')))
13
+ return { code: 'payment-insufficient', category: 'balance', severity: 'high', platform: 'privy', details: msg, timestamp: Date.now() };
14
+ // Cross-chain mismatch — wallet provisioned on wrong chain
15
+ if (msg.includes('chain') && msg.includes('mismatch') && (msg.includes('wallet') || msg.includes('provisioned')))
16
+ return { code: 'token-uninitialized', category: 'network', severity: 'high', platform: 'privy', details: msg, timestamp: Date.now() };
17
+ // #NEW-1: Insufficient wallet balance (not gas, actual tx value)
18
+ if (msg.includes('insufficient funds') && msg.includes('transaction') && !msg.includes('gas'))
19
+ return { code: 'payment-insufficient', category: 'balance', severity: 'high', platform: 'privy', details: msg, timestamp: Date.now() };
20
+ // #NEW-2: Transaction broadcast failure — nonce conflict
21
+ if (msg.includes('broadcast') && (msg.includes('nonce') || msg.includes('sequencing')))
22
+ return { code: 'verification-failed', category: 'signature', severity: 'high', platform: 'privy', details: msg, timestamp: Date.now() };
23
+ // #NEW-3: Transaction broadcast failure — invalid params
24
+ if (msg.includes('broadcast') && (msg.includes('invalid') || msg.includes('malformed')))
25
+ return { code: 'malformed-credential', category: 'service', severity: 'medium', platform: 'privy', details: msg, timestamp: Date.now() };
26
+ return null; // not a Privy error
27
+ }
28
+ //# sourceMappingURL=perceive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perceive.js","sourceRoot":"","sources":["../../../src/platforms/privy/perceive.ts"],"names":[],"mappings":"AAEA,yDAAyD;AACzD,iFAAiF;AAEjF,MAAM,UAAU,aAAa,CAAC,KAAY,EAAE,QAAkC;IAC5E,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC;IAE1B,sDAAsD;IACtD,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;QACxI,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAEpI,sDAAsD;IACt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AQ,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC3F,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAEzI,yDAAyD;IACzD,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QACpF,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAE1I,yDAAyD;IACzD,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACrF,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAE3I,OAAO,IAAI,CAAC,CAAC,oBAAoB;AACnC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { FailureClassification, RepairCandidate } from '../../engine/types.js';
2
+ export declare function privyConstruct(failure: FailureClassification): RepairCandidate[];
3
+ //# sourceMappingURL=strategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../../../src/platforms/privy/strategies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEpF,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,eAAe,EAAE,CA0ChF"}
@@ -0,0 +1,39 @@
1
+ export function privyConstruct(failure) {
2
+ // Privy-unique category: 'policy'
3
+ if (failure.category === 'policy') {
4
+ return [
5
+ { id: 'split_transaction', strategy: 'split_transaction', description: 'Split into multiple transactions under spending limit', estimatedCostUsd: 0.02, estimatedSpeedMs: 400, requirements: [], score: 0, successProbability: 0.90, platform: 'privy' },
6
+ { id: 'use_unrestricted_wallet', strategy: 'use_unrestricted_wallet', description: 'Switch to wallet with higher spending limits', estimatedCostUsd: 0, estimatedSpeedMs: 200, requirements: ['alt_wallet'], score: 0, successProbability: 0.85, platform: 'privy' },
7
+ ];
8
+ }
9
+ // For categories that overlap with Tempo (signature, balance, network),
10
+ // Privy can add platform-specific candidates alongside Tempo's:
11
+ if (failure.platform === 'privy' && failure.category === 'signature') {
12
+ return [
13
+ { id: 'refresh_nonce_from_chain', strategy: 'refresh_nonce', description: 'Sync wallet nonce with on-chain state', estimatedCostUsd: 0, estimatedSpeedMs: 200, requirements: [], score: 0, successProbability: 0.93, platform: 'privy' },
14
+ { id: 'cancel_pending_txs', strategy: 'cancel_pending_txs', description: 'Cancel stuck pending transactions to reset nonce', estimatedCostUsd: 0.01, estimatedSpeedMs: 600, requirements: [], score: 0, successProbability: 0.80, platform: 'privy' },
15
+ ];
16
+ }
17
+ if (failure.platform === 'privy' && failure.category === 'balance') {
18
+ return [
19
+ { id: 'self_pay_gas', strategy: 'self_pay_gas', description: 'Fallback to self-pay gas in stablecoin', estimatedCostUsd: 0.01, estimatedSpeedMs: 300, requirements: ['stablecoin_balance'], score: 0, successProbability: 0.95, platform: 'privy' },
20
+ { id: 'reduce_tx_amount', strategy: 'reduce_request', description: 'Reduce transaction to available balance', estimatedCostUsd: 0, estimatedSpeedMs: 100, requirements: [], score: 0, successProbability: 0.95, platform: 'privy' },
21
+ { id: 'top_up_sponsor', strategy: 'top_up_sponsor', description: 'Top up gas sponsor wallet', estimatedCostUsd: 1.00, estimatedSpeedMs: 1000, requirements: ['reserve'], score: 0, successProbability: 0.88, platform: 'privy' },
22
+ ];
23
+ }
24
+ if (failure.platform === 'privy' && failure.category === 'network') {
25
+ return [
26
+ { id: 'switch_chain_context', strategy: 'switch_network', description: 'Switch wallet chain context to target chain', estimatedCostUsd: 0, estimatedSpeedMs: 200, requirements: [], score: 0, successProbability: 0.92, platform: 'privy' },
27
+ { id: 'create_target_wallet', strategy: 'create_target_wallet', description: 'Create new wallet on target chain', estimatedCostUsd: 0, estimatedSpeedMs: 800, requirements: ['privy_api'], score: 0, successProbability: 0.85, platform: 'privy' },
28
+ ];
29
+ }
30
+ // Privy broadcast failure with invalid/malformed params
31
+ if (failure.platform === 'privy' && failure.code === 'malformed-credential') {
32
+ return [
33
+ { id: 'fix_tx_params', strategy: 'fix_params', description: 'Auto-populate missing tx fields (gas_limit, chainId, type)', estimatedCostUsd: 0, estimatedSpeedMs: 50, requirements: [], score: 0, successProbability: 0.90, platform: 'privy' },
34
+ { id: 'retry_with_estimation', strategy: 'retry_with_estimation', description: 'Let Privy auto-estimate gas and nonce, then retry', estimatedCostUsd: 0, estimatedSpeedMs: 300, requirements: [], score: 0, successProbability: 0.85, platform: 'privy' },
35
+ ];
36
+ }
37
+ return [];
38
+ }
39
+ //# sourceMappingURL=strategies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategies.js","sourceRoot":"","sources":["../../../src/platforms/privy/strategies.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,kCAAkC;IAClC,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO;YACL,EAAE,EAAE,EAAE,mBAAmB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,WA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EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE;SACnP,CAAC;IACJ,CAAC;IAED,wDAAwD;IACxD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,OAAO,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;QAC5E,OAAO;YACL,EAAE,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,4DAA4D,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE;YAC9O,EAAE,EAAE,EAAE,uBAAuB,EAAE,QAAQ,EAAE,uBAAuB,EAAE,WAAW,EAAE,mDAAmD,EAAE,gBAAgB,EAAE,CAAC,EAAE,gBAAgB,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE;SAC1P,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { stripePerceive } from './perceive.js';
2
+ export { stripeConstruct } from './strategies.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platforms/stripe/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { stripePerceive } from './perceive.js';
2
+ export { stripeConstruct } from './strategies.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platforms/stripe/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { FailureClassification } from '../../engine/types.js';
2
+ export declare function stripePerceive(error: Error, _context?: Record<string, unknown>): FailureClassification | null;
3
+ //# sourceMappingURL=perceive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perceive.d.ts","sourceRoot":"","sources":["../../../src/platforms/stripe/perceive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAKnE,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,qBAAqB,GAAG,IAAI,CAc7G"}
@@ -0,0 +1,14 @@
1
+ // PLACEHOLDER — Stripe payment failure patterns
2
+ // Will be implemented in a future PR
3
+ export function stripePerceive(error, _context) {
4
+ const msg = error.message;
5
+ // Stripe-specific error patterns (placeholder)
6
+ if (msg.includes('card_declined'))
7
+ return { code: 'payment-insufficient', category: 'balance', severity: 'high', platform: 'stripe', details: msg, timestamp: Date.now() };
8
+ if (msg.includes('expired_card'))
9
+ return { code: 'payment-expired', category: 'session', severity: 'high', platform: 'stripe', details: msg, timestamp: Date.now() };
10
+ if (msg.includes('rate_limit'))
11
+ return { code: 'rate-limited', category: 'auth', severity: 'medium', platform: 'stripe', details: msg, timestamp: Date.now() };
12
+ return null;
13
+ }
14
+ //# sourceMappingURL=perceive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perceive.js","sourceRoot":"","sources":["../../../src/platforms/stripe/perceive.ts"],"names":[],"mappings":"AAEA,gDAAgD;AAChD,qCAAqC;AAErC,MAAM,UAAU,cAAc,CAAC,KAAY,EAAE,QAAkC;IAC7E,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC;IAE1B,+CAA+C;IAC/C,IAAI,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAE1I,IAAI,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC;QAC9B,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAErI,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAEjI,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { FailureClassification, RepairCandidate } from '../../engine/types.js';
2
+ export declare function stripeConstruct(_failure: FailureClassification): RepairCandidate[];
3
+ //# sourceMappingURL=strategies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategies.d.ts","sourceRoot":"","sources":["../../../src/platforms/stripe/strategies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAKpF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,qBAAqB,GAAG,eAAe,EAAE,CAElF"}
@@ -0,0 +1,6 @@
1
+ // PLACEHOLDER — Stripe repair strategies
2
+ // Coming soon
3
+ export function stripeConstruct(_failure) {
4
+ return [];
5
+ }
6
+ //# sourceMappingURL=strategies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategies.js","sourceRoot":"","sources":["../../../src/platforms/stripe/strategies.ts"],"names":[],"mappings":"AAEA,yCAAyC;AACzC,cAAc;AAEd,MAAM,UAAU,eAAe,CAAC,QAA+B;IAC7D,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { tempoPerceive } from './perceive.js';
2
+ export { tempoConstruct } from './strategies.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platforms/tempo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"}