@codelia/cli 0.1.29 → 0.1.30

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.cjs CHANGED
@@ -846,7 +846,7 @@ var import_node_path2 = __toESM(require("path"), 1);
846
846
  var import_storage3 = require("@codelia/storage");
847
847
 
848
848
  // src/version.ts
849
- var CLI_VERSION = "0.1.29".trim().length > 0 ? "0.1.29" : "0.0.0";
849
+ var CLI_VERSION = "0.1.30".trim().length > 0 ? "0.1.30" : "0.0.0";
850
850
 
851
851
  // src/tui/launcher.ts
852
852
  var resolveTuiBinaryName = (platform) => platform === "win32" ? "codelia-tui.exe" : "codelia-tui";
@@ -1088,9 +1088,72 @@ var parseShellLikeArgs = (value) => {
1088
1088
  };
1089
1089
  var toLine = (value) => `${JSON.stringify(value)}
1090
1090
  `;
1091
+ var envTruthy = (value) => {
1092
+ if (!value) return false;
1093
+ const normalized = value.trim().toLowerCase();
1094
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
1095
+ };
1096
+ var toSingleLine = (value, maxChars = 240) => {
1097
+ const normalized = value.replace(/\s+/g, " ").trim();
1098
+ if (normalized.length <= maxChars) return normalized;
1099
+ return `${normalized.slice(0, maxChars)}...`;
1100
+ };
1101
+ var summarizeProgressEvent = (event) => {
1102
+ const type = typeof event.type === "string" ? event.type : "";
1103
+ switch (type) {
1104
+ case "text": {
1105
+ const content = typeof event.content === "string" ? toSingleLine(event.content) : "";
1106
+ return content ? `[text] ${content}` : "[text]";
1107
+ }
1108
+ case "reasoning": {
1109
+ const content = typeof event.content === "string" ? toSingleLine(event.content) : "";
1110
+ return content ? `[reasoning] ${content}` : "[reasoning]";
1111
+ }
1112
+ case "step_start": {
1113
+ const title = typeof event.title === "string" ? toSingleLine(event.title) : "";
1114
+ const stepNumber = typeof event.step_number === "number" ? `#${String(event.step_number)} ` : "";
1115
+ return `[step_start] ${stepNumber}${title || "unnamed step"}`;
1116
+ }
1117
+ case "step_complete": {
1118
+ const status = typeof event.status === "string" ? event.status : "unknown";
1119
+ const duration = typeof event.duration_ms === "number" ? ` ${String(event.duration_ms)}ms` : "";
1120
+ return `[step_complete] ${status}${duration}`;
1121
+ }
1122
+ case "tool_call": {
1123
+ const tool = typeof event.tool === "string" ? event.tool : "unknown";
1124
+ return `[tool_call] ${tool}`;
1125
+ }
1126
+ case "tool_result": {
1127
+ const tool = typeof event.tool === "string" ? event.tool : "unknown";
1128
+ const isError = event.is_error === true ? "error" : "ok";
1129
+ return `[tool_result] ${tool} (${isError})`;
1130
+ }
1131
+ case "permission.preview": {
1132
+ const tool = typeof event.tool === "string" ? event.tool : "unknown";
1133
+ return `[permission.preview] ${tool}`;
1134
+ }
1135
+ case "permission.ready": {
1136
+ const tool = typeof event.tool === "string" ? event.tool : "unknown";
1137
+ return `[permission.ready] ${tool}`;
1138
+ }
1139
+ case "compaction_start":
1140
+ return "[compaction_start]";
1141
+ case "compaction_complete": {
1142
+ const compacted = typeof event.compacted === "boolean" ? ` compacted=${String(event.compacted)}` : "";
1143
+ return `[compaction_complete]${compacted}`;
1144
+ }
1145
+ case "hidden_user_message":
1146
+ return "[hidden_user_message]";
1147
+ default:
1148
+ return type ? `[${type}]` : null;
1149
+ }
1150
+ };
1091
1151
  var isRpcResponse = (value) => typeof value === "object" && value !== null && "jsonrpc" in value && "id" in value && !value.method;
1092
1152
  var isRpcNotification = (value) => typeof value === "object" && value !== null && "jsonrpc" in value && "method" in value && !value.id;
1093
1153
  var runPromptMode = async (options) => {
1154
+ const emitProgressToStderr = envTruthy(
1155
+ process.env.CODELIA_PROMPT_PROGRESS_STDERR
1156
+ );
1094
1157
  const runtimeEnv = resolveRuntimeEnvForTui(process.env);
1095
1158
  const runtimeCmd = runtimeEnv.CODELIA_RUNTIME_CMD ?? process.execPath;
1096
1159
  const runtimeArgsValue = runtimeEnv.CODELIA_RUNTIME_ARGS ?? "packages/runtime/src/index.ts";
@@ -1161,6 +1224,14 @@ var runPromptMode = async (options) => {
1161
1224
  if (params.event?.type === "final" && typeof params.event.content === "string") {
1162
1225
  finalText = params.event.content;
1163
1226
  }
1227
+ const event = params.event;
1228
+ if (emitProgressToStderr && event && event.type !== "final") {
1229
+ const summary = summarizeProgressEvent(event);
1230
+ if (summary) {
1231
+ process.stderr.write(`${summary}
1232
+ `);
1233
+ }
1234
+ }
1164
1235
  }
1165
1236
  };
1166
1237
  child.on("error", (error) => {
package/dist/index.js CHANGED
@@ -830,7 +830,7 @@ import path2 from "path";
830
830
  import { ensureStorageDirs, resolveStoragePaths as resolveStoragePaths2 } from "@codelia/storage";
831
831
 
832
832
  // src/version.ts
833
- var CLI_VERSION = "0.1.29".trim().length > 0 ? "0.1.29" : "0.0.0";
833
+ var CLI_VERSION = "0.1.30".trim().length > 0 ? "0.1.30" : "0.0.0";
834
834
 
835
835
  // src/tui/launcher.ts
836
836
  var resolveTuiBinaryName = (platform) => platform === "win32" ? "codelia-tui.exe" : "codelia-tui";
@@ -1072,9 +1072,72 @@ var parseShellLikeArgs = (value) => {
1072
1072
  };
1073
1073
  var toLine = (value) => `${JSON.stringify(value)}
1074
1074
  `;
1075
+ var envTruthy = (value) => {
1076
+ if (!value) return false;
1077
+ const normalized = value.trim().toLowerCase();
1078
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
1079
+ };
1080
+ var toSingleLine = (value, maxChars = 240) => {
1081
+ const normalized = value.replace(/\s+/g, " ").trim();
1082
+ if (normalized.length <= maxChars) return normalized;
1083
+ return `${normalized.slice(0, maxChars)}...`;
1084
+ };
1085
+ var summarizeProgressEvent = (event) => {
1086
+ const type = typeof event.type === "string" ? event.type : "";
1087
+ switch (type) {
1088
+ case "text": {
1089
+ const content = typeof event.content === "string" ? toSingleLine(event.content) : "";
1090
+ return content ? `[text] ${content}` : "[text]";
1091
+ }
1092
+ case "reasoning": {
1093
+ const content = typeof event.content === "string" ? toSingleLine(event.content) : "";
1094
+ return content ? `[reasoning] ${content}` : "[reasoning]";
1095
+ }
1096
+ case "step_start": {
1097
+ const title = typeof event.title === "string" ? toSingleLine(event.title) : "";
1098
+ const stepNumber = typeof event.step_number === "number" ? `#${String(event.step_number)} ` : "";
1099
+ return `[step_start] ${stepNumber}${title || "unnamed step"}`;
1100
+ }
1101
+ case "step_complete": {
1102
+ const status = typeof event.status === "string" ? event.status : "unknown";
1103
+ const duration = typeof event.duration_ms === "number" ? ` ${String(event.duration_ms)}ms` : "";
1104
+ return `[step_complete] ${status}${duration}`;
1105
+ }
1106
+ case "tool_call": {
1107
+ const tool = typeof event.tool === "string" ? event.tool : "unknown";
1108
+ return `[tool_call] ${tool}`;
1109
+ }
1110
+ case "tool_result": {
1111
+ const tool = typeof event.tool === "string" ? event.tool : "unknown";
1112
+ const isError = event.is_error === true ? "error" : "ok";
1113
+ return `[tool_result] ${tool} (${isError})`;
1114
+ }
1115
+ case "permission.preview": {
1116
+ const tool = typeof event.tool === "string" ? event.tool : "unknown";
1117
+ return `[permission.preview] ${tool}`;
1118
+ }
1119
+ case "permission.ready": {
1120
+ const tool = typeof event.tool === "string" ? event.tool : "unknown";
1121
+ return `[permission.ready] ${tool}`;
1122
+ }
1123
+ case "compaction_start":
1124
+ return "[compaction_start]";
1125
+ case "compaction_complete": {
1126
+ const compacted = typeof event.compacted === "boolean" ? ` compacted=${String(event.compacted)}` : "";
1127
+ return `[compaction_complete]${compacted}`;
1128
+ }
1129
+ case "hidden_user_message":
1130
+ return "[hidden_user_message]";
1131
+ default:
1132
+ return type ? `[${type}]` : null;
1133
+ }
1134
+ };
1075
1135
  var isRpcResponse = (value) => typeof value === "object" && value !== null && "jsonrpc" in value && "id" in value && !value.method;
1076
1136
  var isRpcNotification = (value) => typeof value === "object" && value !== null && "jsonrpc" in value && "method" in value && !value.id;
1077
1137
  var runPromptMode = async (options) => {
1138
+ const emitProgressToStderr = envTruthy(
1139
+ process.env.CODELIA_PROMPT_PROGRESS_STDERR
1140
+ );
1078
1141
  const runtimeEnv = resolveRuntimeEnvForTui(process.env);
1079
1142
  const runtimeCmd = runtimeEnv.CODELIA_RUNTIME_CMD ?? process.execPath;
1080
1143
  const runtimeArgsValue = runtimeEnv.CODELIA_RUNTIME_ARGS ?? "packages/runtime/src/index.ts";
@@ -1145,6 +1208,14 @@ var runPromptMode = async (options) => {
1145
1208
  if (params.event?.type === "final" && typeof params.event.content === "string") {
1146
1209
  finalText = params.event.content;
1147
1210
  }
1211
+ const event = params.event;
1212
+ if (emitProgressToStderr && event && event.type !== "final") {
1213
+ const summary = summarizeProgressEvent(event);
1214
+ if (summary) {
1215
+ process.stderr.write(`${summary}
1216
+ `);
1217
+ }
1218
+ }
1148
1219
  }
1149
1220
  };
1150
1221
  child.on("error", (error) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/cli",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20 <25"
@@ -19,19 +19,19 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@codelia/config-loader": "0.1.29",
23
- "@codelia/protocol": "0.1.29",
24
- "@codelia/runtime": "0.1.29",
25
- "@codelia/storage": "0.1.29",
22
+ "@codelia/config-loader": "0.1.30",
23
+ "@codelia/protocol": "0.1.30",
24
+ "@codelia/runtime": "0.1.30",
25
+ "@codelia/storage": "0.1.30",
26
26
  "cac": "^6.7.14",
27
27
  "zod": "^4.3.6"
28
28
  },
29
29
  "optionalDependencies": {
30
- "@codelia/tui-darwin-arm64": "0.1.29",
31
- "@codelia/tui-darwin-x64": "0.1.29",
32
- "@codelia/tui-linux-arm64": "0.1.29",
33
- "@codelia/tui-linux-x64": "0.1.29",
34
- "@codelia/tui-win32-x64": "0.1.29"
30
+ "@codelia/tui-darwin-arm64": "0.1.30",
31
+ "@codelia/tui-darwin-x64": "0.1.30",
32
+ "@codelia/tui-linux-arm64": "0.1.30",
33
+ "@codelia/tui-linux-x64": "0.1.30",
34
+ "@codelia/tui-win32-x64": "0.1.30"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "tsup --config tsup.config.ts",