@clicksmith/agent-config 0.1.6 → 0.1.7

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.js CHANGED
@@ -252,7 +252,14 @@ var DEFAULT_AGENTS = [
252
252
  id: "claude",
253
253
  label: "Claude Code",
254
254
  command: "claude",
255
- args: ["-p", "{agentPrompt}", "--append-system-prompt", "@{instructionFile}"],
255
+ args: [
256
+ "-p",
257
+ "{agentPrompt}",
258
+ "--dangerously-skip-permissions",
259
+ "--verbose",
260
+ "--append-system-prompt",
261
+ "@{instructionFile}"
262
+ ],
256
263
  detect: { anyOf: ["claude"] },
257
264
  instructions: { target: "claude", file: "CLAUDE.md" },
258
265
  mcp: { register: "claude" },
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts","../src/config-schema.ts","../src/placeholders.ts","../src/bin-exists.ts","../src/adapter.ts","../src/instruction-template.ts","../src/renderers.ts","../src/defaults.ts","../src/merge.ts"],"names":[],"mappings":";;;;;;AAGO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,YAAA;AAAA,EACA,QAAA;AAAA,EACA,aAAA;AAAA,EACA,iBAAA;AAAA,EACA,MAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF;ACRO,IAAM,uBAAA,GAA0B,EAAE,IAAA,CAAK;AAAA,EAC5C,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAC;AAIM,IAAM,qBAAA,GAAwB,EAAE,IAAA,CAAK,CAAC,UAAU,QAAA,EAAU,OAAA,EAAS,UAAA,EAAY,MAAM,CAAC;AAQtF,IAAM,iBAAA,GAAoB,EAAE,MAAA,CAAO;AAAA,EACxC,EAAA,EAAI,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA;A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placeholder the launcher knows how to resolve in a command template. */\nexport const PLACEHOLDER_KEYS = [\n 'bundlePath',\n 'prompt',\n 'agentPrompt',\n 'instructionFile',\n 'mode',\n 'mcpServer',\n 'cwd',\n] as const;\n\nexport type PlaceholderKey = (typeof PLACEHOLDER_KEYS)[number];\n\n/**\n * Everything the launcher needs to turn a config-driven command template into a\n * concrete process invocation. This is also the `ctx` passed to adapter hooks.\n */\nexport interface AgentLaunchContext {\n /** Absolute path to the serialized capture bundle. */\n bundlePath: string;\n /** The user's free-text prompt. */\n prompt: string;\n /** Full agent-ready prompt containing the ClickSmith bundle and instruction paths. */\n agentPrompt: string;\n /** Absolute path to the rendered instruction file for this agent. */\n instructionFile: string;\n /** Execution mode (`plan` | `edit`). */\n mode: ExecutionMode;\n /** A reference the agent can use to reach the ClickSmith MCP server. */\n mcpServer: string;\n /** Working directory for the spawned process (the sandbox). */\n cwd: string;\n /** Isolation strategy in effect for this run. */\n isolation: Isolation;\n /** The agent id being launched. */\n agentId: string;\n /**\n * Resolves whether an executable exists on PATH. Injected by the daemon so\n * adapters never have to spawn processes themselves. Defaults to a PATH scan.\n */\n binExists?: (bin: string) => Promise<boolean>;\n}\n\n/** A concrete, ready-to-spawn process specification. */\nexport interface CommandSpec {\n command: string;\n args: string[];\n env?: Record<string, string>;\n cwd?: string;\n}\n\n/** A normalized event parsed from an agent's stdout/stderr stream. */\nexport type AgentEvent =\n | { type: 'plan-ready'; plan?: string; diff?: string }\n | { type: 'progress'; message: string }\n | { type: 'error'; message: string };\n\n/**\n * The adapter contract. Built-in adapters are produced from `agents.config.json`\n * by {@link configToAdapter}; the launcher only resolves placeholders. Authors\n * may also hand-write adapters that satisfy this interface.\n */\nexport interface AgentAdapter {\n id: string;\n /** Whether the agent's CLI is installed/usable in this context. */\n isAvailable(ctx: AgentLaunchContext): Promise<boolean>;\n /** Build the concrete command to spawn. */\n buildCommand(ctx: AgentLaunchContext): CommandSpec;\n /** Optionally map a raw output chunk into structured events. */\n parseEvents?(chunk: string, ctx: AgentLaunchContext): AgentEvent[];\n}\n","import { z } from 'zod';\n\n/** Which native instruction format a renderer should target. */\nexport const InstructionTargetSchema = z.enum([\n 'claude',\n 'cursor',\n 'codex',\n 'antigravity',\n 'generic',\n]);\nexport type InstructionTarget = z.infer<typeof InstructionTargetSchema>;\n\n/** How (and whether) to register the daemon's MCP server for this agent. */\nexport const McpRegistrationSchema = z.enum(['claude', 'cursor', 'codex', 'mcp-json', 'none']);\nexport type McpRegistration = z.infer<typeof McpRegistrationSchema>;\n\n/**\n * One agent definition. The `command`/`args` are templates containing\n * placeholders like `{prompt}` — they are **data**, never code. Changing a\n * vendor flag is an edit here, not a code change.\n */\nexport const AgentConfigSchema = z.object({\n id: z.string().min(1),\n label: z.string().optional(),\n /** Executable name or path. May contain placeholders. */\n command: z.string().min(1),\n /** Argument templates; each entry may contain placeholders. */\n args: z.array(z.string()).default([]),\n /** Extra environment variables (values may contain placeholders). */\n env: z.record(z.string()).optional(),\n /** Working directory override (placeholders allowed). Defaults to the sandbox. */\n cwd: z.string().optional(),\n /** How to detect availability: any of these executables must be on PATH. */\n detect: z\n .object({\n anyOf: z.array(z.string()).min(1),\n })\n .optional(),\n /** Where to render this agent's instruction file. */\n instructions: z\n .object({\n target: InstructionTargetSchema,\n file: z.string().min(1),\n })\n .optional(),\n /** How to register the daemon MCP server for this agent. */\n mcp: z\n .object({\n register: McpRegistrationSchema,\n })\n .optional(),\n /** Optional regexes that map log lines to structured events. */\n parse: z\n .object({\n planReady: z.string().optional(),\n error: z.string().optional(),\n })\n .optional(),\n});\nexport type AgentConfig = z.infer<typeof AgentConfigSchema>;\n\n/** The top-level `agents.config.json` document. */\nexport const AgentsConfigSchema = z.object({\n version: z.literal(1).default(1),\n defaultAgent: z.string().optional(),\n agents: z.array(AgentConfigSchema).default([]),\n});\nexport type AgentsConfig = z.infer<typeof AgentsConfigSchema>;\n\n/** Parse and validate an `agents.config.json` value without throwing. */\nexport function parseAgentsConfig(value: unknown):\n | { ok: true; config: AgentsConfig }\n | { ok: false; error: z.ZodError } {\n const result = AgentsConfigSchema.safeParse(value);\n return result.success\n ? { ok: true, config: result.data }\n : { ok: false, error: result.error };\n}\n","import {\n PLACEHOLDER_KEYS,\n type AgentLaunchContext,\n type CommandSpec,\n type PlaceholderKey,\n} from './types.js';\nimport type { AgentConfig } from './config-schema.js';\n\n/** Build the placeholder → value map from a launch context. */\nexport function placeholderValues(ctx: AgentLaunchContext): Record<PlaceholderKey, string> {\n return {\n bundlePath: ctx.bundlePath,\n prompt: ctx.prompt,\n agentPrompt: ctx.agentPrompt,\n instructionFile: ctx.instructionFile,\n mode: ctx.mode,\n mcpServer: ctx.mcpServer,\n cwd: ctx.cwd,\n };\n}\n\nconst PLACEHOLDER_RE = /\\{([a-zA-Z]+)\\}/g;\n\n/**\n * Replace every known `{placeholder}` in a template string with its value.\n * Unknown placeholders are left untouched (so literal braces survive). This is\n * the *entire* job of the launcher — no vendor-specific knowledge lives here.\n */\nexport function resolvePlaceholders(template: string, ctx: AgentLaunchContext): string {\n const values = placeholderValues(ctx);\n return template.replace(PLACEHOLDER_RE, (match, key: string) => {\n return key in values ? values[key as PlaceholderKey] : match;\n });\n}\n\n/** Resolve an entire {@link AgentConfig} into a concrete {@link CommandSpec}. */\nexport function resolveCommand(config: AgentConfig, ctx: AgentLaunchContext): CommandSpec {\n const env = config.env\n ? Object.fromEntries(\n Object.entries(config.env).map(([k, v]) => [k, resolvePlaceholders(v, ctx)]),\n )\n : undefined;\n return {\n command: resolvePlaceholders(config.command, ctx),\n args: config.args.map((a) => resolvePlaceholders(a, ctx)),\n cwd: config.cwd ? resolvePlaceholders(config.cwd, ctx) : ctx.cwd,\n ...(env ? { env } : {}),\n };\n}\n\n/** List the placeholders actually referenced by a template string. */\nexport function referencedPlaceholders(template: string): PlaceholderKey[] {\n const found = new Set<PlaceholderKey>();\n for (const m of template.matchAll(PLACEHOLDER_RE)) {\n const key = m[1] as string;\n if ((PLACEHOLDER_KEYS as readonly string[]).includes(key)) {\n found.add(key as PlaceholderKey);\n }\n }\n return [...found];\n}\n","import { access, constants } from 'node:fs/promises';\nimport { delimiter, join } from 'node:path';\n\n/**\n * Default executable-on-PATH check. Scans `PATH` for the given binary,\n * honoring `PATHEXT` on Windows. Adapters receive this via the launch context\n * but the daemon may override it (e.g. for tests).\n */\nexport async function defaultBinExists(bin: string): Promise<boolean> {\n // An explicit path: just check it directly.\n if (bin.includes('/') || bin.includes('\\\\')) {\n return canExecute(bin);\n }\n const pathEnv = process.env.PATH ?? '';\n const exts = process.platform === 'win32' ? (process.env.PATHEXT ?? '.EXE;.CMD;.BAT').split(';') : [''];\n for (const dir of pathEnv.split(delimiter)) {\n if (!dir) continue;\n for (const ext of exts) {\n if (await canExecute(join(dir, bin + ext))) return true;\n }\n }\n return false;\n}\n\nasync function canExecute(file: string): Promise<boolean> {\n try {\n await access(file, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import { defaultBinExists } from './bin-exists.js';\nimport { resolveCommand } from './placeholders.js';\nimport type { AgentConfig } from './config-schema.js';\nimport type { AgentAdapter, AgentEvent, AgentLaunchContext } from './types.js';\n\n/**\n * Turn a config entry into a live {@link AgentAdapter}. This is the bridge that\n * lets *data* (`agents.config.json`) behave like a built-in adapter:\n *\n * - `isAvailable` checks the configured `detect.anyOf` executables on PATH.\n * - `buildCommand` resolves placeholders into a concrete command.\n * - `parseEvents` applies the optional regexes from `config.parse`.\n */\nexport function configToAdapter(config: AgentConfig): AgentAdapter {\n const planRe = config.parse?.planReady ? new RegExp(config.parse.planReady, 'i') : undefined;\n const errRe = config.parse?.error ? new RegExp(config.parse.error, 'i') : undefined;\n\n return {\n id: config.id,\n\n async isAvailable(ctx: AgentLaunchContext): Promise<boolean> {\n const bins = config.detect?.anyOf ?? [config.command];\n const exists = ctx.binExists ?? defaultBinExists;\n for (const bin of bins) {\n if (await exists(bin)) return true;\n }\n return false;\n },\n\n buildCommand(ctx: AgentLaunchContext) {\n return resolveCommand(config, ctx);\n },\n\n parseEvents(chunk: string): AgentEvent[] {\n if (!planRe && !errRe) return [];\n const events: AgentEvent[] = [];\n for (const line of chunk.split(/\\r?\\n/)) {\n if (!line.trim()) continue;\n if (errRe?.test(line)) events.push({ type: 'error', message: line.trim() });\n else if (planRe?.test(line)) events.push({ type: 'plan-ready' });\n }\n return events;\n },\n };\n}\n\n/** Build adapters for every agent in a config, keyed by id. */\nexport function buildAdapters(configs: readonly AgentConfig[]): Map<string, AgentAdapter> {\n const map = new Map<string, AgentAdapter>();\n for (const config of configs) {\n map.set(config.id, configToAdapter(config));\n }\n return map;\n}\n","import { LOCATOR_PRIORITY } from '@clicksmith/core';\n\nexport interface InstructionTemplateOptions {\n /** MCP tool names exposed by the daemon. */\n mcpTools?: readonly string[];\n /** The daemon port, for the agent's reference. */\n daemonPort?: number;\n /** Project-specific stable attributes the project relies on (e.g. data-testid). */\n stableAttrs?: readonly string[];\n}\n\nexport const DEFAULT_MCP_TOOLS = [\n 'get_session',\n 'list_elements',\n 'get_element_by_id',\n 'get_latest_request',\n] as const;\n\n/**\n * The single, shared instruction body. Every native renderer wraps this exact\n * text so Claude, Cursor, Codex, Antigravity and generic agents all receive the\n * same compact fast-path contract.\n */\nexport function renderInstructionBody(options: InstructionTemplateOptions = {}): string {\n const attrs = options.stableAttrs ?? [];\n\n return `# ClickSmith\n\n**The user message already contains the exact file path and the change to make.**\n\n- The target file is already identified — skip repo-wide search.\n- Run the listed grep(s) (≤ 2) to locate the exact line, then edit only that file.\n- Apply this project's existing conventions and design rules to the edit.\n- Do not open unrelated files, packages, or directories.${\n attrs.length ? `\\n- Project stable attrs: ${attrs.join(', ')}.` : ''\n }`;\n}\n","import { renderInstructionBody, type InstructionTemplateOptions } from './instruction-template.js';\nimport type { InstructionTarget } from './config-schema.js';\n\nexport const MANAGED_BEGIN = '<!-- BEGIN CLICKSMITH (managed — do not edit by hand) -->';\nexport const MANAGED_END = '<!-- END CLICKSMITH (managed) -->';\n\nexport interface RenderedInstruction {\n target: InstructionTarget;\n /** Default relative path for this target's native file. */\n path: string;\n /**\n * `true` when the target file commonly holds other content (e.g. `CLAUDE.md`,\n * `AGENTS.md`). The installer then inserts {@link content} as a managed block\n * rather than overwriting the whole file.\n */\n shared: boolean;\n /** Full file content (dedicated files) or managed-block body (shared files). */\n content: string;\n}\n\n/** Wrap a body in the managed-block markers. */\nexport function wrapManagedBlock(body: string): string {\n return `${MANAGED_BEGIN}\\n${body.trim()}\\n${MANAGED_END}\\n`;\n}\n\n/**\n * Insert or replace the ClickSmith managed block within existing file content,\n * preserving everything the user wrote outside the markers.\n */\nexport function applyManagedBlock(existing: string | undefined, body: string): string {\n const block = wrapManagedBlock(body);\n if (!existing || !existing.trim()) return block;\n const begin = existing.indexOf(MANAGED_BEGIN);\n const end = existing.indexOf(MANAGED_END);\n if (begin !== -1 && end !== -1 && end > begin) {\n const before = existing.slice(0, begin);\n const after = existing.slice(end + MANAGED_END.length);\n return `${before}${block.trimEnd()}${after}`.replace(/\\n{3,}/g, '\\n\\n');\n }\n return `${existing.trimEnd()}\\n\\n${block}`;\n}\n\nfunction cursorMdc(body: string): string {\n // alwaysApply: false — the agentPrompt carries all context; auto-loading this\n // file as system context makes agents explore instead of act immediately.\n return `---\ndescription: ClickSmith — how to handle captured UI change requests\nalwaysApply: false\n---\n\n${body.trim()}\n`;\n}\n\n/** Render the shared instruction body into a target's native file. */\nexport function renderInstructions(\n target: InstructionTarget,\n options: InstructionTemplateOptions = {},\n): RenderedInstruction {\n const body = renderInstructionBody(options);\n switch (target) {\n case 'claude':\n return { target, path: 'CLAUDE.md', shared: true, content: body };\n case 'codex':\n return { target, path: 'AGENTS.md', shared: true, content: body };\n case 'cursor':\n return { target, path: '.cursor/rules/clicksmith.mdc', shared: false, content: cursorMdc(body) };\n case 'antigravity':\n return {\n target,\n path: '.antigravity/rules/clicksmith.md',\n shared: false,\n content: `${body.trim()}\\n`,\n };\n case 'generic':\n return {\n target,\n path: '.clicksmith/AGENT_INSTRUCTIONS.md',\n shared: false,\n content: `${body.trim()}\\n`,\n };\n default: {\n const _exhaustive: never = target;\n throw new Error(`Unknown instruction target: ${String(_exhaustive)}`);\n }\n }\n}\n\n/** Render instruction files for several targets at once. */\nexport function renderAllInstructions(\n targets: readonly InstructionTarget[],\n options: InstructionTemplateOptions = {},\n): RenderedInstruction[] {\n return targets.map((t) => renderInstructions(t, options));\n}\n","import type { AgentConfig, AgentsConfig } from './config-schema.js';\n\n/**\n * Built-in agent templates. **These are example defaults — data, not launcher\n * logic.** Changing a vendor's CLI flag means editing `agents.config.json`\n * (or these defaults), never the daemon. The launcher only resolves the\n * `{placeholders}` below; it has no idea what `claude` or `codex` actually do.\n */\nexport const DEFAULT_AGENTS: AgentConfig[] = [\n {\n id: 'claude',\n label: 'Claude Code',\n command: 'claude',\n args: ['-p', '{agentPrompt}', '--append-system-prompt', '@{instructionFile}'],\n detect: { anyOf: ['claude'] },\n instructions: { target: 'claude', file: 'CLAUDE.md' },\n mcp: { register: 'claude' },\n parse: { planReady: 'plan ready|here is the plan|## plan', error: '^error:|fatal:' },\n },\n {\n id: 'cursor',\n label: 'Cursor Agent',\n command: 'cursor-agent',\n args: ['--print', '{agentPrompt}'],\n detect: { anyOf: ['cursor-agent', 'cursor'] },\n instructions: { target: 'cursor', file: '.cursor/rules/clicksmith.mdc' },\n mcp: { register: 'cursor' },\n },\n {\n id: 'codex',\n label: 'OpenAI Codex',\n command: 'codex',\n args: [\n 'exec',\n '--cd',\n '{cwd}',\n '--sandbox',\n 'workspace-write',\n '--skip-git-repo-check',\n '--ephemeral',\n '-c',\n 'model_reasoning_effort=\"low\"',\n '{agentPrompt}',\n ],\n detect: { anyOf: ['codex'] },\n instructions: { target: 'codex', file: 'AGENTS.md' },\n mcp: { register: 'codex' },\n },\n {\n id: 'antigravity',\n label: 'Antigravity',\n command: 'antigravity',\n args: ['run', '--prompt', '{agentPrompt}'],\n detect: { anyOf: ['antigravity'] },\n instructions: { target: 'antigravity', file: '.antigravity/rules/clicksmith.md' },\n mcp: { register: 'mcp-json' },\n },\n {\n id: 'generic',\n label: 'Generic agent (customize me)',\n command: 'sh',\n args: [\n '-c',\n 'echo \"ClickSmith request: {prompt}\"; echo \"Bundle: {bundlePath}\"; echo \"Instructions: {instructionFile}\"; echo \"Mode: {mode}\"; echo \"Prompt: {agentPrompt}\"',\n ],\n instructions: { target: 'generic', file: '.clicksmith/AGENT_INSTRUCTIONS.md' },\n mcp: { register: 'mcp-json' },\n },\n];\n\n/** The full default `agents.config.json` document. */\nexport const DEFAULT_AGENTS_CONFIG: AgentsConfig = {\n version: 1,\n defaultAgent: 'claude',\n agents: DEFAULT_AGENTS,\n};\n","import type { AgentConfig, AgentsConfig } from './config-schema.js';\n\n/**\n * Layer agent configs: shipped defaults → project config → user config. Agents\n * with the same `id` are replaced by later layers; new ids are appended in\n * order. `defaultAgent` from the last layer that sets it wins.\n */\nexport function mergeAgentsConfig(base: AgentsConfig, ...overlays: AgentsConfig[]): AgentsConfig {\n let agents = [...base.agents];\n let defaultAgent = base.defaultAgent;\n\n for (const overlay of overlays) {\n agents = mergeAgentList(agents, overlay.agents);\n if (overlay.defaultAgent) defaultAgent = overlay.defaultAgent;\n }\n\n return {\n version: 1,\n ...(defaultAgent ? { defaultAgent } : {}),\n agents,\n };\n}\n\nfunction mergeAgentList(base: AgentConfig[], overlay: AgentConfig[]): AgentConfig[] {\n const byId = new Map(base.map((a) => [a.id, a]));\n const order = base.map((a) => a.id);\n for (const agent of overlay) {\n if (!byId.has(agent.id)) order.push(agent.id);\n byId.set(agent.id, agent);\n }\n return order.map((id) => byId.get(id)!);\n}\n\n/** Resolve the effective agent for a run: explicit id → defaultAgent → first. */\nexport function resolveAgent(config: AgentsConfig, agentId?: string): AgentConfig | undefined {\n if (agentId) return config.agents.find((a) => a.id === agentId);\n if (config.defaultAgent) {\n const found = config.agents.find((a) => a.id === config.defaultAgent);\n if (found) return found;\n }\n return config.agents[0];\n}\n"]}
1
+ {"version":3,"sources":["../src/types.ts","../src/config-schema.ts","../src/placeholders.ts","../src/bin-exists.ts","../src/adapter.ts","../src/instruction-template.ts","../src/renderers.ts","../src/defaults.ts","../src/merge.ts"],"names":[],"mappings":";;;;;;AAGO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,YAAA;AAAA,EACA,QAAA;AAAA,EACA,aAAA;AAAA,EACA,iBAAA;AAAA,EACA,MAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF;ACRO,IAAM,uBAAA,GAA0B,EAAE,IAAA,CAAK;AAAA,EAC5C,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAC;AAIM,IAAM,qBAAA,GAAwB,EAAE,IAAA,CAAK,CAAC,UAAU,QAAA,EAAU,OAAA,EAAS,UAAA,EAAY,MAAM,CAAC;AAQtF,IAAM,iBAAA,GAAoB,EAAE,MAAA,CAAO;AAAA,EACxC,EAAA,EAAI,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EACpB,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA;AAAA,EAE3B,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA;AAAA,EAEzB,IAAA,EAAM,EAAE,KAAA,CAAM,CAAA,CAAE,QAAQ,CAAA,CAAE,OAAA,CAAQ,EAAE,CAAA;AAAA;AAAA,EAEpC,KAAK,CAAA,CAAE,MAAA,CAAO,EAAE,MAAA,EAAQ,EAAE,QAAA,EAAS;AAAA;AAAA,EAEnC,GAAA,EAAK,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA;AAAA,EAEzB,MAAA,EAAQ,EACL,MAAA,CAAO;AAAA,IACN,KAAA,EAAO,EAAE,KAAA,CAAM,CAAA,CAAE,QAAQ,CAAA,CAAE,IAAI,CAAC;AAAA,GACjC,EACA,QAAA,EAAS;AAAA;AAAA,EAEZ,YAA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C,KAAK,GAAA,CAAI,KAAA,CAAM,EAAE,CAAA,EAAG,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,EAAE,CAAA;AAC5C,IAAA,IAAA,CAAK,GAAA,CAAI,KAAA,CAAM,EAAA,EAAI,KAAK,CAAA;AAAA,EAC1B;AACA,EAAA,OAAO,MAAM,GAAA,CAAI,CAAC,OAAO,IAAA,CAAK,GAAA,CAAI,EAAE,CAAE,CAAA;AACxC;AAGO,SAAS,YAAA,CAAa,QAAsB,OAAA,EAA2C;AAC5F,EAAA,IAAI,OAAA,SAAgB,MAAA,CAAO,MAAA,CAAO,KAAK,CAAC,CAAA,KAAM,CAAA,CAAE,EAAA,KAAO,OAAO,CAAA;AAC9D,EAAA,IAAI,OAAO,YAAA,EAAc;AACvB,IAAA,MAAM,KAAA,GAAQ,OAAO,MAAA,CAAO,IAAA,CAAK,CAAC,CAAA,KAAM,CAAA,CAAE,EAAA,KAAO,MAAA,CAAO,YAAY,CAAA;AACpE,IAAA,IAAI,OAAO,OAAO,KAAA;AAAA,EACpB;AACA,EAAA,OAAO,MAAA,CAAO,OAAO,CAAC,CAAA;AACxB","file":"index.js","sourcesContent":["import type { ExecutionMode, Isolation } from '@clicksmith/core';\n\n/** Every placeholder the launcher knows how to resolve in a command template. */\nexport const PLACEHOLDER_KEYS = [\n 'bundlePath',\n 'prompt',\n 'agentPrompt',\n 'instructionFile',\n 'mode',\n 'mcpServer',\n 'cwd',\n] as const;\n\nexport type PlaceholderKey = (typeof PLACEHOLDER_KEYS)[number];\n\n/**\n * Everything the launcher needs to turn a config-driven command template into a\n * concrete process invocation. This is also the `ctx` passed to adapter hooks.\n */\nexport interface AgentLaunchContext {\n /** Absolute path to the serialized capture bundle. */\n bundlePath: string;\n /** The user's free-text prompt. */\n prompt: string;\n /** Full agent-ready prompt containing the ClickSmith bundle and instruction paths. */\n agentPrompt: string;\n /** Absolute path to the rendered instruction file for this agent. */\n instructionFile: string;\n /** Execution mode (`plan` | `edit`). */\n mode: ExecutionMode;\n /** A reference the agent can use to reach the ClickSmith MCP server. */\n mcpServer: string;\n /** Working directory for the spawned process (the sandbox). */\n cwd: string;\n /** Isolation strategy in effect for this run. */\n isolation: Isolation;\n /** The agent id being launched. */\n agentId: string;\n /**\n * Resolves whether an executable exists on PATH. Injected by the daemon so\n * adapters never have to spawn processes themselves. Defaults to a PATH scan.\n */\n binExists?: (bin: string) => Promise<boolean>;\n}\n\n/** A concrete, ready-to-spawn process specification. */\nexport interface CommandSpec {\n command: string;\n args: string[];\n env?: Record<string, string>;\n cwd?: string;\n}\n\n/** A normalized event parsed from an agent's stdout/stderr stream. */\nexport type AgentEvent =\n | { type: 'plan-ready'; plan?: string; diff?: string }\n | { type: 'progress'; message: string }\n | { type: 'error'; message: string };\n\n/**\n * The adapter contract. Built-in adapters are produced from `agents.config.json`\n * by {@link configToAdapter}; the launcher only resolves placeholders. Authors\n * may also hand-write adapters that satisfy this interface.\n */\nexport interface AgentAdapter {\n id: string;\n /** Whether the agent's CLI is installed/usable in this context. */\n isAvailable(ctx: AgentLaunchContext): Promise<boolean>;\n /** Build the concrete command to spawn. */\n buildCommand(ctx: AgentLaunchContext): CommandSpec;\n /** Optionally map a raw output chunk into structured events. */\n parseEvents?(chunk: string, ctx: AgentLaunchContext): AgentEvent[];\n}\n","import { z } from 'zod';\n\n/** Which native instruction format a renderer should target. */\nexport const InstructionTargetSchema = z.enum([\n 'claude',\n 'cursor',\n 'codex',\n 'antigravity',\n 'generic',\n]);\nexport type InstructionTarget = z.infer<typeof InstructionTargetSchema>;\n\n/** How (and whether) to register the daemon's MCP server for this agent. */\nexport const McpRegistrationSchema = z.enum(['claude', 'cursor', 'codex', 'mcp-json', 'none']);\nexport type McpRegistration = z.infer<typeof McpRegistrationSchema>;\n\n/**\n * One agent definition. The `command`/`args` are templates containing\n * placeholders like `{prompt}` — they are **data**, never code. Changing a\n * vendor flag is an edit here, not a code change.\n */\nexport const AgentConfigSchema = z.object({\n id: z.string().min(1),\n label: z.string().optional(),\n /** Executable name or path. May contain placeholders. */\n command: z.string().min(1),\n /** Argument templates; each entry may contain placeholders. */\n args: z.array(z.string()).default([]),\n /** Extra environment variables (values may contain placeholders). */\n env: z.record(z.string()).optional(),\n /** Working directory override (placeholders allowed). Defaults to the sandbox. */\n cwd: z.string().optional(),\n /** How to detect availability: any of these executables must be on PATH. */\n detect: z\n .object({\n anyOf: z.array(z.string()).min(1),\n })\n .optional(),\n /** Where to render this agent's instruction file. */\n instructions: z\n .object({\n target: InstructionTargetSchema,\n file: z.string().min(1),\n })\n .optional(),\n /** How to register the daemon MCP server for this agent. */\n mcp: z\n .object({\n register: McpRegistrationSchema,\n })\n .optional(),\n /** Optional regexes that map log lines to structured events. */\n parse: z\n .object({\n planReady: z.string().optional(),\n error: z.string().optional(),\n })\n .optional(),\n});\nexport type AgentConfig = z.infer<typeof AgentConfigSchema>;\n\n/** The top-level `agents.config.json` document. */\nexport const AgentsConfigSchema = z.object({\n version: z.literal(1).default(1),\n defaultAgent: z.string().optional(),\n agents: z.array(AgentConfigSchema).default([]),\n});\nexport type AgentsConfig = z.infer<typeof AgentsConfigSchema>;\n\n/** Parse and validate an `agents.config.json` value without throwing. */\nexport function parseAgentsConfig(value: unknown):\n | { ok: true; config: AgentsConfig }\n | { ok: false; error: z.ZodError } {\n const result = AgentsConfigSchema.safeParse(value);\n return result.success\n ? { ok: true, config: result.data }\n : { ok: false, error: result.error };\n}\n","import {\n PLACEHOLDER_KEYS,\n type AgentLaunchContext,\n type CommandSpec,\n type PlaceholderKey,\n} from './types.js';\nimport type { AgentConfig } from './config-schema.js';\n\n/** Build the placeholder → value map from a launch context. */\nexport function placeholderValues(ctx: AgentLaunchContext): Record<PlaceholderKey, string> {\n return {\n bundlePath: ctx.bundlePath,\n prompt: ctx.prompt,\n agentPrompt: ctx.agentPrompt,\n instructionFile: ctx.instructionFile,\n mode: ctx.mode,\n mcpServer: ctx.mcpServer,\n cwd: ctx.cwd,\n };\n}\n\nconst PLACEHOLDER_RE = /\\{([a-zA-Z]+)\\}/g;\n\n/**\n * Replace every known `{placeholder}` in a template string with its value.\n * Unknown placeholders are left untouched (so literal braces survive). This is\n * the *entire* job of the launcher — no vendor-specific knowledge lives here.\n */\nexport function resolvePlaceholders(template: string, ctx: AgentLaunchContext): string {\n const values = placeholderValues(ctx);\n return template.replace(PLACEHOLDER_RE, (match, key: string) => {\n return key in values ? values[key as PlaceholderKey] : match;\n });\n}\n\n/** Resolve an entire {@link AgentConfig} into a concrete {@link CommandSpec}. */\nexport function resolveCommand(config: AgentConfig, ctx: AgentLaunchContext): CommandSpec {\n const env = config.env\n ? Object.fromEntries(\n Object.entries(config.env).map(([k, v]) => [k, resolvePlaceholders(v, ctx)]),\n )\n : undefined;\n return {\n command: resolvePlaceholders(config.command, ctx),\n args: config.args.map((a) => resolvePlaceholders(a, ctx)),\n cwd: config.cwd ? resolvePlaceholders(config.cwd, ctx) : ctx.cwd,\n ...(env ? { env } : {}),\n };\n}\n\n/** List the placeholders actually referenced by a template string. */\nexport function referencedPlaceholders(template: string): PlaceholderKey[] {\n const found = new Set<PlaceholderKey>();\n for (const m of template.matchAll(PLACEHOLDER_RE)) {\n const key = m[1] as string;\n if ((PLACEHOLDER_KEYS as readonly string[]).includes(key)) {\n found.add(key as PlaceholderKey);\n }\n }\n return [...found];\n}\n","import { access, constants } from 'node:fs/promises';\nimport { delimiter, join } from 'node:path';\n\n/**\n * Default executable-on-PATH check. Scans `PATH` for the given binary,\n * honoring `PATHEXT` on Windows. Adapters receive this via the launch context\n * but the daemon may override it (e.g. for tests).\n */\nexport async function defaultBinExists(bin: string): Promise<boolean> {\n // An explicit path: just check it directly.\n if (bin.includes('/') || bin.includes('\\\\')) {\n return canExecute(bin);\n }\n const pathEnv = process.env.PATH ?? '';\n const exts = process.platform === 'win32' ? (process.env.PATHEXT ?? '.EXE;.CMD;.BAT').split(';') : [''];\n for (const dir of pathEnv.split(delimiter)) {\n if (!dir) continue;\n for (const ext of exts) {\n if (await canExecute(join(dir, bin + ext))) return true;\n }\n }\n return false;\n}\n\nasync function canExecute(file: string): Promise<boolean> {\n try {\n await access(file, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import { defaultBinExists } from './bin-exists.js';\nimport { resolveCommand } from './placeholders.js';\nimport type { AgentConfig } from './config-schema.js';\nimport type { AgentAdapter, AgentEvent, AgentLaunchContext } from './types.js';\n\n/**\n * Turn a config entry into a live {@link AgentAdapter}. This is the bridge that\n * lets *data* (`agents.config.json`) behave like a built-in adapter:\n *\n * - `isAvailable` checks the configured `detect.anyOf` executables on PATH.\n * - `buildCommand` resolves placeholders into a concrete command.\n * - `parseEvents` applies the optional regexes from `config.parse`.\n */\nexport function configToAdapter(config: AgentConfig): AgentAdapter {\n const planRe = config.parse?.planReady ? new RegExp(config.parse.planReady, 'i') : undefined;\n const errRe = config.parse?.error ? new RegExp(config.parse.error, 'i') : undefined;\n\n return {\n id: config.id,\n\n async isAvailable(ctx: AgentLaunchContext): Promise<boolean> {\n const bins = config.detect?.anyOf ?? [config.command];\n const exists = ctx.binExists ?? defaultBinExists;\n for (const bin of bins) {\n if (await exists(bin)) return true;\n }\n return false;\n },\n\n buildCommand(ctx: AgentLaunchContext) {\n return resolveCommand(config, ctx);\n },\n\n parseEvents(chunk: string): AgentEvent[] {\n if (!planRe && !errRe) return [];\n const events: AgentEvent[] = [];\n for (const line of chunk.split(/\\r?\\n/)) {\n if (!line.trim()) continue;\n if (errRe?.test(line)) events.push({ type: 'error', message: line.trim() });\n else if (planRe?.test(line)) events.push({ type: 'plan-ready' });\n }\n return events;\n },\n };\n}\n\n/** Build adapters for every agent in a config, keyed by id. */\nexport function buildAdapters(configs: readonly AgentConfig[]): Map<string, AgentAdapter> {\n const map = new Map<string, AgentAdapter>();\n for (const config of configs) {\n map.set(config.id, configToAdapter(config));\n }\n return map;\n}\n","import { LOCATOR_PRIORITY } from '@clicksmith/core';\n\nexport interface InstructionTemplateOptions {\n /** MCP tool names exposed by the daemon. */\n mcpTools?: readonly string[];\n /** The daemon port, for the agent's reference. */\n daemonPort?: number;\n /** Project-specific stable attributes the project relies on (e.g. data-testid). */\n stableAttrs?: readonly string[];\n}\n\nexport const DEFAULT_MCP_TOOLS = [\n 'get_session',\n 'list_elements',\n 'get_element_by_id',\n 'get_latest_request',\n] as const;\n\n/**\n * The single, shared instruction body. Every native renderer wraps this exact\n * text so Claude, Cursor, Codex, Antigravity and generic agents all receive the\n * same compact fast-path contract.\n */\nexport function renderInstructionBody(options: InstructionTemplateOptions = {}): string {\n const attrs = options.stableAttrs ?? [];\n\n return `# ClickSmith\n\n**The user message already contains the exact file path and the change to make.**\n\n- The target file is already identified — skip repo-wide search.\n- Run the listed grep(s) (≤ 2) to locate the exact line, then edit only that file.\n- Apply this project's existing conventions and design rules to the edit.\n- Do not open unrelated files, packages, or directories.${\n attrs.length ? `\\n- Project stable attrs: ${attrs.join(', ')}.` : ''\n }`;\n}\n","import { renderInstructionBody, type InstructionTemplateOptions } from './instruction-template.js';\nimport type { InstructionTarget } from './config-schema.js';\n\nexport const MANAGED_BEGIN = '<!-- BEGIN CLICKSMITH (managed — do not edit by hand) -->';\nexport const MANAGED_END = '<!-- END CLICKSMITH (managed) -->';\n\nexport interface RenderedInstruction {\n target: InstructionTarget;\n /** Default relative path for this target's native file. */\n path: string;\n /**\n * `true` when the target file commonly holds other content (e.g. `CLAUDE.md`,\n * `AGENTS.md`). The installer then inserts {@link content} as a managed block\n * rather than overwriting the whole file.\n */\n shared: boolean;\n /** Full file content (dedicated files) or managed-block body (shared files). */\n content: string;\n}\n\n/** Wrap a body in the managed-block markers. */\nexport function wrapManagedBlock(body: string): string {\n return `${MANAGED_BEGIN}\\n${body.trim()}\\n${MANAGED_END}\\n`;\n}\n\n/**\n * Insert or replace the ClickSmith managed block within existing file content,\n * preserving everything the user wrote outside the markers.\n */\nexport function applyManagedBlock(existing: string | undefined, body: string): string {\n const block = wrapManagedBlock(body);\n if (!existing || !existing.trim()) return block;\n const begin = existing.indexOf(MANAGED_BEGIN);\n const end = existing.indexOf(MANAGED_END);\n if (begin !== -1 && end !== -1 && end > begin) {\n const before = existing.slice(0, begin);\n const after = existing.slice(end + MANAGED_END.length);\n return `${before}${block.trimEnd()}${after}`.replace(/\\n{3,}/g, '\\n\\n');\n }\n return `${existing.trimEnd()}\\n\\n${block}`;\n}\n\nfunction cursorMdc(body: string): string {\n // alwaysApply: false — the agentPrompt carries all context; auto-loading this\n // file as system context makes agents explore instead of act immediately.\n return `---\ndescription: ClickSmith — how to handle captured UI change requests\nalwaysApply: false\n---\n\n${body.trim()}\n`;\n}\n\n/** Render the shared instruction body into a target's native file. */\nexport function renderInstructions(\n target: InstructionTarget,\n options: InstructionTemplateOptions = {},\n): RenderedInstruction {\n const body = renderInstructionBody(options);\n switch (target) {\n case 'claude':\n return { target, path: 'CLAUDE.md', shared: true, content: body };\n case 'codex':\n return { target, path: 'AGENTS.md', shared: true, content: body };\n case 'cursor':\n return { target, path: '.cursor/rules/clicksmith.mdc', shared: false, content: cursorMdc(body) };\n case 'antigravity':\n return {\n target,\n path: '.antigravity/rules/clicksmith.md',\n shared: false,\n content: `${body.trim()}\\n`,\n };\n case 'generic':\n return {\n target,\n path: '.clicksmith/AGENT_INSTRUCTIONS.md',\n shared: false,\n content: `${body.trim()}\\n`,\n };\n default: {\n const _exhaustive: never = target;\n throw new Error(`Unknown instruction target: ${String(_exhaustive)}`);\n }\n }\n}\n\n/** Render instruction files for several targets at once. */\nexport function renderAllInstructions(\n targets: readonly InstructionTarget[],\n options: InstructionTemplateOptions = {},\n): RenderedInstruction[] {\n return targets.map((t) => renderInstructions(t, options));\n}\n","import type { AgentConfig, AgentsConfig } from './config-schema.js';\n\n/**\n * Built-in agent templates. **These are example defaults — data, not launcher\n * logic.** Changing a vendor's CLI flag means editing `agents.config.json`\n * (or these defaults), never the daemon. The launcher only resolves the\n * `{placeholders}` below; it has no idea what `claude` or `codex` actually do.\n */\nexport const DEFAULT_AGENTS: AgentConfig[] = [\n {\n id: 'claude',\n label: 'Claude Code',\n command: 'claude',\n args: [\n '-p', '{agentPrompt}',\n '--dangerously-skip-permissions',\n '--verbose',\n '--append-system-prompt', '@{instructionFile}',\n ],\n detect: { anyOf: ['claude'] },\n instructions: { target: 'claude', file: 'CLAUDE.md' },\n mcp: { register: 'claude' },\n parse: { planReady: 'plan ready|here is the plan|## plan', error: '^error:|fatal:' },\n },\n {\n id: 'cursor',\n label: 'Cursor Agent',\n command: 'cursor-agent',\n args: ['--print', '{agentPrompt}'],\n detect: { anyOf: ['cursor-agent', 'cursor'] },\n instructions: { target: 'cursor', file: '.cursor/rules/clicksmith.mdc' },\n mcp: { register: 'cursor' },\n },\n {\n id: 'codex',\n label: 'OpenAI Codex',\n command: 'codex',\n args: [\n 'exec',\n '--cd',\n '{cwd}',\n '--sandbox',\n 'workspace-write',\n '--skip-git-repo-check',\n '--ephemeral',\n '-c',\n 'model_reasoning_effort=\"low\"',\n '{agentPrompt}',\n ],\n detect: { anyOf: ['codex'] },\n instructions: { target: 'codex', file: 'AGENTS.md' },\n mcp: { register: 'codex' },\n },\n {\n id: 'antigravity',\n label: 'Antigravity',\n command: 'antigravity',\n args: ['run', '--prompt', '{agentPrompt}'],\n detect: { anyOf: ['antigravity'] },\n instructions: { target: 'antigravity', file: '.antigravity/rules/clicksmith.md' },\n mcp: { register: 'mcp-json' },\n },\n {\n id: 'generic',\n label: 'Generic agent (customize me)',\n command: 'sh',\n args: [\n '-c',\n 'echo \"ClickSmith request: {prompt}\"; echo \"Bundle: {bundlePath}\"; echo \"Instructions: {instructionFile}\"; echo \"Mode: {mode}\"; echo \"Prompt: {agentPrompt}\"',\n ],\n instructions: { target: 'generic', file: '.clicksmith/AGENT_INSTRUCTIONS.md' },\n mcp: { register: 'mcp-json' },\n },\n];\n\n/** The full default `agents.config.json` document. */\nexport const DEFAULT_AGENTS_CONFIG: AgentsConfig = {\n version: 1,\n defaultAgent: 'claude',\n agents: DEFAULT_AGENTS,\n};\n","import type { AgentConfig, AgentsConfig } from './config-schema.js';\n\n/**\n * Layer agent configs: shipped defaults → project config → user config. Agents\n * with the same `id` are replaced by later layers; new ids are appended in\n * order. `defaultAgent` from the last layer that sets it wins.\n */\nexport function mergeAgentsConfig(base: AgentsConfig, ...overlays: AgentsConfig[]): AgentsConfig {\n let agents = [...base.agents];\n let defaultAgent = base.defaultAgent;\n\n for (const overlay of overlays) {\n agents = mergeAgentList(agents, overlay.agents);\n if (overlay.defaultAgent) defaultAgent = overlay.defaultAgent;\n }\n\n return {\n version: 1,\n ...(defaultAgent ? { defaultAgent } : {}),\n agents,\n };\n}\n\nfunction mergeAgentList(base: AgentConfig[], overlay: AgentConfig[]): AgentConfig[] {\n const byId = new Map(base.map((a) => [a.id, a]));\n const order = base.map((a) => a.id);\n for (const agent of overlay) {\n if (!byId.has(agent.id)) order.push(agent.id);\n byId.set(agent.id, agent);\n }\n return order.map((id) => byId.get(id)!);\n}\n\n/** Resolve the effective agent for a run: explicit id → defaultAgent → first. */\nexport function resolveAgent(config: AgentsConfig, agentId?: string): AgentConfig | undefined {\n if (agentId) return config.agents.find((a) => a.id === agentId);\n if (config.defaultAgent) {\n const found = config.agents.find((a) => a.id === config.defaultAgent);\n if (found) return found;\n }\n return config.agents[0];\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clicksmith/agent-config",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Config-driven agent adapters and the shared ClickSmith instruction template, rendered to native files for Claude, Cursor, Codex, Antigravity, and generic agents.",
5
5
  "license": "MIT",
6
6
  "type": "module",