@agirails/sdk 3.4.1 → 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.
- package/dist/builders/QuoteBuilder.d.ts +9 -3
- package/dist/builders/QuoteBuilder.d.ts.map +1 -1
- package/dist/builders/QuoteBuilder.js +14 -3
- package/dist/builders/QuoteBuilder.js.map +1 -1
- package/dist/cli/agirails.d.ts +4 -1
- package/dist/cli/agirails.d.ts.map +1 -1
- package/dist/cli/agirails.js +34 -2
- package/dist/cli/agirails.js.map +1 -1
- package/dist/cli/commands/agent.d.ts +22 -0
- package/dist/cli/commands/agent.d.ts.map +1 -0
- package/dist/cli/commands/agent.js +250 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/pay.d.ts +7 -0
- package/dist/cli/commands/pay.d.ts.map +1 -1
- package/dist/cli/commands/pay.js +34 -1
- package/dist/cli/commands/pay.js.map +1 -1
- package/dist/cli/commands/request.d.ts +19 -0
- package/dist/cli/commands/request.d.ts.map +1 -0
- package/dist/cli/commands/request.js +167 -0
- package/dist/cli/commands/request.js.map +1 -0
- package/dist/cli/commands/serve.d.ts +12 -7
- package/dist/cli/commands/serve.d.ts.map +1 -1
- package/dist/cli/commands/serve.js +12 -7
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/test.d.ts +22 -4
- package/dist/cli/commands/test.d.ts.map +1 -1
- package/dist/cli/commands/test.js +139 -292
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/tx.js +13 -0
- package/dist/cli/commands/tx.js.map +1 -1
- package/dist/cli/index.js +10 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lib/resolveAgent.d.ts +67 -0
- package/dist/cli/lib/resolveAgent.d.ts.map +1 -0
- package/dist/cli/lib/resolveAgent.js +121 -0
- package/dist/cli/lib/resolveAgent.js.map +1 -0
- package/dist/cli/lib/runRequest.d.ts +114 -0
- package/dist/cli/lib/runRequest.d.ts.map +1 -0
- package/dist/cli/lib/runRequest.js +324 -0
- package/dist/cli/lib/runRequest.js.map +1 -0
- package/dist/cli/lib/serviceNameForHash.d.ts +48 -0
- package/dist/cli/lib/serviceNameForHash.d.ts.map +1 -0
- package/dist/cli/lib/serviceNameForHash.js +62 -0
- package/dist/cli/lib/serviceNameForHash.js.map +1 -0
- package/dist/config/networks.d.ts.map +1 -1
- package/dist/config/networks.js +7 -1
- package/dist/config/networks.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/level0/request.d.ts.map +1 -1
- package/dist/level0/request.js +18 -6
- package/dist/level0/request.js.map +1 -1
- package/dist/level1/Agent.d.ts +72 -8
- package/dist/level1/Agent.d.ts.map +1 -1
- package/dist/level1/Agent.js +243 -111
- package/dist/level1/Agent.js.map +1 -1
- package/dist/negotiation/BuyerOrchestrator.d.ts +73 -61
- package/dist/negotiation/BuyerOrchestrator.d.ts.map +1 -1
- package/dist/negotiation/BuyerOrchestrator.js +421 -381
- package/dist/negotiation/BuyerOrchestrator.js.map +1 -1
- package/dist/negotiation/MockChannel.d.ts +63 -0
- package/dist/negotiation/MockChannel.d.ts.map +1 -0
- package/dist/negotiation/MockChannel.js +175 -0
- package/dist/negotiation/MockChannel.js.map +1 -0
- package/dist/negotiation/NegotiationChannel.d.ts +142 -0
- package/dist/negotiation/NegotiationChannel.d.ts.map +1 -0
- package/dist/negotiation/NegotiationChannel.js +59 -0
- package/dist/negotiation/NegotiationChannel.js.map +1 -0
- package/dist/negotiation/ProviderOrchestrator.d.ts +85 -35
- package/dist/negotiation/ProviderOrchestrator.d.ts.map +1 -1
- package/dist/negotiation/ProviderOrchestrator.js +199 -49
- package/dist/negotiation/ProviderOrchestrator.js.map +1 -1
- package/dist/negotiation/ProviderPolicy.d.ts +51 -6
- package/dist/negotiation/ProviderPolicy.d.ts.map +1 -1
- package/dist/negotiation/ProviderPolicy.js +61 -9
- package/dist/negotiation/ProviderPolicy.js.map +1 -1
- package/dist/negotiation/RelayChannel.d.ts +59 -0
- package/dist/negotiation/RelayChannel.d.ts.map +1 -0
- package/dist/negotiation/RelayChannel.js +208 -0
- package/dist/negotiation/RelayChannel.js.map +1 -0
- package/dist/protocol/ACTPKernel.d.ts.map +1 -1
- package/dist/protocol/ACTPKernel.js +51 -1
- package/dist/protocol/ACTPKernel.js.map +1 -1
- package/dist/protocol/EventMonitor.d.ts +26 -1
- package/dist/protocol/EventMonitor.d.ts.map +1 -1
- package/dist/protocol/EventMonitor.js +18 -4
- package/dist/protocol/EventMonitor.js.map +1 -1
- package/dist/runtime/BlockchainRuntime.d.ts +73 -0
- package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
- package/dist/runtime/BlockchainRuntime.js +131 -3
- package/dist/runtime/BlockchainRuntime.js.map +1 -1
- package/dist/runtime/IACTPRuntime.d.ts +29 -0
- package/dist/runtime/IACTPRuntime.d.ts.map +1 -1
- package/dist/runtime/MockRuntime.d.ts.map +1 -1
- package/dist/runtime/MockRuntime.js +21 -4
- package/dist/runtime/MockRuntime.js.map +1 -1
- package/dist/runtime/MockStateManager.d.ts.map +1 -1
- package/dist/runtime/MockStateManager.js +18 -0
- package/dist/runtime/MockStateManager.js.map +1 -1
- package/dist/runtime/types/MockState.d.ts +12 -0
- package/dist/runtime/types/MockState.d.ts.map +1 -1
- package/dist/runtime/types/MockState.js.map +1 -1
- package/dist/types/agent.d.ts +6 -1
- package/dist/types/agent.d.ts.map +1 -1
- package/package.json +2 -1
package/dist/cli/index.js
CHANGED
|
@@ -41,6 +41,7 @@ function getVersion() {
|
|
|
41
41
|
// Import commands
|
|
42
42
|
const init_1 = require("./commands/init");
|
|
43
43
|
const pay_1 = require("./commands/pay");
|
|
44
|
+
const request_1 = require("./commands/request");
|
|
44
45
|
const tx_1 = require("./commands/tx");
|
|
45
46
|
const balance_1 = require("./commands/balance");
|
|
46
47
|
const mint_1 = require("./commands/mint");
|
|
@@ -65,6 +66,7 @@ const autopublish_1 = require("./commands/autopublish");
|
|
|
65
66
|
const health_1 = require("./commands/health");
|
|
66
67
|
const repair_1 = require("./commands/repair");
|
|
67
68
|
const serve_1 = require("./commands/serve");
|
|
69
|
+
const agent_1 = require("./commands/agent");
|
|
68
70
|
// ============================================================================
|
|
69
71
|
// Program Setup
|
|
70
72
|
// ============================================================================
|
|
@@ -91,6 +93,7 @@ program
|
|
|
91
93
|
// Core commands (most used)
|
|
92
94
|
program.addCommand((0, init_1.createInitCommand)());
|
|
93
95
|
program.addCommand((0, pay_1.createPayCommand)());
|
|
96
|
+
program.addCommand((0, request_1.createRequestCommand)());
|
|
94
97
|
program.addCommand((0, tx_1.createTxCommand)());
|
|
95
98
|
program.addCommand((0, balance_1.createBalanceCommand)());
|
|
96
99
|
program.addCommand((0, mint_1.createMintCommand)());
|
|
@@ -125,7 +128,13 @@ program.addCommand((0, autopublish_1.createAutopublishCommand)());
|
|
|
125
128
|
program.addCommand((0, health_1.createHealthCommand)());
|
|
126
129
|
// On-chain shape repair (drop phantom services, update endpoint, toggle flags)
|
|
127
130
|
program.addCommand((0, repair_1.createRepairCommand)());
|
|
128
|
-
// AIP-2.1 provider daemon
|
|
131
|
+
// AIP-2.1 provider daemon — channel-driven, no HTTP listener (3.5.0)
|
|
132
|
+
program.addCommand((0, agent_1.createAgentCommand)());
|
|
133
|
+
// AIP-2.1 quote-channel HTTP daemon. Since 4.0.0, `actp serve` focuses
|
|
134
|
+
// solely on the AIP-2.1 quote channel surface — on-chain INITIATED tx
|
|
135
|
+
// detection is handled by `actp agent` (or `new Agent()` programmatically).
|
|
136
|
+
// Running `actp serve` alongside `actp agent` is the canonical split.
|
|
137
|
+
// See `src/cli/commands/serve.ts` header for scope; PRD §5.10.
|
|
129
138
|
program.addCommand((0, serve_1.createServeCommand)());
|
|
130
139
|
// ============================================================================
|
|
131
140
|
// Error Handling
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1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AAC,QAAQ,EAAE,EAAE;IACnC,OAAO,CAAC,KAAK,CAAC,2BAA2B,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACzD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,+EAA+E;AAC/E,kBAAkB;AAClB,+EAA+E;AAE/E,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,6BAA6B;AAC7B,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC9B,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* resolveAgent — slug → on-chain agent identity lookup for CLI commands.
|
|
3
|
+
*
|
|
4
|
+
* PRD-event-driven-provider-listening §5.7 + §A.6. Backs the new
|
|
5
|
+
* `actp test` onboarding flow (`runRequest` targets a known-named agent
|
|
6
|
+
* rather than a user-supplied address) and is reusable for future
|
|
7
|
+
* built-in references to SDK-published agents.
|
|
8
|
+
*
|
|
9
|
+
* ## Resolution order
|
|
10
|
+
*
|
|
11
|
+
* 1. **Env var override.** If the slug has a registered env var in
|
|
12
|
+
* `ENV_OVERRIDES` and the value is set, parse it as an Ethereum
|
|
13
|
+
* address. This is the rotation escape hatch: if a known agent's
|
|
14
|
+
* wallet is compromised or rotated, operators set
|
|
15
|
+
* `ACTP_SENTINEL_ADDRESS=0x...` and recover without an SDK republish.
|
|
16
|
+
* 2. **Constant table.** Per-network mapping in `KNOWN_AGENTS`. Returns
|
|
17
|
+
* a checksummed address.
|
|
18
|
+
* 3. **Miss.** Throws `AgentNotFoundError`.
|
|
19
|
+
*
|
|
20
|
+
* ## NOT in scope for this helper
|
|
21
|
+
*
|
|
22
|
+
* - Generic on-chain `AgentRegistry.resolveAgent` lookup. Deferred (PRD §11)
|
|
23
|
+
* because the SDK currently has no full agent-registry view and the
|
|
24
|
+
* built-in slugs (just `sentinel` today) cover Phase 0.
|
|
25
|
+
* - The `agirails.app/a/<slug>` URL form used by `actp pay` / `actp request`
|
|
26
|
+
* for arbitrary user-supplied slugs. That path goes through the
|
|
27
|
+
* `discoverAgents` HTTP API; this helper is for SDK-internal known names.
|
|
28
|
+
*
|
|
29
|
+
* @module cli/lib/resolveAgent
|
|
30
|
+
*/
|
|
31
|
+
export type ResolvedAgentSource = 'env' | 'table';
|
|
32
|
+
export interface ResolvedAgent {
|
|
33
|
+
/** Canonical slug used to look up the agent (e.g. `'sentinel'`). */
|
|
34
|
+
slug: string;
|
|
35
|
+
/** Checksummed Ethereum address. */
|
|
36
|
+
address: string;
|
|
37
|
+
/** Network the resolution applies to. */
|
|
38
|
+
network: string;
|
|
39
|
+
/** Where the address came from — useful for diagnostic logging. */
|
|
40
|
+
source: ResolvedAgentSource;
|
|
41
|
+
}
|
|
42
|
+
export declare class AgentNotFoundError extends Error {
|
|
43
|
+
readonly slug: string;
|
|
44
|
+
readonly network: string;
|
|
45
|
+
constructor(slug: string, network: string);
|
|
46
|
+
}
|
|
47
|
+
export declare class InvalidAgentAddressError extends Error {
|
|
48
|
+
readonly envVar: string;
|
|
49
|
+
readonly value: string;
|
|
50
|
+
constructor(envVar: string, value: string);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve a known agent slug on a given network.
|
|
54
|
+
*
|
|
55
|
+
* @throws {InvalidAgentAddressError} when an env var override is set to a
|
|
56
|
+
* non-address value.
|
|
57
|
+
* @throws {AgentNotFoundError} when no override is set and no table entry
|
|
58
|
+
* exists for the (slug, network) pair.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const sentinel = resolveAgent('sentinel', 'base-sepolia');
|
|
63
|
+
* console.log(sentinel.address, sentinel.source);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function resolveAgent(slug: string, network: string): ResolvedAgent;
|
|
67
|
+
//# sourceMappingURL=resolveAgent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveAgent.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/resolveAgent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,OAAO,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;aACf,IAAI,EAAE,MAAM;aAAkB,OAAO,EAAE,MAAM;gBAA7C,IAAI,EAAE,MAAM,EAAkB,OAAO,EAAE,MAAM;CAO1E;AAED,qBAAa,wBAAyB,SAAQ,KAAK;aACrB,MAAM,EAAE,MAAM;aAAkB,KAAK,EAAE,MAAM;gBAA7C,MAAM,EAAE,MAAM,EAAkB,KAAK,EAAE,MAAM;CAO1E;AAyBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAsBzE"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* resolveAgent — slug → on-chain agent identity lookup for CLI commands.
|
|
4
|
+
*
|
|
5
|
+
* PRD-event-driven-provider-listening §5.7 + §A.6. Backs the new
|
|
6
|
+
* `actp test` onboarding flow (`runRequest` targets a known-named agent
|
|
7
|
+
* rather than a user-supplied address) and is reusable for future
|
|
8
|
+
* built-in references to SDK-published agents.
|
|
9
|
+
*
|
|
10
|
+
* ## Resolution order
|
|
11
|
+
*
|
|
12
|
+
* 1. **Env var override.** If the slug has a registered env var in
|
|
13
|
+
* `ENV_OVERRIDES` and the value is set, parse it as an Ethereum
|
|
14
|
+
* address. This is the rotation escape hatch: if a known agent's
|
|
15
|
+
* wallet is compromised or rotated, operators set
|
|
16
|
+
* `ACTP_SENTINEL_ADDRESS=0x...` and recover without an SDK republish.
|
|
17
|
+
* 2. **Constant table.** Per-network mapping in `KNOWN_AGENTS`. Returns
|
|
18
|
+
* a checksummed address.
|
|
19
|
+
* 3. **Miss.** Throws `AgentNotFoundError`.
|
|
20
|
+
*
|
|
21
|
+
* ## NOT in scope for this helper
|
|
22
|
+
*
|
|
23
|
+
* - Generic on-chain `AgentRegistry.resolveAgent` lookup. Deferred (PRD §11)
|
|
24
|
+
* because the SDK currently has no full agent-registry view and the
|
|
25
|
+
* built-in slugs (just `sentinel` today) cover Phase 0.
|
|
26
|
+
* - The `agirails.app/a/<slug>` URL form used by `actp pay` / `actp request`
|
|
27
|
+
* for arbitrary user-supplied slugs. That path goes through the
|
|
28
|
+
* `discoverAgents` HTTP API; this helper is for SDK-internal known names.
|
|
29
|
+
*
|
|
30
|
+
* @module cli/lib/resolveAgent
|
|
31
|
+
*/
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.resolveAgent = exports.InvalidAgentAddressError = exports.AgentNotFoundError = void 0;
|
|
34
|
+
const ethers_1 = require("ethers");
|
|
35
|
+
class AgentNotFoundError extends Error {
|
|
36
|
+
constructor(slug, network) {
|
|
37
|
+
super(`Agent '${slug}' is not registered for network '${network}'. ` +
|
|
38
|
+
`Known agents on this network: ${listKnownAgents(network).join(', ') || '(none)'}.`);
|
|
39
|
+
this.slug = slug;
|
|
40
|
+
this.network = network;
|
|
41
|
+
this.name = 'AgentNotFoundError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.AgentNotFoundError = AgentNotFoundError;
|
|
45
|
+
class InvalidAgentAddressError extends Error {
|
|
46
|
+
constructor(envVar, value) {
|
|
47
|
+
super(`Env var ${envVar} contains an invalid Ethereum address: "${value}". ` +
|
|
48
|
+
`Expected a 0x-prefixed 40-character hex string.`);
|
|
49
|
+
this.envVar = envVar;
|
|
50
|
+
this.value = value;
|
|
51
|
+
this.name = 'InvalidAgentAddressError';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.InvalidAgentAddressError = InvalidAgentAddressError;
|
|
55
|
+
/**
|
|
56
|
+
* Built-in slug → address table. Lookups are case-insensitive on the slug.
|
|
57
|
+
* Add an entry here only for SDK-shipped reference agents that callers
|
|
58
|
+
* should be able to reach without external discovery (e.g. Sentinel's
|
|
59
|
+
* Base Sepolia identity used by `actp test`).
|
|
60
|
+
*/
|
|
61
|
+
const KNOWN_AGENTS = Object.freeze({
|
|
62
|
+
sentinel: Object.freeze({
|
|
63
|
+
// Source of truth: Public Agents/seed-sentinel/sentinel.md (wallet field),
|
|
64
|
+
// committed at agent publish time. If Sentinel rotates, set
|
|
65
|
+
// ACTP_SENTINEL_ADDRESS or republish the SDK.
|
|
66
|
+
'base-sepolia': '0x3813A642C57CF3c20ff1170C0646c309B4bf6d64',
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Slug → env var name. Lets operators override the constant table without
|
|
71
|
+
* republishing the SDK. Match key casing to `KNOWN_AGENTS`.
|
|
72
|
+
*/
|
|
73
|
+
const ENV_OVERRIDES = Object.freeze({
|
|
74
|
+
sentinel: 'ACTP_SENTINEL_ADDRESS',
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* Resolve a known agent slug on a given network.
|
|
78
|
+
*
|
|
79
|
+
* @throws {InvalidAgentAddressError} when an env var override is set to a
|
|
80
|
+
* non-address value.
|
|
81
|
+
* @throws {AgentNotFoundError} when no override is set and no table entry
|
|
82
|
+
* exists for the (slug, network) pair.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* const sentinel = resolveAgent('sentinel', 'base-sepolia');
|
|
87
|
+
* console.log(sentinel.address, sentinel.source);
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
function resolveAgent(slug, network) {
|
|
91
|
+
const normalizedSlug = slug.trim().toLowerCase();
|
|
92
|
+
// 1. Env var override path — rotation escape hatch (PRD §A.6).
|
|
93
|
+
// Trim before testing for empty so a botched shell export
|
|
94
|
+
// (`export ACTP_SENTINEL_ADDRESS=' '`) falls through to the constant
|
|
95
|
+
// table instead of throwing InvalidAgentAddressError — the operator's
|
|
96
|
+
// intent was clearly "no override", and surfacing a "not an address"
|
|
97
|
+
// error for whitespace would be misleading.
|
|
98
|
+
const envVar = ENV_OVERRIDES[normalizedSlug];
|
|
99
|
+
if (envVar) {
|
|
100
|
+
const raw = process.env[envVar]?.trim();
|
|
101
|
+
if (raw !== undefined && raw !== '') {
|
|
102
|
+
if (!(0, ethers_1.isAddress)(raw))
|
|
103
|
+
throw new InvalidAgentAddressError(envVar, raw);
|
|
104
|
+
return { slug: normalizedSlug, address: (0, ethers_1.getAddress)(raw), network, source: 'env' };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// 2. Constant table.
|
|
108
|
+
const addr = KNOWN_AGENTS[normalizedSlug]?.[network];
|
|
109
|
+
if (!addr)
|
|
110
|
+
throw new AgentNotFoundError(normalizedSlug, network);
|
|
111
|
+
return { slug: normalizedSlug, address: (0, ethers_1.getAddress)(addr), network, source: 'table' };
|
|
112
|
+
}
|
|
113
|
+
exports.resolveAgent = resolveAgent;
|
|
114
|
+
/**
|
|
115
|
+
* List the slugs that have a constant-table entry on the given network.
|
|
116
|
+
* Used by `AgentNotFoundError` for a helpful "did you mean..." hint.
|
|
117
|
+
*/
|
|
118
|
+
function listKnownAgents(network) {
|
|
119
|
+
return Object.keys(KNOWN_AGENTS).filter((slug) => KNOWN_AGENTS[slug][network] !== undefined);
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=resolveAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveAgent.js","sourceRoot":"","sources":["../../../src/cli/lib/resolveAgent.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AAEH,mCAA+C;AAe/C,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,YAA4B,IAAY,EAAkB,OAAe;QACvE,KAAK,CACH,UAAU,IAAI,oCAAoC,OAAO,KAAK;YAC9D,iCAAiC,eAAe,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,GAAG,CACpF,CAAC;QAJwB,SAAI,GAAJ,IAAI,CAAQ;QAAkB,YAAO,GAAP,OAAO,CAAQ;QAKvE,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AARD,gDAQC;AAED,MAAa,wBAAyB,SAAQ,KAAK;IACjD,YAA4B,MAAc,EAAkB,KAAa;QACvE,KAAK,CACH,WAAW,MAAM,2CAA2C,KAAK,KAAK;YACtE,iDAAiD,CAClD,CAAC;QAJwB,WAAM,GAAN,MAAM,CAAQ;QAAkB,UAAK,GAAL,KAAK,CAAQ;QAKvE,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AARD,4DAQC;AAED;;;;;GAKG;AACH,MAAM,YAAY,GAA+D,MAAM,CAAC,MAAM,CAAC;IAC7F,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;QACtB,2EAA2E;QAC3E,4DAA4D;QAC5D,8CAA8C;QAC9C,cAAc,EAAE,4CAA4C;KAC7D,CAAC;CACH,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,aAAa,GAAqC,MAAM,CAAC,MAAM,CAAC;IACpE,QAAQ,EAAE,uBAAuB;CAClC,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG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AAK,SAAS,CAAC,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runRequest — Level 1 requester flow (PRD §5.6).
|
|
3
|
+
*
|
|
4
|
+
* Shared helper for `actp request` and (via §5.7) `actp test`. Distinct from
|
|
5
|
+
* `src/level0/request.ts`: that function is the Level 0 simple API with one
|
|
6
|
+
* monolithic delivery timeout; runRequest splits the lifecycle into a
|
|
7
|
+
* **quote phase** (capped by `quoteTimeoutMs`, default 30s) and a **delivery
|
|
8
|
+
* phase** (capped by `deliveryTimeoutMs`, default 5min), and reports each
|
|
9
|
+
* state transition so the CLI can show progress.
|
|
10
|
+
*
|
|
11
|
+
* ## Scope (4.0.0): poll-only, autoAccept-friendly path
|
|
12
|
+
*
|
|
13
|
+
* `runRequest` polls `runtime.getTransaction(txId)` to observe state
|
|
14
|
+
* transitions and relies on a provider whose `shouldAutoAccept` returns
|
|
15
|
+
* `true` to drive INITIATED → COMMITTED on its own side (provider calls
|
|
16
|
+
* `linkEscrow` from `Agent.handleIncomingTransaction`). This is the
|
|
17
|
+
* Sentinel onboarding path the PRD targets.
|
|
18
|
+
*
|
|
19
|
+
* It does **not** implement PRD §5.6 step 6's `counteraccept.v1` envelope
|
|
20
|
+
* over `NegotiationChannel`. Multi-round counter-offer negotiation (which
|
|
21
|
+
* BuyerOrchestrator uses) is out of scope here. A future commit on the
|
|
22
|
+
* 4.x track will wire `subscribeTxId` + send the envelope when:
|
|
23
|
+
* - the provider returns a quote that differs from the requester's offer, or
|
|
24
|
+
* - the requester wants explicit accept-with-different-amount control.
|
|
25
|
+
*
|
|
26
|
+
* For Sentinel + autoAccept, the polling path is functionally equivalent
|
|
27
|
+
* to the negotiated path and ~80 LOC simpler.
|
|
28
|
+
*
|
|
29
|
+
* ## PRD §5.6 invariants enforced here
|
|
30
|
+
* - On-chain `serviceDescription` is the bytes32 routing key
|
|
31
|
+
* `keccak256(toUtf8Bytes(serviceName.trim()))`. Never JSON.
|
|
32
|
+
* - Requester immediately settles after DELIVERED (kernel allows this
|
|
33
|
+
* without waiting for the dispute window; ACTPKernel.sol:700-704).
|
|
34
|
+
* - Quote-timeout exit is non-zero (code 2 at the CLI layer). The TX
|
|
35
|
+
* remains on-chain INITIATED for the caller to cancel manually.
|
|
36
|
+
* - `--input` / `--metadata` are out of scope for 4.0.0; provider sees
|
|
37
|
+
* `job.input = {}`. Future `agirails.request.v1` envelope on
|
|
38
|
+
* `NegotiationChannel` will restore that path (PRD §11).
|
|
39
|
+
*
|
|
40
|
+
* @module cli/lib/runRequest
|
|
41
|
+
*/
|
|
42
|
+
import { TransactionState } from '../../runtime/types/MockState';
|
|
43
|
+
export type RequestNetwork = 'mock' | 'testnet' | 'mainnet';
|
|
44
|
+
export interface RunRequestOptions {
|
|
45
|
+
/** Provider — checksummed or lowercase Ethereum address. */
|
|
46
|
+
provider: string;
|
|
47
|
+
/** Amount in USDC, human-readable (e.g. "0.05"). */
|
|
48
|
+
amount: string;
|
|
49
|
+
/** Service name. On-chain key is `keccak256(toUtf8Bytes(name))`. */
|
|
50
|
+
service: string;
|
|
51
|
+
/** Deadline as ISO 8601 string OR unix seconds. Default: now + 1h. */
|
|
52
|
+
deadline?: string | number;
|
|
53
|
+
/** Target network. Default 'testnet'. */
|
|
54
|
+
network?: RequestNetwork;
|
|
55
|
+
/** Quote-phase timeout in milliseconds. Default 30_000 (PRD §5.6). */
|
|
56
|
+
quoteTimeoutMs?: number;
|
|
57
|
+
/** Delivery-phase timeout in milliseconds. Default 300_000 (5min). */
|
|
58
|
+
deliveryTimeoutMs?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Auto-accept any quote without prompting. 4.0.0 has no
|
|
61
|
+
* interactive-confirm UI yet, so this is effectively always true.
|
|
62
|
+
* Reserved for forward compatibility with interactive flows.
|
|
63
|
+
*/
|
|
64
|
+
autoAccept?: boolean;
|
|
65
|
+
/** Override requester wallet (testnet/mainnet); resolved via keystore if omitted. */
|
|
66
|
+
privateKey?: string;
|
|
67
|
+
/** Override JSON-RPC URL. Falls back to network default. */
|
|
68
|
+
rpcUrl?: string;
|
|
69
|
+
/** Custom state directory for mock mode. */
|
|
70
|
+
stateDirectory?: string;
|
|
71
|
+
/** Called for every state transition the requester observes. */
|
|
72
|
+
onTransition?: (state: TransactionState, txId: string, ts: Date) => void;
|
|
73
|
+
}
|
|
74
|
+
export declare class QuoteTimeoutError extends Error {
|
|
75
|
+
readonly txId: string;
|
|
76
|
+
readonly timeoutMs: number;
|
|
77
|
+
constructor(txId: string, timeoutMs: number);
|
|
78
|
+
}
|
|
79
|
+
export declare class DeliveryTimeoutError extends Error {
|
|
80
|
+
readonly txId: string;
|
|
81
|
+
readonly timeoutMs: number;
|
|
82
|
+
readonly lastState: TransactionState;
|
|
83
|
+
constructor(txId: string, timeoutMs: number, lastState: TransactionState);
|
|
84
|
+
}
|
|
85
|
+
export interface RunRequestResult {
|
|
86
|
+
/** On-chain transaction id (bytes32 hex). */
|
|
87
|
+
txId: string;
|
|
88
|
+
/** Final state observed before runRequest returned. */
|
|
89
|
+
finalState: TransactionState;
|
|
90
|
+
/** Total time from createTransaction to settle/return, in ms. */
|
|
91
|
+
elapsedMs: number;
|
|
92
|
+
/** Decoded delivery payload, when available. */
|
|
93
|
+
payload?: unknown;
|
|
94
|
+
/** Whether the requester settled the escrow before returning. */
|
|
95
|
+
settled: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Execute a Level 1 negotiated request end-to-end.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const r = await runRequest({
|
|
103
|
+
* provider: '0x3813...d64',
|
|
104
|
+
* amount: '0.05',
|
|
105
|
+
* service: 'onboarding',
|
|
106
|
+
* network: 'testnet',
|
|
107
|
+
* onTransition: (state, txId, ts) =>
|
|
108
|
+
* console.log(`[${ts.toISOString()}] ${state.padEnd(12)} ${txId}`),
|
|
109
|
+
* });
|
|
110
|
+
* console.log(r.payload);
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export declare function runRequest(opts: RunRequestOptions): Promise<RunRequestResult>;
|
|
114
|
+
//# sourceMappingURL=runRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runRequest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/runRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAKH,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,yCAAyC;IACzC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gEAAgE;IAChE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,KAAK,IAAI,CAAC;CAC1E;AAED,qBAAa,iBAAkB,SAAQ,KAAK;aACd,IAAI,EAAE,MAAM;aAAkB,SAAS,EAAE,M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