@chusky/sdk 0.1.2 → 0.3.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/types.d.ts CHANGED
@@ -43,6 +43,36 @@ export interface AuditEvent {
43
43
  status: number;
44
44
  at: number;
45
45
  }
46
+ export interface CompanyRunSummary {
47
+ id: string;
48
+ status: Run["status"];
49
+ agentId?: string;
50
+ agentName?: string;
51
+ cost?: number;
52
+ errorCode?: string;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ }
56
+ export interface CompanyAuditEvent {
57
+ id: string;
58
+ action: string;
59
+ requestId: string;
60
+ status: number;
61
+ at: string;
62
+ }
63
+ export interface CompanyUsagePeriod {
64
+ month: string;
65
+ completedRuns: number;
66
+ costUsd: number;
67
+ }
68
+ export interface CompanyUsage {
69
+ currentMonth: CompanyUsagePeriod;
70
+ periods: CompanyUsagePeriod[];
71
+ runs: {
72
+ indexed: number;
73
+ active: number;
74
+ };
75
+ }
46
76
  export interface Webhook {
47
77
  id: string;
48
78
  url: string;
@@ -82,6 +112,325 @@ export interface Usage {
82
112
  count: number;
83
113
  };
84
114
  }
115
+ export type AutonomyMode = "notify" | "check_in" | "act" | "wait_until";
116
+ export type AutonomyLinks = {
117
+ taskId?: string;
118
+ missionId?: string;
119
+ missionStepId?: string;
120
+ openLoopId?: string;
121
+ attentionCandidateId?: string;
122
+ projectId?: string;
123
+ meetingId?: string;
124
+ conversationId?: string;
125
+ };
126
+ export interface AutonomyContextSnapshot {
127
+ capturedAt: number;
128
+ objective: string;
129
+ summary?: string;
130
+ nextAction?: string;
131
+ links?: AutonomyLinks;
132
+ freshnessMs?: number;
133
+ source?: "live" | "checkpoint" | "user" | "system";
134
+ }
135
+ export interface Reminder {
136
+ id: string;
137
+ text: string;
138
+ runAt: string;
139
+ status: "scheduled" | "waiting" | "paused" | "sent" | "cancelled" | "failed";
140
+ workflowRunId?: string;
141
+ mode?: AutonomyMode;
142
+ links?: AutonomyLinks;
143
+ contextSnapshot?: AutonomyContextSnapshot;
144
+ preconditions?: string[];
145
+ postconditions?: string[];
146
+ nextAction?: string;
147
+ pollEverySeconds?: number;
148
+ deliveryTarget?: Record<string, unknown>;
149
+ deliveryError?: string;
150
+ createdAt: string;
151
+ }
152
+ export interface RecurringJob {
153
+ id: string;
154
+ text: string;
155
+ cron: string;
156
+ status?: "active" | "paused" | "cancelled";
157
+ workflowRunId?: string;
158
+ mode?: AutonomyMode;
159
+ links?: AutonomyLinks;
160
+ contextSnapshot?: AutonomyContextSnapshot;
161
+ preconditions?: string[];
162
+ postconditions?: string[];
163
+ nextAction?: string;
164
+ deliveryTarget?: Record<string, unknown>;
165
+ deliveryError?: string;
166
+ createdAt: string;
167
+ [key: string]: unknown;
168
+ }
169
+ export interface JobOccurrence {
170
+ id: string;
171
+ userId?: number;
172
+ jobId: string;
173
+ occurrenceId: string;
174
+ status: string;
175
+ mode: AutonomyMode;
176
+ idempotencyKey: string;
177
+ context?: AutonomyContextSnapshot;
178
+ result?: string;
179
+ nextAction?: string;
180
+ waitReason?: string;
181
+ error?: string;
182
+ cost?: number;
183
+ toolCalls?: number;
184
+ startedAt?: string;
185
+ completedAt?: string;
186
+ createdAt: string;
187
+ updatedAt: string;
188
+ version: number;
189
+ }
190
+ export interface ScratchpadEntry {
191
+ key: string;
192
+ content: string;
193
+ updatedAt: string;
194
+ }
195
+ export type MemoryCategory = "profile" | "personal" | "preference" | "business" | "relationship" | "project" | "procedural" | "episodic" | "document" | "negative" | "fact" | "instruction" | "asset";
196
+ export interface MemoryFact {
197
+ id: string;
198
+ category: MemoryCategory;
199
+ key: string;
200
+ value: string;
201
+ confidence: number;
202
+ source: string;
203
+ sensitivity: "normal" | "sensitive";
204
+ status?: string;
205
+ projectId?: string;
206
+ personKey?: string;
207
+ createdAt: string;
208
+ updatedAt: string;
209
+ expiresAt?: string;
210
+ reviewAt?: string;
211
+ }
212
+ export interface CliDevice {
213
+ id: string;
214
+ name: string;
215
+ createdAt: string;
216
+ lastSeenAt: string;
217
+ }
218
+ export interface AppConnection {
219
+ id: string;
220
+ toolkit?: string;
221
+ accountId?: string;
222
+ name?: string;
223
+ status?: string;
224
+ [key: string]: unknown;
225
+ }
226
+ export interface CompanyBranding {
227
+ organizationId: string;
228
+ displayName?: string;
229
+ logoUrl?: string;
230
+ accentColor?: string;
231
+ backgroundColor?: string;
232
+ customDomain?: string;
233
+ customDomainStatus?: string;
234
+ updatedAt?: string;
235
+ }
236
+ export type CallProvider = "twilio" | "bland" | "legacy";
237
+ export type CallStatus = "starting" | "bridging" | "active" | "ended" | "failed";
238
+ export interface VoiceOption {
239
+ id: string;
240
+ name: string;
241
+ accent?: string;
242
+ description?: string;
243
+ }
244
+ export interface VoiceOptions {
245
+ fluxVoices: VoiceOption[];
246
+ blandVoices: VoiceOption[];
247
+ blandAvailable: boolean;
248
+ blandCatalogueAvailable: boolean;
249
+ }
250
+ export interface LiveVoicePreference {
251
+ provider: "twilio" | "meetings" | "bland";
252
+ voice?: string | VoiceOption | null;
253
+ }
254
+ export interface AccountPreferences {
255
+ model: string;
256
+ voiceReplies: boolean;
257
+ voicePreferences: Record<string, string | VoiceOption>;
258
+ }
259
+ export type VoiceCallMode = "general" | "sales" | "onboarding" | "support" | "scheduling";
260
+ export type VoiceCallTone = "professional" | "warm" | "direct" | "consultative";
261
+ export type VoiceCallCapability = "memory_lookup" | "scratchpad_lookup" | "schedule_lookup" | "task_lookup" | "call_history";
262
+ export interface VoiceCallProfile {
263
+ identity: string;
264
+ organization?: string;
265
+ mode: VoiceCallMode;
266
+ tone: VoiceCallTone;
267
+ opening?: string;
268
+ facts: string[];
269
+ guardrails: string[];
270
+ capabilities: VoiceCallCapability[];
271
+ }
272
+ export interface CallRecord {
273
+ id: string;
274
+ provider?: CallProvider;
275
+ direction?: "inbound" | "outbound";
276
+ phoneNumber: string;
277
+ purpose: string;
278
+ status: CallStatus;
279
+ error?: string;
280
+ summary?: string;
281
+ createdAt: string;
282
+ updatedAt: string;
283
+ }
284
+ export interface CallsResponse {
285
+ available: boolean;
286
+ provider: CallProvider | null;
287
+ data: CallRecord[];
288
+ }
289
+ export type MeetingPlatform = "zoom" | "google_meet" | "microsoft_teams" | "webex";
290
+ export type MeetingInteractionMode = "addressed" | "copilot" | "representative";
291
+ export type MeetingStatus = "creating" | "scheduled" | "joining" | "waiting_room" | "in_call" | "leaving" | "ended" | "failed";
292
+ export interface MeetingMission {
293
+ clientName: string;
294
+ objective: string;
295
+ brief: string;
296
+ sourceMemoryIds: string[];
297
+ preparedAt: number;
298
+ }
299
+ export interface MeetingMissionSummary {
300
+ clientName: string;
301
+ objective: string;
302
+ preparedAt: string;
303
+ }
304
+ export interface MeetingParticipant {
305
+ id: string;
306
+ name: string;
307
+ identityStatus?: "named" | "unknown";
308
+ isHost?: boolean;
309
+ status: "present" | "left";
310
+ updatedAt: string;
311
+ }
312
+ export interface MeetingSpeakerEvent {
313
+ type: "speech_on" | "speech_off";
314
+ participantId?: string;
315
+ at: string;
316
+ }
317
+ export interface MeetingOutcomeActionItem {
318
+ task: string;
319
+ owner: string;
320
+ dueDate?: string;
321
+ }
322
+ export interface MeetingOutcome {
323
+ title: string;
324
+ summary: string;
325
+ decisions: string[];
326
+ actionItems: MeetingOutcomeActionItem[];
327
+ openQuestions: string[];
328
+ }
329
+ export interface MeetingOutcomeFollowThrough {
330
+ notionSaved?: boolean;
331
+ notionTool?: string;
332
+ notionUrl?: string;
333
+ completedTools?: string[];
334
+ }
335
+ export interface MeetingRecord {
336
+ id: string;
337
+ platform: MeetingPlatform;
338
+ status: MeetingStatus;
339
+ interactionMode: MeetingInteractionMode;
340
+ screenShareUnderstanding: boolean;
341
+ searchableTranscript: boolean;
342
+ transcriptStatus?: "processing" | "ready" | "failed";
343
+ transcriptErrorCode?: string;
344
+ transcriptExpiresAt?: string;
345
+ title?: string;
346
+ joinAt?: string;
347
+ error?: string;
348
+ mission?: MeetingMissionSummary;
349
+ participantRoster?: MeetingParticipant[];
350
+ speakerEvents?: MeetingSpeakerEvent[];
351
+ history?: Array<{
352
+ role: "user" | "assistant";
353
+ content: string;
354
+ createdAt?: string;
355
+ }>;
356
+ outcome?: MeetingOutcome;
357
+ outcomeFollowThrough?: MeetingOutcomeFollowThrough;
358
+ outcomeStatus?: "pending" | "completed";
359
+ outcomeNotificationStatus?: "pending" | "claimed" | "delivered";
360
+ providerStatusAt?: string;
361
+ createdAt: string;
362
+ updatedAt: string;
363
+ alreadyActive?: boolean;
364
+ }
365
+ export interface MeetingPreparation {
366
+ id: string;
367
+ title?: string;
368
+ startAt?: string;
369
+ endAt?: string;
370
+ status?: "prepared" | "auto_scheduled" | "cancelled" | "joined" | "expired";
371
+ meetingUrlAvailable?: boolean;
372
+ brief?: string;
373
+ briefStatus?: string;
374
+ createdAt: string;
375
+ updatedAt: string;
376
+ [key: string]: unknown;
377
+ }
378
+ export interface MeetingContact {
379
+ id: string;
380
+ meetingId?: string;
381
+ name?: string;
382
+ email?: string;
383
+ phone?: string;
384
+ preferredChannel?: string;
385
+ followUpAt?: string;
386
+ createdAt: string;
387
+ updatedAt: string;
388
+ [key: string]: unknown;
389
+ }
390
+ export interface MeetingsResponse {
391
+ preparations: MeetingPreparation[];
392
+ meetings: MeetingRecord[];
393
+ contacts: MeetingContact[];
394
+ }
395
+ export interface MeetingProfile {
396
+ enabled: boolean;
397
+ representativeName: string;
398
+ organizationName: string;
399
+ role: "sales" | "client_onboarding" | "employee_onboarding" | "customer_success" | "custom";
400
+ objective: string;
401
+ communicationStyle: string;
402
+ approvedKnowledge: string;
403
+ authorityBoundaries: string;
404
+ allowedComposioTools: string[];
405
+ composioAccountAliases: Record<string, string>;
406
+ allowedNativeTools: string[];
407
+ allowMeetingScheduling: boolean;
408
+ autoJoinCalendar: boolean;
409
+ updatedAt: number;
410
+ }
411
+ export interface MeetingBrief {
412
+ clientName: string;
413
+ objective?: string;
414
+ clientContext?: string;
415
+ }
416
+ export interface JoinMeetingParams {
417
+ meetingUrl: string;
418
+ title?: string;
419
+ joinAt?: string;
420
+ interactionMode?: MeetingInteractionMode;
421
+ analyzeScreenShare?: boolean;
422
+ transcriptRetentionDays?: 1 | 7 | 30;
423
+ clientName?: string;
424
+ objective?: string;
425
+ clientContext?: string;
426
+ }
427
+ export interface MeetingContext {
428
+ clientName?: string;
429
+ objective?: string;
430
+ businessFacts: string[];
431
+ relationshipFacts: string[];
432
+ note: string;
433
+ }
85
434
  export interface Thread {
86
435
  id: string;
87
436
  externalId?: string;
@@ -93,19 +442,38 @@ export interface CreateThreadParams {
93
442
  externalId?: string;
94
443
  metadata?: JsonObject;
95
444
  }
445
+ export interface RunArtifact {
446
+ id: string;
447
+ name: string;
448
+ type: Artifact["type"];
449
+ contentType: string;
450
+ size: number;
451
+ }
96
452
  export interface Run {
97
453
  id: string;
98
454
  threadId: string;
99
455
  status: "queued" | "running" | "requires_approval" | "completed" | "failed" | "cancelled";
100
456
  input: string;
457
+ agentId?: string;
458
+ agentName?: string;
101
459
  model?: string;
460
+ attachments?: Array<{
461
+ id: string;
462
+ name: string;
463
+ contentType: string;
464
+ size: number;
465
+ }>;
466
+ /** Generated file metadata. Download through the artifacts resource using this id. */
467
+ artifacts?: RunArtifact[];
102
468
  output?: string;
469
+ cost?: number;
103
470
  taskId?: string;
104
471
  approvalId?: string;
105
472
  metadata?: JsonObject;
106
473
  budget?: RunBudget;
107
474
  tools?: RunToolPolicy;
108
475
  skills?: string[];
476
+ events?: RunEvent[];
109
477
  error?: {
110
478
  code: string;
111
479
  message: string;
@@ -124,6 +492,34 @@ export interface CreateRunParams {
124
492
  skills?: string[];
125
493
  /** Wait for a terminal result. Use stream() for token-level progress. */
126
494
  wait?: boolean;
495
+ /** Saved company agent ID or one of the built-in template slugs. */
496
+ agentId?: string;
497
+ }
498
+ export interface CompanyAgentTemplate {
499
+ slug: string;
500
+ name: string;
501
+ outcome: string;
502
+ allowedTools: string[];
503
+ requireApproval: string[];
504
+ }
505
+ export interface CompanyAgent {
506
+ id: string;
507
+ name: string;
508
+ template: string;
509
+ instructions: string;
510
+ tools: RunToolPolicy;
511
+ budget: RunBudget;
512
+ createdAt: string;
513
+ updatedAt: string;
514
+ }
515
+ export interface CompanyAgentCreateParams {
516
+ template: string;
517
+ name?: string;
518
+ instructions?: string;
519
+ policy?: {
520
+ tools?: RunToolPolicy;
521
+ budget?: RunBudget;
522
+ };
127
523
  }
128
524
  export type DurationBudget = "5m" | "30m" | "1h" | "3h" | "6h" | "3d" | "1w";
129
525
  export interface RunBudget {
@@ -149,6 +545,11 @@ export interface Task {
149
545
  updatedAt: string;
150
546
  attempt?: number;
151
547
  maxAttempts?: number;
548
+ sdkRunId?: string;
549
+ sdkThreadId?: string;
550
+ sdkModel?: string;
551
+ sdkBudget?: RunBudget;
552
+ sdkSkills?: string[];
152
553
  events?: Array<{
153
554
  id: string;
154
555
  type: string;
@@ -157,16 +558,229 @@ export interface Task {
157
558
  attempt: number;
158
559
  }>;
159
560
  }
561
+ export interface MissionEvidence {
562
+ id: string;
563
+ kind: "source" | "tool_receipt" | "artifact" | "assertion" | "before_after" | "human_confirmation" | string;
564
+ summary: string;
565
+ source?: string;
566
+ ref?: string;
567
+ hash?: string;
568
+ verified: boolean;
569
+ verifiedAt?: number;
570
+ verifiedBy?: "agent" | "system" | "human";
571
+ }
572
+ export interface MissionStep {
573
+ id: string;
574
+ title: string;
575
+ objective: string;
576
+ status: "pending" | "running" | "completed" | "blocked" | "failed" | "cancelled" | string;
577
+ dependsOn: string[];
578
+ result?: string;
579
+ evidence?: MissionEvidence[];
580
+ evidenceRequired?: string[];
581
+ parallelGroup?: string;
582
+ taskId?: string;
583
+ attempts?: number;
584
+ retryLimit?: number;
585
+ input?: JsonObject;
586
+ outputSchema?: JsonObject;
587
+ compensationObjective?: string;
588
+ retryBackoffSeconds?: number;
589
+ updatedAt?: number;
590
+ }
591
+ export interface MissionVerification {
592
+ mode?: "legacy" | "strict";
593
+ requiredEvidence?: string[];
594
+ verified: boolean;
595
+ verifiedAt?: number;
596
+ verifiedBy?: "agent" | "system" | "human" | string;
597
+ confidence?: number;
598
+ unresolved?: string[];
599
+ evidenceIds?: string[];
600
+ reason?: string;
601
+ }
602
+ export interface Mission {
603
+ id: string;
604
+ title: string;
605
+ objective: string;
606
+ definitionOfDone: string;
607
+ status: "queued" | "running" | "waiting" | "paused" | "blocked" | "completed" | "failed" | "cancelled";
608
+ currentStepId?: string;
609
+ activeStepIds?: string[];
610
+ rootTaskId?: string;
611
+ checkpoint?: string;
612
+ nextAction?: string;
613
+ waiting?: {
614
+ kind: string;
615
+ key?: string;
616
+ stepId?: string;
617
+ provider?: string;
618
+ providerEventId?: string;
619
+ runAt?: number;
620
+ expiresAt?: number;
621
+ };
622
+ budget: {
623
+ maxDurationSeconds: number;
624
+ maxSteps: number;
625
+ maxToolCalls: number;
626
+ maxCost: number;
627
+ };
628
+ consumedSteps: number;
629
+ toolCalls: number;
630
+ cost: number;
631
+ steps: MissionStep[];
632
+ evidence?: MissionEvidence[];
633
+ verification?: MissionVerification;
634
+ events: Array<{
635
+ id: string;
636
+ type: string;
637
+ message: string;
638
+ at: number;
639
+ stepId?: string;
640
+ provider?: string;
641
+ providerEventId?: string;
642
+ }>;
643
+ result?: string;
644
+ error?: string;
645
+ startedAt?: number;
646
+ completedAt?: number;
647
+ version?: number;
648
+ createdAt: number;
649
+ updatedAt: number;
650
+ }
651
+ export interface MissionProof {
652
+ missionId: string;
653
+ objective: string;
654
+ definitionOfDone: string;
655
+ status: Mission["status"];
656
+ nextAction?: string;
657
+ checkpoint?: string;
658
+ budget: Mission["budget"] & {
659
+ consumedSteps?: number;
660
+ toolCalls?: number;
661
+ cost?: number;
662
+ };
663
+ verification?: MissionVerification;
664
+ steps: MissionStep[];
665
+ evidence: MissionEvidence[];
666
+ events: Mission["events"];
667
+ }
668
+ export interface MissionCreateParams {
669
+ title: string;
670
+ objective: string;
671
+ definitionOfDone: string;
672
+ steps?: Array<Partial<MissionStep> & {
673
+ title: string;
674
+ objective: string;
675
+ }>;
676
+ requiredEvidence?: string[];
677
+ verificationMode?: "legacy" | "strict";
678
+ maxDurationSeconds?: number;
679
+ maxSteps?: number;
680
+ maxToolCalls?: number;
681
+ maxCost?: number;
682
+ }
683
+ export interface ContextNode {
684
+ id: string;
685
+ scope: string;
686
+ scopeId?: string;
687
+ kind: string;
688
+ key: string;
689
+ value: string;
690
+ source?: string;
691
+ sourceRef?: string;
692
+ confidence: number;
693
+ sensitivity: "normal" | "sensitive";
694
+ tags?: string[];
695
+ reviewAt?: number;
696
+ expiresAt?: number;
697
+ createdAt: number;
698
+ updatedAt: number;
699
+ }
700
+ export interface DepartmentCatalogItem {
701
+ slug: string;
702
+ name: string;
703
+ worker: string;
704
+ objective: string;
705
+ }
706
+ export interface DepartmentSpace {
707
+ id: string;
708
+ department: string;
709
+ name: string;
710
+ mission?: string;
711
+ objectives: string[];
712
+ policies: string[];
713
+ approvedTools: string[];
714
+ escalationOwner?: string;
715
+ contextNodeIds?: string[];
716
+ activeMissionIds?: string[];
717
+ decisionNodeIds?: string[];
718
+ budget?: JsonObject;
719
+ createdAt: number;
720
+ updatedAt: number;
721
+ }
722
+ export interface WorkPacket {
723
+ id: string;
724
+ department: string;
725
+ objective: string;
726
+ status: string;
727
+ fromAgent?: string;
728
+ toAgent?: string;
729
+ inputs?: JsonObject;
730
+ constraints?: string[];
731
+ outputSchema?: JsonObject;
732
+ deadline?: number;
733
+ approvalBoundary?: string;
734
+ evidenceRequired: string[];
735
+ result?: JsonObject;
736
+ evidence?: MissionEvidence[];
737
+ createdAt: number;
738
+ updatedAt: number;
739
+ }
740
+ export interface OutcomePackage {
741
+ slug: string;
742
+ name: string;
743
+ department: string;
744
+ description: string;
745
+ requiredInputs: string[];
746
+ allowedTools: string[];
747
+ successCriteria: string[];
748
+ evidenceRequired: string[];
749
+ escalationRules: string[];
750
+ approvalPolicy: "draft_only" | "approve_external_action" | "approve_every_write";
751
+ budget: Record<string, unknown>;
752
+ slaSeconds: number;
753
+ deliverable: string;
754
+ }
755
+ export interface OutcomePlan {
756
+ package: OutcomePackage;
757
+ missingInputs: string[];
758
+ objective: string;
759
+ definitionOfDone: string;
760
+ steps: Array<{
761
+ id: string;
762
+ title: string;
763
+ objective: string;
764
+ dependsOn?: string[];
765
+ evidenceRequired: string[];
766
+ }>;
767
+ }
160
768
  export interface Approval {
161
769
  id: string;
162
770
  status: "pending" | "approved" | "denied" | "consumed";
163
771
  toolSlug: string;
164
772
  args: JsonObject;
165
773
  expiresAt: string;
774
+ createdAt?: string;
166
775
  request?: string;
167
776
  channelProvider?: string;
168
777
  handoffId?: string;
169
778
  }
779
+ export interface ApprovalDecision {
780
+ id: string;
781
+ status: "denied" | "consumed";
782
+ text?: string;
783
+ }
170
784
  export interface Skill {
171
785
  name: string;
172
786
  description: string;
@@ -239,6 +853,7 @@ export interface ChannelConnection {
239
853
  verifiedAt: string;
240
854
  proactiveOptIn: boolean;
241
855
  }
856
+ export type LinkableChannelProvider = "slack" | "whatsapp" | "sendblue";
242
857
  export interface Activity {
243
858
  now: number;
244
859
  approvals: Approval[];