irises 1.0.0
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/LICENSE +674 -0
- package/bin/iris +97 -0
- package/data/agents.example/my-agent/configs/computer_use.yaml +138 -0
- package/data/agents.example/my-agent/configs/llm.yaml +71 -0
- package/data/agents.example/my-agent/configs/mcp.yaml +20 -0
- package/data/agents.example/my-agent/configs/memory.yaml +7 -0
- package/data/agents.example/my-agent/configs/modes.yaml +18 -0
- package/data/agents.example/my-agent/configs/ocr.yaml +9 -0
- package/data/agents.example/my-agent/configs/platform.yaml +49 -0
- package/data/agents.example/my-agent/configs/storage.yaml +10 -0
- package/data/agents.example/my-agent/configs/sub_agents.yaml +53 -0
- package/data/agents.example/my-agent/configs/system.yaml +25 -0
- package/data/agents.example/my-agent/configs/tools.yaml +231 -0
- package/data/agents.yaml.example +28 -0
- package/data/configs.example/computer_use.yaml +196 -0
- package/data/configs.example/llm.yaml +99 -0
- package/data/configs.example/mcp.yaml +20 -0
- package/data/configs.example/memory.yaml +7 -0
- package/data/configs.example/modes.yaml +18 -0
- package/data/configs.example/ocr.yaml +9 -0
- package/data/configs.example/platform.yaml +71 -0
- package/data/configs.example/plugins.yaml +47 -0
- package/data/configs.example/storage.yaml +10 -0
- package/data/configs.example/sub_agents.yaml +53 -0
- package/data/configs.example/summary.yaml +21 -0
- package/data/configs.example/system.yaml +57 -0
- package/data/configs.example/tools.yaml +237 -0
- package/package.json +19 -0
- package/postinstall.mjs +107 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# =========================================================
|
|
2
|
+
# 插件配置
|
|
3
|
+
#
|
|
4
|
+
# 配置要加载的 Iris 插件。
|
|
5
|
+
# 插件可以扩展工具、模式、钩子,也可以在 preBootstrap 阶段注册
|
|
6
|
+
# 自定义 LLM / Storage / Memory / OCR Provider 与自定义平台。
|
|
7
|
+
#
|
|
8
|
+
# 插件来源:
|
|
9
|
+
# - local(默认):从 ~/.iris/plugins/<name>/ 目录加载
|
|
10
|
+
# - npm:从 npm 包 iris-plugin-<name> 加载
|
|
11
|
+
#
|
|
12
|
+
# priority:
|
|
13
|
+
# - 数值越大越先执行
|
|
14
|
+
# - 影响 preBootstrap、activate、hook 链执行顺序
|
|
15
|
+
#
|
|
16
|
+
# config:
|
|
17
|
+
# - 会与插件目录中的 config.yaml 做浅合并
|
|
18
|
+
# - 同名字段以这里的值为准
|
|
19
|
+
#
|
|
20
|
+
# inline 插件:
|
|
21
|
+
# - 只支持在运行时通过 bootstrap({ inlinePlugins }) 注入
|
|
22
|
+
# - 不能在 plugins.yaml 中直接声明
|
|
23
|
+
#
|
|
24
|
+
# 插件目录结构:
|
|
25
|
+
# ~/.iris/plugins/
|
|
26
|
+
# my-plugin/
|
|
27
|
+
# index.ts # 入口文件(必须 export default 一个 IrisPlugin)
|
|
28
|
+
# config.yaml # 插件默认配置(可选)
|
|
29
|
+
# ============================================================
|
|
30
|
+
|
|
31
|
+
# plugins:
|
|
32
|
+
# # 本地插件示例
|
|
33
|
+
# - name: my-tool
|
|
34
|
+
# enabled: true
|
|
35
|
+
# priority: 100
|
|
36
|
+
# config:
|
|
37
|
+
# apiKey: "sk-xxx"
|
|
38
|
+
#
|
|
39
|
+
# # npm 包插件示例
|
|
40
|
+
# - name: rag
|
|
41
|
+
# type: npm
|
|
42
|
+
# enabled: true
|
|
43
|
+
# priority: 50
|
|
44
|
+
#
|
|
45
|
+
# # 禁用某个插件
|
|
46
|
+
# - name: some-plugin
|
|
47
|
+
# enabled: false
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# 子代理配置
|
|
2
|
+
# 定义主 LLM 可委派的子代理类型。
|
|
3
|
+
# 删除或注释掉某个类型即可禁用它,清空所有类型则完全禁用子代理功能。
|
|
4
|
+
|
|
5
|
+
# 字段说明:
|
|
6
|
+
# description - 面向主 LLM 的用途说明(展示在 sub_agent 工具描述中)
|
|
7
|
+
# systemPrompt - 子代理的系统提示词
|
|
8
|
+
# allowedTools - 工具白名单(与 excludedTools 互斥,优先)
|
|
9
|
+
# excludedTools - 工具黑名单
|
|
10
|
+
# modelName - 固定使用的模型名称;不写时跟随当前活动模型
|
|
11
|
+
# parallel - 当前类型的 sub_agent 调用是否按 parallel 工具参与调度(默认 false)
|
|
12
|
+
# 不写就是 false,只有显式写 true 才会参与并行调度
|
|
13
|
+
# maxToolRounds - 最大工具执行轮次
|
|
14
|
+
|
|
15
|
+
types:
|
|
16
|
+
general-purpose:
|
|
17
|
+
description: "执行需要多步工具操作的复杂子任务。适合承接相对独立的子任务。"
|
|
18
|
+
systemPrompt: "你是一个通用子代理,负责独立完成委派给你的子任务。请专注于完成任务并返回清晰的结果。"
|
|
19
|
+
excludedTools:
|
|
20
|
+
- sub_agent
|
|
21
|
+
parallel: false
|
|
22
|
+
# modelName: gemini_flash
|
|
23
|
+
maxToolRounds: 200
|
|
24
|
+
|
|
25
|
+
explore:
|
|
26
|
+
description: "只读搜索和阅读文件、执行查询命令。不做修改,只返回发现的信息。"
|
|
27
|
+
systemPrompt: "你是一个只读探索代理,负责搜索和阅读信息。不要修改任何文件,只返回你发现的内容。"
|
|
28
|
+
allowedTools:
|
|
29
|
+
- read_file
|
|
30
|
+
- search_in_files
|
|
31
|
+
- find_files
|
|
32
|
+
- list_files
|
|
33
|
+
- shell
|
|
34
|
+
parallel: true
|
|
35
|
+
# modelName: gpt4o_mini
|
|
36
|
+
maxToolRounds: 200
|
|
37
|
+
|
|
38
|
+
recall:
|
|
39
|
+
description: "从长期记忆中检索相关信息。当需要回忆用户偏好、历史事实或之前保存的内容时使用。"
|
|
40
|
+
systemPrompt: |
|
|
41
|
+
你是一个记忆召回代理。根据给定的查询,从长期记忆中尽可能全面地检索相关信息。
|
|
42
|
+
|
|
43
|
+
策略:
|
|
44
|
+
1. 先用原始查询搜索
|
|
45
|
+
2. 如果结果不够,提取关键词重新搜索
|
|
46
|
+
3. 尝试相关概念或同义词搜索
|
|
47
|
+
|
|
48
|
+
将所有找到的记忆整理为清晰的摘要返回。如果没有找到任何相关记忆,明确说明。
|
|
49
|
+
allowedTools:
|
|
50
|
+
- memory_search
|
|
51
|
+
parallel: false
|
|
52
|
+
# modelName: recall_model
|
|
53
|
+
maxToolRounds: 3
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 上下文压缩配置(/compact 指令)
|
|
2
|
+
|
|
3
|
+
# 总结 AI 的系统提示词
|
|
4
|
+
systemPrompt: |
|
|
5
|
+
You are a conversation compressor. Your task is to read the conversation history and produce a dense context summary.
|
|
6
|
+
|
|
7
|
+
The summary must:
|
|
8
|
+
1. State what the user is working on (project, goal)
|
|
9
|
+
2. List key file paths and code changes made
|
|
10
|
+
3. Note important decisions and their reasons
|
|
11
|
+
4. Describe current state and any pending tasks
|
|
12
|
+
5. Preserve technical details (function names, config keys, error messages, etc.)
|
|
13
|
+
|
|
14
|
+
Rules:
|
|
15
|
+
- Write in the same language as the conversation
|
|
16
|
+
- Be information-dense — every sentence should contain useful context
|
|
17
|
+
- Do NOT include pleasantries, greetings, or meta-commentary
|
|
18
|
+
- Output ONLY the summary text
|
|
19
|
+
|
|
20
|
+
# 追加在对话末尾的用户指令(要求 AI 生成摘要)
|
|
21
|
+
userPrompt: "Please summarize the conversation above into a concise context summary."
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# 系统配置
|
|
2
|
+
|
|
3
|
+
# 系统提示词(留空则使用默认)
|
|
4
|
+
systemPrompt: ""
|
|
5
|
+
|
|
6
|
+
# 工具执行最大轮次
|
|
7
|
+
maxToolRounds: 200
|
|
8
|
+
|
|
9
|
+
# 流式输出
|
|
10
|
+
stream: true
|
|
11
|
+
|
|
12
|
+
# LLM 调用报错自动重试(默认开启)
|
|
13
|
+
retryOnError: true
|
|
14
|
+
|
|
15
|
+
# 最大重试次数(默认 3)
|
|
16
|
+
maxRetries: 3
|
|
17
|
+
|
|
18
|
+
# 子代理最大嵌套深度(默认 3)
|
|
19
|
+
# maxAgentDepth: 3
|
|
20
|
+
|
|
21
|
+
# 默认模式(需与 modes.yaml 中定义的名称对应)
|
|
22
|
+
# defaultMode: code
|
|
23
|
+
|
|
24
|
+
# 记录 LLM 请求/响应日志(调试用,默认关闭)
|
|
25
|
+
# 开启后每次 LLM 调用会在 ~/.iris/logs/ 生成配对的请求和响应文件:
|
|
26
|
+
# request_<timestamp>.json — 请求(URL、headers、body)
|
|
27
|
+
# response_<timestamp>.json — 非流式响应原文
|
|
28
|
+
# response_<timestamp>.txt — 流式响应原文(SSE)
|
|
29
|
+
# logRequests: true
|
|
30
|
+
|
|
31
|
+
# 兼容旧配置:skillPreamble 仍可被读取,但当前版本已不再使用。
|
|
32
|
+
# 说明:Skill 已改为通过 read_skill 工具按需读取,不再拼接到用户消息末尾。
|
|
33
|
+
|
|
34
|
+
# Skill 定义(按需加载的提示词模块)
|
|
35
|
+
# 当前实现会先把 Skill 的 name / path / description 暴露给模型,
|
|
36
|
+
# 模型需要完整 Skill 内容时,再通过 read_skill(path) 工具按需读取。
|
|
37
|
+
# 名称规则:仅允许 ASCII 字母、数字、下划线、连字符,最长 64 字符
|
|
38
|
+
#
|
|
39
|
+
# 除了在此处内联定义,也可以将 SKILL.md 放在以下目录:
|
|
40
|
+
# ~/.iris/skills/<name>/SKILL.md — 全局 Skill
|
|
41
|
+
# .agents/skills/<name>/SKILL.md — 项目级 Skill(cwd 下)
|
|
42
|
+
# 文件格式遵循 Agent Skills 开放标准(YAML frontmatter + Markdown 正文)
|
|
43
|
+
# 同名时此处的内联定义优先于文件系统中的定义。
|
|
44
|
+
# 内联 Skill 没有真实的 SKILL.md 文件,因此系统会为它生成形如 inline:<name> 的路径标识,
|
|
45
|
+
# 供 read_skill 工具作为唯一参数使用。
|
|
46
|
+
# skills:
|
|
47
|
+
# code-review:
|
|
48
|
+
# description: "代码审查专家"
|
|
49
|
+
# content: |
|
|
50
|
+
# 你是一个代码审查专家。请对用户的代码进行详细审查,
|
|
51
|
+
# 关注代码质量、安全性、性能和可维护性。
|
|
52
|
+
#
|
|
53
|
+
# translator:
|
|
54
|
+
# description: "中英翻译助手"
|
|
55
|
+
# content: |
|
|
56
|
+
# 请将用户的内容翻译为对应的另一种语言(中→英 或 英→中)。
|
|
57
|
+
# 保持原文的语气和风格。
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# 工具配置
|
|
2
|
+
#
|
|
3
|
+
# ─── 工具防御性参数(防止输出过大撑爆 LLM 上下文) ───
|
|
4
|
+
#
|
|
5
|
+
# 所有参数均有内置默认值,通常无需修改。
|
|
6
|
+
# 如需调整,取消对应行的注释即可。
|
|
7
|
+
#
|
|
8
|
+
limits:
|
|
9
|
+
# ── read_file ──
|
|
10
|
+
read_file:
|
|
11
|
+
maxFiles: 10 # 单次调用最多读取文件数
|
|
12
|
+
maxFileSizeBytes: 2097152 # 单文件最大字节数 (2MB)
|
|
13
|
+
maxTotalOutputChars: 200000 # 所有文件格式化后的总输出字符数上限
|
|
14
|
+
|
|
15
|
+
# ── search_in_files ──
|
|
16
|
+
search_in_files:
|
|
17
|
+
maxResults: 100 # 最大匹配结果数 (search 模式)
|
|
18
|
+
maxFiles: 50 # 最大处理文件数 (replace 模式)
|
|
19
|
+
contextLines: 2 # 每条匹配的上下文行数
|
|
20
|
+
maxFileSizeBytes: 2097152 # 单文件最大字节数 (2MB),超过则跳过
|
|
21
|
+
maxLineDisplayChars: 500 # 结果中单行最大展示字符数 (防 minified 文件撑爆)
|
|
22
|
+
maxMatchDisplayChars: 200 # 匹配文本最大展示字符数
|
|
23
|
+
|
|
24
|
+
# ── list_files ──
|
|
25
|
+
list_files:
|
|
26
|
+
maxEntries: 2000 # 递归列出时最大条目数
|
|
27
|
+
|
|
28
|
+
# ── find_files ──
|
|
29
|
+
find_files:
|
|
30
|
+
maxResults: 500 # 每个 pattern 的最大结果数
|
|
31
|
+
|
|
32
|
+
# ── shell ──
|
|
33
|
+
shell:
|
|
34
|
+
defaultTimeout: 30000 # 默认超时 (毫秒)
|
|
35
|
+
maxOutputChars: 50000 # stdout/stderr 各自的最大字符数
|
|
36
|
+
maxBuffer: 10485760 # Node.js exec maxBuffer 字节数 (10MB)
|
|
37
|
+
|
|
38
|
+
# ─── 全局审批开关(最高优先级) ───
|
|
39
|
+
#
|
|
40
|
+
# 全部自动批准(跳过一类 + 二类审批)
|
|
41
|
+
# autoApproveAll: true
|
|
42
|
+
#
|
|
43
|
+
# 仅跳过一类审批(Y/N 确认),二类审批(diff 预览)仍生效
|
|
44
|
+
# autoApproveConfirmation: true
|
|
45
|
+
#
|
|
46
|
+
# 仅跳过二类审批(diff 预览),一类审批(Y/N 确认)仍生效
|
|
47
|
+
# autoApproveDiff: true
|
|
48
|
+
#
|
|
49
|
+
# ─── 按工具配置执行策略 ───
|
|
50
|
+
#
|
|
51
|
+
# 下方按工具名称配置执行策略。
|
|
52
|
+
# 未配置的工具默认需要手动确认。
|
|
53
|
+
#
|
|
54
|
+
# autoApprove: true -> 工具调用后直接执行
|
|
55
|
+
# autoApprove: false -> 工具执行前需要手动确认
|
|
56
|
+
|
|
57
|
+
# 只读工具:默认直接执行
|
|
58
|
+
read_file:
|
|
59
|
+
autoApprove: true
|
|
60
|
+
search_in_files:
|
|
61
|
+
autoApprove: true
|
|
62
|
+
# 如需对 mode: replace 打开 diff 审批页,可改为 false,并开启 showApprovalView
|
|
63
|
+
showApprovalView: true
|
|
64
|
+
find_files:
|
|
65
|
+
autoApprove: true
|
|
66
|
+
list_files:
|
|
67
|
+
autoApprove: true
|
|
68
|
+
read_skill:
|
|
69
|
+
# Skill 读取工具是只读操作,建议默认直接执行
|
|
70
|
+
autoApprove: true
|
|
71
|
+
|
|
72
|
+
# 修改类工具:默认需要确认
|
|
73
|
+
write_file:
|
|
74
|
+
autoApprove: false
|
|
75
|
+
# Console TUI 中是否打开 diff 审批视图;设为 false 时退回到底部 Y/N 确认提示
|
|
76
|
+
showApprovalView: true
|
|
77
|
+
apply_diff:
|
|
78
|
+
autoApprove: false
|
|
79
|
+
# Console TUI 中是否打开 diff 审批视图;设为 false 时退回到底部 Y/N 确认提示
|
|
80
|
+
showApprovalView: true
|
|
81
|
+
insert_code:
|
|
82
|
+
autoApprove: false
|
|
83
|
+
showApprovalView: true
|
|
84
|
+
delete_code:
|
|
85
|
+
autoApprove: false
|
|
86
|
+
showApprovalView: true
|
|
87
|
+
delete_file:
|
|
88
|
+
autoApprove: false
|
|
89
|
+
create_directory:
|
|
90
|
+
autoApprove: false
|
|
91
|
+
|
|
92
|
+
# ─────────────────────────────────────────────────────────────
|
|
93
|
+
# Shell 工具配置
|
|
94
|
+
# ─────────────────────────────────────────────────────────────
|
|
95
|
+
#
|
|
96
|
+
# 除了 autoApprove 开关外,shell 工具还支持细粒度的命令模式匹配:
|
|
97
|
+
#
|
|
98
|
+
# allowPatterns — 白名单:匹配的命令自动执行(即使 autoApprove: false)
|
|
99
|
+
# denyPatterns — 黑名单:匹配的命令必须确认(即使 autoApprove: true)
|
|
100
|
+
#
|
|
101
|
+
# 判定优先级:denyPatterns > allowPatterns > autoApprove
|
|
102
|
+
#
|
|
103
|
+
# 支持的模式语法:
|
|
104
|
+
# - 精确匹配: "git status" 仅匹配该完整命令
|
|
105
|
+
# - 通配符 *: "git log *" 匹配 git log 后跟任意参数
|
|
106
|
+
# - 通配符 ?: "ls -?" 匹配 ls 后跟单字母选项
|
|
107
|
+
# - 前缀匹配: "npm run *" 匹配所有 npm run 子命令
|
|
108
|
+
# - 正则表达式:"/^cat\s+\S+$/" 以 / 包裹按正则解析
|
|
109
|
+
#
|
|
110
|
+
# ── 用法示例 ──
|
|
111
|
+
#
|
|
112
|
+
# 场景 A:默认拒绝,仅放行指定命令(推荐)
|
|
113
|
+
# autoApprove: false
|
|
114
|
+
# allowPatterns:
|
|
115
|
+
# - "git status*"
|
|
116
|
+
# - "ls *"
|
|
117
|
+
#
|
|
118
|
+
# 场景 B:默认放行,拦截危险命令
|
|
119
|
+
# autoApprove: true
|
|
120
|
+
# denyPatterns:
|
|
121
|
+
# - "rm *"
|
|
122
|
+
# - "/sudo\s+/"
|
|
123
|
+
#
|
|
124
|
+
# 场景 C:混合使用(白名单 + 黑名单 + 兜底)
|
|
125
|
+
# autoApprove: false
|
|
126
|
+
# allowPatterns:
|
|
127
|
+
# - "git *"
|
|
128
|
+
# denyPatterns:
|
|
129
|
+
# - "git push *" # 虽然 git * 在白名单,但 push 被黑名单拦截
|
|
130
|
+
#
|
|
131
|
+
shell:
|
|
132
|
+
autoApprove: false
|
|
133
|
+
|
|
134
|
+
# ── 白名单(取消注释以启用) ──
|
|
135
|
+
allowPatterns:
|
|
136
|
+
# 只读 / 查看类
|
|
137
|
+
# - "ls *" # 列出文件
|
|
138
|
+
# - "cat *" # 查看文件内容
|
|
139
|
+
# - "head *" # 查看文件开头
|
|
140
|
+
# - "tail *" # 查看文件结尾
|
|
141
|
+
# - "wc *" # 统计行数/字数
|
|
142
|
+
# - "which *" # 查找命令路径
|
|
143
|
+
# - "echo *" # 输出信息
|
|
144
|
+
# - "pwd" # 当前目录
|
|
145
|
+
# - "env" # 查看环境变量
|
|
146
|
+
#
|
|
147
|
+
# 搜索类
|
|
148
|
+
# - "grep *" # 搜索文本
|
|
149
|
+
# - "find *" # 查找文件
|
|
150
|
+
# - "rg *" # ripgrep 搜索
|
|
151
|
+
# - "fd *" # fd 查找
|
|
152
|
+
#
|
|
153
|
+
# Git 只读操作
|
|
154
|
+
# - "git status*" # 状态查看
|
|
155
|
+
# - "git log *" # 日志查看
|
|
156
|
+
# - "git diff*" # 差异查看
|
|
157
|
+
# - "git branch*" # 分支查看
|
|
158
|
+
# - "git show *" # 查看提交
|
|
159
|
+
# - "git remote -v" # 查看远程
|
|
160
|
+
#
|
|
161
|
+
# 包管理器(只读)
|
|
162
|
+
# - "npm list*" # 查看依赖
|
|
163
|
+
# - "npm run *" # 运行脚本
|
|
164
|
+
# - "bun run *" # bun 运行脚本
|
|
165
|
+
#
|
|
166
|
+
# 自定义正则
|
|
167
|
+
# - "/^(node|bun|npx|tsx)\\s+/" # 允许 node/bun/npx/tsx 命令
|
|
168
|
+
|
|
169
|
+
# ── 黑名单(取消注释以启用) ──
|
|
170
|
+
denyPatterns:
|
|
171
|
+
# 危险操作
|
|
172
|
+
# - "rm -rf *" # 递归强制删除
|
|
173
|
+
# - "/^sudo\\s+/" # 所有 sudo 命令
|
|
174
|
+
# - "/^chmod\\s+/" # 修改权限
|
|
175
|
+
# - "/^chown\\s+/" # 修改所有者
|
|
176
|
+
# - "dd *" # 磁盘操作
|
|
177
|
+
# - "/\\|\\s*sh/" # 管道到 sh 执行
|
|
178
|
+
# - "curl * | *" # curl 管道执行
|
|
179
|
+
#
|
|
180
|
+
# Git 危险操作
|
|
181
|
+
# - "git push *" # 推送
|
|
182
|
+
# - "git reset --hard*" # 硬重置
|
|
183
|
+
# - "git clean -fd*" # 强制清理
|
|
184
|
+
#
|
|
185
|
+
# 包管理器写操作
|
|
186
|
+
# - "npm install*" # 安装依赖
|
|
187
|
+
# - "npm publish*" # 发布包
|
|
188
|
+
|
|
189
|
+
sub_agent:
|
|
190
|
+
autoApprove: false
|
|
191
|
+
|
|
192
|
+
read_skill:
|
|
193
|
+
autoApprove: true
|
|
194
|
+
|
|
195
|
+
# ─────────────────────────────────────────────────────────────
|
|
196
|
+
# Computer Use 工具配置(需在 computer_use.yaml 中启用)
|
|
197
|
+
# ─────────────────────────────────────────────────────────────
|
|
198
|
+
#
|
|
199
|
+
# 以下工具在 computer_use.yaml 的 enabled: true 时自动注册。
|
|
200
|
+
# 所有坐标参数均为 0-999 归一化值,由工具内部转换为实际像素。
|
|
201
|
+
#
|
|
202
|
+
# 只读 / 低风险操作:建议自动批准
|
|
203
|
+
# get_screenshot:
|
|
204
|
+
# autoApprove: true
|
|
205
|
+
# click_at:
|
|
206
|
+
# autoApprove: true
|
|
207
|
+
# hover_at:
|
|
208
|
+
# autoApprove: true
|
|
209
|
+
# scroll_document:
|
|
210
|
+
# autoApprove: true
|
|
211
|
+
# scroll_at:
|
|
212
|
+
# autoApprove: true
|
|
213
|
+
# go_back:
|
|
214
|
+
# autoApprove: true
|
|
215
|
+
# go_forward:
|
|
216
|
+
# autoApprove: true
|
|
217
|
+
# search:
|
|
218
|
+
# autoApprove: true
|
|
219
|
+
# navigate:
|
|
220
|
+
# autoApprove: true
|
|
221
|
+
# wait_5_seconds:
|
|
222
|
+
# autoApprove: true
|
|
223
|
+
#
|
|
224
|
+
# 输入类操作:按需决定是否自动批准
|
|
225
|
+
# type_text_at:
|
|
226
|
+
# autoApprove: true
|
|
227
|
+
# key_combination:
|
|
228
|
+
# autoApprove: false # 按键组合可能触发系统级操作,建议手动确认
|
|
229
|
+
# drag_and_drop:
|
|
230
|
+
# autoApprove: false
|
|
231
|
+
|
|
232
|
+
# 如需启用其他工具(记忆、MCP 等),请按工具名补充配置。
|
|
233
|
+
# 例如:
|
|
234
|
+
# memory_search:
|
|
235
|
+
# autoApprove: true
|
|
236
|
+
# mcp__my_server__my_tool:
|
|
237
|
+
# autoApprove: false
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "irises",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "模块化、可解耦的 AI 聊天框架,支持多平台、多 LLM、工具调用",
|
|
5
|
+
"license": "GPL-3.0-only",
|
|
6
|
+
"bin": {
|
|
7
|
+
"iris": "./bin/iris"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
|
|
11
|
+
},
|
|
12
|
+
"optionalDependencies": {
|
|
13
|
+
"irises-linux-x64": "1.0.0",
|
|
14
|
+
"irises-darwin-arm64": "1.0.0",
|
|
15
|
+
"irises-darwin-x64": "1.0.0",
|
|
16
|
+
"irises-windows-x64": "1.0.0",
|
|
17
|
+
"irises-linux-arm64": "1.0.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/postinstall.mjs
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Iris npm postinstall 脚本
|
|
5
|
+
*
|
|
6
|
+
* 在 npm install 完成后自动执行,将当前平台的预编译主程序和 onboard 二进制
|
|
7
|
+
* 硬链接(或复制)到包装器包的 bin/.iris 与 bin/.iris-onboard,供统一入口调用。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import fs from "fs"
|
|
11
|
+
import path from "path"
|
|
12
|
+
import os from "os"
|
|
13
|
+
import { fileURLToPath } from "url"
|
|
14
|
+
import { createRequire } from "module"
|
|
15
|
+
|
|
16
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
17
|
+
const require = createRequire(import.meta.url)
|
|
18
|
+
|
|
19
|
+
function detectPlatformAndArch() {
|
|
20
|
+
const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" }
|
|
21
|
+
const archMap = { x64: "x64", arm64: "arm64", arm: "arm" }
|
|
22
|
+
|
|
23
|
+
const platform = platformMap[os.platform()] || os.platform()
|
|
24
|
+
const arch = archMap[os.arch()] || os.arch()
|
|
25
|
+
return { platform, arch }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function resolvePackageDir() {
|
|
29
|
+
const { platform, arch } = detectPlatformAndArch()
|
|
30
|
+
const packageName = `irises-${platform}-${arch}`
|
|
31
|
+
try {
|
|
32
|
+
const packageJsonPath = require.resolve(`${packageName}/package.json`)
|
|
33
|
+
return {
|
|
34
|
+
packageName,
|
|
35
|
+
packageDir: path.dirname(packageJsonPath),
|
|
36
|
+
platform,
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
throw new Error(`Could not find package ${packageName}: ${error.message}`)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function resolveBinaryPaths() {
|
|
44
|
+
const { packageName, packageDir, platform } = resolvePackageDir()
|
|
45
|
+
const suffix = platform === "windows" ? ".exe" : ""
|
|
46
|
+
const binaries = {
|
|
47
|
+
main: path.join(packageDir, "bin", `iris${suffix}`),
|
|
48
|
+
onboard: path.join(packageDir, "bin", `iris-onboard${suffix}`),
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
for (const [kind, binaryPath] of Object.entries(binaries)) {
|
|
52
|
+
if (!fs.existsSync(binaryPath)) {
|
|
53
|
+
throw new Error(`Binary (${kind}) not found in ${packageName}: ${binaryPath}`)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return binaries
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function linkOrCopy(sourcePath, targetPath) {
|
|
61
|
+
if (fs.existsSync(targetPath)) {
|
|
62
|
+
fs.unlinkSync(targetPath)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
fs.linkSync(sourcePath, targetPath)
|
|
67
|
+
} catch {
|
|
68
|
+
fs.copyFileSync(sourcePath, targetPath)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function main() {
|
|
73
|
+
try {
|
|
74
|
+
if (os.platform() === "win32") {
|
|
75
|
+
console.log("Windows detected: skip cached links, launcher will resolve packaged binaries directly")
|
|
76
|
+
return
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const binaries = resolveBinaryPaths()
|
|
80
|
+
const binDir = path.join(__dirname, "bin")
|
|
81
|
+
if (!fs.existsSync(binDir)) {
|
|
82
|
+
fs.mkdirSync(binDir, { recursive: true })
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const targets = {
|
|
86
|
+
main: path.join(binDir, ".iris"),
|
|
87
|
+
onboard: path.join(binDir, ".iris-onboard"),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
for (const [kind, sourcePath] of Object.entries(binaries)) {
|
|
91
|
+
const targetPath = targets[kind]
|
|
92
|
+
linkOrCopy(sourcePath, targetPath)
|
|
93
|
+
fs.chmodSync(targetPath, 0o755)
|
|
94
|
+
console.log(`Iris ${kind} binary linked: ${targetPath} -> ${sourcePath}`)
|
|
95
|
+
}
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error("Failed to setup Iris binaries:", error.message)
|
|
98
|
+
process.exit(0)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
main()
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error("Postinstall script error:", error.message)
|
|
106
|
+
process.exit(0)
|
|
107
|
+
}
|