@orkestrel/agent 0.0.36 → 0.0.37
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/src/core/index.cjs +578 -84
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +324 -32
- package/dist/src/core/index.d.ts +324 -32
- package/dist/src/core/index.js +567 -85
- package/dist/src/core/index.js.map +1 -1
- package/package.json +7 -7
package/dist/src/core/index.d.ts
CHANGED
|
@@ -2458,6 +2458,17 @@ export declare function buildLedgerCut(steps: ReadonlyArray<LedgerLine | string>
|
|
|
2458
2458
|
*/
|
|
2459
2459
|
export declare function buildLedgerIndex(registry: LedgerRegistry): LedgerIndex;
|
|
2460
2460
|
|
|
2461
|
+
/**
|
|
2462
|
+
* Encodes a sentence's record placement without comparing rendered text.
|
|
2463
|
+
* @param line - The record key, title, source, and zero-based sentence index
|
|
2464
|
+
* @returns The serialized placement identity
|
|
2465
|
+
* @example
|
|
2466
|
+
* ```ts
|
|
2467
|
+
* buildLedgerLineKey({ key: 'rules', title: 'Rules', source: 'one', sentence: 0 })
|
|
2468
|
+
* ```
|
|
2469
|
+
*/
|
|
2470
|
+
export declare function buildLedgerLineKey(line: Pick<LedgerOccurrence, 'key' | 'title' | 'source' | 'sentence'>): string;
|
|
2471
|
+
|
|
2461
2472
|
/**
|
|
2462
2473
|
* Derives complete source identities, first occurrences, and local references from the actual lines of the records.
|
|
2463
2474
|
* @param messages - Original messages whose indexed sentences establish completeness
|
|
@@ -2574,17 +2585,17 @@ export declare function buildRecapMessage(section: Section): Message;
|
|
|
2574
2585
|
* Projects the owner records and the rules record from a conversation's messages.
|
|
2575
2586
|
*
|
|
2576
2587
|
* @remarks
|
|
2577
|
-
* Each line is a sentence of a live message, verbatim except that a sentence that opens with a
|
|
2578
|
-
*
|
|
2579
|
-
*
|
|
2580
|
-
*
|
|
2588
|
+
* Each line is a sentence of a live message, verbatim except that a sentence that opens with a
|
|
2589
|
+
* pronoun opens with its party and a colon. {@link collectLive} retains user messages and the
|
|
2590
|
+
* earliest finding in each call identity's last run of identical text, subject to exclusions,
|
|
2591
|
+
* quiet classification, and supersessions. An undefined result still replaces the earlier finding.
|
|
2581
2592
|
*
|
|
2582
2593
|
* A live message joins the owner records its entities name, directly or through a linked lookup
|
|
2583
2594
|
* argument. A message that names no owner joins where its earlier side of an amendment pair joins,
|
|
2584
2595
|
* or on the rules record when it is filed as a rule or a correction, and is an orphan otherwise.
|
|
2585
2596
|
*
|
|
2586
|
-
* Every live sentence is retained. Accepted
|
|
2587
|
-
*
|
|
2597
|
+
* Every live sentence is retained. Accepted edges are listed in `amendments`. An amender that is
|
|
2598
|
+
* superseded points to its newest live successor, or retains its endpoint when none exists.
|
|
2588
2599
|
*
|
|
2589
2600
|
* A sentence that opens with a pronoun takes the party named in the sentence before it. The reading
|
|
2590
2601
|
* trusts capitals, so a capitalized word that is no person, such as a carrier named mid-sentence,
|
|
@@ -2836,13 +2847,13 @@ export declare class Classifier implements ClassifierInterface {
|
|
|
2836
2847
|
/**
|
|
2837
2848
|
* Reads the category a message is filed under.
|
|
2838
2849
|
* @param id - The message id
|
|
2839
|
-
* @returns The assigned category, the recorded category at the cutoff, or `undefined
|
|
2850
|
+
* @returns The assigned category, the recorded category at the cutoff, or `undefined`; a quiet winner suppressed by the user literal floor remains undecided
|
|
2840
2851
|
*/
|
|
2841
2852
|
category(id: string): LedgerCategory | undefined;
|
|
2842
2853
|
/**
|
|
2843
2854
|
* Reports whether a message files under a quiet category.
|
|
2844
2855
|
* @param id - The message id
|
|
2845
|
-
* @returns True if the assigned or recorded
|
|
2856
|
+
* @returns True if the assigned category is quiet or the recorded quiet weight reaches the cutoff, except for a user message carrying an id or number; false otherwise
|
|
2846
2857
|
*/
|
|
2847
2858
|
quiet(id: string): boolean;
|
|
2848
2859
|
/**
|
|
@@ -2899,14 +2910,14 @@ export declare interface ClassifierInterface {
|
|
|
2899
2910
|
*/
|
|
2900
2911
|
classify(requests: ReadonlySet<string>, signal: AbortSignal): Promise<ClassifierResult>;
|
|
2901
2912
|
/**
|
|
2902
|
-
* Returns the
|
|
2913
|
+
* Returns the assigned or recorded category, or undefined when no category reaches its cutoff or the user literal floor suppresses a quiet winner.
|
|
2903
2914
|
*
|
|
2904
2915
|
* @param id - The id of the message
|
|
2905
2916
|
* @returns The category, or undefined
|
|
2906
2917
|
*/
|
|
2907
2918
|
category(id: string): LedgerCategory | undefined;
|
|
2908
2919
|
/**
|
|
2909
|
-
* Returns true
|
|
2920
|
+
* Returns true for a quiet assignment or a recorded quiet weight at the cutoff, except for a user message carrying an id or number; false otherwise.
|
|
2910
2921
|
*
|
|
2911
2922
|
* @param id - The id of the message
|
|
2912
2923
|
* @returns True if the message is quiet; false otherwise.
|
|
@@ -3009,17 +3020,18 @@ export declare interface CodedErrorOptions {
|
|
|
3009
3020
|
}
|
|
3010
3021
|
|
|
3011
3022
|
/**
|
|
3012
|
-
* Collects accepted
|
|
3023
|
+
* Collects accepted amendments of live messages, following superseded amenders to live successors.
|
|
3013
3024
|
*
|
|
3014
3025
|
* @remarks
|
|
3015
3026
|
* An accepted edge relates an earlier live message to an amender without claiming which sentences
|
|
3016
|
-
* changed.
|
|
3017
|
-
*
|
|
3027
|
+
* changed. A superseded amender points to its newest reachable live successor in conversation order,
|
|
3028
|
+
* with cycles guarded and duplicate endpoints removed. With no live successor, its endpoint stays.
|
|
3029
|
+
* This never restores superseded text. An excluded or quiet user or tool message has no effect.
|
|
3018
3030
|
*
|
|
3019
3031
|
* @param input - The exclusions and classification to read
|
|
3020
3032
|
* @param byId - The messages by id
|
|
3021
3033
|
* @param live - The live message ids from {@link collectLive}
|
|
3022
|
-
* @returns The distinct accepted
|
|
3034
|
+
* @returns The distinct accepted edges in conversation order
|
|
3023
3035
|
*
|
|
3024
3036
|
* @example
|
|
3025
3037
|
* ```ts
|
|
@@ -3067,15 +3079,54 @@ export declare function collectExchanges(messages: readonly Message[]): Readonly
|
|
|
3067
3079
|
*/
|
|
3068
3080
|
export declare function collectImageData(files: readonly FileInterface[]): readonly string[];
|
|
3069
3081
|
|
|
3082
|
+
/**
|
|
3083
|
+
* Captures source bytes and direct amendment edges for a held window.
|
|
3084
|
+
* @param messages - Current stored messages
|
|
3085
|
+
* @param sources - Requests, replies, and record sources the window holds
|
|
3086
|
+
* @param amendments - Accepted direct amendment edges from the current projection
|
|
3087
|
+
* @returns Source and edge identities for stale detection
|
|
3088
|
+
* @example
|
|
3089
|
+
* ```ts
|
|
3090
|
+
* collectLedgerEvidence([], new Set(), []).messages.size // 0
|
|
3091
|
+
* ```
|
|
3092
|
+
*/
|
|
3093
|
+
export declare function collectLedgerEvidence(messages: readonly Message[], sources: ReadonlySet<string>, amendments: readonly LedgerAmendment[]): LedgerEvidence;
|
|
3094
|
+
|
|
3095
|
+
/**
|
|
3096
|
+
* Collects the record's sentence receipts not already held by a window.
|
|
3097
|
+
* @param record - The selected record with its original sentence identities
|
|
3098
|
+
* @param held - Placement identities already rendered in the window
|
|
3099
|
+
* @returns The remaining sentences with their record placement
|
|
3100
|
+
* @example
|
|
3101
|
+
* ```ts
|
|
3102
|
+
* collectLedgerLines({ key: 'rules', title: 'Rules', members: [], lines: [] }, new Set()) // []
|
|
3103
|
+
* ```
|
|
3104
|
+
*/
|
|
3105
|
+
export declare function collectLedgerLines(record: LedgerRecord, held: ReadonlySet<string>): readonly LedgerOccurrence[];
|
|
3106
|
+
|
|
3107
|
+
/**
|
|
3108
|
+
* Selects each marked request's unambiguous final call-free reply.
|
|
3109
|
+
* @param messages - Stored conversation messages in order
|
|
3110
|
+
* @param requests - Marked request ids delimiting reply intervals
|
|
3111
|
+
* @param notes - Ledger notes that separate answer passes
|
|
3112
|
+
* @returns Eligible final replies keyed by request id
|
|
3113
|
+
* @example
|
|
3114
|
+
* ```ts
|
|
3115
|
+
* collectLedgerReplies([], new Set(), new Set()).size // 0
|
|
3116
|
+
* ```
|
|
3117
|
+
*/
|
|
3118
|
+
export declare function collectLedgerReplies(messages: readonly Message[], requests: ReadonlySet<string>, notes: ReadonlySet<string>): ReadonlyMap<string, Message>;
|
|
3119
|
+
|
|
3070
3120
|
/**
|
|
3071
3121
|
* Collects the ids of the live messages in conversation order.
|
|
3072
3122
|
*
|
|
3073
3123
|
* @remarks
|
|
3074
|
-
* A message is live when it is a user message
|
|
3075
|
-
* call, and the input neither excludes it nor files it quiet
|
|
3076
|
-
*
|
|
3077
|
-
*
|
|
3078
|
-
*
|
|
3124
|
+
* A message is live when it is a user message or the first unsuperseded finding in its canonical
|
|
3125
|
+
* call identity's last run of identical text, and the input neither excludes it nor files it quiet
|
|
3126
|
+
* or superseded. When the whole run is superseded, its first finding reaches that final filter.
|
|
3127
|
+
* Different text or an undefined result replaces the earlier run, so an empty lookup leaves the
|
|
3128
|
+
* earlier result out of every record. A thrown lookup leaves the earlier result live. A finding
|
|
3129
|
+
* with no canonical identity participates in no replacement.
|
|
3079
3130
|
*
|
|
3080
3131
|
* @param input - The messages, findings, and classification to read
|
|
3081
3132
|
* @returns The live message ids
|
|
@@ -3115,6 +3166,22 @@ export declare function collectNames(text: string): readonly string[];
|
|
|
3115
3166
|
*/
|
|
3116
3167
|
export declare function collectProjectionIds(projection: LedgerProjection): ReadonlySet<string>;
|
|
3117
3168
|
|
|
3169
|
+
/**
|
|
3170
|
+
* Collects stored messages eligible to open the recall offer.
|
|
3171
|
+
* @remarks
|
|
3172
|
+
* Notes and findings without a result do not open the offer. User statements, including quiet
|
|
3173
|
+
* statements available through recall's word route, can open it; this helper does not filter results.
|
|
3174
|
+
* @param input - The messages, findings, and classification
|
|
3175
|
+
* @param requests - The marked request ids
|
|
3176
|
+
* @param notes - The annotation ids to exclude
|
|
3177
|
+
* @returns User statements, lookup findings with results, marked requests, and nonblank call-free replies
|
|
3178
|
+
* @example
|
|
3179
|
+
* ```ts
|
|
3180
|
+
* collectRecallMessages(input, new Set(), new Set()) // eligible stored messages
|
|
3181
|
+
* ```
|
|
3182
|
+
*/
|
|
3183
|
+
export declare function collectRecallMessages(input: LedgerProjectionInput, requests: ReadonlySet<string>, notes: ReadonlySet<string>): readonly Message[];
|
|
3184
|
+
|
|
3118
3185
|
/**
|
|
3119
3186
|
* Collects the ids and the owner names the lookup findings named.
|
|
3120
3187
|
*
|
|
@@ -5284,10 +5351,12 @@ export declare function createThinkSplitter(): ThinkSplitterInterface;
|
|
|
5284
5351
|
* @remarks
|
|
5285
5352
|
* The cut keeps at least one entry. When it leaves entries out, its last line reads
|
|
5286
5353
|
* `N older items not shown; name a narrower topic to narrow the recall`, which
|
|
5287
|
-
* {@link matchesCutLine} recognizes.
|
|
5354
|
+
* {@link matchesCutLine} recognizes. Pass `more` when the entries aren't in age order, so the line
|
|
5355
|
+
* doesn't claim an omitted entry is older than a kept one.
|
|
5288
5356
|
*
|
|
5289
5357
|
* @param entries - The entries in the order they are kept
|
|
5290
5358
|
* @param room - The estimate units the joined entries can take
|
|
5359
|
+
* @param kind - What the cut line calls an omitted entry. Default: `older`
|
|
5291
5360
|
* @returns The kept entries followed by the cut line when any were left out, joined by newlines
|
|
5292
5361
|
*
|
|
5293
5362
|
* @example
|
|
@@ -5295,7 +5364,7 @@ export declare function createThinkSplitter(): ThinkSplitterInterface;
|
|
|
5295
5364
|
* cutListing(['first entry', 'second entry'], 1) // 'first entry\n1 older item not shown; name a narrower topic to narrow the recall'
|
|
5296
5365
|
* ```
|
|
5297
5366
|
*/
|
|
5298
|
-
export declare function cutListing(entries: readonly string[], room: number): string;
|
|
5367
|
+
export declare function cutListing(entries: readonly string[], room: number, kind?: 'older' | 'more'): string;
|
|
5299
5368
|
|
|
5300
5369
|
/**
|
|
5301
5370
|
* Backs a {@link ConversationStoreInterface} with one table of the `databases` layer — a
|
|
@@ -5608,6 +5677,19 @@ export declare function describeSnapshotRefusal(noun: string, id: unknown, fault
|
|
|
5608
5677
|
/** Matches the logprob decoding failure `invalid or duplicate top logprob token`, which the ledger holds for the ledger's life. */
|
|
5609
5678
|
export declare const DETERMINISTIC_JUDGE_ERROR: RegExp;
|
|
5610
5679
|
|
|
5680
|
+
/**
|
|
5681
|
+
* Digests held messages, lookup call context, stored copies, and sentence receipts using canonical text.
|
|
5682
|
+
* This non-cryptographic checksum detects host edits and makes no security claim.
|
|
5683
|
+
* @param exchanges - The stored exchange entries
|
|
5684
|
+
* @param messages - The conversation holding their messages
|
|
5685
|
+
* @returns The hexadecimal checksum, or undefined when a required message is absent or canonical encoding fails
|
|
5686
|
+
* @example
|
|
5687
|
+
* ```ts
|
|
5688
|
+
* digestLedgerWindow([], []) // a deterministic hexadecimal checksum
|
|
5689
|
+
* ```
|
|
5690
|
+
*/
|
|
5691
|
+
export declare function digestLedgerWindow(exchanges: readonly LedgerExchangeSnapshot[], messages: readonly Message[]): string | undefined;
|
|
5692
|
+
|
|
5611
5693
|
/**
|
|
5612
5694
|
* Estimates the context-token footprint of a batch of messages — each message's content plus
|
|
5613
5695
|
* {@link import('./constants.js').MESSAGE_TOKEN_OVERHEAD}, a tool-call JSON estimate, a thinking estimate, and
|
|
@@ -5874,8 +5956,9 @@ export declare function freezeJSON(value: unknown): unknown;
|
|
|
5874
5956
|
* has left.
|
|
5875
5957
|
*
|
|
5876
5958
|
* @remarks
|
|
5877
|
-
* `observe` rescales from the first call
|
|
5878
|
-
*
|
|
5959
|
+
* `observe` rescales from the first call only when `spared` is absent, zero, or at least `overhead`,
|
|
5960
|
+
* with `max(0, overhead - spared)` taken out. A partially spared call keeps the existing scale.
|
|
5961
|
+
* It keeps that request's calls for the marginal rate and the longest final completion for the reply
|
|
5879
5962
|
* reserve after subtracting its thinking. `overhead` never changes after construction.
|
|
5880
5963
|
* {@link GaugeOptions} defines the measured use, reply reserve, and recall-room formulas.
|
|
5881
5964
|
* {@link LedgerOptions} defines the ledger's plan budget and recall close rule.
|
|
@@ -5921,7 +6004,10 @@ export declare class Gauge implements GaugeInterface {
|
|
|
5921
6004
|
* @remarks
|
|
5922
6005
|
* `estimate` is the `estimateMessages` estimate of the call's messages. `prompt` and `completion`
|
|
5923
6006
|
* are the tokens the provider reported, absent when it reported none. `tools` is the count of tool
|
|
5924
|
-
* definitions the call advertised.
|
|
6007
|
+
* definitions the call advertised. `spared` is the tokens of definitions it did not advertise;
|
|
6008
|
+
* estimated use subtracts it from overhead, floored at 0. Omission means 0. Observation rescales
|
|
6009
|
+
* only with exact overhead: `spared` absent or zero retains all overhead, and `spared` at or above
|
|
6010
|
+
* overhead retains none. A partially spared first call keeps the prior scale.
|
|
5925
6011
|
* `thinking` estimates the completion tokens spent on thinking from its share of the generated
|
|
5926
6012
|
* characters, rounded to the nearest integer and capped at `completion`. With replay `'none'`,
|
|
5927
6013
|
* the measured call uses `prompt + completion - thinking`; other policies retain the whole
|
|
@@ -5929,6 +6015,8 @@ export declare class Gauge implements GaugeInterface {
|
|
|
5929
6015
|
*/
|
|
5930
6016
|
export declare interface GaugeCall {
|
|
5931
6017
|
readonly estimate: number;
|
|
6018
|
+
/** Tokens spared by tool definitions this call did not advertise. Default: 0. */
|
|
6019
|
+
readonly spared?: number;
|
|
5932
6020
|
readonly prompt?: number;
|
|
5933
6021
|
readonly completion?: number;
|
|
5934
6022
|
readonly thinking?: number;
|
|
@@ -5999,7 +6087,8 @@ export declare interface GaugeInterface extends LedgerGauge {
|
|
|
5999
6087
|
* nonnegative safe integer less than `capacity`; construction throws `LedgerError` with code
|
|
6000
6088
|
* `'CAPACITY'` otherwise. `replay` names the thinking the next request carries. Default: `'none'`.
|
|
6001
6089
|
* Measured use is `prompt + completion - (thinking ?? 0)` for `'none'`, and `prompt + completion`
|
|
6002
|
-
* otherwise; absent completion counts as 0. Without prompt usage, use is
|
|
6090
|
+
* otherwise; absent completion counts as 0. Without prompt usage, use is
|
|
6091
|
+
* `max(0, overhead - (spared ?? 0)) + scale * estimate`.
|
|
6003
6092
|
* Capacity left is `max(0, capacity - used)`. The reply reserve adds recall uniform at the marginal
|
|
6004
6093
|
* rate to the largest observed reply's `completion - (thinking ?? 0)` for every policy.
|
|
6005
6094
|
* Without a positive reply observation, it prices the longest reply text at that rate. Recall room is
|
|
@@ -6046,6 +6135,23 @@ export declare function handleAgentQueueJob(registry: AgentRegistryInterface, pa
|
|
|
6046
6135
|
*/
|
|
6047
6136
|
export declare function hasCalls(message: Pick<Message, 'calls'>): boolean;
|
|
6048
6137
|
|
|
6138
|
+
/**
|
|
6139
|
+
* Checks whether an eligible earlier message is absent from the prompt or incompletely covered.
|
|
6140
|
+
* A successful finding is held when a finding with the same canonical identity and text is fully received.
|
|
6141
|
+
* @param input - The messages, findings, and classification
|
|
6142
|
+
* @param request - The current request id; only messages before it count
|
|
6143
|
+
* @param requests - The marked request ids
|
|
6144
|
+
* @param notes - The annotation ids to exclude
|
|
6145
|
+
* @param messages - The seed tail and held exchange messages; lookup stubs retain their rendered text
|
|
6146
|
+
* @param lines - The receipts held by the window and the request copy together
|
|
6147
|
+
* @returns True if an eligible earlier message is absent or only partly covered; false otherwise
|
|
6148
|
+
* @example
|
|
6149
|
+
* ```ts
|
|
6150
|
+
* hasHiddenRecall(input, request.id, requests, notes, tail, lines) // whether to offer recall
|
|
6151
|
+
* ```
|
|
6152
|
+
*/
|
|
6153
|
+
export declare function hasHiddenRecall(input: LedgerProjectionInput, request: string, requests: ReadonlySet<string>, notes: ReadonlySet<string>, messages: readonly Message[], lines: readonly LedgerReceipt[]): boolean;
|
|
6154
|
+
|
|
6049
6155
|
/**
|
|
6050
6156
|
* Identifies a lookup finding for projection by its tool name and normalized arguments.
|
|
6051
6157
|
*
|
|
@@ -6721,6 +6827,8 @@ export declare function isLedgerQuestion(value: unknown): value is LedgerQuestio
|
|
|
6721
6827
|
* guard is structural: it admits a conversation holding a stored `system` role
|
|
6722
6828
|
* or a repeated id, which `requireConversationSnapshot` and the `Conversation` constructor then
|
|
6723
6829
|
* refuse as the stored-data check a ledger's hydrate runs.
|
|
6830
|
+
* A present `window` must be nonempty and exactly shaped. This guard does not audit its references
|
|
6831
|
+
* or sentence ranges. Hydration discards the window when its digest disagrees or cannot be computed.
|
|
6724
6832
|
*
|
|
6725
6833
|
* @param value - The value to inspect, such as a parsed checkpoint
|
|
6726
6834
|
* @returns True if the value has the shape of a ledger snapshot whose marked ids name messages of its own conversation; false otherwise
|
|
@@ -6733,6 +6841,17 @@ export declare function isLedgerQuestion(value: unknown): value is LedgerQuestio
|
|
|
6733
6841
|
*/
|
|
6734
6842
|
export declare function isLedgerSnapshot(value: unknown): value is LedgerSnapshot;
|
|
6735
6843
|
|
|
6844
|
+
/**
|
|
6845
|
+
* Checks whether a value has the exact shape of a nonempty exchange window.
|
|
6846
|
+
* @param value - The untrusted window
|
|
6847
|
+
* @returns True if the window and its members are well shaped; false otherwise
|
|
6848
|
+
* @example
|
|
6849
|
+
* ```ts
|
|
6850
|
+
* isLedgerWindowSnapshot({ digest: 'checksum', exchanges: [{ request: 'request', reply: 'reply', lines: [] }], amendments: [] }) // true
|
|
6851
|
+
* ```
|
|
6852
|
+
*/
|
|
6853
|
+
export declare function isLedgerWindowSnapshot(value: unknown): value is LedgerWindowSnapshot;
|
|
6854
|
+
|
|
6736
6855
|
/**
|
|
6737
6856
|
* Checks whether a value is a stored memo revision: a record with a string `id`, `name`,
|
|
6738
6857
|
* `description`, and `content`, a finite `time`, and an optional `origin`.
|
|
@@ -7543,8 +7662,8 @@ export declare class Ledger implements LedgerInterface {
|
|
|
7543
7662
|
*/
|
|
7544
7663
|
calibrate(signal: AbortSignal): Promise<LedgerGauge>;
|
|
7545
7664
|
/**
|
|
7546
|
-
* Serializes the conversation,
|
|
7547
|
-
* @returns The snapshot, each id list in conversation order
|
|
7665
|
+
* Serializes the conversation, marked ids, gauge, and completed exchange window for a later ledger.
|
|
7666
|
+
* @returns The snapshot, each id list in conversation order, with a gauge and window only when held
|
|
7548
7667
|
* @throws {AgentError} Thrown when a request or calibration is active (code `'CONCURRENCY'`)
|
|
7549
7668
|
*/
|
|
7550
7669
|
snapshot(): LedgerSnapshot;
|
|
@@ -7585,6 +7704,12 @@ export declare const LEDGER_OWNER_PREFIX = "owner:";
|
|
|
7585
7704
|
*/
|
|
7586
7705
|
export declare const LEDGER_QUESTIONS: LedgerQuestion;
|
|
7587
7706
|
|
|
7707
|
+
/** Labels recalled conversation text by its origin. */
|
|
7708
|
+
export declare const LEDGER_RECALL_LABELS: Readonly<{
|
|
7709
|
+
request: "Earlier request:";
|
|
7710
|
+
reply: "Earlier reply:";
|
|
7711
|
+
}>;
|
|
7712
|
+
|
|
7588
7713
|
/** Names the key of the record that holds the rules no owner claims. */
|
|
7589
7714
|
export declare const LEDGER_RULES_KEY = "rules";
|
|
7590
7715
|
|
|
@@ -7680,6 +7805,14 @@ export declare interface LedgerCorrectionOptions {
|
|
|
7680
7805
|
readonly narrow?: boolean;
|
|
7681
7806
|
}
|
|
7682
7807
|
|
|
7808
|
+
/** Carries a planned copy and its validity evidence to request settlement. */
|
|
7809
|
+
export declare interface LedgerDraft {
|
|
7810
|
+
readonly copy: Message;
|
|
7811
|
+
readonly lines: readonly LedgerOccurrence[];
|
|
7812
|
+
readonly evidence: LedgerEvidence;
|
|
7813
|
+
readonly window: readonly LedgerExchange[];
|
|
7814
|
+
}
|
|
7815
|
+
|
|
7683
7816
|
/**
|
|
7684
7817
|
* Lists the registry ids and owner ids a text names.
|
|
7685
7818
|
*
|
|
@@ -7742,6 +7875,27 @@ export declare type LedgerErrorCode =
|
|
|
7742
7875
|
/** Reports filing wording that `isLedgerQuestion` refuses. */
|
|
7743
7876
|
| 'QUESTION';
|
|
7744
7877
|
|
|
7878
|
+
/** Captures held message identities and the accepted edges used to validate their copies. */
|
|
7879
|
+
export declare interface LedgerEvidence {
|
|
7880
|
+
readonly messages: ReadonlySet<string>;
|
|
7881
|
+
readonly amendments: ReadonlyMap<string, LedgerAmendment>;
|
|
7882
|
+
}
|
|
7883
|
+
|
|
7884
|
+
/** Carries a completed request copy, its stored reply, and the sentences the copy rendered. */
|
|
7885
|
+
export declare interface LedgerExchange {
|
|
7886
|
+
readonly request: Message;
|
|
7887
|
+
readonly reply: Message;
|
|
7888
|
+
readonly lines: readonly LedgerOccurrence[];
|
|
7889
|
+
}
|
|
7890
|
+
|
|
7891
|
+
/** Carries the sent request text, stored pair ids, and sentence placements of one exchange. */
|
|
7892
|
+
export declare interface LedgerExchangeSnapshot {
|
|
7893
|
+
readonly request: string;
|
|
7894
|
+
readonly copy?: string;
|
|
7895
|
+
readonly reply: string;
|
|
7896
|
+
readonly lines: readonly LedgerReceipt[];
|
|
7897
|
+
}
|
|
7898
|
+
|
|
7745
7899
|
/**
|
|
7746
7900
|
* Carries the price of a prompt in tokens, measured against the model the ledger serves.
|
|
7747
7901
|
*
|
|
@@ -7961,6 +8115,10 @@ export declare interface LedgerNote {
|
|
|
7961
8115
|
readonly closure: string;
|
|
7962
8116
|
}
|
|
7963
8117
|
|
|
8118
|
+
/** Carries a rendered sentence with its record placement. */
|
|
8119
|
+
export declare interface LedgerOccurrence extends LedgerLine, LedgerReceipt {
|
|
8120
|
+
}
|
|
8121
|
+
|
|
7964
8122
|
/**
|
|
7965
8123
|
* Configures a ledger: its judge and the wording and cutoffs it files with, the desk topics, the
|
|
7966
8124
|
* context capacity, and the optional first-pass thinking, lookups, gauge, shares, snapshot, recall
|
|
@@ -8091,6 +8249,14 @@ export declare interface LedgerRecallOptions {
|
|
|
8091
8249
|
readonly limit?: number;
|
|
8092
8250
|
}
|
|
8093
8251
|
|
|
8252
|
+
/** Identifies an original sentence at one record placement. */
|
|
8253
|
+
export declare interface LedgerReceipt {
|
|
8254
|
+
readonly key: string;
|
|
8255
|
+
readonly title: string;
|
|
8256
|
+
readonly source: string;
|
|
8257
|
+
readonly sentence: number;
|
|
8258
|
+
}
|
|
8259
|
+
|
|
8094
8260
|
/**
|
|
8095
8261
|
* Carries one record: the live messages placed on one owner or on the rules, as lines.
|
|
8096
8262
|
*
|
|
@@ -8138,6 +8304,12 @@ export declare interface LedgerRenderContext {
|
|
|
8138
8304
|
readonly references: ReadonlyMap<string, string>;
|
|
8139
8305
|
}
|
|
8140
8306
|
|
|
8307
|
+
/** Carries rendered record text and its sentences in emission order. */
|
|
8308
|
+
export declare interface LedgerRenderResult {
|
|
8309
|
+
readonly text: string;
|
|
8310
|
+
readonly lines: readonly LedgerOccurrence[];
|
|
8311
|
+
}
|
|
8312
|
+
|
|
8141
8313
|
/**
|
|
8142
8314
|
* Holds what one ledger request keeps while it is served: its message, its filing attempts and
|
|
8143
8315
|
* plan, the gauge calls of its passes, and its repeat and recall stops.
|
|
@@ -8179,6 +8351,10 @@ export declare class LedgerRequest implements LedgerRequestInterface {
|
|
|
8179
8351
|
* @returns The planned selection, or undefined before one
|
|
8180
8352
|
*/
|
|
8181
8353
|
get plan(): Selection | undefined;
|
|
8354
|
+
get scope(): ScopeInterface | undefined;
|
|
8355
|
+
apply(scope: ScopeInterface): void;
|
|
8356
|
+
/** Returns the copy and receipts adopted by the last provider turn. */
|
|
8357
|
+
get sent(): LedgerDraft | undefined;
|
|
8182
8358
|
/**
|
|
8183
8359
|
* Returns the selection the current pass's run adopted last.
|
|
8184
8360
|
*
|
|
@@ -8217,7 +8393,7 @@ export declare class LedgerRequest implements LedgerRequestInterface {
|
|
|
8217
8393
|
think(messages: readonly Message[]): void;
|
|
8218
8394
|
fault(error: unknown): void;
|
|
8219
8395
|
faulted(error: unknown): boolean;
|
|
8220
|
-
file(attempts: readonly ClassifierAttempt[], plan?: Selection): void;
|
|
8396
|
+
file(attempts: readonly ClassifierAttempt[], plan?: Selection, draft?: LedgerDraft): void;
|
|
8221
8397
|
admit(name: string, args: Readonly<Record<string, unknown>>): void;
|
|
8222
8398
|
recall(): void;
|
|
8223
8399
|
close(): void;
|
|
@@ -8238,6 +8414,12 @@ export declare class LedgerRequest implements LedgerRequestInterface {
|
|
|
8238
8414
|
* thinking, until its pass observes the next call, and is final from then on.
|
|
8239
8415
|
*/
|
|
8240
8416
|
export declare interface LedgerRequestInterface {
|
|
8417
|
+
/** Holds the scope last applied by the ledger's plan, or undefined before one. */
|
|
8418
|
+
readonly scope: ScopeInterface | undefined;
|
|
8419
|
+
/** Records the scope applied by the ledger's plan for conditional restoration at settle. */
|
|
8420
|
+
apply(scope: ScopeInterface): void;
|
|
8421
|
+
/** Holds the copy and receipts adopted by the last provider turn, or undefined for a view fallback. */
|
|
8422
|
+
readonly sent: LedgerDraft | undefined;
|
|
8241
8423
|
/** Records an error the request's run reported through its `fault` event. */
|
|
8242
8424
|
fault(error: unknown): void;
|
|
8243
8425
|
/**
|
|
@@ -8310,8 +8492,9 @@ export declare interface LedgerRequestInterface {
|
|
|
8310
8492
|
*
|
|
8311
8493
|
* @param attempts - The selection's filing attempts, in asking order
|
|
8312
8494
|
* @param plan - The planned selection, or undefined when planning failed
|
|
8495
|
+
* @param draft - The copy and receipts eligible for adoption; omission discards that eligibility
|
|
8313
8496
|
*/
|
|
8314
|
-
file(attempts: readonly ClassifierAttempt[], plan?: Selection): void;
|
|
8497
|
+
file(attempts: readonly ClassifierAttempt[], plan?: Selection, draft?: LedgerDraft): void;
|
|
8315
8498
|
/**
|
|
8316
8499
|
* Admits one tool call of the request, compared by tool name and canonical arguments.
|
|
8317
8500
|
*
|
|
@@ -8368,7 +8551,11 @@ export declare interface LedgerResult extends AgentResult {
|
|
|
8368
8551
|
*
|
|
8369
8552
|
* @remarks
|
|
8370
8553
|
* `prompt` is a share of the ledger's `capacity`; the overhead tokens of the gauge come out of it
|
|
8371
|
-
* before the records and the tail take the rest. `tail`
|
|
8554
|
+
* before the records and the tail take the rest. `tail` bounds only the seed tail. The seed and
|
|
8555
|
+
* records are planned before the completed-exchange window spends spare room. The full window
|
|
8556
|
+
* with a delta copy, then its newest plain exchange with a full copy, then no exchange are priced
|
|
8557
|
+
* in that order. Admission cannot close an otherwise open recall or displace a selected record
|
|
8558
|
+
* line or seed message. A seed stub reads visibility across the window and the copy together.
|
|
8372
8559
|
* Each share must be finite, greater than 0, and at most 1.
|
|
8373
8560
|
*/
|
|
8374
8561
|
export declare interface LedgerShare {
|
|
@@ -8388,7 +8575,14 @@ export declare interface LedgerShare {
|
|
|
8388
8575
|
* not carried, so a hydrated ledger sizes and closes `recall` from its fallback reserve until it
|
|
8389
8576
|
* completes a request. A question a `strict: false` classifier held after a deterministic judge
|
|
8390
8577
|
* failure is not carried, so a hydrated ledger asks it again. Hydrating a second ledger from one snapshot forks
|
|
8391
|
-
* it at the parent's frontier.
|
|
8578
|
+
* it at the parent's frontier. `window`, when present, retains sent request copies, reply ids,
|
|
8579
|
+
* sentence receipts, and accepted amendment edges. The next plan keeps the same conversation
|
|
8580
|
+
* prefix when the live and hydrated reserves admit the same exchange rung. A rung between those
|
|
8581
|
+
* reserves can differ because hydration carries no gauge observations; this moves the prefix,
|
|
8582
|
+
* never the record coverage. A plain request omits `copy` because its content already lives in `conversation`.
|
|
8583
|
+
* The required window `digest` checks canonical held messages, lookup call context, copies, and receipts. A mismatch drains
|
|
8584
|
+
* the window and its evidence; a missing digest refuses the snapshot. An unencodable held message
|
|
8585
|
+
* makes `snapshot()` omit the window. The checksum detects edits, not authenticity.
|
|
8392
8586
|
*/
|
|
8393
8587
|
export declare interface LedgerSnapshot {
|
|
8394
8588
|
readonly conversation: ConversationSnapshot;
|
|
@@ -8396,9 +8590,10 @@ export declare interface LedgerSnapshot {
|
|
|
8396
8590
|
readonly notes: readonly string[];
|
|
8397
8591
|
readonly failures: readonly string[];
|
|
8398
8592
|
readonly gauge?: LedgerGauge;
|
|
8593
|
+
readonly window?: LedgerWindowSnapshot;
|
|
8399
8594
|
}
|
|
8400
8595
|
|
|
8401
|
-
/** Reads
|
|
8596
|
+
/** Reads structural faults of a ledger snapshot, including its optional held exchange window. */
|
|
8402
8597
|
export declare const ledgerSnapshotContract: ContractInterface<Readonly<{
|
|
8403
8598
|
conversation: Readonly<{
|
|
8404
8599
|
id: string;
|
|
@@ -8558,6 +8753,25 @@ gauge?: Readonly<{
|
|
|
8558
8753
|
scale: number;
|
|
8559
8754
|
overhead: number;
|
|
8560
8755
|
} & {}>;
|
|
8756
|
+
window?: Readonly<{
|
|
8757
|
+
digest: string;
|
|
8758
|
+
exchanges: readonly Readonly<{
|
|
8759
|
+
request: string;
|
|
8760
|
+
reply: string;
|
|
8761
|
+
lines: readonly Readonly<{
|
|
8762
|
+
key: string;
|
|
8763
|
+
title: string;
|
|
8764
|
+
source: string;
|
|
8765
|
+
sentence: number;
|
|
8766
|
+
} & {}>[];
|
|
8767
|
+
} & {
|
|
8768
|
+
copy?: string;
|
|
8769
|
+
}>[];
|
|
8770
|
+
amendments: readonly Readonly<{
|
|
8771
|
+
earlier: string;
|
|
8772
|
+
later: string;
|
|
8773
|
+
} & {}>[];
|
|
8774
|
+
} & {}>;
|
|
8561
8775
|
}>>;
|
|
8562
8776
|
|
|
8563
8777
|
/**
|
|
@@ -8678,6 +8892,24 @@ gauge: OptionalShape<ObjectShape< {
|
|
|
8678
8892
|
scale: NumberShape;
|
|
8679
8893
|
overhead: NumberShape;
|
|
8680
8894
|
}, boolean | ContractShape>>;
|
|
8895
|
+
window: OptionalShape<ObjectShape< {
|
|
8896
|
+
digest: StringShape;
|
|
8897
|
+
exchanges: ArrayShape<ObjectShape< {
|
|
8898
|
+
request: StringShape;
|
|
8899
|
+
copy: OptionalShape<StringShape>;
|
|
8900
|
+
reply: StringShape;
|
|
8901
|
+
lines: ArrayShape<ObjectShape< {
|
|
8902
|
+
key: StringShape;
|
|
8903
|
+
title: StringShape;
|
|
8904
|
+
source: StringShape;
|
|
8905
|
+
sentence: NumberShape;
|
|
8906
|
+
}, boolean | ContractShape>>;
|
|
8907
|
+
}, boolean | ContractShape>>;
|
|
8908
|
+
amendments: ArrayShape<ObjectShape< {
|
|
8909
|
+
earlier: StringShape;
|
|
8910
|
+
later: StringShape;
|
|
8911
|
+
}, boolean | ContractShape>>;
|
|
8912
|
+
}, boolean | ContractShape>>;
|
|
8681
8913
|
}, boolean | ContractShape>;
|
|
8682
8914
|
|
|
8683
8915
|
/**
|
|
@@ -8717,6 +8949,54 @@ export declare interface LedgerTopic {
|
|
|
8717
8949
|
readonly requested?: boolean;
|
|
8718
8950
|
}
|
|
8719
8951
|
|
|
8952
|
+
/** Reads structural faults of a serialized exchange window. */
|
|
8953
|
+
export declare const ledgerWindowContract: ContractInterface<Readonly<{
|
|
8954
|
+
digest: string;
|
|
8955
|
+
exchanges: readonly Readonly<{
|
|
8956
|
+
request: string;
|
|
8957
|
+
reply: string;
|
|
8958
|
+
lines: readonly Readonly<{
|
|
8959
|
+
key: string;
|
|
8960
|
+
title: string;
|
|
8961
|
+
source: string;
|
|
8962
|
+
sentence: number;
|
|
8963
|
+
} & {}>[];
|
|
8964
|
+
} & {
|
|
8965
|
+
copy?: string;
|
|
8966
|
+
}>[];
|
|
8967
|
+
amendments: readonly Readonly<{
|
|
8968
|
+
earlier: string;
|
|
8969
|
+
later: string;
|
|
8970
|
+
} & {}>[];
|
|
8971
|
+
} & {}>>;
|
|
8972
|
+
|
|
8973
|
+
/** Describes the minimal serialized evidence of a nonempty exchange window. */
|
|
8974
|
+
export declare const ledgerWindowShape: ObjectShape< {
|
|
8975
|
+
digest: StringShape;
|
|
8976
|
+
exchanges: ArrayShape<ObjectShape< {
|
|
8977
|
+
request: StringShape;
|
|
8978
|
+
copy: OptionalShape<StringShape>;
|
|
8979
|
+
reply: StringShape;
|
|
8980
|
+
lines: ArrayShape<ObjectShape< {
|
|
8981
|
+
key: StringShape;
|
|
8982
|
+
title: StringShape;
|
|
8983
|
+
source: StringShape;
|
|
8984
|
+
sentence: NumberShape;
|
|
8985
|
+
}, boolean | ContractShape>>;
|
|
8986
|
+
}, boolean | ContractShape>>;
|
|
8987
|
+
amendments: ArrayShape<ObjectShape< {
|
|
8988
|
+
earlier: StringShape;
|
|
8989
|
+
later: StringShape;
|
|
8990
|
+
}, boolean | ContractShape>>;
|
|
8991
|
+
}, boolean | ContractShape>;
|
|
8992
|
+
|
|
8993
|
+
/** Carries a nonempty exchange window, its message, copy, and receipt checksum, and its accepted edges. */
|
|
8994
|
+
export declare interface LedgerWindowSnapshot {
|
|
8995
|
+
readonly digest: string;
|
|
8996
|
+
readonly exchanges: readonly LedgerExchangeSnapshot[];
|
|
8997
|
+
readonly amendments: readonly LedgerAmendment[];
|
|
8998
|
+
}
|
|
8999
|
+
|
|
8720
9000
|
/** Carries the lowercase words and non-opening capitalized names of a message. */
|
|
8721
9001
|
export declare interface LedgerWordSet {
|
|
8722
9002
|
readonly words: ReadonlySet<string>;
|
|
@@ -8842,6 +9122,18 @@ export declare function matchesJSON(left: unknown, right: unknown): boolean;
|
|
|
8842
9122
|
*/
|
|
8843
9123
|
export declare function matchesJudgment(judgment: Judgment, question: JudgeQuestion, sources: readonly string[], state: string, model: string): boolean;
|
|
8844
9124
|
|
|
9125
|
+
/**
|
|
9126
|
+
* Checks whether two successful findings carry the same text for the same canonical lookup.
|
|
9127
|
+
* @param left - The finding to compare
|
|
9128
|
+
* @param right - The candidate copy
|
|
9129
|
+
* @returns True for the same finding or equal canonical identities and text; unkeyable findings match only themselves
|
|
9130
|
+
* @example
|
|
9131
|
+
* ```ts
|
|
9132
|
+
* matchesLookup(finding, finding) // true when it has a result
|
|
9133
|
+
* ```
|
|
9134
|
+
*/
|
|
9135
|
+
export declare function matchesLookup(left: LedgerLookupFinding, right: LedgerLookupFinding): boolean;
|
|
9136
|
+
|
|
8845
9137
|
/**
|
|
8846
9138
|
* Bounds the decoded error excerpt's input in bytes — `2048`, the leading bytes of a non-OK
|
|
8847
9139
|
* response body handed to the decoder before the read cancels the remainder, so a `ProviderError`
|