@codeworksh/cli 0.3.0 → 0.4.0-canary.52.1.ge7df22a4

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.
Files changed (66) hide show
  1. package/{acp-XRYX2dyw.mjs → acp-BPiMP9SV.mjs} +3 -3
  2. package/{acp-XRYX2dyw.mjs.map → acp-BPiMP9SV.mjs.map} +1 -1
  3. package/{add-Cih66f0Z.mjs → add-Dzsv-fKd.mjs} +3 -3
  4. package/{add-Cih66f0Z.mjs.map → add-Dzsv-fKd.mjs.map} +1 -1
  5. package/{check-CWXDjuC1.mjs → check-DhojkK_E.mjs} +3 -3
  6. package/{check-CWXDjuC1.mjs.map → check-DhojkK_E.mjs.map} +1 -1
  7. package/{entries-8LFGwy4n.mjs → entries-KpYvZdpi.mjs} +3 -3
  8. package/{entries-8LFGwy4n.mjs.map → entries-KpYvZdpi.mjs.map} +1 -1
  9. package/{error-CzUxh0Q9.mjs → error-BMI81XvR.mjs} +226 -7
  10. package/error-BMI81XvR.mjs.map +1 -0
  11. package/{identity-CSj_73kP.mjs → identity-Dl0hQHgK.mjs} +2 -2
  12. package/{identity-CSj_73kP.mjs.map → identity-Dl0hQHgK.mjs.map} +1 -1
  13. package/index.mjs +24 -24
  14. package/{install-CRGaL_bc.mjs → install-BLRDBzp1.mjs} +3 -3
  15. package/{install-CRGaL_bc.mjs.map → install-BLRDBzp1.mjs.map} +1 -1
  16. package/{link-BiwLQTXW.mjs → link--UnM2qnT.mjs} +2 -2
  17. package/{link-BiwLQTXW.mjs.map → link--UnM2qnT.mjs.map} +1 -1
  18. package/{list-BvBVZtHt.mjs → list-9fVqelid.mjs} +2 -2
  19. package/{list-BvBVZtHt.mjs.map → list-9fVqelid.mjs.map} +1 -1
  20. package/{list-Daq_zh4E.mjs → list-BE4xSEe3.mjs} +3 -3
  21. package/{list-Daq_zh4E.mjs.map → list-BE4xSEe3.mjs.map} +1 -1
  22. package/{login-lsagcqp6.mjs → login-CRwxi5WD.mjs} +3 -3
  23. package/{login-lsagcqp6.mjs.map → login-CRwxi5WD.mjs.map} +1 -1
  24. package/{logout-DdkYEWM6.mjs → logout-C89X0B9M.mjs} +3 -3
  25. package/{logout-DdkYEWM6.mjs.map → logout-C89X0B9M.mjs.map} +1 -1
  26. package/package-Biq8oAF2.mjs +6 -0
  27. package/package-Biq8oAF2.mjs.map +1 -0
  28. package/package.json +7 -6
  29. package/{providers-CZmPKpb_.mjs → providers-BrXJvY2P.mjs} +2 -2
  30. package/{providers-CZmPKpb_.mjs.map → providers-BrXJvY2P.mjs.map} +1 -1
  31. package/{refresh-BFxZjrH1.mjs → refresh--j0Pj4Cw.mjs} +2 -2
  32. package/{refresh-BFxZjrH1.mjs.map → refresh--j0Pj4Cw.mjs.map} +1 -1
  33. package/{refresh-Cbq-iY3f.mjs → refresh-D0wBP2Go.mjs} +3 -3
  34. package/{refresh-Cbq-iY3f.mjs.map → refresh-D0wBP2Go.mjs.map} +1 -1
  35. package/{reload-C6c48hBY.mjs → reload-DgPawyzr.mjs} +2 -2
  36. package/{reload-C6c48hBY.mjs.map → reload-DgPawyzr.mjs.map} +1 -1
  37. package/{remove-lig66J-D.mjs → remove-DfFme5w2.mjs} +3 -3
  38. package/{remove-lig66J-D.mjs.map → remove-DfFme5w2.mjs.map} +1 -1
  39. package/{restart-C0FtXDtK.mjs → restart-D3QLTXxy.mjs} +3 -3
  40. package/{restart-C0FtXDtK.mjs.map → restart-D3QLTXxy.mjs.map} +1 -1
  41. package/{run-DIFNYGN-.mjs → run-CVRkm_Iz.mjs} +3 -3
  42. package/{run-DIFNYGN-.mjs.map → run-CVRkm_Iz.mjs.map} +1 -1
  43. package/{serve-jhJP26fG.mjs → serve-D2BTAZpR.mjs} +108 -8
  44. package/serve-D2BTAZpR.mjs.map +1 -0
  45. package/{service-BP8Y1n1R.mjs → service-BI_FL26Q.mjs} +3 -3
  46. package/{service-BP8Y1n1R.mjs.map → service-BI_FL26Q.mjs.map} +1 -1
  47. package/{settings-BM_gw7Fm.mjs → settings-BfmoL27m.mjs} +2 -2
  48. package/{settings-BM_gw7Fm.mjs.map → settings-BfmoL27m.mjs.map} +1 -1
  49. package/{shared-wNZoC017.mjs → shared-CnuCjvcG.mjs} +2 -2
  50. package/{shared-wNZoC017.mjs.map → shared-CnuCjvcG.mjs.map} +1 -1
  51. package/{start-BBGmLmro.mjs → start-Bkk-Y6yE.mjs} +3 -3
  52. package/{start-BBGmLmro.mjs.map → start-Bkk-Y6yE.mjs.map} +1 -1
  53. package/{status-BmpmqhUX.mjs → status-BhkBSKLd.mjs} +3 -3
  54. package/{status-BmpmqhUX.mjs.map → status-BhkBSKLd.mjs.map} +1 -1
  55. package/{status-CQHqU7_7.mjs → status-DVzFDoek.mjs} +3 -3
  56. package/{status-CQHqU7_7.mjs.map → status-DVzFDoek.mjs.map} +1 -1
  57. package/{stop-DHzqbCeB.mjs → stop-COTZBIML.mjs} +3 -3
  58. package/{stop-DHzqbCeB.mjs.map → stop-COTZBIML.mjs.map} +1 -1
  59. package/{tui-BGZPK8sC.mjs → tui-Bk0VBJIB.mjs} +4 -4
  60. package/{tui-BGZPK8sC.mjs.map → tui-Bk0VBJIB.mjs.map} +1 -1
  61. package/{update-CfrkcWoW.mjs → update-D0XPVfJu.mjs} +3 -3
  62. package/{update-CfrkcWoW.mjs.map → update-D0XPVfJu.mjs.map} +1 -1
  63. package/error-CzUxh0Q9.mjs.map +0 -1
  64. package/package-DyEUYkEq.mjs +0 -6
  65. package/package-DyEUYkEq.mjs.map +0 -1
  66. package/serve-jhJP26fG.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"link-BiwLQTXW.mjs","names":["Runtime.handler","Client.make","Client.layer"],"sources":["../../src/cli/cmd/handlers/session/link.ts"],"sourcesContent":["import { Session } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path } from \"effect\";\nimport { 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 * Sets `hostDir` on an existing session.\n *\n * **The session ID identifies it; the path is the target.** A project cannot identify a session --\n * it may have many or none, and it is the session that carries the field.\n *\n * The path defaults to the shell's directory, which is both the common case (you are standing in\n * the project you want to link) and safe to default: the CLI runs on the host, so the trust\n * question about naming host paths is about remote clients, not about a local shell's own cwd.\n *\n * Not `session relink`, which moves a session to another checkout of the same project. Different\n * axes -- `relink` changes where the *work* happens, `link` changes which host directory the\n * session is *anchored to* -- and conflating them would recreate the confusion the two names\n * exist to avoid.\n *\n * The anchor is not a settings mechanism. Settings discovery reads it, so do plugin installs, and\n * so will whatever needs a host-side directory next; naming any one of them in the description is\n * what made this read like a settings flag.\n */\nexport default Runtime.handler(\n\tCmd.commands.session.commands.link,\n\tEffect.fn(\"CLI.session.link\")(function* ({ session, path, unlink, server }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst nodePath = yield* Path.Path;\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst sessionId = Session.SessionSchema.ID.make(session);\n\t\t\tconst hostDir = unlink\n\t\t\t\t? undefined\n\t\t\t\t: Session.AbsolutePath.make(nodePath.resolve(Option.getOrElse(path, () => \".\")));\n\n\t\t\tconst info = yield* rpc[\"session.link\"]({\n\t\t\t\tsessionId,\n\t\t\t\t...(hostDir === undefined ? {} : { hostDir }),\n\t\t\t});\n\t\t\t// Settings are re-read every exchange, so this applies at the next one: no reload, no\n\t\t\t// restart, the project layer simply starts or stops being read.\n\t\t\tyield* writeOut(\n\t\t\t\tinfo.hostDir === undefined\n\t\t\t\t\t? `Unlinked ${info.id}; it now reads the user settings alone.\\n`\n\t\t\t\t\t: `Linked ${info.id} to ${info.hostDir}\\n`,\n\t\t\t);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.provide(Client.layer(server)), Effect.scoped, Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAA,eAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,MAC9B,OAAO,GAAG,kBAAkB,CAAC,CAAC,WAAW,EAAE,SAAS,MAAM,QAAQ,UAAU;CAsB3E,OAAO,OArBS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,KAAK;EAC7B,MAAM,MAAM,OAAOC;EACnB,MAAM,YAAY,QAAQ,cAAc,GAAG,KAAK,OAAO;EACvD,MAAM,UAAU,SACb,KAAA,IACA,QAAQ,aAAa,KAAK,SAAS,QAAQ,OAAO,UAAU,YAAY,GAAG,CAAC,CAAC;EAEhF,MAAM,OAAO,OAAO,IAAI,eAAe,CAAC;GACvC;GACA,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;EAC5C,CAAC;EAGD,OAAO,SACN,KAAK,YAAY,KAAA,IACd,YAAY,KAAK,GAAG,6CACpB,UAAU,KAAK,GAAG,MAAM,KAAK,QAAQ,GACzC;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,QAAQC,MAAa,MAAM,CAAC,GAAG,OAAO,QAAQ,OAAO,MAAM,aAAa,CAAC;AAC5G,CAAC,CACF"}
1
+ {"version":3,"file":"link--UnM2qnT.mjs","names":["Runtime.handler","Client.make","Client.layer"],"sources":["../../src/cli/cmd/handlers/session/link.ts"],"sourcesContent":["import { Session } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path } from \"effect\";\nimport { 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 * Sets `hostDir` on an existing session.\n *\n * **The session ID identifies it; the path is the target.** A project cannot identify a session --\n * it may have many or none, and it is the session that carries the field.\n *\n * The path defaults to the shell's directory, which is both the common case (you are standing in\n * the project you want to link) and safe to default: the CLI runs on the host, so the trust\n * question about naming host paths is about remote clients, not about a local shell's own cwd.\n *\n * Not `session relink`, which moves a session to another checkout of the same project. Different\n * axes -- `relink` changes where the *work* happens, `link` changes which host directory the\n * session is *anchored to* -- and conflating them would recreate the confusion the two names\n * exist to avoid.\n *\n * The anchor is not a settings mechanism. Settings discovery reads it, so do plugin installs, and\n * so will whatever needs a host-side directory next; naming any one of them in the description is\n * what made this read like a settings flag.\n */\nexport default Runtime.handler(\n\tCmd.commands.session.commands.link,\n\tEffect.fn(\"CLI.session.link\")(function* ({ session, path, unlink, server }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst nodePath = yield* Path.Path;\n\t\t\tconst rpc = yield* Client.make;\n\t\t\tconst sessionId = Session.SessionSchema.ID.make(session);\n\t\t\tconst hostDir = unlink\n\t\t\t\t? undefined\n\t\t\t\t: Session.AbsolutePath.make(nodePath.resolve(Option.getOrElse(path, () => \".\")));\n\n\t\t\tconst info = yield* rpc[\"session.link\"]({\n\t\t\t\tsessionId,\n\t\t\t\t...(hostDir === undefined ? {} : { hostDir }),\n\t\t\t});\n\t\t\t// Settings are re-read every exchange, so this applies at the next one: no reload, no\n\t\t\t// restart, the project layer simply starts or stops being read.\n\t\t\tyield* writeOut(\n\t\t\t\tinfo.hostDir === undefined\n\t\t\t\t\t? `Unlinked ${info.id}; it now reads the user settings alone.\\n`\n\t\t\t\t\t: `Linked ${info.id} to ${info.hostDir}\\n`,\n\t\t\t);\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.provide(Client.layer(server)), Effect.scoped, Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAA,eAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,MAC9B,OAAO,GAAG,kBAAkB,CAAC,CAAC,WAAW,EAAE,SAAS,MAAM,QAAQ,UAAU;CAsB3E,OAAO,OArBS,OAAO,IAAI,aAAa;EACvC,MAAM,WAAW,OAAO,KAAK;EAC7B,MAAM,MAAM,OAAOC;EACnB,MAAM,YAAY,QAAQ,cAAc,GAAG,KAAK,OAAO;EACvD,MAAM,UAAU,SACb,KAAA,IACA,QAAQ,aAAa,KAAK,SAAS,QAAQ,OAAO,UAAU,YAAY,GAAG,CAAC,CAAC;EAEhF,MAAM,OAAO,OAAO,IAAI,eAAe,CAAC;GACvC;GACA,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;EAC5C,CAAC;EAGD,OAAO,SACN,KAAK,YAAY,KAAA,IACd,YAAY,KAAK,GAAG,6CACpB,UAAU,KAAK,GAAG,MAAM,KAAK,QAAQ,GACzC;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,QAAQC,MAAa,MAAM,CAAC,GAAG,OAAO,QAAQ,OAAO,MAAM,aAAa,CAAC;AAC5G,CAAC,CACF"}
@@ -1,5 +1,5 @@
1
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { d as writeOut, i as reportFailure, t as InvalidInputError } from "./error-CzUxh0Q9.mjs";
2
+ import { d as writeOut, i as reportFailure, t as InvalidInputError } from "./error-BMI81XvR.mjs";
3
3
  import { n as synced } from "./catalog-C1G3pzHZ.mjs";
4
4
  import { Effect, Option } from "effect";
5
5
  import { ModelCatalog } from "@codeworksh/harness/effect";
@@ -27,4 +27,4 @@ var list_default = handler(Cmd.commands.models, Effect.fn("CLI.models.list")(fun
27
27
  //#endregion
28
28
  export { list_default as default };
29
29
 
30
- //# sourceMappingURL=list-BvBVZtHt.mjs.map
30
+ //# sourceMappingURL=list-9fVqelid.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-BvBVZtHt.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/models/list.ts"],"sourcesContent":["import { ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { InvalidInputError, reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { synced } from \"./catalog.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.models,\n\tEffect.fn(\"CLI.models.list\")(function* ({ provider }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tyield* synced;\n\t\t\tconst catalog = yield* ModelCatalog.models;\n\t\t\tif (Option.isSome(provider)) {\n\t\t\t\tconst providerId = provider.value;\n\t\t\t\tif (!Object.hasOwn(catalog, providerId)) {\n\t\t\t\t\treturn yield* new InvalidInputError({\n\t\t\t\t\t\tmessage: `provider \"${providerId}\" is not in the catalog\\nhint: run \\`codework models providers\\``,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst sorted = Object.keys(catalog[providerId] ?? {}).sort((a, b) => a.localeCompare(b));\n\t\t\t\tyield* writeOut(sorted.map((modelId) => `${providerId}/${modelId}\\n`).join(\"\"));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lines: string[] = [];\n\t\t\tconst providers = Object.keys(catalog).sort((a, b) => a.localeCompare(b));\n\t\t\tfor (const providerId of providers) {\n\t\t\t\tconst providerModels = Object.keys(catalog[providerId] ?? {}).sort((a, b) => a.localeCompare(b));\n\t\t\t\tfor (const modelId of providerModels) {\n\t\t\t\t\tlines.push(`${providerId}/${modelId}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield* writeOut(lines.join(\"\"));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,eAAeA,QACd,IAAI,SAAS,QACb,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,YAAY;CA2BrD,OAAO,OA1BS,OAAO,IAAI,aAAa;EACvC,OAAO;EACP,MAAM,UAAU,OAAO,aAAa;EACpC,IAAI,OAAO,OAAO,QAAQ,GAAG;GAC5B,MAAM,aAAa,SAAS;GAC5B,IAAI,CAAC,OAAO,OAAO,SAAS,UAAU,GACrC,OAAO,OAAO,IAAI,kBAAkB,EACnC,SAAS,aAAa,WAAW,kEAClC,CAAC;GAEF,MAAM,SAAS,OAAO,KAAK,QAAQ,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;GACvF,OAAO,SAAS,OAAO,KAAK,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;GAC9E;EACD;EAEA,MAAM,QAAkB,CAAC;EACzB,MAAM,YAAY,OAAO,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;EACxE,KAAK,MAAM,cAAc,WAAW;GACnC,MAAM,iBAAiB,OAAO,KAAK,QAAQ,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;GAC/F,KAAK,MAAM,WAAW,gBACrB,MAAM,KAAK,GAAG,WAAW,GAAG,QAAQ,GAAG;EAEzC;EACA,OAAO,SAAS,MAAM,KAAK,EAAE,CAAC;CAC/B,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
1
+ {"version":3,"file":"list-9fVqelid.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/models/list.ts"],"sourcesContent":["import { ModelCatalog } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { InvalidInputError, reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { synced } from \"./catalog.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.models,\n\tEffect.fn(\"CLI.models.list\")(function* ({ provider }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tyield* synced;\n\t\t\tconst catalog = yield* ModelCatalog.models;\n\t\t\tif (Option.isSome(provider)) {\n\t\t\t\tconst providerId = provider.value;\n\t\t\t\tif (!Object.hasOwn(catalog, providerId)) {\n\t\t\t\t\treturn yield* new InvalidInputError({\n\t\t\t\t\t\tmessage: `provider \"${providerId}\" is not in the catalog\\nhint: run \\`codework models providers\\``,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst sorted = Object.keys(catalog[providerId] ?? {}).sort((a, b) => a.localeCompare(b));\n\t\t\t\tyield* writeOut(sorted.map((modelId) => `${providerId}/${modelId}\\n`).join(\"\"));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst lines: string[] = [];\n\t\t\tconst providers = Object.keys(catalog).sort((a, b) => a.localeCompare(b));\n\t\t\tfor (const providerId of providers) {\n\t\t\t\tconst providerModels = Object.keys(catalog[providerId] ?? {}).sort((a, b) => a.localeCompare(b));\n\t\t\t\tfor (const modelId of providerModels) {\n\t\t\t\t\tlines.push(`${providerId}/${modelId}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield* writeOut(lines.join(\"\"));\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;AAQA,IAAA,eAAeA,QACd,IAAI,SAAS,QACb,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAAW,EAAE,YAAY;CA2BrD,OAAO,OA1BS,OAAO,IAAI,aAAa;EACvC,OAAO;EACP,MAAM,UAAU,OAAO,aAAa;EACpC,IAAI,OAAO,OAAO,QAAQ,GAAG;GAC5B,MAAM,aAAa,SAAS;GAC5B,IAAI,CAAC,OAAO,OAAO,SAAS,UAAU,GACrC,OAAO,OAAO,IAAI,kBAAkB,EACnC,SAAS,aAAa,WAAW,kEAClC,CAAC;GAEF,MAAM,SAAS,OAAO,KAAK,QAAQ,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;GACvF,OAAO,SAAS,OAAO,KAAK,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;GAC9E;EACD;EAEA,MAAM,QAAkB,CAAC;EACzB,MAAM,YAAY,OAAO,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;EACxE,KAAK,MAAM,cAAc,WAAW;GACnC,MAAM,iBAAiB,OAAO,KAAK,QAAQ,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;GAC/F,KAAK,MAAM,WAAW,gBACrB,MAAM,KAAK,GAAG,WAAW,GAAG,QAAQ,GAAG;EAEzC;EACA,OAAO,SAAS,MAAM,KAAK,EAAE,CAAC;CAC/B,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
@@ -1,6 +1,6 @@
1
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { d as writeOut, i as reportFailure } from "./error-CzUxh0Q9.mjs";
3
- import { i as read } from "./entries-8LFGwy4n.mjs";
2
+ import { d as writeOut, i as reportFailure } from "./error-BMI81XvR.mjs";
3
+ import { i as read } from "./entries-KpYvZdpi.mjs";
4
4
  import { Effect, Schema } from "effect";
5
5
  import { Plugin } from "@codeworksh/harness/effect";
6
6
  //#region src/cli/cmd/handlers/plugin/list.ts
@@ -74,4 +74,4 @@ var list_default = handler(Cmd.commands.plugin.commands.list, Effect.fn("CLI.plu
74
74
  //#endregion
75
75
  export { list_default as default };
76
76
 
77
- //# sourceMappingURL=list-Daq_zh4E.mjs.map
77
+ //# sourceMappingURL=list-BE4xSEe3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-Daq_zh4E.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/plugin/list.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Schema } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { read } from \"./entries.ts\";\n\n/**\n * Two columns: what was written, and what it turned out to be.\n *\n * **The second column doubles as the state, for free.** An ID cannot be known without importing\n * the module -- the store records nothing about the plugin inside a package -- so printing one is\n * proof that everything worked: the entry parsed, the store had it, the import succeeded, and the\n * definition validated. When any of that fails there is no ID to print, and the reason goes in its\n * place.\n *\n * **Nothing is stored to make that work.** The reason is the live error from this run, not a\n * record of an older one: a stored failure goes stale the moment someone fixes the cause, and a\n * list still printing `plugin-import-failed` after you installed the missing dependency is worse\n * than one that says nothing. The work is cheap and local -- a parse, a lookup and an import.\n *\n * (`checkedAt`/`outdated` are stored, for the opposite reason: those come from the network, so\n * re-obtaining them is expensive and a slightly stale answer is the right trade. Local facts are\n * recomputed; remote facts are cached.)\n */\nconst isSourceError = Schema.is(Plugin.SourceError);\nconst isInstallError = Schema.is(Plugin.InstallError);\nconst isStoreError = Schema.is(Plugin.StoreError);\nconst isLoadError = Schema.is(Plugin.LoadError);\n\n/** The §5.5 reason slug, which is the same string the CLI prints and a log line carries. */\nconst reasonOf = (error: unknown): { readonly reason: string; readonly message: string } =>\n\tisSourceError(error) || isInstallError(error) || isStoreError(error) || isLoadError(error)\n\t\t? { reason: error.reason, message: error.message }\n\t\t: { reason: \"plugin-load-failed\", message: String(error) };\n\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.list,\n\tEffect.fn(\"CLI.plugin.list\")(function* ({ verbose }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache } = yield* read(shared);\n\t\t\tif (entries.length === 0) {\n\t\t\t\tyield* writeOut(\"No plugins are configured.\\n\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst rows: Array<{ written: string; file: string; state: string; detail?: string }> = [];\n\t\t\tfor (const entry of entries) {\n\t\t\t\t// Resolve-only: listing what is configured must never install anything.\n\t\t\t\tconst inspected = yield* Plugin.inspect(entry.reference, {\n\t\t\t\t\tcache,\n\t\t\t\t\thostDir: entry.from,\n\t\t\t\t\tfile: entry.file,\n\t\t\t\t\tinstall: Plugin.resolveCached,\n\t\t\t\t}).pipe(Effect.result);\n\t\t\t\trows.push(\n\t\t\t\t\tinspected._tag === \"Success\"\n\t\t\t\t\t\t? { written: entry.written, file: entry.file, state: inspected.success.id }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\twritten: entry.written,\n\t\t\t\t\t\t\t\tfile: entry.file,\n\t\t\t\t\t\t\t\tstate: reasonOf(inspected.failure).reason,\n\t\t\t\t\t\t\t\tdetail: reasonOf(inspected.failure).message,\n\t\t\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// The left column is the reference exactly as the entry spells it, because that is the\n\t\t\t// string a person will search their settings for.\n\t\t\tconst width = Math.max(...rows.map((row) => row.written.length));\n\t\t\tfor (const row of rows) {\n\t\t\t\tyield* writeOut(`${row.written.padEnd(width)} ${row.state}\\n`);\n\t\t\t\tif (verbose) {\n\t\t\t\t\tif (row.detail !== undefined) yield* writeOut(`${\" \".repeat(width)} ${row.detail}\\n`);\n\t\t\t\t\tyield* writeOut(`${\" \".repeat(width)} declared in: ${row.file}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,gBAAgB,OAAO,GAAG,OAAO,WAAW;AAClD,MAAM,iBAAiB,OAAO,GAAG,OAAO,YAAY;AACpD,MAAM,eAAe,OAAO,GAAG,OAAO,UAAU;AAChD,MAAM,cAAc,OAAO,GAAG,OAAO,SAAS;;AAG9C,MAAM,YAAY,UACjB,cAAc,KAAK,KAAK,eAAe,KAAK,KAAK,aAAa,KAAK,KAAK,YAAY,KAAK,IACtF;CAAE,QAAQ,MAAM;CAAQ,SAAS,MAAM;AAAQ,IAC/C;CAAE,QAAQ;CAAsB,SAAS,OAAO,KAAK;AAAE;A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file":"list-BE4xSEe3.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/plugin/list.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Schema } from \"effect\";\nimport { Runtime } from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { read } from \"./entries.ts\";\n\n/**\n * Two columns: what was written, and what it turned out to be.\n *\n * **The second column doubles as the state, for free.** An ID cannot be known without importing\n * the module -- the store records nothing about the plugin inside a package -- so printing one is\n * proof that everything worked: the entry parsed, the store had it, the import succeeded, and the\n * definition validated. When any of that fails there is no ID to print, and the reason goes in its\n * place.\n *\n * **Nothing is stored to make that work.** The reason is the live error from this run, not a\n * record of an older one: a stored failure goes stale the moment someone fixes the cause, and a\n * list still printing `plugin-import-failed` after you installed the missing dependency is worse\n * than one that says nothing. The work is cheap and local -- a parse, a lookup and an import.\n *\n * (`checkedAt`/`outdated` are stored, for the opposite reason: those come from the network, so\n * re-obtaining them is expensive and a slightly stale answer is the right trade. Local facts are\n * recomputed; remote facts are cached.)\n */\nconst isSourceError = Schema.is(Plugin.SourceError);\nconst isInstallError = Schema.is(Plugin.InstallError);\nconst isStoreError = Schema.is(Plugin.StoreError);\nconst isLoadError = Schema.is(Plugin.LoadError);\n\n/** The §5.5 reason slug, which is the same string the CLI prints and a log line carries. */\nconst reasonOf = (error: unknown): { readonly reason: string; readonly message: string } =>\n\tisSourceError(error) || isInstallError(error) || isStoreError(error) || isLoadError(error)\n\t\t? { reason: error.reason, message: error.message }\n\t\t: { reason: \"plugin-load-failed\", message: String(error) };\n\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.list,\n\tEffect.fn(\"CLI.plugin.list\")(function* ({ verbose }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache } = yield* read(shared);\n\t\t\tif (entries.length === 0) {\n\t\t\t\tyield* writeOut(\"No plugins are configured.\\n\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst rows: Array<{ written: string; file: string; state: string; detail?: string }> = [];\n\t\t\tfor (const entry of entries) {\n\t\t\t\t// Resolve-only: listing what is configured must never install anything.\n\t\t\t\tconst inspected = yield* Plugin.inspect(entry.reference, {\n\t\t\t\t\tcache,\n\t\t\t\t\thostDir: entry.from,\n\t\t\t\t\tfile: entry.file,\n\t\t\t\t\tinstall: Plugin.resolveCached,\n\t\t\t\t}).pipe(Effect.result);\n\t\t\t\trows.push(\n\t\t\t\t\tinspected._tag === \"Success\"\n\t\t\t\t\t\t? { written: entry.written, file: entry.file, state: inspected.success.id }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\twritten: entry.written,\n\t\t\t\t\t\t\t\tfile: entry.file,\n\t\t\t\t\t\t\t\tstate: reasonOf(inspected.failure).reason,\n\t\t\t\t\t\t\t\tdetail: reasonOf(inspected.failure).message,\n\t\t\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// The left column is the reference exactly as the entry spells it, because that is the\n\t\t\t// string a person will search their settings for.\n\t\t\tconst width = Math.max(...rows.map((row) => row.written.length));\n\t\t\tfor (const row of rows) {\n\t\t\t\tyield* writeOut(`${row.written.padEnd(width)} ${row.state}\\n`);\n\t\t\t\tif (verbose) {\n\t\t\t\t\tif (row.detail !== undefined) yield* writeOut(`${\" \".repeat(width)} ${row.detail}\\n`);\n\t\t\t\t\tyield* writeOut(`${\" \".repeat(width)} declared in: ${row.file}\\n`);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,gBAAgB,OAAO,GAAG,OAAO,WAAW;AAClD,MAAM,iBAAiB,OAAO,GAAG,OAAO,YAAY;AACpD,MAAM,eAAe,OAAO,GAAG,OAAO,U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GAAW,OAAO,SAAS,GAAG,IAAI,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,GAAG;IACrF,OAAO,SAAS,GAAG,IAAI,OAAO,KAAK,EAAE,iBAAiB,IAAI,KAAK,GAAG;GACnE;EACD;CACD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
@@ -1,6 +1,6 @@
1
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { d as writeOut, i as reportFailure, p as make, t as InvalidInputError, u as writeError } from "./error-CzUxh0Q9.mjs";
3
- import { a as oauthProviderLabel, i as makeOps, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-wNZoC017.mjs";
2
+ import { d as writeOut, i as reportFailure, p as make, t as InvalidInputError, u as writeError } from "./error-BMI81XvR.mjs";
3
+ import { a as oauthProviderLabel, i as makeOps, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-CnuCjvcG.mjs";
4
4
  import { Effect, Option } from "effect";
5
5
  import { formatOAuthSummary, oauthLoginIssue, oauthNotice } from "@codeworksh/aikit/oauth/summary";
6
6
  //#region src/cli/cmd/handlers/auth/login.ts
@@ -42,4 +42,4 @@ var login_default = handler(Cmd.commands.auth.commands.login, Effect.fn("CLI.aut
42
42
  //#endregion
43
43
  export { login_default as default };
44
44
 
45
- //# sourceMappingURL=login-lsagcqp6.mjs.map
45
+ //# sourceMappingURL=login-CRwxi5WD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"login-lsagcqp6.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
+ {"version":3,"file":"login-CRwxi5WD.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
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { i as reportFailure, p as make, u as writeError } from "./error-CzUxh0Q9.mjs";
3
- import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-wNZoC017.mjs";
2
+ import { i as reportFailure, p as make, u as writeError } from "./error-BMI81XvR.mjs";
3
+ import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-CnuCjvcG.mjs";
4
4
  import { Effect, Option } from "effect";
5
5
  import { 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-DdkYEWM6.mjs.map
29
+ //# sourceMappingURL=logout-C89X0B9M.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logout-DdkYEWM6.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"}
1
+ {"version":3,"file":"logout-C89X0B9M.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,6 @@
1
+ //#region package.json
2
+ var version = "0.4.0-canary.52.1.ge7df22a4";
3
+ //#endregion
4
+ export { version as t };
5
+
6
+ //# sourceMappingURL=package-Biq8oAF2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-Biq8oAF2.mjs","names":[],"sources":["../../package.json"],"sourcesContent":[""],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeworksh/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.0-canary.52.1.ge7df22a4",
4
4
  "description": "CLI for running CodeWork coding agent harness.",
5
5
  "keywords": [
6
6
  "agent",
@@ -40,11 +40,12 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@agentclientprotocol/sdk": "1.5.1",
43
- "@codeworksh/aikit": "^0.11.0",
44
- "@codeworksh/harness": "0.3.0",
45
- "@codeworksh/tui": "0.0.3",
46
- "@effect/platform-node": "4.0.1",
47
- "effect": "4.0.1",
43
+ "@codeworksh/aikit": "0.12.0-canary.52.1.ge7df22a4",
44
+ "@codeworksh/harness": "0.4.0-canary.52.1.ge7df22a4",
45
+ "@codeworksh/tui": "0.1.0-canary.52.1.ge7df22a4",
46
+ "@effect/platform-node": "4.0.5",
47
+ "@effect/platform-node-shared": "4.0.5",
48
+ "effect": "4.0.5",
48
49
  "jsonc-parser": "3.3.1",
49
50
  "uuidv7": "^1.2.1",
50
51
  "zod": "4.6.5"
@@ -1,5 +1,5 @@
1
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { d as writeOut, i as reportFailure } from "./error-CzUxh0Q9.mjs";
2
+ import { d as writeOut, i as reportFailure } from "./error-BMI81XvR.mjs";
3
3
  import { n as synced } from "./catalog-C1G3pzHZ.mjs";
4
4
  import { Effect } from "effect";
5
5
  import { ModelCatalog } from "@codeworksh/harness/effect";
@@ -14,4 +14,4 @@ var providers_default = handler(Cmd.commands.models.commands.providers, Effect.f
14
14
  //#endregion
15
15
  export { providers_default as default };
16
16
 
17
- //# sourceMappingURL=providers-CZmPKpb_.mjs.map
17
+ //# sourceMappingURL=providers-BrXJvY2P.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"providers-CZmPKpb_.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
+ {"version":3,"file":"providers-BrXJvY2P.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,5 +1,5 @@
1
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { d as writeOut, i as reportFailure, u as writeError } from "./error-CzUxh0Q9.mjs";
2
+ import { d as writeOut, i as reportFailure, u as writeError } from "./error-BMI81XvR.mjs";
3
3
  import { t as home } from "./catalog-C1G3pzHZ.mjs";
4
4
  import { Effect } from "effect";
5
5
  import { ModelCatalog } from "@codeworksh/harness/effect";
@@ -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-BFxZjrH1.mjs.map
17
+ //# sourceMappingURL=refresh--j0Pj4Cw.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"refresh-BFxZjrH1.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
+ {"version":3,"file":"refresh--j0Pj4Cw.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,6 +1,6 @@
1
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { d as writeOut, i as reportFailure, n as OAuthError, p as make, t as InvalidInputError, u as writeError } from "./error-CzUxh0Q9.mjs";
3
- import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-wNZoC017.mjs";
2
+ import { d as writeOut, i as reportFailure, n as OAuthError, p as make, t as InvalidInputError, u as writeError } from "./error-BMI81XvR.mjs";
3
+ import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-CnuCjvcG.mjs";
4
4
  import { Effect, Option } from "effect";
5
5
  import { formatOAuthSummary, oauthNotice, 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-Cbq-iY3f.mjs.map
35
+ //# sourceMappingURL=refresh-D0wBP2Go.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"refresh-Cbq-iY3f.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 }));\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,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
1
+ {"version":3,"file":"refresh-D0wBP2Go.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,5 +1,5 @@
1
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { d as writeOut, f as layer, i as reportFailure, p as make } from "./error-CzUxh0Q9.mjs";
2
+ import { d as writeOut, f as layer, i as reportFailure, p as make } from "./error-BMI81XvR.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-C6c48hBY.mjs.map
26
+ //# sourceMappingURL=reload-DgPawyzr.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"reload-C6c48hBY.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
+ {"version":3,"file":"reload-DgPawyzr.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
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { d as writeOut, i as reportFailure } from "./error-CzUxh0Q9.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-BM_gw7Fm.mjs";
2
+ import { d as writeOut, i as reportFailure } from "./error-BMI81XvR.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-BfmoL27m.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-lig66J-D.mjs.map
37
+ //# sourceMappingURL=remove-DfFme5w2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove-lig66J-D.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
+ {"version":3,"file":"remove-DfFme5w2.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
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.mjs";
2
- import { d as writeOut, i as reportFailure } from "./error-CzUxh0Q9.mjs";
3
- import { i as ensure, n as options, o as stop } from "./service-BP8Y1n1R.mjs";
2
+ import { d as writeOut, i as reportFailure } from "./error-BMI81XvR.mjs";
3
+ import { i as ensure, n as options, o as stop } from "./service-BI_FL26Q.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-C0FtXDtK.mjs.map
21
+ //# sourceMappingURL=restart-D3QLTXxy.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"restart-C0FtXDtK.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
+ {"version":3,"file":"restart-D3QLTXxy.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,5 +1,5 @@
1
1
  import { i as Cmd, t as handler } from "./runtime-B43doHjV.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-CzUxh0Q9.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-BMI81XvR.mjs";
3
3
  import { t as harnessOptions } from "./harness-6d8TlAVk.mjs";
4
4
  import { Effect, Exit, Fiber, Logger, Option, Queue, Ref, Schema, Stream } from "effect";
5
5
  import { EventList, Harness, Sandbox, Session } from "@codeworksh/harness/effect";
@@ -125,7 +125,7 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run", { level: "Info"
125
125
  const execution = yield* handle.prompt({
126
126
  text: prompt,
127
127
  delivery: "followUp"
128
- }).pipe(Effect.andThen(handle.resume()), Effect.exit);
128
+ }).pipe(Effect.andThen(handle.resume()), Effect.onInterrupt(() => handle.interrupt().pipe(Effect.timeout("5 seconds"), Effect.ignore)), Effect.exit);
129
129
  yield* handle.wait();
130
130
  if (Exit.isFailure(execution)) return yield* Effect.failCause(execution.cause);
131
131
  const leaf = (yield* handle.path()).at(-1);
@@ -143,4 +143,4 @@ var run_default = handler(Cmd.commands.run, Effect.fn("CLI.run", { level: "Info"
143
143
  //#endregion
144
144
  export { run_default as default };
145
145
 
146
- //# sourceMappingURL=run-DIFNYGN-.mjs.map
146
+ //# sourceMappingURL=run-CVRkm_Iz.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-DIFNYGN-.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 { 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\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\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":";;;;;;AAwBA,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,UAC5C,OAAO,GAAG,YAAY,CAAC,CAAC,WAAW,OAA4B;CAC9D,IAAI,YAAY,KAAK,GAAG;EACvB,OAAO,SAAS,MAAM,KAAK,KAAK;EAChC,IAAI,MAAM,KAAK,MAAM,SAAS,GAC7B,OAAO,IAAI,OAAO,QAAQ,aAAa;GACtC,GAAG;GACH,UAAU;GACV,qBAAqB,MAAM,KAAK,MAAM,SAAS,IAAI;EACpD,EAAE;EAEH;CACD;CACA,IAAI,WAAW,KAAK,GAAG;EACtB,OAAO,IAAI,OAAO,QAAQ,aAAa;GAAE,GAAG;GAAS,OAAO,SAAS,QAAQ,OAAO,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li/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 { 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\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. 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 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\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":";;;;;;AA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