@akanjs/cli 3.1.1 → 3.1.2-rc.0
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
package/code.command-mpkm2emr.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
Workspace,
|
|
4
|
-
runner,
|
|
5
|
-
script,
|
|
6
|
-
command
|
|
7
|
-
} from "./index-eja64h28.js";
|
|
8
|
-
import"./index-52w0fvh8.js";
|
|
9
|
-
import"./index-8scw1pjk.js";
|
|
10
|
-
import {
|
|
11
|
-
akanCodeDefaultModel2,
|
|
12
|
-
CodeAgentStreamPrinter2
|
|
13
|
-
} from "./index-c6eggbee.js";
|
|
14
|
-
|
|
15
|
-
// pkgs/@akanjs/cli/code/code.runner.ts
|
|
16
|
-
import { codeAgentPresets, isCodeAgentPresetName } from "akanjs/common";
|
|
17
|
-
|
|
18
|
-
class CodeRunner extends runner("code") {
|
|
19
|
-
async serve(options, listen) {
|
|
20
|
-
await import("./consoleToStderr-h5bryj94.js");
|
|
21
|
-
const [{ CodeAgent }, { CodeAgentRpcHost }, { CodeAgentRpcListener }] = await Promise.all([
|
|
22
|
-
import("./CodeAgent-35wnb7w5.js"),
|
|
23
|
-
import("./CodeAgentRpcHost-9g27hmer.js"),
|
|
24
|
-
import("./CodeAgentRpcListener-7p7z5dd7.js")
|
|
25
|
-
]);
|
|
26
|
-
const address = listen ? CodeAgentRpcListener.parse(listen) : null;
|
|
27
|
-
const agent = await CodeAgent.create({ ...await CodeRunner.#agentOptions(options, true), mode: "rpc" });
|
|
28
|
-
if (!address)
|
|
29
|
-
return await new CodeAgentRpcHost(agent).serve();
|
|
30
|
-
const listener = new CodeAgentRpcListener(new CodeAgentRpcHost(agent, null), address).listen();
|
|
31
|
-
process.stderr.write(`akan code rpc listening on ${"unix" in address ? address.unix : `${address.hostname}:${listener.port}`}
|
|
32
|
-
`);
|
|
33
|
-
await listener.serve();
|
|
34
|
-
}
|
|
35
|
-
async tui(options, seed) {
|
|
36
|
-
const [{ CodeAgent }, { CodeTui }] = await Promise.all([
|
|
37
|
-
import("./CodeAgent-35wnb7w5.js"),
|
|
38
|
-
import("./CodeTui-h6yz2kvq.js")
|
|
39
|
-
]);
|
|
40
|
-
const agentOptions = await CodeRunner.#agentOptions(options, false);
|
|
41
|
-
let resume = options.resume;
|
|
42
|
-
let autoCompactAt = agentOptions.autoCompactAt;
|
|
43
|
-
let prompt = seed;
|
|
44
|
-
let notice;
|
|
45
|
-
for (;; ) {
|
|
46
|
-
const agent = await CodeAgent.create({
|
|
47
|
-
...agentOptions,
|
|
48
|
-
mode: "tui",
|
|
49
|
-
...resume ? { resume } : {},
|
|
50
|
-
...autoCompactAt ? { autoCompactAt } : {}
|
|
51
|
-
});
|
|
52
|
-
let next;
|
|
53
|
-
try {
|
|
54
|
-
next = await new CodeTui(agent, {
|
|
55
|
-
thinking: options.thinking,
|
|
56
|
-
...notice ? { notice } : {}
|
|
57
|
-
}).run(prompt);
|
|
58
|
-
autoCompactAt = agent.info.autoCompactAt;
|
|
59
|
-
} finally {
|
|
60
|
-
agent.dispose();
|
|
61
|
-
}
|
|
62
|
-
if (!next)
|
|
63
|
-
return;
|
|
64
|
-
resume = next.id;
|
|
65
|
-
notice = next.notice;
|
|
66
|
-
prompt = "";
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async run(prompt, options) {
|
|
70
|
-
const { CodeAgent } = await import("./CodeAgent-35wnb7w5.js");
|
|
71
|
-
const agent = await CodeAgent.create(await CodeRunner.#agentOptions(options, false));
|
|
72
|
-
const printer = new CodeAgentStreamPrinter2({ json: options.json, thinking: options.thinking });
|
|
73
|
-
agent.on((event) => printer.print(event));
|
|
74
|
-
agent.announce();
|
|
75
|
-
try {
|
|
76
|
-
await agent.prompt(prompt);
|
|
77
|
-
await agent.waitForIdle();
|
|
78
|
-
} finally {
|
|
79
|
-
printer.finish();
|
|
80
|
-
agent.dispose();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
static async#agentOptions(options, hostAttached) {
|
|
84
|
-
const profile = CodeRunner.profileOf(options, { hostAttached });
|
|
85
|
-
return {
|
|
86
|
-
workspace: options.workspace,
|
|
87
|
-
cwd: profile.paths.root,
|
|
88
|
-
profile,
|
|
89
|
-
apps: options.app ? [options.app] : await options.workspace.getApps(),
|
|
90
|
-
model: CodeRunner.modelOf(options.model),
|
|
91
|
-
...options.compactAt !== undefined ? { autoCompactAt: options.compactAt } : {}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
static profileOf(options, { hostAttached }) {
|
|
95
|
-
if (!isCodeAgentPresetName(options.profile))
|
|
96
|
-
throw new Error(`Unknown profile: ${options.profile}. Use local, pod, review, or web.`);
|
|
97
|
-
const root = options.app ? `${options.workspace.workspaceRoot}/apps/${options.app}` : options.workspace.workspaceRoot;
|
|
98
|
-
const profile = codeAgentPresets[options.profile](root);
|
|
99
|
-
return { ...profile, ui: { ...profile.ui, canPrompt: CodeRunner.canPrompt(profile, hostAttached) } };
|
|
100
|
-
}
|
|
101
|
-
static canPrompt(profile, hostAttached) {
|
|
102
|
-
const forced = process.env.AKAN_CODE_CAN_PROMPT;
|
|
103
|
-
if (forced === "1")
|
|
104
|
-
return true;
|
|
105
|
-
if (forced === "0")
|
|
106
|
-
return false;
|
|
107
|
-
return hostAttached || profile.ui.canPrompt;
|
|
108
|
-
}
|
|
109
|
-
static modelOf(model) {
|
|
110
|
-
if (!model)
|
|
111
|
-
return;
|
|
112
|
-
const [provider, ...rest] = model.split("/");
|
|
113
|
-
if (!provider || !rest.length)
|
|
114
|
-
throw new Error(`Model must be "<provider>/<id>", e.g. ${akanCodeDefaultModel2.provider}/${akanCodeDefaultModel2.id}`);
|
|
115
|
-
return { provider, id: rest.join("/") };
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// pkgs/@akanjs/cli/code/code.script.ts
|
|
120
|
-
class CodeScript extends script("code", [CodeRunner]) {
|
|
121
|
-
async run(workspace, prompt, options) {
|
|
122
|
-
const run = {
|
|
123
|
-
workspace,
|
|
124
|
-
...options.app ? { app: options.app } : {},
|
|
125
|
-
profile: options.profile,
|
|
126
|
-
...options.model ? { model: options.model } : {},
|
|
127
|
-
...options.compactAt !== null ? { compactAt: options.compactAt } : {},
|
|
128
|
-
json: options.json,
|
|
129
|
-
thinking: options.thinking,
|
|
130
|
-
...options.resume ? { resume: options.resume } : {}
|
|
131
|
-
};
|
|
132
|
-
if (options.rpcListen)
|
|
133
|
-
return await this.codeRunner.serve(run, options.rpcListen);
|
|
134
|
-
if (options.rpc)
|
|
135
|
-
return await this.codeRunner.serve(run);
|
|
136
|
-
const interactive = options.interactive || !prompt.trim() && !options.json && !!process.stdout.isTTY;
|
|
137
|
-
if (interactive)
|
|
138
|
-
return await this.codeRunner.tui(run, prompt);
|
|
139
|
-
if (!prompt.trim())
|
|
140
|
-
throw new Error('akan code needs a prompt when it has no terminal: akan code "add a comment module"');
|
|
141
|
-
await this.codeRunner.run(prompt, run);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// pkgs/@akanjs/cli/code/code.command.ts
|
|
146
|
-
class CodeCommand extends command("code", [CodeScript], ({ public: target }) => ({
|
|
147
|
-
code: target({ desc: "Run the akan coding agent on a prompt" }).arg("prompt", String, { desc: "what the agent should do", nullable: true }).option("app", String, { desc: "narrow the agent to one app instead of the whole repo", nullable: true }).option("profile", String, { desc: "local, pod, review, or web", default: "local" }).option("model", String, { desc: "<provider>/<id>, e.g. deepseek/deepseek-flash", nullable: true }).option("compactAt", Number, {
|
|
148
|
-
desc: "compact once the context window is this full, in percent: 10, 20, \u2026 100",
|
|
149
|
-
flag: "c",
|
|
150
|
-
nullable: true
|
|
151
|
-
}).option("json", Boolean, { desc: "print one event per line as JSON", default: false }).option("thinking", Boolean, { desc: "print the model's reasoning", default: false }).option("rpc", Boolean, { desc: "serve the agent over stdio for another process to drive", default: false }).option("rpcListen", String, {
|
|
152
|
-
desc: "serve the RPC wire on unix:<path> or tcp:[host:]<port> instead of stdio",
|
|
153
|
-
flag: "L",
|
|
154
|
-
nullable: true
|
|
155
|
-
}).option("resume", String, { desc: "continue a stored session by id", flag: "R", nullable: true }).option("interactive", Boolean, {
|
|
156
|
-
desc: "open the full-screen session even when a prompt is given",
|
|
157
|
-
flag: "i",
|
|
158
|
-
default: false
|
|
159
|
-
}).with(Workspace).exec(async function(prompt, app, profile, model, compactAt, json, thinking, rpc, rpcListen, resume, interactive, workspace) {
|
|
160
|
-
const options = { app, profile, model, compactAt, json, thinking, rpc, rpcListen, interactive, resume };
|
|
161
|
-
await this.codeScript.run(workspace, prompt ?? "", options);
|
|
162
|
-
})
|
|
163
|
-
})) {
|
|
164
|
-
}
|
|
165
|
-
export {
|
|
166
|
-
CodeCommand
|
|
167
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
ContextRunner2
|
|
4
|
-
} from "./index-266dewjs.js";
|
|
5
|
-
import"./index-zcf6k8a5.js";
|
|
6
|
-
import"./index-rnphv731.js";
|
|
7
|
-
import"./index-qxzrp5xt.js";
|
|
8
|
-
import"./index-k5jbcxyh.js";
|
|
9
|
-
import"./index-r2w2eh93.js";
|
|
10
|
-
import"./index-z4b84y6k.js";
|
|
11
|
-
import"./index-fbewhg4g.js";
|
|
12
|
-
import"./index-tgt2fnd6.js";
|
|
13
|
-
import"./index-4mj92tsh.js";
|
|
14
|
-
import"./index-w7q6h97v.js";
|
|
15
|
-
import"./index-r2wedvqn.js";
|
|
16
|
-
import"./index-3yz30c07.js";
|
|
17
|
-
import"./index-m9jj544v.js";
|
|
18
|
-
import"./index-eja64h28.js";
|
|
19
|
-
import"./index-1shvxzt0.js";
|
|
20
|
-
import"./index-xqgwjz7a.js";
|
|
21
|
-
import"./index-8scw1pjk.js";
|
|
22
|
-
import"./index-hj6w4ka1.js";
|
|
23
|
-
import"./index-52w0fvh8.js";
|
|
24
|
-
export {
|
|
25
|
-
ContextRunner2 as ContextRunner
|
|
26
|
-
};
|
package/index-c6eggbee.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// pkgs/@akanjs/devkit/codeAgent/agent/akanCodeModel.ts
|
|
3
|
-
var akanCodeDefaultModel2 = { provider: "deepseek", id: "deepseek-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 (runtime, ref) => {
|
|
13
|
-
if (ref) {
|
|
14
|
-
const requested = runtime.getModel(ref.provider, ref.id);
|
|
15
|
-
if (!requested)
|
|
16
|
-
throw new Error(`Unknown model: ${ref.provider}/${ref.id}`);
|
|
17
|
-
if (!runtime.hasConfiguredAuth(ref.provider))
|
|
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 = runtime.getModel(akanCodeDefaultModel2.provider, akanCodeDefaultModel2.id);
|
|
22
|
-
if (fallback && runtime.hasConfiguredAuth(fallback.provider))
|
|
23
|
-
return correctInputs(fallback);
|
|
24
|
-
return correctInputs((await runtime.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 "tool_start":
|
|
63
|
-
return this.#line(chalk.cyan(`\u2192 ${event.tool.title}`));
|
|
64
|
-
case "tool_end":
|
|
65
|
-
return this.#line(CodeAgentStreamPrinter2.#toolEnd(event));
|
|
66
|
-
case "session":
|
|
67
|
-
return this.#line(chalk.dim(codeAgentEventLabel(event)));
|
|
68
|
-
case "turn_end":
|
|
69
|
-
if (event.stopReason === "truncated")
|
|
70
|
-
return this.#line(chalk.yellow(codeAgentEventLabel(event)));
|
|
71
|
-
return;
|
|
72
|
-
case "message":
|
|
73
|
-
case "tool_progress":
|
|
74
|
-
case "turn_start":
|
|
75
|
-
case "idle":
|
|
76
|
-
case "queue":
|
|
77
|
-
case "context":
|
|
78
|
-
case "subagent":
|
|
79
|
-
return;
|
|
80
|
-
case "question":
|
|
81
|
-
return this.#line(chalk.yellow(`? ${event.question.prompt}`));
|
|
82
|
-
case "approval":
|
|
83
|
-
return this.#line(chalk.yellow(`approve? ${event.request.summary}`));
|
|
84
|
-
case "notice":
|
|
85
|
-
return this.#line(CodeAgentStreamPrinter2.#notice(event.level, event.message));
|
|
86
|
-
case "error":
|
|
87
|
-
return this.#line(chalk.red(`error: ${event.message}`));
|
|
88
|
-
default:
|
|
89
|
-
return this.#line(chalk.dim(codeAgentEventLabel(event)));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
finish() {
|
|
93
|
-
if (this.#streaming)
|
|
94
|
-
this.#write(`
|
|
95
|
-
`);
|
|
96
|
-
this.#streaming = false;
|
|
97
|
-
}
|
|
98
|
-
#line(text) {
|
|
99
|
-
if (this.#streaming)
|
|
100
|
-
this.#write(`
|
|
101
|
-
`);
|
|
102
|
-
this.#streaming = false;
|
|
103
|
-
this.#write(`${text}
|
|
104
|
-
`);
|
|
105
|
-
}
|
|
106
|
-
static #toolEnd(event) {
|
|
107
|
-
if (event.outcome === "ok")
|
|
108
|
-
return chalk.green(`\u2713 ${event.tool.title}`);
|
|
109
|
-
if (event.outcome === "blocked")
|
|
110
|
-
return chalk.yellow(`\u29B8 ${event.tool.title} \u2014 ${event.output}`);
|
|
111
|
-
return chalk.red(`\u2717 ${event.tool.title} \u2014 ${event.output.split(`
|
|
112
|
-
`)[0] ?? ""}`);
|
|
113
|
-
}
|
|
114
|
-
static #notice(level, message) {
|
|
115
|
-
if (level === "error")
|
|
116
|
-
return chalk.red(message);
|
|
117
|
-
if (level === "warning")
|
|
118
|
-
return chalk.yellow(message);
|
|
119
|
-
return chalk.dim(message);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export { akanCodeDefaultModel2, akanCodeModel2, akanCodeModelSupportsImages2, akanCodeModelWarnings2, CodeAgentStreamPrinter2 };
|
package/index-ksfgqq1x.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
GlobalConfig,
|
|
4
|
-
CloudApi
|
|
5
|
-
} from "./index-qkkdhjm6.js";
|
|
6
|
-
|
|
7
|
-
// pkgs/@akanjs/cli/tunnel/TunnelShare.ts
|
|
8
|
-
import { TunnelAgent } from "akanjs/server/tunnel";
|
|
9
|
-
|
|
10
|
-
class TunnelShare2 {
|
|
11
|
-
#api;
|
|
12
|
-
#agent;
|
|
13
|
-
grant;
|
|
14
|
-
#closed = false;
|
|
15
|
-
constructor(api, agent, grant) {
|
|
16
|
-
this.#api = api;
|
|
17
|
-
this.#agent = agent;
|
|
18
|
-
this.grant = grant;
|
|
19
|
-
}
|
|
20
|
-
static async open(app, { workspace, host, port, ttlMinutes, onLost }) {
|
|
21
|
-
const api = await CloudApi.fromHost(workspace, await GlobalConfig.hostFor(workspace, host));
|
|
22
|
-
const grant = await api.requestTunnel({ name: app.name, ...ttlMinutes ? { ttlMinutes } : {} });
|
|
23
|
-
const origin = `http://localhost:${port ?? await app.getDevPort()}`;
|
|
24
|
-
const agent = new TunnelAgent({
|
|
25
|
-
gatewayUrl: grant.gatewayUrl,
|
|
26
|
-
token: grant.token,
|
|
27
|
-
hostnames: [grant.hostname],
|
|
28
|
-
origin,
|
|
29
|
-
name: app.name,
|
|
30
|
-
...onLost ? { onLost } : {}
|
|
31
|
-
});
|
|
32
|
-
await agent.start();
|
|
33
|
-
return new TunnelShare2(api, agent, grant);
|
|
34
|
-
}
|
|
35
|
-
get url() {
|
|
36
|
-
return this.grant.url;
|
|
37
|
-
}
|
|
38
|
-
async close() {
|
|
39
|
-
if (this.#closed)
|
|
40
|
-
return;
|
|
41
|
-
this.#closed = true;
|
|
42
|
-
await this.#agent.stop("cli exited");
|
|
43
|
-
try {
|
|
44
|
-
await this.#api.revokeTunnel(this.grant.code);
|
|
45
|
-
} catch {}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { TunnelShare2 };
|