vgxness 0.1.1-alpha.1 → 1.0.1

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 (181) hide show
  1. package/README.md +35 -9
  2. package/dist/agents/agent-activation-service.js +112 -6
  3. package/dist/agents/agent-registry-service.js +3 -1
  4. package/dist/agents/agent-resolver.js +14 -25
  5. package/dist/agents/agent-seed-service.js +2 -1
  6. package/dist/agents/manager-profile-overlay-service.js +6 -2
  7. package/dist/agents/profile-model-routing.js +6 -2
  8. package/dist/agents/renderers/claude-renderer.js +5 -1
  9. package/dist/agents/renderers/index.js +1 -3
  10. package/dist/agents/renderers/json-renderer.js +24 -7
  11. package/dist/agents/renderers/opencode-renderer.js +14 -3
  12. package/dist/agents/repositories/agents.js +23 -8
  13. package/dist/agents/repositories/manager-profile-overlays.js +15 -6
  14. package/dist/cli/cli-flags.js +328 -0
  15. package/dist/cli/cli-help.js +157 -0
  16. package/dist/cli/cli-helpers.js +77 -0
  17. package/dist/cli/cli-types.js +1 -0
  18. package/dist/cli/commands/agent-skill-dispatcher.js +665 -0
  19. package/dist/cli/commands/dashboard-dispatcher.js +528 -0
  20. package/dist/cli/commands/index.js +8 -0
  21. package/dist/cli/commands/mcp-dispatcher.js +115 -0
  22. package/dist/cli/commands/memory-sdd-dispatcher.js +297 -0
  23. package/dist/cli/commands/run-permission-dispatcher.js +304 -0
  24. package/dist/cli/commands/setup-dispatcher.js +436 -0
  25. package/dist/cli/commands/verification-dispatcher.js +47 -0
  26. package/dist/cli/commands/workflow-dispatcher.js +560 -0
  27. package/dist/cli/dashboard-operational-read-models.js +289 -14
  28. package/dist/cli/dashboard-renderer.js +56 -7
  29. package/dist/cli/dashboard-screen-renderers.js +132 -230
  30. package/dist/cli/dashboard-tui-read-model.js +7 -5
  31. package/dist/cli/dashboard-tui-state.js +72 -27
  32. package/dist/cli/dispatcher.js +85 -2907
  33. package/dist/cli/doctor-renderer.js +26 -0
  34. package/dist/cli/guided-main-menu.js +30 -6
  35. package/dist/cli/index.js +1 -1
  36. package/dist/cli/interactive-dashboard.js +7 -2
  37. package/dist/cli/sdd-renderer.js +146 -0
  38. package/dist/cli/setup-plan-renderer.js +54 -0
  39. package/dist/cli/setup-status-renderer.js +18 -3
  40. package/dist/cli/setup-wizard-read-model.js +22 -6
  41. package/dist/cli/setup-wizard-renderer.js +19 -12
  42. package/dist/cli/tui/dashboard/dashboard-adapter.js +4 -0
  43. package/dist/cli/tui/keymap.js +20 -0
  44. package/dist/cli/tui/main-menu/index.js +7 -0
  45. package/dist/cli/tui/main-menu/main-menu-actions.js +34 -0
  46. package/dist/cli/tui/main-menu/main-menu-app.js +28 -0
  47. package/dist/cli/tui/main-menu/main-menu-controller.js +13 -0
  48. package/dist/cli/tui/main-menu/main-menu-read-model.js +76 -0
  49. package/dist/cli/tui/main-menu/main-menu-render-shape.js +29 -0
  50. package/dist/cli/tui/main-menu/main-menu-result.js +1 -0
  51. package/dist/cli/tui/main-menu/main-menu-state.js +21 -0
  52. package/dist/cli/tui/navigation.js +10 -0
  53. package/dist/cli/tui/render-ink-app.js +10 -0
  54. package/dist/cli/tui/setup/screens/applying-screen.js +6 -0
  55. package/dist/cli/tui/setup/screens/cancellation-screen.js +6 -0
  56. package/dist/cli/tui/setup/screens/error-recovery-screen.js +6 -0
  57. package/dist/cli/tui/setup/screens/final-confirmation-screen.js +6 -0
  58. package/dist/cli/tui/setup/screens/opencode-details-screen.js +10 -0
  59. package/dist/cli/tui/setup/screens/plan-review-screen.js +6 -0
  60. package/dist/cli/tui/setup/screens/project-database-screen.js +6 -0
  61. package/dist/cli/tui/setup/screens/provider-screen.js +7 -0
  62. package/dist/cli/tui/setup/screens/result-screen.js +11 -0
  63. package/dist/cli/tui/setup/screens/screen-components.js +103 -0
  64. package/dist/cli/tui/setup/screens/welcome-screen.js +6 -0
  65. package/dist/cli/tui/setup/setup-tui-actions.js +1 -0
  66. package/dist/cli/tui/setup/setup-tui-app.js +113 -0
  67. package/dist/cli/tui/setup/setup-tui-controller.js +82 -0
  68. package/dist/cli/tui/setup/setup-tui-read-model.js +164 -0
  69. package/dist/cli/tui/setup/setup-tui-render-shape.js +146 -0
  70. package/dist/cli/tui/setup/setup-tui-result.js +1 -0
  71. package/dist/cli/tui/setup/setup-tui-services.js +60 -0
  72. package/dist/cli/tui/setup/setup-tui-state.js +188 -0
  73. package/dist/cli/tui/terminal-capabilities.js +12 -0
  74. package/dist/cli/tui/tui-types.js +1 -0
  75. package/dist/cli/tui/visual/badges.js +19 -0
  76. package/dist/cli/tui/visual/choice-list.js +10 -0
  77. package/dist/cli/tui/visual/footer.js +27 -0
  78. package/dist/cli/tui/visual/index.js +5 -0
  79. package/dist/cli/tui/visual/layout.js +10 -0
  80. package/dist/cli/tui/visual/viewport.js +11 -0
  81. package/dist/cli/tui-render-helpers.js +12 -4
  82. package/dist/cli/verification-plan-renderer.js +25 -0
  83. package/dist/cli/verification-report-renderer.js +19 -0
  84. package/dist/code/cli/code-command.js +65 -26
  85. package/dist/code/config/defaults.js +36 -32
  86. package/dist/code/prompts/prompt-builder.js +79 -62
  87. package/dist/code/providers/credentials.js +5 -5
  88. package/dist/code/providers/fake-provider-adapter.js +45 -37
  89. package/dist/code/providers/message-mapper.js +30 -20
  90. package/dist/code/providers/openai-compatible-provider-adapter.js +35 -17
  91. package/dist/code/providers/provider-adapter.js +1 -1
  92. package/dist/code/providers/provider-registry.js +18 -8
  93. package/dist/code/providers/stream-normalizer.js +19 -14
  94. package/dist/code/reporting/redaction.js +11 -11
  95. package/dist/code/reporting/summary.js +16 -11
  96. package/dist/code/runtime/approval-coordinator.js +409 -16
  97. package/dist/code/runtime/code-runtime.js +750 -167
  98. package/dist/code/runtime/gateways.js +37 -14
  99. package/dist/code/runtime/project-detection.js +29 -31
  100. package/dist/code/runtime/runs-code-run-gateway.js +4 -4
  101. package/dist/code/runtime/sdd-context.js +70 -12
  102. package/dist/code/runtime/verification-coordinator.js +15 -11
  103. package/dist/code/tools/read-only-executor.js +31 -34
  104. package/dist/code/tools/tool-definitions.js +27 -27
  105. package/dist/code/tools/tool-result-normalizer.js +89 -4
  106. package/dist/code/tools/workspace-executor.js +170 -66
  107. package/dist/export/redaction.js +9 -24
  108. package/dist/governance/governance-report-builder.js +62 -38
  109. package/dist/governance/index.js +1 -1
  110. package/dist/governance/overlay-fingerprint.js +4 -4
  111. package/dist/harness/tools/agents.js +45 -57
  112. package/dist/harness/tools/memory.js +2 -2
  113. package/dist/mcp/client-install-opencode-contract.js +87 -116
  114. package/dist/mcp/client-install-opencode.js +40 -17
  115. package/dist/mcp/client-setup-preview.js +1 -3
  116. package/dist/mcp/control-plane.js +47 -14
  117. package/dist/mcp/doctor.js +5 -5
  118. package/dist/mcp/index.js +10 -8
  119. package/dist/mcp/opencode-default-agent-config.js +36 -85
  120. package/dist/mcp/opencode-visibility.js +11 -8
  121. package/dist/mcp/provider-change-plan.js +262 -0
  122. package/dist/mcp/provider-doctor.js +73 -11
  123. package/dist/mcp/provider-health-types.js +4 -1
  124. package/dist/mcp/provider-status.js +107 -11
  125. package/dist/mcp/schema.js +213 -75
  126. package/dist/mcp/stdio-server.js +16 -8
  127. package/dist/mcp/validation.js +188 -14
  128. package/dist/memory/import/index.js +1 -1
  129. package/dist/memory/import/observation-writer.js +10 -4
  130. package/dist/memory/import/package.js +5 -4
  131. package/dist/memory/memory-service.js +21 -5
  132. package/dist/memory/repositories/artifacts.js +26 -5
  133. package/dist/memory/repositories/observations.js +82 -19
  134. package/dist/memory/repositories/sessions.js +30 -13
  135. package/dist/memory/repositories/traces.js +26 -6
  136. package/dist/memory/sqlite/database.js +1 -1
  137. package/dist/memory/storage-paths.js +6 -6
  138. package/dist/orchestrator/natural-language-planner.js +55 -9
  139. package/dist/payload/payload-summary.js +45 -0
  140. package/dist/permissions/index.js +1 -1
  141. package/dist/permissions/policy-evaluator.js +14 -3
  142. package/dist/providers/opencode/injection-preview.js +6 -2
  143. package/dist/providers/opencode/manager-payload.js +80 -9
  144. package/dist/runs/execution-planning.js +3 -9
  145. package/dist/runs/operation-retry.js +6 -1
  146. package/dist/runs/repositories/runs.js +98 -44
  147. package/dist/runs/run-insights.js +147 -22
  148. package/dist/runs/run-service.js +136 -50
  149. package/dist/runs/sandbox-process-execution.js +2 -2
  150. package/dist/sdd/artifact-portability-service.js +24 -5
  151. package/dist/sdd/schema.js +18 -13
  152. package/dist/sdd/sdd-workflow-service.js +255 -83
  153. package/dist/setup/backup-rollback-service.js +251 -19
  154. package/dist/setup/index.js +1 -1
  155. package/dist/setup/providers/antigravity-setup-adapter.js +9 -1
  156. package/dist/setup/providers/claude-setup-adapter.js +17 -3
  157. package/dist/setup/providers/custom-setup-adapter.js +9 -1
  158. package/dist/setup/providers/index.js +4 -4
  159. package/dist/setup/providers/opencode-setup-adapter.js +92 -10
  160. package/dist/setup/providers/provider-setup-registry.js +6 -1
  161. package/dist/setup/setup-defaults.js +2 -2
  162. package/dist/setup/setup-lifecycle-service.js +41 -8
  163. package/dist/setup/setup-plan.js +43 -8
  164. package/dist/skills/repositories/skill-evaluation-scenarios.js +29 -13
  165. package/dist/skills/repositories/skill-improvement-proposals.js +28 -12
  166. package/dist/skills/repositories/skills.js +36 -16
  167. package/dist/skills/skill-payload.js +59 -10
  168. package/dist/skills/skill-registry-service.js +6 -4
  169. package/dist/skills/skill-resolver.js +14 -8
  170. package/dist/skills/skill-seed-service.js +7 -1
  171. package/dist/skills/skill-status-service.js +138 -0
  172. package/dist/verification/index.js +4 -0
  173. package/dist/verification/verification-plan-service.js +107 -0
  174. package/dist/verification/verification-plan.js +40 -0
  175. package/dist/verification/verification-report-service.js +80 -0
  176. package/dist/verification/verification-report.js +69 -0
  177. package/dist/workflows/command-allowlist-adapter.js +25 -4
  178. package/dist/workflows/workflow-executor.js +97 -21
  179. package/docs/cli.md +49 -30
  180. package/docs/funcionamiento-del-sistema.md +2 -2
  181. package/package.json +6 -3
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # VGXNESS
2
2
 
3
- VGXNESS is an alpha CLI and MCP control plane for guided AI-agent workflows, SDD artifacts, local memory, and OpenCode integration.
3
+ VGXNESS is an installable CLI and MCP control plane for guided AI-agent workflows, SDD artifacts, local memory, and OpenCode integration.
4
4
 
5
- ## Alpha status and license
5
+ ## Release status and license
6
6
 
7
7
  This package is proprietary software. The npm package ships inspectable JavaScript (`dist/`) so Node can run it, but it is **not open-source licensed** and may not be redistributed unless you have written permission. See [LICENSE](./LICENSE).
8
8
 
9
- OpenCode is the primary supported provider in this alpha. Other providers are preview/manual only. The dashboard is read-only/copy-only; provider config writes require explicit CLI confirmation.
9
+ OpenCode is the primary supported provider. Other providers remain preview/manual only. The dashboard is read-only/copy-only; provider config writes require explicit CLI confirmation.
10
10
 
11
11
  ## Requirements
12
12
 
@@ -22,19 +22,24 @@ vgx --help
22
22
  vgxness --help
23
23
  ```
24
24
 
25
- Use the `alpha` npm dist-tag for alpha releases when publishing/consuming pre-release builds.
26
-
27
25
  ## First setup with OpenCode
28
26
 
29
- Run the guided setup wizard in a TTY, or preview the same safe setup plan in non-interactive shells:
27
+ Run the guided setup wizard in a TTY:
30
28
 
31
29
  ```bash
32
30
  vgx init
33
- # equivalent explicit command
31
+ ```
32
+
33
+ In non-TTY shells, `vgx init` prints the same read-only setup plan instead of prompting. For a copyable happy path after installing the package globally:
34
+
35
+ ```bash
34
36
  vgx setup plan
37
+ vgx setup apply --yes
38
+ vgx doctor
39
+ vgx sdd next --project <project> --change <change>
35
40
  ```
36
41
 
37
- Defaults for the alpha are: package `vgxness`, provider `opencode`, global user data DB, project OpenCode scope, and `mcp-plus-agents` mode. The generated MCP command for the global DB default is:
42
+ Stable defaults are: package `vgxness`, provider `opencode`, global user data DB, user/global OpenCode scope (`$HOME/.config/opencode/opencode.json`), and `mcp-plus-agents` mode. Use `--scope project` only when you intentionally want `<workspace>/.opencode/opencode.json`. The generated MCP command for the global DB default is:
38
43
 
39
44
  ```bash
40
45
  vgxness mcp start
@@ -46,6 +51,27 @@ Apply only after reviewing the plan:
46
51
  vgx setup apply --yes
47
52
  ```
48
53
 
54
+ `vgx setup plan` and `vgx setup status` are human-readable and read-only by default. `vgx doctor`, `vgx sdd status`, `vgx sdd next`, and `vgx sdd accept-artifact` are also human-readable by default. Pass `--json` when you need parseable automation output. `vgx setup apply --yes` is the explicit provider-config write path.
55
+
56
+ ## Safety model
57
+
58
+ - Preview, status, and plan commands are read-only.
59
+ - Provider config writes require explicit `--yes` confirmation.
60
+ - The dashboard is read-only/copy-only; run copied commands outside the TUI when you choose to act.
61
+ - SDD artifacts are SQLite-backed through VGXNESS services. Do not create or write `openspec/`.
62
+ - `vgx sdd accept-artifact` records explicit human-only acceptance; saving a draft never implies acceptance.
63
+ - OpenCode is the primary supported provider; other providers are preview/manual extension points.
64
+
65
+ ## Dashboard entrypoint
66
+
67
+ Run `vgx` or `vgxness` with no arguments in an interactive terminal to open the operational dashboard. `vgx dashboard interactive` opens the same read-only/copy-only surface. In non-TTY shells, no-args prints static safe guidance and exits 0 without reading dashboard status or inferring project state.
68
+
69
+ For scripts, use the read-only status renderer with an explicit project:
70
+
71
+ ```bash
72
+ vgx dashboard status --project <name>
73
+ ```
74
+
49
75
  For project-local or custom databases, use `--db project-local` or `--db custom --db-path <path>` with setup commands. Existing low-level commands remain available:
50
76
 
51
77
  ```bash
@@ -93,7 +119,7 @@ npm run package:dry-run
93
119
  npm run package:smoke:install
94
120
  ```
95
121
 
96
- Do not publish from CI. Use `npm publish --dry-run --tag alpha` as a final manual gate only.
122
+ Do not publish from CI. Use `npm publish --dry-run --tag latest` as the final manual gate for the stable path before any explicit publish decision.
97
123
 
98
124
  ## Uninstall
99
125
 
@@ -1,3 +1,4 @@
1
+ import { responseByteAccounting, summarizePayloadContent } from '../payload/payload-summary.js';
1
2
  import { resolveAgentProfileModel } from './profile-model-routing.js';
2
3
  const defaultAgentName = 'vgxness-manager';
3
4
  const provider = 'opencode';
@@ -17,7 +18,10 @@ export class AgentActivationService {
17
18
  return agent;
18
19
  if (agent.value.mode !== 'agent')
19
20
  return validationFailure('Agent activation requires a top-level agent');
20
- const selection = resolveAgentProfileModel({ agent: agent.value, ...(validated.value.providerAdapter === undefined ? {} : { providerAdapter: validated.value.providerAdapter }) });
21
+ const selection = resolveAgentProfileModel({
22
+ agent: agent.value,
23
+ ...(validated.value.providerAdapter === undefined ? {} : { providerAdapter: validated.value.providerAdapter }),
24
+ });
21
25
  if (!selection.ok)
22
26
  return selection;
23
27
  if (selection.value.providerAdapter !== provider)
@@ -36,7 +40,7 @@ export class AgentActivationService {
36
40
  const payload = this.dependencies.opencodeManagerPayload.build(toPayloadInput(validated.value, agent.value.id));
37
41
  if (!payload.ok)
38
42
  return this.failAfterRun(run.value.id, payload.error.code, payload.error.message);
39
- const envelopeWithoutRun = {
43
+ const verboseEnvelopeWithoutRun = {
40
44
  version: 1,
41
45
  agent: { id: agent.value.id, name: agent.value.name, scope: agent.value.scope, mode: 'agent' },
42
46
  provider,
@@ -52,10 +56,11 @@ export class AgentActivationService {
52
56
  ...payload.value.warnings,
53
57
  ],
54
58
  };
59
+ const envelopeWithoutRun = validated.value.payloadMode === 'compact' ? compactActivationEnvelope(verboseEnvelopeWithoutRun, validated.value) : verboseEnvelopeWithoutRun;
55
60
  const checkpoint = this.dependencies.runs.appendCheckpoint({
56
61
  runId: run.value.id,
57
62
  label: 'agent-activation-initial',
58
- state: toJson({ ...envelopeWithoutRun, run: { id: run.value.id, status: 'created', checkpointId: null } }),
63
+ state: toJson(checkpointState(envelopeWithoutRun, run.value.id, validated.value.payloadMode ?? 'verbose')),
59
64
  });
60
65
  if (!checkpoint.ok)
61
66
  return this.failAfterRun(run.value.id, checkpoint.error.code, checkpoint.error.message);
@@ -82,7 +87,11 @@ export class AgentActivationService {
82
87
  if (input.agentId !== undefined)
83
88
  return this.dependencies.agents.getAgent(input.agentId);
84
89
  if (this.dependencies.managerProfiles !== undefined) {
85
- const effective = this.dependencies.managerProfiles.resolveEffectiveManager({ project: input.project, scope: input.scope, managerName: defaultAgentName });
90
+ const effective = this.dependencies.managerProfiles.resolveEffectiveManager({
91
+ project: input.project,
92
+ scope: input.scope,
93
+ managerName: defaultAgentName,
94
+ });
86
95
  return effective.ok ? ok(effective.value.manager) : effective;
87
96
  }
88
97
  return this.dependencies.agents.getAgentByName(input.project, input.scope, defaultAgentName);
@@ -105,6 +114,8 @@ function validateActivationInput(input) {
105
114
  return validationFailure('userIntent is required');
106
115
  if (input.agentId !== undefined && input.agentId.trim().length === 0)
107
116
  return validationFailure('agentId must not be empty');
117
+ if (input.payloadMode !== undefined && input.payloadMode !== 'compact' && input.payloadMode !== 'verbose')
118
+ return validationFailure('payloadMode must be compact or verbose');
108
119
  const validated = {
109
120
  project: input.project.trim(),
110
121
  scope: input.scope ?? 'project',
@@ -123,6 +134,8 @@ function validateActivationInput(input) {
123
134
  return validationFailure('providerAdapter must not be empty');
124
135
  validated.providerAdapter = input.providerAdapter.trim();
125
136
  }
137
+ if (input.payloadMode !== undefined)
138
+ validated.payloadMode = input.payloadMode;
126
139
  return ok(validated);
127
140
  }
128
141
  function toPayloadInput(input, agentId) {
@@ -135,10 +148,103 @@ function toPayloadInput(input, agentId) {
135
148
  payload.workspaceRoot = input.workspaceRoot;
136
149
  if (input.maxSourceBytes !== undefined)
137
150
  payload.maxSourceBytes = input.maxSourceBytes;
151
+ payload.payloadMode = input.payloadMode ?? 'verbose';
138
152
  return payload;
139
153
  }
154
+ function checkpointState(envelopeWithoutRun, runId, mode) {
155
+ const base = { ...envelopeWithoutRun, run: { id: runId, status: 'created', checkpointId: null } };
156
+ if (mode === 'verbose')
157
+ return toJson(base);
158
+ return toJson({
159
+ version: base.version,
160
+ run: base.run,
161
+ agent: base.agent,
162
+ provider: base.provider,
163
+ modelSelection: base.modelSelection,
164
+ providerPayload: {
165
+ version: base.providerPayload.version,
166
+ provider: base.providerPayload.provider,
167
+ payloadMode: base.providerPayload.payloadMode,
168
+ selection: base.providerPayload.selection,
169
+ providerArtifacts: base.providerPayload.providerArtifacts,
170
+ skillDiagnostics: base.providerPayload.skillDiagnostics,
171
+ safety: base.providerPayload.safety,
172
+ warnings: base.providerPayload.warnings,
173
+ },
174
+ skillsContext: base.skillsContext === undefined
175
+ ? undefined
176
+ : {
177
+ version: base.skillsContext.version,
178
+ providerAgnostic: base.skillsContext.providerAgnostic,
179
+ context: base.skillsContext.context,
180
+ itemCount: base.skillsContext.items.length,
181
+ skipped: base.skillsContext.skipped,
182
+ skillDiagnostics: base.skillsContext.skillDiagnostics,
183
+ warnings: base.skillsContext.warnings,
184
+ },
185
+ nextSafeAction: base.nextSafeAction,
186
+ safety: base.safety,
187
+ warnings: base.warnings,
188
+ });
189
+ }
190
+ function compactActivationEnvelope(verbose, input) {
191
+ const compactProviderPayload = {
192
+ version: verbose.providerPayload.version,
193
+ provider: verbose.providerPayload.provider,
194
+ payloadMode: 'compact',
195
+ installable: verbose.providerPayload.installable,
196
+ selection: verbose.providerPayload.selection,
197
+ providerArtifacts: verbose.providerPayload.providerArtifacts,
198
+ ...(verbose.providerPayload.skillDiagnostics === undefined ? {} : { skillDiagnostics: verbose.providerPayload.skillDiagnostics }),
199
+ safety: verbose.providerPayload.safety,
200
+ warnings: verbose.providerPayload.warnings,
201
+ };
202
+ const fullRetrieval = {
203
+ tool: 'vgxness_agent_activate',
204
+ payloadMode: 'verbose',
205
+ input: {
206
+ project: input.project,
207
+ scope: input.scope,
208
+ agentId: verbose.agent.id,
209
+ userIntent: input.userIntent,
210
+ workflow: input.workflow,
211
+ phase: input.phase,
212
+ },
213
+ };
214
+ const omittedSections = [];
215
+ if (verbose.providerPayload.skillPayload !== undefined)
216
+ omittedSections.push(omittedSection('providerPayload.skillPayload', 'Duplicate of skillsContext; omitted from compact activation response.', fullRetrieval, verbose.providerPayload.skillPayload));
217
+ if (verbose.skillsContext !== undefined)
218
+ omittedSections.push(omittedSection('skillsContext', 'Skill details remain durably retrievable through verbose activation or skill payload calls.', fullRetrieval, verbose.skillsContext));
219
+ const compact = {
220
+ version: verbose.version,
221
+ agent: verbose.agent,
222
+ provider: verbose.provider,
223
+ modelSelection: verbose.modelSelection,
224
+ providerPayload: compactProviderPayload,
225
+ omittedSections,
226
+ governanceConstraints: [
227
+ 'Activation is preview-only and does not execute providers.',
228
+ 'No provider configuration, background worker, autonomous step, or secrets expansion is performed.',
229
+ 'Request payloadMode=verbose when full provider payload or skills context is needed.',
230
+ ],
231
+ nextSafeAction: verbose.nextSafeAction,
232
+ safety: verbose.safety,
233
+ warnings: verbose.warnings,
234
+ };
235
+ compact.responseByteAccounting = responseByteAccounting(verbose, compact);
236
+ return compact;
237
+ }
238
+ function omittedSection(path, reason, retrieval, value) {
239
+ const summary = summarizePayloadContent(JSON.stringify(value));
240
+ return { path, reason, hash: summary.contentHash, bytes: summary.contentBytes, retrieval };
241
+ }
140
242
  function toJson(value) {
141
243
  return JSON.parse(JSON.stringify(value));
142
244
  }
143
- function ok(value) { return { ok: true, value }; }
144
- function validationFailure(message) { return { ok: false, error: { code: 'validation_failed', message } }; }
245
+ function ok(value) {
246
+ return { ok: true, value };
247
+ }
248
+ function validationFailure(message) {
249
+ return { ok: false, error: { code: 'validation_failed', message } };
250
+ }
@@ -28,7 +28,9 @@ export class AgentRegistryService {
28
28
  resolveAgents(input) {
29
29
  return new AgentResolver(() => this.listAgentDefinitions(input)).resolve(input);
30
30
  }
31
- close() { this.database.close(); }
31
+ close() {
32
+ this.database.close();
33
+ }
32
34
  listAgentDefinitions(input) {
33
35
  void input;
34
36
  const summaries = this.agents.list();
@@ -143,11 +143,9 @@ function workflowMatches(agent, input) {
143
143
  return [...matches.broad, ...matches.phaseOnly, ...matches.exactPhase];
144
144
  }
145
145
  function workflowSignalMatches(agent, input) {
146
- const requested = [
147
- input.workflow,
148
- input.phase,
149
- input.workflow !== undefined && input.phase !== undefined ? `${input.workflow}:${input.phase}` : undefined,
150
- ].filter((value) => value !== undefined).map(normalizeKey);
146
+ const requested = [input.workflow, input.phase, input.workflow !== undefined && input.phase !== undefined ? `${input.workflow}:${input.phase}` : undefined]
147
+ .filter((value) => value !== undefined)
148
+ .map(normalizeKey);
151
149
  if (requested.length === 0)
152
150
  return { broad: [], phaseOnly: [], exactPhase: [] };
153
151
  const workflow = input.workflow !== undefined ? normalizeKey(input.workflow) : undefined;
@@ -172,13 +170,7 @@ function phaseSemanticMatchesFor(agent, input) {
172
170
  if (workflow !== undefined && workflow !== 'sdd')
173
171
  return [];
174
172
  const inputPhase = input.phase !== undefined ? normalizeKey(input.phase) : undefined;
175
- const agentTerms = tokenize([
176
- agent.name,
177
- agent.description,
178
- ...agent.capabilities,
179
- ...agent.skills,
180
- ...agent.workflows,
181
- ].join(' '));
173
+ const agentTerms = tokenize([agent.name, agent.description, ...agent.capabilities, ...agent.skills, ...agent.workflows].join(' '));
182
174
  const requestTerms = new Set(input.terms);
183
175
  const matches = [];
184
176
  for (const semantic of SDD_PHASE_SEMANTICS) {
@@ -193,13 +185,7 @@ function phaseSemanticMatchesFor(agent, input) {
193
185
  function textSignalMatches(agent, terms) {
194
186
  if (terms.length === 0)
195
187
  return [];
196
- const searchable = tokenize([
197
- agent.name,
198
- agent.description,
199
- ...agent.capabilities,
200
- ...agent.skills,
201
- ...agent.workflows,
202
- ].join(' '));
188
+ const searchable = tokenize([agent.name, agent.description, ...agent.capabilities, ...agent.skills, ...agent.workflows].join(' '));
203
189
  return terms.filter((term) => searchable.includes(term));
204
190
  }
205
191
  function matchingValues(values, requested) {
@@ -213,10 +199,7 @@ function matchingValues(values, requested) {
213
199
  return matches;
214
200
  }
215
201
  function compareCandidates(a, b) {
216
- return b.score - a.score
217
- || modeRank(a.agent.mode) - modeRank(b.agent.mode)
218
- || a.agent.name.localeCompare(b.agent.name)
219
- || a.agent.id.localeCompare(b.agent.id);
202
+ return (b.score - a.score || modeRank(a.agent.mode) - modeRank(b.agent.mode) || a.agent.name.localeCompare(b.agent.name) || a.agent.id.localeCompare(b.agent.id));
220
203
  }
221
204
  function compareSkipped(a, b) {
222
205
  return a.agent.name.localeCompare(b.agent.name) || a.agent.id.localeCompare(b.agent.id);
@@ -239,11 +222,17 @@ function normalizeKey(value) {
239
222
  }
240
223
  function tokenize(value) {
241
224
  const seen = new Set();
242
- return value.toLowerCase().split(/[^a-z0-9-]+/).filter(Boolean).filter((term) => {
225
+ return value
226
+ .toLowerCase()
227
+ .split(/[^a-z0-9-]+/)
228
+ .filter(Boolean)
229
+ .filter((term) => {
243
230
  if (term.length < 3 || seen.has(term))
244
231
  return false;
245
232
  seen.add(term);
246
233
  return true;
247
234
  });
248
235
  }
249
- function ok(value) { return { ok: true, value }; }
236
+ function ok(value) {
237
+ return { ok: true, value };
238
+ }
@@ -85,7 +85,8 @@ export class AgentSeedService {
85
85
  seenNames.add(definition.name);
86
86
  if (!definition.parentAgentName.trim())
87
87
  return validationFailure(`Subagent ${definition.name} parentAgentName is required`);
88
- if (!manifest.agents.some((agent) => agent.name === definition.parentAgentName) && this.resolveExistingParentId(manifest, definition.parentAgentName) === undefined) {
88
+ if (!manifest.agents.some((agent) => agent.name === definition.parentAgentName) &&
89
+ this.resolveExistingParentId(manifest, definition.parentAgentName) === undefined) {
89
90
  return validationFailure(`Unresolved parentAgentName: ${definition.parentAgentName}`);
90
91
  }
91
92
  }
@@ -30,5 +30,9 @@ export class ManagerProfileOverlayService {
30
30
  });
31
31
  }
32
32
  }
33
- function ok(value) { return { ok: true, value }; }
34
- function validationFailure(message) { return { ok: false, error: { code: 'validation_failed', message } }; }
33
+ function ok(value) {
34
+ return { ok: true, value };
35
+ }
36
+ function validationFailure(message) {
37
+ return { ok: false, error: { code: 'validation_failed', message } };
38
+ }
@@ -22,5 +22,9 @@ function profileFromAdapter(config) {
22
22
  const profile = config?.profile;
23
23
  return typeof profile === 'string' && profile.trim().length > 0 ? profile.trim() : undefined;
24
24
  }
25
- function ok(value) { return { ok: true, value }; }
26
- function validationFailure(message) { return { ok: false, error: { code: 'validation_failed', message } }; }
25
+ function ok(value) {
26
+ return { ok: true, value };
27
+ }
28
+ function validationFailure(message) {
29
+ return { ok: false, error: { code: 'validation_failed', message } };
30
+ }
@@ -94,5 +94,9 @@ function claudeAgentKey(value) {
94
94
  return pathSegment(value);
95
95
  }
96
96
  function pathSegment(value) {
97
- return value.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^-+|-+$/g, '') || 'unnamed';
97
+ return (value
98
+ .trim()
99
+ .toLowerCase()
100
+ .replace(/[^a-z0-9._-]+/g, '-')
101
+ .replace(/^-+|-+$/g, '') || 'unnamed');
98
102
  }
@@ -10,7 +10,5 @@ const renderers = {
10
10
  export function getProviderRenderer(provider) {
11
11
  const normalized = provider.trim().toLowerCase();
12
12
  const renderer = renderers[normalized];
13
- return renderer === undefined
14
- ? validationFailure(`Unknown provider renderer: ${provider}`)
15
- : ok(renderer);
13
+ return renderer === undefined ? validationFailure(`Unknown provider renderer: ${provider}`) : ok(renderer);
16
14
  }
@@ -1,4 +1,4 @@
1
- import { ok, validationFailure } from './provider-adapter.js';
1
+ import { ok, validationFailure, } from './provider-adapter.js';
2
2
  const previewSafety = {
3
3
  executesProvider: false,
4
4
  writesProviderConfig: false,
@@ -6,7 +6,23 @@ const previewSafety = {
6
6
  previewOnly: true,
7
7
  };
8
8
  const jsonCapabilities = {
9
- supportedAgentFields: ['id', 'project', 'scope', 'mode', 'name', 'description', 'instructions', 'capabilities', 'permissions', 'memory', 'workflows', 'skills', 'adapters', 'timestamps', 'parentAgentId'],
9
+ supportedAgentFields: [
10
+ 'id',
11
+ 'project',
12
+ 'scope',
13
+ 'mode',
14
+ 'name',
15
+ 'description',
16
+ 'instructions',
17
+ 'capabilities',
18
+ 'permissions',
19
+ 'memory',
20
+ 'workflows',
21
+ 'skills',
22
+ 'adapters',
23
+ 'timestamps',
24
+ 'parentAgentId',
25
+ ],
10
26
  skillInjectionModes: ['preserved as registry metadata in neutral export'],
11
27
  permissionCategories: ['preserved registry permission policy metadata'],
12
28
  memoryInjectionModes: ['preserved registry memory scope metadata'],
@@ -41,10 +57,7 @@ export class JsonAgentRenderer {
41
57
  rootAgentId: input.agent.id,
42
58
  rootAgentName: input.agent.name,
43
59
  subagentIds: subagents.map((subagent) => subagent.id),
44
- artifacts: [
45
- `${basePath}.agent.json`,
46
- ...subagents.map((subagent) => `${basePath}.subagents/${pathSegment(subagent.name)}.json`),
47
- ],
60
+ artifacts: [`${basePath}.agent.json`, ...subagents.map((subagent) => `${basePath}.subagents/${pathSegment(subagent.name)}.json`)],
48
61
  }),
49
62
  ...subagents.map((subagent) => jsonArtifact(`${basePath}.subagents/${pathSegment(subagent.name)}.json`, renderedDefinition(subagent, this.provider))),
50
63
  ];
@@ -74,7 +87,11 @@ function jsonArtifact(relativePath, value) {
74
87
  };
75
88
  }
76
89
  function pathSegment(value) {
77
- return value.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^-+|-+$/g, '') || 'unnamed';
90
+ return (value
91
+ .trim()
92
+ .toLowerCase()
93
+ .replace(/[^a-z0-9._-]+/g, '-')
94
+ .replace(/^-+|-+$/g, '') || 'unnamed');
78
95
  }
79
96
  function firstDuplicate(values) {
80
97
  const seen = new Set();
@@ -8,7 +8,14 @@ const previewSafety = {
8
8
  previewOnly: true,
9
9
  };
10
10
  const openCodeCapabilities = {
11
- supportedAgentFields: ['name', 'description', 'instructions', 'mode', 'adapter model', 'adapter config keys: variant, temperature, top_p, hidden, options, color, steps, permission'],
11
+ supportedAgentFields: [
12
+ 'name',
13
+ 'description',
14
+ 'instructions',
15
+ 'mode',
16
+ 'adapter model',
17
+ 'adapter config keys: variant, temperature, top_p, hidden, options, color, steps, permission',
18
+ ],
12
19
  skillInjectionModes: ['external preview services may inject skill payloads before rendering; renderer does not resolve skills'],
13
20
  permissionCategories: ['registry permission metadata mapped from adapter permission config'],
14
21
  memoryInjectionModes: ['external preview services may inject memory payloads before rendering; renderer does not load memory'],
@@ -43,7 +50,7 @@ export class OpenCodeAgentRenderer {
43
50
  const artifact = {
44
51
  relativePath: `rendered/opencode/${pathSegment(input.agent.project)}/${input.agent.scope}/${pathSegment(input.agent.name)}/opencode.json`,
45
52
  contentType: 'application/json',
46
- contents: `${JSON.stringify({ '$schema': openCodeSchema, agent: renderedAgents, safety: previewSafety }, null, 2)}\n`,
53
+ contents: `${JSON.stringify({ $schema: openCodeSchema, agent: renderedAgents, safety: previewSafety }, null, 2)}\n`,
47
54
  };
48
55
  return ok({
49
56
  provider: this.provider,
@@ -96,5 +103,9 @@ function openCodeAgentKey(value) {
96
103
  return pathSegment(value);
97
104
  }
98
105
  function pathSegment(value) {
99
- return value.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^-+|-+$/g, '') || 'unnamed';
106
+ return (value
107
+ .trim()
108
+ .toLowerCase()
109
+ .replace(/[^a-z0-9._-]+/g, '-')
110
+ .replace(/^-+|-+$/g, '') || 'unnamed');
100
111
  }
@@ -19,7 +19,8 @@ export class AgentRepository {
19
19
  const id = existing?.id ?? randomUUID();
20
20
  const now = new Date().toISOString();
21
21
  const parameters = toRowParameters(input, id, existing?.created_at ?? now, now);
22
- this.db.connection.prepare(`
22
+ this.db.connection
23
+ .prepare(`
23
24
  INSERT INTO agents(id, project, scope, mode, name, description, instructions_json, capabilities_json, permissions_json, memory_json, workflows_json, skills_json, adapters_json, parent_agent_id, created_at, updated_at)
24
25
  VALUES (@id, @project, @scope, @mode, @name, @description, @instructionsJson, @capabilitiesJson, @permissionsJson, @memoryJson, @workflowsJson, @skillsJson, @adaptersJson, @parentAgentId, @createdAt, @updatedAt)
25
26
  ON CONFLICT(project, scope, name) DO UPDATE SET
@@ -34,7 +35,8 @@ export class AgentRepository {
34
35
  adapters_json=excluded.adapters_json,
35
36
  parent_agent_id=excluded.parent_agent_id,
36
37
  updated_at=excluded.updated_at
37
- `).run(parameters);
38
+ `)
39
+ .run(parameters);
38
40
  const found = this.getById(id);
39
41
  if (!found.ok)
40
42
  throw new Error(found.error.message);
@@ -67,18 +69,25 @@ export class AgentRepository {
67
69
  try {
68
70
  const where = [];
69
71
  const parameters = {};
70
- for (const [key, column] of [['project', 'project'], ['scope', 'scope'], ['mode', 'mode'], ['parentAgentId', 'parent_agent_id']]) {
72
+ for (const [key, column] of [
73
+ ['project', 'project'],
74
+ ['scope', 'scope'],
75
+ ['mode', 'mode'],
76
+ ['parentAgentId', 'parent_agent_id'],
77
+ ]) {
71
78
  const value = filters[key];
72
79
  if (value !== undefined) {
73
80
  where.push(`${column}=@${key}`);
74
81
  parameters[key] = value;
75
82
  }
76
83
  }
77
- const rows = this.db.connection.prepare(`
84
+ const rows = this.db.connection
85
+ .prepare(`
78
86
  SELECT * FROM agents
79
87
  ${where.length ? `WHERE ${where.join(' AND ')}` : ''}
80
88
  ORDER BY name ASC
81
- `).all(parameters);
89
+ `)
90
+ .all(parameters);
82
91
  return ok(rows.map((row) => toSummary(map(row))));
83
92
  }
84
93
  catch (cause) {
@@ -172,9 +181,15 @@ function toSummary(agent) {
172
181
  value.parentAgentId = agent.parentAgentId;
173
182
  return value;
174
183
  }
175
- function ok(value) { return { ok: true, value }; }
176
- function missing(message) { return { ok: false, error: { code: 'not_found', message } }; }
177
- function validationFailure(message) { return { ok: false, error: { code: 'validation_failed', message } }; }
184
+ function ok(value) {
185
+ return { ok: true, value };
186
+ }
187
+ function missing(message) {
188
+ return { ok: false, error: { code: 'not_found', message } };
189
+ }
190
+ function validationFailure(message) {
191
+ return { ok: false, error: { code: 'validation_failed', message } };
192
+ }
178
193
  function fail(message, cause) {
179
194
  const error = { code: 'validation_failed', message };
180
195
  if (cause !== undefined)
@@ -12,13 +12,15 @@ export class ManagerProfileOverlayRepository {
12
12
  const existing = this.find(input.project, input.scope, input.managerName);
13
13
  const id = existing?.id ?? randomUUID();
14
14
  const now = new Date().toISOString();
15
- this.db.connection.prepare(`
15
+ this.db.connection
16
+ .prepare(`
16
17
  INSERT INTO manager_profile_overlays(id, project, scope, manager_name, instructions, created_at, updated_at)
17
18
  VALUES (@id, @project, @scope, @managerName, @instructions, @createdAt, @updatedAt)
18
19
  ON CONFLICT(project, scope, manager_name) DO UPDATE SET
19
20
  instructions=excluded.instructions,
20
21
  updated_at=excluded.updated_at
21
- `).run({
22
+ `)
23
+ .run({
22
24
  id,
23
25
  project: input.project.trim(),
24
26
  scope: input.scope,
@@ -46,7 +48,8 @@ export class ManagerProfileOverlayRepository {
46
48
  }
47
49
  }
48
50
  find(project, scope, managerName) {
49
- return this.db.connection.prepare('SELECT * FROM manager_profile_overlays WHERE project=? AND scope=? AND manager_name=?')
51
+ return this.db.connection
52
+ .prepare('SELECT * FROM manager_profile_overlays WHERE project=? AND scope=? AND manager_name=?')
50
53
  .get(project.trim(), scope, managerName.trim());
51
54
  }
52
55
  }
@@ -70,9 +73,15 @@ function map(row) {
70
73
  updatedAt: row.updated_at,
71
74
  };
72
75
  }
73
- function ok(value) { return { ok: true, value }; }
74
- function missing(message) { return { ok: false, error: { code: 'not_found', message } }; }
75
- function validationFailure(message) { return { ok: false, error: { code: 'validation_failed', message } }; }
76
+ function ok(value) {
77
+ return { ok: true, value };
78
+ }
79
+ function missing(message) {
80
+ return { ok: false, error: { code: 'not_found', message } };
81
+ }
82
+ function validationFailure(message) {
83
+ return { ok: false, error: { code: 'validation_failed', message } };
84
+ }
76
85
  function fail(message, cause) {
77
86
  const error = { code: 'validation_failed', message };
78
87
  if (cause !== undefined)