@selvajs/selva 4.21.0-beta.7 → 4.21.0-beta.8

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 (108) hide show
  1. package/build/adapter-node.js +1 -1
  2. package/build/client/_app/immutable/assets/0.CqqJCiiV.css +2 -0
  3. package/build/client/_app/immutable/assets/0.CqqJCiiV.css.br +0 -0
  4. package/build/client/_app/immutable/assets/0.CqqJCiiV.css.gz +0 -0
  5. package/build/client/_app/immutable/chunks/{BepzH9eI.js → DptnDNFA.js} +60 -55
  6. package/build/client/_app/immutable/chunks/DptnDNFA.js.br +0 -0
  7. package/build/client/_app/immutable/chunks/{BepzH9eI.js.gz → DptnDNFA.js.gz} +0 -0
  8. package/build/client/_app/immutable/chunks/DvJo0Zn0.js +1 -0
  9. package/build/client/_app/immutable/chunks/DvJo0Zn0.js.br +1 -0
  10. package/build/client/_app/immutable/chunks/DvJo0Zn0.js.gz +0 -0
  11. package/build/client/_app/immutable/entry/{app.Cmuegtgc.js → app.DPVyoSCt.js} +2 -2
  12. package/build/client/_app/immutable/entry/app.DPVyoSCt.js.br +0 -0
  13. package/build/client/_app/immutable/entry/app.DPVyoSCt.js.gz +0 -0
  14. package/build/client/_app/immutable/nodes/{15.BXIV1QfS.js → 15.0NRg5Hm0.js} +1 -1
  15. package/build/client/_app/immutable/nodes/15.0NRg5Hm0.js.br +0 -0
  16. package/build/client/_app/immutable/nodes/15.0NRg5Hm0.js.gz +0 -0
  17. package/build/client/_app/immutable/nodes/21.DpKe0-GH.js +1 -0
  18. package/build/client/_app/immutable/nodes/21.DpKe0-GH.js.br +0 -0
  19. package/build/client/_app/immutable/nodes/21.DpKe0-GH.js.gz +0 -0
  20. package/build/client/_app/version.json +1 -1
  21. package/build/client/_app/version.json.br +0 -0
  22. package/build/client/_app/version.json.gz +0 -0
  23. package/build/server/.vite/manifest.json +16 -27
  24. package/build/server/_app/immutable/assets/_layout.CqqJCiiV.css +2 -0
  25. package/build/server/chunks/api-errors.js +18 -3
  26. package/build/server/chunks/api-errors.js.map +1 -1
  27. package/build/server/chunks/boot.server.js +1 -1
  28. package/build/server/chunks/computeRateLimit.server.js +1 -1
  29. package/build/server/chunks/delete-with-blobs.js +1 -1
  30. package/build/server/chunks/engine.server.js +50 -3
  31. package/build/server/chunks/engine.server.js.map +1 -1
  32. package/build/server/chunks/grasshopper.js +1 -1
  33. package/build/server/chunks/handlers.js +4 -4
  34. package/build/server/chunks/handlers.js.map +1 -1
  35. package/build/server/chunks/http2.js +1 -1
  36. package/build/server/chunks/instance.js +3 -3
  37. package/build/server/chunks/internal.js +1 -1
  38. package/build/server/chunks/{abort-Bfrdupaj.js → keepalive-vtcjhAV3.js} +6 -3
  39. package/build/server/chunks/keepalive-vtcjhAV3.js.map +1 -0
  40. package/build/server/chunks/package.js +1 -1
  41. package/build/server/chunks/package.js.map +1 -1
  42. package/build/server/chunks/permissions.server.js +1 -1
  43. package/build/server/chunks/providers.server.js +72 -3
  44. package/build/server/chunks/providers.server.js.map +1 -1
  45. package/build/server/chunks/resolve-server.js +1 -1
  46. package/build/server/chunks/schema-extraction.js +75 -8
  47. package/build/server/chunks/schema-extraction.js.map +1 -1
  48. package/build/server/chunks/server-config-write.js +1 -1
  49. package/build/server/chunks/serverStats.server.js +1 -1
  50. package/build/server/chunks/solve.server.js +4 -5
  51. package/build/server/chunks/solve.server.js.map +1 -1
  52. package/build/server/chunks/sveltekit.js +3 -4
  53. package/build/server/chunks/sveltekit.js.map +1 -1
  54. package/build/server/entries/endpoints/api/admin/compute/_server.ts.js +1 -1
  55. package/build/server/entries/endpoints/api/admin/compute/actions/_server.ts.js +1 -1
  56. package/build/server/entries/endpoints/api/admin/compute/status/_server.ts.js +1 -1
  57. package/build/server/entries/endpoints/api/admin/system/health/_server.ts.js +1 -1
  58. package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js +1 -1
  59. package/build/server/entries/endpoints/api/admin/users/_id_/_server.ts.js +1 -1
  60. package/build/server/entries/endpoints/api/admin/users/_id_/disable/_server.ts.js +1 -1
  61. package/build/server/entries/endpoints/api/admin/users/_server.ts.js +1 -1
  62. package/build/server/entries/endpoints/api/files/_...path_/_server.ts.js +1 -1
  63. package/build/server/entries/endpoints/api/v1/compute/_server.ts.js +10 -5
  64. package/build/server/entries/endpoints/api/v1/compute/_server.ts.js.map +1 -1
  65. package/build/server/entries/endpoints/api/v1/compute/schema/_server.ts.js +2 -2
  66. package/build/server/entries/endpoints/api/v1/definitions/_guid_/solve/_server.ts.js +3 -3
  67. package/build/server/entries/endpoints/mcp/_server.ts.js +38 -9
  68. package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
  69. package/build/server/entries/hooks.server.js +1 -1
  70. package/build/server/entries/pages/admin/compute/_page.server.ts.js +1 -2
  71. package/build/server/entries/pages/admin/compute/_page.server.ts.js.map +1 -1
  72. package/build/server/entries/pages/admin/system/_page.server.ts.js +3 -3
  73. package/build/server/entries/pages/admin/system/_page.server.ts.js.map +1 -1
  74. package/build/server/entries/pages/admin/system/_page.svelte.js +1 -1
  75. package/build/server/entries/pages/admin/system/_page.svelte.js.map +1 -1
  76. package/build/server/entries/pages/library/_guid_/_page.server.ts.js +198 -99
  77. package/build/server/entries/pages/library/_guid_/_page.server.ts.js.map +1 -1
  78. package/build/server/entries/pages/library/_guid_/_page.svelte.js +462 -30
  79. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  80. package/build/server/manifest-full.js +1 -1
  81. package/build/server/manifest.js +1 -1
  82. package/build/server/nodes/0.js +2 -2
  83. package/build/server/nodes/15.js +1 -1
  84. package/build/server/nodes/21.js +1 -1
  85. package/build/server/server.js +1 -1
  86. package/package.json +8 -8
  87. package/templates/.env.example +5 -3
  88. package/build/client/_app/immutable/assets/0.2jDm0bqh.css +0 -2
  89. package/build/client/_app/immutable/assets/0.2jDm0bqh.css.br +0 -0
  90. package/build/client/_app/immutable/assets/0.2jDm0bqh.css.gz +0 -0
  91. package/build/client/_app/immutable/chunks/BepzH9eI.js.br +0 -0
  92. package/build/client/_app/immutable/chunks/BmoT9ksD.js +0 -1
  93. package/build/client/_app/immutable/chunks/BmoT9ksD.js.br +0 -1
  94. package/build/client/_app/immutable/chunks/BmoT9ksD.js.gz +0 -0
  95. package/build/client/_app/immutable/entry/app.Cmuegtgc.js.br +0 -0
  96. package/build/client/_app/immutable/entry/app.Cmuegtgc.js.gz +0 -0
  97. package/build/client/_app/immutable/nodes/15.BXIV1QfS.js.br +0 -0
  98. package/build/client/_app/immutable/nodes/15.BXIV1QfS.js.gz +0 -0
  99. package/build/client/_app/immutable/nodes/21.DvC40Ypm.js +0 -1
  100. package/build/client/_app/immutable/nodes/21.DvC40Ypm.js.br +0 -0
  101. package/build/client/_app/immutable/nodes/21.DvC40Ypm.js.gz +0 -0
  102. package/build/server/_app/immutable/assets/_layout.2jDm0bqh.css +0 -2
  103. package/build/server/chunks/abort-Bfrdupaj.js.map +0 -1
  104. package/build/server/chunks/computeLimits.js +0 -33
  105. package/build/server/chunks/computeLimits.js.map +0 -1
  106. /package/build/client/_app/immutable/nodes/{0.CYdyv5To.js → 0.Ds0zeDAg.js} +0 -0
  107. /package/build/client/_app/immutable/nodes/{0.CYdyv5To.js.br → 0.Ds0zeDAg.js.br} +0 -0
  108. /package/build/client/_app/immutable/nodes/{0.CYdyv5To.js.gz → 0.Ds0zeDAg.js.gz} +0 -0
@@ -1,4 +1,4 @@
1
- import { T as providers, f as getLogger, l as getErrorReporter, t as flag, u as getEventSink, w as lazyLogger, z as emptyProfile } from "../chunks/providers.server.js";
1
+ import { H as emptyProfile, T as providers, f as getLogger, l as getErrorReporter, t as flag, u as getEventSink, w as lazyLogger } from "../chunks/providers.server.js";
2
2
  import { n as env } from "../chunks/previous-key.js";
3
3
  import { M as isApiError } from "../chunks/access.js";
4
4
  import { t as SYSTEM_CONTEXT } from "../chunks/context.js";
@@ -1,8 +1,7 @@
1
1
  import { S as getTenancy, a as getComputeServerConfigStore, h as getOrganizationProvider } from "../../../../chunks/providers.server.js";
2
2
  import { i as platformServers } from "../../../../chunks/utils.js";
3
3
  import { r as assertManageCompute } from "../../../../chunks/access2.server.js";
4
- import { i as COMPUTE_SOLVE_CACHE_BYTES, t as COMPUTE_DEFINITION_CACHE_BYTES } from "../../../../chunks/computeLimits.js";
5
- import { a as definitionByteCacheStats, l as solveCacheStats } from "../../../../chunks/engine.server.js";
4
+ import { f as COMPUTE_DEFINITION_CACHE_BYTES, h as COMPUTE_SOLVE_CACHE_BYTES, o as definitionByteCacheStats, u as solveCacheStats } from "../../../../chunks/engine.server.js";
6
5
  // src/routes/admin/compute/+page.server.ts
7
6
  /**
8
7
  * Live counters for the two named caches. Read from the running process, so they
@@ -1 +1 @@
1
- {"version":3,"file":"_page.server.ts.js","names":[],"sources":["../../../../../../src/routes/admin/compute/+page.server.ts"],"sourcesContent":["import type { PageServerLoad } from './$types';\nimport {\n\tgetComputeServerConfigStore,\n\tgetOrganizationProvider,\n\tgetTenancy\n} from '#lib/server/providers.server.js';\nimport { assertManageCompute } from '#lib/server/access.server.js';\nimport { platformServers, type Organization } from '@selvajs/platform';\nimport { solveCacheStats, definitionByteCacheStats } from '#lib/server/compute/engine.server.js';\nimport {\n\tCOMPUTE_SOLVE_CACHE_BYTES,\n\tCOMPUTE_DEFINITION_CACHE_BYTES\n} from '#lib/server/computeLimits.js';\n\n/**\n * Live counters for the two named caches. Read from the running process, so they\n * describe THIS instance only — behind a load balancer each instance has its own\n * warm caches and its own numbers.\n */\nfunction readCacheStats() {\n\tconst solve = solveCacheStats();\n\tconst definition = definitionByteCacheStats();\n\treturn {\n\t\tsolve: {\n\t\t\t...solve,\n\t\t\tbudgetBytes: COMPUTE_SOLVE_CACHE_BYTES,\n\t\t\t// Per warm client, so the ceiling is the budget × however many are alive.\n\t\t\tbudgetTotalBytes: COMPUTE_SOLVE_CACHE_BYTES * Math.max(1, solve.warmClients)\n\t\t},\n\t\tdefinition: {\n\t\t\thits: definition.hits,\n\t\t\tmisses: definition.misses,\n\t\t\tevictions: definition.evictions,\n\t\t\tentries: definition.entries,\n\t\t\tbytes: definition.bytes,\n\t\t\tbudgetBytes: COMPUTE_DEFINITION_CACHE_BYTES\n\t\t}\n\t};\n}\n\nexport const load: PageServerLoad = async ({ locals }) => {\n\tassertManageCompute(locals);\n\tconst tenancy = getTenancy();\n\tconst caches = readCacheStats();\n\ttry {\n\t\tconst config = await getComputeServerConfigStore().getConfig(locals.ctx!);\n\t\tconst servers = platformServers(config).map(({ apiKey: _apiKey, hasApiKey, ...rest }) => ({\n\t\t\t...rest,\n\t\t\thasApiKey: !!hasApiKey\n\t\t}));\n\n\t\t// Org list drives the per-server \"Available to\" allowlist control. Skip\n\t\t// the fetch in single-tenancy — the control is hidden there. Otherwise\n\t\t// cap is generous: admin compute UIs aren't paginated and we want all\n\t\t// orgs in the picker without a network hop per row.\n\t\tlet orgs: Pick<Organization, 'id' | 'name' | 'slug'>[] = [];\n\t\tif (tenancy !== 'single') {\n\t\t\tconst orgsPage = await getOrganizationProvider().listOrgs(locals.ctx!, { limit: 500 });\n\t\t\torgs = orgsPage.items.map((o) => ({ id: o.id, name: o.name, slug: o.slug }));\n\t\t}\n\n\t\treturn {\n\t\t\tservers,\n\t\t\tdefaultServerId: config.defaultServerId ?? servers[0]?.id ?? '',\n\t\t\torgs,\n\t\t\ttenancy,\n\t\t\tcaches\n\t\t};\n\t} catch (err) {\n\t\t// Let auth errors bubble up; only catch data loading failures\n\t\tif (err && typeof err === 'object' && 'status' in err) {\n\t\t\tthrow err;\n\t\t}\n\t\treturn { servers: [], defaultServerId: '', orgs: [], tenancy, caches };\n\t}\n};\n"],"mappings":";;;;;;;;;;;AAmBA,SAAS,iBAAiB;CACzB,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,aAAa,yBAAyB;CAC5C,OAAO;EACN,OAAO;GACN,GAAG;GACH,aAAa;GAEb,kBAAkB,4BAA4B,KAAK,IAAI,GAAG,MAAM,WAAW;EAC5E;EACA,YAAY;GACX,MAAM,WAAW;GACjB,QAAQ,WAAW;GACnB,WAAW,WAAW;GACtB,SAAS,WAAW;GACpB,OAAO,WAAW;GAClB,aAAa;EACd;CACD;AACD;AAEA,IAAa,OAAuB,OAAO,EAAE,aAAa;CACzD,oBAAoB,MAAM;CAC1B,MAAM,UAAU,WAAW;CAC3B,MAAM,SAAS,eAAe;CAC9B,IAAI;EACH,MAAM,SAAS,MAAM,4BAA4B,CAAC,CAAC,UAAU,OAAO,GAAI;EACxE,MAAM,UAAU,gBAAgB,MAAM,CAAC,CAAC,KAAK,EAAE,QAAQ,SAAS,WAAW,GAAG,YAAY;GACzF,GAAG;GACH,WAAW,CAAC,CAAC;EACd,EAAE;EAMF,IAAI,OAAqD,CAAC;EAC1D,IAAI,YAAY,UAEf,QAAO,MADgB,wBAAwB,CAAC,CAAC,SAAS,OAAO,KAAM,EAAE,OAAO,IAAI,CAAC,EAAA,CACrE,MAAM,KAAK,OAAO;GAAE,IAAI,EAAE;GAAI,MAAM,EAAE;GAAM,MAAM,EAAE;EAAK,EAAE;EAG5E,OAAO;GACN;GACA,iBAAiB,OAAO,mBAAmB,QAAQ,EAAE,EAAE,MAAM;GAC7D;GACA;GACA;EACD;CACD,SAAS,KAAK;EAEb,IAAI,OAAO,OAAO,QAAQ,YAAY,YAAY,KACjD,MAAM;EAEP,OAAO;GAAE,SAAS,CAAC;GAAG,iBAAiB;GAAI,MAAM,CAAC;GAAG;GAAS;EAAO;CACtE;AACD"}
1
+ {"version":3,"file":"_page.server.ts.js","names":[],"sources":["../../../../../../src/routes/admin/compute/+page.server.ts"],"sourcesContent":["import type { PageServerLoad } from './$types';\nimport {\n\tgetComputeServerConfigStore,\n\tgetOrganizationProvider,\n\tgetTenancy\n} from '#lib/server/providers.server.js';\nimport { assertManageCompute } from '#lib/server/access.server.js';\nimport { platformServers, type Organization } from '@selvajs/platform';\nimport { solveCacheStats, definitionByteCacheStats } from '#lib/server/compute/engine.server.js';\nimport {\n\tCOMPUTE_SOLVE_CACHE_BYTES,\n\tCOMPUTE_DEFINITION_CACHE_BYTES\n} from '#lib/server/computeLimits.js';\n\n/**\n * Live counters for the two named caches. Read from the running process, so they\n * describe THIS instance only — behind a load balancer each instance has its own\n * warm caches and its own numbers.\n */\nfunction readCacheStats() {\n\tconst solve = solveCacheStats();\n\tconst definition = definitionByteCacheStats();\n\treturn {\n\t\tsolve: {\n\t\t\t...solve,\n\t\t\tbudgetBytes: COMPUTE_SOLVE_CACHE_BYTES,\n\t\t\t// Per warm client, so the ceiling is the budget × however many are alive.\n\t\t\tbudgetTotalBytes: COMPUTE_SOLVE_CACHE_BYTES * Math.max(1, solve.warmClients)\n\t\t},\n\t\tdefinition: {\n\t\t\thits: definition.hits,\n\t\t\tmisses: definition.misses,\n\t\t\tevictions: definition.evictions,\n\t\t\tentries: definition.entries,\n\t\t\tbytes: definition.bytes,\n\t\t\tbudgetBytes: COMPUTE_DEFINITION_CACHE_BYTES\n\t\t}\n\t};\n}\n\nexport const load: PageServerLoad = async ({ locals }) => {\n\tassertManageCompute(locals);\n\tconst tenancy = getTenancy();\n\tconst caches = readCacheStats();\n\ttry {\n\t\tconst config = await getComputeServerConfigStore().getConfig(locals.ctx!);\n\t\tconst servers = platformServers(config).map(({ apiKey: _apiKey, hasApiKey, ...rest }) => ({\n\t\t\t...rest,\n\t\t\thasApiKey: !!hasApiKey\n\t\t}));\n\n\t\t// Org list drives the per-server \"Available to\" allowlist control. Skip\n\t\t// the fetch in single-tenancy — the control is hidden there. Otherwise\n\t\t// cap is generous: admin compute UIs aren't paginated and we want all\n\t\t// orgs in the picker without a network hop per row.\n\t\tlet orgs: Pick<Organization, 'id' | 'name' | 'slug'>[] = [];\n\t\tif (tenancy !== 'single') {\n\t\t\tconst orgsPage = await getOrganizationProvider().listOrgs(locals.ctx!, { limit: 500 });\n\t\t\torgs = orgsPage.items.map((o) => ({ id: o.id, name: o.name, slug: o.slug }));\n\t\t}\n\n\t\treturn {\n\t\t\tservers,\n\t\t\tdefaultServerId: config.defaultServerId ?? servers[0]?.id ?? '',\n\t\t\torgs,\n\t\t\ttenancy,\n\t\t\tcaches\n\t\t};\n\t} catch (err) {\n\t\t// Let auth errors bubble up; only catch data loading failures\n\t\tif (err && typeof err === 'object' && 'status' in err) {\n\t\t\tthrow err;\n\t\t}\n\t\treturn { servers: [], defaultServerId: '', orgs: [], tenancy, caches };\n\t}\n};\n"],"mappings":";;;;;;;;;;AAmBA,SAAS,iBAAiB;CACzB,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,aAAa,yBAAyB;CAC5C,OAAO;EACN,OAAO;GACN,GAAG;GACH,aAAa;GAEb,kBAAkB,4BAA4B,KAAK,IAAI,GAAG,MAAM,WAAW;EAC5E;EACA,YAAY;GACX,MAAM,WAAW;GACjB,QAAQ,WAAW;GACnB,WAAW,WAAW;GACtB,SAAS,WAAW;GACpB,OAAO,WAAW;GAClB,aAAa;EACd;CACD;AACD;AAEA,IAAa,OAAuB,OAAO,EAAE,aAAa;CACzD,oBAAoB,MAAM;CAC1B,MAAM,UAAU,WAAW;CAC3B,MAAM,SAAS,eAAe;CAC9B,IAAI;EACH,MAAM,SAAS,MAAM,4BAA4B,CAAC,CAAC,UAAU,OAAO,GAAI;EACxE,MAAM,UAAU,gBAAgB,MAAM,CAAC,CAAC,KAAK,EAAE,QAAQ,SAAS,WAAW,GAAG,YAAY;GACzF,GAAG;GACH,WAAW,CAAC,CAAC;EACd,EAAE;EAMF,IAAI,OAAqD,CAAC;EAC1D,IAAI,YAAY,UAEf,QAAO,MADgB,wBAAwB,CAAC,CAAC,SAAS,OAAO,KAAM,EAAE,OAAO,IAAI,CAAC,EAAA,CACrE,MAAM,KAAK,OAAO;GAAE,IAAI,EAAE;GAAI,MAAM,EAAE;GAAM,MAAM,EAAE;EAAK,EAAE;EAG5E,OAAO;GACN;GACA,iBAAiB,OAAO,mBAAmB,QAAQ,EAAE,EAAE,MAAM;GAC7D;GACA;GACA;EACD;CACD,SAAS,KAAK;EAEb,IAAI,OAAO,OAAO,QAAQ,YAAY,YAAY,KACjD,MAAM;EAEP,OAAO;GAAE,SAAS,CAAC;GAAG,iBAAiB;GAAI,MAAM,CAAC;GAAG;GAAS;EAAO;CACtE;AACD"}
@@ -2,7 +2,7 @@ import { t as flag } from "../../../../chunks/providers.server.js";
2
2
  import { C as requirePermission } from "../../../../chunks/access.js";
3
3
  import { r as hasPermission } from "../../../../chunks/context.js";
4
4
  import { t as asHttpError } from "../../../../chunks/access2.server.js";
5
- import { a as MAX_DEFINITION_FILE_SIZE, c as RATE_LIMIT_WINDOW_MS, d as REMOTE_DEFINITION_MAX_BYTES, i as COMPUTE_SOLVE_CACHE_BYTES, l as REMOTE_DEFINITION_CACHE_TTL_MS, n as COMPUTE_REQUEST_MAX_BYTES, o as MAX_IMAGE_FILE_SIZE, r as COMPUTE_RESPONSE_MAX_BYTES, s as RATE_LIMIT_MAX_REQUESTS, t as COMPUTE_DEFINITION_CACHE_BYTES, u as REMOTE_DEFINITION_FETCH_TIMEOUT_MS } from "../../../../chunks/computeLimits.js";
5
+ import { S as REMOTE_DEFINITION_MAX_BYTES, _ as MAX_IMAGE_FILE_SIZE, a as computeRequestCap, b as REMOTE_DEFINITION_CACHE_TTL_MS, f as COMPUTE_DEFINITION_CACHE_BYTES, g as MAX_DEFINITION_FILE_SIZE, h as COMPUTE_SOLVE_CACHE_BYTES, m as COMPUTE_RESPONSE_MAX_BYTES, v as RATE_LIMIT_MAX_REQUESTS, x as REMOTE_DEFINITION_FETCH_TIMEOUT_MS, y as RATE_LIMIT_WINDOW_MS } from "../../../../chunks/engine.server.js";
6
6
  import { i as writeChannel, r as readChannel, t as checkForUpdate } from "../../../../chunks/updateCheck.server.js";
7
7
  import { t as getBootHealth } from "../../../../chunks/bootHealth.server.js";
8
8
  import { t as package_default } from "../../../../chunks/package.js";
@@ -35,7 +35,7 @@ var load = async ({ locals, fetch, request, url }) => {
35
35
  RATE_LIMIT_MAX_REQUESTS,
36
36
  MAX_DEFINITION_FILE_SIZE,
37
37
  MAX_IMAGE_FILE_SIZE,
38
- COMPUTE_REQUEST_MAX_BYTES,
38
+ COMPUTE_REQUEST_MAX_BYTES: computeRequestCap(),
39
39
  COMPUTE_RESPONSE_MAX_BYTES,
40
40
  REMOTE_DEFINITION_MAX_BYTES,
41
41
  REMOTE_DEFINITION_FETCH_TIMEOUT_MS,
@@ -77,7 +77,7 @@ async function configView(request, url) {
77
77
  checks: getConfigChecks({
78
78
  atRestOnPreviousKey,
79
79
  request: facts,
80
- computeRequestMaxBytes: COMPUTE_REQUEST_MAX_BYTES,
80
+ computeRequestMaxBytes: computeRequestCap(),
81
81
  dev: false
82
82
  })
83
83
  };
@@ -1 +1 @@
1
- {"version":3,"file":"_page.server.ts.js","names":["pkg"],"sources":["../../../../../../src/routes/admin/system/+page.server.ts"],"sourcesContent":["import { fail } from '@sveltejs/kit';\nimport { hasPermission } from '@selvajs/platform';\nimport { flag } from '#lib/server/providers.server.js';\nimport { checkForUpdate } from '#lib/server/updateCheck.server.js';\nimport { readChannel, writeChannel } from '#lib/server/releaseChannel.server.js';\nimport { asHttpError, requirePermission } from '#lib/server/access.server.js';\nimport {\n\tRATE_LIMIT_WINDOW_MS,\n\tRATE_LIMIT_MAX_REQUESTS,\n\tMAX_DEFINITION_FILE_SIZE,\n\tMAX_IMAGE_FILE_SIZE,\n\tCOMPUTE_REQUEST_MAX_BYTES,\n\tCOMPUTE_RESPONSE_MAX_BYTES,\n\tREMOTE_DEFINITION_MAX_BYTES,\n\tREMOTE_DEFINITION_FETCH_TIMEOUT_MS,\n\tREMOTE_DEFINITION_CACHE_TTL_MS,\n\tCOMPUTE_DEFINITION_CACHE_BYTES,\n\tCOMPUTE_SOLVE_CACHE_BYTES\n} from '#lib/server/computeLimits.js';\nimport { dev } from '$app/env';\nimport {\n\tgetChangesSinceLastBoot,\n\tgetConfigChecks,\n\tgetConfigReport,\n\tgetKeyRotation\n} from '#lib/server/config/boot.server.js';\nimport { requestFacts } from '#lib/server/config/checks.js';\nimport { getBootHealth } from '#lib/server/bootHealth.server.js';\nimport pkg from '../../../../package.json';\nimport type { Actions, PageServerLoad } from './$types';\n\n/**\n * System settings host the Update runner (`manage_updates`). Other panels\n * (platform-flag display, build/deploy metadata) are visible to anyone who\n * passed the layout-level `assertAnyPlatformPermission` gate.\n *\n * `version` comes from a build-time JSON import of this package's own\n * package.json — the runtime version IS the version we built with, and\n * after an admin update the new build embeds the new constant. No need to\n * shell out to `npm` or read node_modules at request time.\n */\nexport const load: PageServerLoad = async ({ locals, fetch, request, url }) => {\n\tconst ctx = locals.ctx;\n\tconst canManageUpdates = ctx ? hasPermission(ctx, 'manage_updates') : false;\n\t// The on-demand health check endpoint is instance_admin-only; gate the UI\n\t// to match so we don't show a button that 403s.\n\tconst isInstanceAdmin = ctx ? hasPermission(ctx, 'instance_admin') : false;\n\n\tconst flags = {\n\t\tALLOW_CROSS_ORG_PUBLIC: flag('ALLOW_CROSS_ORG_PUBLIC'),\n\t\tALLOW_ORG_COMPUTE_OVERRIDE: flag('ALLOW_ORG_COMPUTE_OVERRIDE'),\n\t\tALLOW_ORG_CREATION: flag('ALLOW_ORG_CREATION'),\n\t\tENABLE_PLATFORM_PROJECTS: flag('ENABLE_PLATFORM_PROJECTS'),\n\t\tENABLE_SHARING: flag('ENABLE_SHARING')\n\t};\n\n\t// Resolved compute/upload limits (computeLimits.ts is the single source of\n\t// truth — each value here reflects the env override or its default). Surfaced\n\t// read-only so operators can see what's enforced without reading the .env.\n\tconst limits = {\n\t\tRATE_LIMIT_WINDOW_MS,\n\t\tRATE_LIMIT_MAX_REQUESTS,\n\t\tMAX_DEFINITION_FILE_SIZE,\n\t\tMAX_IMAGE_FILE_SIZE,\n\t\tCOMPUTE_REQUEST_MAX_BYTES,\n\t\tCOMPUTE_RESPONSE_MAX_BYTES,\n\t\tREMOTE_DEFINITION_MAX_BYTES,\n\t\tREMOTE_DEFINITION_FETCH_TIMEOUT_MS,\n\t\tREMOTE_DEFINITION_CACHE_TTL_MS,\n\t\tCOMPUTE_DEFINITION_CACHE_BYTES,\n\t\tCOMPUTE_SOLVE_CACHE_BYTES\n\t};\n\n\t// The persisted release channel drives which dist-tag the update check (and\n\t// the runner) targets. Read it regardless of permission so the panel can show\n\t// it; only managers can change it via the action below.\n\tconst channel = readChannel();\n\n\t// Only operators who can run updates need the registry check — skip the\n\t// npm round-trip for everyone else.\n\tconst update = canManageUpdates\n\t\t? await checkForUpdate(fetch, channel)\n\t\t: {\n\t\t\t\tchannel,\n\t\t\t\tcurrent: null,\n\t\t\t\tlatest: null,\n\t\t\t\tupdateAvailable: false,\n\t\t\t\tnodeCompatibility: {\n\t\t\t\t\tcompatible: null,\n\t\t\t\t\trequired: null,\n\t\t\t\t\trunning: process.versions.node\n\t\t\t\t}\n\t\t\t};\n\n\treturn {\n\t\tcanManageUpdates,\n\t\tisInstanceAdmin,\n\t\tflags,\n\t\tlimits,\n\t\t// Hosts, ports and addresses: instance admins only, like the health check.\n\t\tconfig: isInstanceAdmin ? await configView(request, url) : null,\n\t\tversion: pkg.version,\n\t\tchannel,\n\t\tupdate\n\t};\n};\n\nasync function configView(request: Request, url: URL) {\n\t// Set only while SELVA_AT_REST_KEY_PREVIOUS is: what `--finish` would strand.\n\tconst atRestOnPreviousKey = (await getBootHealth()).atRestSecrets?.onPreviousKey ?? null;\n\tconst facts = requestFacts(request.headers, url);\n\treturn {\n\t\treport: getConfigReport(),\n\t\tchanges: getChangesSinceLastBoot(),\n\t\trotation: getKeyRotation(),\n\t\tproxied: facts.proxied,\n\t\tchecks: getConfigChecks({\n\t\t\tatRestOnPreviousKey,\n\t\t\trequest: facts,\n\t\t\tcomputeRequestMaxBytes: COMPUTE_REQUEST_MAX_BYTES,\n\t\t\tdev\n\t\t})\n\t};\n}\n\nexport const actions: Actions = {\n\t// Persist the release channel. Switch-only: this does NOT trigger an update —\n\t// the operator then uses the Update runner to install from the chosen channel.\n\tsetChannel: async ({ request, locals }) => {\n\t\tawait asHttpError(() => requirePermission(locals, 'manage_updates'));\n\t\tconst data = await request.formData();\n\t\tconst channel = data.get('channel');\n\t\tif (channel !== 'stable' && channel !== 'beta') {\n\t\t\treturn fail(400, { error: 'Invalid channel.' });\n\t\t}\n\t\ttry {\n\t\t\twriteChannel(channel);\n\t\t} catch (e) {\n\t\t\treturn fail(500, {\n\t\t\t\terror: `Could not persist the channel: ${e instanceof Error ? e.message : 'unknown error'}`\n\t\t\t});\n\t\t}\n\t\treturn { channel };\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,OAAuB,OAAO,EAAE,QAAQ,OAAO,SAAS,UAAU;CAC9E,MAAM,MAAM,OAAO;CACnB,MAAM,mBAAmB,MAAM,cAAc,KAAK,gBAAgB,IAAI;CAGtE,MAAM,kBAAkB,MAAM,cAAc,KAAK,gBAAgB,IAAI;CAErE,MAAM,QAAQ;EACb,wBAAwB,KAAK,wBAAwB;EACrD,4BAA4B,KAAK,4BAA4B;EAC7D,oBAAoB,KAAK,oBAAoB;EAC7C,0BAA0B,KAAK,0BAA0B;EACzD,gBAAgB,KAAK,gBAAgB;CACtC;CAKA,MAAM,SAAS;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;CAKA,MAAM,UAAU,YAAY;CAI5B,MAAM,SAAS,mBACZ,MAAM,eAAe,OAAO,OAAO,IACnC;EACA;EACA,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,mBAAmB;GAClB,YAAY;GACZ,UAAU;GACV,SAAS,QAAQ,SAAS;EAC3B;CACD;CAEF,OAAO;EACN;EACA;EACA;EACA;EAEA,QAAQ,kBAAkB,MAAM,WAAW,SAAS,GAAG,IAAI;EAC3D,SAASA,gBAAI;EACb;EACA;CACD;AACD;AAEA,eAAe,WAAW,SAAkB,KAAU;CAErD,MAAM,uBAAuB,MAAM,cAAc,EAAA,CAAG,eAAe,iBAAiB;CACpF,MAAM,QAAQ,aAAa,QAAQ,SAAS,GAAG;CAC/C,OAAO;EACN,QAAQ,gBAAgB;EACxB,SAAS,wBAAwB;EACjC,UAAU,eAAe;EACzB,SAAS,MAAM;EACf,QAAQ,gBAAgB;GACvB;GACA,SAAS;GACT,wBAAwB;GACxB,KAAA;EACD,CAAC;CACF;AACD;AAEA,IAAa,UAAmB,EAG/B,YAAY,OAAO,EAAE,SAAS,aAAa;CAC1C,MAAM,kBAAkB,kBAAkB,QAAQ,gBAAgB,CAAC;CAEnE,MAAM,WAAU,MADG,QAAQ,SAAS,EAAA,CACf,IAAI,SAAS;CAClC,IAAI,YAAY,YAAY,YAAY,QACvC,OAAO,KAAK,KAAK,EAAE,OAAO,mBAAmB,CAAC;CAE/C,IAAI;EACH,aAAa,OAAO;CACrB,SAAS,GAAG;EACX,OAAO,KAAK,KAAK,EAChB,OAAO,kCAAkC,aAAa,QAAQ,EAAE,UAAU,kBAC3E,CAAC;CACF;CACA,OAAO,EAAE,QAAQ;AAClB,EACD"}
1
+ {"version":3,"file":"_page.server.ts.js","names":["pkg"],"sources":["../../../../../../src/routes/admin/system/+page.server.ts"],"sourcesContent":["import { fail } from '@sveltejs/kit';\nimport { hasPermission } from '@selvajs/platform';\nimport { flag } from '#lib/server/providers.server.js';\nimport { checkForUpdate } from '#lib/server/updateCheck.server.js';\nimport { readChannel, writeChannel } from '#lib/server/releaseChannel.server.js';\nimport { asHttpError, requirePermission } from '#lib/server/access.server.js';\nimport {\n\tRATE_LIMIT_WINDOW_MS,\n\tRATE_LIMIT_MAX_REQUESTS,\n\tMAX_DEFINITION_FILE_SIZE,\n\tMAX_IMAGE_FILE_SIZE,\n\tCOMPUTE_RESPONSE_MAX_BYTES,\n\tREMOTE_DEFINITION_MAX_BYTES,\n\tREMOTE_DEFINITION_FETCH_TIMEOUT_MS,\n\tREMOTE_DEFINITION_CACHE_TTL_MS,\n\tCOMPUTE_DEFINITION_CACHE_BYTES,\n\tCOMPUTE_SOLVE_CACHE_BYTES\n} from '#lib/server/computeLimits.js';\nimport { computeRequestCap } from '#lib/server/compute/engine.server.js';\nimport { dev } from '$app/env';\nimport {\n\tgetChangesSinceLastBoot,\n\tgetConfigChecks,\n\tgetConfigReport,\n\tgetKeyRotation\n} from '#lib/server/config/boot.server.js';\nimport { requestFacts } from '#lib/server/config/checks.js';\nimport { getBootHealth } from '#lib/server/bootHealth.server.js';\nimport pkg from '../../../../package.json';\nimport type { Actions, PageServerLoad } from './$types';\n\n/**\n * System settings host the Update runner (`manage_updates`). Other panels\n * (platform-flag display, build/deploy metadata) are visible to anyone who\n * passed the layout-level `assertAnyPlatformPermission` gate.\n *\n * `version` comes from a build-time JSON import of this package's own\n * package.json — the runtime version IS the version we built with, and\n * after an admin update the new build embeds the new constant. No need to\n * shell out to `npm` or read node_modules at request time.\n */\nexport const load: PageServerLoad = async ({ locals, fetch, request, url }) => {\n\tconst ctx = locals.ctx;\n\tconst canManageUpdates = ctx ? hasPermission(ctx, 'manage_updates') : false;\n\t// The on-demand health check endpoint is instance_admin-only; gate the UI\n\t// to match so we don't show a button that 403s.\n\tconst isInstanceAdmin = ctx ? hasPermission(ctx, 'instance_admin') : false;\n\n\tconst flags = {\n\t\tALLOW_CROSS_ORG_PUBLIC: flag('ALLOW_CROSS_ORG_PUBLIC'),\n\t\tALLOW_ORG_COMPUTE_OVERRIDE: flag('ALLOW_ORG_COMPUTE_OVERRIDE'),\n\t\tALLOW_ORG_CREATION: flag('ALLOW_ORG_CREATION'),\n\t\tENABLE_PLATFORM_PROJECTS: flag('ENABLE_PLATFORM_PROJECTS'),\n\t\tENABLE_SHARING: flag('ENABLE_SHARING')\n\t};\n\n\t// Resolved compute/upload limits (computeLimits.ts is the single source of\n\t// truth — each value here reflects the env override or its default). Surfaced\n\t// read-only so operators can see what's enforced without reading the .env.\n\tconst limits = {\n\t\tRATE_LIMIT_WINDOW_MS,\n\t\tRATE_LIMIT_MAX_REQUESTS,\n\t\tMAX_DEFINITION_FILE_SIZE,\n\t\tMAX_IMAGE_FILE_SIZE,\n\t\tCOMPUTE_REQUEST_MAX_BYTES: computeRequestCap(),\n\t\tCOMPUTE_RESPONSE_MAX_BYTES,\n\t\tREMOTE_DEFINITION_MAX_BYTES,\n\t\tREMOTE_DEFINITION_FETCH_TIMEOUT_MS,\n\t\tREMOTE_DEFINITION_CACHE_TTL_MS,\n\t\tCOMPUTE_DEFINITION_CACHE_BYTES,\n\t\tCOMPUTE_SOLVE_CACHE_BYTES\n\t};\n\n\t// The persisted release channel drives which dist-tag the update check (and\n\t// the runner) targets. Read it regardless of permission so the panel can show\n\t// it; only managers can change it via the action below.\n\tconst channel = readChannel();\n\n\t// Only operators who can run updates need the registry check — skip the\n\t// npm round-trip for everyone else.\n\tconst update = canManageUpdates\n\t\t? await checkForUpdate(fetch, channel)\n\t\t: {\n\t\t\t\tchannel,\n\t\t\t\tcurrent: null,\n\t\t\t\tlatest: null,\n\t\t\t\tupdateAvailable: false,\n\t\t\t\tnodeCompatibility: {\n\t\t\t\t\tcompatible: null,\n\t\t\t\t\trequired: null,\n\t\t\t\t\trunning: process.versions.node\n\t\t\t\t}\n\t\t\t};\n\n\treturn {\n\t\tcanManageUpdates,\n\t\tisInstanceAdmin,\n\t\tflags,\n\t\tlimits,\n\t\t// Hosts, ports and addresses: instance admins only, like the health check.\n\t\tconfig: isInstanceAdmin ? await configView(request, url) : null,\n\t\tversion: pkg.version,\n\t\tchannel,\n\t\tupdate\n\t};\n};\n\nasync function configView(request: Request, url: URL) {\n\t// Set only while SELVA_AT_REST_KEY_PREVIOUS is: what `--finish` would strand.\n\tconst atRestOnPreviousKey = (await getBootHealth()).atRestSecrets?.onPreviousKey ?? null;\n\tconst facts = requestFacts(request.headers, url);\n\treturn {\n\t\treport: getConfigReport(),\n\t\tchanges: getChangesSinceLastBoot(),\n\t\trotation: getKeyRotation(),\n\t\tproxied: facts.proxied,\n\t\tchecks: getConfigChecks({\n\t\t\tatRestOnPreviousKey,\n\t\t\trequest: facts,\n\t\t\tcomputeRequestMaxBytes: computeRequestCap(),\n\t\t\tdev\n\t\t})\n\t};\n}\n\nexport const actions: Actions = {\n\t// Persist the release channel. Switch-only: this does NOT trigger an update —\n\t// the operator then uses the Update runner to install from the chosen channel.\n\tsetChannel: async ({ request, locals }) => {\n\t\tawait asHttpError(() => requirePermission(locals, 'manage_updates'));\n\t\tconst data = await request.formData();\n\t\tconst channel = data.get('channel');\n\t\tif (channel !== 'stable' && channel !== 'beta') {\n\t\t\treturn fail(400, { error: 'Invalid channel.' });\n\t\t}\n\t\ttry {\n\t\t\twriteChannel(channel);\n\t\t} catch (e) {\n\t\t\treturn fail(500, {\n\t\t\t\terror: `Could not persist the channel: ${e instanceof Error ? e.message : 'unknown error'}`\n\t\t\t});\n\t\t}\n\t\treturn { channel };\n\t}\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,OAAuB,OAAO,EAAE,QAAQ,OAAO,SAAS,UAAU;CAC9E,MAAM,MAAM,OAAO;CACnB,MAAM,mBAAmB,MAAM,cAAc,KAAK,gBAAgB,IAAI;CAGtE,MAAM,kBAAkB,MAAM,cAAc,KAAK,gBAAgB,IAAI;CAErE,MAAM,QAAQ;EACb,wBAAwB,KAAK,wBAAwB;EACrD,4BAA4B,KAAK,4BAA4B;EAC7D,oBAAoB,KAAK,oBAAoB;EAC7C,0BAA0B,KAAK,0BAA0B;EACzD,gBAAgB,KAAK,gBAAgB;CACtC;CAKA,MAAM,SAAS;EACd;EACA;EACA;EACA;EACA,2BAA2B,kBAAkB;EAC7C;EACA;EACA;EACA;EACA;EACA;CACD;CAKA,MAAM,UAAU,YAAY;CAI5B,MAAM,SAAS,mBACZ,MAAM,eAAe,OAAO,OAAO,IACnC;EACA;EACA,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,mBAAmB;GAClB,YAAY;GACZ,UAAU;GACV,SAAS,QAAQ,SAAS;EAC3B;CACD;CAEF,OAAO;EACN;EACA;EACA;EACA;EAEA,QAAQ,kBAAkB,MAAM,WAAW,SAAS,GAAG,IAAI;EAC3D,SAASA,gBAAI;EACb;EACA;CACD;AACD;AAEA,eAAe,WAAW,SAAkB,KAAU;CAErD,MAAM,uBAAuB,MAAM,cAAc,EAAA,CAAG,eAAe,iBAAiB;CACpF,MAAM,QAAQ,aAAa,QAAQ,SAAS,GAAG;CAC/C,OAAO;EACN,QAAQ,gBAAgB;EACxB,SAAS,wBAAwB;EACjC,UAAU,eAAe;EACzB,SAAS,MAAM;EACf,QAAQ,gBAAgB;GACvB;GACA,SAAS;GACT,wBAAwB,kBAAkB;GAC1C,KAAA;EACD,CAAC;CACF;AACD;AAEA,IAAa,UAAmB,EAG/B,YAAY,OAAO,EAAE,SAAS,aAAa;CAC1C,MAAM,kBAAkB,kBAAkB,QAAQ,gBAAgB,CAAC;CAEnE,MAAM,WAAU,MADG,QAAQ,SAAS,EAAA,CACf,IAAI,SAAS;CAClC,IAAI,YAAY,YAAY,YAAY,QACvC,OAAO,KAAK,KAAK,EAAE,OAAO,mBAAmB,CAAC;CAE/C,IAAI;EACH,aAAa,OAAO;CACrB,SAAS,GAAG;EACX,OAAO,KAAK,KAAK,EAChB,OAAO,kCAAkC,aAAa,QAAQ,EAAE,UAAU,kBAC3E,CAAC;CACF;CACA,OAAO,EAAE,QAAQ;AAClB,EACD"}
@@ -1388,7 +1388,7 @@ function _page($$renderer, $$props) {
1388
1388
  key: "COMPUTE_REQUEST_MAX_BYTES",
1389
1389
  label: "Compute request body cap",
1390
1390
  value: (l) => formatBytes(l.COMPUTE_REQUEST_MAX_BYTES),
1391
- note: "Inputs plus base64 file values."
1391
+ note: "Inputs plus base64 file values. The largest RHINO_COMPUTE_MAX_REQUEST_SIZE a reached compute server reports; 256 MB before one is reached."
1392
1392
  },
1393
1393
  {
1394
1394
  key: "COMPUTE_RESPONSE_MAX_BYTES",