@keystrokehq/cli 0.0.173 → 0.0.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{dist-15bo-pXZ.mjs → dist-Cn8Feaea.mjs} +1 -1
- package/dist/{dist-DSbaw33D.mjs → dist-DEnhPwK2.mjs} +2 -2
- package/dist/{dist-DSbaw33D.mjs.map → dist-DEnhPwK2.mjs.map} +1 -1
- package/dist/{dist-BQ5MoLdP.mjs → dist-DdjMxlbo.mjs} +4 -4
- package/dist/{dist-BQ5MoLdP.mjs.map → dist-DdjMxlbo.mjs.map} +1 -1
- package/dist/{dist-CzDlf0Ky.mjs → dist-XVz5PFMT.mjs} +14 -17
- package/dist/{dist-CzDlf0Ky.mjs.map → dist-XVz5PFMT.mjs.map} +1 -1
- package/dist/index.mjs +9 -9
- package/dist/{maybe-auto-update-C2DQhsoc.mjs → maybe-auto-update-BSNK7v0U.mjs} +2 -2
- package/dist/{maybe-auto-update-C2DQhsoc.mjs.map → maybe-auto-update-BSNK7v0U.mjs.map} +1 -1
- package/dist/{version-gi_vugBv.mjs → version-BErvF1mh.mjs} +2 -2
- package/dist/{version-gi_vugBv.mjs.map → version-BErvF1mh.mjs.map} +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $t as normalizeCredentialList, an as custom, cn as object, dn as toJSONSchema, ht as PromptResponseSchema, in as array, ln as string, mt as PromptInputSchema, nn as ZodType, on as discriminatedUnion, rn as _function, sn as literal, un as union, vt as ROUTE_MANIFEST_REL_PATH } from "./dist-
|
|
2
|
+
import { $t as normalizeCredentialList, an as custom, cn as object, dn as toJSONSchema, ht as PromptResponseSchema, in as array, ln as string, mt as PromptInputSchema, nn as ZodType, on as discriminatedUnion, rn as _function, sn as literal, un as union, vt as ROUTE_MANIFEST_REL_PATH } from "./dist-XVz5PFMT.mjs";
|
|
3
3
|
import { dirname, join, relative, sep } from "node:path";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
@@ -772,4 +772,4 @@ async function emitStoredRouteManifestForProject(projectRoot) {
|
|
|
772
772
|
//#endregion
|
|
773
773
|
export { webhookMatchSchemaForBindings as A, walkTypeScriptFiles as B, serializeRouteManifest as C, validateImportedTriggerAttachment as D, triggerRunsListPath as E, discoverEntries as F, discoverModuleFileEntries as I, entryIdFromFile as L, workflowRouteFromKey as M, workflowRunDetailPath as N, validateImportedWorkflowDefinition as O, workflowRunsListPath as P, readKeystrokeIgnoreDirective as R, schemaToJson as S, triggerRunDetailPath as T, importWorkflowDefinition as _, buildStoredRouteManifestForProject as a, pollGroupRouteFromId as b, countAgentCredentials as c, discoverTriggerAttachments as d, discoverWorkflowEntries as f, importTriggerAttachment as g, importAgentDefinition as h, buildPollGroups as i, webhookRouteFromEndpoint as j, webhookManifestAttachmentSchemasFromBindings as k, discoverAgentEntries as l, emitStoredRouteManifestForProject as m, agentSessionDetailPath as n, buildStoredRouteManifestFromContext as o, discoverWorkflows as p, agentSessionsListPath as r, buildWebhookBindingsByRoute as s, agentRouteFromKey as t, discoverSkillManifestEntries as u, persistStoredRouteManifest as v, toStoredRouteManifest as w, pollRouteFromKey as x, pollGroupId as y, shouldSkipKeystrokeModuleFile as z };
|
|
774
774
|
|
|
775
|
-
//# sourceMappingURL=dist-
|
|
775
|
+
//# sourceMappingURL=dist-DEnhPwK2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dist-DSbaw33D.mjs","names":["z.toJSONSchema","z.custom","z.ZodType","z.string","z.union","z.function","z.object","z.literal","z.array","z.discriminatedUnion"],"sources":["../../../packages/manifest/dist/discovery-CWjr_liZ.mjs","../../../packages/manifest/dist/index.mjs"],"sourcesContent":["import { join, relative, sep } from \"node:path\";\nimport { readdir, stat } from \"node:fs/promises\";\nimport { readFileSync } from \"node:fs\";\n//#region src/discovery/entry-from-file.ts\nconst SOURCE_EXT = /\\.(ts|mts|mjs|js)$/;\nconst DECLARATION_FILE$1 = /\\.d\\.(ts|mts|cts)$/;\nfunction entryIdFromFile(rootDir, filePath, options) {\n\tif (DECLARATION_FILE$1.test(filePath)) return null;\n\tconst baseName = filePath.split(sep).at(-1) ?? \"\";\n\tif (/\\.(int\\.)?test\\.(ts|mts)$/.test(baseName)) return null;\n\tconst segments = relative(rootDir, filePath).replace(SOURCE_EXT, \"\").split(sep).filter((segment) => segment.length > 0);\n\tif (segments.length === 1) return segments[0] ?? null;\n\tconst last = segments.at(-1);\n\tconst entryNames = new Set([options.nestedEntry]);\n\tif (options.allowIndex !== false) entryNames.add(\"index\");\n\tif (!last || !entryNames.has(last)) return null;\n\tconst id = segments.slice(0, -1).join(\"/\");\n\treturn id.length > 0 ? id : null;\n}\n//#endregion\n//#region src/discovery/walk-typescript-files.ts\nconst SOURCE_FILE = /\\.(ts|mts|mjs|js)$/;\nconst TEST_FILE = /\\.(int\\.)?test\\.(ts|mts)$/;\nconst DECLARATION_FILE = /\\.d\\.(ts|mts|cts)$/;\nconst JUNK_FILE = /^\\._|\\.DS_Store$/;\nasync function walkTypeScriptFiles(dir) {\n\tlet names;\n\ttry {\n\t\tnames = await readdir(dir);\n\t} catch (error) {\n\t\tif (error.code === \"ENOENT\") return [];\n\t\tthrow error;\n\t}\n\tconst files = [];\n\tfor (const name of names) {\n\t\tconst path = join(dir, name);\n\t\tif ((await stat(path)).isDirectory()) files.push(...await walkTypeScriptFiles(path));\n\t\telse if (!JUNK_FILE.test(name) && SOURCE_FILE.test(name) && !DECLARATION_FILE.test(name) && !TEST_FILE.test(name)) files.push(path);\n\t}\n\treturn files;\n}\n//#endregion\n//#region src/discovery/discover-entries.ts\nasync function discoverEntries(rootDir, options) {\n\tconst files = await walkTypeScriptFiles(rootDir);\n\tconst byKey = /* @__PURE__ */ new Map();\n\tfor (const filePath of files) {\n\t\tconst id = entryIdFromFile(rootDir, filePath, options);\n\t\tif (!id) continue;\n\t\tconst key = options.formatKey(id);\n\t\tconst moduleFile = relative(rootDir, filePath);\n\t\tconst existing = byKey.get(key);\n\t\tif (existing) throw new Error(`Duplicate ${options.duplicateLabel} ${key}: ${existing.filePath} and ${filePath}`);\n\t\tbyKey.set(key, {\n\t\t\tkey,\n\t\t\tfilePath,\n\t\t\tmoduleFile\n\t\t});\n\t}\n\treturn [...byKey.values()];\n}\n//#endregion\n//#region src/discovery/discover-module-entries.ts\nasync function discoverModuleFileEntries(rootDir, options) {\n\treturn (await discoverEntries(rootDir, {\n\t\tnestedEntry: options.nestedEntry,\n\t\tformatKey: (id) => id,\n\t\tduplicateLabel: options.duplicateLabel\n\t})).filter((entry) => options.shouldDiscoverFile?.(entry.filePath) ?? true).map(({ filePath, moduleFile }) => ({\n\t\tfilePath,\n\t\tmoduleFile\n\t}));\n}\nfunction moduleFileKeyFromPath(rootDir, filePath, nestedEntry) {\n\treturn entryIdFromFile(rootDir, filePath, { nestedEntry });\n}\n//#endregion\n//#region src/discovery/keystroke-ignore-directive.ts\nconst HEADER_BYTES = 2048;\nconst DIRECTIVE_RE = /@keystroke\\s+ignore(?::([a-z]+))?/;\n/** Parse `@keystroke ignore` directives from a file header snippet. */\nfunction parseKeystrokeIgnoreDirective(header) {\n\tfor (const line of header.slice(0, HEADER_BYTES).split(\"\\n\")) {\n\t\tconst trimmed = line.trim();\n\t\tif (trimmed.length === 0) continue;\n\t\tif (!isCommentLine(trimmed)) break;\n\t\tconst match = DIRECTIVE_RE.exec(trimmed);\n\t\tif (!match) continue;\n\t\tconst scope = match[1];\n\t\tif (!scope) return \"ignore\";\n\t\tif (scope === \"deploy\") return \"ignore:deploy\";\n\t\tthrow new Error(`Unknown @keystroke ignore target \"${scope}\" in directive \"@keystroke ignore:${scope}\"`);\n\t}\n\treturn null;\n}\n/** Read `@keystroke ignore` directives from the top of a module file. */\nfunction readKeystrokeIgnoreDirective(filePath) {\n\treturn parseKeystrokeIgnoreDirective(readFileSync(filePath, \"utf8\").slice(0, HEADER_BYTES));\n}\n/** Whether a discovered module file should be skipped for the given build phase. */\nfunction shouldSkipKeystrokeModuleFile(directive, phase) {\n\tif (!directive) return false;\n\tif (directive === \"ignore\") return true;\n\treturn phase === \"deploy\";\n}\nfunction isCommentLine(line) {\n\treturn line.startsWith(\"//\") || line.startsWith(\"/*\") || line.startsWith(\"*\");\n}\n//#endregion\n//#region src/discovery/validate-unique-module-keys.ts\nfunction validateUniqueModuleKeys(entries) {\n\tconst byKey = /* @__PURE__ */ new Map();\n\tfor (const entry of entries) {\n\t\tconst list = byKey.get(entry.key) ?? [];\n\t\tlist.push(entry);\n\t\tbyKey.set(entry.key, list);\n\t}\n\tfor (const [key, clashes] of byKey) {\n\t\tif (clashes.length <= 1) continue;\n\t\tconst detail = clashes.map((entry) => `${entry.kind} (${entry.filePath})`).join(\", \");\n\t\tthrow new Error(`Duplicate module key \"${key}\": ${detail}`);\n\t}\n}\n//#endregion\nexport { discoverModuleFileEntries as a, walkTypeScriptFiles as c, shouldSkipKeystrokeModuleFile as i, entryIdFromFile as l, parseKeystrokeIgnoreDirective as n, moduleFileKeyFromPath as o, readKeystrokeIgnoreDirective as r, discoverEntries as s, validateUniqueModuleKeys as t };\n\n//# sourceMappingURL=discovery-CWjr_liZ.mjs.map","import { a as discoverModuleFileEntries, c as walkTypeScriptFiles, l as entryIdFromFile, o as moduleFileKeyFromPath, s as discoverEntries, t as validateUniqueModuleKeys } from \"./discovery-CWjr_liZ.mjs\";\nimport { pathToFileURL } from \"node:url\";\nimport { dirname, join, relative, sep } from \"node:path\";\nimport { PromptInputSchema, PromptResponseSchema, ROUTE_MANIFEST_REL_PATH, normalizeCredentialList, parseStoredRouteManifest } from \"@keystrokehq/shared\";\nimport { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from \"node:fs\";\nimport { z } from \"zod\";\n//#region src/guards/agent.ts\nfunction isManifestAgent(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst agent = value;\n\treturn typeof agent.slug === \"string\" && agent.slug.trim().length > 0 && typeof agent.buildRuntime === \"function\" && typeof agent.model === \"string\" && typeof agent.systemPrompt === \"string\";\n}\nfunction validateManifestAgent(value, filePath) {\n\tif (!isManifestAgent(value)) throw new Error(`${filePath} must default-export defineAgent(...)`);\n\treturn value;\n}\n//#endregion\n//#region src/routes.ts\nfunction normalizeWebhookEndpoint(endpoint) {\n\treturn endpoint.replace(/^\\/+|\\/+$/g, \"\").replace(/^triggers\\/?/, \"\");\n}\nfunction agentRouteFromKey(key) {\n\treturn `/agents/${key}`;\n}\nfunction agentSessionsListPath(route) {\n\treturn `${route}/sessions`;\n}\nfunction agentSessionDetailPath(route) {\n\treturn `${route}/sessions/:sessionId`;\n}\nfunction workflowRouteFromKey(key) {\n\treturn `/workflows/${key}`;\n}\nfunction workflowRunsListPath(route) {\n\treturn `${route}/runs`;\n}\nfunction workflowRunDetailPath(route) {\n\treturn `${route}/runs/:runId`;\n}\nfunction triggerRunsListPath(attachmentKey) {\n\treturn `/triggers/${attachmentKey}/runs`;\n}\nfunction triggerRunDetailPath(attachmentKey) {\n\treturn `/triggers/${attachmentKey}/runs/:runId`;\n}\nfunction pollRouteFromKey(attachmentKey) {\n\treturn `/triggers/${attachmentKey}/poll`;\n}\nfunction pollGroupRouteFromId(pollId) {\n\treturn `/triggers/polls/${pollId}/run`;\n}\nfunction webhookRouteFromEndpoint(endpoint) {\n\tconst normalized = normalizeWebhookEndpoint(endpoint);\n\tif (!normalized) throw new Error(\"Webhook endpoint must not be empty\");\n\treturn `/triggers/${normalized}`;\n}\n//#endregion\n//#region src/agents/discover.ts\nasync function discoverAgentEntries(agentsDir, options) {\n\tconst files = await discoverModuleFileEntries(agentsDir, {\n\t\tnestedEntry: \"agent\",\n\t\tduplicateLabel: \"agent module file\"\n\t});\n\tconst entries = [];\n\tfor (const { filePath, moduleFile } of files) {\n\t\tconst agent = await importAgentDefinition(filePath, options);\n\t\tentries.push({\n\t\t\tkey: agent.slug,\n\t\t\troute: agentRouteFromKey(agent.slug),\n\t\t\tfilePath,\n\t\t\tmoduleFile\n\t\t});\n\t}\n\treturn entries;\n}\nasync function importAgentDefinition(filePath, options) {\n\tconst href = pathToFileURL(filePath).href;\n\treturn validateManifestAgent((await (options?.reload ? import(`${href}?keystroke=${Date.now()}`) : import(href))).default, filePath);\n}\n//#endregion\n//#region src/guards/action.ts\nconst ACTION = Symbol.for(\"keystroke.action\");\nfunction isManifestAction(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\treturn ACTION in value && value[ACTION] === true;\n}\nfunction getManifestActionCredentialRequirements(action) {\n\treturn Array.isArray(action.credentials) ? action.credentials : void 0;\n}\n//#endregion\n//#region src/agents/count-agent-credentials.ts\nfunction countAgentCredentials(agent) {\n\tconst keys = /* @__PURE__ */ new Set();\n\tfor (const tool of agent.tools ?? []) {\n\t\tconst record = tool;\n\t\tconst requirements = isManifestAction(tool) ? getManifestActionCredentialRequirements(tool) : \"credentials\" in record && Array.isArray(record.credentials) ? record.credentials : void 0;\n\t\tif (!requirements?.length) continue;\n\t\tfor (const requirement of normalizeCredentialList(requirements)) keys.add(requirement.key);\n\t}\n\treturn keys.size;\n}\n//#endregion\n//#region src/skills/discover-manifest-entries.ts\nconst SKIP_DIRS = new Set([\".git\", \"node_modules\"]);\nfunction toPosix$1(path) {\n\treturn path.split(sep).join(\"/\");\n}\nfunction parseSkillFrontmatter(raw) {\n\tconst match = raw.match(/^---\\s*\\n([\\s\\S]*?)\\n---/);\n\tif (!match) return {};\n\tconst out = {};\n\tfor (const line of match[1]?.split(\"\\n\") ?? []) {\n\t\tconst trimmed = line.trim();\n\t\tif (!trimmed || trimmed.startsWith(\"#\")) continue;\n\t\tconst colon = trimmed.indexOf(\":\");\n\t\tif (colon < 0) continue;\n\t\tconst key = trimmed.slice(0, colon).trim();\n\t\tlet value = trimmed.slice(colon + 1).trim();\n\t\tif (value.startsWith(\"\\\"\") && value.endsWith(\"\\\"\") || value.startsWith(\"'\") && value.endsWith(\"'\")) value = value.slice(1, -1);\n\t\tif (key === \"name\") out.name = value;\n\t\telse if (key === \"description\") out.description = value;\n\t}\n\treturn out;\n}\nfunction walkSkillFiles(root, dir, out) {\n\tfor (const name of readdirSync(dir).sort()) {\n\t\tconst absolute = join(dir, name);\n\t\tconst stats = statSync(absolute);\n\t\tif (stats.isDirectory()) {\n\t\t\tif (SKIP_DIRS.has(name)) continue;\n\t\t\twalkSkillFiles(root, absolute, out);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!stats.isFile() || name !== \"SKILL.md\") continue;\n\t\tconst moduleFile = toPosix$1(relative(root, absolute));\n\t\tconst slug = toPosix$1(relative(join(root, \"src\", \"skills\"), absolute)).replace(/\\/?SKILL\\.md$/, \"\");\n\t\tif (!slug) continue;\n\t\tconst frontmatter = parseSkillFrontmatter(readFileSync(absolute, \"utf8\"));\n\t\tout.push({\n\t\t\tslug,\n\t\t\tname: frontmatter.name,\n\t\t\tdescription: frontmatter.description,\n\t\t\tmoduleFile\n\t\t});\n\t}\n}\n/** Discover skill metadata from src/skills SKILL.md files for the route manifest. */\nfunction discoverSkillManifestEntries(projectRoot) {\n\tconst skillsDir = join(projectRoot, \"src\", \"skills\");\n\tif (!statSync(skillsDir, { throwIfNoEntry: false })?.isDirectory()) return [];\n\tconst entries = [];\n\twalkSkillFiles(projectRoot, skillsDir, entries);\n\treturn entries;\n}\n//#endregion\n//#region src/openapi/schema-to-json.ts\nfunction schemaToJson(schema) {\n\treturn z.toJSONSchema(schema, { target: \"openapi-3.0\" });\n}\n//#endregion\n//#region src/openapi/serialize-manifest.ts\nfunction collectIntegrationKeys(integrations) {\n\treturn integrations.map((integration) => integration.key);\n}\nfunction serializeRouteManifest(manifest) {\n\treturn manifest.map((entry) => {\n\t\tswitch (entry.kind) {\n\t\t\tcase \"health\": return entry;\n\t\t\tcase \"agent\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tagentSlug: entry.agentSlug,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\tname: entry.name,\n\t\t\t\tdescription: entry.description,\n\t\t\t\tmodel: entry.model,\n\t\t\t\tsystemPrompt: entry.systemPrompt,\n\t\t\t\ttoolCount: entry.toolCount,\n\t\t\t\tcredentialCount: entry.credentialCount,\n\t\t\t\trequestSchema: schemaToJson(entry.request),\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"workflow\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tworkflowSlug: entry.workflowSlug,\n\t\t\t\tworkflowName: entry.workflowName,\n\t\t\t\tdescription: entry.description,\n\t\t\t\tsubscribable: entry.subscribable,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\trequestSchema: schemaToJson(entry.request),\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"trigger-webhook\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tattachmentIds: entry.attachmentIds,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\trequestSchema: schemaToJson(entry.request),\n\t\t\t\tattachmentSchemas: Object.fromEntries(Object.entries(entry.attachmentSchemas).map(([attachmentKey, schemas]) => [attachmentKey, {\n\t\t\t\t\trequestSchema: schemaToJson(schemas.request),\n\t\t\t\t\t...schemas.filter ? { filterSchema: schemaToJson(schemas.filter) } : {}\n\t\t\t\t}])),\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"trigger-poll\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tattachmentId: entry.attachmentId,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\tschedule: entry.schedule,\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"trigger-poll-group\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tpollId: entry.pollId,\n\t\t\t\tattachmentIds: entry.attachmentIds,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\tschedule: entry.schedule,\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"plugin\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tplugin: entry.plugin\n\t\t\t};\n\t\t\tdefault: return entry;\n\t\t}\n\t});\n}\nfunction toStoredRouteManifest(manifest, options) {\n\treturn {\n\t\tversion: 1,\n\t\tentries: serializeRouteManifest(manifest),\n\t\tskills: options?.skills ?? [],\n\t\tintegrations: options?.integrations\n\t};\n}\nfunction buildStoredRouteManifestFromContext(ctx) {\n\tconst integrations = ctx.options?.integrations ?? ctx.options?.plugins?.map((plugin) => ({\n\t\tkey: plugin.name,\n\t\tmount: plugin.register\n\t})) ?? [];\n\treturn toStoredRouteManifest(ctx.manifest, {\n\t\tintegrations: collectIntegrationKeys(integrations),\n\t\tskills: ctx.skills ?? (ctx.projectRoot ? discoverSkillManifestEntries(ctx.projectRoot) : void 0) ?? []\n\t});\n}\nfunction findWorkflowManifestEntry(manifest, workflowSlug) {\n\treturn manifest.entries.find((entry) => entry.kind === \"workflow\" && entry.workflowSlug === workflowSlug);\n}\nfunction findWebhookManifestEntryByPath(manifest, route) {\n\treturn manifest.entries.find((entry) => entry.kind === \"trigger-webhook\" && entry.path === route);\n}\n//#endregion\n//#region src/persist.ts\nfunction persistStoredRouteManifest(projectRoot, manifest) {\n\tconst path = join(projectRoot, ROUTE_MANIFEST_REL_PATH);\n\tmkdirSync(dirname(path), { recursive: true });\n\twriteFileSync(path, `${JSON.stringify(manifest, null, 2)}\\n`);\n}\n//#endregion\n//#region src/guards/workflow.ts\nconst WORKFLOW = Symbol.for(\"keystroke.workflow\");\nfunction isManifestWorkflow(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(WORKFLOW in value) || value[WORKFLOW] !== true) return false;\n\tconst workflow = value;\n\treturn typeof workflow.slug === \"string\" && workflow.slug.trim().length > 0 && workflow.input instanceof Object && \"safeParse\" in workflow.input && workflow.output instanceof Object && \"safeParse\" in workflow.output;\n}\nfunction validateManifestWorkflow(value, filePath) {\n\tif (!isManifestWorkflow(value)) throw new Error(`${filePath} must default-export defineWorkflow(...)`);\n\treturn value;\n}\n//#endregion\n//#region src/guards/trigger.ts\nconst TRIGGER_ATTACHMENT = Symbol.for(\"keystroke.triggerAttachment\");\nconst zodSchema = z.custom((value) => value instanceof z.ZodType, \"must be a Zod schema\");\nconst cronScheduleSchema = z.string().trim().min(1, \"cron schedule must be a non-empty string\");\nconst workflowSchema = z.custom((value) => isManifestWorkflow(value), \"must be defineWorkflow(...)\");\nconst agentSchema = z.custom((value) => typeof value === \"object\" && value !== null && typeof value.slug === \"string\" && value.slug.trim().length > 0 && typeof value.prompt === \"function\", \"must be defineAgent(...)\");\nconst promptSchema = z.union([z.string(), z.function()]);\nconst baseSourceShape = {\n\tkey: z.string().trim().min(1),\n\tattach: z.function()\n};\nconst webhookSourceSchema = z.object({\n\tkind: z.literal(\"webhook\"),\n\t...baseSourceShape,\n\tendpoint: z.string().min(1),\n\trequest: zodSchema,\n\tfilter: zodSchema.optional(),\n\tpasses: z.function()\n});\nconst cronSourceSchema = z.object({\n\tkind: z.literal(\"cron\"),\n\t...baseSourceShape,\n\tschedule: cronScheduleSchema\n});\nconst pollSourceSchema = z.object({\n\tkind: z.literal(\"poll\"),\n\t...baseSourceShape,\n\tid: z.string().optional(),\n\tschedule: cronScheduleSchema,\n\trun: z.function(),\n\tfilters: z.array(z.function()),\n\tpasses: z.function()\n});\nconst triggerSourceSchema = z.discriminatedUnion(\"kind\", [\n\twebhookSourceSchema,\n\tcronSourceSchema,\n\tpollSourceSchema\n]);\nconst workflowAttachmentSchema = z.object({\n\tkey: z.string().trim().min(1),\n\tsource: triggerSourceSchema,\n\ttarget: z.literal(\"workflow\"),\n\tworkflow: workflowSchema,\n\ttransform: z.function().optional()\n});\nconst agentAttachmentSchema = z.object({\n\tkey: z.string().trim().min(1),\n\tsource: triggerSourceSchema,\n\ttarget: z.literal(\"agent\"),\n\tagent: agentSchema,\n\tprompt: promptSchema\n});\nconst triggerAttachmentCoreSchema = z.discriminatedUnion(\"target\", [workflowAttachmentSchema, agentAttachmentSchema]);\nfunction isManifestTriggerAttachment(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(TRIGGER_ATTACHMENT in value) || value[TRIGGER_ATTACHMENT] !== true) return false;\n\treturn triggerAttachmentCoreSchema.safeParse(value).success;\n}\nfunction validateManifestTriggerAttachment(value, filePath) {\n\tif (!isManifestTriggerAttachment(value)) throw new Error(`${filePath} must default-export a trigger attachment from .attach({ workflow }) or .attach({ agent, prompt })`);\n\treturn value;\n}\n//#endregion\n//#region src/triggers/discover.ts\nfunction shouldDiscoverTriggerFile(triggersDir, filePath) {\n\treturn !relative(triggersDir, filePath).split(sep).includes(\"sources\");\n}\nasync function discoverTriggerAttachments(triggersDir, options) {\n\tconst files = await discoverModuleFileEntries(triggersDir, {\n\t\tnestedEntry: \"trigger\",\n\t\tduplicateLabel: \"trigger module file\",\n\t\tshouldDiscoverFile: (filePath) => shouldDiscoverTriggerFile(triggersDir, filePath)\n\t});\n\tconst attachments = [];\n\tfor (const { filePath, moduleFile } of files) {\n\t\tconst attachment = await importTriggerAttachment(filePath, options);\n\t\tattachments.push({\n\t\t\tkey: attachment.key,\n\t\t\tfilePath,\n\t\t\tmoduleFile,\n\t\t\tattachment\n\t\t});\n\t}\n\treturn attachments;\n}\nfunction validateImportedTriggerAttachment(def, filePath) {\n\treturn validateManifestTriggerAttachment(def, filePath);\n}\nasync function importTriggerAttachment(filePath, options) {\n\tconst href = pathToFileURL(filePath).href;\n\treturn validateImportedTriggerAttachment((await (options?.reload ? import(`${href}?keystroke=${Date.now()}`) : import(href))).default, filePath);\n}\n//#endregion\n//#region src/triggers/poll/groups.ts\nfunction pollGroupId(discovered) {\n\tconst source = discovered.attachment.source;\n\tif (source.kind !== \"poll\") throw new Error(`Attachment \"${discovered.key}\" is not a poll trigger`);\n\treturn source.id ?? source.key;\n}\nfunction buildPollGroups(attachments) {\n\tconst byId = /* @__PURE__ */ new Map();\n\tfor (const discovered of attachments) {\n\t\tif (discovered.attachment.source.kind !== \"poll\") continue;\n\t\tconst id = pollGroupId(discovered);\n\t\tconst group = byId.get(id) ?? [];\n\t\tgroup.push(discovered);\n\t\tbyId.set(id, group);\n\t}\n\treturn [...byId.entries()].map(([id, groupAttachments]) => ({\n\t\tid,\n\t\tattachments: groupAttachments\n\t}));\n}\nfunction validatePollGroups(groups) {\n\tfor (const group of groups) {\n\t\tif (group.attachments.length <= 1) continue;\n\t\tif (new Set(group.attachments.map((discovered) => {\n\t\t\tconst source = discovered.attachment.source;\n\t\t\tif (source.kind !== \"poll\") throw new Error(`Poll group \"${group.id}\" has non-poll attachment ${discovered.key}`);\n\t\t\treturn source.schedule;\n\t\t})).size > 1) {\n\t\t\tconst keys = group.attachments.map((discovered) => discovered.key).join(\", \");\n\t\t\tthrow new Error(`Poll group \"${group.id}\" has attachments with different schedules (${keys})`);\n\t\t}\n\t}\n}\nfunction matchesPollRunTarget(attachmentKey, workflowKey, target) {\n\tif (!target?.workflows?.length && !target?.attachments?.length) return true;\n\tif (target.attachments?.length && !target.attachments.includes(attachmentKey)) return false;\n\tif (target.workflows?.length && !target.workflows.includes(workflowKey)) return false;\n\treturn true;\n}\n//#endregion\n//#region src/triggers/webhook/build-webhook-bindings.ts\nfunction buildWebhookBindingsByRoute(attachments, handlerOptionsFor) {\n\tconst webhookBindingsByRoute = /* @__PURE__ */ new Map();\n\tfor (const discovered of attachments) {\n\t\tconst source = discovered.attachment.source;\n\t\tif (source.kind !== \"webhook\") continue;\n\t\tconst route = webhookRouteFromEndpoint(source.endpoint);\n\t\tconst bindings = webhookBindingsByRoute.get(route) ?? [];\n\t\tbindings.push({\n\t\t\tdiscovered,\n\t\t\toptions: handlerOptionsFor(discovered.key)\n\t\t});\n\t\twebhookBindingsByRoute.set(route, bindings);\n\t}\n\treturn webhookBindingsByRoute;\n}\n//#endregion\n//#region src/triggers/webhook/webhook-schemas.ts\nfunction webhookSchemaEntriesFromBindings(bindings) {\n\treturn bindings.flatMap((binding) => {\n\t\tconst source = binding.discovered.attachment.source;\n\t\tif (source.kind !== \"webhook\") return [];\n\t\treturn [{\n\t\t\tattachmentKey: binding.discovered.key,\n\t\t\trequest: source.request,\n\t\t\t...source.filter ? { filter: source.filter } : {}\n\t\t}];\n\t});\n}\nfunction webhookAttachmentSchemasFromBindings(bindings) {\n\treturn webhookSchemaEntriesFromBindings(bindings).map((entry) => ({\n\t\tattachmentKey: entry.attachmentKey,\n\t\trequestSchema: schemaToJson(entry.request),\n\t\t...entry.filter ? { filterSchema: schemaToJson(entry.filter) } : {}\n\t}));\n}\nfunction webhookMatchSchemaForBindings(bindings) {\n\tconst schemas = bindings.flatMap((binding) => {\n\t\tconst source = binding.discovered.attachment.source;\n\t\treturn source.kind === \"webhook\" ? [source.request] : [];\n\t});\n\tif (schemas.length === 0) throw new Error(\"Webhook bindings require at least one webhook source\");\n\tif (schemas.length === 1) return schemas[0];\n\treturn z.union(schemas);\n}\nfunction webhookManifestAttachmentSchemasFromBindings(bindings) {\n\treturn Object.fromEntries(webhookSchemaEntriesFromBindings(bindings).map((entry) => [entry.attachmentKey, {\n\t\trequest: entry.request,\n\t\t...entry.filter ? { filter: entry.filter } : {}\n\t}]));\n}\n//#endregion\n//#region src/workflows/discover.ts\nasync function discoverWorkflowEntries(workflowsDir, options) {\n\tconst files = await discoverModuleFileEntries(workflowsDir, {\n\t\tnestedEntry: \"workflow\",\n\t\tduplicateLabel: \"workflow module file\"\n\t});\n\tconst entries = [];\n\tfor (const { filePath, moduleFile } of files) {\n\t\tconst definition = await importWorkflowDefinition(filePath, options);\n\t\tentries.push({\n\t\t\tkey: definition.slug,\n\t\t\troute: workflowRouteFromKey(definition.slug),\n\t\t\tfilePath,\n\t\t\tmoduleFile\n\t\t});\n\t}\n\treturn entries;\n}\nfunction validateImportedWorkflowDefinition(def, filePath) {\n\treturn validateManifestWorkflow(def, filePath);\n}\nasync function importWorkflowDefinition(filePath, options) {\n\tconst href = pathToFileURL(filePath).href;\n\treturn validateImportedWorkflowDefinition((await (options?.reload ? import(`${href}?keystroke=${Date.now()}`) : import(href))).default, filePath);\n}\nasync function discoverWorkflows(workflowsDir, options) {\n\tconst entries = await discoverWorkflowEntries(workflowsDir, options);\n\tconst workflows = [];\n\tfor (const entry of entries) {\n\t\tconst definition = await importWorkflowDefinition(entry.filePath, options);\n\t\tworkflows.push({\n\t\t\tkey: definition.slug,\n\t\t\troute: workflowRouteFromKey(definition.slug),\n\t\t\tfilePath: entry.filePath,\n\t\t\tdefinition\n\t\t});\n\t}\n\treturn workflows;\n}\n//#endregion\n//#region src/build-stored-manifest.ts\nfunction resolveDistModuleDirs(projectRoot) {\n\tconst distBase = join(projectRoot, \"dist\");\n\tif (!existsSync(distBase)) throw new Error(`Build output missing at ${distBase}. Run keystroke build before emitting the route manifest.`);\n\treturn {\n\t\tagentsDir: join(distBase, \"agents\"),\n\t\tworkflowsDir: join(distBase, \"workflows\"),\n\t\ttriggersDir: join(distBase, \"triggers\")\n\t};\n}\nfunction toPosix(path) {\n\treturn path.split(sep).join(\"/\");\n}\n/**\n* Resolve manifest moduleFile values to project-root-relative source paths.\n*\n* Discovery runs over compiled `dist/` modules, so the raw moduleFile is a\n* dist-relative `.mjs` path. Dist entries are named by their source entry id\n* (`team/escalation.mjs` ← `src/agents/team/escalation/agent.ts`), so walking\n* the matching source dir by the same id rules recovers the source path. Falls\n* back to the dist-relative value when no source file matches (e.g. building\n* a dist-only artifact with no `src/`).\n*/\nvar SourceModuleFileResolver = class {\n\tprojectRoot;\n\tmapsByKind = /* @__PURE__ */ new Map();\n\tconstructor(projectRoot) {\n\t\tthis.projectRoot = projectRoot;\n\t}\n\tasync sourceMapFor(kindDir, nestedEntry) {\n\t\tconst existing = this.mapsByKind.get(kindDir);\n\t\tif (existing) return existing;\n\t\tconst map = /* @__PURE__ */ new Map();\n\t\tconst sourceDir = join(this.projectRoot, \"src\", kindDir);\n\t\tfor (const filePath of await walkTypeScriptFiles(sourceDir)) {\n\t\t\tconst id = entryIdFromFile(sourceDir, filePath, { nestedEntry });\n\t\t\tif (id) map.set(id, toPosix(relative(this.projectRoot, filePath)));\n\t\t}\n\t\tthis.mapsByKind.set(kindDir, map);\n\t\treturn map;\n\t}\n\tasync resolve(kindDir, nestedEntry, distDir, distFilePath) {\n\t\tconst fallback = toPosix(relative(distDir, distFilePath));\n\t\tconst id = entryIdFromFile(distDir, distFilePath, { nestedEntry });\n\t\tif (!id) return fallback;\n\t\treturn (await this.sourceMapFor(kindDir, nestedEntry)).get(id) ?? fallback;\n\t}\n};\n/** Build a stored route manifest from compiled dist/ modules without starting a server. */\nasync function buildStoredRouteManifestForProject(projectRoot, options) {\n\tconst previousRoot = process.env.KEYSTROKE_ROOT;\n\tprocess.env.KEYSTROKE_ROOT = projectRoot;\n\tconst reload = options?.reloadModules ? { reload: true } : void 0;\n\ttry {\n\t\tconst dirs = resolveDistModuleDirs(projectRoot);\n\t\tconst sourcePaths = new SourceModuleFileResolver(projectRoot);\n\t\tconst manifest = [{\n\t\t\tkind: \"health\",\n\t\t\tmethod: \"GET\",\n\t\t\tpath: \"/health\"\n\t\t}];\n\t\tconst agentEntries = await discoverAgentEntries(dirs.agentsDir, reload);\n\t\tfor (const entry of agentEntries) {\n\t\t\tconst agent = await importAgentDefinition(entry.filePath, reload);\n\t\t\tconst moduleFile = await sourcePaths.resolve(\"agents\", \"agent\", dirs.agentsDir, entry.filePath);\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"agent\",\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tpath: entry.route,\n\t\t\t\tagentSlug: agent.slug,\n\t\t\t\tmoduleFile,\n\t\t\t\tname: agent.name,\n\t\t\t\tdescription: agent.description,\n\t\t\t\tmodel: agent.model,\n\t\t\t\tsystemPrompt: agent.systemPrompt,\n\t\t\t\ttoolCount: agent.tools?.length ?? 0,\n\t\t\t\tcredentialCount: countAgentCredentials(agent),\n\t\t\t\trequest: PromptInputSchema,\n\t\t\t\tresponse: PromptResponseSchema\n\t\t\t});\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"agent-sessions-list\",\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tpath: agentSessionsListPath(entry.route),\n\t\t\t\tagentSlug: entry.key,\n\t\t\t\tmoduleFile\n\t\t\t});\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"agent-session-detail\",\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tpath: agentSessionDetailPath(entry.route),\n\t\t\t\tagentSlug: entry.key,\n\t\t\t\tmoduleFile\n\t\t\t});\n\t\t}\n\t\tconst workflows = await discoverWorkflows(dirs.workflowsDir, reload);\n\t\tfor (const workflow of workflows) {\n\t\t\tconst route = workflowRouteFromKey(workflow.key);\n\t\t\tconst moduleFile = await sourcePaths.resolve(\"workflows\", \"workflow\", dirs.workflowsDir, workflow.filePath);\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"workflow\",\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tpath: route,\n\t\t\t\tworkflowSlug: workflow.definition.slug,\n\t\t\t\tworkflowName: workflow.definition.name,\n\t\t\t\tdescription: workflow.definition.description,\n\t\t\t\tsubscribable: workflow.definition.subscription?.mode === \"subscribable\",\n\t\t\t\tmoduleFile,\n\t\t\t\trequest: workflow.definition.input,\n\t\t\t\tresponse: workflow.definition.output\n\t\t\t});\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"workflow-runs-list\",\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tpath: workflowRunsListPath(route),\n\t\t\t\tworkflowSlug: workflow.definition.slug,\n\t\t\t\tworkflowName: workflow.definition.name,\n\t\t\t\tmoduleFile\n\t\t\t});\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"workflow-run-detail\",\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tpath: workflowRunDetailPath(route),\n\t\t\t\tworkflowSlug: workflow.definition.slug,\n\t\t\t\tworkflowName: workflow.definition.name,\n\t\t\t\tmoduleFile\n\t\t\t});\n\t\t}\n\t\tconst attachments = await discoverTriggerAttachments(dirs.triggersDir, reload);\n\t\tconst discoveredByKey = new Map(attachments.map((attachment) => [attachment.key, attachment]));\n\t\tconst pollGroups = buildPollGroups(attachments);\n\t\tfor (const discovered of discoveredByKey.values()) {\n\t\t\tconst source = discovered.attachment.source;\n\t\t\tconst moduleFile = await sourcePaths.resolve(\"triggers\", \"trigger\", dirs.triggersDir, discovered.filePath);\n\t\t\tif (source.kind === \"cron\") {\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"cron-schedule\",\n\t\t\t\t\tattachmentId: discovered.key,\n\t\t\t\t\tmoduleFile,\n\t\t\t\t\tschedule: source.schedule\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (source.kind === \"poll\") {\n\t\t\t\tconst route = pollRouteFromKey(source.key);\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"trigger-poll\",\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tpath: route,\n\t\t\t\t\tattachmentId: discovered.key,\n\t\t\t\t\tmoduleFile,\n\t\t\t\t\tschedule: source.schedule,\n\t\t\t\t\tresponse: PromptResponseSchema\n\t\t\t\t});\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"trigger-runs-list\",\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\tpath: triggerRunsListPath(discovered.key),\n\t\t\t\t\tattachmentId: discovered.key,\n\t\t\t\t\tmoduleFile\n\t\t\t\t});\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"trigger-run-detail\",\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\tpath: triggerRunDetailPath(discovered.key),\n\t\t\t\t\tattachmentId: discovered.key,\n\t\t\t\t\tmoduleFile\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (source.kind === \"webhook\") {\n\t\t\t\tconst route = webhookRouteFromEndpoint(source.endpoint);\n\t\t\t\tconst bindings = buildWebhookBindingsByRoute(discoveredByKey.values(), () => ({\n\t\t\t\t\texecution: { attachmentKey: discovered.key },\n\t\t\t\t\tattachmentKey: discovered.key\n\t\t\t\t})).get(route) ?? [{\n\t\t\t\t\tdiscovered,\n\t\t\t\t\toptions: { attachmentKey: discovered.key }\n\t\t\t\t}];\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"trigger-webhook\",\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tpath: route,\n\t\t\t\t\tattachmentIds: bindings.map(({ discovered: row }) => row.key),\n\t\t\t\t\tmoduleFile,\n\t\t\t\t\trequest: webhookMatchSchemaForBindings(bindings),\n\t\t\t\t\tattachmentSchemas: webhookManifestAttachmentSchemasFromBindings(bindings),\n\t\t\t\t\tresponse: PromptResponseSchema\n\t\t\t\t});\n\t\t\t\tfor (const { discovered: row } of bindings) {\n\t\t\t\t\tconst rowModuleFile = await sourcePaths.resolve(\"triggers\", \"trigger\", dirs.triggersDir, row.filePath);\n\t\t\t\t\tmanifest.push({\n\t\t\t\t\t\tkind: \"trigger-runs-list\",\n\t\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\t\tpath: triggerRunsListPath(row.key),\n\t\t\t\t\t\tattachmentId: row.key,\n\t\t\t\t\t\tmoduleFile: rowModuleFile\n\t\t\t\t\t});\n\t\t\t\t\tmanifest.push({\n\t\t\t\t\t\tkind: \"trigger-run-detail\",\n\t\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\t\tpath: triggerRunDetailPath(row.key),\n\t\t\t\t\t\tattachmentId: row.key,\n\t\t\t\t\t\tmoduleFile: rowModuleFile\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const group of pollGroups) {\n\t\t\tif (group.attachments.length <= 1) continue;\n\t\t\tconst first = group.attachments[0];\n\t\t\tconst source = first.attachment.source;\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"trigger-poll-group\",\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tpath: pollGroupRouteFromId(group.id),\n\t\t\t\tpollId: group.id,\n\t\t\t\tattachmentIds: group.attachments.map((attachment) => attachment.key),\n\t\t\t\tmoduleFile: await sourcePaths.resolve(\"triggers\", \"trigger\", dirs.triggersDir, first.filePath),\n\t\t\t\tschedule: source.kind === \"poll\" ? source.schedule : \"\",\n\t\t\t\tresponse: PromptResponseSchema\n\t\t\t});\n\t\t}\n\t\treturn buildStoredRouteManifestFromContext({\n\t\t\tmanifest,\n\t\t\toptions: {},\n\t\t\tprojectRoot,\n\t\t\tskills: discoverSkillManifestEntries(projectRoot)\n\t\t});\n\t} finally {\n\t\tif (previousRoot === void 0) delete process.env.KEYSTROKE_ROOT;\n\t\telse process.env.KEYSTROKE_ROOT = previousRoot;\n\t}\n}\n/** Write `dist/.keystroke/route-manifest.json` for the project. */\nasync function emitStoredRouteManifestForProject(projectRoot) {\n\tpersistStoredRouteManifest(projectRoot, await buildStoredRouteManifestForProject(projectRoot));\n}\n//#endregion\n//#region src/openapi/manifest.ts\nfunction schedulesFromManifest(manifest) {\n\tconst schedules = [];\n\tfor (const entry of manifest) {\n\t\tif (entry.kind === \"cron-schedule\") {\n\t\t\tschedules.push({\n\t\t\t\tattachmentId: entry.attachmentId,\n\t\t\t\ttype: \"cron\",\n\t\t\t\tschedule: entry.schedule\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (entry.kind === \"trigger-poll\") schedules.push({\n\t\t\tattachmentId: entry.attachmentId,\n\t\t\ttype: \"poll\",\n\t\t\tschedule: entry.schedule\n\t\t});\n\t}\n\treturn schedules;\n}\n//#endregion\n//#region src/load-route-manifest.ts\nfunction routeManifestPathForProjectRoot(projectRoot) {\n\treturn join(projectRoot, ROUTE_MANIFEST_REL_PATH);\n}\nfunction readRouteManifest(projectRoot) {\n\tconst path = routeManifestPathForProjectRoot(projectRoot);\n\tif (!existsSync(path)) throw new Error(`${ROUTE_MANIFEST_REL_PATH} not found — start the project server once to emit the manifest`);\n\tconst raw = readFileSync(path, \"utf8\");\n\treturn parseStoredRouteManifest(JSON.parse(raw));\n}\n//#endregion\nexport { agentRouteFromKey, agentSessionDetailPath, agentSessionsListPath, buildPollGroups, buildStoredRouteManifestForProject, buildStoredRouteManifestFromContext, buildWebhookBindingsByRoute, countAgentCredentials, discoverAgentEntries, discoverEntries, discoverModuleFileEntries, discoverSkillManifestEntries, discoverTriggerAttachments, discoverWorkflowEntries, discoverWorkflows, emitStoredRouteManifestForProject, entryIdFromFile, findWebhookManifestEntryByPath, findWorkflowManifestEntry, importAgentDefinition, importTriggerAttachment, importWorkflowDefinition, matchesPollRunTarget, moduleFileKeyFromPath, persistStoredRouteManifest, pollGroupId, pollGroupRouteFromId, pollRouteFromKey, readRouteManifest, routeManifestPathForProjectRoot, schedulesFromManifest, schemaToJson, serializeRouteManifest, toStoredRouteManifest, triggerRunDetailPath, triggerRunsListPath, validateImportedTriggerAttachment, validateImportedWorkflowDefinition, validatePollGroups, validateUniqueModuleKeys, walkTypeScriptFiles, webhookAttachmentSchemasFromBindings, webhookManifestAttachmentSchemasFromBindings, webhookMatchSchemaForBindings, webhookRouteFromEndpoint, workflowRouteFromKey, workflowRunDetailPath, workflowRunsListPath };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;AAIA,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,SAAS,gBAAgB,SAAS,UAAU,SAAS;CACpD,IAAI,mBAAmB,KAAK,QAAQ,GAAG,OAA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F"}
|
|
1
|
+
{"version":3,"file":"dist-DEnhPwK2.mjs","names":["z.toJSONSchema","z.custom","z.ZodType","z.string","z.union","z.function","z.object","z.literal","z.array","z.discriminatedUnion"],"sources":["../../../packages/manifest/dist/discovery-CWjr_liZ.mjs","../../../packages/manifest/dist/index.mjs"],"sourcesContent":["import { join, relative, sep } from \"node:path\";\nimport { readdir, stat } from \"node:fs/promises\";\nimport { readFileSync } from \"node:fs\";\n//#region src/discovery/entry-from-file.ts\nconst SOURCE_EXT = /\\.(ts|mts|mjs|js)$/;\nconst DECLARATION_FILE$1 = /\\.d\\.(ts|mts|cts)$/;\nfunction entryIdFromFile(rootDir, filePath, options) {\n\tif (DECLARATION_FILE$1.test(filePath)) return null;\n\tconst baseName = filePath.split(sep).at(-1) ?? \"\";\n\tif (/\\.(int\\.)?test\\.(ts|mts)$/.test(baseName)) return null;\n\tconst segments = relative(rootDir, filePath).replace(SOURCE_EXT, \"\").split(sep).filter((segment) => segment.length > 0);\n\tif (segments.length === 1) return segments[0] ?? null;\n\tconst last = segments.at(-1);\n\tconst entryNames = new Set([options.nestedEntry]);\n\tif (options.allowIndex !== false) entryNames.add(\"index\");\n\tif (!last || !entryNames.has(last)) return null;\n\tconst id = segments.slice(0, -1).join(\"/\");\n\treturn id.length > 0 ? id : null;\n}\n//#endregion\n//#region src/discovery/walk-typescript-files.ts\nconst SOURCE_FILE = /\\.(ts|mts|mjs|js)$/;\nconst TEST_FILE = /\\.(int\\.)?test\\.(ts|mts)$/;\nconst DECLARATION_FILE = /\\.d\\.(ts|mts|cts)$/;\nconst JUNK_FILE = /^\\._|\\.DS_Store$/;\nasync function walkTypeScriptFiles(dir) {\n\tlet names;\n\ttry {\n\t\tnames = await readdir(dir);\n\t} catch (error) {\n\t\tif (error.code === \"ENOENT\") return [];\n\t\tthrow error;\n\t}\n\tconst files = [];\n\tfor (const name of names) {\n\t\tconst path = join(dir, name);\n\t\tif ((await stat(path)).isDirectory()) files.push(...await walkTypeScriptFiles(path));\n\t\telse if (!JUNK_FILE.test(name) && SOURCE_FILE.test(name) && !DECLARATION_FILE.test(name) && !TEST_FILE.test(name)) files.push(path);\n\t}\n\treturn files;\n}\n//#endregion\n//#region src/discovery/discover-entries.ts\nasync function discoverEntries(rootDir, options) {\n\tconst files = await walkTypeScriptFiles(rootDir);\n\tconst byKey = /* @__PURE__ */ new Map();\n\tfor (const filePath of files) {\n\t\tconst id = entryIdFromFile(rootDir, filePath, options);\n\t\tif (!id) continue;\n\t\tconst key = options.formatKey(id);\n\t\tconst moduleFile = relative(rootDir, filePath);\n\t\tconst existing = byKey.get(key);\n\t\tif (existing) throw new Error(`Duplicate ${options.duplicateLabel} ${key}: ${existing.filePath} and ${filePath}`);\n\t\tbyKey.set(key, {\n\t\t\tkey,\n\t\t\tfilePath,\n\t\t\tmoduleFile\n\t\t});\n\t}\n\treturn [...byKey.values()];\n}\n//#endregion\n//#region src/discovery/discover-module-entries.ts\nasync function discoverModuleFileEntries(rootDir, options) {\n\treturn (await discoverEntries(rootDir, {\n\t\tnestedEntry: options.nestedEntry,\n\t\tformatKey: (id) => id,\n\t\tduplicateLabel: options.duplicateLabel\n\t})).filter((entry) => options.shouldDiscoverFile?.(entry.filePath) ?? true).map(({ filePath, moduleFile }) => ({\n\t\tfilePath,\n\t\tmoduleFile\n\t}));\n}\nfunction moduleFileKeyFromPath(rootDir, filePath, nestedEntry) {\n\treturn entryIdFromFile(rootDir, filePath, { nestedEntry });\n}\n//#endregion\n//#region src/discovery/keystroke-ignore-directive.ts\nconst HEADER_BYTES = 2048;\nconst DIRECTIVE_RE = /@keystroke\\s+ignore(?::([a-z]+))?/;\n/** Parse `@keystroke ignore` directives from a file header snippet. */\nfunction parseKeystrokeIgnoreDirective(header) {\n\tfor (const line of header.slice(0, HEADER_BYTES).split(\"\\n\")) {\n\t\tconst trimmed = line.trim();\n\t\tif (trimmed.length === 0) continue;\n\t\tif (!isCommentLine(trimmed)) break;\n\t\tconst match = DIRECTIVE_RE.exec(trimmed);\n\t\tif (!match) continue;\n\t\tconst scope = match[1];\n\t\tif (!scope) return \"ignore\";\n\t\tif (scope === \"deploy\") return \"ignore:deploy\";\n\t\tthrow new Error(`Unknown @keystroke ignore target \"${scope}\" in directive \"@keystroke ignore:${scope}\"`);\n\t}\n\treturn null;\n}\n/** Read `@keystroke ignore` directives from the top of a module file. */\nfunction readKeystrokeIgnoreDirective(filePath) {\n\treturn parseKeystrokeIgnoreDirective(readFileSync(filePath, \"utf8\").slice(0, HEADER_BYTES));\n}\n/** Whether a discovered module file should be skipped for the given build phase. */\nfunction shouldSkipKeystrokeModuleFile(directive, phase) {\n\tif (!directive) return false;\n\tif (directive === \"ignore\") return true;\n\treturn phase === \"deploy\";\n}\nfunction isCommentLine(line) {\n\treturn line.startsWith(\"//\") || line.startsWith(\"/*\") || line.startsWith(\"*\");\n}\n//#endregion\n//#region src/discovery/validate-unique-module-keys.ts\nfunction validateUniqueModuleKeys(entries) {\n\tconst byKey = /* @__PURE__ */ new Map();\n\tfor (const entry of entries) {\n\t\tconst list = byKey.get(entry.key) ?? [];\n\t\tlist.push(entry);\n\t\tbyKey.set(entry.key, list);\n\t}\n\tfor (const [key, clashes] of byKey) {\n\t\tif (clashes.length <= 1) continue;\n\t\tconst detail = clashes.map((entry) => `${entry.kind} (${entry.filePath})`).join(\", \");\n\t\tthrow new Error(`Duplicate module key \"${key}\": ${detail}`);\n\t}\n}\n//#endregion\nexport { discoverModuleFileEntries as a, walkTypeScriptFiles as c, shouldSkipKeystrokeModuleFile as i, entryIdFromFile as l, parseKeystrokeIgnoreDirective as n, moduleFileKeyFromPath as o, readKeystrokeIgnoreDirective as r, discoverEntries as s, validateUniqueModuleKeys as t };\n\n//# sourceMappingURL=discovery-CWjr_liZ.mjs.map","import { a as discoverModuleFileEntries, c as walkTypeScriptFiles, l as entryIdFromFile, o as moduleFileKeyFromPath, s as discoverEntries, t as validateUniqueModuleKeys } from \"./discovery-CWjr_liZ.mjs\";\nimport { pathToFileURL } from \"node:url\";\nimport { dirname, join, relative, sep } from \"node:path\";\nimport { PromptInputSchema, PromptResponseSchema, ROUTE_MANIFEST_REL_PATH, normalizeCredentialList, parseStoredRouteManifest } from \"@keystrokehq/shared\";\nimport { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from \"node:fs\";\nimport { z } from \"zod\";\n//#region src/guards/agent.ts\nfunction isManifestAgent(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst agent = value;\n\treturn typeof agent.slug === \"string\" && agent.slug.trim().length > 0 && typeof agent.buildRuntime === \"function\" && typeof agent.model === \"string\" && typeof agent.systemPrompt === \"string\";\n}\nfunction validateManifestAgent(value, filePath) {\n\tif (!isManifestAgent(value)) throw new Error(`${filePath} must default-export defineAgent(...)`);\n\treturn value;\n}\n//#endregion\n//#region src/routes.ts\nfunction normalizeWebhookEndpoint(endpoint) {\n\treturn endpoint.replace(/^\\/+|\\/+$/g, \"\").replace(/^triggers\\/?/, \"\");\n}\nfunction agentRouteFromKey(key) {\n\treturn `/agents/${key}`;\n}\nfunction agentSessionsListPath(route) {\n\treturn `${route}/sessions`;\n}\nfunction agentSessionDetailPath(route) {\n\treturn `${route}/sessions/:sessionId`;\n}\nfunction workflowRouteFromKey(key) {\n\treturn `/workflows/${key}`;\n}\nfunction workflowRunsListPath(route) {\n\treturn `${route}/runs`;\n}\nfunction workflowRunDetailPath(route) {\n\treturn `${route}/runs/:runId`;\n}\nfunction triggerRunsListPath(attachmentKey) {\n\treturn `/triggers/${attachmentKey}/runs`;\n}\nfunction triggerRunDetailPath(attachmentKey) {\n\treturn `/triggers/${attachmentKey}/runs/:runId`;\n}\nfunction pollRouteFromKey(attachmentKey) {\n\treturn `/triggers/${attachmentKey}/poll`;\n}\nfunction pollGroupRouteFromId(pollId) {\n\treturn `/triggers/polls/${pollId}/run`;\n}\nfunction webhookRouteFromEndpoint(endpoint) {\n\tconst normalized = normalizeWebhookEndpoint(endpoint);\n\tif (!normalized) throw new Error(\"Webhook endpoint must not be empty\");\n\treturn `/triggers/${normalized}`;\n}\n//#endregion\n//#region src/agents/discover.ts\nasync function discoverAgentEntries(agentsDir, options) {\n\tconst files = await discoverModuleFileEntries(agentsDir, {\n\t\tnestedEntry: \"agent\",\n\t\tduplicateLabel: \"agent module file\"\n\t});\n\tconst entries = [];\n\tfor (const { filePath, moduleFile } of files) {\n\t\tconst agent = await importAgentDefinition(filePath, options);\n\t\tentries.push({\n\t\t\tkey: agent.slug,\n\t\t\troute: agentRouteFromKey(agent.slug),\n\t\t\tfilePath,\n\t\t\tmoduleFile\n\t\t});\n\t}\n\treturn entries;\n}\nasync function importAgentDefinition(filePath, options) {\n\tconst href = pathToFileURL(filePath).href;\n\treturn validateManifestAgent((await (options?.reload ? import(`${href}?keystroke=${Date.now()}`) : import(href))).default, filePath);\n}\n//#endregion\n//#region src/guards/action.ts\nconst ACTION = Symbol.for(\"keystroke.action\");\nfunction isManifestAction(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\treturn ACTION in value && value[ACTION] === true;\n}\nfunction getManifestActionCredentialRequirements(action) {\n\treturn Array.isArray(action.credentials) ? action.credentials : void 0;\n}\n//#endregion\n//#region src/agents/count-agent-credentials.ts\nfunction countAgentCredentials(agent) {\n\tconst keys = /* @__PURE__ */ new Set();\n\tfor (const tool of agent.tools ?? []) {\n\t\tconst record = tool;\n\t\tconst requirements = isManifestAction(tool) ? getManifestActionCredentialRequirements(tool) : \"credentials\" in record && Array.isArray(record.credentials) ? record.credentials : void 0;\n\t\tif (!requirements?.length) continue;\n\t\tfor (const requirement of normalizeCredentialList(requirements)) keys.add(requirement.key);\n\t}\n\treturn keys.size;\n}\n//#endregion\n//#region src/skills/discover-manifest-entries.ts\nconst SKIP_DIRS = new Set([\".git\", \"node_modules\"]);\nfunction toPosix$1(path) {\n\treturn path.split(sep).join(\"/\");\n}\nfunction parseSkillFrontmatter(raw) {\n\tconst match = raw.match(/^---\\s*\\n([\\s\\S]*?)\\n---/);\n\tif (!match) return {};\n\tconst out = {};\n\tfor (const line of match[1]?.split(\"\\n\") ?? []) {\n\t\tconst trimmed = line.trim();\n\t\tif (!trimmed || trimmed.startsWith(\"#\")) continue;\n\t\tconst colon = trimmed.indexOf(\":\");\n\t\tif (colon < 0) continue;\n\t\tconst key = trimmed.slice(0, colon).trim();\n\t\tlet value = trimmed.slice(colon + 1).trim();\n\t\tif (value.startsWith(\"\\\"\") && value.endsWith(\"\\\"\") || value.startsWith(\"'\") && value.endsWith(\"'\")) value = value.slice(1, -1);\n\t\tif (key === \"name\") out.name = value;\n\t\telse if (key === \"description\") out.description = value;\n\t}\n\treturn out;\n}\nfunction walkSkillFiles(root, dir, out) {\n\tfor (const name of readdirSync(dir).sort()) {\n\t\tconst absolute = join(dir, name);\n\t\tconst stats = statSync(absolute);\n\t\tif (stats.isDirectory()) {\n\t\t\tif (SKIP_DIRS.has(name)) continue;\n\t\t\twalkSkillFiles(root, absolute, out);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!stats.isFile() || name !== \"SKILL.md\") continue;\n\t\tconst moduleFile = toPosix$1(relative(root, absolute));\n\t\tconst slug = toPosix$1(relative(join(root, \"src\", \"skills\"), absolute)).replace(/\\/?SKILL\\.md$/, \"\");\n\t\tif (!slug) continue;\n\t\tconst frontmatter = parseSkillFrontmatter(readFileSync(absolute, \"utf8\"));\n\t\tout.push({\n\t\t\tslug,\n\t\t\tname: frontmatter.name,\n\t\t\tdescription: frontmatter.description,\n\t\t\tmoduleFile\n\t\t});\n\t}\n}\n/** Discover skill metadata from src/skills SKILL.md files for the route manifest. */\nfunction discoverSkillManifestEntries(projectRoot) {\n\tconst skillsDir = join(projectRoot, \"src\", \"skills\");\n\tif (!statSync(skillsDir, { throwIfNoEntry: false })?.isDirectory()) return [];\n\tconst entries = [];\n\twalkSkillFiles(projectRoot, skillsDir, entries);\n\treturn entries;\n}\n//#endregion\n//#region src/openapi/schema-to-json.ts\nfunction schemaToJson(schema) {\n\treturn z.toJSONSchema(schema, { target: \"openapi-3.0\" });\n}\n//#endregion\n//#region src/openapi/serialize-manifest.ts\nfunction collectIntegrationKeys(integrations) {\n\treturn integrations.map((integration) => integration.key);\n}\nfunction serializeRouteManifest(manifest) {\n\treturn manifest.map((entry) => {\n\t\tswitch (entry.kind) {\n\t\t\tcase \"health\": return entry;\n\t\t\tcase \"agent\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tagentSlug: entry.agentSlug,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\tname: entry.name,\n\t\t\t\tdescription: entry.description,\n\t\t\t\tmodel: entry.model,\n\t\t\t\tsystemPrompt: entry.systemPrompt,\n\t\t\t\ttoolCount: entry.toolCount,\n\t\t\t\tcredentialCount: entry.credentialCount,\n\t\t\t\trequestSchema: schemaToJson(entry.request),\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"workflow\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tworkflowSlug: entry.workflowSlug,\n\t\t\t\tworkflowName: entry.workflowName,\n\t\t\t\tdescription: entry.description,\n\t\t\t\tsubscribable: entry.subscribable,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\trequestSchema: schemaToJson(entry.request),\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"trigger-webhook\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tattachmentIds: entry.attachmentIds,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\trequestSchema: schemaToJson(entry.request),\n\t\t\t\tattachmentSchemas: Object.fromEntries(Object.entries(entry.attachmentSchemas).map(([attachmentKey, schemas]) => [attachmentKey, {\n\t\t\t\t\trequestSchema: schemaToJson(schemas.request),\n\t\t\t\t\t...schemas.filter ? { filterSchema: schemaToJson(schemas.filter) } : {}\n\t\t\t\t}])),\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"trigger-poll\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tattachmentId: entry.attachmentId,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\tschedule: entry.schedule,\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"trigger-poll-group\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tpollId: entry.pollId,\n\t\t\t\tattachmentIds: entry.attachmentIds,\n\t\t\t\tmoduleFile: entry.moduleFile,\n\t\t\t\tschedule: entry.schedule,\n\t\t\t\tresponseSchema: schemaToJson(entry.response)\n\t\t\t};\n\t\t\tcase \"plugin\": return {\n\t\t\t\tkind: entry.kind,\n\t\t\t\tmethod: entry.method,\n\t\t\t\tpath: entry.path,\n\t\t\t\tplugin: entry.plugin\n\t\t\t};\n\t\t\tdefault: return entry;\n\t\t}\n\t});\n}\nfunction toStoredRouteManifest(manifest, options) {\n\treturn {\n\t\tversion: 1,\n\t\tentries: serializeRouteManifest(manifest),\n\t\tskills: options?.skills ?? [],\n\t\tintegrations: options?.integrations\n\t};\n}\nfunction buildStoredRouteManifestFromContext(ctx) {\n\tconst integrations = ctx.options?.integrations ?? ctx.options?.plugins?.map((plugin) => ({\n\t\tkey: plugin.name,\n\t\tmount: plugin.register\n\t})) ?? [];\n\treturn toStoredRouteManifest(ctx.manifest, {\n\t\tintegrations: collectIntegrationKeys(integrations),\n\t\tskills: ctx.skills ?? (ctx.projectRoot ? discoverSkillManifestEntries(ctx.projectRoot) : void 0) ?? []\n\t});\n}\nfunction findWorkflowManifestEntry(manifest, workflowSlug) {\n\treturn manifest.entries.find((entry) => entry.kind === \"workflow\" && entry.workflowSlug === workflowSlug);\n}\nfunction findWebhookManifestEntryByPath(manifest, route) {\n\treturn manifest.entries.find((entry) => entry.kind === \"trigger-webhook\" && entry.path === route);\n}\n//#endregion\n//#region src/persist.ts\nfunction persistStoredRouteManifest(projectRoot, manifest) {\n\tconst path = join(projectRoot, ROUTE_MANIFEST_REL_PATH);\n\tmkdirSync(dirname(path), { recursive: true });\n\twriteFileSync(path, `${JSON.stringify(manifest, null, 2)}\\n`);\n}\n//#endregion\n//#region src/guards/workflow.ts\nconst WORKFLOW = Symbol.for(\"keystroke.workflow\");\nfunction isManifestWorkflow(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(WORKFLOW in value) || value[WORKFLOW] !== true) return false;\n\tconst workflow = value;\n\treturn typeof workflow.slug === \"string\" && workflow.slug.trim().length > 0 && workflow.input instanceof Object && \"safeParse\" in workflow.input && workflow.output instanceof Object && \"safeParse\" in workflow.output;\n}\nfunction validateManifestWorkflow(value, filePath) {\n\tif (!isManifestWorkflow(value)) throw new Error(`${filePath} must default-export defineWorkflow(...)`);\n\treturn value;\n}\n//#endregion\n//#region src/guards/trigger.ts\nconst TRIGGER_ATTACHMENT = Symbol.for(\"keystroke.triggerAttachment\");\nconst zodSchema = z.custom((value) => value instanceof z.ZodType, \"must be a Zod schema\");\nconst cronScheduleSchema = z.string().trim().min(1, \"cron schedule must be a non-empty string\");\nconst workflowSchema = z.custom((value) => isManifestWorkflow(value), \"must be defineWorkflow(...)\");\nconst agentSchema = z.custom((value) => typeof value === \"object\" && value !== null && typeof value.slug === \"string\" && value.slug.trim().length > 0 && typeof value.prompt === \"function\", \"must be defineAgent(...)\");\nconst promptSchema = z.union([z.string(), z.function()]);\nconst baseSourceShape = {\n\tkey: z.string().trim().min(1),\n\tattach: z.function()\n};\nconst webhookSourceSchema = z.object({\n\tkind: z.literal(\"webhook\"),\n\t...baseSourceShape,\n\tendpoint: z.string().min(1),\n\trequest: zodSchema,\n\tfilter: zodSchema.optional(),\n\tpasses: z.function()\n});\nconst cronSourceSchema = z.object({\n\tkind: z.literal(\"cron\"),\n\t...baseSourceShape,\n\tschedule: cronScheduleSchema\n});\nconst pollSourceSchema = z.object({\n\tkind: z.literal(\"poll\"),\n\t...baseSourceShape,\n\tid: z.string().optional(),\n\tschedule: cronScheduleSchema,\n\trun: z.function(),\n\tfilters: z.array(z.function()),\n\tpasses: z.function()\n});\nconst triggerSourceSchema = z.discriminatedUnion(\"kind\", [\n\twebhookSourceSchema,\n\tcronSourceSchema,\n\tpollSourceSchema\n]);\nconst workflowAttachmentSchema = z.object({\n\tkey: z.string().trim().min(1),\n\tsource: triggerSourceSchema,\n\ttarget: z.literal(\"workflow\"),\n\tworkflow: workflowSchema,\n\ttransform: z.function().optional()\n});\nconst agentAttachmentSchema = z.object({\n\tkey: z.string().trim().min(1),\n\tsource: triggerSourceSchema,\n\ttarget: z.literal(\"agent\"),\n\tagent: agentSchema,\n\tprompt: promptSchema\n});\nconst triggerAttachmentCoreSchema = z.discriminatedUnion(\"target\", [workflowAttachmentSchema, agentAttachmentSchema]);\nfunction isManifestTriggerAttachment(value) {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tif (!(TRIGGER_ATTACHMENT in value) || value[TRIGGER_ATTACHMENT] !== true) return false;\n\treturn triggerAttachmentCoreSchema.safeParse(value).success;\n}\nfunction validateManifestTriggerAttachment(value, filePath) {\n\tif (!isManifestTriggerAttachment(value)) throw new Error(`${filePath} must default-export a trigger attachment from .attach({ workflow }) or .attach({ agent, prompt })`);\n\treturn value;\n}\n//#endregion\n//#region src/triggers/discover.ts\nfunction shouldDiscoverTriggerFile(triggersDir, filePath) {\n\treturn !relative(triggersDir, filePath).split(sep).includes(\"sources\");\n}\nasync function discoverTriggerAttachments(triggersDir, options) {\n\tconst files = await discoverModuleFileEntries(triggersDir, {\n\t\tnestedEntry: \"trigger\",\n\t\tduplicateLabel: \"trigger module file\",\n\t\tshouldDiscoverFile: (filePath) => shouldDiscoverTriggerFile(triggersDir, filePath)\n\t});\n\tconst attachments = [];\n\tfor (const { filePath, moduleFile } of files) {\n\t\tconst attachment = await importTriggerAttachment(filePath, options);\n\t\tattachments.push({\n\t\t\tkey: attachment.key,\n\t\t\tfilePath,\n\t\t\tmoduleFile,\n\t\t\tattachment\n\t\t});\n\t}\n\treturn attachments;\n}\nfunction validateImportedTriggerAttachment(def, filePath) {\n\treturn validateManifestTriggerAttachment(def, filePath);\n}\nasync function importTriggerAttachment(filePath, options) {\n\tconst href = pathToFileURL(filePath).href;\n\treturn validateImportedTriggerAttachment((await (options?.reload ? import(`${href}?keystroke=${Date.now()}`) : import(href))).default, filePath);\n}\n//#endregion\n//#region src/triggers/poll/groups.ts\nfunction pollGroupId(discovered) {\n\tconst source = discovered.attachment.source;\n\tif (source.kind !== \"poll\") throw new Error(`Attachment \"${discovered.key}\" is not a poll trigger`);\n\treturn source.id ?? source.key;\n}\nfunction buildPollGroups(attachments) {\n\tconst byId = /* @__PURE__ */ new Map();\n\tfor (const discovered of attachments) {\n\t\tif (discovered.attachment.source.kind !== \"poll\") continue;\n\t\tconst id = pollGroupId(discovered);\n\t\tconst group = byId.get(id) ?? [];\n\t\tgroup.push(discovered);\n\t\tbyId.set(id, group);\n\t}\n\treturn [...byId.entries()].map(([id, groupAttachments]) => ({\n\t\tid,\n\t\tattachments: groupAttachments\n\t}));\n}\nfunction validatePollGroups(groups) {\n\tfor (const group of groups) {\n\t\tif (group.attachments.length <= 1) continue;\n\t\tif (new Set(group.attachments.map((discovered) => {\n\t\t\tconst source = discovered.attachment.source;\n\t\t\tif (source.kind !== \"poll\") throw new Error(`Poll group \"${group.id}\" has non-poll attachment ${discovered.key}`);\n\t\t\treturn source.schedule;\n\t\t})).size > 1) {\n\t\t\tconst keys = group.attachments.map((discovered) => discovered.key).join(\", \");\n\t\t\tthrow new Error(`Poll group \"${group.id}\" has attachments with different schedules (${keys})`);\n\t\t}\n\t}\n}\nfunction matchesPollRunTarget(attachmentKey, workflowKey, target) {\n\tif (!target?.workflows?.length && !target?.attachments?.length) return true;\n\tif (target.attachments?.length && !target.attachments.includes(attachmentKey)) return false;\n\tif (target.workflows?.length && !target.workflows.includes(workflowKey)) return false;\n\treturn true;\n}\n//#endregion\n//#region src/triggers/webhook/build-webhook-bindings.ts\nfunction buildWebhookBindingsByRoute(attachments, handlerOptionsFor) {\n\tconst webhookBindingsByRoute = /* @__PURE__ */ new Map();\n\tfor (const discovered of attachments) {\n\t\tconst source = discovered.attachment.source;\n\t\tif (source.kind !== \"webhook\") continue;\n\t\tconst route = webhookRouteFromEndpoint(source.endpoint);\n\t\tconst bindings = webhookBindingsByRoute.get(route) ?? [];\n\t\tbindings.push({\n\t\t\tdiscovered,\n\t\t\toptions: handlerOptionsFor(discovered.key)\n\t\t});\n\t\twebhookBindingsByRoute.set(route, bindings);\n\t}\n\treturn webhookBindingsByRoute;\n}\n//#endregion\n//#region src/triggers/webhook/webhook-schemas.ts\nfunction webhookSchemaEntriesFromBindings(bindings) {\n\treturn bindings.flatMap((binding) => {\n\t\tconst source = binding.discovered.attachment.source;\n\t\tif (source.kind !== \"webhook\") return [];\n\t\treturn [{\n\t\t\tattachmentKey: binding.discovered.key,\n\t\t\trequest: source.request,\n\t\t\t...source.filter ? { filter: source.filter } : {}\n\t\t}];\n\t});\n}\nfunction webhookAttachmentSchemasFromBindings(bindings) {\n\treturn webhookSchemaEntriesFromBindings(bindings).map((entry) => ({\n\t\tattachmentKey: entry.attachmentKey,\n\t\trequestSchema: schemaToJson(entry.request),\n\t\t...entry.filter ? { filterSchema: schemaToJson(entry.filter) } : {}\n\t}));\n}\nfunction webhookMatchSchemaForBindings(bindings) {\n\tconst schemas = bindings.flatMap((binding) => {\n\t\tconst source = binding.discovered.attachment.source;\n\t\treturn source.kind === \"webhook\" ? [source.request] : [];\n\t});\n\tif (schemas.length === 0) throw new Error(\"Webhook bindings require at least one webhook source\");\n\tif (schemas.length === 1) return schemas[0];\n\treturn z.union(schemas);\n}\nfunction webhookManifestAttachmentSchemasFromBindings(bindings) {\n\treturn Object.fromEntries(webhookSchemaEntriesFromBindings(bindings).map((entry) => [entry.attachmentKey, {\n\t\trequest: entry.request,\n\t\t...entry.filter ? { filter: entry.filter } : {}\n\t}]));\n}\n//#endregion\n//#region src/workflows/discover.ts\nasync function discoverWorkflowEntries(workflowsDir, options) {\n\tconst files = await discoverModuleFileEntries(workflowsDir, {\n\t\tnestedEntry: \"workflow\",\n\t\tduplicateLabel: \"workflow module file\"\n\t});\n\tconst entries = [];\n\tfor (const { filePath, moduleFile } of files) {\n\t\tconst definition = await importWorkflowDefinition(filePath, options);\n\t\tentries.push({\n\t\t\tkey: definition.slug,\n\t\t\troute: workflowRouteFromKey(definition.slug),\n\t\t\tfilePath,\n\t\t\tmoduleFile\n\t\t});\n\t}\n\treturn entries;\n}\nfunction validateImportedWorkflowDefinition(def, filePath) {\n\treturn validateManifestWorkflow(def, filePath);\n}\nasync function importWorkflowDefinition(filePath, options) {\n\tconst href = pathToFileURL(filePath).href;\n\treturn validateImportedWorkflowDefinition((await (options?.reload ? import(`${href}?keystroke=${Date.now()}`) : import(href))).default, filePath);\n}\nasync function discoverWorkflows(workflowsDir, options) {\n\tconst entries = await discoverWorkflowEntries(workflowsDir, options);\n\tconst workflows = [];\n\tfor (const entry of entries) {\n\t\tconst definition = await importWorkflowDefinition(entry.filePath, options);\n\t\tworkflows.push({\n\t\t\tkey: definition.slug,\n\t\t\troute: workflowRouteFromKey(definition.slug),\n\t\t\tfilePath: entry.filePath,\n\t\t\tdefinition\n\t\t});\n\t}\n\treturn workflows;\n}\n//#endregion\n//#region src/build-stored-manifest.ts\nfunction resolveDistModuleDirs(projectRoot) {\n\tconst distBase = join(projectRoot, \"dist\");\n\tif (!existsSync(distBase)) throw new Error(`Build output missing at ${distBase}. Run keystroke build before emitting the route manifest.`);\n\treturn {\n\t\tagentsDir: join(distBase, \"agents\"),\n\t\tworkflowsDir: join(distBase, \"workflows\"),\n\t\ttriggersDir: join(distBase, \"triggers\")\n\t};\n}\nfunction toPosix(path) {\n\treturn path.split(sep).join(\"/\");\n}\n/**\n* Resolve manifest moduleFile values to project-root-relative source paths.\n*\n* Discovery runs over compiled `dist/` modules, so the raw moduleFile is a\n* dist-relative `.mjs` path. Dist entries are named by their source entry id\n* (`team/escalation.mjs` ← `src/agents/team/escalation/agent.ts`), so walking\n* the matching source dir by the same id rules recovers the source path. Falls\n* back to the dist-relative value when no source file matches (e.g. building\n* a dist-only artifact with no `src/`).\n*/\nvar SourceModuleFileResolver = class {\n\tprojectRoot;\n\tmapsByKind = /* @__PURE__ */ new Map();\n\tconstructor(projectRoot) {\n\t\tthis.projectRoot = projectRoot;\n\t}\n\tasync sourceMapFor(kindDir, nestedEntry) {\n\t\tconst existing = this.mapsByKind.get(kindDir);\n\t\tif (existing) return existing;\n\t\tconst map = /* @__PURE__ */ new Map();\n\t\tconst sourceDir = join(this.projectRoot, \"src\", kindDir);\n\t\tfor (const filePath of await walkTypeScriptFiles(sourceDir)) {\n\t\t\tconst id = entryIdFromFile(sourceDir, filePath, { nestedEntry });\n\t\t\tif (id) map.set(id, toPosix(relative(this.projectRoot, filePath)));\n\t\t}\n\t\tthis.mapsByKind.set(kindDir, map);\n\t\treturn map;\n\t}\n\tasync resolve(kindDir, nestedEntry, distDir, distFilePath) {\n\t\tconst fallback = toPosix(relative(distDir, distFilePath));\n\t\tconst id = entryIdFromFile(distDir, distFilePath, { nestedEntry });\n\t\tif (!id) return fallback;\n\t\treturn (await this.sourceMapFor(kindDir, nestedEntry)).get(id) ?? fallback;\n\t}\n};\n/** Build a stored route manifest from compiled dist/ modules without starting a server. */\nasync function buildStoredRouteManifestForProject(projectRoot, options) {\n\tconst previousRoot = process.env.KEYSTROKE_ROOT;\n\tprocess.env.KEYSTROKE_ROOT = projectRoot;\n\tconst reload = options?.reloadModules ? { reload: true } : void 0;\n\ttry {\n\t\tconst dirs = resolveDistModuleDirs(projectRoot);\n\t\tconst sourcePaths = new SourceModuleFileResolver(projectRoot);\n\t\tconst manifest = [{\n\t\t\tkind: \"health\",\n\t\t\tmethod: \"GET\",\n\t\t\tpath: \"/health\"\n\t\t}];\n\t\tconst agentEntries = await discoverAgentEntries(dirs.agentsDir, reload);\n\t\tfor (const entry of agentEntries) {\n\t\t\tconst agent = await importAgentDefinition(entry.filePath, reload);\n\t\t\tconst moduleFile = await sourcePaths.resolve(\"agents\", \"agent\", dirs.agentsDir, entry.filePath);\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"agent\",\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tpath: entry.route,\n\t\t\t\tagentSlug: agent.slug,\n\t\t\t\tmoduleFile,\n\t\t\t\tname: agent.name,\n\t\t\t\tdescription: agent.description,\n\t\t\t\tmodel: agent.model,\n\t\t\t\tsystemPrompt: agent.systemPrompt,\n\t\t\t\ttoolCount: agent.tools?.length ?? 0,\n\t\t\t\tcredentialCount: countAgentCredentials(agent),\n\t\t\t\trequest: PromptInputSchema,\n\t\t\t\tresponse: PromptResponseSchema\n\t\t\t});\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"agent-sessions-list\",\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tpath: agentSessionsListPath(entry.route),\n\t\t\t\tagentSlug: entry.key,\n\t\t\t\tmoduleFile\n\t\t\t});\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"agent-session-detail\",\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tpath: agentSessionDetailPath(entry.route),\n\t\t\t\tagentSlug: entry.key,\n\t\t\t\tmoduleFile\n\t\t\t});\n\t\t}\n\t\tconst workflows = await discoverWorkflows(dirs.workflowsDir, reload);\n\t\tfor (const workflow of workflows) {\n\t\t\tconst route = workflowRouteFromKey(workflow.key);\n\t\t\tconst moduleFile = await sourcePaths.resolve(\"workflows\", \"workflow\", dirs.workflowsDir, workflow.filePath);\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"workflow\",\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tpath: route,\n\t\t\t\tworkflowSlug: workflow.definition.slug,\n\t\t\t\tworkflowName: workflow.definition.name,\n\t\t\t\tdescription: workflow.definition.description,\n\t\t\t\tsubscribable: workflow.definition.subscription?.mode === \"subscribable\",\n\t\t\t\tmoduleFile,\n\t\t\t\trequest: workflow.definition.input,\n\t\t\t\tresponse: workflow.definition.output\n\t\t\t});\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"workflow-runs-list\",\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tpath: workflowRunsListPath(route),\n\t\t\t\tworkflowSlug: workflow.definition.slug,\n\t\t\t\tworkflowName: workflow.definition.name,\n\t\t\t\tmoduleFile\n\t\t\t});\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"workflow-run-detail\",\n\t\t\t\tmethod: \"GET\",\n\t\t\t\tpath: workflowRunDetailPath(route),\n\t\t\t\tworkflowSlug: workflow.definition.slug,\n\t\t\t\tworkflowName: workflow.definition.name,\n\t\t\t\tmoduleFile\n\t\t\t});\n\t\t}\n\t\tconst attachments = await discoverTriggerAttachments(dirs.triggersDir, reload);\n\t\tconst discoveredByKey = new Map(attachments.map((attachment) => [attachment.key, attachment]));\n\t\tconst pollGroups = buildPollGroups(attachments);\n\t\tfor (const discovered of discoveredByKey.values()) {\n\t\t\tconst source = discovered.attachment.source;\n\t\t\tconst moduleFile = await sourcePaths.resolve(\"triggers\", \"trigger\", dirs.triggersDir, discovered.filePath);\n\t\t\tif (source.kind === \"cron\") {\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"cron-schedule\",\n\t\t\t\t\tattachmentId: discovered.key,\n\t\t\t\t\tmoduleFile,\n\t\t\t\t\tschedule: source.schedule\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (source.kind === \"poll\") {\n\t\t\t\tconst route = pollRouteFromKey(source.key);\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"trigger-poll\",\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tpath: route,\n\t\t\t\t\tattachmentId: discovered.key,\n\t\t\t\t\tmoduleFile,\n\t\t\t\t\tschedule: source.schedule,\n\t\t\t\t\tresponse: PromptResponseSchema\n\t\t\t\t});\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"trigger-runs-list\",\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\tpath: triggerRunsListPath(discovered.key),\n\t\t\t\t\tattachmentId: discovered.key,\n\t\t\t\t\tmoduleFile\n\t\t\t\t});\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"trigger-run-detail\",\n\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\tpath: triggerRunDetailPath(discovered.key),\n\t\t\t\t\tattachmentId: discovered.key,\n\t\t\t\t\tmoduleFile\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (source.kind === \"webhook\") {\n\t\t\t\tconst route = webhookRouteFromEndpoint(source.endpoint);\n\t\t\t\tconst bindings = buildWebhookBindingsByRoute(discoveredByKey.values(), () => ({\n\t\t\t\t\texecution: { attachmentKey: discovered.key },\n\t\t\t\t\tattachmentKey: discovered.key\n\t\t\t\t})).get(route) ?? [{\n\t\t\t\t\tdiscovered,\n\t\t\t\t\toptions: { attachmentKey: discovered.key }\n\t\t\t\t}];\n\t\t\t\tmanifest.push({\n\t\t\t\t\tkind: \"trigger-webhook\",\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\tpath: route,\n\t\t\t\t\tattachmentIds: bindings.map(({ discovered: row }) => row.key),\n\t\t\t\t\tmoduleFile,\n\t\t\t\t\trequest: webhookMatchSchemaForBindings(bindings),\n\t\t\t\t\tattachmentSchemas: webhookManifestAttachmentSchemasFromBindings(bindings),\n\t\t\t\t\tresponse: PromptResponseSchema\n\t\t\t\t});\n\t\t\t\tfor (const { discovered: row } of bindings) {\n\t\t\t\t\tconst rowModuleFile = await sourcePaths.resolve(\"triggers\", \"trigger\", dirs.triggersDir, row.filePath);\n\t\t\t\t\tmanifest.push({\n\t\t\t\t\t\tkind: \"trigger-runs-list\",\n\t\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\t\tpath: triggerRunsListPath(row.key),\n\t\t\t\t\t\tattachmentId: row.key,\n\t\t\t\t\t\tmoduleFile: rowModuleFile\n\t\t\t\t\t});\n\t\t\t\t\tmanifest.push({\n\t\t\t\t\t\tkind: \"trigger-run-detail\",\n\t\t\t\t\t\tmethod: \"GET\",\n\t\t\t\t\t\tpath: triggerRunDetailPath(row.key),\n\t\t\t\t\t\tattachmentId: row.key,\n\t\t\t\t\t\tmoduleFile: rowModuleFile\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const group of pollGroups) {\n\t\t\tif (group.attachments.length <= 1) continue;\n\t\t\tconst first = group.attachments[0];\n\t\t\tconst source = first.attachment.source;\n\t\t\tmanifest.push({\n\t\t\t\tkind: \"trigger-poll-group\",\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tpath: pollGroupRouteFromId(group.id),\n\t\t\t\tpollId: group.id,\n\t\t\t\tattachmentIds: group.attachments.map((attachment) => attachment.key),\n\t\t\t\tmoduleFile: await sourcePaths.resolve(\"triggers\", \"trigger\", dirs.triggersDir, first.filePath),\n\t\t\t\tschedule: source.kind === \"poll\" ? source.schedule : \"\",\n\t\t\t\tresponse: PromptResponseSchema\n\t\t\t});\n\t\t}\n\t\treturn buildStoredRouteManifestFromContext({\n\t\t\tmanifest,\n\t\t\toptions: {},\n\t\t\tprojectRoot,\n\t\t\tskills: discoverSkillManifestEntries(projectRoot)\n\t\t});\n\t} finally {\n\t\tif (previousRoot === void 0) delete process.env.KEYSTROKE_ROOT;\n\t\telse process.env.KEYSTROKE_ROOT = previousRoot;\n\t}\n}\n/** Write `dist/.keystroke/route-manifest.json` for the project. */\nasync function emitStoredRouteManifestForProject(projectRoot) {\n\tpersistStoredRouteManifest(projectRoot, await buildStoredRouteManifestForProject(projectRoot));\n}\n//#endregion\n//#region src/openapi/manifest.ts\nfunction schedulesFromManifest(manifest) {\n\tconst schedules = [];\n\tfor (const entry of manifest) {\n\t\tif (entry.kind === \"cron-schedule\") {\n\t\t\tschedules.push({\n\t\t\t\tattachmentId: entry.attachmentId,\n\t\t\t\ttype: \"cron\",\n\t\t\t\tschedule: entry.schedule\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (entry.kind === \"trigger-poll\") schedules.push({\n\t\t\tattachmentId: entry.attachmentId,\n\t\t\ttype: \"poll\",\n\t\t\tschedule: entry.schedule\n\t\t});\n\t}\n\treturn schedules;\n}\n//#endregion\n//#region src/load-route-manifest.ts\nfunction routeManifestPathForProjectRoot(projectRoot) {\n\treturn join(projectRoot, ROUTE_MANIFEST_REL_PATH);\n}\nfunction readRouteManifest(projectRoot) {\n\tconst path = routeManifestPathForProjectRoot(projectRoot);\n\tif (!existsSync(path)) throw new Error(`${ROUTE_MANIFEST_REL_PATH} not found — start the project server once to emit the manifest`);\n\tconst raw = readFileSync(path, \"utf8\");\n\treturn parseStoredRouteManifest(JSON.parse(raw));\n}\n//#endregion\nexport { agentRouteFromKey, agentSessionDetailPath, agentSessionsListPath, buildPollGroups, buildStoredRouteManifestForProject, buildStoredRouteManifestFromContext, buildWebhookBindingsByRoute, countAgentCredentials, discoverAgentEntries, discoverEntries, discoverModuleFileEntries, discoverSkillManifestEntries, discoverTriggerAttachments, discoverWorkflowEntries, discoverWorkflows, emitStoredRouteManifestForProject, entryIdFromFile, findWebhookManifestEntryByPath, findWorkflowManifestEntry, importAgentDefinition, importTriggerAttachment, importWorkflowDefinition, matchesPollRunTarget, moduleFileKeyFromPath, persistStoredRouteManifest, pollGroupId, pollGroupRouteFromId, pollRouteFromKey, readRouteManifest, routeManifestPathForProjectRoot, schedulesFromManifest, schemaToJson, serializeRouteManifest, toStoredRouteManifest, triggerRunDetailPath, triggerRunsListPath, validateImportedTriggerAttachment, validateImportedWorkflowDefinition, validatePollGroups, validateUniqueModuleKeys, walkTypeScriptFiles, webhookAttachmentSchemasFromBindings, webhookManifestAttachmentSchemasFromBindings, webhookMatchSchemaForBindings, webhookRouteFromEndpoint, workflowRouteFromKey, workflowRunDetailPath, workflowRunsListPath };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;AAIA,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,SAAS,gBAAgB,SAAS,UAAU,SAAS;CACpD,IAAI,mBAAmB,KAAK,QAAQ,GAAG,OAAO;CAC9C,MAAM,WAAW,SAAS,MAAM,GAAG,EAAE,GAAG,EAAE,KAAK;CAC/C,IAAI,4BAA4B,KAAK,QAAQ,GAAG,OAAO;CACvD,MAAM,WAAW,SAAS,SAAS,QAAQ,EAAE,QAAQ,YAAY,EAAE,EAAE,MAAM,GAAG,EAAE,QAAQ,YAAY,QAAQ,SAAS,CAAC;CACtH,IAAI,SAAS,WAAW,GAAG,OAAO,SAAS,MAAM;CACjD,MAAM,OAAO,SAAS,GAAG,EAAE;CAC3B,MAAM,aAAa,IAAI,IAAI,CAAC,QAAQ,WAAW,CAAC;CAChD,IAAI,QAAQ,eAAe,OAAO,WAAW,IAAI,OAAO;CACxD,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,GAAG,OAAO;CAC3C,MAAM,KAAK,SAAS,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG;CACzC,OAAO,GAAG,SAAS,IAAI,KAAK;AAC7B;AAGA,MAAM,cAAc;AACpB,MAAM,YAAY;AAClB,MAAM,mBAAmB;AACzB,MAAM,YAAY;AAClB,eAAe,oBAAoB,KAAK;CACvC,IAAI;CACJ,IAAI;EACH,QAAQ,MAAM,QAAQ,GAAG;CAC1B,SAAS,OAAO;EACf,IAAI,MAAM,SAAS,UAAU,OAAO,CAAC;EACrC,MAAM;CACP;CACA,MAAM,QAAQ,CAAC;CACf,KAAK,MAAM,QAAQ,OAAO;EACzB,MAAM,OAAO,KAAK,KAAK,IAAI;EAC3B,KAAK,MAAM,KAAK,IAAI,GAAG,YAAY,GAAG,MAAM,K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A,OAAO,oCAAoC;GAC1C;GACA,SAAS,CAAC;GACV;GACA,QAAQ,6BAA6B,WAAW;EACjD,CAAC;CACF,UAAU;EACT,IAAI,iBAAiB,KAAK,GAAG,OAAO,QAAQ,IAAI;OAC3C,QAAQ,IAAI,iBAAiB;CACnC;AACD;;AAEA,eAAe,kCAAkC,aAAa;CAC7D,2BAA2B,aAAa,MAAM,mCAAmC,WAAW,CAAC;AAC9F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { cn as object, in as array, ln as string } from "./dist-
|
|
3
|
-
import { L as entryIdFromFile, R as readKeystrokeIgnoreDirective, a as buildStoredRouteManifestForProject, z as shouldSkipKeystrokeModuleFile } from "./dist-
|
|
2
|
+
import { cn as object, in as array, ln as string } from "./dist-XVz5PFMT.mjs";
|
|
3
|
+
import { L as entryIdFromFile, R as readKeystrokeIgnoreDirective, a as buildStoredRouteManifestForProject, z as shouldSkipKeystrokeModuleFile } from "./dist-DEnhPwK2.mjs";
|
|
4
4
|
import { isBuiltin } from "node:module";
|
|
5
5
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
6
6
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -549,7 +549,7 @@ async function buildApp(options = {}) {
|
|
|
549
549
|
ignoredFiles: walked.ignoredFiles
|
|
550
550
|
}));
|
|
551
551
|
if (emitManifest) {
|
|
552
|
-
const { emitStoredRouteManifestForProject } = await import("./dist-
|
|
552
|
+
const { emitStoredRouteManifestForProject } = await import("./dist-Cn8Feaea.mjs");
|
|
553
553
|
await emitStoredRouteManifestForProject(root);
|
|
554
554
|
}
|
|
555
555
|
} finally {
|
|
@@ -574,4 +574,4 @@ async function watchApp(options = {}) {
|
|
|
574
574
|
//#endregion
|
|
575
575
|
export { buildApp, buildFilteredApp, resolveRuntimeBuildArtifact, watchApp };
|
|
576
576
|
|
|
577
|
-
//# sourceMappingURL=dist-
|
|
577
|
+
//# sourceMappingURL=dist-DdjMxlbo.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dist-BQ5MoLdP.mjs","names":["toPosix","z.object","z.string","z.array"],"sources":["../../../packages/build/dist/walk-project-eZ95LOUW.mjs","../../../packages/sandbox/dist/files-B0H9_dP4.mjs","../../../packages/tsdown-config/deps.js","../../../packages/tsdown-config/index.js","../../../packages/build/dist/index.mjs"],"sourcesContent":["import { readFileSync, readdirSync, realpathSync, statSync } from \"node:fs\";\nimport { join, relative, resolve, sep } from \"node:path\";\nimport { createHash } from \"node:crypto\";\nimport { entryIdFromFile, readKeystrokeIgnoreDirective, shouldSkipKeystrokeModuleFile } from \"@keystrokehq/manifest/discovery\";\nimport { fileURLToPath } from \"node:url\";\n//#region src/ignore-guard-plugin.ts\nfunction toPosix$1(path) {\n\treturn path.split(sep).join(\"/\");\n}\nfunction projectRelativePath(root, filePath) {\n\treturn toPosix$1(relative(root, normalizeBuildFilePath(filePath)));\n}\n/** Normalize paths so /var and /private/var compare equal on macOS. */\nfunction normalizeBuildFilePath(filePath) {\n\tconst absolute = resolve(filePath);\n\ttry {\n\t\treturn realpathSync.native(absolute);\n\t} catch {\n\t\treturn absolute;\n\t}\n}\nfunction normalizeModuleId(id, root) {\n\tif (id.startsWith(\"\\0\")) return null;\n\tconst normalized = normalizeBuildFilePath(id.startsWith(\"file://\") ? fileURLToPath(id) : id);\n\tif (!normalized.startsWith(normalizeBuildFilePath(root))) return null;\n\treturn normalized;\n}\nfunction formatImportGuardError(root, ignoredPath, importer) {\n\tconst ignored = projectRelativePath(root, ignoredPath);\n\tif (importer) return `Cannot import \"${ignored}\" (@keystroke ignore) from \"${projectRelativePath(root, importer)}\". Remove the directive or stop importing it from a shipped module.`;\n\treturn `Cannot import \"${ignored}\" (@keystroke ignore). Remove the directive or stop importing it from a shipped module.`;\n}\n/** Throw when a built module imports a `@keystroke ignore` source file. */\nfunction keystrokeIgnoreGuardPlugin(options) {\n\tconst root = normalizeBuildFilePath(options.root);\n\tconst ignoredFiles = new Set(options.ignoredFiles.map((filePath) => normalizeBuildFilePath(filePath)));\n\tfunction assertNotIgnored(filePath, importer) {\n\t\tconst normalized = normalizeBuildFilePath(filePath);\n\t\tif (!ignoredFiles.has(normalized)) return;\n\t\tthrow new Error(formatImportGuardError(root, normalized, importer));\n\t}\n\treturn {\n\t\tname: \"keystroke-ignore-guard\",\n\t\tasync resolveId(source, importer, resolveOptions) {\n\t\t\tif (resolveOptions?.isEntry || !importer) return null;\n\t\t\tconst resolved = await this.resolve(source, importer, {\n\t\t\t\t...resolveOptions,\n\t\t\t\tskipSelf: true\n\t\t\t});\n\t\t\tif (!resolved) return null;\n\t\t\tassertNotIgnored(typeof resolved === \"string\" ? resolved : resolved.id, importer);\n\t\t\treturn null;\n\t\t},\n\t\tload(id) {\n\t\t\tconst normalized = normalizeModuleId(id, root);\n\t\t\tif (!normalized) return null;\n\t\t\tassertNotIgnored(normalized);\n\t\t\treturn null;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/walk-project.ts\nconst IGNORED_DIRS = new Set([\n\t\"node_modules\",\n\t\"dist\",\n\t\".git\",\n\t\".turbo\",\n\t\"build\",\n\t\"coverage\",\n\t\".keystroke\",\n\t\".cache\",\n\t\"tmp\"\n]);\nconst IGNORED_ENV_FILE = /\\.env/;\nconst IGNORED_LOG_FILE = /\\.log$/;\nfunction isIgnoredFile(name) {\n\treturn IGNORED_ENV_FILE.test(name) || IGNORED_LOG_FILE.test(name);\n}\nfunction toPosix(path) {\n\treturn path.split(sep).join(\"/\");\n}\nfunction isProbablyBinary(buffer) {\n\tconst sampleLength = Math.min(buffer.length, 8e3);\n\tfor (let index = 0; index < sampleLength; index += 1) if (buffer[index] === 0) return true;\n\treturn false;\n}\nfunction classifyBuildEntry(root, srcRoot, filePath) {\n\tconst relativePath = toPosix(relative(root, filePath));\n\tconst agentsPrefix = `${toPosix(relative(root, join(srcRoot, \"agents\")))}/`;\n\tconst workflowsPrefix = `${toPosix(relative(root, join(srcRoot, \"workflows\")))}/`;\n\tconst triggersPrefix = `${toPosix(relative(root, join(srcRoot, \"triggers\")))}/`;\n\tif (relativePath.startsWith(agentsPrefix) && /\\.(ts|mts)$/.test(relativePath) && !/\\.(int\\.)?test\\.(ts|mts)$/.test(relativePath)) {\n\t\tconst id = entryIdFromFile(join(srcRoot, \"agents\"), filePath, { nestedEntry: \"agent\" });\n\t\treturn id ? {\n\t\t\tentryKey: `agents/${id}`,\n\t\t\tentryPath: filePath\n\t\t} : null;\n\t}\n\tif (relativePath.startsWith(workflowsPrefix) && /\\.(ts|mts)$/.test(relativePath) && !/\\.(int\\.)?test\\.(ts|mts)$/.test(relativePath)) {\n\t\tconst id = entryIdFromFile(join(srcRoot, \"workflows\"), filePath, { nestedEntry: \"workflow\" });\n\t\treturn id ? {\n\t\t\tentryKey: `workflows/${id}`,\n\t\t\tentryPath: filePath\n\t\t} : null;\n\t}\n\tif (relativePath.startsWith(triggersPrefix) && /\\.(ts|mts)$/.test(relativePath) && !/\\.(int\\.)?test\\.(ts|mts)$/.test(relativePath)) {\n\t\tconst id = entryIdFromFile(join(srcRoot, \"triggers\"), filePath, { nestedEntry: \"trigger\" });\n\t\treturn id ? {\n\t\t\tentryKey: `triggers/${id}`,\n\t\t\tentryPath: filePath\n\t\t} : null;\n\t}\n\treturn null;\n}\nfunction shouldSkipIgnoredModule(filePath, phase) {\n\treturn shouldSkipKeystrokeModuleFile(readKeystrokeIgnoreDirective(filePath), phase);\n}\nfunction isSrcTypeScriptFile(srcRoot, filePath) {\n\tconst relativePath = toPosix(relative(srcRoot, filePath));\n\tif (relativePath.startsWith(\"..\")) return false;\n\treturn /\\.(ts|mts)$/.test(relativePath);\n}\nfunction walkTree(root, dir, srcRoot, phase, collectSources, sourceFiles, buildEntries, ignoredFiles, totals) {\n\tfor (const name of readdirSync(dir).sort()) {\n\t\tif (collectSources && (sourceFiles.length >= 2e3 || totals.bytes >= 8388608)) return;\n\t\tconst absolute = join(dir, name);\n\t\tconst stats = statSync(absolute);\n\t\tif (stats.isDirectory()) {\n\t\t\tif (IGNORED_DIRS.has(name)) continue;\n\t\t\twalkTree(root, absolute, srcRoot, phase, collectSources, sourceFiles, buildEntries, ignoredFiles, totals);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!stats.isFile()) continue;\n\t\tconst isUnderSrc = isSrcTypeScriptFile(srcRoot, absolute);\n\t\tconst skipIgnored = isUnderSrc ? shouldSkipIgnoredModule(absolute, phase) : false;\n\t\tif (isUnderSrc && skipIgnored) ignoredFiles.push(normalizeBuildFilePath(absolute));\n\t\tconst buildEntry = classifyBuildEntry(root, srcRoot, absolute);\n\t\tif (buildEntry && !skipIgnored) buildEntries[buildEntry.entryKey] = buildEntry.entryPath;\n\t\tif (!collectSources) continue;\n\t\tif (stats.size > 262144 || isIgnoredFile(name)) continue;\n\t\tconst buffer = readFileSync(absolute);\n\t\tif (isProbablyBinary(buffer)) continue;\n\t\ttotals.bytes += buffer.byteLength;\n\t\tsourceFiles.push({\n\t\t\tpath: toPosix(relative(root, absolute)),\n\t\t\tcontents: buffer.toString(\"utf8\"),\n\t\t\thash: createHash(\"sha256\").update(buffer).digest(\"hex\")\n\t\t});\n\t}\n}\n/**\n* One full-tree walk of the project: classifies tsdown entries and optionally\n* collects deploy source files (path + contents + hash) under snapshot limits.\n*/\nfunction walkProject(root, srcDirOrOptions = \"src\", maybeOptions) {\n\tconst srcDir = typeof srcDirOrOptions === \"string\" ? srcDirOrOptions : srcDirOrOptions.srcDir ?? \"src\";\n\tconst options = typeof srcDirOrOptions === \"string\" ? maybeOptions ?? {} : srcDirOrOptions;\n\tconst collectSources = options.collectSources ?? false;\n\tconst phase = options.phase ?? \"build\";\n\tconst sourceFiles = [];\n\tconst buildEntries = {};\n\tconst ignoredFiles = [];\n\twalkTree(root, root, join(root, srcDir), phase, collectSources, sourceFiles, buildEntries, ignoredFiles, { bytes: 0 });\n\treturn {\n\t\tsourceFiles,\n\t\tbuildEntries,\n\t\tignoredFiles\n\t};\n}\n//#endregion\nexport { keystrokeIgnoreGuardPlugin as n, walkProject as t };\n\n//# sourceMappingURL=walk-project-eZ95LOUW.mjs.map","import { basename, dirname, join, relative, resolve } from \"node:path\";\nimport { access, mkdir, writeFile } from \"node:fs/promises\";\nimport { z } from \"zod\";\nimport { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n//#region src/sandbox-dirs.ts\nfunction resolveSandboxRoot(workspacesRoot, scope) {\n\tif (scope.type === \"agent\") return join(workspacesRoot, scope.agentId);\n\treturn join(workspacesRoot, \"runs\", scope.runId);\n}\nasync function ensureWorkspaceDir(workspaceRoot) {\n\tawait mkdir(workspaceRoot, { recursive: true });\n}\n//#endregion\n//#region src/files/schemas.ts\nconst SandboxFileContentSchema = z.object({\n\tpath: z.string(),\n\tfile: z.string()\n});\n/** Destination path under `/workspace`. For `dir`, used as a prefix. */\nconst SandboxFileSchema = z.object({\n\tpath: z.string(),\n\t/** Single file body — typically from a build-time import (`import doc from \"./doc.md\"`). */\n\tfile: z.string().optional(),\n\t/** Directory contents — each path is relative to `path`. */\n\tdir: z.array(SandboxFileContentSchema).optional()\n});\nconst SandboxDefinitionSchema = z.object({\n\tkey: z.string().optional(),\n\tfiles: z.array(SandboxFileSchema).optional()\n});\n//#endregion\n//#region src/files/define-sandbox.ts\n/** Define a reusable sandbox file layout. */\nfunction defineSandbox(def) {\n\treturn def;\n}\n//#endregion\n//#region src/files/flatten-sandbox-files.ts\n/** Expand directory entries into flat `{ path, file }` records under `/workspace`. */\nfunction flattenSandboxFiles(files) {\n\tif (!files?.length) return [];\n\tconst flattened = [];\n\tfor (const entry of files) {\n\t\tif (entry.dir !== void 0) {\n\t\t\tconst prefix = entry.path.replace(/\\/+$/, \"\");\n\t\t\tfor (const child of entry.dir) flattened.push({\n\t\t\t\tpath: prefix ? `${prefix}/${child.path}` : child.path,\n\t\t\t\tfile: child.file\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (entry.file === void 0) continue;\n\t\tflattened.push({\n\t\t\tpath: entry.path,\n\t\t\tfile: entry.file\n\t\t});\n\t}\n\treturn flattened;\n}\n//#endregion\n//#region src/files/materialize-sandbox.ts\nasync function materializeSandbox(options) {\n\tconst root = resolveSandboxRoot(options.workspacesRoot, options.scope);\n\tawait ensureWorkspaceDir(root);\n\tconst files = flattenSandboxFiles(options.definition?.files);\n\tif (files.length) await applySandboxFiles(root, files, options.scope);\n\treturn {\n\t\troot,\n\t\tscope: options.scope,\n\t\t...options.definition !== void 0 ? { definition: options.definition } : {}\n\t};\n}\nasync function applySandboxFiles(root, files, scope) {\n\tfor (const entry of files) {\n\t\tconst hostPath = resolve(root, entry.path);\n\t\tif (scope.type === \"agent\") try {\n\t\t\tawait access(hostPath);\n\t\t\tcontinue;\n\t\t} catch {}\n\t\tawait mkdir(dirname(hostPath), { recursive: true });\n\t\tawait writeFile(hostPath, entry.file);\n\t}\n}\n//#endregion\n//#region src/files/pack-dir.ts\nconst SKIP_DIRS$1 = new Set([\".git\", \"node_modules\"]);\n/** Recursively read a host file or directory into sandbox-relative `{ path, file }` entries. */\nfunction packDirFromDisk(rootPath) {\n\tconst stat = statSync(rootPath);\n\tif (stat.isFile()) return [{\n\t\tpath: basename(rootPath),\n\t\tfile: readFileSync(rootPath, \"utf8\")\n\t}];\n\tif (!stat.isDirectory()) throw new Error(`Expected a file or directory at ${rootPath}`);\n\tconst files = [];\n\twalkDir(rootPath, rootPath, files);\n\treturn files;\n}\nfunction walkDir(rootPath, currentPath, files) {\n\tfor (const name of readdirSync(currentPath)) {\n\t\tif (SKIP_DIRS$1.has(name)) continue;\n\t\tconst entryPath = join(currentPath, name);\n\t\tconst stat = statSync(entryPath);\n\t\tif (stat.isDirectory()) {\n\t\t\twalkDir(rootPath, entryPath, files);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!stat.isFile()) continue;\n\t\tfiles.push({\n\t\t\tpath: relative(rootPath, entryPath),\n\t\t\tfile: readFileSync(entryPath, \"utf8\")\n\t\t});\n\t}\n}\n//#endregion\n//#region src/files/pack-asset-dirs.ts\nconst SKIP_DIRS = new Set([\".git\", \"node_modules\"]);\n/** Pack every subdir under `src/skills/` and `src/files/` into an asset manifest. */\nfunction packAssetDirs(appRoot, srcDir = \"src\") {\n\treturn {\n\t\tskills: packAssetRoot(join(appRoot, srcDir, \"skills\")),\n\t\tfiles: packAssetRoot(join(appRoot, srcDir, \"files\"))\n\t};\n}\nfunction packAssetRoot(rootPath) {\n\tif (!statSync(rootPath, { throwIfNoEntry: false })?.isDirectory()) return {};\n\tconst manifest = {};\n\tfor (const name of readdirSync(rootPath)) {\n\t\tif (SKIP_DIRS.has(name)) continue;\n\t\tconst entryPath = join(rootPath, name);\n\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\tmanifest[name] = packDirFromDisk(entryPath);\n\t}\n\treturn manifest;\n}\n//#endregion\n//#region src/files/resolve-app-root.ts\n/** Walk upward from a module file to find the user app root (`src/agents`, `src/skills`, etc.). */\nfunction resolveAppRoot(fromPath) {\n\tlet dir = statSync(fromPath).isDirectory() ? fromPath : dirname(fromPath);\n\twhile (dir !== dirname(dir)) {\n\t\tif (hasAppLayout(dir)) return dir;\n\t\tdir = dirname(dir);\n\t}\n\treturn process.env.KEYSTROKE_ROOT ?? process.cwd();\n}\n/** Resolve app root from an agent (or other) module URL. */\nfunction resolveAppRootFromModule(moduleUrl) {\n\treturn resolveAppRoot(fileURLToPath(moduleUrl));\n}\nfunction hasAppLayout(dir) {\n\tconst src = join(dir, \"src\");\n\tconst dist = join(dir, \"dist\");\n\treturn existsSync(join(src, \"agents\")) || existsSync(join(src, \"skills\")) || existsSync(join(src, \"files\")) || existsSync(join(dist, \"agents\")) || existsSync(join(dist, \".keystroke\", \"assets.mjs\"));\n}\n//#endregion\nexport { materializeSandbox as a, SandboxDefinitionSchema as c, ensureWorkspaceDir as d, resolveSandboxRoot as f, packDirFromDisk as i, SandboxFileContentSchema as l, resolveAppRootFromModule as n, flattenSandboxFiles as o, packAssetDirs as r, defineSandbox as s, resolveAppRoot as t, SandboxFileSchema as u };\n\n//# sourceMappingURL=files-B0H9_dP4.mjs.map","import { isBuiltin } from \"node:module\";\n\n/** Native addons kept external — resolved from the CLI runtime at app start. */\nexport const NATIVE_RUNTIME_DEPS = [\"pg\", \"better-sqlite3\", \"@parcel/watcher\"];\n\n/** Kept external so .d.ts emission does not inline internal/inferred types. */\nexport const LIBRARY_EXTERNAL_DEPS = [\"better-auth\", /^@better-auth\\//, /^better-auth\\//];\n\n/** Non-auth runtime deps kept external for published entry bundles (platform, etc.). */\nexport const BUNDLED_ENTRY_RUNTIME_EXTERNAL_DEPS = [\n ...NATIVE_RUNTIME_DEPS,\n \"dockerode\",\n \"ssh2\",\n \"cpu-features\",\n \"microsandbox\",\n /^@aws-sdk\\//,\n /^@napi-rs\\//,\n \"hono\",\n /^@hono\\//,\n \"undici\",\n];\n\n/** Kept external when bundling published entry points (cli, keystroke, platform). */\nexport const BUNDLED_ENTRY_EXTERNAL_DEPS = [\n ...BUNDLED_ENTRY_RUNTIME_EXTERNAL_DEPS,\n ...LIBRARY_EXTERNAL_DEPS,\n];\n\n/** Bundle into CLI — device login uses Better Auth client only. */\nexport const BETTER_AUTH_CLIENT_BUNDLE_PATTERNS = [\n /^better-auth\\/client$/,\n /^better-auth\\/client\\//,\n];\n\n/** Server adapters and root entry — must not ship in the CLI bundle. */\nexport const BETTER_AUTH_SERVER_EXTERNAL_PATTERNS = [\n /^better-auth$/,\n /^@better-auth\\//,\n /^better-auth\\/(?!client(\\/|$)).+/,\n];\n\nexport function isNativeRuntimeDep(id) {\n return NATIVE_RUNTIME_DEPS.some((dep) => id === dep || id.startsWith(`${dep}/`));\n}\n\nfunction packageName(id) {\n if (id.startsWith(\"@\")) {\n const [scope, name] = id.split(\"/\");\n return name ? `${scope}/${name}` : id;\n }\n\n return id.split(\"/\")[0] ?? id;\n}\n\nfunction isRuntimeExternal(id) {\n const name = packageName(id);\n if (isNativeRuntimeDep(name)) {\n return true;\n }\n\n if (name.startsWith(\"@keystrokehq/\")) {\n return true;\n }\n\n if (name === \"better-auth\" || name.startsWith(\"@better-auth/\")) {\n return true;\n }\n\n return false;\n}\n\n/** Library packages resolve npm deps from node_modules at runtime. */\nexport function libraryBuildDepsConfig() {\n return {\n alwaysBundle: (_id) => null,\n neverBundle: [...NATIVE_RUNTIME_DEPS, /^@keystrokehq\\//, ...LIBRARY_EXTERNAL_DEPS],\n onlyBundle: false,\n };\n}\n\n/** Bundle npm deps into dist; resolve @keystrokehq/* and natives from the runtime. */\nexport function userAppBuildDepsConfig() {\n return {\n alwaysBundle: (id, _importer) => {\n if (id.startsWith(\".\") || id.startsWith(\"/\") || isBuiltin(id)) {\n return null;\n }\n\n return isRuntimeExternal(id) ? null : true;\n },\n neverBundle: [...NATIVE_RUNTIME_DEPS, /^@keystrokehq\\//, ...LIBRARY_EXTERNAL_DEPS],\n onlyBundle: false,\n };\n}\n\n/**\n * Published entry packages (cli, keystroke, platform): declare bundled @keystrokehq/*\n * in dependencies (changesets release graph ignores devDependencies). Inlining is\n * driven by alwaysBundle below, not by dep kind. Runtime npm deps stay external.\n */\nexport function bundledEntryDepsConfig() {\n return {\n alwaysBundle: [/^@keystrokehq\\//],\n neverBundle: [...BUNDLED_ENTRY_EXTERNAL_DEPS],\n onlyBundle: false,\n };\n}\n\n/** Published CLI: inline better-auth client + @better-auth/*; keep server adapters external. */\nexport const BETTER_AUTH_CLI_BUNDLE_PATTERNS = [\n ...BETTER_AUTH_CLIENT_BUNDLE_PATTERNS,\n /^@better-auth\\//,\n];\n\nexport const BETTER_AUTH_CLI_EXTERNAL_PATTERNS = [\n /^better-auth$/,\n /^better-auth\\/(?!client(\\/|$)).+/,\n /^@better-auth\\/drizzle-adapter/,\n \"drizzle-orm\",\n];\n\n/** Rolldown/tsdown — native bindings; stay in CLI node_modules at runtime. */\nexport const CLI_BUILD_TOOL_EXTERNAL_PATTERNS = [\"tsdown\", \"rolldown\", /^@rolldown\\//, \"tsx\"];\n\n/** CLI: inline better-auth/client; keep server + drizzle adapters external. */\nexport function cliBundledEntryDepsConfig() {\n return {\n alwaysBundle: [/^@keystrokehq\\//, ...BETTER_AUTH_CLI_BUNDLE_PATTERNS],\n neverBundle: [\n ...BUNDLED_ENTRY_RUNTIME_EXTERNAL_DEPS,\n ...BETTER_AUTH_CLI_EXTERNAL_PATTERNS,\n ...CLI_BUILD_TOOL_EXTERNAL_PATTERNS,\n ],\n onlyBundle: false,\n };\n}\n","import { bundledEntryDepsConfig, libraryBuildDepsConfig, userAppBuildDepsConfig } from \"./deps.js\";\n\nexport {\n isNativeRuntimeDep,\n NATIVE_RUNTIME_DEPS,\n bundledEntryDepsConfig,\n cliBundledEntryDepsConfig,\n libraryBuildDepsConfig,\n userAppBuildDepsConfig,\n} from \"./deps.js\";\n\nexport const baseTsdownConfig = {\n format: [\"esm\", \"cjs\"],\n dts: true,\n clean: true,\n sourcemap: true,\n target: \"node20\",\n deps: libraryBuildDepsConfig(),\n};\n\n/** tsdown config for published bundles (cli, keystroke, platform). */\nexport const bundledEntryTsdownConfig = {\n format: [\"esm\", \"cjs\"],\n dts: true,\n clean: true,\n sourcemap: true,\n target: \"node20\",\n deps: bundledEntryDepsConfig(),\n};\n","import { n as keystrokeIgnoreGuardPlugin, t as walkProject } from \"./walk-project-eZ95LOUW.mjs\";\nimport { t as resolveModuleDirs } from \"./resolve-module-dirs-BPHQhRGy.mjs\";\nimport { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, relative } from \"node:path\";\nimport { packAssetDirs } from \"@keystrokehq/sandbox/files\";\nimport { baseTsdownConfig, userAppBuildDepsConfig } from \"@keystrokehq/tsdown-config\";\nimport { build, mergeConfig } from \"tsdown\";\nimport { buildStoredRouteManifestForProject } from \"@keystrokehq/manifest\";\n//#region src/resolve-runtime-artifact.ts\nfunction packageRoot(nodeModules, scope, name) {\n\tconst direct = scope ? join(nodeModules, scope, name) : join(nodeModules, name);\n\tif (existsSync(join(direct, \"package.json\"))) return direct;\n\tconst pnpmDir = join(nodeModules, \".pnpm\");\n\tif (!existsSync(pnpmDir)) return null;\n\tfor (const entry of readdirSync(pnpmDir)) {\n\t\tconst candidate = scope ? join(pnpmDir, entry, \"node_modules\", scope, name) : join(pnpmDir, entry, \"node_modules\", name);\n\t\tif (existsSync(join(candidate, \"package.json\"))) return candidate;\n\t}\n\treturn null;\n}\n/** Resolve a file shipped with `@keystrokehq/build` inside the CLI runtime. */\nfunction resolveRuntimeBuildArtifact(runtimeNodeModules, relativePath) {\n\tconst pkgRoot = packageRoot(runtimeNodeModules, \"@keystrokehq\", \"build\");\n\tif (!pkgRoot) throw new Error(\"Keystroke runtime is missing @keystrokehq/build\");\n\tconst artifact = join(pkgRoot, relativePath);\n\tif (!existsSync(artifact)) throw new Error(`Keystroke runtime artifact not found: ${relativePath}`);\n\treturn artifact;\n}\n//#endregion\n//#region src/vitest-plugin.ts\nconst ASSETS_MODULE$1 = \"@keystrokehq/assets\";\nconst virtualPrefix = `\\0${ASSETS_MODULE$1}:`;\n/** Vitest plugin resolving `@keystrokehq/assets` from disk. */\nfunction agentAssetsVitestPlugin(appRoot = process.cwd()) {\n\tlet manifest = null;\n\treturn {\n\t\tname: \"keystroke-assets\",\n\t\tresolveId(source) {\n\t\t\tif (source !== ASSETS_MODULE$1) return null;\n\t\t\treturn `${virtualPrefix}manifest`;\n\t\t},\n\t\tload(id) {\n\t\t\tif (id !== `${virtualPrefix}manifest`) return null;\n\t\t\tmanifest ??= packAssetDirs(appRoot);\n\t\t\treturn `export default ${JSON.stringify(manifest)};`;\n\t\t}\n\t};\n}\nfunction findAppRootFromConfig(configFile) {\n\tif (!configFile) return process.cwd();\n\treturn dirname(configFile);\n}\nfunction agentAssetsVitestPluginFromConfig(configFile) {\n\treturn agentAssetsVitestPlugin(findAppRootFromConfig(configFile));\n}\n//#endregion\n//#region src/resolve-build-filter.ts\n/** Resolve exact build-entry keys for a filtered deploy build. */\nfunction resolveBuildFilter(filter, buildEntries) {\n\tif (filter.length === 0) throw new Error(\"At least one --filter entry is required\");\n\tconst matched = {};\n\tfor (const key of [...new Set(filter)]) {\n\t\tconst entryPath = buildEntries[key];\n\t\tif (!entryPath) throw new Error(`Unknown build entry \"${key}\". Use keys like agents/foo or workflows/bar from walkProject.`);\n\t\tmatched[key] = entryPath;\n\t}\n\treturn matched;\n}\n//#endregion\n//#region src/build-filtered.ts\nfunction toPosix(path) {\n\treturn path.replace(/\\\\/g, \"/\");\n}\nfunction distRelativePath(entryKey) {\n\treturn `${entryKey}.mjs`;\n}\nasync function buildSingleEntry(root, entryKey, entryPath, ignoredFiles) {\n\tmkdirSync(join(root, \".keystroke\"), { recursive: true });\n\tconst scratchRoot = mkdtempSync(join(root, \".keystroke\", \"filter-build-\"));\n\tconst outDir = join(scratchRoot, \"dist\");\n\tconst relativePath = distRelativePath(entryKey);\n\tawait build(mergeConfig(baseTsdownConfig, {\n\t\tentry: { [entryKey]: entryPath },\n\t\tformat: [\"esm\"],\n\t\toutDir,\n\t\tclean: true,\n\t\tdts: false,\n\t\tloader: { \".md\": \"text\" },\n\t\tdeps: userAppBuildDepsConfig(),\n\t\tplugins: [keystrokeIgnoreGuardPlugin({\n\t\t\troot,\n\t\t\tignoredFiles\n\t\t})]\n\t}));\n\treturn {\n\t\tscratchRoot,\n\t\trelativePath\n\t};\n}\nasync function manifestEntriesForBuiltModule(root, entryPath, relativePath, contents, sourceMap) {\n\tconst moduleFile = toPosix(relative(root, entryPath));\n\tconst distPath = join(root, \"dist\", relativePath);\n\tconst distMapPath = `${distPath}.map`;\n\tconst previousDist = existsSync(distPath) ? readFileSync(distPath) : void 0;\n\tconst hadMap = existsSync(distMapPath);\n\tconst previousMap = hadMap ? readFileSync(distMapPath) : void 0;\n\tmkdirSync(dirname(distPath), { recursive: true });\n\twriteFileSync(distPath, contents);\n\tif (sourceMap) writeFileSync(distMapPath, sourceMap);\n\ttry {\n\t\treturn (await buildStoredRouteManifestForProject(root, { reloadModules: true })).entries.filter((entry) => \"moduleFile\" in entry && entry.moduleFile === moduleFile);\n\t} finally {\n\t\tif (previousDist) writeFileSync(distPath, previousDist);\n\t\telse rmSync(distPath, { force: true });\n\t\tif (previousMap) writeFileSync(distMapPath, previousMap);\n\t\telse if (sourceMap || hadMap) rmSync(distMapPath, { force: true });\n\t}\n}\n/** Build selected modules in isolation for a filtered deploy merge. */\nasync function buildFilteredApp(options) {\n\tconst root = options.root ?? process.cwd();\n\tconst srcDir = options.srcDir ?? \"src\";\n\tconst phase = options.phase ?? \"deploy\";\n\tconst collectSources = options.collectSources ?? false;\n\tconst previous = process.cwd();\n\tconst walked = walkProject(root, {\n\t\tsrcDir,\n\t\tcollectSources,\n\t\tphase\n\t});\n\tconst matched = resolveBuildFilter(options.filter, walked.buildEntries);\n\tconst files = [];\n\tconst manifestEntries = [];\n\ttry {\n\t\tprocess.chdir(root);\n\t\tfor (const [entryKey, entryPath] of Object.entries(matched)) {\n\t\t\tconst { scratchRoot, relativePath } = await buildSingleEntry(root, entryKey, entryPath, walked.ignoredFiles);\n\t\t\ttry {\n\t\t\t\tconst builtPath = join(scratchRoot, \"dist\", relativePath);\n\t\t\t\tconst mapPath = `${builtPath}.map`;\n\t\t\t\tconst contents = readFileSync(builtPath);\n\t\t\t\tconst sourceMap = existsSync(mapPath) ? readFileSync(mapPath) : void 0;\n\t\t\t\tfiles.push({\n\t\t\t\t\tentryKey,\n\t\t\t\t\trelativePath,\n\t\t\t\t\tcontents,\n\t\t\t\t\tsourceMap\n\t\t\t\t});\n\t\t\t\tmanifestEntries.push(...await manifestEntriesForBuiltModule(root, entryPath, relativePath, contents, sourceMap));\n\t\t\t} finally {\n\t\t\t\trmSync(scratchRoot, {\n\t\t\t\t\trecursive: true,\n\t\t\t\t\tforce: true\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tprocess.chdir(previous);\n\t}\n\treturn {\n\t\tfiles,\n\t\tmanifestEntries,\n\t\tsourceFiles: walked.sourceFiles\n\t};\n}\n//#endregion\n//#region src/index.ts\nconst ASSETS_MODULE = \"@keystrokehq/assets\";\nconst VIRTUAL_PREFIX = `\\0${ASSETS_MODULE}:`;\nfunction renderAssetModule(manifest) {\n\treturn `export default ${JSON.stringify(manifest)};\\n`;\n}\n/** Rolldown plugin: pack src/skills + src/files and expose `@keystrokehq/assets`. */\nfunction agentAssetsPlugin(options) {\n\tconst srcDir = options.srcDir ?? \"src\";\n\tlet manifest = null;\n\treturn {\n\t\tname: \"keystroke-assets\",\n\t\tbuildStart() {\n\t\t\tmanifest = packAssetDirs(options.root, srcDir);\n\t\t},\n\t\tresolveId(source) {\n\t\t\tif (source !== ASSETS_MODULE) return null;\n\t\t\treturn `${VIRTUAL_PREFIX}manifest`;\n\t\t},\n\t\tload(id) {\n\t\t\tif (id !== `${VIRTUAL_PREFIX}manifest` || !manifest) return null;\n\t\t\treturn renderAssetModule(manifest);\n\t\t},\n\t\tbuildEnd() {\n\t\t\tif (!manifest) return;\n\t\t\tconst outDir = join(options.root, options.outDir ?? \"dist\", \".keystroke\");\n\t\t\tmkdirSync(outDir, { recursive: true });\n\t\t\twriteFileSync(join(outDir, \"assets.mjs\"), renderAssetModule(manifest));\n\t\t}\n\t};\n}\n/** Full tsdown config for user keystroke apps (config + discovered modules only). */\nfunction createAppBuildConfig(options = {}, walked) {\n\tconst root = options.root ?? process.cwd();\n\tconst srcDir = options.srcDir ?? \"src\";\n\tconst outDir = options.outDir ?? \"dist\";\n\tconst configEntry = existsSync(join(root, \"keystroke.config.ts\")) ? join(root, \"keystroke.config.ts\") : void 0;\n\tconst walkedResult = walked ?? walkProject(root, {\n\t\tsrcDir,\n\t\tphase: options.phase\n\t});\n\tconst discovered = walkedResult.buildEntries;\n\tconst ignoredFiles = walkedResult.ignoredFiles;\n\tconst entries = {\n\t\t...configEntry ? { config: configEntry } : {},\n\t\t...discovered\n\t};\n\tif (Object.keys(entries).length === 0) throw new Error(\"Nothing to build — add keystroke.config.ts or modules under src/\");\n\treturn mergeConfig(baseTsdownConfig, {\n\t\tentry: entries,\n\t\tformat: [\"esm\"],\n\t\toutDir: join(root, outDir),\n\t\tclean: options.clean ?? true,\n\t\tdts: false,\n\t\tloader: { \".md\": \"text\" },\n\t\tdeps: userAppBuildDepsConfig(),\n\t\tplugins: [keystrokeIgnoreGuardPlugin({\n\t\t\troot,\n\t\t\tignoredFiles\n\t\t}), agentAssetsPlugin({\n\t\t\troot,\n\t\t\tsrcDir,\n\t\t\toutDir\n\t\t})]\n\t});\n}\n/** Build user agents, workflows, triggers, and config to `dist/`. */\nasync function buildApp(options = {}) {\n\tconst root = options.root ?? process.cwd();\n\tconst srcDir = options.srcDir ?? \"src\";\n\tconst emitManifest = options.emitManifest ?? true;\n\tconst collectSources = options.collectSources ?? false;\n\tconst phase = options.phase ?? \"build\";\n\tconst previous = process.cwd();\n\tconst walked = walkProject(root, {\n\t\tsrcDir,\n\t\tcollectSources,\n\t\tphase\n\t});\n\ttry {\n\t\tprocess.chdir(root);\n\t\tawait build(createAppBuildConfig({\n\t\t\t...options,\n\t\t\troot\n\t\t}, {\n\t\t\tbuildEntries: walked.buildEntries,\n\t\t\tignoredFiles: walked.ignoredFiles\n\t\t}));\n\t\tif (emitManifest) {\n\t\t\tconst { emitStoredRouteManifestForProject } = await import(\"@keystrokehq/manifest\");\n\t\t\tawait emitStoredRouteManifestForProject(root);\n\t\t}\n\t} finally {\n\t\tprocess.chdir(previous);\n\t}\n\treturn { sourceFiles: walked.sourceFiles };\n}\n/**\n* Watch `src/` and rebuild `dist/` on change.\n*\n* NOT true hot reload — each change runs a full tsdown rebuild. Callers should\n* restart the API server in `onRebuild` so discovery picks up new/changed modules.\n*/\nasync function watchApp(options = {}) {\n\tconst { runWatchApp } = await import(\"./watch-app-DTIeKrbl.mjs\");\n\tawait runWatchApp((watchOptions) => buildApp({\n\t\t...watchOptions,\n\t\temitManifest: false,\n\t\tcollectSources: false\n\t}), options);\n}\n//#endregion\nexport { agentAssetsVitestPlugin, agentAssetsVitestPluginFromConfig, buildApp, buildFilteredApp, createAppBuildConfig, resolveBuildFilter, resolveModuleDirs, resolveRuntimeBuildArtifact, watchApp };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;AAMA,SAAS,UAAU,MAAM;CACxB,OAAO,KAAK,MAAM,GAAG,EAAE,KAAK,GAAG;AAChC;AACA,SAAS,oBAAoB,MAAM,UAAU;CAC5C,OAAO,UAAU,SAAS,MAAM,uBAAuB,QAAQ,CAAC,CAAC;AAClE;;AAEA,SAAS,uBAAuB,UAAU;CACzC,MAAM,WAAW,QAAQ,QAAQ;CACjC,IAAI;EACH,OAAO,aAAa,OAAO,QAAQ;CACpC,QAAQ;EACP,OAAO;CACR;AACD;AACA,SAAS,kBAAkB,IAAI,MAAM;CACpC,IAAI,GAAG,WAAW,IAAI,GAAG,OAAO;CAChC,MAAM,aAAa,uBAAuB,GAAG,WAAW,SAAS,IAAI,cAAc,EAAE,IAAI,EAAE;CAC3F,IAAI,CAAC,WAAW,WAAW,uBAAuB,IAAI,CAAC,GAAG,OAAO;CACjE,OAAO;AACR;AACA,SAAS,uBAAuB,MAAM,aAAa,UAAU;CAC5D,MAAM,UAAU,oBAAoB,MAAM,WAAW;CACrD,IAAI,UAAU,OAAO,kBAAkB,QAAQ,8BAA8B,oBAAoB,MAAM,QAAQ,EAAE;CACjH,OAAO,kBAAkB,QAAQ;AAClC;;AAEA,SAAS,2BAA2B,SAAS;CAC5C,MAAM,OAAO,uBAAuB,QAAQ,IAAI;CAChD,MAAM,eAAe,IAAI,IAAI,QAAQ,aAAa,KAAK,aAAa,uBAAuB,QAAQ,CAAC,CAAC;CACrG,SAAS,iBAAiB,UAAU,UAAU;EAC7C,MAAM,aAAa,uBAAuB,QAAQ;EAClD,IAAI,CAAC,aAAa,IAAI,UAAU,GAAG;EACnC,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,MAAM,kCAAkC,IAAI;EAC7C;CACD,UAAU;EACT,QAAQ,MAAM,QAAQ;CACvB;CACA,OAAO,EAAE,aAAa,OAAO,YAAY;AAC1C;;;;;;;AAOA,eAAe,SAAS,UAAU,CAAC,GAAG;CACrC,MAAM,EAAE,gBAAgB,MAAM,OAAO;CACrC,MAAM,aAAa,iBAAiB,SAAS;EAC5C,GAAG;EACH,cAAc;EACd,gBAAgB;CACjB,CAAC,GAAG,OAAO;AACZ"}
|
|
1
|
+
{"version":3,"file":"dist-DdjMxlbo.mjs","names":["toPosix","z.object","z.string","z.array"],"sources":["../../../packages/build/dist/walk-project-eZ95LOUW.mjs","../../../packages/sandbox/dist/files-B0H9_dP4.mjs","../../../packages/tsdown-config/deps.js","../../../packages/tsdown-config/index.js","../../../packages/build/dist/index.mjs"],"sourcesContent":["import { readFileSync, readdirSync, realpathSync, statSync } from \"node:fs\";\nimport { join, relative, resolve, sep } from \"node:path\";\nimport { createHash } from \"node:crypto\";\nimport { entryIdFromFile, readKeystrokeIgnoreDirective, shouldSkipKeystrokeModuleFile } from \"@keystrokehq/manifest/discovery\";\nimport { fileURLToPath } from \"node:url\";\n//#region src/ignore-guard-plugin.ts\nfunction toPosix$1(path) {\n\treturn path.split(sep).join(\"/\");\n}\nfunction projectRelativePath(root, filePath) {\n\treturn toPosix$1(relative(root, normalizeBuildFilePath(filePath)));\n}\n/** Normalize paths so /var and /private/var compare equal on macOS. */\nfunction normalizeBuildFilePath(filePath) {\n\tconst absolute = resolve(filePath);\n\ttry {\n\t\treturn realpathSync.native(absolute);\n\t} catch {\n\t\treturn absolute;\n\t}\n}\nfunction normalizeModuleId(id, root) {\n\tif (id.startsWith(\"\\0\")) return null;\n\tconst normalized = normalizeBuildFilePath(id.startsWith(\"file://\") ? fileURLToPath(id) : id);\n\tif (!normalized.startsWith(normalizeBuildFilePath(root))) return null;\n\treturn normalized;\n}\nfunction formatImportGuardError(root, ignoredPath, importer) {\n\tconst ignored = projectRelativePath(root, ignoredPath);\n\tif (importer) return `Cannot import \"${ignored}\" (@keystroke ignore) from \"${projectRelativePath(root, importer)}\". Remove the directive or stop importing it from a shipped module.`;\n\treturn `Cannot import \"${ignored}\" (@keystroke ignore). Remove the directive or stop importing it from a shipped module.`;\n}\n/** Throw when a built module imports a `@keystroke ignore` source file. */\nfunction keystrokeIgnoreGuardPlugin(options) {\n\tconst root = normalizeBuildFilePath(options.root);\n\tconst ignoredFiles = new Set(options.ignoredFiles.map((filePath) => normalizeBuildFilePath(filePath)));\n\tfunction assertNotIgnored(filePath, importer) {\n\t\tconst normalized = normalizeBuildFilePath(filePath);\n\t\tif (!ignoredFiles.has(normalized)) return;\n\t\tthrow new Error(formatImportGuardError(root, normalized, importer));\n\t}\n\treturn {\n\t\tname: \"keystroke-ignore-guard\",\n\t\tasync resolveId(source, importer, resolveOptions) {\n\t\t\tif (resolveOptions?.isEntry || !importer) return null;\n\t\t\tconst resolved = await this.resolve(source, importer, {\n\t\t\t\t...resolveOptions,\n\t\t\t\tskipSelf: true\n\t\t\t});\n\t\t\tif (!resolved) return null;\n\t\t\tassertNotIgnored(typeof resolved === \"string\" ? resolved : resolved.id, importer);\n\t\t\treturn null;\n\t\t},\n\t\tload(id) {\n\t\t\tconst normalized = normalizeModuleId(id, root);\n\t\t\tif (!normalized) return null;\n\t\t\tassertNotIgnored(normalized);\n\t\t\treturn null;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/walk-project.ts\nconst IGNORED_DIRS = new Set([\n\t\"node_modules\",\n\t\"dist\",\n\t\".git\",\n\t\".turbo\",\n\t\"build\",\n\t\"coverage\",\n\t\".keystroke\",\n\t\".cache\",\n\t\"tmp\"\n]);\nconst IGNORED_ENV_FILE = /\\.env/;\nconst IGNORED_LOG_FILE = /\\.log$/;\nfunction isIgnoredFile(name) {\n\treturn IGNORED_ENV_FILE.test(name) || IGNORED_LOG_FILE.test(name);\n}\nfunction toPosix(path) {\n\treturn path.split(sep).join(\"/\");\n}\nfunction isProbablyBinary(buffer) {\n\tconst sampleLength = Math.min(buffer.length, 8e3);\n\tfor (let index = 0; index < sampleLength; index += 1) if (buffer[index] === 0) return true;\n\treturn false;\n}\nfunction classifyBuildEntry(root, srcRoot, filePath) {\n\tconst relativePath = toPosix(relative(root, filePath));\n\tconst agentsPrefix = `${toPosix(relative(root, join(srcRoot, \"agents\")))}/`;\n\tconst workflowsPrefix = `${toPosix(relative(root, join(srcRoot, \"workflows\")))}/`;\n\tconst triggersPrefix = `${toPosix(relative(root, join(srcRoot, \"triggers\")))}/`;\n\tif (relativePath.startsWith(agentsPrefix) && /\\.(ts|mts)$/.test(relativePath) && !/\\.(int\\.)?test\\.(ts|mts)$/.test(relativePath)) {\n\t\tconst id = entryIdFromFile(join(srcRoot, \"agents\"), filePath, { nestedEntry: \"agent\" });\n\t\treturn id ? {\n\t\t\tentryKey: `agents/${id}`,\n\t\t\tentryPath: filePath\n\t\t} : null;\n\t}\n\tif (relativePath.startsWith(workflowsPrefix) && /\\.(ts|mts)$/.test(relativePath) && !/\\.(int\\.)?test\\.(ts|mts)$/.test(relativePath)) {\n\t\tconst id = entryIdFromFile(join(srcRoot, \"workflows\"), filePath, { nestedEntry: \"workflow\" });\n\t\treturn id ? {\n\t\t\tentryKey: `workflows/${id}`,\n\t\t\tentryPath: filePath\n\t\t} : null;\n\t}\n\tif (relativePath.startsWith(triggersPrefix) && /\\.(ts|mts)$/.test(relativePath) && !/\\.(int\\.)?test\\.(ts|mts)$/.test(relativePath)) {\n\t\tconst id = entryIdFromFile(join(srcRoot, \"triggers\"), filePath, { nestedEntry: \"trigger\" });\n\t\treturn id ? {\n\t\t\tentryKey: `triggers/${id}`,\n\t\t\tentryPath: filePath\n\t\t} : null;\n\t}\n\treturn null;\n}\nfunction shouldSkipIgnoredModule(filePath, phase) {\n\treturn shouldSkipKeystrokeModuleFile(readKeystrokeIgnoreDirective(filePath), phase);\n}\nfunction isSrcTypeScriptFile(srcRoot, filePath) {\n\tconst relativePath = toPosix(relative(srcRoot, filePath));\n\tif (relativePath.startsWith(\"..\")) return false;\n\treturn /\\.(ts|mts)$/.test(relativePath);\n}\nfunction walkTree(root, dir, srcRoot, phase, collectSources, sourceFiles, buildEntries, ignoredFiles, totals) {\n\tfor (const name of readdirSync(dir).sort()) {\n\t\tif (collectSources && (sourceFiles.length >= 2e3 || totals.bytes >= 8388608)) return;\n\t\tconst absolute = join(dir, name);\n\t\tconst stats = statSync(absolute);\n\t\tif (stats.isDirectory()) {\n\t\t\tif (IGNORED_DIRS.has(name)) continue;\n\t\t\twalkTree(root, absolute, srcRoot, phase, collectSources, sourceFiles, buildEntries, ignoredFiles, totals);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!stats.isFile()) continue;\n\t\tconst isUnderSrc = isSrcTypeScriptFile(srcRoot, absolute);\n\t\tconst skipIgnored = isUnderSrc ? shouldSkipIgnoredModule(absolute, phase) : false;\n\t\tif (isUnderSrc && skipIgnored) ignoredFiles.push(normalizeBuildFilePath(absolute));\n\t\tconst buildEntry = classifyBuildEntry(root, srcRoot, absolute);\n\t\tif (buildEntry && !skipIgnored) buildEntries[buildEntry.entryKey] = buildEntry.entryPath;\n\t\tif (!collectSources) continue;\n\t\tif (stats.size > 262144 || isIgnoredFile(name)) continue;\n\t\tconst buffer = readFileSync(absolute);\n\t\tif (isProbablyBinary(buffer)) continue;\n\t\ttotals.bytes += buffer.byteLength;\n\t\tsourceFiles.push({\n\t\t\tpath: toPosix(relative(root, absolute)),\n\t\t\tcontents: buffer.toString(\"utf8\"),\n\t\t\thash: createHash(\"sha256\").update(buffer).digest(\"hex\")\n\t\t});\n\t}\n}\n/**\n* One full-tree walk of the project: classifies tsdown entries and optionally\n* collects deploy source files (path + contents + hash) under snapshot limits.\n*/\nfunction walkProject(root, srcDirOrOptions = \"src\", maybeOptions) {\n\tconst srcDir = typeof srcDirOrOptions === \"string\" ? srcDirOrOptions : srcDirOrOptions.srcDir ?? \"src\";\n\tconst options = typeof srcDirOrOptions === \"string\" ? maybeOptions ?? {} : srcDirOrOptions;\n\tconst collectSources = options.collectSources ?? false;\n\tconst phase = options.phase ?? \"build\";\n\tconst sourceFiles = [];\n\tconst buildEntries = {};\n\tconst ignoredFiles = [];\n\twalkTree(root, root, join(root, srcDir), phase, collectSources, sourceFiles, buildEntries, ignoredFiles, { bytes: 0 });\n\treturn {\n\t\tsourceFiles,\n\t\tbuildEntries,\n\t\tignoredFiles\n\t};\n}\n//#endregion\nexport { keystrokeIgnoreGuardPlugin as n, walkProject as t };\n\n//# sourceMappingURL=walk-project-eZ95LOUW.mjs.map","import { basename, dirname, join, relative, resolve } from \"node:path\";\nimport { access, mkdir, writeFile } from \"node:fs/promises\";\nimport { z } from \"zod\";\nimport { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { fileURLToPath } from \"node:url\";\n//#region src/sandbox-dirs.ts\nfunction resolveSandboxRoot(workspacesRoot, scope) {\n\tif (scope.type === \"agent\") return join(workspacesRoot, scope.agentId);\n\treturn join(workspacesRoot, \"runs\", scope.runId);\n}\nasync function ensureWorkspaceDir(workspaceRoot) {\n\tawait mkdir(workspaceRoot, { recursive: true });\n}\n//#endregion\n//#region src/files/schemas.ts\nconst SandboxFileContentSchema = z.object({\n\tpath: z.string(),\n\tfile: z.string()\n});\n/** Destination path under `/workspace`. For `dir`, used as a prefix. */\nconst SandboxFileSchema = z.object({\n\tpath: z.string(),\n\t/** Single file body — typically from a build-time import (`import doc from \"./doc.md\"`). */\n\tfile: z.string().optional(),\n\t/** Directory contents — each path is relative to `path`. */\n\tdir: z.array(SandboxFileContentSchema).optional()\n});\nconst SandboxDefinitionSchema = z.object({\n\tkey: z.string().optional(),\n\tfiles: z.array(SandboxFileSchema).optional()\n});\n//#endregion\n//#region src/files/define-sandbox.ts\n/** Define a reusable sandbox file layout. */\nfunction defineSandbox(def) {\n\treturn def;\n}\n//#endregion\n//#region src/files/flatten-sandbox-files.ts\n/** Expand directory entries into flat `{ path, file }` records under `/workspace`. */\nfunction flattenSandboxFiles(files) {\n\tif (!files?.length) return [];\n\tconst flattened = [];\n\tfor (const entry of files) {\n\t\tif (entry.dir !== void 0) {\n\t\t\tconst prefix = entry.path.replace(/\\/+$/, \"\");\n\t\t\tfor (const child of entry.dir) flattened.push({\n\t\t\t\tpath: prefix ? `${prefix}/${child.path}` : child.path,\n\t\t\t\tfile: child.file\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tif (entry.file === void 0) continue;\n\t\tflattened.push({\n\t\t\tpath: entry.path,\n\t\t\tfile: entry.file\n\t\t});\n\t}\n\treturn flattened;\n}\n//#endregion\n//#region src/files/materialize-sandbox.ts\nasync function materializeSandbox(options) {\n\tconst root = resolveSandboxRoot(options.workspacesRoot, options.scope);\n\tawait ensureWorkspaceDir(root);\n\tconst files = flattenSandboxFiles(options.definition?.files);\n\tif (files.length) await applySandboxFiles(root, files, options.scope);\n\treturn {\n\t\troot,\n\t\tscope: options.scope,\n\t\t...options.definition !== void 0 ? { definition: options.definition } : {}\n\t};\n}\nasync function applySandboxFiles(root, files, scope) {\n\tfor (const entry of files) {\n\t\tconst hostPath = resolve(root, entry.path);\n\t\tif (scope.type === \"agent\") try {\n\t\t\tawait access(hostPath);\n\t\t\tcontinue;\n\t\t} catch {}\n\t\tawait mkdir(dirname(hostPath), { recursive: true });\n\t\tawait writeFile(hostPath, entry.file);\n\t}\n}\n//#endregion\n//#region src/files/pack-dir.ts\nconst SKIP_DIRS$1 = new Set([\".git\", \"node_modules\"]);\n/** Recursively read a host file or directory into sandbox-relative `{ path, file }` entries. */\nfunction packDirFromDisk(rootPath) {\n\tconst stat = statSync(rootPath);\n\tif (stat.isFile()) return [{\n\t\tpath: basename(rootPath),\n\t\tfile: readFileSync(rootPath, \"utf8\")\n\t}];\n\tif (!stat.isDirectory()) throw new Error(`Expected a file or directory at ${rootPath}`);\n\tconst files = [];\n\twalkDir(rootPath, rootPath, files);\n\treturn files;\n}\nfunction walkDir(rootPath, currentPath, files) {\n\tfor (const name of readdirSync(currentPath)) {\n\t\tif (SKIP_DIRS$1.has(name)) continue;\n\t\tconst entryPath = join(currentPath, name);\n\t\tconst stat = statSync(entryPath);\n\t\tif (stat.isDirectory()) {\n\t\t\twalkDir(rootPath, entryPath, files);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!stat.isFile()) continue;\n\t\tfiles.push({\n\t\t\tpath: relative(rootPath, entryPath),\n\t\t\tfile: readFileSync(entryPath, \"utf8\")\n\t\t});\n\t}\n}\n//#endregion\n//#region src/files/pack-asset-dirs.ts\nconst SKIP_DIRS = new Set([\".git\", \"node_modules\"]);\n/** Pack every subdir under `src/skills/` and `src/files/` into an asset manifest. */\nfunction packAssetDirs(appRoot, srcDir = \"src\") {\n\treturn {\n\t\tskills: packAssetRoot(join(appRoot, srcDir, \"skills\")),\n\t\tfiles: packAssetRoot(join(appRoot, srcDir, \"files\"))\n\t};\n}\nfunction packAssetRoot(rootPath) {\n\tif (!statSync(rootPath, { throwIfNoEntry: false })?.isDirectory()) return {};\n\tconst manifest = {};\n\tfor (const name of readdirSync(rootPath)) {\n\t\tif (SKIP_DIRS.has(name)) continue;\n\t\tconst entryPath = join(rootPath, name);\n\t\tif (!statSync(entryPath).isDirectory()) continue;\n\t\tmanifest[name] = packDirFromDisk(entryPath);\n\t}\n\treturn manifest;\n}\n//#endregion\n//#region src/files/resolve-app-root.ts\n/** Walk upward from a module file to find the user app root (`src/agents`, `src/skills`, etc.). */\nfunction resolveAppRoot(fromPath) {\n\tlet dir = statSync(fromPath).isDirectory() ? fromPath : dirname(fromPath);\n\twhile (dir !== dirname(dir)) {\n\t\tif (hasAppLayout(dir)) return dir;\n\t\tdir = dirname(dir);\n\t}\n\treturn process.env.KEYSTROKE_ROOT ?? process.cwd();\n}\n/** Resolve app root from an agent (or other) module URL. */\nfunction resolveAppRootFromModule(moduleUrl) {\n\treturn resolveAppRoot(fileURLToPath(moduleUrl));\n}\nfunction hasAppLayout(dir) {\n\tconst src = join(dir, \"src\");\n\tconst dist = join(dir, \"dist\");\n\treturn existsSync(join(src, \"agents\")) || existsSync(join(src, \"skills\")) || existsSync(join(src, \"files\")) || existsSync(join(dist, \"agents\")) || existsSync(join(dist, \".keystroke\", \"assets.mjs\"));\n}\n//#endregion\nexport { materializeSandbox as a, SandboxDefinitionSchema as c, ensureWorkspaceDir as d, resolveSandboxRoot as f, packDirFromDisk as i, SandboxFileContentSchema as l, resolveAppRootFromModule as n, flattenSandboxFiles as o, packAssetDirs as r, defineSandbox as s, resolveAppRoot as t, SandboxFileSchema as u };\n\n//# sourceMappingURL=files-B0H9_dP4.mjs.map","import { isBuiltin } from \"node:module\";\n\n/** Native addons kept external — resolved from the CLI runtime at app start. */\nexport const NATIVE_RUNTIME_DEPS = [\"pg\", \"better-sqlite3\", \"@parcel/watcher\"];\n\n/** Kept external so .d.ts emission does not inline internal/inferred types. */\nexport const LIBRARY_EXTERNAL_DEPS = [\"better-auth\", /^@better-auth\\//, /^better-auth\\//];\n\n/** Non-auth runtime deps kept external for published entry bundles (platform, etc.). */\nexport const BUNDLED_ENTRY_RUNTIME_EXTERNAL_DEPS = [\n ...NATIVE_RUNTIME_DEPS,\n \"dockerode\",\n \"ssh2\",\n \"cpu-features\",\n \"microsandbox\",\n /^@aws-sdk\\//,\n /^@napi-rs\\//,\n \"hono\",\n /^@hono\\//,\n \"undici\",\n];\n\n/** Kept external when bundling published entry points (cli, keystroke, platform). */\nexport const BUNDLED_ENTRY_EXTERNAL_DEPS = [\n ...BUNDLED_ENTRY_RUNTIME_EXTERNAL_DEPS,\n ...LIBRARY_EXTERNAL_DEPS,\n];\n\n/** Bundle into CLI — device login uses Better Auth client only. */\nexport const BETTER_AUTH_CLIENT_BUNDLE_PATTERNS = [\n /^better-auth\\/client$/,\n /^better-auth\\/client\\//,\n];\n\n/** Server adapters and root entry — must not ship in the CLI bundle. */\nexport const BETTER_AUTH_SERVER_EXTERNAL_PATTERNS = [\n /^better-auth$/,\n /^@better-auth\\//,\n /^better-auth\\/(?!client(\\/|$)).+/,\n];\n\nexport function isNativeRuntimeDep(id) {\n return NATIVE_RUNTIME_DEPS.some((dep) => id === dep || id.startsWith(`${dep}/`));\n}\n\nfunction packageName(id) {\n if (id.startsWith(\"@\")) {\n const [scope, name] = id.split(\"/\");\n return name ? `${scope}/${name}` : id;\n }\n\n return id.split(\"/\")[0] ?? id;\n}\n\nfunction isRuntimeExternal(id) {\n const name = packageName(id);\n if (isNativeRuntimeDep(name)) {\n return true;\n }\n\n if (name.startsWith(\"@keystrokehq/\")) {\n return true;\n }\n\n if (name === \"better-auth\" || name.startsWith(\"@better-auth/\")) {\n return true;\n }\n\n return false;\n}\n\n/** Library packages resolve npm deps from node_modules at runtime. */\nexport function libraryBuildDepsConfig() {\n return {\n alwaysBundle: (_id) => null,\n neverBundle: [...NATIVE_RUNTIME_DEPS, /^@keystrokehq\\//, ...LIBRARY_EXTERNAL_DEPS],\n onlyBundle: false,\n };\n}\n\n/** Bundle npm deps into dist; resolve @keystrokehq/* and natives from the runtime. */\nexport function userAppBuildDepsConfig() {\n return {\n alwaysBundle: (id, _importer) => {\n if (id.startsWith(\".\") || id.startsWith(\"/\") || isBuiltin(id)) {\n return null;\n }\n\n return isRuntimeExternal(id) ? null : true;\n },\n neverBundle: [...NATIVE_RUNTIME_DEPS, /^@keystrokehq\\//, ...LIBRARY_EXTERNAL_DEPS],\n onlyBundle: false,\n };\n}\n\n/**\n * Published entry packages (cli, keystroke, platform): declare bundled @keystrokehq/*\n * in dependencies (changesets release graph ignores devDependencies). Inlining is\n * driven by alwaysBundle below, not by dep kind. Runtime npm deps stay external.\n */\nexport function bundledEntryDepsConfig() {\n return {\n alwaysBundle: [/^@keystrokehq\\//],\n neverBundle: [...BUNDLED_ENTRY_EXTERNAL_DEPS],\n onlyBundle: false,\n };\n}\n\n/** Published CLI: inline better-auth client + @better-auth/*; keep server adapters external. */\nexport const BETTER_AUTH_CLI_BUNDLE_PATTERNS = [\n ...BETTER_AUTH_CLIENT_BUNDLE_PATTERNS,\n /^@better-auth\\//,\n];\n\nexport const BETTER_AUTH_CLI_EXTERNAL_PATTERNS = [\n /^better-auth$/,\n /^better-auth\\/(?!client(\\/|$)).+/,\n /^@better-auth\\/drizzle-adapter/,\n \"drizzle-orm\",\n];\n\n/** Rolldown/tsdown — native bindings; stay in CLI node_modules at runtime. */\nexport const CLI_BUILD_TOOL_EXTERNAL_PATTERNS = [\"tsdown\", \"rolldown\", /^@rolldown\\//, \"tsx\"];\n\n/** CLI: inline better-auth/client; keep server + drizzle adapters external. */\nexport function cliBundledEntryDepsConfig() {\n return {\n alwaysBundle: [/^@keystrokehq\\//, ...BETTER_AUTH_CLI_BUNDLE_PATTERNS],\n neverBundle: [\n ...BUNDLED_ENTRY_RUNTIME_EXTERNAL_DEPS,\n ...BETTER_AUTH_CLI_EXTERNAL_PATTERNS,\n ...CLI_BUILD_TOOL_EXTERNAL_PATTERNS,\n ],\n onlyBundle: false,\n };\n}\n","import { bundledEntryDepsConfig, libraryBuildDepsConfig, userAppBuildDepsConfig } from \"./deps.js\";\n\nexport {\n isNativeRuntimeDep,\n NATIVE_RUNTIME_DEPS,\n bundledEntryDepsConfig,\n cliBundledEntryDepsConfig,\n libraryBuildDepsConfig,\n userAppBuildDepsConfig,\n} from \"./deps.js\";\n\nexport const baseTsdownConfig = {\n format: [\"esm\", \"cjs\"],\n dts: true,\n clean: true,\n sourcemap: true,\n target: \"node20\",\n deps: libraryBuildDepsConfig(),\n};\n\n/** tsdown config for published bundles (cli, keystroke, platform). */\nexport const bundledEntryTsdownConfig = {\n format: [\"esm\", \"cjs\"],\n dts: true,\n clean: true,\n sourcemap: true,\n target: \"node20\",\n deps: bundledEntryDepsConfig(),\n};\n","import { n as keystrokeIgnoreGuardPlugin, t as walkProject } from \"./walk-project-eZ95LOUW.mjs\";\nimport { t as resolveModuleDirs } from \"./resolve-module-dirs-BPHQhRGy.mjs\";\nimport { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, relative } from \"node:path\";\nimport { packAssetDirs } from \"@keystrokehq/sandbox/files\";\nimport { baseTsdownConfig, userAppBuildDepsConfig } from \"@keystrokehq/tsdown-config\";\nimport { build, mergeConfig } from \"tsdown\";\nimport { buildStoredRouteManifestForProject } from \"@keystrokehq/manifest\";\n//#region src/resolve-runtime-artifact.ts\nfunction packageRoot(nodeModules, scope, name) {\n\tconst direct = scope ? join(nodeModules, scope, name) : join(nodeModules, name);\n\tif (existsSync(join(direct, \"package.json\"))) return direct;\n\tconst pnpmDir = join(nodeModules, \".pnpm\");\n\tif (!existsSync(pnpmDir)) return null;\n\tfor (const entry of readdirSync(pnpmDir)) {\n\t\tconst candidate = scope ? join(pnpmDir, entry, \"node_modules\", scope, name) : join(pnpmDir, entry, \"node_modules\", name);\n\t\tif (existsSync(join(candidate, \"package.json\"))) return candidate;\n\t}\n\treturn null;\n}\n/** Resolve a file shipped with `@keystrokehq/build` inside the CLI runtime. */\nfunction resolveRuntimeBuildArtifact(runtimeNodeModules, relativePath) {\n\tconst pkgRoot = packageRoot(runtimeNodeModules, \"@keystrokehq\", \"build\");\n\tif (!pkgRoot) throw new Error(\"Keystroke runtime is missing @keystrokehq/build\");\n\tconst artifact = join(pkgRoot, relativePath);\n\tif (!existsSync(artifact)) throw new Error(`Keystroke runtime artifact not found: ${relativePath}`);\n\treturn artifact;\n}\n//#endregion\n//#region src/vitest-plugin.ts\nconst ASSETS_MODULE$1 = \"@keystrokehq/assets\";\nconst virtualPrefix = `\\0${ASSETS_MODULE$1}:`;\n/** Vitest plugin resolving `@keystrokehq/assets` from disk. */\nfunction agentAssetsVitestPlugin(appRoot = process.cwd()) {\n\tlet manifest = null;\n\treturn {\n\t\tname: \"keystroke-assets\",\n\t\tresolveId(source) {\n\t\t\tif (source !== ASSETS_MODULE$1) return null;\n\t\t\treturn `${virtualPrefix}manifest`;\n\t\t},\n\t\tload(id) {\n\t\t\tif (id !== `${virtualPrefix}manifest`) return null;\n\t\t\tmanifest ??= packAssetDirs(appRoot);\n\t\t\treturn `export default ${JSON.stringify(manifest)};`;\n\t\t}\n\t};\n}\nfunction findAppRootFromConfig(configFile) {\n\tif (!configFile) return process.cwd();\n\treturn dirname(configFile);\n}\nfunction agentAssetsVitestPluginFromConfig(configFile) {\n\treturn agentAssetsVitestPlugin(findAppRootFromConfig(configFile));\n}\n//#endregion\n//#region src/resolve-build-filter.ts\n/** Resolve exact build-entry keys for a filtered deploy build. */\nfunction resolveBuildFilter(filter, buildEntries) {\n\tif (filter.length === 0) throw new Error(\"At least one --filter entry is required\");\n\tconst matched = {};\n\tfor (const key of [...new Set(filter)]) {\n\t\tconst entryPath = buildEntries[key];\n\t\tif (!entryPath) throw new Error(`Unknown build entry \"${key}\". Use keys like agents/foo or workflows/bar from walkProject.`);\n\t\tmatched[key] = entryPath;\n\t}\n\treturn matched;\n}\n//#endregion\n//#region src/build-filtered.ts\nfunction toPosix(path) {\n\treturn path.replace(/\\\\/g, \"/\");\n}\nfunction distRelativePath(entryKey) {\n\treturn `${entryKey}.mjs`;\n}\nasync function buildSingleEntry(root, entryKey, entryPath, ignoredFiles) {\n\tmkdirSync(join(root, \".keystroke\"), { recursive: true });\n\tconst scratchRoot = mkdtempSync(join(root, \".keystroke\", \"filter-build-\"));\n\tconst outDir = join(scratchRoot, \"dist\");\n\tconst relativePath = distRelativePath(entryKey);\n\tawait build(mergeConfig(baseTsdownConfig, {\n\t\tentry: { [entryKey]: entryPath },\n\t\tformat: [\"esm\"],\n\t\toutDir,\n\t\tclean: true,\n\t\tdts: false,\n\t\tloader: { \".md\": \"text\" },\n\t\tdeps: userAppBuildDepsConfig(),\n\t\tplugins: [keystrokeIgnoreGuardPlugin({\n\t\t\troot,\n\t\t\tignoredFiles\n\t\t})]\n\t}));\n\treturn {\n\t\tscratchRoot,\n\t\trelativePath\n\t};\n}\nasync function manifestEntriesForBuiltModule(root, entryPath, relativePath, contents, sourceMap) {\n\tconst moduleFile = toPosix(relative(root, entryPath));\n\tconst distPath = join(root, \"dist\", relativePath);\n\tconst distMapPath = `${distPath}.map`;\n\tconst previousDist = existsSync(distPath) ? readFileSync(distPath) : void 0;\n\tconst hadMap = existsSync(distMapPath);\n\tconst previousMap = hadMap ? readFileSync(distMapPath) : void 0;\n\tmkdirSync(dirname(distPath), { recursive: true });\n\twriteFileSync(distPath, contents);\n\tif (sourceMap) writeFileSync(distMapPath, sourceMap);\n\ttry {\n\t\treturn (await buildStoredRouteManifestForProject(root, { reloadModules: true })).entries.filter((entry) => \"moduleFile\" in entry && entry.moduleFile === moduleFile);\n\t} finally {\n\t\tif (previousDist) writeFileSync(distPath, previousDist);\n\t\telse rmSync(distPath, { force: true });\n\t\tif (previousMap) writeFileSync(distMapPath, previousMap);\n\t\telse if (sourceMap || hadMap) rmSync(distMapPath, { force: true });\n\t}\n}\n/** Build selected modules in isolation for a filtered deploy merge. */\nasync function buildFilteredApp(options) {\n\tconst root = options.root ?? process.cwd();\n\tconst srcDir = options.srcDir ?? \"src\";\n\tconst phase = options.phase ?? \"deploy\";\n\tconst collectSources = options.collectSources ?? false;\n\tconst previous = process.cwd();\n\tconst walked = walkProject(root, {\n\t\tsrcDir,\n\t\tcollectSources,\n\t\tphase\n\t});\n\tconst matched = resolveBuildFilter(options.filter, walked.buildEntries);\n\tconst files = [];\n\tconst manifestEntries = [];\n\ttry {\n\t\tprocess.chdir(root);\n\t\tfor (const [entryKey, entryPath] of Object.entries(matched)) {\n\t\t\tconst { scratchRoot, relativePath } = await buildSingleEntry(root, entryKey, entryPath, walked.ignoredFiles);\n\t\t\ttry {\n\t\t\t\tconst builtPath = join(scratchRoot, \"dist\", relativePath);\n\t\t\t\tconst mapPath = `${builtPath}.map`;\n\t\t\t\tconst contents = readFileSync(builtPath);\n\t\t\t\tconst sourceMap = existsSync(mapPath) ? readFileSync(mapPath) : void 0;\n\t\t\t\tfiles.push({\n\t\t\t\t\tentryKey,\n\t\t\t\t\trelativePath,\n\t\t\t\t\tcontents,\n\t\t\t\t\tsourceMap\n\t\t\t\t});\n\t\t\t\tmanifestEntries.push(...await manifestEntriesForBuiltModule(root, entryPath, relativePath, contents, sourceMap));\n\t\t\t} finally {\n\t\t\t\trmSync(scratchRoot, {\n\t\t\t\t\trecursive: true,\n\t\t\t\t\tforce: true\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t} finally {\n\t\tprocess.chdir(previous);\n\t}\n\treturn {\n\t\tfiles,\n\t\tmanifestEntries,\n\t\tsourceFiles: walked.sourceFiles\n\t};\n}\n//#endregion\n//#region src/index.ts\nconst ASSETS_MODULE = \"@keystrokehq/assets\";\nconst VIRTUAL_PREFIX = `\\0${ASSETS_MODULE}:`;\nfunction renderAssetModule(manifest) {\n\treturn `export default ${JSON.stringify(manifest)};\\n`;\n}\n/** Rolldown plugin: pack src/skills + src/files and expose `@keystrokehq/assets`. */\nfunction agentAssetsPlugin(options) {\n\tconst srcDir = options.srcDir ?? \"src\";\n\tlet manifest = null;\n\treturn {\n\t\tname: \"keystroke-assets\",\n\t\tbuildStart() {\n\t\t\tmanifest = packAssetDirs(options.root, srcDir);\n\t\t},\n\t\tresolveId(source) {\n\t\t\tif (source !== ASSETS_MODULE) return null;\n\t\t\treturn `${VIRTUAL_PREFIX}manifest`;\n\t\t},\n\t\tload(id) {\n\t\t\tif (id !== `${VIRTUAL_PREFIX}manifest` || !manifest) return null;\n\t\t\treturn renderAssetModule(manifest);\n\t\t},\n\t\tbuildEnd() {\n\t\t\tif (!manifest) return;\n\t\t\tconst outDir = join(options.root, options.outDir ?? \"dist\", \".keystroke\");\n\t\t\tmkdirSync(outDir, { recursive: true });\n\t\t\twriteFileSync(join(outDir, \"assets.mjs\"), renderAssetModule(manifest));\n\t\t}\n\t};\n}\n/** Full tsdown config for user keystroke apps (config + discovered modules only). */\nfunction createAppBuildConfig(options = {}, walked) {\n\tconst root = options.root ?? process.cwd();\n\tconst srcDir = options.srcDir ?? \"src\";\n\tconst outDir = options.outDir ?? \"dist\";\n\tconst configEntry = existsSync(join(root, \"keystroke.config.ts\")) ? join(root, \"keystroke.config.ts\") : void 0;\n\tconst walkedResult = walked ?? walkProject(root, {\n\t\tsrcDir,\n\t\tphase: options.phase\n\t});\n\tconst discovered = walkedResult.buildEntries;\n\tconst ignoredFiles = walkedResult.ignoredFiles;\n\tconst entries = {\n\t\t...configEntry ? { config: configEntry } : {},\n\t\t...discovered\n\t};\n\tif (Object.keys(entries).length === 0) throw new Error(\"Nothing to build — add keystroke.config.ts or modules under src/\");\n\treturn mergeConfig(baseTsdownConfig, {\n\t\tentry: entries,\n\t\tformat: [\"esm\"],\n\t\toutDir: join(root, outDir),\n\t\tclean: options.clean ?? true,\n\t\tdts: false,\n\t\tloader: { \".md\": \"text\" },\n\t\tdeps: userAppBuildDepsConfig(),\n\t\tplugins: [keystrokeIgnoreGuardPlugin({\n\t\t\troot,\n\t\t\tignoredFiles\n\t\t}), agentAssetsPlugin({\n\t\t\troot,\n\t\t\tsrcDir,\n\t\t\toutDir\n\t\t})]\n\t});\n}\n/** Build user agents, workflows, triggers, and config to `dist/`. */\nasync function buildApp(options = {}) {\n\tconst root = options.root ?? process.cwd();\n\tconst srcDir = options.srcDir ?? \"src\";\n\tconst emitManifest = options.emitManifest ?? true;\n\tconst collectSources = options.collectSources ?? false;\n\tconst phase = options.phase ?? \"build\";\n\tconst previous = process.cwd();\n\tconst walked = walkProject(root, {\n\t\tsrcDir,\n\t\tcollectSources,\n\t\tphase\n\t});\n\ttry {\n\t\tprocess.chdir(root);\n\t\tawait build(createAppBuildConfig({\n\t\t\t...options,\n\t\t\troot\n\t\t}, {\n\t\t\tbuildEntries: walked.buildEntries,\n\t\t\tignoredFiles: walked.ignoredFiles\n\t\t}));\n\t\tif (emitManifest) {\n\t\t\tconst { emitStoredRouteManifestForProject } = await import(\"@keystrokehq/manifest\");\n\t\t\tawait emitStoredRouteManifestForProject(root);\n\t\t}\n\t} finally {\n\t\tprocess.chdir(previous);\n\t}\n\treturn { sourceFiles: walked.sourceFiles };\n}\n/**\n* Watch `src/` and rebuild `dist/` on change.\n*\n* NOT true hot reload — each change runs a full tsdown rebuild. Callers should\n* restart the API server in `onRebuild` so discovery picks up new/changed modules.\n*/\nasync function watchApp(options = {}) {\n\tconst { runWatchApp } = await import(\"./watch-app-DTIeKrbl.mjs\");\n\tawait runWatchApp((watchOptions) => buildApp({\n\t\t...watchOptions,\n\t\temitManifest: false,\n\t\tcollectSources: false\n\t}), options);\n}\n//#endregion\nexport { agentAssetsVitestPlugin, agentAssetsVitestPluginFromConfig, buildApp, buildFilteredApp, createAppBuildConfig, resolveBuildFilter, resolveModuleDirs, resolveRuntimeBuildArtifact, watchApp };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;AAMA,SAAS,UAAU,MAAM;CACxB,OAAO,KAAK,MAAM,GAAG,EAAE,KAAK,GAAG;AAChC;AACA,SAAS,oBAAoB,MAAM,UAAU;CAC5C,OAAO,UAAU,SAAS,MAAM,uBAAuB,QAAQ,CAAC,CAAC;AAClE;;AAEA,SAAS,uBAAuB,UAAU;CACzC,MAAM,WAAW,QAAQ,QAAQ;CACjC,IAAI;EACH,OAAO,aAAa,OAAO,QAAQ;CACpC,QAAQ;EACP,OAAO;CACR;AACD;AACA,SAAS,kBAAkB,IAAI,MAAM;CACpC,IAAI,GAAG,WAAW,IAAI,GAAG,OAAO;CAChC,MAAM,aAAa,uBAAuB,GAAG,WAAW,SAAS,IAAI,cAAc,EAAE,IAAI,EAAE;CAC3F,IAAI,CAAC,WAAW,WAAW,uBAAuB,IAAI,CAAC,GAAG,OAAO;CACjE,OAAO;AACR;AACA,SAAS,uBAAuB,MAAM,aAAa,UAAU;CAC5D,MAAM,UAAU,oBAAoB,MAAM,WAAW;CACrD,IAAI,UAAU,OAAO,kBAAkB,QAAQ,8BAA8B,oBAAoB,MAAM,QAAQ,EAAE;CACjH,OAAO,kBAAkB,QAAQ;AAClC;;AAEA,SAAS,2BAA2B,SAAS;CAC5C,MAAM,OAAO,uBAAuB,QAAQ,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;CACD,IAAI;EACH,QAAQ,MAAM,IAAI;EAClB,MAAM,MAAM,qBAAqB;GAChC,GAAG;GACH;EACD,GAAG;GACF,cAAc,OAAO;GACrB,cAAc,OAAO;EACtB,CAAC,CAAC;EACF,IAAI,cAAc;GACjB,MAAM,EAAE,sCAAsC,MAAM,OAAO;GAC3D,MAAM,kCAAkC,IAAI;EAC7C;CACD,UAAU;EACT,QAAQ,MAAM,QAAQ;CACvB;CACA,OAAO,EAAE,aAAa,OAAO,YAAY;AAC1C;;;;;;;AAOA,eAAe,SAAS,UAAU,CAAC,GAAG;CACrC,MAAM,EAAE,gBAAgB,MAAM,OAAO;CACrC,MAAM,aAAa,iBAAiB,SAAS;EAC5C,GAAG;EACH,cAAc;EACd,gBAAgB;CACjB,CAAC,GAAG,OAAO;AACZ"}
|
|
@@ -5564,27 +5564,18 @@ const CredentialAuthKindSchema = _enum([
|
|
|
5564
5564
|
"oauth_managed",
|
|
5565
5565
|
"keystroke"
|
|
5566
5566
|
]);
|
|
5567
|
-
/** Where a credential instance is stored (`credential_instances.scope_type`). */
|
|
5568
|
-
const CredentialScopeTypeSchema = _enum([
|
|
5569
|
-
"organization",
|
|
5570
|
-
"project",
|
|
5571
|
-
"user"
|
|
5572
|
-
]);
|
|
5573
5567
|
/**
|
|
5574
|
-
*
|
|
5575
|
-
*
|
|
5568
|
+
* Where a credential instance is stored (`credential_instances.scope_type`), and the only thing an
|
|
5569
|
+
* action/tool can pin via `.scope(...)`. There is no resolution chain: when no scope is pinned, the
|
|
5570
|
+
* resolver tries the project default, then the org default, then throws.
|
|
5576
5571
|
*/
|
|
5577
|
-
const
|
|
5578
|
-
"selection",
|
|
5572
|
+
const CredentialScopeTypeSchema = _enum([
|
|
5579
5573
|
"organization",
|
|
5580
5574
|
"project",
|
|
5581
5575
|
"user"
|
|
5582
5576
|
]);
|
|
5583
5577
|
CredentialAuthKindSchema.options;
|
|
5584
5578
|
CredentialScopeTypeSchema.options;
|
|
5585
|
-
CredentialScopeLevelSchema.options;
|
|
5586
|
-
/** Default chain when `credential.static(...).scope()` is called with no args. */
|
|
5587
|
-
const DEFAULT_CREDENTIAL_RESOLUTION_CHAIN = ["organization", "project"];
|
|
5588
5579
|
/** Scope of a platform app credential (maps to `credential_instances.scope_type`). */
|
|
5589
5580
|
const AppCredentialScopeSchema = _enum([
|
|
5590
5581
|
"user",
|
|
@@ -5702,7 +5693,14 @@ object({
|
|
|
5702
5693
|
object({
|
|
5703
5694
|
app: string().trim().min(1),
|
|
5704
5695
|
tool: string().trim().min(1),
|
|
5705
|
-
arguments: record(string(), unknown()).default({})
|
|
5696
|
+
arguments: record(string(), unknown()).default({}),
|
|
5697
|
+
/**
|
|
5698
|
+
* Resolved credential instance to execute against. When set, the platform executes that exact
|
|
5699
|
+
* connection (scoped to the caller's org); when omitted it resolves the app's instance by scope.
|
|
5700
|
+
*/
|
|
5701
|
+
instanceId: string().trim().min(1).optional(),
|
|
5702
|
+
/** Pinned provider toolkit version, sourced from the app definition; forwarded to the provider. */
|
|
5703
|
+
version: string().trim().min(1)
|
|
5706
5704
|
});
|
|
5707
5705
|
const SubmitTeamRequestRequestSchema = object({
|
|
5708
5706
|
type: _enum([
|
|
@@ -5717,7 +5715,7 @@ function normalizeCredentialList(list) {
|
|
|
5717
5715
|
return list.map((item) => toCredentialRequirement(item));
|
|
5718
5716
|
}
|
|
5719
5717
|
function isCredentialRequirement(item) {
|
|
5720
|
-
return "
|
|
5718
|
+
return typeof item.scope !== "function";
|
|
5721
5719
|
}
|
|
5722
5720
|
function toCredentialRequirement(item) {
|
|
5723
5721
|
if (isCredentialRequirement(item)) return item;
|
|
@@ -5725,7 +5723,6 @@ function toCredentialRequirement(item) {
|
|
|
5725
5723
|
key: item.key,
|
|
5726
5724
|
kind: item.kind,
|
|
5727
5725
|
schema: item.schema,
|
|
5728
|
-
chain: DEFAULT_CREDENTIAL_RESOLUTION_CHAIN,
|
|
5729
5726
|
...item.tokenField !== void 0 ? { tokenField: item.tokenField } : {}
|
|
5730
5727
|
};
|
|
5731
5728
|
}
|
|
@@ -6809,4 +6806,4 @@ object({
|
|
|
6809
6806
|
//#endregion
|
|
6810
6807
|
export { ListProjectsResponseSchema as $, normalizeCredentialList as $t, DownloadActiveProjectArtifactResponseSchema as A, TriggerRunListResponseSchema as At, InviteOrganizationMembersResponseSchema as B, UpdateProjectSettingsRequestSchema as Bt, CreateOrganizationResponseSchema as C, StartOAuthConnectionInputSchema as Ct, CredentialInstanceListResponseSchema as D, TriggerDetailResponseSchema as Dt, CreateProjectResponseSchema as E, SubmitTeamRequestRequestSchema as Et, HistoryRunCancelResponseSchema as F, UpdateOrganizationMemberResponseSchema as Ft, ListCredentialsResponseSchema as G, UserAvatarSchema as Gt, InviteProjectMembersResponseSchema as H, UploadProjectSourceResponseSchema as Ht, HistoryRunDetailResponseSchema as I, UpdateOrganizationRequestSchema as It, ListOrganizationsResponseSchema as J, WorkflowRunDetailResponseSchema as Jt, ListOrganizationInvitationsResponseSchema as K, UserPreferencesPatchSchema as Kt, HistoryRunListQuerySchema as L, UpdateProjectMemberRequestSchema as Lt, GatewayAttachmentRecordSchema as M, UpdateCredentialInstanceBodySchema as Mt, GetCredentialResponseSchema as N, UpdateCredentialRequestSchema as Nt, CredentialInstanceRecordSchema as O, TriggerListResponseSchema as Ot, HealthResponseSchema as P, UpdateOrganizationMemberRequestSchema as Pt, ListProjectMetricsResponseSchema as Q, listenPortFromPublicUrl as Qt, HistoryRunListResponseSchema as R, UpdateProjectMemberResponseSchema as Rt, CreateOrganizationRequestSchema as S, SlugAvailabilityResponseSchema as St, CreateProjectRequestSchema as T, StoredRouteManifestSchema as Tt, ListApiKeysResponseSchema as U, UpsertGatewayAttachmentBodySchema as Ut, InviteProjectMembersRequestSchema as V, UploadProjectSourceManifestRequestSchema as Vt, ListAppsResponseSchema as W, UserAvatarPatchSchema as Wt, ListProjectFilesResponseSchema as X, WorkflowSummaryDetailResponseSchema as Xt, ListProjectDeploymentsResponseSchema as Y, WorkflowRunListResponseSchema as Yt, ListProjectMembersResponseSchema as Z, WorkflowSummaryListResponseSchema as Zt, CreateApiKeyRequestSchema as _, QueuedRunResponseSchema as _t, AgentSessionListResponseSchema as a, custom as an, PresignOrgLogoResponseSchema as at, CreateCredentialsRequestSchema as b, SkillSummaryDetailResponseSchema as bt, BindChannelBodySchema as c, object as cn, PresignUserAvatarRequestSchema as ct, ChannelConnectionSchema as d, toJSONSchema as dn, ProjectResponseSchema as dt, originFromPublicUrl as en, OrganizationSidebarBrandingPatchSchema as et, ChannelDirectoryListResponseSchema as f, ProjectSettingsResponseSchema as ft, ConnectProvidersResponseSchema as g, QueuedAgentPromptResponseSchema as gt, ConnectAuthorizeUrlResponseSchema as h, PromptResponseSchema as ht, AgentSessionDetailResponseSchema as i, array as in, PresignOrgLogoRequestSchema as it, ErrorResponseSchema as j, UpdateChannelBindingBodySchema as jt, DeclineOrganizationInvitationResponseSchema as k, TriggerRunDetailResponseSchema as kt, ChannelAccountListResponseSchema as l, string as ln, PresignUserAvatarResponseSchema as lt, CompleteProjectArtifactResponseSchema as m, PromptInputSchema as mt, AcceptOrganizationInvitationResponseSchema as n, ZodType as nn, PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS as nt, AgentSummaryDetailResponseSchema as o, discriminatedUnion as on, PresignProjectSourceRequestSchema as ot, ChannelPlatformSchema as p, ProjectSlugAvailabilityResponseSchema as pt, ListOrganizationMembersResponseSchema as q, UserPreferencesSchema as qt, ActiveOrganizationResponseSchema as r, _function as rn, PollRunResponseSchema as rt, AgentSummaryListResponseSchema as s, literal as sn, PresignProjectSourceResponseSchema as st, ACTIVE_ORG_HEADER as t, parseErrorResponse as tn, OrganizationSidebarBrandingSchema as tt, ChannelConnectionListResponseSchema as u, union as un, ProjectReachabilityResponseSchema as ut, CreateApiKeyResponseSchema as v, ROUTE_MANIFEST_REL_PATH as vt, CreateProjectArtifactResponseSchema as w, StartOAuthConnectionResultSchema as wt, CreateCredentialsResponseSchema as x, SkillSummaryListResponseSchema as xt, CreateCredentialInstanceBodySchema as y, RecentResourceListResponseSchema as yt, InviteOrganizationMembersRequestSchema as z, UpdateProjectRequestSchema as zt };
|
|
6811
6808
|
|
|
6812
|
-
//# sourceMappingURL=dist-
|
|
6809
|
+
//# sourceMappingURL=dist-XVz5PFMT.mjs.map
|