cowork-flow 2.6.0 → 2.7.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/CHANGELOG.md +8 -1
- package/docs/hosts.en.md +4 -2
- package/docs/hosts.md +4 -2
- package/package.json +1 -1
- package/presets/claude-code/.claude-plugin/plugin.json +1 -1
- package/presets/codex/.codex-plugin/plugin.json +1 -1
- package/presets/kimi-code/.kimi-plugin/plugin.json +1 -1
- package/presets/qoder/.qoder-plugin/plugin.json +1 -1
- package/presets/zcode/.zcode-plugin/plugin.json +1 -1
- package/src/commands/host-inspect.js +20 -8
- package/src/commands/install-qoder-plugin.js +175 -27
- package/template/.cowork-flow/.version +1 -1
- package/template/.cowork-flow/scripts/runtime/host_identity.py +9 -7
- package/template/.cowork-flow/spec/contracts/host-install-inspection.md +38 -10
- package/template/skills/runtime-health/scripts/doctor.py +50 -21
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
### Changed
|
|
8
8
|
|
|
9
|
+
## [2.7.0] - 2026-11-05
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **Qoder CN 支持**:`cwf host add qoder` / `host remove qoder` 覆盖 `~/.qoder`(intl)与 `~/.qoder-cn`(CN)两个用户级 edition;安装/卸载时 `QODER_CONFIG_DIR` / `QODERCN_CONFIG_DIR` 显式设置只处理对应目标,目录名支持 `*_CONFIG_DIR_NAME`。`cwf host inspect qoder` 每个存在的 edition 输出一行并带 `variant`,报告 `schemaVersion` 升到 2(doctor 同时接受 1 与 2);doctor 的 Qoder 检查逐 edition 告警。运行时身份补 `QODERCN_SESSION_ID`,CN 会话的 Bash 侧任务能绑定到 `qoder` 宿主。项目级仍是单一 `qoder` 适配(CN 的项目配置目录同样叫 `.qoder`)。升级动作:`cwf host add qoder --force`。
|
|
14
|
+
|
|
9
15
|
## [2.6.0] - 2026-11-04
|
|
10
16
|
|
|
11
17
|
### Added
|
|
@@ -496,7 +502,8 @@
|
|
|
496
502
|
|
|
497
503
|
此版本未保留本地条目正文,详情见 [GitHub Release](https://github.com/fishlikewater/cowork-flow/releases/tag/v0.0.47)。
|
|
498
504
|
|
|
499
|
-
[Unreleased]: https://github.com/fishlikewater/cowork-flow/compare/v2.
|
|
505
|
+
[Unreleased]: https://github.com/fishlikewater/cowork-flow/compare/v2.7.0...HEAD
|
|
506
|
+
[2.7.0]: https://github.com/fishlikewater/cowork-flow/compare/v2.6.0...v2.7.0
|
|
500
507
|
[2.6.0]: https://github.com/fishlikewater/cowork-flow/compare/v2.5.2...v2.6.0
|
|
501
508
|
[2.5.2]: https://github.com/fishlikewater/cowork-flow/compare/v2.5.1...v2.5.2
|
|
502
509
|
[2.5.1]: https://github.com/fishlikewater/cowork-flow/compare/v2.5.0...v2.5.1
|
package/docs/hosts.en.md
CHANGED
|
@@ -67,7 +67,7 @@ cwf host inspect qoder
|
|
|
67
67
|
cwf host inspect --json
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
One row per installable component, with status `installed`, `missing`, `stale`, `broken`, or `unsupported`. `stale` means the installed payload version differs from the running CLI version; `broken` means the host knows about cowork-flow but a required payload artifact is absent. The doctor then compares that same version with the project's `.cowork-flow/.version`: a CLI newer than the project with a payload that still matches the project's runtime stays silent, while a payload that lags a synced project is still `PLUGIN-STALE`. `kimi-code`'s `all` is only a command composition and never appears as a row. The command is read-only and never repairs, installs, or uninstalls; an unhealthy install is data, not a command failure, and only usage errors such as an unknown host exit with 2.
|
|
70
|
+
One row per installable component instance, with status `installed`, `missing`, `stale`, `broken`, or `unsupported`. Qoder's intl and CN editions each get a row (`variant` distinguishes them); an absent edition is omitted. `stale` means the installed payload version differs from the running CLI version; `broken` means the host knows about cowork-flow but a required payload artifact is absent. The doctor then compares that same version with the project's `.cowork-flow/.version`: a CLI newer than the project with a payload that still matches the project's runtime stays silent, while a payload that lags a synced project is still `PLUGIN-STALE`. `kimi-code`'s `all` is only a command composition and never appears as a row. The command is read-only and never repairs, installs, or uninstalls; an unhealthy install is data, not a command failure, and only usage errors such as an unknown host exit with 2.
|
|
71
71
|
|
|
72
72
|
The doctor's host checks consume the same read model (`cwf host inspect --json`) and no longer parse host directories, registries, settings, or TOML themselves. When the CLI is not on `PATH`, exits non-zero, times out, or reports an unexpected `schemaVersion`, the doctor emits `HOST-INSPECT-UNAVAILABLE` with an upgrade hint instead of falsely reporting `PLUGIN-NOT-INSTALLED` — "could not read" and "read as not installed" are different facts. See `spec/contracts/host-install-inspection.md` for the full contract.
|
|
73
73
|
|
|
@@ -145,7 +145,9 @@ cwf host add qoder --force
|
|
|
145
145
|
cwf host remove qoder
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
Qoder has two user-level install directories: `~/.qoder` (international) and `~/.qoder-cn` (Qoder CN). The bare command covers every edition present on the machine; for install and removal, `QODER_CONFIG_DIR` / `QODERCN_CONFIG_DIR` are full-path overrides, and setting either restricts the command to that target (setting both covers both). The directory names can be overridden with `QODER_CONFIG_DIR_NAME` / `QODERCN_CONFIG_DIR_NAME`.
|
|
149
|
+
|
|
150
|
+
`cwf host inspect qoder` prints one row per present edition, labelled `Qoder` or `Qoder CN`; an explicitly configured home is reported as `missing` even when it does not exist, and never hides another present edition. The plugin provides hooks, the three fixed subagents, and the bootstrap Skill; the project-level `init` / `sync` commands only write the single `qoder` adaptation declaration and shared Skills (Qoder CN also uses `.qoder` as its project config directory).
|
|
149
151
|
|
|
150
152
|
## DeepSeek Harness
|
|
151
153
|
|
package/docs/hosts.md
CHANGED
|
@@ -67,7 +67,7 @@ cwf host inspect qoder
|
|
|
67
67
|
cwf host inspect --json
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
每个可安装组件实例一行,状态为 `installed`、`missing`、`stale`、`broken` 或 `unsupported`。Qoder 的 intl 与 CN edition 各占一行(`variant` 区分),不存在的 edition 不出现。`stale` 表示已装载荷版本与当前 CLI 版本不同;`broken` 表示宿主有注册但载荷缺件。doctor 会再拿同一版本与本项目 `.cowork-flow/.version` 比较:CLI 比项目新、但插件仍匹配项目运行时不报;项目已 sync 到新版本、插件落后时仍报 `PLUGIN-STALE`。`kimi-code` 的 `all` 只是命令组合,不会单独出现。命令只读,不修复、不安装、不卸载;安装态异常是数据,不是命令失败,只有未知宿主等用法错误才返回 2。
|
|
71
71
|
|
|
72
72
|
`run doctor` 的宿主检查消费同一份读模型(`cwf host inspect --json`),不再自己解析宿主目录、注册表、设置文件或 TOML。CLI 不在 PATH、退出码非 0、超时或 `schemaVersion` 不匹配时,doctor 报 `HOST-INSPECT-UNAVAILABLE` 并给出升级提示,而不是误报 `PLUGIN-NOT-INSTALLED`——“读不到”和“读到没装”是两件事。完整契约见 `spec/contracts/host-install-inspection.md`。
|
|
73
73
|
|
|
@@ -145,7 +145,9 @@ cwf host add qoder --force
|
|
|
145
145
|
cwf host remove qoder
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
Qoder 有两个用户级安装目录:`~/.qoder`(国际版)和 `~/.qoder-cn`(Qoder CN)。裸命令覆盖机器上所有已存在的 edition;安装/卸载时 `QODER_CONFIG_DIR` / `QODERCN_CONFIG_DIR` 是完整路径覆盖,显式设置时只处理对应目标(两个都设置则两者都处理),目录名可用 `QODER_CONFIG_DIR_NAME` / `QODERCN_CONFIG_DIR_NAME` 覆盖。
|
|
149
|
+
|
|
150
|
+
`cwf host inspect qoder` 每个存在的 edition 一行,文本输出用 `Qoder` / `Qoder CN` 区分;显式配置的目录即使不存在也按 `missing` 报告,且不会掩盖另一个已存在的 edition。插件提供 hook、三个 fixed subagent 和引导技能;项目级 `init` / `sync` 只写单一 `qoder` 适配声明和共享技能(Qoder CN 的项目配置目录同样叫 `.qoder`)。
|
|
149
151
|
|
|
150
152
|
## DeepSeek Harness
|
|
151
153
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hostRegistry } from '../lib/host-assets.js';
|
|
2
2
|
import { readPackageInfo } from '../lib/package-info.js';
|
|
3
3
|
|
|
4
|
-
export const INSPECT_SCHEMA_VERSION =
|
|
4
|
+
export const INSPECT_SCHEMA_VERSION = 2;
|
|
5
5
|
|
|
6
6
|
export const INSPECT_STATUSES = Object.freeze([
|
|
7
7
|
'installed',
|
|
@@ -29,6 +29,14 @@ function normalizedRow(facts, cliVersion) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
// A component may install more than one user-level edition (today only
|
|
33
|
+
// qoder); its reader returns one facts object per present edition. Single
|
|
34
|
+
// edition components keep returning one object.
|
|
35
|
+
function componentFacts(facts) {
|
|
36
|
+
return Array.isArray(facts) ? facts : [facts];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
32
40
|
function unsupportedRow(hostId, componentName) {
|
|
33
41
|
return {
|
|
34
42
|
status: 'unsupported',
|
|
@@ -59,12 +67,15 @@ export async function inspectHosts(components, hostIds, { env = process.env } =
|
|
|
59
67
|
const facts = typeof component.inspect === 'function'
|
|
60
68
|
? await component.inspect({ env })
|
|
61
69
|
: unsupportedRow(hostId, componentName);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
for (const instance of componentFacts(facts)) {
|
|
71
|
+
hosts.push({
|
|
72
|
+
id: hostId,
|
|
73
|
+
displayName: platform.displayName,
|
|
74
|
+
component: componentName,
|
|
75
|
+
...normalizedRow(instance, cliVersion),
|
|
76
|
+
...(instance.variant ? { variant: instance.variant } : {})
|
|
77
|
+
});
|
|
78
|
+
}
|
|
68
79
|
}
|
|
69
80
|
}
|
|
70
81
|
return {
|
|
@@ -82,5 +93,6 @@ export function renderInspectLine(row) {
|
|
|
82
93
|
row.enabled === false ? 'not enabled' : null,
|
|
83
94
|
row.reason
|
|
84
95
|
].filter(Boolean).join('; ');
|
|
85
|
-
|
|
96
|
+
const name = row.variant === 'cn' ? `${row.displayName} CN` : row.displayName;
|
|
97
|
+
return `${row.id} (${name}, ${row.component}): ${row.status}${detail ? ` - ${detail}` : ''}\n`;
|
|
86
98
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cp, mkdir, readFile, rm } from 'node:fs/promises';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
|
-
import { join } from 'node:path';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
4
4
|
|
|
5
5
|
import { parseInstallArgs, pathExists, readJsonFile, writeJsonAtomic } from '../lib/install-support.js';
|
|
6
6
|
import { readPackageInfo } from '../lib/package-info.js';
|
|
@@ -16,9 +16,96 @@ const REGISTRY_FILE = 'installed_plugins_v2.json';
|
|
|
16
16
|
export const FLAGS = ['--dry-run', '--force', '--uninstall'];
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
// Qoder and Qoder CN share one plugin model and differ only in
|
|
20
|
+
// their user-level config home. The CN build keeps the project
|
|
21
|
+
// config directory at `.qoder`, so the project-level adapter stays
|
|
22
|
+
// single; only machine-level installs fan out.
|
|
23
|
+
const QODER_EDITIONS = [
|
|
24
|
+
{
|
|
25
|
+
variant: 'intl',
|
|
26
|
+
configEnv: 'QODER_CONFIG_DIR',
|
|
27
|
+
nameEnv: 'QODER_CONFIG_DIR_NAME',
|
|
28
|
+
defaultName: '.qoder'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
variant: 'cn',
|
|
32
|
+
configEnv: 'QODERCN_CONFIG_DIR',
|
|
33
|
+
nameEnv: 'QODERCN_CONFIG_DIR_NAME',
|
|
34
|
+
defaultName: '.qoder-cn'
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
function editionLabel(variant) {
|
|
40
|
+
return variant === 'cn' ? 'Qoder CN' : 'Qoder';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
function qoderHomeForEdition(edition, env) {
|
|
45
|
+
const configured = (env[edition.configEnv] || '').trim();
|
|
46
|
+
if (configured) return configured;
|
|
47
|
+
// The host lets the directory name be renamed; `*_CONFIG_DIR` is
|
|
48
|
+
// the full-path override, `*_CONFIG_DIR_NAME` only the basename.
|
|
49
|
+
const name = (env[edition.nameEnv] || '').trim() || edition.defaultName;
|
|
50
|
+
return join(homedir(), name);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
async function editionIsPresent(home) {
|
|
55
|
+
return (
|
|
56
|
+
(await pathExists(join(home, 'settings.json')))
|
|
57
|
+
|| (await pathExists(join(home, 'plugins')))
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// Install targets: an explicit config env is a single-target
|
|
63
|
+
// instruction and suppresses discovery; otherwise every edition with
|
|
64
|
+
// product state on disk is covered; a machine with no Qoder state yet
|
|
65
|
+
// keeps the historical `.qoder` default.
|
|
66
|
+
async function qoderHomes(env = process.env) {
|
|
67
|
+
return await resolveQoderHomes(env, { includePresentWithExplicit: false });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// Inspect reports every edition that exists on the machine, plus an
|
|
72
|
+
// explicitly named home even when it does not exist yet. An install
|
|
73
|
+
// override must not hide another present edition from the doctor.
|
|
74
|
+
async function qoderInspectHomes(env = process.env) {
|
|
75
|
+
return await resolveQoderHomes(env, { includePresentWithExplicit: true });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
async function resolveQoderHomes(env, { includePresentWithExplicit }) {
|
|
80
|
+
const editions = QODER_EDITIONS.map((edition) => ({
|
|
81
|
+
edition,
|
|
82
|
+
home: qoderHomeForEdition(edition, env),
|
|
83
|
+
explicit: Boolean((env[edition.configEnv] || '').trim())
|
|
84
|
+
}));
|
|
85
|
+
const discovered = await Promise.all(
|
|
86
|
+
editions.map(async (item) => ({
|
|
87
|
+
...item,
|
|
88
|
+
present: await editionIsPresent(item.home)
|
|
89
|
+
}))
|
|
90
|
+
);
|
|
91
|
+
let selected;
|
|
92
|
+
if (includePresentWithExplicit) {
|
|
93
|
+
selected = discovered.filter((item) => item.explicit || item.present);
|
|
94
|
+
} else {
|
|
95
|
+
const explicit = discovered.filter((item) => item.explicit);
|
|
96
|
+
selected = explicit.length > 0
|
|
97
|
+
? explicit
|
|
98
|
+
: discovered.filter((item) => item.present);
|
|
99
|
+
}
|
|
100
|
+
const seen = new Set();
|
|
101
|
+
const homes = [];
|
|
102
|
+
for (const item of selected.length > 0 ? selected : [discovered[0]]) {
|
|
103
|
+
const key = resolve(item.home);
|
|
104
|
+
if (seen.has(key)) continue;
|
|
105
|
+
seen.add(key);
|
|
106
|
+
homes.push({ variant: item.edition.variant, home: item.home });
|
|
107
|
+
}
|
|
108
|
+
return homes;
|
|
22
109
|
}
|
|
23
110
|
|
|
24
111
|
function pluginPaths(home, version) {
|
|
@@ -123,7 +210,15 @@ async function enablePlugin(settings, paths, dryRun) {
|
|
|
123
210
|
await writeJsonAtomic(paths.settings, settings);
|
|
124
211
|
}
|
|
125
212
|
|
|
126
|
-
|
|
213
|
+
function failureSummary(failures) {
|
|
214
|
+
return failures
|
|
215
|
+
.map(({ variant, home, error }) => `${editionLabel(variant)} (${home}): ${error.message}`)
|
|
216
|
+
.join('; ');
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
async function uninstallQoderHome(paths, { variant, dryRun }) {
|
|
221
|
+
const label = editionLabel(variant);
|
|
127
222
|
const { registry, settings } = await loadConfigs(paths);
|
|
128
223
|
const owned = registry.plugins[PLUGIN_KEY];
|
|
129
224
|
if (dryRun) {
|
|
@@ -142,30 +237,34 @@ async function uninstall(paths, dryRun) {
|
|
|
142
237
|
await rm(paths.cacheRoot, { recursive: true, force: true });
|
|
143
238
|
console.log(
|
|
144
239
|
owned
|
|
145
|
-
? `✓ cowork-flow
|
|
146
|
-
: `cowork-flow
|
|
240
|
+
? `✓ cowork-flow ${label} plugin uninstalled (${PLUGIN_KEY})`
|
|
241
|
+
: `cowork-flow ${label} plugin was not registered; removed any cached copy at ${paths.cacheRoot}`
|
|
147
242
|
);
|
|
148
243
|
return 0;
|
|
149
244
|
}
|
|
150
245
|
|
|
151
|
-
export async function runInstallQoderPlugin(args = []) {
|
|
152
|
-
const { dryRun, force, uninstall: remove } = parseInstallArgs(args);
|
|
153
|
-
const home = qoderHome();
|
|
154
|
-
const { version } = await readPackageInfo();
|
|
155
|
-
const target = pluginPaths(home, version);
|
|
156
246
|
|
|
157
|
-
|
|
158
|
-
|
|
247
|
+
async function uninstallQoderEditions(homes, dryRun) {
|
|
248
|
+
const failures = [];
|
|
249
|
+
for (const { variant, home } of homes) {
|
|
250
|
+
try {
|
|
251
|
+
await uninstallQoderHome(pluginPaths(home, null), { variant, dryRun });
|
|
252
|
+
} catch (error) {
|
|
253
|
+
failures.push({ variant, home, error });
|
|
254
|
+
}
|
|
159
255
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
256
|
+
if (failures.length > 0) {
|
|
257
|
+
throw new Error(
|
|
258
|
+
`Qoder plugin uninstall failed for ${failures.length} edition(s): ${failureSummary(failures)}`
|
|
259
|
+
);
|
|
164
260
|
}
|
|
261
|
+
return 0;
|
|
262
|
+
}
|
|
165
263
|
|
|
264
|
+
async function installQoderHome(target, { version, pluginSrc, manifest, force, variant, dryRun }) {
|
|
265
|
+
const label = editionLabel(variant);
|
|
166
266
|
const configs = await loadConfigs(target);
|
|
167
|
-
console.log(
|
|
168
|
-
console.log(` Plugin: ${pluginSrc} -> ${target.installPath}`);
|
|
267
|
+
console.log(` ${label}: ${pluginSrc} -> ${target.installPath}`);
|
|
169
268
|
|
|
170
269
|
const registeredEntries = configs.registry.plugins[PLUGIN_KEY];
|
|
171
270
|
const pluginRegistered = Array.isArray(registeredEntries) && registeredEntries.length > 0;
|
|
@@ -177,16 +276,16 @@ export async function runInstallQoderPlugin(args = []) {
|
|
|
177
276
|
pluginRegistered &&
|
|
178
277
|
pluginEnabled
|
|
179
278
|
) {
|
|
180
|
-
console.log(`cowork-flow
|
|
279
|
+
console.log(`cowork-flow ${label} plugin already installed at ${target.installPath}`);
|
|
181
280
|
console.log('Use --force to overwrite.');
|
|
182
|
-
return
|
|
281
|
+
return;
|
|
183
282
|
}
|
|
184
283
|
|
|
185
284
|
const now = new Date().toISOString();
|
|
186
285
|
if (dryRun) {
|
|
187
286
|
await updateRegistry(configs.registry, target, version, now, true);
|
|
188
287
|
await enablePlugin(configs.settings, target, true);
|
|
189
|
-
return
|
|
288
|
+
return;
|
|
190
289
|
}
|
|
191
290
|
|
|
192
291
|
await mkdir(target.cacheRoot, { recursive: true });
|
|
@@ -198,17 +297,66 @@ export async function runInstallQoderPlugin(args = []) {
|
|
|
198
297
|
await updateRegistry(configs.registry, target, version, now, false);
|
|
199
298
|
await enablePlugin(configs.settings, target, false);
|
|
200
299
|
|
|
201
|
-
console.log(`✓ cowork-flow
|
|
202
|
-
|
|
300
|
+
console.log(`✓ cowork-flow ${label} plugin installed to ${target.installPath}`);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
export async function runInstallQoderPlugin(args = []) {
|
|
305
|
+
const { dryRun, force, uninstall: remove } = parseInstallArgs(args);
|
|
306
|
+
const homes = await qoderHomes();
|
|
307
|
+
if (remove) {
|
|
308
|
+
return await uninstallQoderEditions(homes, dryRun);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const { version } = await readPackageInfo();
|
|
312
|
+
const { sourceDir: pluginSrc, manifest } = pluginPayload('qoder');
|
|
313
|
+
if (!(await pathExists(pluginSrc))) {
|
|
314
|
+
throw new Error(`Qoder plugin source missing at ${pluginSrc}. Reinstall cowork-flow.`);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
console.log(`${dryRun ? '[dry-run] Would install' : 'Installing'} cowork-flow Qoder plugin:`);
|
|
318
|
+
const failures = [];
|
|
319
|
+
for (const { variant, home } of homes) {
|
|
320
|
+
try {
|
|
321
|
+
await installQoderHome(pluginPaths(home, version), {
|
|
322
|
+
version,
|
|
323
|
+
pluginSrc,
|
|
324
|
+
manifest,
|
|
325
|
+
force,
|
|
326
|
+
variant,
|
|
327
|
+
dryRun
|
|
328
|
+
});
|
|
329
|
+
} catch (error) {
|
|
330
|
+
failures.push({ variant, home, error });
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
if (failures.length > 0) {
|
|
334
|
+
throw new Error(
|
|
335
|
+
`Qoder plugin install failed for ${failures.length} edition(s): ${failureSummary(failures)}`
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
if (!dryRun) {
|
|
339
|
+
console.log(' Restart Qoder to load the plugin (the IDE has no hook hot reload).');
|
|
340
|
+
}
|
|
203
341
|
return 0;
|
|
204
342
|
}
|
|
205
343
|
|
|
206
344
|
|
|
207
345
|
// Read-only installed-state facts for `host inspect`. The registry and the
|
|
208
346
|
// settings flag are the host's records; the payload files are what a session
|
|
209
|
-
// actually loads.
|
|
347
|
+
// actually loads. One facts object per present edition.
|
|
210
348
|
export async function inspectInstalledState({ env = process.env } = {}) {
|
|
211
|
-
const
|
|
349
|
+
const homes = await qoderInspectHomes(env);
|
|
350
|
+
return await Promise.all(
|
|
351
|
+
homes.map(async ({ variant, home }) => ({
|
|
352
|
+
...(await inspectQoderHome(home)),
|
|
353
|
+
variant
|
|
354
|
+
}))
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
async function inspectQoderHome(home) {
|
|
212
360
|
const paths = pluginPaths(home, null);
|
|
213
361
|
const registry = await readJsonFile(paths.registry);
|
|
214
362
|
const entries = registry?.plugins?.[PLUGIN_KEY];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.7.0
|
|
@@ -139,22 +139,24 @@ HOST_IDENTITIES: tuple[HostIdentity, ...] = (
|
|
|
139
139
|
input_keys=(),
|
|
140
140
|
process_label_env=None,
|
|
141
141
|
),
|
|
142
|
-
# Qoder
|
|
143
|
-
#
|
|
144
|
-
#
|
|
145
|
-
#
|
|
146
|
-
#
|
|
147
|
-
#
|
|
142
|
+
# Qoder and Qoder CN are one host with two user-level editions:
|
|
143
|
+
# both export their session id, but the CN CLI prefixes the
|
|
144
|
+
# environment namespace (`QODERCN_SESSION_ID`) while the hook
|
|
145
|
+
# payload keys stay the same. Payload `cwd` is the project-root
|
|
146
|
+
# evidence that matters here: host assets live in a machine-level
|
|
147
|
+
# plugin, not the project.
|
|
148
148
|
HostIdentity(
|
|
149
149
|
id="qoder",
|
|
150
150
|
prefix="qoder",
|
|
151
151
|
adapter="qoder.hooks",
|
|
152
152
|
policy_module="adapters.host.qoder_policy",
|
|
153
153
|
injects_context=True,
|
|
154
|
-
session_env=("QODER_SESSION_ID",),
|
|
154
|
+
session_env=("QODER_SESSION_ID", "QODERCN_SESSION_ID"),
|
|
155
155
|
input_keys=(
|
|
156
156
|
"QODER_SESSION_ID",
|
|
157
157
|
"qoder_session_id",
|
|
158
|
+
"QODERCN_SESSION_ID",
|
|
159
|
+
"qodercn_session_id",
|
|
158
160
|
"session_id",
|
|
159
161
|
),
|
|
160
162
|
process_label_env=None,
|
|
@@ -27,27 +27,46 @@ cwf host inspect [host] [--json]
|
|
|
27
27
|
|
|
28
28
|
```json
|
|
29
29
|
{
|
|
30
|
-
"schemaVersion":
|
|
31
|
-
"cliVersion": "2.
|
|
30
|
+
"schemaVersion": 2,
|
|
31
|
+
"cliVersion": "2.7.0",
|
|
32
32
|
"hosts": [
|
|
33
33
|
{
|
|
34
34
|
"id": "qoder",
|
|
35
35
|
"displayName": "Qoder",
|
|
36
36
|
"component": "plugin",
|
|
37
37
|
"status": "installed",
|
|
38
|
-
"version": "2.
|
|
39
|
-
"payloadPath": "/home/user/.qoder/plugins/cache/cowork-flow-local/cowork-flow/2.
|
|
40
|
-
"detailPath": "/home/user/.qoder/plugins/cache/cowork-flow-local/cowork-flow/2.
|
|
38
|
+
"version": "2.7.0",
|
|
39
|
+
"payloadPath": "/home/user/.qoder/plugins/cache/cowork-flow-local/cowork-flow/2.7.0",
|
|
40
|
+
"detailPath": "/home/user/.qoder/plugins/cache/cowork-flow-local/cowork-flow/2.7.0/.qoder-plugin/plugin.json",
|
|
41
41
|
"registeredSource": "/home/user/.qoder/plugins/installed_plugins_v2.json",
|
|
42
42
|
"enabled": true,
|
|
43
|
-
"reason": null
|
|
43
|
+
"reason": null,
|
|
44
|
+
"variant": "intl"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "qoder",
|
|
48
|
+
"displayName": "Qoder",
|
|
49
|
+
"component": "plugin",
|
|
50
|
+
"status": "installed",
|
|
51
|
+
"version": "2.7.0",
|
|
52
|
+
"payloadPath": "/home/user/.qoder-cn/plugins/cache/cowork-flow-local/cowork-flow/2.7.0",
|
|
53
|
+
"detailPath": "/home/user/.qoder-cn/plugins/cache/cowork-flow-local/cowork-flow/2.7.0/.qoder-plugin/plugin.json",
|
|
54
|
+
"registeredSource": "/home/user/.qoder-cn/plugins/installed_plugins_v2.json",
|
|
55
|
+
"enabled": true,
|
|
56
|
+
"reason": null,
|
|
57
|
+
"variant": "cn"
|
|
44
58
|
}
|
|
45
59
|
]
|
|
46
60
|
}
|
|
47
61
|
```
|
|
48
62
|
|
|
49
|
-
There is one row per installable component.
|
|
50
|
-
|
|
63
|
+
There is one row per installable component instance. A host with several
|
|
64
|
+
user-level editions reports one row per present edition: `qoder` has `intl`
|
|
65
|
+
(`~/.qoder`) and `cn` (`~/.qoder-cn`), distinguished by `variant`. Row identity
|
|
66
|
+
is `(id, component, variant)`; an edition that is absent on the machine is
|
|
67
|
+
omitted unless its config directory was explicitly named. `kimi-code`'s `all`
|
|
68
|
+
component is a command composition, not an installed artifact, so it has no
|
|
69
|
+
row.
|
|
51
70
|
|
|
52
71
|
| Field | Meaning |
|
|
53
72
|
|---|---|
|
|
@@ -61,10 +80,13 @@ command composition, not an installed artifact, so it has no row.
|
|
|
61
80
|
| `registeredSource` | Registry, config file or marketplace path the host reads, or `null`. |
|
|
62
81
|
| `enabled` | `true`/`false` when the host has an enable flag; `null` when it has none or the state is unknown. |
|
|
63
82
|
| `reason` | Human-readable explanation, or `null` when there is nothing to explain. |
|
|
83
|
+
| `variant` | Optional edition discriminator for hosts with several user-level installs. Today only `qoder` sets it: `intl` or `cn`. Absent for single-edition hosts. |
|
|
64
84
|
|
|
65
85
|
Unknown fields are ignored by consumers. A breaking change to the shape, the
|
|
66
86
|
statuses or the meaning of a field bumps `schemaVersion`; the doctor then
|
|
67
|
-
reports `HOST-INSPECT-UNAVAILABLE` instead of guessing.
|
|
87
|
+
reports `HOST-INSPECT-UNAVAILABLE` instead of guessing. `schemaVersion` 2 adds
|
|
88
|
+
the multi-instance row shape (`variant`); version 1 was one row per component.
|
|
89
|
+
The doctor understands both; any other version is unavailable.
|
|
68
90
|
|
|
69
91
|
## Statuses
|
|
70
92
|
|
|
@@ -122,7 +144,7 @@ cwf host inspect --json
|
|
|
122
144
|
- The command runs with stdin closed and its output parsed as UTF-8.
|
|
123
145
|
|
|
124
146
|
If the CLI is absent, exits non-zero, times out, emits invalid JSON, reports a
|
|
125
|
-
`schemaVersion` other than 1, omits the `hosts` list, or omits the row the
|
|
147
|
+
`schemaVersion` other than 1 or 2, omits the `hosts` list, or omits the row the
|
|
126
148
|
caller needs, the doctor emits one `HOST-INSPECT-UNAVAILABLE` warning for that
|
|
127
149
|
host check. It must not translate an unavailable inspection into
|
|
128
150
|
`PLUGIN-NOT-INSTALLED`: "could not read" and "read as missing" are different
|
|
@@ -145,6 +167,10 @@ host layout. Content-drift warnings (OpenCode) name the file they compared, and
|
|
|
145
167
|
the skill-delivery check names `payloadPath/skills`; both point at the artifact
|
|
146
168
|
that actually differs rather than the install record.
|
|
147
169
|
|
|
170
|
+
When a component reports several edition rows, the doctor evaluates each row
|
|
171
|
+
independently and emits one issue per affected edition; a healthy edition never
|
|
172
|
+
masks a missing, broken, disabled or stale one.
|
|
173
|
+
|
|
148
174
|
The `stale` row above is the inspect status. The doctor's code depends on the
|
|
149
175
|
project-relative comparison described under statuses: an `installed` row whose
|
|
150
176
|
payload version also differs from the project's `.version` produces
|
|
@@ -169,6 +195,8 @@ command yet.
|
|
|
169
195
|
## Compatibility
|
|
170
196
|
|
|
171
197
|
- Adding a host platform or component is additive.
|
|
198
|
+
- Adding a row for another edition of an existing component is additive; row
|
|
199
|
+
identity is `(id, component, variant)`.
|
|
172
200
|
- Renaming or removing a field or status is breaking (`schemaVersion` bump).
|
|
173
201
|
- `unsupported` stays a valid status so a future component can be declared
|
|
174
202
|
before its reader exists.
|
|
@@ -1110,21 +1110,21 @@ def _run_host_inspect() -> dict[str, object]:
|
|
|
1110
1110
|
payload = json.loads(completed.stdout)
|
|
1111
1111
|
except (json.JSONDecodeError, ValueError):
|
|
1112
1112
|
return _host_inspect_unavailable("host inspect returned invalid JSON")
|
|
1113
|
-
if not isinstance(payload, dict) or payload.get("schemaVersion")
|
|
1113
|
+
if not isinstance(payload, dict) or payload.get("schemaVersion") not in (1, 2):
|
|
1114
1114
|
return _host_inspect_unavailable(
|
|
1115
|
-
"host inspect does not support schemaVersion 1; upgrade cowork-flow"
|
|
1115
|
+
"host inspect does not support schemaVersion 1 or 2; upgrade cowork-flow"
|
|
1116
1116
|
)
|
|
1117
1117
|
rows = payload.get("hosts")
|
|
1118
1118
|
if not isinstance(rows, list):
|
|
1119
1119
|
return _host_inspect_unavailable("host inspect returned no hosts list")
|
|
1120
1120
|
hosts: dict[str, dict[str, object]] = {}
|
|
1121
|
-
components: dict[str, dict[str, object]] = {}
|
|
1121
|
+
components: dict[str, list[dict[str, object]]] = {}
|
|
1122
1122
|
for row in rows:
|
|
1123
1123
|
if not isinstance(row, dict) or not isinstance(row.get("id"), str):
|
|
1124
1124
|
continue
|
|
1125
1125
|
host_id = row["id"]
|
|
1126
1126
|
component = str(row.get("component") or "")
|
|
1127
|
-
components
|
|
1127
|
+
components.setdefault(f"{host_id}:{component}", []).append(row)
|
|
1128
1128
|
hosts.setdefault(host_id, row)
|
|
1129
1129
|
return {
|
|
1130
1130
|
"available": True,
|
|
@@ -1134,11 +1134,19 @@ def _run_host_inspect() -> dict[str, object]:
|
|
|
1134
1134
|
}
|
|
1135
1135
|
|
|
1136
1136
|
|
|
1137
|
+
def _inspect_rows(
|
|
1138
|
+
facts: dict[str, object], host_id: str, component: str
|
|
1139
|
+
) -> list[dict[str, object]]:
|
|
1140
|
+
"""Every row for one component; a multi-edition host reports several."""
|
|
1141
|
+
rows = facts.get("components", {}).get(f"{host_id}:{component}", [])
|
|
1142
|
+
return [row for row in rows if isinstance(row, dict)]
|
|
1143
|
+
|
|
1144
|
+
|
|
1137
1145
|
def _inspect_row(
|
|
1138
1146
|
facts: dict[str, object], host_id: str, component: str
|
|
1139
1147
|
) -> dict[str, object] | None:
|
|
1140
|
-
|
|
1141
|
-
return
|
|
1148
|
+
rows = _inspect_rows(facts, host_id, component)
|
|
1149
|
+
return rows[0] if rows else None
|
|
1142
1150
|
|
|
1143
1151
|
|
|
1144
1152
|
def _host_inspect_facts(repo_root: Path) -> dict[str, object]:
|
|
@@ -1151,19 +1159,29 @@ def _host_inspect_facts(repo_root: Path) -> dict[str, object]:
|
|
|
1151
1159
|
return cached
|
|
1152
1160
|
|
|
1153
1161
|
|
|
1154
|
-
def
|
|
1162
|
+
def _inspect_component_rows(
|
|
1155
1163
|
repo_root: Path, host_id: str, component: str, label: str
|
|
1156
|
-
) -> tuple[dict[str, object] | None, list[dict[str, str]] | None]:
|
|
1157
|
-
"""The inspect
|
|
1164
|
+
) -> tuple[list[dict[str, object]] | None, list[dict[str, str]] | None]:
|
|
1165
|
+
"""The inspect rows for one component, or the shared unavailable warning."""
|
|
1158
1166
|
facts = _host_inspect_facts(repo_root)
|
|
1159
1167
|
if not facts["available"]:
|
|
1160
1168
|
return None, _host_inspect_unavailable_issue(host_id, facts)
|
|
1161
|
-
|
|
1162
|
-
if
|
|
1169
|
+
rows = _inspect_rows(facts, host_id, component)
|
|
1170
|
+
if not rows:
|
|
1163
1171
|
return None, _host_inspect_unavailable_issue(
|
|
1164
1172
|
host_id, {"reason": f"host inspect omitted {label}"}
|
|
1165
1173
|
)
|
|
1166
|
-
return
|
|
1174
|
+
return rows, None
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
def _inspect_component_row(
|
|
1178
|
+
repo_root: Path, host_id: str, component: str, label: str
|
|
1179
|
+
) -> tuple[dict[str, object] | None, list[dict[str, str]] | None]:
|
|
1180
|
+
"""The first inspect row for one component (single-edition callers)."""
|
|
1181
|
+
rows, unavailable = _inspect_component_rows(repo_root, host_id, component, label)
|
|
1182
|
+
if unavailable is not None:
|
|
1183
|
+
return None, unavailable
|
|
1184
|
+
return rows[0], None
|
|
1167
1185
|
|
|
1168
1186
|
|
|
1169
1187
|
def _unexpected_inspect_status(
|
|
@@ -1223,17 +1241,28 @@ def check_qoder_plugin(repo_root: Path) -> list[dict[str, str]]:
|
|
|
1223
1241
|
"""Qoder plugin health from the CLI-owned install-state read model.
|
|
1224
1242
|
|
|
1225
1243
|
Advisory, and silent while the project never selected the Qoder host: the
|
|
1226
|
-
plugin is a machine-level asset installed once into
|
|
1227
|
-
it never updates through sync
|
|
1244
|
+
plugin is a machine-level asset installed once into the Qoder user config
|
|
1245
|
+
directory (`~/.qoder` or `~/.qoder-cn`), so it never updates through sync
|
|
1246
|
+
or npm. Each present edition is checked independently."""
|
|
1228
1247
|
adapter = repo_root / DIR_WORKFLOW / "adapters" / "qoder" / "adapter.yaml"
|
|
1229
1248
|
if not adapter.is_file():
|
|
1230
1249
|
return []
|
|
1231
1250
|
|
|
1232
|
-
|
|
1251
|
+
rows, unavailable = _inspect_component_rows(
|
|
1233
1252
|
repo_root, "qoder", "plugin", "qoder"
|
|
1234
1253
|
)
|
|
1235
1254
|
if unavailable is not None:
|
|
1236
1255
|
return unavailable
|
|
1256
|
+
issues: list[dict[str, str]] = []
|
|
1257
|
+
for row in rows:
|
|
1258
|
+
issues.extend(_qoder_row_issues(row, repo_root))
|
|
1259
|
+
return issues
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
def _qoder_row_issues(
|
|
1263
|
+
row: dict[str, object], repo_root: Path
|
|
1264
|
+
) -> list[dict[str, str]]:
|
|
1265
|
+
label = "Qoder CN" if row.get("variant") == "cn" else "Qoder"
|
|
1237
1266
|
status = row.get("status")
|
|
1238
1267
|
payload = Path(str(row.get("payloadPath") or row.get("registeredSource") or "qoder"))
|
|
1239
1268
|
path = _inspect_path(row, "qoder")
|
|
@@ -1243,9 +1272,9 @@ def check_qoder_plugin(repo_root: Path) -> list[dict[str, str]]:
|
|
|
1243
1272
|
return _qoder_warning(
|
|
1244
1273
|
"PLUGIN-NOT-INSTALLED",
|
|
1245
1274
|
path,
|
|
1246
|
-
"this project declares the Qoder host, but cowork-flow is not "
|
|
1247
|
-
"registered in the
|
|
1248
|
-
"workflow context; loading also needs a Qoder restart and a "
|
|
1275
|
+
f"this project declares the Qoder host, but cowork-flow is not "
|
|
1276
|
+
f"registered in the {label} plugin cache, so {label} sessions inject "
|
|
1277
|
+
"no workflow context; loading also needs a Qoder restart and a "
|
|
1249
1278
|
"trusted workspace",
|
|
1250
1279
|
"cwf host add qoder",
|
|
1251
1280
|
)
|
|
@@ -1258,7 +1287,7 @@ def check_qoder_plugin(repo_root: Path) -> list[dict[str, str]]:
|
|
|
1258
1287
|
return _qoder_warning(
|
|
1259
1288
|
code,
|
|
1260
1289
|
path,
|
|
1261
|
-
f"the
|
|
1290
|
+
f"the {label} plugin at {payload} is incomplete ({reason}); the host "
|
|
1262
1291
|
"cannot load it",
|
|
1263
1292
|
"cwf host add qoder --force",
|
|
1264
1293
|
)
|
|
@@ -1267,7 +1296,7 @@ def check_qoder_plugin(repo_root: Path) -> list[dict[str, str]]:
|
|
|
1267
1296
|
return _qoder_warning(
|
|
1268
1297
|
"PLUGIN-DISABLED",
|
|
1269
1298
|
path,
|
|
1270
|
-
'the
|
|
1299
|
+
f'the {label} plugin is installed but not enabled '
|
|
1271
1300
|
f'(`enabledPlugins["{QODER_PLUGIN_KEY}"]`); no hook fires',
|
|
1272
1301
|
"cwf host add qoder --force",
|
|
1273
1302
|
)
|
|
@@ -1278,7 +1307,7 @@ def check_qoder_plugin(repo_root: Path) -> list[dict[str, str]]:
|
|
|
1278
1307
|
"PLUGIN-STALE",
|
|
1279
1308
|
path,
|
|
1280
1309
|
_project_stale_message(
|
|
1281
|
-
"the
|
|
1310
|
+
f"the {label} plugin",
|
|
1282
1311
|
recorded,
|
|
1283
1312
|
project_version,
|
|
1284
1313
|
"the plugin does not update with sync or npm, so injection "
|