@farmslot/protocol 0.74.3 → 0.74.5

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/client-cache/held-data.d.ts +20 -0
  3. package/dist/client-cache/held-data.d.ts.map +1 -0
  4. package/dist/client-cache/held-data.js +34 -0
  5. package/dist/client-cache/held-data.js.map +1 -0
  6. package/dist/client-cache/index.d.ts +2 -0
  7. package/dist/client-cache/index.d.ts.map +1 -1
  8. package/dist/client-cache/index.js +2 -0
  9. package/dist/client-cache/index.js.map +1 -1
  10. package/dist/client-cache/native-history.d.ts +110 -7
  11. package/dist/client-cache/native-history.d.ts.map +1 -1
  12. package/dist/client-cache/native-history.js +382 -11
  13. package/dist/client-cache/native-history.js.map +1 -1
  14. package/dist/client-cache/terminal-text.d.ts +6 -0
  15. package/dist/client-cache/terminal-text.d.ts.map +1 -0
  16. package/dist/client-cache/terminal-text.js +27 -0
  17. package/dist/client-cache/terminal-text.js.map +1 -0
  18. package/dist/contracts/evals.d.ts +41 -0
  19. package/dist/contracts/evals.d.ts.map +1 -1
  20. package/dist/contracts/evals.js +25 -0
  21. package/dist/contracts/evals.js.map +1 -1
  22. package/dist/contracts/family.d.ts +2 -1
  23. package/dist/contracts/family.d.ts.map +1 -1
  24. package/dist/contracts/family.js.map +1 -1
  25. package/dist/contracts/runs.d.ts +7 -0
  26. package/dist/contracts/runs.d.ts.map +1 -1
  27. package/dist/contracts/runs.js.map +1 -1
  28. package/dist/rpc/auth.d.ts +9 -0
  29. package/dist/rpc/auth.d.ts.map +1 -1
  30. package/dist/rpc/auth.js +15 -0
  31. package/dist/rpc/auth.js.map +1 -1
  32. package/dist/rpc/eval.d.ts +2 -1
  33. package/dist/rpc/eval.d.ts.map +1 -1
  34. package/dist/rpc/eval.js.map +1 -1
  35. package/dist/rpc/native-session.d.ts +20 -6
  36. package/dist/rpc/native-session.d.ts.map +1 -1
  37. package/dist/version.d.ts +1 -1
  38. package/dist/version.js +1 -1
  39. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,25 @@ All notable changes to `@farmslot/protocol` are tracked here.
6
6
 
7
7
  - Active-development baseline; add user-facing changes here before release or package publication.
8
8
 
9
+ ## 0.74.5 - 2026-10-31
10
+
11
+ - `nativeSendLabel` gives a native composer's send action for a session state: "Send" when idle, "Queue message" for the next turn while a turn runs or waits on a request, none when the session takes no input. `nativeHistoryCanSend` is the held-data rule for sending a message: current, complete history of the conversation on screen (same generation, worker lease and task scope, not released), without `nativeHistoryCanAct`'s requirement that it be the exact snapshot on screen, so a newer read landing while a turn streams does not refuse a queued message.
12
+ - `RunEngineState.taskInit` records whether a run's task still waits for node initialization after prepare (`pending`) or is `initialized`.
13
+ - `NativeSessionEvent.tool` is `NativeSessionTool`, with optional `kind` (`NativeToolKind`: `command`, `file-edit`, `file-read`, `search`, `web`, `other`), `command` and `paths` set by the runner adapter. `nativeToolLabel` reads a tool call as "Run npm test", "Change a.ts, b.ts", "Read a.ts" or "Search src", or the runner's name; native timeline entries and `nativeWorkLabel` use it. `nativeCommandText` gives a command card's text: the command's first line and its last 10 output lines, cleaned as the terminal screen cleans them. `stripTerminalControls`, `terminalLinesFromText` and `terminalTailLinesFromText` move into the client cache from Companion; `stripTerminalControls` ends an OSC sequence at its own terminator, so a terminal hyperlink (OSC 8) keeps its text.
14
+ - `NativeSessionEvent.response`, optional, on `approval.resolved`: the response the host delivered for the request (`decision` or `answers`); absent when the host did not deliver one. `nativeTimeline` keeps each resolved request as a `resolution` entry, "Approved: …", "Declined: …", "Answered: question → answer" or "Resolved: …". Cached native history keeps them, and a snapshot saved by an older reader is read again from its start, once.
15
+ - `FamilyObservabilitySnapshot.latestRunId` is optional: a reference-only eval family has no runs yet.
16
+ - `nativeTimelineRows` adds a summary row for each finished turn's tool calls ("Worked for 4m 12s · 6 tools", "Stopped after …", "Failed after …") just before the turn's end, and marks those tools with it; tools keep their keys, and messages, statuses and a running turn stay as they are. A turn also ends where its host stopped (`session.closed`). `nativeWatchTools` and `nativeFoldWatched` decide that a turn seen running in a live read starts open.
17
+ - `nativeWork` finds the turn a native session is running, when it started and its current tool; `nativeWorkLabel` gives "Working · 1m 12s · Bash". Cached native history keeps the running turn's `turn.started`, which it dropped before as not a timeline entry.
18
+ - `nativeMessagePreview` gives the first 8 lines (at most 600 characters) of a native conversation message over 12 lines or 900 characters, with its line count; `nativeEntryPreview` applies it to user messages only, and `nativeMessageToggleLabel` gives the "Show all · N lines" or "Show less" label.
19
+ - `NativeFollow`, `NATIVE_FOLLOW_LATEST`, `nativeFollowScrolled`, `nativeFollowGrew` and `nativeFollowLabel` track whether a native conversation reader follows new output and how many entries arrived while they read further up.
20
+
21
+ ## 0.74.4 - 2026-10-30
22
+
23
+ - `buildGatewayPairingLink` turns a pairing QR payload into a Companion pair link (`farmslot://pair?payload=…`, or `farmslot-preview://` and `farmslot-development://` for those builds), encoded so it passes through `adb shell am start -d` unchanged.
24
+ - `NativeTranscript`, `appendNativePage`, `nativeDeliveryLabel` and `nativeCommandLockSettled` move into the client cache, replacing the copies Command Center and Companion each kept.
25
+ - `isSupersededRead`, `heldDataIsSaved` and `canActOn` move from Command Center into the client cache. `nativeHistoryCanAct` takes the full query state and follows `canActOn` for history read on this connection: a change notice or a reply that trails a newer write no longer locks native input. History restored from storage, offline history, a failed read and reads superseded for 60 s still wait for a current read.
26
+ - Record blind eval provenance and comparison eligibility without rewriting historical result packages.
27
+
9
28
  ## 0.74.3 - 2026-10-30
10
29
 
11
30
  - Keep loaded native history while a healthy source change refreshes the read; report real observation failures separately.
@@ -0,0 +1,20 @@
1
+ import type { ResourceQueryError, ResourceQueryState } from './types.js';
2
+ /** How long reads may keep being superseded before the held data counts as saved. */
3
+ export declare const SUPERSEDED_READ_GRACE_MS = 60000;
4
+ /**
5
+ * The gateway refuses a read whose source changed while it ran. It has already published that
6
+ * change, so the next read is scheduled: the held data is outdated, not unreadable.
7
+ */
8
+ export declare function isSupersededRead(error: ResourceQueryError | undefined): boolean;
9
+ /**
10
+ * Held data stays saved while disconnected, after a failed read, or while the gateway's own source
11
+ * check is not current. A reread in flight also marks it stale, but only for that read, so a notice
12
+ * shown then would come and go with every change. A superseded read counts once it keeps happening.
13
+ */
14
+ export declare function heldDataIsSaved(state: ResourceQueryState<unknown>, connected: boolean, now?: number): boolean;
15
+ /**
16
+ * Held data an action may start from: current, or stale only while its paced reread is due. The
17
+ * action rereads it first (readCurrent); saved data never qualifies.
18
+ */
19
+ export declare function canActOn(state: ResourceQueryState<unknown>, connected: boolean, now?: number): boolean;
20
+ //# sourceMappingURL=held-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"held-data.d.ts","sourceRoot":"","sources":["../../src/client-cache/held-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEzE,qFAAqF;AACrF,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,GAAG,OAAO,CAE/E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAClC,SAAS,EAAE,OAAO,EAClB,GAAG,SAAa,GACf,OAAO,CAUT;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAClC,SAAS,EAAE,OAAO,EAClB,GAAG,SAAa,GACf,OAAO,CAOT"}
@@ -0,0 +1,34 @@
1
+ /** How long reads may keep being superseded before the held data counts as saved. */
2
+ export const SUPERSEDED_READ_GRACE_MS = 60_000;
3
+ /**
4
+ * The gateway refuses a read whose source changed while it ran. It has already published that
5
+ * change, so the next read is scheduled: the held data is outdated, not unreadable.
6
+ */
7
+ export function isSupersededRead(error) {
8
+ return error?.code === 'RESOURCE_OBSERVATION_CHANGED';
9
+ }
10
+ /**
11
+ * Held data stays saved while disconnected, after a failed read, or while the gateway's own source
12
+ * check is not current. A reread in flight also marks it stale, but only for that read, so a notice
13
+ * shown then would come and go with every change. A superseded read counts once it keeps happening.
14
+ */
15
+ export function heldDataIsSaved(state, connected, now = Date.now()) {
16
+ return (state.status === 'stale' &&
17
+ state.data !== undefined &&
18
+ (!connected ||
19
+ (state.error !== undefined &&
20
+ (!isSupersededRead(state.error) ||
21
+ now - (state.observedAt ?? 0) >= SUPERSEDED_READ_GRACE_MS)) ||
22
+ (state.sourceObservation !== undefined && state.sourceObservation.status !== 'ready')));
23
+ }
24
+ /**
25
+ * Held data an action may start from: current, or stale only while its paced reread is due. The
26
+ * action rereads it first (readCurrent); saved data never qualifies.
27
+ */
28
+ export function canActOn(state, connected, now = Date.now()) {
29
+ return (connected &&
30
+ state.data !== undefined &&
31
+ (state.status === 'ready' ||
32
+ (state.status === 'stale' && !heldDataIsSaved(state, connected, now))));
33
+ }
34
+ //# sourceMappingURL=held-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"held-data.js","sourceRoot":"","sources":["../../src/client-cache/held-data.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAqC;IACpE,OAAO,KAAK,EAAE,IAAI,KAAK,8BAA8B,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAkC,EAClC,SAAkB,EAClB,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAEhB,OAAO,CACL,KAAK,CAAC,MAAM,KAAK,OAAO;QACxB,KAAK,CAAC,IAAI,KAAK,SAAS;QACxB,CAAC,CAAC,SAAS;YACT,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS;gBACxB,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC;oBAC7B,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC,IAAI,wBAAwB,CAAC,CAAC;YAC/D,CAAC,KAAK,CAAC,iBAAiB,KAAK,SAAS,IAAI,KAAK,CAAC,iBAAiB,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CACzF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CACtB,KAAkC,EAClC,SAAkB,EAClB,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAEhB,OAAO,CACL,SAAS;QACT,KAAK,CAAC,IAAI,KAAK,SAAS;QACxB,CAAC,KAAK,CAAC,MAAM,KAAK,OAAO;YACvB,CAAC,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,CACzE,CAAC;AACJ,CAAC"}
@@ -4,12 +4,14 @@ export * from './command-method.js';
4
4
  export { runResourceStoreConformance } from './conformance.js';
5
5
  export * from './content.js';
6
6
  export * from './diff-apply.js';
7
+ export * from './held-data.js';
7
8
  export * from './keys.js';
8
9
  export * from './native-history.js';
9
10
  export * from './prefetch.js';
10
11
  export * from './registry.js';
11
12
  export { RUN_LIST_COLLECTION_ID, type RunListCollectionData } from './run-list-versions.js';
12
13
  export * from './store.js';
14
+ export * from './terminal-text.js';
13
15
  export { createResourceCacheTransport, type ResourceClientConnection, type ResourceConnectionInputs, } from './transport.js';
14
16
  export * from './types.js';
15
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client-cache/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,4BAA4B,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,gBAAgB,CAAC;AACxB,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client-cache/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,KAAK,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC5F,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,4BAA4B,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,GAC9B,MAAM,gBAAgB,CAAC;AACxB,cAAc,YAAY,CAAC"}
@@ -4,12 +4,14 @@ export * from './command-method.js';
4
4
  export { runResourceStoreConformance } from './conformance.js';
5
5
  export * from './content.js';
6
6
  export * from './diff-apply.js';
7
+ export * from './held-data.js';
7
8
  export * from './keys.js';
8
9
  export * from './native-history.js';
9
10
  export * from './prefetch.js';
10
11
  export * from './registry.js';
11
12
  export { RUN_LIST_COLLECTION_ID } from './run-list-versions.js';
12
13
  export * from './store.js';
14
+ export * from './terminal-text.js';
13
15
  export { createResourceCacheTransport, } from './transport.js';
14
16
  export * from './types.js';
15
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client-cache/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAA8B,MAAM,wBAAwB,CAAC;AAC5F,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,4BAA4B,GAG7B,MAAM,gBAAgB,CAAC;AACxB,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client-cache/index.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAA8B,MAAM,wBAAwB,CAAC;AAC5F,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EACL,4BAA4B,GAG7B,MAAM,gBAAgB,CAAC;AACxB,cAAc,YAAY,CAAC"}
@@ -1,9 +1,9 @@
1
- import type { NativeSessionEvent, NativeSessionReadResult, NativeSessionTargetParams } from '../rpc/native-session.js';
1
+ import type { NativeCommandReceipt, NativeSessionEvent, NativeSessionReadResult, NativeSessionTargetParams, NativeSessionTool } from '../rpc/native-session.js';
2
2
  import { type ResourceQuery } from './registry.js';
3
- import type { ResourceReadResult } from './types.js';
3
+ import type { ResourceQueryState, ResourceReadResult } from './types.js';
4
4
  export interface NativeTimelineEntry {
5
5
  key: number;
6
- kind: 'user' | 'assistant' | 'tool' | 'status';
6
+ kind: 'user' | 'assistant' | 'tool' | 'resolution' | 'status';
7
7
  event: NativeSessionEvent;
8
8
  text: string;
9
9
  }
@@ -13,6 +13,7 @@ export interface NativeHistorySnapshot extends NativeSessionReadResult {
13
13
  historyRead: {
14
14
  pageReadCount: number;
15
15
  pageAfters: number[];
16
+ projection?: number;
16
17
  };
17
18
  }
18
19
  export declare const NATIVE_HISTORY_MESSAGES = 200;
@@ -57,8 +58,110 @@ export declare function nativeHistoryParams(value: unknown): NativeSessionTarget
57
58
  /** Durable retention counts sessions, while in-memory observation identity keeps the lease pin. */
58
59
  export declare function nativeHistoryStorageId(query: Pick<ResourceQuery, 'id' | 'method' | 'params'>): string;
59
60
  export declare function storedNativeHistoryMatches(target: NativeSessionTargetParams, value: unknown): value is NativeSessionReadResult;
60
- export declare function nativeHistoryCanAct(observation: {
61
- status: string;
62
- data?: NativeSessionReadResult;
63
- } | undefined, rendered: NativeSessionReadResult | undefined, connected: boolean): boolean;
61
+ /**
62
+ * Sending a message: current, complete history of the conversation on screen. A newer read of it,
63
+ * landing while a turn streams, does not refuse the message; a resumed generation, another worker
64
+ * lease or a released task scope does. Native actions do not reread first, so history restored from
65
+ * storage (no read stamp) waits for a live read.
66
+ */
67
+ export declare function nativeHistoryCanSend(observation: ResourceQueryState<NativeSessionReadResult> | undefined, rendered: NativeSessionReadResult | undefined, connected: boolean, now?: number): boolean;
68
+ /** An answer or stop acts on the exact history snapshot on screen. */
69
+ export declare function nativeHistoryCanAct(observation: ResourceQueryState<NativeSessionReadResult> | undefined, rendered: NativeSessionReadResult | undefined, connected: boolean, now?: number): boolean;
70
+ export interface NativeTranscript {
71
+ events: NativeSessionEvent[];
72
+ cursor: number;
73
+ }
74
+ /** Page sequence is authoritative. Ignore repeats; reject a gap rather than hide missing history. */
75
+ export declare function appendNativePage(previous: NativeTranscript, page: NativeSessionReadResult): NativeTranscript;
76
+ /**
77
+ * The composer's send action for a session in this state: "Send" when it is idle, "Queue message"
78
+ * for the next turn while a turn runs or waits on a request. Undefined: it takes no input now.
79
+ */
80
+ export declare function nativeSendLabel(state: NativeSessionReadResult['session']['state'] | undefined): 'Send' | 'Queue message' | undefined;
81
+ export declare function nativeDeliveryLabel(receipt?: NativeCommandReceipt): string;
82
+ /** A confirmed replacement generation must not inherit the old browser input lock. */
83
+ export declare function nativeCommandLockSettled(command: {
84
+ commandId: string;
85
+ generation: string;
86
+ }, currentGeneration: string, receipt?: NativeCommandReceipt, events?: NativeSessionEvent[]): boolean;
87
+ export interface NativeFollow {
88
+ /** The reader is at the end, so new output stays in view. */
89
+ following: boolean;
90
+ /** Timeline entries added while the reader was away from the end. */
91
+ unseen: number;
92
+ }
93
+ /** Opening a conversation, or jumping to its latest entry, follows again. */
94
+ export declare const NATIVE_FOLLOW_LATEST: NativeFollow;
95
+ /** The reader scrolled. Back at the end means caught up. */
96
+ export declare function nativeFollowScrolled(state: NativeFollow, distanceFromEnd: number): NativeFollow;
97
+ /** Entries arrived. A reader away from the end has that many more to catch up on. */
98
+ export declare function nativeFollowGrew(state: NativeFollow, added: number): NativeFollow;
99
+ /** The jump control's label, or none while the reader follows. */
100
+ export declare function nativeFollowLabel(state: NativeFollow): string | undefined;
101
+ export interface NativeMessagePreview {
102
+ text: string;
103
+ lines: number;
104
+ }
105
+ /** A long message (a worker's dispatch prompt) shows its start until the reader expands it. */
106
+ export declare function nativeMessagePreview(text: string): NativeMessagePreview | undefined;
107
+ /** Only the reader's own messages collapse; assistant, tool and status entries show in full. */
108
+ export declare function nativeEntryPreview(entry: NativeTimelineEntry): NativeMessagePreview | undefined;
109
+ export declare function nativeMessageToggleLabel(preview: NativeMessagePreview, expanded: boolean): string;
110
+ export interface NativeWork {
111
+ /** When the open turn started, in ms. */
112
+ since: number;
113
+ /** The tool the turn is running now. */
114
+ tool?: string;
115
+ }
116
+ /** The turn in progress, if any: when it started and the tool it is running now. */
117
+ export declare function nativeWork(events: NativeSessionEvent[]): NativeWork | undefined;
118
+ /**
119
+ * "Working · 1m 12s · Bash": how long the turn has run, and its current tool.
120
+ * `since` is the execution host's clock: a client clock ahead of it overstates the time by the skew.
121
+ */
122
+ export declare function nativeWorkLabel(work: NativeWork, now: number): string;
123
+ /**
124
+ * A tool call as a reader reads it: "Run npm test", "Change a.ts, b.ts", "Read a.ts", "Search src",
125
+ * at most 120 characters before an ellipsis. A tool whose adapter gave no kind or subject keeps the
126
+ * runner's own name.
127
+ */
128
+ export declare function nativeToolLabel(tool: NativeSessionTool | undefined): string;
129
+ /**
130
+ * A command card's text: "$ npm test", then the last 10 lines it printed, with "… 12 earlier lines"
131
+ * above them; its raw input and output stay one tap away. Undefined for any other tool, whose card
132
+ * shows its raw input and output.
133
+ */
134
+ export declare function nativeCommandText(tool: NativeSessionTool | undefined): string | undefined;
135
+ export type NativeTimelineRow =
136
+ /** `fold`: the summary row that hides this tool while folded. */
137
+ {
138
+ kind: 'entry';
139
+ key: number;
140
+ entry: NativeTimelineEntry;
141
+ fold?: number;
142
+ }
143
+ /** Keyed by the entry that ended its turn; `tools` are the keys it hides. */
144
+ | {
145
+ kind: 'work';
146
+ key: number;
147
+ label: string;
148
+ tools: number[];
149
+ };
150
+ /**
151
+ * The timeline with a summary row for each finished turn's tool calls, "Worked for 4m 12s ·
152
+ * 6 tools", just before the turn's end, and those tools marked with it. Nothing moves when a
153
+ * turn finishes: the tools keep their place and their keys, and the row is added below them.
154
+ * A turn ends at `turn.completed`, or at `session.closed` when its host stopped mid-turn.
155
+ * Messages and statuses stay; a running turn has no summary.
156
+ */
157
+ export declare function nativeTimelineRows(entries: NativeTimelineEntry[]): NativeTimelineRow[];
158
+ /**
159
+ * Tools shown running in a live read here. A turn the reader watched starts open when it
160
+ * finishes, so its tools don't fold away under them. A stored snapshot is not live: a turn that
161
+ * finished while the reader was away starts folded.
162
+ */
163
+ export declare function nativeWatchTools(rows: NativeTimelineRow[], watched: Set<number>, live: boolean): void;
164
+ export declare function nativeFoldWatched(row: Extract<NativeTimelineRow, {
165
+ kind: 'work';
166
+ }>, watched: ReadonlySet<number>): boolean;
64
167
  //# sourceMappingURL=native-history.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-history.d.ts","sourceRoot":"","sources":["../../src/client-cache/native-history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,KAAK,aAAa,EAA0C,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC/C,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,kBAAkB,EAAE,GAAG,mBAAmB,EAAE,CAyElF;AAED,wEAAwE;AACxE,MAAM,WAAW,qBAAsB,SAAQ,uBAAuB;IACpE,WAAW,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC9D;AAED,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,iFAAiF;A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