tenjin-cli 0.1.0-alpha.3 → 0.1.0-alpha.4
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 +156 -188
- package/dist/{_esm-FEASBWRP.js → _esm-N4KAVXQR.js} +9 -9
- package/dist/buy-OOOLUDND.js +41 -0
- package/dist/candidate-TWCWTFGA.js +22 -0
- package/dist/{ccip-XR5NE5QK.js → ccip-RPPPKTJR.js} +5 -5
- package/dist/{ccip-NQXCEK2U.js → ccip-ZGGWQN4X.js} +4 -4
- package/dist/{chunk-XJIW7USF.js → chunk-333FOTUJ.js} +5 -5
- package/dist/{chunk-YALGASEU.js → chunk-47PP7TAG.js} +1610 -1610
- package/dist/chunk-47PP7TAG.js.map +1 -0
- package/dist/{buy-EE6SEXP6.js → chunk-4GR7DGD6.js} +23 -41
- package/dist/{buy-EE6SEXP6.js.map → chunk-4GR7DGD6.js.map} +1 -1
- package/dist/{chunk-DXTQ3CSI.js → chunk-5JH7ZB6Z.js} +7 -7
- package/dist/{chunk-DXTQ3CSI.js.map → chunk-5JH7ZB6Z.js.map} +1 -1
- package/dist/{chunk-OYMYCW7J.js → chunk-6WWVYYSB.js} +32 -2
- package/dist/{chunk-OYMYCW7J.js.map → chunk-6WWVYYSB.js.map} +1 -1
- package/dist/{chunk-UGX7YPX2.js → chunk-7FK2UN2T.js} +65 -65
- package/dist/{chunk-UGX7YPX2.js.map → chunk-7FK2UN2T.js.map} +1 -1
- package/dist/{chunk-ESPNTPQ2.js → chunk-BXUS5UCT.js} +9 -4
- package/dist/{chunk-ESPNTPQ2.js.map → chunk-BXUS5UCT.js.map} +1 -1
- package/dist/{chunk-4ONXEEQL.js → chunk-C4TIWOAM.js} +2 -2
- package/dist/{chunk-4ONXEEQL.js.map → chunk-C4TIWOAM.js.map} +1 -1
- package/dist/{chunk-AWPAWHNX.js → chunk-CJU555P5.js} +24 -24
- package/dist/{chunk-AWPAWHNX.js.map → chunk-CJU555P5.js.map} +1 -1
- package/dist/{chunk-YN5SHIXQ.js → chunk-DPET3TW5.js} +2 -2
- package/dist/{chunk-TLCMMYLY.js → chunk-DPUMEMGM.js} +5 -5
- package/dist/chunk-DPUMEMGM.js.map +1 -0
- package/dist/{chunk-XHC6FCGZ.js → chunk-EUQN3L5X.js} +9 -9
- package/dist/{chunk-XHC6FCGZ.js.map → chunk-EUQN3L5X.js.map} +1 -1
- package/dist/{chunk-GO75V3NZ.js → chunk-FHB3VKZW.js} +6 -6
- package/dist/{chunk-GO75V3NZ.js.map → chunk-FHB3VKZW.js.map} +1 -1
- package/dist/{chunk-S3IGX57D.js → chunk-FU6MCSLG.js} +9 -9
- package/dist/{lookup-ZPN2Q67N.js → chunk-H5ETJRQD.js} +40 -31
- package/dist/chunk-H5ETJRQD.js.map +1 -0
- package/dist/chunk-KXIX7YDV.js +59 -0
- package/dist/chunk-KXIX7YDV.js.map +1 -0
- package/dist/{chunk-5CLSD5YN.js → chunk-KYQVEKP5.js} +7 -7
- package/dist/{chunk-RRN3YTK7.js → chunk-KZAAWQNP.js} +3 -3
- package/dist/{chunk-NCE5NSN6.js → chunk-M2O56UK7.js} +158 -158
- package/dist/chunk-M2O56UK7.js.map +1 -0
- package/dist/{chunk-7KUW4MJD.js → chunk-MM4TGTST.js} +6 -6
- package/dist/{chunk-7KUW4MJD.js.map → chunk-MM4TGTST.js.map} +1 -1
- package/dist/{chunk-662MSGZB.js → chunk-NXCJN2FJ.js} +55 -28
- package/dist/chunk-NXCJN2FJ.js.map +1 -0
- package/dist/{candidate-ERMSYYQZ.js → chunk-OJD54DIU.js} +15 -19
- package/dist/{candidate-ERMSYYQZ.js.map → chunk-OJD54DIU.js.map} +1 -1
- package/dist/{chunk-ZABPQJ3M.js → chunk-POJRB2AE.js} +2 -2
- package/dist/{chunk-FJPLRISB.js → chunk-QH6677FJ.js} +5 -4
- package/dist/chunk-QH6677FJ.js.map +1 -0
- package/dist/{wallet-CWEMYVIH.js → chunk-R7BMDJZM.js} +15 -27
- package/dist/{wallet-CWEMYVIH.js.map → chunk-R7BMDJZM.js.map} +1 -1
- package/dist/{chunk-Z6MFJV5Z.js → chunk-S3KZ3PPK.js} +15 -11
- package/dist/{chunk-Z6MFJV5Z.js.map → chunk-S3KZ3PPK.js.map} +1 -1
- package/dist/{chunk-CYOF7ROH.js → chunk-S5RYMCV6.js} +3 -3
- package/dist/{chunk-ZMHYXMO6.js → chunk-U5S527PP.js} +3 -3
- package/dist/{chunk-RY4XKNV3.js → chunk-UHTVXQ2O.js} +3 -3
- package/dist/{publish-BKBQQAW4.js → chunk-ULLWHHIT.js} +19 -34
- package/dist/{publish-BKBQQAW4.js.map → chunk-ULLWHHIT.js.map} +1 -1
- package/dist/{chunk-Z52RA3NC.js → chunk-VV4P5RVK.js} +47 -20
- package/dist/chunk-VV4P5RVK.js.map +1 -0
- package/dist/{chunk-QVX5MWJZ.js → chunk-W6R3HAAG.js} +2 -2
- package/dist/{chunk-3OV7E5G5.js → chunk-WWX32ML4.js} +1 -1
- package/dist/{chunk-3OV7E5G5.js.map → chunk-WWX32ML4.js.map} +1 -1
- package/dist/{chunk-HIVZG55D.js → chunk-XJN5WUKL.js} +2 -2
- package/dist/{chunk-JPHG2JW3.js → chunk-XNNOR7F7.js} +25 -25
- package/dist/chunk-XNNOR7F7.js.map +1 -0
- package/dist/{inspect-LMKOXE4Y.js → chunk-YFREUEUI.js} +8 -26
- package/dist/{inspect-LMKOXE4Y.js.map → chunk-YFREUEUI.js.map} +1 -1
- package/dist/{chunk-HSDCI7OV.js → chunk-YLYINX2H.js} +3 -3
- package/dist/{cli-SBXI5AMS.js → cli-AFSLAKR6.js} +47 -36
- package/dist/{cli-SBXI5AMS.js.map → cli-AFSLAKR6.js.map} +1 -1
- package/dist/{config-VELDKLHY.js → config-DBEEM3UA.js} +5 -5
- package/dist/{doctor-T3KWNNP2.js → doctor-XDA3YU6H.js} +7 -7
- package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-WHYKB6HA.js} +5 -5
- package/dist/index.js +1 -1
- package/dist/inspect-YBGDAG47.js +33 -0
- package/dist/{install-LEX3ENQ6.js → install-7J6KKEEP.js} +240 -85
- package/dist/install-7J6KKEEP.js.map +1 -0
- package/dist/outcome-ZFGHX2XW.js +20 -0
- package/dist/publish-IH7RJXGB.js +36 -0
- package/dist/publish-IH7RJXGB.js.map +1 -0
- package/dist/run-DCZFEW2C.js +16806 -0
- package/dist/run-DCZFEW2C.js.map +1 -0
- package/dist/search-R6NIQFXI.js +24 -0
- package/dist/search-R6NIQFXI.js.map +1 -0
- package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-XRPVBC6V.js} +3 -3
- package/dist/secp256k1-XRPVBC6V.js.map +1 -0
- package/dist/usdc-AU6ZIKA6.js +22 -0
- package/dist/usdc-AU6ZIKA6.js.map +1 -0
- package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-TUQJBMHM.js} +5 -5
- package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +1 -0
- package/dist/{wallet-PA54CRBL.js → wallet-HKG3GSTX.js} +10 -10
- package/dist/wallet-HKG3GSTX.js.map +1 -0
- package/dist/wallet-UWHSHWC6.js +31 -0
- package/dist/wallet-UWHSHWC6.js.map +1 -0
- package/package.json +4 -3
- package/skills/tenjin/SKILL.md +56 -13
- package/skills/tenjin-publish/SKILL.md +21 -6
- package/skills/tenjin-search/SKILL.md +35 -20
- package/dist/chunk-662MSGZB.js.map +0 -1
- package/dist/chunk-FJPLRISB.js.map +0 -1
- package/dist/chunk-JPHG2JW3.js.map +0 -1
- package/dist/chunk-NCE5NSN6.js.map +0 -1
- package/dist/chunk-TLCMMYLY.js.map +0 -1
- package/dist/chunk-YALGASEU.js.map +0 -1
- package/dist/chunk-Z52RA3NC.js.map +0 -1
- package/dist/install-LEX3ENQ6.js.map +0 -1
- package/dist/lookup-ZPN2Q67N.js.map +0 -1
- package/dist/outcome-N7TAK6WR.js +0 -66
- package/dist/outcome-N7TAK6WR.js.map +0 -1
- package/dist/usdc-JIAJW4SV.js +0 -22
- /package/dist/{_esm-FEASBWRP.js.map → _esm-N4KAVXQR.js.map} +0 -0
- /package/dist/{ccip-NQXCEK2U.js.map → buy-OOOLUDND.js.map} +0 -0
- /package/dist/{ccip-XR5NE5QK.js.map → candidate-TWCWTFGA.js.map} +0 -0
- /package/dist/{config-VELDKLHY.js.map → ccip-RPPPKTJR.js.map} +0 -0
- /package/dist/{doctor-T3KWNNP2.js.map → ccip-ZGGWQN4X.js.map} +0 -0
- /package/dist/{chunk-XJIW7USF.js.map → chunk-333FOTUJ.js.map} +0 -0
- /package/dist/{chunk-YN5SHIXQ.js.map → chunk-DPET3TW5.js.map} +0 -0
- /package/dist/{chunk-S3IGX57D.js.map → chunk-FU6MCSLG.js.map} +0 -0
- /package/dist/{chunk-5CLSD5YN.js.map → chunk-KYQVEKP5.js.map} +0 -0
- /package/dist/{chunk-RRN3YTK7.js.map → chunk-KZAAWQNP.js.map} +0 -0
- /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POJRB2AE.js.map} +0 -0
- /package/dist/{chunk-CYOF7ROH.js.map → chunk-S5RYMCV6.js.map} +0 -0
- /package/dist/{chunk-ZMHYXMO6.js.map → chunk-U5S527PP.js.map} +0 -0
- /package/dist/{chunk-RY4XKNV3.js.map → chunk-UHTVXQ2O.js.map} +0 -0
- /package/dist/{chunk-QVX5MWJZ.js.map → chunk-W6R3HAAG.js.map} +0 -0
- /package/dist/{chunk-HIVZG55D.js.map → chunk-XJN5WUKL.js.map} +0 -0
- /package/dist/{chunk-HSDCI7OV.js.map → chunk-YLYINX2H.js.map} +0 -0
- /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → config-DBEEM3UA.js.map} +0 -0
- /package/dist/{secp256k1-N3ZHU7LB.js.map → doctor-XDA3YU6H.js.map} +0 -0
- /package/dist/{usdc-JIAJW4SV.js.map → ethersCompat-Df4a6QIZ-WHYKB6HA.js.map} +0 -0
- /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → inspect-YBGDAG47.js.map} +0 -0
- /package/dist/{wallet-PA54CRBL.js.map → outcome-ZFGHX2XW.js.map} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
runSearch
|
|
4
|
+
} from "./chunk-H5ETJRQD.js";
|
|
5
|
+
import "./chunk-MM4TGTST.js";
|
|
6
|
+
import "./chunk-XNNOR7F7.js";
|
|
7
|
+
import "./chunk-NXCJN2FJ.js";
|
|
8
|
+
import "./chunk-DPUMEMGM.js";
|
|
9
|
+
import "./chunk-WWX32ML4.js";
|
|
10
|
+
import "./chunk-VV4P5RVK.js";
|
|
11
|
+
import "./chunk-C4TIWOAM.js";
|
|
12
|
+
import "./chunk-QH6677FJ.js";
|
|
13
|
+
import "./chunk-2I4QTOLB.js";
|
|
14
|
+
import "./chunk-FHB3VKZW.js";
|
|
15
|
+
import "./chunk-YBMMV4Y4.js";
|
|
16
|
+
import "./chunk-UO22YNY4.js";
|
|
17
|
+
import "./chunk-BXUS5UCT.js";
|
|
18
|
+
import "./chunk-MUBUQVC3.js";
|
|
19
|
+
import "./chunk-6WWVYYSB.js";
|
|
20
|
+
import "./chunk-ZXTAQYNA.js";
|
|
21
|
+
export {
|
|
22
|
+
runSearch
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=search-R6NIQFXI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
schnorr,
|
|
6
6
|
secp256k1,
|
|
7
7
|
secp256k1_hasher
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-W6R3HAAG.js";
|
|
9
9
|
import "./chunk-RBJPAZFI.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-KYQVEKP5.js";
|
|
11
11
|
import "./chunk-ZXTAQYNA.js";
|
|
12
12
|
export {
|
|
13
13
|
encodeToCurve,
|
|
@@ -16,4 +16,4 @@ export {
|
|
|
16
16
|
secp256k1,
|
|
17
17
|
secp256k1_hasher
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=secp256k1-
|
|
19
|
+
//# sourceMappingURL=secp256k1-XRPVBC6V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
USDC_ADDRESS,
|
|
4
|
+
USDC_DECIMALS,
|
|
5
|
+
getUsdcBalance
|
|
6
|
+
} from "./chunk-333FOTUJ.js";
|
|
7
|
+
import "./chunk-7FK2UN2T.js";
|
|
8
|
+
import "./chunk-M2O56UK7.js";
|
|
9
|
+
import "./chunk-UHTVXQ2O.js";
|
|
10
|
+
import "./chunk-W6R3HAAG.js";
|
|
11
|
+
import "./chunk-U5S527PP.js";
|
|
12
|
+
import "./chunk-47PP7TAG.js";
|
|
13
|
+
import "./chunk-XJN5WUKL.js";
|
|
14
|
+
import "./chunk-RBJPAZFI.js";
|
|
15
|
+
import "./chunk-KYQVEKP5.js";
|
|
16
|
+
import "./chunk-ZXTAQYNA.js";
|
|
17
|
+
export {
|
|
18
|
+
USDC_ADDRESS,
|
|
19
|
+
USDC_DECIMALS,
|
|
20
|
+
getUsdcBalance
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=usdc-AU6ZIKA6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -2,13 +2,13 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
a,
|
|
4
4
|
s
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-S5RYMCV6.js";
|
|
6
|
+
import "./chunk-YLYINX2H.js";
|
|
7
|
+
import "./chunk-XJN5WUKL.js";
|
|
8
|
+
import "./chunk-KYQVEKP5.js";
|
|
9
9
|
import "./chunk-ZXTAQYNA.js";
|
|
10
10
|
export {
|
|
11
11
|
a as n,
|
|
12
12
|
s as t
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=viemAdapter-By13KInL-
|
|
14
|
+
//# sourceMappingURL=viemAdapter-By13KInL-TUQJBMHM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -5,20 +5,20 @@ import {
|
|
|
5
5
|
describeWallet,
|
|
6
6
|
resolveSpendAuthorizer,
|
|
7
7
|
resolveWalletProvider
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-S3KZ3PPK.js";
|
|
9
|
+
import "./chunk-DPET3TW5.js";
|
|
10
10
|
import "./chunk-2I4QTOLB.js";
|
|
11
11
|
import "./chunk-YBMMV4Y4.js";
|
|
12
12
|
import "./chunk-UO22YNY4.js";
|
|
13
13
|
import "./chunk-MUBUQVC3.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-6WWVYYSB.js";
|
|
15
|
+
import "./chunk-M2O56UK7.js";
|
|
16
|
+
import "./chunk-UHTVXQ2O.js";
|
|
17
|
+
import "./chunk-W6R3HAAG.js";
|
|
18
|
+
import "./chunk-47PP7TAG.js";
|
|
19
|
+
import "./chunk-XJN5WUKL.js";
|
|
20
20
|
import "./chunk-RBJPAZFI.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-KYQVEKP5.js";
|
|
22
22
|
import "./chunk-ZXTAQYNA.js";
|
|
23
23
|
export {
|
|
24
24
|
createLocalSpendAuthorizer,
|
|
@@ -27,4 +27,4 @@ export {
|
|
|
27
27
|
resolveSpendAuthorizer,
|
|
28
28
|
resolveWalletProvider
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=wallet-
|
|
30
|
+
//# sourceMappingURL=wallet-HKG3GSTX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
runWalletBalance,
|
|
4
|
+
runWalletCreate,
|
|
5
|
+
runWalletShow
|
|
6
|
+
} from "./chunk-R7BMDJZM.js";
|
|
7
|
+
import "./chunk-S3KZ3PPK.js";
|
|
8
|
+
import "./chunk-DPET3TW5.js";
|
|
9
|
+
import "./chunk-2I4QTOLB.js";
|
|
10
|
+
import "./chunk-YBMMV4Y4.js";
|
|
11
|
+
import "./chunk-UO22YNY4.js";
|
|
12
|
+
import "./chunk-BXUS5UCT.js";
|
|
13
|
+
import "./chunk-MUBUQVC3.js";
|
|
14
|
+
import "./chunk-6WWVYYSB.js";
|
|
15
|
+
import "./chunk-333FOTUJ.js";
|
|
16
|
+
import "./chunk-7FK2UN2T.js";
|
|
17
|
+
import "./chunk-M2O56UK7.js";
|
|
18
|
+
import "./chunk-UHTVXQ2O.js";
|
|
19
|
+
import "./chunk-W6R3HAAG.js";
|
|
20
|
+
import "./chunk-U5S527PP.js";
|
|
21
|
+
import "./chunk-47PP7TAG.js";
|
|
22
|
+
import "./chunk-XJN5WUKL.js";
|
|
23
|
+
import "./chunk-RBJPAZFI.js";
|
|
24
|
+
import "./chunk-KYQVEKP5.js";
|
|
25
|
+
import "./chunk-ZXTAQYNA.js";
|
|
26
|
+
export {
|
|
27
|
+
runWalletBalance,
|
|
28
|
+
runWalletCreate,
|
|
29
|
+
runWalletShow
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=wallet-UWHSHWC6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tenjin-cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Tenjin agent CLI for the x402 knowledge marketplace.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,13 +36,14 @@
|
|
|
36
36
|
],
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@changesets/cli": "^2.31.1",
|
|
39
|
-
"@eslint/js": "^
|
|
39
|
+
"@eslint/js": "^10",
|
|
40
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
40
41
|
"@types/node": "^25",
|
|
41
42
|
"@x402/core": "2.17.0",
|
|
42
43
|
"@x402/evm": "2.17.0",
|
|
43
44
|
"@x402/extensions": "2.17.0",
|
|
44
45
|
"commander": "^14.0.1",
|
|
45
|
-
"eslint": "^
|
|
46
|
+
"eslint": "^10",
|
|
46
47
|
"eslint-config-prettier": "^10",
|
|
47
48
|
"ox": "0.14.30",
|
|
48
49
|
"prettier": "^3",
|
package/skills/tenjin/SKILL.md
CHANGED
|
@@ -80,7 +80,7 @@ in `bodyMd`; to download it as a file, use `GET https://tenjin.blog/api/read/<ha
|
|
|
80
80
|
Every discovery surface is public, unauthenticated, CORS-open, and PREVIEW-ONLY:
|
|
81
81
|
|
|
82
82
|
- `GET https://tenjin.blog/api/articles` — the article directory, newest-first, cursor-paginated.
|
|
83
|
-
Compose `?q=<text>` (leak-safe full-text search over title/excerpt/tags),
|
|
83
|
+
Compose `?q=<text>` (leak-safe full-text search over title/excerpt/tags/preview),
|
|
84
84
|
`?tag=<slug>` (a shared tag is how authors form a "series"),
|
|
85
85
|
`?creator=<handle|0x>`, `?maxPrice=`/`?minPrice=<atomic USDC>` (a price band;
|
|
86
86
|
`maxPrice=0` = free only), `?updatedSince=<ISO-8601 UTC>` (incremental sync —
|
|
@@ -97,20 +97,23 @@ Every discovery surface is public, unauthenticated, CORS-open, and PREVIEW-ONLY:
|
|
|
97
97
|
From outside Tenjin: a paid article is auto-indexed by the CDP x402 Bazaar after its
|
|
98
98
|
FIRST settled sale (no register call), and by x402scan once CDP-settled payments flow.
|
|
99
99
|
|
|
100
|
-
## Find a paid answer for a task (agent
|
|
100
|
+
## Find a paid answer for a task (agent search)
|
|
101
101
|
|
|
102
102
|
Mid-task, ask a QUESTION instead of browsing: it matches author-attested answer cards with
|
|
103
|
-
freshness/price/applicability as HARD gates
|
|
104
|
-
no wallet.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
freshness/price/applicability as HARD gates. A MISS does not prove absence — rephrase, or
|
|
104
|
+
browse `?q=` (a MISS may carry a small `browse` tail). Anonymous, no wallet. Matching
|
|
105
|
+
runs on wording and meaning, so send the whole question as one natural-language sentence
|
|
106
|
+
rather than keywords, generalized first (no private identifiers, internal names, or
|
|
107
|
+
secrets; generalize the NAMES, keep the technical specifics).
|
|
108
|
+
|
|
109
|
+
- `POST https://tenjin.blog/api/agent/search` with `{ "schemaVersion": 1, "question": "<task question>",
|
|
110
|
+
"maxPrice"?: "<atomic USDC>", "freshWithin"?: "P30D", "limit"?: 5 }` → `{ searchId,
|
|
111
|
+
decision: "CANDIDATES" | "MISS", candidates?, browse? }`. A small early catalog means MISS
|
|
112
|
+
is often the honest answer; the question is never stored unless you send `X-Tenjin-Eval-Cohort: 1`.
|
|
110
113
|
- Buy a candidate by paying its `url` (the payable `/api/read/...` link) exactly like a paid
|
|
111
|
-
piece above — no extra headers required. OPTIONALLY add `X-Tenjin-
|
|
112
|
-
that read to link it to this
|
|
113
|
-
- `POST https://tenjin.blog/api/agent/
|
|
114
|
+
piece above — no extra headers required. OPTIONALLY add `X-Tenjin-Search-Id: <searchId>` on
|
|
115
|
+
that read to link it to this search (helps measure discovery quality; expires at 90 days).
|
|
116
|
+
- `POST https://tenjin.blog/api/agent/searches/<searchId>/outcomes` with `{ "status": "used" | "rejected"
|
|
114
117
|
| "regenerated" | "partially_used" | "purchase_declined", "resourceId"?, "contentHash"? }`
|
|
115
118
|
to report what you did → `202` (no existence oracle).
|
|
116
119
|
|
|
@@ -138,6 +141,45 @@ profile for your wallet. To embed an image, upload the bytes FIRST:
|
|
|
138
141
|
same SIWX header) → `{ imageId, url }`, then put `` in `bodyMd`.
|
|
139
142
|
Your first free-preview image becomes the cover automatically.
|
|
140
143
|
|
|
144
|
+
### Resource card (what makes a piece findable via search)
|
|
145
|
+
|
|
146
|
+
Agent search (below) matches a QUESTION against a machine-readable answer card, so a
|
|
147
|
+
piece WITHOUT one is invisible to search — a plain document, browseable but never a
|
|
148
|
+
search candidate. Attach a `resource` object to the same POST (or merge-update it
|
|
149
|
+
later with `PUT https://tenjin.blog/api/posts/<id>`) to make the piece findable, gateable, and
|
|
150
|
+
priceable before a buyer pays:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
"resource": {
|
|
154
|
+
"artifactType": "document", // document | skill | dataset
|
|
155
|
+
"temporalMode": "snapshot", // snapshot | maintained | evergreen
|
|
156
|
+
"asOf": "2026-07-01T00:00:00Z", // required for a snapshot to be eligible
|
|
157
|
+
"questionsAnswered": ["Does Vercel respect .nvmrc for serverless builds?"],
|
|
158
|
+
"scope": "Vercel serverless builds, Next 15/16",
|
|
159
|
+
"exclusions": "Not edge runtime",
|
|
160
|
+
"appliesTo": { "products": ["Vercel"] },
|
|
161
|
+
"provenanceSummary": "Reproduced on a live deploy 2026-07-01"
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`questionsAnswered` is the field that most decides findability. Write 5 to 10 entries, 200 chars max each,
|
|
166
|
+
in DIFFERENT registers: a natural symptom sentence a stuck agent would ask, a terse keyword
|
|
167
|
+
or verbatim error-string form, and a why/how form. Each entry is its own search target. The
|
|
168
|
+
registers are an axis, not a quota: list every distinct question the piece answers, then
|
|
169
|
+
write each in whichever registers fit it. Near-duplicate rephrasings of one question in one
|
|
170
|
+
register add nothing.
|
|
171
|
+
`scope` is searched too: make it a dense factual sentence. Only `questionsAnswered` and
|
|
172
|
+
`scope` are matched by meaning; `tasksSupported` and `appliesTo` match exact wording only,
|
|
173
|
+
so anything a searcher might paraphrase belongs in `questionsAnswered` or `scope`.
|
|
174
|
+
Questions the piece ANSWERS go in `questionsAnswered`; tasks it helps COMPLETE go in
|
|
175
|
+
`tasksSupported`.
|
|
176
|
+
|
|
177
|
+
Every card field is PUBLIC, pre-paywall: never put paid content in it. The response
|
|
178
|
+
echoes a server-computed `cacheEligible` plus `cacheEligibleMissing` listing what the
|
|
179
|
+
card still needs (at least one question/task, `scope`, `exclusions`, `asOf` for a
|
|
180
|
+
snapshot, a provenance summary); fix the gaps with a `PUT`. See /llms.txt for the full
|
|
181
|
+
field contract.
|
|
182
|
+
|
|
141
183
|
### Build the SIGN-IN-WITH-X header
|
|
142
184
|
|
|
143
185
|
CLIENT-driven: you construct, sign, and send the full CAIP-122 message on the FIRST
|
|
@@ -186,7 +228,8 @@ All of these take the same `SIGN-IN-WITH-X` header (single-use nonce per write):
|
|
|
186
228
|
## MCP server
|
|
187
229
|
|
|
188
230
|
https://tenjin.blog/api/mcp is a remote MCP server (Streamable HTTP) exposing these flows as
|
|
189
|
-
callable tools — `search_articles`, `
|
|
231
|
+
callable tools — `search_articles`, `search` (mid-task question → buyable
|
|
232
|
+
candidates), `get_article`, `get_creator`, `list_tags`, `submit_feedback`
|
|
190
233
|
(keyless), plus `pay_and_read`, `publish_essay`, `get_profile`, and `get_library`.
|
|
191
234
|
The server NEVER holds your keys: the keyless tools hit the public discovery + read
|
|
192
235
|
surface, and the wallet tools take a header YOU signed locally (the
|
|
@@ -59,14 +59,29 @@ edge, and price for the freshness that remains.
|
|
|
59
59
|
no personal data; no long verbatim copyrighted text. Method mixed with
|
|
60
60
|
private data: publish the method, strip the data.
|
|
61
61
|
- Fill the answer card when prompted (what it answers, applies-to, exclusions,
|
|
62
|
-
freshness): a complete card is what makes the resource findable by
|
|
62
|
+
freshness): a complete card is what makes the resource findable by search.
|
|
63
|
+
Search matches the card on wording and on meaning, but only
|
|
64
|
+
`questionsAnswered` and `scope` are matched on meaning, so they carry the
|
|
65
|
+
recall. Phrase them for the questions buyers actually ask:
|
|
66
|
+
- `questionsAnswered`: 5 to 10 entries, 200 characters max each, one question
|
|
67
|
+
the piece answers per entry. Vary the register across entries: a natural
|
|
68
|
+
symptom sentence, a terse keyword line or the verbatim error string, a
|
|
69
|
+
why/how question. Same-register rephrasings of an entry you already have add
|
|
70
|
+
nothing. When the piece answers a question you looked up, make that exact
|
|
71
|
+
phrasing one of the entries.
|
|
72
|
+
- `tasksSupported`: the tasks the piece supports, same 10-entry and
|
|
73
|
+
200-character caps. Questions go in `questionsAnswered`, tasks go here; do
|
|
74
|
+
not mix them. Matched on wording only, so anything you want found by meaning
|
|
75
|
+
belongs in `questionsAnswered`.
|
|
76
|
+
- `scope`: dense and factual: versions, platforms, and the setup the work was
|
|
77
|
+
done on, not a pitch.
|
|
63
78
|
- Agent-ready body: tables, exact commands, decision rules; no prose padding.
|
|
64
79
|
Keep the free preview minimal, roughly what it answers plus the as-of date.
|
|
65
80
|
|
|
66
81
|
## Publish
|
|
67
82
|
|
|
68
83
|
```bash
|
|
69
|
-
tenjin publish <file.md> [--draft]
|
|
84
|
+
tenjin publish <file.md> --json [--draft]
|
|
70
85
|
```
|
|
71
86
|
|
|
72
87
|
Consent follows the configured `publish.mode` (default `review`). The
|
|
@@ -78,7 +93,7 @@ full-auto):
|
|
|
78
93
|
plain yes/no (with any flagged findings), and re-run with `--yes` only on an
|
|
79
94
|
explicit yes.
|
|
80
95
|
- **auto**: a clean scan publishes at the default price with no prompt
|
|
81
|
-
(including an answer you derived after a
|
|
96
|
+
(including an answer you derived after a search MISS); a flagged scan exits 3
|
|
82
97
|
with the same `needs_confirmation` payload to render.
|
|
83
98
|
- **full-auto**: warnings do not stop it; only a hard-block finding (a live
|
|
84
99
|
secret or private key) refuses, and no mode or `--yes` can clear that.
|
|
@@ -94,11 +109,11 @@ path) instead, with the same rubric and consent rules above.
|
|
|
94
109
|
Candidates are your internal pen for a reusable answer you could not publish
|
|
95
110
|
yet: the user said not-now, a publish refused or blocked, or there was no
|
|
96
111
|
wallet. Not a user-facing workflow; it is housekeeping so the answer is not
|
|
97
|
-
lost. `tenjin candidate list` shows the pen with age, and a `tenjin
|
|
112
|
+
lost. `tenjin candidate list --json` shows the pen with age, and a `tenjin search`
|
|
98
113
|
prints a one-line stderr nudge when drafts are parked (and how many are stale
|
|
99
|
-
>7d), so they resurface. Publishing one (`tenjin publish --candidate <id
|
|
114
|
+
>7d), so they resurface. Publishing one (`tenjin publish --candidate <id> --json`) runs
|
|
100
115
|
the same flow on its draft and clears it only on a successful publish (a refusal
|
|
101
|
-
or failure leaves it parked); `tenjin candidate drop <id
|
|
116
|
+
or failure leaves it parked); `tenjin candidate drop <id> --json` discards. They are
|
|
102
117
|
local files and never upload by themselves.
|
|
103
118
|
|
|
104
119
|
## Maintain what is published (updates are the product)
|
|
@@ -12,12 +12,15 @@ description: >-
|
|
|
12
12
|
https://tenjin.blog/skills.md instead.
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
# Tenjin search: one
|
|
15
|
+
# Tenjin search: one search before you regenerate
|
|
16
16
|
|
|
17
17
|
The `tenjin` CLI owns every mechanic: HTTP, x402 payment signing, SIWX auth,
|
|
18
18
|
entitlements, local delivery. You never assemble a request or a payment payload.
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
ALWAYS pass `--json`: it prints one compact JSON object on stdout for you to
|
|
20
|
+
parse. Without it, at an interactive terminal the CLI is human-first (prose, no
|
|
21
|
+
envelope), so a PTY-allocating harness would otherwise get unparseable output.
|
|
22
|
+
Every command below already includes it. Exit codes: `0` success (an honest MISS
|
|
23
|
+
is success),
|
|
21
24
|
`1` network/runtime, `2` usage, `3` policy refusal, `4` payment failure. On
|
|
22
25
|
failure the commands self-diagnose; `tenjin doctor` is optional diagnostics,
|
|
23
26
|
never a required first step.
|
|
@@ -39,25 +42,33 @@ never a required first step.
|
|
|
39
42
|
If any of the four fails, generate instead. When they hold, look up first: a
|
|
40
43
|
habitual miss adds latency and context to every task.
|
|
41
44
|
|
|
42
|
-
## The
|
|
45
|
+
## The search
|
|
43
46
|
|
|
44
47
|
```bash
|
|
45
|
-
tenjin
|
|
48
|
+
tenjin search "<generalized question>" --json --limit 5 [--fresh-within P30D] [--max-price 0.25] [--applies-to key=value]
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
- **Query hygiene: the question leaves your environment.** Send only the
|
|
49
52
|
generalizable part. Strip private identifiers, internal service names,
|
|
50
53
|
account names, positions, secrets. If it cannot be generalized without
|
|
51
54
|
leaking, do not search.
|
|
52
|
-
-
|
|
53
|
-
|
|
55
|
+
- Search matches both wording and meaning, so send the complete question as one
|
|
56
|
+
natural-language sentence. Do not compress it to keywords; the dropped words
|
|
57
|
+
are what the meaning match runs on.
|
|
58
|
+
- The server answers `CANDIDATES` or `MISS`. MISS is a fine answer; move on
|
|
59
|
+
immediately.
|
|
54
60
|
- Version- or parameter-specific questions need an exact match. "Related" is
|
|
55
61
|
not "reusable"; an uncertain match is a MISS.
|
|
62
|
+
- A MISS may carry a `browse` tail: at most three pointers (`resourceId`, `url`,
|
|
63
|
+
`title`, `price`, `creator.handle`) into the broad corpus, with no match
|
|
64
|
+
reasons and no score. It is a "you might browse this" hint, not a ranked
|
|
65
|
+
answer, so a MISS with `browse` is still a MISS: treat it as reading material
|
|
66
|
+
a human may want, never as a candidate to buy on the strength of the search.
|
|
56
67
|
|
|
57
68
|
## Inspect, then decide
|
|
58
69
|
|
|
59
70
|
```bash
|
|
60
|
-
tenjin inspect <resource-url-or-id>
|
|
71
|
+
tenjin inspect <resource-url-or-id> --json
|
|
61
72
|
```
|
|
62
73
|
|
|
63
74
|
Free, never pays. Shows the answer card (what it answers, applies-to,
|
|
@@ -74,7 +85,7 @@ above hold rather than on a hunch.
|
|
|
74
85
|
## Buy
|
|
75
86
|
|
|
76
87
|
```bash
|
|
77
|
-
tenjin buy <resource-url-or-id> --max-price <usd> [--yes]
|
|
88
|
+
tenjin buy <resource-url-or-id> --json --max-price <usd> [--yes]
|
|
78
89
|
```
|
|
79
90
|
|
|
80
91
|
- Default automatic spend is **zero**; without approval or a configured policy
|
|
@@ -87,30 +98,31 @@ tenjin buy <resource-url-or-id> --max-price <usd> [--yes]
|
|
|
87
98
|
## Report the outcome (always)
|
|
88
99
|
|
|
89
100
|
```bash
|
|
90
|
-
tenjin outcome --last --status used|partially_used|rejected|regenerated|purchase_declined
|
|
101
|
+
tenjin outcome --json --last --status used|partially_used|rejected|regenerated|purchase_declined
|
|
91
102
|
```
|
|
92
103
|
|
|
93
|
-
Report honestly after acting on a
|
|
104
|
+
Report honestly after acting on a search, including rejections. This is the
|
|
94
105
|
signal the marketplace learns from and it costs one command.
|
|
95
106
|
|
|
96
107
|
## After a MISS: publish what you build (by your consent mode)
|
|
97
108
|
|
|
98
|
-
If the
|
|
109
|
+
If the search MISSed and you then completed the task with a reusable, public,
|
|
99
110
|
rights-clean finding, publishing it back is the point of the marketplace. Act by
|
|
100
111
|
the resolved `publish.mode`. The tenjin-publish skill owns the mechanics and is
|
|
101
112
|
`disable-model-invocation: true`, so on any path that publishes, READ its
|
|
102
113
|
`SKILL.md` (installed alongside this one, at `tenjin-publish/SKILL.md`) first and
|
|
103
114
|
follow its draft, sanitize, and pricing rules; never publish bare.
|
|
104
115
|
|
|
105
|
-
- **review** (the default): draft the piece, then run `tenjin publish` (no
|
|
116
|
+
- **review** (the default): draft the piece, then run `tenjin publish --json` (no
|
|
106
117
|
`--yes`). It exits 3 with the `needs_confirmation` payload; render THAT
|
|
107
118
|
payload's findings and price as the one-click yes/no, and re-run with `--yes`
|
|
108
119
|
only on an explicit yes. Park it as a candidate (`tenjin candidate add
|
|
109
|
-
<finding.md> --
|
|
110
|
-
run-then-render sequence the
|
|
111
|
-
"publish?" before running, or
|
|
112
|
-
(PII, wallet addresses) the user
|
|
113
|
-
|
|
120
|
+
<finding.md> --search-id <id> --question "<the question you looked up>"
|
|
121
|
+
--json`) only on "not now". This is the same run-then-render sequence the
|
|
122
|
+
tenjin-publish skill uses: never ask a generic "publish?" before running, or
|
|
123
|
+
the `--yes` re-run would clear WARN findings (PII, wallet addresses) the user
|
|
124
|
+
never saw.
|
|
125
|
+
- **auto / full-auto**: build the answer card and run `tenjin publish --json` directly.
|
|
114
126
|
In auto, a clearable warning does NOT park silently: the CLI exits 3 with the
|
|
115
127
|
`needs_confirmation` payload, which you render as the same one-click yes/no and
|
|
116
128
|
re-run with `--yes` on a yes. Park as a candidate only when the publish cannot
|
|
@@ -118,8 +130,11 @@ follow its draft, sanitize, and pricing rules; never publish bare.
|
|
|
118
130
|
published, with the URL.
|
|
119
131
|
|
|
120
132
|
Candidates are local files that never upload on their own; `tenjin candidate
|
|
121
|
-
list` shows the pen, and a later `tenjin publish --candidate <id
|
|
122
|
-
through the same consent scan.
|
|
133
|
+
list --json` shows the pen, and a later `tenjin publish --candidate <id> --json` sends one
|
|
134
|
+
through the same consent scan. Publish falls back to the stored `--question` for
|
|
135
|
+
the card's `questionsAnswered`, but only when the draft names none, so whenever
|
|
136
|
+
you write the card yourself include the question you looked up as one of its
|
|
137
|
+
entries: that exact phrasing is what the next searcher sends.
|
|
123
138
|
|
|
124
139
|
## Safety
|
|
125
140
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/agent-api.ts"],"sourcesContent":["import { z } from 'zod';\nimport { CliError } from './errors';\nimport { httpRequest, type HttpResult } from './http';\nimport { CLIENT_HEADER } from './client-meta';\nimport { ATOMIC_RE, UUID_RE } from './ids';\nimport { trimSlash } from './url';\n\n/**\n * The lookup + outcome HTTP contract (A2, tenjin#370). Request building and\n * response validation live here; the wire shape is validated defensively, an\n * unknown `schemaVersion` degrades to a parse refusal rather than a guess, and\n * unrecognized candidate fields are ignored (forward-compatible), per spec 10.\n *\n * These endpoints are anonymous: no wallet, no SIWX. The only header of note is\n * `X-Tenjin-Client`, which attributes a later purchase back to the lookup flow.\n */\n\nconst FRESH_WITHIN_RE = /^P(\\d+)[DWMY]$/;\nconst CANONICAL_KEY_RE = /^[a-z][a-z0-9_]{0,31}$/;\n\n/** Client-side lookup request (mirrors lib/lookup.ts lookupRequestSchema bounds\n * so a malformed flag fails locally as USAGE, before a round trip). */\nexport interface LookupInput {\n question: string;\n freshWithin?: string;\n maxPrice?: string;\n appliesTo?: Record<string, string[]>;\n limit?: number;\n}\n\nexport interface LookupRequestBody {\n schemaVersion: 1;\n question: string;\n freshWithin?: string;\n maxPrice?: string;\n appliesTo?: Record<string, string[]>;\n limit: number;\n}\n\nexport function buildLookupRequest(input: LookupInput): LookupRequestBody {\n const question = input.question.trim();\n if (question.length === 0 || question.length > 512) {\n throw new CliError('USAGE', 'question must be 1 to 512 characters', {\n fix: 'Pass a non-empty question under 512 characters.',\n });\n }\n if (input.freshWithin !== undefined) {\n // The server rejects ANY zero-valued duration (P0D, P0W, P00M, ...), so a\n // zero window fails here as USAGE instead of a remote 400.\n const digits = FRESH_WITHIN_RE.exec(input.freshWithin)?.[1];\n if (digits === undefined || Number(digits) === 0) {\n throw new CliError('USAGE', `Invalid --fresh-within: ${JSON.stringify(input.freshWithin)}`, {\n fix: 'Use a nonzero ISO-like window P<n>[DWMY], e.g. P30D, P2W, P1Y.',\n });\n }\n }\n if (input.maxPrice !== undefined && !ATOMIC_RE.test(input.maxPrice)) {\n throw new CliError('USAGE', `Invalid --max-price: ${JSON.stringify(input.maxPrice)}`, {\n fix: 'Pass an atomic USDC integer, e.g. 100000 for $0.10.',\n });\n }\n const limit = input.limit ?? 5;\n if (!Number.isInteger(limit) || limit < 1 || limit > 10) {\n throw new CliError('USAGE', `Invalid --limit: ${JSON.stringify(input.limit)}`, {\n fix: 'Pass an integer between 1 and 10.',\n });\n }\n if (input.appliesTo !== undefined) {\n // Mirror the server's strictObject bounds (<=8 keys, <=20 values/key,\n // 1..120 chars/value) so a bad filter fails locally, never as a remote 400.\n const keys = Object.keys(input.appliesTo);\n if (keys.length > 8) {\n throw new CliError('USAGE', 'Too many --applies-to keys (max 8).');\n }\n for (const [key, values] of Object.entries(input.appliesTo)) {\n if (!CANONICAL_KEY_RE.test(key)) {\n throw new CliError('USAGE', `Invalid appliesTo key: ${JSON.stringify(key)}`, {\n fix: 'Keys must be canonical lowercase identifiers, e.g. products=Vercel.',\n });\n }\n if (values.length === 0) {\n throw new CliError('USAGE', `appliesTo key ${JSON.stringify(key)} has no values`, {\n fix: 'Give each --applies-to key at least one value.',\n });\n }\n if (values.length > 20) {\n throw new CliError('USAGE', `Too many --applies-to values for ${key} (max 20).`);\n }\n for (const value of values) {\n if (value.length === 0 || value.length > 120) {\n throw new CliError(\n 'USAGE',\n `Invalid --applies-to value for ${key}: must be 1 to 120 characters.`,\n );\n }\n }\n }\n }\n return {\n schemaVersion: 1,\n question,\n ...(input.freshWithin !== undefined ? { freshWithin: input.freshWithin } : {}),\n ...(input.maxPrice !== undefined ? { maxPrice: input.maxPrice } : {}),\n ...(input.appliesTo !== undefined ? { appliesTo: input.appliesTo } : {}),\n limit,\n };\n}\n\n// Response schemas. `.passthrough()` on the candidate keeps unknown future fields\n// instead of stripping them (forward-compatible), while still requiring the\n// contract fields this CLI reads. `decision` is uppercase on the wire.\nexport const lookupCandidateSchema = z\n .object({\n resourceId: z.string().regex(UUID_RE, 'resourceId must be a uuid'),\n url: z.string(),\n title: z.string(),\n artifactType: z.string(),\n price: z.string().regex(ATOMIC_RE, 'price must be an atomic integer string'),\n asOf: z.string().nullable(),\n validUntil: z.string().nullable(),\n temporalMode: z.string(),\n appliesTo: z.record(z.string(), z.array(z.string())),\n questionsAnswered: z.array(z.string()),\n tasksSupported: z.array(z.string()),\n scope: z.string().nullable(),\n exclusions: z.string().nullable(),\n matchReasons: z.array(z.string()),\n estimatedTokens: z.number(),\n creator: z.object({ handle: z.string() }).passthrough(),\n })\n .passthrough();\n\nexport type LookupCandidate = z.infer<typeof lookupCandidateSchema>;\n\nexport const lookupResponseSchema = z.object({\n schemaVersion: z.literal(1),\n lookupId: z.string().regex(UUID_RE, 'lookupId must be a uuid'),\n decision: z.enum(['CANDIDATES', 'MISS']),\n calibration: z.string(),\n candidates: z.array(lookupCandidateSchema).optional(),\n});\n\nexport type LookupResponse = z.infer<typeof lookupResponseSchema>;\n\nexport interface AgentApiOptions {\n baseUrl: string;\n timeoutMs: number;\n fetchImpl?: typeof fetch;\n /** Spec 09 §3 evaluation-cohort opt-in: sends X-Tenjin-Eval-Cohort: 1. */\n evalCohort?: boolean;\n}\n\n/** Turn a non-2xx / transport HttpResult into the CLI error contract. */\nfunction apiFailure(url: string, result: Exclude<HttpResult, { ok: true }>): CliError {\n const code =\n result.kind === 'network' || result.kind === 'timeout' ? 'NETWORK_ERROR' : 'API_UNREACHABLE';\n return new CliError(code, `${url}: ${result.message}`, {\n fix: 'Check --base-url and your network, then retry.',\n });\n}\n\n/** 429 with Retry-After: a recoverable pause, not an outage; agents branch on it. */\nexport function rateLimitError(\n url: string,\n header: (name: string) => string | undefined,\n): CliError {\n const retryAfter = header('retry-after');\n const seconds = retryAfter !== undefined ? Number(retryAfter) : undefined;\n return new CliError('RATE_LIMITED', `${url}: rate limited by the server.`, {\n fix:\n seconds !== undefined && Number.isFinite(seconds)\n ? `Retry after ${seconds}s.`\n : 'Back off and retry shortly.',\n details: {\n ...(seconds !== undefined && Number.isFinite(seconds) ? { retryAfterSeconds: seconds } : {}),\n },\n });\n}\n\nfunction serverErrorMessage(json: unknown): string | undefined {\n if (typeof json === 'object' && json !== null) {\n const rec = json as Record<string, unknown>;\n const err = rec.error;\n if (typeof err === 'string') return err;\n if (typeof err === 'object' && err !== null) {\n const m = (err as Record<string, unknown>).message;\n if (typeof m === 'string') return m;\n }\n if (typeof rec.message === 'string') return rec.message;\n }\n return undefined;\n}\n\nexport async function postLookup(\n body: LookupRequestBody,\n opts: AgentApiOptions,\n): Promise<LookupResponse> {\n const url = `${trimSlash(opts.baseUrl)}/api/agent/lookup`;\n const res = await httpRequest(url, {\n method: 'POST',\n timeoutMs: opts.timeoutMs,\n headers: {\n 'x-tenjin-client': CLIENT_HEADER,\n ...(opts.evalCohort === true ? { 'x-tenjin-eval-cohort': '1' } : {}),\n },\n jsonBody: body,\n fetchImpl: opts.fetchImpl,\n });\n if (!res.ok) throw apiFailure(url, res);\n if (res.status === 429) throw rateLimitError(url, (n) => res.header(n));\n if (res.status !== 200) {\n throw new CliError(\n 'API_UNREACHABLE',\n serverErrorMessage(res.json) ?? `Lookup failed (${res.status})`,\n {\n fix: 'Retry; if it persists the lookup endpoint may be unavailable.',\n details: res.json,\n },\n );\n }\n const parsed = lookupResponseSchema.safeParse(res.json);\n if (!parsed.success) {\n throw new CliError('CONTRACT_MISMATCH', 'Lookup response did not match the expected contract', {\n fix: 'Update tenjin-cli; the server contract may have changed.',\n details: parsed.error.issues,\n });\n }\n return truncateResponse(parsed.data);\n}\n\n/**\n * The server bounds every card string (response budget ~1k tokens, spec 09);\n * re-apply the same caps defensively so a misbehaving server cannot blow up an\n * agent transcript through the CLI (spec 10 response-size discipline).\n */\nconst CAND_BOUNDS = {\n title: 200,\n scope: 240,\n exclusions: 240,\n listItems: 4,\n listItemChars: 160,\n matchReasons: 3,\n matchReasonChars: 80,\n appliesToKeys: 6,\n appliesToValues: 5,\n appliesToValueChars: 80,\n} as const;\n\nfunction truncateResponse(res: LookupResponse): LookupResponse {\n if (res.candidates === undefined) return res;\n return { ...res, candidates: res.candidates.map(truncateCandidate) };\n}\n\nfunction truncateCandidate(c: LookupCandidate): LookupCandidate {\n const cap = (s: string, n: number): string => (s.length > n ? s.slice(0, n) : s);\n const capList = (list: string[], items: number, chars: number): string[] =>\n list.slice(0, items).map((s) => cap(s, chars));\n const appliesTo: Record<string, string[]> = {};\n for (const key of Object.keys(c.appliesTo).slice(0, CAND_BOUNDS.appliesToKeys)) {\n appliesTo[cap(key, CAND_BOUNDS.appliesToValueChars)] = capList(\n c.appliesTo[key] ?? [],\n CAND_BOUNDS.appliesToValues,\n CAND_BOUNDS.appliesToValueChars,\n );\n }\n return {\n ...c,\n title: cap(c.title, CAND_BOUNDS.title),\n scope: c.scope === null ? null : cap(c.scope, CAND_BOUNDS.scope),\n exclusions: c.exclusions === null ? null : cap(c.exclusions, CAND_BOUNDS.exclusions),\n questionsAnswered: capList(\n c.questionsAnswered,\n CAND_BOUNDS.listItems,\n CAND_BOUNDS.listItemChars,\n ),\n tasksSupported: capList(c.tasksSupported, CAND_BOUNDS.listItems, CAND_BOUNDS.listItemChars),\n matchReasons: capList(c.matchReasons, CAND_BOUNDS.matchReasons, CAND_BOUNDS.matchReasonChars),\n appliesTo,\n };\n}\n\nconst OUTCOME_STATUSES = [\n 'used',\n 'partially_used',\n 'rejected',\n 'regenerated',\n 'purchase_declined',\n] as const;\nexport type OutcomeStatus = (typeof OUTCOME_STATUSES)[number];\nexport const OUTCOME_STATUS_VALUES: readonly string[] = OUTCOME_STATUSES;\n\nconst CONTENT_HASH_RE = /^sha256:[0-9a-f]{64}$/;\n\nexport interface OutcomeInput {\n status: string;\n resourceId?: string;\n contentHash?: string;\n}\n\nexport interface OutcomeBodyItem {\n status: OutcomeStatus;\n resourceId?: string;\n contentHash?: string;\n}\n\nexport function buildOutcomeItem(input: OutcomeInput): OutcomeBodyItem {\n if (!OUTCOME_STATUS_VALUES.includes(input.status)) {\n throw new CliError('USAGE', `Invalid outcome status: ${JSON.stringify(input.status)}`, {\n fix: `Use one of: ${OUTCOME_STATUSES.join(', ')}.`,\n });\n }\n if (input.resourceId !== undefined && !UUID_RE.test(input.resourceId)) {\n throw new CliError('USAGE', `Invalid --resource id: ${JSON.stringify(input.resourceId)}`, {\n fix: 'Pass the resourceId (a uuid) from a lookup candidate.',\n });\n }\n if (input.contentHash !== undefined && !CONTENT_HASH_RE.test(input.contentHash)) {\n throw new CliError('USAGE', `Invalid content hash: ${JSON.stringify(input.contentHash)}`, {\n fix: 'A content hash is \"sha256:<64 hex>\".',\n });\n }\n return {\n status: input.status as OutcomeStatus,\n ...(input.resourceId !== undefined ? { resourceId: input.resourceId } : {}),\n ...(input.contentHash !== undefined ? { contentHash: input.contentHash } : {}),\n };\n}\n\nconst LOOKUP_ID_RE = UUID_RE;\n\nexport async function postOutcomes(\n lookupId: string,\n items: OutcomeBodyItem[],\n opts: AgentApiOptions,\n): Promise<{ accepted: number }> {\n if (!LOOKUP_ID_RE.test(lookupId)) {\n throw new CliError('USAGE', `Invalid lookup id: ${JSON.stringify(lookupId)}`, {\n fix: 'Pass the lookupId from a prior lookup (or use --last).',\n });\n }\n if (items.length === 0 || items.length > 10) {\n throw new CliError('USAGE', 'An outcome report carries 1 to 10 items', {\n fix: 'Report between 1 and 10 outcomes per call.',\n });\n }\n const url = `${trimSlash(opts.baseUrl)}/api/agent/lookups/${lookupId}/outcomes`;\n const res = await httpRequest(url, {\n method: 'POST',\n timeoutMs: opts.timeoutMs,\n headers: { 'x-tenjin-client': CLIENT_HEADER },\n jsonBody: items.length === 1 ? items[0] : items,\n fetchImpl: opts.fetchImpl,\n });\n if (!res.ok) throw apiFailure(url, res);\n if (res.status === 429) throw rateLimitError(url, (n) => res.header(n));\n // 202 is the only success; the body is a uniform { accepted } regardless of\n // whether the lookupId existed (no existence oracle, by design).\n if (res.status !== 202) {\n throw new CliError(\n 'API_UNREACHABLE',\n serverErrorMessage(res.json) ?? `Outcome report failed (${res.status})`,\n {\n fix: 'Check the status vocabulary and lookup id, then retry.',\n details: res.json,\n },\n );\n }\n const accepted =\n typeof res.json === 'object' && res.json !== null && 'accepted' in res.json\n ? Number((res.json as { accepted: unknown }).accepted)\n : items.length;\n return { accepted: Number.isFinite(accepted) ? accepted : items.length };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,IAAM,kBAAkB;AACxB,IAAM,mBAAmB;AAqBlB,SAAS,mBAAmB,OAAuC;AACxE,QAAM,WAAW,MAAM,SAAS,KAAK;AACrC,MAAI,SAAS,WAAW,KAAK,SAAS,SAAS,KAAK;AAClD,UAAM,IAAI,SAAS,SAAS,wCAAwC;AAAA,MAClE,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,MAAI,MAAM,gBAAgB,QAAW;AAGnC,UAAM,SAAS,gBAAgB,KAAK,MAAM,WAAW,IAAI,CAAC;AAC1D,QAAI,WAAW,UAAa,OAAO,MAAM,MAAM,GAAG;AAChD,YAAM,IAAI,SAAS,SAAS,2BAA2B,KAAK,UAAU,MAAM,WAAW,CAAC,IAAI;AAAA,QAC1F,KAAK;AAAA,MACP,CAAC;AAAA,IACH;AAAA,EACF;AACA,MAAI,MAAM,aAAa,UAAa,CAAC,UAAU,KAAK,MAAM,QAAQ,GAAG;AACnE,UAAM,IAAI,SAAS,SAAS,wBAAwB,KAAK,UAAU,MAAM,QAAQ,CAAC,IAAI;AAAA,MACpF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,QAAM,QAAQ,MAAM,SAAS;AAC7B,MAAI,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,KAAK,QAAQ,IAAI;AACvD,UAAM,IAAI,SAAS,SAAS,oBAAoB,KAAK,UAAU,MAAM,KAAK,CAAC,IAAI;AAAA,MAC7E,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACA,MAAI,MAAM,cAAc,QAAW;AAGjC,UAAM,OAAO,OAAO,KAAK,MAAM,SAAS;AACxC,QAAI,KAAK,SAAS,G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\": \"tenjin-cli\",\n \"version\": \"0.1.0-alpha.3\",\n \"type\": \"module\",\n \"description\": \"Tenjin agent CLI for the x402 knowledge marketplace.\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/BackTrackCo/tenjin-agent.git\"\n },\n \"homepage\": \"https://tenjin.blog/agents\",\n \"bugs\": \"https://github.com/BackTrackCo/tenjin-agent/issues\",\n \"keywords\": [\n \"x402\",\n \"usdc\",\n \"base\",\n \"ai-agents\",\n \"agent-payments\",\n \"mcp\",\n \"knowledge-marketplace\",\n \"micropayments\",\n \"claude\",\n \"codex\",\n \"cli\"\n ],\n \"bin\": {\n \"tenjin\": \"dist/index.js\"\n },\n \"engines\": {\n \"node\": \">=22\"\n },\n \"files\": [\n \"dist\",\n \"skills\",\n \"NOTICE.md\"\n ],\n \"packageManager\": \"pnpm@11.11.0\",\n \"scripts\": {\n \"build\": \"tsup\",\n \"test\": \"vitest run\",\n \"typecheck\": \"tsc --noEmit\",\n \"lint\": \"eslint .\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"check\": \"pnpm run build && pnpm run test\",\n \"sync:skill\": \"node scripts/sync-skill.mjs\",\n \"pack-smoke\": \"bash scripts/pack-smoke.sh\",\n \"changeset\": \"changeset\",\n \"prepublishOnly\": \"pnpm run build\",\n \"prepare\": \"git config core.hooksPath .githooks || true\"\n },\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.31.1\",\n \"@eslint/js\": \"^9\",\n \"@types/node\": \"^25\",\n \"@x402/core\": \"2.17.0\",\n \"@x402/evm\": \"2.17.0\",\n \"@x402/extensions\": \"2.17.0\",\n \"commander\": \"^14.0.1\",\n \"eslint\": \"^9\",\n \"eslint-config-prettier\": \"^10\",\n \"ox\": \"0.14.30\",\n \"prettier\": \"^3\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^6\",\n \"typescript-eslint\": \"^8\",\n \"viem\": \"^2.53.1\",\n \"vitest\": \"^4.1.9\",\n \"zod\": \"^4.4.3\"\n }\n}\n"],"mappings":";;;AAAA;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,SAAW;AAAA,EACX,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,UAAY;AAAA,EACZ,MAAQ;AAAA,EACR,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,KAAO;AAAA,IACL,QAAU;AAAA,EACZ;AAAA,EACA,SAAW;AAAA,IACT,MAAQ;AAAA,EACV;AAAA,EACA,OAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,gBAAkB;AAAA,EAClB,SAAW;AAAA,IACT,OAAS;AAAA,IACT,MAAQ;AAAA,IACR,WAAa;AAAA,IACb,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,OAAS;AAAA,IACT,cAAc;AAAA,IACd,cAAc;AAAA,IACd,WAAa;AAAA,IACb,gBAAkB;AAAA,IAClB,SAAW;AAAA,EACb;AAAA,EACA,iBAAmB;AAAA,IACjB,mBAAmB;AAAA,IACnB,cAAc;AAAA,IACd,eAAe;AAAA,IACf,cAAc;AAAA,IACd,aAAa;AAAA,IACb,oBAAoB;AAAA,IACpB,WAAa;AAAA,IACb,QAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,IAAM;AAAA,IACN,UAAY;AAAA,IACZ,MAAQ;AAAA,IACR,YAAc;AAAA,IACd,qBAAqB;AAAA,IACrB,MAAQ;AAAA,IACR,QAAU;AAAA,IACV,KAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/lookup-store.ts"],"sourcesContent":["import { mkdir, readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { z } from 'zod';\nimport { writeFileAtomic } from './atomic-json';\nimport { withFileLock } from './lock';\n\n/**\n * A small local ledger of recent lookups so `outcome --last` can target the most\n * recent one and `buy <resourceId>` can resolve the payable read URL a candidate\n * carried (the read route is keyed by handle/slug, not id, so an id alone can't\n * build the URL). Bounded and best-effort: a corrupt file reads as empty rather\n * than blocking a command. NOT an entitlement record, that is the library receipt.\n */\n\nconst MAX_ENTRIES = 50;\n\nconst StoredCandidateSchema = z.object({\n resourceId: z.string(),\n url: z.string(),\n title: z.string(),\n price: z.string(),\n});\nexport type StoredCandidate = z.infer<typeof StoredCandidateSchema>;\n\nconst StoredLookupSchema = z.object({\n lookupId: z.string(),\n at: z.string(),\n question: z.string(),\n decision: z.string(),\n candidates: z.array(StoredCandidateSchema),\n});\nexport type StoredLookup = z.infer<typeof StoredLookupSchema>;\n\nconst StoreSchema = z.object({\n schemaVersion: z.literal(1),\n lookups: z.array(StoredLookupSchema),\n});\n\nfunction storePath(dataDir: string): string {\n return join(dataDir, 'lookups.json');\n}\n\nexport async function loadLookups(dataDir: string): Promise<StoredLookup[]> {\n let raw: string;\n try {\n raw = await readFile(storePath(dataDir), 'utf8');\n } catch {\n return [];\n }\n let json: unknown;\n try {\n json = JSON.parse(raw);\n } catch {\n return [];\n }\n const parsed = StoreSchema.safeParse(json);\n return parsed.success ? parsed.data.lookups : [];\n}\n\n/** Prepend a lookup (newest first), cap to MAX_ENTRIES, persist under a lock so\n * concurrent lookups don't drop each other's entry. */\nexport async function recordLookup(dataDir: string, entry: StoredLookup): Promise<void> {\n await mkdir(dataDir, { recursive: true, mode: 0o700 });\n const lockPath = `${storePath(dataDir)}.lock`;\n await withFileLock(lockPath, async () => {\n const existing = await loadLookups(dataDir);\n const lookups = [entry, ...existing.filter((l) => l.lookupId !== entry.lookupId)].slice(\n 0,\n MAX_ENTRIES,\n );\n await writeFileAtomic(\n storePath(dataDir),\n `${JSON.stringify({ schemaVersion: 1, lookups }, null, 2)}\\n`,\n { mode: 0o644, dirMode: 0o700 },\n );\n });\n}\n\nexport async function latestLookup(dataDir: string): Promise<StoredLookup | null> {\n const lookups = await loadLookups(dataDir);\n return lookups[0] ?? null;\n}\n\n/** The stored candidate for a resourceId across recent lookups (newest first). */\nexport async function findStoredCandidate(\n dataDir: string,\n resourceId: string,\n): Promise<StoredCandidate | null> {\n for (const lookup of await loadLookups(dataDir)) {\n const hit = lookup.candidates.find((c) => c.resourceId === resourceId);\n if (hit) return hit;\n }\n return null;\n}\n\n/** The most recent lookupId that surfaced this resource (by id or url), for\n * purchase attribution (`X-Tenjin-Lookup-Id`). Null when no local lookup did. */\nexport async function findLookupForResource(\n dataDir: string,\n match: { resourceId?: string; url?: string },\n): Promise<string | null> {\n for (const lookup of await loadLookups(dataDir)) {\n const hit = lookup.candidates.some(\n (c) =>\n (match.resourceId !== undefined && c.resourceId === match.resourceId) ||\n (match.url !== undefined && c.url === match.url),\n );\n if (hit) return lookup.lookupId;\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,OAAO,gBAAgB;AAChC,SAAS,YAAY;AAarB,IAAM,cAAc;AAEpB,IAAM,wBAAwB,iBAAE,OAAO;AAAA,EACrC,YAAY,iBAAE,OAAO;AAAA,EACrB,KAAK,iBAAE,OAAO;AAAA,EACd,OAAO,iBAAE,OAAO;AAAA,EAChB,OAAO,iBAAE,OAAO;AAClB,CAAC;AAGD,IAAM,qBAAqB,iBAAE,OAAO;AAAA,EAClC,UAAU,iBAAE,OAAO;AAAA,EACnB,IAAI,iBAAE,OAAO;AAAA,EACb,UAAU,iBAAE,OAAO;AAAA,EACnB,UAAU,iBAAE,OAAO;AAAA,EACnB,YAAY,iBAAE,MAAM,qBAAqB;AAC3C,CAAC;AAGD,IAAM,cAAc,iBAAE,OAAO;AAAA,EAC3B,eAAe,iBAAE,QAAQ,CAAC;AAAA,EAC1B,SAAS,iBAAE,MAAM,kBAAkB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