@harmonyos-arkts/d2h 0.1.18 → 0.1.19

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "android-to-hmos-migration",
3
3
  "description": "基于确定性 facts、迁移报告与端到端验证的 Android 到 HarmonyOS 迁移插件",
4
- "version": "0.1.18",
4
+ "version": "0.1.19",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "android",
package/README.md CHANGED
@@ -31,7 +31,7 @@ npx --yes @harmonyos-arkts/d2h@latest install --agent vscode --force
31
31
 
32
32
  安装完成后会清除 `~/.harmonybot/opencode-bundle/vscode` 缓存。请重启 VS Code,让扩展重新解压资源并加载最新的 D2H 和指标插件配置;安装前无需先启动扩展。`--dry-run` 不会清除缓存。
33
33
 
34
- 默认使用本地轻量指标插件 `opencode-metrics-plugin-lite`。需要远端指标能力时增加 `--remote`:
34
+ 默认使用本地轻量指标插件 `opencode-metrics-plugin-lite`,配置 `agents: ["*"]` 记录所有 Agent 的会话。需要远端指标能力时增加 `--remote`:
35
35
 
36
36
  ```bash
37
37
  npx --yes @harmonyos-arkts/d2h@latest install --agent vscode --force --remote
@@ -86,7 +86,7 @@ function updateAgentConfig(config, remote) {
86
86
  updateMetricsPlugin(config, remote);
87
87
  config.agent ??= {};
88
88
  for (const name of ['general', 'explore']) {
89
- config.agent[name] = { ...config.agent[name], permission: 'allow' };
89
+ config.agent[name] = { ...config.agent[name], permission: { '*': 'allow' } };
90
90
  }
91
91
  const previous = config.agent.d2h ?? {};
92
92
  config.agent.d2h = {
@@ -113,7 +113,7 @@ export function inspectInstallation(configDir) {
113
113
  try {
114
114
  const config = parseJsonConfig(fs.readFileSync(configFile, 'utf8'));
115
115
  const d2h = config.agent?.d2h;
116
- if (!['general', 'explore'].every(name => config.agent?.[name]?.permission === 'allow') ||
116
+ if (!['general', 'explore'].every(name => config.agent?.[name]?.permission?.['*'] === 'allow') ||
117
117
  !d2h || !['read', 'write', 'edit', 'bash'].every(tool => d2h.tools?.[tool] === true) ||
118
118
  !['edit', 'bash', 'external_directory'].every(permission => d2h.permission?.[permission] === 'allow')) {
119
119
  changed.push(path.basename(configFile));
@@ -77,7 +77,7 @@ function updateConfig(source, remote) {
77
77
  const value = JSON.parse(source);
78
78
  value.agent ??= {};
79
79
  for (const name of ['general', 'explore']) {
80
- value.agent[name] = { ...value.agent[name], permission: 'allow' };
80
+ value.agent[name] = { ...value.agent[name], permission: { '*': 'allow' } };
81
81
  }
82
82
  value.agent.d2h = { ...value.agent.d2h, description: modeLabel,
83
83
  tools: { ...value.agent.d2h?.tools, read: true, write: true, edit: true, bash: true },
@@ -206,7 +206,7 @@ export function inspectVSCodeInstallation(extensionDir, bundleCacheRoot) {
206
206
  changed.push(`bundle/plugin/d2h/${name}`);
207
207
  }
208
208
  const config = JSON.parse(fs.readFileSync(path.join(bundle, 'opencode.json'), 'utf8'));
209
- if (!['general', 'explore'].every(name => config.agent?.[name]?.permission === 'allow') ||
209
+ if (!['general', 'explore'].every(name => config.agent?.[name]?.permission?.['*'] === 'allow') ||
210
210
  !config.plugin?.includes('./plugin/d2h') || config.agent?.d2h?.description !== modeLabel) {
211
211
  changed.push('bundle/opencode.json');
212
212
  }
@@ -11,7 +11,7 @@ export function updateMetricsPlugin(config, remote = false) {
11
11
  };
12
12
  const existing = plugins.findIndex(isMetrics);
13
13
  const filtered = plugins.filter((entry, index) => !isMetrics(entry) || index === existing);
14
- const selectedEntry = [selected, { agents: ['d2h'] }];
14
+ const selectedEntry = [selected, { agents: remote ? ['d2h'] : ['*'] }];
15
15
  if (existing < 0)
16
16
  filtered.push(selectedEntry);
17
17
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harmonyos-arkts/d2h",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Install Android-to-HarmonyOS migration agents and skills into OpenCode or DevEco Code",
5
5
  "type": "module",
6
6
  "bin": {