@opengeni/core 0.20.16 → 0.21.10
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 +8 -0
- package/dist/application/session-commands.d.ts +7 -2
- package/dist/dependencies.d.ts +3 -1
- package/dist/domain/capabilities.d.ts +7 -0
- package/dist/domain/memory-slack-publication.d.ts +0 -2
- package/dist/domain/scheduled-tasks.d.ts +25 -1
- package/dist/domain/sessions.d.ts +30 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +453 -102
- package/dist/index.js.map +1 -1
- package/dist/managed-session.d.ts +53 -0
- package/dist/sandbox/fleet.d.ts +9 -1
- package/dist/session-authorization.d.ts +9 -0
- package/dist/transcription.d.ts +35 -0
- package/package.json +10 -10
- package/src/access/index.ts +43 -3
- package/src/application/session-commands.ts +29 -9
- package/src/dependencies.ts +3 -1
- package/src/domain/capabilities.ts +99 -29
- package/src/domain/memory-slack-publication.ts +5 -17
- package/src/domain/resources.ts +10 -20
- package/src/domain/scheduled-tasks.ts +221 -7
- package/src/domain/sessions.ts +127 -37
- package/src/index.ts +1 -0
- package/src/managed-auth-type.ts +4 -3
- package/src/managed-session.ts +36 -0
- package/src/sandbox/fleet.ts +56 -1
- package/src/sandbox/routing.ts +26 -0
- package/src/session-authorization.ts +17 -0
- package/src/transcription.ts +40 -0
package/dist/access/index.d.ts
CHANGED
|
@@ -19,4 +19,12 @@ export type AccessGrantAuthorization = {
|
|
|
19
19
|
export declare function accessGrantAuthorizationFromContext(context: AccessContext, grant: AccessGrant): AccessGrantAuthorization;
|
|
20
20
|
export declare function requireAccessGrantAuthorization(c: Context, deps: AccessDeps, workspaceId: string, permission?: Permission): Promise<AccessGrantAuthorization>;
|
|
21
21
|
export declare function requirePermission(grant: AccessGrant, permission: Permission): void;
|
|
22
|
+
/**
|
|
23
|
+
* Require a permission to be present literally on the grant. This deliberately
|
|
24
|
+
* does not expand workspace:admin or deprecated aliases and is reserved for
|
|
25
|
+
* authorities, such as plaintext secret reads, that old broad grants must not
|
|
26
|
+
* acquire implicitly.
|
|
27
|
+
*/
|
|
28
|
+
export declare function requireLiteralPermission(grant: AccessGrant, permission: Permission): void;
|
|
29
|
+
export declare function hasLiteralPermission(permissions: Permission[], permission: Permission): boolean;
|
|
22
30
|
export declare function hasPermission(permissions: Permission[], permission: Permission): boolean;
|
|
@@ -97,12 +97,17 @@ export declare function steerHumanQueuePrompt(deps: {
|
|
|
97
97
|
bus: EventBus;
|
|
98
98
|
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
99
99
|
}, context: HumanSessionCommandContext, turnId: string, input: SteerSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
|
|
100
|
-
export declare function
|
|
100
|
+
export declare function controlHumanSessionWorkstreamWithOutcome(deps: {
|
|
101
101
|
db: Database;
|
|
102
102
|
bus: EventBus;
|
|
103
103
|
workflowClient: Pick<SessionWorkflowClient, "requestSessionWorkflowWakeDispatch">;
|
|
104
104
|
sessionAuthorization?: SessionAuthorizationPort | null;
|
|
105
|
-
}, context: HumanSessionCommandContext, input: SessionControlRequest): Promise<
|
|
105
|
+
}, context: HumanSessionCommandContext, input: SessionControlRequest): Promise<{
|
|
106
|
+
response: SessionControlResponse;
|
|
107
|
+
replay: boolean;
|
|
108
|
+
}>;
|
|
109
|
+
/** Backward-compatible response path used by the REST control route. */
|
|
110
|
+
export declare function controlHumanSessionWorkstream(deps: Parameters<typeof controlHumanSessionWorkstreamWithOutcome>[0], context: Parameters<typeof controlHumanSessionWorkstreamWithOutcome>[1], input: Parameters<typeof controlHumanSessionWorkstreamWithOutcome>[2]): Promise<SessionControlResponse>;
|
|
106
111
|
export declare function controlHumanWorkspace(deps: {
|
|
107
112
|
db: Database;
|
|
108
113
|
bus: EventBus;
|
package/dist/dependencies.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { Observability } from "@opengeni/observability";
|
|
|
7
7
|
import type { createObjectStorage } from "@opengeni/storage";
|
|
8
8
|
import type { ManagedAuth } from "./managed-auth-type";
|
|
9
9
|
import type { ApiSandboxClient, ResumeBoxByIdInput, ResumedSandboxSession } from "./sandbox-types";
|
|
10
|
-
import type { TranscriptionService } from "./transcription";
|
|
10
|
+
import type { TranscriptionSegmenter, TranscriptionService } from "./transcription";
|
|
11
11
|
export type SessionWorkflowClient = {
|
|
12
12
|
signalUserMessage: (input: {
|
|
13
13
|
sessionId: string;
|
|
@@ -113,6 +113,8 @@ export type AppDependencies = {
|
|
|
113
113
|
oauthCallbackDeadlineMs?: number;
|
|
114
114
|
/** Optional host-owned voice-input transcription service. */
|
|
115
115
|
transcription?: TranscriptionService | null;
|
|
116
|
+
/** Optional host-owned long-form audio normalization/segmentation service. */
|
|
117
|
+
transcriptionSegmenter?: TranscriptionSegmenter | null;
|
|
116
118
|
sandboxClient?: ApiSandboxClient;
|
|
117
119
|
/**
|
|
118
120
|
* Resume a box by id from a serialized resume_state envelope (the lease's
|
|
@@ -65,4 +65,11 @@ export declare function discoverMcpRegistryCapabilities(input: {
|
|
|
65
65
|
}): Promise<CapabilityCatalogItem[]>;
|
|
66
66
|
export { officialMcpRegistryUrl };
|
|
67
67
|
type McpRegistryFetch = (input: URL, init?: RequestInit) => Promise<Response>;
|
|
68
|
+
/**
|
|
69
|
+
* The Apps MCP is not a configured server and is not a user-installable
|
|
70
|
+
* capability. It is a deployment-gated, workspace-designated runtime surface,
|
|
71
|
+
* so project it into the same catalog the web picker already consumes while
|
|
72
|
+
* keeping its authorization state server-derived and explicit.
|
|
73
|
+
*/
|
|
74
|
+
export declare function codexAppsCatalogItem(available: boolean): CapabilityCatalogItem;
|
|
68
75
|
export declare function applyCapabilityEnablement(item: CapabilityCatalogItem, installation: CapabilityInstallation | undefined, activePackIds: Set<string>): CapabilityCatalogItem;
|
|
@@ -76,13 +76,11 @@ export type MemorySlackPublicationProjection = {
|
|
|
76
76
|
importance: MemorySlackImportance;
|
|
77
77
|
deliveryMode: MemorySlackDeliveryMode;
|
|
78
78
|
summary: string;
|
|
79
|
-
summaryRedacted: boolean;
|
|
80
79
|
summaryTruncated: boolean;
|
|
81
80
|
namespace: string;
|
|
82
81
|
labels: string[];
|
|
83
82
|
labelsTruncated: boolean;
|
|
84
83
|
ownerLabel: string | null;
|
|
85
|
-
ownerLabelRedacted: boolean;
|
|
86
84
|
ownerLabelTruncated: boolean;
|
|
87
85
|
authoritativeRecord: {
|
|
88
86
|
workspaceId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Settings } from "@opengeni/config";
|
|
2
|
-
import type { AccessGrant, McpPersonalConnectionDelegation, ScheduledTask, CreateScheduledTaskRequest as CreateScheduledTaskPayload, UpdateScheduledTaskRequest as UpdateScheduledTaskPayload } from "@opengeni/contracts";
|
|
2
|
+
import type { AccessGrant, McpPersonalConnectionDelegation, ScheduledTask, ScheduledTaskAgentConfig, Session, SessionAuthorizationPort, SessionAuthorizationSurface, CreateScheduledTaskRequest as CreateScheduledTaskPayload, UpdateScheduledTaskRequest as UpdateScheduledTaskPayload } from "@opengeni/contracts";
|
|
3
3
|
import { type Database, type UpdateScheduledTaskInput } from "@opengeni/db";
|
|
4
4
|
import type { SessionWorkflowClient } from "../dependencies";
|
|
5
5
|
import type { ObjectStorageDependency } from "../dependencies";
|
|
@@ -20,7 +20,25 @@ export declare function createValidatedScheduledTask(input: {
|
|
|
20
20
|
payload: CreateScheduledTaskPayload;
|
|
21
21
|
toolsProvided?: boolean;
|
|
22
22
|
variableSetPreauthorized?: boolean;
|
|
23
|
+
sessionAuthorization?: SessionAuthorizationPort | null | undefined;
|
|
24
|
+
authorizationSurface?: SessionAuthorizationSurface | undefined;
|
|
23
25
|
}): Promise<ScheduledTask>;
|
|
26
|
+
export declare function validateScheduledTaskTarget(input: {
|
|
27
|
+
db: Database;
|
|
28
|
+
sessionAuthorization?: SessionAuthorizationPort | null | undefined;
|
|
29
|
+
authorizationSurface?: SessionAuthorizationSurface | undefined;
|
|
30
|
+
grant: AccessGrant;
|
|
31
|
+
targetSessionId: string | null | undefined;
|
|
32
|
+
runMode: ScheduledTask["runMode"];
|
|
33
|
+
variableSetId: string | null | undefined;
|
|
34
|
+
rigId: string | null | undefined;
|
|
35
|
+
agentConfig: ScheduledTaskAgentConfig;
|
|
36
|
+
missingTargetStatus?: 404 | 422;
|
|
37
|
+
}): Promise<Session | null>;
|
|
38
|
+
export declare function scheduledTaskForGrant(task: ScheduledTask, grant: AccessGrant): ScheduledTask;
|
|
39
|
+
export declare function scheduledTaskRunForGrant<T extends {
|
|
40
|
+
sessionId: string | null;
|
|
41
|
+
}>(run: T, grant: AccessGrant): T;
|
|
24
42
|
export declare function validatedScheduledTaskUpdate(input: {
|
|
25
43
|
settings: Settings;
|
|
26
44
|
db: Database;
|
|
@@ -30,6 +48,8 @@ export declare function validatedScheduledTaskUpdate(input: {
|
|
|
30
48
|
payload: UpdateScheduledTaskPayload;
|
|
31
49
|
/** See createValidatedScheduledTask; only consulted when agentConfig is updated. */
|
|
32
50
|
toolsProvided?: boolean;
|
|
51
|
+
sessionAuthorization?: SessionAuthorizationPort | null | undefined;
|
|
52
|
+
authorizationSurface?: SessionAuthorizationSurface | undefined;
|
|
33
53
|
}): Promise<UpdateScheduledTaskInput>;
|
|
34
54
|
export declare function requireScheduledTaskForApi(db: Database, workspaceId: string, taskId: string): Promise<ScheduledTask>;
|
|
35
55
|
export type ScheduledTaskRestoreState = {
|
|
@@ -38,6 +58,10 @@ export type ScheduledTaskRestoreState = {
|
|
|
38
58
|
};
|
|
39
59
|
export declare function captureScheduledTaskRestoreState(db: Database, task: ScheduledTask): Promise<ScheduledTaskRestoreState>;
|
|
40
60
|
export declare function restoreScheduledTask(db: Database, previous: ScheduledTaskRestoreState): Promise<ScheduledTask>;
|
|
61
|
+
export declare class ScheduledTaskSyncError extends Error {
|
|
62
|
+
readonly persistenceRestored: boolean;
|
|
63
|
+
constructor(cause: unknown, persistenceRestored: boolean);
|
|
64
|
+
}
|
|
41
65
|
export declare function syncCreatedScheduledTask(input: {
|
|
42
66
|
db: Database;
|
|
43
67
|
workflowClient: SessionWorkflowClient;
|
|
@@ -49,7 +49,20 @@ export type FrozenCreationInitiator = {
|
|
|
49
49
|
};
|
|
50
50
|
export declare function creationInitiatorForGrant(grant: AccessGrant): FrozenCreationInitiator;
|
|
51
51
|
export declare function settingsWithSessionMcpServerMetadata(settings: Settings, servers: SessionMcpServerMetadata[]): Settings;
|
|
52
|
-
export
|
|
52
|
+
export type CreateSessionOutcome = {
|
|
53
|
+
session: CreateSessionResponse;
|
|
54
|
+
/** The committed create/start effect represented by this request. */
|
|
55
|
+
outcome: "created" | "repaired" | "replayed";
|
|
56
|
+
/** Backward-compatible replay flag for existing entity-oriented callers. */
|
|
57
|
+
replay: boolean;
|
|
58
|
+
/** True when the request created/repaired start state or committed a new wake revision. */
|
|
59
|
+
changed: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type CreateSessionRequestOutcome = CreateSessionOutcome & {
|
|
62
|
+
/** Billing telemetry is recorded after the committed session start. */
|
|
63
|
+
usageRecording: "recorded" | "failed";
|
|
64
|
+
};
|
|
65
|
+
export declare function createAndStartSessionWithOutcome(input: {
|
|
53
66
|
requestedSessionId?: string;
|
|
54
67
|
db: Database;
|
|
55
68
|
bus: EventBus;
|
|
@@ -107,7 +120,9 @@ export declare function createAndStartSession(input: {
|
|
|
107
120
|
maxNestedAgentDepthOverride?: number | null;
|
|
108
121
|
allowNestedAgentDepthIncrease?: boolean;
|
|
109
122
|
subjectId?: string | null;
|
|
110
|
-
}): Promise<
|
|
123
|
+
}): Promise<CreateSessionOutcome>;
|
|
124
|
+
/** Backward-compatible entity-returning create path used by existing callers. */
|
|
125
|
+
export declare function createAndStartSession(input: Parameters<typeof createAndStartSessionWithOutcome>[0]): Promise<CreateSessionResponse>;
|
|
111
126
|
export declare function workflowIdForSession(sessionId: string): string;
|
|
112
127
|
/**
|
|
113
128
|
* Reject an explicit model that the host does not expose. The set of usable
|
|
@@ -190,6 +205,7 @@ export declare function postUserMessageTurn(input: {
|
|
|
190
205
|
}): Promise<{
|
|
191
206
|
accepted: SessionEvent;
|
|
192
207
|
turn: SessionTurn;
|
|
208
|
+
replay: boolean;
|
|
193
209
|
}>;
|
|
194
210
|
/**
|
|
195
211
|
* Full create-session flow shared by `POST /sessions` and the first-party MCP
|
|
@@ -200,7 +216,11 @@ export declare function postUserMessageTurn(input: {
|
|
|
200
216
|
* trusted immediate parent, while explicit arrays (including []) win. A
|
|
201
217
|
* top-level create with omitted tools applies workspace-default capability MCPs.
|
|
202
218
|
*/
|
|
203
|
-
export declare function
|
|
219
|
+
export declare function createSessionForRequestWithOutcome(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown): Promise<CreateSessionRequestOutcome>;
|
|
220
|
+
/** @internal Fixed public projection; the committed session outcome remains authoritative. */
|
|
221
|
+
export declare function reportSessionUsageRecordingFailure(_error: unknown): void;
|
|
222
|
+
/** Backward-compatible entity-returning request path for REST and core callers. */
|
|
223
|
+
export declare function createSessionForRequest(deps: ApiRouteDeps, grant: AccessGrant, workspaceId: string, rawPayload: unknown): Promise<CreateSessionResponse>;
|
|
204
224
|
/**
|
|
205
225
|
* Full accept-user-message flow shared by the `user.message` branch of
|
|
206
226
|
* `POST /sessions/:id/events` and the first-party MCP `session_send_message`
|
|
@@ -208,7 +228,7 @@ export declare function createSessionForRequest(deps: ApiRouteDeps, grant: Acces
|
|
|
208
228
|
* enqueue, and usage recording. `toolsProvided: false` durably preserves an
|
|
209
229
|
* Tool selection is durable session state and never rides a follow-up prompt.
|
|
210
230
|
*/
|
|
211
|
-
export declare function
|
|
231
|
+
export declare function acceptSessionUserMessageWithOutcome(deps: AcceptSessionUserMessageDependencies, grant: AccessGrant, workspaceId: string, sessionId: string, input: {
|
|
212
232
|
text: string;
|
|
213
233
|
turnInstructions?: string | null;
|
|
214
234
|
resources?: ResourceRef[];
|
|
@@ -224,6 +244,12 @@ export declare function acceptSessionUserMessage(deps: AcceptSessionUserMessageD
|
|
|
224
244
|
}): Promise<{
|
|
225
245
|
accepted: SessionEvent;
|
|
226
246
|
turn: SessionTurn;
|
|
247
|
+
replay: boolean;
|
|
248
|
+
}>;
|
|
249
|
+
/** Backward-compatible entity-returning path used by existing REST callers. */
|
|
250
|
+
export declare function acceptSessionUserMessage(deps: Parameters<typeof acceptSessionUserMessageWithOutcome>[0], grant: Parameters<typeof acceptSessionUserMessageWithOutcome>[1], workspaceId: Parameters<typeof acceptSessionUserMessageWithOutcome>[2], sessionId: Parameters<typeof acceptSessionUserMessageWithOutcome>[3], input: Parameters<typeof acceptSessionUserMessageWithOutcome>[4]): Promise<{
|
|
251
|
+
accepted: SessionEvent;
|
|
252
|
+
turn: SessionTurn;
|
|
227
253
|
}>;
|
|
228
254
|
/**
|
|
229
255
|
* Shared title-write path for the manual rename route AND both MCP tools
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./dependencies";
|
|
|
2
2
|
export * from "./workflow-wake-contract";
|
|
3
3
|
export * from "./sandbox-types";
|
|
4
4
|
export * from "./managed-auth-type";
|
|
5
|
+
export * from "./managed-session";
|
|
5
6
|
export * from "./transcription";
|
|
6
7
|
export * from "./sandbox/fleet";
|
|
7
8
|
export * from "./sandbox/routing";
|