@codeworksh/cli 0.8.0-dev.20261106102456 → 0.9.0-dev.20261115060350
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-D2mX3nVB.mjs → acp-D7TtvhV-.mjs} +15 -10
- package/acp-D7TtvhV-.mjs.map +1 -0
- package/{add-Dgy0iTEQ.mjs → add-DHMnQW99.mjs} +3 -3
- package/add-DHMnQW99.mjs.map +1 -0
- package/{add-31QB-o0_.mjs → add-zUESl6ET.mjs} +4 -4
- package/add-zUESl6ET.mjs.map +1 -0
- package/{check-BoANDJxT.mjs → check-DaAohHQB.mjs} +3 -3
- package/check-DaAohHQB.mjs.map +1 -0
- package/{control-CQxWGS4k.mjs → control-Bumzv5lJ.mjs} +4 -4
- package/control-Bumzv5lJ.mjs.map +1 -0
- package/disconnect-DyZh1VIG.mjs +2 -0
- package/{entries-DpL4xhu0.mjs → entries-DEIZstjm.mjs} +3 -3
- package/{entries-DpL4xhu0.mjs.map → entries-DEIZstjm.mjs.map} +1 -1
- package/{error-CPyvkO4x.mjs → error-CDGBK9Du.mjs} +226 -25
- package/error-CDGBK9Du.mjs.map +1 -0
- package/{fork-CjZteIbk.mjs → fork-D9G8UFMP.mjs} +3 -3
- package/fork-D9G8UFMP.mjs.map +1 -0
- package/{identity-CUa-10pU.mjs → identity-CnJLJCAw.mjs} +14 -3
- package/identity-CnJLJCAw.mjs.map +1 -0
- package/index.mjs +33 -33
- package/index.mjs.map +1 -1
- package/{install-BUfEBtrj.mjs → install-B3Jrv5qY.mjs} +3 -3
- package/install-B3Jrv5qY.mjs.map +1 -0
- package/jsonc-CwZ1q4tQ.mjs +33 -0
- package/jsonc-CwZ1q4tQ.mjs.map +1 -0
- package/{link-ZuzWj9qt.mjs → link-XTnNYTMG.mjs} +2 -2
- package/link-XTnNYTMG.mjs.map +1 -0
- package/{list-BnIIcMI3.mjs → list-2wagSRhT.mjs} +2 -2
- package/list-2wagSRhT.mjs.map +1 -0
- package/{list-DPbF2uMB.mjs → list-B56MDFRg.mjs} +3 -3
- package/list-B56MDFRg.mjs.map +1 -0
- package/{list-6QTwXTKO.mjs → list-BWMsbeuT.mjs} +3 -3
- package/list-BWMsbeuT.mjs.map +1 -0
- package/{list-DDuzyNv0.mjs → list-CkcQPdvs.mjs} +2 -2
- package/list-CkcQPdvs.mjs.map +1 -0
- package/{login-BtuROCPJ.mjs → login-DEDr2Vyx.mjs} +3 -3
- package/login-DEDr2Vyx.mjs.map +1 -0
- package/{login-CGXU21AK.mjs → login-k_5cpvOg.mjs} +3 -3
- package/login-k_5cpvOg.mjs.map +1 -0
- package/{logout-DUn8KSjX.mjs → logout-CuhgmxyS.mjs} +3 -3
- package/logout-CuhgmxyS.mjs.map +1 -0
- package/{logout-Bnk2hxfZ.mjs → logout-DgfjJ4Qs.mjs} +3 -3
- package/logout-DgfjJ4Qs.mjs.map +1 -0
- package/package-BVZbd-hd.mjs +6 -0
- package/package-BVZbd-hd.mjs.map +1 -0
- package/package.json +3 -3
- package/{providers-GEdlDJHp.mjs → providers-DFBL85KS.mjs} +2 -2
- package/providers-DFBL85KS.mjs.map +1 -0
- package/reconnect-CfSVaPkd.mjs +2 -0
- package/{refresh-DGJW3rSp.mjs → refresh-BevzQTKE.mjs} +3 -3
- package/refresh-BevzQTKE.mjs.map +1 -0
- package/{refresh-93t2pSpb.mjs → refresh-D1ikVUxv.mjs} +2 -2
- package/refresh-D1ikVUxv.mjs.map +1 -0
- package/{relink-Djy5t7D2.mjs → relink-D-74aBQZ.mjs} +3 -3
- package/relink-D-74aBQZ.mjs.map +1 -0
- package/{reload-Dm464rPC.mjs → reload-DQDThDsu.mjs} +2 -2
- package/reload-DQDThDsu.mjs.map +1 -0
- package/{remove-f7C_vEOD.mjs → remove-C5Cdkluk.mjs} +4 -4
- package/remove-C5Cdkluk.mjs.map +1 -0
- package/{remove-DBT19X2j.mjs → remove-DbGeM1mo.mjs} +3 -3
- package/remove-DbGeM1mo.mjs.map +1 -0
- package/{restart-CxpHL6qh.mjs → restart-N7BTKpcC.mjs} +3 -3
- package/restart-N7BTKpcC.mjs.map +1 -0
- package/{run-CTFksYXE.mjs → run-tgTFwaz6.mjs} +3 -3
- package/run-tgTFwaz6.mjs.map +1 -0
- package/runtime-CK2CunDw.mjs.map +1 -1
- package/{serve-BoVwapgO.mjs → serve-Br1ffJVV.mjs} +193 -33
- package/serve-Br1ffJVV.mjs.map +1 -0
- package/{service-d-7_dAHQ.mjs → service-khwTIVEE.mjs} +3 -3
- package/service-khwTIVEE.mjs.map +1 -0
- package/{settings-DasbTMFs.mjs → settings-DIqNg65Q.mjs} +3 -3
- package/settings-DIqNg65Q.mjs.map +1 -0
- package/{shared-CiSbTY59.mjs → shared-D9lJX6cL.mjs} +2 -2
- package/shared-D9lJX6cL.mjs.map +1 -0
- package/{shared-CDyNsYBy.mjs → shared-DasNo1nI.mjs} +3 -3
- package/shared-DasNo1nI.mjs.map +1 -0
- package/{start-DoJDhByP.mjs → start-DeArzE9e.mjs} +3 -3
- package/start-DeArzE9e.mjs.map +1 -0
- package/{status-CHcJyF_7.mjs → status-B1V5lctj.mjs} +3 -3
- package/status-B1V5lctj.mjs.map +1 -0
- package/{status-DWi-QzRT.mjs → status-DV4tmJRh.mjs} +3 -3
- package/status-DV4tmJRh.mjs.map +1 -0
- package/{stop-Ctm_AXm1.mjs → stop-Cbi0IsgA.mjs} +3 -3
- package/stop-Cbi0IsgA.mjs.map +1 -0
- package/{thread-I6vNdC0y.mjs → thread-oH9PJv_L.mjs} +2 -2
- package/{thread-I6vNdC0y.mjs.map → thread-oH9PJv_L.mjs.map} +1 -1
- package/{update-C3llbIB0.mjs → update-DKaDSMmZ.mjs} +3 -3
- package/update-DKaDSMmZ.mjs.map +1 -0
- package/acp-D2mX3nVB.mjs.map +0 -1
- package/add-31QB-o0_.mjs.map +0 -1
- package/add-Dgy0iTEQ.mjs.map +0 -1
- package/check-BoANDJxT.mjs.map +0 -1
- package/control-CQxWGS4k.mjs.map +0 -1
- package/disconnect-BiLuV4JZ.mjs +0 -2
- package/error-CPyvkO4x.mjs.map +0 -1
- package/fork-CjZteIbk.mjs.map +0 -1
- package/identity-CUa-10pU.mjs.map +0 -1
- package/install-BUfEBtrj.mjs.map +0 -1
- package/jsonc-Ca0uQLm-.mjs +0 -58
- package/jsonc-Ca0uQLm-.mjs.map +0 -1
- package/link-ZuzWj9qt.mjs.map +0 -1
- package/list-6QTwXTKO.mjs.map +0 -1
- package/list-BnIIcMI3.mjs.map +0 -1
- package/list-DDuzyNv0.mjs.map +0 -1
- package/list-DPbF2uMB.mjs.map +0 -1
- package/login-BtuROCPJ.mjs.map +0 -1
- package/login-CGXU21AK.mjs.map +0 -1
- package/logout-Bnk2hxfZ.mjs.map +0 -1
- package/logout-DUn8KSjX.mjs.map +0 -1
- package/package-B-kqkiwO.mjs +0 -6
- package/package-B-kqkiwO.mjs.map +0 -1
- package/providers-GEdlDJHp.mjs.map +0 -1
- package/reconnect-ChE5ETwx.mjs +0 -2
- package/refresh-93t2pSpb.mjs.map +0 -1
- package/refresh-DGJW3rSp.mjs.map +0 -1
- package/relink-Djy5t7D2.mjs.map +0 -1
- package/reload-Dm464rPC.mjs.map +0 -1
- package/remove-DBT19X2j.mjs.map +0 -1
- package/remove-f7C_vEOD.mjs.map +0 -1
- package/restart-CxpHL6qh.mjs.map +0 -1
- package/run-CTFksYXE.mjs.map +0 -1
- package/serve-BoVwapgO.mjs.map +0 -1
- package/service-d-7_dAHQ.mjs.map +0 -1
- package/settings-DasbTMFs.mjs.map +0 -1
- package/shared-CDyNsYBy.mjs.map +0 -1
- package/shared-CiSbTY59.mjs.map +0 -1
- package/start-DoJDhByP.mjs.map +0 -1
- package/status-CHcJyF_7.mjs.map +0 -1
- package/status-DWi-QzRT.mjs.map +0 -1
- package/stop-Ctm_AXm1.mjs.map +0 -1
- package/update-C3llbIB0.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
-
import { d as writeJson, f as writeOut, i as reportFailure, m as make, p as layer, t as InvalidInputError, y as ThreadInfo } from "./error-
|
|
3
|
-
import { t as threadFlag } from "./thread-
|
|
2
|
+
import { d as writeJson, f as writeOut, i as reportFailure, m as make, p as layer, t as InvalidInputError, y as ThreadInfo } from "./error-CDGBK9Du.mjs";
|
|
3
|
+
import { t as threadFlag } from "./thread-oH9PJv_L.mjs";
|
|
4
4
|
import { Effect, Option, Schema } from "effect";
|
|
5
5
|
import { Session } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/thread/fork.ts
|
|
@@ -29,4 +29,4 @@ var fork_default = handler(Cmd.commands.thread.commands.fork, Effect.fn("CLI.thr
|
|
|
29
29
|
//#endregion
|
|
30
30
|
export { fork_default as default };
|
|
31
31
|
|
|
32
|
-
//# sourceMappingURL=fork-
|
|
32
|
+
//# sourceMappingURL=fork-D9G8UFMP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fork-D9G8UFMP.mjs","names":["Runtime.handler","Client.make","Client.layer"],"sources":["../../src/cli/cmd/handlers/thread/fork.ts"],"sourcesContent":["import { Session } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Schema } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport * as Client from \"../../../../server/client.ts\";\nimport { ThreadInfo } from \"../../../../server/contract.ts\";\nimport { InvalidInputError, reportFailure } from \"../../../error.ts\";\nimport { writeJson, writeOut } from \"../../../output.ts\";\nimport { threadFlag } from \"../../../thread.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nconst Forked = Schema.Struct({ thread: ThreadInfo, text: Schema.optional(Schema.String) });\n\nexport default Runtime.handler(\n\tCmd.commands.thread.commands.fork,\n\tEffect.fn(\"CLI.thread.fork\")(function* ({ session, thread, at, before, json, server }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst point = Option.isSome(at)\n\t\t\t\t? Option.isNone(before)\n\t\t\t\t\t? { entryId: at.value }\n\t\t\t\t\t: undefined\n\t\t\t\t: Option.map(before, (entryId) => ({ entryId, mode: \"before\" as const })).pipe(Option.getOrUndefined);\n\t\t\tif (point === undefined) {\n\t\t\t\treturn yield* new InvalidInputError({ message: \"Pass exactly one of --at or --before\" });\n\t\t\t}\n\t\t\tconst threadId = yield* threadFlag(thread);\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst forked = yield* rpc[\"thread.fork\"]({\n\t\t\t\tsessionId: Session.SessionSchema.ID.make(session),\n\t\t\t\t...(threadId === undefined ? {} : { threadId }),\n\t\t\t\t...point,\n\t\t\t});\n\t\t\tif (json) return yield* writeJson(Forked, forked);\n\t\t\tyield* writeOut(`${forked.thread.id}\\n`);\n\t\t\tif (forked.text !== undefined) yield* writeOut(`\\n${forked.text}\\n`);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.provide(Client.layer(server)), Effect.scoped, Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAUA,MAAM,SAAS,OAAO,OAAO;CAAE,QAAQ;CAAY,MAAM,OAAO,SAAS,OAAO,MAAM;AAAE,CAAC;AAEzF,IAAA,eAAeA,QACd,IAAI,SAAS,OAAO,SAAS,MAC7B,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,SAAS,QAAQ,IAAI,QAAQ,MAAM,UAAU;CAsBtF,OAAO,OArBS,OAAO,IAAI,aAAa;EACvC,MAAM,QAAQ,OAAO,OAAO,EAAE,IAC3B,OAAO,OAAO,MAAM,IACnB,EAAE,SAAS,GAAG,MAAM,IACpB,KAAA,IACD,OAAO,IAAI,SAAS,aAAa;GAAE;GAAS,MAAM;EAAkB,EAAE,CAAC,CAAC,KAAK,OAAO,cAAc;EACrG,IAAI,UAAU,KAAA,GACb,OAAO,OAAO,IAAI,kBAAkB,EAAE,SAAS,uCAAuC,CAAC;EAExF,MAAM,WAAW,OAAO,WAAW,MAAM;EAEzC,MAAM,SAAS,QAAO,OADHC,KAAAA,CACO,cAAc,CAAC;GACxC,WAAW,QAAQ,cAAc,GAAG,KAAK,OAAO;GAChD,GAAI,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS;GAC7C,GAAG;EACJ,CAAC;EACD,IAAI,MAAM,OAAO,OAAO,UAAU,QAAQ,MAAM;EAChD,OAAO,SAAS,GAAG,OAAO,OAAO,GAAG,GAAG;EACvC,IAAI,OAAO,SAAS,KAAA,GAAW,OAAO,SAAS,KAAK,OAAO,KAAK,GAAG;CACpE,CAEoB,CAAC,CAAC,KAAK,OAAO,QAAQC,MAAa,MAAM,CAAC,GAAG,OAAO,QAAQ,OAAO,MAAM,aAAa,CAAC;AAC5G,CAAC,CACF"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { t as version } from "./package-
|
|
1
|
+
import { t as version } from "./package-BVZbd-hd.mjs";
|
|
2
2
|
import { Context, Effect, FileSystem, Layer, Option, Path, Schedule, Schema } from "effect";
|
|
3
|
+
import { NodeServices } from "@effect/platform-node";
|
|
3
4
|
import { isSea } from "node:sea";
|
|
5
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
6
|
+
import os from "node:os";
|
|
4
7
|
//#region src/server/registration.ts
|
|
5
8
|
/**
|
|
6
9
|
* How a running server advertises itself so later invocations can find it
|
|
@@ -85,8 +88,16 @@ const current = {
|
|
|
85
88
|
pid: process.pid,
|
|
86
89
|
version
|
|
87
90
|
};
|
|
88
|
-
const
|
|
91
|
+
const hostName = Effect.gen(function* () {
|
|
92
|
+
if (process.platform !== "darwin") return os.hostname().trim();
|
|
93
|
+
return (yield* (yield* ChildProcessSpawner.ChildProcessSpawner).string(ChildProcess.make("scutil", ["--get", "ComputerName"])).pipe(Effect.orElseSucceed(() => ""))).trim() || os.hostname().replace(/\.local$/, "").trim();
|
|
94
|
+
});
|
|
95
|
+
/** The host's name is read once, when the server starts. */
|
|
96
|
+
const layer = Layer.effect(Service, hostName.pipe(Effect.map((name) => Service.of(name === "" ? current : {
|
|
97
|
+
...current,
|
|
98
|
+
host: { name }
|
|
99
|
+
})))).pipe(Layer.provide(NodeServices.layer));
|
|
89
100
|
//#endregion
|
|
90
101
|
export { file as a, register as c, command as i, current as n, infoJson as o, layer as r, log as s, Service as t };
|
|
91
102
|
|
|
92
|
-
//# sourceMappingURL=identity-
|
|
103
|
+
//# sourceMappingURL=identity-CnJLJCAw.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-CnJLJCAw.mjs","names":["pkg.version"],"sources":["../../src/server/registration.ts","../../src/server/identity.ts"],"sourcesContent":["import { Effect, FileSystem, Layer, Option, Path, Schedule, Schema } from \"effect\";\nimport { isSea } from \"node:sea\";\n\n/**\n * How a running server advertises itself so later invocations can find it\n * without scanning ports or the process table.\n *\n * The file is a discovery hint, never proof: a caller reads it for the endpoint,\n * then asks the endpoint `server.info` and believes the answer only when the\n * live pid and version match the ones on file. A crashed server leaves a\n * registration behind; the failed probe is what retires it.\n */\nexport const Info = Schema.Struct({\n\t/** Operating system process identifier of the server that wrote this. */\n\tpid: Schema.Int,\n\t/** The build serving this endpoint; a mismatch means a different binary. */\n\tversion: Schema.String,\n\t/** The `ws://host:port/rpc/v1` endpoint a client connects to. */\n\turl: Schema.String,\n\t/** The TCP port the server bound, for a caller that would rather reuse it than default. */\n\tport: Schema.Int,\n});\nexport type Info = typeof Info.Type;\n\nexport const infoJson = Schema.fromJsonString(Info);\n\n/** The registration file for a CodeWork home: `<home>/service.json`. */\nexport const file = (home: string) => `${home}/service.json`;\n\n/** Where a background (`serve --service`) server writes its log: `<log>/server.log`, truncated per start. */\nexport const log = (logDir: string) => `${logDir}/server.log`;\n\nconst decode = Schema.decodeUnknownEffect(infoJson);\n\nconst write = Effect.fn(\"ServerRegistration.write\")(function* (path: string, info: Info) {\n\tconst fs = yield* FileSystem.FileSystem;\n\tconst paths = yield* Path.Path;\n\tyield* fs.makeDirectory(paths.dirname(path), { recursive: true });\n\tconst encoded = yield* Schema.encodeEffect(infoJson)(info);\n\t// Write beside the target and rename, so a reader never sees a half-written\n\t// file. 0600 because a future registration may carry a credential.\n\tconst temp = `${path}.${info.pid}.tmp`;\n\tyield* fs.writeFileString(temp, encoded, { mode: 0o600 });\n\tyield* fs.rename(temp, path);\n});\n\n/**\n * Publishes a registration for as long as this server lives, removing it on the\n * way out if it is still the one on file. A file left by a crash is overwritten\n * by the next server to start, and retired by a probe that cannot confirm it.\n *\n * One home has one discoverable server. Every few seconds the file is checked:\n * a missing or unreadable file is written again, and a file naming another\n * server means this one lost discovery for good, so it shuts down rather than\n * run on where nothing can find or stop it.\n */\nexport const register = (options: { readonly home: string; readonly info: Info }) =>\n\tLayer.effectDiscard(\n\t\tEffect.gen(function* () {\n\t\t\tconst path = file(options.home);\n\t\t\tconst fs = yield* FileSystem.FileSystem;\n\t\t\tconst current = fs.readFileString(path).pipe(Effect.flatMap(decode), Effect.option);\n\t\t\tconst owns = (found: Info) => found.pid === options.info.pid && found.url === options.info.url;\n\n\t\t\tyield* write(path, options.info);\n\t\t\tyield* Effect.addFinalizer(() =>\n\t\t\t\tcurrent.pipe(\n\t\t\t\t\tEffect.flatMap((found) => (Option.isSome(found) && owns(found.value) ? fs.remove(path) : Effect.void)),\n\t\t\t\t\tEffect.ignore,\n\t\t\t\t),\n\t\t\t);\n\t\t\t// Forked after the finalizer, so shutdown stops the watch before the file is removed.\n\t\t\tyield* current.pipe(\n\t\t\t\tEffect.flatMap((found) =>\n\t\t\t\t\tOption.isNone(found)\n\t\t\t\t\t\t? write(path, options.info).pipe(Effect.ignore, Effect.as(true))\n\t\t\t\t\t\t: Effect.succeed(owns(found.value)),\n\t\t\t\t),\n\t\t\t\tEffect.repeat({ while: (ours) => ours, schedule: Schedule.spaced(\"5 seconds\") }),\n\t\t\t\tEffect.andThen(Effect.logWarning(`${path} names another server; shutting down`)),\n\t\t\t\t// The same graceful path `codework service stop` takes.\n\t\t\t\tEffect.andThen(Effect.sync(() => process.kill(process.pid, \"SIGTERM\"))),\n\t\t\t\tEffect.forkScoped,\n\t\t\t);\n\t\t}),\n\t);\n\n/**\n * The launcher command for a managed server: this same CLI, asked to serve.\n *\n * A packaged install runs `dist/pack/index.mjs`; under `--conditions=development`\n * the entry is TypeScript, and `process.execArgv` carries the conditions forward\n * so a managed server resolves workspace sources the same way this process did.\n * The standalone binary is its own entry.\n */\nexport const command = (): ReadonlyArray<string> => {\n\tif (isSea()) return [process.execPath];\n\tconst entry = process.argv[1];\n\tif (entry === undefined) return [process.execPath];\n\tconst runtime = import.meta.url.endsWith(\".ts\") ? process.execArgv : [];\n\treturn [process.execPath, ...runtime, entry];\n};\n","/* @effect-diagnostics nodeBuiltinImport:off -- the host's name is the OS's hostname. */\nimport os from \"node:os\";\nimport { NodeServices } from \"@effect/platform-node\";\nimport { Context, Effect, Layer } from \"effect\";\nimport { ChildProcess, ChildProcessSpawner } from \"effect/process\";\nimport pkg from \"../../package.json\" with { type: \"json\" };\n\n/**\n * What a running server is, as its clients need to know it.\n *\n * A discovery registration names the pid and version it wrote; `server.info`\n * answers with the live ones so a caller can tell the process it reached is the\n * one that registered rather than a different server that took the same port.\n */\nexport interface Interface {\n\treadonly pid: number;\n\treadonly version: string;\n\t/** The machine it runs on, by the name its user knows it; none when the OS names it nothing. */\n\treadonly host?: { readonly name: string };\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@codeworksh/cli/server/identity/Service\") {}\n\n/** This process: a server answers with it, a client compares a server's version against it. */\nexport const current: Interface = { pid: process.pid, version: pkg.version };\n\n// macOS's computer name is the one Finder and sharing show; its hostname is a mangled copy of it.\nconst hostName = Effect.gen(function* () {\n\tif (process.platform !== \"darwin\") return os.hostname().trim();\n\tconst spawner = yield* ChildProcessSpawner.ChildProcessSpawner;\n\tconst computer = yield* spawner\n\t\t.string(ChildProcess.make(\"scutil\", [\"--get\", \"ComputerName\"]))\n\t\t.pipe(Effect.orElseSucceed(() => \"\"));\n\treturn (\n\t\tcomputer.trim() ||\n\t\tos\n\t\t\t.hostname()\n\t\t\t.replace(/\\.local$/, \"\")\n\t\t\t.trim()\n\t);\n});\n\n/** The host's name is read once, when the server starts. */\nexport const layer = Layer.effect(\n\tService,\n\thostName.pipe(Effect.map((name) => Service.of(name === \"\" ? current : { ...current, host: { name } }))),\n).pipe(Layer.provide(NodeServices.layer));\n"],"mappings":"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"}
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-BVZbd-hd.mjs";
|
|
3
3
|
import { i as Cmd, n as handlers, r as run } from "./runtime-CK2CunDw.mjs";
|
|
4
4
|
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
|
5
5
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
@@ -7,50 +7,50 @@ import { Effect } from "effect";
|
|
|
7
7
|
//#region src/index.ts
|
|
8
8
|
const Handlers = handlers(Cmd, {
|
|
9
9
|
auth: {
|
|
10
|
-
login: () => import("./login-
|
|
11
|
-
status: () => import("./status-
|
|
12
|
-
refresh: () => import("./refresh-
|
|
13
|
-
logout: () => import("./logout-
|
|
10
|
+
login: () => import("./login-DEDr2Vyx.mjs"),
|
|
11
|
+
status: () => import("./status-B1V5lctj.mjs"),
|
|
12
|
+
refresh: () => import("./refresh-BevzQTKE.mjs"),
|
|
13
|
+
logout: () => import("./logout-CuhgmxyS.mjs")
|
|
14
14
|
},
|
|
15
15
|
mcp: {
|
|
16
|
-
add: () => import("./add-
|
|
17
|
-
remove: () => import("./remove-
|
|
18
|
-
list: () => import("./list-
|
|
19
|
-
login: () => import("./login-
|
|
20
|
-
logout: () => import("./logout-
|
|
21
|
-
reconnect: () => import("./reconnect-
|
|
22
|
-
disconnect: () => import("./disconnect-
|
|
16
|
+
add: () => import("./add-zUESl6ET.mjs"),
|
|
17
|
+
remove: () => import("./remove-C5Cdkluk.mjs"),
|
|
18
|
+
list: () => import("./list-BWMsbeuT.mjs"),
|
|
19
|
+
login: () => import("./login-k_5cpvOg.mjs"),
|
|
20
|
+
logout: () => import("./logout-DgfjJ4Qs.mjs"),
|
|
21
|
+
reconnect: () => import("./reconnect-CfSVaPkd.mjs"),
|
|
22
|
+
disconnect: () => import("./disconnect-DyZh1VIG.mjs")
|
|
23
23
|
},
|
|
24
|
-
run: () => import("./run-
|
|
25
|
-
serve: () => import("./serve-
|
|
24
|
+
run: () => import("./run-tgTFwaz6.mjs"),
|
|
25
|
+
serve: () => import("./serve-Br1ffJVV.mjs"),
|
|
26
26
|
service: {
|
|
27
|
-
start: () => import("./start-
|
|
28
|
-
restart: () => import("./restart-
|
|
29
|
-
status: () => import("./status-
|
|
30
|
-
stop: () => import("./stop-
|
|
27
|
+
start: () => import("./start-DeArzE9e.mjs"),
|
|
28
|
+
restart: () => import("./restart-N7BTKpcC.mjs"),
|
|
29
|
+
status: () => import("./status-DV4tmJRh.mjs"),
|
|
30
|
+
stop: () => import("./stop-Cbi0IsgA.mjs")
|
|
31
31
|
},
|
|
32
32
|
session: {
|
|
33
|
-
link: () => import("./link-
|
|
34
|
-
relink: () => import("./relink-
|
|
33
|
+
link: () => import("./link-XTnNYTMG.mjs"),
|
|
34
|
+
relink: () => import("./relink-D-74aBQZ.mjs")
|
|
35
35
|
},
|
|
36
36
|
thread: {
|
|
37
|
-
list: () => import("./list-
|
|
38
|
-
fork: () => import("./fork-
|
|
37
|
+
list: () => import("./list-CkcQPdvs.mjs"),
|
|
38
|
+
fork: () => import("./fork-D9G8UFMP.mjs")
|
|
39
39
|
},
|
|
40
|
-
acp: () => import("./acp-
|
|
40
|
+
acp: () => import("./acp-D7TtvhV-.mjs"),
|
|
41
41
|
plugin: {
|
|
42
|
-
add: () => import("./add-
|
|
43
|
-
check: () => import("./check-
|
|
44
|
-
install: () => import("./install-
|
|
45
|
-
list: () => import("./list-
|
|
46
|
-
reload: () => import("./reload-
|
|
47
|
-
remove: () => import("./remove-
|
|
48
|
-
update: () => import("./update-
|
|
42
|
+
add: () => import("./add-DHMnQW99.mjs"),
|
|
43
|
+
check: () => import("./check-DaAohHQB.mjs"),
|
|
44
|
+
install: () => import("./install-B3Jrv5qY.mjs"),
|
|
45
|
+
list: () => import("./list-B56MDFRg.mjs"),
|
|
46
|
+
reload: () => import("./reload-DQDThDsu.mjs"),
|
|
47
|
+
remove: () => import("./remove-DbGeM1mo.mjs"),
|
|
48
|
+
update: () => import("./update-DKaDSMmZ.mjs")
|
|
49
49
|
},
|
|
50
50
|
models: {
|
|
51
|
-
$: () => import("./list-
|
|
52
|
-
providers: () => import("./providers-
|
|
53
|
-
refresh: () => import("./refresh-
|
|
51
|
+
$: () => import("./list-2wagSRhT.mjs"),
|
|
52
|
+
providers: () => import("./providers-DFBL85KS.mjs"),
|
|
53
|
+
refresh: () => import("./refresh-D1ikVUxv.mjs")
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
const main = run(Cmd, Handlers, { version }).pipe(Effect.provide(NodeServices.layer));
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Runtime.handlers","Runtime.run","pkg.version"],"sources":["../../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as NodeRuntime from \"@effect/platform-node/NodeRuntime\";\nimport * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport { Effect } from \"effect\";\nimport type { CliError } from \"effect/cli\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { Cmd } from \"./cli/cmd/cmd.ts\";\nimport type { CommandError } from \"./cli/error.ts\";\nimport
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Runtime.handlers","Runtime.run","pkg.version"],"sources":["../../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as NodeRuntime from \"@effect/platform-node/NodeRuntime\";\nimport * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport { Effect } from \"effect\";\nimport type { CliError } from \"effect/cli\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { Cmd } from \"./cli/cmd/cmd.ts\";\nimport type { CommandError } from \"./cli/error.ts\";\nimport * as Runtime from \"./framework/runtime.ts\";\n\nconst Handlers = Runtime.handlers(Cmd, {\n\tauth: {\n\t\tlogin: () => import(\"./cli/cmd/handlers/auth/login.ts\"),\n\t\tstatus: () => import(\"./cli/cmd/handlers/auth/status.ts\"),\n\t\trefresh: () => import(\"./cli/cmd/handlers/auth/refresh.ts\"),\n\t\tlogout: () => import(\"./cli/cmd/handlers/auth/logout.ts\"),\n\t},\n\tmcp: {\n\t\tadd: () => import(\"./cli/cmd/handlers/mcp/add.ts\"),\n\t\tremove: () => import(\"./cli/cmd/handlers/mcp/remove.ts\"),\n\t\tlist: () => import(\"./cli/cmd/handlers/mcp/list.ts\"),\n\t\tlogin: () => import(\"./cli/cmd/handlers/mcp/login.ts\"),\n\t\tlogout: () => import(\"./cli/cmd/handlers/mcp/logout.ts\"),\n\t\treconnect: () => import(\"./cli/cmd/handlers/mcp/reconnect.ts\"),\n\t\tdisconnect: () => import(\"./cli/cmd/handlers/mcp/disconnect.ts\"),\n\t},\n\trun: () => import(\"./cli/cmd/handlers/run.ts\"),\n\tserve: () => import(\"./cli/cmd/handlers/serve.ts\"),\n\tservice: {\n\t\tstart: () => import(\"./cli/cmd/handlers/service/start.ts\"),\n\t\trestart: () => import(\"./cli/cmd/handlers/service/restart.ts\"),\n\t\tstatus: () => import(\"./cli/cmd/handlers/service/status.ts\"),\n\t\tstop: () => import(\"./cli/cmd/handlers/service/stop.ts\"),\n\t},\n\tsession: {\n\t\tlink: () => import(\"./cli/cmd/handlers/session/link.ts\"),\n\t\trelink: () => import(\"./cli/cmd/handlers/session/relink.ts\"),\n\t},\n\tthread: {\n\t\tlist: () => import(\"./cli/cmd/handlers/thread/list.ts\"),\n\t\tfork: () => import(\"./cli/cmd/handlers/thread/fork.ts\"),\n\t},\n\tacp: () => import(\"./cli/cmd/handlers/acp.ts\"),\n\tplugin: {\n\t\tadd: () => import(\"./cli/cmd/handlers/plugin/add.ts\"),\n\t\tcheck: () => import(\"./cli/cmd/handlers/plugin/check.ts\"),\n\t\tinstall: () => import(\"./cli/cmd/handlers/plugin/install.ts\"),\n\t\tlist: () => import(\"./cli/cmd/handlers/plugin/list.ts\"),\n\t\treload: () => import(\"./cli/cmd/handlers/plugin/reload.ts\"),\n\t\tremove: () => import(\"./cli/cmd/handlers/plugin/remove.ts\"),\n\t\tupdate: () => import(\"./cli/cmd/handlers/plugin/update.ts\"),\n\t},\n\tmodels: {\n\t\t$: () => import(\"./cli/cmd/handlers/models/list.ts\"),\n\t\tproviders: () => import(\"./cli/cmd/handlers/models/providers.ts\"),\n\t\trefresh: () => import(\"./cli/cmd/handlers/models/refresh.ts\"),\n\t},\n});\n\nexport const main: Effect.Effect<void, CommandError | CliError.CliError> = Runtime.run(Cmd, Handlers, {\n\tversion: pkg.version,\n}).pipe(Effect.provide(NodeServices.layer));\n\nNodeRuntime.runMain(main);\n"],"mappings":";;;;;;;AAWA,MAAM,WAAWA,SAAiB,KAAK;CACtC,MAAM;EACL,aAAa,OAAO;EACpB,cAAc,OAAO;EACrB,eAAe,OAAO;EACtB,cAAc,OAAO;CACtB;CACA,KAAK;EACJ,WAAW,OAAO;EAClB,cAAc,OAAO;EACrB,YAAY,OAAO;EACnB,aAAa,OAAO;EACpB,cAAc,OAAO;EACrB,iBAAiB,OAAO;EACxB,kBAAkB,OAAO;CAC1B;CACA,WAAW,OAAO;CAClB,aAAa,OAAO;CACpB,SAAS;EACR,aAAa,OAAO;EACpB,eAAe,OAAO;EACtB,cAAc,OAAO;EACrB,YAAY,OAAO;CACpB;CACA,SAAS;EACR,YAAY,OAAO;EACnB,cAAc,OAAO;CACtB;CACA,QAAQ;EACP,YAAY,OAAO;EACnB,YAAY,OAAO;CACpB;CACA,WAAW,OAAO;CAClB,QAAQ;EACP,WAAW,OAAO;EAClB,aAAa,OAAO;EACpB,eAAe,OAAO;EACtB,YAAY,OAAO;EACnB,cAAc,OAAO;EACrB,cAAc,OAAO;EACrB,cAAc,OAAO;CACtB;CACA,QAAQ;EACP,SAAS,OAAO;EAChB,iBAAiB,OAAO;EACxB,eAAe,OAAO;CACvB;AACD,CAAC;AAED,MAAa,OAA8DC,IAAY,KAAK,UAAU,EAC5FC,QACV,CAAC,CAAC,CAAC,KAAK,OAAO,QAAQ,aAAa,KAAK,CAAC;AAE1C,YAAY,QAAQ,IAAI"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure } from "./error-
|
|
3
|
-
import { i as read, t as fetchable } from "./entries-
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-CDGBK9Du.mjs";
|
|
3
|
+
import { i as read, t as fetchable } from "./entries-DEIZstjm.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { Plugin } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/plugin/install.ts
|
|
@@ -51,4 +51,4 @@ var install_default = handler(Cmd.commands.plugin.commands.install, Effect.fn("C
|
|
|
51
51
|
//#endregion
|
|
52
52
|
export { install_default as default };
|
|
53
53
|
|
|
54
|
-
//# sourceMappingURL=install-
|
|
54
|
+
//# sourceMappingURL=install-B3Jrv5qY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-B3Jrv5qY.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/plugin/install.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { fetchable, read } from \"./entries.ts\";\n\n/**\n * `plugin install`, with no argument: the answer to a fresh checkout.\n *\n * A committed `.codework/settings.jsonc` names plugins, the store on a colleague's machine is\n * empty, and something has to materialise them. This is `npm install` with no arguments -- it\n * writes no settings entry, because the entries already exist.\n *\n * It is also what lets **boot stay offline**. Without it the only path from an entry to bytes is a\n * boot that installs, which makes every fresh start a possible network wait; with it, boot\n * resolves or reports, and the error names this command as the remedy.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.install,\n\tEffect.fn(\"CLI.plugin.install\")(function* () {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache } = yield* read(shared);\n\n\t\t\tlet installed = 0;\n\t\t\tlet present = 0;\n\t\t\tlet local = 0;\n\t\t\tfor (const entry of entries) {\n\t\t\t\tconst target = fetchable(entry.target);\n\t\t\t\tif (target === undefined) {\n\t\t\t\t\t// A local plugin is loaded where it lies and never copied into the store, so\n\t\t\t\t\t// there is nothing to install. An unparseable entry is `list`'s to report.\n\t\t\t\t\tlocal += 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif ((yield* Plugin.resolve(target, cache, entry.from)) !== undefined) {\n\t\t\t\t\tpresent += 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// `inspect` installs, imports and validates, so a spec that turns out not to be a\n\t\t\t\t// plugin fails here rather than at the next run. The reported ID comes from the\n\t\t\t\t// module, never from the spec.\n\t\t\t\tconst plugin = yield* Plugin.inspect(entry.reference, { cache, hostDir: entry.from, file: entry.file });\n\t\t\t\tinstalled += 1;\n\t\t\t\tyield* writeOut(`Installed ${entry.reference} (${plugin.id})\\n`);\n\t\t\t}\n\n\t\t\tconst parts = [\n\t\t\t\t`${installed} installed`,\n\t\t\t\t...(present === 0 ? [] : [`${present} already present`]),\n\t\t\t\t...(local === 0 ? [] : [`${local} local`]),\n\t\t\t];\n\t\t\tyield* writeOut(`${parts.join(\", \")}\\n`);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,IAAA,kBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,SAC7B,OAAO,GAAG,oBAAoB,CAAC,CAAC,aAAa;CAoC5C,OAAO,OAnCS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,IAAI;EAC1B,MAAM,EAAE,SAAS,UAAU,OAAO,KAAK,MAAM;EAE7C,IAAI,YAAY;EAChB,IAAI,UAAU;EACd,IAAI,QAAQ;EACZ,KAAK,MAAM,SAAS,SAAS;GAC5B,MAAM,SAAS,UAAU,MAAM,MAAM;GACrC,IAAI,WAAW,KAAA,GAAW;IAGzB,SAAS;IACT;GACD;GACA,KAAK,OAAO,OAAO,QAAQ,QAAQ,OAAO,MAAM,IAAI,OAAO,KAAA,GAAW;IACrE,WAAW;IACX;GACD;GAIA,MAAM,SAAS,OAAO,OAAO,QAAQ,MAAM,WAAW;IAAE;IAAO,SAAS,MAAM;IAAM,MAAM,MAAM;GAAK,CAAC;GACtG,aAAa;GACb,OAAO,SAAS,aAAa,MAAM,UAAU,IAAI,OAAO,GAAG,IAAI;EAChE;EAEA,MAAM,QAAQ;GACb,GAAG,UAAU;GACb,GAAI,YAAY,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,iBAAiB;GACtD,GAAI,UAAU,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,OAAO;EACzC;EACA,OAAO,SAAS,GAAG,MAAM,KAAK,IAAI,EAAE,GAAG;CACxC,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { t as InvalidInputError } from "./error-CDGBK9Du.mjs";
|
|
2
|
+
import { Effect, FileSystem } from "effect";
|
|
3
|
+
import { SettingsFile } from "@codeworksh/harness/effect";
|
|
4
|
+
import { parse } from "jsonc-parser";
|
|
5
|
+
//#region src/cli/jsonc.ts
|
|
6
|
+
/**
|
|
7
|
+
* Reading and rewriting one value of a JSONC file the CLI edits for its owner: `settings.jsonc`,
|
|
8
|
+
* `mcp.json`. The edit and the write are the harness's {@link SettingsFile}, shared with the app
|
|
9
|
+
* server.
|
|
10
|
+
*/
|
|
11
|
+
/** The file's text and its top-level object; a missing file reads as `{}`. */
|
|
12
|
+
const read = Effect.fn("CLI.jsonc.read")(function* (path, what) {
|
|
13
|
+
const fs = yield* FileSystem.FileSystem;
|
|
14
|
+
const source = (yield* fs.exists(path)) ? yield* fs.readFileString(path) : "{}";
|
|
15
|
+
const errors = [];
|
|
16
|
+
const document = parse(source, errors, { allowTrailingComma: true });
|
|
17
|
+
if (errors.length > 0 || typeof document !== "object" || document === null || Array.isArray(document)) return yield* new InvalidInputError({ message: `${path} is not a valid ${what}` });
|
|
18
|
+
return {
|
|
19
|
+
source,
|
|
20
|
+
document
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
/** Set the value at `at` in `source`, or remove it when `value` is undefined, and write the file. */
|
|
24
|
+
const write = (path, source, at, value) => SettingsFile.save(path, SettingsFile.edit(source, at, value));
|
|
25
|
+
/**
|
|
26
|
+
* Serialize one read-modify-rename of `path` across CLI processes and the app server. Only the local
|
|
27
|
+
* edit is locked, so work that precedes it does not wait behind another process.
|
|
28
|
+
*/
|
|
29
|
+
const locked = (path, edit) => SettingsFile.locked(path, () => new InvalidInputError({ message: `timed out waiting to edit ${path}` }), edit);
|
|
30
|
+
//#endregion
|
|
31
|
+
export { read as n, write as r, locked as t };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=jsonc-CwZ1q4tQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc-CwZ1q4tQ.mjs","names":["parseJsonc"],"sources":["../../src/cli/jsonc.ts"],"sourcesContent":["import { SettingsFile } from \"@codeworksh/harness/effect\";\nimport { Effect, FileSystem } from \"effect\";\nimport { parse as parseJsonc, type ParseError } from \"jsonc-parser\";\nimport { InvalidInputError } from \"./error.ts\";\n\n/**\n * Reading and rewriting one value of a JSONC file the CLI edits for its owner: `settings.jsonc`,\n * `mcp.json`. The edit and the write are the harness's {@link SettingsFile}, shared with the app\n * server.\n */\n\n/** The file's text and its top-level object; a missing file reads as `{}`. */\nexport const read = Effect.fn(\"CLI.jsonc.read\")(function* (path: string, what: string) {\n\tconst fs = yield* FileSystem.FileSystem;\n\tconst source = (yield* fs.exists(path)) ? 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 ${what}` });\n\t}\n\treturn { source, document: document as Record<string, unknown> };\n});\n\n/** Set the value at `at` in `source`, or remove it when `value` is undefined, and write the file. */\nexport const write = (path: string, source: string, at: ReadonlyArray<string>, value: unknown) =>\n\tSettingsFile.save(path, SettingsFile.edit(source, at, value));\n\n/**\n * Serialize one read-modify-rename of `path` across CLI processes and the app server. Only the local\n * edit is locked, so work that precedes it does not wait behind another process.\n */\nexport const locked = <A, E, R>(path: string, edit: Effect.Effect<A, E, R>) =>\n\tSettingsFile.locked(path, () => new InvalidInputError({ message: `timed out waiting to edit ${path}` }), edit);\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,OAAO,OAAO,GAAG,gBAAgB,CAAC,CAAC,WAAW,MAAc,MAAc;CACtF,MAAM,KAAK,OAAO,WAAW;CAC7B,MAAM,UAAU,OAAO,GAAG,OAAO,IAAI,KAAK,OAAO,GAAG,eAAe,IAAI,IAAI;CAC3E,MAAM,SAAuB,CAAC;CAC9B,MAAM,WAAoBA,MAAW,QAAQ,QAAQ,EAAE,oBAAoB,KAAK,CAAC;CACjF,IAAI,OAAO,SAAS,KAAK,OAAO,aAAa,YAAY,aAAa,QAAQ,MAAM,QAAQ,QAAQ,GACnG,OAAO,OAAO,IAAI,kBAAkB,EAAE,SAAS,GAAG,KAAK,kBAAkB,OAAO,CAAC;CAElF,OAAO;EAAE;EAAkB;CAAoC;AAChE,CAAC;;AAGD,MAAa,SAAS,MAAc,QAAgB,IAA2B,UAC9E,aAAa,KAAK,MAAM,aAAa,KAAK,QAAQ,IAAI,KAAK,CAAC;;;;;AAM7D,MAAa,UAAmB,MAAc,SAC7C,aAAa,OAAO,YAAY,IAAI,kBAAkB,EAAE,SAAS,6BAA6B,OAAO,CAAC,GAAG,IAAI"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure, m as make, p as layer } from "./error-
|
|
2
|
+
import { f as writeOut, i as reportFailure, m as make, p as layer } from "./error-CDGBK9Du.mjs";
|
|
3
3
|
import { Effect, Option, Path } from "effect";
|
|
4
4
|
import { Session } from "@codeworksh/harness/effect";
|
|
5
5
|
//#region src/cli/cmd/handlers/session/link.ts
|
|
@@ -38,4 +38,4 @@ var link_default = handler(Cmd.commands.session.commands.link, Effect.fn("CLI.se
|
|
|
38
38
|
//#endregion
|
|
39
39
|
export { link_default as default };
|
|
40
40
|
|
|
41
|
-
//# sourceMappingURL=link-
|
|
41
|
+
//# sourceMappingURL=link-XTnNYTMG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-XTnNYTMG.mjs","names":["Runtime.handler","Client.make","Client.layer"],"sources":["../../src/cli/cmd/handlers/session/link.ts"],"sourcesContent":["import { Session } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport * as Client from \"../../../../server/client.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\n/**\n * Sets `hostDir` on an existing session.\n *\n * **The session ID identifies it; the path is the target.** A project cannot identify a session --\n * it may have many or none, and it is the session that carries the field.\n *\n * The path defaults to the shell's directory, which is both the common case (you are standing in\n * the project you want to link) and safe to default: the CLI runs on the host, so the trust\n * question about naming host paths is about remote clients, not about a local shell's own cwd.\n *\n * Not `session relink`, which moves a session to another checkout of the same project. Different\n * axes -- `relink` changes where the *work* happens, `link` changes which host directory the\n * session is *anchored to* -- and conflating them would recreate the confusion the two names\n * exist to avoid.\n *\n * The anchor is not a settings mechanism. Settings discovery reads it, so do plugin installs, and\n * so will whatever needs a host-side directory next; naming any one of them in the description is\n * what made this read like a settings flag.\n */\nexport default Runtime.handler(\n\tCmd.commands.session.commands.link,\n\tEffect.fn(\"CLI.session.link\")(function* ({ session, path, unlink, server }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst nodePath = yield* Path.Path;\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst sessionId = Session.SessionSchema.ID.make(session);\n\t\t\tconst hostDir = unlink\n\t\t\t\t? undefined\n\t\t\t\t: Session.AbsolutePath.make(nodePath.resolve(Option.getOrElse(path, () => \".\")));\n\n\t\t\tconst info = yield* rpc[\"session.link\"]({\n\t\t\t\tsessionId,\n\t\t\t\t...(hostDir === undefined ? {} : { hostDir }),\n\t\t\t});\n\t\t\t// Settings are re-read every exchange, so this applies at the next one: no reload, no\n\t\t\t// restart, the project layer simply starts or stops being read.\n\t\t\tyield* writeOut(\n\t\t\t\tinfo.hostDir === undefined\n\t\t\t\t\t? `Unlinked ${info.id}; it now reads the user settings alone.\\n`\n\t\t\t\t\t: `Linked ${info.id} to ${info.hostDir}\\n`,\n\t\t\t);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.provide(Client.layer(server)), Effect.scoped, Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAA,eAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,MAC9B,OAAO,GAAG,kBAAkB,CAAC,CAAC,WAAW,EAAE,SAAS,MAAM,QAAQ,UAAU;CAsB3E,OAAO,OArBS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,KAAK;EAC7B,MAAM,MAAM,OAAOC;EACnB,MAAM,YAAY,QAAQ,cAAc,GAAG,KAAK,OAAO;EACvD,MAAM,UAAU,SACb,KAAA,IACA,QAAQ,aAAa,KAAK,SAAS,QAAQ,OAAO,UAAU,YAAY,GAAG,CAAC,CAAC;EAEhF,MAAM,OAAO,OAAO,IAAI,eAAe,CAAC;GACvC;GACA,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;EAC5C,CAAC;EAGD,OAAO,SACN,KAAK,YAAY,KAAA,IACd,YAAY,KAAK,GAAG,6CACpB,UAAU,KAAK,GAAG,MAAM,KAAK,QAAQ,GACzC;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,QAAQC,MAAa,MAAM,CAAC,GAAG,OAAO,QAAQ,OAAO,MAAM,aAAa,CAAC;AAC5G,CAAC,CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure, t as InvalidInputError } from "./error-
|
|
2
|
+
import { f as writeOut, i as reportFailure, t as InvalidInputError } from "./error-CDGBK9Du.mjs";
|
|
3
3
|
import { n as synced } from "./catalog-XfqtqMDz.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { ModelCatalog } from "@codeworksh/harness/effect";
|
|
@@ -27,4 +27,4 @@ var list_default = handler(Cmd.commands.models, Effect.fn("CLI.models.list")(fun
|
|
|
27
27
|
//#endregion
|
|
28
28
|
export { list_default as default };
|
|
29
29
|
|
|
30
|
-
//# sourceMappingURL=list-
|
|
30
|
+
//# sourceMappingURL=list-2wagSRhT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-2wagSRhT.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/models/list.ts"],"sourcesContent":["import { ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { InvalidInputError, reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { synced } from \"./catalog.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.models,\n\tEffect.fn(\"CLI.models.list\")(function* ({ provider }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tyield* synced;\n\t\t\tconst catalog = yield* ModelCatalog.models;\n\t\t\tif (Option.isSome(provider)) {\n\t\t\t\tconst providerId = provider.value;\n\t\t\t\tif (!Object.hasOwn(catalog, providerId)) {\n\t\t\t\t\treturn yield* new InvalidInputError({\n\t\t\t\t\t\tmessage: `provider \"${providerId}\" is not in the catalog\\nhint: run \\`codework models providers\\``,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst sorted = Object.keys(catalog[providerId] ?? {}).sort((a, b) => a.localeCompare(b));\n\t\t\t\tyield* writeOut(sorted.map((modelId) => `${providerId}/${modelId}\\n`).join(\"\"));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lines: string[] = [];\n\t\t\tconst providers = Object.keys(catalog).sort((a, b) => a.localeCompare(b));\n\t\t\tfor (const providerId of providers) {\n\t\t\t\tconst providerModels = Object.keys(catalog[providerId] ?? {}).sort((a, b) => a.localeCompare(b));\n\t\t\t\tfor (const modelId of providerModels) {\n\t\t\t\t\tlines.push(`${providerId}/${modelId}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield* writeOut(lines.join(\"\"));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,eAAeA,QACd,IAAI,SAAS,QACb,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,YAAY;CA2BrD,OAAO,OA1BS,OAAO,IAAI,aAAa;EACvC,OAAO;EACP,MAAM,UAAU,OAAO,aAAa;EACpC,IAAI,OAAO,OAAO,QAAQ,GAAG;GAC5B,MAAM,aAAa,SAAS;GAC5B,IAAI,CAAC,OAAO,OAAO,SAAS,UAAU,GACrC,OAAO,OAAO,IAAI,kBAAkB,EACnC,SAAS,aAAa,WAAW,kEAClC,CAAC;GAEF,MAAM,SAAS,OAAO,KAAK,QAAQ,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;GACvF,OAAO,SAAS,OAAO,KAAK,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;GAC9E;EACD;EAEA,MAAM,QAAkB,CAAC;EACzB,MAAM,YAAY,OAAO,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;EACxE,KAAK,MAAM,cAAc,WAAW;GACnC,MAAM,iBAAiB,OAAO,KAAK,QAAQ,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;GAC/F,KAAK,MAAM,WAAW,gBACrB,MAAM,KAAK,GAAG,WAAW,GAAG,QAAQ,GAAG;EAEzC;EACA,OAAO,SAAS,MAAM,KAAK,EAAE,CAAC;CAC/B,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-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure } from "./error-
|
|
3
|
-
import { i as read } from "./entries-
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-CDGBK9Du.mjs";
|
|
3
|
+
import { i as read } from "./entries-DEIZstjm.mjs";
|
|
4
4
|
import { Effect, Schema } from "effect";
|
|
5
5
|
import { Plugin } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/plugin/list.ts
|
|
@@ -74,4 +74,4 @@ var list_default = handler(Cmd.commands.plugin.commands.list, Effect.fn("CLI.plu
|
|
|
74
74
|
//#endregion
|
|
75
75
|
export { list_default as default };
|
|
76
76
|
|
|
77
|
-
//# sourceMappingURL=list-
|
|
77
|
+
//# sourceMappingURL=list-B56MDFRg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-B56MDFRg.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/plugin/list.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Schema } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { read } from \"./entries.ts\";\n\n/**\n * Two columns: what was written, and what it turned out to be.\n *\n * **The second column doubles as the state, for free.** An ID cannot be known without importing\n * the module -- the store records nothing about the plugin inside a package -- so printing one is\n * proof that everything worked: the entry parsed, the store had it, the import succeeded, and the\n * definition validated. When any of that fails there is no ID to print, and the reason goes in its\n * place.\n *\n * **Nothing is stored to make that work.** The reason is the live error from this run, not a\n * record of an older one: a stored failure goes stale the moment someone fixes the cause, and a\n * list still printing `plugin-import-failed` after you installed the missing dependency is worse\n * than one that says nothing. The work is cheap and local -- a parse, a lookup and an import.\n *\n * (`checkedAt`/`outdated` are stored, for the opposite reason: those come from the network, so\n * re-obtaining them is expensive and a slightly stale answer is the right trade. Local facts are\n * recomputed; remote facts are cached.)\n */\nconst isSourceError = Schema.is(Plugin.SourceError);\nconst isInstallError = Schema.is(Plugin.InstallError);\nconst isStoreError = Schema.is(Plugin.StoreError);\nconst isLoadError = Schema.is(Plugin.LoadError);\n\n/** The §5.5 reason slug, which is the same string the CLI prints and a log line carries. */\nconst reasonOf = (error: unknown): { readonly reason: string; readonly message: string } =>\n\tisSourceError(error) || isInstallError(error) || isStoreError(error) || isLoadError(error)\n\t\t? { reason: error.reason, message: error.message }\n\t\t: { reason: \"plugin-load-failed\", message: String(error) };\n\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.list,\n\tEffect.fn(\"CLI.plugin.list\")(function* ({ verbose }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache } = yield* read(shared);\n\t\t\tif (entries.length === 0) {\n\t\t\t\tyield* writeOut(\"No plugins are configured.\\n\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst rows: Array<{ written: string; file: string; state: string; detail?: string }> = [];\n\t\t\tfor (const entry of entries) {\n\t\t\t\t// Resolve-only: listing what is configured must never install anything.\n\t\t\t\tconst inspected = yield* Plugin.inspect(entry.reference, {\n\t\t\t\t\tcache,\n\t\t\t\t\thostDir: entry.from,\n\t\t\t\t\tfile: entry.file,\n\t\t\t\t\tinstall: Plugin.resolveCached,\n\t\t\t\t}).pipe(Effect.result);\n\t\t\t\trows.push(\n\t\t\t\t\tinspected._tag === \"Success\"\n\t\t\t\t\t\t? { written: entry.written, file: entry.file, state: inspected.success.id }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\twritten: entry.written,\n\t\t\t\t\t\t\t\tfile: entry.file,\n\t\t\t\t\t\t\t\tstate: reasonOf(inspected.failure).reason,\n\t\t\t\t\t\t\t\tdetail: reasonOf(inspected.failure).message,\n\t\t\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// The left column is the reference exactly as the entry spells it, because that is the\n\t\t\t// string a person will search their settings for.\n\t\t\tconst width = Math.max(...rows.map((row) => row.written.length));\n\t\t\tfor (const row of rows) {\n\t\t\t\tyield* writeOut(`${row.written.padEnd(width)} ${row.state}\\n`);\n\t\t\t\tif (verbose) {\n\t\t\t\t\tif (row.detail !== undefined) yield* writeOut(`${\" \".repeat(width)} ${row.detail}\\n`);\n\t\t\t\t\tyield* writeOut(`${\" \".repeat(width)} declared in: ${row.file}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,gBAAgB,OAAO,GAAG,OAAO,WAAW;AAClD,MAAM,iBAAiB,OAAO,GAAG,OAAO,YAAY;AACpD,MAAM,eAAe,OAAO,GAAG,OAAO,UAAU;AAChD,MAAM,cAAc,OAAO,GAAG,OAAO,SAAS;;AAG9C,MAAM,YAAY,UACjB,cAAc,KAAK,KAAK,eAAe,KAAK,KAAK,aAAa,KAAK,KAAK,YAAY,KAAK,IACtF;CAAE,QAAQ,MAAM;CAAQ,SAAS,MAAM;AAAQ,IAC/C;CAAE,QAAQ;CAAsB,SAAS,OAAO,KAAK;AAAE;AAE3D,IAAA,eAAeA,QACd,IAAI,SAAS,OAAO,SAAS,MAC7B,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,WAAW;CA0CpD,OAAO,OAzCS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,IAAI;EAC1B,MAAM,EAAE,SAAS,UAAU,OAAO,KAAK,MAAM;EAC7C,IAAI,QAAQ,WAAW,GAAG;GACzB,OAAO,SAAS,8BAA8B;GAC9C;EACD;EAEA,MAAM,OAAiF,CAAC;EACxF,KAAK,MAAM,SAAS,SAAS;GAE5B,MAAM,YAAY,OAAO,OAAO,QAAQ,MAAM,WAAW;IACxD;IACA,SAAS,MAAM;IACf,MAAM,MAAM;IACZ,SAAS,OAAO;GACjB,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM;GACrB,KAAK,KACJ,UAAU,SAAS,YAChB;IAAE,SAAS,MAAM;IAAS,MAAM,MAAM;IAAM,OAAO,UAAU,QAAQ;GAAG,IACxE;IACA,SAAS,MAAM;IACf,MAAM,MAAM;IACZ,OAAO,SAAS,UAAU,OAAO,CAAC,CAAC;IACnC,QAAQ,SAAS,UAAU,OAAO,CAAC,CAAC;GACrC,CACH;EACD;EAIA,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,KAAK,QAAQ,IAAI,QAAQ,MAAM,CAAC;EAC/D,KAAK,MAAM,OAAO,MAAM;GACvB,OAAO,SAAS,GAAG,IAAI,QAAQ,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,GAAG;GAC9D,IAAI,SAAS;IACZ,IAAI,IAAI,WAAW,KAAA,GAAW,OAAO,SAAS,GAAG,IAAI,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,GAAG;IACrF,OAAO,SAAS,GAAG,IAAI,OAAO,KAAK,EAAE,iBAAiB,IAAI,KAAK,GAAG;GACnE;EACD;CACD,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-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure } from "./error-
|
|
3
|
-
import { n as configured, r as describe, t as MARKS } from "./shared-
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-CDGBK9Du.mjs";
|
|
3
|
+
import { n as configured, r as describe, t as MARKS } from "./shared-DasNo1nI.mjs";
|
|
4
4
|
import { Effect, Layer, References } from "effect";
|
|
5
5
|
import { Database, Event, Mcp } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/mcp/list.ts
|
|
@@ -68,4 +68,4 @@ var list_default = handler(Cmd.commands.mcp.commands.list, Effect.fn("CLI.mcp.li
|
|
|
68
68
|
//#endregion
|
|
69
69
|
export { list_default as default };
|
|
70
70
|
|
|
71
|
-
//# sourceMappingURL=list-
|
|
71
|
+
//# sourceMappingURL=list-BWMsbeuT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-BWMsbeuT.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/mcp/list.ts"],"sourcesContent":["/* @effect-diagnostics preferSchemaOverJson:off -- `--json` prints the report as it is built. */\nimport { Database, Event, type EventList, Mcp } from \"@codeworksh/harness/effect\";\nimport { Effect, Layer, References } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { configured, describe, MARKS } from \"./shared.ts\";\n\ninterface Report {\n\treadonly name: string;\n\treadonly level: \"user\" | \"project\";\n\treadonly file: string;\n\t/** The project `mcp.json` that overrides `enabled` or exposure of this user server. */\n\treadonly override?: string;\n\treadonly enabled: boolean;\n\treadonly exposure: string;\n\treadonly transport: string;\n\treadonly state: Mcp.State;\n\treadonly tools: ReadonlyArray<string>;\n\t/** Tools it listed that were left out because the MCP SDK rejects them. */\n\treadonly skipped?: EventList.McpSkipped;\n\t/** Tools whose exposure differs from the server's, from `toolExposure`. */\n\treadonly toolExposure?: Record<string, string>;\n\t/** Whether the server offers resources. They are not listed: listing every one can take long. */\n\treadonly resources?: true;\n\treadonly error?: string;\n}\n\nexport default Runtime.handler(\n\tCmd.commands.mcp.commands.list,\n\tEffect.fn(\"CLI.mcp.list\")(function* ({ json }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst { home, authFile, hostCwd, root, user, servers, errors } = yield* configured();\n\t\t\t// Every connect problem is in the report; the service's own logs would only repeat it.\n\t\t\tconst statuses = yield* Mcp.check({\n\t\t\t\tservers: servers.map((server) => [server.name, server.config] as const),\n\t\t\t\tdirectory: hostCwd,\n\t\t\t\thostDir: root ?? hostCwd,\n\t\t\t}).pipe(\n\t\t\t\t// Status events need an event service; nothing reads them here, so it keeps them in memory.\n\t\t\t\tEffect.provide(\n\t\t\t\t\tMcp.layer({ hostCwd, home, authFile }).pipe(\n\t\t\t\t\t\tLayer.provide(Event.layer.pipe(Layer.provide(Database.layer(\":memory:\")))),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tEffect.provideService(References.MinimumLogLevel, \"None\"),\n\t\t\t);\n\t\t\tconst reports = servers.map((server): Report => {\n\t\t\t\tconst { config } = server;\n\t\t\t\tconst status = statuses.find((one) => one.server === server.name);\n\t\t\t\tconst exposure = config.exposure ?? \"direct\";\n\t\t\t\tconst tools = status?.tools ?? [];\n\t\t\t\tconst overrides = tools.filter((tool) => tool.exposure !== exposure);\n\t\t\t\tconst state = status?.state ?? \"disabled\";\n\t\t\t\treturn {\n\t\t\t\t\tname: server.name,\n\t\t\t\t\tlevel: server.file === user ? \"user\" : \"project\",\n\t\t\t\t\tfile: server.file,\n\t\t\t\t\t...(server.override === undefined ? {} : { override: server.override }),\n\t\t\t\t\tenabled: config.enabled !== false,\n\t\t\t\t\texposure,\n\t\t\t\t\ttransport: \"url\" in config ? config.url : [config.command, ...(config.args ?? [])].join(\" \"),\n\t\t\t\t\tstate,\n\t\t\t\t\ttools: tools.map((tool) => tool.name),\n\t\t\t\t\t...(status?.skipped === undefined ? {} : { skipped: status.skipped }),\n\t\t\t\t\t...(overrides.length === 0\n\t\t\t\t\t\t? {}\n\t\t\t\t\t\t: { toolExposure: Object.fromEntries(overrides.map((tool) => [tool.name, tool.exposure])) }),\n\t\t\t\t\t...(status?.resources ? { resources: true as const } : {}),\n\t\t\t\t\t...(state !== \"connected\" && status?.error !== undefined ? { error: status.error } : {}),\n\t\t\t\t};\n\t\t\t});\n\t\t\tconst failed = errors.length > 0 || reports.some((report) => report.enabled && report.state !== \"connected\");\n\t\t\tif (failed)\n\t\t\t\tyield* Effect.sync(() => {\n\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t});\n\n\t\t\tif (json) return yield* writeOut(`${JSON.stringify({ servers: reports, errors }, null, 2)}\\n`);\n\t\t\tconst lines: string[] = [];\n\t\t\tif (reports.length === 0 && errors.length === 0)\n\t\t\t\tlines.push(`No MCP servers configured. Add them to ${user} or .codework/mcp.json.`);\n\t\t\tconst width = Math.max(0, ...reports.map((report) => report.name.length));\n\t\t\tfor (const report of reports) {\n\t\t\t\tlines.push(\n\t\t\t\t\t`${MARKS[report.state]} ${report.name.padEnd(width)} ${describe(report.state, report.tools.length, report.skipped)} (${report.exposure}, ${report.level})`,\n\t\t\t\t);\n\t\t\t\tconst detail = (line: string) => lines.push(` ${line}`);\n\t\t\t\tdetail(report.transport);\n\t\t\t\tif (report.override !== undefined) detail(`project override: ${report.override}`);\n\t\t\t\tif (report.tools.length > 0)\n\t\t\t\t\tdetail(\n\t\t\t\t\t\t`tools: ${report.tools\n\t\t\t\t\t\t\t.map((tool) => {\n\t\t\t\t\t\t\t\tconst exposure = report.toolExposure?.[tool];\n\t\t\t\t\t\t\t\treturn exposure === undefined ? tool : `${tool} [${exposure}]`;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.join(\", \")}`,\n\t\t\t\t\t);\n\t\t\t\tif (report.resources) detail(\"offers resources\");\n\t\t\t\tif (report.error !== undefined) for (const line of report.error.split(\"\\n\")) detail(line);\n\t\t\t}\n\t\t\tfor (const error of errors) lines.push(`config error: ${error}`);\n\t\t\tyield* writeOut(`${lines.join(\"\\n\")}\\n`);\n\t\t});\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
-
import { d as writeJson, f as writeOut, i as reportFailure, m as make, p as layer, y as ThreadInfo } from "./error-
|
|
2
|
+
import { d as writeJson, f as writeOut, i as reportFailure, m as make, p as layer, y as ThreadInfo } from "./error-CDGBK9Du.mjs";
|
|
3
3
|
import { Effect, Schema } from "effect";
|
|
4
4
|
import { Session } from "@codeworksh/harness/effect";
|
|
5
5
|
//#region src/cli/cmd/handlers/thread/list.ts
|
|
@@ -33,4 +33,4 @@ var list_default = handler(Cmd.commands.thread.commands.list, Effect.fn("CLI.thr
|
|
|
33
33
|
//#endregion
|
|
34
34
|
export { list_default as default };
|
|
35
35
|
|
|
36
|
-
//# sourceMappingURL=list-
|
|
36
|
+
//# sourceMappingURL=list-CkcQPdvs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-CkcQPdvs.mjs","names":["Runtime.handler","Client.make","ThreadInfoSchema","Client.layer"],"sources":["../../src/cli/cmd/handlers/thread/list.ts"],"sourcesContent":["import { Session } from \"@codeworksh/harness/effect\";\nimport { Effect, Schema } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport * as Client from \"../../../../server/client.ts\";\nimport { type ThreadInfo, ThreadInfo as ThreadInfoSchema } from \"../../../../server/contract.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeJson, writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nconst origin = (info: ThreadInfo): string => {\n\tswitch (info.origin.kind) {\n\t\tcase \"main\":\n\t\t\treturn \"main\";\n\t\tcase \"fork\":\n\t\t\treturn `fork of ${info.origin.threadId}`;\n\t\tcase \"subagent\":\n\t\t\treturn `subagent of ${info.origin.threadId}`;\n\t}\n};\n\nconst cost = (info: ThreadInfo) => `$${info.usage.cost.toFixed(4)}`;\n\nexport default Runtime.handler(\n\tCmd.commands.thread.commands.list,\n\tEffect.fn(\"CLI.thread.list\")(function* ({ session, json, server }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst threads = yield* rpc[\"thread.list\"]({ sessionId: Session.SessionSchema.ID.make(session) });\n\t\t\tif (json) return yield* writeJson(Schema.Array(ThreadInfoSchema), threads);\n\t\t\tif (threads.length === 0) return yield* writeOut(`No threads in ${session}.\\n`);\n\t\t\tconst rows = threads.map((info) => [\n\t\t\t\tinfo.id,\n\t\t\t\torigin(info),\n\t\t\t\tinfo.model === undefined ? \"-\" : `${info.model.provider}/${info.model.id}`,\n\t\t\t\t`${info.usage.input + info.usage.output} tok ${cost(info)}`,\n\t\t\t\tinfo.title ?? \"(untitled)\",\n\t\t\t]);\n\t\t\tconst widths = rows[0]?.map((_, column) => Math.max(...rows.map((row) => row[column]?.length ?? 0))) ?? [];\n\t\t\tfor (const row of rows) {\n\t\t\t\tconst last = row.length - 1;\n\t\t\t\tyield* writeOut(\n\t\t\t\t\t`${row.map((cell, column) => (column === last ? cell : cell.padEnd(widths[column] ?? 0))).join(\" \")}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.provide(Client.layer(server)), Effect.scoped, Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;AASA,MAAM,UAAU,SAA6B;CAC5C,QAAQ,KAAK,OAAO,MAApB;EACC,KAAK,QACJ,OAAO;EACR,KAAK,QACJ,OAAO,WAAW,KAAK,OAAO;EAC/B,KAAK,YACJ,OAAO,eAAe,KAAK,OAAO;CACpC;AACD;AAEA,MAAM,QAAQ,SAAqB,IAAI,KAAK,MAAM,KAAK,QAAQ,CAAC;AAEhE,IAAA,eAAeA,QACd,IAAI,SAAS,OAAO,SAAS,MAC7B,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,SAAS,MAAM,UAAU;CAsBlE,OAAO,OArBS,OAAO,IAAI,aAAa;EAEvC,MAAM,UAAU,QAAO,OADJC,KAAAA,CACQ,cAAc,CAAC,EAAE,WAAW,QAAQ,cAAc,GAAG,KAAK,OAAO,EAAE,CAAC;EAC/F,IAAI,MAAM,OAAO,OAAO,UAAU,OAAO,MAAMC,UAAgB,GAAG,OAAO;EACzE,IAAI,QAAQ,WAAW,GAAG,OAAO,OAAO,SAAS,iBAAiB,QAAQ,IAAI;EAC9E,MAAM,OAAO,QAAQ,KAAK,SAAS;GAClC,KAAK;GACL,OAAO,IAAI;GACX,KAAK,UAAU,KAAA,IAAY,MAAM,GAAG,KAAK,MAAM,SAAS,GAAG,KAAK,MAAM;GACtE,GAAG,KAAK,MAAM,QAAQ,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI;GACxD,KAAK,SAAS;EACf,CAAC;EACD,MAAM,SAAS,KAAK,EAAE,EAAE,KAAK,GAAG,WAAW,KAAK,IAAI,GAAG,KAAK,KAAK,QAAQ,IAAI,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;EACzG,KAAK,MAAM,OAAO,MAAM;GACvB,MAAM,OAAO,IAAI,SAAS;GAC1B,OAAO,SACN,GAAG,IAAI,KAAK,MAAM,WAAY,WAAW,OAAO,OAAO,KAAK,OAAO,OAAO,WAAW,CAAC,CAAE,CAAC,CAAC,KAAK,IAAI,EAAE,GACtG;EACD;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,QAAQC,MAAa,MAAM,CAAC,GAAG,OAAO,QAAQ,OAAO,MAAM,aAAa,CAAC;AAC5G,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure, m as make, t as InvalidInputError, u as writeError } from "./error-
|
|
3
|
-
import { a as oauthProviderLabel, i as makeOps, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-
|
|
2
|
+
import { f as writeOut, i as reportFailure, m as make, t as InvalidInputError, u as writeError } from "./error-CDGBK9Du.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, i as makeOps, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-D9lJX6cL.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { formatOAuthSummary, oauthLoginIssue, oauthNotice } from "@codeworksh/aikit/oauth/summary";
|
|
6
6
|
//#region src/cli/cmd/handlers/auth/login.ts
|
|
@@ -42,4 +42,4 @@ var login_default = handler(Cmd.commands.auth.commands.login, Effect.fn("CLI.aut
|
|
|
42
42
|
//#endregion
|
|
43
43
|
export { login_default as default };
|
|
44
44
|
|
|
45
|
-
//# sourceMappingURL=login-
|
|
45
|
+
//# sourceMappingURL=login-DEDr2Vyx.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-DEDr2Vyx.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/login.ts"],"sourcesContent":["import { formatOAuthSummary, oauthLoginIssue, oauthNotice } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { InvalidInputError, reportFailure } from \"../../../error.ts\";\nimport { writeError, writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport {\n\tassertServerScope,\n\tattempt,\n\tClient,\n\tlocalOps,\n\tmakeOps,\n\toauthProviderLabel,\n\tselectProvider,\n\twithServer,\n\ttype LoginOptions,\n} from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.auth.commands.login,\n\tEffect.fn(\"CLI.auth.login\")(function* ({\n\t\tserver,\n\t\topenaiCodex,\n\t\tgithubCopilot,\n\t\tauthFile,\n\t\tbrowser,\n\t\tdevice,\n\t\tenterprise,\n\t\tenableModels,\n\t\tjson,\n\t}) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst provider = yield* selectProvider({ openaiCodex, githubCopilot });\n\t\t\tconst issue = oauthLoginIssue(provider, {\n\t\t\t\tdevice,\n\t\t\t\tenableModels,\n\t\t\t\t...(Option.isSome(enterprise) && { enterprise: enterprise.value }),\n\t\t\t});\n\t\t\tif (issue !== undefined) return yield* new InvalidInputError({ message: issue });\n\n\t\t\tconst name = oauthProviderLabel(provider);\n\t\t\tconst options: LoginOptions = { browser, device, enterprise, enableModels };\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\t// The browser callback and the device prompt both need this\n\t\t\t\t\t\t// terminal, so the login runs here and only the result travels.\n\t\t\t\t\t\tconst { wire } = yield* attempt(`${name} login failed`, () =>\n\t\t\t\t\t\t\tmakeOps(provider, { persist: false }).login(options),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst info = yield* rpc[\"auth.save\"]({ credentials: wire });\n\t\t\t\t\t\tyield* writeError(`${oauthNotice(\"saved\", provider, \"the server\")}\\n`);\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(`${name} login failed`, () => ops.login(options));\n\t\t\tyield* writeError(`${oauthNotice(\"saved\", provider, ops.path)}\\n`);\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":";;;;;;AAkBA,IAAA,gBAAeA,QACd,IAAI,SAAS,KAAK,SAAS,OAC3B,OAAO,GAAG,gBAAgB,CAAC,CAAC,WAAW,EACtC,QACA,aACA,eACA,UACA,SACA,QACA,YACA,cACA,QACE;CAqCF,OAAO,OApCS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,eAAe;GAAE;GAAa;EAAc,CAAC;EACrE,MAAM,QAAQ,gBAAgB,UAAU;GACvC;GACA;GACA,GAAI,OAAO,OAAO,UAAU,KAAK,EAAE,YAAY,WAAW,MAAM;EACjE,CAAC;EACD,IAAI,UAAU,KAAA,GAAW,OAAO,OAAO,IAAI,kBAAkB,EAAE,SAAS,MAAM,CAAC;EAE/E,MAAM,OAAO,mBAAmB,QAAQ;EACxC,MAAM,UAAwB;GAAE;GAAS;GAAQ;GAAY;EAAa;EAE1E,IAAI,OAAO,OAAO,MAAM,GAAG;GAC1B,OAAO,kBAAkB,QAAQ;GACjC,OAAO,OAAO,WACb,OAAO,OACP,OAAO,IAAI,aAAa;IACvB,MAAM,MAAM,OAAOC;IAGnB,MAAM,EAAE,SAAS,OAAO,QAAQ,GAAG,KAAK,sBACvC,QAAQ,UAAU,EAAE,SAAS,MAAM,CAAC,CAAC,CAAC,MAAM,OAAO,CACpD;IACA,MAAM,OAAO,OAAO,IAAI,YAAY,CAAC,EAAE,aAAa,KAAK,CAAC;IAC1D,OAAO,WAAW,GAAG,YAAY,SAAS,UAAU,YAAY,EAAE,GAAG;IACrE,OAAO,SAAS,mBAAmB,MAAM,EAAE,KAAK,CAAC,CAAC;GACnD,CAAC,CACF;EACD;EAEA,MAAM,MAAM,OAAO,SAAS,UAAU,QAAQ;EAC9C,MAAM,EAAE,YAAY,OAAO,QAAQ,GAAG,KAAK,sBAAsB,IAAI,MAAM,OAAO,CAAC;EACnF,OAAO,WAAW,GAAG,YAAY,SAAS,UAAU,IAAI,IAAI,EAAE,GAAG;EACjE,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-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure, n as OAuthError, u as writeError } from "./error-
|
|
3
|
-
import { i as oauthServer } from "./shared-
|
|
2
|
+
import { f as writeOut, i as reportFailure, n as OAuthError, u as writeError } from "./error-CDGBK9Du.mjs";
|
|
3
|
+
import { i as oauthServer } from "./shared-DasNo1nI.mjs";
|
|
4
4
|
import { Duration, Effect, Logger } from "effect";
|
|
5
5
|
import { McpOAuth } from "@codeworksh/harness/effect";
|
|
6
6
|
import { openBrowser } from "@codeworksh/aikit/oauth/interactive";
|
|
@@ -56,4 +56,4 @@ var login_default = handler(Cmd.commands.mcp.commands.login, Effect.fn("CLI.mcp.
|
|
|
56
56
|
//#endregion
|
|
57
57
|
export { login_default as default };
|
|
58
58
|
|
|
59
|
-
//# sourceMappingURL=login-
|
|
59
|
+
//# sourceMappingURL=login-k_5cpvOg.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-k_5cpvOg.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/mcp/login.ts"],"sourcesContent":["/* @effect-diagnostics nodeBuiltinImport:off -- the pasted redirect URL is read from standard input. */\nimport { createInterface } from \"node:readline\";\nimport { openBrowser } from \"@codeworksh/aikit/oauth/interactive\";\nimport { McpOAuth } from \"@codeworksh/harness/effect\";\nimport { Duration, Effect, Logger } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { OAuthError, reportFailure } from \"../../../error.ts\";\nimport { writeError, writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { oauthServer } from \"./shared.ts\";\n\n/**\n * The redirected URL, typed or piped in when the browser cannot reach this machine's callback (over\n * SSH, say). Piped input that ends without a line leaves the callback to finish the sign-in; a\n * terminal that closes (Ctrl+C, Ctrl+D) cancels it.\n */\nconst paste: Effect.Effect<string> = Effect.acquireUseRelease(\n\tEffect.sync(() => ({\n\t\treadline: createInterface({ input: process.stdin, output: process.stderr }),\n\t\tanswered: false,\n\t})),\n\t(asking) =>\n\t\tEffect.callback<string>((resume) => {\n\t\t\tconst answer = (line: string) => {\n\t\t\t\tasking.answered = true;\n\t\t\t\tresume(Effect.succeed(line));\n\t\t\t};\n\t\t\tasking.readline.question(\"Or paste the URL the browser was redirected to: \", answer);\n\t\t\t// An empty answer cancels the sign-in.\n\t\t\tif (process.stdin.isTTY) asking.readline.once(\"close\", () => answer(\"\"));\n\t\t}),\n\t(asking) =>\n\t\tEffect.sync(() => {\n\t\t\tconst unanswered = !asking.answered;\n\t\t\tasking.readline.close();\n\t\t\t// A pipe still open would keep the process alive after the sign-in.\n\t\t\tprocess.stdin.destroy();\n\t\t\t// What follows starts on its own line, not after the prompt.\n\t\t\tif (unanswered) process.stderr.write(\"\\n\");\n\t\t}),\n);\n\nexport default Runtime.handler(\n\tCmd.commands.mcp.commands.login,\n\tEffect.fn(\"CLI.mcp.login\")(function* ({ name, browser, timeout }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst { store, config } = yield* oauthServer(name);\n\t\t\tconst limit = Duration.seconds(timeout);\n\t\t\tconst result = yield* McpOAuth.login({\n\t\t\t\tstore,\n\t\t\t\tname,\n\t\t\t\tconfig,\n\t\t\t\tprompt: {\n\t\t\t\t\tshow: (url) =>\n\t\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\t\tyield* writeError(`Sign in to MCP server \"${name}\" in your browser:\\n${url.href}\\n`);\n\t\t\t\t\t\t\tif (browser)\n\t\t\t\t\t\t\t\tyield* Effect.sync(\n\t\t\t\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\t\t\t\tvoid openBrowser(url.href, (error) =>\n\t\t\t\t\t\t\t\t\t\t\tprocess.stderr.write(`Failed to open browser: ${error.message}\\n`),\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}),\n\t\t\t\t\tpaste,\n\t\t\t\t},\n\t\t\t}).pipe(\n\t\t\t\tEffect.timeoutOrElse({\n\t\t\t\t\tduration: limit,\n\t\t\t\t\torElse: () =>\n\t\t\t\t\t\tEffect.fail(new OAuthError({ message: `sign-in timed out after ${Duration.format(limit)}` })),\n\t\t\t\t}),\n\t\t\t);\n\t\t\tconst tools = `${result.tools} tool${result.tools === 1 ? \"\" : \"s\"}`;\n\t\t\tyield* writeOut(\n\t\t\t\tresult.signedIn\n\t\t\t\t\t? `Signed in to MCP server \"${name}\" (${tools}).\\n`\n\t\t\t\t\t: `Already signed in to MCP server \"${name}\" (${tools}).\\n`,\n\t\t\t);\n\t\t});\n\t\t// Stdout carries only the outcome; harness logs go with the rest of the diagnostics.\n\t\treturn yield* program.pipe(Effect.provideService(Logger.LogToStderr, true), Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,QAA+B,OAAO,kBAC3C,OAAO,YAAY;CAClB,UAAU,gBAAgB;EAAE,OAAO,QAAQ;EAAO,QAAQ,QAAQ;CAAO,CAAC;CAC1E,UAAU;AACX,EAAE,IACD,WACA,OAAO,UAAkB,WAAW;CACnC,MAAM,UAAU,SAAiB;EAChC,OAAO,WAAW;EAClB,OAAO,OAAO,QAAQ,IAAI,CAAC;CAC5B;CACA,OAAO,SAAS,SAAS,oDAAoD,MAAM;CAEnF,IAAI,QAAQ,MAAM,OAAO,OAAO,SAAS,KAAK,eAAe,OAAO,EAAE,CAAC;AACxE,CAAC,IACD,WACA,OAAO,WAAW;CACjB,MAAM,aAAa,CAAC,OAAO;CAC3B,OAAO,SAAS,MAAM;CAEtB,QAAQ,MAAM,QAAQ;CAEtB,IAAI,YAAY,QAAQ,OAAO,MAAM,IAAI;AAC1C,CAAC,CACH;AAEA,IAAA,gBAAeA,QACd,IAAI,SAAS,IAAI,SAAS,OAC1B,OAAO,GAAG,eAAe,CAAC,CAAC,WAAW,EAAE,MAAM,SAAS,WAAW;CAqCjE,OAAO,OApCS,OAAO,IAAI,aAAa;EACvC,MAAM,EAAE,OAAO,WAAW,OAAO,YAAY,IAAI;EACjD,MAAM,QAAQ,SAAS,QAAQ,OAAO;EACtC,MAAM,SAAS,OAAO,SAAS,MAAM;GACpC;GACA;GACA;GACA,QAAQ;IACP,OAAO,QACN,OAAO,IAAI,aAAa;KACvB,OAAO,WAAW,0BAA0B,KAAK,sBAAsB,IAAI,KAAK,GAAG;KACnF,IAAI,SACH,OAAO,OAAO,WAEZ,KAAK,YAAY,IAAI,OAAO,UAC3B,QAAQ,OAAO,MAAM,2BAA2B,MAAM,QAAQ,GAAG,CAClE,CACF;IACF,CAAC;IACF;GACD;EACD,CAAC,CAAC,CAAC,KACF,OAAO,cAAc;GACpB,UAAU;GACV,cACC,OAAO,KAAK,IAAI,WAAW,EAAE,SAAS,2BAA2B,SAAS,OAAO,KAAK,IAAI,CAAC,CAAC;EAC9F,CAAC,CACF;EACA,MAAM,QAAQ,GAAG,OAAO,MAAM,OAAO,OAAO,UAAU,IAAI,KAAK;EAC/D,OAAO,SACN,OAAO,WACJ,4BAA4B,KAAK,KAAK,MAAM,QAC5C,oCAAoC,KAAK,KAAK,MAAM,KACxD;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,eAAe,OAAO,aAAa,IAAI,GAAG,OAAO,MAAM,aAAa,CAAC;AACxG,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
-
import { i as reportFailure, m as make, u as writeError } 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 { i as reportFailure, m as make, u as writeError } from "./error-CDGBK9Du.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-D9lJX6cL.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { oauthNotice } from "@codeworksh/aikit/oauth/summary";
|
|
6
6
|
//#region src/cli/cmd/handlers/auth/logout.ts
|
|
@@ -26,4 +26,4 @@ var logout_default = handler(Cmd.commands.auth.commands.logout, Effect.fn("CLI.a
|
|
|
26
26
|
//#endregion
|
|
27
27
|
export { logout_default as default };
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=logout-
|
|
29
|
+
//# sourceMappingURL=logout-CuhgmxyS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout-CuhgmxyS.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/logout.ts"],"sourcesContent":["import { oauthNotice } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeError } 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.logout,\n\tEffect.fn(\"CLI.auth.logout\")(function* ({ server, openaiCodex, githubCopilot, authFile }) {\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\tyield* rpc[\"auth.logout\"]({ provider });\n\t\t\t\t\t\tyield* writeError(`${oauthNotice(\"cleared\", provider, \"the server\")}\\n`);\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\tyield* attempt(`failed to clear ${name} credentials`, () => ops.logout());\n\t\t\tyield* writeError(`${oauthNotice(\"cleared\", provider, ops.path)}\\n`);\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,YAAY;CAsBzF,OAAO,OArBS,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,QAAO,OADYC,KAAAA,CACR,cAAc,CAAC,EAAE,SAAS,CAAC;IACtC,OAAO,WAAW,GAAG,YAAY,WAAW,UAAU,YAAY,EAAE,GAAG;GACxE,CAAC,CACF;EACD;EAEA,MAAM,MAAM,OAAO,SAAS,UAAU,QAAQ;EAC9C,OAAO,QAAQ,mBAAmB,KAAK,qBAAqB,IAAI,OAAO,CAAC;EACxE,OAAO,WAAW,GAAG,YAAY,WAAW,UAAU,IAAI,IAAI,EAAE,GAAG;CACpE,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-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure } from "./error-
|
|
3
|
-
import { i as oauthServer } from "./shared-
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-CDGBK9Du.mjs";
|
|
3
|
+
import { i as oauthServer } from "./shared-DasNo1nI.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { McpOAuth } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/mcp/logout.ts
|
|
@@ -14,4 +14,4 @@ var logout_default = handler(Cmd.commands.mcp.commands.logout, Effect.fn("CLI.mc
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { logout_default as default };
|
|
16
16
|
|
|
17
|
-
//# sourceMappingURL=logout-
|
|
17
|
+
//# sourceMappingURL=logout-DgfjJ4Qs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logout-DgfjJ4Qs.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/mcp/logout.ts"],"sourcesContent":["import { McpOAuth } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { oauthServer } from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.mcp.commands.logout,\n\tEffect.fn(\"CLI.mcp.logout\")(function* ({ name }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst { store, server } = yield* oauthServer(name);\n\t\t\tconst removed = yield* McpOAuth.signOut(store, server);\n\t\t\tyield* writeOut(\n\t\t\t\tremoved ? `Signed out of MCP server \"${name}\".\\n` : `MCP server \"${name}\" has no stored sign-in.\\n`,\n\t\t\t);\n\t\t});\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,iBAAeA,QACd,IAAI,SAAS,IAAI,SAAS,QAC1B,OAAO,GAAG,gBAAgB,CAAC,CAAC,WAAW,EAAE,QAAQ;CAQhD,OAAO,OAPS,OAAO,IAAI,aAAa;EACvC,MAAM,EAAE,OAAO,WAAW,OAAO,YAAY,IAAI;EACjD,MAAM,UAAU,OAAO,SAAS,QAAQ,OAAO,MAAM;EACrD,OAAO,SACN,UAAU,6BAA6B,KAAK,QAAQ,eAAe,KAAK,2BACzE;CACD,CACoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-BVZbd-hd.mjs","names":[],"sources":["../../package.json"],"sourcesContent":[""],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeworksh/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-dev.20261115060350",
|
|
4
4
|
"description": "CLI for running CodeWork coding agent harness.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@agentclientprotocol/sdk": "1.5.1",
|
|
43
|
-
"@codeworksh/aikit": "0.14.
|
|
44
|
-
"@codeworksh/harness": "0.
|
|
43
|
+
"@codeworksh/aikit": "0.14.1-dev.20261115060350",
|
|
44
|
+
"@codeworksh/harness": "0.9.0-dev.20261115060350",
|
|
45
45
|
"@effect/platform-node": "4.0.5",
|
|
46
46
|
"@effect/platform-node-shared": "4.0.5",
|
|
47
47
|
"effect": "4.0.5",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as Cmd, t as handler } from "./runtime-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure } from "./error-
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-CDGBK9Du.mjs";
|
|
3
3
|
import { n as synced } from "./catalog-XfqtqMDz.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { ModelCatalog } from "@codeworksh/harness/effect";
|
|
@@ -14,4 +14,4 @@ var providers_default = handler(Cmd.commands.models.commands.providers, Effect.f
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { providers_default as default };
|
|
16
16
|
|
|
17
|
-
//# sourceMappingURL=providers-
|
|
17
|
+
//# sourceMappingURL=providers-DFBL85KS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers-DFBL85KS.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/models/providers.ts"],"sourcesContent":["import { ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { synced } from \"./catalog.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.models.commands.providers,\n\tEffect.fn(\"CLI.models.providers\")(function* () {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tyield* synced;\n\t\t\tconst providers = yield* ModelCatalog.providers;\n\t\t\tconst sorted = [...providers].sort((a, b) => a.localeCompare(b));\n\t\t\tyield* writeOut(sorted.map((providerId) => `${providerId}\\n`).join(\"\"));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,oBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,WAC7B,OAAO,GAAG,sBAAsB,CAAC,CAAC,aAAa;CAQ9C,OAAO,OAPS,OAAO,IAAI,aAAa;EACvC,OAAO;EAEP,MAAM,SAAS,CAAC,GAAG,OADM,aAAa,SACV,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;EAC/D,OAAO,SAAS,OAAO,KAAK,eAAe,GAAG,WAAW,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;CACvE,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-CK2CunDw.mjs";
|
|
2
|
-
import { f as writeOut, i as reportFailure, m as make, n as OAuthError, t as InvalidInputError, u as writeError } 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 { f as writeOut, i as reportFailure, m as make, n as OAuthError, t as InvalidInputError, u as writeError } from "./error-CDGBK9Du.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-D9lJX6cL.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { formatOAuthSummary, oauthNotice, oauthRefreshIssue } from "@codeworksh/aikit/oauth/summary";
|
|
6
6
|
//#region src/cli/cmd/handlers/auth/refresh.ts
|
|
@@ -32,4 +32,4 @@ var refresh_default = handler(Cmd.commands.auth.commands.refresh, Effect.fn("CLI
|
|
|
32
32
|
//#endregion
|
|
33
33
|
export { refresh_default as default };
|
|
34
34
|
|
|
35
|
-
//# sourceMappingURL=refresh-
|
|
35
|
+
//# sourceMappingURL=refresh-BevzQTKE.mjs.map
|