@opengeni/core 3.0.1 → 3.1.2
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.
- package/README.md +4 -4
- package/dist/access/index.d.ts +131 -7
- package/dist/access/service-initiator.d.ts +3 -0
- package/dist/application/archived-session-imports.d.ts +6 -0
- package/dist/application/composer-submit.d.ts +1 -1
- package/dist/application/connect-operation.d.ts +6 -0
- package/dist/application/external-workspace-members.d.ts +13 -1
- package/dist/application/modal-native-live-declaration-join.d.ts +37 -0
- package/dist/application/modal-native-original-configuration.d.ts +79 -0
- package/dist/application/modal-native-worker-host-transport.d.ts +297 -0
- package/dist/application/new-session-drafts.d.ts +29 -2
- package/dist/application/organization-privacy.d.ts +57 -0
- package/dist/application/prepared-mcp-connection.d.ts +31 -0
- package/dist/application/sandbox-recovery.d.ts +58 -0
- package/dist/application/session-commands.d.ts +3 -0
- package/dist/application/session-tenancy.d.ts +13 -4
- package/dist/billing/agent-run-admission.d.ts +21 -0
- package/dist/billing/limits.d.ts +27 -1
- package/dist/billing/model-call-admission.d.ts +34 -0
- package/dist/billing/model-usage-settlement.d.ts +112 -0
- package/dist/canonical-human-identities.js +1 -1
- package/dist/{chunk-VCZFFEPB.js → chunk-7T2SZ7BI.js} +16 -2
- package/dist/chunk-7T2SZ7BI.js.map +1 -0
- package/dist/{chunk-ZYCNLYGH.js → chunk-OMJFIIWK.js} +178 -12
- package/dist/chunk-OMJFIIWK.js.map +1 -0
- package/dist/{chunk-H7X52RI2.js → chunk-QI2M2B2K.js} +83 -8
- package/dist/chunk-QI2M2B2K.js.map +1 -0
- package/dist/{chunk-OF65T3PM.js → chunk-TTWTXQB2.js} +94 -6
- package/dist/chunk-TTWTXQB2.js.map +1 -0
- package/dist/codex-model-availability.d.ts +55 -0
- package/dist/default-session-model.d.ts +192 -0
- package/dist/dependencies.d.ts +41 -7
- package/dist/developer-setup-credential-ceiling.d.ts +10 -0
- package/dist/domain/agent-config-resolution.d.ts +49 -0
- package/dist/domain/automations.d.ts +8 -1
- package/dist/domain/capabilities.d.ts +112 -8
- package/dist/domain/connection-account-selection-error.d.ts +8 -0
- package/dist/domain/connector-tool-permissions.d.ts +62 -0
- package/dist/domain/direct-model-provider.d.ts +3 -0
- package/dist/domain/editable-artifacts/agent-application.d.ts +10 -1
- package/dist/domain/editable-artifacts/durable-export.d.ts +22 -1
- package/dist/domain/editable-artifacts/ports.d.ts +10 -0
- package/dist/domain/editable-artifacts/service.d.ts +3 -1
- package/dist/domain/editable-artifacts/types.d.ts +1 -1
- package/dist/domain/encryption-key.d.ts +12 -0
- package/dist/domain/insights-timing.d.ts +16 -0
- package/dist/domain/insights-usage.d.ts +27 -0
- package/dist/domain/insights.d.ts +21 -3
- package/dist/domain/knowledge-files.d.ts +1 -1
- package/dist/domain/knowledge-preparation.d.ts +10 -0
- package/dist/domain/knowledge-preparation.test.d.ts +1 -0
- package/dist/domain/knowledge-search.d.ts +15 -76
- package/dist/domain/mcp-account-bindings.d.ts +17 -0
- package/dist/domain/mcp-account-routes.d.ts +21 -0
- package/dist/domain/native-mcp-connection-admission.d.ts +3 -0
- package/dist/domain/organization-integration-catalog.d.ts +15 -0
- package/dist/domain/personal-connection-delegations.d.ts +73 -12
- package/dist/domain/pr-review.d.ts +121 -6
- package/dist/domain/realtime-voice-billing.d.ts +103 -0
- package/dist/domain/resources.d.ts +17 -1
- package/dist/domain/scheduled-task-access.d.ts +265 -0
- package/dist/domain/scheduled-task-account-audit.d.ts +27 -0
- package/dist/domain/scheduled-task-audience.d.ts +70 -0
- package/dist/domain/scheduled-tasks.d.ts +61 -18
- package/dist/domain/session-connection-accounts.d.ts +53 -0
- package/dist/domain/session-file-access.d.ts +4 -0
- package/dist/domain/session-native-connection-replacement.d.ts +14 -0
- package/dist/domain/session-start-timing.d.ts +7 -0
- package/dist/domain/session-tool-policy.d.ts +102 -4
- package/dist/domain/sessions.d.ts +179 -15
- package/dist/domain/site-audience.d.ts +52 -0
- package/dist/domain/skills.d.ts +29 -1
- package/dist/domain/slack-bot.d.ts +46 -1
- package/dist/domain/slack-publication-secret-safety.d.ts +1 -1
- package/dist/domain/vaults/index.d.ts +7 -0
- package/dist/domain/vaults/mapping.d.ts +25 -0
- package/dist/domain/vaults/provider-registry.d.ts +72 -0
- package/dist/domain/vaults/provider-sync.d.ts +176 -0
- package/dist/domain/vaults/provider-writes.d.ts +57 -0
- package/dist/domain/vaults/secret-resolver.d.ts +34 -0
- package/dist/domain/vaults/types.d.ts +24 -0
- package/dist/domain/vaults/vault-service.d.ts +35 -0
- package/dist/domain/voice-input-billing.d.ts +77 -0
- package/dist/domain/web-search-billing.d.ts +51 -0
- package/dist/domain/workspace-credits.d.ts +7 -0
- package/dist/editable-artifact-live/application.d.ts +2 -1
- package/dist/editable-artifact-live/server.d.ts +5 -1
- package/dist/editable-artifact-live/ticket.d.ts +2 -1
- package/dist/editable-artifact-live/types.d.ts +9 -0
- package/dist/editable-artifact-live.js +2 -2
- package/dist/editable-artifacts.js +10 -2
- package/dist/goal-admission.d.ts +627 -0
- package/dist/host-session-usage-limit.d.ts +15 -0
- package/dist/index.d.ts +43 -8
- package/dist/index.js +22682 -11743
- package/dist/index.js.map +1 -1
- package/dist/managed-session.d.ts +110 -7
- package/dist/model-call.d.ts +58 -0
- package/dist/model-catalog.d.ts +29 -3
- package/dist/model-provider-credentials.d.ts +43 -0
- package/dist/product-usage-metrics.d.ts +30 -0
- package/dist/rigs/index.d.ts +1 -13
- package/dist/sandbox/fleet.d.ts +58 -4
- package/dist/sandbox/routing.d.ts +42 -2
- package/dist/sandbox/runtime-settings.d.ts +27 -17
- package/dist/session-authorization.d.ts +10 -0
- package/dist/session-usage-limit-metrics.d.ts +60 -0
- package/dist/session-usage-limits.d.ts +89 -0
- package/dist/site-agent-clamp.d.ts +71 -0
- package/dist/site-session-origin.d.ts +39 -2
- package/dist/transcription.d.ts +120 -3
- package/dist/turn-surface.d.ts +20 -0
- package/dist/user-presence.d.ts +32 -0
- package/dist/workflow-wake-contract.d.ts +13 -1
- package/package.json +15 -22
- package/src/access/index.ts +961 -38
- package/src/access/service-initiator.ts +50 -0
- package/src/application/api-integration-servers.ts +9 -0
- package/src/application/archived-session-imports.ts +161 -0
- package/src/application/composer-submit.ts +3 -2
- package/src/application/connect-authority.ts +3 -3
- package/src/application/connect-operation.ts +37 -3
- package/src/application/external-continuation.ts +20 -3
- package/src/application/external-link-work-admission.ts +3 -0
- package/src/application/external-workspace-members.ts +51 -3
- package/src/application/modal-native-live-declaration-join.ts +196 -0
- package/src/application/modal-native-original-configuration.ts +261 -0
- package/src/application/modal-native-worker-host-transport.ts +263 -0
- package/src/application/new-session-drafts.ts +172 -55
- package/src/application/organization-privacy.ts +161 -0
- package/src/application/prepared-mcp-connection.ts +133 -0
- package/src/application/sandbox-recovery.ts +78 -0
- package/src/application/session-commands.ts +73 -1
- package/src/application/session-mcp-credential-rotation.ts +61 -18
- package/src/application/session-tenancy.ts +262 -44
- package/src/application/user-resource-grants.ts +1 -29
- package/src/billing/agent-run-admission.ts +117 -0
- package/src/billing/limits.ts +138 -14
- package/src/billing/model-call-admission.ts +118 -0
- package/src/billing/model-usage-settlement.ts +472 -0
- package/src/codex-model-availability.ts +264 -0
- package/src/default-session-model.ts +692 -0
- package/src/dependencies.ts +48 -6
- package/src/developer-setup-credential-ceiling.ts +60 -0
- package/src/domain/agent-config-resolution.ts +148 -0
- package/src/domain/automations.ts +76 -2
- package/src/domain/capabilities.ts +830 -181
- package/src/domain/connection-account-selection-error.ts +19 -0
- package/src/domain/connector-tool-permissions.ts +572 -0
- package/src/domain/direct-model-provider.ts +62 -0
- package/src/domain/editable-artifacts/agent-application.ts +44 -6
- package/src/domain/editable-artifacts/durable-export.ts +100 -5
- package/src/domain/editable-artifacts/in-memory.ts +6 -0
- package/src/domain/editable-artifacts/ports.ts +11 -0
- package/src/domain/editable-artifacts/service.ts +20 -0
- package/src/domain/editable-artifacts/types.ts +1 -1
- package/src/domain/encryption-key.ts +26 -0
- package/src/domain/file-owner.ts +16 -1
- package/src/domain/github-action-policies.ts +1 -1
- package/src/domain/github-skill-source.ts +3 -1
- package/src/domain/insights-timing.ts +95 -0
- package/src/domain/insights-usage.ts +67 -0
- package/src/domain/insights.ts +167 -43
- package/src/domain/knowledge-files.ts +10 -3
- package/src/domain/knowledge-messages.ts +1 -0
- package/src/domain/knowledge-preparation.test.ts +276 -0
- package/src/domain/knowledge-preparation.ts +147 -0
- package/src/domain/knowledge-search.test.ts +617 -5
- package/src/domain/knowledge-search.ts +240 -23
- package/src/domain/mcp-account-bindings.ts +169 -0
- package/src/domain/mcp-account-routes.ts +152 -0
- package/src/domain/native-mcp-connection-admission.ts +14 -0
- package/src/domain/organization-integration-catalog.ts +88 -0
- package/src/domain/personal-connection-delegations.ts +399 -257
- package/src/domain/pr-review.ts +24 -8
- package/src/domain/realtime-voice-billing.ts +425 -0
- package/src/domain/resources.ts +50 -4
- package/src/domain/scheduled-task-access.ts +1089 -0
- package/src/domain/scheduled-task-account-audit.ts +90 -0
- package/src/domain/scheduled-task-audience.ts +249 -0
- package/src/domain/scheduled-tasks.ts +1313 -374
- package/src/domain/session-connection-accounts.ts +239 -0
- package/src/domain/session-file-access.ts +47 -0
- package/src/domain/session-native-connection-replacement.ts +64 -0
- package/src/domain/session-start-timing.ts +60 -0
- package/src/domain/session-tool-policy.ts +489 -14
- package/src/domain/sessions.ts +2254 -717
- package/src/domain/site-audience.ts +130 -0
- package/src/domain/skills.ts +9 -0
- package/src/domain/slack-bot.ts +141 -4
- package/src/domain/slack-publication-secret-safety.ts +1 -1
- package/src/domain/vaults/index.ts +19 -0
- package/src/domain/vaults/mapping.ts +190 -0
- package/src/domain/vaults/provider-registry.ts +201 -0
- package/src/domain/vaults/provider-sync.ts +531 -0
- package/src/domain/vaults/provider-writes.ts +288 -0
- package/src/domain/vaults/secret-resolver.ts +464 -0
- package/src/domain/vaults/types.ts +26 -0
- package/src/domain/vaults/vault-service.ts +1316 -0
- package/src/domain/voice-input-billing.ts +330 -0
- package/src/domain/web-search-billing.ts +169 -0
- package/src/domain/workspace-credits.ts +13 -0
- package/src/editable-artifact-live/application.ts +8 -1
- package/src/editable-artifact-live/server.ts +154 -6
- package/src/editable-artifact-live/ticket.ts +86 -1
- package/src/editable-artifact-live/types.ts +10 -0
- package/src/goal-admission.ts +220 -0
- package/src/host-session-usage-limit.ts +25 -0
- package/src/index.ts +75 -11
- package/src/managed-session.ts +137 -6
- package/src/model-call.ts +79 -0
- package/src/model-catalog.ts +345 -91
- package/src/model-provider-credentials.ts +394 -0
- package/src/product-usage-metrics.ts +101 -0
- package/src/rigs/index.ts +23 -111
- package/src/sandbox/fleet.ts +253 -28
- package/src/sandbox/routing.ts +204 -43
- package/src/sandbox/runtime-settings.ts +159 -85
- package/src/session-authorization.ts +172 -23
- package/src/session-usage-limit-metrics.ts +95 -0
- package/src/session-usage-limits.ts +415 -0
- package/src/site-agent-clamp.ts +226 -0
- package/src/site-session-origin.ts +84 -5
- package/src/transcription.ts +123 -4
- package/src/turn-surface.ts +47 -0
- package/src/user-presence.ts +134 -0
- package/src/workflow-wake-contract.ts +14 -1
- package/dist/application/host-mcp-owner.d.ts +0 -6
- package/dist/application/host-mcp-resolvers.d.ts +0 -13
- package/dist/chunk-5WZYFL45.js +0 -266
- package/dist/chunk-5WZYFL45.js.map +0 -1
- package/dist/chunk-H7X52RI2.js.map +0 -1
- package/dist/chunk-OF65T3PM.js.map +0 -1
- package/dist/chunk-VCZFFEPB.js.map +0 -1
- package/dist/chunk-ZYCNLYGH.js.map +0 -1
- package/dist/domain/connection-authority.d.ts +0 -97
- package/dist/domain/connection-authority.js +0 -169
- package/dist/domain/connection-authority.js.map +0 -1
- package/dist/domain/environments.d.ts +0 -33
- package/dist/domain/host-mcp-authority-source-admission.d.ts +0 -10
- package/dist/domain/host-mcp-task-admission.d.ts +0 -18
- package/dist/domain/packs.d.ts +0 -59
- package/dist/domain/product-integration-pack.d.ts +0 -44
- package/dist/domain/product-integration-skill.gen.d.ts +0 -5
- package/dist/remote-mcp-credentials.d.ts +0 -23
- package/dist/remote-mcp-credentials.js +0 -11
- package/dist/remote-mcp-credentials.js.map +0 -1
- package/src/application/host-mcp-owner.ts +0 -41
- package/src/application/host-mcp-resolvers.ts +0 -84
- package/src/domain/connection-authority.ts +0 -329
- package/src/domain/environments.ts +0 -120
- package/src/domain/host-mcp-authority-source-admission.ts +0 -25
- package/src/domain/host-mcp-task-admission.ts +0 -121
- package/src/domain/packs.ts +0 -699
- package/src/domain/product-integration-pack.ts +0 -42
- package/src/domain/product-integration-skill.gen.ts +0 -52
- package/src/remote-mcp-credentials.ts +0 -361
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Settings } from "@opengeni/config";
|
|
2
|
+
import { type AgentConfigCreator, type AgentConfigParent, type AgentConfigRequest, type FirstPartyMcpToolName, type ResolvedAgentCapabilities, type ResolvedAgentConfig, type Session, type SessionToolPolicy, type ToolRef } from "@opengeni/contracts";
|
|
3
|
+
/**
|
|
4
|
+
* Run an agent-config resolution step and surface its typed failure as a 422
|
|
5
|
+
* whose `cause` keeps the `AgentConfigError` (the API renders its code as
|
|
6
|
+
* `details.code`; MCP and Slack keep the plain message).
|
|
7
|
+
*/
|
|
8
|
+
export declare function withAgentConfigHttpErrors<T>(fn: () => T): T;
|
|
9
|
+
/** The current effective capabilities of a null-config session (the conversion/child ceiling). */
|
|
10
|
+
export declare function legacySessionAgentCapabilities(settings: Settings, session: Pick<Session, "firstPartyMcpTools" | "tools" | "toolPolicy">, workspaceSettings: unknown,
|
|
11
|
+
/** The workspace's current omitted-tools default server ids, when known. */
|
|
12
|
+
defaultServerIds?: Iterable<string>): ResolvedAgentCapabilities;
|
|
13
|
+
/** A parent session as a resolution input: its frozen config, or its legacy ceiling. */
|
|
14
|
+
export declare function agentConfigParentFor(settings: Settings, parent: Session, workspaceSettings: unknown): AgentConfigParent;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the frozen agent configuration for a new session. Every creator
|
|
17
|
+
* calls this: `createSessionForRequest` (public API, MCP `session_create`,
|
|
18
|
+
* Slack, drafts), automations, and the scheduled worker. Returns `config:
|
|
19
|
+
* null` for exact legacy behavior.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveSessionAgentConfigForCreate(input: {
|
|
22
|
+
settings: Settings;
|
|
23
|
+
creator: AgentConfigCreator;
|
|
24
|
+
request: AgentConfigRequest | undefined;
|
|
25
|
+
instructions: string | undefined;
|
|
26
|
+
workspaceSettings: unknown;
|
|
27
|
+
parent: Session | null;
|
|
28
|
+
goal: boolean;
|
|
29
|
+
}): {
|
|
30
|
+
config: ResolvedAgentConfig | null;
|
|
31
|
+
instructions: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Write a resolved configuration through to the legacy columns the runtime
|
|
35
|
+
* reads today. `null` returns the inputs unchanged; `"all"` also does.
|
|
36
|
+
*/
|
|
37
|
+
export declare function applySessionAgentConfigWriteThrough(input: {
|
|
38
|
+
config: ResolvedAgentConfig | null;
|
|
39
|
+
firstPartyMcpTools: FirstPartyMcpToolName[];
|
|
40
|
+
explicitFirstPartyMcpTools?: readonly FirstPartyMcpToolName[] | undefined;
|
|
41
|
+
tools: ToolRef[];
|
|
42
|
+
toolPolicy: SessionToolPolicy;
|
|
43
|
+
productServerIds: Iterable<string>;
|
|
44
|
+
explicitServerIds?: Iterable<string> | undefined;
|
|
45
|
+
}): {
|
|
46
|
+
firstPartyMcpTools: FirstPartyMcpToolName[];
|
|
47
|
+
tools: ToolRef[];
|
|
48
|
+
toolPolicy: SessionToolPolicy;
|
|
49
|
+
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { AutomationAcceptedExecution, AutomationNormalizedEvent, AutomationSessionTemplate, type AutomationAdapterId, type AutomationSource, type AutomationTrigger } from "@opengeni/contracts";
|
|
1
|
+
import { AutomationAcceptedExecution, AutomationNormalizedEvent, AutomationSessionTemplate, type AccessGrant, type Permission, type AutomationAdapterId, type AutomationSource, type AutomationTrigger } from "@opengeni/contracts";
|
|
2
|
+
import { type Database } from "@opengeni/db";
|
|
3
|
+
/** Canonical authenticated grant or exact server-owned originating policy only. */
|
|
4
|
+
export declare function automationCredentialRestrictionForGrant(db: Database, grant: AccessGrant): Promise<AutomationSessionTemplate["credentialRestriction"]>;
|
|
5
|
+
/** Explicit delegated scopes must stay within the frozen setup ceiling. */
|
|
6
|
+
export declare function requireAutomationCredentialRestrictionPermissions(restriction: AutomationSessionTemplate["credentialRestriction"], permissions: readonly Permission[]): void;
|
|
2
7
|
export type AutomationAdapterRenderResult = {
|
|
3
8
|
initialMessage: string;
|
|
4
9
|
sessionTemplate: AutomationSessionTemplate;
|
|
@@ -48,4 +53,6 @@ export declare function buildAutomationAcceptedExecution(input: {
|
|
|
48
53
|
eventId: string;
|
|
49
54
|
event: AutomationNormalizedEvent;
|
|
50
55
|
render: AutomationAdapterRenderResult;
|
|
56
|
+
/** Trusted caller restriction from the immutable stored event, not adapter JSON. */
|
|
57
|
+
credentialRestriction?: "developer_setup";
|
|
51
58
|
}): AutomationAcceptedExecution;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { type Settings } from "@opengeni/config";
|
|
2
|
-
import { CapabilityCatalogItem, type AccessGrant, type CapabilityCatalogResponse, type CapabilityInstallation, type CreateCapabilityCatalogItemRequest, type EnableCapabilityRequest, type McpPersonalConnectionDelegation } from "@opengeni/contracts";
|
|
3
|
-
import { type Database, type ApiIntegrationRuntime, type EnabledMcpCapabilityServer } from "@opengeni/db";
|
|
2
|
+
import { CapabilityCatalogItem, OPENGENI_BROWSER_EXTENSION_URL, type AccessGrant, type CapabilityCatalogResponse, type CapabilityInstallation, type CreateCapabilityCatalogItemRequest, type EnableCapabilityRequest, type McpPersonalConnectionDelegation } from "@opengeni/contracts";
|
|
3
|
+
import { type SubscriptionCoreCodexAppsRequestAuth, type CodexCutoverDisposition, type Database, type ApiIntegrationRuntime, type EnabledMcpCapabilityServer } from "@opengeni/db";
|
|
4
4
|
declare const officialMcpRegistryUrl = "https://registry.modelcontextprotocol.io";
|
|
5
5
|
export declare function buildCapabilityCatalog(input: {
|
|
6
6
|
db: Database;
|
|
7
7
|
workspaceId: string;
|
|
8
8
|
settings: Settings;
|
|
9
9
|
subjectId?: string | null;
|
|
10
|
+
/** The workspace's organization, when the caller knows it (skips a lookup). */
|
|
11
|
+
accountId?: string;
|
|
10
12
|
}): Promise<CapabilityCatalogResponse>;
|
|
13
|
+
export declare function applyOperatorOAuthClientRequirement(item: CapabilityCatalogItem, configured: (issuer: string) => boolean): CapabilityCatalogItem;
|
|
11
14
|
export declare function createCatalogItem(input: {
|
|
12
15
|
db: Database;
|
|
13
16
|
accountId: string;
|
|
@@ -23,6 +26,14 @@ type EnableCapabilityInput = {
|
|
|
23
26
|
capabilityId: string;
|
|
24
27
|
payload: EnableCapabilityRequest;
|
|
25
28
|
probeMcpServer?: McpCapabilityProbe;
|
|
29
|
+
/** Server-owned receipt from a just-verified native Connect credential.
|
|
30
|
+
* Never projected into EnableCapabilityRequest or accepted from a client. */
|
|
31
|
+
verifiedConnection?: {
|
|
32
|
+
id: string;
|
|
33
|
+
version: number;
|
|
34
|
+
endpointUrl: string;
|
|
35
|
+
connectivity: Record<string, unknown>;
|
|
36
|
+
};
|
|
26
37
|
};
|
|
27
38
|
export declare function enableCapability(input: EnableCapabilityInput): Promise<CapabilityInstallation>;
|
|
28
39
|
/** Probe outside a durable Connect commit; persist the exact prepared settings
|
|
@@ -33,7 +44,7 @@ export declare function prepareCapabilityEnable(input: EnableCapabilityInput): P
|
|
|
33
44
|
accountId: string;
|
|
34
45
|
workspaceId: string;
|
|
35
46
|
capabilityId: string;
|
|
36
|
-
kind: "api" | "mcp" | "
|
|
47
|
+
kind: "api" | "mcp" | "plugin" | "skill";
|
|
37
48
|
status: "active" | "disabled";
|
|
38
49
|
config: Record<string, unknown>;
|
|
39
50
|
metadata: Record<string, unknown>;
|
|
@@ -47,12 +58,13 @@ export type McpCapabilityProbeInput = {
|
|
|
47
58
|
url: string;
|
|
48
59
|
timeoutMs: number;
|
|
49
60
|
headers?: Record<string, string>;
|
|
61
|
+
settings?: Settings;
|
|
50
62
|
};
|
|
51
63
|
export type McpCapabilityProbeResult = {
|
|
52
64
|
toolCount: number;
|
|
53
65
|
};
|
|
54
66
|
export type McpCapabilityProbe = (input: McpCapabilityProbeInput) => Promise<McpCapabilityProbeResult>;
|
|
55
|
-
export declare function validateMcpCapabilityConnection(item: CapabilityCatalogItem, probe?: McpCapabilityProbe, headers?: Record<string, string
|
|
67
|
+
export declare function validateMcpCapabilityConnection(item: CapabilityCatalogItem, probe?: McpCapabilityProbe, headers?: Record<string, string>, settings?: Settings): Promise<Record<string, unknown>>;
|
|
56
68
|
export declare function disableCapability(input: {
|
|
57
69
|
db: Database;
|
|
58
70
|
accountId: string;
|
|
@@ -64,12 +76,68 @@ export declare function settingsWithEnabledCapabilityMcpServers(db: Database, wo
|
|
|
64
76
|
subjectId?: string;
|
|
65
77
|
personalConnectionDelegations?: readonly McpPersonalConnectionDelegation[];
|
|
66
78
|
onResolvedApiIntegrations?: (integrations: readonly ApiIntegrationRuntime[]) => void;
|
|
79
|
+
/** Every enabled capability server read, before static-id shadowing. */
|
|
80
|
+
onResolvedCapabilityServers?: (servers: readonly EnabledMcpCapabilityServer[]) => void;
|
|
81
|
+
/**
|
|
82
|
+
* The Codex Apps designation the caller already resolves (a claim reads
|
|
83
|
+
* its cutover once), or what it knows for resolving it here.
|
|
84
|
+
*/
|
|
85
|
+
codexApps?: Promise<CodexAppsDesignationForRun | null> | CodexAppsRunContext;
|
|
86
|
+
/**
|
|
87
|
+
* `db` is one bounded transaction: run the reads one after another, since
|
|
88
|
+
* its RLS scopes must not overlap.
|
|
89
|
+
*/
|
|
90
|
+
oneReadAtATime?: boolean;
|
|
91
|
+
}): Promise<Settings>;
|
|
92
|
+
/**
|
|
93
|
+
* `settingsWithEnabledCapabilityMcpServers` for a live target fence: only the
|
|
94
|
+
* rows that can produce `serverIds`. That is the capability installations that
|
|
95
|
+
* produced them at preparation plus any catalog item explicitly claiming one of
|
|
96
|
+
* those ids (shadowing), integrations with exactly those runtime keys (read
|
|
97
|
+
* with the same subject visibility), and the Codex designation only when Codex
|
|
98
|
+
* Apps itself is a target. Static servers come from `settings`, unchanged.
|
|
99
|
+
* Restricted to `serverIds`, the result equals the complete projection.
|
|
100
|
+
*/
|
|
101
|
+
export declare function settingsWithEnabledCapabilityMcpServersForTargets(db: Database, workspaceId: string, settings: Settings, options: {
|
|
102
|
+
subjectId: string;
|
|
103
|
+
accountId: string;
|
|
104
|
+
serverIds: readonly string[];
|
|
105
|
+
capabilityIds: readonly string[];
|
|
106
|
+
onResolvedApiIntegrations?: (integrations: readonly ApiIntegrationRuntime[]) => void;
|
|
107
|
+
/** Checked between reads: a stopped caller starts no further read. */
|
|
108
|
+
signal?: AbortSignal;
|
|
67
109
|
}): Promise<Settings>;
|
|
68
110
|
export declare function apiIntegrationsMatchingDelegations(integrations: readonly ApiIntegrationRuntime[], delegations: readonly McpPersonalConnectionDelegation[]): ApiIntegrationRuntime[];
|
|
69
111
|
export declare function settingsWithApiIntegrationServers(settings: Settings, integrations: readonly ApiIntegrationRuntime[]): Settings;
|
|
70
112
|
/**
|
|
71
|
-
*
|
|
72
|
-
*
|
|
113
|
+
* The workspace's executable Codex Apps designation. Without a Codex cutover
|
|
114
|
+
* row this is the legacy designation (`resolveCodexAppsCredentialIdForRun`).
|
|
115
|
+
* With an enabled cutover it is the core designation, which the database
|
|
116
|
+
* rechecks (designated shared Codex connection, still in the workspace's
|
|
117
|
+
* scope, active). A disabled cutover row designates nothing and reads no
|
|
118
|
+
* legacy Codex table.
|
|
119
|
+
*/
|
|
120
|
+
export type CodexAppsDesignationForRun = {
|
|
121
|
+
source: "core";
|
|
122
|
+
accountId: string;
|
|
123
|
+
connectionId: string;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* What the caller already knows, so the resolver does not read it again: the
|
|
127
|
+
* workspace's organization (skips the workspace lookup) and the organization's
|
|
128
|
+
* Codex cutover disposition (skips the cutover read; a claim has read it).
|
|
129
|
+
*/
|
|
130
|
+
export type CodexAppsRunContext = {
|
|
131
|
+
accountId?: string;
|
|
132
|
+
disposition?: CodexCutoverDisposition | Promise<CodexCutoverDisposition>;
|
|
133
|
+
};
|
|
134
|
+
export declare function resolveCodexAppsDesignationForRun(db: Database, workspaceId: string, known?: CodexAppsRunContext): Promise<CodexAppsDesignationForRun | null>;
|
|
135
|
+
/** Runtime Apps authentication for whichever designation `resolveCodexAppsDesignationForRun` returned. */
|
|
136
|
+
export declare function codexAppsRequestAuthForDesignation(db: Database, settings: Settings, workspaceId: string, designation: CodexAppsDesignationForRun): SubscriptionCoreCodexAppsRequestAuth;
|
|
137
|
+
/**
|
|
138
|
+
* Resolve the legacy executable Apps authority. Organizations with a Codex
|
|
139
|
+
* cutover row (enabled or disabled) have none here: their designation lives
|
|
140
|
+
* on the core (`resolveCodexAppsDesignationForRun`).
|
|
73
141
|
*/
|
|
74
142
|
export declare function resolveCodexAppsCredentialIdForRun(db: Database, workspaceId: string): Promise<string | null>;
|
|
75
143
|
/**
|
|
@@ -101,17 +169,53 @@ export declare function codexAppsCatalogItem(available: boolean): CapabilityCata
|
|
|
101
169
|
* recommend the owning product flow without manufacturing an enabled catalog
|
|
102
170
|
* row for GitHub resources, Documents, schedules, or other platform features.
|
|
103
171
|
*/
|
|
104
|
-
|
|
105
|
-
export declare
|
|
172
|
+
/** The in-chat card id for connecting a person's own computer. */
|
|
173
|
+
export declare const CONNECTED_MACHINE_CAPABILITY_ID = "api:connected-machine";
|
|
174
|
+
export { OPENGENI_BROWSER_EXTENSION_URL };
|
|
175
|
+
export declare function nativeConnectionCapabilityRecommendations(options?: {
|
|
176
|
+
connectedMachines?: boolean;
|
|
177
|
+
}): CapabilityCatalogItem[];
|
|
178
|
+
export declare function applyCapabilityEnablement(item: CapabilityCatalogItem, installation: CapabilityInstallation | undefined): CapabilityCatalogItem;
|
|
106
179
|
export type CapabilityCatalogSearchMatch = {
|
|
107
180
|
item: CapabilityCatalogItem;
|
|
108
181
|
score: number;
|
|
109
182
|
matchedOn: Array<"name" | "provider" | "tag" | "category" | "description" | "id">;
|
|
183
|
+
/**
|
|
184
|
+
* True when the item matched only through the typo-tolerant tier (an edit
|
|
185
|
+
* distance hit), never through an exact, prefix, or substring hit.
|
|
186
|
+
*/
|
|
187
|
+
approximate: boolean;
|
|
188
|
+
};
|
|
189
|
+
export type CapabilityCatalogSuggestion = {
|
|
190
|
+
item: CapabilityCatalogItem;
|
|
191
|
+
/** Name similarity to the query in [0, 1]; 1 means identical once normalized. */
|
|
192
|
+
similarity: number;
|
|
110
193
|
};
|
|
111
194
|
/**
|
|
112
195
|
* Deterministically rank the already-merged workspace catalog for an agent.
|
|
113
196
|
* The caller still owns live authorization checks (GitHub binding, OAuth row,
|
|
114
197
|
* and so on); this function searches metadata only and never probes a provider
|
|
115
198
|
* or exposes credential/setup prose to the model.
|
|
199
|
+
*
|
|
200
|
+
* Exact word, prefix, and substring hits rank first. A typo-tolerant tier
|
|
201
|
+
* (bounded Damerau-Levenshtein on name, provider-domain, and tag words, plus
|
|
202
|
+
* the space-stripped name against the space-stripped query) contributes a
|
|
203
|
+
* smaller score so a one-letter spelling difference still finds the entry.
|
|
116
204
|
*/
|
|
117
205
|
export declare function searchCapabilityCatalogItems(items: readonly CapabilityCatalogItem[], query: string, limit?: number): CapabilityCatalogSearchMatch[];
|
|
206
|
+
/**
|
|
207
|
+
* Closest catalog names for a query that matched nothing. A miss must never
|
|
208
|
+
* read as "this integration does not exist" while the workspace has entries,
|
|
209
|
+
* so callers surface these as explicitly labelled suggestions. An empty
|
|
210
|
+
* (all-punctuation) query returns the first entries by name for browsing.
|
|
211
|
+
*/
|
|
212
|
+
export declare function suggestCapabilityCatalogItems(items: readonly CapabilityCatalogItem[], query: string, limit?: number): CapabilityCatalogSuggestion[];
|
|
213
|
+
/**
|
|
214
|
+
* The vendor domain search may match. A stored providerDomain wins. Workspace
|
|
215
|
+
* and operator entries (manual, configured, built-in) without one fall back to
|
|
216
|
+
* the registrable domain of their endpoint (api.wisprflow.ai -> wisprflow.ai).
|
|
217
|
+
* Registry rows do not: their endpoints may sit on a third-party host. This is
|
|
218
|
+
* a search-only projection and never changes the stored item or any
|
|
219
|
+
* connection/authority matching.
|
|
220
|
+
*/
|
|
221
|
+
export declare function capabilityCatalogSearchProviderDomain(item: CapabilityCatalogItem): string | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTTPException } from "hono/http-exception";
|
|
2
|
+
import { ConnectionAccountSelectionDiagnostic } from "@opengeni/contracts";
|
|
3
|
+
/** An account choice needs attention; retrying the same work cannot fix it. */
|
|
4
|
+
export declare class ConnectionAccountSelectionError extends HTTPException {
|
|
5
|
+
name: string;
|
|
6
|
+
readonly diagnostic: ConnectionAccountSelectionDiagnostic;
|
|
7
|
+
constructor(message: string, diagnostic?: ConnectionAccountSelectionDiagnostic);
|
|
8
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
|
+
import type { Settings } from "@opengeni/config";
|
|
3
|
+
import type { AccessGrant, ConnectorToolPermissionsResponse, UpdateConnectorToolPermissionsRequest, ConnectionMetadata, McpServerConnectionRef, SessionMcpToolPermissionsQuery, SessionMcpToolPermissionsResponse, UpdateSessionMcpToolPermissionsRequest } from "@opengeni/contracts";
|
|
4
|
+
import { type Database } from "@opengeni/db";
|
|
5
|
+
type Input = {
|
|
6
|
+
db: Database;
|
|
7
|
+
settings: Settings;
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
grant: AccessGrant;
|
|
10
|
+
capabilityId: string;
|
|
11
|
+
personalOwnerVerified: boolean;
|
|
12
|
+
connectionId?: string;
|
|
13
|
+
instanceKey?: string;
|
|
14
|
+
};
|
|
15
|
+
type ListedTool = {
|
|
16
|
+
name: string;
|
|
17
|
+
title?: string | undefined;
|
|
18
|
+
description?: string | undefined;
|
|
19
|
+
annotations?: {
|
|
20
|
+
readOnlyHint?: boolean | undefined;
|
|
21
|
+
destructiveHint?: boolean | undefined;
|
|
22
|
+
title?: string | undefined;
|
|
23
|
+
} | undefined;
|
|
24
|
+
_meta?: Record<string, unknown> | undefined;
|
|
25
|
+
};
|
|
26
|
+
export declare function connectorToolGroup(tool: ListedTool): "read" | "write" | "other";
|
|
27
|
+
/** A selector can supply discovery credentials only when one visible account
|
|
28
|
+
* matches. Never apply one account's approval choices to an arbitrary sibling. */
|
|
29
|
+
export declare function unpinnedConnectorToolPermissionAccount<T extends ConnectionMetadata>(ref: McpServerConnectionRef, visible: T[], subjectId: string): T | null;
|
|
30
|
+
export declare function connectorToolPermissionReference(ref: McpServerConnectionRef, connectionId: string): McpServerConnectionRef;
|
|
31
|
+
/** Use the same adapter-owned identities as execution for reviewed local catalogs. */
|
|
32
|
+
export declare function reviewedConnectorToolCatalog(server: Pick<Settings["mcpServers"][number], "url" | "connectionRef" | "allowedTools">, grantedScopes: readonly string[], deployment: Pick<Settings, "gmailWatchTopicName">): ListedTool[] | null;
|
|
33
|
+
/** Collect discovery pages without changing the caller's connection or authority. */
|
|
34
|
+
export declare function collectConnectorToolPages(client: Pick<Client, "listTools">, deadline: AbortSignal): Promise<ListedTool[]>;
|
|
35
|
+
export declare function getConnectorToolPermissions(input: Input): Promise<ConnectorToolPermissionsResponse>;
|
|
36
|
+
export declare function updateConnectorToolPermissions(input: Input & {
|
|
37
|
+
payload: UpdateConnectorToolPermissionsRequest;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Same secret-free identity the runtime derives for a credential-free session MCP server.
|
|
41
|
+
* Keyed to the exact URL: a different URL string gets different rules.
|
|
42
|
+
*/
|
|
43
|
+
export declare function sessionMcpToolPermissionConnectionId(serverId: string, url: string): string;
|
|
44
|
+
type SessionMcpInput = {
|
|
45
|
+
db: Database;
|
|
46
|
+
workspaceId: string;
|
|
47
|
+
grant: AccessGrant;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Saved Allow/Ask/Block choices for a host-attached session MCP server. The
|
|
51
|
+
* host owns the tool catalog; Opengeni owns the rules and enforces them on the
|
|
52
|
+
* next attempt of every session in this workspace that attaches the same
|
|
53
|
+
* server id and exact URL.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getSessionMcpToolPermissions(input: SessionMcpInput & {
|
|
56
|
+
query: SessionMcpToolPermissionsQuery;
|
|
57
|
+
}): Promise<SessionMcpToolPermissionsResponse>;
|
|
58
|
+
/** Agents and service principals cannot change the permissions that bound them. */
|
|
59
|
+
export declare function updateSessionMcpToolPermissions(input: SessionMcpInput & {
|
|
60
|
+
payload: UpdateSessionMcpToolPermissionsRequest;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DirectModelProviderMetadata } from "@opengeni/contracts";
|
|
2
|
+
/** Verify the customer's exact route without persisting their key or test response. */
|
|
3
|
+
export declare function verifyDirectModelAccess(input: DirectModelProviderMetadata, apiKey: string, fetchImpl?: typeof fetch): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DocumentArtifactCommand, type DocumentArtifactQuery, type PresentationArtifactCommand, type PresentationArtifactQuery, type SpreadsheetArtifactCommand, type SpreadsheetArtifactKernelQuery } from "@opengeni/contracts/editable-artifacts";
|
|
2
|
-
import type
|
|
2
|
+
import { type EditableArtifactDurableExportService, type EditableArtifactMaterializationFormat, type EditableArtifactMaterializationJob } from "./durable-export.js";
|
|
3
3
|
import type { EditableArtifactService } from "./service.js";
|
|
4
4
|
import { type EditableArtifact, type EditableArtifactActor, type EditableArtifactClientTransactionId, type EditableArtifactId, type EditableArtifactModality, type EditableArtifactOriginalImport, type EditableArtifactScope, type ImportEditableArtifactRequest } from "./types.js";
|
|
5
5
|
import type { EditableArtifactKernelState } from "./ports.js";
|
|
@@ -30,6 +30,7 @@ export type EditableArtifactAgentContext = Readonly<{
|
|
|
30
30
|
}>;
|
|
31
31
|
export type EditableArtifactAgentMetadata = Readonly<{
|
|
32
32
|
id: string;
|
|
33
|
+
artifactReference: string;
|
|
33
34
|
modality: EditableArtifactModality;
|
|
34
35
|
title: string;
|
|
35
36
|
lifecycle: EditableArtifact["lifecycle"];
|
|
@@ -116,6 +117,12 @@ export type EditableArtifactAgentApplicationDependencies = Readonly<{
|
|
|
116
117
|
exports: EditableArtifactDurableExportService;
|
|
117
118
|
associations: EditableArtifactAgentAssociationPort;
|
|
118
119
|
inspector: EditableArtifactAgentInspectionKernelPort;
|
|
120
|
+
/** Production persists proof only after a successful native query. */
|
|
121
|
+
recordInspection?: (input: EditableArtifactAgentContext & {
|
|
122
|
+
artifact: EditableArtifactAgentMetadata;
|
|
123
|
+
queryHash: string;
|
|
124
|
+
queryKind: string;
|
|
125
|
+
}) => Promise<string>;
|
|
119
126
|
officeImports: EditableArtifactOfficeImportPort;
|
|
120
127
|
workspaceFiles: EditableArtifactAgentWorkspaceFilePort;
|
|
121
128
|
}>;
|
|
@@ -125,6 +132,7 @@ export type EditableArtifactAgentApplicationDependencies = Readonly<{
|
|
|
125
132
|
*/
|
|
126
133
|
export declare class EditableArtifactAgentApplication {
|
|
127
134
|
private readonly dependencies;
|
|
135
|
+
describeExportFormats(): string;
|
|
128
136
|
constructor(dependencies: EditableArtifactAgentApplicationDependencies);
|
|
129
137
|
list(input: EditableArtifactAgentContext & Readonly<{
|
|
130
138
|
limit?: number;
|
|
@@ -151,6 +159,7 @@ export declare class EditableArtifactAgentApplication {
|
|
|
151
159
|
}>): Promise<Readonly<{
|
|
152
160
|
artifact: EditableArtifactAgentMetadata;
|
|
153
161
|
projection: unknown;
|
|
162
|
+
inspectionReceiptId?: string;
|
|
154
163
|
}>>;
|
|
155
164
|
apply(input: EditableArtifactAgentContext & Readonly<{
|
|
156
165
|
artifactId: EditableArtifactId;
|
|
@@ -4,6 +4,17 @@ import { type EditableArtifactActor, type EditableArtifactCausalFrontier, type E
|
|
|
4
4
|
export declare const EDITABLE_ARTIFACT_EXPORT_MAX_DOWNLOAD_BYTES: number;
|
|
5
5
|
export declare const EDITABLE_ARTIFACT_EXPORT_MAX_OPTIONS_BYTES: number;
|
|
6
6
|
export type EditableArtifactMaterializationFormat = "xlsx" | "pptx" | "docx" | "pdf" | "png" | "webp";
|
|
7
|
+
/**
|
|
8
|
+
* Stock production export formats. Custom deployments advertise their own
|
|
9
|
+
* capabilities on the profile port; this list never overrides their resolver.
|
|
10
|
+
* Extend the stock list only together with a real deployed codec.
|
|
11
|
+
*/
|
|
12
|
+
export declare const EDITABLE_ARTIFACT_EXPORT_FORMATS: Readonly<Record<EditableArtifactModality, readonly EditableArtifactMaterializationFormat[]>>;
|
|
13
|
+
/** Human/agent-readable summary of {@link EDITABLE_ARTIFACT_EXPORT_FORMATS}. */
|
|
14
|
+
export declare function describeEditableArtifactExportFormats(): string;
|
|
15
|
+
export declare function describeConfiguredExportFormats(configuredFormats: Readonly<Record<EditableArtifactModality, readonly EditableArtifactMaterializationFormat[]>>): string;
|
|
16
|
+
/** Typed refusal that tells the caller which formats do exist. */
|
|
17
|
+
export declare function unsupportedEditableArtifactExport(modality: EditableArtifactModality, format: string, formats?: Readonly<Record<EditableArtifactModality, readonly EditableArtifactMaterializationFormat[]>>): EditableArtifactDurableExportError;
|
|
7
18
|
export type EditableArtifactMaterializationMimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/pdf" | "image/png" | "image/webp";
|
|
8
19
|
export type EditableArtifactPinnedVersion = Readonly<{
|
|
9
20
|
scope: EditableArtifactScope;
|
|
@@ -58,6 +69,9 @@ export type EditableArtifactMaterializationProfile = Readonly<{
|
|
|
58
69
|
}>;
|
|
59
70
|
/** Server-owned profile lookup. Clients never supply executable identity facts. */
|
|
60
71
|
export interface EditableArtifactMaterializationProfilePort {
|
|
72
|
+
/** Deployment-owned discovery; resolve remains the authority for exact options.
|
|
73
|
+
* Optional for existing custom adapters, whose support is resolved dynamically. */
|
|
74
|
+
supportedFormats?: Readonly<Record<EditableArtifactModality, readonly EditableArtifactMaterializationFormat[]>>;
|
|
61
75
|
resolve(input: Readonly<{
|
|
62
76
|
modality: EditableArtifactModality;
|
|
63
77
|
format: EditableArtifactMaterializationFormat;
|
|
@@ -165,7 +179,7 @@ export type EditableArtifactMaterializationDownload = Readonly<{
|
|
|
165
179
|
export type EditableArtifactDurableExportErrorCode = "invalid_request" | "not_found" | "forbidden" | "conflict" | "unsupported_format" | "not_ready" | "unavailable";
|
|
166
180
|
export declare class EditableArtifactDurableExportError extends Error {
|
|
167
181
|
readonly code: EditableArtifactDurableExportErrorCode;
|
|
168
|
-
constructor(code: EditableArtifactDurableExportErrorCode);
|
|
182
|
+
constructor(code: EditableArtifactDurableExportErrorCode, message?: string);
|
|
169
183
|
}
|
|
170
184
|
export type EditableArtifactDurableExportServiceDependencies = Readonly<{
|
|
171
185
|
authorization: EditableArtifactAuthorizationPort;
|
|
@@ -178,6 +192,13 @@ export type EditableArtifactDurableExportServiceDependencies = Readonly<{
|
|
|
178
192
|
export declare class EditableArtifactDurableExportService {
|
|
179
193
|
private readonly dependencies;
|
|
180
194
|
constructor(dependencies: EditableArtifactDurableExportServiceDependencies);
|
|
195
|
+
describeFormats(): string;
|
|
196
|
+
/** Read-only exact preflight: no snapshot, ID allocation, or store write. */
|
|
197
|
+
preflight(input: {
|
|
198
|
+
modality: EditableArtifactModality;
|
|
199
|
+
format: EditableArtifactMaterializationFormat;
|
|
200
|
+
options?: Readonly<Record<string, unknown>>;
|
|
201
|
+
}): Promise<EditableArtifactMaterializationProfile>;
|
|
181
202
|
pinVersion(input: DurableExportContext & {
|
|
182
203
|
idempotencyKey: string;
|
|
183
204
|
name: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Database } from "@opengeni/db";
|
|
1
2
|
import type { EditableArtifact, EditableArtifactActor, EditableArtifactCausalFrontier, EditableArtifactId, EditableArtifactLiveOutboxRecord, EditableArtifactMutationIntent, EditableArtifactOperationId, EditableArtifactOperationRecord, EditableArtifactOriginOperation, EditableArtifactOriginalImport, EditableArtifactOutboxId, EditableArtifactOutboxRetryFailureCode, EditableArtifactOutboxDeadLetterFailureCode, EditableArtifactPermission, EditableArtifactReceipt, EditableArtifactScope, EditableArtifactSequenceCheckpoint, EditableArtifactSnapshotId, EditableArtifactSnapshotMetadata, EditableArtifactStableId, EditableArtifactStateHash, EditableArtifactTransactionId, EditableArtifactClientTransactionId, EditableArtifactCommittedTransactionRecord, EditableArtifactModality, EditableArtifactRequestHash, EditableArtifactSerialized, EditableArtifactSerializedCommittedTransactionRecord, EditableArtifactSerializedSnapshotMetadata, EditableArtifactSpreadsheet, EditableArtifactSpreadsheetCommittedTransactionRecord, EditableArtifactSpreadsheetSnapshotMetadata, CreateEditableArtifactResult, PublishEditableArtifactSnapshotRequest, ValidatedEditableArtifactMutationIntent } from "./types.js";
|
|
2
3
|
export type EditableArtifactAuthorizationRequest = Readonly<{
|
|
3
4
|
scope: EditableArtifactScope;
|
|
@@ -202,6 +203,8 @@ export type ReadEditableArtifactTransactionBasisRequest = Readonly<{
|
|
|
202
203
|
clientTransactionId: EditableArtifactReceipt["clientTransactionId"];
|
|
203
204
|
previousLocalTransactionId: EditableArtifactReceipt["previousLocalTransactionId"];
|
|
204
205
|
selectiveUndoOperationIds: readonly EditableArtifactOperationId[];
|
|
206
|
+
/** Backend-only live authority; checked transactionally even on receipt replay. */
|
|
207
|
+
authorizeCommit?: EditableArtifactCommitAuthorizer;
|
|
205
208
|
}>;
|
|
206
209
|
export type EditableArtifactTransactionUndoBasis = Readonly<{
|
|
207
210
|
operationId: EditableArtifactOperationId;
|
|
@@ -232,6 +235,12 @@ export type ExpectedEditableArtifactPredecessor = Readonly<{
|
|
|
232
235
|
replicaId: EditableArtifactReceipt["replicaId"];
|
|
233
236
|
replicaCounter: number;
|
|
234
237
|
}>;
|
|
238
|
+
/**
|
|
239
|
+
* Receives the actual persistence transaction, never a separate pool handle.
|
|
240
|
+
* May run repeatedly for replay, lock admission and final persistence; must not
|
|
241
|
+
* perform external mutations. Stores without this transaction capability deny.
|
|
242
|
+
*/
|
|
243
|
+
export type EditableArtifactCommitAuthorizer = (tx: Database) => Promise<void>;
|
|
235
244
|
export type TryCommitAppliedEditableArtifactTransactionRequest = CommitAppliedEditableArtifactTransaction & Readonly<{
|
|
236
245
|
scope: EditableArtifactScope;
|
|
237
246
|
artifactId: EditableArtifactId;
|
|
@@ -239,6 +248,7 @@ export type TryCommitAppliedEditableArtifactTransactionRequest = CommitAppliedEd
|
|
|
239
248
|
expectedAuthorizationRevision: number;
|
|
240
249
|
/** Rechecked by durable production stores in the commit transaction. */
|
|
241
250
|
authorizationActor: EditableArtifactActor;
|
|
251
|
+
authorizeCommit?: EditableArtifactCommitAuthorizer;
|
|
242
252
|
actorKey: string;
|
|
243
253
|
clientTransactionId: EditableArtifactReceipt["clientTransactionId"];
|
|
244
254
|
requestHash: EditableArtifactReceipt["requestHash"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuthoritativeEditableArtifactKernelPort, EditableArtifactAuthorizationPort, EditableArtifactClockPort, EditableArtifactCompactionPort, EditableArtifactGenesisPort, EditableArtifactKernelState, EditableArtifactMutationIntentCodecPort, EditableArtifactSnapshotVerifierPort, EditableArtifactStableIdFactoryPort, EditableArtifactStorePort } from "./ports.js";
|
|
1
|
+
import type { EditableArtifactCommitAuthorizer, AuthoritativeEditableArtifactKernelPort, EditableArtifactAuthorizationPort, EditableArtifactClockPort, EditableArtifactCompactionPort, EditableArtifactGenesisPort, EditableArtifactKernelState, EditableArtifactMutationIntentCodecPort, EditableArtifactSnapshotVerifierPort, EditableArtifactStableIdFactoryPort, EditableArtifactStorePort } from "./ports.js";
|
|
2
2
|
import { type ApplyEditableArtifactTransactionRequest, type ApplyEditableArtifactTransactionResult, type CreateEditableArtifactRequest, type CreateEditableArtifactResult, type ImportEditableArtifactRequest, type EditableArtifact, type EditableArtifactActor, type EditableArtifactClientTransactionId, type EditableArtifactReceipt, type EditableArtifactScope, type EditableArtifactSnapshotMetadata, type PublishEditableArtifactSnapshotRequest } from "./types.js";
|
|
3
3
|
export declare const EDITABLE_ARTIFACT_MAX_OPERATIONS_PER_TRANSACTION = 4096;
|
|
4
4
|
export declare const EDITABLE_ARTIFACT_MAX_UNDO_TARGETS_PER_TRANSACTION: number;
|
|
@@ -80,6 +80,8 @@ export declare class EditableArtifactService {
|
|
|
80
80
|
artifactId: EditableArtifact["id"];
|
|
81
81
|
actor: EditableArtifactActor;
|
|
82
82
|
request: ApplyEditableArtifactTransactionRequest;
|
|
83
|
+
/** Authenticated backend authority, not part of the client mutation envelope. */
|
|
84
|
+
authorizeCommit?: EditableArtifactCommitAuthorizer;
|
|
83
85
|
}): Promise<ApplyEditableArtifactTransactionResult>;
|
|
84
86
|
private applyTransactionOptimistically;
|
|
85
87
|
compactCurrentHead(input: {
|
|
@@ -2,7 +2,7 @@ import type { EditableArtifactMutationIntent as ContractEditableArtifactMutation
|
|
|
2
2
|
/**
|
|
3
3
|
* Domain vocabulary for collaborative, editable Office-like artifacts.
|
|
4
4
|
*
|
|
5
|
-
* This is intentionally unrelated to
|
|
5
|
+
* This is intentionally unrelated to Opengeni's published HTML artifacts and
|
|
6
6
|
* document-ingestion records. An editable artifact is mutable canonical model
|
|
7
7
|
* state plus a causally ordered operation history.
|
|
8
8
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Settings } from "@opengeni/config";
|
|
2
|
+
import { HTTPException } from "hono/http-exception";
|
|
3
|
+
/**
|
|
4
|
+
* The deployment's at-rest encryption key (`OPENGENI_ENVIRONMENTS_ENCRYPTION_KEY`),
|
|
5
|
+
* shared by vault values and stored connection credentials.
|
|
6
|
+
*/
|
|
7
|
+
export declare function requireEnvironmentEncryption(settings: Settings): Uint8Array;
|
|
8
|
+
/**
|
|
9
|
+
* RM-1 for internal callers: Variable Sets were replaced by vaults, so a
|
|
10
|
+
* request that still selects one is refused instead of silently ignored.
|
|
11
|
+
*/
|
|
12
|
+
export declare function variableSetsRemovedError(field: string): HTTPException;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type DatabaseTimingObservation } from "@opengeni/db";
|
|
2
|
+
import type { Observability } from "@opengeni/observability";
|
|
3
|
+
declare const phases: Set<"attached_sessions" | "auth" | "floor_sessions" | "live_warm" | "model_bundle" | "online_machines" | "require_workspace" | "scheduled_fires" | "scheduled_tasks" | "session_depth" | "usage_bundle">;
|
|
4
|
+
export type InsightsPhase = typeof phases extends Set<infer T> ? T : never;
|
|
5
|
+
export type InsightsPhaseObservation = {
|
|
6
|
+
phase: InsightsPhase;
|
|
7
|
+
stage: "helper" | DatabaseTimingObservation["stage"];
|
|
8
|
+
outcome: "completed" | "failed";
|
|
9
|
+
durationMs: number;
|
|
10
|
+
};
|
|
11
|
+
export type InsightsPhaseObserver = (observation: InsightsPhaseObservation) => void;
|
|
12
|
+
/** Helper durations overlap under Promise.all; they must not be summed as request latency. */
|
|
13
|
+
export declare function measureInsightsPhase<T>(observer: InsightsPhaseObserver | undefined, phase: InsightsPhase, work: () => Promise<T>): Promise<T>;
|
|
14
|
+
/** Closed runtime label projection: caller input, SQL and identities never become labels. */
|
|
15
|
+
export declare function workspaceInsightsPhaseMetricObserver(observability: Pick<Observability, "observeHistogram"> | null | undefined): InsightsPhaseObserver | undefined;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InsightsCallsQuery, InsightsCallsResponse, InsightsUsageQuery, InsightsUsageRange, InsightsUsageResponse } from "@opengeni/contracts/insights-usage";
|
|
2
|
+
import { type Database } from "@opengeni/db";
|
|
3
|
+
export type InsightsQueryScope = {
|
|
4
|
+
accountId: string;
|
|
5
|
+
/** null means organization scope; it does not grant workspace/session access. */
|
|
6
|
+
workspaceId: string | null;
|
|
7
|
+
/** Server-verified metadata authority; billing permission alone supplies none. */
|
|
8
|
+
detailsWorkspaceIds?: readonly string[];
|
|
9
|
+
/** Existing organization service-key authority applies only to shared workspaces. */
|
|
10
|
+
detailsSharedWorkspaces?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function getInsightsUsage(db: Database, input: InsightsQueryScope & {
|
|
13
|
+
query: InsightsUsageQuery;
|
|
14
|
+
now?: Date;
|
|
15
|
+
}): Promise<InsightsUsageResponse>;
|
|
16
|
+
export declare function listInsightsCalls(db: Database, input: InsightsQueryScope & {
|
|
17
|
+
query: InsightsCallsQuery;
|
|
18
|
+
now?: Date;
|
|
19
|
+
}): Promise<InsightsCallsResponse>;
|
|
20
|
+
/** UTC windows retain the actual request timestamp, including empty midnight windows. */
|
|
21
|
+
export declare function insightsUsageWindow(range: InsightsUsageRange, now?: Date): {
|
|
22
|
+
since: Date;
|
|
23
|
+
until: Date;
|
|
24
|
+
priorSince: Date;
|
|
25
|
+
priorUntil: Date;
|
|
26
|
+
bucket: "day" | "hour";
|
|
27
|
+
};
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { type Settings } from "@opengeni/config";
|
|
2
2
|
import { type InsightsRange, type WorkspaceInsightsResponse } from "@opengeni/contracts";
|
|
3
3
|
import { type Database } from "@opengeni/db";
|
|
4
|
+
import { type InsightsPhaseObserver } from "./insights-timing.js";
|
|
5
|
+
export { measureInsightsPhase, workspaceInsightsPhaseMetricObserver } from "./insights-timing.js";
|
|
6
|
+
export type { InsightsPhaseObservation, InsightsPhaseObserver } from "./insights-timing.js";
|
|
4
7
|
export declare const WORKSPACE_INSIGHTS_PROVIDER_FILTER_MAX_UTF8_BYTES = 256;
|
|
5
8
|
export declare const WORKSPACE_INSIGHTS_MODEL_FILTER_MAX_UTF8_BYTES = 512;
|
|
6
|
-
export type WorkspaceInsightsFilterField = "provider" | "model";
|
|
9
|
+
export type WorkspaceInsightsFilterField = "provider" | "model" | "rootSessionId" | "sessionId";
|
|
7
10
|
export declare class WorkspaceInsightsFilterValidationError extends Error {
|
|
8
11
|
readonly field: WorkspaceInsightsFilterField;
|
|
9
12
|
readonly maxUtf8Bytes: number;
|
|
10
|
-
constructor(field: WorkspaceInsightsFilterField, maxUtf8Bytes: number);
|
|
13
|
+
constructor(field: WorkspaceInsightsFilterField, maxUtf8Bytes: number, message?: string);
|
|
11
14
|
}
|
|
15
|
+
/** Normalize a session drilldown scope; only exact UUIDs are accepted. */
|
|
16
|
+
export declare function normalizeWorkspaceInsightsSessionScope(value: string | null | undefined, field: "rootSessionId" | "sessionId"): string | null;
|
|
12
17
|
/** Normalize the public filter sentinel and enforce the database authority envelope. */
|
|
13
18
|
export declare function normalizeWorkspaceInsightsFilter(value: string | null | undefined, field: WorkspaceInsightsFilterField): string | null;
|
|
14
19
|
export type GetWorkspaceInsightsInput = {
|
|
@@ -16,6 +21,14 @@ export type GetWorkspaceInsightsInput = {
|
|
|
16
21
|
range: InsightsRange;
|
|
17
22
|
provider?: string | null;
|
|
18
23
|
model?: string | null;
|
|
24
|
+
rootSessionId?: string | null;
|
|
25
|
+
sessionId?: string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the reading person, only once the rollup runs. The per-schedule
|
|
28
|
+
* list leaves out other people's Only me schedules; their usage stays in the
|
|
29
|
+
* per-person private totals.
|
|
30
|
+
*/
|
|
31
|
+
viewerSubjectId?: () => Promise<string | null>;
|
|
19
32
|
now?: Date;
|
|
20
33
|
};
|
|
21
34
|
export declare function insightsSessionLabel(input: {
|
|
@@ -23,4 +36,9 @@ export declare function insightsSessionLabel(input: {
|
|
|
23
36
|
title: string | null;
|
|
24
37
|
depth?: number | null;
|
|
25
38
|
}): string;
|
|
26
|
-
export declare function
|
|
39
|
+
export declare function insightsProjectLabel(input: {
|
|
40
|
+
kind: "project" | "other" | "unfiled" | "unavailable" | "deleted";
|
|
41
|
+
name: string | null;
|
|
42
|
+
projects: number;
|
|
43
|
+
}): string;
|
|
44
|
+
export declare function getWorkspaceInsights(db: Database, settings: Settings, input: GetWorkspaceInsightsInput, observePhase?: InsightsPhaseObserver): Promise<WorkspaceInsightsResponse>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type KnowledgeContext } from "@opengeni/db";
|
|
2
2
|
import type { ApiRouteDeps } from "../dependencies.js";
|
|
3
3
|
/** Existing original -> one source revision, through the ordinary task policy. */
|
|
4
|
-
export declare function prepareKnowledgeFile(deps: Pick<ApiRouteDeps, "db" | "objectStorage" | "getDocumentServices">, context: KnowledgeContext, fileId: string): Promise<{
|
|
4
|
+
export declare function prepareKnowledgeFile(deps: Pick<ApiRouteDeps, "db" | "objectStorage" | "getDocumentServices">, context: KnowledgeContext, fileId: string, purpose?: "evidence" | "reference"): Promise<{
|
|
5
5
|
status: "retained";
|
|
6
6
|
fileId: string;
|
|
7
7
|
filename: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KnowledgeSavePreparationRequest, type KnowledgeSavePreparationResponse } from "@opengeni/contracts";
|
|
2
|
+
import { getKnowledgeEntry, listKnowledgeEntries, type Database, type KnowledgeContext } from "@opengeni/db";
|
|
3
|
+
import type { DocumentEmbedder } from "@opengeni/documents";
|
|
4
|
+
import type { Settings } from "@opengeni/config";
|
|
5
|
+
import { searchKnowledgeEntries } from "./knowledge-search.js";
|
|
6
|
+
export declare function prepareKnowledgeSave(db: Database, context: KnowledgeContext, input: KnowledgeSavePreparationRequest, embedder: () => DocumentEmbedder, services?: {
|
|
7
|
+
get: typeof getKnowledgeEntry;
|
|
8
|
+
list: typeof listKnowledgeEntries;
|
|
9
|
+
search: typeof searchKnowledgeEntries;
|
|
10
|
+
}, settings?: Settings): Promise<KnowledgeSavePreparationResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|