@cardor/agent-harness-kit 1.10.5 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -5,27 +5,6 @@ interface ProjectConfig {
5
5
  docsPath: string;
6
6
  agentsMd?: string | null;
7
7
  }
8
- interface AgentConfig {
9
- instructionsPath: string | null;
10
- context?: string;
11
- allowedPaths?: string[];
12
- writablePaths?: string[];
13
- model?: string;
14
- }
15
- interface CustomAgentConfig {
16
- name: string;
17
- instructionsPath: string;
18
- }
19
- interface AgentsConfig {
20
- lead: AgentConfig;
21
- explorer: AgentConfig;
22
- builder: AgentConfig;
23
- reviewer: AgentConfig;
24
- /** Optional — the consultant agent has no dedicated config entry elsewhere;
25
- * this exists primarily to carry a per-agent `model` override. */
26
- consultant?: AgentConfig;
27
- custom?: CustomAgentConfig[];
28
- }
29
8
  type TasksAdapter = 'local' | 'jira' | 'linear' | 'mcp';
30
9
  interface ActionSections {
31
10
  toolsUsed: boolean;
@@ -108,7 +87,6 @@ interface ToolsConfig {
108
87
  interface HarnessConfig {
109
88
  project: ProjectConfig;
110
89
  provider: Provider;
111
- agents: AgentsConfig;
112
90
  storage: StorageConfig;
113
91
  database: DatabaseConfig;
114
92
  health: HealthConfig;
@@ -148,4 +126,4 @@ interface TaskSeed {
148
126
 
149
127
  declare function defineHarness(config: HarnessConfig): HarnessConfig;
150
128
 
151
- export { type ActionRow, type ActionSections, type ActionStatus, type AgentConfig, type AgentName, type AgentsConfig, type CustomAgentConfig, type HarnessConfig, type HealthConfig, type ProjectConfig, type Provider, type StorageConfig, type TaskRow, type TaskSeed, type TaskStatus, type TasksAdapter, type ToolsConfig, defineHarness };
129
+ export { type ActionRow, type ActionSections, type ActionStatus, type AgentName, type HarnessConfig, type HealthConfig, type ProjectConfig, type Provider, type StorageConfig, type TaskRow, type TaskSeed, type TaskStatus, type TasksAdapter, type ToolsConfig, defineHarness };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  defineHarness
3
- } from "./chunk-D64KK6UU.js";
3
+ } from "./chunk-U3O77CGE.js";
4
4
  export {
5
5
  defineHarness
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cardor/agent-harness-kit",
3
- "version": "1.10.5",
3
+ "version": "1.11.0",
4
4
  "description": "CLI scaffolding for multi-agent harness systems",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/config.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto'\nimport { existsSync } from 'node:fs'\nimport { join } from 'node:path'\nimport { createJiti } from 'jiti'\n\nimport type { HarnessConfig } from '@/types'\n\nconst CONFIG_NAMES = [\n 'agent-harness-kit.config.ts',\n 'agent-harness-kit.config',\n 'agent-harness-kit.config.mjs',\n 'agent-harness-kit.config.cjs',\n]\n\nexport function findConfigFile(cwd: string): string | null {\n for (const name of CONFIG_NAMES) {\n const candidate = join(cwd, name)\n if (existsSync(candidate)) return candidate\n }\n return null\n}\n\nexport async function loadConfig(cwd: string): Promise<HarnessConfig> {\n const configPath = findConfigFile(cwd)\n if (!configPath) {\n throw new Error('No agent-harness-kit.config found. Run: ahk init')\n }\n\n const jiti = createJiti(import.meta.url)\n const mod = await jiti.import(configPath) as { default?: HarnessConfig } | HarnessConfig\n const config = (mod as { default?: HarnessConfig }).default ?? (mod as HarnessConfig)\n\n if (!config || typeof config !== 'object') {\n throw new Error(`agent-harness-kit.config must export a default HarnessConfig object.`)\n }\n\n return applyDefaults(config as HarnessConfig)\n}\n\nexport function defineHarness(config: HarnessConfig): HarnessConfig {\n return config\n}\n\n/** Detects and normalizes the legacy contradictory config shape: `scope:\n * 'global'` declared alongside now-meaningless local-only path fields\n * (`database.path` / `storage.sqlitePath`, `storage.markdownFallback.path`).\n *\n * This is necessary IN ADDITION to the type-level redesign (not instead of\n * it) because `loadConfig()` loads `agent-harness-kit.config.ts` via\n * `jiti.import()` at runtime, which transpiles TS to JS and strips types\n * entirely before the module is ever evaluated — a hard type error on\n * `GlobalStorageConfig` protects authors who type-check their config file\n * (IDE, `tsc --noEmit`), but gives ZERO protection against an existing\n * config on disk that already has both fields set. Operates on the RAW\n * untyped input (may not conform to the new types at all) and returns a\n * normalized (stripped) plain object — never crashes, only warns. */\nfunction normalizeLegacyStorageShape(raw: Record<string, unknown>): Record<string, unknown> {\n const storage = raw.storage as Record<string, unknown> | undefined\n const database = raw.database as Record<string, unknown> | undefined\n if (!storage || storage.scope !== 'global') return raw\n\n const offenders: string[] = []\n let normalizedStorage = storage\n let normalizedDatabase = database\n\n const omit = (obj: Record<string, unknown>, key: string): Record<string, unknown> =>\n Object.fromEntries(Object.entries(obj).filter(([k]) => k !== key))\n\n if (database && typeof database.path === 'string' && database.path) {\n offenders.push('database.path')\n normalizedDatabase = omit(database, 'path')\n }\n if (typeof storage.sqlitePath === 'string' && storage.sqlitePath) {\n offenders.push('storage.sqlitePath')\n normalizedStorage = omit(normalizedStorage, 'sqlitePath')\n }\n const markdownFallback = normalizedStorage.markdownFallback as Record<string, unknown> | undefined\n if (markdownFallback && typeof markdownFallback.path === 'string' && markdownFallback.path) {\n offenders.push('storage.markdownFallback.path')\n normalizedStorage = { ...normalizedStorage, markdownFallback: omit(markdownFallback, 'path') }\n }\n\n if (offenders.length === 0) return raw\n\n console.warn(\n `[agent-harness-kit] storage.scope is 'global' but ${offenders.join(', ')} ${offenders.length > 1 ? 'are' : 'is'} set in ` +\n `agent-harness-kit.config.ts — ${offenders.length > 1 ? 'these are' : 'this is'} ignored under global scope and will be ` +\n `removed by a future major version. See docs/architecture.md#storage-scope.`,\n )\n\n return { ...raw, storage: normalizedStorage, database: normalizedDatabase ?? database }\n}\n\nfunction applyDefaults(config: HarnessConfig): HarnessConfig {\n const normalized = normalizeLegacyStorageShape(config as unknown as Record<string, unknown>)\n const c = normalized as Partial<HarnessConfig>\n\n const scope: 'local' | 'global' = c.storage?.scope === 'global' ? 'global' : 'local'\n const projectId = c.storage?.projectId ?? randomUUID()\n const baseStorage = {\n dir: '.harness',\n tasks: { adapter: 'local' as const },\n sections: {\n toolsUsed: true,\n filesModified: true,\n result: true,\n blockers: true,\n nextSteps: false,\n },\n }\n\n const storageOverrides = (c.storage ?? {}) as Record<string, unknown>\n\n const storage: HarnessConfig['storage'] =\n scope === 'global'\n ? ({\n ...baseStorage,\n markdownFallback: { enabled: true },\n ...storageOverrides,\n scope: 'global',\n projectId,\n } as HarnessConfig['storage'])\n : ({\n ...baseStorage,\n markdownFallback: { enabled: true, path: '.harness/current.md' },\n ...storageOverrides,\n scope: 'local',\n projectId,\n } as HarnessConfig['storage'])\n\n return {\n ...(normalized as unknown as HarnessConfig),\n provider: c.provider ?? 'claude-code',\n project: {\n docsPath: './docs',\n agentsMd: './AGENTS.md',\n ...c.project,\n } as HarnessConfig['project'],\n agents: {\n lead: { instructionsPath: null },\n explorer: { instructionsPath: null },\n builder: { instructionsPath: null },\n reviewer: { instructionsPath: null },\n custom: [],\n ...c.agents,\n } as HarnessConfig['agents'],\n database: c.database ?? { type: 'sqlite' as const },\n storage,\n health: {\n scriptPath: './health.sh',\n required: true,\n ...c.health,\n },\n tools: {\n mcp: { enabled: true, port: 3742 },\n scripts: { enabled: true, outputDir: './.harness/scripts' },\n ...c.tools,\n } as HarnessConfig['tools'],\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAI3B,IAAM,eAAe;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,eAAe,KAA4B;AACzD,aAAW,QAAQ,cAAc;AAC/B,UAAM,YAAY,KAAK,KAAK,IAAI;AAChC,QAAI,WAAW,SAAS,EAAG,QAAO;AAAA,EACpC;AACA,SAAO;AACT;AAEA,eAAsB,WAAW,KAAqC;AACpE,QAAM,aAAa,eAAe,GAAG;AAC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