@codeworksh/cli 0.0.1-dev.20260922135856 → 0.0.1-dev.20260922184805
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/{add-D7X5BuCv.mjs → add--i7mPR73.mjs} +4 -4
- package/{add-D7X5BuCv.mjs.map → add--i7mPR73.mjs.map} +1 -1
- package/{catalog-DL8yWdvI.mjs → catalog-DJxy_lne.mjs} +2 -2
- package/{catalog-DL8yWdvI.mjs.map → catalog-DJxy_lne.mjs.map} +1 -1
- package/{check-M9CqztTk.mjs → check-Dq2WOgap.mjs} +4 -4
- package/{check-M9CqztTk.mjs.map → check-Dq2WOgap.mjs.map} +1 -1
- package/{commonjs-CiyyOsS6.mjs → commonjs-BDiLMfFF.mjs} +3 -3
- package/{commonjs-CiyyOsS6.mjs.map → commonjs-BDiLMfFF.mjs.map} +1 -1
- package/{definitions-ClJIBYEm.mjs → definitions-Dfwyyv_K.mjs} +3 -3
- package/{definitions-ClJIBYEm.mjs.map → definitions-Dfwyyv_K.mjs.map} +1 -1
- package/{entries-DBdy6ahj.mjs → entries-Gfsq7U4P.mjs} +2 -2
- package/{entries-DBdy6ahj.mjs.map → entries-Gfsq7U4P.mjs.map} +1 -1
- package/{error-DTXBm1nO.mjs → error-BrbT9_4g.mjs} +119 -9
- package/error-BrbT9_4g.mjs.map +1 -0
- package/{generate-C5NElYXe.mjs → generate-DrGYpD3l.mjs} +3 -3
- package/{generate-C5NElYXe.mjs.map → generate-DrGYpD3l.mjs.map} +1 -1
- package/{harness-DQxbts5f.mjs → harness-Bgvrr0ZB.mjs} +2 -2
- package/{harness-DQxbts5f.mjs.map → harness-Bgvrr0ZB.mjs.map} +1 -1
- package/index.d.mts +6 -1
- package/index.mjs +20 -14
- package/index.mjs.map +1 -1
- package/{install-CJEnZ9dx.mjs → install-DoO4D3fk.mjs} +4 -4
- package/{install-CJEnZ9dx.mjs.map → install-DoO4D3fk.mjs.map} +1 -1
- package/{lib-CVW4jqJ3.mjs → lib-BkWR53Bz.mjs} +6 -6
- package/{lib-CVW4jqJ3.mjs.map → lib-BkWR53Bz.mjs.map} +1 -1
- package/{lib-HXZBVLKt.mjs → lib-CyynPpjH.mjs} +5 -5
- package/{lib-HXZBVLKt.mjs.map → lib-CyynPpjH.mjs.map} +1 -1
- package/{lib-5d-Jmuz2.mjs → lib-Dw7R2suc.mjs} +5 -5
- package/{lib-5d-Jmuz2.mjs.map → lib-Dw7R2suc.mjs.map} +1 -1
- package/{lib-vrwKjvzk.mjs → lib-JQygPqgO.mjs} +3 -3
- package/{lib-vrwKjvzk.mjs.map → lib-JQygPqgO.mjs.map} +1 -1
- package/{link-D8V3E5iZ.mjs → link-B1zfETsS.mjs} +3 -3
- package/{link-D8V3E5iZ.mjs.map → link-B1zfETsS.mjs.map} +1 -1
- package/{list-DS9BJ3dD.mjs → list-3OR68HpY.mjs} +4 -4
- package/{list-DS9BJ3dD.mjs.map → list-3OR68HpY.mjs.map} +1 -1
- package/{list-BMUDpLRf.mjs → list-CfPfmfe0.mjs} +4 -4
- package/{list-BMUDpLRf.mjs.map → list-CfPfmfe0.mjs.map} +1 -1
- package/login-GFV3Z9f2.mjs +45 -0
- package/login-GFV3Z9f2.mjs.map +1 -0
- package/logout-D17TQUfo.mjs +29 -0
- package/logout-D17TQUfo.mjs.map +1 -0
- package/{p-map-LZ99xLhZ.mjs → p-map-C2WSUhyP.mjs} +2 -2
- package/{p-map-LZ99xLhZ.mjs.map → p-map-C2WSUhyP.mjs.map} +1 -1
- package/package.json +3 -3
- package/{providers-DT5BfXJV.mjs → providers-DLXs9aWZ.mjs} +4 -4
- package/{providers-DT5BfXJV.mjs.map → providers-DLXs9aWZ.mjs.map} +1 -1
- package/refresh-BTNuP1zL.mjs +35 -0
- package/refresh-BTNuP1zL.mjs.map +1 -0
- package/{reload-2GZ_8UBW.mjs → reload-BzwsCBQq.mjs} +3 -3
- package/{reload-2GZ_8UBW.mjs.map → reload-BzwsCBQq.mjs.map} +1 -1
- package/{remove-t8FHVGC0.mjs → remove-DgB3l5JL.mjs} +4 -4
- package/{remove-t8FHVGC0.mjs.map → remove-DgB3l5JL.mjs.map} +1 -1
- package/{run-CP7aAfkf.mjs → run-BVo4XsL6.mjs} +4 -4
- package/{run-CP7aAfkf.mjs.map → run-BVo4XsL6.mjs.map} +1 -1
- package/{runtime-CDSh4qOj.mjs → runtime-Dl621FOp.mjs} +76 -1
- package/runtime-Dl621FOp.mjs.map +1 -0
- package/{serve-DewC8gvV.mjs → serve-Dpep18-A.mjs} +79 -16
- package/serve-Dpep18-A.mjs.map +1 -0
- package/{settings-Bn2pmQXX.mjs → settings-C52IrA72.mjs} +2 -2
- package/{settings-Bn2pmQXX.mjs.map → settings-C52IrA72.mjs.map} +1 -1
- package/shared-Uwjcofff.mjs +115 -0
- package/shared-Uwjcofff.mjs.map +1 -0
- package/status-DPYq2Sx4.mjs +31 -0
- package/status-DPYq2Sx4.mjs.map +1 -0
- package/{type-defs-xvRvQI4T.mjs → type-defs-BZxrtlVD.mjs} +3 -3
- package/{type-defs-xvRvQI4T.mjs.map → type-defs-BZxrtlVD.mjs.map} +1 -1
- package/{update-CLfU-oh7.mjs → update-CJrBbHwq.mjs} +4 -4
- package/{update-CLfU-oh7.mjs.map → update-CJrBbHwq.mjs.map} +1 -1
- package/{valid-BXe5q7ao.mjs → valid-BWgW_TUl.mjs} +2 -2
- package/{valid-BXe5q7ao.mjs.map → valid-BWgW_TUl.mjs.map} +1 -1
- package/error-DTXBm1nO.mjs.map +0 -1
- package/runtime-CDSh4qOj.mjs.map +0 -1
- package/serve-DewC8gvV.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as projectRoot, K as parse, L as anchor, P as load, bt as resolve, q as probe$1 } from "./error-BrbT9_4g.mjs";
|
|
2
2
|
import { Effect, Option, Path } from "effect";
|
|
3
3
|
//#region src/cli/cmd/handlers/plugin/entries.ts
|
|
4
4
|
/** Only a string entry loads a module; `{ package }` is configuration for one already selected. */
|
|
@@ -45,4 +45,4 @@ const fetchable = (target) => target === void 0 || target.kind === "local" ? voi
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { probe as n, read as r, fetchable as t };
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=entries-
|
|
48
|
+
//# sourceMappingURL=entries-Gfsq7U4P.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entries-
|
|
1
|
+
{"version":3,"file":"entries-Gfsq7U4P.mjs","names":["Global.resolve","Settings.projectRoot","Settings.load","Plugin.parse","Plugin.anchor","Plugin.probe"],"sources":["../../src/cli/cmd/handlers/plugin/entries.ts"],"sourcesContent":["import { Global, Plugin, Settings } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path } from \"effect\";\nimport type { Shared } from \"./settings.ts\";\n\n/**\n * Every plugin entry the settings files name, across every layer, in the order they accumulate.\n *\n * This is what `install`, `list`, `check` and `update` all operate on: unlike `add` and `remove`,\n * none of them writes an entry. They read what is already there and act on the store -- each one\n * under the `.npmrc` context of the file that declared it, which is what keys the artifact.\n */\nexport interface Entry {\n\t/** The reference as the settings file spells it: the string a person will search for. */\n\treadonly written: string;\n\t/** The same reference, anchored to the file that declared it. This is what resolves. */\n\treadonly reference: string;\n\t/** Which settings file declared it. */\n\treadonly file: string;\n\t/**\n\t * The `.npmrc` anchor for the entry's store identity: the project that declared it, so the\n\t * registry context is the same wherever this command happens to run.\n\t */\n\treadonly from: string;\n\t/** Absent for an unparseable entry and for a local path. */\n\treadonly target: Plugin.Target | undefined;\n}\n\n/** Only a string entry loads a module; `{ package }` is configuration for one already selected. */\nconst moduleOf = (entry: unknown): string | undefined => (typeof entry === \"string\" ? entry : undefined);\n\nexport const read = Effect.fn(\"CLI.plugin.entries\")(function* (shared: Shared) {\n\tconst nodePath = yield* Path.Path;\n\tconst cwd = nodePath.resolve(\".\");\n\tconst paths = yield* Global.resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value });\n\tconst root = yield* Settings.projectRoot(cwd, paths.home);\n\tconst config = yield* Settings.load({\n\t\thome: paths.home,\n\t\t...(root === undefined ? {} : { hostDir: root }),\n\t\t...(Option.isNone(shared.userConfigDir) ? {} : { userConfigDir: shared.userConfigDir.value }),\n\t});\n\n\tconst seen = new Set<string>();\n\tconst entries: Entry[] = [];\n\tfor (const one of config.declared) {\n\t\tconst reference = moduleOf(one.entry);\n\t\t// Loading is keyed by the module, so the same one named twice is one entry here too.\n\t\tif (reference === undefined || seen.has(reference)) continue;\n\t\tseen.add(reference);\n\t\t// Already anchored to the file that declared it, so `cwd` here only affects a reference\n\t\t// no settings file produced.\n\t\tconst target = yield* Plugin.parse(reference, cwd).pipe(Effect.option);\n\t\tentries.push({\n\t\t\twritten: moduleOf(one.written) ?? reference,\n\t\t\treference,\n\t\t\tfile: one.file,\n\t\t\tfrom: Plugin.anchor(one.file, cwd),\n\t\t\ttarget: Option.getOrUndefined(target),\n\t\t});\n\t}\n\treturn { entries: entries as ReadonlyArray<Entry>, cache: paths.cache };\n});\n\n/**\n * The network half, handed to the store so the store itself never opens a socket.\n *\n * `probe` bypasses pacote's own metadata cache, because a staleness check that reads a cache is\n * not a staleness check. `from` is the host directory: a probe that read a different `.npmrc`\n * chain than the install would answer about a registry nothing is ever fetched from.\n */\nexport const probe =\n\t(cache: string, from: string): Plugin.Probe =>\n\t(target) =>\n\t\tPlugin.probe(target, cache, from);\n\n/** Only a fetched target has a store entry; a local one is loaded where it lies. */\nexport const fetchable = (target: Plugin.Target | undefined): Plugin.Fetchable | undefined =>\n\ttarget === undefined || target.kind === \"local\" ? undefined : target;\n"],"mappings":";;;;AA4BA,MAAM,YAAY,UAAwC,OAAO,UAAU,WAAW,QAAQ,KAAA;AAE9F,MAAa,OAAO,OAAO,GAAG,oBAAoB,CAAC,CAAC,WAAW,QAAgB;CAE9E,MAAM,OAAM,OADY,KAAK,KAAA,CACR,QAAQ,GAAG;CAChC,MAAM,QAAQ,OAAOA,QAAe,OAAO,OAAO,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,OAAO,KAAK,MAAM,CAAC;CACjG,MAAM,OAAO,OAAOC,YAAqB,KAAK,MAAM,IAAI;CACxD,MAAM,SAAS,OAAOC,KAAc;EACnC,MAAM,MAAM;EACZ,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,KAAK;EAC9C,GAAI,OAAO,OAAO,OAAO,aAAa,IAAI,CAAC,IAAI,EAAE,eAAe,OAAO,cAAc,MAAM;CAC5F,CAAC;CAED,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,UAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,OAAO,UAAU;EAClC,MAAM,YAAY,SAAS,IAAI,KAAK;EAEpC,IAAI,cAAc,KAAA,KAAa,KAAK,IAAI,SAAS,GAAG;EACpD,KAAK,IAAI,SAAS;EAGlB,MAAM,SAAS,OAAOC,MAAa,WAAW,GAAG,CAAC,CAAC,KAAK,OAAO,MAAM;EACrE,QAAQ,KAAK;GACZ,SAAS,SAAS,IAAI,OAAO,KAAK;GAClC;GACA,MAAM,IAAI;GACV,MAAMC,OAAc,IAAI,MAAM,GAAG;GACjC,QAAQ,OAAO,eAAe,MAAM;EACrC,CAAC;CACF;CACA,OAAO;EAAW;EAAiC,OAAO,MAAM;CAAM;AACvE,CAAC;;;;;;;;AASD,MAAa,SACX,OAAe,UACf,WACAC,QAAa,QAAQ,OAAO,IAAI;;AAGlC,MAAa,aAAa,WACzB,WAAW,KAAA,KAAa,OAAO,SAAS,UAAU,KAAA,IAAY"}
|
|
@@ -22,6 +22,8 @@ import { SandboxDriver as SandboxDriver$3, SandboxProvider } from "@codeworksh/p
|
|
|
22
22
|
import { DirectoryNotFoundError, DirectoryNotFoundError as DirectoryNotFoundError$1, Info, NotDirectoryError, NotDirectoryError as NotDirectoryError$1, Service, Service as Service$8 } from "@codeworksh/plugin/location";
|
|
23
23
|
import { Script, constants } from "node:vm";
|
|
24
24
|
import * as AikitFailure from "@codeworksh/aikit/failure";
|
|
25
|
+
import { JsonGitHubCopilotAuthStorage, getGitHubCopilotApiKey } from "@codeworksh/aikit/oauth/github/copilot";
|
|
26
|
+
import { JsonOpenAICodexAuthStorage, getOpenAICodexApiKey } from "@codeworksh/aikit/oauth/openai/codex";
|
|
25
27
|
import "@codeworksh/plugin/tool/error";
|
|
26
28
|
import { parse, printParseErrorCode } from "jsonc-parser";
|
|
27
29
|
import { Rpc, RpcClient, RpcGroup, RpcSerialization } from "effect/unstable/rpc";
|
|
@@ -137,6 +139,16 @@ function make$23(input = {}) {
|
|
|
137
139
|
log: input.log ?? posix.join(home, "log")
|
|
138
140
|
};
|
|
139
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Where a Codework home keeps its OAuth credentials, or undefined to let aikit
|
|
144
|
+
* resolve them (`CODEWORK_CREDENTIALS`, then the default home).
|
|
145
|
+
*
|
|
146
|
+
* Callers pass a home only when the user actually chose one, so an explicit
|
|
147
|
+
* `--home` pins the file and everything else defers to aikit. The harness and
|
|
148
|
+
* the RPC server both go through here: if they disagreed, a login stored by one
|
|
149
|
+
* would be invisible to the other.
|
|
150
|
+
*/
|
|
151
|
+
const authFile = (home) => home === void 0 ? void 0 : posix.join(home, "aikit", "auth.json");
|
|
140
152
|
const resolve$3 = Effect.fn("Global.resolve")(function* (input = {}) {
|
|
141
153
|
const home = input.home === void 0 ? yield* homeConfig : expandHome(input.home);
|
|
142
154
|
return make$23({
|
|
@@ -5733,8 +5745,8 @@ const options = (dir, cache) => Effect.suspend(() => {
|
|
|
5733
5745
|
});
|
|
5734
5746
|
const npmOptions = (dir, cache) => Effect.gen(function* () {
|
|
5735
5747
|
const config = yield* Effect.tryPromise(async () => {
|
|
5736
|
-
const { default: Config } = await import("./lib-
|
|
5737
|
-
const { definitions, flatten, nerfDarts, shorthands } = (await import("./definitions-
|
|
5748
|
+
const { default: Config } = await import("./lib-CyynPpjH.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
5749
|
+
const { definitions, flatten, nerfDarts, shorthands } = (await import("./definitions-Dfwyyv_K.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1))).default;
|
|
5738
5750
|
const created = new Config({
|
|
5739
5751
|
npmPath: fileURLToPath(new URL("..", import.meta.url)),
|
|
5740
5752
|
cwd: dir,
|
|
@@ -5850,7 +5862,7 @@ const entrypoint = (directory, name) => Effect.gen(function* () {
|
|
|
5850
5862
|
});
|
|
5851
5863
|
const reify = Effect.fn("PluginNpm.reify")(function* ({ target, into, cache, from }) {
|
|
5852
5864
|
const flat = yield* options(from, cache);
|
|
5853
|
-
const { Arborist } = yield* Effect.promise(() => import("./lib-
|
|
5865
|
+
const { Arborist } = yield* Effect.promise(() => import("./lib-Dw7R2suc.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1)));
|
|
5854
5866
|
const settings = {
|
|
5855
5867
|
...flat,
|
|
5856
5868
|
...target.mutable ? {
|
|
@@ -5944,7 +5956,7 @@ const probe = Effect.fn("PluginNpm.probe")(function* (target, cache, from) {
|
|
|
5944
5956
|
noGitRevCache: true,
|
|
5945
5957
|
_isRoot: true
|
|
5946
5958
|
};
|
|
5947
|
-
const { default: pacote } = yield* Effect.promise(() => import("./lib-
|
|
5959
|
+
const { default: pacote } = yield* Effect.promise(() => import("./lib-BkWR53Bz.mjs").then((n) => /* @__PURE__ */ __toESM(n.t(), 1)));
|
|
5948
5960
|
return yield* Effect.tryPromise({
|
|
5949
5961
|
try: async () => target.kind === "registry" ? (await pacote.manifest(target.spec, opts)).version : commitIn(await pacote.resolve(target.spec, opts)),
|
|
5950
5962
|
catch: (cause) => new InstallError({
|
|
@@ -7949,14 +7961,50 @@ const resolve$1 = Effect.fn("LLM.resolve")(function* (input) {
|
|
|
7949
7961
|
});
|
|
7950
7962
|
return model;
|
|
7951
7963
|
});
|
|
7964
|
+
/**
|
|
7965
|
+
* Fill in what an OAuth provider needs and the model catalog cannot carry: the
|
|
7966
|
+
* stored access token, and for Copilot the plan-specific inference host chosen
|
|
7967
|
+
* at login. Anything the request already pins is left alone, and a provider
|
|
7968
|
+
* with no stored login resolves to `{}` so aikit reports the missing key.
|
|
7969
|
+
*/
|
|
7970
|
+
const oauthCredentials = async (protocol, options) => {
|
|
7971
|
+
const storage = options.authFile === void 0 ? {} : { path: options.authFile };
|
|
7972
|
+
if (protocol === "openai-codex") {
|
|
7973
|
+
const apiKey = await getOpenAICodexApiKey({ storage: new JsonOpenAICodexAuthStorage(storage) });
|
|
7974
|
+
return apiKey === void 0 ? {} : { apiKey };
|
|
7975
|
+
}
|
|
7976
|
+
if (protocol === "github-copilot") {
|
|
7977
|
+
const store = new JsonGitHubCopilotAuthStorage(storage);
|
|
7978
|
+
const stored = await store.get();
|
|
7979
|
+
const apiKey = await getGitHubCopilotApiKey({ storage: store });
|
|
7980
|
+
if (apiKey === void 0) return {};
|
|
7981
|
+
const apiEndpoint = apiKey === stored?.access ? stored.apiEndpoint : void 0;
|
|
7982
|
+
return {
|
|
7983
|
+
apiKey,
|
|
7984
|
+
...apiEndpoint === void 0 ? {} : { baseURL: apiEndpoint }
|
|
7985
|
+
};
|
|
7986
|
+
}
|
|
7987
|
+
return {};
|
|
7988
|
+
};
|
|
7952
7989
|
/** Start a provider stream using the model pinned by State. */
|
|
7953
|
-
const
|
|
7990
|
+
const openWith = (options = {}) => Effect.fn("LLM.open")(function* (input, signal) {
|
|
7954
7991
|
const model = input.resolvedModel;
|
|
7992
|
+
const configured = runtimeOptions(input, model, signal);
|
|
7993
|
+
const resolved = configured.apiKey === void 0 ? yield* Effect.tryPromise({
|
|
7994
|
+
try: () => oauthCredentials(model.protocol, options),
|
|
7995
|
+
catch: (cause) => providerErrorFromUnknown(input, cause)
|
|
7996
|
+
}) : {};
|
|
7997
|
+
const request = {
|
|
7998
|
+
...configured,
|
|
7999
|
+
...resolved,
|
|
8000
|
+
...configured.baseURL === void 0 ? {} : { baseURL: configured.baseURL }
|
|
8001
|
+
};
|
|
7955
8002
|
return yield* Effect.try({
|
|
7956
|
-
try: () => stream(model, input.context,
|
|
8003
|
+
try: () => stream(model, input.context, request),
|
|
7957
8004
|
catch: (cause) => providerErrorFromUnknown(input, cause)
|
|
7958
8005
|
});
|
|
7959
8006
|
});
|
|
8007
|
+
const open = openWith();
|
|
7960
8008
|
/**
|
|
7961
8009
|
* Build a provider request from an opener. Tests use this with deterministic
|
|
7962
8010
|
* aikit event streams; production uses `open` above.
|
|
@@ -9317,7 +9365,9 @@ const layer$1 = (options = {}) => Layer.unwrap(Effect.gen(function* () {
|
|
|
9317
9365
|
const configured = yield* loadAll(options.sandboxes ?? [], { hostCwd });
|
|
9318
9366
|
const drivers = layer$19(driver_exports.SandboxDriver.withSource(make$16().driver, "core"), driver_exports.SandboxDriver.withSource(make$14().driver, "core"), ...configured);
|
|
9319
9367
|
const sandboxes = layer$17({ hostCwd }).pipe(Layer.provideMerge(drivers), Layer.provideMerge(database));
|
|
9320
|
-
const
|
|
9368
|
+
const authFile$1 = authFile(options.home === void 0 ? void 0 : paths.home);
|
|
9369
|
+
const open = options.llm ?? openWith(authFile$1 === void 0 ? {} : { authFile: authFile$1 });
|
|
9370
|
+
const loop = layer$4({ request: make$6(open) });
|
|
9321
9371
|
return layer$10.pipe(Layer.provideMerge(layer$8.pipe(Layer.provide(loop))), Layer.provideMerge(layer$5({}, pool, references, followStore, rebuild)), Layer.provideMerge(layer$6(settingsOptions)), Layer.provideMerge(layer$7), Layer.provideMerge(sandboxes), Layer.provideMerge(layer$22), Layer.provideMerge(layer$2), Layer.provideMerge(layer$25), Layer.provideMerge(layer$9(definitions)), Layer.provideMerge(database), Layer.provideMerge(global));
|
|
9322
9372
|
}));
|
|
9323
9373
|
//#endregion
|
|
@@ -9661,6 +9711,38 @@ const RuntimeConfig = Schema.Struct({
|
|
|
9661
9711
|
thinkingLevel: (0, schema_exports$8.optional)(Schema.Enum(Model.ThinkingLevelEnum))
|
|
9662
9712
|
});
|
|
9663
9713
|
const SandboxRef = Selection;
|
|
9714
|
+
var OAuthError$1 = class extends Schema.TaggedError()("Server.OAuthError", { message: Schema.String }) {};
|
|
9715
|
+
/** OAuth providers whose credentials this server stores. */
|
|
9716
|
+
const OAuthProvider = Schema.Literals(["openai-codex", "github-copilot"]);
|
|
9717
|
+
/**
|
|
9718
|
+
* Credentials as the provider's aikit module persists them. The union is
|
|
9719
|
+
* discriminated by `provider` so one set of RPCs serves every login.
|
|
9720
|
+
*/
|
|
9721
|
+
const OAuthCredentials = Schema.Union([Schema.Struct({
|
|
9722
|
+
provider: Schema.Literal("openai-codex"),
|
|
9723
|
+
access: Schema.String,
|
|
9724
|
+
refresh: Schema.String,
|
|
9725
|
+
expires: Schema.Finite,
|
|
9726
|
+
accountId: Schema.String
|
|
9727
|
+
}), Schema.Struct({
|
|
9728
|
+
provider: Schema.Literal("github-copilot"),
|
|
9729
|
+
access: Schema.String,
|
|
9730
|
+
refresh: Schema.String,
|
|
9731
|
+
expires: Schema.Finite,
|
|
9732
|
+
enterpriseUrl: (0, schema_exports$8.optional)(Schema.String),
|
|
9733
|
+
apiEndpoint: (0, schema_exports$8.optional)(Schema.String),
|
|
9734
|
+
availableModelIds: (0, schema_exports$8.optional)(Schema.Array(Schema.String))
|
|
9735
|
+
})]);
|
|
9736
|
+
/** What a login looks like from the outside: never the tokens themselves. */
|
|
9737
|
+
const OAuthInfo = Schema.Struct({
|
|
9738
|
+
provider: OAuthProvider,
|
|
9739
|
+
/** Epoch millis, or 0 for a credential that does not expire. */
|
|
9740
|
+
expires: Schema.Finite,
|
|
9741
|
+
accountId: (0, schema_exports$8.optional)(Schema.String),
|
|
9742
|
+
apiEndpoint: (0, schema_exports$8.optional)(Schema.String),
|
|
9743
|
+
enterpriseUrl: (0, schema_exports$8.optional)(Schema.String),
|
|
9744
|
+
availableModels: (0, schema_exports$8.optional)(Schema.Int)
|
|
9745
|
+
});
|
|
9664
9746
|
const SessionErrors = Schema.Union([
|
|
9665
9747
|
SessionNotFoundError,
|
|
9666
9748
|
SessionLinkedSpaceNotFoundError,
|
|
@@ -9679,6 +9761,26 @@ const SandboxErrors = Schema.Union([
|
|
|
9679
9761
|
]);
|
|
9680
9762
|
const LocationErrors = Schema.Union([DirectoryNotFoundError, NotDirectoryError]);
|
|
9681
9763
|
const Api = RpcGroup.make(
|
|
9764
|
+
Rpc.make("auth.save", {
|
|
9765
|
+
payload: { credentials: OAuthCredentials },
|
|
9766
|
+
success: OAuthInfo,
|
|
9767
|
+
error: OAuthError$1
|
|
9768
|
+
}),
|
|
9769
|
+
Rpc.make("auth.status", {
|
|
9770
|
+
payload: { provider: OAuthProvider },
|
|
9771
|
+
success: Schema.NullOr(OAuthInfo),
|
|
9772
|
+
error: OAuthError$1
|
|
9773
|
+
}),
|
|
9774
|
+
Rpc.make("auth.refresh", {
|
|
9775
|
+
payload: { provider: OAuthProvider },
|
|
9776
|
+
success: Schema.NullOr(OAuthInfo),
|
|
9777
|
+
error: OAuthError$1
|
|
9778
|
+
}),
|
|
9779
|
+
Rpc.make("auth.logout", {
|
|
9780
|
+
payload: { provider: OAuthProvider },
|
|
9781
|
+
success: Schema.Void,
|
|
9782
|
+
error: OAuthError$1
|
|
9783
|
+
}),
|
|
9682
9784
|
Rpc.make("session.create", {
|
|
9683
9785
|
payload: {
|
|
9684
9786
|
title: (0, schema_exports$8.optional)(Schema.String),
|
|
@@ -9966,8 +10068,13 @@ const terminalColumns = () => process.stderr.isTTY ? process.stderr.columns ?? 7
|
|
|
9966
10068
|
/** Bad flag or argument combinations the parser cannot express on its own. */
|
|
9967
10069
|
var InvalidInputError = class extends Schema.TaggedError()("CLI.InvalidInputError", { message: Schema.String }) {};
|
|
9968
10070
|
var ModelgenError = class extends Schema.TaggedError()("CLI.ModelgenError", { cause: Schema.Defect() }) {};
|
|
10071
|
+
var OAuthError = class extends Schema.TaggedError()("CLI.OAuthError", {
|
|
10072
|
+
message: Schema.String,
|
|
10073
|
+
cause: Schema.optional(Schema.Defect())
|
|
10074
|
+
}) {};
|
|
9969
10075
|
const isInvalidInputError = Schema.is(InvalidInputError);
|
|
9970
10076
|
const isModelgenError = Schema.is(ModelgenError);
|
|
10077
|
+
const isOAuthError = Schema.is(OAuthError);
|
|
9971
10078
|
const isProviderError = Schema.is(ProviderError);
|
|
9972
10079
|
const isModelCatalogError = Schema.is(ModelCatalogError);
|
|
9973
10080
|
const isModelNotFoundError = Schema.is(ModelNotFoundError);
|
|
@@ -10003,6 +10110,8 @@ const credentialHint = (provider) => {
|
|
|
10003
10110
|
switch (provider) {
|
|
10004
10111
|
case "openrouter": return "set OPENROUTER_API_KEY and retry";
|
|
10005
10112
|
case "openai": return "set OPENAI_API_KEY and retry";
|
|
10113
|
+
case "openai-codex": return "run `codework auth login --openai-codex` and retry";
|
|
10114
|
+
case "github-copilot": return "run `codework auth login --github-copilot` and retry";
|
|
10006
10115
|
case "anthropic": return "set ANTHROPIC_API_KEY and retry";
|
|
10007
10116
|
case "google": return "set GOOGLE_GENERATIVE_AI_API_KEY and retry";
|
|
10008
10117
|
case "xai": return "set XAI_API_KEY and retry";
|
|
@@ -10066,6 +10175,7 @@ const renderError = (error) => {
|
|
|
10066
10175
|
if (isSandboxDriverRegistrationError(error)) return `error: ${error.reason}\n`;
|
|
10067
10176
|
if (isInvalidInputError(error)) return `error: ${error.message}\n`;
|
|
10068
10177
|
if (isModelgenError(error)) return ["error[model-catalog]: failed to generate the model catalog", "hint: check the output path and retry"].join("\n") + "\n";
|
|
10178
|
+
if (isOAuthError(error)) return [`error[oauth]: ${error.message}`, ...error.cause === void 0 ? [] : [`detail: ${unknownMessage(error.cause)}`]].join("\n") + "\n";
|
|
10069
10179
|
if (isSandboxProviderError(error)) return [
|
|
10070
10180
|
`error: SandboxProviderError - ${error.sanitized.message}`,
|
|
10071
10181
|
`driver: ${error.driver}`,
|
|
@@ -10111,6 +10221,6 @@ const reportFailure = (error) => writeError(renderError(error)).pipe(Effect.andT
|
|
|
10111
10221
|
process.exitCode = 1;
|
|
10112
10222
|
})));
|
|
10113
10223
|
//#endregion
|
|
10114
|
-
export {
|
|
10224
|
+
export { Service$5 as $, resolve as A, inspect as B, get as C, __commonJSMin as Ct, drivers as D, __toCommonJS as Dt, create$2 as E, __require as Et, paths as F, lock as G, required as H, projectRoot as I, InstallError as J, parse$2 as K, anchor$1 as L, layer$1 as M, Service$1 as N, list as O, __toESM as Ot, load$1 as P, Service$4 as Q, canonical as R, create$1 as S, schema_exports$8 as St, relink as T, __exportAll as Tt, resolve$2 as U, check as V, update as W, SourceError as X, LoadError as Y, StoreError as Z, OAuthError$1 as _, path$1 as _t, reportFailure as a, SessionNotLinkedError as at, encode as b, resolve$3 as bt, header as c, SubscriptionOverflowError as ct, writeError as d, LLMTextDelta as dt, ModelCatalogError as et, writeOut as f, TurnEnded as ft, Api as g, layer$26 as gt, run as h, schema_exports$6 as ht, renderError as i, SessionNotFoundError as it, stop as j, register as k, terminalColumns as l, layer$25 as lt, make as m, instance_exports as mt, ModelgenError as n, sandbox$1 as nt, addUsage as o, layer$23 as ot, layer as p, Prompt as pt, probe as q, OAuthError as r, Service$14 as rt, emptyUsage as s, Service$16 as st, InvalidInputError as t, sandbox as tt, usage as u, LLMEnded as ut, Connected as v, Service$17 as vt, link as w, __esmMin as wt, attach as x, ID$1 as xt, Core as y, authFile as yt, definition$1 as z };
|
|
10115
10225
|
|
|
10116
|
-
//# sourceMappingURL=error-
|
|
10226
|
+
//# sourceMappingURL=error-BrbT9_4g.mjs.map
|