@akanjs/cli 3.1.0-rc.12 → 3.1.0-rc.13
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-fhrb6xyw.js → CodeAgent-n3tzjm91.js} +2 -2
- package/{CodeTui-ntnda5dn.js → CodeTui-fnm9ft4d.js} +1 -1
- package/akanCode.js +2 -2
- package/{code.command-3sxektnr.js → code.command-130bdmhe.js} +4 -4
- package/{index-zjgs0t7s.js → index-1djcjcre.js} +218 -41
- package/{index-ht15pm08.js → index-dye8pnxx.js} +1 -1
- package/index.js +1 -1
- package/package.json +2 -2
package/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
7bcd4fe279524ed2759e02783eb078a66b8ee0e6acee19a817c2f751ecba695a
|
package/akanCode.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
CodeMailbox2,
|
|
29
29
|
CodeSessionFork2,
|
|
30
30
|
CodeAgent2
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-1djcjcre.js";
|
|
32
32
|
import {
|
|
33
33
|
akanCodeDefaultModel2,
|
|
34
34
|
akanCodeModel2,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
SubagentPool2,
|
|
41
41
|
akanCodePaths2,
|
|
42
42
|
AkanCodeCompaction2
|
|
43
|
-
} from "./index-
|
|
43
|
+
} from "./index-dye8pnxx.js";
|
|
44
44
|
import"./index-7md2g9vw.js";
|
|
45
45
|
import {
|
|
46
46
|
CodeAgentRpcHost2
|
|
@@ -19,7 +19,7 @@ class CodeRunner extends runner("code") {
|
|
|
19
19
|
async serve(options, listen) {
|
|
20
20
|
await import("./consoleToStderr-h5bryj94.js");
|
|
21
21
|
const [{ CodeAgent }, { CodeAgentRpcHost }, { CodeAgentRpcListener }] = await Promise.all([
|
|
22
|
-
import("./CodeAgent-
|
|
22
|
+
import("./CodeAgent-n3tzjm91.js"),
|
|
23
23
|
import("./CodeAgentRpcHost-9g27hmer.js"),
|
|
24
24
|
import("./CodeAgentRpcListener-7p7z5dd7.js")
|
|
25
25
|
]);
|
|
@@ -34,8 +34,8 @@ class CodeRunner extends runner("code") {
|
|
|
34
34
|
}
|
|
35
35
|
async tui(options, seed) {
|
|
36
36
|
const [{ CodeAgent }, { CodeTui }] = await Promise.all([
|
|
37
|
-
import("./CodeAgent-
|
|
38
|
-
import("./CodeTui-
|
|
37
|
+
import("./CodeAgent-n3tzjm91.js"),
|
|
38
|
+
import("./CodeTui-fnm9ft4d.js")
|
|
39
39
|
]);
|
|
40
40
|
const agentOptions = await CodeRunner.#agentOptions(options, false);
|
|
41
41
|
let resume = options.resume;
|
|
@@ -67,7 +67,7 @@ class CodeRunner extends runner("code") {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
async run(prompt, options) {
|
|
70
|
-
const { CodeAgent } = await import("./CodeAgent-
|
|
70
|
+
const { CodeAgent } = await import("./CodeAgent-n3tzjm91.js");
|
|
71
71
|
const agent = await CodeAgent.create(await CodeRunner.#agentOptions(options, false));
|
|
72
72
|
const printer = new CodeAgentStreamPrinter2({ json: options.json, thinking: options.thinking });
|
|
73
73
|
agent.on((event) => printer.print(event));
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
McpServerConfig,
|
|
6
6
|
McpSignIn,
|
|
7
7
|
AkanCodeCompaction2
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-dye8pnxx.js";
|
|
9
9
|
import {
|
|
10
10
|
stripAnsi
|
|
11
11
|
} from "./index-7md2g9vw.js";
|
|
@@ -319,7 +319,7 @@ import {
|
|
|
319
319
|
DefaultResourceLoader
|
|
320
320
|
} from "@earendil-works/pi-coding-agent";
|
|
321
321
|
import {
|
|
322
|
-
codeAgentClip as
|
|
322
|
+
codeAgentClip as codeAgentClip6,
|
|
323
323
|
codeAgentLabelChars as codeAgentLabelChars2,
|
|
324
324
|
codeAgentRenderAnswer,
|
|
325
325
|
codeAgentSessionName as codeAgentSessionName2
|
|
@@ -1396,11 +1396,120 @@ class SessionToolPack2 {
|
|
|
1396
1396
|
}
|
|
1397
1397
|
|
|
1398
1398
|
// pkgs/@akanjs/devkit/codeAgent/tools/WebToolPack.ts
|
|
1399
|
-
import {
|
|
1399
|
+
import { isIP } from "net";
|
|
1400
|
+
import { codeAgentClip as codeAgentClip4 } from "akanjs/common";
|
|
1400
1401
|
import { Type as Type6 } from "typebox";
|
|
1401
1402
|
|
|
1403
|
+
// pkgs/@akanjs/devkit/codeAgent/tools/DeepSeekWeb.ts
|
|
1404
|
+
import { codeAgentClip as codeAgentClip3 } from "akanjs/common";
|
|
1405
|
+
|
|
1406
|
+
class DeepSeekWeb {
|
|
1407
|
+
static baseUrl = "https://api.deepseek.com/v1/tools";
|
|
1408
|
+
static maxQueryChars = 128;
|
|
1409
|
+
static summaryChars = 600;
|
|
1410
|
+
static #retryable = {
|
|
1411
|
+
search: [408, 429, 500, 502, 503, 504],
|
|
1412
|
+
fetch: [429]
|
|
1413
|
+
};
|
|
1414
|
+
static #attempts = 3;
|
|
1415
|
+
#key;
|
|
1416
|
+
#baseUrl;
|
|
1417
|
+
constructor(key, baseUrl = DeepSeekWeb.baseUrl) {
|
|
1418
|
+
this.#key = key;
|
|
1419
|
+
this.#baseUrl = baseUrl;
|
|
1420
|
+
}
|
|
1421
|
+
static async fromRuntime(runtime, proxied) {
|
|
1422
|
+
if (proxied)
|
|
1423
|
+
return;
|
|
1424
|
+
const key = (await runtime.getAuth("deepseek").catch(() => {
|
|
1425
|
+
return;
|
|
1426
|
+
}))?.auth.apiKey;
|
|
1427
|
+
return key ? new DeepSeekWeb(key) : undefined;
|
|
1428
|
+
}
|
|
1429
|
+
async search(query, count, signal) {
|
|
1430
|
+
if ([...query].length > DeepSeekWeb.maxQueryChars)
|
|
1431
|
+
throw new Error(`DeepSeek search takes at most ${DeepSeekWeb.maxQueryChars} characters; shorten the query.`);
|
|
1432
|
+
const body = await this.#call("search", { query, count }, 20000, signal);
|
|
1433
|
+
const byUrl = new Map;
|
|
1434
|
+
for (const result of body.results ?? []) {
|
|
1435
|
+
const url = DeepSeekWeb.#cleanUrl(result.url);
|
|
1436
|
+
if (!byUrl.has(url))
|
|
1437
|
+
byUrl.set(url, { ...result, url });
|
|
1438
|
+
}
|
|
1439
|
+
return [...byUrl.values()].map((result) => {
|
|
1440
|
+
const date = result.date ? ` \xB7 ${result.date.slice(0, 10)}` : "";
|
|
1441
|
+
const summary = DeepSeekWeb.unescape(result.summary || result.snippet || "").replace(/\s+/g, " ").trim();
|
|
1442
|
+
return `- ${result.title}
|
|
1443
|
+
${result.url}${date}
|
|
1444
|
+
${codeAgentClip3(summary, DeepSeekWeb.summaryChars)}`;
|
|
1445
|
+
}).join(`
|
|
1446
|
+
`);
|
|
1447
|
+
}
|
|
1448
|
+
async fetch(url, signal) {
|
|
1449
|
+
const page = await this.#call("fetch", { url }, 30000, signal);
|
|
1450
|
+
return { title: page.title ?? "", content: DeepSeekWeb.unescape(page.content ?? "") };
|
|
1451
|
+
}
|
|
1452
|
+
static unescape(markdown) {
|
|
1453
|
+
const escaped = markdown.match(/\\[!-/:-@[-`{-~]/g)?.length ?? 0;
|
|
1454
|
+
const punctuation = markdown.match(/[!-/:-@[-`{-~]/g)?.length ?? 0;
|
|
1455
|
+
if (!escaped || escaped < (punctuation - escaped) / 2)
|
|
1456
|
+
return markdown;
|
|
1457
|
+
return markdown.replace(/\\([!-/:-@[-`{-~])/g, "$1");
|
|
1458
|
+
}
|
|
1459
|
+
async#call(tool, body, timeoutMs, signal) {
|
|
1460
|
+
for (let attempt = 1;; attempt++) {
|
|
1461
|
+
const response = await fetch(`${this.#baseUrl}/${tool}`, {
|
|
1462
|
+
method: "POST",
|
|
1463
|
+
headers: { authorization: `Bearer ${this.#key}`, "content-type": "application/json" },
|
|
1464
|
+
body: JSON.stringify(body),
|
|
1465
|
+
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(timeoutMs)]) : AbortSignal.timeout(timeoutMs)
|
|
1466
|
+
});
|
|
1467
|
+
if (response.ok)
|
|
1468
|
+
return await response.json();
|
|
1469
|
+
if (!DeepSeekWeb.#retryable[tool].includes(response.status) || attempt >= DeepSeekWeb.#attempts) {
|
|
1470
|
+
const error = await response.json().catch(() => {
|
|
1471
|
+
return;
|
|
1472
|
+
});
|
|
1473
|
+
throw new Error(`DeepSeek ${tool} answered ${response.status}: ${error?.error?.message ?? response.statusText}`);
|
|
1474
|
+
}
|
|
1475
|
+
await DeepSeekWeb.#wait(DeepSeekWeb.#delayOf(response, attempt), signal);
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
static #delayOf(response, attempt) {
|
|
1479
|
+
const retryAfter = Number(response.headers.get("retry-after"));
|
|
1480
|
+
return Number.isFinite(retryAfter) && retryAfter > 0 ? Math.min(retryAfter, 5) * 1000 : 1000 * 2 ** (attempt - 1);
|
|
1481
|
+
}
|
|
1482
|
+
static #wait(ms, signal) {
|
|
1483
|
+
return new Promise((resolve) => {
|
|
1484
|
+
const timer = setTimeout(resolve, ms);
|
|
1485
|
+
signal?.addEventListener("abort", () => {
|
|
1486
|
+
clearTimeout(timer);
|
|
1487
|
+
resolve();
|
|
1488
|
+
}, { once: true });
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
static #cleanUrl(url) {
|
|
1492
|
+
try {
|
|
1493
|
+
const parsed = new URL(url);
|
|
1494
|
+
for (const name of [...parsed.searchParams.keys()])
|
|
1495
|
+
if (name.startsWith("utm_"))
|
|
1496
|
+
parsed.searchParams.delete(name);
|
|
1497
|
+
if (/^#\d+$/.test(parsed.hash))
|
|
1498
|
+
parsed.hash = "";
|
|
1499
|
+
return parsed.toString();
|
|
1500
|
+
} catch {
|
|
1501
|
+
return url;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
// pkgs/@akanjs/devkit/codeAgent/tools/WebToolPack.ts
|
|
1402
1507
|
class WebToolPack2 {
|
|
1508
|
+
static pageChars = 1e4;
|
|
1509
|
+
static maxResults = 10;
|
|
1510
|
+
static #rememberedPages = 16;
|
|
1403
1511
|
#options;
|
|
1512
|
+
#pages = new Map;
|
|
1404
1513
|
constructor(options) {
|
|
1405
1514
|
this.#options = options;
|
|
1406
1515
|
}
|
|
@@ -1439,7 +1548,7 @@ class WebToolPack2 {
|
|
|
1439
1548
|
const names = [];
|
|
1440
1549
|
if (this.#options.profile.tools.web.fetch)
|
|
1441
1550
|
names.push("web_fetch");
|
|
1442
|
-
if (this.#options.profile.tools.web.search &&
|
|
1551
|
+
if (this.#options.profile.tools.web.search && this.#searcher())
|
|
1443
1552
|
names.push("web_search");
|
|
1444
1553
|
return names;
|
|
1445
1554
|
}
|
|
@@ -1451,58 +1560,124 @@ class WebToolPack2 {
|
|
|
1451
1560
|
#register(pi) {
|
|
1452
1561
|
if (this.#options.profile.tools.web.fetch)
|
|
1453
1562
|
this.#registerFetch(pi);
|
|
1454
|
-
const
|
|
1455
|
-
if (this.#options.profile.tools.web.search &&
|
|
1456
|
-
this.#registerSearch(pi,
|
|
1563
|
+
const searcher = this.#searcher();
|
|
1564
|
+
if (this.#options.profile.tools.web.search && searcher)
|
|
1565
|
+
this.#registerSearch(pi, searcher);
|
|
1457
1566
|
}
|
|
1458
1567
|
#registerFetch(pi) {
|
|
1459
1568
|
const allowHosts = this.#options.profile.network.allowHosts;
|
|
1460
1569
|
pi.registerTool({
|
|
1461
1570
|
name: "web_fetch",
|
|
1462
1571
|
label: "Fetch",
|
|
1463
|
-
description:
|
|
1572
|
+
description: `Fetch a URL and return its readable text, ${WebToolPack2.pageChars} characters at a time. A longer page ends with the offset that continues it.`,
|
|
1464
1573
|
promptSnippet: "web_fetch: fetch a URL and return its readable text",
|
|
1465
|
-
parameters: Type6.Object({
|
|
1466
|
-
|
|
1574
|
+
parameters: Type6.Object({
|
|
1575
|
+
url: Type6.String({ description: "Absolute http(s) URL." }),
|
|
1576
|
+
offset: Type6.Optional(Type6.Number({ description: "Character offset a previous call named, to read on." }))
|
|
1577
|
+
}),
|
|
1578
|
+
execute: async (_id, params, signal) => {
|
|
1467
1579
|
const refusal = WebToolPack2.#refuseHost(params.url, allowHosts);
|
|
1468
1580
|
if (refusal)
|
|
1469
1581
|
return { content: [{ type: "text", text: refusal }], details: undefined, isError: true };
|
|
1470
|
-
const
|
|
1471
|
-
const
|
|
1582
|
+
const offset = Math.max(0, Math.floor(params.offset ?? 0));
|
|
1583
|
+
const cached = offset ? this.#pages.get(params.url) : undefined;
|
|
1584
|
+
const page = cached ?? await this.#read(params.url, signal);
|
|
1585
|
+
if (page.ok)
|
|
1586
|
+
this.#remember(params.url, page);
|
|
1472
1587
|
return {
|
|
1473
|
-
content: [
|
|
1474
|
-
{ type: "text", text: `${response.status} ${params.url}
|
|
1475
|
-
|
|
1476
|
-
${codeAgentClip3(text, codeAgentOutputChars3)}` }
|
|
1477
|
-
],
|
|
1588
|
+
content: [{ type: "text", text: WebToolPack2.#window(params.url, page, offset) }],
|
|
1478
1589
|
details: undefined,
|
|
1479
|
-
isError: !
|
|
1590
|
+
isError: !page.ok
|
|
1480
1591
|
};
|
|
1481
1592
|
}
|
|
1482
1593
|
});
|
|
1483
1594
|
}
|
|
1484
|
-
#registerSearch(pi,
|
|
1595
|
+
#registerSearch(pi, searcher) {
|
|
1596
|
+
const hint = searcher.name === "deepseek" ? ` Keep the query within ${DeepSeekWeb.maxQueryChars} characters; site:, -site: and quoted phrases work.` : "";
|
|
1485
1597
|
pi.registerTool({
|
|
1486
1598
|
name: "web_search",
|
|
1487
1599
|
label: "Search",
|
|
1488
|
-
description: `Search the web (${
|
|
1600
|
+
description: `Search the web (${searcher.name}) and return the top results as title, url and summary.${hint}`,
|
|
1489
1601
|
promptSnippet: "web_search: search the web and return titles, urls and snippets",
|
|
1490
1602
|
parameters: Type6.Object({
|
|
1491
1603
|
query: Type6.String(),
|
|
1492
|
-
count: Type6.Optional(Type6.Number({ description:
|
|
1604
|
+
count: Type6.Optional(Type6.Number({ description: `How many results, default 5, at most ${WebToolPack2.maxResults}.` }))
|
|
1493
1605
|
}),
|
|
1494
|
-
execute: async (_id, params) => {
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1606
|
+
execute: async (_id, params, signal) => {
|
|
1607
|
+
const count = Math.min(Math.max(Math.round(params.count ?? 5), 1), WebToolPack2.maxResults);
|
|
1608
|
+
try {
|
|
1609
|
+
const results = await searcher.search(params.query, count, signal);
|
|
1610
|
+
return {
|
|
1611
|
+
content: [{ type: "text", text: codeAgentClip4(results || "(no results)", WebToolPack2.pageChars) }],
|
|
1612
|
+
details: undefined
|
|
1613
|
+
};
|
|
1614
|
+
} catch (error) {
|
|
1615
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1616
|
+
return { content: [{ type: "text", text: message }], details: undefined, isError: true };
|
|
1617
|
+
}
|
|
1501
1618
|
}
|
|
1502
1619
|
});
|
|
1503
1620
|
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1621
|
+
#searcher() {
|
|
1622
|
+
const provider = WebToolPack2.providers.find((entry) => !!process.env[entry.envKey]);
|
|
1623
|
+
if (provider)
|
|
1624
|
+
return {
|
|
1625
|
+
name: provider.name,
|
|
1626
|
+
search: (query, count) => provider.search(process.env[provider.envKey] ?? "", query, count)
|
|
1627
|
+
};
|
|
1628
|
+
const deepseek = this.#options.deepseek;
|
|
1629
|
+
return deepseek ? { name: "deepseek", search: (query, count, signal) => deepseek.search(query, count, signal) } : undefined;
|
|
1630
|
+
}
|
|
1631
|
+
async#read(url, signal) {
|
|
1632
|
+
const deepseek = this.#options.deepseek;
|
|
1633
|
+
if (deepseek && !WebToolPack2.#isLocal(new URL(url).hostname)) {
|
|
1634
|
+
try {
|
|
1635
|
+
const page = await deepseek.fetch(url, signal);
|
|
1636
|
+
return { status: 200, ok: true, title: page.title, text: page.content };
|
|
1637
|
+
} catch (error) {
|
|
1638
|
+
if (signal?.aborted)
|
|
1639
|
+
throw error;
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
const response = await fetch(url, {
|
|
1643
|
+
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(20000)]) : AbortSignal.timeout(20000),
|
|
1644
|
+
redirect: "follow"
|
|
1645
|
+
});
|
|
1646
|
+
return { status: response.status, ok: response.ok, title: "", text: WebToolPack2.#readable(await response.text()) };
|
|
1647
|
+
}
|
|
1648
|
+
#remember(url, page) {
|
|
1649
|
+
this.#pages.delete(url);
|
|
1650
|
+
this.#pages.set(url, page);
|
|
1651
|
+
const oldest = this.#pages.keys().next().value;
|
|
1652
|
+
if (this.#pages.size > WebToolPack2.#rememberedPages && oldest)
|
|
1653
|
+
this.#pages.delete(oldest);
|
|
1654
|
+
}
|
|
1655
|
+
static #window(url, page, offset) {
|
|
1656
|
+
const head = [`${page.status} ${url}`, page.title].filter(Boolean).join(`
|
|
1657
|
+
`);
|
|
1658
|
+
const total = page.text.length;
|
|
1659
|
+
if (offset && offset >= total)
|
|
1660
|
+
return `${head}
|
|
1661
|
+
|
|
1662
|
+
Offset ${offset} is past the end; the page has ${total} characters.`;
|
|
1663
|
+
const end = Math.min(offset + WebToolPack2.pageChars, total);
|
|
1664
|
+
const rest = end < total ? `
|
|
1665
|
+
|
|
1666
|
+
[characters ${offset}\u2013${end} of ${total}; offset ${end} reads on]` : "";
|
|
1667
|
+
return `${head}
|
|
1668
|
+
|
|
1669
|
+
${page.text.slice(offset, end)}${rest}`;
|
|
1670
|
+
}
|
|
1671
|
+
static #isLocal(hostname) {
|
|
1672
|
+
const host = hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
1673
|
+
const family = isIP(host);
|
|
1674
|
+
if (family === 6)
|
|
1675
|
+
return host === "::1" || /^(f[cd]|fe[89ab])/.test(host);
|
|
1676
|
+
if (family === 4) {
|
|
1677
|
+
const [a = 0, b = 0] = host.split(".").map(Number);
|
|
1678
|
+
return a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
|
|
1679
|
+
}
|
|
1680
|
+
return !host.includes(".") || /\.(localhost|local|internal|lan|home\.arpa)$/.test(host);
|
|
1506
1681
|
}
|
|
1507
1682
|
static #refuseHost(url, allowHosts) {
|
|
1508
1683
|
let parsed;
|
|
@@ -1534,7 +1709,7 @@ class AkanCodePlugins2 {
|
|
|
1534
1709
|
});
|
|
1535
1710
|
const dispose = () => mcp?.close();
|
|
1536
1711
|
const mcpStatus = mcp?.status ?? [];
|
|
1537
|
-
const web = new WebToolPack2({ profile: options.profile });
|
|
1712
|
+
const web = new WebToolPack2({ profile: options.profile, deepseek: options.deepseek });
|
|
1538
1713
|
const sessions = new SessionToolPack2({
|
|
1539
1714
|
workspaceRoot: options.workspace.workspaceRoot,
|
|
1540
1715
|
cwd: options.cwd,
|
|
@@ -1669,9 +1844,9 @@ class CodeAgentAsks2 {
|
|
|
1669
1844
|
|
|
1670
1845
|
// pkgs/@akanjs/devkit/codeAgent/agent/CodeAgentEventMapper.ts
|
|
1671
1846
|
import {
|
|
1672
|
-
codeAgentClip as
|
|
1847
|
+
codeAgentClip as codeAgentClip5,
|
|
1673
1848
|
codeAgentLabelChars,
|
|
1674
|
-
codeAgentOutputChars as
|
|
1849
|
+
codeAgentOutputChars as codeAgentOutputChars3
|
|
1675
1850
|
} from "akanjs/common";
|
|
1676
1851
|
|
|
1677
1852
|
// pkgs/@akanjs/devkit/codeAgent/agent/stringArg.ts
|
|
@@ -1731,7 +1906,7 @@ class CodeAgentEventMapper2 {
|
|
|
1731
1906
|
type: "tool_progress",
|
|
1732
1907
|
turnId: this.#turnId,
|
|
1733
1908
|
toolCallId: event.toolCallId,
|
|
1734
|
-
text:
|
|
1909
|
+
text: codeAgentClip5(CodeAgentEventMapper2.#renderToolText(event.partialResult), codeAgentLabelChars)
|
|
1735
1910
|
}
|
|
1736
1911
|
];
|
|
1737
1912
|
case "tool_execution_end":
|
|
@@ -1802,8 +1977,8 @@ class CodeAgentEventMapper2 {
|
|
|
1802
1977
|
turnId: this.#turnId,
|
|
1803
1978
|
tool,
|
|
1804
1979
|
outcome: reason ? "blocked" : event.isError ? "error" : "ok",
|
|
1805
|
-
output:
|
|
1806
|
-
truncated: full.length >
|
|
1980
|
+
output: codeAgentClip5(full, codeAgentOutputChars3),
|
|
1981
|
+
truncated: full.length > codeAgentOutputChars3
|
|
1807
1982
|
};
|
|
1808
1983
|
}
|
|
1809
1984
|
noteOutcome(reason) {
|
|
@@ -1832,7 +2007,7 @@ class CodeAgentEventMapper2 {
|
|
|
1832
2007
|
name,
|
|
1833
2008
|
op: toolOps[name] ?? "other",
|
|
1834
2009
|
...path ? { path } : {},
|
|
1835
|
-
title:
|
|
2010
|
+
title: codeAgentClip5(`${name}${CodeAgentEventMapper2.#renderArgs(args)}`, codeAgentLabelChars)
|
|
1836
2011
|
};
|
|
1837
2012
|
}
|
|
1838
2013
|
#mapDelta(event) {
|
|
@@ -1859,7 +2034,7 @@ class CodeAgentEventMapper2 {
|
|
|
1859
2034
|
if (!entries.length)
|
|
1860
2035
|
return "";
|
|
1861
2036
|
const rendered = entries.map(([key, value]) => `${key}=${CodeAgentEventMapper2.#renderArgValue(value)}`).join(" ");
|
|
1862
|
-
return `(${
|
|
2037
|
+
return `(${codeAgentClip5(rendered, 120)})`;
|
|
1863
2038
|
}
|
|
1864
2039
|
static #renderArgValue(value) {
|
|
1865
2040
|
if (Array.isArray(value))
|
|
@@ -1868,7 +2043,7 @@ class CodeAgentEventMapper2 {
|
|
|
1868
2043
|
const keys = Object.keys(value).length;
|
|
1869
2044
|
return `{${keys} key${keys === 1 ? "" : "s"}}`;
|
|
1870
2045
|
}
|
|
1871
|
-
return
|
|
2046
|
+
return codeAgentClip5(String(value), 60);
|
|
1872
2047
|
}
|
|
1873
2048
|
static #renderContent(content) {
|
|
1874
2049
|
if (typeof content === "string")
|
|
@@ -2320,7 +2495,8 @@ class CodeAgent2 {
|
|
|
2320
2495
|
const agent = new CodeAgent2(options.profile);
|
|
2321
2496
|
const autoCompactAt = AkanCodeCompaction2.normalize(options.autoCompactAt);
|
|
2322
2497
|
const settingsManager = AkanCodeServices2.settings();
|
|
2323
|
-
const
|
|
2498
|
+
const proxy = CodeAgentProxy.fromEnv(options.profile);
|
|
2499
|
+
const modelRuntime = await AkanCodeServices2.runtime(workspaceRoot, proxy);
|
|
2324
2500
|
const model = await akanCodeModel2(modelRuntime, options.model);
|
|
2325
2501
|
const compaction = settingsManager.getCompactionSettings(model);
|
|
2326
2502
|
const modelWarnings = akanCodeModelWarnings2(model, compaction.reserveTokens + compaction.keepRecentTokens);
|
|
@@ -2330,6 +2506,7 @@ class CodeAgent2 {
|
|
|
2330
2506
|
profile: options.profile,
|
|
2331
2507
|
apps: options.apps ?? [],
|
|
2332
2508
|
canSeeImages: akanCodeModelSupportsImages2(model),
|
|
2509
|
+
deepseek: await DeepSeekWeb.fromRuntime(modelRuntime, !!proxy),
|
|
2333
2510
|
depth: options.depth ?? 0,
|
|
2334
2511
|
...options.subagentSpend ? { subagentSpend: options.subagentSpend } : {},
|
|
2335
2512
|
currentSessionId: () => agent.sessionId,
|
|
@@ -2724,7 +2901,7 @@ Continue the task.`);
|
|
|
2724
2901
|
approvalId,
|
|
2725
2902
|
toolCallId,
|
|
2726
2903
|
name,
|
|
2727
|
-
summary:
|
|
2904
|
+
summary: codeAgentClip6(summary, codeAgentLabelChars2),
|
|
2728
2905
|
policy: this.#profile.approval
|
|
2729
2906
|
};
|
|
2730
2907
|
this.#emit({ type: "approval", request });
|
|
@@ -179,7 +179,7 @@ class SubagentPool2 {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
async#run(id, kind, prompt, signal) {
|
|
182
|
-
const { CodeAgent } = await import("./CodeAgent-
|
|
182
|
+
const { CodeAgent } = await import("./CodeAgent-n3tzjm91.js");
|
|
183
183
|
const budget = this.#options.parent.tools.subagent;
|
|
184
184
|
const child = SubagentPool2.childOf(this.#options.parent, kind);
|
|
185
185
|
const agent = await CodeAgent.create({
|
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import path from "path";
|
|
|
15
15
|
var commandModules = {
|
|
16
16
|
workspace: async () => (await import("./workspace.command-6qfgq4b4.js")).WorkspaceCommand,
|
|
17
17
|
agent: async () => (await import("./agent.command-3qxf4xcj.js")).AgentCommand,
|
|
18
|
-
code: async () => (await import("./code.command-
|
|
18
|
+
code: async () => (await import("./code.command-130bdmhe.js")).CodeCommand,
|
|
19
19
|
application: async () => (await import("./application.command-m1kcd7jf.js")).ApplicationCommand,
|
|
20
20
|
library: async () => (await import("./library.command-erp2f56n.js")).LibraryCommand,
|
|
21
21
|
localRegistry: async () => (await import("./localRegistry.command-y176p558.js")).LocalRegistryCommand,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "3.1.0-rc.
|
|
3
|
+
"version": "3.1.0-rc.13",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@earendil-works/pi-tui": "1.3.0",
|
|
40
40
|
"@inquirer/prompts": "^8.7.3",
|
|
41
41
|
"@tailwindcss/node": "^4.3.3",
|
|
42
|
-
"akanjs": "3.1.0-rc.
|
|
42
|
+
"akanjs": "3.1.0-rc.13",
|
|
43
43
|
"chalk": "^6.0.1",
|
|
44
44
|
"commander": "^15.0.0",
|
|
45
45
|
"dayjs": "^1.11.23",
|