@seclai/cli 1.4.0 → 1.5.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/CHANGELOG.md +161 -0
- package/README.md +150 -5
- package/dist/cli.js +988 -308
- package/dist/cli.js.map +1 -1
- package/package.json +5 -3
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/helpers.ts","../src/commands/agents.ts","../src/commands/sources.ts","../src/commands/contents.ts","../src/commands/kb.ts","../src/commands/memory.ts","../src/commands/evals.ts","../src/commands/solutions.ts","../src/commands/governance.ts","../src/commands/alerts.ts","../src/commands/models.ts","../src/commands/search.ts","../src/commands/ai.ts","../src/commands/skills.ts","../src/commands/mcp.ts","../src/commands/completion.ts","../src/commands/auth.ts","../src/commands/configure.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\n\nimport {\n type CliRuntime,\n type GlobalOptions,\n defaultRuntime,\n getCliVersion,\n printError,\n} from \"./helpers.js\";\n\nimport { register as registerAgents } from \"./commands/agents.js\";\nimport { register as registerSources } from \"./commands/sources.js\";\nimport { register as registerContents } from \"./commands/contents.js\";\nimport { register as registerKb } from \"./commands/kb.js\";\nimport { register as registerMemory } from \"./commands/memory.js\";\nimport { register as registerEvals } from \"./commands/evals.js\";\nimport { register as registerSolutions } from \"./commands/solutions.js\";\nimport { register as registerGovernance } from \"./commands/governance.js\";\nimport { register as registerAlerts } from \"./commands/alerts.js\";\nimport { register as registerModels } from \"./commands/models.js\";\nimport { register as registerSearch } from \"./commands/search.js\";\nimport { register as registerAi } from \"./commands/ai.js\";\nimport { register as registerSkills } from \"./commands/skills.js\";\nimport { register as registerMcp } from \"./commands/mcp.js\";\nimport { register as registerCompletion } from \"./commands/completion.js\";\nimport { register as registerAuth } from \"./commands/auth.js\";\nimport { register as registerConfigure } from \"./commands/configure.js\";\n\nexport type { CliRuntime, GlobalOptions };\n\n/**\n * Build the top-level Commander program with all command modules registered.\n * Pass a custom {@link CliRuntime} for testing; defaults to real process I/O.\n */\nexport function createProgram(rt: CliRuntime = defaultRuntime()): Command {\n const program = new Command();\n const cliVersion = getCliVersion();\n\n program\n .name(\"seclai\")\n .description(\n `Seclai Command Line Interface (v${cliVersion})\\n\\n` +\n `Manage agents, knowledge bases, sources, memory banks, evaluations, and more from the terminal.\\n\\n` +\n `All commands return JSON to stdout, making it easy to pipe into jq or other tools.`\n )\n .version(cliVersion, \"-V, --version\", \"output the version\")\n .option(\n \"--api-key <key>\",\n \"Seclai API key (defaults to SECLAI_API_KEY).\"\n )\n .option(\n \"--profile <name>\",\n \"SSO profile name (defaults to SECLAI_PROFILE, then 'default').\"\n )\n .option(\n \"--account-id <id>\",\n \"Account ID for multi-org targeting (X-Account-Id header).\"\n )\n .option(\n \"--config-dir <path>\",\n \"Config directory (defaults to SECLAI_CONFIG_DIR, then ~/.seclai).\"\n )\n .option(\n \"--compact\",\n \"Output compact JSON (no indentation).\"\n );\n\n program.addHelpText(\n \"after\",\n `\\nEnvironment:\\n` +\n ` SECLAI_API_KEY Default API key (alternative to --api-key)\\n` +\n ` SECLAI_API_URL Override API base URL (default: https://api.seclai.com)\\n` +\n ` SECLAI_PROFILE Default SSO profile (alternative to --profile)\\n` +\n ` SECLAI_CONFIG_DIR Config directory (alternative to --config-dir)\\n\\n` +\n `Examples:\\n` +\n ` seclai agents list\\n` +\n ` seclai agents run <agentId> --json '{\"input\":\"Hello\"}'\\n` +\n ` seclai agents run <agentId> --json '{\"input\":\"Hi\"}' --events\\n` +\n ` seclai configure sso\\n` +\n ` seclai auth login\\n` +\n ` seclai auth status\\n` +\n ` seclai sources list --profile dev\\n` +\n ` npx @seclai/cli agents list\\n`\n );\n\n program.configureOutput({\n writeOut: (str) => rt.writeOut(str),\n writeErr: (str) => rt.writeErr(str),\n });\n program.exitOverride();\n\n // Propagate global flags to runtime before any command action\n program.hook(\"preAction\", (thisCommand) => {\n const globalOpts = thisCommand.opts<GlobalOptions>();\n rt.compact = Boolean(globalOpts.compact);\n });\n\n // Register all command modules\n registerAgents(program, rt);\n registerSources(program, rt);\n registerContents(program, rt);\n registerKb(program, rt);\n registerMemory(program, rt);\n registerEvals(program, rt);\n registerSolutions(program, rt);\n registerGovernance(program, rt);\n registerAlerts(program, rt);\n registerModels(program, rt);\n registerSearch(program, rt);\n registerAi(program, rt);\n registerSkills(program, rt);\n registerMcp(program, rt);\n registerCompletion(program, rt);\n registerAuth(program, rt);\n registerConfigure(program, rt);\n\n return program;\n}\n\n/**\n * Parse `argv` and run the matching command.\n * Returns the process exit code (0 = success).\n */\nexport async function runCli(argv: string[], rt: CliRuntime = defaultRuntime()): Promise<number> {\n let observedExitCode = 0;\n const wrappedRt: CliRuntime = {\n ...rt,\n setExitCode: (code) => {\n observedExitCode = code;\n rt.setExitCode(code);\n },\n };\n\n const program = createProgram(wrappedRt);\n let exitCode = 0;\n\n try {\n await program.parseAsync(argv);\n } catch (err: any) {\n const maybeExitCode = typeof err?.exitCode === \"number\" ? err.exitCode : undefined;\n if (maybeExitCode !== undefined) {\n exitCode = maybeExitCode;\n } else {\n printError(wrappedRt, err);\n exitCode = 1;\n }\n }\n\n const finalExitCode = observedExitCode !== 0 ? observedExitCode : exitCode;\n wrappedRt.setExitCode(finalExitCode);\n return finalExitCode;\n}\n\n// Only run when executed as an entrypoint, not when imported.\nif (process.argv[1]) {\n try {\n const entryReal = realpathSync(process.argv[1]);\n const selfReal = realpathSync(fileURLToPath(import.meta.url));\n if (entryReal === selfReal) {\n await runCli(process.argv);\n }\n } catch {\n const entryHref = pathToFileURL(process.argv[1]).href;\n if (import.meta.url === entryHref) {\n await runCli(process.argv);\n }\n }\n}\n","import { Command } from \"commander\";\nimport { readFile } from \"node:fs/promises\";\nimport { readFileSync } from \"node:fs\";\nimport process from \"node:process\";\n\nimport {\n Seclai,\n SeclaiAPIStatusError,\n SeclaiAPIValidationError,\n SeclaiConfigurationError,\n} from \"@seclai/sdk\";\n\n/** Global CLI options parsed from top-level flags (--api-key, --compact, --profile, --account-id, --config-dir). */\nexport type GlobalOptions = {\n apiKey?: string;\n compact?: boolean;\n profile?: string;\n accountId?: string;\n configDir?: string;\n};\n\n/** Runtime abstraction that decouples the CLI from Node globals, enabling testability. */\nexport type CliRuntime = {\n stdin: NodeJS.ReadableStream;\n writeOut: (text: string) => void;\n /** Write raw bytes to stdout (e.g. binary downloads). Routed through the runtime for testability. */\n writeOutBytes: (bytes: Uint8Array) => void;\n writeErr: (text: string) => void;\n setExitCode: (code: number) => void;\n compact?: boolean;\n};\n\n/** Create a {@link CliRuntime} wired to process stdin/stdout/stderr. */\nexport function defaultRuntime(): CliRuntime {\n return {\n stdin: process.stdin,\n writeOut: (text) => {\n process.stdout.write(text);\n },\n writeOutBytes: (bytes) => {\n process.stdout.write(bytes);\n },\n writeErr: (text) => {\n process.stderr.write(text);\n },\n setExitCode: (code) => {\n process.exitCode = code;\n },\n };\n}\n\n/** Read all of stdin as a UTF-8 string. */\nexport async function readStdinText(rt: CliRuntime): Promise<string> {\n return await new Promise((resolve, reject) => {\n let data = \"\";\n rt.stdin.setEncoding(\"utf8\");\n rt.stdin.on(\"data\", (chunk: string) => (data += chunk));\n rt.stdin.on(\"end\", () => resolve(data));\n rt.stdin.on(\"error\", reject);\n });\n}\n\n/**\n * Resolve JSON input from `--json` or `--json-file` options.\n * Pass `\"-\"` as the value to read from stdin.\n * @throws If neither option is provided, or both are.\n */\nexport async function readJsonInput(\n rt: CliRuntime,\n opts: { json?: string; jsonFile?: string }\n): Promise<unknown> {\n if (opts.json !== undefined && opts.jsonFile !== undefined) {\n throw new Error(\"Provide only one of --json or --json-file\");\n }\n\n if (opts.jsonFile !== undefined) {\n const text =\n opts.jsonFile === \"-\" ? await readStdinText(rt) : await readFile(opts.jsonFile, \"utf8\");\n return JSON.parse(text);\n }\n\n if (opts.json !== undefined) {\n const text = opts.json === \"-\" ? await readStdinText(rt) : opts.json;\n return JSON.parse(text);\n }\n\n throw new Error(\"Missing JSON input. Provide --json or --json-file.\");\n}\n\n/**\n * Like {@link readJsonInput} but validates the result is a plain object.\n * @throws If the parsed value is not a JSON object.\n */\nexport async function readJsonObjectInput(\n rt: CliRuntime,\n opts: { json?: string; jsonFile?: string }\n): Promise<Record<string, unknown>> {\n const value = await readJsonInput(rt, opts);\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(\"Expected a JSON object.\");\n }\n return value as Record<string, unknown>;\n}\n\n/** Read the CLI version from the nearest package.json. Returns `\"0.0.0\"` on failure. */\nexport function getCliVersion(): string {\n try {\n const packageJsonPath = new URL(\"../package.json\", import.meta.url);\n const raw = readFileSync(packageJsonPath, \"utf8\");\n const parsed = JSON.parse(raw) as { version?: unknown };\n return typeof parsed.version === \"string\" ? parsed.version : \"0.0.0\";\n } catch {\n return \"0.0.0\";\n }\n}\n\n/** Create a {@link Seclai} SDK client from global CLI options and environment variables. */\nexport function createClient(opts: GlobalOptions): Seclai {\n const seclaiOpts: {\n apiKey?: string;\n baseUrl?: string;\n profile?: string;\n configDir?: string;\n accountId?: string;\n } = {};\n\n if (opts.apiKey !== undefined) seclaiOpts.apiKey = opts.apiKey;\n if (opts.profile !== undefined) seclaiOpts.profile = opts.profile;\n if (opts.configDir !== undefined) seclaiOpts.configDir = opts.configDir;\n if (opts.accountId !== undefined) seclaiOpts.accountId = opts.accountId;\n\n const envUrl = process.env.SECLAI_API_URL;\n seclaiOpts.baseUrl = envUrl && envUrl.length > 0 ? envUrl : \"https://api.seclai.com\";\n\n return new Seclai(seclaiOpts);\n}\n\n/** Serialize `value` as JSON to stdout. Respects `rt.compact` for indentation. */\nexport function printJson(rt: CliRuntime, value: unknown): void {\n const indent = rt.compact ? undefined : 2;\n rt.writeOut(`${JSON.stringify(value, null, indent)}\\n`);\n}\n\n/** Print a human-readable error to stderr. Shows extra detail for SDK error types. */\nexport function printError(rt: CliRuntime, err: unknown): void {\n if (err instanceof SeclaiAPIValidationError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`status: ${err.statusCode}\\n`);\n rt.writeErr(`url: ${err.url}\\n`);\n if (err.responseText) rt.writeErr(`response: ${err.responseText}\\n`);\n if (err.validationError) printJson(rt, { validationError: err.validationError });\n return;\n }\n\n if (err instanceof SeclaiAPIStatusError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`status: ${err.statusCode}\\n`);\n rt.writeErr(`url: ${err.url}\\n`);\n if (err.responseText) rt.writeErr(`response: ${err.responseText}\\n`);\n return;\n }\n\n if (err instanceof SeclaiConfigurationError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`hint: Set the SECLAI_API_KEY environment variable or pass --api-key.\\n`);\n return;\n }\n\n if (err instanceof Error) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n return;\n }\n\n rt.writeErr(String(err));\n rt.writeErr(\"\\n\");\n}\n\n/** Execute `main`, catching errors and routing them to {@link printError}. */\nexport async function run(rt: CliRuntime, main: () => Promise<void>): Promise<void> {\n try {\n await main();\n } catch (err) {\n printError(rt, err);\n rt.setExitCode(1);\n }\n}\n\n/** Add common pagination options to a command */\nexport function withListOptions(cmd: Command): Command {\n return cmd\n .option(\"--page <n>\", \"Page number (1-based).\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v));\n}\n\n/** Add sortable list options (page, limit, sort, order) */\nexport function withSortableListOptions(cmd: Command): Command {\n return withListOptions(cmd)\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\");\n}\n\n/** Add --json / --json-file options to a command */\nexport function withJsonInputOptions(cmd: Command): Command {\n return cmd\n .option(\"--json <json>\", \"Inline JSON body. Use '-' to read from stdin.\")\n .option(\"--json-file <path>\", \"Path to JSON file. Use '-' to read from stdin.\");\n}\n\n/** Add file upload options */\nexport function withFileUploadOptions(cmd: Command): Command {\n return cmd\n .requiredOption(\"--file <path>\", \"Path to a local file to upload.\")\n .option(\"--title <title>\", \"Optional title.\")\n .option(\"--metadata <json>\", \"Metadata JSON object. Use '-' for stdin.\")\n .option(\"--metadata-file <path>\", \"Path to metadata JSON file. Use '-' for stdin.\")\n .option(\"--file-name <name>\", \"Override filename sent to API.\")\n .option(\"--mime-type <type>\", \"Explicit MIME type.\");\n}\n\n/** Build upload opts from CLI flags */\nexport async function buildUploadOpts(\n rt: CliRuntime,\n opts: {\n file: string;\n title?: string;\n metadata?: string;\n metadataFile?: string;\n fileName?: string;\n mimeType?: string;\n }\n): Promise<{\n file: Uint8Array;\n title?: string;\n metadata?: Record<string, unknown>;\n fileName?: string;\n mimeType?: string;\n}> {\n const bytes = new Uint8Array(await readFile(opts.file));\n const result: {\n file: Uint8Array;\n title?: string;\n metadata?: Record<string, unknown>;\n fileName?: string;\n mimeType?: string;\n } = { file: bytes };\n if (opts.title !== undefined) result.title = opts.title;\n if (opts.metadata !== undefined || opts.metadataFile !== undefined) {\n const jsonArg = opts.metadata !== undefined ? { json: opts.metadata } : {};\n const jsonFileArg = opts.metadataFile !== undefined ? { jsonFile: opts.metadataFile } : {};\n result.metadata = await readJsonObjectInput(rt, { ...jsonArg, ...jsonFileArg });\n }\n if (opts.fileName !== undefined) result.fileName = opts.fileName;\n if (opts.mimeType !== undefined) result.mimeType = opts.mimeType;\n return result;\n}\n\n/** Pick defined values from opts for list calls */\nexport function listOpts(opts: {\n page?: number;\n limit?: number;\n sort?: string;\n order?: string;\n}): Record<string, unknown> {\n const o: Record<string, unknown> = {};\n if (opts.page !== undefined) o.page = opts.page;\n if (opts.limit !== undefined) o.limit = opts.limit;\n if (opts.sort !== undefined) o.sort = opts.sort;\n if (opts.order !== undefined) o.order = opts.order;\n return o;\n}\n\n/** Signature for a command module's `register` function. */\nexport type RegisterFn = (program: Command, rt: CliRuntime) => void;\n\n/** Add --user-input / --json / --json-file options for AI assistant commands */\nexport function withAiInputOptions(cmd: Command): Command {\n return cmd\n .option(\"--user-input <text>\", \"User input text (shorthand for --json '{\\\"user_input\\\":\\\"...\\\"}')\")\n .option(\"--json <json>\", \"Full request body JSON.\")\n .option(\"--json-file <path>\", \"Request body JSON file.\");\n}\n\n/** Read AI assistant input: --user-input takes precedence, falls back to --json/--json-file */\nexport async function readAiInput(\n rt: CliRuntime,\n opts: { userInput?: string; json?: string; jsonFile?: string }\n): Promise<unknown> {\n if (opts.userInput !== undefined) {\n return { user_input: opts.userInput };\n }\n const jsonArg = opts.json !== undefined ? { json: opts.json } : {};\n const jsonFileArg = opts.jsonFile !== undefined ? { jsonFile: opts.jsonFile } : {};\n return readJsonInput(rt, { ...jsonArg, ...jsonFileArg });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport {\n run,\n createClient,\n printJson,\n readJsonInput,\n readAiInput,\n withAiInputOptions,\n listOpts,\n} from \"../helpers.js\";\n\n/** Register `agents` commands: CRUD, run (basic/stream/events/poll), runs, definition, export, input uploads, AI assistant. */\nexport function register(program: Command, rt: CliRuntime): void {\n const agents = program\n .command(\"agents\")\n .description(\"Manage agents, runs, definitions, export, and AI assistance.\");\n\n // --- CRUD ---\n\n agents\n .command(\"list\")\n .description(\"List agents.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listAgents(listOpts(opts)));\n });\n });\n\n agents\n .command(\"create\")\n .description(\"Create a new agent.\")\n .option(\"--json <json>\", \"Inline JSON body. Use '-' for stdin.\")\n .option(\"--json-file <path>\", \"JSON file path. Use '-' for stdin.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createAgent(body as any));\n });\n });\n\n agents\n .command(\"get\")\n .description(\"Get an agent by ID.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgent(agentId));\n });\n });\n\n agents\n .command(\"update\")\n .description(\"Update an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Inline JSON body.\")\n .option(\"--json-file <path>\", \"JSON file path.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateAgent(agentId, body as any));\n });\n });\n\n agents\n .command(\"delete\")\n .description(\"Delete an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteAgent(agentId);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Run ---\n\n agents\n .command(\"run\")\n .description(\"Run an agent. Use --stream/--events/--poll for different modes.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Inline JSON body. Use '-' for stdin.\")\n .option(\"--json-file <path>\", \"JSON file path. Use '-' for stdin.\")\n .option(\"--stream\", \"Stream and print final result when done.\")\n .option(\"--events\", \"Stream SSE events as newline-delimited JSON.\")\n .option(\"--event-filter <types>\", \"Comma-separated event types to show (with --events).\")\n .option(\"--output <mode>\", \"Output mode: 'full' prints entire event, 'data' prints only the data field, 'status' prints a one-line summary.\", \"full\")\n .option(\"--poll\", \"Poll until completion instead of streaming.\")\n .option(\"--poll-interval-ms <n>\", \"Poll interval in ms (with --poll).\", (v: string) => Number(v))\n .option(\"--timeout-ms <n>\", \"Client-side timeout in ms.\", (v: string) => Number(v))\n .option(\"--include-step-outputs\", \"Include step outputs (with --poll).\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n\n if (opts.events) {\n // Stream SSE events as NDJSON\n const filterSet = opts.eventFilter\n ? new Set(opts.eventFilter.split(\",\").map((s: string) => s.trim()))\n : undefined;\n\n const stream = client.runStreamingAgent(\n agentId,\n body as any,\n opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : undefined\n );\n\n for await (const event of stream) {\n if (filterSet && !filterSet.has((event as any).type ?? \"\")) continue;\n\n if (opts.output === \"data\") {\n rt.writeOut(JSON.stringify((event as any).data ?? event) + \"\\n\");\n } else if (opts.output === \"status\") {\n const e = event as any;\n rt.writeOut(`${e.type ?? \"event\"}: ${e.status ?? JSON.stringify(e.data ?? e)}\\n`);\n } else {\n rt.writeOut(JSON.stringify(event) + \"\\n\");\n }\n }\n return;\n }\n\n if (opts.poll) {\n const pollOpts: Record<string, unknown> = {};\n if (opts.pollIntervalMs !== undefined) pollOpts.pollIntervalMs = opts.pollIntervalMs;\n if (opts.timeoutMs !== undefined) pollOpts.timeoutMs = opts.timeoutMs;\n if (opts.includeStepOutputs) pollOpts.includeStepOutputs = true;\n printJson(rt, await client.runAgentAndPoll(agentId, body as any, pollOpts as any));\n return;\n }\n\n if (opts.stream) {\n printJson(\n rt,\n await client.runStreamingAgentAndWait(\n agentId,\n body as any,\n opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : undefined\n )\n );\n return;\n }\n\n printJson(rt, await client.runAgent(agentId, body as any));\n });\n });\n\n // --- Runs ---\n\n const runs = agents.command(\"runs\").description(\"Manage agent runs.\");\n\n runs\n .command(\"list\")\n .description(\"List runs for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--status <status>\", \"Filter by run status (e.g. queued, running, completed, failed, cancelled).\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Record<string, unknown> = listOpts(opts);\n if (opts.status) o.status = opts.status;\n printJson(rt, await client.listAgentRuns(agentId, o));\n });\n });\n\n runs\n .command(\"get\")\n .description(\"Get a specific run.\")\n .argument(\"<runId>\", \"Run ID.\")\n .option(\"--include-step-outputs\", \"Include step-level outputs.\")\n .action(async (runId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(\n rt,\n await client.getAgentRun(runId, opts.includeStepOutputs ? { includeStepOutputs: true } : undefined)\n );\n });\n });\n\n runs\n .command(\"delete\")\n .description(\"Delete a run.\")\n .argument(\"<runId>\", \"Run ID.\")\n .action(async (runId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteAgentRun(runId);\n printJson(rt, { ok: true });\n });\n });\n\n runs\n .command(\"cancel\")\n .description(\"Cancel a running agent run.\")\n .argument(\"<runId>\", \"Run ID.\")\n .action(async (runId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.cancelAgentRun(runId));\n });\n });\n\n runs\n .command(\"search\")\n .description(\"Search agent runs.\")\n .option(\"--json <json>\", \"Search body JSON.\")\n .option(\"--json-file <path>\", \"Search body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.searchAgentRuns(body as any));\n });\n });\n\n runs\n .command(\"download-attachment\")\n .description(\n \"Download a file attachment emitted by a step in an agent run. \" +\n \"The attachmentId is the URL-safe-base64 storage_key from run output manifests / webhooks.\",\n )\n .argument(\"<runId>\", \"Run ID.\")\n .argument(\"<attachmentId>\", \"Attachment ID (storage_key).\")\n .option(\"--download-name <name>\", \"Filename hint for the download disposition.\")\n .option(\"--output <path>\", \"Write the attachment bytes to this file. If omitted, raw bytes are written to stdout.\")\n .action(async (runId: string, attachmentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const res = await client.downloadAgentRunAttachment(\n runId,\n attachmentId,\n opts.downloadName ? { downloadName: opts.downloadName } : {},\n );\n if (opts.output) {\n const { createWriteStream } = await import(\"node:fs\");\n const { stat } = await import(\"node:fs/promises\");\n if (res.body) {\n // Stream the body straight to disk so large attachments never get\n // buffered fully in memory.\n const { Readable } = await import(\"node:stream\");\n const { pipeline } = await import(\"node:stream/promises\");\n await pipeline(\n Readable.fromWeb(res.body as Parameters<typeof Readable.fromWeb>[0]),\n createWriteStream(opts.output),\n );\n } else {\n // Fallback for runtimes/mocks without a streamable body.\n const { writeFile } = await import(\"node:fs/promises\");\n await writeFile(opts.output, Buffer.from(await res.arrayBuffer()));\n }\n const { size } = await stat(opts.output);\n printJson(rt, { saved: opts.output, bytes: size });\n } else {\n rt.writeOutBytes(new Uint8Array(await res.arrayBuffer()));\n }\n });\n });\n\n // --- Definition ---\n\n const def = agents.command(\"def\").description(\"Agent definition (step workflow).\");\n\n def\n .command(\"get\")\n .description(\"Get agent definition.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentDefinition(agentId));\n });\n });\n\n def\n .command(\"update\")\n .description(\"Update agent definition.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Definition JSON body.\")\n .option(\"--json-file <path>\", \"Definition JSON file.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateAgentDefinition(agentId, body as any));\n });\n });\n\n // --- Export / Import ---\n\n agents\n .command(\"export\")\n .description(\"Export an agent definition as a portable JSON snapshot.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--no-download\", \"Omit Content-Disposition header (inline response).\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.exportAgent(agentId, opts.download as boolean));\n });\n });\n\n agents\n .command(\"preview-import\")\n .description(\n \"Validate an agent_definition payload without creating any agent. \" +\n \"Reports step/schedule/alert/criteria/policy counts and any unresolved_refs \" +\n \"(workflow refs to KBs, memory banks, source connections, or sub-agents \" +\n \"that don't exist in this account).\",\n )\n .option(\"--json <json>\", \"Inline JSON body ({ agent_definition: ... }). Use '-' for stdin.\")\n .option(\"--json-file <path>\", \"JSON file path. Use '-' for stdin.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.previewImportAgent(body as any));\n });\n });\n\n // --- Input uploads ---\n\n agents\n .command(\"upload-input\")\n .description(\"Upload a file as agent input.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .requiredOption(\"--file <path>\", \"File to upload.\")\n .option(\"--file-name <name>\", \"Override filename.\")\n .option(\"--mime-type <type>\", \"MIME type.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const { readFile } = await import(\"node:fs/promises\");\n const bytes = new Uint8Array(await readFile(opts.file));\n const o: Record<string, unknown> = { file: bytes };\n if (opts.fileName) o.fileName = opts.fileName;\n if (opts.mimeType) o.mimeType = opts.mimeType;\n printJson(rt, await client.uploadAgentInput(agentId, o as any));\n });\n });\n\n agents\n .command(\"input-status\")\n .description(\"Check agent input upload status.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .argument(\"<uploadId>\", \"Upload ID.\")\n .action(async (agentId: string, uploadId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentInputUploadStatus(agentId, uploadId));\n });\n });\n\n agents\n .command(\"attachment-references\")\n .description(\n \"Show which files (if any) an agent's templates expect on a run. \" +\n \"Call before staging uploads: requires_uploads reports whether the agent accepts files, \" +\n \"and the agent block lists the exact names / indexes / patterns a run-time batch must satisfy.\",\n )\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentAttachmentReferences(agentId));\n });\n });\n\n // --- AI Assistant ---\n\n const ai = agents.command(\"ai\").description(\"Agent AI assistant.\");\n\n withAiInputOptions(\n ai.command(\"gen-steps\")\n .description(\"Generate agent steps via AI.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n ).action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateAgentSteps(agentId, body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"step-config\")\n .description(\"Generate step config via AI.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n ).action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateStepConfig(agentId, body as any));\n });\n });\n\n ai.command(\"history\")\n .description(\"Get agent AI conversation history.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentAiConversationHistory(agentId));\n });\n });\n\n ai.command(\"mark\")\n .description(\"Mark an AI suggestion (accept/reject).\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Mark body JSON.\")\n .option(\"--json-file <path>\", \"Mark body JSON file.\")\n .action(async (agentId: string, conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n await client.markAgentAiSuggestion(agentId, conversationId, body as any);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Run eval results (under runs) ---\n\n runs\n .command(\"eval-results\")\n .description(\"List evaluation results for a run.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .argument(\"<runId>\", \"Run ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (agentId: string, runId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listRunEvaluationResults(agentId, runId, listOpts(opts)));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport {\n run,\n createClient,\n printJson,\n readJsonInput,\n buildUploadOpts,\n withFileUploadOptions,\n listOpts,\n} from \"../helpers.js\";\n\n/** Register `sources` commands: CRUD, file/text upload, exports, embedding migration. */\nexport function register(program: Command, rt: CliRuntime): void {\n const sources = program\n .command(\"sources\")\n .alias(\"source\")\n .description(\"Manage content sources.\");\n\n // --- CRUD ---\n\n sources\n .command(\"list\")\n .description(\"List sources.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\")\n .option(\"--account-id <id>\", \"Filter by account ID.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const client = createClient(globalOpts);\n const o: Record<string, unknown> = listOpts(opts);\n const acctId = opts.accountId || globalOpts.accountId;\n if (acctId) o.accountId = acctId;\n printJson(rt, await client.listSources(o));\n });\n });\n\n sources\n .command(\"create\")\n .description(\"Create a source.\")\n .option(\"--json <json>\", \"Source body JSON.\")\n .option(\"--json-file <path>\", \"Source body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createSource(body as any));\n });\n });\n\n sources\n .command(\"get\")\n .description(\"Get a source by ID.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getSource(sourceId));\n });\n });\n\n sources\n .command(\"update\")\n .description(\"Update a source.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateSource(sourceId, body as any));\n });\n });\n\n sources\n .command(\"delete\")\n .description(\"Delete a source.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteSource(sourceId);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Upload ---\n\n const uploadCmd = sources.command(\"upload\").description(\"Upload a file to a source.\");\n withFileUploadOptions(uploadCmd)\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const uploadOpts = await buildUploadOpts(rt, opts);\n printJson(rt, await client.uploadFileToSource(sourceId, uploadOpts));\n });\n });\n\n sources\n .command(\"upload-text\")\n .description(\"Upload inline text to a source.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Inline text body JSON.\")\n .option(\"--json-file <path>\", \"Inline text body JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.uploadInlineTextToSource(sourceId, body as any));\n });\n });\n\n // --- Exports ---\n\n const exports_ = sources.command(\"exports\").description(\"Manage source exports.\");\n\n exports_\n .command(\"list\")\n .description(\"List exports for a source.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listSourceExports(sourceId, listOpts(opts)));\n });\n });\n\n exports_\n .command(\"create\")\n .description(\"Create an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Export body JSON.\")\n .option(\"--json-file <path>\", \"Export body JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createSourceExport(sourceId, body as any));\n });\n });\n\n exports_\n .command(\"get\")\n .description(\"Get an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .argument(\"<exportId>\", \"Export ID.\")\n .action(async (sourceId: string, exportId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getSourceExport(sourceId, exportId));\n });\n });\n\n exports_\n .command(\"cancel\")\n .description(\"Cancel an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .argument(\"<exportId>\", \"Export ID.\")\n .action(async (sourceId: string, exportId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.cancelSourceExport(sourceId, exportId));\n });\n });\n\n exports_\n .command(\"delete\")\n .description(\"Delete an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .argument(\"<exportId>\", \"Export ID.\")\n .action(async (sourceId: string, exportId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteSourceExport(sourceId, exportId);\n printJson(rt, { ok: true });\n });\n });\n\n exports_\n .command(\"download\")\n .description(\"Download an export (prints raw response body).\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .argument(\"<exportId>\", \"Export ID.\")\n .action(async (sourceId: string, exportId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const res = await client.downloadSourceExport(sourceId, exportId);\n rt.writeOut(await res.text());\n });\n });\n\n exports_\n .command(\"estimate\")\n .description(\"Estimate an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Estimate body JSON.\")\n .option(\"--json-file <path>\", \"Estimate body JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.estimateSourceExport(sourceId, body as any));\n });\n });\n\n // --- Embedding Migration ---\n\n const migration = sources.command(\"migration\").description(\"Source embedding migrations.\");\n\n migration\n .command(\"get\")\n .description(\"Get migration status.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getSourceEmbeddingMigration(sourceId));\n });\n });\n\n migration\n .command(\"start\")\n .description(\"Start an embedding migration.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Migration config JSON.\")\n .option(\"--json-file <path>\", \"Migration config JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.startSourceEmbeddingMigration(sourceId, body as any));\n });\n });\n\n migration\n .command(\"cancel\")\n .description(\"Cancel an embedding migration.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.cancelSourceEmbeddingMigration(sourceId));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport {\n run,\n createClient,\n printJson,\n readJsonInput,\n buildUploadOpts,\n withFileUploadOptions,\n listOpts,\n} from \"../helpers.js\";\n\n/** Register `contents` commands: get, delete, upload/replace, replace-text, embeddings. */\nexport function register(program: Command, rt: CliRuntime): void {\n const contents = program\n .command(\"contents\")\n .description(\"Manage indexed content and embeddings.\");\n\n contents\n .command(\"get\")\n .description(\"Get content version details.\")\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .option(\"--start <n>\", \"Text start offset (0-based).\", (v: string) => Number(v))\n .option(\"--end <n>\", \"Text end offset (exclusive).\", (v: string) => Number(v))\n .action(async (contentVersionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Record<string, unknown> = {};\n if (opts.start !== undefined) o.start = opts.start;\n if (opts.end !== undefined) o.end = opts.end;\n printJson(rt, await client.getContentDetail(contentVersionId, o));\n });\n });\n\n contents\n .command(\"delete\")\n .description(\"Delete a content version.\")\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .action(async (contentVersionId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteContent(contentVersionId);\n printJson(rt, { ok: true });\n });\n });\n\n const uploadCmd = contents.command(\"upload\").alias(\"replace\").description(\"Upload/replace content file.\");\n withFileUploadOptions(uploadCmd)\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .action(async (contentVersionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const uploadOpts = await buildUploadOpts(rt, opts);\n printJson(rt, await client.uploadFileToContent(contentVersionId, uploadOpts));\n });\n });\n\n contents\n .command(\"replace-text\")\n .description(\"Replace content with inline text.\")\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .option(\"--json <json>\", \"Inline text body JSON.\")\n .option(\"--json-file <path>\", \"Inline text body JSON file.\")\n .action(async (contentVersionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.replaceContentWithInlineText(contentVersionId, body as any));\n });\n });\n\n contents\n .command(\"embeddings\")\n .description(\"List embeddings for a content version.\")\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (contentVersionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listContentEmbeddings(contentVersionId, listOpts(opts)));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, listOpts } from \"../helpers.js\";\n\n/** Register `kb` (knowledge base) commands: list, create, get, update, delete. */\nexport function register(program: Command, rt: CliRuntime): void {\n const kb = program.command(\"kb\").description(\"Manage knowledge bases.\");\n\n kb.command(\"list\")\n .description(\"List knowledge bases.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listKnowledgeBases(listOpts(opts)));\n });\n });\n\n kb.command(\"create\")\n .description(\"Create a knowledge base.\")\n .option(\"--json <json>\", \"Body JSON.\")\n .option(\"--json-file <path>\", \"Body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createKnowledgeBase(body as any));\n });\n });\n\n kb.command(\"get\")\n .description(\"Get a knowledge base.\")\n .argument(\"<kbId>\", \"Knowledge base ID.\")\n .action(async (kbId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getKnowledgeBase(kbId));\n });\n });\n\n kb.command(\"update\")\n .description(\"Update a knowledge base.\")\n .argument(\"<kbId>\", \"Knowledge base ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (kbId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateKnowledgeBase(kbId, body as any));\n });\n });\n\n kb.command(\"delete\")\n .description(\"Delete a knowledge base.\")\n .argument(\"<kbId>\", \"Knowledge base ID.\")\n .action(async (kbId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteKnowledgeBase(kbId);\n printJson(rt, { ok: true });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, readAiInput, withAiInputOptions, readJsonObjectInput, listOpts } from \"../helpers.js\";\n\n/** Register `memory` commands: CRUD, stats, utilities, test-compaction, AI assistant. */\nexport function register(program: Command, rt: CliRuntime): void {\n const memory = program.command(\"memory\").description(\"Manage memory banks.\");\n\n // --- CRUD ---\n\n memory\n .command(\"list\")\n .description(\"List memory banks.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listMemoryBanks(listOpts(opts)));\n });\n });\n\n memory\n .command(\"create\")\n .description(\"Create a memory bank.\")\n .option(\"--json <json>\", \"Body JSON.\")\n .option(\"--json-file <path>\", \"Body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createMemoryBank(body as any));\n });\n });\n\n memory\n .command(\"get\")\n .description(\"Get a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getMemoryBank(memoryBankId));\n });\n });\n\n memory\n .command(\"update\")\n .description(\"Update a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (memoryBankId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateMemoryBank(memoryBankId, body as any));\n });\n });\n\n memory\n .command(\"delete\")\n .description(\"Delete a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteMemoryBank(memoryBankId);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Stats & utilities ---\n\n memory\n .command(\"stats\")\n .description(\"Get memory bank statistics.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getMemoryBankStats(memoryBankId));\n });\n });\n\n memory\n .command(\"agents\")\n .description(\"List agents using a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentsUsingMemoryBank(memoryBankId));\n });\n });\n\n memory\n .command(\"compact\")\n .description(\"Compact a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.compactMemoryBank(memoryBankId);\n printJson(rt, { ok: true });\n });\n });\n\n memory\n .command(\"delete-source\")\n .description(\"Delete a memory bank's source data.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteMemoryBankSource(memoryBankId);\n printJson(rt, { ok: true });\n });\n });\n\n memory\n .command(\"templates\")\n .description(\"List memory bank templates.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listMemoryBankTemplates());\n });\n });\n\n memory\n .command(\"test-compaction\")\n .description(\"Test compaction on a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .option(\"--json <json>\", \"Test config JSON.\")\n .option(\"--json-file <path>\", \"Test config JSON file.\")\n .action(async (memoryBankId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.testMemoryBankCompaction(memoryBankId, body as any));\n });\n });\n\n memory\n .command(\"test-compaction-standalone\")\n .description(\"Test compaction prompt standalone (no memory bank required).\")\n .option(\"--json <json>\", \"Test config JSON.\")\n .option(\"--json-file <path>\", \"Test config JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.testCompactionPromptStandalone(body as any));\n });\n });\n\n // --- AI ---\n\n const ai = memory.command(\"ai\").description(\"Memory bank AI assistant.\");\n\n withAiInputOptions(\n ai.command(\"generate\")\n .description(\"Generate memory bank config via AI.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateMemoryBankConfig(body as any));\n });\n });\n\n ai.command(\"last\")\n .description(\"Get last memory bank AI conversation.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getMemoryBankAiLastConversation());\n });\n });\n\n ai.command(\"accept\")\n .description(\"Accept a memory bank AI suggestion.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Accept body JSON.\")\n .option(\"--json-file <path>\", \"Accept body JSON file.\")\n .action(async (conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.acceptMemoryBankAiSuggestion(conversationId, body as any));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, listOpts } from \"../helpers.js\";\n\n/** Register `evals` commands: criteria CRUD, results, compatible-runs, test-draft, agent-level summaries. */\nexport function register(program: Command, rt: CliRuntime): void {\n const evals = program.command(\"evals\").description(\"Manage evaluations.\");\n\n // --- Criteria ---\n\n const criteria = evals.command(\"criteria\").description(\"Evaluation criteria.\");\n\n criteria\n .command(\"list\")\n .description(\"List evaluation criteria for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listEvaluationCriteria(agentId, listOpts(opts)));\n });\n });\n\n criteria\n .command(\"create\")\n .description(\"Create evaluation criteria.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Criteria body JSON.\")\n .option(\"--json-file <path>\", \"Criteria body JSON file.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createEvaluationCriteria(agentId, body as any));\n });\n });\n\n criteria\n .command(\"get\")\n .description(\"Get evaluation criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .action(async (criteriaId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getEvaluationCriteria(criteriaId));\n });\n });\n\n criteria\n .command(\"update\")\n .description(\"Update evaluation criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (criteriaId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateEvaluationCriteria(criteriaId, body as any));\n });\n });\n\n criteria\n .command(\"delete\")\n .description(\"Delete evaluation criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .action(async (criteriaId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteEvaluationCriteria(criteriaId);\n printJson(rt, { ok: true });\n });\n });\n\n criteria\n .command(\"summary\")\n .description(\"Get criteria evaluation summary.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .action(async (criteriaId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getEvaluationCriteriaSummary(criteriaId));\n });\n });\n\n // --- Results ---\n\n const results = evals.command(\"results\").description(\"Evaluation results.\");\n\n results\n .command(\"list\")\n .description(\"List results for criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (criteriaId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listEvaluationResults(criteriaId, listOpts(opts)));\n });\n });\n\n results\n .command(\"create\")\n .description(\"Create an evaluation result.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .option(\"--json <json>\", \"Result body JSON.\")\n .option(\"--json-file <path>\", \"Result body JSON file.\")\n .action(async (criteriaId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createEvaluationResult(criteriaId, body as any));\n });\n });\n\n // --- Misc ---\n\n evals\n .command(\"compatible-runs\")\n .description(\"List runs compatible with criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (criteriaId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listCompatibleRuns(criteriaId, listOpts(opts)));\n });\n });\n\n evals\n .command(\"test-draft\")\n .description(\"Test a draft evaluation.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Test body JSON.\")\n .option(\"--json-file <path>\", \"Test body JSON file.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.testDraftEvaluation(agentId, body as any));\n });\n });\n\n evals\n .command(\"agent-results\")\n .description(\"List all evaluation results for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listAgentEvaluationResults(agentId, listOpts(opts)));\n });\n });\n\n evals\n .command(\"agent-runs\")\n .description(\"List evaluation run summaries for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listEvaluationRuns(agentId, listOpts(opts)));\n });\n });\n\n evals\n .command(\"non-manual-summary\")\n .description(\"Get non-manual evaluation summary for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getNonManualEvaluationSummary(agentId));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, readAiInput, withAiInputOptions, listOpts } from \"../helpers.js\";\n\n/** Register `solutions` commands: CRUD, link/unlink, conversations, AI assistant. */\nexport function register(program: Command, rt: CliRuntime): void {\n const solutions = program.command(\"solutions\").description(\"Manage solutions.\");\n\n // --- CRUD ---\n\n solutions\n .command(\"list\")\n .description(\"List solutions.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listSolutions(listOpts(opts)));\n });\n });\n\n solutions\n .command(\"create\")\n .description(\"Create a solution.\")\n .option(\"--json <json>\", \"Body JSON.\")\n .option(\"--json-file <path>\", \"Body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createSolution(body as any));\n });\n });\n\n solutions\n .command(\"get\")\n .description(\"Get a solution.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .action(async (solutionId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getSolution(solutionId));\n });\n });\n\n solutions\n .command(\"update\")\n .description(\"Update a solution.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateSolution(solutionId, body as any));\n });\n });\n\n solutions\n .command(\"delete\")\n .description(\"Delete a solution.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .action(async (solutionId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteSolution(solutionId);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Link / Unlink ---\n\n solutions\n .command(\"link\")\n .description(\"Link resources to a solution. Use --agents, --kb, or --sources with JSON array of IDs.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .option(\"--agents <json>\", \"Link agents (JSON body).\")\n .option(\"--kb <json>\", \"Link knowledge bases (JSON body).\")\n .option(\"--sources <json>\", \"Link sources (JSON body).\")\n .action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n if (!opts.agents && !opts.kb && !opts.sources) {\n rt.writeErr(\"Provide at least one of --agents, --kb, or --sources.\\n\");\n rt.setExitCode(1);\n return;\n }\n const client = createClient(program.opts<GlobalOptions>());\n const results: Record<string, unknown> = {};\n if (opts.agents) {\n results.agents = await client.linkAgentsToSolution(solutionId, JSON.parse(opts.agents));\n }\n if (opts.kb) {\n results.knowledgeBases = await client.linkKnowledgeBasesToSolution(solutionId, JSON.parse(opts.kb));\n }\n if (opts.sources) {\n results.sources = await client.linkSourceConnectionsToSolution(solutionId, JSON.parse(opts.sources));\n }\n printJson(rt, results);\n });\n });\n\n solutions\n .command(\"unlink\")\n .description(\"Unlink resources from a solution. Use --agents, --kb, or --sources with JSON array of IDs.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .option(\"--agents <json>\", \"Unlink agents (JSON body).\")\n .option(\"--kb <json>\", \"Unlink knowledge bases (JSON body).\")\n .option(\"--sources <json>\", \"Unlink sources (JSON body).\")\n .action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n if (!opts.agents && !opts.kb && !opts.sources) {\n rt.writeErr(\"Provide at least one of --agents, --kb, or --sources.\\n\");\n rt.setExitCode(1);\n return;\n }\n const client = createClient(program.opts<GlobalOptions>());\n const results: Record<string, unknown> = {};\n if (opts.agents) {\n results.agents = await client.unlinkAgentsFromSolution(solutionId, JSON.parse(opts.agents));\n }\n if (opts.kb) {\n results.knowledgeBases = await client.unlinkKnowledgeBasesFromSolution(solutionId, JSON.parse(opts.kb));\n }\n if (opts.sources) {\n results.sources = await client.unlinkSourceConnectionsFromSolution(solutionId, JSON.parse(opts.sources));\n }\n printJson(rt, results);\n });\n });\n\n // --- Conversations ---\n\n const convos = solutions.command(\"convos\").description(\"Solution conversations.\");\n\n convos\n .command(\"list\")\n .description(\"List conversations for a solution.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .action(async (solutionId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listSolutionConversations(solutionId));\n });\n });\n\n convos\n .command(\"add\")\n .description(\"Add a conversation turn.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .option(\"--json <json>\", \"Turn body JSON.\")\n .option(\"--json-file <path>\", \"Turn body JSON file.\")\n .action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.addSolutionConversationTurn(solutionId, body as any));\n });\n });\n\n convos\n .command(\"mark\")\n .description(\"Mark a conversation turn.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Mark body JSON.\")\n .option(\"--json-file <path>\", \"Mark body JSON file.\")\n .action(async (solutionId: string, conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n await client.markSolutionConversationTurn(solutionId, conversationId, body as any);\n printJson(rt, { ok: true });\n });\n });\n\n // --- AI ---\n\n const ai = solutions.command(\"ai\").description(\"Solution AI assistant.\");\n\n withAiInputOptions(\n ai.command(\"generate\")\n .description(\"Generate a solution AI plan.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n ).action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateSolutionAiPlan(solutionId, body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"kb\")\n .description(\"Generate a KB plan via solution AI.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n ).action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateSolutionAiKnowledgeBase(solutionId, body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"source\")\n .description(\"Generate a source plan via solution AI.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n ).action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateSolutionAiSource(solutionId, body as any));\n });\n });\n\n ai.command(\"accept\")\n .description(\"Accept a solution AI plan.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Accept body JSON.\")\n .option(\"--json-file <path>\", \"Accept body JSON file.\")\n .action(async (solutionId: string, conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.acceptSolutionAiPlan(solutionId, conversationId, body as any));\n });\n });\n\n ai.command(\"decline\")\n .description(\"Decline a solution AI plan.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .action(async (solutionId: string, conversationId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.declineSolutionAiPlan(solutionId, conversationId);\n printJson(rt, { ok: true });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readAiInput, withAiInputOptions } from \"../helpers.js\";\n\n/** Register `governance` commands: AI-assisted generate, list, accept, decline. */\nexport function register(program: Command, rt: CliRuntime): void {\n const governance = program.command(\"governance\").description(\"Governance AI assistant.\");\n\n const ai = governance.command(\"ai\").description(\"Governance AI operations.\");\n\n withAiInputOptions(\n ai.command(\"generate\")\n .description(\"Generate a governance AI plan.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateGovernanceAiPlan(body as any));\n });\n });\n\n ai.command(\"list\")\n .description(\"List governance AI conversations.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listGovernanceAiConversations());\n });\n });\n\n ai.command(\"accept\")\n .description(\"Accept a governance AI plan.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .action(async (conversationId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.acceptGovernanceAiPlan(conversationId));\n });\n });\n\n ai.command(\"decline\")\n .description(\"Decline a governance AI plan.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .action(async (conversationId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.declineGovernanceAiPlan(conversationId);\n printJson(rt, { ok: true });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, listOpts } from \"../helpers.js\";\n\n/** Register `alerts` commands: alert CRUD, configs, organization preferences. */\nexport function register(program: Command, rt: CliRuntime): void {\n const alerts = program.command(\"alerts\").description(\"Manage alerts and alert configurations.\");\n\n // --- Alert CRUD ---\n\n alerts\n .command(\"list\")\n .description(\"List alerts.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--status <status>\", \"Filter by status.\")\n .option(\"--severity <severity>\", \"Filter by severity.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Record<string, unknown> = listOpts(opts);\n if (opts.status) o.status = opts.status;\n if (opts.severity) o.severity = opts.severity;\n printJson(rt, await client.listAlerts(o));\n });\n });\n\n alerts\n .command(\"get\")\n .description(\"Get an alert.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .action(async (alertId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAlert(alertId));\n });\n });\n\n alerts\n .command(\"status\")\n .description(\"Change alert status.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .option(\"--json <json>\", \"Status body JSON.\")\n .option(\"--json-file <path>\", \"Status body JSON file.\")\n .action(async (alertId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.changeAlertStatus(alertId, body as any));\n });\n });\n\n alerts\n .command(\"comment\")\n .description(\"Add a comment to an alert.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .option(\"--json <json>\", \"Comment body JSON.\")\n .option(\"--json-file <path>\", \"Comment body JSON file.\")\n .action(async (alertId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.addAlertComment(alertId, body as any));\n });\n });\n\n alerts\n .command(\"subscribe\")\n .description(\"Subscribe to an alert.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .action(async (alertId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.subscribeToAlert(alertId));\n });\n });\n\n alerts\n .command(\"unsubscribe\")\n .description(\"Unsubscribe from an alert.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .action(async (alertId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.unsubscribeFromAlert(alertId));\n });\n });\n\n // --- Alert Configs ---\n\n const configs = alerts.command(\"configs\").description(\"Alert configurations.\");\n\n configs\n .command(\"list\")\n .description(\"List alert configurations.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listAlertConfigs(listOpts(opts)));\n });\n });\n\n configs\n .command(\"create\")\n .description(\"Create an alert configuration.\")\n .option(\"--json <json>\", \"Config body JSON.\")\n .option(\"--json-file <path>\", \"Config body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createAlertConfig(body as any));\n });\n });\n\n configs\n .command(\"get\")\n .description(\"Get an alert configuration.\")\n .argument(\"<configId>\", \"Config ID.\")\n .action(async (configId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAlertConfig(configId));\n });\n });\n\n configs\n .command(\"update\")\n .description(\"Update an alert configuration.\")\n .argument(\"<configId>\", \"Config ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (configId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateAlertConfig(configId, body as any));\n });\n });\n\n configs\n .command(\"delete\")\n .description(\"Delete an alert configuration.\")\n .argument(\"<configId>\", \"Config ID.\")\n .action(async (configId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteAlertConfig(configId);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Organization Alert Preferences ---\n\n const prefs = alerts.command(\"prefs\").description(\"Organization alert preferences.\");\n\n prefs\n .command(\"list\")\n .description(\"List organization alert preferences.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listOrganizationAlertPreferences());\n });\n });\n\n prefs\n .command(\"update\")\n .description(\"Update an organization alert preference.\")\n .argument(\"<organizationId>\", \"Organization ID.\")\n .argument(\"<alertType>\", \"Alert type.\")\n .option(\"--json <json>\", \"Preference body JSON.\")\n .option(\"--json-file <path>\", \"Preference body JSON file.\")\n .action(async (organizationId: string, alertType: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateOrganizationAlertPreference(organizationId, alertType, body as any));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, listOpts, withJsonInputOptions, readJsonInput } from \"../helpers.js\";\n\n/** Register `models` commands: list, get, alerts, recommendations, playground experiments. */\nexport function register(program: Command, rt: CliRuntime): void {\n const models = program.command(\"models\").description(\"Models, model alerts, recommendations, and playground experiments.\");\n\n models\n .command(\"list\")\n .description(\"List models grouped by provider.\")\n .option(\"--provider <provider>\", \"Filter by provider name.\")\n .option(\"--supports-tool-use\", \"Only models that support tool use.\")\n .option(\"--supports-thinking\", \"Only models that support thinking.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.listModels>[0] = {};\n if (opts.provider !== undefined) o.provider = opts.provider;\n if (opts.supportsToolUse !== undefined) o.supportsToolUse = opts.supportsToolUse;\n if (opts.supportsThinking !== undefined) o.supportsThinking = opts.supportsThinking;\n printJson(rt, await client.listModels(o));\n });\n });\n\n models\n .command(\"get\")\n .description(\"Get full details for a specific model.\")\n .argument(\"<modelId>\", \"Model ID.\")\n .action(async (modelId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getModel(modelId));\n });\n });\n\n const alerts = models.command(\"alerts\").description(\"Model alerts.\");\n\n alerts\n .command(\"list\")\n .description(\"List model alerts.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listModelAlerts(listOpts(opts)));\n });\n });\n\n alerts\n .command(\"mark-read\")\n .description(\"Mark a model alert as read.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .action(async (alertId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.markModelAlertRead(alertId);\n printJson(rt, { ok: true });\n });\n });\n\n alerts\n .command(\"mark-all-read\")\n .description(\"Mark all model alerts as read.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.markAllModelAlertsRead();\n printJson(rt, { ok: true });\n });\n });\n\n alerts\n .command(\"unread-count\")\n .description(\"Get unread model alert count.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getUnreadModelAlertCount());\n });\n });\n\n models\n .command(\"recommendations\")\n .description(\"Get model recommendations.\")\n .argument(\"<modelId>\", \"Model ID.\")\n .action(async (modelId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getModelRecommendations(modelId));\n });\n });\n\n // ── Playground Experiments ──────────────────────────────────────────────\n\n const experiments = models.command(\"experiments\").description(\"Model playground experiments.\");\n\n experiments\n .command(\"list\")\n .description(\"List model playground experiments.\")\n .option(\"--days <n>\", \"Filter to last N days.\", (v: string) => Number(v))\n .option(\"--start-date <date>\", \"Start date (ISO 8601).\")\n .option(\"--end-date <date>\", \"End date (ISO 8601).\")\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--offset <n>\", \"Offset.\", (v: string) => Number(v))\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.listExperiments>[0] = {};\n if (opts.days !== undefined) o.days = opts.days;\n if (opts.startDate !== undefined) o.startDate = opts.startDate;\n if (opts.endDate !== undefined) o.endDate = opts.endDate;\n if (opts.limit !== undefined) o.limit = opts.limit;\n if (opts.offset !== undefined) o.offset = opts.offset;\n printJson(rt, await client.listExperiments(o));\n });\n });\n\n withJsonInputOptions(experiments\n .command(\"create\")\n .description(\"Create a model playground experiment.\"))\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createExperiment(body as Parameters<typeof client.createExperiment>[0]));\n });\n });\n\n experiments\n .command(\"get\")\n .description(\"Get a model playground experiment by ID.\")\n .argument(\"<experimentId>\", \"Experiment ID.\")\n .action(async (experimentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getExperiment(experimentId));\n });\n });\n\n experiments\n .command(\"cancel\")\n .description(\"Cancel a running model playground experiment.\")\n .argument(\"<experimentId>\", \"Experiment ID.\")\n .action(async (experimentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.cancelExperiment(experimentId));\n });\n });\n\n experiments\n .command(\"delete\")\n .description(\"Soft-delete a model playground experiment (preserves audit history).\")\n .argument(\"<experimentId>\", \"Experiment ID.\")\n .action(async (experimentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteExperiment(experimentId);\n printJson(rt, { ok: true });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson } from \"../helpers.js\";\n\n/** Register the `search` command for querying across Seclai resources. */\nexport function register(program: Command, rt: CliRuntime): void {\n program\n .command(\"search\")\n .description(\"Search across Seclai resources.\")\n .requiredOption(\"--query <text>\", \"Search query text.\")\n .option(\"--limit <n>\", \"Max results.\", (v: string) => Number(v))\n .option(\"--entity-type <type>\", \"Filter by entity type (e.g. agent, source, knowledge_base, memory_bank).\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Record<string, unknown> = { query: opts.query };\n if (opts.limit !== undefined) o.limit = opts.limit;\n if (opts.entityType) o.entityType = opts.entityType;\n printJson(rt, await client.search(o as any));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, readAiInput, withAiInputOptions } from \"../helpers.js\";\n\n/** Register top-level `ai` commands: feedback, domain assistants (kb/source/solution/memory), accept/decline. */\nexport function register(program: Command, rt: CliRuntime): void {\n const ai = program.command(\"ai\").description(\"Top-level AI assistant.\");\n\n ai.command(\"feedback\")\n .description(\"Submit AI feedback.\")\n .option(\"--json <json>\", \"Feedback body JSON.\")\n .option(\"--json-file <path>\", \"Feedback body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.submitAiFeedback(body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"kb\")\n .description(\"AI assistant for knowledge bases.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.aiAssistantKnowledgeBase(body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"source\")\n .description(\"AI assistant for sources.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.aiAssistantSource(body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"solution\")\n .description(\"AI assistant for solutions.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.aiAssistantSolution(body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"memory\")\n .description(\"AI assistant for memory banks.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.aiAssistantMemoryBank(body as any));\n });\n });\n\n ai.command(\"memory-history\")\n .description(\"Get AI assistant memory bank conversation history.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAiAssistantMemoryBankHistory());\n });\n });\n\n ai.command(\"accept\")\n .description(\"Accept an AI assistant plan.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Accept body JSON.\")\n .option(\"--json-file <path>\", \"Accept body JSON file.\")\n .action(async (conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.acceptAiAssistantPlan(conversationId, body as any));\n });\n });\n\n ai.command(\"decline\")\n .description(\"Decline an AI assistant plan.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .action(async (conversationId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.declineAiAssistantPlan(conversationId);\n printJson(rt, { ok: true });\n });\n });\n\n ai.command(\"memory-accept\")\n .description(\"Accept an AI memory bank suggestion.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Accept body JSON.\")\n .option(\"--json-file <path>\", \"Accept body JSON file.\")\n .action(async (conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.acceptAiMemoryBankSuggestion(conversationId, body as any));\n });\n });\n}\n","import { Command } from \"commander\";\nimport { existsSync, statSync } from \"node:fs\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport type { CliRuntime } from \"../helpers.js\";\nimport { run, printJson } from \"../helpers.js\";\n\n// --- Skill content ---\n\nconst SKILL_MD = `---\nname: seclai-cli\ndescription: >-\n Manage Seclai agents, knowledge bases, sources, memory banks, evaluations,\n solutions, governance, alerts, and more via the CLI. Use when working with\n the Seclai platform or when the user mentions Seclai CLI commands.\n---\n\n# Seclai CLI\n\nThe Seclai CLI (\\`seclai\\` / \\`npx @seclai/cli\\`) manages agents, knowledge bases, sources, memory banks, evaluations, solutions, governance, alerts, and more from the terminal.\n\nAll commands output JSON to stdout. Pipe into \\`jq\\` for filtering.\n\n## Quick start\n\n\\`\\`\\`bash\n# authenticate\nexport SECLAI_API_KEY=\"sk-...\"\n\n# create an agent\nseclai agents create --json '{\"name\":\"My Agent\",\"description\":\"QA chatbot\"}'\n\n# configure steps via AI assistant\nseclai agents ai gen-steps <agentId> --user-input \"Build a QA chatbot that uses a knowledge base\"\n\n# accept the generated plan\nseclai agents ai mark <agentId> <conversationId> --json '{\"accepted\":true}'\n\n# run the agent\nseclai agents run <agentId> --json '{\"input\":\"How do I reset my password?\"}' --stream\n\n# list runs\nseclai agents runs list <agentId>\n\\`\\`\\`\n\n## Authentication\n\nSet \\`SECLAI_API_KEY\\` env var or pass \\`--api-key <key>\\`.\nOverride the API URL with \\`SECLAI_API_URL\\` (default: https://api.seclai.com).\n\n## Global options\n\n\\`\\`\\`bash\n--api-key <key> # Seclai API key (or set SECLAI_API_KEY)\n--compact # Output compact single-line JSON\n-V, --version # Print version\n\\`\\`\\`\n\n## Common patterns\n\n### JSON input\nMost create/update commands accept \\`--json '{\"key\":\"value\"}'\\` or \\`--json-file path.json\\`.\nUse \\`--json -\\` or \\`--json-file -\\` to read from stdin.\n\n### AI assistant shorthand\nAI generation commands accept \\`--user-input <text>\\` as shorthand for \\`--json '{\"user_input\":\"<text>\"}'\\`.\n\n### Pagination\nList commands support \\`--page <n>\\` and \\`--limit <n>\\`. Some also support \\`--sort <field>\\` and \\`--order asc|desc\\`.\n\n### File uploads\nUpload commands accept \\`--file <path>\\` (required), plus optional \\`--title\\`, \\`--metadata '{\"k\":\"v\"}'\\`, \\`--metadata-file path.json\\`, \\`--file-name\\`, \\`--mime-type\\`.\n\n## Commands\n\n### Agents\n\n\\`\\`\\`bash\nseclai agents list [--page N] [--limit N]\nseclai agents create --json '{\"name\":\"My Agent\",\"description\":\"...\"}'\nseclai agents get <agentId>\nseclai agents update <agentId> --json '{\"name\":\"Renamed\"}'\nseclai agents delete <agentId>\n\\`\\`\\`\n\n### Running agents\n\n\\`\\`\\`bash\n# simple run — returns the final result\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}'\n\n# stream — wait for completion via SSE, print final result\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --stream [--timeout-ms 60000]\n\n# events — stream individual SSE events as NDJSON lines\n# --output: full (entire event), data (event data only), status (status events only)\n# --event-filter: comma-separated event types to include, e.g. \"status,data\"\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events [--output full|data|status] [--event-filter \"status,data\"]\n\n# poll — poll for completion\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --poll [--poll-interval-ms 2000] [--include-step-outputs]\n\\`\\`\\`\n\n### Agent runs\n\n\\`\\`\\`bash\nseclai agents runs list <agentId> [--page N] [--limit N] [--status <status>]\nseclai agents runs get <runId> [--include-step-outputs]\nseclai agents runs delete <runId>\nseclai agents runs cancel <runId>\nseclai agents runs search --json '{\"query\":\"...\"}'\nseclai agents runs eval-results <agentId> <runId> [--page N] [--limit N]\n\\`\\`\\`\n\n### Agent definitions\n\n\\`\\`\\`bash\nseclai agents def get <agentId>\nseclai agents def update <agentId> --json '{\"steps\":[{\"step_type\":\"llm\",\"config\":{...}}]}'\n\\`\\`\\`\n\n### Agent input uploads\n\n\\`\\`\\`bash\nseclai agents upload-input <agentId> --file ./input.pdf [--file-name name] [--mime-type type]\nseclai agents input-status <agentId> <uploadId>\n\\`\\`\\`\n\n### Agent AI assistant\n\n\\`\\`\\`bash\nseclai agents ai gen-steps <agentId> --user-input \"Build a QA chatbot\"\nseclai agents ai step-config <agentId> --json '{\"step_type\":\"llm\",\"user_input\":\"Configure the LLM step\"}'\nseclai agents ai history <agentId>\nseclai agents ai mark <agentId> <conversationId> --json '{\"accepted\":true}'\n\\`\\`\\`\n\n### Sources\n\n\\`\\`\\`bash\nseclai sources list [--page N] [--limit N] [--sort field] [--order asc|desc] [--account-id id]\nseclai sources create --json '{\"name\":\"Docs\",\"description\":\"Product documentation\"}'\nseclai sources get <sourceId>\nseclai sources update <sourceId> --json '{\"name\":\"Updated Docs\"}'\nseclai sources delete <sourceId>\n\\`\\`\\`\n\n### Source uploads\n\n\\`\\`\\`bash\nseclai sources upload <sourceId> --file ./doc.pdf [--title \"My Doc\"] [--metadata '{\"category\":\"docs\"}'] [--file-name name] [--mime-type type]\nseclai sources upload-text <sourceId> --json '{\"text\":\"Article content here...\",\"title\":\"My Article\"}'\n\\`\\`\\`\n\n### Source exports\n\n\\`\\`\\`bash\nseclai sources exports list <sourceId> [--page N] [--limit N]\nseclai sources exports create <sourceId> --json '{\"format\":\"jsonl\"}'\nseclai sources exports get <sourceId> <exportId>\nseclai sources exports cancel <sourceId> <exportId>\nseclai sources exports delete <sourceId> <exportId>\nseclai sources exports download <sourceId> <exportId>\nseclai sources exports estimate <sourceId> --json '{\"format\":\"jsonl\"}'\n\\`\\`\\`\n\n### Embedding migration\n\n\\`\\`\\`bash\nseclai sources migration get <sourceId>\nseclai sources migration start <sourceId> --json '{\"target_model\":\"text-embedding-3-large\"}'\nseclai sources migration cancel <sourceId>\n\\`\\`\\`\n\n### Contents (indexed content)\n\n\\`\\`\\`bash\nseclai contents get <contentVersionId> [--start N] [--end N]\nseclai contents delete <contentVersionId>\nseclai contents upload <contentVersionId> --file ./updated.pdf [--title \"Title\"] [--file-name name] [--mime-type type]\nseclai contents replace-text <contentVersionId> --json '{\"text\":\"Replacement text\",\"title\":\"Updated\"}'\nseclai contents embeddings <contentVersionId> [--page N] [--limit N]\n\\`\\`\\`\n\n### Knowledge bases\n\n\\`\\`\\`bash\nseclai kb list [--page N] [--limit N] [--sort field] [--order asc|desc]\nseclai kb create --json '{\"name\":\"Support KB\",\"description\":\"Customer support articles\"}'\nseclai kb get <kbId>\nseclai kb update <kbId> --json '{\"name\":\"Updated KB\"}'\nseclai kb delete <kbId>\n\\`\\`\\`\n\n### Memory banks\n\n\\`\\`\\`bash\nseclai memory list [--page N] [--limit N] [--sort field] [--order asc|desc]\n# type: \"conversation\" (chat history) or \"general\" (structured facts)\nseclai memory create --json '{\"name\":\"Chat Memory\",\"type\":\"conversation\"}'\nseclai memory get <memoryBankId>\nseclai memory update <memoryBankId> --json '{\"name\":\"Renamed\"}'\nseclai memory delete <memoryBankId>\n\\`\\`\\`\n\n### Memory bank utilities\n\n\\`\\`\\`bash\nseclai memory stats <memoryBankId>\nseclai memory agents <memoryBankId>\nseclai memory compact <memoryBankId>\nseclai memory delete-source <memoryBankId>\nseclai memory templates\nseclai memory test-compaction <memoryBankId> --json '{\"prompt\":\"Summarize the conversation\"}'\nseclai memory test-compaction-standalone --json '{\"prompt\":\"Summarize the conversation\"}'\n\\`\\`\\`\n\n### Memory bank AI\n\n\\`\\`\\`bash\nseclai memory ai generate --user-input \"Configure compaction for chat memory\"\nseclai memory ai last\nseclai memory ai accept <conversationId> --json '{\"accepted\":true}'\n\\`\\`\\`\n\n### Evaluations — criteria\n\n\\`\\`\\`bash\nseclai evals criteria list <agentId> [--page N] [--limit N]\nseclai evals criteria create <agentId> --json '{\"name\":\"Response Quality\",\"description\":\"...\",\"eval_type\":\"llm_judge\"}'\nseclai evals criteria get <criteriaId>\nseclai evals criteria update <criteriaId> --json '{\"name\":\"Updated Criteria\"}'\nseclai evals criteria delete <criteriaId>\nseclai evals criteria summary <criteriaId>\n\\`\\`\\`\n\n### Evaluations — results & runs\n\n\\`\\`\\`bash\nseclai evals results list <criteriaId> [--page N] [--limit N]\nseclai evals results create <criteriaId> --json '{\"run_id\":\"...\",\"score\":0.9}'\nseclai evals compatible-runs <criteriaId> [--page N] [--limit N]\nseclai evals test-draft <agentId> --json '{\"criteria\":{\"name\":\"Test\",\"eval_type\":\"llm_judge\"},\"run_id\":\"...\"}'\nseclai evals agent-results <agentId> [--page N] [--limit N]\nseclai evals agent-runs <agentId> [--page N] [--limit N]\nseclai evals non-manual-summary <agentId>\n\\`\\`\\`\n\n### Solutions\n\n\\`\\`\\`bash\nseclai solutions list [--page N] [--limit N] [--sort field] [--order asc|desc]\nseclai solutions create --json '{\"name\":\"Customer Support Solution\"}'\nseclai solutions get <solutionId>\nseclai solutions update <solutionId> --json '{\"name\":\"Updated\"}'\nseclai solutions delete <solutionId>\n\\`\\`\\`\n\n### Solution links\n\n\\`\\`\\`bash\n# link resources — each flag takes a JSON array of IDs\nseclai solutions link <solutionId> --agents '[\"agentId1\"]' --kb '[\"kbId1\"]' --sources '[\"sourceId1\"]'\nseclai solutions unlink <solutionId> --agents '[\"agentId1\"]'\n\\`\\`\\`\n\n### Solution conversations & AI\n\n\\`\\`\\`bash\nseclai solutions convos list <solutionId>\nseclai solutions convos add <solutionId> --json '{\"message\":\"How should I structure this?\"}'\nseclai solutions convos mark <solutionId> <conversationId> --json '{\"accepted\":true}'\n\nseclai solutions ai generate <solutionId> --user-input \"Add an FAQ source\"\nseclai solutions ai kb <solutionId> --user-input \"Create a knowledge base for docs\"\nseclai solutions ai source <solutionId> --user-input \"Create a file source for PDFs\"\nseclai solutions ai accept <solutionId> <conversationId> --json '{\"accepted\":true}'\nseclai solutions ai decline <solutionId> <conversationId>\n\\`\\`\\`\n\n### Alerts\n\n\\`\\`\\`bash\nseclai alerts list [--page N] [--limit N] [--status <status>] [--severity <severity>]\nseclai alerts get <alertId>\nseclai alerts status <alertId> --json '{\"status\":\"resolved\"}'\nseclai alerts comment <alertId> --json '{\"comment\":\"Fixed the issue\"}'\nseclai alerts subscribe <alertId>\nseclai alerts unsubscribe <alertId>\n\\`\\`\\`\n\n### Alert configurations\n\n\\`\\`\\`bash\nseclai alerts configs list [--page N] [--limit N]\nseclai alerts configs create --json '{\"name\":\"Latency Alert\",\"description\":\"...\",\"threshold\":5000}'\nseclai alerts configs get <configId>\nseclai alerts configs update <configId> --json '{\"threshold\":3000}'\nseclai alerts configs delete <configId>\n\\`\\`\\`\n\n### Alert preferences\n\n\\`\\`\\`bash\nseclai alerts prefs list\nseclai alerts prefs update <organizationId> <alertType> --json '{\"enabled\":true}'\n\\`\\`\\`\n\n### Governance AI\n\n\\`\\`\\`bash\nseclai governance ai generate --user-input \"Create a content safety policy\"\nseclai governance ai list\nseclai governance ai accept <conversationId>\nseclai governance ai decline <conversationId>\n\\`\\`\\`\n\n### Model alerts\n\n\\`\\`\\`bash\nseclai models alerts list [--page N] [--limit N]\nseclai models alerts mark-read <alertId>\nseclai models alerts mark-all-read\nseclai models alerts unread-count\nseclai models recommendations <modelId>\n\\`\\`\\`\n\n### Search\n\n\\`\\`\\`bash\nseclai search --query \"deployment guide\" [--limit N] [--entity-type <type>]\n\\`\\`\\`\n\n### AI assistant (global)\n\n\\`\\`\\`bash\nseclai ai feedback --json '{\"feedback\":\"The response was helpful\"}'\nseclai ai kb --user-input \"Create a support knowledge base\"\nseclai ai source --user-input \"Create a documentation source\"\nseclai ai solution --user-input \"Build a customer support solution\"\nseclai ai memory --user-input \"Create a conversation memory bank\"\nseclai ai memory-history\nseclai ai accept <conversationId> --json '{\"accepted\":true}'\nseclai ai decline <conversationId>\nseclai ai memory-accept <conversationId> --json '{\"accepted\":true}'\n\\`\\`\\`\n\n### Skills\n\n\\`\\`\\`bash\n# install skill files into AI coding tool directories (auto-detects or specify)\nseclai skills install [--tool copilot|claude|cursor|windsurf|codex|kiro|cline|roo|gemini|antigravity|all] [--dir .]\n\\`\\`\\`\n\n### MCP server\n\n\\`\\`\\`bash\n# configure MCP server access in AI coding tool config files\nseclai mcp configure --key <apiKey> [--target claude-code|cursor|claude-desktop|windsurf|all] [--dir .]\n\n# show the MCP config JSON snippet\nseclai mcp show [--key <apiKey>]\n\\`\\`\\`\n\n## Example: Create a source and upload content\n\n\\`\\`\\`bash\nseclai sources create --json '{\"name\":\"Product Docs\",\"description\":\"Product documentation source\"}'\n# note the id from the output\nseclai sources upload <sourceId> --file ./docs.pdf --title \"Product Manual\" --metadata '{\"version\":\"2.0\"}'\nseclai sources get <sourceId>\n\\`\\`\\`\n\n## Example: Set up a knowledge base with an agent\n\n\\`\\`\\`bash\nseclai kb create --json '{\"name\":\"Support KB\",\"description\":\"Customer support articles\"}'\nseclai agents create --json '{\"name\":\"Support Bot\",\"description\":\"Answers customer questions\"}'\nseclai agents ai gen-steps <agentId> --user-input \"Build a QA chatbot that searches the Support KB\"\nseclai agents ai mark <agentId> <conversationId> --json '{\"accepted\":true}'\nseclai agents run <agentId> --json '{\"input\":\"How do I reset my password?\"}' --stream\n\\`\\`\\`\n\n## Example: Evaluate agent quality\n\n\\`\\`\\`bash\n# create eval criteria\nseclai evals criteria create <agentId> --json '{\"name\":\"Answer Accuracy\",\"eval_type\":\"llm_judge\",\"description\":\"Does the answer correctly address the question?\"}'\n# find compatible runs\nseclai evals compatible-runs <criteriaId> --limit 5\n# test the criteria against a run without persisting\nseclai evals test-draft <agentId> --json '{\"criteria\":{\"name\":\"Answer Accuracy\",\"eval_type\":\"llm_judge\"},\"run_id\":\"<runId>\"}'\n# create a persisted result\nseclai evals results create <criteriaId> --json '{\"run_id\":\"<runId>\",\"score\":0.95}'\n# view summary\nseclai evals criteria summary <criteriaId>\n\\`\\`\\`\n\n## Example: Solution with linked resources\n\n\\`\\`\\`bash\nseclai solutions create --json '{\"name\":\"Customer Support\"}'\nseclai solutions link <solutionId> --agents '[\"<agentId>\"]' --kb '[\"<kbId>\"]' --sources '[\"<sourceId>\"]'\nseclai solutions get <solutionId>\n\\`\\`\\`\n\n## Example: Memory-powered agent\n\n\\`\\`\\`bash\nseclai memory create --json '{\"name\":\"User Preferences\",\"type\":\"general\"}'\nseclai agents create --json '{\"name\":\"Personal Assistant\",\"description\":\"Remembers user preferences\"}'\nseclai agents ai gen-steps <agentId> --user-input \"Build a chat agent that remembers user preferences. Use general memory bank <memoryBankId>\"\nseclai agents ai mark <agentId> <conversationId> --json '{\"accepted\":true}'\n\\`\\`\\`\n\n## Example: Governance policy setup\n\n\\`\\`\\`bash\nseclai governance ai generate --user-input \"Create a content safety policy that blocks harmful outputs\"\nseclai governance ai list\nseclai governance ai accept <conversationId>\n\\`\\`\\`\n\n## Specific topics\n\n* **Streaming & event modes** [references/streaming.md](references/streaming.md)\n* **File uploads & content management** [references/uploads.md](references/uploads.md)\n* **Evaluations workflow** [references/evaluations.md](references/evaluations.md)\n`;\n\nconst STREAMING_REF = `# Streaming Agent Runs\n\n## Modes\n\n### --stream\nWait for the agent run to complete via SSE. Prints the final result as a single JSON object.\nUseful when you want to block until done.\n\n\\`\\`\\`bash\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --stream\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --stream --timeout-ms 120000\n\\`\\`\\`\n\n### --events\nStream individual SSE events as NDJSON (one JSON object per line). Use for real-time processing.\n\n\\`\\`\\`bash\n# all events, full event objects\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events\n\n# only data payloads (no event metadata)\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events --output data\n\n# only status events\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events --output status\n\n# filter specific event types\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events --event-filter \"status,data\"\n\\`\\`\\`\n\nOutput modes for --events:\n- \\`full\\`: entire SSE event object (default)\n- \\`data\\`: only the data payload of each event\n- \\`status\\`: only events with status information\n\n### --poll\nPoll the API at intervals for run completion. Does not use SSE.\n\n\\`\\`\\`bash\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --poll\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --poll --poll-interval-ms 5000 --include-step-outputs\n\\`\\`\\`\n\n### No flag\nFire-and-forget: starts the run and immediately returns the run ID.\n\n\\`\\`\\`bash\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}'\n# returns: {\"id\":\"run_...\",\"status\":\"queued\",...}\n# check later:\nseclai agents runs get <runId>\n\\`\\`\\`\n`;\n\nconst UPLOADS_REF = `# File Uploads & Content Management\n\n## Upload to a source\n\\`\\`\\`bash\nseclai sources upload <sourceId> --file ./doc.pdf\nseclai sources upload <sourceId> --file ./doc.pdf --title \"My Doc\" --metadata '{\"category\":\"docs\"}' --file-name \"custom-name.pdf\" --mime-type \"application/pdf\"\nseclai sources upload <sourceId> --file ./doc.pdf --metadata-file ./meta.json\n\\`\\`\\`\n\n## Upload text directly\n\\`\\`\\`bash\nseclai sources upload-text <sourceId> --json '{\"text\":\"Article content here...\",\"title\":\"My Article\"}'\n\\`\\`\\`\n\n## Upload input for agent runs\n\\`\\`\\`bash\nseclai agents upload-input <agentId> --file ./input.pdf\nseclai agents upload-input <agentId> --file ./data.csv --file-name \"report.csv\" --mime-type \"text/csv\"\nseclai agents input-status <agentId> <uploadId>\n\\`\\`\\`\n\n## Replace content\n\\`\\`\\`bash\n# replace with file\nseclai contents upload <contentVersionId> --file ./updated.pdf\n\n# replace with text\nseclai contents replace-text <contentVersionId> --json '{\"text\":\"Updated content\",\"title\":\"Revised Article\"}'\n\\`\\`\\`\n\n## Read content\n\\`\\`\\`bash\n# full content\nseclai contents get <contentVersionId>\n\n# text slice (0-based offsets)\nseclai contents get <contentVersionId> --start 0 --end 1000\n\n# view embeddings\nseclai contents embeddings <contentVersionId> [--page N] [--limit N]\n\\`\\`\\`\n`;\n\nconst EVALUATIONS_REF = `# Evaluations Workflow\n\n## Step 1: Create evaluation criteria for an agent\n\\`\\`\\`bash\nseclai evals criteria create <agentId> --json '{\"name\":\"Answer Accuracy\",\"description\":\"Does the answer correctly address the question?\",\"eval_type\":\"llm_judge\"}'\n\\`\\`\\`\n\n## Step 2: Find runs to evaluate\n\\`\\`\\`bash\n# list all runs for an agent\nseclai agents runs list <agentId> --limit 10\n\n# or find runs compatible with specific criteria\nseclai evals compatible-runs <criteriaId> --limit 10\n\\`\\`\\`\n\n## Step 3: Test criteria before committing\n\\`\\`\\`bash\nseclai evals test-draft <agentId> --json '{\"criteria\":{\"name\":\"Answer Accuracy\",\"eval_type\":\"llm_judge\",\"description\":\"...\"},\"run_id\":\"<runId>\"}'\n\\`\\`\\`\n\n## Step 4: Create evaluation results\n\\`\\`\\`bash\nseclai evals results create <criteriaId> --json '{\"run_id\":\"<runId>\",\"score\":0.95}'\n\\`\\`\\`\n\n## Step 5: Review summaries\n\\`\\`\\`bash\nseclai evals criteria summary <criteriaId>\nseclai evals agent-results <agentId>\nseclai evals agent-runs <agentId> --limit 20\nseclai evals non-manual-summary <agentId>\n\\`\\`\\`\n\n## Managing criteria\n\\`\\`\\`bash\nseclai evals criteria list <agentId>\nseclai evals criteria get <criteriaId>\nseclai evals criteria update <criteriaId> --json '{\"name\":\"Updated Name\"}'\nseclai evals criteria delete <criteriaId>\n\\`\\`\\`\n\n## Viewing results\n\\`\\`\\`bash\nseclai evals results list <criteriaId> [--page N] [--limit N]\n\\`\\`\\`\n`;\n\n// --- Tool detection & path mapping ---\n\ntype ToolConfig = {\n dir: string;\n files: Array<{ name: string; content: string }>;\n};\n\nfunction getToolConfig(tool: string, destDir: string): ToolConfig {\n const skillFiles = [\n { name: \"SKILL.md\", content: SKILL_MD },\n { name: \"references/streaming.md\", content: STREAMING_REF },\n { name: \"references/uploads.md\", content: UPLOADS_REF },\n { name: \"references/evaluations.md\", content: EVALUATIONS_REF },\n ];\n\n switch (tool) {\n case \"copilot\":\n return { dir: join(destDir, \".github\", \"copilot\", \"seclai-cli\"), files: skillFiles };\n case \"claude\":\n return { dir: join(destDir, \".claude\", \"skills\", \"seclai-cli\"), files: skillFiles };\n case \"cursor\":\n return { dir: join(destDir, \".cursor\", \"skills\", \"seclai-cli\"), files: skillFiles };\n case \"windsurf\":\n return { dir: join(destDir, \".windsurf\", \"skills\", \"seclai-cli\"), files: skillFiles };\n case \"codex\":\n return { dir: join(destDir, \".codex\", \"skills\", \"seclai-cli\"), files: skillFiles };\n case \"kiro\":\n return { dir: join(destDir, \".kiro\", \"steering\", \"seclai-cli\"), files: skillFiles };\n case \"cline\":\n return { dir: join(destDir, \".clinerules\", \"seclai-cli\"), files: skillFiles };\n case \"roo\":\n return { dir: join(destDir, \".roo\", \"rules\", \"seclai-cli\"), files: skillFiles };\n case \"gemini\":\n return { dir: join(destDir, \".gemini\", \"seclai-cli\"), files: skillFiles };\n case \"antigravity\":\n return { dir: join(destDir, \".antigravity\", \"seclai-cli\"), files: skillFiles };\n default:\n throw new Error(`Unknown tool: ${tool}. Use copilot, claude, cursor, windsurf, codex, kiro, cline, roo, gemini, or antigravity.`);\n }\n}\n\nfunction detectTools(destDir: string): string[] {\n const detected: string[] = [];\n\n if (existsSync(join(destDir, \".github\", \"copilot\"))) detected.push(\"copilot\");\n if (existsSync(join(destDir, \".claude\")) || existsSync(join(destDir, \"CLAUDE.md\")))\n detected.push(\"claude\");\n if (existsSync(join(destDir, \".cursor\"))) detected.push(\"cursor\");\n if (existsSync(join(destDir, \".windsurf\"))) detected.push(\"windsurf\");\n if (existsSync(join(destDir, \".codex\"))) detected.push(\"codex\");\n if (existsSync(join(destDir, \".kiro\"))) detected.push(\"kiro\");\n if (existsSync(join(destDir, \".clinerules\")) && statSync(join(destDir, \".clinerules\")).isDirectory()) detected.push(\"cline\");\n if (existsSync(join(destDir, \".roo\"))) detected.push(\"roo\");\n if (existsSync(join(destDir, \".gemini\")) || existsSync(join(destDir, \"GEMINI.md\")))\n detected.push(\"gemini\");\n if (existsSync(join(destDir, \".antigravity\"))) detected.push(\"antigravity\");\n\n return detected;\n}\n\n/** Register the `skills` command for installing Seclai skill files into AI coding tool directories. */\nexport function register(program: Command, rt: CliRuntime): void {\n const skills = program.command(\"skills\").description(\"Install Seclai CLI skill files for AI coding tools.\");\n\n skills\n .command(\"install\")\n .description(\n \"Write Seclai CLI skill/instruction files into the current workspace.\\n\\n\" +\n \"Detected tools: copilot, claude, cursor, windsurf, codex, kiro, cline, roo, gemini, antigravity.\\n\" +\n \"Use --tool to target a specific tool, or 'all' for all supported tools.\"\n )\n .option(\"--tool <name>\", \"Target tool (copilot|claude|cursor|windsurf|codex|kiro|cline|roo|gemini|antigravity|all). Auto-detects if omitted.\")\n .option(\"--dir <path>\", \"Target directory (default: current directory).\", \".\")\n .action(async (opts) => {\n await run(rt, async () => {\n const destDir = opts.dir;\n let tools: string[];\n\n if (opts.tool === \"all\") {\n tools = [\"copilot\", \"claude\", \"cursor\", \"windsurf\", \"codex\", \"kiro\", \"cline\", \"roo\", \"gemini\", \"antigravity\"];\n } else if (opts.tool) {\n tools = [opts.tool];\n } else {\n tools = detectTools(destDir);\n if (tools.length === 0) {\n tools = [\"copilot\"]; // default fallback\n rt.writeErr(\"No AI tool detected, defaulting to copilot.\\n\");\n }\n }\n\n let totalFiles = 0;\n for (const tool of tools) {\n const config = getToolConfig(tool, destDir);\n for (const file of config.files) {\n const filePath = join(config.dir, file.name);\n await mkdir(dirname(filePath), { recursive: true });\n await writeFile(filePath, file.content, \"utf8\");\n totalFiles++;\n }\n rt.writeErr(`Installed ${config.files.length} skill files for ${tool} → ${config.dir}\\n`);\n }\n\n printJson(rt, { ok: true, tools, filesWritten: totalFiles });\n });\n });\n}\n","import { Command } from \"commander\";\nimport { existsSync } from \"node:fs\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { homedir, platform } from \"node:os\";\nimport type { CliRuntime } from \"../helpers.js\";\nimport { run, printJson } from \"../helpers.js\";\n\nconst MCP_URL = \"https://api.seclai.com/mcp\";\n\ntype McpConfig = {\n mcpServers: Record<string, { type: string; url: string; headers: Record<string, string> }>;\n};\n\nfunction buildMcpEntry(apiKey: string): McpConfig[\"mcpServers\"][\"seclai\"] {\n return {\n type: \"streamable-http\",\n url: MCP_URL,\n headers: { \"X-API-Key\": apiKey },\n };\n}\n\ntype McpTarget = { name: string; path: string; scope: \"project\" | \"global\" };\n\nfunction getTargets(destDir: string): McpTarget[] {\n const home = homedir();\n const os = platform();\n\n const targets: McpTarget[] = [\n // Project-scoped configs\n { name: \"claude-code\", path: join(destDir, \".mcp.json\"), scope: \"project\" },\n { name: \"cursor\", path: join(destDir, \".cursor\", \"mcp.json\"), scope: \"project\" },\n ];\n // Global configs — claude-desktop path varies by platform\n if (os === \"win32\") {\n targets.push({\n name: \"claude-desktop\",\n path: join(process.env[\"APPDATA\"] ?? join(home, \"AppData\", \"Roaming\"), \"Claude\", \"claude_desktop_config.json\"),\n scope: \"global\",\n });\n } else if (os === \"darwin\") {\n targets.push({\n name: \"claude-desktop\",\n path: join(home, \"Library\", \"Application Support\", \"Claude\", \"claude_desktop_config.json\"),\n scope: \"global\",\n });\n }\n targets.push({ name: \"windsurf\", path: join(home, \".codeium\", \"windsurf\", \"mcp_config.json\"), scope: \"global\" });\n return targets;\n}\n\nasync function mergeConfig(filePath: string, apiKey: string): Promise<boolean> {\n let existing: Record<string, unknown> = {};\n if (existsSync(filePath)) {\n try {\n const parsed: unknown = JSON.parse(await readFile(filePath, \"utf8\"));\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return false;\n existing = parsed as Record<string, unknown>;\n } catch {\n return false;\n }\n }\n const raw = existing[\"mcpServers\"];\n const servers = (typeof raw === \"object\" && raw !== null && !Array.isArray(raw) ? raw : {}) as Record<string, unknown>;\n servers[\"seclai\"] = buildMcpEntry(apiKey);\n existing[\"mcpServers\"] = servers;\n await mkdir(dirname(filePath), { recursive: true });\n await writeFile(filePath, JSON.stringify(existing, null, 2) + \"\\n\", \"utf8\");\n return true;\n}\n\nfunction detectTargets(destDir: string): McpTarget[] {\n const all = getTargets(destDir);\n return all.filter((t) => {\n if (t.scope === \"global\") return existsSync(dirname(t.path));\n // For project configs, check if the tool's directory marker exists\n if (t.name === \"claude-code\") return existsSync(join(destDir, \".claude\")) || existsSync(join(destDir, \"CLAUDE.md\"));\n if (t.name === \"cursor\") return existsSync(join(destDir, \".cursor\"));\n return false;\n });\n}\n\n/** Register the `mcp` command for configuring MCP server access in AI coding tools. */\nexport function register(program: Command, rt: CliRuntime): void {\n const mcp = program.command(\"mcp\").description(\"Configure the Seclai MCP server for AI coding tools.\");\n\n mcp\n .command(\"configure\")\n .description(\n \"Add the Seclai MCP server to AI coding tool config files.\\n\\n\" +\n \"Targets: claude-code, cursor, claude-desktop, windsurf.\\n\" +\n \"Use --target to pick a specific tool, or 'all' for all known targets.\"\n )\n .requiredOption(\"--key <key>\", \"Seclai API key to embed in the config.\")\n .option(\"--target <name>\", \"Target tool (claude-code|cursor|claude-desktop|windsurf|all). Auto-detects if omitted.\")\n .option(\"--dir <path>\", \"Project directory for project-scoped configs (default: current directory).\", \".\")\n .action(async (opts) => {\n await run(rt, async () => {\n const destDir = opts.dir;\n const apiKey: string = opts.key;\n const allTargets = getTargets(destDir);\n let targets: McpTarget[];\n\n if (opts.target === \"all\") {\n targets = allTargets;\n } else if (opts.target) {\n const found = allTargets.find((t) => t.name === opts.target);\n if (!found) {\n rt.writeErr(`Unknown target \"${opts.target}\". Use: claude-code, cursor, claude-desktop, windsurf, or all.\\n`);\n rt.setExitCode(1);\n return;\n }\n targets = [found];\n } else {\n targets = detectTargets(destDir);\n if (targets.length === 0) {\n targets = [allTargets[0]!]; // default to claude-code\n rt.writeErr(\"No MCP-compatible tool detected, defaulting to claude-code (.mcp.json).\\n\");\n }\n }\n\n let configured = 0;\n const failures: string[] = [];\n for (const target of targets) {\n const ok = await mergeConfig(target.path, apiKey);\n if (ok) {\n configured++;\n rt.writeErr(`Configured seclai MCP for ${target.name} → ${target.path}\\n`);\n } else {\n failures.push(target.name);\n rt.writeErr(`Failed to parse existing config at ${target.path}, skipping.\\n`);\n }\n }\n\n const allOk = failures.length === 0;\n printJson(rt, { ok: allOk, targets: targets.map((t) => t.name), filesWritten: configured, ...(failures.length > 0 ? { failures } : {}) });\n if (!allOk) rt.setExitCode(1);\n });\n });\n\n mcp\n .command(\"show\")\n .description(\"Show the Seclai MCP server JSON configuration snippet.\")\n .option(\"--key <key>\", \"API key to include (default: placeholder).\")\n .action(async (opts) => {\n await run(rt, async () => {\n const entry = buildMcpEntry(opts.key ?? \"YOUR_API_KEY\");\n printJson(rt, { mcpServers: { seclai: entry } });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime } from \"../helpers.js\";\n\nconst BASH = `#!/usr/bin/env bash\n# seclai bash completion — add to ~/.bashrc:\n# eval \"$(seclai completion bash)\"\n\n_seclai_completions() {\n local cur prev commands\n cur=\"\\${COMP_WORDS[COMP_CWORD]}\"\n prev=\"\\${COMP_WORDS[COMP_CWORD-1]}\"\n\n # Top-level commands\n commands=\"agents sources contents kb memory evals solutions governance alerts models search ai skills mcp completion help\"\n\n case \"\\${COMP_WORDS[1]}\" in\n agents)\n case \"\\${COMP_WORDS[2]}\" in\n runs) COMPREPLY=( $(compgen -W \"list get delete cancel search eval-results download-attachment\" -- \"$cur\") ); return ;;\n def) COMPREPLY=( $(compgen -W \"get update\" -- \"$cur\") ); return ;;\n ai) COMPREPLY=( $(compgen -W \"gen-steps step-config history mark\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list create get update delete run runs def export preview-import upload-input input-status attachment-references ai\" -- \"$cur\") ); return ;;\n esac ;;\n sources|source)\n case \"\\${COMP_WORDS[2]}\" in\n exports) COMPREPLY=( $(compgen -W \"list create get cancel delete download estimate\" -- \"$cur\") ); return ;;\n migration) COMPREPLY=( $(compgen -W \"get start cancel\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list create get update delete upload upload-text exports migration\" -- \"$cur\") ); return ;;\n esac ;;\n contents) COMPREPLY=( $(compgen -W \"get delete upload replace replace-text embeddings\" -- \"$cur\") ); return ;;\n kb) COMPREPLY=( $(compgen -W \"list create get update delete\" -- \"$cur\") ); return ;;\n memory)\n case \"\\${COMP_WORDS[2]}\" in\n ai) COMPREPLY=( $(compgen -W \"generate last accept\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list create get update delete stats agents compact delete-source templates test-compaction test-compaction-standalone ai\" -- \"$cur\") ); return ;;\n esac ;;\n evals)\n case \"\\${COMP_WORDS[2]}\" in\n criteria) COMPREPLY=( $(compgen -W \"list create get update delete summary\" -- \"$cur\") ); return ;;\n results) COMPREPLY=( $(compgen -W \"list create\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"criteria results compatible-runs test-draft agent-results agent-runs non-manual-summary\" -- \"$cur\") ); return ;;\n esac ;;\n solutions)\n case \"\\${COMP_WORDS[2]}\" in\n convos) COMPREPLY=( $(compgen -W \"list add mark\" -- \"$cur\") ); return ;;\n ai) COMPREPLY=( $(compgen -W \"generate kb source accept decline\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list create get update delete link unlink convos ai\" -- \"$cur\") ); return ;;\n esac ;;\n governance)\n case \"\\${COMP_WORDS[2]}\" in\n ai) COMPREPLY=( $(compgen -W \"generate list accept decline\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"ai\" -- \"$cur\") ); return ;;\n esac ;;\n alerts)\n case \"\\${COMP_WORDS[2]}\" in\n configs) COMPREPLY=( $(compgen -W \"list create get update delete\" -- \"$cur\") ); return ;;\n prefs) COMPREPLY=( $(compgen -W \"list update\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list get status comment subscribe unsubscribe configs prefs\" -- \"$cur\") ); return ;;\n esac ;;\n models)\n case \"\\${COMP_WORDS[2]}\" in\n alerts) COMPREPLY=( $(compgen -W \"list mark-read mark-all-read unread-count\" -- \"$cur\") ); return ;;\n experiments) COMPREPLY=( $(compgen -W \"list create get cancel delete\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"alerts recommendations experiments\" -- \"$cur\") ); return ;;\n esac ;;\n ai) COMPREPLY=( $(compgen -W \"feedback kb source solution memory memory-history accept decline memory-accept\" -- \"$cur\") ); return ;;\n skills) COMPREPLY=( $(compgen -W \"install\" -- \"$cur\") ); return ;;\n mcp) COMPREPLY=( $(compgen -W \"configure show\" -- \"$cur\") ); return ;;\n completion) COMPREPLY=( $(compgen -W \"bash zsh fish\" -- \"$cur\") ); return ;;\n esac\n\n COMPREPLY=( $(compgen -W \"$commands\" -- \"$cur\") )\n}\n\ncomplete -F _seclai_completions seclai\n`;\n\nconst ZSH = `#compdef seclai\n# seclai zsh completion — add to ~/.zshrc:\n# eval \"$(seclai completion zsh)\"\n\n_seclai() {\n local -a commands\n commands=(\n 'agents:Manage agents, runs, definitions, and AI assistance'\n 'sources:Manage content sources'\n 'contents:Manage indexed content and embeddings'\n 'kb:Manage knowledge bases'\n 'memory:Manage memory banks'\n 'evals:Manage evaluations'\n 'solutions:Manage solutions'\n 'governance:Governance AI assistant'\n 'alerts:Manage alerts and alert configurations'\n 'models:Model alerts and recommendations'\n 'search:Search across Seclai resources'\n 'ai:Top-level AI assistant'\n 'skills:Install skill files for AI coding tools'\n 'mcp:Configure the Seclai MCP server'\n 'completion:Generate shell completion scripts'\n 'help:Display help for command'\n )\n\n _arguments -C \\\\\n '--api-key[Seclai API key]:key' \\\\\n '--compact[Output compact JSON]' \\\\\n '-V[Output version]' \\\\\n '-h[Display help]' \\\\\n '1:command:->cmd' \\\\\n '*::arg:->args'\n\n case $state in\n cmd) _describe 'command' commands ;;\n args)\n case \\${words[1]} in\n agents)\n local -a sub=(list create get update delete run runs def export preview-import upload-input input-status attachment-references ai)\n _describe 'subcommand' sub ;;\n sources|source)\n local -a sub=(list create get update delete upload upload-text exports migration)\n _describe 'subcommand' sub ;;\n contents)\n local -a sub=(get delete upload replace replace-text embeddings)\n _describe 'subcommand' sub ;;\n kb)\n local -a sub=(list create get update delete)\n _describe 'subcommand' sub ;;\n memory)\n local -a sub=(list create get update delete stats agents compact delete-source templates test-compaction test-compaction-standalone ai)\n _describe 'subcommand' sub ;;\n evals)\n local -a sub=(criteria results compatible-runs test-draft agent-results agent-runs non-manual-summary)\n _describe 'subcommand' sub ;;\n solutions)\n local -a sub=(list create get update delete link unlink convos ai)\n _describe 'subcommand' sub ;;\n governance)\n local -a sub=(ai)\n _describe 'subcommand' sub ;;\n alerts)\n local -a sub=(list get status comment subscribe unsubscribe configs prefs)\n _describe 'subcommand' sub ;;\n models)\n local -a sub=(alerts recommendations experiments)\n _describe 'subcommand' sub ;;\n ai)\n local -a sub=(feedback kb source solution memory memory-history accept decline memory-accept)\n _describe 'subcommand' sub ;;\n skills)\n local -a sub=(install)\n _describe 'subcommand' sub ;;\n mcp)\n local -a sub=(configure show)\n _describe 'subcommand' sub ;;\n completion)\n local -a sub=(bash zsh fish)\n _describe 'shell' sub ;;\n esac ;;\n esac\n}\n\n_seclai \"$@\"\n`;\n\nconst FISH = `# seclai fish completion — save to ~/.config/fish/completions/seclai.fish\n# seclai completion fish > ~/.config/fish/completions/seclai.fish\n\nset -l top agents sources contents kb memory evals solutions governance alerts models search ai skills mcp completion help\n\n# Top-level\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"agents\" -d \"Manage agents\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"sources\" -d \"Manage sources\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"contents\" -d \"Manage content\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"kb\" -d \"Knowledge bases\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"memory\" -d \"Memory banks\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"evals\" -d \"Evaluations\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"solutions\" -d \"Solutions\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"governance\" -d \"Governance AI\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"alerts\" -d \"Alerts\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"models\" -d \"Model alerts\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"search\" -d \"Search resources\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"ai\" -d \"AI assistant\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"skills\" -d \"Skill files\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"mcp\" -d \"MCP server config\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"completion\" -d \"Shell completions\"\n\n# agents\ncomplete -c seclai -n \"__fish_seen_subcommand_from agents; and not __fish_seen_subcommand_from list create get update delete run runs def export preview-import upload-input input-status attachment-references ai\" -f -a \"list create get update delete run runs def export preview-import upload-input input-status attachment-references ai\"\n\n# sources\ncomplete -c seclai -n \"__fish_seen_subcommand_from sources; and not __fish_seen_subcommand_from list create get update delete upload upload-text exports migration\" -f -a \"list create get update delete upload upload-text exports migration\"\n\n# contents\ncomplete -c seclai -n \"__fish_seen_subcommand_from contents; and not __fish_seen_subcommand_from get delete upload replace replace-text embeddings\" -f -a \"get delete upload replace replace-text embeddings\"\n\n# kb\ncomplete -c seclai -n \"__fish_seen_subcommand_from kb; and not __fish_seen_subcommand_from list create get update delete\" -f -a \"list create get update delete\"\n\n# memory\ncomplete -c seclai -n \"__fish_seen_subcommand_from memory; and not __fish_seen_subcommand_from list create get update delete stats agents compact delete-source templates test-compaction test-compaction-standalone ai\" -f -a \"list create get update delete stats agents compact delete-source templates test-compaction test-compaction-standalone ai\"\n\n# evals\ncomplete -c seclai -n \"__fish_seen_subcommand_from evals; and not __fish_seen_subcommand_from criteria results compatible-runs test-draft agent-results agent-runs non-manual-summary\" -f -a \"criteria results compatible-runs test-draft agent-results agent-runs non-manual-summary\"\n\n# solutions\ncomplete -c seclai -n \"__fish_seen_subcommand_from solutions; and not __fish_seen_subcommand_from list create get update delete link unlink convos ai\" -f -a \"list create get update delete link unlink convos ai\"\n\n# governance\ncomplete -c seclai -n \"__fish_seen_subcommand_from governance; and not __fish_seen_subcommand_from ai\" -f -a \"ai\"\n\n# alerts\ncomplete -c seclai -n \"__fish_seen_subcommand_from alerts; and not __fish_seen_subcommand_from list get status comment subscribe unsubscribe configs prefs\" -f -a \"list get status comment subscribe unsubscribe configs prefs\"\n\n# models\ncomplete -c seclai -n \"__fish_seen_subcommand_from models; and not __fish_seen_subcommand_from alerts recommendations experiments\" -f -a \"alerts recommendations experiments\"\n\n# ai\ncomplete -c seclai -n \"__fish_seen_subcommand_from ai; and not __fish_seen_subcommand_from feedback kb source solution memory memory-history accept decline memory-accept\" -f -a \"feedback kb source solution memory memory-history accept decline memory-accept\"\n\n# skills\ncomplete -c seclai -n \"__fish_seen_subcommand_from skills; and not __fish_seen_subcommand_from install\" -f -a \"install\"\n\n# mcp\ncomplete -c seclai -n \"__fish_seen_subcommand_from mcp; and not __fish_seen_subcommand_from configure show\" -f -a \"configure show\"\n\n# completion\ncomplete -c seclai -n \"__fish_seen_subcommand_from completion; and not __fish_seen_subcommand_from bash zsh fish\" -f -a \"bash zsh fish\"\n\n# Global options\ncomplete -c seclai -l api-key -d \"Seclai API key\"\ncomplete -c seclai -l compact -d \"Output compact JSON\"\ncomplete -c seclai -s V -l version -d \"Output version\"\n`;\n\nconst SCRIPTS: Record<string, string> = { bash: BASH, zsh: ZSH, fish: FISH };\n\n/** Register the `completion` command for generating shell completion scripts (bash/zsh/fish). */\nexport function register(program: Command, rt: CliRuntime): void {\n const completion = program\n .command(\"completion\")\n .description(\"Generate shell completion scripts.\")\n .argument(\"<shell>\", \"Shell type: bash, zsh, or fish.\")\n .action(async (shell: string) => {\n const script = SCRIPTS[shell];\n if (!script) {\n rt.writeErr(`Unknown shell \"${shell}\". Use: bash, zsh, or fish.\\n`);\n rt.setExitCode(1);\n return;\n }\n rt.writeOut(script);\n });\n}\n","/**\n * SSO authentication commands — login, logout, status, and refresh.\n *\n * @module\n */\nimport { Command } from \"commander\";\nimport { randomBytes, createHash } from \"node:crypto\";\nimport { createServer } from \"node:http\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { URL, URLSearchParams } from \"node:url\";\nimport process from \"node:process\";\n\nimport {\n loadSsoProfile,\n readSsoCache,\n writeSsoCache,\n deleteSsoCache,\n isTokenValid,\n type SsoProfile,\n type SsoCacheEntry,\n} from \"@seclai/sdk\";\n\nimport {\n type CliRuntime,\n type GlobalOptions,\n createClient,\n printJson,\n run,\n} from \"../helpers.js\";\n\n/**\n * PKCE helpers.\n */\n/** Generate a random PKCE code verifier (base64url-encoded). */\nfunction generateCodeVerifier(): string {\n return randomBytes(32).toString(\"base64url\");\n}\n\n/** Compute the S256 PKCE code challenge from a verifier. */\nfunction computeCodeChallenge(verifier: string): string {\n return createHash(\"sha256\").update(verifier).digest(\"base64url\");\n}\n\n/**\n * Start a local HTTP server to receive the OAuth callback.\n * Returns a promise that resolves with the authorization code.\n */\nfunction waitForAuthCode(port: number, state: string): Promise<{ code: string; cleanup: () => void }> {\n return new Promise((resolve, reject) => {\n const server = createServer((req, res) => {\n const url = new URL(req.url ?? \"/\", `http://localhost:${port}`);\n\n if (url.pathname !== \"/callback\") {\n res.writeHead(404);\n res.end();\n return;\n }\n\n const code = url.searchParams.get(\"code\");\n const returnedState = url.searchParams.get(\"state\");\n const error = url.searchParams.get(\"error\");\n\n if (error) {\n res.writeHead(200, { \"Content-Type\": \"text/html\" });\n res.end(\"<html><body><h2>Authentication failed</h2><p>You can close this tab.</p></body></html>\");\n reject(new Error(`OAuth error: ${error}`));\n server.close();\n return;\n }\n\n if (!code || returnedState !== state) {\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(\"<html><body><h2>Invalid callback</h2></body></html>\");\n reject(new Error(\"Invalid callback: missing code or state mismatch\"));\n server.close();\n return;\n }\n\n res.writeHead(200, { \"Content-Type\": \"text/html\" });\n res.end(\"<html><body><h2>Authenticated successfully!</h2><p>You can close this tab.</p></body></html>\");\n\n resolve({\n code,\n cleanup: () => server.close(),\n });\n });\n\n server.listen(port, \"127.0.0.1\");\n server.on(\"error\", reject);\n });\n}\n\n/**\n * Exchange an authorization code for SSO tokens via the Cognito token endpoint.\n *\n * @param profile - SSO profile with Cognito domain and client ID.\n * @param code - Authorization code from the OAuth callback.\n * @param codeVerifier - PKCE code verifier used in the authorization request.\n * @param redirectUri - Redirect URI matching the authorization request.\n * @returns Fresh cache entry with access, refresh, and ID tokens.\n * @throws {Error} If the token endpoint returns a non-OK status.\n */\nasync function exchangeCodeForTokens(\n profile: SsoProfile,\n code: string,\n codeVerifier: string,\n redirectUri: string,\n): Promise<SsoCacheEntry> {\n const tokenUrl = `https://${profile.ssoDomain}/oauth2/token`;\n\n const body = new URLSearchParams({\n grant_type: \"authorization_code\",\n client_id: profile.ssoClientId,\n code,\n redirect_uri: redirectUri,\n code_verifier: codeVerifier,\n });\n\n const resp = await fetch(tokenUrl, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body: body.toString(),\n });\n\n if (!resp.ok) {\n const text = await resp.text();\n throw new Error(`Token exchange failed (HTTP ${resp.status}): ${text}`);\n }\n\n const data = (await resp.json()) as {\n access_token: string;\n id_token?: string;\n refresh_token?: string;\n expires_in: number;\n };\n\n const expiresAt = new Date(Date.now() + data.expires_in * 1000).toISOString();\n\n const entry: SsoCacheEntry = {\n accessToken: data.access_token,\n expiresAt,\n clientId: profile.ssoClientId,\n region: profile.ssoRegion,\n cognitoDomain: profile.ssoDomain,\n };\n if (data.refresh_token) entry.refreshToken = data.refresh_token;\n if (data.id_token) entry.idToken = data.id_token;\n return entry;\n}\n\nconst DEFAULT_CALLBACK_PORT = 9876;\n\n/** Resolve the API base URL from environment or default. */\nfunction resolveBaseUrl(): string {\n const envUrl = process.env.SECLAI_API_URL;\n return envUrl && envUrl.length > 0 ? envUrl : \"https://api.seclai.com\";\n}\n\n/**\n * Call GET /me with a bearer token to resolve the user's account ID.\n *\n * @param accessToken - Fresh access token from SSO login.\n * @returns The user's personal account ID.\n */\nasync function fetchAccountId(accessToken: string): Promise<string> {\n const baseUrl = resolveBaseUrl();\n const resp = await fetch(`${baseUrl}/me`, {\n headers: { authorization: `Bearer ${accessToken}` },\n });\n\n if (!resp.ok) {\n const text = await resp.text();\n throw new Error(`Failed to resolve account ID from /me (HTTP ${resp.status}): ${text}`);\n }\n\n const data = (await resp.json()) as { account_id: string };\n return data.account_id;\n}\n\n/**\n * Update a single key within an existing profile section of the config file.\n * Adds the key if it doesn't exist in the section.\n */\nasync function updateConfigKey(\n configDir: string,\n profileName: string,\n key: string,\n value: string,\n): Promise<void> {\n const configPath = join(configDir, \"config\");\n\n let content = \"\";\n try {\n content = await readFile(configPath, \"utf-8\");\n } catch {\n // file doesn't exist — we'll create it\n }\n\n const sectionHeader = profileName === \"default\" ? \"[default]\" : `[profile ${profileName}]`;\n const sectionIdx = content.indexOf(sectionHeader);\n\n if (sectionIdx === -1) {\n // Section doesn't exist — create it with just this key\n if (content.length > 0 && !content.endsWith(\"\\n\")) {\n content += \"\\n\";\n }\n content += `\\n${sectionHeader}\\n${key} = ${value}\\n`;\n } else {\n const afterHeader = sectionIdx + sectionHeader.length;\n const nextSectionMatch = content.slice(afterHeader).match(/\\n\\[/);\n const sectionEnd = nextSectionMatch\n ? afterHeader + nextSectionMatch.index!\n : content.length;\n\n const sectionBody = content.slice(afterHeader, sectionEnd);\n const keyRegex = new RegExp(`^${key}\\\\s*=.*$`, \"m\");\n\n let newSectionBody: string;\n if (keyRegex.test(sectionBody)) {\n newSectionBody = sectionBody.replace(keyRegex, `${key} = ${value}`);\n } else {\n const trimmed = sectionBody.trimEnd();\n newSectionBody = `${trimmed}\\n${key} = ${value}\\n`;\n }\n\n content = content.slice(0, afterHeader) + newSectionBody + content.slice(sectionEnd);\n }\n\n const { mkdir } = await import(\"node:fs/promises\");\n await mkdir(configDir, { recursive: true });\n await writeFile(configPath, content, { mode: 0o600 });\n}\n\n/**\n * Resolve profile name and config directory from global options and environment.\n *\n * @param opts - Global CLI options.\n * @returns Object with profileName and configDir.\n */\nfunction resolveProfile(opts: GlobalOptions): { profileName: string; configDir: string } {\n const profileName = opts.profile || process.env.SECLAI_PROFILE || \"default\";\n let configDir = opts.configDir || process.env.SECLAI_CONFIG_DIR;\n if (!configDir) {\n const home = process.env.HOME ?? process.env.USERPROFILE;\n if (home && home.trim() !== \"\") {\n configDir = join(home, \".seclai\");\n } else {\n configDir = join(process.cwd(), \".seclai\");\n }\n }\n return { profileName, configDir };\n}\n\n/**\n * Load the SSO profile, using built-in defaults if no config exists.\n *\n * @param rt - CLI runtime for I/O.\n * @param opts - Global CLI options.\n * @returns Object with the resolved profile, profile name, and config directory.\n */\nasync function loadProfile(rt: CliRuntime, opts: GlobalOptions): Promise<{ profile: SsoProfile; profileName: string; configDir: string }> {\n const { profileName, configDir } = resolveProfile(opts);\n const profile = await loadSsoProfile(configDir, profileName);\n\n return { profile, profileName, configDir };\n}\n\n/**\n * Register the `auth` command group (login, logout, status, refresh)\n * on the given Commander program.\n *\n * @param program - Root Commander program.\n * @param rt - CLI runtime for I/O.\n */\nexport function register(program: Command, rt: CliRuntime): void {\n const group = program.command(\"auth\").description(\"SSO authentication (login/logout/status/refresh).\");\n\n // ── login ─────────────────────────────────────────────────────────────\n group\n .command(\"login\")\n .description(\"Authenticate via SSO using Authorization Code + PKCE flow.\")\n .option(\"--port <port>\", \"Local callback port\", String(DEFAULT_CALLBACK_PORT))\n .option(\"--no-browser\", \"Print the URL instead of opening a browser\")\n .action(async (opts: { port?: string; browser?: boolean }) => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const { profile, profileName, configDir } = await loadProfile(rt, globalOpts);\n\n const port = parseInt(opts.port ?? String(DEFAULT_CALLBACK_PORT), 10);\n if (!Number.isInteger(port) || port < 1 || port > 65535) {\n throw new Error(`Invalid port: ${opts.port}. Must be an integer between 1 and 65535.`);\n }\n const redirectUri = `http://localhost:${port}/callback`;\n\n const codeVerifier = generateCodeVerifier();\n const codeChallenge = computeCodeChallenge(codeVerifier);\n const state = randomBytes(16).toString(\"hex\");\n\n const authUrl = new URL(`https://${profile.ssoDomain}/oauth2/authorize`);\n authUrl.searchParams.set(\"response_type\", \"code\");\n authUrl.searchParams.set(\"client_id\", profile.ssoClientId);\n authUrl.searchParams.set(\"redirect_uri\", redirectUri);\n authUrl.searchParams.set(\"scope\", \"openid profile email\");\n authUrl.searchParams.set(\"state\", state);\n authUrl.searchParams.set(\"code_challenge\", codeChallenge);\n authUrl.searchParams.set(\"code_challenge_method\", \"S256\");\n\n const authUrlStr = authUrl.toString();\n\n // Start callback server before opening browser\n const codePromise = waitForAuthCode(port, state);\n\n if (opts.browser !== false) {\n // Open browser\n const { spawn } = await import(\"node:child_process\");\n const openCmd = process.platform === \"darwin\"\n ? { cmd: \"open\", args: [authUrlStr] }\n : process.platform === \"win32\"\n ? { cmd: \"cmd\", args: [\"/c\", \"start\", \"\", authUrlStr] }\n : { cmd: \"xdg-open\", args: [authUrlStr] };\n spawn(openCmd.cmd, openCmd.args, { stdio: \"ignore\", detached: true }).unref();\n rt.writeErr(`Opening browser for authentication...\\n`);\n } else {\n rt.writeErr(`Open this URL in your browser:\\n\\n${authUrlStr}\\n\\n`);\n }\n\n rt.writeErr(\"Waiting for authentication callback...\\n\");\n\n const { code, cleanup } = await codePromise;\n\n let tokens: Awaited<ReturnType<typeof exchangeCodeForTokens>>;\n try {\n rt.writeErr(\"Exchanging code for tokens...\\n\");\n tokens = await exchangeCodeForTokens(profile, code, codeVerifier, redirectUri);\n await writeSsoCache(configDir, profile, tokens);\n } finally {\n cleanup();\n }\n\n // Resolve the account ID from /me and persist it in the config\n let accountId = profile.ssoAccountId;\n try {\n rt.writeErr(\"Resolving account ID...\\n\");\n accountId = await fetchAccountId(tokens.accessToken);\n await updateConfigKey(configDir, profileName, \"sso_account_id\", accountId);\n } catch {\n rt.writeErr(\"Warning: Could not resolve account ID from /me. You can set it manually with `seclai configure sso`.\\n\");\n }\n\n rt.writeErr(\"Successfully authenticated!\\n\");\n const loginResult: Record<string, string> = {\n status: \"authenticated\",\n profile: profileName,\n expiresAt: tokens.expiresAt,\n };\n if (accountId) loginResult.accountId = accountId;\n printJson(rt, loginResult);\n });\n });\n\n // ── logout ────────────────────────────────────────────────────────────\n group\n .command(\"logout\")\n .description(\"Remove cached SSO tokens for the current profile.\")\n .action(async () => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const { profile, profileName, configDir } = await loadProfile(rt, globalOpts);\n\n await deleteSsoCache(configDir, profile);\n\n rt.writeErr(\"Logged out successfully.\\n\");\n printJson(rt, { status: \"logged_out\", profile: profileName });\n });\n });\n\n // ── status ────────────────────────────────────────────────────────────\n group\n .command(\"status\")\n .description(\"Show current authentication status for the active profile.\")\n .action(async () => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const { profile: profileLoaded, profileName, configDir } = await loadProfile(rt, globalOpts);\n\n const cached = await readSsoCache(configDir, profileLoaded);\n if (!cached) {\n const notAuthResult: Record<string, string> = {\n profile: profileName,\n status: \"not_authenticated\",\n };\n if (profileLoaded.ssoAccountId) notAuthResult.accountId = profileLoaded.ssoAccountId;\n printJson(rt, notAuthResult);\n return;\n }\n\n const valid = isTokenValid(cached);\n const statusResult: Record<string, string | boolean> = {\n profile: profileName,\n status: valid ? \"authenticated\" : \"expired\",\n expiresAt: cached.expiresAt,\n hasRefreshToken: Boolean(cached.refreshToken),\n };\n if (profileLoaded.ssoAccountId) statusResult.accountId = profileLoaded.ssoAccountId;\n printJson(rt, statusResult);\n });\n });\n\n // ── refresh ───────────────────────────────────────────────────────────\n group\n .command(\"refresh\")\n .description(\"Manually refresh the SSO token for the current profile.\")\n .action(async () => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const { profile, profileName, configDir } = await loadProfile(rt, globalOpts);\n\n const cached = await readSsoCache(configDir, profile);\n if (!cached?.refreshToken) {\n throw new Error(\"No cached token with refresh token. Run `seclai auth login` first.\");\n }\n\n const tokenUrl = `https://${profile.ssoDomain}/oauth2/token`;\n const body = new URLSearchParams({\n grant_type: \"refresh_token\",\n client_id: profile.ssoClientId,\n refresh_token: cached.refreshToken,\n });\n\n const resp = await fetch(tokenUrl, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body: body.toString(),\n });\n\n if (!resp.ok) {\n const text = await resp.text();\n throw new Error(`Token refresh failed (HTTP ${resp.status}): ${text}`);\n }\n\n const data = (await resp.json()) as {\n access_token: string;\n id_token?: string;\n refresh_token?: string;\n expires_in: number;\n };\n\n const refreshed: SsoCacheEntry = {\n accessToken: data.access_token,\n refreshToken: data.refresh_token ?? cached.refreshToken,\n expiresAt: new Date(Date.now() + data.expires_in * 1000).toISOString(),\n clientId: profile.ssoClientId,\n region: profile.ssoRegion,\n cognitoDomain: profile.ssoDomain,\n };\n if (data.id_token) refreshed.idToken = data.id_token;\n\n await writeSsoCache(configDir, profile, refreshed);\n\n rt.writeErr(\"Token refreshed successfully.\\n\");\n printJson(rt, {\n status: \"refreshed\",\n profile: profileName,\n expiresAt: refreshed.expiresAt,\n });\n });\n });\n}\n","/**\n * CLI profile configuration commands — interactive SSO profile setup.\n *\n * @module\n */\nimport { Command } from \"commander\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport process from \"node:process\";\nimport { createInterface } from \"node:readline\";\n\nimport { type CliRuntime, type GlobalOptions, printJson, run } from \"../helpers.js\";\nimport { DEFAULT_SSO_DOMAIN, DEFAULT_SSO_CLIENT_ID, DEFAULT_SSO_REGION } from \"@seclai/sdk\";\n\n/**\n * Prompt the user for input with an optional default value.\n *\n * @param rt - CLI runtime for I/O.\n * @param question - Prompt text.\n * @param defaultValue - Default used when user presses Enter without typing.\n * @returns The user's answer (or the default).\n */\nfunction prompt(rt: CliRuntime, question: string, defaultValue?: string): Promise<string> {\n return new Promise((resolve) => {\n const rl = createInterface({\n input: rt.stdin,\n output: { write: (s: string) => { rt.writeErr(s); return true; } } as unknown as NodeJS.WritableStream,\n terminal: false,\n });\n\n const display = defaultValue ? `${question} [${defaultValue}]: ` : `${question}: `;\n rt.writeErr(display);\n\n rl.once(\"line\", (answer) => {\n rl.close();\n resolve(answer.trim() || defaultValue || \"\");\n });\n });\n}\n\n/** Resolve the config directory from global options or environment. */\nfunction resolveConfigDir(opts: GlobalOptions): string {\n if (opts.configDir) return opts.configDir;\n const env = process.env.SECLAI_CONFIG_DIR;\n if (env) return env;\n const home = process.env.HOME ?? process.env.USERPROFILE ?? \"\";\n return join(home, \".seclai\");\n}\n\n/**\n * Register the `configure` command group on the given Commander program.\n *\n * @param program - Root Commander program.\n * @param rt - CLI runtime for I/O.\n */\nexport function register(program: Command, rt: CliRuntime): void {\n const group = program.command(\"configure\").description(\"Configure CLI profiles and settings.\");\n\n // ── sso ───────────────────────────────────────────────────────────────\n group\n .command(\"sso\")\n .description(\"Configure an SSO profile with optional overrides. Defaults to production Seclai SSO.\")\n .option(\"--profile-name <name>\", \"Profile name to configure (default: from --profile flag)\")\n .action(async (opts: { profileName?: string }) => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const profileName = opts.profileName || globalOpts.profile || \"default\";\n const configDir = resolveConfigDir(globalOpts);\n const configPath = join(configDir, \"config\");\n\n rt.writeErr(`\\nConfiguring SSO profile \"${profileName}\".\\n`);\n rt.writeErr(`Defaults: domain=${DEFAULT_SSO_DOMAIN}, region=${DEFAULT_SSO_REGION}\\n`);\n rt.writeErr(`Press Enter to accept defaults.\\n\\n`);\n\n const domain = await prompt(rt, \"SSO domain\", DEFAULT_SSO_DOMAIN);\n const clientId = await prompt(rt, \"SSO client ID\", DEFAULT_SSO_CLIENT_ID);\n const region = await prompt(rt, \"SSO region\", DEFAULT_SSO_REGION);\n const accountId = await prompt(rt, \"Account ID (optional, resolved after login)\");\n\n // Only write config if something differs from defaults\n const isDefault = domain === DEFAULT_SSO_DOMAIN\n && clientId === DEFAULT_SSO_CLIENT_ID\n && region === DEFAULT_SSO_REGION\n && !accountId;\n\n if (isDefault && profileName === \"default\") {\n rt.writeErr(`\\nUsing built-in defaults — no config file needed.\\n`);\n rt.writeErr(`Run \\`seclai auth login\\` to authenticate.\\n`);\n printJson(rt, {\n profile: profileName,\n sso_domain: domain,\n sso_client_id: clientId,\n sso_region: region,\n note: \"using built-in defaults\",\n });\n return;\n }\n\n // Read existing config or start fresh\n let content = \"\";\n try {\n content = await readFile(configPath, \"utf-8\");\n } catch {\n // file doesn't exist\n }\n\n // Build the section — only write keys that differ from defaults\n const sectionHeader = profileName === \"default\"\n ? \"[default]\"\n : `[profile ${profileName}]`;\n\n const lines: string[] = [];\n if (domain !== DEFAULT_SSO_DOMAIN) lines.push(`sso_domain = ${domain}`);\n if (clientId !== DEFAULT_SSO_CLIENT_ID) lines.push(`sso_client_id = ${clientId}`);\n if (region !== DEFAULT_SSO_REGION) lines.push(`sso_region = ${region}`);\n if (accountId) lines.push(`sso_account_id = ${accountId}`);\n const sectionBody = lines.join(\"\\n\");\n\n // Check if section already exists and replace it\n const sectionRegex = profileName === \"default\"\n ? /^\\[default\\][^\\[]*(?=\\[|$(?![\\s\\S]))/m\n : new RegExp(`^\\\\[profile ${escapeRegExp(profileName)}\\\\][^\\\\[]*(?=\\\\[|$(?![\\\\s\\\\S]))`, \"m\");\n\n if (sectionRegex.test(content)) {\n content = content.replace(sectionRegex, `${sectionHeader}\\n${sectionBody}\\n`);\n } else {\n if (content.length > 0 && !content.endsWith(\"\\n\")) {\n content += \"\\n\";\n }\n content += `\\n${sectionHeader}\\n${sectionBody}\\n`;\n }\n\n await mkdir(configDir, { recursive: true });\n await writeFile(configPath, content, { mode: 0o600 });\n\n rt.writeErr(`\\nProfile \"${profileName}\" saved to ${configPath}\\n`);\n rt.writeErr(`Run \\`seclai auth login --profile ${profileName}\\` to authenticate.\\n`);\n\n const result: Record<string, string> = {\n profile: profileName,\n configFile: configPath,\n sso_domain: domain,\n sso_client_id: clientId,\n sso_region: region,\n };\n if (accountId) result.sso_account_id = accountId;\n printJson(rt, result);\n });\n });\n\n // ── list ──────────────────────────────────────────────────────────────\n group\n .command(\"list\")\n .description(\"List all configured profiles.\")\n .action(async () => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const configDir = resolveConfigDir(globalOpts);\n const configPath = join(configDir, \"config\");\n\n let content: string;\n try {\n content = await readFile(configPath, \"utf-8\");\n } catch {\n printJson(rt, { profiles: [], configFile: configPath });\n return;\n }\n\n // Parse profile names from section headers\n const profiles: string[] = [];\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"[\") && trimmed.endsWith(\"]\")) {\n const raw = trimmed.slice(1, -1).trim();\n if (raw.startsWith(\"profile \")) {\n profiles.push(raw.slice(\"profile \".length).trim());\n } else {\n profiles.push(raw);\n }\n }\n }\n\n printJson(rt, { profiles, configFile: configPath });\n });\n });\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,eAAe,qBAAqB;;;ACD7C,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,OAAOA,cAAa;AAEpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAuBA,SAAS,iBAA6B;AAC3C,SAAO;AAAA,IACL,OAAOA,SAAQ;AAAA,IACf,UAAU,CAAC,SAAS;AAClB,MAAAA,SAAQ,OAAO,MAAM,IAAI;AAAA,IAC3B;AAAA,IACA,eAAe,CAAC,UAAU;AACxB,MAAAA,SAAQ,OAAO,MAAM,KAAK;AAAA,IAC5B;AAAA,IACA,UAAU,CAAC,SAAS;AAClB,MAAAA,SAAQ,OAAO,MAAM,IAAI;AAAA,IAC3B;AAAA,IACA,aAAa,CAAC,SAAS;AACrB,MAAAA,SAAQ,WAAW;AAAA,IACrB;AAAA,EACF;AACF;AAGA,eAAsB,cAAc,IAAiC;AACnE,SAAO,MAAM,IAAI,QAAQ,CAAC,SAAS,WAAW;AAC5C,QAAI,OAAO;AACX,OAAG,MAAM,YAAY,MAAM;AAC3B,OAAG,MAAM,GAAG,QAAQ,CAAC,UAAmB,QAAQ,KAAM;AACtD,OAAG,MAAM,GAAG,OAAO,MAAM,QAAQ,IAAI,CAAC;AACtC,OAAG,MAAM,GAAG,SAAS,MAAM;AAAA,EAC7B,CAAC;AACH;AAOA,eAAsB,cACpB,IACA,MACkB;AAClB,MAAI,KAAK,SAAS,UAAa,KAAK,aAAa,QAAW;AAC1D,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AAEA,MAAI,KAAK,aAAa,QAAW;AAC/B,UA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EA,QAAM,UAAU,cAAc,SAAS;AACvC,MAAI,WAAW;AAEf,MAAI;AACF,UAAM,QAAQ,WAAW,IAAI;AAAA,EAC/B,SAAS,KAAU;AACjB,UAAM,gBAAgB,OAAO,KAAK,aAAa,WAAW,IAAI,WAAW;AACzE,QAAI,kBAAkB,QAAW;AAC/B,iBAAW;AAAA,IACb,OAAO;AACL,iBAAW,WAAW,GAAG;AACzB,iBAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,gBAAgB,qBAAqB,IAAI,mBAAmB;AAClE,YAAU,YAAY,aAAa;AACnC,SAAO;AACT;AAGA,IAAI,QAAQ,KAAK,CAAC,GAAG;AACnB,MAAI;AACF,UAAM,YAAY,aAAa,QAAQ,KAAK,CAAC,CAAC;AAC9C,UAAM,WAAW,aAAa,cAAc,YAAY,GAAG,CAAC;AAC5D,QAAI,cAAc,UAAU;AAC1B,YAAM,OAAO,QAAQ,IAAI;AAAA,IAC3B;AAAA,EACF,QAAQ;AACN,UAAM,YAAY,cAAc,QAAQ,KAAK,CAAC,CAAC,EAAE;AACjD,QAAI,YAAY,QAAQ,WAAW;AACjC,YAAM,OAAO,QAAQ,IAAI;AAAA,IAC3B;AAAA,EACF;AACF;","names":["process","writeFile","readFile","register","register","register","register","register","register","register","register","register","register","register","register","existsSync","mkdir","readFile","writeFile","dirname","join","join","existsSync","readFile","mkdir","dirname","writeFile","register","register","readFile","writeFile","join","URL","process","URL","process","join","readFile","mkdir","writeFile","register","mkdir","readFile","writeFile","join","process","process","join","register","readFile","mkdir","writeFile","register"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/helpers.ts","../src/commands/agents.ts","../src/commands/sources.ts","../src/commands/contents.ts","../src/commands/kb.ts","../src/commands/memory.ts","../src/commands/evals.ts","../src/commands/solutions.ts","../src/commands/governance.ts","../src/commands/alerts.ts","../src/commands/email.ts","../src/commands/account.ts","../src/commands/models.ts","../src/commands/search.ts","../src/commands/ai.ts","../src/commands/skills.ts","../src/commands/mcp.ts","../src/commands/completion.ts","../src/commands/auth.ts","../src/commands/configure.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { realpathSync } from \"node:fs\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\n\nimport {\n type CliRuntime,\n type GlobalOptions,\n defaultRuntime,\n getCliVersion,\n printError,\n warnDeprecated,\n} from \"./helpers.js\";\n\nimport { register as registerAgents } from \"./commands/agents.js\";\nimport { register as registerSources } from \"./commands/sources.js\";\nimport { register as registerContents } from \"./commands/contents.js\";\nimport { register as registerKb } from \"./commands/kb.js\";\nimport { register as registerMemory } from \"./commands/memory.js\";\nimport { register as registerEvals } from \"./commands/evals.js\";\nimport { register as registerSolutions } from \"./commands/solutions.js\";\nimport { register as registerGovernance } from \"./commands/governance.js\";\nimport { register as registerAlerts } from \"./commands/alerts.js\";\nimport { register as registerEmail } from \"./commands/email.js\";\nimport { register as registerAccount } from \"./commands/account.js\";\nimport { register as registerModels } from \"./commands/models.js\";\nimport { register as registerSearch } from \"./commands/search.js\";\nimport { register as registerAi } from \"./commands/ai.js\";\nimport { register as registerSkills } from \"./commands/skills.js\";\nimport { register as registerMcp } from \"./commands/mcp.js\";\nimport { register as registerCompletion } from \"./commands/completion.js\";\nimport { register as registerAuth } from \"./commands/auth.js\";\nimport { register as registerConfigure } from \"./commands/configure.js\";\n\nexport type { CliRuntime, GlobalOptions };\n\n/**\n * Global options that take a value, and what to do when one arrives empty.\n *\n * A shell expanding an unset variable hands us `\"\"`, not an absent flag, and\n * every consumer in the SDK's credential chain tests truthiness, so an empty\n * value is silently discarded and something else is used instead.\n *\n * Four of these decide *who you are* or *what you act on*, and no empty value\n * has a legitimate meaning for any of them — `--api-key \"\"` cannot even express\n * \"ignore the environment key\", because the chain falls straight through to\n * `SECLAI_API_KEY` and then to a cached SSO session. So they are rejected:\n *\n * --api-key falls back to SECLAI_API_KEY, then SSO — a different identity\n * --config-dir falls back to ~/.seclai — another account's cached tokens\n * --account-id drops the X-Account-Id header — targets the default org\n * --profile misses its config section — built-in SSO defaults\n *\n * This can only break an invocation that was already resolving to the wrong\n * identity without saying so.\n *\n * `--api-version` is different: an empty value costs nothing but the version\n * header, so it keeps the old behaviour and warns.\n */\ntype EmptyValuePolicy = \"reject\" | \"warn\";\n\nconst VALUED_GLOBAL_OPTIONS: ReadonlyArray<\n [keyof GlobalOptions, string, EmptyValuePolicy, string]\n> = [\n [\"apiKey\", \"--api-key\", \"reject\", \"Pass a key, or omit the flag to use SECLAI_API_KEY or SSO.\"],\n [\"profile\", \"--profile\", \"reject\", \"Pass a profile name, or omit the flag to use the default profile.\"],\n [\"accountId\", \"--account-id\", \"reject\", \"Pass an account ID, or omit the flag to use the default org.\"],\n [\"configDir\", \"--config-dir\", \"reject\", \"Pass a directory, or omit the flag to use ~/.seclai.\"],\n [\"apiVersion\", \"--api-version\", \"warn\", \"Pass a YYYY-MM-DD date, or omit the flag to use the account default.\"],\n];\n\n/**\n * Build the top-level Commander program with all command modules registered.\n * Pass a custom {@link CliRuntime} for testing; defaults to real process I/O.\n */\nexport function createProgram(rt: CliRuntime = defaultRuntime()): Command {\n const program = new Command();\n const cliVersion = getCliVersion();\n\n program\n .name(\"seclai\")\n .description(\n `Seclai Command Line Interface (v${cliVersion})\\n\\n` +\n `Manage agents, knowledge bases, sources, memory banks, evaluations, and more from the terminal.\\n\\n` +\n `All commands return JSON to stdout, making it easy to pipe into jq or other tools.`\n )\n .version(cliVersion, \"-V, --version\", \"output the version\")\n .option(\n \"--api-key <key>\",\n \"Seclai API key (defaults to SECLAI_API_KEY).\"\n )\n .option(\n \"--profile <name>\",\n \"SSO profile name (defaults to SECLAI_PROFILE, then 'default').\"\n )\n .option(\n \"--account-id <id>\",\n \"Account ID for multi-org targeting (X-Account-Id header).\"\n )\n .option(\n \"--config-dir <path>\",\n \"Config directory (defaults to SECLAI_CONFIG_DIR, then ~/.seclai).\"\n )\n .option(\n \"--api-version <date>\",\n \"Opt into dated API changes released on or before this YYYY-MM-DD (defaults to SECLAI_API_VERSION; omitted means the account default).\"\n )\n .option(\n \"--allow-unknown-api-version\",\n \"Send an --api-version this CLI was not built against instead of rejecting it.\"\n )\n .option(\n \"--compact\",\n \"Output compact JSON (no indentation).\"\n );\n\n program.addHelpText(\n \"after\",\n `\\nEnvironment:\\n` +\n ` SECLAI_API_KEY Default API key (alternative to --api-key)\\n` +\n ` SECLAI_API_URL Override API base URL (default: https://api.seclai.com)\\n` +\n ` SECLAI_PROFILE Default SSO profile (alternative to --profile)\\n` +\n ` SECLAI_CONFIG_DIR Config directory (alternative to --config-dir)\\n` +\n ` SECLAI_API_VERSION Dated API version (alternative to --api-version)\\n\\n` +\n `Examples:\\n` +\n ` seclai agents list\\n` +\n ` seclai agents run <agentId> --json '{\"input\":\"Hello\"}'\\n` +\n ` seclai agents run <agentId> --json '{\"input\":\"Hi\"}' --events\\n` +\n ` seclai configure sso\\n` +\n ` seclai auth login\\n` +\n ` seclai auth status\\n` +\n ` seclai sources list --profile dev\\n` +\n ` npx @seclai/cli agents list\\n`\n );\n\n program.configureOutput({\n writeOut: (str) => rt.writeOut(str),\n writeErr: (str) => rt.writeErr(str),\n });\n program.exitOverride();\n\n // Validate global flags and propagate them to the runtime before any action\n program.hook(\"preAction\", (thisCommand) => {\n const globalOpts = thisCommand.opts<GlobalOptions>();\n for (const [key, flag, policy, hint] of VALUED_GLOBAL_OPTIONS) {\n const value = globalOpts[key];\n if (typeof value !== \"string\" || value.length > 0) continue;\n\n if (policy === \"reject\") {\n throw new Error(`${flag} was given an empty value. ${hint}`);\n }\n // Delete it so downstream code sees an absent flag rather than \"\", which\n // is what it effectively saw before this warning existed.\n delete globalOpts[key];\n warnDeprecated(rt, `${flag} was given an empty value and is being ignored. ${hint}`);\n }\n rt.compact = Boolean(globalOpts.compact);\n });\n\n // Register all command modules\n registerAgents(program, rt);\n registerSources(program, rt);\n registerContents(program, rt);\n registerKb(program, rt);\n registerMemory(program, rt);\n registerEvals(program, rt);\n registerSolutions(program, rt);\n registerGovernance(program, rt);\n registerAlerts(program, rt);\n registerEmail(program, rt);\n registerAccount(program, rt);\n registerModels(program, rt);\n registerSearch(program, rt);\n registerAi(program, rt);\n registerSkills(program, rt);\n registerMcp(program, rt);\n registerCompletion(program, rt);\n registerAuth(program, rt);\n registerConfigure(program, rt);\n\n return program;\n}\n\n/**\n * Parse `argv` and run the matching command.\n * Returns the process exit code (0 = success).\n */\nexport async function runCli(argv: string[], rt: CliRuntime = defaultRuntime()): Promise<number> {\n let observedExitCode = 0;\n const wrappedRt: CliRuntime = {\n ...rt,\n setExitCode: (code) => {\n observedExitCode = code;\n rt.setExitCode(code);\n },\n };\n\n const program = createProgram(wrappedRt);\n let exitCode = 0;\n\n try {\n await program.parseAsync(argv);\n } catch (err: any) {\n const maybeExitCode = typeof err?.exitCode === \"number\" ? err.exitCode : undefined;\n if (maybeExitCode !== undefined) {\n exitCode = maybeExitCode;\n } else {\n printError(wrappedRt, err);\n exitCode = 1;\n }\n }\n\n const finalExitCode = observedExitCode !== 0 ? observedExitCode : exitCode;\n wrappedRt.setExitCode(finalExitCode);\n return finalExitCode;\n}\n\n// Only run when executed as an entrypoint, not when imported.\nif (process.argv[1]) {\n try {\n const entryReal = realpathSync(process.argv[1]);\n const selfReal = realpathSync(fileURLToPath(import.meta.url));\n if (entryReal === selfReal) {\n await runCli(process.argv);\n }\n } catch {\n const entryHref = pathToFileURL(process.argv[1]).href;\n if (import.meta.url === entryHref) {\n await runCli(process.argv);\n }\n }\n}\n","import { Command, InvalidArgumentError } from \"commander\";\nimport { readFile } from \"node:fs/promises\";\nimport { readFileSync } from \"node:fs\";\nimport process from \"node:process\";\n\nimport {\n Seclai,\n SeclaiAPIStatusError,\n SeclaiAPIValidationError,\n SeclaiConfigurationError,\n} from \"@seclai/sdk\";\n\n/**\n * Global CLI options parsed from top-level flags (--api-key, --compact,\n * --profile, --account-id, --config-dir, --api-version).\n *\n * The `?: T | undefined` spelling is deliberate. This repo sets\n * `exactOptionalPropertyTypes`, which distinguishes an absent property from one\n * present with the value `undefined` — a distinction that is meaningful for\n * data we construct, and meaningless for a bag of CLI flags. Commander hands\n * these over with unset flags either missing or `undefined` depending on how\n * the option was declared, and every consumer here tests `!== undefined`, so\n * both spellings already behave identically. Widening the input types says so,\n * and lets callers spread a partial without a confusing assignability error.\n *\n * Values we build and hand onwards keep the strict `?: T` form, so the compiler\n * flag still does its job where the distinction carries meaning.\n */\nexport type GlobalOptions = {\n apiKey?: string | undefined;\n compact?: boolean | undefined;\n profile?: string | undefined;\n accountId?: string | undefined;\n configDir?: string | undefined;\n apiVersion?: string | undefined;\n allowUnknownApiVersion?: boolean | undefined;\n};\n\n/** Runtime abstraction that decouples the CLI from Node globals, enabling testability. */\nexport type CliRuntime = {\n stdin: NodeJS.ReadableStream;\n writeOut: (text: string) => void;\n /** Write raw bytes to stdout (e.g. binary downloads). Routed through the runtime for testability. */\n writeOutBytes: (bytes: Uint8Array) => void;\n writeErr: (text: string) => void;\n setExitCode: (code: number) => void;\n compact?: boolean;\n};\n\n/** Create a {@link CliRuntime} wired to process stdin/stdout/stderr. */\nexport function defaultRuntime(): CliRuntime {\n return {\n stdin: process.stdin,\n writeOut: (text) => {\n process.stdout.write(text);\n },\n writeOutBytes: (bytes) => {\n process.stdout.write(bytes);\n },\n writeErr: (text) => {\n process.stderr.write(text);\n },\n setExitCode: (code) => {\n process.exitCode = code;\n },\n };\n}\n\n/** Read all of stdin as a UTF-8 string. */\nexport async function readStdinText(rt: CliRuntime): Promise<string> {\n return await new Promise((resolve, reject) => {\n let data = \"\";\n rt.stdin.setEncoding(\"utf8\");\n rt.stdin.on(\"data\", (chunk: string) => (data += chunk));\n rt.stdin.on(\"end\", () => resolve(data));\n rt.stdin.on(\"error\", reject);\n });\n}\n\n/**\n * Resolve JSON input from `--json` or `--json-file` options.\n * Pass `\"-\"` as the value to read from stdin.\n * @throws If neither option is provided, or both are.\n */\nexport async function readJsonInput(\n rt: CliRuntime,\n opts: { json?: string | undefined; jsonFile?: string | undefined }\n): Promise<unknown> {\n if (opts.json !== undefined && opts.jsonFile !== undefined) {\n throw new Error(\"Provide only one of --json or --json-file\");\n }\n\n if (opts.jsonFile !== undefined) {\n const text =\n opts.jsonFile === \"-\" ? await readStdinText(rt) : await readFile(opts.jsonFile, \"utf8\");\n return JSON.parse(text);\n }\n\n if (opts.json !== undefined) {\n const text = opts.json === \"-\" ? await readStdinText(rt) : opts.json;\n return JSON.parse(text);\n }\n\n throw new Error(\"Missing JSON input. Provide --json or --json-file.\");\n}\n\n/**\n * Like {@link readJsonInput} but validates the result is a plain object.\n * @throws If the parsed value is not a JSON object.\n */\nexport async function readJsonObjectInput(\n rt: CliRuntime,\n opts: { json?: string | undefined; jsonFile?: string | undefined }\n): Promise<Record<string, unknown>> {\n const value = await readJsonInput(rt, opts);\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(\"Expected a JSON object.\");\n }\n return value as Record<string, unknown>;\n}\n\n/** Read the CLI version from the nearest package.json. Returns `\"0.0.0\"` on failure. */\nexport function getCliVersion(): string {\n try {\n const packageJsonPath = new URL(\"../package.json\", import.meta.url);\n const raw = readFileSync(packageJsonPath, \"utf8\");\n const parsed = JSON.parse(raw) as { version?: unknown };\n return typeof parsed.version === \"string\" ? parsed.version : \"0.0.0\";\n } catch {\n return \"0.0.0\";\n }\n}\n\n/** Create a {@link Seclai} SDK client from global CLI options and environment variables. */\nexport function createClient(opts: GlobalOptions): Seclai {\n const seclaiOpts: {\n apiKey?: string;\n baseUrl?: string;\n profile?: string;\n configDir?: string;\n accountId?: string;\n apiVersion?: string;\n allowUnknownApiVersion?: boolean;\n } = {};\n\n if (opts.apiKey !== undefined) seclaiOpts.apiKey = opts.apiKey;\n if (opts.profile !== undefined) seclaiOpts.profile = opts.profile;\n if (opts.configDir !== undefined) seclaiOpts.configDir = opts.configDir;\n if (opts.accountId !== undefined) seclaiOpts.accountId = opts.accountId;\n\n // Omitted by default, so upgrading the CLI never changes a response shape;\n // passing --api-version opts into the dated changes released up to that date.\n //\n // An empty --api-version is rejected before we get here, by the global\n // empty-value guard in cli.ts: the SDK tests the option for truthiness, so \"\"\n // would send no header and skip the unknown-version guard. An empty\n // SECLAI_API_VERSION is treated as unset, which is the ordinary convention\n // for an environment variable.\n const envVersion = process.env.SECLAI_API_VERSION;\n const version = opts.apiVersion ?? (envVersion && envVersion.length > 0 ? envVersion : undefined);\n if (version !== undefined) seclaiOpts.apiVersion = version;\n if (opts.allowUnknownApiVersion) seclaiOpts.allowUnknownApiVersion = true;\n\n const envUrl = process.env.SECLAI_API_URL;\n seclaiOpts.baseUrl = envUrl && envUrl.length > 0 ? envUrl : \"https://api.seclai.com\";\n\n return new Seclai(seclaiOpts);\n}\n\n/** Serialize `value` as JSON to stdout. Respects `rt.compact` for indentation. */\nexport function printJson(rt: CliRuntime, value: unknown): void {\n const indent = rt.compact ? undefined : 2;\n rt.writeOut(`${JSON.stringify(value, null, indent)}\\n`);\n}\n\n/**\n * Warn on stderr about input that is accepted today and will stop being\n * accepted later.\n *\n * Rejecting bad input outright is the better end state, but doing it in a\n * single release breaks whatever was quietly relying on the old handling. These\n * warnings are the deprecation period: the command still behaves exactly as it\n * did, and the operator gets told what will change. stdout stays clean, so\n * anything piping into `jq` is unaffected.\n */\nexport function warnDeprecated(rt: CliRuntime, message: string): void {\n rt.writeErr(`warning: ${message} This will be rejected in a future release.\\n`);\n}\n\n/** Print a human-readable error to stderr. Shows extra detail for SDK error types. */\nexport function printError(rt: CliRuntime, err: unknown): void {\n if (err instanceof SeclaiAPIValidationError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`status: ${err.statusCode}\\n`);\n rt.writeErr(`url: ${err.url}\\n`);\n if (err.responseText) rt.writeErr(`response: ${err.responseText}\\n`);\n if (err.validationError) printJson(rt, { validationError: err.validationError });\n return;\n }\n\n if (err instanceof SeclaiAPIStatusError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`status: ${err.statusCode}\\n`);\n rt.writeErr(`url: ${err.url}\\n`);\n if (err.responseText) rt.writeErr(`response: ${err.responseText}\\n`);\n return;\n }\n\n if (err instanceof SeclaiConfigurationError) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n rt.writeErr(`hint: Set the SECLAI_API_KEY environment variable or pass --api-key.\\n`);\n return;\n }\n\n if (err instanceof Error) {\n rt.writeErr(`${err.name}: ${err.message}\\n`);\n return;\n }\n\n rt.writeErr(String(err));\n rt.writeErr(\"\\n\");\n}\n\n/** Execute `main`, catching errors and routing them to {@link printError}. */\nexport async function run(rt: CliRuntime, main: () => Promise<void>): Promise<void> {\n try {\n await main();\n } catch (err) {\n printError(rt, err);\n rt.setExitCode(1);\n }\n}\n\n/**\n * Argument parser for an option that takes a number, failing the parse instead\n * of forwarding garbage. A bare `Number(v)` turns `--limit abc` into `NaN` and\n * `--limit \"\"` into `0`, and the SDK stringifies whatever it is handed — so the\n * request left as `?limit=NaN` and came back a server 422 naming nothing.\n *\n * Commander wraps an {@link InvalidArgumentError} with the offending flag and\n * value, so the message here only has to say what was expected.\n */\nexport function parseNumber(value: string): number {\n const parsed = value.trim() === \"\" ? Number.NaN : Number(value);\n if (!Number.isFinite(parsed)) {\n throw new InvalidArgumentError(\"Expected a number.\");\n }\n return parsed;\n}\n\n/** The `--limit` declaration shared by the pagination helpers below. */\nfunction withLimitOption(cmd: Command): Command {\n return cmd.option(\"--limit <n>\", \"Page size.\", parseNumber);\n}\n\n/** Add common pagination options to a command */\nexport function withListOptions(cmd: Command): Command {\n return withLimitOption(cmd.option(\"--page <n>\", \"Page number (1-based).\", parseNumber));\n}\n\n/**\n * Add limit/offset options, for the endpoints that paginate by offset rather\n * than by page number. Pairs with {@link offsetListOpts}.\n */\nexport function withOffsetListOptions(cmd: Command): Command {\n return withLimitOption(cmd).option(\"--offset <n>\", \"Number of items to skip.\", parseNumber);\n}\n\n/** Pick the defined limit/offset values for an offset-paginated call. */\nexport function offsetListOpts(opts: { limit?: number | undefined; offset?: number | undefined }): {\n limit?: number;\n offset?: number;\n} {\n const o: { limit?: number; offset?: number } = {};\n if (opts.limit !== undefined) o.limit = opts.limit;\n if (opts.offset !== undefined) o.offset = opts.offset;\n return o;\n}\n\n/** Add sortable list options (page, limit, sort, order) */\nexport function withSortableListOptions(cmd: Command): Command {\n return withListOptions(cmd)\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\");\n}\n\n/** Add --json / --json-file options to a command */\nexport function withJsonInputOptions(cmd: Command): Command {\n return cmd\n .option(\"--json <json>\", \"Inline JSON body. Use '-' to read from stdin.\")\n .option(\"--json-file <path>\", \"Path to JSON file. Use '-' to read from stdin.\");\n}\n\n/** Add file upload options */\nexport function withFileUploadOptions(cmd: Command): Command {\n return cmd\n .requiredOption(\"--file <path>\", \"Path to a local file to upload.\")\n .option(\"--title <title>\", \"Optional title.\")\n .option(\"--metadata <json>\", \"Metadata JSON object. Use '-' for stdin.\")\n .option(\"--metadata-file <path>\", \"Path to metadata JSON file. Use '-' for stdin.\")\n .option(\"--file-name <name>\", \"Override filename sent to API.\")\n .option(\"--mime-type <type>\", \"Explicit MIME type.\");\n}\n\n/** Build upload opts from CLI flags */\nexport async function buildUploadOpts(\n rt: CliRuntime,\n opts: {\n file: string;\n title?: string | undefined;\n metadata?: string | undefined;\n metadataFile?: string | undefined;\n fileName?: string | undefined;\n mimeType?: string | undefined;\n }\n // The returned object is ours to construct, so it keeps the strict form.\n): Promise<{\n file: Uint8Array;\n title?: string;\n metadata?: Record<string, unknown>;\n fileName?: string;\n mimeType?: string;\n}> {\n const bytes = new Uint8Array(await readFile(opts.file));\n const result: {\n file: Uint8Array;\n title?: string;\n metadata?: Record<string, unknown>;\n fileName?: string;\n mimeType?: string;\n } = { file: bytes };\n if (opts.title !== undefined) result.title = opts.title;\n if (opts.metadata !== undefined || opts.metadataFile !== undefined) {\n const jsonArg = opts.metadata !== undefined ? { json: opts.metadata } : {};\n const jsonFileArg = opts.metadataFile !== undefined ? { jsonFile: opts.metadataFile } : {};\n result.metadata = await readJsonObjectInput(rt, { ...jsonArg, ...jsonFileArg });\n }\n if (opts.fileName !== undefined) result.fileName = opts.fileName;\n if (opts.mimeType !== undefined) result.mimeType = opts.mimeType;\n return result;\n}\n\n/** Pick defined values from opts for list calls */\nexport function listOpts(opts: {\n page?: number | undefined;\n limit?: number | undefined;\n sort?: string | undefined;\n order?: string | undefined;\n}): Record<string, unknown> {\n const o: Record<string, unknown> = {};\n if (opts.page !== undefined) o.page = opts.page;\n if (opts.limit !== undefined) o.limit = opts.limit;\n if (opts.sort !== undefined) o.sort = opts.sort;\n if (opts.order !== undefined) o.order = opts.order;\n return o;\n}\n\n/** Signature for a command module's `register` function. */\nexport type RegisterFn = (program: Command, rt: CliRuntime) => void;\n\n/** Add --user-input / --json / --json-file options for AI assistant commands */\nexport function withAiInputOptions(cmd: Command): Command {\n return cmd\n .option(\"--user-input <text>\", \"User input text (shorthand for --json '{\\\"user_input\\\":\\\"...\\\"}')\")\n .option(\"--json <json>\", \"Full request body JSON.\")\n .option(\"--json-file <path>\", \"Request body JSON file.\");\n}\n\n/** Read AI assistant input: --user-input takes precedence, falls back to --json/--json-file */\nexport async function readAiInput(\n rt: CliRuntime,\n opts: { userInput?: string | undefined; json?: string | undefined; jsonFile?: string | undefined }\n): Promise<unknown> {\n if (opts.userInput !== undefined) {\n return { user_input: opts.userInput };\n }\n const jsonArg = opts.json !== undefined ? { json: opts.json } : {};\n const jsonFileArg = opts.jsonFile !== undefined ? { jsonFile: opts.jsonFile } : {};\n return readJsonInput(rt, { ...jsonArg, ...jsonFileArg });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport {\n run,\n createClient,\n printJson,\n readJsonInput,\n readAiInput,\n withAiInputOptions,\n listOpts,\n withOffsetListOptions,\n offsetListOpts,\n parseNumber,\n warnDeprecated,\n} from \"../helpers.js\";\n\n/** Register `agents` commands: CRUD, run (basic/stream/events/poll), runs, definition, export, input uploads, AI assistant. */\nexport function register(program: Command, rt: CliRuntime): void {\n const agents = program\n .command(\"agents\")\n .description(\"Manage agents, runs, definitions, export, and AI assistance.\");\n\n // --- CRUD ---\n\n agents\n .command(\"list\")\n .description(\"List agents.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listAgents(listOpts(opts)));\n });\n });\n\n agents\n .command(\"create\")\n .description(\"Create a new agent.\")\n .option(\"--json <json>\", \"Inline JSON body. Use '-' for stdin.\")\n .option(\"--json-file <path>\", \"JSON file path. Use '-' for stdin.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createAgent(body as any));\n });\n });\n\n agents\n .command(\"get\")\n .description(\"Get an agent by ID.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgent(agentId));\n });\n });\n\n agents\n .command(\"update\")\n .description(\"Update an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Inline JSON body.\")\n .option(\"--json-file <path>\", \"JSON file path.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateAgent(agentId, body as any));\n });\n });\n\n agents\n .command(\"delete\")\n .description(\"Delete an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteAgent(agentId);\n printJson(rt, { ok: true });\n });\n });\n\n agents\n .command(\"disable\")\n .description(\"Pause an agent across every trigger path (API, schedule, email, sub-agent calls).\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.disableAgent(agentId));\n });\n });\n\n agents\n .command(\"enable\")\n .description(\"Resume a paused agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.enableAgent(agentId));\n });\n });\n\n agents\n .command(\"callers\")\n .description(\"List the live agents that call this agent via a call_agent step.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentCallers(agentId));\n });\n });\n\n // --- Triggers ---\n\n const triggers = agents.command(\"triggers\").description(\"Agent trigger configuration.\");\n\n triggers\n .command(\"email-config\")\n .description(\"Set the alias, sender allowlist, and inbound-handling flags on an EMAIL_RECEIVED trigger.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .argument(\"<triggerId>\", \"Trigger ID.\")\n .option(\"--json <json>\", \"Config body JSON. Use '-' for stdin.\")\n .option(\"--json-file <path>\", \"Config body JSON file. Use '-' for stdin.\")\n .action(async (agentId: string, triggerId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(\n rt,\n await client.setEmailTriggerConfig(\n agentId,\n triggerId,\n body as Parameters<typeof client.setEmailTriggerConfig>[2],\n ),\n );\n });\n });\n\n // --- Run ---\n\n agents\n .command(\"run\")\n .description(\"Run an agent. Use --stream/--events/--poll for different modes.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Inline JSON body. Use '-' for stdin.\")\n .option(\"--json-file <path>\", \"JSON file path. Use '-' for stdin.\")\n .option(\"--stream\", \"Stream and print final result when done.\")\n .option(\"--events\", \"Stream SSE events as newline-delimited JSON.\")\n .option(\"--event-filter <types>\", \"Comma-separated event types to show (with --events).\")\n .option(\"--output <mode>\", \"Output mode: 'full' prints entire event, 'data' prints only the data field, 'status' prints a one-line summary.\", \"full\")\n .option(\"--poll\", \"Poll until completion instead of streaming.\")\n .option(\"--poll-interval-ms <n>\", \"Poll interval in ms (with --poll).\", parseNumber)\n .option(\"--timeout-ms <n>\", \"Client-side timeout in ms.\", parseNumber)\n .option(\"--include-step-outputs\", \"Include step outputs (with --poll).\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n\n if (opts.events) {\n // Stream SSE events as NDJSON\n const filterSet = opts.eventFilter\n ? new Set(opts.eventFilter.split(\",\").map((s: string) => s.trim()))\n : undefined;\n\n const stream = client.runStreamingAgent(\n agentId,\n body as any,\n opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : undefined\n );\n\n for await (const event of stream) {\n if (filterSet && !filterSet.has((event as any).type ?? \"\")) continue;\n\n if (opts.output === \"data\") {\n rt.writeOut(JSON.stringify((event as any).data ?? event) + \"\\n\");\n } else if (opts.output === \"status\") {\n const e = event as any;\n rt.writeOut(`${e.type ?? \"event\"}: ${e.status ?? JSON.stringify(e.data ?? e)}\\n`);\n } else {\n rt.writeOut(JSON.stringify(event) + \"\\n\");\n }\n }\n return;\n }\n\n if (opts.poll) {\n const pollOpts: Record<string, unknown> = {};\n if (opts.pollIntervalMs !== undefined) pollOpts.pollIntervalMs = opts.pollIntervalMs;\n if (opts.timeoutMs !== undefined) pollOpts.timeoutMs = opts.timeoutMs;\n if (opts.includeStepOutputs) pollOpts.includeStepOutputs = true;\n printJson(rt, await client.runAgentAndPoll(agentId, body as any, pollOpts as any));\n return;\n }\n\n if (opts.stream) {\n printJson(\n rt,\n await client.runStreamingAgentAndWait(\n agentId,\n body as any,\n opts.timeoutMs !== undefined ? { timeoutMs: opts.timeoutMs } : undefined\n )\n );\n return;\n }\n\n printJson(rt, await client.runAgent(agentId, body as any));\n });\n });\n\n // --- Runs ---\n\n const runs = agents.command(\"runs\").description(\"Manage agent runs.\");\n\n runs\n .command(\"list\")\n .description(\"List runs for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .option(\"--status <status>\", \"Filter by run status (e.g. queued, running, completed, failed, cancelled).\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Record<string, unknown> = listOpts(opts);\n if (opts.status) o.status = opts.status;\n printJson(rt, await client.listAgentRuns(agentId, o));\n });\n });\n\n runs\n .command(\"get\")\n .description(\"Get a specific run.\")\n .argument(\"<runId>\", \"Run ID.\")\n .option(\"--include-step-outputs\", \"Include step-level outputs.\")\n .action(async (runId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(\n rt,\n await client.getAgentRun(runId, opts.includeStepOutputs ? { includeStepOutputs: true } : undefined)\n );\n });\n });\n\n runs\n .command(\"delete\")\n .description(\"Deprecated alias for 'runs cancel'. The API has no delete-a-run operation.\")\n .argument(\"<runId>\", \"Run ID.\")\n .action(async (runId: string) => {\n await run(rt, async () => {\n // This never deleted anything: it called the cancel endpoint all along,\n // so it is routed to the method that says what it does.\n //\n // stdout stays `{\"ok\": true}` as it was through 1.4.0. `runs cancel`\n // prints the cancelled run, and switching this command to match would\n // break every script piping it into `jq`, which is the opposite of what\n // keeping a deprecated alias is for.\n warnDeprecated(\n rt,\n \"'agents runs delete' is deprecated and cancels the run rather than deleting it — \" +\n \"the API has no delete-a-run operation. Use 'agents runs cancel', which also \" +\n \"prints the cancelled run instead of {\\\"ok\\\": true}.\",\n );\n const client = createClient(program.opts<GlobalOptions>());\n await client.cancelAgentRun(runId);\n printJson(rt, { ok: true });\n });\n });\n\n runs\n .command(\"cancel\")\n .description(\"Cancel a running agent run.\")\n .argument(\"<runId>\", \"Run ID.\")\n .action(async (runId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.cancelAgentRun(runId));\n });\n });\n\n runs\n .command(\"search\")\n .description(\"Search agent runs.\")\n .option(\"--json <json>\", \"Search body JSON.\")\n .option(\"--json-file <path>\", \"Search body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.searchAgentRuns(body as any));\n });\n });\n\n runs\n .command(\"download-attachment\")\n .description(\n \"Download a file attachment emitted by a step in an agent run. \" +\n \"The attachmentId is the URL-safe-base64 storage_key from run output manifests / webhooks.\",\n )\n .argument(\"<runId>\", \"Run ID.\")\n .argument(\"<attachmentId>\", \"Attachment ID (storage_key).\")\n .option(\"--download-name <name>\", \"Filename hint for the download disposition.\")\n .option(\"--output <path>\", \"Write the attachment bytes to this file. If omitted, raw bytes are written to stdout.\")\n .action(async (runId: string, attachmentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const res = await client.downloadAgentRunAttachment(\n runId,\n attachmentId,\n opts.downloadName ? { downloadName: opts.downloadName } : {},\n );\n if (opts.output) {\n const { createWriteStream } = await import(\"node:fs\");\n const { stat } = await import(\"node:fs/promises\");\n if (res.body) {\n // Stream the body straight to disk so large attachments never get\n // buffered fully in memory.\n const { Readable } = await import(\"node:stream\");\n const { pipeline } = await import(\"node:stream/promises\");\n await pipeline(\n Readable.fromWeb(res.body as Parameters<typeof Readable.fromWeb>[0]),\n createWriteStream(opts.output),\n );\n } else {\n // Fallback for runtimes/mocks without a streamable body.\n const { writeFile } = await import(\"node:fs/promises\");\n await writeFile(opts.output, Buffer.from(await res.arrayBuffer()));\n }\n const { size } = await stat(opts.output);\n printJson(rt, { saved: opts.output, bytes: size });\n } else {\n rt.writeOutBytes(new Uint8Array(await res.arrayBuffer()));\n }\n });\n });\n\n // --- Definition ---\n\n const def = agents.command(\"def\").description(\"Agent definition (step workflow).\");\n\n def\n .command(\"get\")\n .description(\"Get agent definition.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentDefinition(agentId));\n });\n });\n\n def\n .command(\"update\")\n .description(\"Update agent definition.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Definition JSON body.\")\n .option(\"--json-file <path>\", \"Definition JSON file.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateAgentDefinition(agentId, body as any));\n });\n });\n\n // --- Export / Import ---\n\n agents\n .command(\"export\")\n .description(\"Export an agent definition as a portable JSON snapshot.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--no-download\", \"Omit Content-Disposition header (inline response).\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.exportAgent(agentId, opts.download as boolean));\n });\n });\n\n agents\n .command(\"preview-import\")\n .description(\n \"Validate an agent_definition payload without creating any agent. \" +\n \"Reports step/schedule/alert/criteria/policy counts and any unresolved_refs \" +\n \"(workflow refs to KBs, memory banks, source connections, or sub-agents \" +\n \"that don't exist in this account).\",\n )\n .option(\"--json <json>\", \"Inline JSON body ({ agent_definition: ... }). Use '-' for stdin.\")\n .option(\"--json-file <path>\", \"JSON file path. Use '-' for stdin.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.previewImportAgent(body as any));\n });\n });\n\n // --- Input uploads ---\n\n agents\n .command(\"upload-input\")\n .description(\"Upload a file as agent input.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .requiredOption(\"--file <path>\", \"File to upload.\")\n .option(\"--file-name <name>\", \"Override filename.\")\n .option(\"--mime-type <type>\", \"MIME type.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const { readFile } = await import(\"node:fs/promises\");\n const bytes = new Uint8Array(await readFile(opts.file));\n const o: Record<string, unknown> = { file: bytes };\n if (opts.fileName) o.fileName = opts.fileName;\n if (opts.mimeType) o.mimeType = opts.mimeType;\n printJson(rt, await client.uploadAgentInput(agentId, o as any));\n });\n });\n\n agents\n .command(\"input-status\")\n .description(\"Check agent input upload status.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .argument(\"<uploadId>\", \"Upload ID.\")\n .action(async (agentId: string, uploadId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentInputUploadStatus(agentId, uploadId));\n });\n });\n\n agents\n .command(\"attachment-references\")\n .description(\n \"Show which files (if any) an agent's templates expect on a run. \" +\n \"Call before staging uploads: requires_uploads reports whether the agent accepts files, \" +\n \"and the agent block lists the exact names / indexes / patterns a run-time batch must satisfy.\",\n )\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentAttachmentReferences(agentId));\n });\n });\n\n // --- AI Assistant ---\n\n const ai = agents.command(\"ai\").description(\"Agent AI assistant.\");\n\n withAiInputOptions(\n ai.command(\"gen-steps\")\n .description(\"Generate agent steps via AI.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n ).action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateAgentSteps(agentId, body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"step-config\")\n .description(\"Generate step config via AI.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n ).action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateStepConfig(agentId, body as any));\n });\n });\n\n withOffsetListOptions(\n ai\n .command(\"history\")\n .description(\"Get agent AI conversation history for one step type.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .requiredOption(\n \"--step-type <type>\",\n \"Step type to read history for (e.g. llm). Required by the API.\",\n )\n .option(\"--step-id <id>\", \"Restrict to a single step.\"),\n ).action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.getAgentAiConversationHistory>[1] = {\n ...offsetListOpts(opts),\n stepType: opts.stepType,\n };\n if (opts.stepId !== undefined) o.stepId = opts.stepId;\n printJson(rt, await client.getAgentAiConversationHistory(agentId, o));\n });\n });\n\n ai.command(\"mark\")\n .description(\"Mark an AI suggestion (accept/reject).\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Mark body JSON.\")\n .option(\"--json-file <path>\", \"Mark body JSON file.\")\n .action(async (agentId: string, conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n await client.markAgentAiSuggestion(agentId, conversationId, body as any);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Run eval results (under runs) ---\n\n runs\n .command(\"eval-results\")\n .description(\"List evaluation results for a run.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .argument(\"<runId>\", \"Run ID.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .action(async (agentId: string, runId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listRunEvaluationResults(agentId, runId, listOpts(opts)));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport {\n run,\n createClient,\n printJson,\n readJsonInput,\n buildUploadOpts,\n withFileUploadOptions,\n listOpts,\n} from \"../helpers.js\";\n\n/** Register `sources` commands: CRUD, file/text upload, exports, embedding migration. */\nexport function register(program: Command, rt: CliRuntime): void {\n const sources = program\n .command(\"sources\")\n .alias(\"source\")\n .description(\"Manage content sources.\");\n\n // --- CRUD ---\n\n sources\n .command(\"list\")\n .description(\"List sources.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\")\n .option(\"--account-id <id>\", \"Filter by account ID.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const client = createClient(globalOpts);\n const o: Record<string, unknown> = listOpts(opts);\n const acctId = opts.accountId || globalOpts.accountId;\n if (acctId) o.accountId = acctId;\n printJson(rt, await client.listSources(o));\n });\n });\n\n sources\n .command(\"create\")\n .description(\"Create a source.\")\n .option(\"--json <json>\", \"Source body JSON.\")\n .option(\"--json-file <path>\", \"Source body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createSource(body as any));\n });\n });\n\n sources\n .command(\"get\")\n .description(\"Get a source by ID.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getSource(sourceId));\n });\n });\n\n sources\n .command(\"update\")\n .description(\"Update a source.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateSource(sourceId, body as any));\n });\n });\n\n sources\n .command(\"delete\")\n .description(\"Delete a source.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteSource(sourceId);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Upload ---\n\n const uploadCmd = sources.command(\"upload\").description(\"Upload a file to a source.\");\n withFileUploadOptions(uploadCmd)\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const uploadOpts = await buildUploadOpts(rt, opts);\n printJson(rt, await client.uploadFileToSource(sourceId, uploadOpts));\n });\n });\n\n sources\n .command(\"upload-text\")\n .description(\"Upload inline text to a source.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Inline text body JSON.\")\n .option(\"--json-file <path>\", \"Inline text body JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.uploadInlineTextToSource(sourceId, body as any));\n });\n });\n\n // --- Exports ---\n\n const exports_ = sources.command(\"exports\").description(\"Manage source exports.\");\n\n exports_\n .command(\"list\")\n .description(\"List exports for a source.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listSourceExports(sourceId, listOpts(opts)));\n });\n });\n\n exports_\n .command(\"create\")\n .description(\"Create an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Export body JSON.\")\n .option(\"--json-file <path>\", \"Export body JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createSourceExport(sourceId, body as any));\n });\n });\n\n exports_\n .command(\"get\")\n .description(\"Get an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .argument(\"<exportId>\", \"Export ID.\")\n .action(async (sourceId: string, exportId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getSourceExport(sourceId, exportId));\n });\n });\n\n exports_\n .command(\"cancel\")\n .description(\"Cancel an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .argument(\"<exportId>\", \"Export ID.\")\n .action(async (sourceId: string, exportId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.cancelSourceExport(sourceId, exportId));\n });\n });\n\n exports_\n .command(\"delete\")\n .description(\"Delete an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .argument(\"<exportId>\", \"Export ID.\")\n .action(async (sourceId: string, exportId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteSourceExport(sourceId, exportId);\n printJson(rt, { ok: true });\n });\n });\n\n exports_\n .command(\"download\")\n .description(\"Download an export (prints raw response body).\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .argument(\"<exportId>\", \"Export ID.\")\n .action(async (sourceId: string, exportId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const res = await client.downloadSourceExport(sourceId, exportId);\n rt.writeOut(await res.text());\n });\n });\n\n exports_\n .command(\"estimate\")\n .description(\"Estimate an export.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Estimate body JSON.\")\n .option(\"--json-file <path>\", \"Estimate body JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.estimateSourceExport(sourceId, body as any));\n });\n });\n\n // --- Embedding Migration ---\n\n const migration = sources.command(\"migration\").description(\"Source embedding migrations.\");\n\n migration\n .command(\"get\")\n .description(\"Get migration status.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getSourceEmbeddingMigration(sourceId));\n });\n });\n\n migration\n .command(\"start\")\n .description(\"Start an embedding migration.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .option(\"--json <json>\", \"Migration config JSON.\")\n .option(\"--json-file <path>\", \"Migration config JSON file.\")\n .action(async (sourceId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.startSourceEmbeddingMigration(sourceId, body as any));\n });\n });\n\n migration\n .command(\"cancel\")\n .description(\"Cancel an embedding migration.\")\n .argument(\"<sourceId>\", \"Source ID.\")\n .action(async (sourceId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.cancelSourceEmbeddingMigration(sourceId));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport {\n run,\n createClient,\n printJson,\n readJsonInput,\n buildUploadOpts,\n withFileUploadOptions,\n listOpts,\n} from \"../helpers.js\";\n\n/** Register `contents` commands: get, delete, upload/replace, replace-text, embeddings. */\nexport function register(program: Command, rt: CliRuntime): void {\n const contents = program\n .command(\"contents\")\n .description(\"Manage indexed content and embeddings.\");\n\n contents\n .command(\"get\")\n .description(\"Get content version details.\")\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .option(\"--start <n>\", \"Text start offset (0-based).\", (v: string) => Number(v))\n .option(\"--end <n>\", \"Text end offset (exclusive).\", (v: string) => Number(v))\n .action(async (contentVersionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Record<string, unknown> = {};\n if (opts.start !== undefined) o.start = opts.start;\n if (opts.end !== undefined) o.end = opts.end;\n printJson(rt, await client.getContentDetail(contentVersionId, o));\n });\n });\n\n contents\n .command(\"delete\")\n .description(\"Delete a content version.\")\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .action(async (contentVersionId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteContent(contentVersionId);\n printJson(rt, { ok: true });\n });\n });\n\n const uploadCmd = contents.command(\"upload\").alias(\"replace\").description(\"Upload/replace content file.\");\n withFileUploadOptions(uploadCmd)\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .action(async (contentVersionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const uploadOpts = await buildUploadOpts(rt, opts);\n printJson(rt, await client.uploadFileToContent(contentVersionId, uploadOpts));\n });\n });\n\n contents\n .command(\"replace-text\")\n .description(\"Replace content with inline text.\")\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .option(\"--json <json>\", \"Inline text body JSON.\")\n .option(\"--json-file <path>\", \"Inline text body JSON file.\")\n .action(async (contentVersionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.replaceContentWithInlineText(contentVersionId, body as any));\n });\n });\n\n contents\n .command(\"embeddings\")\n .description(\"List embeddings for a content version.\")\n .argument(\"<contentVersionId>\", \"Content version ID.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .action(async (contentVersionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listContentEmbeddings(contentVersionId, listOpts(opts)));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, listOpts } from \"../helpers.js\";\n\n/** Register `kb` (knowledge base) commands: list, create, get, update, delete. */\nexport function register(program: Command, rt: CliRuntime): void {\n const kb = program.command(\"kb\").description(\"Manage knowledge bases.\");\n\n kb.command(\"list\")\n .description(\"List knowledge bases.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listKnowledgeBases(listOpts(opts)));\n });\n });\n\n kb.command(\"create\")\n .description(\"Create a knowledge base.\")\n .option(\"--json <json>\", \"Body JSON.\")\n .option(\"--json-file <path>\", \"Body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createKnowledgeBase(body as any));\n });\n });\n\n kb.command(\"get\")\n .description(\"Get a knowledge base.\")\n .argument(\"<kbId>\", \"Knowledge base ID.\")\n .action(async (kbId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getKnowledgeBase(kbId));\n });\n });\n\n kb.command(\"update\")\n .description(\"Update a knowledge base.\")\n .argument(\"<kbId>\", \"Knowledge base ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (kbId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateKnowledgeBase(kbId, body as any));\n });\n });\n\n kb.command(\"delete\")\n .description(\"Delete a knowledge base.\")\n .argument(\"<kbId>\", \"Knowledge base ID.\")\n .action(async (kbId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteKnowledgeBase(kbId);\n printJson(rt, { ok: true });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, readAiInput, withAiInputOptions, readJsonObjectInput, listOpts } from \"../helpers.js\";\n\n/** Register `memory` commands: CRUD, stats, utilities, test-compaction, AI assistant. */\nexport function register(program: Command, rt: CliRuntime): void {\n const memory = program.command(\"memory\").description(\"Manage memory banks.\");\n\n // --- CRUD ---\n\n memory\n .command(\"list\")\n .description(\"List memory banks.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listMemoryBanks(listOpts(opts)));\n });\n });\n\n memory\n .command(\"create\")\n .description(\"Create a memory bank.\")\n .option(\"--json <json>\", \"Body JSON.\")\n .option(\"--json-file <path>\", \"Body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createMemoryBank(body as any));\n });\n });\n\n memory\n .command(\"get\")\n .description(\"Get a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getMemoryBank(memoryBankId));\n });\n });\n\n memory\n .command(\"update\")\n .description(\"Update a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (memoryBankId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateMemoryBank(memoryBankId, body as any));\n });\n });\n\n memory\n .command(\"delete\")\n .description(\"Delete a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteMemoryBank(memoryBankId);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Stats & utilities ---\n\n memory\n .command(\"stats\")\n .description(\"Get memory bank statistics.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getMemoryBankStats(memoryBankId));\n });\n });\n\n memory\n .command(\"agents\")\n .description(\"List agents using a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAgentsUsingMemoryBank(memoryBankId));\n });\n });\n\n memory\n .command(\"compact\")\n .description(\"Compact a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.compactMemoryBank(memoryBankId);\n printJson(rt, { ok: true });\n });\n });\n\n memory\n .command(\"delete-source\")\n .description(\"Delete a memory bank's source data.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .action(async (memoryBankId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteMemoryBankSource(memoryBankId);\n printJson(rt, { ok: true });\n });\n });\n\n memory\n .command(\"templates\")\n .description(\"List memory bank templates.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listMemoryBankTemplates());\n });\n });\n\n memory\n .command(\"test-compaction\")\n .description(\"Test compaction on a memory bank.\")\n .argument(\"<memoryBankId>\", \"Memory bank ID.\")\n .option(\"--json <json>\", \"Test config JSON.\")\n .option(\"--json-file <path>\", \"Test config JSON file.\")\n .action(async (memoryBankId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.testMemoryBankCompaction(memoryBankId, body as any));\n });\n });\n\n memory\n .command(\"test-compaction-standalone\")\n .description(\"Test compaction prompt standalone (no memory bank required).\")\n .option(\"--json <json>\", \"Test config JSON.\")\n .option(\"--json-file <path>\", \"Test config JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.testCompactionPromptStandalone(body as any));\n });\n });\n\n // --- AI ---\n\n const ai = memory.command(\"ai\").description(\"Memory bank AI assistant.\");\n\n withAiInputOptions(\n ai.command(\"generate\")\n .description(\"Generate memory bank config via AI.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateMemoryBankConfig(body as any));\n });\n });\n\n ai.command(\"last\")\n .description(\"Get last memory bank AI conversation.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getMemoryBankAiLastConversation());\n });\n });\n\n ai.command(\"accept\")\n .description(\"Accept a memory bank AI suggestion.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Accept body JSON.\")\n .option(\"--json-file <path>\", \"Accept body JSON file.\")\n .action(async (conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.acceptMemoryBankAiSuggestion(conversationId, body as any));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, listOpts, parseNumber } from \"../helpers.js\";\n\n/** Register `evals` commands: criteria CRUD, results, compatible-runs, test-draft, agent-level summaries. */\nexport function register(program: Command, rt: CliRuntime): void {\n const evals = program.command(\"evals\").description(\"Manage evaluations.\");\n\n // --- Criteria ---\n\n const criteria = evals.command(\"criteria\").description(\"Evaluation criteria.\");\n\n criteria\n .command(\"list\")\n .description(\"List evaluation criteria for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .option(\n \"--paged\",\n \"Wrap the results in {data: [...]} instead of returning a bare array. The pagination block is included once the API sends one, from --api-version 2026-07-27.\",\n )\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n // The endpoint answers with a bare array by default and the envelope\n // once the account opts in. --paged normalises the array into {data},\n // so `.data` is a stable path to read either way — but nothing is\n // invented: `pagination` appears only when the API actually sent it.\n printJson(\n rt,\n opts.paged\n ? await client.listEvaluationCriteriaPage(agentId, listOpts(opts))\n : await client.listEvaluationCriteria(agentId, listOpts(opts)),\n );\n });\n });\n\n criteria\n .command(\"create\")\n .description(\"Create evaluation criteria.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Criteria body JSON.\")\n .option(\"--json-file <path>\", \"Criteria body JSON file.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createEvaluationCriteria(agentId, body as any));\n });\n });\n\n criteria\n .command(\"get\")\n .description(\"Get evaluation criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .action(async (criteriaId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getEvaluationCriteria(criteriaId));\n });\n });\n\n criteria\n .command(\"update\")\n .description(\"Update evaluation criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (criteriaId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateEvaluationCriteria(criteriaId, body as any));\n });\n });\n\n criteria\n .command(\"delete\")\n .description(\"Delete evaluation criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .action(async (criteriaId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteEvaluationCriteria(criteriaId);\n printJson(rt, { ok: true });\n });\n });\n\n criteria\n .command(\"summary\")\n .description(\"Get criteria evaluation summary.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .action(async (criteriaId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getEvaluationCriteriaSummary(criteriaId));\n });\n });\n\n // --- Results ---\n\n const results = evals.command(\"results\").description(\"Evaluation results.\");\n\n results\n .command(\"list\")\n .description(\"List results for criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .action(async (criteriaId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listEvaluationResults(criteriaId, listOpts(opts)));\n });\n });\n\n results\n .command(\"create\")\n .description(\"Create an evaluation result.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .option(\"--json <json>\", \"Result body JSON.\")\n .option(\"--json-file <path>\", \"Result body JSON file.\")\n .action(async (criteriaId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createEvaluationResult(criteriaId, body as any));\n });\n });\n\n // --- Misc ---\n\n evals\n .command(\"compatible-runs\")\n .description(\"List runs compatible with criteria.\")\n .argument(\"<criteriaId>\", \"Criteria ID.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .action(async (criteriaId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listCompatibleRuns(criteriaId, listOpts(opts)));\n });\n });\n\n evals\n .command(\"test-draft\")\n .description(\"Test a draft evaluation.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--json <json>\", \"Test body JSON.\")\n .option(\"--json-file <path>\", \"Test body JSON file.\")\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.testDraftEvaluation(agentId, body as any));\n });\n });\n\n evals\n .command(\"agent-results\")\n .description(\"List all evaluation results for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listAgentEvaluationResults(agentId, listOpts(opts)));\n });\n });\n\n evals\n .command(\"agent-runs\")\n .description(\"List evaluation run summaries for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .action(async (agentId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listEvaluationRuns(agentId, listOpts(opts)));\n });\n });\n\n evals\n .command(\"non-manual-summary\")\n .description(\"Get non-manual evaluation summary for an agent.\")\n .argument(\"<agentId>\", \"Agent ID.\")\n .action(async (agentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getNonManualEvaluationSummary(agentId));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, readAiInput, withAiInputOptions, listOpts } from \"../helpers.js\";\n\n/** Register `solutions` commands: CRUD, link/unlink, conversations, AI assistant. */\nexport function register(program: Command, rt: CliRuntime): void {\n const solutions = program.command(\"solutions\").description(\"Manage solutions.\");\n\n // --- CRUD ---\n\n solutions\n .command(\"list\")\n .description(\"List solutions.\")\n .option(\"--page <n>\", \"Page number.\", (v: string) => Number(v))\n .option(\"--limit <n>\", \"Page size.\", (v: string) => Number(v))\n .option(\"--sort <field>\", \"Sort field.\")\n .option(\"--order <asc|desc>\", \"Sort direction.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listSolutions(listOpts(opts)));\n });\n });\n\n solutions\n .command(\"create\")\n .description(\"Create a solution.\")\n .option(\"--json <json>\", \"Body JSON.\")\n .option(\"--json-file <path>\", \"Body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createSolution(body as any));\n });\n });\n\n solutions\n .command(\"get\")\n .description(\"Get a solution.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .action(async (solutionId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getSolution(solutionId));\n });\n });\n\n solutions\n .command(\"update\")\n .description(\"Update a solution.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateSolution(solutionId, body as any));\n });\n });\n\n solutions\n .command(\"delete\")\n .description(\"Delete a solution.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .action(async (solutionId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteSolution(solutionId);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Link / Unlink ---\n\n solutions\n .command(\"link\")\n .description(\"Link resources to a solution. Use --agents, --kb, or --sources with JSON array of IDs.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .option(\"--agents <json>\", \"Link agents (JSON body).\")\n .option(\"--kb <json>\", \"Link knowledge bases (JSON body).\")\n .option(\"--sources <json>\", \"Link sources (JSON body).\")\n .action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n if (!opts.agents && !opts.kb && !opts.sources) {\n rt.writeErr(\"Provide at least one of --agents, --kb, or --sources.\\n\");\n rt.setExitCode(1);\n return;\n }\n const client = createClient(program.opts<GlobalOptions>());\n const results: Record<string, unknown> = {};\n if (opts.agents) {\n results.agents = await client.linkAgentsToSolution(solutionId, JSON.parse(opts.agents));\n }\n if (opts.kb) {\n results.knowledgeBases = await client.linkKnowledgeBasesToSolution(solutionId, JSON.parse(opts.kb));\n }\n if (opts.sources) {\n results.sources = await client.linkSourceConnectionsToSolution(solutionId, JSON.parse(opts.sources));\n }\n printJson(rt, results);\n });\n });\n\n solutions\n .command(\"unlink\")\n .description(\"Unlink resources from a solution. Use --agents, --kb, or --sources with JSON array of IDs.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .option(\"--agents <json>\", \"Unlink agents (JSON body).\")\n .option(\"--kb <json>\", \"Unlink knowledge bases (JSON body).\")\n .option(\"--sources <json>\", \"Unlink sources (JSON body).\")\n .action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n if (!opts.agents && !opts.kb && !opts.sources) {\n rt.writeErr(\"Provide at least one of --agents, --kb, or --sources.\\n\");\n rt.setExitCode(1);\n return;\n }\n const client = createClient(program.opts<GlobalOptions>());\n const results: Record<string, unknown> = {};\n if (opts.agents) {\n results.agents = await client.unlinkAgentsFromSolution(solutionId, JSON.parse(opts.agents));\n }\n if (opts.kb) {\n results.knowledgeBases = await client.unlinkKnowledgeBasesFromSolution(solutionId, JSON.parse(opts.kb));\n }\n if (opts.sources) {\n results.sources = await client.unlinkSourceConnectionsFromSolution(solutionId, JSON.parse(opts.sources));\n }\n printJson(rt, results);\n });\n });\n\n // --- Conversations ---\n\n const convos = solutions.command(\"convos\").description(\"Solution conversations.\");\n\n convos\n .command(\"list\")\n .description(\"List conversations for a solution.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .action(async (solutionId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listSolutionConversations(solutionId));\n });\n });\n\n convos\n .command(\"add\")\n .description(\"Add a conversation turn.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .option(\"--json <json>\", \"Turn body JSON.\")\n .option(\"--json-file <path>\", \"Turn body JSON file.\")\n .action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.addSolutionConversationTurn(solutionId, body as any));\n });\n });\n\n convos\n .command(\"mark\")\n .description(\"Mark a conversation turn.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Mark body JSON.\")\n .option(\"--json-file <path>\", \"Mark body JSON file.\")\n .action(async (solutionId: string, conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n await client.markSolutionConversationTurn(solutionId, conversationId, body as any);\n printJson(rt, { ok: true });\n });\n });\n\n // --- AI ---\n\n const ai = solutions.command(\"ai\").description(\"Solution AI assistant.\");\n\n withAiInputOptions(\n ai.command(\"generate\")\n .description(\"Generate a solution AI plan.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n ).action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateSolutionAiPlan(solutionId, body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"kb\")\n .description(\"Generate a KB plan via solution AI.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n ).action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateSolutionAiKnowledgeBase(solutionId, body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"source\")\n .description(\"Generate a source plan via solution AI.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n ).action(async (solutionId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateSolutionAiSource(solutionId, body as any));\n });\n });\n\n ai.command(\"accept\")\n .description(\"Accept a solution AI plan.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Accept body JSON.\")\n .option(\"--json-file <path>\", \"Accept body JSON file.\")\n .action(async (solutionId: string, conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.acceptSolutionAiPlan(solutionId, conversationId, body as any));\n });\n });\n\n ai.command(\"decline\")\n .description(\"Decline a solution AI plan.\")\n .argument(\"<solutionId>\", \"Solution ID.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .action(async (solutionId: string, conversationId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.declineSolutionAiPlan(solutionId, conversationId);\n printJson(rt, { ok: true });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readAiInput, withAiInputOptions } from \"../helpers.js\";\n\n/** Register `governance` commands: AI-assisted generate, list, accept, decline. */\nexport function register(program: Command, rt: CliRuntime): void {\n const governance = program.command(\"governance\").description(\"Governance AI assistant.\");\n\n const ai = governance.command(\"ai\").description(\"Governance AI operations.\");\n\n withAiInputOptions(\n ai.command(\"generate\")\n .description(\"Generate a governance AI plan.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.generateGovernanceAiPlan(body as any));\n });\n });\n\n ai.command(\"list\")\n .description(\"List governance AI conversations.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listGovernanceAiConversations());\n });\n });\n\n ai.command(\"accept\")\n .description(\"Accept a governance AI plan.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .action(async (conversationId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.acceptGovernanceAiPlan(conversationId));\n });\n });\n\n ai.command(\"decline\")\n .description(\"Decline a governance AI plan.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .action(async (conversationId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.declineGovernanceAiPlan(conversationId);\n printJson(rt, { ok: true });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport {\n run,\n createClient,\n printJson,\n readJsonInput,\n listOpts,\n parseNumber,\n warnDeprecated,\n} from \"../helpers.js\";\n\n/** Register `alerts` commands: alert CRUD, configs, organization preferences. */\nexport function register(program: Command, rt: CliRuntime): void {\n const alerts = program.command(\"alerts\").description(\"Manage alerts and alert configurations.\");\n\n // --- Alert CRUD ---\n\n alerts\n .command(\"list\")\n .description(\"List alerts.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .option(\"--status <status>\", \"Filter by status.\")\n .option(\n \"--severity <severity>\",\n \"Deprecated and ignored — GET /alerts declares no severity filter. Filter with jq instead.\",\n )\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Record<string, unknown> = listOpts(opts);\n if (opts.status) o.status = opts.status;\n if (opts.severity !== undefined) {\n // Accepted so existing invocations keep parsing, but not sent: the\n // endpoint declares no such parameter, so it never filtered, and it\n // becomes a 422 once --api-version is 2026-07-27 or later. Dropping\n // it here returns the same rows as before, minus the future 422.\n warnDeprecated(\n rt,\n \"'alerts list --severity' is ignored — the API has no severity filter, so it never \" +\n \"filtered anything. Filter client-side, e.g. | jq '[.data[] | select(.severity == \\\"high\\\")]'.\",\n );\n }\n printJson(rt, await client.listAlerts(o));\n });\n });\n\n alerts\n .command(\"get\")\n .description(\"Get an alert.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .action(async (alertId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAlert(alertId));\n });\n });\n\n alerts\n .command(\"status\")\n .description(\"Change alert status.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .option(\"--json <json>\", \"Status body JSON.\")\n .option(\"--json-file <path>\", \"Status body JSON file.\")\n .action(async (alertId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.changeAlertStatus(alertId, body as any));\n });\n });\n\n alerts\n .command(\"comment\")\n .description(\"Add a comment to an alert.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .option(\"--json <json>\", \"Comment body JSON.\")\n .option(\"--json-file <path>\", \"Comment body JSON file.\")\n .action(async (alertId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.addAlertComment(alertId, body as any));\n });\n });\n\n alerts\n .command(\"subscribe\")\n .description(\"Subscribe to an alert.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .action(async (alertId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.subscribeToAlert(alertId));\n });\n });\n\n alerts\n .command(\"unsubscribe\")\n .description(\"Unsubscribe from an alert.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .action(async (alertId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.unsubscribeFromAlert(alertId));\n });\n });\n\n // --- Alert Configs ---\n\n const configs = alerts.command(\"configs\").description(\"Alert configurations.\");\n\n configs\n .command(\"list\")\n .description(\"List alert configurations.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listAlertConfigs(listOpts(opts)));\n });\n });\n\n configs\n .command(\"create\")\n .description(\"Create an alert configuration.\")\n .option(\"--json <json>\", \"Config body JSON.\")\n .option(\"--json-file <path>\", \"Config body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createAlertConfig(body as any));\n });\n });\n\n configs\n .command(\"get\")\n .description(\"Get an alert configuration.\")\n .argument(\"<configId>\", \"Config ID.\")\n .action(async (configId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAlertConfig(configId));\n });\n });\n\n configs\n .command(\"update\")\n .description(\"Update an alert configuration.\")\n .argument(\"<configId>\", \"Config ID.\")\n .option(\"--json <json>\", \"Update body JSON.\")\n .option(\"--json-file <path>\", \"Update body JSON file.\")\n .action(async (configId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateAlertConfig(configId, body as any));\n });\n });\n\n configs\n .command(\"delete\")\n .description(\"Delete an alert configuration.\")\n .argument(\"<configId>\", \"Config ID.\")\n .action(async (configId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteAlertConfig(configId);\n printJson(rt, { ok: true });\n });\n });\n\n // --- Organization Alert Preferences ---\n\n const prefs = alerts.command(\"prefs\").description(\"Organization alert preferences.\");\n\n prefs\n .command(\"list\")\n .description(\"List organization alert preferences.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listOrganizationAlertPreferences());\n });\n });\n\n prefs\n .command(\"update\")\n .description(\"Update an organization alert preference.\")\n .argument(\"<organizationId>\", \"Organization ID.\")\n .argument(\"<alertType>\", \"Alert type.\")\n .option(\"--json <json>\", \"Preference body JSON.\")\n .option(\"--json-file <path>\", \"Preference body JSON file.\")\n .action(async (organizationId: string, alertType: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.updateOrganizationAlertPreference(organizationId, alertType, body as any));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport {\n run,\n createClient,\n printJson,\n withOffsetListOptions,\n offsetListOpts,\n parseNumber,\n} from \"../helpers.js\";\n\n/** Register `email` commands: sending domains, inbound blocklist, inbound health, and agent opt-outs. */\nexport function register(program: Command, rt: CliRuntime): void {\n const email = program\n .command(\"email\")\n .description(\"Agent email: sending domains, inbound blocklist, inbound health, and opt-outs.\");\n\n // --- Domains ---\n\n const domains = email.command(\"domains\").description(\"Agent-email sending domains.\");\n\n domains\n .command(\"list\")\n .description(\"List the account's email domains and the plan limits for adding more.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listEmailDomains());\n });\n });\n\n domains\n .command(\"add\")\n .description(\"Add and provision a new agent-email domain. Returns the DNS records to publish.\")\n .requiredOption(\"--kind <kind>\", \"'vanity' (a subdomain of seclai.com) or 'custom' (your own domain).\")\n .requiredOption(\"--value <domain>\", \"The domain to add.\")\n .option(\"--delegated\", \"The domain's DNS is delegated to Seclai, so records are published automatically.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body: Parameters<typeof client.addEmailDomain>[0] = {\n kind: opts.kind,\n value: opts.value,\n };\n if (opts.delegated) body.delegated = true;\n printJson(rt, await client.addEmailDomain(body));\n });\n });\n\n domains\n .command(\"remove\")\n .description(\"Remove a domain and tear down its sending identity and inbound routing.\")\n .argument(\"<domainId>\", \"Domain ID.\")\n .action(async (domainId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.removeEmailDomain(domainId));\n });\n });\n\n domains\n .command(\"verify\")\n .description(\"Run a verification check on a domain immediately.\")\n .argument(\"<domainId>\", \"Domain ID.\")\n .action(async (domainId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.verifyEmailDomain(domainId));\n });\n });\n\n domains\n .command(\"set-primary\")\n .description(\"Promote a verified domain to the account's primary sending domain.\")\n .argument(\"<domainId>\", \"Domain ID.\")\n .action(async (domainId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.setPrimaryEmailDomain(domainId));\n });\n });\n\n domains\n .command(\"use-shared\")\n .description(\"Revert to the shared agent.seclai.com sending and inbound domain.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.useSharedEmailDomain();\n printJson(rt, { ok: true });\n });\n });\n\n domains\n .command(\"test-email\")\n .description(\"Send a test message from a verified domain to the account owner.\")\n .argument(\"<domainId>\", \"Domain ID.\")\n .action(async (domainId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.sendEmailDomainTestEmail(domainId));\n });\n });\n\n domains\n .command(\"dmarc\")\n .description(\"Get the DMARC aggregate-report summary for a domain.\")\n .argument(\"<domainId>\", \"Domain ID.\")\n .option(\"--days <n>\", \"Reporting window in days.\", parseNumber)\n .option(\"--top-sources <n>\", \"How many sending sources to include.\", parseNumber)\n .action(async (domainId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.getDmarcSummary>[1] = {};\n if (opts.days !== undefined) o.days = opts.days;\n if (opts.topSources !== undefined) o.topSources = opts.topSources;\n printJson(rt, await client.getDmarcSummary(domainId, o));\n });\n });\n\n // --- Blocked senders ---\n\n const blocked = email.command(\"blocked\").description(\"Inbound email sender blocklist.\");\n\n withOffsetListOptions(\n blocked\n .command(\"list\")\n .description(\"List blocked inbound senders (newest first) and the account's auto-block mode.\"),\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listBlockedEmailSenders(offsetListOpts(opts)));\n });\n });\n\n blocked\n .command(\"add\")\n .description(\"Block an inbound sender address or domain.\")\n .requiredOption(\"--sender-email <email>\", \"Sender address, or the domain when --match-type is 'domain'.\")\n .option(\"--match-type <type>\", \"'address' or 'domain'.\", \"address\")\n .option(\"--note <text>\", \"Why the sender was blocked.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n // match_type is optional to the API (it defaults to \"address\") but the\n // generated request type marks it required, because declaring a default\n // is what makes a property required in the schema. Send the schema's\n // own default rather than work around the type.\n const body: Parameters<typeof client.blockEmailSender>[0] = {\n sender_email: opts.senderEmail,\n match_type: opts.matchType,\n };\n if (opts.note !== undefined) body.note = opts.note;\n printJson(rt, await client.blockEmailSender(body));\n });\n });\n\n blocked\n .command(\"remove\")\n .description(\"Unblock a sender.\")\n .argument(\"<blockedId>\", \"Blocklist entry ID.\")\n .action(async (blockedId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.unblockEmailSender(blockedId);\n printJson(rt, { ok: true });\n });\n });\n\n blocked\n .command(\"auto-block-mode\")\n .description(\"Set whether a governance BLOCK on an authenticated sender auto-adds them to the blocklist.\")\n .argument(\"<mode>\", \"One of 'disabled', 'input', or 'input_and_output'.\")\n .action(async (mode: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.setAutoBlockMode({ mode }));\n });\n });\n\n // --- Inbound health ---\n\n const inbound = email.command(\"inbound\").description(\"Inbound email health and queue control.\");\n\n inbound\n .command(\"status\")\n .description(\"Get inbound-email quota usage, pause state, and queued-run counts.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getInboundEmailStatus());\n });\n });\n\n inbound\n .command(\"rejections\")\n .description(\"List recently rejected inbound emails and why they were rejected.\")\n .option(\"--agent-id <id>\", \"Restrict to one agent.\")\n .option(\"--limit <n>\", \"Maximum rejections to return.\", parseNumber)\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.listInboundEmailRejections>[0] = {};\n if (opts.agentId !== undefined) o.agentId = opts.agentId;\n if (opts.limit !== undefined) o.limit = opts.limit;\n printJson(rt, await client.listInboundEmailRejections(o));\n });\n });\n\n inbound\n .command(\"cancel-queued\")\n .description(\"Fail all of the account's queued (over-quota) inbound-email runs at once.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.cancelQueuedEmailRuns());\n });\n });\n\n inbound\n .command(\"resume\")\n .description(\"Manually lift the account-wide inbound-email pause.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.resumeInboundEmail());\n });\n });\n\n // --- Opt-outs ---\n\n const optouts = email.command(\"optouts\").description(\"Recipients who opted out of agent email.\");\n\n withOffsetListOptions(\n optouts\n .command(\"list\")\n .description(\"List agent-email opt-outs.\")\n .option(\"--agent-id <id>\", \"Restrict to one agent.\"),\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.listAgentEmailOptOuts>[0] = offsetListOpts(opts);\n if (opts.agentId !== undefined) o.agentId = opts.agentId;\n printJson(rt, await client.listAgentEmailOptOuts(o));\n });\n });\n\n optouts\n .command(\"remove\")\n .description(\"Remove an opt-out so the recipient can receive agent email again.\")\n .argument(\"<optoutId>\", \"Opt-out ID.\")\n .action(async (optoutId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.removeAgentEmailOptOut(optoutId);\n printJson(rt, { ok: true });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson } from \"../helpers.js\";\n\n/** Register account-level commands: `me` and the dated API version pin. */\nexport function register(program: Command, rt: CliRuntime): void {\n program\n .command(\"me\")\n .description(\"Show the authenticated user's account ID and organization memberships.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getMe());\n });\n });\n\n const version = program\n .command(\"api-version\")\n .description(\"Read or pin the account's dated API version.\");\n\n version\n .command(\"get\")\n .description(\n \"Show the version a request resolves to. Reflects --api-version when passed, \" +\n \"otherwise the account pin, otherwise the default.\",\n )\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getApiVersion());\n });\n });\n\n version\n .command(\"set\")\n .description(\"Pin the account to a dated API version. Affects every client, not just this CLI.\")\n .argument(\"<date>\", \"API version as YYYY-MM-DD.\")\n .action(async (date: string) => {\n await run(rt, async () => {\n // The pin is account-wide and persistent, and nothing re-checks it\n // afterwards: the CLI sends no version header of its own, so the SDK's\n // unknown-version guard — which only inspects the header it sends —\n // never sees it. A typo here would silently reshape responses for every\n // client on the account, so the shape is checked before the request.\n if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(date)) {\n throw new Error(`Expected an API version as YYYY-MM-DD, got \"${date}\".`);\n }\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.updateApiVersion(date));\n });\n });\n\n version\n .command(\"clear\")\n .description(\"Remove the account's version pin, reverting to the default version.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.updateApiVersion(null));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport {\n run,\n createClient,\n printJson,\n listOpts,\n withJsonInputOptions,\n readJsonInput,\n withOffsetListOptions,\n offsetListOpts,\n parseNumber,\n} from \"../helpers.js\";\n\n/** Register `models` commands: list, get, alerts, recommendations, playground experiments. */\nexport function register(program: Command, rt: CliRuntime): void {\n const models = program.command(\"models\").description(\"Models, model alerts, recommendations, and playground experiments.\");\n\n models\n .command(\"list\")\n .description(\"List models grouped by provider.\")\n .option(\"--provider <provider>\", \"Filter by provider name.\")\n .option(\"--supports-tool-use\", \"Only models that support tool use.\")\n .option(\"--supports-thinking\", \"Only models that support thinking.\")\n .option(\"--supports-input-media <media>\", \"Only models accepting this input modality (e.g. image, audio).\")\n .option(\"--supports-output-media <media>\", \"Only models producing this output modality (e.g. image, video).\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.listModels>[0] = {};\n if (opts.provider !== undefined) o.provider = opts.provider;\n if (opts.supportsToolUse !== undefined) o.supportsToolUse = opts.supportsToolUse;\n if (opts.supportsThinking !== undefined) o.supportsThinking = opts.supportsThinking;\n if (opts.supportsInputMedia !== undefined) o.supportsInputMedia = opts.supportsInputMedia;\n if (opts.supportsOutputMedia !== undefined) o.supportsOutputMedia = opts.supportsOutputMedia;\n printJson(rt, await client.listModels(o));\n });\n });\n\n models\n .command(\"tiers\")\n .description(\"Show each media-generation modality and tier with its model and cost.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getGenerationTiers());\n });\n });\n\n models\n .command(\"get\")\n .description(\"Get full details for a specific model.\")\n .argument(\"<modelId>\", \"Model ID.\")\n .action(async (modelId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getModel(modelId));\n });\n });\n\n const alerts = models.command(\"alerts\").description(\"Model alerts.\");\n\n alerts\n .command(\"list\")\n .description(\"List model alerts.\")\n .option(\"--page <n>\", \"Page number.\", parseNumber)\n .option(\"--limit <n>\", \"Page size.\", parseNumber)\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.listModelAlerts(listOpts(opts)));\n });\n });\n\n alerts\n .command(\"mark-read\")\n .description(\"Mark a model alert as read.\")\n .argument(\"<alertId>\", \"Alert ID.\")\n .action(async (alertId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.markModelAlertRead(alertId);\n printJson(rt, { ok: true });\n });\n });\n\n alerts\n .command(\"mark-all-read\")\n .description(\"Mark all model alerts as read.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.markAllModelAlertsRead();\n printJson(rt, { ok: true });\n });\n });\n\n alerts\n .command(\"unread-count\")\n .description(\"Get unread model alert count.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getUnreadModelAlertCount());\n });\n });\n\n models\n .command(\"recommendations\")\n .description(\"Get model recommendations.\")\n .argument(\"<modelId>\", \"Model ID.\")\n .action(async (modelId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getModelRecommendations(modelId));\n });\n });\n\n // ── Playground Experiments ──────────────────────────────────────────────\n\n const experiments = models.command(\"experiments\").description(\"Model playground experiments.\");\n\n withOffsetListOptions(\n experiments\n .command(\"list\")\n .description(\"List model playground experiments.\")\n .option(\"--days <n>\", \"Filter to last N days.\", parseNumber)\n .option(\"--start-date <date>\", \"Start date (ISO 8601).\")\n .option(\"--end-date <date>\", \"End date (ISO 8601).\"),\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.listExperiments>[0] = offsetListOpts(opts);\n if (opts.days !== undefined) o.days = opts.days;\n if (opts.startDate !== undefined) o.startDate = opts.startDate;\n if (opts.endDate !== undefined) o.endDate = opts.endDate;\n printJson(rt, await client.listExperiments(o));\n });\n });\n\n withJsonInputOptions(experiments\n .command(\"create\")\n .description(\"Create a model playground experiment.\"))\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.createExperiment(body as Parameters<typeof client.createExperiment>[0]));\n });\n });\n\n experiments\n .command(\"get\")\n .description(\"Get a model playground experiment by ID.\")\n .argument(\"<experimentId>\", \"Experiment ID.\")\n .action(async (experimentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getExperiment(experimentId));\n });\n });\n\n experiments\n .command(\"cancel\")\n .description(\"Cancel a running model playground experiment.\")\n .argument(\"<experimentId>\", \"Experiment ID.\")\n .action(async (experimentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.cancelExperiment(experimentId));\n });\n });\n\n experiments\n .command(\"delete\")\n .description(\"Soft-delete a model playground experiment (preserves audit history).\")\n .argument(\"<experimentId>\", \"Experiment ID.\")\n .action(async (experimentId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.deleteExperiment(experimentId);\n printJson(rt, { ok: true });\n });\n });\n}\n","import { Command, Option } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, parseNumber } from \"../helpers.js\";\n\n/** Register the `search` command for querying across Seclai resources, and `docs search`. */\nexport function register(program: Command, rt: CliRuntime): void {\n program\n .command(\"search\")\n .description(\"Search across Seclai resources.\")\n .requiredOption(\"--query <text>\", \"Search query text.\")\n .option(\"--limit <n>\", \"Max results.\", parseNumber)\n .option(\"--entity-type <type>\", \"Filter by entity type (e.g. agent, source, knowledge_base, memory_bank).\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.search>[0] = { query: opts.query };\n if (opts.limit !== undefined) o.limit = opts.limit;\n if (opts.entityType) o.entityType = opts.entityType;\n printJson(rt, await client.search(o));\n });\n });\n\n const docs = program.command(\"docs\").description(\"Seclai documentation.\");\n\n docs\n .command(\"search\")\n .description(\"Search the Seclai documentation.\")\n .requiredOption(\"--query <text>\", \"Search query text.\")\n // The SDK types this as a closed union, so an unrecognised mode can only\n // ever be a 422. Fail the parse with the accepted values instead.\n .addOption(new Option(\"--mode <mode>\", \"Search mode.\").choices([\"keyword\", \"semantic\"]))\n .option(\"--limit <n>\", \"Max results.\", parseNumber)\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const o: Parameters<typeof client.searchDocs>[0] = { query: opts.query };\n if (opts.mode !== undefined) o.mode = opts.mode;\n if (opts.limit !== undefined) o.limit = opts.limit;\n printJson(rt, await client.searchDocs(o));\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime, GlobalOptions } from \"../helpers.js\";\nimport { run, createClient, printJson, readJsonInput, readAiInput, withAiInputOptions } from \"../helpers.js\";\n\n/** Register top-level `ai` commands: feedback, domain assistants (kb/source/solution/memory), accept/decline. */\nexport function register(program: Command, rt: CliRuntime): void {\n const ai = program.command(\"ai\").description(\"Top-level AI assistant.\");\n\n ai.command(\"feedback\")\n .description(\"Submit AI feedback.\")\n .option(\"--json <json>\", \"Feedback body JSON.\")\n .option(\"--json-file <path>\", \"Feedback body JSON file.\")\n .action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.submitAiFeedback(body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"kb\")\n .description(\"AI assistant for knowledge bases.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.aiAssistantKnowledgeBase(body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"source\")\n .description(\"AI assistant for sources.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.aiAssistantSource(body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"solution\")\n .description(\"AI assistant for solutions.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.aiAssistantSolution(body as any));\n });\n });\n\n withAiInputOptions(\n ai.command(\"memory\")\n .description(\"AI assistant for memory banks.\")\n ).action(async (opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readAiInput(rt, opts);\n printJson(rt, await client.aiAssistantMemoryBank(body as any));\n });\n });\n\n ai.command(\"memory-history\")\n .description(\"Get AI assistant memory bank conversation history.\")\n .action(async () => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n printJson(rt, await client.getAiAssistantMemoryBankHistory());\n });\n });\n\n ai.command(\"accept\")\n .description(\"Accept an AI assistant plan.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Accept body JSON.\")\n .option(\"--json-file <path>\", \"Accept body JSON file.\")\n .action(async (conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.acceptAiAssistantPlan(conversationId, body as any));\n });\n });\n\n ai.command(\"decline\")\n .description(\"Decline an AI assistant plan.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .action(async (conversationId: string) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n await client.declineAiAssistantPlan(conversationId);\n printJson(rt, { ok: true });\n });\n });\n\n ai.command(\"memory-accept\")\n .description(\"Accept an AI memory bank suggestion.\")\n .argument(\"<conversationId>\", \"Conversation ID.\")\n .option(\"--json <json>\", \"Accept body JSON.\")\n .option(\"--json-file <path>\", \"Accept body JSON file.\")\n .action(async (conversationId: string, opts) => {\n await run(rt, async () => {\n const client = createClient(program.opts<GlobalOptions>());\n const body = await readJsonInput(rt, { json: opts.json, jsonFile: opts.jsonFile });\n printJson(rt, await client.acceptAiMemoryBankSuggestion(conversationId, body as any));\n });\n });\n}\n","import { Command } from \"commander\";\nimport { existsSync, statSync } from \"node:fs\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport type { CliRuntime } from \"../helpers.js\";\nimport { run, printJson } from \"../helpers.js\";\n\n// --- Skill content ---\n\nconst SKILL_FILES: Array<{ name: string; content: string }> = [\n { name: \"SKILL.md\", content: `---\nname: seclai-cli\ndescription: >-\n Manage Seclai agents, knowledge bases, sources, memory banks, evaluations,\n solutions, governance, alerts, agent email, and models via the CLI. Use when\n working with the Seclai platform or when the user mentions Seclai CLI commands.\n---\n\n# Seclai CLI\n\nThe Seclai CLI (\\`seclai\\` / \\`npx @seclai/cli\\`) manages agents, knowledge bases,\nsources, memory banks, evaluations, solutions, governance, alerts, agent email,\nand models from the terminal.\n\nEvery command writes JSON to stdout. Pipe into \\`jq\\` for filtering. Errors go to\nstderr and set a non-zero exit code, so \\`set -e\\` scripts fail as expected.\n\n**Find the commands for a task in the map below, then read that reference file.**\nOnly this page is loaded up front; the references are read on demand.\n\n## Quick start\n\n\\`\\`\\`bash\nexport SECLAI_API_KEY=\"sk-...\"\n\nseclai agents create --json '{\"name\":\"My Agent\",\"description\":\"QA chatbot\"}'\nseclai agents ai gen-steps <agentId> --user-input \"Build a QA chatbot that uses a knowledge base\"\nseclai agents ai mark <agentId> <conversationId> --json '{\"accepted\":true}'\nseclai agents run <agentId> --json '{\"input\":\"How do I reset my password?\"}' --stream\nseclai agents runs list <agentId>\n\\`\\`\\`\n\n## Command map\n\n| Group | What it covers | Reference |\n| --- | --- | --- |\n| \\`agents\\` | Agents, runs, definitions, export/import, input uploads, triggers, agent AI | [references/agents.md](references/agents.md) |\n| \\`sources\\` \\`contents\\` \\`kb\\` \\`memory\\` | Sources and uploads, exports, embedding migration, indexed content, knowledge bases, memory banks | [references/knowledge.md](references/knowledge.md) |\n| \\`evals\\` | Evaluation criteria, results, runs, agent-level summaries | [references/evaluations.md](references/evaluations.md) |\n| \\`solutions\\` \\`governance\\` | Solutions, resource links, conversations, solution and governance AI | [references/solutions.md](references/solutions.md) |\n| \\`alerts\\` | Alerts, alert configurations, organization preferences | [references/alerts.md](references/alerts.md) |\n| \\`email\\` | Agent email: sending domains, inbound blocklist, inbound health, opt-outs | [references/email.md](references/email.md) |\n| \\`models\\` | Model catalog, generation tiers, model alerts, recommendations, playground experiments | [references/models.md](references/models.md) |\n| \\`auth\\` \\`configure\\` \\`api-version\\` \\`mcp\\` \\`skills\\` \\`completion\\` | Authentication, profiles, API version pinning, editor integration | [references/setup.md](references/setup.md) |\n| \\`ai\\` | Top-level AI assistant for knowledge bases, sources, solutions and memory | [references/ai-assistant.md](references/ai-assistant.md) |\n\nCross-cutting topics: [streaming and event modes](references/streaming.md),\n[file uploads](references/uploads.md).\n\n## Authentication\n\nTwo modes:\n\n1. **API key** — set \\`SECLAI_API_KEY\\`, or pass \\`--api-key <key>\\`.\n2. **SSO** — \\`seclai auth login\\` for browser-based OAuth2/PKCE. Tokens are cached\n locally and refreshed automatically.\n\nOverride the API host with \\`SECLAI_API_URL\\` (default \\`https://api.seclai.com\\`).\n\n## Global options\n\n\\`\\`\\`bash\n--api-key <key> # or set SECLAI_API_KEY\n--profile <name> # SSO profile (or SECLAI_PROFILE, default 'default')\n--account-id <id> # multi-org targeting (X-Account-Id header)\n--config-dir <path> # or SECLAI_CONFIG_DIR, default ~/.seclai\n--api-version <date> # or SECLAI_API_VERSION; see below\n--allow-unknown-api-version # send a version this CLI was not built against\n--compact # single-line JSON\n-V, --version\n\\`\\`\\`\n\n## API versions\n\nThe API is versioned by date, and a version can change a response's shape — a\nbare array becoming \\`{data, pagination}\\`, for instance. **The CLI sends no\nversion header by default**, so upgrading it never changes what a command\nprints. Opt in per invocation, or pin the account:\n\n\\`\\`\\`bash\nseclai api-version get # what does a request resolve to?\nseclai --api-version 2026-07-27 alerts list # this invocation only\nseclai api-version set 2026-07-27 # every client on the account\nseclai api-version clear\n\\`\\`\\`\n\nAn \\`--api-version\\` this CLI was not built against is rejected, because a newer\nversion can reshape a response the CLI would then misread. Pass\n\\`--allow-unknown-api-version\\` to send it anyway. \\`api-version set\\` takes a\n\\`YYYY-MM-DD\\` date and rejects anything else, because the pin applies to every\nclient on the account.\n\n\\`--api-key\\`, \\`--profile\\`, \\`--account-id\\` and \\`--config-dir\\` reject an empty\nvalue. A shell expanding an unset variable passes \\`\"\"\\`, which the SDK's\ncredential chain discards, so each would silently resolve elsewhere — a\ndifferent identity, another account's cached tokens, or the default org. Guard\nthe flag rather than the value: \\`seclai \\${KEY:+--api-key \"\\$KEY\"} agents list\\`.\n\nAn empty \\`--api-version\\` is accepted with a warning, since it costs only the\nversion header; a future release will reject it too.\n\n## Common patterns\n\n**JSON input.** Most create/update commands take \\`--json '{\"key\":\"value\"}'\\` or\n\\`--json-file path.json\\`. Use \\`-\\` as the value to read from stdin.\n\n**AI shorthand.** AI generation commands accept \\`--user-input <text>\\` in place of\n\\`--json '{\"user_input\":\"<text>\"}'\\`.\n\n**Pagination.** List commands take \\`--page <n>\\` and \\`--limit <n>\\`; some add\n\\`--sort <field>\\` and \\`--order asc|desc\\`. A few endpoints paginate by offset\ninstead and take \\`--limit\\` / \\`--offset\\`.\n\n**Uploads.** Upload commands take \\`--file <path>\\`, plus optional \\`--title\\`,\n\\`--metadata '{\"k\":\"v\"}'\\`, \\`--metadata-file\\`, \\`--file-name\\` and \\`--mime-type\\`.\n\n## Search and account\n\n\\`\\`\\`bash\nseclai search --query \"deployment guide\" [--limit N] [--entity-type <type>]\nseclai docs search --query \"memory banks\" [--mode keyword|semantic] [--limit N]\nseclai me # account ID and organization memberships\n\\`\\`\\`\n` },\n { name: \"references/agents.md\", content: `# Agents\n\nAgents, their runs, definitions, export/import, input uploads, triggers, and the\nagent AI assistant.\n\n## CRUD and lifecycle\n\n\\`\\`\\`bash\nseclai agents list [--page N] [--limit N]\nseclai agents create --json '{\"name\":\"My Agent\",\"description\":\"...\"}'\nseclai agents get <agentId>\nseclai agents update <agentId> --json '{\"name\":\"Renamed\"}'\nseclai agents delete <agentId>\n\n# pause across every trigger path (API, schedule, email, sub-agent calls)\nseclai agents disable <agentId>\nseclai agents enable <agentId>\n\n# which live agents call this one via a call_agent step?\nseclai agents callers <agentId>\n\\`\\`\\`\n\n## Triggers\n\n\\`\\`\\`bash\n# alias, sender allowlist and inbound-handling flags for an EMAIL_RECEIVED trigger\nseclai agents triggers email-config <agentId> <triggerId> --json '{\"alias\":\"support\"}'\n\\`\\`\\`\n\n## Running agents\n\nFour modes: basic, streaming, NDJSON events, and polling. See\n[streaming.md](streaming.md) for event shapes and filtering.\n\n\\`\\`\\`bash\n# simple run — returns the final result\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}'\n\n# stream — wait for completion via SSE, print the final result\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --stream [--timeout-ms 60000]\n\n# events — every SSE event as an NDJSON line\n# --output: full (entire event), data (event data only), status (one-line summary)\n# --event-filter: comma-separated event types, e.g. \"status,data\"\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events [--output full|data|status] [--event-filter \"status,data\"]\n\n# poll — submit, then poll until complete\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --poll [--poll-interval-ms 2000] [--include-step-outputs]\n\\`\\`\\`\n\n## Runs\n\n\\`\\`\\`bash\nseclai agents runs list <agentId> [--page N] [--limit N] [--status <status>]\nseclai agents runs get <runId> [--include-step-outputs]\nseclai agents runs cancel <runId>\nseclai agents runs delete <runId> # deprecated alias for \\`runs cancel\\`; the API has no delete-a-run operation\nseclai agents runs search --json '{\"query\":\"...\"}'\nseclai agents runs eval-results <agentId> <runId> [--page N] [--limit N]\n\n# Download a file emitted by a run step. attachmentId is the URL-safe-base64\n# storage_key from run output manifests or webhooks.\nseclai agents runs download-attachment <runId> <attachmentId> [--download-name <name>] [--output <path>]\n\\`\\`\\`\n\nWithout \\`--output\\`, raw bytes go to stdout — redirect to a file rather than\nletting them hit the terminal.\n\n## Definitions\n\n\\`\\`\\`bash\nseclai agents def get <agentId>\nseclai agents def update <agentId> --json '{\"steps\":[{\"step_type\":\"llm\",\"config\":{}}]}'\n\\`\\`\\`\n\n## Export and import\n\n\\`\\`\\`bash\n# portable JSON snapshot of an agent definition\nseclai agents export <agentId> [--no-download]\n\n# Validate an agent_definition payload before importing — no writes.\n# Reports counts and any unresolved_refs (knowledge bases, memory banks, source\n# connections or sub-agents that do not exist in this account).\nseclai agents export <agentId> \\\\\n | jq '{agent_definition: .}' \\\\\n | seclai agents preview-import --json-file -\n\n# Import via \\`agents create\\` (or \\`agents update\\`) with agent_definition set to\n# the export payload, and entity_remap mapping unresolved source UUIDs to target\n# UUIDs taken from preview-import's unresolved_refs[*].alternatives.\nseclai agents create --json '{\"name\":\"Imported\",\"trigger_type\":\"dynamic_input\",\"agent_definition\":{},\"entity_remap\":{}}'\n\\`\\`\\`\n\n## Input uploads\n\n\\`\\`\\`bash\n# What files (if any) does this agent expect? requires_uploads reports whether it\n# accepts files; the agent block lists the names, indexes and patterns a run-time\n# batch must satisfy. Call this before staging uploads.\nseclai agents attachment-references <agentId>\n\nseclai agents upload-input <agentId> --file ./input.pdf [--file-name name] [--mime-type type]\nseclai agents input-status <agentId> <uploadId>\n\\`\\`\\`\n\n## Agent AI assistant\n\n\\`\\`\\`bash\nseclai agents ai gen-steps <agentId> --user-input \"Build a QA chatbot\"\nseclai agents ai step-config <agentId> --json '{\"step_type\":\"llm\",\"user_input\":\"Configure the LLM step\"}'\n\n# --step-type is required; the API rejects the request without it\nseclai agents ai history <agentId> --step-type llm [--step-id <id>] [--limit N] [--offset N]\n\nseclai agents ai mark <agentId> <conversationId> --json '{\"accepted\":true}'\n\\`\\`\\`\n\n## Example: knowledge-base-backed agent\n\n\\`\\`\\`bash\nseclai kb create --json '{\"name\":\"Support KB\",\"description\":\"Customer support articles\"}'\nseclai agents create --json '{\"name\":\"Support Bot\",\"description\":\"Answers customer questions\"}'\nseclai agents ai gen-steps <agentId> --user-input \"Build a QA chatbot that searches the Support KB\"\nseclai agents ai mark <agentId> <conversationId> --json '{\"accepted\":true}'\nseclai agents run <agentId> --json '{\"input\":\"How do I reset my password?\"}' --stream\n\\`\\`\\`\n\n## Example: memory-powered agent\n\n\\`\\`\\`bash\nseclai memory create --json '{\"name\":\"User Preferences\",\"type\":\"general\"}'\nseclai agents create --json '{\"name\":\"Personal Assistant\",\"description\":\"Remembers user preferences\"}'\nseclai agents ai gen-steps <agentId> --user-input \"Build a chat agent that remembers user preferences. Use general memory bank <memoryBankId>\"\nseclai agents ai mark <agentId> <conversationId> --json '{\"accepted\":true}'\n\\`\\`\\`\n` },\n { name: \"references/ai-assistant.md\", content: `# Top-level AI assistant\n\n\\`seclai ai\\` creates resources from a natural-language description, without\nstarting from a solution or an agent. The domain-scoped assistants —\n\\`agents ai\\`, \\`memory ai\\`, \\`solutions ai\\`, \\`governance ai\\` — live with their\nresources.\n\n\\`\\`\\`bash\nseclai ai kb --user-input \"Create a support knowledge base\"\nseclai ai source --user-input \"Create a documentation source\"\nseclai ai solution --user-input \"Build a customer support solution\"\nseclai ai memory --user-input \"Create a conversation memory bank\"\n\nseclai ai memory-history\nseclai ai accept <conversationId> --json '{\"accepted\":true}'\nseclai ai decline <conversationId>\nseclai ai memory-accept <conversationId> --json '{\"accepted\":true}'\n\nseclai ai feedback --json '{\"feedback\":\"The response was helpful\"}'\n\\`\\`\\`\n\n## The generate-then-accept cycle\n\nEvery assistant command returns a *proposal* with a conversation ID. Nothing is\ncreated until you accept it:\n\n\\`\\`\\`bash\nseclai ai kb --user-input \"Create a support knowledge base\"\n# read the proposal, note the conversation id\nseclai ai accept <conversationId> --json '{\"accepted\":true}'\n\\`\\`\\`\n\nMemory-bank proposals have their own accept command (\\`ai memory-accept\\`) and\ntheir own history (\\`ai memory-history\\`); everything else uses \\`ai accept\\` /\n\\`ai decline\\`.\n` },\n { name: \"references/alerts.md\", content: `# Alerts\n\nAccount alerts, the configurations that raise them, and per-organization\ndelivery preferences.\n\nModel-catalog alerts are separate — see [models.md](models.md).\n\n## Alerts\n\n\\`\\`\\`bash\nseclai alerts list [--page N] [--limit N] [--status <status>]\nseclai alerts get <alertId>\nseclai alerts status <alertId> --json '{\"status\":\"resolved\"}'\nseclai alerts comment <alertId> --json '{\"comment\":\"Fixed the issue\"}'\nseclai alerts subscribe <alertId>\nseclai alerts unsubscribe <alertId>\n\\`\\`\\`\n\n\\`GET /alerts\\` declares no severity filter. \\`--severity\\` still parses, but it is\nignored with a warning and will be removed — it never filtered anything. Filter\nclient-side instead:\n\n\\`\\`\\`bash\nseclai alerts list | jq '[.data[] | select(.severity == \"high\")]'\n\\`\\`\\`\n\n## Alert configurations\n\n\\`\\`\\`bash\nseclai alerts configs list [--page N] [--limit N]\nseclai alerts configs create --json '{\"name\":\"Latency Alert\",\"description\":\"...\",\"threshold\":5000}'\nseclai alerts configs get <configId>\nseclai alerts configs update <configId> --json '{\"threshold\":3000}'\nseclai alerts configs delete <configId>\n\\`\\`\\`\n\n## Organization preferences\n\n\\`\\`\\`bash\nseclai alerts prefs list\nseclai alerts prefs update <organizationId> <alertType> --json '{\"enabled\":true}'\n\\`\\`\\`\n\nPreferences are per organization and per alert type, so \\`update\\` takes both.\n` },\n { name: \"references/email.md\", content: `# Agent email\n\nThe domains agents send from, the inbound blocklist, inbound health, and\nrecipient opt-outs.\n\nPer-agent inbound configuration (alias, sender allowlist) lives on the trigger —\nsee \\`agents triggers email-config\\` in [agents.md](agents.md).\n\n## Sending domains\n\n\\`\\`\\`bash\nseclai email domains list\nseclai email domains add --kind custom --value mail.example.com [--delegated]\nseclai email domains verify <domainId> # run a DNS check now\nseclai email domains set-primary <domainId>\nseclai email domains test-email <domainId> # send a test to the account owner\nseclai email domains dmarc <domainId> [--days N] [--top-sources N]\nseclai email domains remove <domainId>\nseclai email domains use-shared # revert to agent.seclai.com\n\\`\\`\\`\n\n\\`--kind\\` is \\`vanity\\` (a subdomain of seclai.com) or \\`custom\\` (your own domain).\n\\`add\\` returns the DNS records to publish; pass \\`--delegated\\` when the domain's\nDNS is delegated to Seclai so those records are published for you. A domain must\nverify before \\`set-primary\\` will accept it.\n\n## Inbound sender blocklist\n\n\\`\\`\\`bash\nseclai email blocked list [--limit N] [--offset N]\nseclai email blocked add --sender-email spam@example.com [--note \"phishing\"]\nseclai email blocked add --sender-email example.com --match-type domain\nseclai email blocked remove <blockedId>\nseclai email blocked auto-block-mode disabled|input|input_and_output\n\\`\\`\\`\n\n\\`--match-type\\` is \\`address\\` (the default) or \\`domain\\`. \\`auto-block-mode\\` controls\nwhether a governance BLOCK on an authenticated sender adds them to the blocklist\nautomatically.\n\n## Inbound health\n\n\\`\\`\\`bash\nseclai email inbound status # quota usage, pause state, queued run counts\nseclai email inbound rejections [--agent-id <id>] [--limit N]\nseclai email inbound cancel-queued # fail every over-quota parked run at once\nseclai email inbound resume # lift the account-wide pause\n\\`\\`\\`\n\nWhen inbound email exceeds quota, runs park in a QUEUED state and the account\npauses. \\`status\\` shows both; \\`cancel-queued\\` clears the backlog and \\`resume\\`\nlifts the pause. Check \\`rejections\\` first — it reports why messages were turned\naway, which is usually the more useful answer.\n\n## Recipient opt-outs\n\n\\`\\`\\`bash\nseclai email optouts list [--agent-id <id>] [--limit N] [--offset N]\nseclai email optouts remove <optoutId>\n\\`\\`\\`\n\nRemoving an opt-out lets that recipient receive agent email again.\n` },\n { name: \"references/evaluations.md\", content: `# Evaluations Workflow\n\n## Step 1: Create evaluation criteria for an agent\n\\`\\`\\`bash\nseclai evals criteria create <agentId> --json '{\"name\":\"Answer Accuracy\",\"description\":\"Does the answer correctly address the question?\",\"eval_type\":\"llm_judge\"}'\n\\`\\`\\`\n\n## Step 2: Find runs to evaluate\n\\`\\`\\`bash\n# list all runs for an agent\nseclai agents runs list <agentId> --limit 10\n\n# or find runs compatible with specific criteria\nseclai evals compatible-runs <criteriaId> --limit 10\n\\`\\`\\`\n\n## Step 3: Test criteria before committing\n\\`\\`\\`bash\nseclai evals test-draft <agentId> --json '{\"criteria\":{\"name\":\"Answer Accuracy\",\"eval_type\":\"llm_judge\",\"description\":\"...\"},\"run_id\":\"<runId>\"}'\n\\`\\`\\`\n\n## Step 4: Create evaluation results\n\\`\\`\\`bash\nseclai evals results create <criteriaId> --json '{\"run_id\":\"<runId>\",\"score\":0.95}'\n\\`\\`\\`\n\n## Step 5: Review summaries\n\\`\\`\\`bash\nseclai evals criteria summary <criteriaId>\nseclai evals agent-results <agentId>\nseclai evals agent-runs <agentId> --limit 20\nseclai evals non-manual-summary <agentId>\n\\`\\`\\`\n\n## Managing criteria\n\\`\\`\\`bash\nseclai evals criteria list <agentId> [--page N] [--limit N] [--paged]\nseclai evals criteria get <criteriaId>\nseclai evals criteria update <criteriaId> --json '{\"name\":\"Updated Name\"}'\nseclai evals criteria delete <criteriaId>\n\\`\\`\\`\n\n\\`--paged\\` wraps the results in \\`{\"data\": [...]}\\` instead of returning a bare\narray, so \\`.data\\` is a stable path to read whatever \\`--api-version\\` is in effect.\nNothing is invented: the \\`pagination\\` block appears only once the API sends one,\nfrom \\`--api-version 2026-07-27\\`. Move scripts to \\`.data\\` first, then opt in to\nget \\`.pagination\\`.\n\n## Viewing results\n\\`\\`\\`bash\nseclai evals results list <criteriaId> [--page N] [--limit N]\nseclai evals compatible-runs <criteriaId> [--page N] [--limit N]\nseclai evals agent-results <agentId> [--page N] [--limit N]\nseclai evals agent-runs <agentId> [--page N] [--limit N]\n\\`\\`\\`\n` },\n { name: \"references/knowledge.md\", content: `# Sources, content, knowledge bases and memory banks\n\nThe ingestion side of Seclai: where documents come from, how they are indexed,\nand the stores agents read from.\n\nFor upload mechanics — MIME types, size limits, metadata — see\n[uploads.md](uploads.md).\n\n## Sources\n\n\\`\\`\\`bash\nseclai sources list [--page N] [--limit N] [--sort field] [--order asc|desc] [--account-id id]\nseclai sources create --json '{\"name\":\"Docs\",\"description\":\"Product documentation\"}'\nseclai sources get <sourceId>\nseclai sources update <sourceId> --json '{\"name\":\"Updated Docs\"}'\nseclai sources delete <sourceId>\n\\`\\`\\`\n\n\\`source\\` is accepted as an alias for \\`sources\\`.\n\n## Source uploads\n\n\\`\\`\\`bash\nseclai sources upload <sourceId> --file ./doc.pdf [--title \"My Doc\"] [--metadata '{\"category\":\"docs\"}'] [--file-name name] [--mime-type type]\nseclai sources upload-text <sourceId> --json '{\"text\":\"Article content here...\",\"title\":\"My Article\"}'\n\\`\\`\\`\n\n## Source exports\n\n\\`\\`\\`bash\nseclai sources exports list <sourceId> [--page N] [--limit N]\nseclai sources exports create <sourceId> --json '{\"format\":\"jsonl\"}'\nseclai sources exports get <sourceId> <exportId>\nseclai sources exports cancel <sourceId> <exportId>\nseclai sources exports delete <sourceId> <exportId>\nseclai sources exports download <sourceId> <exportId>\nseclai sources exports estimate <sourceId> --json '{\"format\":\"jsonl\"}'\n\\`\\`\\`\n\n\\`estimate\\` reports the size and cost before you commit to \\`create\\`.\n\n## Embedding migration\n\n\\`\\`\\`bash\nseclai sources migration get <sourceId>\nseclai sources migration start <sourceId> --json '{\"target_model\":\"text-embedding-3-large\"}'\nseclai sources migration cancel <sourceId>\n\\`\\`\\`\n\n## Contents (indexed content)\n\n\\`\\`\\`bash\nseclai contents get <contentVersionId> [--start N] [--end N]\nseclai contents delete <contentVersionId>\nseclai contents upload <contentVersionId> --file ./updated.pdf [--title \"Title\"] [--file-name name] [--mime-type type]\nseclai contents replace-text <contentVersionId> --json '{\"text\":\"Replacement text\",\"title\":\"Updated\"}'\nseclai contents embeddings <contentVersionId> [--page N] [--limit N]\n\\`\\`\\`\n\n\\`--start\\` / \\`--end\\` on \\`contents get\\` slice the returned text by character\noffset, which is how you inspect a long document without pulling all of it.\n\n## Knowledge bases\n\n\\`\\`\\`bash\nseclai kb list [--page N] [--limit N] [--sort field] [--order asc|desc]\nseclai kb create --json '{\"name\":\"Support KB\",\"description\":\"Customer support articles\"}'\nseclai kb get <kbId>\nseclai kb update <kbId> --json '{\"name\":\"Updated KB\"}'\nseclai kb delete <kbId>\n\\`\\`\\`\n\n## Memory banks\n\n\\`\\`\\`bash\nseclai memory list [--page N] [--limit N] [--sort field] [--order asc|desc]\n# type: \"conversation\" (chat history) or \"general\" (structured facts)\nseclai memory create --json '{\"name\":\"Chat Memory\",\"type\":\"conversation\"}'\nseclai memory get <memoryBankId>\nseclai memory update <memoryBankId> --json '{\"name\":\"Renamed\"}'\nseclai memory delete <memoryBankId>\n\\`\\`\\`\n\n### Utilities\n\n\\`\\`\\`bash\nseclai memory stats <memoryBankId>\nseclai memory agents <memoryBankId> # agents using this bank\nseclai memory compact <memoryBankId>\nseclai memory delete-source <memoryBankId>\nseclai memory templates\nseclai memory test-compaction <memoryBankId> --json '{\"prompt\":\"Summarize the conversation\"}'\nseclai memory test-compaction-standalone --json '{\"prompt\":\"Summarize the conversation\"}'\n\\`\\`\\`\n\nBoth \\`test-compaction\\` commands are dry runs — they show what compaction would\nproduce without writing to the bank.\n\n### Memory bank AI\n\n\\`\\`\\`bash\nseclai memory ai generate --user-input \"Configure compaction for chat memory\"\nseclai memory ai last\nseclai memory ai accept <conversationId> --json '{\"accepted\":true}'\n\\`\\`\\`\n\n## Example: create a source and upload content\n\n\\`\\`\\`bash\nseclai sources create --json '{\"name\":\"Product Docs\",\"description\":\"Product documentation source\"}'\n# note the id from the output\nseclai sources upload <sourceId> --file ./docs.pdf --title \"Product Manual\" --metadata '{\"version\":\"2.0\"}'\nseclai sources get <sourceId>\n\\`\\`\\`\n` },\n { name: \"references/models.md\", content: `# Models\n\nThe model catalog, media-generation tiers, model-catalog alerts, recommendations\nand the playground.\n\n## Catalog\n\n\\`\\`\\`bash\nseclai models list [--provider <name>] [--supports-tool-use] [--supports-thinking]\nseclai models list [--supports-input-media <media>] [--supports-output-media <media>]\nseclai models get <modelId>\n\n# each media-generation modality and tier, with its model and cost\nseclai models tiers\n\\`\\`\\`\n\nThe capability flags compose, so \\`--supports-tool-use --supports-thinking\\`\nreturns only models with both. \\`--supports-input-media\\` / \\`--supports-output-media\\`\ntake a modality such as \\`image\\`, \\`audio\\` or \\`video\\`.\n\n## Model alerts\n\n\\`\\`\\`bash\nseclai models alerts list [--page N] [--limit N]\nseclai models alerts mark-read <alertId>\nseclai models alerts mark-all-read\nseclai models alerts unread-count\n\\`\\`\\`\n\nThese are catalog alerts — deprecations, price changes, new models — not the\naccount alerts in [alerts.md](alerts.md).\n\n## Recommendations\n\n\\`\\`\\`bash\nseclai models recommendations <modelId>\n\\`\\`\\`\n\nSuggests replacements for a model, which is how you act on a deprecation alert.\n\n## Playground experiments\n\n\\`\\`\\`bash\nseclai models experiments list [--days N] [--start-date <date>] [--end-date <date>] [--limit N] [--offset N]\nseclai models experiments create --json '{\"model_ids\":[\"gpt-4o\"],\"prompt\":\"Compare responses\"}'\nseclai models experiments get <experimentId>\nseclai models experiments cancel <experimentId>\nseclai models experiments delete <experimentId> # soft-delete, preserves audit history\n\\`\\`\\`\n\n\\`create\\` takes several \\`model_ids\\` and runs the same prompt against each, which\nis the point — side-by-side comparison. \\`cancel\\` stops a running experiment;\n\\`delete\\` soft-deletes a finished one.\n` },\n { name: \"references/setup.md\", content: `# Setup: authentication, profiles, API version, editor integration\n\n## SSO authentication\n\n\\`\\`\\`bash\nseclai auth login [--port <port>] [--no-browser] # OAuth2 + PKCE in the browser\nseclai auth status # active profile's auth state\nseclai auth refresh # refresh the token manually\nseclai auth logout # clear cached tokens\n\\`\\`\\`\n\nTokens are cached under the config directory and refreshed automatically, so\n\\`auth refresh\\` is only needed to force it. An API key in \\`SECLAI_API_KEY\\` takes a\ndifferent path entirely and needs none of this.\n\n## Profiles\n\n\\`\\`\\`bash\nseclai configure sso [--profile-name <name>] # interactive: domain, client ID, region, account ID\nseclai configure list # every configured profile\n\\`\\`\\`\n\nProfiles live in \\`~/.seclai/config\\` (override with \\`--config-dir\\` or\n\\`SECLAI_CONFIG_DIR\\`). Select one per invocation with \\`--profile <name>\\`, or set\n\\`SECLAI_PROFILE\\`.\n\n## API version\n\n\\`\\`\\`bash\nseclai api-version get # what version does a request resolve to?\nseclai api-version set <date> # pin the account — affects every client\nseclai api-version clear # remove the pin\n\\`\\`\\`\n\n\\`set\\` and \\`clear\\` change the account, not just this CLI. To affect only your own\ninvocation, use the \\`--api-version\\` global option instead.\n\n## MCP server\n\n\\`\\`\\`bash\n# write Seclai MCP server config into AI coding tool config files\nseclai mcp configure --key <apiKey> [--target claude-code|cursor|claude-desktop|windsurf|all] [--dir .]\n\n# print the config JSON for manual setup\nseclai mcp show [--key <apiKey>]\n\\`\\`\\`\n\n## Skill files\n\n\\`\\`\\`bash\n# install these skill files into AI coding tool directories\nseclai skills install [--tool copilot|claude|cursor|windsurf|codex|kiro|cline|roo|gemini|antigravity|all] [--dir .]\n\\`\\`\\`\n\nWith no \\`--tool\\`, the target is detected from the directory structure.\n\n## Shell completion\n\n\\`\\`\\`bash\nseclai completion bash # eval \"\\$(seclai completion bash)\" in ~/.bashrc\nseclai completion zsh # eval \"\\$(seclai completion zsh)\" in ~/.zshrc\nseclai completion fish # seclai completion fish > ~/.config/fish/completions/seclai.fish\n\\`\\`\\`\n` },\n { name: \"references/solutions.md\", content: `# Solutions and governance\n\nSolutions group agents, knowledge bases and sources into one deliverable.\nGovernance defines the policies applied to agent input and output.\n\n## Solutions\n\n\\`\\`\\`bash\nseclai solutions list [--page N] [--limit N] [--sort field] [--order asc|desc]\nseclai solutions create --json '{\"name\":\"Customer Support Solution\"}'\nseclai solutions get <solutionId>\nseclai solutions update <solutionId> --json '{\"name\":\"Updated\"}'\nseclai solutions delete <solutionId>\n\\`\\`\\`\n\n## Linking resources\n\n\\`\\`\\`bash\n# each flag takes a JSON array of IDs\nseclai solutions link <solutionId> --agents '[\"agentId1\"]' --kb '[\"kbId1\"]' --sources '[\"sourceId1\"]'\nseclai solutions unlink <solutionId> --agents '[\"agentId1\"]'\n\\`\\`\\`\n\n## Conversations\n\n\\`\\`\\`bash\nseclai solutions convos list <solutionId>\nseclai solutions convos add <solutionId> --json '{\"message\":\"How should I structure this?\"}'\nseclai solutions convos mark <solutionId> <conversationId> --json '{\"accepted\":true}'\n\\`\\`\\`\n\n## Solution AI\n\n\\`\\`\\`bash\nseclai solutions ai generate <solutionId> --user-input \"Add an FAQ source\"\nseclai solutions ai kb <solutionId> --user-input \"Create a knowledge base for docs\"\nseclai solutions ai source <solutionId> --user-input \"Create a file source for PDFs\"\nseclai solutions ai accept <solutionId> <conversationId> --json '{\"accepted\":true}'\nseclai solutions ai decline <solutionId> <conversationId>\n\\`\\`\\`\n\n\\`ai kb\\` and \\`ai source\\` create the resource and link it to the solution in one\nstep, which is why they live here rather than under \\`kb\\` or \\`sources\\`.\n\n## Governance AI\n\n\\`\\`\\`bash\nseclai governance ai generate --user-input \"Create a content safety policy\"\nseclai governance ai list\nseclai governance ai accept <conversationId>\nseclai governance ai decline <conversationId>\n\\`\\`\\`\n\nA generated policy is a proposal until accepted — \\`generate\\` alone changes\nnothing.\n\n## Example: solution with linked resources\n\n\\`\\`\\`bash\nseclai solutions create --json '{\"name\":\"Customer Support\"}'\nseclai solutions link <solutionId> --agents '[\"<agentId>\"]' --kb '[\"<kbId>\"]' --sources '[\"<sourceId>\"]'\nseclai solutions get <solutionId>\n\\`\\`\\`\n\n## Example: governance policy setup\n\n\\`\\`\\`bash\nseclai governance ai generate --user-input \"Create a content safety policy that blocks harmful outputs\"\nseclai governance ai list\nseclai governance ai accept <conversationId>\n\\`\\`\\`\n` },\n { name: \"references/streaming.md\", content: `# Streaming Agent Runs\n\n## Modes\n\n### --stream\nWait for the agent run to complete via SSE. Prints the final result as a single JSON object.\nUseful when you want to block until done.\n\n\\`\\`\\`bash\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --stream\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --stream --timeout-ms 120000\n\\`\\`\\`\n\n### --events\nStream individual SSE events as NDJSON (one JSON object per line). Use for real-time processing.\n\n\\`\\`\\`bash\n# all events, full event objects\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events\n\n# only data payloads (no event metadata)\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events --output data\n\n# only status events\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events --output status\n\n# filter specific event types\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --events --event-filter \"status,data\"\n\\`\\`\\`\n\nOutput modes for --events:\n- \\`full\\`: entire SSE event object (default)\n- \\`data\\`: only the data payload of each event\n- \\`status\\`: only events with status information\n\n### --poll\nPoll the API at intervals for run completion. Does not use SSE.\n\n\\`\\`\\`bash\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --poll\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}' --poll --poll-interval-ms 5000 --include-step-outputs\n\\`\\`\\`\n\n### No flag\nFire-and-forget: starts the run and immediately returns the run ID.\n\n\\`\\`\\`bash\nseclai agents run <agentId> --json '{\"input\":\"Hello\"}'\n# returns: {\"id\":\"run_...\",\"status\":\"queued\",...}\n# check later:\nseclai agents runs get <runId>\n\\`\\`\\`\n` },\n { name: \"references/uploads.md\", content: `# File Uploads & Content Management\n\n## Upload to a source\n\\`\\`\\`bash\nseclai sources upload <sourceId> --file ./doc.pdf\nseclai sources upload <sourceId> --file ./doc.pdf --title \"My Doc\" --metadata '{\"category\":\"docs\"}' --file-name \"custom-name.pdf\" --mime-type \"application/pdf\"\nseclai sources upload <sourceId> --file ./doc.pdf --metadata-file ./meta.json\n\\`\\`\\`\n\n## Upload text directly\n\\`\\`\\`bash\nseclai sources upload-text <sourceId> --json '{\"text\":\"Article content here...\",\"title\":\"My Article\"}'\n\\`\\`\\`\n\n## Upload input for agent runs\n\\`\\`\\`bash\n# Check what files (if any) the agent expects before uploading. requires_uploads\n# reports whether the agent accepts files; the agent block lists the exact names /\n# indexes / patterns a run-time batch must satisfy.\nseclai agents attachment-references <agentId>\nseclai agents upload-input <agentId> --file ./input.pdf\nseclai agents upload-input <agentId> --file ./data.csv --file-name \"report.csv\" --mime-type \"text/csv\"\nseclai agents input-status <agentId> <uploadId>\n\\`\\`\\`\n\n## Download an attachment emitted by a run\n\\`\\`\\`bash\n# attachmentId is the URL-safe-base64 storage_key from run output manifests / webhooks.\nseclai agents runs download-attachment <runId> <attachmentId> --output ./out.pdf\n\\`\\`\\`\n\n## Replace content\n\\`\\`\\`bash\n# replace with file\nseclai contents upload <contentVersionId> --file ./updated.pdf\n\n# replace with text\nseclai contents replace-text <contentVersionId> --json '{\"text\":\"Updated content\",\"title\":\"Revised Article\"}'\n\\`\\`\\`\n\n## Read content\n\\`\\`\\`bash\n# full content\nseclai contents get <contentVersionId>\n\n# text slice (0-based offsets)\nseclai contents get <contentVersionId> --start 0 --end 1000\n\n# view embeddings\nseclai contents embeddings <contentVersionId> [--page N] [--limit N]\n\\`\\`\\`\n` },\n];\n\n// --- Tool detection & path mapping ---\n\ntype ToolConfig = {\n dir: string;\n files: Array<{ name: string; content: string }>;\n};\n\nfunction getToolConfig(tool: string, destDir: string): ToolConfig {\n // Generated from skills/seclai-cli/ by scripts/sync-skills.cjs — every file\n // found there ships, so adding a reference needs no change here.\n const skillFiles = SKILL_FILES;\n\n switch (tool) {\n case \"copilot\":\n return { dir: join(destDir, \".github\", \"copilot\", \"seclai-cli\"), files: skillFiles };\n case \"claude\":\n return { dir: join(destDir, \".claude\", \"skills\", \"seclai-cli\"), files: skillFiles };\n case \"cursor\":\n return { dir: join(destDir, \".cursor\", \"skills\", \"seclai-cli\"), files: skillFiles };\n case \"windsurf\":\n return { dir: join(destDir, \".windsurf\", \"skills\", \"seclai-cli\"), files: skillFiles };\n case \"codex\":\n return { dir: join(destDir, \".codex\", \"skills\", \"seclai-cli\"), files: skillFiles };\n case \"kiro\":\n return { dir: join(destDir, \".kiro\", \"steering\", \"seclai-cli\"), files: skillFiles };\n case \"cline\":\n return { dir: join(destDir, \".clinerules\", \"seclai-cli\"), files: skillFiles };\n case \"roo\":\n return { dir: join(destDir, \".roo\", \"rules\", \"seclai-cli\"), files: skillFiles };\n case \"gemini\":\n return { dir: join(destDir, \".gemini\", \"seclai-cli\"), files: skillFiles };\n case \"antigravity\":\n return { dir: join(destDir, \".antigravity\", \"seclai-cli\"), files: skillFiles };\n default:\n throw new Error(`Unknown tool: ${tool}. Use copilot, claude, cursor, windsurf, codex, kiro, cline, roo, gemini, or antigravity.`);\n }\n}\n\nfunction detectTools(destDir: string): string[] {\n const detected: string[] = [];\n\n if (existsSync(join(destDir, \".github\", \"copilot\"))) detected.push(\"copilot\");\n if (existsSync(join(destDir, \".claude\")) || existsSync(join(destDir, \"CLAUDE.md\")))\n detected.push(\"claude\");\n if (existsSync(join(destDir, \".cursor\"))) detected.push(\"cursor\");\n if (existsSync(join(destDir, \".windsurf\"))) detected.push(\"windsurf\");\n if (existsSync(join(destDir, \".codex\"))) detected.push(\"codex\");\n if (existsSync(join(destDir, \".kiro\"))) detected.push(\"kiro\");\n if (existsSync(join(destDir, \".clinerules\")) && statSync(join(destDir, \".clinerules\")).isDirectory()) detected.push(\"cline\");\n if (existsSync(join(destDir, \".roo\"))) detected.push(\"roo\");\n if (existsSync(join(destDir, \".gemini\")) || existsSync(join(destDir, \"GEMINI.md\")))\n detected.push(\"gemini\");\n if (existsSync(join(destDir, \".antigravity\"))) detected.push(\"antigravity\");\n\n return detected;\n}\n\n/** Register the `skills` command for installing Seclai skill files into AI coding tool directories. */\nexport function register(program: Command, rt: CliRuntime): void {\n const skills = program.command(\"skills\").description(\"Install Seclai CLI skill files for AI coding tools.\");\n\n skills\n .command(\"install\")\n .description(\n \"Write Seclai CLI skill/instruction files into the current workspace.\\n\\n\" +\n \"Detected tools: copilot, claude, cursor, windsurf, codex, kiro, cline, roo, gemini, antigravity.\\n\" +\n \"Use --tool to target a specific tool, or 'all' for all supported tools.\"\n )\n .option(\"--tool <name>\", \"Target tool (copilot|claude|cursor|windsurf|codex|kiro|cline|roo|gemini|antigravity|all). Auto-detects if omitted.\")\n .option(\"--dir <path>\", \"Target directory (default: current directory).\", \".\")\n .action(async (opts) => {\n await run(rt, async () => {\n const destDir = opts.dir;\n let tools: string[];\n\n if (opts.tool === \"all\") {\n tools = [\"copilot\", \"claude\", \"cursor\", \"windsurf\", \"codex\", \"kiro\", \"cline\", \"roo\", \"gemini\", \"antigravity\"];\n } else if (opts.tool) {\n tools = [opts.tool];\n } else {\n tools = detectTools(destDir);\n if (tools.length === 0) {\n tools = [\"copilot\"]; // default fallback\n rt.writeErr(\"No AI tool detected, defaulting to copilot.\\n\");\n }\n }\n\n let totalFiles = 0;\n for (const tool of tools) {\n const config = getToolConfig(tool, destDir);\n for (const file of config.files) {\n const filePath = join(config.dir, file.name);\n await mkdir(dirname(filePath), { recursive: true });\n await writeFile(filePath, file.content, \"utf8\");\n totalFiles++;\n }\n rt.writeErr(`Installed ${config.files.length} skill files for ${tool} → ${config.dir}\\n`);\n }\n\n printJson(rt, { ok: true, tools, filesWritten: totalFiles });\n });\n });\n}\n","import { Command } from \"commander\";\nimport { existsSync } from \"node:fs\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { homedir, platform } from \"node:os\";\nimport type { CliRuntime } from \"../helpers.js\";\nimport { run, printJson } from \"../helpers.js\";\n\nconst MCP_URL = \"https://api.seclai.com/mcp\";\n\ntype McpConfig = {\n mcpServers: Record<string, { type: string; url: string; headers: Record<string, string> }>;\n};\n\nfunction buildMcpEntry(apiKey: string): McpConfig[\"mcpServers\"][\"seclai\"] {\n return {\n type: \"streamable-http\",\n url: MCP_URL,\n headers: { \"X-API-Key\": apiKey },\n };\n}\n\ntype McpTarget = { name: string; path: string; scope: \"project\" | \"global\" };\n\nfunction getTargets(destDir: string): McpTarget[] {\n const home = homedir();\n const os = platform();\n\n const targets: McpTarget[] = [\n // Project-scoped configs\n { name: \"claude-code\", path: join(destDir, \".mcp.json\"), scope: \"project\" },\n { name: \"cursor\", path: join(destDir, \".cursor\", \"mcp.json\"), scope: \"project\" },\n ];\n // Global configs — claude-desktop path varies by platform\n if (os === \"win32\") {\n targets.push({\n name: \"claude-desktop\",\n path: join(process.env[\"APPDATA\"] ?? join(home, \"AppData\", \"Roaming\"), \"Claude\", \"claude_desktop_config.json\"),\n scope: \"global\",\n });\n } else if (os === \"darwin\") {\n targets.push({\n name: \"claude-desktop\",\n path: join(home, \"Library\", \"Application Support\", \"Claude\", \"claude_desktop_config.json\"),\n scope: \"global\",\n });\n }\n targets.push({ name: \"windsurf\", path: join(home, \".codeium\", \"windsurf\", \"mcp_config.json\"), scope: \"global\" });\n return targets;\n}\n\nasync function mergeConfig(filePath: string, apiKey: string): Promise<boolean> {\n let existing: Record<string, unknown> = {};\n if (existsSync(filePath)) {\n try {\n const parsed: unknown = JSON.parse(await readFile(filePath, \"utf8\"));\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) return false;\n existing = parsed as Record<string, unknown>;\n } catch {\n return false;\n }\n }\n const raw = existing[\"mcpServers\"];\n const servers = (typeof raw === \"object\" && raw !== null && !Array.isArray(raw) ? raw : {}) as Record<string, unknown>;\n servers[\"seclai\"] = buildMcpEntry(apiKey);\n existing[\"mcpServers\"] = servers;\n await mkdir(dirname(filePath), { recursive: true });\n await writeFile(filePath, JSON.stringify(existing, null, 2) + \"\\n\", \"utf8\");\n return true;\n}\n\nfunction detectTargets(destDir: string): McpTarget[] {\n const all = getTargets(destDir);\n return all.filter((t) => {\n if (t.scope === \"global\") return existsSync(dirname(t.path));\n // For project configs, check if the tool's directory marker exists\n if (t.name === \"claude-code\") return existsSync(join(destDir, \".claude\")) || existsSync(join(destDir, \"CLAUDE.md\"));\n if (t.name === \"cursor\") return existsSync(join(destDir, \".cursor\"));\n return false;\n });\n}\n\n/** Register the `mcp` command for configuring MCP server access in AI coding tools. */\nexport function register(program: Command, rt: CliRuntime): void {\n const mcp = program.command(\"mcp\").description(\"Configure the Seclai MCP server for AI coding tools.\");\n\n mcp\n .command(\"configure\")\n .description(\n \"Add the Seclai MCP server to AI coding tool config files.\\n\\n\" +\n \"Targets: claude-code, cursor, claude-desktop, windsurf.\\n\" +\n \"Use --target to pick a specific tool, or 'all' for all known targets.\"\n )\n .requiredOption(\"--key <key>\", \"Seclai API key to embed in the config.\")\n .option(\"--target <name>\", \"Target tool (claude-code|cursor|claude-desktop|windsurf|all). Auto-detects if omitted.\")\n .option(\"--dir <path>\", \"Project directory for project-scoped configs (default: current directory).\", \".\")\n .action(async (opts) => {\n await run(rt, async () => {\n const destDir = opts.dir;\n const apiKey: string = opts.key;\n const allTargets = getTargets(destDir);\n let targets: McpTarget[];\n\n if (opts.target === \"all\") {\n targets = allTargets;\n } else if (opts.target) {\n const found = allTargets.find((t) => t.name === opts.target);\n if (!found) {\n rt.writeErr(`Unknown target \"${opts.target}\". Use: claude-code, cursor, claude-desktop, windsurf, or all.\\n`);\n rt.setExitCode(1);\n return;\n }\n targets = [found];\n } else {\n targets = detectTargets(destDir);\n if (targets.length === 0) {\n targets = [allTargets[0]!]; // default to claude-code\n rt.writeErr(\"No MCP-compatible tool detected, defaulting to claude-code (.mcp.json).\\n\");\n }\n }\n\n let configured = 0;\n const failures: string[] = [];\n for (const target of targets) {\n const ok = await mergeConfig(target.path, apiKey);\n if (ok) {\n configured++;\n rt.writeErr(`Configured seclai MCP for ${target.name} → ${target.path}\\n`);\n } else {\n failures.push(target.name);\n rt.writeErr(`Failed to parse existing config at ${target.path}, skipping.\\n`);\n }\n }\n\n const allOk = failures.length === 0;\n printJson(rt, { ok: allOk, targets: targets.map((t) => t.name), filesWritten: configured, ...(failures.length > 0 ? { failures } : {}) });\n if (!allOk) rt.setExitCode(1);\n });\n });\n\n mcp\n .command(\"show\")\n .description(\"Show the Seclai MCP server JSON configuration snippet.\")\n .option(\"--key <key>\", \"API key to include (default: placeholder).\")\n .action(async (opts) => {\n await run(rt, async () => {\n const entry = buildMcpEntry(opts.key ?? \"YOUR_API_KEY\");\n printJson(rt, { mcpServers: { seclai: entry } });\n });\n });\n}\n","import { Command } from \"commander\";\nimport type { CliRuntime } from \"../helpers.js\";\n\nconst BASH = `#!/usr/bin/env bash\n# seclai bash completion — add to ~/.bashrc:\n# eval \"$(seclai completion bash)\"\n\n_seclai_completions() {\n local cur prev commands\n cur=\"\\${COMP_WORDS[COMP_CWORD]}\"\n prev=\"\\${COMP_WORDS[COMP_CWORD-1]}\"\n\n # Top-level commands\n commands=\"agents sources contents kb memory evals solutions governance alerts email models search docs me api-version ai skills mcp completion auth configure help\"\n\n case \"\\${COMP_WORDS[1]}\" in\n agents)\n case \"\\${COMP_WORDS[2]}\" in\n runs) COMPREPLY=( $(compgen -W \"list get delete cancel search eval-results download-attachment\" -- \"$cur\") ); return ;;\n def) COMPREPLY=( $(compgen -W \"get update\" -- \"$cur\") ); return ;;\n ai) COMPREPLY=( $(compgen -W \"gen-steps step-config history mark\" -- \"$cur\") ); return ;;\n triggers) COMPREPLY=( $(compgen -W \"email-config\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list create get update delete disable enable callers triggers run runs def export preview-import upload-input input-status attachment-references ai\" -- \"$cur\") ); return ;;\n esac ;;\n sources|source)\n case \"\\${COMP_WORDS[2]}\" in\n exports) COMPREPLY=( $(compgen -W \"list create get cancel delete download estimate\" -- \"$cur\") ); return ;;\n migration) COMPREPLY=( $(compgen -W \"get start cancel\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list create get update delete upload upload-text exports migration\" -- \"$cur\") ); return ;;\n esac ;;\n contents) COMPREPLY=( $(compgen -W \"get delete upload replace replace-text embeddings\" -- \"$cur\") ); return ;;\n kb) COMPREPLY=( $(compgen -W \"list create get update delete\" -- \"$cur\") ); return ;;\n memory)\n case \"\\${COMP_WORDS[2]}\" in\n ai) COMPREPLY=( $(compgen -W \"generate last accept\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list create get update delete stats agents compact delete-source templates test-compaction test-compaction-standalone ai\" -- \"$cur\") ); return ;;\n esac ;;\n evals)\n case \"\\${COMP_WORDS[2]}\" in\n criteria) COMPREPLY=( $(compgen -W \"list create get update delete summary\" -- \"$cur\") ); return ;;\n results) COMPREPLY=( $(compgen -W \"list create\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"criteria results compatible-runs test-draft agent-results agent-runs non-manual-summary\" -- \"$cur\") ); return ;;\n esac ;;\n solutions)\n case \"\\${COMP_WORDS[2]}\" in\n convos) COMPREPLY=( $(compgen -W \"list add mark\" -- \"$cur\") ); return ;;\n ai) COMPREPLY=( $(compgen -W \"generate kb source accept decline\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list create get update delete link unlink convos ai\" -- \"$cur\") ); return ;;\n esac ;;\n governance)\n case \"\\${COMP_WORDS[2]}\" in\n ai) COMPREPLY=( $(compgen -W \"generate list accept decline\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"ai\" -- \"$cur\") ); return ;;\n esac ;;\n alerts)\n case \"\\${COMP_WORDS[2]}\" in\n configs) COMPREPLY=( $(compgen -W \"list create get update delete\" -- \"$cur\") ); return ;;\n prefs) COMPREPLY=( $(compgen -W \"list update\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list get status comment subscribe unsubscribe configs prefs\" -- \"$cur\") ); return ;;\n esac ;;\n email)\n case \"\\${COMP_WORDS[2]}\" in\n domains) COMPREPLY=( $(compgen -W \"list add remove verify set-primary use-shared test-email dmarc\" -- \"$cur\") ); return ;;\n blocked) COMPREPLY=( $(compgen -W \"list add remove auto-block-mode\" -- \"$cur\") ); return ;;\n inbound) COMPREPLY=( $(compgen -W \"status rejections cancel-queued resume\" -- \"$cur\") ); return ;;\n optouts) COMPREPLY=( $(compgen -W \"list remove\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"domains blocked inbound optouts\" -- \"$cur\") ); return ;;\n esac ;;\n models)\n case \"\\${COMP_WORDS[2]}\" in\n alerts) COMPREPLY=( $(compgen -W \"list mark-read mark-all-read unread-count\" -- \"$cur\") ); return ;;\n experiments) COMPREPLY=( $(compgen -W \"list create get cancel delete\" -- \"$cur\") ); return ;;\n *) COMPREPLY=( $(compgen -W \"list get tiers alerts recommendations experiments\" -- \"$cur\") ); return ;;\n esac ;;\n docs) COMPREPLY=( $(compgen -W \"search\" -- \"$cur\") ); return ;;\n api-version) COMPREPLY=( $(compgen -W \"get set clear\" -- \"$cur\") ); return ;;\n auth) COMPREPLY=( $(compgen -W \"login logout status refresh\" -- \"$cur\") ); return ;;\n configure) COMPREPLY=( $(compgen -W \"sso list\" -- \"$cur\") ); return ;;\n ai) COMPREPLY=( $(compgen -W \"feedback kb source solution memory memory-history accept decline memory-accept\" -- \"$cur\") ); return ;;\n skills) COMPREPLY=( $(compgen -W \"install\" -- \"$cur\") ); return ;;\n mcp) COMPREPLY=( $(compgen -W \"configure show\" -- \"$cur\") ); return ;;\n completion) COMPREPLY=( $(compgen -W \"bash zsh fish\" -- \"$cur\") ); return ;;\n esac\n\n COMPREPLY=( $(compgen -W \"$commands\" -- \"$cur\") )\n}\n\ncomplete -F _seclai_completions seclai\n`;\n\nconst ZSH = `#compdef seclai\n# seclai zsh completion — add to ~/.zshrc:\n# eval \"$(seclai completion zsh)\"\n\n_seclai() {\n local -a commands\n commands=(\n 'agents:Manage agents, runs, definitions, and AI assistance'\n 'sources:Manage content sources'\n 'contents:Manage indexed content and embeddings'\n 'kb:Manage knowledge bases'\n 'memory:Manage memory banks'\n 'evals:Manage evaluations'\n 'solutions:Manage solutions'\n 'governance:Governance AI assistant'\n 'alerts:Manage alerts and alert configurations'\n 'email:Agent email domains, blocklist, inbound health, opt-outs'\n 'models:Models, model alerts, recommendations, experiments'\n 'search:Search across Seclai resources'\n 'docs:Search the Seclai documentation'\n 'me:Show the authenticated user and organizations'\n 'api-version:Read or pin the dated API version'\n 'ai:Top-level AI assistant'\n 'skills:Install skill files for AI coding tools'\n 'mcp:Configure the Seclai MCP server'\n 'completion:Generate shell completion scripts'\n 'auth:SSO authentication'\n 'configure:Manage SSO profiles'\n 'help:Display help for command'\n )\n\n _arguments -C \\\\\n '--api-key[Seclai API key]:key' \\\\\n '--profile[SSO profile name]:name' \\\\\n '--account-id[Account ID (X-Account-Id header)]:id' \\\\\n '--config-dir[Config directory]:path' \\\\\n '--api-version[Dated API version (YYYY-MM-DD)]:date' \\\\\n '--allow-unknown-api-version[Permit an unrecognized --api-version]' \\\\\n '--compact[Output compact JSON]' \\\\\n '-V[Output version]' \\\\\n '-h[Display help]' \\\\\n '1:command:->cmd' \\\\\n '*::arg:->args'\n\n case $state in\n cmd) _describe 'command' commands ;;\n args)\n case \\${words[1]} in\n agents)\n local -a sub=(list create get update delete disable enable callers triggers run runs def export preview-import upload-input input-status attachment-references ai)\n _describe 'subcommand' sub ;;\n sources|source)\n local -a sub=(list create get update delete upload upload-text exports migration)\n _describe 'subcommand' sub ;;\n contents)\n local -a sub=(get delete upload replace replace-text embeddings)\n _describe 'subcommand' sub ;;\n kb)\n local -a sub=(list create get update delete)\n _describe 'subcommand' sub ;;\n memory)\n local -a sub=(list create get update delete stats agents compact delete-source templates test-compaction test-compaction-standalone ai)\n _describe 'subcommand' sub ;;\n evals)\n local -a sub=(criteria results compatible-runs test-draft agent-results agent-runs non-manual-summary)\n _describe 'subcommand' sub ;;\n solutions)\n local -a sub=(list create get update delete link unlink convos ai)\n _describe 'subcommand' sub ;;\n governance)\n local -a sub=(ai)\n _describe 'subcommand' sub ;;\n alerts)\n local -a sub=(list get status comment subscribe unsubscribe configs prefs)\n _describe 'subcommand' sub ;;\n email)\n local -a sub=(domains blocked inbound optouts)\n _describe 'subcommand' sub ;;\n models)\n local -a sub=(list get tiers alerts recommendations experiments)\n _describe 'subcommand' sub ;;\n docs)\n local -a sub=(search)\n _describe 'subcommand' sub ;;\n api-version)\n local -a sub=(get set clear)\n _describe 'subcommand' sub ;;\n auth)\n local -a sub=(login logout status refresh)\n _describe 'subcommand' sub ;;\n configure)\n local -a sub=(sso list)\n _describe 'subcommand' sub ;;\n ai)\n local -a sub=(feedback kb source solution memory memory-history accept decline memory-accept)\n _describe 'subcommand' sub ;;\n skills)\n local -a sub=(install)\n _describe 'subcommand' sub ;;\n mcp)\n local -a sub=(configure show)\n _describe 'subcommand' sub ;;\n completion)\n local -a sub=(bash zsh fish)\n _describe 'shell' sub ;;\n esac ;;\n esac\n}\n\n_seclai \"$@\"\n`;\n\nconst FISH = `# seclai fish completion — save to ~/.config/fish/completions/seclai.fish\n# seclai completion fish > ~/.config/fish/completions/seclai.fish\n\nset -l top agents sources contents kb memory evals solutions governance alerts email models search docs me api-version ai skills mcp completion auth configure help\n\n# Top-level\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"agents\" -d \"Manage agents\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"sources\" -d \"Manage sources\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"contents\" -d \"Manage content\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"kb\" -d \"Knowledge bases\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"memory\" -d \"Memory banks\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"evals\" -d \"Evaluations\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"solutions\" -d \"Solutions\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"governance\" -d \"Governance AI\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"alerts\" -d \"Alerts\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"email\" -d \"Agent email\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"models\" -d \"Models and model alerts\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"search\" -d \"Search resources\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"docs\" -d \"Search documentation\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"me\" -d \"Authenticated user\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"api-version\" -d \"Dated API version\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"ai\" -d \"AI assistant\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"skills\" -d \"Skill files\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"mcp\" -d \"MCP server config\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"completion\" -d \"Shell completions\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"auth\" -d \"SSO authentication\"\ncomplete -c seclai -n \"not __fish_seen_subcommand_from $top\" -f -a \"configure\" -d \"Manage SSO profiles\"\n\n# agents\ncomplete -c seclai -n \"__fish_seen_subcommand_from agents; and not __fish_seen_subcommand_from list create get update delete disable enable callers triggers run runs def export preview-import upload-input input-status attachment-references ai\" -f -a \"list create get update delete disable enable callers triggers run runs def export preview-import upload-input input-status attachment-references ai\"\n\n# sources\ncomplete -c seclai -n \"__fish_seen_subcommand_from sources; and not __fish_seen_subcommand_from list create get update delete upload upload-text exports migration\" -f -a \"list create get update delete upload upload-text exports migration\"\n\n# contents\ncomplete -c seclai -n \"__fish_seen_subcommand_from contents; and not __fish_seen_subcommand_from get delete upload replace replace-text embeddings\" -f -a \"get delete upload replace replace-text embeddings\"\n\n# kb\ncomplete -c seclai -n \"__fish_seen_subcommand_from kb; and not __fish_seen_subcommand_from list create get update delete\" -f -a \"list create get update delete\"\n\n# memory\ncomplete -c seclai -n \"__fish_seen_subcommand_from memory; and not __fish_seen_subcommand_from list create get update delete stats agents compact delete-source templates test-compaction test-compaction-standalone ai\" -f -a \"list create get update delete stats agents compact delete-source templates test-compaction test-compaction-standalone ai\"\n\n# evals\ncomplete -c seclai -n \"__fish_seen_subcommand_from evals; and not __fish_seen_subcommand_from criteria results compatible-runs test-draft agent-results agent-runs non-manual-summary\" -f -a \"criteria results compatible-runs test-draft agent-results agent-runs non-manual-summary\"\n\n# solutions\ncomplete -c seclai -n \"__fish_seen_subcommand_from solutions; and not __fish_seen_subcommand_from list create get update delete link unlink convos ai\" -f -a \"list create get update delete link unlink convos ai\"\n\n# governance\ncomplete -c seclai -n \"__fish_seen_subcommand_from governance; and not __fish_seen_subcommand_from ai\" -f -a \"ai\"\n\n# alerts\ncomplete -c seclai -n \"__fish_seen_subcommand_from alerts; and not __fish_seen_subcommand_from list get status comment subscribe unsubscribe configs prefs\" -f -a \"list get status comment subscribe unsubscribe configs prefs\"\n\n# email\ncomplete -c seclai -n \"__fish_seen_subcommand_from email; and not __fish_seen_subcommand_from domains blocked inbound optouts\" -f -a \"domains blocked inbound optouts\"\n\n# models\ncomplete -c seclai -n \"__fish_seen_subcommand_from models; and not __fish_seen_subcommand_from list get tiers alerts recommendations experiments\" -f -a \"list get tiers alerts recommendations experiments\"\n\n# docs\ncomplete -c seclai -n \"__fish_seen_subcommand_from docs; and not __fish_seen_subcommand_from search\" -f -a \"search\"\n\n# api-version\ncomplete -c seclai -n \"__fish_seen_subcommand_from api-version; and not __fish_seen_subcommand_from get set clear\" -f -a \"get set clear\"\n\n# auth\ncomplete -c seclai -n \"__fish_seen_subcommand_from auth; and not __fish_seen_subcommand_from login logout status refresh\" -f -a \"login logout status refresh\"\n\n# configure\ncomplete -c seclai -n \"__fish_seen_subcommand_from configure; and not __fish_seen_subcommand_from sso list\" -f -a \"sso list\"\n\n# ai\ncomplete -c seclai -n \"__fish_seen_subcommand_from ai; and not __fish_seen_subcommand_from feedback kb source solution memory memory-history accept decline memory-accept\" -f -a \"feedback kb source solution memory memory-history accept decline memory-accept\"\n\n# skills\ncomplete -c seclai -n \"__fish_seen_subcommand_from skills; and not __fish_seen_subcommand_from install\" -f -a \"install\"\n\n# mcp\ncomplete -c seclai -n \"__fish_seen_subcommand_from mcp; and not __fish_seen_subcommand_from configure show\" -f -a \"configure show\"\n\n# completion\ncomplete -c seclai -n \"__fish_seen_subcommand_from completion; and not __fish_seen_subcommand_from bash zsh fish\" -f -a \"bash zsh fish\"\n\n# Global options\ncomplete -c seclai -l api-key -d \"Seclai API key\"\ncomplete -c seclai -l profile -d \"SSO profile name\"\ncomplete -c seclai -l account-id -d \"Account ID (X-Account-Id header)\"\ncomplete -c seclai -l config-dir -d \"Config directory\"\ncomplete -c seclai -l api-version -d \"Dated API version (YYYY-MM-DD)\"\ncomplete -c seclai -l allow-unknown-api-version -d \"Permit an unrecognized --api-version\"\ncomplete -c seclai -l compact -d \"Output compact JSON\"\ncomplete -c seclai -s V -l version -d \"Output version\"\n`;\n\nconst SCRIPTS: Record<string, string> = { bash: BASH, zsh: ZSH, fish: FISH };\n\n/** Register the `completion` command for generating shell completion scripts (bash/zsh/fish). */\nexport function register(program: Command, rt: CliRuntime): void {\n const completion = program\n .command(\"completion\")\n .description(\"Generate shell completion scripts.\")\n .argument(\"<shell>\", \"Shell type: bash, zsh, or fish.\")\n .action(async (shell: string) => {\n const script = SCRIPTS[shell];\n if (!script) {\n rt.writeErr(`Unknown shell \"${shell}\". Use: bash, zsh, or fish.\\n`);\n rt.setExitCode(1);\n return;\n }\n rt.writeOut(script);\n });\n}\n","/**\n * SSO authentication commands — login, logout, status, and refresh.\n *\n * @module\n */\nimport { Command } from \"commander\";\nimport { randomBytes, createHash } from \"node:crypto\";\nimport { createServer } from \"node:http\";\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { URL, URLSearchParams } from \"node:url\";\nimport process from \"node:process\";\n\nimport {\n loadSsoProfile,\n readSsoCache,\n writeSsoCache,\n deleteSsoCache,\n isTokenValid,\n type SsoProfile,\n type SsoCacheEntry,\n} from \"@seclai/sdk\";\n\nimport {\n type CliRuntime,\n type GlobalOptions,\n createClient,\n printJson,\n run,\n} from \"../helpers.js\";\n\n/**\n * PKCE helpers.\n */\n/** Generate a random PKCE code verifier (base64url-encoded). */\nfunction generateCodeVerifier(): string {\n return randomBytes(32).toString(\"base64url\");\n}\n\n/** Compute the S256 PKCE code challenge from a verifier. */\nfunction computeCodeChallenge(verifier: string): string {\n return createHash(\"sha256\").update(verifier).digest(\"base64url\");\n}\n\n/**\n * Start a local HTTP server to receive the OAuth callback.\n * Returns a promise that resolves with the authorization code.\n */\nfunction waitForAuthCode(port: number, state: string): Promise<{ code: string; cleanup: () => void }> {\n return new Promise((resolve, reject) => {\n const server = createServer((req, res) => {\n const url = new URL(req.url ?? \"/\", `http://localhost:${port}`);\n\n if (url.pathname !== \"/callback\") {\n res.writeHead(404);\n res.end();\n return;\n }\n\n const code = url.searchParams.get(\"code\");\n const returnedState = url.searchParams.get(\"state\");\n const error = url.searchParams.get(\"error\");\n\n if (error) {\n res.writeHead(200, { \"Content-Type\": \"text/html\" });\n res.end(\"<html><body><h2>Authentication failed</h2><p>You can close this tab.</p></body></html>\");\n reject(new Error(`OAuth error: ${error}`));\n server.close();\n return;\n }\n\n if (!code || returnedState !== state) {\n res.writeHead(400, { \"Content-Type\": \"text/html\" });\n res.end(\"<html><body><h2>Invalid callback</h2></body></html>\");\n reject(new Error(\"Invalid callback: missing code or state mismatch\"));\n server.close();\n return;\n }\n\n res.writeHead(200, { \"Content-Type\": \"text/html\" });\n res.end(\"<html><body><h2>Authenticated successfully!</h2><p>You can close this tab.</p></body></html>\");\n\n resolve({\n code,\n cleanup: () => server.close(),\n });\n });\n\n server.listen(port, \"127.0.0.1\");\n server.on(\"error\", reject);\n });\n}\n\n/**\n * Exchange an authorization code for SSO tokens via the Cognito token endpoint.\n *\n * @param profile - SSO profile with Cognito domain and client ID.\n * @param code - Authorization code from the OAuth callback.\n * @param codeVerifier - PKCE code verifier used in the authorization request.\n * @param redirectUri - Redirect URI matching the authorization request.\n * @returns Fresh cache entry with access, refresh, and ID tokens.\n * @throws {Error} If the token endpoint returns a non-OK status.\n */\nasync function exchangeCodeForTokens(\n profile: SsoProfile,\n code: string,\n codeVerifier: string,\n redirectUri: string,\n): Promise<SsoCacheEntry> {\n const tokenUrl = `https://${profile.ssoDomain}/oauth2/token`;\n\n const body = new URLSearchParams({\n grant_type: \"authorization_code\",\n client_id: profile.ssoClientId,\n code,\n redirect_uri: redirectUri,\n code_verifier: codeVerifier,\n });\n\n const resp = await fetch(tokenUrl, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body: body.toString(),\n });\n\n if (!resp.ok) {\n const text = await resp.text();\n throw new Error(`Token exchange failed (HTTP ${resp.status}): ${text}`);\n }\n\n const data = (await resp.json()) as {\n access_token: string;\n id_token?: string;\n refresh_token?: string;\n expires_in: number;\n };\n\n const expiresAt = new Date(Date.now() + data.expires_in * 1000).toISOString();\n\n const entry: SsoCacheEntry = {\n accessToken: data.access_token,\n expiresAt,\n clientId: profile.ssoClientId,\n region: profile.ssoRegion,\n cognitoDomain: profile.ssoDomain,\n };\n if (data.refresh_token) entry.refreshToken = data.refresh_token;\n if (data.id_token) entry.idToken = data.id_token;\n return entry;\n}\n\nconst DEFAULT_CALLBACK_PORT = 9876;\n\n/** Resolve the API base URL from environment or default. */\nfunction resolveBaseUrl(): string {\n const envUrl = process.env.SECLAI_API_URL;\n return envUrl && envUrl.length > 0 ? envUrl : \"https://api.seclai.com\";\n}\n\n/**\n * Call GET /me with a bearer token to resolve the user's account ID.\n *\n * @param accessToken - Fresh access token from SSO login.\n * @returns The user's personal account ID.\n */\nasync function fetchAccountId(accessToken: string): Promise<string> {\n const baseUrl = resolveBaseUrl();\n const resp = await fetch(`${baseUrl}/me`, {\n headers: { authorization: `Bearer ${accessToken}` },\n });\n\n if (!resp.ok) {\n const text = await resp.text();\n throw new Error(`Failed to resolve account ID from /me (HTTP ${resp.status}): ${text}`);\n }\n\n const data = (await resp.json()) as { account_id: string };\n return data.account_id;\n}\n\n/**\n * Update a single key within an existing profile section of the config file.\n * Adds the key if it doesn't exist in the section.\n */\nasync function updateConfigKey(\n configDir: string,\n profileName: string,\n key: string,\n value: string,\n): Promise<void> {\n const configPath = join(configDir, \"config\");\n\n let content = \"\";\n try {\n content = await readFile(configPath, \"utf-8\");\n } catch {\n // file doesn't exist — we'll create it\n }\n\n const sectionHeader = profileName === \"default\" ? \"[default]\" : `[profile ${profileName}]`;\n const sectionIdx = content.indexOf(sectionHeader);\n\n if (sectionIdx === -1) {\n // Section doesn't exist — create it with just this key\n if (content.length > 0 && !content.endsWith(\"\\n\")) {\n content += \"\\n\";\n }\n content += `\\n${sectionHeader}\\n${key} = ${value}\\n`;\n } else {\n const afterHeader = sectionIdx + sectionHeader.length;\n const nextSectionMatch = content.slice(afterHeader).match(/\\n\\[/);\n const sectionEnd = nextSectionMatch\n ? afterHeader + nextSectionMatch.index!\n : content.length;\n\n const sectionBody = content.slice(afterHeader, sectionEnd);\n const keyRegex = new RegExp(`^${key}\\\\s*=.*$`, \"m\");\n\n let newSectionBody: string;\n if (keyRegex.test(sectionBody)) {\n newSectionBody = sectionBody.replace(keyRegex, `${key} = ${value}`);\n } else {\n const trimmed = sectionBody.trimEnd();\n newSectionBody = `${trimmed}\\n${key} = ${value}\\n`;\n }\n\n content = content.slice(0, afterHeader) + newSectionBody + content.slice(sectionEnd);\n }\n\n const { mkdir } = await import(\"node:fs/promises\");\n await mkdir(configDir, { recursive: true });\n await writeFile(configPath, content, { mode: 0o600 });\n}\n\n/**\n * Resolve profile name and config directory from global options and environment.\n *\n * @param opts - Global CLI options.\n * @returns Object with profileName and configDir.\n */\nfunction resolveProfile(opts: GlobalOptions): { profileName: string; configDir: string } {\n const profileName = opts.profile || process.env.SECLAI_PROFILE || \"default\";\n let configDir = opts.configDir || process.env.SECLAI_CONFIG_DIR;\n if (!configDir) {\n const home = process.env.HOME ?? process.env.USERPROFILE;\n if (home && home.trim() !== \"\") {\n configDir = join(home, \".seclai\");\n } else {\n configDir = join(process.cwd(), \".seclai\");\n }\n }\n return { profileName, configDir };\n}\n\n/**\n * Load the SSO profile, using built-in defaults if no config exists.\n *\n * @param rt - CLI runtime for I/O.\n * @param opts - Global CLI options.\n * @returns Object with the resolved profile, profile name, and config directory.\n */\nasync function loadProfile(rt: CliRuntime, opts: GlobalOptions): Promise<{ profile: SsoProfile; profileName: string; configDir: string }> {\n const { profileName, configDir } = resolveProfile(opts);\n const profile = await loadSsoProfile(configDir, profileName);\n\n return { profile, profileName, configDir };\n}\n\n/**\n * Register the `auth` command group (login, logout, status, refresh)\n * on the given Commander program.\n *\n * @param program - Root Commander program.\n * @param rt - CLI runtime for I/O.\n */\nexport function register(program: Command, rt: CliRuntime): void {\n const group = program.command(\"auth\").description(\"SSO authentication (login/logout/status/refresh).\");\n\n // ── login ─────────────────────────────────────────────────────────────\n group\n .command(\"login\")\n .description(\"Authenticate via SSO using Authorization Code + PKCE flow.\")\n .option(\"--port <port>\", \"Local callback port\", String(DEFAULT_CALLBACK_PORT))\n .option(\"--no-browser\", \"Print the URL instead of opening a browser\")\n .action(async (opts: { port?: string; browser?: boolean }) => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const { profile, profileName, configDir } = await loadProfile(rt, globalOpts);\n\n const port = parseInt(opts.port ?? String(DEFAULT_CALLBACK_PORT), 10);\n if (!Number.isInteger(port) || port < 1 || port > 65535) {\n throw new Error(`Invalid port: ${opts.port}. Must be an integer between 1 and 65535.`);\n }\n const redirectUri = `http://localhost:${port}/callback`;\n\n const codeVerifier = generateCodeVerifier();\n const codeChallenge = computeCodeChallenge(codeVerifier);\n const state = randomBytes(16).toString(\"hex\");\n\n const authUrl = new URL(`https://${profile.ssoDomain}/oauth2/authorize`);\n authUrl.searchParams.set(\"response_type\", \"code\");\n authUrl.searchParams.set(\"client_id\", profile.ssoClientId);\n authUrl.searchParams.set(\"redirect_uri\", redirectUri);\n authUrl.searchParams.set(\"scope\", \"openid profile email\");\n authUrl.searchParams.set(\"state\", state);\n authUrl.searchParams.set(\"code_challenge\", codeChallenge);\n authUrl.searchParams.set(\"code_challenge_method\", \"S256\");\n\n const authUrlStr = authUrl.toString();\n\n // Start callback server before opening browser\n const codePromise = waitForAuthCode(port, state);\n\n if (opts.browser !== false) {\n // Open browser\n const { spawn } = await import(\"node:child_process\");\n const openCmd = process.platform === \"darwin\"\n ? { cmd: \"open\", args: [authUrlStr] }\n : process.platform === \"win32\"\n ? { cmd: \"cmd\", args: [\"/c\", \"start\", \"\", authUrlStr] }\n : { cmd: \"xdg-open\", args: [authUrlStr] };\n spawn(openCmd.cmd, openCmd.args, { stdio: \"ignore\", detached: true }).unref();\n rt.writeErr(`Opening browser for authentication...\\n`);\n } else {\n rt.writeErr(`Open this URL in your browser:\\n\\n${authUrlStr}\\n\\n`);\n }\n\n rt.writeErr(\"Waiting for authentication callback...\\n\");\n\n const { code, cleanup } = await codePromise;\n\n let tokens: Awaited<ReturnType<typeof exchangeCodeForTokens>>;\n try {\n rt.writeErr(\"Exchanging code for tokens...\\n\");\n tokens = await exchangeCodeForTokens(profile, code, codeVerifier, redirectUri);\n await writeSsoCache(configDir, profile, tokens);\n } finally {\n cleanup();\n }\n\n // Resolve the account ID from /me and persist it in the config\n let accountId = profile.ssoAccountId;\n try {\n rt.writeErr(\"Resolving account ID...\\n\");\n accountId = await fetchAccountId(tokens.accessToken);\n await updateConfigKey(configDir, profileName, \"sso_account_id\", accountId);\n } catch {\n rt.writeErr(\"Warning: Could not resolve account ID from /me. You can set it manually with `seclai configure sso`.\\n\");\n }\n\n rt.writeErr(\"Successfully authenticated!\\n\");\n const loginResult: Record<string, string> = {\n status: \"authenticated\",\n profile: profileName,\n expiresAt: tokens.expiresAt,\n };\n if (accountId) loginResult.accountId = accountId;\n printJson(rt, loginResult);\n });\n });\n\n // ── logout ────────────────────────────────────────────────────────────\n group\n .command(\"logout\")\n .description(\"Remove cached SSO tokens for the current profile.\")\n .action(async () => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const { profile, profileName, configDir } = await loadProfile(rt, globalOpts);\n\n await deleteSsoCache(configDir, profile);\n\n rt.writeErr(\"Logged out successfully.\\n\");\n printJson(rt, { status: \"logged_out\", profile: profileName });\n });\n });\n\n // ── status ────────────────────────────────────────────────────────────\n group\n .command(\"status\")\n .description(\"Show current authentication status for the active profile.\")\n .action(async () => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const { profile: profileLoaded, profileName, configDir } = await loadProfile(rt, globalOpts);\n\n const cached = await readSsoCache(configDir, profileLoaded);\n if (!cached) {\n const notAuthResult: Record<string, string> = {\n profile: profileName,\n status: \"not_authenticated\",\n };\n if (profileLoaded.ssoAccountId) notAuthResult.accountId = profileLoaded.ssoAccountId;\n printJson(rt, notAuthResult);\n return;\n }\n\n const valid = isTokenValid(cached);\n const statusResult: Record<string, string | boolean> = {\n profile: profileName,\n status: valid ? \"authenticated\" : \"expired\",\n expiresAt: cached.expiresAt,\n hasRefreshToken: Boolean(cached.refreshToken),\n };\n if (profileLoaded.ssoAccountId) statusResult.accountId = profileLoaded.ssoAccountId;\n printJson(rt, statusResult);\n });\n });\n\n // ── refresh ───────────────────────────────────────────────────────────\n group\n .command(\"refresh\")\n .description(\"Manually refresh the SSO token for the current profile.\")\n .action(async () => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const { profile, profileName, configDir } = await loadProfile(rt, globalOpts);\n\n const cached = await readSsoCache(configDir, profile);\n if (!cached?.refreshToken) {\n throw new Error(\"No cached token with refresh token. Run `seclai auth login` first.\");\n }\n\n const tokenUrl = `https://${profile.ssoDomain}/oauth2/token`;\n const body = new URLSearchParams({\n grant_type: \"refresh_token\",\n client_id: profile.ssoClientId,\n refresh_token: cached.refreshToken,\n });\n\n const resp = await fetch(tokenUrl, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body: body.toString(),\n });\n\n if (!resp.ok) {\n const text = await resp.text();\n throw new Error(`Token refresh failed (HTTP ${resp.status}): ${text}`);\n }\n\n const data = (await resp.json()) as {\n access_token: string;\n id_token?: string;\n refresh_token?: string;\n expires_in: number;\n };\n\n const refreshed: SsoCacheEntry = {\n accessToken: data.access_token,\n refreshToken: data.refresh_token ?? cached.refreshToken,\n expiresAt: new Date(Date.now() + data.expires_in * 1000).toISOString(),\n clientId: profile.ssoClientId,\n region: profile.ssoRegion,\n cognitoDomain: profile.ssoDomain,\n };\n if (data.id_token) refreshed.idToken = data.id_token;\n\n await writeSsoCache(configDir, profile, refreshed);\n\n rt.writeErr(\"Token refreshed successfully.\\n\");\n printJson(rt, {\n status: \"refreshed\",\n profile: profileName,\n expiresAt: refreshed.expiresAt,\n });\n });\n });\n}\n","/**\n * CLI profile configuration commands — interactive SSO profile setup.\n *\n * @module\n */\nimport { Command } from \"commander\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport process from \"node:process\";\nimport { createInterface } from \"node:readline\";\n\nimport { type CliRuntime, type GlobalOptions, printJson, run } from \"../helpers.js\";\nimport { DEFAULT_SSO_DOMAIN, DEFAULT_SSO_CLIENT_ID, DEFAULT_SSO_REGION } from \"@seclai/sdk\";\n\n/**\n * Prompt the user for input with an optional default value.\n *\n * @param rt - CLI runtime for I/O.\n * @param question - Prompt text.\n * @param defaultValue - Default used when user presses Enter without typing.\n * @returns The user's answer (or the default).\n */\nfunction prompt(rt: CliRuntime, question: string, defaultValue?: string): Promise<string> {\n return new Promise((resolve) => {\n const rl = createInterface({\n input: rt.stdin,\n output: { write: (s: string) => { rt.writeErr(s); return true; } } as unknown as NodeJS.WritableStream,\n terminal: false,\n });\n\n const display = defaultValue ? `${question} [${defaultValue}]: ` : `${question}: `;\n rt.writeErr(display);\n\n rl.once(\"line\", (answer) => {\n rl.close();\n resolve(answer.trim() || defaultValue || \"\");\n });\n });\n}\n\n/** Resolve the config directory from global options or environment. */\nfunction resolveConfigDir(opts: GlobalOptions): string {\n if (opts.configDir) return opts.configDir;\n const env = process.env.SECLAI_CONFIG_DIR;\n if (env) return env;\n const home = process.env.HOME ?? process.env.USERPROFILE ?? \"\";\n return join(home, \".seclai\");\n}\n\n/**\n * Register the `configure` command group on the given Commander program.\n *\n * @param program - Root Commander program.\n * @param rt - CLI runtime for I/O.\n */\nexport function register(program: Command, rt: CliRuntime): void {\n const group = program.command(\"configure\").description(\"Configure CLI profiles and settings.\");\n\n // ── sso ───────────────────────────────────────────────────────────────\n group\n .command(\"sso\")\n .description(\"Configure an SSO profile with optional overrides. Defaults to production Seclai SSO.\")\n .option(\"--profile-name <name>\", \"Profile name to configure (default: from --profile flag)\")\n .action(async (opts: { profileName?: string }) => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const profileName = opts.profileName || globalOpts.profile || \"default\";\n const configDir = resolveConfigDir(globalOpts);\n const configPath = join(configDir, \"config\");\n\n rt.writeErr(`\\nConfiguring SSO profile \"${profileName}\".\\n`);\n rt.writeErr(`Defaults: domain=${DEFAULT_SSO_DOMAIN}, region=${DEFAULT_SSO_REGION}\\n`);\n rt.writeErr(`Press Enter to accept defaults.\\n\\n`);\n\n const domain = await prompt(rt, \"SSO domain\", DEFAULT_SSO_DOMAIN);\n const clientId = await prompt(rt, \"SSO client ID\", DEFAULT_SSO_CLIENT_ID);\n const region = await prompt(rt, \"SSO region\", DEFAULT_SSO_REGION);\n const accountId = await prompt(rt, \"Account ID (optional, resolved after login)\");\n\n // Only write config if something differs from defaults\n const isDefault = domain === DEFAULT_SSO_DOMAIN\n && clientId === DEFAULT_SSO_CLIENT_ID\n && region === DEFAULT_SSO_REGION\n && !accountId;\n\n if (isDefault && profileName === \"default\") {\n rt.writeErr(`\\nUsing built-in defaults — no config file needed.\\n`);\n rt.writeErr(`Run \\`seclai auth login\\` to authenticate.\\n`);\n printJson(rt, {\n profile: profileName,\n sso_domain: domain,\n sso_client_id: clientId,\n sso_region: region,\n note: \"using built-in defaults\",\n });\n return;\n }\n\n // Read existing config or start fresh\n let content = \"\";\n try {\n content = await readFile(configPath, \"utf-8\");\n } catch {\n // file doesn't exist\n }\n\n // Build the section — only write keys that differ from defaults\n const sectionHeader = profileName === \"default\"\n ? \"[default]\"\n : `[profile ${profileName}]`;\n\n const lines: string[] = [];\n if (domain !== DEFAULT_SSO_DOMAIN) lines.push(`sso_domain = ${domain}`);\n if (clientId !== DEFAULT_SSO_CLIENT_ID) lines.push(`sso_client_id = ${clientId}`);\n if (region !== DEFAULT_SSO_REGION) lines.push(`sso_region = ${region}`);\n if (accountId) lines.push(`sso_account_id = ${accountId}`);\n const sectionBody = lines.join(\"\\n\");\n\n // Check if section already exists and replace it\n const sectionRegex = profileName === \"default\"\n ? /^\\[default\\][^\\[]*(?=\\[|$(?![\\s\\S]))/m\n : new RegExp(`^\\\\[profile ${escapeRegExp(profileName)}\\\\][^\\\\[]*(?=\\\\[|$(?![\\\\s\\\\S]))`, \"m\");\n\n if (sectionRegex.test(content)) {\n content = content.replace(sectionRegex, `${sectionHeader}\\n${sectionBody}\\n`);\n } else {\n if (content.length > 0 && !content.endsWith(\"\\n\")) {\n content += \"\\n\";\n }\n content += `\\n${sectionHeader}\\n${sectionBody}\\n`;\n }\n\n await mkdir(configDir, { recursive: true });\n await writeFile(configPath, content, { mode: 0o600 });\n\n rt.writeErr(`\\nProfile \"${profileName}\" saved to ${configPath}\\n`);\n rt.writeErr(`Run \\`seclai auth login --profile ${profileName}\\` to authenticate.\\n`);\n\n const result: Record<string, string> = {\n profile: profileName,\n configFile: configPath,\n sso_domain: domain,\n sso_client_id: clientId,\n sso_region: region,\n };\n if (accountId) result.sso_account_id = accountId;\n printJson(rt, result);\n });\n });\n\n // ── list ──────────────────────────────────────────────────────────────\n group\n .command(\"list\")\n .description(\"List all configured profiles.\")\n .action(async () => {\n await run(rt, async () => {\n const globalOpts = program.opts<GlobalOptions>();\n const configDir = resolveConfigDir(globalOpts);\n const configPath = join(configDir, \"config\");\n\n let content: string;\n try {\n content = await readFile(configPath, \"utf-8\");\n } catch {\n printJson(rt, { profiles: [], configFile: configPath });\n return;\n }\n\n // Parse profile names from section headers\n const profiles: string[] = [];\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"[\") && trimmed.endsWith(\"]\")) {\n const raw = trimmed.slice(1, -1).trim();\n if (raw.startsWith(\"profile \")) {\n profiles.push(raw.slice(\"profile \".length).trim());\n } else {\n profiles.push(raw);\n }\n }\n }\n\n printJson(rt, { profiles, configFile: configPath });\n });\n });\n}\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,EAAAA,WAAY,SAAS,EAAE;AACvB,EAAAA,WAAmB,SAAS,EAAE;AAC9B,EAAAA,WAAa,SAAS,EAAE;AACxB,EAAAA,WAAkB,SAAS,EAAE;AAE7B,SAAO;AACT;AAMA,eAAsB,OAAO,MAAgB,KAAiB,eAAe,GAAoB;AAC/F,MAAI,mBAAmB;AACvB,QAAM,YAAwB;AAAA,IAC5B,GAAG;AAAA,IACH,aAAa,CAAC,SAAS;AACrB,yBAAmB;AACnB,SAAG,YAAY,IAAI;AAAA,IACrB;AAAA,EACF;AAEA,QAAM,UAAU,cAAc,SAAS;AACvC,MAAI,WAAW;AAEf,MAAI;AACF,UAAM,QAAQ,WAAW,IAAI;AAAA,EAC/B,SAAS,KAAU;AACjB,UAAM,gBAAgB,OAAO,KAAK,aAAa,WAAW,IAAI,WAAW;AACzE,QAAI,kBAAkB,QAAW;AAC/B,iBAAW;AAAA,IACb,OAAO;AACL,iBAAW,WAAW,GAAG;AACzB,iBAAW;AAAA,IACb;AAAA,EACF;AAEA,QAAM,gBAAgB,qBAAqB,IAAI,mBAAmB;AAClE,YAAU,YAAY,aAAa;AACnC,SAAO;AACT;AAGA,IAAI,QAAQ,KAAK,CAAC,GAAG;AACnB,MAAI;AACF,UAAM,YAAY,aAAa,QAAQ,KAAK,CAAC,CAAC;AAC9C,UAAM,WAAW,aAAa,cAAc,YAAY,GAAG,CAAC;AAC5D,QAAI,cAAc,UAAU;AAC1B,YAAM,OAAO,QAAQ,IAAI;AAAA,IAC3B;AAAA,EACF,QAAQ;AACN,UAAM,YAAY,cAAc,QAAQ,KAAK,CAAC,CAAC,EAAE;AACjD,QAAI,YAAY,QAAQ,WAAW;AACjC,YAAM,OAAO,QAAQ,IAAI;AAAA,IAC3B;AAAA,EACF;AACF;","names":["Command","process","writeFile","readFile","register","register","register","register","register","register","register","register","register","register","register","register","register","register","existsSync","mkdir","readFile","writeFile","dirname","join","join","existsSync","readFile","mkdir","dirname","writeFile","register","register","readFile","writeFile","join","URL","process","URL","process","join","readFile","mkdir","writeFile","register","mkdir","readFile","writeFile","join","process","process","join","register","readFile","mkdir","writeFile","Command","register"]}
|