Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

feat(web): "Create with AI" on the Agents page, the Models page and the Vault tab (#591)

Yaowei Zhengb6da96c09cb1
diff --git a/changelog/unreleased/2026-09-02-create-with-ai-agents-models-vault.md b/changelog/unreleased/2026-09-02-create-with-ai-agents-models-vault.md
new file mode 100644
index 00000000..1a5d077c
--- /dev/null
+++ b/changelog/unreleased/2026-09-02-create-with-ai-agents-models-vault.md
@@ -0,0 +1,17 @@
+# "Create with AI" on the Agents page, the Models page and the Vault tab
+
+- **Date:** 2026-09-02
+- **Type:** feature
+- **Scope:** `web`, `docs`
+- **PR:** [#591](https://github.com/Prism-Shadow/penguin-harness/pull/591)
+
+[中文版](2026-09-02-create-with-ai-agents-models-vault.zh.md)
+
+Three surfaces gained the AI path the [shared kit](../0.2.10/2026-09-02-create-with-ai-kit.md) provides: an agent, a model group and a vault secret can now be described to the Project's default agent instead of filled into a form. Each surface offers the two buttons side by side — **Create with AI** and **Create manually** — ships its own clickable examples, and carries a fixed instruction tail naming the skill the agent must use, so a novice's one-liner becomes a task the agent can finish. Nothing is sent from these dialogs: the prompt lands in a new conversation's composer for the user to read and send.
+
+## Details
+
+- The Agents page's header and its empty state both offer the pair of buttons, and the create dialog opens on the path the button named and stays there — there is no mode switch, and the draft resets on every open. The AI side carries five examples (a jotting agent, a financial Copilot, a document RAG agent, a deep-research report agent, and the report-writing agent with the id `report-writer` that the onboarding chain starts from) and a tail that has the agent run the `agent-initialization` skill: a new agent under the current Project, its AGENTS.md and name/description written, only the skills it needs copied from the plugin library, no other agent touched, the id and how to start a conversation reported at the end. The manual form is unchanged, and the sidebar's mode-dependent "new agent" button — which names no path — still opens it.
+- The Models page's header gained the pair (owner only) beside **Sync presets**: the AI button takes a listing page URL or a description of the service to the default agent with a tail that has it use the `penguin-config` skill — one `penguin config model add --provider … --model-id … --project-id … --root …` per model, `--client-type openai --base-url …` for OpenAI-compatible endpoints, a web page fetched first with the named (else the most popular, about ten) models picked, a missing API key asked for once or left empty for the Models page, the config file never touched, `penguin config model list` at the end. The manual button opens the existing **Add group** dialog, and the AI dialog's lead says when that dialog's **Import models** path is the faster one.
+- The Vault tab gained the pair (owner only) whose AI dialog warns that a value typed into the prompt reaches the model provider, the conversation's Trace and the agent's own command line. The rest of the surface follows that warning: the examples lead with creating the key names an agent's skills need and filling the values in by hand afterwards, and none of them pastes a secret into the prompt. Its tail names the target agent, the Project and the data root on every `penguin config vault set`, forbids echoing values or reading `.vault.toml`, and ends with `penguin config vault list`.
+- The Web App and Models docs describe the three entries in both languages.
diff --git a/changelog/unreleased/2026-09-02-create-with-ai-agents-models-vault.zh.md b/changelog/unreleased/2026-09-02-create-with-ai-agents-models-vault.zh.md
new file mode 100644
index 00000000..eaf4a601
--- /dev/null
+++ b/changelog/unreleased/2026-09-02-create-with-ai-agents-models-vault.zh.md
@@ -0,0 +1,17 @@
+# Agents 页、模型库页与密钥保险柜标签页的「用 AI 创建」
+
+- **Date:** 2026-09-02
+- **Type:** feature
+- **Scope:** `web`, `docs`
+- **PR:** [#591](https://github.com/Prism-Shadow/penguin-harness/pull/591)
+
+[English](2026-09-02-create-with-ai-agents-models-vault.md)
+
+三个页面接入了[共用组件包](../0.2.10/2026-09-02-create-with-ai-kit.zh.md)提供的 AI 路径:Agent、模型分组与保险柜密钥现在都可以向 Project 的默认 Agent 描述,而不必填表单。每个页面并排提供两个按钮——**用 AI 创建**与**手动创建**,各自带可点击的示例与一段固定的说明尾巴,点名 Agent 必须使用的技能,让新手的一句话变成 Agent 能做完的任务。这些弹窗不会发送任何内容:提示词落进新对话的输入框,由用户读过再发送。
+
+## 细节
+
+- Agents 页的页头与空态都提供这一对按钮;创建弹窗按点击的按钮打开对应路径并停在那里——没有模式切换,每次打开草稿都从空开始。AI 一侧带五个示例(随记智能体、金融 Copilot、文档 RAG 智能体、深度研究报告智能体,以及新手引导链起点的报告写作智能体,id 为 `report-writer`)与一段尾巴,要求 Agent 用 `agent-initialization` 技能在当前 Project 下新建 Agent:写好 AGENTS.md 与名称、描述,只从插件库复制它需要的技能,不动其他 Agent,最后报出 id 与开始对话的方式。手动表单不变;侧边栏那个随分组方式变化的「新建 Agent」按钮不点名路径,仍然打开手动表单。
+- 模型库页页头在**同步预置**旁新增这一对按钮(仅 owner):AI 按钮把模型列表页的链接或一段服务描述交给默认 Agent,尾巴要求它用 `penguin-config` 技能——每个模型执行一次 `penguin config model add --provider … --model-id … --project-id … --root …`,OpenAI 兼容端点加 `--client-type openai --base-url …`,来源是网页时先抓取并优先加点名的模型(否则取最常用的、十个左右),缺 API key 只问一次、不给则留空到模型库页补填,不读写配置文件,最后 `penguin config model list`。手动按钮打开原有的**新增分组**弹窗;AI 弹窗的引导语说明何时用该弹窗的**导入模型**更快。
+- 密钥保险柜标签页新增这一对按钮(仅 owner),AI 弹窗如实提醒写进提示词的值会发给模型服务商、进入对话记录(Trace),也会出现在智能体执行的命令里。整个页面都按这句提醒来:示例以「先建好智能体技能需要的键名、值稍后手动填」打头,没有任何示例把密钥粘进提示词。尾巴在每条 `penguin config vault set` 上带上目标 Agent、Project 与数据根目录,禁止复述值或读取 `.vault.toml`,最后 `penguin config vault list`。
+- Web App 与模型文档以双语描述了这三个入口。
diff --git a/packages/docs/content/models.en.md b/packages/docs/content/models.en.md
index 53e2d820..97994420 100644
--- a/packages/docs/content/models.en.md
+++ b/packages/docs/content/models.en.md
@@ -132,6 +132,8 @@ Nothing is inferred from the model id in these groups. Typing `claude-sonnet-5`
The add-group dialog offers two modes under the name field. **Create only** is the light path: a valid name hands off to that group's add-model dialog. **Import models** fills the brand-new group from its endpoint, in the add-model dialog's field rhythm — API key first, then the base URL with **Detect** at its top-right and the in-field protocol picker as manual override. Once a protocol is determined (detected or picked), **Import all models** appears: it asks the endpoint for every model id it serves (`POST /api/projects/:id/models/list`, owner only — AgentHub's `listModels()` on that protocol client, bounded at 20s) and saves them all as entries of the new group in one table write — base URL, protocol, and the typed key inline on each — in the endpoint's own order. An id the config cannot hold (empty, over 200 characters, or carrying control characters) or one already taken is skipped and counted in the toast, so a single bad entry never sinks the import. Only the id is taken from the endpoint: pricing, context window and display name stay empty, and an imported model claims no vision support until you probe it or switch it on — the same start a model added to the group by hand gets. An empty key follows the same per-protocol environment fallback as everywhere else. A failed detection turns the suffix amber and blocks nothing — pick the protocol by hand or switch back to create-only; listing failures (a protocol with no models endpoint, an empty listing) stay inside the dialog and persist nothing.
+The header's **Create with AI** (owner only) covers what the import cannot read: a listing page that is not an OpenAI-compatible `/models` endpoint, a service described in words, or a vendor model to add to an existing group. The prompt goes to the Project's default agent with a fixed tail that has it use the `penguin-config` skill — one `penguin config model add --provider <group> --model-id <upstream id> --project-id <project> --root <data root>` per model (`--client-type openai --base-url <endpoint>` for OpenAI-compatible endpoints; the root is named because a command's environment does not carry it), a web page fetched first with the models you named picked (else the most popular, about ten at most), a missing API key asked for once or left empty for you to fill in on the Models page, `.project_config.toml` never touched, and `penguin config model list` at the end. The page reloads its table on every visit, so the new group is there when you come back from the conversation.
+
### Vision detection
"Supports vision" can be left off and asked of the model instead: **Detect** next to the switch sends one 1x1 PNG with a one-word prompt and turns the switch on if the model answers. A model that answers specifically that it will not take an image turns the switch off — that is a real answer, not an error — while a probe that fails on auth or the network leaves the switch exactly as you had it and shows the usual "check the API key and the base URL".
diff --git a/packages/docs/content/models.zh.md b/packages/docs/content/models.zh.md
index 33917839..eb0f22ef 100644
--- a/packages/docs/content/models.zh.md
+++ b/packages/docs/content/models.zh.md
@@ -132,6 +132,8 @@ Custom 与自建分组走 AgentHub 的通用协议客户端,Web 对话框会
「新增分组」对话框在分组名下方提供两种模式。**仅新增分组**是轻量路径:名称合法即进入该分组的新增模型对话框。**导入模型**按端点填满全新分组,沿用新增模型对话框的字段节奏——先填 API key,再填 base URL,其右上方是「检测协议」,输入框内嵌的协议菜单可手动改选。协议确定后(检测命中或手动选定)出现**「批量导入模型」**:向端点询问它服务的全部模型 id(`POST /api/projects/:id/models/list`,仅 owner——在该协议客户端上调用 AgentHub 的 `listModels()`,限时 20s),并在一次整表写入中把它们全部存为新分组的条目——base URL、协议与所填 key 内联在每条上——顺序保持端点返回的顺序。配置无法承载的 id(为空、超过 200 字符、含控制字符)以及已被占用的 id 会被跳过并计入 toast,因此单个坏条目不会让整次导入失败。端点那边只取 id:价格、上下文窗口与显示名一律留空;导入的模型在你探测或手动打开之前不声明视觉能力——与手动往该分组添加模型的起点完全一致。key 留空时沿用各处一致的按协议环境变量回退。检测失败只把后缀转为琥珀色、不阻塞任何操作——可手动选协议继续,或切回仅新增分组;列表失败(协议不支持列出模型、列表为空)只在对话框内呈现且不落盘。
+页头的**用 AI 创建**(仅 owner)补上导入读不到的那些:模型列表页不是 OpenAI 兼容的 `/models` 端点、只能用文字描述的服务,或要加进既有分组的厂商模型。提示词发给 Project 的默认 Agent,固定尾巴要求它用 `penguin-config` 技能——每个模型执行一次 `penguin config model add --provider <分组> --model-id <上游 id> --project-id <Project> --root <数据根目录>`(OpenAI 兼容端点加 `--client-type openai --base-url <端点>`;数据根目录要写明,因为命令的环境里没有它),来源是网页时先抓取并优先加你点名的模型(否则取最常用的、至多十个左右),缺 API key 只问一次、不给则留空由你到模型库页补填,不读写 `.project_config.toml`,最后 `penguin config model list`。页面每次进入都重新加载模型表,从对话回来即能看到新分组。
+
### 视觉能力检测
「支持视觉」可以先不开,交给模型自己回答:开关旁边的「检测」会发送一张 1x1 的 PNG 和一句一个词的提示,模型能正常作答就把开关打开。若模型明确回答不接受图片,则关闭开关——这是一个真实答案,不是错误;而因鉴权或网络失败的探测则什么都不改动,只显示那句「请检查 API Key 与 base URL」。
diff --git a/packages/docs/content/web-app.en.md b/packages/docs/content/web-app.en.md
index 2a4a6bfd..b3b085c2 100644
--- a/packages/docs/content/web-app.en.md
+++ b/packages/docs/content/web-app.en.md
@@ -110,6 +110,8 @@ Everything the Web App creates from a form — an agent, a model group, a Benchm
## Agent Management (/agents)
+The header carries the two buttons described under [Create with AI](#create-with-ai), and the list's call to action offers the same pair while the Project has no agent beyond `default_agent`. The dialog opens on the path you picked and stays there. **Create with AI** opens a prompt box with five examples — a jotting agent, a financial Copilot, a document RAG agent, a deep-research report agent, and the report-writing agent with the id `report-writer` that the onboarding path starts from (create it with AI, then let AI build a Benchmark for it and optimize it) — and a fixed tail that has the Project's default agent run the `agent-initialization` skill: a new agent under this Project with the id you gave or a semantic one, its AGENTS.md and name/description written, only the skills it needs copied from the plugin library, no other agent touched, and the id plus how to start a conversation reported at the end. **Create manually** opens the form, unchanged; the sidebar's "new agent" button names no path and opens it too.
+
The list page creates and deletes Agents — the create dialog can initialize the new agent from an exported Agent State snapshot package (name and description left empty keep the package's values, and plugin picking is unavailable then, since the package carries its own skills and hooks) — and clicking through opens the `/agents/:agentId` settings page, organized into tabs:
| Tab | Contents |
@@ -120,7 +122,7 @@ The list page creates and deletes Agents — the create dialog can initialize th
| Runtime | Runtime parameters such as max_turns, model.*, compaction.* |
| Tools | Built-in tool table (incl. per-tool call_description switches) and MCP Server management: a table plus an add/edit form whose fields follow the transport (http by default; changes save immediately; full transport validation server-side; a permission control fixes the approval level of that server's tools at `auto` / `r` / `rw`, and the table shows each server's effective level); connectivity testing mirrors the models page — a standalone button in the form probes the current entry (toast with tool count and latency), and a section-level button tests every server in turn with a result badge on each row |
| Hooks | An **Enable hooks** switch at the top (owner only; members see the state) decides whether a Session this agent starts from now on runs its hook packages at all — with it off a new Session runs none of them and every package stays on disk. Below it, the installed hook packages (agent_state/hooks/): each row leads with the package name and the hook points it answers at right beside it (bare point names such as `stop`), the description below, then the version, export as a zip and uninstall. **Import hook** opens the skill import dialog's shape: the recommended path lets the agent import it in chat — a hook source field (a URL, a GitHub repository, a local path, a description, or another tool's hooks config) with a live preview of the prompt, where **Copy prompt** and **Open a new chat** are greyed together while the source is empty; below it, a hook package zip can be uploaded directly (asking before it overwrites an installed name). Library installs still happen on the plugin library page |
-| Vault | Environment-variable entries with masked values |
+| Vault | Environment-variable entries with masked values; **Create with AI** beside **Create manually** hands secrets to AI, which writes them with `penguin config vault set` — the dialog warns that a value typed there reaches the model provider, the conversation's Trace and the agent's own command line, so the safer prompt asks for key names only, and its examples lead with that ask |
| Schedule | Scheduled tasks (TOML-defined): create — with AI or manually — edit, toggle, delete; suggestions stand in for an empty list |
The Memory tab's switch writes immediately rather than joining the tab-level Save, so turning Memory off never drags an unrelated half-finished edit along with it. Turning it off keeps every file and the tab fully usable: it only stops Memory from entering the agent's context and from preparing directories for new Sessions. Scope groups collapse on header click, with the collapse state remembered in the browser per user × Project × Agent; each group header carries an **Add** text entry to its collapse arrow's left (the models page's group convention) — like editing, it goes through a bridge modal (a required content-or-source field plus a live prompt preview) into a new chat, where the agent organizes the content into that scope; the drafts stay deliberately minimal, since the save mechanics live in the Memory prompt. Rows are read-only on purpose, their actions icon-only like the skills tab's — **View** renders the body in a right drawer on desktop and a bottom sheet on narrow screens (the chat page panels' interaction, with half / full snap points), **Delete** confirms and also removes the file's `MEMORY.md` index lines, and **Edit** opens a bridge modal first (what to change plus a prompt preview), then jumps to a new chat with this agent; a Workspace scope's chat also pins that Workspace, so the Session reads the very index it is changing. A whole group also moves in one piece: **Export** downloads it as a JSON document (every memory plus the group's `MEMORY.md`) whose file name carries the export date and time, so repeated exports stay apart, and **Import** — owner only, mirroring the Agent State snapshot's split — reads one back. Import asks what to do with a name the group already has: keep the one that is here (the default, which loses nothing), take the file's version, or replace the whole group; either of the latter two confirms first, naming the memories that would be overwritten or deleted. Below the groups the two memory prompts (`memory.prompt` / `memory.workspace_prompt`) are edited in place, and when the prompt template carries no `{{MEMORY}}` placeholder (an agent created before Memory) it shows a hint with a one-click insert — an explicit, idempotent config write. The agent list cards' stat line also shows the memory count, deep-linking to this tab. For the storage model, see [Configuration](/configuration#memory).
@@ -135,6 +137,8 @@ Browse the plugin library by category — skills and session hooks alike — ins
A per-Project model table grouped by provider. Models can be added and edited: identity is the `(provider, model_id)` pair, credentials are masked, and context window, max output tokens (a per-model cap overriding the Agent's `model.max_tokens` — lower it for small-context models), pricing, the vision flag, and fast mode (off by default: faster output at the provider's premium tier — the toggle is shown only for models whose AgentHub client can serve it, and switching it on confirms the premium billing first) are configurable. A model with fast mode on is badged in the list. You can set the default model and the vision model (which reads images on behalf of session models without image input), and run a connectivity test on any entry — the test carries the dialog's current fast-mode toggle, so a rejection surfaces before saving. Only Project owners can edit. For concepts, see [Models and Providers](/models).
+The header carries the two create buttons (owner only). **Create with AI** hands a model listing page or a description of a service to the Project's default agent, which registers the models as a group through `penguin config model add`; the dialog's lead says when the **Import models** path is the faster one. **Create manually** opens the **Add group** dialog. The table reloads on every visit, so the group is there when you come back from the conversation.
+
## Usage (/usage)
- Filters: Agent, model, and date range (trailing last hour / last 24 hours, last 7 / 30 / 90 days, or a custom pair). The range decides the precision the charts are drawn at — per minute for the last hour, hourly for the last 24 hours, daily for the calendar presets, week or month for a long custom range — so there is no separate precision control;
diff --git a/packages/docs/content/web-app.zh.md b/packages/docs/content/web-app.zh.md
index 8bb19b4f..8c117f6a 100644
--- a/packages/docs/content/web-app.zh.md
+++ b/packages/docs/content/web-app.zh.md
@@ -109,6 +109,8 @@ Web App 里凡是通过表单创建的对象——Agent、模型分组、Benchma
## Agent 管理(/agents)
+页头是[用 AI 创建](#用-ai-创建)一节所述的那两个按钮;Project 里除 `default_agent` 外还没有 Agent 时,列表末尾的空态按钮同样是这一对。弹窗按你点的那个按钮打开对应路径,并停在那里。**用 AI 创建**的提示词框带五个示例——随记智能体、金融 Copilot、文档 RAG 智能体、深度研究报告智能体,以及新手引导链(先用 AI 创建它,再让 AI 为它建 Benchmark 并优化)起点的报告写作智能体(id 为 `report-writer`)——固定尾巴让 Project 的默认 Agent 用 `agent-initialization` 技能创建:在当前 Project 下新建一个 Agent(用你给的 id,否则取语义 id),写好它的 AGENTS.md 与名称、描述,只从插件库复制它需要的技能,不动其他 Agent,最后报出 id 与开始对话的方式。**手动创建**打开原来的表单,内容不变;侧边栏那个「新建 Agent」按钮不点名路径,打开的也是它。
+
列表页支持创建与删除 Agent——创建弹窗可选从导出的 Agent State 快照包直接初始化(名称与描述留空沿用包内值;此时技能选择不可用,包自带技能);点击进入 `/agents/:agentId` 设置页,按标签页组织:
| 标签页 | 内容 |
@@ -119,7 +121,7 @@ Web App 里凡是通过表单创建的对象——Agent、模型分组、Benchma
| Runtime | max_turns、model.*、compaction.* 等运行参数 |
| Tools | 内置工具表格(含条目级 call_description 开关)与 MCP Server 管理:表格 + 添加/编辑表单(默认 http,字段随 transport 切换,改动即时保存,服务端按 transport 完整校验;permission 控件把该 Server 工具的审批等级固定为 `auto` / `r` / `rw`,表格列出各 Server 的生效等级);测试连接与模型页同款——表单内独立按钮测当前条目(toast 报工具数与耗时),区块级按钮逐一测试全部 Server 并在各行显示结果徽标 |
| Hooks | 顶部一个**启用钩子**开关(仅 owner,成员只见状态)决定该 Agent 此后新建的 Session 是否运行钩子包——关闭后新建的 Session 一个钩子都不运行,已安装的包仍全部留在磁盘上。其下是已安装的钩子包(agent_state/hooks/):每行以包名加紧随其后的钩子点胶囊(只写钩子点名,如 `stop`)开头,其下描述,行尾版本、打包导出与卸载。**导入钩子**弹窗与导入技能同款:推荐路径是让 Agent 在对话中导入——填入钩子来源(URL / GitHub 仓库 / 本地路径 / 一段描述,或其他工具的钩子配置),弹窗实时预览发送给 Agent 的 Prompt,**复制 Prompt**与**打开新对话**在来源为空时一同置灰;其下可直接上传钩子包 zip(同名已装先确认覆盖)。从插件库安装仍在插件库页完成 |
-| Vault | 环境变量条目,值以掩码显示 |
+| Vault | 环境变量条目,值以掩码显示;**手动创建**旁的**用 AI 创建**把密钥交给 AI、由它以 `penguin config vault set` 写入——弹窗如实提醒:写进提示词的值会发给模型服务商、进入对话记录(Trace),也会出现在智能体执行的命令里,更稳妥的是只让它建键名,示例即以此打头 |
| Schedule | 定时任务(TOML 定义):创建(用 AI 创建或手动创建)、编辑、启停、删除;列表为空时展示建议 |
Memory 标签页的开关拨动即写入,不参与标签页的保存按钮,因此关闭记忆不会连带把别处未改完的内容一起存盘。关闭记忆也不会删除任何文件,标签页仍可正常查看与删除——只是记忆不再进入 Agent 上下文,也不再为新 Session 准备目录。作用域分组可折叠,折叠状态按「用户 × Project × Agent」记在浏览器本地;每组标题的折叠箭头左侧有**添加**文字入口(与模型页的分组约定一致)——和编辑一样经中转弹窗(必填的内容或来源 + 引导语实时预览)跳到新对话,由 agent 整理保存到该作用域;引导语刻意极简,写入规范由记忆提示词承载。记忆行有意不提供就地编辑,操作与技能页一致为纯图标按钮:**查看**在桌面端从右侧抽屉、窄屏从底部弹层(与对话页面板同一交互,半屏 / 全屏两档吸附)渲染正文;**删除**先确认,并同步清掉该文件在 `MEMORY.md` 中的索引行;**编辑**先打开中转弹窗(修改要求 + 引导语预览),再跳到与该 Agent 的新对话——Workspace 作用域的对话还会锁定对应 Workspace,让会话恰好读到它正在修改的那份索引。整组记忆也可以一次搬运:**导出**把它下载为一份 JSON 文档(这一组的全部记忆加它的 `MEMORY.md`),文件名带导出日期时间,多次导出互不覆盖;**导入**把这样一份文档读回来——与 Agent State 快照同样的分工,仅 owner 可用。导入时需要指定同名记忆的处理方式:保留现有的(缺省,不丢失任何内容)、改用文件里的版本、或整组替换;后两者会先弹出确认,逐条列出将被覆盖或删除的记忆。标签页下方可直接编辑两段记忆提示词(`memory.prompt` / `memory.workspace_prompt`);当提示词模板中没有 `{{MEMORY}}` 占位符(创建于记忆功能之前的 agent)时会给出提示并提供一键插入——显式且幂等的配置写入。Agent 列表卡片的统计行也显示记忆条数,点击直达本标签页。存储模型见[配置说明](/configuration#记忆)。
@@ -134,6 +136,8 @@ Memory 标签页的开关拨动即写入,不参与标签页的保存按钮,
按 Provider 分组展示当前 Project 的模型表格。支持添加与编辑模型:以 `(provider, model_id)` 为唯一标识,凭据以掩码显示,可配置上下文窗口、最大输出长度(按模型的输出上限,覆盖 Agent 的 `model.max_tokens`——小上下文模型建议调低)、定价、视觉(vision)标记与快速模式(默认关闭:进入厂商的溢价快速档位、输出更快——该开关只对 AgentHub client 支持该档位的模型显示,打开时会先确认溢价计费);开启了快速模式的模型会在列表中带角标;可设置默认模型与视觉模型(在会话模型不支持图片输入时代为读图),并对任一模型做连通性测试——测试会携带弹窗当前的快速模式开关状态,被拒时在保存前即可发现。仅 Project Owner 可编辑,概念说明见[模型与 Provider](/models)。
+页头带那两个创建按钮(仅 owner)。**用 AI 创建**把模型列表页或一段服务描述交给 Project 的默认 Agent,由它经 `penguin config model add` 把模型加为一个分组;弹窗引导语说明何时用**导入模型**更快。**手动创建**打开**新增分组**弹窗。模型表每次进入页面都重新加载,从对话回来即能看到新分组。
+
## 用量统计(/usage)
- 筛选条件:Agent、模型与日期范围(最近一小时 / 最近一天滑动窗口、近 7 / 30 / 90 天、或自定义起止)。图表以何种精度绘制由范围决定——最近一小时按分钟,最近一天按小时,日历档位按天,跨度很长的自定义范围按周或按月——因此没有单独的精度控件;
diff --git a/packages/web/e2e/agent-create-skills.spec.mjs b/packages/web/e2e/agent-create-skills.spec.mjs
index f28aa71f..a04b745b 100644
--- a/packages/web/e2e/agent-create-skills.spec.mjs
+++ b/packages/web/e2e/agent-create-skills.spec.mjs
@@ -1,7 +1,7 @@
/**
* End-to-end test for seeding a new Agent with library plugins from the create dialog (locale
* zh-CN):
- * - the Agents page's "创建 Agent" ("Create agent") dialog carries a Plugins field whose trigger
+ * - the Agents page's "手动创建" ("Create manually") dialog carries a Plugins field whose trigger
* reads as a placeholder until something is picked, and whose panel is the shared multi-select
* list — a search box, one toggle row per library plugin, and a bulk row with 全选 / 全不选
* ("select all" / "select none") beside the running count;
@@ -46,7 +46,7 @@ test("agent create: pick library plugins (select all / none, filtered) -> they a
expect(libraryNames.length).toBeGreaterThan(2);
await page.goto(`${BASE}/agents`);
- await page.getByRole("button", { name: "创建 Agent" }).first().click();
+ await page.getByRole("button", { name: "手动创建", exact: true }).first().click();
const idField = page.getByRole("textbox", { name: /^Agent id/ });
await expect(idField).toBeVisible();
@@ -111,7 +111,7 @@ test("agent create: pick library plugins (select all / none, filtered) -> they a
// —— Creating without picking anything leaves a plain Agent ——
await page.goto(`${BASE}/agents`);
- await page.getByRole("button", { name: "创建 Agent" }).first().click();
+ await page.getByRole("button", { name: "手动创建", exact: true }).first().click();
await page.getByRole("textbox", { name: /^Agent id/ }).fill("plain_agent");
await page.getByRole("button", { name: "创建", exact: true }).click();
await page.waitForURL(/\/agents\/plain_agent$/);
diff --git a/packages/web/src/features/agents/agents-page.tsx b/packages/web/src/features/agents/agents-page.tsx
index bdac7426..ba1a5891 100644
--- a/packages/web/src/features/agents/agents-page.tsx
+++ b/packages/web/src/features/agents/agents-page.tsx
@@ -76,6 +76,7 @@ import { SkillPickList } from "../skills/skill-pick-list";
import type { PickableItem } from "../skills/skill-pick-list";
import { addSkillNames, removeSkillNames, toggleSkillName } from "../skills/skill-selection";
import { ICON_SIZE } from "../../lib/icon-scale";
+import { AiCreateModal, CreateButtons } from "../ai-create";
/** Built-in Agent shipped with every Project (default_agent only; the server also rejects deletion, so no delete entry point is shown here). */
const BUILTIN_AGENT_IDS = new Set(["default_agent"]);
@@ -142,6 +143,8 @@ export function AgentsPage() {
const [kernelConfirmOpen, setKernelConfirmOpen] = useState(false);
const [kernelRunning, setKernelRunning] = useState(false);
const [createOpen, setCreateOpen] = useState(false);
+ /** The "Create with AI" dialog, a separate surface from the form above: neither path is a step of the other. */
+ const [aiOpen, setAiOpen] = useState(false);
const [agentId, setAgentId] = useState("");
const [name, setName] = useState("");
const [description, setDescription] = useState("");
@@ -231,7 +234,8 @@ export function AgentsPage() {
// Cross-page create intent (the sidebar's mode-dependent "new" button navigates here
// with { create: true } route state — the chat draft's route-state idiom): open the
// existing create dialog once, then strip the state so a refresh or back-nav doesn't
- // reopen it.
+ // reopen it. That button names no path, so it opens the form; the AI path is one click
+ // away on the header the dialog sits over.
const location = useLocation();
const createIntent = (location.state as { create?: boolean } | null)?.create === true;
useEffect(() => {
@@ -426,10 +430,10 @@ export function AgentsPage() {
<div className="mb-4">
<div className="flex flex-wrap items-center justify-between gap-2">
<h1 className="text-xl font-semibold">{S.agent.listTitle}</h1>
- {/* Search plus the create action, in the Models page header's shape: on a narrow
+ {/* Search plus the create pair, in the Models page header's shape: on a narrow
screen flex-wrap drops the pair onto its own line and the box shrinks with it,
- fixed width from sm up. Both controls take the form rung, so the button reads at
- the size of the box beside it rather than a step above it. */}
+ fixed width from sm up. Both controls take the form rung — CreateButtons defaults
+ to it — so the buttons read at the size of the box beside them. */}
<div className="flex min-w-0 max-w-full grow items-center gap-2 sm:grow-0">
<div className="min-w-0 flex-1 sm:w-56 sm:flex-none">
<Input
@@ -439,9 +443,7 @@ export function AgentsPage() {
placeholder={S.agent.searchPlaceholder}
/>
</div>
- <Button size="sm" variant="primary" onClick={openCreate}>
- {S.agent.create}
- </Button>
+ <CreateButtons onAi={() => setAiOpen(true)} onManual={openCreate} />
</div>
</div>
@@ -688,6 +690,18 @@ export function AgentsPage() {
</div>
);
})}
+ {/* Until the Project has an agent of its own, the list ends in the AI path's call to
+ action: the built-in default is not one the user set up. Hidden while searching
+ (the list itself is being filtered). */}
+ {query.trim() === "" && agents.every((a) => BUILTIN_AGENT_IDS.has(a.agentId)) && (
+ <EmptyState
+ title={S.agent.firstAgentTitle}
+ description={S.agent.firstAgentDesc}
+ action={
+ <CreateButtons size="sm" onAi={() => setAiOpen(true)} onManual={openCreate} />
+ }
+ />
+ )}
</div>
)}
</div>
@@ -882,6 +896,21 @@ export function AgentsPage() {
</div>
</Modal>
+ {/* The AI path, its own dialog rather than a mode of the form above: the draft plus the
+ fixed tail lands in a new conversation with the Project's default agent, which runs the
+ agent-initialization skill. The list reloads on every mount, so the new agent's card is
+ there when the page is next visited. */}
+ <AiCreateModal
+ open={aiOpen}
+ onClose={() => setAiOpen(false)}
+ title={S.agent.aiCreateTitle}
+ intro={S.agent.aiCreateIntro}
+ placeholder={S.agent.aiCreatePlaceholder}
+ examples={S.agent.aiExamples}
+ tail={S.agent.aiCreateTail}
+ agents={agents}
+ />
+
{/* Bulk kernel update confirmation. The body is the per-Agent confirm's own wording,
verbatim — a kernel update is a smart merge that advances the settings tabs the user
has not touched and leaves the customized ones whole — with the list naming every
diff --git a/packages/web/src/features/agents/vault-tab.tsx b/packages/web/src/features/agents/vault-tab.tsx
index 9632e22d..1eb51717 100644
--- a/packages/web/src/features/agents/vault-tab.tsx
+++ b/packages/web/src/features/agents/vault-tab.tsx
@@ -29,6 +29,8 @@ import { SkeletonList } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { usePromptInjection } from "./prompt-injection-controls";
import { HelpFold } from "../../components/ui/help-fold";
+import { toneStrip } from "../../lib/tone";
+import { AiCreateModal, CreateButtons } from "../ai-create";
/** Vault key naming rule (consistent with core/server): shell environment variable name. */
const VAULT_KEY_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -41,7 +43,7 @@ export function VaultTab({
/** Config writes (toggle / prompt / placeholder insert) happen here directly, so the settings page must refetch its own copy — otherwise a later Prompt-tab save from stale data would silently revert them. */
onConfigChanged?: () => void;
}) {
- const { currentProject, reloadAgents } = useProject();
+ const { currentProject, agents, reloadAgents } = useProject();
const projectId = currentProject?.projectId ?? null;
const isOwner = currentProject?.role === "owner";
// Prompt-injection controls follow the tab's existing gate: owner-only edits.
@@ -59,6 +61,8 @@ export function VaultTab({
const [busy, setBusy] = useState(false);
// Add modal: form state and per-field errors travel with the modal (a tab-level error would be hidden behind it).
const [adding, setAdding] = useState(false);
+ /** "Add with AI" dialog: its prompt goes to the Project's default agent, naming this agent as the target. */
+ const [aiAdding, setAiAdding] = useState(false);
const [keyInput, setKeyInput] = useState("");
const [valueInput, setValueInput] = useState("");
const [addErrors, setAddErrors] = useState<{ key?: string; value?: string }>({});
@@ -214,11 +218,15 @@ export function VaultTab({
</div>
)}
- {/* Add entry point (owner): the form lives in a modal; submitting the same key name overwrites the original value. */}
+ {/* Add entry points (owner): two separate buttons. The manual one opens the form in a modal
+ (submitting the same key name overwrites the original value), the AI one the prompt. */}
{isOwner && entries !== null && (
- <Button size="sm" variant="primary" disabled={busy} onClick={openAdd}>
- {S.vault.add}
- </Button>
+ <CreateButtons
+ size="sm"
+ disabled={busy}
+ onAi={() => setAiAdding(true)}
+ onManual={openAdd}
+ />
)}
{promptSection}
@@ -273,6 +281,25 @@ export function VaultTab({
</div>
</Modal>
+ {/* The AI path. Its lead is an honest warning: a value typed into the prompt is recorded in
+ the conversation's Trace, whereas a value typed into the form never leaves the vault. The
+ dialog's one exit already agrees with that warning — the prompt lands in a composer and is
+ read once more before anything carries it to a provider. */}
+ <AiCreateModal
+ open={aiAdding}
+ onClose={() => setAiAdding(false)}
+ title={S.vault.aiAddTitle}
+ intro={
+ <div className={`rounded-md border px-2.5 py-1.5 ${toneStrip.attention}`}>
+ {S.vault.aiAddIntro}
+ </div>
+ }
+ placeholder={S.vault.aiAddPlaceholder}
+ examples={S.vault.aiAddExamples}
+ tail={S.vault.aiAddTail(agentId, projectId)}
+ agents={agents}
+ />
+
{/* Overwrite confirmation: the add modal stays underneath, so cancel returns to the form. */}
<ConfirmModal
open={overwriting !== null}
diff --git a/packages/web/src/features/ai-create/create-buttons.tsx b/packages/web/src/features/ai-create/create-buttons.tsx
index d2b6dd61..2fb736c1 100644
--- a/packages/web/src/features/ai-create/create-buttons.tsx
+++ b/packages/web/src/features/ai-create/create-buttons.tsx
@@ -18,7 +18,14 @@ export interface CreateButtonsProps {
/** Labels when the object has its own verb ("Import with AI" / "Import manually"); default S.aiCreate.withAi / S.aiCreate.manual. */
aiLabel?: string;
manualLabel?: string;
+ /** Greys both paths. */
disabled?: boolean;
+ /**
+ * Greys the manual path alone — for a surface whose form needs data it failed to load. The AI
+ * path stays live on purpose: it only composes a prompt and opens a conversation, and that
+ * conversation is often what repairs the configuration the failed load was reading.
+ */
+ manualDisabled?: boolean;
className?: string;
}
@@ -29,6 +36,7 @@ export function CreateButtons({
aiLabel,
manualLabel,
disabled,
+ manualDisabled,
className,
}: CreateButtonsProps) {
return (
@@ -38,7 +46,12 @@ export function CreateButtons({
{aiLabel ?? S.aiCreate.withAi}
</Button>
{onManual !== undefined && (
- <Button size={size} variant="secondary" disabled={disabled} onClick={onManual}>
+ <Button
+ size={size}
+ variant="secondary"
+ disabled={disabled === true || manualDisabled === true}
+ onClick={onManual}
+ >
<GlyphIcon d={HAND_ICON} />
{manualLabel ?? S.aiCreate.manual}
</Button>
diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsx
index 96434423..dafb33bb 100644
--- a/packages/web/src/features/models/models-page.tsx
+++ b/packages/web/src/features/models/models-page.tsx
@@ -66,6 +66,7 @@ import { ConfirmModal } from "../../components/ui/confirm-modal";
import { Segmented } from "../../components/ui/segmented";
import { Select } from "../../components/ui/select";
import { Switch } from "../../components/ui/switch";
+import { AiCreateModal, CreateButtons } from "../ai-create";
import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
import { Chevron } from "../../components/ui/chevron";
import { GlyphIcon } from "../../components/ui/glyph-icon";
@@ -634,7 +635,7 @@ const DRAG_POINTER_QUERY = "(hover: hover) and (pointer: fine)";
export function ModelsPage() {
useDocumentTitle(S.models.title);
- const { currentProject } = useProject();
+ const { currentProject, agents } = useProject();
const projectId = currentProject?.projectId ?? null;
const isOwner = currentProject?.role === "owner";
/** The Models trail's raised badge, or undefined — the header's two marks appear with it. */
@@ -710,6 +711,8 @@ export function ModelsPage() {
const [deleteGroupFor, setDeleteGroupFor] = useState<string | null>(null);
/** "Add group" popup (user-defined group): create-only hands off to that group's add-model dialog, import mode fills the group from its endpoint (see AddGroupDialog). */
const [addGroupOpen, setAddGroupOpen] = useState(false);
+ /** "Add models with AI" dialog: the prompt goes to the Project's default agent. */
+ const [aiAddOpen, setAiAddOpen] = useState(false);
/** Initial load failure: shown inline only when the whole page has no content (there's no context to pop a toast against). */
const [loadError, setLoadError] = useState<string | null>(null);
const [busy, setBusy] = useState(false);
@@ -1027,9 +1030,10 @@ export function ModelsPage() {
<InfoPopover label={S.models.title}>{S.models.readOnlyHint}</InfoPopover>
)}
</h1>
- {/* The header holds search plus the owner-only "sync presets" action (add-model
- entry points live in each group header); on narrow screens (flex-wrap wraps it
- to its own line) the search box shrinks flexibly, fixed width at >=sm. */}
+ {/* The header holds search, the owner-only "sync presets" action and the pair of
+ create buttons — the AI path and the group form, offered side by side (per-model
+ entry points still live in each group header); on narrow screens (flex-wrap wraps
+ it to its own line) the search box shrinks flexibly, fixed width at >=sm. */}
<div className="flex min-w-0 max-w-full grow items-center gap-2 sm:grow-0">
<div className="min-w-0 flex-1 sm:w-56 sm:flex-none">
<Input
@@ -1058,6 +1062,17 @@ export function ModelsPage() {
<span className="sr-only"> · {syncNote}</span>
</Button>
)}
+ {isOwner && (
+ <CreateButtons
+ size="sm"
+ // Only the form needs the table: AddGroupDialog is mounted behind `rows`, so
+ // without it the manual button would be a dead click. The AI path is left live
+ // precisely because a failed load is one of the things it can repair.
+ manualDisabled={rows === null}
+ onAi={() => setAiAddOpen(true)}
+ onManual={() => setAddGroupOpen(true)}
+ />
+ )}
</div>
</div>
{/* Last stop on the Models trail, in the one shape all four dismissible trails use:
@@ -1508,6 +1523,22 @@ export function ModelsPage() {
</div>
</Modal>
)}
+ {/* The AI path for what the group import cannot read: a listing page that is not an
+ OpenAI-compatible /models endpoint, or a service described in words. The table reloads
+ on every mount, so the group the agent adds is there when the page is next visited. */}
+ {projectId !== null && (
+ <AiCreateModal
+ open={aiAddOpen}
+ onClose={() => setAiAddOpen(false)}
+ title={S.models.aiAddTitle}
+ intro={S.models.aiAddIntro}
+ placeholder={S.models.aiAddPlaceholder}
+ examples={S.models.aiAddExamples}
+ tail={S.models.aiAddTail(projectId)}
+ agents={agents}
+ />
+ )}
+
{rows && addGroupOpen && (
<AddGroupDialog
projectId={projectId}
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index 0534bdd5..c99c3eea 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -628,6 +628,57 @@ export const en: Strings = {
createSnapshotSkillsOff:
"The snapshot package carries its own skills and hooks, so plugin seeding is unavailable.",
createSnapshotClear: "Remove the selected package",
+ aiCreateTitle: "Create an agent with AI",
+ aiCreateIntro:
+ "Describe what the agent does, for whom, and what it produces; the agent doing the work uses the agent-initialization skill to create it in the current Project.",
+ aiCreatePlaceholder: "e.g. Create an agent that turns my meeting recordings into to-do lists…",
+ aiExamples: [
+ {
+ key: "jotting",
+ label: "Jotting agent",
+ description: "Fragments of thought filed into a Markdown file system",
+ prompt:
+ "Create a jotting agent: I will keep sending it fragments of thoughts and half-sentences, and it organizes them into a Markdown file system in the Workspace (one file per topic, an index file it maintains, duplicates merged, a timeline kept), replying after each message with where it filed the content.",
+ },
+ {
+ key: "finance",
+ label: "Financial Copilot",
+ description: "Fundamentals and valuation from filings, quotes and news",
+ prompt:
+ "Create a financial Copilot agent: it reads the filings, market data and news links I give it, does fundamental and valuation analysis, presents conclusions as tables and bullet points, flags uncertainty and cites data sources, and never gives direct buy or sell advice.",
+ },
+ {
+ key: "rag",
+ label: "Document RAG agent",
+ description: "Indexes docs/ first, then answers with citations",
+ prompt:
+ "Create a document Q&A agent: I will put material into the Workspace's docs/ directory; it first builds an index (a summary per file and section), cites the specific file and passage in every answer, and says plainly that it does not know when the material gives no basis for an answer.",
+ },
+ {
+ key: "research",
+ label: "Deep research report agent",
+ description: "Outline, multi-round search, cross-checked, a cited report",
+ prompt:
+ "Create a deep research report agent: given a topic, it first drafts a research outline, then searches and reads sources over several rounds and cross-checks the facts, and finally writes a Markdown report in the Workspace with a table of contents, citations and appendices.",
+ },
+ {
+ key: "report-writer",
+ label: "Report-writing agent",
+ description: "Structured reports from loose material; id report-writer",
+ prompt:
+ "Create a report-writing agent with the agent id report-writer: it turns loose material into structured business or technical reports (summary, background, analysis, conclusions and recommendations), produces Markdown files, and attaches a writing checklist.",
+ },
+ ],
+ aiCreateTail: [
+ "Use the agent-initialization skill to create a new agent in the current Project from the description above:",
+ "- Use the agent id given above if there is one; otherwise pick a short semantic id (starting with a lowercase letter; letters, digits, underscores or hyphens). If the target directory already exists, stop and tell me instead of overwriting it.",
+ "- Start from default_agent's system_config.yaml, set its name, description and version, and write the role and rules into its agent_state/AGENTS.md.",
+ "- Copy only the skills it really needs from the plugin library (the skill directories default_agent carries); do not over-equip it.",
+ "- Do not touch any other agent; run the skill's validation when done.",
+ "Finish by telling me the new agent's id, the skills you installed, and how to start a conversation with it (the New chat button on its card on the Agents page).",
+ ].join("\n"),
+ firstAgentTitle: "No agent of your own yet",
+ firstAgentDesc: "Describe the agent you want and let AI create it — or set one up manually.",
sessionCount: (n: number): string => `${n} session${n === 1 ? "" : "s"}`,
toolCount: (n: number): string => `${n} tool${n === 1 ? "" : "s"}`,
vaultKeyCount: (n: number): string => `${n} vault key${n === 1 ? "" : "s"}`,
@@ -899,6 +950,51 @@ export const en: Strings = {
syncDone: (added: number, updated: number) =>
`Presets synced: ${added} added, ${updated} updated`,
syncUpToDate: "Presets are already up to date",
+ aiAddTitle: "Add a model group with AI",
+ aiAddIntro:
+ "Hand the agent a model listing page or a description of the service, and it adds the models as one group with penguin config commands. For an OpenAI-compatible endpoint that lists its own models, Add group → Import models is faster.",
+ aiAddPlaceholder:
+ "Paste the URL of a model listing page, or describe the service to connect (gateway URL, authentication, model ids)…",
+ aiAddExamples: [
+ {
+ key: "openrouter",
+ label: "OpenRouter's popular models",
+ description: "Reads the listing page, adds one group",
+ prompt:
+ "Add the popular models on https://openrouter.ai/models as an OpenRouter group (ask me for the API key first).",
+ },
+ {
+ key: "vllm",
+ label: "A self-hosted vLLM server",
+ description: "OpenAI-compatible endpoint plus a model id",
+ prompt:
+ "Connect my self-hosted vLLM server at http://10.0.0.5:8000/v1, model id qwen3-32b, as a vllm group.",
+ },
+ {
+ key: "ollama",
+ label: "Local Ollama",
+ description: "Adds the models already pulled locally",
+ prompt:
+ "Add the models already available on my local Ollama (http://localhost:11434) as an ollama group.",
+ },
+ {
+ key: "deepseek",
+ label: "DeepSeek's official model",
+ description: "Into the deepseek group, set as the default",
+ prompt:
+ "Add DeepSeek's official deepseek-v4-pro to the deepseek group and make it the default model.",
+ },
+ ],
+ aiAddTail: (projectId: string): string =>
+ [
+ "Use the penguin-config skill for the configuration above:",
+ "- Every command below carries `--root <data root>`, the parent directory of the App Data Dir in your Environment section. Your command environment does not name that root, so a command without `--root` configures a different one and nothing reaches this Project.",
+ `- Run \`penguin config model add --provider <group> --model-id <upstream id> --project-id ${projectId} --root <data root> [--base-url <endpoint>] [--client-type openai] [--api-key <key>] [--context-window <n>] [--price-cache-read <n> --price-cache-write <n> --price-output <n>]\` once per model: \`--provider\` is mandatory, \`--model-id\` takes the gateway's own model id, and an OpenAI-compatible endpoint gets \`--client-type openai --base-url <endpoint>\`.`,
+ "- When the source is a web page, fetch it first: add the models I named, or the most popular ones when I named none, about 10 at most.",
+ "- When an API key is needed and I did not give one, ask me once; if I do not provide it, leave the key empty and tell me to fill it in on the Models page.",
+ "- Never read or edit .project_config.toml; configuration goes through penguin commands only.",
+ `- Finish with \`penguin config model list --project-id ${projectId} --root <data root>\` and show me the result.`,
+ ].join("\n"),
homepage: "Model page",
speedTest: "Speed test",
speedTestTitle: "Speed test",
@@ -1191,6 +1287,41 @@ export const en: Strings = {
keyHint: "Letters, digits and underscores; must not start with a digit",
keyInvalid: "Invalid name: only letters, digits and underscores, not starting with a digit",
valueRequired: "Value must not be empty",
+ aiAddTitle: "Add secrets with AI",
+ aiAddIntro:
+ "A secret value typed here is sent to the model provider, recorded in the conversation's Trace, and shown again in the command the agent runs. The safer way is to let AI create only the key names and tell you what each is for, then fill in the values in the vault by hand.",
+ aiAddPlaceholder: "Ask which API keys this agent needs, or name the keys to create…",
+ aiAddExamples: [
+ {
+ key: "audit",
+ label: "Find the keys this agent needs",
+ description: "Key names now, values filled in by hand",
+ prompt:
+ "Check which API keys this agent's installed skills need, create the key names now, and tell me what each one is for and where to apply for it — I will fill in the values in the vault myself.",
+ },
+ {
+ key: "rotate",
+ label: "Reset an expired token",
+ description: "Clears the value; you paste the new one",
+ prompt:
+ "GH_TOKEN has expired. Reset it to a placeholder value and tell me where to issue a new one — I will paste the new token in the vault myself.",
+ },
+ {
+ key: "endpoint",
+ label: "Connect an internal service",
+ description: "Address set now, token left for you",
+ prompt:
+ "This agent will call our internal Gitea at https://git.example.com. Set GITEA_BASE_URL to that address, create GITEA_TOKEN with a placeholder value, and tell me where to issue the token.",
+ },
+ ],
+ aiAddTail: (agentId: string, projectId: string): string =>
+ [
+ `Use the penguin-config skill to write the secrets above into the vault of agent ${agentId} (Project ${projectId}):`,
+ "- Every command below carries `--root <data root>`, the parent directory of the App Data Dir in your Environment section. Your command environment does not name that root, so a command without `--root` writes into a different one and this agent's vault stays empty.",
+ `- Run \`penguin config vault set --key <NAME> --value <value> --agent-id ${agentId} --project-id ${projectId} --root <data root>\` once per secret; when only the key name is wanted, store the placeholder value TODO and tell me what the key is for and where to apply for it.`,
+ "- Never repeat a value back in your reply, and never read .vault.toml.",
+ `- Finish with \`penguin config vault list --agent-id ${agentId} --project-id ${projectId} --root <data root>\` to list the key names.`,
+ ].join("\n"),
/** Prompt-injection controls (toggle card / template alert / prompt editor), mirroring the memory tab's set. */
injection: {
enable: "Enable vault",
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index bac32e3b..3fd027bb 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -626,6 +626,65 @@ export const zh = {
"选择导出的 Agent State 快照包(.tar.gz),新 Agent 以包内状态创建;名称与描述留空则沿用包内值",
createSnapshotSkillsOff: "快照包自带技能与钩子,与插件选择互斥",
createSnapshotClear: "移除已选快照包",
+ /**
+ * The "Create with AI" dialog, a separate surface from the create form above: its title, the
+ * lead line, the prompt box's placeholder, the clickable examples and the fixed instruction
+ * tail joined after the draft (composeAiPrompt). The tail follows the agent-initialization
+ * skill's contract — a new agent under the current Project, only the skills it needs, no
+ * other agent touched, the id reported at the end.
+ */
+ aiCreateTitle: "用 AI 创建 Agent",
+ aiCreateIntro:
+ "描述这个智能体要做什么、面向谁、产出什么;执行的智能体会用 agent-initialization 技能在当前 Project 里创建它。",
+ aiCreatePlaceholder: "例如:创建一个帮我把会议录音整理成待办清单的智能体…",
+ aiExamples: [
+ {
+ key: "jotting",
+ label: "随记智能体",
+ description: "零碎想法整理成一套 Markdown 文件体系",
+ prompt:
+ "创建一个随记智能体:我会不断向它发送零碎的想法和只言片语,它要在工作区里把这些内容整理成一套 Markdown 文件体系(按主题建文件、维护一个索引文件、合并重复内容、保留时间线),每次收到内容后回复归档到了哪个文件。",
+ },
+ {
+ key: "finance",
+ label: "金融 Copilot",
+ description: "财报、行情与新闻的基本面与估值分析",
+ prompt:
+ "创建一个金融 Copilot 智能体:能读取我提供的财报、行情数据与新闻链接,做基本面与估值分析,用表格与要点输出结论,标注不确定性与数据来源,不给出直接的买卖建议。",
+ },
+ {
+ key: "rag",
+ label: "文档 RAG 智能体",
+ description: "先给 docs/ 建索引,回答时引用出处",
+ prompt:
+ "创建一个文档问答智能体:我会把资料放进工作区的 docs/ 目录,它要先建立索引(按文件与章节写摘要),回答问题时引用具体文件与段落,没有依据时明确说不知道。",
+ },
+ {
+ key: "research",
+ label: "深度研究报告智能体",
+ description: "提纲、多轮检索与交叉验证,产出带引用的报告",
+ prompt:
+ "创建一个深度研究报告智能体:给定一个课题,它要先制定研究提纲,多轮检索与阅读资料并交叉验证事实,最后在工作区生成一份带目录、引用与附录的 Markdown 报告。",
+ },
+ {
+ key: "report-writer",
+ label: "报告写作智能体",
+ description: "零散材料整理成结构化报告;id 为 report-writer",
+ prompt:
+ "创建一个报告写作智能体,agent id 用 report-writer:擅长把零散材料整理成结构化的商业或技术报告(摘要、背景、分析、结论与建议),产出 Markdown 文件,并附一份写作检查清单。",
+ },
+ ],
+ aiCreateTail: [
+ "请使用 agent-initialization 技能,在当前 Project 中按上面的描述新建一个智能体:",
+ "- 上面给了 agent id 就用它,否则取一个简短的语义 id(小写字母开头,可含数字、下划线或连字符);目标目录已存在时停下来告诉我,不要覆盖。",
+ "- 以 default_agent 的 system_config.yaml 为底,设置它的 name、description 与 version,把角色与行为规则写进它的 agent_state/AGENTS.md。",
+ "- 只从插件库(default_agent 已安装的技能目录)复制它真正需要的技能,不要多装。",
+ "- 不要改动其他智能体;完成后按技能要求做校验。",
+ "最后告诉我:新智能体的 id、安装了哪些技能,以及怎样开始和它对话(Agents 页该智能体卡片上的「新建对话」)。",
+ ].join("\n"),
+ /** The list's call to action while the Project has no agent beyond the built-in default. */
+ firstAgentTitle: "还没有自己的智能体",
+ firstAgentDesc: "描述你想要的智能体,让 AI 帮你创建;也可以手动配置。",
sessionCount: (n: number): string => `${n} 个 Session`,
toolCount: (n: number): string => `${n} 个工具`,
vaultKeyCount: (n: number): string => `${n} 个密钥`,
@@ -872,6 +931,57 @@ export const zh = {
"用内置目录更新预置模型:新增缺失条目、以目录字段为准刷新差异;本地新增模型与 API key 保持不变",
syncDone: (added: number, updated: number) => `预置模型已同步:新增 ${added}、更新 ${updated}`,
syncUpToDate: "预置模型已是最新",
+ /**
+ * The header's "Create with AI" entry: the dialog's title and lead, the prompt box's
+ * placeholder, the examples and the fixed instruction tail. The tail
+ * follows the penguin-config skill — one `penguin config model add` per model with
+ * `--provider` mandatory, the config file never touched by hand, `penguin config model list`
+ * at the end — and carries the Project id and the data root, which the CLI would otherwise
+ * take from its own defaults (the harness strips `PENGUIN_HOME` from a command's
+ * environment, so the CLI's default root is not the one the server runs on).
+ */
+ aiAddTitle: "让 AI 添加模型分组",
+ aiAddIntro:
+ "把模型列表页的链接或服务信息交给智能体,它会用 penguin config 命令把这些模型加为一个分组。能直接列出模型的 OpenAI 兼容端点,用「新增分组 → 导入模型」更快。",
+ aiAddPlaceholder: "粘贴模型列表页的 URL,或描述要接入的服务(网关地址、鉴权方式、模型 id)…",
+ aiAddExamples: [
+ {
+ key: "openrouter",
+ label: "OpenRouter 热门模型",
+ description: "读取模型列表页,加为一个分组",
+ prompt:
+ "把 https://openrouter.ai/models 上的热门模型加为一个 OpenRouter 分组(先问我要 API key)。",
+ },
+ {
+ key: "vllm",
+ label: "自建 vLLM 服务",
+ description: "OpenAI 兼容端点加指定的模型 id",
+ prompt:
+ "接入我自建的 vLLM 服务 http://10.0.0.5:8000/v1,模型 id 为 qwen3-32b,加为一个 vllm 分组。",
+ },
+ {
+ key: "ollama",
+ label: "本机 Ollama",
+ description: "把本机已有的模型加为一组",
+ prompt: "把本机 Ollama(http://localhost:11434)上已有的模型加为一个 ollama 分组。",
+ },
+ {
+ key: "deepseek",
+ label: "DeepSeek 官方模型",
+ description: "加进 deepseek 分组并设为默认",
+ prompt: "把 DeepSeek 官方的 deepseek-v4-pro 加进 deepseek 分组并设为默认模型。",
+ },
+ ],
+ aiAddTail: (projectId: string): string =>
+ [
+ "请使用 penguin-config 技能完成上面的配置:",
+ "- 下面每条命令都要带 `--root <数据根目录>`,即环境信息中 App Data Dir 的上级目录。命令的环境里没有这个值,不带 `--root` 会配置到另一个数据根目录,本 Project 什么也拿不到。",
+ `- 每个模型执行一次 \`penguin config model add --provider <分组名> --model-id <上游模型 id> --project-id ${projectId} --root <数据根目录> [--base-url <端点>] [--client-type openai] [--api-key <key>] [--context-window <n>] [--price-cache-read <n> --price-cache-write <n> --price-output <n>]\`:\`--provider\` 必填,\`--model-id\` 用网关自己的模型 id;OpenAI 兼容端点加 \`--client-type openai --base-url <端点>\`。`,
+ "- 来源是网页时先抓取页面:优先加我点名的模型,没有点名就选最常用的,最多 10 个左右。",
+ "- 需要 API key 而我没给时只问我一次;我不提供就把 key 留空,并告诉我到模型库页补填。",
+ "- 不要读取或改动 .project_config.toml,配置只经 penguin 命令。",
+ `- 最后运行 \`penguin config model list --project-id ${projectId} --root <数据根目录>\` 把结果列给我。`,
+ ].join("\n"),
homepage: "模型主页",
speedTest: "测速",
speedTestTitle: "分组测速",
@@ -1180,6 +1290,50 @@ export const zh = {
keyHint: "字母、数字与下划线,不能以数字开头",
keyInvalid: "键名不合法:仅字母、数字与下划线,且不能以数字开头",
valueRequired: "值不能为空",
+ /**
+ * The tab's "add with AI" entry: the dialog's title and lead (an honest warning — a value
+ * typed into the prompt reaches the provider, the Trace and the agent's own command line),
+ * the prompt box's placeholder, the examples and the fixed instruction tail. The examples obey
+ * that lead: the key-names-only ask comes first and none of them puts a secret in the prompt,
+ * both pinned by create-with-ai-surfaces.test.ts. The tail is fed the target agent and Project
+ * because the prompt goes to the Project's default agent, which is not necessarily the agent
+ * whose vault this is; it names the data root for the same reason the models tail does.
+ */
+ aiAddTitle: "让 AI 添加密钥",
+ aiAddIntro:
+ "写进提示词的密钥值会发给模型服务商、写入对话记录(Trace),还会出现在智能体执行的命令里。更稳妥的做法是让 AI 只创建键名并告诉你用途,值在保险柜里手动填写。",
+ aiAddPlaceholder: "让它检查这个智能体需要哪些 API key,或说明要建哪些键名…",
+ aiAddExamples: [
+ {
+ key: "audit",
+ label: "盘点这个智能体需要的 key",
+ description: "先建键名,值稍后手动填",
+ prompt:
+ "检查这个智能体已安装的技能需要哪些 API key,先把键名建好,并逐个告诉我用途和申请地址——值我自己在保险柜里填。",
+ },
+ {
+ key: "rotate",
+ label: "重置一个过期 token",
+ description: "把值清成占位符,新值手动填",
+ prompt:
+ "GH_TOKEN 已经过期,把它重置为占位值,并告诉我去哪里申请新的——新 token 我自己在保险柜里填。",
+ },
+ {
+ key: "endpoint",
+ label: "接入一个内部服务",
+ description: "地址直接写入,token 留给你填",
+ prompt:
+ "这个智能体要访问我们内部的 Gitea(https://git.example.com)。把 GITEA_BASE_URL 设为该地址,GITEA_TOKEN 先用占位值创建,并告诉我去哪里签发 token。",
+ },
+ ],
+ aiAddTail: (agentId: string, projectId: string): string =>
+ [
+ `请使用 penguin-config 技能,把上面的密钥写进智能体 ${agentId} 的保险柜(Project ${projectId}):`,
+ "- 下面每条命令都要带 `--root <数据根目录>`,即环境信息中 App Data Dir 的上级目录。命令的环境里没有这个值,不带 `--root` 会写到另一个数据根目录,这个智能体的保险柜仍然是空的。",
+ `- 每个密钥执行一次 \`penguin config vault set --key <键名> --value <值> --agent-id ${agentId} --project-id ${projectId} --root <数据根目录>\`;只需创建键名时,值先填占位符 TODO,并告诉我该键的用途与申请地址。`,
+ "- 不要在回复里复述任何值,不要读取 .vault.toml。",
+ `- 最后运行 \`penguin config vault list --agent-id ${agentId} --project-id ${projectId} --root <数据根目录>\` 列出键名。`,
+ ].join("\n"),
/** Prompt-injection controls (toggle card / template alert / prompt editor), mirroring the memory tab's set. */
injection: {
enable: "启用密钥保险柜",
diff --git a/packages/web/test/create-with-ai-surfaces.test.ts b/packages/web/test/create-with-ai-surfaces.test.ts
new file mode 100644
index 00000000..3da57bdd
--- /dev/null
+++ b/packages/web/test/create-with-ai-surfaces.test.ts
@@ -0,0 +1,103 @@
+/**
+ * The prompt material of the three "Create with AI" surfaces — the Agents page's create dialog,
+ * the Models page's add dialog and the Vault tab's add dialog: in both dictionaries each offers
+ * examples that fill the draft and a fixed tail naming the skill the receiving agent must use;
+ * the tail follows the draft when composed the way the dialogs compose it; and the parameterized
+ * tails carry the ids they are fed, since the prompt goes to the Project's default agent rather
+ * than the target. Both CLI tails also name `--root`: the harness strips `PENGUIN_HOME` from a
+ * command's environment, so a `penguin config` call without it configures another data root.
+ *
+ * The vault's cards additionally have to agree with the warning printed above them, so the
+ * key-names-only ask leads and no card hands the user a secret-shaped placeholder to fill.
+ */
+import { describe, expect, it } from "vitest";
+import { zh } from "../src/lib/strings";
+import { en } from "../src/lib/strings-en";
+import { composeAiPrompt } from "../src/features/ai-create/ai-create-prompt";
+import type { AiExample } from "../src/features/ai-create/ai-create-panel";
+
+/** Every example fills the draft with something, and no two share a key (React keys, and the selected-state match). */
+function expectUsableExamples(examples: AiExample[]): void {
+ expect(examples.length).toBeGreaterThan(0);
+ expect(new Set(examples.map((e) => e.key)).size).toBe(examples.length);
+ for (const example of examples) {
+ expect(example.label.trim()).not.toBe("");
+ expect(example.prompt.trim()).not.toBe("");
+ }
+}
+
+/**
+ * Per-dictionary assertions run twice over; this one compares the two, which the per-dictionary
+ * block cannot see: a card added to one language only would pass every check above.
+ */
+it("offers the same example cards in both dictionaries", () => {
+ expect(en.agent.aiExamples.map((e) => e.key)).toEqual(zh.agent.aiExamples.map((e) => e.key));
+ expect(en.models.aiAddExamples.map((e) => e.key)).toEqual(
+ zh.models.aiAddExamples.map((e) => e.key),
+ );
+ expect(en.vault.aiAddExamples.map((e) => e.key)).toEqual(
+ zh.vault.aiAddExamples.map((e) => e.key),
+ );
+});
+
+describe.each([
+ ["zh", zh],
+ ["en", en],
+] as const)("%s dictionary", (_locale, dict) => {
+ it("offers examples on every surface", () => {
+ expectUsableExamples(dict.agent.aiExamples);
+ expectUsableExamples(dict.models.aiAddExamples);
+ expectUsableExamples(dict.vault.aiAddExamples);
+ });
+
+ it("leads the vault examples with the key-names-only ask, and never asks for a pasted secret", () => {
+ // The dialog's intro recommends letting AI create the key names and filling the values in by
+ // hand; the first card is the one a scanning eye reads as the default, so it must be that ask.
+ const examples = dict.vault.aiAddExamples;
+ expect(examples[0]?.key).toBe("audit");
+ for (const example of examples) {
+ // `<paste key>` / `<新 token>`: the placeholder shape that tells the user to put a secret
+ // into the prompt, which is exactly what the intro above the cards warns against.
+ expect(example.prompt).not.toMatch(/<[^>]+>/);
+ // Two-line card, as on the sibling surfaces.
+ expect(example.description?.trim()).toBeTruthy();
+ }
+ });
+
+ it("ends the agent prompt with a tail that runs agent-initialization, and seeds the onboarding agent by id", () => {
+ const tail = dict.agent.aiCreateTail;
+ expect(tail).toContain("agent-initialization");
+ expect(tail).toContain("AGENTS.md");
+ const prompt = composeAiPrompt("Create a jotting agent", tail);
+ expect(prompt.startsWith("Create a jotting agent\n\n")).toBe(true);
+ expect(prompt.endsWith(tail)).toBe(true);
+ const onboarding = dict.agent.aiExamples.find((e) => e.key === "report-writer");
+ expect(onboarding?.prompt).toContain("report-writer");
+ });
+
+ it("names the Project and the data root in the models tail, since the CLI would default both", () => {
+ const tail = dict.models.aiAddTail("alice-default_project");
+ expect(tail).toContain("penguin-config");
+ expect(tail).toContain("penguin config model add --provider");
+ expect(tail).toContain("--project-id alice-default_project");
+ expect(tail).toContain("penguin config model list");
+ // Every penguin invocation in the tail is rooted; the CLI's own default is not the
+ // server's root, because a command's environment carries no PENGUIN_HOME.
+ for (const line of tail.split("\n").filter((l) => l.includes("penguin config"))) {
+ expect(line).toContain("--root");
+ }
+ expect(composeAiPrompt("x", tail).endsWith(tail)).toBe(true);
+ });
+
+ it("names the target agent, the Project and the data root in the vault tail, and lists the keys at the end", () => {
+ const tail = dict.vault.aiAddTail("report-writer", "alice-default_project");
+ expect(tail).toContain("penguin config vault set");
+ expect(tail).toContain("--agent-id report-writer --project-id alice-default_project");
+ expect(tail).toContain("penguin config vault list");
+ expect(tail).toContain(".vault.toml");
+ for (const line of tail.split("\n").filter((l) => l.includes("penguin config"))) {
+ expect(line).toContain("--root");
+ }
+ expect(composeAiPrompt("x", tail).endsWith(tail)).toBe(true);
+ });
+});
diff --git a/plugins/agent-development/plugin.json b/plugins/agent-development/plugin.json
index 732c82b8..232fdaf4 100644
--- a/plugins/agent-development/plugin.json
+++ b/plugins/agent-development/plugin.json
@@ -3,6 +3,6 @@
"description_zh": "基于 PenguinHarness 的智能体开发:用 SDK 构建应用、经统一的 LLM API 调用任意模型、管理模型与密钥、编排智能体/会话/成本/定时任务。",
"short_description": "SDK, unified LLM API, config and orchestration.",
"short_description_zh": "SDK、统一 LLM API、配置与编排。",
- "version": "2026.09.10.1",
+ "version": "2026.09.14.1",
"category": "ai-app-development"
}
diff --git a/plugins/agent-development/skills/penguin-config/SKILL.md b/plugins/agent-development/skills/penguin-config/SKILL.md
index 5dae4a8e..2b501e27 100644
--- a/plugins/agent-development/skills/penguin-config/SKILL.md
+++ b/plugins/agent-development/skills/penguin-config/SKILL.md
@@ -28,7 +28,7 @@ penguin config model add --provider <group> --model-id <upstream_id> [--api-key
- `--vision` / `--no-vision` mark whether the model accepts images; omitting both keeps the current value (default is vision-capable).
- `--max-tokens <n>` pins a per-model output cap (positive integer), overriding the Agent's `model.max_tokens`; omit to inherit. Lower it for small-context models — the per-Agent default (32000) cannot fit into e.g. a 32k context window together with any prompt.
- All `penguin config model ...` and `penguin config vault ...` commands accept `--root <dir>` to target another data root (default `PENGUIN_HOME`, then `~/.penguin/data`). Two configuration targets — treat the difference as a hard rule:
- - **Penguin's own model** (self-configuration: the model Penguin itself runs on): the default root without `--root` is correct.
+ - **Penguin's own model** (self-configuration: the model Penguin itself runs on): pass `--root <data root>` as well — the parent directory of the App Data Dir named in your Environment section. An agent running inside PenguinHarness never sees `PENGUIN_HOME`: the harness strips every `PENGUIN_*` variable from a command's environment, so a command without `--root` falls back to `~/.penguin/data` and configures a root the running server does not read.
- **An AI app you are building**: `--root` **must** point at the app's own data directory inside the project (e.g. `--root ./penguin_data`, the same path the app gives `createAgent({ root })`) unless the user explicitly chose another location — never write an app's models or keys into the global `~/.penguin/data`, which belongs to the person running Penguin, not to the app.
- While developing an app, review regularly: `penguin config model list --root <app root>` should show the app's entries, and the global list (no `--root`) should stay clean.