@zhongqian97-code/ecode 0.5.41 → 0.5.43

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.
@@ -1203,6 +1203,19 @@ async function webFetch(params) {
1203
1203
  // src/logger.ts
1204
1204
  import * as fs4 from "fs";
1205
1205
  import * as path3 from "path";
1206
+ function createLoggerAtPath(filePath) {
1207
+ return {
1208
+ filePath,
1209
+ append(entry) {
1210
+ try {
1211
+ fs4.appendFileSync(filePath, JSON.stringify(entry) + "\n");
1212
+ } catch (err) {
1213
+ process.stderr.write(`[logger] Failed to write log entry: ${err}
1214
+ `);
1215
+ }
1216
+ }
1217
+ };
1218
+ }
1206
1219
  function createLogger(logDir, sessionStart) {
1207
1220
  fs4.mkdirSync(logDir, { recursive: true });
1208
1221
  const filename = sessionStart.toISOString().replace(/:/g, "-").replace(/\..+/, "") + ".jsonl";
@@ -2152,6 +2165,7 @@ export {
2152
2165
  grepFiles,
2153
2166
  WEB_FETCH_TOOL,
2154
2167
  webFetch,
2168
+ createLoggerAtPath,
2155
2169
  createLogger,
2156
2170
  DEFAULT_SYSTEM_PROMPT,
2157
2171
  classifyCommand,
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  applyPatch,
23
23
  classifyCommand,
24
24
  createLogger,
25
+ createLoggerAtPath,
25
26
  createProvider,
26
27
  editFile,
27
28
  executeBash,
@@ -34,7 +35,7 @@ import {
34
35
  todo,
35
36
  webFetch,
36
37
  writeFile
37
- } from "./chunk-7RQ4D4K6.js";
38
+ } from "./chunk-W3PXDSEG.js";
38
39
  import {
39
40
  createSessionMetadata,
40
41
  generateTitle,
@@ -335,7 +336,9 @@ var SessionRuntime = class {
335
336
  this.llm = opts.llm ?? createProvider(resolveActiveProfile(config2));
336
337
  this.model = config2.model;
337
338
  this.autoApproveNormal = opts.autoApproveNormal ?? false;
338
- if (config2.logDir) {
339
+ if (opts.logFilePath) {
340
+ this.logger = createLoggerAtPath(opts.logFilePath);
341
+ } else if (config2.logDir) {
339
342
  this.logger = createLogger(config2.logDir, /* @__PURE__ */ new Date());
340
343
  const meta = createSessionMetadata(this.logger.filePath, this.model, this.id);
341
344
  writeSessionMetadata(this.logger.filePath, meta);
@@ -372,10 +375,11 @@ var SessionRuntime = class {
372
375
  const signal = this.abortController.signal;
373
376
  try {
374
377
  await this.runAgenticLoop(signal);
375
- } catch {
378
+ } catch (err) {
376
379
  if (!signal.aborted) {
377
380
  this._status = "error";
378
- this.bus.emit({ type: "session.error", sessionId: this.id, error: "Unexpected error in agentic loop" });
381
+ const errorMsg = err instanceof Error ? err.message : String(err);
382
+ this.bus.emit({ type: "session.error", sessionId: this.id, error: errorMsg });
379
383
  }
380
384
  return;
381
385
  } finally {
@@ -429,7 +433,7 @@ var SessionRuntime = class {
429
433
  this.bus.emit({ type: "message.delta", messageId, text: chunk.text });
430
434
  assistantText += chunk.text;
431
435
  }
432
- if (chunk.reasoning) {
436
+ if (chunk.reasoning && !chunk.done) {
433
437
  this.bus.emit({ type: "message.reasoning", messageId, text: chunk.reasoning });
434
438
  }
435
439
  if (chunk.done) {
@@ -810,7 +814,7 @@ if (rawArgs[0] === "web") {
810
814
  webAutoApprove = true;
811
815
  }
812
816
  }
813
- const { buildServer, generateAccessToken } = await import("./web-YRH6C6ID.js");
817
+ const { buildServer, generateAccessToken } = await import("./web-ONRJYFTB.js");
814
818
  const token = finalConfig.webToken ?? generateAccessToken();
815
819
  const manager = new SessionManager(finalConfig);
816
820
  const __webDirname = dirname(fileURLToPath(import.meta.url));
@@ -919,6 +923,6 @@ Node.js 16/18 \u8BF7\u4F7F\u7528 --web \u6216 --pipe \u6A21\u5F0F\u3002
919
923
  );
920
924
  process.exit(1);
921
925
  }
922
- const { App, React, render } = await import("./ui-FGG6SNSS.js");
926
+ const { App, React, render } = await import("./ui-6FC4UF7A.js");
923
927
  render(React.createElement(App, { config: finalConfig, version: VERSION, autoMode, registry, trustedSkillDirs, initialMessages }));
924
928
  }
@@ -26,7 +26,7 @@ import {
26
26
  todo,
27
27
  webFetch,
28
28
  writeFile
29
- } from "./chunk-7RQ4D4K6.js";
29
+ } from "./chunk-W3PXDSEG.js";
30
30
  import {
31
31
  handleSkillInput,
32
32
  loadJobs,
@@ -1681,7 +1681,7 @@ async function chatRoutes(app, opts) {
1681
1681
  const logFilePath = join2(opts.config.logDir, session.logFile);
1682
1682
  const initialMessages = loadMessagesFromJsonl(logFilePath);
1683
1683
  try {
1684
- await manager.createSession({ sessionId: id, initialMessages });
1684
+ await manager.createSession({ sessionId: id, initialMessages, logFilePath });
1685
1685
  return reply.send({ success: true, resumed: true });
1686
1686
  } catch (err) {
1687
1687
  const msg = err instanceof Error ? err.message : String(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhongqian97-code/ecode",
3
- "version": "0.5.41",
3
+ "version": "0.5.43",
4
4
  "description": "A minimal Claude Code clone with REPL interface and bash tool calling",
5
5
  "type": "module",
6
6
  "author": "zhongqian97-code",