@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
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# @opengeni/core
|
|
2
2
|
|
|
3
|
-
`@opengeni/core` is the extracted
|
|
3
|
+
`@opengeni/core` is the extracted Opengeni server core: domain flows, access checks, billing/admission helpers, sandbox fleet/routing helpers, and the shared dependency types that HTTP routes and embedded hosts use.
|
|
4
4
|
|
|
5
5
|
It owns code that is not intrinsically HTTP or Temporal process bootstrapping:
|
|
6
6
|
|
|
7
7
|
- access: `requireAccessContext`, `requireAccessGrant`, `requirePermission`
|
|
8
|
-
- domain: session creation/follow-up, scheduled-task validation, environments,
|
|
8
|
+
- domain: session creation/follow-up, scheduled-task validation, environments, capabilities, workspace members
|
|
9
9
|
- billing/admission: `checkLimit`, `requireLimit`, `recordWorkspaceUsage`
|
|
10
10
|
- dependencies: `AppDependencies`, `ApiRouteDeps`, `SessionWorkflowClient`
|
|
11
11
|
|
|
12
12
|
`@opengeni/api-router` owns the Hono app, middleware, HTTP route adapters, MCP HTTP transport, and API-direct sandbox endpoints. `@opengeni/worker-bundle` owns Temporal worker construction, workflows, activities, and process lifecycle. Both consume `@opengeni/core`; core does not import either app.
|
|
13
13
|
|
|
14
|
-
The package is used by standalone
|
|
14
|
+
The package is used by standalone Opengeni through those app runners and by embedded hosts that call core directly or mount the API router.
|
|
15
15
|
|
|
16
16
|
## Scope honesty: engine-core, not domain-core
|
|
17
17
|
|
|
@@ -19,5 +19,5 @@ This package is the **engine core** — the transport-mostly-neutral heart of th
|
|
|
19
19
|
server, extracted so embedders can mount it. It still carries server-flavored
|
|
20
20
|
dependencies (notably Hono's `HTTPException` as the domain error type and the
|
|
21
21
|
full persistence/runtime closure). It is NOT a pure domain library and does not
|
|
22
|
-
try to be one; if you need
|
|
22
|
+
try to be one; if you need Opengeni without any server runtime, you want the
|
|
23
23
|
REST API + `@opengeni/sdk` instead.
|
package/dist/access/index.d.ts
CHANGED
|
@@ -1,15 +1,101 @@
|
|
|
1
1
|
import { type Settings } from "@opengeni/config";
|
|
2
2
|
import { ExternalActorAttribution, type ExternalActorContinuation } from "@opengeni/contracts/external-identities";
|
|
3
|
-
import { type AccountGrant, type AccessContext, type AccessGrant, Permission, type Workspace } from "@opengeni/contracts";
|
|
3
|
+
import { type AccountGrant, type AccessContext, type AccessGrant, type OrganizationApiKeyAccess, OrganizationWorkspaceScope, Permission, type Workspace } from "@opengeni/contracts";
|
|
4
4
|
import { type Database } from "@opengeni/db";
|
|
5
5
|
import type { Context } from "hono";
|
|
6
|
+
import { z } from "zod";
|
|
6
7
|
import type { ManagedAuth } from "../managed-auth-type.js";
|
|
7
8
|
import type { ManagedAuthSessionAdapter } from "../managed-auth-session-sets.js";
|
|
9
|
+
import type { UserPresenceRecorder } from "../user-presence.js";
|
|
10
|
+
/** Only canonical authentication can prove setup-key provenance. */
|
|
11
|
+
export declare function isDeveloperSetupApiKeyContext(context: AccessContext): boolean;
|
|
12
|
+
/** Provenance from canonical raw-key or verified restricted-token authentication. */
|
|
13
|
+
export declare function isDeveloperSetupAuthorization(authorization: AccessGrantAuthorization | undefined): boolean;
|
|
14
|
+
/** Exact grant objects resolved under authenticated setup-only provenance. */
|
|
15
|
+
export declare function isDeveloperSetupGrant(grant: AccessGrant): boolean;
|
|
16
|
+
/** Setup-derived credentials cannot carry literal organization or key authority. */
|
|
17
|
+
export declare function isDeveloperSetupDelegatedPermissionAllowed(permission: Permission): boolean;
|
|
18
|
+
/** Canonical authentication provenance, including the backing key of asUser. */
|
|
19
|
+
export declare function requireApiKeyManagementContext(context: AccessContext): void;
|
|
20
|
+
/** Membership is not an escape hatch for minting durable credentials. */
|
|
21
|
+
export declare function requireApiKeyDelegationContext(context: AccessContext, permissions: Permission[]): void;
|
|
22
|
+
/** Downstream legacy credentials cannot encode a partially selected admin. */
|
|
23
|
+
export declare function requireExplicitPermissionDelegation(grant: Pick<AccessGrant, "permissions" | "permissionMode">, requested: Permission[]): void;
|
|
24
|
+
export type DelegatedHumanAuthorization = Readonly<{
|
|
25
|
+
organizationId: string;
|
|
26
|
+
/** Exact native person subject, never an external identity or service. */
|
|
27
|
+
subjectId: string;
|
|
28
|
+
permissions: Permission[];
|
|
29
|
+
workspaceScope: OrganizationWorkspaceScope;
|
|
30
|
+
}>;
|
|
31
|
+
declare const delegatedHumanProfileSchema: z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
name: z.ZodNullable<z.ZodString>;
|
|
34
|
+
email: z.ZodString;
|
|
35
|
+
emailVerified: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type VerifiedDelegatedHumanContext = Readonly<{
|
|
38
|
+
/** Native identity projection only, never a browser/auth session. Absence of
|
|
39
|
+
* emailVerified means the native lookup did not prove email verification. */
|
|
40
|
+
user: Readonly<z.infer<typeof delegatedHumanProfileSchema>>;
|
|
41
|
+
subjectId: string;
|
|
42
|
+
authorization: DelegatedHumanAuthorization;
|
|
43
|
+
context: AccessContext;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* TRUSTED OAUTH VERIFIED DISPATCH ONLY. Before each stamp the in-process caller
|
|
47
|
+
* must validate the live OAuth grant, revocation, exact native person subject,
|
|
48
|
+
* organization, permission ceilings and workspace scope. This API does not
|
|
49
|
+
* verify OAuth and must NEVER be called with headers, metadata, token claims,
|
|
50
|
+
* a previous request's proof, or other unverified caller input.
|
|
51
|
+
*
|
|
52
|
+
* Stamp the exact raw Request that the actions dispatcher will pass to routes,
|
|
53
|
+
* before any access resolution. Cloning/wrapping a Request does not copy proof.
|
|
54
|
+
* The resolver reloads the real native person's live access on this request
|
|
55
|
+
* (and on fresh reauthorization); no session or cached grant is fabricated or
|
|
56
|
+
* transplanted. This proof never becomes managed-cookie/person-present proof.
|
|
57
|
+
*/
|
|
58
|
+
export declare function stampDelegatedHumanAuthorization(request: Request, input: DelegatedHumanAuthorization): void;
|
|
59
|
+
/** Token prefix of personal API keys, which act as the person who made them. */
|
|
60
|
+
export declare const PERSONAL_API_KEY_TOKEN_PREFIX = "ogp_";
|
|
61
|
+
/**
|
|
62
|
+
* A personal API key acts as its owner. Call once per incoming request, after
|
|
63
|
+
* any middleware that may rebuild the Request and before access resolution:
|
|
64
|
+
* an active personal key stamps this exact raw Request with its owner and
|
|
65
|
+
* access setting, so the request resolves through the same live-access path as
|
|
66
|
+
* a person's signed-in agent (their current membership, role and workspaces,
|
|
67
|
+
* capped by the key) and routes treat it as that person. Anything else is left
|
|
68
|
+
* to the ordinary resolver, which refuses an unknown or revoked key.
|
|
69
|
+
*/
|
|
70
|
+
export declare function stampPersonalApiKeyRequest(request: Request, deps: Pick<AccessDeps, "db">): Promise<boolean>;
|
|
71
|
+
/** Immutable verified dispatch bounds for this exact raw Request, not a grant. */
|
|
72
|
+
export declare function verifiedDelegatedHumanAuthorizationForRequest(request: Request): DelegatedHumanAuthorization | null;
|
|
73
|
+
/**
|
|
74
|
+
* Resolve the exact verified OAuth-dispatch person and constrained live native
|
|
75
|
+
* access for this raw Request. Unstamped requests (even browser cookies) fail
|
|
76
|
+
* closed; callers must not fall back to a service or subject-shaped identity.
|
|
77
|
+
* Uses the same request-local native resolution as requireAccessContext.
|
|
78
|
+
*
|
|
79
|
+
* No session, session id or managed-cookie proof is created. emailVerified is
|
|
80
|
+
* forwarded only when the native profile lookup supplies it; missing is not
|
|
81
|
+
* verified and must never be filled from OAuth claims, headers or metadata.
|
|
82
|
+
*/
|
|
83
|
+
export declare function requireVerifiedDelegatedHumanContext(c: Context, deps: AccessDeps): Promise<VerifiedDelegatedHumanContext>;
|
|
84
|
+
/** Exact resolved owning-person authorization; clones and service claims fail.
|
|
85
|
+
* Supplying the raw Request additionally binds proof to that exact dispatch,
|
|
86
|
+
* not another request with the same native person and authorization bounds. */
|
|
87
|
+
export declare function isVerifiedDelegatedHumanAuthorization(authorization: AccessGrantAuthorization, request?: Request): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Default permissions for a membership created on an external user's first
|
|
90
|
+
* request. Keep equal to `CONVERSATION_PERMISSIONS` in
|
|
91
|
+
* `packages/sdk/src/tenant-workspaces.ts`: conversation use only, no admin.
|
|
92
|
+
*/
|
|
93
|
+
export declare const EXTERNAL_FIRST_USE_MEMBER_PERMISSIONS: readonly Permission[];
|
|
8
94
|
/** Creation audit only, never an authentication or delegation token. Metadata
|
|
9
95
|
* claiming to be external is insufficient; the exact resolver proof is needed. */
|
|
10
96
|
export declare function externalAttributionForAuthorization(authorization: AccessGrantAuthorization | undefined, grant: AccessGrant): ExternalActorAttribution | null;
|
|
11
97
|
export declare function externalActorContinuationForAuthorization(authorization: AccessGrantAuthorization): ExternalActorContinuation | null;
|
|
12
|
-
/** Dedicated owning-user proof. External admission never sets the native
|
|
98
|
+
/** Dedicated owning-user proof. External/OAuth admission never sets the native
|
|
13
99
|
* cookie stamp. The resource/session layer still checks the exact owner. */
|
|
14
100
|
export declare function hasVerifiedOwningUserAuthorization(authorization: AccessGrantAuthorization): boolean;
|
|
15
101
|
/** Request-local organization service-key proof, not a principal-kind claim. */
|
|
@@ -17,13 +103,18 @@ export declare function isVerifiedOrganizationServiceAuthorization(authorization
|
|
|
17
103
|
export type AccountScopedApiKeyWorkspaceAuthority = Readonly<{
|
|
18
104
|
accountId: string;
|
|
19
105
|
permissions: Permission[];
|
|
106
|
+
workspaceScope: OrganizationWorkspaceScope;
|
|
107
|
+
permissionMode: "legacy" | "explicit";
|
|
20
108
|
}>;
|
|
109
|
+
export declare function organizationWorkspaceInScope(scope: OrganizationWorkspaceScope, workspaceId: string): boolean;
|
|
21
110
|
/**
|
|
22
111
|
* Return account-scoped API-key workspace authority only for the exact
|
|
23
112
|
* AccessContext object stamped by successful API-key authentication. Subject
|
|
24
113
|
* shape alone is deliberately insufficient.
|
|
25
114
|
*/
|
|
26
115
|
export declare function accountScopedApiKeyWorkspaceAuthority(context: AccessContext): AccountScopedApiKeyWorkspaceAuthority | null;
|
|
116
|
+
/** Classify stored scopes without changing the legacy full/read permission sets. */
|
|
117
|
+
export declare function organizationApiKeyAccess(permissions: Permission[]): OrganizationApiKeyAccess;
|
|
27
118
|
/**
|
|
28
119
|
* Opaque, request-local proof that the canonical access resolver authorized the
|
|
29
120
|
* exact account administrator named by the stamp. The random id is audit and
|
|
@@ -41,6 +132,8 @@ export type AccessDeps = {
|
|
|
41
132
|
settings: Settings;
|
|
42
133
|
managedAuth?: ManagedAuth | null;
|
|
43
134
|
managedAuthSessionAdapter?: ManagedAuthSessionAdapter | null;
|
|
135
|
+
/** Analytics only: notes canonical managed-cookie activity, never authority. */
|
|
136
|
+
userPresence?: UserPresenceRecorder | null;
|
|
44
137
|
};
|
|
45
138
|
/** null means this is not an authenticated external lane; [] means that lane
|
|
46
139
|
* has no readable inventory. Callers must not fall back from [] to service or
|
|
@@ -62,8 +155,9 @@ export type AccessGrantAuthorization = {
|
|
|
62
155
|
contextIntegrity: boolean;
|
|
63
156
|
/**
|
|
64
157
|
* Did this request authenticate as the canonical managed-cookie (Better Auth)
|
|
65
|
-
* session that OWNS this grant's subject?
|
|
66
|
-
*
|
|
158
|
+
* session that OWNS this grant's subject? Cookie/person-present ceremonies
|
|
159
|
+
* retain this strict gate; owning-user boundaries use
|
|
160
|
+
* `hasVerifiedOwningUserAuthorization` instead.
|
|
67
161
|
* False for every bearer, API-key, delegated, service, local, and configured
|
|
68
162
|
* principal, and for any future path that does not verify a cookie.
|
|
69
163
|
*/
|
|
@@ -107,11 +201,40 @@ export declare function requireCanonicalLocalAccountAdministrator(c: Context, de
|
|
|
107
201
|
export declare function requireAccessGrantAuthorization(c: Context, deps: AccessDeps, workspaceId: string, permission?: Permission): Promise<AccessGrantAuthorization>;
|
|
108
202
|
/**
|
|
109
203
|
* Settings administration is narrower than workspace administration. The
|
|
110
|
-
*
|
|
204
|
+
* verified owning user may configure their Personal workspace, but
|
|
111
205
|
* never acquires the admin wildcard (and its membership/delegation powers).
|
|
206
|
+
* Delegated owners also need workspace:admin in their verified dispatch/key
|
|
207
|
+
* ceiling: a read-only delegation cannot turn ownership into a settings write.
|
|
112
208
|
* Only use this boundary for workspace configuration, not access management.
|
|
113
209
|
*/
|
|
114
210
|
export declare function requireWorkspaceSettingsGrant(c: Context, deps: AccessDeps, workspaceId: string): Promise<AccessGrant>;
|
|
211
|
+
/**
|
|
212
|
+
* Authority for a shared workspace's own Members surface (list, candidates,
|
|
213
|
+
* add, change, remove). A holder of the requested workspace permission keeps
|
|
214
|
+
* the ordinary grant. Otherwise an active organization owner or administrator,
|
|
215
|
+
* authenticated by the canonical managed cookie, manages any shared workspace
|
|
216
|
+
* in their organization exactly as through the organization control plane,
|
|
217
|
+
* with or without an operational membership row there. Every other principal
|
|
218
|
+
* (API keys, delegated bearers, agents, services, local/configured access)
|
|
219
|
+
* and every Personal workspace keeps the original refusal. The database
|
|
220
|
+
* functions re-derive the organization role under the organization fence.
|
|
221
|
+
*/
|
|
222
|
+
export declare function requireWorkspaceMemberManagementAuthority(c: Context, deps: AccessDeps, workspaceId: string, permission: "members:manage" | "workspace:read"): Promise<{
|
|
223
|
+
grant: AccessGrant;
|
|
224
|
+
organizationAdministrator: boolean;
|
|
225
|
+
}>;
|
|
226
|
+
/**
|
|
227
|
+
* The subject whose inbox this request may read, or null when it has none.
|
|
228
|
+
* A signed-in person (`user:`, no key) requires verified managed-human
|
|
229
|
+
* provenance, including approved native app credentials. The local
|
|
230
|
+
* install's human qualifies only when the in-process local bootstrap produced
|
|
231
|
+
* this context (so a delegated bearer naming `dev` cannot borrow it), with the
|
|
232
|
+
* human-session, non-delegated, non-service, keyless shape of
|
|
233
|
+
* {@link accessContextHasInbox}. An agent acting as a person (verified
|
|
234
|
+
* in-process dispatch) reads that person's inbox within its organization and
|
|
235
|
+
* workspaces: the inbox routes check each item's workspace on this context.
|
|
236
|
+
*/
|
|
237
|
+
export declare function inboxSubjectForContext(context: AccessContext): string | null;
|
|
115
238
|
export declare function requirePermission(grant: AccessGrant, permission: Permission): void;
|
|
116
239
|
/**
|
|
117
240
|
* Require a permission to be present literally on the grant. This deliberately
|
|
@@ -120,5 +243,6 @@ export declare function requirePermission(grant: AccessGrant, permission: Permis
|
|
|
120
243
|
* acquire implicitly.
|
|
121
244
|
*/
|
|
122
245
|
export declare function requireLiteralPermission(grant: AccessGrant, permission: Permission): void;
|
|
123
|
-
export declare function hasLiteralPermission(permissions: Permission[], permission: Permission): boolean;
|
|
124
|
-
export declare function hasPermission(permissions: Permission[], permission: Permission): boolean;
|
|
246
|
+
export declare function hasLiteralPermission(permissions: readonly Permission[], permission: Permission): boolean;
|
|
247
|
+
export declare function hasPermission(permissions: readonly Permission[], permission: Permission, permissionMode?: AccessGrant["permissionMode"]): boolean;
|
|
248
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type AccessGrant } from "@opengeni/contracts";
|
|
2
|
+
/** Validated provenance only. The API key remains the authenticated principal. */
|
|
3
|
+
export declare function serviceInitiatorFromHeaders(headers: Headers): Pick<AccessGrant, "serviceInitiator" | "serviceInitiatorContext"> | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AppendArchivedSessionEventsResponse, ImportArchivedSessionResponse } from "@opengeni/contracts";
|
|
2
|
+
import { type AccessGrantAuthorization } from "../access/index.js";
|
|
3
|
+
import type { ApiRouteDeps } from "../dependencies.js";
|
|
4
|
+
export { ArchivedSessionImportError } from "@opengeni/db";
|
|
5
|
+
export declare function importArchivedSessionForRequest(deps: ApiRouteDeps, authorization: AccessGrantAuthorization, workspaceId: string, rawPayload: unknown): Promise<ImportArchivedSessionResponse>;
|
|
6
|
+
export declare function appendArchivedSessionEventsForRequest(deps: ApiRouteDeps, authorization: AccessGrantAuthorization, workspaceId: string, importId: string, rawPayload: unknown): Promise<AppendArchivedSessionEventsResponse>;
|
|
@@ -18,7 +18,7 @@ export type SubmitComposerDraftForRequestOptions = {
|
|
|
18
18
|
* This is the application boundary shared by the stock HTTP adapter and an
|
|
19
19
|
* in-process embedding host. A host may prepare its own durable business state
|
|
20
20
|
* before calling this function and project the returned receipt afterward, but
|
|
21
|
-
*
|
|
21
|
+
* Opengeni remains the sole authority for draft validation/rotation, event
|
|
22
22
|
* append, turn creation, routing, and idempotent replay.
|
|
23
23
|
*/
|
|
24
24
|
export declare function submitComposerDraftForRequest(deps: AcceptSessionUserMessageDependencies, grant: AccessGrant, workspaceId: string, sessionId: string, input: SubmitComposerDraftRequest, options?: SubmitComposerDraftForRequestOptions): Promise<SubmitComposerDraftResponse>;
|
|
@@ -23,6 +23,12 @@ export declare function executeConnectOperation(input: {
|
|
|
23
23
|
operationId: string;
|
|
24
24
|
/** Caller computes a stable keyed digest if input contains low-entropy secrets. */
|
|
25
25
|
inputDigest: string;
|
|
26
|
+
/** Trusted server adapter classification, never derived from request data.
|
|
27
|
+
* Cancellation releases pending setup; it acquires no integration authority. */
|
|
28
|
+
purpose?: "acquisition" | "cancellation";
|
|
29
|
+
/** Trusted adapter's exact attempt fence, inside the organization policy
|
|
30
|
+
* prefix and before Connect row locks, for both claim and final commit. */
|
|
31
|
+
beforeOperation?: ((tx: Database) => Promise<void>) | undefined;
|
|
26
32
|
authorize: ConnectOperationAuthorization;
|
|
27
33
|
execute: (attempt: ConnectAttempt) => Promise<PreparedConnectOperation>;
|
|
28
34
|
}): Promise<ConnectAttempt>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Context } from "hono";
|
|
2
2
|
import { type ExternalIdentity } from "@opengeni/contracts/external-identities";
|
|
3
3
|
import { type AccessDeps } from "../access/index.js";
|
|
4
|
-
/** Explicit host onboarding. Ordinary asUser
|
|
4
|
+
/** Explicit host onboarding. Ordinary asUser requests never call this
|
|
5
|
+
* operation; their first-use membership is `provisionExternalMemberOnFirstUse`
|
|
6
|
+
* in `../access`, under the same key authority and lifecycle fence.
|
|
5
7
|
* Existing memberships are not overwritten, including reduced permissions. */
|
|
6
8
|
export declare function addExternalWorkspaceMemberForRequest(c: Context, deps: AccessDeps, workspaceId: string, input: unknown): Promise<ExternalIdentity>;
|
|
7
9
|
export declare function lookupExternalIdentityForRequest(c: Context, deps: AccessDeps, organizationId: string, input: unknown): Promise<{
|
|
@@ -20,3 +22,13 @@ export declare function cancelExternalWorkspaceMemberGrantForRequest(c: Context,
|
|
|
20
22
|
replay: boolean;
|
|
21
23
|
fencedGrantOperationId: string;
|
|
22
24
|
}>;
|
|
25
|
+
/** Keyed permission change for an existing external member. Widening only
|
|
26
|
+
* rewrites the set; narrowing also advances the member's authorization
|
|
27
|
+
* revision so live authority re-checks. Never cancels or tears down work. */
|
|
28
|
+
export declare function updateExternalWorkspaceMemberForRequest(c: Context, deps: AccessDeps, organizationId: string, workspaceId: string, membershipId: string, input: unknown): Promise<{
|
|
29
|
+
subjectId: string;
|
|
30
|
+
organizationMembershipId: string;
|
|
31
|
+
permissions: ("account:admin" | "account:read" | "api_keys:manage" | "artifacts:publish" | "artifacts:read" | "billing:manage" | "billing:read" | "capabilities:manage" | "codemode:call" | "connections:read" | "connections:write" | "documents:manage" | "documents:search" | "enrollments:manage" | "enrollments:read" | "environments:manage" | "environments:use" | "files:read" | "files:upload" | "files:write" | "github:manage" | "github:use" | "goals:manage" | "mcp_servers:attach" | "members:manage" | "rigs:manage" | "rigs:use" | "scheduled_tasks:manage" | "scheduled_tasks:run" | "secrets:list" | "secrets:read" | "secrets:use" | "secrets:write" | "sessions:control" | "sessions:create" | "sessions:read" | "stream:acknowledge" | "stream:control" | "stream:view" | "terminal:attach" | "usage_allowances:manage" | "variable-sets:attach" | "variable-sets:list" | "variable-sets:manage" | "variable-sets:read" | "variable-sets:use" | "variable-sets:write" | "workspace:admin" | "workspace:create" | "workspace:read")[];
|
|
32
|
+
narrowed: boolean;
|
|
33
|
+
replay: boolean;
|
|
34
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Settings } from "@opengeni/config";
|
|
2
|
+
import { ModalNativePreparationDeclarationV2 } from "@opengeni/contracts/modal-native-proof-v2";
|
|
3
|
+
import { type Database, type ModalNativeLiveOriginProjection, type ModalNativeLiveOriginResult } from "@opengeni/db";
|
|
4
|
+
import { type NativeOriginalConfigurationSample } from "./modal-native-original-configuration.js";
|
|
5
|
+
type JoinSettings = Pick<Settings, "delegationSecret" | "modalTokenId" | "modalTokenSecret" | "modalEnvironment" | "environmentsEncryptionKey">;
|
|
6
|
+
/** Sensitive request-local data only. Do not publish/log/cache across commit.
|
|
7
|
+
* The sample contains immutable credential strings which disposal cannot erase.
|
|
8
|
+
* This result has no native-I/O, replay, custody or effect authority. */
|
|
9
|
+
export type NativeLiveDeclarationJoin = Readonly<{
|
|
10
|
+
requestId: string;
|
|
11
|
+
declaration: ModalNativePreparationDeclarationV2;
|
|
12
|
+
projection: ModalNativeLiveOriginProjection;
|
|
13
|
+
configuration: NativeOriginalConfigurationSample;
|
|
14
|
+
}>;
|
|
15
|
+
export type NativeLiveDeclarationJoinResult = {
|
|
16
|
+
kind: "joined_data";
|
|
17
|
+
data: NativeLiveDeclarationJoin;
|
|
18
|
+
} | {
|
|
19
|
+
kind: "off";
|
|
20
|
+
} | {
|
|
21
|
+
kind: "refused";
|
|
22
|
+
} | Exclude<ModalNativeLiveOriginResult, {
|
|
23
|
+
kind: "live";
|
|
24
|
+
}>;
|
|
25
|
+
/** Own bytes BEFORE either verifying or parsing. After the blocking SQL join,
|
|
26
|
+
* re-read the explicit CURRENT deployment root/profile and reverify current
|
|
27
|
+
* expiry over those SAME owned bytes. A historical MAC witness is insufficient.
|
|
28
|
+
* No tenant/subject GUC change, general access-token resolver, provider await,
|
|
29
|
+
* fallback, registration or error-to-success conversion occurs here.
|
|
30
|
+
*
|
|
31
|
+
* Input execution/human fields are signed CORRELATION, not caller authority:
|
|
32
|
+
* compare them to the exact DB-derived accepted original projection. This does
|
|
33
|
+
* NOT independently prove that the canonical worker produced the request.
|
|
34
|
+
* Enter an existing scoped transaction before any tenancy/control/row lock;
|
|
35
|
+
* consume the result in that transaction and dispose its sample afterward. */
|
|
36
|
+
export declare function lockNativeLiveDeclarationJoinTx(scopedTx: Database, settings: JoinSettings, envelope: string, inputBody: Uint8Array): Promise<NativeLiveDeclarationJoinResult>;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Settings } from "@opengeni/config";
|
|
2
|
+
import { ModalNativePreparationDeclarationV2 } from "@opengeni/contracts/modal-native-proof-v2";
|
|
3
|
+
declare const SUBKEY_DOMAIN = "opengeni:modal-native:configuration-equality:subkey:v2";
|
|
4
|
+
declare const MESSAGE_DOMAIN = "opengeni:modal-native:configuration-equality:framed:v2\0";
|
|
5
|
+
type ConfigurationSettings = Pick<Settings, "modalTokenId" | "modalTokenSecret" | "modalEnvironment" | "environmentsEncryptionKey">;
|
|
6
|
+
export type NativeOriginalConfigurationSnapshot = Readonly<{
|
|
7
|
+
serverUrl: string;
|
|
8
|
+
tokenId: string;
|
|
9
|
+
tokenSecret: string;
|
|
10
|
+
environment: string;
|
|
11
|
+
}>;
|
|
12
|
+
declare function readProfile(environment: string): Readonly<{
|
|
13
|
+
protocol: "modal-direct-original-read-grpc-v1";
|
|
14
|
+
version: 1;
|
|
15
|
+
sourceGitBlob: "7599f5b80cf111a25f78f427cfb2616d7e24b36c";
|
|
16
|
+
serverUrl: "https://api.modal.com:443";
|
|
17
|
+
serverSelection: "host-pinned-modal-0.9-default";
|
|
18
|
+
credentialSelection: "explicit-deployment-settings-pair-only";
|
|
19
|
+
environmentSelection: "explicit-own-settings-no-default";
|
|
20
|
+
environment: string;
|
|
21
|
+
environmentTransmittedByCpReads: false;
|
|
22
|
+
namespaceSelection: "unbound-until-authenticated-once-capture";
|
|
23
|
+
modalProjectionVersion: "0.9.0";
|
|
24
|
+
grpcJsVersion: "1.14.4";
|
|
25
|
+
protobufJsVersion: "7.6.5";
|
|
26
|
+
rpcPrefix: "/modal.client.ModalClient/";
|
|
27
|
+
methods: readonly ["AuthTokenGet", "WorkspaceNameLookup", "TaskGetCommandRouterAccess"];
|
|
28
|
+
authHeaders: {
|
|
29
|
+
readonly clientType: "8";
|
|
30
|
+
readonly clientVersion: "1.0.0";
|
|
31
|
+
readonly libmodalVersion: "modal-js/0.9.0";
|
|
32
|
+
};
|
|
33
|
+
tlsPolicy: "explicit-node-tls-rootCertificates-v1";
|
|
34
|
+
tlsRootsSha256: string;
|
|
35
|
+
retries: 0;
|
|
36
|
+
nativeChainDeadlineMs: 30000;
|
|
37
|
+
maxWireBytes: 1048576;
|
|
38
|
+
}>;
|
|
39
|
+
type PrivateDescription = Readonly<{
|
|
40
|
+
protocol: "opengeni-modal-native-configuration-equality";
|
|
41
|
+
version: 2;
|
|
42
|
+
purpose: "original-native-custody-proof";
|
|
43
|
+
configurationCaptureRef: ModalNativePreparationDeclarationV2["configurationCaptureRef"];
|
|
44
|
+
proofGrantRef: ModalNativePreparationDeclarationV2["proofGrantRef"];
|
|
45
|
+
declarationJson: string;
|
|
46
|
+
declarationSha256: string;
|
|
47
|
+
profile: ReturnType<typeof readProfile>;
|
|
48
|
+
keySelection: "existing-environments-encryption-root-current-only";
|
|
49
|
+
algorithm: "hmac-sha256";
|
|
50
|
+
subkeyDomain: typeof SUBKEY_DOMAIN;
|
|
51
|
+
messageDomain: typeof MESSAGE_DOMAIN;
|
|
52
|
+
}>;
|
|
53
|
+
/** Sensitive PRIVATE storage draft, not proof that any row or grant committed. */
|
|
54
|
+
export type NativeOriginalConfigurationDraftV2 = Readonly<{
|
|
55
|
+
description: PrivateDescription;
|
|
56
|
+
equality: Uint8Array;
|
|
57
|
+
}>;
|
|
58
|
+
declare const sampleBrand: unique symbol;
|
|
59
|
+
export type NativeOriginalConfigurationSample = Readonly<{
|
|
60
|
+
[sampleBrand]: true;
|
|
61
|
+
}>;
|
|
62
|
+
/** Samples ONLY explicit own settings, without environment/profile/SDK lookup.
|
|
63
|
+
* A parsed declaration merely supplies correlation. Genuine known app/image
|
|
64
|
+
* provenance and same-transaction host/grant/admission checks remain external.
|
|
65
|
+
*/
|
|
66
|
+
export declare function sampleNativeOriginalConfiguration(settings: ConfigurationSettings, declarationBytes: Uint8Array): NativeOriginalConfigurationSample | null;
|
|
67
|
+
/** Private draft extraction for protected storage only; never a status DTO. */
|
|
68
|
+
export declare function privateNativeOriginalConfigurationDraft(sample: NativeOriginalConfigurationSample): NativeOriginalConfigurationDraftV2 | null;
|
|
69
|
+
/** Same sampled strings for a future authenticated native caller; NOT a grant. */
|
|
70
|
+
export declare function nativeOriginalConfigurationSnapshot(sample: NativeOriginalConfigurationSample): NativeOriginalConfigurationSnapshot | null;
|
|
71
|
+
/** PRIVATE equality check only. No public oracle, grant renewal or key fallback.
|
|
72
|
+
* Restart reconstruction still requires an authenticated protected original row.
|
|
73
|
+
*/
|
|
74
|
+
export declare function currentNativeOriginalConfigurationMatches(sample: NativeOriginalConfigurationSample, settings: ConfigurationSettings): boolean;
|
|
75
|
+
/** Wipes owned mutable copies, not JS immutable strings or native I/O/custody.
|
|
76
|
+
* A future owning native caller must join its real callbacks separately.
|
|
77
|
+
*/
|
|
78
|
+
export declare function disposeNativeOriginalConfigurationSample(sample: NativeOriginalConfigurationSample): void;
|
|
79
|
+
export {};
|