@vincemakes/kiso-code 0.45.3 → 0.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,86 @@
1
+ /**
2
+ * ADR-0058 (3c): the row a task delivery shows in the transcript — live and
3
+ * on resume. The model reads the notice's own lines; a person reads this.
4
+ *
5
+ * 3e: and what the person sees of the tasks themselves — the `/tasks` rows,
6
+ * a task's output on request, and the counts on the status row. All of it
7
+ * is drawn on the screen only: no `user_input`, nothing in the session log,
8
+ * nothing the model sees (the model has its notices and `read_file`).
9
+ */
10
+ import { closeSync, fstatSync, openSync, readFileSync, readSync } from "node:fs";
11
+ import { dirname, join } from "node:path";
12
+ import { elapsedLabel } from "@vincemakes/kiso-tui-cells";
13
+ export function taskNoticeRow(items) {
14
+ return `✦ task ${items.map((i) => `${i.taskId} ${i.transition}`).join(" · ")}`;
15
+ }
16
+ /** A task's state in the person's words. A stop that was asked for and is
17
+ * not yet confirmed reads `stopping` — never `stopped` before the journal
18
+ * says so; an outcome nobody can know reads `◌ outcome unknown`. */
19
+ export function taskStateLabel(task) {
20
+ const s = task.state;
21
+ switch (s.kind) {
22
+ case "starting":
23
+ return "starting";
24
+ case "not_run":
25
+ return "never ran";
26
+ case "running":
27
+ return task.stoppedBy !== undefined ? "stopping" : s.ready ? "ready" : "running";
28
+ case "unknown":
29
+ return "◌ outcome unknown";
30
+ case "ended":
31
+ if (s.stopped)
32
+ return "stopped";
33
+ if (s.error !== undefined)
34
+ return "failed to start";
35
+ return s.exitCode !== null ? (s.exitCode === 0 ? "exited 0" : `failed ${s.exitCode}`) : `ended ${s.signal ?? ""}`.trim();
36
+ }
37
+ }
38
+ /** What the task is: the command, or the child's role and task. */
39
+ export function taskWhat(task) {
40
+ return task.agent !== undefined ? task.command : task.command.split("\n")[0];
41
+ }
42
+ /** One `/tasks` row: `t3 running 1m 20s`, with the command beside it. */
43
+ export function taskRow(task, now = Date.now()) {
44
+ const seconds = ((task.endedAt ?? now) - task.startedAt) / 1000;
45
+ return { label: `${task.id} ${taskStateLabel(task)} ${elapsedLabel(seconds)}`, note: taskWhat(task) };
46
+ }
47
+ /** A task's last `lines` lines of output — or, for a child, its answer. */
48
+ export function taskOutput(task, lines = 20) {
49
+ if (task.agent !== undefined) {
50
+ try {
51
+ return readFileSync(join(dirname(task.outputPath), "result.md"), "utf8").trimEnd().split("\n").slice(-lines);
52
+ }
53
+ catch {
54
+ // no answer written (yet): what it printed instead
55
+ }
56
+ }
57
+ try {
58
+ const fd = openSync(task.outputPath, "r");
59
+ try {
60
+ const size = fstatSync(fd).size;
61
+ const n = Math.min(size, 64 * 1024);
62
+ const buf = Buffer.alloc(n);
63
+ readSync(fd, buf, 0, n, size - n);
64
+ return buf.toString("utf8").trimEnd().split("\n").slice(-lines);
65
+ }
66
+ finally {
67
+ closeSync(fd);
68
+ }
69
+ }
70
+ catch {
71
+ return [];
72
+ }
73
+ }
74
+ /** The status row's counts: live tasks, and the unknown ones the person
75
+ * has not looked at in `/tasks` in this process. */
76
+ export function taskCounts(tasks, seen) {
77
+ let running = 0;
78
+ let unknown = 0;
79
+ for (const t of tasks) {
80
+ if (t.state.kind === "running" || t.state.kind === "starting")
81
+ running += 1;
82
+ else if (t.state.kind === "unknown" && !seen.has(t.id))
83
+ unknown += 1;
84
+ }
85
+ return { running, unknown };
86
+ }
package/dist/trust-ui.js CHANGED
@@ -15,7 +15,7 @@ import { bodyLog, currentAgentExtensions, dock, extensionsDir, kisoHome, mergedT
15
15
  import { guardSavedAllow } from "./protected-writes.js";
16
16
  import { mergeDirPrefix } from "./temp-sweep.js";
17
17
  import { loadUserConfig, resolveProjectTrustPolicy } from "./config.js";
18
- import { getMode } from "./mode.js";
18
+ import { getDontAsk } from "./mode.js";
19
19
  /**
20
20
  * W21 — ask the human with the approval panel: the bounded block that
21
21
  * replaces the running tool's live window while the approval is pending.
@@ -150,7 +150,7 @@ export function askUi(input) {
150
150
  // Launch-weekend plan §2: dontAsk asks nobody anything — a
151
151
  // question the model puts is declined, recorded as unanswered,
152
152
  // exactly as a non-interactive session declines it.
153
- if (getMode() === "dontAsk") {
153
+ if (getDontAsk()) {
154
154
  bodyLog("[dontAsk] the model's question was declined — nothing asks in dontAsk");
155
155
  return askDeclineAll(spec);
156
156
  }
@@ -284,7 +284,7 @@ export function fixHintFor(speaker, tool) {
284
284
  }
285
285
  if (speaker === "mode:manual" || speaker === "mode:plan")
286
286
  return "/mode default";
287
- if (speaker === "mode:accept-edits" || speaker === "mode:bypass")
287
+ if (speaker === "mode:accept-edits" || speaker === "mode:full-access")
288
288
  return undefined;
289
289
  return `edit ${join(extensionsDir(), `${speaker}.mjs`).replace(homedir(), "~")}`;
290
290
  }
@@ -322,8 +322,8 @@ export async function resolveProjectTrust(input) {
322
322
  // The lead's review of #63, B5: dontAsk takes this same path — nothing
323
323
  // asks, so the project is not loaded, the note says so, and no refusal
324
324
  // is recorded (a later asking session can still decide).
325
- if (!process.stdin.isTTY || getMode() === "dontAsk") {
326
- console.error(`${getMode() === "dontAsk" ? "[dontAsk] " : ""}${projectUntrustedNote(artifacts.files.length, artifacts.root)}`);
325
+ if (!process.stdin.isTTY || getDontAsk()) {
326
+ console.error(`${getDontAsk() ? "[dontAsk] " : ""}${projectUntrustedNote(artifacts.files.length, artifacts.root)}`);
327
327
  return null;
328
328
  }
329
329
  // v2c: the shared input (the editor on a TTY) reads the answer.
@@ -476,7 +476,7 @@ export async function resolveUncertains(session, input, isCancelled) {
476
476
  // uncertain executions are left exactly as a cancel leaves them —
477
477
  // uncertain and durable, no rerun or abandon fabricated — and the one
478
478
  // line says what to do. An unattended session must not sit on a panel.
479
- if (getMode() === "dontAsk") {
479
+ if (getDontAsk()) {
480
480
  const n = session.uncertainExecutions().length;
481
481
  if (n > 0)
482
482
  bodyLog(`[dontAsk] ${n} uncertain execution${n === 1 ? "" : "s"} left unresolved — resolve them in an asking mode`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-code",
3
- "version": "0.45.3",
3
+ "version": "0.46.1",
4
4
  "description": "kiso-code \u2014 the coding agent on kiso, the durable runtime for AI agents: kiso chat / kiso resume / kiso sessions.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -18,19 +18,19 @@
18
18
  "test": "vitest run"
19
19
  },
20
20
  "dependencies": {
21
- "@vincemakes/kiso-ask-ext": "0.45.3",
22
- "@vincemakes/kiso-core": "0.45.3",
23
- "@vincemakes/kiso-evals": "0.45.3",
24
- "@vincemakes/kiso-mcp-ext": "0.45.3",
25
- "@vincemakes/kiso-provider-anthropic": "0.45.3",
26
- "@vincemakes/kiso-provider-openai": "0.45.3",
27
- "@vincemakes/kiso-provider-openai-responses": "0.45.3",
28
- "@vincemakes/kiso-runtime": "0.45.3",
29
- "@vincemakes/kiso-skills-ext": "0.45.3",
30
- "@vincemakes/kiso-subagent-ext": "0.45.3",
31
- "@vincemakes/kiso-tools-node": "0.45.3",
32
- "@vincemakes/kiso-tui": "0.45.3",
33
- "@vincemakes/kiso-tui-cells": "0.45.3"
21
+ "@vincemakes/kiso-ask-ext": "0.46.1",
22
+ "@vincemakes/kiso-core": "0.46.1",
23
+ "@vincemakes/kiso-evals": "0.46.1",
24
+ "@vincemakes/kiso-mcp-ext": "0.46.1",
25
+ "@vincemakes/kiso-provider-anthropic": "0.46.1",
26
+ "@vincemakes/kiso-provider-openai": "0.46.1",
27
+ "@vincemakes/kiso-provider-openai-responses": "0.46.1",
28
+ "@vincemakes/kiso-runtime": "0.46.1",
29
+ "@vincemakes/kiso-skills-ext": "0.46.1",
30
+ "@vincemakes/kiso-subagent-ext": "0.46.1",
31
+ "@vincemakes/kiso-tools-node": "0.46.1",
32
+ "@vincemakes/kiso-tui": "0.46.1",
33
+ "@vincemakes/kiso-tui-cells": "0.46.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^26.1.2",