@opengeni/core 2.1.0-canary.0 → 2.4.0-canary.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.
@@ -1,7 +1,7 @@
1
1
  import { ForkSessionResponse, SessionTenancyCreateCapabilities, UpdateSessionVisibilityResponse, type ForkSessionRequest, type SessionAuthorizationSurface, type UpdateSessionVisibilityRequest } from "@opengeni/contracts";
2
2
  import { type AccessGrantAuthorization } from "../access/index.js";
3
3
  import type { AppDependencies } from "../dependencies.js";
4
- type SessionTenancyDependencies = Pick<AppDependencies, "db" | "bus" | "sessionAuthorization">;
4
+ type SessionTenancyDependencies = Pick<AppDependencies, "db" | "bus" | "sessionAuthorization" | "settings">;
5
5
  export declare class SessionTenancyManagedHumanRequiredError extends Error {
6
6
  readonly name = "SessionTenancyManagedHumanRequiredError";
7
7
  constructor();
@@ -78,6 +78,39 @@ export type DocumentIndexClient = {
78
78
  authoritySubjectId: string | null;
79
79
  }) => Promise<Document | void>;
80
80
  };
81
+ export type ManagedEmailMessage = {
82
+ kind: "email_verification" | "password_reset" | "organization_user_setup";
83
+ from: string;
84
+ to: string;
85
+ subject: string;
86
+ text: string;
87
+ html: string;
88
+ idempotencyKey?: string;
89
+ };
90
+ export type ManagedEmailDeliveryResult = {
91
+ status: "sent";
92
+ providerMessageId: string | null;
93
+ } | {
94
+ status: "failed";
95
+ errorClass: string;
96
+ } | {
97
+ status: "outcome_unknown";
98
+ errorClass: string;
99
+ };
100
+ /** Provider-neutral, injectable boundary for every managed-auth email. */
101
+ export type ManagedEmailTransport = {
102
+ /** Effective provider sender; frozen into any idempotent payload digest. */
103
+ readonly sender: string;
104
+ /**
105
+ * Stable non-secret provider/account/policy namespace plus the provider's
106
+ * guaranteed key-retention window. Both are durably fenced before I/O.
107
+ */
108
+ readonly idempotency: {
109
+ readonly scope: string;
110
+ readonly retentionSeconds: number;
111
+ };
112
+ send(message: ManagedEmailMessage): Promise<ManagedEmailDeliveryResult>;
113
+ };
81
114
  export type AppDependencies = {
82
115
  settings: Settings;
83
116
  db: Database;
@@ -114,6 +147,8 @@ export type AppDependencies = {
114
147
  * App credentials; standalone deployments fall back to @opengeni/github.
115
148
  */
116
149
  githubAppApi?: GitHubAppApiPort;
150
+ /** Optional provider seam for the separately registered OpenGeni Lens App. */
151
+ prReviewGithubAppApi?: GitHubAppApiPort;
117
152
  /**
118
153
  * Optional host-owned connection credential seam. API-side consumers use
119
154
  * the MCP leg for Codemode/Code Mode; worker consumers bind the same port
@@ -127,6 +162,8 @@ export type AppDependencies = {
127
162
  */
128
163
  sessionAuthorization?: SessionAuthorizationPort | null;
129
164
  managedAuth?: ManagedAuth | null;
165
+ /** Injectable managed-email transport; standalone API defaults to Resend or local capture. */
166
+ managedEmailTransport?: ManagedEmailTransport;
130
167
  /** Injectable Codex HTTP transport for deterministic API/provider tests. */
131
168
  codexFetch?: typeof fetch;
132
169
  /** Injectable GitHub transport for deterministic personal-OAuth tests. */
@@ -162,6 +199,7 @@ export type AppDependencies = {
162
199
  };
163
200
  export type ObjectStorageDependency = ReturnType<typeof createObjectStorage>;
164
201
  export type ApiRouteDeps = AppDependencies & {
202
+ managedEmailTransport: ManagedEmailTransport;
165
203
  objectStorage: ObjectStorageDependency;
166
204
  githubStateSecret: string;
167
205
  documentIndexer: DocumentIndexClient;
@@ -1,6 +1,16 @@
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
+ export declare const WORKSPACE_INSIGHTS_PROVIDER_FILTER_MAX_UTF8_BYTES = 256;
5
+ export declare const WORKSPACE_INSIGHTS_MODEL_FILTER_MAX_UTF8_BYTES = 512;
6
+ export type WorkspaceInsightsFilterField = "provider" | "model";
7
+ export declare class WorkspaceInsightsFilterValidationError extends Error {
8
+ readonly field: WorkspaceInsightsFilterField;
9
+ readonly maxUtf8Bytes: number;
10
+ constructor(field: WorkspaceInsightsFilterField, maxUtf8Bytes: number);
11
+ }
12
+ /** Normalize the public filter sentinel and enforce the database authority envelope. */
13
+ export declare function normalizeWorkspaceInsightsFilter(value: string | null | undefined, field: WorkspaceInsightsFilterField): string | null;
4
14
  export type GetWorkspaceInsightsInput = {
5
15
  workspaceId: string;
6
16
  range: InsightsRange;
@@ -8,4 +18,9 @@ export type GetWorkspaceInsightsInput = {
8
18
  model?: string | null;
9
19
  now?: Date;
10
20
  };
21
+ export declare function insightsSessionLabel(input: {
22
+ id: string;
23
+ title: string | null;
24
+ depth?: number | null;
25
+ }): string;
11
26
  export declare function getWorkspaceInsights(db: Database, settings: Settings, input: GetWorkspaceInsightsInput): Promise<WorkspaceInsightsResponse>;
@@ -1,5 +1,5 @@
1
1
  import { type RememberLane, type GovernedLearningActivationReceipt, type RememberConfirmReceipt as RememberConfirmReceiptType, type RememberReceipt as RememberReceiptType } from "@opengeni/contracts";
2
- import { type Database, activateHumanConfirmedLearningDecision, archiveTaskNote, confirmRememberKnowledgeClaim, createTaskNote, getWorkspaceInstructionPolicyBaseline, getWorkspaceKnowledgeChangeProposalSummary, getWorkspaceKnowledgeClaimInitiatingHuman, rebaselineWorkspaceInstructionPolicyKnowledgeProposal } from "@opengeni/db";
2
+ import { type Database, activateHumanConfirmedLearningDecision, archiveTaskNote, confirmRememberKnowledgeClaim, createTaskNote, getWorkspaceInstructionPolicyBaseline, getWorkspaceKnowledgeChangeProposalSummary, getWorkspaceKnowledgeClaimInitiatingHuman, materializeConfirmedRememberKnowledgeMemory, rebaselineWorkspaceInstructionPolicyKnowledgeProposal } from "@opengeni/db";
3
3
  import { createCompanyBrainLearningPolicyRouter } from "./company-brain-governed-writes.js";
4
4
  export declare class RememberError extends Error {
5
5
  readonly code: "proposal_unavailable" | "proposal_not_confirmable" | "human_confirmation_unavailable" | "baseline_stale";
@@ -14,6 +14,7 @@ export type RememberRouterOptions = {
14
14
  rebaselineProposal?: typeof rebaselineWorkspaceInstructionPolicyKnowledgeProposal;
15
15
  activateHumanConfirmed?: typeof activateHumanConfirmedLearningDecision;
16
16
  confirmKnowledgeClaim?: typeof confirmRememberKnowledgeClaim;
17
+ materializeKnowledgeMemory?: typeof materializeConfirmedRememberKnowledgeMemory;
17
18
  proposalSummary?: typeof getWorkspaceKnowledgeChangeProposalSummary;
18
19
  claimInitiatingHuman?: typeof getWorkspaceKnowledgeClaimInitiatingHuman;
19
20
  instructionPolicyBaseline?: typeof getWorkspaceInstructionPolicyBaseline;
@@ -56,6 +57,8 @@ export declare function rememberConfirmationLabel(input: {
56
57
  * and the result is either an immediate activation (automatic policy), a
57
58
  * proposal for the human Knowledge review lifecycle, or a durable proposal that
58
59
  * still needs one bound human confirmation through `request_human_input`.
60
+ * A confirmed Knowledge claim is then materialized as a keyword-searchable
61
+ * Memory record from its exact approved Task-note text.
59
62
  */
60
63
  export declare function createRememberRouter(options: RememberRouterOptions): {
61
64
  remember: (input: {
@@ -1,5 +1,5 @@
1
1
  import { type Settings } from "@opengeni/config";
2
- import { SessionSpawnDenial, type AccessGrant, type ComposerDraft, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type McpConnectionAuthoritySelection, type Permission, type PersonalResourceAttachmentIntent, type ReasoningEffort, type ResourceRef, type Session, type SessionCommandReceipt, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type SubmittedTimelineAnnotation, type TimelineAnnotation, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionToolPolicy, type SessionTurn, type SessionPromptRouting, type SessionGoalSnapshot, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1, type XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
2
+ import { SessionSpawnDenial, type AccessGrant, type ComposerDraft, type CreateSessionResponse, type GoalSpec, type FirstPartyMcpToolName, type McpPersonalConnectionDelegation, type McpConnectionAuthoritySelection, type Permission, type PersonalResourceAttachmentIntent, type ReasoningEffort, type ResourceRef, type Session, type SessionCommandReceipt, type SessionSkill, type SessionEvent, SessionMcpApprovalPolicy, type SessionMcpCredentialUpdateInput, type SessionMcpServerMetadata, type SubmittedTimelineAnnotation, type TimelineAnnotation, type UpdateSessionMcpApprovalPolicyResponse, type UpdateSessionToolPolicyRequest, type SessionAuthorizationPort, type SessionToolPolicy, type SessionTurn, type SessionPromptRouting, type SessionGoalSnapshot, type ToolRef, type TurnInitiator, type TurnInitiatorContext, type TurnExecutionPolicyV1, type VariableSet, type XaiProviderAccountAuthoritySnapshotV1 } from "@opengeni/contracts";
3
3
  import { type CreateSessionMcpServerInput, type Database, type UpdateSessionMcpServerCredentialsInput, type SessionCommandActor, type NewSessionDraftSnapshot } from "@opengeni/db";
4
4
  import { type EventBus } from "@opengeni/events";
5
5
  import { type AccessGrantAuthorization } from "../access/index.js";
@@ -98,10 +98,11 @@ export declare function createAndStartSessionWithOutcome(input: {
98
98
  createdByActor?: Extract<SessionCommandActor, {
99
99
  type: "agent_attempt";
100
100
  }> | null;
101
- variableSet?: {
101
+ variableSets?: Array<{
102
102
  id: string;
103
103
  name: string;
104
- } | null;
104
+ scope: VariableSet["scope"];
105
+ }>;
105
106
  rigId?: string | null;
106
107
  rigVersionId?: string | null;
107
108
  channelId?: string | null;