@opengeni/core 0.24.1 → 0.28.1
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/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-IBOEYG6N.js +34 -0
- package/dist/chunk-IBOEYG6N.js.map +1 -0
- package/dist/dependencies.d.ts +5 -1
- package/dist/domain/conversation-integrations.d.ts +225 -0
- package/dist/domain/fiken.d.ts +35 -0
- package/dist/domain/sessions.d.ts +11 -3
- package/dist/domain/video-generation-capabilities.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1667 -664
- package/dist/index.js.map +1 -1
- package/dist/managed-session.d.ts +5 -1
- package/dist/sandbox/fleet.d.ts +8 -5
- package/dist/session-authorization.d.ts +3 -1
- package/dist/transcription.d.ts +5 -0
- package/package.json +14 -10
- package/src/access/index.ts +14 -2
- package/src/canonical-human-identities.ts +27 -0
- package/src/dependencies.ts +5 -1
- package/src/domain/capabilities.ts +220 -283
- package/src/domain/conversation-integrations.ts +1238 -0
- package/src/domain/fiken.ts +88 -0
- package/src/domain/insights.ts +27 -17
- package/src/domain/scheduled-tasks.ts +16 -0
- package/src/domain/sessions.ts +122 -18
- package/src/domain/video-generation-capabilities.ts +37 -2
- package/src/index.ts +2 -0
- package/src/managed-session.ts +19 -2
- package/src/sandbox/fleet.ts +72 -66
- package/src/session-authorization.ts +187 -55
- package/src/transcription.ts +5 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Database } from "@opengeni/db";
|
|
2
|
+
import type { Context } from "hono";
|
|
3
|
+
import type { ManagedAuth } from "./managed-auth-type.js";
|
|
4
|
+
export type CanonicalHumanRequestIdentity = {
|
|
5
|
+
authUserId: string;
|
|
6
|
+
authSessionId: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function requireCanonicalHumanRequestIdentity(context: Context, input: {
|
|
9
|
+
db: Database;
|
|
10
|
+
managedAuth?: ManagedAuth | null;
|
|
11
|
+
allowRecovery?: boolean;
|
|
12
|
+
}): Promise<CanonicalHumanRequestIdentity>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getManagedSession
|
|
3
|
+
} from "./chunk-IBOEYG6N.js";
|
|
4
|
+
|
|
5
|
+
// src/canonical-human-identities.ts
|
|
6
|
+
import { HTTPException } from "hono/http-exception";
|
|
7
|
+
async function requireCanonicalHumanRequestIdentity(context, input) {
|
|
8
|
+
if (!input.managedAuth) {
|
|
9
|
+
throw new HTTPException(404, { message: "Canonical human identity is unavailable" });
|
|
10
|
+
}
|
|
11
|
+
const session = await getManagedSession(context, input.managedAuth, {
|
|
12
|
+
db: input.db,
|
|
13
|
+
...input.allowRecovery === void 0 ? {} : { allowIdentityRecovery: input.allowRecovery }
|
|
14
|
+
});
|
|
15
|
+
if (!session?.user || typeof session.session?.id !== "string") {
|
|
16
|
+
throw new HTTPException(401, { message: "Managed human authentication required" });
|
|
17
|
+
}
|
|
18
|
+
return { authUserId: session.user.id, authSessionId: session.session.id };
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
requireCanonicalHumanRequestIdentity
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=canonical-human-identities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/canonical-human-identities.ts"],"sourcesContent":["import type { Database } from \"@opengeni/db\";\nimport type { Context } from \"hono\";\nimport { HTTPException } from \"hono/http-exception\";\nimport type { ManagedAuth } from \"./managed-auth-type\";\nimport { getManagedSession } from \"./managed-session\";\n\nexport type CanonicalHumanRequestIdentity = {\n authUserId: string;\n authSessionId: string;\n};\n\nexport async function requireCanonicalHumanRequestIdentity(\n context: Context,\n input: { db: Database; managedAuth?: ManagedAuth | null; allowRecovery?: boolean },\n): Promise<CanonicalHumanRequestIdentity> {\n if (!input.managedAuth) {\n throw new HTTPException(404, { message: \"Canonical human identity is unavailable\" });\n }\n const session = await getManagedSession(context, input.managedAuth, {\n db: input.db,\n ...(input.allowRecovery === undefined ? {} : { allowIdentityRecovery: input.allowRecovery }),\n });\n if (!session?.user || typeof session.session?.id !== \"string\") {\n throw new HTTPException(401, { message: \"Managed human authentication required\" });\n }\n return { authUserId: session.user.id, authSessionId: session.session.id };\n}\n"],"mappings":";;;;;AAEA,SAAS,qBAAqB;AAS9B,eAAsB,qCACpB,SACA,OACwC;AACxC,MAAI,CAAC,MAAM,aAAa;AACtB,UAAM,IAAI,cAAc,KAAK,EAAE,SAAS,0CAA0C,CAAC;AAAA,EACrF;AACA,QAAM,UAAU,MAAM,kBAAkB,SAAS,MAAM,aAAa;AAAA,IAClE,IAAI,MAAM;AAAA,IACV,GAAI,MAAM,kBAAkB,SAAY,CAAC,IAAI,EAAE,uBAAuB,MAAM,cAAc;AAAA,EAC5F,CAAC;AACD,MAAI,CAAC,SAAS,QAAQ,OAAO,QAAQ,SAAS,OAAO,UAAU;AAC7D,UAAM,IAAI,cAAc,KAAK,EAAE,SAAS,wCAAwC,CAAC;AAAA,EACnF;AACA,SAAO,EAAE,YAAY,QAAQ,KAAK,IAAI,eAAe,QAAQ,QAAQ,GAAG;AAC1E;","names":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/managed-session.ts
|
|
2
|
+
import { validateCanonicalHumanSession } from "@opengeni/db/canonical-human-identities";
|
|
3
|
+
async function getManagedSession(c, auth, options) {
|
|
4
|
+
const result = await auth.api.getSession({
|
|
5
|
+
headers: c.req.raw.headers,
|
|
6
|
+
returnHeaders: true
|
|
7
|
+
});
|
|
8
|
+
for (const cookie of setCookieHeaders(result.headers)) {
|
|
9
|
+
c.header("set-cookie", cookie, { append: true });
|
|
10
|
+
}
|
|
11
|
+
const session = result.response;
|
|
12
|
+
if (!session?.user || !options?.db) return session;
|
|
13
|
+
const authSessionId = session.session?.id;
|
|
14
|
+
if (typeof authSessionId !== "string") return null;
|
|
15
|
+
const valid = await validateCanonicalHumanSession(options.db, {
|
|
16
|
+
authSessionId,
|
|
17
|
+
authUserId: session.user.id,
|
|
18
|
+
...options.allowIdentityRecovery === void 0 ? {} : { allowRecovery: options.allowIdentityRecovery }
|
|
19
|
+
});
|
|
20
|
+
return valid ? session : null;
|
|
21
|
+
}
|
|
22
|
+
function setCookieHeaders(headers) {
|
|
23
|
+
const getSetCookie = headers.getSetCookie;
|
|
24
|
+
if (getSetCookie) {
|
|
25
|
+
return getSetCookie.call(headers);
|
|
26
|
+
}
|
|
27
|
+
const cookie = headers.get("set-cookie");
|
|
28
|
+
return cookie ? [cookie] : [];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
getManagedSession
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=chunk-IBOEYG6N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/managed-session.ts"],"sourcesContent":["import type { Context } from \"hono\";\nimport type { ManagedAuth } from \"./managed-auth-type\";\nimport type { Database } from \"@opengeni/db\";\nimport { validateCanonicalHumanSession } from \"@opengeni/db/canonical-human-identities\";\n\n/**\n * Read a Better Auth session without bypassing its sliding-cookie renewal.\n *\n * Better Auth can refresh the durable session while resolving `getSession`.\n * Programmatic callers must explicitly request and forward the returned cookie\n * headers; the HTTP handler does this automatically, but direct API calls do not.\n */\nexport async function getManagedSession(\n c: Context,\n auth: ManagedAuth,\n options?: { db?: Database; allowIdentityRecovery?: boolean },\n) {\n const result = await auth.api.getSession({\n headers: c.req.raw.headers,\n returnHeaders: true,\n });\n\n for (const cookie of setCookieHeaders(result.headers)) {\n c.header(\"set-cookie\", cookie, { append: true });\n }\n\n const session = result.response;\n if (!session?.user || !options?.db) return session;\n const authSessionId = session.session?.id;\n if (typeof authSessionId !== \"string\") return null;\n const valid = await validateCanonicalHumanSession(options.db, {\n authSessionId,\n authUserId: session.user.id,\n ...(options.allowIdentityRecovery === undefined\n ? {}\n : { allowRecovery: options.allowIdentityRecovery }),\n });\n return valid ? session : null;\n}\n\nfunction setCookieHeaders(headers: Headers): string[] {\n const getSetCookie = (\n headers as Headers & {\n getSetCookie?: () => string[];\n }\n ).getSetCookie;\n if (getSetCookie) {\n return getSetCookie.call(headers);\n }\n\n const cookie = headers.get(\"set-cookie\");\n return cookie ? [cookie] : [];\n}\n"],"mappings":";AAGA,SAAS,qCAAqC;AAS9C,eAAsB,kBACpB,GACA,MACA,SACA;AACA,QAAM,SAAS,MAAM,KAAK,IAAI,WAAW;AAAA,IACvC,SAAS,EAAE,IAAI,IAAI;AAAA,IACnB,eAAe;AAAA,EACjB,CAAC;AAED,aAAW,UAAU,iBAAiB,OAAO,OAAO,GAAG;AACrD,MAAE,OAAO,cAAc,QAAQ,EAAE,QAAQ,KAAK,CAAC;AAAA,EACjD;AAEA,QAAM,UAAU,OAAO;AACvB,MAAI,CAAC,SAAS,QAAQ,CAAC,SAAS,GAAI,QAAO;AAC3C,QAAM,gBAAgB,QAAQ,SAAS;AACvC,MAAI,OAAO,kBAAkB,SAAU,QAAO;AAC9C,QAAM,QAAQ,MAAM,8BAA8B,QAAQ,IAAI;AAAA,IAC5D;AAAA,IACA,YAAY,QAAQ,KAAK;AAAA,IACzB,GAAI,QAAQ,0BAA0B,SAClC,CAAC,IACD,EAAE,eAAe,QAAQ,sBAAsB;AAAA,EACrD,CAAC;AACD,SAAO,QAAQ,UAAU;AAC3B;AAEA,SAAS,iBAAiB,SAA4B;AACpD,QAAM,eACJ,QAGA;AACF,MAAI,cAAc;AAChB,WAAO,aAAa,KAAK,OAAO;AAAA,EAClC;AAEA,QAAM,SAAS,QAAQ,IAAI,YAAY;AACvC,SAAO,SAAS,CAAC,MAAM,IAAI,CAAC;AAC9B;","names":[]}
|
package/dist/dependencies.d.ts
CHANGED
|
@@ -120,11 +120,15 @@ export type AppDependencies = {
|
|
|
120
120
|
managedAuth?: ManagedAuth | null;
|
|
121
121
|
/** Injectable Codex HTTP transport for deterministic API/provider tests. */
|
|
122
122
|
codexFetch?: typeof fetch;
|
|
123
|
+
/** Injectable xAI OAuth/subscription transport for deterministic API/provider tests. */
|
|
124
|
+
xaiFetch?: typeof fetch;
|
|
123
125
|
/** Injectable Slack Web API transport for deterministic bot-connection tests. */
|
|
124
126
|
slackFetch?: typeof fetch;
|
|
125
127
|
/** Injectable Google OAuth/Drive transport for deterministic connector tests. */
|
|
126
128
|
googleDriveFetch?: typeof fetch;
|
|
127
|
-
/** Injectable
|
|
129
|
+
/** Injectable Fiken API transport for deterministic connector tests. */
|
|
130
|
+
fikenFetch?: typeof fetch;
|
|
131
|
+
/** Injectable Integration Definition OAuth/API transport for deterministic tests. */
|
|
128
132
|
apiIntegrationOAuthFetch?: typeof fetch;
|
|
129
133
|
atlassianFetch?: typeof fetch;
|
|
130
134
|
/** Injectable MCP OAuth setup deadline for deterministic stalled-provider tests. */
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
declare const conversationProviderNamespaceBrand: unique symbol;
|
|
2
|
+
declare const conversationProviderOpaqueValueBrand: unique symbol;
|
|
3
|
+
declare const conversationEventIdentityBrand: unique symbol;
|
|
4
|
+
declare const conversationRouteIdentityBrand: unique symbol;
|
|
5
|
+
declare const conversationActorIdentityBrand: unique symbol;
|
|
6
|
+
declare const conversationOperationIdentityBrand: unique symbol;
|
|
7
|
+
declare const conversationRequestDigestBrand: unique symbol;
|
|
8
|
+
export declare const CONVERSATION_INTEGRATION_SCHEMA_VERSION: 1;
|
|
9
|
+
export declare const CONVERSATION_PROVIDER_NAMESPACE_MAX_UTF8_BYTES = 128;
|
|
10
|
+
export declare const CONVERSATION_PROVIDER_OPAQUE_ID_MAX_UTF8_BYTES = 512;
|
|
11
|
+
export declare const CONVERSATION_TEXT_MAX_UTF8_BYTES: number;
|
|
12
|
+
export declare const CONVERSATION_ATTACHMENT_MAX_COUNT = 16;
|
|
13
|
+
export declare const CONVERSATION_ATTACHMENT_NAME_MAX_UTF8_BYTES = 1024;
|
|
14
|
+
export declare const CONVERSATION_ATTACHMENT_MEDIA_TYPE_MAX_UTF8_BYTES = 128;
|
|
15
|
+
export declare const CONVERSATION_OPERATION_KEY_MAX_UTF8_BYTES = 512;
|
|
16
|
+
export declare const CONVERSATION_OUTCOME_CODE_MAX_UTF8_BYTES = 128;
|
|
17
|
+
export type ConversationProviderNamespace = string & {
|
|
18
|
+
readonly [conversationProviderNamespaceBrand]: true;
|
|
19
|
+
};
|
|
20
|
+
export type ConversationProviderOpaqueValue = string & {
|
|
21
|
+
readonly [conversationProviderOpaqueValueBrand]: true;
|
|
22
|
+
};
|
|
23
|
+
export type ConversationProviderOpaqueIdKind = "installation" | "actor" | "conversation" | "thread" | "event" | "message" | "attachment" | "receipt";
|
|
24
|
+
export type ConversationProviderOpaqueId<TKind extends ConversationProviderOpaqueIdKind = ConversationProviderOpaqueIdKind> = Readonly<{
|
|
25
|
+
provider: ConversationProviderNamespace;
|
|
26
|
+
kind: TKind;
|
|
27
|
+
value: ConversationProviderOpaqueValue;
|
|
28
|
+
}>;
|
|
29
|
+
export type ConversationInstallationIdentity = ConversationProviderOpaqueId<"installation">;
|
|
30
|
+
export type ConversationEventIdentity = `ciev1_${string}` & {
|
|
31
|
+
readonly [conversationEventIdentityBrand]: true;
|
|
32
|
+
};
|
|
33
|
+
export type ConversationRouteIdentity = `cirt1_${string}` & {
|
|
34
|
+
readonly [conversationRouteIdentityBrand]: true;
|
|
35
|
+
};
|
|
36
|
+
export type ConversationActorIdentity = `ciac1_${string}` & {
|
|
37
|
+
readonly [conversationActorIdentityBrand]: true;
|
|
38
|
+
};
|
|
39
|
+
export type ConversationOperationIdentity = `ciop1_${string}` & {
|
|
40
|
+
readonly [conversationOperationIdentityBrand]: true;
|
|
41
|
+
};
|
|
42
|
+
export type ConversationRequestDigest = `sha256:${string}` & {
|
|
43
|
+
readonly [conversationRequestDigestBrand]: true;
|
|
44
|
+
};
|
|
45
|
+
export type ConversationActorKind = "human" | "bot" | "system";
|
|
46
|
+
export type ConversationActorInput = Readonly<{
|
|
47
|
+
providerActorId: string;
|
|
48
|
+
kind: ConversationActorKind;
|
|
49
|
+
}>;
|
|
50
|
+
export type ConversationActor = Readonly<{
|
|
51
|
+
installation: ConversationInstallationIdentity;
|
|
52
|
+
providerActorId: ConversationProviderOpaqueId<"actor">;
|
|
53
|
+
kind: ConversationActorKind;
|
|
54
|
+
identity: ConversationActorIdentity;
|
|
55
|
+
}>;
|
|
56
|
+
export type ConversationRoute = Readonly<{
|
|
57
|
+
installation: ConversationInstallationIdentity;
|
|
58
|
+
providerConversationId: ConversationProviderOpaqueId<"conversation">;
|
|
59
|
+
providerThreadId: ConversationProviderOpaqueId<"thread"> | null;
|
|
60
|
+
identity: ConversationRouteIdentity;
|
|
61
|
+
}>;
|
|
62
|
+
export type ConversationRouteInput = Readonly<{
|
|
63
|
+
providerConversationId: string;
|
|
64
|
+
providerThreadId?: string | null;
|
|
65
|
+
}>;
|
|
66
|
+
export type ConversationStartSignal = Readonly<{
|
|
67
|
+
kind: "start";
|
|
68
|
+
}>;
|
|
69
|
+
export type ConversationContinueSignal = Readonly<{
|
|
70
|
+
kind: "continue";
|
|
71
|
+
}>;
|
|
72
|
+
export type ConversationControlSignal = Readonly<{
|
|
73
|
+
kind: "control";
|
|
74
|
+
control: "stop" | "resume";
|
|
75
|
+
}>;
|
|
76
|
+
export type ConversationSignal = ConversationStartSignal | ConversationContinueSignal | ConversationControlSignal;
|
|
77
|
+
export type ConversationAttachmentReference = Readonly<{
|
|
78
|
+
providerAttachmentId: ConversationProviderOpaqueId<"attachment">;
|
|
79
|
+
fileName: string | null;
|
|
80
|
+
mediaType: string | null;
|
|
81
|
+
byteSize: number | null;
|
|
82
|
+
contentSha256: string | null;
|
|
83
|
+
}>;
|
|
84
|
+
export type ConversationAttachmentReferenceInput = Readonly<{
|
|
85
|
+
providerAttachmentId: string;
|
|
86
|
+
fileName?: string | null;
|
|
87
|
+
mediaType?: string | null;
|
|
88
|
+
byteSize?: number | null;
|
|
89
|
+
contentSha256?: string | null;
|
|
90
|
+
}>;
|
|
91
|
+
export type ConversationInboundEnvelope = Readonly<{
|
|
92
|
+
schemaVersion: typeof CONVERSATION_INTEGRATION_SCHEMA_VERSION;
|
|
93
|
+
installation: ConversationInstallationIdentity;
|
|
94
|
+
actor: ConversationActor;
|
|
95
|
+
route: ConversationRoute;
|
|
96
|
+
providerEventId: ConversationProviderOpaqueId<"event">;
|
|
97
|
+
providerMessageId: ConversationProviderOpaqueId<"message">;
|
|
98
|
+
eventIdentity: ConversationEventIdentity;
|
|
99
|
+
occurredAt: string;
|
|
100
|
+
signal: ConversationSignal;
|
|
101
|
+
text: string;
|
|
102
|
+
attachments: readonly ConversationAttachmentReference[];
|
|
103
|
+
}>;
|
|
104
|
+
export type ConversationInboundEnvelopeInput = Readonly<{
|
|
105
|
+
provider: string;
|
|
106
|
+
installationId: string;
|
|
107
|
+
actor: ConversationActorInput;
|
|
108
|
+
route: ConversationRouteInput;
|
|
109
|
+
providerEventId: string;
|
|
110
|
+
providerMessageId: string;
|
|
111
|
+
occurredAt: string;
|
|
112
|
+
signal: ConversationSignal;
|
|
113
|
+
text: string;
|
|
114
|
+
attachments?: readonly ConversationAttachmentReferenceInput[];
|
|
115
|
+
}>;
|
|
116
|
+
type ConversationDeliveryCommandBase = Readonly<{
|
|
117
|
+
schemaVersion: typeof CONVERSATION_INTEGRATION_SCHEMA_VERSION;
|
|
118
|
+
operationId: ConversationOperationIdentity;
|
|
119
|
+
logicalOperationKey: string;
|
|
120
|
+
requestDigest: ConversationRequestDigest;
|
|
121
|
+
installation: ConversationInstallationIdentity;
|
|
122
|
+
route: ConversationRoute;
|
|
123
|
+
}>;
|
|
124
|
+
export type ConversationPostCommand = ConversationDeliveryCommandBase & Readonly<{
|
|
125
|
+
kind: "post";
|
|
126
|
+
targetProviderMessageId: null;
|
|
127
|
+
text: string;
|
|
128
|
+
}>;
|
|
129
|
+
export type ConversationUpdateCommand = ConversationDeliveryCommandBase & Readonly<{
|
|
130
|
+
kind: "update";
|
|
131
|
+
targetProviderMessageId: ConversationProviderOpaqueId<"message">;
|
|
132
|
+
text: string;
|
|
133
|
+
}>;
|
|
134
|
+
export type ConversationDeleteCommand = ConversationDeliveryCommandBase & Readonly<{
|
|
135
|
+
kind: "delete";
|
|
136
|
+
targetProviderMessageId: ConversationProviderOpaqueId<"message">;
|
|
137
|
+
text: null;
|
|
138
|
+
}>;
|
|
139
|
+
export type ConversationDeliveryCommand = ConversationPostCommand | ConversationUpdateCommand | ConversationDeleteCommand;
|
|
140
|
+
export type ConversationDeliveryCommandInput = Readonly<{
|
|
141
|
+
kind: "post";
|
|
142
|
+
logicalOperationKey: string;
|
|
143
|
+
installation: ConversationInstallationIdentity;
|
|
144
|
+
route: ConversationRoute;
|
|
145
|
+
text: string;
|
|
146
|
+
}> | Readonly<{
|
|
147
|
+
kind: "update";
|
|
148
|
+
logicalOperationKey: string;
|
|
149
|
+
installation: ConversationInstallationIdentity;
|
|
150
|
+
route: ConversationRoute;
|
|
151
|
+
targetProviderMessageId: string;
|
|
152
|
+
text: string;
|
|
153
|
+
}> | Readonly<{
|
|
154
|
+
kind: "delete";
|
|
155
|
+
logicalOperationKey: string;
|
|
156
|
+
installation: ConversationInstallationIdentity;
|
|
157
|
+
route: ConversationRoute;
|
|
158
|
+
targetProviderMessageId: string;
|
|
159
|
+
}>;
|
|
160
|
+
export type ConversationProviderReceipt = Readonly<{
|
|
161
|
+
schemaVersion: typeof CONVERSATION_INTEGRATION_SCHEMA_VERSION;
|
|
162
|
+
operationId: ConversationOperationIdentity;
|
|
163
|
+
requestDigest: ConversationRequestDigest;
|
|
164
|
+
installation: ConversationInstallationIdentity;
|
|
165
|
+
providerMessageId: ConversationProviderOpaqueId<"message">;
|
|
166
|
+
providerReceiptId: ConversationProviderOpaqueId<"receipt"> | null;
|
|
167
|
+
observedAt: string;
|
|
168
|
+
}>;
|
|
169
|
+
export type ConversationProviderReceiptInput = Readonly<{
|
|
170
|
+
command: ConversationDeliveryCommand;
|
|
171
|
+
providerMessageId: string;
|
|
172
|
+
providerReceiptId?: string | null;
|
|
173
|
+
observedAt: string;
|
|
174
|
+
}>;
|
|
175
|
+
export type ConversationDeliveryNotStarted = Readonly<{
|
|
176
|
+
status: "not_started";
|
|
177
|
+
code: string;
|
|
178
|
+
}>;
|
|
179
|
+
export type ConversationDeliveryUnknown = Readonly<{
|
|
180
|
+
status: "unknown";
|
|
181
|
+
code: string;
|
|
182
|
+
}>;
|
|
183
|
+
export type ConversationDeliveryRetryableFailure = Readonly<{
|
|
184
|
+
status: "retryable_failure";
|
|
185
|
+
code: string;
|
|
186
|
+
retryAfterMs: number | null;
|
|
187
|
+
}>;
|
|
188
|
+
export type ConversationDeliveryPermanentFailure = Readonly<{
|
|
189
|
+
status: "permanent_failure";
|
|
190
|
+
code: string;
|
|
191
|
+
}>;
|
|
192
|
+
export type ConversationDeliverySuccess = Readonly<{
|
|
193
|
+
status: "success";
|
|
194
|
+
receipt: ConversationProviderReceipt;
|
|
195
|
+
}>;
|
|
196
|
+
export type ConversationDeliveryOutcome = ConversationDeliveryNotStarted | ConversationDeliveryUnknown | ConversationDeliveryRetryableFailure | ConversationDeliveryPermanentFailure | ConversationDeliverySuccess;
|
|
197
|
+
export type ConversationDeliveryOutcomeInput = ConversationDeliveryNotStarted | ConversationDeliveryUnknown | Readonly<{
|
|
198
|
+
status: "retryable_failure";
|
|
199
|
+
code: string;
|
|
200
|
+
retryAfterMs?: number | null;
|
|
201
|
+
}> | ConversationDeliveryPermanentFailure | ConversationDeliverySuccess;
|
|
202
|
+
export type ConversationDeliveryNextAction = "retry_same_operation" | "reconcile" | "stop" | "complete";
|
|
203
|
+
export declare function normalizeConversationInboundEnvelope(input: ConversationInboundEnvelopeInput): ConversationInboundEnvelope;
|
|
204
|
+
export declare function normalizeConversationProviderNamespace(value: string): ConversationProviderNamespace;
|
|
205
|
+
export declare function normalizeConversationInstallationIdentity(input: {
|
|
206
|
+
provider: string | ConversationProviderNamespace;
|
|
207
|
+
providerInstallationId: string;
|
|
208
|
+
}): ConversationInstallationIdentity;
|
|
209
|
+
export declare function normalizeConversationActor(installation: ConversationInstallationIdentity, input: ConversationActorInput): ConversationActor;
|
|
210
|
+
export declare function normalizeConversationRoute(installation: ConversationInstallationIdentity, input: ConversationRouteInput): ConversationRoute;
|
|
211
|
+
export declare function normalizeConversationDeliveryCommand(input: ConversationDeliveryCommandInput): ConversationDeliveryCommand;
|
|
212
|
+
export declare function normalizeConversationProviderReceipt(input: ConversationProviderReceiptInput): ConversationProviderReceipt;
|
|
213
|
+
export declare function normalizeConversationDeliveryOutcome(input: ConversationDeliveryOutcomeInput): ConversationDeliveryOutcome;
|
|
214
|
+
export declare function conversationDeliveryNextAction(outcome: ConversationDeliveryOutcome): ConversationDeliveryNextAction;
|
|
215
|
+
export declare function assertConversationDeliveryMayRetry(outcome: ConversationDeliveryOutcome): asserts outcome is ConversationDeliveryNotStarted | ConversationDeliveryRetryableFailure;
|
|
216
|
+
export declare function assertConversationDeliveryCommandMatches(expected: ConversationDeliveryCommand, candidate: ConversationDeliveryCommand): void;
|
|
217
|
+
export declare function assertConversationInboundEnvelope(value: unknown): asserts value is ConversationInboundEnvelope;
|
|
218
|
+
export declare function assertConversationDeliveryCommand(value: unknown): asserts value is ConversationDeliveryCommand;
|
|
219
|
+
export declare function assertConversationProviderReceipt(value: unknown): asserts value is ConversationProviderReceipt;
|
|
220
|
+
export declare function assertConversationDeliveryOutcome(value: unknown): asserts value is ConversationDeliveryOutcome;
|
|
221
|
+
export declare function canonicalConversationInboundEnvelopeJson(envelope: ConversationInboundEnvelope): string;
|
|
222
|
+
export declare function canonicalConversationDeliveryCommandJson(command: ConversationDeliveryCommand): string;
|
|
223
|
+
export declare function canonicalConversationProviderReceiptJson(receipt: ConversationProviderReceipt): string;
|
|
224
|
+
export declare function canonicalConversationDeliveryOutcomeJson(outcome: ConversationDeliveryOutcome): string;
|
|
225
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ConnectionMetadata, type FikenCompanySummary, type FikenConnectionMetadata as FikenMetadata } from "@opengeni/contracts";
|
|
2
|
+
export declare function fikenConnectionMetadata(metadata: Record<string, unknown>): FikenMetadata | null;
|
|
3
|
+
/**
|
|
4
|
+
* A workspace-shared Fiken connection created through one of the verified
|
|
5
|
+
* install paths: the pasted personal API token (`api_key`) or the Fiken OAuth
|
|
6
|
+
* app flow (`oauth2`). Both are deliberately workspace-owned; personal
|
|
7
|
+
* ("Connect only for me") ownership needs the delegation-snapshot lane and is
|
|
8
|
+
* not yet wired for the first-party fiken tools.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isFikenConnection(connection: ConnectionMetadata): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The Fiken credential role is reserved for the verified install routes.
|
|
13
|
+
* Generic connection create/update must reject it so a caller cannot forge a
|
|
14
|
+
* "verified" Fiken row (with attacker-chosen companies metadata) that the
|
|
15
|
+
* first-party fiken tools would then bind to. Mirrors the Slack bot guard.
|
|
16
|
+
*/
|
|
17
|
+
export declare function hasReservedFikenMetadata(metadata: Record<string, unknown> | null | undefined): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* One default-company rule for both verified lanes: an explicit request wins
|
|
20
|
+
* when the credential can access it, then a still-accessible previous default
|
|
21
|
+
* survives reconnect, then a single-company credential auto-selects. Returns
|
|
22
|
+
* null (caller decides whether that is an error) when a requested slug is not
|
|
23
|
+
* among the verified companies.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveFikenDefaultCompanySlug(input: {
|
|
26
|
+
requested: string | null;
|
|
27
|
+
previous: string | null;
|
|
28
|
+
companies: readonly FikenCompanySummary[];
|
|
29
|
+
}): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* The row a capability tile or tool default should bind to when several Fiken
|
|
32
|
+
* connections exist: usable status first, then newest update, then immutable
|
|
33
|
+
* UUID descending as the stable tie-breaker.
|
|
34
|
+
*/
|
|
35
|
+
export declare function preferredFikenConnection<T extends Pick<ConnectionMetadata, "status" | "updatedAt" | "id">>(connections: readonly T[]): T | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Settings } from "@opengeni/config";
|
|
2
|
-
import { SessionSpawnDenial, type AccessGrant, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type Permission, type ReasoningEffort, type ResourceRef, type Session, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type SubmittedTimelineAnnotation, type TimelineAnnotation, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionToolPolicy, type SessionTurn, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1 } from "@opengeni/contracts";
|
|
2
|
+
import { SessionSpawnDenial, type AccessGrant, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type Permission, type ReasoningEffort, type ResourceRef, type Session, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type SubmittedTimelineAnnotation, type TimelineAnnotation, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionToolPolicy, type SessionTurn, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1, type XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
|
|
3
3
|
import { type CreateSessionMcpServerInput, type Database, type UpdateSessionMcpServerCredentialsInput, type SessionCommandActor } from "@opengeni/db";
|
|
4
4
|
import { type EventBus } from "@opengeni/events";
|
|
5
5
|
import type { AcceptSessionUserMessageDependencies, ApiRouteDeps, SessionWorkflowClient } from "../dependencies.js";
|
|
@@ -14,7 +14,10 @@ export declare class SessionSpawnDeniedError extends Error {
|
|
|
14
14
|
* child omission snapshots the parent's exact effective selection. Explicit
|
|
15
15
|
* [] is authoritative and must never widen.
|
|
16
16
|
*/
|
|
17
|
-
export declare function resolveFirstPartyMcpToolsForCreate(requested: FirstPartyMcpToolName[] | undefined, parentStored: FirstPartyMcpToolName[] | null | undefined
|
|
17
|
+
export declare function resolveFirstPartyMcpToolsForCreate(requested: FirstPartyMcpToolName[] | undefined, parentStored: FirstPartyMcpToolName[] | null | undefined, policy?: {
|
|
18
|
+
default: readonly FirstPartyMcpToolName[];
|
|
19
|
+
allowed: readonly FirstPartyMcpToolName[];
|
|
20
|
+
}): FirstPartyMcpToolName[];
|
|
18
21
|
export declare function sessionSpawnDenialEnvelope(error: SessionSpawnDeniedError): {
|
|
19
22
|
readonly error: {
|
|
20
23
|
readonly code: "nested_agent_depth_exceeded" | "nested_agent_depth_override_forbidden";
|
|
@@ -66,7 +69,10 @@ export declare function createAndStartSessionWithOutcome(input: {
|
|
|
66
69
|
requestedSessionId?: string;
|
|
67
70
|
db: Database;
|
|
68
71
|
bus: EventBus;
|
|
69
|
-
workflowClient: SessionWorkflowClient
|
|
72
|
+
workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
|
|
73
|
+
/** Internal database-only composition seam. The exact session shell and this
|
|
74
|
+
* linkage commit together before its first event/turn can be initialized. */
|
|
75
|
+
beforeCreateCommit?: (tx: Database, sessionId: string) => Promise<void>;
|
|
70
76
|
accountId: string;
|
|
71
77
|
workspaceId: string;
|
|
72
78
|
initialMessage: string;
|
|
@@ -96,6 +102,7 @@ export declare function createAndStartSessionWithOutcome(input: {
|
|
|
96
102
|
} | null;
|
|
97
103
|
rigId?: string | null;
|
|
98
104
|
rigVersionId?: string | null;
|
|
105
|
+
channelId?: string | null;
|
|
99
106
|
goal?: GoalSpec | null;
|
|
100
107
|
instructions?: string | null;
|
|
101
108
|
policyRole?: string | null;
|
|
@@ -104,6 +111,7 @@ export declare function createAndStartSessionWithOutcome(input: {
|
|
|
104
111
|
mcpServers?: CreateSessionMcpServerInput[];
|
|
105
112
|
sessionMcpServers?: SessionMcpServerMetadata[];
|
|
106
113
|
personalConnectionDelegations?: McpPersonalConnectionDelegation[];
|
|
114
|
+
xaiProviderAccountAuthoritySnapshot?: XaiProviderAccountAuthoritySnapshotV1;
|
|
107
115
|
parentSessionId?: string | null;
|
|
108
116
|
createIdempotencyKey?: string | null;
|
|
109
117
|
sandboxGroupId?: string | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VideoGenerationCapabilities, type VideoGenerationModelCapability, type VideoGenerationPolicy as VideoGenerationPolicyType } from "@opengeni/contracts";
|
|
2
2
|
/** Reviewed executable catalog. Dynamic workspace policy never mutates tool schemas. */
|
|
3
3
|
export declare const VIDEO_GENERATION_MODEL_CATALOG: readonly VideoGenerationModelCapability[];
|
|
4
|
+
export declare function videoGenerationModelSupportsFundingSource(modelId: string, fundingSource: VideoGenerationPolicyType["fundingSource"]): boolean;
|
|
4
5
|
export declare function defaultVideoGenerationPolicy(): VideoGenerationPolicyType;
|
|
5
6
|
export declare function videoGenerationCapabilitiesForPolicy(input: {
|
|
6
7
|
policy: VideoGenerationPolicyType;
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export * from "./domain/durable-learning-slack-publication.js";
|
|
|
26
26
|
export * from "./domain/slack-publication-secret-safety.js";
|
|
27
27
|
export * from "./domain/company-profile-durable-learning-adapter.js";
|
|
28
28
|
export * from "./domain/slack-bot.js";
|
|
29
|
+
export * from "./domain/conversation-integrations.js";
|
|
30
|
+
export * from "./domain/fiken.js";
|
|
29
31
|
export * from "./domain/workspace-members.js";
|
|
30
32
|
export * from "./domain/video-generation.js";
|
|
31
33
|
export * from "./domain/video-generation-capabilities.js";
|