@dosu/seshi-model 0.0.0-stage → 0.10.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/LICENSE +21 -0
- package/README.md +8 -2
- package/dist/index.js +1553 -0
- package/package.json +33 -4
- package/types/api.d.ts +219 -0
- package/types/authz.d.ts +18 -0
- package/types/canonical.d.ts +5 -0
- package/types/errors.d.ts +53 -0
- package/types/format-adapter.d.ts +66 -0
- package/types/generated/change.d.ts +81 -0
- package/types/generated/common.d.ts +253 -0
- package/types/generated/envelope.d.ts +228 -0
- package/types/generated/layout.d.ts +65 -0
- package/types/generated/metadata.d.ts +307 -0
- package/types/generated/trace.d.ts +484 -0
- package/types/index.d.ts +24 -0
- package/types/parse.d.ts +18 -0
- package/types/prefix-hash.d.ts +47 -0
- package/types/schemas/otlp.d.ts +51 -0
- package/types/schemas/renders.d.ts +95 -0
- package/types/schemas/store.d.ts +32 -0
- package/types/schemas/trace.d.ts +3 -0
- package/types/schemas/trajectory.d.ts +15 -0
- package/types/schemas/validate.d.ts +5 -0
- package/types/search.d.ts +91 -0
- package/types/spans.d.ts +156 -0
- package/types/version.d.ts +1 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
/** Generated from spec/schemas/metadata.schema.json by scripts/model-types.ts (`bun run types`). Do not edit: change the schema and regenerate. */
|
|
2
|
+
import type { Claims, Continuation, Normalizer, OwnerBasis, Provenance, RedactionSummary, Sha256, Timestamp, Visibility, Writer } from "./common.js";
|
|
3
|
+
/** The `schema` value of every SessionMetadata object. */
|
|
4
|
+
export declare const SCHEMA_ID: "seshi/metadata/1";
|
|
5
|
+
/** `seshi/metadata/1`: one session's live pointer, `owners/<owner>/sessions/<archive_id>/metadata.json`. Mutable, so every write is conditional (If-Match, X6.5). It names the head trace and the traces the session has had, how far the session's log has been normalized and the envelopes recently applied to it, who wrote the session and how its owner was established (X5.5), who may read it (X5.10), the identity claims the data made, what redaction did and where the data came from. */
|
|
6
|
+
export interface SessionMetadata {
|
|
7
|
+
schema: "seshi/metadata/1";
|
|
8
|
+
owner: string;
|
|
9
|
+
/** sha256(owner + "\n" + agent + "\n" + session_id). */
|
|
10
|
+
archive_id: Sha256;
|
|
11
|
+
session_id: string;
|
|
12
|
+
/** The format the session is filed under. */
|
|
13
|
+
agent: string;
|
|
14
|
+
/** What the trace's meta record says it came from; absent until a trace is stored. */
|
|
15
|
+
source?: string;
|
|
16
|
+
project?: string;
|
|
17
|
+
branch?: string;
|
|
18
|
+
parent_session_id?: string;
|
|
19
|
+
/** `stored`, or `redacted` once tombstoned: a redacted session is never stored again. */
|
|
20
|
+
status: "stored" | "redacted";
|
|
21
|
+
/** The current trace's content hash; absent before one is stored and once redacted. A `stored` session without one is a stub (F3.4): model review dropped its first envelopes, and it holds only where its log ends (`normalized`) and who wrote it. Readers neither list nor serve a stub. */
|
|
22
|
+
head?: Sha256;
|
|
23
|
+
traces: SessionTraceRef[];
|
|
24
|
+
normalized?: NormalizedState;
|
|
25
|
+
dropped_prefix?: DroppedPrefix;
|
|
26
|
+
/** Tool calls whose results the sensitive-call rules withhold, by call id, so a result that arrives in a later chunk than its call is withheld too. With `normalized`, the small state a chunk is normalized with (X6.3). */
|
|
27
|
+
withheld_calls?: {
|
|
28
|
+
[key: string]: "sensitive-file" | "secret-output";
|
|
29
|
+
};
|
|
30
|
+
/** The last envelopes applied to the session, oldest first, with what each answered: a resend with the same idempotency key gets the same answer and is not processed again (X4.7). Bounded; older entries fall off. */
|
|
31
|
+
applied?: AppliedEnvelope[];
|
|
32
|
+
/** Who first wrote the session: the original writer, who with an admin may replace it (X4.6). Each write's own writer is on its change entry. */
|
|
33
|
+
writer: Writer;
|
|
34
|
+
owner_basis: OwnerBasis;
|
|
35
|
+
visibility: Visibility;
|
|
36
|
+
claims?: Claims;
|
|
37
|
+
/** Redaction over the session's stored traces: the rule set that last ran and the matches by rule, summed over every write. */
|
|
38
|
+
redaction?: RedactionSummary;
|
|
39
|
+
/** Where the latest write came from. */
|
|
40
|
+
provenance?: Provenance;
|
|
41
|
+
/** The agent that ran the session (`claude-code`), whatever route it arrived by, so readers can collapse a session that arrived twice (X4.5). */
|
|
42
|
+
origin_agent?: string;
|
|
43
|
+
/** The session's id in the agent that ran it (X4.5). */
|
|
44
|
+
native_session_id?: string;
|
|
45
|
+
/** What normalized the head trace (X4.9). Its `format_version` is the oldest that built any stored trace of the session: a chunk normalized by a newer adapter does not make the prefix current, a whole write does. */
|
|
46
|
+
normalizer?: Normalizer;
|
|
47
|
+
/** The hash of the uploader's retraction secret (F9.7), kept from the session's first upload. The secret sent in X-Seshi-Retract (a retraction, or an org-key replace) is checked against it. */
|
|
48
|
+
retract_hash?: Sha256;
|
|
49
|
+
/** When the session last did something: the latest record timestamp over its stored traces. Absent for a session written before it was recorded, and for one whose records carry no timestamps; readers then use `updated_at`. */
|
|
50
|
+
active_at?: Timestamp;
|
|
51
|
+
created_at: Timestamp;
|
|
52
|
+
updated_at: Timestamp;
|
|
53
|
+
}
|
|
54
|
+
export interface SessionTraceRef {
|
|
55
|
+
content_hash: Sha256;
|
|
56
|
+
created_at: Timestamp;
|
|
57
|
+
/** Record count of the stored trace. */
|
|
58
|
+
records: number;
|
|
59
|
+
continuation?: Continuation;
|
|
60
|
+
/** sha256 of the rule set this trace was redacted with (as `RedactionSummary.rule_set`). The session's `redaction.rule_set` is the latest write's; a redaction backfill takes the session as current only when every trace was written under the current rules. Absent for a trace written before it was recorded, which counts as the session's. */
|
|
61
|
+
rule_set?: Sha256;
|
|
62
|
+
}
|
|
63
|
+
/** How far a session's log has been normalized: the state the next chunk continues from, and what a whole upload must extend (X4.6). Counted in the log's records as regex redaction left them, before model review, so it follows the uploader's log. */
|
|
64
|
+
export interface NormalizedState {
|
|
65
|
+
/** Bytes of the log normalized so far: where the next chunk starts (0 for a session assembled from spans). */
|
|
66
|
+
bytes: number;
|
|
67
|
+
/** How many records the whole session normalizes to, those bytes in. */
|
|
68
|
+
records: number;
|
|
69
|
+
prefix_sha256: Sha256;
|
|
70
|
+
/** The prefix hash mid-stream (`PrefixHash.export()`), so the next chunk's records extend it. */
|
|
71
|
+
hash_state: string;
|
|
72
|
+
}
|
|
73
|
+
/** The start of a session's log that model review dropped before anything of the session was stored (F3.4): what its stub held, kept once the session has a trace. A whole write that does not extend what is stored (a `rebuild`, a `replace`, an assembled session written again) leaves these records out, so the dropped text is never stored or reviewed again. Counts and a hash, never content. Absent for a session whose first envelope was stored. */
|
|
74
|
+
export interface DroppedPrefix {
|
|
75
|
+
/** Bytes of the log the dropped records came from (0 for a session assembled from spans): a whole log's first `bytes` bytes are the dropped part, whatever the normalizer now makes of them. */
|
|
76
|
+
bytes: number;
|
|
77
|
+
/** How many records the dropped part normalized to when last written. */
|
|
78
|
+
records: number;
|
|
79
|
+
/** The prefix hash of those records as regex redaction left them (as `NormalizedState.prefix_sha256`). */
|
|
80
|
+
prefix_sha256: Sha256;
|
|
81
|
+
}
|
|
82
|
+
/** One envelope applied to the session, and what it answered. */
|
|
83
|
+
export interface AppliedEnvelope {
|
|
84
|
+
idempotency_key: string;
|
|
85
|
+
at: Timestamp;
|
|
86
|
+
/** `stored` (a new trace), `duplicate` (that trace was already stored), `unchanged` (nothing new in it) or `dropped` (model review dropped it). */
|
|
87
|
+
status: "stored" | "duplicate" | "unchanged" | "dropped";
|
|
88
|
+
/** The trace written, for `stored` and `duplicate`. */
|
|
89
|
+
content_hash?: Sha256;
|
|
90
|
+
/** Records in that trace. */
|
|
91
|
+
records?: number;
|
|
92
|
+
/** Events in that trace. */
|
|
93
|
+
events?: number;
|
|
94
|
+
records_total: number;
|
|
95
|
+
prefix_sha256: Sha256;
|
|
96
|
+
bytes_total: number;
|
|
97
|
+
}
|
|
98
|
+
/** metadata.schema.json as data, without its annotations: what `schemaProblems` checks against. */
|
|
99
|
+
export declare const JSON_SCHEMA: {
|
|
100
|
+
$id: string;
|
|
101
|
+
type: string;
|
|
102
|
+
properties: {
|
|
103
|
+
schema: {
|
|
104
|
+
const: string;
|
|
105
|
+
};
|
|
106
|
+
owner: {
|
|
107
|
+
type: string;
|
|
108
|
+
minLength: number;
|
|
109
|
+
};
|
|
110
|
+
archive_id: {
|
|
111
|
+
$ref: string;
|
|
112
|
+
};
|
|
113
|
+
session_id: {
|
|
114
|
+
type: string;
|
|
115
|
+
};
|
|
116
|
+
agent: {
|
|
117
|
+
type: string;
|
|
118
|
+
};
|
|
119
|
+
source: {
|
|
120
|
+
type: string;
|
|
121
|
+
};
|
|
122
|
+
project: {
|
|
123
|
+
type: string;
|
|
124
|
+
};
|
|
125
|
+
branch: {
|
|
126
|
+
type: string;
|
|
127
|
+
};
|
|
128
|
+
parent_session_id: {
|
|
129
|
+
type: string;
|
|
130
|
+
};
|
|
131
|
+
status: {
|
|
132
|
+
enum: string[];
|
|
133
|
+
};
|
|
134
|
+
head: {
|
|
135
|
+
$ref: string;
|
|
136
|
+
};
|
|
137
|
+
traces: {
|
|
138
|
+
type: string;
|
|
139
|
+
items: {
|
|
140
|
+
$ref: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
normalized: {
|
|
144
|
+
$ref: string;
|
|
145
|
+
};
|
|
146
|
+
dropped_prefix: {
|
|
147
|
+
$ref: string;
|
|
148
|
+
};
|
|
149
|
+
withheld_calls: {
|
|
150
|
+
type: string;
|
|
151
|
+
additionalProperties: {
|
|
152
|
+
enum: string[];
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
applied: {
|
|
156
|
+
type: string;
|
|
157
|
+
items: {
|
|
158
|
+
$ref: string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
writer: {
|
|
162
|
+
$ref: string;
|
|
163
|
+
};
|
|
164
|
+
owner_basis: {
|
|
165
|
+
$ref: string;
|
|
166
|
+
};
|
|
167
|
+
visibility: {
|
|
168
|
+
$ref: string;
|
|
169
|
+
};
|
|
170
|
+
claims: {
|
|
171
|
+
$ref: string;
|
|
172
|
+
};
|
|
173
|
+
redaction: {
|
|
174
|
+
$ref: string;
|
|
175
|
+
};
|
|
176
|
+
provenance: {
|
|
177
|
+
$ref: string;
|
|
178
|
+
};
|
|
179
|
+
origin_agent: {
|
|
180
|
+
type: string;
|
|
181
|
+
};
|
|
182
|
+
native_session_id: {
|
|
183
|
+
type: string;
|
|
184
|
+
};
|
|
185
|
+
normalizer: {
|
|
186
|
+
$ref: string;
|
|
187
|
+
};
|
|
188
|
+
retract_hash: {
|
|
189
|
+
$ref: string;
|
|
190
|
+
};
|
|
191
|
+
active_at: {
|
|
192
|
+
$ref: string;
|
|
193
|
+
};
|
|
194
|
+
created_at: {
|
|
195
|
+
$ref: string;
|
|
196
|
+
};
|
|
197
|
+
updated_at: {
|
|
198
|
+
$ref: string;
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
required: string[];
|
|
202
|
+
additionalProperties: boolean;
|
|
203
|
+
$defs: {
|
|
204
|
+
SessionTraceRef: {
|
|
205
|
+
type: string;
|
|
206
|
+
properties: {
|
|
207
|
+
content_hash: {
|
|
208
|
+
$ref: string;
|
|
209
|
+
};
|
|
210
|
+
created_at: {
|
|
211
|
+
$ref: string;
|
|
212
|
+
};
|
|
213
|
+
records: {
|
|
214
|
+
type: string;
|
|
215
|
+
minimum: number;
|
|
216
|
+
};
|
|
217
|
+
continuation: {
|
|
218
|
+
$ref: string;
|
|
219
|
+
};
|
|
220
|
+
rule_set: {
|
|
221
|
+
$ref: string;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
required: string[];
|
|
225
|
+
additionalProperties: boolean;
|
|
226
|
+
};
|
|
227
|
+
NormalizedState: {
|
|
228
|
+
type: string;
|
|
229
|
+
properties: {
|
|
230
|
+
bytes: {
|
|
231
|
+
type: string;
|
|
232
|
+
minimum: number;
|
|
233
|
+
};
|
|
234
|
+
records: {
|
|
235
|
+
type: string;
|
|
236
|
+
minimum: number;
|
|
237
|
+
};
|
|
238
|
+
prefix_sha256: {
|
|
239
|
+
$ref: string;
|
|
240
|
+
};
|
|
241
|
+
hash_state: {
|
|
242
|
+
type: string;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
required: string[];
|
|
246
|
+
additionalProperties: boolean;
|
|
247
|
+
};
|
|
248
|
+
DroppedPrefix: {
|
|
249
|
+
type: string;
|
|
250
|
+
properties: {
|
|
251
|
+
bytes: {
|
|
252
|
+
type: string;
|
|
253
|
+
minimum: number;
|
|
254
|
+
};
|
|
255
|
+
records: {
|
|
256
|
+
type: string;
|
|
257
|
+
minimum: number;
|
|
258
|
+
};
|
|
259
|
+
prefix_sha256: {
|
|
260
|
+
$ref: string;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
required: string[];
|
|
264
|
+
additionalProperties: boolean;
|
|
265
|
+
};
|
|
266
|
+
AppliedEnvelope: {
|
|
267
|
+
type: string;
|
|
268
|
+
properties: {
|
|
269
|
+
idempotency_key: {
|
|
270
|
+
type: string;
|
|
271
|
+
minLength: number;
|
|
272
|
+
maxLength: number;
|
|
273
|
+
};
|
|
274
|
+
at: {
|
|
275
|
+
$ref: string;
|
|
276
|
+
};
|
|
277
|
+
status: {
|
|
278
|
+
enum: string[];
|
|
279
|
+
};
|
|
280
|
+
content_hash: {
|
|
281
|
+
$ref: string;
|
|
282
|
+
};
|
|
283
|
+
records: {
|
|
284
|
+
type: string;
|
|
285
|
+
minimum: number;
|
|
286
|
+
};
|
|
287
|
+
events: {
|
|
288
|
+
type: string;
|
|
289
|
+
minimum: number;
|
|
290
|
+
};
|
|
291
|
+
records_total: {
|
|
292
|
+
type: string;
|
|
293
|
+
minimum: number;
|
|
294
|
+
};
|
|
295
|
+
prefix_sha256: {
|
|
296
|
+
$ref: string;
|
|
297
|
+
};
|
|
298
|
+
bytes_total: {
|
|
299
|
+
type: string;
|
|
300
|
+
minimum: number;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
required: string[];
|
|
304
|
+
additionalProperties: boolean;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
};
|