@agirails/sdk 3.5.3 → 4.0.0-beta.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 (72) hide show
  1. package/dist/cli/agirails.d.ts +4 -1
  2. package/dist/cli/agirails.d.ts.map +1 -1
  3. package/dist/cli/agirails.js +34 -2
  4. package/dist/cli/agirails.js.map +1 -1
  5. package/dist/cli/commands/agent.d.ts.map +1 -1
  6. package/dist/cli/commands/agent.js +62 -21
  7. package/dist/cli/commands/agent.js.map +1 -1
  8. package/dist/cli/commands/pay.d.ts +7 -0
  9. package/dist/cli/commands/pay.d.ts.map +1 -1
  10. package/dist/cli/commands/pay.js +34 -1
  11. package/dist/cli/commands/pay.js.map +1 -1
  12. package/dist/cli/commands/request.d.ts +19 -0
  13. package/dist/cli/commands/request.d.ts.map +1 -0
  14. package/dist/cli/commands/request.js +167 -0
  15. package/dist/cli/commands/request.js.map +1 -0
  16. package/dist/cli/commands/serve.d.ts +12 -7
  17. package/dist/cli/commands/serve.d.ts.map +1 -1
  18. package/dist/cli/commands/serve.js +12 -7
  19. package/dist/cli/commands/serve.js.map +1 -1
  20. package/dist/cli/commands/test.d.ts +22 -4
  21. package/dist/cli/commands/test.d.ts.map +1 -1
  22. package/dist/cli/commands/test.js +139 -292
  23. package/dist/cli/commands/test.js.map +1 -1
  24. package/dist/cli/commands/tx.js +13 -0
  25. package/dist/cli/commands/tx.js.map +1 -1
  26. package/dist/cli/index.js +7 -2
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/cli/lib/resolveAgent.d.ts +67 -0
  29. package/dist/cli/lib/resolveAgent.d.ts.map +1 -0
  30. package/dist/cli/lib/resolveAgent.js +121 -0
  31. package/dist/cli/lib/resolveAgent.js.map +1 -0
  32. package/dist/cli/lib/runRequest.d.ts +114 -0
  33. package/dist/cli/lib/runRequest.d.ts.map +1 -0
  34. package/dist/cli/lib/runRequest.js +324 -0
  35. package/dist/cli/lib/runRequest.js.map +1 -0
  36. package/dist/cli/lib/serviceNameForHash.d.ts +48 -0
  37. package/dist/cli/lib/serviceNameForHash.d.ts.map +1 -0
  38. package/dist/cli/lib/serviceNameForHash.js +62 -0
  39. package/dist/cli/lib/serviceNameForHash.js.map +1 -0
  40. package/dist/level0/request.d.ts.map +1 -1
  41. package/dist/level0/request.js +18 -6
  42. package/dist/level0/request.js.map +1 -1
  43. package/dist/level1/Agent.d.ts +72 -8
  44. package/dist/level1/Agent.d.ts.map +1 -1
  45. package/dist/level1/Agent.js +242 -110
  46. package/dist/level1/Agent.js.map +1 -1
  47. package/dist/negotiation/BuyerOrchestrator.d.ts +1 -1
  48. package/dist/negotiation/BuyerOrchestrator.d.ts.map +1 -1
  49. package/dist/negotiation/BuyerOrchestrator.js +10 -1
  50. package/dist/negotiation/BuyerOrchestrator.js.map +1 -1
  51. package/dist/protocol/EventMonitor.d.ts +26 -1
  52. package/dist/protocol/EventMonitor.d.ts.map +1 -1
  53. package/dist/protocol/EventMonitor.js +18 -4
  54. package/dist/protocol/EventMonitor.js.map +1 -1
  55. package/dist/runtime/BlockchainRuntime.d.ts +73 -0
  56. package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
  57. package/dist/runtime/BlockchainRuntime.js +121 -1
  58. package/dist/runtime/BlockchainRuntime.js.map +1 -1
  59. package/dist/runtime/IACTPRuntime.d.ts +29 -0
  60. package/dist/runtime/IACTPRuntime.d.ts.map +1 -1
  61. package/dist/runtime/MockRuntime.d.ts.map +1 -1
  62. package/dist/runtime/MockRuntime.js +21 -4
  63. package/dist/runtime/MockRuntime.js.map +1 -1
  64. package/dist/runtime/MockStateManager.d.ts.map +1 -1
  65. package/dist/runtime/MockStateManager.js +18 -0
  66. package/dist/runtime/MockStateManager.js.map +1 -1
  67. package/dist/runtime/types/MockState.d.ts +12 -0
  68. package/dist/runtime/types/MockState.d.ts.map +1 -1
  69. package/dist/runtime/types/MockState.js.map +1 -1
  70. package/dist/types/agent.d.ts +6 -1
  71. package/dist/types/agent.d.ts.map +1 -1
  72. package/package.json +2 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * `actp serve` — long-running provider daemon.
3
+ * `actp serve` — long-running provider daemon focused on the AIP-2.1 quote channel.
4
4
  *
5
5
  * Loads a ProviderPolicy JSON, constructs a ProviderOrchestrator, opens
6
6
  * an HTTP server on the configured port that exposes the AIP-2.1 quote
@@ -8,16 +8,21 @@
8
8
  * and routes incoming buyer counter-offers through
9
9
  * orchestrator.evaluateCounter().
10
10
  *
11
- * Scope (v1):
11
+ * Scope:
12
12
  * - accept + verify incoming counter-offers via QuoteChannelHandler
13
13
  * - log the policy verdict (accept / reject) per round
14
14
  * - emit a one-line health response on `GET /`
15
15
  *
16
- * Out of scope for v1 (Phase 5):
17
- * - on-chain event listening (no automatic submitQuote on incoming
18
- * INITIATED txs caller still drives via Agent.ts or manual code)
19
- * - sending CounterAcceptMessage back to buyer (no reverse-endpoint
20
- * discovery yet — print the verdict, operator handles delivery)
16
+ * Not in scope here:
17
+ * - On-chain INITIATED-tx detection is handled by `actp agent` or
18
+ * `new Agent()`. Both use the hybrid subscription + bounded catch-up
19
+ * sweep on `BlockchainRuntime` since 4.0.0
20
+ * (PRD-event-driven-provider-listening §5.2, §5.3, §5.8). `actp serve`
21
+ * intentionally has no on-chain watcher — running it alongside
22
+ * `actp agent` is the canonical split: `serve` handles the AIP-2.1
23
+ * quote channel, `agent` handles on-chain INITIATED pickups.
24
+ * - Sending CounterAcceptMessage back to buyer (no reverse-endpoint
25
+ * discovery yet — print the verdict, operator handles delivery).
21
26
  *
22
27
  * @module cli/commands/serve
23
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/cli/commands/serve.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,+BAAqE;AACrE,2BAA8C;AAC9C,mCAA8D;AAC9D,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I,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;QACzC,CAAC,EAAE,MAAM,CAAC,CAAC;QAEX,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YAC/B,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,KAAK,GAAG,SAAS,EAAE,CAAC;gBACtB,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;gBACpC,OAAO;YACT,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC3E,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC;AAnCD,4BAmCC"}
@@ -1,15 +1,33 @@
1
1
  /**
2
- * Test Command - Prove the earning loop works
2
+ * Test Command Run a real ACTP request against the deployed Sentinel.
3
3
  *
4
- * Always uses mock runtime, regardless of network in {slug}.md.
5
- * Simulates the full ACTP lifecycle (escrow settlement) without
6
- * invoking handler code proves the earning loop, not business logic.
4
+ * PRD-event-driven-provider-listening §5.7. Pre-4.0.0 this command ran a
5
+ * mock simulation of the earning loop. From 4.0.0 it hits the live
6
+ * Sentinel agent on Base Sepolia, walks the full state machine, settles
7
+ * the escrow as the requester, and prints the day's curated reflection.
8
+ *
9
+ * Requirements:
10
+ * - A keystore wallet at `~/.actp/wallets/base-sepolia` (or
11
+ * `ACTP_PRIVATE_KEY` env var) with small ETH for gas + test USDC.
12
+ * - Base Sepolia RPC reachable (defaults to the SDK's bundled URL; can be
13
+ * overridden via `BASE_SEPOLIA_RPC`).
14
+ *
15
+ * Escape hatch: `ACTP_SENTINEL_ADDRESS=0x...` overrides the constant-table
16
+ * Sentinel address. See `src/cli/lib/resolveAgent.ts`.
7
17
  *
8
18
  * @module cli/commands/test
9
19
  */
10
20
  import { Command } from 'commander';
11
21
  import { Output } from '../utils/output';
12
22
  export declare function createTestCommand(): Command;
23
+ /**
24
+ * Run an onboarding request against the deployed Sentinel.
25
+ *
26
+ * Exported so `cli/agirails.ts` can call it directly from the onboarding
27
+ * UX after detecting an existing identity file.
28
+ *
29
+ * @param output - Output instance (controls human / json / quiet mode).
30
+ */
13
31
  declare function runTest(output: Output): Promise<void>;
14
32
  export { runTest };
15
33
  //# sourceMappingURL=test.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAexD,wBAAgB,iBAAiB,IAAI,OAAO,CAwB3C;AA6ED,iBAAe,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0JpD;AAkGD,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAiBnD,wBAAgB,iBAAiB,IAAI,OAAO,CAwE3C;AAMD;;;;;;;GAOG;AACH,iBAAe,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiEpD;AAeD,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1,338 +1,185 @@
1
1
  "use strict";
2
2
  /**
3
- * Test Command - Prove the earning loop works
3
+ * Test Command Run a real ACTP request against the deployed Sentinel.
4
4
  *
5
- * Always uses mock runtime, regardless of network in {slug}.md.
6
- * Simulates the full ACTP lifecycle (escrow settlement) without
7
- * invoking handler code proves the earning loop, not business logic.
5
+ * PRD-event-driven-provider-listening §5.7. Pre-4.0.0 this command ran a
6
+ * mock simulation of the earning loop. From 4.0.0 it hits the live
7
+ * Sentinel agent on Base Sepolia, walks the full state machine, settles
8
+ * the escrow as the requester, and prints the day's curated reflection.
9
+ *
10
+ * Requirements:
11
+ * - A keystore wallet at `~/.actp/wallets/base-sepolia` (or
12
+ * `ACTP_PRIVATE_KEY` env var) with small ETH for gas + test USDC.
13
+ * - Base Sepolia RPC reachable (defaults to the SDK's bundled URL; can be
14
+ * overridden via `BASE_SEPOLIA_RPC`).
15
+ *
16
+ * Escape hatch: `ACTP_SENTINEL_ADDRESS=0x...` overrides the constant-table
17
+ * Sentinel address. See `src/cli/lib/resolveAgent.ts`.
8
18
  *
9
19
  * @module cli/commands/test
10
20
  */
11
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
- if (k2 === undefined) k2 = k;
13
- var desc = Object.getOwnPropertyDescriptor(m, k);
14
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
- desc = { enumerable: true, get: function() { return m[k]; } };
16
- }
17
- Object.defineProperty(o, k2, desc);
18
- }) : (function(o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- }));
22
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
- Object.defineProperty(o, "default", { enumerable: true, value: v });
24
- }) : function(o, v) {
25
- o["default"] = v;
26
- });
27
- var __importStar = (this && this.__importStar) || function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
21
  Object.defineProperty(exports, "__esModule", { value: true });
35
22
  exports.runTest = exports.createTestCommand = void 0;
36
- const fs = __importStar(require("fs"));
37
23
  const commander_1 = require("commander");
38
- const ethers_1 = require("ethers");
39
24
  const output_1 = require("../utils/output");
40
25
  const client_1 = require("../utils/client");
41
- const config_1 = require("../utils/config");
42
- const agirailsmdV4_1 = require("../../config/agirailsmdV4");
43
- const testjobs_1 = require("../testjobs");
44
- const receipt_1 = require("./receipt");
45
- const MockRuntime_1 = require("../../runtime/MockRuntime");
46
- const banner_1 = require("../utils/banner");
47
- const receiptUpload_1 = require("../receiptUpload");
48
- const defaults_1 = require("../../config/defaults");
26
+ const resolveAgent_1 = require("../lib/resolveAgent");
27
+ const runRequest_1 = require("../lib/runRequest");
49
28
  // ============================================================================
50
29
  // Command Definition
51
30
  // ============================================================================
52
31
  function createTestCommand() {
53
- const cmd = new commander_1.Command('test')
54
- .description('Run a test job through the mock earning loop')
32
+ return new commander_1.Command('test')
33
+ .description('Run a real onboarding request against the deployed Sentinel on Base Sepolia')
55
34
  .option('--json', 'Output as JSON')
56
- .option('-q, --quiet', 'Output only net earnings')
35
+ .option('-q, --quiet', 'Output only the reflection')
57
36
  .action(async (options) => {
58
37
  const output = new output_1.Output(options.json ? 'json' : options.quiet ? 'quiet' : 'human');
59
38
  try {
60
39
  await runTest(output);
61
40
  }
62
41
  catch (error) {
63
- const structuredError = (0, client_1.mapError)(error);
42
+ // Quote-timeout has its own exit code so scripts can distinguish
43
+ // "Sentinel offline" from generic failure modes.
44
+ if (error instanceof runRequest_1.QuoteTimeoutError) {
45
+ output.errorResult({
46
+ code: 'QUOTE_TIMEOUT',
47
+ message: error.message,
48
+ details: { txId: error.txId, timeoutMs: error.timeoutMs },
49
+ });
50
+ process.exit(2);
51
+ }
52
+ // Setup errors get a clearer hint than the generic mapError path.
53
+ // Note the two cases get OPPOSITE remediations: AgentNotFoundError
54
+ // fires when no override is set + no table entry exists, so the
55
+ // user needs to SET the env var. InvalidAgentAddressError fires
56
+ // only when the env var IS set but contains garbage, so telling
57
+ // them to set it is exactly the wrong advice.
58
+ if (error instanceof resolveAgent_1.AgentNotFoundError) {
59
+ output.errorResult({
60
+ code: 'SENTINEL_NOT_RESOLVED',
61
+ message: error.message,
62
+ details: {
63
+ hint: 'Set ACTP_SENTINEL_ADDRESS=0x... to point at a Sentinel deployment, ' +
64
+ 'or upgrade the SDK to pick up a refreshed built-in table.',
65
+ },
66
+ });
67
+ process.exit(output_1.ExitCode.ERROR);
68
+ }
69
+ if (error instanceof resolveAgent_1.InvalidAgentAddressError) {
70
+ output.errorResult({
71
+ code: 'SENTINEL_ADDRESS_INVALID',
72
+ message: error.message,
73
+ details: {
74
+ envVar: error.envVar,
75
+ hint: `Fix or unset ${error.envVar} — the value "${error.value}" is not a valid ` +
76
+ 'Ethereum address. Use a 0x-prefixed 40-character hex string, ' +
77
+ 'or unset the variable to fall back to the SDK\'s built-in Sentinel address.',
78
+ },
79
+ });
80
+ process.exit(output_1.ExitCode.ERROR);
81
+ }
82
+ if (error instanceof runRequest_1.DeliveryTimeoutError) {
83
+ output.errorResult({
84
+ code: 'DELIVERY_TIMEOUT',
85
+ message: error.message,
86
+ details: { txId: error.txId, timeoutMs: error.timeoutMs, lastState: error.lastState },
87
+ });
88
+ process.exit(output_1.ExitCode.ERROR);
89
+ }
90
+ const structured = (0, client_1.mapError)(error);
64
91
  output.errorResult({
65
- code: structuredError.code,
66
- message: structuredError.message,
67
- details: structuredError.details,
92
+ code: structured.code,
93
+ message: structured.message,
94
+ details: structured.details,
68
95
  });
69
96
  process.exit(output_1.ExitCode.ERROR);
70
97
  }
71
98
  });
72
- return cmd;
73
99
  }
74
100
  exports.createTestCommand = createTestCommand;
75
101
  // ============================================================================
76
102
  // Implementation
77
103
  // ============================================================================
78
- /** Sleep helper */
79
- function sleep(ms) {
80
- return new Promise((resolve) => setTimeout(resolve, ms));
81
- }
82
- /** Spinner frames (rotating Unicode circle) */
83
- const SPINNER_FRAMES = ['◐', '◓', '◑', '◒'];
84
104
  /**
85
- * Run a state transition with rotating spinner animation.
105
+ * Run an onboarding request against the deployed Sentinel.
86
106
  *
87
- * On TTY (human mode): prints a spinning line, awaits the work, enforces a
88
- * minimum visible duration, then rewrites the line with the final icon + timing.
107
+ * Exported so `cli/agirails.ts` can call it directly from the onboarding
108
+ * UX after detecting an existing identity file.
89
109
  *
90
- * On non-TTY / CI: executes the work without animation, emits a single line
91
- * with actual elapsed time.
110
+ * @param output - Output instance (controls human / json / quiet mode).
92
111
  */
93
- async function animateState(output, label, message, work, settled = false, minDurationMs = 450) {
94
- const labelPad = label.padEnd(14);
95
- const msgPad = message.padEnd(40);
96
- if (output.mode !== 'human') {
97
- // Non-human (json/quiet): execute silently, no output
98
- await work();
99
- return 0;
100
- }
101
- if (!process.stdout.isTTY) {
102
- // Non-TTY: no animation, single line after work completes
103
- const start = performance.now();
104
- await work();
105
- const elapsed = Math.round(performance.now() - start);
106
- const icon = settled ? output_1.fmt.green('✓') : output_1.fmt.cyan('·');
107
- const lbl = settled ? output_1.fmt.green(output_1.fmt.bold(labelPad)) : output_1.fmt.bold(labelPad);
108
- console.log(` ${icon} ${lbl} ${msgPad} ${output_1.fmt.dim(`[${elapsed}ms]`)}`);
109
- return elapsed;
110
- }
111
- // TTY: rotating spinner with min duration for visibility
112
- let frameIdx = 0;
113
- process.stdout.write(` ${output_1.fmt.cyan(SPINNER_FRAMES[0])} ${output_1.fmt.bold(labelPad)} ${msgPad}`);
114
- const interval = setInterval(() => {
115
- frameIdx = (frameIdx + 1) % SPINNER_FRAMES.length;
116
- process.stdout.write(`\r ${output_1.fmt.cyan(SPINNER_FRAMES[frameIdx])} ${output_1.fmt.bold(labelPad)} ${msgPad}`);
117
- }, 90);
118
- const start = performance.now();
119
- await Promise.all([
120
- work(),
121
- sleep(minDurationMs),
122
- ]);
123
- const elapsed = Math.round(performance.now() - start);
124
- clearInterval(interval);
125
- const icon = settled ? output_1.fmt.green('✓') : output_1.fmt.cyan('·');
126
- const lbl = settled ? output_1.fmt.green(output_1.fmt.bold(labelPad)) : output_1.fmt.bold(labelPad);
127
- process.stdout.write(`\r ${icon} ${lbl} ${msgPad} ${output_1.fmt.dim(`[${elapsed}ms]`)}\n`);
128
- return elapsed;
129
- }
130
- /** Demo amount for first-TX experience: $10 USDC (fee $0.10, net $9.90) */
131
- const TEST_TX_AMOUNT_WEI = 10000000n;
132
112
  async function runTest(output) {
133
- // Step 1: Resolve identity file
134
- const identityPath = (0, config_1.resolveIdentityPath)();
135
- if (!identityPath) {
136
- throw new Error('No agent identity file ({slug}.md) found in this directory.\n' +
137
- 'Create one with a valid AGIRAILS.md v4 frontmatter (name, services, pricing).\n' +
138
- 'Or let an AI assistant generate one: curl -sLO https://www.agirails.app/protocol/AGIRAILS.md');
139
- }
140
- // Parse identity
141
- const content = fs.readFileSync(identityPath, 'utf-8');
142
- const config = (0, agirailsmdV4_1.parseAgirailsMdV4)(content);
143
- const testJob = (0, testjobs_1.selectTestJob)(config.services.map(s => s.type));
144
- // Render banner + section header (human mode only)
145
- if (output.mode === 'human') {
146
- output.print('');
147
- output.print((0, banner_1.inlineBanner)('ACTP Transaction Lifecycle'));
148
- output.print('');
149
- }
150
- const isTTY = process.stdout.isTTY && output.mode === 'human';
151
- const totalStart = performance.now();
152
- const runtime = new MockRuntime_1.MockRuntime();
153
- // Create synthetic addresses
154
- const requesterWallet = ethers_1.ethers.Wallet.createRandom();
155
- let providerAddress;
156
- try {
157
- providerAddress = (0, config_1.loadConfig)().address || ethers_1.ethers.Wallet.createRandom().address;
158
- }
159
- catch {
160
- providerAddress = ethers_1.ethers.Wallet.createRandom().address;
161
- }
162
- // Hardcoded $10 demo amount — demonstrates fee math (fee $0.10, net $9.90)
163
- const amountWei = TEST_TX_AMOUNT_WEI;
164
- const amountStr = amountWei.toString();
165
- await runtime.mintTokens(requesterWallet.address, amountStr);
166
- const deadline = runtime.time.now() + 86400;
167
- const disputeWindow = parseDuration(config.sla.dispute_window);
168
- // Shared txId/escrowId across state closures
169
- let txId = '';
170
- let escrowId = '';
171
- let escrowLockMs = 0;
172
- let settlementMs = 0;
173
- // === INITIATED ===
174
- await animateState(output, 'INITIATED', 'Requester created transaction', async () => {
175
- txId = await runtime.createTransaction({
176
- provider: providerAddress,
177
- requester: requesterWallet.address,
178
- amount: amountStr,
179
- deadline,
180
- disputeWindow,
181
- serviceDescription: testJob.title,
182
- });
183
- });
184
- // === QUOTED === (educational: demonstrates full state machine)
185
- await animateState(output, 'QUOTED', `${config.name} quoted $10.00 USDC`, async () => {
186
- await runtime.transitionState(txId, 'QUOTED');
187
- });
188
- // === COMMITTED ===
189
- await animateState(output, 'COMMITTED', 'Escrow funded — $10.00 locked', async () => {
190
- const commitStart = performance.now();
191
- escrowId = await runtime.linkEscrow(txId, amountStr);
192
- escrowLockMs = performance.now() - commitStart;
193
- });
194
- // === IN_PROGRESS ===
195
- await animateState(output, 'IN_PROGRESS', `${config.name} working...`, async () => {
196
- await runtime.transitionState(txId, 'IN_PROGRESS');
197
- }, false, 700); // longer delay — simulates "doing work"
198
- // === DELIVERED ===
199
- await animateState(output, 'DELIVERED', 'Delivery proof submitted', async () => {
200
- await runtime.transitionState(txId, 'DELIVERED');
201
- });
202
- // Advance time past dispute window (silent — not a real state transition)
203
- await runtime.time.advanceTime(disputeWindow + 1);
204
- // === SETTLED ===
205
- await animateState(output, 'SETTLED', `Escrow released → ${config.name}`, async () => {
206
- const settlementStart = performance.now();
207
- await runtime.releaseEscrow(escrowId);
208
- settlementMs = performance.now() - settlementStart;
209
- }, true);
210
- const totalMs = performance.now() - totalStart;
211
- // Summary line
212
- if (output.mode === 'human') {
213
- output.print('');
214
- output.print(output_1.fmt.dim(` ─── ${Math.round(totalMs)}ms total ${'─'.repeat(Math.max(0, 40 - String(Math.round(totalMs)).length))}`));
215
- output.print('');
216
- }
217
- // Receipt
218
- (0, receipt_1.renderReceipt)({
219
- agent: config.name,
220
- service: config.services[0].type,
221
- amountWei,
222
- network: 'mock',
223
- txId,
224
- timing: {
225
- totalMs: Math.round(totalMs),
226
- escrowLockMs: Math.round(escrowLockMs),
227
- settlementMs: Math.round(settlementMs),
113
+ // 1. Resolve Sentinel for Base Sepolia (env override → constant table).
114
+ const sentinel = (0, resolveAgent_1.resolveAgent)('sentinel', 'base-sepolia');
115
+ // 2. Header line in human mode. JSON / quiet modes get only the final
116
+ // structured result.
117
+ output.print('');
118
+ output.print(`→ Requesting onboarding service from Sentinel`);
119
+ output.print(` address: ${sentinel.address}`);
120
+ output.print(` network: base-sepolia (source: ${sentinel.source})`);
121
+ output.print('');
122
+ // 3. Hit Sentinel via the shared Level 1 requester flow. Sentinel's
123
+ // covenant is $0.05 USDC for the onboarding service; PRD §5.6 quote
124
+ // timeout default (30s) is generous on Base Sepolia.
125
+ const result = await (0, runRequest_1.runRequest)({
126
+ provider: sentinel.address,
127
+ amount: '0.05',
128
+ service: 'onboarding',
129
+ network: 'testnet',
130
+ autoAccept: true,
131
+ onTransition: (state, txId, ts) => {
132
+ output.print(` [${ts.toISOString()}] ${state.padEnd(12)} ${txId}`);
228
133
  },
229
- }, output);
230
- // Best-effort publish to agirails.app/r/<id> — mock auth requires API key.
231
- // On failure, fall through silently; the CLI already printed a local receipt.
232
- // Fee math from canonical SDK helper (config/defaults.ts) — kept in sync
233
- // with the web copy at lib/receipts/fees.ts via the parity test on web.
234
- const feeWei = (0, defaults_1.computeDisplayFee)(amountWei);
235
- const netWei = amountWei - feeWei;
236
- const upload = await (0, receiptUpload_1.uploadReceipt)({
237
- agentAddress: providerAddress,
238
- service: testJob.title,
239
- amountWei: amountStr,
240
- feeWei: feeWei.toString(),
241
- netWei: netWei.toString(),
242
- txId,
243
- network: 'mock',
244
- requesterAddress: requesterWallet.address,
245
- durationMs: Math.round(totalMs),
246
134
  });
247
- if (output.mode === 'human' && upload.ok) {
248
- output.print('');
249
- output.print(` ${output_1.fmt.green('→')} Shareable receipt: ${output_1.fmt.bold(upload.url)}`);
250
- if (upload.milestone) {
251
- output.print(` ${output_1.fmt.yellow('★')} Milestone: ${output_1.fmt.bold(upload.milestone)}`);
252
- }
253
- output.print('');
254
- }
255
- // Share prompt (TTY + human mode only — never in CI/piped/json/quiet)
256
- if (isTTY) {
257
- await promptShare(amountWei, 'mock', undefined, upload.ok ? upload.url : undefined);
135
+ // 4. Reflection is the canonical Sentinel payload. Resilient extraction:
136
+ // Sentinel returns { reflection, service, timestamp }; if it's wrapped
137
+ // in a delivery-proof envelope (`{ type: 'delivery.proof', result: {...} }`),
138
+ // unwrap once. Fall back to printing the raw payload otherwise.
139
+ const reflection = extractReflection(result.payload);
140
+ output.print('');
141
+ output.result({
142
+ txId: result.txId,
143
+ finalState: result.finalState,
144
+ elapsedMs: result.elapsedMs,
145
+ settled: result.settled,
146
+ reflection,
147
+ payload: result.payload,
148
+ }, { quietKey: 'reflection' });
149
+ // Footer wording is conditional on what actually happened. The
150
+ // structured JSON output above always reports `settled`, but human-mode
151
+ // consumers see only the line emitted here — so a settle failure that
152
+ // still produced a reflection must not be celebrated as "Settled".
153
+ if (!result.settled) {
154
+ output.blank();
155
+ output.warning(`Escrow settlement did NOT complete after delivery (finalState=${result.finalState}). ` +
156
+ 'The reflection arrived, but the requester-side releaseEscrow call failed. ' +
157
+ 'Verify with `actp tx status ' + result.txId + '` and retry settlement manually.');
158
+ return;
258
159
  }
259
- }
260
- exports.runTest = runTest;
261
- // ============================================================================
262
- // Share prompt
263
- // ============================================================================
264
- async function promptShare(amountWei, network, ethTxHash, receiptUrl) {
265
- const readline = await Promise.resolve().then(() => __importStar(require('readline')));
266
- const { copyToClipboardOSC52, buildTwitterIntentUrl, openUrl, buildMockTweet, buildTestnetTweet, } = await Promise.resolve().then(() => __importStar(require('../utils/share')));
267
- // Compute net for tweet text
268
- const { computeDisplayFee } = await Promise.resolve().then(() => __importStar(require('../../config/defaults')));
269
- const fee = computeDisplayFee(amountWei);
270
- const net = amountWei - fee;
271
- const netUsd = `$${(Number(net) / 1000000).toFixed(2)}`;
272
- const baseTweet = network === 'testnet' && ethTxHash
273
- ? buildTestnetTweet(netUsd, ethTxHash)
274
- : buildMockTweet(netUsd);
275
- const tweetText = receiptUrl ? `${baseTweet}\n\n${receiptUrl}` : baseTweet;
276
- console.log('');
277
- console.log(output_1.fmt.bold('Share your first transaction?'));
278
- console.log('');
279
- console.log(` ${output_1.fmt.cyan('1)')} Copy tweet text to clipboard`);
280
- console.log(` ${output_1.fmt.cyan('2)')} Open Twitter with pre-filled tweet`);
281
- console.log(` ${output_1.fmt.cyan('3)')} Skip`);
282
- console.log('');
283
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
284
- const answer = await new Promise((resolve) => {
285
- rl.question('Choose [1-3, default 3]: ', resolve);
286
- });
287
- rl.close();
288
- const choice = answer.trim() || '3';
289
- if (choice === '1') {
290
- const copied = copyToClipboardOSC52(tweetText);
291
- console.log('');
292
- if (copied) {
293
- console.log(output_1.fmt.green('✓ Tweet copied to clipboard.'));
294
- }
295
- else {
296
- console.log(output_1.fmt.yellow('Clipboard not available — copy manually:'));
297
- console.log('');
298
- console.log(output_1.fmt.dim(tweetText));
299
- }
300
- console.log('');
160
+ if (reflection) {
161
+ output.blank();
162
+ output.success(`Reflection: ${reflection}`);
301
163
  }
302
- else if (choice === '2') {
303
- const url = buildTwitterIntentUrl(tweetText);
304
- const opened = openUrl(url);
305
- console.log('');
306
- if (opened) {
307
- console.log(output_1.fmt.green('✓ Opening Twitter...'));
308
- }
309
- else {
310
- console.log(output_1.fmt.yellow('Could not open browser. Copy this URL:'));
311
- console.log('');
312
- console.log(output_1.fmt.dim(url));
313
- }
314
- console.log('');
164
+ else {
165
+ output.blank();
166
+ output.success(`Settled in ${result.elapsedMs} ms`);
315
167
  }
316
- // choice === '3' or anything else: silent skip
317
168
  }
318
- // ============================================================================
319
- // Helpers
320
- // ============================================================================
321
- /**
322
- * Parse a duration string like "48h", "2h", "24h" into seconds.
323
- */
324
- function parseDuration(duration) {
325
- const match = duration.match(/^(\d+)(s|m|h|d)$/);
326
- if (!match)
327
- return 172800; // default: 48h
328
- const value = parseInt(match[1], 10);
329
- const unit = match[2];
330
- switch (unit) {
331
- case 's': return value;
332
- case 'm': return value * 60;
333
- case 'h': return value * 3600;
334
- case 'd': return value * 86400;
335
- default: return 172800;
169
+ exports.runTest = runTest;
170
+ function extractReflection(payload) {
171
+ if (!payload || typeof payload !== 'object')
172
+ return undefined;
173
+ const obj = payload;
174
+ if (typeof obj.reflection === 'string')
175
+ return obj.reflection;
176
+ // Provider-side `Agent.processJob` wraps handler output as
177
+ // `{ type: 'delivery.proof', result: <handler_output>, ... }`. Peel it.
178
+ if (obj.type === 'delivery.proof' && obj.result && typeof obj.result === 'object') {
179
+ const inner = obj.result;
180
+ if (typeof inner.reflection === 'string')
181
+ return inner.reflection;
336
182
  }
183
+ return undefined;
337
184
  }
338
185
  //# sourceMappingURL=test.js.map