@aiwg/cli 2026.11.8 → 2026.11.9

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.
Files changed (157) hide show
  1. package/README.md +1 -1
  2. package/agentic/code/providers/capability-matrix.yaml +4 -4
  3. package/agentic/code/providers/model-capabilities.v1.json +150 -28
  4. package/agentic/code/providers/model-catalog.v1.json +6 -5
  5. package/bin/aiwg.mjs +3 -1
  6. package/dist/src/agents/agent-packager.js +3 -3
  7. package/dist/src/artifacts/cli.js +6 -2
  8. package/dist/src/artifacts/fortemi-core-sync.js +2 -0
  9. package/dist/src/artifacts/index-query-help.js +27 -0
  10. package/dist/src/artifacts/query-engine-installation.js +17 -4
  11. package/dist/src/artifacts/query-engine-name-intent.js +56 -0
  12. package/dist/src/artifacts/query-engine-scoring.js +14 -8
  13. package/dist/src/artifacts/query-engine-show-card.js +3 -3
  14. package/dist/src/cli/agent-spawn.js +4 -4
  15. package/dist/src/cli/handlers/best-practices-audit.js +1 -1
  16. package/dist/src/cli/handlers/bundle-deployment-mode.js +26 -13
  17. package/dist/src/cli/handlers/bundle-reconciliation.js +2 -2
  18. package/dist/src/cli/handlers/init.js +1 -1
  19. package/dist/src/cli/handlers/issues.js +5 -0
  20. package/dist/src/cli/handlers/marketplace-plugin-search.js +6 -5
  21. package/dist/src/cli/handlers/marketplace.js +1 -1
  22. package/dist/src/cli/handlers/models-muse-wrapper.js +32 -0
  23. package/dist/src/cli/handlers/models.js +5 -4
  24. package/dist/src/cli/handlers/refresh-artifact-freshness.js +51 -0
  25. package/dist/src/cli/handlers/refresh-bundles.js +3 -0
  26. package/dist/src/cli/handlers/refresh-managed-deployment.js +6 -4
  27. package/dist/src/cli/handlers/refresh.js +7 -3
  28. package/dist/src/cli/handlers/repo-access.js +15 -2
  29. package/dist/src/cli/handlers/sdlc-accelerate.js +1 -1
  30. package/dist/src/cli/handlers/steward.js +1 -1
  31. package/dist/src/cli/handlers/subcommands-bundles.js +1 -1
  32. package/dist/src/cli/handlers/subcommands-discovery.js +5 -0
  33. package/dist/src/cli/handlers/subcommands-list.js +1 -1
  34. package/dist/src/cli/handlers/subcommands-plugins.js +1 -1
  35. package/dist/src/cli/handlers/subcommands-storage.js +11 -0
  36. package/dist/src/cli/handlers/team.js +1 -1
  37. package/dist/src/cli/handlers/use-additive-bundles.js +9 -2
  38. package/dist/src/cli/handlers/use-bundle-counts.js +1 -1
  39. package/dist/src/cli/handlers/use-copy-selection.js +42 -0
  40. package/dist/src/cli/handlers/use.js +33 -38
  41. package/dist/src/cli/handlers/workspace-context.js +4 -0
  42. package/dist/src/cli/help-generator.js +1 -1
  43. package/dist/src/cli/new-project-options.js +46 -0
  44. package/dist/src/cli/router.js +15 -4
  45. package/dist/src/cli/scope-resolver.js +6 -6
  46. package/dist/src/cli/services/deployment-probe-scope.js +11 -0
  47. package/dist/src/cli/services/deployment-staleness.js +83 -0
  48. package/dist/src/cli/services/deployment-verification.js +20 -11
  49. package/dist/src/config/aiwg-config.js +1 -1
  50. package/dist/src/config/authorization-cli.js +36 -1
  51. package/dist/src/config/config-normalization.js +3 -1
  52. package/dist/src/data/community.yaml +3 -3
  53. package/dist/src/extensions/commands/definitions.js +2 -2
  54. package/dist/src/extensions/manifest.js +27 -1
  55. package/dist/src/extensions/user-hook-diagnostics.js +6 -4
  56. package/dist/src/extensions/verified-hook-command.js +7 -5
  57. package/dist/src/features/catalog.js +2 -2
  58. package/dist/src/issues/cli.js +10 -2
  59. package/dist/src/marketplace/cache.js +31 -0
  60. package/dist/src/marketplace/plugin-search.js +39 -20
  61. package/dist/src/marketplace/public-search.js +122 -0
  62. package/dist/src/marketplace/registry.js +2 -0
  63. package/dist/src/marketplace/search-contract.js +19 -0
  64. package/dist/src/marketplace/sources/public-search.js +81 -0
  65. package/dist/src/mcp/cli.mjs +8 -7
  66. package/dist/src/mcp/credentials.mjs +1 -1
  67. package/dist/src/mcp/registry.js +6 -2
  68. package/dist/src/mcp/tool-filters.mjs +1 -1
  69. package/dist/src/memory/provider-memory-adapter.js +1 -1
  70. package/dist/src/models/catalog-policy.js +2 -1
  71. package/dist/src/models/config-loader.js +2 -1
  72. package/dist/src/models/cursor-worker-version.d.mts +2 -0
  73. package/dist/src/models/cursor-worker-version.mjs +27 -0
  74. package/dist/src/models/model-capabilities.v1.json +150 -28
  75. package/dist/src/models/model-catalog.v1.json +6 -5
  76. package/dist/src/models/model-discovery.js +3 -3
  77. package/dist/src/models/policy-resources.js +1 -1
  78. package/dist/src/models/worker-direct-readiness.js +8 -5
  79. package/dist/src/models/worker-installation.d.mts +3 -2
  80. package/dist/src/models/worker-installation.mjs +12 -10
  81. package/dist/src/models/worker-invocation-policy.js +1 -1
  82. package/dist/src/models/wrapper-deployment.js +1 -1
  83. package/dist/src/models/wrapper-enforcement.js +6 -2
  84. package/dist/src/plugin/skill-command-frontmatter.js +1 -1
  85. package/dist/src/plugin/skill-command-translator.js +1 -1
  86. package/dist/src/policy/repo-access-workspace-spec.js +63 -0
  87. package/dist/src/policy/repo-access.js +22 -0
  88. package/dist/src/providers/capability-matrix.yaml +4 -4
  89. package/dist/src/providers/deployment-ownership.mjs +1 -1
  90. package/dist/src/providers/deployment-preservation.mjs +10 -5
  91. package/dist/src/providers/deployment-removal.js +1 -1
  92. package/dist/src/providers/devin-compat.d.mts +4 -0
  93. package/dist/src/providers/devin-compat.mjs +29 -0
  94. package/dist/src/providers/grok-build-acp.js +39 -9
  95. package/dist/src/providers/grok-build-paths.js +8 -7
  96. package/dist/src/providers/provider-context-contracts.js +4 -3
  97. package/dist/src/providers/provider-definition-schema.js +1 -1
  98. package/dist/src/providers/provider-definitions.js +1 -1
  99. package/dist/src/providers/provider-definitions.mjs +3 -3
  100. package/dist/src/providers/provider-inventory.js +13 -1
  101. package/dist/src/providers/provider-seeds-3.js +10 -9
  102. package/dist/src/providers/transformation-receipt-integration.js +1 -1
  103. package/dist/src/sessions/adapters/windsurf.js +7 -7
  104. package/dist/src/sessions/grok-build-cli-output.js +1 -1
  105. package/dist/src/sessions/grok-build-cli.js +7 -1
  106. package/dist/src/skills/bundle-import-cli.js +61 -0
  107. package/dist/src/skills/bundle-import-plan.js +108 -0
  108. package/dist/src/skills/bundle-import.js +192 -0
  109. package/dist/src/skills/cli.js +5 -0
  110. package/dist/src/skills/deployment-policy.js +1 -1
  111. package/dist/src/skills/importer.js +4 -4
  112. package/dist/src/smiths/agentsmith/demo.js +1 -1
  113. package/dist/src/smiths/agentsmith/examples.js +6 -6
  114. package/dist/src/smiths/commandsmith/generator.js +1 -1
  115. package/dist/src/smiths/context-pipeline/allowlist.js +1 -1
  116. package/dist/src/smiths/context-pipeline/parallelism-section.js +2 -2
  117. package/dist/src/smiths/skillsmith/collision-detector.js +1 -1
  118. package/dist/src/smiths/skillsmith/namespace-adapter.js +1 -1
  119. package/dist/src/smiths/skillsmith/platform-resolver.js +2 -2
  120. package/dist/src/writing/campaign-report.js +4 -3
  121. package/dist/src/writing/contextual-diagnostics.js +27 -2
  122. package/dist/src/writing/current-patterns.js +1 -0
  123. package/dist/src/writing/structural-judgment.catalogue.json +17 -0
  124. package/dist/src/writing/structural-judgment.js +33 -0
  125. package/dist/src/writing/structural-patterns.js +55 -0
  126. package/dist/src/writing/validation-campaign.js +3 -0
  127. package/dist/src/writing/validation-engine.js +7 -4
  128. package/package.json +4 -2
  129. package/schemas/models/model-config-compatibility.v1.schema.json +1 -1
  130. package/tools/agents/deploy-agents.mjs +12 -10
  131. package/tools/agents/deploy-options.mjs +1 -0
  132. package/tools/agents/providers/base-behaviors.mjs +1 -1
  133. package/tools/agents/providers/base-contract.mjs +1 -1
  134. package/tools/agents/providers/base-kernel-skills.mjs +1 -1
  135. package/tools/agents/providers/base-models-platforms.mjs +9 -7
  136. package/tools/agents/providers/base-rule-index.mjs +1 -1
  137. package/tools/agents/providers/codex.mjs +1 -0
  138. package/tools/agents/providers/devin.mjs +3 -0
  139. package/tools/agents/providers/grok-build.mjs +14 -19
  140. package/tools/agents/providers/hook-capabilities.mjs +1 -1
  141. package/tools/agents/providers/model-wrapper.mjs +1 -1
  142. package/tools/agents/providers/rule-delivery-surface.mjs +14 -10
  143. package/tools/agents/providers/rule-deployment-prepare.mjs +8 -8
  144. package/tools/agents/providers/rule-projection.mjs +5 -5
  145. package/tools/agents/providers/rule-startup.mjs +1 -1
  146. package/tools/agents/providers/skill-copy-prune.mjs +5 -1
  147. package/tools/agents/providers/windsurf.mjs +26 -26
  148. package/tools/agents/use-rule-selection.mjs +1 -1
  149. package/tools/cli/workspace-deployment-health.mjs +38 -0
  150. package/tools/cli/workspace-status.mjs +5 -2
  151. package/tools/daemon/provider-watcher.mjs +3 -3
  152. package/tools/plugin/package-plugins.mjs +16 -2
  153. package/tools/ralph-external/lib/deepseek-harness-adapter.mjs +36 -22
  154. package/tools/ralph-external/lib/factory-adapter.mjs +13 -28
  155. package/tools/ralph-external/lib/factory-stream-final.mjs +31 -0
  156. package/tools/skills/deploy-skills-codex.mjs +2 -1
  157. package/vscode-extension/schemas/aiwg.config.v1.json +2 -1
@@ -114,11 +114,12 @@ export function collectDeploymentRuleSources(opts) {
114
114
  };
115
115
  for (const bundle of bundles.filter(b => b.manifest.core && b.manifest.autoInstall)) select(bundle.id);
116
116
  for (const name of names.filter(name => name !== 'all')) select(name);
117
+ const kernelOnly = opts.kernelOnly && !(opts.discoveryOnly && (opts.bundleOnly || (opts.ruleSelectionMode || opts.mode) !== 'all'));
117
118
  const invoked = bundles.find(bundle => path.resolve(bundle.root) === path.resolve(opts.srcRoot));
118
- if (invoked && !opts.kernelOnly) select(invoked.id);
119
+ if (invoked && !kernelOnly) select(invoked.id);
119
120
  // Include the invocation being installed before its config entry is saved.
120
- if (!opts.kernelOnly) for (const framework of getFrameworksForMode(opts.srcRoot, opts.mode === 'all' && names.length ? 'general' : opts.mode)) select(framework.id);
121
- const roots = [...(!invoked || !opts.kernelOnly ? [opts.srcRoot] : []), ...(opts.additionalSources || []), ...[...selected].map(bundle => bundle.root)];
121
+ if (!kernelOnly) for (const framework of getFrameworksForMode(opts.srcRoot, opts.mode === 'all' && names.length ? 'general' : opts.mode)) select(framework.id);
122
+ const roots = [...(!invoked || !kernelOnly ? [opts.srcRoot] : []), ...(opts.additionalSources || []), ...[...selected].map(bundle => bundle.root)];
122
123
  for (const entry of Object.values(installed)) if (entry?.localPath) roots.push(path.resolve(opts.target, entry.localPath));
123
124
  const files = roots.flatMap(root => listMdFiles(path.join(root, 'rules'))).filter(file => !structural(file));
124
125
  const behaviors = roots.flatMap(root => walk(path.join(root, 'behaviors')).filter(file => path.basename(file) === 'BEHAVIOR.md'));
@@ -201,7 +202,7 @@ export function finishBindings(opts, provider) {
201
202
  const roots = [opts.target, opts.deploymentHome,
202
203
  ...[opts.kernelSkillsPath, opts.activeWorkspace, ...Object.values(provider.paths)].filter(p => p && path.isAbsolute(p))];
203
204
  const files = [...new Set(roots.flatMap(walk))];
204
- const indexRel = provider.name === 'copilot' ? '.github/RULES-BOUND.md' : provider.name === 'flue' ? '.agents/.aiwg/RULES-BOUND.md' : `.${provider.name}/RULES-BOUND.md`;
205
+ const indexRel = provider.name === 'copilot' ? '.github/RULES-BOUND.md' : provider.name === 'flue' ? '.agents/.aiwg/RULES-BOUND.md' : `.${provider.name === 'devin' ? 'windsurf' : provider.name}/RULES-BOUND.md`;
205
206
  const indexFile = path.join(opts.target, indexRel);
206
207
  const anchor = boundRuleAnchor;
207
208
  const sections = new Map();
@@ -288,10 +289,11 @@ export function projectBoundFlowSkills(opts, provider, selected) {
288
289
  opts.flowSkillSources = new Map();
289
290
  if (opts.rulesOnly || opts.commandsOnly || !(opts.deploySkills || opts.skillsOnly)) return;
290
291
  const kernel = path.isAbsolute(provider.kernelSkillsPath || '') ? opts.kernelSkillsPath
291
- : path.join(opts.target, provider.kernelSkillsPath || `.${provider.name}/skills`);
292
+ : path.join(opts.target, provider.kernelSkillsPath || `.${provider.name === 'devin' ? 'windsurf' : provider.name}/skills`);
292
293
  // Codex's opt-in standard tier shares the native skills directory.
293
- const standard = provider.name === 'codex' ? kernel : path.isAbsolute(provider.paths.skills)
294
- ? provider.paths.skills : path.join(opts.target, provider.paths.skills);
294
+ const standardPath = provider.standardSkillsPath || provider.paths.skills;
295
+ const standard = provider.name === 'codex' ? kernel : path.isAbsolute(standardPath)
296
+ ? standardPath : path.join(opts.target, standardPath);
295
297
  const flows = opts.ruleDelivery.targets.filter(entry => entry.type === 'flow' && selected(entry));
296
298
  const sources = new Set(flows.map(entry => entry.source));
297
299
  for (const root of new Set([kernel, standard])) {
@@ -335,9 +337,11 @@ export function projectBoundFlowSkills(opts, provider, selected) {
335
337
  const projected = provider.transformSkillMd ? provider.transformSkillMd(markdown, opts) : markdown;
336
338
  const content = managed(replaceBoundRulesBlock(projected, opts.ruleDelivery.bindings.get(entry.source)), opts);
337
339
  put(file, content);
338
- put(path.join(dir, '.aiwg-managed'), 'true\n');
340
+ put(path.join(dir, '.aiwg-managed'), 'aiwg\n');
341
+ const frameworkSlug = extractFrameworkSlug(opts.logicalInputPath?.(entry.source) || entry.source);
339
342
  put(receiptFile, `${JSON.stringify({ flowSource: entry.source,
340
- managed: { 'SKILL.md': { sourcePath: entry.source, hash: `sha256:${contentHash(content)}` } } }, null, 2)}\n`);
343
+ managed: { 'SKILL.md': { sourcePath: entry.source, source: opts.deploySource || 'bundled',
344
+ ...(frameworkSlug ? { frameworkSlug } : {}), hash: `sha256:${contentHash(content)}` } } }, null, 2)}\n`);
341
345
  }
342
346
  opts.flowSkillSources.set(file, entry.source);
343
347
  if (['warp', 'hermes'].includes(provider.name)) opts.definitionRoutes.push(`${name}: ${file}`);
@@ -371,7 +375,7 @@ export function startupFiles(opts, provider) {
371
375
  // Count managed rule sections while preserving historical accounting for
372
376
  // operator aggregates; discrete hook-reached rule files are counted above.
373
377
  if ((provider.name === 'warp' && path.basename(file) === 'WARP.md')
374
- || (provider.name === 'windsurf' && file === path.join(opts.target, 'AGENTS.md'))) content = warpRuleContent(content);
378
+ || (provider.name === 'devin' && file === path.join(opts.target, 'AGENTS.md'))) content = warpRuleContent(content);
375
379
  return { path: file, content };
376
380
  });
377
381
  }
@@ -62,7 +62,7 @@ export async function prepareRuleDeployment(original, provider, deploy) {
62
62
 
63
63
  async function prepareWithInputs(original, provider, deploy) {
64
64
  const budgetEnv = { ...process.env };
65
- const ruleDir = path.isAbsolute(provider.paths.rules || '') ? provider.paths.rules : path.join(original.target, provider.paths.rules || `.${provider.name}/rules`);
65
+ const ruleDir = path.isAbsolute(provider.paths.rules || '') ? provider.paths.rules : path.join(original.target, provider.paths.rules || `.${provider.name === 'devin' ? 'windsurf' : provider.name}/rules`);
66
66
  const manifestFile = path.join(ruleDir, '.aiwg-manifest.json');
67
67
  const previousText = fs.existsSync(manifestFile) ? read(manifestFile) : '';
68
68
  const previous = previousText ? JSON.parse(previousText) : {};
@@ -229,13 +229,13 @@ async function prepareWithInputs(original, provider, deploy) {
229
229
  // Mount directories independently so only provider-owned surfaces are promoted.
230
230
  const relativeRoots = Object.values(provider.paths).filter(dir => dir && !path.isAbsolute(dir))
231
231
  .map(dir => dir.split(/[\\/]/)[0]).filter(dir => dir && dir !== '.' && !path.extname(dir));
232
- for (const dir of new Set([`.${provider.name}`, '.agents', '.aiwg/skills', ...relativeRoots])) mount(path.join(target, dir), path.join(stage, dir));
232
+ for (const dir of new Set([`.${provider.name === 'devin' ? 'windsurf' : provider.name}`, '.agents', '.aiwg/skills', ...relativeRoots])) mount(path.join(target, dir), path.join(stage, dir));
233
233
  fs.mkdirSync(path.join(stage, '.aiwg'), { recursive: true });
234
234
  if (fs.existsSync(projectSnapshot)) materializeInput(projectSnapshot, path.join(stage, '.aiwg', 'aiwg.config'));
235
235
  const rootNames = ['opencode.json', ...GENERATED_CONTEXT_NAMES, ...OPERATOR_CONTEXT_NAMES, '.aiwg/frameworks/registry.json'];
236
236
  if (provider.name === 'openclaw' && original.contextFiles !== false) rootNames.push('SOUL.md');
237
237
  if (provider.deploymentFiles) rootNames.push(...provider.deploymentFiles(target));
238
- if (provider.name === 'windsurf') rootNames.push('.windsurfrules');
238
+ if (provider.name === 'devin') rootNames.push('.windsurfrules');
239
239
  for (const framework of getFrameworksForMode(original.srcRoot, original.mode)) {
240
240
  for (const entry of framework.manifest?.memory?.creates || []) {
241
241
  if (typeof entry?.path !== 'string' || !entry.path.startsWith('.aiwg/') || !path.extname(entry.path)) continue;
@@ -372,13 +372,13 @@ async function prepareWithInputs(original, provider, deploy) {
372
372
  }
373
373
  }
374
374
  projectBoundFlowSkills(opts, provider, selected);
375
- if (['warp', 'windsurf'].includes(provider.name)) {
376
- for (const file of walk(path.join(stage, `.${provider.name}`, 'commands'))) {
377
- if (/\.md$/.test(file)) opts.definitionRoutes.push(`${path.basename(file, '.md')}: .${provider.name}/commands/${path.basename(file)}`);
375
+ if (['warp', 'devin'].includes(provider.name)) {
376
+ for (const file of walk(path.join(stage, `.${provider.name === 'devin' ? 'windsurf' : provider.name}`, 'commands'))) {
377
+ if (/\.md$/.test(file)) opts.definitionRoutes.push(`${path.basename(file, '.md')}: .${provider.name === 'devin' ? 'windsurf' : provider.name}/commands/${path.basename(file)}`);
378
378
  }
379
379
  for (const entry of delivery.targets.filter(entry => entry.type === 'agent' && selected(entry))) {
380
- const dest = path.join(stage, `.${provider.name}`, 'agents', path.basename(entry.source));
381
- if (fs.existsSync(dest)) opts.definitionRoutes.push(`${entry.name}: .${provider.name}/agents/${path.basename(entry.source)}`);
380
+ const dest = path.join(stage, `.${provider.name === 'devin' ? 'windsurf' : provider.name}`, 'agents', path.basename(entry.source));
381
+ if (fs.existsSync(dest)) opts.definitionRoutes.push(`${entry.name}: .${provider.name === 'devin' ? 'windsurf' : provider.name}/agents/${path.basename(entry.source)}`);
382
382
  }
383
383
  }
384
384
  if (!opts.deferRuleProjection) {
@@ -22,19 +22,19 @@ export function ruleRemovalReason(file) {
22
22
  return ` (${level} retired because the selected deployment no longer projects its source at this path)`;
23
23
  }
24
24
  const put = (file, content) => { fs.mkdirSync(path.dirname(file), { recursive: true }); fs.writeFileSync(file, content); };
25
- export const nativeRuleLoader = name => ['claude', 'cursor', 'grok-build', 'windsurf', 'opencode'].includes(name);
26
- export const nativePathLoader = name => ['claude', 'cursor', 'windsurf'].includes(name);
25
+ export const nativeRuleLoader = name => ['claude', 'cursor', 'grok-build', 'devin', 'opencode'].includes(name);
26
+ export const nativePathLoader = name => ['claude', 'cursor', 'devin'].includes(name);
27
27
  export function ruleDirectory(opts, provider) {
28
28
  // Muse has no declared rules path; use its existing .muse harness convention.
29
- const dir = provider.paths.rules || (provider.name === 'grok-build' ? '.grok/rules' : `.${provider.name}/rules`);
29
+ const dir = provider.paths.rules || (provider.name === 'grok-build' ? '.grok/rules' : `.${provider.name === 'devin' ? 'windsurf' : provider.name}/rules`);
30
30
  return path.isAbsolute(dir) ? dir : path.join(opts.target, dir);
31
31
  }
32
32
  const ruleName = (rule, provider) => rule.behavior
33
- ? `${['grok-build', 'windsurf'].includes(provider.name) ? 'behavior-' : 'behaviors/'}${path.basename(path.dirname(rule.file))}`
33
+ ? `${['grok-build', 'devin'].includes(provider.name) ? 'behavior-' : 'behaviors/'}${path.basename(path.dirname(rule.file))}`
34
34
  : path.basename(rule.file, '.md');
35
35
  function nativeContent(provider, rule, content, opts) {
36
36
  if (provider.name === 'cursor') return provider.transformRule(rule.file, content, opts);
37
- if (provider.name === 'windsurf') {
37
+ if (provider.name === 'devin') {
38
38
  const parsed = parseRuleFrontmatter(content);
39
39
  const data = { ...parsed.data, trigger: rule.activation === 'paths' ? 'glob' : 'always_on' };
40
40
  if (rule.activation === 'paths') data.glob = rule.paths.join(',');
@@ -11,7 +11,7 @@ const read = file => fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : '';
11
11
  export const inlineStartup = {
12
12
  codex: 'AGENTS.md', flue: 'AGENTS.md', pi: 'AGENTS.md', hermes: 'AGENTS.md', warp: 'WARP.md',
13
13
  copilot: '.github/copilot-instructions.md', factory: 'AGENTS.md', opencode: 'AGENTS.md',
14
- windsurf: 'AGENTS.md', antigravity: 'AGENTS.md', muse: 'AGENTS.md',
14
+ devin: 'AGENTS.md', antigravity: 'AGENTS.md', muse: 'AGENTS.md',
15
15
  omp: '.omp/AGENTS.md', 'grok-build': 'AGENTS.md',
16
16
  };
17
17
  function section(content, owner, body) {
@@ -17,7 +17,11 @@ export function removeSkillCopy(dir, opts = {}) {
17
17
  return false;
18
18
  };
19
19
  let receipt;
20
- try { receipt = JSON.parse(fs.readFileSync(path.join(dir, '.aiwg-manifest.json'), 'utf8')); }
20
+ try {
21
+ const manifest = path.join(dir, '.aiwg-manifest.json');
22
+ if (!fs.lstatSync(manifest).isFile()) return keep('unverifiable ownership');
23
+ receipt = JSON.parse(fs.readFileSync(manifest, 'utf8'));
24
+ }
21
25
  catch (error) {
22
26
  if (opts.bundleOnly) return false;
23
27
  // Only a missing receipt may use legacy ownership. An invalid receipt must
@@ -1,10 +1,10 @@
1
1
  import { withModelWrapper } from './model-wrapper.mjs';
2
2
  import { importImpl } from '../../_resolve-impl.mjs';
3
3
  /**
4
- * Devin Desktop Provider (Windsurf compatibility adapter)
4
+ * Devin Desktop Provider (legacy path compatibility adapter)
5
5
  *
6
- * Deploys agents to the Devin Desktop/Windsurf compatibility surface with
7
- * minimal AGENTS.md hooks and trigger-frontmatter rules. The provider id and
6
+ * Deploys agents to the Devin Desktop compatibility surface with
7
+ * minimal AGENTS.md hooks and trigger-frontmatter rules. The deprecated selector and
8
8
  * generated `.windsurf/` paths remain stable for backward compatibility.
9
9
  *
10
10
  * Deployment paths:
@@ -22,7 +22,7 @@ import { importImpl } from '../../_resolve-impl.mjs';
22
22
  * - Capabilities tags for tools
23
23
  * - Workflow format for commands
24
24
  * - Conventional skills and rules deployment
25
- * - Devin Desktop selectors resolve to the stable `windsurf` provider id
25
+ * - Devin Desktop selectors resolve to the canonical `devin` provider id
26
26
  */
27
27
  import realFs from 'fs';
28
28
  import { createRequire } from 'module';
@@ -59,8 +59,8 @@ import { writeContextFileSync } from './context-write.mjs';
59
59
  // ============================================================================
60
60
  // Provider Configuration
61
61
  // ============================================================================
62
- export const name = 'windsurf';
63
- export const aliases = ['devin', 'devin-desktop', 'devin-local', 'cascade'];
62
+ export const name = 'devin';
63
+ export const aliases = ['windsurf', 'devin-desktop', 'devin-local', 'cascade'];
64
64
 
65
65
  export const paths = {
66
66
  agents: '.windsurf/agents/', // Discrete mirrors alongside AGENTS.md
@@ -93,9 +93,9 @@ export const capabilities = {
93
93
  // ============================================================================
94
94
 
95
95
  /**
96
- * Transform agent content to Windsurf format (plain markdown, no YAML frontmatter)
96
+ * Transform agent content to Devin Desktop format (plain markdown, no YAML frontmatter)
97
97
  */
98
- export const transformAgent = withModelWrapper('windsurf', translateAgent);
98
+ export const transformAgent = withModelWrapper('devin', translateAgent);
99
99
  function translateAgent(srcPath, content, opts) {
100
100
  const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
101
101
  if (!fmMatch) return content;
@@ -108,7 +108,7 @@ function translateAgent(srcPath, content, opts) {
108
108
  const toolsMatch = frontmatter.match(/tools:\s*(.+)/)?.[1]?.trim();
109
109
  const modelMatch = frontmatter.match(/model:\s*(.+)/)?.[1]?.trim();
110
110
 
111
- // Build Windsurf-compatible format (plain markdown, no YAML)
111
+ // Build Devin Desktop-compatible format (plain markdown, no YAML)
112
112
  const lines = [];
113
113
  lines.push(`### ${name}`);
114
114
  lines.push('');
@@ -146,7 +146,7 @@ function translateAgent(srcPath, content, opts) {
146
146
  }
147
147
 
148
148
  /**
149
- * Transform command content to Windsurf workflow format
149
+ * Transform command content to Devin Desktop workflow format
150
150
  */
151
151
  export function transformCommand(srcPath, content, opts) {
152
152
  const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
@@ -177,15 +177,15 @@ export function transformCommand(srcPath, content, opts) {
177
177
  }
178
178
 
179
179
  /**
180
- * Transform rule content for Windsurf — injects trigger frontmatter per ADR-2.
180
+ * Transform rule content for Devin Desktop — injects trigger frontmatter per ADR-2.
181
181
  *
182
182
  * Defaults to `trigger: always_on` (the ADR-2 §2 default-preservation choice
183
183
  * for the existing AIWG rule corpus). When the source frontmatter declares
184
184
  * a `globs:` or `applyTo:` field, the trigger is upgraded to `glob` and the
185
- * glob pattern is passed through as the Windsurf-native `glob:` field
185
+ * glob pattern is passed through as the Devin Desktop-native `glob:` field
186
186
  * (PUW-020 / #1121, glob-mode part of ADR-2 §1 mapping).
187
187
  *
188
- * Per ADR-2 §5: non-always_on modes require a live-Windsurf smoke test
188
+ * Per ADR-2 §5: non-always_on modes require a live-Devin Desktop smoke test
189
189
  * gate before shipping to operators with the live loader. Until that gate
190
190
  * lands, the safe default is preserved for rules without explicit globs.
191
191
  */
@@ -205,7 +205,7 @@ export function transformRule(srcPath, content, opts) {
205
205
  if (globsMatch || applyToMatch) {
206
206
  const globValue = (globsMatch?.[1] || applyToMatch?.[1] || '').trim().replace(/^['"]|['"]$/g, '');
207
207
  const triggerLines = [`trigger: glob`];
208
- // Add Windsurf-native `glob:` field if not already present.
208
+ // Add Devin Desktop-native `glob:` field if not already present.
209
209
  if (!/^\s*glob\s*:/m.test(frontmatter)) {
210
210
  triggerLines.push(`glob: '${globValue}'`);
211
211
  }
@@ -221,7 +221,7 @@ export function transformRule(srcPath, content, opts) {
221
221
  }
222
222
 
223
223
  // ============================================================================
224
- // Model Mapping (not applicable for Windsurf)
224
+ // Model Mapping (not applicable for Devin Desktop)
225
225
  // ============================================================================
226
226
 
227
227
  export function mapModel(shorthand, modelCfg, modelsConfig) {
@@ -233,7 +233,7 @@ export function mapModel(shorthand, modelCfg, modelsConfig) {
233
233
  // ============================================================================
234
234
 
235
235
  /**
236
- * Generate AGENTS.md for Windsurf with all agents aggregated
236
+ * Generate AGENTS.md for Devin Desktop with all agents aggregated
237
237
  */
238
238
  export function generateAgentsMd(files, destPath, opts) {
239
239
  if (opts.contextFiles === false) return;
@@ -254,7 +254,7 @@ export function generateAgentsMd(files, destPath, opts) {
254
254
  /**
255
255
  * Generate .windsurf/rules/aiwg-orchestration.md with trigger: always_on frontmatter.
256
256
  * Also writes a deprecated .windsurfrules stub for backward compatibility — that file
257
- * may be silently ignored by Windsurf (not documented in official docs).
257
+ * may be silently ignored by Devin Desktop (not documented in official docs).
258
258
  */
259
259
  export function generateWindsurfRules(srcRoot, target, opts) {
260
260
  const { dryRun } = opts;
@@ -267,7 +267,7 @@ export function generateWindsurfRules(srcRoot, target, opts) {
267
267
  lines.push('# AIWG Orchestration for Devin Desktop');
268
268
  lines.push('');
269
269
  lines.push('<!--');
270
- lines.push(' Generated by AIWG for Devin Desktop using the Windsurf compatibility adapter.');
270
+ lines.push(' Generated by AIWG for Devin Desktop using the legacy path compatibility adapter.');
271
271
  lines.push(' This file provides orchestration context for AIWG SDLC workflows.');
272
272
  lines.push(' trigger: always_on — included in system prompt on every message.');
273
273
  lines.push('-->');
@@ -370,14 +370,14 @@ export function generateWindsurfRules(srcRoot, target, opts) {
370
370
 
371
371
  // Deprecated stub: .windsurfrules — retained for backward compat only
372
372
  const stubLines = [
373
- '# AIWG Rules for Windsurf — Deprecated',
373
+ '# AIWG Rules for Devin Desktop — Deprecated',
374
374
  '',
375
375
  '> **This file is deprecated.**',
376
- '> Windsurf reads `.windsurf/rules/*.md` natively (see official docs).',
376
+ '> Devin Desktop reads `.windsurf/rules/*.md` natively (see official docs).',
377
377
  '> AIWG orchestration context is now deployed to:',
378
378
  '> `.windsurf/rules/aiwg-orchestration.md` (trigger: always_on)',
379
379
  '>',
380
- '> This root-level file may be silently ignored by Windsurf.',
380
+ '> This root-level file may be silently ignored by Devin Desktop.',
381
381
  '> It is retained only for backward compatibility and will be removed in a future release.',
382
382
  ];
383
383
  const stubPath = path.join(target, '.windsurfrules');
@@ -395,7 +395,7 @@ export function generateWindsurfRules(srcRoot, target, opts) {
395
395
  // ============================================================================
396
396
 
397
397
  /**
398
- * Deploy commands as Windsurf workflows
398
+ * Deploy commands as Devin Desktop workflows
399
399
  */
400
400
  export function deployWorkflows(commandFiles, targetDir, opts) {
401
401
  const { dryRun } = opts;
@@ -405,7 +405,7 @@ export function deployWorkflows(commandFiles, targetDir, opts) {
405
405
  ensureDir(workflowsDir);
406
406
  }
407
407
 
408
- console.log(`\nDeploying ${commandFiles.length} commands as Windsurf workflows to ${workflowsDir}...`);
408
+ console.log(`\nDeploying ${commandFiles.length} commands as Devin Desktop workflows to ${workflowsDir}...`);
409
409
 
410
410
  for (const cmdFile of commandFiles) {
411
411
  const content = fs.readFileSync(cmdFile, 'utf8');
@@ -581,7 +581,7 @@ async function deploySelected(opts) {
581
581
  skillDirs.push(...frameworkSkills.skills);
582
582
  }
583
583
 
584
- // Deploy commands as Windsurf workflows
584
+ // Deploy commands as Devin Desktop workflows
585
585
  if (deployCommands || commandsOnly) {
586
586
  // Collect command files based on mode
587
587
  const commandFiles = [];
@@ -656,10 +656,10 @@ async function deploySelected(opts) {
656
656
  await postDeploy(target, opts);
657
657
 
658
658
  console.log('\n' + '='.repeat(70));
659
- console.log('Windsurf deployment complete. Generated files:');
659
+ console.log('Devin Desktop deployment complete. Generated files:');
660
660
  console.log(' - AGENTS.md (agent catalog)');
661
661
  console.log(' - .windsurf/rules/aiwg-orchestration.md (orchestration context, trigger: always_on)');
662
- console.log(' - .windsurfrules (deprecated stub — Windsurf may ignore this file)');
662
+ console.log(' - .windsurfrules (deprecated stub — Devin Desktop may ignore this file)');
663
663
  if (deployCommands || commandsOnly) {
664
664
  console.log(' - .windsurf/workflows/ (commands as workflows)');
665
665
  }
@@ -5,7 +5,7 @@ import { importImpl } from '../_resolve-impl.mjs';
5
5
  const { loadRulePinConfigs } = await importImpl(import.meta.url, 'rules/pins.mjs');
6
6
 
7
7
  export function useRuleSelectionConfig(cfg, srcRoot) {
8
- if (!cfg.ruleSelectionMode || cfg.kernelOnly) return undefined;
8
+ if (!cfg.ruleSelectionMode || cfg.kernelOnly && !(cfg.discoveryOnly && cfg.ruleSelectionMode !== 'all')) return undefined;
9
9
  const root = resolveAiwgRoot(srcRoot) || srcRoot;
10
10
  const frameworks = getFrameworksForMode(root, cfg.ruleSelectionMode);
11
11
  if (!frameworks.length) return undefined;
@@ -0,0 +1,38 @@
1
+ // Add Muse's shared skill inventory and use the deployment probe as dashboard health authority.
2
+ import fs from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { importImpl } from '../_resolve-impl.mjs';
5
+
6
+ export async function appendMuseDeployment(projectRoot, deployments, config) {
7
+ const configured = config?.providers?.includes('muse')
8
+ || Object.values(config?.installed ?? {}).some(entry => entry.deployedTo?.muse);
9
+ if (!configured) return deployments;
10
+ const { getProviderDefinition } = await importImpl(import.meta.url, 'providers/provider-definitions.js');
11
+ const definition = getProviderDefinition('muse');
12
+ const counts = {};
13
+ for (const [kind, directory] of Object.entries({
14
+ skills: definition.paths.kernelSkills, rules: definition.paths.artifacts.rules, hooks: '.muse/hooks',
15
+ })) {
16
+ try {
17
+ const entries = await fs.readdir(path.join(projectRoot, directory), { withFileTypes: true });
18
+ const count = entries.filter(entry => !entry.name.startsWith('.')).length;
19
+ if (count) counts[kind] = count;
20
+ } catch (error) { if (error.code !== 'ENOENT') throw error; }
21
+ }
22
+ return [...deployments, { name: 'muse', path: '.muse', counts, lastRefresh: null }];
23
+ }
24
+
25
+ export async function applyDeploymentHealth(result, projectRoot, frameworkRoot) {
26
+ const { buildDeploymentStatusProbe } = await importImpl(import.meta.url, 'cli/services/deployment-verification.js');
27
+ const probe = await buildDeploymentStatusProbe(projectRoot, frameworkRoot);
28
+ if (probe.status === 'not-configured') return;
29
+ const rank = { unknown: 0, healthy: 1, warning: 2, error: 3 };
30
+ if (rank[probe.checks.health] > rank[result.health.overall]) result.health.overall = probe.checks.health;
31
+ for (const item of probe.deployment_verification.findings) {
32
+ if (item.severity === 'info') continue;
33
+ result.health.issues.push({
34
+ severity: item.severity === 'blocking' ? 'error' : 'warning',
35
+ message: `${item.provider}: ${item.message}`, action: item.remediation,
36
+ });
37
+ }
38
+ }
@@ -20,6 +20,7 @@
20
20
  */
21
21
 
22
22
  import fs from 'fs/promises';
23
+ import { appendMuseDeployment, applyDeploymentHealth } from './workspace-deployment-health.mjs';
23
24
  import { readAuthorizationHealth } from './authorization-health.mjs';
24
25
  import { importImpl } from '../_resolve-impl.mjs';
25
26
  import { collectDecisionOffloadReport, formatDecisionOffloadReport } from './decision-offload-report.mjs';
@@ -220,7 +221,7 @@ function normalizeRegistryFrameworks(registry) {
220
221
  async function countDirEntries(dirPath) {
221
222
  try {
222
223
  const entries = await fs.readdir(dirPath, { withFileTypes: true });
223
- return entries.length;
224
+ return entries.filter(entry => !entry.name.startsWith('.')).length;
224
225
  } catch {
225
226
  return 0;
226
227
  }
@@ -234,6 +235,7 @@ async function collectProviderDeployments(projectRoot) {
234
235
  { name: 'cursor', path: '.cursor', artifactDirs: ['agents', 'commands', 'skills', 'rules'] },
235
236
  { name: 'opencode', path: '.opencode', artifactDirs: ['agent', 'command', 'skill', 'rule'] },
236
237
  { name: 'warp', path: '.warp', artifactDirs: ['agents', 'commands', 'skills', 'rules'] },
238
+ { name: 'devin', path: '.windsurf', artifactDirs: ['agents', 'workflows', 'skills', 'rules'] },
237
239
  { name: 'universal', path: '.agents', artifactDirs: ['agents', 'commands', 'skills', 'rules'] }
238
240
  ];
239
241
 
@@ -489,7 +491,7 @@ async function buildWorkspaceStatus(projectRoot) {
489
491
  });
490
492
  }
491
493
 
492
- result.providerDeployments = await collectProviderDeployments(projectRoot);
494
+ result.providerDeployments = await appendMuseDeployment(projectRoot, await collectProviderDeployments(projectRoot), configRead.data);
493
495
  result.projectLocalBundles = await collectProjectLocalBundles(
494
496
  aiwgPath,
495
497
  new Set(result.frameworks.map(framework => framework.id))
@@ -522,6 +524,7 @@ async function buildWorkspaceStatus(projectRoot) {
522
524
  });
523
525
  }
524
526
 
527
+ await applyDeploymentHealth(result, projectRoot, packageRoot);
525
528
  return result;
526
529
  }
527
530
 
@@ -80,8 +80,8 @@ const PROVIDER_SOURCES = [
80
80
  integrationDocs: [],
81
81
  },
82
82
  {
83
- id: 'windsurf',
84
- displayName: 'Windsurf',
83
+ id: 'devin',
84
+ displayName: 'Devin Desktop',
85
85
  sources: [
86
86
  { type: 'changelog-url', url: 'https://windsurf.com/changelog' },
87
87
  { type: 'docs-url', url: 'https://docs.windsurf.com' },
@@ -139,7 +139,7 @@ export class ProviderWatcher extends EventEmitter {
139
139
  constructor(options = {}) {
140
140
  super();
141
141
  this.stateDir = options.stateDir || '.aiwg/daemon/provider-watch';
142
- this.providers = options.providers || PROVIDER_SOURCES.map((p) => p.id);
142
+ this.providers = (options.providers || PROVIDER_SOURCES.map((p) => p.id)).map(id => id === 'windsurf' ? 'devin' : id);
143
143
  this.intervalHours = options.intervalHours || 6;
144
144
  // npm keeps its own config/registry variables; only daemon secrets are removed.
145
145
  this.environment = options.environment;
@@ -145,16 +145,24 @@ Marketing automation framework with 37 specialized agents.
145
145
  },
146
146
  extraCopy: [
147
147
  { from: 'agentic/code/addons/voice-framework/voices', to: 'voices' },
148
+ { from: 'agentic/code/addons/writing-quality/patterns/common-ai-tells.md', to: 'docs/structural-editing.md' },
149
+ { from: 'agentic/code/addons/writing-quality/skills/ai-pattern-detection/references/current-patterns.json', to: 'docs/current-patterns.json' },
148
150
  { from: 'agentic/code/addons/voice-framework/docs/writing-workflows.md', to: 'docs/writing-workflows.md' },
149
151
  { from: 'agentic/code/addons/voice-framework/docs/voice-output-impact.md', to: 'docs/voice-output-impact.md' },
150
152
  { from: 'agentic/code/addons/voice-framework/docs/natural-voice/ADR-001-evidence-and-ownership.md', to: 'docs/natural-voice/ADR-001-evidence-and-ownership.md' },
151
153
  { from: 'agentic/code/addons/voice-framework/docs/natural-voice/evidence-ledger.v1.json', to: 'docs/natural-voice/evidence-ledger.v1.json' },
152
154
  { from: 'agentic/code/addons/voice-framework/flows/voice-critique-correction.flow.yaml', to: 'flows/voice-critique-correction.flow.yaml' }
153
155
  ],
156
+ rewrites: [
157
+ ...['voice-apply', 'voice-create'].map(name => ({ file: `skills/${name}/SKILL.md`, from: '../../../writing-quality/patterns/common-ai-tells.md', to: '../../docs/structural-editing.md' })),
158
+ { file: 'docs/structural-editing.md', from: '../skills/ai-pattern-detection/references/current-patterns.json', to: 'current-patterns.json' }
159
+ ],
154
160
  readme: `# AIWG Voice Framework
155
161
 
156
162
  Voice profile system for consistent, authentic writing.
157
163
 
164
+ Use the [shared structural editing rules](docs/structural-editing.md) for tiered examples, campaign review and substance checks. These are editing guidelines, not authorship detection.
165
+
158
166
  ## Built-in Profiles
159
167
 
160
168
  - **technical-authority**: Direct, precise, confident
@@ -198,13 +206,19 @@ Voice profile system for consistent, authentic writing.
198
206
  agents: 'agentic/code/addons/writing-quality/agents',
199
207
  skills: 'agentic/code/addons/writing-quality/skills'
200
208
  },
209
+ extraCopy: [
210
+ { from: 'agentic/code/addons/writing-quality/patterns', to: 'patterns' },
211
+ { from: 'agentic/code/addons/writing-quality/validation', to: 'validation' }
212
+ ],
201
213
  readme: `# AIWG Writing Quality
202
214
 
203
- Writing quality validation and AI pattern detection.
215
+ Writing quality validation and contextual editing guidance.
216
+
217
+ Use the [shared structural editing rules](patterns/common-ai-tells.md) and [review checklist](validation/banned-patterns.md) for tiered examples, campaign review and substance checks. These are editing guidelines, not authorship detection.
204
218
 
205
219
  ## Features
206
220
 
207
- - **AI Pattern Detection**: Identify AI-generated writing patterns
221
+ - **Structural Review**: Review formulaic writing patterns in context
208
222
  - **Authenticity Enhancement**: Suggestions for more authentic voice
209
223
  - **Writing Validation**: Check against AIWG principles
210
224
 
@@ -73,21 +73,9 @@ registerProvider('dsh', () => new DeepSeekHarnessAdapter());
73
73
  * proves neither that `sandbox-policy.mode` actually confines file/exec
74
74
  * access, nor what `approval.policy: "never"` actually permits, because
75
75
  * no probe can exercise a tool call without a real model response.
76
- * - The stock `permission` (`@deepseek-ai/dsh-permission-presets`) plugin
77
- * fails to mount for the `workspace-write` + `never` combination
78
- * (`dsh: warning: 1 entry did not activate` / `permission: composed
79
- * sandbox and approval defaults match no preset; configure
80
- * defaultPreset explicitly`, confirmed live on the no-model probe).
81
- * That means the stock preset-switch plugin is NOT mounted for this
82
- * combination — it says nothing about whether `sandbox-policy`/
83
- * `approval` themselves still enforce anything; it is evidence of an
84
- * unmatched preset table entry, not evidence of functioning
85
- * confinement.
86
- * - `danger-full-access` (the only shipped preset pairing `approval:
87
- * never`) is a full bypass and is never emitted by this profile. No
88
- * analogy to another CLI's `-s workspace-write -c
89
- * approval_policy="never"` semantics is drawn here: dsh's own
90
- * behavior for this combination is simply unverified.
76
+ * - The patch declares a matching named permission preset and explicit
77
+ * defaultPreset for every accepted sandbox/approval pairing (#4313).
78
+ * Plugin activation does not establish sandbox enforcement.
91
79
  *
92
80
  * Because of this, `model`/`effort`/`sandbox`/`approval` stay `unqualified`
93
81
  * in the registry below, matching grok-build/cursor/opencode's convention
@@ -101,7 +89,8 @@ registerProvider('dsh', () => new DeepSeekHarnessAdapter());
101
89
  * `DEEPSEEK_API_KEY` is the credential env var the no-model probe's
102
90
  * `MISSING_CREDENTIAL` error names (`llm-deepseek: no API key for
103
91
  * provider route "deepseek-official"; ... export DEEPSEEK_API_KEY`); it is
104
- * the one env allowlist entry (name only, value never rendered).
92
+ * the default route credential. The opt-in direct-shell-openrouter profile
93
+ * instead allowlists OPENROUTER_API_KEY (names only, values never rendered).
105
94
  *
106
95
  * KNOWN GAP (isolation): `getEnvOverrides()` is called with no invocation
107
96
  * context (`session-launcher.mjs` ~847: `providerAdapter.getEnvOverrides()`),
@@ -133,7 +122,7 @@ registerProvider('dsh', () => new DeepSeekHarnessAdapter());
133
122
  * `{"type":"error",...}` line and no `tool_result` with `status:"error"`
134
123
  * anywhere.
135
124
  */
136
- export const DEEPSEEK_HARNESS_SUPPORTED_VERSIONS = Object.freeze(['0.2.0-rc.2']);
125
+ export const DEEPSEEK_HARNESS_SUPPORTED_VERSIONS = Object.freeze(['0.2.0-rc.2', '0.2.2-rc.1']);
137
126
  export const DEEPSEEK_HARNESS_DIRECT_EFFORT_VALUES = Object.freeze(['off', 'low', 'high', 'max']);
138
127
  export const DEEPSEEK_HARNESS_DIRECT_SANDBOX_MODES = Object.freeze(['read-only', 'workspace-write']);
139
128
  /** Non-prompting execution only: `ask` (the only alternative the CLI's own
@@ -190,6 +179,14 @@ function normalizeDeepSeekHarnessApproval(approval) {
190
179
  return approval;
191
180
  }
192
181
 
182
+ function normalizeDeepSeekHarnessProvider(provider = 'deepseek-official') {
183
+ if (provider === 'deepseek') return 'deepseek-official';
184
+ if (!['deepseek-official', 'openrouter'].includes(provider)) {
185
+ throw new Error('DeepSeek Harness worker requires a supported inference provider');
186
+ }
187
+ return provider;
188
+ }
189
+
193
190
  /** Pure: the `--patch` overlay YAML text for one invocation's model,
194
191
  * effort, sandbox and approval. Performs no I/O — see the module-level
195
192
  * execution-time artifact contract. Exported so tests and the docs' manual smoke
@@ -197,16 +194,21 @@ function normalizeDeepSeekHarnessApproval(approval) {
197
194
  * a conservative charset/enum AND `JSON.stringify`-quoted in the emitted
198
195
  * YAML (defense in depth): neither alone is trusted. The patch never
199
196
  * carries the brief or a credential.
200
- * @param {{ model: unknown, effort: unknown, sandbox: unknown, approval: unknown }} selection
197
+ * @param {{ model: unknown, effort: unknown, sandbox: unknown, approval: unknown, inferenceProvider?: unknown }} selection
201
198
  * @returns {string}
202
199
  */
203
- export function buildDeepSeekHarnessPatch({ model, effort, sandbox, approval }) {
200
+ export function buildDeepSeekHarnessPatch({ model, effort, sandbox, approval, inferenceProvider }) {
204
201
  const safeModel = normalizeDeepSeekHarnessModel(model);
205
202
  const safeEffort = normalizeDeepSeekHarnessEffort(effort);
206
203
  const safeSandbox = normalizeDeepSeekHarnessSandbox(sandbox);
207
204
  const safeApproval = normalizeDeepSeekHarnessApproval(approval);
208
- const provider = 'deepseek-official';
205
+ const provider = normalizeDeepSeekHarnessProvider(inferenceProvider);
206
+ const preset = `headless-${safeSandbox}`;
209
207
  return [
208
+ ...(provider === 'openrouter' ? [
209
+ '- id: llm-pi-ai', ' config:', ' providers:', ' openrouter:',
210
+ ' apiKeyEnv: OPENROUTER_API_KEY',
211
+ ] : []),
210
212
  '- id: agent-default-model',
211
213
  ' config:',
212
214
  ` provider: ${JSON.stringify(provider)}`,
@@ -218,6 +220,13 @@ export function buildDeepSeekHarnessPatch({ model, effort, sandbox, approval })
218
220
  '- id: approval',
219
221
  ' config:',
220
222
  ` policy: ${JSON.stringify(safeApproval)}`,
223
+ '- id: permission',
224
+ ' config:',
225
+ ` defaultPreset: ${JSON.stringify(preset)}`,
226
+ ' presets:',
227
+ ` ${preset}:`,
228
+ ` sandbox: ${JSON.stringify(safeSandbox)}`,
229
+ ` approval: ${JSON.stringify(safeApproval)}`,
221
230
  '',
222
231
  ].join('\n');
223
232
  }
@@ -338,7 +347,12 @@ export class DeepSeekHarnessDirectAdapter extends DeepSeekHarnessAdapter {
338
347
  const effort = invocation?.selected?.effort?.value;
339
348
  const sandbox = permissions.sandbox ?? 'workspace-write';
340
349
  const approval = permissions.approval ?? 'never';
341
- buildDeepSeekHarnessPatch({ model, effort, sandbox, approval });
350
+ const inferenceProvider = normalizeDeepSeekHarnessProvider(invocation?.selected?.inferenceProvider);
351
+ const key = inferenceProvider === 'openrouter' ? 'OPENROUTER_API_KEY' : 'DEEPSEEK_API_KEY';
352
+ if (_profile && !_profile.envAllowlist?.includes(key)) {
353
+ throw new Error('DeepSeek Harness worker inference provider does not match the selected profile');
354
+ }
355
+ buildDeepSeekHarnessPatch({ model, effort, sandbox, approval, inferenceProvider });
342
356
  const cwd = invocation?.cwd;
343
357
  if (typeof cwd !== 'string' || !cwd.startsWith('/') || cwd.includes('\0')) throw new Error('DeepSeek Harness worker requires an absolute workspace');
344
358
  const brief = invocation?.brief;
@@ -357,7 +371,7 @@ export class DeepSeekHarnessDirectAdapter extends DeepSeekHarnessAdapter {
357
371
  buildWorkerArtifacts(invocation) {
358
372
  const permissions = invocation.permissions ?? {};
359
373
  return [{ name: 'dsh-patch', location: 'run-directory', content: buildDeepSeekHarnessPatch({
360
- model: invocation.selected.model, effort: invocation.selected.effort.value,
374
+ model: invocation.selected.model, inferenceProvider: invocation.selected.inferenceProvider, effort: invocation.selected.effort.value,
361
375
  sandbox: permissions.sandbox ?? 'workspace-write', approval: permissions.approval ?? 'never',
362
376
  }) }];
363
377
  }