@jmanuelcorral/openteam 0.2.2 → 0.9.0
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.
- package/.opencode/command/openteam.md +2 -1
- package/.opencode/openteam.example.json +27 -8
- package/AGENTS.md +5 -2
- package/README.es.md +155 -59
- package/README.md +418 -62
- package/dist/capabilities/types.d.ts +3 -3
- package/dist/capabilities/types.d.ts.map +1 -1
- package/dist/classifier/localClassifier.d.ts +0 -2
- package/dist/classifier/localClassifier.d.ts.map +1 -1
- package/dist/cli/consoleServe.d.ts +21 -1
- package/dist/cli/consoleServe.d.ts.map +1 -1
- package/dist/cli/graphOperator.d.ts +22 -0
- package/dist/cli/graphOperator.d.ts.map +1 -0
- package/dist/cli/graphStatusSnapshot.d.ts +16 -0
- package/dist/cli/graphStatusSnapshot.d.ts.map +1 -0
- package/dist/cli/migrateAdapter.d.ts +12 -0
- package/dist/cli/migrateAdapter.d.ts.map +1 -0
- package/dist/cli/purgeAdapter.d.ts +10 -0
- package/dist/cli/purgeAdapter.d.ts.map +1 -0
- package/dist/cli/setupAdapters.d.ts.map +1 -1
- package/dist/cli.js +13394 -6121
- package/dist/commands/agents.d.ts +102 -2
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/baseline.d.ts.map +1 -1
- package/dist/commands/clearCache.d.ts +23 -0
- package/dist/commands/clearCache.d.ts.map +1 -0
- package/dist/commands/dispatch.d.ts +196 -4
- package/dist/commands/dispatch.d.ts.map +1 -1
- package/dist/commands/doctor.d.ts +40 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/frontierCatalog.d.ts +8 -14
- package/dist/commands/frontierCatalog.d.ts.map +1 -1
- package/dist/commands/graph.d.ts +0 -27
- package/dist/commands/graph.d.ts.map +1 -1
- package/dist/commands/local.d.ts.map +1 -1
- package/dist/commands/migrate.d.ts +11 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/purge.d.ts +132 -0
- package/dist/commands/purge.d.ts.map +1 -0
- package/dist/commands/report.d.ts +1 -0
- package/dist/commands/report.d.ts.map +1 -1
- package/dist/commands/setup.d.ts +62 -5
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/config/errors.d.ts +10 -0
- package/dist/config/errors.d.ts.map +1 -0
- package/dist/config/legacyMigration.d.ts +82 -0
- package/dist/config/legacyMigration.d.ts.map +1 -0
- package/dist/config/legacyPaths.d.ts +105 -0
- package/dist/config/legacyPaths.d.ts.map +1 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/opencode.d.ts +63 -0
- package/dist/config/opencode.d.ts.map +1 -0
- package/dist/config/persist.d.ts +8 -0
- package/dist/config/persist.d.ts.map +1 -1
- package/dist/config/resolve.d.ts +1 -1
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/runtime.d.ts +62 -0
- package/dist/config/runtime.d.ts.map +1 -0
- package/dist/config/schema.d.ts +142 -79
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/console/assets.d.ts +2 -2
- package/dist/console/assets.d.ts.map +1 -1
- package/dist/console/configView.d.ts +74 -0
- package/dist/console/configView.d.ts.map +1 -0
- package/dist/console/opencodeClient.d.ts +8 -6
- package/dist/console/opencodeClient.d.ts.map +1 -1
- package/dist/console/protocol.d.ts +30 -6
- package/dist/console/protocol.d.ts.map +1 -1
- package/dist/console/render.d.ts +30 -1
- package/dist/console/render.d.ts.map +1 -1
- package/dist/console/types.d.ts +1 -1
- package/dist/console/types.d.ts.map +1 -1
- package/dist/context/redaction.d.ts +19 -19
- package/dist/context/redaction.d.ts.map +1 -1
- package/dist/context/schema.d.ts +26 -26
- package/dist/context/schema.d.ts.map +1 -1
- package/dist/context/types.d.ts +3 -3
- package/dist/contract/opencode.d.ts +39 -23
- package/dist/contract/opencode.d.ts.map +1 -1
- package/dist/graph/certificate.d.ts +37 -16
- package/dist/graph/certificate.d.ts.map +1 -1
- package/dist/graph/langgraph/adapter.d.ts +56 -0
- package/dist/graph/langgraph/adapter.d.ts.map +1 -0
- package/dist/graph/langgraph/certification.d.ts +64 -0
- package/dist/graph/langgraph/certification.d.ts.map +1 -0
- package/dist/graph/langgraph/checkpointReplay.d.ts +49 -0
- package/dist/graph/langgraph/checkpointReplay.d.ts.map +1 -0
- package/dist/graph/langgraph/checkpointer.d.ts +49 -0
- package/dist/graph/langgraph/checkpointer.d.ts.map +1 -0
- package/dist/graph/langgraph/engine.d.ts +34 -0
- package/dist/graph/langgraph/engine.d.ts.map +1 -0
- package/dist/graph/langgraph/graphModel.d.ts +37 -0
- package/dist/graph/langgraph/graphModel.d.ts.map +1 -0
- package/dist/graph/langgraph/reducer.d.ts +18 -0
- package/dist/graph/langgraph/reducer.d.ts.map +1 -0
- package/dist/graph/langgraph/retirement.d.ts +59 -0
- package/dist/graph/langgraph/retirement.d.ts.map +1 -0
- package/dist/graph/langgraph/types.d.ts +65 -0
- package/dist/graph/langgraph/types.d.ts.map +1 -0
- package/dist/graph/privacyPolicy.d.ts +7 -0
- package/dist/graph/privacyPolicy.d.ts.map +1 -1
- package/dist/graph/soakLedger.d.ts.map +1 -1
- package/dist/graph/types.d.ts +0 -2
- package/dist/graph/types.d.ts.map +1 -1
- package/dist/index.d.ts +46 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11083 -5009
- package/dist/local/cacheAdapter.d.ts +7 -0
- package/dist/local/cacheAdapter.d.ts.map +1 -0
- package/dist/local/concurrency.d.ts +52 -0
- package/dist/local/concurrency.d.ts.map +1 -0
- package/dist/local/embeddings.d.ts +10 -10
- package/dist/local/embeddings.d.ts.map +1 -1
- package/dist/local/extractClient.d.ts +13 -10
- package/dist/local/extractClient.d.ts.map +1 -1
- package/dist/local/lemonade.d.ts +4 -0
- package/dist/local/lemonade.d.ts.map +1 -0
- package/dist/local/registry.d.ts +16 -0
- package/dist/local/registry.d.ts.map +1 -1
- package/dist/local/types.d.ts +1 -1
- package/dist/local/types.d.ts.map +1 -1
- package/dist/mcp/semanticRecall.d.ts +18 -1
- package/dist/mcp/semanticRecall.d.ts.map +1 -1
- package/dist/mcp/server.d.ts +41 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/memory/embedText.d.ts +4 -0
- package/dist/memory/embedText.d.ts.map +1 -0
- package/dist/memory/extract.d.ts +33 -18
- package/dist/memory/extract.d.ts.map +1 -1
- package/dist/memory/fold.d.ts +3 -2
- package/dist/memory/fold.d.ts.map +1 -1
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/inject.d.ts.map +1 -1
- package/dist/memory/log.d.ts +15 -4
- package/dist/memory/log.d.ts.map +1 -1
- package/dist/memory/merge.d.ts +18 -1
- package/dist/memory/merge.d.ts.map +1 -1
- package/dist/memory/traverse.d.ts +80 -0
- package/dist/memory/traverse.d.ts.map +1 -0
- package/dist/memory/types.d.ts +53 -7
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/messages/commands.d.ts +84 -0
- package/dist/messages/commands.d.ts.map +1 -0
- package/dist/messages/index.d.ts +46 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/opencodeArtifacts/index.d.ts +33 -0
- package/dist/opencodeArtifacts/index.d.ts.map +1 -0
- package/dist/opencodeArtifacts/orchestratorAgent.d.ts +29 -0
- package/dist/opencodeArtifacts/orchestratorAgent.d.ts.map +1 -0
- package/dist/opencodeArtifacts/slashCommand.d.ts +31 -0
- package/dist/opencodeArtifacts/slashCommand.d.ts.map +1 -0
- package/dist/orchestrator/coordinator.d.ts +152 -1
- package/dist/orchestrator/coordinator.d.ts.map +1 -1
- package/dist/orchestrator/graphCancellation.d.ts +40 -37
- package/dist/orchestrator/graphCancellation.d.ts.map +1 -1
- package/dist/orchestrator/graphEffects.d.ts +24 -24
- package/dist/orchestrator/graphEffects.d.ts.map +1 -1
- package/dist/orchestrator/graphFacade.d.ts +16 -16
- package/dist/orchestrator/graphFacade.d.ts.map +1 -1
- package/dist/orchestrator/graphIngress.d.ts +49 -45
- package/dist/orchestrator/graphIngress.d.ts.map +1 -1
- package/dist/orchestrator/graphReview.d.ts +24 -23
- package/dist/orchestrator/graphReview.d.ts.map +1 -1
- package/dist/orchestrator/graphRuntime.d.ts +27 -26
- package/dist/orchestrator/graphRuntime.d.ts.map +1 -1
- package/dist/orchestrator/graphShadow.d.ts +70 -69
- package/dist/orchestrator/graphShadow.d.ts.map +1 -1
- package/dist/orchestrator/opencodeSessionAdapter.d.ts +25 -25
- package/dist/orchestrator/opencodeSessionAdapter.d.ts.map +1 -1
- package/dist/orchestrator/permissions.d.ts.map +1 -1
- package/dist/orchestrator/ralphLoop.d.ts +57 -0
- package/dist/orchestrator/ralphLoop.d.ts.map +1 -0
- package/dist/orchestrator/roles.d.ts +50 -8
- package/dist/orchestrator/roles.d.ts.map +1 -1
- package/dist/orchestrator/roster.d.ts +103 -0
- package/dist/orchestrator/roster.d.ts.map +1 -0
- package/dist/orchestrator/rosterPersistence.d.ts +22 -0
- package/dist/orchestrator/rosterPersistence.d.ts.map +1 -0
- package/dist/orchestrator/runtimeSelection.d.ts +46 -0
- package/dist/orchestrator/runtimeSelection.d.ts.map +1 -0
- package/dist/orchestrator/sddCompiler.d.ts +34 -34
- package/dist/orchestrator/sddCompiler.d.ts.map +1 -1
- package/dist/orchestrator/sessionReconciler.d.ts +31 -29
- package/dist/orchestrator/sessionReconciler.d.ts.map +1 -1
- package/dist/orchestrator/shadowComparator.d.ts +23 -23
- package/dist/orchestrator/shadowComparator.d.ts.map +1 -1
- package/dist/orchestrator/subsessions.d.ts.map +1 -1
- package/dist/orchestrator/worktreeAdapter.d.ts +12 -12
- package/dist/orchestrator/worktreeAdapter.d.ts.map +1 -1
- package/dist/orchestrator/worktreeDispatch.d.ts +34 -34
- package/dist/orchestrator/worktreeDispatch.d.ts.map +1 -1
- package/dist/orchestrator/worktreeReconciler.d.ts +37 -36
- package/dist/orchestrator/worktreeReconciler.d.ts.map +1 -1
- package/dist/plugin/availability.d.ts.map +1 -1
- package/dist/plugin/capture.d.ts +12 -12
- package/dist/plugin/capture.d.ts.map +1 -1
- package/dist/plugin/commandTool.d.ts +1 -1
- package/dist/plugin/commandTool.d.ts.map +1 -1
- package/dist/plugin/graphShadowIngress.d.ts +50 -48
- package/dist/plugin/graphShadowIngress.d.ts.map +1 -1
- package/dist/plugin/graphTool.d.ts +25 -23
- package/dist/plugin/graphTool.d.ts.map +1 -1
- package/dist/plugin/hooks.d.ts +10 -10
- package/dist/plugin/hooks.d.ts.map +1 -1
- package/dist/plugin/legacyRunProducer.d.ts +22 -22
- package/dist/plugin/legacyRunProducer.d.ts.map +1 -1
- package/dist/plugin/memoryInject.d.ts +6 -6
- package/dist/plugin/memoryInject.d.ts.map +1 -1
- package/dist/plugin/memoryTool.d.ts +36 -0
- package/dist/plugin/memoryTool.d.ts.map +1 -0
- package/dist/plugin/orchestrateTool.d.ts +35 -2
- package/dist/plugin/orchestrateTool.d.ts.map +1 -1
- package/dist/plugin/reportRunSchema.d.ts +8 -8
- package/dist/plugin/reportRunSchema.d.ts.map +1 -1
- package/dist/plugin/sessionTracker.d.ts +15 -15
- package/dist/plugin/sessionTracker.d.ts.map +1 -1
- package/dist/plugin/shadowPipeline.d.ts +2 -1
- package/dist/plugin/shadowPipeline.d.ts.map +1 -1
- package/dist/plugin/soakObserver.d.ts +18 -11
- package/dist/plugin/soakObserver.d.ts.map +1 -1
- package/dist/plugin/toolcalls.d.ts +3 -3
- package/dist/router/chooseModel.d.ts.map +1 -1
- package/dist/router/frontierBaseline.d.ts +3 -3
- package/dist/router/modelSelection.d.ts +12 -4
- package/dist/router/modelSelection.d.ts.map +1 -1
- package/dist/router/types.d.ts +6 -1
- package/dist/router/types.d.ts.map +1 -1
- package/dist/storage/graph/snapshot.d.ts.map +1 -1
- package/dist/storage/graph/soakRecorder.d.ts +14 -1
- package/dist/storage/graph/soakRecorder.d.ts.map +1 -1
- package/dist/storage/graph/workspaceLease.d.ts +1 -1
- package/dist/storage/graph/workspaceLease.d.ts.map +1 -1
- package/dist/storage/graph/worktreeRegistry.d.ts +1 -1
- package/dist/storage/graph/worktreeRegistry.d.ts.map +1 -1
- package/dist/storage/httpStorageProvider.d.ts +2 -2
- package/dist/storage/index/bunSqlite.d.ts +1 -0
- package/dist/storage/index/bunSqlite.d.ts.map +1 -1
- package/dist/storage/index/memoryConsolidate.d.ts +2 -0
- package/dist/storage/index/memoryConsolidate.d.ts.map +1 -1
- package/dist/storage/index/memoryEmbeddings.d.ts +51 -0
- package/dist/storage/index/memoryEmbeddings.d.ts.map +1 -0
- package/dist/storage/index/memoryIndex.d.ts +36 -4
- package/dist/storage/index/memoryIndex.d.ts.map +1 -1
- package/dist/storage/index/memoryRecall.d.ts +1 -1
- package/dist/storage/index/memoryRecall.d.ts.map +1 -1
- package/dist/storage/index/memoryRuntime.d.ts +2 -0
- package/dist/storage/index/memoryRuntime.d.ts.map +1 -1
- package/dist/storage/index/sqliteIndex.d.ts +18 -1
- package/dist/storage/index/sqliteIndex.d.ts.map +1 -1
- package/dist/storage/path.d.ts.map +1 -1
- package/dist/telemetry/aggregate.d.ts +12 -12
- package/dist/telemetry/aggregate.d.ts.map +1 -1
- package/dist/telemetry/cost.d.ts.map +1 -1
- package/dist/telemetry/decisions.d.ts +11 -11
- package/dist/telemetry/decisions.d.ts.map +1 -1
- package/dist/telemetry/eventLog.d.ts +41 -25
- package/dist/telemetry/eventLog.d.ts.map +1 -1
- package/dist/telemetry/events.d.ts +44 -36
- package/dist/telemetry/events.d.ts.map +1 -1
- package/dist/telemetry/fanout.d.ts +18 -0
- package/dist/telemetry/fanout.d.ts.map +1 -0
- package/dist/telemetry/graphProjection.d.ts +12 -12
- package/dist/telemetry/graphProjection.d.ts.map +1 -1
- package/dist/telemetry/graphRuntimeHealth.d.ts +26 -26
- package/dist/telemetry/graphRuntimeHealth.d.ts.map +1 -1
- package/dist/telemetry/graphView.d.ts +20 -20
- package/dist/telemetry/graphView.d.ts.map +1 -1
- package/dist/telemetry/otel.d.ts +86 -0
- package/dist/telemetry/otel.d.ts.map +1 -0
- package/dist/telemetry/otelConfig.d.ts +128 -0
- package/dist/telemetry/otelConfig.d.ts.map +1 -0
- package/dist/telemetry/otelExporter.d.ts +7 -0
- package/dist/telemetry/otelExporter.d.ts.map +1 -0
- package/dist/telemetry/read.d.ts +18 -4
- package/dist/telemetry/read.d.ts.map +1 -1
- package/dist/telemetry/types.d.ts +3 -2
- package/dist/telemetry/types.d.ts.map +1 -1
- package/dist/web/configApi.d.ts +154 -0
- package/dist/web/configApi.d.ts.map +1 -0
- package/dist/web/configRoute.d.ts +57 -0
- package/dist/web/configRoute.d.ts.map +1 -0
- package/dist/web/console.d.ts +8 -0
- package/dist/web/console.d.ts.map +1 -1
- package/dist/web/paths.d.ts +4 -3
- package/dist/web/paths.d.ts.map +1 -1
- package/dist/web/server.d.ts +30 -1
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/start.d.ts +15 -0
- package/dist/web/start.d.ts.map +1 -1
- package/dist/web/storageRoute.d.ts +2 -2
- package/package.json +13 -7
- package/dist/cli/tunnel.d.ts +0 -89
- package/dist/cli/tunnel.d.ts.map +0 -1
- package/dist/commands/orchestratorAgent.d.ts +0 -30
- package/dist/commands/orchestratorAgent.d.ts.map +0 -1
- package/dist/commands/slashCommand.d.ts +0 -39
- package/dist/commands/slashCommand.d.ts.map +0 -1
- package/dist/orchestrator/ledger.d.ts +0 -28
- package/dist/orchestrator/ledger.d.ts.map +0 -1
- package/dist/storage/graph/importLegacy.d.ts +0 -62
- package/dist/storage/graph/importLegacy.d.ts.map +0 -1
- package/dist/storage/graph/migration.d.ts +0 -91
- package/dist/storage/graph/migration.d.ts.map +0 -1
- package/dist/storage/graph/projections.d.ts +0 -31
- package/dist/storage/graph/projections.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphProjection.d.ts","sourceRoot":"","sources":["../../src/telemetry/graphProjection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhF;;;;;;;;;GASG;AAEH,
|
|
1
|
+
{"version":3,"file":"graphProjection.d.ts","sourceRoot":"","sources":["../../src/telemetry/graphProjection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhF;;;;;;;;;GASG;AAEH,oEAAoE;AACpE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,CAAC;CACH,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,oBAAoB,CAe3E"}
|
|
@@ -4,33 +4,33 @@ import type { WorktreeReconcileReport } from "../orchestrator/worktreeReconciler
|
|
|
4
4
|
import type { LeaseRecord } from "../storage/graph/workspaceLease";
|
|
5
5
|
import type { GraphViewHealth } from "./graphView";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Pure producer of graph runtime-health metrics (GE-052).
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Folds a list of journal events, the journal state, the lease, the worktree
|
|
10
|
+
* report, and the kill switch into a `GraphViewHealth` that the web viewer
|
|
11
|
+
* already consumes (GE-084) but that until now lacked a real producer.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
* - `unknownEffects`: `node.dispatched`
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* - `staleCompletions`:
|
|
18
|
-
*
|
|
19
|
-
*
|
|
13
|
+
* Semantics of each metric:
|
|
14
|
+
* - `unknownEffects`: `node.dispatched` whose `attemptID` has no terminal event
|
|
15
|
+
* (`node.succeeded`/`node.failed`/`node.cancelled`) with the same `attemptID`.
|
|
16
|
+
* Deduplicated: repeating the same event does not duplicate the count.
|
|
17
|
+
* - `staleCompletions`: node terminal event whose `attemptID` appears *after*
|
|
18
|
+
* the run terminal event (`run.completed`/`run.failed`/`run.cancelled`).
|
|
19
|
+
* Bounded as a counter for operator utility.
|
|
20
20
|
* - `recoveryRequired`: `journal === "corrupt" || unknownEffects > 0`.
|
|
21
|
-
* - `conflicts`: lease
|
|
21
|
+
* - `conflicts`: active lease not owned by self (holder ≠ input.holder) +
|
|
22
22
|
* `worktrees.blocked`.
|
|
23
|
-
* - `killSwitch`: passthrough
|
|
23
|
+
* - `killSwitch`: passthrough from config.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
* - **
|
|
27
|
-
* - **
|
|
28
|
-
*
|
|
29
|
-
* - **Reference-only**:
|
|
30
|
-
* `assertReferenceOnly`
|
|
31
|
-
* - **
|
|
25
|
+
* Invariants:
|
|
26
|
+
* - **Pure and deterministic**: no I/O, clock, random, env, or logs.
|
|
27
|
+
* - **Idempotent**: folding the same list with duplicates produces the same
|
|
28
|
+
* output.
|
|
29
|
+
* - **Reference-only**: only booleans and bounded counters; the
|
|
30
|
+
* `assertReferenceOnly` guard rejects any raw field.
|
|
31
|
+
* - **No authority**: does not decide, grant, or mutate anything.
|
|
32
32
|
*/
|
|
33
|
-
/**
|
|
33
|
+
/** Inputs for runtime-health computation. */
|
|
34
34
|
export type GraphRuntimeHealthInput = {
|
|
35
35
|
readonly events: readonly GraphEventV1[];
|
|
36
36
|
readonly journal: GraphJournalHealth;
|
|
@@ -40,14 +40,14 @@ export type GraphRuntimeHealthInput = {
|
|
|
40
40
|
readonly killSwitch: boolean;
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
43
|
+
* Shared predicate: determines whether recovery is required.
|
|
44
|
+
* Extracted so that the CLI (`renderGraphStatus`) and the web health banner
|
|
45
|
+
* share the same logic without duplication.
|
|
46
46
|
*/
|
|
47
47
|
export declare function isRecoveryRequired(journal: GraphJournalHealth, unknownEffects: number): boolean;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
49
|
+
* Computes runtime-health metrics from allow-listed sources. Idempotent and
|
|
50
|
+
* reference-only; the final guard guarantees it.
|
|
51
51
|
*/
|
|
52
52
|
export declare function computeGraphRuntimeHealth(input: GraphRuntimeHealthInput): GraphViewHealth;
|
|
53
53
|
//# sourceMappingURL=graphRuntimeHealth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphRuntimeHealth.d.ts","sourceRoot":"","sources":["../../src/telemetry/graphRuntimeHealth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,
|
|
1
|
+
{"version":3,"file":"graphRuntimeHealth.d.ts","sourceRoot":"","sources":["../../src/telemetry/graphRuntimeHealth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,6CAA6C;AAC7C,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,uBAAuB,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B,CAAC;AAgBF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,EAC3B,cAAc,EAAE,MAAM,GACrB,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,uBAAuB,GAC7B,eAAe,CAwDjB"}
|
|
@@ -2,28 +2,28 @@ import type { ErrorClass, GraphSpecV1 } from "../graph/schema";
|
|
|
2
2
|
import type { GraphState } from "../graph/types";
|
|
3
3
|
import type { GraphTelemetryRecord } from "./graphProjection";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* **Pure and reference-only** projection of the graph view (GE-081).
|
|
6
6
|
*
|
|
7
|
-
* `buildGraphView`
|
|
8
|
-
*
|
|
9
|
-
* (`errorClass`,
|
|
10
|
-
* `GraphViewProjectionV1`.
|
|
11
|
-
* `docs/adr/graph-observability-web.md`;
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
7
|
+
* `buildGraphView` folds the static spec (topology), the reduced journal state
|
|
8
|
+
* (state/attempts/artifact per node), the reference-only telemetry
|
|
9
|
+
* (`errorClass`, artifact), and runtime-health metrics into a
|
|
10
|
+
* `GraphViewProjectionV1`. Each field maps to the allow-listed source frozen by
|
|
11
|
+
* `docs/adr/graph-observability-web.md`; reviewer verdicts are **derived** from
|
|
12
|
+
* the terminal state of the reviewer node plus its `reviews` link, never stored
|
|
13
|
+
* as content. Pure and deterministic: no clock, I/O, or random. A final guard
|
|
14
|
+
* rejects any raw-content field.
|
|
15
15
|
*/
|
|
16
|
-
/**
|
|
16
|
+
/** Node state in the view: adds `ready`/`active` on top of the reduced state. */
|
|
17
17
|
export type GraphViewNodeState = "pending" | "ready" | "active" | "succeeded" | "failed" | "cancelled";
|
|
18
|
-
/**
|
|
18
|
+
/** Verdict derived from a review. */
|
|
19
19
|
export type ReviewVerdict = "approved" | "rejected" | "inconclusive";
|
|
20
|
-
/**
|
|
20
|
+
/** Reference-only artifact reference (without content). */
|
|
21
21
|
export type GraphArtifactRef = {
|
|
22
22
|
readonly uri: string;
|
|
23
23
|
readonly sha256: string;
|
|
24
24
|
readonly bytes: number;
|
|
25
25
|
};
|
|
26
|
-
/**
|
|
26
|
+
/** View of a graph node: only allow-listed and reference-only fields. */
|
|
27
27
|
export type GraphNodeView = {
|
|
28
28
|
readonly nodeID: string;
|
|
29
29
|
readonly role: string;
|
|
@@ -38,12 +38,12 @@ export type GraphNodeView = {
|
|
|
38
38
|
readonly artifact?: GraphArtifactRef;
|
|
39
39
|
readonly sessionRef?: string;
|
|
40
40
|
};
|
|
41
|
-
/**
|
|
41
|
+
/** DAG edge (dependency `from` -> `to`). */
|
|
42
42
|
export type GraphViewEdge = {
|
|
43
43
|
readonly from: string;
|
|
44
44
|
readonly to: string;
|
|
45
45
|
};
|
|
46
|
-
/**
|
|
46
|
+
/** Runtime-health metrics for the view (GE-052), bounded and without content. */
|
|
47
47
|
export type GraphViewHealth = {
|
|
48
48
|
readonly recoveryRequired: boolean;
|
|
49
49
|
readonly unknownEffects: number;
|
|
@@ -51,7 +51,7 @@ export type GraphViewHealth = {
|
|
|
51
51
|
readonly conflicts: number;
|
|
52
52
|
readonly killSwitch: boolean;
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
54
|
+
/** Versioned and reference-only projection of the complete graph view. */
|
|
55
55
|
export type GraphViewProjectionV1 = {
|
|
56
56
|
readonly version: 1;
|
|
57
57
|
readonly runID: string;
|
|
@@ -59,7 +59,7 @@ export type GraphViewProjectionV1 = {
|
|
|
59
59
|
readonly edges: readonly GraphViewEdge[];
|
|
60
60
|
readonly health: GraphViewHealth;
|
|
61
61
|
};
|
|
62
|
-
/**
|
|
62
|
+
/** Reference-only inputs to the projector: topology, state, telemetry, health. */
|
|
63
63
|
export type GraphViewInput = {
|
|
64
64
|
readonly spec: GraphSpecV1;
|
|
65
65
|
readonly state: GraphState;
|
|
@@ -68,9 +68,9 @@ export type GraphViewInput = {
|
|
|
68
68
|
readonly sessions?: Readonly<Record<string, string>>;
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
71
|
+
* Builds the reference-only projection of the graph view from its allow-listed
|
|
72
|
+
* sources. Deterministic: same inputs -> same output. The final guard ensures
|
|
73
|
+
* that no field carries raw content.
|
|
74
74
|
*/
|
|
75
75
|
export declare function buildGraphView(input: GraphViewInput): GraphViewProjectionV1;
|
|
76
76
|
//# sourceMappingURL=graphView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphView.d.ts","sourceRoot":"","sources":["../../src/telemetry/graphView.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAa,WAA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C,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACtD,CAAC;AA8FF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,qBAAqB,CAgB3E"}
|
|
@@ -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,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,GACV,sBAAsB,GAAG,IAAI,CAwB/B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB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,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"}
|
package/dist/telemetry/read.d.ts
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
import type { StorageProvider } from "../storage/provider";
|
|
2
2
|
import { type CostRecord } from "./types";
|
|
3
|
-
|
|
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:
|
|
7
|
-
* so
|
|
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):
|
|
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"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,SAAS,CAAC;AAE5D,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/telemetry/read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,SAAS,CAAC;AAE5D;iFACiF;AACjF,eAAO,MAAM,sBAAsB,6CACS,CAAC;AAE7C,0DAA0D;AAC1D,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,SAAS,2BAA2B,EAAE,CAAC;CAC7D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,GACX,2BAA2B,CAiC7B;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,2BAA2B,EACnC,MAAM,EAAE,MAAM,GACb,IAAI,CAaN;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,eAAwD,GAChE,OAAO,CAAC,UAAU,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.$
|
|
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.$
|
|
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
|
|
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"}
|