@akanjs/cli 3.1.1 → 3.1.2-rc.1
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/.build-stamp +1 -1
- package/CodeAgent-dyc45f5w.js +11 -0
- package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
- package/CodeAgentRpcListener-tcwrdvst.js +182 -0
- package/{CodeTui-h6yz2kvq.js → CodeTui-q55b2zrn.js} +25 -8
- package/TunnelShare-hdq9h1hr.js +14 -0
- package/{agent.command-3r4jsck8.js → agent.command-20zaqe60.js} +18 -15
- package/akanCode.js +8 -7
- package/{application.command-g7xv6ad0.js → application.command-nd0fshsk.js} +11 -11
- package/{applicationBuildRunner-qvjnhr9j.js → applicationBuildRunner-s13x3zqb.js} +10 -9
- package/buildBatch.proc.js +6 -6
- package/{cloud.command-6ebygmhw.js → cloud.command-8kbddsz9.js} +25 -18
- package/cloud.script-hgvvajm3.js +27 -0
- package/code.command-625bg8s8.js +345 -0
- package/{context.command-svdh6b2w.js → context.command-p6haqjay.js} +19 -18
- package/context.runner-rsnqnk9j.js +27 -0
- package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
- package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
- package/{guideline.command-qwp3tnjx.js → guideline.command-195g0h9a.js} +4 -4
- package/guidelines/agentRule/agentRule.instruction.md +22 -8
- package/guidelines/conventions/rules/auth.md +5 -4
- package/guidelines/conventions/rules/config.md +5 -1
- package/guidelines/conventions/rules/gates.md +2 -1
- package/guidelines/conventions/rules/module.md +1 -1
- package/guidelines/conventions/rules/server.md +8 -3
- package/guidelines/conventions/rules/ssr.md +2 -2
- package/guidelines/conventions/rules/tsx.md +2 -1
- package/guidelines/pageRule/pageRule.instruction.md +4 -4
- package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
- package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
- package/guidelines/transportRule/transportRule.instruction.md +5 -4
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +1 -1
- package/incrementalBuilder.proc.js +4 -4
- package/{index-w4k2ragk.js → index-00a7j05x.js} +7 -7
- package/{index-w7q6h97v.js → index-0j1t1h2b.js} +3 -1
- package/{index-payhwt51.js → index-1h2jc0x3.js} +141 -67
- package/{index-vxmy1p4f.js → index-1qsd8ft1.js} +63 -123
- package/{index-s6da8ta9.js → index-2mwjshz5.js} +158 -51
- package/index-2nxk8wgs.js +266 -0
- package/{index-k5jbcxyh.js → index-2phm56a1.js} +49 -8
- package/{index-jje9qzyq.js → index-35j83zkd.js} +37 -3
- package/{index-m5n3ka0p.js → index-4am4dvmf.js} +13 -2
- package/index-75y7bcz4.js +28 -0
- package/{index-b8c289dx.js → index-7apsdr5g.js} +55 -12
- package/{index-8559hsz4.js → index-84h43kg6.js} +6 -5
- package/{index-eja64h28.js → index-9zy8479y.js} +5 -3
- package/{index-96wzdhfh.js → index-a1vb3x7t.js} +209 -36
- package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
- package/{index-am36s3jh.js → index-cjmjvg4r.js} +157 -117
- package/{index-1p0qbq3m.js → index-defp4gmb.js} +1 -1
- package/{index-4pdts00b.js → index-ewbmfarf.js} +10 -8
- package/{index-9rvcs76p.js → index-fhw7yq2d.js} +10 -10
- package/{index-8scw1pjk.js → index-g500c5j9.js} +178 -82
- package/{index-qxzrp5xt.js → index-g841cap9.js} +4 -4
- package/{index-qkkdhjm6.js → index-gr9thy79.js} +5 -5
- package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
- package/{index-4mj92tsh.js → index-hm0tn7qv.js} +73 -68
- package/{index-r2wedvqn.js → index-j6eeh5d7.js} +1 -1
- package/{index-tgt2fnd6.js → index-j7hwy56s.js} +3 -3
- package/{index-rnphv731.js → index-jc2zbwra.js} +2 -2
- package/{index-z4b84y6k.js → index-khk05tsf.js} +1 -1
- package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
- package/{index-266dewjs.js → index-qw6814m4.js} +53 -15
- package/{index-zcf6k8a5.js → index-raz588b3.js} +47 -12
- package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
- package/{index-3yz30c07.js → index-sp0qsr7a.js} +114 -12
- package/{index-1shvxzt0.js → index-sveq36gh.js} +39 -42
- package/{index-r2w2eh93.js → index-t1t9wq9a.js} +4 -4
- package/index-t78230d7.js +191 -0
- package/{index-r0k3ham2.js → index-tgqameyb.js} +4 -4
- package/{index-dd44g6vz.js → index-tp56652m.js} +5 -5
- package/index-w15mg3km.js +389 -0
- package/{index-xq543a5y.js → index-y4kcmbt2.js} +2 -2
- package/index-yf9wc28h.js +52 -0
- package/{index-xqgwjz7a.js → index-zbrwnmf1.js} +9 -7
- package/{index-xxfy1jp2.js → index-zttm13c3.js} +4 -4
- package/index.js +24 -24
- package/{library.command-2853y6mk.js → library.command-63hgt9te.js} +4 -4
- package/{localRegistry.command-76ds31p4.js → localRegistry.command-g3f8k25t.js} +43 -23
- package/{module.command-yfnb0abs.js → module.command-r4sa2khp.js} +7 -6
- package/{package.command-d9s86hp9.js → package.command-96eheyvd.js} +5 -5
- package/package.json +2 -2
- package/{page.command-6a8a8rd1.js → page.command-gs6d841d.js} +4 -4
- package/{pipeline.command-rt3rwd2z.js → pipeline.command-wdfvdbfj.js} +3 -3
- package/{primitive.command-emcebgrq.js → primitive.command-dfsv4mpe.js} +8 -7
- package/{projectTypecheck-51m7eh1f.js → projectTypecheck-kqj1t6hb.js} +1 -1
- package/{prompter-hgcta8pb.js → prompter-qrwx1p17.js} +2 -2
- package/{quality.command-xtrk0n3x.js → quality.command-webzxee2.js} +6 -4
- package/{repair.command-51szxnxx.js → repair.command-3r3j1xre.js} +7 -6
- package/{scalar.command-8qv27t82.js → scalar.command-e8y47j6d.js} +6 -5
- package/skills/akan-agent/SKILL.md +8 -1
- package/skills/akan-code/SKILL.md +37 -11
- package/skills/akan-debug/SKILL.md +2 -1
- package/skills/akan-err/SKILL.md +2 -1
- package/skills/akan-query/SKILL.md +3 -2
- package/skills/akan-runtime/SKILL.md +3 -0
- package/{subspace.command-pn56pnh8.js → subspace.command-a1sf9n5a.js} +12 -10
- package/templates/appSample/lib/task/task.signal.ts +14 -9
- package/templates/appSample/srvkit/guards.ts +11 -0
- package/templates/service/__model__.dictionary.ts +3 -5
- package/templates/workspaceRoot/.gitignore.template +1 -0
- package/{tunnel.command-q2h0j2en.js → tunnel.command-dcb0wg93.js} +25 -13
- package/{verify.command-z1dsbmrt.js → verify.command-yyepccbh.js} +13 -11
- package/{workflow.command-r3y67jeq.js → workflow.command-z5pg9ay0.js} +12 -11
- package/{workspace.command-t2f0xsrw.js → workspace.command-d7x5jttw.js} +74 -47
- package/CodeAgent-35wnb7w5.js +0 -9
- package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
- package/TunnelShare-xyjpa7gx.js +0 -14
- package/cloud.script-0s1jybd5.js +0 -26
- package/code.command-mpkm2emr.js +0 -167
- package/context.runner-ch0z3a8g.js +0 -26
- package/index-c6eggbee.js +0 -123
- package/index-ksfgqq1x.js +0 -49
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
akanCodePaths2
|
|
4
|
+
} from "./index-35j83zkd.js";
|
|
2
5
|
import {
|
|
3
6
|
ConfigLock
|
|
4
7
|
} from "./index-bqbf654f.js";
|
|
5
|
-
import {
|
|
6
|
-
akanCodePaths2
|
|
7
|
-
} from "./index-jje9qzyq.js";
|
|
8
8
|
|
|
9
9
|
// pkgs/@akanjs/devkit/codeAgent/agent/AkanCodeCompaction.ts
|
|
10
10
|
class AkanCodeCompaction2 {
|
|
@@ -157,7 +157,7 @@ class SubagentPool2 {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
async#run(id, kind, prompt, signal) {
|
|
160
|
-
const { CodeAgent } = await import("./CodeAgent-
|
|
160
|
+
const { CodeAgent } = await import("./CodeAgent-dyc45f5w.js");
|
|
161
161
|
const budget = this.#options.parent.tools.subagent;
|
|
162
162
|
const child = SubagentPool2.childOf(this.#options.parent, kind);
|
|
163
163
|
const model = this.#options.model?.();
|
|
@@ -209,98 +209,6 @@ class SubagentPool2 {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
// pkgs/@akanjs/devkit/codeAgent/tools/McpServerConfig.ts
|
|
213
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
214
|
-
import path from "path";
|
|
215
|
-
class McpServerConfig {
|
|
216
|
-
static file(workspaceRoot, scope = "workspace") {
|
|
217
|
-
return scope === "global" ? akanCodePaths2.globalMcpFile() : akanCodePaths2.mcpFile(workspaceRoot);
|
|
218
|
-
}
|
|
219
|
-
static files(workspaceRoot) {
|
|
220
|
-
return [
|
|
221
|
-
{ scope: "global", file: McpServerConfig.file(workspaceRoot, "global") },
|
|
222
|
-
{ scope: "workspace", file: McpServerConfig.file(workspaceRoot, "workspace") }
|
|
223
|
-
];
|
|
224
|
-
}
|
|
225
|
-
static read(workspaceRoot) {
|
|
226
|
-
return McpServerConfig.declared(workspaceRoot).filter((entry) => !entry.disabled).map((entry) => entry.ref);
|
|
227
|
-
}
|
|
228
|
-
static declared(workspaceRoot) {
|
|
229
|
-
const byName = new Map;
|
|
230
|
-
for (const { scope } of McpServerConfig.files(workspaceRoot))
|
|
231
|
-
for (const [name, entry] of Object.entries(McpServerConfig.#parse(workspaceRoot, scope).map))
|
|
232
|
-
byName.set(name, { ref: McpServerConfig.#refOf(name, entry), disabled: !!entry.disabled, scope });
|
|
233
|
-
return [...byName.values()];
|
|
234
|
-
}
|
|
235
|
-
static add(workspaceRoot, name, target, scope = "global") {
|
|
236
|
-
const [head, ...rest] = target;
|
|
237
|
-
if (!head)
|
|
238
|
-
throw new Error("Give the server a command to run, or a url to reach.");
|
|
239
|
-
const entry = /^https?:\/\//.test(head) ? { url: head } : { command: head, args: rest };
|
|
240
|
-
const { file, key, map } = McpServerConfig.#parse(workspaceRoot, scope);
|
|
241
|
-
const next = { ...map, [name]: entry };
|
|
242
|
-
mkdirSync(path.dirname(file), { recursive: true });
|
|
243
|
-
writeFileSync(file, `${JSON.stringify({ [key]: next }, null, 2)}
|
|
244
|
-
`);
|
|
245
|
-
return McpServerConfig.#refOf(name, entry);
|
|
246
|
-
}
|
|
247
|
-
static remove(workspaceRoot, name, only) {
|
|
248
|
-
const candidates = McpServerConfig.files(workspaceRoot).filter(({ scope }) => !only || scope === only);
|
|
249
|
-
for (const { scope } of candidates.reverse()) {
|
|
250
|
-
const { file, key, map } = McpServerConfig.#parse(workspaceRoot, scope);
|
|
251
|
-
if (!(name in map))
|
|
252
|
-
continue;
|
|
253
|
-
const next = { ...map };
|
|
254
|
-
delete next[name];
|
|
255
|
-
writeFileSync(file, `${JSON.stringify({ [key]: next }, null, 2)}
|
|
256
|
-
`);
|
|
257
|
-
return scope;
|
|
258
|
-
}
|
|
259
|
-
return false;
|
|
260
|
-
}
|
|
261
|
-
static #refOf(name, entry) {
|
|
262
|
-
return {
|
|
263
|
-
name,
|
|
264
|
-
transport: entry.url ? "http" : "stdio",
|
|
265
|
-
...entry.command ? { command: entry.command } : {},
|
|
266
|
-
...entry.args ? { args: entry.args } : {},
|
|
267
|
-
...entry.url ? { url: entry.url } : {},
|
|
268
|
-
...entry.env ? { env: entry.env } : {},
|
|
269
|
-
...entry.headers ? { headers: entry.headers } : {},
|
|
270
|
-
...entry.oauth ? { oauth: entry.oauth } : {}
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
static targetOf(ref) {
|
|
274
|
-
return ref.url ?? [ref.command, ...ref.args ?? []].filter(Boolean).join(" ");
|
|
275
|
-
}
|
|
276
|
-
static problem(workspaceRoot) {
|
|
277
|
-
for (const { file } of McpServerConfig.files(workspaceRoot)) {
|
|
278
|
-
if (!existsSync(file))
|
|
279
|
-
continue;
|
|
280
|
-
try {
|
|
281
|
-
JSON.parse(readFileSync(file, "utf8"));
|
|
282
|
-
} catch (error) {
|
|
283
|
-
return `${file} is not valid JSON \u2014 ${String(error)}`;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
static #parse(workspaceRoot, scope) {
|
|
289
|
-
const file = McpServerConfig.file(workspaceRoot, scope);
|
|
290
|
-
const empty = { file, key: "mcpServers", map: {} };
|
|
291
|
-
if (!existsSync(file))
|
|
292
|
-
return empty;
|
|
293
|
-
try {
|
|
294
|
-
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
295
|
-
if (parsed.servers && !parsed.mcpServers)
|
|
296
|
-
return { file, key: "servers", map: parsed.servers };
|
|
297
|
-
return { ...empty, map: parsed.mcpServers ?? {} };
|
|
298
|
-
} catch {
|
|
299
|
-
return empty;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
212
|
// pkgs/@akanjs/devkit/codeAgent/tools/McpOAuth.ts
|
|
305
213
|
import { createHash, randomBytes } from "crypto";
|
|
306
214
|
|
|
@@ -526,8 +434,8 @@ class McpOAuthLoopback {
|
|
|
526
434
|
}
|
|
527
435
|
|
|
528
436
|
// pkgs/@akanjs/devkit/codeAgent/tools/McpTokenStore.ts
|
|
529
|
-
import { chmodSync, existsSync
|
|
530
|
-
import
|
|
437
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
438
|
+
import path from "path";
|
|
531
439
|
class McpTokenStore {
|
|
532
440
|
static file() {
|
|
533
441
|
return akanCodePaths2.mcpAuthFile();
|
|
@@ -535,43 +443,75 @@ class McpTokenStore {
|
|
|
535
443
|
static lockFile() {
|
|
536
444
|
return `${McpTokenStore.file()}.lock`;
|
|
537
445
|
}
|
|
538
|
-
static read(
|
|
539
|
-
|
|
446
|
+
static read(owner) {
|
|
447
|
+
const origin = McpTokenStore.#originOf(owner.url);
|
|
448
|
+
if (!origin)
|
|
449
|
+
return;
|
|
450
|
+
const here = McpTokenStore.#all().filter((entry) => entry.origin === origin);
|
|
451
|
+
const entry = here.find((candidate) => candidate.name === owner.name) ?? here[0];
|
|
452
|
+
if (!entry)
|
|
453
|
+
return;
|
|
454
|
+
const { name: _name, origin: _origin, ...auth } = entry;
|
|
455
|
+
return auth;
|
|
540
456
|
}
|
|
541
457
|
static names() {
|
|
542
|
-
return
|
|
458
|
+
return [...new Set(McpTokenStore.#all().map((entry) => entry.name))];
|
|
543
459
|
}
|
|
544
|
-
static write(
|
|
545
|
-
|
|
460
|
+
static write(owner, auth) {
|
|
461
|
+
const origin = McpTokenStore.#originOf(owner.url);
|
|
462
|
+
if (!origin)
|
|
463
|
+
throw new Error(`"${owner.name}" has no http(s) url to bind its token to.`);
|
|
464
|
+
const kept = McpTokenStore.#all().filter((entry) => entry.origin !== origin || entry.issuer !== auth.issuer && entry.name !== owner.name);
|
|
465
|
+
McpTokenStore.#save([...kept, { ...auth, name: owner.name, origin }]);
|
|
546
466
|
}
|
|
547
|
-
static clear(
|
|
467
|
+
static clear(owner) {
|
|
468
|
+
const origin = McpTokenStore.#originOf(owner.url);
|
|
548
469
|
const all = McpTokenStore.#all();
|
|
549
|
-
|
|
470
|
+
const kept = all.filter((entry) => entry.name !== owner.name && entry.origin !== origin);
|
|
471
|
+
if (kept.length === all.length)
|
|
550
472
|
return false;
|
|
551
|
-
|
|
552
|
-
McpTokenStore.#save(all);
|
|
473
|
+
McpTokenStore.#save(kept);
|
|
553
474
|
return true;
|
|
554
475
|
}
|
|
555
476
|
static isExpired(auth) {
|
|
556
477
|
return auth.expiresAt !== undefined && auth.expiresAt <= Date.now() + McpTokenStore.skewMs;
|
|
557
478
|
}
|
|
558
479
|
static skewMs = 60000;
|
|
480
|
+
static #originOf(url) {
|
|
481
|
+
if (!url)
|
|
482
|
+
return;
|
|
483
|
+
try {
|
|
484
|
+
const parsed = new URL(url);
|
|
485
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:" ? parsed.origin : undefined;
|
|
486
|
+
} catch {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
static #keyOf(entry) {
|
|
491
|
+
return `${entry.origin} ${entry.issuer}`;
|
|
492
|
+
}
|
|
559
493
|
static #all() {
|
|
560
494
|
const file = McpTokenStore.file();
|
|
561
|
-
if (!
|
|
562
|
-
return
|
|
495
|
+
if (!existsSync(file))
|
|
496
|
+
return [];
|
|
563
497
|
try {
|
|
564
|
-
const parsed = JSON.parse(
|
|
565
|
-
|
|
498
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
499
|
+
if (parsed.tokens)
|
|
500
|
+
return Object.values(parsed.tokens);
|
|
501
|
+
return Object.entries(parsed.servers ?? {}).flatMap(([name, auth]) => {
|
|
502
|
+
const origin = McpTokenStore.#originOf(auth.resource);
|
|
503
|
+
return origin ? [{ ...auth, name, origin }] : [];
|
|
504
|
+
});
|
|
566
505
|
} catch {
|
|
567
|
-
return
|
|
506
|
+
return [];
|
|
568
507
|
}
|
|
569
508
|
}
|
|
570
|
-
static #save(
|
|
509
|
+
static #save(entries) {
|
|
571
510
|
const file = McpTokenStore.file();
|
|
572
|
-
|
|
511
|
+
mkdirSync(path.dirname(file), { recursive: true, mode: 448 });
|
|
512
|
+
const tokens = Object.fromEntries(entries.map((entry) => [McpTokenStore.#keyOf(entry), entry]));
|
|
573
513
|
const temp = `${file}.${process.pid}.tmp`;
|
|
574
|
-
|
|
514
|
+
writeFileSync(temp, `${JSON.stringify({ tokens }, null, 2)}
|
|
575
515
|
`, { mode: 384 });
|
|
576
516
|
renameSync(temp, file);
|
|
577
517
|
chmodSync(file, 384);
|
|
@@ -582,7 +522,7 @@ class McpTokenStore {
|
|
|
582
522
|
class McpSignIn {
|
|
583
523
|
static #refreshing = new Map;
|
|
584
524
|
static async token(ref, onNotice) {
|
|
585
|
-
const stored = McpTokenStore.read(ref
|
|
525
|
+
const stored = McpTokenStore.read(ref);
|
|
586
526
|
if (!stored)
|
|
587
527
|
return;
|
|
588
528
|
if (!McpTokenStore.isExpired(stored))
|
|
@@ -590,7 +530,7 @@ class McpSignIn {
|
|
|
590
530
|
return await McpSignIn.#refreshOnce(ref, stored, onNotice);
|
|
591
531
|
}
|
|
592
532
|
static async retryToken(ref, refused, onNotice) {
|
|
593
|
-
const stored = McpTokenStore.read(ref
|
|
533
|
+
const stored = McpTokenStore.read(ref);
|
|
594
534
|
if (!stored)
|
|
595
535
|
return;
|
|
596
536
|
if (stored.accessToken !== refused && !McpTokenStore.isExpired(stored))
|
|
@@ -598,7 +538,7 @@ class McpSignIn {
|
|
|
598
538
|
return await McpSignIn.#refreshOnce(ref, stored, onNotice);
|
|
599
539
|
}
|
|
600
540
|
static async#refreshOnce(ref, stored, onNotice) {
|
|
601
|
-
const key = `${
|
|
541
|
+
const key = `${stored.issuer}
|
|
602
542
|
${stored.refreshToken}`;
|
|
603
543
|
let pending = McpSignIn.#refreshing.get(key);
|
|
604
544
|
if (!pending) {
|
|
@@ -612,7 +552,7 @@ ${stored.refreshToken}`;
|
|
|
612
552
|
return;
|
|
613
553
|
try {
|
|
614
554
|
return await ConfigLock.run(McpTokenStore.lockFile(), async () => {
|
|
615
|
-
const current = McpTokenStore.read(ref
|
|
555
|
+
const current = McpTokenStore.read(ref);
|
|
616
556
|
if (!current)
|
|
617
557
|
return;
|
|
618
558
|
if (current.accessToken !== stored.accessToken && !McpTokenStore.isExpired(current))
|
|
@@ -625,7 +565,7 @@ ${stored.refreshToken}`;
|
|
|
625
565
|
};
|
|
626
566
|
const tokens = await McpOAuth.refresh(server, current);
|
|
627
567
|
const { expiresAt: _spent, ...grant } = current;
|
|
628
|
-
McpTokenStore.write(ref
|
|
568
|
+
McpTokenStore.write(ref, { ...grant, ...tokens });
|
|
629
569
|
return tokens.accessToken;
|
|
630
570
|
});
|
|
631
571
|
} catch (error) {
|
|
@@ -638,7 +578,7 @@ ${stored.refreshToken}`;
|
|
|
638
578
|
throw new Error(`"${ref.name}" is a stdio server: give it its credential through "env".`);
|
|
639
579
|
const challenge = await McpSignIn.challenge(ref);
|
|
640
580
|
const server = await McpOAuth.discover(ref.url, challenge);
|
|
641
|
-
const stored = McpTokenStore.read(ref
|
|
581
|
+
const stored = McpTokenStore.read(ref);
|
|
642
582
|
const reusable = stored && stored.issuer === server.issuer && !ref.oauth?.clientId ? stored : undefined;
|
|
643
583
|
const loopback = McpOAuthLoopback.bind(McpSignIn.#portOf(reusable?.redirectUri));
|
|
644
584
|
try {
|
|
@@ -664,7 +604,7 @@ ${stored.refreshToken}`;
|
|
|
664
604
|
redirectUri,
|
|
665
605
|
...tokens
|
|
666
606
|
};
|
|
667
|
-
McpTokenStore.write(ref
|
|
607
|
+
McpTokenStore.write(ref, auth);
|
|
668
608
|
return auth;
|
|
669
609
|
} finally {
|
|
670
610
|
loopback.close();
|
|
@@ -715,4 +655,4 @@ ${stored.refreshToken}`;
|
|
|
715
655
|
}
|
|
716
656
|
}
|
|
717
657
|
|
|
718
|
-
export { SubagentPool2,
|
|
658
|
+
export { SubagentPool2, McpTokenStore, McpSignIn, AkanCodeCompaction2 };
|