tenjin-cli 0.1.0-alpha.22 → 0.1.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +1 -1
- package/README.md +17 -19
- package/dist/{chunk-U5FFVIIF.js → chunk-EP5P2STS.js} +12 -12
- package/dist/chunk-EP5P2STS.js.map +1 -0
- package/dist/{chunk-F4IJQBGP.js → chunk-FFL5M5BC.js} +2 -2
- package/dist/{chunk-DHCOGDJB.js → chunk-GPLSNGKX.js} +4 -4
- package/dist/{chunk-CYEUVU3F.js → chunk-H5UR3GFJ.js} +98 -14
- package/dist/chunk-H5UR3GFJ.js.map +1 -0
- package/dist/{chunk-DA53QKTD.js → chunk-IIE65SJC.js} +4 -4
- package/dist/{chunk-2RMXTNLT.js → chunk-KC24CYGV.js} +4 -4
- package/dist/{chunk-XBYTP4SP.js → chunk-NSDZESRS.js} +3 -3
- package/dist/{chunk-UGLTSPXQ.js → chunk-O2WN732M.js} +2 -2
- package/dist/{chunk-SAN5PFTL.js → chunk-P22ZWXFX.js} +1 -1
- package/dist/{chunk-SAN5PFTL.js.map → chunk-P22ZWXFX.js.map} +1 -1
- package/dist/{chunk-2QYORQBF.js → chunk-P7LABKCW.js} +36 -1
- package/dist/{chunk-2QYORQBF.js.map → chunk-P7LABKCW.js.map} +1 -1
- package/dist/{chunk-AG4DWNHO.js → chunk-RCJ64OXH.js} +3 -3
- package/dist/{chunk-3Q3UBMVB.js → chunk-SQSKVKX6.js} +2 -2
- package/dist/{chunk-UHEMZEGW.js → chunk-TMLCEPCD.js} +2 -2
- package/dist/{chunk-UAT3Q7VF.js → chunk-UBOFYC6J.js} +35 -22
- package/dist/{chunk-UAT3Q7VF.js.map → chunk-UBOFYC6J.js.map} +1 -1
- package/dist/{chunk-GONDQ27X.js → chunk-UXSF7IFD.js} +3 -3
- package/dist/{chunk-UIOZRILX.js → chunk-W2ARIOAZ.js} +43 -27
- package/dist/chunk-W2ARIOAZ.js.map +1 -0
- package/dist/{chunk-NZYVSZNF.js → chunk-XRW4N23F.js} +4 -4
- package/dist/{chunk-NYJCBQL5.js → chunk-XZUGRTSV.js} +2 -2
- package/dist/{chunk-UFCN7NCE.js → chunk-YXLG7Q6Q.js} +22 -12
- package/dist/chunk-YXLG7Q6Q.js.map +1 -0
- package/dist/{chunk-TU3IK7KK.js → chunk-YZTIYDWU.js} +2 -2
- package/dist/{chunk-WXFVJPZD.js → chunk-ZMFDMALH.js} +2 -2
- package/dist/{chunk-B4GA3HAK.js → chunk-ZNZGBUV6.js} +11 -9
- package/dist/chunk-ZNZGBUV6.js.map +1 -0
- package/dist/{cli-5WM56Y7K.js → cli-GGNOQQEB.js} +28 -28
- package/dist/{cli-5WM56Y7K.js.map → cli-GGNOQQEB.js.map} +1 -1
- package/dist/{config-JBF5BZNO.js → config-XUUFICXK.js} +8 -8
- package/dist/{doctor-6KHBE77P.js → doctor-3LGF6CWI.js} +16 -16
- package/dist/{fund-GSFCXEF7.js → fund-3URFMBMN.js} +9 -9
- package/dist/{hook-command-UQZ4DVDL.js → hook-command-GMIDXVFK.js} +28 -10
- package/dist/{hook-command-UQZ4DVDL.js.map → hook-command-GMIDXVFK.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/{install-TDYC22KI.js → install-FRTG4KHF.js} +11 -11
- package/dist/{install-identity-QS4UFF27.js → install-identity-WNXSYP6N.js} +6 -6
- package/dist/{install-wallet-T737X74E.js → install-wallet-MXLJJP3N.js} +9 -9
- package/dist/{mcp-JWOOSKLX.js → mcp-O2WJ3QBW.js} +37 -35
- package/dist/{mcp-JWOOSKLX.js.map → mcp-O2WJ3QBW.js.map} +1 -1
- package/dist/{pay-TDYQFSKY.js → pay-43WUYTW5.js} +11 -11
- package/dist/{payments-26NVMFR2.js → payments-7UTMMTIO.js} +6 -6
- package/dist/{send-4RUBQQKP.js → send-ALHG2RXT.js} +8 -8
- package/dist/{status-CEHZKHBU.js → status-CFPNHB6R.js} +5 -5
- package/dist/{status-line-QRAO3Y2E.js → status-line-FJ6N7MKJ.js} +4 -4
- package/dist/{status-line-wiring-XKUVI5UW.js → status-line-wiring-GXFNXHPE.js} +4 -4
- package/dist/{uninstall-SJ6R2W2M.js → uninstall-5P2GFYBY.js} +11 -11
- package/dist/{update-N2NZS3AA.js → update-QJ5YHJ7I.js} +5 -5
- package/dist/{wallet-IB2EFAUP.js → wallet-6OJPGNEV.js} +8 -8
- package/docs/agent-permissions.md +6 -6
- package/docs/safety-model.md +10 -23
- package/package.json +10 -8
- package/dist/chunk-B4GA3HAK.js.map +0 -1
- package/dist/chunk-CYEUVU3F.js.map +0 -1
- package/dist/chunk-U5FFVIIF.js.map +0 -1
- package/dist/chunk-UFCN7NCE.js.map +0 -1
- package/dist/chunk-UIOZRILX.js.map +0 -1
- package/dist/tenjin-daemon.mjs +0 -20601
- package/dist/tenjin-shim.mjs +0 -251
- package/dist/tenjin-vitest-reporter.mjs +0 -49
- /package/dist/{chunk-F4IJQBGP.js.map → chunk-FFL5M5BC.js.map} +0 -0
- /package/dist/{chunk-DHCOGDJB.js.map → chunk-GPLSNGKX.js.map} +0 -0
- /package/dist/{chunk-DA53QKTD.js.map → chunk-IIE65SJC.js.map} +0 -0
- /package/dist/{chunk-2RMXTNLT.js.map → chunk-KC24CYGV.js.map} +0 -0
- /package/dist/{chunk-XBYTP4SP.js.map → chunk-NSDZESRS.js.map} +0 -0
- /package/dist/{chunk-UGLTSPXQ.js.map → chunk-O2WN732M.js.map} +0 -0
- /package/dist/{chunk-AG4DWNHO.js.map → chunk-RCJ64OXH.js.map} +0 -0
- /package/dist/{chunk-3Q3UBMVB.js.map → chunk-SQSKVKX6.js.map} +0 -0
- /package/dist/{chunk-UHEMZEGW.js.map → chunk-TMLCEPCD.js.map} +0 -0
- /package/dist/{chunk-GONDQ27X.js.map → chunk-UXSF7IFD.js.map} +0 -0
- /package/dist/{chunk-NZYVSZNF.js.map → chunk-XRW4N23F.js.map} +0 -0
- /package/dist/{chunk-NYJCBQL5.js.map → chunk-XZUGRTSV.js.map} +0 -0
- /package/dist/{chunk-TU3IK7KK.js.map → chunk-YZTIYDWU.js.map} +0 -0
- /package/dist/{chunk-WXFVJPZD.js.map → chunk-ZMFDMALH.js.map} +0 -0
- /package/dist/{config-JBF5BZNO.js.map → config-XUUFICXK.js.map} +0 -0
- /package/dist/{doctor-6KHBE77P.js.map → doctor-3LGF6CWI.js.map} +0 -0
- /package/dist/{fund-GSFCXEF7.js.map → fund-3URFMBMN.js.map} +0 -0
- /package/dist/{install-TDYC22KI.js.map → install-FRTG4KHF.js.map} +0 -0
- /package/dist/{install-identity-QS4UFF27.js.map → install-identity-WNXSYP6N.js.map} +0 -0
- /package/dist/{install-wallet-T737X74E.js.map → install-wallet-MXLJJP3N.js.map} +0 -0
- /package/dist/{pay-TDYQFSKY.js.map → pay-43WUYTW5.js.map} +0 -0
- /package/dist/{payments-26NVMFR2.js.map → payments-7UTMMTIO.js.map} +0 -0
- /package/dist/{send-4RUBQQKP.js.map → send-ALHG2RXT.js.map} +0 -0
- /package/dist/{status-CEHZKHBU.js.map → status-CFPNHB6R.js.map} +0 -0
- /package/dist/{status-line-QRAO3Y2E.js.map → status-line-FJ6N7MKJ.js.map} +0 -0
- /package/dist/{status-line-wiring-XKUVI5UW.js.map → status-line-wiring-GXFNXHPE.js.map} +0 -0
- /package/dist/{uninstall-SJ6R2W2M.js.map → uninstall-5P2GFYBY.js.map} +0 -0
- /package/dist/{update-N2NZS3AA.js.map → update-QJ5YHJ7I.js.map} +0 -0
- /package/dist/{wallet-IB2EFAUP.js.map → wallet-6OJPGNEV.js.map} +0 -0
|
@@ -34,6 +34,39 @@ function withInputEnd(streams, onEnd, run) {
|
|
|
34
34
|
function resolveStreams(streams) {
|
|
35
35
|
return { input: streams.input ?? process.stdin, output: streams.output ?? process.stderr };
|
|
36
36
|
}
|
|
37
|
+
async function selectOne(opts) {
|
|
38
|
+
const { select, isCancel } = await import("./dist-3LOO6M4U.js");
|
|
39
|
+
const streams = resolveStreams(opts.streams ?? {});
|
|
40
|
+
return withInputEnd(streams, null, async (signal) => {
|
|
41
|
+
const answer = await select({
|
|
42
|
+
message: opts.message,
|
|
43
|
+
options: opts.choices.map((c) => ({
|
|
44
|
+
value: c.value,
|
|
45
|
+
label: c.label,
|
|
46
|
+
...c.hint !== void 0 ? { hint: c.hint } : {}
|
|
47
|
+
})),
|
|
48
|
+
initialValue: opts.initialValue,
|
|
49
|
+
input: streams.input,
|
|
50
|
+
output: streams.output,
|
|
51
|
+
signal
|
|
52
|
+
});
|
|
53
|
+
return isCancel(answer) ? null : answer;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function askText(opts) {
|
|
57
|
+
const { text, isCancel } = await import("./dist-3LOO6M4U.js");
|
|
58
|
+
const streams = resolveStreams(opts.streams ?? {});
|
|
59
|
+
return withInputEnd(streams, null, async (signal) => {
|
|
60
|
+
const answer = await text({
|
|
61
|
+
message: opts.message,
|
|
62
|
+
...opts.placeholder !== void 0 ? { placeholder: opts.placeholder } : {},
|
|
63
|
+
input: streams.input,
|
|
64
|
+
output: streams.output,
|
|
65
|
+
signal
|
|
66
|
+
});
|
|
67
|
+
return isCancel(answer) ? null : answer;
|
|
68
|
+
});
|
|
69
|
+
}
|
|
37
70
|
async function confirmChoice(message, initialValue = true, streams = {}) {
|
|
38
71
|
const { confirm, isCancel } = await import("./dist-3LOO6M4U.js");
|
|
39
72
|
const resolved = resolveStreams(streams);
|
|
@@ -50,6 +83,8 @@ async function confirmChoice(message, initialValue = true, streams = {}) {
|
|
|
50
83
|
}
|
|
51
84
|
|
|
52
85
|
export {
|
|
86
|
+
selectOne,
|
|
87
|
+
askText,
|
|
53
88
|
confirmChoice
|
|
54
89
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-P7LABKCW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/clack.ts"],"sourcesContent":["import type { Readable, Writable } from 'node:stream';\n\n/**\n * The pretty-prompt renderer behind the install walkthrough's seams.\n *\n * @clack/prompts is a devDependency BUNDLED by tsup (published `dependencies`\n * stays `{}`), and every entry point here is behind a dynamic `import()` so it\n * lands in its own split chunk: a `search` or `doctor` run never parses it.\n *\n * Nothing in this module is reachable from a machine run. Commands call it only\n * on the real interactive path (a TTY on both stdout and stdin, no `--json`),\n * and always through an injectable seam, so unit tests supply answers directly\n * and never touch clack or a terminal.\n *\n * Prompts render on STDERR, like every other prompt in this CLI: stdout carries\n * the human walkthrough (or a single JSON envelope) and must not be interleaved\n * with prompt chrome.\n */\n\n/** Cancel (ctrl-C, escape) is not an answer. Callers map `null` to their own default. */\nexport type Cancelled = null;\n\nexport interface SelectChoice<T extends string> {\n value: T;\n label: string;\n /** The one line of consequence shown beside the label. */\n hint?: string;\n}\n\n/** Streams a prompt reads and draws on. Injected by tests; defaults to the real ones. */\ninterface PromptStreams {\n input?: Readable;\n output?: Writable;\n}\n\n/** DECTCUM show-cursor. Written on the EOF path in case the prompt did not get to. */\nconst SHOW_CURSOR = '\\x1b[?25h';\n\n/**\n * Settle a prompt when its input goes away instead of hanging forever.\n *\n * Ctrl-D at a clack prompt leaves its promise unsettled: no resolve, no reject,\n * no cancel symbol. The process then dies on an unsettled top-level await with\n * exit 13, nothing printed, and the cursor still hidden. The readline seam this\n * replaced handled it on purpose (\"ctrl-D mid-prompt reads as the default\"), and\n * that behavior has to survive the renderer swap.\n *\n * \"Input goes away\" is two different events, and only covering one of them was\n * the original bug:\n *\n * - The STREAM ends. A pipe closes, a harness detaches, stdin was already at\n * EOF. Caught via `end` / `close`.\n * - The ctrl-D BYTE (0x04) arrives with the stream still open. This is what a\n * real terminal sends, and it is the common case. A prompt puts stdin in raw\n * mode, where 0x04 is ordinary data rather than EOF, so no stream event ever\n * fires; clack has no binding for it and simply keeps waiting. Caught via the\n * `keypress` decoder readline installs, which is a read-only view of the same\n * bytes: listening there takes nothing away from the prompt, where a `data`\n * listener would risk flipping the stream to flowing before clack reads it.\n *\n * Two mechanisms settle it, because one of them is advisory. The AbortSignal is\n * clack's own teardown: it flips the prompt to `cancel`, which restores the\n * cursor and raw mode and resolves with the cancel symbol. The race is the\n * guarantee, for a prompt that is not yet listening or never settles anyway; on\n * that path we restore the cursor ourselves, since no prompt did.\n */\nfunction withInputEnd<T>(\n streams: Required<PromptStreams>,\n onEnd: T,\n run: (signal: AbortSignal) => Promise<T>,\n): Promise<T> {\n const controller = new AbortController();\n let settleEnd: (() => void) | undefined;\n const ended = new Promise<T>((resolve) => {\n settleEnd = () => {\n streams.output.write(SHOW_CURSOR);\n resolve(onEnd);\n };\n });\n\n const end = (): void => {\n controller.abort();\n settleEnd?.();\n };\n const onKeypress = (_text: string | undefined, key?: { name?: string; ctrl?: boolean }): void => {\n if (key?.ctrl === true && key.name === 'd') end();\n };\n\n streams.input.on('keypress', onKeypress);\n // A stream that finished before we got here never emits `end` again, so ask.\n if (streams.input.readableEnded) {\n queueMicrotask(end);\n } else {\n streams.input.once('end', end);\n streams.input.once('close', end);\n }\n\n return Promise.race([run(controller.signal), ended]).finally(() => {\n streams.input.off('keypress', onKeypress);\n streams.input.off('end', end);\n streams.input.off('close', end);\n });\n}\n\nfunction resolveStreams(streams: PromptStreams): Required<PromptStreams> {\n return { input: streams.input ?? process.stdin, output: streams.output ?? process.stderr };\n}\n\n/**\n * A single-choice list. Returns the chosen value, or `null` when the operator\n * cancelled or the input ended, both of which callers treat as \"leave everything\n * as it was\".\n */\nexport async function selectOne<T extends string>(opts: {\n message: string;\n choices: readonly SelectChoice<T>[];\n initialValue: T;\n streams?: PromptStreams;\n}): Promise<T | Cancelled> {\n const { select, isCancel } = await import('@clack/prompts');\n const streams = resolveStreams(opts.streams ?? {});\n return withInputEnd<T | Cancelled>(streams, null, async (signal) => {\n // Instantiated at `string`, not at `T`: clack's `Option<Value>` is a conditional\n // type that a generic `T extends string` cannot resolve. The values come from\n // this call's own choices, so narrowing the answer back is sound.\n const answer = await select<string>({\n message: opts.message,\n options: opts.choices.map((c) => ({\n value: c.value as string,\n label: c.label,\n ...(c.hint !== undefined ? { hint: c.hint } : {}),\n })),\n initialValue: opts.initialValue,\n input: streams.input,\n output: streams.output,\n signal,\n });\n return isCancel(answer) ? null : (answer as T);\n });\n}\n\n/** A multi-choice list. Returns the selected values, or `null` when cancelled. */\nexport async function selectMany<T extends string>(opts: {\n message: string;\n choices: readonly SelectChoice<T>[];\n initialValues: readonly T[];\n required?: boolean;\n streams?: PromptStreams;\n}): Promise<T[] | Cancelled> {\n const { multiselect, isCancel } = await import('@clack/prompts');\n const streams = resolveStreams(opts.streams ?? {});\n return withInputEnd<T[] | Cancelled>(streams, null, async (signal) => {\n const answer = await multiselect<string>({\n message: opts.message,\n options: opts.choices.map((c) => ({\n value: c.value as string,\n label: c.label,\n ...(c.hint !== undefined ? { hint: c.hint } : {}),\n })),\n initialValues: [...opts.initialValues] as string[],\n required: opts.required ?? true,\n input: streams.input,\n output: streams.output,\n signal,\n });\n return isCancel(answer) ? null : (answer as T[]);\n });\n}\n\n/** A yes/no confirm. Cancelling, or an input that ends, reads as no. */\nexport async function confirmChoice(\n message: string,\n initialValue = true,\n streams: PromptStreams = {},\n): Promise<boolean> {\n const { confirm, isCancel } = await import('@clack/prompts');\n const resolved = resolveStreams(streams);\n return withInputEnd<boolean>(resolved, false, async (signal) => {\n const answer = await confirm({\n message,\n initialValue,\n input: resolved.input,\n output: resolved.output,\n signal,\n });\n return isCancel(answer) ? false : answer;\n });\n}\n\n/** Open the walkthrough's prompt sequence with a title bar. */\nexport async function intro(message: string): Promise<void> {\n const clack = await import('@clack/prompts');\n clack.intro(message, { output: process.stderr });\n}\n\n/** Close it, so the last prompt is not left dangling above plain stdout lines. */\nexport async function outro(message: string): Promise<void> {\n const clack = await import('@clack/prompts');\n clack.outro(message, { output: process.stderr });\n}\n"],"mappings":";;;AAoCA,IAAM,cAAc;AA8BpB,SAAS,aACP,SACA,OACA,KACY;AACZ,QA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AQ;AAAA,EACpC,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/clack.ts"],"sourcesContent":["import type { Readable, Writable } from 'node:stream';\n\n/**\n * The pretty-prompt renderer behind the install walkthrough's seams.\n *\n * @clack/prompts is a devDependency BUNDLED by tsup (published `dependencies`\n * stays `{}`), and every entry point here is behind a dynamic `import()` so it\n * lands in its own split chunk: a `search` or `doctor` run never parses it.\n *\n * Nothing in this module is reachable from a machine run. Commands call it only\n * on the real interactive path (a TTY on both stdout and stdin, no `--json`),\n * and always through an injectable seam, so unit tests supply answers directly\n * and never touch clack or a terminal.\n *\n * Prompts render on STDERR, like every other prompt in this CLI: stdout carries\n * the human walkthrough (or a single JSON envelope) and must not be interleaved\n * with prompt chrome.\n */\n\n/** Cancel (ctrl-C, escape) is not an answer. Callers map `null` to their own default. */\nexport type Cancelled = null;\n\nexport interface SelectChoice<T extends string> {\n value: T;\n label: string;\n /** The one line of consequence shown beside the label. */\n hint?: string;\n}\n\n/** Streams a prompt reads and draws on. Injected by tests; defaults to the real ones. */\ninterface PromptStreams {\n input?: Readable;\n output?: Writable;\n}\n\n/** DECTCUM show-cursor. Written on the EOF path in case the prompt did not get to. */\nconst SHOW_CURSOR = '\\x1b[?25h';\n\n/**\n * Settle a prompt when its input goes away instead of hanging forever.\n *\n * Ctrl-D at a clack prompt leaves its promise unsettled: no resolve, no reject,\n * no cancel symbol. The process then dies on an unsettled top-level await with\n * exit 13, nothing printed, and the cursor still hidden. The readline seam this\n * replaced handled it on purpose (\"ctrl-D mid-prompt reads as the default\"), and\n * that behavior has to survive the renderer swap.\n *\n * \"Input goes away\" is two different events, and only covering one of them was\n * the original bug:\n *\n * - The STREAM ends. A pipe closes, a harness detaches, stdin was already at\n * EOF. Caught via `end` / `close`.\n * - The ctrl-D BYTE (0x04) arrives with the stream still open. This is what a\n * real terminal sends, and it is the common case. A prompt puts stdin in raw\n * mode, where 0x04 is ordinary data rather than EOF, so no stream event ever\n * fires; clack has no binding for it and simply keeps waiting. Caught via the\n * `keypress` decoder readline installs, which is a read-only view of the same\n * bytes: listening there takes nothing away from the prompt, where a `data`\n * listener would risk flipping the stream to flowing before clack reads it.\n *\n * Two mechanisms settle it, because one of them is advisory. The AbortSignal is\n * clack's own teardown: it flips the prompt to `cancel`, which restores the\n * cursor and raw mode and resolves with the cancel symbol. The race is the\n * guarantee, for a prompt that is not yet listening or never settles anyway; on\n * that path we restore the cursor ourselves, since no prompt did.\n */\nfunction withInputEnd<T>(\n streams: Required<PromptStreams>,\n onEnd: T,\n run: (signal: AbortSignal) => Promise<T>,\n): Promise<T> {\n const controller = new AbortController();\n let settleEnd: (() => void) | undefined;\n const ended = new Promise<T>((resolve) => {\n settleEnd = () => {\n streams.output.write(SHOW_CURSOR);\n resolve(onEnd);\n };\n });\n\n const end = (): void => {\n controller.abort();\n settleEnd?.();\n };\n const onKeypress = (_text: string | undefined, key?: { name?: string; ctrl?: boolean }): void => {\n if (key?.ctrl === true && key.name === 'd') end();\n };\n\n streams.input.on('keypress', onKeypress);\n // A stream that finished before we got here never emits `end` again, so ask.\n if (streams.input.readableEnded) {\n queueMicrotask(end);\n } else {\n streams.input.once('end', end);\n streams.input.once('close', end);\n }\n\n return Promise.race([run(controller.signal), ended]).finally(() => {\n streams.input.off('keypress', onKeypress);\n streams.input.off('end', end);\n streams.input.off('close', end);\n });\n}\n\nfunction resolveStreams(streams: PromptStreams): Required<PromptStreams> {\n return { input: streams.input ?? process.stdin, output: streams.output ?? process.stderr };\n}\n\n/**\n * A single-choice list. Returns the chosen value, or `null` when the operator\n * cancelled or the input ended, both of which callers treat as \"leave everything\n * as it was\".\n */\nexport async function selectOne<T extends string>(opts: {\n message: string;\n choices: readonly SelectChoice<T>[];\n initialValue: T;\n streams?: PromptStreams;\n}): Promise<T | Cancelled> {\n const { select, isCancel } = await import('@clack/prompts');\n const streams = resolveStreams(opts.streams ?? {});\n return withInputEnd<T | Cancelled>(streams, null, async (signal) => {\n // Instantiated at `string`, not at `T`: clack's `Option<Value>` is a conditional\n // type that a generic `T extends string` cannot resolve. The values come from\n // this call's own choices, so narrowing the answer back is sound.\n const answer = await select<string>({\n message: opts.message,\n options: opts.choices.map((c) => ({\n value: c.value as string,\n label: c.label,\n ...(c.hint !== undefined ? { hint: c.hint } : {}),\n })),\n initialValue: opts.initialValue,\n input: streams.input,\n output: streams.output,\n signal,\n });\n return isCancel(answer) ? null : (answer as T);\n });\n}\n\n/** A multi-choice list. Returns the selected values, or `null` when cancelled. */\nexport async function selectMany<T extends string>(opts: {\n message: string;\n choices: readonly SelectChoice<T>[];\n initialValues: readonly T[];\n required?: boolean;\n streams?: PromptStreams;\n}): Promise<T[] | Cancelled> {\n const { multiselect, isCancel } = await import('@clack/prompts');\n const streams = resolveStreams(opts.streams ?? {});\n return withInputEnd<T[] | Cancelled>(streams, null, async (signal) => {\n const answer = await multiselect<string>({\n message: opts.message,\n options: opts.choices.map((c) => ({\n value: c.value as string,\n label: c.label,\n ...(c.hint !== undefined ? { hint: c.hint } : {}),\n })),\n initialValues: [...opts.initialValues] as string[],\n required: opts.required ?? true,\n input: streams.input,\n output: streams.output,\n signal,\n });\n return isCancel(answer) ? null : (answer as T[]);\n });\n}\n\n/** A one-line answer. Returns what was typed, or `null` when cancelled or the input ended. */\nexport async function askText(opts: {\n message: string;\n placeholder?: string;\n streams?: PromptStreams;\n}): Promise<string | Cancelled> {\n const { text, isCancel } = await import('@clack/prompts');\n const streams = resolveStreams(opts.streams ?? {});\n return withInputEnd<string | Cancelled>(streams, null, async (signal) => {\n const answer = await text({\n message: opts.message,\n ...(opts.placeholder !== undefined ? { placeholder: opts.placeholder } : {}),\n input: streams.input,\n output: streams.output,\n signal,\n });\n return isCancel(answer) ? null : answer;\n });\n}\n\n/** A yes/no confirm. Cancelling, or an input that ends, reads as no. */\nexport async function confirmChoice(\n message: string,\n initialValue = true,\n streams: PromptStreams = {},\n): Promise<boolean> {\n const { confirm, isCancel } = await import('@clack/prompts');\n const resolved = resolveStreams(streams);\n return withInputEnd<boolean>(resolved, false, async (signal) => {\n const answer = await confirm({\n message,\n initialValue,\n input: resolved.input,\n output: resolved.output,\n signal,\n });\n return isCancel(answer) ? false : answer;\n });\n}\n\n/** Open the walkthrough's prompt sequence with a title bar. */\nexport async function intro(message: string): Promise<void> {\n const clack = await import('@clack/prompts');\n clack.intro(message, { output: process.stderr });\n}\n\n/** Close it, so the last prompt is not left dangling above plain stdout lines. */\nexport async function outro(message: string): Promise<void> {\n const clack = await import('@clack/prompts');\n clack.outro(message, { output: process.stderr });\n}\n"],"mappings":";;;AAoCA,IAAM,cAAc;AA8BpB,SAAS,aACP,SACA,OACA,KACY;AACZ,QAAM,aAAa,IAAI,gBAAgB;AACvC,MAAI;AACJ,QAAM,QAAQ,IAAI,QAAW,CAAC,YAAY;AACxC,gBAAY,MAAM;AAChB,cAAQ,OAAO,MAAM,WAAW;AAChC,cAAQ,KAAK;AAAA,IACf;AAAA,EACF,CAAC;AAED,QAAM,MAAM,MAAY;AACtB,eAAW,MAAM;AACjB,gBAAY;AAAA,EACd;AACA,QAAM,aAAa,CAAC,OAA2B,QAAkD;AAC/F,QAAI,KAAK,SAAS,QAAQ,IAAI,SAAS,IAAK,KAAI;AAAA,EAClD;AAEA,UAAQ,MAAM,GAAG,YAAY,UAAU;AAEvC,MAAI,QAAQ,MAAM,eAAe;AAC/B,mBAAe,GAAG;AAAA,EACpB,OAAO;AACL,YAAQ,MAAM,KAAK,OAAO,GAAG;AAC7B,YAAQ,MAAM,KAAK,SAAS,GAAG;AAAA,EACjC;AAEA,SAAO,QAAQ,KAAK,CAAC,IAAI,WAAW,MAAM,GAAG,KAAK,CAAC,EAAE,QAAQ,MAAM;AACjE,YAAQ,MAAM,IAAI,YAAY,UAAU;AACxC,YAAQ,MAAM,IAAI,OAAO,GAAG;AAC5B,YAAQ,MAAM,IAAI,SAAS,GAAG;AAAA,EAChC,CAAC;AACH;AAEA,SAAS,eAAe,SAAiD;AACvE,SAAO,EAAE,O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O;AACvC,SAAO,aAAsB,UAAU,OAAO,OAAO,WAAW;AAC9D,UAAM,SAAS,MAAM,QAAQ;AAAA,MAC3B;AAAA,MACA;AAAA,MACA,OAAO,SAAS;AAAA,MAChB,QAAQ,SAAS;AAAA,MACjB;AAAA,IACF,CAAC;AACD,WAAO,SAAS,MAAM,IAAI,QAAQ;AAAA,EACpC,CAAC;AACH;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
PRODUCTION_ORIGIN
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-P22ZWXFX.js";
|
|
5
5
|
import {
|
|
6
6
|
package_default
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZNZGBUV6.js";
|
|
8
8
|
import {
|
|
9
9
|
CliError
|
|
10
10
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -288,4 +288,4 @@ export {
|
|
|
288
288
|
httpRequest,
|
|
289
289
|
fetchFailureToCliError
|
|
290
290
|
};
|
|
291
|
-
//# sourceMappingURL=chunk-
|
|
291
|
+
//# sourceMappingURL=chunk-RCJ64OXH.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __tenjinCreateRequire } from 'node:module'; const require = __tenjinCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
package_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZNZGBUV6.js";
|
|
5
5
|
import {
|
|
6
6
|
CliError,
|
|
7
7
|
HARNESSES,
|
|
@@ -1781,4 +1781,4 @@ export {
|
|
|
1781
1781
|
registeredHooks,
|
|
1782
1782
|
writeHooks
|
|
1783
1783
|
};
|
|
1784
|
-
//# sourceMappingURL=chunk-
|
|
1784
|
+
//# sourceMappingURL=chunk-SQSKVKX6.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
isSameDeployment,
|
|
12
12
|
loadRawConfig,
|
|
13
13
|
resolveSettings
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-P22ZWXFX.js";
|
|
15
15
|
import {
|
|
16
16
|
CliError
|
|
17
17
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -239,4 +239,4 @@ export {
|
|
|
239
239
|
ownedCandidates,
|
|
240
240
|
projectRoot
|
|
241
241
|
};
|
|
242
|
-
//# sourceMappingURL=chunk-
|
|
242
|
+
//# sourceMappingURL=chunk-TMLCEPCD.js.map
|
|
@@ -30,28 +30,28 @@ import {
|
|
|
30
30
|
} from "./chunk-LHHMV4GU.js";
|
|
31
31
|
import {
|
|
32
32
|
USDC_ADDRESS
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-FFL5M5BC.js";
|
|
34
34
|
import {
|
|
35
35
|
describeWallet,
|
|
36
36
|
resolveSpendAuthorizer,
|
|
37
37
|
resolveWalletProvider
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-GPLSNGKX.js";
|
|
39
39
|
import {
|
|
40
40
|
getAddress
|
|
41
41
|
} from "./chunk-EGELTSPU.js";
|
|
42
42
|
import {
|
|
43
43
|
sanitizeForTerminal
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-O2WN732M.js";
|
|
45
45
|
import {
|
|
46
46
|
mask
|
|
47
47
|
} from "./chunk-7QKHZQKW.js";
|
|
48
48
|
import {
|
|
49
49
|
fetchFailureToCliError,
|
|
50
50
|
httpRequest
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-RCJ64OXH.js";
|
|
52
52
|
import {
|
|
53
53
|
resolveContextSettings
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-TMLCEPCD.js";
|
|
55
55
|
import {
|
|
56
56
|
parseUsdToAtomic,
|
|
57
57
|
toMoney
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
external_exports,
|
|
61
61
|
isSameDeployment,
|
|
62
62
|
readUsdcBalanceWithFallback
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-P22ZWXFX.js";
|
|
64
64
|
import {
|
|
65
65
|
CliError
|
|
66
66
|
} from "./chunk-JLEF5WHM.js";
|
|
@@ -8586,7 +8586,7 @@ var import_ajv_formats = __toESM(require_dist(), 1);
|
|
|
8586
8586
|
import { createHash } from "node:crypto";
|
|
8587
8587
|
var MAX_SCHEMA_BYTES = 96 * 1024;
|
|
8588
8588
|
var MAX_VALUE_BYTES = 64 * 1024;
|
|
8589
|
-
var MAX_BODY_BYTES =
|
|
8589
|
+
var MAX_BODY_BYTES = 4 * 1024 * 1024;
|
|
8590
8590
|
var MAX_DEPTH = 24;
|
|
8591
8591
|
var VALIDATOR_CACHE_LIMIT = 128;
|
|
8592
8592
|
var DRAFT_07 = "http://json-schema.org/draft-07/schema#";
|
|
@@ -8622,11 +8622,11 @@ function walk(value, schemaMode, depth = 0) {
|
|
|
8622
8622
|
}
|
|
8623
8623
|
}
|
|
8624
8624
|
var validators = /* @__PURE__ */ new Map();
|
|
8625
|
-
function compile(schema, { allErrors = false, ignoreUnknown = false } = {}) {
|
|
8625
|
+
function compile(schema, { allErrors = false, ignoreUnknown = false, project = false } = {}) {
|
|
8626
8626
|
if (Buffer.byteLength(stable(schema)) > MAX_SCHEMA_BYTES) {
|
|
8627
8627
|
throw new Error("Schema exceeds its size limit.");
|
|
8628
8628
|
}
|
|
8629
|
-
const key = `${canonicalHash(schema)}${allErrors ? ":all" : ""}${ignoreUnknown ? ":lenient" : ""}`;
|
|
8629
|
+
const key = `${canonicalHash(schema)}${allErrors ? ":all" : ""}${ignoreUnknown ? ":lenient" : ""}${project ? ":project" : ""}`;
|
|
8630
8630
|
const cached = validators.get(key);
|
|
8631
8631
|
if (cached !== void 0) return cached;
|
|
8632
8632
|
walk(schema, true);
|
|
@@ -8640,7 +8640,7 @@ function compile(schema, { allErrors = false, ignoreUnknown = false } = {}) {
|
|
|
8640
8640
|
validateFormats: true,
|
|
8641
8641
|
coerceTypes: false,
|
|
8642
8642
|
useDefaults: false,
|
|
8643
|
-
removeAdditional: false,
|
|
8643
|
+
removeAdditional: project ? "all" : false,
|
|
8644
8644
|
allowUnionTypes: true
|
|
8645
8645
|
};
|
|
8646
8646
|
const ajv = schema.$schema === DRAFT_07 ? new import_ajv.default(options) : new import__.default(options);
|
|
@@ -8653,16 +8653,11 @@ function compile(schema, { allErrors = false, ignoreUnknown = false } = {}) {
|
|
|
8653
8653
|
validators.set(key, compiled);
|
|
8654
8654
|
return compiled;
|
|
8655
8655
|
}
|
|
8656
|
-
function
|
|
8656
|
+
function checkValue(schema, value) {
|
|
8657
8657
|
try {
|
|
8658
8658
|
if (schema === null || typeof schema !== "object" || Array.isArray(schema)) {
|
|
8659
8659
|
throw new Error("A schema must be a JSON Schema object.");
|
|
8660
8660
|
}
|
|
8661
|
-
const json = JSON.stringify(value);
|
|
8662
|
-
if (json === void 0 || Buffer.byteLength(json) > MAX_VALUE_BYTES) {
|
|
8663
|
-
throw new Error("The value is not JSON, or exceeds its size limit.");
|
|
8664
|
-
}
|
|
8665
|
-
walk(value, false);
|
|
8666
8661
|
const validate = compile(schema);
|
|
8667
8662
|
if (validate(value)) return { valid: true, errors: [] };
|
|
8668
8663
|
return {
|
|
@@ -8739,13 +8734,13 @@ function preview(body) {
|
|
|
8739
8734
|
}
|
|
8740
8735
|
function validateResultBody(schema, body) {
|
|
8741
8736
|
const bytes = Buffer.byteLength(body);
|
|
8742
|
-
const base = { json: false, bytes, maxBytes: MAX_BODY_BYTES, preview: preview(body) };
|
|
8737
|
+
const base = () => ({ json: false, bytes, maxBytes: MAX_BODY_BYTES, preview: preview(body) });
|
|
8743
8738
|
if (bytes > MAX_BODY_BYTES) {
|
|
8744
8739
|
return {
|
|
8745
8740
|
valid: false,
|
|
8746
8741
|
unvalidated: true,
|
|
8747
8742
|
reason: `The result is ${bytes} bytes, over the ${MAX_BODY_BYTES} byte validation limit, so its success schema was not checked.`,
|
|
8748
|
-
diagnosis: { ...base, failed: "too-large" }
|
|
8743
|
+
diagnosis: { ...base(), failed: "too-large" }
|
|
8749
8744
|
};
|
|
8750
8745
|
}
|
|
8751
8746
|
let value;
|
|
@@ -8756,18 +8751,35 @@ function validateResultBody(schema, body) {
|
|
|
8756
8751
|
return {
|
|
8757
8752
|
valid: false,
|
|
8758
8753
|
reason: `The result is not a supported bounded JSON document (${err instanceof Error ? err.message : String(err)}).`,
|
|
8759
|
-
diagnosis: { ...base, failed: "not-json" }
|
|
8754
|
+
diagnosis: { ...base(), failed: "not-json" }
|
|
8760
8755
|
};
|
|
8761
8756
|
}
|
|
8762
|
-
const check =
|
|
8757
|
+
const check = checkValue(schema, value);
|
|
8763
8758
|
if (check.valid) return { valid: true };
|
|
8764
8759
|
const failed = check.errors[0] ?? "the success rule";
|
|
8765
8760
|
return {
|
|
8766
8761
|
valid: false,
|
|
8767
8762
|
reason: `The result does not satisfy its success schema: ${failed}`,
|
|
8768
|
-
diagnosis: { ...base, json: true, failed }
|
|
8763
|
+
diagnosis: { ...base(), json: true, failed }
|
|
8769
8764
|
};
|
|
8770
8765
|
}
|
|
8766
|
+
function projectBody(schema, body) {
|
|
8767
|
+
if (schema === null || typeof schema !== "object" || Array.isArray(schema)) return void 0;
|
|
8768
|
+
if (Buffer.byteLength(body) > MAX_BODY_BYTES) return void 0;
|
|
8769
|
+
try {
|
|
8770
|
+
const value = JSON.parse(body);
|
|
8771
|
+
walk(value, false);
|
|
8772
|
+
const project = compile(withoutPatterns(schema), {
|
|
8773
|
+
allErrors: true,
|
|
8774
|
+
ignoreUnknown: true,
|
|
8775
|
+
project: true
|
|
8776
|
+
});
|
|
8777
|
+
project(value);
|
|
8778
|
+
return { value };
|
|
8779
|
+
} catch {
|
|
8780
|
+
return void 0;
|
|
8781
|
+
}
|
|
8782
|
+
}
|
|
8771
8783
|
|
|
8772
8784
|
// src/lib/spend-gate.ts
|
|
8773
8785
|
async function gateSpend(input) {
|
|
@@ -10606,9 +10618,10 @@ export {
|
|
|
10606
10618
|
canonicalHash,
|
|
10607
10619
|
inputProblems,
|
|
10608
10620
|
assertResultSchema,
|
|
10621
|
+
projectBody,
|
|
10609
10622
|
runPay,
|
|
10610
10623
|
MAX_PAID_LEG_TIMEOUT_MS,
|
|
10611
10624
|
paidLegTimeoutMs,
|
|
10612
10625
|
settlementTx
|
|
10613
10626
|
};
|
|
10614
|
-
//# sourceMappingURL=chunk-
|
|
10627
|
+
//# sourceMappingURL=chunk-UBOFYC6J.js.map
|