@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
@@ -47,9 +47,13 @@ export function wrapperModelRisks(provider, artifact, catalog = loadProviderMode
47
47
  const premium = !!state.effectiveModel && (Object.values(catalog.providers)
48
48
  .some(entry => matches([entry?.tiers?.premium?.id, entry?.roles.reasoning.id]))
49
49
  || (provider === 'claude' && state.effectiveModel === 'opus'));
50
+ // Muse's explicit session setting elects its sole catalog model without cross-provider pins.
51
+ const muse = catalog.providers.muse;
52
+ const museSessionElected = provider === 'muse' && !!muse && !muse.tiers
53
+ && Object.values(muse.roles).every(entry => entry.id === artifact.inheritedModel);
50
54
  // Flagship always needs an operator election, pinned or not. Premium is a normal ladder tier
51
55
  // (the reasoning role's default), so it is a risk only when a wrapper inherits it.
52
- if ((flagship || (premium && state.model !== 'pinned')) && !flagshipElected(artifact)) {
56
+ if ((flagship || (premium && state.model !== 'pinned' && !museSessionElected)) && !flagshipElected(artifact)) {
53
57
  findings.push('delegation.flagship-inheritance');
54
58
  }
55
59
  return findings;
@@ -97,7 +101,7 @@ export function wrapperEnforcementReport(provider, artifact) {
97
101
  openclaw: 'Markdown wrapper mirrors do not set native subagents.model or per-spawn overrides.',
98
102
  openhuman: 'User harness wrappers carry semantic model hints; project wrappers omit model. Neither is an exact pin.',
99
103
  antigravity: 'Wrapper mirrors do not project native CLI model/effort flags.',
100
- windsurf: 'Portable wrapper model selection is unsupported; the main UI session controls selection.',
104
+ devin: 'Portable wrapper model selection is unsupported; the main UI session controls selection.',
101
105
  pi: 'Agents are reference skills; CLI model/thinking flags are separate from deployed wrappers.',
102
106
  'deepseek-harness': 'Agent references do not pin the configured Harness route.',
103
107
  hermes: 'All delegated workers share the provider delegation configuration.',
@@ -10,7 +10,7 @@ const PROVIDERS_NEEDING_COMMANDS = new Set([
10
10
  'factory',
11
11
  'opencode', // OpenCode scans .opencode/command/**/*.md via ConfigCommand.load() (PUW-006 #1107)
12
12
  'warp',
13
- 'windsurf',
13
+ 'devin',
14
14
  'copilot',
15
15
  'codex',
16
16
  'openclaw',
@@ -2,7 +2,7 @@
2
2
  * Skill→Command Translation Layer
3
3
  *
4
4
  * Generates command files from canonical SKILL.md sources for providers that
5
- * require command format natively (Factory, OpenCode, Warp, Windsurf, Copilot,
5
+ * require command format natively (Factory, OpenCode, Warp, Devin Desktop, Copilot,
6
6
  * Codex, OpenClaw).
7
7
  *
8
8
  * Skills are the canonical source format; commands are deployment artifacts.
@@ -0,0 +1,63 @@
1
+ // Adapt itops workspace declarations without creating a competing authorization source.
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { dirname, join, relative, resolve } from 'node:path';
4
+ import { load as loadYaml } from 'js-yaml';
5
+ export const WORKSPACE_SPEC_PATH = 'config/workspace.yaml';
6
+ function object(value) {
7
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
8
+ }
9
+ export function workspaceSpecPath(root) {
10
+ const candidate = join(root, WORKSPACE_SPEC_PATH);
11
+ return existsSync(candidate) ? candidate : null;
12
+ }
13
+ export function readWorkspaceSpec(path) {
14
+ const raw = loadYaml(readFileSync(path, 'utf8'));
15
+ if (!object(raw) || raw.apiVersion !== 'workspace.aiwg.io/v1' || raw.kind !== 'WorkspaceSpec') {
16
+ throw new Error(`${path}: expected workspace.aiwg.io/v1 WorkspaceSpec`);
17
+ }
18
+ if (!Array.isArray(raw.repos))
19
+ throw new Error(`${path}: requires repos: []`);
20
+ const entries = [...raw.repos];
21
+ const routingPath = join(dirname(path), 'repository-routing.yaml');
22
+ if (existsSync(routingPath)) {
23
+ const routing = loadYaml(readFileSync(routingPath, 'utf8'));
24
+ if (!object(routing) || !Array.isArray(routing.repositories)) {
25
+ throw new Error(`${routingPath}: requires repositories: []`);
26
+ }
27
+ entries.push(...routing.repositories);
28
+ }
29
+ return {
30
+ workspaceName: object(raw.metadata) && typeof raw.metadata.name === 'string' ? raw.metadata.name : undefined,
31
+ repos: entries.map(entry => object(entry) ? {
32
+ ...entry,
33
+ // Membership authorizes local reads/edits, never implicit push or destructive work.
34
+ allowed: entry.allowed ?? entry.actions ?? entry.permissions ?? ['read', 'write'],
35
+ } : entry),
36
+ };
37
+ }
38
+ export function mergeSpecRepos(entries) {
39
+ const result = [];
40
+ for (const entry of entries) {
41
+ const previous = result.find(repo => repo.path === entry.path || repo.name === entry.name);
42
+ if (!previous) {
43
+ result.push(entry);
44
+ }
45
+ else {
46
+ if (previous.path !== entry.path || previous.name !== entry.name) {
47
+ throw new Error(`Conflicting workspace spec repository: ${entry.name} (${entry.path})`);
48
+ }
49
+ previous.actions = previous.actions.filter(action => entry.actions.includes(action));
50
+ }
51
+ }
52
+ return result;
53
+ }
54
+ export function workspaceSpecEdit(path, name, repoPath, allowed) {
55
+ const root = resolve(dirname(path), '..');
56
+ const routing = join(dirname(path), 'repository-routing.yaml');
57
+ const edit = repoPath === undefined ? `Remove the entry named ${JSON.stringify(name)}.`
58
+ : `Add or update this entry (paths relative to ${root}):\n - name: ${JSON.stringify(name)}\n path: ${JSON.stringify(relative(root, repoPath) || '.')}`;
59
+ const requested = allowed ? `Requested actions: ${allowed.join(', ')}. ` : '';
60
+ return `${requested}Workspace spec is managed externally. Edit ${path} repos[] and ${routing} repositories[].\n${edit}\n`
61
+ + 'Membership defaults to read,write; preserve any explicit allowed restrictions. No files were changed.';
62
+ }
63
+ //# sourceMappingURL=repo-access-workspace-spec.js.map
@@ -4,6 +4,7 @@ import { dirname, isAbsolute, join, relative, resolve } from 'path';
4
4
  import { load as loadYaml } from 'js-yaml';
5
5
  import { WORKSPACE_REPO_ACTIONS, } from '../config/aiwg-config.js';
6
6
  import { resolveProjectAiwgDir } from '../config/project-artifacts.js';
7
+ import { mergeSpecRepos, readWorkspaceSpec, workspaceSpecPath, WORKSPACE_SPEC_PATH } from './repo-access-workspace-spec.js';
7
8
  export const REPO_ACCESS_MANIFEST_PATHS = [
8
9
  '.aiwg/ops/security/repo-access.manifest.yaml',
9
10
  '.aiwg/security/repo-access.manifest.yaml',
@@ -17,6 +18,8 @@ function isObject(value) {
17
18
  }
18
19
  function findProjectRootFromManifest(manifestPath) {
19
20
  const normalized = manifestPath.replace(/\\/g, '/');
21
+ if (normalized.endsWith('/config/workspace.yaml'))
22
+ return resolve(dirname(manifestPath), '..');
20
23
  if (normalized.endsWith('/.aiwg/aiwg.config')) {
21
24
  return resolve(dirname(manifestPath), '..');
22
25
  }
@@ -42,6 +45,9 @@ export function findRepoAccessManifest(startDir = process.cwd()) {
42
45
  if (Array.isArray(parsed.repos))
43
46
  return explicitConfig;
44
47
  }
48
+ const spec = workspaceSpecPath(expanded);
49
+ if (spec)
50
+ return spec;
45
51
  }
46
52
  let current = resolve(startDir);
47
53
  while (true) {
@@ -67,6 +73,9 @@ export function findRepoAccessManifest(startDir = process.cwd()) {
67
73
  if (Array.isArray(parent.repos))
68
74
  return parentConfig;
69
75
  }
76
+ const spec = workspaceSpecPath(workspaceRoot);
77
+ if (spec)
78
+ return spec;
70
79
  }
71
80
  }
72
81
  catch {
@@ -75,6 +84,9 @@ export function findRepoAccessManifest(startDir = process.cwd()) {
75
84
  return workspaceConfig;
76
85
  }
77
86
  }
87
+ const spec = workspaceSpecPath(current);
88
+ if (spec)
89
+ return spec;
78
90
  for (const manifestRel of REPO_ACCESS_MANIFEST_PATHS) {
79
91
  const candidate = resolve(current, manifestRel);
80
92
  if (existsSync(candidate))
@@ -124,10 +136,20 @@ export function loadRepoAccessManifest(startDir = process.cwd()) {
124
136
  const manifestPath = findRepoAccessManifest(startDir);
125
137
  if (!manifestPath) {
126
138
  throw new Error('Repo access manifest not found. Expected .aiwg/aiwg.config workspace + repos blocks (canonical). '
139
+ + `Itops workspace source: ${WORKSPACE_SPEC_PATH} + config/repository-routing.yaml. `
127
140
  + `Legacy compatibility fallbacks: ${REPO_ACCESS_MANIFEST_PATHS.join(' or ')}. `
128
141
  + 'Register a repo with aiwg repo-access add --path <repo-or-file> --name <name> --allow read,write.');
129
142
  }
130
143
  const workspaceProjectRoot = findProjectRootFromManifest(manifestPath);
144
+ if (manifestPath.replace(/\\/g, '/').endsWith(`/${WORKSPACE_SPEC_PATH}`)) {
145
+ const spec = readWorkspaceSpec(manifestPath);
146
+ return {
147
+ version: '1', path: manifestPath, source: 'workspace-spec',
148
+ workspaceProjectRoot, projectRoot: workspaceProjectRoot,
149
+ workspaceName: spec.workspaceName, defaultPolicy: 'deny',
150
+ repos: mergeSpecRepos(spec.repos.map((entry, index) => normalizeRepoEntry(entry, index, workspaceProjectRoot))),
151
+ };
152
+ }
131
153
  const isWorkspaceConfig = manifestPath.endsWith('/.aiwg/aiwg.config')
132
154
  || manifestPath.endsWith('\\.aiwg\\aiwg.config');
133
155
  const raw = isWorkspaceConfig
@@ -457,10 +457,10 @@ providers:
457
457
  deploy_target: project
458
458
  aggregated_output: true
459
459
 
460
- windsurf:
460
+ devin:
461
461
  display_name: Devin Desktop
462
462
  aliases:
463
- - devin
463
+ - windsurf
464
464
  - devin-desktop
465
465
  - devin-local
466
466
  - cascade
@@ -476,13 +476,13 @@ providers:
476
476
  source_date: "2026-10-08"
477
477
  live_qualified: false
478
478
  sources:
479
- - "src/providers/provider-definitions.ts#windsurf"
479
+ - "src/providers/provider-seeds-3.ts#devin"
480
480
  - "https://docs.devin.ai/cli/reference/commands.md"
481
481
  - "https://docs.devin.ai/_llms/en/desktop.md"
482
482
  exclusion_gap: "Devin Desktop documents no headless worker command and no worker-serving MCP tool; its MCP settings configure clients, IDE startup is not inference."
483
483
  recheck: "Rechecked 2026-10-08: Desktop unchanged, still OUT. Devin CLI documents `devin -p/--print`, `--model`, `--prompt-file`, `--permission-mode` and `--sandbox` (no JSON output or effort flag found; `devin acp` is ACP, `devin mcp` manages client servers). Devin CLI stays a distinct future-provider surface, not a windsurf alias, until registry support exists."
484
484
  status: stable
485
- # Devin Desktop uses the Windsurf compatibility surface and requires a VS Code host — daemon not supported
485
+ # Devin Desktop uses retained legacy compatibility paths and requires a VS Code host — daemon not supported
486
486
  daemon_tier: unsupported
487
487
  daemon_pty_adapter: false
488
488
  artifact_paths:
@@ -32,7 +32,7 @@ export function deploymentOutputRoots(provider, target) {
32
32
  const roots = Object.values(provider.paths || {}).filter(Boolean).map(dir => path.isAbsolute(dir)
33
33
  ? dir : path.join(target, dir.split(/[\\/]/)[0]));
34
34
  if (provider.kernelSkillsPath) roots.push(path.resolve(target, provider.kernelSkillsPath));
35
- return [...new Set([...roots, path.join(target, `.${provider.name}`), path.join(target, '.agents'),
35
+ return [...new Set([...roots, path.join(target, `.${provider.name === 'devin' ? 'windsurf' : provider.name}`), path.join(target, '.agents'),
36
36
  ...(provider.deploymentFiles?.(target) || []).map(name => path.join(target, name)),
37
37
  ...['AGENTS.md', 'AIWG.md', 'WORKSPACE.md', 'CLAUDE.md', 'WARP.md', '.hermes.md', 'opencode.json',
38
38
  '.windsurfrules', 'models.json', '.aiwg/frameworks', '.aiwg/.aiwg-manifest.json'].map(name => path.join(target, name))])];
@@ -1,5 +1,6 @@
1
1
  // Preserve copy-mode deletions and edited receipt-owned payloads across provider passes.
2
2
  import fs from 'node:fs';
3
+ import { canonicalDesktopProviderId, canonicalizeDesktopProviderKeys } from './devin-compat.mjs';
3
4
  import path from 'node:path';
4
5
  import { createHash } from 'node:crypto';
5
6
  import { frameworkRegistryId } from '../config/framework-aliases.js';
@@ -9,13 +10,16 @@ const parse = bytes => { try { return JSON.parse(bytes?.toString() || '{}'); } c
9
10
  const sidecar = '.aiwg-manifest.json';
10
11
  const context = new Set(['AGENTS.md', 'AIWG.md', 'WORKSPACE.md', 'CLAUDE.md', 'WARP.md', '.hermes.md', 'copilot-instructions.md']);
11
12
  export function providerCopyMode(project, provider, owner, config, indexOwner) {
12
- const history = parse(fs.existsSync(path.join(project, '.aiwg', sidecar)) ? fs.readFileSync(path.join(project, '.aiwg', sidecar)) : null).bundleDeployments?.[provider] || {};
13
+ provider = canonicalDesktopProviderId(provider);
14
+ const histories = parse(fs.existsSync(path.join(project, '.aiwg', sidecar)) ? fs.readFileSync(path.join(project, '.aiwg', sidecar)) : null).bundleDeployments || {};
15
+ const history = canonicalizeDesktopProviderKeys(histories)[provider] || {};
13
16
  if (!config) {
14
17
  try { config = JSON.parse(fs.readFileSync(path.join(project, '.aiwg/aiwg.config'), 'utf8')); } catch { config = {}; }
15
18
  }
16
19
  const modes = new Map(Object.entries(history).map(([id, mode]) => [frameworkRegistryId(id), mode.copy === true || mode.package === true]));
17
20
  for (const [id, entry] of Object.entries(config.installed || {})) {
18
- if (entry.deployedTo?.[provider]) modes.set(frameworkRegistryId(id), entry.deployedTo[provider].copy === true || entry.deployedTo[provider].package === true);
21
+ const deployment = canonicalizeDesktopProviderKeys(entry.deployedTo || {})[provider];
22
+ if (deployment) modes.set(frameworkRegistryId(id), deployment.copy === true || deployment.package === true);
19
23
  }
20
24
  if (indexOwner) modes.set(frameworkRegistryId(indexOwner), false);
21
25
  const inherited = new Set();
@@ -85,8 +89,9 @@ export function preserveDeploymentOutputs(before, roots, opts = {}) {
85
89
  && !context.has(path.basename(file)) && claim.record.kind !== 'settings';
86
90
  const owners = claim?.record.owners || (claim?.record.frameworkSlug ? [claim.record.frameworkSlug] : []);
87
91
  const currentOwner = (opts.srcRoot || '').replaceAll('\\', '/').match(/(?:agentic\/code|\.aiwg)\/(?:frameworks|addons|extensions)\/([^/]+)/)?.[1] || frameworkRegistryId(opts.mode || '');
88
- const copy = (opts.copyMode ?? opts.copyStandardSkills) || owners.some(owner => providerCopyMode(opts.target, opts.provider, owner, opts.config, currentOwner));
89
- const retire = opts.copyMode === false && opts.retiredRuleFiles?.has(file);
92
+ const keepCopies = (opts.copyMode ?? opts.copyStandardSkills) && !(opts.discoveryOnly && claim?.record?.kind === 'rule');
93
+ const copy = keepCopies || owners.some(owner => providerCopyMode(opts.target, opts.provider, owner, opts.config, currentOwner));
94
+ const retire = (opts.copyMode === false || opts.discoveryOnly) && opts.retiredRuleFiles?.has(file);
90
95
  if (!(outOfScope || edited || !exists && copy && !retire) || exists && fs.readFileSync(file).equals(bytes)) continue;
91
96
  fs.mkdirSync(path.dirname(file), { recursive: true });
92
97
  fs.writeFileSync(file, bytes);
@@ -148,7 +153,7 @@ export function deploymentEditWarnings(project, provider) {
148
153
  }
149
154
  }
150
155
  };
151
- visit(path.join(project, `.${provider}`));
156
+ visit(path.join(project, `.${provider === 'devin' ? 'windsurf' : provider}`));
152
157
  visit(path.join(project, '.agents'));
153
158
  return [...warnings];
154
159
  }
@@ -30,7 +30,7 @@ function symlinkBetween(root, file) {
30
30
  export function planDeploymentRemoval(project, provider, owner, includeProject = true, preserveRoots = []) {
31
31
  const paths = Object.values(getProviderArtifactPathStrings(provider) || {}).filter(Boolean);
32
32
  const roots = [...new Set([...paths.map(dir => path.isAbsolute(dir) ? dir : path.join(project, dir.split(/[\\/]/)[0])),
33
- ...deployedSkillRoots(project, provider), path.join(project, `.${provider}`), ...(includeProject ? [path.join(project, '.aiwg/frameworks')] : [])])].map(root => path.resolve(root));
33
+ ...deployedSkillRoots(project, provider), path.join(project, `.${provider === 'devin' ? 'windsurf' : provider}`), ...(includeProject ? [path.join(project, '.aiwg/frameworks')] : [])])].map(root => path.resolve(root));
34
34
  const files = new Set();
35
35
  const decisions = [], writes = [], remaining = [], recorded = [];
36
36
  const visit = (file) => {
@@ -0,0 +1,4 @@
1
+ export function canonicalDesktopProviderId(provider: string): string;
2
+ export function canonicalizeDesktopProviderKeys<T>(records: Record<string, T>): Record<string, T>;
3
+ export function normalizeDesktopConfig<T>(config: T): T;
4
+ export function normalizeDesktopModelConfig<T>(config: T): T;
@@ -0,0 +1,29 @@
1
+ // Read pre-buyout Desktop configuration and deployment records under the canonical identity.
2
+ const record = value => value !== null && typeof value === 'object' && !Array.isArray(value);
3
+ export const canonicalDesktopProviderId = provider => provider === 'windsurf' ? 'devin' : provider;
4
+
5
+ export function canonicalizeDesktopProviderKeys(records) {
6
+ if (!record(records) || !Object.hasOwn(records, 'windsurf')) return records;
7
+ const { windsurf, ...current } = records;
8
+ if (!Object.hasOwn(current, 'devin')) return { ...current, devin: windsurf };
9
+ return { ...current, devin: record(windsurf) && record(current.devin)
10
+ ? { ...windsurf, ...current.devin } : current.devin };
11
+ }
12
+
13
+ export function normalizeDesktopConfig(config) {
14
+ if (!record(config)) return config;
15
+ if (Array.isArray(config.providers) && config.providers.includes('windsurf')) {
16
+ config.providers = config.providers.map(canonicalDesktopProviderId)
17
+ .filter((id, index, ids) => id !== 'devin' || ids.indexOf(id) === index);
18
+ }
19
+ if (record(config.installed)) for (const entry of Object.values(config.installed)) {
20
+ if (record(entry) && record(entry.deployedTo)) entry.deployedTo = canonicalizeDesktopProviderKeys(entry.deployedTo);
21
+ }
22
+ return config;
23
+ }
24
+
25
+ // Model validation and loading share a pure conversion of the deprecated selector.
26
+ export function normalizeDesktopModelConfig(config) {
27
+ if (!record(config) || !record(config.defaults) || config.defaults.provider !== 'windsurf') return config;
28
+ return { ...config, defaults: { ...config.defaults, provider: 'devin' } };
29
+ }
@@ -2,6 +2,9 @@
2
2
  import { signalChild } from '../process/signal-child.mjs';
3
3
  import { spawn } from 'node:child_process';
4
4
  import { redactGrokOutput } from './grok-build-headless.js';
5
+ function isRecord(value) {
6
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
7
+ }
5
8
  export class GrokAcpClient {
6
9
  child;
7
10
  env;
@@ -18,10 +21,15 @@ export class GrokAcpClient {
18
21
  sessionId;
19
22
  text = '';
20
23
  constructor(options) {
24
+ for (const key of ['timeoutMs', 'maxStderrBytes']) {
25
+ if (options[key] !== undefined && (!Number.isFinite(options[key]) || options[key] <= 0)) {
26
+ throw new Error(`Grok ACP ${key} must be a positive finite number`);
27
+ }
28
+ }
21
29
  this.env = options.env ?? process.env;
22
30
  this.cwd = options.cwd;
23
31
  this.timeoutMs = Math.min(Math.max(options.timeoutMs ?? 30_000, 1), 120_000);
24
- this.maxStderrBytes = options.maxStderrBytes ?? 1024 * 1024;
32
+ this.maxStderrBytes = Math.min(options.maxStderrBytes ?? 1024 * 1024, 8 * 1024 * 1024);
25
33
  this.onUpdate = options.onUpdate;
26
34
  this.child = spawn(options.command ?? 'grok', [...(options.prefixArgs ?? []), '--no-auto-update', '--allow', 'Bash(aiwg discover *)', ...(options.disableSubagents ? ['--no-subagents', '--disallowed-tools', 'workflow'] : []), 'agent', 'stdio'], {
27
35
  cwd: options.cwd, env: this.env, stdio: ['pipe', 'pipe', 'pipe'], shell: false,
@@ -31,13 +39,18 @@ export class GrokAcpClient {
31
39
  this.failAll(new Error(`Grok ACP closed (exit ${code ?? 'signal'})`));
32
40
  void options.onExit?.();
33
41
  });
34
- this.child.stdout.on('data', (chunk) => this.receive(chunk.toString('utf8')));
42
+ this.child.stdout.setEncoding('utf8');
43
+ this.child.stderr.setEncoding('utf8');
44
+ this.child.stdout.on('data', (chunk) => this.receive(chunk));
35
45
  this.child.stderr.on('data', (chunk) => {
36
- this.stderrBuffer += chunk.toString('utf8');
37
- if (Buffer.byteLength(this.stderrBuffer) > this.maxStderrBytes) {
46
+ if (this.closed)
47
+ return;
48
+ if (Buffer.byteLength(this.stderrBuffer) + Buffer.byteLength(chunk) > this.maxStderrBytes) {
38
49
  this.failAll(new Error('Grok ACP stderr limit exceeded'));
39
50
  this.close();
51
+ return;
40
52
  }
53
+ this.stderrBuffer += chunk;
41
54
  });
42
55
  }
43
56
  get stderr() { return redactGrokOutput(this.stderrBuffer, this.env); }
@@ -50,8 +63,10 @@ export class GrokAcpClient {
50
63
  }
51
64
  }
52
65
  receive(chunk) {
66
+ if (this.closed)
67
+ return;
53
68
  this.stdoutBuffer += chunk;
54
- if (this.stdoutBuffer.length > 8 * 1024 * 1024) {
69
+ if (Buffer.byteLength(this.stdoutBuffer) > 8 * 1024 * 1024) {
55
70
  this.failAll(new Error('Grok ACP stdout limit exceeded'));
56
71
  this.close();
57
72
  return;
@@ -64,7 +79,10 @@ export class GrokAcpClient {
64
79
  continue;
65
80
  let message;
66
81
  try {
67
- message = JSON.parse(line);
82
+ const parsed = JSON.parse(line);
83
+ if (!isRecord(parsed))
84
+ throw new Error('Invalid frame');
85
+ message = parsed;
68
86
  }
69
87
  catch {
70
88
  this.failAll(new Error('Invalid Grok ACP JSON-RPC message'));
@@ -72,17 +90,29 @@ export class GrokAcpClient {
72
90
  return;
73
91
  }
74
92
  if (message.method === 'session/update' || message.method === '_x.ai/session_notification') {
75
- const params = message.params;
93
+ const params = isRecord(message.params) ? message.params : undefined;
94
+ if (this.sessionId && params?.sessionId !== undefined && params.sessionId !== this.sessionId)
95
+ continue;
76
96
  const update = params?.update;
77
- if (update) {
97
+ if (isRecord(update)) {
78
98
  const safe = JSON.parse(redactGrokOutput(JSON.stringify(update), this.env));
79
99
  const content = safe.content;
80
100
  if (safe.sessionUpdate === 'agent_message_chunk' && typeof content?.text === 'string')
81
101
  this.text += content.text;
82
- this.onUpdate?.(safe);
102
+ try {
103
+ this.onUpdate?.(safe);
104
+ }
105
+ catch (cause) {
106
+ const detail = cause instanceof Error ? cause.message : String(cause);
107
+ this.failAll(new Error(`Grok ACP update callback failed: ${redactGrokOutput(detail, this.env)}`));
108
+ this.close();
109
+ return;
110
+ }
83
111
  }
84
112
  continue;
85
113
  }
114
+ if (typeof message.method === 'string')
115
+ continue;
86
116
  const id = message.id;
87
117
  if (typeof id !== 'number')
88
118
  continue;
@@ -18,11 +18,11 @@ export const GROK_HOME_ENV = 'GROK_HOME';
18
18
  export function isGrokFilesystemRoot(resolved, pathFlavor = path) {
19
19
  return pathFlavor.parse(resolved).root === resolved;
20
20
  }
21
- function expandHomePrefix(raw, userHome = homedir()) {
21
+ function expandHomePrefix(raw, userHome, pathFlavor) {
22
22
  if (raw === '~')
23
23
  return raw;
24
24
  if (raw.startsWith('~/'))
25
- return path.join(userHome, raw.slice(2));
25
+ return pathFlavor.join(userHome, raw.slice(2));
26
26
  return raw;
27
27
  }
28
28
  /**
@@ -31,9 +31,10 @@ function expandHomePrefix(raw, userHome = homedir()) {
31
31
  */
32
32
  export function resolveGrokHomeResult(env = process.env, userHome = homedir()) {
33
33
  const raw = (env[GROK_HOME_ENV] || '').trim();
34
+ const pathFlavor = process.platform === 'win32' ? path.win32 : path;
34
35
  const fromEnv = Boolean(raw);
35
- const candidate = fromEnv ? raw : path.join(userHome, '.grok');
36
- const expanded = expandHomePrefix(candidate, userHome);
36
+ const candidate = fromEnv ? raw : pathFlavor.join(userHome, '.grok');
37
+ const expanded = expandHomePrefix(candidate, userHome, pathFlavor);
37
38
  if (expanded === '~' || expanded.startsWith('~')) {
38
39
  return {
39
40
  ok: false,
@@ -41,7 +42,7 @@ export function resolveGrokHomeResult(env = process.env, userHome = homedir()) {
41
42
  message: `${GROK_HOME_ENV} must be an absolute path or ~/… (got '${raw || '(default)'}'). Bare '~' is rejected.`,
42
43
  };
43
44
  }
44
- if (!path.isAbsolute(expanded)) {
45
+ if (!pathFlavor.isAbsolute(expanded)) {
45
46
  return {
46
47
  ok: false,
47
48
  reason: 'not-absolute',
@@ -55,8 +56,8 @@ export function resolveGrokHomeResult(env = process.env, userHome = homedir()) {
55
56
  message: `${GROK_HOME_ENV} contains an invalid path character.`,
56
57
  };
57
58
  }
58
- const resolved = path.resolve(expanded);
59
- if (!resolved || isGrokFilesystemRoot(resolved)) {
59
+ const resolved = pathFlavor.resolve(expanded);
60
+ if (!resolved || isGrokFilesystemRoot(resolved, pathFlavor)) {
60
61
  return {
61
62
  ok: false,
62
63
  reason: 'root',
@@ -166,11 +166,12 @@ export const CONTEXT_CONTRACTS = {
166
166
  bootstrapTargets: ['WARP.md', 'AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'supported',
167
167
  verification: { method: 'official Warp project rules documentation', source: 'https://docs.warp.dev/agent-platform/capabilities/rules/', lastVerified: VERIFIED_ON },
168
168
  },
169
- windsurf: {
170
- startupFiles: ['AGENTS.md', '.windsurf/rules/*.md', '.devin/rules/*.md'], precedence: ['provider/system', 'Devin rules', 'Windsurf rules', 'AGENTS.md'],
169
+ devin: {
170
+ // Retained topology: Desktop 3.14 loader precedence still needs verification on titan.
171
+ startupFiles: ['AGENTS.md', '.windsurf/rules/*.md', '.devin/rules/*.md'], precedence: ['provider/system', 'Devin rules', 'Devin Desktop rules', 'AGENTS.md'],
171
172
  loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
172
173
  bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: null, nestedContext: true, support: 'degraded',
173
- verification: { method: 'AIWG Windsurf/Devin topology contract; provider-native rules retained', source: 'src/providers/provider-definitions.ts', lastVerified: VERIFIED_ON },
174
+ verification: { method: 'AIWG Devin Desktop/Devin topology contract; provider-native rules retained', source: 'src/providers/provider-definitions.ts', lastVerified: VERIFIED_ON },
174
175
  },
175
176
  generic: {
176
177
  startupFiles: ['AGENTS.md'], precedence: ['host policy'], loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
@@ -28,7 +28,7 @@ export const ProviderDefinitionSchema = z.object({
28
28
  'pi',
29
29
  'omp',
30
30
  'warp',
31
- 'windsurf',
31
+ 'devin',
32
32
  'generic',
33
33
  ]),
34
34
  displayName: z.string().min(1),
@@ -27,7 +27,7 @@ export const PROVIDER_IDS = [
27
27
  'pi',
28
28
  'omp',
29
29
  'warp',
30
- 'windsurf',
30
+ 'devin',
31
31
  'generic',
32
32
  ];
33
33
  const BUILT_IN_SEEDS = [...BUILT_IN_SEEDS_1, ...BUILT_IN_SEEDS_2, ...BUILT_IN_SEEDS_3];
@@ -99,10 +99,10 @@ const MCP_INJECTION_DEFINITIONS = [
99
99
  },
100
100
  },
101
101
  {
102
- id: 'windsurf',
103
- aliases: ['devin', 'devin-desktop', 'devin-local', 'cascade'],
102
+ id: 'devin',
103
+ aliases: ['windsurf', 'devin-desktop', 'devin-local', 'cascade'],
104
104
  mcp: {
105
- providerId: 'windsurf',
105
+ providerId: 'devin',
106
106
  includeInSupportedProviders: true,
107
107
  configFormat: 'json',
108
108
  serverConfigFormat: 'standard',
@@ -24,7 +24,7 @@ const PROVIDER_EXECUTABLES = {
24
24
  pi: ['pi'],
25
25
  omp: ['omp'],
26
26
  warp: ['warp'],
27
- windsurf: ['windsurf'],
27
+ devin: ['devin-desktop', 'windsurf'],
28
28
  };
29
29
  async function defaultPathExists(filePath) {
30
30
  try {
@@ -138,6 +138,18 @@ export async function collectProviderInventory(projectDir, options = {}) {
138
138
  if (configPath && await pathExists(resolve(configPath))) {
139
139
  evidence.push({ kind: 'provider-config', scope: configPath.startsWith(homeDir) ? 'user' : 'project', value: configPath });
140
140
  }
141
+ // Inspect directory existence only: current Desktop and legacy Windsurf may coexist.
142
+ // These are detection markers, not new deployment destinations (3.14 read paths unverified).
143
+ if (definition.id === 'devin') {
144
+ for (const marker of ['.devin', '.config/Devin', '.codeium', '.windsurf']) {
145
+ const location = join(homeDir, marker);
146
+ if (await pathExists(location))
147
+ evidence.push({ kind: 'provider-config', scope: 'user', value: location });
148
+ }
149
+ const legacyDeployment = join(projectDir, '.windsurf');
150
+ if (await pathExists(legacyDeployment))
151
+ evidence.push({ kind: 'provider-config', scope: 'project', value: legacyDeployment });
152
+ }
141
153
  const configured = evidence.some(item => item.kind === 'project-config' || item.kind === 'user-config');
142
154
  const deployed = evidence.some(item => item.kind === 'deployment-record');
143
155
  const detected = evidence.some(item => item.kind === 'runtime-env' ||
@@ -124,10 +124,10 @@ export const BUILT_IN_SEEDS_3 = [
124
124
  matrixRef: 'warp',
125
125
  },
126
126
  {
127
- id: 'windsurf',
127
+ id: 'devin',
128
128
  displayName: 'Devin Desktop',
129
129
  status: 'stable',
130
- aliases: ['devin', 'devin-desktop', 'devin-local', 'cascade'],
130
+ aliases: ['windsurf', 'devin-desktop', 'devin-local', 'cascade'],
131
131
  builtIn: true,
132
132
  surfaces: {
133
133
  primary: 'devin',
@@ -148,7 +148,7 @@ export const BUILT_IN_SEEDS_3 = [
148
148
  },
149
149
  notes: [
150
150
  'Devin Desktop is the current product name; --provider devin is preferred and --provider windsurf remains a deprecated compatibility id.',
151
- '.devin/rules is preferred by Devin Desktop, but AIWG keeps .devin/ as ignored local provider output and currently emits the compatibility surface through .windsurf/ plus AGENTS.md.',
151
+ 'AIWG keeps .devin/ as ignored local provider output and retains .windsurf/ plus AGENTS.md; the installed 3.11 package is insufficient to verify 3.14 project discovery. Verify on titan before changing paths.',
152
152
  ],
153
153
  },
154
154
  {
@@ -164,7 +164,7 @@ export const BUILT_IN_SEEDS_3 = [
164
164
  legacy: ['.windsurfrules'],
165
165
  },
166
166
  notes: [
167
- 'Devin CLI has distinct rules and skills surfaces and should not normalize to windsurf until a dedicated provider behavior issue adds writer support.',
167
+ 'Devin CLI has distinct rules and skills surfaces and should not normalize to devin until a dedicated provider behavior issue adds writer support.',
168
168
  ],
169
169
  },
170
170
  {
@@ -180,17 +180,18 @@ export const BUILT_IN_SEEDS_3 = [
180
180
  legacy: [],
181
181
  },
182
182
  notes: [
183
- 'Devin product skills use the Agent Skills layout and are recorded here as a readable surface, not as current AIWG windsurf deploy output.',
183
+ 'Devin product skills use the Agent Skills layout and are recorded here as a readable surface, not as current AIWG devin deploy output.',
184
184
  ],
185
185
  },
186
186
  ],
187
187
  },
188
188
  detection: {
189
189
  env: ['WINDSURF_VERSION'],
190
- process: ['windsurf'],
191
- capabilityId: 'windsurf',
190
+ process: ['devin-desktop', 'windsurf'],
191
+ capabilityId: 'devin',
192
192
  runtimeEnvPriority: 30,
193
193
  },
194
+ // Compatibility filenames stay unchanged; verify Desktop 3.14 on titan before migrating.
194
195
  paths: {
195
196
  artifacts: {
196
197
  agents: '.windsurf/agents',
@@ -221,11 +222,11 @@ export const BUILT_IN_SEEDS_3 = [
221
222
  adapters: {
222
223
  agentFormat: 'windsurf-markdown',
223
224
  hookBridge: null,
224
- mcpInjection: 'windsurf',
225
+ mcpInjection: 'devin',
225
226
  contextAggregation: 'agents-md',
226
227
  ruleFormat: 'windsurf-rule',
227
228
  },
228
- matrixRef: 'windsurf',
229
+ matrixRef: 'devin',
229
230
  },
230
231
  {
231
232
  id: 'generic',
@@ -151,7 +151,7 @@ export async function resolveProviderReceiptRuntimeEvidence(rawOptions) {
151
151
  const paths = artifactPaths(provider, options.scope);
152
152
  const outputRoot = path.resolve(options.outputRoot ?? (options.scope === 'user' ? homedir() : options.projectRoot));
153
153
  const ownedFiles = new Set();
154
- const receiptDirectories = new Set([outputRoot, path.join(outputRoot, '.aiwg'), path.join(outputRoot, `.${provider}`)]);
154
+ const receiptDirectories = new Set([outputRoot, path.join(outputRoot, '.aiwg'), path.join(outputRoot, `.${provider === 'devin' ? 'windsurf' : provider}`)]);
155
155
  if (paths) {
156
156
  for (const type of ['agents', 'commands', 'skills', 'rules', 'behaviors']) {
157
157
  const configured = paths[type];