@codeworksh/cli 0.9.0-canary.167.1.g6ddcc8db → 0.9.0-canary.169.1.g71f19429
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{acp-CmtcmhuX.mjs → acp-Cw5Ljayx.mjs} +6 -5
- package/acp-Cw5Ljayx.mjs.map +1 -0
- package/{add-Bmholf85.mjs → add-Be7-HfBj.mjs} +2 -2
- package/{add-Bmholf85.mjs.map → add-Be7-HfBj.mjs.map} +1 -1
- package/{add-Ct20ZUEC.mjs → add-D2ly9-x3.mjs} +3 -3
- package/{add-Ct20ZUEC.mjs.map → add-D2ly9-x3.mjs.map} +1 -1
- package/{catalog-BJScfJLW.mjs → catalog-Dzi9__Rq.mjs} +2 -2
- package/{catalog-BJScfJLW.mjs.map → catalog-Dzi9__Rq.mjs.map} +1 -1
- package/categories-DD30aGHU.mjs +19 -0
- package/categories-DD30aGHU.mjs.map +1 -0
- package/{check-ki1450h-.mjs → check-DzxfN43i.mjs} +2 -2
- package/{check-ki1450h-.mjs.map → check-DzxfN43i.mjs.map} +1 -1
- package/{connect-KX-A0EzQ.mjs → connect-AqacTFrV.mjs} +5 -5
- package/{connect-KX-A0EzQ.mjs.map → connect-AqacTFrV.mjs.map} +1 -1
- package/{control-Cotypk4e.mjs → control-CFQeKIKx.mjs} +4 -4
- package/{control-Cotypk4e.mjs.map → control-CFQeKIKx.mjs.map} +1 -1
- package/create-dxNGBbiQ.mjs +35 -0
- package/create-dxNGBbiQ.mjs.map +1 -0
- package/{devices-BcuQ11QF.mjs → devices-DNzXKhNy.mjs} +3 -3
- package/{devices-BcuQ11QF.mjs.map → devices-DNzXKhNy.mjs.map} +1 -1
- package/disconnect-BcwEk1sG.mjs +19 -0
- package/disconnect-BcwEk1sG.mjs.map +1 -0
- package/disconnect-CHEHx_ic.mjs +2 -0
- package/{disconnect-CCI1DLJ0.mjs → disconnect-V4MnDMkF.mjs} +4 -4
- package/{disconnect-CCI1DLJ0.mjs.map → disconnect-V4MnDMkF.mjs.map} +1 -1
- package/discover-DAP4t5Kb.mjs +35 -0
- package/discover-DAP4t5Kb.mjs.map +1 -0
- package/{discovery-D2ftXE5a.mjs → discovery-C6H7dCHz.mjs} +2 -2
- package/{discovery-D2ftXE5a.mjs.map → discovery-C6H7dCHz.mjs.map} +1 -1
- package/{fork-DkYRL_nQ.mjs → fork-TUz05qSe.mjs} +3 -3
- package/{fork-DkYRL_nQ.mjs.map → fork-TUz05qSe.mjs.map} +1 -1
- package/{identity-Llk4K_8w.mjs → identity-fLl347sJ.mjs} +2 -2
- package/{identity-Llk4K_8w.mjs.map → identity-fLl347sJ.mjs.map} +1 -1
- package/index.mjs +49 -39
- package/index.mjs.map +1 -1
- package/{install-hs3tvWLA.mjs → install-BtoWHZoI.mjs} +2 -2
- package/{install-hs3tvWLA.mjs.map → install-BtoWHZoI.mjs.map} +1 -1
- package/{link-BzFGtDKJ.mjs → link-Cd6T22_n.mjs} +3 -3
- package/{link-BzFGtDKJ.mjs.map → link-Cd6T22_n.mjs.map} +1 -1
- package/{list-sLzs2Y7w.mjs → list-Bn5CvS1y.mjs} +3 -3
- package/{list-sLzs2Y7w.mjs.map → list-Bn5CvS1y.mjs.map} +1 -1
- package/list-C29G-xrA.mjs +27 -0
- package/list-C29G-xrA.mjs.map +1 -0
- package/{list-D1c5uzCc.mjs → list-CdS1_gFF.mjs} +2 -2
- package/{list-D1c5uzCc.mjs.map → list-CdS1_gFF.mjs.map} +1 -1
- package/{list-DhL_z5v2.mjs → list-DAA92mUG.mjs} +3 -3
- package/{list-DhL_z5v2.mjs.map → list-DAA92mUG.mjs.map} +1 -1
- package/{list-Dt0_ol5P.mjs → list-MiZ6rD_w.mjs} +3 -3
- package/{list-Dt0_ol5P.mjs.map → list-MiZ6rD_w.mjs.map} +1 -1
- package/{login-BxiN8frI.mjs → login-C_tBeHg6.mjs} +3 -3
- package/{login-BxiN8frI.mjs.map → login-C_tBeHg6.mjs.map} +1 -1
- package/login-D0EMtnh2.mjs +26 -0
- package/login-D0EMtnh2.mjs.map +1 -0
- package/{login-S-2L5YYB.mjs → login-Q_ezdpon.mjs} +3 -3
- package/{login-S-2L5YYB.mjs.map → login-Q_ezdpon.mjs.map} +1 -1
- package/{logout-BeMvfZkG.mjs → logout-BjL1W-0I.mjs} +3 -3
- package/{logout-BeMvfZkG.mjs.map → logout-BjL1W-0I.mjs.map} +1 -1
- package/{logout-CKcRACIf.mjs → logout-E_dRjl1L.mjs} +3 -3
- package/{logout-CKcRACIf.mjs.map → logout-E_dRjl1L.mjs.map} +1 -1
- package/package-Y0eg0qm4.mjs +6 -0
- package/package-Y0eg0qm4.mjs.map +1 -0
- package/package.json +4 -4
- package/{pair-BhGzBBV8.mjs → pair-BBneOJZJ.mjs} +3 -3
- package/{pair-BhGzBBV8.mjs.map → pair-BBneOJZJ.mjs.map} +1 -1
- package/{providers-DdBYxi9t.mjs → providers-BYnMGDs7.mjs} +3 -3
- package/{providers-DdBYxi9t.mjs.map → providers-BYnMGDs7.mjs.map} +1 -1
- package/reconnect-BKpud0ma.mjs +2 -0
- package/{refresh-BgQfD2zv.mjs → refresh-CvE_f1Fa.mjs} +3 -3
- package/{refresh-BgQfD2zv.mjs.map → refresh-CvE_f1Fa.mjs.map} +1 -1
- package/{refresh-Cy6abMk_.mjs → refresh-Dy9kI2El.mjs} +3 -3
- package/{refresh-Cy6abMk_.mjs.map → refresh-Dy9kI2El.mjs.map} +1 -1
- package/{relay-BmHXs1yg.mjs → relay-DbZQ4i7J.mjs} +3 -3
- package/{relay-BmHXs1yg.mjs.map → relay-DbZQ4i7J.mjs.map} +1 -1
- package/{relink-Dxg1kstB.mjs → relink-DxftNq9n.mjs} +3 -3
- package/{relink-Dxg1kstB.mjs.map → relink-DxftNq9n.mjs.map} +1 -1
- package/{reload-CUyG343t.mjs → reload-DRp3UlHQ.mjs} +3 -3
- package/{reload-CUyG343t.mjs.map → reload-DRp3UlHQ.mjs.map} +1 -1
- package/{remove-BXmNNX2f.mjs → remove-C0e5sHqb.mjs} +3 -3
- package/{remove-BXmNNX2f.mjs.map → remove-C0e5sHqb.mjs.map} +1 -1
- package/{remove-CJ__oofS.mjs → remove-CdcoheOp.mjs} +2 -2
- package/{remove-CJ__oofS.mjs.map → remove-CdcoheOp.mjs.map} +1 -1
- package/remove-y_AI5IuH.mjs +22 -0
- package/remove-y_AI5IuH.mjs.map +1 -0
- package/{restart-CMDZZJ4N.mjs → restart-BcpKCYwQ.mjs} +4 -4
- package/{restart-CMDZZJ4N.mjs.map → restart-BcpKCYwQ.mjs.map} +1 -1
- package/{revoke-DigrkMoL.mjs → revoke-DoMHa1vL.mjs} +3 -3
- package/{revoke-DigrkMoL.mjs.map → revoke-DoMHa1vL.mjs.map} +1 -1
- package/{run-BN0xfxh_.mjs → run-DNbme1W_.mjs} +8 -5
- package/run-DNbme1W_.mjs.map +1 -0
- package/{runtime-Q4G4z83G.mjs → runtime-CyXV7HH_.mjs} +152 -9
- package/runtime-CyXV7HH_.mjs.map +1 -0
- package/{serve-CfjS09-r.mjs → serve-CGPp3kyd.mjs} +27 -11
- package/serve-CGPp3kyd.mjs.map +1 -0
- package/service-C1UBpOCn.mjs +1718 -0
- package/service-C1UBpOCn.mjs.map +1 -0
- package/{service-B0O4PjbL.mjs → service-YVNwFMNf.mjs} +2 -2
- package/{service-B0O4PjbL.mjs.map → service-YVNwFMNf.mjs.map} +1 -1
- package/{shared-C2sMimyK.mjs → shared-CDJQxUb9.mjs} +4 -4
- package/{shared-C2sMimyK.mjs.map → shared-CDJQxUb9.mjs.map} +1 -1
- package/shared-CXbDdgs4.mjs +223 -0
- package/shared-CXbDdgs4.mjs.map +1 -0
- package/{shared-C4j4rGe4.mjs → shared-D_MVXtOf.mjs} +3 -3
- package/{shared-C4j4rGe4.mjs.map → shared-D_MVXtOf.mjs.map} +1 -1
- package/{start-DbCTFswo.mjs → start-Dky5Iihf.mjs} +4 -4
- package/{start-DbCTFswo.mjs.map → start-Dky5Iihf.mjs.map} +1 -1
- package/status-B29jKo_s.mjs +23 -0
- package/status-B29jKo_s.mjs.map +1 -0
- package/{status-CR_E6RiI.mjs → status-BoTZqXwd.mjs} +3 -3
- package/{status-CR_E6RiI.mjs.map → status-BoTZqXwd.mjs.map} +1 -1
- package/{status-Dcbdl6Sv.mjs → status-CdAZIIEi.mjs} +4 -4
- package/{status-Dcbdl6Sv.mjs.map → status-CdAZIIEi.mjs.map} +1 -1
- package/{stop-ML5Yeo_s.mjs → stop-BCAMcHem.mjs} +4 -4
- package/{stop-ML5Yeo_s.mjs.map → stop-BCAMcHem.mjs.map} +1 -1
- package/{update-BK_LdUUv.mjs → update-mWc5cR7q.mjs} +2 -2
- package/{update-BK_LdUUv.mjs.map → update-mWc5cR7q.mjs.map} +1 -1
- package/acp-CmtcmhuX.mjs.map +0 -1
- package/disconnect-DKi3PmC2.mjs +0 -2
- package/package-D_TWKUKk.mjs +0 -6
- package/package-D_TWKUKk.mjs.map +0 -1
- package/reconnect-DgUK2fwU.mjs +0 -2
- package/run-BN0xfxh_.mjs.map +0 -1
- package/runtime-Q4G4z83G.mjs.map +0 -1
- package/serve-CfjS09-r.mjs.map +0 -1
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { g as make, m as writeOut } from "./error-BsI8iNna.mjs";
|
|
2
|
+
import { i as Cmd } from "./runtime-CyXV7HH_.mjs";
|
|
3
|
+
import { n as layer, t as Service } from "./service-C1UBpOCn.mjs";
|
|
4
|
+
import { t as connect } from "./service-YVNwFMNf.mjs";
|
|
5
|
+
import { Duration, Effect, Option, Schema } from "effect";
|
|
6
|
+
import { oauthErrorHtml, oauthSuccessHtml, openBrowser, promptLine } from "@codeworksh/aikit/oauth/interactive";
|
|
7
|
+
import { createServer } from "node:http";
|
|
8
|
+
//#region src/cli/cmd/handlers/connect/shared.ts
|
|
9
|
+
var ConnectCliError = class extends Schema.TaggedError()("CLI.ConnectError", { message: Schema.String }) {};
|
|
10
|
+
const toCliError = (cause) => new ConnectCliError({ message: typeof cause === "object" && cause !== null && "message" in cause && typeof cause.message === "string" ? cause.message : String(cause) });
|
|
11
|
+
const mapErr = (effect) => effect.pipe(Effect.mapError(toCliError));
|
|
12
|
+
/**
|
|
13
|
+
* Runs an operation against either a running RPC server (`--server`) or the local `<home>/connections.db`.
|
|
14
|
+
*/
|
|
15
|
+
const withConnectApi = (server, fn) => Effect.gen(function* () {
|
|
16
|
+
if (Option.isSome(server)) return yield* Effect.gen(function* () {
|
|
17
|
+
const rpc = yield* make;
|
|
18
|
+
return yield* fn({
|
|
19
|
+
catalog: (input) => mapErr(rpc["connectors.catalog"](input)),
|
|
20
|
+
list: (input) => mapErr(rpc["connections.list"](input)),
|
|
21
|
+
get: (ref) => mapErr(rpc["connections.get"]({ ref })),
|
|
22
|
+
create: (input) => mapErr(rpc["connections.create"](input)),
|
|
23
|
+
remove: (ref) => mapErr(rpc["connections.remove"]({ ref }).pipe(Effect.map((r) => r.removed))),
|
|
24
|
+
setApiKey: (ref, apiKey) => mapErr(rpc["connections.setApiKey"]({
|
|
25
|
+
ref,
|
|
26
|
+
apiKey
|
|
27
|
+
})),
|
|
28
|
+
disconnect: (ref) => mapErr(rpc["connections.disconnect"]({ ref })),
|
|
29
|
+
oauthStart: (input) => mapErr(rpc["connections.oauth.start"](input)),
|
|
30
|
+
oauthFinish: (input) => mapErr(rpc["connections.oauth.finish"](input)),
|
|
31
|
+
deviceStart: (input) => mapErr(rpc["connections.oauth.deviceStart"](input)),
|
|
32
|
+
devicePoll: (state) => mapErr(rpc["connections.oauth.devicePoll"]({ state }))
|
|
33
|
+
});
|
|
34
|
+
}).pipe(Effect.scoped, connect(server.value));
|
|
35
|
+
const shared = yield* Cmd.spec;
|
|
36
|
+
const layer$1 = layer(Option.isNone(shared.home) ? {} : { home: shared.home.value });
|
|
37
|
+
return yield* Effect.gen(function* () {
|
|
38
|
+
const svc = yield* Service;
|
|
39
|
+
return yield* fn({
|
|
40
|
+
catalog: (input) => mapErr(svc.catalog(input)),
|
|
41
|
+
list: (input) => mapErr(svc.list(input)),
|
|
42
|
+
get: (ref) => mapErr(svc.get(ref)),
|
|
43
|
+
create: (input) => mapErr(svc.create(input)),
|
|
44
|
+
remove: (ref) => mapErr(svc.remove(ref)),
|
|
45
|
+
setApiKey: (ref, apiKey) => mapErr(svc.setApiKey(ref, apiKey)),
|
|
46
|
+
disconnect: (ref) => mapErr(svc.disconnect(ref)),
|
|
47
|
+
oauthStart: (input) => mapErr(svc.oauthStart(input)),
|
|
48
|
+
oauthFinish: (input) => mapErr(svc.oauthFinish(input)),
|
|
49
|
+
deviceStart: (input) => mapErr(svc.deviceStart(input)),
|
|
50
|
+
devicePoll: (state) => mapErr(svc.devicePoll(state))
|
|
51
|
+
});
|
|
52
|
+
}).pipe(Effect.provide(layer$1));
|
|
53
|
+
});
|
|
54
|
+
const replyHtml = (res, status, html) => res.writeHead(status, {
|
|
55
|
+
"content-type": "text/html; charset=utf-8",
|
|
56
|
+
"cache-control": "no-store"
|
|
57
|
+
}).end(html);
|
|
58
|
+
const PER_SERVER_CALLBACK = /^\/oauth\/callback\/[A-Za-z0-9_-]{12}$/;
|
|
59
|
+
const startLoopback = (opts) => new Promise((resolve, reject) => {
|
|
60
|
+
const server = createServer();
|
|
61
|
+
let pending;
|
|
62
|
+
server.on("request", (req, res) => {
|
|
63
|
+
const addr = server.address();
|
|
64
|
+
const port = addr !== null && typeof addr === "object" ? addr.port : opts.port;
|
|
65
|
+
const defaultHost = `${opts.redirectHost}:${port}`;
|
|
66
|
+
const rawHost = req.headers.host?.trim().toLowerCase();
|
|
67
|
+
const allowedHosts = /* @__PURE__ */ new Set([defaultHost.toLowerCase(), ...opts.redirectHost === "127.0.0.1" ? [`localhost:${port}`] : []]);
|
|
68
|
+
const effectiveHost = rawHost !== void 0 && allowedHosts.has(rawHost) ? rawHost : defaultHost;
|
|
69
|
+
const url = new URL(req.url ?? "/", `http://${effectiveHost}`);
|
|
70
|
+
if (!(url.pathname === opts.path || opts.path === "/oauth/callback" && PER_SERVER_CALLBACK.test(url.pathname))) return replyHtml(res, 404, oauthErrorHtml("Not found."));
|
|
71
|
+
const state = url.searchParams.get("state");
|
|
72
|
+
if (!pending || state !== pending.state) return replyHtml(res, 400, oauthErrorHtml("Invalid or expired OAuth state."));
|
|
73
|
+
const current = pending;
|
|
74
|
+
pending = void 0;
|
|
75
|
+
if (url.pathname !== current.expectedPath) {
|
|
76
|
+
current.fail(/* @__PURE__ */ new Error("The authorization response arrived on another redirect URI"));
|
|
77
|
+
return replyHtml(res, 400, oauthErrorHtml("Unexpected redirect URI."));
|
|
78
|
+
}
|
|
79
|
+
const error = url.searchParams.get("error");
|
|
80
|
+
const code = url.searchParams.get("code");
|
|
81
|
+
if (error !== null) {
|
|
82
|
+
const desc = url.searchParams.get("error_description") ?? error;
|
|
83
|
+
current.fail(new Error(desc));
|
|
84
|
+
return replyHtml(res, 200, oauthErrorHtml("Sign-in failed. You may close this window.", desc));
|
|
85
|
+
}
|
|
86
|
+
if (code === null || code.length === 0) {
|
|
87
|
+
current.fail(/* @__PURE__ */ new Error("Missing authorization code"));
|
|
88
|
+
return replyHtml(res, 400, oauthErrorHtml("Missing authorization code."));
|
|
89
|
+
}
|
|
90
|
+
current.done(url.href);
|
|
91
|
+
return replyHtml(res, 200, oauthSuccessHtml("Connected to CodeWork. You may close this window."));
|
|
92
|
+
});
|
|
93
|
+
server.once("error", (err) => reject(err));
|
|
94
|
+
server.listen(opts.port, opts.host, () => {
|
|
95
|
+
const addr = server.address();
|
|
96
|
+
if (addr === null || typeof addr !== "object") {
|
|
97
|
+
server.close();
|
|
98
|
+
reject(/* @__PURE__ */ new Error("Failed to bind loopback callback server"));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
resolve({
|
|
102
|
+
redirectUrl: `http://${opts.redirectHost}:${addr.port}${opts.path}`,
|
|
103
|
+
wait: (expectedState, expectedPath, signal) => new Promise((done, fail) => {
|
|
104
|
+
if (signal.aborted) {
|
|
105
|
+
fail(/* @__PURE__ */ new Error("Cancelled"));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const onAbort = () => {
|
|
109
|
+
if (pending?.state === expectedState) pending = void 0;
|
|
110
|
+
fail(/* @__PURE__ */ new Error("Cancelled"));
|
|
111
|
+
};
|
|
112
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
113
|
+
pending = {
|
|
114
|
+
state: expectedState,
|
|
115
|
+
expectedPath,
|
|
116
|
+
done: (callbackUrl) => {
|
|
117
|
+
signal.removeEventListener("abort", onAbort);
|
|
118
|
+
done(callbackUrl);
|
|
119
|
+
},
|
|
120
|
+
fail: (err) => {
|
|
121
|
+
signal.removeEventListener("abort", onAbort);
|
|
122
|
+
fail(err);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}),
|
|
126
|
+
close: () => {
|
|
127
|
+
server.close();
|
|
128
|
+
server.closeIdleConnections();
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
/**
|
|
134
|
+
* Runs the interactive authentication flow (API key, OAuth PKCE loopback raced with paste, or device code)
|
|
135
|
+
* for an existing Connection via `api`.
|
|
136
|
+
*/
|
|
137
|
+
const authenticateConnection = (api, connection, spec, options) => Effect.gen(function* () {
|
|
138
|
+
if (connection.authType === "apikey") {
|
|
139
|
+
const key = options.apiKey ?? (yield* Effect.tryPromise({
|
|
140
|
+
try: () => promptLine(`Enter API key for ${connection.uid}${spec?.auth.apikey?.keyUrl ? ` (${spec.auth.apikey.keyUrl})` : ""}: `),
|
|
141
|
+
catch: toCliError
|
|
142
|
+
}));
|
|
143
|
+
return yield* api.setApiKey(connection.uid, key);
|
|
144
|
+
}
|
|
145
|
+
if (connection.authType !== "oauth") return connection;
|
|
146
|
+
const oauthSpec = spec?.auth.oauth;
|
|
147
|
+
if (options.device === true || oauthSpec !== void 0 && !oauthSpec.grants.includes("authorization_code") && oauthSpec.grants.includes("device_code")) {
|
|
148
|
+
const started = yield* api.deviceStart({
|
|
149
|
+
ref: connection.uid,
|
|
150
|
+
enterpriseUrl: options.enterpriseUrl
|
|
151
|
+
});
|
|
152
|
+
process.stderr.write(`Open ${started.verificationUri} and enter code: ${started.userCode}\n`);
|
|
153
|
+
if (options.browser !== false) openBrowser(started.verificationUri, (err) => {
|
|
154
|
+
process.stderr.write(`Failed to open browser: ${err.message}\n`);
|
|
155
|
+
});
|
|
156
|
+
let intervalSeconds = Math.max(1, started.intervalSeconds);
|
|
157
|
+
while (true) {
|
|
158
|
+
yield* Effect.sleep(Duration.seconds(intervalSeconds));
|
|
159
|
+
const polled = yield* api.devicePoll(started.state);
|
|
160
|
+
if (polled.status === "complete") return polled.connection;
|
|
161
|
+
if (polled.intervalSeconds !== void 0 && polled.intervalSeconds > 0) intervalSeconds = polled.intervalSeconds;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const isCodex = oauthSpec?.handler === "openai-codex";
|
|
165
|
+
const listener = yield* Effect.tryPromise({
|
|
166
|
+
try: () => startLoopback(isCodex ? {
|
|
167
|
+
host: "127.0.0.1",
|
|
168
|
+
redirectHost: "localhost",
|
|
169
|
+
port: 1455,
|
|
170
|
+
path: "/auth/callback"
|
|
171
|
+
} : {
|
|
172
|
+
host: "127.0.0.1",
|
|
173
|
+
redirectHost: "127.0.0.1",
|
|
174
|
+
port: 0,
|
|
175
|
+
path: "/oauth/callback"
|
|
176
|
+
}),
|
|
177
|
+
catch: toCliError
|
|
178
|
+
});
|
|
179
|
+
try {
|
|
180
|
+
const started = yield* api.oauthStart({
|
|
181
|
+
ref: connection.uid,
|
|
182
|
+
redirectUrl: listener.redirectUrl
|
|
183
|
+
});
|
|
184
|
+
const controller = new AbortController();
|
|
185
|
+
const expectedPath = new URL(started.redirectUrl).pathname;
|
|
186
|
+
const callbackPromise = listener.wait(started.state, expectedPath, controller.signal);
|
|
187
|
+
process.stderr.write(`Authorize ${connection.uid} in your browser:\n${started.authorizeUrl}\n`);
|
|
188
|
+
if (options.browser !== false) openBrowser(started.authorizeUrl, (err) => {
|
|
189
|
+
process.stderr.write(`Failed to open browser: ${err.message}\n`);
|
|
190
|
+
});
|
|
191
|
+
const code = yield* Effect.tryPromise({
|
|
192
|
+
try: async () => {
|
|
193
|
+
if (!process.stdin.isTTY) return await callbackPromise;
|
|
194
|
+
const manualPromise = promptLine("Waiting for browser callback (or paste redirected URL here): ");
|
|
195
|
+
try {
|
|
196
|
+
return await Promise.race([callbackPromise, manualPromise]);
|
|
197
|
+
} finally {
|
|
198
|
+
controller.abort();
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
catch: toCliError
|
|
202
|
+
});
|
|
203
|
+
return yield* api.oauthFinish({
|
|
204
|
+
state: started.state,
|
|
205
|
+
code
|
|
206
|
+
});
|
|
207
|
+
} finally {
|
|
208
|
+
listener.close();
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
const printJson = (value) => writeOut(`${JSON.stringify(value, null, 2)}\n`);
|
|
212
|
+
const formatConnectionLine = (c) => {
|
|
213
|
+
const flags = [c.status, c.sourceLabel];
|
|
214
|
+
if (c.isDefault) flags.push("default");
|
|
215
|
+
if (!c.enabled) flags.push("disabled");
|
|
216
|
+
if (c.readOnly) flags.push("read-only");
|
|
217
|
+
const account = c.accountLabel ? ` [${c.accountLabel}]` : "";
|
|
218
|
+
return `${c.uid}${account} (${flags.join(", ")})`;
|
|
219
|
+
};
|
|
220
|
+
//#endregion
|
|
221
|
+
export { withConnectApi as i, formatConnectionLine as n, printJson as r, authenticateConnection as t };
|
|
222
|
+
|
|
223
|
+
//# sourceMappingURL=shared-CXbDdgs4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-CXbDdgs4.mjs","names":["Client.make","Service.connect","layer","ConnectorService.layer","ConnectorService.Service"],"sources":["../../src/cli/cmd/handlers/connect/shared.ts"],"sourcesContent":["/* @effect-diagnostics nodeBuiltinImport:off -- CLI OAuth flow opens a loopback listener and prompts on stdio. */\n/* @effect-diagnostics asyncFunction:off -- interactive loopback/prompt race wraps Promise callbacks. */\n/* @effect-diagnostics newPromise:off -- loopback HTTP server exposes Promise callbacks for Promise.race with stdin. */\n/* @effect-diagnostics preferSchemaOverJson:off -- CLI --json prints formatted JSON to stdout. */\n/* @effect-diagnostics abortControllerInEffect:off -- Promise.race aborts the losing loopback callback wait. */\nimport { createServer, type ServerResponse } from \"node:http\";\nimport { oauthErrorHtml, oauthSuccessHtml, openBrowser, promptLine } from \"@codeworksh/aikit/oauth/interactive\";\nimport type {\n\tConnectionSummary,\n\tConnectorCategory,\n\tConnectorKind,\n\tConnectorSpec,\n\tDevicePollResult,\n\tDeviceStartResult,\n\tOAuthStartResult,\n\tOwnership,\n\tStoredAuthType,\n} from \"@codeworksh/schema/connector\";\nimport { Duration, Effect, Option, Schema } from \"effect\";\nimport * as ConnectorService from \"../../../../connector/service.ts\";\nimport * as Client from \"../../../../server/client.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport * as Service from \"../../../service.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport class ConnectCliError extends Schema.TaggedError<ConnectCliError>()(\"CLI.ConnectError\", {\n\tmessage: Schema.String,\n}) {}\n\nconst toCliError = (cause: unknown): ConnectCliError =>\n\tnew ConnectCliError({\n\t\tmessage:\n\t\t\ttypeof cause === \"object\" && cause !== null && \"message\" in cause && typeof cause.message === \"string\"\n\t\t\t\t? cause.message\n\t\t\t\t: String(cause),\n\t});\n\nconst mapErr = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, ConnectCliError, R> =>\n\teffect.pipe(Effect.mapError(toCliError));\n\nexport interface ConnectApi {\n\treadonly catalog: (input: {\n\t\treadonly kind?: ConnectorKind | undefined;\n\t\treadonly category?: string | undefined;\n\t\treadonly query?: string | undefined;\n\t\treadonly refresh?: boolean | undefined;\n\t}) => Effect.Effect<\n\t\t{\n\t\t\treadonly schemaVersion: 1;\n\t\t\treadonly generatedAt: string;\n\t\t\treadonly categories: ReadonlyArray<ConnectorCategory>;\n\t\t\treadonly connectors: ReadonlyArray<ConnectorSpec>;\n\t\t},\n\t\tConnectCliError\n\t>;\n\treadonly list: (input: {\n\t\treadonly kind?: ConnectorKind | undefined;\n\t\treadonly connectorId?: string | undefined;\n\t\treadonly enabled?: boolean | undefined;\n\t\treadonly includeEnv?: boolean | undefined;\n\t}) => Effect.Effect<ReadonlyArray<ConnectionSummary>, ConnectCliError>;\n\treadonly get: (ref: string) => Effect.Effect<ConnectionSummary, ConnectCliError>;\n\treadonly create: (input: {\n\t\treadonly connector: string;\n\t\treadonly slug?: string | undefined;\n\t\treadonly label?: string | undefined;\n\t\treadonly authType?: StoredAuthType | undefined;\n\t\treadonly ownership?: Ownership | undefined;\n\t}) => Effect.Effect<ConnectionSummary, ConnectCliError>;\n\treadonly remove: (ref: string) => Effect.Effect<boolean, ConnectCliError>;\n\treadonly setApiKey: (ref: string, apiKey: string) => Effect.Effect<ConnectionSummary, ConnectCliError>;\n\treadonly disconnect: (ref: string) => Effect.Effect<ConnectionSummary, ConnectCliError>;\n\treadonly oauthStart: (input: {\n\t\treadonly ref: string;\n\t\treadonly redirectUrl: string;\n\t}) => Effect.Effect<OAuthStartResult, ConnectCliError>;\n\treadonly oauthFinish: (input: {\n\t\treadonly state: string;\n\t\treadonly code: string;\n\t}) => Effect.Effect<ConnectionSummary, ConnectCliError>;\n\treadonly deviceStart: (input: {\n\t\treadonly ref: string;\n\t\treadonly enterpriseUrl?: string | undefined;\n\t}) => Effect.Effect<DeviceStartResult, ConnectCliError>;\n\treadonly devicePoll: (state: string) => Effect.Effect<DevicePollResult, ConnectCliError>;\n}\n\n/**\n * Runs an operation against either a running RPC server (`--server`) or the local `<home>/connections.db`.\n */\nexport const withConnectApi = <A, R = never>(\n\tserver: Option.Option<string>,\n\tfn: (api: ConnectApi) => Effect.Effect<A, ConnectCliError, R>,\n) =>\n\tEffect.gen(function* () {\n\t\tif (Option.isSome(server)) {\n\t\t\treturn yield* Effect.gen(function* () {\n\t\t\t\tconst rpc = yield* Client.make;\n\t\t\t\tconst api: ConnectApi = {\n\t\t\t\t\tcatalog: (input) => mapErr(rpc[\"connectors.catalog\"](input)),\n\t\t\t\t\tlist: (input) => mapErr(rpc[\"connections.list\"](input)),\n\t\t\t\t\tget: (ref) => mapErr(rpc[\"connections.get\"]({ ref })),\n\t\t\t\t\tcreate: (input) => mapErr(rpc[\"connections.create\"](input)),\n\t\t\t\t\tremove: (ref) => mapErr(rpc[\"connections.remove\"]({ ref }).pipe(Effect.map((r) => r.removed))),\n\t\t\t\t\tsetApiKey: (ref, apiKey) => mapErr(rpc[\"connections.setApiKey\"]({ ref, apiKey })),\n\t\t\t\t\tdisconnect: (ref) => mapErr(rpc[\"connections.disconnect\"]({ ref })),\n\t\t\t\t\toauthStart: (input) => mapErr(rpc[\"connections.oauth.start\"](input)),\n\t\t\t\t\toauthFinish: (input) => mapErr(rpc[\"connections.oauth.finish\"](input)),\n\t\t\t\t\tdeviceStart: (input) => mapErr(rpc[\"connections.oauth.deviceStart\"](input)),\n\t\t\t\t\tdevicePoll: (state) => mapErr(rpc[\"connections.oauth.devicePoll\"]({ state })),\n\t\t\t\t};\n\t\t\t\treturn yield* fn(api);\n\t\t\t}).pipe(Effect.scoped, Service.connect(server.value));\n\t\t}\n\n\t\tconst shared = yield* Cmd.spec;\n\t\tconst layer = ConnectorService.layer(Option.isNone(shared.home) ? {} : { home: shared.home.value });\n\t\treturn yield* Effect.gen(function* () {\n\t\t\tconst svc = yield* ConnectorService.Service;\n\t\t\tconst api: ConnectApi = {\n\t\t\t\tcatalog: (input) => mapErr(svc.catalog(input)),\n\t\t\t\tlist: (input) => mapErr(svc.list(input)),\n\t\t\t\tget: (ref) => mapErr(svc.get(ref)),\n\t\t\t\tcreate: (input) => mapErr(svc.create(input)),\n\t\t\t\tremove: (ref) => mapErr(svc.remove(ref)),\n\t\t\t\tsetApiKey: (ref, apiKey) => mapErr(svc.setApiKey(ref, apiKey)),\n\t\t\t\tdisconnect: (ref) => mapErr(svc.disconnect(ref)),\n\t\t\t\toauthStart: (input) => mapErr(svc.oauthStart(input)),\n\t\t\t\toauthFinish: (input) => mapErr(svc.oauthFinish(input)),\n\t\t\t\tdeviceStart: (input) => mapErr(svc.deviceStart(input)),\n\t\t\t\tdevicePoll: (state) => mapErr(svc.devicePoll(state)),\n\t\t\t};\n\t\t\treturn yield* fn(api);\n\t\t}).pipe(Effect.provide(layer));\n\t});\n\nconst replyHtml = (res: ServerResponse, status: number, html: string) =>\n\tres.writeHead(status, { \"content-type\": \"text/html; charset=utf-8\", \"cache-control\": \"no-store\" }).end(html);\n\nconst PER_SERVER_CALLBACK = /^\\/oauth\\/callback\\/[A-Za-z0-9_-]{12}$/;\n\nconst startLoopback = (opts: {\n\treadonly host: string;\n\treadonly redirectHost: string;\n\treadonly port: number;\n\treadonly path: string;\n}) =>\n\tnew Promise<{\n\t\treadonly redirectUrl: string;\n\t\treadonly wait: (expectedState: string, expectedPath: string, signal: AbortSignal) => Promise<string>;\n\t\treadonly close: () => void;\n\t}>((resolve, reject) => {\n\t\tconst server = createServer();\n\t\tlet pending:\n\t\t\t| {\n\t\t\t\t\treadonly state: string;\n\t\t\t\t\treadonly expectedPath: string;\n\t\t\t\t\treadonly done: (callbackUrl: string) => void;\n\t\t\t\t\treadonly fail: (err: Error) => void;\n\t\t\t }\n\t\t\t| undefined;\n\n\t\tserver.on(\"request\", (req, res) => {\n\t\t\tconst addr = server.address();\n\t\t\tconst port = addr !== null && typeof addr === \"object\" ? addr.port : opts.port;\n\t\t\tconst defaultHost = `${opts.redirectHost}:${port}`;\n\t\t\tconst rawHost = req.headers.host?.trim().toLowerCase();\n\t\t\tconst allowedHosts = new Set([\n\t\t\t\tdefaultHost.toLowerCase(),\n\t\t\t\t...(opts.redirectHost === \"127.0.0.1\" ? [`localhost:${port}`] : []),\n\t\t\t]);\n\t\t\tconst effectiveHost = rawHost !== undefined && allowedHosts.has(rawHost) ? rawHost : defaultHost;\n\t\t\tconst url = new URL(req.url ?? \"/\", `http://${effectiveHost}`);\n\t\t\tconst pathAccepted =\n\t\t\t\turl.pathname === opts.path || (opts.path === \"/oauth/callback\" && PER_SERVER_CALLBACK.test(url.pathname));\n\t\t\tif (!pathAccepted) return replyHtml(res, 404, oauthErrorHtml(\"Not found.\"));\n\t\t\tconst state = url.searchParams.get(\"state\");\n\t\t\tif (!pending || state !== pending.state) {\n\t\t\t\treturn replyHtml(res, 400, oauthErrorHtml(\"Invalid or expired OAuth state.\"));\n\t\t\t}\n\t\t\tconst current = pending;\n\t\t\tpending = undefined;\n\t\t\tif (url.pathname !== current.expectedPath) {\n\t\t\t\tcurrent.fail(new Error(\"The authorization response arrived on another redirect URI\"));\n\t\t\t\treturn replyHtml(res, 400, oauthErrorHtml(\"Unexpected redirect URI.\"));\n\t\t\t}\n\t\t\tconst error = url.searchParams.get(\"error\");\n\t\t\tconst code = url.searchParams.get(\"code\");\n\t\t\tif (error !== null) {\n\t\t\t\tconst desc = url.searchParams.get(\"error_description\") ?? error;\n\t\t\t\tcurrent.fail(new Error(desc));\n\t\t\t\treturn replyHtml(res, 200, oauthErrorHtml(\"Sign-in failed. You may close this window.\", desc));\n\t\t\t}\n\t\t\tif (code === null || code.length === 0) {\n\t\t\t\tcurrent.fail(new Error(\"Missing authorization code\"));\n\t\t\t\treturn replyHtml(res, 400, oauthErrorHtml(\"Missing authorization code.\"));\n\t\t\t}\n\t\t\tcurrent.done(url.href);\n\t\t\treturn replyHtml(res, 200, oauthSuccessHtml(\"Connected to CodeWork. You may close this window.\"));\n\t\t});\n\n\t\tserver.once(\"error\", (err) => reject(err));\n\t\tserver.listen(opts.port, opts.host, () => {\n\t\t\tconst addr = server.address();\n\t\t\tif (addr === null || typeof addr !== \"object\") {\n\t\t\t\tserver.close();\n\t\t\t\treject(new Error(\"Failed to bind loopback callback server\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve({\n\t\t\t\tredirectUrl: `http://${opts.redirectHost}:${addr.port}${opts.path}`,\n\t\t\t\twait: (expectedState, expectedPath, signal) =>\n\t\t\t\t\tnew Promise<string>((done, fail) => {\n\t\t\t\t\t\tif (signal.aborted) {\n\t\t\t\t\t\t\tfail(new Error(\"Cancelled\"));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst onAbort = () => {\n\t\t\t\t\t\t\tif (pending?.state === expectedState) pending = undefined;\n\t\t\t\t\t\t\tfail(new Error(\"Cancelled\"));\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\t\t\t\t\tpending = {\n\t\t\t\t\t\t\tstate: expectedState,\n\t\t\t\t\t\t\texpectedPath,\n\t\t\t\t\t\t\tdone: (callbackUrl) => {\n\t\t\t\t\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\t\tdone(callbackUrl);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfail: (err) => {\n\t\t\t\t\t\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\t\t\t\t\t\tfail(err);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t}),\n\t\t\t\tclose: () => {\n\t\t\t\t\tserver.close();\n\t\t\t\t\tserver.closeIdleConnections();\n\t\t\t\t},\n\t\t\t});\n\t\t});\n\t});\n\nexport interface AuthenticateOptions {\n\treadonly apiKey?: string | undefined;\n\treadonly device?: boolean | undefined;\n\treadonly enterpriseUrl?: string | undefined;\n\treadonly browser?: boolean | undefined;\n}\n\n/**\n * Runs the interactive authentication flow (API key, OAuth PKCE loopback raced with paste, or device code)\n * for an existing Connection via `api`.\n */\nexport const authenticateConnection = (\n\tapi: ConnectApi,\n\tconnection: ConnectionSummary,\n\tspec: ConnectorSpec | undefined,\n\toptions: AuthenticateOptions,\n): Effect.Effect<ConnectionSummary, ConnectCliError> =>\n\tEffect.gen(function* () {\n\t\tif (connection.authType === \"apikey\") {\n\t\t\tconst key =\n\t\t\t\toptions.apiKey ??\n\t\t\t\t(yield* Effect.tryPromise({\n\t\t\t\t\ttry: () =>\n\t\t\t\t\t\tpromptLine(\n\t\t\t\t\t\t\t`Enter API key for ${connection.uid}${spec?.auth.apikey?.keyUrl ? ` (${spec.auth.apikey.keyUrl})` : \"\"}: `,\n\t\t\t\t\t\t),\n\t\t\t\t\tcatch: toCliError,\n\t\t\t\t}));\n\t\t\treturn yield* api.setApiKey(connection.uid, key);\n\t\t}\n\n\t\tif (connection.authType !== \"oauth\") {\n\t\t\treturn connection;\n\t\t}\n\n\t\tconst oauthSpec = spec?.auth.oauth;\n\t\tconst useDevice =\n\t\t\toptions.device === true ||\n\t\t\t(oauthSpec !== undefined &&\n\t\t\t\t!oauthSpec.grants.includes(\"authorization_code\") &&\n\t\t\t\toauthSpec.grants.includes(\"device_code\"));\n\n\t\tif (useDevice) {\n\t\t\tconst started = yield* api.deviceStart({\n\t\t\t\tref: connection.uid,\n\t\t\t\tenterpriseUrl: options.enterpriseUrl,\n\t\t\t});\n\t\t\tprocess.stderr.write(`Open ${started.verificationUri} and enter code: ${started.userCode}\\n`);\n\t\t\tif (options.browser !== false) {\n\t\t\t\tvoid openBrowser(started.verificationUri, (err) => {\n\t\t\t\t\tprocess.stderr.write(`Failed to open browser: ${err.message}\\n`);\n\t\t\t\t});\n\t\t\t}\n\t\t\tlet intervalSeconds = Math.max(1, started.intervalSeconds);\n\t\t\twhile (true) {\n\t\t\t\tyield* Effect.sleep(Duration.seconds(intervalSeconds));\n\t\t\t\tconst polled = yield* api.devicePoll(started.state);\n\t\t\t\tif (polled.status === \"complete\") return polled.connection;\n\t\t\t\tif (polled.intervalSeconds !== undefined && polled.intervalSeconds > 0) {\n\t\t\t\t\tintervalSeconds = polled.intervalSeconds;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Authorization code + PKCE with loopback callback raced against manual redirect paste.\n\t\tconst isCodex = oauthSpec?.handler === \"openai-codex\";\n\t\tconst listener = yield* Effect.tryPromise({\n\t\t\ttry: () =>\n\t\t\t\tstartLoopback(\n\t\t\t\t\tisCodex\n\t\t\t\t\t\t? { host: \"127.0.0.1\", redirectHost: \"localhost\", port: 1455, path: \"/auth/callback\" }\n\t\t\t\t\t\t: { host: \"127.0.0.1\", redirectHost: \"127.0.0.1\", port: 0, path: \"/oauth/callback\" },\n\t\t\t\t),\n\t\t\tcatch: toCliError,\n\t\t});\n\n\t\ttry {\n\t\t\tconst started = yield* api.oauthStart({\n\t\t\t\tref: connection.uid,\n\t\t\t\tredirectUrl: listener.redirectUrl,\n\t\t\t});\n\t\t\tconst controller = new AbortController();\n\t\t\tconst expectedPath = new URL(started.redirectUrl).pathname;\n\t\t\tconst callbackPromise = listener.wait(started.state, expectedPath, controller.signal);\n\n\t\t\tprocess.stderr.write(`Authorize ${connection.uid} in your browser:\\n${started.authorizeUrl}\\n`);\n\t\t\tif (options.browser !== false) {\n\t\t\t\tvoid openBrowser(started.authorizeUrl, (err) => {\n\t\t\t\t\tprocess.stderr.write(`Failed to open browser: ${err.message}\\n`);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst code = yield* Effect.tryPromise({\n\t\t\t\ttry: async () => {\n\t\t\t\t\tif (!process.stdin.isTTY) {\n\t\t\t\t\t\treturn await callbackPromise;\n\t\t\t\t\t}\n\t\t\t\t\tconst manualPromise = promptLine(\"Waiting for browser callback (or paste redirected URL here): \");\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn await Promise.race([callbackPromise, manualPromise]);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tcontroller.abort();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tcatch: toCliError,\n\t\t\t});\n\n\t\t\treturn yield* api.oauthFinish({ state: started.state, code });\n\t\t} finally {\n\t\t\tlistener.close();\n\t\t}\n\t});\n\nexport const printJson = (value: unknown) => writeOut(`${JSON.stringify(value, null, 2)}\\n`);\n\nexport const formatConnectionLine = (c: ConnectionSummary): string => {\n\tconst flags: Array<string> = [c.status, c.sourceLabel];\n\tif (c.isDefault) flags.push(\"default\");\n\tif (!c.enabled) flags.push(\"disabled\");\n\tif (c.readOnly) flags.push(\"read-only\");\n\tconst account = c.accountLabel ? ` [${c.accountLabel}]` : \"\";\n\treturn `${c.uid}${account} (${flags.join(\", \")})`;\n};\n"],"mappings":";;;;;;;;AAyBA,IAAa,kBAAb,cAAqC,OAAO,YAA6B,CAAC,CAAC,oBAAoB,EAC9F,SAAS,OAAO,OACjB,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,cAAc,UACnB,IAAI,gBAAgB,EACnB,SACC,OAAO,UAAU,YAAY,UAAU,QAAQ,aAAa,SAAS,OAAO,MAAM,YAAY,WAC3F,MAAM,UACN,OAAO,KAAK,EACjB,CAAC;AAEF,MAAM,UAAmB,WACxB,OAAO,KAAK,OAAO,SAAS,UAAU,CAAC;;;;AAoDxC,MAAa,kBACZ,QACA,OAEA,OAAO,IAAI,aAAa;CACvB,IAAI,OAAO,OAAO,MAAM,GACvB,OAAO,OAAO,OAAO,IAAI,aAAa;EACrC,MAAM,MAAM,OAAOA;EAcnB,OAAO,OAAO,GAAG;GAZhB,UAAU,UAAU,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC;GAC3D,OAAO,UAAU,OAAO,IAAI,mBAAmB,CAAC,KAAK,CAAC;GACtD,MAAM,QAAQ,OAAO,IAAI,kBAAkB,CAAC,EAAE,IAAI,CAAC,CAAC;GACpD,SAAS,UAAU,OAAO,IAAI,qBAAqB,CAAC,KAAK,CAAC;GAC1D,SAAS,QAAQ,OAAO,IAAI,qBAAqB,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,KAAK,MAAM,EAAE,OAAO,CAAC,CAAC;GAC7F,YAAY,KAAK,WAAW,OAAO,IAAI,wBAAwB,CAAC;IAAE;IAAK;GAAO,CAAC,CAAC;GAChF,aAAa,QAAQ,OAAO,IAAI,yBAAyB,CAAC,EAAE,IA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ACrC,IAAI,EAAE,UAAU,MAAM,KAAK,WAAW;CACtC,MAAM,UAAU,EAAE,eAAe,KAAK,EAAE,aAAa,KAAK;CAC1D,OAAO,GAAG,EAAE,MAAM,QAAQ,KAAK,MAAM,KAAK,IAAI,EAAE;AACjD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as InvalidInputError } from "./error-BsI8iNna.mjs";
|
|
2
|
-
import { i as Cmd } from "./runtime-
|
|
2
|
+
import { i as Cmd } from "./runtime-CyXV7HH_.mjs";
|
|
3
3
|
import { n as read } from "./jsonc-BtRExpz3.mjs";
|
|
4
4
|
import { Effect, Option, Path, Predicate } from "effect";
|
|
5
5
|
import { Global, McpConfig, McpOAuth, Settings } from "@codeworksh/harness/effect";
|
|
@@ -70,7 +70,7 @@ const oauthServer = Effect.fn("CLI.mcp.oauthServer")(function* (name) {
|
|
|
70
70
|
}
|
|
71
71
|
const config = entry.config;
|
|
72
72
|
if (!("url" in config)) return yield* new InvalidInputError({ message: `MCP server "${name}" runs over stdio; only HTTP servers sign in` });
|
|
73
|
-
if (config.auth !== void 0) return yield* new InvalidInputError({ message: `MCP server "${name}" sends the credential of provider "${config.auth.provider}"; sign in to the provider with codework auth login` });
|
|
73
|
+
if (config.auth !== void 0) return yield* new InvalidInputError({ message: "connection" in config.auth ? `MCP server "${name}" uses connector connection "${config.auth.connection}"; sign in with codework connect login ${config.auth.connection}` : `MCP server "${name}" sends the credential of provider "${config.auth.provider}"; sign in to the provider with codework auth login` });
|
|
74
74
|
if (Object.keys(config.headers ?? {}).some((header) => header.toLowerCase() === "authorization")) return yield* new InvalidInputError({ message: `MCP server "${name}" sends its own Authorization header; remove it to sign in with OAuth` });
|
|
75
75
|
return {
|
|
76
76
|
store: McpOAuth.store(home),
|
|
@@ -85,4 +85,4 @@ const oauthServer = Effect.fn("CLI.mcp.oauthServer")(function* (name) {
|
|
|
85
85
|
//#endregion
|
|
86
86
|
export { readServers as a, oauthServer as i, configured as n, describe as r, MARKS as t };
|
|
87
87
|
|
|
88
|
-
//# sourceMappingURL=shared-
|
|
88
|
+
//# sourceMappingURL=shared-D_MVXtOf.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-
|
|
1
|
+
{"version":3,"file":"shared-D_MVXtOf.mjs","names":["Jsonc.read"],"sources":["../../src/cli/cmd/handlers/mcp/shared.ts"],"sourcesContent":["import { type EventList, Global, type Mcp, McpConfig, McpOAuth, Settings } from \"@codeworksh/harness/effect\";\nimport { Effect, Option, Path, Predicate } from \"effect\";\nimport { InvalidInputError } from \"../../../error.ts\";\nimport * as Jsonc from \"../../../jsonc.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\n/**\n * Where this directory's `mcp.json` files are: the user one in the home, or the `--user-config-dir`\n * that replaces it, and the project's under the nearest `.codework`, or this directory's when there\n * is none. Then what they configure.\n */\nexport const configured = Effect.fn(\"CLI.mcp.configured\")(function* () {\n\tconst shared = yield* Cmd.spec;\n\tconst path = yield* Path.Path;\n\tconst hostCwd = path.resolve(\".\");\n\tconst paths = yield* Global.resolve(Option.isNone(shared.home) ? {} : { home: shared.home.value });\n\tconst root = yield* Settings.projectRoot(hostCwd, paths.home);\n\tconst userDir = Option.isNone(shared.userConfigDir)\n\t\t? paths.home\n\t\t: Settings.userConfigDir(shared.userConfigDir.value, hostCwd);\n\tconst loaded = yield* McpConfig.load({ userDir, root });\n\treturn {\n\t\thome: paths.home,\n\t\tauthFile: Global.authFile(Option.isNone(shared.home) ? undefined : paths.home),\n\t\thostCwd,\n\t\troot,\n\t\tuser: path.join(userDir, \"mcp.json\"),\n\t\tproject: path.join(root ?? hostCwd, Global.appConfigDir, \"mcp.json\"),\n\t\t...loaded,\n\t};\n});\n\nexport const MARKS: Record<Mcp.State, string> = {\n\tconnected: \"✓\",\n\tauthenticate: \"⚠\",\n\tfailed: \"✗\",\n\tconnecting: \"○\",\n\tdisconnected: \"○\",\n\tdisabled: \"○\",\n};\n\nconst plural = (count: number, noun: string) => `${count} ${noun}${count === 1 ? \"\" : \"s\"}`;\n\n/** A server's state as the commands print it, with the tools its listing left out. */\nexport const describe = (state: Mcp.State, tools: number, skipped?: EventList.McpSkipped) => {\n\tif (state !== \"connected\") return state;\n\tconst connected = `connected, ${plural(tools, \"tool\")}`;\n\tif (skipped === undefined) return connected;\n\tconst left = [...skipped.names, ...(skipped.unnamed === 0 ? [] : [plural(skipped.unnamed, \"unnamed tool\")])];\n\treturn `${connected} — skipped ${left.join(\", \")}`;\n};\n\n/** The `mcpServers` of one `mcp.json`, and the text an edit rewrites. */\nexport const readServers = Effect.fn(\"CLI.mcp.readServers\")(function* (path: string) {\n\tconst { source, document } = yield* Jsonc.read(path, \"mcp.json\");\n\tconst servers = document.mcpServers ?? {};\n\tif (!Predicate.isObject(servers) || Array.isArray(servers))\n\t\treturn yield* new InvalidInputError({ message: `${path}: expected an object with an \"mcpServers\" object` });\n\treturn { source, servers: servers as Record<string, unknown> };\n});\n\n/**\n * The OAuth server `name` names in the `mcp.json` this directory reads, the user file and the\n * project's, and the credential store of the home. A server that sends a credential of its own\n * never signs in.\n */\nexport const oauthServer = Effect.fn(\"CLI.mcp.oauthServer\")(function* (name: string) {\n\tconst { home, servers, errors } = yield* configured();\n\tconst entry = servers.find((server) => server.name === name);\n\tif (entry === undefined) {\n\t\tconst problems = errors.length === 0 ? \"\" : `\\n${errors.join(\"\\n\")}`;\n\t\treturn yield* new InvalidInputError({ message: `no MCP server named \"${name}\" in mcp.json${problems}` });\n\t}\n\tconst config = entry.config;\n\tif (!(\"url\" in config))\n\t\treturn yield* new InvalidInputError({\n\t\t\tmessage: `MCP server \"${name}\" runs over stdio; only HTTP servers sign in`,\n\t\t});\n\tif (config.auth !== undefined)\n\t\treturn yield* new InvalidInputError({\n\t\t\tmessage:\n\t\t\t\t\"connection\" in config.auth\n\t\t\t\t\t? `MCP server \"${name}\" uses connector connection \"${config.auth.connection}\"; sign in with codework connect login ${config.auth.connection}`\n\t\t\t\t\t: `MCP server \"${name}\" sends the credential of provider \"${config.auth.provider}\"; sign in to the provider with codework auth login`,\n\t\t});\n\tif (Object.keys(config.headers ?? {}).some((header) => header.toLowerCase() === \"authorization\"))\n\t\treturn yield* new InvalidInputError({\n\t\t\tmessage: `MCP server \"${name}\" sends its own Authorization header; remove it to sign in with OAuth`,\n\t\t});\n\treturn {\n\t\tstore: McpOAuth.store(home),\n\t\tserver: { name, url: config.url, oauth: config.oauth },\n\t\tconfig,\n\t};\n});\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,aAAa,OAAO,GAAG,oBAAoB,CAAC,CAAC,aAAa;CACtE,MAAM,SAAS,OAAO,IAAI;CAC1B,MAAM,OAAO,OAAO,KAAK;CACzB,MAAM,UAAU,KAAK,QAAQ,GAAG;CAChC,MAAM,QAAQ,OAAO,OAAO,QAAQ,OAAO,OAAO,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,OAAO,KAAK,MAAM,CAAC;CACjG,MAAM,OAAO,OAAO,SAAS,YAAY,SAAS,MAAM,IAAI;CAC5D,MAAM,UAAU,OAAO,OAAO,OAAO,aAAa,IAC/C,MAAM,OACN,SAAS,cAAc,OAAO,cAAc,OAAO,OAAO;CAC7D,MAAM,SAAS,OAAO,UAAU,KAAK;EAAE;EAAS;CAAK,CAAC;CACtD,OAAO;EACN,MAAM,MAAM;EACZ,UAAU,OAAO,SAAS,OAAO,OAAO,OAAO,IAAI,IAAI,KAAA,IAAY,MAAM,IAAI;EAC7E;EACA;EACA,MAAM,KAAK,KAAK,SAAS,UAAU;EACnC,SAAS,KAAK,KAAK,QAAQ,SAAS,OAAO,cAAc,UAAU;EACnE,GAAG;CACJ;AACD,CAAC;AAED,MAAa,QAAmC;CAC/C,WAAW;CACX,cAAc;CACd,QAAQ;CACR,YAAY;CACZ,cAAc;CACd,UAAU;AACX;AAEA,MAAM,UAAU,OAAe,SAAiB,GAAG,MAAM,GAAG,OAAO,UAAU,IAAI,KAAK;;AAGtF,MAAa,YAAY,OA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yCAAyC,OAAO,KAAK,eAC/H,eAAe,KAAK,sCAAsC,OAAO,KAAK,SAAS,qDACpF,CAAC;CACF,IAAI,OAAO,KAAK,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,WAAW,OAAO,YAAY,MAAM,eAAe,GAC9F,OAAO,OAAO,IAAI,kBAAkB,EACnC,SAAS,eAAe,KAAK,uEAC9B,CAAC;CACF,OAAO;EACN,OAAO,SAAS,MAAM,IAAI;EAC1B,QAAQ;GAAE;GAAM,KAAK,OAAO;GAAK,OAAO,OAAO;EAAM;EACrD;CACD;AACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as reportFailure, m as writeOut } from "./error-BsI8iNna.mjs";
|
|
2
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
3
|
-
import { r as options } from "./service-
|
|
4
|
-
import { n as ensure } from "./discovery-
|
|
2
|
+
import { i as Cmd, t as handler } from "./runtime-CyXV7HH_.mjs";
|
|
3
|
+
import { r as options } from "./service-YVNwFMNf.mjs";
|
|
4
|
+
import { n as ensure } from "./discovery-C6H7dCHz.mjs";
|
|
5
5
|
import { Effect } from "effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/service/start.ts
|
|
7
7
|
var start_default = handler(Cmd.commands.service.commands.start, Effect.fn("CLI.service.start")(function* ({ host, port }) {
|
|
@@ -18,4 +18,4 @@ var start_default = handler(Cmd.commands.service.commands.start, Effect.fn("CLI.
|
|
|
18
18
|
//#endregion
|
|
19
19
|
export { start_default as default };
|
|
20
20
|
|
|
21
|
-
//# sourceMappingURL=start-
|
|
21
|
+
//# sourceMappingURL=start-Dky5Iihf.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-
|
|
1
|
+
{"version":3,"file":"start-Dky5Iihf.mjs","names":["Runtime.handler","options","Service.options","Discovery.ensure"],"sources":["../../src/cli/cmd/handlers/service/start.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport * as Discovery from \"../../../../server/discovery.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport * as Service from \"../../../service.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.service.commands.start,\n\tEffect.fn(\"CLI.service.start\")(function* ({ host, port }) {\n\t\tconst options = yield* Service.options(yield* Cmd.spec, { host, port });\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,gBAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,OAC9B,OAAO,GAAG,mBAAmB,CAAC,CAAC,WAAW,EAAE,MAAM,QAAQ;CACzD,MAAMC,YAAU,OAAOC,QAAgB,OAAO,IAAI,MAAM;EAAE;EAAM;CAAK,CAAC;CACtE,MAAM,SAAS,OAAOC,OAAiB;EAAE,GAAGF;EAAS,SAAS;CAAK,CAAC;CACpE,OAAO,SAAS,GAAG,OAAO,IAAI,GAAG;AAClC,GAAG,OAAO,MAAM,aAAa,CAAC,CAC/B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { a as reportFailure, m as writeOut } from "./error-BsI8iNna.mjs";
|
|
2
|
+
import { i as Cmd, t as handler } from "./runtime-CyXV7HH_.mjs";
|
|
3
|
+
import { i as withConnectApi, n as formatConnectionLine, r as printJson } from "./shared-CXbDdgs4.mjs";
|
|
4
|
+
import { Effect } from "effect";
|
|
5
|
+
//#region src/cli/cmd/handlers/connect/status.ts
|
|
6
|
+
var status_default = handler(Cmd.commands.connect.commands.status, Effect.fn("CLI.connect.status")(function* ({ ref, server, json }) {
|
|
7
|
+
return yield* withConnectApi(server, (api) => Effect.gen(function* () {
|
|
8
|
+
const item = yield* api.get(ref);
|
|
9
|
+
if (json) {
|
|
10
|
+
yield* printJson(item);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
yield* writeOut(`${formatConnectionLine(item)}\n`);
|
|
14
|
+
yield* writeOut(` id: ${item.id}\n`);
|
|
15
|
+
yield* writeOut(` connector: ${item.connectorId}\n`);
|
|
16
|
+
yield* writeOut(` kinds: ${item.kinds.join(", ")}\n`);
|
|
17
|
+
if (item.lastError) yield* writeOut(` error: ${item.lastError}\n`);
|
|
18
|
+
})).pipe(Effect.catch(reportFailure));
|
|
19
|
+
}));
|
|
20
|
+
//#endregion
|
|
21
|
+
export { status_default as default };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=status-B29jKo_s.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-B29jKo_s.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/connect/status.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { formatConnectionLine, printJson, withConnectApi } from \"./shared.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.connect.commands.status,\n\tEffect.fn(\"CLI.connect.status\")(function* ({ ref, server, json }) {\n\t\tconst program = withConnectApi(server, (api) =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst item = yield* api.get(ref);\n\t\t\t\tif (json) {\n\t\t\t\t\tyield* printJson(item);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tyield* writeOut(`${formatConnectionLine(item)}\\n`);\n\t\t\t\tyield* writeOut(` id: ${item.id}\\n`);\n\t\t\t\tyield* writeOut(` connector: ${item.connectorId}\\n`);\n\t\t\t\tyield* writeOut(` kinds: ${item.kinds.join(\", \")}\\n`);\n\t\t\t\tif (item.lastError) yield* writeOut(` error: ${item.lastError}\\n`);\n\t\t\t}),\n\t\t);\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;AAOA,IAAA,iBAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,QAC9B,OAAO,GAAG,oBAAoB,CAAC,CAAC,WAAW,EAAE,KAAK,QAAQ,QAAQ;CAejE,OAAO,OAdS,eAAe,SAAS,QACvC,OAAO,IAAI,aAAa;EACvB,MAAM,OAAO,OAAO,IAAI,IAAI,GAAG;EAC/B,IAAI,MAAM;GACT,OAAO,UAAU,IAAI;GACrB;EACD;EACA,OAAO,SAAS,GAAG,qBAAqB,IAAI,EAAE,GAAG;EACjD,OAAO,SAAS,SAAS,KAAK,GAAG,GAAG;EACpC,OAAO,SAAS,gBAAgB,KAAK,YAAY,GAAG;EACpD,OAAO,SAAS,YAAY,KAAK,MAAM,KAAK,IAAI,EAAE,GAAG;EACrD,IAAI,KAAK,WAAW,OAAO,SAAS,YAAY,KAAK,UAAU,GAAG;CACnE,CAAC,CAEkB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as reportFailure, g as make, m as writeOut, n as OAuthError } from "./error-BsI8iNna.mjs";
|
|
2
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
3
|
-
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-
|
|
2
|
+
import { i as Cmd, t as handler } from "./runtime-CyXV7HH_.mjs";
|
|
3
|
+
import { a as oauthProviderLabel, n as attempt, o as selectProvider, r as localOps, s as withServer, t as assertServerScope } from "./shared-CDJQxUb9.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { formatOAuthSummary, oauthNotice } from "@codeworksh/aikit/oauth/summary";
|
|
6
6
|
//#region src/cli/cmd/handlers/auth/status.ts
|
|
@@ -28,4 +28,4 @@ var status_default = handler(Cmd.commands.auth.commands.status, Effect.fn("CLI.a
|
|
|
28
28
|
//#endregion
|
|
29
29
|
export { status_default as default };
|
|
30
30
|
|
|
31
|
-
//# sourceMappingURL=status-
|
|
31
|
+
//# sourceMappingURL=status-BoTZqXwd.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-
|
|
1
|
+
{"version":3,"file":"status-BoTZqXwd.mjs","names":["Runtime.handler","Client.make"],"sources":["../../src/cli/cmd/handlers/auth/status.ts"],"sourcesContent":["import { formatOAuthSummary, oauthNotice } from \"@codeworksh/aikit/oauth/summary\";\nimport { Effect, Option } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { OAuthError, reportFailure } from \"../../../error.ts\";\nimport { 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.status,\n\tEffect.fn(\"CLI.auth.status\")(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 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.status\"]({ 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* 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.stored());\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* writeOut(formatOAuthSummary(summary, { json }));\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,UAAU,QAAQ;CA4B/F,OAAO,OA3BS,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,MAAM,OAAO,QAAO,OADDC,KAAAA,CACK,cAAc,CAAC,EAAE,SAAS,CAAC;IACnD,IAAI,SAAS,MACZ,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,YAAY,EAAE,CAAC;IAEzF,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,OAAO,CAAC;EACvF,IAAI,YAAY,KAAA,GACf,OAAO,OAAO,IAAI,WAAW,EAAE,SAAS,YAAY,WAAW,UAAU,IAAI,IAAI,EAAE,CAAC;EAErF,OAAO,SAAS,mBAAmB,SAAS,EAAE,KAAK,CAAC,CAAC;CACtD,CAEoB,CAAC,CAAC,KAAK,OAAO,MAAM,aAAa,CAAC;AACvD,CAAC,CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as reportFailure, m as writeOut } from "./error-BsI8iNna.mjs";
|
|
2
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
3
|
-
import { n as home } from "./service-
|
|
4
|
-
import { t as discover } from "./discovery-
|
|
2
|
+
import { i as Cmd, t as handler } from "./runtime-CyXV7HH_.mjs";
|
|
3
|
+
import { n as home } from "./service-YVNwFMNf.mjs";
|
|
4
|
+
import { t as discover } from "./discovery-C6H7dCHz.mjs";
|
|
5
5
|
import { Effect } from "effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/service/status.ts
|
|
7
7
|
var status_default = handler(Cmd.commands.service.commands.status, Effect.fn("CLI.service.status")(function* () {
|
|
@@ -12,4 +12,4 @@ var status_default = handler(Cmd.commands.service.commands.status, Effect.fn("CL
|
|
|
12
12
|
//#endregion
|
|
13
13
|
export { status_default as default };
|
|
14
14
|
|
|
15
|
-
//# sourceMappingURL=status-
|
|
15
|
+
//# sourceMappingURL=status-CdAZIIEi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-
|
|
1
|
+
{"version":3,"file":"status-CdAZIIEi.mjs","names":["Runtime.handler","Service.home","Discovery.discover"],"sources":["../../src/cli/cmd/handlers/service/status.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport * as Discovery from \"../../../../server/discovery.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport * as Service from \"../../../service.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.service.commands.status,\n\tEffect.fn(\"CLI.service.status\")(function* () {\n\t\tconst paths = yield* Service.home(yield* Cmd.spec);\n\t\tconst server = yield* Discovery.discover(paths.home);\n\t\tyield* writeOut(`${server?.url ?? \"stopped\"}\\n`);\n\t}, Effect.catch(reportFailure)),\n);\n"],"mappings":";;;;;;AAQA,IAAA,iBAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,QAC9B,OAAO,GAAG,oBAAoB,CAAC,CAAC,aAAa;CAC5C,MAAM,QAAQ,OAAOC,KAAa,OAAO,IAAI,IAAI;CACjD,MAAM,SAAS,OAAOC,SAAmB,MAAM,IAAI;CACnD,OAAO,SAAS,GAAG,QAAQ,OAAO,UAAU,GAAG;AAChD,GAAG,OAAO,MAAM,aAAa,CAAC,CAC/B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as reportFailure } from "./error-BsI8iNna.mjs";
|
|
2
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
3
|
-
import { n as home } from "./service-
|
|
4
|
-
import { r as stop } from "./discovery-
|
|
2
|
+
import { i as Cmd, t as handler } from "./runtime-CyXV7HH_.mjs";
|
|
3
|
+
import { n as home } from "./service-YVNwFMNf.mjs";
|
|
4
|
+
import { r as stop } from "./discovery-C6H7dCHz.mjs";
|
|
5
5
|
import { Effect } from "effect";
|
|
6
6
|
//#region src/cli/cmd/handlers/service/stop.ts
|
|
7
7
|
var stop_default = handler(Cmd.commands.service.commands.stop, Effect.fn("CLI.service.stop")(function* () {
|
|
@@ -11,4 +11,4 @@ var stop_default = handler(Cmd.commands.service.commands.stop, Effect.fn("CLI.se
|
|
|
11
11
|
//#endregion
|
|
12
12
|
export { stop_default as default };
|
|
13
13
|
|
|
14
|
-
//# sourceMappingURL=stop-
|
|
14
|
+
//# sourceMappingURL=stop-BCAMcHem.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop-
|
|
1
|
+
{"version":3,"file":"stop-BCAMcHem.mjs","names":["Runtime.handler","Service.home","Discovery.stop"],"sources":["../../src/cli/cmd/handlers/service/stop.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport * as Discovery from \"../../../../server/discovery.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport * as Service from \"../../../service.ts\";\nimport { Cmd } from \"../../cmd.ts\";\n\nexport default Runtime.handler(\n\tCmd.commands.service.commands.stop,\n\tEffect.fn(\"CLI.service.stop\")(function* () {\n\t\tconst paths = yield* Service.home(yield* Cmd.spec);\n\t\tyield* Discovery.stop(paths.home);\n\t}, Effect.catch(reportFailure)),\n);\n"],"mappings":";;;;;;AAOA,IAAA,eAAeA,QACd,IAAI,SAAS,QAAQ,SAAS,MAC9B,OAAO,GAAG,kBAAkB,CAAC,CAAC,aAAa;CAC1C,MAAM,QAAQ,OAAOC,KAAa,OAAO,IAAI,IAAI;CACjD,OAAOC,KAAe,MAAM,IAAI;AACjC,GAAG,OAAO,MAAM,aAAa,CAAC,CAC/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as reportFailure, m as writeOut } from "./error-BsI8iNna.mjs";
|
|
2
|
-
import { i as Cmd, t as handler } from "./runtime-
|
|
2
|
+
import { i as Cmd, t as handler } from "./runtime-CyXV7HH_.mjs";
|
|
3
3
|
import { a as targeted, i as read, n as local, r as probe, t as fetchable } from "./entries-8D1NzQXw.mjs";
|
|
4
4
|
import { Effect, Option } from "effect";
|
|
5
5
|
import { Plugin } from "@codeworksh/harness/effect";
|
|
@@ -48,4 +48,4 @@ var update_default = handler(Cmd.commands.plugin.commands.update, Effect.fn("CLI
|
|
|
48
48
|
//#endregion
|
|
49
49
|
export { update_default as default };
|
|
50
50
|
|
|
51
|
-
//# sourceMappingURL=update-
|
|
51
|
+
//# sourceMappingURL=update-mWc5cR7q.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-
|
|
1
|
+
{"version":3,"file":"update-mWc5cR7q.mjs","names":["Runtime.handler"],"sources":["../../src/cli/cmd/handlers/plugin/update.ts"],"sourcesContent":["import { Plugin } from \"@codeworksh/harness/effect\";\nimport { Effect, Option } from \"effect\";\nimport * as Runtime from \"../../../../framework/runtime.ts\";\nimport { reportFailure } from \"../../../error.ts\";\nimport { writeOut } from \"../../../output.ts\";\nimport { Cmd } from \"../../cmd.ts\";\nimport { fetchable, local, probe, read, targeted } from \"./entries.ts\";\n\n/**\n * Take whatever `check` found.\n *\n * Only a plugin that is **already installed** is refreshed: \"not installed\" is not \"outdated\", and\n * `plugin install` is the verb for that. Each refresh publishes a new generation, which a running\n * session picks up at its next exchange -- so this command never has to reach into a server.\n */\nexport default Runtime.handler(\n\tCmd.commands.plugin.commands.update,\n\tEffect.fn(\"CLI.plugin.update\")(function* ({ spec }) {\n\t\tconst program = Effect.gen(function* () {\n\t\t\tconst shared = yield* Cmd.spec;\n\t\t\tconst { entries, cache, hostDir } = yield* read(shared);\n\t\t\tconst selected = yield* targeted(entries, spec, hostDir);\n\t\t\tif (selected.length === 0 && Option.isSome(spec)) return;\n\n\t\t\tlet updated = 0;\n\t\t\tlet failed = 0;\n\t\t\tfor (const entry of selected) {\n\t\t\t\tconst target = fetchable(entry.target);\n\t\t\t\t// A local plugin has no revision to compare and is never copied into the store.\n\t\t\t\tif (target === undefined) {\n\t\t\t\t\tyield* local(entry, spec);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst result = yield* Plugin.update(target, cache, {\n\t\t\t\t\tprobe: probe(cache, entry.from),\n\t\t\t\t\tfrom: entry.from,\n\t\t\t\t\t// Validated while staged, so a refresh that fetches something broken leaves\n\t\t\t\t\t// the generation already in use as the answer. Preserve the loader's reason:\n\t\t\t\t\t// an import failure or invalid definition is not a missing entrypoint.\n\t\t\t\t\tvalidate: (fetched) => Plugin.definition(fetched.entrypoint, entry.reference).pipe(Effect.asVoid),\n\t\t\t\t}).pipe(Effect.result);\n\n\t\t\t\tif (result._tag === \"Failure\") {\n\t\t\t\t\tfailed += 1;\n\t\t\t\t\tyield* writeOut(`${entry.reference} error[${result.failure.reason}]: ${result.failure.message}\\n`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (result.success._tag === \"updated\") {\n\t\t\t\t\tupdated += 1;\n\t\t\t\t\tyield* writeOut(`Updated ${entry.reference} to ${result.success.entry.revision ?? \"a new revision\"}\\n`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// A spec that named only local plugins compared nothing, so there is nothing to sum up.\n\t\t\tif (Option.isSome(spec) && selected.every((entry) => fetchable(entry.target) === undefined)) return;\n\t\t\tyield* writeOut(updated === 0 ? \"Nothing to update.\\n\" : `${updated} updated.\\n`);\n\t\t\tif (failed > 0) process.exitCode = 1;\n\t\t});\n\n\t\treturn yield* program.pipe(Effect.catch(reportFailure));\n\t}),\n);\n"],"mappings":";;;;;;;;;;;;;AAeA,IAAA,iBAAeA,QACd,IAAI,SAAS,OAAO,SAAS,QAC7B,OAAO,GAAG,mBAAmB,CAAC,CAAC,WAAW,EAAE,QAAQ;CA2CnD,OAAO,OA1CS,OAAO,IAAI,aAAa;EACvC,MAAM,SAAS,OAAO,IAAI;EAC1B,MAAM,EAAE,SAAS,OAAO,YAAY,OAAO,KAAK,MAAM;EACtD,MAAM,WAAW,OAAO,SAAS,SAAS,MAAM,OAAO;EACvD,IAAI,SAAS,WAAW,KAAK,OAAO,OAAO,IAAI,GAAG;EAElD,IAAI,UAAU;EACd,IAAI,SAAS;EACb,KAAK,MAAM,SAAS,UAAU;GAC7B,MAAM,SAAS,UAAU,MAAM,MAAM;GAErC,IAAI,WAAW,KAAA,GAAW;IACzB,OAAO,MAAM,OAAO,IAAI;IACxB;GACD;GAEA,MAAM,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO;IAClD,OAAO,MAAM,OAAO,MAAM,IAAI;IAC9B,MAAM,MAAM;IAIZ,WAAW,YAAY,OAAO,WAAW,QAAQ,YAAY,MAAM,SAAS,CAAC,CAAC,KAAK,OAAO,MAAM;GACjG,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM;GAErB,IAAI,OAAO,SAAS,WAAW;IAC9B,UAAU;IACV,OAAO,SAAS,GAAG,MAAM,UAAU,UAAU,OAAO,QAAQ,OAAO,KAAK,OAAO,QAAQ,QAAQ,GAAG;IAClG;GACD;GACA,IAAI,OAAO,QAAQ,SAAS,WA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