@granular-software/sdk 0.4.57 → 0.4.59

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.
@@ -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";
@@ -214,10 +710,29 @@ interface OpenEnvironmentOptions {
214
710
  email?: string;
215
711
  /**
216
712
  * Permission profile names or IDs to ensure before opening the environment.
217
- * This should be provided even for existing users so the SDK can guarantee
218
- * assignments for first-time environment creation.
713
+ * Required at runtime when `assignmentMode` is omitted or set to `ensure`.
714
+ * Ignored by `require-existing`, which never mutates authorization records.
219
715
  */
220
- permissions: string[];
716
+ permissions?: string[];
717
+ /**
718
+ * How the SDK should handle the subject's ontology assignment.
719
+ *
720
+ * `ensure` preserves the historical behavior: permission profiles and the
721
+ * assignment are created or updated as needed. `require-existing` accepts
722
+ * only `granularId`, requires a current assignment, and never issues SDK
723
+ * authorization-setup writes for the selected subject, permission profile,
724
+ * or assignment. Managed opening can still write default tags,
725
+ * environments, activations, importer/setup state, sessions, and internal
726
+ * shared-mount subjects.
727
+ */
728
+ assignmentMode?: "ensure" | "require-existing";
729
+ /**
730
+ * Optional integrity guard for `require-existing`. Opening fails when the
731
+ * assignment read by the SDK does not use this permission profile ID. The
732
+ * control plane rechecks the same expectation while resolving an existing
733
+ * active environment and atomically when changing the active pointer.
734
+ */
735
+ expectedPermissionProfileId?: string;
221
736
  /**
222
737
  * When true, if the latest environment for this ontology/user/tag is marked
223
738
  * outdated relative to the current tag target, create a fresh environment on
@@ -630,6 +1145,10 @@ interface EffectHandlerContext {
630
1145
  effectClientId: string;
631
1146
  sandboxId: string;
632
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;
633
1152
  buildId?: string;
634
1153
  buildVersionNumber?: number;
635
1154
  sessionId: string;
@@ -645,6 +1164,16 @@ interface EffectHandlerContext {
645
1164
  };
646
1165
  behaviors?: ResolvedEffectBehaviors;
647
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"];
648
1177
  }
649
1178
  interface ResolvedEffectPostCondition {
650
1179
  condition: string;
@@ -669,18 +1198,51 @@ interface ResolvedEffectBehaviors {
669
1198
  reverse?: ResolvedEffectReverse;
670
1199
  approvalRequired?: ResolvedEffectApprovalRequired;
671
1200
  }
672
- 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
+ }
673
1207
  interface EffectInvocationMetadata {
674
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;
675
1215
  reverseHandler?: string;
676
1216
  sourceEffectKey?: string;
677
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;
678
1225
  }
679
1226
  type ToolHandler = (input: any, context: EffectHandlerContext) => Promise<unknown>;
680
1227
  /**
681
1228
  * Effect handler for instance methods: receives (objectId, input, context)
682
1229
  */
683
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
+ /**
1240
+ * Actionable explanation shown when no eligible record is available.
1241
+ * It must be customer-facing and must not expose internal policy machinery.
1242
+ */
1243
+ emptyMessage?: string;
1244
+ }
1245
+ type ArtifactOptionsHandler = (input: any, context: EffectHandlerContext) => Promise<EffectArtifactRelationshipOptionsResult>;
684
1246
  /**
685
1247
  * Effect schema for declaring or registering an effect.
686
1248
  *
@@ -768,6 +1330,12 @@ interface ToolWithHandler extends ToolSchema {
768
1330
  handler: ToolHandler | InstanceToolHandler;
769
1331
  dryRunHandler?: ToolHandler | InstanceToolHandler;
770
1332
  reverseHandler?: ToolHandler | InstanceToolHandler;
1333
+ /**
1334
+ * Optional server-authoritative relationship option resolver for prepared
1335
+ * artifacts. It is invoked on the original effect and is not published as a
1336
+ * separate agent-visible tool.
1337
+ */
1338
+ artifactOptionsHandler?: ArtifactOptionsHandler;
771
1339
  }
772
1340
  type EffectWithHandler = ToolWithHandler;
773
1341
  /**
@@ -953,42 +1521,58 @@ interface Prompt {
953
1521
  allowEmpty?: boolean;
954
1522
  metadata?: Record<string, unknown>;
955
1523
  }
956
- interface ConversationMessageShowRefs {
1524
+ interface UserMessageShowRefs {
957
1525
  entryPaths?: string[];
958
1526
  listNames?: string[];
959
1527
  variableNames?: string[];
960
1528
  fileIds?: string[];
961
- sessionArtifactIds?: string[];
962
- actionSuggestions?: ConversationActionSuggestion[];
963
- tables?: ConversationTableProjection[];
964
1529
  }
965
- type ConversationTableCell = string | number | boolean | null | {
966
- kind: "relative_time" | "date";
967
- value: string | number;
968
- };
969
- interface ConversationTableColumn {
1530
+ interface UserMessageTarget {
1531
+ className: string;
970
1532
  id: string;
971
- label: string;
1533
+ label?: string;
972
1534
  }
973
- interface ConversationTableRowReference {
974
- entryPath?: string;
975
- className?: string;
1535
+ interface UserMessageInput {
1536
+ /**
1537
+ * Caller-owned logical user-message ID used to correlate optimistic and durable
1538
+ * turns. Reuse this id when retrying a call after an ambiguous timeout.
1539
+ *
1540
+ * When omitted together with `operationId`, the SDK reserves an identity for
1541
+ * that single invocation. A later caller-level retry must supply the
1542
+ * previously chosen id or operationId; identical content is never deduped.
1543
+ */
976
1544
  id?: string;
977
- label?: string;
1545
+ /**
1546
+ * Caller-owned idempotency key for the logical append operation. If omitted,
1547
+ * the SDK derives it from `id`, or from the id it reserves for this call.
1548
+ */
1549
+ operationId?: string;
1550
+ content: string;
1551
+ show?: UserMessageShowRefs;
1552
+ target?: UserMessageTarget;
978
1553
  }
979
- interface ConversationTableRow {
980
- id: string;
981
- reference?: ConversationTableRowReference;
982
- cells: ConversationTableCell[];
1554
+ interface UserMessageAppendResult {
1555
+ ok: boolean;
1556
+ messageId: string;
1557
+ timestamp: number;
983
1558
  }
984
- interface ConversationTableProjection {
1559
+ interface AssistantReplyPublicationInput {
1560
+ /** Stable caller-owned identity for this exact assistant occurrence. */
985
1561
  id: string;
986
- label?: string;
987
- source?: string;
988
- columns: ConversationTableColumn[];
989
- rows: ConversationTableRow[];
1562
+ /** Stable idempotency key reused after an ambiguous response. */
1563
+ operationId: string;
1564
+ /** Exact assistant text to append to the canonical feed. */
1565
+ text: string;
1566
+ }
1567
+ interface AssistantReplyPublicationResult {
1568
+ ok: true;
1569
+ /** Caller-owned logical identity supplied as `id`. */
1570
+ messageId: string;
1571
+ /** Canonical durable feed occurrence identity used by presentation clients. */
1572
+ feedItemId: string;
1573
+ timestamp: number;
990
1574
  }
991
- interface ConversationActionSuggestion {
1575
+ interface SessionTranscriptActionSuggestion {
992
1576
  suggestionId?: string;
993
1577
  label: string;
994
1578
  description?: string | null;
@@ -996,61 +1580,10 @@ interface ConversationActionSuggestion {
996
1580
  target?: Record<string, unknown> | null;
997
1581
  metadata?: Record<string, unknown>;
998
1582
  }
999
- /** A normalized action embedded in an ordered assistant message stream. */
1000
- interface ConversationMessageAction {
1001
- kind: "frontend" | "backend" | "system";
1002
- label: string;
1003
- status?: "done" | "queued" | "failed";
1004
- }
1005
- /**
1006
- * A durable assistant message segment in the order it reached the client.
1007
- *
1008
- * `content` and `actions` remain the canonical compatibility fields on the
1009
- * message. Parts only preserve their interleaving for capable clients.
1010
- */
1011
- type ConversationMessagePart = {
1012
- type: "text";
1013
- text: string;
1014
- } | {
1015
- type: "action";
1016
- action: ConversationMessageAction;
1017
- };
1018
- interface ConversationMessageInput {
1019
- /** Optional caller-owned id used to correlate optimistic and durable turns. */
1020
- id?: string;
1021
- role: "user" | "assistant";
1022
- content?: string;
1023
- show?: ConversationMessageShowRefs;
1024
- reasoningLines?: string[];
1025
- reasoningDurationMs?: number;
1026
- actions?: Array<Record<string, unknown>>;
1027
- parts?: ConversationMessagePart[];
1028
- target?: Record<string, unknown>;
1029
- jobId?: string;
1030
- promptId?: string;
1031
- timestamp?: number;
1032
- }
1033
- interface ConversationAppendResult {
1034
- ok: boolean;
1035
- messageId: string;
1036
- timestamp: number;
1037
- jobId?: string;
1038
- promptId?: string;
1039
- }
1040
- interface SessionConversationMessage {
1041
- id: string;
1042
- role: "user" | "assistant";
1043
- content?: string;
1044
- show?: ConversationMessageShowRefs;
1045
- reasoningLines?: string[];
1046
- reasoningDurationMs?: number;
1047
- actions?: Array<Record<string, unknown>>;
1048
- parts?: ConversationMessagePart[];
1049
- target?: Record<string, unknown>;
1050
- jobId?: string;
1051
- promptId?: string;
1052
- ts: number;
1053
- [key: string]: unknown;
1583
+ interface SessionTranscriptShowRefs extends UserMessageShowRefs {
1584
+ sessionArtifactIds?: string[];
1585
+ actionSuggestions?: SessionTranscriptActionSuggestion[];
1586
+ tables?: FeedTableProjection[];
1054
1587
  }
1055
1588
  interface SessionTimelineEvent {
1056
1589
  id?: string;
@@ -1167,6 +1700,29 @@ interface SessionArtifactValidationResult {
1167
1700
  artifact: SessionArtifactRecord;
1168
1701
  errors: Array<Record<string, unknown>>;
1169
1702
  }
1703
+ interface SessionArtifactRelationshipOptionsInput {
1704
+ fieldName: string;
1705
+ query?: string;
1706
+ limit?: number;
1707
+ inputValues?: Record<string, unknown>;
1708
+ relationships?: Record<string, string | string[] | null>;
1709
+ }
1710
+ interface SessionArtifactRelationshipOption {
1711
+ id: string;
1712
+ label: string;
1713
+ description?: string | null;
1714
+ fields?: Record<string, string | number | boolean | null>;
1715
+ }
1716
+ interface SessionArtifactRelationshipOptionsResult {
1717
+ supported: boolean;
1718
+ items: SessionArtifactRelationshipOption[];
1719
+ emptyMessage?: string | null;
1720
+ }
1721
+ interface SessionArtifactRelationshipCreateInput {
1722
+ fieldName: string;
1723
+ query?: string;
1724
+ values?: Record<string, unknown>;
1725
+ }
1170
1726
  interface SessionArtifactExecutionResult {
1171
1727
  ok: boolean;
1172
1728
  status: SessionArtifactStatus;
@@ -1377,7 +1933,6 @@ interface SessionJobRecord {
1377
1933
  prompts?: Record<string, unknown>;
1378
1934
  actionSummary?: string[];
1379
1935
  actionTrace?: Array<Record<string, unknown>>;
1380
- agentMessages?: Array<Record<string, unknown>>;
1381
1936
  [key: string]: unknown;
1382
1937
  }
1383
1938
  interface SessionTranscriptEntry {
@@ -1385,17 +1940,13 @@ interface SessionTranscriptEntry {
1385
1940
  role: "user" | "assistant";
1386
1941
  content: string;
1387
1942
  timestamp: number;
1943
+ /** Canonical durable feed position. */
1944
+ sequence: number;
1388
1945
  jobId?: string;
1389
1946
  promptId?: string;
1390
- code?: string;
1391
- jobStatus?: string;
1392
- jobResultPreview?: string;
1393
- error?: string;
1394
- show?: ConversationMessageShowRefs;
1395
- actions?: ConversationMessageAction[];
1396
- parts?: ConversationMessagePart[];
1947
+ show?: SessionTranscriptShowRefs;
1397
1948
  historyContent?: string;
1398
- source: "conversation" | "job_code" | "job_result" | "job_prompt" | "job_agent_message";
1949
+ source: "feed";
1399
1950
  }
1400
1951
  type SessionHeapFieldType = "string" | "number" | "boolean" | "null" | "unknown";
1401
1952
  interface SessionHeapFieldValue {
@@ -1480,7 +2031,7 @@ interface UserEnvironmentPrompt {
1480
2031
  id: string;
1481
2032
  jobId?: string | null;
1482
2033
  sessionId?: string;
1483
- type: "confirm" | "choice" | "input" | "text" | "form" | "file" | "custom";
2034
+ type: Prompt["type"];
1484
2035
  status: string;
1485
2036
  title: string;
1486
2037
  message: string;
@@ -1498,12 +2049,19 @@ interface UserEnvironmentMessagePreview {
1498
2049
  latestMessageAt: number | null;
1499
2050
  latestAssistantAt: number | null;
1500
2051
  latestAssistantText: string;
2052
+ /** Canonical sequence of the latest durable message occurrence. */
2053
+ latestMessageSequence: number;
2054
+ /** Canonical sequence of the latest assistant message occurrence. */
2055
+ latestAssistantSequence: number;
2056
+ /** Latest occurrence that independently creates unread state. */
2057
+ unreadProducingSequence: number;
1501
2058
  }
1502
2059
  interface UserEnvironmentSessionState {
1503
2060
  session: ConversationSessionInfo;
1504
2061
  status: "active" | "closed" | "running" | "awaiting_input" | "unread";
1505
2062
  unread: boolean;
1506
- readAt: number | null;
2063
+ /** Canonical feed cursor read by this user, with zero as the initial state. */
2064
+ readThroughSequence: number;
1507
2065
  messagePreview: UserEnvironmentMessagePreview;
1508
2066
  prompts: UserEnvironmentPrompt[];
1509
2067
  runningJobCount: number;
@@ -1527,7 +2085,8 @@ interface UserEnvironmentState {
1527
2085
  activePrompt: UserEnvironmentPrompt | null;
1528
2086
  };
1529
2087
  unreadCount: number;
1530
- readAtBySessionId: Record<string, number>;
2088
+ /** Canonical per-session feed cursor read by this user. */
2089
+ readThroughSequenceBySessionId: Record<string, number>;
1531
2090
  }
1532
2091
  interface UserEnvironmentStateOptions {
1533
2092
  sessionScope?: string | null;
@@ -1538,7 +2097,8 @@ interface UserEnvironmentStateOptions {
1538
2097
  interface MarkUserEnvironmentReadOptions {
1539
2098
  sessionId?: string;
1540
2099
  sessionIds?: string[];
1541
- readAt?: number;
2100
+ /** Monotonic canonical feed cursor to mark read for the selected sessions. */
2101
+ readThroughSequence: number;
1542
2102
  }
1543
2103
  interface WSDisconnectInfo {
1544
2104
  code?: number;
@@ -1553,6 +2113,7 @@ interface WSReconnectErrorInfo {
1553
2113
  sessionId: string;
1554
2114
  error: string;
1555
2115
  timestamp: number;
2116
+ terminal: boolean;
1556
2117
  }
1557
2118
  interface WSClientOptions {
1558
2119
  url: string;
@@ -1561,6 +2122,8 @@ interface WSClientOptions {
1561
2122
  initialDocumentSnapshot?: Record<string, unknown> | Uint8Array | null;
1562
2123
  tokenProvider?: AccessTokenProvider;
1563
2124
  WebSocketCtor?: any;
2125
+ /** Maximum time for one socket open attempt before reconnect may continue. */
2126
+ connectTimeoutMs?: number;
1564
2127
  maxReconnectAttempts?: number;
1565
2128
  reconnectDelayMs?: number;
1566
2129
  onUnexpectedClose?: (info: WSDisconnectInfo) => void;
@@ -1582,10 +2145,11 @@ interface RPCResponse {
1582
2145
  data?: unknown;
1583
2146
  };
1584
2147
  }
1585
- interface SyncMessage {
1586
- type: "sync";
1587
- message?: string | number[] | Uint8Array;
1588
- data?: number[];
2148
+ interface SnapshotResetMessage {
2149
+ type: "snapshot_reset";
2150
+ documentEpoch: number;
2151
+ documentRevision: number;
2152
+ data: number[];
1589
2153
  }
1590
2154
  interface RPCRequestFromServer {
1591
2155
  type: "rpc";
@@ -1597,9 +2161,21 @@ interface ToolInvokeParams {
1597
2161
  callId: string;
1598
2162
  toolName: string;
1599
2163
  input: unknown;
2164
+ /** Server-derived execution metadata for the directed invocation context. */
2165
+ jobId?: string;
2166
+ sessionId?: string;
2167
+ environmentId?: string;
2168
+ sandboxId?: string;
2169
+ /**
2170
+ * Opaque, invocation-scoped grant. Only directed calls receive one; clients
2171
+ * must echo it to publish feedback or complete the invocation.
2172
+ */
2173
+ feedbackCapability?: string;
1600
2174
  }
1601
2175
  interface ToolResultParams {
1602
2176
  callId: string;
2177
+ /** Echo of a directed invocation's short-lived feedback grant. */
2178
+ feedbackCapability?: string;
1603
2179
  result?: unknown;
1604
2180
  error?: string | {
1605
2181
  code: string;
@@ -2307,4 +2883,4 @@ declare function toGranularHttpBase(apiUrl: string): string;
2307
2883
  declare function buildOpenAISpendEventId(usage: Pick<OpenAIUsageSpendEvent, "requestId">, context?: GranularSpendContext): string | undefined;
2308
2884
  declare function recordOpenAIUsageSpend(options: RecordOpenAIUsageSpendOptions): Promise<RecordOpenAIUsageSpendResult>;
2309
2885
 
2310
- export { type SpendSummary as $, type AccessTokenProvider as A, type RecordUserOptions as B, type ConditionIR as C, type DomainState as D, type EndpointMode as E, type Subject as F, type GranularSpendContext as G, type OpenEnvironmentOptions as H, type InstanceToolHandler as I, type AdoptEnvironmentOptions as J, type ConnectOptions as K, type CreateSessionOptions as L, type ManifestEffectMetamodelSpec as M, type NormalizedOpenAIUsage as N, type OpenAIModelPricing as O, type Prompt as P, type ConversationSessionInfo as Q, type ResolvedEffectBehaviors as R, type SessionHeapEntry as S, type ToolWithHandler as T, type User as U, type ConversationSessionListStatus as V, type ConversationSessionListOptions as W, type SpendLineItemType as X, type QuotaScopeType as Y, type QuotaPeriod as Z, type QuotaStatus as _, type EffectHandlerContext as a, type SessionTimelineEvent as a$, type QuotaLineItemFilter as a0, type GranularQuotaPolicy as a1, type GranularQuotaProgress as a2, type Sandbox as a3, type CreateSandboxData as a4, type SandboxListResponse as a5, type PermissionRules as a6, type PermissionProfile as a7, type CreatePermissionProfileData as a8, type PermissionProfileListResponse as a9, type ToolInfo as aA, type EffectInfo as aB, type ToolsChangedEvent as aC, type EffectsChangedEvent as aD, type EffectHandler as aE, type InstanceEffectHandler as aF, type JobStatus as aG, type JobFeedbackSentiment as aH, type JobFeedbackToolCall as aI, type JobFeedbackMetadata as aJ, type JobFeedbackInput as aK, type JobFeedbackRecord as aL, type EnvironmentFeedbackRecord as aM, type JobSubmitResult as aN, type Job as aO, type ConversationMessageShowRefs as aP, type ConversationTableCell as aQ, type ConversationTableColumn as aR, type ConversationTableRowReference as aS, type ConversationTableRow as aT, type ConversationTableProjection as aU, type ConversationActionSuggestion as aV, type ConversationMessageAction as aW, type ConversationMessagePart as aX, type ConversationMessageInput as aY, type ConversationAppendResult as aZ, type SessionConversationMessage as a_, type Assignment as aa, type AssignmentListResponse as ab, type BuildPolicy as ac, type VersionTracking as ad, type VersionTag as ae, type EnvironmentData as af, type CreateEnvironmentData as ag, type EnvironmentListResponse as ah, type Manifest as ai, type ManifestListResponse as aj, type BuildStatus as ak, type Build as al, type Version as am, type BuildListResponse as an, type SemanticVersionDiffEntry as ao, type SemanticVersionDiff as ap, type ResolvedEffectPostCondition as aq, type ResolvedEffectDryRun as ar, type ResolvedEffectReverse as as, type ResolvedEffectApprovalRequired as at, type EffectInvocationMode as au, type EffectInvocationMetadata as av, type EffectSchema as aw, type EffectWithHandler as ax, type PublishEffectsResult as ay, type EffectVersionSelector as az, type SessionHeapList as b, type EnvironmentStateMachineProxy as b$, type SessionFileSource as b0, type SessionFileKind as b1, type SessionFileStatus as b2, type SessionFileRecord as b3, type SessionArtifactStatus as b4, type SessionArtifactKind as b5, type SessionArtifactAutonomyPolicy as b6, type SessionArtifactRecord as b7, type SessionArtifactListOptions as b8, type SessionArtifactValidationResult as b9, type SessionDocumentResult as bA, type SessionCollectionListOptions as bB, type SessionJobListOptions as bC, type SessionCollectionListResult as bD, type UserEnvironmentPrompt as bE, type UserEnvironmentMessagePreview as bF, type UserEnvironmentSessionState as bG, type UserEnvironmentState as bH, type UserEnvironmentStateOptions as bI, type MarkUserEnvironmentReadOptions as bJ, type WSDisconnectInfo as bK, type WSReconnectErrorInfo as bL, type WSClientOptions as bM, type RPCRequest as bN, type RPCResponse as bO, type SyncMessage as bP, type RPCRequestFromServer as bQ, type ToolInvokeParams as bR, type ToolResultParams as bS, type ModelRef as bT, type RelationshipInfo as bU, type DefineRelationshipOptions as bV, type RecordObjectOptions as bW, type RecordObjectStateValue as bX, type EnvironmentStateTarget as bY, type EnvironmentStateObservationInput as bZ, type EnvironmentStateUpdateInput as b_, type SessionArtifactExecutionResult as ba, type SessionArtifactExecutionOptions as bb, type SessionArtifactApprovalOptions as bc, type ArtifactApprovalTaskStatus as bd, type ArtifactApprovalTask as be, type ArtifactApprovalTaskListOptions as bf, type ArtifactApprovalDecisionInput as bg, type ArtifactApprovalDecisionResult as bh, type ManualActionStatus as bi, type ManualActionSource as bj, type ManualActionTarget as bk, type ManualActionRelatedRecord as bl, type RecordManualActionInput as bm, type ManualActionOccurrence as bn, type ManualActionRecordResult as bo, type ManualActionListOptions as bp, type ManualActionSuggestion as bq, type ManualActionSuggestionOptions as br, type SessionFileUploadOptions as bs, type SessionJobRecord as bt, type SessionHeapFieldType as bu, type SessionHeapFieldValue as bv, type SessionHeapVariable as bw, type RecordSearchResult as bx, type RecordSearchOptions as by, type RecordMentionInput as bz, type SessionHeapSnapshot as c, type EnvironmentStateProxy as c0, type RecordObjectResult as c1, type RecordObjectsChunkInfo as c2, type RecordObjectsOptions as c3, type RecordImportWriteMode as c4, type RecordImportOptions as c5, type RecordImportStatus as c6, type RecordImportItemStatus as c7, type RecordImportStats as c8, type RecordImportItem as c9, type ManifestReverseSpec as cA, type ManifestApprovalRequiredSpec as cB, type ManifestCreatesSpec as cC, type ManifestRelationshipDef as cD, type ManifestEffectSchema as cE, type ManifestEffectDeclaration as cF, type ManifestEventTypeDef as cG, type ManifestEventStreamDef as cH, type ManifestOperation as cI, type ManifestImport as cJ, type ManifestVolume as cK, type ManifestContent as cL, type GraphQLResult as cM, type APIError as cN, type DeleteResponse as cO, type StreamEvent as cP, type StreamSubscription as cQ, type StreamStats as cR, type RecordImport as ca, type EnvironmentRecordImportSummary as cb, type EnvironmentSetupTriggerReason as cc, type RunEnvironmentImporterOptions as cd, type EnvironmentSetupLifecycleStatus as ce, type EnvironmentSetupSummary as cf, type EnvironmentSetupImporterClaim as cg, type EnvironmentImporterImportOptions as ch, type EnvironmentImporter as ci, type ManifestPropertySpec as cj, type ManifestValidationOperator as ck, type ManifestEnumRuleSpec as cl, type ManifestFilterBySpec as cm, type ManifestValidationRuleSpec as cn, type ManifestStateMachineStateSpec as co, type ManifestStateTransitionInputBinding as cp, type ManifestStateTransitionActionSpec as cq, type ManifestStateTransitionAssigneeSpec as cr, type ManifestStateTransitionRelatedStateRequirementSpec as cs, type ManifestStateTransitionRequirementsSpec as ct, type ManifestStateTransitionPermissionSpec as cu, type ManifestStateTransitionExpectedOutcomeSpec as cv, type ManifestStateMachineTransitionSpec as cw, type ManifestStateMachineSpec as cx, type ManifestPostConditionSpec as cy, type ManifestDryRunSpec as cz, type SessionTranscriptEntry as d, type ToolSchema as e, type PublishToolsResult as f, type ToolHandler as g, type OpenAITokenSpend as h, OPENAI_MODEL_PRICING_USD_PER_MILLION as i, getOpenAIModelPricing as j, calculateOpenAITokenSpend as k, type OpenAIUsageSpendEvent as l, type RecordOpenAIUsageSpendOptions as m, normalizeOpenAIUsage as n, type RecordOpenAIUsageSpendResult as o, buildOpenAISpendEventId as p, type PolicySource as q, recordOpenAIUsageSpend as r, type PolicyPredicateSource as s, toGranularHttpBase as t, type PolicyOperator as u, type PolicyOrigin as v, type PolicyRuleIR as w, type MatchedPolicy as x, type GranularOptions as y, type GranularAuth as z };
2886
+ 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 };