@akanjs/cli 3.0.0-beta.14 → 3.0.0-beta.15
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-d3wvbq8q.js +9 -0
- package/CodeAgentRpcHost-qvwfv0n9.js +7 -0
- package/CodeTui-6c9a2wtk.js +1103 -0
- package/README.md +3 -0
- package/{agent.command-bhwsc2aj.js → agent.command-9cg8m87z.js} +6 -6
- package/akanCode.js +100 -0
- package/{application.command-436y543n.js → application.command-x75men32.js} +6 -5
- package/{applicationBuildRunner-4f1wrba0.js → applicationBuildRunner-d3702f1w.js} +2 -2
- package/{applicationReleasePackager-jkjmy5ee.js → applicationReleasePackager-2kdyj3te.js} +1 -1
- package/buildBatch.proc.js +2 -2
- package/{capacitorApp-hqvsrec4.js → capacitorApp-qk975zyz.js} +2 -2
- package/{cloud.command-3xn0xpz8.js → cloud.command-a09wggfq.js} +9 -8
- package/cloud.script-qd3hpybf.js +20 -0
- package/code.command-ca7rpmez.js +147 -0
- package/commandManifest.json +1 -1
- package/consoleToStderr-h5bryj94.js +7 -0
- package/{context.command-hxh96cc3.js → context.command-9kbm0527.js} +14 -13
- package/context.runner-wtqpw7mh.js +22 -0
- package/{devTui-4ted58a6.js → devTui-v19fbnpk.js} +114 -8
- package/{devTuiView-1dj2yq7t.js → devTuiView-pa63jrjq.js} +1 -1
- package/{guideline.command-cyw8c0m0.js → guideline.command-qvrh5pnx.js} +6 -6
- package/guidelines/agentRule/agentRule.instruction.md +22 -2
- package/guidelines/conventions/conventions.instruction.md +3 -1
- package/incrementalBuilder.proc.js +1 -1
- package/{index-tt6kzwj5.js → index-0qvq9aeb.js} +3 -3
- package/{index-jwjaf9fy.js → index-1p146w4s.js} +44 -44
- package/{index-7f4dsf9v.js → index-1sggq0m8.js} +1 -1
- package/{index-15r9a10e.js → index-3dmebxnk.js} +2 -2
- package/{index-vrwdx0zx.js → index-3hr7cpy1.js} +1 -1
- package/{index-31hmq4ys.js → index-5hy11qaq.js} +8 -8
- package/{index-8pkvrcv1.js → index-658xafm1.js} +3 -3
- package/index-7md2g9vw.js +6 -0
- package/{index-ys7dvdb3.js → index-84b080zh.js} +1 -1
- package/index-8k16atqy.js +82 -0
- package/{index-8tcj5wk8.js → index-91brpnzb.js} +5 -5
- package/{index-em4swemt.js → index-bchkysja.js} +3 -3
- package/{index-fad0hhty.js → index-bzjnp9ap.js} +22 -80
- package/{index-sg1bgdhe.js → index-chp5gqmm.js} +27 -105
- package/{index-r73ha1rf.js → index-d35a8vc0.js} +4 -4
- package/{index-1nwxbr2y.js → index-ea1smknd.js} +2 -2
- package/index-egt4vfgb.js +69 -0
- package/index-erzcytap.js +2434 -0
- package/{index-sh88vtye.js → index-f4gpcp98.js} +1 -1
- package/{index-b3ae16mg.js → index-gca9y01h.js} +1 -1
- package/index-sxg87a8f.js +727 -0
- package/{index-h7yw2z9n.js → index-twq9p2sp.js} +8 -8
- package/{index-9fbk3dbh.js → index-v156f836.js} +4 -4
- package/{index-1mrmve4s.js → index-v1y3cx0k.js} +2 -2
- package/{index-t8gvwcrx.js → index-va2je2qm.js} +2 -2
- package/index-wfwknnje.js +124 -0
- package/index-x7g1qzpt.js +121 -0
- package/index.js +21 -20
- package/{library.command-1f9h2ex6.js → library.command-n89re6cx.js} +3 -3
- package/{localRegistry.command-4cbgz63s.js → localRegistry.command-1mmnegph.js} +8 -7
- package/{module.command-ew0484va.js → module.command-4m82zgfp.js} +5 -5
- package/{package.command-y2rh4np7.js → package.command-9dv0p6zq.js} +3 -3
- package/package.json +9 -2
- package/{page.command-e5h29fyt.js → page.command-q86b0m0z.js} +3 -3
- package/{primitive.command-50ecfzg4.js → primitive.command-kaneasq6.js} +6 -6
- package/prompter-9mn3kp36.js +8 -0
- package/{quality.command-a2jytczs.js → quality.command-sgapx315.js} +2 -2
- package/{repair.command-c2amvt74.js → repair.command-efc5gdbq.js} +5 -5
- package/{scalar.command-bptz6aj6.js → scalar.command-e2rpkhqy.js} +4 -4
- package/skills/akan-debug/SKILL.md +42 -0
- package/skills/akan-deps/SKILL.md +50 -0
- package/skills/akan-err/SKILL.md +39 -0
- package/skills/akan-module/SKILL.md +45 -0
- package/skills/akan-scaffold/SKILL.md +76 -0
- package/skills/akan-scalar/SKILL.md +52 -0
- package/skills/akan-service/SKILL.md +34 -0
- package/skills/akan-store/SKILL.md +63 -0
- package/skills/akan-ui/SKILL.md +63 -0
- package/skills/akan-validate/SKILL.md +44 -0
- package/{subspace.command-kmemx1vm.js → subspace.command-005rz1x6.js} +4 -4
- package/{tunnel.command-67q8vsg5.js → tunnel.command-66j9estx.js} +2 -2
- package/{workflow.command-2ze5y2xp.js → workflow.command-z1xcm4c7.js} +9 -9
- package/{workspace.command-2n385jkt.js → workspace.command-4ahrhp3k.js} +22 -20
- package/cloud.script-0a76c2g8.js +0 -19
- /package/{index-5nyznra1.js → index-p1j0cyvd.js} +0 -0
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
// pkgs/@akanjs/devkit/prompter.ts
|
|
7
7
|
import fsPromise from "fs/promises";
|
|
8
8
|
import { input, select } from "@inquirer/prompts";
|
|
9
|
-
class
|
|
9
|
+
class Prompter2 {
|
|
10
10
|
static async#getGuidelineRoot() {
|
|
11
11
|
const dirname = getDirname2(import.meta.url);
|
|
12
12
|
const candidates = [`${dirname}/guidelines`, `${dirname}/../cli/guidelines`];
|
|
@@ -19,27 +19,27 @@ class Prompter {
|
|
|
19
19
|
return candidates[0];
|
|
20
20
|
}
|
|
21
21
|
static async selectGuideline() {
|
|
22
|
-
const guideNames = await
|
|
22
|
+
const guideNames = await Prompter2.listGuidelines();
|
|
23
23
|
return await select({
|
|
24
24
|
message: "Select a guideline",
|
|
25
25
|
choices: guideNames.map((name) => ({ name, value: name }))
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
static async listGuidelines() {
|
|
29
|
-
const guidelineRoot = await
|
|
29
|
+
const guidelineRoot = await Prompter2.#getGuidelineRoot();
|
|
30
30
|
return (await fsPromise.readdir(guidelineRoot)).filter((name) => !name.startsWith("_")).sort();
|
|
31
31
|
}
|
|
32
32
|
static async getGuideJson(guideName) {
|
|
33
|
-
const guidelineRoot = await
|
|
33
|
+
const guidelineRoot = await Prompter2.#getGuidelineRoot();
|
|
34
34
|
const filePath = `${guidelineRoot}/${guideName}/${guideName}.generate.json`;
|
|
35
35
|
const guideJson = await fsPromise.readFile(filePath, "utf-8");
|
|
36
36
|
return JSON.parse(guideJson);
|
|
37
37
|
}
|
|
38
38
|
static async getInstruction(guideName) {
|
|
39
|
-
const guideNames = await
|
|
39
|
+
const guideNames = await Prompter2.listGuidelines();
|
|
40
40
|
if (!guideNames.includes(guideName))
|
|
41
41
|
throw new Error(`Unknown guideline "${guideName}". Available: ${guideNames.join(", ")}`);
|
|
42
|
-
const guidelineRoot = await
|
|
42
|
+
const guidelineRoot = await Prompter2.#getGuidelineRoot();
|
|
43
43
|
return await fsPromise.readFile(`${guidelineRoot}/${guideName}/${guideName}.instruction.md`, "utf-8");
|
|
44
44
|
}
|
|
45
45
|
static async getUpdateRequest(guideName) {
|
|
@@ -67,7 +67,7 @@ ${request}
|
|
|
67
67
|
`;
|
|
68
68
|
}
|
|
69
69
|
async getDocumentation(guideName) {
|
|
70
|
-
const guidelineRoot = await
|
|
70
|
+
const guidelineRoot = await Prompter2.#getGuidelineRoot();
|
|
71
71
|
const filePath = `${guidelineRoot}/${guideName}/${guideName}.instruction.md`;
|
|
72
72
|
const document = await fsPromise.readFile(filePath, "utf-8");
|
|
73
73
|
return `\`\`\`markdown
|
|
@@ -77,4 +77,4 @@ ${document}
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export {
|
|
80
|
+
export { Prompter2 };
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-gca9y01h.js";
|
|
6
6
|
import {
|
|
7
7
|
ModuleExecutor
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-p1j0cyvd.js";
|
|
9
9
|
import {
|
|
10
10
|
sourceFile,
|
|
11
11
|
moduleSourcePaths,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
createPassedPrimitiveReport,
|
|
14
14
|
bilingualLabelForField,
|
|
15
15
|
bilingualDescriptionForField
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-1p146w4s.js";
|
|
17
17
|
import {
|
|
18
18
|
PageScript
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-f4gpcp98.js";
|
|
20
20
|
import {
|
|
21
21
|
pluralizeName
|
|
22
22
|
} from "./index-nz8prx9g.js";
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-gca9y01h.js";
|
|
6
6
|
import {
|
|
7
7
|
generatedFilesForSync,
|
|
8
8
|
createPassedPrimitiveReport,
|
|
9
9
|
scalarChangedFiles
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-1p146w4s.js";
|
|
11
11
|
import {
|
|
12
12
|
pluralizeName
|
|
13
13
|
} from "./index-nz8prx9g.js";
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-gca9y01h.js";
|
|
6
6
|
import {
|
|
7
7
|
FileSys
|
|
8
8
|
} from "./index-q0y2jq9j.js";
|
|
9
9
|
import {
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-p1j0cyvd.js";
|
|
12
12
|
import {
|
|
13
13
|
TypeScriptDependencyScanner2
|
|
14
14
|
} from "./index-kcxmv48c.js";
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/codeAgent/agent/akanCodeModel.ts
|
|
3
|
+
var akanCodeDefaultModel2 = { provider: "deepseek", id: "deepseek-v4-flash" };
|
|
4
|
+
var catalogueMissesImages = new Set(["deepseek/deepseek-v4-flash"]);
|
|
5
|
+
var correctInputs = (model) => {
|
|
6
|
+
if (!model || model.input.includes("image"))
|
|
7
|
+
return model;
|
|
8
|
+
if (!catalogueMissesImages.has(`${model.provider}/${model.id}`))
|
|
9
|
+
return model;
|
|
10
|
+
return { ...model, input: [...model.input, "image"] };
|
|
11
|
+
};
|
|
12
|
+
var akanCodeModel2 = async (registry, ref) => {
|
|
13
|
+
if (ref) {
|
|
14
|
+
const requested = registry.find(ref.provider, ref.id);
|
|
15
|
+
if (!requested)
|
|
16
|
+
throw new Error(`Unknown model: ${ref.provider}/${ref.id}`);
|
|
17
|
+
if (!registry.hasConfiguredAuth(requested))
|
|
18
|
+
throw new Error(`No API key configured for ${ref.provider}. Set ${ref.provider.toUpperCase()}_API_KEY.`);
|
|
19
|
+
return correctInputs(requested);
|
|
20
|
+
}
|
|
21
|
+
const fallback = registry.find(akanCodeDefaultModel2.provider, akanCodeDefaultModel2.id);
|
|
22
|
+
if (fallback && registry.hasConfiguredAuth(fallback))
|
|
23
|
+
return correctInputs(fallback);
|
|
24
|
+
return correctInputs(registry.getAvailable()[0]);
|
|
25
|
+
};
|
|
26
|
+
var akanCodeModelSupportsImages2 = (model) => !!model?.input.includes("image");
|
|
27
|
+
var akanCodeModelWarnings2 = (model, compactionFloor) => {
|
|
28
|
+
if (!model)
|
|
29
|
+
return [];
|
|
30
|
+
if (model.contextWindow >= compactionFloor)
|
|
31
|
+
return [];
|
|
32
|
+
return [
|
|
33
|
+
`${model.provider}/${model.id} declares a ${model.contextWindow}-token context window, below the ${compactionFloor} the compaction policy needs, so every turn will compact immediately. Check the model entry in ~/.akan/code/models.json.`
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// pkgs/@akanjs/devkit/codeAgent/agent/CodeAgentStreamPrinter.ts
|
|
38
|
+
import { codeAgentEventLabel } from "akanjs/common";
|
|
39
|
+
import chalk from "chalk";
|
|
40
|
+
|
|
41
|
+
class CodeAgentStreamPrinter2 {
|
|
42
|
+
#options;
|
|
43
|
+
#write;
|
|
44
|
+
#streaming = false;
|
|
45
|
+
constructor(options = {}) {
|
|
46
|
+
this.#options = options;
|
|
47
|
+
this.#write = options.write ?? ((text) => process.stdout.write(text));
|
|
48
|
+
}
|
|
49
|
+
print(event) {
|
|
50
|
+
if (this.#options.json)
|
|
51
|
+
return this.#write(`${JSON.stringify(event)}
|
|
52
|
+
`);
|
|
53
|
+
switch (event.type) {
|
|
54
|
+
case "text_delta":
|
|
55
|
+
this.#streaming = true;
|
|
56
|
+
return this.#write(event.text);
|
|
57
|
+
case "thinking_delta":
|
|
58
|
+
if (!this.#options.thinking)
|
|
59
|
+
return;
|
|
60
|
+
this.#streaming = true;
|
|
61
|
+
return this.#write(chalk.dim(event.text));
|
|
62
|
+
case "message":
|
|
63
|
+
return;
|
|
64
|
+
case "tool_start":
|
|
65
|
+
return this.#line(chalk.cyan(`\u2192 ${event.tool.title}`));
|
|
66
|
+
case "tool_progress":
|
|
67
|
+
return;
|
|
68
|
+
case "tool_end":
|
|
69
|
+
return this.#line(CodeAgentStreamPrinter2.#toolEnd(event));
|
|
70
|
+
case "session":
|
|
71
|
+
return this.#line(chalk.dim(codeAgentEventLabel(event)));
|
|
72
|
+
case "turn_end":
|
|
73
|
+
if (event.stopReason === "truncated")
|
|
74
|
+
return this.#line(chalk.yellow(codeAgentEventLabel(event)));
|
|
75
|
+
return;
|
|
76
|
+
case "turn_start":
|
|
77
|
+
case "idle":
|
|
78
|
+
case "queue":
|
|
79
|
+
case "context":
|
|
80
|
+
return;
|
|
81
|
+
case "question":
|
|
82
|
+
return this.#line(chalk.yellow(`? ${event.question.prompt}`));
|
|
83
|
+
case "approval":
|
|
84
|
+
return this.#line(chalk.yellow(`approve? ${event.request.summary}`));
|
|
85
|
+
case "notice":
|
|
86
|
+
return this.#line(CodeAgentStreamPrinter2.#notice(event.level, event.message));
|
|
87
|
+
case "error":
|
|
88
|
+
return this.#line(chalk.red(`error: ${event.message}`));
|
|
89
|
+
default:
|
|
90
|
+
return this.#line(chalk.dim(codeAgentEventLabel(event)));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
finish() {
|
|
94
|
+
if (this.#streaming)
|
|
95
|
+
this.#write(`
|
|
96
|
+
`);
|
|
97
|
+
this.#streaming = false;
|
|
98
|
+
}
|
|
99
|
+
#line(text) {
|
|
100
|
+
if (this.#streaming)
|
|
101
|
+
this.#write(`
|
|
102
|
+
`);
|
|
103
|
+
this.#streaming = false;
|
|
104
|
+
this.#write(`${text}
|
|
105
|
+
`);
|
|
106
|
+
}
|
|
107
|
+
static #toolEnd(event) {
|
|
108
|
+
if (event.outcome === "ok")
|
|
109
|
+
return chalk.green(`\u2713 ${event.tool.title}`);
|
|
110
|
+
if (event.outcome === "blocked")
|
|
111
|
+
return chalk.yellow(`\u29B8 ${event.tool.title} \u2014 ${event.output}`);
|
|
112
|
+
return chalk.red(`\u2717 ${event.tool.title} \u2014 ${event.output.split(`
|
|
113
|
+
`)[0] ?? ""}`);
|
|
114
|
+
}
|
|
115
|
+
static #notice(level, message) {
|
|
116
|
+
if (level === "error")
|
|
117
|
+
return chalk.red(message);
|
|
118
|
+
if (level === "warning")
|
|
119
|
+
return chalk.yellow(message);
|
|
120
|
+
return chalk.dim(message);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { akanCodeDefaultModel2, akanCodeModel2, akanCodeModelSupportsImages2, akanCodeModelWarnings2, CodeAgentStreamPrinter2 };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/codeAgent/agent/SubagentPool.ts
|
|
3
|
+
import { codeAgentReadOnlyBuiltins } from "akanjs/common";
|
|
4
|
+
import { Type } from "typebox";
|
|
5
|
+
var maxResultChars = 8000;
|
|
6
|
+
|
|
7
|
+
class SubagentPool2 {
|
|
8
|
+
static kinds = {
|
|
9
|
+
explore: {
|
|
10
|
+
readOnly: true,
|
|
11
|
+
desc: "reads, searches and reports back. It cannot write a file or run a command."
|
|
12
|
+
},
|
|
13
|
+
code: {
|
|
14
|
+
readOnly: false,
|
|
15
|
+
desc: "makes the change itself, with the same tools as this session."
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
static defaultKind = "explore";
|
|
19
|
+
#options;
|
|
20
|
+
#running = 0;
|
|
21
|
+
#spent = 0;
|
|
22
|
+
constructor(options) {
|
|
23
|
+
this.#options = options;
|
|
24
|
+
}
|
|
25
|
+
static extensionFor(options) {
|
|
26
|
+
if (!options.parent.tools.subagent)
|
|
27
|
+
return;
|
|
28
|
+
if (options.depth >= options.parent.tools.subagent.maxDepth)
|
|
29
|
+
return;
|
|
30
|
+
const pool = new SubagentPool2(options);
|
|
31
|
+
return { name: "akan-subagent", factory: (pi) => pool.#register(pi) };
|
|
32
|
+
}
|
|
33
|
+
static toolName = "task";
|
|
34
|
+
#register(pi) {
|
|
35
|
+
pi.registerTool({
|
|
36
|
+
name: SubagentPool2.toolName,
|
|
37
|
+
label: "Task",
|
|
38
|
+
description: "Run a focused sub-agent on one self-contained question and get back its answer. Use it for searching and reading that would otherwise fill this conversation \u2014 the sub-agent's own reading does not come back, only its answer. Give it everything it needs: it cannot see this conversation.",
|
|
39
|
+
promptSnippet: "task: run a sub-agent on one self-contained question and get back only its answer",
|
|
40
|
+
parameters: Type.Object({
|
|
41
|
+
description: Type.String({ description: "Three to five words naming the task, for the activity log." }),
|
|
42
|
+
prompt: Type.String({
|
|
43
|
+
description: "The complete instruction. The sub-agent sees nothing of this conversation."
|
|
44
|
+
}),
|
|
45
|
+
type: Type.Optional(Type.Union(Object.entries(SubagentPool2.kinds).map(([kind, spec]) => Type.Literal(kind, { description: spec.desc })), { description: `What the sub-agent may do. Defaults to ${SubagentPool2.defaultKind}.` }))
|
|
46
|
+
}),
|
|
47
|
+
execute: async (_id, params, signal) => {
|
|
48
|
+
const kind = params.type ?? SubagentPool2.defaultKind;
|
|
49
|
+
const refusal = this.#refuse();
|
|
50
|
+
if (refusal)
|
|
51
|
+
return { content: [{ type: "text", text: refusal }], details: undefined, isError: true };
|
|
52
|
+
this.#running += 1;
|
|
53
|
+
this.#options.onNotice?.(`${kind} sub-agent \xB7 ${params.description}`);
|
|
54
|
+
try {
|
|
55
|
+
const text = await this.#run(kind, params.prompt, signal);
|
|
56
|
+
return { content: [{ type: "text", text }], details: undefined };
|
|
57
|
+
} finally {
|
|
58
|
+
this.#running -= 1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
#refuse() {
|
|
64
|
+
const budget = this.#options.parent.tools.subagent;
|
|
65
|
+
if (!budget)
|
|
66
|
+
return "Sub-agents are disabled by this profile.";
|
|
67
|
+
if (this.#running >= budget.maxConcurrent)
|
|
68
|
+
return `Too many sub-agents are already running (limit ${budget.maxConcurrent}). Wait for one to finish.`;
|
|
69
|
+
if (this.#spent >= budget.budget)
|
|
70
|
+
return `The sub-agent token budget (${budget.budget}) is spent. Do the rest of this work yourself.`;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
static childOf(parent, kind) {
|
|
74
|
+
const budget = parent.tools.subagent;
|
|
75
|
+
return {
|
|
76
|
+
...parent,
|
|
77
|
+
name: `${parent.name}:${kind}`,
|
|
78
|
+
tools: {
|
|
79
|
+
...parent.tools,
|
|
80
|
+
builtin: SubagentPool2.kinds[kind].readOnly ? parent.tools.builtin.filter((tool) => codeAgentReadOnlyBuiltins.includes(tool)) : parent.tools.builtin,
|
|
81
|
+
subagent: budget ? { ...budget, maxDepth: budget.maxDepth } : false
|
|
82
|
+
},
|
|
83
|
+
session: { store: "memory", crossSession: false },
|
|
84
|
+
ui: { canPrompt: false },
|
|
85
|
+
context: { projectFiles: false, skills: parent.context.skills }
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
async#run(kind, prompt, signal) {
|
|
89
|
+
const { CodeAgent } = await import("./CodeAgent-d3wvbq8q.js");
|
|
90
|
+
const budget = this.#options.parent.tools.subagent;
|
|
91
|
+
const child = SubagentPool2.childOf(this.#options.parent, kind);
|
|
92
|
+
const agent = await CodeAgent.create({
|
|
93
|
+
workspace: this.#options.workspace,
|
|
94
|
+
cwd: this.#options.cwd,
|
|
95
|
+
profile: child,
|
|
96
|
+
apps: [],
|
|
97
|
+
depth: this.#options.depth + 1
|
|
98
|
+
});
|
|
99
|
+
const abort = () => void agent.abort();
|
|
100
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
101
|
+
try {
|
|
102
|
+
let answer = "";
|
|
103
|
+
agent.on((event) => {
|
|
104
|
+
if (event.type === "message" && event.role === "assistant")
|
|
105
|
+
answer = event.text;
|
|
106
|
+
});
|
|
107
|
+
await agent.prompt(prompt);
|
|
108
|
+
await agent.waitForIdle();
|
|
109
|
+
this.#spent += agent.tokensUsed;
|
|
110
|
+
const ceiling = budget ? budget.budget : 0;
|
|
111
|
+
this.#options.onNotice?.(`${kind} sub-agent finished, ${agent.tokensUsed} tokens (${this.#spent} of ${ceiling} spent)`);
|
|
112
|
+
return answer.length > maxResultChars ? `${answer.slice(0, maxResultChars)}
|
|
113
|
+
\u2026(truncated)` : answer || "(no answer)";
|
|
114
|
+
} finally {
|
|
115
|
+
signal?.removeEventListener("abort", abort);
|
|
116
|
+
agent.dispose();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { SubagentPool2 };
|
package/index.js
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
getTargetMetas,
|
|
5
5
|
getTargetCommandNames,
|
|
6
6
|
runCommands
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-gca9y01h.js";
|
|
8
8
|
import"./index-q0y2jq9j.js";
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-p1j0cyvd.js";
|
|
10
10
|
import"./index-6wwzs1bc.js";
|
|
11
11
|
|
|
12
12
|
// pkgs/@akanjs/cli/commandManifest.ts
|
|
@@ -14,24 +14,25 @@ import path from "path";
|
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/commandModules.ts
|
|
16
16
|
var commandModules = {
|
|
17
|
-
workspace: async () => (await import("./workspace.command-
|
|
18
|
-
agent: async () => (await import("./agent.command-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
workspace: async () => (await import("./workspace.command-4ahrhp3k.js")).WorkspaceCommand,
|
|
18
|
+
agent: async () => (await import("./agent.command-9cg8m87z.js")).AgentCommand,
|
|
19
|
+
code: async () => (await import("./code.command-ca7rpmez.js")).CodeCommand,
|
|
20
|
+
application: async () => (await import("./application.command-x75men32.js")).ApplicationCommand,
|
|
21
|
+
library: async () => (await import("./library.command-n89re6cx.js")).LibraryCommand,
|
|
22
|
+
localRegistry: async () => (await import("./localRegistry.command-1mmnegph.js")).LocalRegistryCommand,
|
|
23
|
+
package: async () => (await import("./package.command-9dv0p6zq.js")).PackageCommand,
|
|
24
|
+
module: async () => (await import("./module.command-4m82zgfp.js")).ModuleCommand,
|
|
25
|
+
page: async () => (await import("./page.command-q86b0m0z.js")).PageCommand,
|
|
26
|
+
context: async () => (await import("./context.command-9kbm0527.js")).ContextCommand,
|
|
27
|
+
cloud: async () => (await import("./cloud.command-a09wggfq.js")).CloudCommand,
|
|
28
|
+
subspace: async () => (await import("./subspace.command-005rz1x6.js")).SubspaceCommand,
|
|
29
|
+
guideline: async () => (await import("./guideline.command-qvrh5pnx.js")).GuidelineCommand,
|
|
30
|
+
scalar: async () => (await import("./scalar.command-e2rpkhqy.js")).ScalarCommand,
|
|
31
|
+
primitive: async () => (await import("./primitive.command-kaneasq6.js")).PrimitiveCommand,
|
|
32
|
+
quality: async () => (await import("./quality.command-sgapx315.js")).QualityCommand,
|
|
33
|
+
repair: async () => (await import("./repair.command-efc5gdbq.js")).RepairCommand,
|
|
34
|
+
workflow: async () => (await import("./workflow.command-z1xcm4c7.js")).WorkflowCommand,
|
|
35
|
+
tunnel: async () => (await import("./tunnel.command-66j9estx.js")).TunnelCommand
|
|
35
36
|
};
|
|
36
37
|
var commandModuleIds = Object.keys(commandModules);
|
|
37
38
|
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
Lib,
|
|
4
4
|
Workspace,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gca9y01h.js";
|
|
7
7
|
import"./index-q0y2jq9j.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-p1j0cyvd.js";
|
|
9
9
|
import"./index-6wwzs1bc.js";
|
|
10
10
|
import {
|
|
11
11
|
LibraryScript
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-ea1smknd.js";
|
|
13
13
|
|
|
14
14
|
// pkgs/@akanjs/cli/library/library.command.ts
|
|
15
15
|
class LibraryCommand extends command("library", [LibraryScript], ({ public: target }) => ({
|
|
@@ -4,27 +4,28 @@ import {
|
|
|
4
4
|
runner,
|
|
5
5
|
script,
|
|
6
6
|
command
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-gca9y01h.js";
|
|
8
8
|
import"./index-q0y2jq9j.js";
|
|
9
9
|
import {
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-p1j0cyvd.js";
|
|
12
12
|
import"./index-6wwzs1bc.js";
|
|
13
13
|
import {
|
|
14
14
|
ApplicationScript
|
|
15
|
-
} from "./index-
|
|
16
|
-
import"./index-
|
|
15
|
+
} from "./index-chp5gqmm.js";
|
|
16
|
+
import"./index-ea1smknd.js";
|
|
17
17
|
import"./index-hwkygn9s.js";
|
|
18
|
+
import"./index-7md2g9vw.js";
|
|
18
19
|
import"./index-myj01w9r.js";
|
|
19
20
|
import {
|
|
20
21
|
getNpmRegistryUrl,
|
|
21
22
|
CloudRunner
|
|
22
|
-
} from "./index-
|
|
23
|
+
} from "./index-0qvq9aeb.js";
|
|
23
24
|
import"./index-kcxmv48c.js";
|
|
24
25
|
import {
|
|
25
26
|
PackageScript
|
|
26
|
-
} from "./index-
|
|
27
|
-
import"./index-
|
|
27
|
+
} from "./index-va2je2qm.js";
|
|
28
|
+
import"./index-84b080zh.js";
|
|
28
29
|
|
|
29
30
|
// pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
|
|
30
31
|
import { mkdir, rm } from "fs/promises";
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
Sys,
|
|
4
4
|
Module,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gca9y01h.js";
|
|
7
7
|
import"./index-q0y2jq9j.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-p1j0cyvd.js";
|
|
9
9
|
import"./index-6wwzs1bc.js";
|
|
10
10
|
import {
|
|
11
11
|
renderPrimitiveReport
|
|
12
|
-
} from "./index-
|
|
13
|
-
import"./index-
|
|
12
|
+
} from "./index-1p146w4s.js";
|
|
13
|
+
import"./index-f4gpcp98.js";
|
|
14
14
|
import {
|
|
15
15
|
ModuleScript
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-v156f836.js";
|
|
17
17
|
|
|
18
18
|
// pkgs/@akanjs/cli/module/module.command.ts
|
|
19
19
|
import { Logger, lowerlize } from "akanjs/common";
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
Pkg,
|
|
4
4
|
Workspace,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gca9y01h.js";
|
|
7
7
|
import"./index-q0y2jq9j.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-p1j0cyvd.js";
|
|
9
9
|
import"./index-6wwzs1bc.js";
|
|
10
10
|
import"./index-kcxmv48c.js";
|
|
11
11
|
import {
|
|
12
12
|
PackageScript
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-va2je2qm.js";
|
|
14
14
|
|
|
15
15
|
// pkgs/@akanjs/cli/package/package.command.ts
|
|
16
16
|
class PackageCommand extends command("package", [PackageScript], ({ public: target }) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/cli",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.15",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -24,13 +24,18 @@
|
|
|
24
24
|
"import": "./index.js",
|
|
25
25
|
"default": "./index.js"
|
|
26
26
|
},
|
|
27
|
+
"./code": {
|
|
28
|
+
"import": "./akanCode.js",
|
|
29
|
+
"default": "./akanCode.js"
|
|
30
|
+
},
|
|
27
31
|
"./package.json": "./package.json"
|
|
28
32
|
},
|
|
29
33
|
"dependencies": {
|
|
34
|
+
"@earendil-works/pi-coding-agent": "0.80.6",
|
|
30
35
|
"@inquirer/prompts": "^8.4.3",
|
|
31
36
|
"@tailwindcss/node": "^4.3.0",
|
|
32
37
|
"@trapezedev/project": "^7.1.4",
|
|
33
|
-
"akanjs": "3.0.0-beta.
|
|
38
|
+
"akanjs": "3.0.0-beta.15",
|
|
34
39
|
"chalk": "^5.6.2",
|
|
35
40
|
"commander": "^14.0.3",
|
|
36
41
|
"dayjs": "^1.11.20",
|
|
@@ -42,9 +47,11 @@
|
|
|
42
47
|
"qrcode": "^1.5.4",
|
|
43
48
|
"react": "19.2.7",
|
|
44
49
|
"ssh2": "^1.17.0",
|
|
50
|
+
"string-width": "^8.2.1",
|
|
45
51
|
"subset-font": "^2.5.0",
|
|
46
52
|
"tailwind-scrollbar": "^4.0.2",
|
|
47
53
|
"tailwindcss": "^4.3.0",
|
|
54
|
+
"typebox": "1.1.38",
|
|
48
55
|
"typescript": "^6.0.3"
|
|
49
56
|
},
|
|
50
57
|
"devDependencies": {},
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
App,
|
|
4
4
|
Module,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gca9y01h.js";
|
|
7
7
|
import"./index-q0y2jq9j.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-p1j0cyvd.js";
|
|
9
9
|
import"./index-6wwzs1bc.js";
|
|
10
10
|
import {
|
|
11
11
|
PageScript
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-f4gpcp98.js";
|
|
13
13
|
|
|
14
14
|
// pkgs/@akanjs/cli/page/page.command.ts
|
|
15
15
|
class PageCommand extends command("page", [PageScript], ({ public: target }) => ({
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Workspace,
|
|
4
4
|
command
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-gca9y01h.js";
|
|
6
6
|
import"./index-q0y2jq9j.js";
|
|
7
|
-
import"./index-
|
|
7
|
+
import"./index-p1j0cyvd.js";
|
|
8
8
|
import"./index-6wwzs1bc.js";
|
|
9
9
|
import {
|
|
10
10
|
renderPrimitiveReport
|
|
11
|
-
} from "./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
11
|
+
} from "./index-1p146w4s.js";
|
|
12
|
+
import"./index-f4gpcp98.js";
|
|
13
|
+
import"./index-v156f836.js";
|
|
14
14
|
import {
|
|
15
15
|
PrimitiveScript
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-d35a8vc0.js";
|
|
17
17
|
|
|
18
18
|
// pkgs/@akanjs/cli/primitive/primitive.command.ts
|
|
19
19
|
import { Logger } from "akanjs/common";
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
runner,
|
|
5
5
|
script,
|
|
6
6
|
command
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-gca9y01h.js";
|
|
8
8
|
import"./index-q0y2jq9j.js";
|
|
9
9
|
import {
|
|
10
10
|
rootAllowedFiles,
|
|
11
11
|
rootAllowedDirs,
|
|
12
12
|
isAllowedLibFacetRootFile
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-p1j0cyvd.js";
|
|
14
14
|
import"./index-6wwzs1bc.js";
|
|
15
15
|
|
|
16
16
|
// pkgs/@akanjs/devkit/qualityScanner.ts
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
Workspace,
|
|
4
4
|
script,
|
|
5
5
|
command
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-gca9y01h.js";
|
|
7
7
|
import"./index-q0y2jq9j.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-p1j0cyvd.js";
|
|
9
9
|
import"./index-6wwzs1bc.js";
|
|
10
10
|
import"./index-by5gpp8x.js";
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
11
|
+
import"./index-1p146w4s.js";
|
|
12
|
+
import"./index-3dmebxnk.js";
|
|
13
13
|
import {
|
|
14
14
|
RepairRunner
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-bchkysja.js";
|
|
16
16
|
|
|
17
17
|
// pkgs/@akanjs/cli/repair/repair.script.ts
|
|
18
18
|
import { Logger } from "akanjs/common";
|