@opengeni/core 0.28.1 → 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 +18812 -6833
  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,18 +1,39 @@
1
+ import type { SessionRetryRequest, SessionRetryResponse, SessionTurnSurface } from "@opengeni/contracts";
2
+ import { type ProductUsageMetricsSink } from "../product-usage-metrics.js";
3
+ import { type SessionStartObservability } from "./session-start-timing.js";
1
4
  import { type Settings } from "@opengeni/config";
2
- import { SessionSpawnDenial, type AccessGrant, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type Permission, type ReasoningEffort, type ResourceRef, type Session, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type SubmittedTimelineAnnotation, type TimelineAnnotation, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionToolPolicy, type SessionTurn, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1, type XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
3
- import { type CreateSessionMcpServerInput, type Database, type UpdateSessionMcpServerCredentialsInput, type SessionCommandActor } from "@opengeni/db";
5
+ import type { CodeSearchDeploymentPolicy } from "@opengeni/contracts/code-search";
6
+ import { type AgentConfigCreator, type ResolvedAgentConfig, type UpdateSessionAgentRequest } from "@opengeni/contracts";
7
+ import { SessionSpawnDenial, type AccessGrant, type ComposerDraft, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type McpConnectionAccountBinding, type McpConnectionAccountSelection, type Permission, type PersonalResourceAttachmentIntent, type ReasoningEffort, type ResourceRef, type Session, type SessionAgentAccess, type SessionCommandReceipt, type SessionScopeSubjectId, type SessionMemoryScope, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, SetSessionModelRequest, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type SubmittedTimelineAnnotation, type TimelineAnnotation, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionAuthorizationSurface, type SessionToolPolicy, type SessionTurn, type SessionPromptRouting, type SessionGoalSnapshot, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1, type VariableSet, type XaiProviderAccountAuthoritySnapshotV1, type ClaudeProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
8
+ import { type CreateSessionMcpServerInput, type Database, type FrozenTurnInitiator, type UpdateSessionMcpServerCredentialsInput, type SessionCommandActor, type NewSessionDraftSnapshot } from "@opengeni/db";
4
9
  import { type EventBus } from "@opengeni/events";
10
+ import { HTTPException } from "hono/http-exception";
11
+ import { type AccessGrantAuthorization } from "../access/index.js";
5
12
  import type { AcceptSessionUserMessageDependencies, ApiRouteDeps, SessionWorkflowClient } from "../dependencies.js";
6
13
  /** Transport-neutral typed denial raised only after its audit row committed. */
7
14
  export declare class SessionSpawnDeniedError extends Error {
8
15
  readonly denial: SessionSpawnDenial;
9
16
  constructor(denial: SessionSpawnDenial);
10
17
  }
18
+ /**
19
+ * A session's effective first-party selection as a ceiling for narrowing:
20
+ * the stored selection (or the deployment default for a legacy null) under
21
+ * the deployment ceiling, with the resume counterpart of pause authority the
22
+ * runtime already grants to existing sessions.
23
+ */
24
+ export declare function effectiveFirstPartyMcpToolCeiling(stored: readonly FirstPartyMcpToolName[] | null | undefined, policy: {
25
+ default: readonly FirstPartyMcpToolName[];
26
+ allowed: readonly FirstPartyMcpToolName[];
27
+ }): Set<FirstPartyMcpToolName>;
11
28
  /**
12
29
  * Resolve per-session first-party tool visibility without consulting
13
30
  * authorization. Top-level omission snapshots the complete runtime default;
14
31
  * child omission snapshots the parent's exact effective selection. Explicit
15
- * [] is authoritative and must never widen.
32
+ * [] is authoritative and must never widen. An explicit child selection may
33
+ * only narrow the parent's effective selection: a session that was handed a
34
+ * reduced catalog cannot spawn a child that sees more than it does. A
35
+ * top-level explicit selection keeps only the deployment ceiling (checked by
36
+ * the caller) because there is no creator selection to narrow.
16
37
  */
17
38
  export declare function resolveFirstPartyMcpToolsForCreate(requested: FirstPartyMcpToolName[] | undefined, parentStored: FirstPartyMcpToolName[] | null | undefined, policy?: {
18
39
  default: readonly FirstPartyMcpToolName[];
@@ -50,8 +71,17 @@ export type FrozenCreationInitiator = {
50
71
  type: "agent_attempt";
51
72
  }>;
52
73
  };
74
+ /** Attribution is immutable accepted-work data, never the current request principal. */
75
+ export declare function initiatingHumanForAllowance(frozen: Pick<FrozenTurnInitiator, "initiator" | "initiatingHumanSubjectId">): string | null;
53
76
  export declare function creationInitiatorForGrant(grant: AccessGrant): FrozenCreationInitiator;
77
+ export declare function normalizedSessionMcpCredentialHeaders(headers: Record<string, string> | undefined): Record<string, string>;
54
78
  export declare function settingsWithSessionMcpServerMetadata(settings: Settings, servers: SessionMcpServerMetadata[]): Settings;
79
+ export declare function validateSessionMcpCredentialUpdates(input: {
80
+ settings: Settings;
81
+ grant: AccessGrant;
82
+ session: Session;
83
+ updates: SessionMcpCredentialUpdateInput[];
84
+ }): UpdateSessionMcpServerCredentialsInput[];
55
85
  export type CreateSessionOutcome = {
56
86
  session: CreateSessionResponse;
57
87
  /** The committed create/start effect represented by this request. */
@@ -65,7 +95,30 @@ export type CreateSessionRequestOutcome = CreateSessionOutcome & {
65
95
  /** Billing telemetry is recorded after the committed session start. */
66
96
  usageRecording: "recorded" | "failed";
67
97
  };
98
+ type AgentChildSessionCreatePresentation = {
99
+ /** Model-authored title candidate from the first-party `session_create` tool.
100
+ * This is deliberately separate from the public REST request contract. */
101
+ automaticTitleCandidate?: string | null;
102
+ };
103
+ /** Trusted entry-point options for creating a session outside the REST body. */
104
+ export type SessionCreateRequestOptions = {
105
+ /**
106
+ * Product surface when the entry point knows it (for example Slack or an
107
+ * in-process embedding host). Omitted derives it from the grant.
108
+ */
109
+ surface?: SessionTurnSurface;
110
+ /**
111
+ * Agent-configuration creator kind (renderer default and default-config
112
+ * policy). Omitted derives `slack` from a Slack surface, else the public API.
113
+ */
114
+ agentConfigCreator?: AgentConfigCreator;
115
+ };
116
+ /** @internal Exported for the keyed-create repair regression. */
117
+ export declare function freezeAgentChildAutomaticTitleInCreatorContext(context: TurnInitiatorContext | undefined, title: string | null | undefined): TurnInitiatorContext | undefined;
118
+ /** @internal Keyed repair must use the committed winner, not the retry payload. */
119
+ export declare function initialAutomaticTitleForSessionStart(session: Pick<Session, "createdByContext">, requestedTitle: string | null | undefined): string | null;
68
120
  export declare function createAndStartSessionWithOutcome(input: {
121
+ initialAgentLearning?: import("@opengeni/contracts").AgentLearningOverrides | undefined;
69
122
  requestedSessionId?: string;
70
123
  db: Database;
71
124
  bus: EventBus;
@@ -73,14 +126,41 @@ export declare function createAndStartSessionWithOutcome(input: {
73
126
  /** Internal database-only composition seam. The exact session shell and this
74
127
  * linkage commit together before its first event/turn can be initialized. */
75
128
  beforeCreateCommit?: (tx: Database, sessionId: string) => Promise<void>;
129
+ /** Backend-only accepted-work composition. Recheck live caller authority
130
+ * here before capturing; session-shell authorization may have happened in
131
+ * an earlier transaction. Called only for a newly inserted initial turn. */
132
+ captureInitialTurnAuthority?: (tx: Database, sessionId: string, turnId: string) => Promise<void>;
133
+ /** Internal replay identity; the verified caller must also capture authority.
134
+ * Supplying selection metadata alone never grants runtime use. */
135
+ /** The custom workspace model was frozen by an earlier accepted boundary or
136
+ * inherited from an existing session, so retirement must not invalidate it. */
137
+ retainWorkspaceGatewayModel?: boolean;
138
+ /** Provider-neutral successor to retainWorkspaceGatewayModel. */
139
+ retainWorkspaceCustomModel?: boolean;
140
+ /** The selected workspace Gateway product is backed by a mutable custom row,
141
+ * rather than deployment-curated Gateway membership. */
142
+ workspaceGatewayCustomModel?: boolean;
143
+ /** Provider-neutral successor to workspaceGatewayCustomModel. */
144
+ workspaceCustomModel?: boolean;
76
145
  accountId: string;
77
146
  workspaceId: string;
147
+ visibility?: "user_private" | "workspace_shared";
78
148
  initialMessage: string;
149
+ /** Content-free product surface the create request entered through. */
150
+ surface?: SessionTurnSurface | null;
151
+ /**
152
+ * Live product usage counters: a newly created session (never a replay)
153
+ * counts once, and its initial user message once unless deferred.
154
+ */
155
+ metrics?: ProductUsageMetricsSink | null;
156
+ /** Optional content-free child spans; never a lifecycle dependency. */
157
+ startupObservability?: SessionStartObservability | null;
79
158
  /** Create the session shell without an initial user event/agent turn. */
80
159
  deferInitialTurn?: boolean;
81
- turnInstructions?: string | null;
160
+ modelContext?: string | null;
82
161
  resources: ResourceRef[];
83
162
  skills?: SessionSkill[];
163
+ bundledSkillIds?: import("@opengeni/contracts").BundledSkillId[] | undefined;
84
164
  tools: ToolRef[];
85
165
  toolPolicy: SessionToolPolicy;
86
166
  clientEventId?: string;
@@ -96,34 +176,63 @@ export declare function createAndStartSessionWithOutcome(input: {
96
176
  createdByActor?: Extract<SessionCommandActor, {
97
177
  type: "agent_attempt";
98
178
  }> | null;
99
- variableSet?: {
179
+ variableSets?: Array<{
100
180
  id: string;
101
181
  name: string;
102
- } | null;
182
+ scope: VariableSet["scope"];
183
+ }>;
103
184
  rigId?: string | null;
104
185
  rigVersionId?: string | null;
105
186
  channelId?: string | null;
106
187
  goal?: GoalSpec | null;
188
+ /** Trusted sensitive-safe automatic title for an agent-created child. The
189
+ * atomic initializer commits the row mutation and `session.title_set`. */
190
+ initialAutomaticTitle?: string | null;
107
191
  instructions?: string | null;
108
192
  policyRole?: string | null;
109
193
  firstPartyMcpPermissions?: Permission[] | null;
110
194
  firstPartyMcpTools: FirstPartyMcpToolName[];
195
+ agentConfig?: ResolvedAgentConfig | null;
196
+ agentAccess?: SessionAgentAccess;
197
+ scopeSubjectId?: SessionScopeSubjectId | null;
198
+ memoryScope?: SessionMemoryScope;
111
199
  mcpServers?: CreateSessionMcpServerInput[];
200
+ mcpApprovalPolicies?: Record<string, SessionMcpApprovalPolicy>;
112
201
  sessionMcpServers?: SessionMcpServerMetadata[];
113
202
  personalConnectionDelegations?: McpPersonalConnectionDelegation[];
203
+ mcpAccountBindings?: McpConnectionAccountBinding[] | null;
204
+ initialPersonalResourceAttachmentIntent?: PersonalResourceAttachmentIntent | null;
114
205
  xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
206
+ claudeProviderAccountAuthoritySnapshot?: ClaudeProviderAccountAuthoritySnapshotV1;
115
207
  parentSessionId?: string | null;
208
+ codeSearchDeploymentPolicy?: CodeSearchDeploymentPolicy;
116
209
  createIdempotencyKey?: string | null;
210
+ selectedInstalledSkillIds?: string[];
117
211
  sandboxGroupId?: string | null;
118
212
  sandboxOs?: Session["sandboxOs"];
119
213
  seedTargetSandbox?: {
120
214
  sandboxId: string;
121
215
  settings: Settings;
122
216
  workingDir?: string | null;
217
+ resourceSubjectId?: string | null;
123
218
  } | null;
124
219
  consumeNewSessionDraft?: {
125
220
  subjectId: string;
126
221
  expectedRevision: number;
222
+ expectedSnapshot: NewSessionDraftSnapshot;
223
+ acceptedSelection: {
224
+ channelId: string | null;
225
+ targetSandboxId: string | null;
226
+ workingDir: string | null;
227
+ };
228
+ } | null;
229
+ rememberNewSessionSelection?: {
230
+ subjectId: string;
231
+ acceptedSelection: {
232
+ channelId: string | null;
233
+ targetSandboxId: string | null;
234
+ workingDir: string | null;
235
+ };
127
236
  } | null;
128
237
  maxNestedAgentDepthOverride?: number | null;
129
238
  allowNestedAgentDepthIncrease?: boolean;
@@ -132,6 +241,13 @@ export declare function createAndStartSessionWithOutcome(input: {
132
241
  /** Backward-compatible entity-returning create path used by existing callers. */
133
242
  export declare function createAndStartSession(input: Parameters<typeof createAndStartSessionWithOutcome>[0]): Promise<CreateSessionResponse>;
134
243
  export declare function workflowIdForSession(sessionId: string): string;
244
+ /**
245
+ * The one 422 for a model that is not selectable in the live catalog (retired,
246
+ * removed, or never offered). The message keeps its historical text; the typed
247
+ * cause lets the API envelope add `details.code: "model_unavailable"` so
248
+ * clients can ask for another model instead of offering a futile retry.
249
+ */
250
+ export declare function modelUnavailableHttpException(model: string): HTTPException;
135
251
  /**
136
252
  * Reject an explicit model that the host does not expose. The set of usable
137
253
  * models is the union surfaced by `configuredAllowedModels` (the built-in
@@ -140,8 +256,9 @@ export declare function workflowIdForSession(sessionId: string): string;
140
256
  * the API edge with 422 rather than enqueuing a turn the worker can't honor.
141
257
  *
142
258
  * `model` is the effective value selected by the caller's boundary. Top-level
143
- * omission defaults to `settings.openaiModel`; child-session omission inherits
144
- * the worker-signed calling turn before reaching this helper. Centralized here
259
+ * omission resolves the new-chat default (`resolveDefaultSessionModel`);
260
+ * child-session omission inherits the worker-signed calling turn before
261
+ * reaching this helper. Centralized here
145
262
  * so every model-carrying choke point
146
263
  * (create-session, user-message/turn-accept, queued-turn update, and
147
264
  * scheduled-task agentConfig — a scheduled task is a session the worker runs
@@ -168,15 +285,13 @@ export declare function assertSessionAllowsProductModel(session: Pick<Session, "
168
285
  * worker's authoritative post-resolution gate would fail. `model` is the
169
286
  * EFFECTIVE value the caller is about to persist: pass the explicit value at
170
287
  * message/turn-update/scheduled-task edges (omitted inherits an
171
- * already-validated stored default), but at session CREATION pass
172
- * `payload.model ?? settings.openaiModel` — an omitted model stamps the
173
- * deployment default onto the session, and under a restricted policy that
174
- * default may be exactly the provider the policy exists to block.
288
+ * already-validated stored default), but at session CREATION pass the
289
+ * effective model: an omitted model stamps the resolved default onto the
290
+ * session, and under a restricted policy that default may be exactly the
291
+ * provider the policy exists to block.
175
292
  */
176
293
  export declare function assertWorkspaceModelPolicyAllows(db: Database, settings: Settings, workspaceId: string, model: string | null | undefined): Promise<void>;
177
294
  export declare function requireQueuedTurnForApi(db: Database, workspaceId: string, sessionId: string, turnId: string): Promise<SessionTurn>;
178
- export declare function reasoningEffortForSession(metadata: Record<string, unknown>, fallback: Settings["openaiReasoningEffort"]): Settings["openaiReasoningEffort"];
179
- export declare function latencyModeForSession(metadata: Record<string, unknown>, fallback?: "standard" | "priority" | "fast"): "standard" | "priority" | "fast";
180
295
  /**
181
296
  * Appends a `user.message` to an existing session and enqueues the resulting
182
297
  * turn, merging requested resources/tools into the session and waking the
@@ -184,7 +299,16 @@ export declare function latencyModeForSession(metadata: Record<string, unknown>,
184
299
  * `session_send_message` tool so the two surfaces cannot drift. Callers own
185
300
  * resource/tool validation and the per-message usage limit before calling.
186
301
  */
187
- export declare function postUserMessageTurn(input: {
302
+ type PostUserMessageTurnResult = {
303
+ accepted: SessionEvent;
304
+ turn: SessionTurn;
305
+ draft: ComposerDraft | null;
306
+ receipt: SessionCommandReceipt;
307
+ routing: SessionPromptRouting;
308
+ interruptionCount: number;
309
+ replay: boolean;
310
+ };
311
+ type PostUserMessageTurnInput = {
188
312
  db: Database;
189
313
  bus: EventBus;
190
314
  workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
@@ -194,45 +318,84 @@ export declare function postUserMessageTurn(input: {
194
318
  sessionId: string;
195
319
  text: string;
196
320
  annotations?: TimelineAnnotation[];
197
- turnInstructions?: string | null;
321
+ modelContext?: string | null;
198
322
  resources: ResourceRef[];
323
+ /** Actor-owned resources used only for the exact durable-draft fence. */
324
+ composerDraftResources?: ResourceRef[];
199
325
  model?: string | null;
200
326
  reasoningEffort?: Settings["openaiReasoningEffort"] | null;
201
327
  latencyMode?: "standard" | "priority" | "fast" | null;
202
328
  clientEventId?: string;
203
329
  mcpCredentialUpdates?: UpdateSessionMcpServerCredentialsInput[];
204
330
  personalConnectionDelegations?: McpPersonalConnectionDelegation[];
331
+ mcpAccountBindings?: McpConnectionAccountBinding[] | null;
332
+ captureTurnAuthority?: (tx: Database, turnId: string) => Promise<void>;
333
+ personalResourceAttachment?: PersonalResourceAttachmentIntent;
205
334
  delivery?: "send" | "steer";
206
335
  origin?: "human" | "operator";
336
+ /** Content-free product surface the request entered through. */
337
+ surface?: SessionTurnSurface | null;
207
338
  actor?: string;
208
339
  actorLabel?: string;
209
340
  commandActor?: SessionCommandActor;
210
341
  controlEtag?: string | null;
211
342
  expectedDraftRevision?: number | null;
343
+ boundaryRequestHash?: string;
212
344
  reasoningEffortFallback?: Settings["openaiReasoningEffort"];
213
345
  turnExecutionPolicy: TurnExecutionPolicyV1;
214
346
  recordAgentRunUsage?: boolean;
215
347
  schedulePostCommit?: (task: () => Promise<void>) => void;
216
- }): Promise<{
217
- accepted: SessionEvent;
218
- turn: SessionTurn;
219
- interruptionCount: number;
220
- replay: boolean;
221
- }>;
348
+ };
349
+ export declare function postUserMessageTurn(input: PostUserMessageTurnInput): Promise<PostUserMessageTurnResult>;
222
350
  /**
223
351
  * Full create-session flow shared by `POST /sessions` and the first-party MCP
224
352
  * `session_create` tool: payload validation, resource/tool/variableSet
225
353
  * checks, usage limits, session start, and usage recording. `rawPayload` is
226
354
  * the unparsed request body so absent-vs-empty execution-context fields keep
227
- * their meaning: a child inherits omitted resources/tools/mcpServers from its
228
- * trusted immediate parent, while explicit arrays (including []) win. A
355
+ * their meaning: a child inherits repositories (never files), tools, and MCP
356
+ * servers from its trusted immediate parent when omitted; explicit arrays
357
+ * (including []) win. A
229
358
  * top-level create with omitted tools applies workspace-default capability MCPs.
230
359
  */
231
- export declare function createSessionForRequestWithOutcome(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown): Promise<CreateSessionRequestOutcome>;
360
+ export declare function resolveChildGoalFromAcceptedSnapshot(goal: GoalSpec, parentGoalSnapshot: SessionGoalSnapshot): GoalSpec;
361
+ export declare function resolveSessionCreateVisibility(input: {
362
+ requestedVisibility: "private" | "workspace";
363
+ visibilityProvided: boolean;
364
+ parentVisibility: "user_private" | "workspace_shared" | null;
365
+ }): "user_private" | "workspace_shared";
366
+ export type SessionCreateScope = {
367
+ agentAccess: SessionAgentAccess;
368
+ scopeSubjectId: SessionScopeSubjectId | null;
369
+ memoryScope: SessionMemoryScope;
370
+ };
371
+ /**
372
+ * Resolve a new session's agent-access scope, end-user label, and Memory
373
+ * selector (migration 0427). A top-level request takes its own values. An
374
+ * agent-created child inherits every omitted value from its trusted parent
375
+ * and may only NARROW an explicit one: agent access workspace > user >
376
+ * session, memory workspace > user > session > off, and the label must equal
377
+ * the parent's. Widening is a 403 because the parent's declared reach is a
378
+ * security boundary the child's own request cannot cross; a memory `user`
379
+ * selector without a label is a 422 in either position.
380
+ */
381
+ export declare function resolveSessionCreateScope(input: {
382
+ requested: {
383
+ agentAccess: SessionAgentAccess;
384
+ agentAccessProvided: boolean;
385
+ scopeSubjectId: SessionScopeSubjectId | null;
386
+ endUserProvided: boolean;
387
+ memoryScope: SessionMemoryScope;
388
+ memoryScopeProvided: boolean;
389
+ };
390
+ parent: SessionCreateScope | null;
391
+ }): SessionCreateScope;
392
+ /** Explicit recovery, never a new prompt or a Pause/Resume command. */
393
+ export declare function retryFailedSession(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, sessionId: string, request: SessionRetryRequest): Promise<SessionRetryResponse>;
394
+ declare function createSessionForRequestInFileScope(unresolvedDeps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown, authorization?: AccessGrantAuthorization, agentChildPresentation?: AgentChildSessionCreatePresentation, requestOptions?: SessionCreateRequestOptions): Promise<CreateSessionRequestOutcome>;
232
395
  /** @internal Fixed public projection; the committed session outcome remains authoritative. */
233
396
  export declare function reportSessionUsageRecordingFailure(_error: unknown): void;
234
397
  /** Backward-compatible entity-returning request path for REST and core callers. */
235
- export declare function createSessionForRequest(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown): Promise<CreateSessionResponse>;
398
+ export declare function createSessionForRequest(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown, authorization?: AccessGrantAuthorization, requestOptions?: SessionCreateRequestOptions): Promise<CreateSessionResponse>;
236
399
  /**
237
400
  * Full accept-user-message flow shared by the `user.message` branch of
238
401
  * `POST /sessions/:id/events` and the first-party MCP `session_send_message`
@@ -240,23 +403,36 @@ export declare function createSessionForRequest(deps: ApiRouteDeps, grant: Acces
240
403
  * enqueue, and usage recording. `toolsProvided: false` durably preserves an
241
404
  * Tool selection is durable session state and never rides a follow-up prompt.
242
405
  */
243
- export declare function acceptSessionUserMessageWithOutcome(deps: AcceptSessionUserMessageDependencies, grant: AccessGrant, workspaceId: string, sessionId: string, input: {
406
+ declare function acceptSessionUserMessageInFileScope(deps: AcceptSessionUserMessageDependencies, grant: AccessGrant, workspaceId: string, sessionId: string, input: {
244
407
  text: string;
245
408
  annotations?: SubmittedTimelineAnnotation[];
246
- turnInstructions?: string | null;
409
+ modelContext?: string | null;
247
410
  resources?: ResourceRef[];
411
+ /** Actor-owned resources used only for the exact durable-draft fence. */
412
+ composerDraftResources?: ResourceRef[];
248
413
  model?: string | null;
249
414
  reasoningEffort?: ReasoningEffort | null;
250
415
  latencyMode?: "standard" | "priority" | "fast" | null;
251
416
  clientEventId?: string;
252
417
  mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[];
418
+ connectionAccounts?: McpConnectionAccountSelection[];
253
419
  delivery?: "send" | "steer";
254
420
  origin?: "human" | "operator";
421
+ /**
422
+ * Product surface when the entry point knows it (for example Slack or an
423
+ * in-process embedding host). Omitted derives it from the grant.
424
+ */
425
+ surface?: SessionTurnSurface;
255
426
  controlEtag?: string | null;
256
427
  expectedDraftRevision?: number | null;
428
+ personalResourceAttachment?: PersonalResourceAttachmentIntent;
429
+ authorization?: AccessGrantAuthorization;
257
430
  }): Promise<{
258
431
  accepted: SessionEvent;
259
432
  turn: SessionTurn;
433
+ draft: ComposerDraft | null;
434
+ receipt: SessionCommandReceipt;
435
+ routing: SessionPromptRouting;
260
436
  interruptionCount: number;
261
437
  replay: boolean;
262
438
  }>;
@@ -264,6 +440,8 @@ export declare function acceptSessionUserMessageWithOutcome(deps: AcceptSessionU
264
440
  export declare function acceptSessionUserMessage(deps: Parameters<typeof acceptSessionUserMessageWithOutcome>[0], grant: Parameters<typeof acceptSessionUserMessageWithOutcome>[1], workspaceId: Parameters<typeof acceptSessionUserMessageWithOutcome>[2], sessionId: Parameters<typeof acceptSessionUserMessageWithOutcome>[3], input: Parameters<typeof acceptSessionUserMessageWithOutcome>[4]): Promise<{
265
441
  accepted: SessionEvent;
266
442
  turn: SessionTurn;
443
+ receipt: SessionCommandReceipt;
444
+ routing: SessionPromptRouting;
267
445
  interruptionCount: number;
268
446
  replay: boolean;
269
447
  }>;
@@ -285,6 +463,18 @@ export declare function updateSessionTitle(deps: {
285
463
  title: string | null;
286
464
  relatedSessionAccess: "target" | "root";
287
465
  }>;
466
+ /** Change future defaults without accepting a prompt or touching accepted work. */
467
+ export declare function setSessionModel(deps: Pick<ApiRouteDeps, "db" | "bus" | "settings" | "catalogSourceSettings" | "sessionAuthorization">, grant: AccessGrant, sessionId: string, request: SetSessionModelRequest, surface?: SessionAuthorizationSurface): Promise<{
468
+ model: string;
469
+ reasoningEffort: "high" | "low" | "max" | "medium" | "minimal" | "none" | "xhigh";
470
+ latencyMode: "fast" | "priority" | "standard";
471
+ eventId: string;
472
+ receiptId: string;
473
+ timestamp: string;
474
+ replay: boolean;
475
+ sessionId: string;
476
+ effectiveFrom: "future_turns";
477
+ }>;
288
478
  /**
289
479
  * Update one existing session MCP server's approval policy. The database
290
480
  * serializes this write with attempt claim under the session lock: an already
@@ -308,4 +498,61 @@ export declare function updateSessionToolPolicy(deps: {
308
498
  settings: Settings;
309
499
  sessionAuthorization?: SessionAuthorizationPort | null;
310
500
  }, grant: AccessGrant, sessionId: string, request: UpdateSessionToolPolicyRequest): Promise<Session>;
501
+ /**
502
+ * Replace a running session's agent configuration (`PUT .../agent`). Omitted
503
+ * request fields keep their current values; a legacy (null) session converts
504
+ * from its current effective state without widening. The configuration and
505
+ * its write-through to the legacy tool columns (and the instructions alias)
506
+ * commit under the same tool-policy version CAS, so tool-policy and agent
507
+ * updates cannot race. Effective from the next attempt. Agent callers may only
508
+ * narrow; a child never widens past its parent.
509
+ */
510
+ export declare function updateSessionAgent(deps: {
511
+ db: Database;
512
+ bus: EventBus;
513
+ settings: Settings;
514
+ sessionAuthorization?: SessionAuthorizationPort | null;
515
+ }, grant: AccessGrant, sessionId: string, request: UpdateSessionAgentRequest): Promise<Session>;
311
516
  export declare function readSessionLineage(deps: Pick<ApiRouteDeps, "db" | "sessionAuthorization">, grant: AccessGrant, sessionId: string): Promise<import("@opengeni/db").SessionLineage>;
517
+ /**
518
+ * A server attached in the same root create request is selected by that
519
+ * attachment. Neither `tools` (an allow-list over the workspace/deployment
520
+ * registry) nor the workspace-default expansion can name it, so without this
521
+ * the attached endpoint was stored but never contacted and the model saw no
522
+ * tools. This grants nothing beyond the attach itself: the caller already
523
+ * passed `mcp_servers:attach` for exactly this endpoint, and the server's own
524
+ * approval policy still governs every call. An explicit ref for the same id
525
+ * wins unchanged so a caller can still mark it `eager` or `optional`; the
526
+ * added ref is strict, exactly like listing `{ kind: "mcp", id }` explicitly.
527
+ * Child creates never reach here: an inherited snapshot keeps the parent's
528
+ * selection and a child may only narrow it.
529
+ */
530
+ export declare function withSameRequestSessionMcpServerTools(tools: ToolRef[], attachedServers: ReadonlyArray<{
531
+ id: string;
532
+ }>): ToolRef[];
533
+ /**
534
+ * The executable MCP tool list a follow-up on an existing session freezes
535
+ * connector accounts against.
536
+ *
537
+ * A `workspace_default` session stores only the tool snapshot taken when it
538
+ * was created and expands the current workspace defaults at run time, so a
539
+ * connector enabled after creation never enters the stored column. The
540
+ * composer projects that same expansion and submits account selections for
541
+ * it, so freezing against the stored column rejected every such selection as
542
+ * unmatched and never froze its personal delegation. Resolve through the one
543
+ * ID-only policy resolver the API projection and the worker use, with the
544
+ * same omitted-tools default, so all three agree on the executable set.
545
+ */
546
+ export declare function sessionToolsForConnectionAccounts(input: {
547
+ session: Pick<Session, "tools" | "toolPolicy">;
548
+ /** The resolved runtime registry, including session-local servers. */
549
+ runtimeMcpServers: Iterable<{
550
+ id: string;
551
+ }>;
552
+ /** The current omitted-tools default for this workspace. */
553
+ defaultMcpServerIds: Iterable<string>;
554
+ }): ToolRef[];
555
+ /** Keep original-file ownership scoped across admission, history hydration and setup. */
556
+ export declare function createSessionForRequestWithOutcome(...args: Parameters<typeof createSessionForRequestInFileScope>): Promise<CreateSessionRequestOutcome>;
557
+ export declare function acceptSessionUserMessageWithOutcome(...args: Parameters<typeof acceptSessionUserMessageInFileScope>): ReturnType<typeof acceptSessionUserMessageInFileScope>;
558
+ export {};
@@ -8,6 +8,7 @@ export type GitHubSkillTreeEntry = Readonly<{
8
8
  size: number | null;
9
9
  }>;
10
10
  export type GitHubSkillSourceClient = Readonly<{
11
+ downloadSnapshot?(owner: string, repository: string, slug: string): Promise<readonly SkillLibraryFile[]>;
11
12
  resolveCommit(owner: string, repository: string, ref: string): Promise<string>;
12
13
  listTree(owner: string, repository: string, commit: string): Promise<readonly GitHubSkillTreeEntry[]>;
13
14
  readBlob(owner: string, repository: string, sha: string): Promise<Uint8Array>;
@@ -0,0 +1,30 @@
1
+ import type { Settings } from "@opengeni/config";
2
+ import { pinnedFetch } from "@opengeni/network";
3
+ export type PublicSkillSearchInput = Readonly<{
4
+ query: string;
5
+ limit?: number;
6
+ owner?: string;
7
+ }>;
8
+ export type PublicSkillSearchResult = Readonly<{
9
+ provider: "skills_sh";
10
+ query: string;
11
+ items: readonly Readonly<{
12
+ id: string;
13
+ name: string;
14
+ source: string;
15
+ skillId: string;
16
+ url: string;
17
+ installs: number;
18
+ }>[];
19
+ nextCursor: null;
20
+ }>;
21
+ export type PublicSkillSearchClient = Readonly<{
22
+ search(input: PublicSkillSearchInput): Promise<PublicSkillSearchResult>;
23
+ }>;
24
+ export type PublicSkillSearchErrorCode = "invalid_query" | "rate_limited" | "timeout" | "unavailable" | "invalid_response";
25
+ export declare class PublicSkillSearchError extends Error {
26
+ readonly code: PublicSkillSearchErrorCode;
27
+ readonly retryAfterSeconds: number | null;
28
+ constructor(code: PublicSkillSearchErrorCode, message: string, retryAfterSeconds?: number | null);
29
+ }
30
+ export declare function createPublicSkillSearchClient(settings: Settings, fetcher?: typeof pinnedFetch): PublicSkillSearchClient;
@@ -0,0 +1,117 @@
1
+ import type { SkillFile, SkillInstallInput, SkillRevisionInput, SkillSaveInput, SkillRemoveInput } from "@opengeni/contracts";
2
+ import { listSkillRecords, type Database, type SkillReadContext } from "@opengeni/db";
3
+ export { replayPortableSkillInstall } from "@opengeni/db";
4
+ /** Canonical text-only folder; rejects invalid Unicode before PostgreSQL conversion. */
5
+ export declare function validateSkillFiles(files: readonly SkillFile[]): SkillFile[];
6
+ /** Separate from the historical SKILL.md hash, which must never be rewritten. */
7
+ export declare function skillBundleHash(files: readonly SkillFile[]): string;
8
+ export declare const listSkills: typeof listSkillRecords;
9
+ export declare function removeSkill(db: Database, input: SkillRemoveInput): Promise<{
10
+ removed?: boolean | undefined;
11
+ operationId: string;
12
+ skillId: string;
13
+ revisionId: string;
14
+ outcome: "applied" | "pending" | "preserved";
15
+ decision?: "rejected" | undefined;
16
+ pendingReason?: "approval" | "source_finalization" | undefined;
17
+ skillReview?: {
18
+ removalOperationId?: string | undefined;
19
+ sourceOperationId: string;
20
+ skillId: string;
21
+ revisionId: string;
22
+ expectedRevisionId: string | null;
23
+ expectedScopeVersion: number;
24
+ } | undefined;
25
+ replayed: boolean;
26
+ }>;
27
+ export declare function readSkill(db: Database, context: SkillReadContext, skillId: string, revisionId?: string): Promise<import("@opengeni/contracts").SkillRecord | null>;
28
+ export declare function saveSkill(db: Database, input: SkillSaveInput): Promise<{
29
+ removed?: boolean | undefined;
30
+ operationId: string;
31
+ skillId: string;
32
+ revisionId: string;
33
+ outcome: "applied" | "pending" | "preserved";
34
+ decision?: "rejected" | undefined;
35
+ pendingReason?: "approval" | "source_finalization" | undefined;
36
+ skillReview?: {
37
+ removalOperationId?: string | undefined;
38
+ sourceOperationId: string;
39
+ skillId: string;
40
+ revisionId: string;
41
+ expectedRevisionId: string | null;
42
+ expectedScopeVersion: number;
43
+ } | undefined;
44
+ replayed: boolean;
45
+ }>;
46
+ export declare function installSkill(db: Database, input: SkillInstallInput): Promise<{
47
+ removed?: boolean | undefined;
48
+ operationId: string;
49
+ skillId: string;
50
+ revisionId: string;
51
+ outcome: "applied" | "pending" | "preserved";
52
+ decision?: "rejected" | undefined;
53
+ pendingReason?: "approval" | "source_finalization" | undefined;
54
+ skillReview?: {
55
+ removalOperationId?: string | undefined;
56
+ sourceOperationId: string;
57
+ skillId: string;
58
+ revisionId: string;
59
+ expectedRevisionId: string | null;
60
+ expectedScopeVersion: number;
61
+ } | undefined;
62
+ replayed: boolean;
63
+ }>;
64
+ export declare function approveSkill(db: Database, input: SkillRevisionInput): Promise<{
65
+ removed?: boolean | undefined;
66
+ operationId: string;
67
+ skillId: string;
68
+ revisionId: string;
69
+ outcome: "applied" | "pending" | "preserved";
70
+ decision?: "rejected" | undefined;
71
+ pendingReason?: "approval" | "source_finalization" | undefined;
72
+ skillReview?: {
73
+ removalOperationId?: string | undefined;
74
+ sourceOperationId: string;
75
+ skillId: string;
76
+ revisionId: string;
77
+ expectedRevisionId: string | null;
78
+ expectedScopeVersion: number;
79
+ } | undefined;
80
+ replayed: boolean;
81
+ }>;
82
+ export declare function rejectSkill(db: Database, input: SkillRevisionInput): Promise<{
83
+ removed?: boolean | undefined;
84
+ operationId: string;
85
+ skillId: string;
86
+ revisionId: string;
87
+ outcome: "applied" | "pending" | "preserved";
88
+ decision?: "rejected" | undefined;
89
+ pendingReason?: "approval" | "source_finalization" | undefined;
90
+ skillReview?: {
91
+ removalOperationId?: string | undefined;
92
+ sourceOperationId: string;
93
+ skillId: string;
94
+ revisionId: string;
95
+ expectedRevisionId: string | null;
96
+ expectedScopeVersion: number;
97
+ } | undefined;
98
+ replayed: boolean;
99
+ }>;
100
+ export declare function restoreSkill(db: Database, input: SkillRevisionInput): Promise<{
101
+ removed?: boolean | undefined;
102
+ operationId: string;
103
+ skillId: string;
104
+ revisionId: string;
105
+ outcome: "applied" | "pending" | "preserved";
106
+ decision?: "rejected" | undefined;
107
+ pendingReason?: "approval" | "source_finalization" | undefined;
108
+ skillReview?: {
109
+ removalOperationId?: string | undefined;
110
+ sourceOperationId: string;
111
+ skillId: string;
112
+ revisionId: string;
113
+ expectedRevisionId: string | null;
114
+ expectedScopeVersion: number;
115
+ } | undefined;
116
+ replayed: boolean;
117
+ }>;