@opengeni/core 0.21.10 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/index.d.ts +1 -1
- package/dist/application/new-session-drafts.d.ts +1 -1
- package/dist/application/session-commands.d.ts +2 -2
- package/dist/billing/limits.d.ts +1 -1
- package/dist/canonical-human-identities.d.ts +12 -0
- package/dist/canonical-human-identities.js +23 -0
- package/dist/canonical-human-identities.js.map +1 -0
- package/dist/chunk-6WKPWE5S.js +2380 -0
- package/dist/chunk-6WKPWE5S.js.map +1 -0
- package/dist/chunk-IBOEYG6N.js +34 -0
- package/dist/chunk-IBOEYG6N.js.map +1 -0
- package/dist/chunk-JJU6I5XD.js +2713 -0
- package/dist/chunk-JJU6I5XD.js.map +1 -0
- package/dist/chunk-NYPMQ7NO.js +2270 -0
- package/dist/chunk-NYPMQ7NO.js.map +1 -0
- package/dist/dependencies.d.ts +30 -6
- package/dist/domain/capabilities.d.ts +28 -3
- package/dist/domain/company-profile-durable-learning-adapter.d.ts +39 -0
- package/dist/domain/conversation-integrations.d.ts +225 -0
- package/dist/domain/durable-learning-slack-publication.d.ts +72 -0
- package/dist/domain/editable-artifacts/agent-application.d.ts +192 -0
- package/dist/domain/editable-artifacts/durable-export-postgres.d.ts +4 -0
- package/dist/domain/editable-artifacts/durable-export.d.ts +212 -0
- package/dist/domain/editable-artifacts/errors.d.ts +47 -0
- package/dist/domain/editable-artifacts/hash.d.ts +11 -0
- package/dist/domain/editable-artifacts/in-memory.d.ts +99 -0
- package/dist/domain/editable-artifacts/index.d.ts +14 -0
- package/dist/domain/editable-artifacts/ports.d.ts +341 -0
- package/dist/domain/editable-artifacts/postgres-adapters.d.ts +13 -0
- package/dist/domain/editable-artifacts/service.d.ts +105 -0
- package/dist/domain/editable-artifacts/snapshot-compaction.d.ts +44 -0
- package/dist/domain/editable-artifacts/snapshot-verifier-genesis.d.ts +50 -0
- package/dist/domain/editable-artifacts/snapshot-verifier-materialization.d.ts +21 -0
- package/dist/domain/editable-artifacts/snapshot-verifier.d.ts +118 -0
- package/dist/domain/editable-artifacts/types.d.ts +410 -0
- package/dist/domain/fiken.d.ts +35 -0
- package/dist/domain/memory-slack-delivery.d.ts +19 -0
- package/dist/domain/packs.d.ts +29 -1
- package/dist/domain/personal-connection-delegations.d.ts +9 -1
- package/dist/domain/scheduled-tasks.d.ts +2 -2
- package/dist/domain/session-tool-policy.d.ts +2 -2
- package/dist/domain/sessions.d.ts +24 -8
- package/dist/domain/skill-imports.d.ts +32 -0
- package/dist/domain/slack-publication-secret-safety.d.ts +8 -0
- package/dist/domain/timeline-annotations.d.ts +5 -0
- package/dist/domain/video-generation-capabilities.d.ts +10 -0
- package/dist/domain/video-generation.d.ts +47 -0
- package/dist/editable-artifact-live/application.d.ts +69 -0
- package/dist/editable-artifact-live/errors.d.ts +1 -0
- package/dist/editable-artifact-live/index.d.ts +8 -0
- package/dist/editable-artifact-live/outbox-dispatcher.d.ts +162 -0
- package/dist/editable-artifact-live/ports.d.ts +100 -0
- package/dist/editable-artifact-live/server.d.ts +71 -0
- package/dist/editable-artifact-live/ticket.d.ts +40 -0
- package/dist/editable-artifact-live/types.d.ts +213 -0
- package/dist/editable-artifact-live/wire.d.ts +34 -0
- package/dist/editable-artifact-live.d.ts +2 -0
- package/dist/editable-artifact-live.js +58 -0
- package/dist/editable-artifact-live.js.map +1 -0
- package/dist/editable-artifacts.d.ts +2 -0
- package/dist/editable-artifacts.js +179 -0
- package/dist/editable-artifacts.js.map +1 -0
- package/dist/index.d.ts +37 -26
- package/dist/index.js +4145 -959
- package/dist/index.js.map +1 -1
- package/dist/managed-session.d.ts +6 -2
- package/dist/rigs/index.d.ts +1 -1
- package/dist/rigs/provider-images.d.ts +31 -0
- package/dist/sandbox/fleet.d.ts +8 -5
- package/dist/sandbox/routing.d.ts +1 -0
- package/dist/session-authorization.d.ts +4 -2
- package/dist/transcription.d.ts +5 -0
- package/dist/workflow-wake-contract.d.ts +7 -0
- package/package.json +22 -10
- package/src/access/index.ts +14 -2
- package/src/application/new-session-drafts.ts +2 -0
- package/src/application/session-commands.ts +188 -107
- package/src/canonical-human-identities.ts +27 -0
- package/src/dependencies.ts +34 -2
- package/src/domain/capabilities.ts +729 -408
- package/src/domain/company-profile-durable-learning-adapter.ts +221 -0
- package/src/domain/conversation-integrations.ts +1238 -0
- package/src/domain/durable-learning-slack-publication.ts +202 -0
- package/src/domain/editable-artifacts/agent-application.ts +687 -0
- package/src/domain/editable-artifacts/durable-export-postgres.ts +139 -0
- package/src/domain/editable-artifacts/durable-export.ts +734 -0
- package/src/domain/editable-artifacts/errors.ts +115 -0
- package/src/domain/editable-artifacts/hash.ts +131 -0
- package/src/domain/editable-artifacts/in-memory.ts +1662 -0
- package/src/domain/editable-artifacts/index.ts +14 -0
- package/src/domain/editable-artifacts/ports.ts +462 -0
- package/src/domain/editable-artifacts/postgres-adapters.ts +49 -0
- package/src/domain/editable-artifacts/service.ts +2402 -0
- package/src/domain/editable-artifacts/snapshot-compaction.ts +246 -0
- package/src/domain/editable-artifacts/snapshot-verifier-genesis.ts +235 -0
- package/src/domain/editable-artifacts/snapshot-verifier-materialization.ts +74 -0
- package/src/domain/editable-artifacts/snapshot-verifier.ts +687 -0
- package/src/domain/editable-artifacts/types.ts +835 -0
- package/src/domain/fiken.ts +88 -0
- package/src/domain/insights.ts +163 -50
- package/src/domain/memory-slack-delivery.ts +204 -0
- package/src/domain/memory-slack-publication.ts +5 -2
- package/src/domain/packs.ts +266 -5
- package/src/domain/personal-connection-delegations.ts +97 -6
- package/src/domain/scheduled-tasks.ts +171 -29
- package/src/domain/session-tool-policy.ts +8 -2
- package/src/domain/sessions.ts +395 -148
- package/src/domain/skill-imports.ts +350 -0
- package/src/domain/slack-publication-secret-safety.ts +42 -0
- package/src/domain/timeline-annotations.ts +204 -0
- package/src/domain/video-generation-capabilities.ts +104 -0
- package/src/domain/video-generation.ts +249 -0
- package/src/editable-artifact-live/application.ts +182 -0
- package/src/editable-artifact-live/errors.ts +4 -0
- package/src/editable-artifact-live/index.ts +8 -0
- package/src/editable-artifact-live/outbox-dispatcher.ts +916 -0
- package/src/editable-artifact-live/ports.ts +139 -0
- package/src/editable-artifact-live/server.ts +1707 -0
- package/src/editable-artifact-live/ticket.ts +217 -0
- package/src/editable-artifact-live/types.ts +286 -0
- package/src/editable-artifact-live/wire.ts +95 -0
- package/src/editable-artifact-live.ts +2 -0
- package/src/editable-artifacts.ts +2 -0
- package/src/index.ts +15 -0
- package/src/managed-session.ts +19 -2
- package/src/rigs/index.ts +26 -19
- package/src/rigs/provider-images.ts +110 -0
- package/src/sandbox/fleet.ts +72 -66
- package/src/sandbox/routing.ts +6 -3
- package/src/session-authorization.ts +187 -52
- package/src/transcription.ts +5 -0
- package/src/workflow-wake-contract.ts +8 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Context } from "hono";
|
|
2
|
-
import type { ManagedAuth } from "./managed-auth-type";
|
|
2
|
+
import type { ManagedAuth } from "./managed-auth-type.js";
|
|
3
|
+
import type { Database } from "@opengeni/db";
|
|
3
4
|
/**
|
|
4
5
|
* Read a Better Auth session without bypassing its sliding-cookie renewal.
|
|
5
6
|
*
|
|
@@ -7,7 +8,10 @@ import type { ManagedAuth } from "./managed-auth-type";
|
|
|
7
8
|
* Programmatic callers must explicitly request and forward the returned cookie
|
|
8
9
|
* headers; the HTTP handler does this automatically, but direct API calls do not.
|
|
9
10
|
*/
|
|
10
|
-
export declare function getManagedSession(c: Context, auth: ManagedAuth
|
|
11
|
+
export declare function getManagedSession(c: Context, auth: ManagedAuth, options?: {
|
|
12
|
+
db?: Database;
|
|
13
|
+
allowIdentityRecovery?: boolean;
|
|
14
|
+
}): Promise<{
|
|
11
15
|
session: {
|
|
12
16
|
id: string;
|
|
13
17
|
createdAt: Date;
|
package/dist/rigs/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccessGrant, CreateRigRequest, RigDefinitionEditPayload, ProposeRigChangeRequest, Rig, RigChange, RigVersion, UpdateRigRequest } from "@opengeni/contracts";
|
|
2
2
|
import { type Database } from "@opengeni/db";
|
|
3
|
+
export * from "./provider-images.js";
|
|
3
4
|
export declare const MAX_RIGS_PER_WORKSPACE = 50;
|
|
4
5
|
export declare const MAX_CHECKS_PER_RIG = 100;
|
|
5
6
|
export declare const MAX_CREDENTIAL_HOOKS_PER_RIG = 50;
|
|
@@ -54,4 +55,3 @@ export declare function createRigVersionForApi(deps: RigServices, grant: AccessG
|
|
|
54
55
|
export declare function activateRigVersionForApi(deps: RigServices, grant: AccessGrant, rig: Rig, versionId: string): Promise<RigVersion>;
|
|
55
56
|
export declare function listRigVersionsForApi(deps: RigServices, workspaceId: string, rigId: string): Promise<RigVersion[]>;
|
|
56
57
|
export declare function listRigChangesForApi(deps: RigServices, workspaceId: string, rigId: string, limit?: number): Promise<RigChange[]>;
|
|
57
|
-
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type RigChangeVerification, type RigProviderImage, type RigProviderImages, type RigVersion, type SandboxBackend } from "@opengeni/contracts";
|
|
2
|
+
export type RigProviderImageDefinition = Pick<RigVersion, "image" | "setupScript" | "checks" | "credentialHooks" | "defaultVariableSetIds">;
|
|
3
|
+
export declare function rigProviderImageProviderBindingKeyHash(bindingKey: string): string;
|
|
4
|
+
export declare function rigProviderImageSetupHash(definition: Pick<RigProviderImageDefinition, "setupScript">): string;
|
|
5
|
+
/**
|
|
6
|
+
* Hash every exact rig-definition input that can affect whether a provider
|
|
7
|
+
* image may be reused. Credential values and variable-set contents are
|
|
8
|
+
* intentionally absent: verification never injects them into the build box.
|
|
9
|
+
* Their declared hook/set identities still participate so a new rig version
|
|
10
|
+
* cannot silently inherit an older build record.
|
|
11
|
+
*/
|
|
12
|
+
export declare function rigProviderImageContentHash(input: {
|
|
13
|
+
backend: SandboxBackend;
|
|
14
|
+
sourceImage: string | null;
|
|
15
|
+
definition: RigProviderImageDefinition;
|
|
16
|
+
}): string;
|
|
17
|
+
/** Modal's patched snapshot API accepts a caller-owned UUID idempotency key.
|
|
18
|
+
* v2 denotes images proven by a separate cold boot before publication. */
|
|
19
|
+
export declare function rigProviderImageBuildRequestId(input: {
|
|
20
|
+
targetId: string;
|
|
21
|
+
backend: SandboxBackend;
|
|
22
|
+
contentHash: string;
|
|
23
|
+
}): string;
|
|
24
|
+
export declare function rigProviderImageMatchesDefinition(image: RigProviderImage, definition: RigProviderImageDefinition): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Promotion copies only a finalized, structurally valid build record whose
|
|
27
|
+
* hashes match the exact version definition being inserted. A malformed or
|
|
28
|
+
* stale optimization record is discarded; the version remains correct and
|
|
29
|
+
* falls back to runtime setup.
|
|
30
|
+
*/
|
|
31
|
+
export declare function rigProviderImagesFromVerification(verification: RigChangeVerification | null, definition: RigProviderImageDefinition): RigProviderImages;
|
package/dist/sandbox/fleet.d.ts
CHANGED
|
@@ -28,8 +28,9 @@ export type FleetContext = {
|
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
30
|
* Build a session-scoped {@link FleetContext}: load the session (workspace-
|
|
31
|
-
* scoped)
|
|
32
|
-
*
|
|
31
|
+
* scoped) and project its group backend/id. A backend:none session has no home
|
|
32
|
+
* box, but it may still discover, run on, and attach an owned Connected Machine.
|
|
33
|
+
* Shared
|
|
33
34
|
* by the worker-signed MCP fleet tools and the user-authenticated swap REST
|
|
34
35
|
* route so both resolve the SAME context (no drift). The `accountId`/`workspaceId`/
|
|
35
36
|
* `sessionId` come from the trusted grant/route; the backend + group id come from
|
|
@@ -108,9 +109,11 @@ export type FleetSwapResult = {
|
|
|
108
109
|
code?: BackendUnresolvableCode | "concurrent_swap" | "recovery_in_progress" | "recovery_degraded" | "recovery_unrecoverable";
|
|
109
110
|
};
|
|
110
111
|
/**
|
|
111
|
-
* List the fleet: the session's own
|
|
112
|
-
* workspace's first-class selfhosted sandboxes (each probed for
|
|
113
|
-
* with an `active` marker derived from the session's active
|
|
112
|
+
* List the fleet: the session's own group box when it has one (a synthetic
|
|
113
|
+
* entry) + the workspace's first-class selfhosted sandboxes (each probed for
|
|
114
|
+
* liveness), each with an `active` marker derived from the session's active
|
|
115
|
+
* pointer. A backend:none session has no synthetic home entry; a null pointer
|
|
116
|
+
* then means no compute is attached.
|
|
114
117
|
*/
|
|
115
118
|
export declare function listFleet(services: FleetServices, ctx: FleetContext): Promise<FleetListResult>;
|
|
116
119
|
/**
|
|
@@ -7,6 +7,7 @@ export type ChannelARoutingServices = {
|
|
|
7
7
|
settings: Settings;
|
|
8
8
|
bus?: EventBus;
|
|
9
9
|
onSandboxOperation?: RoutingSandboxOperationObserver;
|
|
10
|
+
waitSignal?: AbortSignal;
|
|
10
11
|
};
|
|
11
12
|
/** Map the deployment relay URL to the leaf's `SelfhostedRelayConfig` shape. The
|
|
12
13
|
* relay URL (`OPENGENI_SELFHOSTED_RELAY_URL`) may carry a path (the relay's wss
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SessionAuthorizationActor, SessionAuthorizationListScope, type AccessGrant, type SessionAuthorizationOperation, type SessionAuthorizationSurface, type SessionAuthorizationTarget } from "@opengeni/contracts";
|
|
2
|
-
import { type Database } from "@opengeni/db";
|
|
3
|
-
import type { AppDependencies } from "./dependencies";
|
|
2
|
+
import { type Database, type SessionRlsActorContext } from "@opengeni/db";
|
|
3
|
+
import type { AppDependencies } from "./dependencies.js";
|
|
4
4
|
export type SessionAuthorizationDependencies = Pick<AppDependencies, "db" | "sessionAuthorization">;
|
|
5
5
|
/** Maximum time an omitted host hint leaves a live session stream unchecked. */
|
|
6
6
|
export declare const SESSION_AUTHORIZATION_DEFAULT_REAUTHORIZE_MS = 15000;
|
|
@@ -19,6 +19,8 @@ export type ResolvedSessionAuthorization = {
|
|
|
19
19
|
relatedSessionAccess: "target" | "root";
|
|
20
20
|
reauthorizeAfterMs: number | null;
|
|
21
21
|
};
|
|
22
|
+
export declare function sessionRlsActorForAuthorization(authorization: ResolvedSessionAuthorization): SessionRlsActorContext;
|
|
23
|
+
export declare function withResolvedSessionAuthorization<T>(authorization: ResolvedSessionAuthorization, fn: () => Promise<T>): Promise<T>;
|
|
22
24
|
/**
|
|
23
25
|
* Prove that a first-party request belongs to the exact currently active
|
|
24
26
|
* attempt of the named caller session. Unlike the optional embedding-host ACL
|
package/dist/transcription.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export type TranscriptionLimits = {
|
|
|
16
16
|
export type TranscriptionRequest = {
|
|
17
17
|
workspaceId: string;
|
|
18
18
|
accountId: string;
|
|
19
|
+
/** Authenticated human/service subject used for provider-account authority. */
|
|
20
|
+
subjectId: string;
|
|
19
21
|
audio: Uint8Array;
|
|
20
22
|
mimeType: string;
|
|
21
23
|
/** Optional client-reported duration; enforced as a soft ceiling before upstream. */
|
|
@@ -48,6 +50,7 @@ export declare function statusForVoiceInputError(code: VoiceInputErrorCode): num
|
|
|
48
50
|
/** Optional workspace scope for readiness checks during provider selection. */
|
|
49
51
|
export type TranscriptionAvailabilityContext = {
|
|
50
52
|
workspaceId?: string | undefined;
|
|
53
|
+
subjectId?: string | undefined;
|
|
51
54
|
};
|
|
52
55
|
/**
|
|
53
56
|
* Extensible transcription provider port. Implementations own credentials and
|
|
@@ -69,6 +72,8 @@ export type TranscriptionProvider = {
|
|
|
69
72
|
mimeType: string;
|
|
70
73
|
filename: string;
|
|
71
74
|
workspaceId: string;
|
|
75
|
+
accountId: string;
|
|
76
|
+
subjectId: string;
|
|
72
77
|
requestId: string;
|
|
73
78
|
signal?: AbortSignal | undefined;
|
|
74
79
|
}): Promise<{
|
|
@@ -2,3 +2,10 @@
|
|
|
2
2
|
export declare const SESSION_WORKFLOW_WAKE_DISPATCHER_SCHEDULE_ID = "opengeni-session-workflow-wake-dispatcher";
|
|
3
3
|
export declare const SESSION_WORKFLOW_WAKE_DISPATCHER_WORKFLOW_TYPE = "sessionWorkflowWakeDispatcherWorkflow";
|
|
4
4
|
export declare const SESSION_WORKFLOW_WAKE_DISPATCHER_PERIOD_MS = 10000;
|
|
5
|
+
/**
|
|
6
|
+
* Temporal delivers activity cancellation through heartbeats. Keep both the
|
|
7
|
+
* activity's local heartbeat timer and the worker's SDK throttle at this bound
|
|
8
|
+
* so the end-to-end Pause/Steer physical-cancellation contract is not already
|
|
9
|
+
* exhausted before sandbox/tool quiescence and replacement admission begin.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TURN_ACTIVITY_CANCELLATION_HEARTBEAT_INTERVAL_MS = 500;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "OpenGeni framework-agnostic core: the domain, access, and billing layers (neutral access, off-HTTP V2 surface). Behavior-preserving extraction from apps/api — keeps Hono's HTTPException for error throwing (typed-errors cleanup deferred).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,18 @@
|
|
|
21
21
|
".": {
|
|
22
22
|
"types": "./dist/index.d.ts",
|
|
23
23
|
"import": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./editable-artifacts": {
|
|
26
|
+
"types": "./dist/editable-artifacts.d.ts",
|
|
27
|
+
"import": "./dist/editable-artifacts.js"
|
|
28
|
+
},
|
|
29
|
+
"./editable-artifact-live": {
|
|
30
|
+
"types": "./dist/editable-artifact-live.d.ts",
|
|
31
|
+
"import": "./dist/editable-artifact-live.js"
|
|
32
|
+
},
|
|
33
|
+
"./canonical-human-identities": {
|
|
34
|
+
"types": "./dist/canonical-human-identities.d.ts",
|
|
35
|
+
"import": "./dist/canonical-human-identities.js"
|
|
24
36
|
}
|
|
25
37
|
},
|
|
26
38
|
"publishConfig": {
|
|
@@ -34,15 +46,15 @@
|
|
|
34
46
|
},
|
|
35
47
|
"dependencies": {
|
|
36
48
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
37
|
-
"@opengeni/codex": "^0.2.
|
|
38
|
-
"@opengeni/config": "^0.
|
|
39
|
-
"@opengeni/contracts": "^0.
|
|
40
|
-
"@opengeni/db": "^0.
|
|
41
|
-
"@opengeni/documents": "^0.5.
|
|
42
|
-
"@opengeni/events": "^0.3.
|
|
43
|
-
"@opengeni/observability": "^0.5
|
|
44
|
-
"@opengeni/runtime": "^0.
|
|
45
|
-
"@opengeni/storage": "^0.2.
|
|
49
|
+
"@opengeni/codex": "^0.2.16",
|
|
50
|
+
"@opengeni/config": "^0.16.1",
|
|
51
|
+
"@opengeni/contracts": "^0.50.0",
|
|
52
|
+
"@opengeni/db": "^0.36.0",
|
|
53
|
+
"@opengeni/documents": "^0.5.38",
|
|
54
|
+
"@opengeni/events": "^0.3.109",
|
|
55
|
+
"@opengeni/observability": "^0.7.5",
|
|
56
|
+
"@opengeni/runtime": "^0.23.0",
|
|
57
|
+
"@opengeni/storage": "^0.2.93",
|
|
46
58
|
"hono": "^4.12.18"
|
|
47
59
|
},
|
|
48
60
|
"engines": {
|
package/src/access/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type { ManagedAuth } from "../managed-auth-type";
|
|
|
20
20
|
import { getManagedSession } from "../managed-session";
|
|
21
21
|
|
|
22
22
|
const bearerPrefix = "Bearer ";
|
|
23
|
+
const accessContextByRequest = new WeakMap<Request, Promise<AccessContext | null>>();
|
|
23
24
|
|
|
24
25
|
export type AccessDeps = {
|
|
25
26
|
db: Database;
|
|
@@ -28,7 +29,12 @@ export type AccessDeps = {
|
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
export async function requireAccessContext(c: Context, deps: AccessDeps): Promise<AccessContext> {
|
|
31
|
-
|
|
32
|
+
let pending = accessContextByRequest.get(c.req.raw);
|
|
33
|
+
if (!pending) {
|
|
34
|
+
pending = resolveAccessContext(c, deps);
|
|
35
|
+
accessContextByRequest.set(c.req.raw, pending);
|
|
36
|
+
}
|
|
37
|
+
const context = await pending;
|
|
32
38
|
if (!context) {
|
|
33
39
|
throw new HTTPException(401, { message: "authentication required" });
|
|
34
40
|
}
|
|
@@ -252,7 +258,7 @@ async function resolveAccessContext(c: Context, deps: AccessDeps): Promise<Acces
|
|
|
252
258
|
}
|
|
253
259
|
|
|
254
260
|
if (deps.managedAuth) {
|
|
255
|
-
const session = await getManagedSession(c, deps.managedAuth);
|
|
261
|
+
const session = await getManagedSession(c, deps.managedAuth, { db: deps.db });
|
|
256
262
|
if (session?.user) {
|
|
257
263
|
return await ensureManagedAccessForUser(deps.db, {
|
|
258
264
|
userId: session.user.id,
|
|
@@ -355,6 +361,12 @@ async function delegatedAccessContext(
|
|
|
355
361
|
...(payload.firstPartyMcpTools !== undefined
|
|
356
362
|
? { firstPartyMcpTools: payload.firstPartyMcpTools }
|
|
357
363
|
: {}),
|
|
364
|
+
...(payload.nestedAgentDepth !== undefined
|
|
365
|
+
? { nestedAgentDepth: payload.nestedAgentDepth }
|
|
366
|
+
: {}),
|
|
367
|
+
...(payload.effectiveMaxNestedAgentDepth !== undefined
|
|
368
|
+
? { effectiveMaxNestedAgentDepth: payload.effectiveMaxNestedAgentDepth }
|
|
369
|
+
: {}),
|
|
358
370
|
// Caller identity: the turn that minted this token. Tools classify the
|
|
359
371
|
// CALLER from this instead of re-reading the live active pointer.
|
|
360
372
|
...(payload.turnId ? { turnId: payload.turnId } : {}),
|
|
@@ -67,6 +67,7 @@ async function hydrateNewSessionDraft(
|
|
|
67
67
|
deps.db,
|
|
68
68
|
workspaceId,
|
|
69
69
|
deps.settings,
|
|
70
|
+
{ subjectId: grant.subjectId },
|
|
70
71
|
);
|
|
71
72
|
const resources = [] as NewSessionDraftValue["resources"];
|
|
72
73
|
for (const resource of mapped.resources) {
|
|
@@ -200,6 +201,7 @@ export async function saveActorNewSessionDraft(
|
|
|
200
201
|
deps.db,
|
|
201
202
|
workspaceId,
|
|
202
203
|
deps.settings,
|
|
204
|
+
{ subjectId: grant.subjectId },
|
|
203
205
|
);
|
|
204
206
|
const resources = normalizeResources(input.resources);
|
|
205
207
|
const tools = toolsProvided ? validateToolRefs(input.tools, runtimeSettings) : [];
|