@orkestrel/agent 0.0.32 → 0.0.34

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.
@@ -318,7 +318,7 @@ export declare interface AgentContextInterface {
318
318
  * `workspaces.active` is set, its
319
319
  * {@link import('@orkestrel/workspace').WorkspaceInterface.files} are filtered by
320
320
  * `scope.files` (a three-way allow-list; `undefined` ⇒ all active files), then split by
321
- * carrier: text files ({@link import('@orkestrel/workspace').isText}) render into a dedicated
321
+ * carrier: text files ({@link import('@orkestrel/workspace').isTextContent}) render into a dedicated
322
322
  * `## Workspace` section in the system block — each a fenced
323
323
  * `` File: <path>\n```<language>\n<text>\n``` `` block whose fence is one backtick longer than
324
324
  * the longest backtick run in the text, and never shorter than three — placed immediately after
@@ -691,7 +691,7 @@ export declare interface AgentInterface {
691
691
  */
692
692
  export declare class AgentJobError extends Error {
693
693
  /** Names the machine-readable condition — `'PARTIAL'`: a job that ended partial under a disallowing policy. */
694
- readonly code: "PARTIAL";
694
+ readonly code: 'PARTIAL';
695
695
  /** Holds the partial {@link AgentResult} the cancelled job produced. */
696
696
  readonly partial: AgentResult;
697
697
  constructor(message: string, partial: AgentResult);
@@ -1543,7 +1543,7 @@ export declare interface AgentTurn {
1543
1543
  readonly usage: TokenUsage | undefined;
1544
1544
  readonly spent: TokenUsage | undefined;
1545
1545
  readonly messages: readonly Message[];
1546
- readonly ending: 'answer' | 'tools' | 'cancel';
1546
+ readonly outcome: 'answer' | 'tools' | 'cancel';
1547
1547
  readonly partial: boolean;
1548
1548
  readonly futile: boolean;
1549
1549
  readonly estimate: number | undefined;
@@ -4616,7 +4616,7 @@ export declare interface GaugeInterface extends LedgerGauge {
4616
4616
  * `'CAPACITY'` otherwise. `replay` names the thinking the next request carries. Default: `'none'`.
4617
4617
  * Measured use is `prompt + completion - (thinking ?? 0)` for `'none'`, and `prompt + completion`
4618
4618
  * otherwise; absent completion counts as 0. Without prompt usage, use is `overhead + scale * estimate`.
4619
- * Capacity left is `max(0, capacity - used)`. The reply reserve adds recall framing at the marginal
4619
+ * Capacity left is `max(0, capacity - used)`. The reply reserve adds recall uniform at the marginal
4620
4620
  * rate to the largest observed reply's `completion - (thinking ?? 0)` for every policy.
4621
4621
  * Without a positive reply observation, it prices the longest reply text at that rate. Recall room is
4622
4622
  * `max(0, (remainder - predict - reserve) / 2 / rate)`; recall closes at `remainder - predict < 2 * reserve`.
@@ -5008,7 +5008,7 @@ export declare function intersectKeys(parent: readonly string[] | undefined, chi
5008
5008
  export declare const INVALID_RELAY_STATUS = 400;
5009
5009
 
5010
5010
  /**
5011
- * Narrows an unknown caught value to an {@link AgentError} through `instanceof`, so a `catch`
5011
+ * Narrows an unknown caught value to an {@link AgentError} through its identity brand and declared members, so a `catch`
5012
5012
  * can branch on its `code`.
5013
5013
  *
5014
5014
  * @param value - The value to test (typically a `catch` binding)
@@ -5026,7 +5026,7 @@ export declare const INVALID_RELAY_STATUS = 400;
5026
5026
  export declare function isAgentError(value: unknown): value is AgentError;
5027
5027
 
5028
5028
  /**
5029
- * Narrows an unknown caught value to an {@link AgentJobError} through `instanceof`, so a
5029
+ * Narrows an unknown caught value to an {@link AgentJobError} through its identity brand and declared members, so a
5030
5030
  * `catch` can recover its `partial` result.
5031
5031
  *
5032
5032
  * @param value - The value to test (typically a `catch` binding or a rejected enqueue)
@@ -5044,7 +5044,7 @@ export declare function isAgentError(value: unknown): value is AgentError;
5044
5044
  export declare function isAgentJobError(value: unknown): value is AgentJobError;
5045
5045
 
5046
5046
  /**
5047
- * Narrows an unknown caught value to a {@link ConversationError} through `instanceof`, so a
5047
+ * Narrows an unknown caught value to a {@link ConversationError} through its identity brand and declared members, so a
5048
5048
  * `catch` can branch on its `code`.
5049
5049
  *
5050
5050
  * @param value - The value to test (typically a `catch` binding)
@@ -5106,7 +5106,7 @@ export declare function isConversationSnapshot(value: unknown): value is Convers
5106
5106
  export declare function isFraction(value: unknown): value is number;
5107
5107
 
5108
5108
  /**
5109
- * Narrows a caught value to a {@link JudgeAbortError} through `instanceof`, so a `catch` can
5109
+ * Narrows a caught value to a {@link JudgeAbortError} through its identity brand and declared members, so a `catch` can
5110
5110
  * recover its `partial` result.
5111
5111
  *
5112
5112
  * @param value - The caught value
@@ -5138,7 +5138,7 @@ export declare function isJudgeAbortError(value: unknown): value is JudgeAbortEr
5138
5138
  export declare function isJudgeEntry(value: unknown): value is JudgeEntry;
5139
5139
 
5140
5140
  /**
5141
- * Narrows a caught value to the judge failure class through `instanceof`.
5141
+ * Narrows a caught value to the judge failure class through its identity brand and declared members.
5142
5142
  *
5143
5143
  * @param value - The caught value
5144
5144
  * @returns True if the value is a {@link JudgeError}; false otherwise
@@ -5191,7 +5191,7 @@ export declare function isJudgeQuestion(value: unknown): value is JudgeQuestion;
5191
5191
  export declare function isJudgment(value: unknown): value is Judgment;
5192
5192
 
5193
5193
  /**
5194
- * Narrows an unknown caught value to a {@link LedgerError} through `instanceof`, so a `catch` can
5194
+ * Narrows an unknown caught value to a {@link LedgerError} through its identity brand and declared members, so a `catch` can
5195
5195
  * branch on its `code`.
5196
5196
  *
5197
5197
  * @param value - The value to test (typically a `catch` binding)
@@ -5258,7 +5258,7 @@ export declare function isNonNegativeSafeInteger(value: unknown): value is numbe
5258
5258
  export declare function isPositiveSafeInteger(value: unknown): value is number;
5259
5259
 
5260
5260
  /**
5261
- * Narrows an unknown caught value to a {@link ProviderAbortError} through `instanceof`, so a
5261
+ * Narrows an unknown caught value to a {@link ProviderAbortError} through its identity brand and declared members, so a
5262
5262
  * `catch` can recover its `partial` result.
5263
5263
  *
5264
5264
  * @param value - The value to test (typically a `catch` binding)
@@ -5276,7 +5276,7 @@ export declare function isPositiveSafeInteger(value: unknown): value is number;
5276
5276
  export declare function isProviderAbortError(value: unknown): value is ProviderAbortError;
5277
5277
 
5278
5278
  /**
5279
- * Narrows a caught value to the provider failure class through `instanceof`.
5279
+ * Narrows a caught value to the provider failure class through its identity brand and declared members.
5280
5280
  *
5281
5281
  * @param value - The caught value
5282
5282
  * @returns True if the value is a provider failure; false otherwise
@@ -5388,7 +5388,7 @@ export declare function joinThinking(running: string | undefined, next: string):
5388
5388
  */
5389
5389
  export declare class JudgeAbortError extends Error {
5390
5390
  /** Names the machine-readable condition — `'ABORT'`: a judge call cancelled mid-flight. */
5391
- readonly code: "ABORT";
5391
+ readonly code: 'ABORT';
5392
5392
  readonly partial: JudgeResult;
5393
5393
  constructor(partial: JudgeResult, options?: ErrorOptions);
5394
5394
  }
@@ -5970,7 +5970,7 @@ export declare interface LedgerOwner {
5970
5970
  }
5971
5971
 
5972
5972
  /** Names a briefing source's planning group: a topic match, an off-topic rule or correction, or a name match. */
5973
- export declare type LedgerPlanningGroup = 1 | 2 | 3;
5973
+ export declare type LedgerPlanGroup = 1 | 2 | 3;
5974
5974
 
5975
5975
  /**
5976
5976
  * Carries the records projected from a conversation, accepted amendments, and the live messages no
@@ -6457,7 +6457,7 @@ export declare const MAX_ERROR_BODY_LENGTH = 2048;
6457
6457
  * @remarks
6458
6458
  * The result is a structural estimate, not a tokenizer allocation. `id` and `role` are joins back to
6459
6459
  * the message, not token components, and a provider's template effects and the estimation error are
6460
- * not individually attributed. `content` is `ceil(length / 4)`, `framing` is
6460
+ * not individually attributed. `content` is `ceil(length / 4)`, `uniform` is
6461
6461
  * {@link import('./constants.js').MESSAGE_TOKEN_OVERHEAD}, `calls` is the estimate of the JSON-rendered
6462
6462
  * calls (`0` when the message carries none, the framing overhead when they cannot be rendered),
6463
6463
  * `thinking` is the estimate of the thinking (`0` when absent), and `images` is the attached image
@@ -6469,7 +6469,7 @@ export declare const MAX_ERROR_BODY_LENGTH = 2048;
6469
6469
  * @example
6470
6470
  * ```ts
6471
6471
  * measureMessage({ id: '1', role: 'user', content: 'hello' })
6472
- * // { id: '1', role: 'user', content: 2, framing: 4, calls: 0, thinking: 0, images: 0 }
6472
+ * // { id: '1', role: 'user', content: 2, uniform: 4, calls: 0, thinking: 0, images: 0 }
6473
6473
  * ```
6474
6474
  */
6475
6475
  export declare function measureMessage(message: Message): MessageMeasure;
@@ -6493,7 +6493,7 @@ export declare function measureMessage(message: Message): MessageMeasure;
6493
6493
  * @example
6494
6494
  * ```ts
6495
6495
  * measureRequest({ messages: [{ id: '1', role: 'user', content: 'hello' }] })
6496
- * // { messages: [{ id: '1', role: 'user', content: 2, framing: 4, calls: 0, thinking: 0, images: 0 }], tools: 0, schema: 0 }
6496
+ * // { messages: [{ id: '1', role: 'user', content: 2, uniform: 4, calls: 0, thinking: 0, images: 0 }], tools: 0, schema: 0 }
6497
6497
  * ```
6498
6498
  */
6499
6499
  export declare function measureRequest(request: ProviderRequest): RequestMeasure;
@@ -6620,7 +6620,7 @@ export declare const MESSAGE_TOKEN_OVERHEAD = 4;
6620
6620
  /** Validates and projects conversation messages at a JSON wire boundary. */
6621
6621
  export declare const messageContract: ContractInterface<Readonly<{
6622
6622
  id: string;
6623
- role: "system" | "user" | "assistant" | "tool";
6623
+ role: "assistant" | "system" | "tool" | "user";
6624
6624
  content: string;
6625
6625
  } & {
6626
6626
  calls?: readonly Readonly<{
@@ -6718,7 +6718,7 @@ export declare interface MessageManagerInterface {
6718
6718
  *
6719
6719
  * @remarks
6720
6720
  * The structural estimate is not a tokenizer allocation. `id` and `role` are joins back to the
6721
- * message, not token components. A message's estimate is the sum of `content`, `framing`, `calls`,
6721
+ * message, not token components. A message's estimate is the sum of `content`, `uniform`, `calls`,
6722
6722
  * `thinking`, and `images`; no total is stored. A provider's template effects and the estimation
6723
6723
  * error are not individually attributed.
6724
6724
  */
@@ -6727,9 +6727,9 @@ export declare interface MessageMeasure {
6727
6727
  readonly role: MessageRole;
6728
6728
  /** Holds the `ceil(length / 4)` estimate of the message `content`. */
6729
6729
  readonly content: number;
6730
- /** Holds the fixed per-message framing overhead. */
6731
- readonly framing: number;
6732
- /** Holds the estimate of the JSON-rendered `calls`, or the framing overhead when they cannot be rendered; `0` when the message carries none. */
6730
+ /** Holds the fixed per-message uniform overhead. */
6731
+ readonly uniform: number;
6732
+ /** Holds the estimate of the JSON-rendered `calls`, or the uniform overhead when they cannot be rendered; `0` when the message carries none. */
6733
6733
  readonly calls: number;
6734
6734
  /** Holds the estimate of the message `thinking`; `0` when absent. */
6735
6735
  readonly thinking: number;
@@ -6854,7 +6854,7 @@ export declare function placeMember(input: LedgerProjectionInput, links: Readonl
6854
6854
  */
6855
6855
  export declare class ProviderAbortError extends Error {
6856
6856
  /** Names the machine-readable condition — `'ABORT'`: a stream cancelled mid-flight. */
6857
- readonly code: "ABORT";
6857
+ readonly code: 'ABORT';
6858
6858
  readonly partial: ProviderResult;
6859
6859
  constructor(partial: ProviderResult, options?: ErrorOptions);
6860
6860
  }
@@ -7015,7 +7015,7 @@ export declare interface ProviderRequest {
7015
7015
  export declare const providerRequestContract: ContractInterface<Readonly<{
7016
7016
  messages: readonly Readonly<{
7017
7017
  id: string;
7018
- role: "system" | "user" | "assistant" | "tool";
7018
+ role: "assistant" | "system" | "tool" | "user";
7019
7019
  content: string;
7020
7020
  } & {
7021
7021
  calls?: readonly Readonly<{
@@ -7230,7 +7230,30 @@ export declare function raceSignal<T>(promise: Promise<T>, signal: AbortSignal |
7230
7230
  * rankLedgerCut(2, false, 'rule') // 3
7231
7231
  * ```
7232
7232
  */
7233
- export declare function rankLedgerCut(group: LedgerPlanningGroup, unsettled: boolean, category: LedgerCategory | undefined): number;
7233
+ export declare function rankLedgerCut(group: LedgerPlanGroup, unsettled: boolean, category: LedgerCategory | undefined): number;
7234
+
7235
+ /**
7236
+ * Reads a UTF-8 prefix of a byte stream and cancels its remainder.
7237
+ *
7238
+ * @remarks
7239
+ * The `limit` parameter bounds bytes passed to the decoder, including a partial final
7240
+ * character. An omitted limit reads to completion. A source may deliver a chunk larger
7241
+ * than the remaining limit; its unused bytes are discarded without decoding.
7242
+ * The read can overshoot by one source chunk. An abort leaves completion false.
7243
+ *
7244
+ * @param body - The readable byte stream
7245
+ * @param limit - The maximum byte prefix, or undefined for the complete stream
7246
+ * @param signal - The optional cancellation bound; abort returns the decoded prefix
7247
+ * @returns The decoded prefix and whether EOF occurred within the byte budget
7248
+ * @example
7249
+ * ```ts
7250
+ * import { readBodyText } from '@orkestrel/agent'
7251
+ *
7252
+ * const body = new Response('answer').body
7253
+ * if (body !== null) await readBodyText(body, 3) // { text: 'ans', complete: false }
7254
+ * ```
7255
+ */
7256
+ export declare function readBodyText(body: ReadableStream<Uint8Array>, limit?: number, signal?: AbortSignal): Promise<TextRead>;
7234
7257
 
7235
7258
  /**
7236
7259
  * Decodes UTF-8 chunks with a final flush and releases the stream on every exit.
@@ -7279,29 +7302,6 @@ export declare interface Reading {
7279
7302
  readonly score?: number;
7280
7303
  }
7281
7304
 
7282
- /**
7283
- * Reads a UTF-8 prefix of a byte stream and cancels its remainder.
7284
- *
7285
- * @remarks
7286
- * The `limit` parameter bounds bytes passed to the decoder, including a partial final
7287
- * character. An omitted limit reads to completion. A source may deliver a chunk larger
7288
- * than the remaining limit; its unused bytes are discarded without decoding.
7289
- * The read can overshoot by one source chunk. An abort leaves completion false.
7290
- *
7291
- * @param body - The readable byte stream
7292
- * @param limit - The maximum byte prefix, or undefined for the complete stream
7293
- * @param signal - The optional cancellation bound; abort returns the decoded prefix
7294
- * @returns The decoded prefix and whether EOF occurred within the byte budget
7295
- * @example
7296
- * ```ts
7297
- * import { readText } from '@orkestrel/agent'
7298
- *
7299
- * const body = new Response('answer').body
7300
- * if (body !== null) await readText(body, 3) // { text: 'ans', complete: false }
7301
- * ```
7302
- */
7303
- export declare function readText(body: ReadableStream<Uint8Array>, limit?: number, signal?: AbortSignal): Promise<TextRead>;
7304
-
7305
7305
  /** Reports a question a wire could not read a candidate for; it lists the caller's keys and invents no probability. */
7306
7306
  export declare interface Refusal {
7307
7307
  readonly missing: readonly string[];
@@ -318,7 +318,7 @@ export declare interface AgentContextInterface {
318
318
  * `workspaces.active` is set, its
319
319
  * {@link import('@orkestrel/workspace').WorkspaceInterface.files} are filtered by
320
320
  * `scope.files` (a three-way allow-list; `undefined` ⇒ all active files), then split by
321
- * carrier: text files ({@link import('@orkestrel/workspace').isText}) render into a dedicated
321
+ * carrier: text files ({@link import('@orkestrel/workspace').isTextContent}) render into a dedicated
322
322
  * `## Workspace` section in the system block — each a fenced
323
323
  * `` File: <path>\n```<language>\n<text>\n``` `` block whose fence is one backtick longer than
324
324
  * the longest backtick run in the text, and never shorter than three — placed immediately after
@@ -691,7 +691,7 @@ export declare interface AgentInterface {
691
691
  */
692
692
  export declare class AgentJobError extends Error {
693
693
  /** Names the machine-readable condition — `'PARTIAL'`: a job that ended partial under a disallowing policy. */
694
- readonly code: "PARTIAL";
694
+ readonly code: 'PARTIAL';
695
695
  /** Holds the partial {@link AgentResult} the cancelled job produced. */
696
696
  readonly partial: AgentResult;
697
697
  constructor(message: string, partial: AgentResult);
@@ -1543,7 +1543,7 @@ export declare interface AgentTurn {
1543
1543
  readonly usage: TokenUsage | undefined;
1544
1544
  readonly spent: TokenUsage | undefined;
1545
1545
  readonly messages: readonly Message[];
1546
- readonly ending: 'answer' | 'tools' | 'cancel';
1546
+ readonly outcome: 'answer' | 'tools' | 'cancel';
1547
1547
  readonly partial: boolean;
1548
1548
  readonly futile: boolean;
1549
1549
  readonly estimate: number | undefined;
@@ -4616,7 +4616,7 @@ export declare interface GaugeInterface extends LedgerGauge {
4616
4616
  * `'CAPACITY'` otherwise. `replay` names the thinking the next request carries. Default: `'none'`.
4617
4617
  * Measured use is `prompt + completion - (thinking ?? 0)` for `'none'`, and `prompt + completion`
4618
4618
  * otherwise; absent completion counts as 0. Without prompt usage, use is `overhead + scale * estimate`.
4619
- * Capacity left is `max(0, capacity - used)`. The reply reserve adds recall framing at the marginal
4619
+ * Capacity left is `max(0, capacity - used)`. The reply reserve adds recall uniform at the marginal
4620
4620
  * rate to the largest observed reply's `completion - (thinking ?? 0)` for every policy.
4621
4621
  * Without a positive reply observation, it prices the longest reply text at that rate. Recall room is
4622
4622
  * `max(0, (remainder - predict - reserve) / 2 / rate)`; recall closes at `remainder - predict < 2 * reserve`.
@@ -5008,7 +5008,7 @@ export declare function intersectKeys(parent: readonly string[] | undefined, chi
5008
5008
  export declare const INVALID_RELAY_STATUS = 400;
5009
5009
 
5010
5010
  /**
5011
- * Narrows an unknown caught value to an {@link AgentError} through `instanceof`, so a `catch`
5011
+ * Narrows an unknown caught value to an {@link AgentError} through its identity brand and declared members, so a `catch`
5012
5012
  * can branch on its `code`.
5013
5013
  *
5014
5014
  * @param value - The value to test (typically a `catch` binding)
@@ -5026,7 +5026,7 @@ export declare const INVALID_RELAY_STATUS = 400;
5026
5026
  export declare function isAgentError(value: unknown): value is AgentError;
5027
5027
 
5028
5028
  /**
5029
- * Narrows an unknown caught value to an {@link AgentJobError} through `instanceof`, so a
5029
+ * Narrows an unknown caught value to an {@link AgentJobError} through its identity brand and declared members, so a
5030
5030
  * `catch` can recover its `partial` result.
5031
5031
  *
5032
5032
  * @param value - The value to test (typically a `catch` binding or a rejected enqueue)
@@ -5044,7 +5044,7 @@ export declare function isAgentError(value: unknown): value is AgentError;
5044
5044
  export declare function isAgentJobError(value: unknown): value is AgentJobError;
5045
5045
 
5046
5046
  /**
5047
- * Narrows an unknown caught value to a {@link ConversationError} through `instanceof`, so a
5047
+ * Narrows an unknown caught value to a {@link ConversationError} through its identity brand and declared members, so a
5048
5048
  * `catch` can branch on its `code`.
5049
5049
  *
5050
5050
  * @param value - The value to test (typically a `catch` binding)
@@ -5106,7 +5106,7 @@ export declare function isConversationSnapshot(value: unknown): value is Convers
5106
5106
  export declare function isFraction(value: unknown): value is number;
5107
5107
 
5108
5108
  /**
5109
- * Narrows a caught value to a {@link JudgeAbortError} through `instanceof`, so a `catch` can
5109
+ * Narrows a caught value to a {@link JudgeAbortError} through its identity brand and declared members, so a `catch` can
5110
5110
  * recover its `partial` result.
5111
5111
  *
5112
5112
  * @param value - The caught value
@@ -5138,7 +5138,7 @@ export declare function isJudgeAbortError(value: unknown): value is JudgeAbortEr
5138
5138
  export declare function isJudgeEntry(value: unknown): value is JudgeEntry;
5139
5139
 
5140
5140
  /**
5141
- * Narrows a caught value to the judge failure class through `instanceof`.
5141
+ * Narrows a caught value to the judge failure class through its identity brand and declared members.
5142
5142
  *
5143
5143
  * @param value - The caught value
5144
5144
  * @returns True if the value is a {@link JudgeError}; false otherwise
@@ -5191,7 +5191,7 @@ export declare function isJudgeQuestion(value: unknown): value is JudgeQuestion;
5191
5191
  export declare function isJudgment(value: unknown): value is Judgment;
5192
5192
 
5193
5193
  /**
5194
- * Narrows an unknown caught value to a {@link LedgerError} through `instanceof`, so a `catch` can
5194
+ * Narrows an unknown caught value to a {@link LedgerError} through its identity brand and declared members, so a `catch` can
5195
5195
  * branch on its `code`.
5196
5196
  *
5197
5197
  * @param value - The value to test (typically a `catch` binding)
@@ -5258,7 +5258,7 @@ export declare function isNonNegativeSafeInteger(value: unknown): value is numbe
5258
5258
  export declare function isPositiveSafeInteger(value: unknown): value is number;
5259
5259
 
5260
5260
  /**
5261
- * Narrows an unknown caught value to a {@link ProviderAbortError} through `instanceof`, so a
5261
+ * Narrows an unknown caught value to a {@link ProviderAbortError} through its identity brand and declared members, so a
5262
5262
  * `catch` can recover its `partial` result.
5263
5263
  *
5264
5264
  * @param value - The value to test (typically a `catch` binding)
@@ -5276,7 +5276,7 @@ export declare function isPositiveSafeInteger(value: unknown): value is number;
5276
5276
  export declare function isProviderAbortError(value: unknown): value is ProviderAbortError;
5277
5277
 
5278
5278
  /**
5279
- * Narrows a caught value to the provider failure class through `instanceof`.
5279
+ * Narrows a caught value to the provider failure class through its identity brand and declared members.
5280
5280
  *
5281
5281
  * @param value - The caught value
5282
5282
  * @returns True if the value is a provider failure; false otherwise
@@ -5388,7 +5388,7 @@ export declare function joinThinking(running: string | undefined, next: string):
5388
5388
  */
5389
5389
  export declare class JudgeAbortError extends Error {
5390
5390
  /** Names the machine-readable condition — `'ABORT'`: a judge call cancelled mid-flight. */
5391
- readonly code: "ABORT";
5391
+ readonly code: 'ABORT';
5392
5392
  readonly partial: JudgeResult;
5393
5393
  constructor(partial: JudgeResult, options?: ErrorOptions);
5394
5394
  }
@@ -5970,7 +5970,7 @@ export declare interface LedgerOwner {
5970
5970
  }
5971
5971
 
5972
5972
  /** Names a briefing source's planning group: a topic match, an off-topic rule or correction, or a name match. */
5973
- export declare type LedgerPlanningGroup = 1 | 2 | 3;
5973
+ export declare type LedgerPlanGroup = 1 | 2 | 3;
5974
5974
 
5975
5975
  /**
5976
5976
  * Carries the records projected from a conversation, accepted amendments, and the live messages no
@@ -6457,7 +6457,7 @@ export declare const MAX_ERROR_BODY_LENGTH = 2048;
6457
6457
  * @remarks
6458
6458
  * The result is a structural estimate, not a tokenizer allocation. `id` and `role` are joins back to
6459
6459
  * the message, not token components, and a provider's template effects and the estimation error are
6460
- * not individually attributed. `content` is `ceil(length / 4)`, `framing` is
6460
+ * not individually attributed. `content` is `ceil(length / 4)`, `uniform` is
6461
6461
  * {@link import('./constants.js').MESSAGE_TOKEN_OVERHEAD}, `calls` is the estimate of the JSON-rendered
6462
6462
  * calls (`0` when the message carries none, the framing overhead when they cannot be rendered),
6463
6463
  * `thinking` is the estimate of the thinking (`0` when absent), and `images` is the attached image
@@ -6469,7 +6469,7 @@ export declare const MAX_ERROR_BODY_LENGTH = 2048;
6469
6469
  * @example
6470
6470
  * ```ts
6471
6471
  * measureMessage({ id: '1', role: 'user', content: 'hello' })
6472
- * // { id: '1', role: 'user', content: 2, framing: 4, calls: 0, thinking: 0, images: 0 }
6472
+ * // { id: '1', role: 'user', content: 2, uniform: 4, calls: 0, thinking: 0, images: 0 }
6473
6473
  * ```
6474
6474
  */
6475
6475
  export declare function measureMessage(message: Message): MessageMeasure;
@@ -6493,7 +6493,7 @@ export declare function measureMessage(message: Message): MessageMeasure;
6493
6493
  * @example
6494
6494
  * ```ts
6495
6495
  * measureRequest({ messages: [{ id: '1', role: 'user', content: 'hello' }] })
6496
- * // { messages: [{ id: '1', role: 'user', content: 2, framing: 4, calls: 0, thinking: 0, images: 0 }], tools: 0, schema: 0 }
6496
+ * // { messages: [{ id: '1', role: 'user', content: 2, uniform: 4, calls: 0, thinking: 0, images: 0 }], tools: 0, schema: 0 }
6497
6497
  * ```
6498
6498
  */
6499
6499
  export declare function measureRequest(request: ProviderRequest): RequestMeasure;
@@ -6620,7 +6620,7 @@ export declare const MESSAGE_TOKEN_OVERHEAD = 4;
6620
6620
  /** Validates and projects conversation messages at a JSON wire boundary. */
6621
6621
  export declare const messageContract: ContractInterface<Readonly<{
6622
6622
  id: string;
6623
- role: "system" | "user" | "assistant" | "tool";
6623
+ role: "assistant" | "system" | "tool" | "user";
6624
6624
  content: string;
6625
6625
  } & {
6626
6626
  calls?: readonly Readonly<{
@@ -6718,7 +6718,7 @@ export declare interface MessageManagerInterface {
6718
6718
  *
6719
6719
  * @remarks
6720
6720
  * The structural estimate is not a tokenizer allocation. `id` and `role` are joins back to the
6721
- * message, not token components. A message's estimate is the sum of `content`, `framing`, `calls`,
6721
+ * message, not token components. A message's estimate is the sum of `content`, `uniform`, `calls`,
6722
6722
  * `thinking`, and `images`; no total is stored. A provider's template effects and the estimation
6723
6723
  * error are not individually attributed.
6724
6724
  */
@@ -6727,9 +6727,9 @@ export declare interface MessageMeasure {
6727
6727
  readonly role: MessageRole;
6728
6728
  /** Holds the `ceil(length / 4)` estimate of the message `content`. */
6729
6729
  readonly content: number;
6730
- /** Holds the fixed per-message framing overhead. */
6731
- readonly framing: number;
6732
- /** Holds the estimate of the JSON-rendered `calls`, or the framing overhead when they cannot be rendered; `0` when the message carries none. */
6730
+ /** Holds the fixed per-message uniform overhead. */
6731
+ readonly uniform: number;
6732
+ /** Holds the estimate of the JSON-rendered `calls`, or the uniform overhead when they cannot be rendered; `0` when the message carries none. */
6733
6733
  readonly calls: number;
6734
6734
  /** Holds the estimate of the message `thinking`; `0` when absent. */
6735
6735
  readonly thinking: number;
@@ -6854,7 +6854,7 @@ export declare function placeMember(input: LedgerProjectionInput, links: Readonl
6854
6854
  */
6855
6855
  export declare class ProviderAbortError extends Error {
6856
6856
  /** Names the machine-readable condition — `'ABORT'`: a stream cancelled mid-flight. */
6857
- readonly code: "ABORT";
6857
+ readonly code: 'ABORT';
6858
6858
  readonly partial: ProviderResult;
6859
6859
  constructor(partial: ProviderResult, options?: ErrorOptions);
6860
6860
  }
@@ -7015,7 +7015,7 @@ export declare interface ProviderRequest {
7015
7015
  export declare const providerRequestContract: ContractInterface<Readonly<{
7016
7016
  messages: readonly Readonly<{
7017
7017
  id: string;
7018
- role: "system" | "user" | "assistant" | "tool";
7018
+ role: "assistant" | "system" | "tool" | "user";
7019
7019
  content: string;
7020
7020
  } & {
7021
7021
  calls?: readonly Readonly<{
@@ -7230,7 +7230,30 @@ export declare function raceSignal<T>(promise: Promise<T>, signal: AbortSignal |
7230
7230
  * rankLedgerCut(2, false, 'rule') // 3
7231
7231
  * ```
7232
7232
  */
7233
- export declare function rankLedgerCut(group: LedgerPlanningGroup, unsettled: boolean, category: LedgerCategory | undefined): number;
7233
+ export declare function rankLedgerCut(group: LedgerPlanGroup, unsettled: boolean, category: LedgerCategory | undefined): number;
7234
+
7235
+ /**
7236
+ * Reads a UTF-8 prefix of a byte stream and cancels its remainder.
7237
+ *
7238
+ * @remarks
7239
+ * The `limit` parameter bounds bytes passed to the decoder, including a partial final
7240
+ * character. An omitted limit reads to completion. A source may deliver a chunk larger
7241
+ * than the remaining limit; its unused bytes are discarded without decoding.
7242
+ * The read can overshoot by one source chunk. An abort leaves completion false.
7243
+ *
7244
+ * @param body - The readable byte stream
7245
+ * @param limit - The maximum byte prefix, or undefined for the complete stream
7246
+ * @param signal - The optional cancellation bound; abort returns the decoded prefix
7247
+ * @returns The decoded prefix and whether EOF occurred within the byte budget
7248
+ * @example
7249
+ * ```ts
7250
+ * import { readBodyText } from '@orkestrel/agent'
7251
+ *
7252
+ * const body = new Response('answer').body
7253
+ * if (body !== null) await readBodyText(body, 3) // { text: 'ans', complete: false }
7254
+ * ```
7255
+ */
7256
+ export declare function readBodyText(body: ReadableStream<Uint8Array>, limit?: number, signal?: AbortSignal): Promise<TextRead>;
7234
7257
 
7235
7258
  /**
7236
7259
  * Decodes UTF-8 chunks with a final flush and releases the stream on every exit.
@@ -7279,29 +7302,6 @@ export declare interface Reading {
7279
7302
  readonly score?: number;
7280
7303
  }
7281
7304
 
7282
- /**
7283
- * Reads a UTF-8 prefix of a byte stream and cancels its remainder.
7284
- *
7285
- * @remarks
7286
- * The `limit` parameter bounds bytes passed to the decoder, including a partial final
7287
- * character. An omitted limit reads to completion. A source may deliver a chunk larger
7288
- * than the remaining limit; its unused bytes are discarded without decoding.
7289
- * The read can overshoot by one source chunk. An abort leaves completion false.
7290
- *
7291
- * @param body - The readable byte stream
7292
- * @param limit - The maximum byte prefix, or undefined for the complete stream
7293
- * @param signal - The optional cancellation bound; abort returns the decoded prefix
7294
- * @returns The decoded prefix and whether EOF occurred within the byte budget
7295
- * @example
7296
- * ```ts
7297
- * import { readText } from '@orkestrel/agent'
7298
- *
7299
- * const body = new Response('answer').body
7300
- * if (body !== null) await readText(body, 3) // { text: 'ans', complete: false }
7301
- * ```
7302
- */
7303
- export declare function readText(body: ReadableStream<Uint8Array>, limit?: number, signal?: AbortSignal): Promise<TextRead>;
7304
-
7305
7305
  /** Reports a question a wire could not read a candidate for; it lists the caller's keys and invents no probability. */
7306
7306
  export declare interface Refusal {
7307
7307
  readonly missing: readonly string[];