@codeworksh/cli 0.5.0-canary.69.1.g5be1ef81 → 0.5.0-canary.71.1.g8233e4eb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -2
- package/{acp-BCeZqkaQ.mjs → acp-BTtByOlX.mjs} +92 -42
- package/acp-BTtByOlX.mjs.map +1 -0
- package/{add-Dzsv-fKd.mjs → add-Dm3RaxB1.mjs} +5 -5
- package/add-Dm3RaxB1.mjs.map +1 -0
- package/{catalog-C1G3pzHZ.mjs → catalog-Do2eDgti.mjs} +2 -2
- package/{catalog-C1G3pzHZ.mjs.map → catalog-Do2eDgti.mjs.map} +1 -1
- package/{check-DhojkK_E.mjs → check-BdfxwBaL.mjs} +4 -4
- package/{check-DhojkK_E.mjs.map → check-BdfxwBaL.mjs.map} +1 -1
- package/{entries-KpYvZdpi.mjs → entries-C6AeEOS1.mjs} +3 -3
- package/{entries-KpYvZdpi.mjs.map → entries-C6AeEOS1.mjs.map} +1 -1
- package/{error-BMI81XvR.mjs → error-CSeYCa9R.mjs} +195 -89
- package/error-CSeYCa9R.mjs.map +1 -0
- package/fork-CAu8PdA3.mjs +32 -0
- package/fork-CAu8PdA3.mjs.map +1 -0
- package/{identity-BfTAc3aC.mjs → identity-CpsvMaTx.mjs} +2 -2
- package/{identity-BfTAc3aC.mjs.map → identity-CpsvMaTx.mjs.map} +1 -1
- package/index.mjs +32 -25
- package/index.mjs.map +1 -1
- package/{install-BLRDBzp1.mjs → install-D5kkATcv.mjs} +4 -4
- package/{install-BLRDBzp1.mjs.map → install-D5kkATcv.mjs.map} +1 -1
- package/{link--UnM2qnT.mjs → link-CsfmcRa8.mjs} +3 -3
- package/{link--UnM2qnT.mjs.map → link-CsfmcRa8.mjs.map} +1 -1
- package/list-C60d6ifJ.mjs +36 -0
- package/list-C60d6ifJ.mjs.map +1 -0
- package/{list-9fVqelid.mjs → list-CHIzxyZx.mjs} +4 -4
- package/{list-9fVqelid.mjs.map → list-CHIzxyZx.mjs.map} +1 -1
- package/{list-BE4xSEe3.mjs → list-CakHFl9C.mjs} +4 -4
- package/{list-BE4xSEe3.mjs.map → list-CakHFl9C.mjs.map} +1 -1
- package/{login-CRwxi5WD.mjs → login-BaUYCO2G.mjs} +4 -4
- package/{login-CRwxi5WD.mjs.map → login-BaUYCO2G.mjs.map} +1 -1
- package/{logout-C89X0B9M.mjs → logout-BAks2xS7.mjs} +4 -4
- package/{logout-C89X0B9M.mjs.map → logout-BAks2xS7.mjs.map} +1 -1
- package/package-CmagAGZz.mjs +6 -0
- package/package-CmagAGZz.mjs.map +1 -0
- package/package.json +4 -4
- package/{providers-BrXJvY2P.mjs → providers-DVh6hhLU.mjs} +4 -4
- package/{providers-BrXJvY2P.mjs.map → providers-DVh6hhLU.mjs.map} +1 -1
- package/{refresh-D0wBP2Go.mjs → refresh-CNQBX5NK.mjs} +4 -4
- package/{refresh-D0wBP2Go.mjs.map → refresh-CNQBX5NK.mjs.map} +1 -1
- package/{refresh--j0Pj4Cw.mjs → refresh-tj3xbNRY.mjs} +4 -4
- package/{refresh--j0Pj4Cw.mjs.map → refresh-tj3xbNRY.mjs.map} +1 -1
- package/relink-BlRMYOra.mjs +23 -0
- package/relink-BlRMYOra.mjs.map +1 -0
- package/{reload-DgPawyzr.mjs → reload-h_2WARQN.mjs} +3 -3
- package/{reload-DgPawyzr.mjs.map → reload-h_2WARQN.mjs.map} +1 -1
- package/{remove-DfFme5w2.mjs → remove-CVbXLNTb.mjs} +4 -4
- package/{remove-DfFme5w2.mjs.map → remove-CVbXLNTb.mjs.map} +1 -1
- package/{restart-JPAbjFUh.mjs → restart-B0XSXYtj.mjs} +4 -4
- package/{restart-JPAbjFUh.mjs.map → restart-B0XSXYtj.mjs.map} +1 -1
- package/{run-CVRkm_Iz.mjs → run-CRV3jJ2d.mjs} +26 -17
- package/run-CRV3jJ2d.mjs.map +1 -0
- package/{runtime-B43doHjV.mjs → runtime-Bg4mc9BB.mjs} +59 -3
- package/runtime-Bg4mc9BB.mjs.map +1 -0
- package/{serve-DT8-nVCx.mjs → serve-XrW3PuIZ.mjs} +101 -73
- package/serve-XrW3PuIZ.mjs.map +1 -0
- package/{service-Cv-MLS-9.mjs → service-D_vwPPPh.mjs} +3 -3
- package/{service-Cv-MLS-9.mjs.map → service-D_vwPPPh.mjs.map} +1 -1
- package/{settings-BfmoL27m.mjs → settings-DcwstDUm.mjs} +2 -2
- package/{settings-BfmoL27m.mjs.map → settings-DcwstDUm.mjs.map} +1 -1
- package/{shared-CnuCjvcG.mjs → shared-D_3E8bu_.mjs} +3 -3
- package/{shared-CnuCjvcG.mjs.map → shared-D_3E8bu_.mjs.map} +1 -1
- package/{start-Qb1Ea9oT.mjs → start-CJ4XeLwV.mjs} +4 -4
- package/{start-Qb1Ea9oT.mjs.map → start-CJ4XeLwV.mjs.map} +1 -1
- package/{status-VGKqsdkQ.mjs → status-6NyZu0f_.mjs} +4 -4
- package/{status-VGKqsdkQ.mjs.map → status-6NyZu0f_.mjs.map} +1 -1
- package/{status-DVzFDoek.mjs → status-DBzQVkL2.mjs} +4 -4
- package/{status-DVzFDoek.mjs.map → status-DBzQVkL2.mjs.map} +1 -1
- package/{stop-mO7eg0nG.mjs → stop-BY1c7cUX.mjs} +4 -4
- package/{stop-mO7eg0nG.mjs.map → stop-BY1c7cUX.mjs.map} +1 -1
- package/thread-CEYjLavT.mjs +15 -0
- package/thread-CEYjLavT.mjs.map +1 -0
- package/{tui-DVVaevMF.mjs → tui-CBUtCHzR.mjs} +5 -5
- package/{tui-DVVaevMF.mjs.map → tui-CBUtCHzR.mjs.map} +1 -1
- package/{update-D0XPVfJu.mjs → update-CORsF38E.mjs} +4 -4
- package/{update-D0XPVfJu.mjs.map → update-CORsF38E.mjs.map} +1 -1
- package/acp-BCeZqkaQ.mjs.map +0 -1
- package/add-Dzsv-fKd.mjs.map +0 -1
- package/error-BMI81XvR.mjs.map +0 -1
- package/package-D9XCaBr1.mjs +0 -6
- package/package-D9XCaBr1.mjs.map +0 -1
- package/run-CVRkm_Iz.mjs.map +0 -1
- package/runtime-B43doHjV.mjs.map +0 -1
- package/serve-DT8-nVCx.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-
|
|
1
|
+
{"version":3,"file":"login-BaUYCO2G.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 { 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
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import { i as reportFailure,
|
|
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-Bg4mc9BB.mjs";
|
|
2
|
+
import { i as reportFailure, m as make, u as writeError } from "./error-CSeYCa9R.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-D_3E8bu_.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-BAks2xS7.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout-
|
|
1
|
+
{"version":3,"file":"logout-BAks2xS7.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 { 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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-CmagAGZz.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.5.0-canary.
|
|
3
|
+
"version": "0.5.0-canary.71.1.g8233e4eb",
|
|
4
4
|
"description": "CLI for running CodeWork coding agent harness.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@agentclientprotocol/sdk": "1.5.1",
|
|
43
|
-
"@codeworksh/aikit": "0.12.1-canary.
|
|
44
|
-
"@codeworksh/harness": "0.5.0-canary.
|
|
45
|
-
"@codeworksh/tui": "0.1.0-canary.
|
|
43
|
+
"@codeworksh/aikit": "0.12.1-canary.71.1.g8233e4eb",
|
|
44
|
+
"@codeworksh/harness": "0.5.0-canary.71.1.g8233e4eb",
|
|
45
|
+
"@codeworksh/tui": "0.1.0-canary.71.1.g8233e4eb",
|
|
46
46
|
"@effect/platform-node": "4.0.5",
|
|
47
47
|
"@effect/platform-node-shared": "4.0.5",
|
|
48
48
|
"effect": "4.0.5",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { n as synced } from "./catalog-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-Bg4mc9BB.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-CSeYCa9R.mjs";
|
|
3
|
+
import { n as synced } from "./catalog-Do2eDgti.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { ModelCatalog } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/models/providers.ts
|
|
@@ -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-DVh6hhLU.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers-
|
|
1
|
+
{"version":3,"file":"providers-DVh6hhLU.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/models/providers.ts"],"sourcesContent":["import { ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect } from \"effect\";\nimport { 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
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
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-Bg4mc9BB.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, m as make, n as OAuthError, t as InvalidInputError, u as writeError } from "./error-CSeYCa9R.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-D_3E8bu_.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-CNQBX5NK.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-
|
|
1
|
+
{"version":3,"file":"refresh-CNQBX5NK.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,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { t as home } from "./catalog-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-Bg4mc9BB.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, u as writeError } from "./error-CSeYCa9R.mjs";
|
|
3
|
+
import { t as home } from "./catalog-Do2eDgti.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { ModelCatalog } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/models/refresh.ts
|
|
@@ -14,4 +14,4 @@ var refresh_default = handler(Cmd.commands.models.commands.refresh, Effect.fn("C
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { refresh_default as default };
|
|
16
16
|
|
|
17
|
-
//# sourceMappingURL=refresh
|
|
17
|
+
//# sourceMappingURL=refresh-tj3xbNRY.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh
|
|
1
|
+
{"version":3,"file":"refresh-tj3xbNRY.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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-Bg4mc9BB.mjs";
|
|
2
|
+
import { d as writeJson, f as writeOut, i as reportFailure, m as make, p as layer, v as ThreadInfo } from "./error-CSeYCa9R.mjs";
|
|
3
|
+
import { t as threadFlag } from "./thread-CEYjLavT.mjs";
|
|
4
|
+
import { Effect, Option } from "effect";
|
|
5
|
+
import { Sandbox, Session } from "@codeworksh/harness/effect";
|
|
6
|
+
//#region src/cli/cmd/handlers/session/relink.ts
|
|
7
|
+
var relink_default = handler(Cmd.commands.session.commands.relink, Effect.fn("CLI.session.relink")(function* ({ session, thread, directory, sandboxId, json, server }) {
|
|
8
|
+
return yield* Effect.gen(function* () {
|
|
9
|
+
const threadId = yield* threadFlag(thread);
|
|
10
|
+
const info = yield* (yield* make)["session.relink"]({
|
|
11
|
+
sessionId: Session.SessionSchema.ID.make(session),
|
|
12
|
+
...threadId === void 0 ? {} : { threadId },
|
|
13
|
+
...Option.isNone(sandboxId) ? {} : { sandbox: { id: Sandbox.SandboxInstance.ID.make(sandboxId.value) } },
|
|
14
|
+
...Option.isNone(directory) ? {} : { directory: directory.value }
|
|
15
|
+
});
|
|
16
|
+
if (json) return yield* writeJson(ThreadInfo, info);
|
|
17
|
+
yield* writeOut(threadId === void 0 ? `Moved ${info.session.id} to ${info.session.directory}\n` : `Moved thread ${info.id} of ${info.session.id} to ${info.placement?.directory ?? info.session.directory}\n`);
|
|
18
|
+
}).pipe(Effect.provide(layer(server)), Effect.scoped, Effect.catch(reportFailure));
|
|
19
|
+
}));
|
|
20
|
+
//#endregion
|
|
21
|
+
export { relink_default as default };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=relink-BlRMYOra.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relink-BlRMYOra.mjs","names":["Runtime.handler","Client.make","Client.layer"],"sources":["../../src/cli/cmd/handlers/session/relink.ts"],"sourcesContent":["import { Sandbox, Session } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { Client } from \"../../../../server/client.ts\";\nimport { ThreadInfo } from \"../../../../server/contract.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeJson, writeOut } from \"../../../output.ts\";\nimport { threadFlag } from \"../../../thread.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.session.commands.relink,\n\tEffect.fn(\"CLI.session.relink\")(function* ({ session, thread, directory, sandboxId, json, server }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst threadId = yield* threadFlag(thread);\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst info = yield* rpc[\"session.relink\"]({\n\t\t\t\tsessionId: Session.SessionSchema.ID.make(session),\n\t\t\t\t...(threadId === undefined ? {} : { threadId }),\n\t\t\t\t...(Option.isNone(sandboxId) ? {} : { sandbox: { id: Sandbox.SandboxInstance.ID.make(sandboxId.value) } }),\n\t\t\t\t...(Option.isNone(directory) ? {} : { directory: directory.value }),\n\t\t\t});\n\t\t\tif (json) return yield* writeJson(ThreadInfo, info);\n\t\t\t// Without `--thread` the session's default moved; a thread with its own placement stays put.\n\t\t\tyield* writeOut(\n\t\t\t\tthreadId === undefined\n\t\t\t\t\t? `Moved ${info.session.id} to ${info.session.directory}\\n`\n\t\t\t\t\t: `Moved thread ${info.id} of ${info.session.id} to ${info.placement?.directory ?? info.session.directory}\\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":";;;;;;AAUA,IAAA,iBAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,QAC9B,OAAO,GAAG,oBAAoB,CAAC,CAAC,WAAW,EAAE,SAAS,QAAQ,WAAW,WAAW,MAAM,UAAU;CAmBnG,OAAO,OAlBS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,WAAW,MAAM;EAEzC,MAAM,OAAO,QAAO,OADDC,KAAAA,CACK,iBAAiB,CAAC;GACzC,WAAW,QAAQ,cAAc,GAAG,KAAK,OAAO;GAChD,GAAI,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS;GAC7C,GAAI,OAAO,OAAO,SAAS,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,QAAQ,gBAAgB,GAAG,KAAK,UAAU,KAAK,EAAE,EAAE;GACxG,GAAI,OAAO,OAAO,SAAS,IAAI,CAAC,IAAI,EAAE,WAAW,UAAU,MAAM;EAClE,CAAC;EACD,IAAI,MAAM,OAAO,OAAO,UAAU,YAAY,IAAI;EAElD,OAAO,SACN,aAAa,KAAA,IACV,SAAS,KAAK,QAAQ,GAAG,MAAM,KAAK,QAAQ,UAAU,MACtD,gBAAgB,KAAK,GAAG,MAAM,KAAK,QAAQ,GAAG,MAAM,KAAK,WAAW,aAAa,KAAK,QAAQ,UAAU,GAC5G;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
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-Bg4mc9BB.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure, m as make, p as layer } from "./error-CSeYCa9R.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-h_2WARQN.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reload-
|
|
1
|
+
{"version":3,"file":"reload-h_2WARQN.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,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
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-Bg4mc9BB.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-CSeYCa9R.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-DcwstDUm.mjs";
|
|
4
4
|
import { Effect, FileSystem, Option, Path } from "effect";
|
|
5
5
|
import { Global } from "@codeworksh/harness/effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/plugin/remove.ts
|
|
@@ -34,4 +34,4 @@ var remove_default = handler(Cmd.commands.plugin.commands.remove, Effect.fn("CLI
|
|
|
34
34
|
//#endregion
|
|
35
35
|
export { remove_default as default };
|
|
36
36
|
|
|
37
|
-
//# sourceMappingURL=remove-
|
|
37
|
+
//# sourceMappingURL=remove-CVbXLNTb.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove-
|
|
1
|
+
{"version":3,"file":"remove-CVbXLNTb.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 yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAgBA,IAAA,iBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,QAC7B,OAAO,GAAG,mBAAmB,CAAC,CAAC,WAAW,EAAE,SAAS,WAAW,QAAQ,YAAY;CAqCnF,OAAO,OApCS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,IAAI;EAC1B,MAAM,OAAO,OAAO,KAAK;EACzB,MAAM,KAAK,OAAO,WAAW;EAC7B,MAAM,QAAQ,OAAO,OAAO,QAAQ,OAAO,OAAO,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,OAAO,KAAK,MAAM,CAAC;EACjG,MAAM,SAAS,OAAO,cAAc,QAAQ,UAAU,KAAA,GAAW,KAAK;EAGtE,IAAI,EAAE,OAAO,GAAG,OAAO,KAAK,QAAQ,OAAO,IAAI,CAAC,IAAI;GACnD,OAAO,SAAS,WAAW,UAAU,yBAAyB,OAAO,KAAK,GAAG;GAC7E;EACD;EACA,MAAM,UAAU,OAAO,UAAU,WAAW,KAAK,QAAQ,GAAG,CAAC;EAC7D,OAAO,gBACN,OAAO,MACP,OAAO,IAAI,aAAa;GACvB,MAAM,EAAE,QAAQ,YAAY,OAAO,YAAY,OAAO,IAAI;GAI1D,MAAM,UAAU,OAAO,SAAS,SAAS,OAAO,MAAM,MAAM,KAAK;GACjE,MAAM,WAAW,SAAS,SAAS,OAAO;GAC1C,MAAM,OAAO,QAAQ,QAAQ,UAAU,CAAC,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,UAAU,MAAM,KAAK;GACvF,IAAI,KAAK,WAAW,QAAQ,QAAQ;IACnC,OAAO,SAAS,WAAW,UAAU,yBAAyB,OAAO,KAAK,GAAG;IAC7E;GACD;GACA,OAAO,aAAa,OAAO,MAAM,QAAQ,IAAI;GAC7C,MAAM,UAAU,QAAQ,SAAS,KAAK;GACtC,OAAO,SACN,WAAW,QAAQ,GAAG,YAAY,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,6 +1,6 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import {
|
|
3
|
-
import { i as ensure, n as options, o as stop } from "./service-
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-Bg4mc9BB.mjs";
|
|
2
|
+
import { f as writeOut, i as reportFailure } from "./error-CSeYCa9R.mjs";
|
|
3
|
+
import { i as ensure, n as options, o as stop } from "./service-D_vwPPPh.mjs";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
//#region src/cli/cmd/handlers/service/restart.ts
|
|
6
6
|
var restart_default = handler(Cmd.commands.service.commands.restart, Effect.fn("CLI.service.restart")(function* ({ host, port }) {
|
|
@@ -18,4 +18,4 @@ var restart_default = handler(Cmd.commands.service.commands.restart, Effect.fn("
|
|
|
18
18
|
//#endregion
|
|
19
19
|
export { restart_default as default };
|
|
20
20
|
|
|
21
|
-
//# sourceMappingURL=restart-
|
|
21
|
+
//# sourceMappingURL=restart-B0XSXYtj.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restart-
|
|
1
|
+
{"version":3,"file":"restart-B0XSXYtj.mjs","names":["Runtime.handler","options","Service.options","Discovery.stop","Discovery.ensure"],"sources":["../../src/cli/cmd/handlers/service/restart.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { Discovery } from \"../../../../server/discovery.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Service } from \"../../../service.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.service.commands.restart,\n\tEffect.fn(\"CLI.service.restart\")(function* ({ host, port }) {\n\t\tconst options = yield* Service.options(yield* Cmd.spec, { host, port });\n\t\tyield* Discovery.stop(options.home);\n\t\tconst server = yield* Discovery.ensure({ ...options, replace: true });\n\t\tyield* writeOut(`${server.url}\\n`);\n\t}, Effect.catch(reportFailure)),\n);\n"],"mappings":";;;;;AAQA,IAAA,kBAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,SAC9B,OAAO,GAAG,qBAAqB,CAAC,CAAC,WAAW,EAAE,MAAM,QAAQ;CAC3D,MAAMC,YAAU,OAAOC,QAAgB,OAAO,IAAI,MAAM;EAAE;EAAM;CAAK,CAAC;CACtE,OAAOC,KAAeF,UAAQ,IAAI;CAClC,MAAM,SAAS,OAAOG,OAAiB;EAAE,GAAGH;EAAS,SAAS;CAAK,CAAC;CACpE,OAAO,SAAS,GAAG,OAAO,IAAI,GAAG;AAClC,GAAG,OAAO,MAAM,aAAa,CAAC,CAC/B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
-
import { a as addUsage, c as terminalColumns,
|
|
1
|
+
import { i as Cmd, t as handler } from "./runtime-Bg4mc9BB.mjs";
|
|
2
|
+
import { a as addUsage, c as terminalColumns, f as writeOut, h as run, l as usage, m as make, o as emptyUsage, p as layer, r as renderError, s as header, t as InvalidInputError, u as writeError } from "./error-CSeYCa9R.mjs";
|
|
3
3
|
import { t as harnessOptions } from "./harness-6d8TlAVk.mjs";
|
|
4
|
+
import { t as threadFlag } from "./thread-CEYjLavT.mjs";
|
|
4
5
|
import { Effect, Exit, Fiber, Logger, Option, Queue, Ref, Schema, Stream } from "effect";
|
|
5
6
|
import { EventList, Harness, Sandbox, Session } from "@codeworksh/harness/effect";
|
|
6
7
|
//#region src/cli/cmd/handlers/run.ts
|
|
@@ -47,9 +48,11 @@ const selectSandbox = Effect.fn("CLI.selectSandbox", { level: "Info" })(function
|
|
|
47
48
|
}
|
|
48
49
|
return selection.info;
|
|
49
50
|
});
|
|
50
|
-
var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run", { level: "Info" })(function* ({ prompt, session, cwd, sandboxDriver, sandboxProviderId, sandboxId, provider, model, thinking, server }) {
|
|
51
|
+
var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run", { level: "Info" })(function* ({ prompt, session, thread, cwd, sandboxDriver, sandboxProviderId, sandboxId, provider, model, thinking, server }) {
|
|
51
52
|
const shared = yield* Cmd.spec;
|
|
52
53
|
if (Option.isSome(session) && (Option.isSome(cwd) || Option.isSome(sandboxDriver) || Option.isSome(sandboxProviderId) || Option.isSome(sandboxId))) return yield* new InvalidInputError({ message: "--cwd, --sandbox-driver, --sandbox-id, and --sandbox-provider-id can only be used when creating a new session" });
|
|
54
|
+
if (Option.isSome(thread) && Option.isNone(session)) return yield* new InvalidInputError({ message: "--thread continues a thread of --session" });
|
|
55
|
+
const threadId = yield* threadFlag(thread);
|
|
53
56
|
if (Option.isSome(provider) !== Option.isSome(model)) return yield* new InvalidInputError({ message: "--provider and --model must be provided together" });
|
|
54
57
|
if (Option.isSome(sandboxProviderId) && Option.isNone(sandboxDriver)) return yield* new InvalidInputError({ message: "--sandbox-provider-id requires a remote --sandbox-driver" });
|
|
55
58
|
if (Option.isSome(server) && [
|
|
@@ -72,8 +75,9 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run", { level: "Info"
|
|
|
72
75
|
};
|
|
73
76
|
const remote = Effect.gen(function* () {
|
|
74
77
|
const rpc = yield* make;
|
|
75
|
-
const info = Option.isSome(session) ? yield* rpc["
|
|
78
|
+
const info = Option.isSome(session) ? yield* rpc["thread.configure"]({
|
|
76
79
|
sessionId: Session.SessionSchema.ID.make(session.value),
|
|
80
|
+
...threadId === void 0 ? {} : { threadId },
|
|
77
81
|
runtime
|
|
78
82
|
}) : yield* rpc["session.create"]({
|
|
79
83
|
runtime,
|
|
@@ -84,32 +88,37 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run", { level: "Info"
|
|
|
84
88
|
const state = yield* Ref.make(initialRenderState);
|
|
85
89
|
const columns = terminalColumns();
|
|
86
90
|
yield* writeError(header({
|
|
87
|
-
sessionId: info.id,
|
|
88
|
-
sandbox: info.sandbox?.driver ?? "local",
|
|
89
|
-
directory: info.directory,
|
|
91
|
+
sessionId: info.session.id,
|
|
92
|
+
sandbox: info.session.sandbox?.driver ?? "local",
|
|
93
|
+
directory: info.placement?.directory ?? info.session.directory,
|
|
90
94
|
columns
|
|
91
95
|
}));
|
|
92
|
-
if (info.sandbox !== void 0) yield* writeError(`sandbox-id: ${info.sandbox.id}\n`);
|
|
96
|
+
if (info.session.sandbox !== void 0) yield* writeError(`sandbox-id: ${info.session.sandbox.id}\n`);
|
|
93
97
|
yield* run(rpc, {
|
|
94
|
-
sessionId: info.id,
|
|
98
|
+
sessionId: info.session.id,
|
|
99
|
+
threadId: info.id,
|
|
95
100
|
text: prompt
|
|
96
|
-
}, render(state)).pipe(Effect.onInterrupt(() => rpc["
|
|
101
|
+
}, render(state)).pipe(Effect.onInterrupt(() => rpc["thread.interrupt"]({
|
|
102
|
+
sessionId: info.session.id,
|
|
103
|
+
threadId: info.id
|
|
104
|
+
}).pipe(Effect.timeout("5 seconds"), Effect.ignore)));
|
|
97
105
|
yield* finish(state, columns);
|
|
98
106
|
});
|
|
99
107
|
const program = Effect.gen(function* () {
|
|
100
108
|
let handle;
|
|
101
109
|
if (Option.isSome(session)) handle = yield* Session.attach({
|
|
102
110
|
sessionId: Session.SessionSchema.ID.make(session.value),
|
|
111
|
+
...threadId === void 0 ? {} : { threadId },
|
|
103
112
|
...runtime
|
|
104
113
|
});
|
|
105
114
|
else {
|
|
106
115
|
const selected = yield* selectSandbox(selection);
|
|
107
|
-
handle = yield* Session.create({
|
|
116
|
+
handle = (yield* Session.create({
|
|
108
117
|
...runtime,
|
|
109
118
|
...selected === void 0 ? {} : { sandbox: selected },
|
|
110
119
|
...Option.isNone(cwd) ? {} : { directory: cwd.value },
|
|
111
120
|
hostDir
|
|
112
|
-
});
|
|
121
|
+
})).main;
|
|
113
122
|
}
|
|
114
123
|
const ended = yield* Queue.unbounded();
|
|
115
124
|
const renderState = yield* Ref.make(initialRenderState);
|
|
@@ -117,9 +126,9 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run", { level: "Info"
|
|
|
117
126
|
const info = yield* handle.info;
|
|
118
127
|
const columns = terminalColumns();
|
|
119
128
|
yield* writeError(header({
|
|
120
|
-
sessionId: handle.
|
|
121
|
-
sandbox: info.sandbox?.driver ?? "local",
|
|
122
|
-
directory: info.directory,
|
|
129
|
+
sessionId: handle.sessionId,
|
|
130
|
+
sandbox: info.session.sandbox?.driver ?? "local",
|
|
131
|
+
directory: info.placement?.directory ?? info.session.directory,
|
|
123
132
|
columns
|
|
124
133
|
}));
|
|
125
134
|
const execution = yield* handle.prompt({
|
|
@@ -128,7 +137,7 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run", { level: "Info"
|
|
|
128
137
|
}).pipe(Effect.andThen(handle.resume()), Effect.onInterrupt(() => handle.interrupt().pipe(Effect.timeout("5 seconds"), Effect.ignore)), Effect.exit);
|
|
129
138
|
yield* handle.wait();
|
|
130
139
|
if (Exit.isFailure(execution)) return yield* Effect.failCause(execution.cause);
|
|
131
|
-
const leaf = (yield* handle.
|
|
140
|
+
const leaf = (yield* handle.history()).at(-1);
|
|
132
141
|
if (leaf !== void 0) yield* awaitMessage(ended, leaf.entry.id);
|
|
133
142
|
yield* Fiber.interrupt(printer);
|
|
134
143
|
yield* finish(renderState, columns);
|
|
@@ -143,4 +152,4 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run", { level: "Info"
|
|
|
143
152
|
//#endregion
|
|
144
153
|
export { run_default as default };
|
|
145
154
|
|
|
146
|
-
//# sourceMappingURL=run-
|
|
155
|
+
//# sourceMappingURL=run-CRV3jJ2d.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-CRV3jJ2d.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, Logger, 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 { threadFlag } from \"../../thread.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\", { level: \"Info\" })(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\", { level: \"Info\" })(function* ({\n\t\tprompt,\n\t\tsession,\n\t\tthread,\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(thread) && Option.isNone(session)) {\n\t\t\treturn yield* new InvalidInputError({ message: \"--thread continues a thread of --session\" });\n\t\t}\n\t\tconst threadId = yield* threadFlag(thread);\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[\"thread.configure\"]({\n\t\t\t\t\t\tsessionId: Session.SessionSchema.ID.make(session.value),\n\t\t\t\t\t\t...(threadId === undefined ? {} : { threadId }),\n\t\t\t\t\t\truntime,\n\t\t\t\t\t})\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.session.id,\n\t\t\t\t\tsandbox: info.session.sandbox?.driver ?? \"local\",\n\t\t\t\t\tdirectory: info.placement?.directory ?? info.session.directory,\n\t\t\t\t\tcolumns,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tif (info.session.sandbox !== undefined) yield* writeError(`sandbox-id: ${info.session.sandbox.id}\\n`);\n\t\t\tyield* Client.run(rpc, { sessionId: info.session.id, threadId: info.id, text: prompt }, render(state)).pipe(\n\t\t\t\tEffect.onInterrupt(() =>\n\t\t\t\t\trpc[\"thread.interrupt\"]({ sessionId: info.session.id, threadId: info.id }).pipe(\n\t\t\t\t\t\tEffect.timeout(\"5 seconds\"),\n\t\t\t\t\t\tEffect.ignore,\n\t\t\t\t\t),\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.ThreadHandle;\n\t\t\tif (Option.isSome(session)) {\n\t\t\t\thandle = yield* Session.attach({\n\t\t\t\t\tsessionId: Session.SessionSchema.ID.make(session.value),\n\t\t\t\t\t...(threadId === undefined ? {} : { threadId }),\n\t\t\t\t\t...runtime,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst selected = yield* selectSandbox(selection);\n\t\t\t\tconst created = 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\thandle = created.main;\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.sessionId,\n\t\t\t\t\tsandbox: info.session.sandbox?.driver ?? \"local\",\n\t\t\t\t\tdirectory: info.placement?.directory ?? info.session.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. Ctrl+C is the user stopping\n\t\t\t// the run, as on the remote path: named so, the next server start does not resume it.\n\t\t\tconst execution = yield* handle.prompt({ text: prompt, delivery: \"followUp\" }).pipe(\n\t\t\t\tEffect.andThen(handle.resume()),\n\t\t\t\tEffect.onInterrupt(() => handle.interrupt().pipe(Effect.timeout(\"5 seconds\"), Effect.ignore)),\n\t\t\t\tEffect.exit,\n\t\t\t);\n\t\t\tyield* handle.wait();\n\t\t\tif (Exit.isFailure(execution)) return yield* Effect.failCause(execution.cause);\n\t\t\tconst leaf = (yield* handle.history()).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\t// Scope inside the provided layer, so the run's finalizers (stopping a created sandbox) close\n\t\t// while the harness and its database are still open.\n\t\tconst execute = Effect.gen(function* () {\n\t\t\tif (Option.isSome(server))\n\t\t\t\treturn yield* remote.pipe(Effect.scoped, Effect.provide(Client.layer(server.value)));\n\t\t\t// Stdout carries only the response; harness logs go with the rest of the diagnostics.\n\t\t\treturn yield* program.pipe(\n\t\t\t\tEffect.scoped,\n\t\t\t\tEffect.provide(Harness.layer(harnessOptions(shared))),\n\t\t\t\tEffect.provideService(Logger.LogToStderr, true),\n\t\t\t);\n\t\t});\n\t\treturn yield* execute.pipe(\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":";;;;;;;AAyBA,MAAM,qBAAkC;CACvC,OAAO;CACP,UAAU;CACV,qBAAqB;AACtB;AAEA,MAAM,cAAc,OAAO,GAAG,UAAU,YAAY;AACpD,MAAM,aAAa,OAAO,GAAG,UAAU,QAAQ;AAC/C,MAAM,cAAc,OAAO,GAAG,UAAU,SAAS;AAEjD,MAAM,UAAU,OAA6B,UAC5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,GAAG,OAAO,MAAM,CAAC,GAC5F,OAAO,IACR;EACA,OAAO,OAAO,KAAK;EACnB,IAAI,KAAK,UAAU,SAAS,GAAG,OAAO,OAAO,OAAO,UAAU,UAAU,KAAK;EAC7E,MAAM,QAAQ,OAAO,OAAO,QAAQ,EAAA,CAAG,GAAG,EAAE;EAC5C,IAAI,SAAS,KAAA,GAAW,OAAO,aAAa,OAAO,KAAK,MAAM,EAAE;EAChE,OAAO,MAAM,UAAU,OAAO;EAC9B,OAAO,OAAO,aAAa,OAAO;CACnC,CAAC;CAcD,OAAO,OAVS,OAAO,IAAI,aAAa;EACvC,IAAI,OAAO,OAAO,MAAM,GACvB,OAAO,OAAO,OAAO,KAAK,OAAO,QAAQ,OAAO,QAAQC,MAAa,OAAO,KAAK,CAAC,CAAC;EAEpF,OAAO,OAAO,QAAQ,KACrB,OAAO,QACP,OAAO,QAAQ,QAAQ,MAAM,eAAe,MAAM,CAAC,CAAC,GACpD,OAAO,eAAe,OAAO,aAAa,IAAI,CAC/C;CACD,CACoB,CAAC,CAAC,KACrB,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"}
|
|
@@ -40,6 +40,8 @@ const ServerAddress = {
|
|
|
40
40
|
maximum: 65535
|
|
41
41
|
}))), Flag.withDescription("Port the background server listens on"), Flag.withDefault(7433))
|
|
42
42
|
};
|
|
43
|
+
/** For commands that only talk to a server that is already running. */
|
|
44
|
+
const RunningServer = Flag.String("server").pipe(Flag.withDescription("Base URL of the running codework server"), Flag.withDefault("http://127.0.0.1:7433"));
|
|
43
45
|
const JsonFlag = Flag.Boolean("json").pipe(Flag.withDescription("Print machine-readable output"), Flag.withDefault(false));
|
|
44
46
|
const Cmd = make("codework", {
|
|
45
47
|
description: "CodeWork Command Line Interface",
|
|
@@ -119,6 +121,7 @@ const Cmd = make("codework", {
|
|
|
119
121
|
server: Flag.String("server").pipe(Flag.withDescription("RPC server URL (ws://host:port/rpc/v1)"), Flag.optional),
|
|
120
122
|
prompt: Argument.String("prompt").pipe(Argument.withDescription("Prompt for the agent")),
|
|
121
123
|
session: Flag.String("session").pipe(Flag.withAlias("s"), Flag.withDescription("Continue an existing session"), Flag.optional),
|
|
124
|
+
thread: Flag.String("thread").pipe(Flag.withDescription("Thread of --session to continue: a thread ID, or main (default)"), Flag.optional),
|
|
122
125
|
cwd: Flag.String("cwd").pipe(Flag.withAlias("C"), Flag.withDescription("Working directory for a new session"), Flag.optional),
|
|
123
126
|
sandboxDriver: Flag.String("sandbox-driver").pipe(Flag.withDescription("Sandbox driver for a new session (default: local)"), Flag.optional),
|
|
124
127
|
sandboxId: Flag.String("sandbox-id").pipe(Flag.withDescription("Reuse an existing sandbox instance"), Flag.optional),
|
|
@@ -147,6 +150,10 @@ const Cmd = make("codework", {
|
|
|
147
150
|
{
|
|
148
151
|
command: "codework run --session <id> --provider openai --model gpt-5.6-luna \"Now fix them\"",
|
|
149
152
|
description: "Continue a session with explicit model bindings"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
command: "codework run --session <id> --thread <thread-id> \"Try OAuth instead\"",
|
|
156
|
+
description: "Continue one of the session's threads"
|
|
150
157
|
}
|
|
151
158
|
]
|
|
152
159
|
}),
|
|
@@ -206,7 +213,7 @@ const Cmd = make("codework", {
|
|
|
206
213
|
session: Argument.String("session-id").pipe(Argument.withDescription("The session to link")),
|
|
207
214
|
path: Argument.String("path").pipe(Argument.withDescription("Host directory to anchor to — typically the directory holding your .codework configuration; defaults to the shell's"), Argument.optional),
|
|
208
215
|
unlink: Flag.Boolean("unlink").pipe(Flag.withDescription("Clear the anchor, leaving the session with no host directory"), Flag.withDefault(false)),
|
|
209
|
-
server:
|
|
216
|
+
server: RunningServer
|
|
210
217
|
},
|
|
211
218
|
examples: [
|
|
212
219
|
{
|
|
@@ -222,6 +229,55 @@ const Cmd = make("codework", {
|
|
|
222
229
|
description: "Clear the anchor"
|
|
223
230
|
}
|
|
224
231
|
]
|
|
232
|
+
}), make("relink", {
|
|
233
|
+
description: "Move where a session's work, or one thread's, happens",
|
|
234
|
+
params: {
|
|
235
|
+
session: Argument.String("session-id").pipe(Argument.withDescription("The session to move")),
|
|
236
|
+
thread: Flag.String("thread").pipe(Flag.withDescription("Move only this thread: a thread ID, or main; omitted moves the session's default"), Flag.optional),
|
|
237
|
+
directory: Flag.String("directory").pipe(Flag.withAlias("C"), Flag.withDescription("Checkout to move into; the work keeps its position under it when that path exists there"), Flag.optional),
|
|
238
|
+
sandboxId: Flag.String("sandbox-id").pipe(Flag.withDescription("Sandbox instance to move to (default: local)"), Flag.optional),
|
|
239
|
+
json: JsonFlag,
|
|
240
|
+
server: RunningServer
|
|
241
|
+
},
|
|
242
|
+
examples: [{
|
|
243
|
+
command: "codework session relink ses_01h9 -C ~/work/api",
|
|
244
|
+
description: "Move the session to a local checkout"
|
|
245
|
+
}, {
|
|
246
|
+
command: "codework session relink ses_01h9 --thread thr_01ja --sandbox-id sbx_01k2",
|
|
247
|
+
description: "Run one thread in a sandbox, leaving the others where they are"
|
|
248
|
+
}]
|
|
249
|
+
})]
|
|
250
|
+
}),
|
|
251
|
+
make("thread", {
|
|
252
|
+
description: "Manage a session's threads",
|
|
253
|
+
commands: [make("list", {
|
|
254
|
+
description: "List a session's threads, newest first",
|
|
255
|
+
params: {
|
|
256
|
+
session: Argument.String("session-id").pipe(Argument.withDescription("The session")),
|
|
257
|
+
json: JsonFlag,
|
|
258
|
+
server: RunningServer
|
|
259
|
+
},
|
|
260
|
+
examples: [{
|
|
261
|
+
command: "codework thread list ses_01h9",
|
|
262
|
+
description: "List the session's threads"
|
|
263
|
+
}]
|
|
264
|
+
}), make("fork", {
|
|
265
|
+
description: "Start a new thread from a committed entry of a thread's history",
|
|
266
|
+
params: {
|
|
267
|
+
session: Argument.String("session-id").pipe(Argument.withDescription("The session")),
|
|
268
|
+
thread: Flag.String("thread").pipe(Flag.withDescription("Thread to fork: a thread ID, or main (default)"), Flag.optional),
|
|
269
|
+
at: Flag.String("at").pipe(Flag.withDescription("Keep history through this entry"), Flag.optional),
|
|
270
|
+
before: Flag.String("before").pipe(Flag.withDescription("Keep history up to this user entry, and print its text to edit"), Flag.optional),
|
|
271
|
+
json: JsonFlag,
|
|
272
|
+
server: RunningServer
|
|
273
|
+
},
|
|
274
|
+
examples: [{
|
|
275
|
+
command: "codework thread fork ses_01h9 --at 01jb",
|
|
276
|
+
description: "Continue the main thread's history through an entry in a new thread"
|
|
277
|
+
}, {
|
|
278
|
+
command: "codework thread fork ses_01h9 --thread thr_01ja --before 01jc",
|
|
279
|
+
description: "Branch just before a prompt, to send it again differently"
|
|
280
|
+
}]
|
|
225
281
|
})]
|
|
226
282
|
}),
|
|
227
283
|
make("plugin", {
|
|
@@ -299,7 +355,7 @@ const Cmd = make("codework", {
|
|
|
299
355
|
}),
|
|
300
356
|
make("reload", {
|
|
301
357
|
description: "Re-import configured plugins in a running server",
|
|
302
|
-
params: { server:
|
|
358
|
+
params: { server: RunningServer },
|
|
303
359
|
examples: [{
|
|
304
360
|
command: "codework plugin reload",
|
|
305
361
|
description: "Pick up edits to a local plugin without restarting"
|
|
@@ -457,4 +513,4 @@ function provide(node, handlers, context) {
|
|
|
457
513
|
//#endregion
|
|
458
514
|
export { Cmd as i, handlers as n, run as r, handler as t };
|
|
459
515
|
|
|
460
|
-
//# sourceMappingURL=runtime-
|
|
516
|
+
//# sourceMappingURL=runtime-Bg4mc9BB.mjs.map
|