@frockbot/kernel-contracts 0.3.7 → 0.3.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frockbot/kernel-contracts",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,6 +14,38 @@ export class LlmEffectNotStartedError extends Error {
14
14
  }
15
15
  }
16
16
 
17
+ /**
18
+ * What a person is told when a model request produced nothing at all.
19
+ *
20
+ * The same register as the Turn deadline copy: what happened, and what to do
21
+ * about it. The phase, the provider and the millisecond count are diagnostics
22
+ * and belong in the log, not on a person's screen.
23
+ */
24
+ export const MODEL_FIRST_BYTE_DEADLINE_REASON_V1 =
25
+ "The model did not start replying within 2 minutes and the request was stopped. Try sending it again.";
26
+
27
+ /** What a person is told when a reply started and then went silent. */
28
+ export const MODEL_IDLE_DEADLINE_REASON_V1 =
29
+ "The model stopped part-way through its reply and went quiet for a minute, so the request was stopped. Try sending it again.";
30
+
31
+ /**
32
+ * Time allowed from sending a model request to its first stream event.
33
+ *
34
+ * Two minutes to say anything at all is generous for a chat completion and
35
+ * still far inside the fifteen-minute Turn deadline, which before this was the
36
+ * only bound anywhere and far too long to read as an answer.
37
+ */
38
+ export const MODEL_FIRST_BYTE_DEADLINE_MS_V1 = 120_000;
39
+
40
+ /**
41
+ * Time allowed between two stream events once the answer has started.
42
+ *
43
+ * Shorter than the first-byte allowance on purpose: a stream that has already
44
+ * produced a chunk has proved the model is generating, so a minute of silence
45
+ * after that is a dead socket rather than a slow start.
46
+ */
47
+ export const MODEL_IDLE_DEADLINE_MS_V1 = 60_000;
48
+
17
49
  /**
18
50
  * A model request that ran out of time.
19
51
  *
@@ -24,7 +56,8 @@ export class LlmEffectNotStartedError extends Error {
24
56
  * later, with words already on screen.
25
57
  *
26
58
  * Either is a real answer where before there was none: a Turn with no deadline
27
- * anywhere hung for seventeen minutes showing nothing at all.
59
+ * anywhere hung for seventeen minutes showing nothing at all. The message is
60
+ * the copy a person reads, so it says nothing the caller could vary.
28
61
  */
29
62
  export class ModelRequestDeadlineError extends Error {
30
63
  constructor(
@@ -33,8 +66,8 @@ export class ModelRequestDeadlineError extends Error {
33
66
  ) {
34
67
  super(
35
68
  phase === "first-byte"
36
- ? `Model request produced nothing within ${Math.round(milliseconds / 1000)}s`
37
- : `Model response stalled for ${Math.round(milliseconds / 1000)}s`,
69
+ ? MODEL_FIRST_BYTE_DEADLINE_REASON_V1
70
+ : MODEL_IDLE_DEADLINE_REASON_V1,
38
71
  );
39
72
  this.name = "ModelRequestDeadlineError";
40
73
  }
@@ -48,17 +81,10 @@ export interface ModelRequestDeadlinesV1 {
48
81
  idleMs: number;
49
82
  }
50
83
 
51
- /**
52
- * The defaults every provider gets unless its Package names others.
53
- *
54
- * Two minutes to say anything at all is generous for a chat completion and
55
- * still an order of magnitude inside the wall-clock a person will wait; the
56
- * same allowance between chunks tolerates a slow tool-call assembly without
57
- * tolerating a dead socket.
58
- */
84
+ /** The defaults every provider gets unless its Package names others. */
59
85
  export const MODEL_REQUEST_DEADLINES_V1: ModelRequestDeadlinesV1 = {
60
- firstByteMs: 120_000,
61
- idleMs: 120_000,
86
+ firstByteMs: MODEL_FIRST_BYTE_DEADLINE_MS_V1,
87
+ idleMs: MODEL_IDLE_DEADLINE_MS_V1,
62
88
  };
63
89
 
64
90
  export type LlmReconciliationOutcome =