@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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./index-
|
|
3
|
+
stripAnsi
|
|
4
|
+
} from "./index-7md2g9vw.js";
|
|
5
|
+
import {
|
|
6
|
+
openBrowser
|
|
7
|
+
} from "./index-chp5gqmm.js";
|
|
8
8
|
import {
|
|
9
9
|
writeClipboard
|
|
10
10
|
} from "./index-p6pbz9n5.js";
|
|
@@ -156,6 +156,8 @@ var DevTuiApp = ({ actions }) => {
|
|
|
156
156
|
actions.copyLines();
|
|
157
157
|
else if (input === "Y")
|
|
158
158
|
actions.copyPath();
|
|
159
|
+
else if (input === "s")
|
|
160
|
+
actions.copyShareUrl();
|
|
159
161
|
else if (input === "o")
|
|
160
162
|
actions.openSelected();
|
|
161
163
|
else if (input === "r")
|
|
@@ -216,12 +218,95 @@ var DevTuiApp = ({ actions }) => {
|
|
|
216
218
|
}, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV(Text, {
|
|
217
219
|
dimColor: true,
|
|
218
220
|
wrap: "truncate",
|
|
219
|
-
children:
|
|
221
|
+
children: `${snapshot.hasShare ? "s share \xB7 " : ""}Tab next \xB7 1-9 app \xB7 \u2191\u2193 scroll (shift page) \xB7 G follow${snapshot.following ? "" : " (paused)"} \xB7 / grep${snapshot.grep ? ` (${snapshot.grep})` : ""} \xB7 e errors${snapshot.errorsOnly ? " on" : ""} \xB7 c clear \xB7 y copy \xB7 Y path \xB7 o open \xB7 r restart \xB7 q quit`
|
|
220
222
|
}, undefined, false, undefined, this)
|
|
221
223
|
]
|
|
222
224
|
}, undefined, true, undefined, this);
|
|
223
225
|
};
|
|
224
226
|
|
|
227
|
+
// pkgs/@akanjs/cli/application/devLogBuffer.ts
|
|
228
|
+
var plainTextOf = (lines, { withApp = false } = {}) => {
|
|
229
|
+
const width = withApp ? lines.reduce((max, line) => Math.max(max, line.app.length), 0) : 0;
|
|
230
|
+
return lines.map((line) => `${withApp ? `${line.app.padEnd(width)} \u2502 ` : ""}${stripAnsi(line.text)}`).join(`
|
|
231
|
+
`);
|
|
232
|
+
};
|
|
233
|
+
var HOST_SOURCE = "host";
|
|
234
|
+
var childPrefix = /^\[child:(\d+) ([a-z-]+)\] \[(?:stdout|stderr)\] /;
|
|
235
|
+
var sourceOf = (text) => {
|
|
236
|
+
const match = childPrefix.exec(text);
|
|
237
|
+
return match ? `#${match[1]} ${match[2]}` : HOST_SOURCE;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
class DevLogBuffer {
|
|
241
|
+
static defaultLimit = 5000;
|
|
242
|
+
#limit;
|
|
243
|
+
#lines = [];
|
|
244
|
+
#partial = new Map;
|
|
245
|
+
#sources = new Map;
|
|
246
|
+
#seq = 0;
|
|
247
|
+
constructor({ limit = DevLogBuffer.defaultLimit } = {}) {
|
|
248
|
+
this.#limit = Math.max(1, limit);
|
|
249
|
+
}
|
|
250
|
+
get size() {
|
|
251
|
+
return this.#lines.length;
|
|
252
|
+
}
|
|
253
|
+
sourcesOf(app) {
|
|
254
|
+
return [...this.#sources.get(app) ?? []];
|
|
255
|
+
}
|
|
256
|
+
push(app, kind, chunk) {
|
|
257
|
+
const key = `${app}:${kind}`;
|
|
258
|
+
const parts = `${this.#partial.get(key) ?? ""}${chunk}`.split(`
|
|
259
|
+
`);
|
|
260
|
+
this.#partial.set(key, parts.pop() ?? "");
|
|
261
|
+
return this.#append(app, kind, parts);
|
|
262
|
+
}
|
|
263
|
+
flushPartials() {
|
|
264
|
+
const flushed = [];
|
|
265
|
+
for (const [key, remainder] of [...this.#partial]) {
|
|
266
|
+
this.#partial.set(key, "");
|
|
267
|
+
if (!remainder)
|
|
268
|
+
continue;
|
|
269
|
+
const split = key.lastIndexOf(":");
|
|
270
|
+
const app = key.slice(0, split);
|
|
271
|
+
const kind = key.slice(split + 1) === "stderr" ? "stderr" : "stdout";
|
|
272
|
+
flushed.push(...this.#append(app, kind, [remainder]));
|
|
273
|
+
}
|
|
274
|
+
return flushed;
|
|
275
|
+
}
|
|
276
|
+
select({ app = null, source = null, grep, errorsOnly = false } = {}) {
|
|
277
|
+
const needle = grep?.trim().toLowerCase();
|
|
278
|
+
return this.#lines.filter((line) => {
|
|
279
|
+
if (app !== null && line.app !== app)
|
|
280
|
+
return false;
|
|
281
|
+
if (source !== null && line.source !== source)
|
|
282
|
+
return false;
|
|
283
|
+
if (errorsOnly && line.kind !== "stderr")
|
|
284
|
+
return false;
|
|
285
|
+
if (needle && !stripAnsi(line.text).toLowerCase().includes(needle))
|
|
286
|
+
return false;
|
|
287
|
+
return true;
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
clear(app = null) {
|
|
291
|
+
const kept = app === null ? [] : this.#lines.filter((line) => line.app !== app);
|
|
292
|
+
this.#lines.length = 0;
|
|
293
|
+
this.#lines.push(...kept);
|
|
294
|
+
}
|
|
295
|
+
#append(app, kind, texts) {
|
|
296
|
+
const known = this.#sources.get(app) ?? new Set;
|
|
297
|
+
this.#sources.set(app, known);
|
|
298
|
+
const added = texts.map((text) => {
|
|
299
|
+
const source = sourceOf(text);
|
|
300
|
+
known.add(source);
|
|
301
|
+
return { seq: ++this.#seq, app, source, kind, text };
|
|
302
|
+
});
|
|
303
|
+
this.#lines.push(...added);
|
|
304
|
+
if (this.#lines.length > this.#limit)
|
|
305
|
+
this.#lines.splice(0, this.#lines.length - this.#limit);
|
|
306
|
+
return added;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
225
310
|
// pkgs/@akanjs/cli/application/devLogWindow.ts
|
|
226
311
|
var windowOf = (lines, rows, anchor) => {
|
|
227
312
|
const height = Math.max(1, Math.trunc(rows));
|
|
@@ -293,6 +378,7 @@ class DevTui {
|
|
|
293
378
|
clear: this.#clear,
|
|
294
379
|
copyLines: this.#copyLines,
|
|
295
380
|
copyPath: this.#copyPath,
|
|
381
|
+
copyShareUrl: this.#copyShareUrl,
|
|
296
382
|
openSelected: this.#openSelected,
|
|
297
383
|
restartSelected: this.#restartSelected,
|
|
298
384
|
quit: this.#quit
|
|
@@ -328,7 +414,7 @@ class DevTui {
|
|
|
328
414
|
process.stdout.write(`${line.app} \u2502 ${line.text}
|
|
329
415
|
`);
|
|
330
416
|
for (const status of this.#statuses)
|
|
331
|
-
process.stdout.write(`${status.name} ${status.url} \u2014 ${status.state}
|
|
417
|
+
process.stdout.write(`${status.name} ${status.url}${status.shareUrl ? ` \xB7 ${status.shareUrl}` : ""} \u2014 ${status.state}
|
|
332
418
|
`);
|
|
333
419
|
const log = this.#supervisor.sessionLog;
|
|
334
420
|
for (const name of log.appNames)
|
|
@@ -388,7 +474,7 @@ class DevTui {
|
|
|
388
474
|
this.#cachedSnapshot = {
|
|
389
475
|
rows,
|
|
390
476
|
selected: this.#indexOfTarget(rows),
|
|
391
|
-
title: status ? `${status.name}${this.#target.source ? ` \xB7 ${this.#target.source}` : ""} \xB7 ${status.url} \xB7 ${status.state}${status.detail ? ` (${status.detail})` : ""}` :
|
|
477
|
+
title: status ? `${status.name}${this.#target.source ? ` \xB7 ${this.#target.source}` : ""}${status.shareUrl ? ` \xB7 \u25C8 ${status.shareUrl}` : ""} \xB7 ${status.url} \xB7 ${status.state}${status.detail ? ` (${status.detail})` : ""}` : this.#mergedTitle(),
|
|
392
478
|
lines: view.lines,
|
|
393
479
|
above: view.above,
|
|
394
480
|
below: view.below,
|
|
@@ -399,6 +485,7 @@ class DevTui {
|
|
|
399
485
|
errorsOnly: this.#errorsOnly,
|
|
400
486
|
editingGrep: this.#editingGrep,
|
|
401
487
|
notice: this.#notice,
|
|
488
|
+
hasShare: this.#statuses.some((candidate) => !!candidate.shareUrl),
|
|
402
489
|
readyCount: this.#statuses.filter((candidate) => candidate.state === "ready").length,
|
|
403
490
|
appCount: this.#statuses.length,
|
|
404
491
|
logRows,
|
|
@@ -500,6 +587,25 @@ class DevTui {
|
|
|
500
587
|
const app = this.#target.app;
|
|
501
588
|
return (app ? [app] : log.appNames).map((name) => log.relativePathOf(name));
|
|
502
589
|
}
|
|
590
|
+
#copyShareUrl = () => {
|
|
591
|
+
const urls = this.#shareUrls();
|
|
592
|
+
if (urls.length === 0) {
|
|
593
|
+
this.#setNotice("no public share \u2014 start with --share");
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
writeClipboard(urls.join(`
|
|
597
|
+
`)).then((copied) => {
|
|
598
|
+
this.#setNotice(copied ? `copied ${urls.join(" \xB7 ")}` : urls.join(" \xB7 "));
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
#shareUrls() {
|
|
602
|
+
const app = this.#target.app;
|
|
603
|
+
return this.#statuses.filter((status) => app === null || status.name === app).map((status) => status.shareUrl).filter((url) => !!url);
|
|
604
|
+
}
|
|
605
|
+
#mergedTitle() {
|
|
606
|
+
const urls = this.#shareUrls();
|
|
607
|
+
return urls.length === 0 ? "all apps" : `all apps \xB7 \u25C8 ${urls.join(" \xB7 ")}`;
|
|
608
|
+
}
|
|
503
609
|
#setNotice(text) {
|
|
504
610
|
this.#notice = text;
|
|
505
611
|
if (this.#noticeTimer)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// pkgs/@akanjs/cli/application/devTuiView.ts
|
|
3
3
|
var createDevTuiView = async (supervisor) => {
|
|
4
|
-
const { DevTui } = await import("./devTui-
|
|
4
|
+
const { DevTui } = await import("./devTui-v19fbnpk.js");
|
|
5
5
|
return new DevTui(supervisor);
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
script,
|
|
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
|
-
|
|
11
|
-
} from "./index-
|
|
10
|
+
Prompter2
|
|
11
|
+
} from "./index-twq9p2sp.js";
|
|
12
12
|
|
|
13
13
|
// pkgs/@akanjs/cli/guideline/guideline.script.ts
|
|
14
14
|
import { Logger } from "akanjs/common";
|
|
@@ -16,7 +16,7 @@ import { Logger } from "akanjs/common";
|
|
|
16
16
|
class GuidelineScript extends script("guideline") {
|
|
17
17
|
async guideline(action, name = null, format = "markdown") {
|
|
18
18
|
if (action === "list") {
|
|
19
|
-
const guidelines = await
|
|
19
|
+
const guidelines = await Prompter2.listGuidelines();
|
|
20
20
|
Logger.rawLog(format === "json" ? JSON.stringify({ guidelines }, null, 2) : guidelines.join(`
|
|
21
21
|
`));
|
|
22
22
|
return;
|
|
@@ -24,7 +24,7 @@ class GuidelineScript extends script("guideline") {
|
|
|
24
24
|
if (action === "show") {
|
|
25
25
|
if (!name)
|
|
26
26
|
throw new Error("Guideline name is required. Example: akan guideline show framework");
|
|
27
|
-
const [instruction, guideJson] = await Promise.all([
|
|
27
|
+
const [instruction, guideJson] = await Promise.all([Prompter2.getInstruction(name), Prompter2.getGuideJson(name)]);
|
|
28
28
|
Logger.rawLog(format === "json" ? JSON.stringify({ name, instruction, guideJson }, null, 2) : instruction);
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
@@ -46,7 +46,7 @@ apps and libs never import it directly (`no-import-external-library`) — everyt
|
|
|
46
46
|
already titles, and `defaultDraft` opens the composer with text in it without sending it. A panel driven by a
|
|
47
47
|
controlled `open` with **no** `onOpenChange` draws no close button at all rather than an inert one. Then the
|
|
48
48
|
slots: `AgentLauncher`, `AgentSteps`, `AgentBubble`, `AgentComposer`, `AgentApproval`,
|
|
49
|
-
`AgentQuestion`, `AgentQueued`, `AgentMenu`, `AgentMarkdown` and `AgentCode` each replace one part in `_overrides.tsx`, and
|
|
49
|
+
`AgentQuestion`, `AgentToolCard`, `AgentQueued`, `AgentMenu`, `AgentMarkdown` and `AgentCode` each replace one part in `_overrides.tsx`, and
|
|
50
50
|
`akanjs/ui` exports every default beside them (`DefaultBubble`, `DefaultComposer`, …) so a skin composes the
|
|
51
51
|
one it is replacing. **`AgentSteps` is one agent turn** — the messages between the user message that opened it
|
|
52
52
|
and the next one, with `isRunning` saying whether more are still coming — which is the grain a chat needs to
|
|
@@ -216,6 +216,15 @@ apps and libs never import it directly (`no-import-external-library`) — everyt
|
|
|
216
216
|
is called from components the composer cannot see; writing the token is the composer's half, and `refer` warns
|
|
217
217
|
rather than staging silently when no chat is mounted on that session — the case where a card sits outside the
|
|
218
218
|
`<Agent.Zone>` its chat is inside.
|
|
219
|
+
- **The composer draws a pointer as the name it points at, never as the token.** Where `reference` sources are
|
|
220
|
+
declared the input is a Lexical editor rather than a textarea, and each pointer is one atomic node — a backspace
|
|
221
|
+
takes the whole thing rather than a character of a label that would then name nothing. Nothing above it changes:
|
|
222
|
+
the node's text content *is* the `@[…](mention:…)` token, so the draft string the chat reads, the `@` query, the
|
|
223
|
+
chips, the wire and the server's framing all see what they always saw, and every offset the chat hands over is
|
|
224
|
+
an offset into that string. It is its own chunk behind the chat's, fetched only where a source was declared, and
|
|
225
|
+
`mentions={false}` keeps the plain textarea — for an app that overrides `AgentComposer`, or one that would
|
|
226
|
+
rather see the tokens it is sending. An override that draws its own textarea keeps working: it fills the
|
|
227
|
+
`inputRef` it is handed, and the chat reads the caret off that when no editor filled `handleRef`.
|
|
219
228
|
- **`attach` and `voice` both carry functions, so a server layout cannot pass either.** A closure does not cross
|
|
220
229
|
the RSC boundary — `non-scalar-props-restricted` says so on `page/**` — so an app that wants either mounts the
|
|
221
230
|
chat from a small client component in the app's own `ui/` that calls the hook.
|
|
@@ -287,6 +296,14 @@ apps and libs never import it directly (`no-import-external-library`) — everyt
|
|
|
287
296
|
`data-akan-action` like a store setter does. A `remove*` name defaults to a confirm gate. Reach a store action
|
|
288
297
|
from the body — `.exec((id) => st.do.removeX(id))` — which is how an agent gets CRUD; `st.do` on its own
|
|
289
298
|
reaches nobody.
|
|
299
|
+
- **`.card()` is the other way the chain ends, for an answer that is the user's to give.** Where `.exec()` runs a
|
|
300
|
+
function, `.card(({ submit, cancel }, ...args) => <Form …/>)` parks the call in the chat and renders the app's own
|
|
301
|
+
component there; what `submit` is handed is what the model reads back, and `cancel` is the refusal it reads
|
|
302
|
+
instead. A name and a phone number, a date somebody has to look up, a signature — a model that fills those in
|
|
303
|
+
has answered its own question, and every other shape of "ask the user" is `askUser`. The declared arguments are
|
|
304
|
+
checked **before** the card is parked, so a bad one reaches the model as a refusal rather than throwing inside
|
|
305
|
+
the render; `confirm` is not read at all, because the card in front of the user is already the asking. The frame
|
|
306
|
+
draws its own way out even when the card does not, and the turn is never parked on something with no exit.
|
|
290
307
|
- **The second argument is how the call behaves, never what it is.** `{ settle, confirm, guard }`:
|
|
291
308
|
`settle: false` marks a read that returns what is already there and skips the wait; every other tool is waited
|
|
292
309
|
out before its effect on the screen is reported, because a write may still be landing when `exec` resolves. A
|
|
@@ -685,7 +702,10 @@ apps and libs never import it directly (`no-import-external-library`) — everyt
|
|
|
685
702
|
is among them. The loop parks on the question exactly as it parks on an approval, a dismissal is the tool's
|
|
686
703
|
error result rather than a silent empty answer, and the settled exchange renders as question-and-answer instead
|
|
687
704
|
of a tool row. **Never re-implement it per screen** — a `st.tool("askAboutX")` that opens a modal is the same
|
|
688
|
-
thing with a worse transcript — and a hook tool named `askUser` shadows it like any other built-in.
|
|
705
|
+
thing with a worse transcript — and a hook tool named `askUser` shadows it like any other built-in. The line
|
|
706
|
+
between it and a `.card()` tool is what the answer *is*: a sentence or a pick off a list is `askUser` and belongs
|
|
707
|
+
to the conversation, while a shape the model must not invent — fields, a form, a signature — is a card the screen
|
|
708
|
+
declares, because only the screen knows what filling it in looks like.
|
|
689
709
|
|
|
690
710
|
## What The Page Draws
|
|
691
711
|
- **The page shows the agent's work, not just the transcript.** A chat panel is closed as often as it is open, and
|
|
@@ -946,7 +946,9 @@ when two shapes disagree.
|
|
|
946
946
|
selected one's log beside it. `Tab` walks every row and `1`-`9` jump to that app (the rail shows each
|
|
947
947
|
app's digit), `↑↓` scroll (shift for a page, `G` back to following),
|
|
948
948
|
`/` greps, `e` shows stderr only, `c` clears, `y` copies, `Y` copies the log path, `o` opens the browser,
|
|
949
|
-
`r` restarts that app, `q` quits.
|
|
949
|
+
`r` restarts that app, `q` quits. Under `--share`, `s` copies the public URL — the selected app's, or every
|
|
950
|
+
app's from the merged row — and the header carries it ahead of the local one, because the line `--share`
|
|
951
|
+
printed before the view took the terminal is gone by its first repaint.
|
|
950
952
|
**`--plain` prints prefixed interleaved lines instead**, and a pipe, a redirect or an unsized terminal
|
|
951
953
|
downgrades to that on its own.
|
|
952
954
|
- **A supervised session writes `local/apps/<app>/runtime/dev.log`, and that path is how a log gets handed over.**
|
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
} from "./index-myj01w9r.js";
|
|
7
7
|
import {
|
|
8
8
|
runner
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-gca9y01h.js";
|
|
10
10
|
import {
|
|
11
11
|
WorkspaceExecutor,
|
|
12
12
|
AppExecutor
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-p1j0cyvd.js";
|
|
14
14
|
import {
|
|
15
15
|
openBrowser
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-chp5gqmm.js";
|
|
17
17
|
|
|
18
18
|
// pkgs/@akanjs/cli/cloud/cloud.runner.ts
|
|
19
19
|
import path from "path";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor,
|
|
4
4
|
LibExecutor
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-p1j0cyvd.js";
|
|
6
6
|
|
|
7
7
|
// pkgs/@akanjs/devkit/workflow/utils.ts
|
|
8
8
|
var jsonText = (value, { trailingNewline = true } = {}) => `${JSON.stringify(value, null, 2)}${trailingNewline ? `
|
|
@@ -21,49 +21,6 @@ var uniqueBy = (values, key) => {
|
|
|
21
21
|
};
|
|
22
22
|
var compactDiagnostics = (diagnostics) => diagnostics.filter((diagnostic) => !!diagnostic);
|
|
23
23
|
|
|
24
|
-
// pkgs/@akanjs/devkit/workflow/primitive.ts
|
|
25
|
-
var createPrimitiveWriteReport = ({
|
|
26
|
-
command,
|
|
27
|
-
status,
|
|
28
|
-
changedFiles = [],
|
|
29
|
-
generatedFiles = [],
|
|
30
|
-
validationCommands = [],
|
|
31
|
-
diagnostics = [],
|
|
32
|
-
nextActions = []
|
|
33
|
-
}) => ({
|
|
34
|
-
schemaVersion: 1,
|
|
35
|
-
command,
|
|
36
|
-
status: status ?? (diagnostics.some((diagnostic) => diagnostic.severity === "error") ? "failed" : "passed"),
|
|
37
|
-
changedFiles,
|
|
38
|
-
generatedFiles,
|
|
39
|
-
validationCommands,
|
|
40
|
-
diagnostics,
|
|
41
|
-
nextActions
|
|
42
|
-
});
|
|
43
|
-
var renderPrimitiveWriteReport = (report) => [
|
|
44
|
-
`# Primitive Write: ${report.command}`,
|
|
45
|
-
"",
|
|
46
|
-
`- Status: ${report.status}`,
|
|
47
|
-
"",
|
|
48
|
-
"## Changed Files",
|
|
49
|
-
...report.changedFiles.length ? report.changedFiles.map((file) => `- \`${file.action}\` ${file.path}: ${file.reason}`) : ["- none"],
|
|
50
|
-
"",
|
|
51
|
-
"## Generated Files",
|
|
52
|
-
...report.generatedFiles.length ? report.generatedFiles.map((file) => `- \`${file.action}\` ${file.path}: ${file.reason}`) : ["- none"],
|
|
53
|
-
"",
|
|
54
|
-
"## Validation Commands",
|
|
55
|
-
...report.validationCommands.length ? report.validationCommands.map((validation) => `- \`${validation.command}\`: ${validation.reason}`) : ["- none"],
|
|
56
|
-
"",
|
|
57
|
-
"## Diagnostics",
|
|
58
|
-
...report.diagnostics.length ? report.diagnostics.map((diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`) : ["- none"],
|
|
59
|
-
"",
|
|
60
|
-
"## Next Actions",
|
|
61
|
-
...report.nextActions.length ? report.nextActions.map((action) => `- \`${action.command}\`: ${action.reason}`) : ["- none"],
|
|
62
|
-
""
|
|
63
|
-
].join(`
|
|
64
|
-
`);
|
|
65
|
-
var renderPrimitiveReport = (report, format = "markdown") => format === "json" ? jsonText(report) : renderPrimitiveWriteReport(report);
|
|
66
|
-
|
|
67
24
|
// pkgs/@akanjs/devkit/workflow/artifacts.ts
|
|
68
25
|
var sourceChangeBlocked = (diagnostics) => diagnostics.some((diagnostic) => diagnostic.severity === "error" && (diagnostic.failureScope === "source-change" || !diagnostic.failureScope || diagnostic.failureScope === "unknown"));
|
|
69
26
|
var workflowPlanApproval = {
|
|
@@ -415,6 +372,49 @@ var createRepairReport = ({
|
|
|
415
372
|
generatedFiles,
|
|
416
373
|
...syncedAt ? { syncedAt } : {}
|
|
417
374
|
});
|
|
375
|
+
|
|
376
|
+
// pkgs/@akanjs/devkit/workflow/primitive.ts
|
|
377
|
+
var createPrimitiveWriteReport = ({
|
|
378
|
+
command,
|
|
379
|
+
status,
|
|
380
|
+
changedFiles = [],
|
|
381
|
+
generatedFiles = [],
|
|
382
|
+
validationCommands = [],
|
|
383
|
+
diagnostics = [],
|
|
384
|
+
nextActions = []
|
|
385
|
+
}) => ({
|
|
386
|
+
schemaVersion: 1,
|
|
387
|
+
command,
|
|
388
|
+
status: status ?? (diagnostics.some((diagnostic) => diagnostic.severity === "error") ? "failed" : "passed"),
|
|
389
|
+
changedFiles,
|
|
390
|
+
generatedFiles,
|
|
391
|
+
validationCommands,
|
|
392
|
+
diagnostics,
|
|
393
|
+
nextActions
|
|
394
|
+
});
|
|
395
|
+
var renderPrimitiveWriteReport = (report) => [
|
|
396
|
+
`# Primitive Write: ${report.command}`,
|
|
397
|
+
"",
|
|
398
|
+
`- Status: ${report.status}`,
|
|
399
|
+
"",
|
|
400
|
+
"## Changed Files",
|
|
401
|
+
...report.changedFiles.length ? report.changedFiles.map((file) => `- \`${file.action}\` ${file.path}: ${file.reason}`) : ["- none"],
|
|
402
|
+
"",
|
|
403
|
+
"## Generated Files",
|
|
404
|
+
...report.generatedFiles.length ? report.generatedFiles.map((file) => `- \`${file.action}\` ${file.path}: ${file.reason}`) : ["- none"],
|
|
405
|
+
"",
|
|
406
|
+
"## Validation Commands",
|
|
407
|
+
...report.validationCommands.length ? report.validationCommands.map((validation) => `- \`${validation.command}\`: ${validation.reason}`) : ["- none"],
|
|
408
|
+
"",
|
|
409
|
+
"## Diagnostics",
|
|
410
|
+
...report.diagnostics.length ? report.diagnostics.map((diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`) : ["- none"],
|
|
411
|
+
"",
|
|
412
|
+
"## Next Actions",
|
|
413
|
+
...report.nextActions.length ? report.nextActions.map((action) => `- \`${action.command}\`: ${action.reason}`) : ["- none"],
|
|
414
|
+
""
|
|
415
|
+
].join(`
|
|
416
|
+
`);
|
|
417
|
+
var renderPrimitiveReport = (report, format = "markdown") => format === "json" ? jsonText(report) : renderPrimitiveWriteReport(report);
|
|
418
418
|
// pkgs/@akanjs/devkit/workflow/executor.ts
|
|
419
419
|
import ts3 from "typescript";
|
|
420
420
|
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
isScannedRootEntry,
|
|
8
8
|
AppExecutor,
|
|
9
9
|
LibExecutor
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-p1j0cyvd.js";
|
|
11
11
|
import {
|
|
12
12
|
FileSys
|
|
13
13
|
} from "./index-q0y2jq9j.js";
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
workflowRunArtifactPath,
|
|
21
21
|
workflowSyncDir
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-1p146w4s.js";
|
|
23
23
|
|
|
24
24
|
// pkgs/@akanjs/devkit/akanContext.ts
|
|
25
25
|
import { readdir } from "fs/promises";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
runner,
|
|
4
4
|
script
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-gca9y01h.js";
|
|
6
6
|
import {
|
|
7
7
|
AGENT_BLOCK_START,
|
|
8
8
|
AGENT_BLOCK_END,
|
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
CLAUDE_COMMENT_RULE,
|
|
14
14
|
AppExecutor,
|
|
15
15
|
LibExecutor
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-p1j0cyvd.js";
|
|
17
17
|
import {
|
|
18
18
|
collectRecipeSources2,
|
|
19
19
|
scanRecipes2
|
|
20
20
|
} from "./index-by5gpp8x.js";
|
|
21
21
|
import {
|
|
22
22
|
AkanContextAnalyzer
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-3dmebxnk.js";
|
|
24
24
|
import {
|
|
25
|
-
|
|
26
|
-
} from "./index-
|
|
25
|
+
Prompter2
|
|
26
|
+
} from "./index-twq9p2sp.js";
|
|
27
27
|
|
|
28
28
|
// pkgs/@akanjs/cli/agent/agent.script.ts
|
|
29
29
|
import { Logger as Logger2 } from "akanjs/common";
|
|
@@ -106,10 +106,10 @@ ${scopeIndexPointer}
|
|
|
106
106
|
`;
|
|
107
107
|
};
|
|
108
108
|
var renderGuides = async (context) => {
|
|
109
|
-
const conventions = (await
|
|
109
|
+
const conventions = (await Prompter2.getInstruction("conventions")).trim();
|
|
110
110
|
if (context.pkgs.some((pkg) => pkg.name === "akanjs"))
|
|
111
111
|
return conventions;
|
|
112
|
-
const onboarding = (await
|
|
112
|
+
const onboarding = (await Prompter2.getInstruction("workspaceOnboarding")).trim();
|
|
113
113
|
const appName = context.apps[0]?.name ?? "app";
|
|
114
114
|
return `${conventions}
|
|
115
115
|
|
|
@@ -117,7 +117,7 @@ ${onboarding.replaceAll("<%= appName %>", appName)}`;
|
|
|
117
117
|
};
|
|
118
118
|
var renderManagedBlock = async (workspace) => {
|
|
119
119
|
const context = await AkanContextAnalyzer.analyze(workspace);
|
|
120
|
-
const frameworkGuide = await
|
|
120
|
+
const frameworkGuide = await Prompter2.getInstruction("framework");
|
|
121
121
|
const appNames = context.apps.map((app) => app.name);
|
|
122
122
|
const sampleCleanup = await renderSampleCleanup(workspace, appNames);
|
|
123
123
|
const recipeIndex = await renderRecipeIndex(workspace);
|
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
renderWorkflowApply,
|
|
21
21
|
renderWorkflowValidation,
|
|
22
22
|
renderWorkflowRunArtifact
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-1p146w4s.js";
|
|
24
24
|
import {
|
|
25
25
|
AkanContextAnalyzer
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-3dmebxnk.js";
|
|
27
27
|
import {
|
|
28
28
|
runner
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-gca9y01h.js";
|
|
30
30
|
|
|
31
31
|
// pkgs/@akanjs/cli/workflow/workflow.runner.ts
|
|
32
32
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// pkgs/@akanjs/devkit/codeAgent/agent/CodeAgentRpcHost.ts
|
|
3
|
+
class CodeAgentRpcHost2 {
|
|
4
|
+
#agent;
|
|
5
|
+
#write;
|
|
6
|
+
#buffer = "";
|
|
7
|
+
constructor(agent, write = (line) => process.stdout.write(line)) {
|
|
8
|
+
this.#agent = agent;
|
|
9
|
+
this.#write = write;
|
|
10
|
+
}
|
|
11
|
+
async serve(input = process.stdin) {
|
|
12
|
+
this.#agent.on((event) => this.#emit(event));
|
|
13
|
+
this.#agent.announce();
|
|
14
|
+
const decoder = new TextDecoder;
|
|
15
|
+
for await (const chunk of input)
|
|
16
|
+
await this.#push(decoder.decode(chunk, { stream: true }));
|
|
17
|
+
await this.#agent.abort().catch(() => {});
|
|
18
|
+
}
|
|
19
|
+
async#push(text) {
|
|
20
|
+
this.#buffer += text;
|
|
21
|
+
let index = this.#buffer.indexOf(`
|
|
22
|
+
`);
|
|
23
|
+
while (index >= 0) {
|
|
24
|
+
const line = this.#buffer.slice(0, index).trim();
|
|
25
|
+
this.#buffer = this.#buffer.slice(index + 1);
|
|
26
|
+
if (line)
|
|
27
|
+
await this.#handle(line);
|
|
28
|
+
index = this.#buffer.indexOf(`
|
|
29
|
+
`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async#handle(line) {
|
|
33
|
+
let request;
|
|
34
|
+
try {
|
|
35
|
+
request = JSON.parse(line);
|
|
36
|
+
} catch {
|
|
37
|
+
return this.#emit({ type: "error", message: "malformed command frame", fatal: false, seq: -1 });
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
this.#reply({ type: "reply", id: request.id, ok: true, data: await this.#run(request.command) });
|
|
41
|
+
} catch (error) {
|
|
42
|
+
this.#reply({ type: "reply", id: request.id, ok: false, error: String(error) });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async#run(command) {
|
|
46
|
+
switch (command.type) {
|
|
47
|
+
case "prompt":
|
|
48
|
+
this.#agent.prompt(command.message, command.images);
|
|
49
|
+
return { accepted: true };
|
|
50
|
+
case "answer":
|
|
51
|
+
return { handled: await this.#agent.answer(command.questionId, command.answer) };
|
|
52
|
+
case "approve":
|
|
53
|
+
return { handled: await this.#agent.approve(command.approvalId, command.approved) };
|
|
54
|
+
case "abort":
|
|
55
|
+
await this.#agent.abort();
|
|
56
|
+
return { aborted: true };
|
|
57
|
+
case "compact":
|
|
58
|
+
await this.#agent.compact(command.instructions);
|
|
59
|
+
return { compacted: true };
|
|
60
|
+
case "set_model":
|
|
61
|
+
await this.#agent.setModel({ provider: command.provider, id: command.modelId });
|
|
62
|
+
return await this.#agent.state();
|
|
63
|
+
case "get_state":
|
|
64
|
+
return await this.#agent.state(command.sinceSeq === undefined ? {} : { sinceSeq: command.sinceSeq });
|
|
65
|
+
case "shutdown":
|
|
66
|
+
this.#agent.dispose();
|
|
67
|
+
return { shutdown: true };
|
|
68
|
+
default:
|
|
69
|
+
throw new Error(`Unsupported command: ${command.type}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
#emit(event) {
|
|
73
|
+
this.#write(`${JSON.stringify({ type: "event", event })}
|
|
74
|
+
`);
|
|
75
|
+
}
|
|
76
|
+
#reply(reply) {
|
|
77
|
+
this.#write(`${JSON.stringify(reply)}
|
|
78
|
+
`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { CodeAgentRpcHost2 };
|
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
} from "./index-myj01w9r.js";
|
|
6
6
|
import {
|
|
7
7
|
script
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-gca9y01h.js";
|
|
9
9
|
import {
|
|
10
10
|
PkgExecutor
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-p1j0cyvd.js";
|
|
12
12
|
import {
|
|
13
13
|
ApplicationScript
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-chp5gqmm.js";
|
|
15
15
|
import {
|
|
16
16
|
PackageScript
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-va2je2qm.js";
|
|
18
18
|
import {
|
|
19
19
|
CloudRunner
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-0qvq9aeb.js";
|
|
21
21
|
|
|
22
22
|
// pkgs/@akanjs/cli/cloud/cloud.script.ts
|
|
23
23
|
import { Logger } from "akanjs/common";
|