@agirails/sdk 4.4.9 → 4.6.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 (97) hide show
  1. package/dist/builders/DeliveryProofBuilder.d.ts +224 -13
  2. package/dist/builders/DeliveryProofBuilder.d.ts.map +1 -1
  3. package/dist/builders/DeliveryProofBuilder.js +247 -13
  4. package/dist/builders/DeliveryProofBuilder.js.map +1 -1
  5. package/dist/cli/agirails.d.ts +85 -1
  6. package/dist/cli/agirails.d.ts.map +1 -1
  7. package/dist/cli/agirails.js +429 -154
  8. package/dist/cli/agirails.js.map +1 -1
  9. package/dist/cli/commands/init.d.ts +95 -0
  10. package/dist/cli/commands/init.d.ts.map +1 -1
  11. package/dist/cli/commands/init.js +338 -1
  12. package/dist/cli/commands/init.js.map +1 -1
  13. package/dist/cli/commands/publish.d.ts +19 -0
  14. package/dist/cli/commands/publish.d.ts.map +1 -1
  15. package/dist/cli/commands/publish.js +14 -1
  16. package/dist/cli/commands/publish.js.map +1 -1
  17. package/dist/cli/commands/receipt.d.ts +70 -2
  18. package/dist/cli/commands/receipt.d.ts.map +1 -1
  19. package/dist/cli/commands/receipt.js +218 -3
  20. package/dist/cli/commands/receipt.js.map +1 -1
  21. package/dist/cli/commands/test.d.ts +77 -1
  22. package/dist/cli/commands/test.d.ts.map +1 -1
  23. package/dist/cli/commands/test.js +264 -2
  24. package/dist/cli/commands/test.js.map +1 -1
  25. package/dist/cli/lib/runRequest.d.ts +90 -0
  26. package/dist/cli/lib/runRequest.d.ts.map +1 -1
  27. package/dist/cli/lib/runRequest.js +300 -9
  28. package/dist/cli/lib/runRequest.js.map +1 -1
  29. package/dist/cli/lib/sentinelReflections.d.ts +111 -0
  30. package/dist/cli/lib/sentinelReflections.d.ts.map +1 -0
  31. package/dist/cli/lib/sentinelReflections.js +193 -0
  32. package/dist/cli/lib/sentinelReflections.js.map +1 -0
  33. package/dist/delivery/MockDeliveryChannel.d.ts +208 -0
  34. package/dist/delivery/MockDeliveryChannel.d.ts.map +1 -0
  35. package/dist/delivery/MockDeliveryChannel.js +445 -0
  36. package/dist/delivery/MockDeliveryChannel.js.map +1 -0
  37. package/dist/delivery/RelayDeliveryChannel.d.ts +176 -0
  38. package/dist/delivery/RelayDeliveryChannel.d.ts.map +1 -0
  39. package/dist/delivery/RelayDeliveryChannel.js +377 -0
  40. package/dist/delivery/RelayDeliveryChannel.js.map +1 -0
  41. package/dist/delivery/channel.d.ts +282 -0
  42. package/dist/delivery/channel.d.ts.map +1 -0
  43. package/dist/delivery/channel.js +76 -0
  44. package/dist/delivery/channel.js.map +1 -0
  45. package/dist/delivery/channelLog.d.ts +115 -0
  46. package/dist/delivery/channelLog.d.ts.map +1 -0
  47. package/dist/delivery/channelLog.js +94 -0
  48. package/dist/delivery/channelLog.js.map +1 -0
  49. package/dist/delivery/crypto.d.ts +312 -0
  50. package/dist/delivery/crypto.d.ts.map +1 -0
  51. package/dist/delivery/crypto.js +495 -0
  52. package/dist/delivery/crypto.js.map +1 -0
  53. package/dist/delivery/eip712.d.ts +248 -0
  54. package/dist/delivery/eip712.d.ts.map +1 -0
  55. package/dist/delivery/eip712.js +397 -0
  56. package/dist/delivery/eip712.js.map +1 -0
  57. package/dist/delivery/envelopeBuilder.d.ts +531 -0
  58. package/dist/delivery/envelopeBuilder.d.ts.map +1 -0
  59. package/dist/delivery/envelopeBuilder.js +832 -0
  60. package/dist/delivery/envelopeBuilder.js.map +1 -0
  61. package/dist/delivery/index.d.ts +53 -0
  62. package/dist/delivery/index.d.ts.map +1 -0
  63. package/dist/delivery/index.js +143 -0
  64. package/dist/delivery/index.js.map +1 -0
  65. package/dist/delivery/keys.d.ts +344 -0
  66. package/dist/delivery/keys.d.ts.map +1 -0
  67. package/dist/delivery/keys.js +513 -0
  68. package/dist/delivery/keys.js.map +1 -0
  69. package/dist/delivery/nonce-keys.d.ts +93 -0
  70. package/dist/delivery/nonce-keys.d.ts.map +1 -0
  71. package/dist/delivery/nonce-keys.js +88 -0
  72. package/dist/delivery/nonce-keys.js.map +1 -0
  73. package/dist/delivery/setupBuilder.d.ts +403 -0
  74. package/dist/delivery/setupBuilder.d.ts.map +1 -0
  75. package/dist/delivery/setupBuilder.js +554 -0
  76. package/dist/delivery/setupBuilder.js.map +1 -0
  77. package/dist/delivery/types.d.ts +722 -0
  78. package/dist/delivery/types.d.ts.map +1 -0
  79. package/dist/delivery/types.js +150 -0
  80. package/dist/delivery/types.js.map +1 -0
  81. package/dist/delivery/validate.d.ts +288 -0
  82. package/dist/delivery/validate.d.ts.map +1 -0
  83. package/dist/delivery/validate.js +648 -0
  84. package/dist/delivery/validate.js.map +1 -0
  85. package/dist/level1/Agent.d.ts +130 -0
  86. package/dist/level1/Agent.d.ts.map +1 -1
  87. package/dist/level1/Agent.js +248 -0
  88. package/dist/level1/Agent.js.map +1 -1
  89. package/dist/level1/types/Options.d.ts +62 -0
  90. package/dist/level1/types/Options.d.ts.map +1 -1
  91. package/dist/level1/types/Options.js +22 -0
  92. package/dist/level1/types/Options.js.map +1 -1
  93. package/dist/runtime/MockRuntime.d.ts +32 -0
  94. package/dist/runtime/MockRuntime.d.ts.map +1 -1
  95. package/dist/runtime/MockRuntime.js +44 -0
  96. package/dist/runtime/MockRuntime.js.map +1 -1
  97. package/package.json +6 -1
@@ -1,13 +1,97 @@
1
1
  /**
2
2
  * npx agirails — One Command Entry Point
3
3
  *
4
- * 60-second quickstart: ask 3 questions → generate {slug}.md → real Sentinel
4
+ * 60-second quickstart: ask 3 questions → generate {slug}.md → bootstrap a
5
+ * real testnet wallet (Smart Wallet + 1K test USDC) → run a real Sentinel
5
6
  * onboarding request on Base Sepolia → reflection. PRD-event-driven-provider-
6
7
  * listening §5.7 replaced the prior MockRuntime earning-loop simulation with
7
8
  * a live Level 1 request against the deployed Sentinel agent.
9
+ *
10
+ * FIX-2 (2026-06): the wizard previously wrote a `mock` config with a random
11
+ * address and immediately invoked `runTest({ network: 'testnet' })`. The
12
+ * downstream `resolvePrivateKey` returned `undefined` and ACTPClient crashed.
13
+ * The wizard now runs `runInit({ mode: 'testnet', wallet: 'auto' })` BEFORE
14
+ * `runTest` so the keystore + Smart Wallet exist and the first transaction
15
+ * has a real signer behind it.
16
+ *
8
17
  * Re-entrant: if identity already exists, skips onboarding and runs test.
9
18
  *
10
19
  * @module cli/agirails
11
20
  */
21
+ import { Output, ExitCodeValue } from './utils/output';
22
+ /**
23
+ * Wizard answers — populated either by interactive prompts or supplied
24
+ * directly by callers (tests, automation).
25
+ */
26
+ export interface WizardAnswers {
27
+ name: string;
28
+ service: string;
29
+ price: number;
30
+ }
31
+ /**
32
+ * Injection seams so tests can drive the wizard without spawning interactive
33
+ * subprocesses. Production code provides the real defaults — see
34
+ * `defaultWizardDeps()`.
35
+ */
36
+ export interface WizardDeps {
37
+ /** Collect the 3 wizard answers (name / service / price). */
38
+ collectAnswers: (output: Output) => Promise<WizardAnswers | null>;
39
+ /** Resolve / prompt for the ACTP_KEY_PASSWORD before runInit. */
40
+ ensurePassword: (output: Output) => Promise<string | null>;
41
+ /** Run keystore + Smart Wallet bootstrap (defaults to commands/init.runInit). */
42
+ runInit: (opts: Record<string, unknown>, output: Output) => Promise<void>;
43
+ /** Run the Sentinel test transaction (defaults to commands/test.runTest). */
44
+ runTest: (output: Output) => Promise<void>;
45
+ /** Predicate — does the project already have a usable keystore? */
46
+ hasKeystore: (projectRoot: string) => boolean;
47
+ /** Is stdin a TTY right now? Exposed so tests can flip CI / interactive paths. */
48
+ isTTY: () => boolean;
49
+ }
50
+ /**
51
+ * Production wiring for the wizard. Tests substitute individual fields.
52
+ */
53
+ export declare function defaultWizardDeps(): WizardDeps;
54
+ /**
55
+ * A keystore is "present" when `.actp/keystore.json` exists OR the user
56
+ * has provided `ACTP_KEYSTORE_BASE64` / `ACTP_PRIVATE_KEY` env vars. Any
57
+ * of those satisfies `resolvePrivateKey()` in `runTest`.
58
+ */
59
+ export declare function hasKeystoreDefault(projectRoot?: string): boolean;
60
+ /**
61
+ * Build the V4 frontmatter + body for a fresh {slug}.md from wizard answers.
62
+ *
63
+ * Extracted so tests can verify the structure without going through the
64
+ * full wizard flow.
65
+ */
66
+ export declare function buildIdentityFile(answers: WizardAnswers): {
67
+ filename: string;
68
+ content: string;
69
+ slug: string;
70
+ };
71
+ /**
72
+ * Orchestrate the wizard. Pure-ish: every side effect goes through `deps`,
73
+ * so the test suite can verify behavior without ever touching the network,
74
+ * the keystore encrypt path, or a real Sentinel deployment.
75
+ *
76
+ * Returns the exit code instead of calling process.exit so callers (and
77
+ * tests) can decide what to do with failures.
78
+ */
79
+ export declare function runWizard(output: Output, deps?: WizardDeps): Promise<ExitCodeValue>;
80
+ /**
81
+ * Map a runTest error to a structured output + the right exit code.
82
+ * Mirrors the existing setup-hint heuristic so users with no wallet / no
83
+ * funds / missing Sentinel address still get actionable next-step guidance.
84
+ */
85
+ declare function handleTestError(error: unknown, output: Output): ExitCodeValue;
86
+ declare function extractMessage(error: unknown): string;
87
+ /** Heuristic — match the four most common runRequest / resolveAgent first-run
88
+ * failure-message shapes so the setup hint only fires when actionable. */
89
+ declare function looksLikeRunTestSetupError(message: string): boolean;
90
+ export declare const __test: {
91
+ looksLikeRunTestSetupError: typeof looksLikeRunTestSetupError;
92
+ handleTestError: typeof handleTestError;
93
+ extractMessage: typeof extractMessage;
94
+ bootstrapMockConfig: (filename: string) => void;
95
+ };
12
96
  export {};
13
97
  //# sourceMappingURL=agirails.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agirails.d.ts","sourceRoot":"","sources":["../../src/cli/agirails.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
1
+ {"version":3,"file":"agirails.d.ts","sourceRoot":"","sources":["../../src/cli/agirails.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAE,MAAM,EAAiB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAqCtE;;;GAGG;AACH,MAAM,WAAW,aAAa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