@kodycodes/cli 3.46.2 → 3.46.4

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 (86) hide show
  1. package/dist/{auth-Q6TDDWB2.js → auth-2UN7GB4F.js} +8 -8
  2. package/dist/bin.js +11 -11
  3. package/dist/{chunk-F6N7JCMD.js → chunk-3LTYWJRX.js} +3 -3
  4. package/dist/{chunk-BYZB4U4P.js → chunk-5JI7IJFP.js} +7 -7
  5. package/dist/{chunk-MWC6FYWF.js → chunk-6XHJV62I.js} +4 -4
  6. package/dist/{chunk-RFZQC23P.js → chunk-7DTONYR5.js} +12 -6
  7. package/dist/{chunk-RFZQC23P.js.map → chunk-7DTONYR5.js.map} +1 -1
  8. package/dist/{chunk-6BMYORZK.js → chunk-BPSD6VMQ.js} +50 -50
  9. package/dist/{chunk-Q7XRVWKZ.js → chunk-ERURT3VD.js} +3 -3
  10. package/dist/{chunk-OFI4MF3S.js → chunk-FS5G5OLI.js} +4 -4
  11. package/dist/{chunk-6HPU7SMS.js → chunk-GBIQBEKD.js} +2 -2
  12. package/dist/{chunk-6JQXFR73.js → chunk-HRDM7TRJ.js} +3 -3
  13. package/dist/{chunk-W257N63R.js → chunk-IQSN4HQY.js} +6 -6
  14. package/dist/{chunk-XSRTFMCF.js → chunk-KIC65VM5.js} +4 -4
  15. package/dist/{chunk-2G3YXYZ4.js → chunk-LKJPBFUD.js} +2 -2
  16. package/dist/{chunk-2G3YXYZ4.js.map → chunk-LKJPBFUD.js.map} +1 -1
  17. package/dist/{chunk-VX2KDCQF.js → chunk-NZDTFELD.js} +3 -3
  18. package/dist/{chunk-ZER4SBOV.js → chunk-OZG2CY42.js} +5 -5
  19. package/dist/{chunk-OBK4CIB2.js → chunk-PQ53PPOM.js} +3 -3
  20. package/dist/{chunk-42C77QLO.js → chunk-RSODG7NF.js} +2 -2
  21. package/dist/{chunk-ZIL2JPJC.js → chunk-SCQKYYSW.js} +5 -5
  22. package/dist/{chunk-AM2SBW3C.js → chunk-U5MKJ4L4.js} +2 -2
  23. package/dist/{chunk-N33Y3A4H.js → chunk-UYRRMDAI.js} +2 -1
  24. package/dist/{chunk-N33Y3A4H.js.map → chunk-UYRRMDAI.js.map} +1 -1
  25. package/dist/{chunk-EJOF2MYU.js → chunk-VHOKL4CU.js} +2 -2
  26. package/dist/cli.js +11 -11
  27. package/dist/{commands-AMTPU2F7.js → commands-2KBEAASD.js} +6 -6
  28. package/dist/{dev-command-754FYKV6.js → dev-command-WYZNJ7NO.js} +13 -13
  29. package/dist/{execute-local-package-PVPTFQFM.js → execute-local-package-ILH7ARJT.js} +13 -13
  30. package/dist/{git-credential-BL7KCA76.js → git-credential-F3VDL2HQ.js} +9 -9
  31. package/dist/{local-execute-A4ZUH53E.js → local-execute-PM2TBMAH.js} +9 -9
  32. package/dist/{local-kody-BJ7OORPF.js → local-kody-BOIWOFLS.js} +10 -10
  33. package/dist/{local-package-graph-7A4ZQBXJ.js → local-package-graph-GKLQ4MGD.js} +7 -7
  34. package/dist/{local-package-run-2X72ZAV2.js → local-package-run-62YJYFJF.js} +11 -11
  35. package/dist/local-package-secret-write.d.ts +5 -2
  36. package/dist/{local-secrets-2S7KJ6EI.js → local-secrets-56KLEWFI.js} +7 -7
  37. package/dist/{mock-dep-resolve-ACHQAI36.js → mock-dep-resolve-DC7VVS4R.js} +6 -6
  38. package/dist/{mock-local-deps-43QBYHHF.js → mock-local-deps-OXSL65A4.js} +8 -8
  39. package/dist/{open-api-client-Z3LIDWQ2.js → open-api-client-DRJJFK2G.js} +7 -7
  40. package/dist/{org-ZPHE7DVE.js → org-JRDAABYV.js} +2 -2
  41. package/dist/{package-run-E34M5ERO.js → package-run-FO2LQL5J.js} +7 -7
  42. package/dist/publish-builder.js +292 -63
  43. package/dist/{remote-execute-CINWGFKJ.js → remote-execute-3OM2JI3S.js} +8 -8
  44. package/dist/{run-executor-OGVMKPIB.js → run-executor-I4R6QJHK.js} +2 -2
  45. package/dist/{setup-git-P5HLZX3R.js → setup-git-7LTQO23B.js} +8 -8
  46. package/dist/{store-7AFDVRNS.js → store-RVFCVRGK.js} +2 -2
  47. package/dist/store.d.ts +16 -3
  48. package/dist/{whoami-EU7HSV45.js → whoami-WSBAFVF3.js} +6 -6
  49. package/package.json +1 -1
  50. /package/dist/{auth-Q6TDDWB2.js.map → auth-2UN7GB4F.js.map} +0 -0
  51. /package/dist/{chunk-F6N7JCMD.js.map → chunk-3LTYWJRX.js.map} +0 -0
  52. /package/dist/{chunk-BYZB4U4P.js.map → chunk-5JI7IJFP.js.map} +0 -0
  53. /package/dist/{chunk-MWC6FYWF.js.map → chunk-6XHJV62I.js.map} +0 -0
  54. /package/dist/{chunk-6BMYORZK.js.map → chunk-BPSD6VMQ.js.map} +0 -0
  55. /package/dist/{chunk-Q7XRVWKZ.js.map → chunk-ERURT3VD.js.map} +0 -0
  56. /package/dist/{chunk-OFI4MF3S.js.map → chunk-FS5G5OLI.js.map} +0 -0
  57. /package/dist/{chunk-6HPU7SMS.js.map → chunk-GBIQBEKD.js.map} +0 -0
  58. /package/dist/{chunk-6JQXFR73.js.map → chunk-HRDM7TRJ.js.map} +0 -0
  59. /package/dist/{chunk-W257N63R.js.map → chunk-IQSN4HQY.js.map} +0 -0
  60. /package/dist/{chunk-XSRTFMCF.js.map → chunk-KIC65VM5.js.map} +0 -0
  61. /package/dist/{chunk-VX2KDCQF.js.map → chunk-NZDTFELD.js.map} +0 -0
  62. /package/dist/{chunk-ZER4SBOV.js.map → chunk-OZG2CY42.js.map} +0 -0
  63. /package/dist/{chunk-OBK4CIB2.js.map → chunk-PQ53PPOM.js.map} +0 -0
  64. /package/dist/{chunk-42C77QLO.js.map → chunk-RSODG7NF.js.map} +0 -0
  65. /package/dist/{chunk-ZIL2JPJC.js.map → chunk-SCQKYYSW.js.map} +0 -0
  66. /package/dist/{chunk-AM2SBW3C.js.map → chunk-U5MKJ4L4.js.map} +0 -0
  67. /package/dist/{chunk-EJOF2MYU.js.map → chunk-VHOKL4CU.js.map} +0 -0
  68. /package/dist/{commands-AMTPU2F7.js.map → commands-2KBEAASD.js.map} +0 -0
  69. /package/dist/{dev-command-754FYKV6.js.map → dev-command-WYZNJ7NO.js.map} +0 -0
  70. /package/dist/{execute-local-package-PVPTFQFM.js.map → execute-local-package-ILH7ARJT.js.map} +0 -0
  71. /package/dist/{git-credential-BL7KCA76.js.map → git-credential-F3VDL2HQ.js.map} +0 -0
  72. /package/dist/{local-execute-A4ZUH53E.js.map → local-execute-PM2TBMAH.js.map} +0 -0
  73. /package/dist/{local-kody-BJ7OORPF.js.map → local-kody-BOIWOFLS.js.map} +0 -0
  74. /package/dist/{local-package-graph-7A4ZQBXJ.js.map → local-package-graph-GKLQ4MGD.js.map} +0 -0
  75. /package/dist/{local-package-run-2X72ZAV2.js.map → local-package-run-62YJYFJF.js.map} +0 -0
  76. /package/dist/{local-secrets-2S7KJ6EI.js.map → local-secrets-56KLEWFI.js.map} +0 -0
  77. /package/dist/{mock-dep-resolve-ACHQAI36.js.map → mock-dep-resolve-DC7VVS4R.js.map} +0 -0
  78. /package/dist/{mock-local-deps-43QBYHHF.js.map → mock-local-deps-OXSL65A4.js.map} +0 -0
  79. /package/dist/{open-api-client-Z3LIDWQ2.js.map → open-api-client-DRJJFK2G.js.map} +0 -0
  80. /package/dist/{org-ZPHE7DVE.js.map → org-JRDAABYV.js.map} +0 -0
  81. /package/dist/{package-run-E34M5ERO.js.map → package-run-FO2LQL5J.js.map} +0 -0
  82. /package/dist/{remote-execute-CINWGFKJ.js.map → remote-execute-3OM2JI3S.js.map} +0 -0
  83. /package/dist/{run-executor-OGVMKPIB.js.map → run-executor-I4R6QJHK.js.map} +0 -0
  84. /package/dist/{setup-git-P5HLZX3R.js.map → setup-git-7LTQO23B.js.map} +0 -0
  85. /package/dist/{store-7AFDVRNS.js.map → store-RVFCVRGK.js.map} +0 -0
  86. /package/dist/{whoami-EU7HSV45.js.map → whoami-WSBAFVF3.js.map} +0 -0
@@ -27493,7 +27493,8 @@ var init_package_bound_runtime_exports = __esm({
27493
27493
  },
27494
27494
  { name: "credential", creator: "__kodyCreatePackageBoundCredentialRuntime" },
27495
27495
  { name: "credentials", creator: "__kodyCreatePackageBoundCredentialRuntime" },
27496
- { name: "packageContext", creator: "__kodyCreatePackageBoundPackageContext" }
27496
+ { name: "packageContext", creator: "__kodyCreatePackageBoundPackageContext" },
27497
+ { name: "events", creator: "__kodyCreatePackageBoundEvents" }
27497
27498
  ];
27498
27499
  packageBoundRuntimeExportNames = packageBoundRuntimeExports.map((entry) => entry.name);
27499
27500
  credentialRuntimeName = "__kodyPackageCredentialRuntime";
@@ -28226,7 +28227,7 @@ function isD1NetworkConnectionLostMessage(message) {
28226
28227
  return isExactD1PlatformMessage(message, d1NetworkConnectionLostMessage);
28227
28228
  }
28228
28229
  function isD1DbOverloadedMessage(message) {
28229
- return isExactD1PlatformMessage(message, d1DbOverloadedMessage) || isExactD1PlatformMessage(message, d1DbOverloadedTooManyQueuedMessage) || isExactD1PlatformMessage(message, d1DbOverloadedResourceWindowMessage);
28230
+ return isExactD1PlatformMessage(message, d1DbOverloadedMessage) || isExactD1PlatformMessage(message, d1DbOverloadedTooManyQueuedMessage) || isExactD1PlatformMessage(message, d1DbOverloadedResourceWindowMessage) || isExactD1PlatformMessage(message, d1AccountOverloadedMessage);
28230
28231
  }
28231
28232
  function isD1InternalErrorMessage(message) {
28232
28233
  return d1InternalErrorReferencePattern.test(stripD1ErrorPrefixes(message));
@@ -28245,6 +28246,23 @@ function isRetryableD1LockMessage(message) {
28245
28246
  function isRetryableD1LockError(error2) {
28246
28247
  return errorCauseChainIncludes(error2, isRetryableD1LockMessage);
28247
28248
  }
28249
+ function classifyRetryableD1Message(message) {
28250
+ if (message.includes("SQLITE_BUSY") || message.includes("database is locked"))
28251
+ return "lock";
28252
+ if (message.includes(d1LongRunningExportMessage)) return "export";
28253
+ if (isD1NetworkConnectionLostMessage(message)) return "network";
28254
+ if (isD1DbOverloadedMessage(message)) return "overloaded";
28255
+ if (isD1InternalErrorMessage(message)) return "internal";
28256
+ if (isD1DurableObjectPlatformResetMessage(message)) return "do_reset";
28257
+ return null;
28258
+ }
28259
+ function classifyRetryableD1Error(error2) {
28260
+ for (const entry of getErrorCauseChain(error2)) {
28261
+ const kind = classifyRetryableD1Message(getErrorMessage(entry));
28262
+ if (kind) return kind;
28263
+ }
28264
+ return null;
28265
+ }
28248
28266
  function isD1AttemptTimeoutError(error2) {
28249
28267
  return error2 instanceof D1AttemptTimeoutError;
28250
28268
  }
@@ -28285,13 +28303,13 @@ async function runD1WithRetry(operation, options) {
28285
28303
  }
28286
28304
  const backoffMs = baseDelayMs * 2 ** (attempt - 1);
28287
28305
  await sleep(
28288
- options?.jitter ? backoffMs / 2 + Math.random() * (backoffMs / 2) : backoffMs
28306
+ options?.jitter || classifyRetryableD1Error(error2) === "overloaded" ? backoffMs / 2 + Math.random() * (backoffMs / 2) : backoffMs
28289
28307
  );
28290
28308
  }
28291
28309
  }
28292
28310
  throw lastError;
28293
28311
  }
28294
- var d1LockRetryMaxAttempts, d1LockRetryBaseDelayMs, d1LongRunningExportMessage, d1NetworkConnectionLostMessage, d1DbOverloadedMessage, d1DbOverloadedTooManyQueuedMessage, d1DbOverloadedResourceWindowMessage, d1InternalErrorReferencePattern, d1DurableObjectPlatformResetMessages, d1RetryAttemptsByError, D1AttemptTimeoutError;
28312
+ var d1LockRetryMaxAttempts, d1LockRetryBaseDelayMs, d1LongRunningExportMessage, d1NetworkConnectionLostMessage, d1DbOverloadedMessage, d1DbOverloadedTooManyQueuedMessage, d1DbOverloadedResourceWindowMessage, d1AccountOverloadedMessage, d1InternalErrorReferencePattern, d1DurableObjectPlatformResetMessages, d1RetryAttemptsByError, D1AttemptTimeoutError;
28295
28313
  var init_d1_retry = __esm({
28296
28314
  "../shared/src/d1-retry.ts"() {
28297
28315
  "use strict";
@@ -28303,6 +28321,7 @@ var init_d1_retry = __esm({
28303
28321
  d1DbOverloadedMessage = "D1 DB is overloaded. Requests queued for too long";
28304
28322
  d1DbOverloadedTooManyQueuedMessage = "D1 DB is overloaded. Too many requests queued";
28305
28323
  d1DbOverloadedResourceWindowMessage = "D1 DB is overloaded. Too many resources consumed within a 10 second window";
28324
+ d1AccountOverloadedMessage = "Your account is generating too much load on D1 DBs. Please back off and try again later";
28306
28325
  d1InternalErrorReferencePattern = /^internal error(?: (?:in|while starting up) (?:D1 DB|Durable Object) storage caused object to be reset)?;\s*reference\s*=\s*[A-Za-z0-9_-]+$/i;
28307
28326
  d1DurableObjectPlatformResetMessages = [
28308
28327
  "Durable Object reset because its code was updated",
@@ -28804,6 +28823,43 @@ var init_store = __esm({
28804
28823
  }
28805
28824
  });
28806
28825
 
28826
+ // ../shared/src/isolate-state.ts
28827
+ function isolateStateRegistry() {
28828
+ const scope = globalThis;
28829
+ scope[registryKey] ??= /* @__PURE__ */ new Set();
28830
+ return scope[registryKey];
28831
+ }
28832
+ function isolateState(create, options) {
28833
+ const state2 = { current: create() };
28834
+ isolateStateRegistry().add({
28835
+ reset() {
28836
+ state2.current = create();
28837
+ },
28838
+ pending() {
28839
+ return options?.pending?.(state2.current) ?? [];
28840
+ }
28841
+ });
28842
+ return state2;
28843
+ }
28844
+ function isolateCollection(collection, options) {
28845
+ isolateStateRegistry().add({
28846
+ reset() {
28847
+ collection.clear();
28848
+ },
28849
+ pending() {
28850
+ return options?.pending?.(collection) ?? [];
28851
+ }
28852
+ });
28853
+ return collection;
28854
+ }
28855
+ var registryKey;
28856
+ var init_isolate_state = __esm({
28857
+ "../shared/src/isolate-state.ts"() {
28858
+ "use strict";
28859
+ registryKey = /* @__PURE__ */ Symbol.for("kody.isolate-state");
28860
+ }
28861
+ });
28862
+
28807
28863
  // ../worker/src/feature-flags/execution-scope.ts
28808
28864
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
28809
28865
  var executionIdleTtlMs, callReadsStorage;
@@ -28838,6 +28894,8 @@ var init_registry = __esm({
28838
28894
  featureFlagDefinitions = [
28839
28895
  {
28840
28896
  key: "files-workspace",
28897
+ removeWhen: "Workspace Files is on for everyone; delete the flag and gate sites.",
28898
+ reviewBy: "2027-02-15",
28841
28899
  defaultEnabled: false,
28842
28900
  defaultAudience: "experiments_opt_in",
28843
28901
  description: "Workspace Files, including comments, presence, and agent tools. Off by default for controlled rollout.",
@@ -28850,6 +28908,7 @@ var init_registry = __esm({
28850
28908
  },
28851
28909
  {
28852
28910
  key: "demo-indicator",
28911
+ reviewBy: "2027-05-19",
28853
28912
  defaultEnabled: false,
28854
28913
  description: "Reserved for exercising the feature flag system end-to-end. When enabled it shows a small demo indicator in the app UI. Safe to toggle."
28855
28914
  // Intentionally no successMetric: this permanent flag exists to
@@ -28858,6 +28917,8 @@ var init_registry = __esm({
28858
28917
  },
28859
28918
  {
28860
28919
  key: "profiles",
28920
+ removeWhen: "Profiles graduate (ADR 0092); delete the flag and gate sites.",
28921
+ reviewBy: "2027-02-01",
28861
28922
  defaultEnabled: false,
28862
28923
  defaultAudience: "experiments_opt_in",
28863
28924
  description: "Profiles (ADR 0092): scoped identities a person creates for agents and bots, with snapshot grants capped by the parent chain, shorten-only expiry, and terminal revoke. Off by default; experimenters opt in at /account/experiments. Delete the flag and gate sites when profiles graduate.",
@@ -28870,6 +28931,8 @@ var init_registry = __esm({
28870
28931
  },
28871
28932
  {
28872
28933
  key: "mcp-events-extension",
28934
+ removeWhen: "The MCP Events experiment ends; delete the flag and gate sites.",
28935
+ reviewBy: "2027-01-15",
28873
28936
  defaultEnabled: false,
28874
28937
  defaultAudience: "experiments_opt_in",
28875
28938
  description: "MCP Events extension (draft, webhook delivery only) on the stateless /mcp lane: advertise the events capability and serve events/list, events/subscribe, and events/unsubscribe for package kody.emits topics that opt in with mcp: true. OAuth callers only; clients declare nothing. Off by default; enable with audience experiments_opt_in. Signed-in users can also turn it on from /docs/mcp-events. Delete the flag and gate sites when the experiment ends.",
@@ -28883,6 +28946,8 @@ var init_registry = __esm({
28883
28946
  },
28884
28947
  {
28885
28948
  key: "package-credential-suppliers",
28949
+ removeWhen: "The follow-up removes supplier aliases and legacy paths.",
28950
+ reviewBy: "2027-01-15",
28886
28951
  defaultEnabled: false,
28887
28952
  description: "Gate publisher- and executor-supplied package credentials, including visitor grant mappings. Off by default. Delete this flag after the follow-up removes supplier aliases and legacy paths."
28888
28953
  // Intentionally no successMetric: a credential authority boundary, not
@@ -28890,6 +28955,8 @@ var init_registry = __esm({
28890
28955
  },
28891
28956
  {
28892
28957
  key: "repo-push-queue",
28958
+ removeWhen: "Two clean weeks on the queue by git_push error_rate; remove the isolate-local proxy with this flag.",
28959
+ reviewBy: "2026-12-15",
28893
28960
  defaultEnabled: true,
28894
28961
  description: "Per-repo Durable Object write queue for plain-repo git pushes (git-receive-pack): pushes land in the kody-push-queue Worker (RepoPushQueueV1) and reach Artifacts one at a time in FIFO order, with a 90s per-push budget and a clean 503 + Retry-After instead of a raw busy error. Evaluated per repo: repo allowlist (adminFeatureFlagRepoOverride), then the repo owner override, then the global switch with percentage rollout bucketed by repo, then the audience gate on the repo owner. On for everyone; off repos keep the isolate-local wait-and-retry proxy, which is removed (with this flag) after two clean weeks on the queue. Every push records an observe-only git_push usage event (path, outcome, Durable Object wall time, wait, queue depth, attempts) and an exposure for the repo owner; read queue cost with adminRepoPushQueueCost.",
28895
28962
  exposureRecording: "repo-push-owners",
@@ -28902,6 +28969,8 @@ var init_registry = __esm({
28902
28969
  },
28903
28970
  {
28904
28971
  key: "execution-contexts",
28972
+ removeWhen: "Execution contexts ship to everyone; delete the flag and gate sites.",
28973
+ reviewBy: "2027-02-01",
28905
28974
  defaultEnabled: false,
28906
28975
  defaultAudience: "experiments_opt_in",
28907
28976
  description: "Execution contexts: run execute on a machine the user registered (their laptop or a build server) instead of Kody cloud, with package-style sharing and a per-user chain. Off by default; enable with audience experiments_opt_in. Delete the flag and gate sites when the feature ships.",
@@ -28914,12 +28983,16 @@ var init_registry = __esm({
28914
28983
  },
28915
28984
  {
28916
28985
  key: "publish-offload",
28986
+ removeWhen: "Publish offload ships to everyone; delete the flag and gate sites.",
28987
+ reviewBy: "2027-02-01",
28917
28988
  defaultEnabled: false,
28918
28989
  defaultAudience: "experiments_opt_in",
28919
28990
  description: "Publish offload: build a package on the CLI machine or an execution context the publisher runs, upload the bundles, and let the server verify them before it serves the commit. Off by default. Publishing on an execution context (by chain, a named context, or a package's kody.publish.execution.context binding) also needs execution-contexts; `--build local` needs only this flag. Product choices live in #worker/publish-offload/policy.ts."
28920
28991
  },
28921
28992
  {
28922
28993
  key: "credential-need-enforcement",
28994
+ removeWhen: "Enforcement is on for everyone with no new credential_need_undeclared regressions; delete the flag and gate sites.",
28995
+ reviewBy: "2027-01-15",
28923
28996
  defaultEnabled: false,
28924
28997
  description: "Global switch (audience and rollout are ignored) for packages that have no credential stamp. When on, a package run by anyone but its author (a team-org package, a Use collaborator, an unadopted community fork, or any internet-visible package) may fill {{secret:\u2026}}, {{integration-token:\u2026}}, and vault placeholders and call credential(key) only for credentials its kody.credentials closure declares; anything else fails with credential_need_undeclared. Packages that stored a credential stamp are limited to those slots whether or not this flag is on (issue #3836). Do not flip this flag to enforce stamped packages: it would also change unstamped packages. Self-publish auto-approval also waits for this flag."
28925
28998
  // Intentionally no successMetric: a security boundary, not a product
@@ -28927,6 +29000,8 @@ var init_registry = __esm({
28927
29000
  },
28928
29001
  {
28929
29002
  key: "credential-allowed-packages-safety-window",
29003
+ removeWhen: "The issue #4129 30-day safety window has closed; delete the flag and gate sites.",
29004
+ reviewBy: "2026-12-01",
28930
29005
  defaultEnabled: true,
28931
29006
  description: "Global switch (audience and rollout are ignored) for the issue #4129 30-day safety window before allowed-packages enforcement cutover. While on and inside the window, nothing is refused for a self-authored or adopted package that a user credential's non-empty allowed-packages list leaves out. The use is allowed with a log line (credential_allowed_packages_safety_window_allow) and keeps its would-block marker; the allowed-packages list is never written, so an owner's removal sticks. The owner is never notified. From cutover the rule is strict whether or not this flag is on. Delete the flag and gate sites once the window has closed."
28932
29007
  // Intentionally no successMetric: a credential authority boundary, not
@@ -29251,12 +29326,13 @@ var packageCredentialSuppliersFlagTtlMs, enabledByOrg;
29251
29326
  var init_credential_suppliers_flag = __esm({
29252
29327
  "../worker/src/credentials/credential-suppliers-flag.ts"() {
29253
29328
  "use strict";
29329
+ init_isolate_state();
29254
29330
  init_execution_scope();
29255
29331
  init_service();
29256
29332
  init_registry();
29257
29333
  init_published_package_cache();
29258
29334
  packageCredentialSuppliersFlagTtlMs = 15e3;
29259
- enabledByOrg = createEnabledByOrgCache();
29335
+ enabledByOrg = isolateState(createEnabledByOrgCache);
29260
29336
  }
29261
29337
  });
29262
29338
 
@@ -29406,7 +29482,9 @@ function profileDenialMessage(access, permission, resource) {
29406
29482
  if (blocked.code === "profile_inactive") {
29407
29483
  return layer.self ? `Profile "${layer.name}" is ${layer.reason ?? "revoked"}, so it cannot use ${permission}${target}.` : `Parent profile "${layer.name}" is ${layer.reason ?? "revoked"}, so the profiles below it cannot use ${permission}${target}.`;
29408
29484
  }
29409
- const grantHint = resource?.type === "credential" ? 'The person it acts for can share the credential with it under Credentials (or accessGrant with resource_type "credential" and subject_type "profile").' : 'The person it acts for can grant it (accessGrant with subject_type "profile").';
29485
+ const resourceType = resource?.type ?? "org";
29486
+ const onPage = ["org", "package", "credential"].includes(resourceType) ? "under Agent profiles (/account/profiles) or " : "";
29487
+ const grantHint = `The person it acts for can grant it ${onPage}with accessGrant (resource_type "${resourceType}", subject_type "profile", subject_id the profile id).`;
29410
29488
  const message = layer.self ? `Profile "${layer.name}" was not granted ${permission}${target}. ${grantHint}` : `Parent profile "${layer.name}" does not hold ${permission}${target}, so the profiles below it cannot use it.`;
29411
29489
  return access.credentialScopes && !access.credentialScopes.has(permission) ? `${message} This token is also not scoped for ${permission}; after the grant, mint one whose scopes include it.` : message;
29412
29490
  }
@@ -30296,12 +30374,27 @@ function __kodyCreateRuntimeRecordExport(exportName) {
30296
30374
 
30297
30375
  // A package's own modules read its own id even when an export runs inside
30298
30376
  // another run (ad hoc execute, another package): the run's context when the
30299
- // run belongs to this package, else just \`{ packageId }\`.
30377
+ // run belongs to this package, else \`{ packageId }\` plus the package's own
30378
+ // \`hostedUrl\` / \`appBasePath\` from the run's host-set \`packageApps\`.
30300
30379
  export function __kodyCreatePackageBoundPackageContext(packageId) {
30301
30380
  const own = Object.freeze({ packageId });
30381
+ let ownAppSource = null;
30382
+ let ownApp = own;
30302
30383
  return __kodyCreateRecordProxy('packageContext', () => {
30303
- const run = __kodyGetRuntimeStore()?.packageContext ?? null;
30304
- return run != null && run.packageId === packageId ? run : own;
30384
+ const store = __kodyGetRuntimeStore();
30385
+ const run = store?.packageContext ?? null;
30386
+ if (run != null && run.packageId === packageId) return run;
30387
+ const app = store?.packageApps?.[packageId] ?? null;
30388
+ if (app == null) return own;
30389
+ if (app !== ownAppSource) {
30390
+ ownAppSource = app;
30391
+ ownApp = Object.freeze({
30392
+ packageId,
30393
+ hostedUrl: app.hostedUrl,
30394
+ appBasePath: app.appBasePath,
30395
+ });
30396
+ }
30397
+ return ownApp;
30305
30398
  });
30306
30399
  }
30307
30400
 
@@ -30354,6 +30447,32 @@ export function __kodyCreatePackageBoundStorage(packageId) {
30354
30447
  };
30355
30448
  }
30356
30449
 
30450
+ // Factory for the per-package virtual runtime modules: events.dispatch from a
30451
+ // package's modules emits as that package wherever the module runs (its own
30452
+ // run, ad hoc execute, another package's run). With a trusted binding in
30453
+ // scope the host-bound dispatcher stamps the package; without one only the
30454
+ // run's own package may use the run's events helper.
30455
+ export function __kodyCreatePackageBoundEvents(packageId) {
30456
+ return {
30457
+ dispatch: async (input) => {
30458
+ const binding = __kodyPackageBindingFor(packageId);
30459
+ if (binding != null && typeof binding.packageEventDispatch === 'function') {
30460
+ return await __kodyReflectApply(binding.packageEventDispatch, binding, [
30461
+ input ?? {},
30462
+ ]);
30463
+ }
30464
+ __kodyAssertUnboundIsRunPackage(packageId, 'events.dispatch');
30465
+ const runEvents = __kodyGetRuntimeStore()?.events;
30466
+ if (runEvents == null || typeof runEvents.dispatch !== 'function') {
30467
+ throw new __kodyErrorCtor(
30468
+ 'events.dispatch is not available in this execution context.',
30469
+ );
30470
+ }
30471
+ return await runEvents.dispatch(input ?? {});
30472
+ },
30473
+ };
30474
+ }
30475
+
30357
30476
  function __kodyResolvePackageSecrets(packageId) {
30358
30477
  const currentRuntime = __kodyGetRuntimeStore();
30359
30478
  const factory = currentRuntime?.__kodyPackageSecrets;
@@ -32514,10 +32633,11 @@ var init_repo_session_storage_bucket_cursor = __esm({
32514
32633
  });
32515
32634
 
32516
32635
  // ../worker/src/storage-buckets/service.ts
32517
- var registerUpsertStatement, estimateUpdateStatement;
32636
+ var registerUpsertStatement, estimateUpdateStatement, registeredBucketKeys, estimateRefreshAttemptsAtMs, pendingRegistrations;
32518
32637
  var init_service2 = __esm({
32519
32638
  "../worker/src/storage-buckets/service.ts"() {
32520
32639
  "use strict";
32640
+ init_isolate_state();
32521
32641
  init_repo_session_due_owners();
32522
32642
  init_repo_session_index_client();
32523
32643
  init_repo_session_storage_bucket_cursor();
@@ -32535,6 +32655,11 @@ UPDATE user_storage_buckets
32535
32655
  SET estimated_bytes = ?3, estimated_bytes_updated_at = ?4
32536
32656
  WHERE user_id = ?1 AND storage_id = ?2
32537
32657
  `.trim();
32658
+ registeredBucketKeys = isolateCollection(/* @__PURE__ */ new Set());
32659
+ estimateRefreshAttemptsAtMs = isolateCollection(/* @__PURE__ */ new Map());
32660
+ pendingRegistrations = isolateCollection(/* @__PURE__ */ new Set(), {
32661
+ pending: (tasks) => tasks
32662
+ });
32538
32663
  }
32539
32664
  });
32540
32665
 
@@ -34240,23 +34365,23 @@ var require_createActor_25900f76_cjs = __commonJS({
34240
34365
  if (actor.sessionId) {
34241
34366
  registeredActors.delete(actor.sessionId);
34242
34367
  }
34243
- const registryKey = reverseKeyedActors.get(actor);
34244
- if (registryKey !== void 0 && keyedActors.get(registryKey) === actor) {
34245
- keyedActors.delete(registryKey);
34368
+ const registryKey2 = reverseKeyedActors.get(actor);
34369
+ if (registryKey2 !== void 0 && keyedActors.get(registryKey2) === actor) {
34370
+ keyedActors.delete(registryKey2);
34246
34371
  }
34247
34372
  reverseKeyedActors.delete(actor);
34248
34373
  markSystemSnapshotDirty(system);
34249
34374
  },
34250
- _set: (registryKey, actor) => {
34251
- const existing = keyedActors.get(registryKey);
34375
+ _set: (registryKey2, actor) => {
34376
+ const existing = keyedActors.get(registryKey2);
34252
34377
  if (existing && existing !== actor) {
34253
- throw new Error(xstateError(45, String(registryKey)));
34378
+ throw new Error(xstateError(45, String(registryKey2)));
34254
34379
  }
34255
- keyedActors.set(registryKey, actor);
34256
- reverseKeyedActors.set(actor, registryKey);
34380
+ keyedActors.set(registryKey2, actor);
34381
+ reverseKeyedActors.set(actor, registryKey2);
34257
34382
  markSystemSnapshotDirty(system);
34258
34383
  },
34259
- get: (registryKey) => keyedActors.get(registryKey),
34384
+ get: (registryKey2) => keyedActors.get(registryKey2),
34260
34385
  getAll: () => Object.fromEntries(keyedActors),
34261
34386
  onEmitted: (listener) => baseSystem.onEmitted(listener),
34262
34387
  _notifyEmitted: (actorRef, event) => baseSystem._notifyEmitted(actorRef, event),
@@ -34269,11 +34394,11 @@ var require_createActor_25900f76_cjs = __commonJS({
34269
34394
  _sendInspectionEvent: forwardInspection ? (event) => baseSystem._sendInspectionEvent(event) : () => {
34270
34395
  }
34271
34396
  });
34272
- for (const [registryKey, actor] of keyedActors) {
34397
+ for (const [registryKey2, actor] of keyedActors) {
34273
34398
  if (!actor) {
34274
34399
  continue;
34275
34400
  }
34276
- reverseKeyedActors.set(actor, registryKey);
34401
+ reverseKeyedActors.set(actor, registryKey2);
34277
34402
  }
34278
34403
  for (const actor of Object.values(children)) {
34279
34404
  if (!actor) {
@@ -34282,10 +34407,10 @@ var require_createActor_25900f76_cjs = __commonJS({
34282
34407
  if (actor.sessionId) {
34283
34408
  registeredActors.set(actor.sessionId, actor);
34284
34409
  }
34285
- const registryKey = actor.registryKey;
34286
- if (registryKey) {
34287
- keyedActors.set(registryKey, actor);
34288
- reverseKeyedActors.set(actor, registryKey);
34410
+ const registryKey2 = actor.registryKey;
34411
+ if (registryKey2) {
34412
+ keyedActors.set(registryKey2, actor);
34413
+ reverseKeyedActors.set(actor, registryKey2);
34289
34414
  }
34290
34415
  }
34291
34416
  return system;
@@ -34358,12 +34483,12 @@ var require_createActor_25900f76_cjs = __commonJS({
34358
34483
  if (child.sessionId) {
34359
34484
  (children ??= /* @__PURE__ */ new Map()).set(child.sessionId, child);
34360
34485
  }
34361
- const registryKey = child.registryKey;
34362
- if (registryKey) {
34486
+ const registryKey2 = child.registryKey;
34487
+ if (registryKey2) {
34363
34488
  if (keyedActors === emptyKeyedActors) {
34364
34489
  keyedActors = /* @__PURE__ */ new Map();
34365
34490
  }
34366
- keyedActors.set(registryKey, child);
34491
+ keyedActors.set(registryKey2, child);
34367
34492
  }
34368
34493
  }
34369
34494
  snapshotActorRefs.set(snapshot, {
@@ -37175,10 +37300,10 @@ var require_createActor_25900f76_cjs = __commonJS({
37175
37300
  } else {
37176
37301
  changed = actor.sessionId !== void 0 && (this._children?.delete(actor.sessionId) ?? false);
37177
37302
  }
37178
- const registryKey = this._reverseKeyedActors?.get(actor);
37179
- if (registryKey !== void 0) {
37180
- if (this._keyedActors?.get(registryKey) === actor) {
37181
- this._keyedActors.delete(registryKey);
37303
+ const registryKey2 = this._reverseKeyedActors?.get(actor);
37304
+ if (registryKey2 !== void 0) {
37305
+ if (this._keyedActors?.get(registryKey2) === actor) {
37306
+ this._keyedActors.delete(registryKey2);
37182
37307
  changed = true;
37183
37308
  }
37184
37309
  this._reverseKeyedActors?.delete(actor);
@@ -37187,19 +37312,19 @@ var require_createActor_25900f76_cjs = __commonJS({
37187
37312
  markSystemSnapshotDirty(this);
37188
37313
  }
37189
37314
  }
37190
- get(registryKey) {
37191
- return this._keyedActors?.get(registryKey);
37315
+ get(registryKey2) {
37316
+ return this._keyedActors?.get(registryKey2);
37192
37317
  }
37193
37318
  getAll() {
37194
37319
  return Object.fromEntries(this._keyedActors?.entries() ?? []);
37195
37320
  }
37196
- _set(registryKey, actor) {
37197
- const existing = this._keyedActors?.get(registryKey);
37321
+ _set(registryKey2, actor) {
37322
+ const existing = this._keyedActors?.get(registryKey2);
37198
37323
  if (existing && existing !== actor) {
37199
- throw new Error(xstateError(45, String(registryKey)));
37324
+ throw new Error(xstateError(45, String(registryKey2)));
37200
37325
  }
37201
- (this._keyedActors ??= /* @__PURE__ */ new Map()).set(registryKey, actor);
37202
- (this._reverseKeyedActors ??= /* @__PURE__ */ new WeakMap()).set(actor, registryKey);
37326
+ (this._keyedActors ??= /* @__PURE__ */ new Map()).set(registryKey2, actor);
37327
+ (this._reverseKeyedActors ??= /* @__PURE__ */ new WeakMap()).set(actor, registryKey2);
37203
37328
  if (existing !== actor) {
37204
37329
  markSystemSnapshotDirty(this);
37205
37330
  }
@@ -37554,7 +37679,7 @@ var require_createActor_25900f76_cjs = __commonJS({
37554
37679
  parent,
37555
37680
  syncSnapshot,
37556
37681
  id,
37557
- registryKey,
37682
+ registryKey: registryKey2,
37558
37683
  inspect
37559
37684
  } = resolvedOptions;
37560
37685
  this.system = parent ? parent.system : resolvedOptions._systemRef?.current ?? createRuntimeSystem(this, {
@@ -37585,9 +37710,9 @@ var require_createActor_25900f76_cjs = __commonJS({
37585
37710
  this.src = resolvedOptions.src ?? logic;
37586
37711
  this.ref = this;
37587
37712
  this._actorScope = this;
37588
- if (registryKey) {
37589
- this.registryKey = registryKey;
37590
- this.system._set(registryKey, this);
37713
+ if (registryKey2) {
37714
+ this.registryKey = registryKey2;
37715
+ this.system._set(registryKey2, this);
37591
37716
  }
37592
37717
  this._collectedMicrosteps = void 0;
37593
37718
  const restore = resolvedOptions._restore;
@@ -37611,7 +37736,7 @@ var require_createActor_25900f76_cjs = __commonJS({
37611
37736
  this._deferred.length = 0;
37612
37737
  }
37613
37738
  }
37614
- if (registryKey && this._snapshot.status !== "active") {
37739
+ if (registryKey2 && this._snapshot.status !== "active") {
37615
37740
  this.system._unregister(this);
37616
37741
  }
37617
37742
  if (this.system._hasInspectionObservers?.() ?? true) {
@@ -39162,7 +39287,7 @@ var require_machineSchemas_88d01821_cjs = __commonJS({
39162
39287
  this.invoke = createActor2.toArray(this.config.invoke).map((invokeConfig, i4) => {
39163
39288
  const {
39164
39289
  src,
39165
- registryKey
39290
+ registryKey: registryKey2
39166
39291
  } = invokeConfig;
39167
39292
  const invokeId = createActor2.createInvokeId(this.id, i4);
39168
39293
  const resolvedId = invokeConfig.id ?? invokeId;
@@ -39173,7 +39298,7 @@ var require_machineSchemas_88d01821_cjs = __commonJS({
39173
39298
  src: typeof src === "string" ? src : void 0,
39174
39299
  logic: src,
39175
39300
  id: resolvedId,
39176
- registryKey
39301
+ registryKey: registryKey2
39177
39302
  };
39178
39303
  });
39179
39304
  }
@@ -42713,11 +42838,11 @@ var require_xstate_cjs = __commonJS({
42713
42838
  this.enqueue(void 0, ref, event);
42714
42839
  this.settle();
42715
42840
  }
42716
- initialize(input3, id, registryKey) {
42841
+ initialize(input3, id, registryKey2) {
42717
42842
  const root = this.allocate(this.logic.get("root"), {
42718
42843
  id,
42719
42844
  input: input3,
42720
- registryKey
42845
+ registryKey: registryKey2
42721
42846
  });
42722
42847
  this.snapshot.root = root.address;
42723
42848
  this.start(this.reference(root));
@@ -43861,14 +43986,6 @@ async function requestArtifactsEnvelope(client, input3) {
43861
43986
  query: input3.query,
43862
43987
  body: input3.body
43863
43988
  });
43864
- if (response.cfRay) {
43865
- console.info("artifacts-rest", {
43866
- method: input3.method,
43867
- path: redactArtifactsRestPath(input3.path),
43868
- status: response.status,
43869
- cfRay: response.cfRay
43870
- });
43871
- }
43872
43989
  const envelope = response.body;
43873
43990
  if (!envelope?.success) {
43874
43991
  const primaryError = envelope?.errors?.[0];
@@ -43881,6 +43998,12 @@ async function requestArtifactsEnvelope(client, input3) {
43881
43998
  messages: []
43882
43999
  };
43883
44000
  }
44001
+ console.warn("artifacts-rest", {
44002
+ method: input3.method,
44003
+ path: redactArtifactsRestPath(input3.path),
44004
+ status: response.status,
44005
+ cfRay: response.cfRay
44006
+ });
43884
44007
  throw new Error(
43885
44008
  message,
43886
44009
  primaryError ? { cause: primaryError } : void 0
@@ -197365,10 +197488,31 @@ var init_allowed_hosts2 = __esm({
197365
197488
  });
197366
197489
 
197367
197490
  // ../worker/src/credentials/credential-request.ts
197491
+ function isCredentialPlacementHeader(name) {
197492
+ const lower = name.toLowerCase();
197493
+ return /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/.test(name) && !reservedPlacementHeaders.has(lower) && !lower.startsWith("x-kody-");
197494
+ }
197495
+ var reservedPlacementHeaders;
197368
197496
  var init_credential_request = __esm({
197369
197497
  "../worker/src/credentials/credential-request.ts"() {
197370
197498
  "use strict";
197371
197499
  init_allowed_hosts2();
197500
+ reservedPlacementHeaders = /* @__PURE__ */ new Set([
197501
+ "connection",
197502
+ "content-encoding",
197503
+ "content-length",
197504
+ "content-type",
197505
+ "host",
197506
+ "keep-alive",
197507
+ "proxy-authorization",
197508
+ "te",
197509
+ "trailer",
197510
+ "transfer-encoding",
197511
+ "upgrade",
197512
+ "user-agent",
197513
+ "x-http-method-override",
197514
+ "x-method-override"
197515
+ ]);
197372
197516
  }
197373
197517
  });
197374
197518
 
@@ -198811,7 +198955,7 @@ function renderStaticCss(selector, styles) {
198811
198955
  const own2 = declarations.length ? `${selector}{${declarations.join(";")}}` : "";
198812
198956
  return own2 + nested.join("");
198813
198957
  }
198814
- var hoverMq, buttonSizes, pageHeadCss, markdownTableCss, proseCss, stackedPageCss, layoutMaxWidths, pageGutter, siteHeaderNavPaddingBlock, siteHeaderBrandMinHeight, siteHeaderHairline, siteHeaderHeight, accountRailContentTop, accountRailGapBelowHeader, workspaceTextureCss, packageDetailPageCss, pageHeaderCss, pageEyebrowCss, pageTitleCss, pageDescriptionCss, cardCss, insetCardCss, cardTitleCss, sectionTitleCss, descriptionCss, nativeDisclosureCss, fieldLabelCss, fieldLabelRowCss, fieldDescriptionCss, fieldErrorCss, choiceControlCss, inlineSpinnerCss, focusRingCss, visuallyHiddenCss, visuallyHiddenUntilFocusedCss, listCss, detailGridCss, detailItemCss, detailLabelCss, detailValueCss;
198958
+ var hoverMq, buttonSizes, pageHeadCss, markdownTableCss, proseCss, stackedPageCss, layoutMaxWidths, pageGutter, siteHeaderNavPaddingBlock, siteHeaderBrandMinHeight, siteHeaderHairline, siteHeaderHeight, accountRailContentTop, accountRailGapBelowHeader, workspaceTextureCss, packageDetailPageCss, pageHeaderCss, pageEyebrowCss, pageTitleCss, pageDescriptionCss, cardCss, insetCardCss, cardTitleCss, sectionTitleCss, descriptionCss, nativeDisclosureCss, fieldLabelCss, fieldLabelRowCss, fieldDescriptionCss, fieldErrorCss, choiceControlCss, inlineSpinnerCss, focusRingCss, visuallyHiddenCss, visuallyHiddenUntilFocusedCss, listCss, detailGridCss, detailItemCss, detailLabelCss, detailValueCss, underlineLinkTabsCss, underlineLinkTabCss;
198815
198959
  var init_style_primitives = __esm({
198816
198960
  "../worker/universal/styles/style-primitives.ts"() {
198817
198961
  "use strict";
@@ -199356,6 +199500,47 @@ var init_style_primitives = __esm({
199356
199500
  overflowWrap: "anywhere",
199357
199501
  whiteSpace: "normal"
199358
199502
  };
199503
+ underlineLinkTabsCss = {
199504
+ position: "relative",
199505
+ display: "flex",
199506
+ alignItems: "stretch",
199507
+ gap: spacing.md,
199508
+ // Inset shadow, not a border: the scroll box would clip a tab underline
199509
+ // pulled down over a border, but paints it over its own shadow.
199510
+ boxShadow: `inset 0 -1px 0 ${colors.border}`,
199511
+ overflowX: "auto",
199512
+ overscrollBehaviorX: "contain",
199513
+ // A visible thin bar, so a mouse without a sideways wheel can reach
199514
+ // overflowed tabs.
199515
+ scrollbarWidth: "thin"
199516
+ };
199517
+ underlineLinkTabCss = {
199518
+ display: "inline-flex",
199519
+ alignItems: "center",
199520
+ flexShrink: 0,
199521
+ minHeight: "44px",
199522
+ boxSizing: "border-box",
199523
+ padding: "0 0.15rem",
199524
+ borderBottom: "2px solid transparent",
199525
+ color: colors.textMuted,
199526
+ fontSize: "0.95rem",
199527
+ fontWeight: 550,
199528
+ whiteSpace: "nowrap",
199529
+ textDecoration: "none",
199530
+ transition: `color ${transitions.fast}, border-color ${transitions.fast}`,
199531
+ "&:hover": {
199532
+ color: colors.text
199533
+ },
199534
+ "&:focus-visible": {
199535
+ outline: `2px solid ${colors.primary}`,
199536
+ outlineOffset: "-2px",
199537
+ borderRadius: radius.sm
199538
+ },
199539
+ '&[aria-current="page"]': {
199540
+ color: colors.text,
199541
+ borderBottomColor: colors.primary
199542
+ }
199543
+ };
199359
199544
  }
199360
199545
  });
199361
199546
 
@@ -199877,15 +200062,20 @@ var init_password_change_lockout = __esm({
199877
200062
  });
199878
200063
 
199879
200064
  // ../worker/src/app/auth-session.ts
199880
- var defaultSessionMaxAgeSeconds, rememberedSessionMaxAgeSeconds, rememberedSessionRenewAfterMs;
200065
+ var defaultSessionMaxAgeSeconds, rememberedSessionMaxAgeSeconds, rememberedSessionRenewAfterMs, session;
199881
200066
  var init_auth_session = __esm({
199882
200067
  "../worker/src/app/auth-session.ts"() {
199883
200068
  "use strict";
200069
+ init_isolate_state();
199884
200070
  init_password_change_lockout();
199885
200071
  init_owner_person_ids();
199886
200072
  defaultSessionMaxAgeSeconds = 60 * 60 * 24 * 7;
199887
200073
  rememberedSessionMaxAgeSeconds = 60 * 60 * 24 * 30;
199888
200074
  rememberedSessionRenewAfterMs = 1e3 * 60 * 60 * 24 * 14;
200075
+ session = isolateState(() => ({
200076
+ cookie: null,
200077
+ secret: null
200078
+ }));
199889
200079
  }
199890
200080
  });
199891
200081
 
@@ -201823,10 +202013,16 @@ var init_limit_overrides = __esm({
201823
202013
  });
201824
202014
 
201825
202015
  // ../worker/src/entitlements/d1-storage-reconciliation.ts
202016
+ var inFlightOwnerReconciles;
201826
202017
  var init_d1_storage_reconciliation = __esm({
201827
202018
  "../worker/src/entitlements/d1-storage-reconciliation.ts"() {
201828
202019
  "use strict";
202020
+ init_isolate_state();
201829
202021
  init_service5();
202022
+ inFlightOwnerReconciles = isolateCollection(
202023
+ /* @__PURE__ */ new Map(),
202024
+ { pending: (tasks) => tasks.values() }
202025
+ );
201830
202026
  }
201831
202027
  });
201832
202028
 
@@ -202139,6 +202335,7 @@ var init_credential_needs = __esm({
202139
202335
  /**
202140
202336
  * Deprecated legacy alias for `supplier: 'publisher'`, set only by the
202141
202337
  * package that declares the need.
202338
+ * Remove when: no published package declares `ownerCredentialForVisitors`.
202142
202339
  */
202143
202340
  ownerCredentialForVisitors: external_exports.literal(true).optional(),
202144
202341
  supplier: external_exports.enum(["publisher", "executor"]).optional(),
@@ -205846,12 +206043,14 @@ var init_stored_credential = __esm({
205846
206043
  });
205847
206044
 
205848
206045
  // ../worker/src/credentials/login-resolver.ts
205849
- var maxSessionSeconds, maxExchangeResponseBytes, maxErrorBodyBytes, loginExchangeSchema, sessionInjectSchema;
206046
+ var maxSessionSeconds, maxExchangeResponseBytes, maxErrorBodyBytes, loginExchangeSchema, sessionInjectSchema, sessions, pendingSessions;
205850
206047
  var init_login_resolver = __esm({
205851
206048
  "../worker/src/credentials/login-resolver.ts"() {
205852
206049
  "use strict";
206050
+ init_isolate_state();
205853
206051
  init_zod();
205854
206052
  init_read_bounded_body();
206053
+ init_ssrf();
205855
206054
  init_crypto();
205856
206055
  init_service6();
205857
206056
  init_org_audit();
@@ -205880,7 +206079,16 @@ var init_login_resolver = __esm({
205880
206079
  refreshToken: external_exports.object({
205881
206080
  path: external_exports.string().min(1),
205882
206081
  field: external_exports.string().regex(/^[A-Za-z0-9_.-]+$/)
205883
- }).strict().optional()
206082
+ }).strict().optional(),
206083
+ singleRequest: external_exports.strictObject({
206084
+ logoutUrl: external_exports.url({ protocol: /^https$/ }),
206085
+ headers: external_exports.array(
206086
+ external_exports.strictObject({
206087
+ name: external_exports.string().max(100).refine(isCredentialPlacementHeader),
206088
+ field: external_exports.string().regex(/^[A-Za-z0-9_.-]+$/)
206089
+ })
206090
+ ).max(8).default([])
206091
+ }).optional()
205884
206092
  }).strict().refine(
205885
206093
  (exchange) => !exchange.refreshToken || Object.values(exchange.body).some(
205886
206094
  (template) => template.includes(`{${exchange.refreshToken.field}}`)
@@ -205889,7 +206097,24 @@ var init_login_resolver = __esm({
205889
206097
  message: "refreshToken.field must be a login field the exchange body sends.",
205890
206098
  path: ["refreshToken", "field"]
205891
206099
  }
205892
- );
206100
+ ).superRefine((exchange, ctx) => {
206101
+ const profile = exchange.singleRequest;
206102
+ if (!profile) return;
206103
+ const loginUrl = URL.parse(exchange.url);
206104
+ const logoutUrl = URL.parse(profile.logoutUrl);
206105
+ const names = profile.headers.map(({ name }) => name.toLowerCase());
206106
+ if (exchange.refreshToken || !loginUrl || loginUrl.protocol !== "https:" || loginUrl.hash || !isPublicFetchHostname(loginUrl.hostname) || !logoutUrl || logoutUrl.origin !== loginUrl.origin || logoutUrl.username || logoutUrl.password || logoutUrl.hash || new Set(names).size !== names.length || profile.headers.some(
206107
+ ({ field }) => !Object.values(exchange.body).some(
206108
+ (value) => value.includes(`{${field}}`)
206109
+ )
206110
+ )) {
206111
+ ctx.addIssue({
206112
+ code: "custom",
206113
+ path: ["singleRequest"],
206114
+ message: "Single-request Login requires a same-origin logout URL, distinct headers from existing login fields, and no refresh token rotation."
206115
+ });
206116
+ }
206117
+ });
205893
206118
  sessionInjectSchema = external_exports.discriminatedUnion("kind", [
205894
206119
  external_exports.object({
205895
206120
  kind: external_exports.literal("header"),
@@ -205898,6 +206123,10 @@ var init_login_resolver = __esm({
205898
206123
  }),
205899
206124
  external_exports.object({ kind: external_exports.literal("query"), param: external_exports.string().min(1) })
205900
206125
  ]);
206126
+ sessions = isolateCollection(/* @__PURE__ */ new Map());
206127
+ pendingSessions = isolateCollection(
206128
+ /* @__PURE__ */ new Map()
206129
+ );
205901
206130
  }
205902
206131
  });
205903
206132
 
@@ -206426,8 +206655,8 @@ declare module "kody:runtime" {
206426
206655
  export const packageContext: {
206427
206656
  packageId: string;
206428
206657
  kodyId: string;
206429
- appBasePath?: string;
206430
- hostedUrl?: string;
206658
+ appBasePath?: string | null;
206659
+ hostedUrl?: string | null;
206431
206660
  cookiePrefix?: string;
206432
206661
  assetBasePath?: string;
206433
206662
  clientModuleUrl?: string | null;