tenjin-cli 0.1.0-alpha.21 → 0.1.0-alpha.23
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/README.md +17 -14
- package/dist/{chunk-PJEG2JIJ.js → chunk-2RMXTNLT.js} +4 -4
- package/dist/{chunk-2AQO4YDI.js → chunk-3IOS6YG6.js} +3 -3
- package/dist/{chunk-IOIHYOU4.js → chunk-6O6DFYF3.js} +2 -2
- package/dist/chunk-A2XMQSWI.js +140 -0
- package/dist/chunk-A2XMQSWI.js.map +1 -0
- package/dist/{chunk-YVODPFTL.js → chunk-DHCOGDJB.js} +4 -4
- package/dist/{chunk-AQRUD5GQ.js → chunk-F4IJQBGP.js} +4 -4
- package/dist/{chunk-SRVDXR6B.js → chunk-GONDQ27X.js} +5 -5
- package/dist/{chunk-JN7TMXVF.js → chunk-HJYI52HM.js} +2 -2
- package/dist/{chunk-UY2TOI3B.js → chunk-HTC4VJFT.js} +77 -7
- package/dist/chunk-HTC4VJFT.js.map +1 -0
- package/dist/{chunk-OTPEH3AH.js → chunk-I2GBBIDI.js} +5 -5
- package/dist/{chunk-GHTPYKDT.js → chunk-K63HPLYT.js} +4 -4
- package/dist/{chunk-3EUTWC2B.js → chunk-N7A5EXJZ.js} +4 -4
- package/dist/{chunk-N4DJEQAF.js → chunk-NYJCBQL5.js} +2 -2
- package/dist/{chunk-RCJQARZF.js → chunk-RA2J3TWG.js} +2 -2
- package/dist/{chunk-RCJQARZF.js.map → chunk-RA2J3TWG.js.map} +1 -1
- package/dist/{chunk-W3LVZ2EN.js → chunk-SAN5PFTL.js} +102 -5
- package/dist/chunk-SAN5PFTL.js.map +1 -0
- package/dist/{chunk-QRFONFRW.js → chunk-UGLTSPXQ.js} +2 -2
- package/dist/{chunk-IOB7URFH.js → chunk-UHEMZEGW.js} +2 -2
- package/dist/{chunk-U2ATFMKZ.js → chunk-WXFVJPZD.js} +2 -2
- package/dist/{chunk-C363JZN2.js → chunk-XBYTP4SP.js} +3 -3
- package/dist/{chunk-OSUD6YZZ.js → chunk-Y3LKUXZA.js} +8 -8
- package/dist/{chunk-ETW2ASBP.js → chunk-YT7A7DLY.js} +94 -29
- package/dist/chunk-YT7A7DLY.js.map +1 -0
- package/dist/{cli-7KJ4QLUU.js → cli-MUYFTWWB.js} +28 -28
- package/dist/{cli-7KJ4QLUU.js.map → cli-MUYFTWWB.js.map} +1 -1
- package/dist/{config-MSN6H4MD.js → config-IIRRO3XC.js} +7 -7
- package/dist/{doctor-ITUCKN6C.js → doctor-KGHM2CAC.js} +15 -15
- package/dist/{fund-XPB4IIG5.js → fund-DOWIT3JT.js} +9 -10
- package/dist/{fund-XPB4IIG5.js.map → fund-DOWIT3JT.js.map} +1 -1
- package/dist/{hook-command-VVV2Q23L.js → hook-command-RDT754KQ.js} +90 -12
- package/dist/hook-command-RDT754KQ.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/{install-OSJRM2ME.js → install-BYQUMYBN.js} +10 -10
- package/dist/{install-identity-YIWKQOUD.js → install-identity-KTQPYVAO.js} +6 -6
- package/dist/{install-wallet-BWJO2SUC.js → install-wallet-T737X74E.js} +8 -9
- package/dist/{install-wallet-BWJO2SUC.js.map → install-wallet-T737X74E.js.map} +1 -1
- package/dist/{mcp-KE5YKPS2.js → mcp-ZKOTURQN.js} +462 -69
- package/dist/mcp-ZKOTURQN.js.map +1 -0
- package/dist/{pay-MUV2U232.js → pay-LZPU2HUT.js} +11 -12
- package/dist/{payments-4D27K4L2.js → payments-26NVMFR2.js} +6 -7
- package/dist/{payments-4D27K4L2.js.map → payments-26NVMFR2.js.map} +1 -1
- package/dist/{send-BXHFKDBF.js → send-4RUBQQKP.js} +8 -9
- package/dist/{send-BXHFKDBF.js.map → send-4RUBQQKP.js.map} +1 -1
- package/dist/{status-3Z3YPRSE.js → status-CEHZKHBU.js} +5 -5
- package/dist/{status-line-CKRMGZ3Q.js → status-line-QRAO3Y2E.js} +4 -4
- package/dist/{status-line-wiring-GECLIIBT.js → status-line-wiring-7D2CSV3K.js} +4 -4
- package/dist/tenjin-daemon.mjs +5 -2
- package/dist/{uninstall-BZTVWJ7W.js → uninstall-VR44B4KD.js} +10 -10
- package/dist/{update-IQQTEOI5.js → update-SOYQLDBF.js} +5 -5
- package/dist/{wallet-UFXQ57TZ.js → wallet-IB2EFAUP.js} +8 -9
- package/docs/agent-permissions.md +8 -8
- package/docs/safety-model.md +2 -2
- package/package.json +1 -1
- package/dist/chunk-ETW2ASBP.js.map +0 -1
- package/dist/chunk-QHILSA6G.js +0 -82
- package/dist/chunk-QHILSA6G.js.map +0 -1
- package/dist/chunk-UY2TOI3B.js.map +0 -1
- package/dist/chunk-W3LVZ2EN.js.map +0 -1
- package/dist/hook-command-VVV2Q23L.js.map +0 -1
- package/dist/mcp-KE5YKPS2.js.map +0 -1
- /package/dist/{chunk-PJEG2JIJ.js.map → chunk-2RMXTNLT.js.map} +0 -0
- /package/dist/{chunk-2AQO4YDI.js.map → chunk-3IOS6YG6.js.map} +0 -0
- /package/dist/{chunk-IOIHYOU4.js.map → chunk-6O6DFYF3.js.map} +0 -0
- /package/dist/{chunk-YVODPFTL.js.map → chunk-DHCOGDJB.js.map} +0 -0
- /package/dist/{chunk-AQRUD5GQ.js.map → chunk-F4IJQBGP.js.map} +0 -0
- /package/dist/{chunk-SRVDXR6B.js.map → chunk-GONDQ27X.js.map} +0 -0
- /package/dist/{chunk-JN7TMXVF.js.map → chunk-HJYI52HM.js.map} +0 -0
- /package/dist/{chunk-OTPEH3AH.js.map → chunk-I2GBBIDI.js.map} +0 -0
- /package/dist/{chunk-GHTPYKDT.js.map → chunk-K63HPLYT.js.map} +0 -0
- /package/dist/{chunk-3EUTWC2B.js.map → chunk-N7A5EXJZ.js.map} +0 -0
- /package/dist/{chunk-N4DJEQAF.js.map → chunk-NYJCBQL5.js.map} +0 -0
- /package/dist/{chunk-QRFONFRW.js.map → chunk-UGLTSPXQ.js.map} +0 -0
- /package/dist/{chunk-IOB7URFH.js.map → chunk-UHEMZEGW.js.map} +0 -0
- /package/dist/{chunk-U2ATFMKZ.js.map → chunk-WXFVJPZD.js.map} +0 -0
- /package/dist/{chunk-C363JZN2.js.map → chunk-XBYTP4SP.js.map} +0 -0
- /package/dist/{chunk-OSUD6YZZ.js.map → chunk-Y3LKUXZA.js.map} +0 -0
- /package/dist/{config-MSN6H4MD.js.map → config-IIRRO3XC.js.map} +0 -0
- /package/dist/{doctor-ITUCKN6C.js.map → doctor-KGHM2CAC.js.map} +0 -0
- /package/dist/{install-OSJRM2ME.js.map → install-BYQUMYBN.js.map} +0 -0
- /package/dist/{install-identity-YIWKQOUD.js.map → install-identity-KTQPYVAO.js.map} +0 -0
- /package/dist/{pay-MUV2U232.js.map → pay-LZPU2HUT.js.map} +0 -0
- /package/dist/{status-3Z3YPRSE.js.map → status-CEHZKHBU.js.map} +0 -0
- /package/dist/{status-line-CKRMGZ3Q.js.map → status-line-QRAO3Y2E.js.map} +0 -0
- /package/dist/{status-line-wiring-GECLIIBT.js.map → status-line-wiring-7D2CSV3K.js.map} +0 -0
- /package/dist/{uninstall-BZTVWJ7W.js.map → uninstall-VR44B4KD.js.map} +0 -0
- /package/dist/{update-IQQTEOI5.js.map → update-SOYQLDBF.js.map} +0 -0
- /package/dist/{wallet-UFXQ57TZ.js.map → wallet-IB2EFAUP.js.map} +0 -0
package/README.md
CHANGED
|
@@ -77,18 +77,21 @@ Each answer names the provider and the price. Your agent keeps its own tools, an
|
|
|
77
77
|
|
|
78
78
|
The router picks from a catalog we curate and maintain. When nothing in it fits, it can point your agent at a reviewed third-party pay-per-call service from the [Tenjin list](#tenjin-list-and-experimental-bazaar), and your agent decides whether to use it or to ask you first. Routing is free: you pay the provider's price and nothing else.
|
|
79
79
|
|
|
80
|
-
| Tool
|
|
81
|
-
|
|
|
82
|
-
| **Docs lookup** · [Context7](https://context7.com)
|
|
83
|
-
| **Web research** · [Exa](https://exa.ai)
|
|
84
|
-
| **Read a page** · [Firecrawl](https://firecrawl.dev)
|
|
85
|
-
| **Crypto prices** · [CoinMarketCap](https://coinmarketcap.com)
|
|
86
|
-
| **Compute** · [Wolfram Alpha](https://www.wolframalpha.com)
|
|
87
|
-
| **Email check** · [Hunter](https://hunter.io)
|
|
88
|
-
| **Person lookup** ·
|
|
89
|
-
| **Company profile** · [
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
| Tool | What your agent gets | Price per call |
|
|
81
|
+
| -------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -------------- |
|
|
82
|
+
| **Docs lookup** · [Context7](https://context7.com) | Current, version-specific docs for a library or API | **Free** |
|
|
83
|
+
| **Web research** · [Exa](https://exa.ai) | Search results with the page content, not just links | $0.007 |
|
|
84
|
+
| **Read a page** · [Firecrawl](https://firecrawl.dev) | One exact page as clean text, even when a plain fetch fails | $0.01 |
|
|
85
|
+
| **Crypto prices** · [CoinMarketCap](https://coinmarketcap.com) | Live quotes for any coin | $0.01 |
|
|
86
|
+
| **Compute** · [Wolfram Alpha](https://www.wolframalpha.com) | Math, unit conversions, science and data questions | $0.02 |
|
|
87
|
+
| **Email check** · [Hunter](https://hunter.io) | Whether an address is real and deliverable | $0.008 |
|
|
88
|
+
| **Person lookup** · [Apollo](https://www.apollo.io) | A professional profile and work email from a name and company, a LinkedIn URL or an email | $0.01 |
|
|
89
|
+
| **Company profile** · [Apollo](https://www.apollo.io) | Industry, headcount, revenue and funding from a domain | $0.01 |
|
|
90
|
+
| **Company match** · [CompanyEnrich](https://companyenrich.com) | The company behind a name or a social URL | $0.01225 |
|
|
91
|
+
| **X posts** · [glim](https://glim.sh) | Posts matching a search, or one post with its thread | $0.005 |
|
|
92
|
+
| **Reddit** · [glim](https://glim.sh) | Posts matching a search, or one thread with its comments | $0.01 / $0.005 |
|
|
93
|
+
|
|
94
|
+
Free tools run without a funded wallet. More are added by demand: [tell us what you want](#request-a-tool).
|
|
92
95
|
|
|
93
96
|
### Tenjin list and experimental Bazaar
|
|
94
97
|
|
|
@@ -114,7 +117,7 @@ flowchart LR
|
|
|
114
117
|
|
|
115
118
|
The Tenjin router hooks into Claude Code at your prompt, before each web search or page fetch, when your agent hands work to a subagent, and around a question your agent asks you. At each point it asks Jev, a decision model from [TypeSafe](https://typesafe.ai), whether a tool in the catalog fits. When none does, Jev may pick one third-party service from a short list matching the step (the Tenjin list, plus the open Bazaar if you turned it on), or none. Either way Jev only chooses from a list, so it never writes a call or an instruction for your agent; a third-party listing's description is the seller's own, and your agent judges it.
|
|
116
119
|
|
|
117
|
-
When one fits, your agent sees a one-line suggestion with the tool and its price, and calls it through Tenjin's `x402` MCP server. Tenjin pays the provider from your wallet, within your limits, and hands back the result. Your status line shows the call as it happens:
|
|
120
|
+
When one fits, your agent sees a one-line suggestion with the tool and its price, and calls it through Tenjin's `x402` MCP server: the offer's id alone shows the tool's inputs, an example and what it returns, and the id with the agent's input runs it. Tenjin builds the call, pays the provider from your wallet, within your limits, and hands back the result. Your status line shows the call as it happens:
|
|
118
121
|
|
|
119
122
|
```text
|
|
120
123
|
x402 · request: calling pro-api.coinmarketcap.com/x402/v3/cryptocurrency/quotes/latest · {"query":{"symbol":"BTC,ETH"}}
|
|
@@ -164,7 +167,7 @@ tenjin uninstall # remove the Claude Code setup; your wallet stays
|
|
|
164
167
|
|
|
165
168
|
Use `tenjin install --project` to set it up for a single project. Add `--json` to any command for machine-readable output.
|
|
166
169
|
|
|
167
|
-
Every paid lookup is recorded on your machine in `~/.tenjin/paid/ledger.jsonl`: what was sent (masked), who was paid, how much, the settlement transaction, and any files saved. Files a paid lookup returns, and media files a paid third-party service links to, are saved under `~/.tenjin/downloads/`. When a seller never confirmed settlement, `tenjin payments reconcile` asks USDC on Base whether the payment was used once it has expired, and one that was never charged goes back to today's limit; the `request` tool does the same for up to three beside each lookup, without waiting for it.
|
|
170
|
+
Every paid lookup is recorded on your machine in `~/.tenjin/paid/ledger.jsonl`: what was sent (masked), who was paid, how much, the settlement transaction, and any files saved. Files a paid lookup returns, and media files a paid third-party service links to, are saved under `~/.tenjin/downloads/`. When a tool names the fields it returns, your agent gets those fields and the provider's whole response is saved under `~/.tenjin/results/` for a day, at the path the result names. When a seller never confirmed settlement, `tenjin payments reconcile` asks USDC on Base whether the payment was used once it has expired, and one that was never charged goes back to today's limit; the `request` tool does the same for up to three beside each lookup, without waiting for it.
|
|
168
171
|
|
|
169
172
|
<details>
|
|
170
173
|
<summary>Status line: keeping your own</summary>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
getUsdcBalance
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-F4IJQBGP.js";
|
|
5
5
|
import {
|
|
6
6
|
commitLocalWallet,
|
|
7
7
|
createLocalWallet,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
verifyAndPreserveOutgoingWallet,
|
|
15
15
|
walletExistsError,
|
|
16
16
|
walletFileExists
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-DHCOGDJB.js";
|
|
18
18
|
import {
|
|
19
19
|
LockTimeoutError,
|
|
20
20
|
withFileLock
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
loadRawConfig,
|
|
27
27
|
resolveSettings
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-SAN5PFTL.js";
|
|
29
29
|
import {
|
|
30
30
|
CliError
|
|
31
31
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -239,4 +239,4 @@ export {
|
|
|
239
239
|
runWalletShow,
|
|
240
240
|
runWalletBalance
|
|
241
241
|
};
|
|
242
|
-
//# sourceMappingURL=chunk-
|
|
242
|
+
//# sourceMappingURL=chunk-2RMXTNLT.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
PRODUCTION_ORIGIN
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SAN5PFTL.js";
|
|
5
5
|
import {
|
|
6
6
|
package_default
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RA2J3TWG.js";
|
|
8
8
|
import {
|
|
9
9
|
CliError
|
|
10
10
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -288,4 +288,4 @@ export {
|
|
|
288
288
|
httpRequest,
|
|
289
289
|
fetchFailureToCliError
|
|
290
290
|
};
|
|
291
|
-
//# sourceMappingURL=chunk-
|
|
291
|
+
//# sourceMappingURL=chunk-3IOS6YG6.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
package_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RA2J3TWG.js";
|
|
5
5
|
import {
|
|
6
6
|
CliError,
|
|
7
7
|
HARNESSES,
|
|
@@ -1781,4 +1781,4 @@ export {
|
|
|
1781
1781
|
registeredHooks,
|
|
1782
1782
|
writeHooks
|
|
1783
1783
|
};
|
|
1784
|
-
//# sourceMappingURL=chunk-
|
|
1784
|
+
//# sourceMappingURL=chunk-6O6DFYF3.js.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
OfferSpecSchema
|
|
4
|
+
} from "./chunk-HTC4VJFT.js";
|
|
5
|
+
import {
|
|
6
|
+
external_exports
|
|
7
|
+
} from "./chunk-SAN5PFTL.js";
|
|
8
|
+
import {
|
|
9
|
+
writeFileAtomic,
|
|
10
|
+
writeFileAtomicExclusive
|
|
11
|
+
} from "./chunk-JLEF5WHM.js";
|
|
12
|
+
|
|
13
|
+
// src/router/specs.ts
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
import { constants } from "node:fs";
|
|
16
|
+
import { lstat, open, opendir, rm } from "node:fs/promises";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
var SPECS_DIR = join("progress", "specs");
|
|
19
|
+
var RESULTS_DIR = "results";
|
|
20
|
+
var MAX_SPEC_BYTES = 128 * 1024;
|
|
21
|
+
var SPEC_TTL_MS = 15 * 6e4;
|
|
22
|
+
var RESULT_TTL_MS = 24 * 60 * 6e4;
|
|
23
|
+
var digest = (value) => createHash("sha256").update(value).digest("hex");
|
|
24
|
+
function specPath(dataDir, id) {
|
|
25
|
+
return join(dataDir, SPECS_DIR, `${digest(id)}.json`);
|
|
26
|
+
}
|
|
27
|
+
async function storeSpecs(dataDir, specs) {
|
|
28
|
+
if (specs === void 0 || specs.length === 0) return;
|
|
29
|
+
for (const spec of specs) {
|
|
30
|
+
try {
|
|
31
|
+
await writeFileAtomic(specPath(dataDir, spec.id), JSON.stringify(spec), {
|
|
32
|
+
mode: 384,
|
|
33
|
+
dirMode: 448
|
|
34
|
+
});
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
await prune(join(dataDir, SPECS_DIR), SPEC_TTL_MS, Date.now());
|
|
39
|
+
}
|
|
40
|
+
async function readSpec(dataDir, id) {
|
|
41
|
+
const path = specPath(dataDir, id);
|
|
42
|
+
const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW).catch(() => void 0);
|
|
43
|
+
if (file === void 0) return null;
|
|
44
|
+
try {
|
|
45
|
+
const stat = await file.stat();
|
|
46
|
+
if (Date.now() - stat.mtimeMs > SPEC_TTL_MS || stat.size > MAX_SPEC_BYTES) return null;
|
|
47
|
+
const parsed = OfferSpecSchema.safeParse(JSON.parse(await file.readFile("utf8")));
|
|
48
|
+
return parsed.success && parsed.data.id === id ? parsed.data : null;
|
|
49
|
+
} catch {
|
|
50
|
+
return null;
|
|
51
|
+
} finally {
|
|
52
|
+
await file.close().catch(() => void 0);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
var PaymentSchema = external_exports.discriminatedUnion("state", [
|
|
56
|
+
external_exports.strictObject({
|
|
57
|
+
state: external_exports.literal("paid"),
|
|
58
|
+
at: external_exports.string().max(40),
|
|
59
|
+
amountAtomic: external_exports.string().regex(/^\d+$/),
|
|
60
|
+
txHash: external_exports.string().max(100).optional()
|
|
61
|
+
}),
|
|
62
|
+
external_exports.strictObject({ state: external_exports.literal("possibly_paid"), at: external_exports.string().max(40) }),
|
|
63
|
+
external_exports.strictObject({ state: external_exports.literal("running"), at: external_exports.string().max(40) })
|
|
64
|
+
]);
|
|
65
|
+
function paymentPath(dataDir, id) {
|
|
66
|
+
return join(dataDir, SPECS_DIR, `${digest(id)}.paid.json`);
|
|
67
|
+
}
|
|
68
|
+
async function claimSpecPayment(dataDir, id, now = Date.now()) {
|
|
69
|
+
const path = paymentPath(dataDir, id);
|
|
70
|
+
try {
|
|
71
|
+
await writeFileAtomicExclusive(
|
|
72
|
+
path,
|
|
73
|
+
JSON.stringify({ state: "running", at: new Date(now).toISOString() }),
|
|
74
|
+
{ mode: 384, dirMode: 448 }
|
|
75
|
+
);
|
|
76
|
+
return null;
|
|
77
|
+
} catch (err) {
|
|
78
|
+
if (err.code !== "EEXIST") return { state: "unrecorded" };
|
|
79
|
+
}
|
|
80
|
+
const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW).catch(() => void 0);
|
|
81
|
+
if (file === void 0) return { state: "running" };
|
|
82
|
+
try {
|
|
83
|
+
const parsed = PaymentSchema.safeParse(JSON.parse(await file.readFile("utf8")));
|
|
84
|
+
return parsed.success ? parsed.data : { state: "running" };
|
|
85
|
+
} catch {
|
|
86
|
+
return { state: "running" };
|
|
87
|
+
} finally {
|
|
88
|
+
await file.close().catch(() => void 0);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function settleSpecPayment(dataDir, id, left, now = Date.now()) {
|
|
92
|
+
const path = paymentPath(dataDir, id);
|
|
93
|
+
if (!left.signed && left.amountAtomic === 0n) {
|
|
94
|
+
await rm(path, { force: true }).catch(() => void 0);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const at = new Date(now).toISOString();
|
|
98
|
+
const record = left.amountAtomic > 0n ? {
|
|
99
|
+
state: "paid",
|
|
100
|
+
at,
|
|
101
|
+
amountAtomic: left.amountAtomic.toString(),
|
|
102
|
+
...left.txHash !== void 0 ? { txHash: left.txHash } : {}
|
|
103
|
+
} : { state: "possibly_paid", at };
|
|
104
|
+
await writeFileAtomic(path, JSON.stringify(record), { mode: 384, dirMode: 448 }).catch(
|
|
105
|
+
() => void 0
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
async function storeFullResult(dataDir, id, body) {
|
|
109
|
+
const path = join(dataDir, RESULTS_DIR, `${digest(id)}.json`);
|
|
110
|
+
try {
|
|
111
|
+
await writeFileAtomic(path, body, { mode: 384, dirMode: 448 });
|
|
112
|
+
} catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
void prune(join(dataDir, RESULTS_DIR), RESULT_TTL_MS, Date.now());
|
|
116
|
+
return path;
|
|
117
|
+
}
|
|
118
|
+
async function prune(dir, ttlMs, now) {
|
|
119
|
+
try {
|
|
120
|
+
const directory = await opendir(dir);
|
|
121
|
+
for await (const entry of directory) {
|
|
122
|
+
if (!entry.isFile()) continue;
|
|
123
|
+
const path = join(dir, entry.name);
|
|
124
|
+
const stat = await lstat(path).catch(() => void 0);
|
|
125
|
+
if (stat === void 0 || now - stat.mtimeMs > ttlMs) {
|
|
126
|
+
await rm(path, { force: true }).catch(() => void 0);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
} catch {
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
storeSpecs,
|
|
135
|
+
readSpec,
|
|
136
|
+
claimSpecPayment,
|
|
137
|
+
settleSpecPayment,
|
|
138
|
+
storeFullResult
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=chunk-A2XMQSWI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/router/specs.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { constants } from 'node:fs';\nimport { lstat, open, opendir, rm } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { z } from 'zod';\nimport { writeFileAtomic, writeFileAtomicExclusive } from '../lib/atomic-json';\nimport { OfferSpecSchema, type OfferSpec } from './decision';\n\n/**\n * THE REQUEST SPECS AN OFFER CARRIED, kept on this machine by the offer's id. The\n * hook that shows a line stores the spec of every service the line names; the\n * `request` tool, which runs in the MCP server's own process and never sees\n * the hook, reads one back by the id the agent passes. One file per id, named\n * by the id's SHA-256, so a read is one open and needs no session.\n *\n * Best effort on the write, like every record the hooks keep: with no spec\n * stored, `request({id})` says none is kept and asks for the query its line\n * named. A spec is the server's own answer, re-parsed on the way back in, and\n * it lives as long as the server keeps the offer's id.\n */\n\nconst SPECS_DIR = join('progress', 'specs');\nconst RESULTS_DIR = 'results';\n/** A spec holds a service's whole input schema; far larger than any record. */\nconst MAX_SPEC_BYTES = 128 * 1024;\n/** The server's decision expiry: past it, the id's outcome report and an\n * `{id, query}` fallback find no row. */\nexport const SPEC_TTL_MS = 15 * 60_000;\n/** A saved result outlives its offer: the agent opens it later in the session,\n * or in the next step of a chain. A day covers a working session. */\nexport const RESULT_TTL_MS = 24 * 60 * 60_000;\n\nconst digest = (value: string): string => createHash('sha256').update(value).digest('hex');\n\nfunction specPath(dataDir: string, id: string): string {\n return join(dataDir, SPECS_DIR, `${digest(id)}.json`);\n}\n\n/**\n * Store each spec under its id, and drop expired ones. Never throws. Ages are\n * file mtimes, so they are read against the real clock, never a caller's.\n */\nexport async function storeSpecs(\n dataDir: string,\n specs: readonly OfferSpec[] | undefined,\n): Promise<void> {\n if (specs === undefined || specs.length === 0) return;\n for (const spec of specs) {\n try {\n await writeFileAtomic(specPath(dataDir, spec.id), JSON.stringify(spec), {\n mode: 0o600,\n dirMode: 0o700,\n });\n } catch {\n // The tool falls back to the server for this id.\n }\n }\n await prune(join(dataDir, SPECS_DIR), SPEC_TTL_MS, Date.now());\n}\n\n/** The spec stored for this id, or null: none, expired, damaged or not ours. */\nexport async function readSpec(dataDir: string, id: string): Promise<OfferSpec | null> {\n const path = specPath(dataDir, id);\n // O_NOFOLLOW: the directory is the user's, and a planted symlink must not\n // turn this read into a read of something else.\n const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW).catch(() => undefined);\n if (file === undefined) return null;\n try {\n const stat = await file.stat();\n if (Date.now() - stat.mtimeMs > SPEC_TTL_MS || stat.size > MAX_SPEC_BYTES) return null;\n const parsed = OfferSpecSchema.safeParse(JSON.parse(await file.readFile('utf8')));\n return parsed.success && parsed.data.id === id ? parsed.data : null;\n } catch {\n return null;\n } finally {\n await file.close().catch(() => undefined);\n }\n}\n\n/**\n * What an earlier call with a spec's id left. `paid`: money left for it.\n * `possibly_paid`: a payment was signed and may have left, but the call ended\n * without saying how much (a spend ledger that could not be written, say).\n * `running`: a call claimed it and has not ended, or its process died, so it\n * may have paid. `unrecorded`: this call could not record its claim.\n */\nexport type EarlierPayment =\n | { state: 'paid'; at: string; amountAtomic: string; txHash?: string }\n | { state: 'possibly_paid'; at: string }\n | { state: 'running'; at?: string }\n | { state: 'unrecorded' };\n\nconst PaymentSchema = z.discriminatedUnion('state', [\n z.strictObject({\n state: z.literal('paid'),\n at: z.string().max(40),\n amountAtomic: z.string().regex(/^\\d+$/),\n txHash: z.string().max(100).optional(),\n }),\n z.strictObject({ state: z.literal('possibly_paid'), at: z.string().max(40) }),\n z.strictObject({ state: z.literal('running'), at: z.string().max(40) }),\n]);\n\nfunction paymentPath(dataDir: string, id: string): string {\n return join(dataDir, SPECS_DIR, `${digest(id)}.paid.json`);\n}\n\n/**\n * CLAIM THE ONE PAYMENT A SPEC ALLOWS, before anything is signed: an exclusive\n * create beside the spec, so a retry or a second call with the same id cannot\n * pay again. Null when the claim is this call's; otherwise what an earlier call\n * left, and this one pays nothing. A claim that cannot be written refuses too:\n * the record is the only proof a payment has not already left.\n */\nexport async function claimSpecPayment(\n dataDir: string,\n id: string,\n now: number = Date.now(),\n): Promise<EarlierPayment | null> {\n const path = paymentPath(dataDir, id);\n try {\n await writeFileAtomicExclusive(\n path,\n JSON.stringify({ state: 'running', at: new Date(now).toISOString() }),\n { mode: 0o600, dirMode: 0o700 },\n );\n return null;\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'EEXIST') return { state: 'unrecorded' };\n }\n const file = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW).catch(() => undefined);\n if (file === undefined) return { state: 'running' };\n try {\n const parsed = PaymentSchema.safeParse(JSON.parse(await file.readFile('utf8')));\n return parsed.success ? parsed.data : { state: 'running' };\n } catch {\n return { state: 'running' };\n } finally {\n await file.close().catch(() => undefined);\n }\n}\n\n/**\n * How the claimed call ended. Money that left is recorded against the id. The\n * claim is dropped ONLY when nothing was signed, so a fixed input can still\n * run: a signed payment whose amount the call never learned (it failed after\n * the authorization left) stays claimed as possibly paid, and the id never\n * signs again. A record that cannot be written leaves the claim standing,\n * which refuses too.\n */\nexport async function settleSpecPayment(\n dataDir: string,\n id: string,\n left: { amountAtomic: bigint; txHash?: string; signed: boolean },\n now: number = Date.now(),\n): Promise<void> {\n const path = paymentPath(dataDir, id);\n if (!left.signed && left.amountAtomic === 0n) {\n await rm(path, { force: true }).catch(() => undefined);\n return;\n }\n const at = new Date(now).toISOString();\n const record =\n left.amountAtomic > 0n\n ? {\n state: 'paid',\n at,\n amountAtomic: left.amountAtomic.toString(),\n ...(left.txHash !== undefined ? { txHash: left.txHash } : {}),\n }\n : { state: 'possibly_paid', at };\n await writeFileAtomic(path, JSON.stringify(record), { mode: 0o600, dirMode: 0o700 }).catch(\n () => undefined,\n );\n}\n\n/**\n * THE WHOLE BODY A SPEC'S CALL RETURNED, kept by the offer's id while the\n * agent is handed only the fields the spec promises, so nothing it paid for is\n * out of reach. The caller passes only a body it could project, which is\n * bounded by the result cap. The path, or null when it could not be written,\n * and the caller then hands back the whole body instead. Never throws.\n */\nexport async function storeFullResult(\n dataDir: string,\n id: string,\n body: string,\n): Promise<string | null> {\n const path = join(dataDir, RESULTS_DIR, `${digest(id)}.json`);\n try {\n await writeFileAtomic(path, body, { mode: 0o600, dirMode: 0o700 });\n } catch {\n return null;\n }\n // Housekeeping never holds up a paid result: the prune runs after the path\n // is handed back, and it swallows its own errors.\n void prune(join(dataDir, RESULTS_DIR), RESULT_TTL_MS, Date.now());\n return path;\n}\n\nasync function prune(dir: string, ttlMs: number, now: number): Promise<void> {\n try {\n // Every entry: a directory with many files is the one that most needs its\n // expired files gone.\n const directory = await opendir(dir);\n for await (const entry of directory) {\n if (!entry.isFile()) continue;\n const path = join(dir, entry.name);\n const stat = await lstat(path).catch(() => undefined);\n if (stat === undefined || now - stat.mtimeMs > ttlMs) {\n await rm(path, { force: true }).catch(() => undefined);\n }\n }\n } catch {\n // Housekeeping only.\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,OAAO,MAAM,SAAS,UAAU;AACzC,SAAS,YAAY;AAkBrB,IAAM,YAAY,KAAK,YAAY,OAAO;AAC1C,IAAM,cAAc;AAEpB,IAAM,iBAAiB,MAAM;AAGtB,IAAM,cAAc,KAAK;AAGzB,IAAM,gBAAgB,KAAK,KAAK;AAEvC,IAAM,SAAS,CAAC,UAA0B,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK;AAEzF,SAAS,SAAS,SAAiB,IAAoB;AACrD,SAAO,KAAK,SAAS,WAAW,GAAG,OAAO,EAAE,CAAC,OAAO;AACtD;AAMA,eAAsB,WACpB,SACA,OACe;AACf,MAAI,UAAU,UAAa,MAAM,WAAW,EAAG;AAC/C,aAAW,QAAQ,OAAO;AACxB,QAAI;AACF,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E,YAAY;AACrC,QAAM,SACJ,KAAK,eAAe,KAChB;AAAA,IACE,OAAO;AAAA,IACP;AAAA,IACA,cAAc,KAAK,aAAa,SAAS;AAAA,IACzC,GAAI,KAAK,WAAW,SAAY,EAAE,QAAQ,KAAK,OAAO,IAAI,CAAC;AAAA,EAC7D,IACA,EAAE,OAAO,iBAAiB,GAAG;AACnC,QAAM,gBAAgB,MAAM,KAAK,UAAU,MAAM,GAAG,EAAE,MAAM,KAAO,SAAS,IAAM,CAAC,EAAE;AAAA,IACnF,MAAM;AAAA,EACR;AACF;AASA,eAAsB,gBACpB,SACA,IACA,MACwB;AACxB,QAAM,OAAO,KAAK,SAAS,aAAa,GAAG,OAAO,EAAE,CAAC,OAAO;AAC5D,MAAI;AACF,UAAM,gBAAgB,MAAM,MAAM,EAAE,MAAM,KAAO,SAAS,IAAM,CAAC;AAAA,EACnE,QAAQ;AACN,WAAO;AAAA,EACT;AAGA,OAAK,MAAM,KAAK,SAAS,WAAW,GAAG,eAAe,KAAK,IAAI,CAAC;AAChE,SAAO;AACT;AAEA,eAAe,MAAM,KAAa,OAAe,KAA4B;AAC3E,MAAI;AAGF,UAAM,YAAY,MAAM,QAAQ,GAAG;AACnC,qBAAiB,SAAS,WAAW;AACnC,UAAI,CAAC,MAAM,OAAO,EAAG;AACrB,YAAM,OAAO,KAAK,KAAK,MAAM,IAAI;AACjC,YAAM,OAAO,MAAM,MAAM,IAAI,EAAE,MAAM,MAAM,MAAS;AACpD,UAAI,SAAS,UAAa,MAAM,KAAK,UAAU,OAAO;AACpD,cAAM,GAAG,MAAM,EAAE,OAAO,KAAK,CAAC,EAAE,MAAM,MAAM,MAAS;AAAA,MACvD;AAAA,IACF;AAAA,EACF,QAAQ;AAAA,EAER;AACF;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createLocalSpendAuthorizer
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NYJCBQL5.js";
|
|
5
5
|
import {
|
|
6
6
|
hashAuthorization,
|
|
7
7
|
hashMessage,
|
|
@@ -45,13 +45,13 @@ import {
|
|
|
45
45
|
} from "./chunk-BPMWXTFX.js";
|
|
46
46
|
import {
|
|
47
47
|
emitNotice
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-UGLTSPXQ.js";
|
|
49
49
|
import {
|
|
50
50
|
hasCode
|
|
51
51
|
} from "./chunk-2I4QTOLB.js";
|
|
52
52
|
import {
|
|
53
53
|
external_exports
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-SAN5PFTL.js";
|
|
55
55
|
import {
|
|
56
56
|
CliError,
|
|
57
57
|
fsyncDir,
|
|
@@ -1678,4 +1678,4 @@ export {
|
|
|
1678
1678
|
@noble/ciphers/esm/utils.js:
|
|
1679
1679
|
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
|
|
1680
1680
|
*/
|
|
1681
|
-
//# sourceMappingURL=chunk-
|
|
1681
|
+
//# sourceMappingURL=chunk-DHCOGDJB.js.map
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
USDC_ADDRESS
|
|
4
|
-
} from "./chunk-QHILSA6G.js";
|
|
5
2
|
import {
|
|
6
3
|
createPublicClient,
|
|
7
4
|
defineBlock,
|
|
@@ -28,6 +25,9 @@ import {
|
|
|
28
25
|
isAddress,
|
|
29
26
|
toHex
|
|
30
27
|
} from "./chunk-EGELTSPU.js";
|
|
28
|
+
import {
|
|
29
|
+
USDC_ADDRESS
|
|
30
|
+
} from "./chunk-SAN5PFTL.js";
|
|
31
31
|
|
|
32
32
|
// node_modules/.pnpm/viem@2.55.2_typescript@6.0.3_zod@4.4.3/node_modules/viem/_esm/op-stack/contracts.js
|
|
33
33
|
var contracts = {
|
|
@@ -318,4 +318,4 @@ export {
|
|
|
318
318
|
prepareUsdcSend,
|
|
319
319
|
broadcastUsdcSend
|
|
320
320
|
};
|
|
321
|
-
//# sourceMappingURL=chunk-
|
|
321
|
+
//# sourceMappingURL=chunk-F4IJQBGP.js.map
|
|
@@ -2,12 +2,9 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
resolvePublicDestination
|
|
4
4
|
} from "./chunk-LAIZ2AQA.js";
|
|
5
|
-
import {
|
|
6
|
-
USDC_ADDRESS
|
|
7
|
-
} from "./chunk-QHILSA6G.js";
|
|
8
5
|
import {
|
|
9
6
|
releaseUnchargedExposure
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NYJCBQL5.js";
|
|
11
8
|
import {
|
|
12
9
|
mask
|
|
13
10
|
} from "./chunk-7QKHZQKW.js";
|
|
@@ -17,6 +14,9 @@ import {
|
|
|
17
14
|
import {
|
|
18
15
|
hasCode
|
|
19
16
|
} from "./chunk-2I4QTOLB.js";
|
|
17
|
+
import {
|
|
18
|
+
USDC_ADDRESS
|
|
19
|
+
} from "./chunk-SAN5PFTL.js";
|
|
20
20
|
import {
|
|
21
21
|
writeFileAtomic
|
|
22
22
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -334,4 +334,4 @@ export {
|
|
|
334
334
|
writeAll,
|
|
335
335
|
createUniqueFile
|
|
336
336
|
};
|
|
337
|
-
//# sourceMappingURL=chunk-
|
|
337
|
+
//# sourceMappingURL=chunk-GONDQ27X.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
inspectHooksFile
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6O6DFYF3.js";
|
|
5
5
|
import {
|
|
6
6
|
CliError,
|
|
7
7
|
writeFileAtomic
|
|
@@ -169,4 +169,4 @@ export {
|
|
|
169
169
|
removeStatusLine,
|
|
170
170
|
inspectStatusLine
|
|
171
171
|
};
|
|
172
|
-
//# sourceMappingURL=chunk-
|
|
172
|
+
//# sourceMappingURL=chunk-HJYI52HM.js.map
|
|
@@ -2,10 +2,10 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
fetchFailureToCliError,
|
|
4
4
|
httpRequest
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3IOS6YG6.js";
|
|
6
6
|
import {
|
|
7
7
|
external_exports
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SAN5PFTL.js";
|
|
9
9
|
|
|
10
10
|
// src/router/decision.ts
|
|
11
11
|
var ROUTER_PATH = "/api/x402-router";
|
|
@@ -74,13 +74,42 @@ var DiscoveredCandidateSchema = external_exports.strictObject({
|
|
|
74
74
|
schema: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
75
75
|
})
|
|
76
76
|
});
|
|
77
|
+
var ToolSpecSchema = external_exports.strictObject({
|
|
78
|
+
capabilityId: external_exports.string().min(1).max(200),
|
|
79
|
+
provider: external_exports.string().min(1).max(120),
|
|
80
|
+
description: external_exports.string().min(1).max(500),
|
|
81
|
+
priceAtomic: external_exports.string().regex(/^\d+$/),
|
|
82
|
+
priceVaries: external_exports.boolean(),
|
|
83
|
+
maxAmountAtomic: external_exports.string().regex(/^\d+$/),
|
|
84
|
+
payTo: external_exports.string().min(1).max(200),
|
|
85
|
+
network: external_exports.string().min(1).max(64),
|
|
86
|
+
asset: external_exports.string().min(1).max(200),
|
|
87
|
+
request: external_exports.strictObject({
|
|
88
|
+
method: external_exports.enum(["GET", "POST"]),
|
|
89
|
+
url: external_exports.string().min(1).max(2048),
|
|
90
|
+
fields: external_exports.record(external_exports.string(), external_exports.enum(["path", "query", "body"])),
|
|
91
|
+
location: external_exports.enum(["query", "body"])
|
|
92
|
+
}),
|
|
93
|
+
input: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
94
|
+
pinned: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
95
|
+
example: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
96
|
+
returns: external_exports.string().min(1).max(200).optional(),
|
|
97
|
+
returnsExample: external_exports.unknown().optional(),
|
|
98
|
+
resultSchema: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
99
|
+
/** The fields the result promises (type, properties, items, required). The
|
|
100
|
+
* agent is handed only these; the whole body is saved to a file. */
|
|
101
|
+
outputSchema: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
102
|
+
});
|
|
103
|
+
var OfferSpecSchema = ToolSpecSchema.extend({ id: IdSchema });
|
|
104
|
+
var SpecsSchema = external_exports.array(OfferSpecSchema).min(1).max(4).optional();
|
|
77
105
|
var DiscoveredSchema = external_exports.strictObject({
|
|
78
106
|
action: external_exports.literal("discovered"),
|
|
79
107
|
id: IdSchema,
|
|
80
108
|
candidate: DiscoveredCandidateSchema,
|
|
81
109
|
/** THE LINE, FINISHED, as on `execute`: it carries the seller's
|
|
82
110
|
* description and the input it takes. */
|
|
83
|
-
hint: external_exports.string().min(1).max(2e3)
|
|
111
|
+
hint: external_exports.string().min(1).max(2e3),
|
|
112
|
+
specs: SpecsSchema
|
|
84
113
|
}).superRefine(checkHint);
|
|
85
114
|
var HookDecisionSchema = external_exports.discriminatedUnion("action", [
|
|
86
115
|
external_exports.strictObject({
|
|
@@ -98,7 +127,8 @@ var HookDecisionSchema = external_exports.discriminatedUnion("action", [
|
|
|
98
127
|
* more: two sides writing the same sentence is how they drift. The same
|
|
99
128
|
* bound as a discovered line's.
|
|
100
129
|
*/
|
|
101
|
-
hint: external_exports.string().min(1).max(2e3)
|
|
130
|
+
hint: external_exports.string().min(1).max(2e3),
|
|
131
|
+
specs: SpecsSchema
|
|
102
132
|
}).superRefine(checkHint),
|
|
103
133
|
DiscoveredSchema,
|
|
104
134
|
RefusedSchema.extend({ action: external_exports.literal("native") }),
|
|
@@ -110,6 +140,22 @@ var ToolDecisionSchema = external_exports.discriminatedUnion("action", [
|
|
|
110
140
|
...CapabilityFields,
|
|
111
141
|
contract: ContractSchema
|
|
112
142
|
}),
|
|
143
|
+
/**
|
|
144
|
+
* A query with no id, answered with the spec of the service the server
|
|
145
|
+
* picked under a fresh `id`: kept like a hook's. `input` is there only when
|
|
146
|
+
* the query, as written, was a valid value for the spec's query field (a
|
|
147
|
+
* free-text field, or one whose format or pattern it satisfies), and the
|
|
148
|
+
* tool then runs it in the same call, checked again like any input.
|
|
149
|
+
* Otherwise the agent fills the skeleton. `hint` is the line, with the skeleton of the call:
|
|
150
|
+
* `request({id, input: {...}})` with the required fields, or the bound one.
|
|
151
|
+
*/
|
|
152
|
+
external_exports.strictObject({
|
|
153
|
+
action: external_exports.literal("spec"),
|
|
154
|
+
id: IdSchema,
|
|
155
|
+
spec: ToolSpecSchema,
|
|
156
|
+
hint: external_exports.string().min(1).max(2e3),
|
|
157
|
+
input: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
158
|
+
}).superRefine(checkHint),
|
|
113
159
|
DiscoveredSchema,
|
|
114
160
|
RefusedSchema.extend({ action: external_exports.literal("native") }),
|
|
115
161
|
RefusedSchema.extend({ action: external_exports.literal("needs_input") })
|
|
@@ -127,7 +173,7 @@ function envelope(decision) {
|
|
|
127
173
|
}
|
|
128
174
|
var HookResponseSchema = envelope(HookDecisionSchema);
|
|
129
175
|
var ToolResponseSchema = envelope(ToolDecisionSchema);
|
|
130
|
-
var CLIENT_ACCEPTS = ["discovered"];
|
|
176
|
+
var CLIENT_ACCEPTS = ["discovered", "spec"];
|
|
131
177
|
var BAZAAR_ACCEPT = "bazaar";
|
|
132
178
|
function acceptsFor(bazaar) {
|
|
133
179
|
return bazaar ? [...CLIENT_ACCEPTS, BAZAAR_ACCEPT] : [...CLIENT_ACCEPTS];
|
|
@@ -173,6 +219,28 @@ async function requestDecision(kind, request, deps) {
|
|
|
173
219
|
kind === "hook" ? HookResponseSchema : ToolResponseSchema
|
|
174
220
|
);
|
|
175
221
|
}
|
|
222
|
+
var OUTCOME_TIMEOUT_MS = 3e3;
|
|
223
|
+
async function reportSpecOutcome(outcome, deps) {
|
|
224
|
+
try {
|
|
225
|
+
await httpRequest(new URL(ROUTER_PATH, deps.baseUrl).toString(), {
|
|
226
|
+
method: "POST",
|
|
227
|
+
timeoutMs: OUTCOME_TIMEOUT_MS,
|
|
228
|
+
blockRedirects: true,
|
|
229
|
+
jsonBody: buildOutcomeBody(outcome),
|
|
230
|
+
...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {}
|
|
231
|
+
});
|
|
232
|
+
} catch {
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function buildOutcomeBody(outcome) {
|
|
236
|
+
return {
|
|
237
|
+
schemaVersion: 1,
|
|
238
|
+
id: outcome.id,
|
|
239
|
+
status: outcome.status,
|
|
240
|
+
...outcome.httpStatus !== void 0 ? { httpStatus: outcome.httpStatus } : {},
|
|
241
|
+
...outcome.ms !== void 0 ? { ms: Math.max(0, Math.round(outcome.ms)) } : {}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
176
244
|
function readDecision(response, schema) {
|
|
177
245
|
if (!response.ok) return { status: "failed", reason: fetchFailureToCliError(response).message };
|
|
178
246
|
if (response.status < 200 || response.status >= 300) {
|
|
@@ -203,6 +271,8 @@ function errorOf(body) {
|
|
|
203
271
|
|
|
204
272
|
export {
|
|
205
273
|
ROUTER_PATH,
|
|
206
|
-
|
|
274
|
+
OfferSpecSchema,
|
|
275
|
+
requestDecision,
|
|
276
|
+
reportSpecOutcome
|
|
207
277
|
};
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
278
|
+
//# sourceMappingURL=chunk-HTC4VJFT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/router/decision.ts"],"sourcesContent":["import { z } from 'zod';\nimport { fetchFailureToCliError, httpRequest } from '../lib/http';\nimport type { HttpRequestOptions, HttpResult } from '../lib/http';\nimport type { CommandContext } from '../context';\nimport type { Packet } from './context';\n\n/**\n * `POST /api/x402-router`: ONE FREE DECISION PER LOOKUP.\n *\n * The routing decision costs nothing and nobody signs for it. The hook asks for\n * it from the user's own words, the backend answers with what it would do and\n * what the provider charges, and the only payment on the wire is the one\n * `runPay` makes to that provider. That deletes the router fee and everything\n * built to carry it: the 402 probe, the requirements cache, the stale-quote\n * retry, the settlement accounting and one Base settlement of about 1.5 s from\n * every paid lookup.\n *\n * NOTHING IS STORED LOCALLY. The bounded packet travels with the request and\n * the backend keeps it against the decision id until that id expires, which is\n * how `request({query})` reaches the same calibrated input with no session\n * file, no timestamp latch and no guess about which window this process serves.\n */\n\nexport const ROUTER_PATH = '/api/x402-router';\n\n/**\n * The request the server builds and this client sends verbatim. Query assembly,\n * body encoding and header choice are the server's; what stays here is every\n * check that decides whether to send it at all.\n */\nconst RequestSchema = z.object({\n url: z.string().min(1).max(16_384),\n method: z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS']),\n headers: z.record(z.string(), z.string()),\n body: z\n .string()\n .max(256 * 1024)\n .optional(),\n});\n\nconst ContractSchema = z.object({\n /** Flat, for display and for the result check; never re-encoded into a call:\n * the server built `request` from them and this client sends that verbatim. */\n arguments: z.record(z.string(), z.unknown()).optional(),\n resultSchema: z.record(z.string(), z.unknown()).optional(),\n request: RequestSchema,\n});\nexport type DecisionContract = z.infer<typeof ContractSchema>;\n\n/**\n * What stopped an outcome this client cannot execute, in terms the host can act\n * on: a stable reason code, the stage that stopped, the fields or scope choices\n * the user can supply, and one concrete next action.\n */\nconst DiagnosticsSchema = z.object({\n reasonCode: z.string().min(1).max(64),\n stage: z.string().min(1).max(32),\n missing: z.array(z.string().max(200)).max(60),\n nextAction: z.string().max(500),\n});\nexport type DecisionDiagnostics = z.infer<typeof DiagnosticsSchema>;\n\n/**\n * ONE VARIANT PER ANSWER, DISCRIMINATED ON THE ACTION. Optional fields made\n * every shape legal: an `execute` with no contract parsed and came back to the\n * host as a routine `needs_input`, a non-execute with no diagnostics parsed\n * with nothing to act on, and a hook answer carrying a contract parsed as\n * though the hook had quoted a price. Each of those is drift the shared\n * fixtures exist to catch, so each is now a parse failure that names itself.\n *\n * The two calls ask different questions and get different answers, so they get\n * different parsers. The HOOK asks whether a paid lookup is worth offering: an\n * id, or a reason it is not. The TOOL asks for the decision: the capability,\n * its price and the contract together, so a caller cannot approve one offer and\n * receive another.\n */\nconst IdSchema = z\n .string()\n .regex(/^[A-Za-z0-9_-]{8,64}$/)\n .describe(\n 'The turn id, an OPAQUE HANDLE: it is the one piece of server text this ' +\n 'client puts in a model-facing line, so the alphabet is pinned here ' +\n 'rather than escaped later.',\n );\n\n/** Every non-execute answer carries these, beside the action they explain. */\nconst RefusedSchema = z.strictObject({\n reason: z.string().max(2_000).optional(),\n diagnostics: DiagnosticsSchema,\n});\n\n/**\n * WHAT THE SERVICE IS, AND WHAT IT DOES. The hook answer used to be an id and\n * nothing else, so the line the host injected could only say \"a paid lookup is\n * available\", which a model follows 8 to 20 times in 40 where a line naming the\n * task and the service is followed 40 in 40. The gate knows which capability\n * serves the category it chose, so it now says so; the CONTRACT is still not\n * here, because the task the host will run does not exist yet.\n */\nconst CapabilityFields = {\n capabilityId: z.string().min(1).max(200),\n category: z.string().min(1).max(64),\n /** The service's own name, not the x402 reseller in front of it. */\n provider: z.string().min(1).max(120),\n capabilityDescription: z.string().min(1).max(500),\n /** What the provider charges, atomic USDC. The `request` tool refuses a live\n * 402 above it; `gateSpend` still caps the amount actually signed. */\n providerPriceAtomic: z.string().regex(/^\\d+$/),\n};\n\n/**\n * STRUCTURE, NEVER WORDING. A hint lands in the model's context verbatim, so\n * its shape is checked the way the id's alphabet is: one line, no control\n * characters, and it has to be the call it claims to be, naming the id this\n * same answer carries. A hint that fails any of these is a protocol error and\n * the turn falls back to the generic line; nothing here rewrites a word of a\n * hint that passes. Both offering arms, `execute` and `discovered`, hold it.\n */\nfunction checkHint(decision: { id: string; hint: string }, ctx: z.RefinementCtx): void {\n if (/[\\p{Cc}\\p{Cf}]/u.test(decision.hint)) {\n ctx.addIssue({ code: 'custom', path: ['hint'], message: 'a hint is one plain line' });\n }\n if (!decision.hint.includes('request({')) {\n ctx.addIssue({ code: 'custom', path: ['hint'], message: 'a hint names the call to make' });\n }\n if (!decision.hint.includes(decision.id)) {\n ctx.addIssue({\n code: 'custom',\n path: ['hint'],\n message: \"a hint carries this answer's own id\",\n });\n }\n}\n\n/**\n * A PAY-PER-CALL SERVICE NOBODY CURATED. When no capability in the catalog fits\n * but a listed x402 service could do the step, the server names that one\n * service: who sells it, where, for how much, and the input it takes. The\n * candidate is the seller's own listing, so every field is data for the host\n * to judge, never an instruction; the host builds the `input` and the tool\n * call pays through the same `runPay` path and caps as a curated lookup.\n */\nconst DiscoveredCandidateSchema = z.strictObject({\n source: z.string().min(1).max(64),\n provider: z.string().min(1).max(120),\n url: z.string().min(1).max(2_048),\n method: z.enum(['GET', 'POST']),\n description: z.string().max(500),\n providerPriceAtomic: z.string().regex(/^\\d+$/),\n network: z.string().min(1).max(64),\n payTo: z.string().min(1).max(200),\n input: z.strictObject({\n location: z.enum(['body', 'query']),\n schema: z.record(z.string(), z.unknown()),\n }),\n});\n\n/**\n * A REQUEST SPEC: the offered service's real contract, sent beside the line only\n * because this build asks for it (`accepts: [\"spec\"]`). The hook stores it by\n * the offer's id; `request({id})` shows it and `request({id, input})` fills its\n * request and pays the provider directly, with no second decision. Every field\n * is the server's, and so is checked like the rest of the answer: the payee and\n * price still meet the live 402 and the spend policy in `runPay`.\n */\nexport const ToolSpecSchema = z.strictObject({\n capabilityId: z.string().min(1).max(200),\n provider: z.string().min(1).max(120),\n description: z.string().min(1).max(500),\n priceAtomic: z.string().regex(/^\\d+$/),\n priceVaries: z.boolean(),\n maxAmountAtomic: z.string().regex(/^\\d+$/),\n payTo: z.string().min(1).max(200),\n network: z.string().min(1).max(64),\n asset: z.string().min(1).max(200),\n request: z.strictObject({\n method: z.enum(['GET', 'POST']),\n url: z.string().min(1).max(2_048),\n fields: z.record(z.string(), z.enum(['path', 'query', 'body'])),\n location: z.enum(['query', 'body']),\n }),\n input: z.record(z.string(), z.unknown()),\n pinned: z.record(z.string(), z.unknown()),\n example: z.record(z.string(), z.unknown()).optional(),\n returns: z.string().min(1).max(200).optional(),\n returnsExample: z.unknown().optional(),\n resultSchema: z.record(z.string(), z.unknown()).optional(),\n /** The fields the result promises (type, properties, items, required). The\n * agent is handed only these; the whole body is saved to a file. */\n outputSchema: z.record(z.string(), z.unknown()).optional(),\n});\nexport type ToolSpec = z.infer<typeof ToolSpecSchema>;\n\nexport const OfferSpecSchema = ToolSpecSchema.extend({ id: IdSchema });\nexport type OfferSpec = z.infer<typeof OfferSpecSchema>;\n\n/** One spec per service the line names: the offer and any alternative. */\nconst SpecsSchema = z.array(OfferSpecSchema).min(1).max(4).optional();\n\n/** The same answer on both calls: the hook's offer, and the tool's fallback\n * when a query with no id found no curated capability. */\nconst DiscoveredSchema = z\n .strictObject({\n action: z.literal('discovered'),\n id: IdSchema,\n candidate: DiscoveredCandidateSchema,\n /** THE LINE, FINISHED, as on `execute`: it carries the seller's\n * description and the input it takes. */\n hint: z.string().min(1).max(2_000),\n specs: SpecsSchema,\n })\n .superRefine(checkHint);\n\nconst HookDecisionSchema = z.discriminatedUnion('action', [\n z\n .strictObject({\n action: z.literal('execute'),\n id: IdSchema,\n ...CapabilityFields,\n /** The x402 URL a lookup would pay, for the line the server writes. */\n endpoint: z.string().min(1).max(2_048),\n /** What to pass in `query`, in the service's own terms. */\n usage: z.string().min(1).max(300),\n /**\n * THE LINE, FINISHED. The server writes it with the real id in it and, on a\n * native call, the exact search or URL that was denied. The client injects\n * it and composes nothing, which is why there is no hint builder here any\n * more: two sides writing the same sentence is how they drift. The same\n * bound as a discovered line's.\n */\n hint: z.string().min(1).max(2_000),\n specs: SpecsSchema,\n })\n .superRefine(checkHint),\n DiscoveredSchema,\n RefusedSchema.extend({ action: z.literal('native') }),\n RefusedSchema.extend({ action: z.literal('needs_input') }),\n]);\n\nconst ToolDecisionSchema = z.discriminatedUnion('action', [\n z.strictObject({\n action: z.literal('execute'),\n ...CapabilityFields,\n contract: ContractSchema,\n }),\n /**\n * A query with no id, answered with the spec of the service the server\n * picked under a fresh `id`: kept like a hook's. `input` is there only when\n * the query, as written, was a valid value for the spec's query field (a\n * free-text field, or one whose format or pattern it satisfies), and the\n * tool then runs it in the same call, checked again like any input.\n * Otherwise the agent fills the skeleton. `hint` is the line, with the skeleton of the call:\n * `request({id, input: {...}})` with the required fields, or the bound one.\n */\n z\n .strictObject({\n action: z.literal('spec'),\n id: IdSchema,\n spec: ToolSpecSchema,\n hint: z.string().min(1).max(2_000),\n input: z.record(z.string(), z.unknown()).optional(),\n })\n .superRefine(checkHint),\n DiscoveredSchema,\n RefusedSchema.extend({ action: z.literal('native') }),\n RefusedSchema.extend({ action: z.literal('needs_input') }),\n]);\n\nfunction envelope<T extends z.ZodTypeAny>(decision: T) {\n return z.strictObject({\n schemaVersion: z.literal(1),\n routerVersion: z.string().min(1).max(64),\n decision,\n /** A plain sentence about the CALL, such as an id that had expired. Never a\n * failure: the decision beside it ran anyway. */\n note: z.string().max(500).optional(),\n jev: z.object({ calls: z.number(), latencyMs: z.number() }).optional(),\n });\n}\n\nconst HookResponseSchema = envelope(HookDecisionSchema);\nconst ToolResponseSchema = envelope(ToolDecisionSchema);\n\nexport type HookResponse = z.infer<typeof HookResponseSchema>;\nexport type ToolResponse = z.infer<typeof ToolResponseSchema>;\nexport type HookDecision = HookResponse['decision'];\nexport type ToolDecision = ToolResponse['decision'];\n\n/** Which call this is, and therefore which answer is legal for it. */\nexport type CallKind = 'hook' | 'tool';\n\n/**\n * What this client can act on beyond the curated answers, sent on both calls.\n * `discovered` is Tenjin's reviewed list of third-party services, on for every\n * build that parses it; the server answers that arm only to a request that\n * lists it, so an older build never sees one. `spec` asks for each offered\n * service's request spec beside its line, and for the picked service's spec in\n * place of a decision on a query with no id, which only a build that parses\n * them can take: the decision schemas are strict. `bazaar` widens discovery\n * to the open Bazaar and is sent only while `experimental.bazaar` is on.\n */\nexport const CLIENT_ACCEPTS: readonly string[] = ['discovered', 'spec'];\nexport const BAZAAR_ACCEPT = 'bazaar';\n\n/** The `accepts` this build sends, with the open Bazaar or without it. */\nexport function acceptsFor(bazaar: boolean): string[] {\n return bazaar ? [...CLIENT_ACCEPTS, BAZAAR_ACCEPT] : [...CLIENT_ACCEPTS];\n}\n\n/**\n * The exact body the hook call sends, spelled once and pinned to the shared\n * fixtures. The route reads it with a strict object, so an extra field is a\n * 400, and a 400 is a turn with no hint.\n *\n * ONE BODY FOR BOTH HOOKS. Which hook is asking is not a field: the route reads\n * it from `packet.pendingCall`, which the native hook sets and the prompt hook\n * does not. A `source` beside the packet was the `/prepare` route's shape, and\n * that route is gone. `sessionId` is the harness's own session id, which the\n * server uses only so one session is not offered the same discovered service\n * twice.\n */\nexport function buildHookBody(\n packet: Packet,\n extras: { sessionId?: string; accepts?: readonly string[] } = {},\n): Record<string, unknown> {\n return {\n schemaVersion: 1,\n ...(extras.sessionId !== undefined ? { sessionId: extras.sessionId } : {}),\n ...(extras.accepts !== undefined ? { accepts: [...extras.accepts] } : {}),\n packet,\n };\n}\n\n/** The exact body the tool call sends. `id` is the turn whose packet decides\n * with this query; `gateHint` is evidence, never authority. `input` is the\n * host's own input for a discovered service, and stands in for `query`. */\nexport function buildToolBody(request: {\n query?: string;\n id?: string;\n input?: Record<string, unknown>;\n gateHint?: GateHint;\n accepts?: readonly string[];\n}): Record<string, unknown> {\n return {\n schemaVersion: 1,\n ...(request.query !== undefined ? { query: request.query } : {}),\n ...(request.id !== undefined ? { id: request.id } : {}),\n ...(request.input !== undefined ? { input: request.input } : {}),\n ...(request.gateHint !== undefined ? { gateHint: request.gateHint } : {}),\n ...(request.accepts !== undefined ? { accepts: [...request.accepts] } : {}),\n };\n}\n\n/** The parsers, exposed so the shared wire fixtures are checked against the\n * same schemas production parses with rather than against a copy of them. */\nexport function parseForTests(kind: CallKind, value: unknown): { success: boolean } {\n const schema = kind === 'hook' ? HookResponseSchema : ToolResponseSchema;\n return { success: schema.safeParse(value).success };\n}\n\n/**\n * The gate's own reading of this turn, travelling as EVIDENCE for the lookup it\n * was produced for. The backend may refine or reject it, and it authorizes no\n * money: the local spend policy does that. Optional on both call forms.\n */\nexport interface GateHint {\n category: string;\n turnId: string;\n lookupId: string;\n}\n\nexport interface DecisionDeps {\n ctx: CommandContext;\n baseUrl: string;\n /** `experimental.bazaar`: add {@link BAZAAR_ACCEPT}, so a service from the\n * open Bazaar may come back. Off by default: curated and the Tenjin list. */\n acceptsBazaar?: boolean;\n fetchImpl?: typeof fetch;\n /** Overrides the per-call deadline; the hook passes its own, smaller one. */\n timeoutMs?: number;\n}\n\nexport type DecisionOutcome<T> =\n | { status: 'decided'; decision: T }\n /** Nothing was paid and nothing could be: the endpoint is free, so a failure\n * here costs the turn a routing answer and nothing else. */\n | { status: 'failed'; reason: string; errorCode?: string };\n\n/**\n * ONE FREE CALL, IN TWO FORMS. The hook sends `{ packet }`: the backend runs\n * the gate, and on `execute` stores that packet under an id. The tool sends\n * `{ query, id? }`: the backend makes THE decision from that query plus the\n * packet it stored, and answers with the contract to run. A discovered\n * service's id is sent with the host's own `{ input }` instead of a query.\n *\n * The tool never sends a packet of its own. The turn's context lives on the\n * backend against the id, and the query the model wrote is what the routing\n * corpus is calibrated against: 55 of 56 for query plus packet, 53 of 56 for\n * the raw prompt, measured on jev-1.13.0.\n */\nexport async function requestDecision(\n kind: 'hook',\n request: { packet: Packet; sessionId?: string },\n deps: DecisionDeps,\n): Promise<DecisionOutcome<HookResponse>>;\nexport async function requestDecision(\n kind: 'tool',\n request: { query?: string; id?: string; input?: Record<string, unknown>; gateHint?: GateHint },\n deps: DecisionDeps,\n): Promise<DecisionOutcome<ToolResponse>>;\nexport async function requestDecision(\n kind: CallKind,\n request: {\n query?: string;\n packet?: Packet;\n sessionId?: string;\n id?: string;\n input?: Record<string, unknown>;\n gateHint?: GateHint;\n },\n deps: DecisionDeps,\n): Promise<DecisionOutcome<HookResponse | ToolResponse>> {\n const url = new URL(ROUTER_PATH, deps.baseUrl).toString();\n const options: HttpRequestOptions = {\n method: 'POST',\n timeoutMs: deps.timeoutMs ?? deps.ctx.flags.timeout,\n blockRedirects: true,\n jsonBody:\n kind === 'hook'\n ? buildHookBody(request.packet as Packet, {\n ...(request.sessionId !== undefined ? { sessionId: request.sessionId } : {}),\n accepts: acceptsFor(deps.acceptsBazaar === true),\n })\n : buildToolBody({\n ...(request.query !== undefined ? { query: request.query } : {}),\n ...(request.id !== undefined ? { id: request.id } : {}),\n ...(request.input !== undefined ? { input: request.input } : {}),\n ...(request.gateHint !== undefined ? { gateHint: request.gateHint } : {}),\n accepts: acceptsFor(deps.acceptsBazaar === true),\n }),\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n };\n return readDecision(\n await httpRequest(url, options),\n kind === 'hook' ? HookResponseSchema : ToolResponseSchema,\n );\n}\n\n/** How a call run from a request spec ended, for the server's offer-to-call\n * count. No text: the id, the outcome, the provider's status and the time. */\nexport interface SpecOutcome {\n id: string;\n status: 'fulfilled' | 'unverified' | 'failed' | 'needs_approval';\n httpStatus?: number;\n ms?: number;\n}\n\n/** The outcome report's own deadline: it is telemetry and never holds a result. */\nexport const OUTCOME_TIMEOUT_MS = 3_000;\n\n/**\n * TELL THE SERVER A SPEC WAS USED. The client called and paid the provider\n * itself, so this is the only word the server gets that its offer was taken.\n * Never throws and never waits on anything the caller needs: a lost report\n * costs one count.\n */\nexport async function reportSpecOutcome(\n outcome: SpecOutcome,\n deps: Pick<DecisionDeps, 'ctx' | 'baseUrl' | 'fetchImpl'>,\n): Promise<void> {\n try {\n await httpRequest(new URL(ROUTER_PATH, deps.baseUrl).toString(), {\n method: 'POST',\n timeoutMs: OUTCOME_TIMEOUT_MS,\n blockRedirects: true,\n jsonBody: buildOutcomeBody(outcome),\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n });\n } catch {\n // Telemetry only.\n }\n}\n\n/** The exact body of an outcome report, pinned to the shared fixtures. */\nexport function buildOutcomeBody(outcome: SpecOutcome): Record<string, unknown> {\n return {\n schemaVersion: 1,\n id: outcome.id,\n status: outcome.status,\n ...(outcome.httpStatus !== undefined ? { httpStatus: outcome.httpStatus } : {}),\n ...(outcome.ms !== undefined ? { ms: Math.max(0, Math.round(outcome.ms)) } : {}),\n };\n}\n\nfunction readDecision<T extends z.ZodTypeAny>(\n response: HttpResult,\n schema: T,\n): DecisionOutcome<z.infer<T>> {\n // A transport failure says its own reason; nothing was paid either way,\n // because there is nothing to pay for on this route.\n if (!response.ok) return { status: 'failed', reason: fetchFailureToCliError(response).message };\n if (response.status < 200 || response.status >= 300) {\n const named = errorOf(response.json);\n return {\n status: 'failed',\n // The backend's own code and message, never a bare status line: a typed\n // refusal the host could act on was arriving as \"answered 400\".\n reason:\n named === null\n ? `The router endpoint answered ${response.status}.`\n : `The router endpoint answered ${response.status} (${named.code}): ${named.message}`,\n ...(named !== null ? { errorCode: named.code } : {}),\n };\n }\n const parsed = schema.safeParse(response.json);\n if (!parsed.success) {\n return { status: 'failed', reason: 'The router returned a decision this build cannot read.' };\n }\n return { status: 'decided', decision: parsed.data as z.infer<T> };\n}\n\n/** `{ error: { code, message } }`, the envelope every Tenjin route answers a\n * refusal with. Anything else reads as no code rather than as a guess. */\nfunction errorOf(body: unknown): { code: string; message: string } | null {\n if (body === null || typeof body !== 'object') return null;\n const error = (body as { error?: unknown }).error;\n if (error === null || typeof error !== 'object') return null;\n const { code, message } = error as { code?: unknown; message?: unknown };\n if (typeof code !== 'string' || code.length === 0 || code.length > 64) return null;\n const text = typeof message === 'string' ? message.slice(0, 500) : '';\n return { code, message: text };\n}\n"],"mappings":";;;;;;;;;;AAuBO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from "./chunk-
|
|
16
|
+
} from "./chunk-XBYTP4SP.js";
|
|
17
17
|
import {
|
|
18
18
|
hasCode
|
|
19
19
|
} from "./chunk-2I4QTOLB.js";
|
|
20
20
|
import {
|
|
21
21
|
isTeamShelfOrigin,
|
|
22
22
|
loadProjectConfig
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-UHEMZEGW.js";
|
|
24
24
|
import {
|
|
25
25
|
parseUsdToAtomic,
|
|
26
26
|
toMoney
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
parseUpdateModeFlag,
|
|
49
49
|
resolveSettings,
|
|
50
50
|
retiredPaymentKeys
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-SAN5PFTL.js";
|
|
52
52
|
import {
|
|
53
53
|
ADAPTERS,
|
|
54
54
|
MODE_GATED_RULES,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
registeredHooks,
|
|
57
57
|
retractModeGatedRules,
|
|
58
58
|
wireFreeVerbAllowlist
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-6O6DFYF3.js";
|
|
60
60
|
import {
|
|
61
61
|
CliError,
|
|
62
62
|
writeFileAtomic
|
|
@@ -923,4 +923,4 @@ export {
|
|
|
923
923
|
persistInstallHarness,
|
|
924
924
|
persistGrantDeclined
|
|
925
925
|
};
|
|
926
|
-
//# sourceMappingURL=chunk-
|
|
926
|
+
//# sourceMappingURL=chunk-I2GBBIDI.js.map
|