superagent-ai-agent 0.1.0 → 0.1.1

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/.env.example CHANGED
@@ -3,8 +3,8 @@
3
3
  # ═══════════════════════════════════════════════════
4
4
 
5
5
  # API gateway URL (required)
6
- # Supports: Anthropic official, AWS Bedrock, Alibaba Cloud, Zhipu AI, etc.
7
- # Anthropic 兼容网关地址(必填)
6
+ # Supports: Anthropic official, AWS Bedrock, OpenAI-compatible endpoints, etc.
7
+ # API 网关地址(必填)
8
8
  ANTHROPIC_BASE_URL=https://api.anthropic.com
9
9
 
10
10
  # API auth token (required)
@@ -24,4 +24,4 @@ ANTHROPIC_AUTH_TOKEN=
24
24
  # ANTHROPIC_MODEL_FALLBACK=
25
25
 
26
26
  # Optional: set to 0 to disable Plan-Execute pipeline (emergency escape hatch)
27
- # LUNA_PLAN=0
27
+ # SUPERAGENT_PLAN=0
package/README.md CHANGED
@@ -62,13 +62,13 @@ npm start
62
62
 
63
63
  | Variable | Required | Description |
64
64
  |----------|----------|-------------|
65
- | `ANTHROPIC_BASE_URL` | Yes | API gateway URL (supports Anthropic, AWS Bedrock, Alibaba Cloud, Zhipu AI, etc.) |
65
+ | `ANTHROPIC_BASE_URL` | Yes | API gateway URL (supports Anthropic, AWS Bedrock, OpenAI-compatible endpoints, etc.) |
66
66
  | `ANTHROPIC_AUTH_TOKEN` | Yes | API authentication token |
67
67
  | `PORT` | No | Server port (default: 3000) |
68
68
  | `ANTHROPIC_MODEL` | No | Text model name (default: claude-sonnet-4-6) |
69
69
  | `ANTHROPIC_MODEL_VISION` | No | Vision model name (default: same as text model) |
70
70
  | `ANTHROPIC_MODEL_FALLBACK` | No | Fallback model for content moderation |
71
- | `LUNA_PLAN` | No | Set to `0` to disable Plan-Execute pipeline |
71
+ | `SUPERAGENT_PLAN` | No | Set to `0` to disable Plan-Execute pipeline |
72
72
 
73
73
  ### Agent Config (`agent-config.json`)
74
74
 
package/README.zh-CN.md CHANGED
@@ -62,13 +62,13 @@ npm start
62
62
 
63
63
  | 变量名 | 必填 | 说明 |
64
64
  |--------|------|------|
65
- | `ANTHROPIC_BASE_URL` | 是 | API 网关地址(支持 Anthropic 官方、AWS Bedrock、阿里云百炼、智谱 AI 等) |
65
+ | `ANTHROPIC_BASE_URL` | 是 | API 网关地址(支持 Anthropic 官方、AWS Bedrock、OpenAI 兼容接口等) |
66
66
  | `ANTHROPIC_AUTH_TOKEN` | 是 | API 认证令牌 |
67
67
  | `PORT` | 否 | 服务端口(默认 3000) |
68
68
  | `ANTHROPIC_MODEL` | 否 | 文本模型名称(默认 claude-sonnet-4-6) |
69
69
  | `ANTHROPIC_MODEL_VISION` | 否 | 多模态模型名称(默认与文本模型相同) |
70
70
  | `ANTHROPIC_MODEL_FALLBACK` | 否 | 内容审查触发时的备用模型 |
71
- | `LUNA_PLAN` | 否 | 设为 `0` 关闭 Plan-Execute 管线 |
71
+ | `SUPERAGENT_PLAN` | 否 | 设为 `0` 关闭 Plan-Execute 管线 |
72
72
 
73
73
  ### Agent 配置(`agent-config.json`)
74
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superagent-ai-agent",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A local AI Agent powered by Claude SDK with Plan-Execute-Reflect architecture. Zero-build, browser-ready.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/agent.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * 3. Reflector — 失败反思(诊断 + 修复 + 验证,仅一次机会)
10
10
  *
11
11
  * 快捷路径:
12
- * - LUNA_PLAN=0 → 关闭 plan,退化为单次 query
12
+ * - SUPERAGENT_PLAN=0 → 关闭 plan,退化为单次 query
13
13
  * - 简单请求(短 prompt + 匹配 SIMPLE_RE)→ 跳过 Planner 直接执行
14
14
  */
15
15
 
package/src/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * src/config.js — Luna Agent 配置中心
2
+ * src/config.js — SuperAgent 配置中心
3
3
  *
4
4
  * 所有可调参数、工具列表、角色提示词模板集中在这里。
5
5
  * 修改模型名称、增减工具、调整 prompt 只需改这一个文件。
@@ -12,13 +12,13 @@ import path from 'node:path';
12
12
  // ═══════════════════════════════════════════════
13
13
 
14
14
  /** 纯文本对话使用的主模型 */
15
- export const MODEL_TEXT = process.env.ANTHROPIC_MODEL ?? 'glm-5.2';
15
+ export const MODEL_TEXT = process.env.ANTHROPIC_MODEL ?? 'claude-sonnet-4-20250514';
16
16
 
17
17
  /** 多模态(带图片)请求使用的模型 */
18
18
  export const MODEL_VISION = process.env.ANTHROPIC_MODEL_VISION ?? MODEL_TEXT;
19
19
 
20
- /** 主模型命中内容审查时自动切换的兜底模型 */
21
- export const MODEL_FALLBACK = process.env.ANTHROPIC_MODEL_FALLBACK ?? 'qwen3.7-plus';
20
+ /** 主模型命中内容审查时自动切换的兆底模型 */
21
+ export const MODEL_FALLBACK = process.env.ANTHROPIC_MODEL_FALLBACK ?? 'claude-sonnet-4-20250514';
22
22
 
23
23
  // ═══════════════════════════════════════════════
24
24
  // 工具列表
@@ -40,10 +40,10 @@ export const PLANNER_TOOLS = [
40
40
  // 开关 & 正则
41
41
  // ═══════════════════════════════════════════════
42
42
 
43
- /** Plan-Execute 总开关:LUNA_PLAN=0 退化为原单次 query 行为(应急逃生口) */
44
- export const PLAN_ENABLED = process.env.LUNA_PLAN !== '0';
43
+ /** Plan-Execute 总开关:SUPERAGENT_PLAN=0 退化为原单次 query 行为(应急逃生口) */
44
+ export const PLAN_ENABLED = process.env.SUPERAGENT_PLAN !== '0' && process.env.LUNA_PLAN !== '0';
45
45
 
46
- /** 命中内容安全审查的特征正则(智谱网关会把上游 data_inspection_failed 包成 InvalidParameter) */
46
+ /** 命中内容安全审查的特征正则 */
47
47
  export const INSPECTION_RE = /data_inspection_failed|Input text data may contain inappropriate content/i;
48
48
 
49
49
  /** 简单请求判定:命中则跳过 Planner 直接执行,减少延迟 */
@@ -57,7 +57,7 @@ export const SIMPLE_RE = /^(你好|hi|hello|hey|谢谢|thanks|帮我|能不能|
57
57
  export const PERSONA_PATH = path.resolve(process.cwd(), 'agent-persona.md');
58
58
 
59
59
  /** 项目级 skills 目录 */
60
- export const PROJECT_SKILLS_DIR = path.resolve(process.cwd(), '.claude', 'skills');
60
+ export const PROJECT_SKILLS_DIR = path.resolve(process.cwd(), 'skills');
61
61
 
62
62
  // ═══════════════════════════════════════════════
63
63
  // 角色提示词模板(append 到主 persona 之后)
@@ -8,7 +8,7 @@
8
8
  <style>
9
9
  :root {
10
10
  color-scheme: light dark;
11
- /* Luna 主题:薰衣草紫 + 月光粉 */
11
+ /* SuperAgent 主题:薋衣草紫 + 月光粉 */
12
12
  --primary: #9b87d4;
13
13
  --primary-hover: #7d68b8;
14
14
  --primary-soft: #f3eefe;
@@ -879,14 +879,14 @@
879
879
  const { startTime } = await r.json();
880
880
  unreachableCount = 0;
881
881
  if (startTime !== initialStartTime) {
882
- console.log('[Luna] server 重启,1 秒后刷新页面');
882
+ console.log('[SuperAgent] server 重启,1 秒后刷新页面');
883
883
  setTimeout(() => location.reload(), 1000);
884
884
  }
885
885
  } catch {
886
886
  unreachableCount++;
887
887
  // 连续 4 次(~12s)连不上才提示,避免短暂网络抖动
888
888
  if (unreachableCount === 4) {
889
- console.warn('[Luna] server 短暂不可达,等待恢复...');
889
+ console.warn('[SuperAgent] server 短暂不可达,等待恢复...');
890
890
  }
891
891
  }
892
892
  }, 3000);
@@ -1161,7 +1161,7 @@
1161
1161
  // ---------- Thinking indicator ----------
1162
1162
  let thinkingNode = null;
1163
1163
 
1164
- function showThinking(label = 'Luna 正在思考…') {
1164
+ function showThinking(label = 'Agent 正在思考…') {
1165
1165
  if (thinkingNode) return;
1166
1166
  const msg = el('div', 'msg assistant');
1167
1167
  msg.appendChild(buildAvatar('assistant'));
@@ -1845,7 +1845,7 @@
1845
1845
  })();
1846
1846
 
1847
1847
  // ---------- 重启后自动自测 ----------
1848
- // Luna 改完代码重启前会写 .self-test-pending.json;页面加载时拉取,
1848
+ // Agent 改完代码重启前会写 .self-test-pending.json;页面加载时拉取,
1849
1849
  // 有 pending 就自动发一条测试消息,验证 web 工具是否真能被调用,完成后上报清除
1850
1850
  let selfTestActive = false;
1851
1851
  let selfTestToolSeen = false;
@@ -1856,7 +1856,7 @@
1856
1856
  if (!task || !task.pending || !task.prompt) return;
1857
1857
  // 等 init 跑完再发,避免和 history restore 抢 bubble
1858
1858
  await new Promise((res) => setTimeout(res, 300));
1859
- console.log('[Luna] 检测到待自测任务,自动发送:', task.prompt);
1859
+ console.log('[SuperAgent] 检测到待自测任务,自动发送:', task.prompt);
1860
1860
  selfTestActive = true;
1861
1861
  selfTestToolSeen = false;
1862
1862
  appendUser(task.prompt, [], true);
@@ -1879,7 +1879,7 @@
1879
1879
  // 不在旧 session 上定时重试,避免空转烧 token
1880
1880
  }
1881
1881
  } catch (e) {
1882
- console.warn('[Luna] 自测流程异常:', e);
1882
+ console.warn('[SuperAgent] 自测流程异常:', e);
1883
1883
  }
1884
1884
  }
1885
1885
  // 启动时触发一次
package/src/server.js CHANGED
@@ -52,7 +52,7 @@ app.get('/api/version', (_req, res) => {
52
52
  });
53
53
 
54
54
  // ---------- 重启后自动自测 ----------
55
- // Luna 改完代码重启前会写 .self-test-pending.json,server 启动时读到就暴露给前端,
55
+ // Agent 改完代码重启前会写 .self-test-pending.json,server 启动时读到就暴露给前端,
56
56
  // 前端 init 时拉取,有 pending 就自动发一条测试消息验证工具是否工作,完成后上报清除
57
57
  const SELF_TEST_FILE = path.resolve(process.cwd(), '.self-test-pending.json');
58
58
  app.get('/api/self-test', async (_req, res) => {
@@ -76,7 +76,7 @@ app.post('/api/self-test/done', async (_req, res) => {
76
76
  }
77
77
  });
78
78
 
79
- // 头像图片路由:如果项目根有 luna-avatar.png 之类的图片就 serve 出去
79
+ // 头像图片路由:如果项目根有 avatar.png 之类的图片就 serve 出去
80
80
  app.get('/avatar', async (_req, res) => {
81
81
  try {
82
82
  const fs = await import('node:fs/promises');