@actant/core 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.
@@ -100,16 +100,22 @@ function parseSkillMdContent(raw) {
100
100
  if (actantTags) {
101
101
  tags.push(...actantTags.split(",").map((t) => t.trim()).filter(Boolean));
102
102
  }
103
+ const allowedToolsRaw = meta["allowed-tools"];
104
+ const allowedTools = allowedToolsRaw ? allowedToolsRaw.split(/\s+/).filter(Boolean) : void 0;
103
105
  return {
104
106
  name,
105
107
  description: meta.description || void 0,
106
108
  version: meta["metadata.version"] || meta.version || void 0,
107
109
  content,
108
- tags: tags.length > 0 ? tags : void 0
110
+ tags: tags.length > 0 ? tags : void 0,
111
+ license: meta.license || void 0,
112
+ compatibility: meta.compatibility || void 0,
113
+ allowedTools
109
114
  };
110
115
  }
116
+
111
117
  export {
112
118
  parseSkillMd,
113
119
  parseSkillMdContent
114
120
  };
115
- //# sourceMappingURL=skill-md-parser-2HXC4AAW.js.map
121
+ //# sourceMappingURL=chunk-DYGZP4MW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/source/skill-md-parser.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport type { SkillDefinition } from \"@actant/shared\";\n\n/**\n * Parses a SKILL.md file (Agent Skills / skill.sh format) into a SkillDefinition.\n * Format:\n * ---\n * name: skill-name\n * description: ...\n * license: MIT\n * metadata:\n * author: ...\n * version: \"1.0.0\"\n * actant-tags: \"tag1,tag2\"\n * ---\n *\n * # Skill content starts here...\n */\nexport async function parseSkillMd(filePath: string): Promise<SkillDefinition | null> {\n try {\n const raw = await readFile(filePath, \"utf-8\");\n return parseSkillMdContent(raw);\n } catch {\n return null;\n }\n}\n\n/**\n * Parses YAML frontmatter, handling single-line, quoted, and block scalar values.\n * Supports: key: value, key: \"quoted\", key: | (literal block), key: > (folded block).\n */\nfunction parseYamlFrontmatter(frontmatter: string): Record<string, string> {\n const meta: Record<string, string> = {};\n const lines = frontmatter.split(\"\\n\");\n let i = 0;\n let inMetadata = false;\n\n while (i < lines.length) {\n const line = lines[i];\n if (line === undefined) break;\n const trimmed = line.trim();\n\n if (trimmed === \"metadata:\") {\n inMetadata = true;\n i++;\n continue;\n }\n\n const isNested = inMetadata && (line.startsWith(\" \") || line.startsWith(\"\\t\"));\n const keyPrefix = isNested ? \"metadata.\" : \"\";\n\n const blockMatch = trimmed.match(/^(\\w[\\w-]*)\\s*:\\s*(\\||>)\\s*$/);\n if (blockMatch) {\n const key = keyPrefix + (blockMatch[1] ?? \"\");\n if (!isNested) inMetadata = false;\n\n const keyLineIndent = line.search(/\\S/);\n const blockIndent = keyLineIndent >= 0 ? keyLineIndent : line.length;\n const blockLines: string[] = [];\n i++;\n\n while (i < lines.length) {\n const nextLine = lines[i];\n if (nextLine === undefined) break;\n const nextIndent = nextLine.search(/\\S/);\n const isEmpty = nextLine.trim() === \"\";\n\n if (isEmpty) {\n blockLines.push(nextLine);\n i++;\n continue;\n }\n if (nextIndent !== -1 && nextIndent <= blockIndent) {\n break;\n }\n blockLines.push(nextLine);\n i++;\n }\n\n const nonEmpty = blockLines.filter((l) => l.trim() !== \"\");\n const minIndent =\n nonEmpty.length > 0 ? Math.min(...nonEmpty.map((l) => l.search(/\\S/))) : 0;\n meta[key] =\n blockMatch[2] === \"|\"\n ? blockLines\n .map((l) => (l.trim() === \"\" ? \"\" : l.slice(minIndent)))\n .join(\"\\n\")\n .trimEnd()\n : blockLines.map((l) => l.trim()).join(\" \").trim();\n continue;\n }\n\n const quotedMatch = trimmed.match(/^(\\w[\\w-]*)\\s*:\\s*\"((?:[^\"\\\\]|\\\\.)*)\"\\s*$/);\n if (quotedMatch) {\n const key = keyPrefix + (quotedMatch[1] ?? \"\");\n if (!isNested) inMetadata = false;\n try {\n meta[key] = JSON.parse(`\"${(quotedMatch[2] ?? \"\").replace(/\\\\/g, \"\\\\\\\\\")}\"`);\n } catch {\n meta[key] = (quotedMatch[2] ?? \"\").replace(/\\\\\"/g, '\"');\n }\n i++;\n continue;\n }\n\n const match = trimmed.match(/^(\\w[\\w-]*)\\s*:\\s*(.*)$/);\n if (match?.[1] !== undefined) {\n const key = keyPrefix + match[1];\n if (!isNested) inMetadata = false;\n let value = (match[2] ?? \"\").trim();\n if (value.startsWith('\"') && value.endsWith('\"')) {\n try {\n value = JSON.parse(value);\n } catch {\n value = value.slice(1, -1).replace(/\\\\\"/g, '\"');\n }\n }\n meta[key] = value;\n i++;\n continue;\n }\n\n if (!isNested) inMetadata = false;\n i++;\n }\n\n return meta;\n}\n\nexport function parseSkillMdContent(raw: string): SkillDefinition | null {\n // Check for YAML frontmatter\n if (!raw.startsWith(\"---\")) return null;\n\n const endIdx = raw.indexOf(\"---\", 3);\n if (endIdx === -1) return null;\n\n const frontmatter = raw.substring(3, endIdx).trim();\n const content = raw.substring(endIdx + 3).trim();\n\n // YAML parsing (handles single-line, quoted, and block scalars)\n const meta = parseYamlFrontmatter(frontmatter);\n\n const name = meta.name;\n if (!name) return null;\n\n const tags: string[] = [];\n const actantTags = meta[\"metadata.actant-tags\"];\n if (actantTags) {\n tags.push(...actantTags.split(\",\").map((t) => t.trim()).filter(Boolean));\n }\n\n return {\n name,\n description: meta.description || undefined,\n version: meta[\"metadata.version\"] || meta.version || undefined,\n content,\n tags: tags.length > 0 ? tags : undefined,\n };\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAkBzB,eAAsB,aAAa,UAAmD;AACpF,MAAI;AACF,UAAM,MAAM,MAAM,SAAS,UAAU,OAAO;AAC5C,WAAO,oBAAoB,GAAG;AAAA,EAChC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMA,SAAS,qBAAqB,aAA6C;AACzE,QAAM,OAA+B,CAAC;AACtC,QAAM,QAAQ,YAAY,MAAM,IAAI;AACpC,MAAI,IAAI;AACR,MAAI,aAAa;AAEjB,SAAO,IAAI,MAAM,QAAQ;AACvB,UAAM,OAAO,MAAM,CAAC;AACpB,QAAI,SAAS,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KAAK,sBAAsB;AAC9C,MAAI,YAAY;AACd,SAAK,KAAK,GAAG,WAAW,MAAM,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,OAAO,CAAC;AAAA,EACzE;AAEA,SAAO;AAAA,IACL;AAAA,IACA,aAAa,KAAK,eAAe;AAAA,IACjC,SAAS,KAAK,kBAAkB,KAAK,KAAK,WAAW;AAAA,IACrD;AAAA,IACA,MAAM,KAAK,SAAS,IAAI,OAAO;AAAA,EACjC;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/source/skill-md-parser.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport type { SkillDefinition } from \"@actant/shared\";\n\n/**\n * Parses a SKILL.md file (Agent Skills / skill.sh format) into a SkillDefinition.\n * Format:\n * ---\n * name: skill-name\n * description: ...\n * license: MIT\n * metadata:\n * author: ...\n * version: \"1.0.0\"\n * actant-tags: \"tag1,tag2\"\n * ---\n *\n * # Skill content starts here...\n */\nexport async function parseSkillMd(filePath: string): Promise<SkillDefinition | null> {\n try {\n const raw = await readFile(filePath, \"utf-8\");\n return parseSkillMdContent(raw);\n } catch {\n return null;\n }\n}\n\n/**\n * Parses YAML frontmatter, handling single-line, quoted, and block scalar values.\n * Supports: key: value, key: \"quoted\", key: | (literal block), key: > (folded block).\n */\nfunction parseYamlFrontmatter(frontmatter: string): Record<string, string> {\n const meta: Record<string, string> = {};\n const lines = frontmatter.split(\"\\n\");\n let i = 0;\n let inMetadata = false;\n\n while (i < lines.length) {\n const line = lines[i];\n if (line === undefined) break;\n const trimmed = line.trim();\n\n if (trimmed === \"metadata:\") {\n inMetadata = true;\n i++;\n continue;\n }\n\n const isNested = inMetadata && (line.startsWith(\" \") || line.startsWith(\"\\t\"));\n const keyPrefix = isNested ? \"metadata.\" : \"\";\n\n const blockMatch = trimmed.match(/^(\\w[\\w-]*)\\s*:\\s*(\\||>)\\s*$/);\n if (blockMatch) {\n const key = keyPrefix + (blockMatch[1] ?? \"\");\n if (!isNested) inMetadata = false;\n\n const keyLineIndent = line.search(/\\S/);\n const blockIndent = keyLineIndent >= 0 ? keyLineIndent : line.length;\n const blockLines: string[] = [];\n i++;\n\n while (i < lines.length) {\n const nextLine = lines[i];\n if (nextLine === undefined) break;\n const nextIndent = nextLine.search(/\\S/);\n const isEmpty = nextLine.trim() === \"\";\n\n if (isEmpty) {\n blockLines.push(nextLine);\n i++;\n continue;\n }\n if (nextIndent !== -1 && nextIndent <= blockIndent) {\n break;\n }\n blockLines.push(nextLine);\n i++;\n }\n\n const nonEmpty = blockLines.filter((l) => l.trim() !== \"\");\n const minIndent =\n nonEmpty.length > 0 ? Math.min(...nonEmpty.map((l) => l.search(/\\S/))) : 0;\n meta[key] =\n blockMatch[2] === \"|\"\n ? blockLines\n .map((l) => (l.trim() === \"\" ? \"\" : l.slice(minIndent)))\n .join(\"\\n\")\n .trimEnd()\n : blockLines.map((l) => l.trim()).join(\" \").trim();\n continue;\n }\n\n const quotedMatch = trimmed.match(/^(\\w[\\w-]*)\\s*:\\s*\"((?:[^\"\\\\]|\\\\.)*)\"\\s*$/);\n if (quotedMatch) {\n const key = keyPrefix + (quotedMatch[1] ?? \"\");\n if (!isNested) inMetadata = false;\n try {\n meta[key] = JSON.parse(`\"${(quotedMatch[2] ?? \"\").replace(/\\\\/g, \"\\\\\\\\\")}\"`);\n } catch {\n meta[key] = (quotedMatch[2] ?? \"\").replace(/\\\\\"/g, '\"');\n }\n i++;\n continue;\n }\n\n const match = trimmed.match(/^(\\w[\\w-]*)\\s*:\\s*(.*)$/);\n if (match?.[1] !== undefined) {\n const key = keyPrefix + match[1];\n if (!isNested) inMetadata = false;\n let value = (match[2] ?? \"\").trim();\n if (value.startsWith('\"') && value.endsWith('\"')) {\n try {\n value = JSON.parse(value);\n } catch {\n value = value.slice(1, -1).replace(/\\\\\"/g, '\"');\n }\n }\n meta[key] = value;\n i++;\n continue;\n }\n\n if (!isNested) inMetadata = false;\n i++;\n }\n\n return meta;\n}\n\nexport function parseSkillMdContent(raw: string): SkillDefinition | null {\n // Check for YAML frontmatter\n if (!raw.startsWith(\"---\")) return null;\n\n const endIdx = raw.indexOf(\"---\", 3);\n if (endIdx === -1) return null;\n\n const frontmatter = raw.substring(3, endIdx).trim();\n const content = raw.substring(endIdx + 3).trim();\n\n // YAML parsing (handles single-line, quoted, and block scalars)\n const meta = parseYamlFrontmatter(frontmatter);\n\n const name = meta.name;\n if (!name) return null;\n\n const tags: string[] = [];\n const actantTags = meta[\"metadata.actant-tags\"];\n if (actantTags) {\n tags.push(...actantTags.split(\",\").map((t) => t.trim()).filter(Boolean));\n }\n\n const allowedToolsRaw = meta[\"allowed-tools\"];\n const allowedTools = allowedToolsRaw\n ? allowedToolsRaw.split(/\\s+/).filter(Boolean)\n : undefined;\n\n return {\n name,\n description: meta.description || undefined,\n version: meta[\"metadata.version\"] || meta.version || undefined,\n content,\n tags: tags.length > 0 ? tags : undefined,\n license: meta.license || undefined,\n compatibility: meta.compatibility || undefined,\n allowedTools,\n };\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AAkBzB,eAAsB,aAAa,UAAmD;AACpF,MAAI;AACF,UAAM,MAAM,MAAM,SAAS,UAAU,OAAO;AAC5C,WAAO,oBAAoB,GAAG;AAAA,EAChC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAMA,SAAS,qBAAqB,aAA6C;AACzE,QAAM,OAA+B,CAAC;AACtC,QAAM,QAAQ,YAAY,MAAM,IAAI;AACpC,MAAI,IAAI;AACR,MAAI,aAAa;AAEjB,SAAO,IAAI,MAAM,QAAQ;AACvB,UAAM,OAAO,MAAM,CAAC;AACpB,QAAI,SAAS,OAAW;AACxB,UAAM,UAAU,KAAK,KAAK;AAE1B,QAAI,YAAY,aAAa;AAC3B,mBAAa;AACb;AACA;AAAA,IACF;AAEA,UAAM,WAAW,eAAe,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,GAAI;AAC7E,UAAM,YAAY,WAAW,cAAc;AAE3C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AAe,kBACjB,gBAAgB,MAAM,KAAK,EAAE,OAAO,OAAO,IAC3C;AAEJ,SAAO;AAAA,IACL;AAAA,IACA,aAAa,KAAK,eAAe;AAAA,IACjC,SAAS,KAAK,kBAAkB,KAAK,KAAK,WAAW;AAAA,IACrD;AAAA,IACA,MAAM,KAAK,SAAS,IAAI,OAAO;AAAA,IAC/B,SAAS,KAAK,WAAW;AAAA,IACzB,eAAe,KAAK,iBAAiB;AAAA,IACrC;AAAA,EACF;AACF;","names":[]}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AgentBackendType, SkillDefinition, PromptDefinition, McpServerDefinition, PluginDefinition, WorkflowDefinition, PermissionsInput, Logger, ConfigValidationResult, DomainContextConfig, AgentBackendConfig, ModelProviderConfig, AgentTemplate, AgentInstanceMeta, LaunchMode, WorkspacePolicy, WorkDirConflict, InitializerStep, AgentStatus, ResolveResult, DetachResult, BackendDescriptor, AgentOpenMode, PermissionsConfig, SourceConfig, PackageManifest, PresetDefinition, GitHubSourceConfig, LocalSourceConfig, SourceEntry } from '@actant/shared';
1
+ import { AgentBackendType, SkillDefinition, PromptDefinition, McpServerDefinition, PluginDefinition, WorkflowDefinition, PermissionsInput, Logger, ConfigValidationResult, DomainContextConfig, AgentBackendConfig, ModelProviderConfig, AgentTemplate, AgentInstanceMeta, LaunchMode, WorkspacePolicy, WorkDirConflict, InitializerStep, AgentStatus, ResolveResult, DetachResult, BackendDescriptor, AgentOpenMode, PermissionsConfig, SourceConfig, PackageManifest, PresetDefinition, GitHubSourceConfig, LocalSourceConfig, SourceEntry, ModelProviderDescriptor } from '@actant/shared';
2
2
  import { z } from 'zod/v4';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import { Writable, Readable } from 'node:stream';
@@ -538,21 +538,32 @@ declare const AgentBackendSchema: z.ZodObject<{
538
538
  }>;
539
539
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
540
540
  }, z.core.$strip>;
541
- declare const ModelProviderSchema: z.ZodObject<{
542
- type: z.ZodEnum<{
541
+ declare const ModelApiProtocolEnum: z.ZodEnum<{
542
+ custom: "custom";
543
+ openai: "openai";
544
+ anthropic: "anthropic";
545
+ }>;
546
+ type ApiProtocol = z.infer<typeof ModelApiProtocolEnum>;
547
+ declare const ModelProviderSchema: z.ZodPipe<z.ZodObject<{
548
+ type: z.ZodString;
549
+ protocol: z.ZodOptional<z.ZodEnum<{
543
550
  custom: "custom";
544
- anthropic: "anthropic";
545
551
  openai: "openai";
546
- "openai-compatible": "openai-compatible";
547
- }>;
548
- protocol: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
549
- http: "http";
550
- websocket: "websocket";
551
- grpc: "grpc";
552
- }>>>;
552
+ anthropic: "anthropic";
553
+ }>>;
553
554
  baseUrl: z.ZodOptional<z.ZodString>;
554
555
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
555
- }, z.core.$strip>;
556
+ }, z.core.$strip>, z.ZodTransform<{
557
+ protocol: ApiProtocol;
558
+ type: string;
559
+ baseUrl?: string | undefined;
560
+ config?: Record<string, unknown> | undefined;
561
+ }, {
562
+ type: string;
563
+ protocol?: "custom" | "openai" | "anthropic" | undefined;
564
+ baseUrl?: string | undefined;
565
+ config?: Record<string, unknown> | undefined;
566
+ }>>;
556
567
  declare const InitializerStepSchema: z.ZodObject<{
557
568
  type: z.ZodString;
558
569
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -656,21 +667,26 @@ declare const AgentTemplateSchema: z.ZodObject<{
656
667
  }>;
657
668
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
658
669
  }, z.core.$strip>;
659
- provider: z.ZodObject<{
660
- type: z.ZodEnum<{
670
+ provider: z.ZodOptional<z.ZodPipe<z.ZodObject<{
671
+ type: z.ZodString;
672
+ protocol: z.ZodOptional<z.ZodEnum<{
661
673
  custom: "custom";
662
- anthropic: "anthropic";
663
674
  openai: "openai";
664
- "openai-compatible": "openai-compatible";
665
- }>;
666
- protocol: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
667
- http: "http";
668
- websocket: "websocket";
669
- grpc: "grpc";
670
- }>>>;
675
+ anthropic: "anthropic";
676
+ }>>;
671
677
  baseUrl: z.ZodOptional<z.ZodString>;
672
678
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
673
- }, z.core.$strip>;
679
+ }, z.core.$strip>, z.ZodTransform<{
680
+ protocol: ApiProtocol;
681
+ type: string;
682
+ baseUrl?: string | undefined;
683
+ config?: Record<string, unknown> | undefined;
684
+ }, {
685
+ type: string;
686
+ protocol?: "custom" | "openai" | "anthropic" | undefined;
687
+ baseUrl?: string | undefined;
688
+ config?: Record<string, unknown> | undefined;
689
+ }>>>;
674
690
  domainContext: z.ZodObject<{
675
691
  skills: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
676
692
  prompts: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
@@ -1150,6 +1166,16 @@ declare const AgentInstanceMetaSchema: z.ZodObject<{
1150
1166
  pi: "pi";
1151
1167
  }>>;
1152
1168
  backendConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1169
+ providerConfig: z.ZodOptional<z.ZodObject<{
1170
+ type: z.ZodString;
1171
+ protocol: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
1172
+ custom: "custom";
1173
+ openai: "openai";
1174
+ anthropic: "anthropic";
1175
+ }>>>;
1176
+ baseUrl: z.ZodOptional<z.ZodString>;
1177
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1178
+ }, z.core.$strip>>;
1153
1179
  status: z.ZodEnum<{
1154
1180
  error: "error";
1155
1181
  running: "running";
@@ -1937,6 +1963,8 @@ interface ComponentSource {
1937
1963
  readonly type: string;
1938
1964
  readonly packageName: string;
1939
1965
  readonly config: SourceConfig;
1966
+ /** Filesystem root directory for this source's content. */
1967
+ getRootDir(): string;
1940
1968
  fetch(): Promise<FetchResult>;
1941
1969
  sync(): Promise<FetchResult>;
1942
1970
  dispose(): Promise<void>;
@@ -1952,6 +1980,7 @@ declare class GitHubSource implements ComponentSource {
1952
1980
  readonly config: GitHubSourceConfig;
1953
1981
  private readonly cacheDir;
1954
1982
  constructor(packageName: string, config: GitHubSourceConfig, cacheDir: string);
1983
+ getRootDir(): string;
1955
1984
  fetch(): Promise<FetchResult>;
1956
1985
  sync(): Promise<FetchResult>;
1957
1986
  dispose(): Promise<void>;
@@ -1965,6 +1994,7 @@ declare class LocalSource implements ComponentSource {
1965
1994
  readonly packageName: string;
1966
1995
  readonly config: LocalSourceConfig;
1967
1996
  constructor(packageName: string, config: LocalSourceConfig);
1997
+ getRootDir(): string;
1968
1998
  fetch(): Promise<FetchResult>;
1969
1999
  sync(): Promise<FetchResult>;
1970
2000
  dispose(): Promise<void>;
@@ -2029,6 +2059,8 @@ declare class SourceManager {
2029
2059
  removeSource(name: string): Promise<boolean>;
2030
2060
  listSources(): SourceEntry[];
2031
2061
  hasSource(name: string): boolean;
2062
+ /** Resolve a registered source name to its filesystem root directory. */
2063
+ getSourceRootDir(name: string): string;
2032
2064
  listPresets(packageName?: string): PresetDefinition[];
2033
2065
  getPreset(qualifiedName: string): PresetDefinition | undefined;
2034
2066
  /**
@@ -2053,4 +2085,83 @@ declare class SourceManager {
2053
2085
  private buildSyncReport;
2054
2086
  }
2055
2087
 
2056
- export { AgentBackendSchema, type AgentCommunicator, AgentInitializer, AgentInstanceMetaSchema, type AgentLauncher, AgentManager, type AgentProcess, AgentStatusSchema, type AgentTask, type AgentTemplateInput, type AgentTemplateOutput, AgentTemplateSchema, type AuditEntry, type BackendBuilder, BaseComponentManager, ClaudeCodeBuilder, ClaudeCodeCommunicator, type CommunicatorFactory, ComponentOriginSchema, type ComponentSource, type ComponentTypeHandler, ContextMaterializer, type CreateSessionOptions, type CronConfig, CronConfigSchema, CronInput, CursorBuilder, CursorCommunicator, CustomBuilder, type CustomBuilderConfig, DEFAULT_RESTART_POLICY, DEFAULT_SOURCE_CONFIG, DEFAULT_SOURCE_NAME, DomainContextSchema, type DomainManagers$1 as DomainManagers, EmployeeScheduler, ExecStep, ExecutionLog, type ExecutionRecord, type FetchResult, FileCopyStep, GitCloneStep, GitHubSource, type HeartbeatConfig, HeartbeatConfigSchema, HeartbeatInput, type HookConfig, HookConfigSchema, HookInput, InitializationPipeline, type InitializerOptions, InitializerSchema, InitializerStepExecutor, InitializerStepSchema, InputRouter, type InputSource, type InstanceOverrides, InstanceRegistry, type InstanceRegistryAdapter, type InstanceRegistryData, type InstanceRegistryEntry, type LaunchModeHandler, LaunchModeSchema, type LauncherConfig, type LauncherMode, LocalSource, type ManagerOptions, McpConfigManager, McpServerRefSchema, MkdirStep, MockLauncher, ModelProviderSchema, type NamedComponent, NpmInstallStep, type PermissionAuditEvent, PermissionAuditLogger, PermissionPolicyEnforcer, PermissionPresetSchema, PermissionsInputSchema, PermissionsObjectSchema, type PipelineOptions, type PipelineResult, PluginManager, type PolicyAction, type PolicyDecision, type ProcessExitAction, type ProcessExitHandler, type ProcessExitInfo, ProcessLauncher, type ProcessLauncherOptions, ProcessLogWriter, type ProcessLogWriterOptions, ProcessWatcher, type ProcessWatcherOptions, type PromptAgentFn, PromptManager, type PromptResult, type RecoveryAction, type RegistryOptions, type ResolvedBackend, type RestartDecision, type RestartPolicy, RestartTracker, type RunPromptOptions, type ScheduleConfig, type ScheduleConfigInput, ScheduleConfigSchema, type SessionLease, SessionRegistry, type SessionRegistryOptions, type SessionState, SkillManager, SourceManager, type SourceManagerDeps, type SourceManagerOptions, type StepContext, StepRegistry, type StepResult, type StepValidationResult, type StreamChunk, type TaskCallback, TaskDispatcher, type TaskPriority, TaskQueue, type TaskStatus, TemplateFileWatcher, type TemplateFileWatcherOptions, TemplateLoader, TemplateRegistry, type ToolCallInfo, type VerifyResult, WorkflowManager, type WorkspaceBuildResult, WorkspaceBuilder, createCommunicator, createDefaultStepRegistry, createLauncher, getBackendDescriptor, getLaunchModeHandler, globMatch, isAcpBackend, isAcpOnlyBackend, isProcessAlive, metaFilePath, openBackend, readInstanceMeta, registerBackend, registerCommunicator, requireMode, resolveAcpBackend, resolveBackend, resolvePermissions, resolvePermissionsWithMcp, scanInstances, supportsMode, toAgentTemplate, updateInstanceMeta, validateBackendConfig, validateDomainContextConfig, validatePermissionsConfig, validateProviderConfig, validateScheduleConfig, validateTemplate, writeInstanceMeta };
2088
+ interface SourceValidationIssue {
2089
+ severity: "error" | "warning" | "info";
2090
+ path: string;
2091
+ component?: string;
2092
+ message: string;
2093
+ code?: string;
2094
+ }
2095
+ interface SourceValidationReport {
2096
+ valid: boolean;
2097
+ sourceName: string;
2098
+ rootDir: string;
2099
+ summary: {
2100
+ pass: number;
2101
+ warn: number;
2102
+ error: number;
2103
+ };
2104
+ issues: SourceValidationIssue[];
2105
+ }
2106
+ type CompatMode = "agent-skills";
2107
+ interface ValidateOptions {
2108
+ strict?: boolean;
2109
+ /** Enable compatibility checks against an external standard. */
2110
+ compat?: CompatMode;
2111
+ }
2112
+ declare class SourceValidator {
2113
+ /**
2114
+ * Validate all assets in a source directory.
2115
+ * Returns a report with pass/warn/error counts and detailed issues.
2116
+ */
2117
+ validate(rootDir: string, options?: ValidateOptions): Promise<SourceValidationReport>;
2118
+ private validateManifest;
2119
+ private verifyManifestFileRefs;
2120
+ private validateExplicitFiles;
2121
+ private validateComponentDirs;
2122
+ private scanDirectory;
2123
+ private validateSingleFile;
2124
+ private validateTemplateComponent;
2125
+ private validateSkillMd;
2126
+ private validateAgentSkillsCompat;
2127
+ private validateSkillDirConventions;
2128
+ private validatePresetReferences;
2129
+ private trackComponentName;
2130
+ }
2131
+
2132
+ /**
2133
+ * Registry for model provider descriptors.
2134
+ *
2135
+ * Sources (registered at startup in this order):
2136
+ * 1. Built-in providers (anthropic, openai, deepseek, ...)
2137
+ * 2. Default provider from config.json `provider` field
2138
+ * 3. User-registered providers from config.json `providers` field
2139
+ *
2140
+ * Consumers:
2141
+ * - Zod schema validation (warning for unknown types)
2142
+ * - CLI setup wizard (dynamic provider list)
2143
+ * - AgentInitializer (resolve default when template omits provider)
2144
+ * - AgentManager (resolve provider → env vars for ACP)
2145
+ */
2146
+ declare class ModelProviderRegistry {
2147
+ private readonly descriptors;
2148
+ private defaultType;
2149
+ register(descriptor: ModelProviderDescriptor): void;
2150
+ get(type: string): ModelProviderDescriptor | undefined;
2151
+ getOrThrow(type: string): ModelProviderDescriptor;
2152
+ has(type: string): boolean;
2153
+ list(): ModelProviderDescriptor[];
2154
+ setDefault(type: string): void;
2155
+ getDefault(): ModelProviderDescriptor | undefined;
2156
+ getDefaultType(): string | undefined;
2157
+ /** @internal Test-only: clear all registrations. */
2158
+ _reset(): void;
2159
+ }
2160
+ /** Singleton instance used throughout the application. */
2161
+ declare const modelProviderRegistry: ModelProviderRegistry;
2162
+
2163
+ declare const BUILTIN_PROVIDERS: readonly ModelProviderDescriptor[];
2164
+ /** Register all built-in providers into the singleton registry. */
2165
+ declare function registerBuiltinProviders(): void;
2166
+
2167
+ export { AgentBackendSchema, type AgentCommunicator, AgentInitializer, AgentInstanceMetaSchema, type AgentLauncher, AgentManager, type AgentProcess, AgentStatusSchema, type AgentTask, type AgentTemplateInput, type AgentTemplateOutput, AgentTemplateSchema, type AuditEntry, BUILTIN_PROVIDERS, type BackendBuilder, BaseComponentManager, ClaudeCodeBuilder, ClaudeCodeCommunicator, type CommunicatorFactory, type CompatMode, ComponentOriginSchema, type ComponentSource, type ComponentTypeHandler, ContextMaterializer, type CreateSessionOptions, type CronConfig, CronConfigSchema, CronInput, CursorBuilder, CursorCommunicator, CustomBuilder, type CustomBuilderConfig, DEFAULT_RESTART_POLICY, DEFAULT_SOURCE_CONFIG, DEFAULT_SOURCE_NAME, DomainContextSchema, type DomainManagers$1 as DomainManagers, EmployeeScheduler, ExecStep, ExecutionLog, type ExecutionRecord, type FetchResult, FileCopyStep, GitCloneStep, GitHubSource, type HeartbeatConfig, HeartbeatConfigSchema, HeartbeatInput, type HookConfig, HookConfigSchema, HookInput, InitializationPipeline, type InitializerOptions, InitializerSchema, InitializerStepExecutor, InitializerStepSchema, InputRouter, type InputSource, type InstanceOverrides, InstanceRegistry, type InstanceRegistryAdapter, type InstanceRegistryData, type InstanceRegistryEntry, type LaunchModeHandler, LaunchModeSchema, type LauncherConfig, type LauncherMode, LocalSource, type ManagerOptions, McpConfigManager, McpServerRefSchema, MkdirStep, MockLauncher, ModelProviderRegistry, ModelProviderSchema, type NamedComponent, NpmInstallStep, type PermissionAuditEvent, PermissionAuditLogger, PermissionPolicyEnforcer, PermissionPresetSchema, PermissionsInputSchema, PermissionsObjectSchema, type PipelineOptions, type PipelineResult, PluginManager, type PolicyAction, type PolicyDecision, type ProcessExitAction, type ProcessExitHandler, type ProcessExitInfo, ProcessLauncher, type ProcessLauncherOptions, ProcessLogWriter, type ProcessLogWriterOptions, ProcessWatcher, type ProcessWatcherOptions, type PromptAgentFn, PromptManager, type PromptResult, type RecoveryAction, type RegistryOptions, type ResolvedBackend, type RestartDecision, type RestartPolicy, RestartTracker, type RunPromptOptions, type ScheduleConfig, type ScheduleConfigInput, ScheduleConfigSchema, type SessionLease, SessionRegistry, type SessionRegistryOptions, type SessionState, SkillManager, SourceManager, type SourceManagerDeps, type SourceManagerOptions, type SourceValidationIssue, type SourceValidationReport, SourceValidator, type StepContext, StepRegistry, type StepResult, type StepValidationResult, type StreamChunk, type TaskCallback, TaskDispatcher, type TaskPriority, TaskQueue, type TaskStatus, TemplateFileWatcher, type TemplateFileWatcherOptions, TemplateLoader, TemplateRegistry, type ToolCallInfo, type ValidateOptions, type VerifyResult, WorkflowManager, type WorkspaceBuildResult, WorkspaceBuilder, createCommunicator, createDefaultStepRegistry, createLauncher, getBackendDescriptor, getLaunchModeHandler, globMatch, isAcpBackend, isAcpOnlyBackend, isProcessAlive, metaFilePath, modelProviderRegistry, openBackend, readInstanceMeta, registerBackend, registerBuiltinProviders, registerCommunicator, requireMode, resolveAcpBackend, resolveBackend, resolvePermissions, resolvePermissionsWithMcp, scanInstances, supportsMode, toAgentTemplate, updateInstanceMeta, validateBackendConfig, validateDomainContextConfig, validatePermissionsConfig, validateProviderConfig, validateScheduleConfig, validateTemplate, writeInstanceMeta };