tenjin-cli 0.1.0-alpha.5 → 0.1.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -199
- package/dist/{buy-YMXXVNFH.js → buy-K2G6XQY2.js} +20 -18
- package/dist/{candidate-H7FR4AU5.js → candidate-DJB2NNTG.js} +7 -8
- package/dist/{chunk-ZW3B5LWX.js → chunk-2YX6LTCD.js} +5 -5
- package/dist/{chunk-4WVKXKDK.js → chunk-6OE2IJMH.js} +29 -238
- package/dist/chunk-6OE2IJMH.js.map +1 -0
- package/dist/{chunk-ADJYSM45.js → chunk-6ZBZCBR7.js} +27 -13
- package/dist/chunk-6ZBZCBR7.js.map +1 -0
- package/dist/{chunk-HTDALK7M.js → chunk-B7YB4MMU.js} +15 -12
- package/dist/{chunk-HTDALK7M.js.map → chunk-B7YB4MMU.js.map} +1 -1
- package/dist/{chunk-NFSOVL3C.js → chunk-BBUYCDSG.js} +12 -3
- package/dist/chunk-BBUYCDSG.js.map +1 -0
- package/dist/chunk-C3S6725N.js +337 -0
- package/dist/chunk-C3S6725N.js.map +1 -0
- package/dist/chunk-CYRYVZPN.js +213 -0
- package/dist/chunk-CYRYVZPN.js.map +1 -0
- package/dist/{chunk-MDDGEGSW.js → chunk-DAJ56EUU.js} +3 -3
- package/dist/{chunk-IOPWPMT2.js → chunk-DH6D6QIO.js} +5 -5
- package/dist/{chunk-NJF2WENW.js → chunk-DQDGBWWH.js} +4 -2
- package/dist/chunk-DQDGBWWH.js.map +1 -0
- package/dist/chunk-EDENZN2Q.js +614 -0
- package/dist/chunk-EDENZN2Q.js.map +1 -0
- package/dist/chunk-GABYDXWL.js +190 -0
- package/dist/chunk-GABYDXWL.js.map +1 -0
- package/dist/{chunk-LAM66WFJ.js → chunk-GM4RZUVU.js} +6 -8
- package/dist/{chunk-LAM66WFJ.js.map → chunk-GM4RZUVU.js.map} +1 -1
- package/dist/{chunk-PAUXMRSF.js → chunk-J6CVKC4M.js} +73 -2
- package/dist/chunk-J6CVKC4M.js.map +1 -0
- package/dist/chunk-L6AV2Q73.js +105 -0
- package/dist/chunk-L6AV2Q73.js.map +1 -0
- package/dist/{chunk-PYNSGYBE.js → chunk-NVHQCTIC.js} +249 -552
- package/dist/chunk-NVHQCTIC.js.map +1 -0
- package/dist/{chunk-CVX6JNGD.js → chunk-OTDI5FXG.js} +3 -5
- package/dist/{chunk-CVX6JNGD.js.map → chunk-OTDI5FXG.js.map} +1 -1
- package/dist/{chunk-3IRDP7TN.js → chunk-P3FBESBB.js} +6 -4
- package/dist/{chunk-3IRDP7TN.js.map → chunk-P3FBESBB.js.map} +1 -1
- package/dist/{chunk-FU6MCSLG.js → chunk-PCLPVJ3J.js} +16 -78
- package/dist/chunk-PCLPVJ3J.js.map +1 -0
- package/dist/chunk-QB2NNV6C.js +143 -0
- package/dist/chunk-QB2NNV6C.js.map +1 -0
- package/dist/{chunk-C444K6MI.js → chunk-RGFBBNGP.js} +42 -17
- package/dist/{chunk-C444K6MI.js.map → chunk-RGFBBNGP.js.map} +1 -1
- package/dist/{chunk-TXPPMK4L.js → chunk-RGTTACP3.js} +5 -5
- package/dist/chunk-SGK2B724.js +67 -0
- package/dist/chunk-SGK2B724.js.map +1 -0
- package/dist/{chunk-ZDY2KY5X.js → chunk-URSGGRO4.js} +28 -11
- package/dist/chunk-URSGGRO4.js.map +1 -0
- package/dist/{chunk-5SCU253N.js → chunk-UYP7G3GZ.js} +2 -2
- package/dist/{chunk-ZIYVN4CD.js → chunk-VZ3AJCO5.js} +3 -5
- package/dist/{chunk-ZIYVN4CD.js.map → chunk-VZ3AJCO5.js.map} +1 -1
- package/dist/{chunk-QONTBYQW.js → chunk-WRWCDLVK.js} +4 -6
- package/dist/{chunk-QONTBYQW.js.map → chunk-WRWCDLVK.js.map} +1 -1
- package/dist/chunk-XBJ3VLWX.js +35 -0
- package/dist/chunk-XBJ3VLWX.js.map +1 -0
- package/dist/{chunk-RTJLLPFA.js → chunk-XFHZWORF.js} +123 -24
- package/dist/chunk-XFHZWORF.js.map +1 -0
- package/dist/{chunk-BIKAUVC2.js → chunk-ZA3RFDAV.js} +40 -6
- package/dist/chunk-ZA3RFDAV.js.map +1 -0
- package/dist/{cli-IW76QTN3.js → cli-KNCYWMAG.js} +237 -25
- package/dist/cli-KNCYWMAG.js.map +1 -0
- package/dist/{config-VCOS7P5K.js → config-SAQEQRFB.js} +5 -6
- package/dist/dist-U4M6QCKE.js +2842 -0
- package/dist/dist-U4M6QCKE.js.map +1 -0
- package/dist/{doctor-WS65JG3V.js → doctor-FBRQNOUQ.js} +10 -9
- package/dist/{publish-DSFWQRUN.js → edit-IZZ2HIMR.js} +20 -18
- package/dist/index.js +1 -1
- package/dist/{inspect-SFJWUQHO.js → inspect-BFWZ5XOP.js} +17 -16
- package/dist/{install-RVPQPCKH.js → install-QXZCHIBT.js} +400 -166
- package/dist/install-QXZCHIBT.js.map +1 -0
- package/dist/outcome-VXCBEGNC.js +20 -0
- package/dist/publish-5NTCRF2V.js +40 -0
- package/dist/read-T6OTMU72.js +158 -0
- package/dist/read-T6OTMU72.js.map +1 -0
- package/dist/{run-OMPKA43G.js → run-5OGX64IY.js} +106 -32
- package/dist/{run-OMPKA43G.js.map → run-5OGX64IY.js.map} +1 -1
- package/dist/search-LIIWUMWV.js +24 -0
- package/dist/{send-3G4C64HJ.js → send-ENE47KQE.js} +7 -7
- package/dist/session-HY4QIWHV.js +87 -0
- package/dist/session-HY4QIWHV.js.map +1 -0
- package/dist/{wallet-PP22LAX7.js → wallet-OCCGEH6H.js} +7 -7
- package/dist/{wallet-B7KJS2R5.js → wallet-RBDVNZVR.js} +5 -5
- package/dist/wallet-RBDVNZVR.js.map +1 -0
- package/docs/agent-permissions.md +255 -0
- package/package.json +3 -1
- package/skills/tenjin/SKILL.md +57 -13
- package/skills/tenjin-publish/SKILL.md +12 -4
- package/skills/tenjin-search/SKILL.md +68 -12
- package/dist/chunk-2JQ5JSG6.js +0 -68
- package/dist/chunk-2JQ5JSG6.js.map +0 -1
- package/dist/chunk-4WVKXKDK.js.map +0 -1
- package/dist/chunk-ADJYSM45.js.map +0 -1
- package/dist/chunk-BIKAUVC2.js.map +0 -1
- package/dist/chunk-FU6MCSLG.js.map +0 -1
- package/dist/chunk-L4IHCN6B.js +0 -63
- package/dist/chunk-L4IHCN6B.js.map +0 -1
- package/dist/chunk-NFSOVL3C.js.map +0 -1
- package/dist/chunk-NJF2WENW.js.map +0 -1
- package/dist/chunk-PAUXMRSF.js.map +0 -1
- package/dist/chunk-PYNSGYBE.js.map +0 -1
- package/dist/chunk-RTJLLPFA.js.map +0 -1
- package/dist/chunk-ZDY2KY5X.js.map +0 -1
- package/dist/cli-IW76QTN3.js.map +0 -1
- package/dist/install-RVPQPCKH.js.map +0 -1
- package/dist/outcome-GNYCSZ7J.js +0 -20
- package/dist/search-KOI6Y7P6.js +0 -24
- /package/dist/{buy-YMXXVNFH.js.map → buy-K2G6XQY2.js.map} +0 -0
- /package/dist/{candidate-H7FR4AU5.js.map → candidate-DJB2NNTG.js.map} +0 -0
- /package/dist/{chunk-ZW3B5LWX.js.map → chunk-2YX6LTCD.js.map} +0 -0
- /package/dist/{chunk-MDDGEGSW.js.map → chunk-DAJ56EUU.js.map} +0 -0
- /package/dist/{chunk-IOPWPMT2.js.map → chunk-DH6D6QIO.js.map} +0 -0
- /package/dist/{chunk-TXPPMK4L.js.map → chunk-RGTTACP3.js.map} +0 -0
- /package/dist/{chunk-5SCU253N.js.map → chunk-UYP7G3GZ.js.map} +0 -0
- /package/dist/{config-VCOS7P5K.js.map → config-SAQEQRFB.js.map} +0 -0
- /package/dist/{doctor-WS65JG3V.js.map → doctor-FBRQNOUQ.js.map} +0 -0
- /package/dist/{inspect-SFJWUQHO.js.map → edit-IZZ2HIMR.js.map} +0 -0
- /package/dist/{outcome-GNYCSZ7J.js.map → inspect-BFWZ5XOP.js.map} +0 -0
- /package/dist/{publish-DSFWQRUN.js.map → outcome-VXCBEGNC.js.map} +0 -0
- /package/dist/{search-KOI6Y7P6.js.map → publish-5NTCRF2V.js.map} +0 -0
- /package/dist/{wallet-B7KJS2R5.js.map → search-LIIWUMWV.js.map} +0 -0
- /package/dist/{send-3G4C64HJ.js.map → send-ENE47KQE.js.map} +0 -0
- /package/dist/{wallet-PP22LAX7.js.map → wallet-OCCGEH6H.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/install.ts","../src/lib/harness-permissions.ts","../src/lib/clack.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile, readdir, rm } from 'node:fs/promises';\nimport { fileURLToPath } from 'node:url';\nimport { join, relative } from 'node:path';\nimport { homedir } from 'node:os';\nimport { z } from 'zod';\nimport { styleText } from 'node:util';\nimport { Stream } from 'node:stream';\nimport { CliError } from '../lib/errors';\nimport { writeFileAtomic } from '../lib/atomic-json';\nimport { resolveSkillsSource, SKILL_NAMES } from '../lib/skills-source';\nimport {\n CLI_SKILL_NAMES,\n HARNESS_TARGETS,\n HOSTED_SKILL_NAME,\n harnessDetectedBy,\n harnessTargetDir,\n isModelInvocationDisabled,\n onPath,\n} from '../lib/skill-wiring';\nimport type { HarnessTarget } from '../lib/skill-wiring';\nimport {\n CONFIG_DEFAULTS,\n loadRawConfig,\n PublishModeSchema,\n parsePublishModeFlag,\n} from '../lib/config';\nimport type { PublishMode } from '../lib/config';\nimport { persistInstallHarness, persistPublishMode } from './config';\nimport { runWalletCreate } from './wallet';\nimport { collectDoctorChecks } from './doctor';\nimport type { DoctorDeps, DoctorChecks } from './doctor';\nimport { describeWallet, resolveWalletProvider } from '../lib/wallet';\nimport { walletFileExists } from '../lib/wallet/store';\nimport { recommendedPermissions } from '../lib/permissions';\nimport {\n FREE_VERB_RULES,\n permissionsSkipped,\n wireFreeVerbAllowlist,\n} from '../lib/harness-permissions';\nimport type { PermissionsResult } from '../lib/harness-permissions';\nimport { confirmChoice, intro as clackIntro, outro as clackOutro, selectOne } from '../lib/clack';\nimport { sanitizeForTerminal } from '../lib/output';\nimport type { Io } from '../lib/output';\nimport type { CommandContext, CommandResult } from '../context';\n\n// The `--harness` vocabulary and its directory mapping are single-sourced in\n// skill-wiring beside the detection probes, because `doctor` maps a persisted choice\n// back to a directory with the same rules.\nconst HARNESSES = HARNESS_TARGETS;\ntype Harness = HarnessTarget;\n\nconst InstallInputSchema = z.object({\n harness: z.array(z.string()).optional(),\n dryRun: z.boolean().optional(),\n publishMode: z.string().optional(),\n noWallet: z.boolean().optional(),\n /** Opt-in for the ~/.claude/CLAUDE.md nudge: true (--claude-md), false\n * (--no-claude-md), or undefined (skip). Never a question: the walkthrough is\n * capped at three decisions. */\n claudeMd: z.boolean().optional(),\n /** Wire the free-verb harness allowlist without asking (`--allow-free-verbs`). */\n allowFreeVerbs: z.boolean().optional(),\n});\nexport type InstallInput = z.infer<typeof InstallInputSchema>;\n\n/**\n * The publish-mode question's seam: returns the chosen mode, or `null` when the\n * operator cancelled (which changes nothing and writes nothing). The choices\n * themselves are {@link PUBLISH_MODE_CHOICES}; the seam exists so tests answer\n * in-process and never render a prompt.\n */\nexport type PromptPublishModeFn = () => Promise<PublishMode | null>;\n\n/** A yes/no seam, same shape as buy's `confirm`. */\nexport type ConfirmFn = (label: string) => Promise<boolean>;\n\ntype PublishModeSource = 'flag' | 'existing' | 'prompt' | 'default-skipped';\ninterface PublishModeSelection {\n value: PublishMode;\n source: PublishModeSource;\n}\n\n/** How the wallet step resolved, so rendering stays separate from prompting. */\ninterface WalletOutcome {\n status: 'existing' | 'created' | 'none';\n address?: string;\n}\n\n/**\n * The one line `install` keeps in an AGENTS.md (and, opt-in, in a CLAUDE.md) so the\n * harness reads it as global guidance, not the raw ~/.agents/skills scan. It is an\n * instinct nudge: run a free `tenjin search` before regenerating public research,\n * then a pointer to where the skills live. The HTML-comment marker keeps re-runs\n * idempotent: a matching line is left untouched, a drifted line (an older install's\n * copy) is rewritten in place, and an absent line is appended, so we never duplicate.\n */\nconst SKILLS_MARKER = '<!-- tenjin-cli:skills -->';\n\n/**\n * The instinct nudge line, pointed at `skillsDir`. One line, no em dashes: the\n * marker, the search-before-regenerating nudge, then where the skills live.\n */\nfunction nudgeLine(skillsDir: string): string {\n return `${SKILLS_MARKER} Tenjin: before regenerating public research (version-specific compatibility, integration gotchas, benchmarks, dated probes), run 'tenjin search \"<question>\" --json' first; it is free and anonymous but sends the generalized question text to tenjin.blog, so strip private identifiers. Skills (tenjin-search, tenjin-publish, tenjin) are installed at ${skillsDir}; read the relevant SKILL.md before using the CLI.`;\n}\n\n/**\n * Upsert the marker line into a file's text. Finds the existing marker line by its\n * marker prefix (not exact text) so an older install's drifted copy is recognized:\n * a matching line is `none`, a drifted line is `replace`d in place, an absent marker\n * is `append`ed. `content` is the text to write (null when nothing changes).\n */\nfunction upsertMarkerLine(\n existing: string | null,\n line: string,\n): { content: string | null; change: 'append' | 'replace' | 'none' } {\n const text = existing ?? '';\n if (!text.includes(SKILLS_MARKER)) {\n const prefix = text.length === 0 || text.endsWith('\\n') ? '' : '\\n';\n return { content: `${text}${prefix}${line}\\n`, change: 'append' };\n }\n const lines = text.split('\\n');\n const idx = lines.findIndex((l) => l.includes(SKILLS_MARKER));\n if (lines[idx] === line) return { content: null, change: 'none' };\n lines[idx] = line;\n return { content: lines.join('\\n'), change: 'replace' };\n}\n\n/**\n * The Codex config.toml rule the user must add by hand. We PRINT it, never edit\n * config.toml: Codex's default workspace-write sandbox blocks network, which would\n * make every paid x402 call fail (or prompt) until this is set.\n */\nconst CODEX_NETWORK_RULE = '[sandbox_workspace_write]\\nnetwork_access = true';\n\n/** Per-skill install outcome for one harness target. */\ninterface SkillResult {\n name: string;\n status: 'installed' | 'updated' | 'up-to-date' | 'would-install' | 'would-update';\n /** Was a real copy (a SKILL.md, not just the directory) already on disk before this run? */\n preexisting: boolean;\n /** Is this one of the two CLI adapter skills (as opposed to the hosted mirror)? */\n cli: boolean;\n /** Will a harness surface it to the model after this run? On a --dry-run nothing is\n * written, so it answers for the packaged copy that would land. */\n modelInvocable: boolean;\n}\n\ninterface AgentsMdResult {\n path: string;\n status: 'appended' | 'already-present' | 'updated' | 'would-append' | 'would-update';\n}\n\ninterface ClaudeMdResult {\n path: string;\n status: 'written' | 'up-to-date' | 'updated' | 'skipped' | 'would-write' | 'would-update';\n}\n\ninterface HarnessResult {\n harness: Harness;\n detected: boolean;\n detectedBy: string[];\n skillsDir: string;\n skills: SkillResult[];\n /**\n * Was the hosted zero-install `tenjin` skill already in this target before the\n * run? Reported so an upgrade over a hosted-skill machine is visible in `--json`,\n * which is exactly the state #35 was invisible in.\n */\n hostedPreexisting: boolean;\n agentsMd?: AgentsMdResult;\n claudeMd?: ClaudeMdResult;\n codexNetworkRule?: string;\n notes: string[];\n warnings: string[];\n}\n\nexport interface InstallDeps {\n /** Home directory root for harness detection + skill destinations. Tests inject a temp dir. */\n homeDir?: string;\n /** The packaged skills source directory. Defaults to resolving it from this module's location. */\n skillsSourceDir?: string;\n /** PATH probe for `claude`/`codex` binaries. Injectable so tests never depend on the real PATH. */\n which?: (bin: string) => boolean;\n /** Environment (PATH for the default `which`). Defaults to process.env. */\n env?: NodeJS.ProcessEnv;\n /** Doctor check collector; defaults to the real one. Injected in tests to avoid the network. */\n collectChecks?: (ctx: CommandContext) => Promise<DoctorChecks>;\n /** Deps forwarded to the default doctor collector (e.g. a canned fetch). */\n doctorDeps?: DoctorDeps;\n /** Decision 1: the publish-mode select; defaults to the clack list. */\n promptPublishMode?: PromptPublishModeFn;\n /** Decision 2: the permissions confirm (default yes); defaults to the clack confirm. */\n confirmPermissions?: ConfirmFn;\n /** Decision 3: \"Create a wallet now?\"; defaults to the clack confirm (default yes). */\n confirmWallet?: ConfirmFn;\n /** Prompt-sequence chrome. Seams so tests never load the renderer. */\n intro?: (message: string) => Promise<void>;\n outro?: (message: string) => Promise<void>;\n /** Whether the human walkthrough runs (TTY, no --json, stdin is a TTY). Injected in tests. */\n isInteractive?: boolean;\n /** Does a wallet already exist? Defaults to walletFileExists(dataDir). */\n walletExists?: (dataDir: string) => Promise<boolean>;\n /** An existing wallet's address, for the \"(existing)\" line. Defaults to the local provider. */\n walletAddress?: (ctx: CommandContext) => Promise<string>;\n /** Create a wallet and return its address. Defaults to runWalletCreate. */\n createWallet?: (ctx: CommandContext) => Promise<string>;\n}\n\n/**\n * `tenjin install`: detect the installed harness(es), copy the packaged skills\n * into each one's skills directory, wire the AGENTS.md pointer, run the doctor\n * checks, then ask AT MOST THREE questions (publishing, harness permissions,\n * wallet) and print a short summary. Everything that is not one of those three\n * decisions is display: the security reference material lives in `doctor` and\n * the README, not in the middle of a setup flow.\n *\n * Like every command it is human-first (the global output contract): at a TTY\n * without `--json` it prompts and returns the walkthrough as humanLines, which\n * the dispatcher prints to stdout with no envelope. With `--json` or piped\n * stdout it returns the envelope, no prompts, no wallet step. Idempotent: a\n * re-run reports up-to-date, never duplicates the AGENTS.md line, and adds no\n * permission rule twice. `--dry-run` writes nothing.\n */\nexport async function runInstall(\n input: InstallInput,\n ctx: CommandContext,\n deps: InstallDeps = {},\n): Promise<CommandResult> {\n const parsed = InstallInputSchema.safeParse(input);\n if (!parsed.success) {\n throw new CliError('USAGE', 'Invalid install options', {\n fix: 'Run `tenjin install --help`.',\n details: parsed.error.issues,\n });\n }\n const dryRun = parsed.data.dryRun === true;\n const noWallet = parsed.data.noWallet === true;\n const claudeMdFlag = parsed.data.claudeMd;\n const allowFreeVerbs = parsed.data.allowFreeVerbs === true;\n // Validate --publish-mode UP FRONT so a bad value fails before any wiring.\n const publishModeFlag =\n parsed.data.publishMode !== undefined ? parseModeFlag(parsed.data.publishMode) : undefined;\n const env = deps.env ?? process.env;\n const home = deps.homeDir ?? homedir();\n const which = deps.which ?? ((bin: string) => onPath(bin, env));\n\n // Human-first is the global output rule (emitSuccess renders humanLines at a TTY\n // without --json and no envelope). `humanOutput` matches that gate so install\n // returns its walkthrough as humanLines; `canPrompt` additionally needs stdin, so\n // a piped-stdin run still renders a walkthrough (with defaults, no wallet prompt).\n const humanOutput = ctx.flags.json === true ? false : (deps.isInteractive ?? ctx.io.isTTY);\n const canPrompt = humanOutput && (deps.isInteractive ?? Boolean(process.stdin.isTTY));\n\n const skillsSource =\n deps.skillsSourceDir ?? resolveSkillsSource(fileURLToPath(new URL('.', import.meta.url)));\n await assertSkillsSource(skillsSource);\n\n const plans = resolvePlans(parsed.data.harness, home, which);\n // Same condition resolvePlans treats as an override, so what gets recorded below is\n // exactly what overrode detection.\n const explicitHarness = parsed.data.harness !== undefined && parsed.data.harness.length > 0;\n // The CLAUDE.md nudge is flag-only now: `--claude-md` writes it, `--no-claude-md`\n // and an absent flag skip it. It used to be a fourth interactive question, and\n // the walkthrough's whole point is that there are three.\n const claudeMdWrite = claudeMdFlag === true;\n const harnesses: HarnessResult[] = [];\n for (const plan of plans) {\n harnesses.push(await applyPlan(plan, skillsSource, dryRun, claudeMdWrite));\n }\n await assertSkillsLanded(plans, dryRun);\n // An explicit --harness is REMEMBERED, before the embedded doctor run so this run's\n // own check already honours it. Detection cannot see a harness we do not probe for,\n // so without the record a directory the user named by hand is a target for one run\n // and then invisible to every later doctor — including for the #35 shadowing defect\n // it was chosen to hold. `--dry-run` records nothing, like the publish-mode write.\n if (explicitHarness && !dryRun) {\n await persistInstallHarness(\n ctx.dataDir,\n plans.map((p) => p.harness),\n );\n }\n // The embedded doctor run inspects the same `home` install just wrote into, so\n // its skill-wiring check reports THIS run's result rather than os.homedir()'s.\n // `which` goes with it: the check gates its verdicts on harness detection, and a\n // different probe there would judge directories this run never targeted.\n const doctorDeps: DoctorDeps = { ...(deps.doctorDeps ?? {}) };\n doctorDeps.homeDir ??= home;\n doctorDeps.which ??= which;\n const collect = deps.collectChecks ?? ((c) => collectDoctorChecks(c, doctorDeps));\n const doctor = await collect(ctx);\n\n // The three decisions, in order. Each one is skipped (with its own recorded\n // reason) when a flag already settled it or when there is no one to ask.\n if (canPrompt) await (deps.intro ?? clackIntro)('tenjin install');\n const publishMode = await resolvePublishMode(publishModeFlag, ctx, deps, dryRun, canPrompt);\n const permissions = await resolvePermissions({\n plans,\n home,\n deps,\n flag: allowFreeVerbs,\n dryRun,\n canPrompt,\n });\n // The wallet question belongs to the human walkthrough only: a machine run has\n // never created a key, and that stays true.\n const wallet = humanOutput\n ? await resolveWallet(ctx, deps, dryRun || !canPrompt || noWallet)\n : undefined;\n if (canPrompt) await (deps.outro ?? clackOutro)('Setup complete.');\n\n const data = {\n dryRun,\n skillsSource,\n harnesses,\n doctor: { status: doctor.failure !== undefined ? 'fail' : 'pass', checks: doctor.checks },\n publishMode,\n // Shipped with the install rather than left for the operator to discover after\n // their first auto-mode denial (#33). Static constants, no config key: see\n // lib/permissions.ts for why this is deliberately not operator-editable state.\n // `wired` is the outcome of THIS run's optional settings.json write; the three\n // recommendation tiers beside it are unchanged, so a machine consumer that\n // read `alwaysSafe` / `optIn` / `neverAllowlisted` before still does.\n permissions: { ...recommendedPermissions(), wired: permissions },\n };\n\n // Machine path (--json or piped stdout): today's envelope, no wallet step.\n if (!humanOutput) return { data };\n\n // Human path: the walkthrough as humanLines (the global emitSuccess prints them\n // to stdout at a TTY and never an envelope).\n const humanLines = buildWalkthrough(ctx.io, {\n dryRun,\n harnesses,\n publishMode,\n permissions,\n wallet: wallet ?? { status: 'none' },\n doctor,\n });\n return { data, humanLines };\n}\n\nconst EXAMPLE_QUESTION = \"what actually changed in <library> v3's public API\";\n\ninterface WalkthroughState {\n dryRun: boolean;\n harnesses: HarnessResult[];\n publishMode: PublishModeSelection;\n permissions: PermissionsResult;\n wallet: WalletOutcome;\n doctor: DoctorChecks;\n}\n\n/**\n * The human surface: anything that genuinely needs attention (a dry-run banner,\n * an overwrite warning, a consent disclosure, a failing check) followed by a\n * summary of at most five lines. On a clean install the summary IS the output.\n */\nfunction buildWalkthrough(io: Io, s: WalkthroughState): string[] {\n const lines: string[] = [];\n if (s.dryRun) lines.push(paint(io, 'yellow', 'Dry run: nothing was written.'));\n lines.push(...noticeLines(io, s));\n if (lines.length > 0) lines.push('');\n lines.push(...summaryLines(io, s));\n return lines;\n}\n\n/**\n * Everything above the summary: per-harness warnings, the Codex network rule,\n * the nudge disclosure and its undo, and any doctor check that is not ok. A\n * green doctor says nothing at all, so a clean run stays five lines.\n */\nfunction noticeLines(io: Io, s: WalkthroughState): string[] {\n const lines: string[] = [];\n for (const h of s.harnesses) {\n if (h.hostedPreexisting) {\n lines.push(\n paint(\n io,\n 'dim',\n `The hosted ${HOSTED_SKILL_NAME} skill was already here: kept as the zero-install fallback, and the CLI skills now take precedence.`,\n ),\n );\n }\n // When a nudge line was actually written or refreshed, disclose what it does\n // (question text leaves the machine) and how to undo it. This makes a re-run\n // that silently upgrades an older pointer line visible, not just the first write.\n const nudgePaths = nudgeFilesTouched(h);\n if (nudgePaths.length > 0) {\n lines.push(\n paint(\n io,\n 'dim',\n 'The nudge tells agents to run a free anonymous `tenjin search` before regenerating research; the generalized question text is sent to tenjin.blog.',\n ),\n );\n lines.push(\n paint(\n io,\n 'dim',\n `Undo anytime: delete the ${SKILLS_MARKER} line from ${nudgePaths.join(' and ')}.`,\n ),\n );\n }\n if (h.codexNetworkRule !== undefined) {\n lines.push(paint(io, 'dim', 'Codex blocks network by default; add to ~/.codex/config.toml:'));\n for (const rl of h.codexNetworkRule.split('\\n')) lines.push(paint(io, 'dim', ` ${rl}`));\n }\n for (const w of h.warnings) lines.push(paint(io, 'yellow', `! ${w}`));\n }\n if (s.permissions.warning !== undefined) {\n // Sanitized for the same reason doctorNotices sanitizes `detail`/`fix`: this\n // string embeds a V8 JSON parse error, and V8 quotes the offending input, so\n // ~20 bytes of whatever is in settings.json (escapes included) reach the\n // terminal at the moment we tell the operator we left their file alone.\n lines.push(paint(io, 'yellow', `! ${sanitizeForTerminal(s.permissions.warning)}`));\n }\n lines.push(...doctorNotices(io, s.doctor));\n return lines;\n}\n\n/**\n * The closing summary, capped at one line per subject: skills, publishing,\n * permissions, wallet, and the command to run next.\n */\nfunction summaryLines(io: Io, s: WalkthroughState): string[] {\n return [\n ...s.harnesses.map((h) => skillsLine(io, h, s.dryRun)),\n publishingLine(io, s.publishMode.value),\n permissionsLine(io, s.permissions),\n walletLine(io, s.wallet),\n `${paint(io, 'bold', 'Next:')} tenjin search \"${EXAMPLE_QUESTION}\"`,\n ];\n}\n\nfunction harnessLabel(h: Harness): string {\n return h === 'claude' ? 'Claude Code' : h === 'codex' ? 'Codex' : 'Agent Skills';\n}\n\n/**\n * One line per harness. It names the skills rather than counting them: #35\n * shipped as \"search worked, publish was simply absent\" on a machine that\n * already had the hosted skill, and a bare \"3 skills installed\" cannot tell you\n * publish is wired.\n */\nfunction skillsLine(io: Io, h: HarnessResult, dryRun: boolean): string {\n const changed = h.skills.some((s) => s.status !== 'up-to-date');\n const verb = dryRun ? 'would install' : changed ? 'installed' : 'up to date';\n const wired: string[] = [];\n if (h.agentsMd !== undefined) wired.push('AGENTS.md nudge');\n if (h.claudeMd !== undefined && h.claudeMd.status !== 'skipped') wired.push('CLAUDE.md nudge');\n const suffix = wired.length > 0 ? ` + ${wired.join(' + ')}` : '';\n const head = `${harnessLabel(h.harness)}: ${h.skills.length} skills ${verb}${suffix}`;\n return `${paint(io, 'green', '✓')} ${paint(io, 'bold', head)} in ${h.skillsDir}. ${skillRoster(h)}.`;\n}\n\n/** One line for the settled consent mode, with the same consequence the question showed. */\nfunction publishingLine(io: Io, mode: PublishMode): string {\n return `${paint(io, 'green', '✓')} ${paint(io, 'bold', `Publishing: ${mode}`)}. ${modeBlurb(mode)}`;\n}\n\n/**\n * One line for the harness allowlist: what landed, or what to run to get it. A\n * skip is never silent, because the operator's next auto-mode session is where\n * they would otherwise find out (#33).\n *\n * \"free\", never \"read-only\": see PERMISSIONS_QUESTION for why this tier cannot\n * honestly be called the latter. The line that reports a WRITE carries the\n * `doctor` pointer too, since that is the other moment an operator learns rules\n * landed without seeing them or the flag caveat that qualifies them.\n */\nfunction permissionsLine(io: Io, p: PermissionsResult): string {\n const label = paint(io, 'bold', 'Permissions:');\n if (p.added.length > 0) {\n return `${paint(io, 'green', '✓')} ${label} ${p.added.length} free tenjin commands added to ${p.path}. Full caveats: tenjin doctor`;\n }\n if (p.skipped === undefined) {\n return `${paint(io, 'green', '✓')} ${label} the ${FREE_VERB_RULES.length} free tenjin commands were already allowed in ${p.path}`;\n }\n if (p.skipped === 'harness-not-claude') {\n return `${paint(io, 'dim', '-')} ${label} not wired (Claude Code only). Run \\`tenjin doctor\\` for the lines your harness needs.`;\n }\n if (p.skipped === 'dry-run') {\n return `${paint(io, 'dim', '-')} ${label} unchanged (dry run).`;\n }\n if (p.skipped === 'declined') {\n return `${paint(io, 'dim', '-')} ${label} unchanged. Add them anytime: tenjin install --allow-free-verbs`;\n }\n if (p.skipped === 'not-requested') {\n return `${paint(io, 'dim', '-')} ${label} unchanged. Allow the ${FREE_VERB_RULES.length} free tenjin commands with: tenjin install --allow-free-verbs`;\n }\n return `${paint(io, 'yellow', '!')} ${label} ${p.path} was left untouched. Fix it, then: tenjin install --allow-free-verbs`;\n}\n\nfunction walletLine(io: Io, w: WalletOutcome): string {\n const label = paint(io, 'bold', 'Wallet:');\n if (w.status === 'existing') {\n return `${paint(io, 'green', '✓')} ${label} ${w.address} (existing). Check funds with: tenjin wallet balance`;\n }\n if (w.status === 'created') {\n return `${paint(io, 'green', '✓')} ${label} ${w.address}. Fund it with a few dollars of USDC on Base, then: tenjin wallet balance`;\n }\n return `${paint(io, 'dim', '-')} ${label} none. Create one later with: tenjin wallet create`;\n}\n\n/** `tenjin-search, tenjin-publish (CLI); tenjin (hosted, zero-install fallback)`. */\nfunction skillRoster(h: HarnessResult): string {\n const cli = h.skills.filter((s) => s.cli).map((s) => s.name);\n const hosted = h.skills.filter((s) => !s.cli).map((s) => s.name);\n const parts: string[] = [];\n if (cli.length > 0) parts.push(`${cli.join(', ')} (CLI)`);\n if (hosted.length > 0) parts.push(`${hosted.join(', ')} (hosted, zero-install fallback)`);\n return parts.join('; ');\n}\n\n/**\n * The nudge files whose marker line this run wrote or refreshed (append/update, and\n * their dry-run would-* previews). An untouched line (already-present / up-to-date)\n * or a skipped CLAUDE.md is not included, so the disclosure only fires on a change.\n */\nfunction nudgeFilesTouched(h: HarnessResult): string[] {\n const paths: string[] = [];\n if (\n h.agentsMd !== undefined &&\n ['appended', 'updated', 'would-append', 'would-update'].includes(h.agentsMd.status)\n ) {\n paths.push(h.agentsMd.path);\n }\n if (\n h.claudeMd !== undefined &&\n ['written', 'updated', 'would-write', 'would-update'].includes(h.claudeMd.status)\n ) {\n paths.push(h.claudeMd.path);\n }\n return paths;\n}\n\n/** The single line of consequence attached to a mode, wherever it is shown. */\nfunction modeBlurb(v: PublishMode): string {\n return v === 'auto'\n ? 'Your agent publishes clean pieces on its own; your harness still shows each command for approval.'\n : v === 'review'\n ? 'Your agent asks you in chat before every publish.'\n : 'Fully unattended; only hard blocks stop it.';\n}\n\n/**\n * Decision 3, unchanged in behavior: ask only when no wallet exists, and never\n * under `--no-wallet`, `--dry-run`, or a run we cannot prompt in.\n */\nasync function resolveWallet(\n ctx: CommandContext,\n deps: InstallDeps,\n skipCreate: boolean,\n): Promise<WalletOutcome> {\n const exists = await (deps.walletExists ?? walletFileExists)(ctx.dataDir);\n if (exists) {\n return {\n status: 'existing',\n address: await (deps.walletAddress ?? existingWalletAddress)(ctx),\n };\n }\n if (skipCreate) return { status: 'none' };\n\n const confirm = deps.confirmWallet ?? defaultConfirm;\n if (!(await confirm(WALLET_QUESTION))) return { status: 'none' };\n\n return { status: 'created', address: await (deps.createWallet ?? defaultCreateWallet)(ctx) };\n}\n\nasync function existingWalletAddress(ctx: CommandContext): Promise<string> {\n return (await describeWallet(resolveWalletProvider(ctx))).address;\n}\n\nasync function defaultCreateWallet(ctx: CommandContext): Promise<string> {\n const result = await runWalletCreate(ctx);\n return (result.data as { address: string }).address;\n}\n\n/** The shared confirm, defaulting to YES (setup ergonomics); cancel reads as no. */\nfunction defaultConfirm(label: string): Promise<boolean> {\n return confirmChoice(label, true);\n}\n\n/**\n * Doctor problems only. A fully green run prints nothing here: the summary is\n * the whole output, and \"everything checks out\" is what an absent warning means.\n */\nfunction doctorNotices(io: Io, doctor: DoctorChecks): string[] {\n const problems = doctor.checks.filter((c) => c.status !== 'ok');\n if (problems.length === 0) return [];\n const lines = [paint(io, 'yellow', 'Some checks need attention:')];\n for (const c of problems) {\n const icon = c.status === 'fail' ? paint(io, 'red', '✗') : paint(io, 'yellow', '!');\n // Same seam as renderDoctorHuman: `detail`/`fix` carry server-sourced substrings.\n lines.push(` ${icon} ${c.name}: ${sanitizeForTerminal(c.detail)}`);\n if (c.fix !== undefined) {\n lines.push(paint(io, 'dim', ` fix: ${sanitizeForTerminal(c.fix)}`));\n }\n }\n return lines;\n}\n\n// --- Publish-mode selection (D38 setup) ------------------------------------------\n\n/**\n * The STORED default: what a non-interactive run, a cancelled question, or a\n * `--dry-run` leaves `publish.mode` at, which is to say unset. It is deliberately\n * NOT the interactively recommended answer below: recommending `auto` is a thing\n * we do to a human who is looking at the consequence, never a thing that happens\n * to a machine run that was never asked.\n */\nconst DEFAULT_MODE: PublishMode = CONFIG_DEFAULTS.publish.mode;\n\n/** Decision 1's literal copy: one line of consequence per option, `auto` first. */\nexport const PUBLISH_MODE_CHOICES = [\n {\n value: 'auto',\n label: 'Auto (recommended)',\n hint: 'your agent publishes clean pieces on its own; your harness still shows each command for approval',\n },\n { value: 'review', label: 'Ask me in chat first' },\n { value: 'full-auto', label: 'Fully unattended', hint: 'only hard blocks stop it' },\n] as const satisfies readonly { value: PublishMode; label: string; hint?: string }[];\n\nexport const PUBLISH_MODE_QUESTION = 'When your agent has something worth publishing:';\n\n/**\n * Resolve (and, for an explicit choice, persist) the publish consent mode at\n * install time. Precedence: `--publish-mode` flag > an already-configured global\n * mode > the interactive select > the untouched default. Only an explicit choice\n * writes: a cancelled select, a non-interactive run, and `--dry-run` all leave\n * `publish.mode` unset so its provenance stays `default`.\n */\nasync function resolvePublishMode(\n flag: PublishMode | undefined,\n ctx: CommandContext,\n deps: InstallDeps,\n dryRun: boolean,\n interactive: boolean,\n): Promise<PublishModeSelection> {\n if (flag !== undefined) {\n if (!dryRun) await persistPublishMode(ctx.dataDir, flag); // --dry-run: would-set only\n return { value: flag, source: 'flag' };\n }\n\n // Only the GLOBAL config file counts as \"already configured\" for setup: env/flag\n // are per-run and a project `.tenjin.json` is not this machine's global choice.\n const config = await loadRawConfig(ctx.dataDir);\n if (config.publish?.mode !== undefined) {\n return { value: config.publish.mode, source: 'existing' };\n }\n\n // `interactive` is the walkthrough gate (already false under --json or off a TTY),\n // so a machine consumer never sits behind a prompt.\n if (dryRun || !interactive) return { value: DEFAULT_MODE, source: 'default-skipped' };\n\n const answer = await (deps.promptPublishMode ?? defaultPromptPublishMode)();\n if (answer === null) return { value: DEFAULT_MODE, source: 'default-skipped' }; // cancelled: no write\n // The seam is injectable, so an answer is validated rather than trusted; an\n // unparseable one is a cancel, not a write of something unknown.\n const parsed = PublishModeSchema.safeParse(answer);\n if (!parsed.success) return { value: DEFAULT_MODE, source: 'default-skipped' };\n await persistPublishMode(ctx.dataDir, parsed.data);\n return { value: parsed.data, source: 'prompt' };\n}\n\nfunction defaultPromptPublishMode(): Promise<PublishMode | null> {\n return selectOne<PublishMode>({\n message: PUBLISH_MODE_QUESTION,\n choices: PUBLISH_MODE_CHOICES.map((c) => ({ ...c })),\n initialValue: 'auto',\n });\n}\n\nfunction parseModeFlag(value: string): PublishMode {\n return parsePublishModeFlag(value, '--publish-mode');\n}\n\n// --- Harness permissions (decision 2) ---------------------------------------------\n\n/**\n * Decision 2's literal copy: one question, and a consequence that lib/permissions.ts\n * would agree with. NOT \"read-only\" and NOT \"never touches your wallet\" — that\n * module refuses both claims in as many words (`search` and `outcome` POST\n * off-machine, `read` saves to the library and can present a cached\n * wallet-derived delegation, and two of the nine rules are `wallet show` /\n * `wallet balance`). What is actually true of the whole tier is that it cannot\n * spend and cannot open the keystore, so that is what the question says.\n *\n * The pointer at `tenjin doctor` is how FLAG_CAVEAT's \"printed with the rules\n * everywhere they are printed\" contract is met at the consent moment. The\n * walkthrough no longer prints the rules or the flag caveat, so the yes/no that\n * replaced them names the one command that prints both, in full, unchanged.\n */\nexport const PERMISSIONS_QUESTION = [\n 'Let your agent search tenjin without permission popups?',\n `Adds ${FREE_VERB_RULES.length} free commands to ~/.claude/settings.json.`,\n 'None can spend USDC or open your wallet keystore;',\n 'three send or store data (search, outcome, read).',\n 'Full caveats: tenjin doctor.',\n].join(' ');\n\n/** Decision 3's literal copy. */\nexport const WALLET_QUESTION = 'Create a wallet now?';\n\n/**\n * Settle the harness allowlist. The write itself is consent-gated and free-verb\n * only (see lib/harness-permissions.ts); this decides ONLY whether to call it.\n * `--allow-free-verbs` wires it headlessly, an interactive run asks, and a\n * non-interactive run without the flag changes nothing and says so.\n */\nasync function resolvePermissions(args: {\n plans: HarnessPlan[];\n home: string;\n deps: InstallDeps;\n flag: boolean;\n dryRun: boolean;\n canPrompt: boolean;\n}): Promise<PermissionsResult> {\n const { plans, home, deps, flag, dryRun, canPrompt } = args;\n // Only Claude Code has a settings file with this shape. Codex and the shared\n // Agent Skills location gate permissions elsewhere, so there is nothing here to\n // write for them, and guessing at another harness's config would be the kind of\n // uninvited write this whole module is careful about.\n if (!plans.some((p) => p.harness === 'claude')) {\n return permissionsSkipped(plans[0]?.harness ?? 'shared', home, 'harness-not-claude');\n }\n if (dryRun) return permissionsSkipped('claude', home, 'dry-run');\n if (flag) return wireFreeVerbAllowlist(home);\n if (!canPrompt) return permissionsSkipped('claude', home, 'not-requested');\n\n const confirm = deps.confirmPermissions ?? defaultConfirm;\n if (!(await confirm(PERMISSIONS_QUESTION))) {\n return permissionsSkipped('claude', home, 'declined');\n }\n return wireFreeVerbAllowlist(home);\n}\n\n// --- Detection + planning --------------------------------------------------------\n\ninterface HarnessPlan {\n harness: Harness;\n detected: boolean;\n detectedBy: string[];\n skillsDir: string;\n wiresAgentsMd: boolean;\n home: string;\n}\n\n/**\n * Turn detection (or an explicit --harness override) into the ordered, de-duped\n * list of targets to write. Codex and the shared fallback both land in\n * ~/.agents/skills (the harness-shared Agent Skills location), so a request for\n * both collapses to one target keyed by that directory.\n */\nfunction resolvePlans(\n override: string[] | undefined,\n home: string,\n which: (bin: string) => boolean,\n): HarnessPlan[] {\n if (override !== undefined && override.length > 0) {\n const plans = override.map((v) => planFor(validateHarness(v), ['override'], true, home));\n return dedupeBySkillsDir(plans);\n }\n\n const plans: HarnessPlan[] = [];\n // Same two probes doctor's skills check gates its per-directory verdicts on.\n const claudeBy = harnessDetectedBy(home, 'claude', which);\n const codexBy = harnessDetectedBy(home, 'codex', which);\n if (claudeBy.length > 0) plans.push(planFor('claude', claudeBy, true, home));\n if (codexBy.length > 0) plans.push(planFor('codex', codexBy, true, home));\n if (plans.length === 0) {\n // Nothing detected: the shared Agent Skills location is the fallback target, so\n // a harness installed later still finds the skills.\n plans.push(planFor('shared', ['fallback'], false, home));\n }\n return dedupeBySkillsDir(plans);\n}\n\nfunction planFor(\n harness: Harness,\n detectedBy: string[],\n detected: boolean,\n home: string,\n): HarnessPlan {\n const skillsDir = harnessTargetDir(home, harness);\n return { harness, detected, detectedBy, skillsDir, wiresAgentsMd: harness !== 'claude', home };\n}\n\nfunction dedupeBySkillsDir(plans: HarnessPlan[]): HarnessPlan[] {\n const seen = new Set<string>();\n const out: HarnessPlan[] = [];\n for (const p of plans) {\n if (seen.has(p.skillsDir)) continue;\n seen.add(p.skillsDir);\n out.push(p);\n }\n return out;\n}\n\nfunction validateHarness(value: string): Harness {\n if ((HARNESSES as readonly string[]).includes(value)) return value as Harness;\n throw new CliError('USAGE', `Unknown harness \"${value}\"`, {\n fix: `--harness must be one of: ${HARNESSES.join(', ')}.`,\n });\n}\n\n// --- Applying a plan -------------------------------------------------------------\n\n/**\n * Wire one harness target. EVERY packaged skill is written on every run,\n * unconditionally: an existing Tenjin skill in the target (typically the hosted\n * zero-install one from tenjin.blog/skills.md) is never a reason to skip, because\n * install on such a machine is the UPGRADE path (#35). The hosted mirror is kept\n * and refreshed rather than removed (roadmap G4: it is the permanent zero-install\n * curriculum); the two CLI adapter skills land beside it and supersede it while\n * the CLI is present.\n */\nasync function applyPlan(\n plan: HarnessPlan,\n skillsSource: string,\n dryRun: boolean,\n claudeMdWrite: boolean,\n): Promise<HarnessResult> {\n const skills: SkillResult[] = [];\n const warnings: string[] = [];\n for (const name of SKILL_NAMES) {\n const { status, warning, preexisting } = await installSkill(\n join(skillsSource, name),\n join(plan.skillsDir, name),\n dryRun,\n name,\n );\n skills.push({\n name,\n status,\n preexisting,\n cli: (CLI_SKILL_NAMES as readonly string[]).includes(name),\n modelInvocable: await landedInvocable(plan.skillsDir, skillsSource, name, dryRun),\n });\n if (warning !== undefined) warnings.push(warning);\n }\n\n const hostedPreexisting = skills.some((s) => s.name === HOSTED_SKILL_NAME && s.preexisting);\n const result: HarnessResult = {\n harness: plan.harness,\n detected: plan.detected,\n detectedBy: plan.detectedBy,\n skillsDir: plan.skillsDir,\n skills,\n hostedPreexisting,\n notes: notesFor(plan, hostedPreexisting),\n warnings,\n };\n\n if (plan.wiresAgentsMd) {\n result.agentsMd = await wireAgentsMd(plan, dryRun);\n result.codexNetworkRule = CODEX_NETWORK_RULE;\n } else if (plan.harness === 'claude') {\n result.claudeMd = await wireClaudeMd(plan, dryRun, claudeMdWrite);\n }\n return result;\n}\n\n/**\n * Write the nudge line into ~/.claude/CLAUDE.md when opted in. Creates the file if\n * absent, rewrites a drifted marker line in place, and leaves a matching line alone.\n * `skipped` means the user opted out (or was never asked).\n */\nasync function wireClaudeMd(\n plan: HarnessPlan,\n dryRun: boolean,\n write: boolean,\n): Promise<ClaudeMdResult> {\n const path = join(plan.home, '.claude', 'CLAUDE.md');\n if (!write) return { path, status: 'skipped' };\n\n const existing = existsSync(path) ? await readFile(path, 'utf8') : null;\n const { content, change } = upsertMarkerLine(existing, nudgeLine(plan.skillsDir));\n if (change === 'none') return { path, status: 'up-to-date' };\n if (!dryRun && content !== null) await writeFileAtomic(path, content);\n if (change === 'append') return { path, status: dryRun ? 'would-write' : 'written' };\n return { path, status: dryRun ? 'would-update' : 'updated' };\n}\n\nfunction notesFor(plan: HarnessPlan, hostedPreexisting: boolean): string[] {\n const notes =\n plan.harness === 'claude'\n ? [\n 'Installed at the user level (~/.claude/skills). A Claude Code plugin will later make this automatic.',\n ]\n : [\n 'Copied into the shared Agent Skills location (~/.agents/skills). Codex and any Agent-Skills-compatible harness read it there.',\n ];\n if (hostedPreexisting) {\n notes.push(\n `The hosted ${HOSTED_SKILL_NAME} skill was already here; it stays as the zero-install fallback and the CLI skills (${CLI_SKILL_NAMES.join(', ')}) take precedence while the CLI is installed.`,\n );\n }\n return notes;\n}\n\n/**\n * Did the skill actually land model-invocable? Read back from the target so the\n * reported value is the file a harness will read, not what we intended to write.\n * A dry run wrote nothing, so it READS THE PACKAGED SOURCE — the file that would\n * land. Hardcoding `true` there was wrong for the one skill whose value can\n * legitimately be false: `assertSkillsSource` exempts the hosted mirror from the\n * invocability assertion, so a shadowed mirror ships and must report as shadowed on\n * both paths.\n */\nasync function landedInvocable(\n skillsDir: string,\n skillsSource: string,\n name: string,\n dryRun: boolean,\n): Promise<boolean> {\n const path = join(dryRun ? skillsSource : skillsDir, name, 'SKILL.md');\n if (!existsSync(path)) return false;\n try {\n return !isModelInvocationDisabled(await readFile(path, 'utf8'));\n } catch {\n return false;\n }\n}\n\n/**\n * Every packaged skill landed in every target. Runs after ALL targets are written,\n * never mid-loop: a throw between two targets would leave target 1 rewritten and\n * target 2 untouched. (It still sits ahead of the doctor run, the publish-mode\n * question and the wallet step, so a throw here skips those either way.)\n *\n * Presence only. Whether a skill is model-invocable is a property of the PACKAGED\n * source, checked up front by `assertSkillsSource` before anything is written.\n */\nasync function assertSkillsLanded(plans: HarnessPlan[], dryRun: boolean): Promise<void> {\n if (dryRun) return;\n const missing: string[] = [];\n for (const plan of plans) {\n for (const name of SKILL_NAMES) {\n if (!existsSync(join(plan.skillsDir, name, 'SKILL.md'))) {\n missing.push(join(plan.skillsDir, name));\n }\n }\n }\n if (missing.length === 0) return;\n throw new CliError('INTERNAL', `Skills were not written: ${missing.join(', ')}`, {\n fix: 'Check permissions on the skills directory and re-run `tenjin install`.',\n });\n}\n\n/**\n * Copy one skill directory. The packaged copy is canonical: an absent target is\n * `installed`, an identical target is `up-to-date`, and any local drift is\n * overwritten and reported as `updated` with a warning. On --dry-run nothing is\n * written and the status reads `would-*`.\n */\nasync function installSkill(\n srcDir: string,\n destDir: string,\n dryRun: boolean,\n name: string,\n): Promise<{ status: SkillResult['status']; warning?: string; preexisting: boolean }> {\n const src = await readTree(srcDir);\n const dest = await readTree(destDir);\n if (src === null) {\n // assertSkillsSource already guards SKILL.md; this is defensive for an empty dir.\n throw new CliError('INTERNAL', `Packaged skill source ${srcDir} is empty`);\n }\n // A real prior copy means a SKILL.md, not merely the directory: readTree returns\n // an empty Map for a bare `mkdir`, and an interrupted write leaves a stray file\n // with no SKILL.md. Neither is a skill that \"was already here\".\n const preexisting = dest?.has('SKILL.md') === true;\n\n // `change` is keyed off BYTES, not off `preexisting`: the rm below deletes whatever\n // is in the destination, so anything with content in it is an overwrite and must\n // carry the warning, even with no SKILL.md — a hand-saved `skills.md` and a\n // directory of the user's own notes both live here. Only a bare `mkdir` (or a dir\n // that does not exist) is a create, which is what `preexisting` reporting is for.\n const change =\n dest === null || dest.size === 0 ? 'create' : treesEqual(src, dest) ? 'none' : 'update';\n\n if (!dryRun && change !== 'none') {\n // Overwrite wholesale so the packaged copy is exactly what lands, with no stray\n // local files left behind. rm is a no-op when the dir is absent.\n await rm(destDir, { recursive: true, force: true });\n for (const [rel, content] of src) {\n await writeFileAtomic(join(destDir, rel), content);\n }\n }\n\n if (change === 'create') return { status: dryRun ? 'would-install' : 'installed', preexisting };\n if (change === 'none') return { status: 'up-to-date', preexisting };\n return {\n status: dryRun ? 'would-update' : 'updated',\n preexisting,\n // The hosted skill is a MIRROR of tenjin.blog/skills.md (roadmap G4), so a\n // differing local copy is a replacement, not the drift warning the CLI skills\n // get. Neither side carries a version or date, so the wording claims no\n // direction: the local file may well be a newer fetch than this package's copy.\n warning:\n name === HOSTED_SKILL_NAME\n ? `${destDir}: the hosted Tenjin skill differed and ${dryRun ? 'would be' : 'was'} replaced by this package's mirror of tenjin.blog/skills.md, which may be older; it stays as the zero-install fallback. Re-fetch it from tenjin.blog/skills.md if you need the current one.`\n : `${destDir}: local skill copy differed and ${dryRun ? 'would be' : 'was'} overwritten (the packaged copy is canonical).`,\n };\n}\n\n/**\n * Read a directory tree into a rel-path -> content map, or null when it does not\n * exist. Reads as raw `Buffer`, not `utf8`: today's skills are markdown-only, but\n * this is a general recursive dir-copy, and decoding to a string here would\n * silently corrupt a future non-text asset (an image, a font) on write, or worse,\n * make two different corrupted binaries both decode to U+FFFD and compare equal.\n */\nasync function readTree(dir: string): Promise<Map<string, Buffer> | null> {\n if (!existsSync(dir)) return null;\n const entries = await readdir(dir, { recursive: true, withFileTypes: true });\n const files = new Map<string, Buffer>();\n for (const entry of entries) {\n if (!entry.isFile()) continue;\n const full = join(entry.parentPath, entry.name);\n files.set(relative(dir, full), await readFile(full));\n }\n return files;\n}\n\nfunction treesEqual(a: Map<string, Buffer>, b: Map<string, Buffer> | null): boolean {\n if (b === null) return false;\n if (a.size !== b.size) return false;\n for (const [k, v] of a) {\n const other = b.get(k);\n if (other === undefined || !v.equals(other)) return false;\n }\n return true;\n}\n\n/**\n * Ensure the AGENTS.md pointer line is present exactly once. Append-once is GLOBAL\n * across both locations Codex/harnesses read (~/.agents/AGENTS.md and Codex's own\n * ~/.codex/AGENTS.md): if either already carries the marker we stop, so a pointer\n * already in ~/.codex/AGENTS.md is never duplicated into a later-created\n * ~/.agents/AGENTS.md. When neither has it, target selection follows what Codex\n * actually reads: prefer an existing ~/.agents/AGENTS.md, else an existing\n * ~/.codex/AGENTS.md, else create the one whose home dir exists, else fall back to\n * ~/.agents/AGENTS.md alongside the shared skills.\n */\nasync function wireAgentsMd(plan: HarnessPlan, dryRun: boolean): Promise<AgentsMdResult> {\n const shared = join(plan.home, '.agents', 'AGENTS.md');\n const codex = join(plan.home, '.codex', 'AGENTS.md');\n const line = nudgeLine(plan.skillsDir);\n\n // If either file Codex reads already carries the marker, that file owns the line:\n // refresh it in place when an older install's text drifted, else leave it. This\n // keeps append-once global while still upgrading a stale line.\n for (const path of [shared, codex]) {\n if (existsSync(path) && (await readFile(path, 'utf8')).includes(SKILLS_MARKER)) {\n return upsertAgentsMd(path, line, dryRun);\n }\n }\n\n return upsertAgentsMd(chooseAgentsMdPath(plan.home), line, dryRun);\n}\n\nasync function upsertAgentsMd(\n path: string,\n line: string,\n dryRun: boolean,\n): Promise<AgentsMdResult> {\n const existing = existsSync(path) ? await readFile(path, 'utf8') : null;\n const { content, change } = upsertMarkerLine(existing, line);\n if (change === 'none') return { path, status: 'already-present' };\n if (!dryRun && content !== null) await writeFileAtomic(path, content);\n if (change === 'append') return { path, status: dryRun ? 'would-append' : 'appended' };\n return { path, status: dryRun ? 'would-update' : 'updated' };\n}\n\nfunction chooseAgentsMdPath(home: string): string {\n const shared = join(home, '.agents', 'AGENTS.md');\n const codex = join(home, '.codex', 'AGENTS.md');\n if (existsSync(shared)) return shared;\n if (existsSync(codex)) return codex;\n if (existsSync(join(home, '.codex'))) return codex;\n return shared;\n}\n\n// --- Human rendering -------------------------------------------------------------\n\nfunction paint(io: Io, format: Parameters<typeof styleText>[0], text: string): string {\n if (io.stdout instanceof Stream) return styleText(format, text, { stream: io.stdout });\n return styleText(format, text);\n}\n\n// --- Skills source guard ---------------------------------------------------------\n\n/**\n * Guard the packaged source BEFORE any target is touched, so a bad package aborts\n * with nothing written rather than mid-copy.\n *\n * The model-invocable assertion covers only CLI_SKILL_NAMES. The hosted `tenjin`\n * mirror is written verbatim from tenjin.blog/skills.md by scripts/sync-skill.mjs\n * and its frontmatter is not authored here: if upstream ever adds\n * `disable-model-invocation: true` (a plausible way to say \"prefer the CLI\n * skills\"), asserting on it would hard-fail every install with a fix that cannot\n * work, and skill-drift.yml would stay green because the mirror still matches\n * upstream. Doctor warns about the mirror instead.\n */\nasync function assertSkillsSource(dir: string): Promise<void> {\n for (const name of SKILL_NAMES) {\n if (!existsSync(join(dir, name, 'SKILL.md'))) {\n throw new CliError('INTERNAL', `Packaged skill \"${name}\" is missing under ${dir}`, {\n fix: 'Reinstall tenjin-cli; the published package must ship every skill under skills/.',\n });\n }\n }\n for (const name of CLI_SKILL_NAMES) {\n const text = await readFile(join(dir, name, 'SKILL.md'), 'utf8');\n if (isModelInvocationDisabled(text)) {\n throw new CliError(\n 'INTERNAL',\n `Packaged skill \"${name}\" carries disable-model-invocation: true, so no harness would surface it`,\n {\n fix: 'Reinstall tenjin-cli; the published CLI skills must be model-invocable.',\n },\n );\n }\n }\n}\n","import { lstat, readFile, realpath } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { writeFileAtomic } from './atomic-json';\n\n/**\n * The one place the CLI WRITES a permission grant into a harness's own settings\n * file, so the invariants live here rather than at the call site:\n *\n * - CONSENT-GATED. Nothing in this module runs unless the operator said yes at\n * the install prompt or passed `--allow-free-verbs`. It is never reached by a\n * bare non-interactive run.\n * - FREE-TIER ONLY, AND NOT PARAMETERIZED. The rules are the hardcoded\n * {@link FREE_VERB_RULES} constant and the writer takes no rule argument, so\n * there is no call path — no flag, no config key, no future caller — that can\n * make it write `buy`, `publish`, `session start`, `send`, `config set`,\n * `wallet create`, `mcp`, `install`, or a broad `Bash(tenjin:*)`. A CLI that\n * could widen its own permission grant is exactly what this shape rules out.\n * - ADDITIVE ONLY. Existing entries and every other key in the file are copied\n * through verbatim, in their original order; missing rules are appended. A\n * re-run adds nothing and reports what was already present.\n * - NEVER CLOBBERS. A settings file we cannot parse, or whose `permissions` /\n * `permissions.allow` is not the shape we expect, is left untouched and\n * reported as skipped. We do not \"repair\" someone's hand-edited config.\n *\n * The rules mirror lib/permissions.ts's ALWAYS_SAFE_ALLOWLIST (the block\n * `doctor` prints and the README quotes) and are duplicated as literals on\n * purpose: that module is a DOCUMENT whose safe tier could grow, and a widened\n * tier must not silently widen what install writes. A test pins the two lists\n * equal, so drift is a red build rather than a broader grant.\n */\n\n/** Claude Code's user-level settings file, the only file this module writes. */\nexport function claudeSettingsPath(homeDir: string): string {\n return join(homeDir, '.claude', 'settings.json');\n}\n\n/**\n * The exact rules install may add. Free verbs only: none of them can spend USDC\n * or open the keystore. See lib/permissions.ts for the per-verb notes and for\n * the flag caveat that qualifies every prefix rule.\n */\nexport const FREE_VERB_RULES: readonly string[] = [\n 'Bash(tenjin search:*)',\n 'Bash(tenjin inspect:*)',\n 'Bash(tenjin read:*)',\n 'Bash(tenjin outcome:*)',\n 'Bash(tenjin doctor:*)',\n 'Bash(tenjin wallet show:*)',\n 'Bash(tenjin wallet balance:*)',\n 'Bash(tenjin config get:*)',\n 'Bash(tenjin candidate list:*)',\n];\n\n/**\n * Verb fragments that must never appear in {@link FREE_VERB_RULES}. Asserted by\n * a test rather than at runtime: the constant above is not reachable from any\n * input, so the only way one of these lands in it is an edit to this file, and a\n * test is what catches an edit.\n */\nexport const FORBIDDEN_VERB_FRAGMENTS: readonly string[] = [\n 'tenjin buy',\n 'tenjin publish',\n 'tenjin edit',\n 'tenjin session',\n 'tenjin send',\n 'tenjin config set',\n 'tenjin wallet create',\n 'tenjin mcp',\n 'tenjin install',\n 'tenjin candidate add',\n 'tenjin candidate drop',\n 'Bash(tenjin:*)',\n];\n\n/**\n * Why no rules were written. Every value is a reason to leave the file alone,\n * never a partial write: the writer either appends all missing rules or none.\n */\nexport type PermissionsSkipReason =\n | 'harness-not-claude'\n | 'not-requested'\n | 'declined'\n | 'dry-run'\n | 'unresolvable'\n | 'unreadable'\n | 'unparsable'\n | 'unexpected-shape';\n\nexport interface PermissionsResult {\n /** The harness this outcome is about; only `claude` has a settings file we write. */\n harness: string;\n /**\n * The settings file, reported even when nothing was written so a human can go\n * look. ABSENT when the harness has no such file: naming a Claude path on a\n * Codex-only install would point the envelope's reader at a file that has\n * nothing to do with their harness.\n */\n path?: string;\n added: string[];\n alreadyPresent: string[];\n skipped?: PermissionsSkipReason;\n /** Human-readable detail for a skip that is a problem rather than a choice. */\n warning?: string;\n}\n\nfunction skip(\n harness: string,\n path: string | undefined,\n reason: PermissionsSkipReason,\n warning?: string,\n): PermissionsResult {\n return {\n harness,\n ...(path !== undefined ? { path } : {}),\n added: [],\n alreadyPresent: [],\n skipped: reason,\n ...(warning !== undefined ? { warning } : {}),\n };\n}\n\n/** A decision NOT to write, shaped like a write outcome so the caller has one type. */\nexport function permissionsSkipped(\n harness: string,\n homeDir: string,\n reason: PermissionsSkipReason,\n): PermissionsResult {\n const path = harness === 'claude' ? claudeSettingsPath(homeDir) : undefined;\n return skip(harness, path, reason);\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Add the free-verb rules to `permissions.allow` in ~/.claude/settings.json.\n * Creates the file (and the `permissions.allow` path) when absent, appends only\n * the rules that are missing, and rewrites nothing else. Idempotent: a second\n * run returns `added: []` with every rule under `alreadyPresent` and does not\n * touch the file at all.\n */\nexport async function wireFreeVerbAllowlist(homeDir: string): Promise<PermissionsResult> {\n const declaredPath = claudeSettingsPath(homeDir);\n const harness = 'claude';\n\n // `lstat`, not `existsSync`: existsSync FOLLOWS a symlink, so a link pointing at\n // a file that is not there reads as \"absent\" and the create path below would\n // rename a regular file over the link. We need to know whether an ENTRY is\n // there, whatever it points at.\n const entry = await lstat(declaredPath).catch(() => null);\n\n // Resolve symlinks BEFORE writing. `writeFileAtomic` commits with a rename,\n // which replaces a symlink with a regular file: a settings.json linked into a\n // dotfiles repo would be severed, its target left stale, and future edits there\n // would stop reaching Claude Code. Renaming over the RESOLVED path edits the\n // file the operator actually maintains and leaves the link intact, which is\n // what this module's additive-only, never-clobber invariants promise. A link we\n // cannot resolve is left alone rather than overwritten; for a genuinely absent\n // file there is nothing to follow and we create it at the declared path.\n let path = declaredPath;\n if (entry !== null) {\n try {\n path = await realpath(declaredPath);\n } catch (err) {\n return skip(\n harness,\n declaredPath,\n 'unresolvable',\n `${declaredPath} could not be resolved (${(err as Error).message}); it was left exactly as it is.`,\n );\n }\n }\n\n let settings: Record<string, unknown> = {};\n if (entry !== null) {\n let raw: string;\n try {\n raw = await readFile(path, 'utf8');\n } catch (err) {\n return skip(\n harness,\n path,\n 'unreadable',\n `${path} could not be read (${(err as Error).message}); no permissions were written.`,\n );\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (err) {\n return skip(\n harness,\n path,\n 'unparsable',\n `${path} is not valid JSON (${(err as Error).message}); it was left exactly as it is.`,\n );\n }\n if (!isPlainObject(parsed)) {\n return skip(\n harness,\n path,\n 'unexpected-shape',\n `${path} is not a JSON object; it was left exactly as it is.`,\n );\n }\n settings = parsed;\n }\n\n // `permissions` and `permissions.allow` may be absent (we create them), but a\n // present one of the wrong type is someone else's structure: refuse rather\n // than replace it. Unknown entry types inside `allow` are fine and ride\n // through verbatim; they simply never match a rule.\n const permissionsValue = settings.permissions;\n if (permissionsValue !== undefined && !isPlainObject(permissionsValue)) {\n return skip(\n harness,\n path,\n 'unexpected-shape',\n `${path} has a \"permissions\" key that is not an object; it was left exactly as it is.`,\n );\n }\n const permissions: Record<string, unknown> = permissionsValue ?? {};\n const allowValue = permissions.allow;\n if (allowValue !== undefined && !Array.isArray(allowValue)) {\n return skip(\n harness,\n path,\n 'unexpected-shape',\n `${path} has a \"permissions.allow\" key that is not an array; it was left exactly as it is.`,\n );\n }\n const allow: unknown[] = allowValue ?? [];\n\n const present = new Set(allow.filter((e): e is string => typeof e === 'string'));\n const added = FREE_VERB_RULES.filter((rule) => !present.has(rule));\n const alreadyPresent = FREE_VERB_RULES.filter((rule) => present.has(rule));\n if (added.length === 0) return { harness, path, added: [], alreadyPresent: [...alreadyPresent] };\n\n // Object spreads keep the original key order and land the rebuilt `permissions`\n // in the slot it already occupied, so a diff of the file is the appended rules\n // and nothing else.\n const next = {\n ...settings,\n permissions: { ...permissions, allow: [...allow, ...added] },\n };\n await writeFileAtomic(path, `${JSON.stringify(next, null, 2)}\\n`);\n return { harness, path, added, alreadyPresent: [...alreadyPresent] };\n}\n","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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,YAAAA,WAAU,SAAS,UAAU;AACtC,SAAS,qBAAqB;AAC9B,SAAS,QAAAC,OAAM,gBAAgB;AAC/B,SAAS,eAAe;AAExB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;;;ACPvB,SAAS,OAAO,UAAU,gBAAgB;AAC1C,SAAS,YAAY;AA+Bd,SAAS,mBAAmB,SAAyB;AAC1D,SAAO,KAAK,SAAS,WAAW,eAAe;AACjD;AAOO,IAAM,kBAAqC;AAAA,E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A,SAAS,MAAM,IAAQ,QAAyC,MAAsB;AACpF,MAAI,GAAG,kBAAkB,OAAQ,QAAO,UAAU,QAAQ,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC;AACrF,SAAO,UAAU,QAAQ,IAAI;AAC/B;AAgBA,eAAe,mBAAmB,KAA4B;AAC5D,aAAW,QAAQ,aAAa;AAC9B,QAAI,CAAC,WAAWA,MAAK,KAAK,MAAM,UAAU,CAAC,GAAG;AAC5C,YAAM,IAAI,SAAS,YAAY,mBAAmB,IAAI,sBAAsB,GAAG,IAAI;AAAA,QACjF,KAAK;AAAA,MACP,CAAC;AAAA,IACH;AAAA,EACF;AACA,aAAW,QAAQ,iBAAiB;AAClC,UAAM,OAAO,MAAMC,UAASD,MAAK,KAAK,MAAM,UAAU,GAAG,MAAM;AAC/D,QAAI,0BAA0B,IAAI,GAAG;AACnC,YAAM,IAAI;AAAA,QACR;AAAA,QACA,mBAAmB,IAAI;AAAA,QACvB;AAAA,UACE,KAAK;AAAA,QACP;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":["readFile","join","plans","join","readFile"]}
|
|
@@ -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-RGTTACP3.js";
|
|
5
|
+
import "./chunk-OTDI5FXG.js";
|
|
6
|
+
import "./chunk-P3FBESBB.js";
|
|
7
|
+
import "./chunk-WWX32ML4.js";
|
|
8
|
+
import "./chunk-URSGGRO4.js";
|
|
9
|
+
import "./chunk-DQDGBWWH.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-VXCBEGNC.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-C3S6725N.js";
|
|
5
|
+
import "./chunk-SGK2B724.js";
|
|
6
|
+
import "./chunk-NVHQCTIC.js";
|
|
7
|
+
import "./chunk-QB2NNV6C.js";
|
|
8
|
+
import "./chunk-PCLPVJ3J.js";
|
|
9
|
+
import "./chunk-S5RYMCV6.js";
|
|
10
|
+
import "./chunk-POJRB2AE.js";
|
|
11
|
+
import "./chunk-YLYINX2H.js";
|
|
12
|
+
import "./chunk-GABYDXWL.js";
|
|
13
|
+
import "./chunk-RGFBBNGP.js";
|
|
14
|
+
import "./chunk-WRWCDLVK.js";
|
|
15
|
+
import "./chunk-VZ3AJCO5.js";
|
|
16
|
+
import "./chunk-P3FBESBB.js";
|
|
17
|
+
import "./chunk-WWX32ML4.js";
|
|
18
|
+
import "./chunk-URSGGRO4.js";
|
|
19
|
+
import "./chunk-DQDGBWWH.js";
|
|
20
|
+
import "./chunk-XBJ3VLWX.js";
|
|
21
|
+
import "./chunk-2I4QTOLB.js";
|
|
22
|
+
import "./chunk-BBUYCDSG.js";
|
|
23
|
+
import "./chunk-KZAAWQNP.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-5NTCRF2V.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-ZA3RFDAV.js";
|
|
10
|
+
import "./chunk-SGK2B724.js";
|
|
11
|
+
import "./chunk-PCLPVJ3J.js";
|
|
12
|
+
import "./chunk-S5RYMCV6.js";
|
|
13
|
+
import "./chunk-POJRB2AE.js";
|
|
14
|
+
import "./chunk-YLYINX2H.js";
|
|
15
|
+
import {
|
|
16
|
+
isSessionPresentable,
|
|
17
|
+
loadSessionFile,
|
|
18
|
+
signWithSession
|
|
19
|
+
} from "./chunk-GABYDXWL.js";
|
|
20
|
+
import {
|
|
21
|
+
findDelivered,
|
|
22
|
+
findDeliveredByUrl,
|
|
23
|
+
resolveResourceRef
|
|
24
|
+
} from "./chunk-CYRYVZPN.js";
|
|
25
|
+
import "./chunk-OTDI5FXG.js";
|
|
26
|
+
import "./chunk-P3FBESBB.js";
|
|
27
|
+
import "./chunk-WWX32ML4.js";
|
|
28
|
+
import "./chunk-URSGGRO4.js";
|
|
29
|
+
import "./chunk-DQDGBWWH.js";
|
|
30
|
+
import {
|
|
31
|
+
originOf
|
|
32
|
+
} from "./chunk-XBJ3VLWX.js";
|
|
33
|
+
import "./chunk-2I4QTOLB.js";
|
|
34
|
+
import {
|
|
35
|
+
sanitizeForTerminal
|
|
36
|
+
} from "./chunk-BBUYCDSG.js";
|
|
37
|
+
import "./chunk-KZAAWQNP.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-T6OTMU72.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,eAAsB,QACpB,MACA,KACA,OAAiB,CAAC,GACM;AACxB,QAAM,WAAW,MAAM,uBAAuB,GAAG;AACjD,QAAM,iBAAiB,oBAAoB,KAAK,QAAQ;AACxD,QAAM,MAAM,MAAM,mBAAmB,KAAK,KAAK,IAAI,SAAS,SAAS,OAAO;AAC5E,QAAM,cAA2B,EAAE,WAAW,KAAK,cAAc,MAAM,eAAe;AAKtF,QAAM,WACJ,IAAI,eAAe,SACf,MAAM,cAAc,IAAI,SAAS,IAAI,UAAU,IAC/C,MAAM,mBAAmB,IAAI,SAAS,IAAI,GAAG;AACnD,MAAI,aAAa,MAAM;AACrB,WAAO,gBAAgB,UAAU,WAAW;AAAA,EAC9C;AAEA,QAAM,YAAY;AAAA,IAChB,WAAW,IAAI,MAAM;AAAA,IACrB,GAAI,KAAK,cAAc,SAAY,EAAE,WAAW,KAAK,UAAU,IAAI,CAAC;AAAA,EACtE;AAIA,QAAM,QAAQ,MAAM,UAAU,IAAI,KAAK,SAAS;AAEhD,MAAI,MAAM,SAAS,YAAY;AAG7B,WAAO,MAAM,aAAa,IAAI,SAAS,IAAI,KAAK,MAAM,MAAM,QAAQ,QAAW,WAAW;AAAA,EAC5F;AAEA,MAAI,MAAM,SAAS,qBAAqB;AAItC,UAAM,IAAI,SAAS,mBAAmB,8CAA8C;AAAA,MAClF,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AAGA,QAAM,mBA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