@codeworksh/cli 0.4.0 → 0.5.0
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/{acp-CMS706IG.mjs → acp-JnyJmRCD.mjs} +3 -3
- package/{acp-CMS706IG.mjs.map → acp-JnyJmRCD.mjs.map} +1 -1
- package/{add-DNUklw-1.mjs → add-Dzsv-fKd.mjs} +3 -3
- package/{add-DNUklw-1.mjs.map → add-Dzsv-fKd.mjs.map} +1 -1
- package/{check-kFowK1HH.mjs → check-DhojkK_E.mjs} +3 -3
- package/{check-kFowK1HH.mjs.map → check-DhojkK_E.mjs.map} +1 -1
- package/{entries-DK4If3_G.mjs → entries-KpYvZdpi.mjs} +3 -3
- package/{entries-DK4If3_G.mjs.map → entries-KpYvZdpi.mjs.map} +1 -1
- package/{error-CPo0lJt1.mjs → error-BMI81XvR.mjs} +49 -2
- package/error-BMI81XvR.mjs.map +1 -0
- package/{identity-DYvnRw38.mjs → identity-BA1-EGoN.mjs} +2 -2
- package/{identity-DYvnRw38.mjs.map → identity-BA1-EGoN.mjs.map} +1 -1
- package/index.mjs +24 -24
- package/{install-BPF55E27.mjs → install-BLRDBzp1.mjs} +3 -3
- package/{install-BPF55E27.mjs.map → install-BLRDBzp1.mjs.map} +1 -1
- package/{link-CVKXgNxQ.mjs → link--UnM2qnT.mjs} +2 -2
- package/{link-CVKXgNxQ.mjs.map → link--UnM2qnT.mjs.map} +1 -1
- package/{list-DRnMn-TS.mjs → list-9fVqelid.mjs} +2 -2
- package/{list-DRnMn-TS.mjs.map → list-9fVqelid.mjs.map} +1 -1
- package/{list-CjEHPoW7.mjs → list-BE4xSEe3.mjs} +3 -3
- package/{list-CjEHPoW7.mjs.map → list-BE4xSEe3.mjs.map} +1 -1
- package/{login-BSa_WYlV.mjs → login-CRwxi5WD.mjs} +3 -3
- package/{login-BSa_WYlV.mjs.map → login-CRwxi5WD.mjs.map} +1 -1
- package/{logout-BP79XZqa.mjs → logout-C89X0B9M.mjs} +3 -3
- package/{logout-BP79XZqa.mjs.map → logout-C89X0B9M.mjs.map} +1 -1
- package/package-Bi5FfVSP.mjs +6 -0
- package/package-Bi5FfVSP.mjs.map +1 -0
- package/package.json +3 -3
- package/{providers-CEw_yhL4.mjs → providers-BrXJvY2P.mjs} +2 -2
- package/{providers-CEw_yhL4.mjs.map → providers-BrXJvY2P.mjs.map} +1 -1
- package/{refresh-BiN_5HeQ.mjs → refresh--j0Pj4Cw.mjs} +2 -2
- package/{refresh-BiN_5HeQ.mjs.map → refresh--j0Pj4Cw.mjs.map} +1 -1
- package/{refresh-O6AOOTiX.mjs → refresh-D0wBP2Go.mjs} +3 -3
- package/{refresh-O6AOOTiX.mjs.map → refresh-D0wBP2Go.mjs.map} +1 -1
- package/{reload-DMJ4jfv6.mjs → reload-DgPawyzr.mjs} +2 -2
- package/{reload-DMJ4jfv6.mjs.map → reload-DgPawyzr.mjs.map} +1 -1
- package/{remove-DXODbsDw.mjs → remove-DfFme5w2.mjs} +3 -3
- package/{remove-DXODbsDw.mjs.map → remove-DfFme5w2.mjs.map} +1 -1
- package/{restart-roXPupBi.mjs → restart-DDrkmn2h.mjs} +3 -3
- package/{restart-roXPupBi.mjs.map → restart-DDrkmn2h.mjs.map} +1 -1
- package/{run-C19PINh0.mjs → run-CVRkm_Iz.mjs} +3 -3
- package/{run-C19PINh0.mjs.map → run-CVRkm_Iz.mjs.map} +1 -1
- package/{serve-3x_ry1TW.mjs → serve-DDw1dCvW.mjs} +34 -5
- package/serve-DDw1dCvW.mjs.map +1 -0
- package/{service-CNnkhe6z.mjs → service-DJR6nPam.mjs} +3 -3
- package/{service-CNnkhe6z.mjs.map → service-DJR6nPam.mjs.map} +1 -1
- package/{settings-BHxEl9yP.mjs → settings-BfmoL27m.mjs} +2 -2
- package/{settings-BHxEl9yP.mjs.map → settings-BfmoL27m.mjs.map} +1 -1
- package/{shared-CCdYmc2s.mjs → shared-CnuCjvcG.mjs} +2 -2
- package/{shared-CCdYmc2s.mjs.map → shared-CnuCjvcG.mjs.map} +1 -1
- package/{start-D0mMz6TR.mjs → start-DwhV9ucd.mjs} +3 -3
- package/{start-D0mMz6TR.mjs.map → start-DwhV9ucd.mjs.map} +1 -1
- package/{status-BrFdfv1V.mjs → status-Bklxb3u6.mjs} +3 -3
- package/{status-BrFdfv1V.mjs.map → status-Bklxb3u6.mjs.map} +1 -1
- package/{status-JqyYbpR6.mjs → status-DVzFDoek.mjs} +3 -3
- package/{status-JqyYbpR6.mjs.map → status-DVzFDoek.mjs.map} +1 -1
- package/{stop-CPH4Qm5O.mjs → stop-DI91UvG_.mjs} +3 -3
- package/{stop-CPH4Qm5O.mjs.map → stop-DI91UvG_.mjs.map} +1 -1
- package/{tui-DSB1vDY8.mjs → tui-Cdim7SjU.mjs} +4 -4
- package/{tui-DSB1vDY8.mjs.map → tui-Cdim7SjU.mjs.map} +1 -1
- package/{update-DZiXdSAV.mjs → update-D0XPVfJu.mjs} +3 -3
- package/{update-DZiXdSAV.mjs.map → update-D0XPVfJu.mjs.map} +1 -1
- package/error-CPo0lJt1.mjs.map +0 -1
- package/package-BNWFYk8y.mjs +0 -6
- package/package-BNWFYk8y.mjs.map +0 -1
- package/serve-3x_ry1TW.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-BHxEl9yP.mjs","names":["parseJsonc"],"sources":["../../src/cli/cmd/handlers/plugin/settings.ts"],"sourcesContent":["import { Global, Plugin, Settings } from \"@codeworksh/harness/effect\";\nimport { Effect, FileSystem, Option, Path } from \"effect\";\nimport { applyEdits, modify, parse as parseJsonc, type ParseError } from \"jsonc-parser\";\nimport { InvalidInputError } from \"../../../error.ts\";\n\n/**\n * Reading and rewriting the `plugins` array of one settings file.\n *\n * Edits go through `jsonc-parser`, so a hand-written file keeps its comments, key order and\n * formatting: a plugin added by the CLI must not reformat a file its owner maintains. The write\n * is a temp file renamed over the original, so an interrupted run leaves the previous settings\n * intact rather than a half-written document.\n */\n\nexport interface Shared {\n\treadonly userConfigDir: Option.Option<string>;\n\treadonly home: Option.Option<string>;\n}\n\n/**\n * The user layer a command reads and writes: `--user-config-dir` when given -- a hard override of\n * the home's settings file -- resolved, like every app-level flag, against the directory the\n * command runs in (`hostCwd`), never against a linked session's `hostDir`.\n */\nexport const userLayer = (shared: Shared, hostCwd: string) =>\n\tOption.isNone(shared.userConfigDir)\n\t\t? {}\n\t\t: { userConfigDir: Settings.userConfigDir(shared.userConfigDir.value, hostCwd) };\n\nexport interface Target {\n\treadonly path: string;\n\t/** Set when this command had to create the project directory, so the caller can say so. */\n\treadonly created?: string;\n\t/** The project this file belongs to, which a local entry is written relative to. */\n\treadonly root?: string;\n}\n\n/** The module an entry names: a bare loader string, or the `package` of a config object. */\nconst moduleOf = (entry: unknown): string | undefined => {\n\tif (typeof entry === \"string\") return entry;\n\tif (typeof entry !== \"object\" || entry === null) return undefined;\n\tconst { package: located } = entry as { package?: unknown };\n\treturn typeof located === \"string\" ? located : undefined;\n};\n\n/** The plugin ID an entry configures, if it names one. */\nconst idOf = (entry: unknown): string | undefined => {\n\tif (typeof entry !== \"object\" || entry === null) return undefined;\n\tconst { plugin } = entry as { plugin?: unknown };\n\treturn typeof plugin === \"string\" ? plugin : undefined;\n};\n\n/**\n * Every spelling a reference answers to, without touching the filesystem.\n *\n * `canonical` drops a version suffix and resolves a relative path against the file that declared\n * it, so `@acme/x@1.2.0` and `@acme/x` are one name. The literal string is kept alongside it\n * because a plugin ID is not a module reference and survives `canonical` unchanged.\n */\nconst aliases = (reference: string, directory: string): Effect.Effect<ReadonlyArray<string>> =>\n\tPlugin.canonical(reference, directory).pipe(\n\t\tEffect.map((canonical) => [reference, canonical] as ReadonlyArray<string>),\n\t\t// A reference that does not parse still answers to itself: a plugin ID is not a module\n\t\t// reference, and it has to keep matching an entry that names it.\n\t\tEffect.orElseSucceed(() => [reference] as ReadonlyArray<string>),\n\t);\n\n/** Every spelling `reference` answers to, computed once for a whole command. */\nexport const spellings = (reference: string, directory: string): Effect.Effect<ReadonlySet<string>> =>\n\tEffect.map(aliases(reference, directory), (found) => new Set(found));\n\nexport interface Entry {\n\treadonly value: unknown;\n\treadonly answers: ReadonlySet<string>;\n\treadonly loads: boolean;\n}\n\n/**\n * What each configured entry answers to.\n *\n * Comparing the string as written is not enough. `plugin add @acme/x@1.2.0` records a version the\n * user will not repeat when removing it, and one plugin can be named three ways: by package, by\n * path, or by the ID it declares -- a `{ \"plugin\": \"<id>\" }` configuration object sits next to the\n * module entry that loaded it, and removing the plugin has to take both.\n *\n * The declared ID is only knowable by importing the module, so it is read from what is already\n * installed: `resolveCached` reads a published package out of the harness cache and never runs an\n * installer, so editing a settings file cannot fetch anything. An entry that does not resolve --\n * uninstalled, moved, or broken -- keeps the names it was written with rather than failing the\n * command, because an unusable plugin is exactly the one a user is trying to remove.\n */\nexport const identify = Effect.fn(\"CLI.plugin.identify\")(function* (\n\tplugins: ReadonlyArray<unknown>,\n\tfile: string,\n\tcache: string,\n) {\n\tconst nodePath = yield* Path.Path;\n\tconst directory = nodePath.dirname(file);\n\tconst entries: Entry[] = [];\n\tfor (const value of plugins) {\n\t\tconst answers = new Set<string>();\n\t\tconst id = idOf(value);\n\t\tif (id !== undefined) answers.add(id);\n\t\tconst module = moduleOf(value);\n\t\tif (module !== undefined) {\n\t\t\tfor (const alias of yield* aliases(module, directory)) answers.add(alias);\n\t\t\tconst declared = yield* Plugin.inspect(module, {\n\t\t\t\tcache,\n\t\t\t\thostDir: directory,\n\t\t\t\tfile,\n\t\t\t\tinstall: Plugin.resolveCached,\n\t\t\t}).pipe(Effect.option);\n\t\t\tif (Option.isSome(declared)) {\n\t\t\t\tanswers.add(declared.value.id);\n\t\t\t\tif (declared.value.name !== undefined) answers.add(declared.value.name);\n\t\t\t}\n\t\t}\n\t\tentries.push({ value, answers, loads: typeof value === \"string\" });\n\t}\n\treturn entries as ReadonlyArray<Entry>;\n});\n\n/**\n * What a local reference should be *written* as, which is rarely what was typed.\n *\n * A relative path on the command line is relative to the command's host directory; in a settings file it is relative to\n * that file's own directory. Those differ the moment the command runs anywhere but the directory\n * holding the file, and writing the string verbatim produces a silently wrong entry:\n *\n * ```\n * $ cd ~/workspace/app/packages/fubar\n * $ codework plugin add ./plugins/x.ts # means packages/fubar/plugins/x.ts\n * → the project is ~/workspace/app, so the entry lands in app/.codework/settings.jsonc\n * → written verbatim, the harness loads app/.codework/plugins/x.ts ← a different file\n * ```\n *\n * With both ends inside one project the entry is written relative to the file, which is portable\n * to any checkout of that repository and therefore worth committing. Otherwise -- a `-g` write\n * into `<home>`, a `--user-config-dir` elsewhere, or a target outside the project -- relative\n * would be a lie, and an absolute path means the same thing read from anywhere.\n *\n * A package spec is returned untouched: it names no location.\n */\nexport const written = Effect.fn(\"CLI.plugin.written\")(function* (\n\treference: string,\n\tinput: { readonly hostDir: string; readonly file: string; readonly root: string | undefined },\n) {\n\tconst nodePath = yield* Path.Path;\n\tconst target = yield* Plugin.parse(reference, input.hostDir).pipe(Effect.option);\n\tif (Option.isNone(target) || target.value.kind !== \"local\") return reference;\n\n\tconst absolute = target.value.path;\n\tconst inside = (root: string, path: string) => path === root || path.startsWith(`${root}${nodePath.sep}`);\n\tif (input.root !== undefined && inside(input.root, input.file) && inside(input.root, absolute)) {\n\t\tconst relative = nodePath.relative(nodePath.dirname(input.file), absolute);\n\t\treturn relative.startsWith(\"..\") ? relative : `./${relative}`;\n\t}\n\treturn absolute;\n});\n\n/** `reference` selects `entry` when any spelling of one is a spelling of the other. */\nexport const matches = (entry: Entry, spelled: ReadonlySet<string>) =>\n\t[...spelled].some((alias) => entry.answers.has(alias));\n\n/** Every entry connected to a reference through a package spelling or declared plugin ID. */\nexport const matching = (entries: ReadonlyArray<Entry>, spelled: ReadonlySet<string>) => {\n\tconst answers = new Set(spelled);\n\tconst found = new Set<Entry>();\n\tfor (;;) {\n\t\tconst next = entries.filter(\n\t\t\t(entry) => !found.has(entry) && [...entry.answers].some((answer) => answers.has(answer)),\n\t\t);\n\t\tif (next.length === 0) return found as ReadonlySet<Entry>;\n\t\tfor (const entry of next) {\n\t\t\tfound.add(entry);\n\t\t\tfor (const answer of entry.answers) answers.add(answer);\n\t\t}\n\t}\n};\n\nexport const readPlugins = Effect.fn(\"CLI.plugin.readPlugins\")(function* (path: string) {\n\tconst fs = yield* FileSystem.FileSystem;\n\tconst exists = yield* fs.exists(path);\n\tconst source = exists ? yield* fs.readFileString(path) : \"{}\";\n\tconst errors: ParseError[] = [];\n\tconst document: unknown = parseJsonc(source, errors, { allowTrailingComma: true });\n\tif (errors.length > 0 || typeof document !== \"object\" || document === null || Array.isArray(document)) {\n\t\treturn yield* new InvalidInputError({ message: `${path} is not a valid settings file` });\n\t}\n\tconst plugins = (document as { plugins?: unknown }).plugins;\n\tif (plugins !== undefined && !Array.isArray(plugins)) {\n\t\treturn yield* new InvalidInputError({ message: `${path}: \"plugins\" must be an array` });\n\t}\n\treturn { source, plugins: (plugins ?? []) as ReadonlyArray<unknown> };\n});\n\nexport const writePlugins = Effect.fn(\"CLI.plugin.writePlugins\")(function* (\n\tpath: string,\n\tsource: string,\n\tplugins: ReadonlyArray<unknown>,\n) {\n\tconst fs = yield* FileSystem.FileSystem;\n\tconst nodePath = yield* Path.Path;\n\tconst edited = applyEdits(\n\t\tsource,\n\t\tmodify(source, [\"plugins\"], plugins, { formattingOptions: { tabSize: 2, insertSpaces: false } }),\n\t);\n\tconst directory = nodePath.dirname(path);\n\tyield* fs.makeDirectory(directory, { recursive: true });\n\tconst mode = (yield* fs.exists(path)) ? (yield* fs.stat(path)).mode & 0o777 : 0o600;\n\tconst temporary = yield* fs.makeTempFile({ directory, prefix: `.${nodePath.basename(path)}.`, suffix: \".tmp\" });\n\tyield* fs\n\t\t.writeFileString(temporary, edited.endsWith(\"\\n\") ? edited : `${edited}\\n`)\n\t\t.pipe(\n\t\t\tEffect.andThen(fs.chmod(temporary, mode)),\n\t\t\tEffect.andThen(fs.rename(temporary, path)),\n\t\t\tEffect.ensuring(fs.remove(temporary, { force: true }).pipe(Effect.ignore)),\n\t\t);\n});\n\n/**\n * Serialize one settings read-modify-rename across CLI processes.\n *\n * The install or inspection that precedes an edit stays outside this scope; only the local edit is\n * locked, so unrelated downloads do not wait behind one another.\n */\nexport const withPluginsLock = <A, E, R>(path: string, edit: Effect.Effect<A, E, R>) =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst nodePath = yield* Path.Path;\n\t\tyield* fs.makeDirectory(nodePath.dirname(path), { recursive: true });\n\t\tyield* Plugin.settingsLock(\n\t\t\t`${path}.lock`,\n\t\t\t() => new InvalidInputError({ message: `timed out waiting to edit ${path}` }),\n\t\t);\n\t\treturn yield* edit;\n\t}).pipe(Effect.scoped);\n\n/**\n * Which file the edit lands in.\n *\n * A plugin belongs to a project by default — it is part of how that repository is worked on, so\n * the entry belongs in a file the repository can commit. `--global` writes the user settings file\n * instead, the way `npm -g` installs outside a package: `<--home>/settings.jsonc`, or the\n * `--user-config-dir` one that replaces it.\n *\n * The project is found the way the harness finds it: the nearest ancestor holding a `.codework`\n * directory, so a command run from `packages/app` edits the repository's own file rather than\n * creating a second one beside it. When no ancestor has one, the project begins here -- the\n * directory is created and the caller is told, because that decision changes where every future\n * plugin entry lands, and a mistyped `cd` is the way it goes wrong.\n *\n * There is nothing to warn about between layers: plugin entries from every layer accumulate, so a\n * user-wide entry still applies inside a project that declares its own.\n */\nexport const resolveTarget = Effect.fn(\"CLI.plugin.resolveTarget\")(function* (\n\tshared: Shared,\n\tglobal: boolean,\n\t/**\n\t * Where to discover the project from, when it is not the shell's directory.\n\t *\n\t * A session's host directory is the only other honest answer: it is a declared host path. The\n\t * session's *space* is not, and neither is its project -- a `Project` is env-independent by\n\t * design, so it has no host directory to offer.\n\t */\n\tfrom?: string,\n\t/** Only `plugin add` may establish a project marker when no project exists yet. */\n\tcreate = true,\n) {\n\tconst fs = yield* FileSystem.FileSystem;\n\tconst nodePath = yield* Path.Path;\n\tconst hostCwd = nodePath.resolve(\".\");\n\t// The linked session's host directory, or -- with none -- the one the command runs in.\n\tconst hostDir = from ?? hostCwd;\n\tconst home = yield* Global.resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value });\n\tconst root = global ? undefined : yield* Settings.projectRoot(hostDir, home.home);\n\t// `paths` is ordered lowest priority first: the user layer, then the project.\n\tconst groups = Settings.paths({\n\t\thome: home.home,\n\t\t...(root === undefined ? {} : { root }),\n\t\t...userLayer(shared, hostCwd),\n\t});\n\tconst chosen = global ? 0 : 1;\n\t// An empty group is the project layer saying there is no project above this directory. Then\n\t// this directory becomes one -- reported, not silent, because the marker shadows any outer\n\t// project from now on, so a `.codework/` created by a mistyped `cd` is worth spotting at once.\n\tconst found = groups[chosen] ?? [];\n\tif (found.length > 0) {\n\t\tconst existing = yield* Effect.findFirst(found, (candidate) => fs.exists(candidate));\n\t\treturn {\n\t\t\tpath: Option.getOrElse(existing, () => found[0]!),\n\t\t\t...(root === undefined ? {} : { root }),\n\t\t} satisfies Target;\n\t}\n\tconst marker = nodePath.join(hostDir, \".codework\");\n\t// `created` is reported either way: with `create` unset the marker is named, not made, so a\n\t// caller can say what its write is about to establish without establishing it early.\n\tif (!create)\n\t\treturn { path: nodePath.join(marker, \"settings.jsonc\"), created: marker, root: hostDir } satisfies Target;\n\tyield* fs.makeDirectory(marker, { recursive: true });\n\treturn { path: nodePath.join(marker, \"settings.jsonc\"), created: marker, root: hostDir } satisfies Target;\n});\n"],"mappings":";;;;;;;;;;AAwBA,MAAa,aAAa,QAAgB,YACzC,OAAO,OAAO,OAAO,aAAa,IAC/B,CAAC,IACD,EAAE,eAAe,SAAS,cAAc,OAAO,cAAc,OAAO,OAAO,EAAE;;AAWjF,MAAM,YAAY,UAAuC;CACxD,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,KAAA;CACxD,MAAM,EAAE,SAAS,YAAY;CAC7B,OAAO,OAAO,YAAY,WA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AAM,WAAW,OAAO,OAAO,UAAU,QAAQ,cAAc,GAAG,OAAO,SAAS,CAAC;EACnF,OAAO;GACN,MAAM,OAAO,UAAU,gBAAgB,MAAM,EAAG;GAChD,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK;EACtC;CACD;CACA,MAAM,SAAS,SAAS,KAAK,SAAS,WAAW;CAGjD,IAAI,CAAC,QACJ,OAAO;EAAE,MAAM,SAAS,KAAK,QAAQ,gBAAgB;EAAG,SAAS;EAAQ,MAAM;CAAQ;CACxF,OAAO,GAAG,cAAc,QAAQ,EAAE,WAAW,KAAK,CAAC;CACnD,OAAO;EAAE,MAAM,SAAS,KAAK,QAAQ,gBAAgB;EAAG,SAAS;EAAQ,MAAM;CAAQ;AACxF,CAAC"}
|
|
1
|
+
{"version":3,"file":"settings-BfmoL27m.mjs","names":["parseJsonc"],"sources":["../../src/cli/cmd/handlers/plugin/settings.ts"],"sourcesContent":["import { Global, Plugin, Settings } from \"@codeworksh/harness/effect\";\nimport { Effect, FileSystem, Option, Path } from \"effect\";\nimport { applyEdits, modify, parse as parseJsonc, type ParseError } from \"jsonc-parser\";\nimport { InvalidInputError } from \"../../../error.ts\";\n\n/**\n * Reading and rewriting the `plugins` array of one settings file.\n *\n * Edits go through `jsonc-parser`, so a hand-written file keeps its comments, key order and\n * formatting: a plugin added by the CLI must not reformat a file its owner maintains. The write\n * is a temp file renamed over the original, so an interrupted run leaves the previous settings\n * intact rather than a half-written document.\n */\n\nexport interface Shared {\n\treadonly userConfigDir: Option.Option<string>;\n\treadonly home: Option.Option<string>;\n}\n\n/**\n * The user layer a command reads and writes: `--user-config-dir` when given -- a hard override of\n * the home's settings file -- resolved, like every app-level flag, against the directory the\n * command runs in (`hostCwd`), never against a linked session's `hostDir`.\n */\nexport const userLayer = (shared: Shared, hostCwd: string) =>\n\tOption.isNone(shared.userConfigDir)\n\t\t? {}\n\t\t: { userConfigDir: Settings.userConfigDir(shared.userConfigDir.value, hostCwd) };\n\nexport interface Target {\n\treadonly path: string;\n\t/** Set when this command had to create the project directory, so the caller can say so. */\n\treadonly created?: string;\n\t/** The project this file belongs to, which a local entry is written relative to. */\n\treadonly root?: string;\n}\n\n/** The module an entry names: a bare loader string, or the `package` of a config object. */\nconst moduleOf = (entry: unknown): string | undefined => {\n\tif (typeof entry === \"string\") return entry;\n\tif (typeof entry !== \"object\" || entry === null) return undefined;\n\tconst { package: located } = entry as { package?: unknown };\n\treturn typeof located === \"string\" ? located : undefined;\n};\n\n/** The plugin ID an entry configures, if it names one. */\nconst idOf = (entry: unknown): string | undefined => {\n\tif (typeof entry !== \"object\" || entry === null) return undefined;\n\tconst { plugin } = entry as { plugin?: unknown };\n\treturn typeof plugin === \"string\" ? plugin : undefined;\n};\n\n/**\n * Every spelling a reference answers to, without touching the filesystem.\n *\n * `canonical` drops a version suffix and resolves a relative path against the file that declared\n * it, so `@acme/x@1.2.0` and `@acme/x` are one name. The literal string is kept alongside it\n * because a plugin ID is not a module reference and survives `canonical` unchanged.\n */\nconst aliases = (reference: string, directory: string): Effect.Effect<ReadonlyArray<string>> =>\n\tPlugin.canonical(reference, directory).pipe(\n\t\tEffect.map((canonical) => [reference, canonical] as ReadonlyArray<string>),\n\t\t// A reference that does not parse still answers to itself: a plugin ID is not a module\n\t\t// reference, and it has to keep matching an entry that names it.\n\t\tEffect.orElseSucceed(() => [reference] as ReadonlyArray<string>),\n\t);\n\n/** Every spelling `reference` answers to, computed once for a whole command. */\nexport const spellings = (reference: string, directory: string): Effect.Effect<ReadonlySet<string>> =>\n\tEffect.map(aliases(reference, directory), (found) => new Set(found));\n\nexport interface Entry {\n\treadonly value: unknown;\n\treadonly answers: ReadonlySet<string>;\n\treadonly loads: boolean;\n}\n\n/**\n * What each configured entry answers to.\n *\n * Comparing the string as written is not enough. `plugin add @acme/x@1.2.0` records a version the\n * user will not repeat when removing it, and one plugin can be named three ways: by package, by\n * path, or by the ID it declares -- a `{ \"plugin\": \"<id>\" }` configuration object sits next to the\n * module entry that loaded it, and removing the plugin has to take both.\n *\n * The declared ID is only knowable by importing the module, so it is read from what is already\n * installed: `resolveCached` reads a published package out of the harness cache and never runs an\n * installer, so editing a settings file cannot fetch anything. An entry that does not resolve --\n * uninstalled, moved, or broken -- keeps the names it was written with rather than failing the\n * command, because an unusable plugin is exactly the one a user is trying to remove.\n */\nexport const identify = Effect.fn(\"CLI.plugin.identify\")(function* (\n\tplugins: ReadonlyArray<unknown>,\n\tfile: string,\n\tcache: string,\n) {\n\tconst nodePath = yield* Path.Path;\n\tconst directory = nodePath.dirname(file);\n\tconst entries: Entry[] = [];\n\tfor (const value of plugins) {\n\t\tconst answers = new Set<string>();\n\t\tconst id = idOf(value);\n\t\tif (id !== undefined) answers.add(id);\n\t\tconst module = moduleOf(value);\n\t\tif (module !== undefined) {\n\t\t\tfor (const alias of yield* aliases(module, directory)) answers.add(alias);\n\t\t\tconst declared = yield* Plugin.inspect(module, {\n\t\t\t\tcache,\n\t\t\t\thostDir: directory,\n\t\t\t\tfile,\n\t\t\t\tinstall: Plugin.resolveCached,\n\t\t\t}).pipe(Effect.option);\n\t\t\tif (Option.isSome(declared)) {\n\t\t\t\tanswers.add(declared.value.id);\n\t\t\t\tif (declared.value.name !== undefined) answers.add(declared.value.name);\n\t\t\t}\n\t\t}\n\t\tentries.push({ value, answers, loads: typeof value === \"string\" });\n\t}\n\treturn entries as ReadonlyArray<Entry>;\n});\n\n/**\n * What a local reference should be *written* as, which is rarely what was typed.\n *\n * A relative path on the command line is relative to the command's host directory; in a settings file it is relative to\n * that file's own directory. Those differ the moment the command runs anywhere but the directory\n * holding the file, and writing the string verbatim produces a silently wrong entry:\n *\n * ```\n * $ cd ~/workspace/app/packages/fubar\n * $ codework plugin add ./plugins/x.ts # means packages/fubar/plugins/x.ts\n * → the project is ~/workspace/app, so the entry lands in app/.codework/settings.jsonc\n * → written verbatim, the harness loads app/.codework/plugins/x.ts ← a different file\n * ```\n *\n * With both ends inside one project the entry is written relative to the file, which is portable\n * to any checkout of that repository and therefore worth committing. Otherwise -- a `-g` write\n * into `<home>`, a `--user-config-dir` elsewhere, or a target outside the project -- relative\n * would be a lie, and an absolute path means the same thing read from anywhere.\n *\n * A package spec is returned untouched: it names no location.\n */\nexport const written = Effect.fn(\"CLI.plugin.written\")(function* (\n\treference: string,\n\tinput: { readonly hostDir: string; readonly file: string; readonly root: string | undefined },\n) {\n\tconst nodePath = yield* Path.Path;\n\tconst target = yield* Plugin.parse(reference, input.hostDir).pipe(Effect.option);\n\tif (Option.isNone(target) || target.value.kind !== \"local\") return reference;\n\n\tconst absolute = target.value.path;\n\tconst inside = (root: string, path: string) => path === root || path.startsWith(`${root}${nodePath.sep}`);\n\tif (input.root !== undefined && inside(input.root, input.file) && inside(input.root, absolute)) {\n\t\tconst relative = nodePath.relative(nodePath.dirname(input.file), absolute);\n\t\treturn relative.startsWith(\"..\") ? relative : `./${relative}`;\n\t}\n\treturn absolute;\n});\n\n/** `reference` selects `entry` when any spelling of one is a spelling of the other. */\nexport const matches = (entry: Entry, spelled: ReadonlySet<string>) =>\n\t[...spelled].some((alias) => entry.answers.has(alias));\n\n/** Every entry connected to a reference through a package spelling or declared plugin ID. */\nexport const matching = (entries: ReadonlyArray<Entry>, spelled: ReadonlySet<string>) => {\n\tconst answers = new Set(spelled);\n\tconst found = new Set<Entry>();\n\tfor (;;) {\n\t\tconst next = entries.filter(\n\t\t\t(entry) => !found.has(entry) && [...entry.answers].some((answer) => answers.has(answer)),\n\t\t);\n\t\tif (next.length === 0) return found as ReadonlySet<Entry>;\n\t\tfor (const entry of next) {\n\t\t\tfound.add(entry);\n\t\t\tfor (const answer of entry.answers) answers.add(answer);\n\t\t}\n\t}\n};\n\nexport const readPlugins = Effect.fn(\"CLI.plugin.readPlugins\")(function* (path: string) {\n\tconst fs = yield* FileSystem.FileSystem;\n\tconst exists = yield* fs.exists(path);\n\tconst source = exists ? yield* fs.readFileString(path) : \"{}\";\n\tconst errors: ParseError[] = [];\n\tconst document: unknown = parseJsonc(source, errors, { allowTrailingComma: true });\n\tif (errors.length > 0 || typeof document !== \"object\" || document === null || Array.isArray(document)) {\n\t\treturn yield* new InvalidInputError({ message: `${path} is not a valid settings file` });\n\t}\n\tconst plugins = (document as { plugins?: unknown }).plugins;\n\tif (plugins !== undefined && !Array.isArray(plugins)) {\n\t\treturn yield* new InvalidInputError({ message: `${path}: \"plugins\" must be an array` });\n\t}\n\treturn { source, plugins: (plugins ?? []) as ReadonlyArray<unknown> };\n});\n\nexport const writePlugins = Effect.fn(\"CLI.plugin.writePlugins\")(function* (\n\tpath: string,\n\tsource: string,\n\tplugins: ReadonlyArray<unknown>,\n) {\n\tconst fs = yield* FileSystem.FileSystem;\n\tconst nodePath = yield* Path.Path;\n\tconst edited = applyEdits(\n\t\tsource,\n\t\tmodify(source, [\"plugins\"], plugins, { formattingOptions: { tabSize: 2, insertSpaces: false } }),\n\t);\n\tconst directory = nodePath.dirname(path);\n\tyield* fs.makeDirectory(directory, { recursive: true });\n\tconst mode = (yield* fs.exists(path)) ? (yield* fs.stat(path)).mode & 0o777 : 0o600;\n\tconst temporary = yield* fs.makeTempFile({ directory, prefix: `.${nodePath.basename(path)}.`, suffix: \".tmp\" });\n\tyield* fs\n\t\t.writeFileString(temporary, edited.endsWith(\"\\n\") ? edited : `${edited}\\n`)\n\t\t.pipe(\n\t\t\tEffect.andThen(fs.chmod(temporary, mode)),\n\t\t\tEffect.andThen(fs.rename(temporary, path)),\n\t\t\tEffect.ensuring(fs.remove(temporary, { force: true }).pipe(Effect.ignore)),\n\t\t);\n});\n\n/**\n * Serialize one settings read-modify-rename across CLI processes.\n *\n * The install or inspection that precedes an edit stays outside this scope; only the local edit is\n * locked, so unrelated downloads do not wait behind one another.\n */\nexport const withPluginsLock = <A, E, R>(path: string, edit: Effect.Effect<A, E, R>) =>\n\tEffect.gen(function* () {\n\t\tconst fs = yield* FileSystem.FileSystem;\n\t\tconst nodePath = yield* Path.Path;\n\t\tyield* fs.makeDirectory(nodePath.dirname(path), { recursive: true });\n\t\tyield* Plugin.settingsLock(\n\t\t\t`${path}.lock`,\n\t\t\t() => new InvalidInputError({ message: `timed out waiting to edit ${path}` }),\n\t\t);\n\t\treturn yield* edit;\n\t}).pipe(Effect.scoped);\n\n/**\n * Which file the edit lands in.\n *\n * A plugin belongs to a project by default — it is part of how that repository is worked on, so\n * the entry belongs in a file the repository can commit. `--global` writes the user settings file\n * instead, the way `npm -g` installs outside a package: `<--home>/settings.jsonc`, or the\n * `--user-config-dir` one that replaces it.\n *\n * The project is found the way the harness finds it: the nearest ancestor holding a `.codework`\n * directory, so a command run from `packages/app` edits the repository's own file rather than\n * creating a second one beside it. When no ancestor has one, the project begins here -- the\n * directory is created and the caller is told, because that decision changes where every future\n * plugin entry lands, and a mistyped `cd` is the way it goes wrong.\n *\n * There is nothing to warn about between layers: plugin entries from every layer accumulate, so a\n * user-wide entry still applies inside a project that declares its own.\n */\nexport const resolveTarget = Effect.fn(\"CLI.plugin.resolveTarget\")(function* (\n\tshared: Shared,\n\tglobal: boolean,\n\t/**\n\t * Where to discover the project from, when it is not the shell's directory.\n\t *\n\t * A session's host directory is the only other honest answer: it is a declared host path. The\n\t * session's *space* is not, and neither is its project -- a `Project` is env-independent by\n\t * design, so it has no host directory to offer.\n\t */\n\tfrom?: string,\n\t/** Only `plugin add` may establish a project marker when no project exists yet. */\n\tcreate = true,\n) {\n\tconst fs = yield* FileSystem.FileSystem;\n\tconst nodePath = yield* Path.Path;\n\tconst hostCwd = nodePath.resolve(\".\");\n\t// The linked session's host directory, or -- with none -- the one the command runs in.\n\tconst hostDir = from ?? hostCwd;\n\tconst home = yield* Global.resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value });\n\tconst root = global ? undefined : yield* Settings.projectRoot(hostDir, home.home);\n\t// `paths` is ordered lowest priority first: the user layer, then the project.\n\tconst groups = Settings.paths({\n\t\thome: home.home,\n\t\t...(root === undefined ? {} : { root }),\n\t\t...userLayer(shared, hostCwd),\n\t});\n\tconst chosen = global ? 0 : 1;\n\t// An empty group is the project layer saying there is no project above this directory. Then\n\t// this directory becomes one -- reported, not silent, because the marker shadows any outer\n\t// project from now on, so a `.codework/` created by a mistyped `cd` is worth spotting at once.\n\tconst found = groups[chosen] ?? [];\n\tif (found.length > 0) {\n\t\tconst existing = yield* Effect.findFirst(found, (candidate) => fs.exists(candidate));\n\t\treturn {\n\t\t\tpath: Option.getOrElse(existing, () => found[0]!),\n\t\t\t...(root === undefined ? {} : { root }),\n\t\t} satisfies Target;\n\t}\n\tconst marker = nodePath.join(hostDir, \".codework\");\n\t// `created` is reported either way: with `create` unset the marker is named, not made, so a\n\t// caller can say what its write is about to establish without establishing it early.\n\tif (!create)\n\t\treturn { path: nodePath.join(marker, \"settings.jsonc\"), created: marker, root: hostDir } satisfies Target;\n\tyield* fs.makeDirectory(marker, { recursive: true });\n\treturn { path: nodePath.join(marker, \"settings.jsonc\"), created: marker, root: hostDir } satisfies Target;\n});\n"],"mappings":";;;;;;;;;;AAwBA,MAAa,aAAa,QAAgB,YACzC,OAAO,OAAO,OAAO,aAAa,IAC/B,CAAC,IACD,EAAE,eAAe,SAAS,cAAc,OAAO,cAAc,OAAO,OAAO,EAAE;;AAWjF,MAAM,YAAY,UAAuC;CACxD,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,KAAA;CACxD,MAAM,EAAE,SAAS,YAAY;CAC7B,OAAO,OAAO,YAAY,WAAW,UAAU,KAAA;AAChD;;AAGA,MAAM,QAAQ,UAAuC;CACpD,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO,KAAA;CACxD,MAAM,EAAE,WAAW;CACnB,OAAO,OAAO,WAAW,WAAW,SAAS,KAAA;AAC9C;;;;;;;;AASA,MAAM,WAAW,WAAmB,cACnC,OAAO,UAAU,WAAW,SAAS,CAAC,CAAC,KACtC,OAAO,KAAK,cAAc,CAAC,WAAW,SAAS,CAA0B,GAGzE,OAAO,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Q,MAAM;CAAQ;CACxF,OAAO,GAAG,cAAc,QAAQ,EAAE,WAAW,KAAK,CAAC;CACnD,OAAO;EAAE,MAAM,SAAS,KAAK,QAAQ,gBAAgB;EAAG,SAAS;EAAQ,MAAM;CAAQ;AACxF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as Cmd } from "./runtime-B43doHjV.mjs";
|
|
2
|
-
import { f as layer, n as OAuthError, t as InvalidInputError } from "./error-
|
|
2
|
+
import { f as layer, n as OAuthError, t as InvalidInputError } from "./error-BMI81XvR.mjs";
|
|
3
3
|
import { Effect, Option, Path } from "effect";
|
|
4
4
|
import { Global } from "@codeworksh/harness/effect";
|
|
5
5
|
import { checkOAuthProvider, oauthProviderLabel, summarizeGitHubCopilot, summarizeOpenAICodex } from "@codeworksh/aikit/oauth/summary";
|
|
@@ -113,4 +113,4 @@ const withServer = (url, program) => program.pipe(Effect.provide(layer(url)), Ef
|
|
|
113
113
|
//#endregion
|
|
114
114
|
export { oauthProviderLabel as a, makeOps as i, attempt as n, selectProvider as o, localOps as r, withServer as s, assertServerScope as t };
|
|
115
115
|
|
|
116
|
-
//# sourceMappingURL=shared-
|
|
116
|
+
//# sourceMappingURL=shared-CnuCjvcG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-
|
|
1
|
+
{"version":3,"file":"shared-CnuCjvcG.mjs","names":["Client.layer"],"sources":["../../src/cli/cmd/handlers/auth/shared.ts"],"sourcesContent":["/* @effect-diagnostics nodeBuiltinImport:off -- OAuth login opens the system browser. */\n/* @effect-diagnostics globalDate:off -- Stored expiry timestamps are rendered for the user. */\n/* oxlint-disable effecttsgo/async-function -- Aikit OAuth callbacks require Promise-returning functions. */\nimport {\n\tGitHubCopilotOAuthClient,\n\tJsonGitHubCopilotAuthStorage,\n\ttype GitHubCopilotAuthStorage,\n} from \"@codeworksh/aikit/oauth/github/copilot\";\nimport {\n\tJsonOpenAICodexAuthStorage,\n\tOpenAICodexOAuthClient,\n\ttype OpenAICodexAuthStorage,\n} from \"@codeworksh/aikit/oauth/openai/codex\";\nimport { openBrowser, promptLine } from \"@codeworksh/aikit/oauth/interactive\";\nimport {\n\tcheckOAuthProvider,\n\toauthProviderLabel,\n\tsummarizeGitHubCopilot,\n\tsummarizeOpenAICodex,\n\ttype OAuthSummary,\n} from \"@codeworksh/aikit/oauth/summary\";\nimport { Global } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path } from \"effect\";\nimport { Client } from \"../../../../server/client.ts\";\nimport type { Contract } from \"../../../../server/contract.ts\";\nimport { InvalidInputError, OAuthError } from \"../../../error.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport type Provider = Contract.OAuthProvider;\n\n// The wire shape and aikit's summary are the same record.\nexport type Summary = Contract.OAuthInfo & OAuthSummary;\n\nconst announce = (\n\tinfo: { url: string; userCode?: string | undefined; instructions?: string | undefined },\n\tbrowser: boolean,\n): void => {\n\tprocess.stderr.write(\n\t\t`${info.instructions ?? \"Complete authentication in your browser.\"}\\n${\n\t\t\tinfo.userCode === undefined ? \"\" : `Enter code: ${info.userCode}\\n`\n\t\t}${info.url}\\n`,\n\t);\n\tif (browser) {\n\t\tvoid openBrowser(info.url, (error) => void process.stderr.write(`Failed to open browser: ${error.message}\\n`));\n\t}\n};\n\nexport interface LoginOptions {\n\treadonly browser: boolean;\n\treadonly device: boolean;\n\treadonly enterprise: Option.Option<string>;\n\treadonly enableModels: boolean;\n}\n\nexport interface Ops {\n\treadonly path: string;\n\treadonly login: (options: LoginOptions) => Promise<{ wire: Contract.OAuthCredentials; summary: Summary }>;\n\treadonly stored: () => Promise<Summary | undefined>;\n\treadonly refreshed: () => Promise<Summary | undefined>;\n\treadonly logout: () => Promise<void>;\n}\n\n/** Holds nothing: a server's credentials live on the server, not on this disk. */\nconst transient: OpenAICodexAuthStorage & GitHubCopilotAuthStorage = {\n\tget: async () => undefined,\n\tset: async () => {},\n\tclear: async () => {},\n};\n\nconst codexOps = (storage: OpenAICodexAuthStorage, path: string): Ops => {\n\tconst client = new OpenAICodexOAuthClient({ storage });\n\treturn {\n\t\tpath,\n\t\tlogin: async (options) => {\n\t\t\tconst credentials = await client.login({\n\t\t\t\tdevice: options.device,\n\t\t\t\tonAuth: (info) => announce(info, options.browser),\n\t\t\t\tonProgress: (message) => void process.stderr.write(`${message}\\n`),\n\t\t\t\tonPrompt: (prompt) => promptLine(prompt.message),\n\t\t\t});\n\t\t\treturn { wire: { provider: \"openai-codex\", ...credentials }, summary: summarizeOpenAICodex(credentials) };\n\t\t},\n\t\tstored: async () => {\n\t\t\tconst credentials = await storage.get();\n\t\t\treturn credentials && summarizeOpenAICodex(credentials);\n\t\t},\n\t\trefreshed: async () => {\n\t\t\tconst credentials = await client.getCredentials();\n\t\t\treturn credentials && summarizeOpenAICodex(credentials);\n\t\t},\n\t\tlogout: () => client.logout(),\n\t};\n};\n\nconst copilotOps = (storage: GitHubCopilotAuthStorage, path: string): Ops => {\n\tconst client = new GitHubCopilotOAuthClient({ storage });\n\tconst read = async () => {\n\t\tconst credentials = await storage.get();\n\t\treturn credentials && summarizeGitHubCopilot(credentials);\n\t};\n\treturn {\n\t\tpath,\n\t\tlogin: async (options) => {\n\t\t\tconst credentials = await client.login({\n\t\t\t\t...(Option.isSome(options.enterprise) && { enterpriseUrl: options.enterprise.value }),\n\t\t\t\tenableModels: options.enableModels,\n\t\t\t\tonAuth: (info) => announce(info, options.browser),\n\t\t\t\tonProgress: (message) => void process.stderr.write(`${message}\\n`),\n\t\t\t});\n\t\t\treturn { wire: { provider: \"github-copilot\", ...credentials }, summary: summarizeGitHubCopilot(credentials) };\n\t\t},\n\t\tstored: read,\n\t\t// GitHub OAuth tokens never expire, so there is nothing to refresh.\n\t\trefreshed: read,\n\t\tlogout: () => client.logout(),\n\t};\n};\n\nexport const makeOps = (provider: Provider, options: { path?: string | undefined; persist?: boolean } = {}): Ops => {\n\tconst file = options.path === undefined ? {} : { path: options.path };\n\tif (provider === \"openai-codex\") {\n\t\tconst storage = options.persist === false ? undefined : new JsonOpenAICodexAuthStorage(file);\n\t\treturn codexOps(storage ?? transient, storage?.path ?? \"\");\n\t}\n\tconst storage = options.persist === false ? undefined : new JsonGitHubCopilotAuthStorage(file);\n\treturn copilotOps(storage ?? transient, storage?.path ?? \"\");\n};\n\nexport const attempt = <A>(message: string, run: () => Promise<A>) =>\n\tEffect.tryPromise({ try: run, catch: (cause) => new OAuthError({ message, cause }) });\n\n/** The provider named by the two mutually exclusive flags. */\nexport const selectProvider = (flags: {\n\treadonly openaiCodex: boolean;\n\treadonly githubCopilot: boolean;\n}): Effect.Effect<Provider, InvalidInputError> => {\n\tconst checked = checkOAuthProvider(flags);\n\treturn checked.ok\n\t\t? Effect.succeed(checked.provider)\n\t\t: Effect.fail(new InvalidInputError({ message: checked.message }));\n};\n\n/** Reject the local-credential flags when the credentials live on a server. */\nexport const assertServerScope = (authFile: Option.Option<string>) =>\n\tEffect.gen(function* () {\n\t\tconst shared = yield* Cmd.spec;\n\t\tif (Option.isSome(authFile) || Option.isSome(shared.home)) {\n\t\t\treturn yield* new InvalidInputError({\n\t\t\t\tmessage: \"--auth-file and --home belong on codework serve when using --server\",\n\t\t\t});\n\t\t}\n\t});\n\n/** Credential operations against this machine's auth.json. */\nexport const localOps = (provider: Provider, authFile: Option.Option<string>) =>\n\tEffect.gen(function* () {\n\t\tconst shared = yield* Cmd.spec;\n\t\tconst path = yield* Path.Path;\n\t\tconst file = Option.isSome(authFile)\n\t\t\t? authFile.value\n\t\t\t: Option.isSome(shared.home)\n\t\t\t\t? path.join((yield* Global.resolve({ home: shared.home.value })).home, \"aikit\", \"auth.json\")\n\t\t\t\t: undefined;\n\t\treturn makeOps(provider, file === undefined ? {} : { path: file });\n\t});\n\n/** Run an effect against the RPC server at `url`, discharging the client. */\nexport const withServer = <A, E, R>(url: string, program: Effect.Effect<A, E, R>) =>\n\tprogram.pipe(Effect.provide(Client.layer(url)), Effect.scoped);\n\nexport { Client,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IAAI;CAC1B,IAAI,OAAO,OAAO,QAAQ,KAAK,OAAO,OAAO,OAAO,IAAI,GACvD,OAAO,OAAO,IAAI,kBAAkB,EACnC,SAAS,sEACV,CAAC;AAEH,CAAC;;AAGF,MAAa,YAAY,UAAoB,aAC5C,OAAO,IAAI,aAAa;CACvB,MAAM,SAAS,OAAO,IAAI;CAC1B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,OAAO,OAAO,OAAO,QAAQ,IAChC,SAAS,QACT,OAAO,OAAO,OAAO,IAAI,IACxB,KAAK,MAAM,OAAO,OAAO,QAAQ,EAAE,MAAM,OAAO,KAAK,MAAM,CAAC,EAAA,CAAG,MAAM,SAAS,WAAW,IACzF,KAAA;CACJ,OAAO,QAAQ,UAAU,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC;AAClE,CAAC;;AAGF,MAAa,cAAuB,KAAa,YAChD,QAAQ,KAAK,OAAO,QAAQA,MAAa,GAAG,CAAC,GAAG,OAAO,MAAM"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
|
|
2
|
-
import { d as writeOut, i as reportFailure } from "./error-
|
|
3
|
-
import { i as ensure, n as options } from "./service-
|
|
2
|
+
import { d as writeOut, i as reportFailure } from "./error-BMI81XvR.mjs";
|
|
3
|
+
import { i as ensure, n as options } from "./service-DJR6nPam.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
//#region src/cli/cmd/handlers/service/start.ts
|
|
6
6
|
var start_default = handler(Cmd.commands.service.commands.start, Effect.fn("CLI.service.start")(function* ({ host, port }) {
|
|
@@ -17,4 +17,4 @@ var start_default = handler(Cmd.commands.service.commands.start, Effect.fn("CLI.
|
|
|
17
17
|
//#endregion
|
|
18
18
|
export { start_default as default };
|
|
19
19
|
|
|
20
|
-
//# sourceMappingURL=start-
|
|
20
|
+
//# sourceMappingURL=start-DwhV9ucd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-
|
|
1
|
+
{"version":3,"file":"start-DwhV9ucd.mjs","names":["Runtime.handler","options","Service.options","Discovery.ensure"],"sources":["../../src/cli/cmd/handlers/service/start.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { Discovery } from \"../../../../server/discovery.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Service } from \"../../../service.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.service.commands.start,\n\tEffect.fn(\"CLI.service.start\")(function* ({ host, port }) {\n\t\tconst options = yield* Service.options(yield* Cmd.spec, { host, port });\n\t\tconst server = yield* Discovery.ensure({ ...options, replace: true });\n\t\tyield* writeOut(`${server.url}\\n`);\n\t}, Effect.catch(reportFailure)),\n);\n"],"mappings":";;;;;AAQA,IAAA,gBAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,OAC9B,OAAO,GAAG,mBAAmB,CAAC,CAAC,WAAW,EAAE,MAAM,QAAQ;CACzD,MAAMC,YAAU,OAAOC,QAAgB,OAAO,IAAI,MAAM;EAAE;EAAM;CAAK,CAAC;CACtE,MAAM,SAAS,OAAOC,OAAiB;EAAE,GAAGF;EAAS,SAAS;CAAK,CAAC;CACpE,OAAO,SAAS,GAAG,OAAO,IAAI,GAAG;AAClC,GAAG,OAAO,MAAM,aAAa,CAAC,CAC/B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
|
|
2
|
-
import { d as writeOut, i as reportFailure } from "./error-
|
|
3
|
-
import { r as discover, t as home } from "./service-
|
|
2
|
+
import { d as writeOut, i as reportFailure } from "./error-BMI81XvR.mjs";
|
|
3
|
+
import { r as discover, t as home } from "./service-DJR6nPam.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
//#region src/cli/cmd/handlers/service/status.ts
|
|
6
6
|
var status_default = handler(Cmd.commands.service.commands.status, Effect.fn("CLI.service.status")(function* () {
|
|
@@ -11,4 +11,4 @@ var status_default = handler(Cmd.commands.service.commands.status, Effect.fn("CL
|
|
|
11
11
|
//#endregion
|
|
12
12
|
export { status_default as default };
|
|
13
13
|
|
|
14
|
-
//# sourceMappingURL=status-
|
|
14
|
+
//# sourceMappingURL=status-Bklxb3u6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-
|
|
1
|
+
{"version":3,"file":"status-Bklxb3u6.mjs","names":["Runtime.handler","Service.home","Discovery.discover"],"sources":["../../src/cli/cmd/handlers/service/status.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { Discovery } from \"../../../../server/discovery.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Service } from \"../../../service.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.service.commands.status,\n\tEffect.fn(\"CLI.service.status\")(function* () {\n\t\tconst paths = yield* Service.home(yield* Cmd.spec);\n\t\tconst server = yield* Discovery.discover(paths.home);\n\t\tyield* writeOut(`${server?.url ?? \"stopped\"}\\n`);\n\t}, Effect.catch(reportFailure)),\n);\n"],"mappings":";;;;;AAQA,IAAA,iBAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,QAC9B,OAAO,GAAG,oBAAoB,CAAC,CAAC,aAAa;CAC5C,MAAM,QAAQ,OAAOC,KAAa,OAAO,IAAI,IAAI;CACjD,MAAM,SAAS,OAAOC,SAAmB,MAAM,IAAI;CACnD,OAAO,SAAS,GAAG,QAAQ,OAAO,UAAU,GAAG;AAChD,GAAG,OAAO,MAAM,aAAa,CAAC,CAC/B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
|
|
2
|
-
import { d as writeOut, i as reportFailure, n as OAuthError, p as make } from "./error-
|
|
3
|
-
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-
|
|
2
|
+
import { d as writeOut, i as reportFailure, n as OAuthError, p as make } from "./error-BMI81XvR.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-CnuCjvcG.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { formatOAuthSummary, oauthNotice } from "@codeworksh/aikit/oauth/summary";
|
|
6
6
|
//#region src/cli/cmd/handlers/auth/status.ts
|
|
@@ -28,4 +28,4 @@ var status_default = handler(Cmd.commands.auth.commands.status, Effect.fn("CLI.a
|
|
|
28
28
|
//#endregion
|
|
29
29
|
export { status_default as default };
|
|
30
30
|
|
|
31
|
-
//# sourceMappingURL=status-
|
|
31
|
+
//# sourceMappingURL=status-DVzFDoek.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-
|
|
1
|
+
{"version":3,"file":"status-DVzFDoek.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/status.ts"],"sourcesContent":["import { formatOAuthSummary, oauthNotice } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { OAuthError, reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport {\n\tassertServerScope,\n\tattempt,\n\tClient,\n\tlocalOps,\n\toauthProviderLabel,\n\tselectProvider,\n\twithServer,\n} from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.auth.commands.status,\n\tEffect.fn(\"CLI.auth.status\")(function* ({ server, openaiCodex, githubCopilot, authFile, json }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst provider = yield* selectProvider({ openaiCodex, githubCopilot });\n\t\t\tconst name = oauthProviderLabel(provider);\n\n\t\t\tif (Option.isSome(server)) {\n\t\t\t\tyield* assertServerScope(authFile);\n\t\t\t\treturn yield* withServer(\n\t\t\t\t\tserver.value,\n\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\tconst rpc = yield* Client.make;\n\t\t\t\t\t\tconst info = yield* rpc[\"auth.status\"]({ provider });\n\t\t\t\t\t\tif (info === null) {\n\t\t\t\t\t\t\treturn yield* new OAuthError({ message: oauthNotice(\"missing\", provider, \"the server\") });\n\t\t\t\t\t\t}\n\t\t\t\t\t\tyield* writeOut(formatOAuthSummary(info, { json }));\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst ops = yield* localOps(provider, authFile);\n\t\t\tconst summary = yield* attempt(`failed to read ${name} credentials`, () => ops.stored());\n\t\t\tif (summary === undefined) {\n\t\t\t\treturn yield* new OAuthError({ message: oauthNotice(\"missing\", provider, ops.path) });\n\t\t\t}\n\t\t\tyield* writeOut(formatOAuthSummary(summary, { json }));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAgBA,IAAA,iBAAeA,QACd,IAAI,SAAS,KAAK,SAAS,QAC3B,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,QAAQ,aAAa,eAAe,UAAU,QAAQ;CA4B/F,OAAO,OA3BS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,eAAe;GAAE;GAAa;EAAc,CAAC;EACrE,MAAM,OAAO,mBAAmB,QAAQ;EAExC,IAAI,OAAO,OAAO,MAAM,GAAG;GAC1B,OAAO,kBAAkB,QAAQ;GACjC,OAAO,OAAO,WACb,OAAO,OACP,OAAO,IAAI,aAAa;IAEvB,MAAM,OAAO,QAAO,OADDC,KAAAA,CACK,cAAc,CAAC,EAAE,SAAS,CAAC;IACnD,IAAI,SAAS,MACZ,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,YAAY,EAAE,CAAC;IAEzF,OAAO,SAAS,mBAAmB,MAAM,EAAE,KAAK,CAAC,CAAC;GACnD,CAAC,CACF;EACD;EAEA,MAAM,MAAM,OAAO,SAAS,UAAU,QAAQ;EAC9C,MAAM,UAAU,OAAO,QAAQ,kBAAkB,KAAK,qBAAqB,IAAI,OAAO,CAAC;EACvF,IAAI,YAAY,KAAA,GACf,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,IAAI,IAAI,EAAE,CAAC;EAErF,OAAO,SAAS,mBAAmB,SAAS,EAAE,KAAK,CAAC,CAAC;CACtD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
|
|
2
|
-
import { i as reportFailure } from "./error-
|
|
3
|
-
import { o as stop, t as home } from "./service-
|
|
2
|
+
import { i as reportFailure } from "./error-BMI81XvR.mjs";
|
|
3
|
+
import { o as stop, t as home } from "./service-DJR6nPam.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
//#region src/cli/cmd/handlers/service/stop.ts
|
|
6
6
|
var stop_default = handler(Cmd.commands.service.commands.stop, Effect.fn("CLI.service.stop")(function* () {
|
|
@@ -10,4 +10,4 @@ var stop_default = handler(Cmd.commands.service.commands.stop, Effect.fn("CLI.se
|
|
|
10
10
|
//#endregion
|
|
11
11
|
export { stop_default as default };
|
|
12
12
|
|
|
13
|
-
//# sourceMappingURL=stop-
|
|
13
|
+
//# sourceMappingURL=stop-DI91UvG_.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop-
|
|
1
|
+
{"version":3,"file":"stop-DI91UvG_.mjs","names":["Runtime.handler","Service.home","Discovery.stop"],"sources":["../../src/cli/cmd/handlers/service/stop.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { Discovery } from \"../../../../server/discovery.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { Service } from \"../../../service.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.service.commands.stop,\n\tEffect.fn(\"CLI.service.stop\")(function* () {\n\t\tconst paths = yield* Service.home(yield* Cmd.spec);\n\t\tyield* Discovery.stop(paths.home);\n\t}, Effect.catch(reportFailure)),\n);\n"],"mappings":";;;;;AAOA,IAAA,eAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,MAC9B,OAAO,GAAG,kBAAkB,CAAC,CAAC,aAAa;CAC1C,MAAM,QAAQ,OAAOC,KAAa,OAAO,IAAI,IAAI;CACjD,OAAOC,KAAe,MAAM,IAAI;AACjC,GAAG,OAAO,MAAM,aAAa,CAAC,CAC/B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
|
|
2
|
-
import { r as renderError, t as InvalidInputError, u as writeError } from "./error-
|
|
3
|
-
import { n as current } from "./identity-
|
|
4
|
-
import { a as keepAlive, i as ensure, n as options, s as probe } from "./service-
|
|
2
|
+
import { r as renderError, t as InvalidInputError, u as writeError } from "./error-BMI81XvR.mjs";
|
|
3
|
+
import { n as current } from "./identity-BA1-EGoN.mjs";
|
|
4
|
+
import { a as keepAlive, i as ensure, n as options, s as probe } from "./service-DJR6nPam.mjs";
|
|
5
5
|
import { Effect, Option } from "effect";
|
|
6
6
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
7
7
|
//#region src/cli/cmd/handlers/tui.ts
|
|
@@ -73,4 +73,4 @@ var tui_default = handler(Cmd.commands.tui, Effect.fn("CLI.tui", { level: "Info"
|
|
|
73
73
|
//#endregion
|
|
74
74
|
export { tui_default as default };
|
|
75
75
|
|
|
76
|
-
//# sourceMappingURL=tui-
|
|
76
|
+
//# sourceMappingURL=tui-Cdim7SjU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui-
|
|
1
|
+
{"version":3,"file":"tui-Cdim7SjU.mjs","names":["Health.probe","Discovery.ensure","Discovery.keepAlive","Runtime.handler","options","Service.options"],"sources":["../../src/cli/cmd/handlers/tui.ts"],"sourcesContent":["import { Effect, Option } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport { Runtime } from \"../../../framework/runtime.ts\";\nimport { Discovery } from \"../../../server/discovery.ts\";\nimport { Health } from \"../../../server/health.ts\";\nimport { Identity } from \"../../../server/identity.ts\";\nimport { InvalidInputError, renderError } from \"../../error.ts\";\nimport { writeError } from \"../../output.ts\";\nimport { Service } from \"../../service.ts\";\nimport { Cmd } from \"../cmd.ts\";\n\n/**\n * Adopt a server the user started, only if it answers `server.info`: the UI must\n * never launch against an endpoint that is not a CodeWork server. A different\n * build is allowed, with a warning, because the user chose it.\n */\nconst attach = (url: string) =>\n\tEffect.gen(function* () {\n\t\tconst info = yield* Health.probe(url);\n\t\tif (info === undefined) return yield* new InvalidInputError({ message: `no CodeWork server answered at ${url}` });\n\t\tif (info.version !== Identity.current.version) {\n\t\t\tyield* Effect.sync(() =>\n\t\t\t\tprocess.stderr.write(\n\t\t\t\t\t`warning: server at ${url} runs ${info.version}; this client is ${Identity.current.version}\\n`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\treturn url;\n\t});\n\n/** Start or reuse the local server, and keep it up while the TUI runs. */\nconst managed = (options: Discovery.Options) =>\n\tEffect.gen(function* () {\n\t\tconst resolved = yield* Discovery.ensure({\n\t\t\t...options,\n\t\t\t// An upgraded CLI must not drive a server from an older build.\n\t\t\treplace: true,\n\t\t\tonStart: (reason) =>\n\t\t\t\tvoid process.stderr.write(\n\t\t\t\t\treason === \"version-mismatch\"\n\t\t\t\t\t\t? \"Restarting CodeWork server (version mismatch)...\\n\"\n\t\t\t\t\t\t: `Starting CodeWork server on ${options.host}:${options.port}...\\n`,\n\t\t\t\t),\n\t\t});\n\t\t// The TUI only reconnects; restoring a server that dies under it is ours to do.\n\t\tyield* Discovery.keepAlive(resolved, options).pipe(Effect.forkScoped);\n\t\treturn resolved.url;\n\t});\n\n/**\n * Run the TUI in the foreground, on this terminal, for as long as this command\n * runs. It stays in this process group (`detached: false`) so it keeps the\n * terminal; stdio is inherited because it draws and reads raw keys itself. The\n * scope is what ties their lifetimes: when this command is interrupted (SIGINT,\n * SIGTERM), closing it terminates the TUI rather than leaving it on the screen.\n */\nconst run = (binary: string, args: ReadonlyArray<string>, env: Record<string, string>) =>\n\tEffect.gen(function* () {\n\t\tconst spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n\t\tconst tui = yield* spawner.spawn(\n\t\t\tChildProcess.make(binary, [...args], {\n\t\t\t\tenv,\n\t\t\t\textendEnv: true,\n\t\t\t\tdetached: false,\n\t\t\t\tstdin: \"inherit\",\n\t\t\t\tstdout: \"inherit\",\n\t\t\t\tstderr: \"inherit\",\n\t\t\t}),\n\t\t);\n\t\t// A TUI killed by a signal has no exit code; it still must not read as success.\n\t\treturn yield* tui.exitCode.pipe(Effect.orElseSucceed(() => 1));\n\t}).pipe(Effect.scoped);\n\nexport default Runtime.handler(\n\tCmd.commands.tui,\n\tEffect.fn(\"CLI.tui\", { level: \"Info\" })(function* ({ server, host, port, args }) {\n\t\tconst shared = yield* Cmd.spec;\n\n\t\tconst program = Effect.gen(function* () {\n\t\t\tif (Option.isSome(server) && [shared.home, shared.database, shared.userConfigDir].some(Option.isSome)) {\n\t\t\t\treturn yield* new InvalidInputError({\n\t\t\t\t\tmessage: \"--home, --database, and --user-config-dir belong on codework serve when using --server\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst options = yield* Service.options(shared, { host, port });\n\t\t\tconst url = yield* Option.isSome(server) ? attach(server.value) : managed(options);\n\n\t\t\t// Imported lazily: binary resolution must stay off the path of every other command.\n\t\t\tconst launcher = yield* Effect.promise(() => import(\"@codeworksh/tui\"));\n\t\t\tconst binary = yield* Effect.try({\n\t\t\t\ttry: () => launcher.resolveBinary(),\n\t\t\t\tcatch: (error) => new InvalidInputError({ message: (error as Error).message }),\n\t\t\t});\n\t\t\treturn yield* run(binary, args, {\n\t\t\t\t[launcher.ENV_SERVER]: url,\n\t\t\t\t// The TUI reads its own config and credentials, so it must resolve the same home\n\t\t\t\t// the server uses; otherwise the UI would show a different installation.\n\t\t\t\tCODEWORK_HOME_DIR: options.home,\n\t\t\t});\n\t\t});\n\n\t\tconst code = yield* program.pipe(\n\t\t\tEffect.scoped,\n\t\t\tEffect.catch((error) => writeError(renderError(error)).pipe(Effect.as(1))),\n\t\t);\n\t\tyield* Effect.sync(() => {\n\t\t\tprocess.exitCode = code;\n\t\t});\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,UAAU,QACf,OAAO,IAAI,aAAa;CACvB,MAAM,OAAO,OAAOA,MAAa,GAAG;CACpC,IAAI,SAAS,KAAA,GAAW,OAAO,OAAO,IAAI,kBAAkB,EAAE,SAAS,kCAAkC,MAAM,CAAC;CAChH,IAAI,KAAK,YAAA,QAA6B,SACrC,OAAO,OAAO,WACb,QAAQ,OAAO,MACd,sBAAsB,IAAI,QAAQ,KAAK,QAAQ,mBAAA,QAAoC,QAAQ,GAC5F,CACD;CAED,OAAO;AACR,CAAC;;AAGF,MAAM,WAAW,YAChB,OAAO,IAAI,aAAa;CACvB,MAAM,WAAW,OAAOC,OAAiB;EACxC,GAAG;EAEH,SAAS;EACT,UAAU,WACT,KAAK,QAAQ,OAAO,MACnB,WAAW,qBACR,uDACA,+BAA+B,QAAQ,KAAK,GAAG,QAAQ,KAAK,MAChE;CACF,CAAC;CAED,OAAOC,UAAoB,UAAU,OAAO,CAAC,CAAC,KAAK,OAAO,UAAU;CACpE,OAAO,SAAS;AACjB,CAAC;;;;;;;;AASF,MAAM,OAAO,QAAgB,MAA6B,QACzD,OAAO,IAAI,aAAa;CAavB,O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O,WAAW;EACxB,QAAQ,WAAW;CACpB,CAAC;AACF,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
|
|
2
|
-
import { d as writeOut, i as reportFailure } from "./error-
|
|
3
|
-
import { a as targeted, i as read, n as local, r as probe, t as fetchable } from "./entries-
|
|
2
|
+
import { d as writeOut, i as reportFailure } from "./error-BMI81XvR.mjs";
|
|
3
|
+
import { a as targeted, i as read, n as local, r as probe, t as fetchable } from "./entries-KpYvZdpi.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { Plugin } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/plugin/update.ts
|
|
@@ -48,4 +48,4 @@ var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI
|
|
|
48
48
|
//#endregion
|
|
49
49
|
export { update_default as default };
|
|
50
50
|
|
|
51
|
-
//# sourceMappingURL=update-
|
|
51
|
+
//# sourceMappingURL=update-D0XPVfJu.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-
|
|
1
|
+
{"version":3,"file":"update-D0XPVfJu.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/plugin/update.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { fetchable, local, probe, read, targeted } from \"./entries.ts\";\n\n/**\n * Take whatever `check` found.\n *\n * Only a plugin that is **already installed** is refreshed: \"not installed\" is not \"outdated\", and\n * `plugin install` is the verb for that. Each refresh publishes a new generation, which a running\n * session picks up at its next exchange -- so this command never has to reach into a server.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.update,\n\tEffect.fn(\"CLI.plugin.update\")(function* ({ spec }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache, hostDir } = yield* read(shared);\n\t\t\tconst selected = yield* targeted(entries, spec, hostDir);\n\t\t\tif (selected.length === 0 && Option.isSome(spec)) return;\n\n\t\t\tlet updated = 0;\n\t\t\tlet failed = 0;\n\t\t\tfor (const entry of selected) {\n\t\t\t\tconst target = fetchable(entry.target);\n\t\t\t\t// A local plugin has no revision to compare and is never copied into the store.\n\t\t\t\tif (target === undefined) {\n\t\t\t\t\tyield* local(entry, spec);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst result = yield* Plugin.update(target, cache, {\n\t\t\t\t\tprobe: probe(cache, entry.from),\n\t\t\t\t\tfrom: entry.from,\n\t\t\t\t\t// Validated while staged, so a refresh that fetches something broken leaves\n\t\t\t\t\t// the generation already in use as the answer. Preserve the loader's reason:\n\t\t\t\t\t// an import failure or invalid definition is not a missing entrypoint.\n\t\t\t\t\tvalidate: (fetched) => Plugin.definition(fetched.entrypoint, entry.reference).pipe(Effect.asVoid),\n\t\t\t\t}).pipe(Effect.result);\n\n\t\t\t\tif (result._tag === \"Failure\") {\n\t\t\t\t\tfailed += 1;\n\t\t\t\t\tyield* writeOut(`${entry.reference} error[${result.failure.reason}]: ${result.failure.message}\\n`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (result.success._tag === \"updated\") {\n\t\t\t\t\tupdated += 1;\n\t\t\t\t\tyield* writeOut(`Updated ${entry.reference} to ${result.success.entry.revision ?? \"a new revision\"}\\n`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// A spec that named only local plugins compared nothing, so there is nothing to sum up.\n\t\t\tif (Option.isSome(spec) && selected.every((entry) => fetchable(entry.target) === undefined)) return;\n\t\t\tyield* writeOut(updated === 0 ? \"Nothing to update.\\n\" : `${updated} updated.\\n`);\n\t\t\tif (failed > 0) process.exitCode = 1;\n\t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I,yBAAyB,GAAG,QAAQ,YAAY;EAChF,IAAI,SAAS,GAAG,QAAQ,WAAW;CACpC,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
package/error-CPo0lJt1.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-CPo0lJt1.mjs","names":["decode","OAuthError","Contract.Api","Envelope.decode","Client.ExecutionError"],"sources":["../../src/server/envelope.ts","../../src/server/part.ts","../../src/server/contract.ts","../../src/server/client.ts","../../src/cli/output.ts","../../src/cli/error.ts"],"sourcesContent":["import { EventList, EventSchema, optional } from \"@codeworksh/harness/effect\";\nimport { Effect, Schema } from \"effect\";\n\n/**\n * The wire form of an `EventSchema.Payload`. `data` is carried in its encoded\n * form — decoded payloads are not wire-safe (`Schema.Duration`, aikit class\n * transforms) — so clients decode it lazily through their own copy of the\n * registry and can skip types they do not know.\n */\nexport const EventEnvelope = Schema.Struct({\n\tid: EventSchema.ID,\n\ttype: Schema.String,\n\tdurable: optional(Schema.Struct({ aggregateId: Schema.String, seq: Schema.Int, version: Schema.Int })),\n\tmetadata: optional(Schema.Record(Schema.String, Schema.String)),\n\tdata: Schema.Unknown,\n});\nexport type EventEnvelope = typeof EventEnvelope.Type;\n\nexport class UnknownEventTypeError extends Schema.TaggedError<UnknownEventTypeError>()(\"UnknownEventTypeError\", {\n\ttype: Schema.String,\n}) {}\n\n/** The transport's own readiness frame; it has no meaning inside the harness. */\nexport const Connected = EventSchema.define({ type: \"server.connected\", schema: {} });\n\n/** Resolves a published type to the definition that encodes it. */\nexport type Registry = (type: string) => EventSchema.Definition | undefined;\n\n/**\n * What a stock client can decode: the harness's public events plus the frames\n * the transport adds itself. A server may know more than this -- plugins\n * register their own types -- which is exactly why `data` crosses the wire\n * encoded and is decoded lazily, so an unknown type is skipped, not fatal.\n */\nconst core = EventSchema.latest([...EventList.PublicDefinitions, Connected]);\nexport const Core: Registry = (type) => core.get(type);\n\nexport class EncodingError extends Schema.TaggedError<EncodingError>()(\"EventEncodingError\", {\n\ttype: Schema.String,\n\tcause: Schema.Defect(),\n}) {}\n\nexport const encode = Effect.fn(\"Envelope.encode\")(function* (payload: EventSchema.Payload, registry: Registry = Core) {\n\tconst definition = registry(payload.type);\n\tif (definition === undefined) return yield* new UnknownEventTypeError({ type: payload.type });\n\tconst data = yield* Schema.encodeEffect(definition.data)(payload.data).pipe(\n\t\tEffect.mapError((cause) => new EncodingError({ type: payload.type, cause })),\n\t);\n\treturn {\n\t\tid: payload.id,\n\t\ttype: payload.type,\n\t\t...(payload.durable === undefined ? {} : { durable: payload.durable }),\n\t\t...(payload.metadata === undefined ? {} : { metadata: payload.metadata }),\n\t\tdata,\n\t};\n});\n\nexport const decode = Effect.fn(\"Envelope.decode\")(function* (envelope: EventEnvelope, registry: Registry = Core) {\n\tconst definition = registry(envelope.type);\n\tif (definition === undefined) {\n\t\treturn yield* new UnknownEventTypeError({ type: envelope.type });\n\t}\n\tconst data = yield* Schema.decodeEffect(definition.data)(envelope.data);\n\treturn {\n\t\tid: envelope.id,\n\t\ttype: envelope.type,\n\t\t...(envelope.durable === undefined ? {} : { durable: envelope.durable }),\n\t\t...(envelope.metadata === undefined ? {} : { metadata: envelope.metadata }),\n\t\tdata,\n\t} as EventSchema.Payload;\n});\n\nexport * as Envelope from \"./envelope.ts\";\n","import { Schema } from \"effect\";\n\n/*\n * A stored message part as clients see it: aikit's part JSON (persisted verbatim by the harness),\n * narrowed to what a client renders. Provider replay data (signatures, namespaces) and tool\n * `details` are left out, so decoding a stored part drops them.\n */\n\nexport const TextContent = Schema.Struct({ type: Schema.Literal(\"text\"), text: Schema.String });\nexport const ImageContent = Schema.Struct({\n\ttype: Schema.Literal(\"image\"),\n\tdata: Schema.String,\n\tmimeType: Schema.String,\n});\nexport const ThinkingContent = Schema.Struct({\n\ttype: Schema.Literal(\"thinking\"),\n\tthinking: Schema.String,\n\t/** The provider withheld the reasoning; `thinking` is then empty. */\n\tredacted: Schema.optionalKey(Schema.Boolean),\n});\n\n/** aikit's ToolStatusEnum. */\nexport const ToolStatus = Schema.Literals([\"pending\", \"running\", \"completed\", \"error\", \"skipped\", \"aborted\"]);\n\nexport const ToolResult = Schema.Struct({\n\tcontent: Schema.Array(Schema.Union([TextContent, ImageContent])),\n\tisError: Schema.Boolean,\n});\n\nexport const ToolCall = Schema.Struct({\n\ttype: Schema.Literal(\"toolCall\"),\n\tcallID: Schema.String,\n\tname: Schema.String,\n\targuments: Schema.Record(Schema.String, Schema.Json),\n\tstatus: ToolStatus,\n\t/** Present once the call settled (completed, error, skipped, aborted). */\n\tresult: Schema.optionalKey(ToolResult),\n\t/** Epoch milliseconds: started, and last lifecycle update. */\n\ttime: Schema.optionalKey(Schema.Struct({ start: Schema.Finite, end: Schema.Finite })),\n});\nexport type ToolCall = typeof ToolCall.Type;\n\nexport const Part = Schema.Union([TextContent, ImageContent, ThinkingContent, ToolCall]);\nexport type Part = typeof Part.Type;\n\n/** A stored part row's JSON, or none when it is not a part a client renders. */\nexport const decode = Schema.decodeUnknownOption(Schema.fromJsonString(Part));\n\nexport * as MessagePart from \"./part.ts\";\n","import { Model } from \"@codeworksh/aikit\";\nimport {\n\tControl,\n\tEvent,\n\tLocation,\n\toptional,\n\tProject,\n\tPromptSchema,\n\tRunner,\n\tSandbox,\n\tSandboxError,\n\tSession,\n\tSessionStore,\n\tSettings,\n} from \"@codeworksh/harness/effect\";\nimport { Schema } from \"effect\";\nimport { Rpc, RpcGroup } from \"effect/rpc\";\nimport { EncodingError, EventEnvelope } from \"./envelope.ts\";\nimport { Part } from \"./part.ts\";\n\n/** The HTTP path the RPC endpoint is served on; the version moves with breaking wire changes. */\nexport const path = \"/rpc/v1\";\n\nexport const SandboxInfo = Schema.Struct({\n\tid: Sandbox.SandboxInstance.ID,\n\tdriver: Schema.String,\n\tkind: Sandbox.SandboxInstance.Kind,\n\tproviderResourceId: Schema.OptionFromNullOr(Schema.String),\n\townership: Sandbox.SandboxInstance.Ownership,\n\tstatus: Sandbox.SandboxInstance.Status,\n\tusage: Sandbox.SandboxInstance.Usage,\n\trefCount: Schema.Int,\n\tcreatedAt: Schema.DateFromString,\n\tupdatedAt: Schema.DateFromString,\n});\nexport type SandboxInfo = typeof SandboxInfo.Type;\n\nexport const SessionInfo = Schema.Struct({\n\tid: Session.SessionSchema.ID,\n\ttitle: Schema.String,\n\tdirectory: Session.AbsolutePath,\n\t/** The host directory this session is anchored to. Absent when it has none. */\n\thostDir: optional(Session.AbsolutePath),\n\tsandbox: optional(SandboxInfo),\n\t/** The project the session's space belongs to. */\n\tproject: optional(Schema.Struct({ id: Schema.String, name: Schema.String })),\n\t/** Last activity, epoch milliseconds. */\n\tupdatedAt: Schema.Finite,\n\t/** The model chosen for this session; absent when settings decide. */\n\tmodel: optional(Schema.Struct({ provider: Schema.String, id: Schema.String })),\n\t/** The thinking level chosen for this session; absent when settings decide. */\n\tthinkingLevel: optional(Schema.Enum(Model.ThinkingLevelEnum)),\n});\nexport type SessionInfo = typeof SessionInfo.Type;\n\n/** One message on a session's active branch, oldest first. */\nexport const HistoryEntry = Schema.Struct({\n\t/** The entry id: what live events and `session.message` refer to. */\n\tid: Schema.String,\n\t/** Its place in the session's durable log; live events continue from it. */\n\tseq: Schema.Int,\n\trole: Schema.Literals([\"user\", \"assistant\"]),\n\t/** `draft` is a reply still streaming; `aborted` one that was interrupted. */\n\tstate: Schema.Literals([\"committed\", \"draft\", \"aborted\"]),\n\t/** Epoch milliseconds. */\n\tcreatedAt: Schema.Finite,\n\t/** Epoch milliseconds of the last change; for a reply, when it ended once it is no longer a draft. */\n\tupdatedAt: Schema.Finite,\n\tparts: Schema.Array(Part),\n});\nexport type HistoryEntry = typeof HistoryEntry.Type;\n\n/** Ends `session.log`'s replay; `seq` is absent when the session has no durable events yet. */\nexport const LogSynced = Schema.Struct({\n\ttype: Schema.Literal(\"log.synced\"),\n\t/** The session the log was read for. */\n\taggregateId: Schema.String,\n\tseq: optional(Schema.Int),\n});\nexport type LogSynced = typeof LogSynced.Type;\n\nexport const RuntimeConfig = Schema.Struct({\n\tmodel: optional(Schema.Struct({ provider: Schema.String, id: Schema.String })),\n\tthinkingLevel: optional(Schema.Enum(Model.ThinkingLevelEnum)),\n});\nexport type RuntimeConfig = typeof RuntimeConfig.Type;\n\nexport const SandboxRef = Sandbox.Selection;\n\n/** A model to choose, by the catalog's id and display name, with the thinking levels it supports. */\nexport const ModelOption = Schema.Struct({\n\tid: Schema.String,\n\tname: Schema.String,\n\t/** In ascending order; `[\"off\"]` for a model that does not reason. */\n\tthinkingLevels: Schema.Array(Schema.Enum(Model.ThinkingLevelEnum)),\n});\n\n/** A provider this server can call, with the models a session may use from it. */\nexport const ModelProvider = Schema.Struct({\n\tid: Schema.String,\n\tname: Schema.String,\n\tmodels: Schema.Array(ModelOption),\n});\nexport type ModelProvider = typeof ModelProvider.Type;\n\n/** A project's name as a client sets it: trimmed, never empty. */\nexport const ProjectName = Schema.Trimmed.check(Schema.isNonEmpty());\n\nexport class OAuthError extends Schema.TaggedError<OAuthError>()(\"Server.OAuthError\", {\n\tmessage: Schema.String,\n}) {}\n\n/** OAuth providers whose credentials this server stores. */\nexport const OAuthProvider = Schema.Literals([\"openai-codex\", \"github-copilot\"]);\nexport type OAuthProvider = typeof OAuthProvider.Type;\n\n/**\n * Credentials as the provider's aikit module persists them. The union is\n * discriminated by `provider` so one set of RPCs serves every login.\n */\nexport const OAuthCredentials = Schema.Union([\n\tSchema.Struct({\n\t\tprovider: Schema.Literal(\"openai-codex\"),\n\t\taccess: Schema.String,\n\t\trefresh: Schema.String,\n\t\texpires: Schema.Finite,\n\t\taccountId: Schema.String,\n\t}),\n\tSchema.Struct({\n\t\tprovider: Schema.Literal(\"github-copilot\"),\n\t\taccess: Schema.String,\n\t\trefresh: Schema.String,\n\t\texpires: Schema.Finite,\n\t\tenterpriseUrl: optional(Schema.String),\n\t\tapiEndpoint: optional(Schema.String),\n\t\tavailableModelIds: optional(Schema.Array(Schema.String)),\n\t}),\n]);\nexport type OAuthCredentials = typeof OAuthCredentials.Type;\n\n/** What a login looks like from the outside: never the tokens themselves. */\nexport const OAuthInfo = Schema.Struct({\n\tprovider: OAuthProvider,\n\t/** Epoch millis, or 0 for a credential that does not expire. */\n\texpires: Schema.Finite,\n\taccountId: optional(Schema.String),\n\tapiEndpoint: optional(Schema.String),\n\tenterpriseUrl: optional(Schema.String),\n\tavailableModels: optional(Schema.Int),\n});\nexport type OAuthInfo = typeof OAuthInfo.Type;\n\nconst SessionErrors = Schema.Union([\n\tSessionStore.SessionNotFoundError,\n\tSessionStore.SessionLinkedSpaceNotFoundError,\n\tSessionStore.RelinkError,\n]);\n\n// Every lifecycle error the sandbox control plane can raise; narrowing per\n// endpoint would misreport what `withMount` and `stop` actually fail with.\nconst SandboxErrors = Schema.Union([\n\tSandboxError.SandboxNotFoundError,\n\tSandboxError.SandboxDriverNotRegisteredError,\n\tSandboxError.SandboxDriverRegistrationError,\n\tSandboxError.SandboxUnsupportedError,\n\tSandboxError.SandboxProviderError,\n\tSandboxError.SandboxUnavailError,\n\tSandboxError.SandboxRemovedError,\n\tSandboxError.SandboxTransitionConflictError,\n\tSandboxError.SandboxBusyError,\n]);\n\nconst LocationErrors = Schema.Union([Location.DirectoryNotFoundError, Location.NotDirectoryError]);\n\nexport const Api = RpcGroup.make(\n\t/**\n\t * The server's own identity: the process and build a client is talking to.\n\t *\n\t * The health probe: a discovery registration names a pid and version, and a\n\t * caller confirms the process answering is the one that registered before it\n\t * trusts the endpoint. Like every other capability it rides the RPC channel,\n\t * so there is no separate HTTP surface to keep in step.\n\t */\n\tRpc.make(\"server.info\", {\n\t\tpayload: {},\n\t\tsuccess: Schema.Struct({ pid: Schema.Int, version: Schema.String }),\n\t}),\n\tRpc.make(\"auth.save\", {\n\t\tpayload: { credentials: OAuthCredentials },\n\t\tsuccess: OAuthInfo,\n\t\terror: OAuthError,\n\t}),\n\tRpc.make(\"auth.status\", {\n\t\tpayload: { provider: OAuthProvider },\n\t\tsuccess: Schema.NullOr(OAuthInfo),\n\t\terror: OAuthError,\n\t}),\n\tRpc.make(\"auth.refresh\", {\n\t\tpayload: { provider: OAuthProvider },\n\t\tsuccess: Schema.NullOr(OAuthInfo),\n\t\terror: OAuthError,\n\t}),\n\tRpc.make(\"auth.logout\", {\n\t\tpayload: { provider: OAuthProvider },\n\t\tsuccess: Schema.Void,\n\t\terror: OAuthError,\n\t}),\n\tRpc.make(\"session.create\", {\n\t\tpayload: {\n\t\t\ttitle: optional(Schema.String),\n\t\t\tdirectory: optional(Schema.String),\n\t\t\t/**\n\t\t\t * The host directory this session is anchored to, usually the caller's project root.\n\t\t\t * Unrelated to `directory`, which names a place inside the session's space.\n\t\t\t *\n\t\t\t * It is an anchor and nothing more: whatever needs a host-side directory resolves from\n\t\t\t * here rather than from wherever the server happens to be running. What reads it is the\n\t\t\t * reader's business, not this field's.\n\t\t\t *\n\t\t\t * Optional and honoured as given. Omitting it is normal, not a failure.\n\t\t\t */\n\t\t\thostDir: optional(Session.AbsolutePath),\n\t\t\tsandbox: optional(SandboxRef),\n\t\t\truntime: optional(RuntimeConfig),\n\t\t\t/**\n\t\t\t * Names the project when this session creates it, ahead of the repository's and the\n\t\t\t * folder's name. A project that already exists keeps its name; `project.rename` changes it.\n\t\t\t */\n\t\t\tproject: optional(Schema.Struct({ name: ProjectName })),\n\t\t},\n\t\tsuccess: SessionInfo,\n\t\terror: Schema.Union([SessionErrors, SandboxErrors, LocationErrors]),\n\t}),\n\tRpc.make(\"project.rename\", {\n\t\tpayload: { projectId: Schema.String, name: ProjectName },\n\t\tsuccess: Schema.Struct({ id: Schema.String, name: Schema.String }),\n\t\terror: Project.ProjectNotFoundError,\n\t}),\n\t/**\n\t * The models a session anchored at `hostDir` can use: providers this server holds credentials\n\t * for, in the catalog plus that project's settings, and the model settings pick when a session\n\t * names none. Without `hostDir`, only the user's settings apply. Credentials are checked for\n\t * presence, not validity.\n\t */\n\tRpc.make(\"model.list\", {\n\t\tpayload: { hostDir: optional(Session.AbsolutePath) },\n\t\tsuccess: Schema.Struct({\n\t\t\tproviders: Schema.Array(ModelProvider),\n\t\t\tdefault: Schema.Struct({\n\t\t\t\tprovider: Schema.String,\n\t\t\t\tid: Schema.String,\n\t\t\t\t/** As settings name it; a run clamps it to what the model supports. */\n\t\t\t\tthinkingLevel: Schema.Enum(Model.ThinkingLevelEnum),\n\t\t\t\t/** Display names from the catalog, present even when its provider is not listed. */\n\t\t\t\tname: optional(Schema.String),\n\t\t\t\tproviderName: optional(Schema.String),\n\t\t\t}),\n\t\t}),\n\t\terror: Schema.Union([Settings.SettingsError, Runner.ModelCatalogError]),\n\t}),\n\tRpc.make(\"session.list\", {\n\t\tpayload: {},\n\t\tsuccess: Schema.Array(SessionInfo),\n\t}),\n\t/**\n\t * The conversation on a session's active branch: user and assistant messages, oldest first.\n\t * Other branches and the harness's own entries (compactions, summaries) are left out.\n\t */\n\tRpc.make(\"session.history\", {\n\t\tpayload: { sessionId: Session.SessionSchema.ID },\n\t\tsuccess: Schema.Struct({ entries: Schema.Array(HistoryEntry) }),\n\t\terror: SessionStore.SessionNotFoundError,\n\t}),\n\t/**\n\t * A session's durable events after `after` (exclusive; omitted reads from the start), then a\n\t * `log.synced` marker at the head read when the call began. With `follow`, each event then\n\t * streams as it commits; without it the stream ends at the marker.\n\t * Ephemeral events (text and tool progress deltas) are never stored, so they are not here;\n\t * `event.subscribe` carries them live. To resume, pass the higher of the last event's\n\t * `durable.seq` and the last marker's `seq`: the marker can sit past the last event sent.\n\t */\n\tRpc.make(\"session.log\", {\n\t\tpayload: { sessionId: Session.SessionSchema.ID, after: optional(Schema.Int), follow: optional(Schema.Boolean) },\n\t\tsuccess: Schema.Union([EventEnvelope, LogSynced]),\n\t\terror: Schema.Union([SessionStore.SessionNotFoundError, EncodingError]),\n\t\tstream: true,\n\t}),\n\tRpc.make(\"session.configure\", {\n\t\tpayload: { sessionId: Session.SessionSchema.ID, runtime: RuntimeConfig },\n\t\tsuccess: SessionInfo,\n\t\terror: SessionStore.SessionNotFoundError,\n\t}),\n\tRpc.make(\"session.info\", {\n\t\tpayload: { sessionId: Session.SessionSchema.ID },\n\t\tsuccess: SessionInfo,\n\t\terror: SessionStore.SessionNotFoundError,\n\t}),\n\t/**\n\t * Point an existing session at a host directory, or clear it with `null`.\n\t *\n\t * Not `session.relink`: that moves where the *work* happens, this changes which host directory\n\t * the session is *anchored to*. Conflating them would recreate exactly the `cwd`/`hostDir`\n\t * confusion the split exists to remove, which is why they sound alike and stay apart.\n\t */\n\tRpc.make(\"session.link\", {\n\t\tpayload: {\n\t\t\tsessionId: Session.SessionSchema.ID,\n\t\t\t/** Absent clears the anchor, leaving the session with no host directory. */\n\t\t\thostDir: optional(Session.AbsolutePath),\n\t\t},\n\t\tsuccess: SessionInfo,\n\t\terror: SessionStore.SessionNotFoundError,\n\t}),\n\tRpc.make(\"session.relink\", {\n\t\tpayload: {\n\t\t\tsessionId: Session.SessionSchema.ID,\n\t\t\tsandbox: optional(SandboxRef),\n\t\t\tdirectory: optional(Schema.String),\n\t\t},\n\t\tsuccess: SessionInfo,\n\t\terror: Schema.Union([SessionErrors, SandboxErrors, LocationErrors]),\n\t}),\n\tRpc.make(\"session.prompt\", {\n\t\tpayload: {\n\t\t\tsessionId: Session.SessionSchema.ID,\n\t\t\ttext: Schema.String,\n\t\t\tdelivery: optional(PromptSchema.Delivery),\n\t\t\tid: optional(Session.SessionMessageSchema.ID),\n\t\t},\n\t\tsuccess: Schema.Void,\n\t\terror: Schema.Union([SessionStore.SessionNotFoundError, Control.PromptConflictError]),\n\t}),\n\tRpc.make(\"session.interrupt\", {\n\t\tpayload: { sessionId: Session.SessionSchema.ID },\n\t\tsuccess: Schema.Struct({ interrupted: Schema.Boolean }),\n\t}),\n\t/**\n\t * Whether a prompt materialized into the conversation. An admitted prompt\n\t * that is still queued has no entry yet, so this is the projection a client\n\t * reconciles against when the volatile stream left it unsure\n\t */\n\tRpc.make(\"session.message\", {\n\t\tpayload: { sessionId: Session.SessionSchema.ID, messageId: Session.SessionMessageSchema.ID },\n\t\tsuccess: Schema.Struct({ found: Schema.Boolean }),\n\t}),\n\tRpc.make(\"session.wait\", {\n\t\tpayload: { sessionId: Session.SessionSchema.ID },\n\t\tsuccess: Schema.Void,\n\t\terror: SessionStore.SessionNotFoundError,\n\t}),\n\t/**\n\t * Re-import every configured plugin, for the whole server.\n\t *\n\t * The one thing an exchange cannot notice on its own: a local plugin whose contents changed\n\t * while its path did not. A failure keeps the previous set and is reported here rather than\n\t * emptying a running server's tool registry.\n\t */\n\tRpc.make(\"plugin.reload\", {\n\t\tpayload: {},\n\t\t// No error channel: a reload that fails keeps the previous set and reports why, because a\n\t\t// server that empties its tool registry over a typo is worse than one that says so.\n\t\tsuccess: Schema.Struct({ plugins: Schema.Int, failure: optional(Schema.String) }),\n\t}),\n\tRpc.make(\"sandbox.drivers\", {\n\t\tpayload: {},\n\t\tsuccess: Schema.Array(Schema.Struct({ name: Schema.String, kind: Schema.String })),\n\t}),\n\tRpc.make(\"sandbox.list\", {\n\t\tpayload: {},\n\t\tsuccess: Schema.Array(SandboxInfo),\n\t}),\n\tRpc.make(\"sandbox.create\", {\n\t\tpayload: { driver: Schema.String },\n\t\tsuccess: SandboxInfo,\n\t\terror: SandboxErrors,\n\t}),\n\tRpc.make(\"sandbox.register\", {\n\t\tpayload: { driver: Schema.String, providerResourceId: Schema.String },\n\t\tsuccess: SandboxInfo,\n\t\terror: SandboxErrors,\n\t}),\n\tRpc.make(\"sandbox.stop\", {\n\t\tpayload: { sandboxId: Sandbox.SandboxInstance.ID },\n\t\tsuccess: Schema.Void,\n\t\terror: SandboxErrors,\n\t}),\n\tRpc.make(\"event.subscribe\", {\n\t\tpayload: {},\n\t\tsuccess: EventEnvelope,\n\t\terror: Schema.Union([Event.SubscriptionOverflowError, EncodingError]),\n\t\tstream: true,\n\t}),\n);\n\nexport * as Contract from \"./contract.ts\";\n","import { EventList, type EventSchema, optional, Session } from \"@codeworksh/harness/effect\";\nimport { NodeSocket } from \"@effect/platform-node\";\nimport { Deferred, Effect, Layer, Predicate, Schema, Stream } from \"effect\";\nimport { RpcClient, RpcSerialization } from \"effect/rpc\";\nimport { Contract } from \"./contract.ts\";\nimport { Envelope } from \"./envelope.ts\";\n\nexport const make = RpcClient.make(Contract.Api);\nexport type Client = Effect.Success<typeof make>;\n\nexport const layer = (url: string) =>\n\tRpcClient.layerProtocolSocket().pipe(\n\t\tLayer.provide(NodeSocket.layerWebSocket(url)),\n\t\tLayer.provide(RpcSerialization.layerNdjson),\n\t);\n\n/** A server-side failure as the client sees it: the category, not the cause. */\nexport class ExecutionError extends Schema.TaggedError<ExecutionError>()(\"Client.ExecutionError\", {\n\ttype: Schema.String,\n\tmessage: Schema.String,\n\tstatus: optional(Schema.Int),\n}) {}\n\n/**\n * Runs one prompt against a server and renders its output.\n *\n * Sessions are shared, so the stream carries other clients' work too and every\n * terminal event has to be attributed before it is believed. A terminal that\n * arrives before our own prompt is promoted belongs to somebody else's drain:\n * it is remembered rather than raised, and forgotten the moment our prompt is\n * promoted. It only becomes our outcome if the session reaches idle having\n * never promoted us -- at which point it is the best explanation available for\n * why our prompt never ran.\n */\nexport const run = Effect.fn(\"Client.run\")(function* <E, R>(\n\trpc: Client,\n\tinput: { sessionId: Session.SessionSchema.ID; text: string },\n\trender: (event: EventSchema.Payload) => Effect.Effect<void, E, R>,\n) {\n\tconst id = Session.SessionMessageSchema.ID.create();\n\tlet admitted = false;\n\tlet promoted = false;\n\tlet settled = false;\n\tlet unattributed: ExecutionError | undefined;\n\t// Raised once a busy period ends without our prompt in it: the session may be\n\t// about to go idle, and only idleness proves our prompt is never running.\n\tconst stalled = yield* Deferred.make<void>();\n\n\tconst terminal = (event: EventSchema.Payload): ExecutionError | undefined => {\n\t\tif (Schema.is(EventList.ExecutionInterrupted)(event))\n\t\t\treturn new ExecutionError({\n\t\t\t\ttype: \"aborted\",\n\t\t\t\tmessage: event.data.reason === \"shutdown\" ? \"Server stopped the session\" : \"Session interrupted\",\n\t\t\t});\n\t\tif (Schema.is(EventList.ExecutionFailed)(event))\n\t\t\treturn new ExecutionError({\n\t\t\t\ttype: event.data.error.type,\n\t\t\t\tmessage: event.data.error.message,\n\t\t\t\t...(event.data.error.status === undefined ? {} : { status: event.data.error.status }),\n\t\t\t});\n\t\treturn undefined;\n\t};\n\n\tconst consume = rpc[\"event.subscribe\"]({}).pipe(\n\t\tStream.mapEffect(\n\t\t\tEffect.fnUntraced(function* (envelope) {\n\t\t\t\tif (envelope.type === Envelope.Connected.type) {\n\t\t\t\t\tyield* rpc[\"session.prompt\"]({ ...input, id, delivery: \"followUp\" });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst event = yield* Envelope.decode(envelope).pipe(\n\t\t\t\t\tEffect.catchTag(\"UnknownEventTypeError\", () => Effect.void),\n\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\tevent === undefined ||\n\t\t\t\t\t!Predicate.hasProperty(event.data, \"sessionId\") ||\n\t\t\t\t\tevent.data.sessionId !== input.sessionId\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tif (Schema.is(EventList.PromptAdmitted)(event) && event.data.messageId === id) admitted = true;\n\t\t\t\tif (Schema.is(EventList.Prompted)(event) && event.data.messageId === id) {\n\t\t\t\t\tpromoted = true;\n\t\t\t\t\t// Our prompt is running after all; whatever ended before it was not ours.\n\t\t\t\t\tunattributed = undefined;\n\t\t\t\t}\n\t\t\t\tif (!admitted) return;\n\n\t\t\t\tconst ended = terminal(event);\n\t\t\t\tconst succeeded = Schema.is(EventList.ExecutionSucceeded)(event);\n\t\t\t\tif (!promoted) {\n\t\t\t\t\tif (ended !== undefined) unattributed = ended;\n\t\t\t\t\t// A busy period that ended without us: wait for idle to find out\n\t\t\t\t\t// whether a successor still picks our prompt up.\n\t\t\t\t\tif (ended !== undefined || succeeded) yield* Deferred.succeed(stalled, undefined);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (ended !== undefined) return yield* ended;\n\t\t\t\tif (succeeded) {\n\t\t\t\t\tsettled = true;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tyield* render(event);\n\t\t\t}),\n\t\t),\n\t\tStream.takeUntil(() => settled),\n\t\tStream.runDrain,\n\t);\n\n\t// Idle is the cue to reconcile, not the verdict. `wait` follows successors, so\n\t// it resolves only once the session is quiet -- then the projection says\n\t// whether our prompt was ever part of it. A prompt that did run leaves its\n\t// terminal in flight on the same socket, so the consumer is left alone to\n\t// finish; only a prompt that never materialized ends the run early.\n\tlet abandoned = false;\n\tconst reconcile = Deferred.await(stalled).pipe(\n\t\tEffect.andThen(rpc[\"session.wait\"]({ sessionId: input.sessionId })),\n\t\tEffect.andThen(rpc[\"session.message\"]({ sessionId: input.sessionId, messageId: id })),\n\t\tEffect.andThen(({ found }) =>\n\t\t\tfound\n\t\t\t\t? Effect.never\n\t\t\t\t: Effect.sync(() => {\n\t\t\t\t\t\tabandoned = true;\n\t\t\t\t\t}),\n\t\t),\n\t);\n\n\tyield* Effect.raceFirst(consume, reconcile);\n\tif (settled) return;\n\tif (abandoned)\n\t\treturn yield* unattributed ?? new ExecutionError({ type: \"unknown\", message: \"Prompt was not promoted\" });\n\treturn yield* new ExecutionError({\n\t\ttype: \"transport.disconnected\",\n\t\tmessage: \"Event stream ended before the prompt finished; its output was not rendered\",\n\t});\n});\n\nexport * as Client from \"./client.ts\";\n","import type { Message } from \"@codeworksh/aikit\";\nimport { Effect } from \"effect\";\n\nexport interface UsageSummary {\n\treadonly turns: number;\n\treadonly provider?: string;\n\treadonly model?: string;\n\treadonly input: number;\n\treadonly output: number;\n\treadonly reasoning: number;\n\treadonly cacheRead: number;\n\treadonly cacheWrite: number;\n\treadonly totalTokens: number;\n\treadonly cost: number;\n}\n\nexport const emptyUsage: UsageSummary = {\n\tturns: 0,\n\tinput: 0,\n\toutput: 0,\n\treasoning: 0,\n\tcacheRead: 0,\n\tcacheWrite: 0,\n\ttotalTokens: 0,\n\tcost: 0,\n};\n\nexport const addUsage = (summary: UsageSummary, message: Message.AssistantMessage): UsageSummary => ({\n\tturns: summary.turns + 1,\n\tprovider: message.provider.id,\n\tmodel: message.responseModel ?? message.model,\n\tinput: summary.input + message.usage.input,\n\toutput: summary.output + message.usage.output,\n\treasoning: summary.reasoning + (message.usage.reasoning ?? 0),\n\tcacheRead: summary.cacheRead + message.usage.cacheRead,\n\tcacheWrite: summary.cacheWrite + message.usage.cacheWrite,\n\ttotalTokens: summary.totalTokens + message.usage.totalTokens,\n\tcost: summary.cost + message.usage.cost.total,\n});\n\nconst number = new Intl.NumberFormat(\"en-US\");\nconst row = (label: string, value: string) => `${label.padEnd(9)}${value}\\n`;\n\nconst formatCost = (cost: number): string => `$${cost.toFixed(cost > 0 && cost < 0.01 ? 6 : 4)}`;\n\nexport const divider = (label: string, columns = 72): string => {\n\tconst width = Math.min(100, Math.max(32, columns));\n\tconst start = `── ${label} `;\n\treturn `${start}${\"─\".repeat(Math.max(2, width - start.length))}\\n`;\n};\n\nexport const header = (input: {\n\treadonly sessionId: string;\n\treadonly sandbox: string;\n\treadonly directory: string;\n\treadonly columns?: number;\n}): string =>\n\t`${row(\"session\", input.sessionId)}${row(\"sandbox\", `${input.sandbox} · ${input.directory}`)}\\n${divider(\n\t\t\"response\",\n\t\tinput.columns,\n\t)}`;\n\nexport const usage = (summary: UsageSummary, columns?: number): string => {\n\tconst turns = `${summary.turns} ${summary.turns === 1 ? \"turn\" : \"turns\"}`;\n\tconst model =\n\t\tsummary.provider === undefined || summary.model === undefined\n\t\t\t? \"unknown\"\n\t\t\t: `${summary.provider}/${summary.model}`;\n\tconst reasoning = summary.reasoning === 0 ? \"\" : ` · ${number.format(summary.reasoning)} reasoning`;\n\treturn `${divider(\"usage\", columns)}${row(\"model\", model)}${row(\n\t\t\"tokens\",\n\t\t`${number.format(summary.input)} input · ${number.format(summary.output)} output${reasoning} · ${number.format(\n\t\t\tsummary.totalTokens,\n\t\t)} total`,\n\t)}${row(\"cache\", `${number.format(summary.cacheRead)} read · ${number.format(summary.cacheWrite)} write`)}${row(\n\t\t\"cost\",\n\t\t`${formatCost(summary.cost)} · ${turns}`,\n\t)}`;\n};\n\nexport const writeOut = (value: string) => Effect.sync(() => void process.stdout.write(value));\nexport const writeError = (value: string) => Effect.sync(() => void process.stderr.write(value));\nexport const terminalColumns = () => (process.stderr.isTTY ? (process.stderr.columns ?? 72) : 72);\n","import { ModelCatalog, Plugin, Runner, SandboxError, SessionStore, Settings } from \"@codeworksh/harness/effect\";\nimport { SandboxProvider } from \"@codeworksh/harness/sandbox\";\nimport { Duration, Effect, Schema } from \"effect\";\nimport { Client } from \"../server/client.ts\";\nimport { writeError } from \"./output.ts\";\n\n/** Bad flag or argument combinations the parser cannot express on its own. */\nexport class InvalidInputError extends Schema.TaggedError<InvalidInputError>()(\"CLI.InvalidInputError\", {\n\tmessage: Schema.String,\n}) {}\n\nexport class OAuthError extends Schema.TaggedError<OAuthError>()(\"CLI.OAuthError\", {\n\tmessage: Schema.String,\n\tcause: Schema.optional(Schema.Defect()),\n}) {}\n\n/**\n * Every failure a command handler may surface to the runtime. Harness failures are\n * rendered inside the handler that owns them, so only the CLI's own errors reach\n * the top-level renderer.\n */\nexport type CommandError = InvalidInputError | OAuthError;\n\nconst isInvalidInputError = Schema.is(InvalidInputError);\nconst isOAuthError = Schema.is(OAuthError);\nconst isProviderError = Schema.is(Runner.ProviderError);\nconst isModelCatalogError = Schema.is(Runner.ModelCatalogError);\nconst isModelCatalogRefreshError = Schema.is(ModelCatalog.RefreshError);\nconst isModelNotFoundError = Schema.is(Runner.ModelNotFoundError);\nconst isLLMStreamError = Schema.is(Runner.LLMStreamError);\nconst isSandboxProviderError = Schema.is(SandboxProvider.SandboxProviderError);\nconst isPluginInstallError = Schema.is(Plugin.InstallError);\nconst isPluginSourceError = Schema.is(Plugin.SourceError);\nconst isPluginStoreError = Schema.is(Plugin.StoreError);\nconst isPluginLoadError = Schema.is(Plugin.LoadError);\nconst isSessionNotLinkedError = Schema.is(SessionStore.SessionNotLinkedError);\nconst isSettingsError = Schema.is(Settings.SettingsError);\nconst isSandboxDriverNotRegisteredError = Schema.is(SandboxError.SandboxDriverNotRegisteredError);\nconst isSandboxDriverRegistrationError = Schema.is(SandboxError.SandboxDriverRegistrationError);\nconst isExecutionError = Schema.is(Client.ExecutionError);\n\nconst credentialHint = (provider: string): string => {\n\tswitch (provider) {\n\t\tcase \"openrouter\":\n\t\t\treturn \"set OPENROUTER_API_KEY and retry\";\n\t\tcase \"openai\":\n\t\t\treturn \"set OPENAI_API_KEY and retry\";\n\t\tcase \"openai-codex\":\n\t\t\treturn \"run `codework auth login --openai-codex` and retry\";\n\t\tcase \"github-copilot\":\n\t\t\treturn \"run `codework auth login --github-copilot` and retry\";\n\t\tcase \"anthropic\":\n\t\t\treturn \"set ANTHROPIC_API_KEY and retry\";\n\t\tcase \"google\":\n\t\t\treturn \"set GOOGLE_GENERATIVE_AI_API_KEY and retry\";\n\t\tcase \"xai\":\n\t\t\treturn \"set XAI_API_KEY and retry\";\n\t\tdefault:\n\t\t\treturn `configure credentials for provider \"${provider}\" and retry`;\n\t}\n};\n\nconst providerHint = (error: Runner.ProviderError): string | undefined => {\n\tswitch (error.reason._tag) {\n\t\tcase \"Runner.ProviderAuthenticationError\":\n\t\t\treturn error.reason.authentication === \"missing\"\n\t\t\t\t? credentialHint(error.provider)\n\t\t\t\t: `check the credentials configured for provider \"${error.provider}\"`;\n\t\tcase \"Runner.ProviderAuthorizationError\":\n\t\t\treturn \"check that the credential can access this model and endpoint\";\n\t\tcase \"Runner.ProviderModelUnavailableError\":\n\t\t\treturn \"check the provider model ID and whether your account can access it\";\n\t\tcase \"Runner.ProviderRateLimitError\":\n\t\t\treturn error.reason.retryAfter === undefined\n\t\t\t\t? \"retry after the provider rate-limit window resets\"\n\t\t\t\t: `retry in about ${Math.ceil(Duration.toMillis(error.reason.retryAfter) / 1_000)} seconds`;\n\t\tcase \"Runner.ProviderQuotaError\":\n\t\t\treturn \"check the provider account quota or billing balance\";\n\t\tcase \"Runner.ProviderTimeoutError\":\n\t\tcase \"Runner.ProviderTransportError\":\n\t\tcase \"Runner.ProviderUnavailableError\":\n\t\t\treturn error.isRetryable ? \"this failure is retryable\" : undefined;\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n};\n\nconst unknownMessage = (error: unknown): string => {\n\tif (error instanceof Error && error.message.trim().length > 0) return error.message;\n\tif (typeof error === \"string\" && error.trim().length > 0) return error;\n\tif (typeof error === \"object\" && error !== null && \"_tag\" in error) {\n\t\t// A bare tag such as `ServeError` hides the reason; its cause carries it (`EADDRINUSE`).\n\t\tconst cause = \"cause\" in error ? error.cause : undefined;\n\t\treturn cause instanceof Error ? `${String(error._tag)}: ${cause.message}` : String(error._tag);\n\t}\n\treturn \"the command failed for an unknown reason\";\n};\n\n/**\n * What the reader can do about a reference that failed to prepare. A plugin list is\n * usually hand-written in a settings file, so the phase is worth translating.\n */\n/** One hint per reason. Lowercase, like everything else a plugin failure prints. */\nconst providerCategory = (reason: Runner.ProviderFailureReason): string => {\n\tswitch (reason._tag) {\n\t\tcase \"Runner.ProviderAuthenticationError\":\n\t\t\treturn \"provider-authentication-error\";\n\t\tcase \"Runner.ProviderConfigurationError\":\n\t\t\treturn \"provider-configuration-error\";\n\t\tcase \"Runner.ProviderAuthorizationError\":\n\t\t\treturn \"provider-authorization-error\";\n\t\tcase \"Runner.ProviderModelUnavailableError\":\n\t\t\treturn \"provider-model-unavailable-error\";\n\t\tcase \"Runner.ProviderRateLimitError\":\n\t\t\treturn \"provider-rate-limit-error\";\n\t\tcase \"Runner.ProviderQuotaError\":\n\t\t\treturn \"provider-quota-error\";\n\t\tcase \"Runner.ProviderInvalidRequestError\":\n\t\t\treturn \"provider-invalid-request-error\";\n\t\tcase \"Runner.ProviderContentPolicyError\":\n\t\t\treturn \"provider-content-filter-error\";\n\t\tcase \"Runner.ProviderTimeoutError\":\n\t\t\treturn \"provider-timeout-error\";\n\t\tcase \"Runner.ProviderTransportError\":\n\t\t\treturn \"provider-transport-error\";\n\t\tcase \"Runner.ProviderUnavailableError\":\n\t\t\treturn \"provider-unavailable-error\";\n\t\tcase \"Runner.ProviderInvalidResponseError\":\n\t\t\treturn \"provider-invalid-response-error\";\n\t\tcase \"Runner.ProviderUnknownError\":\n\t\t\treturn \"provider-unknown-error\";\n\t}\n};\n\nconst pluginReasonHint = (\n\treason:\n\t\t| Plugin.SourceError[\"reason\"]\n\t\t| Plugin.InstallError[\"reason\"]\n\t\t| Plugin.StoreError[\"reason\"]\n\t\t| Plugin.LoadError[\"reason\"],\n): string => {\n\tswitch (reason) {\n\t\tcase \"plugin-unsupported-source\":\n\t\t\treturn \"a path entry starts with `./`, `../`, `~/` or `/`; anything else is a package or a git spec, and a remote tarball is not supported\";\n\t\tcase \"plugin-not-found\":\n\t\t\treturn \"the path does not exist; check the spelling, remembering it anchors to the settings file that declares it\";\n\t\tcase \"plugin-escapes-root\":\n\t\t\treturn \"a plugin path must stay inside the project it is declared in\";\n\t\tcase \"plugin-resolve-failed\":\n\t\t\treturn \"check that the registry or git remote is reachable, and that your credentials are current\";\n\t\tcase \"plugin-fetch-failed\":\n\t\t\treturn \"check the package name and version, and that the registry is reachable\";\n\t\tcase \"plugin-no-commit\":\n\t\t\treturn \"the git source installed but no commit could be recovered; name a branch, tag or commit explicitly\";\n\t\tcase \"plugin-no-entrypoint\":\n\t\t\treturn \"the package installed but exports no module to import; check its `exports` and `main`\";\n\t\tcase \"plugin-not-installed\":\n\t\t\treturn \"run `codework plugin install` to fetch what the settings files name\";\n\t\tcase \"plugin-lock-timeout\":\n\t\t\treturn \"another install is holding this entry; wait for it to finish, or remove the stale `.lock` directory\";\n\t\tcase \"plugin-marker-invalid\":\n\t\tcase \"plugin-index-invalid\":\n\t\t\treturn \"the store entry is damaged; remove it and install again\";\n\t\tcase \"plugin-collect-failed\":\n\t\t\treturn \"the store could not be tidied; check the permissions on the plugin cache\";\n\t\tcase \"plugin-import-failed\":\n\t\t\treturn \"the module failed to load; import it directly to see its own error\";\n\t\tcase \"plugin-missing-dependency\":\n\t\t\treturn \"the plugin's own dependencies are missing; install them where the plugin lives\";\n\t\tcase \"plugin-not-compiled\":\n\t\t\treturn \"a plugin installed from git or npm must ship compiled javascript; build it and commit or publish the output\";\n\t\tcase \"plugin-invalid-definition\":\n\t\t\treturn \"a plugin module must default-export one object with a `setup` and a `vendor.domain.name` id\";\n\t}\n};\n\nconst settingsHint = (reason: Settings.SettingsError[\"reason\"]): string => {\n\tswitch (reason) {\n\t\tcase \"read\":\n\t\t\treturn \"the file exists but could not be read; check that it is a file and readable\";\n\t\tcase \"parse\":\n\t\t\treturn \"the file is not valid JSON; the location above is where parsing stopped\";\n\t\tcase \"decode\":\n\t\t\treturn \"the key above holds a value this setting does not accept\";\n\t}\n};\n\n/** Render typed SDK errors for humans without exposing Effect causes or provider payloads. */\nexport const renderError = (error: unknown): string => {\n\tif (isSandboxDriverNotRegisteredError(error)) {\n\t\treturn `error: sandbox driver \"${error.driver}\" is not registered (available: ${error.registered?.join(\", \") ?? \"none\"})\\n`;\n\t}\n\tif (isSandboxDriverRegistrationError(error)) {\n\t\treturn `error: ${error.reason}\\n`;\n\t}\n\tif (isInvalidInputError(error)) {\n\t\treturn `error: ${error.message}\\n`;\n\t}\n\tif (isOAuthError(error)) {\n\t\treturn (\n\t\t\t[\n\t\t\t\t`error[oauth-credential-error]: ${error.message}`,\n\t\t\t\t...(error.cause === undefined ? [] : [`detail: ${unknownMessage(error.cause)}`]),\n\t\t\t].join(\"\\n\") + \"\\n\"\n\t\t);\n\t}\n\tif (isSandboxProviderError(error)) {\n\t\treturn (\n\t\t\t[\n\t\t\t\t`error: SandboxProviderError - ${error.sanitized.message}`,\n\t\t\t\t`driver: ${error.driver}`,\n\t\t\t\t`operation: ${error.operation}`,\n\t\t\t\t...(error.sanitized.code === undefined ? [] : [`code: ${error.sanitized.code}`]),\n\t\t\t\t...(error.stack === undefined ? [] : [\"traceback:\", error.stack]),\n\t\t\t].join(\"\\n\") + \"\\n\"\n\t\t);\n\t}\n\tif (isSessionNotLinkedError(error)) {\n\t\treturn (\n\t\t\t[\n\t\t\t\t`error[${error.reason}]: ${error.message}`,\n\t\t\t\t`session: ${error.sessionId}`,\n\t\t\t\t\"hint: run `codework session link <session-id>` from the directory to anchor it to\",\n\t\t\t].join(\"\\n\") + \"\\n\"\n\t\t);\n\t}\n\tif (isSettingsError(error)) {\n\t\treturn (\n\t\t\t[\n\t\t\t\t`error[settings-${error.reason}-failed]: ${error.path}`,\n\t\t\t\t`detail: ${error.detail}`,\n\t\t\t\t`hint: ${settingsHint(error.reason)}`,\n\t\t\t].join(\"\\n\") + \"\\n\"\n\t\t);\n\t}\n\t// One shape for all three plugin domains: the reason is the slug, the message is the sentence,\n\t// and the reference is the string the person recognises from their settings file.\n\tif (\n\t\tisPluginSourceError(error) ||\n\t\tisPluginInstallError(error) ||\n\t\tisPluginStoreError(error) ||\n\t\tisPluginLoadError(error)\n\t) {\n\t\treturn (\n\t\t\t[\n\t\t\t\t`error[${error.reason}]: ${error.message}`,\n\t\t\t\t...(error.reference === \"\" ? [] : [`reference: ${error.reference}`]),\n\t\t\t\t...(error.file === undefined ? [] : [`declared in: ${error.file}`]),\n\t\t\t\t...(isPluginLoadError(error) && error.id !== undefined ? [`id: ${error.id}`] : []),\n\t\t\t\t`hint: ${pluginReasonHint(error.reason)}`,\n\t\t\t].join(\"\\n\") + \"\\n\"\n\t\t);\n\t}\n\tif (isProviderError(error)) {\n\t\tconst hint = providerHint(error);\n\t\treturn (\n\t\t\t[\n\t\t\t\t`error[${providerCategory(error.reason)}]: ${error.message}`,\n\t\t\t\t`provider: ${error.provider}`,\n\t\t\t\t`model: ${error.model}`,\n\t\t\t\t...(error.reason.requestId === undefined ? [] : [`request: ${error.reason.requestId}`]),\n\t\t\t\t...(hint === undefined ? [] : [`hint: ${hint}`]),\n\t\t\t].join(\"\\n\") + \"\\n\"\n\t\t);\n\t}\n\tif (isModelCatalogError(error)) {\n\t\treturn (\n\t\t\t[`error[model-catalog-${error.reason}]: ${error.message}`, \"hint: run `codework models refresh`\"].join(\"\\n\") +\n\t\t\t\"\\n\"\n\t\t);\n\t}\n\tif (isModelCatalogRefreshError(error)) {\n\t\treturn (\n\t\t\t[`error[catalog-refresh-failed]: ${error.message}`, \"hint: check the network connection and retry\"].join(\n\t\t\t\t\"\\n\",\n\t\t\t) + \"\\n\"\n\t\t);\n\t}\n\tif (isModelNotFoundError(error)) {\n\t\treturn (\n\t\t\t[\n\t\t\t\t`error[model-not-found-error]: ${error.message}`,\n\t\t\t\t\"hint: check the provider/model IDs in models.gen.json or regenerate the catalog\",\n\t\t\t].join(\"\\n\") + \"\\n\"\n\t\t);\n\t}\n\tif (isLLMStreamError(error)) {\n\t\treturn `error[llm-stream-error]: ${error.message}\\n`;\n\t}\n\t// A remote run has only the category the server published; render it the same\n\t// way a local typed error is rendered, minus the detail that stayed server-side.\n\tif (isExecutionError(error)) {\n\t\treturn (\n\t\t\t[\n\t\t\t\terror.type === \"aborted\" ? `error: ${error.message}` : `error[${error.type}]: ${error.message}`,\n\t\t\t\t...(error.status === undefined ? [] : [`status: ${error.status}`]),\n\t\t\t].join(\"\\n\") + \"\\n\"\n\t\t);\n\t}\n\treturn `error: ${unknownMessage(error)}\\n`;\n};\n\nexport const reportFailure = (error: unknown) =>\n\twriteError(renderError(error)).pipe(\n\t\tEffect.andThen(\n\t\t\tEffect.sync(() => {\n\t\t\t\tprocess.exitCode = 1;\n\t\t\t}),\n\t\t),\n\t);\n"],"mappings":";;;;;;;;;;;;;AASA,MAAa,gBAAgB,OAAO,OAAO;CAC1C,IAAI,YAAY;CAChB,MAAM,OAAO;CACb,SAAS,SAAS,OAAO,OAAO;EAAE,aAAa,OAAO;EAAQ,KAAK,OAAO;EAAK,SAAS,OAAO;CAAI,CAAC,CAAC;CACrG,UAAU,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,MAAM,CAA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],"sourcesContent":[""],"mappings":""}
|