@deepseek-ai/dsh-session-stats 0.1.0-rc.8 → 0.1.1-rc.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/index.js +31 -12
- package/lib/types/projection.d.ts +64 -2
- package/lib/types/projection.js +31 -12
- package/package.json +10 -10
package/lib/index.js
CHANGED
|
@@ -36,6 +36,22 @@ const sessionStatsSchema = z.object({
|
|
|
36
36
|
decodeTokens: z.number().nonnegative()
|
|
37
37
|
}).strict();
|
|
38
38
|
/**
|
|
39
|
+
* The fold state's shape (totals plus in-flight boundaries), validated on
|
|
40
|
+
* persisted-cache rows after their `ver` gate — the unit's input boundary.
|
|
41
|
+
* The view is a strict subset of the state, so this schema extends
|
|
42
|
+
* `sessionStatsSchema` (the wire output boundary) with the boundary fields.
|
|
43
|
+
*/
|
|
44
|
+
const sessionStatsStateSchema = sessionStatsSchema.extend({
|
|
45
|
+
lastTurn: z.number().int().nonnegative().nullable(),
|
|
46
|
+
openStep: z.object({
|
|
47
|
+
turn: z.number().int().nonnegative(),
|
|
48
|
+
step: z.number().int().nonnegative(),
|
|
49
|
+
startTime: z.number().nonnegative(),
|
|
50
|
+
firstTokenTime: z.number().nonnegative().nullable()
|
|
51
|
+
}).nullable(),
|
|
52
|
+
pendingCalls: z.record(z.string(), z.number().nonnegative())
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
39
55
|
* Provider-reported completion tokens, guarded the way the window fold guards
|
|
40
56
|
* node usage.
|
|
41
57
|
* @param usage - the assistant/message event's optional usage record.
|
|
@@ -49,7 +65,8 @@ function usageOutputTokens(usage) {
|
|
|
49
65
|
/** The `sessionStats` unit registered on `ctx.sessionProjections` (exported for the unit spec). */
|
|
50
66
|
const sessionStatsProjectionDefinition = {
|
|
51
67
|
key: "sessionStats",
|
|
52
|
-
|
|
68
|
+
stateVersion: 1,
|
|
69
|
+
stateSchema: sessionStatsStateSchema,
|
|
53
70
|
init: () => ({
|
|
54
71
|
turns: 0,
|
|
55
72
|
steps: 0,
|
|
@@ -137,17 +154,19 @@ const sessionStatsProjectionDefinition = {
|
|
|
137
154
|
default: return state;
|
|
138
155
|
}
|
|
139
156
|
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
wire: {
|
|
158
|
+
viewSchema: sessionStatsSchema,
|
|
159
|
+
view: (state) => ({
|
|
160
|
+
turns: state.turns,
|
|
161
|
+
steps: state.steps,
|
|
162
|
+
llmMs: state.llmMs,
|
|
163
|
+
toolMs: state.toolMs,
|
|
164
|
+
ttftMs: state.ttftMs,
|
|
165
|
+
ttftSteps: state.ttftSteps,
|
|
166
|
+
decodeMs: state.decodeMs,
|
|
167
|
+
decodeTokens: state.decodeTokens
|
|
168
|
+
})
|
|
169
|
+
}
|
|
151
170
|
};
|
|
152
171
|
//#endregion
|
|
153
172
|
//#region lib/types/index.js
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* @module @deepseek-ai/dsh-session-stats/projection
|
|
24
24
|
*/
|
|
25
|
-
import
|
|
25
|
+
import { z } from 'zod';
|
|
26
26
|
/** Accumulated whole-log figures (the view is exactly these totals). */
|
|
27
27
|
interface SessionStatsTotals {
|
|
28
28
|
/** Distinct turns with at least one closed step so far. */
|
|
@@ -61,7 +61,69 @@ interface SessionStatsState extends SessionStatsTotals {
|
|
|
61
61
|
/** Dispatch times of tool calls whose result has not landed, by callId. */
|
|
62
62
|
pendingCalls: Record<string, number>;
|
|
63
63
|
}
|
|
64
|
+
declare module '@deepseek-ai/dsh-session-projection/types' {
|
|
65
|
+
interface SessionProjectionStateMap {
|
|
66
|
+
sessionStats: SessionStatsState;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
64
69
|
/** The `sessionStats` unit registered on `ctx.sessionProjections` (exported for the unit spec). */
|
|
65
|
-
export declare const sessionStatsProjectionDefinition:
|
|
70
|
+
export declare const sessionStatsProjectionDefinition: {
|
|
71
|
+
key: "sessionStats";
|
|
72
|
+
stateVersion: number;
|
|
73
|
+
stateSchema: z.ZodObject<{
|
|
74
|
+
turns: z.ZodNumber;
|
|
75
|
+
steps: z.ZodNumber;
|
|
76
|
+
llmMs: z.ZodNumber;
|
|
77
|
+
toolMs: z.ZodNumber;
|
|
78
|
+
ttftMs: z.ZodNumber;
|
|
79
|
+
ttftSteps: z.ZodNumber;
|
|
80
|
+
decodeMs: z.ZodNumber;
|
|
81
|
+
decodeTokens: z.ZodNumber;
|
|
82
|
+
lastTurn: z.ZodNullable<z.ZodNumber>;
|
|
83
|
+
openStep: z.ZodNullable<z.ZodObject<{
|
|
84
|
+
turn: z.ZodNumber;
|
|
85
|
+
step: z.ZodNumber;
|
|
86
|
+
startTime: z.ZodNumber;
|
|
87
|
+
firstTokenTime: z.ZodNullable<z.ZodNumber>;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
pendingCalls: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
init: () => {
|
|
92
|
+
turns: number;
|
|
93
|
+
steps: number;
|
|
94
|
+
llmMs: number;
|
|
95
|
+
toolMs: number;
|
|
96
|
+
ttftMs: number;
|
|
97
|
+
ttftSteps: number;
|
|
98
|
+
decodeMs: number;
|
|
99
|
+
decodeTokens: number;
|
|
100
|
+
lastTurn: null;
|
|
101
|
+
openStep: null;
|
|
102
|
+
pendingCalls: {};
|
|
103
|
+
};
|
|
104
|
+
apply: (state: NoInfer<SessionStatsState>, event: import("@deepseek-ai/dsh-session").SessionEvent) => SessionStatsState;
|
|
105
|
+
wire: {
|
|
106
|
+
viewSchema: z.ZodObject<{
|
|
107
|
+
turns: z.ZodNumber;
|
|
108
|
+
steps: z.ZodNumber;
|
|
109
|
+
llmMs: z.ZodNumber;
|
|
110
|
+
toolMs: z.ZodNumber;
|
|
111
|
+
ttftMs: z.ZodNumber;
|
|
112
|
+
ttftSteps: z.ZodNumber;
|
|
113
|
+
decodeMs: z.ZodNumber;
|
|
114
|
+
decodeTokens: z.ZodNumber;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
view: (state: NoInfer<SessionStatsState>) => {
|
|
117
|
+
turns: number;
|
|
118
|
+
steps: number;
|
|
119
|
+
llmMs: number;
|
|
120
|
+
toolMs: number;
|
|
121
|
+
ttftMs: number;
|
|
122
|
+
ttftSteps: number;
|
|
123
|
+
decodeMs: number;
|
|
124
|
+
decodeTokens: number;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
66
128
|
export {};
|
|
67
129
|
//# sourceMappingURL=projection.d.ts.map
|
package/lib/types/projection.js
CHANGED
|
@@ -34,6 +34,22 @@ const sessionStatsSchema = z.object({
|
|
|
34
34
|
decodeMs: z.number().nonnegative(),
|
|
35
35
|
decodeTokens: z.number().nonnegative(),
|
|
36
36
|
}).strict();
|
|
37
|
+
/**
|
|
38
|
+
* The fold state's shape (totals plus in-flight boundaries), validated on
|
|
39
|
+
* persisted-cache rows after their `ver` gate — the unit's input boundary.
|
|
40
|
+
* The view is a strict subset of the state, so this schema extends
|
|
41
|
+
* `sessionStatsSchema` (the wire output boundary) with the boundary fields.
|
|
42
|
+
*/
|
|
43
|
+
const sessionStatsStateSchema = sessionStatsSchema.extend({
|
|
44
|
+
lastTurn: z.number().int().nonnegative().nullable(),
|
|
45
|
+
openStep: z.object({
|
|
46
|
+
turn: z.number().int().nonnegative(),
|
|
47
|
+
step: z.number().int().nonnegative(),
|
|
48
|
+
startTime: z.number().nonnegative(),
|
|
49
|
+
firstTokenTime: z.number().nonnegative().nullable(),
|
|
50
|
+
}).nullable(),
|
|
51
|
+
pendingCalls: z.record(z.string(), z.number().nonnegative()),
|
|
52
|
+
});
|
|
37
53
|
/**
|
|
38
54
|
* Provider-reported completion tokens, guarded the way the window fold guards
|
|
39
55
|
* node usage.
|
|
@@ -49,7 +65,8 @@ function usageOutputTokens(usage) {
|
|
|
49
65
|
/** The `sessionStats` unit registered on `ctx.sessionProjections` (exported for the unit spec). */
|
|
50
66
|
export const sessionStatsProjectionDefinition = {
|
|
51
67
|
key: 'sessionStats',
|
|
52
|
-
|
|
68
|
+
stateVersion: 1,
|
|
69
|
+
stateSchema: sessionStatsStateSchema,
|
|
53
70
|
init: () => ({
|
|
54
71
|
turns: 0,
|
|
55
72
|
steps: 0,
|
|
@@ -132,16 +149,18 @@ export const sessionStatsProjectionDefinition = {
|
|
|
132
149
|
return state;
|
|
133
150
|
}
|
|
134
151
|
},
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
152
|
+
wire: {
|
|
153
|
+
viewSchema: sessionStatsSchema,
|
|
154
|
+
view: state => ({
|
|
155
|
+
turns: state.turns,
|
|
156
|
+
steps: state.steps,
|
|
157
|
+
llmMs: state.llmMs,
|
|
158
|
+
toolMs: state.toolMs,
|
|
159
|
+
ttftMs: state.ttftMs,
|
|
160
|
+
ttftSteps: state.ttftSteps,
|
|
161
|
+
decodeMs: state.decodeMs,
|
|
162
|
+
decodeTokens: state.decodeTokens,
|
|
163
|
+
}),
|
|
164
|
+
},
|
|
146
165
|
};
|
|
147
166
|
//# sourceMappingURL=projection.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-session-stats",
|
|
3
3
|
"description": "Whole-log conversation counts and wall times projection (sessionStats) for the DeepSeek Harness",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1-rc.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -41,22 +41,22 @@
|
|
|
41
41
|
],
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
45
|
-
"@deepseek-ai/dsh-
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.
|
|
44
|
+
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
45
|
+
"@deepseek-ai/dsh-session": "^0.1.1-rc.2",
|
|
46
|
+
"@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
|
|
47
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.1-rc.2",
|
|
48
48
|
"@deepseek-ai/cordis": "^4.0.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"zod": "^4.4.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@deepseek-ai/cordis-plugin-loader": "^1.0.2",
|
|
55
54
|
"@deepseek-ai/cordis-plugin-include": "^1.0.6",
|
|
56
|
-
"@deepseek-ai/
|
|
57
|
-
"@deepseek-ai/dsh-
|
|
58
|
-
"@deepseek-ai/dsh-
|
|
59
|
-
"@deepseek-ai/dsh-session
|
|
55
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.2",
|
|
56
|
+
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
57
|
+
"@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
|
|
58
|
+
"@deepseek-ai/dsh-session": "^0.1.1-rc.2",
|
|
59
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.1-rc.2",
|
|
60
60
|
"@deepseek-ai/cordis": "^4.0.1"
|
|
61
61
|
}
|
|
62
62
|
}
|