@bli-cockpit/telemetry-core 0.1.92 → 0.1.93
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/dist/evidence-upload-abort.d.ts +73 -0
- package/dist/evidence-upload-abort.js +69 -0
- package/dist/evidence-upload-extend.d.ts +26 -0
- package/dist/evidence-upload-extend.js +24 -0
- package/dist/evidence-upload.d.ts +29 -72
- package/dist/evidence-upload.js +8 -67
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/upload-failure-class.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The collector giving up on an object it already opened (BLI-2539).
|
|
4
|
+
*
|
|
5
|
+
* `begin` writes a ledger row for every object in the batch, then chunks go one
|
|
6
|
+
* object at a time. When one object's chunks fail its siblings still finish, so
|
|
7
|
+
* the production shape is a single failure among committed rows rather than a
|
|
8
|
+
* truncated batch. The collector knows exactly why that object died — it
|
|
9
|
+
* composes labels like `chunk_0_failed_http_500` — and until this route existed
|
|
10
|
+
* it had nowhere to send them: begin/chunk/commit has no call meaning "I quit".
|
|
11
|
+
* The row stayed `pending` with a null reason until a drain relabelled it
|
|
12
|
+
* `staging_incomplete`, which describes the shape and not the cause. 275 rows
|
|
13
|
+
* reached that state by 2026-08-14.
|
|
14
|
+
*
|
|
15
|
+
* The reason is a label, never free text or an error body: it lands in
|
|
16
|
+
* `status_reason`, which is read by `classifyUploadFailure`, and an unlisted
|
|
17
|
+
* label classifies as `unknown` rather than being guessed into a bucket. That
|
|
18
|
+
* is also what keeps these rows recoverable — `unknown` is not permanent, so
|
|
19
|
+
* the row stays open (still `pending`, staged chunks intact) and the next
|
|
20
|
+
* `begin` resumes it. Only a reason classified permanent fails the row closed.
|
|
21
|
+
*/
|
|
22
|
+
export declare const RawEvidenceUploadAbortRequestSchema: z.ZodObject<{
|
|
23
|
+
schema_version: z.ZodLiteral<"ambient-raw-evidence-upload-abort.v1">;
|
|
24
|
+
generated_at: z.ZodString;
|
|
25
|
+
provenance: z.ZodObject<{
|
|
26
|
+
capture_source: z.ZodEnum<{
|
|
27
|
+
unknown: "unknown";
|
|
28
|
+
codex_jsonl: "codex_jsonl";
|
|
29
|
+
codex_otel: "codex_otel";
|
|
30
|
+
car_state: "car_state";
|
|
31
|
+
git_state: "git_state";
|
|
32
|
+
github_state: "github_state";
|
|
33
|
+
linear_state: "linear_state";
|
|
34
|
+
mcp_local: "mcp_local";
|
|
35
|
+
claude_jsonl: "claude_jsonl";
|
|
36
|
+
claude_hooks: "claude_hooks";
|
|
37
|
+
manual_event: "manual_event";
|
|
38
|
+
collector_runtime: "collector_runtime";
|
|
39
|
+
}>;
|
|
40
|
+
capture_adapter_version: z.ZodString;
|
|
41
|
+
collector_version: z.ZodString;
|
|
42
|
+
repo: z.ZodString;
|
|
43
|
+
branch: z.ZodString;
|
|
44
|
+
repo_label: z.ZodOptional<z.ZodString>;
|
|
45
|
+
repo_fingerprint: z.ZodOptional<z.ZodString>;
|
|
46
|
+
repo_origin_url: z.ZodOptional<z.ZodString>;
|
|
47
|
+
worktree_label: z.ZodOptional<z.ZodString>;
|
|
48
|
+
worktree_fingerprint: z.ZodOptional<z.ZodString>;
|
|
49
|
+
worktree_is_primary: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
operator_id: z.ZodString;
|
|
51
|
+
session_id: z.ZodString;
|
|
52
|
+
work_context_id: z.ZodString;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
upload_id: z.ZodString;
|
|
55
|
+
object_key: z.ZodString;
|
|
56
|
+
reason: z.ZodString;
|
|
57
|
+
uploaded_chunk_count: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
}, z.core.$strict>;
|
|
59
|
+
export type RawEvidenceUploadAbortRequest = z.infer<typeof RawEvidenceUploadAbortRequestSchema>;
|
|
60
|
+
export declare const RawEvidenceUploadAbortResponseSchema: z.ZodObject<{
|
|
61
|
+
ok: z.ZodLiteral<true>;
|
|
62
|
+
status: z.ZodEnum<{
|
|
63
|
+
reason_recorded: "reason_recorded";
|
|
64
|
+
aborted: "aborted";
|
|
65
|
+
already_terminal: "already_terminal";
|
|
66
|
+
}>;
|
|
67
|
+
upload_id: z.ZodString;
|
|
68
|
+
object_key: z.ZodString;
|
|
69
|
+
status_reason: z.ZodString;
|
|
70
|
+
retryable: z.ZodBoolean;
|
|
71
|
+
will_reopen: z.ZodBoolean;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
export type RawEvidenceUploadAbortResponse = z.infer<typeof RawEvidenceUploadAbortResponseSchema>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CaptureProvenanceSchema, IsoDateTimeSchema, NonEmptyStringSchema, } from "./common.js";
|
|
3
|
+
import { SafeLabelSchema } from "./evidence-upload.js";
|
|
4
|
+
/**
|
|
5
|
+
* The collector giving up on an object it already opened (BLI-2539).
|
|
6
|
+
*
|
|
7
|
+
* `begin` writes a ledger row for every object in the batch, then chunks go one
|
|
8
|
+
* object at a time. When one object's chunks fail its siblings still finish, so
|
|
9
|
+
* the production shape is a single failure among committed rows rather than a
|
|
10
|
+
* truncated batch. The collector knows exactly why that object died — it
|
|
11
|
+
* composes labels like `chunk_0_failed_http_500` — and until this route existed
|
|
12
|
+
* it had nowhere to send them: begin/chunk/commit has no call meaning "I quit".
|
|
13
|
+
* The row stayed `pending` with a null reason until a drain relabelled it
|
|
14
|
+
* `staging_incomplete`, which describes the shape and not the cause. 275 rows
|
|
15
|
+
* reached that state by 2026-08-14.
|
|
16
|
+
*
|
|
17
|
+
* The reason is a label, never free text or an error body: it lands in
|
|
18
|
+
* `status_reason`, which is read by `classifyUploadFailure`, and an unlisted
|
|
19
|
+
* label classifies as `unknown` rather than being guessed into a bucket. That
|
|
20
|
+
* is also what keeps these rows recoverable — `unknown` is not permanent, so
|
|
21
|
+
* the row stays open (still `pending`, staged chunks intact) and the next
|
|
22
|
+
* `begin` resumes it. Only a reason classified permanent fails the row closed.
|
|
23
|
+
*/
|
|
24
|
+
export const RawEvidenceUploadAbortRequestSchema = z
|
|
25
|
+
.object({
|
|
26
|
+
schema_version: z.literal("ambient-raw-evidence-upload-abort.v1"),
|
|
27
|
+
generated_at: IsoDateTimeSchema,
|
|
28
|
+
provenance: CaptureProvenanceSchema,
|
|
29
|
+
upload_id: NonEmptyStringSchema,
|
|
30
|
+
object_key: NonEmptyStringSchema,
|
|
31
|
+
reason: SafeLabelSchema,
|
|
32
|
+
// How far the object actually got before the collector gave up. The server
|
|
33
|
+
// already knows the received chunk count; this is what the CLIENT believed,
|
|
34
|
+
// and a disagreement between the two is itself worth being able to see.
|
|
35
|
+
uploaded_chunk_count: z.number().int().nonnegative().optional(),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
export const RawEvidenceUploadAbortResponseSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
ok: z.literal(true),
|
|
41
|
+
// `reason_recorded` is the ordinary answer: the reason landed on the
|
|
42
|
+
// still-open row, whose staged chunks stay resumable by the next `begin`.
|
|
43
|
+
// `aborted` means the reason was classified permanent and the row failed
|
|
44
|
+
// closed. `already_terminal` covers a row the server had already settled —
|
|
45
|
+
// a drain that ran first, or a duplicate abort after a retry. Reporting
|
|
46
|
+
// these back distinguishes "we recorded your reason" from "someone beat
|
|
47
|
+
// you to it", which a bare 200 would hide.
|
|
48
|
+
status: z.enum(["reason_recorded", "aborted", "already_terminal"]),
|
|
49
|
+
upload_id: NonEmptyStringSchema,
|
|
50
|
+
object_key: NonEmptyStringSchema,
|
|
51
|
+
status_reason: SafeLabelSchema,
|
|
52
|
+
// Two booleans because the underlying questions are not each other's
|
|
53
|
+
// negation, and one field would have to lie about half of them.
|
|
54
|
+
//
|
|
55
|
+
// `retryable` is `isRetryableUploadFailure`: is repeating this KNOWN to
|
|
56
|
+
// help? An unclassified reason answers no — refusing to promise something
|
|
57
|
+
// nobody has reasoned about.
|
|
58
|
+
//
|
|
59
|
+
// `will_reopen` is `!isPermanentUploadFailure`: is this row still open (or
|
|
60
|
+
// re-openable) for the next `begin`? An unclassified reason answers yes —
|
|
61
|
+
// refusing to abandon an object over a word it cannot read.
|
|
62
|
+
//
|
|
63
|
+
// So a composed transport label like `chunk_0_failed_http_500` comes back
|
|
64
|
+
// `retryable: false, will_reopen: true`, which is the honest pair: we are
|
|
65
|
+
// not claiming a retry succeeds, and we are not writing the row off.
|
|
66
|
+
retryable: z.boolean(),
|
|
67
|
+
will_reopen: z.boolean(),
|
|
68
|
+
})
|
|
69
|
+
.strict();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* BLI-23345: the base a grown transcript extends. The collector names the snapshot it last committed
|
|
4
|
+
* (it holds the hash and size; the pointer's supersede claim already names the key) and sends only the
|
|
5
|
+
* bytes after `base_byte_size`; the server composes base + tail into the final object. A request with
|
|
6
|
+
* this field plans `chunk_count` over the TAIL, not the final object. Size and count ceilings are the
|
|
7
|
+
* begin route's to enforce (the base must be smaller than a final object that already passed them).
|
|
8
|
+
*/
|
|
9
|
+
export declare const RawEvidenceUploadExtendRequestSchema: z.ZodObject<{
|
|
10
|
+
base_object_key: z.ZodString;
|
|
11
|
+
base_content_hash_sha256: z.ZodString;
|
|
12
|
+
base_byte_size: z.ZodNumber;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export type RawEvidenceUploadExtendRequest = z.infer<typeof RawEvidenceUploadExtendRequestSchema>;
|
|
15
|
+
/** The tail plan the server accepted: the base it will read, where the tail starts, and its geometry. */
|
|
16
|
+
export declare const RawEvidenceUploadExtendAcceptedSchema: z.ZodObject<{
|
|
17
|
+
base_object_key: z.ZodString;
|
|
18
|
+
base_content_hash_sha256: z.ZodString;
|
|
19
|
+
base_byte_size: z.ZodNumber;
|
|
20
|
+
tail_offset: z.ZodNumber;
|
|
21
|
+
tail_size: z.ZodNumber;
|
|
22
|
+
chunk_count: z.ZodNumber;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export type RawEvidenceUploadExtendAccepted = z.infer<typeof RawEvidenceUploadExtendAcceptedSchema>;
|
|
25
|
+
/** Commit refusal: the base object is gone or no longer matches; re-offer the whole object. */
|
|
26
|
+
export declare const EXTEND_BASE_UNAVAILABLE = "extend_base_unavailable";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { NonEmptyStringSchema, Sha256Schema } from "./common.js";
|
|
3
|
+
/**
|
|
4
|
+
* BLI-23345: the base a grown transcript extends. The collector names the snapshot it last committed
|
|
5
|
+
* (it holds the hash and size; the pointer's supersede claim already names the key) and sends only the
|
|
6
|
+
* bytes after `base_byte_size`; the server composes base + tail into the final object. A request with
|
|
7
|
+
* this field plans `chunk_count` over the TAIL, not the final object. Size and count ceilings are the
|
|
8
|
+
* begin route's to enforce (the base must be smaller than a final object that already passed them).
|
|
9
|
+
*/
|
|
10
|
+
export const RawEvidenceUploadExtendRequestSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
base_object_key: NonEmptyStringSchema,
|
|
13
|
+
base_content_hash_sha256: Sha256Schema,
|
|
14
|
+
base_byte_size: z.number().int().positive(),
|
|
15
|
+
})
|
|
16
|
+
.strict();
|
|
17
|
+
/** The tail plan the server accepted: the base it will read, where the tail starts, and its geometry. */
|
|
18
|
+
export const RawEvidenceUploadExtendAcceptedSchema = RawEvidenceUploadExtendRequestSchema.extend({
|
|
19
|
+
tail_offset: z.number().int().positive(),
|
|
20
|
+
tail_size: z.number().int().positive(),
|
|
21
|
+
chunk_count: z.number().int().positive(),
|
|
22
|
+
}).strict();
|
|
23
|
+
/** Commit refusal: the base object is gone or no longer matches; re-offer the whole object. */
|
|
24
|
+
export const EXTEND_BASE_UNAVAILABLE = "extend_base_unavailable";
|
|
@@ -13,6 +13,7 @@ export declare const RAW_EVIDENCE_UPLOAD_MAX_CHUNK_COUNT = 192;
|
|
|
13
13
|
export declare const RAW_EVIDENCE_UPLOAD_MAX_FILE_BYTES: number;
|
|
14
14
|
export declare const RAW_EVIDENCE_UPLOAD_MAX_OBJECTS_PER_BEGIN = 25;
|
|
15
15
|
export declare const CODEX_SESSION_REPORT_MAX_SESSIONS = 200;
|
|
16
|
+
export declare const SafeLabelSchema: z.ZodString;
|
|
16
17
|
/**
|
|
17
18
|
* Receipt returned by the pre-ledger single-shot upload route. Older
|
|
18
19
|
* dashboards still use this path, so the collector must prove that a 2xx
|
|
@@ -128,6 +129,11 @@ export declare const RawEvidenceUploadBeginObjectSchema: z.ZodObject<{
|
|
|
128
129
|
stub_replaced: "stub_replaced";
|
|
129
130
|
}>>;
|
|
130
131
|
}, z.core.$strict>;
|
|
132
|
+
extend: z.ZodOptional<z.ZodObject<{
|
|
133
|
+
base_object_key: z.ZodString;
|
|
134
|
+
base_content_hash_sha256: z.ZodString;
|
|
135
|
+
base_byte_size: z.ZodNumber;
|
|
136
|
+
}, z.core.$strict>>;
|
|
131
137
|
chunk_size_bytes: z.ZodNumber;
|
|
132
138
|
chunk_count: z.ZodNumber;
|
|
133
139
|
image_use: z.ZodOptional<z.ZodObject<{
|
|
@@ -240,6 +246,11 @@ export declare const RawEvidenceUploadBeginRequestSchema: z.ZodObject<{
|
|
|
240
246
|
stub_replaced: "stub_replaced";
|
|
241
247
|
}>>;
|
|
242
248
|
}, z.core.$strict>;
|
|
249
|
+
extend: z.ZodOptional<z.ZodObject<{
|
|
250
|
+
base_object_key: z.ZodString;
|
|
251
|
+
base_content_hash_sha256: z.ZodString;
|
|
252
|
+
base_byte_size: z.ZodNumber;
|
|
253
|
+
}, z.core.$strict>>;
|
|
243
254
|
chunk_size_bytes: z.ZodNumber;
|
|
244
255
|
chunk_count: z.ZodNumber;
|
|
245
256
|
image_use: z.ZodOptional<z.ZodObject<{
|
|
@@ -293,6 +304,15 @@ export declare const RawEvidenceUploadBeginResponseObjectSchema: z.ZodObject<{
|
|
|
293
304
|
zstd: "zstd";
|
|
294
305
|
br: "br";
|
|
295
306
|
}>>>;
|
|
307
|
+
extend: z.ZodOptional<z.ZodObject<{
|
|
308
|
+
base_object_key: z.ZodString;
|
|
309
|
+
base_content_hash_sha256: z.ZodString;
|
|
310
|
+
base_byte_size: z.ZodNumber;
|
|
311
|
+
tail_offset: z.ZodNumber;
|
|
312
|
+
tail_size: z.ZodNumber;
|
|
313
|
+
chunk_count: z.ZodNumber;
|
|
314
|
+
}, z.core.$strict>>;
|
|
315
|
+
extend_refused: z.ZodOptional<z.ZodString>;
|
|
296
316
|
}, z.core.$strict>;
|
|
297
317
|
export type RawEvidenceUploadBeginResponseObject = z.infer<typeof RawEvidenceUploadBeginResponseObjectSchema>;
|
|
298
318
|
export declare const RawEvidenceUploadBeginResponseSchema: z.ZodObject<{
|
|
@@ -319,6 +339,15 @@ export declare const RawEvidenceUploadBeginResponseSchema: z.ZodObject<{
|
|
|
319
339
|
zstd: "zstd";
|
|
320
340
|
br: "br";
|
|
321
341
|
}>>>;
|
|
342
|
+
extend: z.ZodOptional<z.ZodObject<{
|
|
343
|
+
base_object_key: z.ZodString;
|
|
344
|
+
base_content_hash_sha256: z.ZodString;
|
|
345
|
+
base_byte_size: z.ZodNumber;
|
|
346
|
+
tail_offset: z.ZodNumber;
|
|
347
|
+
tail_size: z.ZodNumber;
|
|
348
|
+
chunk_count: z.ZodNumber;
|
|
349
|
+
}, z.core.$strict>>;
|
|
350
|
+
extend_refused: z.ZodOptional<z.ZodString>;
|
|
322
351
|
}, z.core.$strict>>;
|
|
323
352
|
}, z.core.$strict>;
|
|
324
353
|
export type RawEvidenceUploadBeginResponse = z.infer<typeof RawEvidenceUploadBeginResponseSchema>;
|
|
@@ -472,78 +501,6 @@ export declare const RawEvidenceUploadCommitResponseSchema: z.ZodObject<{
|
|
|
472
501
|
}, z.core.$strict>>;
|
|
473
502
|
}, z.core.$strict>;
|
|
474
503
|
export type RawEvidenceUploadCommitResponse = z.infer<typeof RawEvidenceUploadCommitResponseSchema>;
|
|
475
|
-
/**
|
|
476
|
-
* The collector giving up on an object it already opened (BLI-2539).
|
|
477
|
-
*
|
|
478
|
-
* `begin` writes a ledger row for every object in the batch, then chunks go one
|
|
479
|
-
* object at a time. When one object's chunks fail its siblings still finish, so
|
|
480
|
-
* the production shape is a single failure among committed rows rather than a
|
|
481
|
-
* truncated batch. The collector knows exactly why that object died — it
|
|
482
|
-
* composes labels like `chunk_0_failed_http_500` — and until this route existed
|
|
483
|
-
* it had nowhere to send them: begin/chunk/commit has no call meaning "I quit".
|
|
484
|
-
* The row stayed `pending` with a null reason until a drain relabelled it
|
|
485
|
-
* `staging_incomplete`, which describes the shape and not the cause. 275 rows
|
|
486
|
-
* reached that state by 2026-08-14.
|
|
487
|
-
*
|
|
488
|
-
* The reason is a label, never free text or an error body: it lands in
|
|
489
|
-
* `status_reason`, which is read by `classifyUploadFailure`, and an unlisted
|
|
490
|
-
* label classifies as `unknown` rather than being guessed into a bucket. That
|
|
491
|
-
* is also what keeps these rows recoverable — `unknown` is not permanent, so
|
|
492
|
-
* the row stays open (still `pending`, staged chunks intact) and the next
|
|
493
|
-
* `begin` resumes it. Only a reason classified permanent fails the row closed.
|
|
494
|
-
*/
|
|
495
|
-
export declare const RawEvidenceUploadAbortRequestSchema: z.ZodObject<{
|
|
496
|
-
schema_version: z.ZodLiteral<"ambient-raw-evidence-upload-abort.v1">;
|
|
497
|
-
generated_at: z.ZodString;
|
|
498
|
-
provenance: z.ZodObject<{
|
|
499
|
-
capture_source: z.ZodEnum<{
|
|
500
|
-
unknown: "unknown";
|
|
501
|
-
codex_jsonl: "codex_jsonl";
|
|
502
|
-
codex_otel: "codex_otel";
|
|
503
|
-
car_state: "car_state";
|
|
504
|
-
git_state: "git_state";
|
|
505
|
-
github_state: "github_state";
|
|
506
|
-
linear_state: "linear_state";
|
|
507
|
-
mcp_local: "mcp_local";
|
|
508
|
-
claude_jsonl: "claude_jsonl";
|
|
509
|
-
claude_hooks: "claude_hooks";
|
|
510
|
-
manual_event: "manual_event";
|
|
511
|
-
collector_runtime: "collector_runtime";
|
|
512
|
-
}>;
|
|
513
|
-
capture_adapter_version: z.ZodString;
|
|
514
|
-
collector_version: z.ZodString;
|
|
515
|
-
repo: z.ZodString;
|
|
516
|
-
branch: z.ZodString;
|
|
517
|
-
repo_label: z.ZodOptional<z.ZodString>;
|
|
518
|
-
repo_fingerprint: z.ZodOptional<z.ZodString>;
|
|
519
|
-
repo_origin_url: z.ZodOptional<z.ZodString>;
|
|
520
|
-
worktree_label: z.ZodOptional<z.ZodString>;
|
|
521
|
-
worktree_fingerprint: z.ZodOptional<z.ZodString>;
|
|
522
|
-
worktree_is_primary: z.ZodOptional<z.ZodBoolean>;
|
|
523
|
-
operator_id: z.ZodString;
|
|
524
|
-
session_id: z.ZodString;
|
|
525
|
-
work_context_id: z.ZodString;
|
|
526
|
-
}, z.core.$strict>;
|
|
527
|
-
upload_id: z.ZodString;
|
|
528
|
-
object_key: z.ZodString;
|
|
529
|
-
reason: z.ZodString;
|
|
530
|
-
uploaded_chunk_count: z.ZodOptional<z.ZodNumber>;
|
|
531
|
-
}, z.core.$strict>;
|
|
532
|
-
export type RawEvidenceUploadAbortRequest = z.infer<typeof RawEvidenceUploadAbortRequestSchema>;
|
|
533
|
-
export declare const RawEvidenceUploadAbortResponseSchema: z.ZodObject<{
|
|
534
|
-
ok: z.ZodLiteral<true>;
|
|
535
|
-
status: z.ZodEnum<{
|
|
536
|
-
reason_recorded: "reason_recorded";
|
|
537
|
-
aborted: "aborted";
|
|
538
|
-
already_terminal: "already_terminal";
|
|
539
|
-
}>;
|
|
540
|
-
upload_id: z.ZodString;
|
|
541
|
-
object_key: z.ZodString;
|
|
542
|
-
status_reason: z.ZodString;
|
|
543
|
-
retryable: z.ZodBoolean;
|
|
544
|
-
will_reopen: z.ZodBoolean;
|
|
545
|
-
}, z.core.$strict>;
|
|
546
|
-
export type RawEvidenceUploadAbortResponse = z.infer<typeof RawEvidenceUploadAbortResponseSchema>;
|
|
547
504
|
/**
|
|
548
505
|
* Codex session attribution report.
|
|
549
506
|
*
|
package/dist/evidence-upload.js
CHANGED
|
@@ -4,6 +4,7 @@ import { ImageUseSchema } from "./image-store.js";
|
|
|
4
4
|
import { RawEvidencePointerSchema } from "./privacy.js";
|
|
5
5
|
import { RawEvidenceRedactionMetadataSchema } from "./secret-guards.js";
|
|
6
6
|
import { SessionFactsSchema } from "./session-facts.js";
|
|
7
|
+
import { RawEvidenceUploadExtendAcceptedSchema, RawEvidenceUploadExtendRequestSchema } from "./evidence-upload-extend.js";
|
|
7
8
|
/**
|
|
8
9
|
* Chunked raw-evidence upload wire contract.
|
|
9
10
|
*
|
|
@@ -39,7 +40,7 @@ export const RAW_EVIDENCE_UPLOAD_MAX_CHUNK_COUNT = 192;
|
|
|
39
40
|
export const RAW_EVIDENCE_UPLOAD_MAX_FILE_BYTES = 500 * 1024 * 1024;
|
|
40
41
|
export const RAW_EVIDENCE_UPLOAD_MAX_OBJECTS_PER_BEGIN = 25;
|
|
41
42
|
export const CODEX_SESSION_REPORT_MAX_SESSIONS = 200;
|
|
42
|
-
const SafeLabelSchema = z
|
|
43
|
+
export const SafeLabelSchema = z
|
|
43
44
|
.string()
|
|
44
45
|
.trim()
|
|
45
46
|
.min(1)
|
|
@@ -74,6 +75,7 @@ export const RawEvidenceLegacyUploadResponseSchema = z
|
|
|
74
75
|
export const RawEvidenceUploadBeginObjectSchema = z
|
|
75
76
|
.object({
|
|
76
77
|
pointer: RawEvidencePointerSchema,
|
|
78
|
+
extend: RawEvidenceUploadExtendRequestSchema.optional(),
|
|
77
79
|
chunk_size_bytes: z
|
|
78
80
|
.number()
|
|
79
81
|
.int()
|
|
@@ -135,6 +137,11 @@ export const RawEvidenceUploadBeginResponseObjectSchema = z
|
|
|
135
137
|
// `EVIDENCE_CODECS_HEADER`; this schema is strict, so an old collector must never be shown the
|
|
136
138
|
// key. Absent means gzip only.
|
|
137
139
|
accepted_encodings: z.array(RawEvidenceUploadEncodingSchema).optional(),
|
|
140
|
+
// BLI-23345: present only on an answer to a request that carried `extend`. `extend` is the accepted
|
|
141
|
+
// tail plan (chunk indexes below count the TAIL); `extend_refused` names why the server opened a
|
|
142
|
+
// whole-object plan instead.
|
|
143
|
+
extend: RawEvidenceUploadExtendAcceptedSchema.optional(),
|
|
144
|
+
extend_refused: SafeLabelSchema.optional(),
|
|
138
145
|
})
|
|
139
146
|
.strict();
|
|
140
147
|
export const RawEvidenceUploadBeginResponseSchema = z
|
|
@@ -197,72 +204,6 @@ export const RawEvidenceUploadCommitResponseSchema = z
|
|
|
197
204
|
redaction: RawEvidenceRedactionMetadataSchema.optional(),
|
|
198
205
|
})
|
|
199
206
|
.strict();
|
|
200
|
-
/**
|
|
201
|
-
* The collector giving up on an object it already opened (BLI-2539).
|
|
202
|
-
*
|
|
203
|
-
* `begin` writes a ledger row for every object in the batch, then chunks go one
|
|
204
|
-
* object at a time. When one object's chunks fail its siblings still finish, so
|
|
205
|
-
* the production shape is a single failure among committed rows rather than a
|
|
206
|
-
* truncated batch. The collector knows exactly why that object died — it
|
|
207
|
-
* composes labels like `chunk_0_failed_http_500` — and until this route existed
|
|
208
|
-
* it had nowhere to send them: begin/chunk/commit has no call meaning "I quit".
|
|
209
|
-
* The row stayed `pending` with a null reason until a drain relabelled it
|
|
210
|
-
* `staging_incomplete`, which describes the shape and not the cause. 275 rows
|
|
211
|
-
* reached that state by 2026-08-14.
|
|
212
|
-
*
|
|
213
|
-
* The reason is a label, never free text or an error body: it lands in
|
|
214
|
-
* `status_reason`, which is read by `classifyUploadFailure`, and an unlisted
|
|
215
|
-
* label classifies as `unknown` rather than being guessed into a bucket. That
|
|
216
|
-
* is also what keeps these rows recoverable — `unknown` is not permanent, so
|
|
217
|
-
* the row stays open (still `pending`, staged chunks intact) and the next
|
|
218
|
-
* `begin` resumes it. Only a reason classified permanent fails the row closed.
|
|
219
|
-
*/
|
|
220
|
-
export const RawEvidenceUploadAbortRequestSchema = z
|
|
221
|
-
.object({
|
|
222
|
-
schema_version: z.literal("ambient-raw-evidence-upload-abort.v1"),
|
|
223
|
-
generated_at: IsoDateTimeSchema,
|
|
224
|
-
provenance: CaptureProvenanceSchema,
|
|
225
|
-
upload_id: NonEmptyStringSchema,
|
|
226
|
-
object_key: NonEmptyStringSchema,
|
|
227
|
-
reason: SafeLabelSchema,
|
|
228
|
-
// How far the object actually got before the collector gave up. The server
|
|
229
|
-
// already knows the received chunk count; this is what the CLIENT believed,
|
|
230
|
-
// and a disagreement between the two is itself worth being able to see.
|
|
231
|
-
uploaded_chunk_count: z.number().int().nonnegative().optional(),
|
|
232
|
-
})
|
|
233
|
-
.strict();
|
|
234
|
-
export const RawEvidenceUploadAbortResponseSchema = z
|
|
235
|
-
.object({
|
|
236
|
-
ok: z.literal(true),
|
|
237
|
-
// `reason_recorded` is the ordinary answer: the reason landed on the
|
|
238
|
-
// still-open row, whose staged chunks stay resumable by the next `begin`.
|
|
239
|
-
// `aborted` means the reason was classified permanent and the row failed
|
|
240
|
-
// closed. `already_terminal` covers a row the server had already settled —
|
|
241
|
-
// a drain that ran first, or a duplicate abort after a retry. Reporting
|
|
242
|
-
// these back distinguishes "we recorded your reason" from "someone beat
|
|
243
|
-
// you to it", which a bare 200 would hide.
|
|
244
|
-
status: z.enum(["reason_recorded", "aborted", "already_terminal"]),
|
|
245
|
-
upload_id: NonEmptyStringSchema,
|
|
246
|
-
object_key: NonEmptyStringSchema,
|
|
247
|
-
status_reason: SafeLabelSchema,
|
|
248
|
-
// Two booleans because the underlying questions are not each other's
|
|
249
|
-
// negation, and one field would have to lie about half of them.
|
|
250
|
-
//
|
|
251
|
-
// `retryable` is `isRetryableUploadFailure`: is repeating this KNOWN to
|
|
252
|
-
// help? An unclassified reason answers no — refusing to promise something
|
|
253
|
-
// nobody has reasoned about.
|
|
254
|
-
//
|
|
255
|
-
// `will_reopen` is `!isPermanentUploadFailure`: is this row still open (or
|
|
256
|
-
// re-openable) for the next `begin`? An unclassified reason answers yes —
|
|
257
|
-
// refusing to abandon an object over a word it cannot read.
|
|
258
|
-
//
|
|
259
|
-
// So a composed transport label like `chunk_0_failed_http_500` comes back
|
|
260
|
-
// `retryable: false, will_reopen: true`, which is the honest pair: we are
|
|
261
|
-
// not claiming a retry succeeds, and we are not writing the row off.
|
|
262
|
-
retryable: z.boolean(),
|
|
263
|
-
will_reopen: z.boolean(),
|
|
264
|
-
})
|
|
265
|
-
.strict();
|
|
266
207
|
/**
|
|
267
208
|
* Codex session attribution report.
|
|
268
209
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export * from "./evidence-rules-fingerprint.js";
|
|
|
11
11
|
export * from "./evidence-stubs.js";
|
|
12
12
|
export * from "./evidence-transcripts.js";
|
|
13
13
|
export * from "./evidence-upload.js";
|
|
14
|
+
export * from "./evidence-upload-abort.js";
|
|
15
|
+
export * from "./evidence-upload-extend.js";
|
|
14
16
|
export * from "./image-description-store.js";
|
|
15
17
|
export * from "./image-descriptions.js";
|
|
16
18
|
export * from "./image-marker-resolver.js";
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export * from "./evidence-rules-fingerprint.js";
|
|
|
11
11
|
export * from "./evidence-stubs.js";
|
|
12
12
|
export * from "./evidence-transcripts.js";
|
|
13
13
|
export * from "./evidence-upload.js";
|
|
14
|
+
export * from "./evidence-upload-abort.js";
|
|
15
|
+
export * from "./evidence-upload-extend.js";
|
|
14
16
|
export * from "./image-description-store.js";
|
|
15
17
|
export * from "./image-descriptions.js";
|
|
16
18
|
export * from "./image-marker-resolver.js";
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
// stripped only when the remaining stem is itself a listed reason — see
|
|
20
20
|
// `baseUploadFailureReason` — so the table still decides everything and an
|
|
21
21
|
// unreasoned-about stem stays `unknown`.
|
|
22
|
+
import { EXTEND_BASE_UNAVAILABLE } from "./evidence-upload-extend.js";
|
|
22
23
|
/**
|
|
23
24
|
* The reason written when nothing in the pipeline explained itself.
|
|
24
25
|
*
|
|
@@ -237,6 +238,11 @@ const UPLOAD_FAILURE_CLASSES = {
|
|
|
237
238
|
// the final write uses `upsert: false` on purpose, so the row would loop as
|
|
238
239
|
// `skipped_storage_error` for as long as anyone kept running the pass.
|
|
239
240
|
object_key_holds_other_content: "deterministic",
|
|
241
|
+
// BLI-23345. A tail upload whose base vanished (commit) or whose staging only ever held the tail
|
|
242
|
+
// (drain). The collector still holds the whole staged file and the next `begin` without a tail plan
|
|
243
|
+
// resets the row, so the identical retry is exactly right.
|
|
244
|
+
[EXTEND_BASE_UNAVAILABLE]: "transient",
|
|
245
|
+
extend_row_needs_whole_upload: "transient",
|
|
240
246
|
// Attribution never produced a target, so there is nowhere to put the object.
|
|
241
247
|
// Widening discovery can change this; running the same scan again cannot.
|
|
242
248
|
cwd_outside_scanned_worktrees: "deterministic",
|