dsh-observe 0.2.27 → 0.2.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-observe",
3
- "version": "0.2.27",
3
+ "version": "0.2.29",
4
4
  "description": "OpenTelemetry and Langfuse observability exporter for DeepSeek Harness: turn/step/tool/LLM spans, token and cost metrics, and sanitized LLM prompt/completion capture from the session/event stream, with async batching, bounded offline buffering, and retry with backoff.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,10 +33,10 @@
33
33
  "CHANGELOG.md",
34
34
  "THIRD_PARTY_NOTICES.md",
35
35
  "README.md",
36
- "README-zh.md",
37
- "README-es.md",
38
- "README-pt.md",
39
- "README-hi.md",
36
+ "README.en.md",
37
+ "README.es.md",
38
+ "README.pt.md",
39
+ "README.hi.md",
40
40
  "LICENSE"
41
41
  ],
42
42
  "sideEffects": false,
@@ -122,19 +122,19 @@
122
122
  "@deepseek-ai/schemastery": "^3.18.5"
123
123
  },
124
124
  "dependencies": {
125
- "zod": "4.4.3"
125
+ "zod": "4.6.6"
126
126
  },
127
127
  "devDependencies": {
128
- "@deepseek-ai/dsh-attachment": "0.2.2-rc.1",
128
+ "@deepseek-ai/dsh-attachment": "0.2.2-rc.4",
129
129
  "@deepseek-ai/cordis": "^4.1.0",
130
130
  "@deepseek-ai/cordis-plugin-include": "^1.1.0",
131
131
  "@deepseek-ai/cordis-plugin-loader": "^1.1.0",
132
- "@deepseek-ai/dsh-llm": "0.2.2-rc.1",
133
- "@deepseek-ai/dsh-session": "0.2.2-rc.1",
134
- "@deepseek-ai/dsh-storage": "0.2.2-rc.1",
135
- "@deepseek-ai/dsh-storage-domain": "0.2.2-rc.1",
136
- "@deepseek-ai/dsh-storage-json": "0.2.2-rc.1",
137
- "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.1",
132
+ "@deepseek-ai/dsh-llm": "0.2.2-rc.4",
133
+ "@deepseek-ai/dsh-session": "0.2.2-rc.4",
134
+ "@deepseek-ai/dsh-storage": "0.2.2-rc.4",
135
+ "@deepseek-ai/dsh-storage-domain": "0.2.2-rc.4",
136
+ "@deepseek-ai/dsh-storage-json": "0.2.2-rc.4",
137
+ "@deepseek-ai/dsh-typert-protocol": "0.2.2-rc.4",
138
138
  "@deepseek-ai/schemastery": "~3.19.0",
139
139
  "@types/node": "^22.20.5",
140
140
  "@vitest/coverage-v8": "^3.2.0",
@@ -142,7 +142,7 @@
142
142
  "vitest": "^3.2.0",
143
143
  "tsdown": "^0.23.1",
144
144
  "typescript": "^5.9.0",
145
- "@deepseek-ai/dsh-package-manifest": "0.2.2-rc.1"
145
+ "@deepseek-ai/dsh-package-manifest": "0.2.2-rc.4"
146
146
  },
147
147
  "scripts": {
148
148
  "build": "node scripts/prepare.mjs",
package/src/collector.ts CHANGED
@@ -18,7 +18,7 @@ import type { EpochHeader, RequestContext, Session, SessionEvent } from '@deepse
18
18
  import type { ResolvedConfig } from './config.ts'
19
19
  import type { JsonScalar, MetricRecord, SpanRecord, TokenCounts } from './model.ts'
20
20
  import { findPrice, costUsd } from './pricing.ts'
21
- import { projectContent, projectMessage, projectToolMessage } from './project.ts'
21
+ import { projectMessage, projectReasoningContent, projectTextContent, projectToolMessage } from './project.ts'
22
22
  import { sanitizeJsonText, sanitizeText } from './sanitize.ts'
23
23
  import type { ObserveLogger } from './sinks.ts'
24
24
 
@@ -82,6 +82,14 @@ function normalizeUsage(usage: TokenUsage | undefined): TokenCounts | undefined
82
82
  output: usage.outputTokens,
83
83
  cacheRead: usage.cacheReadTokens ?? 0,
84
84
  cacheWrite: usage.cacheWriteTokens ?? 0,
85
+ // Host adapters do not fill `reasoningTokens` today: the DeepSeek Messages
86
+ // adapter maps only input/output/cache-read/cache-write from the wire usage
87
+ // (`packages/llm/llm-deepseek/src/translate.ts`, `updateUsage`), and no other
88
+ // adapter assigns it either. On those routes `gen_ai.usage.reasoning_tokens`
89
+ // and `observe.tokens{kind="reasoning"}` therefore stay 0 even though
90
+ // reasoning text is exported (as `gen_ai.completion.reasoning`). This is
91
+ // reported as the host gives it — no synthetic estimate is invented here;
92
+ // wire the field through once the adapter reports one.
85
93
  reasoning: usage.reasoningTokens ?? 0,
86
94
  }
87
95
  }
@@ -355,9 +363,22 @@ export class Collector {
355
363
  ? findPrice(this.config.pricing, provider, model)
356
364
  : undefined
357
365
  const cost = usage !== undefined && price !== undefined ? costUsd(price, usage) : undefined
366
+ // `gen_ai.completion` carries the visible answer only. Reasoning is a
367
+ // separate body: merged CoT is indistinguishable from the final answer to
368
+ // a downstream backend (which would price/display it as completion), so
369
+ // it travels as `gen_ai.completion.reasoning` under its own switch. Both
370
+ // bodies are gated by `llm.completion`; `llm.reasoning` can only narrow
371
+ // that, never widen it.
358
372
  const output = this.config.llm.completion
359
373
  ? sanitizeText(
360
- projectContent(event.data.message.content),
374
+ projectTextContent(event.data.message.content),
375
+ this.config.sanitize.truncateCompletionChars,
376
+ this.config.sanitize,
377
+ )
378
+ : undefined
379
+ const reasoning = this.config.llm.completion && this.config.llm.reasoning
380
+ ? sanitizeText(
381
+ projectReasoningContent(event.data.message.content),
361
382
  this.config.sanitize.truncateCompletionChars,
362
383
  this.config.sanitize,
363
384
  )
@@ -381,6 +402,9 @@ export class Collector {
381
402
  : { ttftMs: Math.max(0, Math.round((step.firstChunkUnixNano - start) / NANO)) }),
382
403
  ...(step.prompt === undefined ? {} : { input: step.prompt }),
383
404
  ...(output === undefined ? {} : { output }),
405
+ // Empty reasoning adds no information and would only widen the
406
+ // payload, so it is omitted instead of exported as "".
407
+ ...(reasoning === undefined || reasoning === '' ? {} : { reasoning }),
384
408
  ...(cost === undefined ? {} : { costUsd: cost }),
385
409
  },
386
410
  })
package/src/config.ts CHANGED
@@ -32,6 +32,14 @@ export interface LlmCaptureConfig {
32
32
  prompt?: boolean
33
33
  /** Capture the sanitized assistant completion. `false` records only sizes. */
34
34
  completion?: boolean
35
+ /**
36
+ * Capture the sanitized reasoning (chain-of-thought) body as a separate
37
+ * `gen_ai.completion.reasoning` value. Only effective while `completion` is
38
+ * on — `completion: false` drops both bodies. Reasoning may quote user input
39
+ * or model-visible context verbatim, so evaluate the compliance impact of
40
+ * exporting it before leaving this on.
41
+ */
42
+ reasoning?: boolean
35
43
  }
36
44
 
37
45
  /** Metadata capture switches; every one defaults to off except session identity. */
@@ -211,6 +219,7 @@ export interface ResolvedCapture {
211
219
  export interface ResolvedLlmCapture {
212
220
  readonly prompt: boolean
213
221
  readonly completion: boolean
222
+ readonly reasoning: boolean
214
223
  }
215
224
 
216
225
  /** Fully resolved metadata policy. */
@@ -323,7 +332,8 @@ export const Config: z<Config> = z.object({
323
332
  llm: z.object({
324
333
  prompt: z.boolean().default(true),
325
334
  completion: z.boolean().default(true),
326
- }).default({ prompt: true, completion: true }),
335
+ reasoning: z.boolean().default(true),
336
+ }).default({ prompt: true, completion: true, reasoning: true }),
327
337
  metadata: z.object({
328
338
  sessionId: z.boolean().default(true),
329
339
  cwd: z.boolean().default(false),
@@ -584,6 +594,7 @@ export function resolveConfig(config: Config = {}): ResolvedConfig {
584
594
  llm: {
585
595
  prompt: llmRaw.prompt ?? true,
586
596
  completion: llmRaw.completion ?? true,
597
+ reasoning: llmRaw.reasoning ?? true,
587
598
  },
588
599
  metadata: {
589
600
  sessionId: metadataRaw.sessionId ?? true,
package/src/model.ts CHANGED
@@ -40,7 +40,13 @@ export interface LlmSpanInfo {
40
40
  finishReason?: string
41
41
  ttftMs?: number
42
42
  input?: string
43
+ /** Sanitized visible answer text (`gen_ai.completion`); never contains reasoning. */
43
44
  output?: string
45
+ /**
46
+ * Sanitized chain-of-thought text, exported as `gen_ai.completion.reasoning`
47
+ * and never merged into {@link output}. Empty reasoning is omitted.
48
+ */
49
+ reasoning?: string
44
50
  costUsd?: number
45
51
  }
46
52
 
package/src/project.ts CHANGED
@@ -101,6 +101,64 @@ export function projectContent(blocks: readonly ContentBlock[]): string {
101
101
  return parts.join('\n')
102
102
  }
103
103
 
104
+ /**
105
+ * Narrow projection used by the completion export: keep only blocks of one
106
+ * text-bearing kind (`text` or `reasoning`). The retired V3 wrapper is still
107
+ * walked so a pre-upgrade log projects the same way it always did, but the
108
+ * two kinds are never merged.
109
+ * @param blocks - the model-facing content blocks.
110
+ * @param kind - the block kind to keep.
111
+ * @returns the joined text of that kind of block.
112
+ */
113
+ function projectTextBlocks(blocks: readonly ContentBlock[], kind: 'text' | 'reasoning'): string {
114
+ const parts: string[] = []
115
+ for (const block of blocks as readonly unknown[]) {
116
+ if (isRetiredToolResultWrapper(block)) {
117
+ parts.push(projectTextBlocks(block.content, kind))
118
+ continue
119
+ }
120
+ if (block === null || typeof block !== 'object') continue
121
+ const typed = block as ContentBlock
122
+ switch (typed.type) {
123
+ case 'text':
124
+ case 'reasoning':
125
+ if (typed.type === kind) parts.push(typed.text)
126
+ break
127
+ default:
128
+ break
129
+ }
130
+ }
131
+ return parts.join('\n')
132
+ }
133
+
134
+ /**
135
+ * Project the assistant's visible answer: `text` blocks only.
136
+ *
137
+ * This is the body of `gen_ai.completion`. `reasoning` blocks are deliberately
138
+ * excluded — chain-of-thought is model-internal text that can quote the user's
139
+ * input verbatim, and merging it into the completion makes it
140
+ * indistinguishable from the final answer to a downstream backend (which would
141
+ * then price and display CoT as completion output). Tool-call and image blocks
142
+ * are not answer text either; tool calls are exported through their own tool
143
+ * spans, never folded back into the completion.
144
+ * @param blocks - the model-facing content blocks.
145
+ * @returns the joined `text` blocks (possibly empty).
146
+ */
147
+ export function projectTextContent(blocks: readonly ContentBlock[]): string {
148
+ return projectTextBlocks(blocks, 'text')
149
+ }
150
+
151
+ /**
152
+ * Project the reasoning (chain-of-thought) blocks, kept separate from the
153
+ * completion. Exported only when both `llm.completion` and `llm.reasoning` are
154
+ * enabled, and never mixed into `gen_ai.completion`.
155
+ * @param blocks - the model-facing content blocks.
156
+ * @returns the joined `reasoning` blocks (possibly empty).
157
+ */
158
+ export function projectReasoningContent(blocks: readonly ContentBlock[]): string {
159
+ return projectTextBlocks(blocks, 'reasoning')
160
+ }
161
+
104
162
  /**
105
163
  * Project one message's content.
106
164
  *
package/src/sinks.ts CHANGED
@@ -126,8 +126,20 @@ function otlpSpan(span: SpanRecord): Record<string, unknown> {
126
126
  if (span.llm?.input !== undefined) {
127
127
  events.push({ name: 'gen_ai.prompt', attributes: [otlpAttribute('gen_ai.prompt', span.llm.input)] })
128
128
  }
129
- if (span.llm?.output !== undefined) {
130
- events.push({ name: 'gen_ai.completion', attributes: [otlpAttribute('gen_ai.completion', span.llm.output)] })
129
+ // The completion event carries the visible answer in `gen_ai.completion`.
130
+ // Reasoning, when released, is a sibling attribute on the same event — never
131
+ // concatenated into the completion body, so a backend can tell the final
132
+ // answer from chain-of-thought (and never prices/displays CoT as completion
133
+ // output). Both values are bounded strings (sanitize.truncateCompletionChars).
134
+ if (span.llm?.output !== undefined || span.llm?.reasoning !== undefined) {
135
+ const completion: Record<string, unknown>[] = []
136
+ if (span.llm?.output !== undefined) {
137
+ completion.push(otlpAttribute('gen_ai.completion', span.llm.output))
138
+ }
139
+ if (span.llm?.reasoning !== undefined) {
140
+ completion.push(otlpAttribute('gen_ai.completion.reasoning', span.llm.reasoning))
141
+ }
142
+ events.push({ name: 'gen_ai.completion', attributes: completion })
131
143
  }
132
144
  const error = span.status === 'error'
133
145
  return {
@@ -445,7 +457,14 @@ export class LangfuseSink implements SpanSink {
445
457
  startTime: isoTimestamp(span.startUnixNano),
446
458
  endTime: isoTimestamp(span.endUnixNano),
447
459
  ...(span.llm?.model === undefined ? {} : { model: span.llm.model }),
448
- metadata: { ...span.attributes, ...(span.llm?.costUsd === undefined ? {} : { costUsd: span.llm.costUsd }) },
460
+ // Langfuse's generation `output` means the final answer, so it stays
461
+ // text-only. Chain-of-thought rides in metadata under the same attribute
462
+ // name the OTLP event uses, keeping it visible but distinguishable.
463
+ metadata: {
464
+ ...span.attributes,
465
+ ...(span.llm?.costUsd === undefined ? {} : { costUsd: span.llm.costUsd }),
466
+ ...(span.llm?.reasoning === undefined ? {} : { 'gen_ai.completion.reasoning': span.llm.reasoning }),
467
+ },
449
468
  ...(span.llm?.input === undefined ? {} : { input: span.llm.input }),
450
469
  ...(span.llm?.output === undefined ? {} : { output: span.llm.output }),
451
470
  ...(usage === undefined ? {} : {
package/src/version.ts CHANGED
@@ -7,4 +7,4 @@
7
7
  */
8
8
 
9
9
  /** The dsh-observe package version, kept in sync with package.json. */
10
- export const VERSION = '0.2.27'
10
+ export const VERSION = '0.2.29'
package/README-es.md DELETED
@@ -1,354 +0,0 @@
1
- <div align="center">
2
-
3
- # 📊 dsh-observe
4
- - **Canal 1024 store**: `npm i -g dsh1024` una vez, luego `dsh1024 plugin --profile web add dsh-observe` (cuenta para el ranking de instalaciones de [deepseek1024.com](https://deepseek1024.com)).
5
-
6
- **Exportador de observabilidad OpenTelemetry y Langfuse para DeepSeek Harness.**
7
-
8
- *Convierte los eventos de sesión en trazas OTLP y observaciones de Langfuse — saneado, con buffer y apagado por defecto.*
9
-
10
- [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
11
- [![Gitee](https://img.shields.io/badge/Gitee-mirror-c71d23?logo=gitee)](https://gitee.com/perrylink/dsh-observe)
12
- [![DSH plugin](https://img.shields.io/badge/dsh--plugin-✅-green)](https://github.com/topics/dsh-plugin)
13
- [![dsh-doctor](https://raw.githubusercontent.com/PerryLink/dsh-plugin-doctor/main/badges/PerryLink__dsh-observe.svg)](https://github.com/PerryLink/dsh-plugin-doctor#verified-徽章)
14
- [![DSH Market](https://raw.githubusercontent.com/2BingLing/dsh-market/master/assets/readme/badge-listed-en.svg)](https://dsh.market/)
15
- [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)
16
- [![CI](https://img.shields.io/github/actions/workflow/status/PerryLink/dsh-observe/ci.yml?branch=main&label=CI)](https://github.com/PerryLink/dsh-observe/actions)
17
- [![Version](https://img.shields.io/github/v/tag/PerryLink/dsh-observe?label=version)](https://github.com/PerryLink/dsh-observe/releases)
18
- [![npm version](https://img.shields.io/npm/v/dsh-observe)](https://www.npmjs.com/package/dsh-observe)
19
- [![npm downloads](https://img.shields.io/npm/dm/dsh-observe)](https://www.npmjs.com/package/dsh-observe)
20
- [![dshfind](https://dshfind.com/api/badge/PerryLink/dsh-observe?metric=downloads&lang=es)](https://dshfind.com/es/plugins/PerryLink/dsh-observe?ref=badge)
21
-
22
- [English](README.md) · [简体中文](README-zh.md) · [Español](README-es.md) · [Português](README-pt.md) · [हिन्दी](README-hi.md)
23
-
24
- ```sh
25
- dsh plugin --profile <name> add dsh-observe
26
- ```
27
-
28
-
29
- </div>
30
-
31
- ---
32
-
33
-
34
- **📖 Base de conocimiento del ecosistema** — datos medidos, no marketing: [guía de desarrollo · datos de selección · criterios de mantenimiento](https://perrylink.github.io/dsh-plugin-guide/).
35
-
36
- <!-- star-cta -->
37
- ## Install & uninstall
38
-
39
- - **Canal git** (último `main`): `dsh plugin --profile web add github:PerryLink/dsh-observe` — el script `prepare` compila solo con dependencias de producción.
40
- - **Canal npm** (versiones publicadas): `dsh plugin --profile web add dsh-observe`.
41
- - **Canal tarball**: `pnpm pack` en este repositorio y luego `dsh plugin --profile web add ./dsh-observe-<version>.tgz`.
42
- - **Desinstalar**: `dsh plugin --profile web remove dsh-observe` (o elimina la fila del parche del perfil).
43
-
44
- > Si pnpm informa `ERR_PNPM_IGNORED_BUILDS` para este paquete (la validación inofensiva del binario de plataforma de esbuild), añade `allowBuilds: { esbuild: true }` a tu `pnpm-workspace.yaml` — el CLI `dsh` imprime el fragmento exacto.
45
-
46
- ## ⭐ 如果它帮到了你
47
-
48
- Este plugin forma parte de la [familia de plugins DSH](https://github.com/PerryLink) (más de 40, todos Apache-2.0). Si te resulta útil, **dale una estrella**: no desbloquea nada, pero ayuda a que la siguiente persona lo encuentre antes.
49
-
50
- *English:* part of a 95 plugin family for DeepSeek Harness. If it is useful, **a star helps the next person find it** — nothing is gated behind it.
51
-
52
- ## What is dsh-observe?
53
-
54
- Exportador de observabilidad OpenTelemetry y Langfuse para DeepSeek Harness.
55
-
56
- Convierte los eventos de sesión en trazas OTLP y observaciones de Langfuse — saneado, con buffer y apagado por defecto.
57
-
58
- ![Diagrama de flujo de dsh-observe: instalar → abrir panel → actuar.](docs/assets/dsh-observe-flow.svg)
59
-
60
- *Resumen del flujo: instalar → abrir panel → actuar. Los ejemplos siguientes usan la superficie de comandos real.*
61
-
62
-
63
- *La misma ejecución, animada.*
64
-
65
- ## Compatibility
66
-
67
- | Superficie | Estado |
68
- |---|---|
69
- | Harness | DeepSeek Harness `dsh-v0.2.1-alpha.1` (adaptado el 2026-10-04): el formato de sesión V4 representa el resultado de una herramienta como un mensaje de primera clase `role: 'tool'` con `toolCallId` + `content` + `isError` opcional en el nivel superior — el bloque de contenido `tool-result` de V3 ya no está en el `ContentBlockMap` del host, y este plugin solo lee la forma V4 (un log V3 anterior a la actualización todavía se proyecta mediante una ruta de compatibilidad de solo lectura). Los demás rasgos del formato de sesión V3 se mantienen: el flujo del asistente se incorpora en `assistant/message` / `assistant/attempt` y el prompt de sistema es el nodo 0 de la superficie (`system/message`); el plugin consume solo el flujo de eventos en vivo y nunca lee archivos de log de sesión. El rango de peers `>=0.1.2-rc.1 <0.2.0 \|\| >=0.1.5-alpha.1 <0.2.0 \|\| >=0.1.6-0 <0.2.0 \|\| >=0.1.7-0 <0.2.0` mantiene instalable cada línea publicada (cadena completa de puertas local; el workflow compat cubre el smoke de instalación de perfil). |
70
- | Node | `^22.19.0 \|\| >=24.0.0` |
71
- | Backends | OpenTelemetry OTLP/HTTP (traces + metrics, codificación JSON) y Langfuse (observabilidad de LLM) — uno o ambos |
72
- | Modelo | Independiente del modelo: exporta el flujo `session/event`; no realiza llamadas a modelos |
73
-
74
- ## What you get
75
-
76
- `dsh-observe` convierte el flujo `session/event` del harness en protocolos estándar de observabilidad:
77
-
78
- - **Spans** — spans de turno, paso, llamada a herramienta (duración, estado, derivación de reintentos) y generación de LLM, enlazados en trazas por turno con ids deterministas.
79
- - **Metrics** — contadores de tokens por provider/modelo, contadores de coste en USD (tabla de precios configurable) y el gauge opcional de presión de contexto desde `ctx.tokenMeter`.
80
- - **Captura saneada** — los cuerpos de prompt y completion se redactan (nombres de clave estructurales + patrones de secretos integrados + tus patrones) y se truncan antes de encolar o enviar nada.
81
- - **Fiabilidad** — lotes asíncronos (por tamaño y por temporizador), un buffer offline duradero y acotado (storage-domain) con desalojo del más antiguo, y reintentos con backoff exponencial determinista; los lotes no entregados sobreviven a reinicios.
82
- - **Interruptor en tiempo de ejecución** — el Typert remote opcional (`observe/status`, `observe/setEnabled`) permite a una página de ajustes detener y reanudar la exportación sin desmontar.
83
- - **Apagado por defecto** — `enabled: true` más al menos un backend es la adhesión explícita; de lo contrario no se captura ni se exporta nada.
84
-
85
- ```text
86
- flujo session/event
87
- │ collector (spans de turno/paso/herramienta/LLM, métricas)
88
- │ sanitize (claves, secretos, presupuestos)
89
- ├──▶ pipeline "otlp" ── cola ── flush ──▶ OTLP /v1/traces + /v1/metrics
90
- │ └─ reintento/backoff ─┐
91
- ├──▶ pipeline "langfuse" ── cola ── flush ──▶ ingesta de Langfuse
92
- │ └─ reintento/backoff ─┤
93
- └────────── spool duradero (buffer offline, acotado) ◀┘
94
- ```
95
-
96
- ## Quick start
97
-
98
- ```sh
99
- dsh plugin --profile web add github:PerryLink/dsh-observe
100
- ```
101
-
102
- ```sh
103
- # 1. instala el bundle en tu perfil
104
- dsh plugin --profile web add github:PerryLink/dsh-observe
105
-
106
- # o desde npm (versiones publicadas)
107
- dsh plugin --profile web add dsh-observe
108
-
109
- # 2. configura un backend en el parche de tu perfil (cordis.yml) y reinicia
110
- dsh --profile web
111
- ```
112
-
113
- Configuración OTLP mínima (la fila viene comentada en `cordis.patch.yml`):
114
-
115
- ```yaml
116
- - insert:
117
- - id: dsh-observe
118
- name: dsh-observe
119
- config:
120
- enabled: true
121
- otlp:
122
- endpoint: http://localhost:4318
123
- ```
124
-
125
- Luego verifica que la fila monta:
126
-
127
- ```sh
128
- dsh --profile web --dump-config | grep -A2 'id: dsh-observe'
129
- ```
130
-
131
- ### Ejemplos
132
-
133
- Este plugin no registra un comando visible; se ejecuta como exportador en segundo plano, configurado desde sus ajustes.
134
-
135
- ## Configuration
136
-
137
- Todos los ajustes son campos `Config` de Schemastery (modificables desde cordis.yml). Una sobrescritura dirigida por id reemplaza toda la fila — vuelve a declarar cada clave que necesites. `cordis.patch.yml` documenta cada clave en línea.
138
-
139
- | Key | Default | Meaning |
140
- |---|---|---|
141
- | `enabled` | `false` | Interruptor maestro; `true` más al menos un backend es la adhesión explícita |
142
- | `otlp` | `null` | Configuración del backend OTLP, o `null` para desactivarlo |
143
- | `otlp.endpoint` | *(obligatorio)* | URL base de OTLP; `/v1/traces` y `/v1/metrics` se añaden |
144
- | `otlp.serviceName` | `deepseek-harness` | Atributo de recurso `service.name` |
145
- | `otlp.serviceVersion` | *(ninguno)* | Atributo de recurso `service.version` |
146
- | `otlp.headers` | `{}` | Cabeceras extra fusionadas en cada petición de exportación |
147
- | `otlp.timeoutMs` | `10000` | Tiempo de espera por petición |
148
- | `langfuse` | `null` | Configuración del backend Langfuse, o `null` para desactivarlo |
149
- | `langfuse.baseUrl` | `https://cloud.langfuse.com` | URL base de Langfuse |
150
- | `langfuse.publicKey` | *(obligatorio)* | Clave pública del proyecto |
151
- | `langfuse.secretKey` | *(obligatorio)* | Clave secreta del proyecto |
152
- | `langfuse.release` | *(ninguno)* | Etiqueta release estampada en las trazas |
153
- | `langfuse.traceName` | `session {session} turn {turn}` | Plantilla del nombre de traza; `{session}`/`{turn}` se interpolan por traza |
154
- | `langfuse.tags` | `[]` | Etiquetas estáticas estampadas en cada traza |
155
- | `langfuse.timeoutMs` | `10000` | Tiempo de espera por petición |
156
- | `capture.turns` | `true` | Spans de ciclo de vida del turno |
157
- | `capture.steps` | `true` | Spans de ciclo de vida del paso |
158
- | `capture.tools` | `true` | Spans de llamada a herramienta con argumentos/resultados saneados |
159
- | `capture.llm` | `true` | Spans de generación de LLM |
160
- | `llm.prompt` | `true` | Captura el prompt de petición saneado (`false` = solo tamaños) |
161
- | `llm.completion` | `true` | Captura la completion saneada (`false` = solo tamaños) |
162
- | `metadata.sessionId` | `true` | Atributo de id de sesión |
163
- | `metadata.cwd` | `false` | Directorio de trabajo de la sesión (una ruta local — apagado por defecto) |
164
- | `metadata.agentPreset` | `true` | Atributo de id del agent preset |
165
- | `metadata.model` | `true` | Atributos de provider/modelo |
166
- | `metrics.tokens` | `true` | Contadores de tokens por provider/modelo |
167
- | `metrics.cost` | `true` | Contadores de coste en USD (necesitan reglas `pricing` que coincidan) |
168
- | `metrics.contextTokens` | `true` | Gauge de presión de contexto (necesita `ctx.tokenMeter`) |
169
- | `pricing` | `[]` | Tabla de precios, primera coincidencia gana: `{ provider?, model, inputPerToken, outputPerToken, cacheReadPerToken?, cacheWritePerToken? }` |
170
- | `sanitize.enabled` | `true` | Interruptor maestro de redacción (`false` desactiva la redacción, nunca el truncado) |
171
- | `sanitize.redactKeys` | `[]` | Subcadenas de nombre de clave extra (key/token/secret/password/authorization/credential/apiKey siempre se incluyen) |
172
- | `sanitize.redactPatterns` | `[]` | Expresiones regulares de secretos extra |
173
- | `sanitize.truncatePromptChars` | `4000` | Presupuesto de caracteres del prompt |
174
- | `sanitize.truncateCompletionChars` | `4000` | Presupuesto de caracteres de la completion |
175
- | `sanitize.truncateToolInputChars` | `2000` | Presupuesto de caracteres de los argumentos de herramienta |
176
- | `sanitize.truncateToolOutputChars` | `2000` | Presupuesto de caracteres del resultado de herramienta |
177
- | `sanitize.truncateAttributeChars` | `512` | Presupuesto de cadenas de atributos de span |
178
- | `batch.maxRecords` | `256` | Flush cuando la cola alcanza este número de registros |
179
- | `batch.flushIntervalMs` | `5000` | Intervalo de flush por temporizador |
180
- | `batch.maxQueueRecords` | `2000` | Límite de la cola en memoria; el exceso se derrama al buffer |
181
- | `batch.maxBufferRecords` | `10000` | Límite del buffer offline duradero; los registros más antiguos caen primero |
182
- | `batch.bufferRetryIntervalMs` | `30000` | Intervalo de reintento del buffer offline |
183
- | `retry.maxAttempts` | `5` | Intentos por lote, incluido el primero |
184
- | `retry.baseDelayMs` | `1000` | Primer retardo de backoff |
185
- | `retry.factor` | `2` | Multiplicador de backoff por fallo consecutivo |
186
- | `retry.maxDelayMs` | `60000` | Techo de backoff |
187
- | `remote.enabled` | `false` | Monta el Typert remote `observe` (interruptor) |
188
-
189
- ## Tools & surfaces
190
-
191
- Este plugin **no registra herramientas de modelo** — es un exportador en segundo plano. Sus superficies:
192
-
193
- - **Consume** `session/event` (recolección de spans/métricas), `session/flush` (impulso de exportación best-effort — el checkpoint de durabilidad nunca espera a un backend remoto) y `session/disposed`.
194
- - **Servicio remote opcional** `observe` — `observe/status` devuelve el estado del interruptor, los backends configurados, la profundidad de cola y la ocupación del buffer; `observe/setEnabled` detiene y reanuda la exportación en tiempo de ejecución.
195
-
196
- ## Permissions & data
197
-
198
- - **Permisos**: `network:outbound` hacia los endpoints que configures, `session:read` para el flujo de eventos, `storage:write` para el buffer offline; sin código nativo, sin acceso al sistema de archivos.
199
- - **Datos**: todo lo enviado se deriva del registro de sesión y se sanea (redacción + truncado) antes de encolarse, almacenarse o transmitirse. El buffer offline solo guarda registros saneados, re-validados al leerlos.
200
- - **Credenciales**: las claves pública/secreta de Langfuse viajan solo al endpoint de Langfuse configurado; las cabeceras OTLP solo al endpoint OTLP configurado. El plugin no almacena credenciales — guárdalas en referencias de credenciales o valores inyectados por entorno.
201
-
202
- ## Security boundaries
203
-
204
- - **Apagado por defecto** — nada se captura ni se exporta salvo adhesión explícita.
205
- - **Sanear antes de enviar** — redacción estructural de claves, patrones de secretos integrados (claves de API, tokens de GitHub, claves de AWS, credenciales bearer, claves privadas), tus patrones y presupuestos de caracteres se aplican antes de que un registro salga de memoria.
206
- - **Re-validación en el límite duradero** — los registros leídos del almacenamiento se comprueban de nuevo antes de que un sink pueda verlos.
207
- - **Fallo ruidoso, fallo contenido** — los fallos de exportación avisan, cuentan, reintentan y finalmente se guardan en el spool; un manejador de sesión que falla se captura y registra, de modo que la observabilidad nunca puede romper la ruta caliente del harness.
208
- - **Model-visible ⟺ logged** — las exportaciones de prompt/completion proyectan solo la superficie de sesión (cuyo nodo 0 es el prompt de sistema) y la cabecera registrada (configuración de llamada y herramientas); el exportador no inventa contenido.
209
-
210
- ## Known limitations
211
-
212
- - **npm 0.1.7-rc.2** — el plugin se desarrolla y prueba contra `@deepseek-ai/dsh@0.1.7-rc.2` (devDeps y la regla primaria de CI); el rango de peers `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0 || >=0.1.6-0 <0.2.0 || >=0.1.7-0 <0.2.0` mantiene instalable cada línea publicada, y la segunda regla (`typecheck:ci`) más el workflow compat cubren los baselines antiguos.
213
- - **Los eventos de auditoría no se persisten** — los registros `observe/*` del propio exportador son solo de auditoría: en la línea de host actual la puerta de append de sesión admite eventos de superficie, así que ningún evento `observe/*` se escribe en el log de sesión, y el plugin no lo falsifica con un append sin marcar (eso volvería ilegibles las sesiones). Usa la salida de estado de `/observe` y los backends OTLP/Langfuse como superficie de auditoría.
214
- - **Las métricas evitan la ruta de reintento/spool** — las métricas OTLP se agregan de forma acumulativa, así que un flush perdido se autocura en el siguiente (por diseño, no es un fallo).
215
- - **Sin muestreo** — toda familia de spans habilitada se exporta; ajusta los interruptores `capture.*` y `batch.maxBufferRecords` para sesiones de alto volumen.
216
-
217
- ## Development
218
-
219
- ```sh
220
- pnpm install # node ^22.19 || >=24
221
- pnpm run typecheck # tsc: src + tests contra los devDeps 0.1.7-rc.2 (sin tsconfig paths)
222
- pnpm run typecheck:ci # tsc contra la línea publicada (sin paths)
223
- pnpm run check:ruler-live # canario: debe fallar al compilar, probando que la regla sigue viva
224
- pnpm test # vitest: 126 tests, 18 suites (Context/Session/storage seam reales)
225
- pnpm run test:coverage # puerta de cobertura (90/80/90/90)
226
- pnpm run build # bundle tsdown + declaraciones tsc (lib/)
227
- pnpm run verify:self-contained # las especificaciones de dependencias resuelven desde el registry
228
- pnpm run verify:artifacts # cara ESM construida + bundle patch presentes
229
- node scripts/check-readme-sync.mjs # puerta de sincronía de los cinco READMEs
230
- pnpm pack # el tarball publicado
231
- ```
232
-
233
- ## Topics
234
-
235
- `dsh`, `dsh-plugin`, `deepseek-harness`, `deepseek`, `cordis`, `observability`, `opentelemetry`, `otlp`, `langfuse`, `tracing`
236
-
237
- ## Contributors
238
-
239
- - [@PerryLink](https://github.com/PerryLink) — creador y mantenedor: collector, pipelines, spool, sinks OTLP/Langfuse, saneamiento y la documentación en cinco idiomas.
240
-
241
- ## PerryLink DSH Plugin Family
242
-
243
- Este proyecto forma parte de la familia de plugins de DeepSeek Harness de [PerryLink](https://github.com/PerryLink). El registro permanece plegado abajo para que cada README conserve una primera pantalla corta; expándelo para ver cada fila y su estado.
244
-
245
- <details>
246
- <summary>Expandir todos los plugins</summary>
247
-
248
- | Plugin | Estado |
249
- |---|---|
250
- | **[dsh-aqua-input-check](https://github.com/PerryLink/dsh-aqua-input-check)** | |
251
- | **[dsh-archive-check](https://github.com/PerryLink/dsh-archive-check)** | |
252
- | **[dsh-auto-review](https://github.com/PerryLink/dsh-auto-review)** | |
253
- | **[dsh-autotier](https://github.com/PerryLink/dsh-autotier)** | |
254
- | **[dsh-bid-ca-precheck](https://github.com/PerryLink/dsh-bid-ca-precheck)** | |
255
- | **[dsh-bid-qual-check](https://github.com/PerryLink/dsh-bid-qual-check)** | |
256
- | **[dsh-cert-mcp](https://github.com/PerryLink/dsh-cert-mcp)** | |
257
- | **[dsh-checkpoint-rewind](https://github.com/PerryLink/dsh-checkpoint-rewind)** | |
258
- | **[dsh-click](https://github.com/PerryLink/dsh-click)** | |
259
- | **[dsh-composer-history](https://github.com/PerryLink/dsh-composer-history)** | |
260
- | **[dsh-contract-stance](https://github.com/PerryLink/dsh-contract-stance)** | |
261
- | **[dsh-customs-doc-check](https://github.com/PerryLink/dsh-customs-doc-check)** | |
262
- | **[dsh-data-quality](https://github.com/PerryLink/dsh-data-quality)** | |
263
- | **[dsh-demurrage-ledger](https://github.com/PerryLink/dsh-demurrage-ledger)** | |
264
- | **[dsh-doublecheck](https://github.com/PerryLink/dsh-doublecheck)** | |
265
- | **[dsh-drill-script-check](https://github.com/PerryLink/dsh-drill-script-check)** | |
266
- | **[dsh-eia-guide-check](https://github.com/PerryLink/dsh-eia-guide-check)** | |
267
- | **[dsh-emergency-plan](https://github.com/PerryLink/dsh-emergency-plan)** | |
268
- | **[dsh-essay-rubric-check](https://github.com/PerryLink/dsh-essay-rubric-check)** | |
269
- | **[dsh-evidence-check](https://github.com/PerryLink/dsh-evidence-check)** | |
270
- | **[dsh-export-ctl-check](https://github.com/PerryLink/dsh-export-ctl-check)** | |
271
- | **[dsh-fast](https://github.com/PerryLink/dsh-fast)** | |
272
- | **[dsh-fmea-table-check](https://github.com/PerryLink/dsh-fmea-table-check)** | |
273
- | **[dsh-forecast-penalty](https://github.com/PerryLink/dsh-forecast-penalty)** | |
274
- | **[dsh-fund-research](https://github.com/PerryLink/dsh-fund-research)** | |
275
- | **[dsh-github](https://github.com/PerryLink/dsh-github)** | |
276
- | **[dsh-gongwen-flow-check](https://github.com/PerryLink/dsh-gongwen-flow-check)** | |
277
- | **[dsh-gongwen-word-check](https://github.com/PerryLink/dsh-gongwen-word-check)** | |
278
- | **[dsh-guard-plan-qc](https://github.com/PerryLink/dsh-guard-plan-qc)** | |
279
- | **[dsh-hazchem-check](https://github.com/PerryLink/dsh-hazchem-check)** | |
280
- | **[dsh-hazplan-check](https://github.com/PerryLink/dsh-hazplan-check)** | |
281
- | **[dsh-hidden-risk-map](https://github.com/PerryLink/dsh-hidden-risk-map)** | |
282
- | **[dsh-hs-classify](https://github.com/PerryLink/dsh-hs-classify)** | |
283
- | **[dsh-icd-rule-check](https://github.com/PerryLink/dsh-icd-rule-check)** | |
284
- | **[dsh-industry-research](https://github.com/PerryLink/dsh-industry-research)** | |
285
- | **[dsh-lawcite-adapter](https://github.com/PerryLink/dsh-lawcite-adapter)** | |
286
- | **[dsh-laya](https://github.com/PerryLink/dsh-laya)** | |
287
- | **[dsh-lc-doc-check](https://github.com/PerryLink/dsh-lc-doc-check)** | |
288
- | **[dsh-learning-gap-check](https://github.com/PerryLink/dsh-learning-gap-check)** | |
289
- | **[dsh-library](https://github.com/PerryLink/dsh-library)** | |
290
- | **[dsh-local-ai](https://github.com/PerryLink/dsh-local-ai)** | |
291
- | **[dsh-lsp-actions](https://github.com/PerryLink/dsh-lsp-actions)** | |
292
- | **[dsh-mask](https://github.com/PerryLink/dsh-mask)** | |
293
- | **[dsh-mcp-panel](https://github.com/PerryLink/dsh-mcp-panel)** | |
294
- | **[dsh-medrec-qc](https://github.com/PerryLink/dsh-medrec-qc)** | |
295
- | **[dsh-memento](https://github.com/PerryLink/dsh-memento)** | |
296
- | **[dsh-nsfc-form-check](https://github.com/PerryLink/dsh-nsfc-form-check)** | |
297
- | **[dsh-nurse-record-check](https://github.com/PerryLink/dsh-nurse-record-check)** | |
298
- | **[dsh-observe](https://github.com/PerryLink/dsh-observe)** | |
299
- | **[dsh-origin-rvc-check](https://github.com/PerryLink/dsh-origin-rvc-check)** | |
300
- | **[dsh-ota-review-check](https://github.com/PerryLink/dsh-ota-review-check)** | |
301
- | **[dsh-output-styles](https://github.com/PerryLink/dsh-output-styles)** | |
302
- | **[dsh-paper-doc-adapter](https://github.com/PerryLink/dsh-paper-doc-adapter)** | |
303
- | **[dsh-permission-rules](https://github.com/PerryLink/dsh-permission-rules)** | |
304
- | **[dsh-permit-report-check](https://github.com/PerryLink/dsh-permit-report-check)** | |
305
- | **[dsh-pipeline-check](https://github.com/PerryLink/dsh-pipeline-check)** | |
306
- | **[dsh-pleading-draft](https://github.com/PerryLink/dsh-pleading-draft)** | |
307
- | **[dsh-plugin-doctor](https://github.com/PerryLink/dsh-plugin-doctor)** | |
308
- | **[dsh-plugin-guide](https://github.com/PerryLink/dsh-plugin-guide)** | |
309
- | **[dsh-plugin-kit](https://github.com/PerryLink/dsh-plugin-kit)** | |
310
- | **[dsh-plugin-upgrade](https://github.com/PerryLink/dsh-plugin-upgrade)** | |
311
- | **[dsh-policy-brief-draft](https://github.com/PerryLink/dsh-policy-brief-draft)** | |
312
- | **[dsh-power-loss-split](https://github.com/PerryLink/dsh-power-loss-split)** | |
313
- | **[dsh-power-ticket-check](https://github.com/PerryLink/dsh-power-ticket-check)** | |
314
- | **[dsh-ppap-check](https://github.com/PerryLink/dsh-ppap-check)** | |
315
- | **[dsh-protest-deadline](https://github.com/PerryLink/dsh-protest-deadline)** | |
316
- | **[dsh-railway-window](https://github.com/PerryLink/dsh-railway-window)** | |
317
- | **[dsh-repair-order-qc](https://github.com/PerryLink/dsh-repair-order-qc)** | |
318
- | **[dsh-research-report](https://github.com/PerryLink/dsh-research-report)** | |
319
- | **[dsh-review-reply-check](https://github.com/PerryLink/dsh-review-reply-check)** | |
320
- | **[dsh-rulefile-check](https://github.com/PerryLink/dsh-rulefile-check)** | |
321
- | **[dsh-safety-brief-check](https://github.com/PerryLink/dsh-safety-brief-check)** | |
322
- | **[dsh-score](https://github.com/PerryLink/dsh-score)** | |
323
- | **[dsh-session-sync](https://github.com/PerryLink/dsh-session-sync)** | |
324
- | **[dsh-site-log-check](https://github.com/PerryLink/dsh-site-log-check)** | |
325
- | **[dsh-skill-pack-security](https://github.com/PerryLink/dsh-skill-pack-security)** | |
326
- | **[dsh-soe-decision-check](https://github.com/PerryLink/dsh-soe-decision-check)** | |
327
- | **[dsh-soilwater-check](https://github.com/PerryLink/dsh-soilwater-check)** | |
328
- | **[dsh-sop-sync-check](https://github.com/PerryLink/dsh-sop-sync-check)** | |
329
- | **[dsh-spc-gbt-adapter](https://github.com/PerryLink/dsh-spc-gbt-adapter)** | |
330
- | **[dsh-talk](https://github.com/PerryLink/dsh-talk)** | |
331
- | **[dsh-tender-extract](https://github.com/PerryLink/dsh-tender-extract)** | |
332
- | **[dsh-tender-matrix](https://github.com/PerryLink/dsh-tender-matrix)** | |
333
- | **[dsh-test-drive](https://github.com/PerryLink/dsh-test-drive)** | |
334
- | **[dsh-ticktick](https://github.com/PerryLink/dsh-ticktick)** | |
335
- | **[dsh-translate](https://github.com/PerryLink/dsh-translate)** | |
336
- | **[dsh-warranty-calc](https://github.com/PerryLink/dsh-warranty-calc)** | |
337
- | **[dsh-budget](https://github.com/PerryLink/dsh-budget)** | 🧊 CONGELADO — ver el README del repositorio |
338
- | **[dsh-claude-move](https://github.com/PerryLink/dsh-claude-move)** | 🧊 CONGELADO — ver el README del repositorio |
339
- | **[dsh-defend](https://github.com/PerryLink/dsh-defend)** | 🧊 CONGELADO — ver el README del repositorio |
340
- | **[dsh-draw](https://github.com/PerryLink/dsh-draw)** | 🧊 CONGELADO — ver el README del repositorio |
341
- | **[dsh-reach](https://github.com/PerryLink/dsh-reach)** | 🧊 CONGELADO — ver el README del repositorio |
342
- | **[dsh-background-agents](https://github.com/PerryLink/dsh-background-agents)** | 🚫 RETIRADO — ver el README del repositorio |
343
- | **[dsh-session-pin](https://github.com/PerryLink/dsh-session-pin)** | 🚫 RETIRADO — ver el README del repositorio |
344
- | **[dsh-team-rooms](https://github.com/PerryLink/dsh-team-rooms)** | 🚫 RETIRADO — ver el README del repositorio |
345
-
346
- </details>
347
-
348
- ## License
349
-
350
- [Apache License 2.0](LICENSE) © 2026 dsh-observe contributors
351
-
352
- ### Instalar desde el mercado de DSH Desktop
353
-
354
- Todos los plugins de PerryLink pueden explorarse en el mercado integrado de DSH Desktop: **Market → Sources → add source → pegar** `https://perrylink-dsh-catalog.perrylink.workers.dev/catalog-source.json` **→ seleccionarlo**. La instalación sigue pasando por la verificación de identidad npm del mercado y tu confirmación.