@majkapp/plugin-kit 1.2.0 → 1.2.1

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.
@@ -0,0 +1,979 @@
1
+ /**
2
+ * Type definitions for the Majk Interface
3
+ * These types define what's available to plugins via ctx.majk
4
+ *
5
+ * Extracted from majk app interface definitions without implementation dependencies
6
+ */
7
+ export type EntityId = string;
8
+ export type Unsubscribe = () => void;
9
+ export interface BaseEntity {
10
+ id: EntityId;
11
+ createdAt: Date;
12
+ updatedAt: Date;
13
+ version: number;
14
+ }
15
+ export type StandardEventType = 'created' | 'updated' | 'deleted';
16
+ export type PluginEventType = 'installing' | 'installed' | 'install_failed' | 'starting' | 'started' | 'start_failed' | 'stopping' | 'stopped' | 'stop_failed' | 'uninstalling' | 'uninstalled' | 'uninstall_failed' | 'reloading' | 'reloaded' | 'reload_failed' | 'enabling' | 'enabled' | 'disabling' | 'disabled';
17
+ export type RepositoryEventType = StandardEventType | PluginEventType;
18
+ export type EntityType = 'message' | 'conversation' | 'agent' | 'tool' | 'project' | 'mcpServer' | 'event' | 'execution' | 'toolGeneration' | 'archivedConversation' | 'teamMember' | 'prompt' | 'workflow' | 'integration' | 'credential' | 'variable' | 'file' | 'workspace' | 'task' | 'notebook' | 'collection' | 'todo' | 'setting' | 'template' | 'snippet' | string;
19
+ export interface RepositoryEvent<T = any> {
20
+ type: RepositoryEventType;
21
+ entityType: EntityType;
22
+ entity: T;
23
+ timestamp: Date;
24
+ metadata?: {
25
+ source?: string;
26
+ operationId?: string;
27
+ userId?: string;
28
+ conversationId?: string;
29
+ [key: string]: any;
30
+ };
31
+ }
32
+ export interface EventFilter<T = any> {
33
+ entityType?: EntityType | EntityType[];
34
+ eventType?: RepositoryEventType | RepositoryEventType[];
35
+ entityId?: EntityId | EntityId[];
36
+ predicate?: (event: RepositoryEvent<T>) => boolean;
37
+ metadata?: {
38
+ [key: string]: any;
39
+ };
40
+ }
41
+ export type EventListener<T = any> = (event: RepositoryEvent<T>) => void | Promise<void>;
42
+ export interface Subscription {
43
+ unsubscribe: () => void;
44
+ id: string;
45
+ filter?: EventFilter<any> | 'ALL_EVENTS';
46
+ }
47
+ export interface QueryBuilder<T = any> {
48
+ whereType(eventType: RepositoryEventType): QueryBuilder<T>;
49
+ where(predicate: (event: RepositoryEvent<T>) => boolean): QueryBuilder<T>;
50
+ subscribe(listener: EventListener<T>): Subscription;
51
+ }
52
+ export interface QueryableEventChannel<T = any> {
53
+ query(): QueryBuilder<T>;
54
+ onCreated(listener: (entity: T) => void | Promise<void>): Subscription;
55
+ onUpdated(listener: (entity: T) => void | Promise<void>): Subscription;
56
+ onDeleted(listener: (entity: T) => void | Promise<void>): Subscription;
57
+ subscribe(listener: EventListener<T>, filter?: EventFilter<T>): Subscription;
58
+ }
59
+ export interface EventBusAPI {
60
+ messages<T = any>(): QueryableEventChannel<T>;
61
+ conversations<T = any>(): QueryableEventChannel<T>;
62
+ agents<T = any>(): QueryableEventChannel<T>;
63
+ tools<T = any>(): QueryableEventChannel<T>;
64
+ projects<T = any>(): QueryableEventChannel<T>;
65
+ mcpServers<T = any>(): QueryableEventChannel<T>;
66
+ integrations<T = any>(): QueryableEventChannel<T>;
67
+ todos<T = any>(): QueryableEventChannel<T>;
68
+ channel<T = any>(entityType: string): QueryableEventChannel<T>;
69
+ subscribe<T = any>(listener: EventListener<T>, filter?: EventFilter<T>): Subscription;
70
+ subscribeAll<T = any>(listener: (event: RepositoryEvent<T>) => void): Subscription;
71
+ getDiagnostics(): {
72
+ channels: string[];
73
+ stats: {
74
+ eventsEmitted: Record<string, number>;
75
+ listenersRegistered: Record<string, number>;
76
+ };
77
+ listeners: Array<{
78
+ entityType: string;
79
+ count: number;
80
+ }>;
81
+ lastEventTime?: Date;
82
+ };
83
+ }
84
+ export interface PluginInfo {
85
+ id: string;
86
+ name: string;
87
+ version: string;
88
+ description?: string;
89
+ author?: string;
90
+ type: 'in-process' | 'external-process';
91
+ enabled: boolean;
92
+ running: boolean;
93
+ root: string;
94
+ health?: PluginHealth;
95
+ hotReloadEnabled?: boolean;
96
+ }
97
+ export interface PluginHealth {
98
+ healthy: boolean;
99
+ errors?: string[];
100
+ warnings?: string[];
101
+ lastChecked?: Date;
102
+ }
103
+ export interface PluginCapabilityInfo {
104
+ type: string;
105
+ data: any;
106
+ }
107
+ export interface PluginLog {
108
+ timestamp: Date;
109
+ level: 'debug' | 'info' | 'warn' | 'error' | 'system' | 'stdout' | 'stderr';
110
+ message: string;
111
+ args?: any[];
112
+ }
113
+ export interface InstallPluginOptions {
114
+ ignoreScripts?: boolean;
115
+ enableOnInstall?: boolean;
116
+ startOnInstall?: boolean;
117
+ }
118
+ export interface InstallPluginResult {
119
+ pluginId: string;
120
+ version: string;
121
+ root: string;
122
+ }
123
+ export interface GetLogsOptions {
124
+ level?: 'debug' | 'info' | 'warn' | 'error' | 'system' | 'stdout' | 'stderr';
125
+ since?: Date;
126
+ limit?: number;
127
+ }
128
+ export interface PluginManagementAPI {
129
+ install(identifier: string, options?: InstallPluginOptions): Promise<InstallPluginResult>;
130
+ uninstall(pluginId: string): Promise<boolean>;
131
+ list(): Promise<PluginInfo[]>;
132
+ get(pluginId: string): Promise<PluginInfo | null>;
133
+ start(pluginId: string): Promise<void>;
134
+ stop(pluginId: string): Promise<void>;
135
+ restart(pluginId: string): Promise<void>;
136
+ reload(pluginId: string): Promise<void>;
137
+ enable(pluginId: string): Promise<void>;
138
+ disable(pluginId: string): Promise<void>;
139
+ isRunning(pluginId: string): boolean;
140
+ getHealth(pluginId: string): Promise<PluginHealth | null>;
141
+ getCapabilities(pluginId: string): Promise<PluginCapabilityInfo[]>;
142
+ getLogs(pluginId: string, options?: GetLogsOptions): Promise<PluginLog[]>;
143
+ clearLogs(pluginId: string): Promise<void>;
144
+ setHotReload(pluginId: string, enabled: boolean): Promise<void>;
145
+ isHotReloadEnabled(pluginId: string): Promise<boolean>;
146
+ }
147
+ export interface SecretScope {
148
+ type: 'global' | 'project' | 'integration';
149
+ id?: string;
150
+ }
151
+ export interface SecretInfo {
152
+ key: string;
153
+ scope: SecretScope;
154
+ description?: string;
155
+ createdAt: Date;
156
+ updatedAt: Date;
157
+ lastUsedAt?: Date;
158
+ tags?: string[];
159
+ }
160
+ export interface ScopedSecretsAPI {
161
+ set(key: string, value: string): Promise<void>;
162
+ get(key: string): Promise<string | null>;
163
+ has(key: string): Promise<boolean>;
164
+ list(): Promise<string[]>;
165
+ delete(key: string): Promise<boolean>;
166
+ }
167
+ export interface SecretsAPI {
168
+ set(key: string, value: string, scope?: SecretScope): Promise<void>;
169
+ get(key: string, scope?: SecretScope): Promise<string | null>;
170
+ has(key: string, scope?: SecretScope): Promise<boolean>;
171
+ list(scope?: SecretScope): Promise<SecretInfo[]>;
172
+ delete(key: string, scope?: SecretScope): Promise<boolean>;
173
+ forProject(projectId: string): ScopedSecretsAPI;
174
+ forIntegration(integrationId: string): ScopedSecretsAPI;
175
+ }
176
+ export interface StartTaskRequest {
177
+ title: string;
178
+ message: string;
179
+ agentId?: string;
180
+ teamMemberId?: string;
181
+ workingDirectory?: string;
182
+ context?: Record<string, any>;
183
+ triggerImmediately?: boolean;
184
+ taskType?: 'code-project' | 'automation' | 'analysis' | 'chat' | 'research';
185
+ }
186
+ export interface TaskFilter {
187
+ status?: 'pending' | 'running' | 'completed' | 'failed';
188
+ agentId?: string;
189
+ teamMemberId?: string;
190
+ startedAfter?: Date;
191
+ startedBefore?: Date;
192
+ }
193
+ export interface TaskMessage {
194
+ role: 'user' | 'assistant' | 'tool' | 'system';
195
+ content: string;
196
+ timestamp: Date;
197
+ seq: number;
198
+ }
199
+ export interface TaskProgress {
200
+ stage?: string;
201
+ message?: string;
202
+ percentage?: number;
203
+ messageCount?: number;
204
+ toolCall?: {
205
+ name: string;
206
+ status: string;
207
+ };
208
+ }
209
+ export interface TaskResult {
210
+ success: boolean;
211
+ output?: any;
212
+ error?: string;
213
+ conversationId?: string;
214
+ duration?: number;
215
+ }
216
+ export interface TaskError {
217
+ code: string;
218
+ message: string;
219
+ details?: any;
220
+ }
221
+ export interface TaskHandle {
222
+ readonly id: string;
223
+ readonly conversationId: string;
224
+ readonly title: string;
225
+ readonly status: 'pending' | 'running' | 'completed' | 'failed';
226
+ readonly agentId: string;
227
+ readonly teamMemberId?: string;
228
+ readonly startedAt: Date;
229
+ readonly completedAt?: Date;
230
+ send(message: string): Promise<void>;
231
+ waitForCompletion(timeout?: number): Promise<TaskResult>;
232
+ stop(): Promise<void>;
233
+ onMessage(handler: (message: TaskMessage) => void): Unsubscribe;
234
+ onProgress(handler: (progress: TaskProgress) => void): Unsubscribe;
235
+ onComplete(handler: (result: TaskResult) => void): Unsubscribe;
236
+ onError(handler: (error: TaskError) => void): Unsubscribe;
237
+ getMessages(): Promise<TaskMessage[]>;
238
+ getConversation(): Promise<any>;
239
+ }
240
+ export type TaskEventHandler = (event: TaskEvent) => void;
241
+ export interface TaskEvent {
242
+ taskId: string;
243
+ conversationId: string;
244
+ agentId: string;
245
+ timestamp: Date;
246
+ }
247
+ export interface TaskAPI {
248
+ start(request: StartTaskRequest): Promise<TaskHandle>;
249
+ get(taskId: string): Promise<TaskHandle | null>;
250
+ list(filter?: TaskFilter): Promise<TaskHandle[]>;
251
+ onTaskStarted(handler: TaskEventHandler): Unsubscribe;
252
+ onTaskCompleted(handler: TaskEventHandler): Unsubscribe;
253
+ onTaskFailed(handler: TaskEventHandler): Unsubscribe;
254
+ }
255
+ export type AccountType = 'aws-cognito' | 'azure-entra' | 'gcp-iam' | 'api-key' | 'system-default' | string;
256
+ export interface AccountMetadata {
257
+ region?: string;
258
+ createdAt: Date;
259
+ lastUsedAt?: Date;
260
+ [key: string]: any;
261
+ }
262
+ export interface TimeWindow {
263
+ milliseconds?: number;
264
+ seconds?: number;
265
+ minutes?: number;
266
+ hours?: number;
267
+ }
268
+ export interface CredentialOptions {
269
+ forceRefresh?: boolean;
270
+ purpose?: string;
271
+ timeout?: number;
272
+ }
273
+ export interface RefreshOptions {
274
+ force?: boolean;
275
+ }
276
+ export interface RefreshResult {
277
+ success: boolean;
278
+ expiresAt?: Date;
279
+ error?: string;
280
+ }
281
+ export interface ValidationResult {
282
+ valid: boolean;
283
+ reason?: string;
284
+ details?: any;
285
+ }
286
+ export interface TokenInfo {
287
+ expiresAt: Date;
288
+ issuedAt: Date;
289
+ timeUntilExpiry: number;
290
+ isExpired: boolean;
291
+ scopes?: string[];
292
+ }
293
+ export interface AutoRefreshConfig {
294
+ beforeExpiry: TimeWindow;
295
+ onRefresh?: (result: RefreshResult) => void;
296
+ onError?: (error: Error) => void;
297
+ }
298
+ export interface AutoRefreshHandle {
299
+ stop(): void;
300
+ isActive(): boolean;
301
+ refresh(): Promise<RefreshResult>;
302
+ }
303
+ export interface AwsSdkCredentials {
304
+ accessKeyId: string;
305
+ secretAccessKey: string;
306
+ sessionToken: string;
307
+ expiration?: Date;
308
+ }
309
+ export interface CognitoTokenSet {
310
+ idToken: string;
311
+ accessToken: string;
312
+ refreshToken: string;
313
+ expiresAt: Date;
314
+ }
315
+ export interface AzureSdkCredentials {
316
+ accessToken: string;
317
+ subscriptionId: string;
318
+ tenantId: string;
319
+ expiration?: Date;
320
+ }
321
+ export interface AccountJSON {
322
+ id: string;
323
+ name: string;
324
+ type: AccountType;
325
+ expiresAt?: string;
326
+ metadata: AccountMetadata;
327
+ }
328
+ interface BaseCredentials {
329
+ accountType: AccountType;
330
+ accountId: string;
331
+ expiresAt?: Date;
332
+ metadata: {
333
+ issuedAt: Date;
334
+ region?: string;
335
+ [key: string]: any;
336
+ };
337
+ }
338
+ export interface AwsCognitoCredentials extends BaseCredentials {
339
+ accountType: 'aws-cognito';
340
+ bearerToken: string;
341
+ aws: {
342
+ accessKeyId: string;
343
+ secretAccessKey: string;
344
+ sessionToken: string;
345
+ region: string;
346
+ };
347
+ cognito: {
348
+ idToken: string;
349
+ accessToken: string;
350
+ refreshToken: string;
351
+ };
352
+ }
353
+ export interface AzureEntraCredentials extends BaseCredentials {
354
+ accountType: 'azure-entra';
355
+ bearerToken: string;
356
+ azure: {
357
+ accessToken: string;
358
+ subscriptionId: string;
359
+ tenantId: string;
360
+ region: string;
361
+ };
362
+ }
363
+ export interface ApiKeyCredentials extends BaseCredentials {
364
+ accountType: 'api-key';
365
+ apiKey: string;
366
+ baseUrl?: string;
367
+ }
368
+ export interface SystemDefaultCredentials extends BaseCredentials {
369
+ accountType: 'system-default';
370
+ }
371
+ export type Credentials = AwsCognitoCredentials | AzureEntraCredentials | ApiKeyCredentials | SystemDefaultCredentials;
372
+ export interface SystemAccount {
373
+ readonly id: string;
374
+ readonly name: string;
375
+ readonly type: AccountType;
376
+ readonly expiresAt?: Date;
377
+ readonly metadata: AccountMetadata;
378
+ getCredentials(options?: CredentialOptions): Promise<Credentials>;
379
+ isValid(): Promise<boolean>;
380
+ isExpired(): boolean;
381
+ isExpiringSoon(window?: TimeWindow): boolean;
382
+ isOAuthAccount(): this is OAuthAccount;
383
+ isAwsAccount(): this is AwsAccount;
384
+ isAzureAccount(): this is AzureAccount;
385
+ toJSON(): AccountJSON;
386
+ }
387
+ export interface OAuthAccount extends SystemAccount {
388
+ refresh(options?: RefreshOptions): Promise<RefreshResult>;
389
+ validate(): Promise<ValidationResult>;
390
+ getTokenInfo(): Promise<TokenInfo>;
391
+ autoRefresh(config: AutoRefreshConfig): AutoRefreshHandle;
392
+ }
393
+ export interface AwsAccount extends OAuthAccount {
394
+ type: 'aws-cognito';
395
+ getRegion(): string;
396
+ getBedrockToken(): Promise<string>;
397
+ getAwsCredentials(): Promise<AwsSdkCredentials>;
398
+ getCognitoTokens(): Promise<CognitoTokenSet>;
399
+ }
400
+ export interface AzureAccount extends OAuthAccount {
401
+ type: 'azure-entra';
402
+ getRegion(): string;
403
+ getAzureToken(): Promise<string>;
404
+ getAzureCredentials(): Promise<AzureSdkCredentials>;
405
+ }
406
+ export type AuthEvent = AuthStateChangeEvent | AuthTokenRefreshedEvent | AuthErrorEvent | AccountChangedEvent;
407
+ export interface AuthStateChangeEvent {
408
+ type: 'auth:state-changed';
409
+ isAuthenticated: boolean;
410
+ accountId?: string;
411
+ accountType?: AccountType;
412
+ timestamp: Date;
413
+ }
414
+ export interface AuthTokenRefreshedEvent {
415
+ type: 'auth:token-refreshed';
416
+ accountId: string;
417
+ expiresAt: Date;
418
+ timestamp: Date;
419
+ }
420
+ export interface AuthErrorEvent {
421
+ type: 'auth:error';
422
+ error: string;
423
+ accountId?: string;
424
+ timestamp: Date;
425
+ }
426
+ export interface AccountChangedEvent {
427
+ type: 'auth:account-changed';
428
+ action: 'added' | 'removed' | 'updated' | 'selected';
429
+ accountId: string;
430
+ accountType: AccountType;
431
+ timestamp: Date;
432
+ }
433
+ export interface AuthAPI {
434
+ getAccount(): Promise<SystemAccount | null>;
435
+ getAccountsOfType(type: AccountType | '*'): Promise<SystemAccount[]>;
436
+ getCredentials(options?: CredentialOptions): Promise<Credentials>;
437
+ isAuthenticated(): Promise<boolean>;
438
+ }
439
+ export interface Message extends BaseEntity {
440
+ conversationId: string;
441
+ role: 'user' | 'assistant' | 'tool' | 'system';
442
+ content: string;
443
+ seq: number;
444
+ }
445
+ export interface Conversation extends BaseEntity {
446
+ agentId: string;
447
+ title: string;
448
+ status: 'active' | 'completed' | 'failed' | 'cancelled';
449
+ messageCount: number;
450
+ lastMessageAt?: Date;
451
+ workingDirectory?: string;
452
+ projectId?: string;
453
+ teamMemberId?: string;
454
+ startedAt?: Date;
455
+ endedAt?: Date;
456
+ completion?: any;
457
+ metadata?: Record<string, any>;
458
+ }
459
+ export interface Agent extends BaseEntity {
460
+ name: string;
461
+ description: string;
462
+ systemPrompt: string;
463
+ model: string;
464
+ temperature?: number;
465
+ maxTokens?: number;
466
+ mcpServerIds: string[];
467
+ isActive: boolean;
468
+ tags: string[];
469
+ configuration?: {
470
+ streaming?: boolean;
471
+ timeout?: number;
472
+ retryAttempts?: number;
473
+ rateLimiting?: {
474
+ requestsPerMinute?: number;
475
+ tokensPerMinute?: number;
476
+ };
477
+ customHeaders?: Record<string, string>;
478
+ };
479
+ }
480
+ export interface TeamMemberSkills {
481
+ primary: string[];
482
+ secondary: string[];
483
+ languages: string[];
484
+ frameworks: string[];
485
+ tools: string[];
486
+ }
487
+ export interface TeamMemberPersonality {
488
+ workStyle?: string;
489
+ codeStyle?: string;
490
+ reviewStyle?: string;
491
+ communicationStyle?: string;
492
+ }
493
+ export interface TeamMemberCodeStats {
494
+ linesWritten: number;
495
+ filesModified: number;
496
+ testsWritten: number;
497
+ reviewsPassed: number;
498
+ commitsCreated: number;
499
+ }
500
+ export interface TeamMemberMetadata {
501
+ totalTasks: number;
502
+ successfulTasks: number;
503
+ projectHistory: string[];
504
+ codeStats: TeamMemberCodeStats;
505
+ [key: string]: any;
506
+ }
507
+ export interface TeamMember extends BaseEntity {
508
+ name: string;
509
+ role: string;
510
+ skills: TeamMemberSkills;
511
+ systemPrompt?: string;
512
+ model?: string;
513
+ mcpServerIds: string[];
514
+ projectIds: string[];
515
+ isActive: boolean;
516
+ personality: TeamMemberPersonality;
517
+ expertise: string[];
518
+ metadata: TeamMemberMetadata;
519
+ avatar?: string;
520
+ title?: string;
521
+ tags?: string[];
522
+ }
523
+ export interface Todo extends BaseEntity {
524
+ title: string;
525
+ description?: string;
526
+ status: 'pending' | 'active' | 'completed';
527
+ priority: 'low' | 'medium' | 'high';
528
+ assignedTo?: string;
529
+ projectId?: string;
530
+ conversationIds: string[];
531
+ metadata?: Record<string, any>;
532
+ }
533
+ export type WorkStrategy = 'autonomous' | 'collaborative' | 'supervised' | 'manual' | string;
534
+ export interface Project extends BaseEntity {
535
+ name: string;
536
+ description?: string;
537
+ path: string;
538
+ workStrategy: WorkStrategy;
539
+ teamMemberIds: string[];
540
+ }
541
+ export interface MCPServer extends BaseEntity {
542
+ name: string;
543
+ description?: string;
544
+ type: 'local' | 'remote' | 'docker';
545
+ status: string;
546
+ connectionConfig: any;
547
+ toolIds: string[];
548
+ }
549
+ export interface ConversationFilter {
550
+ status?: 'active' | 'completed' | 'failed' | 'cancelled';
551
+ agentId?: string;
552
+ projectId?: string;
553
+ teamMemberId?: string;
554
+ createdAfter?: Date;
555
+ createdBefore?: Date;
556
+ }
557
+ export interface MessageQueryOptions {
558
+ limit?: number;
559
+ beforeSeq?: number;
560
+ afterSeq?: number;
561
+ }
562
+ export interface ConversationHandle {
563
+ readonly id: string;
564
+ readonly agentId: string;
565
+ readonly title: string;
566
+ readonly status: 'active' | 'completed' | 'failed' | 'cancelled';
567
+ readonly messageCount: number;
568
+ readonly lastMessageAt?: Date;
569
+ readonly workingDirectory?: string;
570
+ readonly projectId?: string;
571
+ readonly teamMemberId?: string;
572
+ readonly createdAt: Date;
573
+ readonly updatedAt: Date;
574
+ readonly version: number;
575
+ refresh(): Promise<void>;
576
+ getMessages(options?: MessageQueryOptions): Promise<Message[]>;
577
+ send(message: string): Promise<void>;
578
+ getAgent(): Promise<any>;
579
+ onChange(handler: (entity: Conversation) => void): Unsubscribe;
580
+ onDelete(handler: () => void): Unsubscribe;
581
+ toEntity(): Conversation;
582
+ }
583
+ export interface ConversationAPI {
584
+ get(id: string): Promise<ConversationHandle | null>;
585
+ list(filter?: ConversationFilter): Promise<ConversationHandle[]>;
586
+ exists(id: string): Promise<boolean>;
587
+ count(filter?: ConversationFilter): Promise<number>;
588
+ search(query: string): Promise<ConversationHandle[]>;
589
+ channel(): any;
590
+ }
591
+ export interface CreateTeammateRequest {
592
+ name: string;
593
+ role: string;
594
+ skills?: TeamMemberSkills;
595
+ systemPrompt?: string;
596
+ model?: string;
597
+ mcpServerIds?: string[];
598
+ personality?: TeamMemberPersonality;
599
+ expertise?: string[];
600
+ metadata?: Partial<TeamMemberMetadata>;
601
+ avatar?: string;
602
+ title?: string;
603
+ tags?: string[];
604
+ }
605
+ export interface TeammateUpdate {
606
+ name?: string;
607
+ role?: string;
608
+ skills?: TeamMemberSkills;
609
+ systemPrompt?: string;
610
+ model?: string;
611
+ mcpServerIds?: string[];
612
+ isActive?: boolean;
613
+ personality?: TeamMemberPersonality;
614
+ expertise?: string[];
615
+ metadata?: Partial<TeamMemberMetadata>;
616
+ avatar?: string;
617
+ title?: string;
618
+ tags?: string[];
619
+ }
620
+ export interface TeammateFilter {
621
+ role?: string;
622
+ isActive?: boolean;
623
+ projectId?: string;
624
+ }
625
+ export interface TeammateHandle {
626
+ readonly id: string;
627
+ readonly name: string;
628
+ readonly role: string;
629
+ readonly skills: TeamMemberSkills;
630
+ readonly systemPrompt?: string;
631
+ readonly model?: string;
632
+ readonly mcpServerIds: string[];
633
+ readonly projectIds: string[];
634
+ readonly isActive: boolean;
635
+ readonly personality: TeamMemberPersonality;
636
+ readonly expertise: string[];
637
+ readonly metadata: TeamMemberMetadata;
638
+ readonly avatar?: string;
639
+ readonly title?: string;
640
+ readonly tags?: string[];
641
+ readonly createdAt: Date;
642
+ readonly updatedAt: Date;
643
+ readonly version: number;
644
+ refresh(): Promise<void>;
645
+ update(updates: Partial<TeamMember>): Promise<void>;
646
+ delete(): Promise<boolean>;
647
+ assignToProject(projectId: string): Promise<void>;
648
+ unassignFromProject(projectId: string): Promise<void>;
649
+ getProjects(): Promise<any[]>;
650
+ onChange(handler: (entity: TeamMember) => void): Unsubscribe;
651
+ onDelete(handler: () => void): Unsubscribe;
652
+ toEntity(): TeamMember;
653
+ }
654
+ export interface TeammateAPI {
655
+ create(data: CreateTeammateRequest): Promise<TeammateHandle>;
656
+ get(id: string): Promise<TeammateHandle | null>;
657
+ list(filter?: TeammateFilter): Promise<TeammateHandle[]>;
658
+ update(id: string, updates: TeammateUpdate): Promise<TeammateHandle>;
659
+ delete(id: string): Promise<boolean>;
660
+ exists(id: string): Promise<boolean>;
661
+ count(filter?: TeammateFilter): Promise<number>;
662
+ channel(): any;
663
+ }
664
+ export interface CreateTodoRequest {
665
+ title: string;
666
+ description?: string;
667
+ status?: 'pending' | 'active' | 'completed';
668
+ priority?: 'low' | 'medium' | 'high';
669
+ assignedTo?: string;
670
+ projectId?: string;
671
+ metadata?: Record<string, any>;
672
+ }
673
+ export interface TodoUpdate {
674
+ title?: string;
675
+ description?: string;
676
+ status?: 'pending' | 'active' | 'completed';
677
+ priority?: 'low' | 'medium' | 'high';
678
+ assignedTo?: string;
679
+ projectId?: string;
680
+ metadata?: Record<string, any>;
681
+ }
682
+ export interface TodoFilter {
683
+ status?: 'pending' | 'active' | 'completed';
684
+ priority?: 'low' | 'medium' | 'high';
685
+ assignedTo?: string;
686
+ projectId?: string;
687
+ }
688
+ export interface SpawnOptions {
689
+ message?: string;
690
+ agentId?: string;
691
+ triggerImmediately?: boolean;
692
+ }
693
+ export interface TodoHandle {
694
+ readonly id: string;
695
+ readonly title: string;
696
+ readonly description?: string;
697
+ readonly status: 'pending' | 'active' | 'completed';
698
+ readonly priority: 'low' | 'medium' | 'high';
699
+ readonly assignedTo?: string;
700
+ readonly projectId?: string;
701
+ readonly conversationIds: string[];
702
+ readonly metadata?: Record<string, any>;
703
+ readonly createdAt: Date;
704
+ readonly updatedAt: Date;
705
+ readonly version: number;
706
+ refresh(): Promise<void>;
707
+ update(updates: Partial<Todo>): Promise<void>;
708
+ delete(): Promise<boolean>;
709
+ complete(): Promise<void>;
710
+ assignTo(teammateId: string): Promise<void>;
711
+ linkToConversation(conversationId: string): Promise<void>;
712
+ spawn(options?: SpawnOptions): Promise<TaskHandle>;
713
+ onChange(handler: (entity: Todo) => void): Unsubscribe;
714
+ onDelete(handler: () => void): Unsubscribe;
715
+ toEntity(): Todo;
716
+ }
717
+ export interface TodoAPI {
718
+ create(data: CreateTodoRequest): Promise<TodoHandle>;
719
+ get(id: string): Promise<TodoHandle | null>;
720
+ list(filter?: TodoFilter): Promise<TodoHandle[]>;
721
+ update(id: string, updates: TodoUpdate): Promise<TodoHandle>;
722
+ delete(id: string): Promise<boolean>;
723
+ exists(id: string): Promise<boolean>;
724
+ count(filter?: TodoFilter): Promise<number>;
725
+ channel(): any;
726
+ }
727
+ export interface CreateProjectRequest {
728
+ name: string;
729
+ description?: string;
730
+ path: string;
731
+ workStrategy?: WorkStrategy;
732
+ teamMemberIds?: string[];
733
+ }
734
+ export interface ProjectUpdate {
735
+ name?: string;
736
+ description?: string;
737
+ path?: string;
738
+ workStrategy?: WorkStrategy;
739
+ teamMemberIds?: string[];
740
+ }
741
+ export interface ProjectFilter {
742
+ teamMemberId?: string;
743
+ }
744
+ export interface ProjectHandle {
745
+ readonly id: string;
746
+ readonly name: string;
747
+ readonly description?: string;
748
+ readonly path: string;
749
+ readonly workStrategy: WorkStrategy;
750
+ readonly teamMemberIds: string[];
751
+ readonly createdAt: Date;
752
+ readonly updatedAt: Date;
753
+ readonly version: number;
754
+ refresh(): Promise<void>;
755
+ update(updates: Partial<Project>): Promise<void>;
756
+ delete(): Promise<boolean>;
757
+ addTeammate(teammateId: string): Promise<void>;
758
+ removeTeammate(teammateId: string): Promise<void>;
759
+ getTeammates(): Promise<any[]>;
760
+ setWorkStrategy(strategy: WorkStrategy): Promise<void>;
761
+ onChange(handler: (entity: Project) => void): Unsubscribe;
762
+ onDelete(handler: () => void): Unsubscribe;
763
+ toEntity(): Project;
764
+ }
765
+ export interface ProjectAPI {
766
+ create(data: CreateProjectRequest): Promise<ProjectHandle>;
767
+ get(id: string): Promise<ProjectHandle | null>;
768
+ list(filter?: ProjectFilter): Promise<ProjectHandle[]>;
769
+ update(id: string, updates: ProjectUpdate): Promise<ProjectHandle>;
770
+ delete(id: string): Promise<boolean>;
771
+ exists(id: string): Promise<boolean>;
772
+ count(filter?: ProjectFilter): Promise<number>;
773
+ channel(): any;
774
+ }
775
+ export interface CreateMCPServerRequest {
776
+ name: string;
777
+ description?: string;
778
+ type: 'local' | 'remote' | 'docker';
779
+ connectionConfig: {
780
+ command?: string;
781
+ args?: string[];
782
+ env?: Record<string, string>;
783
+ workingDirectory?: string;
784
+ url?: string;
785
+ };
786
+ }
787
+ export interface MCPServerUpdate {
788
+ name?: string;
789
+ description?: string;
790
+ connectionConfig?: {
791
+ command?: string;
792
+ args?: string[];
793
+ env?: Record<string, string>;
794
+ workingDirectory?: string;
795
+ url?: string;
796
+ };
797
+ }
798
+ export interface MCPServerFilter {
799
+ type?: 'local' | 'remote' | 'docker';
800
+ status?: 'connected' | 'disconnected' | 'error';
801
+ }
802
+ export interface ConnectionTestResult {
803
+ success: boolean;
804
+ error?: string;
805
+ latency?: number;
806
+ }
807
+ export interface MCPServerHandle {
808
+ readonly id: string;
809
+ readonly name: string;
810
+ readonly description?: string;
811
+ readonly type: 'local' | 'remote' | 'docker';
812
+ readonly status: string;
813
+ readonly connectionConfig: any;
814
+ readonly toolIds: string[];
815
+ readonly createdAt: Date;
816
+ readonly updatedAt: Date;
817
+ readonly version: number;
818
+ refresh(): Promise<void>;
819
+ update(updates: Partial<MCPServer>): Promise<void>;
820
+ delete(): Promise<boolean>;
821
+ connect(): Promise<void>;
822
+ disconnect(): Promise<void>;
823
+ testConnection(): Promise<ConnectionTestResult>;
824
+ getTools(): Promise<any[]>;
825
+ onChange(handler: (entity: MCPServer) => void): Unsubscribe;
826
+ onDelete(handler: () => void): Unsubscribe;
827
+ toEntity(): MCPServer;
828
+ }
829
+ export interface MCPServerAPI {
830
+ create(data: CreateMCPServerRequest): Promise<MCPServerHandle>;
831
+ get(id: string): Promise<MCPServerHandle | null>;
832
+ list(filter?: MCPServerFilter): Promise<MCPServerHandle[]>;
833
+ update(id: string, updates: MCPServerUpdate): Promise<MCPServerHandle>;
834
+ delete(id: string): Promise<boolean>;
835
+ exists(id: string): Promise<boolean>;
836
+ count(filter?: MCPServerFilter): Promise<number>;
837
+ channel(): any;
838
+ }
839
+ export interface CreateAgentRequest {
840
+ name: string;
841
+ description?: string;
842
+ systemPrompt: string;
843
+ model: string;
844
+ temperature?: number;
845
+ maxTokens?: number;
846
+ mcpServerIds?: string[];
847
+ configuration?: {
848
+ streaming?: boolean;
849
+ timeout?: number;
850
+ retryAttempts?: number;
851
+ rateLimiting?: {
852
+ requestsPerMinute?: number;
853
+ tokensPerMinute?: number;
854
+ };
855
+ customHeaders?: Record<string, string>;
856
+ };
857
+ tags?: string[];
858
+ isActive?: boolean;
859
+ }
860
+ export interface AgentUpdate {
861
+ name?: string;
862
+ description?: string;
863
+ systemPrompt?: string;
864
+ model?: string;
865
+ temperature?: number;
866
+ maxTokens?: number;
867
+ mcpServerIds?: string[];
868
+ configuration?: {
869
+ streaming?: boolean;
870
+ timeout?: number;
871
+ retryAttempts?: number;
872
+ rateLimiting?: {
873
+ requestsPerMinute?: number;
874
+ tokensPerMinute?: number;
875
+ };
876
+ customHeaders?: Record<string, string>;
877
+ };
878
+ tags?: string[];
879
+ isActive?: boolean;
880
+ }
881
+ export interface AgentFilter {
882
+ isActive?: boolean;
883
+ model?: string;
884
+ tags?: string[];
885
+ }
886
+ export interface TestResult {
887
+ success: boolean;
888
+ response?: string;
889
+ error?: string;
890
+ duration?: number;
891
+ }
892
+ export interface AgentHandle {
893
+ readonly id: string;
894
+ readonly name: string;
895
+ readonly description: string;
896
+ readonly systemPrompt: string;
897
+ readonly model: string;
898
+ readonly temperature?: number;
899
+ readonly maxTokens?: number;
900
+ readonly mcpServerIds: string[];
901
+ readonly isActive: boolean;
902
+ readonly tags: string[];
903
+ readonly createdAt: Date;
904
+ readonly updatedAt: Date;
905
+ readonly version: number;
906
+ refresh(): Promise<void>;
907
+ update(updates: Partial<Agent>): Promise<void>;
908
+ delete(): Promise<boolean>;
909
+ test(message: string): Promise<TestResult>;
910
+ clone(modifications?: Partial<CreateAgentRequest>): Promise<AgentHandle>;
911
+ getMCPServers(): Promise<any[]>;
912
+ addMCPServer(serverId: string): Promise<void>;
913
+ removeMCPServer(serverId: string): Promise<void>;
914
+ onChange(handler: (entity: Agent) => void): Unsubscribe;
915
+ onDelete(handler: () => void): Unsubscribe;
916
+ toEntity(): Agent;
917
+ }
918
+ export interface AgentAPI {
919
+ create(data: CreateAgentRequest): Promise<AgentHandle>;
920
+ get(id: string): Promise<AgentHandle | null>;
921
+ list(filter?: AgentFilter): Promise<AgentHandle[]>;
922
+ update(id: string, updates: AgentUpdate): Promise<AgentHandle>;
923
+ delete(id: string): Promise<boolean>;
924
+ exists(id: string): Promise<boolean>;
925
+ count(filter?: AgentFilter): Promise<number>;
926
+ test(agentId: string, message: string): Promise<TestResult>;
927
+ clone(agentId: string, modifications?: Partial<CreateAgentRequest>): Promise<AgentHandle>;
928
+ channel(): any;
929
+ }
930
+ export interface AddKnowledgeInput {
931
+ conversationId: string;
932
+ title: string;
933
+ content: string;
934
+ references?: string[];
935
+ tree?: string;
936
+ }
937
+ export interface KnowledgeNode {
938
+ id: string;
939
+ title: string;
940
+ content: string;
941
+ references: string[];
942
+ conversationId: string;
943
+ tree: string;
944
+ createdAt: Date;
945
+ }
946
+ export interface KnowledgeTree {
947
+ name: string;
948
+ conversationId: string;
949
+ nodes: KnowledgeNode[];
950
+ }
951
+ export interface KnowledgeSearchOptions {
952
+ conversationId?: string;
953
+ tree?: string;
954
+ limit?: number;
955
+ }
956
+ export interface KnowledgeAPI {
957
+ add(input: AddKnowledgeInput): Promise<void>;
958
+ search(query: string, options?: KnowledgeSearchOptions): Promise<KnowledgeNode[]>;
959
+ getByReference(ref: string): Promise<KnowledgeNode[]>;
960
+ getTree(conversationId: string, treeName: string): Promise<KnowledgeTree>;
961
+ listTrees(conversationId: string): Promise<string[]>;
962
+ }
963
+ export interface MajkInterface {
964
+ readonly version: string;
965
+ readonly plugins: PluginManagementAPI;
966
+ readonly secrets: SecretsAPI;
967
+ readonly tasks: TaskAPI;
968
+ readonly eventBus: EventBusAPI;
969
+ readonly auth: AuthAPI;
970
+ readonly conversations: ConversationAPI;
971
+ readonly todos: TodoAPI;
972
+ readonly projects: ProjectAPI;
973
+ readonly teammates: TeammateAPI;
974
+ readonly mcpServers: MCPServerAPI;
975
+ readonly knowledge: KnowledgeAPI;
976
+ readonly agents: AgentAPI;
977
+ }
978
+ export {};
979
+ //# sourceMappingURL=majk-interface-types.d.ts.map