@opengeni/contracts 0.7.0 → 0.9.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/dist/index.js CHANGED
@@ -412,12 +412,18 @@ var Permission = z.enum([
412
412
  "github:manage",
413
413
  "github:use",
414
414
  "api_keys:manage",
415
+ "connections:read",
416
+ "connections:write",
415
417
  "environments:manage",
416
418
  "environments:use",
417
419
  // Attach or rotate per-session third-party MCP server credentials. Deliberately
418
420
  // not part of the worker's default first-party MCP permission set: a sandboxed
419
421
  // agent must not be able to hand itself new bearer credentials.
420
422
  "mcp_servers:attach",
423
+ // Programmatic sandbox -> tool access through the first-party MCP gate. This is
424
+ // intentionally narrow and is never part of first-party MCP defaults; callers
425
+ // must receive it through an explicit delegated `ogd_` mint carrying sessionId.
426
+ "toolspace:call",
421
427
  "goals:manage",
422
428
  // Bring-your-own-compute (M5). enrollments:read lists a workspace's machines;
423
429
  // enrollments:manage approves a device-flow enrollment (the LOUD whole-machine
@@ -427,6 +433,9 @@ var Permission = z.enum([
427
433
  "enrollments:read",
428
434
  "enrollments:manage"
429
435
  ]);
436
+ function prefixedMcpToolName(registryId2, toolName) {
437
+ return `${registryId2}__${toolName}`;
438
+ }
430
439
  var ProductAccessMode = z.enum(["local", "configured", "managed"]);
431
440
  var BillingMode = z.enum(["disabled", "stripe"]);
432
441
  var EntitlementsMode = z.enum(["none", "static", "managed"]);
@@ -882,6 +891,8 @@ var FileDownloadUrlResponse = z.object({
882
891
  expiresAt: z.string()
883
892
  });
884
893
  var DocumentStatus = z.enum(["queued", "indexing", "ready", "failed"]);
894
+ var KnowledgeSourceKind = z.enum(["manual_upload", "meeting_transcript", "repository", "email", "chat", "document", "web", "other"]);
895
+ var DocumentSearchMode = z.enum(["hybrid", "vector", "keyword"]);
885
896
  var DocumentBase = z.object({
886
897
  id: z.string().uuid(),
887
898
  workspaceId: z.string().uuid(),
@@ -900,6 +911,15 @@ var Document = z.object({
900
911
  parser: z.string(),
901
912
  chunkCount: z.number().int().nonnegative(),
902
913
  error: z.string().nullable(),
914
+ sourceKind: KnowledgeSourceKind,
915
+ sourceUri: z.string().nullable(),
916
+ sourceExternalId: z.string().nullable(),
917
+ sourceTitle: z.string().nullable(),
918
+ sourceAuthor: z.string().nullable(),
919
+ sourceCreatedAt: z.string().nullable(),
920
+ sourceUpdatedAt: z.string().nullable(),
921
+ sourceVersion: z.string().nullable(),
922
+ aclTags: z.array(z.string()),
903
923
  createdAt: z.string(),
904
924
  updatedAt: z.string()
905
925
  });
@@ -912,19 +932,97 @@ var DocumentSearchResult = z.object({
912
932
  title: z.string(),
913
933
  text: z.string(),
914
934
  score: z.number(),
935
+ matchType: DocumentSearchMode,
936
+ vectorScore: z.number().nullable(),
937
+ keywordScore: z.number().nullable(),
915
938
  chunkIndex: z.number().int().nonnegative(),
916
- metadata: z.record(z.string(), z.unknown())
939
+ metadata: z.record(z.string(), z.unknown()),
940
+ sourceKind: KnowledgeSourceKind,
941
+ sourceUri: z.string().nullable(),
942
+ sourceExternalId: z.string().nullable(),
943
+ sourceTitle: z.string().nullable(),
944
+ sourceAuthor: z.string().nullable(),
945
+ sourceCreatedAt: z.string().nullable(),
946
+ sourceUpdatedAt: z.string().nullable(),
947
+ sourceVersion: z.string().nullable(),
948
+ aclTags: z.array(z.string())
917
949
  });
918
950
  var CreateDocumentBaseRequest = z.object({
919
951
  name: z.string().min(1),
920
952
  description: z.string().optional()
921
953
  });
922
954
  var AddDocumentRequest = z.object({
923
- fileId: z.string().uuid()
955
+ fileId: z.string().uuid(),
956
+ title: z.string().min(1).optional(),
957
+ sourceKind: KnowledgeSourceKind.optional(),
958
+ sourceUri: z.string().min(1).optional(),
959
+ sourceExternalId: z.string().min(1).optional(),
960
+ sourceTitle: z.string().min(1).optional(),
961
+ sourceAuthor: z.string().min(1).optional(),
962
+ sourceCreatedAt: z.string().datetime({ offset: true }).optional(),
963
+ sourceUpdatedAt: z.string().datetime({ offset: true }).optional(),
964
+ sourceVersion: z.string().min(1).optional(),
965
+ aclTags: z.array(z.string().min(1)).optional()
924
966
  });
925
967
  var DocumentSearchRequest = z.object({
926
968
  query: z.string().min(1),
927
- limit: z.number().int().positive().max(20).default(5)
969
+ baseIds: z.array(z.string().uuid()).optional(),
970
+ mode: DocumentSearchMode.optional(),
971
+ sourceKinds: z.array(KnowledgeSourceKind).optional(),
972
+ aclTags: z.array(z.string().min(1)).optional(),
973
+ limit: z.number().int().positive().max(50).default(5)
974
+ });
975
+ var KnowledgeMemoryStatus = z.enum(["proposed", "approved", "rejected"]);
976
+ var KnowledgeMemoryKind = z.enum(["semantic", "episodic", "procedural", "decision", "preference"]);
977
+ var KnowledgeSourceRef = z.object({
978
+ kind: z.enum(["document_chunk", "document", "session_event", "memory", "external"]),
979
+ id: z.string().min(1),
980
+ uri: z.string().min(1).optional(),
981
+ title: z.string().min(1).optional(),
982
+ metadata: z.record(z.string(), z.unknown()).default({})
983
+ });
984
+ var KnowledgeMemory = z.object({
985
+ id: z.string().uuid(),
986
+ workspaceId: z.string().uuid(),
987
+ status: KnowledgeMemoryStatus,
988
+ kind: KnowledgeMemoryKind,
989
+ scope: z.string(),
990
+ text: z.string(),
991
+ sourceRefs: z.array(KnowledgeSourceRef),
992
+ confidence: z.number().min(0).max(1),
993
+ metadata: z.record(z.string(), z.unknown()),
994
+ createdBySessionId: z.string().uuid().nullable(),
995
+ reviewedBy: z.string().nullable(),
996
+ reviewedAt: z.string().nullable(),
997
+ createdAt: z.string(),
998
+ updatedAt: z.string()
999
+ });
1000
+ var CreateKnowledgeMemoryRequest = z.object({
1001
+ status: KnowledgeMemoryStatus.default("proposed"),
1002
+ kind: KnowledgeMemoryKind.default("semantic"),
1003
+ scope: z.string().min(1).default("workspace"),
1004
+ text: z.string().min(1),
1005
+ sourceRefs: z.array(KnowledgeSourceRef).default([]),
1006
+ confidence: z.number().min(0).max(1).default(0.5),
1007
+ metadata: z.record(z.string(), z.unknown()).default({}),
1008
+ createdBySessionId: z.string().uuid().optional()
1009
+ });
1010
+ var UpdateKnowledgeMemoryRequest = z.object({
1011
+ status: KnowledgeMemoryStatus.optional(),
1012
+ kind: KnowledgeMemoryKind.optional(),
1013
+ scope: z.string().min(1).optional(),
1014
+ text: z.string().min(1).optional(),
1015
+ sourceRefs: z.array(KnowledgeSourceRef).optional(),
1016
+ confidence: z.number().min(0).max(1).optional(),
1017
+ metadata: z.record(z.string(), z.unknown()).optional(),
1018
+ reviewedBy: z.string().min(1).optional()
1019
+ });
1020
+ var KnowledgeMemorySearchRequest = z.object({
1021
+ query: z.string().min(1).optional(),
1022
+ status: KnowledgeMemoryStatus.optional(),
1023
+ kind: KnowledgeMemoryKind.optional(),
1024
+ scope: z.string().min(1).optional(),
1025
+ limit: z.number().int().positive().max(100).default(20)
928
1026
  });
929
1027
  var ToolRef = z.object({
930
1028
  kind: z.literal("mcp"),
@@ -952,6 +1050,12 @@ var SessionMcpServerInput = z.object({
952
1050
  allowedTools: z.array(z.string().min(1)).optional(),
953
1051
  timeoutMs: z.number().int().positive().optional(),
954
1052
  cacheToolsList: z.boolean().optional(),
1053
+ // Human-approval policy for this server's tools. `true` = every tool of this
1054
+ // server requires approval before it runs (a `session.requiresAction` pause
1055
+ // the caller resolves with `user.approvalDecision`); a string[] = ONLY the
1056
+ // listed UNPREFIXED tool names require approval (e.g. reads auto-run, writes
1057
+ // ask); absent / `false` = auto-run everything (the historical default).
1058
+ requireApproval: z.union([z.boolean(), z.array(z.string().min(1))]).optional(),
955
1059
  // Write-only credential headers. Values are encrypted at rest and never
956
1060
  // returned in session responses or events; response metadata exposes names.
957
1061
  headers: z.record(z.string(), z.string()).optional()
@@ -1449,6 +1553,86 @@ var CreateSocialPostRequest = z.object({
1449
1553
  metrics: z.record(z.string(), z.number()).default({}),
1450
1554
  raw: z.record(z.string(), z.unknown()).default({})
1451
1555
  });
1556
+ var ConnectionKind = z.enum(["oauth2", "api_key", "app_install", "delegated"]);
1557
+ var ConnectionStatus = z.enum(["active", "needs_reauth", "revoked", "error"]);
1558
+ var McpServerConnectionRef = z.object({
1559
+ connectionId: z.string().uuid().optional(),
1560
+ providerDomain: z.string().min(1),
1561
+ kind: ConnectionKind.optional(),
1562
+ scopes: z.array(z.string().min(1)).optional(),
1563
+ resource: z.string().min(1).optional(),
1564
+ subjectScope: z.enum(["workspace", "subject"]).optional()
1565
+ }).strict();
1566
+ var ConnectionMetadata = z.object({
1567
+ id: z.string().uuid(),
1568
+ accountId: z.string().uuid(),
1569
+ workspaceId: z.string().uuid(),
1570
+ subjectId: z.string().nullable(),
1571
+ providerDomain: z.string(),
1572
+ kind: ConnectionKind,
1573
+ status: ConnectionStatus,
1574
+ grantedScopes: z.array(z.string()),
1575
+ expiresAt: z.string().nullable(),
1576
+ lastRefreshAt: z.string().nullable(),
1577
+ lastUsedAt: z.string().nullable(),
1578
+ lastError: z.string().nullable(),
1579
+ version: z.number().int().positive(),
1580
+ metadata: z.record(z.string(), z.unknown()),
1581
+ createdBySubjectId: z.string().nullable(),
1582
+ updatedBySubjectId: z.string().nullable(),
1583
+ createdAt: z.string(),
1584
+ updatedAt: z.string()
1585
+ });
1586
+ var ConnectionCredentialBundle = z.record(z.string(), z.unknown());
1587
+ var CreateConnectionRequest = z.object({
1588
+ providerDomain: z.string().min(1),
1589
+ kind: ConnectionKind,
1590
+ subjectId: z.string().min(1).nullable().optional(),
1591
+ credential: ConnectionCredentialBundle,
1592
+ grantedScopes: z.array(z.string().min(1)).default([]),
1593
+ expiresAt: z.string().datetime({ offset: true }).nullable().optional(),
1594
+ metadata: z.record(z.string(), z.unknown()).default({})
1595
+ });
1596
+ var UpdateConnectionRequest = z.object({
1597
+ providerDomain: z.string().min(1).optional(),
1598
+ subjectId: z.string().min(1).nullable().optional(),
1599
+ kind: ConnectionKind.optional(),
1600
+ status: ConnectionStatus.optional(),
1601
+ credential: ConnectionCredentialBundle.optional(),
1602
+ grantedScopes: z.array(z.string().min(1)).optional(),
1603
+ expiresAt: z.string().datetime({ offset: true }).nullable().optional(),
1604
+ metadata: z.record(z.string(), z.unknown()).optional()
1605
+ });
1606
+ var ConnectionResponse = z.object({
1607
+ connection: ConnectionMetadata
1608
+ });
1609
+ var ListConnectionsResponse = z.object({
1610
+ connections: z.array(ConnectionMetadata)
1611
+ });
1612
+ var OAuthStartRequest = z.object({
1613
+ providerDomain: z.string().min(1).optional(),
1614
+ mcpUrl: z.string().url().optional(),
1615
+ resource: z.string().url().optional(),
1616
+ requestedScopes: z.array(z.string().min(1)).default([]),
1617
+ returnPath: z.string().min(1).optional(),
1618
+ connectionId: z.string().uuid().optional()
1619
+ }).refine((value) => Boolean(value.mcpUrl ?? value.resource), {
1620
+ message: "mcpUrl is required",
1621
+ path: ["mcpUrl"]
1622
+ });
1623
+ var OAuthStartResponse = z.object({
1624
+ state: z.string().min(1),
1625
+ authorizationUrl: z.string().url().nullable(),
1626
+ expiresAt: z.string()
1627
+ });
1628
+ var IntegrationClientMetadata = z.object({
1629
+ client_id: z.string().url(),
1630
+ client_name: z.literal("OpenGeni"),
1631
+ redirect_uris: z.array(z.string().url()),
1632
+ token_endpoint_auth_method: z.literal("none"),
1633
+ grant_types: z.array(z.enum(["authorization_code", "refresh_token"])),
1634
+ response_types: z.array(z.literal("code"))
1635
+ });
1452
1636
  var MarketingDailyAnalysisTaskRequest = z.object({
1453
1637
  name: z.string().min(1).optional(),
1454
1638
  connectionIds: z.array(z.string().uuid()).default([]),
@@ -1462,8 +1646,10 @@ var MarketingDailyAnalysisTaskRequest = z.object({
1462
1646
  overlapPolicy: ScheduledTaskOverlapPolicy.default("skip")
1463
1647
  });
1464
1648
  var CapabilityKind = z.enum(["pack", "mcp", "api", "skill", "plugin"]);
1465
- var CapabilitySource = z.enum(["built_in", "configured", "public_registry", "manual"]);
1649
+ var CapabilitySource = z.enum(["built_in", "configured", "public_registry", "registry", "manual"]);
1466
1650
  var CapabilityInstallationStatus = z.enum(["active", "disabled"]);
1651
+ var CapabilityCatalogAuthKind = z.enum(["oauth2", "api_key", "none", "unknown"]);
1652
+ var CapabilityCatalogTier = z.enum(["verified", "community"]);
1467
1653
  var CapabilityRuntime = z.object({
1468
1654
  available: z.boolean().default(false),
1469
1655
  mcpServerId: z.string().min(1).optional(),
@@ -1484,6 +1670,18 @@ var CapabilityCatalogItem = z.object({
1484
1670
  endpointUrl: z.string().url().nullable().default(null),
1485
1671
  installUrl: z.string().url().nullable().default(null),
1486
1672
  authModel: z.string().min(1).nullable().default(null),
1673
+ providerDomain: z.string().min(1).nullable().default(null),
1674
+ surfaceType: z.string().min(1).nullable().default(null),
1675
+ transport: z.string().min(1).nullable().default(null),
1676
+ mcpUrl: z.string().url().nullable().default(null),
1677
+ authKind: CapabilityCatalogAuthKind.nullable().default(null),
1678
+ credentialFacts: z.array(z.record(z.string(), z.unknown())).default([]),
1679
+ tier: CapabilityCatalogTier.nullable().default(null),
1680
+ provenance: z.string().min(1).nullable().default(null),
1681
+ logoAssetPath: z.string().min(1).nullable().default(null),
1682
+ importBatchId: z.string().uuid().nullable().default(null),
1683
+ stale: z.boolean().default(false),
1684
+ staleAt: z.string().nullable().default(null),
1487
1685
  tools: z.array(ToolRef).default([]),
1488
1686
  runtime: CapabilityRuntime.default({ available: false, notes: null }),
1489
1687
  enabled: z.boolean().default(false),
@@ -1521,6 +1719,7 @@ var CreateCapabilityCatalogItemRequest = z.object({
1521
1719
  var EnableCapabilityRequest = z.object({
1522
1720
  config: z.record(z.string(), z.unknown()).default({}),
1523
1721
  metadata: z.record(z.string(), z.unknown()).default({}),
1722
+ connectionRef: McpServerConnectionRef.optional(),
1524
1723
  /**
1525
1724
  * Credential headers for remote MCP capabilities (for example an
1526
1725
  * Authorization bearer token). Values are encrypted at rest with the
@@ -1628,6 +1827,7 @@ var SessionEventType = z.enum([
1628
1827
  "agent.reasoning.delta",
1629
1828
  "agent.toolCall.created",
1630
1829
  "agent.toolCall.output",
1830
+ "tool.auth_needed",
1631
1831
  "agent.updated",
1632
1832
  "sandbox.operation.started",
1633
1833
  "sandbox.operation.completed",
@@ -1685,6 +1885,17 @@ var SessionEventType = z.enum([
1685
1885
  // the in-session "Running on:" indicator's live flip.
1686
1886
  "codex.account.switched"
1687
1887
  ]);
1888
+ var ToolAuthNeededPayload = z.object({
1889
+ serverId: z.string().min(1),
1890
+ toolName: z.string().min(1).nullable().optional(),
1891
+ providerDomain: z.string().min(1),
1892
+ connectionId: z.string().uuid().nullable().optional(),
1893
+ reason: z.enum(["missing_connection", "expired", "insufficient_scope", "refresh_failed"]),
1894
+ scopes: z.array(z.string().min(1)).optional(),
1895
+ resource: z.string().min(1).optional(),
1896
+ authorizationUrl: z.string().url().optional(),
1897
+ subjectId: z.string().min(1).nullable().optional()
1898
+ });
1688
1899
  var StreamUrlRotatedPayload = z.object({
1689
1900
  url: z.string().url(),
1690
1901
  token: z.string().nullable(),
@@ -2441,6 +2652,11 @@ var EnrollmentSummary = z.object({
2441
2652
  pubkey: z.string(),
2442
2653
  exposure: z.literal("whole-machine"),
2443
2654
  hasDisplay: z.boolean(),
2655
+ // Present (non-null) only when a display EXISTS but capture is blocked (macOS
2656
+ // Screen Recording / TCC not granted): a human, actionable reason so the UI can
2657
+ // show "display: capture not granted" instead of a bare "headless". null == capture
2658
+ // permitted OR genuinely headless.
2659
+ desktopUnavailableReason: z.string().nullish(),
2444
2660
  allowScreenControl: z.boolean(),
2445
2661
  status: z.enum(["active", "revoked"]),
2446
2662
  os: EnrollmentOs,
@@ -2537,6 +2753,10 @@ var MachineView = z.object({
2537
2753
  os: z.string(),
2538
2754
  arch: z.string(),
2539
2755
  hasDisplay: z.boolean(),
2756
+ // Non-null only when a display exists but capture is blocked (macOS Screen
2757
+ // Recording / TCC not granted) — the UI can surface "display: capture not granted".
2758
+ // null == capture permitted OR headless.
2759
+ desktopUnavailableReason: z.string().nullish(),
2540
2760
  allowScreenControl: z.boolean(),
2541
2761
  sharedSessionCount: z.number().int(),
2542
2762
  lastSeenAt: z.string().nullable(),
@@ -2646,8 +2866,10 @@ export {
2646
2866
  CAPABILITY_DESCRIPTORS,
2647
2867
  CLEARED_RUN_STATE_BLOB,
2648
2868
  CLEARED_RUN_STATE_MARKER,
2869
+ CapabilityCatalogAuthKind,
2649
2870
  CapabilityCatalogItem,
2650
2871
  CapabilityCatalogResponse,
2872
+ CapabilityCatalogTier,
2651
2873
  CapabilityInstallation,
2652
2874
  CapabilityInstallationStatus,
2653
2875
  CapabilityKind,
@@ -2669,14 +2891,21 @@ export {
2669
2891
  CompactSessionContextRequest,
2670
2892
  CompactSessionContextResult,
2671
2893
  CompleteFileUploadResponse,
2894
+ ConnectionCredentialBundle,
2895
+ ConnectionKind,
2896
+ ConnectionMetadata,
2897
+ ConnectionResponse,
2898
+ ConnectionStatus,
2672
2899
  CreateApiKeyRequest,
2673
2900
  CreateApiKeyResponse,
2674
2901
  CreateCapabilityCatalogItemRequest,
2675
2902
  CreateCheckoutRequest,
2676
2903
  CreateCheckoutResponse,
2904
+ CreateConnectionRequest,
2677
2905
  CreateDocumentBaseRequest,
2678
2906
  CreateFileUploadRequest,
2679
2907
  CreateFileUploadResponse,
2908
+ CreateKnowledgeMemoryRequest,
2680
2909
  CreateScheduledTaskRequest,
2681
2910
  CreateSessionRequest,
2682
2911
  CreateSocialConnectionRequest,
@@ -2700,6 +2929,7 @@ export {
2700
2929
  DiscoverMcpCapabilitiesResponse,
2701
2930
  Document,
2702
2931
  DocumentBase,
2932
+ DocumentSearchMode,
2703
2933
  DocumentSearchRequest,
2704
2934
  DocumentSearchResult,
2705
2935
  DocumentStatus,
@@ -2760,8 +2990,16 @@ export {
2760
2990
  GitStatusRequest,
2761
2991
  GitStatusResponse,
2762
2992
  GoalSpec,
2993
+ IntegrationClientMetadata,
2994
+ KnowledgeMemory,
2995
+ KnowledgeMemoryKind,
2996
+ KnowledgeMemorySearchRequest,
2997
+ KnowledgeMemoryStatus,
2998
+ KnowledgeSourceKind,
2999
+ KnowledgeSourceRef,
2763
3000
  LimitAction,
2764
3001
  LimitDecision,
3002
+ ListConnectionsResponse,
2765
3003
  ListEnrollmentsResponse,
2766
3004
  ListWorkspaceMembersResponse,
2767
3005
  MachineKind,
@@ -2771,9 +3009,12 @@ export {
2771
3009
  MachinesResponse,
2772
3010
  ManagedAccount,
2773
3011
  MarketingDailyAnalysisTaskRequest,
3012
+ McpServerConnectionRef,
2774
3013
  MetricSample,
2775
3014
  MintEnrollTokenRequest,
2776
3015
  MintEnrollTokenResponse,
3016
+ OAuthStartRequest,
3017
+ OAuthStartResponse,
2777
3018
  PackInstallation,
2778
3019
  PackInstallationStatus,
2779
3020
  Permission,
@@ -2847,8 +3088,11 @@ export {
2847
3088
  TerminalPtyExitedPayload,
2848
3089
  TerminalPtyOutputDeltaPayload,
2849
3090
  TerminalPtyStartedPayload,
3091
+ ToolAuthNeededPayload,
2850
3092
  ToolRef,
2851
3093
  TriggerScheduledTaskRequest,
3094
+ UpdateConnectionRequest,
3095
+ UpdateKnowledgeMemoryRequest,
2852
3096
  UpdateScheduledTaskRequest,
2853
3097
  UpdateSessionGoalRequest,
2854
3098
  UpdateSessionRequest,
@@ -2871,6 +3115,7 @@ export {
2871
3115
  isClearedRunStateBlob,
2872
3116
  mergeResourceRefs,
2873
3117
  mergeToolRefs,
3118
+ prefixedMcpToolName,
2874
3119
  reasoningEffortForMetadata,
2875
3120
  resourceIdentityKey,
2876
3121
  signDelegatedAccessToken,