crewbee 0.1.9 → 0.1.11

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 (158) hide show
  1. package/README.md +448 -233
  2. package/README.zh-CN.md +334 -127
  3. package/dist/opencode-plugin.mjs +406 -210
  4. package/dist/src/adapters/opencode/bootstrap.js.map +1 -1
  5. package/dist/src/adapters/opencode/chat-message-hook.d.ts.map +1 -1
  6. package/dist/src/adapters/opencode/chat-message-hook.js +2 -1
  7. package/dist/src/adapters/opencode/chat-message-hook.js.map +1 -1
  8. package/dist/src/adapters/opencode/config-hook.d.ts.map +1 -1
  9. package/dist/src/adapters/opencode/config-hook.js +12 -5
  10. package/dist/src/adapters/opencode/config-hook.js.map +1 -1
  11. package/dist/src/adapters/opencode/defaults.d.ts +3 -0
  12. package/dist/src/adapters/opencode/defaults.d.ts.map +1 -0
  13. package/dist/src/adapters/opencode/defaults.js +5 -0
  14. package/dist/src/adapters/opencode/defaults.js.map +1 -0
  15. package/dist/src/adapters/opencode/index.d.ts +1 -0
  16. package/dist/src/adapters/opencode/index.d.ts.map +1 -1
  17. package/dist/src/adapters/opencode/index.js +3 -1
  18. package/dist/src/adapters/opencode/index.js.map +1 -1
  19. package/dist/src/adapters/opencode/plugin.d.ts.map +1 -1
  20. package/dist/src/adapters/opencode/plugin.js +1 -1
  21. package/dist/src/adapters/opencode/plugin.js.map +1 -1
  22. package/dist/src/adapters/opencode/prompt-builder.d.ts.map +1 -1
  23. package/dist/src/adapters/opencode/prompt-builder.js +7 -17
  24. package/dist/src/adapters/opencode/prompt-builder.js.map +1 -1
  25. package/dist/src/adapters/opencode/system-transform-hook.d.ts +2 -1
  26. package/dist/src/adapters/opencode/system-transform-hook.d.ts.map +1 -1
  27. package/dist/src/adapters/opencode/system-transform-hook.js +17 -3
  28. package/dist/src/adapters/opencode/system-transform-hook.js.map +1 -1
  29. package/dist/src/agent-teams/canonical-agent-id.d.ts.map +1 -1
  30. package/dist/src/agent-teams/canonical-agent-id.js +3 -0
  31. package/dist/src/agent-teams/canonical-agent-id.js.map +1 -1
  32. package/dist/src/agent-teams/diagnostics.d.ts +10 -0
  33. package/dist/src/agent-teams/diagnostics.d.ts.map +1 -0
  34. package/dist/src/agent-teams/diagnostics.js +29 -0
  35. package/dist/src/agent-teams/diagnostics.js.map +1 -0
  36. package/dist/src/agent-teams/embedded/coding-team/agent-helpers.d.ts +1 -3
  37. package/dist/src/agent-teams/embedded/coding-team/agent-helpers.d.ts.map +1 -1
  38. package/dist/src/agent-teams/embedded/coding-team/agent-helpers.js +4 -14
  39. package/dist/src/agent-teams/embedded/coding-team/agent-helpers.js.map +1 -1
  40. package/dist/src/agent-teams/embedded/coding-team/agent-profile-builder.d.ts +4 -0
  41. package/dist/src/agent-teams/embedded/coding-team/agent-profile-builder.d.ts.map +1 -0
  42. package/dist/src/agent-teams/embedded/coding-team/agent-profile-builder.js +17 -0
  43. package/dist/src/agent-teams/embedded/coding-team/agent-profile-builder.js.map +1 -0
  44. package/dist/src/agent-teams/embedded/coding-team/agents/codebase-explorer.js +5 -5
  45. package/dist/src/agent-teams/embedded/coding-team/agents/codebase-explorer.js.map +1 -1
  46. package/dist/src/agent-teams/embedded/coding-team/agents/coding-executor.js +4 -4
  47. package/dist/src/agent-teams/embedded/coding-team/agents/coding-executor.js.map +1 -1
  48. package/dist/src/agent-teams/embedded/coding-team/agents/coding-leader.js +8 -8
  49. package/dist/src/agent-teams/embedded/coding-team/agents/coding-leader.js.map +1 -1
  50. package/dist/src/agent-teams/embedded/coding-team/agents/coordination-leader.js +8 -8
  51. package/dist/src/agent-teams/embedded/coding-team/agents/coordination-leader.js.map +1 -1
  52. package/dist/src/agent-teams/embedded/coding-team/agents/multimodal-looker.js +2 -2
  53. package/dist/src/agent-teams/embedded/coding-team/agents/multimodal-looker.js.map +1 -1
  54. package/dist/src/agent-teams/embedded/coding-team/agents/principal-advisor.js +5 -5
  55. package/dist/src/agent-teams/embedded/coding-team/agents/principal-advisor.js.map +1 -1
  56. package/dist/src/agent-teams/embedded/coding-team/agents/reviewer.js +6 -6
  57. package/dist/src/agent-teams/embedded/coding-team/agents/reviewer.js.map +1 -1
  58. package/dist/src/agent-teams/embedded/coding-team/agents/web-researcher.js +5 -5
  59. package/dist/src/agent-teams/embedded/coding-team/agents/web-researcher.js.map +1 -1
  60. package/dist/src/agent-teams/filesystem.d.ts +4 -0
  61. package/dist/src/agent-teams/filesystem.d.ts.map +1 -1
  62. package/dist/src/agent-teams/filesystem.js +134 -21
  63. package/dist/src/agent-teams/filesystem.js.map +1 -1
  64. package/dist/src/agent-teams/index.d.ts +1 -0
  65. package/dist/src/agent-teams/index.d.ts.map +1 -1
  66. package/dist/src/agent-teams/index.js +5 -1
  67. package/dist/src/agent-teams/index.js.map +1 -1
  68. package/dist/src/agent-teams/library.d.ts +5 -1
  69. package/dist/src/agent-teams/library.d.ts.map +1 -1
  70. package/dist/src/agent-teams/library.js +31 -8
  71. package/dist/src/agent-teams/library.js.map +1 -1
  72. package/dist/src/agent-teams/parsers.js +3 -3
  73. package/dist/src/agent-teams/parsers.js.map +1 -1
  74. package/dist/src/agent-teams/types.d.ts +6 -0
  75. package/dist/src/agent-teams/types.d.ts.map +1 -1
  76. package/dist/src/agent-teams/validation.d.ts.map +1 -1
  77. package/dist/src/agent-teams/validation.js +50 -3
  78. package/dist/src/agent-teams/validation.js.map +1 -1
  79. package/dist/src/cli/doctor.d.ts.map +1 -1
  80. package/dist/src/cli/doctor.js +53 -7
  81. package/dist/src/cli/doctor.js.map +1 -1
  82. package/dist/src/cli/install.d.ts.map +1 -1
  83. package/dist/src/cli/install.js +8 -3
  84. package/dist/src/cli/install.js.map +1 -1
  85. package/dist/src/cli/parse-install-options.d.ts.map +1 -1
  86. package/dist/src/cli/parse-install-options.js +31 -0
  87. package/dist/src/cli/parse-install-options.js.map +1 -1
  88. package/dist/src/cli/parse-setup-options.d.ts +3 -0
  89. package/dist/src/cli/parse-setup-options.d.ts.map +1 -0
  90. package/dist/src/cli/parse-setup-options.js +102 -0
  91. package/dist/src/cli/parse-setup-options.js.map +1 -0
  92. package/dist/src/cli/render-help.d.ts.map +1 -1
  93. package/dist/src/cli/render-help.js +12 -4
  94. package/dist/src/cli/render-help.js.map +1 -1
  95. package/dist/src/cli/run-cli.d.ts.map +1 -1
  96. package/dist/src/cli/run-cli.js +27 -1
  97. package/dist/src/cli/run-cli.js.map +1 -1
  98. package/dist/src/cli/setup.d.ts +7 -0
  99. package/dist/src/cli/setup.d.ts.map +1 -0
  100. package/dist/src/cli/setup.js +70 -0
  101. package/dist/src/cli/setup.js.map +1 -0
  102. package/dist/src/cli/uninstall-user.d.ts.map +1 -1
  103. package/dist/src/cli/uninstall-user.js +2 -1
  104. package/dist/src/cli/uninstall-user.js.map +1 -1
  105. package/dist/src/cli/validate.d.ts +6 -0
  106. package/dist/src/cli/validate.d.ts.map +1 -0
  107. package/dist/src/cli/validate.js +90 -0
  108. package/dist/src/cli/validate.js.map +1 -0
  109. package/dist/src/core/index.d.ts +1 -0
  110. package/dist/src/core/index.d.ts.map +1 -1
  111. package/dist/src/install/config-writer.d.ts +2 -18
  112. package/dist/src/install/config-writer.d.ts.map +1 -1
  113. package/dist/src/install/config-writer.js +9 -94
  114. package/dist/src/install/config-writer.js.map +1 -1
  115. package/dist/src/install/doctor.d.ts.map +1 -1
  116. package/dist/src/install/doctor.js +28 -19
  117. package/dist/src/install/doctor.js.map +1 -1
  118. package/dist/src/install/index.d.ts +6 -4
  119. package/dist/src/install/index.d.ts.map +1 -1
  120. package/dist/src/install/index.js +20 -11
  121. package/dist/src/install/index.js.map +1 -1
  122. package/dist/src/install/install.d.ts.map +1 -1
  123. package/dist/src/install/install.js +50 -33
  124. package/dist/src/install/install.js.map +1 -1
  125. package/dist/src/install/opencode-cli.d.ts +14 -0
  126. package/dist/src/install/opencode-cli.d.ts.map +1 -0
  127. package/dist/src/install/opencode-cli.js +58 -0
  128. package/dist/src/install/opencode-cli.js.map +1 -0
  129. package/dist/src/install/opencode-config-file.d.ts +26 -0
  130. package/dist/src/install/opencode-config-file.d.ts.map +1 -0
  131. package/dist/src/install/opencode-config-file.js +131 -0
  132. package/dist/src/install/opencode-config-file.js.map +1 -0
  133. package/dist/src/install/package-installation.d.ts +19 -0
  134. package/dist/src/install/package-installation.d.ts.map +1 -0
  135. package/dist/src/install/package-installation.js +95 -0
  136. package/dist/src/install/package-installation.js.map +1 -0
  137. package/dist/src/install/package-manager.d.ts +1 -14
  138. package/dist/src/install/package-manager.d.ts.map +1 -1
  139. package/dist/src/install/package-manager.js +8 -79
  140. package/dist/src/install/package-manager.js.map +1 -1
  141. package/dist/src/install/plugin-entry.d.ts +3 -1
  142. package/dist/src/install/plugin-entry.d.ts.map +1 -1
  143. package/dist/src/install/plugin-entry.js +11 -22
  144. package/dist/src/install/plugin-entry.js.map +1 -1
  145. package/dist/src/install/setup.d.ts +6 -0
  146. package/dist/src/install/setup.d.ts.map +1 -0
  147. package/dist/src/install/setup.js +72 -0
  148. package/dist/src/install/setup.js.map +1 -0
  149. package/dist/src/install/types.d.ts +41 -0
  150. package/dist/src/install/types.d.ts.map +1 -1
  151. package/dist/src/install/uninstall.d.ts.map +1 -1
  152. package/dist/src/install/uninstall.js +30 -18
  153. package/dist/src/install/uninstall.js.map +1 -1
  154. package/dist/src/render/prompt-document-renderer.d.ts +4 -0
  155. package/dist/src/render/prompt-document-renderer.d.ts.map +1 -0
  156. package/dist/src/render/prompt-document-renderer.js +19 -0
  157. package/dist/src/render/prompt-document-renderer.js.map +1 -0
  158. package/package.json +5 -2
@@ -7354,14 +7354,14 @@ function resolveTeamDocumentation(teamDir, workspaceRoot = process.cwd()) {
7354
7354
  };
7355
7355
  }
7356
7356
 
7357
- // src/agent-teams/embedded/coding-team/agent-helpers.ts
7358
- function createAgent(metadata, config2) {
7357
+ // src/agent-teams/embedded/coding-team/agent-profile-builder.ts
7358
+ function createAgentProfile(metadata, profile) {
7359
7359
  return {
7360
7360
  metadata,
7361
- ...config2
7361
+ ...profile
7362
7362
  };
7363
7363
  }
7364
- function binding(agentRef, description) {
7364
+ function createCollaborationBinding(agentRef, description) {
7365
7365
  return {
7366
7366
  agentRef,
7367
7367
  description
@@ -7370,7 +7370,7 @@ function binding(agentRef, description) {
7370
7370
 
7371
7371
  // src/agent-teams/embedded/coding-team/agents/codebase-explorer.ts
7372
7372
  function createCodebaseExplorerAgent() {
7373
- return createAgent(
7373
+ return createAgentProfile(
7374
7374
  {
7375
7375
  id: "codebase-explorer",
7376
7376
  name: "\u4EE3\u7801\u5E93\u63A2\u7D22\u8005",
@@ -7444,9 +7444,9 @@ function createCodebaseExplorerAgent() {
7444
7444
  },
7445
7445
  collaboration: {
7446
7446
  defaultConsults: [
7447
- binding("web-researcher", "\u5F53\u4ED3\u5E93\u95EE\u9898\u6D89\u53CA\u5916\u90E8\u4F9D\u8D56\u3001\u5B98\u65B9\u6587\u6863\u6216\u5F00\u6E90\u5B9E\u73B0\u65F6\u8865\u5916\u90E8\u8BC1\u636E"),
7448
- binding("multimodal-looker", "\u5F53\u5B9A\u4F4D\u4F9D\u8D56\u622A\u56FE\u3001PDF\u3001\u67B6\u6784\u56FE\u7B49\u975E\u6E90\u7801\u6750\u6599\u65F6\u89E3\u8BFB"),
7449
- binding("principal-advisor", "\u5F53\u641C\u7D22\u7ED3\u679C\u66B4\u9732\u590D\u6742\u7ED3\u6784\u5206\u6B67\uFF0C\u4E14\u9700\u8981\u66F4\u9AD8\u5C42\u6B21\u6280\u672F\u5224\u65AD\u65F6\u54A8\u8BE2")
7447
+ createCollaborationBinding("web-researcher", "\u5F53\u4ED3\u5E93\u95EE\u9898\u6D89\u53CA\u5916\u90E8\u4F9D\u8D56\u3001\u5B98\u65B9\u6587\u6863\u6216\u5F00\u6E90\u5B9E\u73B0\u65F6\u8865\u5916\u90E8\u8BC1\u636E"),
7448
+ createCollaborationBinding("multimodal-looker", "\u5F53\u5B9A\u4F4D\u4F9D\u8D56\u622A\u56FE\u3001PDF\u3001\u67B6\u6784\u56FE\u7B49\u975E\u6E90\u7801\u6750\u6599\u65F6\u89E3\u8BFB"),
7449
+ createCollaborationBinding("principal-advisor", "\u5F53\u641C\u7D22\u7ED3\u679C\u66B4\u9732\u590D\u6742\u7ED3\u6784\u5206\u6B67\uFF0C\u4E14\u9700\u8981\u66F4\u9AD8\u5C42\u6B21\u6280\u672F\u5224\u65AD\u65F6\u54A8\u8BE2")
7450
7450
  ],
7451
7451
  defaultHandoffs: []
7452
7452
  },
@@ -7556,7 +7556,7 @@ function createCodebaseExplorerAgent() {
7556
7556
 
7557
7557
  // src/agent-teams/embedded/coding-team/agents/coordination-leader.ts
7558
7558
  function createCoordinationLeaderAgent() {
7559
- return createAgent(
7559
+ return createAgentProfile(
7560
7560
  {
7561
7561
  id: "coordination-leader",
7562
7562
  name: "\u7BA1\u7406\u578B\u7EC4\u957F",
@@ -7638,14 +7638,14 @@ function createCoordinationLeaderAgent() {
7638
7638
  },
7639
7639
  collaboration: {
7640
7640
  defaultConsults: [
7641
- binding("codebase-explorer", "\u4ED3\u5E93\u5185\u4EE3\u7801\u5B9A\u4F4D\u3001\u4F9D\u8D56\u5173\u7CFB\u4E0E\u6A21\u5F0F\u63A2\u7D22"),
7642
- binding("web-researcher", "\u5916\u90E8\u6587\u6863\u3001\u7248\u672C\u3001\u6700\u4F73\u5B9E\u8DF5\u4E0E\u5F00\u6E90\u5B9E\u73B0\u7814\u7A76"),
7643
- binding("reviewer", "\u9ED8\u8BA4\u72EC\u7ACB\u590D\u6838\u8D44\u6E90\uFF1B\u7528\u4E8E\u8BA1\u5212\u3001\u5B9E\u73B0\u7ED3\u679C\u4E0E\u5B8C\u6210\u58F0\u660E\u7684\u4E8C\u6B21\u6821\u9A8C\u3002\u5BF9\u975E\u7410\u788E\u4EFB\u52A1\uFF0C\u901A\u5E38\u5E94\u5728\u5BA3\u79F0\u5B8C\u6210\u524D\u8003\u8651\u8BF7\u6C42\u5176\u5BA1\u89C6\uFF1B\u662F\u5426\u8C03\u7528\u7531\u5F53\u524D owner \u6839\u636E\u98CE\u9669\u3001\u590D\u6742\u5EA6\u4E0E\u8BC1\u636E\u5145\u5206\u6027\u5224\u65AD\u3002"),
7644
- binding("principal-advisor", "\u9AD8\u4EE3\u4EF7\u67B6\u6784\u3001\u5B89\u5168\u3001\u6027\u80FD\u4E0E\u590D\u6742\u5EA6\u51B3\u7B56\u54A8\u8BE2"),
7645
- binding("multimodal-looker", "\u56FE\u8868\u3001PDF\u3001\u622A\u56FE\u3001\u754C\u9762\u4E0E\u67B6\u6784\u56FE\u89E3\u8BFB")
7641
+ createCollaborationBinding("codebase-explorer", "\u4ED3\u5E93\u5185\u4EE3\u7801\u5B9A\u4F4D\u3001\u4F9D\u8D56\u5173\u7CFB\u4E0E\u6A21\u5F0F\u63A2\u7D22"),
7642
+ createCollaborationBinding("web-researcher", "\u5916\u90E8\u6587\u6863\u3001\u7248\u672C\u3001\u6700\u4F73\u5B9E\u8DF5\u4E0E\u5F00\u6E90\u5B9E\u73B0\u7814\u7A76"),
7643
+ createCollaborationBinding("reviewer", "\u9ED8\u8BA4\u72EC\u7ACB\u590D\u6838\u8D44\u6E90\uFF1B\u7528\u4E8E\u8BA1\u5212\u3001\u5B9E\u73B0\u7ED3\u679C\u4E0E\u5B8C\u6210\u58F0\u660E\u7684\u4E8C\u6B21\u6821\u9A8C\u3002\u5BF9\u975E\u7410\u788E\u4EFB\u52A1\uFF0C\u901A\u5E38\u5E94\u5728\u5BA3\u79F0\u5B8C\u6210\u524D\u8003\u8651\u8BF7\u6C42\u5176\u5BA1\u89C6\uFF1B\u662F\u5426\u8C03\u7528\u7531\u5F53\u524D owner \u6839\u636E\u98CE\u9669\u3001\u590D\u6742\u5EA6\u4E0E\u8BC1\u636E\u5145\u5206\u6027\u5224\u65AD\u3002"),
7644
+ createCollaborationBinding("principal-advisor", "\u9AD8\u4EE3\u4EF7\u67B6\u6784\u3001\u5B89\u5168\u3001\u6027\u80FD\u4E0E\u590D\u6742\u5EA6\u51B3\u7B56\u54A8\u8BE2"),
7645
+ createCollaborationBinding("multimodal-looker", "\u56FE\u8868\u3001PDF\u3001\u622A\u56FE\u3001\u754C\u9762\u4E0E\u67B6\u6784\u56FE\u89E3\u8BFB")
7646
7646
  ],
7647
7647
  defaultHandoffs: [
7648
- binding("coding-executor", "\u8FB9\u754C\u6E05\u6670\u6216\u5DF2\u6536\u675F\u7684\u5B9E\u73B0\u3001\u4FEE\u590D\u3001\u8C03\u8BD5\u4E0E\u5C40\u90E8\u91CD\u6784\u6267\u884C\u8005")
7648
+ createCollaborationBinding("coding-executor", "\u8FB9\u754C\u6E05\u6670\u6216\u5DF2\u6536\u675F\u7684\u5B9E\u73B0\u3001\u4FEE\u590D\u3001\u8C03\u8BD5\u4E0E\u5C40\u90E8\u91CD\u6784\u6267\u884C\u8005")
7649
7649
  ]
7650
7650
  },
7651
7651
  runtimeConfig: {
@@ -7933,7 +7933,7 @@ function createCoordinationLeaderAgent() {
7933
7933
 
7934
7934
  // src/agent-teams/embedded/coding-team/agents/coding-executor.ts
7935
7935
  function createCodingExecutorAgent() {
7936
- return createAgent(
7936
+ return createAgentProfile(
7937
7937
  {
7938
7938
  id: "coding-executor",
7939
7939
  name: "\u7F16\u7801\u6267\u884C\u8005",
@@ -8009,8 +8009,8 @@ function createCodingExecutorAgent() {
8009
8009
  },
8010
8010
  collaboration: {
8011
8011
  defaultConsults: [
8012
- binding("codebase-explorer", "\u4EE3\u7801\u5E93\u63A2\u7D22\u8005"),
8013
- binding("web-researcher", "\u5728\u7EBF\u7814\u7A76\u8005")
8012
+ createCollaborationBinding("codebase-explorer", "\u4EE3\u7801\u5E93\u63A2\u7D22\u8005"),
8013
+ createCollaborationBinding("web-researcher", "\u5728\u7EBF\u7814\u7A76\u8005")
8014
8014
  ],
8015
8015
  defaultHandoffs: []
8016
8016
  },
@@ -8120,7 +8120,7 @@ function createCodingExecutorAgent() {
8120
8120
 
8121
8121
  // src/agent-teams/embedded/coding-team/agents/coding-leader.ts
8122
8122
  function createCodingLeaderAgent() {
8123
- return createAgent(
8123
+ return createAgentProfile(
8124
8124
  {
8125
8125
  id: "coding-leader",
8126
8126
  name: "CodingLeader",
@@ -8200,14 +8200,14 @@ function createCodingLeaderAgent() {
8200
8200
  },
8201
8201
  collaboration: {
8202
8202
  defaultConsults: [
8203
- binding("codebase-explorer", "\u4ED3\u5E93\u5185\u4EE3\u7801\u5B9A\u4F4D\u3001\u8C03\u7528\u94FE\u548C\u6A21\u5F0F\u63A2\u7D22"),
8204
- binding("web-researcher", "\u5916\u90E8\u6587\u6863\u3001\u5F00\u6E90\u5B9E\u73B0\u3001\u7248\u672C\u4E0E\u5386\u53F2\u8BC1\u636E\u7814\u7A76"),
8205
- binding("reviewer", "\u9ED8\u8BA4\u72EC\u7ACB\u590D\u6838\u8D44\u6E90\uFF1B\u7528\u4E8E\u8BA1\u5212\u3001\u5B9E\u73B0\u7ED3\u679C\u4E0E\u5B8C\u6210\u58F0\u660E\u7684\u4E8C\u6B21\u6821\u9A8C\u3002\u5BF9\u975E\u7410\u788E\u4EFB\u52A1\uFF0C\u901A\u5E38\u5E94\u5728\u5BA3\u79F0\u5B8C\u6210\u524D\u8003\u8651\u8BF7\u6C42\u5176\u5BA1\u89C6\uFF1B\u662F\u5426\u8C03\u7528\u7531\u5F53\u524D owner \u6839\u636E\u98CE\u9669\u3001\u590D\u6742\u5EA6\u4E0E\u8BC1\u636E\u5145\u5206\u6027\u5224\u65AD\u3002"),
8206
- binding("principal-advisor", "\u9AD8\u98CE\u9669\u67B6\u6784\u3001\u6027\u80FD\u3001\u5B89\u5168\u4E0E\u590D\u6742\u5EA6\u51B3\u7B56\u54A8\u8BE2"),
8207
- binding("multimodal-looker", "\u56FE\u8868\u3001\u622A\u56FE\u3001PDF\u3001\u754C\u9762\u4E0E\u67B6\u6784\u56FE\u7684\u591A\u6A21\u6001\u89E3\u8BFB")
8203
+ createCollaborationBinding("codebase-explorer", "\u4ED3\u5E93\u5185\u4EE3\u7801\u5B9A\u4F4D\u3001\u8C03\u7528\u94FE\u548C\u6A21\u5F0F\u63A2\u7D22"),
8204
+ createCollaborationBinding("web-researcher", "\u5916\u90E8\u6587\u6863\u3001\u5F00\u6E90\u5B9E\u73B0\u3001\u7248\u672C\u4E0E\u5386\u53F2\u8BC1\u636E\u7814\u7A76"),
8205
+ createCollaborationBinding("reviewer", "\u9ED8\u8BA4\u72EC\u7ACB\u590D\u6838\u8D44\u6E90\uFF1B\u7528\u4E8E\u8BA1\u5212\u3001\u5B9E\u73B0\u7ED3\u679C\u4E0E\u5B8C\u6210\u58F0\u660E\u7684\u4E8C\u6B21\u6821\u9A8C\u3002\u5BF9\u975E\u7410\u788E\u4EFB\u52A1\uFF0C\u901A\u5E38\u5E94\u5728\u5BA3\u79F0\u5B8C\u6210\u524D\u8003\u8651\u8BF7\u6C42\u5176\u5BA1\u89C6\uFF1B\u662F\u5426\u8C03\u7528\u7531\u5F53\u524D owner \u6839\u636E\u98CE\u9669\u3001\u590D\u6742\u5EA6\u4E0E\u8BC1\u636E\u5145\u5206\u6027\u5224\u65AD\u3002"),
8206
+ createCollaborationBinding("principal-advisor", "\u9AD8\u98CE\u9669\u67B6\u6784\u3001\u6027\u80FD\u3001\u5B89\u5168\u4E0E\u590D\u6742\u5EA6\u51B3\u7B56\u54A8\u8BE2"),
8207
+ createCollaborationBinding("multimodal-looker", "\u56FE\u8868\u3001\u622A\u56FE\u3001PDF\u3001\u754C\u9762\u4E0E\u67B6\u6784\u56FE\u7684\u591A\u6A21\u6001\u89E3\u8BFB")
8208
8208
  ],
8209
8209
  defaultHandoffs: [
8210
- binding("coding-executor", "\u8FB9\u754C\u6E05\u6670\u3001\u65E0\u9700\u590D\u6742\u7F16\u6392\u7684\u53F6\u5B50\u5B9E\u73B0\u3001\u4FEE\u590D\u3001\u8C03\u8BD5\u4E0E\u5C40\u90E8\u91CD\u6784")
8210
+ createCollaborationBinding("coding-executor", "\u8FB9\u754C\u6E05\u6670\u3001\u65E0\u9700\u590D\u6742\u7F16\u6392\u7684\u53F6\u5B50\u5B9E\u73B0\u3001\u4FEE\u590D\u3001\u8C03\u8BD5\u4E0E\u5C40\u90E8\u91CD\u6784")
8211
8211
  ]
8212
8212
  },
8213
8213
  runtimeConfig: {
@@ -8479,7 +8479,7 @@ function createCodingLeaderAgent() {
8479
8479
 
8480
8480
  // src/agent-teams/embedded/coding-team/agents/multimodal-looker.ts
8481
8481
  function createMultimodalLookerAgent() {
8482
- return createAgent(
8482
+ return createAgentProfile(
8483
8483
  {
8484
8484
  id: "multimodal-looker",
8485
8485
  name: "MultimodalLooker",
@@ -8626,7 +8626,7 @@ function createMultimodalLookerAgent() {
8626
8626
 
8627
8627
  // src/agent-teams/embedded/coding-team/agents/principal-advisor.ts
8628
8628
  function createPrincipalAdvisorAgent() {
8629
- return createAgent(
8629
+ return createAgentProfile(
8630
8630
  {
8631
8631
  id: "principal-advisor",
8632
8632
  name: "\u9996\u5E2D\u987E\u95EE",
@@ -8710,9 +8710,9 @@ function createPrincipalAdvisorAgent() {
8710
8710
  },
8711
8711
  collaboration: {
8712
8712
  defaultConsults: [
8713
- binding("codebase-explorer", "\u4ED3\u5E93\u5185\u7ED3\u6784\u3001\u8C03\u7528\u94FE\u3001\u6A21\u5F0F\u4E0E\u5B9E\u73B0\u4F4D\u7F6E\u63A2\u7D22"),
8714
- binding("web-researcher", "\u5916\u90E8\u6587\u6863\u3001\u6700\u4F73\u5B9E\u8DF5\u3001\u7248\u672C\u5DEE\u5F02\u4E0E\u5F00\u6E90\u5B9E\u73B0\u7814\u7A76"),
8715
- binding("multimodal-looker", "\u56FE\u8868\u3001PDF\u3001\u622A\u56FE\u3001\u754C\u9762\u4E0E\u67B6\u6784\u56FE\u89E3\u8BFB")
8713
+ createCollaborationBinding("codebase-explorer", "\u4ED3\u5E93\u5185\u7ED3\u6784\u3001\u8C03\u7528\u94FE\u3001\u6A21\u5F0F\u4E0E\u5B9E\u73B0\u4F4D\u7F6E\u63A2\u7D22"),
8714
+ createCollaborationBinding("web-researcher", "\u5916\u90E8\u6587\u6863\u3001\u6700\u4F73\u5B9E\u8DF5\u3001\u7248\u672C\u5DEE\u5F02\u4E0E\u5F00\u6E90\u5B9E\u73B0\u7814\u7A76"),
8715
+ createCollaborationBinding("multimodal-looker", "\u56FE\u8868\u3001PDF\u3001\u622A\u56FE\u3001\u754C\u9762\u4E0E\u67B6\u6784\u56FE\u89E3\u8BFB")
8716
8716
  ],
8717
8717
  defaultHandoffs: []
8718
8718
  },
@@ -8910,7 +8910,7 @@ function createPrincipalAdvisorAgent() {
8910
8910
 
8911
8911
  // src/agent-teams/embedded/coding-team/agents/reviewer.ts
8912
8912
  function createReviewerAgent() {
8913
- return createAgent(
8913
+ return createAgentProfile(
8914
8914
  {
8915
8915
  id: "reviewer",
8916
8916
  name: "\u8BC4\u5BA1\u8005",
@@ -8994,10 +8994,10 @@ function createReviewerAgent() {
8994
8994
  },
8995
8995
  collaboration: {
8996
8996
  defaultConsults: [
8997
- binding("codebase-explorer", "\u4ED3\u5E93\u5185\u5F15\u7528\u3001\u8C03\u7528\u94FE\u3001\u6A21\u5F0F\u4E0E\u5B9E\u73B0\u4F4D\u7F6E\u63A2\u7D22"),
8998
- binding("web-researcher", "\u5916\u90E8\u6587\u6863\u3001\u7248\u672C\u884C\u4E3A\u4E0E\u53C2\u8003\u5B9E\u73B0\u6838\u9A8C"),
8999
- binding("principal-advisor", "\u9AD8\u98CE\u9669\u67B6\u6784\u3001\u5B89\u5168\u3001\u6027\u80FD\u6216\u590D\u6742\u5EA6\u95EE\u9898\u54A8\u8BE2"),
9000
- binding("multimodal-looker", "\u56FE\u8868\u3001PDF\u3001\u622A\u56FE\u3001\u754C\u9762\u4E0E\u67B6\u6784\u56FE\u89E3\u8BFB")
8997
+ createCollaborationBinding("codebase-explorer", "\u4ED3\u5E93\u5185\u5F15\u7528\u3001\u8C03\u7528\u94FE\u3001\u6A21\u5F0F\u4E0E\u5B9E\u73B0\u4F4D\u7F6E\u63A2\u7D22"),
8998
+ createCollaborationBinding("web-researcher", "\u5916\u90E8\u6587\u6863\u3001\u7248\u672C\u884C\u4E3A\u4E0E\u53C2\u8003\u5B9E\u73B0\u6838\u9A8C"),
8999
+ createCollaborationBinding("principal-advisor", "\u9AD8\u98CE\u9669\u67B6\u6784\u3001\u5B89\u5168\u3001\u6027\u80FD\u6216\u590D\u6742\u5EA6\u95EE\u9898\u54A8\u8BE2"),
9000
+ createCollaborationBinding("multimodal-looker", "\u56FE\u8868\u3001PDF\u3001\u622A\u56FE\u3001\u754C\u9762\u4E0E\u67B6\u6784\u56FE\u89E3\u8BFB")
9001
9001
  ],
9002
9002
  defaultHandoffs: []
9003
9003
  },
@@ -9195,7 +9195,7 @@ function createReviewerAgent() {
9195
9195
 
9196
9196
  // src/agent-teams/embedded/coding-team/agents/web-researcher.ts
9197
9197
  function createWebResearcherAgent() {
9198
- return createAgent(
9198
+ return createAgentProfile(
9199
9199
  {
9200
9200
  id: "web-researcher",
9201
9201
  name: "\u5728\u7EBF\u7814\u7A76\u8005",
@@ -9268,9 +9268,9 @@ function createWebResearcherAgent() {
9268
9268
  },
9269
9269
  collaboration: {
9270
9270
  defaultConsults: [
9271
- binding("codebase-explorer", "\u5F53\u5916\u90E8\u7814\u7A76\u9700\u8981\u6620\u5C04\u56DE\u672C\u4ED3\u5E93\u4E2D\u7684\u63A5\u5165\u70B9\u3001\u8C03\u7528\u4F4D\u7F6E\u6216\u65E2\u6709\u6A21\u5F0F\u65F6\u534F\u540C"),
9272
- binding("multimodal-looker", "\u5F53\u5B98\u65B9\u8D44\u6599\u6216\u5F00\u6E90\u8BA8\u8BBA\u5305\u542B PDF\u3001\u622A\u56FE\u3001\u56FE\u8868\u7B49\u975E\u6E90\u7801\u6750\u6599\u65F6\u89E3\u8BFB"),
9273
- binding("principal-advisor", "\u5F53\u7814\u7A76\u7ED3\u679C\u9700\u8981\u5347\u683C\u4E3A\u67B6\u6784\u3001\u5B89\u5168\u3001\u6027\u80FD\u6216\u590D\u6742\u5EA6\u51B3\u7B56\u65F6\u54A8\u8BE2")
9271
+ createCollaborationBinding("codebase-explorer", "\u5F53\u5916\u90E8\u7814\u7A76\u9700\u8981\u6620\u5C04\u56DE\u672C\u4ED3\u5E93\u4E2D\u7684\u63A5\u5165\u70B9\u3001\u8C03\u7528\u4F4D\u7F6E\u6216\u65E2\u6709\u6A21\u5F0F\u65F6\u534F\u540C"),
9272
+ createCollaborationBinding("multimodal-looker", "\u5F53\u5B98\u65B9\u8D44\u6599\u6216\u5F00\u6E90\u8BA8\u8BBA\u5305\u542B PDF\u3001\u622A\u56FE\u3001\u56FE\u8868\u7B49\u975E\u6E90\u7801\u6750\u6599\u65F6\u89E3\u8BFB"),
9273
+ createCollaborationBinding("principal-advisor", "\u5F53\u7814\u7A76\u7ED3\u679C\u9700\u8981\u5347\u683C\u4E3A\u67B6\u6784\u3001\u5B89\u5168\u3001\u6027\u80FD\u6216\u590D\u6742\u5EA6\u51B3\u7B56\u65F6\u54A8\u8BE2")
9274
9274
  ],
9275
9275
  defaultHandoffs: []
9276
9276
  },
@@ -10129,8 +10129,8 @@ function mapCollaboration(raw) {
10129
10129
  return value.map(mapCollaborationBinding);
10130
10130
  };
10131
10131
  return {
10132
- defaultConsults: mapList(raw.default_consults ?? raw.defaultConsults ?? [], "default_consults"),
10133
- defaultHandoffs: mapList(raw.default_handoffs ?? raw.defaultHandoffs ?? [], "default_handoffs")
10132
+ defaultConsults: mapList(raw?.default_consults ?? raw?.defaultConsults ?? [], "default_consults"),
10133
+ defaultHandoffs: mapList(raw?.default_handoffs ?? raw?.defaultHandoffs ?? [], "default_handoffs")
10134
10134
  };
10135
10135
  }
10136
10136
  function mapMinimalOperations(raw, body) {
@@ -10297,7 +10297,7 @@ function mapAgentProfile(filePath) {
10297
10297
  rejectRemovedAgentProfileFields(data, filePath);
10298
10298
  const personaCore = asRecord(data.persona_core, "persona_core");
10299
10299
  const responsibilityCore = asRecord(data.responsibility_core, "responsibility_core");
10300
- const collaboration = asRecord(data.collaboration, "collaboration");
10300
+ const collaboration = asOptionalRecord(data.collaboration);
10301
10301
  const runtimeConfig = asRecord(data.runtime_config, "runtime_config");
10302
10302
  const extraContent = omitKeys(data, KNOWN_AGENT_TOP_LEVEL_KEYS);
10303
10303
  const reservedAgentKeys = new Set(KNOWN_AGENT_TOP_LEVEL_KEYS);
@@ -10468,11 +10468,16 @@ function mapTeamPolicy(filePath) {
10468
10468
  // src/agent-teams/filesystem.ts
10469
10469
  var TEAM_MANIFEST_FILE = "team.manifest.yaml";
10470
10470
  var TEAM_POLICY_FILE = "team.policy.yaml";
10471
- function createConfigIssue(configPath, message) {
10471
+ function createConfigIssue(input) {
10472
10472
  return {
10473
10473
  level: "warning",
10474
- filePath: configPath,
10475
- message
10474
+ filePath: input.configPath,
10475
+ message: input.message,
10476
+ code: input.code,
10477
+ path: input.path,
10478
+ suggestion: input.suggestion,
10479
+ sourceScope: input.sourceScope,
10480
+ fixable: input.fixable
10476
10481
  };
10477
10482
  }
10478
10483
  function isRecord3(value) {
@@ -10676,7 +10681,14 @@ function resolveConfiguredTeamPath(teamPath, configRoot) {
10676
10681
  function normalizeConfiguredTeamEntry(input) {
10677
10682
  if (!isRecord3(input.value)) {
10678
10683
  return {
10679
- issues: [createConfigIssue(input.configPath, `crewbee.json teams[${input.index}] must be an object.`)]
10684
+ issues: [createConfigIssue({
10685
+ configPath: input.configPath,
10686
+ message: `crewbee.json teams[${input.index}] must be an object.`,
10687
+ code: "crewbee_config_team_entry_invalid",
10688
+ path: `teams[${input.index}]`,
10689
+ sourceScope: input.sourceScope,
10690
+ suggestion: "Replace this entry with an object containing either id or path."
10691
+ })]
10680
10692
  };
10681
10693
  }
10682
10694
  const raw = input.value;
@@ -10684,22 +10696,50 @@ function normalizeConfiguredTeamEntry(input) {
10684
10696
  const teamPath = getOptionalString(raw.path);
10685
10697
  if (teamId && teamPath) {
10686
10698
  return {
10687
- issues: [createConfigIssue(input.configPath, `crewbee.json teams[${input.index}] cannot declare both id and path.`)]
10699
+ issues: [createConfigIssue({
10700
+ configPath: input.configPath,
10701
+ message: `crewbee.json teams[${input.index}] cannot declare both id and path.`,
10702
+ code: "crewbee_config_team_entry_conflict",
10703
+ path: `teams[${input.index}]`,
10704
+ sourceScope: input.sourceScope,
10705
+ suggestion: "Keep id for embedded Teams or path for filesystem Teams, not both."
10706
+ })]
10688
10707
  };
10689
10708
  }
10690
10709
  if (!teamId && !teamPath) {
10691
10710
  return {
10692
- issues: [createConfigIssue(input.configPath, `crewbee.json teams[${input.index}] must declare either id or path.`)]
10711
+ issues: [createConfigIssue({
10712
+ configPath: input.configPath,
10713
+ message: `crewbee.json teams[${input.index}] must declare either id or path.`,
10714
+ code: "crewbee_config_team_entry_missing_source",
10715
+ path: `teams[${input.index}]`,
10716
+ sourceScope: input.sourceScope,
10717
+ suggestion: "Add an embedded Team id or a filesystem Team path."
10718
+ })]
10693
10719
  };
10694
10720
  }
10695
10721
  if (raw.enabled !== void 0 && typeof raw.enabled !== "boolean") {
10696
10722
  return {
10697
- issues: [createConfigIssue(input.configPath, `crewbee.json teams[${input.index}].enabled must be a boolean when provided.`)]
10723
+ issues: [createConfigIssue({
10724
+ configPath: input.configPath,
10725
+ message: `crewbee.json teams[${input.index}].enabled must be a boolean when provided.`,
10726
+ code: "crewbee_config_team_entry_enabled_invalid",
10727
+ path: `teams[${input.index}].enabled`,
10728
+ sourceScope: input.sourceScope,
10729
+ suggestion: "Use true or false for enabled."
10730
+ })]
10698
10731
  };
10699
10732
  }
10700
10733
  if (raw.priority !== void 0 && (typeof raw.priority !== "number" || !Number.isFinite(raw.priority))) {
10701
10734
  return {
10702
- issues: [createConfigIssue(input.configPath, `crewbee.json teams[${input.index}].priority must be a finite number when provided.`)]
10735
+ issues: [createConfigIssue({
10736
+ configPath: input.configPath,
10737
+ message: `crewbee.json teams[${input.index}].priority must be a finite number when provided.`,
10738
+ code: "crewbee_config_team_entry_priority_invalid",
10739
+ path: `teams[${input.index}].priority`,
10740
+ sourceScope: input.sourceScope,
10741
+ suggestion: "Use a finite numeric priority; lower values load first."
10742
+ })]
10703
10743
  };
10704
10744
  }
10705
10745
  if (teamId) {
@@ -10734,7 +10774,14 @@ function normalizeConfiguredTeamEntry(input) {
10734
10774
  } catch (error45) {
10735
10775
  const message = error45 instanceof Error ? error45.message : String(error45);
10736
10776
  return {
10737
- issues: [createConfigIssue(input.configPath, `crewbee.json teams[${input.index}].path is invalid: ${message}`)]
10777
+ issues: [createConfigIssue({
10778
+ configPath: input.configPath,
10779
+ message: `crewbee.json teams[${input.index}].path is invalid: ${message}`,
10780
+ code: "crewbee_config_team_entry_path_invalid",
10781
+ path: `teams[${input.index}].path`,
10782
+ sourceScope: input.sourceScope,
10783
+ suggestion: "Use an absolute path, ~/path, or @path relative to the crewbee.json directory."
10784
+ })]
10738
10785
  };
10739
10786
  }
10740
10787
  }
@@ -10744,7 +10791,12 @@ function dedupeConfiguredTeamSources(input) {
10744
10791
  const sources = input.sources.filter((source) => {
10745
10792
  const key = source.kind === "embedded" ? `embedded:${source.teamId}` : `filesystem:${source.teamDir.toLowerCase()}`;
10746
10793
  if (seen.has(key)) {
10747
- issues.push(createConfigIssue(input.configPath, `crewbee.json contains a duplicate Team entry for '${key}'.`));
10794
+ issues.push(createConfigIssue({
10795
+ configPath: input.configPath,
10796
+ message: `crewbee.json contains a duplicate Team entry for '${key}'.`,
10797
+ code: "crewbee_config_duplicate_team_entry",
10798
+ suggestion: "Remove the duplicate Team entry; the first matching entry is used."
10799
+ }));
10748
10800
  return false;
10749
10801
  }
10750
10802
  seen.add(key);
@@ -10790,7 +10842,12 @@ function listConfiguredTeamSourcesFromDescriptor(descriptor) {
10790
10842
  sourcePrecedence: descriptor.precedence,
10791
10843
  configPath
10792
10844
  })] : [],
10793
- issues: descriptor.missingIsWarning ? [createConfigIssue(configPath, `crewbee.json source '${descriptor.scope}' does not exist.`)] : []
10845
+ issues: descriptor.missingIsWarning ? [createConfigIssue({
10846
+ configPath,
10847
+ message: `crewbee.json source '${descriptor.scope}' does not exist.`,
10848
+ code: "crewbee_config_missing",
10849
+ sourceScope: descriptor.scope
10850
+ })] : []
10794
10851
  };
10795
10852
  }
10796
10853
  let parsed;
@@ -10804,7 +10861,14 @@ function listConfiguredTeamSourcesFromDescriptor(descriptor) {
10804
10861
  sourcePrecedence: descriptor.precedence,
10805
10862
  configPath
10806
10863
  })] : [],
10807
- issues: [createConfigIssue(configPath, "crewbee.json must contain a top-level object.")]
10864
+ issues: [createConfigIssue({
10865
+ configPath,
10866
+ message: "crewbee.json must contain a top-level object.",
10867
+ code: "crewbee_config_root_invalid",
10868
+ sourceScope: descriptor.scope,
10869
+ fixable: descriptor.addDefaultCodingTeam,
10870
+ suggestion: descriptor.addDefaultCodingTeam ? "Run crewbee install to rewrite the global crewbee.json from the packaged template." : "Replace project crewbee.json with an object containing a teams array."
10871
+ })]
10808
10872
  };
10809
10873
  }
10810
10874
  parsed = value;
@@ -10816,7 +10880,14 @@ function listConfiguredTeamSourcesFromDescriptor(descriptor) {
10816
10880
  sourcePrecedence: descriptor.precedence,
10817
10881
  configPath
10818
10882
  })] : [],
10819
- issues: [createConfigIssue(configPath, `Failed to parse crewbee.json: ${message}`)]
10883
+ issues: [createConfigIssue({
10884
+ configPath,
10885
+ message: `Failed to parse crewbee.json: ${message}`,
10886
+ code: "crewbee_config_parse_failed",
10887
+ sourceScope: descriptor.scope,
10888
+ fixable: descriptor.addDefaultCodingTeam,
10889
+ suggestion: descriptor.addDefaultCodingTeam ? "The global config can be safely repaired from the packaged template on install or plugin startup." : "Fix the JSON syntax; project configs are reported but not auto-rewritten."
10890
+ })]
10820
10891
  };
10821
10892
  }
10822
10893
  if (parsed.teams !== void 0 && !Array.isArray(parsed.teams)) {
@@ -10826,7 +10897,15 @@ function listConfiguredTeamSourcesFromDescriptor(descriptor) {
10826
10897
  sourcePrecedence: descriptor.precedence,
10827
10898
  configPath
10828
10899
  })] : [],
10829
- issues: [createConfigIssue(configPath, "crewbee.json teams must be an array when provided.")]
10900
+ issues: [createConfigIssue({
10901
+ configPath,
10902
+ message: "crewbee.json teams must be an array when provided.",
10903
+ code: "crewbee_config_teams_invalid",
10904
+ path: "teams",
10905
+ sourceScope: descriptor.scope,
10906
+ fixable: descriptor.addDefaultCodingTeam,
10907
+ suggestion: descriptor.addDefaultCodingTeam ? "The global config can be safely repaired from the packaged template on install or plugin startup." : "Use teams: [] or a list of Team entries in project crewbee.json."
10908
+ })]
10830
10909
  };
10831
10910
  }
10832
10911
  const resolved = (parsed.teams ?? []).map((value, index) => normalizeConfiguredTeamEntry({
@@ -10865,21 +10944,45 @@ function listConfiguredTeamSources(input) {
10865
10944
  issues: resolved.flatMap((entry) => entry.issues)
10866
10945
  };
10867
10946
  }
10868
- function loadTeamDefinitionFromDirectory(teamDir, workspaceRoot = process.cwd()) {
10947
+ function createSkippedAgentIssue(filePath, message) {
10948
+ return {
10949
+ level: "error",
10950
+ blocking: false,
10951
+ filePath,
10952
+ code: "agent_profile_load_failed",
10953
+ message: `Skipped Agent '${path3.basename(filePath)}': ${message}`,
10954
+ suggestion: "Fix this Agent profile file; other valid Agents in the same Team remain loadable when possible."
10955
+ };
10956
+ }
10957
+ function loadTeamDefinitionFromDirectoryWithIssues(teamDir, workspaceRoot = process.cwd()) {
10869
10958
  const manifest = mapTeamManifest(path3.join(teamDir, TEAM_MANIFEST_FILE));
10870
10959
  const policyPath = path3.join(teamDir, TEAM_POLICY_FILE);
10871
10960
  if (!existsSync3(policyPath)) {
10872
10961
  throw new Error(`${teamDir} is missing ${TEAM_POLICY_FILE}.`);
10873
10962
  }
10874
- const agents = readdirSync2(teamDir).filter((entry) => entry.endsWith(".agent.md")).sort().map((entry) => mapAgentProfile(path3.join(teamDir, entry)));
10963
+ const agentFiles = readdirSync2(teamDir).filter((entry) => entry.endsWith(".agent.md")).sort();
10964
+ const issues = [];
10965
+ const agents = agentFiles.flatMap((entry) => {
10966
+ const agentPath = path3.join(teamDir, entry);
10967
+ try {
10968
+ return [mapAgentProfile(agentPath)];
10969
+ } catch (error45) {
10970
+ const message = error45 instanceof Error ? error45.message : String(error45);
10971
+ issues.push(createSkippedAgentIssue(agentPath, message));
10972
+ return [];
10973
+ }
10974
+ });
10875
10975
  if (agents.length === 0) {
10876
10976
  throw new Error(`${teamDir} must contain at least one *.agent.md file at the team root.`);
10877
10977
  }
10878
10978
  return {
10879
- manifest,
10880
- policy: mapTeamPolicy(policyPath),
10881
- agents,
10882
- documentation: resolveTeamDocumentation(teamDir, workspaceRoot)
10979
+ team: {
10980
+ manifest,
10981
+ policy: mapTeamPolicy(policyPath),
10982
+ agents,
10983
+ documentation: resolveTeamDocumentation(teamDir, workspaceRoot)
10984
+ },
10985
+ issues
10883
10986
  };
10884
10987
  }
10885
10988
 
@@ -10908,13 +11011,13 @@ function createCanonicalAgentId(teamId, agentId) {
10908
11011
  function createFallbackCanonicalAgentId(teamId, agentId) {
10909
11012
  return `${sanitizeSegment(teamId)}-${resolveAgentSlug(agentId)}`;
10910
11013
  }
10911
- function rewriteBinding(binding3, agentIdMap) {
10912
- if (typeof binding3 === "string") {
10913
- return agentIdMap.get(binding3) ?? binding3;
11014
+ function rewriteBinding(binding2, agentIdMap) {
11015
+ if (typeof binding2 === "string") {
11016
+ return agentIdMap.get(binding2) ?? binding2;
10914
11017
  }
10915
11018
  return {
10916
- ...binding3,
10917
- agentRef: agentIdMap.get(binding3.agentRef) ?? binding3.agentRef
11019
+ ...binding2,
11020
+ agentRef: agentIdMap.get(binding2.agentRef) ?? binding2.agentRef
10918
11021
  };
10919
11022
  }
10920
11023
  function normalizeTeamAgentIds(input) {
@@ -10933,7 +11036,10 @@ function normalizeTeamAgentIds(input) {
10933
11036
  if (nextUsedIds.has(assigned) || localAssignedIds.has(assigned)) {
10934
11037
  issues.push({
10935
11038
  level: "error",
10936
- message: `Team '${input.team.manifest.id}' cannot assign a unique canonicalAgentId for source agent '${sourceId}'. Candidate '${candidate}' and fallback '${fallback}' both collide.`
11039
+ code: "canonical_agent_id_collision",
11040
+ message: `Team '${input.team.manifest.id}' cannot assign a unique canonicalAgentId for source agent '${sourceId}'. Candidate '${candidate}' and fallback '${fallback}' both collide.`,
11041
+ path: `agents.${sourceId}.id`,
11042
+ suggestion: "Rename the source Agent id or Team id so CrewBee can derive a unique canonical Agent id."
10937
11043
  });
10938
11044
  return { issues };
10939
11045
  }
@@ -10974,8 +11080,8 @@ function normalizeTeamAgentIds(input) {
10974
11080
  name: canonicalAgentId
10975
11081
  },
10976
11082
  collaboration: {
10977
- defaultConsults: agent.collaboration.defaultConsults.map((binding3) => rewriteBinding(binding3, agentIdMap)),
10978
- defaultHandoffs: agent.collaboration.defaultHandoffs.map((binding3) => rewriteBinding(binding3, agentIdMap))
11083
+ defaultConsults: agent.collaboration.defaultConsults.map((binding2) => rewriteBinding(binding2, agentIdMap)),
11084
+ defaultHandoffs: agent.collaboration.defaultHandoffs.map((binding2) => rewriteBinding(binding2, agentIdMap))
10979
11085
  },
10980
11086
  entryPoint: agent.entryPoint ? {
10981
11087
  ...agent.entryPoint,
@@ -10995,8 +11101,8 @@ function normalizeTeamAgentIds(input) {
10995
11101
  }
10996
11102
 
10997
11103
  // src/agent-teams/validation.ts
10998
- function getBindingAgentRef(binding3) {
10999
- return typeof binding3 === "string" ? binding3 : binding3.agentRef;
11104
+ function getBindingAgentRef(binding2) {
11105
+ return typeof binding2 === "string" ? binding2 : binding2.agentRef;
11000
11106
  }
11001
11107
  function validateTeamDefinition(team) {
11002
11108
  const issues = [];
@@ -11006,34 +11112,49 @@ function validateTeamDefinition(team) {
11006
11112
  if (!agentIds.has(manifest.leader.agentRef)) {
11007
11113
  issues.push({
11008
11114
  level: "error",
11009
- message: `Leader agent '${manifest.leader.agentRef}' is not defined in this Team.`
11115
+ code: "team_leader_missing",
11116
+ path: "leader.agent_ref",
11117
+ message: `Leader agent '${manifest.leader.agentRef}' is not defined in this Team.`,
11118
+ suggestion: "Add a matching *.agent.md profile or update leader.agent_ref."
11010
11119
  });
11011
11120
  } else if (leaderAgent?.entryPoint?.exposure !== "user-selectable") {
11012
11121
  issues.push({
11013
11122
  level: "error",
11014
- message: `Leader agent '${manifest.leader.agentRef}' must be user-selectable.`
11123
+ code: "team_leader_not_user_selectable",
11124
+ path: "leader.agent_ref",
11125
+ message: `Leader agent '${manifest.leader.agentRef}' must be user-selectable.`,
11126
+ suggestion: "Set entry_point.exposure to user-selectable on the leader Agent profile."
11015
11127
  });
11016
11128
  }
11017
11129
  for (const agentRef of Object.keys(manifest.members)) {
11018
11130
  if (!agentIds.has(agentRef)) {
11019
11131
  issues.push({
11020
- level: "error",
11021
- message: `Member agent '${agentRef}' is not defined in this Team.`
11132
+ level: "warning",
11133
+ code: "team_member_missing",
11134
+ path: `members.${agentRef}`,
11135
+ message: `Member agent '${agentRef}' is not defined in this Team.`,
11136
+ suggestion: "Add the member Agent profile or remove this manifest member entry."
11022
11137
  });
11023
11138
  }
11024
11139
  }
11025
11140
  if (!team.policy) {
11026
11141
  issues.push({
11027
11142
  level: "error",
11028
- message: `Team '${manifest.id}' must define team.policy.yaml.`
11143
+ code: "team_policy_missing",
11144
+ path: "team.policy.yaml",
11145
+ message: `Team '${manifest.id}' must define team.policy.yaml.`,
11146
+ suggestion: "Create team.policy.yaml at the Team root."
11029
11147
  });
11030
11148
  return issues;
11031
11149
  }
11032
11150
  for (const [agentId] of Object.entries(manifest.agentRuntime ?? {})) {
11033
11151
  if (!agentIds.has(agentId)) {
11034
11152
  issues.push({
11035
- level: "error",
11036
- message: `Agent runtime override '${agentId}' is not defined in this Team.`
11153
+ level: "warning",
11154
+ code: "team_agent_runtime_target_missing",
11155
+ path: `agent_runtime.${agentId}`,
11156
+ message: `Agent runtime override '${agentId}' is not defined in this Team.`,
11157
+ suggestion: "Remove this runtime override or add the target Agent profile."
11037
11158
  });
11038
11159
  }
11039
11160
  }
@@ -11046,27 +11167,39 @@ function validateTeamDefinition(team) {
11046
11167
  if (requestedTools.size === 0) {
11047
11168
  issues.push({
11048
11169
  level: "error",
11049
- message: `Agent '${agent.metadata.id}' must declare at least one requested tool.`
11170
+ code: "agent_requested_tools_missing",
11171
+ path: `agents.${agent.metadata.id}.runtime_config.requested_tools`,
11172
+ message: `Agent '${agent.metadata.id}' must declare at least one requested tool.`,
11173
+ suggestion: "Add runtime_config.requested_tools with at least one tool name."
11050
11174
  });
11051
11175
  }
11052
11176
  if (agent.runtimeConfig.permission.length === 0) {
11053
11177
  issues.push({
11054
11178
  level: "error",
11055
- message: `Agent '${agent.metadata.id}' must declare at least one permission rule.`
11179
+ code: "agent_permission_missing",
11180
+ path: `agents.${agent.metadata.id}.runtime_config.permission`,
11181
+ message: `Agent '${agent.metadata.id}' must declare at least one permission rule.`,
11182
+ suggestion: "Add runtime_config.permission with at least one permission rule."
11056
11183
  });
11057
11184
  }
11058
11185
  for (const targetAgentRef of collaborationTargets) {
11059
11186
  if (!agentIds.has(targetAgentRef)) {
11060
11187
  issues.push({
11061
- level: "error",
11062
- message: `Agent '${agent.metadata.id}' references unknown collaboration target '${targetAgentRef}'.`
11188
+ level: "warning",
11189
+ code: "agent_collaboration_target_unknown",
11190
+ path: `agents.${agent.metadata.id}.collaboration`,
11191
+ message: `Agent '${agent.metadata.id}' references unknown collaboration target '${targetAgentRef}'.`,
11192
+ suggestion: "Add the target Agent profile or update the collaboration binding."
11063
11193
  });
11064
11194
  continue;
11065
11195
  }
11066
11196
  if (targetAgentRef !== manifest.leader.agentRef && !manifest.members[targetAgentRef]) {
11067
11197
  issues.push({
11068
11198
  level: "error",
11069
- message: `Agent '${agent.metadata.id}' references collaboration target '${targetAgentRef}' without manifest member guidance.`
11199
+ code: "agent_collaboration_target_missing_member_guidance",
11200
+ path: `agents.${agent.metadata.id}.collaboration`,
11201
+ message: `Agent '${agent.metadata.id}' references collaboration target '${targetAgentRef}' without manifest member guidance.`,
11202
+ suggestion: "Add manifest member guidance for this collaboration target or remove the binding."
11070
11203
  });
11071
11204
  }
11072
11205
  }
@@ -11074,43 +11207,63 @@ function validateTeamDefinition(team) {
11074
11207
  if (manifest.governance.instructionPrecedence.length === 0) {
11075
11208
  issues.push({
11076
11209
  level: "error",
11077
- message: `Team '${manifest.id}' must define governance.instructionPrecedence.`
11210
+ code: "team_governance_instruction_precedence_missing",
11211
+ path: "governance.instruction_precedence",
11212
+ message: `Team '${manifest.id}' must define governance.instructionPrecedence.`,
11213
+ suggestion: "Add governance.instruction_precedence with at least one rule."
11078
11214
  });
11079
11215
  }
11080
11216
  if (!team.policy.instructionPrecedence) {
11081
11217
  issues.push({
11082
11218
  level: "error",
11083
- message: `Team '${manifest.id}' must define policy.instruction_precedence.`
11219
+ code: "team_policy_instruction_precedence_missing",
11220
+ path: "team.policy.yaml.instruction_precedence",
11221
+ message: `Team '${manifest.id}' must define policy.instruction_precedence.`,
11222
+ suggestion: "Add instruction_precedence to team.policy.yaml."
11084
11223
  });
11085
11224
  }
11086
11225
  if (!team.policy.workingRules) {
11087
11226
  issues.push({
11088
11227
  level: "error",
11089
- message: `Team '${manifest.id}' must define policy.working_rules.`
11228
+ code: "team_policy_working_rules_missing",
11229
+ path: "team.policy.yaml.working_rules",
11230
+ message: `Team '${manifest.id}' must define policy.working_rules.`,
11231
+ suggestion: "Add working_rules to team.policy.yaml."
11090
11232
  });
11091
11233
  }
11092
11234
  if (!team.policy.qualityFloor) {
11093
11235
  issues.push({
11094
11236
  level: "error",
11095
- message: `Team '${manifest.id}' must define policy.quality_floor.`
11237
+ code: "team_policy_quality_floor_missing",
11238
+ path: "team.policy.yaml.quality_floor",
11239
+ message: `Team '${manifest.id}' must define policy.quality_floor.`,
11240
+ suggestion: "Add quality_floor to team.policy.yaml."
11096
11241
  });
11097
11242
  }
11098
11243
  if (manifest.governance.workingRules.length === 0) {
11099
11244
  issues.push({
11100
11245
  level: "error",
11101
- message: `Team '${manifest.id}' must define governance.workingRules.`
11246
+ code: "team_governance_working_rules_missing",
11247
+ path: "governance.working_rules",
11248
+ message: `Team '${manifest.id}' must define governance.workingRules.`,
11249
+ suggestion: "Add governance.working_rules with at least one rule."
11102
11250
  });
11103
11251
  }
11104
11252
  if (manifest.governance.qualityFloor.requiredChecks.length === 0) {
11105
11253
  issues.push({
11106
11254
  level: "error",
11107
- message: `Team '${manifest.id}' must define governance.qualityFloor.requiredChecks.`
11255
+ code: "team_governance_required_checks_missing",
11256
+ path: "governance.quality_floor.required_checks",
11257
+ message: `Team '${manifest.id}' must define governance.qualityFloor.requiredChecks.`,
11258
+ suggestion: "Add governance.quality_floor.required_checks with at least one check."
11108
11259
  });
11109
11260
  }
11110
11261
  if (!team.documentation?.teamReadme && !EMBEDDED_TEAM_IDS.includes(manifest.id)) {
11111
11262
  issues.push({
11112
11263
  level: "warning",
11113
- message: `Team '${manifest.id}' has no human-facing TEAM.md or README.md at the team root.`
11264
+ code: "team_documentation_missing",
11265
+ message: `Team '${manifest.id}' has no human-facing TEAM.md or README.md at the team root.`,
11266
+ suggestion: "Add TEAM.md or README.md to document this Team for humans."
11114
11267
  });
11115
11268
  }
11116
11269
  return issues;
@@ -11124,11 +11277,16 @@ function createSkippedTeamIssue(teamDir, message) {
11124
11277
  return {
11125
11278
  level: "warning",
11126
11279
  filePath: teamDir,
11127
- message: `Skipped Team '${path4.basename(teamDir)}': ${message}`
11280
+ code: "team_load_failed",
11281
+ message: `Skipped Team '${path4.basename(teamDir)}': ${message}`,
11282
+ suggestion: "Fix this Team directory; CrewBee will continue loading other valid Teams."
11128
11283
  };
11129
11284
  }
11130
- function loadDefaultTeamLibrary(baseDir = process.cwd()) {
11131
- const configured = listConfiguredTeamSources({ projectWorktree: baseDir });
11285
+ function loadDefaultTeamLibrary(input = process.cwd()) {
11286
+ const baseDir = typeof input === "string" ? input : input.projectWorktree ?? process.cwd();
11287
+ const configured = listConfiguredTeamSources(
11288
+ typeof input === "string" ? { projectWorktree: input } : { globalConfigRoot: input.globalConfigRoot, projectWorktree: input.projectWorktree }
11289
+ );
11132
11290
  const pendingTeams = [];
11133
11291
  for (const source of configured.sources) {
11134
11292
  if (!source.enabled) {
@@ -11153,9 +11311,10 @@ function loadDefaultTeamLibrary(baseDir = process.cwd()) {
11153
11311
  pendingTeams.push({
11154
11312
  loader: () => {
11155
11313
  try {
11314
+ const loaded = loadTeamDefinitionFromDirectoryWithIssues(source.teamDir, baseDir);
11156
11315
  return {
11157
- team: loadTeamDefinitionFromDirectory(source.teamDir, baseDir),
11158
- issues: []
11316
+ team: loaded.team,
11317
+ issues: loaded.issues
11159
11318
  };
11160
11319
  } catch (error45) {
11161
11320
  const message = error45 instanceof Error ? error45.message : String(error45);
@@ -11194,7 +11353,10 @@ function loadDefaultTeamLibrary(baseDir = process.cwd()) {
11194
11353
  configured.issues.push({
11195
11354
  level: "warning",
11196
11355
  filePath: entry.configPath,
11197
- message: entry.sourceScope === "global" && existing.sourceScope === "project" ? `Project Team '${loaded.team.manifest.id}' shadows global Team '${loaded.team.manifest.id}'.` : `Skipped Team '${loaded.team.manifest.id}': duplicate Team id already loaded from ${existing.sourceScope} source.`
11356
+ code: "team_id_shadowed_or_duplicate",
11357
+ sourceScope: entry.sourceScope === "project" || entry.sourceScope === "global" ? entry.sourceScope : void 0,
11358
+ message: entry.sourceScope === "global" && existing.sourceScope === "project" ? `Project Team '${loaded.team.manifest.id}' shadows global Team '${loaded.team.manifest.id}'.` : `Skipped Team '${loaded.team.manifest.id}': duplicate Team id already loaded from ${existing.sourceScope} source.`,
11359
+ suggestion: entry.sourceScope === "global" && existing.sourceScope === "project" ? "This is expected when a project intentionally overrides a global Team id." : "Rename one Team id or disable one Team entry."
11198
11360
  });
11199
11361
  continue;
11200
11362
  }
@@ -11215,6 +11377,9 @@ function loadDefaultTeamLibrary(baseDir = process.cwd()) {
11215
11377
  configured.issues.push(...errors.map((issue2) => ({
11216
11378
  level: "warning",
11217
11379
  filePath: issue2.filePath,
11380
+ code: issue2.code ?? "team_validation_failed",
11381
+ path: issue2.path,
11382
+ suggestion: issue2.suggestion,
11218
11383
  message: `Skipped Team '${normalized.team?.manifest.id ?? "unknown"}': ${issue2.message}`
11219
11384
  })));
11220
11385
  continue;
@@ -11250,8 +11415,8 @@ function loadEmbeddedTeam(source) {
11250
11415
  };
11251
11416
  }
11252
11417
 
11253
- // src/install/config-writer.ts
11254
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "node:fs";
11418
+ // src/install/opencode-config-file.ts
11419
+ import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
11255
11420
 
11256
11421
  // src/install/jsonc.ts
11257
11422
  function parseJsoncText(text) {
@@ -11365,7 +11530,7 @@ function findNextNonWhitespaceCharacter(text, startIndex) {
11365
11530
  return void 0;
11366
11531
  }
11367
11532
 
11368
- // src/install/config-writer.ts
11533
+ // src/install/opencode-config-file.ts
11369
11534
  function readOpenCodeConfig(configPath) {
11370
11535
  if (!existsSync4(configPath)) {
11371
11536
  return {
@@ -11600,6 +11765,9 @@ function createCheckpoint(agent, model) {
11600
11765
  };
11601
11766
  }
11602
11767
 
11768
+ // src/adapters/opencode/defaults.ts
11769
+ var DEFAULT_OPENCODE_EXECUTION_MODE = "single-executor";
11770
+
11603
11771
  // src/adapters/opencode/permission-mapper.ts
11604
11772
  var TOOL_MAP = {
11605
11773
  write: "edit",
@@ -11676,79 +11844,6 @@ function createManagedCrewBeeAgentOptions(input) {
11676
11844
  };
11677
11845
  }
11678
11846
 
11679
- // src/catalog/build-prompt-catalog.ts
11680
- function formatDisplayLabel(key) {
11681
- return key.replace(/_/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\b\w/g, (char) => char.toUpperCase());
11682
- }
11683
- function toTitleLabel(key) {
11684
- return formatDisplayLabel(key);
11685
- }
11686
- function detectNodeKind(value) {
11687
- if (Array.isArray(value)) {
11688
- return "array";
11689
- }
11690
- if (typeof value === "object") {
11691
- return "object";
11692
- }
11693
- return "scalar";
11694
- }
11695
- function buildNode(path10, key, value, order) {
11696
- const kind = detectNodeKind(value);
11697
- if (kind !== "object") {
11698
- return {
11699
- path: path10,
11700
- key,
11701
- label: toTitleLabel(key),
11702
- kind,
11703
- value,
11704
- order,
11705
- visibleByDefault: true
11706
- };
11707
- }
11708
- const children = Object.entries(value).map(
11709
- ([childKey, childValue], index) => buildNode(`${path10}.${childKey}`, childKey, childValue, index)
11710
- );
11711
- return {
11712
- path: path10,
11713
- key,
11714
- label: toTitleLabel(key),
11715
- kind,
11716
- value,
11717
- children,
11718
- order,
11719
- visibleByDefault: true
11720
- };
11721
- }
11722
- function applyMetadataVisibility(node) {
11723
- if (node.path !== "metadata" || !node.children) {
11724
- return node;
11725
- }
11726
- const visiblePaths = /* @__PURE__ */ new Set(["metadata.id", "metadata.name", "metadata.archetype"]);
11727
- return {
11728
- ...node,
11729
- visibleByDefault: false,
11730
- children: node.children.map((child) => ({
11731
- ...child,
11732
- visibleByDefault: visiblePaths.has(child.path)
11733
- }))
11734
- };
11735
- }
11736
- function buildPromptCatalog(doc) {
11737
- const metadataNode = applyMetadataVisibility(buildNode("metadata", "metadata", doc.metadata, -1));
11738
- const nodes = [metadataNode];
11739
- for (const block of doc.blocks) {
11740
- const node = buildNode(block.path, block.key, block.value, block.order);
11741
- nodes.push({
11742
- ...node,
11743
- label: block.title ?? node.label
11744
- });
11745
- }
11746
- return {
11747
- kind: doc.kind,
11748
- nodes
11749
- };
11750
- }
11751
-
11752
11847
  // src/normalize/build-agent-prompt-source.ts
11753
11848
  function isRecord5(value) {
11754
11849
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -11898,6 +11993,79 @@ function buildTeamPromptSource(manifest, policy, bodySections = []) {
11898
11993
  };
11899
11994
  }
11900
11995
 
11996
+ // src/catalog/build-prompt-catalog.ts
11997
+ function formatDisplayLabel(key) {
11998
+ return key.replace(/_/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/\b\w/g, (char) => char.toUpperCase());
11999
+ }
12000
+ function toTitleLabel(key) {
12001
+ return formatDisplayLabel(key);
12002
+ }
12003
+ function detectNodeKind(value) {
12004
+ if (Array.isArray(value)) {
12005
+ return "array";
12006
+ }
12007
+ if (typeof value === "object") {
12008
+ return "object";
12009
+ }
12010
+ return "scalar";
12011
+ }
12012
+ function buildNode(path10, key, value, order) {
12013
+ const kind = detectNodeKind(value);
12014
+ if (kind !== "object") {
12015
+ return {
12016
+ path: path10,
12017
+ key,
12018
+ label: toTitleLabel(key),
12019
+ kind,
12020
+ value,
12021
+ order,
12022
+ visibleByDefault: true
12023
+ };
12024
+ }
12025
+ const children = Object.entries(value).map(
12026
+ ([childKey, childValue], index) => buildNode(`${path10}.${childKey}`, childKey, childValue, index)
12027
+ );
12028
+ return {
12029
+ path: path10,
12030
+ key,
12031
+ label: toTitleLabel(key),
12032
+ kind,
12033
+ value,
12034
+ children,
12035
+ order,
12036
+ visibleByDefault: true
12037
+ };
12038
+ }
12039
+ function applyMetadataVisibility(node) {
12040
+ if (node.path !== "metadata" || !node.children) {
12041
+ return node;
12042
+ }
12043
+ const visiblePaths = /* @__PURE__ */ new Set(["metadata.id", "metadata.name", "metadata.archetype"]);
12044
+ return {
12045
+ ...node,
12046
+ visibleByDefault: false,
12047
+ children: node.children.map((child) => ({
12048
+ ...child,
12049
+ visibleByDefault: visiblePaths.has(child.path)
12050
+ }))
12051
+ };
12052
+ }
12053
+ function buildPromptCatalog(doc) {
12054
+ const metadataNode = applyMetadataVisibility(buildNode("metadata", "metadata", doc.metadata, -1));
12055
+ const nodes = [metadataNode];
12056
+ for (const block of doc.blocks) {
12057
+ const node = buildNode(block.path, block.key, block.value, block.order);
12058
+ nodes.push({
12059
+ ...node,
12060
+ label: block.title ?? node.label
12061
+ });
12062
+ }
12063
+ return {
12064
+ kind: doc.kind,
12065
+ nodes
12066
+ };
12067
+ }
12068
+
11901
12069
  // src/plan/build-prompt-plan.ts
11902
12070
  var CANONICAL_SECTION_TITLES = {
11903
12071
  working_rules: "Working Rules",
@@ -12101,17 +12269,25 @@ function renderPromptPlan(plan, ctx = defaultRenderContext) {
12101
12269
  return plan.sections.map((section) => renderSection(section, ctx)).filter((block) => Boolean(block)).join("\n\n");
12102
12270
  }
12103
12271
 
12272
+ // src/render/prompt-document-renderer.ts
12273
+ function renderNormalizedPromptDocument(document) {
12274
+ const catalog = buildPromptCatalog(document);
12275
+ const projectedCatalog = applyPromptProjection(catalog, document.promptProjection);
12276
+ const plan = buildPromptPlan(projectedCatalog);
12277
+ return renderPromptPlan(plan, defaultRenderContext);
12278
+ }
12279
+
12104
12280
  // src/adapters/opencode/prompt-builder.ts
12105
12281
  function resolveTargetAgent(team, agentRef) {
12106
12282
  return team.agents.find((candidate) => candidate.metadata.id === agentRef);
12107
12283
  }
12108
12284
  function createCollaborationPromptValue(agent) {
12109
12285
  const team = agent.sourceTeam;
12110
- const mapBinding = (binding3) => {
12111
- const agentRef = typeof binding3 === "string" ? binding3 : binding3.agentRef;
12286
+ const mapBinding = (binding2) => {
12287
+ const agentRef = typeof binding2 === "string" ? binding2 : binding2.agentRef;
12112
12288
  const targetAgent = resolveTargetAgent(team, agentRef);
12113
12289
  const member = team.manifest.members[agentRef];
12114
- const fallbackDescription = typeof binding3 === "string" ? void 0 : binding3.description;
12290
+ const fallbackDescription = typeof binding2 === "string" ? void 0 : binding2.description;
12115
12291
  return {
12116
12292
  id: targetAgent ? targetAgent.canonicalAgentId ?? targetAgent.metadata.id : agentRef,
12117
12293
  description: member?.responsibility ?? targetAgent?.responsibilityCore.description ?? fallbackDescription ?? agentRef,
@@ -12137,17 +12313,11 @@ function createOpenCodeAgentPrompt(agent, _requestedTools) {
12137
12313
  },
12138
12314
  agent.sourceTeam.policy
12139
12315
  );
12140
- const teamPart = renderPromptPlan(
12141
- buildPromptPlan(applyPromptProjection(buildPromptCatalog(teamSource), teamSource.promptProjection)),
12142
- defaultRenderContext
12143
- );
12316
+ const teamPart = renderNormalizedPromptDocument(teamSource);
12144
12317
  const normalizedAgent = buildAgentPromptSourceWithOverrides(agent.sourceAgent, {
12145
12318
  collaborationValue: createCollaborationPromptValue(agent)
12146
12319
  });
12147
- const agentPart = renderPromptPlan(
12148
- buildPromptPlan(applyPromptProjection(buildPromptCatalog(normalizedAgent), normalizedAgent.promptProjection)),
12149
- defaultRenderContext
12150
- );
12320
+ const agentPart = renderNormalizedPromptDocument(normalizedAgent);
12151
12321
  return [renderPart("Team Contract", teamPart), renderPart("Agent Contract", agentPart)].filter((block) => Boolean(block)).join("\n\n");
12152
12322
  }
12153
12323
 
@@ -12313,15 +12483,15 @@ function createChatMessageHook(input) {
12313
12483
  if (!agent) {
12314
12484
  return;
12315
12485
  }
12316
- const binding3 = createSessionRuntimeBinding({
12486
+ const binding2 = createSessionRuntimeBinding({
12317
12487
  projection: boot.projection,
12318
12488
  sessionID: message.sessionID,
12319
12489
  teamId: agent.teamId,
12320
12490
  canonicalAgentId: agent.canonicalAgentId,
12321
- mode: "single-executor",
12491
+ mode: DEFAULT_OPENCODE_EXECUTION_MODE,
12322
12492
  source: message.agent ? "host-agent-selection" : "plugin-default"
12323
12493
  });
12324
- input.bindings.set(message.sessionID, binding3);
12494
+ input.bindings.set(message.sessionID, binding2);
12325
12495
  input.store.setCheckpoint(message.sessionID, createCheckpoint(agent, resolveModel(agent, message.model)));
12326
12496
  };
12327
12497
  }
@@ -12661,7 +12831,6 @@ async function logCrewBee(ctx, message, extra, level = "info") {
12661
12831
  }
12662
12832
 
12663
12833
  // src/adapters/opencode/config-hook.ts
12664
- var DEFAULT_MODE = "single-executor";
12665
12834
  function summarizeProjectedAgents(boot) {
12666
12835
  return boot.projectedAgents.map((agent) => ({
12667
12836
  configKey: agent.configKey,
@@ -12674,7 +12843,7 @@ function getConfig(cfg) {
12674
12843
  }
12675
12844
  async function validateAndLogTeamLibrary(ctx, teamLibrary) {
12676
12845
  const issues = validateTeamLibrary(teamLibrary);
12677
- const errors = issues.filter((issue2) => issue2.level === "error");
12846
+ const errors = issues.filter((issue2) => issue2.level === "error" && issue2.blocking !== false);
12678
12847
  if (errors.length > 0) {
12679
12848
  throw new Error(errors.map((issue2) => issue2.message).join("\n"));
12680
12849
  }
@@ -12684,7 +12853,14 @@ async function validateAndLogTeamLibrary(ctx, teamLibrary) {
12684
12853
  service: "crewbee",
12685
12854
  level: issue2.level === "warning" ? "warn" : "error",
12686
12855
  message: issue2.message,
12687
- extra: issue2.filePath ? { filePath: issue2.filePath } : void 0
12856
+ extra: {
12857
+ ...issue2.filePath ? { filePath: issue2.filePath } : {},
12858
+ ...issue2.code ? { code: issue2.code } : {},
12859
+ ...issue2.path ? { path: issue2.path } : {},
12860
+ ...issue2.sourceScope ? { sourceScope: issue2.sourceScope } : {},
12861
+ ...issue2.fixable !== void 0 ? { fixable: issue2.fixable } : {},
12862
+ ...issue2.suggestion ? { suggestion: issue2.suggestion } : {}
12863
+ }
12688
12864
  }
12689
12865
  }))
12690
12866
  );
@@ -12692,7 +12868,7 @@ async function validateAndLogTeamLibrary(ctx, teamLibrary) {
12692
12868
  function createInitialBootstrap(teamLibrary) {
12693
12869
  const boot = createOpenCodeBootstrap({
12694
12870
  teamLibrary,
12695
- defaults: { defaultMode: DEFAULT_MODE }
12871
+ defaults: { defaultMode: DEFAULT_OPENCODE_EXECUTION_MODE }
12696
12872
  });
12697
12873
  return {
12698
12874
  boot,
@@ -12704,7 +12880,7 @@ function createConfigHook(input) {
12704
12880
  const current = getConfig(cfg);
12705
12881
  const next = createOpenCodeBootstrap({
12706
12882
  teamLibrary: input.teamLibrary,
12707
- defaults: { defaultMode: DEFAULT_MODE },
12883
+ defaults: { defaultMode: DEFAULT_OPENCODE_EXECUTION_MODE },
12708
12884
  existingConfig: current,
12709
12885
  existingDefaultAgent: typeof current.default_agent === "string" ? current.default_agent : void 0
12710
12886
  });
@@ -25402,11 +25578,11 @@ function resolveDelegateAgent(input) {
25402
25578
  canonicalAgentId: byAlias.agent.canonicalAgentId
25403
25579
  };
25404
25580
  }
25405
- function isSelfDelegate(binding3, canonicalAgentId) {
25406
- if (!binding3) {
25581
+ function isSelfDelegate(binding2, canonicalAgentId) {
25582
+ if (!binding2) {
25407
25583
  return false;
25408
25584
  }
25409
- return binding3.selectedAgentId === canonicalAgentId;
25585
+ return binding2.selectedAgentId === canonicalAgentId;
25410
25586
  }
25411
25587
 
25412
25588
  // src/adapters/opencode/delegation/tool-result.ts
@@ -25572,8 +25748,8 @@ function createDelegateTools(input) {
25572
25748
  if (!target) {
25573
25749
  return stringifyDelegateTaskResult(createFailedResult(ctx.sessionID, "unknown_agent", `Unknown CrewBee agent: ${args.agent}`));
25574
25750
  }
25575
- const binding3 = input.bindings.get(ctx.sessionID);
25576
- if (isSelfDelegate(binding3, target.canonicalAgentId)) {
25751
+ const binding2 = input.bindings.get(ctx.sessionID);
25752
+ if (isSelfDelegate(binding2, target.canonicalAgentId)) {
25577
25753
  return stringifyDelegateTaskResult(createFailedResult(ctx.sessionID, "self_delegate_forbidden", "Do not delegate a CrewBee session back to the same active agent."));
25578
25754
  }
25579
25755
  const title = createDelegatedTitle(target.canonicalAgentId, args.prompt);
@@ -25693,22 +25869,39 @@ function createDelegateTools(input) {
25693
25869
  }
25694
25870
 
25695
25871
  // src/adapters/opencode/system-transform-hook.ts
25696
- function createSystemTransformHook(bindings) {
25872
+ function createSystemTransformHook(bindings, getLoadIssues = () => []) {
25697
25873
  return async (input, output) => {
25698
25874
  if (!input.sessionID) {
25699
25875
  return;
25700
25876
  }
25701
- const binding3 = bindings.get(input.sessionID);
25702
- if (!binding3) {
25877
+ const binding2 = bindings.get(input.sessionID);
25878
+ if (!binding2) {
25703
25879
  return;
25704
25880
  }
25705
- output.system.push([
25881
+ const lines = [
25706
25882
  "CrewBee runtime binding:",
25707
- `- Team: ${binding3.teamId}`,
25708
- `- Entry Agent: ${binding3.selectedAgentId}`,
25709
- `- Active Owner: ${binding3.activeOwnerId}`,
25710
- `- Mode: ${binding3.mode}`
25711
- ].join("\n"));
25883
+ `- Team: ${binding2.teamId}`,
25884
+ `- Entry Agent: ${binding2.selectedAgentId}`,
25885
+ `- Active Owner: ${binding2.activeOwnerId}`,
25886
+ `- Mode: ${binding2.mode}`
25887
+ ];
25888
+ const loadIssues = getLoadIssues();
25889
+ if (loadIssues.length > 0) {
25890
+ lines.push(
25891
+ "- Team Load Warnings:",
25892
+ ...loadIssues.map((issue2) => {
25893
+ const details = [
25894
+ issue2.code,
25895
+ issue2.sourceScope ? `scope=${issue2.sourceScope}` : void 0,
25896
+ issue2.filePath,
25897
+ issue2.path ? `path=${issue2.path}` : void 0,
25898
+ issue2.suggestion ? `suggestion=${issue2.suggestion}` : void 0
25899
+ ].filter(Boolean).join("; ");
25900
+ return ` - ${issue2.message}${details ? ` (${details})` : ""}`;
25901
+ })
25902
+ );
25903
+ }
25904
+ output.system.push(lines.join("\n"));
25712
25905
  };
25713
25906
  }
25714
25907
 
@@ -25953,7 +26146,7 @@ function resolveReleaseLockPath() {
25953
26146
  }
25954
26147
 
25955
26148
  // src/update/workspace.ts
25956
- import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync6, rmSync, writeFileSync as writeFileSync5 } from "node:fs";
26149
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync6, rmSync as rmSync2, writeFileSync as writeFileSync5 } from "node:fs";
25957
26150
  import path8 from "node:path";
25958
26151
  function readInstalledWorkspaceVersion(workspaceRoot) {
25959
26152
  const manifestPath = path8.join(workspaceRoot, "node_modules", "crewbee", "package.json");
@@ -25994,11 +26187,11 @@ function invalidateWorkspacePackage(intent) {
25994
26187
  const lockPath = path8.join(intent.workspaceRoot, "package-lock.json");
25995
26188
  let changed = false;
25996
26189
  if (existsSync7(packageRoot)) {
25997
- rmSync(packageRoot, { recursive: true, force: true });
26190
+ rmSync2(packageRoot, { recursive: true, force: true });
25998
26191
  changed = true;
25999
26192
  }
26000
26193
  if (existsSync7(lockPath)) {
26001
- rmSync(lockPath, { force: true });
26194
+ rmSync2(lockPath, { force: true });
26002
26195
  changed = true;
26003
26196
  }
26004
26197
  return changed;
@@ -26234,7 +26427,10 @@ var OpenCodeCrewBeePlugin = async (ctx) => {
26234
26427
  getAliasIndex: () => aliasIndex
26235
26428
  }),
26236
26429
  "tool.execute.after": createToolExecuteAfterHook(),
26237
- "experimental.chat.system.transform": createSystemTransformHook(bindings),
26430
+ "experimental.chat.system.transform": createSystemTransformHook(
26431
+ bindings,
26432
+ () => teamLibrary.loadIssues ?? []
26433
+ ),
26238
26434
  "experimental.session.compacting": createCompactionHook(ctx, store)
26239
26435
  };
26240
26436
  };