@opengeni/core 0.28.1 → 1.0.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/README.md +1 -1
- package/dist/access/external-actor-authority.d.ts +47 -0
- package/dist/access/index.d.ts +182 -3
- package/dist/access/service-initiator.d.ts +3 -0
- package/dist/application/api-integration-servers.d.ts +20 -0
- package/dist/application/archived-session-imports.d.ts +6 -0
- package/dist/application/composer-submit.d.ts +24 -0
- package/dist/application/connect-authority.d.ts +13 -0
- package/dist/application/connect-operation.d.ts +31 -0
- package/dist/application/external-continuation.d.ts +15 -0
- package/dist/application/external-identity-lifecycle.d.ts +20 -0
- package/dist/application/external-link-work-admission.d.ts +12 -0
- package/dist/application/external-workspace-members.d.ts +34 -0
- package/dist/application/modal-native-worker-host-transport.d.ts +297 -0
- package/dist/application/new-session-drafts.d.ts +39 -2
- package/dist/application/sandbox-recovery.d.ts +58 -0
- package/dist/application/session-commands.d.ts +26 -13
- package/dist/application/session-mcp-credential-rotation.d.ts +29 -0
- package/dist/application/session-tenancy.d.ts +19 -0
- package/dist/application/user-resource-grants.d.ts +20 -0
- package/dist/billing/limits.d.ts +11 -0
- package/dist/canonical-human-identities.d.ts +7 -2
- package/dist/canonical-human-identities.js +17 -4
- package/dist/canonical-human-identities.js.map +1 -1
- package/dist/{chunk-6WKPWE5S.js → chunk-2MKMRGSY.js} +108 -24
- package/dist/chunk-2MKMRGSY.js.map +1 -0
- package/dist/{chunk-NYPMQ7NO.js → chunk-GVO3N37G.js} +205 -37
- package/dist/chunk-GVO3N37G.js.map +1 -0
- package/dist/{chunk-JJU6I5XD.js → chunk-LCQXNR62.js} +36 -10
- package/dist/chunk-LCQXNR62.js.map +1 -0
- package/dist/chunk-MM6N7CTO.js +387 -0
- package/dist/chunk-MM6N7CTO.js.map +1 -0
- package/dist/chunk-QO5GVFFO.js +235 -0
- package/dist/chunk-QO5GVFFO.js.map +1 -0
- package/dist/codex-model-availability.d.ts +14 -0
- package/dist/default-session-model.d.ts +139 -0
- package/dist/dependencies.d.ts +87 -4
- package/dist/developer-setup-credential-ceiling.d.ts +10 -0
- package/dist/domain/agent-config-resolution.d.ts +49 -0
- package/dist/domain/automations.d.ts +58 -0
- package/dist/domain/capabilities.d.ts +22 -4
- package/dist/domain/company-profile-agent-admin.d.ts +25 -0
- package/dist/domain/connection-account-selection-error.d.ts +8 -0
- package/dist/domain/connector-tool-permissions.d.ts +36 -0
- package/dist/domain/direct-model-provider.d.ts +3 -0
- package/dist/domain/editable-artifacts/agent-application.d.ts +10 -1
- package/dist/domain/editable-artifacts/durable-export.d.ts +22 -1
- package/dist/domain/editable-artifacts/ports.d.ts +10 -0
- package/dist/domain/editable-artifacts/service.d.ts +4 -3
- package/dist/domain/environments.d.ts +5 -9
- package/dist/domain/external-creation-attribution.d.ts +6 -0
- package/dist/domain/file-owner.d.ts +8 -0
- package/dist/domain/github-action-policies.d.ts +36 -0
- package/dist/domain/github-repository-bindings.d.ts +117 -0
- package/dist/domain/github-skill-source.d.ts +5 -0
- package/dist/domain/governed-learning-slack-publication.d.ts +45 -0
- package/dist/domain/insights-timing.d.ts +16 -0
- package/dist/domain/insights-usage.d.ts +27 -0
- package/dist/domain/insights.d.ts +28 -1
- package/dist/domain/knowledge-files.d.ts +20 -0
- package/dist/domain/knowledge-messages.d.ts +39 -0
- package/dist/domain/knowledge-messages.test.d.ts +1 -0
- package/dist/domain/knowledge-preparation.d.ts +10 -0
- package/dist/domain/knowledge-preparation.test.d.ts +1 -0
- package/dist/domain/knowledge-search.d.ts +15 -0
- package/dist/domain/knowledge-search.test.d.ts +1 -0
- package/dist/domain/knowledge.d.ts +9 -0
- package/dist/domain/mcp-account-bindings.d.ts +19 -0
- package/dist/domain/mcp-account-routes.d.ts +21 -0
- package/dist/domain/native-mcp-connection-admission.d.ts +3 -0
- package/dist/domain/organization-integration-catalog.d.ts +15 -0
- package/dist/domain/organization-membership-lifecycle.d.ts +1 -0
- package/dist/domain/personal-connection-delegations.d.ts +87 -4
- package/dist/domain/pr-review.d.ts +249 -0
- package/dist/domain/resources.d.ts +24 -3
- package/dist/domain/scheduled-task-access.d.ts +247 -0
- package/dist/domain/scheduled-tasks.d.ts +103 -6
- package/dist/domain/session-connection-accounts.d.ts +16 -0
- package/dist/domain/session-file-access.d.ts +4 -0
- package/dist/domain/session-native-connection-replacement.d.ts +14 -0
- package/dist/domain/session-start-timing.d.ts +7 -0
- package/dist/domain/session-tool-policy.d.ts +93 -4
- package/dist/domain/sessions.d.ts +275 -28
- package/dist/domain/skill-imports.d.ts +1 -0
- package/dist/domain/skill-search.d.ts +30 -0
- package/dist/domain/skills.d.ts +117 -0
- package/dist/domain/slack-bot.d.ts +46 -1
- package/dist/domain/workspace-members.d.ts +8 -1
- package/dist/editable-artifact-live/application.d.ts +12 -3
- package/dist/editable-artifact-live/ports.d.ts +0 -1
- package/dist/editable-artifact-live/server.d.ts +5 -2
- package/dist/editable-artifact-live/ticket.d.ts +2 -2
- package/dist/editable-artifact-live/types.d.ts +14 -2
- package/dist/editable-artifact-live.js +2 -2
- package/dist/editable-artifacts.js +10 -4
- package/dist/index.d.ts +49 -3
- package/dist/index.js +18812 -6833
- package/dist/index.js.map +1 -1
- package/dist/managed-auth-session-sets.d.ts +131 -0
- package/dist/managed-auth-session-sets.js +51 -0
- package/dist/managed-auth-session-sets.js.map +1 -0
- package/dist/managed-session.d.ts +98 -11
- package/dist/model-catalog.d.ts +117 -0
- package/dist/product-usage-metrics.d.ts +30 -0
- package/dist/rigs/index.d.ts +22 -5
- package/dist/rigs/provider-images.d.ts +1 -1
- package/dist/sandbox/fleet.d.ts +59 -10
- package/dist/sandbox/routing.d.ts +22 -2
- package/dist/sandbox/runtime-settings.d.ts +56 -0
- package/dist/session-authorization.d.ts +38 -1
- package/dist/site-session-origin.d.ts +9 -0
- package/dist/transcription.d.ts +12 -1
- package/dist/turn-surface.d.ts +18 -0
- package/dist/user-presence.d.ts +32 -0
- package/package.json +18 -11
- package/src/access/external-actor-authority.ts +94 -0
- package/src/access/index.ts +1386 -44
- package/src/access/service-initiator.ts +50 -0
- package/src/application/api-integration-servers.ts +215 -0
- package/src/application/archived-session-imports.ts +161 -0
- package/src/application/composer-submit.ts +77 -0
- package/src/application/connect-authority.ts +77 -0
- package/src/application/connect-operation.ts +80 -0
- package/src/application/external-continuation.ts +129 -0
- package/src/application/external-identity-lifecycle.ts +48 -0
- package/src/application/external-link-work-admission.ts +90 -0
- package/src/application/external-workspace-members.ts +232 -0
- package/src/application/modal-native-worker-host-transport.ts +263 -0
- package/src/application/new-session-drafts.ts +222 -29
- package/src/application/sandbox-recovery.ts +78 -0
- package/src/application/session-commands.ts +430 -73
- package/src/application/session-mcp-credential-rotation.ts +217 -0
- package/src/application/session-tenancy.ts +445 -0
- package/src/application/user-resource-grants.ts +154 -0
- package/src/billing/limits.ts +103 -24
- package/src/canonical-human-identities.ts +22 -3
- package/src/codex-model-availability.ts +136 -0
- package/src/default-session-model.ts +656 -0
- package/src/dependencies.ts +97 -5
- package/src/developer-setup-credential-ceiling.ts +60 -0
- package/src/domain/agent-config-resolution.ts +148 -0
- package/src/domain/automations.ts +270 -0
- package/src/domain/capabilities.ts +244 -151
- package/src/domain/company-profile-agent-admin.ts +56 -0
- package/src/domain/connection-account-selection-error.ts +19 -0
- package/src/domain/connector-tool-permissions.ts +371 -0
- package/src/domain/direct-model-provider.ts +62 -0
- package/src/domain/editable-artifacts/agent-application.ts +61 -15
- package/src/domain/editable-artifacts/durable-export.ts +100 -5
- package/src/domain/editable-artifacts/in-memory.ts +6 -0
- package/src/domain/editable-artifacts/ports.ts +11 -0
- package/src/domain/editable-artifacts/service.ts +32 -1
- package/src/domain/editable-artifacts/snapshot-compaction.ts +9 -5
- package/src/domain/editable-artifacts/snapshot-verifier-genesis.ts +10 -8
- package/src/domain/editable-artifacts/snapshot-verifier.ts +10 -3
- package/src/domain/environments.ts +25 -45
- package/src/domain/external-creation-attribution.ts +22 -0
- package/src/domain/file-owner.ts +67 -0
- package/src/domain/github-action-policies.ts +169 -0
- package/src/domain/github-repository-bindings.ts +295 -0
- package/src/domain/github-skill-source.ts +233 -0
- package/src/domain/governed-learning-slack-publication.ts +157 -0
- package/src/domain/insights-timing.ts +95 -0
- package/src/domain/insights-usage.ts +67 -0
- package/src/domain/insights.ts +270 -169
- package/src/domain/knowledge-files.ts +46 -0
- package/src/domain/knowledge-messages.test.ts +91 -0
- package/src/domain/knowledge-messages.ts +106 -0
- package/src/domain/knowledge-preparation.test.ts +276 -0
- package/src/domain/knowledge-preparation.ts +147 -0
- package/src/domain/knowledge-search.test.ts +561 -0
- package/src/domain/knowledge-search.ts +256 -0
- package/src/domain/knowledge.ts +133 -0
- package/src/domain/mcp-account-bindings.ts +171 -0
- package/src/domain/mcp-account-routes.ts +121 -0
- package/src/domain/native-mcp-connection-admission.ts +14 -0
- package/src/domain/organization-integration-catalog.ts +88 -0
- package/src/domain/organization-membership-lifecycle.ts +10 -0
- package/src/domain/personal-connection-delegations.ts +758 -115
- package/src/domain/pr-review.ts +687 -0
- package/src/domain/resources.ts +182 -25
- package/src/domain/scheduled-task-access.ts +1052 -0
- package/src/domain/scheduled-tasks.ts +1952 -215
- package/src/domain/session-connection-accounts.ts +67 -0
- package/src/domain/session-file-access.ts +47 -0
- package/src/domain/session-native-connection-replacement.ts +64 -0
- package/src/domain/session-start-timing.ts +55 -0
- package/src/domain/session-tool-policy.ts +443 -19
- package/src/domain/sessions.ts +3417 -619
- package/src/domain/skill-imports.ts +137 -17
- package/src/domain/skill-search.ts +221 -0
- package/src/domain/skills.ts +104 -0
- package/src/domain/slack-bot.ts +128 -3
- package/src/domain/workspace-members.ts +34 -2
- package/src/editable-artifact-live/application.ts +29 -4
- package/src/editable-artifact-live/ports.ts +0 -1
- package/src/editable-artifact-live/server.ts +167 -13
- package/src/editable-artifact-live/ticket.ts +87 -6
- package/src/editable-artifact-live/types.ts +16 -2
- package/src/editable-artifact-live/wire.ts +0 -10
- package/src/index.ts +69 -4
- package/src/managed-auth-session-sets.ts +371 -0
- package/src/managed-session.ts +520 -2
- package/src/model-catalog.ts +873 -0
- package/src/product-usage-metrics.ts +101 -0
- package/src/rigs/index.ts +179 -63
- package/src/rigs/provider-images.ts +2 -3
- package/src/sandbox/fleet.ts +471 -59
- package/src/sandbox/routing.ts +160 -33
- package/src/sandbox/runtime-settings.ts +281 -0
- package/src/session-authorization.ts +262 -78
- package/src/site-session-origin.ts +22 -0
- package/src/transcription.ts +13 -1
- package/src/turn-surface.ts +45 -0
- package/src/user-presence.ts +134 -0
- package/dist/chunk-6WKPWE5S.js.map +0 -1
- package/dist/chunk-IBOEYG6N.js +0 -34
- package/dist/chunk-IBOEYG6N.js.map +0 -1
- package/dist/chunk-JJU6I5XD.js.map +0 -1
- package/dist/chunk-NYPMQ7NO.js.map +0 -1
- package/dist/domain/durable-learning-slack-publication.d.ts +0 -72
- package/dist/domain/packs.d.ts +0 -55
- package/src/domain/durable-learning-slack-publication.ts +0 -202
- package/src/domain/packs.ts +0 -556
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { GovernedLearningActivationReceipt, GovernedLearningActivationUndoReceipt } from "@opengeni/contracts";
|
|
2
|
+
import { enqueueMemorySlackPublication, getCurrentMemorySlackPublicationConfiguration, resolveGovernedLearningEvidenceOrigin, type Database, type EnqueueMemorySlackPublicationResult, type GovernedLearningEvidenceOrigin } from "@opengeni/db";
|
|
3
|
+
/**
|
|
4
|
+
* Narrow post-persistence notification port for governed-learning activation
|
|
5
|
+
* and undo receipts (migration 0269). The evaluator/controller own policy,
|
|
6
|
+
* authority, and the immutable receipts; this adapter only projects bounded,
|
|
7
|
+
* content-free facts into the existing Slack publication outbox. It never
|
|
8
|
+
* reads proposal content, evidence bytes, or destination bodies.
|
|
9
|
+
*/
|
|
10
|
+
export type GovernedLearningSlackEvent = {
|
|
11
|
+
kind: "activated";
|
|
12
|
+
receipt: GovernedLearningActivationReceipt;
|
|
13
|
+
sessionId: string | null;
|
|
14
|
+
attemptId: string | null;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "undone";
|
|
17
|
+
receipt: GovernedLearningActivationUndoReceipt;
|
|
18
|
+
};
|
|
19
|
+
export type GovernedLearningSlackPublicationResult = {
|
|
20
|
+
kind: "evidence_origin_unresolved" | "slack_derived_evidence" | "policy_quiet";
|
|
21
|
+
enqueue: null;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "enqueued";
|
|
24
|
+
enqueue: EnqueueMemorySlackPublicationResult;
|
|
25
|
+
};
|
|
26
|
+
export type GovernedLearningSlackProjection = {
|
|
27
|
+
summary: string;
|
|
28
|
+
outcome: "activated" | "undone";
|
|
29
|
+
destination: "instruction_policy" | "preference";
|
|
30
|
+
sourceKind: "scoped-knowledge-evidence" | "task-note" | null;
|
|
31
|
+
destinationRevisionId: string;
|
|
32
|
+
destinationVersion: number;
|
|
33
|
+
activationReceiptId: string;
|
|
34
|
+
undoReceiptId: string | null;
|
|
35
|
+
occurredAt: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function governedLearningSlackImportance(event: GovernedLearningSlackEvent): "major" | "normal" | "minor";
|
|
38
|
+
export declare function governedLearningSlackProjection(event: GovernedLearningSlackEvent): GovernedLearningSlackProjection;
|
|
39
|
+
/** Evidence that itself came from a Slack knowledge connector must never republish to Slack. */
|
|
40
|
+
export declare function governedLearningEvidenceIsSlackDerived(origin: GovernedLearningEvidenceOrigin): boolean;
|
|
41
|
+
export declare function publishGovernedLearningEventToSlack(db: Database, event: GovernedLearningSlackEvent, options?: {
|
|
42
|
+
resolveEvidenceOrigin?: typeof resolveGovernedLearningEvidenceOrigin;
|
|
43
|
+
configuration?: typeof getCurrentMemorySlackPublicationConfiguration;
|
|
44
|
+
enqueue?: typeof enqueueMemorySlackPublication;
|
|
45
|
+
}): Promise<GovernedLearningSlackPublicationResult>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type DatabaseTimingObservation } from "@opengeni/db";
|
|
2
|
+
import type { Observability } from "@opengeni/observability";
|
|
3
|
+
declare const phases: Set<"attached_sessions" | "auth" | "floor_sessions" | "live_warm" | "model_bundle" | "online_machines" | "require_workspace" | "scheduled_fires" | "scheduled_tasks" | "session_depth" | "usage_bundle">;
|
|
4
|
+
export type InsightsPhase = typeof phases extends Set<infer T> ? T : never;
|
|
5
|
+
export type InsightsPhaseObservation = {
|
|
6
|
+
phase: InsightsPhase;
|
|
7
|
+
stage: "helper" | DatabaseTimingObservation["stage"];
|
|
8
|
+
outcome: "completed" | "failed";
|
|
9
|
+
durationMs: number;
|
|
10
|
+
};
|
|
11
|
+
export type InsightsPhaseObserver = (observation: InsightsPhaseObservation) => void;
|
|
12
|
+
/** Helper durations overlap under Promise.all; they must not be summed as request latency. */
|
|
13
|
+
export declare function measureInsightsPhase<T>(observer: InsightsPhaseObserver | undefined, phase: InsightsPhase, work: () => Promise<T>): Promise<T>;
|
|
14
|
+
/** Closed runtime label projection: caller input, SQL and identities never become labels. */
|
|
15
|
+
export declare function workspaceInsightsPhaseMetricObserver(observability: Pick<Observability, "observeHistogram"> | null | undefined): InsightsPhaseObserver | undefined;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InsightsCallsQuery, InsightsCallsResponse, InsightsUsageQuery, InsightsUsageRange, InsightsUsageResponse } from "@opengeni/contracts/insights-usage";
|
|
2
|
+
import { type Database } from "@opengeni/db";
|
|
3
|
+
export type InsightsQueryScope = {
|
|
4
|
+
accountId: string;
|
|
5
|
+
/** null means organization scope; it does not grant workspace/session access. */
|
|
6
|
+
workspaceId: string | null;
|
|
7
|
+
/** Server-verified metadata authority; billing permission alone supplies none. */
|
|
8
|
+
detailsWorkspaceIds?: readonly string[];
|
|
9
|
+
/** Existing organization service-key authority applies only to shared workspaces. */
|
|
10
|
+
detailsSharedWorkspaces?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function getInsightsUsage(db: Database, input: InsightsQueryScope & {
|
|
13
|
+
query: InsightsUsageQuery;
|
|
14
|
+
now?: Date;
|
|
15
|
+
}): Promise<InsightsUsageResponse>;
|
|
16
|
+
export declare function listInsightsCalls(db: Database, input: InsightsQueryScope & {
|
|
17
|
+
query: InsightsCallsQuery;
|
|
18
|
+
now?: Date;
|
|
19
|
+
}): Promise<InsightsCallsResponse>;
|
|
20
|
+
/** UTC windows retain the actual request timestamp, including empty midnight windows. */
|
|
21
|
+
export declare function insightsUsageWindow(range: InsightsUsageRange, now?: Date): {
|
|
22
|
+
since: Date;
|
|
23
|
+
until: Date;
|
|
24
|
+
priorSince: Date;
|
|
25
|
+
priorUntil: Date;
|
|
26
|
+
bucket: "day" | "hour";
|
|
27
|
+
};
|
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
import { type Settings } from "@opengeni/config";
|
|
2
2
|
import { type InsightsRange, type WorkspaceInsightsResponse } from "@opengeni/contracts";
|
|
3
3
|
import { type Database } from "@opengeni/db";
|
|
4
|
+
import { type InsightsPhaseObserver } from "./insights-timing.js";
|
|
5
|
+
export { measureInsightsPhase, workspaceInsightsPhaseMetricObserver } from "./insights-timing.js";
|
|
6
|
+
export type { InsightsPhaseObservation, InsightsPhaseObserver } from "./insights-timing.js";
|
|
7
|
+
export declare const WORKSPACE_INSIGHTS_PROVIDER_FILTER_MAX_UTF8_BYTES = 256;
|
|
8
|
+
export declare const WORKSPACE_INSIGHTS_MODEL_FILTER_MAX_UTF8_BYTES = 512;
|
|
9
|
+
export type WorkspaceInsightsFilterField = "provider" | "model" | "rootSessionId" | "sessionId";
|
|
10
|
+
export declare class WorkspaceInsightsFilterValidationError extends Error {
|
|
11
|
+
readonly field: WorkspaceInsightsFilterField;
|
|
12
|
+
readonly maxUtf8Bytes: number;
|
|
13
|
+
constructor(field: WorkspaceInsightsFilterField, maxUtf8Bytes: number, message?: string);
|
|
14
|
+
}
|
|
15
|
+
/** Normalize a session drilldown scope; only exact UUIDs are accepted. */
|
|
16
|
+
export declare function normalizeWorkspaceInsightsSessionScope(value: string | null | undefined, field: "rootSessionId" | "sessionId"): string | null;
|
|
17
|
+
/** Normalize the public filter sentinel and enforce the database authority envelope. */
|
|
18
|
+
export declare function normalizeWorkspaceInsightsFilter(value: string | null | undefined, field: WorkspaceInsightsFilterField): string | null;
|
|
4
19
|
export type GetWorkspaceInsightsInput = {
|
|
5
20
|
workspaceId: string;
|
|
6
21
|
range: InsightsRange;
|
|
7
22
|
provider?: string | null;
|
|
8
23
|
model?: string | null;
|
|
24
|
+
rootSessionId?: string | null;
|
|
25
|
+
sessionId?: string | null;
|
|
9
26
|
now?: Date;
|
|
10
27
|
};
|
|
11
|
-
export declare function
|
|
28
|
+
export declare function insightsSessionLabel(input: {
|
|
29
|
+
id: string;
|
|
30
|
+
title: string | null;
|
|
31
|
+
depth?: number | null;
|
|
32
|
+
}): string;
|
|
33
|
+
export declare function insightsProjectLabel(input: {
|
|
34
|
+
kind: "project" | "other" | "unfiled" | "unavailable" | "deleted";
|
|
35
|
+
name: string | null;
|
|
36
|
+
projects: number;
|
|
37
|
+
}): string;
|
|
38
|
+
export declare function getWorkspaceInsights(db: Database, settings: Settings, input: GetWorkspaceInsightsInput, observePhase?: InsightsPhaseObserver): Promise<WorkspaceInsightsResponse>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type KnowledgeContext } from "@opengeni/db";
|
|
2
|
+
import type { ApiRouteDeps } from "../dependencies.js";
|
|
3
|
+
/** Existing original -> one source revision, through the ordinary task policy. */
|
|
4
|
+
export declare function prepareKnowledgeFile(deps: Pick<ApiRouteDeps, "db" | "objectStorage" | "getDocumentServices">, context: KnowledgeContext, fileId: string, purpose?: "evidence" | "reference"): Promise<{
|
|
5
|
+
status: "retained";
|
|
6
|
+
fileId: string;
|
|
7
|
+
filename: string;
|
|
8
|
+
receipt: {
|
|
9
|
+
operationId: string;
|
|
10
|
+
entryId: string;
|
|
11
|
+
revisionId: string;
|
|
12
|
+
version: number;
|
|
13
|
+
outcome: "archived" | "pending" | "published" | "rejected";
|
|
14
|
+
reviewBatchId: string | null;
|
|
15
|
+
replayed: boolean;
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
status: "disabled";
|
|
19
|
+
fileId: string;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type Database, type KnowledgeContext } from "@opengeni/db";
|
|
2
|
+
/** Retain actual message bytes, never a model-authored reconstruction of a confirmation. */
|
|
3
|
+
export declare function retainKnowledgeMessage(db: Database, context: KnowledgeContext, messageId?: string): Promise<{
|
|
4
|
+
retained: boolean;
|
|
5
|
+
reason: string;
|
|
6
|
+
entryId?: never;
|
|
7
|
+
revisionId?: never;
|
|
8
|
+
outcome?: never;
|
|
9
|
+
messageId?: never;
|
|
10
|
+
reused?: never;
|
|
11
|
+
} | {
|
|
12
|
+
retained: boolean;
|
|
13
|
+
reason: string;
|
|
14
|
+
entryId: string;
|
|
15
|
+
revisionId?: never;
|
|
16
|
+
outcome?: never;
|
|
17
|
+
messageId?: never;
|
|
18
|
+
reused?: never;
|
|
19
|
+
} | {
|
|
20
|
+
reason?: never;
|
|
21
|
+
retained: boolean;
|
|
22
|
+
entryId: string;
|
|
23
|
+
revisionId: string;
|
|
24
|
+
outcome: "pending" | "published" | "superseded";
|
|
25
|
+
messageId: string;
|
|
26
|
+
reused: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
operationId: string;
|
|
29
|
+
entryId: string;
|
|
30
|
+
revisionId: string;
|
|
31
|
+
version: number;
|
|
32
|
+
outcome: "archived" | "pending" | "published" | "rejected";
|
|
33
|
+
reviewBatchId: string | null;
|
|
34
|
+
replayed: boolean;
|
|
35
|
+
reason?: never;
|
|
36
|
+
reused?: never;
|
|
37
|
+
retained: boolean;
|
|
38
|
+
messageId: string;
|
|
39
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KnowledgeSavePreparationRequest, type KnowledgeSavePreparationResponse } from "@opengeni/contracts";
|
|
2
|
+
import { getKnowledgeEntry, listKnowledgeEntries, type Database, type KnowledgeContext } from "@opengeni/db";
|
|
3
|
+
import type { DocumentEmbedder } from "@opengeni/documents";
|
|
4
|
+
import type { Settings } from "@opengeni/config";
|
|
5
|
+
import { searchKnowledgeEntries } from "./knowledge-search.js";
|
|
6
|
+
export declare function prepareKnowledgeSave(db: Database, context: KnowledgeContext, input: KnowledgeSavePreparationRequest, embedder: () => DocumentEmbedder, services?: {
|
|
7
|
+
get: typeof getKnowledgeEntry;
|
|
8
|
+
list: typeof listKnowledgeEntries;
|
|
9
|
+
search: typeof searchKnowledgeEntries;
|
|
10
|
+
}, settings?: Settings): Promise<KnowledgeSavePreparationResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KnowledgeEntryListRequest, type KnowledgeEntryListResponse } from "@opengeni/contracts";
|
|
2
|
+
import type { Settings } from "@opengeni/config";
|
|
3
|
+
import { type Database, type KnowledgeContext } from "@opengeni/db";
|
|
4
|
+
import type { DocumentEmbedder } from "@opengeni/documents";
|
|
5
|
+
import type { z } from "zod";
|
|
6
|
+
export declare class KnowledgeVectorFundingError extends Error {
|
|
7
|
+
readonly code = "knowledge_vector_funding_required";
|
|
8
|
+
constructor();
|
|
9
|
+
}
|
|
10
|
+
export declare class KnowledgeVectorQueryRejectedError extends Error {
|
|
11
|
+
readonly code: "pagination_unavailable" | "query_limit" | "quota";
|
|
12
|
+
constructor(code: "pagination_unavailable" | "query_limit" | "quota", message: string);
|
|
13
|
+
}
|
|
14
|
+
/** Shared search path for HTTP and both first-party retrieval servers. */
|
|
15
|
+
export declare function searchKnowledgeEntries(db: Database, context: KnowledgeContext, input: z.input<typeof KnowledgeEntryListRequest>, embedder: () => DocumentEmbedder, settings?: Settings): Promise<KnowledgeEntryListResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AccessGrant, Permission } from "@opengeni/contracts";
|
|
2
|
+
import type { KnowledgeContext } from "@opengeni/db";
|
|
3
|
+
import { type AccessGrantAuthorization } from "../access/index.js";
|
|
4
|
+
import type { ApiRouteDeps } from "../dependencies.js";
|
|
5
|
+
/** A delegated MCP gateway can retrieve shared Knowledge. Its subject label
|
|
6
|
+
* does not establish personal ownership or human review authority. */
|
|
7
|
+
export declare function knowledgeContextForGateway(deps: Pick<ApiRouteDeps, "db">, grant: AccessGrant): Promise<KnowledgeContext>;
|
|
8
|
+
/** One host boundary for HTTP, SDK-through-HTTP and first-party Knowledge tools. */
|
|
9
|
+
export declare function knowledgeContextForAccess(deps: Pick<ApiRouteDeps, "db">, access: AccessGrantAuthorization, permission: Permission): Promise<KnowledgeContext>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { McpServerConfig } from "@opengeni/config";
|
|
2
|
+
import { type ConnectionMetadata, type McpConnectionAccountBinding, type McpConnectionAccountSelection, type McpPersonalConnectionDelegation } from "@opengeni/contracts";
|
|
3
|
+
/** Account routes are stable across retries, but are never parsed to discover
|
|
4
|
+
* authority. The canonical server is retained separately in the binding. */
|
|
5
|
+
export declare function mcpAccountRouteId(serverId: string, connectionId: string): string;
|
|
6
|
+
/** Pure admission projection over an already authorized inventory. Explicit
|
|
7
|
+
* pairs narrow one connector; omission attaches all eligible accounts. */
|
|
8
|
+
export declare function mcpAccountBindingsFromVisibleConnections(input: {
|
|
9
|
+
accountId: string;
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
subjectId: string | null;
|
|
12
|
+
servers: McpServerConfig[];
|
|
13
|
+
connections: ConnectionMetadata[];
|
|
14
|
+
selections?: McpConnectionAccountSelection[];
|
|
15
|
+
/** The complete accepted set, including an explicitly empty set. */
|
|
16
|
+
selectionsFrozen?: boolean;
|
|
17
|
+
}): McpConnectionAccountBinding[];
|
|
18
|
+
/** Workspace accounts never acquire a fabricated personal owner/delegation. */
|
|
19
|
+
export declare function personalDelegationsForAccountBindings(bindings: McpConnectionAccountBinding[]): McpPersonalConnectionDelegation[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Settings } from "@opengeni/config";
|
|
2
|
+
import type { McpConnectionAccountBinding, ToolRef } from "@opengeni/contracts";
|
|
3
|
+
import type { ApiIntegrationRuntime } from "@opengeni/db";
|
|
4
|
+
/** Expand only after canonical tool-policy admission. Aliases are execution
|
|
5
|
+
* identities, never an alternate way to gain admission to a connector. */
|
|
6
|
+
export declare function expandMcpAccountRoutes(input: {
|
|
7
|
+
settings: Settings;
|
|
8
|
+
tools: ToolRef[];
|
|
9
|
+
bindings: readonly McpConnectionAccountBinding[] | null | undefined;
|
|
10
|
+
}): {
|
|
11
|
+
settings: Settings;
|
|
12
|
+
tools: ToolRef[];
|
|
13
|
+
accountLabels: ReadonlyMap<string, string>;
|
|
14
|
+
};
|
|
15
|
+
/** Each adapter closes over its own immutable credential ref and authority
|
|
16
|
+
* generation. Sharing a provider transport never shares a credential resolver. */
|
|
17
|
+
export declare function expandApiIntegrationAccountRoutes(input: {
|
|
18
|
+
integrations: readonly ApiIntegrationRuntime[];
|
|
19
|
+
bindings: readonly McpConnectionAccountBinding[] | null | undefined;
|
|
20
|
+
tools: readonly ToolRef[];
|
|
21
|
+
}): ApiIntegrationRuntime[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type IntegrationSourceInput, type OrganizationIntegrationPolicy } from "@opengeni/contracts";
|
|
2
|
+
/** Admission for source discovery, before any credential-bearing network work.
|
|
3
|
+
* Auto-detection may try only protocols the organization actually permits.
|
|
4
|
+
*/
|
|
5
|
+
export declare function integrationSourceForOrganizationPolicy(policy: OrganizationIntegrationPolicy, source: IntegrationSourceInput): IntegrationSourceInput;
|
|
6
|
+
/** Product identities owned by the server, independent of mutable workspace catalogs. */
|
|
7
|
+
export declare function organizationIntegrationCatalog(): {
|
|
8
|
+
integrations: Array<{
|
|
9
|
+
key: string;
|
|
10
|
+
label: string;
|
|
11
|
+
kind: "curated" | "custom";
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
/** Only use for a validated built-in Connect adapter, never caller-authored catalog metadata. */
|
|
15
|
+
export declare function integrationKeyForConnectProvider(providerId: string): string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function organizationMembershipHttpStatus(sqlState: string | null): 400 | 403 | 404 | 409 | null;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { McpServerConfig, Settings } from "@opengeni/config";
|
|
2
|
-
import type { AccessGrant, ConnectionMetadata, McpPersonalConnectionDelegation, SessionTurn, SocialConnection, ToolRef } from "@opengeni/contracts";
|
|
2
|
+
import type { AccessGrant, ConnectionMetadata, McpConnectionAccountBinding, McpConnectionAccountSelection, McpPersonalConnectionDelegation, ResourceRef, SessionTurn, SocialConnection, ToolRef } from "@opengeni/contracts";
|
|
3
3
|
import { type Database, type ResolveConnectionCredentialInput, type ResolveConnectionCredentialResult } from "@opengeni/db";
|
|
4
|
+
export { ConnectionAccountSelectionError } from "./connection-account-selection-error.js";
|
|
4
5
|
export type PersonalConnectionDelegationSource = {
|
|
5
6
|
kind: "subject";
|
|
6
7
|
subjectId: string;
|
|
8
|
+
/**
|
|
9
|
+
* Organization of the authorizing grant. The owner-only
|
|
10
|
+
* personal-workspace pointer lives on an organization membership, so
|
|
11
|
+
* the account is part of the question, not an optimization.
|
|
12
|
+
*/
|
|
13
|
+
accountId: string;
|
|
7
14
|
} | {
|
|
8
15
|
kind: "turn";
|
|
9
16
|
sessionId: string;
|
|
@@ -21,12 +28,19 @@ export type AuthorizedAtlassianConnection = {
|
|
|
21
28
|
};
|
|
22
29
|
export declare function directPersonalConnectionSubjectId(turn: Pick<SessionTurn, "source" | "initiator" | "initiatorContext">): string | undefined;
|
|
23
30
|
export declare function personalConnectionDelegationSourceForGrant(grant: AccessGrant): PersonalConnectionDelegationSource;
|
|
31
|
+
/** Account-picker inventory: shared workspace accounts and this sender's own
|
|
32
|
+
* personal accounts. Visibility is never an execution grant or a credential
|
|
33
|
+
* response; every selected connection is validated again at admission/use. */
|
|
34
|
+
export declare function listOwnConnectionAccountsForGrant(db: Database, grant: AccessGrant, options?: {
|
|
35
|
+
includeInactive?: boolean;
|
|
36
|
+
}): Promise<ConnectionMetadata[]>;
|
|
24
37
|
export declare function authorizedSocialConnectionsForGrant(input: {
|
|
25
38
|
db: Database;
|
|
26
39
|
grant: AccessGrant;
|
|
27
40
|
limit?: number;
|
|
28
41
|
}): Promise<AuthorizedSocialConnection[]>;
|
|
29
|
-
|
|
42
|
+
/** Historical native Atlassian grants no longer authorize API execution. */
|
|
43
|
+
export declare function authorizedAtlassianConnectionsForGrant(_input: {
|
|
30
44
|
db: Database;
|
|
31
45
|
grant: AccessGrant;
|
|
32
46
|
}): Promise<AuthorizedAtlassianConnection[]>;
|
|
@@ -35,10 +49,29 @@ export declare function personalConnectionDelegationsFromVisibleConnections(inpu
|
|
|
35
49
|
servers: McpServerConfig[];
|
|
36
50
|
subjectId: string;
|
|
37
51
|
connections: ConnectionMetadata[];
|
|
52
|
+
authoritySelections?: McpConnectionAccountSelection[];
|
|
38
53
|
}): McpPersonalConnectionDelegation[];
|
|
39
54
|
export declare function personalConnectionDelegationsFromParent(input: {
|
|
40
55
|
servers: McpServerConfig[];
|
|
41
56
|
parentDelegations: McpPersonalConnectionDelegation[];
|
|
57
|
+
personalGitHubResources?: ResourceRef[];
|
|
58
|
+
targetSessionId?: string;
|
|
59
|
+
}): McpPersonalConnectionDelegation[];
|
|
60
|
+
/**
|
|
61
|
+
* Freezes Google Drive publishing only when one exact subject-owned connection
|
|
62
|
+
* is eligible. Multiple writable Google accounts are intentionally ambiguous:
|
|
63
|
+
* callers must narrow the connection before a later turn can advertise or use
|
|
64
|
+
* the private publication tool.
|
|
65
|
+
*/
|
|
66
|
+
export declare function googleDrivePublicationDelegationFromVisibleConnections(input: {
|
|
67
|
+
subjectId: string;
|
|
68
|
+
connections: ConnectionMetadata[];
|
|
69
|
+
authoritySelection?: McpConnectionAccountSelection;
|
|
70
|
+
}): McpPersonalConnectionDelegation | null;
|
|
71
|
+
/** Native Atlassian credentials remain stored but are not new turn authority. */
|
|
72
|
+
export declare function personalAtlassianDelegationsFromVisibleConnections(_input: {
|
|
73
|
+
subjectId: string;
|
|
74
|
+
connections: ConnectionMetadata[];
|
|
42
75
|
}): McpPersonalConnectionDelegation[];
|
|
43
76
|
export declare function personalConnectionDelegationsEqual(left: McpPersonalConnectionDelegation[], right: McpPersonalConnectionDelegation[]): boolean;
|
|
44
77
|
export declare function personalConnectionDelegationForServer(delegations: McpPersonalConnectionDelegation[], server: Pick<McpServerConfig, "id" | "connectionRef">): McpPersonalConnectionDelegation | null;
|
|
@@ -53,13 +86,63 @@ export declare function withFrozenPersonalConnectionDelegations(input: {
|
|
|
53
86
|
resolveCredential: ConnectionCredentialResolver;
|
|
54
87
|
settings: Pick<Settings, "mcpServers">;
|
|
55
88
|
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
89
|
+
/**
|
|
90
|
+
* Does the frozen delegation owner still hold workspace authority? Supply
|
|
91
|
+
* the canonical `namedSubjectHasLiveWorkspaceAuthority` resolver, never a bare
|
|
92
|
+
* `workspace_memberships` lookup: a managed human's personal workspace has
|
|
93
|
+
* no membership row, so a bare lookup revokes the owner's own connections.
|
|
94
|
+
*/
|
|
56
95
|
ownerHasWorkspaceMembership: (subjectId: string) => Promise<boolean>;
|
|
57
96
|
}): ConnectionCredentialResolver;
|
|
58
|
-
|
|
97
|
+
/** Freeze all native account routes without conflating workspace ownership
|
|
98
|
+
* with the exact causal human required for personal connections. */
|
|
99
|
+
export declare function freezeConnectionAccounts(input: Parameters<typeof freezePersonalConnectionDelegations>[0] & {
|
|
100
|
+
accountId: string;
|
|
101
|
+
}): Promise<{
|
|
102
|
+
mcpAccountBindings: McpConnectionAccountBinding[] | null;
|
|
103
|
+
personalConnectionDelegations: McpPersonalConnectionDelegation[];
|
|
104
|
+
}>;
|
|
105
|
+
/** Shared workspace accounts plus the entitled owner's own active accounts. */
|
|
106
|
+
export declare function visibleMcpAccountConnections(db: Database, input: {
|
|
107
|
+
accountId: string;
|
|
108
|
+
workspaceId: string;
|
|
109
|
+
source: Exclude<PersonalConnectionDelegationSource, {
|
|
110
|
+
kind: "turn";
|
|
111
|
+
}>;
|
|
112
|
+
}): Promise<ConnectionMetadata[]>;
|
|
113
|
+
/**
|
|
114
|
+
* Every account a fresh, selection-free freeze would bind for the generic MCP
|
|
115
|
+
* routes among `tools`: exactly what `freezeConnectionAccounts` binds when no
|
|
116
|
+
* account is chosen. The same entitlement contract applies: `source` is a
|
|
117
|
+
* grant-derived or frozen-owner subject, never a looked-up one. Read-only; it
|
|
118
|
+
* never persists a delegation.
|
|
119
|
+
*/
|
|
120
|
+
export declare function availableMcpAccountBindings(input: {
|
|
59
121
|
db: Database;
|
|
122
|
+
accountId: string;
|
|
60
123
|
workspaceId: string;
|
|
61
124
|
settings: Pick<Settings, "mcpServers">;
|
|
62
125
|
tools: ToolRef[];
|
|
126
|
+
source: Exclude<PersonalConnectionDelegationSource, {
|
|
127
|
+
kind: "turn";
|
|
128
|
+
}>;
|
|
129
|
+
/** Result of `visibleMcpAccountConnections` for the same source, when already read. */
|
|
130
|
+
connections?: ConnectionMetadata[];
|
|
131
|
+
}): Promise<McpConnectionAccountBinding[]>;
|
|
132
|
+
export declare function freezePersonalConnectionDelegations(input: {
|
|
133
|
+
db: Database;
|
|
134
|
+
workspaceId: string;
|
|
135
|
+
settings: Pick<Settings, "mcpServers"> & Partial<Pick<Settings, "githubPersonalOauthEnabled">>;
|
|
136
|
+
tools: ToolRef[];
|
|
137
|
+
resources?: ResourceRef[];
|
|
63
138
|
source: PersonalConnectionDelegationSource;
|
|
139
|
+
authoritySelections?: McpConnectionAccountSelection[];
|
|
140
|
+
/** Internal durable schedule snapshot, not a default account selector. */
|
|
141
|
+
authoritySelectionsFrozen?: boolean;
|
|
142
|
+
/** Exact first-party export tool + permission gate, not broad opengeni attachment. */
|
|
143
|
+
googleDrivePublicationEnabled?: boolean;
|
|
144
|
+
/** Exact first-party Atlassian tool + permission gate. */
|
|
145
|
+
atlassianEnabled?: boolean;
|
|
146
|
+
/** Exact target for successor-mode projection (`session` never crosses it). */
|
|
147
|
+
targetSessionId?: string;
|
|
64
148
|
}): Promise<McpPersonalConnectionDelegation[]>;
|
|
65
|
-
export {};
|