@vincemakes/kiso-code 0.1.19 → 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.
Files changed (2) hide show
  1. package/dist/index.js +29 -0
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -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.19",
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,13 +18,13 @@
18
18
  "test": "vitest run"
19
19
  },
20
20
  "dependencies": {
21
- "@vincemakes/kiso-core": "0.1.19",
22
- "@vincemakes/kiso-evals": "0.1.19",
23
- "@vincemakes/kiso-provider-anthropic": "0.1.19",
24
- "@vincemakes/kiso-provider-openai": "0.1.19",
25
- "@vincemakes/kiso-runtime": "0.1.19",
26
- "@vincemakes/kiso-tools-node": "0.1.19",
27
- "@vincemakes/kiso-tui": "0.1.19"
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"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^26.1.2",