@codeworksh/cli 0.0.1-dev.20260925125202 → 0.1.0-canary.15.1.g86693cf5
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-DK_xXx9y.mjs +494 -0
- package/acp-DK_xXx9y.mjs.map +1 -0
- package/{add-CIQSfxan.mjs → add-B9gIgFb3.mjs} +13 -12
- package/add-B9gIgFb3.mjs.map +1 -0
- package/{catalog-C5fDCgtx.mjs → catalog-D5BxyTfH.mjs} +5 -5
- package/catalog-D5BxyTfH.mjs.map +1 -0
- package/{check-B7bP5lRI.mjs → check-B9PJ6rn_.mjs} +6 -5
- package/check-B9PJ6rn_.mjs.map +1 -0
- package/{entries-CSY5N6jH.mjs → entries-CzgqHfKQ.mjs} +15 -14
- package/entries-CzgqHfKQ.mjs.map +1 -0
- package/error-C9ACQhhu.mjs +610 -0
- package/error-C9ACQhhu.mjs.map +1 -0
- package/{harness-DXAwGk0B.mjs → harness-6d8TlAVk.mjs} +4 -3
- package/harness-6d8TlAVk.mjs.map +1 -0
- package/index.mjs +20 -21
- package/index.mjs.map +1 -1
- package/{install-B02SIXwF.mjs → install-Cw6h6IRB.mjs} +7 -6
- package/install-Cw6h6IRB.mjs.map +1 -0
- package/{link-CA9XdPwj.mjs → link-B7iVolAn.mjs} +6 -5
- package/{link-CA9XdPwj.mjs.map → link-B7iVolAn.mjs.map} +1 -1
- package/{list-Bbo4XnG_.mjs → list-3hYMW1Wo.mjs} +11 -10
- package/list-3hYMW1Wo.mjs.map +1 -0
- package/{list-Ce1Ry4JN.mjs → list-BAonMfru.mjs} +6 -5
- package/list-BAonMfru.mjs.map +1 -0
- package/{login-CagARGqW.mjs → login-CXelgTth.mjs} +4 -4
- package/{login-CagARGqW.mjs.map → login-CXelgTth.mjs.map} +1 -1
- package/{logout-CYYtjZL3.mjs → logout-DrQQPxEW.mjs} +4 -4
- package/{logout-CYYtjZL3.mjs.map → logout-DrQQPxEW.mjs.map} +1 -1
- package/package-7FOUqcPO.mjs +6 -0
- package/package-7FOUqcPO.mjs.map +1 -0
- package/package.json +10 -34
- package/{providers-CoYj1SYv.mjs → providers-DksUoT4Z.mjs} +6 -5
- package/providers-DksUoT4Z.mjs.map +1 -0
- package/{refresh-8_nfeYNZ.mjs → refresh-CHBg5ya9.mjs} +4 -4
- package/{refresh-8_nfeYNZ.mjs.map → refresh-CHBg5ya9.mjs.map} +1 -1
- package/{refresh-D2a1ikea.mjs → refresh-DPBpboO0.mjs} +6 -5
- package/refresh-DPBpboO0.mjs.map +1 -0
- package/{reload-C5ysPM58.mjs → reload-DDsh7kFG.mjs} +3 -3
- package/{reload-C5ysPM58.mjs.map → reload-DDsh7kFG.mjs.map} +1 -1
- package/{remove-BkbspSED.mjs → remove-__JfeHO-.mjs} +6 -5
- package/remove-__JfeHO-.mjs.map +1 -0
- package/{run-CnxjZIGy.mjs → run-D47jXr5Q.mjs} +17 -18
- package/run-D47jXr5Q.mjs.map +1 -0
- package/{runtime-B3dlWGfs.mjs → runtime-D4zyJPrh.mjs} +9 -2
- package/runtime-D4zyJPrh.mjs.map +1 -0
- package/{serve-DaD7Eijz.mjs → serve-gOODO9pv.mjs} +44 -39
- package/serve-gOODO9pv.mjs.map +1 -0
- package/{settings-BZXmb54m.mjs → settings-DDkmAxW5.mjs} +12 -11
- package/settings-DDkmAxW5.mjs.map +1 -0
- package/{shared-BaTfajJ2.mjs → shared-DFB2--6V.mjs} +5 -4
- package/shared-DFB2--6V.mjs.map +1 -0
- package/{status-qJImmv6V.mjs → status-BNc5JZ1C.mjs} +4 -4
- package/{status-qJImmv6V.mjs.map → status-BNc5JZ1C.mjs.map} +1 -1
- package/{update-CxcNv_t0.mjs → update-CaW7oDOl.mjs} +7 -6
- package/update-CaW7oDOl.mjs.map +1 -0
- package/add-CIQSfxan.mjs.map +0 -1
- package/catalog-C5fDCgtx.mjs.map +0 -1
- package/check-B7bP5lRI.mjs.map +0 -1
- package/entries-CSY5N6jH.mjs.map +0 -1
- package/error-D0C5K2Av.mjs +0 -10376
- package/error-D0C5K2Av.mjs.map +0 -1
- package/harness-DXAwGk0B.mjs.map +0 -1
- package/index.d.mts +0 -24
- package/install-B02SIXwF.mjs.map +0 -1
- package/list-Bbo4XnG_.mjs.map +0 -1
- package/list-Ce1Ry4JN.mjs.map +0 -1
- package/providers-CoYj1SYv.mjs.map +0 -1
- package/refresh-D2a1ikea.mjs.map +0 -1
- package/remove-BkbspSED.mjs.map +0 -1
- package/run-CnxjZIGy.mjs.map +0 -1
- package/runtime-B3dlWGfs.mjs.map +0 -1
- package/serve-DaD7Eijz.mjs.map +0 -1
- package/settings-BZXmb54m.mjs.map +0 -1
- package/shared-BaTfajJ2.mjs.map +0 -1
- package/update-CxcNv_t0.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
3
|
-
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-D4zyJPrh.mjs";
|
|
2
|
+
import { d as writeOut, i as reportFailure, n as OAuthError, p as make, t as InvalidInputError, u as writeError } from "./error-C9ACQhhu.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-DFB2--6V.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-CHBg5ya9.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-
|
|
1
|
+
{"version":3,"file":"refresh-CHBg5ya9.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/refresh.ts"],"sourcesContent":["import { formatOAuthSummary, oauthNotice, oauthRefreshIssue } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { InvalidInputError, OAuthError, 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\toauthProviderLabel,\n\tselectProvider,\n\twithServer,\n} from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.auth.commands.refresh,\n\tEffect.fn(\"CLI.auth.refresh\")(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 blocked = oauthRefreshIssue(provider);\n\t\t\tif (blocked !== undefined) return yield* new InvalidInputError({ message: blocked });\n\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.refresh\"]({ 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* writeError(`${oauthNotice(\"refreshed\", 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(`failed to read ${name} credentials`, () => ops.refreshed());\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* writeError(`${oauthNotice(\"refreshed\", 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":";;;;;;AAgBA,IAAA,kBAAeA,QACd,IAAI,SAAS,KAAK,SAAS,SAC3B,OAAO,GAAG,kBAAkB,CAAC,CAAC,WAAW,EAAE,QAAQ,aAAa,eAAe,UAAU,QAAQ;CAiChG,OAAO,OAhCS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,eAAe;GAAE;GAAa;EAAc,CAAC;EACrE,MAAM,UAAU,kBAAkB,QAAQ;EAC1C,IAAI,YAAY,KAAA,GAAW,OAAO,OAAO,IAAI,kBAAkB,EAAE,SAAS,QAAQ,CAAC;EAEnF,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,eAAe,CAAC,EAAE,SAAS,CAAC;IACpD,IAAI,SAAS,MACZ,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,YAAY,EAAE,CAAC;IAEzF,OAAO,WAAW,GAAG,YAAY,aAAa,UAAU,YAAY,EAAE,GAAG;IACzE,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,UAAU,CAAC;EAC1F,IAAI,YAAY,KAAA,GACf,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,IAAI,IAAI,EAAE,CAAC;EAErF,OAAO,WAAW,GAAG,YAAY,aAAa,UAAU,IAAI,IAAI,EAAE,GAAG;EACrE,OAAO,SAAS,mBAAmB,SAAS,EAAE,KAAK,CAAC,CAAC;CACtD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
3
|
-
import { t as home } from "./catalog-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-D4zyJPrh.mjs";
|
|
2
|
+
import { d as writeOut, i as reportFailure, u as writeError } from "./error-C9ACQhhu.mjs";
|
|
3
|
+
import { t as home } from "./catalog-D5BxyTfH.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
|
+
import { ModelCatalog } from "@codeworksh/harness/effect";
|
|
5
6
|
//#region src/cli/cmd/handlers/models/refresh.ts
|
|
6
7
|
var refresh_default = handler(Cmd.commands.models.commands.refresh, Effect.fn("CLI.models.refresh")(function* ({ force }) {
|
|
7
8
|
return yield* Effect.gen(function* () {
|
|
8
|
-
const status = yield* refresh(yield* home, { force });
|
|
9
|
+
const status = yield* ModelCatalog.refresh(yield* home, { force });
|
|
9
10
|
yield* writeError(status.refreshed ? `Refreshed model catalog at ${status.path}\n` : `Model catalog at ${status.path} is fresh; pass --force to download it anyway\n`);
|
|
10
11
|
yield* writeOut(`${status.path}\n`);
|
|
11
12
|
}).pipe(Effect.catch(reportFailure));
|
|
@@ -13,4 +14,4 @@ var refresh_default = handler(Cmd.commands.models.commands.refresh, Effect.fn("C
|
|
|
13
14
|
//#endregion
|
|
14
15
|
export { refresh_default as default };
|
|
15
16
|
|
|
16
|
-
//# sourceMappingURL=refresh-
|
|
17
|
+
//# sourceMappingURL=refresh-DPBpboO0.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refresh-DPBpboO0.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/models/refresh.ts"],"sourcesContent":["import { ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeError, writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { home } from \"./catalog.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.models.commands.refresh,\n\tEffect.fn(\"CLI.models.refresh\")(function* ({ force }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst status = yield* ModelCatalog.refresh(yield* home, { force });\n\t\t\tyield* writeError(\n\t\t\t\tstatus.refreshed\n\t\t\t\t\t? `Refreshed model catalog at ${status.path}\\n`\n\t\t\t\t\t: `Model catalog at ${status.path} is fresh; pass --force to download it anyway\\n`,\n\t\t\t);\n\t\t\tyield* writeOut(`${status.path}\\n`);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,kBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,SAC7B,OAAO,GAAG,oBAAoB,CAAC,CAAC,WAAW,EAAE,SAAS;CAWrD,OAAO,OAVS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,aAAa,QAAQ,OAAO,MAAM,EAAE,MAAM,CAAC;EACjE,OAAO,WACN,OAAO,YACJ,8BAA8B,OAAO,KAAK,MAC1C,oBAAoB,OAAO,KAAK,gDACpC;EACA,OAAO,SAAS,GAAG,OAAO,KAAK,GAAG;CACnC,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-D4zyJPrh.mjs";
|
|
2
|
+
import { d as writeOut, f as layer, i as reportFailure, p as make } from "./error-C9ACQhhu.mjs";
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
//#region src/cli/cmd/handlers/plugin/reload.ts
|
|
5
5
|
/**
|
|
@@ -23,4 +23,4 @@ var reload_default = handler(Cmd.commands.plugin.commands.reload, Effect.fn("CLI
|
|
|
23
23
|
//#endregion
|
|
24
24
|
export { reload_default as default };
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=reload-
|
|
26
|
+
//# sourceMappingURL=reload-DDsh7kFG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload-
|
|
1
|
+
{"version":3,"file":"reload-DDsh7kFG.mjs","names":["Runtime.handler","Client.make","Client.layer"],"sources":["../../src/cli/cmd/handlers/plugin/reload.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Client } from \"../../../../server/client.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\n/**\n * Re-import every configured plugin in a running server.\n *\n * It exists for exactly one case: a **local** plugin edited in place. Nothing in settings changed\n * and no generation moved -- a local source is never copied into the store, so it has none -- and\n * the module registry holds the old module against an unchanged URL. Everything else the runtime\n * notices for itself at the next exchange.\n *\n * There is no local form, and that is not an omission. In a CLI every run is a fresh process, so\n * the load pass happens at startup and a reload would have nothing to do.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.reload,\n\tEffect.fn(\"CLI.plugin.reload\")(function* ({ server }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst result = yield* rpc[\"plugin.reload\"]({});\n\t\t\t// A reload that failed still reports the set that stayed loaded: the server kept\n\t\t\t// working, which is the whole point of not failing it.\n\t\t\tyield* writeOut(\n\t\t\t\tresult.failure === undefined\n\t\t\t\t\t? `Reloaded ${result.plugins} plugin${result.plugins === 1 ? \"\" : \"s\"}.\\n`\n\t\t\t\t\t: `Reload failed, keeping ${result.plugins} loaded: ${result.failure}\\n`,\n\t\t\t);\n\t\t\tif (result.failure !== undefined) process.exitCode = 1;\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":";;;;;;;;;;;;;;;AAkBA,IAAA,iBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,QAC7B,OAAO,GAAG,mBAAmB,CAAC,CAAC,WAAW,EAAE,UAAU;CAcrD,OAAO,OAbS,OAAO,IAAI,aAAa;EAEvC,MAAM,SAAS,QAAO,OADHC,KAAAA,CACO,gBAAgB,CAAC,CAAC,CAAC;EAG7C,OAAO,SACN,OAAO,YAAY,KAAA,IAChB,YAAY,OAAO,QAAQ,SAAS,OAAO,YAAY,IAAI,KAAK,IAAI,OACpE,0BAA0B,OAAO,QAAQ,WAAW,OAAO,QAAQ,GACvE;EACA,IAAI,OAAO,YAAY,KAAA,GAAW,QAAQ,WAAW;CACtD,CAEoB,CAAC,CAAC,KAAK,OAAO,QAAQC,MAAa,MAAM,CAAC,GAAG,OAAO,QAAQ,OAAO,MAAM,aAAa,CAAC;AAC5G,CAAC,CACF"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as resolveTarget, c as withPluginsLock, i as readPlugins, l as writePlugins, o as spellings, r as matching, t as identify } from "./settings-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-D4zyJPrh.mjs";
|
|
2
|
+
import { d as writeOut, i as reportFailure } from "./error-C9ACQhhu.mjs";
|
|
3
|
+
import { a as resolveTarget, c as withPluginsLock, i as readPlugins, l as writePlugins, o as spellings, r as matching, t as identify } from "./settings-DDkmAxW5.mjs";
|
|
4
4
|
import { Effect, FileSystem, Option, Path } from "effect";
|
|
5
|
+
import { Global } from "@codeworksh/harness/effect";
|
|
5
6
|
//#region src/cli/cmd/handlers/plugin/remove.ts
|
|
6
7
|
var remove_default = handler(Cmd.commands.plugin.commands.remove, Effect.fn("CLI.plugin.remove")(function* ({ package: reference, global: userWide }) {
|
|
7
8
|
return yield* Effect.gen(function* () {
|
|
8
9
|
const shared = yield* Cmd.spec;
|
|
9
10
|
const path = yield* Path.Path;
|
|
10
11
|
const fs = yield* FileSystem.FileSystem;
|
|
11
|
-
const paths = yield* resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value });
|
|
12
|
+
const paths = yield* Global.resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value });
|
|
12
13
|
const target = yield* resolveTarget(shared, userWide, void 0, false);
|
|
13
14
|
if (!(yield* fs.exists(path.dirname(target.path)))) {
|
|
14
15
|
yield* writeOut(`Plugin "${reference}" is not configured in ${target.path}\n`);
|
|
@@ -33,4 +34,4 @@ var remove_default = handler(Cmd.commands.plugin.commands.remove, Effect.fn("CLI
|
|
|
33
34
|
//#endregion
|
|
34
35
|
export { remove_default as default };
|
|
35
36
|
|
|
36
|
-
//# sourceMappingURL=remove-
|
|
37
|
+
//# sourceMappingURL=remove-__JfeHO-.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-__JfeHO-.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/plugin/remove.ts"],"sourcesContent":["import { Global } from \"@codeworksh/harness/effect\";\nimport { Effect, FileSystem, Option, Path } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport {\n\tidentify,\n\tmatching,\n\treadPlugins,\n\tresolveTarget,\n\tspellings,\n\twithPluginsLock,\n\twritePlugins,\n} from \"./settings.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.remove,\n\tEffect.fn(\"CLI.plugin.remove\")(function* ({ package: reference, global: userWide }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst path = yield* Path.Path;\n\t\t\tconst fs = yield* FileSystem.FileSystem;\n\t\t\tconst paths = yield* Global.resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value });\n\t\t\tconst target = yield* resolveTarget(shared, userWide, undefined, false);\n\t\t\t// Removing from a directory that is not a project is a read-only no-op. In particular, it\n\t\t\t// must not create the marker that would make this directory shadow a real project later.\n\t\t\tif (!(yield* fs.exists(path.dirname(target.path)))) {\n\t\t\t\tyield* writeOut(`Plugin \"${reference}\" is not configured in ${target.path}\\n`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst spelled = yield* spellings(reference, path.resolve(\".\"));\n\t\t\tyield* withPluginsLock(\n\t\t\t\ttarget.path,\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst { source, plugins } = yield* readPlugins(target.path);\n\t\t\t\t\t// Both the module entry and any configuration written against it: the package it was\n\t\t\t\t\t// added as, the path or version it was written with, and the ID it declares all name\n\t\t\t\t\t// the one plugin being removed.\n\t\t\t\t\tconst entries = yield* identify(plugins, target.path, paths.cache);\n\t\t\t\t\tconst selected = matching(entries, spelled);\n\t\t\t\t\tconst kept = entries.filter((entry) => !selected.has(entry)).map((entry) => entry.value);\n\t\t\t\t\tif (kept.length === plugins.length) {\n\t\t\t\t\t\tyield* writeOut(`Plugin \"${reference}\" is not configured in ${target.path}\\n`);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tyield* writePlugins(target.path, source, kept);\n\t\t\t\t\tconst dropped = plugins.length - kept.length;\n\t\t\t\t\tyield* writeOut(\n\t\t\t\t\t\t`Removed ${dropped} ${dropped === 1 ? \"entry\" : \"entries\"} for \"${reference}\" from ${target.path}\\n`,\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\t);\n\t\t});\n\n\t\treturn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IAAI,UAAU,UAAU,QAAQ,UAAU,SAAS,OAAO,KAAK,GAClG;EACD,CAAC,CACF;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as harnessOptions } from "./harness-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-D4zyJPrh.mjs";
|
|
2
|
+
import { a as addUsage, c as terminalColumns, d as writeOut, f as layer, l as usage, m as run, o as emptyUsage, p as make, r as renderError, s as header, t as InvalidInputError, u as writeError } from "./error-C9ACQhhu.mjs";
|
|
3
|
+
import { t as harnessOptions } from "./harness-6d8TlAVk.mjs";
|
|
4
4
|
import { Effect, Exit, Fiber, Option, Queue, Ref, Schema, Stream } from "effect";
|
|
5
|
+
import { EventList, Harness, Sandbox, Session } from "@codeworksh/harness/effect";
|
|
5
6
|
//#region src/cli/cmd/handlers/run.ts
|
|
6
7
|
const initialRenderState = {
|
|
7
8
|
usage: emptyUsage,
|
|
8
9
|
textSeen: false,
|
|
9
10
|
textEndsWithNewline: false
|
|
10
11
|
};
|
|
11
|
-
const isTextDelta = Schema.is(LLMTextDelta);
|
|
12
|
-
const isLLMEnded = Schema.is(LLMEnded);
|
|
13
|
-
const isTurnEnded = Schema.is(TurnEnded);
|
|
12
|
+
const isTextDelta = Schema.is(EventList.LLMTextDelta);
|
|
13
|
+
const isLLMEnded = Schema.is(EventList.LLMEnded);
|
|
14
|
+
const isTurnEnded = Schema.is(EventList.TurnEnded);
|
|
14
15
|
const render = (state, ended) => Effect.fn("CLI.render")(function* (event) {
|
|
15
16
|
if (isTextDelta(event)) {
|
|
16
17
|
yield* writeOut(event.data.delta);
|
|
@@ -39,10 +40,10 @@ const awaitMessage = Effect.fn("CLI.awaitMessage")(function* (ended, messageId)
|
|
|
39
40
|
while ((yield* Queue.take(ended)) !== messageId);
|
|
40
41
|
});
|
|
41
42
|
const selectSandbox = Effect.fn("CLI.selectSandbox")(function* (input) {
|
|
42
|
-
const selection = yield* resolve(input);
|
|
43
|
+
const selection = yield* Sandbox.resolve(input);
|
|
43
44
|
if (selection.created && selection.info !== void 0) {
|
|
44
45
|
const id = selection.info.id;
|
|
45
|
-
yield* Effect.addFinalizer(() => Effect.ignore(stop(id)));
|
|
46
|
+
yield* Effect.addFinalizer(() => Effect.ignore(Sandbox.stop(id)));
|
|
46
47
|
}
|
|
47
48
|
return selection.info;
|
|
48
49
|
});
|
|
@@ -57,11 +58,11 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run")(function* ({ pr
|
|
|
57
58
|
shared.userConfigDir
|
|
58
59
|
].some(Option.isSome)) return yield* new InvalidInputError({ message: "--home, --database, and --user-config-dir belong on codework serve when using --server" });
|
|
59
60
|
if (Option.isSome(sandboxId) && (Option.isSome(sandboxDriver) || Option.isSome(sandboxProviderId))) return yield* new InvalidInputError({ message: "--sandbox-id cannot be combined with --sandbox-driver or --sandbox-provider-id" });
|
|
60
|
-
const selection = Option.isSome(sandboxId) ? { id:
|
|
61
|
+
const selection = Option.isSome(sandboxId) ? { id: Sandbox.SandboxInstance.ID.make(sandboxId.value) } : {
|
|
61
62
|
driver: Option.getOrElse(sandboxDriver, () => "local"),
|
|
62
63
|
...Option.isNone(sandboxProviderId) ? {} : { providerResourceId: sandboxProviderId.value }
|
|
63
64
|
};
|
|
64
|
-
const hostDir =
|
|
65
|
+
const hostDir = Session.AbsolutePath.make(process.cwd());
|
|
65
66
|
const runtime = {
|
|
66
67
|
...Option.isNone(provider) || Option.isNone(model) ? {} : { model: {
|
|
67
68
|
provider: provider.value,
|
|
@@ -72,10 +73,9 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run")(function* ({ pr
|
|
|
72
73
|
const remote = Effect.gen(function* () {
|
|
73
74
|
const rpc = yield* make;
|
|
74
75
|
const info = Option.isSome(session) ? yield* rpc["session.configure"]({
|
|
75
|
-
sessionId: ID.make(session.value),
|
|
76
|
+
sessionId: Session.SessionSchema.ID.make(session.value),
|
|
76
77
|
runtime
|
|
77
78
|
}) : yield* rpc["session.create"]({
|
|
78
|
-
title: "CLI",
|
|
79
79
|
runtime,
|
|
80
80
|
...Option.isNone(cwd) ? {} : { directory: cwd.value },
|
|
81
81
|
hostDir,
|
|
@@ -98,14 +98,13 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run")(function* ({ pr
|
|
|
98
98
|
});
|
|
99
99
|
const program = Effect.gen(function* () {
|
|
100
100
|
let handle;
|
|
101
|
-
if (Option.isSome(session)) handle = yield* attach({
|
|
102
|
-
sessionId: ID.make(session.value),
|
|
101
|
+
if (Option.isSome(session)) handle = yield* Session.attach({
|
|
102
|
+
sessionId: Session.SessionSchema.ID.make(session.value),
|
|
103
103
|
...runtime
|
|
104
104
|
});
|
|
105
105
|
else {
|
|
106
106
|
const selected = yield* selectSandbox(selection);
|
|
107
|
-
handle = yield* create({
|
|
108
|
-
title: "CLI",
|
|
107
|
+
handle = yield* Session.create({
|
|
109
108
|
...runtime,
|
|
110
109
|
...selected === void 0 ? {} : { sandbox: selected },
|
|
111
110
|
...Option.isNone(cwd) ? {} : { directory: cwd.value },
|
|
@@ -136,7 +135,7 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run")(function* ({ pr
|
|
|
136
135
|
});
|
|
137
136
|
return yield* Effect.gen(function* () {
|
|
138
137
|
if (Option.isSome(server)) return yield* remote.pipe(Effect.provide(layer(server.value)));
|
|
139
|
-
return yield* program.pipe(Effect.provide(layer
|
|
138
|
+
return yield* program.pipe(Effect.provide(Harness.layer(harnessOptions(shared))));
|
|
140
139
|
}).pipe(Effect.scoped, Effect.catch((error) => writeError(renderError(error)).pipe(Effect.andThen(Effect.sync(() => {
|
|
141
140
|
process.exitCode = 1;
|
|
142
141
|
})))));
|
|
@@ -144,4 +143,4 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run")(function* ({ pr
|
|
|
144
143
|
//#endregion
|
|
145
144
|
export { run_default as default };
|
|
146
145
|
|
|
147
|
-
//# sourceMappingURL=run-
|
|
146
|
+
//# sourceMappingURL=run-D47jXr5Q.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-D47jXr5Q.mjs","names":["Runtime.handler","Client.make","Client.run","Client.layer"],"sources":["../../src/cli/cmd/handlers/run.ts"],"sourcesContent":["import { EventList, type EventSchema, Harness, Sandbox, Session } from \"@codeworksh/harness/effect\";\nimport { Effect, Exit, Fiber, Option, Queue, Ref, Schema, Stream } from \"effect\";\nimport { Runtime } from \"../../../framework/runtime.ts\";\nimport { Client } from \"../../../server/client.ts\";\nimport { InvalidInputError, renderError } from \"../../error.ts\";\nimport { harnessOptions } from \"../../harness.ts\";\nimport {\n\taddUsage,\n\temptyUsage,\n\theader,\n\tterminalColumns,\n\tusage,\n\ttype UsageSummary,\n\twriteError,\n\twriteOut,\n} from \"../../output.ts\";\nimport { Cmd } from \"../cmd.ts\";\n\ninterface RenderState {\n\treadonly usage: UsageSummary;\n\treadonly textSeen: boolean;\n\treadonly textEndsWithNewline: boolean;\n}\n\nconst initialRenderState: RenderState = {\n\tusage: emptyUsage,\n\ttextSeen: false,\n\ttextEndsWithNewline: false,\n};\n\nconst isTextDelta = Schema.is(EventList.LLMTextDelta);\nconst isLLMEnded = Schema.is(EventList.LLMEnded);\nconst isTurnEnded = Schema.is(EventList.TurnEnded);\n\nconst render = (state: Ref.Ref<RenderState>, ended?: Queue.Queue<string>) =>\n\tEffect.fn(\"CLI.render\")(function* (event: EventSchema.Payload) {\n\t\tif (isTextDelta(event)) {\n\t\t\tyield* writeOut(event.data.delta);\n\t\t\tif (event.data.delta.length > 0) {\n\t\t\t\tyield* Ref.update(state, (current) => ({\n\t\t\t\t\t...current,\n\t\t\t\t\ttextSeen: true,\n\t\t\t\t\ttextEndsWithNewline: event.data.delta.endsWith(\"\\n\"),\n\t\t\t\t}));\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (isLLMEnded(event)) {\n\t\t\tyield* Ref.update(state, (current) => ({ ...current, usage: addUsage(current.usage, event.data.message) }));\n\t\t\treturn;\n\t\t}\n\t\tif (ended !== undefined && isTurnEnded(event)) {\n\t\t\tyield* Queue.offer(ended, event.data.messageId);\n\t\t}\n\t});\n\nconst finish = Effect.fn(\"CLI.finish\")(function* (state: Ref.Ref<RenderState>, columns: number) {\n\tconst rendered = yield* Ref.get(state);\n\tif (rendered.textSeen && !rendered.textEndsWithNewline) yield* writeOut(\"\\n\");\n\tyield* writeError(usage(rendered.usage, columns));\n});\n\nconst awaitMessage = Effect.fn(\"CLI.awaitMessage\")(function* (ended: Queue.Queue<string>, messageId: string) {\n\twhile ((yield* Queue.take(ended)) !== messageId) {\n\t\t// Earlier turns in the same drain are expected when a tool call continues.\n\t}\n});\n\nconst selectSandbox = Effect.fn(\"CLI.selectSandbox\")(function* (input: Sandbox.Selection) {\n\tconst selection = yield* Sandbox.resolve(input);\n\tif (selection.created && selection.info !== undefined) {\n\t\tconst id = selection.info.id;\n\t\tyield* Effect.addFinalizer(() => Effect.ignore(Sandbox.stop(id)));\n\t}\n\treturn selection.info;\n});\n\nexport default Runtime.handler(\n\tCmd.commands.run,\n\tEffect.fn(\"CLI.run\")(function* ({\n\t\tprompt,\n\t\tsession,\n\t\tcwd,\n\t\tsandboxDriver,\n\t\tsandboxProviderId,\n\t\tsandboxId,\n\t\tprovider,\n\t\tmodel,\n\t\tthinking,\n\t\tserver,\n\t}) {\n\t\tconst shared = yield* Cmd.spec;\n\t\tif (\n\t\t\tOption.isSome(session) &&\n\t\t\t(Option.isSome(cwd) ||\n\t\t\t\tOption.isSome(sandboxDriver) ||\n\t\t\t\tOption.isSome(sandboxProviderId) ||\n\t\t\t\tOption.isSome(sandboxId))\n\t\t) {\n\t\t\treturn yield* new InvalidInputError({\n\t\t\t\tmessage:\n\t\t\t\t\t\"--cwd, --sandbox-driver, --sandbox-id, and --sandbox-provider-id can only be used when creating a new session\",\n\t\t\t});\n\t\t}\n\t\tif (Option.isSome(provider) !== Option.isSome(model)) {\n\t\t\treturn yield* new InvalidInputError({ message: \"--provider and --model must be provided together\" });\n\t\t}\n\t\tif (Option.isSome(sandboxProviderId) && Option.isNone(sandboxDriver)) {\n\t\t\treturn yield* new InvalidInputError({\n\t\t\t\tmessage: \"--sandbox-provider-id requires a remote --sandbox-driver\",\n\t\t\t});\n\t\t}\n\t\tif (Option.isSome(server) && [shared.home, shared.database, shared.userConfigDir].some(Option.isSome)) {\n\t\t\treturn yield* new InvalidInputError({\n\t\t\t\tmessage: \"--home, --database, and --user-config-dir belong on codework serve when using --server\",\n\t\t\t});\n\t\t}\n\n\t\tif (Option.isSome(sandboxId) && (Option.isSome(sandboxDriver) || Option.isSome(sandboxProviderId))) {\n\t\t\treturn yield* new InvalidInputError({\n\t\t\t\tmessage: \"--sandbox-id cannot be combined with --sandbox-driver or --sandbox-provider-id\",\n\t\t\t});\n\t\t}\n\t\tconst selection: Sandbox.Selection = Option.isSome(sandboxId)\n\t\t\t? { id: Sandbox.SandboxInstance.ID.make(sandboxId.value) }\n\t\t\t: {\n\t\t\t\t\tdriver: Option.getOrElse(sandboxDriver, () => \"local\"),\n\t\t\t\t\t...(Option.isNone(sandboxProviderId) ? {} : { providerResourceId: sandboxProviderId.value }),\n\t\t\t\t};\n\n\t\t// The session's host directory, with no flag to set it: a person running a command is always\n\t\t// somewhere, and that somewhere is what they mean by \"this project\". `--cwd` is a different\n\t\t// thing entirely -- where the work runs inside the session's space, which may be a sandbox\n\t\t// on another machine.\n\t\tconst hostDir = Session.AbsolutePath.make(process.cwd());\n\n\t\tconst runtime = {\n\t\t\t...(Option.isNone(provider) || Option.isNone(model)\n\t\t\t\t? {}\n\t\t\t\t: { model: { provider: provider.value, id: model.value } }),\n\t\t\t...(Option.isNone(thinking) ? {} : { thinkingLevel: thinking.value }),\n\t\t};\n\t\tconst remote = Effect.gen(function* () {\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst info = Option.isSome(session)\n\t\t\t\t? yield* rpc[\"session.configure\"]({ sessionId: Session.SessionSchema.ID.make(session.value), runtime })\n\t\t\t\t: yield* rpc[\"session.create\"]({\n\t\t\t\t\t\truntime,\n\t\t\t\t\t\t...(Option.isNone(cwd) ? {} : { directory: cwd.value }),\n\t\t\t\t\t\thostDir,\n\t\t\t\t\t\tsandbox: selection,\n\t\t\t\t\t});\n\t\t\tconst state = yield* Ref.make(initialRenderState);\n\t\t\tconst columns = terminalColumns();\n\t\t\tyield* writeError(\n\t\t\t\theader({\n\t\t\t\t\tsessionId: info.id,\n\t\t\t\t\tsandbox: info.sandbox?.driver ?? \"local\",\n\t\t\t\t\tdirectory: info.directory,\n\t\t\t\t\tcolumns,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tif (info.sandbox !== undefined) yield* writeError(`sandbox-id: ${info.sandbox.id}\\n`);\n\t\t\tyield* Client.run(rpc, { sessionId: info.id, text: prompt }, render(state)).pipe(\n\t\t\t\tEffect.onInterrupt(() =>\n\t\t\t\t\trpc[\"session.interrupt\"]({ sessionId: info.id }).pipe(Effect.timeout(\"5 seconds\"), Effect.ignore),\n\t\t\t\t),\n\t\t\t);\n\t\t\tyield* finish(state, columns);\n\t\t});\n\t\tconst program = Effect.gen(function* () {\n\t\t\tlet handle: Session.Handle;\n\t\t\tif (Option.isSome(session)) {\n\t\t\t\thandle = yield* Session.attach({ sessionId: Session.SessionSchema.ID.make(session.value), ...runtime });\n\t\t\t} else {\n\t\t\t\tconst selected = yield* selectSandbox(selection);\n\t\t\t\thandle = yield* Session.create({\n\t\t\t\t\t...runtime,\n\t\t\t\t\t...(selected === undefined ? {} : { sandbox: selected }),\n\t\t\t\t\t...(Option.isNone(cwd) ? {} : { directory: cwd.value }),\n\t\t\t\t\thostDir,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst ended = yield* Queue.unbounded<string>();\n\t\t\tconst renderState = yield* Ref.make(initialRenderState);\n\t\t\tconst printer = yield* handle\n\t\t\t\t.events()\n\t\t\t\t.pipe(Stream.runForEach(render(renderState, ended)), Effect.forkScoped({ startImmediately: true }));\n\n\t\t\tconst info = yield* handle.info;\n\t\t\tconst columns = terminalColumns();\n\t\t\tyield* writeError(\n\t\t\t\theader({\n\t\t\t\t\tsessionId: handle.id,\n\t\t\t\t\tsandbox: info.sandbox?.driver ?? \"local\",\n\t\t\t\t\tdirectory: info.directory,\n\t\t\t\t\tcolumns,\n\t\t\t\t}),\n\t\t\t);\n\t\t\t// The local command joins execution to retain typed error details.\n\t\t\tconst execution = yield* handle\n\t\t\t\t.prompt({ text: prompt, delivery: \"followUp\" })\n\t\t\t\t.pipe(Effect.andThen(handle.resume()), Effect.exit);\n\t\t\tyield* handle.wait();\n\t\t\tif (Exit.isFailure(execution)) return yield* Effect.failCause(execution.cause);\n\t\t\tconst path = yield* handle.path();\n\t\t\tconst leaf = path.at(-1);\n\t\t\tif (leaf !== undefined) yield* awaitMessage(ended, leaf.entry.id);\n\t\t\tyield* Fiber.interrupt(printer);\n\t\t\tyield* finish(renderState, columns);\n\t\t});\n\n\t\tconst execute = Effect.gen(function* () {\n\t\t\tif (Option.isSome(server)) return yield* remote.pipe(Effect.provide(Client.layer(server.value)));\n\t\t\treturn yield* program.pipe(Effect.provide(Harness.layer(harnessOptions(shared))));\n\t\t});\n\t\treturn yield* execute.pipe(\n\t\t\tEffect.scoped,\n\t\t\tEffect.catch((error) =>\n\t\t\t\twriteError(renderError(error)).pipe(\n\t\t\t\t\tEffect.andThen(\n\t\t\t\t\t\tEffect.sync(() => {\n\t\t\t\t\t\t\tprocess.exitCode = 1;\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t}),\n);\n"],"mappings":";;;;;;AAwBA,MAAM,qBAAkC;CACvC,OAAO;CACP,UAAU;CACV,qBAAqB;AACtB;AAEA,MAAM,cAAc,OAAO,GAAG,UAAU,YAAY;AACpD,MAAM,aAAa,OAAO,GAAG,U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CAAC,CAAC;EAC/F,OAAO,OAAO,QAAQ,KAAK,OAAO,QAAQ,QAAQ,MAAM,eAAe,MAAM,CAAC,CAAC,CAAC;CACjF,CACoB,CAAC,CAAC,KACrB,OAAO,QACP,OAAO,OAAO,UACb,WAAW,YAAY,KAAK,CAAC,CAAC,CAAC,KAC9B,OAAO,QACN,OAAO,WAAW;EACjB,QAAQ,WAAW;CACpB,CAAC,CACF,CACD,CACD,CACD;AACD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
2
|
import { Model } from "@codeworksh/aikit";
|
|
3
|
-
import { Argument, Command, Flag } from "effect/
|
|
3
|
+
import { Argument, Command, Flag } from "effect/cli";
|
|
4
4
|
//#region src/framework/spec.ts
|
|
5
5
|
function make(name, options = {}) {
|
|
6
6
|
let spec = Command.make(name, options.params ?? {}).pipe(Command.withSharedFlags(options.shared ?? {}));
|
|
@@ -304,6 +304,13 @@ const Cmd = make("codework", {
|
|
|
304
304
|
description: "Download the catalog now"
|
|
305
305
|
}]
|
|
306
306
|
})]
|
|
307
|
+
}),
|
|
308
|
+
make("acp", {
|
|
309
|
+
description: "Start the CodeWork Agent Client Protocol (ACP) server over stdio",
|
|
310
|
+
examples: [{
|
|
311
|
+
command: "codework acp",
|
|
312
|
+
description: "Start the ACP server on stdio"
|
|
313
|
+
}]
|
|
307
314
|
})
|
|
308
315
|
]
|
|
309
316
|
});
|
|
@@ -348,4 +355,4 @@ function provide(node, handlers) {
|
|
|
348
355
|
//#endregion
|
|
349
356
|
export { Cmd as i, handlers as n, run as r, handler as t };
|
|
350
357
|
|
|
351
|
-
//# sourceMappingURL=runtime-
|
|
358
|
+
//# sourceMappingURL=runtime-D4zyJPrh.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-D4zyJPrh.mjs","names":["Spec.make"],"sources":["../../src/framework/spec.ts","../../src/cli/cmd/cmd.ts","../../src/framework/runtime.ts"],"sourcesContent":["import { Command } from \"effect/cli\";\n\n/**\n * A declarative command tree. Specs carry only the shape of a command -- its\n * name, parameters, description, and children -- so the whole CLI surface can\n * be read in one file. Handlers are attached separately by {@link Runtime}, which\n * keeps their imports (and the harness they pull in) off the startup path.\n */\n\nexport interface Example {\n\treadonly command: string;\n\treadonly description: string;\n}\n\ninterface Options<\n\tConfig extends Command.Command.Config,\n\tShared extends Command.Command.FlagConfig,\n\tCommands extends ReadonlyArray<Any>,\n> {\n\treadonly description?: string;\n\treadonly params?: Config;\n\t/** Flags declared here are also parsed by every descendant command. */\n\treadonly shared?: Shared;\n\treadonly examples?: ReadonlyArray<Example>;\n\treadonly commands?: Commands;\n}\n\nexport interface Node<\n\tName extends string,\n\t// The tree is heterogeneous, so a node has to accept any command shape here.\n\t// Concrete types are recovered per-command through `Runtime.Input`.\n\t// biome-ignore lint/suspicious/noExplicitAny: heterogeneous command tree\n\tSpec extends Command.Command<Name, any, any, any, any>,\n\tCommands extends Children,\n> {\n\treadonly name: Name;\n\treadonly spec: Spec;\n\treadonly commands: Commands;\n}\n\n// The command name is invariant on `Command`, so the erased node type has to\n// admit any name for concrete nodes to be assignable to it.\n// biome-ignore lint/suspicious/noExplicitAny: heterogeneous command tree\nexport type Any = Node<string, Command.Command<any, any, any, any, any>, Children>;\nexport type Children = Readonly<Record<string, Any>>;\n\ntype ChildrenOf<Commands extends ReadonlyArray<Any>> = {\n\treadonly [Node in Commands[number] as Node[\"name\"]]: Node;\n};\n\nexport function make<\n\tconst Name extends string,\n\tconst Config extends Command.Command.Config = {},\n\tconst Shared extends Command.Command.FlagConfig = {},\n\tconst Commands extends ReadonlyArray<Any> = [],\n>(name: Name, options: Options<Config, Shared, Commands> = {}) {\n\tlet spec = Command.make(name, options.params ?? ({} as Config)).pipe(\n\t\tCommand.withSharedFlags(options.shared ?? ({} as Shared)),\n\t);\n\tif (options.description !== undefined) spec = spec.pipe(Command.withDescription(options.description));\n\tif (options.examples !== undefined) spec = spec.pipe(Command.withExamples(options.examples));\n\treturn {\n\t\tname,\n\t\tspec,\n\t\tcommands: Object.fromEntries(\n\t\t\t(options.commands ?? []).map((command) => [command.name, command]),\n\t\t) as ChildrenOf<Commands>,\n\t};\n}\n\nexport * as Spec from \"./spec.ts\";\n","import { Model } from \"@codeworksh/aikit\";\nimport { Schema } from \"effect\";\nimport { Argument, Flag } from \"effect/cli\";\nimport { Spec } from \"../../framework/spec.ts\";\n\n/**\n * The full command surface of the `codework` CLI. Declarations only -- each\n * command's behaviour lives in `./handlers`, wired up in `src/index.ts`.\n */\n\nexport const thinkingLevels = Object.values(Model.ThinkingLevelEnum);\n\n/**\n * Every `auth` subcommand answers the same three questions: which provider,\n * whose credentials, and where they live. Only `login` needs anything more.\n */\nconst AuthParams = {\n\topenaiCodex: Flag.Boolean(\"openai-codex\").pipe(\n\t\tFlag.withDescription(\"Use OpenAI Codex OAuth\"),\n\t\tFlag.withDefault(false),\n\t),\n\tgithubCopilot: Flag.Boolean(\"github-copilot\").pipe(\n\t\tFlag.withDescription(\"Use GitHub Copilot OAuth (device flow)\"),\n\t\tFlag.withDefault(false),\n\t),\n\tserver: Flag.String(\"server\").pipe(Flag.withDescription(\"RPC server URL (ws://host:port/rpc)\"), Flag.optional),\n\tauthFile: Flag.String(\"auth-file\").pipe(\n\t\tFlag.withDescription(\"Credential file (defaults to <home>/aikit/auth.json)\"),\n\t\tFlag.optional,\n\t),\n};\n\nconst JsonFlag = Flag.Boolean(\"json\").pipe(\n\tFlag.withDescription(\"Print machine-readable output\"),\n\tFlag.withDefault(false),\n);\n\nexport const Cmd = Spec.make(\"codework\", {\n\tdescription: \"CodeWork Command Line Interface\",\n\tshared: {\n\t\tuserConfigDir: Flag.String(\"user-config-dir\").pipe(\n\t\t\tFlag.withDescription(\"Directory whose settings.jsonc replaces the user settings in --home\"),\n\t\t\tFlag.optional,\n\t\t),\n\t\thome: Flag.String(\"home\").pipe(\n\t\t\tFlag.withDescription(\"CodeWork home: user settings, credentials, cache and data (default: ~/.codework)\"),\n\t\t\tFlag.optional,\n\t\t),\n\t\tdatabase: Flag.String(\"database\").pipe(Flag.withDescription(\"SQLite database path or :memory:\"), Flag.optional),\n\t},\n\tcommands: [\n\t\tSpec.make(\"auth\", {\n\t\t\tdescription: \"Manage OAuth credentials\",\n\t\t\tcommands: [\n\t\t\t\tSpec.make(\"login\", {\n\t\t\t\t\tdescription: \"Sign in to a provider\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\t...AuthParams,\n\t\t\t\t\t\tbrowser: Flag.Boolean(\"browser\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Open the authorization URL in the default browser\"),\n\t\t\t\t\t\t\tFlag.withDefault(true),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdevice: Flag.Boolean(\"device\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Use the device-code flow instead of a localhost browser callback\"),\n\t\t\t\t\t\t\tFlag.withDefault(false),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tenterprise: Flag.String(\"enterprise\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"GitHub Enterprise domain for GitHub Copilot login\"),\n\t\t\t\t\t\t\tFlag.optional,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tenableModels: Flag.Boolean(\"enable-models\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Enable unconfigured Copilot catalog models after login\"),\n\t\t\t\t\t\t\tFlag.withDefault(false),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tjson: JsonFlag,\n\t\t\t\t\t},\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t{ command: \"codework auth login --openai-codex\", description: \"Sign in with ChatGPT\" },\n\t\t\t\t\t\t{ command: \"codework auth login --github-copilot\", description: \"Sign in with GitHub Copilot\" },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework auth login --openai-codex --device\",\n\t\t\t\t\t\t\tdescription: \"Sign in with a device code, no local port\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework auth login --openai-codex --server ws://127.0.0.1:7433/rpc\",\n\t\t\t\t\t\t\tdescription: \"Sign in the running server\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"status\", {\n\t\t\t\t\tdescription: \"Show a stored login without refreshing it\",\n\t\t\t\t\tparams: { ...AuthParams, json: JsonFlag },\n\t\t\t\t\texamples: [{ command: \"codework auth status --openai-codex\", description: \"Show the stored login\" }],\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"refresh\", {\n\t\t\t\t\tdescription: \"Refresh a stored login if it has expired\",\n\t\t\t\t\tparams: { ...AuthParams, json: JsonFlag },\n\t\t\t\t\texamples: [{ command: \"codework auth refresh --openai-codex\", description: \"Renew an expired login\" }],\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"logout\", {\n\t\t\t\t\tdescription: \"Clear a stored login\",\n\t\t\t\t\tparams: AuthParams,\n\t\t\t\t\texamples: [{ command: \"codework auth logout --github-copilot\", description: \"Clear the stored login\" }],\n\t\t\t\t}),\n\t\t\t],\n\t\t}),\n\t\tSpec.make(\"run\", {\n\t\t\tdescription: \"Start or continue an agent session\",\n\t\t\tparams: {\n\t\t\t\tserver: Flag.String(\"server\").pipe(\n\t\t\t\t\tFlag.withDescription(\"RPC server URL (ws://host:port/rpc)\"),\n\t\t\t\t\tFlag.optional,\n\t\t\t\t),\n\t\t\t\tprompt: Argument.String(\"prompt\").pipe(Argument.withDescription(\"Prompt for the agent\")),\n\t\t\t\tsession: Flag.String(\"session\").pipe(\n\t\t\t\t\tFlag.withAlias(\"s\"),\n\t\t\t\t\tFlag.withDescription(\"Continue an existing session\"),\n\t\t\t\t\tFlag.optional,\n\t\t\t\t),\n\t\t\t\tcwd: Flag.String(\"cwd\").pipe(\n\t\t\t\t\tFlag.withAlias(\"C\"),\n\t\t\t\t\tFlag.withDescription(\"Working directory for a new session\"),\n\t\t\t\t\tFlag.optional,\n\t\t\t\t),\n\t\t\t\tsandboxDriver: Flag.String(\"sandbox-driver\").pipe(\n\t\t\t\t\tFlag.withDescription(\"Sandbox driver for a new session (default: local)\"),\n\t\t\t\t\tFlag.optional,\n\t\t\t\t),\n\t\t\t\tsandboxId: Flag.String(\"sandbox-id\").pipe(\n\t\t\t\t\tFlag.withDescription(\"Reuse an existing sandbox instance\"),\n\t\t\t\t\tFlag.optional,\n\t\t\t\t),\n\t\t\t\tsandboxProviderId: Flag.String(\"sandbox-provider-id\").pipe(\n\t\t\t\t\tFlag.withDescription(\"Provider ID of an existing remote sandbox\"),\n\t\t\t\t\tFlag.optional,\n\t\t\t\t),\n\t\t\t\tprovider: Flag.String(\"provider\").pipe(Flag.withDescription(\"Model catalog provider ID\"), Flag.optional),\n\t\t\t\tmodel: Flag.String(\"model\").pipe(Flag.withDescription(\"Model ID\"), Flag.optional),\n\t\t\t\tthinking: Flag.Literals(\"thinking\", thinkingLevels).pipe(\n\t\t\t\t\tFlag.withDescription(\"Reasoning effort the model uses before answering\"),\n\t\t\t\t\tFlag.optional,\n\t\t\t\t),\n\t\t\t},\n\t\t\texamples: [\n\t\t\t\t{ command: 'codework run \"Inspect the failing tests\"', description: \"Create a session\" },\n\t\t\t\t{\n\t\t\t\t\tcommand: 'codework run --provider openai --model gpt-5.5 --thinking high \"Inspect the failing tests\"',\n\t\t\t\t\tdescription: \"Create a session with an explicit model\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcommand: 'codework run --sandbox-driver daytona \"Inspect the repository\"',\n\t\t\t\t\tdescription: \"Create a Daytona sandbox and session\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcommand: 'codework run --sandbox-driver daytona --sandbox-provider-id <id> \"Inspect the repository\"',\n\t\t\t\t\tdescription: \"Use an existing remote sandbox\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcommand: 'codework run --session <id> --provider openai --model gpt-5.6-luna \"Now fix them\"',\n\t\t\t\t\tdescription: \"Continue a session with explicit model bindings\",\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t\tSpec.make(\"serve\", {\n\t\t\tdescription: \"Start the CodeWork RPC server\",\n\t\t\tparams: {\n\t\t\t\thost: Flag.String(\"host\").pipe(\n\t\t\t\t\tFlag.withDescription(\"Host interface to bind\"),\n\t\t\t\t\tFlag.withDefault(\"127.0.0.1\"),\n\t\t\t\t),\n\t\t\t\tport: Flag.Int(\"port\").pipe(\n\t\t\t\t\tFlag.withSchema(Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 65535 }))),\n\t\t\t\t\tFlag.withDescription(\"Port to listen on (0 for an ephemeral port)\"),\n\t\t\t\t\tFlag.withDefault(7433),\n\t\t\t\t),\n\t\t\t},\n\t\t\texamples: [\n\t\t\t\t{ command: \"codework serve\", description: \"Start the RPC server on 127.0.0.1:7433\" },\n\t\t\t\t{ command: \"codework serve --port 0\", description: \"Choose an available local port\" },\n\t\t\t],\n\t\t}),\n\t\tSpec.make(\"session\", {\n\t\t\tdescription: \"Manage sessions\",\n\t\t\tcommands: [\n\t\t\t\tSpec.make(\"link\", {\n\t\t\t\t\tdescription: \"Anchor a session to a host directory\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tsession: Argument.String(\"session-id\").pipe(Argument.withDescription(\"The session to link\")),\n\t\t\t\t\t\tpath: Argument.String(\"path\").pipe(\n\t\t\t\t\t\t\t// The anchor is not a configuration mechanism, but `.codework` is the landmark\n\t\t\t\t\t\t\t// a person recognises, so the help names it to make the directory concrete.\n\t\t\t\t\t\t\tArgument.withDescription(\n\t\t\t\t\t\t\t\t\"Host directory to anchor to — typically the directory holding your .codework configuration; defaults to the shell's\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tArgument.optional,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tunlink: Flag.Boolean(\"unlink\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Clear the anchor, leaving the session with no host directory\"),\n\t\t\t\t\t\t\tFlag.withDefault(false),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tserver: Flag.String(\"server\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Base URL of the running codework server\"),\n\t\t\t\t\t\t\tFlag.withDefault(\"http://127.0.0.1:7433\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework session link ses_01h9\",\n\t\t\t\t\t\t\tdescription: \"Link it to the directory you are standing in\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework session link ses_01h9 ~/work/api\",\n\t\t\t\t\t\t\tdescription: \"Link it to a project elsewhere on this machine\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework session link ses_01h9 --unlink\",\n\t\t\t\t\t\t\tdescription: \"Clear the anchor\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t],\n\t\t}),\n\t\tSpec.make(\"plugin\", {\n\t\t\tdescription: \"Manage plugins\",\n\t\t\tcommands: [\n\t\t\t\tSpec.make(\"add\", {\n\t\t\t\t\tdescription: \"Install a plugin and add it to a settings file\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tpackage: Argument.String(\"package\").pipe(\n\t\t\t\t\t\t\tArgument.withDescription(\"Package spec, path, or file: URL\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tglobal: Flag.Boolean(\"global\").pipe(\n\t\t\t\t\t\t\tFlag.withAlias(\"g\"),\n\t\t\t\t\t\t\tFlag.withDescription(\"Write the user-wide settings file instead of this project's\"),\n\t\t\t\t\t\t\tFlag.withDefault(false),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tsession: Flag.String(\"session\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Write the project a session is linked to, rather than this directory's\"),\n\t\t\t\t\t\t\tFlag.optional,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework plugin add @acme/codework-tool-proc@1.2.0\",\n\t\t\t\t\t\t\tdescription: \"Install a published plugin into this project's settings\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework plugin add @acme/codework-tool-proc --session ses_01h9\",\n\t\t\t\t\t\t\tdescription: \"Write the project that session is linked to, from anywhere\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework plugin add @acme/codework-tool-proc -g\",\n\t\t\t\t\t\t\tdescription: \"Install it for every project this user runs\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"install\", {\n\t\t\t\t\tdescription: \"Install every plugin the settings files name\",\n\t\t\t\t\tparams: {},\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework plugin install\",\n\t\t\t\t\t\t\tdescription: \"Materialise what a fresh checkout already declares\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"list\", {\n\t\t\t\t\tdescription: \"List configured plugins and what each one resolved to\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tverbose: Flag.Boolean(\"verbose\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Show the message behind a failure, not only its reason\"),\n\t\t\t\t\t\t\tFlag.withDefault(false),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texamples: [{ command: \"codework plugin list\", description: \"Show every configured plugin\" }],\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"check\", {\n\t\t\t\t\tdescription: \"Report which configured plugins have a newer revision available\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tspec: Argument.String(\"spec\").pipe(\n\t\t\t\t\t\t\tArgument.withDescription(\"Only this configured plugin: a package name or spec, git spec, or path\"),\n\t\t\t\t\t\t\tArgument.optional,\n\t\t\t\t\t\t),\n\t\t\t\t\t\t// An answer is reused for an hour, which is right for a command someone may\n\t\t\t\t\t\t// run repeatedly and wrong for the minute after they pushed a plugin. Without\n\t\t\t\t\t\t// this there is no way to say \"ask again\", and `check` reports a moving branch\n\t\t\t\t\t\t// as current while `update` — which always refreshes — moves it.\n\t\t\t\t\t\trefresh: Flag.Boolean(\"refresh\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Ask the remote again instead of reusing a recent answer\"),\n\t\t\t\t\t\t\tFlag.withDefault(false),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t{ command: \"codework plugin check\", description: \"Ask the registry what has moved\" },\n\t\t\t\t\t\t{ command: \"codework plugin check @acme/codework-tool-proc\", description: \"Ask about one plugin\" },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework plugin check --refresh\",\n\t\t\t\t\t\t\tdescription: \"Ignore the cached answer, after pushing a plugin\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"update\", {\n\t\t\t\t\tdescription: \"Fetch a newer revision of every plugin that has one\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tspec: Argument.String(\"spec\").pipe(\n\t\t\t\t\t\t\tArgument.withDescription(\"Only this configured plugin: a package name or spec, git spec, or path\"),\n\t\t\t\t\t\t\tArgument.optional,\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t{ command: \"codework plugin update\", description: \"Take whatever `check` found\" },\n\t\t\t\t\t\t{ command: \"codework plugin update @acme/codework-tool-proc\", description: \"Update one plugin\" },\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"reload\", {\n\t\t\t\t\tdescription: \"Re-import configured plugins in a running server\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tserver: Flag.String(\"server\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Base URL of the running codework server\"),\n\t\t\t\t\t\t\tFlag.withDefault(\"http://127.0.0.1:7433\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework plugin reload\",\n\t\t\t\t\t\t\tdescription: \"Pick up edits to a local plugin without restarting\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"remove\", {\n\t\t\t\t\tdescription: \"Remove a plugin from a settings file\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tpackage: Argument.String(\"package\").pipe(\n\t\t\t\t\t\t\tArgument.withDescription(\"Configured package spec, path, or plugin ID\"),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tglobal: Flag.Boolean(\"global\").pipe(\n\t\t\t\t\t\t\tFlag.withAlias(\"g\"),\n\t\t\t\t\t\t\tFlag.withDescription(\"Edit the user-wide settings file instead of this project's\"),\n\t\t\t\t\t\t\tFlag.withDefault(false),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"codework plugin remove @acme/codework-tool-proc\",\n\t\t\t\t\t\t\tdescription: \"Drop a plugin and any configuration written against it\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t],\n\t\t}),\n\t\tSpec.make(\"models\", {\n\t\t\tdescription: \"List or refresh the model catalog\",\n\t\t\tparams: {\n\t\t\t\tprovider: Flag.String(\"provider\").pipe(Flag.withDescription(\"Model catalog provider ID\"), Flag.optional),\n\t\t\t},\n\t\t\texamples: [\n\t\t\t\t{ command: \"codework models\", description: \"List all models from all providers\" },\n\t\t\t\t{\n\t\t\t\t\tcommand: \"codework models --provider openai\",\n\t\t\t\t\tdescription: \"List models for a specific provider\",\n\t\t\t\t},\n\t\t\t\t{ command: \"codework models providers\", description: \"List all available provider IDs\" },\n\t\t\t],\n\t\t\tcommands: [\n\t\t\t\tSpec.make(\"providers\", {\n\t\t\t\t\tdescription: \"List available model providers in the catalog\",\n\t\t\t\t}),\n\t\t\t\tSpec.make(\"refresh\", {\n\t\t\t\t\tdescription: \"Download the model catalog into the home if it is stale\",\n\t\t\t\t\tparams: {\n\t\t\t\t\t\tforce: Flag.Boolean(\"force\").pipe(\n\t\t\t\t\t\t\tFlag.withDescription(\"Download it even if it is still fresh\"),\n\t\t\t\t\t\t\tFlag.withDefault(false),\n\t\t\t\t\t\t),\n\t\t\t\t\t},\n\t\t\t\t\texamples: [\n\t\t\t\t\t\t{ command: \"codework models refresh\", description: \"Refresh a catalog older than 15 minutes\" },\n\t\t\t\t\t\t{ command: \"codework models refresh --force\", description: \"Download the catalog now\" },\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t],\n\t\t}),\n\t\tSpec.make(\"acp\", {\n\t\t\tdescription: \"Start the CodeWork Agent Client Protocol (ACP) server over stdio\",\n\t\t\texamples: [{ command: \"codework acp\", description: \"Start the ACP server on stdio\" }],\n\t\t}),\n\t],\n});\n","import { Effect } from \"effect\";\nimport { Command } from \"effect/cli\";\nimport type { CommandError } from \"../cli/error.ts\";\nimport { Spec } from \"./spec.ts\";\n\n/**\n * Binds handlers to a {@link Spec} tree. Handlers are loaded through dynamic\n * imports so that starting the process -- or printing `--help` -- never pulls in\n * the harness, its sandbox drivers, or the model catalog.\n */\n\n/** Recovers the parsed input type of a spec node, for typing its handler. */\nexport type Input<Value> =\n\tValue extends Spec.Node<infer _Name, infer Spec, infer _Commands>\n\t\t? Input<Spec>\n\t\t: Value extends Command.Command<infer _Name, infer Parsed, infer _Context, infer _Error, infer _Requirements>\n\t\t\t? Parsed\n\t\t\t: never;\n\n/**\n * A handler may yield an ancestor's spec to read its shared flags, which shows up\n * as a `CommandContext` requirement; `withSubcommands` discharges it when the tree\n * is assembled.\n */\ntype Requirements = Command.Environment | Command.CommandContext<string>;\ntype Run<Parsed> = (input: Parsed) => Effect.Effect<void, CommandError, Requirements>;\ntype Loader<Node extends Spec.Any> = () => Promise<{ readonly default: Run<Input<Node>> }>;\n\n/**\n * The handler registry for a spec tree: a loader per leaf, mirroring the shape of\n * the tree. A parent with children takes its own handler under `$`.\n */\nexport type Handlers<Node extends Spec.Any> = keyof Node[\"commands\"] extends never\n\t? Loader<Node>\n\t: { readonly $?: Loader<Node> } & { readonly [Key in keyof Node[\"commands\"]]: Handlers<Node[\"commands\"][Key]> };\n\ninterface LazyHandler {\n\treadonly spec: Command.Command.Any;\n\t// biome-ignore lint/suspicious/noExplicitAny: input is recovered per-command by `Input`\n\treadonly load: () => Promise<{ readonly default: Run<any> }>;\n}\n\ntype LazyHandlers = LazyHandler[\"load\"] | { readonly [key: string]: LazyHandlers | undefined };\n\ntype ProvidedCommand = Command.Command<string, unknown, unknown, CommandError, Command.Environment>;\n\n/** Type-checks a handler against the spec node it implements. */\nexport function handler<const Node extends Spec.Any>(_node: Node, run: Run<Input<Node>>) {\n\treturn run;\n}\n\nexport function handlers<const Root extends Spec.Any>(\n\troot: Root,\n\thandlers: Handlers<Root>,\n): ReadonlyArray<LazyHandler> {\n\tconst result: LazyHandler[] = [];\n\n\tfunction add(node: Spec.Any, value: LazyHandlers) {\n\t\tif (typeof value === \"function\") {\n\t\t\tresult.push({ spec: node.spec, load: value });\n\t\t\treturn;\n\t\t}\n\t\tif (value.$ !== undefined) result.push({ spec: node.spec, load: value.$ as LazyHandler[\"load\"] });\n\t\tfor (const [name, child] of Object.entries(node.commands)) {\n\t\t\tconst nested = value[name];\n\t\t\tif (nested !== undefined) add(child, nested);\n\t\t}\n\t}\n\n\tadd(root, handlers as LazyHandlers);\n\treturn result;\n}\n\nexport function run(root: Spec.Any, handlers: ReadonlyArray<LazyHandler>, options: { readonly version: string }) {\n\treturn Command.run(provide(root, handlers), options);\n}\n\nfunction provide(node: Spec.Any, handlers: ReadonlyArray<LazyHandler>): ProvidedCommand {\n\tconst found = handlers.find((entry) => entry.spec === node.spec);\n\tconst spec = found\n\t\t? node.spec.pipe(\n\t\t\t\tCommand.withHandler((input) =>\n\t\t\t\t\tEffect.promise(found.load).pipe(Effect.flatMap((module) => module.default(input))),\n\t\t\t\t),\n\t\t\t)\n\t\t: node.spec;\n\tconst children = Object.values(node.commands);\n\tif (children.length === 0) return spec as ProvidedCommand;\n\treturn spec.pipe(Command.withSubcommands(children.map((child) => provide(child, handlers)))) as ProvidedCommand;\n}\n\nexport * as Runtime from \"./runtime.ts\";\n"],"mappings":";;;;AAkDA,SAAgB,KAKd,MAAY,UAA6C,CAAC,GAAG;CAC9D,IAAI,OAAO,QAAQ,KAAK,MAAM,QAAQ,UAAW,CAAC,CAAY,CAAC,CAAC,KAC/D,QAAQ,gBAAgB,QAAQ,UAAW,CAAC,CAAY,CACzD;CACA,IAAI,QAAQ,gBAAgB,KAAA,GAAW,OAAO,KAAK,KAAK,QAAQ,gBAAgB,QAAQ,WAAW,CAAC;CACpG,IAAI,QAAQ,aAAa,KAAA,GAAW,OAAO,KAAK,KAAK,QAAQ,aAAa,QAAQ,QAAQ,CAAC;CAC3F,OAAO;EACN;EACA;EACA,UAAU,OAAO,aACf,QAAQ,YAAY,CAAC,EAAA,CAAG,KAAK,YAAY,CAAC,QAAQ,MAAM,OAAO,CAAC,CAClE;CACD;AACD;;;;;;;AC1DA,MAAa,iBAAiB,OAAO,OAAO,MAAM,iBAAiB;;;;;AAMnE,MAAM,aAAa;CAClB,aAAa,KAAK,QAAQ,cAAc,CAAC,CAAC,KACzC,KAAK,gBAAgB,wBAAwB,GAC7C,KAAK,YAAY,KAAK,CACvB;CACA,eAAe,KAAK,QAAQ,gBAAgB,CAAC,CAAC,KAC7C,KAAK,gBAAgB,wCAAwC,GAC7D,KAAK,YAAY,KAAK,CACvB;CACA,QAAQ,KAAK,OAAO,QAAQ,CAAC,CAAC,KAAK,KAAK,gBAAgB,qCAAqC,GAAG,KA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QAAQ,KAAK,CAAC,CAAC,CAClF,CACD,IACC,KAAK;CACR,MAAM,WAAW,OAAO,OAAO,KAAK,QAAQ;CAC5C,IAAI,SAAS,WAAW,GAAG,OAAO;CAClC,OAAO,KAAK,KAAK,QAAQ,gBAAgB,SAAS,KAAK,UAAU,QAAQ,OAAO,QAAQ,CAAC,CAAC,CAAC;AAC5F"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as harnessOptions } from "./harness-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-D4zyJPrh.mjs";
|
|
2
|
+
import { _ as Connected, g as OAuthError, h as Api, r as renderError, u as writeError, v as Core, y as encode } from "./error-C9ACQhhu.mjs";
|
|
3
|
+
import { t as harnessOptions } from "./harness-6d8TlAVk.mjs";
|
|
4
4
|
import { Cause, Context, Effect, Layer, Option, Queue, Stream } from "effect";
|
|
5
|
-
import {
|
|
5
|
+
import { Control, Event, EventRegistry, EventSchema, Global, Harness, PromptSchema, Sandbox, Session, SessionStore, State } from "@codeworksh/harness/effect";
|
|
6
6
|
import { NodeHttpServer } from "@effect/platform-node";
|
|
7
|
+
import { RpcSerialization, RpcServer } from "effect/rpc";
|
|
8
|
+
import { summarizeGitHubCopilot, summarizeOpenAICodex } from "@codeworksh/aikit/oauth/summary";
|
|
7
9
|
import { GitHubCopilotOAuthClient, JsonGitHubCopilotAuthStorage } from "@codeworksh/aikit/oauth/github/copilot";
|
|
8
10
|
import { JsonOpenAICodexAuthStorage, OpenAICodexOAuthClient } from "@codeworksh/aikit/oauth/openai/codex";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import * as NetAddress from "effect/unstable/net/NetAddress";
|
|
11
|
+
import { HttpRouter, HttpServer } from "effect/http";
|
|
12
|
+
import * as NetAddress from "effect/net/NetAddress";
|
|
12
13
|
import { createServer } from "node:http";
|
|
13
14
|
var Service$1 = class extends Context.Service()("@codeworksh/cli/server/feed/Service") {};
|
|
14
15
|
/**
|
|
@@ -38,7 +39,7 @@ const make = Effect.fn("EventFeed.make")(function* (listen, options) {
|
|
|
38
39
|
for (const subscriber of subscribers) {
|
|
39
40
|
if (Queue.offerUnsafe(subscriber, envelope)) continue;
|
|
40
41
|
subscribers.delete(subscriber);
|
|
41
|
-
Queue.failCauseUnsafe(subscriber, Cause.fail(new SubscriptionOverflowError({ capacity })));
|
|
42
|
+
Queue.failCauseUnsafe(subscriber, Cause.fail(new Event.SubscriptionOverflowError({ capacity })));
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
45
|
const publish = (event) => deliver(event).pipe(Effect.catchTags({
|
|
@@ -53,8 +54,8 @@ const make = Effect.fn("EventFeed.make")(function* (listen, options) {
|
|
|
53
54
|
return Service$1.of({ subscribe: Effect.acquireRelease(Queue.dropping(capacity).pipe(Effect.tap((queue) => Effect.sync(() => subscribers.add(queue)))), (queue) => Effect.sync(() => subscribers.delete(queue)).pipe(Effect.andThen(Queue.shutdown(queue)))).pipe(Effect.map(Stream.fromQueue)) });
|
|
54
55
|
});
|
|
55
56
|
const layer$3 = Layer.effect(Service$1, Effect.gen(function* () {
|
|
56
|
-
const events = yield* Service
|
|
57
|
-
const registered = yield* Service
|
|
57
|
+
const events = yield* Event.Service;
|
|
58
|
+
const registered = yield* EventRegistry.Service;
|
|
58
59
|
return yield* make(events.listen, { registry: registered.get });
|
|
59
60
|
}));
|
|
60
61
|
//#endregion
|
|
@@ -76,9 +77,9 @@ const message = (cause) => cause instanceof Error && cause.message.trim().length
|
|
|
76
77
|
const codexInfo = summarizeOpenAICodex;
|
|
77
78
|
const copilotInfo = summarizeGitHubCopilot;
|
|
78
79
|
const layer$2 = (options = {}) => Layer.effect(Service, Effect.gen(function* () {
|
|
79
|
-
const global = yield* Service
|
|
80
|
-
const authFile
|
|
81
|
-
const file = authFile
|
|
80
|
+
const global = yield* Global.Service;
|
|
81
|
+
const authFile = Global.authFile(options.home === void 0 ? void 0 : global.home);
|
|
82
|
+
const file = authFile === void 0 ? {} : { path: authFile };
|
|
82
83
|
const codex = new OpenAICodexOAuthClient({ storage: new JsonOpenAICodexAuthStorage(file) });
|
|
83
84
|
const copilot = new GitHubCopilotOAuthClient({ storage: new JsonGitHubCopilotAuthStorage(file) });
|
|
84
85
|
const attempt = (run) => Effect.tryPromise({
|
|
@@ -138,16 +139,16 @@ const runtimeInput = (runtime) => ({
|
|
|
138
139
|
...runtime?.thinkingLevel === void 0 ? {} : { thinkingLevel: runtime.thinkingLevel }
|
|
139
140
|
});
|
|
140
141
|
const sessionInfo = Effect.fn("Server.sessionInfo")(function* (sessionId) {
|
|
141
|
-
const found = yield* get(sessionId);
|
|
142
|
-
if (Option.isNone(found)) return yield* new SessionNotFoundError({ sessionId });
|
|
142
|
+
const found = yield* Session.get(sessionId);
|
|
143
|
+
if (Option.isNone(found)) return yield* new SessionStore.SessionNotFoundError({ sessionId });
|
|
143
144
|
return toSessionInfo(yield* found.value.info);
|
|
144
145
|
});
|
|
145
|
-
const releaseOnFailure = (selection) => selection?.created && selection.info !== void 0 ? stop(selection.info.id).pipe(Effect.catchCause(Effect.logError)) : Effect.void;
|
|
146
|
+
const releaseOnFailure = (selection) => selection?.created && selection.info !== void 0 ? Sandbox.stop(selection.info.id).pipe(Effect.catchCause(Effect.logError)) : Effect.void;
|
|
146
147
|
const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
147
|
-
const control = yield* Service
|
|
148
|
+
const control = yield* Control.Service;
|
|
148
149
|
const feed = yield* Service$1;
|
|
149
|
-
const sessions = yield* Service
|
|
150
|
-
const state = yield* Service
|
|
150
|
+
const sessions = yield* SessionStore.Service;
|
|
151
|
+
const state = yield* State.Service;
|
|
151
152
|
const oauth = yield* Service;
|
|
152
153
|
return Api.of({
|
|
153
154
|
"auth.save": ({ credentials }) => oauth.save(credentials),
|
|
@@ -155,9 +156,9 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
155
156
|
"auth.refresh": ({ provider }) => oauth.refresh(provider),
|
|
156
157
|
"auth.logout": ({ provider }) => oauth.logout(provider),
|
|
157
158
|
"session.create": Effect.fnUntraced(function* ({ title, directory, hostDir, sandbox, runtime }) {
|
|
158
|
-
const selection = sandbox === void 0 ? void 0 : yield* resolve(sandbox);
|
|
159
|
+
const selection = sandbox === void 0 ? void 0 : yield* Sandbox.resolve(sandbox);
|
|
159
160
|
const selected = selection?.info;
|
|
160
|
-
const handle = yield* create({
|
|
161
|
+
const handle = yield* Session.create({
|
|
161
162
|
...title === void 0 ? {} : { title },
|
|
162
163
|
...directory === void 0 ? {} : { directory },
|
|
163
164
|
...hostDir === void 0 ? {} : { hostDir },
|
|
@@ -174,7 +175,7 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
174
175
|
return yield* Effect.forEach(rows, (row) => sessionInfo(row.id).pipe(Effect.orDie));
|
|
175
176
|
}),
|
|
176
177
|
"session.configure": Effect.fnUntraced(function* ({ sessionId, runtime }) {
|
|
177
|
-
const handle = yield* attach({
|
|
178
|
+
const handle = yield* Session.attach({
|
|
178
179
|
sessionId,
|
|
179
180
|
...runtimeInput(runtime)
|
|
180
181
|
});
|
|
@@ -184,16 +185,16 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
184
185
|
return yield* sessionInfo(sessionId);
|
|
185
186
|
}),
|
|
186
187
|
"session.link": Effect.fnUntraced(function* ({ sessionId, hostDir }) {
|
|
187
|
-
const handle = yield* link({
|
|
188
|
+
const handle = yield* Session.link({
|
|
188
189
|
sessionId,
|
|
189
190
|
hostDir: hostDir ?? null
|
|
190
191
|
});
|
|
191
192
|
return toSessionInfo(yield* handle.info);
|
|
192
193
|
}),
|
|
193
194
|
"session.relink": Effect.fnUntraced(function* ({ sessionId, sandbox, directory }) {
|
|
194
|
-
const selection = sandbox === void 0 ? void 0 : yield* resolve(sandbox);
|
|
195
|
+
const selection = sandbox === void 0 ? void 0 : yield* Sandbox.resolve(sandbox);
|
|
195
196
|
const selected = selection?.info;
|
|
196
|
-
const handle = yield* relink({
|
|
197
|
+
const handle = yield* Session.relink({
|
|
197
198
|
sessionId,
|
|
198
199
|
...selected === void 0 ? {} : { sandbox: selected },
|
|
199
200
|
...directory === void 0 ? {} : { directory }
|
|
@@ -203,7 +204,7 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
203
204
|
"session.prompt": Effect.fnUntraced(function* ({ sessionId, text, delivery, id }) {
|
|
204
205
|
yield* control.prompt({
|
|
205
206
|
sessionId,
|
|
206
|
-
prompt: Prompt.
|
|
207
|
+
prompt: PromptSchema.Prompt.fromText(text),
|
|
207
208
|
...delivery === void 0 ? {} : { delivery },
|
|
208
209
|
...id === void 0 ? {} : { id }
|
|
209
210
|
});
|
|
@@ -219,28 +220,28 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
219
220
|
yield* control.wait(sessionId);
|
|
220
221
|
}),
|
|
221
222
|
"sandbox.drivers": Effect.fnUntraced(function* () {
|
|
222
|
-
return (yield* drivers()).map(({ name, kind }) => ({
|
|
223
|
+
return (yield* Sandbox.drivers()).map(({ name, kind }) => ({
|
|
223
224
|
name,
|
|
224
225
|
kind
|
|
225
226
|
}));
|
|
226
227
|
}),
|
|
227
228
|
"sandbox.list": Effect.fnUntraced(function* () {
|
|
228
|
-
return (yield* list()).map(toSandboxInfo);
|
|
229
|
+
return (yield* Sandbox.list()).map(toSandboxInfo);
|
|
229
230
|
}),
|
|
230
231
|
"sandbox.create": Effect.fnUntraced(function* ({ driver }) {
|
|
231
|
-
return toSandboxInfo(yield* create
|
|
232
|
+
return toSandboxInfo(yield* Sandbox.create({ driver }));
|
|
232
233
|
}),
|
|
233
234
|
"sandbox.register": Effect.fnUntraced(function* ({ driver, providerResourceId }) {
|
|
234
|
-
return toSandboxInfo(yield* register({
|
|
235
|
+
return toSandboxInfo(yield* Sandbox.register({
|
|
235
236
|
driver,
|
|
236
237
|
providerResourceId
|
|
237
238
|
}));
|
|
238
239
|
}),
|
|
239
240
|
"sandbox.stop": Effect.fnUntraced(function* ({ sandboxId }) {
|
|
240
|
-
yield* stop(sandboxId);
|
|
241
|
+
yield* Sandbox.stop(sandboxId);
|
|
241
242
|
}),
|
|
242
243
|
"event.subscribe": () => Stream.unwrap(feed.subscribe.pipe(Effect.map((events) => Stream.make({
|
|
243
|
-
id:
|
|
244
|
+
id: EventSchema.ID.create(),
|
|
244
245
|
type: Connected.type,
|
|
245
246
|
data: {}
|
|
246
247
|
}).pipe(Stream.concat(events)))))
|
|
@@ -248,9 +249,8 @@ const layer$1 = Api.toLayer(Effect.gen(function* () {
|
|
|
248
249
|
}));
|
|
249
250
|
//#endregion
|
|
250
251
|
//#region src/server/server.ts
|
|
251
|
-
const WsProtocol = RpcServer.layerProtocolWebsocket({ path: "/rpc" }).pipe(Layer.provide(HttpRouter.layer));
|
|
252
252
|
const managedShutdown = Layer.unwrap(Effect.gen(function* () {
|
|
253
|
-
const control = yield* Service
|
|
253
|
+
const control = yield* Control.Service;
|
|
254
254
|
yield* Effect.addFinalizer(() => Effect.gen(function* () {
|
|
255
255
|
yield* Effect.forEach(yield* control.active, (id) => control.interrupt(id, {
|
|
256
256
|
reason: "shutdown",
|
|
@@ -259,8 +259,8 @@ const managedShutdown = Layer.unwrap(Effect.gen(function* () {
|
|
|
259
259
|
concurrency: "unbounded",
|
|
260
260
|
discard: true
|
|
261
261
|
});
|
|
262
|
-
const infos = yield* list();
|
|
263
|
-
yield* Effect.forEach(infos.filter((info) => info.ownership === "managed"), (info) => stop(info.id).pipe(Effect.timeout("10 seconds"), Effect.catchCause((cause) => Effect.logError("Failed to stop managed sandbox during shutdown", cause).pipe(Effect.annotateLogs({ sandboxInstanceId: info.id })))), {
|
|
262
|
+
const infos = yield* Sandbox.list();
|
|
263
|
+
yield* Effect.forEach(infos.filter((info) => info.ownership === "managed"), (info) => Sandbox.stop(info.id).pipe(Effect.timeout("10 seconds"), Effect.catchCause((cause) => Effect.logError("Failed to stop managed sandbox during shutdown", cause).pipe(Effect.annotateLogs({ sandboxInstanceId: info.id })))), {
|
|
264
264
|
concurrency: "unbounded",
|
|
265
265
|
discard: true
|
|
266
266
|
});
|
|
@@ -273,10 +273,15 @@ const listenLog = Layer.unwrap(Effect.gen(function* () {
|
|
|
273
273
|
return Layer.empty;
|
|
274
274
|
}));
|
|
275
275
|
const layer = (options) => {
|
|
276
|
-
|
|
276
|
+
const rpc = RpcServer.layerHttp({
|
|
277
|
+
group: Api,
|
|
278
|
+
path: "/rpc",
|
|
279
|
+
protocol: "websocket"
|
|
280
|
+
}).pipe(Layer.provide(layer$1.pipe(Layer.provide(layer$3))));
|
|
281
|
+
return HttpRouter.serve(rpc, { disableListenLog: true }).pipe(Layer.provideMerge(managedShutdown), Layer.provide(layer$2(options.harness.home === void 0 ? {} : { home: options.harness.home }))).pipe(Layer.provideMerge(listenLog), Layer.provideMerge(NodeHttpServer.layer(createServer, {
|
|
277
282
|
host: options.host,
|
|
278
283
|
port: options.port
|
|
279
|
-
})), Layer.provide(RpcSerialization.layerNdjson), Layer.provide(layer
|
|
284
|
+
})), Layer.provide(RpcSerialization.layerNdjson), Layer.provide(Harness.layer(options.harness)));
|
|
280
285
|
};
|
|
281
286
|
//#endregion
|
|
282
287
|
//#region src/cli/cmd/handlers/serve.ts
|
|
@@ -296,4 +301,4 @@ var serve_default = handler(Cmd.commands.serve, Effect.fn("CLI.serve")(function*
|
|
|
296
301
|
//#endregion
|
|
297
302
|
export { serve_default as default };
|
|
298
303
|
|
|
299
|
-
//# sourceMappingURL=serve-
|
|
304
|
+
//# sourceMappingURL=serve-gOODO9pv.mjs.map
|