@flexkit/agent-protocol 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +89 -2
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -288,13 +288,59 @@ declare function isDataPartType(type: string): type is DataPartType;
288
288
  /** The `type` of a UI message part carrying this data part. */
289
289
  type DataPartMessageType = `data-${DataPartType}`;
290
290
 
291
+ /**
292
+ * `approval_request`: a proposal waits on the recipient. `automation_result`: an
293
+ * automation run finished and its notify rule asked for it. `automation_failure`:
294
+ * an automation run failed.
295
+ */
296
+ type ActivityItemKind = 'approval_request' | 'automation_result' | 'automation_failure';
297
+ /** `done` = resolved by the system (e.g. the approval was decided); `dismissed` = hidden by the recipient. */
298
+ type ActivityItemState = 'unread' | 'read' | 'done' | 'dismissed';
299
+ type ActivityItemResolution = 'approved' | 'rejected' | 'expired' | 'cancelled';
300
+ /** One entry in a user's Studio Activity inbox. */
301
+ interface ActivityItem {
302
+ approvalId: string | null;
303
+ automationId: string | null;
304
+ automationRunId: string | null;
305
+ body: string | null;
306
+ chatId: string | null;
307
+ chatMessageId: string | null;
308
+ createdAt: string;
309
+ id: string;
310
+ kind: ActivityItemKind;
311
+ readAt: string | null;
312
+ /** True when the item waits on the recipient (an approval request). */
313
+ requiresAction: boolean;
314
+ resolution: ActivityItemResolution | null;
315
+ resolvedAt: string | null;
316
+ state: ActivityItemState;
317
+ title: string;
318
+ }
319
+ interface ActivityItemsPage {
320
+ hasMore: boolean;
321
+ items: ActivityItem[];
322
+ }
323
+ /** Badge counts plus unread items newer than the client's `since` watermark (newest first, at most 5). */
324
+ interface ActivitySummary {
325
+ needsActionCount: number;
326
+ newItems: ActivityItem[];
327
+ unreadCount: number;
328
+ }
329
+
291
330
  /** Run and approval shapes returned by the automations API. */
292
331
  type AutomationRunStatus = 'running' | 'awaiting_approval' | 'success' | 'skipped' | 'failed' | 'cancelled';
293
332
  type AutomationTriggerType = 'entity' | 'manual' | 'schedule' | 'webhook';
294
333
  type AutomationApprovalStatus = 'pending' | 'approved' | 'rejected' | 'expired' | 'cancelled';
295
- type AutomationApprovalKind = 'graphql' | 'bulk' | 'plugin' | 'exec' | 'schema';
334
+ type AutomationApprovalKind = 'graphql' | 'bulk' | 'plugin' | 'exec' | 'schema' | 'automation';
296
335
  type AutomationApprovalPreviewKind = 'create' | 'update' | 'delete' | 'unknown';
297
336
  type AutomationMutationPolicy = 'require_approval' | 'auto_approve';
337
+ /**
338
+ * Which finished runs create an Activity item for the automation's recipients:
339
+ * every run, runs the agent flagged for attention, failures only, or none.
340
+ * Failures notify under every rule except `never`.
341
+ */
342
+ type AutomationNotifyRule = 'always' | 'when_flagged' | 'failures' | 'never';
343
+ type AutomationVisibility = 'project' | 'space' | 'personal';
298
344
  interface AutomationApprovalOperation {
299
345
  query: string;
300
346
  variables: {
@@ -328,15 +374,56 @@ interface SchemaChangePreviewSummary {
328
374
  breakingChanges: string[];
329
375
  warnings: string[];
330
376
  }
377
+ /** A plugin an agent-proposed automation may use. */
378
+ interface AutomationProposalPlugin {
379
+ /** The connected account, e.g. an email address; null when the plugin needs none. */
380
+ account: string | null;
381
+ /** Channel names it delivers to (Slack, Teams); empty when it does not deliver. */
382
+ deliveryChannels: string[];
383
+ name: string;
384
+ }
385
+ /**
386
+ * Extra context carried by `kind: 'automation'` approvals: the automation the
387
+ * chat agent proposed. Nothing exists until a person approves; the approver may
388
+ * edit the instructions first.
389
+ */
390
+ interface AutomationProposalPreview {
391
+ customTools: string[];
392
+ instructions: string;
393
+ modelLabel: string;
394
+ mutationPolicy: AutomationMutationPolicy;
395
+ name: string;
396
+ notifyCreator: boolean;
397
+ notifyRule: AutomationNotifyRule;
398
+ plugins: AutomationProposalPlugin[];
399
+ /** Run the automation once right after it is created (the approver can also choose this). */
400
+ runOnceAfterCreate: boolean;
401
+ skills: string[];
402
+ spaceLabel: string | null;
403
+ /** Subscribers' display names. */
404
+ subscribers: string[];
405
+ /** One line per trigger in plain words, e.g. "Every Monday at 09:00 (Europe/Prague)". */
406
+ triggers: string[];
407
+ visibility: AutomationVisibility;
408
+ }
331
409
  interface AutomationApprovalPreview {
410
+ automation?: AutomationProposalPreview;
332
411
  operations: AutomationApprovalPreviewOperation[];
333
412
  schema?: SchemaChangePreviewSummary;
334
413
  }
414
+ /** What an approved `kind: 'automation'` proposal created. */
415
+ interface CreatedAutomationResult {
416
+ automationId: string;
417
+ /** The first run, when the approver chose to run it once. */
418
+ runId: string | null;
419
+ }
335
420
  interface AutomationApproval {
336
421
  affectedCount: number | null;
337
422
  /** Null for approvals raised by a chat turn. */
338
423
  automationId: string | null;
339
424
  automationName: string;
425
+ /** Set once an approved `kind: 'automation'` proposal created its automation. */
426
+ createdAutomation?: CreatedAutomationResult | null;
340
427
  /** Set for approvals raised by a chat turn. */
341
428
  chatId: string | null;
342
429
  chatMessageId: string | null;
@@ -451,4 +538,4 @@ type AgentChatFollowUpResult = {
451
538
  turn: AgentChatTurn;
452
539
  };
453
540
 
454
- export { type AgentChat, type AgentChatAttachment, type AgentChatFollowUp, type AgentChatFollowUpDelivery, type AgentChatFollowUpResult, type AgentChatMessage, type AgentChatMessageRole, type AgentChatMessageStatus, type AgentChatPart, type AgentChatTurn, type AutomationApproval, type AutomationApprovalKind, type AutomationApprovalOperation, type AutomationApprovalPreview, type AutomationApprovalPreviewKind, type AutomationApprovalPreviewOperation, type AutomationApprovalPreviewRow, type AutomationApprovalStatus, type AutomationMutationPolicy, type AutomationRun, type AutomationRunStatus, type AutomationToolAllowRule, type AutomationTriggerType, DATA_PART_TYPES, type DataPart, type DataPartMessageType, type DataPartType, type SchemaChangePreviewSummary, dataPartSchema, errorSchema, isDataPartType };
541
+ export { type ActivityItem, type ActivityItemKind, type ActivityItemResolution, type ActivityItemState, type ActivityItemsPage, type ActivitySummary, type AgentChat, type AgentChatAttachment, type AgentChatFollowUp, type AgentChatFollowUpDelivery, type AgentChatFollowUpResult, type AgentChatMessage, type AgentChatMessageRole, type AgentChatMessageStatus, type AgentChatPart, type AgentChatTurn, type AutomationApproval, type AutomationApprovalKind, type AutomationApprovalOperation, type AutomationApprovalPreview, type AutomationApprovalPreviewKind, type AutomationApprovalPreviewOperation, type AutomationApprovalPreviewRow, type AutomationApprovalStatus, type AutomationMutationPolicy, type AutomationNotifyRule, type AutomationProposalPlugin, type AutomationProposalPreview, type AutomationRun, type AutomationRunStatus, type AutomationToolAllowRule, type AutomationTriggerType, type AutomationVisibility, type CreatedAutomationResult, DATA_PART_TYPES, type DataPart, type DataPartMessageType, type DataPartType, type SchemaChangePreviewSummary, dataPartSchema, errorSchema, isDataPartType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexkit/agent-protocol",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Schemas and types shared between the Flexkit agent platform and its Studio UI: streamed data parts, run, approval and chat DTOs.",
5
5
  "keywords": [
6
6
  "flexkit",