tenjin-cli 0.1.0-alpha.4 → 0.1.0-alpha.7

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 (135) hide show
  1. package/README.md +269 -38
  2. package/dist/{buy-OOOLUDND.js → buy-XVOMNWKN.js} +21 -18
  3. package/dist/{candidate-TWCWTFGA.js → candidate-DJB2NNTG.js} +7 -8
  4. package/dist/{chunk-KXIX7YDV.js → chunk-2KIDDWQO.js} +5 -5
  5. package/dist/{chunk-NXCJN2FJ.js → chunk-2L73UI6T.js} +51 -42
  6. package/dist/chunk-2L73UI6T.js.map +1 -0
  7. package/dist/{chunk-OJD54DIU.js → chunk-2YX6LTCD.js} +5 -5
  8. package/dist/{chunk-H5ETJRQD.js → chunk-5X4EBGGU.js} +22 -14
  9. package/dist/chunk-5X4EBGGU.js.map +1 -0
  10. package/dist/chunk-6S44OLND.js +699 -0
  11. package/dist/chunk-6S44OLND.js.map +1 -0
  12. package/dist/{chunk-FU6MCSLG.js → chunk-7WDY4AXV.js} +2 -64
  13. package/dist/chunk-7WDY4AXV.js.map +1 -0
  14. package/dist/{chunk-VV4P5RVK.js → chunk-BBUYCDSG.js} +16 -4
  15. package/dist/chunk-BBUYCDSG.js.map +1 -0
  16. package/dist/chunk-CYRYVZPN.js +213 -0
  17. package/dist/chunk-CYRYVZPN.js.map +1 -0
  18. package/dist/{chunk-FHB3VKZW.js → chunk-DAJ56EUU.js} +5 -3
  19. package/dist/chunk-DAJ56EUU.js.map +1 -0
  20. package/dist/chunk-DH6D6QIO.js +239 -0
  21. package/dist/chunk-DH6D6QIO.js.map +1 -0
  22. package/dist/chunk-E6BNARCS.js +614 -0
  23. package/dist/chunk-E6BNARCS.js.map +1 -0
  24. package/dist/chunk-GABYDXWL.js +190 -0
  25. package/dist/chunk-GABYDXWL.js.map +1 -0
  26. package/dist/{chunk-EUQN3L5X.js → chunk-GM4RZUVU.js} +21 -9
  27. package/dist/chunk-GM4RZUVU.js.map +1 -0
  28. package/dist/{chunk-C4TIWOAM.js → chunk-GXYNLMUQ.js} +28 -11
  29. package/dist/chunk-GXYNLMUQ.js.map +1 -0
  30. package/dist/{chunk-6WWVYYSB.js → chunk-J6CVKC4M.js} +86 -4
  31. package/dist/chunk-J6CVKC4M.js.map +1 -0
  32. package/dist/{chunk-5JH7ZB6Z.js → chunk-KT2DGKFT.js} +76 -10
  33. package/dist/chunk-KT2DGKFT.js.map +1 -0
  34. package/dist/chunk-L6AV2Q73.js +105 -0
  35. package/dist/chunk-L6AV2Q73.js.map +1 -0
  36. package/dist/{chunk-333FOTUJ.js → chunk-MJZZTKCC.js} +108 -2
  37. package/dist/chunk-MJZZTKCC.js.map +1 -0
  38. package/dist/{chunk-XNNOR7F7.js → chunk-OTDI5FXG.js} +3 -5
  39. package/dist/{chunk-XNNOR7F7.js.map → chunk-OTDI5FXG.js.map} +1 -1
  40. package/dist/chunk-PIIWLEEG.js +337 -0
  41. package/dist/chunk-PIIWLEEG.js.map +1 -0
  42. package/dist/{chunk-ULLWHHIT.js → chunk-PLU3E63S.js} +468 -559
  43. package/dist/chunk-PLU3E63S.js.map +1 -0
  44. package/dist/chunk-QW2Q2KAH.js +27 -0
  45. package/dist/chunk-QW2Q2KAH.js.map +1 -0
  46. package/dist/{chunk-S3KZ3PPK.js → chunk-RGFBBNGP.js} +291 -59
  47. package/dist/chunk-RGFBBNGP.js.map +1 -0
  48. package/dist/chunk-SGK2B724.js +67 -0
  49. package/dist/chunk-SGK2B724.js.map +1 -0
  50. package/dist/chunk-UYP7G3GZ.js +412 -0
  51. package/dist/chunk-UYP7G3GZ.js.map +1 -0
  52. package/dist/{chunk-DPUMEMGM.js → chunk-VZ3AJCO5.js} +3 -5
  53. package/dist/{chunk-DPUMEMGM.js.map → chunk-VZ3AJCO5.js.map} +1 -1
  54. package/dist/{chunk-QH6677FJ.js → chunk-WDJTGVKN.js} +2 -2
  55. package/dist/{chunk-QH6677FJ.js.map → chunk-WDJTGVKN.js.map} +1 -1
  56. package/dist/{chunk-4GR7DGD6.js → chunk-WI5EOAQQ.js} +33 -256
  57. package/dist/{chunk-4GR7DGD6.js.map → chunk-WI5EOAQQ.js.map} +1 -1
  58. package/dist/{chunk-DPET3TW5.js → chunk-WRWCDLVK.js} +13 -12
  59. package/dist/chunk-WRWCDLVK.js.map +1 -0
  60. package/dist/chunk-XBJ3VLWX.js +35 -0
  61. package/dist/chunk-XBJ3VLWX.js.map +1 -0
  62. package/dist/chunk-ZEWY3RJ3.js +149 -0
  63. package/dist/chunk-ZEWY3RJ3.js.map +1 -0
  64. package/dist/chunk-ZFE7STX7.js +143 -0
  65. package/dist/chunk-ZFE7STX7.js.map +1 -0
  66. package/dist/{cli-AFSLAKR6.js → cli-7B2QNJG3.js} +247 -26
  67. package/dist/cli-7B2QNJG3.js.map +1 -0
  68. package/dist/{config-DBEEM3UA.js → config-SAQEQRFB.js} +7 -6
  69. package/dist/{doctor-XDA3YU6H.js → doctor-ENJ22XWN.js} +10 -8
  70. package/dist/{publish-IH7RJXGB.js → edit-2QO5GQDU.js} +19 -17
  71. package/dist/index.js +1 -1
  72. package/dist/{inspect-YBGDAG47.js → inspect-IPKKQB2S.js} +16 -15
  73. package/dist/{install-7J6KKEEP.js → install-7ZIYISQ7.js} +180 -133
  74. package/dist/install-7ZIYISQ7.js.map +1 -0
  75. package/dist/outcome-NSDE2KAJ.js +20 -0
  76. package/dist/publish-7WIFFNFG.js +40 -0
  77. package/dist/read-5TQR7LCF.js +158 -0
  78. package/dist/read-5TQR7LCF.js.map +1 -0
  79. package/dist/{run-DCZFEW2C.js → run-NPKIP26Y.js} +109 -34
  80. package/dist/{run-DCZFEW2C.js.map → run-NPKIP26Y.js.map} +1 -1
  81. package/dist/search-63ELMRZH.js +24 -0
  82. package/dist/send-ENE47KQE.js +222 -0
  83. package/dist/send-ENE47KQE.js.map +1 -0
  84. package/dist/session-FZU4VFFE.js +87 -0
  85. package/dist/session-FZU4VFFE.js.map +1 -0
  86. package/dist/{usdc-AU6ZIKA6.js → usdc-4VCDHFWX.js} +20 -4
  87. package/dist/{wallet-UWHSHWC6.js → wallet-OCCGEH6H.js} +8 -8
  88. package/dist/{wallet-HKG3GSTX.js → wallet-RBDVNZVR.js} +17 -7
  89. package/dist/wallet-RBDVNZVR.js.map +1 -0
  90. package/package.json +1 -1
  91. package/skills/tenjin/SKILL.md +32 -7
  92. package/skills/tenjin-publish/SKILL.md +109 -16
  93. package/skills/tenjin-search/SKILL.md +174 -15
  94. package/dist/chunk-333FOTUJ.js.map +0 -1
  95. package/dist/chunk-5JH7ZB6Z.js.map +0 -1
  96. package/dist/chunk-6WWVYYSB.js.map +0 -1
  97. package/dist/chunk-BXUS5UCT.js +0 -212
  98. package/dist/chunk-BXUS5UCT.js.map +0 -1
  99. package/dist/chunk-C4TIWOAM.js.map +0 -1
  100. package/dist/chunk-CJU555P5.js +0 -333
  101. package/dist/chunk-CJU555P5.js.map +0 -1
  102. package/dist/chunk-DPET3TW5.js.map +0 -1
  103. package/dist/chunk-EUQN3L5X.js.map +0 -1
  104. package/dist/chunk-FHB3VKZW.js.map +0 -1
  105. package/dist/chunk-FU6MCSLG.js.map +0 -1
  106. package/dist/chunk-H5ETJRQD.js.map +0 -1
  107. package/dist/chunk-MM4TGTST.js +0 -59
  108. package/dist/chunk-MM4TGTST.js.map +0 -1
  109. package/dist/chunk-MUBUQVC3.js +0 -67
  110. package/dist/chunk-MUBUQVC3.js.map +0 -1
  111. package/dist/chunk-NXCJN2FJ.js.map +0 -1
  112. package/dist/chunk-R7BMDJZM.js +0 -167
  113. package/dist/chunk-R7BMDJZM.js.map +0 -1
  114. package/dist/chunk-S3KZ3PPK.js.map +0 -1
  115. package/dist/chunk-ULLWHHIT.js.map +0 -1
  116. package/dist/chunk-VV4P5RVK.js.map +0 -1
  117. package/dist/chunk-YFREUEUI.js +0 -78
  118. package/dist/chunk-YFREUEUI.js.map +0 -1
  119. package/dist/cli-AFSLAKR6.js.map +0 -1
  120. package/dist/install-7J6KKEEP.js.map +0 -1
  121. package/dist/outcome-ZFGHX2XW.js +0 -20
  122. package/dist/search-R6NIQFXI.js +0 -24
  123. /package/dist/{buy-OOOLUDND.js.map → buy-XVOMNWKN.js.map} +0 -0
  124. /package/dist/{candidate-TWCWTFGA.js.map → candidate-DJB2NNTG.js.map} +0 -0
  125. /package/dist/{chunk-KXIX7YDV.js.map → chunk-2KIDDWQO.js.map} +0 -0
  126. /package/dist/{chunk-OJD54DIU.js.map → chunk-2YX6LTCD.js.map} +0 -0
  127. /package/dist/{config-DBEEM3UA.js.map → config-SAQEQRFB.js.map} +0 -0
  128. /package/dist/{doctor-XDA3YU6H.js.map → doctor-ENJ22XWN.js.map} +0 -0
  129. /package/dist/{inspect-YBGDAG47.js.map → edit-2QO5GQDU.js.map} +0 -0
  130. /package/dist/{outcome-ZFGHX2XW.js.map → inspect-IPKKQB2S.js.map} +0 -0
  131. /package/dist/{publish-IH7RJXGB.js.map → outcome-NSDE2KAJ.js.map} +0 -0
  132. /package/dist/{search-R6NIQFXI.js.map → publish-7WIFFNFG.js.map} +0 -0
  133. /package/dist/{usdc-AU6ZIKA6.js.map → search-63ELMRZH.js.map} +0 -0
  134. /package/dist/{wallet-HKG3GSTX.js.map → usdc-4VCDHFWX.js.map} +0 -0
  135. /package/dist/{wallet-UWHSHWC6.js.map → wallet-OCCGEH6H.js.map} +0 -0
@@ -0,0 +1,20 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ runOutcome
4
+ } from "./chunk-2KIDDWQO.js";
5
+ import "./chunk-OTDI5FXG.js";
6
+ import "./chunk-2L73UI6T.js";
7
+ import "./chunk-WWX32ML4.js";
8
+ import "./chunk-GXYNLMUQ.js";
9
+ import "./chunk-WDJTGVKN.js";
10
+ import "./chunk-XBJ3VLWX.js";
11
+ import "./chunk-DAJ56EUU.js";
12
+ import "./chunk-YBMMV4Y4.js";
13
+ import "./chunk-UO22YNY4.js";
14
+ import "./chunk-UYP7G3GZ.js";
15
+ import "./chunk-J6CVKC4M.js";
16
+ import "./chunk-ZXTAQYNA.js";
17
+ export {
18
+ runOutcome
19
+ };
20
+ //# sourceMappingURL=outcome-NSDE2KAJ.js.map
@@ -0,0 +1,40 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ runPublish
4
+ } from "./chunk-PIIWLEEG.js";
5
+ import "./chunk-SGK2B724.js";
6
+ import "./chunk-PLU3E63S.js";
7
+ import "./chunk-ZFE7STX7.js";
8
+ import "./chunk-7WDY4AXV.js";
9
+ import "./chunk-POJRB2AE.js";
10
+ import "./chunk-GABYDXWL.js";
11
+ import "./chunk-RGFBBNGP.js";
12
+ import "./chunk-WRWCDLVK.js";
13
+ import "./chunk-VZ3AJCO5.js";
14
+ import "./chunk-2L73UI6T.js";
15
+ import "./chunk-WWX32ML4.js";
16
+ import "./chunk-GXYNLMUQ.js";
17
+ import "./chunk-WDJTGVKN.js";
18
+ import "./chunk-XBJ3VLWX.js";
19
+ import "./chunk-2I4QTOLB.js";
20
+ import "./chunk-BBUYCDSG.js";
21
+ import "./chunk-KZAAWQNP.js";
22
+ import "./chunk-S5RYMCV6.js";
23
+ import "./chunk-YLYINX2H.js";
24
+ import "./chunk-DAJ56EUU.js";
25
+ import "./chunk-YBMMV4Y4.js";
26
+ import "./chunk-UO22YNY4.js";
27
+ import "./chunk-UYP7G3GZ.js";
28
+ import "./chunk-J6CVKC4M.js";
29
+ import "./chunk-M2O56UK7.js";
30
+ import "./chunk-UHTVXQ2O.js";
31
+ import "./chunk-W6R3HAAG.js";
32
+ import "./chunk-47PP7TAG.js";
33
+ import "./chunk-XJN5WUKL.js";
34
+ import "./chunk-RBJPAZFI.js";
35
+ import "./chunk-KYQVEKP5.js";
36
+ import "./chunk-ZXTAQYNA.js";
37
+ export {
38
+ runPublish
39
+ };
40
+ //# sourceMappingURL=publish-7WIFFNFG.js.map
@@ -0,0 +1,158 @@
1
+ import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ deliverExisting,
4
+ deliverFresh,
5
+ parseSectionsBudget
6
+ } from "./chunk-L6AV2Q73.js";
7
+ import {
8
+ fetchRead
9
+ } from "./chunk-KT2DGKFT.js";
10
+ import "./chunk-SGK2B724.js";
11
+ import "./chunk-7WDY4AXV.js";
12
+ import "./chunk-POJRB2AE.js";
13
+ import {
14
+ isSessionPresentable,
15
+ loadSessionFile,
16
+ signWithSession
17
+ } from "./chunk-GABYDXWL.js";
18
+ import {
19
+ findDelivered,
20
+ findDeliveredByUrl,
21
+ resolveResourceRef
22
+ } from "./chunk-CYRYVZPN.js";
23
+ import "./chunk-OTDI5FXG.js";
24
+ import "./chunk-2L73UI6T.js";
25
+ import "./chunk-WWX32ML4.js";
26
+ import "./chunk-GXYNLMUQ.js";
27
+ import "./chunk-WDJTGVKN.js";
28
+ import {
29
+ originOf
30
+ } from "./chunk-XBJ3VLWX.js";
31
+ import "./chunk-2I4QTOLB.js";
32
+ import {
33
+ sanitizeForTerminal
34
+ } from "./chunk-BBUYCDSG.js";
35
+ import "./chunk-KZAAWQNP.js";
36
+ import "./chunk-S5RYMCV6.js";
37
+ import "./chunk-YLYINX2H.js";
38
+ import {
39
+ resolveContextSettings
40
+ } from "./chunk-DAJ56EUU.js";
41
+ import "./chunk-YBMMV4Y4.js";
42
+ import "./chunk-UO22YNY4.js";
43
+ import {
44
+ formatUsdDisplay,
45
+ toMoney
46
+ } from "./chunk-UYP7G3GZ.js";
47
+ import {
48
+ CliError
49
+ } from "./chunk-J6CVKC4M.js";
50
+ import "./chunk-UHTVXQ2O.js";
51
+ import "./chunk-W6R3HAAG.js";
52
+ import "./chunk-XJN5WUKL.js";
53
+ import "./chunk-RBJPAZFI.js";
54
+ import "./chunk-KYQVEKP5.js";
55
+ import "./chunk-ZXTAQYNA.js";
56
+
57
+ // src/commands/read.ts
58
+ async function runRead(args, ctx, deps = {}) {
59
+ const settings = await resolveContextSettings(ctx);
60
+ const sectionsBudget = parseSectionsBudget(args.sections);
61
+ const ref = await resolveResourceRef(args.ref, ctx.dataDir, settings.baseUrl);
62
+ const presentOpts = { printBody: args.printBody === true, sectionsBudget };
63
+ const existing = ref.resourceId !== void 0 ? await findDelivered(ctx.dataDir, ref.resourceId) : await findDeliveredByUrl(ctx.dataDir, ref.url);
64
+ if (existing !== null) {
65
+ return deliverExisting(existing, presentOpts);
66
+ }
67
+ const fetchOpts = {
68
+ timeoutMs: ctx.flags.timeout,
69
+ ...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {}
70
+ };
71
+ const first = await fetchRead(ref.url, fetchOpts);
72
+ if (first.kind === "entitled") {
73
+ return await deliverFresh(ctx.dataDir, ref.url, first.body, "free", void 0, presentOpts);
74
+ }
75
+ if (first.kind === "already_purchased") {
76
+ throw new CliError("API_UNREACHABLE", "Unexpected 409 on an unauthenticated read.", {
77
+ fix: "Retry; if it persists, update tenjin-cli."
78
+ });
79
+ }
80
+ const firstRequirement = first.paymentRequired.accepts[0];
81
+ if (firstRequirement === void 0) {
82
+ throw new CliError("PAYMENT_FAILED", "The 402 advertised no payment requirements.", {
83
+ fix: "Try another candidate; this resource looks misconfigured."
84
+ });
85
+ }
86
+ const cached = await loadSessionFile(ctx.dataDir);
87
+ const now = deps.now ?? Date.now;
88
+ const origin = originOf(ref.url);
89
+ const outcome = await presentIfUsable(cached, origin, now, ref.url, fetchOpts);
90
+ if (outcome.kind === "entitled") {
91
+ return await deliverFresh(
92
+ ctx.dataDir,
93
+ ref.url,
94
+ outcome.body,
95
+ "entitled",
96
+ void 0,
97
+ presentOpts
98
+ );
99
+ }
100
+ throw refusal(ref, firstRequirement, outcome.check);
101
+ }
102
+ var LOUD_CODES = /* @__PURE__ */ new Set(["CONTRACT_MISMATCH", "RATE_LIMITED"]);
103
+ async function presentIfUsable(cached, origin, now, url, fetchOpts) {
104
+ if (cached === null) return { kind: "refuse", check: "not_performed" };
105
+ if (cached.origin !== origin) {
106
+ return { kind: "refuse", check: "session_origin_mismatch" };
107
+ }
108
+ if (!isSessionPresentable(cached, now(), "read", origin)) {
109
+ return { kind: "refuse", check: "not_performed" };
110
+ }
111
+ return await present(cached, url, fetchOpts, now);
112
+ }
113
+ async function present(session, url, fetchOpts, now) {
114
+ let second;
115
+ try {
116
+ const sessionHeaders = await signWithSession(session, { method: "GET", url }, { now });
117
+ second = await fetchRead(url, { ...fetchOpts, sessionHeaders });
118
+ } catch (err) {
119
+ if (err instanceof CliError && LOUD_CODES.has(err.code)) throw err;
120
+ return { kind: "refuse", check: "session_inconclusive" };
121
+ }
122
+ switch (second.kind) {
123
+ case "entitled":
124
+ return { kind: "entitled", body: second.body };
125
+ case "payment_required":
126
+ return { kind: "refuse", check: "session" };
127
+ case "session_rejected":
128
+ return { kind: "refuse", check: "session_rejected" };
129
+ case "already_purchased":
130
+ return { kind: "refuse", check: "session_inconclusive" };
131
+ }
132
+ }
133
+ function refusal(ref, requirement, check) {
134
+ const price = toMoney(requirement.amount);
135
+ const priceText = `${formatUsdDisplay(price.atomic)} USD (${price.atomic} atomic)`;
136
+ const url = sanitizeForTerminal(ref.url);
137
+ const buyFix = `Run \`tenjin buy ${url}\` to pay and read it, or \`tenjin inspect\` for the card first.`;
138
+ const mismatch = check === "session_origin_mismatch";
139
+ const mintable = check !== "session" && !mismatch;
140
+ const fix = mismatch ? `Your session key was minted for a different Tenjin deployment, so it was not presented. Read from the origin it belongs to, rather than minting a new session against this one. Check the configured origin with \`tenjin config get baseUrl\` and drop any host override. ${buyFix}` : mintable ? `${buyFix} If you already bought it, \`tenjin session start --scope read\` lets this read recover it free.` : buyFix;
141
+ return new CliError("REFUSED", `This piece costs ${priceText}; \`tenjin read\` never pays.`, {
142
+ fix,
143
+ details: {
144
+ reason: "payment_required",
145
+ entitlementCheck: check,
146
+ url: ref.url,
147
+ ...ref.resourceId !== void 0 ? { resourceId: ref.resourceId } : {},
148
+ price,
149
+ network: requirement.network,
150
+ buyCommand: `tenjin buy ${ref.url}`,
151
+ ...mintable ? { sessionCommand: "tenjin session start --scope read" } : {}
152
+ }
153
+ });
154
+ }
155
+ export {
156
+ runRead
157
+ };
158
+ //# sourceMappingURL=read-5TQR7LCF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/read.ts"],"sourcesContent":["import { CliError } from '../lib/errors';\nimport { formatUsdDisplay, toMoney } from '../lib/money';\nimport { resolveContextSettings } from '../lib/settings';\nimport { resolveResourceRef } from '../lib/resource-ref';\nimport { fetchRead } from '../lib/read-client';\nimport type { ReadBody, SessionReadResult } from '../lib/read-client';\nimport { findDelivered, findDeliveredByUrl } from '../lib/library';\nimport {\n deliverExisting,\n deliverFresh,\n parseSectionsBudget,\n type PresentOpts,\n} from '../lib/delivery';\nimport { sanitizeForTerminal } from '../lib/output';\nimport { isSessionPresentable, loadSessionFile, signWithSession } from '../lib/session-present';\nimport type { SessionFile } from '../lib/session-present';\nimport { originOf } from '../lib/url';\nimport type { CommandContext, CommandResult } from '../context';\n\n/**\n * `tenjin read <resource-url-or-id>`, the FREE-ONLY delivery verb (#42).\n *\n * `buy` was the only verb that delivered a body, so a zero-cost re-read of\n * something you already own was indistinguishable — to a prefix-matching harness\n * permission classifier, and to a human reading a transcript — from a purchase.\n * `read` is the half of `buy` that never spends:\n * 1. local library (already delivered → re-deliver from disk, no network)\n * 2. first GET, unauthenticated → a FREE resource delivers immediately\n * 3. a PAID resource, with a read-scoped session key on disk for THIS origin →\n * present it on ONE bodyless signed GET; a 200 means this wallet owns the\n * piece and it delivers, free\n * 4. anything else → REFUSED (exit 3), naming the price, and pointing at\n * `tenjin buy` only when the server actually answered \"you do not own this\".\n * Nothing is charged, and the refusal lands before any payment could be\n * constructed, because none can be.\n *\n * The hard invariant, test-pinned rather than merely intended (read.test.ts): this\n * module and its whole transitive import graph never reach `lib/x402-pay`,\n * `lib/wallet`, or `lib/session-key`. Step 3 uses the present-only half, so read\n * can load a delegation and sign with it but cannot mint one and cannot pay.\n * Those two are the whole of what the pin guarantees; what a minted delegation is\n * worth to a holder is answered in `lib/permissions.ts`.\n *\n * Step 3 therefore presents ONLY to the origin the session was minted against.\n * `--base-url` rides this verb like every other and `read` is always-safe, so\n * without that check one auto-allowed command line would hand a wallet-derived\n * credential to a host an agent picked.\n */\n\nexport interface ReadArgs {\n ref: string;\n /** Include the full body in the machine output (default: outline only). */\n printBody?: boolean;\n /** Include leading sections within this token budget (deterministic split). */\n sections?: string;\n}\n\nexport interface ReadDeps {\n /** No `provider`/`authorizer` seam, unlike BuyDeps: there is no wallet to inject. */\n fetchImpl?: typeof fetch;\n /** Clock seam (ms since epoch) for the session-expiry decision. */\n now?: () => number;\n}\n\nexport async function runRead(\n args: ReadArgs,\n ctx: CommandContext,\n deps: ReadDeps = {},\n): Promise<CommandResult> {\n const settings = await resolveContextSettings(ctx);\n const sectionsBudget = parseSectionsBudget(args.sections);\n const ref = await resolveResourceRef(args.ref, ctx.dataDir, settings.baseUrl);\n const presentOpts: PresentOpts = { printBody: args.printBody === true, sectionsBudget };\n\n // 1. Library idempotence, BEFORE any network: an owned resource re-delivers\n // from disk. This is the case #42 exists for — the re-read that used to need\n // a `buy` approval. Matched by id or by url, exactly as buy matches it.\n const existing =\n ref.resourceId !== undefined\n ? await findDelivered(ctx.dataDir, ref.resourceId)\n : await findDeliveredByUrl(ctx.dataDir, ref.url);\n if (existing !== null) {\n return deliverExisting(existing, presentOpts);\n }\n\n const fetchOpts = {\n timeoutMs: ctx.flags.timeout,\n ...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),\n };\n\n // 2. First GET, unauthenticated — the same probe buy opens with, and like buy's\n // probe it is unattributed (no search id rides a non-purchase).\n const first = await fetchRead(ref.url, fetchOpts);\n\n if (first.kind === 'entitled') {\n // Free resource (no payment challenge was issued): deliver and save. No wallet\n // was resolved to get here.\n return await deliverFresh(ctx.dataDir, ref.url, first.body, 'free', undefined, presentOpts);\n }\n\n if (first.kind === 'already_purchased') {\n // A plain GET carries no payment header, so the read route cannot answer the\n // owned-re-pay 409 here; the contract makes this unreachable. Same loud failure\n // buy raises rather than guessing a recovery chain.\n throw new CliError('API_UNREACHABLE', 'Unexpected 409 on an unauthenticated read.', {\n fix: 'Retry; if it persists, update tenjin-cli.',\n });\n }\n\n // A paid resource. Capture the advertised price: it is what the refusal reports.\n const firstRequirement = first.paymentRequired.accepts[0];\n if (firstRequirement === undefined) {\n throw new CliError('PAYMENT_FAILED', 'The 402 advertised no payment requirements.', {\n fix: 'Try another candidate; this resource looks misconfigured.',\n });\n }\n\n // 3. Paid and not on disk. A live session key minted for THIS origin means the\n // wallet may already own the piece. Exactly one attempt: re-establishing\n // would need the wallet this module cannot reach.\n const cached = await loadSessionFile(ctx.dataDir);\n const now = deps.now ?? Date.now;\n // Against the origin of the URL actually being signed, not the configured base\n // URL. They are equal only because `resolveResourceRef` asserted it in another\n // module; checking the request target makes this guard locally sound instead of\n // dependent on a pin someone could move.\n const origin = originOf(ref.url);\n const outcome = await presentIfUsable(cached, origin, now, ref.url, fetchOpts);\n if (outcome.kind === 'entitled') {\n return await deliverFresh(\n ctx.dataDir,\n ref.url,\n outcome.body,\n 'entitled',\n undefined,\n presentOpts,\n );\n }\n\n // 4. Not entitled, not asked, or not answered: refuse (exit 3) on the advertised\n // price. No payment is constructed; none can be.\n throw refusal(ref, firstRequirement, outcome.check);\n}\n\n/** What the entitlement question got, which is not the same as what was asked. */\ntype EntitlementCheck =\n | 'not_performed'\n | 'session'\n | 'session_rejected'\n | 'session_inconclusive'\n | 'session_origin_mismatch';\n\ntype PresentOutcome =\n { kind: 'entitled'; body: ReadBody } | { kind: 'refuse'; check: EntitlementCheck };\n\n/** Failures that must NOT be folded into a price refusal; see `present`. */\nconst LOUD_CODES = new Set(['CONTRACT_MISMATCH', 'RATE_LIMITED']);\n\n/**\n * Decide whether the cached session may be presented, and present it if so.\n *\n * The origin mismatch is its own outcome rather than \"no session\": the two are\n * indistinguishable to an agent, and the remedy for one is the remedy the other\n * must NOT get. `not_performed` tells the agent to run `session start`, which is\n * the single verb that opens the keystore — and an agent that reached a mismatch\n * by carrying `--base-url` would carry it straight into that suggestion, minting\n * a wallet-signed delegation against the wrong host and clobbering the good one.\n */\nasync function presentIfUsable(\n cached: SessionFile | null,\n origin: string,\n now: () => number,\n url: string,\n fetchOpts: { timeoutMs: number; fetchImpl?: typeof fetch },\n): Promise<PresentOutcome> {\n if (cached === null) return { kind: 'refuse', check: 'not_performed' };\n if (cached.origin !== origin) {\n return { kind: 'refuse', check: 'session_origin_mismatch' };\n }\n if (!isSessionPresentable(cached, now(), 'read', origin)) {\n return { kind: 'refuse', check: 'not_performed' };\n }\n return await present(cached, url, fetchOpts, now);\n}\n\n/**\n * The one signed GET. Never throws for a transport failure: the first 402 already\n * told us the price, and losing it turns a recoverable refusal into a bare\n * network error that says nothing about the piece. Two exceptions stay loud: a\n * blocked redirect (a signal about where a credential was nearly sent) and a\n * rate limit (a recoverable pause the CLI models explicitly everywhere else —\n * swallowing it costs a looping agent its backoff and points it at a\n * keystore-opening command instead).\n */\nasync function present(\n session: SessionFile,\n url: string,\n fetchOpts: { timeoutMs: number; fetchImpl?: typeof fetch },\n now: () => number,\n): Promise<PresentOutcome> {\n let second: SessionReadResult;\n try {\n const sessionHeaders = await signWithSession(session, { method: 'GET', url }, { now });\n second = await fetchRead(url, { ...fetchOpts, sessionHeaders });\n } catch (err) {\n if (err instanceof CliError && LOUD_CODES.has(err.code)) throw err;\n return { kind: 'refuse', check: 'session_inconclusive' };\n }\n switch (second.kind) {\n case 'entitled':\n return { kind: 'entitled', body: second.body };\n case 'payment_required':\n // The only state where the server actually answered the ownership question.\n return { kind: 'refuse', check: 'session' };\n case 'session_rejected':\n // The delegation was declined (expired, revoked, origin drift, rotated\n // wallet). The entitlement question was never asked, so \"you must buy\" is\n // not the answer — re-minting is.\n return { kind: 'refuse', check: 'session_rejected' };\n case 'already_purchased':\n // A 409 on a request carrying no payment is contract-anomalous: the server\n // said \"already purchased\" and delivered nothing. Handled by name rather\n // than swept into a default, because the one thing this must never become\n // is a price refusal telling the agent to buy what it was just told it owns.\n return { kind: 'refuse', check: 'session_inconclusive' };\n }\n}\n\n/**\n * The exit-3 refusal: the price, in human money, plus the move that actually gets\n * past it. `entitlementCheck` reports what the server said, and the fix follows\n * from it rather than from a single default:\n *\n * - `session` — the server answered \"you do not own this\". Buying is the answer.\n * - `session_origin_mismatch` — a session exists, for a DIFFERENT origin. The\n * remedy is to stop redirecting the CLI, never to mint. `sessionCommand` is\n * deliberately absent: recommending it here would send an agent that still\n * carries `--base-url` to wallet-sign a delegation against the wrong host and\n * overwrite the good one.\n * - everything else — the question is still open, so re-minting may deliver it\n * free and `sessionCommand` rides.\n */\nfunction refusal(\n ref: { url: string; resourceId?: string },\n requirement: { amount: string; network: string },\n check: EntitlementCheck,\n): CliError {\n const price = toMoney(requirement.amount);\n // formatUsdDisplay (not the machine `usd`) because this string is human copy:\n // a price a person reads renders as 0.10, never 0.1.\n const priceText = `${formatUsdDisplay(price.atomic)} USD (${price.atomic} atomic)`;\n const url = sanitizeForTerminal(ref.url);\n const buyFix = `Run \\`tenjin buy ${url}\\` to pay and read it, or \\`tenjin inspect\\` for the card first.`;\n const mismatch = check === 'session_origin_mismatch';\n const mintable = check !== 'session' && !mismatch;\n const fix = mismatch\n ? `Your session key was minted for a different Tenjin deployment, so it was not presented. Read from the origin it belongs to, rather than minting a new session against this one. Check the configured origin with \\`tenjin config get baseUrl\\` and drop any host override. ${buyFix}`\n : mintable\n ? `${buyFix} If you already bought it, \\`tenjin session start --scope read\\` lets this read recover it free.`\n : buyFix;\n return new CliError('REFUSED', `This piece costs ${priceText}; \\`tenjin read\\` never pays.`, {\n fix,\n details: {\n reason: 'payment_required',\n entitlementCheck: check,\n url: ref.url,\n ...(ref.resourceId !== undefined ? { resourceId: ref.resourceId } : {}),\n price,\n network: requirement.network,\n buyCommand: `tenjin buy ${ref.url}`,\n ...(mintable ? { sessionCommand: 'tenjin session start --scope read' } : {}),\n },\n });\n}\n"],"mappings":"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","names":[]}
@@ -1,57 +1,66 @@
1
1
  import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
2
+ import {
3
+ runCandidateAdd,
4
+ runCandidateDrop,
5
+ runCandidateList
6
+ } from "./chunk-2YX6LTCD.js";
2
7
  import {
3
8
  runInspect
4
- } from "./chunk-YFREUEUI.js";
9
+ } from "./chunk-ZEWY3RJ3.js";
5
10
  import {
6
11
  runBuy
7
- } from "./chunk-4GR7DGD6.js";
8
- import "./chunk-5JH7ZB6Z.js";
12
+ } from "./chunk-WI5EOAQQ.js";
13
+ import "./chunk-L6AV2Q73.js";
14
+ import "./chunk-KT2DGKFT.js";
9
15
  import {
10
16
  runPublish
11
- } from "./chunk-ULLWHHIT.js";
12
- import "./chunk-FU6MCSLG.js";
17
+ } from "./chunk-PIIWLEEG.js";
18
+ import "./chunk-SGK2B724.js";
13
19
  import {
14
- runOutcome
15
- } from "./chunk-KXIX7YDV.js";
20
+ runEdit
21
+ } from "./chunk-E6BNARCS.js";
22
+ import "./chunk-PLU3E63S.js";
23
+ import "./chunk-ZFE7STX7.js";
24
+ import "./chunk-7WDY4AXV.js";
25
+ import "./chunk-POJRB2AE.js";
16
26
  import {
17
- runCandidateAdd,
18
- runCandidateDrop,
19
- runCandidateList
20
- } from "./chunk-OJD54DIU.js";
27
+ runOutcome
28
+ } from "./chunk-2KIDDWQO.js";
21
29
  import {
22
30
  runWalletBalance,
23
31
  runWalletCreate,
24
32
  runWalletShow
25
- } from "./chunk-R7BMDJZM.js";
26
- import "./chunk-S3KZ3PPK.js";
27
- import "./chunk-DPET3TW5.js";
33
+ } from "./chunk-DH6D6QIO.js";
34
+ import "./chunk-GABYDXWL.js";
35
+ import "./chunk-QW2Q2KAH.js";
36
+ import "./chunk-RGFBBNGP.js";
37
+ import "./chunk-WRWCDLVK.js";
28
38
  import {
29
39
  runSearch
30
- } from "./chunk-H5ETJRQD.js";
31
- import "./chunk-MM4TGTST.js";
32
- import "./chunk-XNNOR7F7.js";
33
- import "./chunk-NXCJN2FJ.js";
34
- import "./chunk-DPUMEMGM.js";
40
+ } from "./chunk-5X4EBGGU.js";
41
+ import "./chunk-CYRYVZPN.js";
42
+ import "./chunk-VZ3AJCO5.js";
43
+ import "./chunk-OTDI5FXG.js";
44
+ import "./chunk-2L73UI6T.js";
35
45
  import "./chunk-WWX32ML4.js";
46
+ import "./chunk-GXYNLMUQ.js";
47
+ import {
48
+ package_default
49
+ } from "./chunk-WDJTGVKN.js";
50
+ import "./chunk-XBJ3VLWX.js";
51
+ import "./chunk-2I4QTOLB.js";
36
52
  import {
37
53
  buildFailureEnvelope,
38
54
  buildSuccessEnvelope,
39
55
  normalizeError
40
- } from "./chunk-VV4P5RVK.js";
41
- import "./chunk-C4TIWOAM.js";
42
- import {
43
- package_default
44
- } from "./chunk-QH6677FJ.js";
45
- import "./chunk-2I4QTOLB.js";
56
+ } from "./chunk-BBUYCDSG.js";
46
57
  import "./chunk-KZAAWQNP.js";
47
58
  import "./chunk-S5RYMCV6.js";
48
- import "./chunk-POJRB2AE.js";
49
59
  import "./chunk-YLYINX2H.js";
50
- import "./chunk-FHB3VKZW.js";
60
+ import "./chunk-DAJ56EUU.js";
51
61
  import "./chunk-YBMMV4Y4.js";
52
62
  import "./chunk-UO22YNY4.js";
53
- import "./chunk-BXUS5UCT.js";
54
- import "./chunk-MUBUQVC3.js";
63
+ import "./chunk-UYP7G3GZ.js";
55
64
  import {
56
65
  $ZodObject,
57
66
  $ZodType,
@@ -86,8 +95,8 @@ import {
86
95
  toJSONSchema,
87
96
  union,
88
97
  unknown
89
- } from "./chunk-6WWVYYSB.js";
90
- import "./chunk-333FOTUJ.js";
98
+ } from "./chunk-J6CVKC4M.js";
99
+ import "./chunk-MJZZTKCC.js";
91
100
  import "./chunk-7FK2UN2T.js";
92
101
  import "./chunk-M2O56UK7.js";
93
102
  import "./chunk-UHTVXQ2O.js";
@@ -16559,6 +16568,33 @@ var publishInput = {
16559
16568
  provenance: external_exports.string().optional().describe("Provenance summary (card)"),
16560
16569
  methodology: external_exports.string().optional().describe("Methodology summary (card)")
16561
16570
  };
16571
+ var editInput = {
16572
+ postId: external_exports.string().describe("The uuid of your own post to show or update"),
16573
+ yes: external_exports.boolean().optional().describe(
16574
+ "Clear the review confirm and soft findings after user approval (never a hard block)"
16575
+ ),
16576
+ mode: external_exports.string().optional().describe("Consent mode for this run: review | auto | full-auto"),
16577
+ title: external_exports.string().optional().describe("New post title"),
16578
+ price: external_exports.coerce.string().optional().describe('New post price in decimal USD, e.g. "0.25"'),
16579
+ body: external_exports.string().optional().describe("Path to a Markdown file whose body replaces the stored body (frontmatter ignored)"),
16580
+ excerpt: external_exports.string().optional().describe("New excerpt"),
16581
+ question: external_exports.array(external_exports.string()).optional().describe("REPLACE the questions this piece answers"),
16582
+ task: external_exports.array(external_exports.string()).optional().describe("REPLACE the tasks this piece supports"),
16583
+ addQuestion: external_exports.array(external_exports.string()).optional().describe("Append questions, keeping the stored ones (not with question)"),
16584
+ addTask: external_exports.array(external_exports.string()).optional().describe("Append tasks, keeping the stored ones (not with task)"),
16585
+ scope: external_exports.string().optional().describe("What the piece covers (card scope)"),
16586
+ exclusions: external_exports.string().optional().describe("What the piece does not cover (card exclusions)"),
16587
+ appliesTo: external_exports.array(external_exports.string()).optional().describe("REPLACE applicability with key=value pairs"),
16588
+ asOf: external_exports.string().optional().describe("As-of timestamp, ISO-8601 with offset"),
16589
+ validUntil: external_exports.string().optional().describe("Valid-until timestamp, ISO-8601 with offset"),
16590
+ artifactType: external_exports.string().optional().describe("document | skill | dataset"),
16591
+ temporalMode: external_exports.string().optional().describe("snapshot | maintained | evergreen"),
16592
+ provenance: external_exports.string().optional().describe("Provenance summary (card)"),
16593
+ methodology: external_exports.string().optional().describe("Methodology summary (card)"),
16594
+ clear: external_exports.array(external_exports.string()).optional().describe(
16595
+ "Card fields to clear: scope, exclusions, asOf, validUntil, provenance, methodology, supersedesPostId, questionsAnswered, tasksSupported, appliesTo"
16596
+ )
16597
+ };
16562
16598
  var candidateAddInput = {
16563
16599
  file: external_exports.string().optional().describe("add: path to the Markdown draft to park"),
16564
16600
  searchId: external_exports.string().optional().describe("add: the searchId whose unmet demand this draft answers"),
@@ -16603,7 +16639,7 @@ function buildTenjinMcpServer(opts = {}) {
16603
16639
  "tenjin_search",
16604
16640
  {
16605
16641
  title: "Search for payable answers",
16606
- description: 'Ask the marketplace for payable candidate pieces that answer a question, or an honest MISS. Free, no wallet, no payment. Send GENERALIZED PUBLIC text only: strip secrets, private identifiers, and company-internal context, then send what is left as one complete natural-language sentence. Retrieval matches wording and meaning, so compressing the question to keywords throws away signal. Returns the compact candidates/MISS envelope; records the searchId locally so tenjin_buy and tenjin_outcome can refer to it. A MISS may also carry a `browse` array of at most three pointers (resourceId, url, title, price, creator.handle) into the broad corpus: unscored "you might browse this" hints with no match reasons, not answer candidates, and never resolvable by tenjin_buy/tenjin_outcome via resourceId.',
16642
+ description: 'Ask the marketplace for payable candidate pieces that answer a question, or an honest MISS. Free, no wallet, no payment. Send GENERALIZED PUBLIC text only: strip secrets, private identifiers, and company-internal context, then send what is left as one complete natural-language sentence. Retrieval matches wording and meaning, so compressing the question to keywords throws away signal. Returns up to `limit` LEAN candidates (identity, price, freshness, why it matched) or a MISS; records the searchId locally so tenjin_buy and tenjin_outcome can refer to it. A candidate does NOT say what the piece claims, so always call tenjin_inspect (free) before tenjin_buy. A `truncated: true` flag means candidates were dropped for size; the ceiling grows with the number returned, so retry with a LARGER limit (up to 10), and only at 10 is narrowing the question the remedy. A MISS may also carry a `browse` array of at most three pointers (resourceId, url, title, price, creator.handle) into the broad corpus: unscored "you might browse this" hints with no match reasons, not answer candidates, and never resolvable by tenjin_buy/tenjin_outcome via resourceId.',
16607
16643
  inputSchema: searchInput,
16608
16644
  annotations: { readOnlyHint: true, openWorldHint: true }
16609
16645
  },
@@ -16626,7 +16662,7 @@ function buildTenjinMcpServer(opts = {}) {
16626
16662
  "tenjin_inspect",
16627
16663
  {
16628
16664
  title: "Inspect a candidate",
16629
- description: "Show a candidate's pre-purchase card / preview from the read route without paying: price, scope, freshness, and the leak-safe preview. Use after tenjin_search and before tenjin_buy. Never signs, never pays, never saves.",
16665
+ description: "Show a candidate's answer card and preview from the read route without paying: what it answers, what it applies to, its scope and exclusions, its freshness dates, its provenance, plus the price and the leak-safe preview. This is the only place that depth exists before a purchase, so run it after tenjin_search and before every tenjin_buy. A piece with no `card` shows price and preview only; a `cardUnavailable` flag instead means the card exists but could not be loaded, so retry rather than treating the piece as attesting nothing. A maximal card is roughly 25kB, so inspect the two or three most promising candidates, not a whole page of them. Never signs, never pays, never saves.",
16630
16666
  inputSchema: inspectInput,
16631
16667
  annotations: { readOnlyHint: true, openWorldHint: true }
16632
16668
  },
@@ -16713,6 +16749,45 @@ function buildTenjinMcpServer(opts = {}) {
16713
16749
  )
16714
16750
  )
16715
16751
  );
16752
+ server.registerTool(
16753
+ "tenjin_edit",
16754
+ {
16755
+ title: "Show or update one of your posts",
16756
+ description: 'Show one of your own posts and its answer card (call with only postId), or update it: every field flag you pass is merged, every field you omit is kept, and array fields REPLACE the stored list unless you use addQuestion/addTask. Clear a card field with clear:["scope"]. Under the same publish.mode consent as publishing, an update returns NEEDS_CONFIRMATION with the before/after summary for you to show the user before re-calling with yes:true, and a live secret in the new content returns PUBLISH_BLOCKED, which yes never clears. Reading is owner-scoped, so even a show (postId only) signs with the local wallet on first use, minting a read-scoped 24h session; the key never leaves this machine.',
16757
+ inputSchema: editInput,
16758
+ annotations: { readOnlyHint: false, openWorldHint: true }
16759
+ },
16760
+ async (args) => runCore(
16761
+ "edit",
16762
+ (ctx) => runEdit(
16763
+ {
16764
+ postId: args.postId,
16765
+ ...args.yes !== void 0 ? { yes: args.yes } : {},
16766
+ ...args.mode !== void 0 ? { mode: args.mode } : {},
16767
+ ...args.title !== void 0 ? { title: args.title } : {},
16768
+ ...args.price !== void 0 ? { price: args.price } : {},
16769
+ ...args.body !== void 0 ? { body: args.body } : {},
16770
+ ...args.excerpt !== void 0 ? { excerpt: args.excerpt } : {},
16771
+ ...args.question !== void 0 ? { question: args.question } : {},
16772
+ ...args.task !== void 0 ? { task: args.task } : {},
16773
+ ...args.addQuestion !== void 0 ? { addQuestion: args.addQuestion } : {},
16774
+ ...args.addTask !== void 0 ? { addTask: args.addTask } : {},
16775
+ ...args.scope !== void 0 ? { scope: args.scope } : {},
16776
+ ...args.exclusions !== void 0 ? { exclusions: args.exclusions } : {},
16777
+ ...args.appliesTo !== void 0 ? { appliesTo: args.appliesTo } : {},
16778
+ ...args.asOf !== void 0 ? { asOf: args.asOf } : {},
16779
+ ...args.validUntil !== void 0 ? { validUntil: args.validUntil } : {},
16780
+ ...args.artifactType !== void 0 ? { artifactType: args.artifactType } : {},
16781
+ ...args.temporalMode !== void 0 ? { temporalMode: args.temporalMode } : {},
16782
+ ...args.provenance !== void 0 ? { provenance: args.provenance } : {},
16783
+ ...args.methodology !== void 0 ? { methodology: args.methodology } : {},
16784
+ ...args.clear !== void 0 ? { clear: args.clear } : {}
16785
+ },
16786
+ ctx,
16787
+ deps.edit
16788
+ )
16789
+ )
16790
+ );
16716
16791
  server.registerTool(
16717
16792
  "tenjin_candidate",
16718
16793
  {
@@ -16803,4 +16878,4 @@ async function runMcpServer(opts = {}) {
16803
16878
  export {
16804
16879
  runMcpServer
16805
16880
  };
16806
- //# sourceMappingURL=run-DCZFEW2C.js.map
16881
+ //# sourceMappingURL=run-NPKIP26Y.js.map