farseer-cli 1.17.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/README.md +3 -3
  2. package/dist/commands/app.js.map +0 -1
  3. package/dist/commands/apps.js.map +0 -1
  4. package/dist/commands/cells.js.map +0 -1
  5. package/dist/commands/code.js.map +0 -1
  6. package/dist/commands/config.js.map +0 -1
  7. package/dist/commands/dashboards.js.map +0 -1
  8. package/dist/commands/diff.js.map +0 -1
  9. package/dist/commands/dimensions.js.map +0 -1
  10. package/dist/commands/files.js.map +0 -1
  11. package/dist/commands/formula.js +16 -7
  12. package/dist/commands/formula.js.map +1 -2
  13. package/dist/commands/install.js.map +0 -1
  14. package/dist/commands/list.js.map +0 -1
  15. package/dist/commands/login.js +3 -3
  16. package/dist/commands/login.js.map +1 -2
  17. package/dist/commands/logout.js.map +0 -1
  18. package/dist/commands/mcp-server.js.map +0 -1
  19. package/dist/commands/model.js.map +0 -1
  20. package/dist/commands/pipeline.js.map +0 -1
  21. package/dist/commands/pull.js +1 -1
  22. package/dist/commands/pull.js.map +1 -2
  23. package/dist/commands/push.js +2 -2
  24. package/dist/commands/push.js.map +1 -2
  25. package/dist/commands/refresh.js.map +0 -1
  26. package/dist/commands/run.js.map +0 -1
  27. package/dist/commands/sheets.js.map +0 -1
  28. package/dist/commands/status.js.map +0 -1
  29. package/dist/commands/tool.js +120 -0
  30. package/dist/commands/tool.js.map +6 -0
  31. package/dist/commands/variables.js.map +0 -1
  32. package/dist/commands/whoami.js.map +0 -1
  33. package/dist/index.js +29 -12
  34. package/dist/index.js.map +1 -2
  35. package/dist/mcp/index.js.map +0 -1
  36. package/dist/mcp/prompts/workflows.js.map +0 -1
  37. package/dist/mcp/resources/documentation.js.map +0 -1
  38. package/dist/mcp/server.js.map +0 -1
  39. package/dist/mcp/skills.js.map +0 -1
  40. package/dist/mcp/tools/appTools.js.map +0 -1
  41. package/dist/mcp/tools/authTools.js +1 -1
  42. package/dist/mcp/tools/authTools.js.map +1 -2
  43. package/dist/mcp/tools/cellTools.js.map +0 -1
  44. package/dist/mcp/tools/dashboardTools.js.map +0 -1
  45. package/dist/mcp/tools/dataTools.js.map +0 -1
  46. package/dist/mcp/tools/folderTools.js.map +0 -1
  47. package/dist/mcp/tools/modelTools.js +65 -23
  48. package/dist/mcp/tools/modelTools.js.map +2 -3
  49. package/dist/mcp/tools/pipelineContract.js.map +0 -1
  50. package/dist/mcp/tools/pipelineTools.js.map +0 -1
  51. package/dist/mcp/tools/runTools.js +6 -2
  52. package/dist/mcp/tools/runTools.js.map +1 -2
  53. package/dist/mcp/tools/sheetTools.js.map +0 -1
  54. package/dist/mcp/tools/syncTools.js +2 -2
  55. package/dist/mcp/tools/syncTools.js.map +1 -2
  56. package/dist/mcp/utils/helpers.js.map +0 -1
  57. package/dist/mcp/utils/launchPin.js +1 -1
  58. package/dist/mcp/utils/launchPin.js.map +1 -2
  59. package/dist/mcp/utils/registerTool.js.map +0 -1
  60. package/dist/mcp/utils/session.js.map +0 -1
  61. package/dist/mcp/utils/tenantPin.js.map +0 -1
  62. package/dist/pipeline/compatibility.js.map +0 -1
  63. package/dist/pipeline/connect.js.map +0 -1
  64. package/dist/pipeline/create.js.map +0 -1
  65. package/dist/pipeline/errors.js.map +0 -1
  66. package/dist/pipeline/generated-reference.json +22 -10
  67. package/dist/pipeline/guide.js.map +0 -1
  68. package/dist/pipeline/init.js.map +0 -1
  69. package/dist/pipeline/operations.js.map +0 -1
  70. package/dist/pipeline/query.js.map +0 -1
  71. package/dist/pipeline/queryDownloads.js.map +0 -1
  72. package/dist/pipeline/queryWorker.js.map +0 -1
  73. package/dist/pipeline/readiness.js.map +0 -1
  74. package/dist/pipeline/reference.js.map +0 -1
  75. package/dist/pipeline/requests.js.map +0 -1
  76. package/dist/pipeline/runArguments.js.map +0 -1
  77. package/dist/pipeline/runtime.js.map +0 -1
  78. package/dist/pipeline/service.js.map +0 -1
  79. package/dist/services/agentApprovalFetch.js +7 -3
  80. package/dist/services/agentApprovalFetch.js.map +1 -2
  81. package/dist/services/appSyncService.js.map +0 -1
  82. package/dist/services/apps.js.map +0 -1
  83. package/dist/services/authErrors.js.map +0 -1
  84. package/dist/services/codefirst/api.js +38 -5
  85. package/dist/services/codefirst/api.js.map +1 -2
  86. package/dist/services/codefirst/binaryDisk.js.map +0 -1
  87. package/dist/services/codefirst/byteHashes.js +5 -0
  88. package/dist/services/codefirst/byteHashes.js.map +1 -2
  89. package/dist/services/codefirst/documents.js +41 -15
  90. package/dist/services/codefirst/documents.js.map +1 -2
  91. package/dist/services/codefirst/layoutBinaryProjection.js +24 -13
  92. package/dist/services/codefirst/layoutBinaryProjection.js.map +1 -2
  93. package/dist/services/codefirst/layoutCompose.js +44 -38
  94. package/dist/services/codefirst/layoutCompose.js.map +1 -2
  95. package/dist/services/codefirst/layoutCore.js +14 -1
  96. package/dist/services/codefirst/layoutCore.js.map +1 -2
  97. package/dist/services/codefirst/layoutPaths.js +80 -4
  98. package/dist/services/codefirst/layoutPaths.js.map +1 -2
  99. package/dist/services/codefirst/layoutProjection.js +73 -39
  100. package/dist/services/codefirst/layoutProjection.js.map +1 -2
  101. package/dist/services/codefirst/layoutReadback.js +357 -130
  102. package/dist/services/codefirst/layoutReadback.js.map +2 -3
  103. package/dist/services/codefirst/layoutReadbackPlacement.js +94 -57
  104. package/dist/services/codefirst/layoutReadbackPlacement.js.map +2 -3
  105. package/dist/services/codefirst/layoutReceipt.js +283 -243
  106. package/dist/services/codefirst/layoutReceipt.js.map +2 -3
  107. package/dist/services/codefirst/layoutScan.js +208 -110
  108. package/dist/services/codefirst/layoutScan.js.map +1 -2
  109. package/dist/services/codefirst/output.js +76 -10
  110. package/dist/services/codefirst/output.js.map +1 -2
  111. package/dist/services/codefirst/types.js.map +0 -1
  112. package/dist/services/codefirst/workflow.js +65 -29
  113. package/dist/services/codefirst/workflow.js.map +2 -3
  114. package/dist/services/codefirst/workspace.js.map +0 -1
  115. package/dist/services/codefirst/workspaceLock.js.map +0 -1
  116. package/dist/services/codefirst/workspaceRoot.js +2 -1
  117. package/dist/services/codefirst/workspaceRoot.js.map +1 -2
  118. package/dist/services/configService.js.map +0 -1
  119. package/dist/services/credentials.js.map +0 -1
  120. package/dist/services/farseerService.js +3 -1
  121. package/dist/services/farseerService.js.map +1 -2
  122. package/dist/services/httpError.js.map +0 -1
  123. package/dist/services/modelExport.js.map +0 -1
  124. package/dist/services/organisation.js.map +0 -1
  125. package/dist/services/preflight.js.map +0 -1
  126. package/dist/services/realms.js.map +0 -1
  127. package/dist/services/syncService.js +3 -3
  128. package/dist/services/syncService.js.map +1 -2
  129. package/dist/skills/pipeline.js.map +0 -1
  130. package/dist/utils/agentSandbox.js.map +0 -1
  131. package/dist/utils/cliOptions.js.map +0 -1
  132. package/dist/utils/constants.js.map +0 -1
  133. package/dist/utils/entityResolver.js.map +0 -1
  134. package/dist/utils/errorFormatter.js +59 -11
  135. package/dist/utils/errorFormatter.js.map +1 -2
  136. package/dist/utils/fileLogger.js.map +0 -1
  137. package/dist/utils/fileValidation.js.map +0 -1
  138. package/dist/utils/folderMatch.js.map +0 -1
  139. package/dist/utils/formulaFilters.js +48 -0
  140. package/dist/utils/formulaFilters.js.map +6 -0
  141. package/dist/utils/helpers.js.map +0 -1
  142. package/dist/utils/logger.js.map +0 -1
  143. package/dist/utils/nameResolver.js.map +0 -1
  144. package/dist/utils/packageManager.js.map +0 -1
  145. package/dist/utils/syncReporting.js.map +0 -1
  146. package/dist/utils/syncScope.js.map +0 -1
  147. package/dist/utils/updateCheck.js.map +0 -1
  148. package/dist/utils/variableValues.js.map +0 -1
  149. package/dist/utils/workspace.js.map +0 -1
  150. package/docs/cli-guide.md +14 -1
  151. package/docs/import-workflows.md +14 -14
  152. package/docs/new-app-template.md +1 -1
  153. package/docs/pipeline-client-guide.md +1 -1
  154. package/docs/pipeline-reference.md +292 -3
  155. package/package.json +2 -2
  156. package/skills/farseer-analysis/SKILL.md +132 -0
  157. package/skills/farseer-dashboards/SKILL.md +40 -0
  158. package/skills/farseer-formulas/SKILL.md +165 -0
  159. package/skills/farseer-model/SKILL.md +119 -0
  160. package/skills/pipeline-authoring/SKILL.md +6 -4
  161. package/skills/pipeline-authoring/practices.md +6 -5
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/mcp/tools/syncTools.ts"],
4
- "sourcesContent": ["/**\n * File Synchronization Tools\n *\n * Tools for syncing files between local repository and Farseer instance.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { registerTool } from '../utils/registerTool';\nimport { z } from 'zod';\nimport { createPatch } from 'diff';\nimport { SyncService } from '../../services/syncService';\nimport { AppSyncService } from '../../services/appSyncService';\nimport { requireSession } from '../utils/session';\nimport { successResponse, errorResponse } from '../utils/helpers';\nimport { formatClientError } from '../../utils/errorFormatter';\nimport { normalizeExtensions } from '../../utils/cliOptions';\n\n/**\n * Format a category breakdown for the MCP summary string when\n * `ignoredLocal` is non-empty. Agents quote the summary verbatim back\n * to users, so the breakdown has to fit on one line and stay readable\n * without the structured array.\n *\n * Examples:\n * - \"5 with unsupported extension\"\n * - \"3 in blocklisted folders\"\n * - \"5 with unsupported extension, 3 in blocklisted folders\"\n *\n * Takes the UNCAPPED per-reason totals tracked during the walk, not\n * counts from the stored slice. The slice is capped at\n * `IGNORED_LOCAL_CAP` to bound memory, so counting it would give the\n * user a number that disagrees with the headline \u2014 e.g. headline\n * \"250 outside scope\" with breakdown \"100 with unsupported extension\"\n * when all 250 are unsupported-extension files.\n *\n * Returns an empty string when both totals are zero; the caller still\n * gates on `total > 0` and falls back to a plain pointer when this\n * comes back empty.\n */\nfunction summariseIgnoredReasons(totals: { unsupportedExtension: number; blocklistedFolder: number }): string {\n const parts: string[] = [];\n if (totals.unsupportedExtension > 0) parts.push(`${totals.unsupportedExtension} with unsupported extension`);\n if (totals.blocklistedFolder > 0) parts.push(`${totals.blocklistedFolder} in blocklisted folders`);\n return parts.join(', ');\n}\n\n// Define schemas outside of tool registration to avoid deep type instantiation\n//\n// `includeExtensions` and `includeFolders` mirror the CLI's `--include-ext` /\n// `--include-folder` flags. Without them on the MCP surface, an agent could\n// only choose between the default scope and \"all\" \u2014 there was no way to\n// scope a pull/push/status to \"default plus this one folder\" the way a CLI\n// user can.\nconst includeExtensionsSchema = z\n .array(z.string())\n .optional()\n .describe(\n 'Extra file extensions to include alongside the default scope (developer files ' +\n '(.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist). ' +\n 'Data files (.csv, .xlsx, .parquet, \u2026) are backend-accepted but excluded from default \u2014 ' +\n 'opt in here (e.g. [\"csv\"]). Supply with or without leading dot (\".csv\" or \"csv\") \u2014 ' +\n \"both work; the handler normalises before matching. Mirrors the CLI's --include-ext flag.\",\n );\nconst includeFoldersSchema = z\n .array(z.string())\n .optional()\n .describe(\n 'Extra folder paths whose files (any extension) are included alongside the default scope. ' +\n 'Useful for opting into hidden or blocklisted folders. Each path is interpreted ' +\n 'relative to the tenant root, e.g. \"Data\" or \".vscode\" or \"dist\". ' +\n \"Mirrors the CLI's --include-folder flag.\",\n );\n\nconst pullSchema = {\n all: z\n .boolean()\n .optional()\n .describe(\n 'Pull every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, ' +\n '.yml, .yaml, .md, .json) outside hidden directories and the folder blocklist). Data files ' +\n '(.csv, .xlsx, .parquet, \u2026) are backend-accepted but excluded from default \u2014 opt in ' +\n 'via includeExtensions (e.g. [\"csv\"]) or pass all=true to broaden everything.',\n ),\n force: z\n .boolean()\n .optional()\n .describe(\n 'DESTRUCTIVE \u2014 overwrites EVERY locally-modified file with the remote version, including ' +\n \"local edits that have no remote conflict (e.g. a file you've been editing but the remote \" +\n 'is still on the baseline version). Use only when the user has explicitly asked to ' +\n 'discard local changes. Does NOT delete local-only files (that destructive wipe stays ' +\n 'on the CLI side behind the interactive confirm prompt).',\n ),\n includeExtensions: includeExtensionsSchema,\n includeFolders: includeFoldersSchema,\n};\n\nconst pushSchema = {\n force: z\n .boolean()\n .optional()\n .describe(\n 'Skip the drift check and overwrite remote even if it diverged from baseline. ' +\n 'Does NOT delete remote-only files; pass mirror=true for that.',\n ),\n mirror: z\n .boolean()\n .optional()\n .describe(\n 'Also delete remote files that have no local counterpart \u2014 destructive \"make remote = local\" semantics. ' +\n \"Implies the upload step still respects the user's local presence, so this only fires for files \" +\n 'genuinely missing locally. Combine with force=true if the drift check would otherwise refuse the push.',\n ),\n all: z\n .boolean()\n .optional()\n .describe(\n 'Push every non-hidden, non-blocklisted file (default: developer files (.ts, .js, .py, ' +\n '.yml, .yaml, .md, .json) outside hidden directories and the folder blocklist). Data files ' +\n '(.csv, .xlsx, .parquet, \u2026) are backend-accepted but excluded from default \u2014 opt in ' +\n 'via includeExtensions. Hidden files / blocklisted folders still require explicit ' +\n 'opt-in via includeFolders.',\n ),\n includeExtensions: includeExtensionsSchema,\n includeFolders: includeFoldersSchema,\n};\n\nconst statusSchema = {\n all: z\n .boolean()\n .optional()\n .describe(\n 'Show status for every non-hidden, non-blocklisted file (default: developer files ' +\n '(.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder blocklist). ' +\n 'Data files (.csv, .xlsx, .parquet, \u2026) are backend-accepted but excluded from default \u2014 ' +\n 'opt in via includeExtensions (e.g. [\"csv\"]) or pass all=true to broaden everything.',\n ),\n // Deep is the default \u2014 matches the CLI's `farseer status` behaviour\n // (deep-by-default since 1.6.2). Agents should pass `shallow: true`\n // only when they have independent reason to trust the last-pull\n // baseline (e.g. checking immediately after a successful pull) and\n // want the faster path on a large tenant.\n shallow: z\n .boolean()\n .optional()\n .describe(\n 'Skip remote-content hashing. Faster on big tenants but cannot detect remote-side edits to existing ' +\n 'files made since the last pull. Default is deep \u2014 every remote file is hashed.',\n ),\n // Backwards-compat alias for callers written against the 1.6.1 MCP\n // schema, where deep=false was the fast-path opt-out. We map it to\n // shallow internally; if both are passed, shallow wins (explicit\n // opt-out beats the legacy positive). New callers should use shallow.\n deep: z\n .boolean()\n .optional()\n .describe(\n '(Deprecated) Backwards-compat alias for the pre-1.6.2 fast-path control. ' +\n 'Pass shallow=true instead. If both are supplied, shallow takes precedence.',\n ),\n includeExtensions: includeExtensionsSchema,\n includeFolders: includeFoldersSchema,\n};\n\nconst diffSchema = {\n file: z.string().optional().describe('Specific file path to diff. If omitted, shows all differences.'),\n showRemote: z.boolean().optional().describe('Show only the remote content instead of diff'),\n};\n\nconst listFilesSchema = {\n all: z\n .boolean()\n .optional()\n .describe(\n 'By default, lists files with script extensions only (.ts, .js, .mjs, .cjs), matching ' +\n \"the CLI's `farseer files list`. This is NARROWER than the default sync scope used \" +\n 'by farseer_pull/status/push. Set all=true to list every file on the remote.',\n ),\n};\n\nexport function registerSyncTools(server: McpServer): void {\n // farseer_pull - Download files from remote\n registerTool(\n server,\n 'farseer_pull',\n `Pull (download) files and app configurations from a Farseer instance to the local repository.\n\nFor a prepared data pipeline, use farseer_pipeline operation=pull to sync that pipeline's source scope. Start with operation=guide topic=method when authoring a pipeline.\n\nWhat gets pulled:\n- Files from the tenant Files/ folder (searched recursively)\n- App configurations (saved as JSON in apps/ folder)\n\nFiles are saved to: farseer-apps/<tenant>/files/\nApps are saved to: farseer-apps/<tenant>/apps/\n\nDefault sync scope: developer files (.ts, .js, .py, .yml, .yaml, .md, .json) that sit\noutside hidden directories (.git/, .vscode/, .env*) and the folder blocklist\n(node_modules/, dist/, build/, vendor/, target/, tmp/, \u2026). Data files (.csv,\n.xlsx, .parquet, .pdf, images, \u2026) are backend-accepted but EXCLUDED from default\n\u2014 opt in via includeExtensions (e.g. [\"csv\"]). Hidden paths and blocklisted\nfolders require explicit opt-in.\nUse all=true to broaden the scope to every non-hidden, non-blocklisted file\n(extensions outside the backend whitelist, files with no extension, etc.).\nUse includeExtensions / includeFolders to broaden the scope without pulling everything\n(e.g. includeFolders=[\".vscode\"] adds the .vscode folder regardless of extension).\nThese mirror the CLI's --include-ext / --include-folder flags and are additive on\ntop of the default scope.\n\nConflict handling:\n- Per-file conflict resolution (keep_local / keep_remote / keep_both / merge_markers)\n is CLI-only \u2014 it requires an interactive prompt and the MCP can't answer one.\n- The MCP path returns conflicts in response.conflicts[] so the agent can re-pull\n with force=true once the user has confirmed they want to discard their edits.\n- force=true is DESTRUCTIVE: it overwrites every locally-modified file with the\n remote version (even local edits that don't conflict with remote). It does NOT\n wipe local-only files (that destructive step lives behind the CLI's confirm prompt).\n Only pass force=true when the user has explicitly accepted losing local changes.\n\nSync includes (middle ground between the default scope and all):\n- Users can configure extra extensions and folders via \"farseer config include\" CLI command\n- These are stored per-tenant in ~/.farseer/config.json under \"syncIncludes\"\n- When configured, pull/push/status automatically include those files alongside the default scope\n- Example: syncIncludes may add extra extensions or otherwise blocklisted folders like \"dist\" or \".vscode\"\n- The sync includes are respected automatically \u2014 no extra parameters needed here`,\n pullSchema,\n async (params: { all?: boolean; force?: boolean; includeExtensions?: string[]; includeFolders?: string[] }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { organisation, tenant, client, authType } = gate.session;\n\n try {\n // Pull files (use tenant for folder path).\n // Normalise extensions: agents pass them with or without a\n // leading dot (\".json\" vs \"json\"), but downstream comparisons\n // are against `path.extname()` which always has a dot.\n // Without this, includeExtensions=[\"json\"] would silently\n // never match anything.\n const syncService = new SyncService(tenant, client);\n const fileResult = await syncService.pull({\n all: params.all,\n force: params.force,\n includeExtensions: params.includeExtensions\n ? normalizeExtensions(params.includeExtensions)\n : undefined,\n includeFolders: params.includeFolders,\n });\n\n // Pull apps (only with JWT auth)\n let appResult = null;\n if (authType === 'jwt') {\n const appSyncService = new AppSyncService(tenant, client);\n appResult = await appSyncService.pull();\n }\n\n const response: Record<string, any> = {\n tenant,\n organisation,\n files: {\n downloaded: fileResult.downloaded,\n deleted: fileResult.deleted,\n unchanged: fileResult.unchanged.length,\n },\n apps: appResult\n ? {\n created: appResult.created,\n updated: appResult.updated,\n deleted: appResult.deleted,\n unchanged: appResult.unchanged.length,\n }\n : { note: 'App sync requires browser login (JWT)' },\n message: `Pulled ${fileResult.downloaded.length} files${appResult ? ` and ${appResult.created.length + appResult.updated.length} apps` : ''}`,\n };\n\n if (fileResult.conflicts.length > 0) {\n response.conflicts = fileResult.conflicts.map((c) => ({\n file: c.filePath,\n type: c.type,\n description: c.description,\n }));\n response.message = `Pulled ${fileResult.downloaded.length} files but ${fileResult.conflicts.length} conflict(s) need resolution`;\n response.hint =\n 'Use force=true to overwrite local changes, or resolve conflicts via CLI: farseer pull <tenant>';\n }\n\n if (fileResult.conflictFilesWritten.length > 0) {\n response.conflictFilesWritten = fileResult.conflictFilesWritten;\n }\n\n return successResponse(response);\n } catch (error) {\n return errorResponse(`Pull failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_push - Upload files to remote\n registerTool(\n server,\n 'farseer_push',\n `Push (upload) local file and app changes to a Farseer instance.\n\nFor a prepared data pipeline, use farseer_pipeline operation=push to sync that pipeline's source scope. Start with operation=guide topic=method when authoring a pipeline.\n\nWhat gets pushed:\n- New/modified files from farseer-apps/<tenant>/files/ (filtered by sync scope \u2014\n default is developer files (.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories\n and the folder blocklist. Data files like .csv / .xlsx / .parquet are backend-accepted\n but excluded from default; broaden via includeExtensions / includeFolders / all on\n this tool, or via persistent sync includes set with the CLI's \"farseer config include\").\n- New/modified app configurations from farseer-apps/<tenant>/apps/.\n- Deleted files (when they were previously synced \u2014 preserves \"I rm'd this\" semantics).\n\nPre-flight (runs before any HTTP call):\n- Refuses files the backend would refuse anyway: extension not on whitelist,\n filename longer than 256 chars, empty body, unresolved git-style merge markers\n (<<<<<<< LOCAL / ======= / >>>>>>> REMOTE) left over from a merge_markers pull.\n- Returns rejected files in the response. If every candidate is rejected (and\n no deletes/updates either), the tool call returns VALIDATION_ERROR.\n\nDrift / mirror semantics:\n- force=true skips the drift check (push over remote-side adds/deletes).\n- mirror=true (separate param) also deletes remote files that have no local\n counterpart, within the current sync scope. Combine with force when both are\n needed.\n\nOut-of-scope files (e.g. a hidden .vscode/settings.json next to in-scope files)\nare INVISIBLE to push \u2014 never uploaded, never deleted. Hidden paths require\nexplicit opt-in via --include-folder (extension includes never widen scope to\nhidden files \u2014 that would let a generic .json broadening leak credentials).\n\nSilent-skip signal: \\`files.ignoredLocal\\` is an array of\n\\`{ path, reason }\\` entries listing non-hidden user files that exist on\ndisk but were outside the active sync scope and therefore NOT pushed.\n\\`reason\\` is one of:\n - \\`unsupportedExtension\\`: file extension isn't in default scope (e.g.\n .csv, .md). Tell the user to broaden with \\`--include-ext <ext>\\`.\n - \\`blocklistedFolder\\`: file is in a tooling-output folder (node_modules/,\n dist/, build/). These are almost never user content \u2014 warn the user\n that opting in is unusual instead of suggesting the flag outright.\n\\`files.ignoredLocalTotal\\` carries the uncapped count when the list was\ntruncated. Hidden files (.env, .git/, .vscode/) never appear here \u2014 the\nresponse does not advertise widening scope to include them. Use this list to\ndetect \"push succeeded but my local .csv / .md / .py files weren't sent\"\nbefore reporting success to the user.\n\nSync includes: if user configured via \"farseer config include\", drift and scope\nchecks respect those settings automatically.`,\n pushSchema,\n async (params: {\n force?: boolean;\n mirror?: boolean;\n all?: boolean;\n includeExtensions?: string[];\n includeFolders?: string[];\n }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { organisation, tenant, client, authType } = gate.session;\n\n try {\n const syncService = new SyncService(tenant, client);\n\n // Normalise extensions once: agents may pass them dotless\n // (\"json\" vs \".json\"), but downstream comparisons are\n // against `path.extname()` which always has a dot. Build\n // the scope once and reuse it so the drift check and push\n // run in identical scope.\n const scopeOptions = {\n all: params.all,\n includeExtensions: params.includeExtensions\n ? normalizeExtensions(params.includeExtensions)\n : undefined,\n includeFolders: params.includeFolders,\n };\n\n // Non-force push must not silently overwrite remote-side\n // drift. The previous `checkRemoteChanges` gate was a\n // list-only diff against the recorded baseline \u2014 it could\n // see remote-side adds/deletes but not content edits to\n // existing files. That's the same Matej-class blind spot\n // the CLI gate closed in 1.6.2: run a DEEP status so\n // remote content drift surfaces, then block if any\n // remote-side bucket has paths in scope.\n if (!params.force) {\n const status = await syncService.getStatus({\n ...scopeOptions,\n deep: true,\n });\n const conflicting = [\n ...status.modifiedRemotely,\n ...status.addedRemotely,\n ...status.deletedRemotely,\n ];\n if (conflicting.length > 0) {\n // Mirror the CLI's behaviour at push.ts:211-216 \u2014\n // echo the active scope flags back into the\n // suggested pull command so a default-scope pull\n // doesn't run, report \"Already up to date\", and\n // leave the agent stuck in the same drift loop.\n const scopeFlags: string[] = [];\n if (params.all) scopeFlags.push('--all');\n for (const ext of params.includeExtensions ?? []) scopeFlags.push(`--include-ext ${ext}`);\n for (const folder of params.includeFolders ?? [])\n scopeFlags.push(`--include-folder \"${folder}\"`);\n const pullCmd = ['farseer pull', tenant, ...scopeFlags].join(' ');\n return errorResponse(\n `Remote has changes for ${conflicting.length} file(s) since last pull:\\n` +\n conflicting.map((p) => ` - ${p}`).join('\\n') +\n `\\n\\nRun \\`${pullCmd}\\` first, or use force=true to overwrite remote.`,\n 'VALIDATION_ERROR',\n );\n }\n }\n\n // Push files. Pass `mirror` separately from `force` so an\n // agent must opt in explicitly to remote-side deletes \u2014 the\n // CLI gates this behind a confirm prompt, the MCP can't, so\n // we make it a separate parameter the caller has to set.\n const fileResult = await syncService.push({\n ...scopeOptions,\n force: params.force,\n mirror: params.mirror,\n });\n\n // Check for conflicts\n if (fileResult.conflicts.length > 0) {\n return errorResponse(\n `Push blocked by ${fileResult.conflicts.length} conflict(s):\\n${fileResult.conflicts.map((c) => ` - ${c.filePath}: ${c.description}`).join('\\n')}\\n\\nPull first or use force=true.`,\n 'VALIDATION_ERROR',\n );\n }\n\n // Pre-flight rejected files. A push that produced zero side\n // effects (no upload, no update, no delete) because every\n // candidate was rejected is a failure from the agent's\n // perspective \u2014 surface it as VALIDATION_ERROR so the tool\n // call doesn't quietly look like a success.\n //\n // Note `appliedAny` includes deletes: a mirror push that\n // removed remote-only files BUT had every upload candidate\n // rejected has still mutated remote state, so the response\n // must show the deletes (treated as a partial success), not\n // an error that hides them.\n if (fileResult.rejected && fileResult.rejected.length > 0) {\n const summary = fileResult.rejected.map((r) => ` - ${r.filePath}: ${r.detail}`).join('\\n');\n const appliedAny =\n fileResult.uploaded.length + fileResult.updated.length + fileResult.deleted.length > 0;\n if (!appliedAny) {\n return errorResponse(\n `Push rejected \u2014 backend would refuse every candidate file:\\n${summary}`,\n 'VALIDATION_ERROR',\n );\n }\n // Partial success: at least some side effects applied.\n // Fall through to successResponse below so the caller\n // sees the full files.{uploaded,updated,deleted,rejected}\n // breakdown and can decide how strict to be.\n }\n\n // Per-file mid-push failures (5xx, transient errors). These\n // reach the agent as a separate signal from `rejected`\n // (pre-flight). We always surface them \u2014 if the entire push\n // failed mid-flight with no side effects, return error so\n // the agent retries; otherwise let the partial success\n // through so the agent can see what stuck.\n if (fileResult.failed && fileResult.failed.length > 0) {\n const failureSummary = fileResult.failed\n .map((f) => ` - ${f.filePath} (${f.operation}): ${f.reason}`)\n .join('\\n');\n const appliedAny =\n fileResult.uploaded.length + fileResult.updated.length + fileResult.deleted.length > 0;\n if (!appliedAny) {\n return errorResponse(\n `Push failed mid-flight \u2014 every attempted file errored:\\n${failureSummary}`,\n 'NETWORK_ERROR',\n );\n }\n }\n\n // Push apps (only with JWT auth)\n let appResult = null;\n if (authType === 'jwt') {\n const appSyncService = new AppSyncService(tenant, client);\n appResult = await appSyncService.push();\n }\n\n const ignoredLocalEntries = fileResult.ignoredLocal ?? [];\n const ignoredLocalCount = fileResult.ignoredLocalTotal ?? 0;\n const ignoredLocalTotalByReason = fileResult.ignoredLocalTotalByReason ?? {\n unsupportedExtension: 0,\n blocklistedFolder: 0,\n };\n // Drive the breakdown from the UNCAPPED per-reason totals so\n // the numbers in the suffix agree with the headline even\n // when the path slice was truncated.\n const ignoredBreakdown = summariseIgnoredReasons(ignoredLocalTotalByReason);\n const ignoredSuffix =\n ignoredLocalCount > 0\n ? ignoredBreakdown\n ? ` (${ignoredLocalCount} local file(s) outside scope: ${ignoredBreakdown} \u2014 see files.ignoredLocal)`\n : ` (${ignoredLocalCount} local file(s) outside scope \u2014 see files.ignoredLocal)`\n : '';\n return successResponse({\n tenant,\n organisation,\n files: {\n uploaded: fileResult.uploaded,\n updated: fileResult.updated,\n deleted: fileResult.deleted,\n unchanged: fileResult.unchanged.length,\n rejected: fileResult.rejected ?? [],\n failed: fileResult.failed ?? [],\n // Surface scope-skipped files so an agent calling\n // push gets the same silent-skip signal CLI users\n // see in the warning line. Without this, agents\n // reported \"push complete\" while local .csv / .md /\n // .py work-in-progress sat unsent on disk.\n // Entries are { path, reason } so the agent can\n // present category-specific advice \u2014 extension\n // broadening vs blocklisted-folder warning.\n ignoredLocal: ignoredLocalEntries,\n ignoredLocalTotal: ignoredLocalCount,\n ignoredLocalTotalByReason,\n },\n apps: appResult\n ? {\n created: appResult.created,\n updated: appResult.updated,\n unchanged: appResult.unchanged.length,\n }\n : { note: 'App sync requires browser login (JWT)' },\n summary: `Pushed ${fileResult.uploaded.length + fileResult.updated.length} files${appResult ? ` and ${appResult.created.length + appResult.updated.length} apps` : ''}${fileResult.rejected && fileResult.rejected.length > 0 ? ` (${fileResult.rejected.length} skipped \u2014 see files.rejected)` : ''}${fileResult.failed && fileResult.failed.length > 0 ? ` (${fileResult.failed.length} failed mid-push \u2014 see files.failed)` : ''}${ignoredSuffix}`,\n });\n } catch (error) {\n return errorResponse(`Push failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_status - Check sync status\n registerTool(\n server,\n 'farseer_status',\n `Check the synchronization status between local files and the remote Farseer instance.\n\nShows which files are:\n- Modified locally (changed since last sync)\n- Modified remotely (changed on server since last sync)\n- Only local (new files not yet pushed)\n- Only remote (files not yet pulled)\n- In sync (no changes)\n\nAlso shows app sync status if using JWT authentication.\n\nOut-of-scope local files: \\`files.ignoredLocal\\` is an array of\n\\`{ path, reason }\\` entries listing user-authored files that exist on disk\nbut were silently skipped because they don't match the current sync scope\n(default scope is .ts / .js). \\`reason\\` is one of \\`unsupportedExtension\\`\n(extension not in default scope \u2014 broaden via \\`--include-ext\\`) or\n\\`blocklistedFolder\\` (file lives under a tooling-output folder like\nnode_modules/ or dist/ \u2014 opting in is unusual). Use this to detect the\n\"local edits exist but status reports clean\" failure mode before reporting\n\"everything is in sync\" to the user. Hidden files (.env, .git/, .vscode/)\nare NEVER listed there \u2014 those require explicit opt-in via the CLI's\n\\`farseer config include\\` and the response does not advertise widening\nscope to include them. \\`ignoredLocalTotal\\` carries the uncapped count\nwhen the slice was truncated.\n\nSync includes: If the user has configured extra file types via \"farseer config include\"\n(e.g., .json extensions or specific folders like \"Config\"), those files are automatically\nincluded in the status check alongside default script files.\n\nDeep vs shallow: Default is deep \u2014 every remote file is hashed so the response surfaces\nremote-side content edits made since the last pull. Pass shallow=true to skip the hash\ncheck (faster on big tenants; trusts the recorded baseline, so it cannot detect content\nedits to existing remote files). Matches the CLI's --shallow flag.`,\n statusSchema,\n async (params: {\n all?: boolean;\n shallow?: boolean;\n deep?: boolean;\n includeExtensions?: string[];\n includeFolders?: string[];\n }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { organisation, tenant, client, authType } = gate.session;\n\n try {\n // Normalise extensions: agents may pass them dotless (\"json\"\n // vs \".json\"), but downstream comparisons are against\n // `path.extname()` which always has a dot.\n const syncService = new SyncService(tenant, client);\n // Deep is the default; `shallow: true` opts into the faster\n // list-only path. Matches the CLI's --shallow flag.\n //\n // `deep` is a deprecated backwards-compat alias for callers\n // written against the 1.6.1 schema. Resolution order:\n // 1. shallow=true \u2192 deep: false (explicit opt-out wins)\n // 2. deep=false \u2192 deep: false (legacy fast-path)\n // 3. deep=true or unset \u2192 deep: true (the new default)\n // This keeps the schema-validated surface backwards-\n // compatible with existing MCP callers that haven't been\n // rewritten yet, without confusing combinations.\n const effectiveDeep = params.shallow === true ? false : params.deep !== false;\n const fileStatus = await syncService.getStatus({\n all: params.all,\n deep: effectiveDeep,\n includeExtensions: params.includeExtensions\n ? normalizeExtensions(params.includeExtensions)\n : undefined,\n includeFolders: params.includeFolders,\n });\n\n // Get app status (only with JWT auth)\n let appStatus = null;\n if (authType === 'jwt') {\n const appSyncService = new AppSyncService(tenant, client);\n appStatus = await appSyncService.getStatus();\n }\n\n const hasChanges =\n fileStatus.modifiedLocally.length > 0 ||\n fileStatus.modifiedRemotely.length > 0 ||\n fileStatus.addedLocally.length > 0 ||\n fileStatus.addedRemotely.length > 0 ||\n fileStatus.deletedLocally.length > 0 ||\n fileStatus.deletedRemotely.length > 0 ||\n fileStatus.conflicts.length > 0;\n\n // Surface scope-skipped files so agents calling MCP see\n // the same silent-skip signal CLI users get. Without this\n // an agent that ran status on a tenant where the user has\n // unsaved .csv / .md / .py edits gets a clean \"Everything\n // is in sync\" \u2014 exactly the failure the CLI fix addressed.\n // Hidden files (.env, .git/) are upstream-excluded so the\n // response can't tell the agent to widen scope to include\n // a credential file.\n return successResponse({\n tenant,\n organisation,\n files: {\n addedLocally: fileStatus.addedLocally,\n modifiedLocally: fileStatus.modifiedLocally,\n deletedLocally: fileStatus.deletedLocally,\n addedRemotely: fileStatus.addedRemotely,\n modifiedRemotely: fileStatus.modifiedRemotely,\n deletedRemotely: fileStatus.deletedRemotely,\n inSync: fileStatus.inSync.length,\n deepCompare: fileStatus.deepCompare,\n conflicts: fileStatus.conflicts.map((c) => ({\n file: c.filePath,\n type: c.type,\n description: c.description,\n })),\n ignoredLocal: fileStatus.ignoredLocal,\n ignoredLocalTotal: fileStatus.ignoredLocalTotal,\n ignoredLocalTotalByReason: fileStatus.ignoredLocalTotalByReason,\n },\n apps: appStatus\n ? {\n newLocal: appStatus.newLocal,\n newRemote: appStatus.newRemote,\n modified: appStatus.modified,\n synced: appStatus.synced.length,\n }\n : { note: 'App sync requires browser login (JWT)' },\n summary: (() => {\n if (fileStatus.conflicts?.length) {\n return `${fileStatus.conflicts.length} conflict(s) detected`;\n }\n if (hasChanges) return 'Changes detected';\n if (fileStatus.ignoredLocalTotal > 0) {\n // No drift within scope \u2014 but local files\n // outside scope exist. Agents quote this\n // summary back to users; a flat \"Everything is\n // in sync\" would hide that .md / .csv / .py\n // work was never compared. Include the reason\n // breakdown so the user sees whether they need\n // to broaden by extension or are looking at\n // ignored tooling output.\n //\n // Drive the breakdown from the UNCAPPED per-\n // reason totals so e.g. \"250 outside scope\"\n // doesn't pair with \"100 with unsupported\n // extension\" when all 250 are that reason.\n const breakdown = summariseIgnoredReasons(fileStatus.ignoredLocalTotalByReason);\n const suffix = breakdown\n ? `${fileStatus.ignoredLocalTotal} local file(s) outside scope: ${breakdown}`\n : `${fileStatus.ignoredLocalTotal} local file(s) outside scope`;\n return `Everything in sync within current scope (${suffix} \u2014 see files.ignoredLocal)`;\n }\n return 'Everything is in sync';\n })(),\n });\n } catch (error) {\n return errorResponse(`Status check failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_diff - Show file differences\n registerTool(\n server,\n 'farseer_diff',\n `Show the differences between local and remote versions of files.\n\nCan show:\n- Unified diff format (default)\n- Just the remote content (showRemote=true)\n\nUseful for reviewing changes before pull or push.\n\nIf no file is specified, shows diffs for all changed files.`,\n diffSchema,\n async (params: { file?: string; showRemote?: boolean }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { tenant, client } = gate.session;\n\n try {\n const syncService = new SyncService(tenant, client);\n\n if (params.file) {\n // Single file diff\n const { localContent, remoteContent } = await syncService.getFileDiff(params.file);\n\n if (params.showRemote) {\n return successResponse({\n file: params.file,\n remoteContent: remoteContent || '(file does not exist on remote)',\n });\n }\n\n const diff = createPatch(params.file, remoteContent || '', localContent || '', 'remote', 'local');\n\n return successResponse({\n file: params.file,\n localExists: localContent !== null,\n remoteExists: remoteContent !== null,\n diff,\n });\n } else {\n // All changed files\n const status = await syncService.getStatus();\n const changedFiles = [\n ...status.addedLocally,\n ...status.modifiedLocally,\n ...status.deletedLocally,\n ...status.addedRemotely,\n ...status.modifiedRemotely,\n ...status.deletedRemotely,\n ];\n\n const diffs: Array<{\n file: string;\n localExists: boolean;\n remoteExists: boolean;\n diff: string;\n }> = [];\n\n for (const f of changedFiles.slice(0, 10)) {\n // Limit to 10 files\n const { localContent, remoteContent } = await syncService.getFileDiff(f);\n const diff = createPatch(f, remoteContent || '', localContent || '', 'remote', 'local');\n diffs.push({\n file: f,\n localExists: localContent !== null,\n remoteExists: remoteContent !== null,\n diff,\n });\n }\n\n return successResponse({\n totalChangedFiles: changedFiles.length,\n diffs,\n note:\n changedFiles.length > 10\n ? `Showing first 10 of ${changedFiles.length} changed files`\n : undefined,\n });\n }\n } catch (error) {\n return errorResponse(`Diff failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n\n // farseer_list_files - List remote files\n registerTool(\n server,\n 'farseer_list_files',\n `Lists files stored on the remote Farseer instance in the Files/ folder.\n\nIMPORTANT: this tool defaults to script files only (.ts, .js),\nmatching the CLI's \"farseer files list\" command which is intended for\ninspecting app scripts. This is NARROWER than the default sync scope used\nby farseer_pull / farseer_status / farseer_push (which sync developer files\n(.ts, .js, .py, .yml, .yaml, .md, .json) outside hidden directories and the folder\nblocklist; data files like .csv / .xlsx / .parquet are backend-accepted\nbut excluded from default).\n\nUse all=true to list every file the remote knows about.\n\nReturns file paths relative to the Files/ folder.`,\n listFilesSchema,\n async (params: { all?: boolean }) => {\n const gate = await requireSession();\n if (!gate.ok) return gate.response;\n const { organisation, tenant, client } = gate.session;\n\n try {\n let files = await client.listFiles();\n\n // Filter to scripts unless --all\n if (!params.all) {\n const scriptExtensions = ['.ts', '.js'];\n files = files.filter((f) => scriptExtensions.some((ext) => f.name.toLowerCase().endsWith(ext)));\n }\n\n // Group by directory\n const byDirectory: Record<string, string[]> = {};\n for (const file of files) {\n const dir = file.path.includes('/') ? file.path.split('/').slice(0, -1).join('/') : '.';\n if (!byDirectory[dir]) {\n byDirectory[dir] = [];\n }\n byDirectory[dir].push(file.name);\n }\n\n return successResponse({\n tenant,\n organisation,\n totalFiles: files.length,\n files: files.map((f) => ({\n name: f.name,\n path: f.path,\n reference: f.reference,\n })),\n byDirectory,\n });\n } catch (error) {\n return errorResponse(`List files failed: ${await formatClientError(error)}`, 'NETWORK_ERROR');\n }\n },\n );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAA6B;AAC7B,iBAAkB;AAClB,kBAA4B;AAC5B,yBAA4B;AAC5B,4BAA+B;AAC/B,qBAA+B;AAC/B,qBAA+C;AAC/C,4BAAkC;AAClC,wBAAoC;AAwBpC,SAAS,wBAAwB,QAA6E;AAC1G,QAAM,QAAkB,CAAC;AACzB,MAAI,OAAO,uBAAuB,EAAG,OAAM,KAAK,GAAG,OAAO,oBAAoB,6BAA6B;AAC3G,MAAI,OAAO,oBAAoB,EAAG,OAAM,KAAK,GAAG,OAAO,iBAAiB,yBAAyB;AACjG,SAAO,MAAM,KAAK,IAAI;AAC1B;AASA,MAAM,0BAA0B,aAC3B,MAAM,aAAE,OAAO,CAAC,EAChB,SAAS,EACT;AAAA,EACG;AAKJ;AACJ,MAAM,uBAAuB,aACxB,MAAM,aAAE,OAAO,CAAC,EAChB,SAAS,EACT;AAAA,EACG;AAIJ;AAEJ,MAAM,aAAa;AAAA,EACf,KAAK,aACA,QAAQ,EACR,SAAS,EACT;AAAA,IACG;AAAA,EAIJ;AAAA,EACJ,OAAO,aACF,QAAQ,EACR,SAAS,EACT;AAAA,IACG;AAAA,EAKJ;AAAA,EACJ,mBAAmB;AAAA,EACnB,gBAAgB;AACpB;AAEA,MAAM,aAAa;AAAA,EACf,OAAO,aACF,QAAQ,EACR,SAAS,EACT;AAAA,IACG;AAAA,EAEJ;AAAA,EACJ,QAAQ,aACH,QAAQ,EACR,SAAS,EACT;AAAA,IACG;AAAA,EAGJ;AAAA,EAC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W,EAAE;AAAA,UACjB,EAAE;AAAA,UACF;AAAA,QACJ,CAAC;AAAA,MACL,SAAS,OAAO;AACZ,mBAAO,8BAAc,sBAAsB,UAAM,yCAAkB,KAAK,CAAC,IAAI,eAAe;AAAA,MAChG;AAAA,IACJ;AAAA,EACJ;AACJ;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/mcp/utils/helpers.ts"],
4
- "sourcesContent": ["/** Response shapes and wording shared by the MCP tools. */\n\nimport { isUserAuthValid, listCredentials, listUserAuths } from '../../services/configService';\nimport { knownRealmForOrganisation } from '../../services/realms';\nimport type { SessionFailure, SessionWarning } from '../../services/preflight';\nimport { getTenantPin, isLaunchPinned } from './tenantPin';\nimport { fileLogger } from '../../utils/fileLogger';\nimport type { FarseerService } from '../../services/farseerService';\nimport type { AppListItem, RemoteApp } from '../../services/apps';\nimport { selectByNameOrId, formatAmbiguous } from '../../utils/nameResolver';\nimport { resolveSheet, resolveDashboard, describeAmbiguity, type NamedEntity } from '../../utils/entityResolver';\nimport * as farseer from 'farseer-client';\n\n/**\n * The tenant this server is bound to, or null if nothing is bound yet. The env\n * is read once at launch (see launchPin.ts), so re-exporting FARSEER_TENANT\n * mid-session cannot retarget a running server.\n */\nexport function getSessionTenant(): { organisation: string; tenant: string } | null {\n return getTenantPin() ?? null;\n}\n\nexport function successResponse(data: Record<string, unknown>): { content: Array<{ type: 'text'; text: string }> } {\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify({ success: true, ...data }, null, 2),\n },\n ],\n };\n}\n\nexport type McpErrorResponse = { content: Array<{ type: 'text'; text: string }>; isError: true };\n\nexport function errorResponse(\n message: string,\n errorCode?: 'AUTH_REQUIRED' | 'NOT_FOUND' | 'NETWORK_ERROR' | 'VALIDATION_ERROR' | 'UNKNOWN',\n): McpErrorResponse {\n // Log MCP tool errors to file for diagnostics\n fileLogger.error('mcp-tool', message, { errorCode: errorCode || 'UNKNOWN' });\n\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(\n {\n success: false,\n error: message,\n errorCode: errorCode || 'UNKNOWN',\n },\n null,\n 2,\n ),\n },\n ],\n isError: true,\n };\n}\n\n/**\n * Resolve an app to its folder list item, or to an error response ready to\n * return. An explicit `appId` wins; a name that matches more than one app is a\n * validation error listing the candidates, never a guess.\n *\n * Callers take `.reference` to fetch details and `.id` to delete \u2014 the two ids\n * are different and their number spaces overlap.\n */\nexport async function resolveAppItemForMcp(\n client: FarseerService,\n selector: { appName?: string; id?: string },\n): Promise<{ item: AppListItem } | { error: ReturnType<typeof errorResponse> }> {\n const selection = selectByNameOrId(\n await client.listApps(),\n { name: selector.appName, id: selector.id },\n (a) => a.reference,\n );\n if (selection.kind === 'found') {\n return { item: selection.entity };\n }\n if (selection.kind === 'ambiguous') {\n // Names are not unique \u2014 refuse to guess which colliding app was meant.\n return {\n error: errorResponse(\n formatAmbiguous('apps', selector.appName ?? '', selection.matches, (a) => a.reference),\n 'VALIDATION_ERROR',\n ),\n };\n }\n if (selection.kind === 'conflict') {\n return {\n error: errorResponse(\n `App ${selection.entity.reference} is \"${selection.entity.name}\", not \"${selection.name}\". The id and the name point at different apps, so nothing was done \u2014 pass one of them.`,\n 'VALIDATION_ERROR',\n ),\n };\n }\n return {\n error: errorResponse(\n selector.id ? `App not found: id ${selector.id}` : `App \"${selector.appName}\" not found`,\n 'NOT_FOUND',\n ),\n };\n}\n\n/**\n * Resolve an app for an MCP tool to its full details. Wraps\n * `resolveAppItemForMcp` + `getApp` so the tools that need the whole\n * `RemoteApp` (get, configure, run) don't repeat the fetch.\n */\nexport async function resolveAppForMcp(\n client: FarseerService,\n selector: { appName?: string; id?: string },\n): Promise<{ app: RemoteApp } | { error: ReturnType<typeof errorResponse> }> {\n const resolution = await resolveAppItemForMcp(client, selector);\n if ('error' in resolution) {\n return resolution;\n }\n const app = await client.getApp(resolution.item.reference);\n if (!app) {\n return { error: errorResponse('Failed to load app details', 'NETWORK_ERROR') };\n }\n return { app };\n}\n\nexport function authRequiredResponse(tenant?: string, organisation?: string): McpErrorResponse {\n // A login is per realm, so name the org: `login --org` picks its realm.\n const login = `farseer login${organisation ? ` --org ${organisation}` : ''}`;\n const message = tenant\n ? `Authentication required for tenant \"${tenant}\". Run \"${login}\" to authenticate.`\n : `Authentication required. Run \"${login}\" to authenticate.`;\n\n return errorResponse(message, 'AUTH_REQUIRED');\n}\n\n/** No usable tenant for this call. States only how to fix the current situation. */\nexport function tenantRequiredResponse(): McpErrorResponse {\n const pin = getTenantPin();\n if (pin) {\n return errorResponse(\n `This session works only on tenant \"${pin.tenant}\". The tenant is locked for the session \u2014 to work on a different tenant, start a new session.`,\n 'VALIDATION_ERROR',\n );\n }\n // Agent-facing: the in-session fix is farseer_select_tenant, not a CLI\n // command or config edit. Configured API-key tenants are offered as a hint\n // when present (a browser-login user may reach others not listed).\n const configured = Object.keys(listCredentials());\n const hint = configured.length > 0 ? ` Configured tenants include: ${configured.join(', ')}.` : '';\n return errorResponse(\n `No tenant is selected for this session yet. Call farseer_select_tenant with the tenant to work on (the client the user named). It can be selected once, then locks for the session.${hint}`,\n 'VALIDATION_ERROR',\n );\n}\n\nexport function getAuthStatus(): {\n jwtValid: boolean;\n jwtExpiresAt?: string;\n jwtRealm?: string;\n logins: { realm: string; valid: boolean; expiresAt: string }[];\n tenant?: { organisation: string; tenant: string };\n launchPinned: boolean;\n configuredTenants: string[];\n} {\n const pin = getTenantPin();\n const credentials = listCredentials();\n const logins = Object.entries(listUserAuths()).map(([realm, login]) => ({\n realm,\n valid: isUserAuthValid(login),\n expiresAt: login.expiresAt,\n }));\n // Bound: the login that tenant needs. Unbound: any usable one.\n const realm = pin ? knownRealmForOrganisation(pin.organisation) : undefined;\n const login = realm ? logins.find((l) => l.realm === realm) : (logins.find((l) => l.valid) ?? logins[0]);\n\n return {\n jwtValid: !!login?.valid,\n jwtExpiresAt: login?.expiresAt,\n jwtRealm: login?.realm ?? realm,\n logins,\n tenant: pin,\n launchPinned: isLaunchPinned(),\n configuredTenants: Object.keys(credentials),\n };\n}\n\n/**\n * The diagnosis is the guard's; `remedy` is the caller's, because the same\n * refusal is fixable in-session before the tenant locks and not after.\n */\nexport function describeSessionFailure(failure: SessionFailure, remedy: string): McpErrorResponse {\n switch (failure.reason) {\n case 'no-credentials':\n return authRequiredResponse(failure.tenant, failure.organisation);\n\n case 'org-unknown':\n return errorResponse(`No Farseer organisation at \"${failure.organisation}\". ${remedy}`, 'VALIDATION_ERROR');\n\n case 'pair-refuted': {\n const known =\n failure.orgTenants.length > 0\n ? ` Tenants you can access under \"${failure.organisation}\": ${failure.orgTenants.join(', ')}.`\n : '';\n return errorResponse(\n `Tenant \"${failure.tenant}\" is not available under organisation \"${failure.organisation}\".${known} ${remedy}`,\n 'VALIDATION_ERROR',\n );\n }\n }\n}\n\n/** The CLI's warning without the \"you typed it\" framing \u2014 an agent did not type it. */\nexport function describeSessionWarning(warning: SessionWarning): string {\n return (\n `Organisation \"${warning.organisation}\" is not being used: the stored API key for \"${warning.tenant}\" ` +\n `carries its own host (${warning.host}). The tenant is the bound one; the organisation has no effect.`\n );\n}\n\n/**\n * A sheet or dashboard for an MCP tool, or an error response ready to return.\n * A name matching more than one is a validation error listing the candidates by\n * folder \u2014 several of these tools write, so guessing corrupts the other one.\n */\nexport async function resolveEntityForMcp(\n client: farseer.FarseerClient,\n kind: 'sheet' | 'dashboard',\n nameOrId: string,\n): Promise<{ entity: NamedEntity } | { error: McpErrorResponse }> {\n const sheet = kind === 'sheet';\n const selection = sheet ? await resolveSheet(client, nameOrId) : await resolveDashboard(client, nameOrId);\n\n if (selection.kind === 'found') {\n return { entity: selection.entity };\n }\n if (selection.kind === 'ambiguous') {\n const itemType = sheet ? farseer.FolderItemType.Sheet : farseer.FolderItemType.Dashboard;\n const message = await describeAmbiguity(client, `${kind}s`, nameOrId, selection.matches, itemType);\n return { error: errorResponse(message, 'VALIDATION_ERROR') };\n }\n return { error: errorResponse(`${sheet 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AAQ,YAAY,gDAAgD,QAAQ,MAAM,2BAC1E,QAAQ,IAAI;AAE7C;AAOA,eAAsB,oBAClB,QACA,MACA,UAC8D;AAC9D,QAAM,QAAQ,SAAS;AACvB,QAAM,YAAY,QAAQ,UAAM,oCAAa,QAAQ,QAAQ,IAAI,UAAM,wCAAiB,QAAQ,QAAQ;AAExG,MAAI,UAAU,SAAS,SAAS;AAC5B,WAAO,EAAE,QAAQ,UAAU,OAAO;AAAA,EACtC;AACA,MAAI,UAAU,SAAS,aAAa;AAChC,UAAM,WAAW,QAAQ,QAAQ,eAAe,QAAQ,QAAQ,eAAe;AAC/E,UAAM,UAAU,UAAM,yCAAkB,QAAQ,GAAG,IAAI,KAAK,UAAU,UAAU,SAAS,QAAQ;AACjG,WAAO,EAAE,OAAO,cAAc,SAAS,kBAAkB,EAAE;AAAA,EAC/D;AACA,SAAO,EAAE,OAAO,cAAc,GAAG,QAAQ,UAAU,WAAW,KAAK,QAAQ,eAAe,WAAW,EAAE;AAC3G;",
6
5
  "names": ["realm", "login"]
7
6
  }
@@ -28,7 +28,7 @@ function resolveLaunchPin(options, env) {
28
28
  const org = options.org || env.FARSEER_ORG;
29
29
  if (org) {
30
30
  process.stderr.write(
31
- `farseer mcp-server: organisation "${org}" was provided without a tenant (--tenant / FARSEER_TENANT); ignoring it and starting unbound.
31
+ `Organisation "${org}" was provided without a tenant (--tenant / FARSEER_TENANT), so it is ignored.
32
32
  `
33
33
  );
34
34
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/mcp/utils/launchPin.ts"],
4
- "sourcesContent": ["/**\n * Launch-time tenant resolution for the MCP server.\n *\n * Precedence: --tenant flag > FARSEER_TENANT env. Org: --org > FARSEER_ORG >\n * the saved tenant->org mapping > the tenant. The CLI's command resolvers read\n * the same FARSEER_TENANT/FARSEER_ORG (utils/helpers.ts getEnvCheckout), so a\n * shell that sets them targets the same tenant whether you run a `farseer`\n * command or launch this server from it \u2014 one vocabulary across both worlds.\n * This launch pin stays the ONLY place the MCP server reads the env: once\n * bound, the server is locked to that tenant for its lifetime and never\n * re-reads it. FARSEER_TENANT is also the channel Mindseer already injects per\n * server (bfm2000 apps/main/src/services/MCPService.ts), so honoring it lets\n * that host bind a tenant with no `--tenant` in the args.\n */\nimport type { CurrentCheckout } from '../../services/configService';\nimport { getTenantOrg } from '../../services/configService';\n\nexport interface McpServerOptions {\n /** Tenant to bind at launch (X-TENANT-ID). From --tenant, else FARSEER_TENANT. */\n tenant?: string;\n /** Organisation subdomain. From --org, else FARSEER_ORG, else the mapping/tenant. */\n org?: string;\n}\n\n/**\n * Resolve the launch-time tenant pin from flags + env, or undefined if none was\n * provided (the server then starts unbound and waits for farseer_select_tenant).\n */\nexport function resolveLaunchPin(options: McpServerOptions, env: NodeJS.ProcessEnv): CurrentCheckout | undefined {\n const tenant = options.tenant || env.FARSEER_TENANT;\n if (!tenant) {\n // An org with no tenant binds nothing; warn so it isn't a silent no-op.\n // stderr is safe here \u2014 stdout carries the MCP protocol.\n const org = options.org || env.FARSEER_ORG;\n if (org) {\n process.stderr.write(\n `farseer mcp-server: organisation \"${org}\" was provided without a tenant ` +\n `(--tenant / FARSEER_TENANT); ignoring it and starting unbound.\\n`,\n );\n }\n return undefined;\n }\n const organisation = options.org || env.FARSEER_ORG || getTenantOrg(tenant) || tenant;\n return { organisation, tenant };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,2BAA6B;AAatB,SAAS,iBAAiB,SAA2B,KAAqD;AAC7G,QAAM,SAAS,QAAQ,UAAU,IAAI;AACrC,MAAI,CAAC,QAAQ;AAGT,UAAM,MAAM,QAAQ,OAAO,IAAI;AAC/B,QAAI,KAAK;AACL,cAAQ,OAAO;AAAA,QACX,qCAAqC,GAAG;AAAA;AAAA,MAE5C;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AACA,QAAM,eAAe,QAAQ,OAAO,IAAI,mBAAe,mCAAa,MAAM,KAAK;AAC/E,SAAO,EAAE,cAAc,OAAO;AAClC;",
4
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,2BAA6B;AAatB,SAAS,iBAAiB,SAA2B,KAAqD;AAC7G,QAAM,SAAS,QAAQ,UAAU,IAAI;AACrC,MAAI,CAAC,QAAQ;AAGT,UAAM,MAAM,QAAQ,OAAO,IAAI;AAC/B,QAAI,KAAK;AACL,cAAQ,OAAO;AAAA,QACX,iBAAiB,GAAG;AAAA;AAAA,MACxB;AAAA,IACJ;AACA,WAAO;AAAA,EACX;AACA,QAAM,eAAe,QAAQ,OAAO,IAAI,mBAAe,mCAAa,MAAM,KAAK;AAC/E,SAAO,EAAE,cAAc,OAAO;AAClC;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/mcp/utils/registerTool.ts"],
4
- "sourcesContent": ["/**\n * Registers an MCP tool without resolving the SDK's `McpServer.tool(...)` overloads.\n *\n * Type-checking those overloads is a known SDK problem: a handful of `server.tool` calls\n * cost `tsc` millions of type instantiations, minutes of check time and multi-GB memory,\n * so the CLI could not be type-checked as a whole. This wrapper types the handler through\n * zod's own inference and calls the SDK method untyped. Runtime behaviour is identical to\n * `server.tool(name, description, shape, handler)`.\n */\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { z } from 'zod';\n\nexport type ToolResponse = { content: Array<{ type: 'text'; text: string }>; isError?: boolean };\nexport type ToolArgs<S extends z.ZodRawShape> = z.objectOutputType<S, z.ZodTypeAny>;\n\nexport function registerTool<S extends z.ZodRawShape>(\n server: McpServer,\n name: string,\n description: string,\n shape: S,\n handler: (args: ToolArgs<S>) => ToolResponse | Promise<ToolResponse>,\n): void {\n const untyped = server as unknown as { tool(...args: unknown[]): unknown };\n untyped.tool(name, description, shape, handler);\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,aACZ,QACA,MACA,aACA,OACA,SACI;AACJ,QAAM,UAAU;AAChB,UAAQ,KAAK,MAAM,aAAa,OAAO,OAAO;AAClD;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/mcp/utils/session.ts"],
4
- "sourcesContent": ["/**\n * The tenant guard for MCP tools: the checks a CLI command runs, minus the exit.\n *\n * The pin cannot change for the life of the process, so the verdict is reached\n * once per credential. What is kept is the verdict and the credential, not a\n * built client \u2014 a browser token expires long before a long-lived server does.\n */\n\nimport {\n getCredential,\n getUserAuth,\n isUserAuthValid,\n type CurrentCheckout,\n type UserAuth,\n} from '../../services/configService';\nimport { refreshAuth } from '../../services/credentials';\nimport { knownRealmForOrganisation } from '../../services/realms';\nimport type { ResolvedAuth } from '../../services/farseerService';\nimport { openTenantSession, sessionFrom, type SessionWarning, type TenantSession } from '../../services/preflight';\nimport { authRequiredResponse, describeSessionFailure, tenantRequiredResponse } from './helpers';\nimport type { McpErrorResponse } from './helpers';\nimport { getTenantPin } from './tenantPin';\n\nexport type SessionResult = { ok: true; session: TenantSession } | { ok: false; response: McpErrorResponse };\n\n// Safe only because each server is a stdio process with a single client, on the\n// same terms as the pin it mirrors.\nlet validated:\n | {\n pin: CurrentCheckout;\n auth: ResolvedAuth;\n credentials: string;\n passedOverLogin: boolean;\n warning?: SessionWarning;\n }\n | undefined;\n\n/**\n * What the credential choice was made from, as one comparable value.\n *\n * A browser login is identified by its Keycloak session (`sid`), which token\n * rotation keeps and a new `farseer login` replaces \u2014 so the ordinary case, a\n * token renewed about once a minute, never re-runs the guard.\n *\n * A login the guard passed over for a key is the exception. Its refresh token\n * already failed, so nothing can rotate it, and a login made to recover can land\n * in the same Keycloak session when the browser still holds one. There the\n * refresh token itself is the identity: only replacing the login changes it.\n *\n * Without both, a key that stops working is reused until the process restarts,\n * while `farseer_whoami`, which reads the config directly, reports the new login\n * as valid.\n */\nfunction credentialState(pin: CurrentCheckout, passedOverLogin: boolean): string {\n const credential = getCredential(pin.tenant);\n const key = credential ? `${credential.basePath}|${credential.tenantId}|${credential.apiKey}` : 'none';\n const login = getUserAuth(knownRealmForOrganisation(pin.organisation));\n const who = !login ? 'none' : passedOverLogin ? `unusable:${login.refreshToken}` : `session:${loginSession(login)}`;\n return `${who}|${key}`;\n}\n\n/**\n * Read straight after a decision, when the guard has just tried to renew the\n * login: one that is still expired is one the refresh could not renew.\n */\nfunction passedOver(pin: CurrentCheckout, auth: ResolvedAuth): boolean {\n if (auth.kind !== 'apiKey') {\n return false;\n }\n const login = getUserAuth(knownRealmForOrganisation(pin.organisation));\n return !!login && !isUserAuthValid(login);\n}\n\nfunction loginSession(login: UserAuth): string {\n for (const token of [login.refreshToken, login.accessToken]) {\n try {\n const sid = JSON.parse(Buffer.from(token.split('.')[1], 'base64url').toString('utf-8')).sid;\n if (typeof sid === 'string' && sid) {\n return sid;\n }\n } catch {\n // Not a JWT; try the other token.\n }\n }\n // Unreadable, so the token itself: re-decides on every rotation \u2014 more often\n // than needed, never less.\n return login.refreshToken;\n}\n\n/** The gate every tool that talks to a tenant goes through. */\nexport async function requireSession(): Promise<SessionResult> {\n const pin = getTenantPin();\n if (!pin) {\n return { ok: false, response: tenantRequiredResponse() };\n }\n\n // Identity, not value: a different object means a different binding, and an\n // extra check is the safe way to be wrong. The credentials are part of the\n // key for the same reason \u2014 a verdict reached over one says nothing about\n // another. The pin survives either way; only the credential is re-decided.\n if (validated?.pin === pin && validated.credentials === credentialState(pin, validated.passedOverLogin)) {\n const auth = await refreshAuth(validated.auth);\n if (!auth) {\n // Drop the verdict rather than reuse a credential we can no longer mint.\n validated = undefined;\n return { ok: false, response: authRequiredResponse(pin.tenant, pin.organisation) };\n }\n return { ok: true, session: sessionFrom(pin.organisation, pin.tenant, auth) };\n }\n\n const outcome = await openTenantSession(pin.organisation, pin.tenant);\n if (!outcome.ok) {\n return { ok: false, response: describeSessionFailure(outcome.failure, LOCKED_REMEDY) };\n }\n\n remember(pin, outcome.auth, outcome.warning);\n return { ok: true, session: sessionFrom(outcome.organisation, outcome.tenant, outcome.auth) };\n}\n\n/** Adopt a verdict reached elsewhere \u2014 `farseer_select_tenant` validates before it binds. */\nexport function rememberSession(pin: CurrentCheckout, auth: ResolvedAuth, warning?: SessionWarning): void {\n remember(pin, auth, warning);\n}\n\nfunction remember(pin: CurrentCheckout, auth: ResolvedAuth, warning?: SessionWarning): void {\n const passedOverLogin = passedOver(pin, auth);\n validated = { pin, auth, credentials: credentialState(pin, passedOverLogin), passedOverLogin, warning };\n}\n\n/** Reported by `farseer_whoami`: true about this session, but not a failure. */\nexport function getSessionWarning(): SessionWarning | undefined {\n const pin = getTenantPin();\n return validated?.pin === pin ? validated?.warning : undefined;\n}\n\nexport function resetSessionCache(): void {\n validated = undefined;\n}\n\n// Past the lock there is no in-session fix.\nconst LOCKED_REMEDY =\n 'This session is locked to that pair for its lifetime \u2014 start a new server with the right organisation (--org, or FARSEER_ORG).';\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,2BAMO;AACP,yBAA4B;AAC5B,oBAA0C;AAE1C,uBAAwF;AACxF,qBAAqF;AAErF,uBAA6B;AAM7B,IAAI;AA0BJ,SAAS,gBAAgB,KAAsB,iBAAkC;AAC7E,QAAM,iBAAa,oCAAc,IAAI,MAAM;AAC3C,QAAM,MAAM,aAAa,GAAG,WAAW,QAAQ,IAAI,WAAW,QAAQ,IAAI,WAAW,MAAM,KAAK;AAChG,QAAM,YAAQ,sCAAY,yCAA0B,IAAI,YAAY,CAAC;AACrE,QAAM,MAAM,CAAC,QAAQ,SAAS,kBAAkB,YAAY,MAAM,YAAY,KAAK,WAAW,aAAa,KAAK,CAAC;AACjH,SAAO,GAAG,GAAG,IAAI,GAAG;AACxB;AAMA,SAAS,WAAW,KAAsB,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,QAAQ,cAAc,QAAQ,QAAQ,QAAQ,IAAI,EAAE;AAChG;AAGO,SAAS,gBAAgB,KAAsB,MAAoB,SAAgC;AACtG,WAAS,KAAK,MAAM,OAAO;AAC/B;AAEA,SAAS,SAAS,KAAsB,MAAoB,SAAgC;AACxF,QAAM,kBAAkB,WAAW,KAAK,IAAI;AAC5C,cAAY,EAAE,KAAK,MAAM,aAAa,gBAAgB,KAAK,eAAe,GAAG,iBAAiB,QAAQ;AAC1G;AAGO,SAAS,oBAAgD;AAC5D,QAAM,UAAM,+BAAa;AACzB,SAAO,WAAW,QAAQ,MAAM,WAAW,UAAU;AACzD;AAEO,SAAS,oBAA0B;AACtC,cAAY;AAChB;AAGA,MAAM,gBACF;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/mcp/utils/tenantPin.ts"],
4
- "sourcesContent": ["/**\n * Per-process tenant binding for the MCP server: set once, then locked, either\n * by `--tenant` at launch or by one `farseer_select_tenant` call.\n *\n * In memory only. The one thing that reaches `~/.farseer/config.json` is the\n * tenant->org mapping the guard records for a pair the organisation confirmed.\n * Whether a binding has been *checked* lives in session.ts.\n */\n\nimport type { CurrentCheckout } from '../../services/configService';\n\n// Safe ONLY because each server is a stdio process with a single client. A\n// multiplexing transport (HTTP/SSE) would share these and bleed across tenants.\nlet pin: CurrentCheckout | undefined;\nlet launchPinned = false;\n\n/** Bind at startup from `--tenant` (hard pin; disables runtime selection). */\nexport function setLaunchTenant(checkout: CurrentCheckout): void {\n pin = checkout;\n launchPinned = true;\n}\n\nexport type SelectResult =\n | { ok: true; checkout: CurrentCheckout }\n | { ok: false; reason: 'launch-pinned' | 'already-selected'; current: CurrentCheckout };\n\n/** One-shot selection: only when launched without `--tenant` and nothing bound yet. */\nexport function selectTenant(checkout: CurrentCheckout): SelectResult {\n if (launchPinned) return { ok: false, reason: 'launch-pinned', current: pin! };\n if (pin) return { ok: false, reason: 'already-selected', current: pin };\n pin = checkout;\n return { ok: true, checkout };\n}\n\nexport function getTenantPin(): CurrentCheckout | undefined {\n return pin;\n}\n\nexport function isLaunchPinned(): boolean {\n return launchPinned;\n}\n\nexport function resetTenantPin(): void {\n pin = undefined;\n launchPinned = false;\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,IAAI;AACJ,IAAI,eAAe;AAGZ,SAAS,gBAAgB,UAAiC;AAC7D,QAAM;AACN,iBAAe;AACnB;AAOO,SAAS,aAAa,UAAyC;AAClE,MAAI,aAAc,QAAO,EAAE,IAAI,OAAO,QAAQ,iBAAiB,SAAS,IAAK;AAC7E,MAAI,IAAK,QAAO,EAAE,IAAI,OAAO,QAAQ,oBAAoB,SAAS,IAAI;AACtE,QAAM;AACN,SAAO,EAAE,IAAI,MAAM,SAAS;AAChC;AAEO,SAAS,eAA4C;AACxD,SAAO;AACX;AAEO,SAAS,iBAA0B;AACtC,SAAO;AACX;AAEO,SAAS,iBAAuB;AACnC,QAAM;AACN,iBAAe;AACnB;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/compatibility.ts"],
4
- "sourcesContent": ["import { z } from 'zod';\nimport type { PipelineClient } from './service';\nimport { CLI_UPDATE_INSTRUCTION } from './reference';\n\nconst compatibilitySchema = z.object({\n protocolVersion: z.literal(3),\n minimumCliVersion: z.string().regex(/^\\d+\\.\\d+\\.\\d+$/),\n});\n\nexport async function checkPipelineCompatibility(client: PipelineClient): Promise<void> {\n let response: unknown;\n try {\n // The backend compares our version header before returning this contract.\n response = await client.pipelineRequest('GET', '/pipelineAuthoring');\n } catch (error: any) {\n const status = error.response?.status ?? /^HTTP (\\d+):/.exec(error.message ?? '')?.[1];\n if (Number(status) === 404)\n throw new Error(\n 'Pipeline authoring compatibility is unavailable on this tenant. Ask the pipeline setup owner to enable the matching backend.',\n );\n if (Number(status) === 426)\n throw new Error(`This tenant requires an updated pipeline CLI. ${CLI_UPDATE_INSTRUCTION}`);\n throw error;\n }\n if (!compatibilitySchema.safeParse(response).success)\n throw new Error(\n `This backend's pipeline authoring protocol is unknown to this CLI. ${CLI_UPDATE_INSTRUCTION} If it persists, ask the pipeline setup owner to check the backend.`,\n );\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AAElB,uBAAuC;AAEvC,MAAM,sBAAsB,aAAE,OAAO;AAAA,EACjC,iBAAiB,aAAE,QAAQ,CAAC;AAAA,EAC5B,mBAAmB,aAAE,OAAO,EAAE,MAAM,iBAAiB;AACzD,CAAC;AAED,eAAsB,2BAA2B,QAAuC;AACpF,MAAI;AACJ,MAAI;AAEA,eAAW,MAAM,OAAO,gBAAgB,OAAO,oBAAoB;AAAA,EACvE,SAAS,OAAY;AACjB,UAAM,SAAS,MAAM,UAAU,UAAU,eAAe,KAAK,MAAM,WAAW,EAAE,IAAI,CAAC;AACrF,QAAI,OAAO,MAAM,MAAM;AACnB,YAAM,IAAI;AAAA,QACN;AAAA,MACJ;AACJ,QAAI,OAAO,MAAM,MAAM;AACnB,YAAM,IAAI,MAAM,iDAAiD,uCAAsB,EAAE;AAC7F,UAAM;AAAA,EACV;AACA,MAAI,CAAC,oBAAoB,UAAU,QAAQ,EAAE;AACzC,UAAM,IAAI;AAAA,MACN,sEAAsE,uCAAsB;AAAA,IAChG;AACR;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/connect.ts"],
4
- "sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { openTenantSession, sessionFrom, type TenantSession } from '../services/preflight';\nimport { getTenantDir, getTenantFilesDir } from '../utils/helpers';\nimport { PipelineClient, PipelineProfile, PipelineService, readPipelineProfileFile } from './service';\nimport { checkPipelineCompatibility } from './compatibility';\nimport { boundedPipelineCall, boundedPipelineClient } from './requests';\nimport { PipelineError } from './errors';\n\nexport interface PipelinePaths {\n /** Holds .pipelines/<name>.json, the legacy .pipeline.json and the local run state. */\n profileDir: string;\n filesDir: string;\n stateRoot: string;\n}\n/** Which profile a command works on: an explicit file, a pipeline name, or neither. */\nexport interface ProfileSelection {\n profile?: string;\n pipeline?: string;\n}\n\nconst LEGACY_PROFILE = '.pipeline.json';\nconst PROFILES_DIR = '.pipelines';\n\nexport function pipelinePaths(tenant: string): PipelinePaths {\n const profileDir = getTenantDir(tenant);\n return { profileDir, filesDir: getTenantFilesDir(tenant), stateRoot: path.join(profileDir, '.pipeline-runs') };\n}\n\n/** A profile is named after its pipeline folder, the last segment of the workspace path. */\nexport function profileFile(profileDir: string, name: string): string {\n if (!name || name.includes('/') || name.includes('\\\\') || name === '.' || name === '..')\n throw new Error(`\"${name}\" is not a pipeline folder name`);\n return path.join(profileDir, PROFILES_DIR, `${name}.json`);\n}\n\nfunction namedProfiles(profileDir: string): string[] {\n const dir = path.join(profileDir, PROFILES_DIR);\n if (!fs.existsSync(dir)) return [];\n return fs\n .readdirSync(dir)\n .filter((f) => f.endsWith('.json'))\n .map((f) => f.slice(0, -'.json'.length))\n .sort();\n}\n\n/**\n * The one rule every command uses to find its profile. Exactly one named profile is\n * taken without being asked; the legacy single .pipeline.json still works on its own.\n */\nexport function resolveProfileFile(profileDir: string, selection: ProfileSelection): string {\n if (selection.profile && selection.pipeline)\n throw new PipelineError(\n 'refused',\n 'PIPELINE_SELECTION',\n 'Select the pipeline by name (pipeline=<name>) or give a profile file (profile=<path>), not both',\n 'Pass one selector only.',\n );\n if (selection.profile) return selection.profile;\n if (selection.pipeline) {\n const file = profileFile(profileDir, selection.pipeline);\n if (!fs.existsSync(file)) throw setupRequired(`No profile for pipeline \"${selection.pipeline}\" at ${file}`);\n return file;\n }\n const names = namedProfiles(profileDir);\n if (names.length === 1) return profileFile(profileDir, names[0]);\n if (names.length > 1)\n throw new PipelineError(\n 'refused',\n 'PIPELINE_SELECTION',\n `Several pipelines have profiles: ${names.join(', ')}. Select the pipeline by name (pipeline=<name>)`,\n 'Pass pipeline=<name> naming one of the listed pipelines.',\n );\n const legacy = path.join(profileDir, LEGACY_PROFILE);\n if (fs.existsSync(legacy)) return legacy;\n throw setupRequired(`No pipeline profile under ${profileDir}`);\n}\n\nfunction setupRequired(detail: string): PipelineError {\n return new PipelineError(\n 'refused',\n 'SETUP_REQUIRED',\n `${detail}; initialise the pipeline first (pipeline init)`,\n 'Run init with a prepared jobId or a new name, or ask the setup owner to prepare the job, source and output datasets. Do not substitute a local app or direct import.',\n );\n}\n\n/** Sign in (unless a validated session is supplied) and confirm protocol compatibility. */\nexport async function openPipelineConnection(\n organisation: string,\n tenant: string,\n validatedSession?: TenantSession,\n): Promise<PipelineClient> {\n let result = validatedSession;\n if (result && (result.organisation !== organisation || result.tenant !== tenant))\n throw new Error('Validated connection does not match the selected tenant');\n if (!result) {\n const outcome = await boundedPipelineCall(() => openTenantSession(organisation, tenant));\n if (!outcome.ok)\n throw new PipelineError(\n 'refused',\n 'TENANT_CONNECTION_REFUSED',\n `Cannot connect to ${organisation}/${tenant}: ${outcome.failure.reason}. Check the tenant and sign in.`,\n 'Check the tenant selection and sign in before retrying.',\n );\n result = sessionFrom(outcome.organisation, outcome.tenant, outcome.auth);\n }\n const client = result.client as PipelineClient;\n await checkPipelineCompatibility(boundedPipelineClient(client));\n return client;\n}\n\nexport function readPipelineProfile(file: string): PipelineProfile {\n return readPipelineProfileFile(file);\n}\n\nexport async function connectPipeline(\n organisation: string,\n tenant: string,\n selection: ProfileSelection,\n validatedSession?: TenantSession,\n) {\n const paths = pipelinePaths(tenant);\n const profile = readPipelineProfile(resolveProfileFile(paths.profileDir, selection));\n if (profile.organisation !== organisation || profile.tenant !== tenant)\n throw new Error(\n `Pipeline profile belongs to ${profile.organisation}/${profile.tenant}, not ${organisation}/${tenant}. If the pipeline was copied from another tenant, delete the copied .pipelines/ entry and run init name=<folder> here; only files/<name>/ moves between tenants.`,\n );\n const client = await openPipelineConnection(organisation, tenant, validatedSession);\n return new PipelineService(profile, client, paths.filesDir, paths.stateRoot, undefined);\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,uBAAmE;AACnE,qBAAgD;AAChD,qBAA0F;AAC1F,2BAA2C;AAC3C,sBAA2D;AAC3D,oBAA8B;AAc9B,MAAM,iBAAiB;AACvB,MAAM,eAAe;AAEd,SAAS,cAAc,QAA+B;AACzD,QAAM,iBAAa,6BAAa,MAAM;AACtC,SAAO,EAAE,YAAY,cAAU,kCAAkB,MAAM,GAAG,WAAW,KAAK,KAAK,YAAY,gBAAgB,EAAE;AACjH;AAGO,SAAS,YAAY,YAAoB,MAAsB;AAClE,MAAI,CAAC,QAAQ,KAAK,SAAS,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,SAAS,OAAO,SAAS;AAC/E,UAAM,IAAI,MAAM,IAAI,IAAI,iCAAiC;AAC7D,SAAO,KAAK,KAAK,YAAY,cAAc,GAAG,IAAI,OAAO;AAC7D;AAEA,SAAS,cAAc,YAA8B;AACjD,QAAM,MAAM,KAAK,KAAK,YAAY,YAAY;AAC9C,MAAI,CAAC,GAAG,WAAW,GAAG,EAAG,QAAO,CAAC;AACjC,SAAO,GACF,YAAY,GAAG,EACf,OAAO,CAAC,MAAM,EAAE,SAAS,OAAO,CAAC,EACjC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,QAAQ,MAAM,CAAC,EACtC,KAAK;AACd;AAMO,SAAS,mBAAmB,YAAoB,WAAqC;AACxF,MAAI,UAAU,WAAW,UAAU;AAC/B,UAAM,IAAI;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ;AACJ,MAAI,UAAU,QAA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MAA+B;AAC/D,aAAO,wCAAwB,IAAI;AACvC;AAEA,eAAsB,gBAClB,cACA,QACA,WACA,kBACF;AACE,QAAM,QAAQ,cAAc,MAAM;AAClC,QAAM,UAAU,oBAAoB,mBAAmB,MAAM,YAAY,SAAS,CAAC;AACnF,MAAI,QAAQ,iBAAiB,gBAAgB,QAAQ,WAAW;AAC5D,UAAM,IAAI;AAAA,MACN,+BAA+B,QAAQ,YAAY,IAAI,QAAQ,MAAM,SAAS,YAAY,IAAI,MAAM;AAAA,IACxG;AACJ,QAAM,SAAS,MAAM,uBAAuB,cAAc,QAAQ,gBAAgB;AAClF,SAAO,IAAI,+BAAgB,SAAS,QAAQ,MAAM,UAAU,MAAM,WAAW,MAAS;AAC1F;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/create.ts"],
4
- "sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { resolveRunnerImage } from '../services/apps';\nimport { profileFile, type PipelinePaths } from './connect';\nimport { initPipelineProfile, type InitResult } from './init';\nimport { localSourceFiles, PipelineService, readPipelineProfileFile, type PipelineClient } from './service';\nimport { PIPELINE_RUNNER_IMAGE } from './runtime';\n\nconst ENTRYPOINT = 'main.py';\n// The skill's starter for complete replacement outputs, with no destination arguments.\nconst STARTER_MAIN = `from farseer_simple_pipelines.runner import run_pipeline\nfrom farseer_simple_pipelines.storage import StoreType\nfrom farseer_simple_pipelines.authoring import PipelinePolicy\nrun_pipeline(store_type=StoreType.DATASETS, pipeline_policy=PipelinePolicy(), experimental__emit_pipeline_visualization_markers=True)\n`;\nconst FOLDER_NAME = /^[A-Za-z0-9][A-Za-z0-9._ -]*$/;\n\nexport interface CreateOptions {\n organisation: string;\n tenant: string;\n name: string;\n}\nexport interface CreateResult {\n organisation: string;\n tenant: string;\n jobId: number;\n name: string;\n workspace: string;\n profile: string;\n /** 'scaffold' wrote the starter files; 'adopted' uploaded the local folder that was already there. */\n source: 'scaffold' | 'adopted';\n created: { folder: { id: number; path: string }; job: { id: number; name: string }; files: string[] };\n pendingDatasets: InitResult['pendingDatasets'];\n warnings: string[];\n}\n\n/**\n * Start a pipeline on this tenant: the remote source folder, a job configured to run it, and\n * the profile init derives from that job. With no local folder the starter `main.py` is written\n * first; with one already there (a pipeline copied from another tenant, say) its source files\n * are uploaded as they are. Every refusal happens before the first remote write.\n */\nexport async function createPipeline(\n options: CreateOptions,\n client: PipelineClient,\n paths: PipelinePaths,\n): Promise<CreateResult> {\n const { name } = options;\n if (!FOLDER_NAME.test(name)) throw new Error(`\"${name}\" is not a plain pipeline folder name`);\n const workspaceDir = path.join(paths.filesDir, name);\n const adopting = fs.existsSync(workspaceDir);\n const scope = { workspace: name, entrypoint: ENTRYPOINT, configFiles: [] };\n // Entrypoint first, then a stable order, so the upload log reads the same on every machine.\n const entry = `${name}/${ENTRYPOINT}`;\n const sources = adopting\n ? localSourceFiles(scope, paths.filesDir).sort((a, b) =>\n a === entry ? -1 : b === entry ? 1 : a.localeCompare(b),\n )\n : [];\n if (adopting && !sources.includes(entry))\n throw new Error(\n `Local folder ${workspaceDir} exists but has no ${ENTRYPOINT}; it is not a pipeline folder. Pick another name or add the entrypoint.`,\n );\n refuseForeignProfile(profileFile(paths.profileDir, name), options);\n if ((await client.listApps()).some((app) => app.name === name))\n throw new Error(\n `Job \"${name}\" already exists on ${options.tenant}; pick another name or attach to that job (init jobId=<id>)`,\n );\n if (await client.resolveSourceFolder(name))\n throw new Error(\n `Folder \"${name}\" already exists under Files on ${options.tenant}; attach to its prepared job (init jobId=<id>) or pick another name`,\n );\n const image = resolveRunnerImage(PIPELINE_RUNNER_IMAGE, await client.getRunnerImageRepositories());\n if ('error' in image) throw new Error(image.error);\n // The backend hides Apps from a user without the remote jobs feature, super user or not, and\n // createApp then fails after the source folder is uploaded, leaving a folder that blocks a retry.\n if (!(await client.getFolderByPath(['Apps'])))\n throw new Error(\n `This user cannot see the Apps folder on ${options.tenant}, so init cannot create the job. Ask the tenant admin for the remote jobs feature (FEATURE.REMOTE_JOBS), then rerun init.`,\n );\n\n // Uploaded in this order into the new source folder. Models/ and Code/ stay local until they\n // hold a file. There is no starter model: every run would publish it as a dataset that only a\n // super user can delete.\n const files: { name: string; folder: string[]; content: string }[] = adopting\n ? sources.map((file) => {\n const inner = file.slice(name.length + 1).split('/');\n return {\n name: inner[inner.length - 1],\n folder: inner.slice(0, -1),\n content: fs.readFileSync(path.join(paths.filesDir, file), 'utf8'),\n };\n })\n : [{ name: ENTRYPOINT, folder: [], content: STARTER_MAIN }];\n if (!adopting) writeScaffold(workspaceDir, files);\n const created: string[] = [];\n try {\n for (const file of files) {\n await client.createFile(file.content, file.name, ['Files', name, ...file.folder]);\n created.push([name, ...file.folder, file.name].join('/'));\n }\n const folder = await client.resolveSourceFolder(name);\n const script = folder?.scripts.find((s) => s.name === ENTRYPOINT);\n if (!folder || !script) throw new Error(`Uploaded ${ENTRYPOINT} was not found in the new folder \"${name}\"`);\n const job = await client.createApp(name);\n created.push(`job ${job.id}`);\n await client.updateApp(\n String(job.id),\n { sourceFolderId: folder.id, mainScriptFileId: script.id, runnerImage: image.image },\n job,\n );\n const init = await initPipelineProfile(\n { organisation: options.organisation, tenant: options.tenant, jobId: job.id, workspace: name },\n client,\n paths,\n );\n // Local and remote are identical right now; one pull records that as the sync baseline,\n // so the first edit is a plain local change rather than a conflict with init's own upload.\n await new PipelineService(init.profile, client, paths.filesDir, paths.stateRoot).syncSources('pull');\n return {\n organisation: options.organisation,\n tenant: options.tenant,\n jobId: job.id,\n name,\n workspace: name,\n profile: init.file,\n source: adopting ? 'adopted' : 'scaffold',\n created: {\n folder: { id: folder.id, path: name },\n job: { id: job.id, name },\n files: created.filter((c) => !c.startsWith('job ')),\n },\n pendingDatasets: init.pendingDatasets,\n warnings: init.warnings,\n };\n } catch (error) {\n // The backend creates Files/<name> while storing the first file, so the folder can\n // exist even when no upload succeeded. Ask, rather than infer it from `created`.\n const remoteFolder = await client.resolveSourceFolder(name).then(\n (folder) => (folder ? 'present' : 'absent'),\n () => 'unknown',\n );\n const leftover = [\n ...(remoteFolder === 'present' ? [`folder Files/${name}`] : []),\n ...(remoteFolder === 'unknown' ? [`possibly folder Files/${name} (could not check)`] : []),\n ...created,\n ];\n throw new Error(\n `${String(error)}. Created before the failure and left in place: ${leftover.length ? leftover.join(', ') : 'nothing remote'}; local scaffold ${workspaceDir}`,\n );\n }\n}\n\n/**\n * A profile under this tenant that names another tenant is a copied .pipelines/ folder, the\n * mishap this guards against: it would make every later command talk about the wrong job.\n */\nfunction refuseForeignProfile(file: string, options: CreateOptions) {\n if (!fs.existsSync(file)) return;\n const existing = readPipelineProfileFile(file);\n if (existing.organisation !== options.organisation || existing.tenant !== options.tenant)\n throw new Error(\n `Profile ${file} belongs to ${existing.organisation}/${existing.tenant}, not ${options.organisation}/${options.tenant}. It was copied along with the pipeline; delete it and rerun init. Only files/<name>/ moves between tenants.`,\n );\n throw new Error(`Profile ${file} already exists; this pipeline is initialised on ${options.tenant}`);\n}\n\nfunction writeScaffold(workspaceDir: string, files: { name: string; folder: string[]; content: string }[]) {\n fs.mkdirSync(path.join(workspaceDir, 'Models'), { recursive: true });\n fs.mkdirSync(path.join(workspaceDir, 'Code'), { recursive: true });\n for (const file of files) fs.writeFileSync(path.join(workspaceDir, ...file.folder, file.name), file.content);\n fs.writeFileSync(path.join(workspaceDir, 'Code', '.gitkeep'), '');\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,kBAAmC;AACnC,qBAAgD;AAChD,kBAAqD;AACrD,qBAAgG;AAChG,qBAAsC;AAEtC,MAAM,aAAa;AAEnB,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAKrB,MAAM,cAAc;AA2BpB,eAAsB,eAClB,SACA,QACA,OACqB;AACrB,QAAM,EAAE,KAAK,IAAI;A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,MAAM,WAAW,IAAI,oDAAoD,QAAQ,MAAM,EAAE;AACvG;AAEA,SAAS,cAAc,cAAsB,OAA8D;AACvG,KAAG,UAAU,KAAK,KAAK,cAAc,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AACnE,KAAG,UAAU,KAAK,KAAK,cAAc,MAAM,GAAG,EAAE,WAAW,KAAK,CAAC;AACjE,aAAW,QAAQ,MAAO,IAAG,cAAc,KAAK,KAAK,cAAc,GAAG,KAAK,QAAQ,KAAK,IAAI,GAAG,KAAK,OAAO;AAC3G,KAAG,cAAc,KAAK,KAAK,cAAc,QAAQ,UAAU,GAAG,EAAE;AACpE;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/errors.ts"],
4
- "sourcesContent": ["/** Known pipeline outcomes; callers must not infer write acceptance from a transport error. */\nexport class PipelineError extends Error {\n constructor(\n readonly outcome: 'refused' | 'failed' | 'unknown',\n readonly code: string,\n message: string,\n readonly nextAction: string,\n readonly runUuid?: string,\n ) {\n super(message);\n this.name = 'PipelineError';\n }\n}\n\nexport function httpStatus(error: unknown): number | undefined {\n const value = error as { response?: { status?: number }; message?: string } | undefined;\n const status = Number(value?.response?.status ?? /^HTTP (\\d+):/.exec(value?.message ?? '')?.[1]);\n return Number.isFinite(status) ? status : undefined;\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,MAAM,sBAAsB,MAAM;AAAA,EACrC,YACa,SACA,MACT,SACS,YACA,SACX;AACE,UAAM,OAAO;AANJ;AACA;AAEA;AACA;AAGT,SAAK,OAAO;AAAA,EAChB;AACJ;AAEO,SAAS,WAAW,OAAoC;AAC3D,QAAM,QAAQ;AACd,QAAM,SAAS,OAAO,OAAO,UAAU,UAAU,eAAe,KAAK,OAAO,WAAW,EAAE,IAAI,CAAC,CAAC;AAC/F,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC9C;",
6
5
  "names": []
7
6
  }
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "formatVersion": 1,
3
- "engineVersion": "3.0.0",
4
- "engineProfile": "3.0",
5
- "runnerImage": "runner-python-simple-pipelines:1.14.0",
3
+ "engineVersion": "3.2.1",
4
+ "engineProfile": "3.2",
5
+ "runnerImage": "runner-python-simple-pipelines:1.17.0",
6
6
  "sourceHashes": {
7
- "data-platform/packages/simple-pipelines/src/farseer_simple_pipelines/schema.py": "f2b6408e74e1312bd7cc105df7055a08a1cf5fc8fadcf3b8e8897ac704758706",
8
- "data-platform/packages/simple-pipelines/pyproject.toml": "13e888969318f6fbac59d31f65d3295e075f004bbde6991fa0b24af1093fa608",
7
+ "data-platform/packages/simple-pipelines/src/farseer_simple_pipelines/schema.py": "290c529c594e529d14225577160aff1a256e8ae2dc3daf9422964ff2e0ade863",
8
+ "data-platform/packages/simple-pipelines/pyproject.toml": "39e2ffc934371952369c12ab4702accdca399afefa4fe6f65019cc6041cc09ab",
9
9
  "tools/pipeline/generate_docs.py": "3a3639b1421f06ed816a35def8861fc42104324eff3c38892ae8367bf877e4cc",
10
- "runner-images/VERSION": "bb0df1bd902faba507c15975eb9973e695f2732f760d851b4f9c7ba17068f5ff",
11
- "runner-images/python-simple-pipelines/pyproject.toml": "3b99503f425c7f0941a432d813b16c5bb5a0f9260ed2c0f7c00d697b7d950c45",
10
+ "runner-images/VERSION": "00afc49f1599e59129a59b64c2b019de3fe35300c05bb9d96cb25002576ff43b",
11
+ "runner-images/python-simple-pipelines/pyproject.toml": "a2da7943744a782bab55f3b7866eea9138e3636d858944258d84f0fd52e119d2",
12
12
  "tools/pipeline/examples/FarseerFilesExtractConfig.yaml": "20950da2f5413833dcaa1e700f13dd0597530c5a17d75ed96e35d6e3ca87eaa4",
13
13
  "tools/pipeline/examples/LoadCellsConfig.yaml": "2b56bd84e35765b616916c21c98fd306e2b93127358979777a77083991ac8bf1",
14
14
  "tools/pipeline/examples/ParseConfig.yaml": "c5b2deada46ba2edbe29410a37d4b3fd53ffd231d506417a5990cdd3c2d7f8ac",
@@ -24,8 +24,10 @@
24
24
  "Connection": "## Connection\n\nMaps a source column to a target dimension table (foreign key).\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_column` | string | yes | none | |\n| `target_dimension_table` | string | yes | none | |\n",
25
25
  "CsvParseOptions": "## CsvParseOptions\n\nHow to read a csv payload.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `encoding` | string | no | `\"utf-8\"` | |\n| `separator` | string or null | no | `null` | |\n| `decimal` | string or null | no | `null` | |\n| `has_header` | boolean | no | `true` | |\n| `columns` | string or null | no | `null` | |\n",
26
26
  "CsvWriteOptions": "## CsvWriteOptions\n\nOptions for DataFrame → CSV serialization on export.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `separator` | string | no | `\",\"` | |\n| `decimal` | string | no | `\".\"` | |\n| `encoding` | string | no | `\"utf-8\"` | |\n| `include_header` | boolean | no | `true` | |\n| `lineterminator` | string | no | `\"\\n\"` | minLength=`1` |\n",
27
+ "CustomExtractConfig": "## CustomExtractConfig\n\n`extract.type: custom` -- an extract an author writes, as an `@extractor` function in `Code/`.\n\nFor a source no built-in type reaches: an odd authentication, a SOAP\nservice, a flow of several calls. `script` is a file under `Code/`, in the\nfolder mirroring the step's own under `Models/`, and `function` names the\nfunction in it, the dataset's own name when omitted -- the binding\n`transform` and `parse` scripts follow.\n\n extract:\n type: custom\n custom:\n script: invoices.py\n args: {base_url: \"https://api.example.com/v1\"}\n secrets: {token: \"{{ pipeline_args.SHOP_TOKEN }}\"}\n\nThe function takes keyword-only `args` (a dict), `secrets` (a mapping\nthat prints itself masked), `http` (a client with retries and the\nnetwork guard of the `http` extract, sending `headers` with every\nrequest) and `logger`, each optional. Every value under `secrets` is\nmasked in the run's output, what the function prints included; a\ncredential put under `args` or `headers` is not.\n\nWhat the function returns is what lands: a file it wrote into the\ndirectory it was handed (the file's extension is the payload's format),\nrecords (a list or generator of dicts, landed as one JSON object per line),\nor a table (a DataFrame or Arrow table, landed as parquet). The parse step\nreading this extract interprets it, as for any other source, and\n`optional: true` skips only when the function raises\n`ExtractionSourceMissing`.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `script` | string | yes | none | |\n| `function` | string or null | no | `null` | |\n| `args` | object | no | none | |\n| `secrets` | map of string | no | none | |\n| `headers` | map of string | no | none | Headers the `http` client sends with every request, to any host, such as a `User-Agent` a source's firewall expects. Not credentials: those go under `secrets:`. |\n| `timeout` | number | no | `120.0` | maximum=`3600`; exclusiveMinimum=`0`; Seconds per request the `http` client handed to the function makes. |\n| `private_network` | boolean | no | `false` | |\n",
27
28
  "CustomField": "## CustomField\n\nMaps a DataFrame column to a CUSTOM column meta.\n\nEach imported cell receives the column's value in a per-cell JSON blob,\nkeyed by the column's header name (= `source_column`). Typical uses:\nsource-system IDs, processing notes, confidence scores.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_column` | string | yes | none | |\n",
28
- "DataSchema": "## DataSchema\n\nTop-level `schema:` block in a dataset YAML.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `columns` | array of [ColumnSchema](#columnschema) | yes | none | minItems=`1` |\n",
29
+ "DataFormat": "## DataFormat\n\nThe extension a stored file may carry, which is all a store needs.\n\nNot \"a format the framework can interpret\" -- every step writes parquet, and\n`parse:` decides how a payload is read. This is the narrower question of\nwhat a file at rest may be *called*, which the Farseer Files store answers\nby writing `<leaf>.<value>` and probing these in order to find it again.\n\nThe set mirrors the backend's upload allow-list exactly, so any file that\nstore accepts can be landed. A subset would be a second, narrower policy\nfor someone to keep in sync, and it would fail the first time a source\nhands back a type nobody trimmed for.\n\nA folder there can hold more than one file under a dataset's name -- the\nworkbook an extract reads sits beside the parquet it writes, and a\n`sales.csv` written before parquet became the only output stays until\nsomeone removes it -- because the store writes its own file and touches no\nother. A name the store wrote in this run is read under the extension it\nwas written with; the probe, which takes the first extension present, is\nfor files from earlier runs, so `PARQUET` is first: a step's own output is\nthe one found.\n\nValues: `\"parquet\"`, `\"csv\"`, `\"json\"`, `\"xlsx\"`, `\"xls\"`, `\"xml\"`, `\"zip\"`, `\"txt\"`, `\"html\"`, `\"pdf\"`, `\"docx\"`, `\"md\"`, `\"yaml\"`, `\"yml\"`, `\"css\"`, `\"scss\"`, `\"js\"`, `\"jsx\"`, `\"ts\"`, `\"tsx\"`, `\"py\"`, `\"jpg\"`, `\"jpeg\"`, `\"png\"`, `\"svg\"`, `\"gif\"`, `\"webp\"`\n",
30
+ "DataSchema": "## DataSchema\n\nTop-level `schema:` block in a dataset YAML: the columns the dataset keeps.\n\nA parse step or transform with a `schema:` writes exactly these columns, in\nthis order. A column its output has and this does not declare is dropped and\nnamed in a warning, so declare every column a reader needs; a declared column\nthe output lacks fails validation. Without a `schema:` every column is kept.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `columns` | array of [ColumnSchema](#columnschema) | yes | none | minItems=`1` |\n",
29
31
  "DateColumn": "## DateColumn\n\nMaps a DataFrame column to a DATE attribute column on a RAMA dim table.\n\nValues are converted to Excel serial numbers at load time via\n`farseer_client.date_utils.to_excel_serial`.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_column` | string | yes | none | |\n| `target_dimension_table_column` | string | yes | none | |\n",
30
32
  "DimensionTableEntryOptions": "## DimensionTableEntryOptions\n\nPer-entry options for one dimension-table sync (this table only).\n\nDistinct from `DimensionTableOptions`, which carries options for the\nwhole `model.load` call (all tables at once); these govern a single\ntable's source frame.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `allow_empty` | boolean | no | `false` | |\n",
31
33
  "DimensionTableOptions": "## DimensionTableOptions\n\nShared options for dimension table sync (applies to all tables in one API call).\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `delete_missing` | boolean | no | `false` | |\n",
@@ -33,8 +35,8 @@
33
35
  "ExportConfig": "## ExportConfig\n\nConfiguration for a `type: export` dataset step.\n\n`target` selects the destination system. The target-specific\nconfig block must match (e.g. `target: sharepoint` requires a\n`sharepoint:` section). Export steps are terminal sinks — no\ndownstream dataset depends on their output.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `target` | [ExportTarget](#exporttarget) | yes | none | |\n| `sharepoint` | [SharePointExportConfig](#sharepointexportconfig) or null | no | `null` | |\n| `farseer_files` | [FarseerFilesExportConfig](#farseerfilesexportconfig) or null | no | `null` | |\n| `allow_empty` | boolean | no | `false` | |\n",
34
36
  "ExportFormat": "## ExportFormat\n\nValues: `\"csv\"`, `\"xlsx\"`, `\"parquet\"`\n",
35
37
  "ExportTarget": "## ExportTarget\n\nValues: `\"sharepoint\"`, `\"farseer_files\"`\n",
36
- "ExtractConfig": "## ExtractConfig\n\nConfiguration for a `type: extract` dataset step.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | [ExtractType](#extracttype) | yes | none | |\n| `google_drive_public` | [GoogleDrivePublicExtractConfig](#googledrivepublicextractconfig) or null | no | `null` | |\n| `google_drive` | [GoogleDriveExtractConfig](#googledriveextractconfig) or null | no | `null` | |\n| `sharepoint` | [SharePointExtractConfig](#sharepointextractconfig) or null | no | `null` | |\n| `sql_database` | [SqlDatabaseExtractConfig](#sqldatabaseextractconfig) or null | no | `null` | |\n| `farseer` | [FarseerExtractConfig](#farseerextractconfig) or null | no | `null` | |\n| `business_central` | [BusinessCentralExtractConfig](#businesscentralextractconfig) or null | no | `null` | |\n| `tldv` | [TldvExtractConfig](#tldvextractconfig) or null | no | `null` | |\n| `intercom` | [IntercomExtractConfig](#intercomextractconfig) or null | no | `null` | |\n| `notion` | [NotionExtractConfig](#notionextractconfig) or null | no | `null` | |\n| `hubspot` | [HubspotExtractConfig](#hubspotextractconfig) or null | no | `null` | |\n| `sap_odata` | [SapOdataExtractConfig](#sapodataextractconfig) or null | no | `null` | |\n| `s3` | [S3ExtractConfig](#s3extractconfig) or null | no | `null` | |\n| `optional` | boolean | no | `false` | When true, a source that does not exist (404, no such table, no such file) skips this extract instead of failing the run. The skip propagates to the parse step reading it and every step that depends on that, loads and exports included, and the run still finishes successfully. Network errors, authentication failures, timeouts and 5xx responses still fail the run. |\n",
37
- "ExtractType": "## ExtractType\n\nValues: `\"google_drive_public\"`, `\"google_drive\"`, `\"sharepoint\"`, `\"sql_database\"`, `\"farseer\"`, `\"business_central\"`, `\"tldv\"`, `\"intercom\"`, `\"notion\"`, `\"hubspot\"`, `\"sap_odata\"`, `\"s3\"`\n",
38
+ "ExtractConfig": "## ExtractConfig\n\nConfiguration for a `type: extract` dataset step.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | [ExtractType](#extracttype) | yes | none | |\n| `google_drive_public` | [GoogleDrivePublicExtractConfig](#googledrivepublicextractconfig) or null | no | `null` | |\n| `google_drive` | [GoogleDriveExtractConfig](#googledriveextractconfig) or null | no | `null` | |\n| `sharepoint` | [SharePointExtractConfig](#sharepointextractconfig) or null | no | `null` | |\n| `sql_database` | [SqlDatabaseExtractConfig](#sqldatabaseextractconfig) or null | no | `null` | |\n| `farseer` | [FarseerExtractConfig](#farseerextractconfig) or null | no | `null` | |\n| `business_central` | [BusinessCentralExtractConfig](#businesscentralextractconfig) or null | no | `null` | |\n| `tldv` | [TldvExtractConfig](#tldvextractconfig) or null | no | `null` | |\n| `intercom` | [IntercomExtractConfig](#intercomextractconfig) or null | no | `null` | |\n| `notion` | [NotionExtractConfig](#notionextractconfig) or null | no | `null` | |\n| `hubspot` | [HubspotExtractConfig](#hubspotextractconfig) or null | no | `null` | |\n| `sap_odata` | [SapOdataExtractConfig](#sapodataextractconfig) or null | no | `null` | |\n| `s3` | [S3ExtractConfig](#s3extractconfig) or null | no | `null` | |\n| `http` | [HttpExtractConfig](#httpextractconfig) or null | no | `null` | |\n| `custom` | [CustomExtractConfig](#customextractconfig) or null | no | `null` | |\n| `optional` | boolean | no | `false` | When true, a source that does not exist (404, no such table, no such file) skips this extract instead of failing the run. The skip propagates to the parse step reading it and every step that depends on that, loads and exports included, and the run still finishes successfully. Network errors, authentication failures, timeouts and 5xx responses still fail the run. |\n",
39
+ "ExtractType": "## ExtractType\n\nValues: `\"google_drive_public\"`, `\"google_drive\"`, `\"sharepoint\"`, `\"sql_database\"`, `\"farseer\"`, `\"business_central\"`, `\"tldv\"`, `\"intercom\"`, `\"notion\"`, `\"hubspot\"`, `\"sap_odata\"`, `\"s3\"`, `\"http\"`, `\"custom\"`\n",
38
40
  "FarseerDatasetsExtractConfig": "## FarseerDatasetsExtractConfig\n\n`extract.farseer.source: datasets` — read a versioned dataset.\n\nReads from the Labs Datasets API: the symmetric counterpart to\n`DatasetDataStore` writes — same control-plane API, same GCS data-plane,\njust the read half.\n\n`qualified_name` is the dataset's registered name (the writer's\nqualified name maps 1:1 to the API `name` field). `version_id`\npins the read to a specific completed version for reproducibility;\nwhen omitted the extractor reads the dataset's currently promoted\nversion. An unpromoted dataset (created but never promoted) is\ntreated as a missing source so `optional: true` can absorb it.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `qualified_name` | string | yes | none | |\n| `version_id` | string or null | no | `null` | |\n",
39
41
  "FarseerDimensionsConnection": "## FarseerDimensionsConnection\n\nProjects a foreign-key column on a dim table to a DataFrame column.\n\nInverse of the load side's `dimension_tables.tables[].mapping.connections`.\nThe DataFrame cell receives a list of connected-member names\n(`/model/export` resolves FK ids to names server-side via\n`PK_MEMBER_EXTRACTOR`).\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_dimension_table` | string | yes | none | |\n| `target_column` | string | yes | none | |\n",
40
42
  "FarseerDimensionsDateColumn": "## FarseerDimensionsDateColumn\n\nProjects a DATE attribute column on a dim table to a DataFrame column.\n\nThe DataFrame value is the raw Excel serial number Rama stores — days\nsince 1899-12-30 with the 1900 leap-year bug preserved. See\n`clients/python/src/farseer_client/date_utils.py` for the formula\n(only the forward conversion `to_excel_serial` ships in the client\ntoday) if a downstream transform needs a Python date.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source_dimension_table_column` | string | yes | none | |\n| `target_column` | string | yes | none | |\n",
@@ -56,6 +58,16 @@
56
58
  "FixedDimension": "## FixedDimension\n\nPin a dimension member for a variable column.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `dimension_table` | string | yes | none | |\n| `dimension_member` | string | yes | none | |\n",
57
59
  "GoogleDriveExtractConfig": "## GoogleDriveExtractConfig\n\nExtraction settings for private Google Drive files (service account).\n\nAuthenticates as a Google Cloud service account; the client shares the\nfolder (or Shared Drive) with the service account's e-mail as a Viewer,\nso no domain-wide delegation and no per-user OAuth is involved.\n\n`service_account_json` is the service account's full JSON key,\ntemplated via `{{ pipeline_args.NAME }}` so a Remote Job's secret\n`expectedArguments` flow through at discovery time. Its shape is\nvalidated at extract time, not here — a schema-load error would echo\nthe offending input back into logs (`hide_input_in_errors` guards\nthe pydantic side of that).\n\nTwo addressing modes, mutually exclusive:\n\n- `file_id` — opaque Drive file ID.\n- `folder_id` + `file_path` — anchor folder ID (the folder the\n client shared) plus a slash-separated path below it, resolved one\n segment at a time. Folder IDs are stable across renames, so the\n anchor survives the client tidying up folder names. The final\n segment may contain `*` wildcards (e.g. `REPORT2502AC.*` for a\n source whose extension flips between `.xlsx` and `.xls` across\n periods); exactly one file must match.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `service_account_json` | string or null | no | `null` | |\n| `file_id` | string or null | no | `null` | |\n| `folder_id` | string or null | no | `null` | |\n| `file_path` | string or null | no | `null` | |\n",
58
60
  "GoogleDrivePublicExtractConfig": "## GoogleDrivePublicExtractConfig\n\nExtraction settings for public Google Drive files.\n\nOnly works with files shared as \"Anyone with the link\" — no auth required.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `file_id` | string | yes | none | |\n",
61
+ "HttpBasicAuth": "## HttpBasicAuth\n\nHTTP Basic authentication with a username and a password.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"basic\"` | yes | none | |\n| `username` | string | yes | none | |\n| `password` | string | yes | none | From a secret run argument: `{{ pipeline_args.NAME }}`. |\n",
62
+ "HttpBearerAuth": "## HttpBearerAuth\n\n`Authorization: Bearer <token>` on every request to the configured origin.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"bearer\"` | yes | none | |\n| `token` | string | yes | none | The token, from a secret run argument: `{{ pipeline_args.NAME }}`. |\n",
63
+ "HttpCursorPagination": "## HttpCursorPagination\n\nSend the cursor from each page as a query parameter, until a page returns none.\n\nA page that hands back the cursor it was asked with fails the step rather\nthan looping.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"cursor\"` | yes | none | |\n| `cursor` | string | yes | none | JSON Pointer to the next cursor in the body, e.g. `/meta/next_cursor`. |\n| `param` | string | yes | none | The query parameter the cursor is sent in. |\n| `max_pages` | integer | no | `1000` | exclusiveMinimum=`0`; A ceiling on pages, so a crawl that never ends fails instead of running until the job's time limit. A source with more pages fails the step; it never truncates. The empty page that ends a page or offset crawl does not count. |\n",
64
+ "HttpExtractConfig": "## HttpExtractConfig\n\n`extract.type: http` -- one HTTP(S) source, configured rather than coded.\n\nA single request lands the response body as it came, under `format` (or\nthe extension its `Content-Type` names), for the parse step reading this\nextract to interpret: an ECB `csvdata` response is read by\n`parse: {format: csv}` with no code at all.\n\nWith `records`, or with `pagination`, the body is JSON and what lands is\nthe records: the array `records` points at, from every page, one JSON\nobject per line, as the source sent each one. A `format: json` parse step\nreads them when the fields it declares are flat; nested ones need an\n`@parse` function.\n\n extract:\n type: http\n http:\n url: https://api.example.com/v1/orders\n params: {status: open}\n auth: {type: bearer, token: \"{{ pipeline_args.SHOP_TOKEN }}\"}\n records: /data\n pagination: {type: cursor, cursor: /meta/next_cursor, param: cursor}\n\nCredentials go in `auth:` and nowhere else, templated from secret run\narguments. They are sent only to the origin of `url`, masked in every\nmessage, and dropped on a redirect to another origin.\n\n`not_found` and `empty` say whether a 404, or a response with no body (no\nrecords, in record mode), means the data is not there -- the signal\n`optional: true` skips on -- or that something is wrong. Both default to\nfailing: the ECB answers 404 for a misspelled series key, which must not\nread as an absent month.\n\nDestinations other than public `https://` hosts are refused -- loopback,\nlink-local, private ranges and plain `http://` -- unless\n`private_network: true`, which is how a source behind the tenant's VPN is\nreached. That catches a wrong URL; it is not a sandbox.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `url` | string | yes | none | |\n| `method` | `\"GET\"`, `\"POST\"` | no | `\"GET\"` | |\n| `params` | map of string or integer or number or boolean | no | none | Query parameters, added to `url`'s own. |\n| `headers` | map of string | no | none | Headers that are not credentials; credentials go in `auth:`. |\n| `json` | any | no | `null` | A JSON request body, for `POST` only. |\n| `auth` | [HttpBearerAuth](#httpbearerauth) or [HttpBasicAuth](#httpbasicauth) or [HttpHeaderAuth](#httpheaderauth) or [HttpQueryAuth](#httpqueryauth) or [HttpOAuth2ClientCredentialsAuth](#httpoauth2clientcredentialsauth) or null | no | `null` | |\n| `format` | [DataFormat](#dataformat) or null | no | `null` | What the body is, which is the extension the payload is stored under. Omit it to take the one the `Content-Type` names. Record mode always lands `json`. |\n| `records` | string or null | no | `null` | JSON Pointer to the array of records in the body, e.g. `/data` or `/value`. Omit it for a body that is the array itself. |\n| `pagination` | [HttpNextUrlPagination](#httpnexturlpagination) or [HttpCursorPagination](#httpcursorpagination) or [HttpPagePagination](#httppagepagination) or [HttpOffsetPagination](#httpoffsetpagination) or null | no | `null` | |\n| `not_found` | `\"fail\"`, `\"missing\"` | no | `\"fail\"` | |\n| `empty` | `\"fail\"`, `\"missing\"` | no | `\"fail\"` | |\n| `timeout` | number | no | `120.0` | maximum=`3600`; exclusiveMinimum=`0`; Seconds per request. |\n| `private_network` | boolean | no | `false` | |\n",
65
+ "HttpHeaderAuth": "## HttpHeaderAuth\n\nOne or more headers carrying a key, such as `X-Api-Key`.\n\nEvery value here is treated as a secret: masked in messages and logs, and\nnever sent to another origin.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"header\"` | yes | none | |\n| `headers` | map of string | yes | none | |\n",
66
+ "HttpNextUrlPagination": "## HttpNextUrlPagination\n\nFollow each page's link to the next one, until a page has none.\n\n`next_url` points at the link in the body (`/@odata.nextLink`,\n`/links/next`). Without it the `Link` response header is read for\n`rel=\"next\"`. A relative link is resolved against the page it came from;\na link to another origin is refused, because the request carries the\nstep's credentials.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"next_url\"` | yes | none | |\n| `next_url` | string or null | no | `null` | JSON Pointer to the next page's URL in the body. Omit it to read the `Link` header. |\n| `max_pages` | integer | no | `1000` | exclusiveMinimum=`0`; A ceiling on pages, so a crawl that never ends fails instead of running until the job's time limit. A source with more pages fails the step; it never truncates. The empty page that ends a page or offset crawl does not count. |\n",
67
+ "HttpOAuth2ClientCredentialsAuth": "## HttpOAuth2ClientCredentialsAuth\n\nOAuth 2.0 client credentials: a token from `token_url`, then `Bearer` on every request.\n\nThe token is requested once per run and is not refreshed, so a crawl that\noutlives it fails with a 401 rather than continuing on a stale grant.\n`params` adds form fields some servers require, such as `audience` or\n`resource`.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"oauth2_client_credentials\"` | yes | none | |\n| `token_url` | string | yes | none | |\n| `client_id` | string | yes | none | |\n| `client_secret` | string | yes | none | From a secret run argument: `{{ pipeline_args.NAME }}`. |\n| `scope` | string or null | no | `null` | |\n| `params` | map of string | no | none | |\n",
68
+ "HttpOffsetPagination": "## HttpOffsetPagination\n\nMove an offset by the records each page returned, until a page returns none.\n\nIt asks for `limit` records a page but moves by what arrived, so a server\nthat caps its pages below `limit` is still read whole. It stops on an\nempty page for the reason page numbering does.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"offset\"` | yes | none | |\n| `param` | string | no | `\"offset\"` | |\n| `limit_param` | string | no | `\"limit\"` | |\n| `limit` | integer | yes | none | exclusiveMinimum=`0` |\n| `start` | integer | no | `0` | minimum=`0` |\n| `max_pages` | integer | no | `1000` | exclusiveMinimum=`0`; A ceiling on pages, so a crawl that never ends fails instead of running until the job's time limit. A source with more pages fails the step; it never truncates. The empty page that ends a page or offset crawl does not count. |\n",
69
+ "HttpPagePagination": "## HttpPagePagination\n\nNumber the pages in a query parameter, until a page returns no records.\n\nIt stops on the first empty page rather than the first short one: an API\nthat caps its page size below the one asked for returns short pages long\nbefore the end, and stopping there would drop the rest without a word.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"page\"` | yes | none | |\n| `param` | string | no | `\"page\"` | |\n| `start` | integer | no | `1` | |\n| `size_param` | string or null | no | `null` | |\n| `size` | integer or null | no | `null` | integer: exclusiveMinimum=`0` |\n| `max_pages` | integer | no | `1000` | exclusiveMinimum=`0`; A ceiling on pages, so a crawl that never ends fails instead of running until the job's time limit. A source with more pages fails the step; it never truncates. The empty page that ends a page or offset crawl does not count. |\n",
70
+ "HttpQueryAuth": "## HttpQueryAuth\n\nA key sent as a query parameter, such as `?api_key=...`.\n\nEvery value here is treated as a secret and masked wherever the URL is\nshown. Prefer a header where the API accepts one: a query string is more\nlikely to be logged on the server side.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `type` | `\"query\"` | yes | none | |\n| `params` | map of string | yes | none | |\n",
59
71
  "HubspotAssociationsExtractConfig": "## HubspotAssociationsExtractConfig\n\nOne row per (record of `object_type`, associated record) pair.\n\nThe link table between two HubSpot object types -- which company a deal\nbelongs to, which contacts a note was logged against. A record extract\ncarries no such information: HubSpot keeps associations beside the\nrecord, not on it, and reports them only when a crawl asks for the\n`to_object_types` by name. This grain does that ask over the same record\ncrawl `objects` uses, and explodes what comes back to one row per pair.\n\n`association_type` is HubSpot's own label for the link\n(`deal_to_company`, `note_to_contact`, ...). The same pair often arrives\ntwice, once as the typed link and once as its `_unlabeled` twin, which is\nHubSpot's representation of an unlabelled association rather than a\nduplicate; keep both or dedupe in a transform, as the model needs.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `object_type` | string | yes | none | |\n| `to_object_types` | array of string | yes | none | minItems=`1` |\n| `archived` | boolean | no | `false` | |\n| `page_size` | integer | no | `100` | maximum=`100`; exclusiveMinimum=`0` |\n",
60
72
  "HubspotExtractConfig": "## HubspotExtractConfig\n\n`extract.type: hubspot` — multi-source family over the HubSpot CRM API.\n\nAuthentication is a `pat-<region>-...` bearer token — either an\n**account service key** (the current developer platform's credential\nfor single-account API access) or a **legacy private app token**. Both\nare account-level, carry the same object-specific scopes, and go over\nthe wire identically, so `access_token` is validated only for presence\nand not for shape: a token format check here would reject a\nHubSpot-issued credential the moment they add a fourth variant. The\ntoken is supplied as a YAML field, typically templated via\n`{{ pipeline_args.HUBSPOT_ACCESS_TOKEN }}` so a Remote Job's secret\n`expectedArguments` flow through at discovery time.\n\n`source:` picks the grain; the matching inner block carries its\nconfig. One token covers every source, so it lives out here.\n\nEvery source stores a parquet payload, which a parse step reads with\n`format: parquet` — same as `business_central` and `sql_database`. A\n`schema:` goes on that parse step, where it checks the result rather than\ninstructing the read.\n\nHubSpot serializes every record property as a JSON *string*, including\nnumbers, booleans and dates. The extractor reads the object's property\ncatalog and coerces each column to the type HubSpot declares for it,\nbecause leaving it alone would make `amount` a text column that sums\nby concatenation, and `\"false\"` a truthy value. Record ids stay\nstrings deliberately: they exceed 2^53 in some portals, so any numeric\ndtype would corrupt them.\n\nTimestamps land as timezone-naive UTC. HubSpot documents every time as\nUTC and date-only properties as midnight UTC; dropping the marker\nrather than converting keeps the values as HubSpot stated them and\nmatches the physical type the platform's `type: datetime` declares.\nLocalizing them to a negative-offset zone downstream would move a\nclose date — and its revenue — into the previous month.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `source` | [HubspotSource](#hubspotsource) | yes | none | |\n| `access_token` | string or null | no | `null` | |\n| `objects` | [HubspotObjectsExtractConfig](#hubspotobjectsextractconfig) or null | no | `null` | |\n| `pipelines` | [HubspotPipelinesExtractConfig](#hubspotpipelinesextractconfig) or null | no | `null` | |\n| `properties` | [HubspotPropertyCatalogConfig](#hubspotpropertycatalogconfig) or null | no | `null` | |\n| `property_options` | [HubspotPropertyCatalogConfig](#hubspotpropertycatalogconfig) or null | no | `null` | |\n| `associations` | [HubspotAssociationsExtractConfig](#hubspotassociationsextractconfig) or null | no | `null` | |\n| `owners` | [HubspotOwnersExtractConfig](#hubspotownersextractconfig) or null | no | `null` | |\n",
61
73
  "HubspotObjectsExtractConfig": "## HubspotObjectsExtractConfig\n\nOne row per CRM record of `object_type`, one column per requested property.\n\n`object_type` is HubSpot's own plural object name as it appears in the\nAPI path (`deals`, `companies`, `contacts`, `line_items`, `tickets`),\nor a custom object's `p<portalId>_<name>` / `2-xxxxxxx` identifier.\n\n`properties` is required and has no wildcard form, which is the single\nmost consequential choice in this config. HubSpot returns only about\neight default properties when the parameter is omitted — a portal with\n400 deal properties answers a propertyless request with eight columns\nand no warning — so an implicit \"everything\" would make the dataset's\ncolumn set a function of whatever a HubSpot admin last added, silently\nfor undeclared columns and as a hard failure for anything downstream\ndeclaring a `schema:`. Declaring the list keeps the frame's shape owned\nby the pipeline. Extract `source: properties` first to discover what the\nportal actually has, then name the ones the model needs.\n\nProperty names are checked against the portal's own catalog before the\ncrawl starts: HubSpot ignores an unknown property rather than\nrejecting it, so a typo would otherwise land a frame quietly missing\nthat column.\n\n`archived` selects HubSpot's archived (soft-deleted, recoverable)\nrecords *instead of* the live ones — it is the API's own parameter, not\na union. Reading both means two datasets.\n\n`page_size` is HubSpot's `limit`. It defaults to the documented\nmaximum rather than HubSpot's own default of 10, which would make ten\ntimes as many requests for the same data.\n\nUnknown fields are rejected.\n\n| YAML field | Type | Required | Default | Constraints / description |\n| --- | --- | --- | --- | --- |\n| `object_type` | string | yes | none | |\n| `properties` | array of string | yes | none | minItems=`1` |\n| `archived` | boolean | no | `false` | |\n| `page_size` | integer | no | `100` | maximum=`100`; exclusiveMinimum=`0` |\n",
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/guide.ts"],
4
- "sourcesContent": ["import { pipelineSkill } from '../skills/pipeline';\n\n// CLI and MCP guide callers read the same method and practices as native skill clients.\nexport const PIPELINE_GUIDE = pipelineSkill.body;\nexport const PIPELINE_PRACTICES = pipelineSkill.practices;\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA8B;AAGvB,MAAM,iBAAiB,8BAAc;AACrC,MAAM,qBAAqB,8BAAc;",
6
5
  "names": []
7
6
  }
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/pipeline/init.ts"],
4
- "sourcesContent": ["import * as fs from 'fs';\nimport * as path from 'path';\nimport { randomUUID } from 'crypto';\nimport type { RemoteApp, SourceFolderResolution } from '../services/apps';\nimport { profileFile, type PipelinePaths } from './connect';\nimport { PIPELINE_ENGINE_PROFILE } from './reference';\nimport { assertPipelineRuntime, compareRuntime } from './runtime';\nimport {\n BLANK_SETUP,\n PipelineClient,\n PipelineProfile,\n PipelineService,\n profileSchema,\n readPipelineProfileFile,\n redact,\n SCHEDULE_NOTE,\n} from './service';\n\nconst { load: loadYaml }: { load: (source: string) => unknown } = require('js-yaml');\n\n/** What the skill's starter layout uses and what check expects when the job names no script. */\nconst CONVENTIONAL_ENTRYPOINT = 'main.py';\n// Mirrors the engine's charset for a rendered dataset name; anything else is templated or invalid.\nconst DATASET_NAME = /^[A-Za-z0-9_-]+$/;\n\nexport interface InitOptions {\n organisation: string;\n tenant: string;\n jobId: number;\n workspace?: string;\n force?: boolean;\n}\ninterface Definition {\n file: string;\n qualifiedName: string;\n}\ninterface SkippedDefinition {\n file: string;\n reason: string;\n}\nexport interface InitResult {\n file: string;\n profile: PipelineProfile;\n datasets: { name: string; id: string; file: string }[];\n /** Declared under Models/ but not created yet; the engine creates a dataset on its first write. */\n pendingDatasets: { name: string; file: string }[];\n skippedDefinitions: SkippedDefinition[];\n warnings: string[];\n nextSteps: string[];\n}\ntype Job = RemoteApp & { sourceFolderId: number; runnerImage: string };\n\n/** Derive a profile from the prepared job and write it. Reads only; never changes remote state. */\nexport async function initPipelineProfile(\n options: InitOptions,\n client: PipelineClient,\n paths: PipelinePaths,\n): Promise<InitResult> {\n const warnings: string[] = [];\n const job = await readJob(client, options.jobId);\n const workspace = options.workspace ?? (await locateWorkspace(client, job));\n const folder = await resolveFolder(client, job, workspace);\n const file = targetFile(paths.profileDir, workspace, options.force ?? false);\n const identity = {\n organisation: options.organisation,\n tenant: options.tenant,\n jobId: job.id,\n sourceFolderId: job.sourceFolderId,\n workspace,\n };\n const kept = writtenByPeople(file, identity, warnings);\n const draft = profileSchema.parse({\n ...identity,\n author: kept?.author,\n configFiles: kept?.configFiles,\n entrypoint: entrypointFor(job, folder, warnings),\n engine: PIPELINE_ENGINE_PROFILE,\n schedule: job.schedule ?? null,\n });\n const runtime = compareRuntime(job.runnerImage);\n if (runtime.status !== 'match') warnings.push(runtime.nextAction);\n if (job.schedule)\n warnings.push(`Job runs on schedule \"${job.schedule}\" (recorded in the profile). ${SCHEDULE_NOTE}`);\n const service = new PipelineService(draft, client, paths.filesDir, paths.stateRoot);\n const { definitions, skipped } = await scanDefinitions(service, paths.filesDir, warnings);\n const resolved = await resolveDatasets(client, definitions);\n const profile = profileSchema.parse({\n ...draft,\n datasetIds: [...new Set(resolved.datasets.map((d) => d.id))],\n setup: kept?.setup ?? BLANK_SETUP,\n });\n writeProfile(file, profile);\n return {\n file,\n profile,\n ...resolved,\n skippedDefinitions: skipped,\n warnings,\n nextSteps: [\n 'Fill the setup record: owner, checkedAt (ISO datetime), evidence, retentionDays, otherWritersExcluded=true and runtimeVerified=true. These are owner statements; check reports the record as pending until all are filled.',\n ...(resolved.pendingDatasets.length\n ? [\n `Pending datasets (${resolved.pendingDatasets.map((d) => d.name).join(', ')}) are created on the first run; rerun init jobId=${job.id} force=true after it to record their IDs.`,\n ]\n : []),\n 'Run check to see what is verified and what is still pending.',\n ],\n };\n}\n\nasync function readJob(client: PipelineClient, jobId: number): Promise<Job> {\n const job = await client.getApp(String(jobId));\n if (!job) throw new Error(`Job ${jobId} was not found on this tenant`);\n const runnerImage = job.runnerImage ?? '';\n assertPipelineRuntime(runnerImage);\n if (!job.sourceFolderId) throw new Error(`Job ${jobId} has no source folder; set one in the web app first`);\n return { ...job, sourceFolderId: job.sourceFolderId, runnerImage };\n}\n\n/** The job stores a folder ID, not a path; the path comes from where its main script lives. */\nasync function locateWorkspace(client: PipelineClient, job: Job): Promise<string> {\n const advice = 'give the workspace folder (workspace=<dir>, the tenant-relative source folder path)';\n if (!job.mainScriptFileId) throw new Error(`Job ${job.id} has no main script; ${advice}`);\n const script = (await client.listFiles(['Files'])).find((f) => f.reference === job.mainScriptFileId);\n if (!script) throw new Error(`Main script of job ${job.id} was not found under Files; ${advice}`);\n const workspace = path.posix.dirname(script.path);\n if (workspace === '.') throw new Error(`Main script of job ${job.id} sits at the Files root; ${advice}`);\n return workspace;\n}\n\nasync function resolveFolder(client: PipelineClient, job: Job, workspace: string): Promise<SourceFolderResolution> {\n const folder = await client.resolveSourceFolder(workspace);\n if (!folder) throw new Error(`Workspace folder \"${workspace}\" does not exist under Files`);\n if (folder.id !== job.sourceFolderId)\n throw new Error(\n `Workspace folder \"${workspace}\" (id ${folder.id}) is not the source folder of job ${job.id} (id ${job.sourceFolderId})`,\n );\n return folder;\n}\n\nfunction entrypointFor(job: Job, folder: SourceFolderResolution, warnings: string[]): string {\n const script = folder.scripts.find((s) => s.id === job.mainScriptFileId);\n if (script) return script.name;\n warnings.push(\n `Job ${job.id} names no main script inside its source folder; wrote the conventional entrypoint ${CONVENTIONAL_ENTRYPOINT}. Until the job's main script is set to it, check reports prepared-job as failed and run refuses.`,\n );\n return CONVENTIONAL_ENTRYPOINT;\n}\n\n/**\n * What people wrote into the existing profile, kept when it belongs to the same job and folder: a\n * rerun with force refreshes only what init reads from the job. A profile for anything else, or one\n * that cannot be read, is replaced by a fresh one.\n */\nfunction writtenByPeople(\n file: string,\n identity: Pick<PipelineProfile, 'organisation' | 'tenant' | 'jobId' | 'sourceFolderId' | 'workspace'>,\n warnings: string[],\n): Pick<PipelineProfile, 'author' | 'configFiles' | 'setup'> | undefined {\n if (!fs.existsSync(file)) return undefined;\n let existing: PipelineProfile;\n try {\n existing = readPipelineProfileFile(file);\n } catch (error) {\n warnings.push(\n `The existing profile could not be read, so its setup record, config files and author were not kept: ${redact(error instanceof Error ? error.message : String(error))}`,\n );\n return undefined;\n }\n const same = (Object.keys(identity) as (keyof typeof identity)[]).every((key) => existing[key] === identity[key]);\n return same ? { author: existing.author, configFiles: existing.configFiles, setup: existing.setup } : undefined;\n}\n\n/** Named after the pipeline folder, so one tenant can hold a profile per pipeline. */\nfunction targetFile(profileDir: string, workspace: string, force: boolean): string {\n const file = profileFile(profileDir, path.posix.basename(workspace));\n if (fs.existsSync(file) && !force)\n throw new Error(`Profile ${file} already exists for workspace ${workspace}; set force=true to overwrite it`);\n return file;\n}\n\n/** Dataset YAML in the local Models/ tree, pulled first when the workspace has no local source. */\nasync function scanDefinitions(\n service: PipelineService,\n filesDir: string,\n warnings: string[],\n): Promise<{ definitions: Definition[]; skipped: SkippedDefinition[] }> {\n if (!service.localSources().length) {\n try {\n await service.syncSources('pull');\n } catch (error) {\n warnings.push(\n `No local source and the pull failed, so no datasets were derived: ${redact(String(error))}. Fix the job, pull, then rerun init jobId=${service.profile.jobId} force=true.`,\n );\n }\n }\n const prefix = `${service.profile.workspace}/Models/`;\n const definitions: Definition[] = [];\n const skipped: SkippedDefinition[] = [];\n for (const file of service\n .localSources()\n .filter((f) => f.startsWith(prefix) && /\\.ya?ml$/.test(f))\n .sort()) {\n const parsed = readDefinition(path.join(filesDir, file), file.slice(prefix.length));\n if ('reason' in parsed) skipped.push({ file, reason: parsed.reason });\n else definitions.push({ file, qualifiedName: parsed.qualifiedName });\n }\n return { definitions, skipped };\n}\n\n/** Same rule as the engine: folders under Models/ form the namespace, the YAML name is the last segment. */\nfunction readDefinition(absolute: string, relativeToModels: string): { qualifiedName: string } | { reason: string } {\n let data: unknown;\n try {\n data = loadYaml(fs.readFileSync(absolute, 'utf8'));\n } catch {\n return { reason: 'invalid YAML syntax' };\n }\n const name = (data as { name?: unknown } | null)?.name;\n if (typeof name !== 'string') return { reason: 'no string name field' };\n if (!DATASET_NAME.test(name)) return { reason: `name \"${name}\" is templated or not a plain dataset name` };\n const namespace = path.posix\n .dirname(relativeToModels)\n .split('/')\n .filter((p) => p !== '.');\n return { qualifiedName: [...namespace, name].join('.') };\n}\n\nasync function resolveDatasets(client: PipelineClient, definitions: Definition[]) {\n // A newly scaffolded pipeline (or a plain script job) has no dataset names\n // to resolve. It must be initializable before dataset storage is configured.\n if (definitions.length === 0) return { datasets: [], pendingDatasets: [] };\n const remote = await client.pipelineRequest<{ id: string; name: string }[]>('GET', '/labs/datasets');\n const byName = new Map(remote.map((d) => [d.name, d.id]));\n const datasets: InitResult['datasets'] = [];\n const pendingDatasets: InitResult['pendingDatasets'] = [];\n for (const { file, qualifiedName: name } of definitions) {\n const id = byName.get(name);\n if (id) datasets.push({ name, id, file });\n else pendingDatasets.push({ name, file });\n }\n return { datasets, pendingDatasets };\n}\n\nfunction writeProfile(file: string, profile: PipelineProfile) {\n fs.mkdirSync(path.dirname(file), { recursive: true });\n const tmp = `${file}.${randomUUID()}`;\n fs.writeFileSync(tmp, JSON.stringify(profile, null, 2) + '\\n', { mode: 0o600 });\n fs.renameSync(tmp, file);\n}\n"],
5
4
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,SAAoB;AACpB,WAAsB;AACtB,oBAA2B;AAE3B,qBAAgD;AAChD,uBAAwC;AACxC,qBAAsD;AACtD,qBASO;AAEP,MAAM,EAAE,MAAM,SAAS,IAA2C,QAAQ,SAAS;AAGnF,MAAM,0BAA0B;AAEhC,MAAM,eAAe;AA8BrB,eAAsB,oBAClB,SACA,QACA,OACmB;AACnB,QAAM,WAAqB,CAAC;AAC5B,QAAM,MAAM,MAAM,QAAQ,QAAQ,QAAQ,KAAK;AAC/C,QAAM,YAAY,QAAQ,aAAc,MAAM,gBAAgB,QAAQ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