@granular-software/sdk 0.4.58 → 0.4.60
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/README.md +38 -4
- package/dist/agent-evals.d.mts +2 -3
- package/dist/agent-evals.d.ts +2 -3
- package/dist/agent-evals.js +2910 -1329
- package/dist/agent-evals.js.map +1 -1
- package/dist/agent-evals.mjs +2910 -1329
- package/dist/agent-evals.mjs.map +1 -1
- package/dist/agent-harness.d.mts +3 -3
- package/dist/agent-harness.d.ts +3 -3
- package/dist/agent-harness.js +67 -131
- package/dist/agent-harness.js.map +1 -1
- package/dist/agent-harness.mjs +67 -131
- package/dist/agent-harness.mjs.map +1 -1
- package/dist/cli/index.js +2394 -1009
- package/dist/{client-DFaCRSto.d.mts → client-BzgQvNyG.d.ts} +90 -17
- package/dist/{client-UdGt44dF.d.ts → client-DSkGcmmX.d.mts} +90 -17
- package/dist/index.d.mts +33 -11
- package/dist/index.d.ts +33 -11
- package/dist/index.js +2840 -1252
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2826 -1253
- package/dist/index.mjs.map +1 -1
- package/dist/{spend-czRX7l0X.d.mts → spend-CNe-Ff6U.d.mts} +670 -98
- package/dist/{spend-czRX7l0X.d.ts → spend-CNe-Ff6U.d.ts} +670 -98
- package/dist/spend.d.mts +1 -1
- package/dist/spend.d.ts +1 -1
- package/package.json +5 -2
|
@@ -1,7 +1,503 @@
|
|
|
1
|
+
type FeedSourceActor = "user" | "agent" | "system" | "customer_method";
|
|
2
|
+
interface FeedSource {
|
|
3
|
+
actor: FeedSourceActor;
|
|
4
|
+
clientId?: string;
|
|
5
|
+
jobId?: string;
|
|
6
|
+
turnId?: string;
|
|
7
|
+
method?: string;
|
|
8
|
+
}
|
|
9
|
+
type FeedIconToken = "neutral" | "info" | "database" | "search" | "clock" | "sparkles" | "check" | "warning" | "error";
|
|
10
|
+
type FeedFeedbackTone = "info" | "working" | "awaiting" | "success" | "warning" | "error";
|
|
11
|
+
/** Tones that describe live state; terminal success belongs in durable history. */
|
|
12
|
+
type FeedTransientFeedbackTone = Exclude<FeedFeedbackTone, "success">;
|
|
13
|
+
type FeedItemKind = "message" | "feedback" | "objects" | "table" | "artifact" | "file" | "action_suggestion" | "prompt";
|
|
14
|
+
interface FeedTarget {
|
|
15
|
+
className: string;
|
|
16
|
+
id: string;
|
|
17
|
+
label?: string;
|
|
18
|
+
}
|
|
19
|
+
interface FeedItemBase {
|
|
20
|
+
id: string;
|
|
21
|
+
sequence: number;
|
|
22
|
+
occurredAt: number;
|
|
23
|
+
kind: FeedItemKind;
|
|
24
|
+
operationId: string;
|
|
25
|
+
batchIndex: number;
|
|
26
|
+
source?: FeedSource;
|
|
27
|
+
}
|
|
28
|
+
interface MessageFeedItem extends FeedItemBase {
|
|
29
|
+
kind: "message";
|
|
30
|
+
payload: {
|
|
31
|
+
role: "user" | "assistant" | "system";
|
|
32
|
+
text: string;
|
|
33
|
+
format?: "plain_text" | "markdown";
|
|
34
|
+
target?: FeedTarget;
|
|
35
|
+
inReplyToPromptId?: string;
|
|
36
|
+
answer?: string | number | boolean | null;
|
|
37
|
+
answerDisplay?: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
interface FeedbackFeedItem extends FeedItemBase {
|
|
41
|
+
kind: "feedback";
|
|
42
|
+
payload: {
|
|
43
|
+
text: string;
|
|
44
|
+
icon?: FeedIconToken;
|
|
45
|
+
tone: FeedFeedbackTone;
|
|
46
|
+
audience: "customer";
|
|
47
|
+
action?: {
|
|
48
|
+
actionId: string;
|
|
49
|
+
kind: "frontend" | "backend" | "system";
|
|
50
|
+
label: string;
|
|
51
|
+
status: "queued" | "done" | "failed";
|
|
52
|
+
};
|
|
53
|
+
code?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
type FeedObjectReference = {
|
|
57
|
+
type: "entry";
|
|
58
|
+
path: string;
|
|
59
|
+
} | {
|
|
60
|
+
type: "list";
|
|
61
|
+
name: string;
|
|
62
|
+
} | {
|
|
63
|
+
type: "variable";
|
|
64
|
+
name: string;
|
|
65
|
+
};
|
|
66
|
+
interface ObjectsFeedItem extends FeedItemBase {
|
|
67
|
+
kind: "objects";
|
|
68
|
+
payload: {
|
|
69
|
+
label?: string;
|
|
70
|
+
refs: FeedObjectReference[];
|
|
71
|
+
fallback?: Array<{
|
|
72
|
+
className?: string;
|
|
73
|
+
id: string;
|
|
74
|
+
label?: string;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
type FeedTableCell = string | number | boolean | null | {
|
|
79
|
+
kind: "relative_time" | "date";
|
|
80
|
+
value: string | number;
|
|
81
|
+
};
|
|
82
|
+
interface FeedTableColumn {
|
|
83
|
+
id: string;
|
|
84
|
+
label: string;
|
|
85
|
+
}
|
|
86
|
+
interface FeedTableRowReference {
|
|
87
|
+
entryPath?: string;
|
|
88
|
+
className?: string;
|
|
89
|
+
id?: string;
|
|
90
|
+
label?: string;
|
|
91
|
+
}
|
|
92
|
+
interface FeedTableRow {
|
|
93
|
+
id: string;
|
|
94
|
+
reference?: FeedTableRowReference;
|
|
95
|
+
cells: FeedTableCell[];
|
|
96
|
+
}
|
|
97
|
+
interface FeedTableProjection {
|
|
98
|
+
id: string;
|
|
99
|
+
label?: string;
|
|
100
|
+
source?: string;
|
|
101
|
+
columns: FeedTableColumn[];
|
|
102
|
+
rows: FeedTableRow[];
|
|
103
|
+
}
|
|
104
|
+
interface TableFeedItem extends FeedItemBase {
|
|
105
|
+
kind: "table";
|
|
106
|
+
payload: {
|
|
107
|
+
tableId: string;
|
|
108
|
+
label?: string;
|
|
109
|
+
columns: FeedTableColumn[];
|
|
110
|
+
rows: FeedTableRow[];
|
|
111
|
+
truncated?: boolean;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
interface ArtifactFeedItem extends FeedItemBase {
|
|
115
|
+
kind: "artifact";
|
|
116
|
+
payload: {
|
|
117
|
+
artifactId: string;
|
|
118
|
+
fallback: {
|
|
119
|
+
kind: "effect" | "batch" | "state_path";
|
|
120
|
+
label: string;
|
|
121
|
+
status?: string;
|
|
122
|
+
description?: string;
|
|
123
|
+
target?: FeedTarget;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
type FeedFileSource = "dock" | "sdk" | "agent" | "runtime" | "processor" | "library" | "imported";
|
|
128
|
+
interface FileFeedItem extends FeedItemBase {
|
|
129
|
+
kind: "file";
|
|
130
|
+
payload: {
|
|
131
|
+
fileId: string;
|
|
132
|
+
fallback: {
|
|
133
|
+
filename: string;
|
|
134
|
+
contentType?: string;
|
|
135
|
+
byteLength?: number;
|
|
136
|
+
status?: string;
|
|
137
|
+
source?: FeedFileSource;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The bounded subset needed to create an artifact from a suggestion.
|
|
143
|
+
*
|
|
144
|
+
* This is deliberately data-only. It must never contain executable UI or
|
|
145
|
+
* callback values.
|
|
146
|
+
*/
|
|
147
|
+
interface NormalizedSuggestedArtifact {
|
|
148
|
+
version?: 1;
|
|
149
|
+
kind: "effect" | "batch" | "state_path";
|
|
150
|
+
label: string;
|
|
151
|
+
description?: string;
|
|
152
|
+
status?: string;
|
|
153
|
+
target?: FeedTarget;
|
|
154
|
+
inputSchema?: Record<string, unknown>;
|
|
155
|
+
inputValues?: Record<string, unknown>;
|
|
156
|
+
relationships?: Record<string, string | string[] | null>;
|
|
157
|
+
policy?: Record<string, unknown>;
|
|
158
|
+
statePlan?: Record<string, unknown>;
|
|
159
|
+
metadata?: Record<string, unknown>;
|
|
160
|
+
}
|
|
161
|
+
interface ActionSuggestionFeedItem extends FeedItemBase {
|
|
162
|
+
kind: "action_suggestion";
|
|
163
|
+
payload: {
|
|
164
|
+
suggestionId: string;
|
|
165
|
+
label: string;
|
|
166
|
+
description?: string;
|
|
167
|
+
target?: FeedTarget;
|
|
168
|
+
proposedArtifact?: NormalizedSuggestedArtifact;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
interface PromptFeedItem extends FeedItemBase {
|
|
172
|
+
kind: "prompt";
|
|
173
|
+
payload: {
|
|
174
|
+
promptId: string;
|
|
175
|
+
type: "choice" | "confirm" | "input";
|
|
176
|
+
title: string;
|
|
177
|
+
message: string;
|
|
178
|
+
options?: Array<{
|
|
179
|
+
value: string;
|
|
180
|
+
label: string;
|
|
181
|
+
}>;
|
|
182
|
+
placeholder?: string;
|
|
183
|
+
defaultValue?: string | boolean | null;
|
|
184
|
+
allowEmpty?: boolean;
|
|
185
|
+
openedAt: number;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
type FeedItem = MessageFeedItem | FeedbackFeedItem | ObjectsFeedItem | TableFeedItem | ArtifactFeedItem | FileFeedItem | ActionSuggestionFeedItem | PromptFeedItem;
|
|
189
|
+
interface TransientFeedItemBase {
|
|
190
|
+
id: string;
|
|
191
|
+
ordinal: number;
|
|
192
|
+
revision: number;
|
|
193
|
+
createdAt: number;
|
|
194
|
+
updatedAt: number;
|
|
195
|
+
expiresAt?: number;
|
|
196
|
+
source?: Omit<FeedSource, "actor" | "clientId"> & {
|
|
197
|
+
actor: Exclude<FeedSourceActor, "user">;
|
|
198
|
+
promptId?: string;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
interface TransientMessageFeedItem extends TransientFeedItemBase {
|
|
202
|
+
kind: "message";
|
|
203
|
+
producerRevision: number;
|
|
204
|
+
payload: {
|
|
205
|
+
role: "assistant";
|
|
206
|
+
text: string;
|
|
207
|
+
format?: "plain_text" | "markdown";
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
interface TransientFeedbackFeedItem extends TransientFeedItemBase {
|
|
211
|
+
kind: "feedback";
|
|
212
|
+
payload: {
|
|
213
|
+
text: string;
|
|
214
|
+
icon?: FeedIconToken;
|
|
215
|
+
tone: FeedTransientFeedbackTone;
|
|
216
|
+
audience: "customer";
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
type TransientFeedItem = TransientMessageFeedItem | TransientFeedbackFeedItem;
|
|
220
|
+
interface FeedSnapshot {
|
|
221
|
+
tail: FeedItem[];
|
|
222
|
+
transients: TransientFeedItem[];
|
|
223
|
+
revision: number;
|
|
224
|
+
documentEpoch: number;
|
|
225
|
+
documentRevision: number;
|
|
226
|
+
lastSequence: number;
|
|
227
|
+
archivedThroughSequence: number;
|
|
228
|
+
hasOlder: boolean;
|
|
229
|
+
isHydrated: boolean;
|
|
230
|
+
isRepairing: boolean;
|
|
231
|
+
error: Error | null;
|
|
232
|
+
}
|
|
233
|
+
interface FeedListOptions {
|
|
234
|
+
afterSequence?: number;
|
|
235
|
+
beforeSequence?: number;
|
|
236
|
+
limit?: number;
|
|
237
|
+
}
|
|
238
|
+
interface FeedPage {
|
|
239
|
+
items: FeedItem[];
|
|
240
|
+
firstSequence: number | null;
|
|
241
|
+
lastSequence: number | null;
|
|
242
|
+
hasMoreBefore: boolean;
|
|
243
|
+
hasMoreAfter: boolean;
|
|
244
|
+
}
|
|
245
|
+
interface FeedSubscribeOptions {
|
|
246
|
+
afterSequence?: number;
|
|
247
|
+
}
|
|
248
|
+
type FeedSubscriptionChange = {
|
|
249
|
+
type: "append";
|
|
250
|
+
items: FeedItem[];
|
|
251
|
+
} | {
|
|
252
|
+
type: "transients";
|
|
253
|
+
items: TransientFeedItem[];
|
|
254
|
+
revision: number;
|
|
255
|
+
} | {
|
|
256
|
+
type: "resource_refresh";
|
|
257
|
+
documentRevision: number;
|
|
258
|
+
resourceIds?: string[];
|
|
259
|
+
} | {
|
|
260
|
+
type: "reset";
|
|
261
|
+
snapshot: FeedSnapshot;
|
|
262
|
+
};
|
|
263
|
+
interface SessionFeedApi {
|
|
264
|
+
getSnapshot(): FeedSnapshot;
|
|
265
|
+
list(options?: FeedListOptions): Promise<FeedPage>;
|
|
266
|
+
subscribe(listener: (change: FeedSubscriptionChange) => void, options?: FeedSubscribeOptions): () => void;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Merge independently contiguous archive/live collections by authoritative
|
|
270
|
+
* sequence. Expected overlap collapses by occurrence identity; conflicting
|
|
271
|
+
* IDs or positions fail closed.
|
|
272
|
+
*/
|
|
273
|
+
declare function mergeFeedItemsBySequence(...collections: ReadonlyArray<readonly FeedItem[]>): FeedItem[];
|
|
274
|
+
/**
|
|
275
|
+
* Select the newest revision of each transient and preserve server ordinal
|
|
276
|
+
* order. Duplicate ordinal ownership is a chronology violation.
|
|
277
|
+
*/
|
|
278
|
+
declare function orderTransientFeedItems(items: readonly TransientFeedItem[]): TransientFeedItem[];
|
|
279
|
+
type FeedListTransport = (options: FeedListOptions) => Promise<FeedPage | Record<string, unknown>>;
|
|
280
|
+
type FeedSnapshotRegressionReason = "canonical_deactivation" | "invalid_canonical_document" | "older_document_epoch" | "document_revision_regression" | "last_sequence_regression" | "last_sequence_without_revision" | "feed_revision_regression" | "identity_conflict";
|
|
281
|
+
type FeedDiagnostic = {
|
|
282
|
+
type: "gap_detected";
|
|
283
|
+
expectedSequence: number;
|
|
284
|
+
targetSequence: number;
|
|
285
|
+
repairAvailable: boolean;
|
|
286
|
+
} | {
|
|
287
|
+
type: "gap_repair";
|
|
288
|
+
outcome: "success" | "failure" | "cancelled";
|
|
289
|
+
durationMs: number;
|
|
290
|
+
pageCount: number;
|
|
291
|
+
repairedThroughSequence: number;
|
|
292
|
+
targetSequence: number;
|
|
293
|
+
} | {
|
|
294
|
+
type: "snapshot_regression_rejected";
|
|
295
|
+
reason: FeedSnapshotRegressionReason;
|
|
296
|
+
currentDocumentEpoch: number;
|
|
297
|
+
incomingDocumentEpoch: number;
|
|
298
|
+
currentDocumentRevision: number;
|
|
299
|
+
incomingDocumentRevision: number;
|
|
300
|
+
currentFeedRevision: number;
|
|
301
|
+
incomingFeedRevision: number;
|
|
302
|
+
currentLastSequence: number;
|
|
303
|
+
incomingLastSequence: number;
|
|
304
|
+
} | {
|
|
305
|
+
type: "unknown_kind";
|
|
306
|
+
kind: string;
|
|
307
|
+
sequence: number;
|
|
308
|
+
consumer?: "sdk" | "dock";
|
|
309
|
+
};
|
|
310
|
+
type FeedDiagnosticListener = (diagnostic: FeedDiagnostic) => void;
|
|
311
|
+
declare const GRANULAR_FEED_DIAGNOSTIC_EVENT: "granular:feed-diagnostic";
|
|
312
|
+
type FeedDiagnosticEventTarget = {
|
|
313
|
+
dispatchEvent?: (event: unknown) => unknown;
|
|
314
|
+
CustomEvent?: new (type: string, init: {
|
|
315
|
+
detail: Readonly<FeedDiagnostic>;
|
|
316
|
+
}) => unknown;
|
|
317
|
+
};
|
|
318
|
+
declare function normalizeFeedDiagnosticKind(kind: string): string;
|
|
319
|
+
declare function normalizeFeedDiagnostic(diagnostic: FeedDiagnostic): FeedDiagnostic;
|
|
320
|
+
/**
|
|
321
|
+
* Dependency-free production sink for browser SDK and Dock diagnostics.
|
|
322
|
+
*
|
|
323
|
+
* Hosts can listen for `granular:feed-diagnostic` and forward the bounded
|
|
324
|
+
* metadata to their telemetry provider. Server/customer payloads, operation
|
|
325
|
+
* IDs, and resource IDs are not part of the diagnostic union.
|
|
326
|
+
*/
|
|
327
|
+
declare function emitFeedDiagnosticToDefaultSink(diagnostic: FeedDiagnostic, target?: FeedDiagnosticEventTarget): void;
|
|
328
|
+
declare function emitFeedDiagnostic(diagnostic: FeedDiagnostic, listener?: FeedDiagnosticListener | null): void;
|
|
329
|
+
interface SessionFeedControllerOptions {
|
|
330
|
+
listTransport?: FeedListTransport | null;
|
|
331
|
+
isHydrated?: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Receives chronology metadata only. Durable payloads, operation IDs, and
|
|
334
|
+
* resource IDs are deliberately not included.
|
|
335
|
+
*/
|
|
336
|
+
onDiagnostic?: FeedDiagnosticListener | null;
|
|
337
|
+
/** Test-only clock seam for deterministic repair duration assertions. */
|
|
338
|
+
now?: () => number;
|
|
339
|
+
/** Test seam for deterministic quiet-feed repair retries. */
|
|
340
|
+
scheduleRepairRetry?: (callback: () => void, delayMs: number) => unknown;
|
|
341
|
+
/** Test seam paired with `scheduleRepairRetry`. */
|
|
342
|
+
cancelRepairRetry?: (handle: unknown) => void;
|
|
343
|
+
/** Initial archive repair retry delay. Defaults to 500ms. */
|
|
344
|
+
initialRepairRetryDelayMs?: number;
|
|
345
|
+
/** Maximum archive repair retry delay. Defaults to 10s. */
|
|
346
|
+
maxRepairRetryDelayMs?: number;
|
|
347
|
+
}
|
|
348
|
+
interface FeedDocumentState {
|
|
349
|
+
schemaVersion: 1;
|
|
350
|
+
activation: {
|
|
351
|
+
mode: "canonical";
|
|
352
|
+
activatedAt: number;
|
|
353
|
+
};
|
|
354
|
+
revision: number;
|
|
355
|
+
lastSequence: number;
|
|
356
|
+
archivedThroughSequence: number;
|
|
357
|
+
tail: FeedItem[];
|
|
358
|
+
transientById: Record<string, TransientFeedItem>;
|
|
359
|
+
lastTransientOrdinal: number;
|
|
360
|
+
}
|
|
361
|
+
declare function emptyFeedSnapshot(isHydrated?: boolean): FeedSnapshot;
|
|
362
|
+
/**
|
|
363
|
+
* Canonical mode is selected solely by the irreversible activation marker.
|
|
364
|
+
*
|
|
365
|
+
* This is intentionally separate from document-shape validation. An activated
|
|
366
|
+
* but temporarily partial/corrupt document must fail closed in canonical mode;
|
|
367
|
+
* treating it as non-canonical would mix two mutually exclusive projections.
|
|
368
|
+
*/
|
|
369
|
+
declare function hasCanonicalSessionFeedActivation(document: unknown): boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Capability predicate retained for SDK consumers. It answers whether the
|
|
372
|
+
* session is canonical, not whether the current canonical payload is valid.
|
|
373
|
+
*/
|
|
374
|
+
declare function isCanonicalSessionFeedDocument(document: unknown): boolean;
|
|
375
|
+
declare function readSessionFeedSnapshot(document: unknown, options?: {
|
|
376
|
+
isHydrated?: boolean;
|
|
377
|
+
isRepairing?: boolean;
|
|
378
|
+
error?: Error | null;
|
|
379
|
+
}): FeedSnapshot;
|
|
380
|
+
declare function normalizeFeedPage(value: unknown): FeedPage;
|
|
381
|
+
type FeedSubscriber = (change: FeedSubscriptionChange) => void;
|
|
382
|
+
/**
|
|
383
|
+
* Stateful bridge between replicated Automerge snapshots and the public feed.
|
|
384
|
+
*
|
|
385
|
+
* It owns sequence deduplication, stale snapshot rejection and history repair.
|
|
386
|
+
* UI consumers never merge raw websocket events with this stream.
|
|
387
|
+
*/
|
|
388
|
+
declare class SessionFeedController implements SessionFeedApi {
|
|
389
|
+
private snapshot;
|
|
390
|
+
private canonical;
|
|
391
|
+
private canonicalStructureValid;
|
|
392
|
+
private deliveredThrough;
|
|
393
|
+
private knownBySequence;
|
|
394
|
+
private sequenceById;
|
|
395
|
+
private subscribers;
|
|
396
|
+
private listTransport;
|
|
397
|
+
private repairGeneration;
|
|
398
|
+
private repairPromise;
|
|
399
|
+
private repairRetryHandle;
|
|
400
|
+
private repairRetryToken;
|
|
401
|
+
private repairFailureAttempt;
|
|
402
|
+
private scheduleRepairRetryCallback;
|
|
403
|
+
private cancelRepairRetryCallback;
|
|
404
|
+
private initialRepairRetryDelayMs;
|
|
405
|
+
private maxRepairRetryDelayMs;
|
|
406
|
+
private disposed;
|
|
407
|
+
private diagnosticListener;
|
|
408
|
+
private diagnosticNow;
|
|
409
|
+
private observedUnknownPositions;
|
|
410
|
+
constructor(initialDocument: unknown, options?: SessionFeedControllerOptions);
|
|
411
|
+
setListTransport(transport: FeedListTransport | null): void;
|
|
412
|
+
getSnapshot(): FeedSnapshot;
|
|
413
|
+
/**
|
|
414
|
+
* Stop background archive work when its owning Session is replaced or
|
|
415
|
+
* explicitly disconnected. Late transport completions are quarantined by
|
|
416
|
+
* the generation check and cannot update subscribers.
|
|
417
|
+
*/
|
|
418
|
+
dispose(): void;
|
|
419
|
+
list(options?: FeedListOptions): Promise<FeedPage>;
|
|
420
|
+
subscribe(listener: FeedSubscriber, options?: FeedSubscribeOptions): () => void;
|
|
421
|
+
/**
|
|
422
|
+
* Accept the latest synced document. Calls may arrive out of order after a
|
|
423
|
+
* reconnect; freshness watermarks prevent an older snapshot from regressing
|
|
424
|
+
* durable positions or transient state.
|
|
425
|
+
*/
|
|
426
|
+
updateDocument(document: unknown, options?: {
|
|
427
|
+
forceReset?: boolean;
|
|
428
|
+
}): void;
|
|
429
|
+
/**
|
|
430
|
+
* Quarantine a canonical replacement rejected by the document transport.
|
|
431
|
+
* The notice deliberately contains no replacement document, so accepted
|
|
432
|
+
* feed history remains the only data visible to subscribers during repair.
|
|
433
|
+
*
|
|
434
|
+
* @internal
|
|
435
|
+
*/
|
|
436
|
+
quarantineCanonicalReplacement(quarantine: {
|
|
437
|
+
documentEpoch: number;
|
|
438
|
+
documentRevision: number;
|
|
439
|
+
error: Error;
|
|
440
|
+
}): void;
|
|
441
|
+
private acceptReset;
|
|
442
|
+
private emitDiagnostic;
|
|
443
|
+
private rejectSnapshotRegression;
|
|
444
|
+
private observeUnknownKinds;
|
|
445
|
+
private selectNewerTransients;
|
|
446
|
+
private remember;
|
|
447
|
+
private findIdentityConflict;
|
|
448
|
+
private drainContiguous;
|
|
449
|
+
private startRepair;
|
|
450
|
+
private cancelScheduledRepairRetry;
|
|
451
|
+
private scheduleQuietRepairRetry;
|
|
452
|
+
private repair;
|
|
453
|
+
private emit;
|
|
454
|
+
}
|
|
455
|
+
interface PublishFeedbackOptions {
|
|
456
|
+
icon?: FeedIconToken;
|
|
457
|
+
tone?: FeedFeedbackTone;
|
|
458
|
+
code?: string;
|
|
459
|
+
operationId?: string;
|
|
460
|
+
}
|
|
461
|
+
interface PublishTransientFeedbackOptions {
|
|
462
|
+
icon?: FeedIconToken;
|
|
463
|
+
tone?: FeedTransientFeedbackTone;
|
|
464
|
+
expiresAt?: number;
|
|
465
|
+
operationId?: string;
|
|
466
|
+
}
|
|
467
|
+
interface SettleTransientFeedbackOptions {
|
|
468
|
+
icon?: FeedIconToken;
|
|
469
|
+
tone?: FeedFeedbackTone;
|
|
470
|
+
code?: string;
|
|
471
|
+
operationId?: string;
|
|
472
|
+
/** Set false to remove the live row without creating durable history. */
|
|
473
|
+
durable?: boolean;
|
|
474
|
+
}
|
|
475
|
+
interface TransientFeedbackHandle {
|
|
476
|
+
readonly id: string;
|
|
477
|
+
readonly ordinal: number;
|
|
478
|
+
readonly revision: number;
|
|
479
|
+
update(text: string, options?: Omit<PublishTransientFeedbackOptions, "operationId"> & {
|
|
480
|
+
operationId?: string;
|
|
481
|
+
}): Promise<TransientFeedbackHandle>;
|
|
482
|
+
settle(text?: string, options?: SettleTransientFeedbackOptions): Promise<FeedbackFeedItem | null>;
|
|
483
|
+
}
|
|
484
|
+
interface FeedPublisher {
|
|
485
|
+
feedback(text: string, options?: PublishFeedbackOptions): Promise<FeedbackFeedItem>;
|
|
486
|
+
transientFeedback(text: string, options?: PublishTransientFeedbackOptions): Promise<TransientFeedbackHandle>;
|
|
487
|
+
}
|
|
488
|
+
type FeedPublishTransport = (method: string, params: Record<string, unknown>) => Promise<unknown>;
|
|
489
|
+
/**
|
|
490
|
+
* Build customer-visible feedback helpers for a trusted, invocation-scoped
|
|
491
|
+
* transport. This is infrastructure for effect/grounding execution hosts; it
|
|
492
|
+
* is intentionally not attached to browser Session instances.
|
|
493
|
+
*/
|
|
494
|
+
declare function createFeedPublisher(publish: FeedPublishTransport): FeedPublisher;
|
|
495
|
+
|
|
1
496
|
/**
|
|
2
497
|
* @module @granular-software/sdk/types
|
|
3
498
|
* Type definitions for the Granular SDK
|
|
4
499
|
*/
|
|
500
|
+
|
|
5
501
|
type PolicyOutcome = "allow" | "confirm" | "deny";
|
|
6
502
|
type PolicySource = "manifest" | "permissionProfile" | "builtin";
|
|
7
503
|
type PolicyPredicateSource = "input" | "object" | "stateMachine";
|
|
@@ -649,6 +1145,10 @@ interface EffectHandlerContext {
|
|
|
649
1145
|
effectClientId: string;
|
|
650
1146
|
sandboxId: string;
|
|
651
1147
|
environmentId: string;
|
|
1148
|
+
/** Stable effect call id assigned by the authoritative session. */
|
|
1149
|
+
invocationId?: string;
|
|
1150
|
+
/** Owning execution/job when the effect is invoked from one. */
|
|
1151
|
+
jobId?: string;
|
|
652
1152
|
buildId?: string;
|
|
653
1153
|
buildVersionNumber?: number;
|
|
654
1154
|
sessionId: string;
|
|
@@ -664,6 +1164,16 @@ interface EffectHandlerContext {
|
|
|
664
1164
|
};
|
|
665
1165
|
behaviors?: ResolvedEffectBehaviors;
|
|
666
1166
|
invocation?: EffectInvocationMetadata;
|
|
1167
|
+
/**
|
|
1168
|
+
* Publish durable customer-visible feedback for the directed invocation
|
|
1169
|
+
* owned by this effect host or `tool.invoke` callback.
|
|
1170
|
+
*/
|
|
1171
|
+
feedback?: FeedPublisher["feedback"];
|
|
1172
|
+
/**
|
|
1173
|
+
* Create invocation-owned live feedback that can be updated and settled.
|
|
1174
|
+
* Present under the same invocation-scoped conditions as `feedback`.
|
|
1175
|
+
*/
|
|
1176
|
+
transientFeedback?: FeedPublisher["transientFeedback"];
|
|
667
1177
|
}
|
|
668
1178
|
interface ResolvedEffectPostCondition {
|
|
669
1179
|
condition: string;
|
|
@@ -688,18 +1198,59 @@ interface ResolvedEffectBehaviors {
|
|
|
688
1198
|
reverse?: ResolvedEffectReverse;
|
|
689
1199
|
approvalRequired?: ResolvedEffectApprovalRequired;
|
|
690
1200
|
}
|
|
691
|
-
type EffectInvocationMode = "execute" | "dryRun" | "reverse";
|
|
1201
|
+
type EffectInvocationMode = "execute" | "dryRun" | "reverse" | "artifactOptions";
|
|
1202
|
+
interface EffectArtifactOptionsInvocation {
|
|
1203
|
+
fieldName: string;
|
|
1204
|
+
query?: string;
|
|
1205
|
+
limit?: number;
|
|
1206
|
+
}
|
|
692
1207
|
interface EffectInvocationMetadata {
|
|
693
1208
|
mode?: EffectInvocationMode;
|
|
1209
|
+
/**
|
|
1210
|
+
* Present when an effect is being run as part of a durable action artifact.
|
|
1211
|
+
* It lets an application distinguish the artifact's authoritative record
|
|
1212
|
+
* mirror from an ordinary session effect invocation.
|
|
1213
|
+
*/
|
|
1214
|
+
artifactId?: string;
|
|
694
1215
|
reverseHandler?: string;
|
|
695
1216
|
sourceEffectKey?: string;
|
|
696
1217
|
sourceEffectName?: string;
|
|
1218
|
+
/**
|
|
1219
|
+
* Present only when the artifact runtime asks an effect for authoritative
|
|
1220
|
+
* relationship choices. This is deliberately kept out of the effect input
|
|
1221
|
+
* so application handlers receive the exact same action payload they will
|
|
1222
|
+
* eventually execute.
|
|
1223
|
+
*/
|
|
1224
|
+
artifactOptions?: EffectArtifactOptionsInvocation;
|
|
697
1225
|
}
|
|
698
1226
|
type ToolHandler = (input: any, context: EffectHandlerContext) => Promise<unknown>;
|
|
699
1227
|
/**
|
|
700
1228
|
* Effect handler for instance methods: receives (objectId, input, context)
|
|
701
1229
|
*/
|
|
702
1230
|
type InstanceToolHandler = (id: string, input: any, context: EffectHandlerContext) => Promise<unknown>;
|
|
1231
|
+
interface EffectArtifactRelationshipOption {
|
|
1232
|
+
id: string;
|
|
1233
|
+
label: string;
|
|
1234
|
+
description?: string;
|
|
1235
|
+
fields?: Record<string, string | number | boolean | null>;
|
|
1236
|
+
}
|
|
1237
|
+
interface EffectArtifactRelationshipOptionsResult {
|
|
1238
|
+
items: EffectArtifactRelationshipOption[];
|
|
1239
|
+
/** True when the returned page contains the complete eligible option set. */
|
|
1240
|
+
complete?: boolean;
|
|
1241
|
+
/** True when more eligible options exist beyond this response. */
|
|
1242
|
+
hasMore?: boolean;
|
|
1243
|
+
/** Number of eligible options for the current query when known. */
|
|
1244
|
+
totalCount?: number;
|
|
1245
|
+
/** Typed empty/loading outcome that the Artifact UI can explain locally. */
|
|
1246
|
+
status?: "ok" | "domain_empty" | "no_match" | "workspace_syncing" | "verification_failed" | "provider_unavailable";
|
|
1247
|
+
/**
|
|
1248
|
+
* Actionable explanation shown when no eligible record is available.
|
|
1249
|
+
* It must be customer-facing and must not expose internal policy machinery.
|
|
1250
|
+
*/
|
|
1251
|
+
emptyMessage?: string;
|
|
1252
|
+
}
|
|
1253
|
+
type ArtifactOptionsHandler = (input: any, context: EffectHandlerContext) => Promise<EffectArtifactRelationshipOptionsResult>;
|
|
703
1254
|
/**
|
|
704
1255
|
* Effect schema for declaring or registering an effect.
|
|
705
1256
|
*
|
|
@@ -787,6 +1338,12 @@ interface ToolWithHandler extends ToolSchema {
|
|
|
787
1338
|
handler: ToolHandler | InstanceToolHandler;
|
|
788
1339
|
dryRunHandler?: ToolHandler | InstanceToolHandler;
|
|
789
1340
|
reverseHandler?: ToolHandler | InstanceToolHandler;
|
|
1341
|
+
/**
|
|
1342
|
+
* Optional server-authoritative relationship option resolver for prepared
|
|
1343
|
+
* artifacts. It is invoked on the original effect and is not published as a
|
|
1344
|
+
* separate agent-visible tool.
|
|
1345
|
+
*/
|
|
1346
|
+
artifactOptionsHandler?: ArtifactOptionsHandler;
|
|
790
1347
|
}
|
|
791
1348
|
type EffectWithHandler = ToolWithHandler;
|
|
792
1349
|
/**
|
|
@@ -972,42 +1529,58 @@ interface Prompt {
|
|
|
972
1529
|
allowEmpty?: boolean;
|
|
973
1530
|
metadata?: Record<string, unknown>;
|
|
974
1531
|
}
|
|
975
|
-
interface
|
|
1532
|
+
interface UserMessageShowRefs {
|
|
976
1533
|
entryPaths?: string[];
|
|
977
1534
|
listNames?: string[];
|
|
978
1535
|
variableNames?: string[];
|
|
979
1536
|
fileIds?: string[];
|
|
980
|
-
sessionArtifactIds?: string[];
|
|
981
|
-
actionSuggestions?: ConversationActionSuggestion[];
|
|
982
|
-
tables?: ConversationTableProjection[];
|
|
983
1537
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
value: string | number;
|
|
987
|
-
};
|
|
988
|
-
interface ConversationTableColumn {
|
|
1538
|
+
interface UserMessageTarget {
|
|
1539
|
+
className: string;
|
|
989
1540
|
id: string;
|
|
990
|
-
label
|
|
1541
|
+
label?: string;
|
|
991
1542
|
}
|
|
992
|
-
interface
|
|
993
|
-
|
|
994
|
-
|
|
1543
|
+
interface UserMessageInput {
|
|
1544
|
+
/**
|
|
1545
|
+
* Caller-owned logical user-message ID used to correlate optimistic and durable
|
|
1546
|
+
* turns. Reuse this id when retrying a call after an ambiguous timeout.
|
|
1547
|
+
*
|
|
1548
|
+
* When omitted together with `operationId`, the SDK reserves an identity for
|
|
1549
|
+
* that single invocation. A later caller-level retry must supply the
|
|
1550
|
+
* previously chosen id or operationId; identical content is never deduped.
|
|
1551
|
+
*/
|
|
995
1552
|
id?: string;
|
|
996
|
-
|
|
1553
|
+
/**
|
|
1554
|
+
* Caller-owned idempotency key for the logical append operation. If omitted,
|
|
1555
|
+
* the SDK derives it from `id`, or from the id it reserves for this call.
|
|
1556
|
+
*/
|
|
1557
|
+
operationId?: string;
|
|
1558
|
+
content: string;
|
|
1559
|
+
show?: UserMessageShowRefs;
|
|
1560
|
+
target?: UserMessageTarget;
|
|
997
1561
|
}
|
|
998
|
-
interface
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1562
|
+
interface UserMessageAppendResult {
|
|
1563
|
+
ok: boolean;
|
|
1564
|
+
messageId: string;
|
|
1565
|
+
timestamp: number;
|
|
1002
1566
|
}
|
|
1003
|
-
interface
|
|
1567
|
+
interface AssistantReplyPublicationInput {
|
|
1568
|
+
/** Stable caller-owned identity for this exact assistant occurrence. */
|
|
1004
1569
|
id: string;
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1570
|
+
/** Stable idempotency key reused after an ambiguous response. */
|
|
1571
|
+
operationId: string;
|
|
1572
|
+
/** Exact assistant text to append to the canonical feed. */
|
|
1573
|
+
text: string;
|
|
1009
1574
|
}
|
|
1010
|
-
interface
|
|
1575
|
+
interface AssistantReplyPublicationResult {
|
|
1576
|
+
ok: true;
|
|
1577
|
+
/** Caller-owned logical identity supplied as `id`. */
|
|
1578
|
+
messageId: string;
|
|
1579
|
+
/** Canonical durable feed occurrence identity used by presentation clients. */
|
|
1580
|
+
feedItemId: string;
|
|
1581
|
+
timestamp: number;
|
|
1582
|
+
}
|
|
1583
|
+
interface SessionTranscriptActionSuggestion {
|
|
1011
1584
|
suggestionId?: string;
|
|
1012
1585
|
label: string;
|
|
1013
1586
|
description?: string | null;
|
|
@@ -1015,61 +1588,10 @@ interface ConversationActionSuggestion {
|
|
|
1015
1588
|
target?: Record<string, unknown> | null;
|
|
1016
1589
|
metadata?: Record<string, unknown>;
|
|
1017
1590
|
}
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
status?: "done" | "queued" | "failed";
|
|
1023
|
-
}
|
|
1024
|
-
/**
|
|
1025
|
-
* A durable assistant message segment in the order it reached the client.
|
|
1026
|
-
*
|
|
1027
|
-
* `content` and `actions` remain the canonical compatibility fields on the
|
|
1028
|
-
* message. Parts only preserve their interleaving for capable clients.
|
|
1029
|
-
*/
|
|
1030
|
-
type ConversationMessagePart = {
|
|
1031
|
-
type: "text";
|
|
1032
|
-
text: string;
|
|
1033
|
-
} | {
|
|
1034
|
-
type: "action";
|
|
1035
|
-
action: ConversationMessageAction;
|
|
1036
|
-
};
|
|
1037
|
-
interface ConversationMessageInput {
|
|
1038
|
-
/** Optional caller-owned id used to correlate optimistic and durable turns. */
|
|
1039
|
-
id?: string;
|
|
1040
|
-
role: "user" | "assistant";
|
|
1041
|
-
content?: string;
|
|
1042
|
-
show?: ConversationMessageShowRefs;
|
|
1043
|
-
reasoningLines?: string[];
|
|
1044
|
-
reasoningDurationMs?: number;
|
|
1045
|
-
actions?: Array<Record<string, unknown>>;
|
|
1046
|
-
parts?: ConversationMessagePart[];
|
|
1047
|
-
target?: Record<string, unknown>;
|
|
1048
|
-
jobId?: string;
|
|
1049
|
-
promptId?: string;
|
|
1050
|
-
timestamp?: number;
|
|
1051
|
-
}
|
|
1052
|
-
interface ConversationAppendResult {
|
|
1053
|
-
ok: boolean;
|
|
1054
|
-
messageId: string;
|
|
1055
|
-
timestamp: number;
|
|
1056
|
-
jobId?: string;
|
|
1057
|
-
promptId?: string;
|
|
1058
|
-
}
|
|
1059
|
-
interface SessionConversationMessage {
|
|
1060
|
-
id: string;
|
|
1061
|
-
role: "user" | "assistant";
|
|
1062
|
-
content?: string;
|
|
1063
|
-
show?: ConversationMessageShowRefs;
|
|
1064
|
-
reasoningLines?: string[];
|
|
1065
|
-
reasoningDurationMs?: number;
|
|
1066
|
-
actions?: Array<Record<string, unknown>>;
|
|
1067
|
-
parts?: ConversationMessagePart[];
|
|
1068
|
-
target?: Record<string, unknown>;
|
|
1069
|
-
jobId?: string;
|
|
1070
|
-
promptId?: string;
|
|
1071
|
-
ts: number;
|
|
1072
|
-
[key: string]: unknown;
|
|
1591
|
+
interface SessionTranscriptShowRefs extends UserMessageShowRefs {
|
|
1592
|
+
sessionArtifactIds?: string[];
|
|
1593
|
+
actionSuggestions?: SessionTranscriptActionSuggestion[];
|
|
1594
|
+
tables?: FeedTableProjection[];
|
|
1073
1595
|
}
|
|
1074
1596
|
interface SessionTimelineEvent {
|
|
1075
1597
|
id?: string;
|
|
@@ -1186,6 +1708,34 @@ interface SessionArtifactValidationResult {
|
|
|
1186
1708
|
artifact: SessionArtifactRecord;
|
|
1187
1709
|
errors: Array<Record<string, unknown>>;
|
|
1188
1710
|
}
|
|
1711
|
+
interface SessionArtifactRelationshipOptionsInput {
|
|
1712
|
+
fieldName: string;
|
|
1713
|
+
query?: string;
|
|
1714
|
+
limit?: number;
|
|
1715
|
+
inputValues?: Record<string, unknown>;
|
|
1716
|
+
relationships?: Record<string, string | string[] | null>;
|
|
1717
|
+
}
|
|
1718
|
+
interface SessionArtifactRelationshipOption {
|
|
1719
|
+
id: string;
|
|
1720
|
+
label: string;
|
|
1721
|
+
description?: string | null;
|
|
1722
|
+
fields?: Record<string, string | number | boolean | null>;
|
|
1723
|
+
}
|
|
1724
|
+
interface SessionArtifactRelationshipOptionsResult {
|
|
1725
|
+
supported: boolean;
|
|
1726
|
+
items: SessionArtifactRelationshipOption[];
|
|
1727
|
+
emptyMessage?: string | null;
|
|
1728
|
+
/** True when this response contains the complete eligible option set. */
|
|
1729
|
+
complete?: boolean;
|
|
1730
|
+
hasMore?: boolean;
|
|
1731
|
+
totalCount?: number | null;
|
|
1732
|
+
status?: "ok" | "domain_empty" | "no_match" | "workspace_syncing" | "verification_failed" | "provider_unavailable";
|
|
1733
|
+
}
|
|
1734
|
+
interface SessionArtifactRelationshipCreateInput {
|
|
1735
|
+
fieldName: string;
|
|
1736
|
+
query?: string;
|
|
1737
|
+
values?: Record<string, unknown>;
|
|
1738
|
+
}
|
|
1189
1739
|
interface SessionArtifactExecutionResult {
|
|
1190
1740
|
ok: boolean;
|
|
1191
1741
|
status: SessionArtifactStatus;
|
|
@@ -1396,7 +1946,6 @@ interface SessionJobRecord {
|
|
|
1396
1946
|
prompts?: Record<string, unknown>;
|
|
1397
1947
|
actionSummary?: string[];
|
|
1398
1948
|
actionTrace?: Array<Record<string, unknown>>;
|
|
1399
|
-
agentMessages?: Array<Record<string, unknown>>;
|
|
1400
1949
|
[key: string]: unknown;
|
|
1401
1950
|
}
|
|
1402
1951
|
interface SessionTranscriptEntry {
|
|
@@ -1404,17 +1953,13 @@ interface SessionTranscriptEntry {
|
|
|
1404
1953
|
role: "user" | "assistant";
|
|
1405
1954
|
content: string;
|
|
1406
1955
|
timestamp: number;
|
|
1956
|
+
/** Canonical durable feed position. */
|
|
1957
|
+
sequence: number;
|
|
1407
1958
|
jobId?: string;
|
|
1408
1959
|
promptId?: string;
|
|
1409
|
-
|
|
1410
|
-
jobStatus?: string;
|
|
1411
|
-
jobResultPreview?: string;
|
|
1412
|
-
error?: string;
|
|
1413
|
-
show?: ConversationMessageShowRefs;
|
|
1414
|
-
actions?: ConversationMessageAction[];
|
|
1415
|
-
parts?: ConversationMessagePart[];
|
|
1960
|
+
show?: SessionTranscriptShowRefs;
|
|
1416
1961
|
historyContent?: string;
|
|
1417
|
-
source: "
|
|
1962
|
+
source: "feed";
|
|
1418
1963
|
}
|
|
1419
1964
|
type SessionHeapFieldType = "string" | "number" | "boolean" | "null" | "unknown";
|
|
1420
1965
|
interface SessionHeapFieldValue {
|
|
@@ -1499,7 +2044,7 @@ interface UserEnvironmentPrompt {
|
|
|
1499
2044
|
id: string;
|
|
1500
2045
|
jobId?: string | null;
|
|
1501
2046
|
sessionId?: string;
|
|
1502
|
-
type: "
|
|
2047
|
+
type: Prompt["type"];
|
|
1503
2048
|
status: string;
|
|
1504
2049
|
title: string;
|
|
1505
2050
|
message: string;
|
|
@@ -1517,12 +2062,19 @@ interface UserEnvironmentMessagePreview {
|
|
|
1517
2062
|
latestMessageAt: number | null;
|
|
1518
2063
|
latestAssistantAt: number | null;
|
|
1519
2064
|
latestAssistantText: string;
|
|
2065
|
+
/** Canonical sequence of the latest durable message occurrence. */
|
|
2066
|
+
latestMessageSequence: number;
|
|
2067
|
+
/** Canonical sequence of the latest assistant message occurrence. */
|
|
2068
|
+
latestAssistantSequence: number;
|
|
2069
|
+
/** Latest occurrence that independently creates unread state. */
|
|
2070
|
+
unreadProducingSequence: number;
|
|
1520
2071
|
}
|
|
1521
2072
|
interface UserEnvironmentSessionState {
|
|
1522
2073
|
session: ConversationSessionInfo;
|
|
1523
2074
|
status: "active" | "closed" | "running" | "awaiting_input" | "unread";
|
|
1524
2075
|
unread: boolean;
|
|
1525
|
-
|
|
2076
|
+
/** Canonical feed cursor read by this user, with zero as the initial state. */
|
|
2077
|
+
readThroughSequence: number;
|
|
1526
2078
|
messagePreview: UserEnvironmentMessagePreview;
|
|
1527
2079
|
prompts: UserEnvironmentPrompt[];
|
|
1528
2080
|
runningJobCount: number;
|
|
@@ -1546,7 +2098,8 @@ interface UserEnvironmentState {
|
|
|
1546
2098
|
activePrompt: UserEnvironmentPrompt | null;
|
|
1547
2099
|
};
|
|
1548
2100
|
unreadCount: number;
|
|
1549
|
-
|
|
2101
|
+
/** Canonical per-session feed cursor read by this user. */
|
|
2102
|
+
readThroughSequenceBySessionId: Record<string, number>;
|
|
1550
2103
|
}
|
|
1551
2104
|
interface UserEnvironmentStateOptions {
|
|
1552
2105
|
sessionScope?: string | null;
|
|
@@ -1557,7 +2110,8 @@ interface UserEnvironmentStateOptions {
|
|
|
1557
2110
|
interface MarkUserEnvironmentReadOptions {
|
|
1558
2111
|
sessionId?: string;
|
|
1559
2112
|
sessionIds?: string[];
|
|
1560
|
-
|
|
2113
|
+
/** Monotonic canonical feed cursor to mark read for the selected sessions. */
|
|
2114
|
+
readThroughSequence: number;
|
|
1561
2115
|
}
|
|
1562
2116
|
interface WSDisconnectInfo {
|
|
1563
2117
|
code?: number;
|
|
@@ -1572,6 +2126,7 @@ interface WSReconnectErrorInfo {
|
|
|
1572
2126
|
sessionId: string;
|
|
1573
2127
|
error: string;
|
|
1574
2128
|
timestamp: number;
|
|
2129
|
+
terminal: boolean;
|
|
1575
2130
|
}
|
|
1576
2131
|
interface WSClientOptions {
|
|
1577
2132
|
url: string;
|
|
@@ -1580,6 +2135,8 @@ interface WSClientOptions {
|
|
|
1580
2135
|
initialDocumentSnapshot?: Record<string, unknown> | Uint8Array | null;
|
|
1581
2136
|
tokenProvider?: AccessTokenProvider;
|
|
1582
2137
|
WebSocketCtor?: any;
|
|
2138
|
+
/** Maximum time for one socket open attempt before reconnect may continue. */
|
|
2139
|
+
connectTimeoutMs?: number;
|
|
1583
2140
|
maxReconnectAttempts?: number;
|
|
1584
2141
|
reconnectDelayMs?: number;
|
|
1585
2142
|
onUnexpectedClose?: (info: WSDisconnectInfo) => void;
|
|
@@ -1601,10 +2158,11 @@ interface RPCResponse {
|
|
|
1601
2158
|
data?: unknown;
|
|
1602
2159
|
};
|
|
1603
2160
|
}
|
|
1604
|
-
interface
|
|
1605
|
-
type: "
|
|
1606
|
-
|
|
1607
|
-
|
|
2161
|
+
interface SnapshotResetMessage {
|
|
2162
|
+
type: "snapshot_reset";
|
|
2163
|
+
documentEpoch: number;
|
|
2164
|
+
documentRevision: number;
|
|
2165
|
+
data: number[];
|
|
1608
2166
|
}
|
|
1609
2167
|
interface RPCRequestFromServer {
|
|
1610
2168
|
type: "rpc";
|
|
@@ -1616,9 +2174,21 @@ interface ToolInvokeParams {
|
|
|
1616
2174
|
callId: string;
|
|
1617
2175
|
toolName: string;
|
|
1618
2176
|
input: unknown;
|
|
2177
|
+
/** Server-derived execution metadata for the directed invocation context. */
|
|
2178
|
+
jobId?: string;
|
|
2179
|
+
sessionId?: string;
|
|
2180
|
+
environmentId?: string;
|
|
2181
|
+
sandboxId?: string;
|
|
2182
|
+
/**
|
|
2183
|
+
* Opaque, invocation-scoped grant. Only directed calls receive one; clients
|
|
2184
|
+
* must echo it to publish feedback or complete the invocation.
|
|
2185
|
+
*/
|
|
2186
|
+
feedbackCapability?: string;
|
|
1619
2187
|
}
|
|
1620
2188
|
interface ToolResultParams {
|
|
1621
2189
|
callId: string;
|
|
2190
|
+
/** Echo of a directed invocation's short-lived feedback grant. */
|
|
2191
|
+
feedbackCapability?: string;
|
|
1622
2192
|
result?: unknown;
|
|
1623
2193
|
error?: string | {
|
|
1624
2194
|
code: string;
|
|
@@ -1988,6 +2558,8 @@ type ManifestStateTransitionInputBinding = null | string | number | boolean | Ma
|
|
|
1988
2558
|
};
|
|
1989
2559
|
interface ManifestStateTransitionActionSpec {
|
|
1990
2560
|
effect: string;
|
|
2561
|
+
/** User-facing name of the connected system that performs the effect. */
|
|
2562
|
+
providerLabel?: string;
|
|
1991
2563
|
input?: Record<string, ManifestStateTransitionInputBinding>;
|
|
1992
2564
|
}
|
|
1993
2565
|
interface ManifestStateTransitionAssigneeSpec {
|
|
@@ -2326,4 +2898,4 @@ declare function toGranularHttpBase(apiUrl: string): string;
|
|
|
2326
2898
|
declare function buildOpenAISpendEventId(usage: Pick<OpenAIUsageSpendEvent, "requestId">, context?: GranularSpendContext): string | undefined;
|
|
2327
2899
|
declare function recordOpenAIUsageSpend(options: RecordOpenAIUsageSpendOptions): Promise<RecordOpenAIUsageSpendResult>;
|
|
2328
2900
|
|
|
2329
|
-
export { type
|
|
2901
|
+
export { type FeedListTransport as $, type ArtifactFeedItem as A, type FileFeedItem as B, type ActionSuggestionFeedItem as C, type DomainState as D, type EndpointMode as E, type FeedPublishTransport as F, type PromptFeedItem as G, type TransientFeedItemBase as H, type InstanceToolHandler as I, type TransientMessageFeedItem as J, type TransientFeedbackFeedItem as K, type TransientFeedItem as L, type ManifestEffectMetamodelSpec as M, type NormalizedSuggestedArtifact as N, type ObjectsFeedItem as O, type Prompt as P, type FeedSnapshot as Q, type ResolvedEffectBehaviors as R, type SessionHeapEntry as S, type ToolWithHandler as T, type FeedListOptions as U, type FeedPage as V, type FeedSubscribeOptions as W, type FeedSubscriptionChange as X, type SessionFeedApi as Y, mergeFeedItemsBySequence as Z, orderTransientFeedItems as _, type EffectHandlerContext as a, type GranularQuotaProgress as a$, type FeedSnapshotRegressionReason as a0, type FeedDiagnostic as a1, type FeedDiagnosticListener as a2, GRANULAR_FEED_DIAGNOSTIC_EVENT as a3, normalizeFeedDiagnosticKind as a4, normalizeFeedDiagnostic as a5, emitFeedDiagnosticToDefaultSink as a6, emitFeedDiagnostic as a7, type SessionFeedControllerOptions as a8, type FeedDocumentState as a9, type PolicySource as aA, type PolicyPredicateSource as aB, type PolicyOperator as aC, type ConditionIR as aD, type PolicyOrigin as aE, type PolicyRuleIR as aF, type MatchedPolicy as aG, type AccessTokenProvider as aH, type GranularOptions as aI, type GranularAuth as aJ, type User as aK, type RecordUserOptions as aL, type Subject as aM, type OpenEnvironmentOptions as aN, type AdoptEnvironmentOptions as aO, type ConnectOptions as aP, type CreateSessionOptions as aQ, type ConversationSessionInfo as aR, type ConversationSessionListStatus as aS, type ConversationSessionListOptions as aT, type SpendLineItemType as aU, type QuotaScopeType as aV, type QuotaPeriod as aW, type QuotaStatus as aX, type SpendSummary as aY, type QuotaLineItemFilter as aZ, type GranularQuotaPolicy as a_, emptyFeedSnapshot as aa, hasCanonicalSessionFeedActivation as ab, isCanonicalSessionFeedDocument as ac, readSessionFeedSnapshot as ad, normalizeFeedPage as ae, SessionFeedController as af, type PublishFeedbackOptions as ag, type PublishTransientFeedbackOptions as ah, type SettleTransientFeedbackOptions as ai, type TransientFeedbackHandle as aj, type FeedPublisher as ak, createFeedPublisher as al, type OpenAIModelPricing as am, type NormalizedOpenAIUsage as an, type OpenAITokenSpend as ao, OPENAI_MODEL_PRICING_USD_PER_MILLION as ap, getOpenAIModelPricing as aq, normalizeOpenAIUsage as ar, calculateOpenAITokenSpend as as, type GranularSpendContext as at, type OpenAIUsageSpendEvent as au, type RecordOpenAIUsageSpendOptions as av, type RecordOpenAIUsageSpendResult as aw, toGranularHttpBase as ax, buildOpenAISpendEventId as ay, recordOpenAIUsageSpend as az, type SessionHeapList as b, type SessionFileStatus as b$, type Sandbox as b0, type CreateSandboxData as b1, type SandboxListResponse as b2, type PermissionRules as b3, type PermissionProfile as b4, type CreatePermissionProfileData as b5, type PermissionProfileListResponse as b6, type Assignment as b7, type AssignmentListResponse as b8, type BuildPolicy as b9, type EffectVersionSelector as bA, type ToolInfo as bB, type EffectInfo as bC, type ToolsChangedEvent as bD, type EffectsChangedEvent as bE, type EffectHandler as bF, type InstanceEffectHandler as bG, type JobStatus as bH, type JobFeedbackSentiment as bI, type JobFeedbackToolCall as bJ, type JobFeedbackMetadata as bK, type JobFeedbackInput as bL, type JobFeedbackRecord as bM, type EnvironmentFeedbackRecord as bN, type JobSubmitResult as bO, type Job as bP, type UserMessageShowRefs as bQ, type UserMessageTarget as bR, type UserMessageInput as bS, type UserMessageAppendResult as bT, type AssistantReplyPublicationInput as bU, type AssistantReplyPublicationResult as bV, type SessionTranscriptActionSuggestion as bW, type SessionTranscriptShowRefs as bX, type SessionTimelineEvent as bY, type SessionFileSource as bZ, type SessionFileKind as b_, type VersionTracking as ba, type VersionTag as bb, type EnvironmentData as bc, type CreateEnvironmentData as bd, type EnvironmentListResponse as be, type Manifest as bf, type ManifestListResponse as bg, type BuildStatus as bh, type Build as bi, type Version as bj, type BuildListResponse as bk, type SemanticVersionDiffEntry as bl, type SemanticVersionDiff as bm, type ResolvedEffectPostCondition as bn, type ResolvedEffectDryRun as bo, type ResolvedEffectReverse as bp, type ResolvedEffectApprovalRequired as bq, type EffectInvocationMode as br, type EffectArtifactOptionsInvocation as bs, type EffectInvocationMetadata as bt, type EffectArtifactRelationshipOption as bu, type EffectArtifactRelationshipOptionsResult as bv, type ArtifactOptionsHandler as bw, type EffectSchema as bx, type EffectWithHandler as by, type PublishEffectsResult as bz, type FeedItem as c, type EnvironmentStateUpdateInput as c$, type SessionFileRecord as c0, type SessionArtifactStatus as c1, type SessionArtifactKind as c2, type SessionArtifactAutonomyPolicy as c3, type SessionArtifactRecord as c4, type SessionArtifactListOptions as c5, type SessionArtifactValidationResult as c6, type SessionArtifactRelationshipOptionsInput as c7, type SessionArtifactRelationshipOption as c8, type SessionArtifactRelationshipOptionsResult as c9, type RecordMentionInput as cA, type SessionDocumentResult as cB, type SessionCollectionListOptions as cC, type SessionJobListOptions as cD, type SessionCollectionListResult as cE, type UserEnvironmentPrompt as cF, type UserEnvironmentMessagePreview as cG, type UserEnvironmentSessionState as cH, type UserEnvironmentState as cI, type UserEnvironmentStateOptions as cJ, type MarkUserEnvironmentReadOptions as cK, type WSDisconnectInfo as cL, type WSReconnectErrorInfo as cM, type WSClientOptions as cN, type RPCRequest as cO, type RPCResponse as cP, type SnapshotResetMessage as cQ, type RPCRequestFromServer as cR, type ToolInvokeParams as cS, type ToolResultParams as cT, type ModelRef as cU, type RelationshipInfo as cV, type DefineRelationshipOptions as cW, type RecordObjectOptions as cX, type RecordObjectStateValue as cY, type EnvironmentStateTarget as cZ, type EnvironmentStateObservationInput as c_, type SessionArtifactRelationshipCreateInput as ca, type SessionArtifactExecutionResult as cb, type SessionArtifactExecutionOptions as cc, type SessionArtifactApprovalOptions as cd, type ArtifactApprovalTaskStatus as ce, type ArtifactApprovalTask as cf, type ArtifactApprovalTaskListOptions as cg, type ArtifactApprovalDecisionInput as ch, type ArtifactApprovalDecisionResult as ci, type ManualActionStatus as cj, type ManualActionSource as ck, type ManualActionTarget as cl, type ManualActionRelatedRecord as cm, type RecordManualActionInput as cn, type ManualActionOccurrence as co, type ManualActionRecordResult as cp, type ManualActionListOptions as cq, type ManualActionSuggestion as cr, type ManualActionSuggestionOptions as cs, type SessionFileUploadOptions as ct, type SessionJobRecord as cu, type SessionHeapFieldType as cv, type SessionHeapFieldValue as cw, type SessionHeapVariable as cx, type RecordSearchResult as cy, type RecordSearchOptions as cz, type SessionHeapSnapshot as d, type EnvironmentStateMachineProxy as d0, type EnvironmentStateProxy as d1, type RecordObjectResult as d2, type RecordObjectsChunkInfo as d3, type RecordObjectsOptions as d4, type RecordImportWriteMode as d5, type RecordImportOptions as d6, type RecordImportStatus as d7, type RecordImportItemStatus as d8, type RecordImportStats as d9, type ManifestPostConditionSpec as dA, type ManifestDryRunSpec as dB, type ManifestReverseSpec as dC, type ManifestApprovalRequiredSpec as dD, type ManifestCreatesSpec as dE, type ManifestRelationshipDef as dF, type ManifestEffectSchema as dG, type ManifestEffectDeclaration as dH, type ManifestEventTypeDef as dI, type ManifestEventStreamDef as dJ, type ManifestOperation as dK, type ManifestImport as dL, type ManifestVolume as dM, type ManifestContent as dN, type GraphQLResult as dO, type APIError as dP, type DeleteResponse as dQ, type StreamEvent as dR, type StreamSubscription as dS, type StreamStats as dT, type RecordImportItem as da, type RecordImport as db, type EnvironmentRecordImportSummary as dc, type EnvironmentSetupTriggerReason as dd, type RunEnvironmentImporterOptions as de, type EnvironmentSetupLifecycleStatus as df, type EnvironmentSetupSummary as dg, type EnvironmentSetupImporterClaim as dh, type EnvironmentImporterImportOptions as di, type EnvironmentImporter as dj, type ManifestPropertySpec as dk, type ManifestValidationOperator as dl, type ManifestEnumRuleSpec as dm, type ManifestFilterBySpec as dn, type ManifestValidationRuleSpec as dp, type ManifestStateMachineStateSpec as dq, type ManifestStateTransitionInputBinding as dr, type ManifestStateTransitionActionSpec as ds, type ManifestStateTransitionAssigneeSpec as dt, type ManifestStateTransitionRelatedStateRequirementSpec as du, type ManifestStateTransitionRequirementsSpec as dv, type ManifestStateTransitionPermissionSpec as dw, type ManifestStateTransitionExpectedOutcomeSpec as dx, type ManifestStateMachineTransitionSpec as dy, type ManifestStateMachineSpec as dz, type SessionTranscriptEntry as e, type ToolSchema as f, type PublishToolsResult as g, type ToolHandler as h, type FeedSourceActor as i, type FeedSource as j, type FeedIconToken as k, type FeedFeedbackTone as l, type FeedTransientFeedbackTone as m, type FeedItemKind as n, type FeedTarget as o, type FeedItemBase as p, type MessageFeedItem as q, type FeedbackFeedItem as r, type FeedObjectReference as s, type FeedTableCell as t, type FeedTableColumn as u, type FeedTableRowReference as v, type FeedTableRow as w, type FeedTableProjection as x, type TableFeedItem as y, type FeedFileSource as z };
|