@ia-ccun/code-agent-cli 0.0.51-beta.1 → 0.0.51

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/bin/cli.js CHANGED
@@ -193,7 +193,8 @@ async function checkForUpdates() {
193
193
  }
194
194
  checkForUpdates();
195
195
 
196
- const piAgentPathUrl = new URL('../node_modules/@earendil-works/pi-coding-agent/dist/cli.js', import.meta.url);
196
+ // 获取 node_modules 中 pi-coding-agent 的 CLI 路径
197
+ const piAgentPathUrl = new URL('../node_modules/@mariozechner/pi-coding-agent/dist/cli.js', import.meta.url);
197
198
  const piAgentPath = fileURLToPath(piAgentPathUrl); // 解码中文路径
198
199
 
199
200
  // 获取本地版本号
@@ -6,7 +6,7 @@
6
6
  * 技巧列表包含快捷键、命令使用及联系方式提示
7
7
  */
8
8
 
9
- import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
9
+ import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
10
10
 
11
11
  const AICODE_TIPS = [
12
12
  "@ 快速搜索项目文件",
@@ -104,6 +104,7 @@ const AICODE_TIPS = [
104
104
  "可在 /settings 中调整消息发送模式和行为偏好",
105
105
  // 记忆功能使用技巧
106
106
  "💡 记忆功能自动记录会话中的关键经验,下次会话自动应用",
107
+ "💡 使用 /memory 查看当前记忆库中的条目",
107
108
  "💡 在对话中说'记住这个'可手动保存经验到记忆库",
108
109
  "💡 记忆功能支持选择性注入 (selective),只注入相关记忆避免干扰",
109
110
  "💡 说'忘记 XXX'可删除特定记忆条目",
@@ -10,7 +10,7 @@
10
10
  * 危险模式配置: config/agent/dangerous-patterns.json
11
11
  */
12
12
 
13
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
13
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
14
14
  import { readFileSync, existsSync } from "fs";
15
15
  import { join } from "path";
16
16
  import { homedir } from "os";
@@ -14,7 +14,7 @@
14
14
  * - 100% : 阻止继续并强制提示压缩
15
15
  */
16
16
 
17
- import type { ExtensionAPI, ExtensionContext, ToolResultEvent } from "@earendil-works/pi-coding-agent";
17
+ import type { ExtensionAPI, ExtensionContext, ToolResultEvent } from "@mariozechner/pi-coding-agent";
18
18
 
19
19
  interface ContextThresholds {
20
20
  info: number; // 70%
@@ -9,9 +9,9 @@
9
9
  * - current context window usage + session totals (tokens/cost)
10
10
  */
11
11
 
12
- import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext, ToolResultEvent } from "@earendil-works/pi-coding-agent";
13
- import { DynamicBorder } from "@earendil-works/pi-coding-agent";
14
- import { Container, Key, Text, matchesKey, type Component, type TUI } from "@earendil-works/pi-tui";
12
+ import type { ExtensionAPI, ExtensionCommandContext, ExtensionContext, ToolResultEvent } from "@mariozechner/pi-coding-agent";
13
+ import { DynamicBorder } from "@mariozechner/pi-coding-agent";
14
+ import { Container, Key, Text, matchesKey, type Component, type TUI } from "@mariozechner/pi-tui";
15
15
  import os from "node:os";
16
16
  import path from "node:path";
17
17
  import fs from "node:fs/promises";
@@ -6,9 +6,9 @@
6
6
  * [gold] [dim] [dim] [color ctx] [accent]
7
7
  */
8
8
 
9
- import type { AssistantMessage } from "@earendil-works/pi-ai";
10
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
11
- import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
9
+ import type { AssistantMessage } from "@mariozechner/pi-ai";
10
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
11
+ import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
12
12
 
13
13
  function fmtTokens(n: number): string {
14
14
  if (n < 1000) return n.toString();
@@ -8,9 +8,9 @@
8
8
  * 可以拦截内置工具、注册自定义工具和命令
9
9
  */
10
10
 
11
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
12
- import type { AssistantMessage } from "@earendil-works/pi-ai";
13
- import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
11
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
12
+ import type { AssistantMessage } from "@mariozechner/pi-ai";
13
+ import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
14
14
 
15
15
  export default function (pi: ExtensionAPI) {
16
16
  // === 记录开始时间 ===
@@ -23,32 +23,25 @@ export default function (pi: ExtensionAPI) {
23
23
  // === 消息完成通知(只在最后一条显示)===
24
24
 
25
25
  pi.on("agent_end", async (event, ctx) => {
26
- try {
27
- // 检查 ctx 是否仍然有效
28
- ctx.runtime.assertActive();
29
-
30
- // 计算耗时
31
- const elapsed = Date.now() - agentStartTime;
32
- let timeStr: string;
33
- if (elapsed < 1000) {
34
- timeStr = `${elapsed}ms`;
35
- } else if (elapsed < 60000) {
36
- timeStr = `${(elapsed / 1000).toFixed(1)}s`;
37
- } else {
38
- const mins = Math.floor(elapsed / 60000);
39
- const secs = Math.floor((elapsed % 60000) / 1000);
40
- timeStr = `${mins}m ${secs}s`;
41
- }
26
+ // 计算耗时
27
+ const elapsed = Date.now() - agentStartTime;
28
+ let timeStr: string;
29
+ if (elapsed < 1000) {
30
+ timeStr = `${elapsed}ms`;
31
+ } else if (elapsed < 60000) {
32
+ timeStr = `${(elapsed / 1000).toFixed(1)}s`;
33
+ } else {
34
+ const mins = Math.floor(elapsed / 60000);
35
+ const secs = Math.floor((elapsed % 60000) / 1000);
36
+ timeStr = `${mins}m ${secs}s`;
37
+ }
42
38
 
43
- // 格式化完整时间
44
- const now = new Date();
45
- const timeStr2 = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`;
39
+ // 格式化完整时间
40
+ const now = new Date();
41
+ const timeStr2 = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`;
46
42
 
47
- // agent_end 表示一轮对话结束,显示完成提示
48
- ctx.ui.notify(`${timeStr2} | ✨ 消息处理完成 (${timeStr})`, "info");
49
- } catch (e) {
50
- // ctx 已过期,忽略通知
51
- }
43
+ // agent_end 表示一轮对话结束,显示完成提示
44
+ ctx.ui.notify(`${timeStr2} | ✨ 消息处理完成 (${timeStr})`, "info");
52
45
  });
53
46
 
54
47
  // === 拦截工具调用 ===
@@ -6,7 +6,7 @@
6
6
  * Logs errors to ~/.aicode-cli/logs/aicode-error-YYYY-MM-DD.log
7
7
  */
8
8
 
9
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
9
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
10
10
  import fs from "fs";
11
11
  import os from "os";
12
12
  import path from "path";
@@ -15,7 +15,7 @@
15
15
 
16
16
  import { appendFileSync, existsSync, mkdirSync } from "node:fs";
17
17
  import { join } from "node:path";
18
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
18
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
19
19
 
20
20
  // 北京时间格式化函数 (UTC+8)
21
21
  function formatBeijingTime(date: Date = new Date()): string {
@@ -125,21 +125,6 @@ ${JSON.stringify({ ...payload, messages: filteredMessages }, null, 2)}
125
125
  const timestamp = formatBeijingTime();
126
126
  const { response, usage, cached } = event;
127
127
 
128
- // Check if response is defined
129
- if (!response) {
130
- const logEntry = `
131
- ================================================================================
132
- [${timestamp}] AFTER PROVIDER RESPONSE
133
- ================================================================================
134
- Cached: ${cached ? "YES" : "NO"}
135
- Error: Response is undefined
136
-
137
- ================================================================================
138
- `;
139
- appendFileSync(logFile, logEntry, "utf8");
140
- return;
141
- }
142
-
143
128
  const logEntry = `
144
129
  ================================================================================
145
130
  [${timestamp}] AFTER PROVIDER RESPONSE
@@ -27,9 +27,9 @@
27
27
  * Note: PR review requires a clean working tree (no uncommitted changes to tracked files).
28
28
  */
29
29
 
30
- import type { ExtensionAPI, ExtensionContext, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
31
- import { DynamicBorder, BorderedLoader } from "@earendil-works/pi-coding-agent";
32
- import { Container, type SelectItem, SelectList, Text } from "@earendil-works/pi-tui";
30
+ import type { ExtensionAPI, ExtensionContext, ExtensionCommandContext } from "@mariozechner/pi-coding-agent";
31
+ import { DynamicBorder, BorderedLoader } from "@mariozechner/pi-coding-agent";
32
+ import { Container, type SelectItem, SelectList, Text } from "@mariozechner/pi-tui";
33
33
  import path from "node:path";
34
34
  import { promises as fs } from "node:fs";
35
35
 
@@ -5,8 +5,8 @@
5
5
  * 自定义工作消息,格式类似 Claude Code: ✶ xxx… (时间 · tokens)
6
6
  */
7
7
 
8
- import type { ExtensionAPI, TurnEndEvent } from "@earendil-works/pi-coding-agent";
9
- import type { AssistantMessage } from "@earendil-works/pi-ai";
8
+ import type { ExtensionAPI, TurnEndEvent } from "@mariozechner/pi-coding-agent";
9
+ import type { AssistantMessage } from "@mariozechner/pi-ai";
10
10
 
11
11
  // 主题色 #49bccf
12
12
  const accentColor = "\x1b[38;2;73;188;207m";
package/dist/index.d.ts CHANGED
@@ -2,8 +2,9 @@
2
2
  * aicode-cli
3
3
  * AI Coding Agent CLI
4
4
  *
5
+ * 基于 @mariozechner/pi-coding-agent 的封装
5
6
  */
6
- export * from '@earendil-works/pi-coding-agent';
7
+ export * from '@mariozechner/pi-coding-agent';
7
8
  export { defaultConfig, type AppConfig } from './config.js';
8
9
  export { getConfig, getConfigDir, loadConfig } from './config-loader.js';
9
10
  export { defaultBanner, generateBanner } from './banner.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iCAAiC,CAAC;AAGhD,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,+BAA+B,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -2,8 +2,10 @@
2
2
  * aicode-cli
3
3
  * AI Coding Agent CLI
4
4
  *
5
+ * 基于 @mariozechner/pi-coding-agent 的封装
5
6
  */
6
- export * from '@earendil-works/pi-coding-agent';
7
+ // 重新导出 pi-coding-agent 的核心功能
8
+ export * from '@mariozechner/pi-coding-agent';
7
9
  // 导出配置相关
8
10
  export { defaultConfig } from './config.js';
9
11
  export { getConfig, getConfigDir, loadConfig } from './config-loader.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,iCAAiC,CAAC;AAEhD,SAAS;AACT,OAAO,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEzE,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6BAA6B;AAC7B,cAAc,+BAA+B,CAAC;AAE9C,SAAS;AACT,OAAO,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEzE,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ia-ccun/code-agent-cli",
3
- "version": "0.0.51-beta.1",
3
+ "version": "0.0.51",
4
4
  "description": "AI Coding Agent CLI - 基于OpenClaw🦞底层Agent(pi)原理封装的编码智能体(供学习使用)。",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,10 +35,10 @@
35
35
  "prepare": "husky"
36
36
  },
37
37
  "dependencies": {
38
- "@earendil-works/pi-agent-core": "^0.74.0",
39
- "@earendil-works/pi-ai": "^0.74.0",
40
- "@earendil-works/pi-coding-agent": "^0.74.0",
41
- "@earendil-works/pi-tui": "^0.74.0"
38
+ "@mariozechner/pi-agent-core": "0.62.0",
39
+ "@mariozechner/pi-ai": "0.62.0",
40
+ "@mariozechner/pi-coding-agent": "0.62.0",
41
+ "@mariozechner/pi-tui": "0.62.0"
42
42
  },
43
43
  "overrides": {
44
44
  "glob": "^11.0.0",
@@ -50,7 +50,6 @@
50
50
  "@typescript-eslint/parser": "^8.57.0",
51
51
  "eslint": "^10.0.3",
52
52
  "husky": "^9.1.7",
53
- "playwright": "^1.60.0",
54
53
  "shx": "^0.4.0",
55
54
  "typescript": "^5.7.2",
56
55
  "typescript-eslint": "^8.57.0"
@@ -21,7 +21,7 @@ const piDir = join(homeDir, '.pi');
21
21
  // ============================================================================
22
22
  // Fix pi-coding-agent APP_NAME
23
23
  // ============================================================================
24
- const piAgentPackageJson = join(__dirname, '..', 'node_modules', '@earendil-works', 'pi-coding-agent', 'package.json');
24
+ const piAgentPackageJson = join(__dirname, '..', 'node_modules', '@mariozechner', 'pi-coding-agent', 'package.json');
25
25
  if (existsSync(piAgentPackageJson)) {
26
26
  try {
27
27
  const piPkg = JSON.parse(readFileSync(piAgentPackageJson, 'utf-8'));
@@ -39,7 +39,7 @@ if (existsSync(piAgentPackageJson)) {
39
39
  }
40
40
 
41
41
  // Fix pi-coding-agent cli.js process.title
42
- const piAgentCliJs = join(__dirname, '..', 'node_modules', '@earendil-works', 'pi-coding-agent', 'dist', 'cli.js');
42
+ const piAgentCliJs = join(__dirname, '..', 'node_modules', '@mariozechner', 'pi-coding-agent', 'dist', 'cli.js');
43
43
  if (existsSync(piAgentCliJs)) {
44
44
  try {
45
45
  let cliContent = readFileSync(piAgentCliJs, 'utf-8');
@@ -54,7 +54,7 @@ if (existsSync(piAgentCliJs)) {
54
54
  }
55
55
 
56
56
  // Fix pi-coding-agent config.js APP_NAME default
57
- const piAgentConfigJs = join(__dirname, '..', 'node_modules', '@earendil-works', 'pi-coding-agent', 'dist', 'config.js');
57
+ const piAgentConfigJs = join(__dirname, '..', 'node_modules', '@mariozechner', 'pi-coding-agent', 'dist', 'config.js');
58
58
  if (existsSync(piAgentConfigJs)) {
59
59
  try {
60
60
  let configContent = readFileSync(piAgentConfigJs, 'utf-8');
@@ -69,7 +69,7 @@ if (existsSync(piAgentConfigJs)) {
69
69
  }
70
70
 
71
71
  // Fix pi-coding-agent slash commands - change "Quit pi" to "Quit aicode-cli"
72
- const slashCommandsJs = join(__dirname, '..', 'node_modules', '@earendil-works', 'pi-coding-agent', 'dist', 'core', 'slash-commands.js');
72
+ const slashCommandsJs = join(__dirname, '..', 'node_modules', '@mariozechner', 'pi-coding-agent', 'dist', 'core', 'slash-commands.js');
73
73
  if (existsSync(slashCommandsJs)) {
74
74
  try {
75
75
  let content = readFileSync(slashCommandsJs, 'utf-8');