fix: guide agent to a real public link instead of dead-ending on apps__create_app
Diagnosed via production session logs (RDS + shared goose PG) that some
users' page-generation attempts drifted: the agent used apps__create_app
(no public URL) then fabricated a placeholder domain when asked for a
link, and separately burned many turns scraping unreachable/anti-bot
search engines. Steer both flows toward the already-working path instead
of banning tools outright:
- apps__create_app is fine for designing/previewing a page, but the
agent must still write_file the result into public/*.html per the
static-page-publish skill and return a link built from the real
public URL template (no invented domains)
- for real-world lookups, load_skill('web') first and prefer
Bing/360 over retrying google.com or hammering anti-bot sites
Also folds in generate_docx guidance for Word-download attachments
(sandbox-fs tool) that landed in the same files during this pass.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -100,8 +100,11 @@ ${zoneLines.join('\n')}
|
||||
|
||||
- 用户要网页 / HTML / 报告 / 分享链接时:**你必须亲自完成**,不要推给用户手动操作
|
||||
- 先 \`load_skill\` → \`static-page-publish\`,再使用 \`write_file\` 创建 \`public/页面名.html\`(需要调整已有页面时用 \`edit_file\`)
|
||||
- 页面需要 Word / docx 下载时,必须用 sandbox-fs 的 \`generate_docx\` 写入 \`public/*.docx\`,不要用 shell/computercontroller 生成生产下载文件
|
||||
- 若用 \`apps__create_app\` 设计/预览页面:这一步只是在 Apps 窗口内创建交互式 App,**还没有公网链接**;必须紧接着按 \`static-page-publish\` skill 把最终内容 \`write_file\` 落到 \`public/*.html\`,才能给出真实可访问的链接
|
||||
- 写入 \`<head>\` 的 **mindspace-cover** 元数据(详见 \`.agents/skills/static-page-publish/SKILL.md\`)
|
||||
- 保存后立即给出 Markdown 可点击公网链接 \`[标题](URL)\`;写入 \`public/页面.html\` 时 URL 为 \`.../MindSpace/<用户ID>/public/页面.html\`
|
||||
- 给链接时按 \`static-page-publish\` skill 里的公网前缀模板拼接真实地址,不确定域名时用相对路径 \`public/xxx.html\` 说明,不要猜一个域名充数
|
||||
- **禁止**回复「请手动保存到 public 目录」「我无法生成页面」——除非 \`write_file\` / \`edit_file\` 调用已失败并说明具体错误
|
||||
|
||||
## 工作区文件与 OA 界面
|
||||
@@ -126,6 +129,8 @@ export function buildUserSpaceConstraints({ username, workspaceRoot, publicBaseU
|
||||
'- **禁止**:访问其它用户目录、MindSpace 根目录、data/mindspace 内部路径、主机绝对路径',
|
||||
'- **禁止**用公网 URL 列目录或读 CSV;生成 HTML 写入 `public/` 并给出公网链接',
|
||||
'- **生成页面**:先 `load_skill` → `static-page-publish`,再用 `write_file` / `edit_file` 写入 `public/*.html`;**禁止**让用户手动保存文件',
|
||||
'- 用 `apps__create_app` 设计页面时,最后一步仍要按 `static-page-publish` skill 把内容 `write_file` 落到 `public/*.html`,再给出下方前缀拼出的真实链接,不要停在 App 阶段就回复链接',
|
||||
'- **需要查实时/真实世界信息(如机构名单、新闻、行情)时**:先 `load_skill` → `web`,优先用其 `web_search`/`fetch_url`;国内环境下 google.com 不可达,`web_search` 多次无果时改走 Bing/360 等可达搜索源,避免对反爬站点反复硬抓',
|
||||
publicBaseUrl && slug
|
||||
? `- 公网 HTML 前缀(公开区):\`${publicBaseUrl}/${PUBLISH_ROOT_DIR}/${slug}/public/\`(写入 \`public/页面.html\` 时分享链接必须含 \`public/\`)`
|
||||
: null,
|
||||
|
||||
Reference in New Issue
Block a user