@opengeni/core 5.0.0 → 5.0.1-canary.36927100590001

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.
Files changed (74) hide show
  1. package/dist/access/index.d.ts +18 -1
  2. package/dist/application/archived-session-imports.d.ts +6 -0
  3. package/dist/application/external-workspace-members.d.ts +1 -1
  4. package/dist/application/session-commands.d.ts +3 -0
  5. package/dist/billing/limits.d.ts +2 -0
  6. package/dist/{chunk-2JXLQTMR.js → chunk-2MKMRGSY.js} +8 -2
  7. package/dist/chunk-2MKMRGSY.js.map +1 -0
  8. package/dist/{chunk-ZYCNLYGH.js → chunk-GVO3N37G.js} +178 -12
  9. package/dist/chunk-GVO3N37G.js.map +1 -0
  10. package/dist/{chunk-VCZFFEPB.js → chunk-LCQXNR62.js} +16 -2
  11. package/dist/chunk-LCQXNR62.js.map +1 -0
  12. package/dist/codex-model-availability.d.ts +14 -0
  13. package/dist/default-session-model.d.ts +19 -2
  14. package/dist/dependencies.d.ts +9 -1
  15. package/dist/developer-setup-credential-ceiling.d.ts +10 -0
  16. package/dist/domain/agent-config-resolution.d.ts +64 -0
  17. package/dist/domain/automations.d.ts +8 -1
  18. package/dist/domain/editable-artifacts/ports.d.ts +10 -0
  19. package/dist/domain/editable-artifacts/service.d.ts +3 -1
  20. package/dist/domain/knowledge-messages.d.ts +4 -4
  21. package/dist/domain/organization-integration-catalog.d.ts +2 -2
  22. package/dist/domain/pr-review.d.ts +47 -2
  23. package/dist/domain/scheduled-tasks.d.ts +22 -1
  24. package/dist/domain/session-connection-accounts.d.ts +16 -0
  25. package/dist/domain/session-tool-policy.d.ts +78 -3
  26. package/dist/domain/sessions.d.ts +47 -1
  27. package/dist/editable-artifact-live/application.d.ts +2 -1
  28. package/dist/editable-artifact-live/server.d.ts +5 -1
  29. package/dist/editable-artifact-live/ticket.d.ts +2 -1
  30. package/dist/editable-artifact-live/types.d.ts +9 -0
  31. package/dist/editable-artifact-live.js +2 -2
  32. package/dist/editable-artifacts.js +2 -2
  33. package/dist/index.d.ts +6 -0
  34. package/dist/index.js +8101 -6468
  35. package/dist/index.js.map +1 -1
  36. package/dist/model-catalog.d.ts +7 -0
  37. package/dist/product-usage-metrics.d.ts +30 -0
  38. package/dist/user-presence.d.ts +32 -0
  39. package/package.json +12 -12
  40. package/src/access/index.ts +164 -5
  41. package/src/application/archived-session-imports.ts +161 -0
  42. package/src/application/external-workspace-members.ts +3 -0
  43. package/src/application/session-commands.ts +59 -0
  44. package/src/application/session-tenancy.ts +9 -0
  45. package/src/billing/limits.ts +18 -3
  46. package/src/codex-model-availability.ts +136 -0
  47. package/src/default-session-model.ts +93 -8
  48. package/src/dependencies.ts +9 -0
  49. package/src/developer-setup-credential-ceiling.ts +60 -0
  50. package/src/domain/agent-config-resolution.ts +193 -0
  51. package/src/domain/automations.ts +75 -1
  52. package/src/domain/connector-tool-permissions.ts +8 -0
  53. package/src/domain/editable-artifacts/in-memory.ts +6 -0
  54. package/src/domain/editable-artifacts/ports.ts +11 -0
  55. package/src/domain/editable-artifacts/service.ts +20 -0
  56. package/src/domain/knowledge-search.test.ts +199 -9
  57. package/src/domain/knowledge-search.ts +53 -1
  58. package/src/domain/organization-integration-catalog.ts +8 -3
  59. package/src/domain/scheduled-tasks.ts +99 -15
  60. package/src/domain/session-connection-accounts.ts +67 -0
  61. package/src/domain/session-tool-policy.ts +379 -8
  62. package/src/domain/sessions.ts +684 -80
  63. package/src/editable-artifact-live/application.ts +8 -1
  64. package/src/editable-artifact-live/server.ts +154 -6
  65. package/src/editable-artifact-live/ticket.ts +86 -1
  66. package/src/editable-artifact-live/types.ts +10 -0
  67. package/src/index.ts +6 -0
  68. package/src/model-catalog.ts +17 -0
  69. package/src/product-usage-metrics.ts +101 -0
  70. package/src/sandbox/routing.ts +6 -2
  71. package/src/user-presence.ts +134 -0
  72. package/dist/chunk-2JXLQTMR.js.map +0 -1
  73. package/dist/chunk-VCZFFEPB.js.map +0 -1
  74. package/dist/chunk-ZYCNLYGH.js.map +0 -1
@@ -1,10 +1,23 @@
1
1
  import { type Settings } from "@opengeni/config";
2
2
  import { ExternalActorAttribution, type ExternalActorContinuation } from "@opengeni/contracts/external-identities";
3
- import { type AccountGrant, type AccessContext, type AccessGrant, Permission, type Workspace } from "@opengeni/contracts";
3
+ import { type AccountGrant, type AccessContext, type AccessGrant, type OrganizationApiKeyAccess, Permission, type Workspace } from "@opengeni/contracts";
4
4
  import { type Database } from "@opengeni/db";
5
5
  import type { Context } from "hono";
6
6
  import type { ManagedAuth } from "../managed-auth-type.js";
7
7
  import type { ManagedAuthSessionAdapter } from "../managed-auth-session-sets.js";
8
+ import type { UserPresenceRecorder } from "../user-presence.js";
9
+ /** Only canonical authentication can prove setup-key provenance. */
10
+ export declare function isDeveloperSetupApiKeyContext(context: AccessContext): boolean;
11
+ /** Provenance from canonical raw-key or verified restricted-token authentication. */
12
+ export declare function isDeveloperSetupAuthorization(authorization: AccessGrantAuthorization | undefined): boolean;
13
+ /** Exact grant objects resolved under authenticated setup-only provenance. */
14
+ export declare function isDeveloperSetupGrant(grant: AccessGrant): boolean;
15
+ /** Setup-derived credentials cannot carry literal organization or key authority. */
16
+ export declare function isDeveloperSetupDelegatedPermissionAllowed(permission: Permission): boolean;
17
+ /** Canonical authentication provenance, including the backing key of asUser. */
18
+ export declare function requireApiKeyManagementContext(context: AccessContext): void;
19
+ /** Membership is not an escape hatch for minting durable credentials. */
20
+ export declare function requireApiKeyDelegationContext(context: AccessContext, permissions: Permission[]): void;
8
21
  /** Creation audit only, never an authentication or delegation token. Metadata
9
22
  * claiming to be external is insufficient; the exact resolver proof is needed. */
10
23
  export declare function externalAttributionForAuthorization(authorization: AccessGrantAuthorization | undefined, grant: AccessGrant): ExternalActorAttribution | null;
@@ -24,6 +37,8 @@ export type AccountScopedApiKeyWorkspaceAuthority = Readonly<{
24
37
  * shape alone is deliberately insufficient.
25
38
  */
26
39
  export declare function accountScopedApiKeyWorkspaceAuthority(context: AccessContext): AccountScopedApiKeyWorkspaceAuthority | null;
40
+ /** Classify stored scopes without changing the legacy full/read permission sets. */
41
+ export declare function organizationApiKeyAccess(permissions: Permission[]): OrganizationApiKeyAccess;
27
42
  /**
28
43
  * Opaque, request-local proof that the canonical access resolver authorized the
29
44
  * exact account administrator named by the stamp. The random id is audit and
@@ -41,6 +56,8 @@ export type AccessDeps = {
41
56
  settings: Settings;
42
57
  managedAuth?: ManagedAuth | null;
43
58
  managedAuthSessionAdapter?: ManagedAuthSessionAdapter | null;
59
+ /** Analytics only: notes canonical managed-cookie activity, never authority. */
60
+ userPresence?: UserPresenceRecorder | null;
44
61
  };
45
62
  /** null means this is not an authenticated external lane; [] means that lane
46
63
  * has no readable inventory. Callers must not fall back from [] to service or
@@ -0,0 +1,6 @@
1
+ import { AppendArchivedSessionEventsResponse, ImportArchivedSessionResponse } from "@opengeni/contracts";
2
+ import { type AccessGrantAuthorization } from "../access/index.js";
3
+ import type { ApiRouteDeps } from "../dependencies.js";
4
+ export { ArchivedSessionImportError } from "@opengeni/db";
5
+ export declare function importArchivedSessionForRequest(deps: ApiRouteDeps, authorization: AccessGrantAuthorization, workspaceId: string, rawPayload: unknown): Promise<ImportArchivedSessionResponse>;
6
+ export declare function appendArchivedSessionEventsForRequest(deps: ApiRouteDeps, authorization: AccessGrantAuthorization, workspaceId: string, importId: string, rawPayload: unknown): Promise<AppendArchivedSessionEventsResponse>;
@@ -26,7 +26,7 @@ export declare function cancelExternalWorkspaceMemberGrantForRequest(c: Context,
26
26
  export declare function updateExternalWorkspaceMemberForRequest(c: Context, deps: AccessDeps, organizationId: string, workspaceId: string, membershipId: string, input: unknown): Promise<{
27
27
  subjectId: string;
28
28
  organizationMembershipId: string;
29
- permissions: ("account:admin" | "account:read" | "api_keys:manage" | "artifacts:publish" | "artifacts:read" | "billing:manage" | "billing:read" | "capabilities:manage" | "codemode:call" | "connections:read" | "connections:write" | "documents:manage" | "documents:search" | "enrollments:manage" | "enrollments:read" | "environments:manage" | "environments:use" | "files:read" | "files:upload" | "files:write" | "github:manage" | "github:use" | "goals:manage" | "mcp_servers:attach" | "members:manage" | "rigs:manage" | "rigs:use" | "scheduled_tasks:manage" | "scheduled_tasks:run" | "secrets:list" | "secrets:read" | "secrets:write" | "sessions:control" | "sessions:create" | "sessions:read" | "stream:acknowledge" | "stream:control" | "stream:view" | "terminal:attach" | "variable-sets:attach" | "variable-sets:list" | "variable-sets:manage" | "variable-sets:read" | "variable-sets:use" | "variable-sets:write" | "workspace:admin" | "workspace:create" | "workspace:read")[];
29
+ permissions: ("account:admin" | "account:read" | "api_keys:manage" | "artifacts:publish" | "artifacts:read" | "billing:manage" | "billing:read" | "capabilities:manage" | "codemode:call" | "connections:read" | "connections:write" | "documents:manage" | "documents:search" | "enrollments:manage" | "enrollments:read" | "environments:manage" | "environments:use" | "files:read" | "files:upload" | "files:write" | "github:manage" | "github:use" | "goals:manage" | "mcp_servers:attach" | "members:manage" | "rigs:manage" | "rigs:use" | "scheduled_tasks:manage" | "scheduled_tasks:run" | "secrets:list" | "secrets:read" | "secrets:write" | "sessions:control" | "sessions:create" | "sessions:read" | "stream:acknowledge" | "stream:control" | "stream:view" | "terminal:attach" | "usage_allowances:manage" | "variable-sets:attach" | "variable-sets:list" | "variable-sets:manage" | "variable-sets:read" | "variable-sets:use" | "variable-sets:write" | "workspace:admin" | "workspace:create" | "workspace:read")[];
30
30
  narrowed: boolean;
31
31
  replay: boolean;
32
32
  }>;
@@ -1,4 +1,5 @@
1
1
  import type { ComposerDraft, DeleteSessionQueueItemRequest, EditSessionQueueItemRequest, MoveSessionQueueItemRequest, SaveComposerDraftRequest, SessionAuthorizationPort, SessionAuthorizationSurface, SessionControlRequest, SessionControlResponse, SessionQueueMutationResponse, SteerSessionQueueItemRequest, WorkspaceInferenceControlRequest, WorkspaceInferenceControlResponse } from "@opengeni/contracts";
2
+ import type { Settings } from "@opengeni/config";
2
3
  import { type Database, type SessionCommandReceiptRow } from "@opengeni/db";
3
4
  import { type EventBus } from "@opengeni/events";
4
5
  import type { SessionWorkflowClient } from "../dependencies.js";
@@ -37,6 +38,7 @@ type SessionCommandPostCommitDeps = {
37
38
  };
38
39
  export declare function sendAgentSessionMessage(deps: {
39
40
  db: Database;
41
+ settings?: Settings;
40
42
  bus: EventBus;
41
43
  workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
42
44
  sessionAuthorization?: SessionAuthorizationPort | null;
@@ -47,6 +49,7 @@ export declare function sendAgentSessionMessage(deps: {
47
49
  }): Promise<import("@opengeni/db").AgentInternalUpdateCommandResult>;
48
50
  export declare function steerAgentSession(deps: {
49
51
  db: Database;
52
+ settings?: Settings;
50
53
  bus: EventBus;
51
54
  workflowClient: Pick<SessionWorkflowClient, "wakeSessionWorkflow">;
52
55
  sessionAuthorization?: SessionAuthorizationPort | null;
@@ -9,6 +9,8 @@ export declare function documentEmbeddingCostMicros(settings: Settings, inputByt
9
9
  export type LimitCheckInput = {
10
10
  accountId: string;
11
11
  workspaceId?: string;
12
+ /** Frozen causal human, never the API key or service admitting the work. */
13
+ initiatingHumanSubjectId?: string | null;
12
14
  action: LimitAction;
13
15
  quantity?: number;
14
16
  model?: string | null;
@@ -25,7 +25,7 @@ import {
25
25
  editableArtifactSnapshotId,
26
26
  editableArtifactStateHash,
27
27
  validateEditableArtifactActor
28
- } from "./chunk-VCZFFEPB.js";
28
+ } from "./chunk-LCQXNR62.js";
29
29
 
30
30
  // src/domain/editable-artifacts/durable-export.ts
31
31
  import { createHash } from "crypto";
@@ -1288,6 +1288,9 @@ var InMemoryEditableArtifactStore = class {
1288
1288
  });
1289
1289
  }
1290
1290
  async readTransactionBasis(scope, artifactId, request) {
1291
+ if (request.authorizeCommit) {
1292
+ throw new TypeError("Transactional artifact authority requires a PostgreSQL store");
1293
+ }
1291
1294
  const normalizedScope = editableArtifactScope(scope);
1292
1295
  const normalizedArtifactId = editableArtifactId(artifactId);
1293
1296
  const key = aggregateKey(normalizedScope, normalizedArtifactId);
@@ -1337,6 +1340,9 @@ var InMemoryEditableArtifactStore = class {
1337
1340
  });
1338
1341
  }
1339
1342
  async tryCommitAppliedTransaction(request) {
1343
+ if (request.authorizeCommit) {
1344
+ throw new TypeError("Transactional artifact authority requires a PostgreSQL store");
1345
+ }
1340
1346
  const scope = editableArtifactScope(request.scope);
1341
1347
  const artifactId = editableArtifactId(request.artifactId);
1342
1348
  const key = aggregateKey(scope, artifactId);
@@ -2455,4 +2461,4 @@ export {
2455
2461
  EditableArtifactGenesisPipeline,
2456
2462
  editableArtifactMaterializationKey
2457
2463
  };
2458
- //# sourceMappingURL=chunk-2JXLQTMR.js.map
2464
+ //# sourceMappingURL=chunk-2MKMRGSY.js.map