@opengeni/core 0.28.0 → 1.0.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 (224) hide show
  1. package/README.md +1 -1
  2. package/dist/access/external-actor-authority.d.ts +47 -0
  3. package/dist/access/index.d.ts +182 -3
  4. package/dist/access/service-initiator.d.ts +3 -0
  5. package/dist/application/api-integration-servers.d.ts +20 -0
  6. package/dist/application/archived-session-imports.d.ts +6 -0
  7. package/dist/application/composer-submit.d.ts +24 -0
  8. package/dist/application/connect-authority.d.ts +13 -0
  9. package/dist/application/connect-operation.d.ts +31 -0
  10. package/dist/application/external-continuation.d.ts +15 -0
  11. package/dist/application/external-identity-lifecycle.d.ts +20 -0
  12. package/dist/application/external-link-work-admission.d.ts +12 -0
  13. package/dist/application/external-workspace-members.d.ts +34 -0
  14. package/dist/application/modal-native-worker-host-transport.d.ts +297 -0
  15. package/dist/application/new-session-drafts.d.ts +39 -2
  16. package/dist/application/sandbox-recovery.d.ts +58 -0
  17. package/dist/application/session-commands.d.ts +26 -13
  18. package/dist/application/session-mcp-credential-rotation.d.ts +29 -0
  19. package/dist/application/session-tenancy.d.ts +19 -0
  20. package/dist/application/user-resource-grants.d.ts +20 -0
  21. package/dist/billing/limits.d.ts +11 -0
  22. package/dist/canonical-human-identities.d.ts +7 -2
  23. package/dist/canonical-human-identities.js +17 -4
  24. package/dist/canonical-human-identities.js.map +1 -1
  25. package/dist/{chunk-6WKPWE5S.js → chunk-2MKMRGSY.js} +108 -24
  26. package/dist/chunk-2MKMRGSY.js.map +1 -0
  27. package/dist/{chunk-NYPMQ7NO.js → chunk-GVO3N37G.js} +205 -37
  28. package/dist/chunk-GVO3N37G.js.map +1 -0
  29. package/dist/{chunk-JJU6I5XD.js → chunk-LCQXNR62.js} +36 -10
  30. package/dist/chunk-LCQXNR62.js.map +1 -0
  31. package/dist/chunk-MM6N7CTO.js +387 -0
  32. package/dist/chunk-MM6N7CTO.js.map +1 -0
  33. package/dist/chunk-QO5GVFFO.js +235 -0
  34. package/dist/chunk-QO5GVFFO.js.map +1 -0
  35. package/dist/codex-model-availability.d.ts +14 -0
  36. package/dist/default-session-model.d.ts +139 -0
  37. package/dist/dependencies.d.ts +87 -4
  38. package/dist/developer-setup-credential-ceiling.d.ts +10 -0
  39. package/dist/domain/agent-config-resolution.d.ts +49 -0
  40. package/dist/domain/automations.d.ts +58 -0
  41. package/dist/domain/capabilities.d.ts +22 -4
  42. package/dist/domain/company-profile-agent-admin.d.ts +25 -0
  43. package/dist/domain/connection-account-selection-error.d.ts +8 -0
  44. package/dist/domain/connector-tool-permissions.d.ts +36 -0
  45. package/dist/domain/direct-model-provider.d.ts +3 -0
  46. package/dist/domain/editable-artifacts/agent-application.d.ts +10 -1
  47. package/dist/domain/editable-artifacts/durable-export.d.ts +22 -1
  48. package/dist/domain/editable-artifacts/ports.d.ts +10 -0
  49. package/dist/domain/editable-artifacts/service.d.ts +4 -3
  50. package/dist/domain/environments.d.ts +5 -9
  51. package/dist/domain/external-creation-attribution.d.ts +6 -0
  52. package/dist/domain/file-owner.d.ts +8 -0
  53. package/dist/domain/github-action-policies.d.ts +36 -0
  54. package/dist/domain/github-repository-bindings.d.ts +117 -0
  55. package/dist/domain/github-skill-source.d.ts +5 -0
  56. package/dist/domain/governed-learning-slack-publication.d.ts +45 -0
  57. package/dist/domain/insights-timing.d.ts +16 -0
  58. package/dist/domain/insights-usage.d.ts +27 -0
  59. package/dist/domain/insights.d.ts +28 -1
  60. package/dist/domain/knowledge-files.d.ts +20 -0
  61. package/dist/domain/knowledge-messages.d.ts +39 -0
  62. package/dist/domain/knowledge-messages.test.d.ts +1 -0
  63. package/dist/domain/knowledge-preparation.d.ts +10 -0
  64. package/dist/domain/knowledge-preparation.test.d.ts +1 -0
  65. package/dist/domain/knowledge-search.d.ts +15 -0
  66. package/dist/domain/knowledge-search.test.d.ts +1 -0
  67. package/dist/domain/knowledge.d.ts +9 -0
  68. package/dist/domain/mcp-account-bindings.d.ts +19 -0
  69. package/dist/domain/mcp-account-routes.d.ts +21 -0
  70. package/dist/domain/native-mcp-connection-admission.d.ts +3 -0
  71. package/dist/domain/organization-integration-catalog.d.ts +15 -0
  72. package/dist/domain/organization-membership-lifecycle.d.ts +1 -0
  73. package/dist/domain/personal-connection-delegations.d.ts +87 -4
  74. package/dist/domain/pr-review.d.ts +249 -0
  75. package/dist/domain/resources.d.ts +24 -3
  76. package/dist/domain/scheduled-task-access.d.ts +247 -0
  77. package/dist/domain/scheduled-tasks.d.ts +103 -6
  78. package/dist/domain/session-connection-accounts.d.ts +16 -0
  79. package/dist/domain/session-file-access.d.ts +4 -0
  80. package/dist/domain/session-native-connection-replacement.d.ts +14 -0
  81. package/dist/domain/session-start-timing.d.ts +7 -0
  82. package/dist/domain/session-tool-policy.d.ts +93 -4
  83. package/dist/domain/sessions.d.ts +275 -28
  84. package/dist/domain/skill-imports.d.ts +1 -0
  85. package/dist/domain/skill-search.d.ts +30 -0
  86. package/dist/domain/skills.d.ts +117 -0
  87. package/dist/domain/slack-bot.d.ts +46 -1
  88. package/dist/domain/workspace-members.d.ts +8 -1
  89. package/dist/editable-artifact-live/application.d.ts +12 -3
  90. package/dist/editable-artifact-live/ports.d.ts +0 -1
  91. package/dist/editable-artifact-live/server.d.ts +5 -2
  92. package/dist/editable-artifact-live/ticket.d.ts +2 -2
  93. package/dist/editable-artifact-live/types.d.ts +14 -2
  94. package/dist/editable-artifact-live.js +2 -2
  95. package/dist/editable-artifacts.js +10 -4
  96. package/dist/index.d.ts +49 -3
  97. package/dist/index.js +18826 -6847
  98. package/dist/index.js.map +1 -1
  99. package/dist/managed-auth-session-sets.d.ts +131 -0
  100. package/dist/managed-auth-session-sets.js +51 -0
  101. package/dist/managed-auth-session-sets.js.map +1 -0
  102. package/dist/managed-session.d.ts +98 -11
  103. package/dist/model-catalog.d.ts +117 -0
  104. package/dist/product-usage-metrics.d.ts +30 -0
  105. package/dist/rigs/index.d.ts +22 -5
  106. package/dist/rigs/provider-images.d.ts +1 -1
  107. package/dist/sandbox/fleet.d.ts +59 -10
  108. package/dist/sandbox/routing.d.ts +22 -2
  109. package/dist/sandbox/runtime-settings.d.ts +56 -0
  110. package/dist/session-authorization.d.ts +38 -1
  111. package/dist/site-session-origin.d.ts +9 -0
  112. package/dist/transcription.d.ts +12 -1
  113. package/dist/turn-surface.d.ts +18 -0
  114. package/dist/user-presence.d.ts +32 -0
  115. package/package.json +18 -11
  116. package/src/access/external-actor-authority.ts +94 -0
  117. package/src/access/index.ts +1386 -44
  118. package/src/access/service-initiator.ts +50 -0
  119. package/src/application/api-integration-servers.ts +215 -0
  120. package/src/application/archived-session-imports.ts +161 -0
  121. package/src/application/composer-submit.ts +77 -0
  122. package/src/application/connect-authority.ts +77 -0
  123. package/src/application/connect-operation.ts +80 -0
  124. package/src/application/external-continuation.ts +129 -0
  125. package/src/application/external-identity-lifecycle.ts +48 -0
  126. package/src/application/external-link-work-admission.ts +90 -0
  127. package/src/application/external-workspace-members.ts +232 -0
  128. package/src/application/modal-native-worker-host-transport.ts +263 -0
  129. package/src/application/new-session-drafts.ts +222 -29
  130. package/src/application/sandbox-recovery.ts +78 -0
  131. package/src/application/session-commands.ts +430 -73
  132. package/src/application/session-mcp-credential-rotation.ts +217 -0
  133. package/src/application/session-tenancy.ts +445 -0
  134. package/src/application/user-resource-grants.ts +154 -0
  135. package/src/billing/limits.ts +103 -24
  136. package/src/canonical-human-identities.ts +22 -3
  137. package/src/codex-model-availability.ts +136 -0
  138. package/src/default-session-model.ts +656 -0
  139. package/src/dependencies.ts +97 -5
  140. package/src/developer-setup-credential-ceiling.ts +60 -0
  141. package/src/domain/agent-config-resolution.ts +148 -0
  142. package/src/domain/automations.ts +270 -0
  143. package/src/domain/capabilities.ts +244 -151
  144. package/src/domain/company-profile-agent-admin.ts +56 -0
  145. package/src/domain/connection-account-selection-error.ts +19 -0
  146. package/src/domain/connector-tool-permissions.ts +371 -0
  147. package/src/domain/direct-model-provider.ts +62 -0
  148. package/src/domain/editable-artifacts/agent-application.ts +61 -15
  149. package/src/domain/editable-artifacts/durable-export.ts +100 -5
  150. package/src/domain/editable-artifacts/in-memory.ts +6 -0
  151. package/src/domain/editable-artifacts/ports.ts +11 -0
  152. package/src/domain/editable-artifacts/service.ts +32 -1
  153. package/src/domain/editable-artifacts/snapshot-compaction.ts +9 -5
  154. package/src/domain/editable-artifacts/snapshot-verifier-genesis.ts +10 -8
  155. package/src/domain/editable-artifacts/snapshot-verifier.ts +10 -3
  156. package/src/domain/environments.ts +25 -45
  157. package/src/domain/external-creation-attribution.ts +22 -0
  158. package/src/domain/file-owner.ts +67 -0
  159. package/src/domain/github-action-policies.ts +169 -0
  160. package/src/domain/github-repository-bindings.ts +295 -0
  161. package/src/domain/github-skill-source.ts +233 -0
  162. package/src/domain/governed-learning-slack-publication.ts +157 -0
  163. package/src/domain/insights-timing.ts +95 -0
  164. package/src/domain/insights-usage.ts +67 -0
  165. package/src/domain/insights.ts +270 -169
  166. package/src/domain/knowledge-files.ts +46 -0
  167. package/src/domain/knowledge-messages.test.ts +91 -0
  168. package/src/domain/knowledge-messages.ts +106 -0
  169. package/src/domain/knowledge-preparation.test.ts +276 -0
  170. package/src/domain/knowledge-preparation.ts +147 -0
  171. package/src/domain/knowledge-search.test.ts +561 -0
  172. package/src/domain/knowledge-search.ts +256 -0
  173. package/src/domain/knowledge.ts +133 -0
  174. package/src/domain/mcp-account-bindings.ts +171 -0
  175. package/src/domain/mcp-account-routes.ts +121 -0
  176. package/src/domain/native-mcp-connection-admission.ts +14 -0
  177. package/src/domain/organization-integration-catalog.ts +88 -0
  178. package/src/domain/organization-membership-lifecycle.ts +10 -0
  179. package/src/domain/personal-connection-delegations.ts +758 -115
  180. package/src/domain/pr-review.ts +687 -0
  181. package/src/domain/resources.ts +182 -25
  182. package/src/domain/scheduled-task-access.ts +1052 -0
  183. package/src/domain/scheduled-tasks.ts +1952 -215
  184. package/src/domain/session-connection-accounts.ts +67 -0
  185. package/src/domain/session-file-access.ts +47 -0
  186. package/src/domain/session-native-connection-replacement.ts +64 -0
  187. package/src/domain/session-start-timing.ts +55 -0
  188. package/src/domain/session-tool-policy.ts +443 -19
  189. package/src/domain/sessions.ts +3417 -619
  190. package/src/domain/skill-imports.ts +137 -17
  191. package/src/domain/skill-search.ts +221 -0
  192. package/src/domain/skills.ts +104 -0
  193. package/src/domain/slack-bot.ts +128 -3
  194. package/src/domain/workspace-members.ts +34 -2
  195. package/src/editable-artifact-live/application.ts +29 -4
  196. package/src/editable-artifact-live/ports.ts +0 -1
  197. package/src/editable-artifact-live/server.ts +167 -13
  198. package/src/editable-artifact-live/ticket.ts +87 -6
  199. package/src/editable-artifact-live/types.ts +16 -2
  200. package/src/editable-artifact-live/wire.ts +0 -10
  201. package/src/index.ts +69 -4
  202. package/src/managed-auth-session-sets.ts +371 -0
  203. package/src/managed-session.ts +520 -2
  204. package/src/model-catalog.ts +873 -0
  205. package/src/product-usage-metrics.ts +101 -0
  206. package/src/rigs/index.ts +179 -63
  207. package/src/rigs/provider-images.ts +2 -3
  208. package/src/sandbox/fleet.ts +471 -59
  209. package/src/sandbox/routing.ts +160 -33
  210. package/src/sandbox/runtime-settings.ts +281 -0
  211. package/src/session-authorization.ts +262 -78
  212. package/src/site-session-origin.ts +22 -0
  213. package/src/transcription.ts +13 -1
  214. package/src/turn-surface.ts +45 -0
  215. package/src/user-presence.ts +134 -0
  216. package/dist/chunk-6WKPWE5S.js.map +0 -1
  217. package/dist/chunk-IBOEYG6N.js +0 -34
  218. package/dist/chunk-IBOEYG6N.js.map +0 -1
  219. package/dist/chunk-JJU6I5XD.js.map +0 -1
  220. package/dist/chunk-NYPMQ7NO.js.map +0 -1
  221. package/dist/domain/durable-learning-slack-publication.d.ts +0 -72
  222. package/dist/domain/packs.d.ts +0 -55
  223. package/src/domain/durable-learning-slack-publication.ts +0 -202
  224. package/src/domain/packs.ts +0 -556
@@ -1,23 +1,36 @@
1
1
  import {
2
- getManagedSession
3
- } from "./chunk-IBOEYG6N.js";
2
+ getManagedAuthRequestActorAdmissionStamp,
3
+ getManagedAuthRequestActorLeaseStamp,
4
+ getManagedSession,
5
+ markManagedAuthRequestActorTransitionApplied
6
+ } from "./chunk-MM6N7CTO.js";
7
+ import "./chunk-QO5GVFFO.js";
4
8
 
5
9
  // src/canonical-human-identities.ts
6
10
  import { HTTPException } from "hono/http-exception";
7
11
  async function requireCanonicalHumanRequestIdentity(context, input) {
8
12
  if (!input.managedAuth) {
9
- throw new HTTPException(404, { message: "Canonical human identity is unavailable" });
13
+ throw new HTTPException(404, {
14
+ message: "Canonical human identity is unavailable"
15
+ });
10
16
  }
11
17
  const session = await getManagedSession(context, input.managedAuth, {
12
18
  db: input.db,
19
+ sessionAdapter: input.managedAuthSessionAdapter,
20
+ sessionSetMode: input.managedAuthSessionSetMode,
13
21
  ...input.allowRecovery === void 0 ? {} : { allowIdentityRecovery: input.allowRecovery }
14
22
  });
15
23
  if (!session?.user || typeof session.session?.id !== "string") {
16
- throw new HTTPException(401, { message: "Managed human authentication required" });
24
+ throw new HTTPException(401, {
25
+ message: "Managed human authentication required"
26
+ });
17
27
  }
18
28
  return { authUserId: session.user.id, authSessionId: session.session.id };
19
29
  }
20
30
  export {
31
+ getManagedAuthRequestActorAdmissionStamp,
32
+ getManagedAuthRequestActorLeaseStamp,
33
+ markManagedAuthRequestActorTransitionApplied,
21
34
  requireCanonicalHumanRequestIdentity
22
35
  };
23
36
  //# sourceMappingURL=canonical-human-identities.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/canonical-human-identities.ts"],"sourcesContent":["import type { Database } from \"@opengeni/db\";\nimport type { Context } from \"hono\";\nimport { HTTPException } from \"hono/http-exception\";\nimport type { ManagedAuth } from \"./managed-auth-type\";\nimport { getManagedSession } from \"./managed-session\";\n\nexport type CanonicalHumanRequestIdentity = {\n authUserId: string;\n authSessionId: string;\n};\n\nexport async function requireCanonicalHumanRequestIdentity(\n context: Context,\n input: { db: Database; managedAuth?: ManagedAuth | null; allowRecovery?: boolean },\n): Promise<CanonicalHumanRequestIdentity> {\n if (!input.managedAuth) {\n throw new HTTPException(404, { message: \"Canonical human identity is unavailable\" });\n }\n const session = await getManagedSession(context, input.managedAuth, {\n db: input.db,\n ...(input.allowRecovery === undefined ? {} : { allowIdentityRecovery: input.allowRecovery }),\n });\n if (!session?.user || typeof session.session?.id !== \"string\") {\n throw new HTTPException(401, { message: \"Managed human authentication required\" });\n }\n return { authUserId: session.user.id, authSessionId: session.session.id };\n}\n"],"mappings":";;;;;AAEA,SAAS,qBAAqB;AAS9B,eAAsB,qCACpB,SACA,OACwC;AACxC,MAAI,CAAC,MAAM,aAAa;AACtB,UAAM,IAAI,cAAc,KAAK,EAAE,SAAS,0CAA0C,CAAC;AAAA,EACrF;AACA,QAAM,UAAU,MAAM,kBAAkB,SAAS,MAAM,aAAa;AAAA,IAClE,IAAI,MAAM;AAAA,IACV,GAAI,MAAM,kBAAkB,SAAY,CAAC,IAAI,EAAE,uBAAuB,MAAM,cAAc;AAAA,EAC5F,CAAC;AACD,MAAI,CAAC,SAAS,QAAQ,OAAO,QAAQ,SAAS,OAAO,UAAU;AAC7D,UAAM,IAAI,cAAc,KAAK,EAAE,SAAS,wCAAwC,CAAC;AAAA,EACnF;AACA,SAAO,EAAE,YAAY,QAAQ,KAAK,IAAI,eAAe,QAAQ,QAAQ,GAAG;AAC1E;","names":[]}
1
+ {"version":3,"sources":["../src/canonical-human-identities.ts"],"sourcesContent":["import type { Database } from \"@opengeni/db\";\nimport type { Context } from \"hono\";\nimport { HTTPException } from \"hono/http-exception\";\nimport type { ManagedAuth } from \"./managed-auth-type\";\nimport { getManagedSession } from \"./managed-session\";\nexport {\n getManagedAuthRequestActorAdmissionStamp,\n getManagedAuthRequestActorLeaseStamp,\n markManagedAuthRequestActorTransitionApplied,\n} from \"./managed-session\";\nimport type { ManagedAuthSessionAdapter } from \"./managed-auth-session-sets\";\nimport type { ManagedAuthSessionSetMode } from \"@opengeni/contracts/managed-auth-session-sets\";\n\nexport type CanonicalHumanRequestIdentity = {\n authUserId: string;\n authSessionId: string;\n};\n\nexport async function requireCanonicalHumanRequestIdentity(\n context: Context,\n input: {\n db: Database;\n managedAuth?: ManagedAuth | null | undefined;\n managedAuthSessionAdapter?: ManagedAuthSessionAdapter | null | undefined;\n managedAuthSessionSetMode?: ManagedAuthSessionSetMode | undefined;\n allowRecovery?: boolean | undefined;\n },\n): Promise<CanonicalHumanRequestIdentity> {\n if (!input.managedAuth) {\n throw new HTTPException(404, {\n message: \"Canonical human identity is unavailable\",\n });\n }\n const session = await getManagedSession(context, input.managedAuth, {\n db: input.db,\n sessionAdapter: input.managedAuthSessionAdapter,\n sessionSetMode: input.managedAuthSessionSetMode,\n ...(input.allowRecovery === undefined ? {} : { allowIdentityRecovery: input.allowRecovery }),\n });\n if (!session?.user || typeof session.session?.id !== \"string\") {\n throw new HTTPException(401, {\n message: \"Managed human authentication required\",\n });\n }\n return { authUserId: session.user.id, authSessionId: session.session.id };\n}\n"],"mappings":";;;;;;;;;AAEA,SAAS,qBAAqB;AAgB9B,eAAsB,qCACpB,SACA,OAOwC;AACxC,MAAI,CAAC,MAAM,aAAa;AACtB,UAAM,IAAI,cAAc,KAAK;AAAA,MAC3B,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACA,QAAM,UAAU,MAAM,kBAAkB,SAAS,MAAM,aAAa;AAAA,IAClE,IAAI,MAAM;AAAA,IACV,gBAAgB,MAAM;AAAA,IACtB,gBAAgB,MAAM;AAAA,IACtB,GAAI,MAAM,kBAAkB,SAAY,CAAC,IAAI,EAAE,uBAAuB,MAAM,cAAc;AAAA,EAC5F,CAAC;AACD,MAAI,CAAC,SAAS,QAAQ,OAAO,QAAQ,SAAS,OAAO,UAAU;AAC7D,UAAM,IAAI,cAAc,KAAK;AAAA,MAC3B,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACA,SAAO,EAAE,YAAY,QAAQ,KAAK,IAAI,eAAe,QAAQ,QAAQ,GAAG;AAC1E;","names":[]}
@@ -25,15 +25,39 @@ import {
25
25
  editableArtifactSnapshotId,
26
26
  editableArtifactStateHash,
27
27
  validateEditableArtifactActor
28
- } from "./chunk-JJU6I5XD.js";
28
+ } from "./chunk-LCQXNR62.js";
29
29
 
30
30
  // src/domain/editable-artifacts/durable-export.ts
31
31
  import { createHash } from "crypto";
32
32
  var EDITABLE_ARTIFACT_EXPORT_MAX_DOWNLOAD_BYTES = 512 * 1024 * 1024;
33
33
  var EDITABLE_ARTIFACT_EXPORT_MAX_OPTIONS_BYTES = 256 * 1024;
34
+ var EDITABLE_ARTIFACT_EXPORT_FORMATS = Object.freeze({
35
+ spreadsheet: Object.freeze(["xlsx"]),
36
+ document: Object.freeze([]),
37
+ presentation: Object.freeze([])
38
+ });
39
+ function describeEditableArtifactExportFormats() {
40
+ return describeConfiguredExportFormats(EDITABLE_ARTIFACT_EXPORT_FORMATS);
41
+ }
42
+ function describeConfiguredExportFormats(configuredFormats) {
43
+ const entries = Object.entries(configuredFormats);
44
+ const supported = entries.filter(([, formats]) => formats.length > 0).map(([modality, formats]) => `${modality} \u2192 ${formats.join(", ")}`);
45
+ const none = entries.filter(([, formats]) => formats.length === 0).map(([modality]) => modality);
46
+ return [
47
+ supported.length > 0 ? `Supported exports: ${supported.join("; ")}.` : "No exports are available.",
48
+ none.length > 0 ? `${none.join(" and ")} artifacts cannot be exported yet (no PDF, DOCX, PPTX, or image export); share the live artifact with its artifactReference link instead.` : ""
49
+ ].filter(Boolean).join(" ");
50
+ }
51
+ function unsupportedEditableArtifactExport(modality, format, formats = EDITABLE_ARTIFACT_EXPORT_FORMATS) {
52
+ const listed = formats[modality].includes(format);
53
+ return new EditableArtifactDurableExportError(
54
+ "unsupported_format",
55
+ listed ? `unsupported_format: this deployment does not serve a ${format} export of a ${modality} artifact with these options; retry with options omitted. ${describeConfiguredExportFormats(formats)}` : `unsupported_format: a ${modality} artifact cannot be exported as ${format}. ${describeConfiguredExportFormats(formats)}`
56
+ );
57
+ }
34
58
  var EditableArtifactDurableExportError = class extends Error {
35
- constructor(code) {
36
- super(code);
59
+ constructor(code, message) {
60
+ super(message ?? code);
37
61
  this.code = code;
38
62
  this.name = "EditableArtifactDurableExportError";
39
63
  }
@@ -47,6 +71,30 @@ var EditableArtifactDurableExportService = class {
47
71
  constructor(dependencies) {
48
72
  this.dependencies = dependencies;
49
73
  }
74
+ describeFormats() {
75
+ const formats = this.dependencies.profiles.supportedFormats;
76
+ return formats ? describeConfiguredExportFormats(formats) : "Export formats are determined by this deployment's configured exporter; unsupported format/options combinations are refused before pinning.";
77
+ }
78
+ /** Read-only exact preflight: no snapshot, ID allocation, or store write. */
79
+ async preflight(input) {
80
+ const format = materializationFormat(input.format);
81
+ const options = exactOptions(input.options ?? Object.freeze({}));
82
+ const profile = await this.dependencies.profiles.resolve({
83
+ modality: input.modality,
84
+ format,
85
+ options
86
+ });
87
+ if (!profile) {
88
+ const formats = this.dependencies.profiles.supportedFormats;
89
+ if (formats) throw unsupportedEditableArtifactExport(input.modality, format, formats);
90
+ throw new EditableArtifactDurableExportError(
91
+ "unsupported_format",
92
+ `unsupported_format: this deployment does not serve ${input.modality} \u2192 ${format} with these options. ${this.describeFormats()}`
93
+ );
94
+ }
95
+ validateProfile(profile, input.modality, format);
96
+ return profile;
97
+ }
50
98
  async pinVersion(input) {
51
99
  const context = normalizeContext(input);
52
100
  const idempotencyKey = portableIdempotencyKey(input.idempotencyKey);
@@ -88,13 +136,11 @@ var EditableArtifactDurableExportService = class {
88
136
  const format = materializationFormat(input.format);
89
137
  const options = exactOptions(input.options ?? Object.freeze({}));
90
138
  const version = await this.getVersion(context, versionId);
91
- const profile = await this.dependencies.profiles.resolve({
139
+ const profile = await this.preflight({
92
140
  modality: version.modality,
93
141
  format,
94
142
  options
95
143
  });
96
- if (!profile) throw new EditableArtifactDurableExportError("unsupported_format");
97
- validateProfile(profile, version.modality, format);
98
144
  const requestHash = hashPublicRequest("materialize", [
99
145
  idempotencyKey,
100
146
  versionId,
@@ -423,15 +469,13 @@ function validateEditableArtifactMaterializationJob(job) {
423
469
 
424
470
  // src/domain/editable-artifacts/agent-application.ts
425
471
  import { createHash as createHash2 } from "crypto";
426
- import {
427
- COMMITTED_TRANSACTION_PROTOCOL_VERSION,
428
- EDITABLE_ARTIFACT_MODEL_SCHEMA_VERSION
429
- } from "@opengeni/contracts/editable-artifact-versions";
430
472
  import {
431
473
  DOCUMENT_ARTIFACT_COMMAND_VERSION,
474
+ EDITABLE_ARTIFACT_INTENT_PROTOCOL_VERSION,
432
475
  EDITABLE_ARTIFACT_INTENT_VERSION,
433
476
  PRESENTATION_ARTIFACT_COMMAND_VERSION,
434
477
  SPREADSHEET_ARTIFACT_COMMAND_VERSION,
478
+ currentEditableArtifactCompatibility,
435
479
  decodeEditableArtifactMutationIntent,
436
480
  decodeDocumentArtifactQueryResponse,
437
481
  decodePresentationArtifactQueryResponse,
@@ -455,6 +499,9 @@ var EditableArtifactAgentApplication = class {
455
499
  constructor(dependencies) {
456
500
  this.dependencies = dependencies;
457
501
  }
502
+ describeExportFormats() {
503
+ return this.dependencies.exports.describeFormats();
504
+ }
458
505
  async list(input) {
459
506
  const context = agentContext(input);
460
507
  const limit = boundedLimit(input.limit ?? 64);
@@ -543,8 +590,18 @@ var EditableArtifactAgentApplication = class {
543
590
  const queryBytes = encodeQuery(input.request);
544
591
  const responseBytes = await this.dependencies.inspector.query({ state, queryBytes });
545
592
  const projection = decodeQueryResponse(input.request.modality, responseBytes);
593
+ const inspectionReceiptId = state.modality === "document" ? await this.dependencies.recordInspection?.({
594
+ ...context,
595
+ artifact: projectArtifact(state.artifact),
596
+ queryHash: createHash2("sha256").update(queryBytes).digest("hex"),
597
+ queryKind: input.request.query.kind
598
+ }) : void 0;
546
599
  await this.touch(context, artifactId);
547
- return Object.freeze({ artifact: projectArtifact(state.artifact), projection });
600
+ return Object.freeze({
601
+ artifact: projectArtifact(state.artifact),
602
+ projection,
603
+ ...inspectionReceiptId ? { inspectionReceiptId } : {}
604
+ });
548
605
  }
549
606
  async apply(input) {
550
607
  const context = agentContext(input);
@@ -586,8 +643,8 @@ var EditableArtifactAgentApplication = class {
586
643
  }
587
644
  const authored = hashEditableArtifactMutationIntent({
588
645
  envelopeVersion: EDITABLE_ARTIFACT_INTENT_VERSION,
589
- protocolVersion: COMMITTED_TRANSACTION_PROTOCOL_VERSION,
590
- modelSchemaVersion: EDITABLE_ARTIFACT_MODEL_SCHEMA_VERSION,
646
+ protocolVersion: EDITABLE_ARTIFACT_INTENT_PROTOCOL_VERSION,
647
+ modelSchemaVersion: currentEditableArtifactCompatibility(input.batch.modality).modelSchemaVersion,
591
648
  commandProtocolVersion: commandProtocolVersion(input.batch.modality),
592
649
  artifactId,
593
650
  clientTransactionId,
@@ -646,6 +703,11 @@ var EditableArtifactAgentApplication = class {
646
703
  actor: context.actor,
647
704
  artifactId
648
705
  });
706
+ await this.dependencies.exports.preflight({
707
+ modality: artifact.modality,
708
+ format: input.format,
709
+ ...input.options ? { options: input.options } : {}
710
+ });
649
711
  const version = await this.dependencies.exports.pinVersion({
650
712
  scope: context.scope,
651
713
  actor: context.actor,
@@ -738,12 +800,21 @@ function agentContext(input) {
738
800
  }
739
801
  function encodeCommands(batch) {
740
802
  if (batch.modality === "spreadsheet") {
741
- return encodeSpreadsheetArtifactCommandBatch({ version: 1, commands: batch.commands });
803
+ return encodeSpreadsheetArtifactCommandBatch({
804
+ version: SPREADSHEET_ARTIFACT_COMMAND_VERSION,
805
+ commands: batch.commands
806
+ });
742
807
  }
743
808
  if (batch.modality === "document") {
744
- return encodeDocumentArtifactCommandBatch({ version: 1, commands: batch.commands });
809
+ return encodeDocumentArtifactCommandBatch({
810
+ version: DOCUMENT_ARTIFACT_COMMAND_VERSION,
811
+ commands: batch.commands
812
+ });
745
813
  }
746
- return encodePresentationArtifactCommandBatch({ version: 1, commands: batch.commands });
814
+ return encodePresentationArtifactCommandBatch({
815
+ version: PRESENTATION_ARTIFACT_COMMAND_VERSION,
816
+ commands: batch.commands
817
+ });
747
818
  }
748
819
  function encodeQuery(request) {
749
820
  if (request.modality === "spreadsheet") {
@@ -765,6 +836,7 @@ function commandProtocolVersion(modality) {
765
836
  function projectArtifact(artifact) {
766
837
  return Object.freeze({
767
838
  id: artifact.id,
839
+ artifactReference: `[Open report](/workspaces/${artifact.scope.workspaceId}/artifacts/editable/${artifact.id})`,
768
840
  modality: artifact.modality,
769
841
  title: artifact.title,
770
842
  lifecycle: artifact.lifecycle,
@@ -1216,6 +1288,9 @@ var InMemoryEditableArtifactStore = class {
1216
1288
  });
1217
1289
  }
1218
1290
  async readTransactionBasis(scope, artifactId, request) {
1291
+ if (request.authorizeCommit) {
1292
+ throw new TypeError("Transactional artifact authority requires a PostgreSQL store");
1293
+ }
1219
1294
  const normalizedScope = editableArtifactScope(scope);
1220
1295
  const normalizedArtifactId = editableArtifactId(artifactId);
1221
1296
  const key = aggregateKey(normalizedScope, normalizedArtifactId);
@@ -1265,6 +1340,9 @@ var InMemoryEditableArtifactStore = class {
1265
1340
  });
1266
1341
  }
1267
1342
  async tryCommitAppliedTransaction(request) {
1343
+ if (request.authorizeCommit) {
1344
+ throw new TypeError("Transactional artifact authority requires a PostgreSQL store");
1345
+ }
1268
1346
  const scope = editableArtifactScope(request.scope);
1269
1347
  const artifactId = editableArtifactId(request.artifactId);
1270
1348
  const key = aggregateKey(scope, artifactId);
@@ -2072,6 +2150,8 @@ function editableArtifactLiveTicketStorePortFromPostgres(store) {
2072
2150
 
2073
2151
  // src/domain/editable-artifacts/snapshot-compaction.ts
2074
2152
  import { BoundedObjectWriteError } from "@opengeni/storage";
2153
+ import { EDITABLE_ARTIFACT_CODEC_REGISTRY } from "@opengeni/contracts/editable-artifacts";
2154
+ import { COMMITTED_TRANSACTION_PROTOCOL_VERSION } from "@opengeni/contracts/editable-artifact-committed-transaction";
2075
2155
  var SNAPSHOT_MIME_TYPE = "application/vnd.opengeni.editable-artifact-snapshot";
2076
2156
  var EditableArtifactCompactionPipeline = class {
2077
2157
  #dependencies;
@@ -2148,6 +2228,7 @@ function validateBasis(state, scope, artifactId) {
2148
2228
  }
2149
2229
  }
2150
2230
  function validateGenerated(value, state, scope, artifactId) {
2231
+ const currentCodec = EDITABLE_ARTIFACT_CODEC_REGISTRY[value.modality];
2151
2232
  if (value.scope.accountId !== scope.accountId || value.scope.workspaceId !== scope.workspaceId || value.artifactId !== artifactId || value.modality !== state.modality) {
2152
2233
  throw new EditableArtifactSnapshotVerificationError("identity_mismatch");
2153
2234
  }
@@ -2161,8 +2242,7 @@ function validateGenerated(value, state, scope, artifactId) {
2161
2242
  throw new EditableArtifactSnapshotVerificationError("limit_exceeded");
2162
2243
  }
2163
2244
  editableArtifactContentHash(value.canonicalContentHash);
2164
- const versions = value.modality === "spreadsheet" ? [value.modelSchemaVersion, value.operationProtocolVersion, value.crdtStateVersion] : [value.modelSchemaVersion];
2165
- if (versions.some((version) => !Number.isSafeInteger(version) || version <= 0)) {
2245
+ if (value.modelSchemaVersion !== currentCodec.modelSchemaVersion || value.modality === "spreadsheet" && (value.operationProtocolVersion !== COMMITTED_TRANSACTION_PROTOCOL_VERSION || value.crdtStateVersion !== currentCodec.snapshotVersion)) {
2166
2246
  throw new EditableArtifactSnapshotVerificationError("version_mismatch");
2167
2247
  }
2168
2248
  try {
@@ -2189,6 +2269,8 @@ function throwIfCancelled(signal) {
2189
2269
 
2190
2270
  // src/domain/editable-artifacts/snapshot-verifier-genesis.ts
2191
2271
  import { BoundedObjectWriteError as BoundedObjectWriteError2 } from "@opengeni/storage";
2272
+ import { EDITABLE_ARTIFACT_CODEC_REGISTRY as EDITABLE_ARTIFACT_CODEC_REGISTRY2 } from "@opengeni/contracts/editable-artifacts";
2273
+ import { COMMITTED_TRANSACTION_PROTOCOL_VERSION as COMMITTED_TRANSACTION_PROTOCOL_VERSION2 } from "@opengeni/contracts/editable-artifact-committed-transaction";
2192
2274
  var SNAPSHOT_MIME_TYPE2 = "application/vnd.opengeni.editable-artifact-snapshot";
2193
2275
  var EditableArtifactGenesisPipeline = class {
2194
2276
  #dependencies;
@@ -2265,6 +2347,7 @@ var EditableArtifactGenesisPipeline = class {
2265
2347
  }
2266
2348
  };
2267
2349
  function validateGeneratedGenesis(value, scope, artifactId, modality) {
2350
+ const currentCodec = EDITABLE_ARTIFACT_CODEC_REGISTRY2[value.modality];
2268
2351
  if (value.scope.accountId !== scope.accountId || value.scope.workspaceId !== scope.workspaceId || value.artifactId !== artifactId || value.modality !== modality) {
2269
2352
  throw new EditableArtifactSnapshotVerificationError("identity_mismatch");
2270
2353
  }
@@ -2276,11 +2359,8 @@ function validateGeneratedGenesis(value, scope, artifactId, modality) {
2276
2359
  }
2277
2360
  editableArtifactContentHash(value.canonicalContentHash);
2278
2361
  editableArtifactStateHash(value.stateHash);
2279
- const versions = value.modality === "spreadsheet" ? [value.modelSchemaVersion, value.operationProtocolVersion, value.crdtStateVersion] : [value.modelSchemaVersion];
2280
- for (const version of versions) {
2281
- if (!Number.isSafeInteger(version) || version <= 0) {
2282
- throw new EditableArtifactSnapshotVerificationError("version_mismatch");
2283
- }
2362
+ if (value.modelSchemaVersion !== currentCodec.modelSchemaVersion || value.modality === "spreadsheet" && (value.operationProtocolVersion !== COMMITTED_TRANSACTION_PROTOCOL_VERSION2 || value.crdtStateVersion !== currentCodec.snapshotVersion)) {
2363
+ throw new EditableArtifactSnapshotVerificationError("version_mismatch");
2284
2364
  }
2285
2365
  try {
2286
2366
  assertBoundedKernelVersion(value.kernelVersion);
@@ -2356,6 +2436,10 @@ function editableArtifactMaterializationKey(input) {
2356
2436
  export {
2357
2437
  EDITABLE_ARTIFACT_EXPORT_MAX_DOWNLOAD_BYTES,
2358
2438
  EDITABLE_ARTIFACT_EXPORT_MAX_OPTIONS_BYTES,
2439
+ EDITABLE_ARTIFACT_EXPORT_FORMATS,
2440
+ describeEditableArtifactExportFormats,
2441
+ describeConfiguredExportFormats,
2442
+ unsupportedEditableArtifactExport,
2359
2443
  EditableArtifactDurableExportError,
2360
2444
  EditableArtifactDurableExportService,
2361
2445
  editableArtifactMaterializationMimeType,
@@ -2377,4 +2461,4 @@ export {
2377
2461
  EditableArtifactGenesisPipeline,
2378
2462
  editableArtifactMaterializationKey
2379
2463
  };
2380
- //# sourceMappingURL=chunk-6WKPWE5S.js.map
2464
+ //# sourceMappingURL=chunk-2MKMRGSY.js.map