@opengeni/core 0.4.9 → 0.8.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/index.d.ts +103 -138
- package/dist/index.js +792 -154
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/access/index.ts +4 -0
- package/src/application/session-commands.ts +190 -38
- package/src/billing/limits.ts +20 -1
- package/src/dependencies.ts +26 -2
- package/src/domain/capabilities.ts +171 -3
- package/src/domain/resources.ts +89 -30
- package/src/domain/sessions.ts +409 -93
- package/src/index.ts +1 -0
- package/src/sandbox/fleet.ts +2 -2
- package/src/sandbox/routing.ts +1 -1
- package/src/session-authorization.ts +208 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Settings } from '@opengeni/config';
|
|
2
|
-
import { ScheduledTask, Document, Permission, AccessContext, AccessGrant, LimitAction, LimitDecision, CapabilityCatalogItem, CapabilityInstallation, CapabilityCatalogResponse, CreateCapabilityCatalogItemRequest, EnableCapabilityRequest, VariableSet, Rig, RigVersion, CreateRigRequest, RigDefinitionEditPayload, RigChange, ProposeRigChangeRequest, UpdateRigRequest, CapabilityPack, SocialConnection, ScheduledTaskAgentConfig, ToolRef, ResourceRef, CreateScheduledTaskRequest, UpdateScheduledTaskRequest, ReasoningEffort, SessionMcpCredentialUpdateInput, SessionEvent, SessionTurn, GoalSpec, SessionMcpServerMetadata, Session, WorkspaceMember, SessionControlRequest, SessionControlResponse, WorkspaceInferenceControlRequest, WorkspaceInferenceControlResponse, DeleteSessionQueueItemRequest, SessionQueueMutationResponse, EditSessionQueueItemRequest, ComposerDraft, MoveSessionQueueItemRequest, SaveComposerDraftRequest, SteerSessionQueueItemRequest } from '@opengeni/contracts';
|
|
2
|
+
import { ScheduledTask, Document, GitHubAppApiPort, ConnectionCredentialsPort, SessionAuthorizationPort, Permission, AccessContext, AccessGrant, SessionAuthorizationActor, SessionAuthorizationTarget, SessionAuthorizationOperation, SessionAuthorizationSurface, SessionAuthorizationListScope, LimitAction, LimitDecision, TurnInitiator, TurnInitiatorContext, SessionTurnSource, CapabilityCatalogItem, CapabilityInstallation, CapabilityCatalogResponse, CreateCapabilityCatalogItemRequest, EnableCapabilityRequest, VariableSet, Rig, RigVersion, CreateRigRequest, RigDefinitionEditPayload, RigChange, ProposeRigChangeRequest, UpdateRigRequest, CapabilityPack, SocialConnection, ScheduledTaskAgentConfig, ToolRef, ResourceRef, CreateScheduledTaskRequest, UpdateScheduledTaskRequest, ReasoningEffort, SessionMcpCredentialUpdateInput, SessionEvent, SessionTurn, GoalSpec, SessionMcpServerMetadata, Session, CreateSessionResponse, WorkspaceMember, SessionControlRequest, SessionControlResponse, WorkspaceInferenceControlRequest, WorkspaceInferenceControlResponse, DeleteSessionQueueItemRequest, SessionQueueMutationResponse, EditSessionQueueItemRequest, ComposerDraft, MoveSessionQueueItemRequest, SaveComposerDraftRequest, SteerSessionQueueItemRequest } from '@opengeni/contracts';
|
|
3
3
|
export { mergeToolRefs, stableJson } from '@opengeni/contracts';
|
|
4
4
|
import * as _opengeni_db from '@opengeni/db';
|
|
5
|
-
import { Database, SandboxRecord, EnabledMcpCapabilityServer, UpdateScheduledTaskInput, CreateSessionMcpServerInput, UpdateSessionMcpServerCredentialsInput } from '@opengeni/db';
|
|
5
|
+
import { Database, SandboxRecord, EnabledMcpCapabilityServer, UpdateScheduledTaskInput, SessionCommandActor, CreateSessionMcpServerInput, UpdateSessionMcpServerCredentialsInput } from '@opengeni/db';
|
|
6
6
|
import { DocumentServices } from '@opengeni/documents';
|
|
7
7
|
import { EventBus } from '@opengeni/events';
|
|
8
8
|
import { Observability } from '@opengeni/observability';
|
|
@@ -136,6 +136,24 @@ type AppDependencies = {
|
|
|
136
136
|
observability?: Observability;
|
|
137
137
|
readinessChecks?: Partial<Record<"db" | "nats" | "temporal", () => Promise<void> | void>>;
|
|
138
138
|
githubStateSecret?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Optional host-provided GitHub App API seam. Embedded hosts can authorize
|
|
141
|
+
* users, inspect installations, and list repositories with their own GitHub
|
|
142
|
+
* App credentials; standalone deployments fall back to @opengeni/github.
|
|
143
|
+
*/
|
|
144
|
+
githubAppApi?: GitHubAppApiPort;
|
|
145
|
+
/**
|
|
146
|
+
* Optional host-owned connection credential seam. API-side consumers use
|
|
147
|
+
* the MCP leg for Toolspace/Code Mode; worker consumers bind the same port
|
|
148
|
+
* for model MCP, Git, and sandbox-secret resolution.
|
|
149
|
+
*/
|
|
150
|
+
connectionCredentials?: ConnectionCredentialsPort | null;
|
|
151
|
+
/**
|
|
152
|
+
* Optional embedding-host session ACL. Unset preserves standalone workspace
|
|
153
|
+
* authorization; once bound, every session-addressed surface fails closed on
|
|
154
|
+
* an unavailable or invalid host decision.
|
|
155
|
+
*/
|
|
156
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
139
157
|
managedAuth?: ManagedAuth | null;
|
|
140
158
|
sandboxClient?: ApiSandboxClient;
|
|
141
159
|
/**
|
|
@@ -162,7 +180,7 @@ type ApiRouteDeps = AppDependencies & {
|
|
|
162
180
|
* the canonical admission path without constructing unrelated HTTP, document,
|
|
163
181
|
* or sandbox services. The public API still passes its `ApiRouteDeps` superset.
|
|
164
182
|
*/
|
|
165
|
-
type AcceptSessionUserMessageDependencies = Pick<AppDependencies, "settings" | "db" | "bus"> & {
|
|
183
|
+
type AcceptSessionUserMessageDependencies = Pick<AppDependencies, "settings" | "db" | "bus" | "sessionAuthorization"> & {
|
|
166
184
|
workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
|
|
167
185
|
objectStorage: ObjectStorageDependency;
|
|
168
186
|
};
|
|
@@ -288,7 +306,7 @@ type RunOnResult = {
|
|
|
288
306
|
};
|
|
289
307
|
/**
|
|
290
308
|
* Run a ONE-OFF op against a SPECIFIC target WITHOUT changing the active pointer
|
|
291
|
-
* (the
|
|
309
|
+
* (the design `run_on`). Only selfhosted targets are routable as a one-off here
|
|
292
310
|
* (a Modal target is the session's group box, reached via the normal Channel-A /
|
|
293
311
|
* turn path — `run_on` is for reaching a NON-active enrolled machine without
|
|
294
312
|
* swapping). The op is fenced under the target's enrollment, addressed to its
|
|
@@ -315,7 +333,7 @@ type ProvisionResult = {
|
|
|
315
333
|
* cannot click the loud whole-machine consent itself).
|
|
316
334
|
* - modal → create a first-class named modal `sandboxes` record (a swap target).
|
|
317
335
|
* NOTE: the Modal BOX is materialized lazily when first swapped-to (Modal
|
|
318
|
-
*
|
|
336
|
+
* lifecycle is owned by the lease — unchanged per).
|
|
319
337
|
*/
|
|
320
338
|
declare function provisionSandbox(services: FleetServices, ctx: FleetContext, input: {
|
|
321
339
|
kind: "selfhosted" | "modal";
|
|
@@ -340,7 +358,7 @@ declare function relayConfigFromSettings(settings: Settings): SelfhostedRelayCon
|
|
|
340
358
|
* the CONSUMER uses (`relayConfigFromSettings`) so producer + consumer always agree
|
|
341
359
|
* on `/stream` — even when the configured URL omits it. An unconfigured relay maps to
|
|
342
360
|
* `""` (graceful degrade: the agent reports no-relay rather than dialing a synthetic
|
|
343
|
-
*
|
|
361
|
+
* host). Fixes preview AND managed prod with no agent rebuild. */
|
|
344
362
|
declare function relayDialBaseFromSettings(settings: Settings): string;
|
|
345
363
|
/** Whether the routing proxy should wrap the Channel-A box: gated by the
|
|
346
364
|
* selfhosted flag (the active pointer + swap are only meaningful then). */
|
|
@@ -367,6 +385,41 @@ declare function requireAccessGrant(c: Context, deps: AccessDeps, workspaceId: s
|
|
|
367
385
|
declare function requirePermission(grant: AccessGrant, permission: Permission): void;
|
|
368
386
|
declare function hasPermission(permissions: Permission[], permission: Permission): boolean;
|
|
369
387
|
|
|
388
|
+
type SessionAuthorizationDependencies = Pick<AppDependencies, "db" | "sessionAuthorization">;
|
|
389
|
+
/** Maximum time an omitted host hint leaves a live session stream unchecked. */
|
|
390
|
+
declare const SESSION_AUTHORIZATION_DEFAULT_REAUTHORIZE_MS = 15000;
|
|
391
|
+
declare class SessionAuthorizationDeniedError extends Error {
|
|
392
|
+
readonly reason: "not_found" | "forbidden" | "revoked" | "caller_stale";
|
|
393
|
+
readonly code = "SESSION_NOT_FOUND_OR_DENIED";
|
|
394
|
+
constructor(reason: "not_found" | "forbidden" | "revoked" | "caller_stale");
|
|
395
|
+
}
|
|
396
|
+
declare class SessionAuthorizationUnavailableError extends Error {
|
|
397
|
+
readonly code = "SESSION_AUTHORIZATION_UNAVAILABLE";
|
|
398
|
+
constructor(options?: ErrorOptions);
|
|
399
|
+
}
|
|
400
|
+
type ResolvedSessionAuthorization = {
|
|
401
|
+
actor: SessionAuthorizationActor;
|
|
402
|
+
target: SessionAuthorizationTarget;
|
|
403
|
+
relatedSessionAccess: "target" | "root";
|
|
404
|
+
reauthorizeAfterMs: number | null;
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* Resolve and enforce the host ACL for one session. The target and agent actor
|
|
408
|
+
* are reconstructed from workspace-scoped durable state. A request can supply
|
|
409
|
+
* an immediate target id and signed attempt claims, but can never nominate a
|
|
410
|
+
* lineage root or frozen initiator.
|
|
411
|
+
*
|
|
412
|
+
* Returns null when no host port is bound so standalone behavior stays byte-
|
|
413
|
+
* for-byte unchanged and pays no additional lineage lookup.
|
|
414
|
+
*/
|
|
415
|
+
declare function requireSessionAuthorization(deps: SessionAuthorizationDependencies, grant: AccessGrant, input: {
|
|
416
|
+
sessionId: string;
|
|
417
|
+
operation: SessionAuthorizationOperation;
|
|
418
|
+
surface: SessionAuthorizationSurface;
|
|
419
|
+
}): Promise<ResolvedSessionAuthorization | null>;
|
|
420
|
+
/** Resolve the host's complete current list scope for an in-database query. */
|
|
421
|
+
declare function requireSessionAuthorizationListScope(deps: SessionAuthorizationDependencies, grant: AccessGrant, surface: SessionAuthorizationSurface): Promise<SessionAuthorizationListScope | null>;
|
|
422
|
+
|
|
370
423
|
type LimitDependencies = Pick<ApiRouteDeps, "db" | "settings">;
|
|
371
424
|
type LimitCheckInput = {
|
|
372
425
|
accountId: string;
|
|
@@ -386,6 +439,12 @@ declare function recordWorkspaceUsage(deps: LimitDependencies, input: {
|
|
|
386
439
|
unit: string;
|
|
387
440
|
sourceResourceType: string;
|
|
388
441
|
sourceResourceId: string;
|
|
442
|
+
sessionId?: string | null;
|
|
443
|
+
turnId?: string | null;
|
|
444
|
+
turnAttemptId?: string | null;
|
|
445
|
+
initiator?: TurnInitiator | null;
|
|
446
|
+
initiatorContext?: TurnInitiatorContext;
|
|
447
|
+
origin?: SessionTurnSource | null;
|
|
389
448
|
idempotencyKey: string;
|
|
390
449
|
}): Promise<void>;
|
|
391
450
|
|
|
@@ -560,6 +619,8 @@ declare function enabledCapabilityMcpToolRefs(settings: McpSettings, runtimeSett
|
|
|
560
619
|
declare function withDefaultEnabledCapabilityMcpTools(tools: ToolRef[], settings: McpSettings, runtimeSettings: McpSettings): ToolRef[];
|
|
561
620
|
declare function normalizeResources(resources: ResourceRef[]): ResourceRef[];
|
|
562
621
|
declare function mergeResourceRefs(existing: ResourceRef[], additions: ResourceRef[]): ResourceRef[];
|
|
622
|
+
declare function validateGitHubRepositorySelectionShapes(resources: ResourceRef[]): number[];
|
|
623
|
+
/** @deprecated Use validateGitHubRepositorySelectionShapes for multi-installation sessions. */
|
|
563
624
|
declare function validateGitHubRepositorySelectionShape(resources: ResourceRef[]): number | null;
|
|
564
625
|
declare function validateGitHubRepositorySelection(db: Database, workspaceId: string, resources: ResourceRef[]): Promise<void>;
|
|
565
626
|
declare function validateFileResources(db: Database, workspaceId: string, resources: ResourceRef[]): Promise<void>;
|
|
@@ -634,12 +695,14 @@ declare function manualScheduledTaskTriggerUsageKey(workspaceId: string, taskId:
|
|
|
634
695
|
|
|
635
696
|
declare function settingsWithSessionMcpServerMetadata(settings: Settings, servers: SessionMcpServerMetadata[]): Settings;
|
|
636
697
|
declare function createAndStartSession(input: {
|
|
698
|
+
requestedSessionId?: string;
|
|
637
699
|
db: Database;
|
|
638
700
|
bus: EventBus;
|
|
639
701
|
workflowClient: SessionWorkflowClient;
|
|
640
702
|
accountId: string;
|
|
641
703
|
workspaceId: string;
|
|
642
704
|
initialMessage: string;
|
|
705
|
+
turnInstructions?: string | null;
|
|
643
706
|
resources: ResourceRef[];
|
|
644
707
|
tools: ToolRef[];
|
|
645
708
|
clientEventId?: string;
|
|
@@ -647,6 +710,11 @@ declare function createAndStartSession(input: {
|
|
|
647
710
|
reasoningEffort: Settings["openaiReasoningEffort"];
|
|
648
711
|
sandboxBackend: Settings["sandboxBackend"];
|
|
649
712
|
metadata: Record<string, unknown>;
|
|
713
|
+
createdBy?: TurnInitiator;
|
|
714
|
+
createdByContext?: TurnInitiatorContext;
|
|
715
|
+
createdByActor?: Extract<SessionCommandActor, {
|
|
716
|
+
type: "agent_attempt";
|
|
717
|
+
}> | null;
|
|
650
718
|
variableSet?: {
|
|
651
719
|
id: string;
|
|
652
720
|
name: string;
|
|
@@ -667,131 +735,7 @@ declare function createAndStartSession(input: {
|
|
|
667
735
|
settings: Settings;
|
|
668
736
|
workingDir?: string | null;
|
|
669
737
|
} | null;
|
|
670
|
-
}): Promise<
|
|
671
|
-
id: string;
|
|
672
|
-
workspaceId: string;
|
|
673
|
-
accountId: string;
|
|
674
|
-
status: "queued" | "running" | "idle" | "requires_action" | "recovering" | "waiting_capacity" | "failed" | "cancelled";
|
|
675
|
-
initialMessage: string;
|
|
676
|
-
title: string | null;
|
|
677
|
-
titleSource: "user" | "agent" | null;
|
|
678
|
-
instructions: string | null;
|
|
679
|
-
resources: ({
|
|
680
|
-
kind: "repository";
|
|
681
|
-
uri: string;
|
|
682
|
-
ref: string;
|
|
683
|
-
mountPath?: string | undefined;
|
|
684
|
-
subpath?: string | undefined;
|
|
685
|
-
provider?: "github" | "gitlab" | "azure_devops" | undefined;
|
|
686
|
-
repositoryId?: string | number | undefined;
|
|
687
|
-
installationId?: string | number | undefined;
|
|
688
|
-
projectId?: string | number | undefined;
|
|
689
|
-
connectionId?: string | undefined;
|
|
690
|
-
githubInstallationId?: number | undefined;
|
|
691
|
-
githubRepositoryId?: number | undefined;
|
|
692
|
-
} | {
|
|
693
|
-
kind: "file";
|
|
694
|
-
fileId: string;
|
|
695
|
-
mountPath?: string | undefined;
|
|
696
|
-
})[];
|
|
697
|
-
tools: {
|
|
698
|
-
kind: "mcp";
|
|
699
|
-
id: string;
|
|
700
|
-
optional?: boolean | undefined;
|
|
701
|
-
}[];
|
|
702
|
-
metadata: Record<string, unknown>;
|
|
703
|
-
model: string;
|
|
704
|
-
sandboxBackend: "docker" | "modal" | "local" | "none" | "daytona" | "runloop" | "e2b" | "blaxel" | "cloudflare" | "vercel" | "selfhosted";
|
|
705
|
-
sandboxOs: "linux" | "macos" | "windows";
|
|
706
|
-
sandboxGroupId: string;
|
|
707
|
-
activeSandboxId: string | null;
|
|
708
|
-
activeEpoch: number;
|
|
709
|
-
variableSetId: string | null;
|
|
710
|
-
environmentId: string | null;
|
|
711
|
-
rigId: string | null;
|
|
712
|
-
rigVersionId: string | null;
|
|
713
|
-
firstPartyMcpPermissions: ("account:read" | "account:admin" | "members:manage" | "workspace:create" | "billing:read" | "billing:manage" | "workspace:read" | "workspace:admin" | "sessions:create" | "sessions:read" | "sessions:control" | "stream:view" | "stream:control" | "stream:acknowledge" | "files:upload" | "files:read" | "files:write" | "terminal:attach" | "documents:manage" | "documents:search" | "scheduled_tasks:manage" | "scheduled_tasks:run" | "github:manage" | "github:use" | "api_keys:manage" | "connections:read" | "connections:write" | "environments:manage" | "environments:use" | "variable-sets:manage" | "variable-sets:use" | "mcp_servers:attach" | "toolspace:call" | "goals:manage" | "enrollments:read" | "enrollments:manage" | "rigs:use" | "rigs:manage")[] | null;
|
|
714
|
-
mcpServers: {
|
|
715
|
-
id: string;
|
|
716
|
-
name: string | null;
|
|
717
|
-
url: string;
|
|
718
|
-
headerNames: string[];
|
|
719
|
-
credentialVersion: number;
|
|
720
|
-
}[];
|
|
721
|
-
parentSessionId: string | null;
|
|
722
|
-
createIdempotencyKey: string | null;
|
|
723
|
-
temporalWorkflowId: string | null;
|
|
724
|
-
activeTurnId: string | null;
|
|
725
|
-
lastInputTokens: number | null;
|
|
726
|
-
queueVersion: number;
|
|
727
|
-
queueHeadPosition: number;
|
|
728
|
-
queueTailPosition: number;
|
|
729
|
-
effectiveControl: {
|
|
730
|
-
state: "active" | "paused";
|
|
731
|
-
controlVersion: number;
|
|
732
|
-
controlEtag: string;
|
|
733
|
-
directState: "active" | "paused";
|
|
734
|
-
primaryBlocker: {
|
|
735
|
-
kind: "workspace" | "session";
|
|
736
|
-
displayName: string;
|
|
737
|
-
actor: string | null;
|
|
738
|
-
reason: string | null;
|
|
739
|
-
changedAt: string | null;
|
|
740
|
-
revision: number;
|
|
741
|
-
sessionId?: string | undefined;
|
|
742
|
-
} | null;
|
|
743
|
-
additionalBlockerCount: number;
|
|
744
|
-
blockers: {
|
|
745
|
-
kind: "workspace" | "session";
|
|
746
|
-
displayName: string;
|
|
747
|
-
actor: string | null;
|
|
748
|
-
reason: string | null;
|
|
749
|
-
changedAt: string | null;
|
|
750
|
-
revision: number;
|
|
751
|
-
sessionId?: string | undefined;
|
|
752
|
-
}[];
|
|
753
|
-
resumeOptions: {
|
|
754
|
-
scope: "workspace" | "session" | "selected";
|
|
755
|
-
selectedStateAfter: "active" | "paused";
|
|
756
|
-
impactCopy: string;
|
|
757
|
-
targetId?: string | undefined;
|
|
758
|
-
remainingPrimaryBlocker?: {
|
|
759
|
-
kind: "workspace" | "session";
|
|
760
|
-
displayName: string;
|
|
761
|
-
actor: string | null;
|
|
762
|
-
reason: string | null;
|
|
763
|
-
changedAt: string | null;
|
|
764
|
-
revision: number;
|
|
765
|
-
sessionId?: string | undefined;
|
|
766
|
-
} | undefined;
|
|
767
|
-
}[];
|
|
768
|
-
override: {
|
|
769
|
-
rootSessionId: string;
|
|
770
|
-
revision: number;
|
|
771
|
-
} | null;
|
|
772
|
-
settlement: {
|
|
773
|
-
state: "stopping";
|
|
774
|
-
attemptCount: number;
|
|
775
|
-
} | null;
|
|
776
|
-
};
|
|
777
|
-
lastSequence: number;
|
|
778
|
-
codexPinnedCredentialId: string | null;
|
|
779
|
-
codexLastCredentialId: string | null;
|
|
780
|
-
pinned: boolean;
|
|
781
|
-
pinnedAt: string | null;
|
|
782
|
-
pinVersion: number;
|
|
783
|
-
createdAt: string;
|
|
784
|
-
updatedAt: string;
|
|
785
|
-
treeStats?: {
|
|
786
|
-
directChildren: number;
|
|
787
|
-
totalDescendants: number;
|
|
788
|
-
runningDescendants: number;
|
|
789
|
-
queuedDescendants: number;
|
|
790
|
-
attentionDescendants: number;
|
|
791
|
-
pausedDescendants: number;
|
|
792
|
-
failedDescendants: number;
|
|
793
|
-
} | undefined;
|
|
794
|
-
}>;
|
|
738
|
+
}): Promise<CreateSessionResponse>;
|
|
795
739
|
declare function workflowIdForSession(sessionId: string): string;
|
|
796
740
|
/**
|
|
797
741
|
* Reject an explicit model that the host does not expose. The set of usable
|
|
@@ -840,6 +784,7 @@ declare function postUserMessageTurn(input: {
|
|
|
840
784
|
workspaceId: string;
|
|
841
785
|
sessionId: string;
|
|
842
786
|
text: string;
|
|
787
|
+
turnInstructions?: string | null;
|
|
843
788
|
resources: ResourceRef[];
|
|
844
789
|
tools: ToolRef[];
|
|
845
790
|
model?: string | null;
|
|
@@ -849,6 +794,8 @@ declare function postUserMessageTurn(input: {
|
|
|
849
794
|
delivery?: "send" | "steer";
|
|
850
795
|
origin?: "human" | "operator";
|
|
851
796
|
actor?: string;
|
|
797
|
+
actorLabel?: string;
|
|
798
|
+
commandActor?: SessionCommandActor;
|
|
852
799
|
controlEtag?: string | null;
|
|
853
800
|
expectedDraftRevision?: number | null;
|
|
854
801
|
}): Promise<{
|
|
@@ -859,8 +806,10 @@ declare function postUserMessageTurn(input: {
|
|
|
859
806
|
* Full create-session flow shared by `POST /sessions` and the first-party MCP
|
|
860
807
|
* `session_create` tool: payload validation, resource/tool/variableSet
|
|
861
808
|
* checks, usage limits, session start, and usage recording. `rawPayload` is
|
|
862
|
-
* the unparsed request body so absent-vs-empty
|
|
863
|
-
*
|
|
809
|
+
* the unparsed request body so absent-vs-empty execution-context fields keep
|
|
810
|
+
* their meaning: a child inherits omitted resources/tools/mcpServers from its
|
|
811
|
+
* trusted immediate parent, while explicit arrays (including []) win. A
|
|
812
|
+
* top-level create with omitted tools applies workspace-default capability MCPs.
|
|
864
813
|
*/
|
|
865
814
|
declare function createSessionForRequest(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown): Promise<Session>;
|
|
866
815
|
/**
|
|
@@ -872,6 +821,7 @@ declare function createSessionForRequest(deps: ApiRouteDeps, grant: AccessGrant,
|
|
|
872
821
|
*/
|
|
873
822
|
declare function acceptSessionUserMessage(deps: AcceptSessionUserMessageDependencies, grant: AccessGrant, workspaceId: string, sessionId: string, input: {
|
|
874
823
|
text: string;
|
|
824
|
+
turnInstructions?: string | null;
|
|
875
825
|
resources?: ResourceRef[];
|
|
876
826
|
tools?: ToolRef[];
|
|
877
827
|
toolsProvided: boolean;
|
|
@@ -899,11 +849,13 @@ declare function acceptSessionUserMessage(deps: AcceptSessionUserMessageDependen
|
|
|
899
849
|
declare function updateSessionTitle(deps: {
|
|
900
850
|
db: Database;
|
|
901
851
|
bus: EventBus;
|
|
902
|
-
|
|
852
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
853
|
+
}, grant: AccessGrant, sessionId: string, title: string, source: "user" | "agent"): Promise<{
|
|
903
854
|
updated: boolean;
|
|
904
855
|
title: string | null;
|
|
856
|
+
relatedSessionAccess: "target" | "root";
|
|
905
857
|
}>;
|
|
906
|
-
declare function readSessionLineage(
|
|
858
|
+
declare function readSessionLineage(deps: Pick<ApiRouteDeps, "db" | "sessionAuthorization">, grant: AccessGrant, sessionId: string): Promise<_opengeni_db.SessionLineage>;
|
|
907
859
|
|
|
908
860
|
/** A member can manage other members (directly or via the admin wildcard). */
|
|
909
861
|
declare function memberCanAdminister(member: Pick<WorkspaceMember, "permissions">): boolean;
|
|
@@ -948,15 +900,21 @@ type HumanSessionCommandContext = {
|
|
|
948
900
|
type AgentSessionCommandContext = {
|
|
949
901
|
accountId: string;
|
|
950
902
|
workspaceId: string;
|
|
903
|
+
subjectId: string;
|
|
951
904
|
callerSessionId: string;
|
|
952
905
|
callerTurnId: string;
|
|
953
906
|
callerAttemptId: string;
|
|
954
907
|
callerExecutionGeneration: number;
|
|
955
908
|
};
|
|
909
|
+
type SessionAuthorizationCommandDeps = {
|
|
910
|
+
db: Database;
|
|
911
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
912
|
+
};
|
|
956
913
|
declare function sendAgentSessionMessage(deps: {
|
|
957
914
|
db: Database;
|
|
958
915
|
bus: EventBus;
|
|
959
916
|
workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
|
|
917
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
960
918
|
}, context: AgentSessionCommandContext, input: {
|
|
961
919
|
targetSessionId: string;
|
|
962
920
|
text: string;
|
|
@@ -966,6 +924,7 @@ declare function steerAgentSession(deps: {
|
|
|
966
924
|
db: Database;
|
|
967
925
|
bus: EventBus;
|
|
968
926
|
workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
|
|
927
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
969
928
|
}, context: AgentSessionCommandContext, input: {
|
|
970
929
|
targetSessionId: string;
|
|
971
930
|
instruction: string;
|
|
@@ -975,6 +934,7 @@ declare function controlAgentSessionWorkstream(deps: {
|
|
|
975
934
|
db: Database;
|
|
976
935
|
bus: EventBus;
|
|
977
936
|
workflowClient: Pick<SessionWorkflowClient, "requestSessionWorkflowWakeDispatch">;
|
|
937
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
978
938
|
}, context: AgentSessionCommandContext, input: {
|
|
979
939
|
targetSessionId: string;
|
|
980
940
|
action: "pause" | "resume";
|
|
@@ -984,30 +944,35 @@ declare function controlAgentSessionWorkstream(deps: {
|
|
|
984
944
|
declare function moveHumanQueuePrompt(deps: {
|
|
985
945
|
db: Database;
|
|
986
946
|
bus: EventBus;
|
|
947
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
987
948
|
}, context: HumanSessionCommandContext, turnId: string, input: MoveSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
|
|
988
949
|
declare function deleteHumanQueuePrompt(deps: {
|
|
989
950
|
db: Database;
|
|
990
951
|
bus: EventBus;
|
|
952
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
991
953
|
}, context: HumanSessionCommandContext, turnId: string, input: DeleteSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
|
|
992
954
|
declare function editHumanQueuePrompt(deps: {
|
|
993
955
|
db: Database;
|
|
994
956
|
bus: EventBus;
|
|
957
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
995
958
|
}, context: HumanSessionCommandContext, turnId: string, input: EditSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
|
|
996
959
|
declare function steerHumanQueuePrompt(deps: {
|
|
997
960
|
db: Database;
|
|
998
961
|
bus: EventBus;
|
|
962
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
999
963
|
}, context: HumanSessionCommandContext, turnId: string, input: SteerSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
|
|
1000
964
|
declare function controlHumanSessionWorkstream(deps: {
|
|
1001
965
|
db: Database;
|
|
1002
966
|
bus: EventBus;
|
|
1003
967
|
workflowClient: Pick<SessionWorkflowClient, "requestSessionWorkflowWakeDispatch">;
|
|
968
|
+
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
1004
969
|
}, context: HumanSessionCommandContext, input: SessionControlRequest): Promise<SessionControlResponse>;
|
|
1005
970
|
declare function controlHumanWorkspace(deps: {
|
|
1006
971
|
db: Database;
|
|
1007
972
|
bus: EventBus;
|
|
1008
973
|
workflowClient: Pick<SessionWorkflowClient, "requestSessionWorkflowWakeDispatch">;
|
|
1009
974
|
}, context: Omit<HumanSessionCommandContext, "sessionId">, input: WorkspaceInferenceControlRequest): Promise<WorkspaceInferenceControlResponse>;
|
|
1010
|
-
declare function getHumanComposerDraft(
|
|
1011
|
-
declare function saveHumanComposerDraft(
|
|
975
|
+
declare function getHumanComposerDraft(deps: SessionAuthorizationCommandDeps, context: HumanSessionCommandContext): Promise<ComposerDraft>;
|
|
976
|
+
declare function saveHumanComposerDraft(deps: SessionAuthorizationCommandDeps, context: HumanSessionCommandContext, input: SaveComposerDraftRequest): Promise<ComposerDraft>;
|
|
1012
977
|
|
|
1013
|
-
export { type AcceptSessionUserMessageDependencies, type AccessDeps, type AgentSessionCommandContext, type ApiRouteDeps, type ApiSandboxClient, type ApiSandboxSession, type AppDependencies, type ChannelARoutingServices, type DocumentIndexClient, type FleetContext, type FleetListResult, type FleetLiveness, type FleetSandboxEntry, type FleetServices, type FleetSwapResult, type HumanSessionCommandContext, type LimitCheckInput, type LimitDependencies, MARKETING_SOCIAL_PACK_ID, MAX_CHECKS_PER_RIG, MAX_CREDENTIAL_HOOKS_PER_RIG, MAX_DEFAULT_VARIABLE_SETS_PER_RIG, MAX_ENVIRONMENTS_PER_WORKSPACE, MAX_RIGS_PER_WORKSPACE, MAX_VARIABLES_PER_ENVIRONMENT, type ManagedAuth, type McpCapabilityProbe, type McpCapabilityProbeInput, type McpCapabilityProbeResult, type ObjectStorageDependency, type ProvisionResult, type ResumeBoxByIdInput, type ResumedSandboxSession, type RigServices, type RigVerificationClassification, type RunOnOp, type RunOnResult, SESSION_WORKFLOW_WAKE_DISPATCHER_PERIOD_MS, SESSION_WORKFLOW_WAKE_DISPATCHER_SCHEDULE_ID, SESSION_WORKFLOW_WAKE_DISPATCHER_WORKFLOW_TYPE, type SessionWorkflowClient, acceptSessionUserMessage, activateRigVersionForApi, appendRigSetupCommand, applyCapabilityEnablement, assertAllowedEnvironmentVariableName, assertAllowedVariableSetVariableName, assertConfiguredModel, assertPackSandboxImageCompatible, assertWorkspaceDeletable, assertWorkspaceMemberRemovable, assertWorkspaceModelPolicyAllows, buildCapabilityCatalog, buildFleetContextForSession, buildMarketingDailyAnalysisAgentConfig, checkLimit, classifyRigVerificationOutcome, controlAgentSessionWorkstream, controlHumanSessionWorkstream, controlHumanWorkspace, createAndStartSession, createCatalogItem, createRigForApi, createRigVersionForApi, createSessionForRequest, createValidatedScheduledTask, deleteHumanQueuePrompt, deleteRigForApi, disableCapability, discoverMcpRegistryCapabilities, editHumanQueuePrompt, enableCapability, enabledCapabilityMcpToolRefs, getCapabilityPack, getHumanComposerDraft, hasPermission, isBuiltInCapabilityPack, isUserMember, listCapabilityPacks, listFleet, listRigChangesForApi, listRigVersionsForApi, listWorkspaceCapabilityPacks, manualScheduledTaskTriggerUsageKey, manualScheduledTaskTriggerWorkflowId, memberCanAdminister, mergeResourceRefs, moveHumanQueuePrompt, normalizeResources, officialMcpRegistryUrl, postUserMessageTurn, promoteSetupAppendChange, promoteVerifiedDefinitionEditChangeForApi, proposeRigChangeForApi, provisionSandbox, readSessionLineage, reasoningEffortForSession, recordRigAuditEvent, recordVariableSetAuditEvent, recordWorkspaceUsage, relayConfigFromSettings, relayDialBaseFromSettings, requireAccessContext, requireAccessGrant, requireEnvironmentEncryption, requireLimit, requirePermission, requireQueuedTurnForApi, requireRigChangeForApi, requireRigForApi, requireScheduledTaskForApi, requireVariableSetEncryption, requireVariableSetForApi, resolveCapabilityPack, resolveMemberSubjectId, restoreScheduledTask, rigActorForGrant, routingEnabled, runOnSandbox, saveHumanComposerDraft, scheduledTaskTemporalScheduleId, scheduledTaskToolsProvided, scheduledTaskTriggerToken, sendAgentSessionMessage, settingsWithEnabledCapabilityMcpServers, settingsWithMcpCapabilityServers, settingsWithSessionMcpServerMetadata, steerAgentSession, steerHumanQueuePrompt, swapActiveSandbox, syncCreatedScheduledTask, syncUpdatedScheduledTask, updateRigForApi, updateSessionTitle, validateFileResources, validateGitHubRepositorySelection, validateGitHubRepositorySelectionShape, validateMcpCapabilityConnection, validateToolRefs, validateVariableSetAttachment, validatedScheduledTaskUpdate, withDefaultEnabledCapabilityMcpTools, workflowIdForSession, wrapChannelABoxWithRouting };
|
|
978
|
+
export { type AcceptSessionUserMessageDependencies, type AccessDeps, type AgentSessionCommandContext, type ApiRouteDeps, type ApiSandboxClient, type ApiSandboxSession, type AppDependencies, type ChannelARoutingServices, type DocumentIndexClient, type FleetContext, type FleetListResult, type FleetLiveness, type FleetSandboxEntry, type FleetServices, type FleetSwapResult, type HumanSessionCommandContext, type LimitCheckInput, type LimitDependencies, MARKETING_SOCIAL_PACK_ID, MAX_CHECKS_PER_RIG, MAX_CREDENTIAL_HOOKS_PER_RIG, MAX_DEFAULT_VARIABLE_SETS_PER_RIG, MAX_ENVIRONMENTS_PER_WORKSPACE, MAX_RIGS_PER_WORKSPACE, MAX_VARIABLES_PER_ENVIRONMENT, type ManagedAuth, type McpCapabilityProbe, type McpCapabilityProbeInput, type McpCapabilityProbeResult, type ObjectStorageDependency, type ProvisionResult, type ResolvedSessionAuthorization, type ResumeBoxByIdInput, type ResumedSandboxSession, type RigServices, type RigVerificationClassification, type RunOnOp, type RunOnResult, SESSION_AUTHORIZATION_DEFAULT_REAUTHORIZE_MS, SESSION_WORKFLOW_WAKE_DISPATCHER_PERIOD_MS, SESSION_WORKFLOW_WAKE_DISPATCHER_SCHEDULE_ID, SESSION_WORKFLOW_WAKE_DISPATCHER_WORKFLOW_TYPE, SessionAuthorizationDeniedError, type SessionAuthorizationDependencies, SessionAuthorizationUnavailableError, type SessionWorkflowClient, acceptSessionUserMessage, activateRigVersionForApi, appendRigSetupCommand, applyCapabilityEnablement, assertAllowedEnvironmentVariableName, assertAllowedVariableSetVariableName, assertConfiguredModel, assertPackSandboxImageCompatible, assertWorkspaceDeletable, assertWorkspaceMemberRemovable, assertWorkspaceModelPolicyAllows, buildCapabilityCatalog, buildFleetContextForSession, buildMarketingDailyAnalysisAgentConfig, checkLimit, classifyRigVerificationOutcome, controlAgentSessionWorkstream, controlHumanSessionWorkstream, controlHumanWorkspace, createAndStartSession, createCatalogItem, createRigForApi, createRigVersionForApi, createSessionForRequest, createValidatedScheduledTask, deleteHumanQueuePrompt, deleteRigForApi, disableCapability, discoverMcpRegistryCapabilities, editHumanQueuePrompt, enableCapability, enabledCapabilityMcpToolRefs, getCapabilityPack, getHumanComposerDraft, hasPermission, isBuiltInCapabilityPack, isUserMember, listCapabilityPacks, listFleet, listRigChangesForApi, listRigVersionsForApi, listWorkspaceCapabilityPacks, manualScheduledTaskTriggerUsageKey, manualScheduledTaskTriggerWorkflowId, memberCanAdminister, mergeResourceRefs, moveHumanQueuePrompt, normalizeResources, officialMcpRegistryUrl, postUserMessageTurn, promoteSetupAppendChange, promoteVerifiedDefinitionEditChangeForApi, proposeRigChangeForApi, provisionSandbox, readSessionLineage, reasoningEffortForSession, recordRigAuditEvent, recordVariableSetAuditEvent, recordWorkspaceUsage, relayConfigFromSettings, relayDialBaseFromSettings, requireAccessContext, requireAccessGrant, requireEnvironmentEncryption, requireLimit, requirePermission, requireQueuedTurnForApi, requireRigChangeForApi, requireRigForApi, requireScheduledTaskForApi, requireSessionAuthorization, requireSessionAuthorizationListScope, requireVariableSetEncryption, requireVariableSetForApi, resolveCapabilityPack, resolveMemberSubjectId, restoreScheduledTask, rigActorForGrant, routingEnabled, runOnSandbox, saveHumanComposerDraft, scheduledTaskTemporalScheduleId, scheduledTaskToolsProvided, scheduledTaskTriggerToken, sendAgentSessionMessage, settingsWithEnabledCapabilityMcpServers, settingsWithMcpCapabilityServers, settingsWithSessionMcpServerMetadata, steerAgentSession, steerHumanQueuePrompt, swapActiveSandbox, syncCreatedScheduledTask, syncUpdatedScheduledTask, updateRigForApi, updateSessionTitle, validateFileResources, validateGitHubRepositorySelection, validateGitHubRepositorySelectionShape, validateGitHubRepositorySelectionShapes, validateMcpCapabilityConnection, validateToolRefs, validateVariableSetAttachment, validatedScheduledTaskUpdate, withDefaultEnabledCapabilityMcpTools, workflowIdForSession, wrapChannelABoxWithRouting };
|