dsh-observe 0.1.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/CHANGELOG.md +25 -0
- package/LICENSE +201 -0
- package/README.es.md +198 -0
- package/README.hi.md +198 -0
- package/README.md +198 -0
- package/README.pt.md +198 -0
- package/README.zh.md +198 -0
- package/THIRD_PARTY_NOTICES.md +21 -0
- package/cordis.patch.yml +86 -0
- package/lib/index.js +1947 -0
- package/lib/typert.host.js +109 -0
- package/lib/types/backoff.d.ts +17 -0
- package/lib/types/backoff.d.ts.map +1 -0
- package/lib/types/backoff.js +17 -0
- package/lib/types/backoff.js.map +1 -0
- package/lib/types/collector.d.ts +83 -0
- package/lib/types/collector.d.ts.map +1 -0
- package/lib/types/collector.js +506 -0
- package/lib/types/collector.js.map +1 -0
- package/lib/types/config.d.ts +286 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +312 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/ids.d.ts +43 -0
- package/lib/types/ids.d.ts.map +1 -0
- package/lib/types/ids.js +63 -0
- package/lib/types/ids.js.map +1 -0
- package/lib/types/index.d.ts +35 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +162 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/model.d.ts +89 -0
- package/lib/types/model.d.ts.map +1 -0
- package/lib/types/model.js +25 -0
- package/lib/types/model.js.map +1 -0
- package/lib/types/pipeline.d.ts +71 -0
- package/lib/types/pipeline.d.ts.map +1 -0
- package/lib/types/pipeline.js +193 -0
- package/lib/types/pipeline.js.map +1 -0
- package/lib/types/pricing.d.ts +34 -0
- package/lib/types/pricing.d.ts.map +1 -0
- package/lib/types/pricing.js +45 -0
- package/lib/types/pricing.js.map +1 -0
- package/lib/types/project.d.ts +26 -0
- package/lib/types/project.d.ts.map +1 -0
- package/lib/types/project.js +52 -0
- package/lib/types/project.js.map +1 -0
- package/lib/types/remote.d.ts +28 -0
- package/lib/types/remote.d.ts.map +1 -0
- package/lib/types/remote.js +45 -0
- package/lib/types/remote.js.map +1 -0
- package/lib/types/sanitize.d.ts +78 -0
- package/lib/types/sanitize.d.ts.map +1 -0
- package/lib/types/sanitize.js +132 -0
- package/lib/types/sanitize.js.map +1 -0
- package/lib/types/sinks.d.ts +84 -0
- package/lib/types/sinks.d.ts.map +1 -0
- package/lib/types/sinks.js +434 -0
- package/lib/types/sinks.js.map +1 -0
- package/lib/types/spool.d.ts +113 -0
- package/lib/types/spool.d.ts.map +1 -0
- package/lib/types/spool.js +167 -0
- package/lib/types/spool.js.map +1 -0
- package/lib/types/typert.host.d.ts +93 -0
- package/lib/types/typert.host.d.ts.map +1 -0
- package/lib/types/typert.host.js +23 -0
- package/lib/types/typert.host.js.map +1 -0
- package/lib/types/version.d.ts +10 -0
- package/lib/types/version.d.ts.map +1 -0
- package/lib/types/version.js +10 -0
- package/lib/types/version.js.map +1 -0
- package/lib/types/wire.d.ts +206 -0
- package/lib/types/wire.d.ts.map +1 -0
- package/lib/types/wire.js +71 -0
- package/lib/types/wire.js.map +1 -0
- package/package.json +147 -0
- package/src/backoff.ts +20 -0
- package/src/collector.ts +561 -0
- package/src/config.ts +604 -0
- package/src/ids.ts +68 -0
- package/src/index.ts +186 -0
- package/src/model.ts +100 -0
- package/src/pipeline.ts +205 -0
- package/src/pricing.ts +55 -0
- package/src/project.ts +55 -0
- package/src/remote.ts +56 -0
- package/src/sanitize.ts +132 -0
- package/src/sinks.ts +471 -0
- package/src/spool.ts +196 -0
- package/src/typert.host.ts +24 -0
- package/src/version.ts +10 -0
- package/src/wire.ts +97 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `observe` Remote wire vocabulary: the status snapshot and the kill
|
|
3
|
+
* switch result, their zod v4 strict schemas, and the invocation descriptors
|
|
4
|
+
* shared by the host `./typert` manifest. One canonical source keeps the two
|
|
5
|
+
* Typert faces from drifting apart.
|
|
6
|
+
* @module dsh-observe/wire
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import type { SpoolCounts } from './spool.ts';
|
|
10
|
+
/** The status payload returned by `observe/status`. */
|
|
11
|
+
export interface ObserveStatus {
|
|
12
|
+
/** The runtime kill switch state. */
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
/** Which backends are configured (not whether they are reachable). */
|
|
15
|
+
backends: {
|
|
16
|
+
otlp: boolean;
|
|
17
|
+
langfuse: boolean;
|
|
18
|
+
};
|
|
19
|
+
/** Queued + retry-pending records per backend. */
|
|
20
|
+
queueDepth: {
|
|
21
|
+
otlp: number;
|
|
22
|
+
langfuse: number;
|
|
23
|
+
};
|
|
24
|
+
/** Durable offline-buffer occupancy per backend. */
|
|
25
|
+
spool: Record<'otlp' | 'langfuse', SpoolCounts>;
|
|
26
|
+
}
|
|
27
|
+
/** Strict wire schema for {@link ObserveStatus} (zod v4). */
|
|
28
|
+
export declare const OBSERVE_STATUS_SCHEMA: z.ZodObject<{
|
|
29
|
+
enabled: z.ZodBoolean;
|
|
30
|
+
backends: z.ZodObject<{
|
|
31
|
+
otlp: z.ZodBoolean;
|
|
32
|
+
langfuse: z.ZodBoolean;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
queueDepth: z.ZodObject<{
|
|
35
|
+
otlp: z.ZodNumber;
|
|
36
|
+
langfuse: z.ZodNumber;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
spool: z.ZodObject<{
|
|
39
|
+
otlp: z.ZodObject<{
|
|
40
|
+
batches: z.ZodNumber;
|
|
41
|
+
records: z.ZodNumber;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
langfuse: z.ZodObject<{
|
|
44
|
+
batches: z.ZodNumber;
|
|
45
|
+
records: z.ZodNumber;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
/** The result of `observe/setEnabled`: the kill switch state after the write. */
|
|
50
|
+
export interface ObserveSetEnabledResult {
|
|
51
|
+
/** The runtime kill switch state after the change. */
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Strict wire schema for {@link ObserveSetEnabledResult} (zod v4). */
|
|
55
|
+
export declare const OBSERVE_SET_ENABLED_RESULT_SCHEMA: z.ZodObject<{
|
|
56
|
+
enabled: z.ZodBoolean;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
/** The `observe/status` invocation descriptor: the read-only status snapshot. */
|
|
59
|
+
export declare const OBSERVE_STATUS_DESCRIPTOR: Readonly<{
|
|
60
|
+
readonly id: "dsh-observe#observe/status";
|
|
61
|
+
readonly service: "dsh-observe";
|
|
62
|
+
readonly namespace: "observe";
|
|
63
|
+
readonly method: "status";
|
|
64
|
+
readonly invocation: Readonly<{
|
|
65
|
+
kind: "direct";
|
|
66
|
+
}>;
|
|
67
|
+
readonly parameters: readonly never[];
|
|
68
|
+
readonly result: Readonly<{
|
|
69
|
+
mode: "strict";
|
|
70
|
+
typeSymbol: "dsh-observe/types#ObserveStatus";
|
|
71
|
+
schema: z.ZodObject<{
|
|
72
|
+
enabled: z.ZodBoolean;
|
|
73
|
+
backends: z.ZodObject<{
|
|
74
|
+
otlp: z.ZodBoolean;
|
|
75
|
+
langfuse: z.ZodBoolean;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
queueDepth: z.ZodObject<{
|
|
78
|
+
otlp: z.ZodNumber;
|
|
79
|
+
langfuse: z.ZodNumber;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
spool: z.ZodObject<{
|
|
82
|
+
otlp: z.ZodObject<{
|
|
83
|
+
batches: z.ZodNumber;
|
|
84
|
+
records: z.ZodNumber;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
langfuse: z.ZodObject<{
|
|
87
|
+
batches: z.ZodNumber;
|
|
88
|
+
records: z.ZodNumber;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
}>;
|
|
93
|
+
readonly sourceLocation: Readonly<{
|
|
94
|
+
file: "src/wire.ts";
|
|
95
|
+
line: 1;
|
|
96
|
+
column: 1;
|
|
97
|
+
}>;
|
|
98
|
+
}>;
|
|
99
|
+
/** The `observe/setEnabled` invocation descriptor: the runtime kill switch. */
|
|
100
|
+
export declare const OBSERVE_SET_ENABLED_DESCRIPTOR: Readonly<{
|
|
101
|
+
readonly id: "dsh-observe#observe/setEnabled";
|
|
102
|
+
readonly service: "dsh-observe";
|
|
103
|
+
readonly namespace: "observe";
|
|
104
|
+
readonly method: "setEnabled";
|
|
105
|
+
readonly invocation: Readonly<{
|
|
106
|
+
kind: "direct";
|
|
107
|
+
}>;
|
|
108
|
+
readonly parameters: readonly Readonly<{
|
|
109
|
+
name: string;
|
|
110
|
+
wire: string;
|
|
111
|
+
source: "json";
|
|
112
|
+
codec: Readonly<{
|
|
113
|
+
mode: "strict";
|
|
114
|
+
typeSymbol: "dsh-observe/types#ObserveSetEnabledArgs";
|
|
115
|
+
schema: z.ZodObject<{
|
|
116
|
+
enabled: z.ZodBoolean;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
}>;
|
|
119
|
+
}>[];
|
|
120
|
+
readonly result: Readonly<{
|
|
121
|
+
mode: "strict";
|
|
122
|
+
typeSymbol: "dsh-observe/types#ObserveSetEnabledResult";
|
|
123
|
+
schema: z.ZodObject<{
|
|
124
|
+
enabled: z.ZodBoolean;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
}>;
|
|
127
|
+
readonly sourceLocation: Readonly<{
|
|
128
|
+
file: "src/wire.ts";
|
|
129
|
+
line: 1;
|
|
130
|
+
column: 1;
|
|
131
|
+
}>;
|
|
132
|
+
}>;
|
|
133
|
+
/** The canonical invocation list both Typert faces register. */
|
|
134
|
+
export declare const OBSERVE_INVOCATIONS: readonly (Readonly<{
|
|
135
|
+
readonly id: "dsh-observe#observe/status";
|
|
136
|
+
readonly service: "dsh-observe";
|
|
137
|
+
readonly namespace: "observe";
|
|
138
|
+
readonly method: "status";
|
|
139
|
+
readonly invocation: Readonly<{
|
|
140
|
+
kind: "direct";
|
|
141
|
+
}>;
|
|
142
|
+
readonly parameters: readonly never[];
|
|
143
|
+
readonly result: Readonly<{
|
|
144
|
+
mode: "strict";
|
|
145
|
+
typeSymbol: "dsh-observe/types#ObserveStatus";
|
|
146
|
+
schema: z.ZodObject<{
|
|
147
|
+
enabled: z.ZodBoolean;
|
|
148
|
+
backends: z.ZodObject<{
|
|
149
|
+
otlp: z.ZodBoolean;
|
|
150
|
+
langfuse: z.ZodBoolean;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
queueDepth: z.ZodObject<{
|
|
153
|
+
otlp: z.ZodNumber;
|
|
154
|
+
langfuse: z.ZodNumber;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
spool: z.ZodObject<{
|
|
157
|
+
otlp: z.ZodObject<{
|
|
158
|
+
batches: z.ZodNumber;
|
|
159
|
+
records: z.ZodNumber;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
langfuse: z.ZodObject<{
|
|
162
|
+
batches: z.ZodNumber;
|
|
163
|
+
records: z.ZodNumber;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
}, z.core.$strip>;
|
|
167
|
+
}>;
|
|
168
|
+
readonly sourceLocation: Readonly<{
|
|
169
|
+
file: "src/wire.ts";
|
|
170
|
+
line: 1;
|
|
171
|
+
column: 1;
|
|
172
|
+
}>;
|
|
173
|
+
}> | Readonly<{
|
|
174
|
+
readonly id: "dsh-observe#observe/setEnabled";
|
|
175
|
+
readonly service: "dsh-observe";
|
|
176
|
+
readonly namespace: "observe";
|
|
177
|
+
readonly method: "setEnabled";
|
|
178
|
+
readonly invocation: Readonly<{
|
|
179
|
+
kind: "direct";
|
|
180
|
+
}>;
|
|
181
|
+
readonly parameters: readonly Readonly<{
|
|
182
|
+
name: string;
|
|
183
|
+
wire: string;
|
|
184
|
+
source: "json";
|
|
185
|
+
codec: Readonly<{
|
|
186
|
+
mode: "strict";
|
|
187
|
+
typeSymbol: "dsh-observe/types#ObserveSetEnabledArgs";
|
|
188
|
+
schema: z.ZodObject<{
|
|
189
|
+
enabled: z.ZodBoolean;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
}>;
|
|
192
|
+
}>[];
|
|
193
|
+
readonly result: Readonly<{
|
|
194
|
+
mode: "strict";
|
|
195
|
+
typeSymbol: "dsh-observe/types#ObserveSetEnabledResult";
|
|
196
|
+
schema: z.ZodObject<{
|
|
197
|
+
enabled: z.ZodBoolean;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
}>;
|
|
200
|
+
readonly sourceLocation: Readonly<{
|
|
201
|
+
file: "src/wire.ts";
|
|
202
|
+
line: 1;
|
|
203
|
+
column: 1;
|
|
204
|
+
}>;
|
|
205
|
+
}>)[];
|
|
206
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/wire.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,sEAAsE;IACtE,QAAQ,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAA;IAC9C,kDAAkD;IAClD,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC,MAAM,GAAG,UAAU,EAAE,WAAW,CAAC,CAAA;CAChD;AAED,6DAA6D;AAC7D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;iBAQhC,CAAA;AAEF,iFAAiF;AACjF,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,uEAAuE;AACvE,eAAO,MAAM,iCAAiC;;iBAE5C,CAAA;AAOF,iFAAiF;AACjF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaI,CAAA;AAE1C,+EAA+E;AAC/E,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBD,CAAA;AAE1C,gEAAgE;AAChE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAG9B,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `observe` Remote wire vocabulary: the status snapshot and the kill
|
|
3
|
+
* switch result, their zod v4 strict schemas, and the invocation descriptors
|
|
4
|
+
* shared by the host `./typert` manifest. One canonical source keeps the two
|
|
5
|
+
* Typert faces from drifting apart.
|
|
6
|
+
* @module dsh-observe/wire
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
/** Strict wire schema for {@link ObserveStatus} (zod v4). */
|
|
10
|
+
export const OBSERVE_STATUS_SCHEMA = z.object({
|
|
11
|
+
enabled: z.boolean(),
|
|
12
|
+
backends: z.object({ otlp: z.boolean(), langfuse: z.boolean() }),
|
|
13
|
+
queueDepth: z.object({ otlp: z.number().int(), langfuse: z.number().int() }),
|
|
14
|
+
spool: z.object({
|
|
15
|
+
otlp: z.object({ batches: z.number().int(), records: z.number().int() }),
|
|
16
|
+
langfuse: z.object({ batches: z.number().int(), records: z.number().int() }),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
/** Strict wire schema for {@link ObserveSetEnabledResult} (zod v4). */
|
|
20
|
+
export const OBSERVE_SET_ENABLED_RESULT_SCHEMA = z.object({
|
|
21
|
+
enabled: z.boolean(),
|
|
22
|
+
});
|
|
23
|
+
/** JSON codec for the setEnabled argument. */
|
|
24
|
+
const SET_ENABLED_ARGS_CODEC = z.object({
|
|
25
|
+
enabled: z.boolean(),
|
|
26
|
+
});
|
|
27
|
+
/** The `observe/status` invocation descriptor: the read-only status snapshot. */
|
|
28
|
+
export const OBSERVE_STATUS_DESCRIPTOR = Object.freeze({
|
|
29
|
+
id: 'dsh-observe#observe/status',
|
|
30
|
+
service: 'dsh-observe',
|
|
31
|
+
namespace: 'observe',
|
|
32
|
+
method: 'status',
|
|
33
|
+
invocation: Object.freeze({ kind: 'direct' }),
|
|
34
|
+
parameters: Object.freeze([]),
|
|
35
|
+
result: Object.freeze({
|
|
36
|
+
mode: 'strict',
|
|
37
|
+
typeSymbol: 'dsh-observe/types#ObserveStatus',
|
|
38
|
+
schema: OBSERVE_STATUS_SCHEMA,
|
|
39
|
+
}),
|
|
40
|
+
sourceLocation: Object.freeze({ file: 'src/wire.ts', line: 1, column: 1 }),
|
|
41
|
+
});
|
|
42
|
+
/** The `observe/setEnabled` invocation descriptor: the runtime kill switch. */
|
|
43
|
+
export const OBSERVE_SET_ENABLED_DESCRIPTOR = Object.freeze({
|
|
44
|
+
id: 'dsh-observe#observe/setEnabled',
|
|
45
|
+
service: 'dsh-observe',
|
|
46
|
+
namespace: 'observe',
|
|
47
|
+
method: 'setEnabled',
|
|
48
|
+
invocation: Object.freeze({ kind: 'direct' }),
|
|
49
|
+
parameters: Object.freeze([Object.freeze({
|
|
50
|
+
name: 'request',
|
|
51
|
+
wire: 'request',
|
|
52
|
+
source: 'json',
|
|
53
|
+
codec: Object.freeze({
|
|
54
|
+
mode: 'strict',
|
|
55
|
+
typeSymbol: 'dsh-observe/types#ObserveSetEnabledArgs',
|
|
56
|
+
schema: SET_ENABLED_ARGS_CODEC,
|
|
57
|
+
}),
|
|
58
|
+
})]),
|
|
59
|
+
result: Object.freeze({
|
|
60
|
+
mode: 'strict',
|
|
61
|
+
typeSymbol: 'dsh-observe/types#ObserveSetEnabledResult',
|
|
62
|
+
schema: OBSERVE_SET_ENABLED_RESULT_SCHEMA,
|
|
63
|
+
}),
|
|
64
|
+
sourceLocation: Object.freeze({ file: 'src/wire.ts', line: 1, column: 1 }),
|
|
65
|
+
});
|
|
66
|
+
/** The canonical invocation list both Typert faces register. */
|
|
67
|
+
export const OBSERVE_INVOCATIONS = Object.freeze([
|
|
68
|
+
OBSERVE_STATUS_DESCRIPTOR,
|
|
69
|
+
OBSERVE_SET_ENABLED_DESCRIPTOR,
|
|
70
|
+
]);
|
|
71
|
+
//# sourceMappingURL=wire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../src/wire.ts"],"names":[],"mappings":"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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-observe",
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/PerryLink/dsh-observe.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/PerryLink/dsh-observe#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/PerryLink/dsh-observe/issues"
|
|
12
|
+
},
|
|
13
|
+
"author": "dsh-observe contributors",
|
|
14
|
+
"private": false,
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "./lib/index.js",
|
|
17
|
+
"types": "./lib/types/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./lib/types/index.d.ts",
|
|
21
|
+
"default": "./lib/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./typert": {
|
|
24
|
+
"types": "./lib/types/typert.host.d.ts",
|
|
25
|
+
"default": "./lib/typert.host.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"lib",
|
|
31
|
+
"src",
|
|
32
|
+
"cordis.patch.yml",
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"THIRD_PARTY_NOTICES.md",
|
|
35
|
+
"README.md",
|
|
36
|
+
"README.zh.md",
|
|
37
|
+
"README.es.md",
|
|
38
|
+
"README.pt.md",
|
|
39
|
+
"README.hi.md",
|
|
40
|
+
"LICENSE"
|
|
41
|
+
],
|
|
42
|
+
"sideEffects": false,
|
|
43
|
+
"dsh": {
|
|
44
|
+
"bundle": {
|
|
45
|
+
"patch": "./cordis.patch.yml"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"dshWorkshop": {
|
|
49
|
+
"schema": "omdsh-workshop-package/v1",
|
|
50
|
+
"type": "plugin",
|
|
51
|
+
"integration": {
|
|
52
|
+
"protocol": "harness-profile",
|
|
53
|
+
"artifact": "cordis.patch.yml"
|
|
54
|
+
},
|
|
55
|
+
"install": {
|
|
56
|
+
"mode": "transactional",
|
|
57
|
+
"adapter": "profile-bundle",
|
|
58
|
+
"failurePolicy": "generation-rollback",
|
|
59
|
+
"touchesCurrentBeforeActivation": false
|
|
60
|
+
},
|
|
61
|
+
"lifecycle": {
|
|
62
|
+
"activation": "restart-profile",
|
|
63
|
+
"dispose": "supported"
|
|
64
|
+
},
|
|
65
|
+
"permissions": [
|
|
66
|
+
"network:outbound",
|
|
67
|
+
"session:read",
|
|
68
|
+
"storage:write",
|
|
69
|
+
"native-code:none"
|
|
70
|
+
],
|
|
71
|
+
"compatibility": {
|
|
72
|
+
"dshVersions": [
|
|
73
|
+
"0.1.0-rc.6"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"capability": {
|
|
77
|
+
"id": "observe",
|
|
78
|
+
"kind": "service",
|
|
79
|
+
"invocation": "mount the dsh-observe bundle row",
|
|
80
|
+
"expected": "exports session telemetry as OTLP traces + metrics and Langfuse observations, sanitized and buffered"
|
|
81
|
+
},
|
|
82
|
+
"evidence": {
|
|
83
|
+
"install": null,
|
|
84
|
+
"failureIsolation": null,
|
|
85
|
+
"hotReload": null,
|
|
86
|
+
"remove": null
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"keywords": [
|
|
90
|
+
"dsh",
|
|
91
|
+
"dsh-plugin",
|
|
92
|
+
"deepseek-harness",
|
|
93
|
+
"deepseek",
|
|
94
|
+
"cordis",
|
|
95
|
+
"opentelemetry",
|
|
96
|
+
"otel",
|
|
97
|
+
"otlp",
|
|
98
|
+
"langfuse",
|
|
99
|
+
"observability",
|
|
100
|
+
"tracing",
|
|
101
|
+
"metrics",
|
|
102
|
+
"llm-observability"
|
|
103
|
+
],
|
|
104
|
+
"engines": {
|
|
105
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
106
|
+
},
|
|
107
|
+
"packageManager": "pnpm@11.7.0",
|
|
108
|
+
"peerDependencies": {
|
|
109
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
110
|
+
"@deepseek-ai/schemastery": "^3.18.0",
|
|
111
|
+
"@deepseek-ai/dsh-llm": "0.1.0-rc.6",
|
|
112
|
+
"@deepseek-ai/dsh-session": "0.1.0-rc.6",
|
|
113
|
+
"@deepseek-ai/dsh-storage-domain": "0.1.0-rc.6",
|
|
114
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.0-rc.6"
|
|
115
|
+
},
|
|
116
|
+
"dependencies": {
|
|
117
|
+
"tsdown": "^0.22.14",
|
|
118
|
+
"typescript": "^5.9.0",
|
|
119
|
+
"zod": "^4.4.3"
|
|
120
|
+
},
|
|
121
|
+
"devDependencies": {
|
|
122
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
123
|
+
"@deepseek-ai/schemastery": "^3.18.0",
|
|
124
|
+
"@deepseek-ai/dsh-llm": "0.1.0-rc.6",
|
|
125
|
+
"@deepseek-ai/dsh-session": "0.1.0-rc.6",
|
|
126
|
+
"@deepseek-ai/dsh-storage": "0.1.0-rc.6",
|
|
127
|
+
"@deepseek-ai/dsh-storage-domain": "0.1.0-rc.6",
|
|
128
|
+
"@deepseek-ai/dsh-storage-json": "0.1.0-rc.6",
|
|
129
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.0-rc.6",
|
|
130
|
+
"@types/node": "^22.19.0",
|
|
131
|
+
"@vitest/coverage-v8": "^3.2.0",
|
|
132
|
+
"vitest": "^3.2.0"
|
|
133
|
+
},
|
|
134
|
+
"scripts": {
|
|
135
|
+
"build": "node scripts/prepare.mjs",
|
|
136
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
137
|
+
"typecheck:ci": "tsc -p tsconfig.ci.json --noEmit",
|
|
138
|
+
"test": "vitest run",
|
|
139
|
+
"test:coverage": "vitest run --coverage",
|
|
140
|
+
"prepare": "node scripts/prepare.mjs",
|
|
141
|
+
"verify:self-contained": "node scripts/verify-self-contained.mjs",
|
|
142
|
+
"verify:artifacts": "node scripts/verify-artifacts.mjs",
|
|
143
|
+
"verify:readme-sync": "node scripts/check-readme-sync.mjs",
|
|
144
|
+
"pack:check": "node scripts/prepare.mjs && pnpm pack"
|
|
145
|
+
},
|
|
146
|
+
"license": "Apache-2.0"
|
|
147
|
+
}
|
package/src/backoff.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backoff delay computation for export retries: deterministic exponential
|
|
3
|
+
* backoff (no jitter — tests and replays stay reproducible).
|
|
4
|
+
* @module dsh-observe/backoff
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Compute the delay before the next retry attempt.
|
|
9
|
+
* @param consecutiveFailures - failures so far (1 = first retry).
|
|
10
|
+
* @param policy - the resolved retry policy.
|
|
11
|
+
* @returns the delay in milliseconds, capped at `maxDelayMs`.
|
|
12
|
+
*/
|
|
13
|
+
export function backoffDelayMs(
|
|
14
|
+
consecutiveFailures: number,
|
|
15
|
+
policy: { readonly baseDelayMs: number; readonly factor: number; readonly maxDelayMs: number },
|
|
16
|
+
): number {
|
|
17
|
+
const exponent = Math.min(consecutiveFailures, 30)
|
|
18
|
+
const delay = policy.baseDelayMs * (policy.factor ** exponent)
|
|
19
|
+
return Math.min(delay, policy.maxDelayMs)
|
|
20
|
+
}
|