@retainer/sdk 0.1.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { BindingWriteStamp, ExtensionAuthorization, ExtensionAuthorizationCompletion, ExtensionAuthorizeInput, ExtensionBindingChoices, ExtensionConnection, ExtensionConnectionInput, ExtensionInstallation, ExtensionInstallInput, ExtensionManifest, ExtensionOAuthClient, ExtensionPreview, ExtensionRecordButton, ExtensionRecordButtonRun } from '@retainer/extension';
2
- import type { CreateDashboard, DashboardSummary, OrganizationRole, SavedDashboard, UpdateDashboard, WorkspaceRole } from '@retainer/shared';
2
+ import type { CalendarCopy, CalendarEntryReference, CalendarQuery, CalendarResult, CalendarSource, CalendarSourceMode, CreateDashboard, DashboardSummary, EnrollmentDetail, EnrollmentInput, EnrollmentView, MemberCalendarSources, OrganizationRole, PreparedEnrollment, SavedDashboard, UpdateDashboard, WorkspaceRole } from '@retainer/shared';
3
3
  export { isMaintenance, isMaintenanceRead, retryAfterMs, waitForRetry } from './maintenance.js';
4
- import type { Actor, AddedLinks, AggregateInput, AggregateResult, AssertionView, AttachedEventPage, BulkDeleteImpact, CommentPage, ContextInput, ContextPack, CreateViewInput, DecisionResult, DeleteImpact, DeleteRecordResult, EventAttachment, LogEventInput as EventInput, EventPage, EventQueryInput, ExtensionRunInspection, FactPlace, ForgetResult, LinkedRecordPage, LogEventResult, MergeInput, MergeResult, MergeSuggestionDecision, MoveEventsInput, MoveEventsResult, Page, PresentedComment, PresentedFact, PresentedRecord, ProfileAlias, ProfileContextPack, QueryInput, RecordPage, RetractEventResult, ReviewCollection, ReviewQueue, RoutineButton, RoutineCapabilities, RoutineCheckResult, RoutineDetail, RoutinePreview, RoutineProblem, RoutineReport, RoutineRunAgentTask, RoutineRunView, RoutineView, SavedView, SchemaChange, SchemaChangeResult, SchemaDescription, SchemaOperation, SearchInput, SearchResult, Session, TemplateView, TimelineItemKind, TimelinePage, UpdateViewInput, UpsertRecordsResponse, WorkspaceFeedInput, WorkspaceFeedPage, WriteResponse } from '@retainer/shared';
4
+ import type { Actor, AddedLinks, AgentBriefing, AggregateInput, AggregateResult, AssertionView, AttachedEventPage, BulkDeleteImpact, CommentPage, ContextInput, ContextPack, CreateViewInput, DecisionResult, DeleteImpact, DeleteRecordResult, EventAttachment, LogEventInput as EventInput, EventPage, EventQueryInput, ExtensionRunInspection, FactPlace, GmailComposeInput, GmailComposeResult, LinkedRecordPage, LogEventResult, MergeInput, MergeResult, MergeSuggestionDecision, MoveEventsInput, MoveEventsResult, Page, PresentedComment, PresentedFact, PresentedRecord, ProfileAlias, ProfileContextPack, QueryInput, RecordPage, RetractEventResult, ReviewCollection, ReviewQueue, RoutineButton, RoutineCapabilities, RoutineCheckResult, RoutineDetail, RoutineDraft, RoutineFlowStep, RoutinePreview, RoutineProblem, RoutineReport, RoutineRunAgentTask, RoutineRunView, RoutineView, SavedView, SchemaChange, SchemaChangeResult, SchemaDescription, SchemaOperation, SearchInput, SearchResult, Session, TemplateView, TimelineItemKind, TimelinePage, UpdateViewInput, UpsertRecordsResponse, ViewCheckResult, WorkspaceFeedInput, WorkspaceFeedPage, WriteResponse } from '@retainer/shared';
5
5
  export type RetainerClientOptions = {
6
6
  /** The Retainer server origin, such as https://retainer.tamloot.cc. */
7
7
  baseUrl: string;
@@ -61,11 +61,309 @@ export type { MoveEventsInput, MoveEventsResult };
61
61
  export type LogEventInput = EventInput & {
62
62
  bindings?: BindingWriteStamp;
63
63
  };
64
+ export type RecordActionInput = {
65
+ kind: 'delete';
66
+ recordId: string;
67
+ } | {
68
+ kind: 'merge';
69
+ recordId: string;
70
+ mergedId: string;
71
+ };
72
+ type ReviewedRecord = {
73
+ id: string;
74
+ label: string | null;
75
+ updatedAt: string;
76
+ };
77
+ export type RecordActionPreview = {
78
+ record: ReviewedRecord;
79
+ previewUrl?: string;
80
+ previewPath: string;
81
+ } & ({
82
+ kind: 'delete';
83
+ records: DeleteImpact['records'];
84
+ fingerprint: string;
85
+ } | {
86
+ kind: 'merge';
87
+ merged: ReviewedRecord;
88
+ impact: {
89
+ relations: number;
90
+ events: number;
91
+ facts: number;
92
+ };
93
+ });
94
+ export type ConfirmRecordActionInput = {
95
+ kind: 'delete';
96
+ recordId: string;
97
+ expectedUpdatedAt: string;
98
+ fingerprint: string;
99
+ } | {
100
+ kind: 'merge';
101
+ recordId: string;
102
+ mergedId: string;
103
+ keptUpdatedAt: string;
104
+ mergedUpdatedAt: string;
105
+ };
64
106
  type Participant = {
65
107
  handle?: string;
66
108
  recordId?: string;
67
109
  role?: string;
68
110
  };
111
+ /** Correlates a successful keep with a draft rendered in this chat. */
112
+ export type BuildContext = {
113
+ chatId: string;
114
+ draftKey: string;
115
+ };
116
+ export type FeatureBuildKind = 'dashboard' | 'view' | 'routine' | 'customer_agent';
117
+ export type CustomerDisclosure = {
118
+ match: string[];
119
+ hear: string[];
120
+ change: string[];
121
+ accounts: string[];
122
+ };
123
+ export type CustomerAgentItem = {
124
+ id: string;
125
+ name: string;
126
+ active_version_id: string | null;
127
+ pause_reason: string | null;
128
+ };
129
+ export type CustomerAgentList = {
130
+ agents: CustomerAgentItem[];
131
+ availability: {
132
+ voice: boolean;
133
+ text: boolean;
134
+ };
135
+ };
136
+ export type CustomerWebLink = {
137
+ id: string;
138
+ slug: string;
139
+ created_at: string;
140
+ };
141
+ export type CustomerAgentDetail = {
142
+ agent: CustomerAgentItem;
143
+ phoneNumbers: string[];
144
+ /** The numbers among phoneNumbers that also take WhatsApp messages and calls. */
145
+ whatsappNumbers: string[];
146
+ webLinks: CustomerWebLink[];
147
+ /** Whether this deployment can serve web links (a voice runtime and Turnstile). */
148
+ webLinksAvailable: boolean;
149
+ versions: Array<{
150
+ id: string;
151
+ definition: import('@retainer/shared').CustomerAgentDefinition;
152
+ }>;
153
+ proposals: Array<{
154
+ id: string;
155
+ definition: import('@retainer/shared').CustomerAgentDefinition;
156
+ check: {
157
+ problems: FeatureBuildProblem[];
158
+ warnings: FeatureBuildProblem[];
159
+ disclosure: CustomerDisclosure;
160
+ };
161
+ }>;
162
+ };
163
+ export type CustomerTestAdmission = {
164
+ id: string;
165
+ admission: string;
166
+ origin: string;
167
+ };
168
+ export type CustomerConversationItem = {
169
+ id: string;
170
+ agent_id: string | null;
171
+ agent_name: string | null;
172
+ channel: 'voice' | 'text';
173
+ /** How the customer reached the agent: an assigned number, a web link, or neither. */
174
+ line: 'number' | 'web' | null;
175
+ caller_number: string | null;
176
+ status: string;
177
+ outcome: string | null;
178
+ created_at: string;
179
+ started_at: string | null;
180
+ ended_at: string | null;
181
+ event_id: string | null;
182
+ /** Action counts by outcome, for calls and message conversations. */
183
+ actions?: Partial<Record<'done' | 'refused' | 'unknown' | 'pending' | 'pending_review', number>>;
184
+ /** Message counts by status, for message conversations. */
185
+ messages?: Partial<Record<'queued' | 'processing' | 'reply_ready' | 'sending' | 'sent' | 'failed' | 'uncertain' | 'expired', number>>;
186
+ };
187
+ export type CustomerConversationList = {
188
+ conversations: CustomerConversationItem[];
189
+ nextCursor: string | null;
190
+ };
191
+ export type CustomerPreviewReply = {
192
+ conversationId: string;
193
+ status: 'reply_ready' | 'failed' | 'uncertain';
194
+ text?: string;
195
+ actions: Array<{
196
+ name: string;
197
+ result: import('@retainer/shared').CustomerActionResult;
198
+ }>;
199
+ };
200
+ export type FeatureBuildAction = 'pin' | 'save_view' | 'update' | 'save_as_new' | 'propose';
201
+ export type FeatureBuildReceipt = {
202
+ draftId: string;
203
+ action: FeatureBuildAction;
204
+ savedId?: string;
205
+ revision?: string;
206
+ keptAt: string;
207
+ };
208
+ export type FeatureBuildProblem = {
209
+ path?: string;
210
+ statement?: string;
211
+ part?: string;
212
+ at?: string;
213
+ message: string;
214
+ };
215
+ type FeatureBuildEdit = {
216
+ id: string;
217
+ expectedUpdatedAt: string;
218
+ };
219
+ type ViewBuildDefinition = Omit<CreateViewInput, 'visibility' | 'position'> & {
220
+ object: string;
221
+ };
222
+ type ViewBuildChanges = Omit<UpdateViewInput, 'visibility' | 'position' | 'expectedUpdatedAt'>;
223
+ export type PrepareBuildInput = {
224
+ revisesDraftId?: string;
225
+ } & ({
226
+ feature: 'dashboard';
227
+ definition: Pick<CreateDashboard, 'name' | 'program'>;
228
+ target?: FeatureBuildEdit;
229
+ } | ({
230
+ feature: 'view';
231
+ } & ({
232
+ definition: ViewBuildDefinition;
233
+ target?: FeatureBuildEdit;
234
+ } | {
235
+ definition: ViewBuildChanges;
236
+ target: FeatureBuildEdit;
237
+ })) | {
238
+ feature: 'customer_agent';
239
+ definition: import('@retainer/shared').CustomerAgentDefinition;
240
+ target?: {
241
+ id: string;
242
+ expectedVersionId: string | null;
243
+ };
244
+ } | {
245
+ feature: 'routine';
246
+ definition: {
247
+ sourceId: string;
248
+ previewId?: string | null;
249
+ accountOwner?: string;
250
+ name: string;
251
+ description: string;
252
+ summary: string;
253
+ report: RoutineReport;
254
+ flow?: RoutineFlowStep[];
255
+ };
256
+ target?: {
257
+ id: string;
258
+ expectedVersionId: string | null;
259
+ };
260
+ });
261
+ export type PrepareBuildResult = {
262
+ ok: false;
263
+ problems: FeatureBuildProblem[];
264
+ } | {
265
+ ok: true;
266
+ draftId: string;
267
+ feature: FeatureBuildKind;
268
+ title: string;
269
+ expiresAt: string;
270
+ previewPath: string;
271
+ previewUrl?: string;
272
+ previewInstructions?: string;
273
+ reviewAccess?: string;
274
+ summary: {
275
+ count?: number;
276
+ queries?: unknown[];
277
+ warnings?: FeatureBuildProblem[];
278
+ dryRun?: 'not_attached' | 'unavailable' | 'pending' | 'failed' | 'complete';
279
+ };
280
+ };
281
+ export type BuildStatus = {
282
+ status: 'pending' | 'expired';
283
+ } | {
284
+ status: 'kept';
285
+ receipt: FeatureBuildReceipt;
286
+ };
287
+ export type PreparedRoutineRun = {
288
+ actionId: string;
289
+ expiresAt: string;
290
+ routineId: string;
291
+ versionId: string;
292
+ versionNumber: number;
293
+ name: string;
294
+ summary: string;
295
+ records: {
296
+ id: string;
297
+ label: string | null;
298
+ }[];
299
+ };
300
+ type RoutineActionLink = {
301
+ previewPath: string;
302
+ previewUrl?: string;
303
+ reviewAccess?: string;
304
+ };
305
+ type RoutineActionEffects = {
306
+ tools: (PreparedEnrollment['tools'][number] & {
307
+ accountOwner?: {
308
+ id: string;
309
+ name: string;
310
+ };
311
+ })[];
312
+ };
313
+ export type PreparedManualAction = PreparedRoutineRun & RoutineActionLink & RoutineActionEffects & {
314
+ kind: 'run';
315
+ };
316
+ export type PreparedEnrollmentAction = Omit<PreparedEnrollment, 'tools'> & RoutineActionLink & RoutineActionEffects & {
317
+ kind: 'enrollment';
318
+ };
319
+ export type RoutineActionReceipt = {
320
+ runs: string[];
321
+ } | {
322
+ enrollments: string[];
323
+ };
324
+ export type RoutineActionReview = (Omit<PreparedManualAction, keyof RoutineActionLink> | Omit<PreparedEnrollmentAction, keyof RoutineActionLink>) & {
325
+ status: 'pending' | 'expired' | 'confirmed';
326
+ receipt: RoutineActionReceipt | null;
327
+ canConfirm: boolean;
328
+ reviewer: string;
329
+ };
330
+ export type FeatureBuildReview = {
331
+ feature: FeatureBuildKind;
332
+ draftId: string;
333
+ title: string;
334
+ expiresAt: string;
335
+ status: 'pending' | 'kept' | 'expired';
336
+ receipt?: FeatureBuildReceipt;
337
+ target?: {
338
+ name?: string;
339
+ visibility?: 'workspace' | 'private';
340
+ stale: boolean;
341
+ } | null;
342
+ actions?: FeatureBuildAction[];
343
+ problems?: FeatureBuildProblem[];
344
+ warnings?: FeatureBuildProblem[];
345
+ program?: string;
346
+ customerAgent?: import('@retainer/shared').CustomerAgentDefinition;
347
+ disclosure?: CustomerDisclosure;
348
+ routine?: {
349
+ sourceId: string;
350
+ name: string;
351
+ description: string;
352
+ summary: string;
353
+ report: RoutineReport;
354
+ flow?: RoutineFlowStep[];
355
+ previewId?: string | null;
356
+ checked: RoutineDraft;
357
+ };
358
+ view?: {
359
+ preview: SavedView;
360
+ count?: number;
361
+ groups?: Extract<ViewCheckResult, {
362
+ ok: true;
363
+ }>['groups'];
364
+ };
365
+ };
366
+ export type { GmailComposeInput, GmailComposeResult, GmailRecipient } from '@retainer/shared';
69
367
  export declare class RetainerClient {
70
368
  private readonly options;
71
369
  private readonly baseUrl;
@@ -78,6 +376,95 @@ export declare class RetainerClient {
78
376
  protected get<T>(path: string, params?: Record<string, unknown>, signal?: AbortSignal): Promise<T>;
79
377
  protected send<T>(method: string, path: string, body?: unknown, signal?: AbortSignal, idempotencyKey?: string): Promise<T>;
80
378
  private post;
379
+ getCalendar(input: CalendarQuery, signal?: AbortSignal): Promise<CalendarResult>;
380
+ recordCalendar(id: string, options?: PageOptions & {
381
+ period?: 'upcoming' | 'past';
382
+ }, signal?: AbortSignal): Promise<{
383
+ items: CalendarEntryReference[];
384
+ nextCursor: string | null;
385
+ }>;
386
+ registerMemberCalendar(input: {
387
+ account: string;
388
+ email: string;
389
+ timeZone?: string;
390
+ syncInterval: number;
391
+ }): Promise<{
392
+ id: string;
393
+ generation: number;
394
+ }>;
395
+ registerResourceCalendar(input: {
396
+ key: string;
397
+ name: string;
398
+ record?: string;
399
+ timeZone?: string;
400
+ syncInterval?: number;
401
+ }): Promise<{
402
+ id: string;
403
+ generation: number;
404
+ }>;
405
+ beginCalendarObservation(input: {
406
+ calendar: string;
407
+ generation: number;
408
+ /** The source revision read with the choices (calendars spec 5.7). */
409
+ sources?: number;
410
+ window?: {
411
+ from: string;
412
+ to: string;
413
+ };
414
+ }): Promise<{
415
+ token: number;
416
+ generation: number;
417
+ }>;
418
+ syncCalendarCopies(input: {
419
+ token: number;
420
+ generation: number;
421
+ copies: CalendarCopy[];
422
+ }): Promise<{
423
+ accepted: number;
424
+ entries: Record<string, string>;
425
+ }>;
426
+ ownCalendarCopy(entry: string, includeCancelled?: boolean): Promise<{
427
+ calendar: string;
428
+ sourceItemId: string;
429
+ generation: number;
430
+ }>;
431
+ calendarGuestEmails(records: string[]): Promise<{
432
+ emails: string[];
433
+ }>;
434
+ /** A provider reads the member's source choices (calendars spec 5.7). */
435
+ calendarSources(calendar: string): Promise<{
436
+ revision: number;
437
+ sources: CalendarSource[];
438
+ }>;
439
+ /** A provider replaces its list of the member's source calendars. */
440
+ reportCalendarSources(calendar: string, input: {
441
+ generation: number;
442
+ listed: boolean;
443
+ sources: {
444
+ key: string;
445
+ name: string;
446
+ primary: boolean;
447
+ }[];
448
+ }): Promise<{
449
+ revision: number;
450
+ sources: CalendarSource[];
451
+ }>;
452
+ /** The caller's own member calendars and their sources. */
453
+ memberCalendarSources(signal?: AbortSignal): Promise<MemberCalendarSources>;
454
+ /** Saves the caller's choices for one of their own calendars. */
455
+ saveCalendarSources(calendar: string, input: {
456
+ revision: number;
457
+ modes: Record<string, CalendarSourceMode>;
458
+ }): Promise<{
459
+ revision: number;
460
+ sources: CalendarSource[];
461
+ }>;
462
+ completeCalendarObservation(calendar: string, input: {
463
+ token: number;
464
+ generation: number;
465
+ }): Promise<{
466
+ completed: boolean;
467
+ }>;
81
468
  /** Health reports database outages in its response body, including HTTP 503. */
82
469
  health(): Promise<HealthResponse>;
83
470
  signIn(key: string): Promise<Session>;
@@ -86,6 +473,8 @@ export declare class RetainerClient {
86
473
  }>;
87
474
  me(signal?: AbortSignal): Promise<Session>;
88
475
  schema(signal?: AbortSignal): Promise<SchemaDescription>;
476
+ /** What Retainer tells every agent that connects: instructions, tools and guides. */
477
+ agentBriefing(signal?: AbortSignal): Promise<AgentBriefing>;
89
478
  templates(signal?: AbortSignal): Promise<{
90
479
  templates: TemplateView[];
91
480
  }>;
@@ -110,6 +499,8 @@ export declare class RetainerClient {
110
499
  }): Promise<WriteResponse>;
111
500
  /** What deleting the record would delete with it; changes nothing. */
112
501
  deleteImpact(id: string, signal?: AbortSignal): Promise<DeleteImpact>;
502
+ previewRecordAction(input: RecordActionInput, signal?: AbortSignal): Promise<RecordActionPreview>;
503
+ confirmRecordAction(input: ConfirmRecordActionInput): Promise<MergeResult | DeleteRecordResult>;
113
504
  /** What deleting several records together would delete with them. */
114
505
  bulkDeleteImpact(ids: string[], signal?: AbortSignal): Promise<BulkDeleteImpact>;
115
506
  /** The total and requested aggregates over the records a filter matches. */
@@ -120,25 +511,47 @@ export declare class RetainerClient {
120
511
  views: SavedView[];
121
512
  }>;
122
513
  view(id: string, signal?: AbortSignal): Promise<SavedView>;
123
- createView(object: string, input: CreateViewInput): Promise<SavedView>;
514
+ customerAgents(signal?: AbortSignal): Promise<CustomerAgentList>;
515
+ customerAgent(id: string, signal?: AbortSignal): Promise<CustomerAgentDetail>;
516
+ publishCustomerAgent(id: string, proposalId: string): Promise<{
517
+ versionId: string;
518
+ }>;
519
+ addCustomerWebLink(id: string): Promise<CustomerWebLink>;
520
+ removeCustomerWebLink(id: string, lineId: string): Promise<{
521
+ removed: true;
522
+ }>;
523
+ customerConversations(input?: {
524
+ agentId?: string;
525
+ cursor?: string;
526
+ limit?: number;
527
+ }, signal?: AbortSignal): Promise<CustomerConversationList>;
528
+ pauseCustomerAgent(id: string, paused: boolean): Promise<{
529
+ paused: boolean;
530
+ }>;
531
+ testCustomerCall(id: string, input: {
532
+ number?: string;
533
+ proposalId?: string;
534
+ }): Promise<CustomerTestAdmission>;
535
+ testCustomerReply(id: string, input: {
536
+ number?: string;
537
+ proposalId?: string;
538
+ text: string;
539
+ conversationId?: string;
540
+ }): Promise<CustomerPreviewReply>;
541
+ prepareBuild(input: PrepareBuildInput): Promise<PrepareBuildResult>;
542
+ buildStatus(draftId: string, signal?: AbortSignal): Promise<BuildStatus>;
543
+ featureBuild(draftId: string, signal?: AbortSignal): Promise<FeatureBuildReview>;
544
+ keepFeatureBuild(draftId: string, action: FeatureBuildAction): Promise<FeatureBuildReceipt>;
545
+ checkView(draft: unknown, object?: string, signal?: AbortSignal): Promise<ViewCheckResult>;
546
+ createView(object: string, input: CreateViewInput, build?: BuildContext): Promise<SavedView>;
124
547
  /** Changes only the keys given; `null` clears a setting. */
125
- updateView(id: string, input: UpdateViewInput): Promise<SavedView>;
548
+ updateView(id: string, input: UpdateViewInput, build?: BuildContext): Promise<SavedView>;
126
549
  deleteView(id: string): Promise<{
127
550
  id: string;
128
551
  deleted: true;
129
552
  }>;
130
553
  /** Merges `input.recordId` into `id`, which survives. Retrying with the same key is safe. */
131
554
  mergeRecords(id: string, input: MergeInput, idempotencyKey?: string): Promise<MergeResult>;
132
- /**
133
- * Deletes the signed-in person's personal memory in this workspace (4.6):
134
- * web sessions only; agents cannot clear it.
135
- */
136
- clearMyMemory(): Promise<{
137
- cleared: true;
138
- counts: Record<string, number>;
139
- }>;
140
- /** Erases a person and what was logged about them (needs the `admin` scope). Not reversible. */
141
- forget(id: string): Promise<ForgetResult>;
142
555
  search(input: SearchInput, signal?: AbortSignal): Promise<SearchResult>;
143
556
  context(id: ProfileAlias, input?: ContextInput, signal?: AbortSignal): Promise<ProfileContextPack>;
144
557
  context(id: string, input?: ContextInput, signal?: AbortSignal): Promise<ContextPack>;
@@ -234,6 +647,8 @@ export declare class RetainerClient {
234
647
  * `added.participants.matched` includes participants resolved in place.
235
648
  */
236
649
  logEvent(input: LogEventInput): Promise<LogEventResult>;
650
+ /** Apply or clear an admin correction on the current revision of a synced event. */
651
+ correctSourceEvent(id: string, input: import('@retainer/shared').SourceEventCorrection): Promise<import("@retainer/shared").SourceEventCorrectionResult>;
237
652
  /**
238
653
  * Moves events to another event type, keeping their IDs, identities, links
239
654
  * and the claims that cite them (`POST /v1/events/move`). Moving needs a
@@ -271,15 +686,6 @@ export declare class RetainerClient {
271
686
  facts: string | null;
272
687
  };
273
688
  }>;
274
- fileErasureStatus(ids: string[]): Promise<{
275
- pending: number;
276
- succeeded: number;
277
- jobs: {
278
- id: string;
279
- status: string;
280
- code: string | null;
281
- }[];
282
- }>;
283
689
  createFileIntent(input: import('@retainer/shared').FileUploadInput, idempotencyKey: string): Promise<{
284
690
  id: string;
285
691
  upload: import('@retainer/shared').FileTransfer;
@@ -289,6 +695,47 @@ export declare class RetainerClient {
289
695
  } & {
290
696
  state: 'ready';
291
697
  }>;
698
+ recorderIdentity(signal?: AbortSignal): Promise<import("@retainer/shared").RecorderIdentityView>;
699
+ /** People to add to a meeting, by name or the start of an email; recorder logins only. */
700
+ recorderPeople(q: string, signal?: AbortSignal): Promise<import("@retainer/shared").RecorderPeopleView>;
701
+ revokeRecorderSession(): Promise<void>;
702
+ recordingConfig(signal?: AbortSignal): Promise<import("@retainer/shared").RecordingConfig>;
703
+ recordingSettings(signal?: AbortSignal): Promise<import("@retainer/shared").RecordingSettings>;
704
+ recordingNotesPlan(): Promise<import("@retainer/shared").RecordingNotesPlan>;
705
+ recordingNotes(id: string, signal?: AbortSignal): Promise<import("@retainer/shared").RecordingNotes>;
706
+ updateRecordingSettings(input: import('@retainer/shared').RecordingSettingsInput): Promise<import("@retainer/shared").RecordingSettings>;
707
+ /** Who is recording a meeting now (§5.4), before starting another recording of it. */
708
+ activeRecordings(meeting: {
709
+ calendarEntry?: string;
710
+ meetingUrl?: string;
711
+ }, signal?: AbortSignal): Promise<{
712
+ recordings: import('@retainer/shared').RecordingElsewhere[];
713
+ }>;
714
+ startRecording(input: import('@retainer/shared').StartRecordingInput): Promise<import("@retainer/shared").StartRecordingResult>;
715
+ recordings(options?: {
716
+ all?: boolean;
717
+ before?: string;
718
+ limit?: number;
719
+ outstanding?: boolean;
720
+ }, signal?: AbortSignal): Promise<{
721
+ recordings: import('@retainer/shared').RecordingView[];
722
+ nextBefore: string | null;
723
+ }>;
724
+ recording(id: string, signal?: AbortSignal): Promise<import("@retainer/shared").RecordingView>;
725
+ updateRecording(id: string, input: import('@retainer/shared').UpdateRecordingInput): Promise<import("@retainer/shared").RecordingView>;
726
+ recordingPart(id: string, part: import('@retainer/shared').RecordingPartInput): Promise<import("@retainer/shared").RecordingPartTransfer>;
727
+ sealRecording(id: string, input: import('@retainer/shared').SealRecordingInput): Promise<import("@retainer/shared").RecordingView>;
728
+ /** Seal a parts recording with what arrived, or wake the provider check for a Recall capture. */
729
+ finishRecording(id: string): Promise<import("@retainer/shared").RecordingView>;
730
+ discardRecording(id: string): Promise<import("@retainer/shared").RecordingView>;
731
+ retryRecording(id: string): Promise<import("@retainer/shared").RecordingView>;
732
+ /** Add without text (§4.1): logs the event with no transcript. */
733
+ logRecordingWithoutText(id: string): Promise<import("@retainer/shared").RecordingView>;
734
+ recordingTranscript(id: string, after?: number, signal?: AbortSignal): Promise<import("@retainer/shared").RecordingTranscriptPage>;
735
+ recordingPlayback(id: string): Promise<import("@retainer/shared").RecordingPlayback>;
736
+ transcribeRecording(id: string): Promise<import("@retainer/shared").RecordingView>;
737
+ nameRecordingSpeakers(id: string, input: import('@retainer/shared').NameSpeakersInput): Promise<import("@retainer/shared").RecordingView>;
738
+ eraseRecordingAudio(id: string): Promise<import("@retainer/shared").RecordingView>;
292
739
  file(id: string, signal?: AbortSignal): Promise<import("@retainer/shared").FileView>;
293
740
  downloadFile(id: string): Promise<import("@retainer/shared").FileTransfer>;
294
741
  extensionCatalog(signal?: AbortSignal): Promise<{
@@ -337,7 +784,7 @@ export declare class RetainerClient {
337
784
  providerRevision: string | null;
338
785
  } | {
339
786
  externalId: string;
340
- code: 'source_erased' | 'source_deleted';
787
+ code: 'source_deleted';
341
788
  })[];
342
789
  }>;
343
790
  sourceItem(installationId: string, itemId: string): Promise<import("@retainer/shared").SourceItemView>;
@@ -359,6 +806,12 @@ export declare class RetainerClient {
359
806
  through: number;
360
807
  } | null;
361
808
  }>;
809
+ /**
810
+ * Draft or send an email from the run's member mailbox. Gmail tool runs only;
811
+ * the server builds the message and keys it to the tool job, so a retry
812
+ * finishes the same message.
813
+ */
814
+ composeGmail(installationId: string, input: GmailComposeInput): Promise<GmailComposeResult>;
362
815
  releaseGmailConnection(installationId: string): Promise<{
363
816
  released: true;
364
817
  }>;
@@ -466,11 +919,10 @@ export declare class RetainerClient {
466
919
  extensionConnections(id: string, signal?: AbortSignal): Promise<{
467
920
  connections: ExtensionConnection[];
468
921
  }>;
469
- authorizeGmail(id: string, historyDays: number): Promise<{
922
+ /** `allowSending` allows Retainer to use the Gmail grant for drafting and sending. */
923
+ authorizeGmail(id: string, historyDays: number, allowSending?: boolean): Promise<{
470
924
  attemptId: string;
471
925
  connectLink: string;
472
- sessionToken: string;
473
- integrationId: string;
474
926
  expiresAt: string;
475
927
  }>;
476
928
  finishGmailAuthorization(id: string, attemptId: string): Promise<{
@@ -629,20 +1081,6 @@ export declare class RetainerClient {
629
1081
  }): Promise<{
630
1082
  revision: number;
631
1083
  }>;
632
- /** Recompute only the release-pinned last-contact fields. Values, provenance and actor are server-derived. */
633
- reconcileLastContact(id: string, input: {
634
- kind: 'scan';
635
- after?: string | null;
636
- through?: string;
637
- } | {
638
- kind: 'records';
639
- recordIds: string[];
640
- }): Promise<{
641
- processed: number;
642
- changed: number;
643
- nextAfter: string | null;
644
- through: string | null;
645
- }>;
646
1084
  /** Reserve a durable callback before provider registration returns its signing material. Setup only. */
647
1085
  prepareExtensionWebhook(id: string, input: {
648
1086
  route: string;
@@ -745,32 +1183,44 @@ export declare class RetainerClient {
745
1183
  manifest: unknown;
746
1184
  code: string;
747
1185
  }, wait?: number): Promise<RoutineCheckResult>;
748
- previewRoutine(input: {
1186
+ previewRoutine(input: ({
749
1187
  manifest: unknown;
750
1188
  code: string;
1189
+ } | {
1190
+ sourceId: string;
1191
+ }) & {
1192
+ sampleInput?: EnrollmentInput;
751
1193
  }): Promise<{
752
1194
  valid: boolean;
753
1195
  problems: RoutineProblem[];
1196
+ sourceId?: string;
754
1197
  /** Null when nothing matched recently: there is nothing to dry-run or poll. */
755
1198
  previewId?: string | null;
1199
+ /** Eligible records after the condition, or one run for a schedule without an object. */
756
1200
  matched?: number;
757
1201
  done?: boolean;
758
1202
  }>;
759
1203
  routinePreview(previewId: string, signal?: AbortSignal): Promise<RoutinePreview>;
760
1204
  routineJob(jobId: string, signal?: AbortSignal): Promise<RoutineRunView & Partial<RoutineCheckResult>>;
761
- /** Asks the built-in builder for a routine from a description; poll the job. */
762
- buildRoutine(description: string, routineId?: string): Promise<{
763
- jobId: string;
764
- }>;
765
- proposeRoutine(input: {
1205
+ /** What a chat's routine draft card shows (routines-in-chat spec §4.1). It only reads. */
1206
+ routineDraft(sourceId: string, options?: {
1207
+ preview?: string | null;
1208
+ routine?: string;
1209
+ }, signal?: AbortSignal): Promise<RoutineDraft>;
1210
+ proposeRoutine(input: ({
766
1211
  manifest: unknown;
767
1212
  code: string;
1213
+ } | {
1214
+ sourceId: string;
1215
+ }) & {
768
1216
  name: string;
769
1217
  description: string;
770
1218
  summary: string;
771
1219
  report: RoutineReport;
772
1220
  routineId?: string;
773
- }): Promise<{
1221
+ /** The builder's flow chart of the code, kept with the version. */
1222
+ flow?: RoutineFlowStep[];
1223
+ }, build?: BuildContext): Promise<{
774
1224
  routineId: string;
775
1225
  versionId: string;
776
1226
  number: number;
@@ -784,8 +1234,8 @@ export declare class RetainerClient {
784
1234
  dashboards: DashboardSummary[];
785
1235
  }>;
786
1236
  dashboard(id: string, signal?: AbortSignal): Promise<SavedDashboard>;
787
- createDashboard(input: CreateDashboard): Promise<SavedDashboard>;
788
- updateDashboard(id: string, input: UpdateDashboard): Promise<SavedDashboard>;
1237
+ createDashboard(input: CreateDashboard, build?: BuildContext): Promise<SavedDashboard>;
1238
+ updateDashboard(id: string, input: UpdateDashboard, build?: BuildContext): Promise<SavedDashboard>;
789
1239
  deleteDashboard(id: string): Promise<void>;
790
1240
  createAgentChat(signal?: AbortSignal, client?: 'web' | 'cli'): Promise<AgentChat>;
791
1241
  /** The person's chats with the workspace agent. */
@@ -834,9 +1284,41 @@ export declare class RetainerClient {
834
1284
  held?: number;
835
1285
  matched?: number;
836
1286
  }>;
837
- runRoutine(id: string, recordIds: string[]): Promise<{
1287
+ prepareRoutineRun(routineId: string, recordIds: string[]): Promise<PreparedManualAction>;
1288
+ prepareEnrollment(routineId: string, recordIds: string[], input: EnrollmentInput): Promise<PreparedEnrollmentAction>;
1289
+ routineAction(actionId: string, signal?: AbortSignal): Promise<RoutineActionReview>;
1290
+ confirmRoutineAction(actionId: string): Promise<RoutineActionReceipt>;
1291
+ runRoutine(id: string, recordIds: string[], reviewed?: {
1292
+ expectedVersionId: string;
1293
+ actionId: string;
1294
+ }): Promise<{
838
1295
  runs: string[];
839
1296
  }>;
1297
+ startEnrollment(routineId: string, input: {
1298
+ recordIds: string[];
1299
+ input: EnrollmentInput;
1300
+ expectedVersionId?: string;
1301
+ }, actionId?: string): Promise<{
1302
+ enrollments: string[];
1303
+ }>;
1304
+ enrollmentStartReceipt(actionId: string, signal?: AbortSignal): Promise<{
1305
+ started: boolean;
1306
+ }>;
1307
+ routineEnrollments(routineId: string, signal?: AbortSignal): Promise<{
1308
+ enrollments: EnrollmentView[];
1309
+ }>;
1310
+ recordEnrollments(recordId: string, signal?: AbortSignal): Promise<{
1311
+ enrollments: EnrollmentView[];
1312
+ }>;
1313
+ enrollment(id: string, signal?: AbortSignal): Promise<EnrollmentDetail>;
1314
+ stopEnrollment(id: string): Promise<EnrollmentDetail>;
1315
+ answerAgentQuestion(id: string, answer: {
1316
+ text?: string;
1317
+ option?: string;
1318
+ }): Promise<{
1319
+ id: string;
1320
+ status: 'answered';
1321
+ }>;
840
1322
  routineButtons(object: string, signal?: AbortSignal): Promise<{
841
1323
  buttons: RoutineButton[];
842
1324
  }>;
@@ -845,6 +1327,7 @@ export declare class RetainerClient {
845
1327
  }>;
846
1328
  }
847
1329
  export type AgentChat = {
1330
+ client?: 'whatsapp';
848
1331
  id: string;
849
1332
  title: string | null;
850
1333
  createdAt: string;
@@ -852,6 +1335,7 @@ export type AgentChat = {
852
1335
  status?: string;
853
1336
  };
854
1337
  export type AgentChatDetail = {
1338
+ preparedBuilds?: boolean;
855
1339
  id: string;
856
1340
  title: string | null;
857
1341
  running: boolean;