@opengeni/db 5.0.1 → 6.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 (212) hide show
  1. package/dist/automations.d.ts +0 -2
  2. package/dist/canonical-human-identities.d.ts +4 -0
  3. package/dist/canonical-human-identities.js +3 -3
  4. package/dist/capability-components.d.ts +5 -13
  5. package/dist/capability-integrations.d.ts +23 -8
  6. package/dist/capability-reconciliation.d.ts +5 -0
  7. package/dist/capability-reconciliation.js +21 -0
  8. package/dist/capability-reconciliation.js.map +1 -0
  9. package/dist/{chunk-6T2GGYWE.js → chunk-4UJCXBR2.js} +4 -5800
  10. package/dist/chunk-4UJCXBR2.js.map +1 -0
  11. package/dist/{chunk-MWMXWHJD.js → chunk-7JCDSMX2.js} +2 -2
  12. package/dist/chunk-AJA2ZIUW.js +219 -0
  13. package/dist/chunk-AJA2ZIUW.js.map +1 -0
  14. package/dist/chunk-CDAT6EKW.js +247 -0
  15. package/dist/chunk-CDAT6EKW.js.map +1 -0
  16. package/dist/{chunk-DPONPYJD.js → chunk-CJI6G254.js} +70 -18
  17. package/dist/chunk-CJI6G254.js.map +1 -0
  18. package/dist/chunk-G32NVMRJ.js +276 -0
  19. package/dist/chunk-G32NVMRJ.js.map +1 -0
  20. package/dist/chunk-GABXCG3N.js +5811 -0
  21. package/dist/chunk-GABXCG3N.js.map +1 -0
  22. package/dist/{chunk-ERKVSPDX.js → chunk-LVY33EWL.js} +3 -3
  23. package/dist/{chunk-45CP2YKY.js → chunk-MAMBI2HR.js} +9 -3
  24. package/dist/{chunk-45CP2YKY.js.map → chunk-MAMBI2HR.js.map} +1 -1
  25. package/dist/{chunk-F73UKJY6.js → chunk-MN5PZMEK.js} +91 -108
  26. package/dist/chunk-MN5PZMEK.js.map +1 -0
  27. package/dist/chunk-PJI4MUZ7.js +131 -0
  28. package/dist/chunk-PJI4MUZ7.js.map +1 -0
  29. package/dist/{chunk-T6BWIGWJ.js → chunk-RIYHP2WU.js} +2 -2
  30. package/dist/{chunk-7HMK3B45.js → chunk-RL2MUXM3.js} +16 -7
  31. package/dist/chunk-RL2MUXM3.js.map +1 -0
  32. package/dist/{chunk-HQDVI2DB.js → chunk-SYKHLPTK.js} +4 -3
  33. package/dist/{chunk-HQDVI2DB.js.map → chunk-SYKHLPTK.js.map} +1 -1
  34. package/dist/{chunk-T6YLHJLS.js → chunk-XIXVVBW2.js} +198 -51
  35. package/dist/chunk-XIXVVBW2.js.map +1 -0
  36. package/dist/chunk-ZPJ6V2VG.js +156 -0
  37. package/dist/chunk-ZPJ6V2VG.js.map +1 -0
  38. package/dist/codex-capacity-recovery.d.ts +12 -0
  39. package/dist/codex-failure-eligibility.d.ts +9 -0
  40. package/dist/company-profile-schema.d.ts +4 -2
  41. package/dist/connect-attempts.d.ts +15 -0
  42. package/dist/connect-attempts.js +25 -0
  43. package/dist/connect-attempts.js.map +1 -0
  44. package/dist/connection-authority.d.ts +7 -63
  45. package/dist/connection-refresh-lock.d.ts +4 -0
  46. package/dist/connection-token-resolver.d.ts +8 -43
  47. package/dist/database-timing.d.ts +10 -0
  48. package/dist/database.d.ts +4 -0
  49. package/dist/editable-artifact-durable-export.js +2 -2
  50. package/dist/editable-artifacts.d.ts +9 -0
  51. package/dist/editable-artifacts.js +7 -5
  52. package/dist/index.d.ts +447 -78
  53. package/dist/index.js +12705 -12872
  54. package/dist/index.js.map +1 -1
  55. package/dist/insights-usage-bundle.d.ts +3 -0
  56. package/dist/integration-bindings.d.ts +1 -1
  57. package/dist/integration-facets.d.ts +18 -1
  58. package/dist/knowledge-entries-schema.d.ts +2 -0
  59. package/dist/knowledge-entries.d.ts +1 -0
  60. package/dist/knowledge-indexing.d.ts +1 -0
  61. package/dist/live-session-attempt.d.ts +35 -137
  62. package/dist/managed-auth-session-sets.js +3 -3
  63. package/dist/mcp-account-bindings.d.ts +4 -0
  64. package/dist/mcp-oauth.d.ts +11 -0
  65. package/dist/mcp-operations.js +2 -2
  66. package/dist/migrate.js +1 -1
  67. package/dist/organization-integration-policy.d.ts +51 -0
  68. package/dist/organization-integration-policy.js +18 -0
  69. package/dist/organization-integration-policy.js.map +1 -0
  70. package/dist/organization-usage.d.ts +20 -0
  71. package/dist/plugin-packages.d.ts +9 -12
  72. package/dist/pr-review.d.ts +0 -11
  73. package/dist/preference-registry-schema.d.ts +17 -0
  74. package/dist/provision-roles.js +1 -1
  75. package/dist/retained-provider-commands.d.ts +124 -6
  76. package/dist/retained-provider-commands.js +29 -97
  77. package/dist/retained-provider-commands.js.map +1 -1
  78. package/dist/retired-session-create-metadata.d.ts +4 -0
  79. package/dist/runtime-posture.d.ts +7 -5
  80. package/dist/schema.d.ts +876 -656
  81. package/dist/schema.js +5 -7
  82. package/dist/session-admission-block.d.ts +32 -0
  83. package/dist/session-attempt-writers.d.ts +4 -0
  84. package/dist/session-background-commands.js +5 -4
  85. package/dist/session-command-output.js +8 -126
  86. package/dist/session-command-output.js.map +1 -1
  87. package/dist/session-control.d.ts +5 -1
  88. package/dist/session-event-slices.d.ts +10 -0
  89. package/dist/session-event-slices.js +8 -222
  90. package/dist/session-event-slices.js.map +1 -1
  91. package/dist/session-file-attachments.d.ts +28 -0
  92. package/dist/session-goal-reports.d.ts +43 -0
  93. package/dist/session-mcp-approval.d.ts +4 -0
  94. package/dist/session-mcp-credential-rotation.js +5 -4
  95. package/dist/session-mcp-credential-rotation.js.map +1 -1
  96. package/dist/session-message-search.d.ts +22 -0
  97. package/dist/session-queue-commands.d.ts +2 -6
  98. package/dist/session-retry.d.ts +36 -0
  99. package/dist/session-tenancy.js +3 -3
  100. package/dist/skill-source-release-impact.d.ts +18 -0
  101. package/dist/skill-source-release.d.ts +9 -0
  102. package/dist/skills.d.ts +7 -1
  103. package/dist/user-resource-authority.d.ts +0 -8
  104. package/dist/video-generation.js +3 -3
  105. package/dist/workspace-tool-defaults.js +5 -4
  106. package/dist/workspace-tool-defaults.js.map +1 -1
  107. package/drizzle/0468_knowledge_relationship_projection.sql +30 -0
  108. package/drizzle/0469_knowledge_source_discovery.sql +85 -0
  109. package/drizzle/0470_organization_integration_policy.sql +151 -0
  110. package/drizzle/0471_usage_events_account_recent_index.sql +4 -0
  111. package/drizzle/0472_usage_events_workspace_recent_index.sql +4 -0
  112. package/drizzle/0473_organization_usage_analytical_capability.sql +237 -0
  113. package/drizzle/0474_goal_report_requirements.sql +156 -0
  114. package/drizzle/0475_session_event_history_statistics.sql +15 -0
  115. package/drizzle/0476_session_event_history_policy_planning.sql +29 -0
  116. package/drizzle/0477_managed_sign_in_methods.sql +303 -0
  117. package/drizzle/0478_sender_owned_connections.sql +2772 -0
  118. package/drizzle/0479_connection_create_idempotency.sql +16 -0
  119. package/drizzle/0480_private_session_organization_key_administration.sql +154 -0
  120. package/drizzle/0481_personal_connection_visibility_cleanup.sql +45 -0
  121. package/drizzle/0482_remove_packs.sql +417 -0
  122. package/drizzle/0483_preclaim_admission_block.sql +85 -0
  123. package/drizzle/0484_insights_usage_projection.sql +211 -0
  124. package/drizzle/0485_inherited_mcp_approval_policies.sql +6 -0
  125. package/drizzle/0486_reasoning_configuration_message_forks.sql +35 -0
  126. package/drizzle/0487_skill_catalog_message_forks.sql +26 -0
  127. package/drizzle/0488_permanent_skill_removal.sql +207 -0
  128. package/drizzle/0489_modal_command_byte_offsets.sql +17 -0
  129. package/drizzle/0490_periodic_capture_attempt_cadence.sql +6 -0
  130. package/drizzle/0491_warm_capture_holder_reclamation.sql +57 -0
  131. package/drizzle/0492_codex_accepted_source_authority.sql +249 -0
  132. package/drizzle/0493_stopping_command_error_containment.sql +58 -0
  133. package/drizzle/0494_mcp_account_bindings.sql +334 -0
  134. package/drizzle/0495_consented_sandbox_recovery.sql +220 -0
  135. package/drizzle/0496_supervised_command_settlement.sql +386 -0
  136. package/drizzle/0497_modal_inventory_owner_read_capability.sql +112 -0
  137. package/drizzle/0498_enrollment_membership_fence.sql +87 -0
  138. package/drizzle/0499_session_attachment_access.sql +224 -0
  139. package/drizzle/0500_session_execution_epoch.sql +37 -0
  140. package/drizzle/0501_session_sharing_execution.sql +591 -0
  141. package/drizzle/0502_active_message_boundary_forks.sql +30 -0
  142. package/package.json +17 -5
  143. package/src/automations.ts +17 -73
  144. package/src/canonical-human-identities.ts +17 -5
  145. package/src/capability-components.ts +7 -24
  146. package/src/capability-integrations.ts +301 -21
  147. package/src/capability-reconciliation.ts +19 -0
  148. package/src/codex-capacity-recovery.ts +47 -0
  149. package/src/codex-failure-eligibility.ts +93 -0
  150. package/src/connect-attempts.ts +49 -18
  151. package/src/connection-authority.ts +12 -158
  152. package/src/connection-refresh-lock.ts +22 -0
  153. package/src/connection-token-resolver.ts +58 -530
  154. package/src/database-timing.ts +43 -0
  155. package/src/database.ts +61 -26
  156. package/src/editable-artifacts.ts +1 -1
  157. package/src/index.ts +3578 -1273
  158. package/src/insights-model-bundle.ts +19 -7
  159. package/src/insights-usage-bundle.ts +16 -19
  160. package/src/integration-bindings.ts +2 -7
  161. package/src/integration-facets.ts +73 -6
  162. package/src/knowledge-entries.ts +8 -1
  163. package/src/live-session-attempt.ts +0 -22
  164. package/src/mcp-account-bindings.ts +12 -0
  165. package/src/mcp-oauth.ts +26 -0
  166. package/src/organization-integration-policy.ts +235 -0
  167. package/src/organization-usage.ts +83 -0
  168. package/src/plugin-packages.ts +226 -42
  169. package/src/pr-review.ts +7 -69
  170. package/src/preference-registry-schema.ts +1 -0
  171. package/src/provision-roles.ts +50 -37
  172. package/src/retained-provider-commands.ts +286 -9
  173. package/src/retired-session-create-metadata.ts +16 -0
  174. package/src/runtime-posture.ts +217 -13
  175. package/src/schema.ts +104 -120
  176. package/src/session-admission-block.ts +29 -0
  177. package/src/session-attempt-writers.ts +48 -0
  178. package/src/session-control.ts +21 -5
  179. package/src/session-event-slices.ts +76 -26
  180. package/src/session-file-attachments.ts +66 -0
  181. package/src/session-goal-reports.ts +255 -0
  182. package/src/session-mcp-approval.ts +30 -0
  183. package/src/session-message-search.ts +348 -0
  184. package/src/session-queue-commands.ts +60 -36
  185. package/src/session-retry.ts +319 -0
  186. package/src/skill-config-migration.ts +11 -2
  187. package/src/skill-source-release-impact.ts +33 -0
  188. package/src/skill-source-release.ts +67 -26
  189. package/src/skills.ts +44 -6
  190. package/src/user-resource-authority.ts +0 -56
  191. package/dist/chunk-6T2GGYWE.js.map +0 -1
  192. package/dist/chunk-7HMK3B45.js.map +0 -1
  193. package/dist/chunk-DPONPYJD.js.map +0 -1
  194. package/dist/chunk-F73UKJY6.js.map +0 -1
  195. package/dist/chunk-T6YLHJLS.js.map +0 -1
  196. package/dist/host-mcp-binding-match.d.ts +0 -5
  197. package/dist/host-mcp-bindings.d.ts +0 -79
  198. package/dist/host-mcp-resolvers.d.ts +0 -47
  199. package/dist/host-mcp-task-authority.d.ts +0 -43
  200. package/dist/host-selection-identity.d.ts +0 -6
  201. package/dist/pack-components.d.ts +0 -83
  202. package/dist/pack-installations.d.ts +0 -86
  203. package/src/host-mcp-binding-match.ts +0 -34
  204. package/src/host-mcp-bindings.ts +0 -777
  205. package/src/host-mcp-resolvers.ts +0 -266
  206. package/src/host-mcp-task-authority.ts +0 -384
  207. package/src/host-selection-identity.ts +0 -29
  208. package/src/pack-components.ts +0 -980
  209. package/src/pack-installations.ts +0 -950
  210. /package/dist/{chunk-MWMXWHJD.js.map → chunk-7JCDSMX2.js.map} +0 -0
  211. /package/dist/{chunk-ERKVSPDX.js.map → chunk-LVY33EWL.js.map} +0 -0
  212. /package/dist/{chunk-T6BWIGWJ.js.map → chunk-RIYHP2WU.js.map} +0 -0
@@ -1,5 +0,0 @@
1
- import { type McpCredentialsRequest } from "@opengeni/contracts";
2
- /** Metadata comparison only. A caller must independently establish accepted
3
- * execution delegation and live owner/workspace authority. A matching registry
4
- * row never authorizes a turn, a scheduler, or a nested session by itself. */
5
- export declare function hostMcpBindingMatchesRequest(rawBinding: unknown, request: McpCredentialsRequest): boolean;
@@ -1,79 +0,0 @@
1
- import { type McpCredentialsRequest } from "@opengeni/contracts";
2
- import { HostMcpBinding, HostMcpDelegation, HostMcpAcceptedAuthority } from "@opengeni/contracts/host-mcp-bindings";
3
- import { type Database } from "./database.js";
4
- export type HostMcpBindingOwner = {
5
- accountId: string;
6
- workspaceId: string;
7
- subjectId: string;
8
- authorizationRevision: number;
9
- };
10
- /** Resolve the effective member's revision, not the authenticating external
11
- * identity revision. Caller must separately prove its authority to act as them. */
12
- export declare function resolveHostMcpBindingOwner(db: Database, input: Omit<HostMcpBindingOwner, "authorizationRevision">): Promise<HostMcpBindingOwner>;
13
- export declare class HostMcpBindingConflictError extends Error {
14
- constructor();
15
- }
16
- export declare class HostMcpDelegationAuthorityError extends Error {
17
- }
18
- /** Low-level persistence, not HTTP authentication. Callers must establish the
19
- * exact external owner and workspace grant before entering this scoped seam. */
20
- export declare function createHostMcpBinding(db: Database, owner: HostMcpBindingOwner, raw: unknown): Promise<HostMcpBinding>;
21
- export declare function getHostMcpBinding(db: Database, owner: HostMcpBindingOwner, id: string): Promise<HostMcpBinding | null>;
22
- export declare function revokeHostMcpBinding(db: Database, owner: HostMcpBindingOwner, id: string, expectedGeneration: number): Promise<HostMcpBinding>;
23
- /** Internal persistence only. Caller must first verify owner identity and grant
24
- * issuance permission. No worker consumes these rows without accepted-work capture. */
25
- export declare function issueHostMcpDelegation(db: Database, owner: HostMcpBindingOwner, raw: unknown): Promise<HostMcpDelegation>;
26
- export declare function getHostMcpDelegation(db: Database, owner: HostMcpBindingOwner, id: string): Promise<HostMcpDelegation | null>;
27
- export declare function revokeHostMcpDelegation(db: Database, owner: HostMcpBindingOwner, id: string, expectedGeneration: number): Promise<HostMcpDelegation>;
28
- /** Internal direct-admission boundary, NOT authentication and NOT persistence.
29
- * The caller must establish a verified external owner and explicit selection,
30
- * and capture the returned authority with accepted work INSIDE `capture`.
31
- * Locks remain held through that callback. Historical initiator metadata only
32
- * narrows the verified caller's selection; it never establishes who called.
33
- * Schedules, continuations and inherited turns need their own frozen causal
34
- * authority path and deliberately cannot use this direct-only boundary.
35
- */
36
- export declare function withDirectHostMcpAdmission<T>(db: Database, owner: HostMcpBindingOwner, input: {
37
- sessionId: string;
38
- turnId: string;
39
- delegationId: string;
40
- expectedDelegationGeneration: number;
41
- }, capture: (tx: Database, authority: HostMcpAcceptedAuthority) => Promise<T>): Promise<T>;
42
- /** Internal direct-turn persistence. The authenticated acceptance transaction
43
- * must call this before claim; this does not authenticate the supplied owner.
44
- * Exact replay is allowed, but a turn/server selection cannot be replaced. */
45
- export declare function captureDirectHostMcpAuthority(db: Database, owner: HostMcpBindingOwner, input: Parameters<typeof withDirectHostMcpAdmission>[2]): Promise<HostMcpAcceptedAuthority>;
46
- /** Copy only the authority of an exact causal turn after its canonical machine
47
- * update has been delivered. The insert trigger independently proves delivery,
48
- * live generations and byte-equivalent authority; no creator fallback exists.
49
- * Revoked selections are omitted, allowing a continuation to explain loss of
50
- * access without making its whole session permanently unclaimable. */
51
- export declare function inheritCausalHostMcpTurnAuthorities(db: Database, input: {
52
- accountId: string;
53
- workspaceId: string;
54
- sessionId: string;
55
- subjectId: string;
56
- sourceTurnId: string;
57
- targetTurnId: string;
58
- }): Promise<void>;
59
- /** Initial child turn only. The stored parent-turn pointer was admitted by the
60
- * native signed-attempt creation boundary; caller metadata never chooses it. */
61
- export declare function inheritChildHostMcpTurnAuthorities(db: Database, input: {
62
- accountId: string;
63
- workspaceId: string;
64
- sessionId: string;
65
- turnId: string;
66
- subjectId: string;
67
- }): Promise<void>;
68
- /** Live consumption of captured direct or same-session causal turn authority.
69
- * Request context must come from the accepted attempt, never caller JSON.
70
- * Missing/revoked authority denies; infrastructure failures propagate so the
71
- * broker reports refresh_failed rather than misclassifying an outage.
72
- * The historical function name is retained for existing internal consumers. */
73
- export declare function authorizeDirectHostMcpUse(db: Database, request: McpCredentialsRequest,
74
- /** Internal metadata observer; called only after every live authorization fence succeeds. */
75
- onAuthorized?: (snapshot: HostMcpAcceptedAuthority) => void): Promise<boolean>;
76
- /** Resolve a configuration selector from the exact live accepted turn, never
77
- * registry inventory or session creator metadata. The broker still revalidates
78
- * the resulting concrete reference around resolution and every physical use. */
79
- export declare function resolveAcceptedHostMcpBinding(db: Database, request: McpCredentialsRequest): Promise<McpCredentialsRequest["connectionRef"] | null>;
@@ -1,47 +0,0 @@
1
- import { HostMcpResolver, PutHostMcpResolverRequest, RevokeHostMcpResolverRequest } from "@opengeni/contracts/host-mcp-resolvers";
2
- import { type Database } from "./database.js";
3
- export declare class HostMcpResolverError extends Error {
4
- readonly status: 403 | 404 | 409;
5
- constructor(status: 403 | 404 | 409, message: string);
6
- }
7
- type Actor = {
8
- accountId: string;
9
- subjectId: string;
10
- };
11
- export declare function getHostMcpResolver(db: Database, actor: Actor, source: string): Promise<HostMcpResolver>;
12
- export declare function mutateHostMcpResolver(db: Database, actor: Actor, input: {
13
- externalSource: string;
14
- encryptionKey: Uint8Array;
15
- legacyConfigured: boolean;
16
- } & ({
17
- kind: "put";
18
- request: PutHostMcpResolverRequest;
19
- } | {
20
- kind: "revoke";
21
- request: RevokeHostMcpResolverRequest;
22
- })): Promise<HostMcpResolver>;
23
- export type HostMcpResolverRoute = {
24
- mode: "legacy";
25
- } | {
26
- mode: "denied";
27
- } | {
28
- mode: "namespace";
29
- id: string;
30
- generation: number;
31
- accountId: string;
32
- workspaceId: string;
33
- externalSource: string;
34
- url: string;
35
- bearerToken: string;
36
- timeoutMs: number;
37
- };
38
- /** Runtime lookup, not tool authority. Failure must never be interpreted as legacy. */
39
- export declare function resolveHostMcpResolverRoute(db: Database, input: {
40
- accountId: string;
41
- workspaceId: string;
42
- }, encryptionKey: Uint8Array | null): Promise<HostMcpResolverRoute>;
43
- export declare function hostMcpResolverRouteIsCurrent(db: Database, input: {
44
- accountId: string;
45
- workspaceId: string;
46
- }, route: HostMcpResolverRoute): Promise<boolean>;
47
- export {};
@@ -1,43 +0,0 @@
1
- import { type ScheduledTask } from "@opengeni/contracts";
2
- import { HostMcpTaskAuthority, HostMcpBindingDefinition, type HostMcpBindingSelection } from "@opengeni/contracts/host-mcp-bindings";
3
- import { type Database } from "./database.js";
4
- import { type HostMcpBindingOwner } from "./host-mcp-bindings.js";
5
- export type SelectedHostMcpTaskGrant = {
6
- delegationId: string;
7
- generation: number;
8
- bindingId: string;
9
- bindingGeneration: number;
10
- definition: HostMcpBindingDefinition;
11
- };
12
- /** Internal capture only. The API/core authenticates the external owner and
13
- * rechecks that proof in this same task-write transaction before calling. */
14
- export declare function captureHostMcpTaskAuthorities(db: Database, owner: HostMcpBindingOwner, task: ScheduledTask, selections: SelectedHostMcpTaskGrant[]): Promise<void>;
15
- /** Backend-only read; native immutable task-revision proof chooses the owner.
16
- * No caller-supplied subject and no ambient workspace account enumeration. */
17
- export declare function getHostMcpTaskAuthorities(db: Database, input: {
18
- accountId: string;
19
- workspaceId: string;
20
- taskId: string;
21
- taskAuthorityRevision: number;
22
- }): Promise<HostMcpTaskAuthority[]>;
23
- /** Native task revisions are the authority/version boundary, including ordinary
24
- * lifecycle edits. Never silently drop or reassign retained host selections. */
25
- export declare function cloneHostMcpTaskAuthorities(db: Database, task: ScheduledTask, sourceRevision: number): Promise<void>;
26
- /** Claim-time attachment to the exact accepted run. No host callback or key is
27
- * used here; credentials are requested only when the accepted attempt uses MCP. */
28
- export declare function captureScheduledHostMcpTurnAuthorities(db: Database, input: {
29
- accountId: string;
30
- workspaceId: string;
31
- sessionId: string;
32
- turnId: string;
33
- runId: string;
34
- }): Promise<void>;
35
- /** Agent-created task: derive selections exclusively from its live accepted
36
- * attempt, then re-admit only native successor-eligible grants. No user lookup
37
- * or connection inventory is a fallback for a turn with no captured authority. */
38
- export declare function inheritHostMcpTaskAuthoritiesFromAttempt(db: Database, task: ScheduledTask, source: {
39
- sessionId: string;
40
- turnId: string;
41
- attemptId: string;
42
- executionGeneration: number;
43
- }, configured: HostMcpBindingSelection[]): Promise<void>;
@@ -1,6 +0,0 @@
1
- import { type HostMcpCreateSelection } from "@opengeni/contracts/host-mcp-bindings";
2
- export type { HostMcpCreateSelection } from "@opengeni/contracts/host-mcp-bindings";
3
- /** Replay identity only: neither grant admission nor credential authority. */
4
- export declare function normalizeHostCreateSelection(value: unknown): HostMcpCreateSelection[];
5
- export declare function metadataWithHostCreateSelection(metadata: Record<string, unknown>, value: unknown): Record<string, unknown>;
6
- export declare function hostCreateSelectionFromMetadata(metadata: Record<string, unknown>): HostMcpCreateSelection[];
@@ -1,83 +0,0 @@
1
- import { type CapabilityPackComponentReference, type PackComponentResolution, type SkillActor } from "@opengeni/contracts";
2
- import { type Database } from "./database.js";
3
- import type { SkillSourceReleaseReceipt } from "./skill-source-release.js";
4
- type PackComponentKind = PackComponentResolution["kind"];
5
- export type PackInlineSkillRequirement = {
6
- key: string;
7
- capabilityId: string;
8
- name: string;
9
- activationMode: "workspace_managed" | "session_selected";
10
- contentSha256: string;
11
- };
12
- export type StoredPackInstallationComponent = {
13
- id: string;
14
- packInstallationId: string;
15
- key: string;
16
- kind: PackComponentKind;
17
- capabilityId: string;
18
- resolvedId: string;
19
- digest: string;
20
- metadata: Record<string, unknown>;
21
- };
22
- export declare class PackComponentResolutionError extends Error {
23
- readonly componentKey: string;
24
- readonly status: "missing" | "mismatch";
25
- readonly name = "PackComponentResolutionError";
26
- constructor(componentKey: string, status: "missing" | "mismatch");
27
- }
28
- export declare function resolvePackComponentReferences(db: Database, workspaceId: string, references: readonly CapabilityPackComponentReference[]): Promise<PackComponentResolution[]>;
29
- /**
30
- * Resolve inline Pack Skills against effective owners by case-insensitive
31
- * runtime name. Exact content is shareable; different content under the same
32
- * active name is a conflict. The current Pack owner may be excluded so an
33
- * update can replace its own previous inline Skill safely.
34
- */
35
- export declare function resolvePackInlineSkillReferences(db: Database, workspaceId: string, requirements: readonly PackInlineSkillRequirement[], excludePackInstallationId?: string): Promise<PackComponentResolution[]>;
36
- export declare function adoptPackComponentReferences(db: Database, input: {
37
- accountId: string;
38
- workspaceId: string;
39
- packInstallationId: string;
40
- references: readonly CapabilityPackComponentReference[];
41
- }): Promise<{
42
- components: StoredPackInstallationComponent[];
43
- retainedFacetInstallationIds: string[];
44
- retainedBindingIds: string[];
45
- }>;
46
- export declare function listPackInstallationComponents(db: Database, workspaceId: string, packInstallationId: string): Promise<StoredPackInstallationComponent[]>;
47
- export declare function recordPackInlineSkillComponent(db: Database, input: {
48
- accountId: string;
49
- workspaceId: string;
50
- packInstallationId: string;
51
- componentKey: string;
52
- capabilityId: string;
53
- facetInstallationId: string;
54
- contentSha256: string;
55
- name: string;
56
- }): Promise<StoredPackInstallationComponent>;
57
- export declare function finalizePackComponentOwnership(db: Database, input: {
58
- accountId: string;
59
- workspaceId: string;
60
- packInstallationId: string;
61
- retainedComponentKeys: string[];
62
- retainedFacetInstallationIds: string[];
63
- retainedBindingIds: string[];
64
- skillActor?: SkillActor;
65
- }): Promise<{
66
- skillReleases: SkillSourceReleaseReceipt[];
67
- }>;
68
- export declare function previewPackComponentRelease(db: Database, workspaceId: string, packInstallationId: string): Promise<Array<{
69
- key: string;
70
- kind: PackComponentKind;
71
- capabilityId: string;
72
- retainedByOtherOwners: boolean;
73
- }>>;
74
- export declare function releasePackComponents(db: Database, input: {
75
- accountId: string;
76
- workspaceId: string;
77
- packInstallationId: string;
78
- skillActor?: SkillActor;
79
- }): Promise<{
80
- retainedComponents: string[];
81
- skillReleases?: SkillSourceReleaseReceipt[];
82
- }>;
83
- export {};
@@ -1,86 +0,0 @@
1
- import { type CapabilityPack, type PackInstallation } from "@opengeni/contracts";
2
- import { type Database } from "./database.js";
3
- export declare class PackOperationIdempotencyError extends Error {
4
- readonly name = "PackOperationIdempotencyError";
5
- }
6
- export declare class PackOperationInProgressError extends Error {
7
- readonly name = "PackOperationInProgressError";
8
- }
9
- export declare class PackOperationClaimLostError extends Error {
10
- readonly name = "PackOperationClaimLostError";
11
- }
12
- export declare class PackManifestChangedError extends Error {
13
- readonly name = "PackManifestChangedError";
14
- }
15
- export declare class PackInstallationVersionConflictError extends Error {
16
- readonly expectedVersion: number;
17
- readonly actualVersion: number;
18
- readonly name = "PackInstallationVersionConflictError";
19
- constructor(expectedVersion: number, actualVersion: number);
20
- }
21
- export declare class PackInstallationVersionRequiredError extends Error {
22
- readonly name = "PackInstallationVersionRequiredError";
23
- }
24
- export type PreparedPackInstallation = {
25
- installation: PackInstallation;
26
- operationId: string;
27
- operationVersion: number;
28
- replayResult: Record<string, unknown> | null;
29
- };
30
- export declare function preparePackInstallationOperation(db: Database, input: {
31
- accountId: string;
32
- workspaceId: string;
33
- subjectId: string;
34
- pack: CapabilityPack;
35
- manifestDigest: string;
36
- selectedRigId: string | null;
37
- metadata: Record<string, unknown>;
38
- idempotencyKey: string;
39
- requestDigest: string;
40
- registeredManifestDigest?: string;
41
- expectedInstallationVersion?: number;
42
- }): Promise<PreparedPackInstallation>;
43
- export declare function finalizePackInstallationOperation(db: Database, input: {
44
- accountId: string;
45
- workspaceId: string;
46
- operationId: string;
47
- operationVersion: number;
48
- packInstallationId: string;
49
- packId: string;
50
- result: Record<string, unknown>;
51
- }): Promise<PackInstallation>;
52
- export declare function deferPackInstallationOperation(db: Database, input: {
53
- accountId: string;
54
- workspaceId: string;
55
- operationId: string;
56
- operationVersion: number;
57
- packInstallationId: string;
58
- phase: string;
59
- errorCode: string;
60
- }): Promise<void>;
61
- export declare function touchPackInstallationOperation(db: Database, input: {
62
- accountId: string;
63
- workspaceId: string;
64
- operationId: string;
65
- operationVersion: number;
66
- }): Promise<void>;
67
- export declare function preparePackUninstallOperation(db: Database, input: {
68
- accountId: string;
69
- workspaceId: string;
70
- subjectId: string;
71
- packId: string;
72
- expectedInstallationVersion: number;
73
- idempotencyKey: string;
74
- requestDigest: string;
75
- }): Promise<PreparedPackInstallation | {
76
- replayResult: Record<string, unknown>;
77
- }>;
78
- export declare function finalizePackUninstallOperation(db: Database, input: {
79
- accountId: string;
80
- workspaceId: string;
81
- operationId: string;
82
- operationVersion: number;
83
- packInstallationId: string;
84
- packId: string;
85
- result: Record<string, unknown>;
86
- }): Promise<void>;
@@ -1,34 +0,0 @@
1
- import { stableJson, type McpCredentialsRequest } from "@opengeni/contracts";
2
- import { HostMcpBinding, HostMcpBindingDefinition } from "@opengeni/contracts/host-mcp-bindings";
3
-
4
- /** Metadata comparison only. A caller must independently establish accepted
5
- * execution delegation and live owner/workspace authority. A matching registry
6
- * row never authorizes a turn, a scheduler, or a nested session by itself. */
7
- export function hostMcpBindingMatchesRequest(
8
- rawBinding: unknown,
9
- request: McpCredentialsRequest,
10
- ): boolean {
11
- const parsed = HostMcpBinding.safeParse(rawBinding);
12
- if (!parsed.success) return false;
13
- const binding = parsed.data;
14
- const { hostBinding, ...connectionRef } = request.connectionRef;
15
- if (
16
- !hostBinding ||
17
- "selection" in hostBinding ||
18
- binding.status !== "active" ||
19
- binding.revokedAt !== null ||
20
- binding.id !== hostBinding.bindingId ||
21
- binding.generation !== hostBinding.generation ||
22
- binding.accountId !== request.accountId ||
23
- binding.workspaceId !== request.workspaceId ||
24
- // The registry currently describes an MCP endpoint, not a REST API grant.
25
- request.credentialTarget !== "mcp"
26
- )
27
- return false;
28
- const candidate = HostMcpBindingDefinition.safeParse({
29
- serverId: request.serverId,
30
- destinationUrl: request.destinationUrl,
31
- connectionRef,
32
- });
33
- return candidate.success && stableJson(candidate.data) === stableJson(binding.definition);
34
- }