@amaster.ai/dsh-langfuse 0.1.0 → 0.1.2

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/lib/client.js CHANGED
@@ -46,7 +46,7 @@ const NO_PARENT = { traceId: '0'.repeat(32), spanId: '0'.repeat(16), traceFlags:
46
46
  * `input_*`, `output` excludes `output_*`, `total` is the bucket sum —
47
47
  * overlapping buckets double-count usage and inferred cost). dsh reports
48
48
  * uncached input, separate cache buckets, and provider-style output that
49
- * INCLUDES reasoning (verified in dsh-llm-deepseek@0.1.0-rc.7:
49
+ * INCLUDES reasoning (verified in dsh-llm-deepseek@0.1.5-rc.1:
50
50
  * `outputTokens: usage.completion_tokens`, with reasoning split out of
51
51
  * `completion_tokens_details`), so the `output` bucket subtracts
52
52
  * `reasoningTokens` into `output_reasoning`. Only `usageDetails` is sent.
package/lib/index.js CHANGED
@@ -23,12 +23,11 @@
23
23
  * `subagent/descriptor` event).
24
24
  *
25
25
  * Event/waterfall shapes verified against the installed
26
- * @deepseek-ai/dsh-{llm,session,tools,agent,subagent}@0.1.0-rc.7 package sources
26
+ * @deepseek-ai/dsh-{llm,session,tools,agent,subagent}@0.1.5-rc.1 package sources
27
27
  * (types for shapes; `lib/*.js` for the session/created ordering claim).
28
28
  *
29
29
  * @module dsh-langfuse
30
30
  */
31
- import { isTokenDelta } from '@deepseek-ai/dsh-llm/message';
32
31
  import Schema from '@deepseek-ai/schemastery';
33
32
  import { LangfuseReporter } from './client.js';
34
33
  export const name = 'dsh-langfuse';
@@ -55,6 +54,13 @@ const messageOf = (error) => error instanceof Error ? error.message : String(err
55
54
  * facts (levels, kinds, error codes) always do.
56
55
  */
57
56
  const contentMessage = (config, text) => config.captureContent ? text : undefined;
57
+ // dsh-llm ≤0.1.0 exported this shared predicate from './message'; 0.1.2
58
+ // removed it without a replacement (0.1.3 keeps per-package private copies),
59
+ // so the TTFT rule lives here: the first real token is a non-empty
60
+ // text/reasoning delta or a tool-call delta with content — block boundaries,
61
+ // usage frames and empty heartbeat deltas are not completions.
62
+ const isTokenDelta = (chunk) => ((chunk.type === 'text-delta' || chunk.type === 'reasoning-delta') && chunk.text !== '') ||
63
+ (chunk.type === 'tool-call-delta' && (chunk.argumentsDelta !== '' || chunk.name !== undefined));
58
64
  /** Trace input/output text: the message's text blocks, joined. */
59
65
  function messageText(message) {
60
66
  const text = message.content.flatMap((block) => (block.type === 'text' ? [block.text] : []));
@@ -73,7 +79,11 @@ function modelParametersOf(options, captureContent) {
73
79
  stop: captureContent && options.stop ? JSON.stringify(options.stop) : undefined,
74
80
  stopCount: captureContent ? undefined : options.stop?.length,
75
81
  reasoningEffort: options.reasoningEffort,
76
- }).filter(([, value]) => value !== undefined));
82
+ // Narrowing predicate: drops the undefined-valued keys for the type
83
+ // checker too (dsh-llm ≥0.1.2 resolves its branded ids for real —
84
+ // dsh-brand became a runtime dependency — so the unfiltered union no
85
+ // longer collapses to any).
86
+ }).filter((entry) => entry[1] !== undefined));
77
87
  return Object.keys(params).length > 0 ? params : undefined;
78
88
  }
79
89
  /**
@@ -169,7 +179,7 @@ export function apply(ctx, config) {
169
179
  // ------------------------------------------------------------------
170
180
  // Subagent child sessions: session/created precedes both subagent/start
171
181
  // and the child's first generation, and the durable header already links
172
- // child → parent (verified against dsh-subagent@0.1.0-rc.7).
182
+ // child → parent (verified against dsh-subagent@0.1.5-rc.1).
173
183
  // ------------------------------------------------------------------
174
184
  ctx.on('session/created', (session) => {
175
185
  const parentSessionId = session.header.parentSession;
@@ -375,7 +385,7 @@ export function apply(ctx, config) {
375
385
  for await (const chunk of stream) {
376
386
  rawChunks.push(chunk);
377
387
  // TTFT is the first real token — block boundaries, usage frames and
378
- // empty heartbeat deltas are not completions (dsh's shared predicate).
388
+ // empty heartbeat deltas are not completions (the predicate above).
379
389
  if (completionStartTime === undefined && isTokenDelta(chunk)) {
380
390
  completionStartTime = new Date();
381
391
  }
@@ -49,7 +49,7 @@ type Observation = LangfuseSpan | LangfuseGeneration;
49
49
  * `input_*`, `output` excludes `output_*`, `total` is the bucket sum —
50
50
  * overlapping buckets double-count usage and inferred cost). dsh reports
51
51
  * uncached input, separate cache buckets, and provider-style output that
52
- * INCLUDES reasoning (verified in dsh-llm-deepseek@0.1.0-rc.7:
52
+ * INCLUDES reasoning (verified in dsh-llm-deepseek@0.1.5-rc.1:
53
53
  * `outputTokens: usage.completion_tokens`, with reasoning split out of
54
54
  * `completion_tokens_details`), so the `output` bucket subtracts
55
55
  * `reasoningTokens` into `output_reasoning`. Only `usageDetails` is sent.
@@ -23,7 +23,7 @@
23
23
  * `subagent/descriptor` event).
24
24
  *
25
25
  * Event/waterfall shapes verified against the installed
26
- * @deepseek-ai/dsh-{llm,session,tools,agent,subagent}@0.1.0-rc.7 package sources
26
+ * @deepseek-ai/dsh-{llm,session,tools,agent,subagent}@0.1.5-rc.1 package sources
27
27
  * (types for shapes; `lib/*.js` for the session/created ordering claim).
28
28
  *
29
29
  * @module dsh-langfuse
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/dsh-langfuse",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Langfuse observability plugin for DeepSeek Harness: one generation per LLM call with a nested llm-request span, one span per tool call, one trace per session turn, subagent child sessions nested under the parent's tree.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -36,10 +36,10 @@
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@deepseek-ai/cordis": "^4.0.1",
39
- "@deepseek-ai/dsh-llm": "0.1.0-rc.7",
40
- "@deepseek-ai/dsh-session": "0.1.0-rc.7",
41
- "@deepseek-ai/dsh-subagent": "0.1.0-rc.7",
42
- "@deepseek-ai/dsh-tools": "0.1.0-rc.7",
39
+ "@deepseek-ai/dsh-llm": "0.1.5-rc.1",
40
+ "@deepseek-ai/dsh-session": "0.1.5-rc.1",
41
+ "@deepseek-ai/dsh-subagent": "0.1.5-rc.1",
42
+ "@deepseek-ai/dsh-tools": "0.1.5-rc.1",
43
43
  "@langfuse/otel": "^5.10.1",
44
44
  "@langfuse/tracing": "^5.10.1",
45
45
  "@opentelemetry/sdk-trace-node": "^2.10.0"
@@ -57,11 +57,11 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@deepseek-ai/cordis": "^4.0.1",
60
- "@deepseek-ai/dsh-agent": "0.1.0-rc.7",
61
- "@deepseek-ai/dsh-llm": "0.1.0-rc.7",
62
- "@deepseek-ai/dsh-session": "0.1.0-rc.7",
63
- "@deepseek-ai/dsh-subagent": "0.1.0-rc.7",
64
- "@deepseek-ai/dsh-tools": "0.1.0-rc.7",
60
+ "@deepseek-ai/dsh-agent": "0.1.5-rc.1",
61
+ "@deepseek-ai/dsh-llm": "0.1.5-rc.1",
62
+ "@deepseek-ai/dsh-session": "0.1.5-rc.1",
63
+ "@deepseek-ai/dsh-subagent": "0.1.5-rc.1",
64
+ "@deepseek-ai/dsh-tools": "0.1.5-rc.1",
65
65
  "@langfuse/otel": "5.10.1",
66
66
  "@langfuse/tracing": "5.10.1",
67
67
  "@opentelemetry/api": "^1.9.1",