@jmanuelcorral/openteam 0.2.2 → 0.9.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 (310) hide show
  1. package/.opencode/command/openteam.md +2 -1
  2. package/.opencode/openteam.example.json +27 -8
  3. package/AGENTS.md +5 -2
  4. package/README.es.md +155 -59
  5. package/README.md +418 -62
  6. package/dist/capabilities/types.d.ts +3 -3
  7. package/dist/capabilities/types.d.ts.map +1 -1
  8. package/dist/classifier/localClassifier.d.ts +0 -2
  9. package/dist/classifier/localClassifier.d.ts.map +1 -1
  10. package/dist/cli/consoleServe.d.ts +21 -1
  11. package/dist/cli/consoleServe.d.ts.map +1 -1
  12. package/dist/cli/graphOperator.d.ts +22 -0
  13. package/dist/cli/graphOperator.d.ts.map +1 -0
  14. package/dist/cli/graphStatusSnapshot.d.ts +16 -0
  15. package/dist/cli/graphStatusSnapshot.d.ts.map +1 -0
  16. package/dist/cli/migrateAdapter.d.ts +12 -0
  17. package/dist/cli/migrateAdapter.d.ts.map +1 -0
  18. package/dist/cli/purgeAdapter.d.ts +10 -0
  19. package/dist/cli/purgeAdapter.d.ts.map +1 -0
  20. package/dist/cli/setupAdapters.d.ts.map +1 -1
  21. package/dist/cli.js +13534 -6124
  22. package/dist/commands/agents.d.ts +102 -2
  23. package/dist/commands/agents.d.ts.map +1 -1
  24. package/dist/commands/baseline.d.ts.map +1 -1
  25. package/dist/commands/clearCache.d.ts +23 -0
  26. package/dist/commands/clearCache.d.ts.map +1 -0
  27. package/dist/commands/dispatch.d.ts +202 -4
  28. package/dist/commands/dispatch.d.ts.map +1 -1
  29. package/dist/commands/doctor.d.ts +53 -0
  30. package/dist/commands/doctor.d.ts.map +1 -1
  31. package/dist/commands/frontierCatalog.d.ts +8 -14
  32. package/dist/commands/frontierCatalog.d.ts.map +1 -1
  33. package/dist/commands/graph.d.ts +0 -27
  34. package/dist/commands/graph.d.ts.map +1 -1
  35. package/dist/commands/local.d.ts.map +1 -1
  36. package/dist/commands/migrate.d.ts +11 -0
  37. package/dist/commands/migrate.d.ts.map +1 -0
  38. package/dist/commands/purge.d.ts +132 -0
  39. package/dist/commands/purge.d.ts.map +1 -0
  40. package/dist/commands/report.d.ts +1 -0
  41. package/dist/commands/report.d.ts.map +1 -1
  42. package/dist/commands/setup.d.ts +62 -5
  43. package/dist/commands/setup.d.ts.map +1 -1
  44. package/dist/config/errors.d.ts +10 -0
  45. package/dist/config/errors.d.ts.map +1 -0
  46. package/dist/config/legacyMigration.d.ts +82 -0
  47. package/dist/config/legacyMigration.d.ts.map +1 -0
  48. package/dist/config/legacyPaths.d.ts +105 -0
  49. package/dist/config/legacyPaths.d.ts.map +1 -0
  50. package/dist/config/load.d.ts.map +1 -1
  51. package/dist/config/opencode.d.ts +63 -0
  52. package/dist/config/opencode.d.ts.map +1 -0
  53. package/dist/config/persist.d.ts +8 -0
  54. package/dist/config/persist.d.ts.map +1 -1
  55. package/dist/config/resolve.d.ts +1 -1
  56. package/dist/config/resolve.d.ts.map +1 -1
  57. package/dist/config/runtime.d.ts +62 -0
  58. package/dist/config/runtime.d.ts.map +1 -0
  59. package/dist/config/schema.d.ts +142 -79
  60. package/dist/config/schema.d.ts.map +1 -1
  61. package/dist/console/assets.d.ts +2 -2
  62. package/dist/console/assets.d.ts.map +1 -1
  63. package/dist/console/configView.d.ts +74 -0
  64. package/dist/console/configView.d.ts.map +1 -0
  65. package/dist/console/opencodeClient.d.ts +8 -6
  66. package/dist/console/opencodeClient.d.ts.map +1 -1
  67. package/dist/console/protocol.d.ts +30 -6
  68. package/dist/console/protocol.d.ts.map +1 -1
  69. package/dist/console/render.d.ts +30 -1
  70. package/dist/console/render.d.ts.map +1 -1
  71. package/dist/console/types.d.ts +1 -1
  72. package/dist/console/types.d.ts.map +1 -1
  73. package/dist/context/redaction.d.ts +19 -19
  74. package/dist/context/redaction.d.ts.map +1 -1
  75. package/dist/context/schema.d.ts +26 -26
  76. package/dist/context/schema.d.ts.map +1 -1
  77. package/dist/context/types.d.ts +3 -3
  78. package/dist/contract/opencode.d.ts +39 -23
  79. package/dist/contract/opencode.d.ts.map +1 -1
  80. package/dist/graph/certificate.d.ts +37 -16
  81. package/dist/graph/certificate.d.ts.map +1 -1
  82. package/dist/graph/langgraph/adapter.d.ts +56 -0
  83. package/dist/graph/langgraph/adapter.d.ts.map +1 -0
  84. package/dist/graph/langgraph/certification.d.ts +64 -0
  85. package/dist/graph/langgraph/certification.d.ts.map +1 -0
  86. package/dist/graph/langgraph/checkpointReplay.d.ts +49 -0
  87. package/dist/graph/langgraph/checkpointReplay.d.ts.map +1 -0
  88. package/dist/graph/langgraph/checkpointer.d.ts +49 -0
  89. package/dist/graph/langgraph/checkpointer.d.ts.map +1 -0
  90. package/dist/graph/langgraph/engine.d.ts +34 -0
  91. package/dist/graph/langgraph/engine.d.ts.map +1 -0
  92. package/dist/graph/langgraph/graphModel.d.ts +37 -0
  93. package/dist/graph/langgraph/graphModel.d.ts.map +1 -0
  94. package/dist/graph/langgraph/reducer.d.ts +18 -0
  95. package/dist/graph/langgraph/reducer.d.ts.map +1 -0
  96. package/dist/graph/langgraph/retirement.d.ts +59 -0
  97. package/dist/graph/langgraph/retirement.d.ts.map +1 -0
  98. package/dist/graph/langgraph/types.d.ts +65 -0
  99. package/dist/graph/langgraph/types.d.ts.map +1 -0
  100. package/dist/graph/privacyPolicy.d.ts +7 -0
  101. package/dist/graph/privacyPolicy.d.ts.map +1 -1
  102. package/dist/graph/soakLedger.d.ts.map +1 -1
  103. package/dist/graph/types.d.ts +0 -2
  104. package/dist/graph/types.d.ts.map +1 -1
  105. package/dist/index.d.ts +52 -19
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +11334 -5016
  108. package/dist/local/cacheAdapter.d.ts +7 -0
  109. package/dist/local/cacheAdapter.d.ts.map +1 -0
  110. package/dist/local/concurrency.d.ts +52 -0
  111. package/dist/local/concurrency.d.ts.map +1 -0
  112. package/dist/local/embeddings.d.ts +10 -10
  113. package/dist/local/embeddings.d.ts.map +1 -1
  114. package/dist/local/extractClient.d.ts +13 -10
  115. package/dist/local/extractClient.d.ts.map +1 -1
  116. package/dist/local/lemonade.d.ts +4 -0
  117. package/dist/local/lemonade.d.ts.map +1 -0
  118. package/dist/local/registry.d.ts +16 -0
  119. package/dist/local/registry.d.ts.map +1 -1
  120. package/dist/local/types.d.ts +1 -1
  121. package/dist/local/types.d.ts.map +1 -1
  122. package/dist/mcp/semanticRecall.d.ts +18 -1
  123. package/dist/mcp/semanticRecall.d.ts.map +1 -1
  124. package/dist/mcp/server.d.ts +41 -1
  125. package/dist/mcp/server.d.ts.map +1 -1
  126. package/dist/memory/embedText.d.ts +4 -0
  127. package/dist/memory/embedText.d.ts.map +1 -0
  128. package/dist/memory/extract.d.ts +33 -18
  129. package/dist/memory/extract.d.ts.map +1 -1
  130. package/dist/memory/fold.d.ts +3 -2
  131. package/dist/memory/fold.d.ts.map +1 -1
  132. package/dist/memory/index.d.ts +1 -0
  133. package/dist/memory/index.d.ts.map +1 -1
  134. package/dist/memory/inject.d.ts.map +1 -1
  135. package/dist/memory/log.d.ts +15 -4
  136. package/dist/memory/log.d.ts.map +1 -1
  137. package/dist/memory/merge.d.ts +18 -1
  138. package/dist/memory/merge.d.ts.map +1 -1
  139. package/dist/memory/traverse.d.ts +80 -0
  140. package/dist/memory/traverse.d.ts.map +1 -0
  141. package/dist/memory/types.d.ts +53 -7
  142. package/dist/memory/types.d.ts.map +1 -1
  143. package/dist/messages/commands.d.ts +84 -0
  144. package/dist/messages/commands.d.ts.map +1 -0
  145. package/dist/messages/index.d.ts +46 -0
  146. package/dist/messages/index.d.ts.map +1 -0
  147. package/dist/opencodeArtifacts/index.d.ts +33 -0
  148. package/dist/opencodeArtifacts/index.d.ts.map +1 -0
  149. package/dist/opencodeArtifacts/orchestratorAgent.d.ts +29 -0
  150. package/dist/opencodeArtifacts/orchestratorAgent.d.ts.map +1 -0
  151. package/dist/opencodeArtifacts/slashCommand.d.ts +31 -0
  152. package/dist/opencodeArtifacts/slashCommand.d.ts.map +1 -0
  153. package/dist/orchestrator/coordinator.d.ts +155 -1
  154. package/dist/orchestrator/coordinator.d.ts.map +1 -1
  155. package/dist/orchestrator/graphCancellation.d.ts +40 -37
  156. package/dist/orchestrator/graphCancellation.d.ts.map +1 -1
  157. package/dist/orchestrator/graphEffects.d.ts +24 -24
  158. package/dist/orchestrator/graphEffects.d.ts.map +1 -1
  159. package/dist/orchestrator/graphFacade.d.ts +16 -16
  160. package/dist/orchestrator/graphFacade.d.ts.map +1 -1
  161. package/dist/orchestrator/graphIngress.d.ts +49 -45
  162. package/dist/orchestrator/graphIngress.d.ts.map +1 -1
  163. package/dist/orchestrator/graphReview.d.ts +24 -23
  164. package/dist/orchestrator/graphReview.d.ts.map +1 -1
  165. package/dist/orchestrator/graphRuntime.d.ts +27 -26
  166. package/dist/orchestrator/graphRuntime.d.ts.map +1 -1
  167. package/dist/orchestrator/graphShadow.d.ts +70 -69
  168. package/dist/orchestrator/graphShadow.d.ts.map +1 -1
  169. package/dist/orchestrator/opencodeSessionAdapter.d.ts +25 -25
  170. package/dist/orchestrator/opencodeSessionAdapter.d.ts.map +1 -1
  171. package/dist/orchestrator/permissions.d.ts.map +1 -1
  172. package/dist/orchestrator/ralphLoop.d.ts +57 -0
  173. package/dist/orchestrator/ralphLoop.d.ts.map +1 -0
  174. package/dist/orchestrator/roles.d.ts +69 -8
  175. package/dist/orchestrator/roles.d.ts.map +1 -1
  176. package/dist/orchestrator/roster.d.ts +103 -0
  177. package/dist/orchestrator/roster.d.ts.map +1 -0
  178. package/dist/orchestrator/rosterPersistence.d.ts +22 -0
  179. package/dist/orchestrator/rosterPersistence.d.ts.map +1 -0
  180. package/dist/orchestrator/runtimeSelection.d.ts +46 -0
  181. package/dist/orchestrator/runtimeSelection.d.ts.map +1 -0
  182. package/dist/orchestrator/sddCompiler.d.ts +34 -34
  183. package/dist/orchestrator/sddCompiler.d.ts.map +1 -1
  184. package/dist/orchestrator/sessionReconciler.d.ts +31 -29
  185. package/dist/orchestrator/sessionReconciler.d.ts.map +1 -1
  186. package/dist/orchestrator/shadowComparator.d.ts +23 -23
  187. package/dist/orchestrator/shadowComparator.d.ts.map +1 -1
  188. package/dist/orchestrator/subsessions.d.ts.map +1 -1
  189. package/dist/orchestrator/worktreeAdapter.d.ts +12 -12
  190. package/dist/orchestrator/worktreeAdapter.d.ts.map +1 -1
  191. package/dist/orchestrator/worktreeDispatch.d.ts +34 -34
  192. package/dist/orchestrator/worktreeDispatch.d.ts.map +1 -1
  193. package/dist/orchestrator/worktreeReconciler.d.ts +37 -36
  194. package/dist/orchestrator/worktreeReconciler.d.ts.map +1 -1
  195. package/dist/plugin/availability.d.ts.map +1 -1
  196. package/dist/plugin/capture.d.ts +12 -12
  197. package/dist/plugin/capture.d.ts.map +1 -1
  198. package/dist/plugin/commandTool.d.ts +1 -1
  199. package/dist/plugin/commandTool.d.ts.map +1 -1
  200. package/dist/plugin/diagnostics.d.ts +30 -0
  201. package/dist/plugin/diagnostics.d.ts.map +1 -0
  202. package/dist/plugin/graphShadowIngress.d.ts +50 -48
  203. package/dist/plugin/graphShadowIngress.d.ts.map +1 -1
  204. package/dist/plugin/graphTool.d.ts +25 -23
  205. package/dist/plugin/graphTool.d.ts.map +1 -1
  206. package/dist/plugin/hooks.d.ts +10 -10
  207. package/dist/plugin/hooks.d.ts.map +1 -1
  208. package/dist/plugin/legacyRunProducer.d.ts +22 -22
  209. package/dist/plugin/legacyRunProducer.d.ts.map +1 -1
  210. package/dist/plugin/memoryInject.d.ts +6 -6
  211. package/dist/plugin/memoryInject.d.ts.map +1 -1
  212. package/dist/plugin/memoryTool.d.ts +36 -0
  213. package/dist/plugin/memoryTool.d.ts.map +1 -0
  214. package/dist/plugin/orchestrateTool.d.ts +38 -3
  215. package/dist/plugin/orchestrateTool.d.ts.map +1 -1
  216. package/dist/plugin/reportRunSchema.d.ts +8 -8
  217. package/dist/plugin/reportRunSchema.d.ts.map +1 -1
  218. package/dist/plugin/sessionTracker.d.ts +15 -15
  219. package/dist/plugin/sessionTracker.d.ts.map +1 -1
  220. package/dist/plugin/shadowPipeline.d.ts +2 -1
  221. package/dist/plugin/shadowPipeline.d.ts.map +1 -1
  222. package/dist/plugin/soakObserver.d.ts +18 -11
  223. package/dist/plugin/soakObserver.d.ts.map +1 -1
  224. package/dist/plugin/toolcalls.d.ts +3 -3
  225. package/dist/router/chooseModel.d.ts.map +1 -1
  226. package/dist/router/frontierBaseline.d.ts +3 -3
  227. package/dist/router/modelSelection.d.ts +12 -4
  228. package/dist/router/modelSelection.d.ts.map +1 -1
  229. package/dist/router/types.d.ts +6 -1
  230. package/dist/router/types.d.ts.map +1 -1
  231. package/dist/storage/graph/snapshot.d.ts.map +1 -1
  232. package/dist/storage/graph/soakRecorder.d.ts +14 -1
  233. package/dist/storage/graph/soakRecorder.d.ts.map +1 -1
  234. package/dist/storage/graph/workspaceLease.d.ts +1 -1
  235. package/dist/storage/graph/workspaceLease.d.ts.map +1 -1
  236. package/dist/storage/graph/worktreeRegistry.d.ts +1 -1
  237. package/dist/storage/graph/worktreeRegistry.d.ts.map +1 -1
  238. package/dist/storage/httpStorageProvider.d.ts +2 -2
  239. package/dist/storage/index/bunSqlite.d.ts +1 -0
  240. package/dist/storage/index/bunSqlite.d.ts.map +1 -1
  241. package/dist/storage/index/memoryConsolidate.d.ts +2 -0
  242. package/dist/storage/index/memoryConsolidate.d.ts.map +1 -1
  243. package/dist/storage/index/memoryEmbeddings.d.ts +51 -0
  244. package/dist/storage/index/memoryEmbeddings.d.ts.map +1 -0
  245. package/dist/storage/index/memoryIndex.d.ts +37 -5
  246. package/dist/storage/index/memoryIndex.d.ts.map +1 -1
  247. package/dist/storage/index/memoryRecall.d.ts +1 -1
  248. package/dist/storage/index/memoryRecall.d.ts.map +1 -1
  249. package/dist/storage/index/memoryRuntime.d.ts +2 -0
  250. package/dist/storage/index/memoryRuntime.d.ts.map +1 -1
  251. package/dist/storage/index/sqliteIndex.d.ts +18 -1
  252. package/dist/storage/index/sqliteIndex.d.ts.map +1 -1
  253. package/dist/storage/path.d.ts.map +1 -1
  254. package/dist/telemetry/aggregate.d.ts +12 -12
  255. package/dist/telemetry/aggregate.d.ts.map +1 -1
  256. package/dist/telemetry/cost.d.ts.map +1 -1
  257. package/dist/telemetry/decisions.d.ts +11 -11
  258. package/dist/telemetry/decisions.d.ts.map +1 -1
  259. package/dist/telemetry/diagnostics.d.ts +10 -0
  260. package/dist/telemetry/diagnostics.d.ts.map +1 -0
  261. package/dist/telemetry/eventLog.d.ts +44 -26
  262. package/dist/telemetry/eventLog.d.ts.map +1 -1
  263. package/dist/telemetry/events.d.ts +121 -36
  264. package/dist/telemetry/events.d.ts.map +1 -1
  265. package/dist/telemetry/fanout.d.ts +18 -0
  266. package/dist/telemetry/fanout.d.ts.map +1 -0
  267. package/dist/telemetry/graphProjection.d.ts +12 -12
  268. package/dist/telemetry/graphProjection.d.ts.map +1 -1
  269. package/dist/telemetry/graphRuntimeHealth.d.ts +26 -26
  270. package/dist/telemetry/graphRuntimeHealth.d.ts.map +1 -1
  271. package/dist/telemetry/graphView.d.ts +20 -20
  272. package/dist/telemetry/graphView.d.ts.map +1 -1
  273. package/dist/telemetry/otel.d.ts +86 -0
  274. package/dist/telemetry/otel.d.ts.map +1 -0
  275. package/dist/telemetry/otelConfig.d.ts +128 -0
  276. package/dist/telemetry/otelConfig.d.ts.map +1 -0
  277. package/dist/telemetry/otelExporter.d.ts +7 -0
  278. package/dist/telemetry/otelExporter.d.ts.map +1 -0
  279. package/dist/telemetry/read.d.ts +18 -4
  280. package/dist/telemetry/read.d.ts.map +1 -1
  281. package/dist/telemetry/types.d.ts +3 -2
  282. package/dist/telemetry/types.d.ts.map +1 -1
  283. package/dist/web/configApi.d.ts +154 -0
  284. package/dist/web/configApi.d.ts.map +1 -0
  285. package/dist/web/configRoute.d.ts +57 -0
  286. package/dist/web/configRoute.d.ts.map +1 -0
  287. package/dist/web/console.d.ts +8 -0
  288. package/dist/web/console.d.ts.map +1 -1
  289. package/dist/web/paths.d.ts +4 -3
  290. package/dist/web/paths.d.ts.map +1 -1
  291. package/dist/web/server.d.ts +30 -1
  292. package/dist/web/server.d.ts.map +1 -1
  293. package/dist/web/start.d.ts +15 -0
  294. package/dist/web/start.d.ts.map +1 -1
  295. package/dist/web/storageRoute.d.ts +2 -2
  296. package/package.json +13 -7
  297. package/dist/cli/tunnel.d.ts +0 -89
  298. package/dist/cli/tunnel.d.ts.map +0 -1
  299. package/dist/commands/orchestratorAgent.d.ts +0 -30
  300. package/dist/commands/orchestratorAgent.d.ts.map +0 -1
  301. package/dist/commands/slashCommand.d.ts +0 -39
  302. package/dist/commands/slashCommand.d.ts.map +0 -1
  303. package/dist/orchestrator/ledger.d.ts +0 -28
  304. package/dist/orchestrator/ledger.d.ts.map +0 -1
  305. package/dist/storage/graph/importLegacy.d.ts +0 -62
  306. package/dist/storage/graph/importLegacy.d.ts.map +0 -1
  307. package/dist/storage/graph/migration.d.ts +0 -91
  308. package/dist/storage/graph/migration.d.ts.map +0 -1
  309. package/dist/storage/graph/projections.d.ts +0 -31
  310. package/dist/storage/graph/projections.d.ts.map +0 -1
@@ -0,0 +1,86 @@
1
+ import type { EventSink } from "./eventLog";
2
+ import type { OpenTeamEvent } from "./events";
3
+ /**
4
+ * OpenTelemetry sink layer for openteam telemetry (W1-S02/S03/S05, see #161,
5
+ * #162, #164).
6
+ *
7
+ * The exporter is an **injected port**: this module never imports the concrete
8
+ * `@opentelemetry/*` SDK and never touches the network, so the privacy and
9
+ * resilience guarantees are provable with deterministic fakes. The real OTLP
10
+ * transport lives behind the same port in `./otelExporter.ts`.
11
+ *
12
+ * Privacy is enforced **by construction**, not by convention: every event is
13
+ * projected to a bounded, reference-only record and both the incoming event and
14
+ * the projected record are run through `assertReferenceOnly` before anything is
15
+ * handed to the exporter. A raw prompt/content field can therefore never reach
16
+ * an OpenTelemetry span or attribute.
17
+ */
18
+ /**
19
+ * A reference-only span record handed to the OpenTelemetry exporter. Attributes
20
+ * are primitives only; by construction the record never carries raw prompt or
21
+ * content text — only already-redacted correlation metadata.
22
+ */
23
+ export type OtelSpanRecord = {
24
+ readonly name: string;
25
+ readonly attributes: Readonly<Record<string, string | number | boolean>>;
26
+ };
27
+ /**
28
+ * Injected transport port. The real implementation (`./otelExporter.ts`) adapts
29
+ * an OTLP/HTTP trace exporter; tests inject a recording or failing fake. `export`
30
+ * may be sync or async and may reject — the sink isolates every failure.
31
+ */
32
+ export type OtelSpanExporter = {
33
+ export: (record: OtelSpanRecord) => Promise<void> | void;
34
+ };
35
+ /**
36
+ * Injected deadline used to bound `emit` even when the exporter never settles.
37
+ * `sleep` must be an injected timer (no real `setTimeout` in the pure path) so
38
+ * the resilience contract is deterministic.
39
+ */
40
+ export type OtelDeadline = {
41
+ readonly ms: number;
42
+ readonly sleep: (ms: number) => Promise<void>;
43
+ };
44
+ /**
45
+ * Privacy decision applied to a projection. Under `forceLocalOnSensitive`, a
46
+ * node classified `sensitive` is reduced to the minimal reference-only record
47
+ * (correlation id and counts only) so the cloud sink learns nothing about the
48
+ * sensitive work beyond that it happened — never content, model, or cost detail.
49
+ */
50
+ export type PrivacyProjection = {
51
+ readonly mode: string;
52
+ readonly nodeClass: "sensitive" | "normal";
53
+ };
54
+ /**
55
+ * Pure, bounded projection of an `OpenTeamEvent` into a span record. Copies only
56
+ * safe, already-redacted fields — never `rationale`, error text, or any content
57
+ * field. `failureReason` is already a bounded classification code by the time an
58
+ * event is produced (see `classifyFailureForTelemetry` in the coordinator), so
59
+ * carrying it is reference-only.
60
+ *
61
+ * When `privacy` marks the node sensitive under `forceLocalOnSensitive`, the
62
+ * projection collapses to the minimal reference-only record.
63
+ */
64
+ export declare function projectEventToOtel(event: OpenTeamEvent, privacy?: PrivacyProjection): OtelSpanRecord;
65
+ /** Dependencies of the OpenTelemetry event sink. */
66
+ export type OtelSinkDeps = {
67
+ /** Injected transport port. */
68
+ readonly exporter: OtelSpanExporter;
69
+ /** Telemetry error handler; the sink never throws out of `emit`. */
70
+ readonly onError?: (error: unknown) => void;
71
+ /** Optional deadline so a hanging exporter cannot stall the emit path. */
72
+ readonly deadline?: OtelDeadline;
73
+ /** Projection override (defaults to `projectEventToOtel`). */
74
+ readonly project?: (event: OpenTeamEvent) => OtelSpanRecord;
75
+ };
76
+ /**
77
+ * Creates an `EventSink` that exports events through the injected OTLP port.
78
+ *
79
+ * Contract (`EventSink.emit` never throws): the incoming event and the projected
80
+ * record are both guarded by `assertReferenceOnly`; a raw content field throws
81
+ * *before* the exporter is touched, so nothing leaks. Exporter rejections and
82
+ * timeouts are caught and routed to `onError`. With a `deadline`, `emit` resolves
83
+ * within the budget even if the exporter never settles.
84
+ */
85
+ export declare function createOtelSink(deps: OtelSinkDeps): EventSink;
86
+ //# sourceMappingURL=otel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otel.d.ts","sourceRoot":"","sources":["../../src/telemetry/otel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAC1E,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC1D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,WAAW,GAAG,QAAQ,CAAC;CAC5C,CAAC;AAYF;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EACpB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,cAAc,CA8BhB;AAED,oDAAoD;AACpD,MAAM,MAAM,YAAY,GAAG;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,oEAAoE;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACjC,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,cAAc,CAAC;CAC7D,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,CA2B5D"}
@@ -0,0 +1,128 @@
1
+ import { z } from "zod";
2
+ import { type EventLogSinkDeps, type EventSink } from "./eventLog";
3
+ import { type OtelDeadline, type OtelSpanExporter } from "./otel";
4
+ /**
5
+ * Telemetry backend resolution and sink composition (W1-S01/S02/S05, see #160,
6
+ * #161, #164).
7
+ *
8
+ * `createTelemetryEventSink` is the single construction point of the fan-out
9
+ * sink: it composes the local JSONL event log with an optional OpenTelemetry
10
+ * sink resolved from configuration. The connection-string **secret** is never a
11
+ * config field — configuration only names the *env var* that holds it, and the
12
+ * value is read through an injected `EnvReader` (no real `process.env` in the
13
+ * pure path). This keeps `.opencode/opencode.json` free of credentials (P8 (b)).
14
+ */
15
+ /** Injected environment-variable reader (never real `process.env` in tests). */
16
+ export type EnvReader = (name: string) => string | undefined;
17
+ /**
18
+ * OpenTelemetry backend configuration block. Names the env var that provides the
19
+ * Application Insights connection string; it deliberately carries **no** secret.
20
+ *
21
+ * The field is `connectionEnv` (the env var *name*), never `connectionString`:
22
+ * a field whose name matched the secret vocabulary would trip the config-secret
23
+ * guard (`tests/contract/portability-boundary.test.ts`).
24
+ */
25
+ export declare const OtelBackendConfigSchema: z.ZodObject<{
26
+ backend: z.ZodLiteral<"opentelemetry">;
27
+ connectionEnv: z.ZodString;
28
+ serviceName: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strict>;
30
+ export type OtelBackendConfig = z.infer<typeof OtelBackendConfigSchema>;
31
+ /** A parsed Application Insights connection string (key/value, `;`-separated). */
32
+ export type ParsedConnectionString = {
33
+ readonly instrumentationKey: string;
34
+ readonly ingestionEndpoint?: string;
35
+ };
36
+ /**
37
+ * Parses an Application Insights connection string. Returns `null` when it is
38
+ * malformed (no `InstrumentationKey`), which callers treat as a disable-with-
39
+ * warning condition rather than a hard failure.
40
+ */
41
+ export declare function parseConnectionString(raw: string): ParsedConnectionString | null;
42
+ /**
43
+ * Redacts a connection string for human-facing output (e.g. `openteam doctor`).
44
+ * The raw string never appears: the instrumentation key is masked and only the
45
+ * non-secret ingestion host is echoed when present.
46
+ */
47
+ export declare function redactConnectionString(raw: string): string;
48
+ /** Builds a concrete transport port from a parsed connection string. */
49
+ export type ExporterFactory = (connection: ParsedConnectionString, config: OtelBackendConfig) => OtelSpanExporter;
50
+ /** Dependencies for resolving an OpenTelemetry sink from configuration. */
51
+ export type OtelResolutionDeps = {
52
+ /** Injected env reader that provides the connection string value. */
53
+ readonly env: EnvReader;
54
+ /** Injected factory building the concrete OTLP transport port. */
55
+ readonly buildExporter: ExporterFactory;
56
+ /** Telemetry error handler passed to the OTel sink. */
57
+ readonly onError?: (error: unknown) => void;
58
+ /** Warning handler for misconfiguration (invalid/absent connection string). */
59
+ readonly onWarn?: (message: string) => void;
60
+ /** Optional deadline so a hanging exporter cannot stall emit. */
61
+ readonly deadline?: OtelDeadline;
62
+ };
63
+ /** Outcome of resolving the OpenTelemetry backend. */
64
+ export type OtelResolution = {
65
+ /** The OpenTelemetry sink, or `undefined` to fall back to JSONL-only. */
66
+ readonly sink?: EventSink;
67
+ /** Whether the env var actually provided a value. */
68
+ readonly connectionStringPresent: boolean;
69
+ /** A single warning when the backend is disabled by misconfiguration. */
70
+ readonly warning?: string;
71
+ };
72
+ /**
73
+ * Resolves an OpenTelemetry sink from an (already-parsed) backend config plus an
74
+ * injected env reader. Falls back to JSONL-only (no sink) when the env var is
75
+ * absent, and disables with a single warning when the connection string is
76
+ * malformed — never aborting startup.
77
+ */
78
+ export declare function resolveOtelSink(config: OtelBackendConfig | undefined, deps: OtelResolutionDeps): OtelResolution;
79
+ /**
80
+ * Human-facing OpenTelemetry backend view for `openteam doctor` (W1-S04, see
81
+ * #163). Carries only **redacted** detail: the raw connection string never
82
+ * enters this structure, so it cannot leak through doctor output or any JSON
83
+ * serialization of the doctor input.
84
+ */
85
+ export type OtelDoctorView = {
86
+ readonly configured: boolean;
87
+ /** Env var name that provides the connection string (safe to show). */
88
+ readonly connectionEnv: string;
89
+ readonly status: "active" | "unconfigured" | "invalid";
90
+ /** Redacted, human-facing connection detail. Never the raw string. */
91
+ readonly redacted?: string;
92
+ };
93
+ /**
94
+ * Builds the redacted doctor view for the OpenTelemetry backend. The connection
95
+ * string is read through the injected env reader and passed through
96
+ * `redactConnectionString`; the raw value is never returned.
97
+ */
98
+ export declare function describeOtelBackendForDoctor(config: OtelBackendConfig | undefined, env: EnvReader): OtelDoctorView | undefined;
99
+ /** Options controlling telemetry sink composition. */
100
+ export type TelemetrySinkOptions = {
101
+ /** Master switch: when false, telemetry is the null sink. */
102
+ readonly enabled: boolean;
103
+ /** Optional OpenTelemetry backend block (already validated). */
104
+ readonly otel?: OtelBackendConfig;
105
+ };
106
+ /** Dependencies for composing the telemetry sink. */
107
+ export type TelemetrySinkDeps = {
108
+ /** JSONL event-log sink dependencies. */
109
+ readonly eventLog: EventLogSinkDeps;
110
+ /** OpenTelemetry resolution dependencies. */
111
+ readonly otel: OtelResolutionDeps;
112
+ };
113
+ /** Result of composing the telemetry sink, exposing the resolution detail. */
114
+ export type TelemetrySinkResult = {
115
+ readonly sink: EventSink;
116
+ readonly resolution: OtelResolution;
117
+ };
118
+ /**
119
+ * Single construction point for the telemetry event sink. Returns:
120
+ * - the null sink when telemetry is disabled;
121
+ * - the JSONL sink alone when no OpenTelemetry backend resolves;
122
+ * - a fan-out of JSONL + OpenTelemetry when a backend resolves.
123
+ *
124
+ * This is the function `createEventSink` (`src/index.ts`) delegates to, so the
125
+ * fan-out has exactly one construction site.
126
+ */
127
+ export declare function createTelemetryEventSink(options: TelemetrySinkOptions, deps: TelemetrySinkDeps): TelemetrySinkResult;
128
+ //# sourceMappingURL=otelConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otelConfig.d.ts","sourceRoot":"","sources":["../../src/telemetry/otelConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,QAAQ,CAAC;AAEhB;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB;;;;kBAQzB,CAAC;AAEZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,kFAAkF;AAClF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QA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cAAc,GAAG;IAC3B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,cAAc,GAAG,SAAS,CAAC;IACvD,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,iBAAiB,GAAG,SAAS,EACrC,GAAG,EAAE,SAAS,GACb,cAAc,GAAG,SAAS,CA0B5B;AAED,sDAAsD;AACtD,MAAM,MAAM,oBAAoB,GAAG;IACjC,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC;CACnC,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;CACrC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,oBAAoB,EAC7B,IAAI,EAAE,iBAAiB,GACtB,mBAAmB,CAmBrB"}
@@ -0,0 +1,7 @@
1
+ import type { ExporterFactory } from "./otelConfig";
2
+ /**
3
+ * `ExporterFactory` that builds a real OTLP/HTTP trace exporter port. The heavy
4
+ * SDK import is deferred to the first `export` call and memoized thereafter.
5
+ */
6
+ export declare const createOtlpSpanExporter: ExporterFactory;
7
+ //# sourceMappingURL=otelExporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otelExporter.d.ts","sourceRoot":"","sources":["../../src/telemetry/otelExporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,cAAc,CAAC;AA0DtB;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,eAcpC,CAAC"}
@@ -1,11 +1,25 @@
1
1
  import type { StorageProvider } from "../storage/provider";
2
2
  import { type CostRecord } from "./types";
3
- export declare const DEFAULT_TELEMETRY_PATH = ".opencode/openteam-telemetry.jsonl";
3
+ /** Machine-local cost telemetry file (P15b): lives under the git-ignored
4
+ * `.opencode/openteam-local/` directory so it never enters the portable repo. */
5
+ export declare const DEFAULT_TELEMETRY_PATH = ".opencode/openteam-local/telemetry.jsonl";
6
+ /** Rejection detail for a single telemetry JSONL line. */
7
+ export type TelemetryJsonlLineRejection = {
8
+ readonly lineNumber: number;
9
+ readonly detail: string;
10
+ };
11
+ /** Result of parsing legacy cost telemetry JSONL. */
12
+ export type ParseCostRecordsJsonlResult = {
13
+ readonly records: CostRecord[];
14
+ readonly rejectedLines: number;
15
+ readonly rejections: readonly TelemetryJsonlLineRejection[];
16
+ };
4
17
  /**
5
18
  * Parse newline-delimited JSON cost records.
6
- * Pure: silently skips blank lines and lines that fail schema validation,
7
- * so a partially corrupted telemetry file never throws.
19
+ * Pure: skips blank lines, counts malformed or schema-invalid nonblank lines,
20
+ * and never throws for bad records so callers can warn without breaking runtime.
8
21
  */
9
- export declare function parseCostRecordsJsonl(text: string): CostRecord[];
22
+ export declare function parseCostRecordsJsonl(text: string): ParseCostRecordsJsonlResult;
23
+ export declare function warnCostRecordRejections(result: ParseCostRecordsJsonlResult, source: string): void;
10
24
  export declare function readCostRecords(path: string, storage?: StorageProvider): Promise<CostRecord[]>;
11
25
  //# sourceMappingURL=read.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/telemetry/read.ts"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AU,EAAE,CAAC,CAQvB"}
@@ -11,13 +11,14 @@ export declare const CostRecordSchema: z.ZodObject<{
11
11
  trivial: "trivial";
12
12
  }>;
13
13
  routeKind: z.ZodEnum<{
14
+ blocked: "blocked";
14
15
  frontier: "frontier";
15
16
  local: "local";
16
17
  }>;
17
18
  selected: z.ZodObject<{
18
19
  providerID: z.ZodString;
19
20
  modelID: z.ZodString;
20
- }, z.core.$strip>;
21
+ }, z.core.$strict>;
21
22
  rationale: z.ZodString;
22
23
  estimatedCostUSD: z.ZodNumber;
23
24
  baselineCostUSD: z.ZodNumber;
@@ -25,6 +26,6 @@ export declare const CostRecordSchema: z.ZodObject<{
25
26
  budgetAction: z.ZodString;
26
27
  tokensIn: z.ZodOptional<z.ZodNumber>;
27
28
  tokensOut: z.ZodOptional<z.ZodNumber>;
28
- }, z.core.$strip>;
29
+ }, z.core.$strict>;
29
30
  export type CostRecord = z.infer<typeof CostRecordSchema>;
30
31
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/telemetry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/telemetry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiBlB,CAAC;AAEZ,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,154 @@
1
+ import { type OpenTeamConfig } from "../config/schema";
2
+ import type { StorageProvider } from "../storage/provider";
3
+ /**
4
+ * Machine-specific key paths. Edits to these are routed to the ignored local
5
+ * overlay instead of the committed base, so saving in the console never pushes a
6
+ * value that would be wrong on a teammate's machine (P16, #197). `local.runtimes`
7
+ * is listed as the whole array because arrays replace wholesale on merge — the
8
+ * documented caveat is that overriding one runtime's `baseURL` restates the
9
+ * entire array.
10
+ */
11
+ export declare const MACHINE_SPECIFIC_KEYS: readonly ["local.runtimes", "console.host", "console.port"];
12
+ /**
13
+ * Keys the console process can serve fresh through a config getter WITHOUT a
14
+ * restart (P14 hybrid, hot half). Deliberately conservative: only
15
+ * `console.refreshMs` is read per-request by the renderer, so it is the one key
16
+ * the console genuinely applies live. Every other key is consumed by the
17
+ * opencode plugin session, which froze config at load and therefore needs a
18
+ * restart — reporting them as live would be the exact silent no-op the P14
19
+ * decision forbids.
20
+ */
21
+ export declare const HOT_RELOADABLE_KEYS: readonly ["console.refreshMs"];
22
+ /**
23
+ * Env-sourced secret descriptors (P8b). The value is NEVER read into any
24
+ * response — only its presence is reported, marked "set via environment".
25
+ */
26
+ export declare const KNOWN_ENV_SECRETS: readonly [{
27
+ readonly key: "telemetry.connectionString";
28
+ readonly envVar: "APPLICATIONINSIGHTS_CONNECTION_STRING";
29
+ readonly label: "Application Insights connection string";
30
+ }];
31
+ export declare const SET_VIA_ENVIRONMENT: "set via environment";
32
+ export declare function isMachineSpecificPath(path: string): boolean;
33
+ export declare function isHotReloadablePath(path: string): boolean;
34
+ /**
35
+ * Collect changed leaf paths comparing `next` against `prev`. Objects recurse;
36
+ * arrays and scalars are compared as a whole (the path stops at the array key),
37
+ * matching the merge semantics where arrays replace wholesale.
38
+ */
39
+ export declare function diffConfigLeaves(prev: unknown, next: unknown, base?: string): string[];
40
+ /** One audited config-write entry: the path plus a content-free descriptor. */
41
+ export type ConfigAuditEntry = {
42
+ readonly path: string;
43
+ readonly valueHash?: string;
44
+ readonly chars?: number;
45
+ readonly value?: number | boolean | null;
46
+ };
47
+ export type ConfigAuditRecord = {
48
+ readonly ts: string;
49
+ readonly kind: "config.write";
50
+ readonly changed: readonly string[];
51
+ readonly entries: readonly ConfigAuditEntry[];
52
+ readonly wroteBase: boolean;
53
+ readonly wroteOverlay: boolean;
54
+ };
55
+ /**
56
+ * Describe a changed value for the audit trail WITHOUT leaking its content.
57
+ * Strings and structured values are stored as a hash plus character count;
58
+ * only non-string scalars (numbers, booleans, null) are recorded verbatim,
59
+ * because they can never carry a prompt body. This mirrors telemetry's stance:
60
+ * hash, never raw.
61
+ */
62
+ export declare function auditValue(value: unknown): Omit<ConfigAuditEntry, "path">;
63
+ /**
64
+ * Defensive scrub: replace any string that carries a known env-secret value with
65
+ * a redaction marker. The committed schema is already secret-free, so this never
66
+ * fires on a real config; it is belt-and-suspenders that guarantees a secret can
67
+ * never round-trip through the read endpoint even if one ever leaked into config.
68
+ */
69
+ export declare function scrubSecretStrings(value: unknown, secrets: readonly string[]): unknown;
70
+ export type ConfigSecretDescriptor = {
71
+ readonly key: string;
72
+ readonly source: typeof SET_VIA_ENVIRONMENT;
73
+ readonly set: boolean;
74
+ };
75
+ export type ConfigReadResult = {
76
+ readonly config: OpenTeamConfig;
77
+ readonly reload: {
78
+ readonly hotReloadable: readonly string[];
79
+ readonly restartRequired: readonly string[];
80
+ };
81
+ readonly overlay: {
82
+ readonly active: boolean;
83
+ readonly machineSpecificKeys: readonly string[];
84
+ };
85
+ readonly secrets: readonly ConfigSecretDescriptor[];
86
+ };
87
+ export type ConfigWriteResult = {
88
+ readonly status: 200;
89
+ readonly body: {
90
+ readonly ok: true;
91
+ readonly changed: readonly string[];
92
+ readonly applied: readonly string[];
93
+ readonly pendingRestart: readonly string[];
94
+ readonly wroteBase: boolean;
95
+ readonly wroteOverlay: boolean;
96
+ };
97
+ } | {
98
+ readonly status: 400;
99
+ readonly body: {
100
+ readonly ok: false;
101
+ readonly error: string;
102
+ };
103
+ };
104
+ export type ConfigEditorPorts = {
105
+ storage: StorageProvider;
106
+ basePath?: string;
107
+ overlayPath?: string;
108
+ /** Reads an environment variable; injected so the read side is deterministic. */
109
+ env?: (name: string) => string | undefined;
110
+ /** Audit sink; every persisted write appends one content-free record. */
111
+ audit?: (record: ConfigAuditRecord) => void | Promise<void>;
112
+ /** Clock for the audit timestamp; injected for determinism. */
113
+ now?: () => string;
114
+ /**
115
+ * Fires after a write persists at least one change, so the composition root
116
+ * can reload the live config getter (P14 hybrid). Optional.
117
+ */
118
+ onPersisted?: () => void | Promise<void>;
119
+ };
120
+ /**
121
+ * Default machine-local audit log for console config writes. Content-free
122
+ * (paths + hashes, never a raw value) and git-ignored, so it never leaves the
123
+ * developer's machine and never lands in committed history.
124
+ */
125
+ export declare const DEFAULT_CONFIG_AUDIT_PATH = ".opencode/openteam-local/config-audit.jsonl";
126
+ /**
127
+ * The editor's editable surface (W7-S16 / #200). The console edits the openteam
128
+ * config object only. "System prompt" is the body of an agent Markdown file
129
+ * under `.opencode/agent/*.md`, not a config field; "harness" and "skills" have
130
+ * no openteam representation. The editor therefore mounts NO systemPrompt /
131
+ * harness / skills sub-tab, so it never claims to edit a field that does not
132
+ * exist.
133
+ */
134
+ export type EditableArtifact = {
135
+ readonly id: string;
136
+ readonly kind: "openteam-config" | "agent-markdown";
137
+ readonly validated: boolean;
138
+ readonly mvp: boolean;
139
+ };
140
+ export declare function editableSurface(): readonly EditableArtifact[];
141
+ export declare function createConfigEditor(ports: ConfigEditorPorts): {
142
+ editableSurface: typeof editableSurface;
143
+ read(): Promise<ConfigReadResult>;
144
+ write(submittedRaw: unknown): Promise<ConfigWriteResult>;
145
+ };
146
+ export type ConfigEditor = ReturnType<typeof createConfigEditor>;
147
+ /**
148
+ * Restart-required top-level keys surfaced by the read endpoint. Behaviourally
149
+ * significant keys consumed by the opencode plugin session, which reads config
150
+ * once at load. Kept beside `HOT_RELOADABLE_KEYS` as the single classification
151
+ * source of truth (#193).
152
+ */
153
+ export declare const RESTART_REQUIRED_KEYS: readonly ["baseline", "router", "local", "privacyMode", "graph", "orchestrator", "memory", "console.host", "console.port"];
154
+ //# sourceMappingURL=configApi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configApi.d.ts","sourceRoot":"","sources":["../../src/web/configApi.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA6B3D;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,YAChC,gBAAgB,EAChB,cAAc,EACd,cAAc,CACN,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,YAAI,mBAAmB,CAAU,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,iBAAiB;aAE1B,GAAG,EAAE,4BAA4B;aACjC,MAAM,EAAE,uCAAuC;aAC/C,KAAK,EAAE,wCAAwC;EAEzC,CAAC;AAEX,eAAO,MAAM,mBAAmB,EAAG,qBAA8B,CAAC;AAElE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI3D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAwBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,EACb,IAAI,SAAK,GACR,MAAM,EAAE,CAgBV;AA8BD,+EAA+E;AAC/E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,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S,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,eAAe,IAAI,SAAS,gBAAgB,EAAE,CAS7D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB;;YAgCzC,OAAO,CAAC,gBAAgB,CAAC;wBA6Bb,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC;EA8FjE;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,YAChC,UAAU,EACV,QAAQ,EACR,OAAO,EACP,aAAa,EACb,OAAO,EACP,cAAc,EACd,QAAQ,EACR,cAAc,EACd,cAAc,CACN,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { IncomingMessage, ServerResponse } from "node:http";
2
+ import type { ConfigEditor } from "./configApi";
3
+ /**
4
+ * HTTP routes for the console config editor: `GET /api/config` (read, redacted)
5
+ * and `POST /api/config` (write, validated). Both require the per-launch
6
+ * ephemeral token — config is more sensitive than the read-only dashboard, so it
7
+ * is token-gated even on pure loopback (a strict hardening, never a relaxation).
8
+ *
9
+ * Mutations are additionally CSRF-safe (W7-S06 / #190): the token is accepted
10
+ * ONLY in the `Authorization: Bearer` header (never `?token=`), cross-origin
11
+ * requests are rejected by `Origin`/`Sec-Fetch-Site`, and no ambient cookie auth
12
+ * exists. The surface is loopback-only (W7-S07 / #191): `console.host` cannot
13
+ * widen past `ConsoleHostSchema`, enforced by the write validator.
14
+ */
15
+ export type ConfigRouteDeps = {
16
+ token: string;
17
+ editor: Pick<ConfigEditor, "read" | "write">;
18
+ };
19
+ /**
20
+ * A mutation is CSRF-safe only when it is same-origin. Any `Origin` whose host
21
+ * is not loopback is cross-origin and rejected. A missing `Origin`
22
+ * (same-origin navigations, non-browser clients) is allowed, but the bearer
23
+ * token is still required separately.
24
+ */
25
+ export declare function isCrossOriginMutation(request: IncomingMessage): boolean;
26
+ /**
27
+ * Routes `/api/config`. Returns `true` when it handled (and answered) the
28
+ * request, `false` so the server continues with its other routes.
29
+ */
30
+ export declare function handleConfigRoute(request: IncomingMessage, response: ServerResponse, url: URL, deps: ConfigRouteDeps): Promise<boolean>;
31
+ /** A synthetic or real opencode watcher event, narrowed to the fields we read. */
32
+ export type ConfigChangeEvent = {
33
+ readonly type?: string;
34
+ readonly properties?: {
35
+ readonly event?: string;
36
+ readonly file?: string;
37
+ };
38
+ };
39
+ /**
40
+ * P14 hybrid reload (hot half). Holds a mutable config reference behind a getter
41
+ * and re-runs `load` when a `file.watcher.updated` `change` event names the
42
+ * config path. The console renderer consults `current()` per request, so a
43
+ * hot-reloadable key (`console.refreshMs`) is served fresh WITHOUT a restart; the
44
+ * `file.watcher.updated` firing for an external write is verified at integration
45
+ * time (it needs a live opencode process), with `watchSources` on the config
46
+ * path as the deterministic fallback.
47
+ */
48
+ export declare function createConfigReloader<T>(deps: {
49
+ initial: T;
50
+ load: () => Promise<T>;
51
+ configPath: string;
52
+ }): {
53
+ current: () => T;
54
+ reload: () => Promise<T>;
55
+ handleEvent: (event: ConfigChangeEvent) => Promise<boolean>;
56
+ };
57
+ //# sourceMappingURL=configRoute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configRoute.d.ts","sourceRoot":"","sources":["../../src/web/configRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAOjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CAC9C,CAAC;AA0CF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAcvE;AAiCD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,OAAO,CAAC,CAmElB;AAED,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE;QACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;CACH,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,IAAI,EAAE;IAC5C,OAAO,EAAE,CAAC,CAAC;IACX,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG;IACF,OAAO,EAAE,MAAM,CAAC,CAAC;IACjB,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,WAAW,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7D,CAwBA"}
@@ -18,6 +18,14 @@ export type ConsoleRouteDeps = {
18
18
  drilldownEnabled?: boolean;
19
19
  /** Habilita la vista "Terminal" (PTY real, Fase 5). Opt-in. */
20
20
  ptyEnabled?: boolean;
21
+ /**
22
+ * Habilita el **modo diagnóstico local** (P11b): opt-in del operador para que
23
+ * las rutas de lectura (`stream`, `messages`) puedan servir texto verbatim en
24
+ * lugar de la referencia redactada por defecto. Requiere además `?diagnostic=1`
25
+ * en la petición. Off por defecto: sin esta bandera el contenido va redactado
26
+ * aunque la petición pida diagnóstico. Nunca debilita el token ni el loopback.
27
+ */
28
+ diagnosticEnabled?: boolean;
21
29
  /** Resuelve el origen del servidor opencode de una sesión (o `undefined`). */
22
30
  resolveEndpoint: (sessionID: string) => Promise<string | undefined>;
23
31
  /** Crea un cliente opencode para un endpoint (inyectable en tests). */
@@ -1 +1 @@
1
- {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/web/console.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8EAA8E;IAC9E,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACpE,uEAAuE;IACvE,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,aAAa,CAAC;IAClD,mEAAmE;IACnE,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC;CACnD,CAAC;AA4OF;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,OAAO,CAAC,CAqDlB"}
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/web/console.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8EAA8E;IAC9E,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACpE,uEAAuE;IACvE,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,aAAa,CAAC;IAClD,mEAAmE;IACnE,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC;CACnD,CAAC;AAiPF;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,OAAO,CAAC,CA4DlB"}
@@ -1,4 +1,5 @@
1
- /** Rutas por defecto de las fuentes que alimentan el console. */
2
- export declare const DEFAULT_BACKLOG_PATH = ".opencode/openteam-backlog.md";
3
- export declare const DEFAULT_DECISIONS_PATH = ".opencode/openteam-decisions.md";
1
+ /** Rutas por defecto de las fuentes que alimentan el console.
2
+ * Portable team-state (P15b): committed under `.opencode/openteam/`. */
3
+ export declare const DEFAULT_BACKLOG_PATH = ".opencode/openteam/backlog.md";
4
+ export declare const DEFAULT_DECISIONS_PATH = ".opencode/openteam/decisions.md";
4
5
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/web/paths.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,kCAAkC,CAAC;AACpE,eAAO,MAAM,sBAAsB,oCAAoC,CAAC"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/web/paths.ts"],"names":[],"mappings":"AAAA;wEACwE;AACxE,eAAO,MAAM,oBAAoB,kCAAkC,CAAC;AACpE,eAAO,MAAM,sBAAsB,oCAAoC,CAAC"}
@@ -4,11 +4,24 @@ import type { ConsoleClient } from "../console/opencodeClient";
4
4
  import type { PtyClient } from "../console/pty";
5
5
  import type { ConsoleInputs } from "../console/state";
6
6
  import type { GraphViewProjectionV1 } from "../telemetry/graphView";
7
+ import { type ConfigRouteDeps } from "./configRoute";
7
8
  import { type StorageRouteDeps } from "./storageRoute";
8
9
  export type ConsoleServerDeps = {
9
10
  /** Relee las fuentes y produce los inputs crudos del console. */
10
11
  readSnapshot: () => Promise<ConsoleInputs>;
11
12
  config: ConsoleConfig;
13
+ /**
14
+ * Live console-config getter (P14 hybrid, hot half). When provided, the
15
+ * renderer reads hot-reloadable presentation keys (`console.refreshMs`) from
16
+ * this getter instead of the frozen `config`, so a reloaded value is served
17
+ * fresh without a restart. Absent → behaviour is identical to today.
18
+ */
19
+ getConsoleConfig?: () => ConsoleConfig;
20
+ /**
21
+ * Config editor surface (`/api/config`, read + write). Opt-in: without it the
22
+ * console exposes no config endpoint. Token-gated even on loopback.
23
+ */
24
+ configApi?: ConfigRouteDeps;
12
25
  /** Inyectable para tests; por defecto el `createServer` de `node:http`. */
13
26
  createServer?: typeof createHttpServer;
14
27
  /** Logger (por defecto `console`). */
@@ -26,12 +39,18 @@ export type ConsoleServerDeps = {
26
39
  drilldownEnabled?: boolean;
27
40
  /** Habilita la vista "Terminal" (PTY real, Fase 5). Opt-in. */
28
41
  ptyEnabled?: boolean;
42
+ /**
43
+ * Habilita el **modo diagnóstico local** (P11b): opt-in del operador para que
44
+ * el drill-down sirva texto verbatim en vez de la referencia redactada por
45
+ * defecto (requiere además `?diagnostic=1` en la petición). Off por defecto.
46
+ */
47
+ diagnosticEnabled?: boolean;
29
48
  createClient: (endpoint: string) => ConsoleClient;
30
49
  createPtyClient?: (endpoint: string) => PtyClient;
31
50
  };
32
51
  /**
33
52
  * Endpoint remoto de storage (`/storage/*`). Opcional y opt-in: expone el
34
- * estado del equipo autenticado con token para una Console remota vía tunnel.
53
+ * estado del equipo autenticado con token para una Console remota.
35
54
  */
36
55
  storageApi?: StorageRouteDeps;
37
56
  /**
@@ -43,6 +62,16 @@ export type ConsoleServerDeps = {
43
62
  graphApi?: {
44
63
  readView: () => Promise<GraphViewProjectionV1 | null>;
45
64
  };
65
+ /**
66
+ * `true` when the operator enabled the console agent-tree view
67
+ * (`console.graphView.enabled`) but the graph engine is off (`graph.mode` ==
68
+ * "off"), so no `graphApi` provider is wired. The shell still mounts the
69
+ * agent-tree tab and renders the `graph.mode` remediation hint instead of a
70
+ * bare-missing tab (PRD W7 acceptance #9). `/api/graph` and the SSE `graph`
71
+ * frame stay absent because they follow `graphApi`. Absent/`false` → behaviour
72
+ * is identical to today.
73
+ */
74
+ graphDisabled?: boolean;
46
75
  };
47
76
  export type ConsoleServer = {
48
77
  url: string;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/web/server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,gBAAgB,EAIjC,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAOpE,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CA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