opencode-session-spawn 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -7
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,15 +22,17 @@ opencode 插件:**会话生成原语**。只做一件事——**创建一个
|
|
|
22
22
|
- 优先 `promptAsync`(异步 fire-and-forget,**不阻塞父会话**);缺失则回退同步 `prompt`。
|
|
23
23
|
- create 失败 → 不建会话;create 成功但注入失败 → **保留已建会话**并提示 id,不产生重复会话。
|
|
24
24
|
|
|
25
|
-
##
|
|
25
|
+
## 安装
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
在全局或项目 `opencode.json(c)` 的 `plugin` 数组注册包名,重启桌面版生效(opencode 自动拉取最新发布并装入包缓存):
|
|
28
28
|
|
|
29
|
-
```
|
|
30
|
-
|
|
29
|
+
```jsonc
|
|
30
|
+
{
|
|
31
|
+
"plugin": ["opencode-session-spawn"]
|
|
32
|
+
}
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
本地开发也可注册本地目录(opencode 按路径加载):把 `index.js` + `package.json` 复制到自选目录,在 `plugin` 中写该目录相对路径(如 `./plugins/session-spawn`)。
|
|
34
36
|
|
|
35
37
|
## 编排示例
|
|
36
38
|
|
|
@@ -60,12 +62,12 @@ npm install # 安装 devDependency @opencode-ai/plugin(唯一依赖
|
|
|
60
62
|
node test/test.mjs # 23 用例 / 62 断言
|
|
61
63
|
```
|
|
62
64
|
|
|
63
|
-
- `test/test.mjs` 默认经相对路径 `../index.js` 测项目版;环境变量 `RELAY_MAIN`
|
|
65
|
+
- `test/test.mjs` 默认经相对路径 `../index.js` 测项目版;环境变量 `RELAY_MAIN` 覆盖为其他路径(tarball 解包版 / 包缓存活实例)。`RELAY_MAIN` 目标须能向上解析到 `@opencode-ai/plugin`(解包放项目内即可)。
|
|
64
66
|
- 以尾部 `==== 结果: N 通过, 0 失败 ====` 为准。
|
|
65
67
|
|
|
66
68
|
## 发布
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
bump 版本号(`package.json` 与 `index.js` 头注释同步)→ `node test/test.mjs` 全绿 → `npm pack` 解包核对哈希 + `RELAY_MAIN` 回归全绿 → commit → push → `npm publish`(不打 git tag;先 `npm whoami` 确认登录态,凭据不入库)→ 重启桌面版实测 `@spawn` / `spawn_session`;实测不过修复补丁重发。详见 `AGENTS.md`。
|
|
69
71
|
|
|
70
72
|
## 历史
|
|
71
73
|
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tool } from "@opencode-ai/plugin/tool";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* session-spawn —— 会话生成原语(v2.1.
|
|
4
|
+
* session-spawn —— 会话生成原语(v2.1.1,2026-09-12 起支持 agent/directory)
|
|
5
5
|
*
|
|
6
6
|
* 只做一件事:创建一个新的顶层会话,并把起始语句注入为该会话首条消息。
|
|
7
7
|
* create: client.session.create({ body: { title }, query: { directory } })
|