tenjin-cli 0.1.0-alpha.2 → 0.1.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/NOTICE.md +54 -7
  2. package/README.md +161 -257
  3. package/dist/{_esm-FEASBWRP.js → _esm-CE7KNONL.js} +9 -10
  4. package/dist/{ccip-NQXCEK2U.js → ccip-7RMRLAGV.js} +4 -4
  5. package/dist/{ccip-XR5NE5QK.js → ccip-NLCSCHKI.js} +5 -5
  6. package/dist/chunk-2E6GVIRP.js +888 -0
  7. package/dist/chunk-2E6GVIRP.js.map +1 -0
  8. package/dist/chunk-2G2WLVHB.js +102 -0
  9. package/dist/chunk-2G2WLVHB.js.map +1 -0
  10. package/dist/chunk-2QYORQBF.js +55 -0
  11. package/dist/chunk-2QYORQBF.js.map +1 -0
  12. package/dist/chunk-3BS55ANY.js +245 -0
  13. package/dist/chunk-3BS55ANY.js.map +1 -0
  14. package/dist/chunk-3KKKB2AQ.js +40 -0
  15. package/dist/chunk-3KKKB2AQ.js.map +1 -0
  16. package/dist/chunk-4AS52HUG.js +165 -0
  17. package/dist/chunk-4AS52HUG.js.map +1 -0
  18. package/dist/chunk-4M5FBWT5.js +368 -0
  19. package/dist/chunk-4M5FBWT5.js.map +1 -0
  20. package/dist/chunk-5FYKPQNX.js +1784 -0
  21. package/dist/chunk-5FYKPQNX.js.map +1 -0
  22. package/dist/{chunk-ZMHYXMO6.js → chunk-5IEP5EGE.js} +3 -3
  23. package/dist/chunk-5KD5HRAJ.js +241 -0
  24. package/dist/chunk-5KD5HRAJ.js.map +1 -0
  25. package/dist/chunk-72UHZRG6.js +231 -0
  26. package/dist/chunk-72UHZRG6.js.map +1 -0
  27. package/dist/chunk-7ACHDNJA.js +155 -0
  28. package/dist/chunk-7ACHDNJA.js.map +1 -0
  29. package/dist/chunk-7QKHZQKW.js +1680 -0
  30. package/dist/chunk-7QKHZQKW.js.map +1 -0
  31. package/dist/chunk-A36LQPHV.js +29 -0
  32. package/dist/chunk-A36LQPHV.js.map +1 -0
  33. package/dist/{chunk-UGX7YPX2.js → chunk-AWQPGIR6.js} +7 -9
  34. package/dist/{chunk-UGX7YPX2.js.map → chunk-AWQPGIR6.js.map} +1 -1
  35. package/dist/{chunk-5CLSD5YN.js → chunk-BPMWXTFX.js} +2 -2
  36. package/dist/{chunk-XJIW7USF.js → chunk-BTX2QE2Y.js} +115 -11
  37. package/dist/chunk-BTX2QE2Y.js.map +1 -0
  38. package/dist/{chunk-OYMYCW7J.js → chunk-CCDOV45D.js} +588 -97
  39. package/dist/chunk-CCDOV45D.js.map +1 -0
  40. package/dist/chunk-CXUYCDPX.js +127 -0
  41. package/dist/chunk-CXUYCDPX.js.map +1 -0
  42. package/dist/{chunk-YALGASEU.js → chunk-EGELTSPU.js} +2 -2
  43. package/dist/chunk-HH3PDYIG.js +194 -0
  44. package/dist/chunk-HH3PDYIG.js.map +1 -0
  45. package/dist/{chunk-CYOF7ROH.js → chunk-HPWO4O6S.js} +3 -3
  46. package/dist/chunk-JLEF5WHM.js +132 -0
  47. package/dist/chunk-JLEF5WHM.js.map +1 -0
  48. package/dist/{chunk-QVX5MWJZ.js → chunk-JRGFKVAZ.js} +2 -2
  49. package/dist/{chunk-HIVZG55D.js → chunk-KG3D7FIF.js} +2 -2
  50. package/dist/chunk-LHHMV4GU.js +27 -0
  51. package/dist/chunk-LHHMV4GU.js.map +1 -0
  52. package/dist/chunk-LI44XLMB.js +242 -0
  53. package/dist/chunk-LI44XLMB.js.map +1 -0
  54. package/dist/chunk-LN2HISWU.js +172 -0
  55. package/dist/chunk-LN2HISWU.js.map +1 -0
  56. package/dist/{chunk-YBMMV4Y4.js → chunk-MEFB5KHA.js} +13 -5
  57. package/dist/chunk-MEFB5KHA.js.map +1 -0
  58. package/dist/{chunk-NCE5NSN6.js → chunk-N35E6CM2.js} +140 -10
  59. package/dist/chunk-N35E6CM2.js.map +1 -0
  60. package/dist/chunk-NSG5TVZQ.js +447 -0
  61. package/dist/chunk-NSG5TVZQ.js.map +1 -0
  62. package/dist/chunk-O2JYBOUO.js +47 -0
  63. package/dist/chunk-O2JYBOUO.js.map +1 -0
  64. package/dist/{chunk-N62ROTMC.js → chunk-P42QX3QF.js} +14 -10
  65. package/dist/chunk-P42QX3QF.js.map +1 -0
  66. package/dist/chunk-PO4HAXAW.js +10528 -0
  67. package/dist/chunk-PO4HAXAW.js.map +1 -0
  68. package/dist/{chunk-ZABPQJ3M.js → chunk-POUWHWID.js} +2 -2
  69. package/dist/{chunk-S3IGX57D.js → chunk-RGVOODF4.js} +7703 -7475
  70. package/dist/chunk-RGVOODF4.js.map +1 -0
  71. package/dist/chunk-RPR2C2JO.js +112 -0
  72. package/dist/chunk-RPR2C2JO.js.map +1 -0
  73. package/dist/chunk-S2NRVRPF.js +171 -0
  74. package/dist/chunk-S2NRVRPF.js.map +1 -0
  75. package/dist/chunk-TGLKKLQG.js +11 -0
  76. package/dist/chunk-TGLKKLQG.js.map +1 -0
  77. package/dist/{chunk-RRN3YTK7.js → chunk-TTNESUPQ.js} +3 -3
  78. package/dist/chunk-TU7XH3JJ.js +97 -0
  79. package/dist/chunk-TU7XH3JJ.js.map +1 -0
  80. package/dist/{chunk-HSDCI7OV.js → chunk-XZKD7DIF.js} +3 -3
  81. package/dist/{chunk-Z6MFJV5Z.js → chunk-YEBNE5NW.js} +851 -500
  82. package/dist/chunk-YEBNE5NW.js.map +1 -0
  83. package/dist/chunk-YREKMJPP.js +131 -0
  84. package/dist/chunk-YREKMJPP.js.map +1 -0
  85. package/dist/{cli-4NNBEQYH.js → cli-XJQYUOHI.js} +355 -217
  86. package/dist/cli-XJQYUOHI.js.map +1 -0
  87. package/dist/config-KMJLFPSI.js +39 -0
  88. package/dist/dist-3LOO6M4U.js +2842 -0
  89. package/dist/dist-3LOO6M4U.js.map +1 -0
  90. package/dist/doctor-KMN55D7U.js +444 -0
  91. package/dist/doctor-KMN55D7U.js.map +1 -0
  92. package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-THAVUGIJ.js} +5 -5
  93. package/dist/fund-LT6ZPGEQ.js +298 -0
  94. package/dist/fund-LT6ZPGEQ.js.map +1 -0
  95. package/dist/hook-command-U5XPEHAJ.js +1052 -0
  96. package/dist/hook-command-U5XPEHAJ.js.map +1 -0
  97. package/dist/index.js +11 -3
  98. package/dist/index.js.map +1 -1
  99. package/dist/install-MMNXJ5LM.js +61 -0
  100. package/dist/install-identity-B7FVIWML.js +27 -0
  101. package/dist/install-wallet-XMVUBCHS.js +107 -0
  102. package/dist/install-wallet-XMVUBCHS.js.map +1 -0
  103. package/dist/mcp-TUPRIPSI.js +10000 -0
  104. package/dist/mcp-TUPRIPSI.js.map +1 -0
  105. package/dist/paths-LRMWNTJP.js +51 -0
  106. package/dist/pay-XAWW3NV3.js +44 -0
  107. package/dist/redact-6W23GGJC.js +15 -0
  108. package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-ZZZT2CAX.js} +3 -3
  109. package/dist/secp256k1-ZZZT2CAX.js.map +1 -0
  110. package/dist/send-HESQYRKM.js +225 -0
  111. package/dist/send-HESQYRKM.js.map +1 -0
  112. package/dist/status-ANZPRZJJ.js +71 -0
  113. package/dist/status-ANZPRZJJ.js.map +1 -0
  114. package/dist/status-line-J3TUWVRQ.js +87 -0
  115. package/dist/status-line-J3TUWVRQ.js.map +1 -0
  116. package/dist/status-line-wiring-HSV7DXO5.js +29 -0
  117. package/dist/status-line-wiring-HSV7DXO5.js.map +1 -0
  118. package/dist/tenjin-daemon.mjs +20547 -0
  119. package/dist/tenjin-shim.mjs +251 -0
  120. package/dist/tenjin-vitest-reporter.mjs +49 -0
  121. package/dist/uninstall-GUU34YKP.js +165 -0
  122. package/dist/uninstall-GUU34YKP.js.map +1 -0
  123. package/dist/update-KO2NZRJ5.js +433 -0
  124. package/dist/update-KO2NZRJ5.js.map +1 -0
  125. package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-X2VY6CY3.js} +5 -5
  126. package/dist/viemAdapter-By13KInL-X2VY6CY3.js.map +1 -0
  127. package/dist/wallet-3URC5QPK.js +33 -0
  128. package/dist/wallet-3URC5QPK.js.map +1 -0
  129. package/dist/wallet-kdf-worker.mjs +980 -0
  130. package/docs/agent-permissions.md +139 -0
  131. package/docs/safety-model.md +70 -0
  132. package/package.json +14 -9
  133. package/LICENSE +0 -21
  134. package/dist/buy-U35DQ6XM.js +0 -1598
  135. package/dist/buy-U35DQ6XM.js.map +0 -1
  136. package/dist/candidate-RLYCQMF5.js +0 -127
  137. package/dist/candidate-RLYCQMF5.js.map +0 -1
  138. package/dist/chunk-27ONARHV.js +0 -171
  139. package/dist/chunk-27ONARHV.js.map +0 -1
  140. package/dist/chunk-3OV7E5G5.js +0 -18
  141. package/dist/chunk-3OV7E5G5.js.map +0 -1
  142. package/dist/chunk-7KUW4MJD.js +0 -59
  143. package/dist/chunk-7KUW4MJD.js.map +0 -1
  144. package/dist/chunk-7PHSZKQS.js +0 -333
  145. package/dist/chunk-7PHSZKQS.js.map +0 -1
  146. package/dist/chunk-IYLHQMT5.js +0 -211
  147. package/dist/chunk-IYLHQMT5.js.map +0 -1
  148. package/dist/chunk-JPHG2JW3.js +0 -96
  149. package/dist/chunk-JPHG2JW3.js.map +0 -1
  150. package/dist/chunk-MUBUQVC3.js +0 -67
  151. package/dist/chunk-MUBUQVC3.js.map +0 -1
  152. package/dist/chunk-N62ROTMC.js.map +0 -1
  153. package/dist/chunk-NCE5NSN6.js.map +0 -1
  154. package/dist/chunk-OYMYCW7J.js.map +0 -1
  155. package/dist/chunk-QNP7H47L.js +0 -152
  156. package/dist/chunk-QNP7H47L.js.map +0 -1
  157. package/dist/chunk-RY4XKNV3.js +0 -140
  158. package/dist/chunk-RY4XKNV3.js.map +0 -1
  159. package/dist/chunk-S3IGX57D.js.map +0 -1
  160. package/dist/chunk-TFGSOPWR.js +0 -261
  161. package/dist/chunk-TFGSOPWR.js.map +0 -1
  162. package/dist/chunk-TLCMMYLY.js +0 -126
  163. package/dist/chunk-TLCMMYLY.js.map +0 -1
  164. package/dist/chunk-UO22YNY4.js +0 -69
  165. package/dist/chunk-UO22YNY4.js.map +0 -1
  166. package/dist/chunk-UPIEAMGH.js +0 -160
  167. package/dist/chunk-UPIEAMGH.js.map +0 -1
  168. package/dist/chunk-XJIW7USF.js.map +0 -1
  169. package/dist/chunk-YBMMV4Y4.js.map +0 -1
  170. package/dist/chunk-YIYQ2ZNT.js +0 -286
  171. package/dist/chunk-YIYQ2ZNT.js.map +0 -1
  172. package/dist/chunk-YN5SHIXQ.js +0 -126
  173. package/dist/chunk-YN5SHIXQ.js.map +0 -1
  174. package/dist/chunk-Z52RA3NC.js +0 -137
  175. package/dist/chunk-Z52RA3NC.js.map +0 -1
  176. package/dist/chunk-Z6MFJV5Z.js.map +0 -1
  177. package/dist/cli-4NNBEQYH.js.map +0 -1
  178. package/dist/config-2VSXWWHK.js +0 -21
  179. package/dist/doctor-JJPNIBYH.js +0 -20
  180. package/dist/inspect-JGYJWFDP.js +0 -96
  181. package/dist/inspect-JGYJWFDP.js.map +0 -1
  182. package/dist/install-ZQRMSRGW.js +0 -378
  183. package/dist/install-ZQRMSRGW.js.map +0 -1
  184. package/dist/lookup-WYVTOMVY.js +0 -113
  185. package/dist/lookup-WYVTOMVY.js.map +0 -1
  186. package/dist/outcome-HKKT6QIA.js +0 -66
  187. package/dist/outcome-HKKT6QIA.js.map +0 -1
  188. package/dist/publish-D76B3MBK.js +0 -1480
  189. package/dist/publish-D76B3MBK.js.map +0 -1
  190. package/dist/usdc-JIAJW4SV.js +0 -22
  191. package/dist/wallet-6QKS6UHW.js +0 -179
  192. package/dist/wallet-6QKS6UHW.js.map +0 -1
  193. package/dist/wallet-PA54CRBL.js +0 -30
  194. package/skills/tenjin/SKILL.md +0 -199
  195. package/skills/tenjin-publish/SKILL.md +0 -96
  196. package/skills/tenjin-search/SKILL.md +0 -122
  197. /package/dist/{_esm-FEASBWRP.js.map → _esm-CE7KNONL.js.map} +0 -0
  198. /package/dist/{ccip-NQXCEK2U.js.map → ccip-7RMRLAGV.js.map} +0 -0
  199. /package/dist/{ccip-XR5NE5QK.js.map → ccip-NLCSCHKI.js.map} +0 -0
  200. /package/dist/{chunk-ZMHYXMO6.js.map → chunk-5IEP5EGE.js.map} +0 -0
  201. /package/dist/{chunk-5CLSD5YN.js.map → chunk-BPMWXTFX.js.map} +0 -0
  202. /package/dist/{chunk-YALGASEU.js.map → chunk-EGELTSPU.js.map} +0 -0
  203. /package/dist/{chunk-CYOF7ROH.js.map → chunk-HPWO4O6S.js.map} +0 -0
  204. /package/dist/{chunk-QVX5MWJZ.js.map → chunk-JRGFKVAZ.js.map} +0 -0
  205. /package/dist/{chunk-HIVZG55D.js.map → chunk-KG3D7FIF.js.map} +0 -0
  206. /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POUWHWID.js.map} +0 -0
  207. /package/dist/{chunk-RRN3YTK7.js.map → chunk-TTNESUPQ.js.map} +0 -0
  208. /package/dist/{chunk-HSDCI7OV.js.map → chunk-XZKD7DIF.js.map} +0 -0
  209. /package/dist/{config-2VSXWWHK.js.map → config-KMJLFPSI.js.map} +0 -0
  210. /package/dist/{doctor-JJPNIBYH.js.map → ethersCompat-Df4a6QIZ-THAVUGIJ.js.map} +0 -0
  211. /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → install-MMNXJ5LM.js.map} +0 -0
  212. /package/dist/{secp256k1-N3ZHU7LB.js.map → install-identity-B7FVIWML.js.map} +0 -0
  213. /package/dist/{usdc-JIAJW4SV.js.map → paths-LRMWNTJP.js.map} +0 -0
  214. /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → pay-XAWW3NV3.js.map} +0 -0
  215. /package/dist/{wallet-PA54CRBL.js.map → redact-6W23GGJC.js.map} +0 -0
@@ -1,4 +1,11 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ CliError,
4
+ HARNESSES
5
+ } from "./chunk-JLEF5WHM.js";
6
+ import {
7
+ configPath
8
+ } from "./chunk-TU7XH3JJ.js";
2
9
  import {
3
10
  __export
4
11
  } from "./chunk-ZXTAQYNA.js";
@@ -509,7 +516,7 @@ __export(core_exports2, {
509
516
  parse: () => parse,
510
517
  parseAsync: () => parseAsync,
511
518
  prettifyError: () => prettifyError,
512
- process: () => process2,
519
+ process: () => process,
513
520
  regexes: () => regexes_exports,
514
521
  registry: () => registry,
515
522
  safeDecode: () => safeDecode,
@@ -11434,7 +11441,7 @@ function initializeContext(params) {
11434
11441
  external: params?.external ?? void 0
11435
11442
  };
11436
11443
  }
11437
- function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
11444
+ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
11438
11445
  var _a3;
11439
11446
  const def = schema._zod.def;
11440
11447
  const seen = ctx.seen.get(schema);
@@ -11471,7 +11478,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
11471
11478
  if (parent) {
11472
11479
  if (!result.ref)
11473
11480
  result.ref = parent;
11474
- process2(parent, ctx, params);
11481
+ process(parent, ctx, params);
11475
11482
  ctx.seen.get(parent).isParent = true;
11476
11483
  }
11477
11484
  }
@@ -11759,14 +11766,14 @@ function isTransforming(_schema, _ctx) {
11759
11766
  }
11760
11767
  var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
11761
11768
  const ctx = initializeContext({ ...params, processors });
11762
- process2(schema, ctx);
11769
+ process(schema, ctx);
11763
11770
  extractDefs(ctx, schema);
11764
11771
  return finalize(ctx, schema);
11765
11772
  };
11766
11773
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
11767
11774
  const { libraryOptions, target } = params ?? {};
11768
11775
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
11769
- process2(schema, ctx);
11776
+ process(schema, ctx);
11770
11777
  extractDefs(ctx, schema);
11771
11778
  return finalize(ctx, schema);
11772
11779
  };
@@ -12012,7 +12019,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
12012
12019
  if (typeof maximum === "number")
12013
12020
  json2.maxItems = maximum;
12014
12021
  json2.type = "array";
12015
- json2.items = process2(def.element, ctx, {
12022
+ json2.items = process(def.element, ctx, {
12016
12023
  ...params,
12017
12024
  path: [...params.path, "items"]
12018
12025
  });
@@ -12024,7 +12031,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
12024
12031
  json2.properties = {};
12025
12032
  const shape = def.shape;
12026
12033
  for (const key in shape) {
12027
- json2.properties[key] = process2(shape[key], ctx, {
12034
+ json2.properties[key] = process(shape[key], ctx, {
12028
12035
  ...params,
12029
12036
  path: [...params.path, "properties", key]
12030
12037
  });
@@ -12047,7 +12054,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
12047
12054
  if (ctx.io === "output")
12048
12055
  json2.additionalProperties = false;
12049
12056
  } else if (def.catchall) {
12050
- json2.additionalProperties = process2(def.catchall, ctx, {
12057
+ json2.additionalProperties = process(def.catchall, ctx, {
12051
12058
  ...params,
12052
12059
  path: [...params.path, "additionalProperties"]
12053
12060
  });
@@ -12056,7 +12063,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
12056
12063
  var unionProcessor = (schema, ctx, json2, params) => {
12057
12064
  const def = schema._zod.def;
12058
12065
  const isExclusive = def.inclusive === false;
12059
- const options = def.options.map((x, i) => process2(x, ctx, {
12066
+ const options = def.options.map((x, i) => process(x, ctx, {
12060
12067
  ...params,
12061
12068
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
12062
12069
  }));
@@ -12068,11 +12075,11 @@ var unionProcessor = (schema, ctx, json2, params) => {
12068
12075
  };
12069
12076
  var intersectionProcessor = (schema, ctx, json2, params) => {
12070
12077
  const def = schema._zod.def;
12071
- const a = process2(def.left, ctx, {
12078
+ const a = process(def.left, ctx, {
12072
12079
  ...params,
12073
12080
  path: [...params.path, "allOf", 0]
12074
12081
  });
12075
- const b = process2(def.right, ctx, {
12082
+ const b = process(def.right, ctx, {
12076
12083
  ...params,
12077
12084
  path: [...params.path, "allOf", 1]
12078
12085
  });
@@ -12089,11 +12096,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
12089
12096
  json2.type = "array";
12090
12097
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
12091
12098
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
12092
- const prefixItems = def.items.map((x, i) => process2(x, ctx, {
12099
+ const prefixItems = def.items.map((x, i) => process(x, ctx, {
12093
12100
  ...params,
12094
12101
  path: [...params.path, prefixPath, i]
12095
12102
  }));
12096
- const rest = def.rest ? process2(def.rest, ctx, {
12103
+ const rest = def.rest ? process(def.rest, ctx, {
12097
12104
  ...params,
12098
12105
  path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
12099
12106
  }) : null;
@@ -12133,7 +12140,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
12133
12140
  const keyBag = keyType._zod.bag;
12134
12141
  const patterns = keyBag?.patterns;
12135
12142
  if (def.mode === "loose" && patterns && patterns.size > 0) {
12136
- const valueSchema = process2(def.valueType, ctx, {
12143
+ const valueSchema = process(def.valueType, ctx, {
12137
12144
  ...params,
12138
12145
  path: [...params.path, "patternProperties", "*"]
12139
12146
  });
@@ -12143,12 +12150,12 @@ var recordProcessor = (schema, ctx, _json, params) => {
12143
12150
  }
12144
12151
  } else {
12145
12152
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
12146
- json2.propertyNames = process2(def.keyType, ctx, {
12153
+ json2.propertyNames = process(def.keyType, ctx, {
12147
12154
  ...params,
12148
12155
  path: [...params.path, "propertyNames"]
12149
12156
  });
12150
12157
  }
12151
- json2.additionalProperties = process2(def.valueType, ctx, {
12158
+ json2.additionalProperties = process(def.valueType, ctx, {
12152
12159
  ...params,
12153
12160
  path: [...params.path, "additionalProperties"]
12154
12161
  });
@@ -12163,7 +12170,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
12163
12170
  };
12164
12171
  var nullableProcessor = (schema, ctx, json2, params) => {
12165
12172
  const def = schema._zod.def;
12166
- const inner = process2(def.innerType, ctx, params);
12173
+ const inner = process(def.innerType, ctx, params);
12167
12174
  const seen = ctx.seen.get(schema);
12168
12175
  if (ctx.target === "openapi-3.0") {
12169
12176
  seen.ref = def.innerType;
@@ -12174,20 +12181,20 @@ var nullableProcessor = (schema, ctx, json2, params) => {
12174
12181
  };
12175
12182
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
12176
12183
  const def = schema._zod.def;
12177
- process2(def.innerType, ctx, params);
12184
+ process(def.innerType, ctx, params);
12178
12185
  const seen = ctx.seen.get(schema);
12179
12186
  seen.ref = def.innerType;
12180
12187
  };
12181
12188
  var defaultProcessor = (schema, ctx, json2, params) => {
12182
12189
  const def = schema._zod.def;
12183
- process2(def.innerType, ctx, params);
12190
+ process(def.innerType, ctx, params);
12184
12191
  const seen = ctx.seen.get(schema);
12185
12192
  seen.ref = def.innerType;
12186
12193
  json2.default = JSON.parse(JSON.stringify(def.defaultValue));
12187
12194
  };
12188
12195
  var prefaultProcessor = (schema, ctx, json2, params) => {
12189
12196
  const def = schema._zod.def;
12190
- process2(def.innerType, ctx, params);
12197
+ process(def.innerType, ctx, params);
12191
12198
  const seen = ctx.seen.get(schema);
12192
12199
  seen.ref = def.innerType;
12193
12200
  if (ctx.io === "input")
@@ -12195,7 +12202,7 @@ var prefaultProcessor = (schema, ctx, json2, params) => {
12195
12202
  };
12196
12203
  var catchProcessor = (schema, ctx, json2, params) => {
12197
12204
  const def = schema._zod.def;
12198
- process2(def.innerType, ctx, params);
12205
+ process(def.innerType, ctx, params);
12199
12206
  const seen = ctx.seen.get(schema);
12200
12207
  seen.ref = def.innerType;
12201
12208
  let catchValue;
@@ -12210,32 +12217,32 @@ var pipeProcessor = (schema, ctx, _json, params) => {
12210
12217
  const def = schema._zod.def;
12211
12218
  const inIsTransform = def.in._zod.traits.has("$ZodTransform");
12212
12219
  const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
12213
- process2(innerType, ctx, params);
12220
+ process(innerType, ctx, params);
12214
12221
  const seen = ctx.seen.get(schema);
12215
12222
  seen.ref = innerType;
12216
12223
  };
12217
12224
  var readonlyProcessor = (schema, ctx, json2, params) => {
12218
12225
  const def = schema._zod.def;
12219
- process2(def.innerType, ctx, params);
12226
+ process(def.innerType, ctx, params);
12220
12227
  const seen = ctx.seen.get(schema);
12221
12228
  seen.ref = def.innerType;
12222
12229
  json2.readOnly = true;
12223
12230
  };
12224
12231
  var promiseProcessor = (schema, ctx, _json, params) => {
12225
12232
  const def = schema._zod.def;
12226
- process2(def.innerType, ctx, params);
12233
+ process(def.innerType, ctx, params);
12227
12234
  const seen = ctx.seen.get(schema);
12228
12235
  seen.ref = def.innerType;
12229
12236
  };
12230
12237
  var optionalProcessor = (schema, ctx, _json, params) => {
12231
12238
  const def = schema._zod.def;
12232
- process2(def.innerType, ctx, params);
12239
+ process(def.innerType, ctx, params);
12233
12240
  const seen = ctx.seen.get(schema);
12234
12241
  seen.ref = def.innerType;
12235
12242
  };
12236
12243
  var lazyProcessor = (schema, ctx, _json, params) => {
12237
12244
  const innerType = schema._zod.innerType;
12238
- process2(innerType, ctx, params);
12245
+ process(innerType, ctx, params);
12239
12246
  const seen = ctx.seen.get(schema);
12240
12247
  seen.ref = innerType;
12241
12248
  };
@@ -12287,7 +12294,7 @@ function toJSONSchema(input, params) {
12287
12294
  const defs = {};
12288
12295
  for (const entry of registry2._idmap.entries()) {
12289
12296
  const [_, schema] = entry;
12290
- process2(schema, ctx2);
12297
+ process(schema, ctx2);
12291
12298
  }
12292
12299
  const schemas = {};
12293
12300
  const external = {
@@ -12310,7 +12317,7 @@ function toJSONSchema(input, params) {
12310
12317
  return { schemas };
12311
12318
  }
12312
12319
  const ctx = initializeContext({ ...params, processors: allProcessors });
12313
- process2(input, ctx);
12320
+ process(input, ctx);
12314
12321
  extractDefs(ctx, input);
12315
12322
  return finalize(ctx, input);
12316
12323
  }
@@ -12368,7 +12375,7 @@ var JSONSchemaGenerator = class {
12368
12375
  * This must be called before emit().
12369
12376
  */
12370
12377
  process(schema, _params = { path: [], schemaPath: [] }) {
12371
- return process2(schema, this.ctx, _params);
12378
+ return process(schema, this.ctx, _params);
12372
12379
  }
12373
12380
  /**
12374
12381
  * Emit the final JSON Schema after processing.
@@ -14517,80 +14524,564 @@ function date4(params) {
14517
14524
  // node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
14518
14525
  config(en_default());
14519
14526
 
14520
- // src/lib/errors.ts
14521
- var EXIT_BY_CODE = {
14522
- NODE_UNSUPPORTED: 1,
14523
- USAGE: 2,
14524
- CONFIG_INVALID: 2,
14525
- WALLET_EXISTS: 3,
14526
- WALLET_MISSING: 1,
14527
- WALLET_INVALID_KEY: 1,
14528
- PROVIDER_ERROR: 1,
14529
- RPC_ERROR: 1,
14530
- API_UNREACHABLE: 1,
14531
- CONTRACT_MISMATCH: 1,
14532
- REFUSED: 3,
14533
- NETWORK_ERROR: 1,
14534
- INTERNAL: 1,
14535
- NOT_IMPLEMENTED: 1,
14536
- POLICY_REFUSED: 3,
14537
- PAYMENT_FAILED: 4,
14538
- RESOURCE_NOT_FOUND: 1,
14539
- LOOKUP_NOT_FOUND: 1,
14540
- RATE_LIMITED: 1,
14541
- // A publish awaiting confirmation or hard-blocked is understood-but-refused (3),
14542
- // the same posture as POLICY_REFUSED; a write that failed after approval is a
14543
- // settlement-class failure (4), like PAYMENT_FAILED.
14544
- NEEDS_CONFIRMATION: 3,
14545
- PUBLISH_BLOCKED: 3,
14546
- PUBLISH_FAILED: 4
14547
- };
14548
- function exitCodeFor(code) {
14549
- return EXIT_BY_CODE[code];
14550
- }
14551
- var CliError = class extends Error {
14552
- code;
14553
- exitCode;
14554
- fix;
14555
- details;
14556
- constructor(code, message, opts = {}) {
14557
- super(message, opts.cause !== void 0 ? { cause: opts.cause } : void 0);
14558
- this.name = "CliError";
14559
- this.code = code;
14560
- this.exitCode = opts.exitCode ?? exitCodeFor(code);
14561
- this.fix = opts.fix;
14562
- this.details = opts.details;
14563
- }
14564
- };
14527
+ // src/lib/production-origin.ts
14528
+ var PRODUCTION_ORIGIN = "https://tenjin.blog";
14529
+ var PRODUCTION_HOST = new URL(PRODUCTION_ORIGIN).host;
14530
+ var KNOWN_DEPLOYMENT_ORIGINS = /* @__PURE__ */ new Set([
14531
+ PRODUCTION_ORIGIN,
14532
+ "https://tenjin.sh"
14533
+ ]);
14534
+ function isSameDeployment(a, b) {
14535
+ if (a === b) return true;
14536
+ return KNOWN_DEPLOYMENT_ORIGINS.has(a) && KNOWN_DEPLOYMENT_ORIGINS.has(b);
14537
+ }
14538
+ function knownDeploymentOrigins() {
14539
+ return [...KNOWN_DEPLOYMENT_ORIGINS];
14540
+ }
14565
14541
 
14566
- // src/lib/paths.ts
14567
- import { homedir } from "os";
14568
- import { join } from "path";
14569
- function dataDir(env = process.env) {
14570
- const override = env.TENJIN_DATA_DIR;
14571
- if (override !== void 0 && override.length > 0) return override;
14572
- return join(homedir(), ".tenjin");
14542
+ // src/lib/config.ts
14543
+ import { readFile } from "node:fs/promises";
14544
+ var atomicString = external_exports.string().regex(/^\d+$/, "expected an atomic USDC integer string");
14545
+ var PublishModeSchema = external_exports.enum(["review", "auto", "full-auto"]);
14546
+ var AckServerWarningsSchema = external_exports.enum(["mode", "on", "off"]);
14547
+ function parseAckServerWarnings(value, keyName) {
14548
+ const parsed = AckServerWarningsSchema.safeParse(value);
14549
+ if (parsed.success) return parsed.data;
14550
+ throw new CliError("USAGE", `Invalid ${keyName} ${JSON.stringify(value)}`, {
14551
+ fix: 'Use "mode", "on", or "off".'
14552
+ });
14553
+ }
14554
+ var PublishConfigSchema = external_exports.object({
14555
+ mode: PublishModeSchema,
14556
+ defaultPrice: atomicString,
14557
+ ackServerWarnings: AckServerWarningsSchema
14558
+ });
14559
+ var HOOK_ARMS = [
14560
+ "prompt",
14561
+ "web-search",
14562
+ "web-fetch",
14563
+ "subagent",
14564
+ "failure",
14565
+ "publish",
14566
+ "primer"
14567
+ ];
14568
+ var HooksConfigSchema = external_exports.object({
14569
+ prompt: external_exports.boolean(),
14570
+ "web-search": external_exports.boolean(),
14571
+ "web-fetch": external_exports.boolean(),
14572
+ subagent: external_exports.boolean(),
14573
+ failure: external_exports.boolean(),
14574
+ publish: external_exports.boolean(),
14575
+ primer: external_exports.boolean()
14576
+ });
14577
+ var ROUTER_CONTEXTS = ["session", "turn"];
14578
+ var RouterLayerSchema = external_exports.object({
14579
+ enabled: external_exports.boolean().optional(),
14580
+ context: external_exports.enum(ROUTER_CONTEXTS).optional()
14581
+ });
14582
+ var RouterConfigSchema = RouterLayerSchema.required();
14583
+ function parseRouterLayer(json2, path) {
14584
+ if (json2 === null || typeof json2 !== "object" || Array.isArray(json2)) {
14585
+ throw new CliError("CONFIG_INVALID", `Config at ${path} is not a JSON object`, {
14586
+ fix: `Fix ${path}, or delete it.`
14587
+ });
14588
+ }
14589
+ const parsed = RouterLayerSchema.safeParse(json2.router ?? {});
14590
+ if (!parsed.success) {
14591
+ throw new CliError("CONFIG_INVALID", `Config at ${path} has an invalid router block`, {
14592
+ fix: `Use router.enabled true|false and router.context "session"|"turn" in ${path}, or delete it.`,
14593
+ details: parsed.error.issues
14594
+ });
14595
+ }
14596
+ const { enabled, context } = parsed.data;
14597
+ return {
14598
+ ...enabled !== void 0 ? { enabled } : {},
14599
+ ...context !== void 0 ? { context } : {}
14600
+ };
14573
14601
  }
14574
- function configPath(dir = dataDir()) {
14575
- return join(dir, "config.json");
14602
+ var UpdateModeSchema = external_exports.enum(["nudge", "off"]);
14603
+ var positiveInt = external_exports.number().int().positive();
14604
+ var LoopConfigSchema = external_exports.object({
14605
+ human_wait_ms: positiveInt,
14606
+ tool_wait_ms: positiveInt,
14607
+ idle_exit_min: positiveInt,
14608
+ port: external_exports.number().int().min(0).max(65535).nullable()
14609
+ });
14610
+ var PublicFallbackSchema = external_exports.enum(["on", "off"]);
14611
+ var TeamConfigSchema = external_exports.object({ publicFallback: PublicFallbackSchema });
14612
+ function parsePublicFallbackFlag(value, keyName) {
14613
+ const parsed = PublicFallbackSchema.safeParse(value);
14614
+ if (parsed.success) return parsed.data;
14615
+ throw new CliError("USAGE", `Invalid ${keyName}: ${JSON.stringify(value)}`, {
14616
+ fix: 'Use "on" or "off".'
14617
+ });
14576
14618
  }
14577
- function walletPath(dir = dataDir()) {
14578
- return join(dir, "wallet.json");
14619
+ function parseLoopValue(key, value) {
14620
+ const field = key.slice("loop.".length);
14621
+ if (field === "port" && (value === "null" || value === "auto")) return null;
14622
+ const n = /^\d+$/.test(value.trim()) ? Number(value.trim()) : NaN;
14623
+ const parsed = LoopConfigSchema.shape[field].safeParse(n);
14624
+ if (parsed.success) return parsed.data;
14625
+ throw new CliError("USAGE", `Invalid ${key}: ${JSON.stringify(value)}`, {
14626
+ fix: field === "port" ? 'Use an integer from 0 to 65535, or "null" to derive one from the data dir.' : "Use a positive integer."
14627
+ });
14579
14628
  }
14580
- function sessionPath(dir = dataDir()) {
14581
- return join(dir, "session.json");
14629
+ var UpdateConfigSchema = external_exports.object({
14630
+ mode: UpdateModeSchema
14631
+ });
14632
+ function parseUpdateModeFlag(value, flagName) {
14633
+ const parsed = UpdateModeSchema.safeParse(value);
14634
+ if (parsed.success) return parsed.data;
14635
+ throw new CliError("USAGE", `Invalid ${flagName} ${JSON.stringify(value)}`, {
14636
+ fix: 'Use "nudge" or "off".'
14637
+ });
14582
14638
  }
14583
- function passphraseBlobPath(dir = dataDir()) {
14584
- return join(dir, "passphrase.dpapi");
14639
+ var InstallConfigSchema = external_exports.object({
14640
+ harness: external_exports.array(external_exports.enum(HARNESSES)),
14641
+ /**
14642
+ * The EXACT rule strings still pending the last time an install explicitly
14643
+ * declined the free-verb allowlist (`--no-grant`), so `--refresh`
14644
+ * can subtract them from what it would
14645
+ * otherwise report as pending instead of recomputing from the settings file
14646
+ * and nagging about a settled "no" on every refresh (tenjin-agent#234).
14647
+ *
14648
+ * A LIST, NOT A FLAG, on purpose: a boolean has no way to say "these were
14649
+ * declined" without also silencing every rule a LATER version might add, so a
14650
+ * genuinely new suggestion would never be reported again either. Per-rule
14651
+ * suppression means only the rules that were actually offered and refused
14652
+ * stay quiet; a new one still surfaces.
14653
+ *
14654
+ * Cleared back to `[]` the next time an install actually wires the allowlist,
14655
+ * or finds it already fully satisfied, so a later legitimate grant (manual or
14656
+ * otherwise) is never shadowed by a stale decline.
14657
+ */
14658
+ grantDeclined: external_exports.array(external_exports.string()),
14659
+ /**
14660
+ * Absolute directories a `tenjin install --project` wired, so `tenjin update`
14661
+ * can refresh them. It spawns `install --refresh` from the HOME directory,
14662
+ * which is the one place a project install can never be found by looking
14663
+ * around: without this list a project-only machine refreshed nothing and
14664
+ * reported success while its hooks stayed on the old build.
14665
+ *
14666
+ * A LIST, because one machine can wire several projects, and entries are
14667
+ * dropped by `tenjin uninstall --project` and by any refresh that finds the
14668
+ * project's settings file no longer carries our entries.
14669
+ */
14670
+ routerProjects: external_exports.array(external_exports.string())
14671
+ });
14672
+ var STORED_INSTALL_HARNESSES = [...HARNESSES, "shared"];
14673
+ function resolveInstallHarness(value) {
14674
+ const normalized = new Set(value?.map((harness) => harness === "shared" ? "codex" : harness));
14675
+ return HARNESSES.filter((harness) => normalized.has(harness));
14676
+ }
14677
+ var RawInstallHarnessSchema = external_exports.array(external_exports.enum(STORED_INSTALL_HARNESSES)).transform(resolveInstallHarness);
14678
+ var ConfigSchema = external_exports.object({
14679
+ maxAutoSpend: atomicString,
14680
+ sessionBudget: external_exports.union([atomicString, external_exports.literal("none")]),
14681
+ /**
14682
+ * Hard per-send cap for `tenjin wallet send`, NOT satisfiable by --yes or a prompt
14683
+ * (the spend-policy posture): an atomic amount caps each send, "0" disables
14684
+ * the verb entirely, and "none" = explicitly uncapped (send exists to drain
14685
+ * the wallet, but uncapped is an opt-in, never a default). The key has NO
14686
+ * usable default: absent from config.json, `tenjin wallet send` refuses until it is
14687
+ * set (see resolveSendMaxAmount). Client-enforced like every spend key (see
14688
+ * the note above).
14689
+ */
14690
+ sendMaxAmount: external_exports.union([external_exports.literal("none"), atomicString]),
14691
+ allowlistCreators: external_exports.array(external_exports.string()),
14692
+ baseUrl: external_exports.url(),
14693
+ /**
14694
+ * The PUBLIC marketplace, consume-only, and the second shelf a team-mode
14695
+ * lookup falls through to. Distinct from `baseUrl` because in team mode
14696
+ * `baseUrl` is the team's own deployment: `publish`, `read` and the first leg
14697
+ * of every search go there, and this is the shelf that still gets asked when
14698
+ * the team's own has nothing. In public mode the two are the same origin and
14699
+ * nothing falls through.
14700
+ */
14701
+ publicShelfUrl: external_exports.url(),
14702
+ /**
14703
+ * The team shelf's Vercel "Protection Bypass for Automation" secret, and the
14704
+ * ONE key that decides which mode this CLI is in: empty (the default) is
14705
+ * public mode, byte-for-byte what it always did; non-empty is team mode.
14706
+ *
14707
+ * It is a DOOR KEY, not a credential of the operator's: it gets a request past
14708
+ * Deployment Protection on the team's preview deployment and authenticates
14709
+ * nobody. Stored in plain config.json alongside everything else for exactly
14710
+ * that reason — anything that can read this file can already read the wallet's
14711
+ * keystore path and rewrite `baseUrl`. It is redacted from `config get` and
14712
+ * `config list` all the same, because those outputs are pasted into issues.
14713
+ *
14714
+ * Sent ONLY to `baseUrl`'s origin; see lib/http.ts's `bypass` option, which
14715
+ * derives that from the request URL rather than from the caller's intent.
14716
+ */
14717
+ shelfBypassSecret: external_exports.string(),
14718
+ rpcUrl: external_exports.url(),
14719
+ /**
14720
+ * Evaluation-cohort opt-in (spec 09 §3): when true, search sends
14721
+ * X-Tenjin-Eval-Cohort: 1 and the server stores the generalized question for
14722
+ * 90 days. Off by default; no query text is retained server-side without it.
14723
+ */
14724
+ evalCohort: external_exports.boolean(),
14725
+ /** x402 discovery registries (facilitator base URLs) `discover` queries and
14726
+ * the Bazaar pay lane verifies against. */
14727
+ bazaarRegistries: external_exports.array(external_exports.url()),
14728
+ publish: PublishConfigSchema,
14729
+ install: InstallConfigSchema,
14730
+ hooks: HooksConfigSchema,
14731
+ update: UpdateConfigSchema,
14732
+ loop: LoopConfigSchema,
14733
+ team: TeamConfigSchema,
14734
+ router: RouterConfigSchema
14735
+ });
14736
+ var RawInstallConfigSchema = InstallConfigSchema.partial().extend({
14737
+ harness: RawInstallHarnessSchema.optional(),
14738
+ grantDeclined: external_exports.array(external_exports.string()).optional()
14739
+ }).passthrough();
14740
+ var RawConfigSchema = ConfigSchema.partial().extend({
14741
+ publish: PublishConfigSchema.partial().passthrough().optional(),
14742
+ install: RawInstallConfigSchema.optional(),
14743
+ hooks: HooksConfigSchema.partial().passthrough().optional(),
14744
+ update: UpdateConfigSchema.partial().passthrough().optional(),
14745
+ loop: LoopConfigSchema.partial().passthrough().optional(),
14746
+ team: TeamConfigSchema.partial().passthrough().optional(),
14747
+ router: RouterLayerSchema.passthrough().optional()
14748
+ }).passthrough();
14749
+ function resolveGrantDeclined(value) {
14750
+ return value ?? [];
14751
+ }
14752
+ var SEND_MAX_UNSET = "unset";
14753
+ var DEFAULT_BAZAAR_REGISTRIES = [
14754
+ "https://api.cdp.coinbase.com/platform/v2/x402",
14755
+ "https://facilitator.ultravioletadao.xyz",
14756
+ "https://facilitator.payai.network"
14757
+ ];
14758
+ var CONFIG_DEFAULTS = {
14759
+ maxAutoSpend: "0",
14760
+ sessionBudget: "5000000",
14761
+ // A type placeholder only, never honored: Config requires every key (and
14762
+ // CONFIG_KEYS derives from these). resolveSendMaxAmount never reads it — an
14763
+ // absent key resolves to SEND_MAX_UNSET and `tenjin wallet send` refuses until the
14764
+ // cap is set. '0' (send disabled) rather than 'none' (uncapped) so that if a
14765
+ // future caller ever DOES read the cap through loadConfig/fileOrDefault, the
14766
+ // leak fails closed instead of silently running uncapped.
14767
+ sendMaxAmount: "0",
14768
+ allowlistCreators: [],
14769
+ baseUrl: PRODUCTION_ORIGIN,
14770
+ publicShelfUrl: PRODUCTION_ORIGIN,
14771
+ // Empty = public mode. Setting it is the whole of "turn on team mode".
14772
+ shelfBypassSecret: "",
14773
+ rpcUrl: "https://mainnet.base.org",
14774
+ evalCohort: false,
14775
+ bazaarRegistries: DEFAULT_BAZAAR_REGISTRIES,
14776
+ publish: { mode: "review", defaultPrice: "100000", ackServerWarnings: "mode" },
14777
+ install: { harness: [], grantDeclined: [], routerProjects: [] },
14778
+ // Every hook is on out of the box: a vanilla install turns the whole loop on,
14779
+ // and the disclosure and the undo ride the install output. `false` leaves the
14780
+ // registered entries inert without touching settings.json, so any of these is
14781
+ // one `config set` away in either direction.
14782
+ hooks: {
14783
+ prompt: true,
14784
+ "web-search": true,
14785
+ "web-fetch": true,
14786
+ subagent: true,
14787
+ failure: true,
14788
+ publish: true,
14789
+ primer: true
14790
+ },
14791
+ update: { mode: "nudge" },
14792
+ loop: {
14793
+ human_wait_ms: 2500,
14794
+ tool_wait_ms: 4e3,
14795
+ idle_exit_min: 30,
14796
+ port: null
14797
+ },
14798
+ team: { publicFallback: "on" },
14799
+ router: { enabled: true, context: "session" }
14800
+ };
14801
+ var NESTED_CONFIG_KEYS = /* @__PURE__ */ new Set([
14802
+ "publish",
14803
+ "install",
14804
+ "hooks",
14805
+ "update",
14806
+ "loop",
14807
+ "team",
14808
+ "router"
14809
+ ]);
14810
+ var CONFIG_KEYS = Object.keys(CONFIG_DEFAULTS).filter(
14811
+ (key) => !NESTED_CONFIG_KEYS.has(key)
14812
+ );
14813
+ var PUBLISH_CONFIG_KEYS = [
14814
+ "publish.mode",
14815
+ "publish.defaultPrice",
14816
+ "publish.ackServerWarnings"
14817
+ ];
14818
+ var HOOKS_CONFIG_KEYS = HOOK_ARMS.map(
14819
+ (arm) => `hooks.${arm}`
14820
+ );
14821
+ var UPDATE_CONFIG_KEYS = ["update.mode"];
14822
+ var LOOP_CONFIG_KEYS = [
14823
+ "loop.human_wait_ms",
14824
+ "loop.tool_wait_ms",
14825
+ "loop.idle_exit_min",
14826
+ "loop.port"
14827
+ ];
14828
+ var TEAM_CONFIG_KEYS = ["team.publicFallback"];
14829
+ var ROUTER_CONFIG_KEYS = ["router.enabled", "router.context"];
14830
+ var RETIRED_PAYMENT_KEYS = ["bazaarPay", "confirm"];
14831
+ var RETIRED_PAYMENT_GUIDANCE = "Retired payment settings no longer control payments. Use router.enabled, maxAutoSpend and sessionBudget for automatic routing; manual pay always requires consent. Run tenjin install to remove retired keys.";
14832
+ function retiredPaymentKeys(raw) {
14833
+ return RETIRED_PAYMENT_KEYS.filter((key) => Object.hasOwn(raw, key));
14834
+ }
14835
+ async function loadRawConfig(dir) {
14836
+ const path = configPath(dir);
14837
+ let raw;
14838
+ try {
14839
+ raw = await readFile(path, "utf8");
14840
+ } catch (err) {
14841
+ if (isNotFound(err)) return {};
14842
+ throw new CliError("CONFIG_INVALID", `Could not read config at ${path}`, {
14843
+ fix: `Check file permissions on ${path}.`,
14844
+ cause: err
14845
+ });
14846
+ }
14847
+ let json2;
14848
+ try {
14849
+ json2 = JSON.parse(raw);
14850
+ } catch (err) {
14851
+ throw new CliError("CONFIG_INVALID", `Config at ${path} is not valid JSON`, {
14852
+ fix: `Fix the JSON syntax in ${path}, or delete it to restore defaults.`,
14853
+ cause: err
14854
+ });
14855
+ }
14856
+ const parsed = RawConfigSchema.safeParse(json2);
14857
+ if (!parsed.success) {
14858
+ throw new CliError("CONFIG_INVALID", `Config at ${path} is invalid`, {
14859
+ fix: `Correct the reported keys in ${path}, or delete it to restore defaults.`,
14860
+ details: parsed.error.issues
14861
+ });
14862
+ }
14863
+ return parsed.data;
14864
+ }
14865
+ async function loadConfig(dir) {
14866
+ const raw = { ...await loadRawConfig(dir) };
14867
+ for (const key of retiredPaymentKeys(raw)) delete raw[key];
14868
+ return {
14869
+ ...CONFIG_DEFAULTS,
14870
+ ...raw,
14871
+ publish: {
14872
+ mode: raw.publish?.mode ?? CONFIG_DEFAULTS.publish.mode,
14873
+ defaultPrice: raw.publish?.defaultPrice ?? CONFIG_DEFAULTS.publish.defaultPrice,
14874
+ ackServerWarnings: raw.publish?.ackServerWarnings ?? CONFIG_DEFAULTS.publish.ackServerWarnings
14875
+ },
14876
+ install: {
14877
+ harness: raw.install?.harness ?? CONFIG_DEFAULTS.install.harness,
14878
+ routerProjects: raw.install?.routerProjects ?? CONFIG_DEFAULTS.install.routerProjects,
14879
+ grantDeclined: resolveGrantDeclined(raw.install?.grantDeclined)
14880
+ },
14881
+ hooks: resolveHooksConfig(raw),
14882
+ update: { mode: raw.update?.mode ?? CONFIG_DEFAULTS.update.mode },
14883
+ loop: resolveLoopConfig(raw),
14884
+ team: { publicFallback: raw.team?.publicFallback ?? CONFIG_DEFAULTS.team.publicFallback },
14885
+ router: {
14886
+ enabled: raw.router?.enabled ?? CONFIG_DEFAULTS.router.enabled,
14887
+ context: raw.router?.context ?? CONFIG_DEFAULTS.router.context
14888
+ }
14889
+ };
14890
+ }
14891
+ function resolveLoopConfig(raw) {
14892
+ const file2 = raw.loop ?? {};
14893
+ return {
14894
+ human_wait_ms: file2.human_wait_ms ?? CONFIG_DEFAULTS.loop.human_wait_ms,
14895
+ tool_wait_ms: file2.tool_wait_ms ?? CONFIG_DEFAULTS.loop.tool_wait_ms,
14896
+ idle_exit_min: file2.idle_exit_min ?? CONFIG_DEFAULTS.loop.idle_exit_min,
14897
+ port: file2.port === void 0 ? CONFIG_DEFAULTS.loop.port : file2.port
14898
+ };
14899
+ }
14900
+ function resolveSettings(input) {
14901
+ const { config: config2, flags, env, project } = input;
14902
+ return {
14903
+ maxAutoSpend: fileOrDefault("maxAutoSpend", config2),
14904
+ sessionBudget: fileOrDefault("sessionBudget", config2),
14905
+ sendMaxAmount: resolveSendMaxAmount(config2),
14906
+ allowlistCreators: fileOrDefault("allowlistCreators", config2),
14907
+ baseUrl: resolveBaseUrl(config2, flags, env),
14908
+ publicShelfUrl: fileOrDefault("publicShelfUrl", config2),
14909
+ shelfBypassSecret: fileOrDefault("shelfBypassSecret", config2),
14910
+ rpcUrl: fileOrDefault("rpcUrl", config2),
14911
+ evalCohort: fileOrDefault("evalCohort", config2),
14912
+ bazaarRegistries: fileOrDefault("bazaarRegistries", config2),
14913
+ publishMode: resolvePublishMode({ config: config2, project, env }),
14914
+ publishDefaultPrice: resolvePublishDefaultPrice({ config: config2, project }),
14915
+ publishAckServerWarnings: resolveAckServerWarnings(config2),
14916
+ hooks: resolveHookSettings(config2),
14917
+ updateMode: resolveUpdateMode(config2),
14918
+ loop: resolveLoopSettings(config2),
14919
+ teamPublicFallback: resolveTeamPublicFallback(config2)
14920
+ };
14921
+ }
14922
+ function resolveLoopSettings(config2) {
14923
+ const file2 = config2.loop ?? {};
14924
+ const one = (key) => {
14925
+ const fromFile = file2[key];
14926
+ if (fromFile !== void 0) return { value: fromFile, source: "file" };
14927
+ return { value: CONFIG_DEFAULTS.loop[key], source: "default" };
14928
+ };
14929
+ return {
14930
+ human_wait_ms: one("human_wait_ms"),
14931
+ tool_wait_ms: one("tool_wait_ms"),
14932
+ idle_exit_min: one("idle_exit_min"),
14933
+ port: one("port")
14934
+ };
14935
+ }
14936
+ function resolveTeamPublicFallback(config2) {
14937
+ const fromFile = config2.team?.publicFallback;
14938
+ if (fromFile !== void 0) return { value: fromFile, source: "file" };
14939
+ return { value: CONFIG_DEFAULTS.team.publicFallback, source: "default" };
14940
+ }
14941
+ function resolveAckServerWarnings(config2) {
14942
+ const fromFile = config2.publish?.ackServerWarnings;
14943
+ if (fromFile !== void 0) return { value: fromFile, source: "file" };
14944
+ return { value: CONFIG_DEFAULTS.publish.ackServerWarnings, source: "default" };
14945
+ }
14946
+ function resolveUpdateMode(config2) {
14947
+ const fromFile = config2.update?.mode;
14948
+ if (fromFile !== void 0) return { value: fromFile, source: "file" };
14949
+ return { value: CONFIG_DEFAULTS.update.mode, source: "default" };
14950
+ }
14951
+ function resolveHook(config2, arm) {
14952
+ const fromFile = config2.hooks?.[arm];
14953
+ if (fromFile !== void 0) return { value: fromFile, source: "file" };
14954
+ return { value: CONFIG_DEFAULTS.hooks[arm], source: "default" };
14955
+ }
14956
+ function resolveHookSettings(config2) {
14957
+ return Object.fromEntries(
14958
+ HOOK_ARMS.map((arm) => [arm, resolveHook(config2, arm)])
14959
+ );
14960
+ }
14961
+ function resolveHooksConfig(raw) {
14962
+ return Object.fromEntries(
14963
+ HOOK_ARMS.map((arm) => [arm, raw.hooks?.[arm] ?? CONFIG_DEFAULTS.hooks[arm]])
14964
+ );
14965
+ }
14966
+ var FULL_AUTO_DOWNGRADE_WARNING = 'Ignoring publish.mode "full-auto" from a committed .tenjin.json (cloning a repo must not enable auto-publish); using "auto". Add .tenjin.json to .gitignore to opt in.';
14967
+ function coercePublishMode(raw) {
14968
+ if (raw === void 0 || raw.length === 0) return void 0;
14969
+ const parsed = PublishModeSchema.safeParse(raw);
14970
+ return parsed.success ? parsed.data : void 0;
14971
+ }
14972
+ function resolvePublishMode(input) {
14973
+ const { config: config2, project, env, flag } = input;
14974
+ let winner = { value: CONFIG_DEFAULTS.publish.mode, source: "default" };
14975
+ const fromFile = config2.publish?.mode;
14976
+ if (fromFile !== void 0) winner = { value: fromFile, source: "file" };
14977
+ if (project !== void 0 && project.publish?.mode !== void 0) {
14978
+ const fromProject = project.publish.mode;
14979
+ if (fromProject === "full-auto" && !project.gitignored) {
14980
+ winner = { value: "auto", source: "project", downgradedWarning: FULL_AUTO_DOWNGRADE_WARNING };
14981
+ } else {
14982
+ winner = { value: fromProject, source: "project" };
14983
+ }
14984
+ }
14985
+ const fromEnv = coercePublishMode(env.TENJIN_PUBLISH_MODE);
14986
+ if (fromEnv !== void 0) winner = { value: fromEnv, source: "env" };
14987
+ const fromFlag = coercePublishMode(flag);
14988
+ if (fromFlag !== void 0) winner = { value: fromFlag, source: "flag" };
14989
+ return winner;
14990
+ }
14991
+ function resolvePublishDefaultPrice(input) {
14992
+ const { config: config2, project } = input;
14993
+ let result = {
14994
+ value: CONFIG_DEFAULTS.publish.defaultPrice,
14995
+ source: "default"
14996
+ };
14997
+ if (config2.publish?.defaultPrice !== void 0) {
14998
+ result = { value: config2.publish.defaultPrice, source: "file" };
14999
+ }
15000
+ if (project?.publish?.defaultPrice !== void 0) {
15001
+ result = { value: project.publish.defaultPrice, source: "project" };
15002
+ }
15003
+ return result;
15004
+ }
15005
+ function resolveSendMaxAmount(config2) {
15006
+ if (config2.sendMaxAmount !== void 0) return { value: config2.sendMaxAmount, source: "file" };
15007
+ return { value: SEND_MAX_UNSET, source: "default" };
15008
+ }
15009
+ function fileOrDefault(key, config2) {
15010
+ const fromFile = config2[key];
15011
+ if (fromFile !== void 0) return { value: fromFile, source: "file" };
15012
+ return { value: CONFIG_DEFAULTS[key], source: "default" };
15013
+ }
15014
+ function resolveBaseUrl(config2, flags, env) {
15015
+ if (flags.baseUrl !== void 0 && flags.baseUrl.length > 0) {
15016
+ return { value: flags.baseUrl, source: "flag" };
15017
+ }
15018
+ const fromEnv = env.TENJIN_BASE_URL;
15019
+ if (fromEnv !== void 0 && fromEnv.length > 0) {
15020
+ return { value: fromEnv, source: "env" };
15021
+ }
15022
+ if (config2.baseUrl !== void 0) return { value: config2.baseUrl, source: "file" };
15023
+ return { value: CONFIG_DEFAULTS.baseUrl, source: "default" };
15024
+ }
15025
+ function isNotFound(err) {
15026
+ return typeof err === "object" && err !== null && "code" in err && err.code === "ENOENT";
14585
15027
  }
14586
15028
 
14587
15029
  export {
15030
+ $constructor,
15031
+ defineLazy,
15032
+ clone,
15033
+ normalizeParams,
15034
+ parse,
15035
+ parseAsync,
15036
+ safeParse,
15037
+ safeParseAsync,
15038
+ $ZodType,
15039
+ $ZodObject,
15040
+ toJSONSchema,
15041
+ iso_exports,
15042
+ string2 as string,
15043
+ number2 as number,
15044
+ boolean2 as boolean,
15045
+ _null3 as _null,
15046
+ unknown,
15047
+ array,
15048
+ object,
15049
+ looseObject,
15050
+ union,
15051
+ discriminatedUnion,
15052
+ intersection,
15053
+ record,
15054
+ _enum2 as _enum,
15055
+ literal,
15056
+ ZodOptional,
15057
+ optional,
15058
+ custom,
15059
+ preprocess,
14588
15060
  external_exports,
14589
- CliError,
14590
- dataDir,
14591
- configPath,
14592
- walletPath,
14593
- sessionPath,
14594
- passphraseBlobPath
14595
- };
14596
- //# sourceMappingURL=chunk-OYMYCW7J.js.map
15061
+ PRODUCTION_ORIGIN,
15062
+ isSameDeployment,
15063
+ knownDeploymentOrigins,
15064
+ PublishModeSchema,
15065
+ parseAckServerWarnings,
15066
+ ROUTER_CONTEXTS,
15067
+ parseRouterLayer,
15068
+ parsePublicFallbackFlag,
15069
+ parseLoopValue,
15070
+ parseUpdateModeFlag,
15071
+ RawConfigSchema,
15072
+ SEND_MAX_UNSET,
15073
+ CONFIG_DEFAULTS,
15074
+ CONFIG_KEYS,
15075
+ PUBLISH_CONFIG_KEYS,
15076
+ HOOKS_CONFIG_KEYS,
15077
+ UPDATE_CONFIG_KEYS,
15078
+ LOOP_CONFIG_KEYS,
15079
+ TEAM_CONFIG_KEYS,
15080
+ ROUTER_CONFIG_KEYS,
15081
+ RETIRED_PAYMENT_GUIDANCE,
15082
+ retiredPaymentKeys,
15083
+ loadRawConfig,
15084
+ loadConfig,
15085
+ resolveSettings
15086
+ };
15087
+ //# sourceMappingURL=chunk-CCDOV45D.js.map