page-agent-sdk 1.1.1 → 1.1.2
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/README.md +7 -6
- package/README.zh-CN.md +7 -6
- package/package.json +1 -1
- package/skills/page-agent-sdk-release/SKILL.md +0 -44
package/README.md
CHANGED
|
@@ -257,26 +257,27 @@ CLAUDE.md # architecture + gotchas + coding conventions (a
|
|
|
257
257
|
|
|
258
258
|
## Skills for AI tools (for integrators)
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
A ready-to-use Agent Skill is bundled for integrators using Claude Code / Cursor (or any agent harness that loads `.claude/skills/` / `~/.claude/skills/`). It teaches the AI how to use **this SDK** in your project:
|
|
261
261
|
|
|
262
262
|
| Skill | When it triggers |
|
|
263
263
|
|---|---|
|
|
264
264
|
| `page-agent-sdk-integrate` | Embedding the SDK — choose install method, declare `windowProps` + zod schemas, configure the LLM, mount, subscribe to events (`onEvent` / `sdk.hook`), run headless, troubleshoot common pitfalls |
|
|
265
|
-
| `page-agent-sdk-release` | Releasing a new version (bump → build → test → push gitee/github → npm publish → verify) — for maintainers |
|
|
266
265
|
|
|
267
266
|
**Install** (pick one):
|
|
268
267
|
|
|
269
268
|
```bash
|
|
270
269
|
# Option A — copy from the installed npm package
|
|
271
270
|
npm i page-agent-sdk
|
|
272
|
-
cp -R node_modules/page-agent-sdk/skills/page-agent-sdk
|
|
271
|
+
cp -R node_modules/page-agent-sdk/skills/page-agent-sdk-integrate ~/.claude/skills/
|
|
273
272
|
|
|
274
273
|
# Option B — download from the repo (no install needed)
|
|
275
|
-
curl -L https://github.com/whyymj/chat-sdk/tarball/master | tar xz --strip-components=1 --wildcards '*/skills/page-agent-sdk
|
|
276
|
-
mv skills/page-agent-sdk
|
|
274
|
+
curl -L https://github.com/whyymj/chat-sdk/tarball/master | tar xz --strip-components=1 --wildcards '*/skills/page-agent-sdk-integrate'
|
|
275
|
+
mv skills/page-agent-sdk-integrate ~/.claude/skills/
|
|
277
276
|
```
|
|
278
277
|
|
|
279
|
-
After install, restart your AI tool; the
|
|
278
|
+
After install, restart your AI tool; the skill auto-triggers when you ask things like "add page-agent-sdk to my page".
|
|
279
|
+
|
|
280
|
+
> A second skill `page-agent-sdk-release` (release workflow for maintainers) is kept in the repo's `.claude/skills/` for project maintainers only and is **not** distributed via the npm package.
|
|
280
281
|
|
|
281
282
|
## Architecture
|
|
282
283
|
|
package/README.zh-CN.md
CHANGED
|
@@ -202,26 +202,27 @@ CLAUDE.md # 架构要点 + 约定坑 + 编码规范(agen
|
|
|
202
202
|
|
|
203
203
|
## 给 AI 工具使用者的 Skills(集成方安装)
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
内置一个开箱即用的 Agent Skill,供使用 Claude Code / Cursor(或任何加载 `.claude/skills/` / `~/.claude/skills/` 的 agent 工具)的集成方使用。它教 AI 如何在**你的项目**中使用本 SDK:
|
|
206
206
|
|
|
207
207
|
| Skill | 触发场景 |
|
|
208
208
|
|---|---|
|
|
209
209
|
| `page-agent-sdk-integrate` | 集成 SDK —— 选引入方式、声明 `windowProps` + zod schema、配 LLM、挂载、订阅事件(`onEvent` / `sdk.hook`)、跑 headless、排查常见坑 |
|
|
210
|
-
| `page-agent-sdk-release` | 发布新版本(bump → 构建 → 测试 → 推 gitee/github → 发 npm → 验证)—— 面向维护者 |
|
|
211
210
|
|
|
212
211
|
**安装**(任选其一):
|
|
213
212
|
|
|
214
213
|
```bash
|
|
215
214
|
# 方式 A —— 从已安装的 npm 包复制
|
|
216
215
|
npm i page-agent-sdk
|
|
217
|
-
cp -R node_modules/page-agent-sdk/skills/page-agent-sdk
|
|
216
|
+
cp -R node_modules/page-agent-sdk/skills/page-agent-sdk-integrate ~/.claude/skills/
|
|
218
217
|
|
|
219
218
|
# 方式 B —— 从仓库下载(无需安装)
|
|
220
|
-
curl -L https://github.com/whyymj/chat-sdk/tarball/master | tar xz --strip-components=1 --wildcards '*/skills/page-agent-sdk
|
|
221
|
-
mv skills/page-agent-sdk
|
|
219
|
+
curl -L https://github.com/whyymj/chat-sdk/tarball/master | tar xz --strip-components=1 --wildcards '*/skills/page-agent-sdk-integrate'
|
|
220
|
+
mv skills/page-agent-sdk-integrate ~/.claude/skills/
|
|
222
221
|
```
|
|
223
222
|
|
|
224
|
-
安装后重启 AI 工具;当你说「把 page-agent-sdk
|
|
223
|
+
安装后重启 AI 工具;当你说「把 page-agent-sdk 加到我的页面」等时 skill 自动触发。
|
|
224
|
+
|
|
225
|
+
> 另有 `page-agent-sdk-release`(维护者发布工作流)skill 仅保留在仓库 `.claude/skills/` 供项目维护者自用,**不**通过 npm 包公开分发。
|
|
225
226
|
|
|
226
227
|
## 架构
|
|
227
228
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "page-agent-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "框架无关的页面内 Agent JS SDK —— 以对话框形态挂载到任意网页,通过自定义 tool 读写宿主 window 属性(GET 抓文档),具备 planning/skills/虚拟工作区/快照回退/context 管理能力。Vue 打包进库,使用者无需安装 Vue。",
|
|
6
6
|
"main": "./dist/page-agent-sdk.umd.cjs",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: page-agent-sdk-release
|
|
3
|
-
description: Release a new version of the page-agent-sdk npm package and push to its two git remotes (Gitee + GitHub). Use when the user wants to publish/ship a new version, bump the version, build + test before release, push to gitee/github, or follow the project's release checklist. Covers the full flow: code changes → sync zh/en docs → bump semver → build + self-test → commit → push Gitee → push GitHub → npm publish → verify.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Release page-agent-sdk
|
|
7
|
-
|
|
8
|
-
Execute the project's release checklist end-to-end. The authoritative, detailed checklist lives in `CLAUDE.md` → "发布流程 checklist"; read that section first, then follow the steps below.
|
|
9
|
-
|
|
10
|
-
## Two remotes (do NOT mix them up)
|
|
11
|
-
|
|
12
|
-
| remote | URL | role |
|
|
13
|
-
|---|---|---|
|
|
14
|
-
| `origin` | gitee.com/whyymj/**chat-agent**.git | daily storage, keeps all granular commits |
|
|
15
|
-
| `github` | github.com/whyymj/**chat-sdk**.git | official open-source, receives curated commits |
|
|
16
|
-
|
|
17
|
-
Personal notes (`doc/待确认问题.md`) are gitignored — Gitee only, never GitHub.
|
|
18
|
-
|
|
19
|
-
## Release checklist (in order)
|
|
20
|
-
|
|
21
|
-
1. **Code**: edit `src/`, sync `types/index.d.ts` (hand-maintained), update exports in `src/core/index.ts`.
|
|
22
|
-
2. **Docs (sync zh + en, never single-side)**:
|
|
23
|
-
- `README.md` (en) / `README.zh-CN.md` (zh) — features, usage, scenarios
|
|
24
|
-
- `doc/README.md` (zh) / `doc/README.en.md` (en) — doc index
|
|
25
|
-
- `doc/usage-guide.md` (zh) / `doc/usage-guide.en.md` (en) — usage guide
|
|
26
|
-
- `CLAUDE.md` — internal dev guide/architecture
|
|
27
|
-
- Keep language toggle links bidirectional.
|
|
28
|
-
3. **Bump version**: `npm version patch|minor|major --no-git-tag-version` (semver: minor for new API, major for breaking, patch for fix). Never republish the same version.
|
|
29
|
-
4. **Build + self-test**: `npm run build` (= `build:lib` + `build:iife`) then `npm test` (341 assertions must pass). Run `npm pack --dry-run` to confirm the tarball excludes `.env` / `src` / `examples` / notes.
|
|
30
|
-
5. **Commit**: `git add -A && git commit -m "feat/fix/docs: ..."` (conventional style).
|
|
31
|
-
6. **Push Gitee** (daily storage): `git push origin master`. If you just rebased and rewrote history → `git push --force-with-lease origin master` (personal repo, safe).
|
|
32
|
-
7. **Push GitHub** (official): `git push github master`. If rejected as `non-fast-forward` → `git fetch github master && git pull --rebase github master` then push again.
|
|
33
|
-
8. **Publish to npm**: `npm publish` (`publishConfig.registry` is locked to the official npm registry, unaffected by the machine's default private registry).
|
|
34
|
-
9. **Verify**: `npm view page-agent-sdk version` (confirm latest) + a temp dir `npm i page-agent-sdk` to confirm it installs + imports.
|
|
35
|
-
|
|
36
|
-
## npm credentials gotchas
|
|
37
|
-
|
|
38
|
-
- Account `whyymj` has 2FA enabled. Use an **Automation Access Token** (npmjs.com → Access Tokens → Classic → Automation, bypasses OTP); write to user-level `~/.npmrc` via `npm config set //registry.npmjs.org/:_authToken <token> --location=user`. Revoke after use. Never commit tokens or store them in the project dir.
|
|
39
|
-
- `npm login` / `npm whoami` require `--registry=https://registry.npmjs.org/` (machine default may be a private registry).
|
|
40
|
-
|
|
41
|
-
## References
|
|
42
|
-
|
|
43
|
-
- `CLAUDE.md` → "发布流程 checklist" / "双远程仓库与发布约定" / "npm 发布约定" — authoritative details.
|
|
44
|
-
- `package.json` → `publishConfig`, `exports`, `files`, `peerDependencies`.
|