@actant/shared 0.2.0 → 0.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.
package/dist/index.d.ts CHANGED
@@ -54,6 +54,12 @@ interface VersionedComponent {
54
54
  interface SkillDefinition extends VersionedComponent {
55
55
  /** The actual skill content (markdown/text rules) */
56
56
  content: string;
57
+ /** SPDX license identifier or reference to bundled license file (Agent Skills spec) */
58
+ license?: string;
59
+ /** Environment requirements: intended product, system packages, network access (Agent Skills spec) */
60
+ compatibility?: string;
61
+ /** Pre-approved tools the skill may use, e.g. ["Bash(git:*)", "Read"] (Agent Skills spec, experimental) */
62
+ allowedTools?: string[];
57
63
  }
58
64
  /** A Prompt = a system prompt or instruction set. */
59
65
  interface PromptDefinition extends VersionedComponent {
@@ -114,7 +120,8 @@ interface AgentTemplate extends VersionedComponent {
114
120
  /** Required override: templates must have an explicit semver version. */
115
121
  version: string;
116
122
  backend: AgentBackendConfig;
117
- provider: ModelProviderConfig;
123
+ /** Model provider. Optional — when omitted, uses the default provider from config.json. */
124
+ provider?: ModelProviderConfig;
118
125
  domainContext: DomainContextConfig;
119
126
  /** Tool/file/network permission control, aligned with Claude Code permissions. */
120
127
  permissions?: PermissionsInput;
@@ -180,13 +187,45 @@ interface BackendDescriptor {
180
187
  */
181
188
  acpOwnsProcess?: boolean;
182
189
  }
190
+ /**
191
+ * Provider config for templates and instance meta.
192
+ * SECURITY: apiKey is intentionally excluded — secrets are stored only in
193
+ * ~/.actant/config.json and resolved at runtime via the registry.
194
+ * Agent workspaces must never contain API keys.
195
+ */
183
196
  interface ModelProviderConfig {
184
- type: ModelProviderType;
185
- protocol?: "http" | "websocket" | "grpc";
197
+ /** Provider type — any registered provider name (e.g. "anthropic", "openai", "groq"). */
198
+ type: string;
199
+ /** API protocol format. Inferred from `type` when omitted (e.g. "deepseek" → "openai"). */
200
+ protocol?: ModelApiProtocol;
186
201
  baseUrl?: string;
187
202
  config?: Record<string, unknown>;
188
203
  }
189
- type ModelProviderType = "anthropic" | "openai" | "openai-compatible" | "custom";
204
+ /**
205
+ * Well-known built-in provider names. Kept for backward compatibility and
206
+ * type narrowing. The registry accepts any string, not just these.
207
+ */
208
+ type ModelProviderType = "anthropic" | "openai" | "deepseek" | "ollama" | "azure" | "bedrock" | "vertex" | "custom";
209
+ /**
210
+ * API protocol format — the wire-level request/response schema.
211
+ * - "openai" — OpenAI Chat Completions compatible (also DeepSeek, Ollama, Azure, etc.)
212
+ * - "anthropic" — Anthropic Messages API (also Bedrock/Vertex with Anthropic models)
213
+ * - "custom" — User-provided adapter
214
+ */
215
+ type ModelApiProtocol = "openai" | "anthropic" | "custom";
216
+ /**
217
+ * Descriptor for a registered model provider.
218
+ * Built-in providers are registered at startup; users can register additional
219
+ * providers via config.json `providers` field.
220
+ */
221
+ interface ModelProviderDescriptor {
222
+ type: string;
223
+ displayName: string;
224
+ protocol: ModelApiProtocol;
225
+ defaultBaseUrl?: string;
226
+ apiKey?: string;
227
+ models?: string[];
228
+ }
190
229
  interface InitializerConfig {
191
230
  steps: InitializerStep[];
192
231
  }
@@ -209,6 +248,12 @@ interface AgentInstanceMeta {
209
248
  backendType: AgentBackendType;
210
249
  /** Backend config from template (e.g. executablePath). Persisted so launcher can use without template registry. */
211
250
  backendConfig?: Record<string, unknown>;
251
+ /**
252
+ * Provider config reference (type + protocol + baseUrl only).
253
+ * SECURITY: Never contains apiKey — secrets stay in ~/.actant/config.json
254
+ * and are resolved at runtime from the in-memory registry.
255
+ */
256
+ providerConfig?: ModelProviderConfig;
212
257
  status: AgentStatus;
213
258
  launchMode: LaunchMode;
214
259
  /** Workspace lifecycle policy. "persistent" survives across spawns; "ephemeral" can be cleaned up after task. */
@@ -693,6 +738,34 @@ interface SourceSyncResult {
693
738
  hasBreakingChanges: boolean;
694
739
  };
695
740
  }
741
+ interface SourceValidateParams {
742
+ /** Validate a registered source by name. */
743
+ name?: string;
744
+ /** Validate an arbitrary directory path directly. */
745
+ path?: string;
746
+ /** Treat warnings as errors. */
747
+ strict?: boolean;
748
+ /** Enable compatibility checks against an external standard (e.g. "agent-skills"). */
749
+ compat?: string;
750
+ }
751
+ interface SourceValidationIssueDto {
752
+ severity: "error" | "warning" | "info";
753
+ path: string;
754
+ component?: string;
755
+ message: string;
756
+ code?: string;
757
+ }
758
+ interface SourceValidateResult {
759
+ valid: boolean;
760
+ sourceName: string;
761
+ rootDir: string;
762
+ summary: {
763
+ pass: number;
764
+ warn: number;
765
+ error: number;
766
+ };
767
+ issues: SourceValidationIssueDto[];
768
+ }
696
769
  interface PresetListParams {
697
770
  packageName?: string;
698
771
  }
@@ -987,6 +1060,10 @@ interface RpcMethodMap {
987
1060
  params: SourceSyncParams;
988
1061
  result: SourceSyncResult;
989
1062
  };
1063
+ "source.validate": {
1064
+ params: SourceValidateParams;
1065
+ result: SourceValidateResult;
1066
+ };
990
1067
  "preset.list": {
991
1068
  params: PresetListParams;
992
1069
  result: PresetListResult;
@@ -1141,4 +1218,4 @@ declare function isWindows(): boolean;
1141
1218
  */
1142
1219
  declare function isSingleExecutable(): boolean;
1143
1220
 
1144
- 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 AgentOpenMode, type AgentOpenParams, type AgentOpenResult, 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, type BackendDescriptor, 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 PlatformCommand, 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 };
1221
+ 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 AgentOpenMode, type AgentOpenParams, type AgentOpenResult, 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, type BackendDescriptor, 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 ModelApiProtocol, type ModelProviderConfig, type ModelProviderDescriptor, type ModelProviderType, type PackageManifest, type PermissionMode, type PermissionPreset, type PermissionsConfig, type PermissionsInput, type PlatformCommand, 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 SourceValidateParams, type SourceValidateResult, type SourceValidationIssueDto, 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 };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/rpc.types.ts","../src/errors/base-error.ts","../src/errors/config-errors.ts","../src/errors/lifecycle-errors.ts","../src/logger/logger.ts","../src/platform/platform.ts"],"sourcesContent":["import type { AgentTemplate, PermissionsInput, PermissionsConfig } from \"./template.types\";\nimport type { AgentInstanceMeta, LaunchMode, WorkspacePolicy, ResolveResult, DetachResult } from \"./agent.types\";\nimport type { SkillDefinition, PromptDefinition, McpServerDefinition, WorkflowDefinition, PluginDefinition } from \"./domain-component.types\";\nimport type { SourceEntry, SourceConfig, PresetDefinition } from \"./source.types\";\n\n// ---------------------------------------------------------------------------\n// JSON-RPC 2.0 base types\n// ---------------------------------------------------------------------------\n\nexport interface RpcRequest {\n jsonrpc: \"2.0\";\n id: number | string;\n method: string;\n params?: Record<string, unknown>;\n}\n\nexport interface RpcResponse {\n jsonrpc: \"2.0\";\n id: number | string;\n result?: unknown;\n error?: RpcError;\n}\n\nexport interface RpcError {\n code: number;\n message: string;\n data?: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Error codes — maps ActantError codes to JSON-RPC error codes\n// ---------------------------------------------------------------------------\n\nexport const RPC_ERROR_CODES = {\n PARSE_ERROR: -32700,\n INVALID_REQUEST: -32600,\n METHOD_NOT_FOUND: -32601,\n INVALID_PARAMS: -32602,\n INTERNAL_ERROR: -32603,\n\n TEMPLATE_NOT_FOUND: -32001,\n CONFIG_VALIDATION: -32002,\n AGENT_NOT_FOUND: -32003,\n AGENT_ALREADY_RUNNING: -32004,\n WORKSPACE_INIT: -32005,\n COMPONENT_REFERENCE: -32006,\n INSTANCE_CORRUPTED: -32007,\n AGENT_LAUNCH: -32008,\n AGENT_ALREADY_ATTACHED: -32009,\n AGENT_NOT_ATTACHED: -32010,\n GENERIC_BUSINESS: -32000,\n} as const;\n\nexport type RpcErrorCode = (typeof RPC_ERROR_CODES)[keyof typeof RPC_ERROR_CODES];\n\n// ---------------------------------------------------------------------------\n// Method-specific param/result types\n// ---------------------------------------------------------------------------\n\n// template.*\n\nexport type TemplateListParams = Record<string, never>;\n\nexport type TemplateListResult = AgentTemplate[];\n\nexport interface TemplateGetParams {\n name: string;\n}\n\nexport type TemplateGetResult = AgentTemplate;\n\nexport interface TemplateLoadParams {\n filePath: string;\n}\n\nexport type TemplateLoadResult = AgentTemplate;\n\nexport interface TemplateUnloadParams {\n name: string;\n}\n\nexport interface TemplateUnloadResult {\n success: boolean;\n}\n\nexport interface TemplateValidateParams {\n filePath: string;\n}\n\nexport interface TemplateValidateResult {\n valid: boolean;\n template?: AgentTemplate;\n errors?: Array<{ path: string; message: string }>;\n /** Warnings that don't prevent loading but indicate potential issues (#119) */\n warnings?: Array<{ path: string; message: string }>;\n}\n\n// agent.*\n\nexport type WorkDirConflict = \"error\" | \"overwrite\" | \"append\";\n\nexport interface AgentCreateParams {\n name: string;\n template: string;\n overrides?: {\n launchMode?: LaunchMode;\n workspacePolicy?: WorkspacePolicy;\n /** Absolute path to use as workspace directory instead of the default {instancesDir}/{name}. */\n workDir?: string;\n /** Behavior when workDir already exists. Default: \"error\". */\n workDirConflict?: WorkDirConflict;\n /** Override template permissions. Completely replaces template.permissions when set. */\n permissions?: PermissionsInput;\n metadata?: Record<string, string>;\n };\n}\n\nexport type AgentCreateResult = AgentInstanceMeta;\n\nexport interface AgentStartParams {\n name: string;\n}\n\nexport type AgentStartResult = AgentInstanceMeta;\n\nexport interface AgentStopParams {\n name: string;\n}\n\nexport type AgentStopResult = AgentInstanceMeta;\n\nexport interface AgentDestroyParams {\n name: string;\n}\n\nexport interface AgentDestroyResult {\n success: boolean;\n}\n\nexport interface AgentStatusParams {\n name: string;\n}\n\nexport type AgentStatusResult = AgentInstanceMeta;\n\nexport type AgentListParams = Record<string, never>;\n\nexport type AgentListResult = AgentInstanceMeta[];\n\nexport interface AgentUpdatePermissionsParams {\n name: string;\n permissions: PermissionsInput;\n}\n\nexport interface AgentUpdatePermissionsResult {\n effectivePermissions: PermissionsConfig;\n}\n\nexport interface AgentAdoptParams {\n path: string;\n rename?: string;\n}\n\nexport interface AgentAdoptResult {\n name: string;\n template: string;\n workspacePath: string;\n location: \"builtin\" | \"external\";\n createdAt: string;\n status: \"stopped\" | \"running\" | \"orphaned\";\n}\n\n// agent.resolve / agent.attach / agent.detach (external spawn)\n\nexport interface AgentResolveParams {\n name: string;\n template?: string;\n overrides?: {\n launchMode?: LaunchMode;\n workspacePolicy?: WorkspacePolicy;\n metadata?: Record<string, string>;\n };\n}\n\nexport type AgentResolveResult = ResolveResult;\n\nexport interface AgentOpenParams {\n name: string;\n}\n\nexport interface AgentOpenResult {\n command: string;\n args: string[];\n}\n\nexport interface AgentAttachParams {\n name: string;\n pid: number;\n metadata?: Record<string, string>;\n}\n\nexport type AgentAttachResult = AgentInstanceMeta;\n\nexport interface AgentDetachParams {\n name: string;\n cleanup?: boolean;\n}\n\nexport type AgentDetachResult = DetachResult;\n\n// agent.run\n\nexport interface AgentRunParams {\n name: string;\n prompt: string;\n options?: {\n systemPromptFile?: string;\n appendSystemPrompt?: string;\n sessionId?: string;\n timeoutMs?: number;\n maxTurns?: number;\n model?: string;\n };\n}\n\nexport interface AgentRunResult {\n text: string;\n sessionId?: string;\n}\n\n// agent.dispatch\n\nexport interface AgentDispatchParams {\n name: string;\n prompt: string;\n priority?: string;\n}\nexport interface AgentDispatchResult {\n queued: boolean;\n}\n\n// agent.tasks\n\nexport interface AgentTasksParams {\n name: string;\n}\nexport interface AgentTasksResult {\n queued: number;\n processing: boolean;\n tasks: unknown[];\n}\n\n// agent.logs\n\nexport interface AgentLogsParams {\n name: string;\n limit?: number;\n}\nexport type AgentLogsResult = unknown[];\n\n// schedule.list\n\nexport interface ScheduleListParams {\n name: string;\n}\nexport interface ScheduleListResult {\n sources: Array<{ id: string; type: string; active: boolean }>;\n running: boolean;\n}\n\n// agent.prompt (ACP session)\n\nexport interface AgentPromptParams {\n name: string;\n message: string;\n sessionId?: string;\n}\n\nexport interface AgentPromptResult {\n response: string;\n sessionId: string;\n}\n\n// session.* (Session Lease mode)\n\nexport interface SessionCreateParams {\n agentName: string;\n clientId: string;\n idleTtlMs?: number;\n}\n\nexport interface SessionLeaseInfo {\n sessionId: string;\n agentName: string;\n clientId: string | null;\n state: \"active\" | \"idle\" | \"expired\";\n createdAt: string;\n lastActivityAt: string;\n idleTtlMs: number;\n}\n\nexport type SessionCreateResult = SessionLeaseInfo;\n\nexport interface SessionPromptParams {\n sessionId: string;\n text: string;\n}\n\nexport interface SessionPromptResult {\n stopReason: string;\n text: string;\n}\n\nexport interface SessionCancelParams {\n sessionId: string;\n}\n\nexport interface SessionCancelResult {\n ok: boolean;\n}\n\nexport interface SessionCloseParams {\n sessionId: string;\n}\n\nexport interface SessionCloseResult {\n ok: boolean;\n}\n\nexport interface SessionListParams {\n agentName?: string;\n}\n\nexport type SessionListResult = SessionLeaseInfo[];\n\n// proxy.* (legacy)\n\nexport interface ProxyConnectParams {\n agentName: string;\n envPassthrough?: boolean;\n}\n\nexport interface ProxySession {\n sessionId: string;\n agentName: string;\n envPassthrough: boolean;\n connectedAt: string;\n}\n\nexport type ProxyConnectResult = ProxySession;\n\nexport interface ProxyDisconnectParams {\n sessionId: string;\n}\n\nexport interface ProxyDisconnectResult {\n ok: boolean;\n}\n\nexport interface ProxyForwardParams {\n sessionId: string;\n acpMessage: Record<string, unknown>;\n}\n\nexport type ProxyForwardResult = Record<string, unknown>;\n\n// skill.*\n\nexport type SkillListParams = Record<string, never>;\nexport type SkillListResult = SkillDefinition[];\n\nexport interface SkillGetParams {\n name: string;\n}\nexport type SkillGetResult = SkillDefinition;\n\n// prompt.*\n\nexport type PromptListParams = Record<string, never>;\nexport type PromptListResult = PromptDefinition[];\n\nexport interface PromptGetParams {\n name: string;\n}\nexport type PromptGetResult = PromptDefinition;\n\n// mcp.*\n\nexport type McpListParams = Record<string, never>;\nexport type McpListResult = McpServerDefinition[];\n\nexport interface McpGetParams {\n name: string;\n}\nexport type McpGetResult = McpServerDefinition;\n\n// workflow.*\n\nexport type WorkflowListParams = Record<string, never>;\nexport type WorkflowListResult = WorkflowDefinition[];\n\nexport interface WorkflowGetParams {\n name: string;\n}\nexport type WorkflowGetResult = WorkflowDefinition;\n\n// plugin.*\n\nexport type PluginListParams = Record<string, never>;\nexport type PluginListResult = PluginDefinition[];\n\nexport interface PluginGetParams {\n name: string;\n}\nexport type PluginGetResult = PluginDefinition;\n\n// daemon.*\n\nexport type DaemonPingParams = Record<string, never>;\n\nexport interface DaemonPingResult {\n version: string;\n uptime: number;\n agents: number;\n}\n\nexport type DaemonShutdownParams = Record<string, never>;\n\nexport interface DaemonShutdownResult {\n success: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Gateway lease — request an ACP Gateway socket for Session Lease\n// ---------------------------------------------------------------------------\n\nexport interface GatewayLeaseParams {\n agentName: string;\n}\n\nexport interface GatewayLeaseResult {\n socketPath: string;\n}\n\nexport interface ComponentAddParams {\n component: Record<string, unknown>;\n}\n\nexport interface ComponentAddResult {\n name: string;\n}\n\nexport interface ComponentUpdateParams {\n name: string;\n patch: Record<string, unknown>;\n}\n\nexport interface ComponentUpdateResult {\n name: string;\n}\n\nexport interface ComponentRemoveParams {\n name: string;\n}\n\nexport interface ComponentRemoveResult {\n success: boolean;\n}\n\nexport interface ComponentImportParams {\n filePath: string;\n}\n\nexport interface ComponentImportResult {\n name: string;\n}\n\nexport interface ComponentExportParams {\n name: string;\n filePath: string;\n}\n\nexport interface ComponentExportResult {\n success: boolean;\n}\n\nexport type SourceListParams = Record<string, never>;\nexport type SourceListResult = SourceEntry[];\n\nexport interface SourceAddParams {\n name: string;\n config: SourceConfig;\n}\n\nexport interface SourceAddResult {\n name: string;\n components: { skills: number; prompts: number; mcp: number; workflows: number; presets: number };\n}\n\nexport interface SourceRemoveParams {\n name: string;\n}\n\nexport interface SourceRemoveResult {\n success: boolean;\n}\n\nexport interface SourceSyncParams {\n name?: string;\n}\n\nexport interface SourceSyncResult {\n synced: string[];\n /** Sync report summary (aggregated when syncing multiple sources). */\n report?: {\n addedCount: number;\n updatedCount: number;\n removedCount: number;\n hasBreakingChanges: boolean;\n };\n}\n\nexport interface PresetListParams {\n packageName?: string;\n}\n\nexport type PresetListResult = PresetDefinition[];\n\nexport interface PresetShowParams {\n qualifiedName: string;\n}\n\nexport type PresetShowResult = PresetDefinition;\n\nexport interface PresetApplyParams {\n qualifiedName: string;\n templateName: string;\n}\n\nexport type PresetApplyResult = AgentTemplate;\n\n// ---------------------------------------------------------------------------\n// Method registry type — maps method name to params/result for type safety\n// ---------------------------------------------------------------------------\n\nexport interface RpcMethodMap {\n \"template.list\": { params: TemplateListParams; result: TemplateListResult };\n \"template.get\": { params: TemplateGetParams; result: TemplateGetResult };\n \"template.load\": { params: TemplateLoadParams; result: TemplateLoadResult };\n \"template.unload\": { params: TemplateUnloadParams; result: TemplateUnloadResult };\n \"template.validate\": { params: TemplateValidateParams; result: TemplateValidateResult };\n \"agent.create\": { params: AgentCreateParams; result: AgentCreateResult };\n \"agent.start\": { params: AgentStartParams; result: AgentStartResult };\n \"agent.stop\": { params: AgentStopParams; result: AgentStopResult };\n \"agent.destroy\": { params: AgentDestroyParams; result: AgentDestroyResult };\n \"agent.status\": { params: AgentStatusParams; result: AgentStatusResult };\n \"agent.list\": { params: AgentListParams; result: AgentListResult };\n \"agent.updatePermissions\": { params: AgentUpdatePermissionsParams; result: AgentUpdatePermissionsResult };\n \"agent.adopt\": { params: AgentAdoptParams; result: AgentAdoptResult };\n \"agent.resolve\": { params: AgentResolveParams; result: AgentResolveResult };\n \"agent.open\": { params: AgentOpenParams; result: AgentOpenResult };\n \"agent.attach\": { params: AgentAttachParams; result: AgentAttachResult };\n \"agent.detach\": { params: AgentDetachParams; result: AgentDetachResult };\n \"agent.run\": { params: AgentRunParams; result: AgentRunResult };\n \"agent.prompt\": { params: AgentPromptParams; result: AgentPromptResult };\n \"agent.dispatch\": { params: AgentDispatchParams; result: AgentDispatchResult };\n \"agent.tasks\": { params: AgentTasksParams; result: AgentTasksResult };\n \"agent.logs\": { params: AgentLogsParams; result: AgentLogsResult };\n \"schedule.list\": { params: ScheduleListParams; result: ScheduleListResult };\n \"session.create\": { params: SessionCreateParams; result: SessionCreateResult };\n \"session.prompt\": { params: SessionPromptParams; result: SessionPromptResult };\n \"session.cancel\": { params: SessionCancelParams; result: SessionCancelResult };\n \"session.close\": { params: SessionCloseParams; result: SessionCloseResult };\n \"session.list\": { params: SessionListParams; result: SessionListResult };\n \"proxy.connect\": { params: ProxyConnectParams; result: ProxyConnectResult };\n \"proxy.disconnect\": { params: ProxyDisconnectParams; result: ProxyDisconnectResult };\n \"proxy.forward\": { params: ProxyForwardParams; result: ProxyForwardResult };\n \"skill.list\": { params: SkillListParams; result: SkillListResult };\n \"skill.get\": { params: SkillGetParams; result: SkillGetResult };\n \"skill.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"skill.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"skill.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"skill.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"skill.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"prompt.list\": { params: PromptListParams; result: PromptListResult };\n \"prompt.get\": { params: PromptGetParams; result: PromptGetResult };\n \"prompt.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"prompt.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"prompt.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"prompt.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"prompt.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"mcp.list\": { params: McpListParams; result: McpListResult };\n \"mcp.get\": { params: McpGetParams; result: McpGetResult };\n \"mcp.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"mcp.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"mcp.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"mcp.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"mcp.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"workflow.list\": { params: WorkflowListParams; result: WorkflowListResult };\n \"workflow.get\": { params: WorkflowGetParams; result: WorkflowGetResult };\n \"workflow.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"workflow.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"workflow.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"workflow.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"workflow.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"plugin.list\": { params: PluginListParams; result: PluginListResult };\n \"plugin.get\": { params: PluginGetParams; result: PluginGetResult };\n \"plugin.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"plugin.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"plugin.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"plugin.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"plugin.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"source.list\": { params: SourceListParams; result: SourceListResult };\n \"source.add\": { params: SourceAddParams; result: SourceAddResult };\n \"source.remove\": { params: SourceRemoveParams; result: SourceRemoveResult };\n \"source.sync\": { params: SourceSyncParams; result: SourceSyncResult };\n \"preset.list\": { params: PresetListParams; result: PresetListResult };\n \"preset.show\": { params: PresetShowParams; result: PresetShowResult };\n \"preset.apply\": { params: PresetApplyParams; result: PresetApplyResult };\n \"daemon.ping\": { params: DaemonPingParams; result: DaemonPingResult };\n \"daemon.shutdown\": { params: DaemonShutdownParams; result: DaemonShutdownResult };\n \"gateway.lease\": { params: GatewayLeaseParams; result: GatewayLeaseResult };\n}\n\nexport type RpcMethod = keyof RpcMethodMap;\n","export type ErrorCategory =\n | \"configuration\"\n | \"lifecycle\"\n | \"communication\"\n | \"cli\";\n\nexport abstract class ActantError extends Error {\n abstract readonly code: string;\n abstract readonly category: ErrorCategory;\n readonly timestamp: Date;\n readonly context?: Record<string, unknown>;\n\n constructor(message: string, context?: Record<string, unknown>) {\n super(message);\n this.name = this.constructor.name;\n this.timestamp = new Date();\n this.context = context;\n }\n}\n","import { ActantError, type ErrorCategory } from \"./base-error\";\nimport type { ValidationIssue } from \"../types/validation.types\";\n\nexport class ConfigNotFoundError extends ActantError {\n readonly code = \"CONFIG_NOT_FOUND\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(configPath: string) {\n super(`Configuration file not found: ${configPath}`, { configPath });\n }\n}\n\nexport class ConfigValidationError extends ActantError {\n readonly code = \"CONFIG_VALIDATION_ERROR\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(\n message: string,\n public readonly validationErrors: Array<{\n path: string;\n message: string;\n }>,\n /** Structured validation issues with severity (#119) */\n public readonly issues?: ValidationIssue[],\n ) {\n super(message, { validationErrors });\n }\n}\n\nexport class TemplateNotFoundError extends ActantError {\n readonly code = \"TEMPLATE_NOT_FOUND\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(templateName: string) {\n super(`Template \"${templateName}\" not found in registry`, {\n templateName,\n });\n }\n}\n\nexport class SkillReferenceError extends ActantError {\n readonly code = \"SKILL_REFERENCE_ERROR\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(skillName: string) {\n super(`Skill \"${skillName}\" not found in registry`, { skillName });\n }\n}\n\nexport class ComponentReferenceError extends ActantError {\n readonly code = \"COMPONENT_REFERENCE_ERROR\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(componentType: string, componentName: string) {\n super(`${componentType} \"${componentName}\" not found in registry`, {\n componentType,\n componentName,\n });\n }\n}\n\nexport class CircularReferenceError extends ActantError {\n readonly code = \"CIRCULAR_REFERENCE\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(cyclePath: string[]) {\n super(`Circular reference detected: ${cyclePath.join(\" → \")}`, {\n cyclePath,\n });\n }\n}\n","import { ActantError, type ErrorCategory } from \"./base-error\";\n\nexport class AgentLaunchError extends ActantError {\n readonly code = \"AGENT_LAUNCH_ERROR\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string, cause?: Error) {\n super(`Failed to launch agent \"${instanceName}\"`, {\n instanceName,\n cause: cause?.message,\n });\n if (cause) this.cause = cause;\n }\n}\n\nexport class AgentNotFoundError extends ActantError {\n readonly code = \"AGENT_NOT_FOUND\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string) {\n super(`Agent instance \"${instanceName}\" not found`, { instanceName });\n }\n}\n\nexport class AgentAlreadyRunningError extends ActantError {\n readonly code = \"AGENT_ALREADY_RUNNING\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string) {\n super(`Agent \"${instanceName}\" is already running`, { instanceName });\n }\n}\n\nexport class AgentAlreadyAttachedError extends ActantError {\n readonly code = \"AGENT_ALREADY_ATTACHED\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string) {\n super(`Agent \"${instanceName}\" already has an attached process`, { instanceName });\n }\n}\n\nexport class AgentNotAttachedError extends ActantError {\n readonly code = \"AGENT_NOT_ATTACHED\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string) {\n super(`Agent \"${instanceName}\" has no attached process`, { instanceName });\n }\n}\n\nexport class InstanceCorruptedError extends ActantError {\n readonly code = \"INSTANCE_CORRUPTED\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string, reason: string) {\n super(\n `Agent instance \"${instanceName}\" is corrupted: ${reason}`,\n { instanceName, reason },\n );\n }\n}\n\nexport class WorkspaceInitError extends ActantError {\n readonly code = \"WORKSPACE_INIT_ERROR\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(workspacePath: string, cause?: Error) {\n super(`Failed to initialize workspace at \"${workspacePath}\"`, {\n workspacePath,\n cause: cause?.message,\n });\n if (cause) this.cause = cause;\n }\n}\n","import pino from \"pino\";\n\nexport type Logger = pino.Logger;\n\nfunction resolveLogLevel(): string {\n if (process.env[\"LOG_LEVEL\"]) return process.env[\"LOG_LEVEL\"];\n if (process.env[\"VITEST\"] || process.env[\"NODE_ENV\"] === \"test\") return \"silent\";\n return \"info\";\n}\n\nexport function createLogger(module: string): Logger {\n return pino({\n name: module,\n level: resolveLogLevel(),\n formatters: {\n level(label: string) {\n return { level: label };\n },\n },\n timestamp: pino.stdTimeFunctions.isoTime,\n });\n}\n","import { join } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nconst IS_WINDOWS = process.platform === \"win32\";\n\n/**\n * Returns the platform-appropriate IPC path for daemon communication.\n *\n * - macOS/Linux: Unix domain socket at `~/.actant/actant.sock`\n * - Windows: Named pipe derived from homeDir (e.g. `\\\\.\\pipe\\actant-...`)\n *\n * Delegates to {@link getIpcPath} to ensure CLI and daemon always\n * resolve to the same path for a given homeDir.\n */\nexport function getDefaultIpcPath(homeDir?: string): string {\n const base = homeDir ?? join(homedir(), \".actant\");\n return getIpcPath(base);\n}\n\n/**\n * Returns the IPC path for a given home directory.\n * Used by AppContext when homeDir is explicitly provided.\n */\nexport function getIpcPath(homeDir: string): string {\n if (IS_WINDOWS) {\n const safeName = homeDir.replace(/[^a-zA-Z0-9._-]/g, \"_\");\n return `\\\\\\\\.\\\\pipe\\\\actant-${safeName}`;\n }\n return join(homeDir, \"actant.sock\");\n}\n\n/**\n * Whether the current platform uses file-based IPC (Unix sockets)\n * that may need cleanup (unlink) before listening.\n */\nexport function ipcRequiresFileCleanup(): boolean {\n return !IS_WINDOWS;\n}\n\n/**\n * Registers graceful shutdown handlers that work across all platforms.\n *\n * - Unix: SIGINT, SIGTERM\n * - Windows: SIGINT (Ctrl+C in terminal), SIGBREAK (Ctrl+Break)\n *\n * SIGTERM is not reliably delivered on Windows, so we also listen for\n * SIGBREAK which is the closest equivalent.\n */\nexport function onShutdownSignal(handler: () => void | Promise<void>): void {\n const wrappedHandler = () => {\n void Promise.resolve(handler());\n };\n\n process.on(\"SIGINT\", wrappedHandler);\n\n if (IS_WINDOWS) {\n process.on(\"SIGBREAK\", wrappedHandler);\n } else {\n process.on(\"SIGTERM\", wrappedHandler);\n }\n}\n\nexport function isWindows(): boolean {\n return IS_WINDOWS;\n}\n\nlet _isSea = false;\nlet _isSeaChecked = false;\n\n/**\n * Detects if the process is running as a Node.js Single Executable Application.\n * Uses `node:sea` module (Node 20+) with a fallback heuristic.\n */\nexport function isSingleExecutable(): boolean {\n if (_isSeaChecked) return _isSea;\n _isSeaChecked = true;\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const sea = require(\"node:sea\");\n _isSea = typeof sea.isSea === \"function\" ? sea.isSea() : false;\n } catch {\n _isSea = false;\n }\n return _isSea;\n}\n"],"mappings":";;;;;;;;AAiCO,IAAM,kBAAkB;AAAA,EAC7B,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAEhB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,wBAAwB;AAAA,EACxB,oBAAoB;AAAA,EACpB,kBAAkB;AACpB;;;AC7CO,IAAe,cAAf,cAAmC,MAAM;AAAA,EAGrC;AAAA,EACA;AAAA,EAET,YAAY,SAAiB,SAAmC;AAC9D,UAAM,OAAO;AACb,SAAK,OAAO,KAAK,YAAY;AAC7B,SAAK,YAAY,oBAAI,KAAK;AAC1B,SAAK,UAAU;AAAA,EACjB;AACF;;;ACfO,IAAM,sBAAN,cAAkC,YAAY;AAAA,EAC1C,OAAO;AAAA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AAA,EACX;AACA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../src/types/rpc.types.ts","../src/errors/base-error.ts","../src/errors/config-errors.ts","../src/errors/lifecycle-errors.ts","../src/logger/logger.ts","../src/platform/platform.ts"],"sourcesContent":["import type { AgentTemplate, PermissionsInput, PermissionsConfig } from \"./template.types\";\nimport type { AgentInstanceMeta, LaunchMode, WorkspacePolicy, ResolveResult, DetachResult } from \"./agent.types\";\nimport type { SkillDefinition, PromptDefinition, McpServerDefinition, WorkflowDefinition, PluginDefinition } from \"./domain-component.types\";\nimport type { SourceEntry, SourceConfig, PresetDefinition } from \"./source.types\";\n\n// ---------------------------------------------------------------------------\n// JSON-RPC 2.0 base types\n// ---------------------------------------------------------------------------\n\nexport interface RpcRequest {\n jsonrpc: \"2.0\";\n id: number | string;\n method: string;\n params?: Record<string, unknown>;\n}\n\nexport interface RpcResponse {\n jsonrpc: \"2.0\";\n id: number | string;\n result?: unknown;\n error?: RpcError;\n}\n\nexport interface RpcError {\n code: number;\n message: string;\n data?: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Error codes — maps ActantError codes to JSON-RPC error codes\n// ---------------------------------------------------------------------------\n\nexport const RPC_ERROR_CODES = {\n PARSE_ERROR: -32700,\n INVALID_REQUEST: -32600,\n METHOD_NOT_FOUND: -32601,\n INVALID_PARAMS: -32602,\n INTERNAL_ERROR: -32603,\n\n TEMPLATE_NOT_FOUND: -32001,\n CONFIG_VALIDATION: -32002,\n AGENT_NOT_FOUND: -32003,\n AGENT_ALREADY_RUNNING: -32004,\n WORKSPACE_INIT: -32005,\n COMPONENT_REFERENCE: -32006,\n INSTANCE_CORRUPTED: -32007,\n AGENT_LAUNCH: -32008,\n AGENT_ALREADY_ATTACHED: -32009,\n AGENT_NOT_ATTACHED: -32010,\n GENERIC_BUSINESS: -32000,\n} as const;\n\nexport type RpcErrorCode = (typeof RPC_ERROR_CODES)[keyof typeof RPC_ERROR_CODES];\n\n// ---------------------------------------------------------------------------\n// Method-specific param/result types\n// ---------------------------------------------------------------------------\n\n// template.*\n\nexport type TemplateListParams = Record<string, never>;\n\nexport type TemplateListResult = AgentTemplate[];\n\nexport interface TemplateGetParams {\n name: string;\n}\n\nexport type TemplateGetResult = AgentTemplate;\n\nexport interface TemplateLoadParams {\n filePath: string;\n}\n\nexport type TemplateLoadResult = AgentTemplate;\n\nexport interface TemplateUnloadParams {\n name: string;\n}\n\nexport interface TemplateUnloadResult {\n success: boolean;\n}\n\nexport interface TemplateValidateParams {\n filePath: string;\n}\n\nexport interface TemplateValidateResult {\n valid: boolean;\n template?: AgentTemplate;\n errors?: Array<{ path: string; message: string }>;\n /** Warnings that don't prevent loading but indicate potential issues (#119) */\n warnings?: Array<{ path: string; message: string }>;\n}\n\n// agent.*\n\nexport type WorkDirConflict = \"error\" | \"overwrite\" | \"append\";\n\nexport interface AgentCreateParams {\n name: string;\n template: string;\n overrides?: {\n launchMode?: LaunchMode;\n workspacePolicy?: WorkspacePolicy;\n /** Absolute path to use as workspace directory instead of the default {instancesDir}/{name}. */\n workDir?: string;\n /** Behavior when workDir already exists. Default: \"error\". */\n workDirConflict?: WorkDirConflict;\n /** Override template permissions. Completely replaces template.permissions when set. */\n permissions?: PermissionsInput;\n metadata?: Record<string, string>;\n };\n}\n\nexport type AgentCreateResult = AgentInstanceMeta;\n\nexport interface AgentStartParams {\n name: string;\n}\n\nexport type AgentStartResult = AgentInstanceMeta;\n\nexport interface AgentStopParams {\n name: string;\n}\n\nexport type AgentStopResult = AgentInstanceMeta;\n\nexport interface AgentDestroyParams {\n name: string;\n}\n\nexport interface AgentDestroyResult {\n success: boolean;\n}\n\nexport interface AgentStatusParams {\n name: string;\n}\n\nexport type AgentStatusResult = AgentInstanceMeta;\n\nexport type AgentListParams = Record<string, never>;\n\nexport type AgentListResult = AgentInstanceMeta[];\n\nexport interface AgentUpdatePermissionsParams {\n name: string;\n permissions: PermissionsInput;\n}\n\nexport interface AgentUpdatePermissionsResult {\n effectivePermissions: PermissionsConfig;\n}\n\nexport interface AgentAdoptParams {\n path: string;\n rename?: string;\n}\n\nexport interface AgentAdoptResult {\n name: string;\n template: string;\n workspacePath: string;\n location: \"builtin\" | \"external\";\n createdAt: string;\n status: \"stopped\" | \"running\" | \"orphaned\";\n}\n\n// agent.resolve / agent.attach / agent.detach (external spawn)\n\nexport interface AgentResolveParams {\n name: string;\n template?: string;\n overrides?: {\n launchMode?: LaunchMode;\n workspacePolicy?: WorkspacePolicy;\n metadata?: Record<string, string>;\n };\n}\n\nexport type AgentResolveResult = ResolveResult;\n\nexport interface AgentOpenParams {\n name: string;\n}\n\nexport interface AgentOpenResult {\n command: string;\n args: string[];\n}\n\nexport interface AgentAttachParams {\n name: string;\n pid: number;\n metadata?: Record<string, string>;\n}\n\nexport type AgentAttachResult = AgentInstanceMeta;\n\nexport interface AgentDetachParams {\n name: string;\n cleanup?: boolean;\n}\n\nexport type AgentDetachResult = DetachResult;\n\n// agent.run\n\nexport interface AgentRunParams {\n name: string;\n prompt: string;\n options?: {\n systemPromptFile?: string;\n appendSystemPrompt?: string;\n sessionId?: string;\n timeoutMs?: number;\n maxTurns?: number;\n model?: string;\n };\n}\n\nexport interface AgentRunResult {\n text: string;\n sessionId?: string;\n}\n\n// agent.dispatch\n\nexport interface AgentDispatchParams {\n name: string;\n prompt: string;\n priority?: string;\n}\nexport interface AgentDispatchResult {\n queued: boolean;\n}\n\n// agent.tasks\n\nexport interface AgentTasksParams {\n name: string;\n}\nexport interface AgentTasksResult {\n queued: number;\n processing: boolean;\n tasks: unknown[];\n}\n\n// agent.logs\n\nexport interface AgentLogsParams {\n name: string;\n limit?: number;\n}\nexport type AgentLogsResult = unknown[];\n\n// schedule.list\n\nexport interface ScheduleListParams {\n name: string;\n}\nexport interface ScheduleListResult {\n sources: Array<{ id: string; type: string; active: boolean }>;\n running: boolean;\n}\n\n// agent.prompt (ACP session)\n\nexport interface AgentPromptParams {\n name: string;\n message: string;\n sessionId?: string;\n}\n\nexport interface AgentPromptResult {\n response: string;\n sessionId: string;\n}\n\n// session.* (Session Lease mode)\n\nexport interface SessionCreateParams {\n agentName: string;\n clientId: string;\n idleTtlMs?: number;\n}\n\nexport interface SessionLeaseInfo {\n sessionId: string;\n agentName: string;\n clientId: string | null;\n state: \"active\" | \"idle\" | \"expired\";\n createdAt: string;\n lastActivityAt: string;\n idleTtlMs: number;\n}\n\nexport type SessionCreateResult = SessionLeaseInfo;\n\nexport interface SessionPromptParams {\n sessionId: string;\n text: string;\n}\n\nexport interface SessionPromptResult {\n stopReason: string;\n text: string;\n}\n\nexport interface SessionCancelParams {\n sessionId: string;\n}\n\nexport interface SessionCancelResult {\n ok: boolean;\n}\n\nexport interface SessionCloseParams {\n sessionId: string;\n}\n\nexport interface SessionCloseResult {\n ok: boolean;\n}\n\nexport interface SessionListParams {\n agentName?: string;\n}\n\nexport type SessionListResult = SessionLeaseInfo[];\n\n// proxy.* (legacy)\n\nexport interface ProxyConnectParams {\n agentName: string;\n envPassthrough?: boolean;\n}\n\nexport interface ProxySession {\n sessionId: string;\n agentName: string;\n envPassthrough: boolean;\n connectedAt: string;\n}\n\nexport type ProxyConnectResult = ProxySession;\n\nexport interface ProxyDisconnectParams {\n sessionId: string;\n}\n\nexport interface ProxyDisconnectResult {\n ok: boolean;\n}\n\nexport interface ProxyForwardParams {\n sessionId: string;\n acpMessage: Record<string, unknown>;\n}\n\nexport type ProxyForwardResult = Record<string, unknown>;\n\n// skill.*\n\nexport type SkillListParams = Record<string, never>;\nexport type SkillListResult = SkillDefinition[];\n\nexport interface SkillGetParams {\n name: string;\n}\nexport type SkillGetResult = SkillDefinition;\n\n// prompt.*\n\nexport type PromptListParams = Record<string, never>;\nexport type PromptListResult = PromptDefinition[];\n\nexport interface PromptGetParams {\n name: string;\n}\nexport type PromptGetResult = PromptDefinition;\n\n// mcp.*\n\nexport type McpListParams = Record<string, never>;\nexport type McpListResult = McpServerDefinition[];\n\nexport interface McpGetParams {\n name: string;\n}\nexport type McpGetResult = McpServerDefinition;\n\n// workflow.*\n\nexport type WorkflowListParams = Record<string, never>;\nexport type WorkflowListResult = WorkflowDefinition[];\n\nexport interface WorkflowGetParams {\n name: string;\n}\nexport type WorkflowGetResult = WorkflowDefinition;\n\n// plugin.*\n\nexport type PluginListParams = Record<string, never>;\nexport type PluginListResult = PluginDefinition[];\n\nexport interface PluginGetParams {\n name: string;\n}\nexport type PluginGetResult = PluginDefinition;\n\n// daemon.*\n\nexport type DaemonPingParams = Record<string, never>;\n\nexport interface DaemonPingResult {\n version: string;\n uptime: number;\n agents: number;\n}\n\nexport type DaemonShutdownParams = Record<string, never>;\n\nexport interface DaemonShutdownResult {\n success: boolean;\n}\n\n// ---------------------------------------------------------------------------\n// Gateway lease — request an ACP Gateway socket for Session Lease\n// ---------------------------------------------------------------------------\n\nexport interface GatewayLeaseParams {\n agentName: string;\n}\n\nexport interface GatewayLeaseResult {\n socketPath: string;\n}\n\nexport interface ComponentAddParams {\n component: Record<string, unknown>;\n}\n\nexport interface ComponentAddResult {\n name: string;\n}\n\nexport interface ComponentUpdateParams {\n name: string;\n patch: Record<string, unknown>;\n}\n\nexport interface ComponentUpdateResult {\n name: string;\n}\n\nexport interface ComponentRemoveParams {\n name: string;\n}\n\nexport interface ComponentRemoveResult {\n success: boolean;\n}\n\nexport interface ComponentImportParams {\n filePath: string;\n}\n\nexport interface ComponentImportResult {\n name: string;\n}\n\nexport interface ComponentExportParams {\n name: string;\n filePath: string;\n}\n\nexport interface ComponentExportResult {\n success: boolean;\n}\n\nexport type SourceListParams = Record<string, never>;\nexport type SourceListResult = SourceEntry[];\n\nexport interface SourceAddParams {\n name: string;\n config: SourceConfig;\n}\n\nexport interface SourceAddResult {\n name: string;\n components: { skills: number; prompts: number; mcp: number; workflows: number; presets: number };\n}\n\nexport interface SourceRemoveParams {\n name: string;\n}\n\nexport interface SourceRemoveResult {\n success: boolean;\n}\n\nexport interface SourceSyncParams {\n name?: string;\n}\n\nexport interface SourceSyncResult {\n synced: string[];\n /** Sync report summary (aggregated when syncing multiple sources). */\n report?: {\n addedCount: number;\n updatedCount: number;\n removedCount: number;\n hasBreakingChanges: boolean;\n };\n}\n\nexport interface SourceValidateParams {\n /** Validate a registered source by name. */\n name?: string;\n /** Validate an arbitrary directory path directly. */\n path?: string;\n /** Treat warnings as errors. */\n strict?: boolean;\n /** Enable compatibility checks against an external standard (e.g. \"agent-skills\"). */\n compat?: string;\n}\n\nexport interface SourceValidationIssueDto {\n severity: \"error\" | \"warning\" | \"info\";\n path: string;\n component?: string;\n message: string;\n code?: string;\n}\n\nexport interface SourceValidateResult {\n valid: boolean;\n sourceName: string;\n rootDir: string;\n summary: { pass: number; warn: number; error: number };\n issues: SourceValidationIssueDto[];\n}\n\nexport interface PresetListParams {\n packageName?: string;\n}\n\nexport type PresetListResult = PresetDefinition[];\n\nexport interface PresetShowParams {\n qualifiedName: string;\n}\n\nexport type PresetShowResult = PresetDefinition;\n\nexport interface PresetApplyParams {\n qualifiedName: string;\n templateName: string;\n}\n\nexport type PresetApplyResult = AgentTemplate;\n\n// ---------------------------------------------------------------------------\n// Method registry type — maps method name to params/result for type safety\n// ---------------------------------------------------------------------------\n\nexport interface RpcMethodMap {\n \"template.list\": { params: TemplateListParams; result: TemplateListResult };\n \"template.get\": { params: TemplateGetParams; result: TemplateGetResult };\n \"template.load\": { params: TemplateLoadParams; result: TemplateLoadResult };\n \"template.unload\": { params: TemplateUnloadParams; result: TemplateUnloadResult };\n \"template.validate\": { params: TemplateValidateParams; result: TemplateValidateResult };\n \"agent.create\": { params: AgentCreateParams; result: AgentCreateResult };\n \"agent.start\": { params: AgentStartParams; result: AgentStartResult };\n \"agent.stop\": { params: AgentStopParams; result: AgentStopResult };\n \"agent.destroy\": { params: AgentDestroyParams; result: AgentDestroyResult };\n \"agent.status\": { params: AgentStatusParams; result: AgentStatusResult };\n \"agent.list\": { params: AgentListParams; result: AgentListResult };\n \"agent.updatePermissions\": { params: AgentUpdatePermissionsParams; result: AgentUpdatePermissionsResult };\n \"agent.adopt\": { params: AgentAdoptParams; result: AgentAdoptResult };\n \"agent.resolve\": { params: AgentResolveParams; result: AgentResolveResult };\n \"agent.open\": { params: AgentOpenParams; result: AgentOpenResult };\n \"agent.attach\": { params: AgentAttachParams; result: AgentAttachResult };\n \"agent.detach\": { params: AgentDetachParams; result: AgentDetachResult };\n \"agent.run\": { params: AgentRunParams; result: AgentRunResult };\n \"agent.prompt\": { params: AgentPromptParams; result: AgentPromptResult };\n \"agent.dispatch\": { params: AgentDispatchParams; result: AgentDispatchResult };\n \"agent.tasks\": { params: AgentTasksParams; result: AgentTasksResult };\n \"agent.logs\": { params: AgentLogsParams; result: AgentLogsResult };\n \"schedule.list\": { params: ScheduleListParams; result: ScheduleListResult };\n \"session.create\": { params: SessionCreateParams; result: SessionCreateResult };\n \"session.prompt\": { params: SessionPromptParams; result: SessionPromptResult };\n \"session.cancel\": { params: SessionCancelParams; result: SessionCancelResult };\n \"session.close\": { params: SessionCloseParams; result: SessionCloseResult };\n \"session.list\": { params: SessionListParams; result: SessionListResult };\n \"proxy.connect\": { params: ProxyConnectParams; result: ProxyConnectResult };\n \"proxy.disconnect\": { params: ProxyDisconnectParams; result: ProxyDisconnectResult };\n \"proxy.forward\": { params: ProxyForwardParams; result: ProxyForwardResult };\n \"skill.list\": { params: SkillListParams; result: SkillListResult };\n \"skill.get\": { params: SkillGetParams; result: SkillGetResult };\n \"skill.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"skill.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"skill.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"skill.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"skill.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"prompt.list\": { params: PromptListParams; result: PromptListResult };\n \"prompt.get\": { params: PromptGetParams; result: PromptGetResult };\n \"prompt.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"prompt.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"prompt.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"prompt.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"prompt.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"mcp.list\": { params: McpListParams; result: McpListResult };\n \"mcp.get\": { params: McpGetParams; result: McpGetResult };\n \"mcp.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"mcp.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"mcp.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"mcp.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"mcp.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"workflow.list\": { params: WorkflowListParams; result: WorkflowListResult };\n \"workflow.get\": { params: WorkflowGetParams; result: WorkflowGetResult };\n \"workflow.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"workflow.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"workflow.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"workflow.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"workflow.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"plugin.list\": { params: PluginListParams; result: PluginListResult };\n \"plugin.get\": { params: PluginGetParams; result: PluginGetResult };\n \"plugin.add\": { params: ComponentAddParams; result: ComponentAddResult };\n \"plugin.update\": { params: ComponentUpdateParams; result: ComponentUpdateResult };\n \"plugin.remove\": { params: ComponentRemoveParams; result: ComponentRemoveResult };\n \"plugin.import\": { params: ComponentImportParams; result: ComponentImportResult };\n \"plugin.export\": { params: ComponentExportParams; result: ComponentExportResult };\n \"source.list\": { params: SourceListParams; result: SourceListResult };\n \"source.add\": { params: SourceAddParams; result: SourceAddResult };\n \"source.remove\": { params: SourceRemoveParams; result: SourceRemoveResult };\n \"source.sync\": { params: SourceSyncParams; result: SourceSyncResult };\n \"source.validate\": { params: SourceValidateParams; result: SourceValidateResult };\n \"preset.list\": { params: PresetListParams; result: PresetListResult };\n \"preset.show\": { params: PresetShowParams; result: PresetShowResult };\n \"preset.apply\": { params: PresetApplyParams; result: PresetApplyResult };\n \"daemon.ping\": { params: DaemonPingParams; result: DaemonPingResult };\n \"daemon.shutdown\": { params: DaemonShutdownParams; result: DaemonShutdownResult };\n \"gateway.lease\": { params: GatewayLeaseParams; result: GatewayLeaseResult };\n}\n\nexport type RpcMethod = keyof RpcMethodMap;\n","export type ErrorCategory =\n | \"configuration\"\n | \"lifecycle\"\n | \"communication\"\n | \"cli\";\n\nexport abstract class ActantError extends Error {\n abstract readonly code: string;\n abstract readonly category: ErrorCategory;\n readonly timestamp: Date;\n readonly context?: Record<string, unknown>;\n\n constructor(message: string, context?: Record<string, unknown>) {\n super(message);\n this.name = this.constructor.name;\n this.timestamp = new Date();\n this.context = context;\n }\n}\n","import { ActantError, type ErrorCategory } from \"./base-error\";\nimport type { ValidationIssue } from \"../types/validation.types\";\n\nexport class ConfigNotFoundError extends ActantError {\n readonly code = \"CONFIG_NOT_FOUND\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(configPath: string) {\n super(`Configuration file not found: ${configPath}`, { configPath });\n }\n}\n\nexport class ConfigValidationError extends ActantError {\n readonly code = \"CONFIG_VALIDATION_ERROR\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(\n message: string,\n public readonly validationErrors: Array<{\n path: string;\n message: string;\n }>,\n /** Structured validation issues with severity (#119) */\n public readonly issues?: ValidationIssue[],\n ) {\n super(message, { validationErrors });\n }\n}\n\nexport class TemplateNotFoundError extends ActantError {\n readonly code = \"TEMPLATE_NOT_FOUND\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(templateName: string) {\n super(`Template \"${templateName}\" not found in registry`, {\n templateName,\n });\n }\n}\n\nexport class SkillReferenceError extends ActantError {\n readonly code = \"SKILL_REFERENCE_ERROR\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(skillName: string) {\n super(`Skill \"${skillName}\" not found in registry`, { skillName });\n }\n}\n\nexport class ComponentReferenceError extends ActantError {\n readonly code = \"COMPONENT_REFERENCE_ERROR\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(componentType: string, componentName: string) {\n super(`${componentType} \"${componentName}\" not found in registry`, {\n componentType,\n componentName,\n });\n }\n}\n\nexport class CircularReferenceError extends ActantError {\n readonly code = \"CIRCULAR_REFERENCE\";\n readonly category: ErrorCategory = \"configuration\";\n\n constructor(cyclePath: string[]) {\n super(`Circular reference detected: ${cyclePath.join(\" → \")}`, {\n cyclePath,\n });\n }\n}\n","import { ActantError, type ErrorCategory } from \"./base-error\";\n\nexport class AgentLaunchError extends ActantError {\n readonly code = \"AGENT_LAUNCH_ERROR\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string, cause?: Error) {\n super(`Failed to launch agent \"${instanceName}\"`, {\n instanceName,\n cause: cause?.message,\n });\n if (cause) this.cause = cause;\n }\n}\n\nexport class AgentNotFoundError extends ActantError {\n readonly code = \"AGENT_NOT_FOUND\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string) {\n super(`Agent instance \"${instanceName}\" not found`, { instanceName });\n }\n}\n\nexport class AgentAlreadyRunningError extends ActantError {\n readonly code = \"AGENT_ALREADY_RUNNING\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string) {\n super(`Agent \"${instanceName}\" is already running`, { instanceName });\n }\n}\n\nexport class AgentAlreadyAttachedError extends ActantError {\n readonly code = \"AGENT_ALREADY_ATTACHED\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string) {\n super(`Agent \"${instanceName}\" already has an attached process`, { instanceName });\n }\n}\n\nexport class AgentNotAttachedError extends ActantError {\n readonly code = \"AGENT_NOT_ATTACHED\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string) {\n super(`Agent \"${instanceName}\" has no attached process`, { instanceName });\n }\n}\n\nexport class InstanceCorruptedError extends ActantError {\n readonly code = \"INSTANCE_CORRUPTED\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(instanceName: string, reason: string) {\n super(\n `Agent instance \"${instanceName}\" is corrupted: ${reason}`,\n { instanceName, reason },\n );\n }\n}\n\nexport class WorkspaceInitError extends ActantError {\n readonly code = \"WORKSPACE_INIT_ERROR\";\n readonly category: ErrorCategory = \"lifecycle\";\n\n constructor(workspacePath: string, cause?: Error) {\n super(`Failed to initialize workspace at \"${workspacePath}\"`, {\n workspacePath,\n cause: cause?.message,\n });\n if (cause) this.cause = cause;\n }\n}\n","import pino from \"pino\";\n\nexport type Logger = pino.Logger;\n\nfunction resolveLogLevel(): string {\n if (process.env[\"LOG_LEVEL\"]) return process.env[\"LOG_LEVEL\"];\n if (process.env[\"VITEST\"] || process.env[\"NODE_ENV\"] === \"test\") return \"silent\";\n return \"info\";\n}\n\nexport function createLogger(module: string): Logger {\n return pino({\n name: module,\n level: resolveLogLevel(),\n formatters: {\n level(label: string) {\n return { level: label };\n },\n },\n timestamp: pino.stdTimeFunctions.isoTime,\n });\n}\n","import { join } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nconst IS_WINDOWS = process.platform === \"win32\";\n\n/**\n * Returns the platform-appropriate IPC path for daemon communication.\n *\n * - macOS/Linux: Unix domain socket at `~/.actant/actant.sock`\n * - Windows: Named pipe derived from homeDir (e.g. `\\\\.\\pipe\\actant-...`)\n *\n * Delegates to {@link getIpcPath} to ensure CLI and daemon always\n * resolve to the same path for a given homeDir.\n */\nexport function getDefaultIpcPath(homeDir?: string): string {\n const base = homeDir ?? join(homedir(), \".actant\");\n return getIpcPath(base);\n}\n\n/**\n * Returns the IPC path for a given home directory.\n * Used by AppContext when homeDir is explicitly provided.\n */\nexport function getIpcPath(homeDir: string): string {\n if (IS_WINDOWS) {\n const safeName = homeDir.replace(/[^a-zA-Z0-9._-]/g, \"_\");\n return `\\\\\\\\.\\\\pipe\\\\actant-${safeName}`;\n }\n return join(homeDir, \"actant.sock\");\n}\n\n/**\n * Whether the current platform uses file-based IPC (Unix sockets)\n * that may need cleanup (unlink) before listening.\n */\nexport function ipcRequiresFileCleanup(): boolean {\n return !IS_WINDOWS;\n}\n\n/**\n * Registers graceful shutdown handlers that work across all platforms.\n *\n * - Unix: SIGINT, SIGTERM\n * - Windows: SIGINT (Ctrl+C in terminal), SIGBREAK (Ctrl+Break)\n *\n * SIGTERM is not reliably delivered on Windows, so we also listen for\n * SIGBREAK which is the closest equivalent.\n */\nexport function onShutdownSignal(handler: () => void | Promise<void>): void {\n const wrappedHandler = () => {\n void Promise.resolve(handler());\n };\n\n process.on(\"SIGINT\", wrappedHandler);\n\n if (IS_WINDOWS) {\n process.on(\"SIGBREAK\", wrappedHandler);\n } else {\n process.on(\"SIGTERM\", wrappedHandler);\n }\n}\n\nexport function isWindows(): boolean {\n return IS_WINDOWS;\n}\n\nlet _isSea = false;\nlet _isSeaChecked = false;\n\n/**\n * Detects if the process is running as a Node.js Single Executable Application.\n * Uses `node:sea` module (Node 20+) with a fallback heuristic.\n */\nexport function isSingleExecutable(): boolean {\n if (_isSeaChecked) return _isSea;\n _isSeaChecked = true;\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const sea = require(\"node:sea\");\n _isSea = typeof sea.isSea === \"function\" ? sea.isSea() : false;\n } catch {\n _isSea = false;\n }\n return _isSea;\n}\n"],"mappings":";;;;;;;;AAiCO,IAAM,kBAAkB;AAAA,EAC7B,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAEhB,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,wBAAwB;AAAA,EACxB,oBAAoB;AAAA,EACpB,kBAAkB;AACpB;;;AC7CO,IAAe,cAAf,cAAmC,MAAM;AAAA,EAGrC;AAAA,EAC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b,IAAI,gBAAgB;AAMb,SAAS,qBAA8B;AAC5C,MAAI,cAAe,QAAO;AAC1B,kBAAgB;AAChB,MAAI;AAEF,UAAM,MAAM,UAAQ,KAAU;AAC9B,aAAS,OAAO,IAAI,UAAU,aAAa,IAAI,MAAM,IAAI;AAAA,EAC3D,QAAQ;AACN,aAAS;AAAA,EACX;AACA,SAAO;AACT;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actant/shared",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Shared utilities and types for the Actant AI agent platform",
5
5
  "type": "module",
6
6
  "license": "MIT",