@actant/shared 0.1.2

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,1096 @@
1
+ import pino from 'pino';
2
+
3
+ interface DomainContextConfig {
4
+ skills?: string[];
5
+ prompts?: string[];
6
+ mcpServers?: McpServerRef[];
7
+ workflow?: string;
8
+ subAgents?: string[];
9
+ plugins?: string[];
10
+ /** Extension point for custom component types (#54). */
11
+ extensions?: Record<string, unknown[]>;
12
+ }
13
+ interface McpServerRef {
14
+ name: string;
15
+ command: string;
16
+ args?: string[];
17
+ env?: Record<string, string>;
18
+ }
19
+
20
+ /**
21
+ * Domain Context Component definitions.
22
+ * These are the resolved, concrete forms of components referenced by name in templates.
23
+ */
24
+ /** Tracks where a component came from. */
25
+ type ComponentOriginType = "builtin" | "source" | "local";
26
+ interface ComponentOrigin {
27
+ type: ComponentOriginType;
28
+ /** For source-originated components: the source package name */
29
+ sourceName?: string;
30
+ /** Hash at the time of last sync */
31
+ syncHash?: string;
32
+ syncedAt?: string;
33
+ /** Whether the user has locally modified the synced copy */
34
+ modified?: boolean;
35
+ }
36
+ /**
37
+ * Base interface for all shareable components.
38
+ * All component types extend this to get version tracking and origin metadata.
39
+ */
40
+ interface VersionedComponent {
41
+ name: string;
42
+ /** Semver version string. Optional for backward compatibility; unset defaults to "0.0.0". */
43
+ version?: string;
44
+ description?: string;
45
+ /** Component type discriminator for manifest.json envelope (#58) */
46
+ $type?: string;
47
+ /** Manifest schema version (#58) */
48
+ $version?: number;
49
+ /** Tracks where this component originated from */
50
+ origin?: ComponentOrigin;
51
+ tags?: string[];
52
+ }
53
+ /** A Skill = a set of rules/knowledge an Agent should follow. */
54
+ interface SkillDefinition extends VersionedComponent {
55
+ /** The actual skill content (markdown/text rules) */
56
+ content: string;
57
+ }
58
+ /** A Prompt = a system prompt or instruction set. */
59
+ interface PromptDefinition extends VersionedComponent {
60
+ /** The prompt content, may contain {{variable}} placeholders */
61
+ content: string;
62
+ /** Variable names expected in the content */
63
+ variables?: string[];
64
+ }
65
+ /** A Workflow = a development workflow template (directory-based). */
66
+ interface WorkflowDefinition extends VersionedComponent {
67
+ /** The workflow content (e.g. workflow.md contents) */
68
+ content: string;
69
+ }
70
+ /** MCP Server configuration (resolved form, same structure as McpServerRef). */
71
+ interface McpServerDefinition extends VersionedComponent {
72
+ command: string;
73
+ args?: string[];
74
+ env?: Record<string, string>;
75
+ }
76
+ /**
77
+ * A Plugin = an agent-side capability extension.
78
+ * Examples: Claude Code plugins, Cursor extensions, custom tool integrations.
79
+ * Distinct from Actant system-level plugins (Phase 4 #13).
80
+ */
81
+ interface PluginDefinition extends VersionedComponent {
82
+ /** Plugin type: npm package, local file, or JSON config */
83
+ type: "npm" | "file" | "config";
84
+ /** For npm: package specifier (e.g. "@anthropic/memory"). For file: relative path. */
85
+ source?: string;
86
+ /** Plugin-specific configuration */
87
+ config?: Record<string, unknown>;
88
+ /** Whether this plugin is enabled by default */
89
+ enabled?: boolean;
90
+ }
91
+
92
+ type PermissionMode = "default" | "acceptEdits" | "plan" | "dontAsk" | "bypassPermissions";
93
+ type PermissionPreset = "permissive" | "standard" | "restricted" | "readonly";
94
+ interface SandboxNetworkConfig {
95
+ allowedDomains?: string[];
96
+ allowLocalBinding?: boolean;
97
+ }
98
+ interface SandboxConfig {
99
+ enabled?: boolean;
100
+ autoAllowBashIfSandboxed?: boolean;
101
+ network?: SandboxNetworkConfig;
102
+ }
103
+ interface PermissionsConfig {
104
+ allow?: string[];
105
+ deny?: string[];
106
+ ask?: string[];
107
+ defaultMode?: PermissionMode;
108
+ sandbox?: SandboxConfig;
109
+ additionalDirectories?: string[];
110
+ }
111
+ /** Permissions field on a template: either a preset name or full config. */
112
+ type PermissionsInput = PermissionPreset | PermissionsConfig;
113
+ interface AgentTemplate extends VersionedComponent {
114
+ /** Required override: templates must have an explicit semver version. */
115
+ version: string;
116
+ backend: AgentBackendConfig;
117
+ provider: ModelProviderConfig;
118
+ domainContext: DomainContextConfig;
119
+ /** Tool/file/network permission control, aligned with Claude Code permissions. */
120
+ permissions?: PermissionsInput;
121
+ initializer?: InitializerConfig;
122
+ schedule?: {
123
+ heartbeat?: {
124
+ intervalMs: number;
125
+ prompt: string;
126
+ priority?: string;
127
+ };
128
+ cron?: Array<{
129
+ pattern: string;
130
+ prompt: string;
131
+ timezone?: string;
132
+ priority?: string;
133
+ }>;
134
+ hooks?: Array<{
135
+ eventName: string;
136
+ prompt: string;
137
+ priority?: string;
138
+ }>;
139
+ };
140
+ metadata?: Record<string, string>;
141
+ }
142
+ interface AgentBackendConfig {
143
+ type: AgentBackendType;
144
+ /** Optional backend-specific config (e.g. executablePath for launcher). Used in materialization and persisted on instance. */
145
+ config?: Record<string, unknown>;
146
+ }
147
+ type AgentBackendType = "cursor" | "claude-code" | "custom";
148
+ interface ModelProviderConfig {
149
+ type: ModelProviderType;
150
+ config?: Record<string, unknown>;
151
+ }
152
+ type ModelProviderType = "anthropic" | "openai" | "custom";
153
+ interface InitializerConfig {
154
+ steps: InitializerStep[];
155
+ }
156
+ interface InitializerStep {
157
+ type: string;
158
+ config?: Record<string, unknown>;
159
+ }
160
+
161
+ /**
162
+ * Agent Instance = a workspace directory.
163
+ * `.actant.json` is the metadata descriptor of that directory.
164
+ * The directory itself IS the instance — containing materialized Domain Context files.
165
+ */
166
+ interface AgentInstanceMeta {
167
+ id: string;
168
+ name: string;
169
+ templateName: string;
170
+ templateVersion: string;
171
+ /** Backend type (cursor / claude-code / custom). Set from template when instance is created. */
172
+ backendType: AgentBackendType;
173
+ /** Backend config from template (e.g. executablePath). Persisted so launcher can use without template registry. */
174
+ backendConfig?: Record<string, unknown>;
175
+ status: AgentStatus;
176
+ launchMode: LaunchMode;
177
+ /** Workspace lifecycle policy. "persistent" survives across spawns; "ephemeral" can be cleaned up after task. */
178
+ workspacePolicy: WorkspacePolicy;
179
+ /** Who owns/manages the agent process. "managed" = Actant, "external" = caller. */
180
+ processOwnership: ProcessOwnership;
181
+ createdAt: string;
182
+ updatedAt: string;
183
+ pid?: number;
184
+ /** Resolved permissions for this instance (after template + override resolution). */
185
+ effectivePermissions?: PermissionsConfig;
186
+ metadata?: Record<string, string>;
187
+ }
188
+ type AgentStatus = "created" | "starting" | "running" | "stopping" | "stopped" | "error" | "crashed";
189
+ type LaunchMode = "direct" | "acp-background" | "acp-service" | "one-shot";
190
+ type ProcessOwnership = "managed" | "external";
191
+ /** Workspace filesystem lifecycle policy, independent of process lifecycle. */
192
+ type WorkspacePolicy = "persistent" | "ephemeral";
193
+ /** Information needed to spawn an agent process externally. */
194
+ interface ResolveResult {
195
+ workspaceDir: string;
196
+ command: string;
197
+ args: string[];
198
+ env?: Record<string, string>;
199
+ instanceName: string;
200
+ backendType: AgentBackendType;
201
+ /** Whether a new instance was created by this resolve call. */
202
+ created: boolean;
203
+ }
204
+ /** Result of detaching an externally-managed process. */
205
+ interface DetachResult {
206
+ ok: boolean;
207
+ workspaceCleaned: boolean;
208
+ }
209
+
210
+ /**
211
+ * Unified configuration validation result types (#119).
212
+ * Used across all config validators (templates, domain components, sub-configs).
213
+ */
214
+ type ValidationSeverity = "error" | "warning" | "info";
215
+ /** A single validation issue with path, message, and severity. */
216
+ interface ValidationIssue {
217
+ /** Dot-separated path to the problematic field (e.g. "domainContext.skills") */
218
+ path: string;
219
+ message: string;
220
+ severity: ValidationSeverity;
221
+ /** Machine-readable code for programmatic handling (e.g. "DUPLICATE_NAME", "DEPRECATED_FIELD") */
222
+ code?: string;
223
+ }
224
+ /**
225
+ * Structured result from any config validation.
226
+ * @template T The validated configuration type
227
+ */
228
+ interface ConfigValidationResult<T = unknown> {
229
+ valid: boolean;
230
+ data?: T;
231
+ errors: ValidationIssue[];
232
+ warnings: ValidationIssue[];
233
+ }
234
+
235
+ /** Discriminated union for source configurations. New source types extend this. */
236
+ type SourceConfig = GitHubSourceConfig | LocalSourceConfig;
237
+ interface GitHubSourceConfig {
238
+ type: "github";
239
+ url: string;
240
+ branch?: string;
241
+ }
242
+ interface LocalSourceConfig {
243
+ type: "local";
244
+ path: string;
245
+ }
246
+ /** Persisted source entry (stored in sources.json). */
247
+ interface SourceEntry {
248
+ name: string;
249
+ config: SourceConfig;
250
+ syncedAt?: string;
251
+ }
252
+ interface PackageManifest {
253
+ name: string;
254
+ version?: string;
255
+ description?: string;
256
+ components?: {
257
+ skills?: string[];
258
+ prompts?: string[];
259
+ mcp?: string[];
260
+ workflows?: string[];
261
+ templates?: string[];
262
+ };
263
+ presets?: string[];
264
+ }
265
+ interface PresetDefinition {
266
+ name: string;
267
+ version?: string;
268
+ description?: string;
269
+ skills?: string[];
270
+ prompts?: string[];
271
+ mcpServers?: string[];
272
+ workflows?: string[];
273
+ templates?: string[];
274
+ }
275
+
276
+ interface RpcRequest {
277
+ jsonrpc: "2.0";
278
+ id: number | string;
279
+ method: string;
280
+ params?: Record<string, unknown>;
281
+ }
282
+ interface RpcResponse {
283
+ jsonrpc: "2.0";
284
+ id: number | string;
285
+ result?: unknown;
286
+ error?: RpcError;
287
+ }
288
+ interface RpcError {
289
+ code: number;
290
+ message: string;
291
+ data?: unknown;
292
+ }
293
+ declare const RPC_ERROR_CODES: {
294
+ readonly PARSE_ERROR: -32700;
295
+ readonly INVALID_REQUEST: -32600;
296
+ readonly METHOD_NOT_FOUND: -32601;
297
+ readonly INVALID_PARAMS: -32602;
298
+ readonly INTERNAL_ERROR: -32603;
299
+ readonly TEMPLATE_NOT_FOUND: -32001;
300
+ readonly CONFIG_VALIDATION: -32002;
301
+ readonly AGENT_NOT_FOUND: -32003;
302
+ readonly AGENT_ALREADY_RUNNING: -32004;
303
+ readonly WORKSPACE_INIT: -32005;
304
+ readonly COMPONENT_REFERENCE: -32006;
305
+ readonly INSTANCE_CORRUPTED: -32007;
306
+ readonly AGENT_LAUNCH: -32008;
307
+ readonly AGENT_ALREADY_ATTACHED: -32009;
308
+ readonly AGENT_NOT_ATTACHED: -32010;
309
+ readonly GENERIC_BUSINESS: -32000;
310
+ };
311
+ type RpcErrorCode = (typeof RPC_ERROR_CODES)[keyof typeof RPC_ERROR_CODES];
312
+ type TemplateListParams = Record<string, never>;
313
+ type TemplateListResult = AgentTemplate[];
314
+ interface TemplateGetParams {
315
+ name: string;
316
+ }
317
+ type TemplateGetResult = AgentTemplate;
318
+ interface TemplateLoadParams {
319
+ filePath: string;
320
+ }
321
+ type TemplateLoadResult = AgentTemplate;
322
+ interface TemplateUnloadParams {
323
+ name: string;
324
+ }
325
+ interface TemplateUnloadResult {
326
+ success: boolean;
327
+ }
328
+ interface TemplateValidateParams {
329
+ filePath: string;
330
+ }
331
+ interface TemplateValidateResult {
332
+ valid: boolean;
333
+ template?: AgentTemplate;
334
+ errors?: Array<{
335
+ path: string;
336
+ message: string;
337
+ }>;
338
+ /** Warnings that don't prevent loading but indicate potential issues (#119) */
339
+ warnings?: Array<{
340
+ path: string;
341
+ message: string;
342
+ }>;
343
+ }
344
+ type WorkDirConflict = "error" | "overwrite" | "append";
345
+ interface AgentCreateParams {
346
+ name: string;
347
+ template: string;
348
+ overrides?: {
349
+ launchMode?: LaunchMode;
350
+ workspacePolicy?: WorkspacePolicy;
351
+ /** Absolute path to use as workspace directory instead of the default {instancesDir}/{name}. */
352
+ workDir?: string;
353
+ /** Behavior when workDir already exists. Default: "error". */
354
+ workDirConflict?: WorkDirConflict;
355
+ /** Override template permissions. Completely replaces template.permissions when set. */
356
+ permissions?: PermissionsInput;
357
+ metadata?: Record<string, string>;
358
+ };
359
+ }
360
+ type AgentCreateResult = AgentInstanceMeta;
361
+ interface AgentStartParams {
362
+ name: string;
363
+ }
364
+ type AgentStartResult = AgentInstanceMeta;
365
+ interface AgentStopParams {
366
+ name: string;
367
+ }
368
+ type AgentStopResult = AgentInstanceMeta;
369
+ interface AgentDestroyParams {
370
+ name: string;
371
+ }
372
+ interface AgentDestroyResult {
373
+ success: boolean;
374
+ }
375
+ interface AgentStatusParams {
376
+ name: string;
377
+ }
378
+ type AgentStatusResult = AgentInstanceMeta;
379
+ type AgentListParams = Record<string, never>;
380
+ type AgentListResult = AgentInstanceMeta[];
381
+ interface AgentUpdatePermissionsParams {
382
+ name: string;
383
+ permissions: PermissionsInput;
384
+ }
385
+ interface AgentUpdatePermissionsResult {
386
+ effectivePermissions: PermissionsConfig;
387
+ }
388
+ interface AgentAdoptParams {
389
+ path: string;
390
+ rename?: string;
391
+ }
392
+ interface AgentAdoptResult {
393
+ name: string;
394
+ template: string;
395
+ workspacePath: string;
396
+ location: "builtin" | "external";
397
+ createdAt: string;
398
+ status: "stopped" | "running" | "orphaned";
399
+ }
400
+ interface AgentResolveParams {
401
+ name: string;
402
+ template?: string;
403
+ overrides?: {
404
+ launchMode?: LaunchMode;
405
+ workspacePolicy?: WorkspacePolicy;
406
+ metadata?: Record<string, string>;
407
+ };
408
+ }
409
+ type AgentResolveResult = ResolveResult;
410
+ interface AgentAttachParams {
411
+ name: string;
412
+ pid: number;
413
+ metadata?: Record<string, string>;
414
+ }
415
+ type AgentAttachResult = AgentInstanceMeta;
416
+ interface AgentDetachParams {
417
+ name: string;
418
+ cleanup?: boolean;
419
+ }
420
+ type AgentDetachResult = DetachResult;
421
+ interface AgentRunParams {
422
+ name: string;
423
+ prompt: string;
424
+ options?: {
425
+ systemPromptFile?: string;
426
+ appendSystemPrompt?: string;
427
+ sessionId?: string;
428
+ timeoutMs?: number;
429
+ maxTurns?: number;
430
+ model?: string;
431
+ };
432
+ }
433
+ interface AgentRunResult {
434
+ text: string;
435
+ sessionId?: string;
436
+ }
437
+ interface AgentDispatchParams {
438
+ name: string;
439
+ prompt: string;
440
+ priority?: string;
441
+ }
442
+ interface AgentDispatchResult {
443
+ queued: boolean;
444
+ }
445
+ interface AgentTasksParams {
446
+ name: string;
447
+ }
448
+ interface AgentTasksResult {
449
+ queued: number;
450
+ processing: boolean;
451
+ tasks: unknown[];
452
+ }
453
+ interface AgentLogsParams {
454
+ name: string;
455
+ limit?: number;
456
+ }
457
+ type AgentLogsResult = unknown[];
458
+ interface ScheduleListParams {
459
+ name: string;
460
+ }
461
+ interface ScheduleListResult {
462
+ sources: Array<{
463
+ id: string;
464
+ type: string;
465
+ active: boolean;
466
+ }>;
467
+ running: boolean;
468
+ }
469
+ interface AgentPromptParams {
470
+ name: string;
471
+ message: string;
472
+ sessionId?: string;
473
+ }
474
+ interface AgentPromptResult {
475
+ response: string;
476
+ sessionId: string;
477
+ }
478
+ interface SessionCreateParams {
479
+ agentName: string;
480
+ clientId: string;
481
+ idleTtlMs?: number;
482
+ }
483
+ interface SessionLeaseInfo {
484
+ sessionId: string;
485
+ agentName: string;
486
+ clientId: string | null;
487
+ state: "active" | "idle" | "expired";
488
+ createdAt: string;
489
+ lastActivityAt: string;
490
+ idleTtlMs: number;
491
+ }
492
+ type SessionCreateResult = SessionLeaseInfo;
493
+ interface SessionPromptParams {
494
+ sessionId: string;
495
+ text: string;
496
+ }
497
+ interface SessionPromptResult {
498
+ stopReason: string;
499
+ text: string;
500
+ }
501
+ interface SessionCancelParams {
502
+ sessionId: string;
503
+ }
504
+ interface SessionCancelResult {
505
+ ok: boolean;
506
+ }
507
+ interface SessionCloseParams {
508
+ sessionId: string;
509
+ }
510
+ interface SessionCloseResult {
511
+ ok: boolean;
512
+ }
513
+ interface SessionListParams {
514
+ agentName?: string;
515
+ }
516
+ type SessionListResult = SessionLeaseInfo[];
517
+ interface ProxyConnectParams {
518
+ agentName: string;
519
+ envPassthrough?: boolean;
520
+ }
521
+ interface ProxySession {
522
+ sessionId: string;
523
+ agentName: string;
524
+ envPassthrough: boolean;
525
+ connectedAt: string;
526
+ }
527
+ type ProxyConnectResult = ProxySession;
528
+ interface ProxyDisconnectParams {
529
+ sessionId: string;
530
+ }
531
+ interface ProxyDisconnectResult {
532
+ ok: boolean;
533
+ }
534
+ interface ProxyForwardParams {
535
+ sessionId: string;
536
+ acpMessage: Record<string, unknown>;
537
+ }
538
+ type ProxyForwardResult = Record<string, unknown>;
539
+ type SkillListParams = Record<string, never>;
540
+ type SkillListResult = SkillDefinition[];
541
+ interface SkillGetParams {
542
+ name: string;
543
+ }
544
+ type SkillGetResult = SkillDefinition;
545
+ type PromptListParams = Record<string, never>;
546
+ type PromptListResult = PromptDefinition[];
547
+ interface PromptGetParams {
548
+ name: string;
549
+ }
550
+ type PromptGetResult = PromptDefinition;
551
+ type McpListParams = Record<string, never>;
552
+ type McpListResult = McpServerDefinition[];
553
+ interface McpGetParams {
554
+ name: string;
555
+ }
556
+ type McpGetResult = McpServerDefinition;
557
+ type WorkflowListParams = Record<string, never>;
558
+ type WorkflowListResult = WorkflowDefinition[];
559
+ interface WorkflowGetParams {
560
+ name: string;
561
+ }
562
+ type WorkflowGetResult = WorkflowDefinition;
563
+ type PluginListParams = Record<string, never>;
564
+ type PluginListResult = PluginDefinition[];
565
+ interface PluginGetParams {
566
+ name: string;
567
+ }
568
+ type PluginGetResult = PluginDefinition;
569
+ type DaemonPingParams = Record<string, never>;
570
+ interface DaemonPingResult {
571
+ version: string;
572
+ uptime: number;
573
+ agents: number;
574
+ }
575
+ type DaemonShutdownParams = Record<string, never>;
576
+ interface DaemonShutdownResult {
577
+ success: boolean;
578
+ }
579
+ interface GatewayLeaseParams {
580
+ agentName: string;
581
+ }
582
+ interface GatewayLeaseResult {
583
+ socketPath: string;
584
+ }
585
+ interface ComponentAddParams {
586
+ component: Record<string, unknown>;
587
+ }
588
+ interface ComponentAddResult {
589
+ name: string;
590
+ }
591
+ interface ComponentUpdateParams {
592
+ name: string;
593
+ patch: Record<string, unknown>;
594
+ }
595
+ interface ComponentUpdateResult {
596
+ name: string;
597
+ }
598
+ interface ComponentRemoveParams {
599
+ name: string;
600
+ }
601
+ interface ComponentRemoveResult {
602
+ success: boolean;
603
+ }
604
+ interface ComponentImportParams {
605
+ filePath: string;
606
+ }
607
+ interface ComponentImportResult {
608
+ name: string;
609
+ }
610
+ interface ComponentExportParams {
611
+ name: string;
612
+ filePath: string;
613
+ }
614
+ interface ComponentExportResult {
615
+ success: boolean;
616
+ }
617
+ type SourceListParams = Record<string, never>;
618
+ type SourceListResult = SourceEntry[];
619
+ interface SourceAddParams {
620
+ name: string;
621
+ config: SourceConfig;
622
+ }
623
+ interface SourceAddResult {
624
+ name: string;
625
+ components: {
626
+ skills: number;
627
+ prompts: number;
628
+ mcp: number;
629
+ workflows: number;
630
+ presets: number;
631
+ };
632
+ }
633
+ interface SourceRemoveParams {
634
+ name: string;
635
+ }
636
+ interface SourceRemoveResult {
637
+ success: boolean;
638
+ }
639
+ interface SourceSyncParams {
640
+ name?: string;
641
+ }
642
+ interface SourceSyncResult {
643
+ synced: string[];
644
+ /** Sync report summary (aggregated when syncing multiple sources). */
645
+ report?: {
646
+ addedCount: number;
647
+ updatedCount: number;
648
+ removedCount: number;
649
+ hasBreakingChanges: boolean;
650
+ };
651
+ }
652
+ interface PresetListParams {
653
+ packageName?: string;
654
+ }
655
+ type PresetListResult = PresetDefinition[];
656
+ interface PresetShowParams {
657
+ qualifiedName: string;
658
+ }
659
+ type PresetShowResult = PresetDefinition;
660
+ interface PresetApplyParams {
661
+ qualifiedName: string;
662
+ templateName: string;
663
+ }
664
+ type PresetApplyResult = AgentTemplate;
665
+ interface RpcMethodMap {
666
+ "template.list": {
667
+ params: TemplateListParams;
668
+ result: TemplateListResult;
669
+ };
670
+ "template.get": {
671
+ params: TemplateGetParams;
672
+ result: TemplateGetResult;
673
+ };
674
+ "template.load": {
675
+ params: TemplateLoadParams;
676
+ result: TemplateLoadResult;
677
+ };
678
+ "template.unload": {
679
+ params: TemplateUnloadParams;
680
+ result: TemplateUnloadResult;
681
+ };
682
+ "template.validate": {
683
+ params: TemplateValidateParams;
684
+ result: TemplateValidateResult;
685
+ };
686
+ "agent.create": {
687
+ params: AgentCreateParams;
688
+ result: AgentCreateResult;
689
+ };
690
+ "agent.start": {
691
+ params: AgentStartParams;
692
+ result: AgentStartResult;
693
+ };
694
+ "agent.stop": {
695
+ params: AgentStopParams;
696
+ result: AgentStopResult;
697
+ };
698
+ "agent.destroy": {
699
+ params: AgentDestroyParams;
700
+ result: AgentDestroyResult;
701
+ };
702
+ "agent.status": {
703
+ params: AgentStatusParams;
704
+ result: AgentStatusResult;
705
+ };
706
+ "agent.list": {
707
+ params: AgentListParams;
708
+ result: AgentListResult;
709
+ };
710
+ "agent.updatePermissions": {
711
+ params: AgentUpdatePermissionsParams;
712
+ result: AgentUpdatePermissionsResult;
713
+ };
714
+ "agent.adopt": {
715
+ params: AgentAdoptParams;
716
+ result: AgentAdoptResult;
717
+ };
718
+ "agent.resolve": {
719
+ params: AgentResolveParams;
720
+ result: AgentResolveResult;
721
+ };
722
+ "agent.attach": {
723
+ params: AgentAttachParams;
724
+ result: AgentAttachResult;
725
+ };
726
+ "agent.detach": {
727
+ params: AgentDetachParams;
728
+ result: AgentDetachResult;
729
+ };
730
+ "agent.run": {
731
+ params: AgentRunParams;
732
+ result: AgentRunResult;
733
+ };
734
+ "agent.prompt": {
735
+ params: AgentPromptParams;
736
+ result: AgentPromptResult;
737
+ };
738
+ "agent.dispatch": {
739
+ params: AgentDispatchParams;
740
+ result: AgentDispatchResult;
741
+ };
742
+ "agent.tasks": {
743
+ params: AgentTasksParams;
744
+ result: AgentTasksResult;
745
+ };
746
+ "agent.logs": {
747
+ params: AgentLogsParams;
748
+ result: AgentLogsResult;
749
+ };
750
+ "schedule.list": {
751
+ params: ScheduleListParams;
752
+ result: ScheduleListResult;
753
+ };
754
+ "session.create": {
755
+ params: SessionCreateParams;
756
+ result: SessionCreateResult;
757
+ };
758
+ "session.prompt": {
759
+ params: SessionPromptParams;
760
+ result: SessionPromptResult;
761
+ };
762
+ "session.cancel": {
763
+ params: SessionCancelParams;
764
+ result: SessionCancelResult;
765
+ };
766
+ "session.close": {
767
+ params: SessionCloseParams;
768
+ result: SessionCloseResult;
769
+ };
770
+ "session.list": {
771
+ params: SessionListParams;
772
+ result: SessionListResult;
773
+ };
774
+ "proxy.connect": {
775
+ params: ProxyConnectParams;
776
+ result: ProxyConnectResult;
777
+ };
778
+ "proxy.disconnect": {
779
+ params: ProxyDisconnectParams;
780
+ result: ProxyDisconnectResult;
781
+ };
782
+ "proxy.forward": {
783
+ params: ProxyForwardParams;
784
+ result: ProxyForwardResult;
785
+ };
786
+ "skill.list": {
787
+ params: SkillListParams;
788
+ result: SkillListResult;
789
+ };
790
+ "skill.get": {
791
+ params: SkillGetParams;
792
+ result: SkillGetResult;
793
+ };
794
+ "skill.add": {
795
+ params: ComponentAddParams;
796
+ result: ComponentAddResult;
797
+ };
798
+ "skill.update": {
799
+ params: ComponentUpdateParams;
800
+ result: ComponentUpdateResult;
801
+ };
802
+ "skill.remove": {
803
+ params: ComponentRemoveParams;
804
+ result: ComponentRemoveResult;
805
+ };
806
+ "skill.import": {
807
+ params: ComponentImportParams;
808
+ result: ComponentImportResult;
809
+ };
810
+ "skill.export": {
811
+ params: ComponentExportParams;
812
+ result: ComponentExportResult;
813
+ };
814
+ "prompt.list": {
815
+ params: PromptListParams;
816
+ result: PromptListResult;
817
+ };
818
+ "prompt.get": {
819
+ params: PromptGetParams;
820
+ result: PromptGetResult;
821
+ };
822
+ "prompt.add": {
823
+ params: ComponentAddParams;
824
+ result: ComponentAddResult;
825
+ };
826
+ "prompt.update": {
827
+ params: ComponentUpdateParams;
828
+ result: ComponentUpdateResult;
829
+ };
830
+ "prompt.remove": {
831
+ params: ComponentRemoveParams;
832
+ result: ComponentRemoveResult;
833
+ };
834
+ "prompt.import": {
835
+ params: ComponentImportParams;
836
+ result: ComponentImportResult;
837
+ };
838
+ "prompt.export": {
839
+ params: ComponentExportParams;
840
+ result: ComponentExportResult;
841
+ };
842
+ "mcp.list": {
843
+ params: McpListParams;
844
+ result: McpListResult;
845
+ };
846
+ "mcp.get": {
847
+ params: McpGetParams;
848
+ result: McpGetResult;
849
+ };
850
+ "mcp.add": {
851
+ params: ComponentAddParams;
852
+ result: ComponentAddResult;
853
+ };
854
+ "mcp.update": {
855
+ params: ComponentUpdateParams;
856
+ result: ComponentUpdateResult;
857
+ };
858
+ "mcp.remove": {
859
+ params: ComponentRemoveParams;
860
+ result: ComponentRemoveResult;
861
+ };
862
+ "mcp.import": {
863
+ params: ComponentImportParams;
864
+ result: ComponentImportResult;
865
+ };
866
+ "mcp.export": {
867
+ params: ComponentExportParams;
868
+ result: ComponentExportResult;
869
+ };
870
+ "workflow.list": {
871
+ params: WorkflowListParams;
872
+ result: WorkflowListResult;
873
+ };
874
+ "workflow.get": {
875
+ params: WorkflowGetParams;
876
+ result: WorkflowGetResult;
877
+ };
878
+ "workflow.add": {
879
+ params: ComponentAddParams;
880
+ result: ComponentAddResult;
881
+ };
882
+ "workflow.update": {
883
+ params: ComponentUpdateParams;
884
+ result: ComponentUpdateResult;
885
+ };
886
+ "workflow.remove": {
887
+ params: ComponentRemoveParams;
888
+ result: ComponentRemoveResult;
889
+ };
890
+ "workflow.import": {
891
+ params: ComponentImportParams;
892
+ result: ComponentImportResult;
893
+ };
894
+ "workflow.export": {
895
+ params: ComponentExportParams;
896
+ result: ComponentExportResult;
897
+ };
898
+ "plugin.list": {
899
+ params: PluginListParams;
900
+ result: PluginListResult;
901
+ };
902
+ "plugin.get": {
903
+ params: PluginGetParams;
904
+ result: PluginGetResult;
905
+ };
906
+ "plugin.add": {
907
+ params: ComponentAddParams;
908
+ result: ComponentAddResult;
909
+ };
910
+ "plugin.update": {
911
+ params: ComponentUpdateParams;
912
+ result: ComponentUpdateResult;
913
+ };
914
+ "plugin.remove": {
915
+ params: ComponentRemoveParams;
916
+ result: ComponentRemoveResult;
917
+ };
918
+ "plugin.import": {
919
+ params: ComponentImportParams;
920
+ result: ComponentImportResult;
921
+ };
922
+ "plugin.export": {
923
+ params: ComponentExportParams;
924
+ result: ComponentExportResult;
925
+ };
926
+ "source.list": {
927
+ params: SourceListParams;
928
+ result: SourceListResult;
929
+ };
930
+ "source.add": {
931
+ params: SourceAddParams;
932
+ result: SourceAddResult;
933
+ };
934
+ "source.remove": {
935
+ params: SourceRemoveParams;
936
+ result: SourceRemoveResult;
937
+ };
938
+ "source.sync": {
939
+ params: SourceSyncParams;
940
+ result: SourceSyncResult;
941
+ };
942
+ "preset.list": {
943
+ params: PresetListParams;
944
+ result: PresetListResult;
945
+ };
946
+ "preset.show": {
947
+ params: PresetShowParams;
948
+ result: PresetShowResult;
949
+ };
950
+ "preset.apply": {
951
+ params: PresetApplyParams;
952
+ result: PresetApplyResult;
953
+ };
954
+ "daemon.ping": {
955
+ params: DaemonPingParams;
956
+ result: DaemonPingResult;
957
+ };
958
+ "daemon.shutdown": {
959
+ params: DaemonShutdownParams;
960
+ result: DaemonShutdownResult;
961
+ };
962
+ "gateway.lease": {
963
+ params: GatewayLeaseParams;
964
+ result: GatewayLeaseResult;
965
+ };
966
+ }
967
+ type RpcMethod = keyof RpcMethodMap;
968
+
969
+ type ErrorCategory = "configuration" | "lifecycle" | "communication" | "cli";
970
+ declare abstract class ActantError extends Error {
971
+ abstract readonly code: string;
972
+ abstract readonly category: ErrorCategory;
973
+ readonly timestamp: Date;
974
+ readonly context?: Record<string, unknown>;
975
+ constructor(message: string, context?: Record<string, unknown>);
976
+ }
977
+
978
+ declare class ConfigNotFoundError extends ActantError {
979
+ readonly code = "CONFIG_NOT_FOUND";
980
+ readonly category: ErrorCategory;
981
+ constructor(configPath: string);
982
+ }
983
+ declare class ConfigValidationError extends ActantError {
984
+ readonly validationErrors: Array<{
985
+ path: string;
986
+ message: string;
987
+ }>;
988
+ /** Structured validation issues with severity (#119) */
989
+ readonly issues?: ValidationIssue[] | undefined;
990
+ readonly code = "CONFIG_VALIDATION_ERROR";
991
+ readonly category: ErrorCategory;
992
+ constructor(message: string, validationErrors: Array<{
993
+ path: string;
994
+ message: string;
995
+ }>,
996
+ /** Structured validation issues with severity (#119) */
997
+ issues?: ValidationIssue[] | undefined);
998
+ }
999
+ declare class TemplateNotFoundError extends ActantError {
1000
+ readonly code = "TEMPLATE_NOT_FOUND";
1001
+ readonly category: ErrorCategory;
1002
+ constructor(templateName: string);
1003
+ }
1004
+ declare class SkillReferenceError extends ActantError {
1005
+ readonly code = "SKILL_REFERENCE_ERROR";
1006
+ readonly category: ErrorCategory;
1007
+ constructor(skillName: string);
1008
+ }
1009
+ declare class ComponentReferenceError extends ActantError {
1010
+ readonly code = "COMPONENT_REFERENCE_ERROR";
1011
+ readonly category: ErrorCategory;
1012
+ constructor(componentType: string, componentName: string);
1013
+ }
1014
+ declare class CircularReferenceError extends ActantError {
1015
+ readonly code = "CIRCULAR_REFERENCE";
1016
+ readonly category: ErrorCategory;
1017
+ constructor(cyclePath: string[]);
1018
+ }
1019
+
1020
+ declare class AgentLaunchError extends ActantError {
1021
+ readonly code = "AGENT_LAUNCH_ERROR";
1022
+ readonly category: ErrorCategory;
1023
+ constructor(instanceName: string, cause?: Error);
1024
+ }
1025
+ declare class AgentNotFoundError extends ActantError {
1026
+ readonly code = "AGENT_NOT_FOUND";
1027
+ readonly category: ErrorCategory;
1028
+ constructor(instanceName: string);
1029
+ }
1030
+ declare class AgentAlreadyRunningError extends ActantError {
1031
+ readonly code = "AGENT_ALREADY_RUNNING";
1032
+ readonly category: ErrorCategory;
1033
+ constructor(instanceName: string);
1034
+ }
1035
+ declare class AgentAlreadyAttachedError extends ActantError {
1036
+ readonly code = "AGENT_ALREADY_ATTACHED";
1037
+ readonly category: ErrorCategory;
1038
+ constructor(instanceName: string);
1039
+ }
1040
+ declare class AgentNotAttachedError extends ActantError {
1041
+ readonly code = "AGENT_NOT_ATTACHED";
1042
+ readonly category: ErrorCategory;
1043
+ constructor(instanceName: string);
1044
+ }
1045
+ declare class InstanceCorruptedError extends ActantError {
1046
+ readonly code = "INSTANCE_CORRUPTED";
1047
+ readonly category: ErrorCategory;
1048
+ constructor(instanceName: string, reason: string);
1049
+ }
1050
+ declare class WorkspaceInitError extends ActantError {
1051
+ readonly code = "WORKSPACE_INIT_ERROR";
1052
+ readonly category: ErrorCategory;
1053
+ constructor(workspacePath: string, cause?: Error);
1054
+ }
1055
+
1056
+ type Logger = pino.Logger;
1057
+ declare function createLogger(module: string): Logger;
1058
+
1059
+ /**
1060
+ * Returns the platform-appropriate IPC path for daemon communication.
1061
+ *
1062
+ * - macOS/Linux: Unix domain socket at `~/.actant/actant.sock`
1063
+ * - Windows: Named pipe at `\\.\pipe\actant`
1064
+ *
1065
+ * Named pipes are the standard Windows IPC mechanism and work with
1066
+ * Node.js `net.createServer` / `net.createConnection` transparently.
1067
+ */
1068
+ declare function getDefaultIpcPath(homeDir?: string): string;
1069
+ /**
1070
+ * Returns the IPC path for a given home directory.
1071
+ * Used by AppContext when homeDir is explicitly provided.
1072
+ */
1073
+ declare function getIpcPath(homeDir: string): string;
1074
+ /**
1075
+ * Whether the current platform uses file-based IPC (Unix sockets)
1076
+ * that may need cleanup (unlink) before listening.
1077
+ */
1078
+ declare function ipcRequiresFileCleanup(): boolean;
1079
+ /**
1080
+ * Registers graceful shutdown handlers that work across all platforms.
1081
+ *
1082
+ * - Unix: SIGINT, SIGTERM
1083
+ * - Windows: SIGINT (Ctrl+C in terminal), SIGBREAK (Ctrl+Break)
1084
+ *
1085
+ * SIGTERM is not reliably delivered on Windows, so we also listen for
1086
+ * SIGBREAK which is the closest equivalent.
1087
+ */
1088
+ declare function onShutdownSignal(handler: () => void | Promise<void>): void;
1089
+ declare function isWindows(): boolean;
1090
+ /**
1091
+ * Detects if the process is running as a Node.js Single Executable Application.
1092
+ * Uses `node:sea` module (Node 20+) with a fallback heuristic.
1093
+ */
1094
+ declare function isSingleExecutable(): boolean;
1095
+
1096
+ export { ActantError, type AgentAdoptParams, type AgentAdoptResult, AgentAlreadyAttachedError, AgentAlreadyRunningError, type AgentAttachParams, type AgentAttachResult, type AgentBackendConfig, type AgentBackendType, type AgentCreateParams, type AgentCreateResult, type AgentDestroyParams, type AgentDestroyResult, type AgentDetachParams, type AgentDetachResult, type AgentDispatchParams, type AgentDispatchResult, type AgentInstanceMeta, AgentLaunchError, type AgentListParams, type AgentListResult, type AgentLogsParams, type AgentLogsResult, AgentNotAttachedError, AgentNotFoundError, type AgentPromptParams, type AgentPromptResult, type AgentResolveParams, type AgentResolveResult, type AgentRunParams, type AgentRunResult, type AgentStartParams, type AgentStartResult, type AgentStatus, type AgentStatusParams, type AgentStatusResult, type AgentStopParams, type AgentStopResult, type AgentTasksParams, type AgentTasksResult, type AgentTemplate, type AgentUpdatePermissionsParams, type AgentUpdatePermissionsResult, CircularReferenceError, type ComponentAddParams, type ComponentAddResult, type ComponentExportParams, type ComponentExportResult, type ComponentImportParams, type ComponentImportResult, type ComponentOrigin, type ComponentOriginType, ComponentReferenceError, type ComponentRemoveParams, type ComponentRemoveResult, type ComponentUpdateParams, type ComponentUpdateResult, ConfigNotFoundError, ConfigValidationError, type ConfigValidationResult, type DaemonPingParams, type DaemonPingResult, type DaemonShutdownParams, type DaemonShutdownResult, type DetachResult, type DomainContextConfig, type ErrorCategory, type GitHubSourceConfig, type InitializerConfig, type InitializerStep, InstanceCorruptedError, type LaunchMode, type LocalSourceConfig, type Logger, type McpGetParams, type McpGetResult, type McpListParams, type McpListResult, type McpServerDefinition, type McpServerRef, type ModelProviderConfig, type ModelProviderType, type PackageManifest, type PermissionMode, type PermissionPreset, type PermissionsConfig, type PermissionsInput, type PluginDefinition, type PluginGetParams, type PluginGetResult, type PluginListParams, type PluginListResult, type PresetApplyParams, type PresetApplyResult, type PresetDefinition, type PresetListParams, type PresetListResult, type PresetShowParams, type PresetShowResult, type ProcessOwnership, type PromptDefinition, type PromptGetParams, type PromptGetResult, type PromptListParams, type PromptListResult, type ProxyConnectParams, type ProxyConnectResult, type ProxyDisconnectParams, type ProxyDisconnectResult, type ProxyForwardParams, type ProxyForwardResult, type ProxySession, RPC_ERROR_CODES, type ResolveResult, type RpcError, type RpcErrorCode, type RpcMethod, type RpcMethodMap, type RpcRequest, type RpcResponse, type SandboxConfig, type SandboxNetworkConfig, type ScheduleListParams, type ScheduleListResult, type SessionCancelParams, type SessionCancelResult, type SessionCloseParams, type SessionCloseResult, type SessionCreateParams, type SessionCreateResult, type SessionLeaseInfo, type SessionListParams, type SessionListResult, type SessionPromptParams, type SessionPromptResult, type SkillDefinition, type SkillGetParams, type SkillGetResult, type SkillListParams, type SkillListResult, SkillReferenceError, type SourceAddParams, type SourceAddResult, type SourceConfig, type SourceEntry, type SourceListParams, type SourceListResult, type SourceRemoveParams, type SourceRemoveResult, type SourceSyncParams, type SourceSyncResult, type TemplateGetParams, type TemplateGetResult, type TemplateListParams, type TemplateListResult, type TemplateLoadParams, type TemplateLoadResult, TemplateNotFoundError, type TemplateUnloadParams, type TemplateUnloadResult, type TemplateValidateParams, type TemplateValidateResult, type ValidationIssue, type ValidationSeverity, type VersionedComponent, type WorkDirConflict, type WorkflowDefinition, type WorkflowGetParams, type WorkflowGetResult, type WorkflowListParams, type WorkflowListResult, WorkspaceInitError, type WorkspacePolicy, createLogger, getDefaultIpcPath, getIpcPath, ipcRequiresFileCleanup, isSingleExecutable, isWindows, onShutdownSignal };