@vincemakes/kiso-code 0.1.18 → 0.1.20
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/dist/index.js +36 -7
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
19
19
|
import { createInterface } from "node:readline";
|
|
20
|
-
import { Body } from "
|
|
21
|
-
import { editFileDiff, writeFileDiff } from "
|
|
20
|
+
import { Body } from "@vincemakes/kiso-tui";
|
|
21
|
+
import { editFileDiff, writeFileDiff } from "@vincemakes/kiso-tui";
|
|
22
22
|
import { MODES, getMode, modeExtensions, modeFromEnv, modeSystemPrompt, setMode } from "./mode.js";
|
|
23
|
-
import { Editor, PROMPT as EDITOR_PROMPT } from "
|
|
23
|
+
import { Editor, PROMPT as EDITOR_PROMPT } from "@vincemakes/kiso-tui";
|
|
24
24
|
import { homedir, tmpdir } from "node:os";
|
|
25
25
|
import { dirname, join } from "node:path";
|
|
26
26
|
import { fileURLToPath } from "node:url";
|
|
27
27
|
import { createAgent, disposeExtensions, loadExtensions, loadProjectExtensions, projectArtifacts, recordTrust, SessionStore, trustFor, } from "@vincemakes/kiso-runtime";
|
|
28
28
|
import { createFauxProvider } from "@vincemakes/kiso-evals";
|
|
29
|
-
import { createCodingTools } from "@vincemakes/kiso-tools-node";
|
|
30
|
-
import { escapeTerminal, foldResult, foldThinking, palette, renderEvent, renderSessionLine, renderStatusLine, renderTerminalGap, renderToolSummary, bannerLines, kUnit, renderRecap, truncateRow, } from "
|
|
31
|
-
import { Dock } from "
|
|
29
|
+
import { canonicalTargetPath, createCodingTools } from "@vincemakes/kiso-tools-node";
|
|
30
|
+
import { escapeTerminal, foldResult, foldThinking, palette, renderEvent, renderSessionLine, renderStatusLine, renderTerminalGap, renderToolSummary, bannerLines, kUnit, renderRecap, truncateRow, } from "@vincemakes/kiso-tui";
|
|
31
|
+
import { Dock } from "@vincemakes/kiso-tui";
|
|
32
32
|
/** 发现#11: KISO_HOME is the ONE root — every default path derives from
|
|
33
33
|
* it (sessions, trust, extensions, mcp config, skills). The dedicated
|
|
34
34
|
* env vars (KISO_EXTENSIONS_DIR / KISO_MCP_CONFIG / KISO_SKILLS_DIR)
|
|
@@ -833,7 +833,7 @@ async function consumeRun(session, run, input, turnNo, faux, liveInput, statusCb
|
|
|
833
833
|
default: {
|
|
834
834
|
// Events without a cell (stop, …) — the generic render, byte-
|
|
835
835
|
// preserved for the pipe path.
|
|
836
|
-
const rendered = renderEvent(ev);
|
|
836
|
+
const rendered = renderEvent(ev, false, canonicalTargetPath);
|
|
837
837
|
if (rendered.text !== "") {
|
|
838
838
|
body.raw(rendered.text.replace(/\n$/, "").split("\n"));
|
|
839
839
|
}
|
|
@@ -1027,6 +1027,7 @@ async function chat(session, faux, input) {
|
|
|
1027
1027
|
bodyLog(cmd("/last", "show the most recent tool call's input and output"));
|
|
1028
1028
|
bodyLog(cmd("/status", "show session id, event count, and context estimate"));
|
|
1029
1029
|
bodyLog(cmd("/mode", "show the approval tier; /mode <name> switches (manual/default/accept-edits/plan/bypass)"));
|
|
1030
|
+
bodyLog(cmd("/compact", "summarize the older conversation to free context"));
|
|
1030
1031
|
bodyLog(cmd("exit", "leave the session"));
|
|
1031
1032
|
input.prompt();
|
|
1032
1033
|
});
|
|
@@ -1103,6 +1104,34 @@ async function chat(session, faux, input) {
|
|
|
1103
1104
|
});
|
|
1104
1105
|
return;
|
|
1105
1106
|
}
|
|
1107
|
+
if (trimmed === "/compact") {
|
|
1108
|
+
// /compact (ADR-0044): the older conversation becomes one
|
|
1109
|
+
// model summary — an OFF-LOOP call through the session's own
|
|
1110
|
+
// adapter, so it must never race a running turn: refused
|
|
1111
|
+
// mid-run, with a hint to wait for the turn to end.
|
|
1112
|
+
if (currentRun !== null) {
|
|
1113
|
+
body.notice("[/compact] a turn is running — wait for it to finish");
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
chain = chain.then(async () => {
|
|
1117
|
+
try {
|
|
1118
|
+
const result = await session.summarize();
|
|
1119
|
+
if (result === null) {
|
|
1120
|
+
body.notice("[/compact] nothing to compact — fewer than 5 rounds yet");
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1123
|
+
body.notice(`[/compact] saved ~${result.savedTokens.toLocaleString("en-US")} tokens`);
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
catch (err) {
|
|
1127
|
+
// Honest failure: nothing was persisted, the session
|
|
1128
|
+
// is unchanged (ADR-0044 crash semantics).
|
|
1129
|
+
body.notice(`[/compact] failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1130
|
+
}
|
|
1131
|
+
input.prompt();
|
|
1132
|
+
});
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1106
1135
|
if (trimmed === "exit" || trimmed === "") {
|
|
1107
1136
|
input.close();
|
|
1108
1137
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-code",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "kiso CLI — the coding-agent reference product: kiso chat / kiso resume / kiso sessions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
"test": "vitest run"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@vincemakes/kiso-core": "0.1.
|
|
22
|
-
"@vincemakes/kiso-evals": "0.1.
|
|
23
|
-
"@vincemakes/kiso-provider-anthropic": "0.1.
|
|
24
|
-
"@vincemakes/kiso-provider-openai": "0.1.
|
|
25
|
-
"@vincemakes/kiso-runtime": "0.1.
|
|
26
|
-
"@vincemakes/kiso-tools-node": "0.1.
|
|
21
|
+
"@vincemakes/kiso-core": "0.1.20",
|
|
22
|
+
"@vincemakes/kiso-evals": "0.1.20",
|
|
23
|
+
"@vincemakes/kiso-provider-anthropic": "0.1.20",
|
|
24
|
+
"@vincemakes/kiso-provider-openai": "0.1.20",
|
|
25
|
+
"@vincemakes/kiso-runtime": "0.1.20",
|
|
26
|
+
"@vincemakes/kiso-tools-node": "0.1.20",
|
|
27
|
+
"@vincemakes/kiso-tui": "0.1.20"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/node": "^26.1.2",
|