@agimon-ai/doompi-build 0.0.1-alpha.27 → 0.0.1-alpha.28

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.
Files changed (31) hide show
  1. package/dist/constants/contributions.cjs.map +1 -1
  2. package/dist/constants/contributions.mjs.map +1 -1
  3. package/dist/constants/layout.cjs.map +1 -1
  4. package/dist/constants/layout.mjs.map +1 -1
  5. package/dist/services/browserFile/index.cjs.map +1 -1
  6. package/dist/services/browserFile/index.mjs.map +1 -1
  7. package/dist/services/filename/index.cjs.map +1 -1
  8. package/dist/services/filename/index.mjs.map +1 -1
  9. package/dist/services/generate/index.cjs.map +1 -1
  10. package/dist/services/generate/index.mjs.map +1 -1
  11. package/dist/services/identity/index.cjs.map +1 -1
  12. package/dist/services/identity/index.mjs.map +1 -1
  13. package/dist/services/renderClient/index.cjs.map +1 -1
  14. package/dist/services/renderClient/index.mjs.map +1 -1
  15. package/dist/services/renderEntry/index.cjs.map +1 -1
  16. package/dist/services/renderEntry/index.mjs.map +1 -1
  17. package/dist/services/renderMcpWidgets/index.cjs.map +1 -1
  18. package/dist/services/renderMcpWidgets/index.mjs.map +1 -1
  19. package/dist/services/resolveTarget/index.cjs.map +1 -1
  20. package/dist/services/resolveTarget/index.mjs.map +1 -1
  21. package/dist/services/scan/index.cjs.map +1 -1
  22. package/dist/services/scan/index.mjs.map +1 -1
  23. package/dist/services/segments/index.cjs.map +1 -1
  24. package/dist/services/segments/index.mjs.map +1 -1
  25. package/dist/services/syncManifest/index.cjs.map +1 -1
  26. package/dist/services/syncManifest/index.mjs.map +1 -1
  27. package/dist/services/tsdownPreset/index.cjs.map +1 -1
  28. package/dist/services/tsdownPreset/index.mjs.map +1 -1
  29. package/dist/services/writeGenerated/index.cjs.map +1 -1
  30. package/dist/services/writeGenerated/index.mjs.map +1 -1
  31. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"contributions.cjs","names":[],"sources":["../../src/constants/contributions.ts"],"sourcesContent":["/**\n * Which contribution field each surface produces, per host and side.\n *\n * The surface names the concept; the host decides which array carries it.\n * A surface missing from a host's table is legitimately absent there, such\n * as api/ on the CLI, and is skipped without complaint.\n *\n * Two hosts read the frontend side. The cockpit takes the `.web` files; the\n * terminal takes only the `.cli` ones, and puts them somewhere else, which is\n * why that side needs a table per host rather than one shared.\n */\n\n/** A surface that produces nothing registrable, but is still published. */\nexport const NOT_A_CONTRIBUTION = '';\n\n/**\n * A surface whose file is folded into another contribution rather than being one.\n *\n * A terminal tool renderer is not a separate registration the way a cockpit\n * one is: `renderCall` and `renderResult` are fields of the tool declaration,\n * so the generated entry pairs the presentation file with the backend tool of\n * the same name and merges them.\n */\nexport const MERGED_INTO_TOOL = 'tool-renderers';\n\nexport const CLI_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n shortcut: 'shortcuts',\n hook: 'events',\n provider: 'providers',\n resource: 'resources',\n};\n\nexport const SERVER_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n hook: 'hooks',\n mode: 'minorModes',\n api: 'api',\n channel: 'channels',\n method: 'methods',\n resource: 'resources',\n};\n\nexport const MCP_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n skill: 'skills',\n resource: 'uiResources',\n};\n/** The terminal's own presentation surfaces, authored under `(frontend)` with a `.cli` suffix. */\nexport const CLI_FRONTEND_FIELDS: Readonly<Record<string, string>> = {\n tool: MERGED_INTO_TOOL,\n message: 'messageRenderers',\n overlay: NOT_A_CONTRIBUTION,\n};\n\nexport const WEB_FIELDS: Readonly<Record<string, string>> = {\n tool: 'toolRenderers',\n command: 'paletteCommands',\n mode: 'minorModes',\n channel: 'channels',\n tab: 'tabs',\n template: 'templates',\n dock: 'dockFaces',\n setting: 'settingsSections',\n slot: 'slots',\n // Every fill is a slot fill. The cockpit declares its own regions as slots\n // (overlay, rail, context, activity and so on), so the build tooling needs\n // to know none of their names.\n fill: 'fills',\n action: 'contextActions',\n 'activity-group': 'activityGroups',\n leader: 'leaderBindings',\n 'selection-axis': 'selectionAxes',\n lifecycle: 'start',\n 'file-links': 'fileLinks',\n 'repository-settings-panel': 'repositorySettingsPanel',\n api: NOT_A_CONTRIBUTION,\n method: NOT_A_CONTRIBUTION,\n store: NOT_A_CONTRIBUTION,\n};\n\n/** Disambiguates the two shapes a `setting/` file can take. */\nexport const SETTING_FIELDS: Readonly<Record<string, string>> = {\n section: 'settingsSections',\n panel: 'settingsPanels',\n};\n\n/** Disambiguates the two shapes an `action/` file can take. */\nexport const ACTION_FIELDS: Readonly<Record<string, string>> = {\n context: 'contextActions',\n message: 'userMessageActions',\n};\n"],"mappings":"AAuBA,MAAa,EAAmB,iBAEnB,EAA+C,CAC1D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,SAAU,YACV,KAAM,SACN,SAAU,YACV,SAAU,WACZ,EAEa,EAAkD,CAC7D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,KAAM,QACN,KAAM,aACN,IAAK,MACL,QAAS,WACT,OAAQ,UACR,SAAU,WACZ,EAEa,EAA+C,CAC1D,KAAM,QACN,MAAO,SACP,SAAU,aACZ,EAEa,EAAwD,CACnE,KAAM,EACN,QAAS,mBACT,QAAA,EACF,EAEa,EAA+C,CAC1D,KAAM,gBACN,QAAS,kBACT,KAAM,aACN,QAAS,WACT,IAAK,OACL,SAAU,YACV,KAAM,YACN,QAAS,mBACT,KAAM,QAIN,KAAM,QACN,OAAQ,iBACR,iBAAkB,iBAClB,OAAQ,iBACR,iBAAkB,gBAClB,UAAW,QACX,aAAc,YACd,4BAA6B,0BAC7B,IAAA,GACA,OAAA,GACA,MAAA,EACF,EAGa,EAAmD,CAC9D,QAAS,mBACT,MAAO,gBACT,EAGa,EAAkD,CAC7D,QAAS,iBACT,QAAS,oBACX"}
1
+ {"version":3,"file":"contributions.cjs","names":["MERGED_INTO_TOOL","CLI_FIELDS","SERVER_FIELDS","MCP_FIELDS","CLI_FRONTEND_FIELDS","WEB_FIELDS","SETTING_FIELDS","ACTION_FIELDS"],"sources":["../../src/constants/contributions.ts"],"sourcesContent":["/**\n * Which contribution field each surface produces, per host and side.\n *\n * The surface names the concept; the host decides which array carries it.\n * A surface missing from a host's table is legitimately absent there, such\n * as api/ on the CLI, and is skipped without complaint.\n *\n * Two hosts read the frontend side. The cockpit takes the `.web` files; the\n * terminal takes only the `.cli` ones, and puts them somewhere else, which is\n * why that side needs a table per host rather than one shared.\n */\n\n/** A surface that produces nothing registrable, but is still published. */\nexport const NOT_A_CONTRIBUTION = '';\n\n/**\n * A surface whose file is folded into another contribution rather than being one.\n *\n * A terminal tool renderer is not a separate registration the way a cockpit\n * one is: `renderCall` and `renderResult` are fields of the tool declaration,\n * so the generated entry pairs the presentation file with the backend tool of\n * the same name and merges them.\n */\nexport const MERGED_INTO_TOOL = 'tool-renderers';\n\nexport const CLI_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n shortcut: 'shortcuts',\n hook: 'events',\n provider: 'providers',\n resource: 'resources',\n};\n\nexport const SERVER_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n hook: 'hooks',\n mode: 'minorModes',\n api: 'api',\n channel: 'channels',\n method: 'methods',\n resource: 'resources',\n};\n\nexport const MCP_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n skill: 'skills',\n resource: 'uiResources',\n};\n/** The terminal's own presentation surfaces, authored under `(frontend)` with a `.cli` suffix. */\nexport const CLI_FRONTEND_FIELDS: Readonly<Record<string, string>> = {\n tool: MERGED_INTO_TOOL,\n message: 'messageRenderers',\n overlay: NOT_A_CONTRIBUTION,\n};\n\nexport const WEB_FIELDS: Readonly<Record<string, string>> = {\n tool: 'toolRenderers',\n command: 'paletteCommands',\n mode: 'minorModes',\n channel: 'channels',\n tab: 'tabs',\n template: 'templates',\n dock: 'dockFaces',\n setting: 'settingsSections',\n slot: 'slots',\n // Every fill is a slot fill. The cockpit declares its own regions as slots\n // (overlay, rail, context, activity and so on), so the build tooling needs\n // to know none of their names.\n fill: 'fills',\n action: 'contextActions',\n 'activity-group': 'activityGroups',\n leader: 'leaderBindings',\n 'selection-axis': 'selectionAxes',\n lifecycle: 'start',\n 'file-links': 'fileLinks',\n 'repository-settings-panel': 'repositorySettingsPanel',\n api: NOT_A_CONTRIBUTION,\n method: NOT_A_CONTRIBUTION,\n store: NOT_A_CONTRIBUTION,\n};\n\n/** Disambiguates the two shapes a `setting/` file can take. */\nexport const SETTING_FIELDS: Readonly<Record<string, string>> = {\n section: 'settingsSections',\n panel: 'settingsPanels',\n};\n\n/** Disambiguates the two shapes an `action/` file can take. */\nexport const ACTION_FIELDS: Readonly<Record<string, string>> = {\n context: 'contextActions',\n message: 'userMessageActions',\n};\n"],"mappings":"AAuBA,MAAaA,EAAmB,iBAEnBC,EAA+C,CAC1D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,SAAU,YACV,KAAM,SACN,SAAU,YACV,SAAU,WACZ,EAEaC,EAAkD,CAC7D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,KAAM,QACN,KAAM,aACN,IAAK,MACL,QAAS,WACT,OAAQ,UACR,SAAU,WACZ,EAEaC,EAA+C,CAC1D,KAAM,QACN,MAAO,SACP,SAAU,aACZ,EAEaC,EAAwD,CACnE,KAAMJ,EACN,QAAS,mBACT,QAAA,EACF,EAEaK,EAA+C,CAC1D,KAAM,gBACN,QAAS,kBACT,KAAM,aACN,QAAS,WACT,IAAK,OACL,SAAU,YACV,KAAM,YACN,QAAS,mBACT,KAAM,QAIN,KAAM,QACN,OAAQ,iBACR,iBAAkB,iBAClB,OAAQ,iBACR,iBAAkB,gBAClB,UAAW,QACX,aAAc,YACd,4BAA6B,0BAC7B,IAAA,GACA,OAAA,GACA,MAAA,EACF,EAGaC,EAAmD,CAC9D,QAAS,mBACT,MAAO,gBACT,EAGaC,EAAkD,CAC7D,QAAS,iBACT,QAAS,oBACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"contributions.mjs","names":[],"sources":["../../src/constants/contributions.ts"],"sourcesContent":["/**\n * Which contribution field each surface produces, per host and side.\n *\n * The surface names the concept; the host decides which array carries it.\n * A surface missing from a host's table is legitimately absent there, such\n * as api/ on the CLI, and is skipped without complaint.\n *\n * Two hosts read the frontend side. The cockpit takes the `.web` files; the\n * terminal takes only the `.cli` ones, and puts them somewhere else, which is\n * why that side needs a table per host rather than one shared.\n */\n\n/** A surface that produces nothing registrable, but is still published. */\nexport const NOT_A_CONTRIBUTION = '';\n\n/**\n * A surface whose file is folded into another contribution rather than being one.\n *\n * A terminal tool renderer is not a separate registration the way a cockpit\n * one is: `renderCall` and `renderResult` are fields of the tool declaration,\n * so the generated entry pairs the presentation file with the backend tool of\n * the same name and merges them.\n */\nexport const MERGED_INTO_TOOL = 'tool-renderers';\n\nexport const CLI_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n shortcut: 'shortcuts',\n hook: 'events',\n provider: 'providers',\n resource: 'resources',\n};\n\nexport const SERVER_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n hook: 'hooks',\n mode: 'minorModes',\n api: 'api',\n channel: 'channels',\n method: 'methods',\n resource: 'resources',\n};\n\nexport const MCP_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n skill: 'skills',\n resource: 'uiResources',\n};\n/** The terminal's own presentation surfaces, authored under `(frontend)` with a `.cli` suffix. */\nexport const CLI_FRONTEND_FIELDS: Readonly<Record<string, string>> = {\n tool: MERGED_INTO_TOOL,\n message: 'messageRenderers',\n overlay: NOT_A_CONTRIBUTION,\n};\n\nexport const WEB_FIELDS: Readonly<Record<string, string>> = {\n tool: 'toolRenderers',\n command: 'paletteCommands',\n mode: 'minorModes',\n channel: 'channels',\n tab: 'tabs',\n template: 'templates',\n dock: 'dockFaces',\n setting: 'settingsSections',\n slot: 'slots',\n // Every fill is a slot fill. The cockpit declares its own regions as slots\n // (overlay, rail, context, activity and so on), so the build tooling needs\n // to know none of their names.\n fill: 'fills',\n action: 'contextActions',\n 'activity-group': 'activityGroups',\n leader: 'leaderBindings',\n 'selection-axis': 'selectionAxes',\n lifecycle: 'start',\n 'file-links': 'fileLinks',\n 'repository-settings-panel': 'repositorySettingsPanel',\n api: NOT_A_CONTRIBUTION,\n method: NOT_A_CONTRIBUTION,\n store: NOT_A_CONTRIBUTION,\n};\n\n/** Disambiguates the two shapes a `setting/` file can take. */\nexport const SETTING_FIELDS: Readonly<Record<string, string>> = {\n section: 'settingsSections',\n panel: 'settingsPanels',\n};\n\n/** Disambiguates the two shapes an `action/` file can take. */\nexport const ACTION_FIELDS: Readonly<Record<string, string>> = {\n context: 'contextActions',\n message: 'userMessageActions',\n};\n"],"mappings":"AAuBA,MAAa,EAAmB,iBAEnB,EAA+C,CAC1D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,SAAU,YACV,KAAM,SACN,SAAU,YACV,SAAU,WACZ,EAEa,EAAkD,CAC7D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,KAAM,QACN,KAAM,aACN,IAAK,MACL,QAAS,WACT,OAAQ,UACR,SAAU,WACZ,EAEa,EAA+C,CAC1D,KAAM,QACN,MAAO,SACP,SAAU,aACZ,EAEa,EAAwD,CACnE,KAAM,EACN,QAAS,mBACT,QAAA,EACF,EAEa,EAA+C,CAC1D,KAAM,gBACN,QAAS,kBACT,KAAM,aACN,QAAS,WACT,IAAK,OACL,SAAU,YACV,KAAM,YACN,QAAS,mBACT,KAAM,QAIN,KAAM,QACN,OAAQ,iBACR,iBAAkB,iBAClB,OAAQ,iBACR,iBAAkB,gBAClB,UAAW,QACX,aAAc,YACd,4BAA6B,0BAC7B,IAAA,GACA,OAAA,GACA,MAAA,EACF,EAGa,EAAmD,CAC9D,QAAS,mBACT,MAAO,gBACT,EAGa,EAAkD,CAC7D,QAAS,iBACT,QAAS,oBACX"}
1
+ {"version":3,"file":"contributions.mjs","names":["MERGED_INTO_TOOL","CLI_FIELDS","SERVER_FIELDS","MCP_FIELDS","CLI_FRONTEND_FIELDS","WEB_FIELDS","SETTING_FIELDS","ACTION_FIELDS"],"sources":["../../src/constants/contributions.ts"],"sourcesContent":["/**\n * Which contribution field each surface produces, per host and side.\n *\n * The surface names the concept; the host decides which array carries it.\n * A surface missing from a host's table is legitimately absent there, such\n * as api/ on the CLI, and is skipped without complaint.\n *\n * Two hosts read the frontend side. The cockpit takes the `.web` files; the\n * terminal takes only the `.cli` ones, and puts them somewhere else, which is\n * why that side needs a table per host rather than one shared.\n */\n\n/** A surface that produces nothing registrable, but is still published. */\nexport const NOT_A_CONTRIBUTION = '';\n\n/**\n * A surface whose file is folded into another contribution rather than being one.\n *\n * A terminal tool renderer is not a separate registration the way a cockpit\n * one is: `renderCall` and `renderResult` are fields of the tool declaration,\n * so the generated entry pairs the presentation file with the backend tool of\n * the same name and merges them.\n */\nexport const MERGED_INTO_TOOL = 'tool-renderers';\n\nexport const CLI_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n shortcut: 'shortcuts',\n hook: 'events',\n provider: 'providers',\n resource: 'resources',\n};\n\nexport const SERVER_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n 'tool-restriction': 'toolRestrictions',\n command: 'commands',\n hook: 'hooks',\n mode: 'minorModes',\n api: 'api',\n channel: 'channels',\n method: 'methods',\n resource: 'resources',\n};\n\nexport const MCP_FIELDS: Readonly<Record<string, string>> = {\n tool: 'tools',\n skill: 'skills',\n resource: 'uiResources',\n};\n/** The terminal's own presentation surfaces, authored under `(frontend)` with a `.cli` suffix. */\nexport const CLI_FRONTEND_FIELDS: Readonly<Record<string, string>> = {\n tool: MERGED_INTO_TOOL,\n message: 'messageRenderers',\n overlay: NOT_A_CONTRIBUTION,\n};\n\nexport const WEB_FIELDS: Readonly<Record<string, string>> = {\n tool: 'toolRenderers',\n command: 'paletteCommands',\n mode: 'minorModes',\n channel: 'channels',\n tab: 'tabs',\n template: 'templates',\n dock: 'dockFaces',\n setting: 'settingsSections',\n slot: 'slots',\n // Every fill is a slot fill. The cockpit declares its own regions as slots\n // (overlay, rail, context, activity and so on), so the build tooling needs\n // to know none of their names.\n fill: 'fills',\n action: 'contextActions',\n 'activity-group': 'activityGroups',\n leader: 'leaderBindings',\n 'selection-axis': 'selectionAxes',\n lifecycle: 'start',\n 'file-links': 'fileLinks',\n 'repository-settings-panel': 'repositorySettingsPanel',\n api: NOT_A_CONTRIBUTION,\n method: NOT_A_CONTRIBUTION,\n store: NOT_A_CONTRIBUTION,\n};\n\n/** Disambiguates the two shapes a `setting/` file can take. */\nexport const SETTING_FIELDS: Readonly<Record<string, string>> = {\n section: 'settingsSections',\n panel: 'settingsPanels',\n};\n\n/** Disambiguates the two shapes an `action/` file can take. */\nexport const ACTION_FIELDS: Readonly<Record<string, string>> = {\n context: 'contextActions',\n message: 'userMessageActions',\n};\n"],"mappings":"AAuBA,MAAaA,EAAmB,iBAEnBC,EAA+C,CAC1D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,SAAU,YACV,KAAM,SACN,SAAU,YACV,SAAU,WACZ,EAEaC,EAAkD,CAC7D,KAAM,QACN,mBAAoB,mBACpB,QAAS,WACT,KAAM,QACN,KAAM,aACN,IAAK,MACL,QAAS,WACT,OAAQ,UACR,SAAU,WACZ,EAEaC,EAA+C,CAC1D,KAAM,QACN,MAAO,SACP,SAAU,aACZ,EAEaC,EAAwD,CACnE,KAAMJ,EACN,QAAS,mBACT,QAAA,EACF,EAEaK,EAA+C,CAC1D,KAAM,gBACN,QAAS,kBACT,KAAM,aACN,QAAS,WACT,IAAK,OACL,SAAU,YACV,KAAM,YACN,QAAS,mBACT,KAAM,QAIN,KAAM,QACN,OAAQ,iBACR,iBAAkB,iBAClB,OAAQ,iBACR,iBAAkB,gBAClB,UAAW,QACX,aAAc,YACd,4BAA6B,0BAC7B,IAAA,GACA,OAAA,GACA,MAAA,EACF,EAGaC,EAAmD,CAC9D,QAAS,mBACT,MAAO,gBACT,EAGaC,EAAkD,CAC7D,QAAS,iBACT,QAAS,oBACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"layout.cjs","names":[],"sources":["../../src/constants/layout.ts"],"sourcesContent":["/**\n * The folder-convention vocabulary, in one place.\n *\n * Every name here is part of the authoring contract in\n * docs/extension-layout.md. Adding a surface means adding it to both.\n */\n\n/** Where the scan starts, package-relative. */\nexport const DEFAULT_ROUTING_ROOT = 'src/extensions';\n/** Accepted spelling of the same root, for packages that prefer the singular. */\nexport const ROUTING_ROOT_ALIAS = 'src/extension';\n\n/** Group folders that also select a build side. */\nexport const BACKEND_GROUP = 'backend';\nexport const FRONTEND_GROUP = 'frontend';\n\n/** Scope segments, in nesting order below the routing root. */\nexport const WORKSPACE_SEGMENT = 'workspaces';\nexport const SESSION_SEGMENT = 'sessions';\n\n/** Gate folders. Each is followed by exactly one id segment. */\nexport const GATE_SEGMENTS: readonly string[] = ['mode', 'domain'];\n\n/** The leaf filename of an HTTP route, as Next.js spells it. */\nexport const ROUTE_FILE_NAME = 'route';\n\n/**\n * The reserved filename that constructs a scope, as Next.js spells a layout.\n *\n * One per scope and side. It runs before every contribution beneath it, and\n * whatever it returns is handed to each of them as part of the mount context,\n * which is how a package with one shared per-mount object graph decomposes\n * into a file per surface instead of one closure.\n */\nexport const ROOT_FILE_NAME = 'root';\n\n/**\n * Where generated entries are written, package-relative.\n *\n * Not `src`. That directory is authored code, and a build that writes into it\n * makes every package carry output its author did not write and must not edit.\n * This one is gitignored per package, and the repository's formatter already\n * skips a directory by this name.\n */\nexport const GENERATED_DIR = 'generated';\n\n/**\n * The generated entry each build target writes, keyed by the target it serves.\n *\n * Keyed rather than positional. The basenames are historical and two of the\n * three do not match their target's name, so an array has to be read by index,\n * and adding a fourth generated file silently rotates which host each entry\n * belongs to.\n */\nexport const GENERATED_ENTRY_FILENAMES = { cli: 'pi', server: 'server', web: 'web', mcp: 'mcp' } as const;\n\n/**\n * The generated typed client, which is not a build target.\n *\n * Nothing bundles it as an entry: a `(frontend)` file imports it and the\n * cockpit's browser build pulls it in from there. It is listed among the\n * managed names so that a package which drops its route table has the stale\n * client deleted rather than left behind.\n */\nexport const GENERATED_CLIENT_NAME = 'client';\n\n/**\n * The route table a package authors, and the switch that asks for a client.\n *\n * Its presence is what opts a package in, the way `src/exports/apiContracts.ts`\n * is what asks for a contracts entry. It lives under `src/types` because that\n * is one of the two source roots a browser bundle may read.\n */\nexport const API_ROUTES_MODULE = 'src/types/apiRoutes.ts';\n\n/**\n * Every generated basename. Never scanned, never hand-edited.\n *\n * Spelled out rather than derived from the two declarations above, because a\n * constants module holds data a reader can see without running it. The cost is\n * that the names appear twice; the generate tests assert the two agree.\n */\nexport const GENERATED_ENTRY_NAMES: readonly string[] = ['pi', 'server', 'web', 'mcp', 'client'];\n\n/**\n * Platform suffixes, scoped to their side. A target may not reuse one of these words.\n *\n * Every public routed file names one of these, so which host reads it is read\n * off the filename rather than inferred. A file that names none is a notice.\n *\n * `cli` appears on both sides, because the interactive host has both. Its\n * backend files hold a tool's `execute` and its services; its frontend files\n * hold the TUI that draws them. A terminal is a frontend that happens not to\n * be a browser, which is why the side axis is logic against presentation\n * rather than Node against browser.\n */\nexport const BACKEND_PLATFORMS: readonly string[] = ['cli', 'server', 'mcp'];\nexport const FRONTEND_PLATFORMS: readonly string[] = ['cli', 'web', 'ios', 'android', 'desktop'];\n\n/** The hosts this build emits. A frontend platform outside this set is authorable but unbuildable. */\nexport const BUILD_TARGET_PLATFORMS: readonly string[] = ['cli', 'server', 'web', 'mcp'];\n\n/**\n * Surfaces that produce contributions on the backend side.\n *\n * `mode` is absent on purpose: it is a gate folder, so it is consumed before\n * the surface check and its declaration file synthesises the surface instead.\n */\nexport const BACKEND_SURFACES: readonly string[] = [\n 'tool',\n 'skill',\n 'tool-restriction',\n 'command',\n 'shortcut',\n 'hook',\n 'api',\n 'channel',\n 'method',\n 'provider',\n 'resource',\n];\n\n/**\n * Surfaces that produce contributions on the frontend side.\n *\n * `message` is terminal-only today: the cockpit renders a timeline entry\n * through a tool renderer or a fill, while the TUI has a separate registry\n * keyed by custom message type.\n */\nexport const FRONTEND_SURFACES: readonly string[] = [\n 'tool',\n 'command',\n 'api',\n 'channel',\n 'method',\n 'message',\n 'overlay',\n 'tab',\n 'template',\n 'dock',\n 'setting',\n 'slot',\n 'fill',\n 'action',\n 'store',\n 'activity-group',\n 'leader',\n 'selection-axis',\n 'lifecycle',\n 'file-links',\n 'repository-settings-panel',\n];\n\n/** Surfaces whose filename carries a relationship target. */\nexport const TARGETED_SURFACES: readonly string[] = ['fill', 'action'];\n\n/** Surfaces whose folders below the surface spell a route path. */\nexport const ROUTED_SURFACES: readonly string[] = ['api'];\n\n/** Source extensions the scan accepts. */\nexport const SOURCE_EXTENSIONS: readonly string[] = ['ts', 'tsx', 'mts', 'cts'];\n\n/** Filename infixes excluded everywhere, whatever their position. */\nexport const EXCLUDED_INFIXES: readonly string[] = ['test', 'spec', 'stories'];\n\n/** Marks a folder as organisational: not a path segment, contents still scanned. */\nexport const GROUP_PREFIX = '(';\nexport const GROUP_SUFFIX = ')';\n/** Marks a folder as private: never scanned, never built. */\nexport const PRIVATE_PREFIX = '_';\n/** Marks a folder as a dynamic route segment. */\nexport const DYNAMIC_PREFIX = '[';\nexport const DYNAMIC_SUFFIX = ']';\n/** Marks a dynamic segment as catch-all. */\nexport const CATCH_ALL_MARKER = '...';\n"],"mappings":"AAQA,MAaa,EAAmC,CAAC,OAAQ,QAAQ,EAiCpD,EAA4B,CAAE,IAAK,KAAM,OAAQ,SAAU,IAAK,MAAO,IAAK,KAAM,EA4BlF,EAA2C,CAAC,KAAM,SAAU,MAAO,MAAO,QAAQ,EAclF,EAAuC,CAAC,MAAO,SAAU,KAAK,EAC9D,EAAwC,CAAC,MAAO,MAAO,MAAO,UAAW,SAAS,EAGlF,EAA4C,CAAC,MAAO,SAAU,MAAO,KAAK,EAQ1E,EAAsC,CACjD,OACA,QACA,mBACA,UACA,WACA,OACA,MACA,UACA,SACA,WACA,UACF,EASa,EAAuC,CAClD,OACA,UACA,MACA,UACA,SACA,UACA,UACA,MACA,WACA,OACA,UACA,OACA,OACA,SACA,QACA,iBACA,SACA,iBACA,YACA,aACA,2BACF,EAGa,EAAuC,CAAC,OAAQ,QAAQ,EAGxD,EAAqC,CAAC,KAAK,EAG3C,EAAuC,CAAC,KAAM,MAAO,MAAO,KAAK,EAGjE,EAAsC,CAAC,OAAQ,OAAQ,SAAS"}
1
+ {"version":3,"file":"layout.cjs","names":["GATE_SEGMENTS","GENERATED_ENTRY_FILENAMES","GENERATED_ENTRY_NAMES","BACKEND_PLATFORMS","FRONTEND_PLATFORMS","BUILD_TARGET_PLATFORMS","BACKEND_SURFACES","FRONTEND_SURFACES","TARGETED_SURFACES","ROUTED_SURFACES","SOURCE_EXTENSIONS","EXCLUDED_INFIXES"],"sources":["../../src/constants/layout.ts"],"sourcesContent":["/**\n * The folder-convention vocabulary, in one place.\n *\n * Every name here is part of the authoring contract in\n * docs/extension-layout.md. Adding a surface means adding it to both.\n */\n\n/** Where the scan starts, package-relative. */\nexport const DEFAULT_ROUTING_ROOT = 'src/extensions';\n/** Accepted spelling of the same root, for packages that prefer the singular. */\nexport const ROUTING_ROOT_ALIAS = 'src/extension';\n\n/** Group folders that also select a build side. */\nexport const BACKEND_GROUP = 'backend';\nexport const FRONTEND_GROUP = 'frontend';\n\n/** Scope segments, in nesting order below the routing root. */\nexport const WORKSPACE_SEGMENT = 'workspaces';\nexport const SESSION_SEGMENT = 'sessions';\n\n/** Gate folders. Each is followed by exactly one id segment. */\nexport const GATE_SEGMENTS: readonly string[] = ['mode', 'domain'];\n\n/** The leaf filename of an HTTP route, as Next.js spells it. */\nexport const ROUTE_FILE_NAME = 'route';\n\n/**\n * The reserved filename that constructs a scope, as Next.js spells a layout.\n *\n * One per scope and side. It runs before every contribution beneath it, and\n * whatever it returns is handed to each of them as part of the mount context,\n * which is how a package with one shared per-mount object graph decomposes\n * into a file per surface instead of one closure.\n */\nexport const ROOT_FILE_NAME = 'root';\n\n/**\n * Where generated entries are written, package-relative.\n *\n * Not `src`. That directory is authored code, and a build that writes into it\n * makes every package carry output its author did not write and must not edit.\n * This one is gitignored per package, and the repository's formatter already\n * skips a directory by this name.\n */\nexport const GENERATED_DIR = 'generated';\n\n/**\n * The generated entry each build target writes, keyed by the target it serves.\n *\n * Keyed rather than positional. The basenames are historical and two of the\n * three do not match their target's name, so an array has to be read by index,\n * and adding a fourth generated file silently rotates which host each entry\n * belongs to.\n */\nexport const GENERATED_ENTRY_FILENAMES = { cli: 'pi', server: 'server', web: 'web', mcp: 'mcp' } as const;\n\n/**\n * The generated typed client, which is not a build target.\n *\n * Nothing bundles it as an entry: a `(frontend)` file imports it and the\n * cockpit's browser build pulls it in from there. It is listed among the\n * managed names so that a package which drops its route table has the stale\n * client deleted rather than left behind.\n */\nexport const GENERATED_CLIENT_NAME = 'client';\n\n/**\n * The route table a package authors, and the switch that asks for a client.\n *\n * Its presence is what opts a package in, the way `src/exports/apiContracts.ts`\n * is what asks for a contracts entry. It lives under `src/types` because that\n * is one of the two source roots a browser bundle may read.\n */\nexport const API_ROUTES_MODULE = 'src/types/apiRoutes.ts';\n\n/**\n * Every generated basename. Never scanned, never hand-edited.\n *\n * Spelled out rather than derived from the two declarations above, because a\n * constants module holds data a reader can see without running it. The cost is\n * that the names appear twice; the generate tests assert the two agree.\n */\nexport const GENERATED_ENTRY_NAMES: readonly string[] = ['pi', 'server', 'web', 'mcp', 'client'];\n\n/**\n * Platform suffixes, scoped to their side. A target may not reuse one of these words.\n *\n * Every public routed file names one of these, so which host reads it is read\n * off the filename rather than inferred. A file that names none is a notice.\n *\n * `cli` appears on both sides, because the interactive host has both. Its\n * backend files hold a tool's `execute` and its services; its frontend files\n * hold the TUI that draws them. A terminal is a frontend that happens not to\n * be a browser, which is why the side axis is logic against presentation\n * rather than Node against browser.\n */\nexport const BACKEND_PLATFORMS: readonly string[] = ['cli', 'server', 'mcp'];\nexport const FRONTEND_PLATFORMS: readonly string[] = ['cli', 'web', 'ios', 'android', 'desktop'];\n\n/** The hosts this build emits. A frontend platform outside this set is authorable but unbuildable. */\nexport const BUILD_TARGET_PLATFORMS: readonly string[] = ['cli', 'server', 'web', 'mcp'];\n\n/**\n * Surfaces that produce contributions on the backend side.\n *\n * `mode` is absent on purpose: it is a gate folder, so it is consumed before\n * the surface check and its declaration file synthesises the surface instead.\n */\nexport const BACKEND_SURFACES: readonly string[] = [\n 'tool',\n 'skill',\n 'tool-restriction',\n 'command',\n 'shortcut',\n 'hook',\n 'api',\n 'channel',\n 'method',\n 'provider',\n 'resource',\n];\n\n/**\n * Surfaces that produce contributions on the frontend side.\n *\n * `message` is terminal-only today: the cockpit renders a timeline entry\n * through a tool renderer or a fill, while the TUI has a separate registry\n * keyed by custom message type.\n */\nexport const FRONTEND_SURFACES: readonly string[] = [\n 'tool',\n 'command',\n 'api',\n 'channel',\n 'method',\n 'message',\n 'overlay',\n 'tab',\n 'template',\n 'dock',\n 'setting',\n 'slot',\n 'fill',\n 'action',\n 'store',\n 'activity-group',\n 'leader',\n 'selection-axis',\n 'lifecycle',\n 'file-links',\n 'repository-settings-panel',\n];\n\n/** Surfaces whose filename carries a relationship target. */\nexport const TARGETED_SURFACES: readonly string[] = ['fill', 'action'];\n\n/** Surfaces whose folders below the surface spell a route path. */\nexport const ROUTED_SURFACES: readonly string[] = ['api'];\n\n/** Source extensions the scan accepts. */\nexport const SOURCE_EXTENSIONS: readonly string[] = ['ts', 'tsx', 'mts', 'cts'];\n\n/** Filename infixes excluded everywhere, whatever their position. */\nexport const EXCLUDED_INFIXES: readonly string[] = ['test', 'spec', 'stories'];\n\n/** Marks a folder as organisational: not a path segment, contents still scanned. */\nexport const GROUP_PREFIX = '(';\nexport const GROUP_SUFFIX = ')';\n/** Marks a folder as private: never scanned, never built. */\nexport const PRIVATE_PREFIX = '_';\n/** Marks a folder as a dynamic route segment. */\nexport const DYNAMIC_PREFIX = '[';\nexport const DYNAMIC_SUFFIX = ']';\n/** Marks a dynamic segment as catch-all. */\nexport const CATCH_ALL_MARKER = '...';\n"],"mappings":"AAQA,MAaaA,EAAmC,CAAC,OAAQ,QAAQ,EAiCpDC,EAA4B,CAAE,IAAK,KAAM,OAAQ,SAAU,IAAK,MAAO,IAAK,KAAM,EA4BlFC,EAA2C,CAAC,KAAM,SAAU,MAAO,MAAO,QAAQ,EAclFC,EAAuC,CAAC,MAAO,SAAU,KAAK,EAC9DC,EAAwC,CAAC,MAAO,MAAO,MAAO,UAAW,SAAS,EAGlFC,EAA4C,CAAC,MAAO,SAAU,MAAO,KAAK,EAQ1EC,EAAsC,CACjD,OACA,QACA,mBACA,UACA,WACA,OACA,MACA,UACA,SACA,WACA,UACF,EASaC,EAAuC,CAClD,OACA,UACA,MACA,UACA,SACA,UACA,UACA,MACA,WACA,OACA,UACA,OACA,OACA,SACA,QACA,iBACA,SACA,iBACA,YACA,aACA,2BACF,EAGaC,EAAuC,CAAC,OAAQ,QAAQ,EAGxDC,EAAqC,CAAC,KAAK,EAG3CC,EAAuC,CAAC,KAAM,MAAO,MAAO,KAAK,EAGjEC,EAAsC,CAAC,OAAQ,OAAQ,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"layout.mjs","names":[],"sources":["../../src/constants/layout.ts"],"sourcesContent":["/**\n * The folder-convention vocabulary, in one place.\n *\n * Every name here is part of the authoring contract in\n * docs/extension-layout.md. Adding a surface means adding it to both.\n */\n\n/** Where the scan starts, package-relative. */\nexport const DEFAULT_ROUTING_ROOT = 'src/extensions';\n/** Accepted spelling of the same root, for packages that prefer the singular. */\nexport const ROUTING_ROOT_ALIAS = 'src/extension';\n\n/** Group folders that also select a build side. */\nexport const BACKEND_GROUP = 'backend';\nexport const FRONTEND_GROUP = 'frontend';\n\n/** Scope segments, in nesting order below the routing root. */\nexport const WORKSPACE_SEGMENT = 'workspaces';\nexport const SESSION_SEGMENT = 'sessions';\n\n/** Gate folders. Each is followed by exactly one id segment. */\nexport const GATE_SEGMENTS: readonly string[] = ['mode', 'domain'];\n\n/** The leaf filename of an HTTP route, as Next.js spells it. */\nexport const ROUTE_FILE_NAME = 'route';\n\n/**\n * The reserved filename that constructs a scope, as Next.js spells a layout.\n *\n * One per scope and side. It runs before every contribution beneath it, and\n * whatever it returns is handed to each of them as part of the mount context,\n * which is how a package with one shared per-mount object graph decomposes\n * into a file per surface instead of one closure.\n */\nexport const ROOT_FILE_NAME = 'root';\n\n/**\n * Where generated entries are written, package-relative.\n *\n * Not `src`. That directory is authored code, and a build that writes into it\n * makes every package carry output its author did not write and must not edit.\n * This one is gitignored per package, and the repository's formatter already\n * skips a directory by this name.\n */\nexport const GENERATED_DIR = 'generated';\n\n/**\n * The generated entry each build target writes, keyed by the target it serves.\n *\n * Keyed rather than positional. The basenames are historical and two of the\n * three do not match their target's name, so an array has to be read by index,\n * and adding a fourth generated file silently rotates which host each entry\n * belongs to.\n */\nexport const GENERATED_ENTRY_FILENAMES = { cli: 'pi', server: 'server', web: 'web', mcp: 'mcp' } as const;\n\n/**\n * The generated typed client, which is not a build target.\n *\n * Nothing bundles it as an entry: a `(frontend)` file imports it and the\n * cockpit's browser build pulls it in from there. It is listed among the\n * managed names so that a package which drops its route table has the stale\n * client deleted rather than left behind.\n */\nexport const GENERATED_CLIENT_NAME = 'client';\n\n/**\n * The route table a package authors, and the switch that asks for a client.\n *\n * Its presence is what opts a package in, the way `src/exports/apiContracts.ts`\n * is what asks for a contracts entry. It lives under `src/types` because that\n * is one of the two source roots a browser bundle may read.\n */\nexport const API_ROUTES_MODULE = 'src/types/apiRoutes.ts';\n\n/**\n * Every generated basename. Never scanned, never hand-edited.\n *\n * Spelled out rather than derived from the two declarations above, because a\n * constants module holds data a reader can see without running it. The cost is\n * that the names appear twice; the generate tests assert the two agree.\n */\nexport const GENERATED_ENTRY_NAMES: readonly string[] = ['pi', 'server', 'web', 'mcp', 'client'];\n\n/**\n * Platform suffixes, scoped to their side. A target may not reuse one of these words.\n *\n * Every public routed file names one of these, so which host reads it is read\n * off the filename rather than inferred. A file that names none is a notice.\n *\n * `cli` appears on both sides, because the interactive host has both. Its\n * backend files hold a tool's `execute` and its services; its frontend files\n * hold the TUI that draws them. A terminal is a frontend that happens not to\n * be a browser, which is why the side axis is logic against presentation\n * rather than Node against browser.\n */\nexport const BACKEND_PLATFORMS: readonly string[] = ['cli', 'server', 'mcp'];\nexport const FRONTEND_PLATFORMS: readonly string[] = ['cli', 'web', 'ios', 'android', 'desktop'];\n\n/** The hosts this build emits. A frontend platform outside this set is authorable but unbuildable. */\nexport const BUILD_TARGET_PLATFORMS: readonly string[] = ['cli', 'server', 'web', 'mcp'];\n\n/**\n * Surfaces that produce contributions on the backend side.\n *\n * `mode` is absent on purpose: it is a gate folder, so it is consumed before\n * the surface check and its declaration file synthesises the surface instead.\n */\nexport const BACKEND_SURFACES: readonly string[] = [\n 'tool',\n 'skill',\n 'tool-restriction',\n 'command',\n 'shortcut',\n 'hook',\n 'api',\n 'channel',\n 'method',\n 'provider',\n 'resource',\n];\n\n/**\n * Surfaces that produce contributions on the frontend side.\n *\n * `message` is terminal-only today: the cockpit renders a timeline entry\n * through a tool renderer or a fill, while the TUI has a separate registry\n * keyed by custom message type.\n */\nexport const FRONTEND_SURFACES: readonly string[] = [\n 'tool',\n 'command',\n 'api',\n 'channel',\n 'method',\n 'message',\n 'overlay',\n 'tab',\n 'template',\n 'dock',\n 'setting',\n 'slot',\n 'fill',\n 'action',\n 'store',\n 'activity-group',\n 'leader',\n 'selection-axis',\n 'lifecycle',\n 'file-links',\n 'repository-settings-panel',\n];\n\n/** Surfaces whose filename carries a relationship target. */\nexport const TARGETED_SURFACES: readonly string[] = ['fill', 'action'];\n\n/** Surfaces whose folders below the surface spell a route path. */\nexport const ROUTED_SURFACES: readonly string[] = ['api'];\n\n/** Source extensions the scan accepts. */\nexport const SOURCE_EXTENSIONS: readonly string[] = ['ts', 'tsx', 'mts', 'cts'];\n\n/** Filename infixes excluded everywhere, whatever their position. */\nexport const EXCLUDED_INFIXES: readonly string[] = ['test', 'spec', 'stories'];\n\n/** Marks a folder as organisational: not a path segment, contents still scanned. */\nexport const GROUP_PREFIX = '(';\nexport const GROUP_SUFFIX = ')';\n/** Marks a folder as private: never scanned, never built. */\nexport const PRIVATE_PREFIX = '_';\n/** Marks a folder as a dynamic route segment. */\nexport const DYNAMIC_PREFIX = '[';\nexport const DYNAMIC_SUFFIX = ']';\n/** Marks a dynamic segment as catch-all. */\nexport const CATCH_ALL_MARKER = '...';\n"],"mappings":"AAQA,MAAa,EAAuB,iBAEvB,EAAqB,gBAGrB,EAAgB,UAChB,EAAiB,WAGjB,EAAoB,aACpB,EAAkB,WAGlB,EAAmC,CAAC,OAAQ,QAAQ,EAGpD,EAAkB,QAUlB,EAAiB,OAUjB,EAAgB,YAUhB,EAA4B,CAAE,IAAK,KAAM,OAAQ,SAAU,IAAK,MAAO,IAAK,KAAM,EAUlF,EAAwB,SASxB,EAAoB,yBASpB,EAA2C,CAAC,KAAM,SAAU,MAAO,MAAO,QAAQ,EAclF,EAAuC,CAAC,MAAO,SAAU,KAAK,EAC9D,EAAwC,CAAC,MAAO,MAAO,MAAO,UAAW,SAAS,EAGlF,EAA4C,CAAC,MAAO,SAAU,MAAO,KAAK,EAQ1E,EAAsC,CACjD,OACA,QACA,mBACA,UACA,WACA,OACA,MACA,UACA,SACA,WACA,UACF,EASa,EAAuC,CAClD,OACA,UACA,MACA,UACA,SACA,UACA,UACA,MACA,WACA,OACA,UACA,OACA,OACA,SACA,QACA,iBACA,SACA,iBACA,YACA,aACA,2BACF,EAGa,EAAuC,CAAC,OAAQ,QAAQ,EAGxD,EAAqC,CAAC,KAAK,EAG3C,EAAuC,CAAC,KAAM,MAAO,MAAO,KAAK,EAGjE,EAAsC,CAAC,OAAQ,OAAQ,SAAS"}
1
+ {"version":3,"file":"layout.mjs","names":["DEFAULT_ROUTING_ROOT","ROUTING_ROOT_ALIAS","BACKEND_GROUP","FRONTEND_GROUP","WORKSPACE_SEGMENT","SESSION_SEGMENT","GATE_SEGMENTS","ROUTE_FILE_NAME","ROOT_FILE_NAME","GENERATED_DIR","GENERATED_ENTRY_FILENAMES","GENERATED_CLIENT_NAME","API_ROUTES_MODULE","GENERATED_ENTRY_NAMES","BACKEND_PLATFORMS","FRONTEND_PLATFORMS","BUILD_TARGET_PLATFORMS","BACKEND_SURFACES","FRONTEND_SURFACES","TARGETED_SURFACES","ROUTED_SURFACES","SOURCE_EXTENSIONS","EXCLUDED_INFIXES"],"sources":["../../src/constants/layout.ts"],"sourcesContent":["/**\n * The folder-convention vocabulary, in one place.\n *\n * Every name here is part of the authoring contract in\n * docs/extension-layout.md. Adding a surface means adding it to both.\n */\n\n/** Where the scan starts, package-relative. */\nexport const DEFAULT_ROUTING_ROOT = 'src/extensions';\n/** Accepted spelling of the same root, for packages that prefer the singular. */\nexport const ROUTING_ROOT_ALIAS = 'src/extension';\n\n/** Group folders that also select a build side. */\nexport const BACKEND_GROUP = 'backend';\nexport const FRONTEND_GROUP = 'frontend';\n\n/** Scope segments, in nesting order below the routing root. */\nexport const WORKSPACE_SEGMENT = 'workspaces';\nexport const SESSION_SEGMENT = 'sessions';\n\n/** Gate folders. Each is followed by exactly one id segment. */\nexport const GATE_SEGMENTS: readonly string[] = ['mode', 'domain'];\n\n/** The leaf filename of an HTTP route, as Next.js spells it. */\nexport const ROUTE_FILE_NAME = 'route';\n\n/**\n * The reserved filename that constructs a scope, as Next.js spells a layout.\n *\n * One per scope and side. It runs before every contribution beneath it, and\n * whatever it returns is handed to each of them as part of the mount context,\n * which is how a package with one shared per-mount object graph decomposes\n * into a file per surface instead of one closure.\n */\nexport const ROOT_FILE_NAME = 'root';\n\n/**\n * Where generated entries are written, package-relative.\n *\n * Not `src`. That directory is authored code, and a build that writes into it\n * makes every package carry output its author did not write and must not edit.\n * This one is gitignored per package, and the repository's formatter already\n * skips a directory by this name.\n */\nexport const GENERATED_DIR = 'generated';\n\n/**\n * The generated entry each build target writes, keyed by the target it serves.\n *\n * Keyed rather than positional. The basenames are historical and two of the\n * three do not match their target's name, so an array has to be read by index,\n * and adding a fourth generated file silently rotates which host each entry\n * belongs to.\n */\nexport const GENERATED_ENTRY_FILENAMES = { cli: 'pi', server: 'server', web: 'web', mcp: 'mcp' } as const;\n\n/**\n * The generated typed client, which is not a build target.\n *\n * Nothing bundles it as an entry: a `(frontend)` file imports it and the\n * cockpit's browser build pulls it in from there. It is listed among the\n * managed names so that a package which drops its route table has the stale\n * client deleted rather than left behind.\n */\nexport const GENERATED_CLIENT_NAME = 'client';\n\n/**\n * The route table a package authors, and the switch that asks for a client.\n *\n * Its presence is what opts a package in, the way `src/exports/apiContracts.ts`\n * is what asks for a contracts entry. It lives under `src/types` because that\n * is one of the two source roots a browser bundle may read.\n */\nexport const API_ROUTES_MODULE = 'src/types/apiRoutes.ts';\n\n/**\n * Every generated basename. Never scanned, never hand-edited.\n *\n * Spelled out rather than derived from the two declarations above, because a\n * constants module holds data a reader can see without running it. The cost is\n * that the names appear twice; the generate tests assert the two agree.\n */\nexport const GENERATED_ENTRY_NAMES: readonly string[] = ['pi', 'server', 'web', 'mcp', 'client'];\n\n/**\n * Platform suffixes, scoped to their side. A target may not reuse one of these words.\n *\n * Every public routed file names one of these, so which host reads it is read\n * off the filename rather than inferred. A file that names none is a notice.\n *\n * `cli` appears on both sides, because the interactive host has both. Its\n * backend files hold a tool's `execute` and its services; its frontend files\n * hold the TUI that draws them. A terminal is a frontend that happens not to\n * be a browser, which is why the side axis is logic against presentation\n * rather than Node against browser.\n */\nexport const BACKEND_PLATFORMS: readonly string[] = ['cli', 'server', 'mcp'];\nexport const FRONTEND_PLATFORMS: readonly string[] = ['cli', 'web', 'ios', 'android', 'desktop'];\n\n/** The hosts this build emits. A frontend platform outside this set is authorable but unbuildable. */\nexport const BUILD_TARGET_PLATFORMS: readonly string[] = ['cli', 'server', 'web', 'mcp'];\n\n/**\n * Surfaces that produce contributions on the backend side.\n *\n * `mode` is absent on purpose: it is a gate folder, so it is consumed before\n * the surface check and its declaration file synthesises the surface instead.\n */\nexport const BACKEND_SURFACES: readonly string[] = [\n 'tool',\n 'skill',\n 'tool-restriction',\n 'command',\n 'shortcut',\n 'hook',\n 'api',\n 'channel',\n 'method',\n 'provider',\n 'resource',\n];\n\n/**\n * Surfaces that produce contributions on the frontend side.\n *\n * `message` is terminal-only today: the cockpit renders a timeline entry\n * through a tool renderer or a fill, while the TUI has a separate registry\n * keyed by custom message type.\n */\nexport const FRONTEND_SURFACES: readonly string[] = [\n 'tool',\n 'command',\n 'api',\n 'channel',\n 'method',\n 'message',\n 'overlay',\n 'tab',\n 'template',\n 'dock',\n 'setting',\n 'slot',\n 'fill',\n 'action',\n 'store',\n 'activity-group',\n 'leader',\n 'selection-axis',\n 'lifecycle',\n 'file-links',\n 'repository-settings-panel',\n];\n\n/** Surfaces whose filename carries a relationship target. */\nexport const TARGETED_SURFACES: readonly string[] = ['fill', 'action'];\n\n/** Surfaces whose folders below the surface spell a route path. */\nexport const ROUTED_SURFACES: readonly string[] = ['api'];\n\n/** Source extensions the scan accepts. */\nexport const SOURCE_EXTENSIONS: readonly string[] = ['ts', 'tsx', 'mts', 'cts'];\n\n/** Filename infixes excluded everywhere, whatever their position. */\nexport const EXCLUDED_INFIXES: readonly string[] = ['test', 'spec', 'stories'];\n\n/** Marks a folder as organisational: not a path segment, contents still scanned. */\nexport const GROUP_PREFIX = '(';\nexport const GROUP_SUFFIX = ')';\n/** Marks a folder as private: never scanned, never built. */\nexport const PRIVATE_PREFIX = '_';\n/** Marks a folder as a dynamic route segment. */\nexport const DYNAMIC_PREFIX = '[';\nexport const DYNAMIC_SUFFIX = ']';\n/** Marks a dynamic segment as catch-all. */\nexport const CATCH_ALL_MARKER = '...';\n"],"mappings":"AAQA,MAAaA,EAAuB,iBAEvBC,EAAqB,gBAGrBC,EAAgB,UAChBC,EAAiB,WAGjBC,EAAoB,aACpBC,EAAkB,WAGlBC,EAAmC,CAAC,OAAQ,QAAQ,EAGpDC,EAAkB,QAUlBC,EAAiB,OAUjBC,EAAgB,YAUhBC,EAA4B,CAAE,IAAK,KAAM,OAAQ,SAAU,IAAK,MAAO,IAAK,KAAM,EAUlFC,EAAwB,SASxBC,EAAoB,yBASpBC,EAA2C,CAAC,KAAM,SAAU,MAAO,MAAO,QAAQ,EAclFC,EAAuC,CAAC,MAAO,SAAU,KAAK,EAC9DC,EAAwC,CAAC,MAAO,MAAO,MAAO,UAAW,SAAS,EAGlFC,EAA4C,CAAC,MAAO,SAAU,MAAO,KAAK,EAQ1EC,EAAsC,CACjD,OACA,QACA,mBACA,UACA,WACA,OACA,MACA,UACA,SACA,WACA,UACF,EASaC,EAAuC,CAClD,OACA,UACA,MACA,UACA,SACA,UACA,UACA,MACA,WACA,OACA,UACA,OACA,OACA,SACA,QACA,iBACA,SACA,iBACA,YACA,aACA,2BACF,EAGaC,EAAuC,CAAC,OAAQ,QAAQ,EAGxDC,EAAqC,CAAC,KAAK,EAG3CC,EAAuC,CAAC,KAAM,MAAO,MAAO,KAAK,EAGjEC,EAAsC,CAAC,OAAQ,OAAQ,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["CLI_FRONTEND_FIELDS","WEB_FIELDS","DEFAULT_ROUTING_ROOT","ROUTING_ROOT_ALIAS","classifySegment","GATE_SEGMENTS","parseFilename","FRONTEND_PLATFORMS"],"sources":["../../../src/services/browserFile/index.ts"],"sourcesContent":["import { CLI_FRONTEND_FIELDS, WEB_FIELDS } from '../../constants/contributions';\nimport {\n BACKEND_GROUP,\n DEFAULT_ROUTING_ROOT,\n FRONTEND_GROUP,\n FRONTEND_PLATFORMS,\n GATE_SEGMENTS,\n ROUTING_ROOT_ALIAS,\n} from '../../constants/layout';\nimport { parseFilename } from '../filename';\nimport { classifySegment } from '../segments';\n\n/** The frontend platform that draws in a terminal rather than a browser. */\nconst TERMINAL_PLATFORM = 'cli';\n\n/**\n * Frontend surfaces the terminal owns outright.\n *\n * Derived from the two frontend tables rather than listed, so a surface the\n * cockpit gains later stops counting as terminal-only the moment `WEB_FIELDS`\n * names it. Today that is `overlay` and `message`.\n */\nconst TERMINAL_ONLY_SURFACES: readonly string[] = Object.keys(CLI_FRONTEND_FIELDS).filter(\n (surface) => !(surface in WEB_FIELDS),\n);\n\n/** The segments below the routing root, or undefined when the path is not routed. */\nfunction routedSegments(relativePath: string): readonly string[] | undefined {\n for (const root of [DEFAULT_ROUTING_ROOT, ROUTING_ROOT_ALIAS]) {\n if (relativePath.startsWith(`${root}/`)) return relativePath.slice(root.length + 1).split('/');\n }\n return undefined;\n}\n\n/**\n * Whether a package-relative path holds code the cockpit bundles.\n *\n * Browser-bound is narrower than `(frontend)`. That side carries both\n * presentations, and the terminal's half legitimately imports src/services and\n * pi-tui, so treating the whole side as browser would reject every one of those\n * imports. Two things separate the halves, in this order:\n *\n * - a surface the CLI frontend table names and the web table does not is\n * terminal-only, whatever the filename says;\n * - on a surface both hosts share, the platform in the filename decides, which\n * is what tells `tool/x.cli.tsx` from `tool/x.web.tsx`.\n *\n * Everything else under `(frontend)` is browser, including the private folders\n * colocated beside a surface, and a private folder at the side root, which\n * names no surface to read.\n *\n * That default is why a private terminal helper carries `.cli` even though the\n * scan never routes it: on a shared surface such as `tool/`, the folder says\n * nothing about which host draws the file, so `_lib/bashRender.cli.ts` is the\n * only thing distinguishing a TUI renderer from a cockpit one sitting beside it.\n *\n * Path in, answer out: nothing here reads the file or the filesystem.\n */\nexport function isBrowserFile(relativePath: string): boolean {\n const segments = routedSegments(relativePath);\n if (segments === undefined) return false;\n\n const fileName = segments[segments.length - 1];\n if (fileName === undefined) return false;\n const folders = segments.slice(0, -1);\n let index = 0;\n\n // The first side group decides the side, the way the scan reads it.\n let side: string | undefined;\n while (index < folders.length && side === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'group') continue;\n if (segment.name === BACKEND_GROUP || segment.name === FRONTEND_GROUP) side = segment.name;\n }\n if (side !== FRONTEND_GROUP) return false;\n\n // The surface is the first named segment below the side. Groups and private\n // folders are transparent, and a gate folder takes its id segment with it.\n let surface: string | undefined;\n while (index < folders.length && surface === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'plain') continue;\n if (GATE_SEGMENTS.includes(segment.name)) index += 1;\n else surface = segment.name;\n }\n if (surface !== undefined && TERMINAL_ONLY_SURFACES.includes(surface)) return false;\n\n return parseFilename(fileName, FRONTEND_PLATFORMS)?.platform !== TERMINAL_PLATFORM;\n}\n"],"mappings":"mKAsBM,EAA4C,OAAO,KAAKA,EAAAA,mBAAmB,CAAC,CAAC,OAChF,GAAY,EAAE,KAAWC,EAAAA,WAC5B,EAGA,SAAS,EAAe,EAAqD,CAC3E,IAAK,IAAM,IAAQ,CAACC,EAAAA,qBAAsBC,EAAAA,kBAAkB,EAC1D,GAAI,EAAa,WAAW,GAAG,EAAK,EAAE,EAAG,OAAO,EAAa,MAAM,EAAK,OAAS,CAAC,CAAC,CAAC,MAAM,GAAG,CAGjG,CA0BA,SAAgB,EAAc,EAA+B,CAC3D,IAAM,EAAW,EAAe,CAAY,EAC5C,GAAI,IAAa,IAAA,GAAW,MAAO,GAEnC,IAAM,EAAW,EAAS,EAAS,OAAS,GAC5C,GAAI,IAAa,IAAA,GAAW,MAAO,GACnC,IAAM,EAAU,EAAS,MAAM,EAAG,EAAE,EAChC,EAAQ,EAGR,EACJ,KAAO,EAAQ,EAAQ,QAAU,IAAS,IAAA,IAAW,CACnD,IAAM,EAAUC,EAAAA,gBAAgB,EAAQ,EAAM,EAC9C,GAAS,EACL,EAAQ,OAAS,UACjB,EAAQ,OAAA,WAA0B,EAAQ,OAAA,cAAyB,EAAO,EAAQ,KACxF,CACA,GAAI,IAAA,WAAyB,MAAO,GAIpC,IAAI,EACJ,KAAO,EAAQ,EAAQ,QAAU,IAAY,IAAA,IAAW,CACtD,IAAM,EAAUA,EAAAA,gBAAgB,EAAQ,EAAM,EAC9C,GAAS,EACL,EAAQ,OAAS,UACjBC,EAAAA,cAAc,SAAS,EAAQ,IAAI,EAAG,GAAS,EAC9C,EAAU,EAAQ,KACzB,CAGA,OAFI,IAAY,IAAA,IAAa,EAAuB,SAAS,CAAO,EAAU,GAEvEC,EAAAA,cAAc,EAAUC,EAAAA,kBAAkB,CAAC,EAAE,WAAa,KACnE"}
1
+ {"version":3,"file":"index.cjs","names":["CLI_FRONTEND_FIELDS","WEB_FIELDS","DEFAULT_ROUTING_ROOT","ROUTING_ROOT_ALIAS","classifySegment","GATE_SEGMENTS","parseFilename","FRONTEND_PLATFORMS","require_contributions","require_layout","require_index","require_index$1","TERMINAL_ONLY_SURFACES","surface","routedSegments","root","relativePath","isBrowserFile","segments","fileName","folders","index","side","segment"],"sources":["../../../src/services/browserFile/index.ts"],"sourcesContent":["import { CLI_FRONTEND_FIELDS, WEB_FIELDS } from '../../constants/contributions';\nimport {\n BACKEND_GROUP,\n DEFAULT_ROUTING_ROOT,\n FRONTEND_GROUP,\n FRONTEND_PLATFORMS,\n GATE_SEGMENTS,\n ROUTING_ROOT_ALIAS,\n} from '../../constants/layout';\nimport { parseFilename } from '../filename';\nimport { classifySegment } from '../segments';\n\n/** The frontend platform that draws in a terminal rather than a browser. */\nconst TERMINAL_PLATFORM = 'cli';\n\n/**\n * Frontend surfaces the terminal owns outright.\n *\n * Derived from the two frontend tables rather than listed, so a surface the\n * cockpit gains later stops counting as terminal-only the moment `WEB_FIELDS`\n * names it. Today that is `overlay` and `message`.\n */\nconst TERMINAL_ONLY_SURFACES: readonly string[] = Object.keys(CLI_FRONTEND_FIELDS).filter(\n (surface) => !(surface in WEB_FIELDS),\n);\n\n/** The segments below the routing root, or undefined when the path is not routed. */\nfunction routedSegments(relativePath: string): readonly string[] | undefined {\n for (const root of [DEFAULT_ROUTING_ROOT, ROUTING_ROOT_ALIAS]) {\n if (relativePath.startsWith(`${root}/`)) return relativePath.slice(root.length + 1).split('/');\n }\n return undefined;\n}\n\n/**\n * Whether a package-relative path holds code the cockpit bundles.\n *\n * Browser-bound is narrower than `(frontend)`. That side carries both\n * presentations, and the terminal's half legitimately imports src/services and\n * pi-tui, so treating the whole side as browser would reject every one of those\n * imports. Two things separate the halves, in this order:\n *\n * - a surface the CLI frontend table names and the web table does not is\n * terminal-only, whatever the filename says;\n * - on a surface both hosts share, the platform in the filename decides, which\n * is what tells `tool/x.cli.tsx` from `tool/x.web.tsx`.\n *\n * Everything else under `(frontend)` is browser, including the private folders\n * colocated beside a surface, and a private folder at the side root, which\n * names no surface to read.\n *\n * That default is why a private terminal helper carries `.cli` even though the\n * scan never routes it: on a shared surface such as `tool/`, the folder says\n * nothing about which host draws the file, so `_lib/bashRender.cli.ts` is the\n * only thing distinguishing a TUI renderer from a cockpit one sitting beside it.\n *\n * Path in, answer out: nothing here reads the file or the filesystem.\n */\nexport function isBrowserFile(relativePath: string): boolean {\n const segments = routedSegments(relativePath);\n if (segments === undefined) return false;\n\n const fileName = segments[segments.length - 1];\n if (fileName === undefined) return false;\n const folders = segments.slice(0, -1);\n let index = 0;\n\n // The first side group decides the side, the way the scan reads it.\n let side: string | undefined;\n while (index < folders.length && side === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'group') continue;\n if (segment.name === BACKEND_GROUP || segment.name === FRONTEND_GROUP) side = segment.name;\n }\n if (side !== FRONTEND_GROUP) return false;\n\n // The surface is the first named segment below the side. Groups and private\n // folders are transparent, and a gate folder takes its id segment with it.\n let surface: string | undefined;\n while (index < folders.length && surface === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'plain') continue;\n if (GATE_SEGMENTS.includes(segment.name)) index += 1;\n else surface = segment.name;\n }\n if (surface !== undefined && TERMINAL_ONL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AkB,CAAC,EAAE,WAAa,KACnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/browserFile/index.ts"],"sourcesContent":["import { CLI_FRONTEND_FIELDS, WEB_FIELDS } from '../../constants/contributions';\nimport {\n BACKEND_GROUP,\n DEFAULT_ROUTING_ROOT,\n FRONTEND_GROUP,\n FRONTEND_PLATFORMS,\n GATE_SEGMENTS,\n ROUTING_ROOT_ALIAS,\n} from '../../constants/layout';\nimport { parseFilename } from '../filename';\nimport { classifySegment } from '../segments';\n\n/** The frontend platform that draws in a terminal rather than a browser. */\nconst TERMINAL_PLATFORM = 'cli';\n\n/**\n * Frontend surfaces the terminal owns outright.\n *\n * Derived from the two frontend tables rather than listed, so a surface the\n * cockpit gains later stops counting as terminal-only the moment `WEB_FIELDS`\n * names it. Today that is `overlay` and `message`.\n */\nconst TERMINAL_ONLY_SURFACES: readonly string[] = Object.keys(CLI_FRONTEND_FIELDS).filter(\n (surface) => !(surface in WEB_FIELDS),\n);\n\n/** The segments below the routing root, or undefined when the path is not routed. */\nfunction routedSegments(relativePath: string): readonly string[] | undefined {\n for (const root of [DEFAULT_ROUTING_ROOT, ROUTING_ROOT_ALIAS]) {\n if (relativePath.startsWith(`${root}/`)) return relativePath.slice(root.length + 1).split('/');\n }\n return undefined;\n}\n\n/**\n * Whether a package-relative path holds code the cockpit bundles.\n *\n * Browser-bound is narrower than `(frontend)`. That side carries both\n * presentations, and the terminal's half legitimately imports src/services and\n * pi-tui, so treating the whole side as browser would reject every one of those\n * imports. Two things separate the halves, in this order:\n *\n * - a surface the CLI frontend table names and the web table does not is\n * terminal-only, whatever the filename says;\n * - on a surface both hosts share, the platform in the filename decides, which\n * is what tells `tool/x.cli.tsx` from `tool/x.web.tsx`.\n *\n * Everything else under `(frontend)` is browser, including the private folders\n * colocated beside a surface, and a private folder at the side root, which\n * names no surface to read.\n *\n * That default is why a private terminal helper carries `.cli` even though the\n * scan never routes it: on a shared surface such as `tool/`, the folder says\n * nothing about which host draws the file, so `_lib/bashRender.cli.ts` is the\n * only thing distinguishing a TUI renderer from a cockpit one sitting beside it.\n *\n * Path in, answer out: nothing here reads the file or the filesystem.\n */\nexport function isBrowserFile(relativePath: string): boolean {\n const segments = routedSegments(relativePath);\n if (segments === undefined) return false;\n\n const fileName = segments[segments.length - 1];\n if (fileName === undefined) return false;\n const folders = segments.slice(0, -1);\n let index = 0;\n\n // The first side group decides the side, the way the scan reads it.\n let side: string | undefined;\n while (index < folders.length && side === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'group') continue;\n if (segment.name === BACKEND_GROUP || segment.name === FRONTEND_GROUP) side = segment.name;\n }\n if (side !== FRONTEND_GROUP) return false;\n\n // The surface is the first named segment below the side. Groups and private\n // folders are transparent, and a gate folder takes its id segment with it.\n let surface: string | undefined;\n while (index < folders.length && surface === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'plain') continue;\n if (GATE_SEGMENTS.includes(segment.name)) index += 1;\n else surface = segment.name;\n }\n if (surface !== undefined && TERMINAL_ONLY_SURFACES.includes(surface)) return false;\n\n return parseFilename(fileName, FRONTEND_PLATFORMS)?.platform !== TERMINAL_PLATFORM;\n}\n"],"mappings":"2UAaA,MASM,EAA4C,OAAO,KAAK,CAAmB,CAAC,CAAC,OAChF,GAAY,EAAE,KAAW,EAC5B,EAGA,SAAS,EAAe,EAAqD,CAC3E,IAAK,IAAM,IAAQ,CAAC,EAAsB,CAAkB,EAC1D,GAAI,EAAa,WAAW,GAAG,EAAK,EAAE,EAAG,OAAO,EAAa,MAAM,EAAK,OAAS,CAAC,CAAC,CAAC,MAAM,GAAG,CAGjG,CA0BA,SAAgB,EAAc,EAA+B,CAC3D,IAAM,EAAW,EAAe,CAAY,EAC5C,GAAI,IAAa,IAAA,GAAW,MAAO,GAEnC,IAAM,EAAW,EAAS,EAAS,OAAS,GAC5C,GAAI,IAAa,IAAA,GAAW,MAAO,GACnC,IAAM,EAAU,EAAS,MAAM,EAAG,EAAE,EAChC,EAAQ,EAGR,EACJ,KAAO,EAAQ,EAAQ,QAAU,IAAS,IAAA,IAAW,CACnD,IAAM,EAAU,EAAgB,EAAQ,EAAM,EAC9C,GAAS,EACL,EAAQ,OAAS,UACjB,EAAQ,OAAA,WAA0B,EAAQ,OAAA,cAAyB,EAAO,EAAQ,KACxF,CACA,GAAI,IAAA,WAAyB,MAAO,GAIpC,IAAI,EACJ,KAAO,EAAQ,EAAQ,QAAU,IAAY,IAAA,IAAW,CACtD,IAAM,EAAU,EAAgB,EAAQ,EAAM,EAC9C,GAAS,EACL,EAAQ,OAAS,UACjB,EAAc,SAAS,EAAQ,IAAI,EAAG,GAAS,EAC9C,EAAU,EAAQ,KACzB,CAGA,OAFI,IAAY,IAAA,IAAa,EAAuB,SAAS,CAAO,EAAU,GAEvE,EAAc,EAAU,CAAkB,CAAC,EAAE,WAAa,KACnE"}
1
+ {"version":3,"file":"index.mjs","names":["TERMINAL_ONLY_SURFACES","CLI_FRONTEND_FIELDS","surface","WEB_FIELDS","routedSegments","root","DEFAULT_ROUTING_ROOT","ROUTING_ROOT_ALIAS","relativePath","isBrowserFile","segments","fileName","folders","index","side","segment","classifySegment","GATE_SEGMENTS","parseFilename","FRONTEND_PLATFORMS"],"sources":["../../../src/services/browserFile/index.ts"],"sourcesContent":["import { CLI_FRONTEND_FIELDS, WEB_FIELDS } from '../../constants/contributions';\nimport {\n BACKEND_GROUP,\n DEFAULT_ROUTING_ROOT,\n FRONTEND_GROUP,\n FRONTEND_PLATFORMS,\n GATE_SEGMENTS,\n ROUTING_ROOT_ALIAS,\n} from '../../constants/layout';\nimport { parseFilename } from '../filename';\nimport { classifySegment } from '../segments';\n\n/** The frontend platform that draws in a terminal rather than a browser. */\nconst TERMINAL_PLATFORM = 'cli';\n\n/**\n * Frontend surfaces the terminal owns outright.\n *\n * Derived from the two frontend tables rather than listed, so a surface the\n * cockpit gains later stops counting as terminal-only the moment `WEB_FIELDS`\n * names it. Today that is `overlay` and `message`.\n */\nconst TERMINAL_ONLY_SURFACES: readonly string[] = Object.keys(CLI_FRONTEND_FIELDS).filter(\n (surface) => !(surface in WEB_FIELDS),\n);\n\n/** The segments below the routing root, or undefined when the path is not routed. */\nfunction routedSegments(relativePath: string): readonly string[] | undefined {\n for (const root of [DEFAULT_ROUTING_ROOT, ROUTING_ROOT_ALIAS]) {\n if (relativePath.startsWith(`${root}/`)) return relativePath.slice(root.length + 1).split('/');\n }\n return undefined;\n}\n\n/**\n * Whether a package-relative path holds code the cockpit bundles.\n *\n * Browser-bound is narrower than `(frontend)`. That side carries both\n * presentations, and the terminal's half legitimately imports src/services and\n * pi-tui, so treating the whole side as browser would reject every one of those\n * imports. Two things separate the halves, in this order:\n *\n * - a surface the CLI frontend table names and the web table does not is\n * terminal-only, whatever the filename says;\n * - on a surface both hosts share, the platform in the filename decides, which\n * is what tells `tool/x.cli.tsx` from `tool/x.web.tsx`.\n *\n * Everything else under `(frontend)` is browser, including the private folders\n * colocated beside a surface, and a private folder at the side root, which\n * names no surface to read.\n *\n * That default is why a private terminal helper carries `.cli` even though the\n * scan never routes it: on a shared surface such as `tool/`, the folder says\n * nothing about which host draws the file, so `_lib/bashRender.cli.ts` is the\n * only thing distinguishing a TUI renderer from a cockpit one sitting beside it.\n *\n * Path in, answer out: nothing here reads the file or the filesystem.\n */\nexport function isBrowserFile(relativePath: string): boolean {\n const segments = routedSegments(relativePath);\n if (segments === undefined) return false;\n\n const fileName = segments[segments.length - 1];\n if (fileName === undefined) return false;\n const folders = segments.slice(0, -1);\n let index = 0;\n\n // The first side group decides the side, the way the scan reads it.\n let side: string | undefined;\n while (index < folders.length && side === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'group') continue;\n if (segment.name === BACKEND_GROUP || segment.name === FRONTEND_GROUP) side = segment.name;\n }\n if (side !== FRONTEND_GROUP) return false;\n\n // The surface is the first named segment below the side. Groups and private\n // folders are transparent, and a gate folder takes its id segment with it.\n let surface: string | undefined;\n while (index < folders.length && surface === undefined) {\n const segment = classifySegment(folders[index]);\n index += 1;\n if (segment.kind !== 'plain') continue;\n if (GATE_SEGMENTS.includes(segment.name)) index += 1;\n else surface = segment.name;\n }\n if (surface !== undefined && TERMINAL_ONLY_SURFACES.includes(surface)) return false;\n\n return parseFilename(fileName, FRONTEND_PLATFORMS)?.platform !== TERMINAL_PLATFORM;\n}\n"],"mappings":"2UAaA,MASMA,EAA4C,OAAO,KAAKC,CAAmB,CAAC,CAAC,OAChF,GAAY,EAAEC,KAAWC,EAC5B,EAGA,SAASC,EAAe,EAAqD,CAC3E,IAAK,IAAMC,IAAQ,CAACC,EAAsBC,CAAkB,EAC1D,GAAIC,EAAa,WAAW,GAAGH,EAAK,EAAE,EAAG,OAAOG,EAAa,MAAMH,EAAK,OAAS,CAAC,CAAC,CAAC,MAAM,GAAG,CAGjG,CA0BA,SAAgBI,EAAc,EAA+B,CAC3D,IAAMC,EAAWN,EAAeI,CAAY,EAC5C,GAAIE,IAAa,IAAA,GAAW,MAAO,GAEnC,IAAMC,EAAWD,EAASA,EAAS,OAAS,GAC5C,GAAIC,IAAa,IAAA,GAAW,MAAO,GACnC,IAAMC,EAAUF,EAAS,MAAM,EAAG,EAAE,EAChCG,EAAQ,EAGRC,EACJ,KAAOD,EAAQD,EAAQ,QAAUE,IAAS,IAAA,IAAW,CACnD,IAAMC,EAAUC,EAAgBJ,EAAQC,EAAM,EAC9C,GAAS,EACLE,EAAQ,OAAS,UACjBA,EAAQ,OAAA,WAA0BA,EAAQ,OAAA,cAAyB,EAAOA,EAAQ,KACxF,CACA,GAAID,IAAA,WAAyB,MAAO,GAIpC,IAAIZ,EACJ,KAAOW,EAAQD,EAAQ,QAAUV,IAAY,IAAA,IAAW,CACtD,IAAMa,EAAUC,EAAgBJ,EAAQC,EAAM,EAC9C,GAAS,EACLE,EAAQ,OAAS,UACjBE,EAAc,SAASF,EAAQ,IAAI,EAAG,GAAS,EAC9C,EAAUA,EAAQ,KACzB,CAGA,OAFIb,IAAY,IAAA,IAAaF,EAAuB,SAASE,CAAO,EAAU,GAEvEgB,EAAcP,EAAUQ,CAAkB,CAAC,EAAE,WAAa,KACnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["SOURCE_EXTENSIONS","EXCLUDED_INFIXES"],"sources":["../../../src/services/filename/index.ts"],"sourcesContent":["import { EXCLUDED_INFIXES, SOURCE_EXTENSIONS } from '../../constants/layout';\n\n/** One filename split into the four things the grammar encodes. */\nexport interface ParsedFilename {\n /** The contribution's identity. */\n readonly name: string;\n /** The relationship target, such as the slot a fill names. */\n readonly target: string | undefined;\n /** The platform this file serves, or undefined when the filename names none. */\n readonly platform: string | undefined;\n readonly extension: string;\n}\n\n/**\n * Parses `{name}[.{target}][.{platform}].{ext}`.\n *\n * Right to left, because the platform set is closed and the target is not: a\n * dotted slot name such as `task.detail` would otherwise be ambiguous. A file\n * whose extension is not a source extension, or that carries an excluded\n * infix, returns undefined rather than an entry the caller has to filter.\n *\n * The one word a target may not be is a platform name for its own side, since\n * the last segment is read as a platform whenever it matches.\n *\n * A filename that names no platform still parses, with `platform: undefined`.\n * Requiring one is the scan's job, since only the scan knows whether the file\n * is public: a private `_lib` helper and an `api/` route sibling name none.\n */\nexport function parseFilename(fileName: string, platforms: readonly string[]): ParsedFilename | undefined {\n const lastDot = fileName.lastIndexOf('.');\n if (lastDot <= 0) return undefined;\n\n const extension = fileName.slice(lastDot + 1);\n if (!SOURCE_EXTENSIONS.includes(extension)) return undefined;\n\n const parts = fileName.slice(0, lastDot).split('.');\n const [name, ...rest] = parts;\n if (name === undefined || name === '') return undefined;\n if (parts.some((part) => EXCLUDED_INFIXES.includes(part))) return undefined;\n\n const last = rest[rest.length - 1];\n const platform = last !== undefined && platforms.includes(last) ? rest.pop() : undefined;\n\n return { name, target: rest.length > 0 ? rest.join('.') : undefined, platform, extension };\n}\n"],"mappings":"8CA4BA,SAAgB,EAAc,EAAkB,EAA0D,CACxG,IAAM,EAAU,EAAS,YAAY,GAAG,EACxC,GAAI,GAAW,EAAG,OAElB,IAAM,EAAY,EAAS,MAAM,EAAU,CAAC,EAC5C,GAAI,CAACA,EAAAA,kBAAkB,SAAS,CAAS,EAAG,OAE5C,IAAM,EAAQ,EAAS,MAAM,EAAG,CAAO,CAAC,CAAC,MAAM,GAAG,EAC5C,CAAC,EAAM,GAAG,GAAQ,EAExB,GADI,IAAS,IAAA,IAAa,IAAS,IAC/B,EAAM,KAAM,GAASC,EAAAA,iBAAiB,SAAS,CAAI,CAAC,EAAG,OAE3D,IAAM,EAAO,EAAK,EAAK,OAAS,GAC1B,EAAW,IAAS,IAAA,IAAa,EAAU,SAAS,CAAI,EAAI,EAAK,IAAI,EAAI,IAAA,GAE/E,MAAO,CAAE,OAAM,OAAQ,EAAK,OAAS,EAAI,EAAK,KAAK,GAAG,EAAI,IAAA,GAAW,WAAU,WAAU,CAC3F"}
1
+ {"version":3,"file":"index.cjs","names":["SOURCE_EXTENSIONS","EXCLUDED_INFIXES","require_layout","parseFilename","lastDot","fileName","extension","parts","name","rest","part","last","platform","platforms"],"sources":["../../../src/services/filename/index.ts"],"sourcesContent":["import { EXCLUDED_INFIXES, SOURCE_EXTENSIONS } from '../../constants/layout';\n\n/** One filename split into the four things the grammar encodes. */\nexport interface ParsedFilename {\n /** The contribution's identity. */\n readonly name: string;\n /** The relationship target, such as the slot a fill names. */\n readonly target: string | undefined;\n /** The platform this file serves, or undefined when the filename names none. */\n readonly platform: string | undefined;\n readonly extension: string;\n}\n\n/**\n * Parses `{name}[.{target}][.{platform}].{ext}`.\n *\n * Right to left, because the platform set is closed and the target is not: a\n * dotted slot name such as `task.detail` would otherwise be ambiguous. A file\n * whose extension is not a source extension, or that carries an excluded\n * infix, returns undefined rather than an entry the caller has to filter.\n *\n * The one word a target may not be is a platform name for its own side, since\n * the last segment is read as a platform whenever it matches.\n *\n * A filename that names no platform still parses, with `platform: undefined`.\n * Requiring one is the scan's job, since only the scan knows whether the file\n * is public: a private `_lib` helper and an `api/` route sibling name none.\n */\nexport function parseFilename(fileName: string, platforms: readonly string[]): ParsedFilename | undefined {\n const lastDot = fileName.lastIndexOf('.');\n if (lastDot <= 0) return undefined;\n\n const extension = fileName.slice(lastDot + 1);\n if (!SOURCE_EXTENSIONS.includes(extension)) return undefined;\n\n const parts = fileName.slice(0, lastDot).split('.');\n const [name, ...rest] = parts;\n if (name === undefined || name === '') return undefined;\n if (parts.some((part) => EXCLUDED_INFIXES.includes(part))) return undefined;\n\n const last = rest[rest.length - 1];\n const platform = last !== undefined && platforms.includes(last) ? rest.pop() : undefined;\n\n return { name, target: rest.length > 0 ? rest.join('.') : undefined, platform, extension };\n}\n"],"mappings":"8CA4BA,SAAgBG,EAAc,EAAkB,EAA0D,CACxG,IAAMC,EAAUC,EAAS,YAAY,GAAG,EACxC,GAAID,GAAW,EAAG,OAElB,IAAME,EAAYD,EAAS,MAAMD,EAAU,CAAC,EAC5C,GAAI,CAACJ,EAAAA,kBAAkB,SAASM,CAAS,EAAG,OAE5C,IAAMC,EAAQF,EAAS,MAAM,EAAGD,CAAO,CAAC,CAAC,MAAM,GAAG,EAC5C,CAACI,EAAM,GAAGC,GAAQF,EAExB,GADIC,IAAS,IAAA,IAAaA,IAAS,IAC/BD,EAAM,KAAM,GAASN,EAAAA,iBAAiB,SAASS,CAAI,CAAC,EAAG,OAE3D,IAAMC,EAAOF,EAAKA,EAAK,OAAS,GAC1BG,EAAWD,IAAS,IAAA,IAAaE,EAAU,SAASF,CAAI,EAAIF,EAAK,IAAI,EAAI,IAAA,GAE/E,MAAO,CAAE,OAAM,OAAQA,EAAK,OAAS,EAAIA,EAAK,KAAK,GAAG,EAAI,IAAA,GAAW,WAAU,WAAU,CAC3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/filename/index.ts"],"sourcesContent":["import { EXCLUDED_INFIXES, SOURCE_EXTENSIONS } from '../../constants/layout';\n\n/** One filename split into the four things the grammar encodes. */\nexport interface ParsedFilename {\n /** The contribution's identity. */\n readonly name: string;\n /** The relationship target, such as the slot a fill names. */\n readonly target: string | undefined;\n /** The platform this file serves, or undefined when the filename names none. */\n readonly platform: string | undefined;\n readonly extension: string;\n}\n\n/**\n * Parses `{name}[.{target}][.{platform}].{ext}`.\n *\n * Right to left, because the platform set is closed and the target is not: a\n * dotted slot name such as `task.detail` would otherwise be ambiguous. A file\n * whose extension is not a source extension, or that carries an excluded\n * infix, returns undefined rather than an entry the caller has to filter.\n *\n * The one word a target may not be is a platform name for its own side, since\n * the last segment is read as a platform whenever it matches.\n *\n * A filename that names no platform still parses, with `platform: undefined`.\n * Requiring one is the scan's job, since only the scan knows whether the file\n * is public: a private `_lib` helper and an `api/` route sibling name none.\n */\nexport function parseFilename(fileName: string, platforms: readonly string[]): ParsedFilename | undefined {\n const lastDot = fileName.lastIndexOf('.');\n if (lastDot <= 0) return undefined;\n\n const extension = fileName.slice(lastDot + 1);\n if (!SOURCE_EXTENSIONS.includes(extension)) return undefined;\n\n const parts = fileName.slice(0, lastDot).split('.');\n const [name, ...rest] = parts;\n if (name === undefined || name === '') return undefined;\n if (parts.some((part) => EXCLUDED_INFIXES.includes(part))) return undefined;\n\n const last = rest[rest.length - 1];\n const platform = last !== undefined && platforms.includes(last) ? rest.pop() : undefined;\n\n return { name, target: rest.length > 0 ? rest.join('.') : undefined, platform, extension };\n}\n"],"mappings":"qFA4BA,SAAgB,EAAc,EAAkB,EAA0D,CACxG,IAAM,EAAU,EAAS,YAAY,GAAG,EACxC,GAAI,GAAW,EAAG,OAElB,IAAM,EAAY,EAAS,MAAM,EAAU,CAAC,EAC5C,GAAI,CAAC,EAAkB,SAAS,CAAS,EAAG,OAE5C,IAAM,EAAQ,EAAS,MAAM,EAAG,CAAO,CAAC,CAAC,MAAM,GAAG,EAC5C,CAAC,EAAM,GAAG,GAAQ,EAExB,GADI,IAAS,IAAA,IAAa,IAAS,IAC/B,EAAM,KAAM,GAAS,EAAiB,SAAS,CAAI,CAAC,EAAG,OAE3D,IAAM,EAAO,EAAK,EAAK,OAAS,GAC1B,EAAW,IAAS,IAAA,IAAa,EAAU,SAAS,CAAI,EAAI,EAAK,IAAI,EAAI,IAAA,GAE/E,MAAO,CAAE,OAAM,OAAQ,EAAK,OAAS,EAAI,EAAK,KAAK,GAAG,EAAI,IAAA,GAAW,WAAU,WAAU,CAC3F"}
1
+ {"version":3,"file":"index.mjs","names":["parseFilename","lastDot","fileName","extension","SOURCE_EXTENSIONS","parts","name","rest","EXCLUDED_INFIXES","part","last","platform","platforms"],"sources":["../../../src/services/filename/index.ts"],"sourcesContent":["import { EXCLUDED_INFIXES, SOURCE_EXTENSIONS } from '../../constants/layout';\n\n/** One filename split into the four things the grammar encodes. */\nexport interface ParsedFilename {\n /** The contribution's identity. */\n readonly name: string;\n /** The relationship target, such as the slot a fill names. */\n readonly target: string | undefined;\n /** The platform this file serves, or undefined when the filename names none. */\n readonly platform: string | undefined;\n readonly extension: string;\n}\n\n/**\n * Parses `{name}[.{target}][.{platform}].{ext}`.\n *\n * Right to left, because the platform set is closed and the target is not: a\n * dotted slot name such as `task.detail` would otherwise be ambiguous. A file\n * whose extension is not a source extension, or that carries an excluded\n * infix, returns undefined rather than an entry the caller has to filter.\n *\n * The one word a target may not be is a platform name for its own side, since\n * the last segment is read as a platform whenever it matches.\n *\n * A filename that names no platform still parses, with `platform: undefined`.\n * Requiring one is the scan's job, since only the scan knows whether the file\n * is public: a private `_lib` helper and an `api/` route sibling name none.\n */\nexport function parseFilename(fileName: string, platforms: readonly string[]): ParsedFilename | undefined {\n const lastDot = fileName.lastIndexOf('.');\n if (lastDot <= 0) return undefined;\n\n const extension = fileName.slice(lastDot + 1);\n if (!SOURCE_EXTENSIONS.includes(extension)) return undefined;\n\n const parts = fileName.slice(0, lastDot).split('.');\n const [name, ...rest] = parts;\n if (name === undefined || name === '') return undefined;\n if (parts.some((part) => EXCLUDED_INFIXES.includes(part))) return undefined;\n\n const last = rest[rest.length - 1];\n const platform = last !== undefined && platforms.includes(last) ? rest.pop() : undefined;\n\n return { name, target: rest.length > 0 ? rest.join('.') : undefined, platform, extension };\n}\n"],"mappings":"qFA4BA,SAAgBA,EAAc,EAAkB,EAA0D,CACxG,IAAMC,EAAUC,EAAS,YAAY,GAAG,EACxC,GAAID,GAAW,EAAG,OAElB,IAAME,EAAYD,EAAS,MAAMD,EAAU,CAAC,EAC5C,GAAI,CAACG,EAAkB,SAASD,CAAS,EAAG,OAE5C,IAAME,EAAQH,EAAS,MAAM,EAAGD,CAAO,CAAC,CAAC,MAAM,GAAG,EAC5C,CAACK,EAAM,GAAGC,GAAQF,EAExB,GADIC,IAAS,IAAA,IAAaA,IAAS,IAC/BD,EAAM,KAAM,GAASG,EAAiB,SAASC,CAAI,CAAC,EAAG,OAE3D,IAAMC,EAAOH,EAAKA,EAAK,OAAS,GAC1BI,EAAWD,IAAS,IAAA,IAAaE,EAAU,SAASF,CAAI,EAAIH,EAAK,IAAI,EAAI,IAAA,GAE/E,MAAO,CAAE,OAAM,OAAQA,EAAK,OAAS,EAAIA,EAAK,KAAK,GAAG,EAAI,IAAA,GAAW,WAAU,WAAU,CAC3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["fs","path","renderCliEntry","renderServerEntry","renderWebEntry","renderMcpEntry","GENERATED_ENTRY_FILENAMES","scanExtensions","renderMcpWidgets","GENERATED_DIR","BUILD_TARGET_PLATFORMS","resolveTarget","renderApiClient","GENERATED_CLIENT_NAME","API_ROUTES_MODULE","GENERATED_ENTRY_NAMES","writeGenerated"],"sources":["../../../src/services/generate/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n API_ROUTES_MODULE,\n BUILD_TARGET_PLATFORMS,\n GENERATED_CLIENT_NAME,\n GENERATED_DIR,\n GENERATED_ENTRY_FILENAMES,\n GENERATED_ENTRY_NAMES,\n} from '../../constants/layout';\nimport type { ExtensionGraph, ExtensionNotice } from '../../types/extensionGraph';\nimport { renderApiClient } from '../renderClient';\nimport { renderCliEntry, renderMcpEntry, renderServerEntry, renderWebEntry } from '../renderEntry';\nimport { renderMcpWidgets } from '../renderMcpWidgets';\nimport { resolveTarget } from '../resolveTarget';\nimport type { BuildTarget } from '../resolveTarget/type';\nimport { scanExtensions } from '../scan';\nimport { writeGenerated } from '../writeGenerated';\nimport type { GenerateOptions, GenerateResult } from './type';\n\n/** `@agimon-ai/doompi-plan` becomes `plan`. */\nexport function defaultPluginId(packageName: string): string {\n return packageName.replace(/^@[^/]+\\//u, '').replace(/^doompi-/u, '');\n}\n\nfunction readPackageName(packageDir: string): string {\n const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as { name?: unknown };\n if (typeof manifest.name !== 'string') throw new Error(`${packageDir}/package.json has no name`);\n return manifest.name;\n}\n\nconst RENDERERS: Readonly<Record<BuildTarget, typeof renderCliEntry>> = {\n cli: renderCliEntry,\n server: renderServerEntry,\n web: renderWebEntry,\n mcp: renderMcpEntry,\n};\n\n/** The generated entry keeps its historical filename so no consumer has to change. */\nconst ENTRY_FILENAME: Readonly<Record<BuildTarget, string>> = GENERATED_ENTRY_FILENAMES;\nconst ENTRY_EXTENSION: Readonly<Record<BuildTarget, string>> = { cli: 'ts', server: 'ts', web: 'ts', mcp: 'ts' };\n\n/**\n * Scans a package and renders every entry its tree calls for.\n *\n * A target with nothing in it produces no file, so a backend-only package\n * never grows an empty cockpit entry. Notices from the scan and from each\n * resolution are gathered rather than thrown: an unrecognised folder costs\n * that folder, never the build.\n */\nexport function generateExtension(options: GenerateOptions): GenerateResult {\n const packageName = options.packageName ?? readPackageName(options.packageDir);\n const pluginId = options.pluginId ?? defaultPluginId(packageName);\n\n const graph: ExtensionGraph = scanExtensions(options);\n const notices: ExtensionNotice[] = [...graph.notices];\n const files = new Map<string, string>();\n const targets: BuildTarget[] = [];\n const mcpWidgets = options.target === 'mcp' ? renderMcpWidgets(graph, packageName, GENERATED_DIR) : undefined;\n if (mcpWidgets?.source !== undefined) files.set(`${GENERATED_DIR}/mcp-ui.ts`, mcpWidgets.source);\n\n // Here rather than in the scan, deliberately. The doomRoutedFilePosition lint\n // rule calls scanExtensions() directly, so a scan notice would make `.ios` a\n // hard preflight failure and cost us the forward-looking platforms we kept on\n // purpose. resolveTarget runs once per target, which would print this 3x.\n for (const entry of graph.entries) {\n if (entry.platform === undefined || BUILD_TARGET_PLATFORMS.includes(entry.platform)) continue;\n notices.push({\n path: entry.file,\n message: `'${entry.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server, web or mcp`,\n });\n }\n\n const requestedTargets = options.target === undefined ? (['cli', 'server', 'web'] as const) : [options.target];\n for (const target of requestedTargets) {\n const resolution = resolveTarget(graph, target);\n notices.push(...resolution.notices);\n // modes.yaml admits packages through their Pi entry, even when their only feature is a browser layout.\n const templateAdmission =\n target === 'cli' &&\n graph.entries.some(\n (entry) => entry.side === 'frontend' && entry.surface === 'template' && entry.platform === 'web',\n );\n if (\n resolution.contributions.length === 0 &&\n resolution.escapeHatches.length === 0 &&\n resolution.roots.length === 0 &&\n !templateAdmission\n )\n continue;\n\n targets.push(target);\n const render = RENDERERS[target];\n const source = render(resolution, {\n packageName,\n pluginId,\n root: graph.root,\n entryDir: GENERATED_DIR,\n mcpWidgets: mcpWidgets?.declarations,\n });\n files.set(`${GENERATED_DIR}/${ENTRY_FILENAME[target]}.${ENTRY_EXTENSION[target]}`, source);\n }\n\n // Not a fourth build target: no host loads it as an entry, and adding one to\n // the target loop would mean a resolution pass and a contribution field for\n // something that is only ever imported by a routed frontend file.\n //\n // Only for a package that has a browser half. The client exists to be called\n // from a page and it carries the sealed transport, so emitting one into a\n // node-only package asks that package to depend on a browser runtime it never\n // loads, to satisfy a file nothing imports.\n const hasRouteTable = options.target === undefined && fs.existsSync(path.join(options.packageDir, API_ROUTES_MODULE));\n const hasBrowserHalf = targets.includes('web');\n const client =\n hasRouteTable && hasBrowserHalf\n ? renderApiClient(graph, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR })\n : undefined;\n if (client !== undefined) files.set(`${GENERATED_DIR}/${GENERATED_CLIENT_NAME}.ts`, client);\n if (hasRouteTable && hasBrowserHalf && client === undefined) {\n notices.push({\n path: API_ROUTES_MODULE,\n message: 'declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted',\n });\n }\n\n const managed =\n options.target === undefined\n ? GENERATED_ENTRY_NAMES.filter(\n (name) => name !== 'mcp' || !fs.existsSync(path.join(options.packageDir, 'tsdown.mcp.config.ts')),\n ).map((name) => `${GENERATED_DIR}/${name}.ts`)\n : [\n `${GENERATED_DIR}/${ENTRY_FILENAME[options.target]}.${ENTRY_EXTENSION[options.target]}`,\n ...(options.target === 'mcp' ? [`${GENERATED_DIR}/mcp-ui.ts`] : []),\n ];\n const { changed } = writeGenerated(options.packageDir, files, options.check, managed);\n return { graph, packageName, pluginId, files, changed, notices, targets };\n}\n"],"mappings":"8ZAsBA,SAAgB,EAAgB,EAA6B,CAC3D,OAAO,EAAY,QAAQ,aAAc,EAAE,CAAC,CAAC,QAAQ,YAAa,EAAE,CACtE,CAEA,SAAS,EAAgB,EAA4B,CACnD,IAAM,EAAW,KAAK,MAAMA,EAAAA,QAAG,aAAaC,EAAAA,QAAK,KAAK,EAAY,cAAc,EAAG,MAAM,CAAC,EAC1F,GAAI,OAAO,EAAS,MAAS,SAAU,MAAU,MAAM,GAAG,EAAW,0BAA0B,EAC/F,OAAO,EAAS,IAClB,CAEA,MAAM,EAAkE,CACtE,IAAKC,EAAAA,eACL,OAAQC,EAAAA,kBACR,IAAKC,EAAAA,eACL,IAAKC,EAAAA,cACP,EAGM,EAAwDC,EAAAA,0BACxD,EAAyD,CAAE,IAAK,KAAM,OAAQ,KAAM,IAAK,KAAM,IAAK,IAAK,EAU/G,SAAgB,EAAkB,EAA0C,CAC1E,IAAM,EAAc,EAAQ,aAAe,EAAgB,EAAQ,UAAU,EACvE,EAAW,EAAQ,UAAY,EAAgB,CA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C9G,EAAiB,EAAQ,SAAS,KAAK,EACvC,EACJ,GAAiB,EACbW,EAAAA,gBAAgB,EAAO,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAUH,EAAAA,aAAc,CAAC,EAC3F,IAAA,GACF,IAAW,IAAA,IAAW,EAAM,IAAI,GAAGA,EAAAA,cAAc,GAAGI,EAAAA,sBAAsB,KAAM,CAAM,EACtF,GAAiB,GAAkB,IAAW,IAAA,IAChD,EAAQ,KAAK,CACX,KAAMC,EAAAA,kBACN,QAAS,2FACX,CAAC,EAGH,IAAM,EACJ,EAAQ,SAAW,IAAA,GACfC,EAAAA,sBAAsB,OACnB,GAAS,IAAS,OAAS,CAACf,EAAAA,QAAG,WAAWC,EAAAA,QAAK,KAAK,EAAQ,WAAY,sBAAsB,CAAC,CAClG,CAAC,CAAC,IAAK,GAAS,GAAGQ,EAAAA,cAAc,GAAG,EAAK,IAAI,EAC7C,CACE,GAAGA,EAAAA,cAAc,GAAG,EAAe,EAAQ,QAAQ,GAAG,EAAgB,EAAQ,UAC9E,GAAI,EAAQ,SAAW,MAAQ,CAAC,GAAGA,EAAAA,cAAc,WAAW,EAAI,CAAC,CACnE,EACA,CAAE,WAAYO,EAAAA,eAAe,EAAQ,WAAY,EAAO,EAAQ,MAAO,CAAO,EACpF,MAAO,CAAE,QAAO,cAAa,WAAU,QAAO,UAAS,UAAS,SAAQ,CAC1E"}
1
+ {"version":3,"file":"index.cjs","names":["fs","path","renderCliEntry","renderServerEntry","renderWebEntry","renderMcpEntry","GENERATED_ENTRY_FILENAMES","scanExtensions","renderMcpWidgets","GENERATED_DIR","BUILD_TARGET_PLATFORMS","resolveTarget","renderApiClient","GENERATED_CLIENT_NAME","API_ROUTES_MODULE","GENERATED_ENTRY_NAMES","writeGenerated","require_runtime","require_layout","require_index","require_index$1","require_index$2","require_index$3","require_index$4","require_index$5","node_fs","node_path","defaultPluginId","packageName","readPackageName","manifest","packageDir","RENDERERS","ENTRY_FILENAME","ENTRY_EXTENSION","generateExtension","options","pluginId","graph","notices","files","targets","mcpWidgets","entry","requestedTargets","target","resolution","templateAdmission","render","source","hasRouteTable","hasBrowserHalf","client","managed","name"],"sources":["../../../src/services/generate/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n API_ROUTES_MODULE,\n BUILD_TARGET_PLATFORMS,\n GENERATED_CLIENT_NAME,\n GENERATED_DIR,\n GENERATED_ENTRY_FILENAMES,\n GENERATED_ENTRY_NAMES,\n} from '../../constants/layout';\nimport type { ExtensionGraph, ExtensionNotice } from '../../types/extensionGraph';\nimport { renderApiClient } from '../renderClient';\nimport { renderCliEntry, renderMcpEntry, renderServerEntry, renderWebEntry } from '../renderEntry';\nimport { renderMcpWidgets } from '../renderMcpWidgets';\nimport { resolveTarget } from '../resolveTarget';\nimport type { BuildTarget } from '../resolveTarget/type';\nimport { scanExtensions } from '../scan';\nimport { writeGenerated } from '../writeGenerated';\nimport type { GenerateOptions, GenerateResult } from './type';\n\n/** `@agimon-ai/doompi-plan` becomes `plan`. */\nexport function defaultPluginId(packageName: string): string {\n return packageName.replace(/^@[^/]+\\//u, '').replace(/^doompi-/u, '');\n}\n\nfunction readPackageName(packageDir: string): string {\n const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as { name?: unknown };\n if (typeof manifest.name !== 'string') throw new Error(`${packageDir}/package.json has no name`);\n return manifest.name;\n}\n\nconst RENDERERS: Readonly<Record<BuildTarget, typeof renderCliEntry>> = {\n cli: renderCliEntry,\n server: renderServerEntry,\n web: renderWebEntry,\n mcp: renderMcpEntry,\n};\n\n/** The generated entry keeps its historical filename so no consumer has to change. */\nconst ENTRY_FILENAME: Readonly<Record<BuildTarget, string>> = GENERATED_ENTRY_FILENAMES;\nconst ENTRY_EXTENSION: Readonly<Record<BuildTarget, string>> = { cli: 'ts', server: 'ts', web: 'ts', mcp: 'ts' };\n\n/**\n * Scans a package and renders every entry its tree calls for.\n *\n * A target with nothing in it produces no file, so a backend-only package\n * never grows an empty cockpit entry. Notices from the scan and from each\n * resolution are gathered rather than thrown: an unrecognised folder costs\n * that folder, never the build.\n */\nexport function generateExtension(options: GenerateOptions): GenerateResult {\n const packageName = options.packageName ?? readPackageName(options.packageDir);\n const pluginId = options.pluginId ?? defaultPluginId(packageName);\n\n const graph: ExtensionGraph = scanExtensions(options);\n const notices: ExtensionNotice[] = [...graph.notices];\n const files = new Map<string, string>();\n const targets: BuildTarget[] = [];\n const mcpWidgets = options.target === 'mcp' ? renderMcpWidgets(graph, packageName, GENERATED_DIR) : undefined;\n if (mcpWidgets?.source !== undefined) files.set(`${GENERATED_DIR}/mcp-ui.ts`, mcpWidgets.source);\n\n // Here rather than in the scan, deliberately. The doomRoutedFilePosition lint\n // rule calls scanExtensions() directly, so a scan notice would make `.ios` a\n // hard preflight failure and cost us the forward-looking platforms we kept on\n // purpose. resolveTarget runs once per target, which would print this 3x.\n for (const entry of graph.entries) {\n if (entry.platform === undefined || BUILD_TARGET_PLATFORMS.includes(entry.platform)) continue;\n notices.push({\n path: entry.file,\n message: `'${entry.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server, web or mcp`,\n });\n }\n\n const requestedTargets = options.target === undefined ? (['cli', 'server', 'web'] as const) : [options.target];\n for (const target of requestedTargets) {\n const resolution = resolveTarget(graph, target);\n notices.push(...resolution.notices);\n // modes.yaml admits packages through their Pi entry, even when their only feature is a browser layout.\n const templateAdmission =\n target === 'cli' &&\n graph.entries.some(\n (entry) => entry.side === 'frontend' && entry.surface === 'template' && entry.platform === 'web',\n );\n if (\n resolution.contributions.length === 0 &&\n resolution.escapeHatches.length === 0 &&\n resolution.roots.length === 0 &&\n !templateAdmission\n )\n continue;\n\n targets.push(target);\n const render = RENDERERS[target];\n const source = render(resolution, {\n packageName,\n pluginId,\n root: graph.root,\n entryDir: GENERATED_DIR,\n mcpWidgets: mcpWidgets?.declarations,\n });\n files.set(`${GENERATED_DIR}/${ENTRY_FILENAME[target]}.${ENTRY_EXTENSION[target]}`, source);\n }\n\n // Not a fourth build target: no host loads it as an entry, and adding one to\n // the target loop would mean a resolution pass and a contribution field for\n // something that is only ever imported by a routed frontend file.\n //\n // Only for a package that has a browser half. The client exists to be called\n // from a page and it carries the sealed transport, so emitting one into a\n // node-only package asks that package to depend on a browser runtime it never\n // loads, to satisfy a file nothing imports.\n const hasRouteTable = options.target === undefined && fs.existsSync(path.join(options.packageDir, API_ROUTES_MODULE));\n const hasBrowserHalf = targets.includes('web');\n const client =\n hasRouteTable && hasBrowserHalf\n ? renderApiClient(graph, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR })\n : undefined;\n if (client !== undefined) files.set(`${GENERATED_DIR}/${GENERATED_CLIENT_NAME}.ts`, client);\n if (hasRouteTable && hasBrowserHalf && client === undefined) {\n notices.push({\n path: API_ROUTES_MODULE,\n message: 'declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted',\n });\n }\n\n const managed =\n options.target === undefined\n ? GENERATED_ENTRY_NAMES.filter(\n (name) => name !== 'mcp' || !fs.existsSync(path.join(options.packageDir, 'tsdown.mcp.config.ts')),\n ).map((name) => `${GENERATED_DIR}/${name}.ts`)\n : [\n `${GENERATED_DIR}/${ENTRY_FILENAME[options.target]}.${ENTRY_EXTENSION[options.target]}`,\n ...(options.target === 'mcp' ? [`${GENERATED_DIR}/mcp-ui.ts`] : []),\n ];\n const { changed } = writeGenerated(options.packageDir, files, options.check, managed);\n return { graph, packageName, pluginId, files, changed, notices, targets };\n}\n"],"mappings":"8ZAsBA,SAAgB2B,EAAgB,EAA6B,CAC3D,OAAOC,EAAY,QAAQ,aAAc,EAAE,CAAC,CAAC,QAAQ,YAAa,EAAE,CACtE,CAEA,SAASC,EAAgB,EAA4B,CACnD,IAAMC,EAAW,KAAK,MAAM9B,EAAAA,QAAG,aAAaC,EAAAA,QAAK,KAAK8B,EAAY,cAAc,EAAG,MAAM,CAAC,EAC1F,GAAI,OAAOD,EAAS,MAAS,SAAU,MAAU,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AAC,CACnE,EACA,CAAE,WAAYO,EAAAA,eAAeoB,EAAQ,WAAYI,EAAOJ,EAAQ,MAAOiB,CAAO,EACpF,MAAO,CAAE,QAAO,cAAa,WAAU,QAAO,UAAS,UAAS,SAAQ,CAC1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/generate/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n API_ROUTES_MODULE,\n BUILD_TARGET_PLATFORMS,\n GENERATED_CLIENT_NAME,\n GENERATED_DIR,\n GENERATED_ENTRY_FILENAMES,\n GENERATED_ENTRY_NAMES,\n} from '../../constants/layout';\nimport type { ExtensionGraph, ExtensionNotice } from '../../types/extensionGraph';\nimport { renderApiClient } from '../renderClient';\nimport { renderCliEntry, renderMcpEntry, renderServerEntry, renderWebEntry } from '../renderEntry';\nimport { renderMcpWidgets } from '../renderMcpWidgets';\nimport { resolveTarget } from '../resolveTarget';\nimport type { BuildTarget } from '../resolveTarget/type';\nimport { scanExtensions } from '../scan';\nimport { writeGenerated } from '../writeGenerated';\nimport type { GenerateOptions, GenerateResult } from './type';\n\n/** `@agimon-ai/doompi-plan` becomes `plan`. */\nexport function defaultPluginId(packageName: string): string {\n return packageName.replace(/^@[^/]+\\//u, '').replace(/^doompi-/u, '');\n}\n\nfunction readPackageName(packageDir: string): string {\n const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as { name?: unknown };\n if (typeof manifest.name !== 'string') throw new Error(`${packageDir}/package.json has no name`);\n return manifest.name;\n}\n\nconst RENDERERS: Readonly<Record<BuildTarget, typeof renderCliEntry>> = {\n cli: renderCliEntry,\n server: renderServerEntry,\n web: renderWebEntry,\n mcp: renderMcpEntry,\n};\n\n/** The generated entry keeps its historical filename so no consumer has to change. */\nconst ENTRY_FILENAME: Readonly<Record<BuildTarget, string>> = GENERATED_ENTRY_FILENAMES;\nconst ENTRY_EXTENSION: Readonly<Record<BuildTarget, string>> = { cli: 'ts', server: 'ts', web: 'ts', mcp: 'ts' };\n\n/**\n * Scans a package and renders every entry its tree calls for.\n *\n * A target with nothing in it produces no file, so a backend-only package\n * never grows an empty cockpit entry. Notices from the scan and from each\n * resolution are gathered rather than thrown: an unrecognised folder costs\n * that folder, never the build.\n */\nexport function generateExtension(options: GenerateOptions): GenerateResult {\n const packageName = options.packageName ?? readPackageName(options.packageDir);\n const pluginId = options.pluginId ?? defaultPluginId(packageName);\n\n const graph: ExtensionGraph = scanExtensions(options);\n const notices: ExtensionNotice[] = [...graph.notices];\n const files = new Map<string, string>();\n const targets: BuildTarget[] = [];\n const mcpWidgets = options.target === 'mcp' ? renderMcpWidgets(graph, packageName, GENERATED_DIR) : undefined;\n if (mcpWidgets?.source !== undefined) files.set(`${GENERATED_DIR}/mcp-ui.ts`, mcpWidgets.source);\n\n // Here rather than in the scan, deliberately. The doomRoutedFilePosition lint\n // rule calls scanExtensions() directly, so a scan notice would make `.ios` a\n // hard preflight failure and cost us the forward-looking platforms we kept on\n // purpose. resolveTarget runs once per target, which would print this 3x.\n for (const entry of graph.entries) {\n if (entry.platform === undefined || BUILD_TARGET_PLATFORMS.includes(entry.platform)) continue;\n notices.push({\n path: entry.file,\n message: `'${entry.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server, web or mcp`,\n });\n }\n\n const requestedTargets = options.target === undefined ? (['cli', 'server', 'web'] as const) : [options.target];\n for (const target of requestedTargets) {\n const resolution = resolveTarget(graph, target);\n notices.push(...resolution.notices);\n // modes.yaml admits packages through their Pi entry, even when their only feature is a browser layout.\n const templateAdmission =\n target === 'cli' &&\n graph.entries.some(\n (entry) => entry.side === 'frontend' && entry.surface === 'template' && entry.platform === 'web',\n );\n if (\n resolution.contributions.length === 0 &&\n resolution.escapeHatches.length === 0 &&\n resolution.roots.length === 0 &&\n !templateAdmission\n )\n continue;\n\n targets.push(target);\n const render = RENDERERS[target];\n const source = render(resolution, {\n packageName,\n pluginId,\n root: graph.root,\n entryDir: GENERATED_DIR,\n mcpWidgets: mcpWidgets?.declarations,\n });\n files.set(`${GENERATED_DIR}/${ENTRY_FILENAME[target]}.${ENTRY_EXTENSION[target]}`, source);\n }\n\n // Not a fourth build target: no host loads it as an entry, and adding one to\n // the target loop would mean a resolution pass and a contribution field for\n // something that is only ever imported by a routed frontend file.\n //\n // Only for a package that has a browser half. The client exists to be called\n // from a page and it carries the sealed transport, so emitting one into a\n // node-only package asks that package to depend on a browser runtime it never\n // loads, to satisfy a file nothing imports.\n const hasRouteTable = options.target === undefined && fs.existsSync(path.join(options.packageDir, API_ROUTES_MODULE));\n const hasBrowserHalf = targets.includes('web');\n const client =\n hasRouteTable && hasBrowserHalf\n ? renderApiClient(graph, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR })\n : undefined;\n if (client !== undefined) files.set(`${GENERATED_DIR}/${GENERATED_CLIENT_NAME}.ts`, client);\n if (hasRouteTable && hasBrowserHalf && client === undefined) {\n notices.push({\n path: API_ROUTES_MODULE,\n message: 'declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted',\n });\n }\n\n const managed =\n options.target === undefined\n ? GENERATED_ENTRY_NAMES.filter(\n (name) => name !== 'mcp' || !fs.existsSync(path.join(options.packageDir, 'tsdown.mcp.config.ts')),\n ).map((name) => `${GENERATED_DIR}/${name}.ts`)\n : [\n `${GENERATED_DIR}/${ENTRY_FILENAME[options.target]}.${ENTRY_EXTENSION[options.target]}`,\n ...(options.target === 'mcp' ? [`${GENERATED_DIR}/mcp-ui.ts`] : []),\n ];\n const { changed } = writeGenerated(options.packageDir, files, options.check, managed);\n return { graph, packageName, pluginId, files, changed, notices, targets };\n}\n"],"mappings":"opBAsBA,SAAgB,EAAgB,EAA6B,CAC3D,OAAO,EAAY,QAAQ,aAAc,EAAE,CAAC,CAAC,QAAQ,YAAa,EAAE,CACtE,CAEA,SAAS,EAAgB,EAA4B,CACnD,IAAM,EAAW,KAAK,MAAM,EAAG,aAAa,EAAK,KAAK,EAAY,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AAM,EACnB,IAAM,EAAS,EAAU,GACnB,EAAS,EAAO,EAAY,CAChC,cACA,WACA,KAAM,EAAM,KACZ,SAAU,EACV,WAAY,GAAY,YAC1B,CAAC,EACD,EAAM,IAAI,GAAG,EAAc,GAAG,EAAe,GAAQ,GAAG,EAAgB,KAAW,CAAM,CAC3F,CAUA,IAAM,EAAgB,EAAQ,SAAW,IAAA,IAAa,EAAG,WAAW,EAAK,KAAK,EAAQ,WAAA,wBAA6B,CAAC,EAC9G,EAAiB,EAAQ,SAAS,KAAK,EACvC,EACJ,GAAiB,EACb,EAAgB,EAAO,CAAE,cAAa,WAAU,KAAM,EAAM,KAAM,SAAU,CAAc,CAAC,EAC3F,IAAA,GACF,IAAW,IAAA,IAAW,EAAM,IAAI,GAAG,EAAc,GAAG,EAAsB,KAAM,CAAM,EACtF,GAAiB,GAAkB,IAAW,IAAA,IAChD,EAAQ,KAAK,CACX,KAAM,EACN,QAAS,2FACX,CAAC,EAGH,IAAM,EACJ,EAAQ,SAAW,IAAA,GACf,EAAsB,OACnB,GAAS,IAAS,OAAS,CAAC,EAAG,WAAW,EAAK,KAAK,EAAQ,WAAY,sBAAsB,CAAC,CAClG,CAAC,CAAC,IAAK,GAAS,GAAG,EAAc,GAAG,EAAK,IAAI,EAC7C,CACE,GAAG,EAAc,GAAG,EAAe,EAAQ,QAAQ,GAAG,EAAgB,EAAQ,UAC9E,GAAI,EAAQ,SAAW,MAAQ,CAAC,GAAG,EAAc,WAAW,EAAI,CAAC,CACnE,EACA,CAAE,WAAY,EAAe,EAAQ,WAAY,EAAO,EAAQ,MAAO,CAAO,EACpF,MAAO,CAAE,QAAO,cAAa,WAAU,QAAO,UAAS,UAAS,SAAQ,CAC1E"}
1
+ {"version":3,"file":"index.mjs","names":["fs","path","defaultPluginId","packageName","readPackageName","manifest","packageDir","RENDERERS","renderCliEntry","renderServerEntry","renderWebEntry","renderMcpEntry","ENTRY_FILENAME","GENERATED_ENTRY_FILENAMES","ENTRY_EXTENSION","generateExtension","options","pluginId","graph","scanExtensions","notices","files","targets","mcpWidgets","renderMcpWidgets","GENERATED_DIR","entry","BUILD_TARGET_PLATFORMS","requestedTargets","target","resolution","resolveTarget","templateAdmission","render","source","hasRouteTable","hasBrowserHalf","client","renderApiClient","GENERATED_CLIENT_NAME","API_ROUTES_MODULE","managed","GENERATED_ENTRY_NAMES","name","writeGenerated"],"sources":["../../../src/services/generate/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n API_ROUTES_MODULE,\n BUILD_TARGET_PLATFORMS,\n GENERATED_CLIENT_NAME,\n GENERATED_DIR,\n GENERATED_ENTRY_FILENAMES,\n GENERATED_ENTRY_NAMES,\n} from '../../constants/layout';\nimport type { ExtensionGraph, ExtensionNotice } from '../../types/extensionGraph';\nimport { renderApiClient } from '../renderClient';\nimport { renderCliEntry, renderMcpEntry, renderServerEntry, renderWebEntry } from '../renderEntry';\nimport { renderMcpWidgets } from '../renderMcpWidgets';\nimport { resolveTarget } from '../resolveTarget';\nimport type { BuildTarget } from '../resolveTarget/type';\nimport { scanExtensions } from '../scan';\nimport { writeGenerated } from '../writeGenerated';\nimport type { GenerateOptions, GenerateResult } from './type';\n\n/** `@agimon-ai/doompi-plan` becomes `plan`. */\nexport function defaultPluginId(packageName: string): string {\n return packageName.replace(/^@[^/]+\\//u, '').replace(/^doompi-/u, '');\n}\n\nfunction readPackageName(packageDir: string): string {\n const manifest = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf8')) as { name?: unknown };\n if (typeof manifest.name !== 'string') throw new Error(`${packageDir}/package.json has no name`);\n return manifest.name;\n}\n\nconst RENDERERS: Readonly<Record<BuildTarget, typeof renderCliEntry>> = {\n cli: renderCliEntry,\n server: renderServerEntry,\n web: renderWebEntry,\n mcp: renderMcpEntry,\n};\n\n/** The generated entry keeps its historical filename so no consumer has to change. */\nconst ENTRY_FILENAME: Readonly<Record<BuildTarget, string>> = GENERATED_ENTRY_FILENAMES;\nconst ENTRY_EXTENSION: Readonly<Record<BuildTarget, string>> = { cli: 'ts', server: 'ts', web: 'ts', mcp: 'ts' };\n\n/**\n * Scans a package and renders every entry its tree calls for.\n *\n * A target with nothing in it produces no file, so a backend-only package\n * never grows an empty cockpit entry. Notices from the scan and from each\n * resolution are gathered rather than thrown: an unrecognised folder costs\n * that folder, never the build.\n */\nexport function generateExtension(options: GenerateOptions): GenerateResult {\n const packageName = options.packageName ?? readPackageName(options.packageDir);\n const pluginId = options.pluginId ?? defaultPluginId(packageName);\n\n const graph: ExtensionGraph = scanExtensions(options);\n const notices: ExtensionNotice[] = [...graph.notices];\n const files = new Map<string, string>();\n const targets: BuildTarget[] = [];\n const mcpWidgets = options.target === 'mcp' ? renderMcpWidgets(graph, packageName, GENERATED_DIR) : undefined;\n if (mcpWidgets?.source !== undefined) files.set(`${GENERATED_DIR}/mcp-ui.ts`, mcpWidgets.source);\n\n // Here rather than in the scan, deliberately. The doomRoutedFilePosition lint\n // rule calls scanExtensions() directly, so a scan notice would make `.ios` a\n // hard preflight failure and cost us the forward-looking platforms we kept on\n // purpose. resolveTarget runs once per target, which would print this 3x.\n for (const entry of graph.entries) {\n if (entry.platform === undefined || BUILD_TARGET_PLATFORMS.includes(entry.platform)) continue;\n notices.push({\n path: entry.file,\n message: `'${entry.platform}' is a forward-looking platform with no build target; this file is not emitted for cli, server, web or mcp`,\n });\n }\n\n const requestedTargets = options.target === undefined ? (['cli', 'server', 'web'] as const) : [options.target];\n for (const target of requestedTargets) {\n const resolution = resolveTarget(graph, target);\n notices.push(...resolution.notices);\n // modes.yaml admits packages through their Pi entry, even when their only feature is a browser layout.\n const templateAdmission =\n target === 'cli' &&\n graph.entries.some(\n (entry) => entry.side === 'frontend' && entry.surface === 'template' && entry.platform === 'web',\n );\n if (\n resolution.contributions.length === 0 &&\n resolution.escapeHatches.length === 0 &&\n resolution.roots.length === 0 &&\n !templateAdmission\n )\n continue;\n\n targets.push(target);\n const render = RENDERERS[target];\n const source = render(resolution, {\n packageName,\n pluginId,\n root: graph.root,\n entryDir: GENERATED_DIR,\n mcpWidgets: mcpWidgets?.declarations,\n });\n files.set(`${GENERATED_DIR}/${ENTRY_FILENAME[target]}.${ENTRY_EXTENSION[target]}`, source);\n }\n\n // Not a fourth build target: no host loads it as an entry, and adding one to\n // the target loop would mean a resolution pass and a contribution field for\n // something that is only ever imported by a routed frontend file.\n //\n // Only for a package that has a browser half. The client exists to be called\n // from a page and it carries the sealed transport, so emitting one into a\n // node-only package asks that package to depend on a browser runtime it never\n // loads, to satisfy a file nothing imports.\n const hasRouteTable = options.target === undefined && fs.existsSync(path.join(options.packageDir, API_ROUTES_MODULE));\n const hasBrowserHalf = targets.includes('web');\n const client =\n hasRouteTable && hasBrowserHalf\n ? renderApiClient(graph, { packageName, pluginId, root: graph.root, entryDir: GENERATED_DIR })\n : undefined;\n if (client !== undefined) files.set(`${GENERATED_DIR}/${GENERATED_CLIENT_NAME}.ts`, client);\n if (hasRouteTable && hasBrowserHalf && client === undefined) {\n notices.push({\n path: API_ROUTES_MODULE,\n message: 'declares API routes, but no (backend)/api/<base-path>/ folder says where they are mounted',\n });\n }\n\n const managed =\n options.target === undefined\n ? GENERATED_ENTRY_NAMES.filter(\n (name) => name !== 'mcp' || !fs.existsSync(path.join(options.packageDir, 'tsdown.mcp.config.ts')),\n ).map((name) => `${GENERATED_DIR}/${name}.ts`)\n : [\n `${GENERATED_DIR}/${ENTRY_FILENAME[options.target]}.${ENTRY_EXTENSION[options.target]}`,\n ...(options.target === 'mcp' ? [`${GENERATED_DIR}/mcp-ui.ts`] : []),\n ];\n const { changed } = writeGenerated(options.packageDir, files, options.check, managed);\n return { graph, packageName, pluginId, files, changed, notices, targets };\n}\n"],"mappings":"opBAsBA,SAAgBE,EAAgB,EAA6B,CAC3D,OAAOC,EAAY,QAAQ,aAAc,EAAE,CAAC,CAAC,QAAQ,YAAa,EAAE,CACtE,CAEA,SAASC,EAAgB,EAA4B,CACnD,IAAMC,EAAW,KA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AU,QAAO,UAAS,UAAS,SAAQ,CAC1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../../src/services/identity/index.ts"],"sourcesContent":["/**\n * What a path knows about a contribution's identity.\n *\n * The generator supplies these and the authored file is spread over the top,\n * so a file that states its own name or id always wins. That is what lets the\n * filename be the identity without taking the choice away.\n */\n\n/** `write-plan` and `writePlan` both become `write_plan`. */\nexport function toSnake(name: string): string {\n return name\n .replace(/([a-z0-9])([A-Z])/gu, '$1-$2')\n .toLowerCase()\n .replaceAll('-', '_');\n}\n\n/** `PlanPanel` becomes `plan-panel`; an already-kebab name is unchanged. */\nexport function toKebab(name: string): string {\n return name.replace(/([a-z0-9])([A-Z])/gu, '$1-$2').toLowerCase();\n}\n\n/** One derived field and the literal it holds. */\nexport type Identity = Readonly<Record<string, string | readonly string[]>>;\n\n/** Renders an identity as object-literal members, ready to precede a spread. */\nexport function renderIdentity(identity: Identity): string {\n return Object.entries(identity)\n .map(([key, value]) =>\n Array.isArray(value)\n ? `${key}: [${value.map((item) => `'${item}'`).join(', ')}]`\n : `${key}: '${value as string}'`,\n )\n .join(', ');\n}\n"],"mappings":"AASA,SAAgB,EAAQ,EAAsB,CAC5C,OAAO,EACJ,QAAQ,sBAAuB,OAAO,CAAC,CACvC,YAAY,CAAC,CACb,WAAW,IAAK,GAAG,CACxB,CAGA,SAAgB,EAAQ,EAAsB,CAC5C,OAAO,EAAK,QAAQ,sBAAuB,OAAO,CAAC,CAAC,YAAY,CAClE,CAMA,SAAgB,EAAe,EAA4B,CACzD,OAAO,OAAO,QAAQ,CAAQ,CAAC,CAC5B,KAAK,CAAC,EAAK,KACV,MAAM,QAAQ,CAAK,EACf,GAAG,EAAI,KAAK,EAAM,IAAK,GAAS,IAAI,EAAK,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,GACxD,GAAG,EAAI,KAAK,EAAgB,EAClC,CAAC,CACA,KAAK,IAAI,CACd"}
1
+ {"version":3,"file":"index.cjs","names":["toSnake","name","toKebab","renderIdentity","identity","key","value","item"],"sources":["../../../src/services/identity/index.ts"],"sourcesContent":["/**\n * What a path knows about a contribution's identity.\n *\n * The generator supplies these and the authored file is spread over the top,\n * so a file that states its own name or id always wins. That is what lets the\n * filename be the identity without taking the choice away.\n */\n\n/** `write-plan` and `writePlan` both become `write_plan`. */\nexport function toSnake(name: string): string {\n return name\n .replace(/([a-z0-9])([A-Z])/gu, '$1-$2')\n .toLowerCase()\n .replaceAll('-', '_');\n}\n\n/** `PlanPanel` becomes `plan-panel`; an already-kebab name is unchanged. */\nexport function toKebab(name: string): string {\n return name.replace(/([a-z0-9])([A-Z])/gu, '$1-$2').toLowerCase();\n}\n\n/** One derived field and the literal it holds. */\nexport type Identity = Readonly<Record<string, string | readonly string[]>>;\n\n/** Renders an identity as object-literal members, ready to precede a spread. */\nexport function renderIdentity(identity: Identity): string {\n return Object.entries(identity)\n .map(([key, value]) =>\n Array.isArray(value)\n ? `${key}: [${value.map((item) => `'${item}'`).join(', ')}]`\n : `${key}: '${value as string}'`,\n )\n .join(', ');\n}\n"],"mappings":"AASA,SAAgBA,EAAQ,EAAsB,CAC5C,OAAOC,EACJ,QAAQ,sBAAuB,OAAO,CAAC,CACvC,YAAY,CAAC,CACb,WAAW,IAAK,GAAG,CACxB,CAGA,SAAgBC,EAAQ,EAAsB,CAC5C,OAAOD,EAAK,QAAQ,sBAAuB,OAAO,CAAC,CAAC,YAAY,CAClE,CAMA,SAAgBE,EAAe,EAA4B,CACzD,OAAO,OAAO,QAAQC,CAAQ,CAAC,CAC5B,KAAK,CAACC,EAAKC,KACV,MAAM,QAAQA,CAAK,EACf,GAAGD,EAAI,KAAKC,EAAM,IAAK,GAAS,IAAIC,EAAK,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,GACxD,GAAGF,EAAI,KAAKC,EAAgB,EAClC,CAAC,CACA,KAAK,IAAI,CACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/identity/index.ts"],"sourcesContent":["/**\n * What a path knows about a contribution's identity.\n *\n * The generator supplies these and the authored file is spread over the top,\n * so a file that states its own name or id always wins. That is what lets the\n * filename be the identity without taking the choice away.\n */\n\n/** `write-plan` and `writePlan` both become `write_plan`. */\nexport function toSnake(name: string): string {\n return name\n .replace(/([a-z0-9])([A-Z])/gu, '$1-$2')\n .toLowerCase()\n .replaceAll('-', '_');\n}\n\n/** `PlanPanel` becomes `plan-panel`; an already-kebab name is unchanged. */\nexport function toKebab(name: string): string {\n return name.replace(/([a-z0-9])([A-Z])/gu, '$1-$2').toLowerCase();\n}\n\n/** One derived field and the literal it holds. */\nexport type Identity = Readonly<Record<string, string | readonly string[]>>;\n\n/** Renders an identity as object-literal members, ready to precede a spread. */\nexport function renderIdentity(identity: Identity): string {\n return Object.entries(identity)\n .map(([key, value]) =>\n Array.isArray(value)\n ? `${key}: [${value.map((item) => `'${item}'`).join(', ')}]`\n : `${key}: '${value as string}'`,\n )\n .join(', ');\n}\n"],"mappings":"AASA,SAAgB,EAAQ,EAAsB,CAC5C,OAAO,EACJ,QAAQ,sBAAuB,OAAO,CAAC,CACvC,YAAY,CAAC,CACb,WAAW,IAAK,GAAG,CACxB,CAGA,SAAgB,EAAQ,EAAsB,CAC5C,OAAO,EAAK,QAAQ,sBAAuB,OAAO,CAAC,CAAC,YAAY,CAClE,CAMA,SAAgB,EAAe,EAA4B,CACzD,OAAO,OAAO,QAAQ,CAAQ,CAAC,CAC5B,KAAK,CAAC,EAAK,KACV,MAAM,QAAQ,CAAK,EACf,GAAG,EAAI,KAAK,EAAM,IAAK,GAAS,IAAI,EAAK,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,GACxD,GAAG,EAAI,KAAK,EAAgB,EAClC,CAAC,CACA,KAAK,IAAI,CACd"}
1
+ {"version":3,"file":"index.mjs","names":["toSnake","name","toKebab","renderIdentity","identity","key","value","item"],"sources":["../../../src/services/identity/index.ts"],"sourcesContent":["/**\n * What a path knows about a contribution's identity.\n *\n * The generator supplies these and the authored file is spread over the top,\n * so a file that states its own name or id always wins. That is what lets the\n * filename be the identity without taking the choice away.\n */\n\n/** `write-plan` and `writePlan` both become `write_plan`. */\nexport function toSnake(name: string): string {\n return name\n .replace(/([a-z0-9])([A-Z])/gu, '$1-$2')\n .toLowerCase()\n .replaceAll('-', '_');\n}\n\n/** `PlanPanel` becomes `plan-panel`; an already-kebab name is unchanged. */\nexport function toKebab(name: string): string {\n return name.replace(/([a-z0-9])([A-Z])/gu, '$1-$2').toLowerCase();\n}\n\n/** One derived field and the literal it holds. */\nexport type Identity = Readonly<Record<string, string | readonly string[]>>;\n\n/** Renders an identity as object-literal members, ready to precede a spread. */\nexport function renderIdentity(identity: Identity): string {\n return Object.entries(identity)\n .map(([key, value]) =>\n Array.isArray(value)\n ? `${key}: [${value.map((item) => `'${item}'`).join(', ')}]`\n : `${key}: '${value as string}'`,\n )\n .join(', ');\n}\n"],"mappings":"AASA,SAAgBA,EAAQ,EAAsB,CAC5C,OAAOC,EACJ,QAAQ,sBAAuB,OAAO,CAAC,CACvC,YAAY,CAAC,CACb,WAAW,IAAK,GAAG,CACxB,CAGA,SAAgBC,EAAQ,EAAsB,CAC5C,OAAOD,EAAK,QAAQ,sBAAuB,OAAO,CAAC,CAAC,YAAY,CAClE,CAMA,SAAgBE,EAAe,EAA4B,CACzD,OAAO,OAAO,QAAQC,CAAQ,CAAC,CAC5B,KAAK,CAACC,EAAKC,KACV,MAAM,QAAQA,CAAK,EACf,GAAGD,EAAI,KAAKC,EAAM,IAAK,GAAS,IAAIC,EAAK,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,GACxD,GAAGF,EAAI,KAAKC,EAAgB,EAClC,CAAC,CACA,KAAK,IAAI,CACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["toKebab","posix"],"sources":["../../../src/services/renderClient/index.ts"],"sourcesContent":["import { posix } from 'node:path';\n\nimport { GENERATED_DIR } from '../../constants/layout';\nimport type { ExtensionEntry, ExtensionGraph, ExtensionScope } from '../../types/extensionGraph';\nimport { toKebab } from '../identity';\nimport type { RenderOptions } from '../renderEntry/type';\n\n/**\n * Renders the typed client a cockpit plugin calls its own API through.\n *\n * The two facts this injects are the two a package kept restating and getting\n * wrong: which scopes its API mounts at, and under which base path. Both are\n * read off the folder tree, so `api/file-edits/route.server.ts` at the session\n * scope is the whole declaration. A package that writes them out again is a\n * package that can disagree with itself, and several did.\n *\n * The route list is not read here. It is authored as plain data in\n * `src/types/apiRoutes.ts`, because this build evaluates no TypeScript and must\n * not learn how: it has no dependencies at all, and every specifier below is\n * emitted as text.\n */\n\nconst HEADER = '// Generated by @agimon-ai/doompi-build. Do not edit by hand.';\n\n/** Server scopes cascade outward-in, the way the generated server entry mounts them. */\nconst SCOPE_ORDER: readonly ExtensionScope[] = ['global', 'workspace', 'session'];\n\n/** One mount the tree declares: a base path, and the scopes it is reachable at. */\ninterface ClientMount {\n readonly basePath: string;\n readonly scopes: readonly ExtensionScope[];\n /** A valid identifier for the exported factory, when a package has several mounts. */\n readonly identifier: string;\n}\n\nfunction identifierFor(basePath: string, multiple: boolean): string {\n if (!multiple) return 'api';\n const camel = toKebab(basePath)\n .split('-')\n .filter((word) => word.length > 0)\n .map((word, index) => (index === 0 ? word : word[0]?.toUpperCase() + word.slice(1)))\n .join('');\n return /^[A-Za-z_]/u.test(camel) ? camel : `api${camel}`;\n}\n\n/**\n * The base path an api entry mounts at: the first literal segment below `api/`.\n *\n * An entry with no segment is the flat `api/route.server.ts` shape that predates\n * this convention. Its base path lives in a hand-written `DoomApi` the build\n * cannot read, so it contributes no client and keeps its hand-built URLs until\n * the folder is renamed.\n */\nfunction baseSegmentOf(entry: ExtensionEntry): string | undefined {\n const first = entry.route[0];\n if (first === undefined || !('literal' in first)) return undefined;\n return first.literal;\n}\n\nfunction mountsOf(graph: ExtensionGraph): ClientMount[] {\n const scopesByBase = new Map<string, Set<ExtensionScope>>();\n for (const entry of graph.entries) {\n if (entry.side !== 'backend' || entry.surface !== 'api' || entry.role !== 'contribution') continue;\n const basePath = baseSegmentOf(entry);\n if (basePath === undefined) continue;\n const held = scopesByBase.get(basePath) ?? new Set<ExtensionScope>();\n held.add(entry.scope);\n scopesByBase.set(basePath, held);\n }\n\n const bases = [...scopesByBase.keys()].sort();\n return bases.map((basePath) => {\n const declared = scopesByBase.get(basePath) as Set<ExtensionScope>;\n // A facet mounts a contribution at its own scope and every scope below it,\n // so a global API answers workspace and session requests too.\n const shallowest = SCOPE_ORDER.findIndex((scope) => declared.has(scope));\n return {\n basePath,\n scopes: SCOPE_ORDER.slice(shallowest),\n identifier: identifierFor(basePath, bases.length > 1),\n };\n });\n}\n\n/** The extensionless relative specifier from the generated directory to the route table. */\nfunction routesSpecifier(entryDir: string): string {\n const relative = posix.relative(entryDir, 'src/types/apiRoutes');\n return relative.startsWith('.') ? relative : `./${relative}`;\n}\n\nfunction renderMount(mount: ClientMount): string[] {\n const scopes = mount.scopes.map((scope) => `'${scope}'`).join(', ');\n const suffix = mount.identifier === 'api' ? '' : ` for the ${mount.basePath} mount`;\n return [\n `/** Scopes the tree mounts '${mount.basePath}' at${suffix}. */`,\n `export const ${mount.identifier}Scopes = [${scopes}] as const;`,\n '',\n `export const ${mount.identifier} = createApiClient(routes, {`,\n ` scopes: ${mount.identifier}Scopes,`,\n ` basePath: '${mount.basePath}',`,\n ' transport: (input, init) => sealedTransport.fetch(input, init),',\n ' sessionAddress: sessionApiAddress,',\n '});',\n '',\n ];\n}\n\n/**\n * The client source, or undefined when the tree declares no `api/<base-path>/`.\n *\n * `options.entryDir` is where the file will be written, so the relative import\n * of the route table is computed against it rather than assumed.\n */\nexport function renderApiClient(graph: ExtensionGraph, options: RenderOptions): string | undefined {\n const mounts = mountsOf(graph);\n if (mounts.length === 0) return undefined;\n\n const lines = [\n HEADER,\n \"import { createApiClient, sessionApiAddress } from '@agimon-ai/doompi-core/web';\",\n \"import { sealedTransport } from '@agimon-ai/doompi-web-security/browser';\",\n '',\n `import routes from '${routesSpecifier(options.entryDir ?? GENERATED_DIR)}';`,\n '',\n ...mounts.flatMap((mount) => renderMount(mount)),\n ];\n return `${lines.join('\\n').replace(/\\n+$/u, '')}\\n`;\n}\n"],"mappings":"0GAsBA,MAGM,EAAyC,CAAC,SAAU,YAAa,SAAS,EAUhF,SAAS,EAAc,EAAkB,EAA2B,CAClE,GAAI,CAAC,EAAU,MAAO,MACtB,IAAM,EAAQA,EAAAA,QAAQ,CAAQ,CAAC,CAC5B,MAAM,GAAG,CAAC,CACV,OAAQ,GAAS,EAAK,OAAS,CAAC,CAAC,CACjC,KAAK,EAAM,IAAW,IAAU,EAAI,EAAO,EAAK,EAAE,EAAE,YAAY,EAAI,EAAK,MAAM,CAAC,CAAE,CAAC,CACnF,KAAK,EAAE,EACV,MAAO,cAAc,KAAK,CAAK,EAAI,EAAQ,MAAM,GACnD,CAUA,SAAS,EAAc,EAA2C,CAChE,IAAM,EAAQ,EAAM,MAAM,GACtB,OAAU,IAAA,IAAe,YAAa,EAC1C,OAAO,EAAM,OACf,CAEA,SAAS,EAAS,EAAsC,CACtD,IAAM,kBAAe,IAAI,IACzB,IAAK,IAAM,KAAS,EAAM,QAAS,CACjC,GAAI,EAAM,OAAS,WAAa,EAAM,UAAY,OAAS,EAAM,OAAS,eAAgB,SAC1F,IAAM,EAAW,EAAc,CAAK,EACpC,GAAI,IAAa,IAAA,GAAW,SAC5B,IAAM,EAAO,EAAa,IAAI,CAAQ,mBAAK,IAAI,IAC/C,EAAK,IAAI,EAAM,KAAK,EACpB,EAAa,IAAI,EAAU,CAAI,CACjC,CAEA,IAAM,EAAQ,CAAC,GAAG,EAAa,KAAK,CAAC,CAAC,CAAC,KAAK,EAC5C,OAAO,EAAM,IAAK,GAAa,CAC7B,IAAM,EAAW,EAAa,IAAI,CAAQ,EAGpC,EAAa,EAAY,UAAW,GAAU,EAAS,IAAI,CAAK,CAAC,EACvE,MAAO,CACL,WACA,OAAQ,EAAY,MAAM,CAAU,EACpC,WAAY,EAAc,EAAU,EAAM,OAAS,CAAC,CACtD,CACF,CAAC,CACH,CAGA,SAAS,EAAgB,EAA0B,CACjD,IAAM,EAAWC,EAAAA,MAAM,SAAS,EAAU,qBAAqB,EAC/D,OAAO,EAAS,WAAW,GAAG,EAAI,EAAW,KAAK,GACpD,CAEA,SAAS,EAAY,EAA8B,CACjD,IAAM,EAAS,EAAM,OAAO,IAAK,GAAU,IAAI,EAAM,EAAE,CAAC,CAAC,KAAK,IAAI,EAC5D,EAAS,EAAM,aAAe,MAAQ,GAAK,YAAY,EAAM,SAAS,QAC5E,MAAO,CACL,+BAA+B,EAAM,SAAS,MAAM,EAAO,MAC3D,gBAAgB,EAAM,WAAW,YAAY,EAAO,aACpD,GACA,gBAAgB,EAAM,WAAW,8BACjC,aAAa,EAAM,WAAW,SAC9B,gBAAgB,EAAM,SAAS,IAC/B,oEACA,uCACA,MACA,EACF,CACF,CAQA,SAAgB,EAAgB,EAAuB,EAA4C,CACjG,IAAM,EAAS,EAAS,CAAK,EACzB,KAAO,SAAW,EAWtB,MAAO,GAAG,CARR,gEACA,mFACA,4EACA,GACA,uBAAuB,EAAgB,EAAQ,UAAA,WAAyB,EAAE,IAC1E,GACA,GAAG,EAAO,QAAS,GAAU,EAAY,CAAK,CAAC,CAEnC,CAAC,CAAC,KAAK;CAAI,CAAC,CAAC,QAAQ,QAAS,EAAE,EAAE,GAClD"}
1
+ {"version":3,"file":"index.cjs","names":["toKebab","posix","require_index","node_path","SCOPE_ORDER","identifierFor","multiple","camel","basePath","word","index","baseSegmentOf","first","entry","mountsOf","scopesByBase","graph","held","bases","declared","shallowest","scope","routesSpecifier","relative","entryDir","renderMount","scopes","mount","suffix","renderApiClient","mounts","options"],"sources":["../../../src/services/renderClient/index.ts"],"sourcesContent":["import { posix } from 'node:path';\n\nimport { GENERATED_DIR } from '../../constants/layout';\nimport type { ExtensionEntry, ExtensionGraph, ExtensionScope } from '../../types/extensionGraph';\nimport { toKebab } from '../identity';\nimport type { RenderOptions } from '../renderEntry/type';\n\n/**\n * Renders the typed client a cockpit plugin calls its own API through.\n *\n * The two facts this injects are the two a package kept restating and getting\n * wrong: which scopes its API mounts at, and under which base path. Both are\n * read off the folder tree, so `api/file-edits/route.server.ts` at the session\n * scope is the whole declaration. A package that writes them out again is a\n * package that can disagree with itself, and several did.\n *\n * The route list is not read here. It is authored as plain data in\n * `src/types/apiRoutes.ts`, because this build evaluates no TypeScript and must\n * not learn how: it has no dependencies at all, and every specifier below is\n * emitted as text.\n */\n\nconst HEADER = '// Generated by @agimon-ai/doompi-build. Do not edit by hand.';\n\n/** Server scopes cascade outward-in, the way the generated server entry mounts them. */\nconst SCOPE_ORDER: readonly ExtensionScope[] = ['global', 'workspace', 'session'];\n\n/** One mount the tree declares: a base path, and the scopes it is reachable at. */\ninterface ClientMount {\n readonly basePath: string;\n readonly scopes: readonly ExtensionScope[];\n /** A valid identifier for the exported factory, when a package has several mounts. */\n readonly identifier: string;\n}\n\nfunction identifierFor(basePath: string, multiple: boolean): string {\n if (!multiple) return 'api';\n const camel = toKebab(basePath)\n .split('-')\n .filter((word) => word.length > 0)\n .map((word, index) => (index === 0 ? word : word[0]?.toUpperCase() + word.slice(1)))\n .join('');\n return /^[A-Za-z_]/u.test(camel) ? camel : `api${camel}`;\n}\n\n/**\n * The base path an api entry mounts at: the first literal segment below `api/`.\n *\n * An entry with no segment is the flat `api/route.server.ts` shape that predates\n * this convention. Its base path lives in a hand-written `DoomApi` the build\n * cannot read, so it contributes no client and keeps its hand-built URLs until\n * the folder is renamed.\n */\nfunction baseSegmentOf(entry: ExtensionEntry): string | undefined {\n const first = entry.route[0];\n if (first === undefined || !('literal' in first)) return undefined;\n return first.literal;\n}\n\nfunction mountsOf(graph: ExtensionGraph): ClientMount[] {\n const scopesByBase = new Map<string, Set<ExtensionScope>>();\n for (const entry of graph.entries) {\n if (entry.side !== 'backend' || entry.surface !== 'api' || entry.role !== 'contribution') continue;\n const basePath = baseSegmentOf(entry);\n if (basePath === undefined) continue;\n const held = scopesByBase.get(basePath) ?? new Set<ExtensionScope>();\n held.add(entry.scope);\n scopesByBase.set(basePath, held);\n }\n\n const bases = [...scopesByBase.keys()].sort();\n return bases.map((basePath) => {\n const declared = scopesByBase.get(basePath) as Set<ExtensionScope>;\n // A facet mounts a contribution at its own scope and every scope below it,\n // so a global API answers workspace and session requests too.\n const shallowest = SCOPE_ORDER.findIndex((scope) => declared.has(scope));\n return {\n basePath,\n scopes: SCOPE_ORDER.slice(shallowest),\n identifier: identifierFor(basePath, bases.length > 1),\n };\n });\n}\n\n/** The extensionless relative specifier from the generated directory to the route table. */\nfunction routesSpecifier(entryDir: string): string {\n const relative = posix.relative(entryDir, 'src/types/apiRoutes');\n return relative.startsWith('.') ? relative : `./${relative}`;\n}\n\nfunction renderMount(mount: ClientMount): string[] {\n const scopes = mount.scopes.map((scope) => `'${scope}'`).join(', ');\n const suffix = mount.identifier === 'api' ? '' : ` for the ${mount.basePath} mount`;\n return [\n `/** Scopes the tree mounts '${mount.basePath}' at${suffix}. */`,\n `export const ${mount.identifier}Scopes = [${scopes}] as const;`,\n '',\n `export const ${mount.identifier} = createApiClient(routes, {`,\n ` scopes: ${mount.identifier}Scopes,`,\n ` basePath: '${mount.basePath}',`,\n ' transport: (input, init) => sealedTransport.fetch(input, init),',\n ' sessionAddress: sessionApiAddress,',\n '});',\n '',\n ];\n}\n\n/**\n * The client source, or undefined when the tree declares no `api/<base-path>/`.\n *\n * `options.entryDir` is where the file will be written, so the relative import\n * of the route table is computed against it rather than assumed.\n */\nexport function renderApiClient(graph: ExtensionGraph, options: RenderOptions): string | undefined {\n const mounts = mountsOf(graph);\n if (mounts.length === 0) return undefined;\n\n const lines = [\n HEADER,\n \"import { createApiClient, sessionApiAddress } from '@agimon-ai/doompi-core/web';\",\n \"import { sealedTransport } from '@agimon-ai/doompi-web-security/browser';\",\n '',\n `import routes from '${routesSpecifier(options.entryDir ?? GENERATED_DIR)}';`,\n '',\n ...mounts.flatMap((mount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cG,EAAUU,EAAM,OAAS,CAAC,CACtD,CACF,CAAC,CACH,CAGA,SAASI,EAAgB,EAA0B,CACjD,IAAMC,EAAWtB,EAAAA,MAAM,SAASuB,EAAU,qBAAqB,EAC/D,OAAOD,EAAS,WAAW,GAAG,EAAIA,EAAW,KAAKA,GACpD,CAEA,SAASE,EAAY,EAA8B,CACjD,IAAMC,EAASC,EAAM,OAAO,IAAK,GAAU,IAAIN,EAAM,EAAE,CAAC,CAAC,KAAK,IAAI,EAC5DO,EAASD,EAAM,aAAe,MAAQ,GAAK,YAAYA,EAAM,SAAS,QAC5E,MAAO,CACL,+BAA+BA,EAAM,SAAS,MAAMC,EAAO,MAC3D,gBAAgBD,EAAM,WAAW,YAAYD,EAAO,aACpD,GACA,gBAAgBC,EAAM,WAAW,8BACjC,aAAaA,EAAM,WAAW,SAC9B,gBAAgBA,EAAM,SAAS,IAC/B,oEACA,uCACA,MACA,EACF,CACF,CAQA,SAAgBE,EAAgB,EAAuB,EAA4C,CACjG,IAAMC,EAAShB,EAASE,CAAK,EAC7B,GAAIc,EAAO,SAAW,EAWtB,MAAO,GAAG,CARR,gEACA,mFACA,4EACA,GACA,uBAAuBR,EAAgBS,EAAQ,UAAA,WAAyB,EAAE,IAC1E,GACA,GAAGD,EAAO,QAAS,GAAUL,EAAYE,CAAK,CAAC,CAEnC,CAAC,CAAC,KAAK;CAAI,CAAC,CAAC,QAAQ,QAAS,EAAE,EAAE,GAClD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/services/renderClient/index.ts"],"sourcesContent":["import { posix } from 'node:path';\n\nimport { GENERATED_DIR } from '../../constants/layout';\nimport type { ExtensionEntry, ExtensionGraph, ExtensionScope } from '../../types/extensionGraph';\nimport { toKebab } from '../identity';\nimport type { RenderOptions } from '../renderEntry/type';\n\n/**\n * Renders the typed client a cockpit plugin calls its own API through.\n *\n * The two facts this injects are the two a package kept restating and getting\n * wrong: which scopes its API mounts at, and under which base path. Both are\n * read off the folder tree, so `api/file-edits/route.server.ts` at the session\n * scope is the whole declaration. A package that writes them out again is a\n * package that can disagree with itself, and several did.\n *\n * The route list is not read here. It is authored as plain data in\n * `src/types/apiRoutes.ts`, because this build evaluates no TypeScript and must\n * not learn how: it has no dependencies at all, and every specifier below is\n * emitted as text.\n */\n\nconst HEADER = '// Generated by @agimon-ai/doompi-build. Do not edit by hand.';\n\n/** Server scopes cascade outward-in, the way the generated server entry mounts them. */\nconst SCOPE_ORDER: readonly ExtensionScope[] = ['global', 'workspace', 'session'];\n\n/** One mount the tree declares: a base path, and the scopes it is reachable at. */\ninterface ClientMount {\n readonly basePath: string;\n readonly scopes: readonly ExtensionScope[];\n /** A valid identifier for the exported factory, when a package has several mounts. */\n readonly identifier: string;\n}\n\nfunction identifierFor(basePath: string, multiple: boolean): string {\n if (!multiple) return 'api';\n const camel = toKebab(basePath)\n .split('-')\n .filter((word) => word.length > 0)\n .map((word, index) => (index === 0 ? word : word[0]?.toUpperCase() + word.slice(1)))\n .join('');\n return /^[A-Za-z_]/u.test(camel) ? camel : `api${camel}`;\n}\n\n/**\n * The base path an api entry mounts at: the first literal segment below `api/`.\n *\n * An entry with no segment is the flat `api/route.server.ts` shape that predates\n * this convention. Its base path lives in a hand-written `DoomApi` the build\n * cannot read, so it contributes no client and keeps its hand-built URLs until\n * the folder is renamed.\n */\nfunction baseSegmentOf(entry: ExtensionEntry): string | undefined {\n const first = entry.route[0];\n if (first === undefined || !('literal' in first)) return undefined;\n return first.literal;\n}\n\nfunction mountsOf(graph: ExtensionGraph): ClientMount[] {\n const scopesByBase = new Map<string, Set<ExtensionScope>>();\n for (const entry of graph.entries) {\n if (entry.side !== 'backend' || entry.surface !== 'api' || entry.role !== 'contribution') continue;\n const basePath = baseSegmentOf(entry);\n if (basePath === undefined) continue;\n const held = scopesByBase.get(basePath) ?? new Set<ExtensionScope>();\n held.add(entry.scope);\n scopesByBase.set(basePath, held);\n }\n\n const bases = [...scopesByBase.keys()].sort();\n return bases.map((basePath) => {\n const declared = scopesByBase.get(basePath) as Set<ExtensionScope>;\n // A facet mounts a contribution at its own scope and every scope below it,\n // so a global API answers workspace and session requests too.\n const shallowest = SCOPE_ORDER.findIndex((scope) => declared.has(scope));\n return {\n basePath,\n scopes: SCOPE_ORDER.slice(shallowest),\n identifier: identifierFor(basePath, bases.length > 1),\n };\n });\n}\n\n/** The extensionless relative specifier from the generated directory to the route table. */\nfunction routesSpecifier(entryDir: string): string {\n const relative = posix.relative(entryDir, 'src/types/apiRoutes');\n return relative.startsWith('.') ? relative : `./${relative}`;\n}\n\nfunction renderMount(mount: ClientMount): string[] {\n const scopes = mount.scopes.map((scope) => `'${scope}'`).join(', ');\n const suffix = mount.identifier === 'api' ? '' : ` for the ${mount.basePath} mount`;\n return [\n `/** Scopes the tree mounts '${mount.basePath}' at${suffix}. */`,\n `export const ${mount.identifier}Scopes = [${scopes}] as const;`,\n '',\n `export const ${mount.identifier} = createApiClient(routes, {`,\n ` scopes: ${mount.identifier}Scopes,`,\n ` basePath: '${mount.basePath}',`,\n ' transport: (input, init) => sealedTransport.fetch(input, init),',\n ' sessionAddress: sessionApiAddress,',\n '});',\n '',\n ];\n}\n\n/**\n * The client source, or undefined when the tree declares no `api/<base-path>/`.\n *\n * `options.entryDir` is where the file will be written, so the relative import\n * of the route table is computed against it rather than assumed.\n */\nexport function renderApiClient(graph: ExtensionGraph, options: RenderOptions): string | undefined {\n const mounts = mountsOf(graph);\n if (mounts.length === 0) return undefined;\n\n const lines = [\n HEADER,\n \"import { createApiClient, sessionApiAddress } from '@agimon-ai/doompi-core/web';\",\n \"import { sealedTransport } from '@agimon-ai/doompi-web-security/browser';\",\n '',\n `import routes from '${routesSpecifier(options.entryDir ?? GENERATED_DIR)}';`,\n '',\n ...mounts.flatMap((mount) => renderMount(mount)),\n ];\n return `${lines.join('\\n').replace(/\\n+$/u, '')}\\n`;\n}\n"],"mappings":"qHAsBA,MAGM,EAAyC,CAAC,SAAU,YAAa,SAAS,EA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AY,EAA8B,CACjD,IAAM,EAAS,EAAM,OAAO,IAAK,GAAU,IAAI,EAAM,EAAE,CAAC,CAAC,KAAK,IAAI,EAC5D,EAAS,EAAM,aAAe,MAAQ,GAAK,YAAY,EAAM,SAAS,QAC5E,MAAO,CACL,+BAA+B,EAAM,SAAS,MAAM,EAAO,MAC3D,gBAAgB,EAAM,WAAW,YAAY,EAAO,aACpD,GACA,gBAAgB,EAAM,WAAW,8BACjC,aAAa,EAAM,WAAW,SAC9B,gBAAgB,EAAM,SAAS,IAC/B,oEACA,uCACA,MACA,EACF,CACF,CAQA,SAAgB,EAAgB,EAAuB,EAA4C,CACjG,IAAM,EAAS,EAAS,CAAK,EACzB,KAAO,SAAW,EAWtB,MAAO,GAAG,CARR,gEACA,mFACA,4EACA,GACA,uBAAuB,EAAgB,EAAQ,UAAA,WAAyB,EAAE,IAC1E,GACA,GAAG,EAAO,QAAS,GAAU,EAAY,CAAK,CAAC,CAEnC,CAAC,CAAC,KAAK;CAAI,CAAC,CAAC,QAAQ,QAAS,EAAE,EAAE,GAClD"}
1
+ {"version":3,"file":"index.mjs","names":["SCOPE_ORDER","identifierFor","multiple","camel","toKebab","basePath","word","index","baseSegmentOf","first","entry","mountsOf","scopesByBase","graph","held","bases","declared","shallowest","scope","routesSpecifier","relative","posix","entryDir","renderMount","scopes","mount","suffix","renderApiClient","mounts","options"],"sources":["../../../src/services/renderClient/index.ts"],"sourcesContent":["import { posix } from 'node:path';\n\nimport { GENERATED_DIR } from '../../constants/layout';\nimport type { ExtensionEntry, ExtensionGraph, ExtensionScope } from '../../types/extensionGraph';\nimport { toKebab } from '../identity';\nimport type { RenderOptions } from '../renderEntry/type';\n\n/**\n * Renders the typed client a cockpit plugin calls its own API through.\n *\n * The two facts this injects are the two a package kept restating and getting\n * wrong: which scopes its API mounts at, and under which base path. Both are\n * read off the folder tree, so `api/file-edits/route.server.ts` at the session\n * scope is the whole declaration. A package that writes them out again is a\n * package that can disagree with itself, and several did.\n *\n * The route list is not read here. It is authored as plain data in\n * `src/types/apiRoutes.ts`, because this build evaluates no TypeScript and must\n * not learn how: it has no dependencies at all, and every specifier below is\n * emitted as text.\n */\n\nconst HEADER = '// Generated by @agimon-ai/doompi-build. Do not edit by hand.';\n\n/** Server scopes cascade outward-in, the way the generated server entry mounts them. */\nconst SCOPE_ORDER: readonly ExtensionScope[] = ['global', 'workspace', 'session'];\n\n/** One mount the tree declares: a base path, and the scopes it is reachable at. */\ninterface ClientMount {\n readonly basePath: string;\n readonly scopes: readonly ExtensionScope[];\n /** A valid identifier for the exported factory, when a package has several mounts. */\n readonly identifier: string;\n}\n\nfunction identifierFor(basePath: string, multiple: boolean): string {\n if (!multiple) return 'api';\n const camel = toKebab(basePath)\n .split('-')\n .filter((word) => word.length > 0)\n .map((word, index) => (index === 0 ? word : word[0]?.toUpperCase() + word.slice(1)))\n .join('');\n return /^[A-Za-z_]/u.test(camel) ? camel : `api${camel}`;\n}\n\n/**\n * The base path an api entry mounts at: the first literal segment below `api/`.\n *\n * An entry with no segment is the flat `api/route.server.ts` shape that predates\n * this convention. Its base path lives in a hand-written `DoomApi` the build\n * cannot read, so it contributes no client and keeps its hand-built URLs until\n * the folder is renamed.\n */\nfunction baseSegmentOf(entry: ExtensionEntry): string | undefined {\n const first = entry.route[0];\n if (first === undefined || !('literal' in first)) return undefined;\n return first.literal;\n}\n\nfunction mountsOf(graph: ExtensionGraph): ClientMount[] {\n const scopesByBase = new Map<string, Set<ExtensionScope>>();\n for (const entry of graph.entries) {\n if (entry.side !== 'backend' || entry.surface !== 'api' || entry.role !== 'contribution') continue;\n const basePath = baseSegmentOf(entry);\n if (basePath === undefined) continue;\n const held = scopesByBase.get(basePath) ?? new Set<ExtensionScope>();\n held.add(entry.scope);\n scopesByBase.set(basePath, held);\n }\n\n const bases = [...scopesByBase.keys()].sort();\n return bases.map((basePath) => {\n const declared = scopesByBase.get(basePath) as Set<ExtensionScope>;\n // A facet mounts a contribution at its own scope and every scope below it,\n // so a global API answers workspace and session requests too.\n const shallowest = SCOPE_ORDER.findIndex((scope) => declared.has(scope));\n return {\n basePath,\n scopes: SCOPE_ORDER.slice(shallowest),\n identifier: identifierFor(basePath, bases.length > 1),\n };\n });\n}\n\n/** The extensionless relative specifier from the generated directory to the route table. */\nfunction routesSpecifier(entryDir: string): string {\n const relative = posix.relative(entryDir, 'src/types/apiRoutes');\n return relative.startsWith('.') ? relative : `./${relative}`;\n}\n\nfunction renderMount(mount: ClientMount): string[] {\n const scopes = mount.scopes.map((scope) => `'${scope}'`).join(', ');\n const suffix = mount.identifier === 'api' ? '' : ` for the ${mount.basePath} mount`;\n return [\n `/** Scopes the tree mounts '${mount.basePath}' at${suffix}. */`,\n `export const ${mount.identifier}Scopes = [${scopes}] as const;`,\n '',\n `export const ${mount.identifier} = createApiClient(routes, {`,\n ` scopes: ${mount.identifier}Scopes,`,\n ` basePath: '${mount.basePath}',`,\n ' transport: (input, init) => sealedTransport.fetch(input, init),',\n ' sessionAddress: sessionApiAddress,',\n '});',\n '',\n ];\n}\n\n/**\n * The client source, or undefined when the tree declares no `api/<base-path>/`.\n *\n * `options.entryDir` is where the file will be written, so the relative import\n * of the route table is computed against it rather than assumed.\n */\nexport function renderApiClient(graph: ExtensionGraph, options: RenderOptions): string | undefined {\n const mounts = mountsOf(graph);\n if (mounts.length === 0) return undefined;\n\n const lines = [\n HEADER,\n \"import { createApiClient, sessionApiAddress } from '@agimon-ai/doompi-core/web';\",\n \"import { sealedTransport } from '@agimon-ai/doompi-web-security/browser';\",\n '',\n `import routes from '${routesSpecifier(options.entryDir ?? GENERATED_DIR)}';`,\n '',\n ...mounts.flatMap((mount) => renderMount(mount)),\n ];\n return `${lines.join('\\n').replace(/\\n+$/u, '')}\\n`;\n}\n"],"mappings":"qHAsBA,MAGMA,EAAyC,CAAC,SAAU,YAAa,SAAS,EAUhF,SAASC,EAAc,EAAkB,EAA2B,CAClE,GAAI,CAACC,EAAU,MAAO,MACtB,IAAMC,EAAQC,EAAQC,CAA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