@opengeni/contracts 0.28.1 → 0.30.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,6 +1,6 @@
1
1
  import {
2
2
  ConnectionMetadata
3
- } from "./chunk-3Q5FLMOD.js";
3
+ } from "./chunk-YWKPXSLB.js";
4
4
  import "./chunk-KGL5BVGF.js";
5
5
 
6
6
  // src/google-drive.ts
package/dist/index.d.ts CHANGED
@@ -2395,6 +2395,42 @@ export declare const McpServerConnectionRef: z.ZodObject<{
2395
2395
  }>>;
2396
2396
  }, z.core.$strict>;
2397
2397
  export type McpServerConnectionRef = z.infer<typeof McpServerConnectionRef>;
2398
+ /** Internal frozen authority for one personal MCP connection. */
2399
+ export declare const McpPersonalConnectionDelegation: z.ZodObject<{
2400
+ serverId: z.ZodString;
2401
+ connectionId: z.ZodString;
2402
+ ownerSubjectId: z.ZodString;
2403
+ providerDomain: z.ZodString;
2404
+ kind: z.ZodOptional<z.ZodEnum<{
2405
+ api_key: "api_key";
2406
+ app_install: "app_install";
2407
+ delegated: "delegated";
2408
+ oauth2: "oauth2";
2409
+ }>>;
2410
+ }, z.core.$strict>;
2411
+ export type McpPersonalConnectionDelegation = z.infer<typeof McpPersonalConnectionDelegation>;
2412
+ /**
2413
+ * Exact personal MCP authority frozen on one causal turn or scheduled task.
2414
+ * One server can have at most one grant; bounded validation keeps corrupt JSON
2415
+ * from becoming executable credential authority at a DB read boundary.
2416
+ */
2417
+ export declare const McpPersonalConnectionDelegations: z.ZodArray<z.ZodObject<{
2418
+ serverId: z.ZodString;
2419
+ connectionId: z.ZodString;
2420
+ ownerSubjectId: z.ZodString;
2421
+ providerDomain: z.ZodString;
2422
+ kind: z.ZodOptional<z.ZodEnum<{
2423
+ api_key: "api_key";
2424
+ app_install: "app_install";
2425
+ delegated: "delegated";
2426
+ oauth2: "oauth2";
2427
+ }>>;
2428
+ }, z.core.$strict>>;
2429
+ export declare const McpPersonalConnectionSummary: z.ZodObject<{
2430
+ serverId: z.ZodString;
2431
+ providerDomain: z.ZodString;
2432
+ }, z.core.$strict>;
2433
+ export type McpPersonalConnectionSummary = z.infer<typeof McpPersonalConnectionSummary>;
2398
2434
  export type McpCredentialsRequest = {
2399
2435
  accountId: string;
2400
2436
  workspaceId: string;
@@ -2419,7 +2455,7 @@ export type McpCredentialsRequest = {
2419
2455
  connectionRef: McpServerConnectionRef;
2420
2456
  forceRefresh: boolean;
2421
2457
  };
2422
- export type McpCredentialAuthNeededReason = CredentialAuthNeededReason | "unsupported_auth" | "resource_scope_unavailable";
2458
+ export type McpCredentialAuthNeededReason = CredentialAuthNeededReason | "personal_authority_unavailable" | "unsupported_auth" | "resource_scope_unavailable";
2423
2459
  export type McpCredentialResolution = {
2424
2460
  status: "ok";
2425
2461
  /** Scope echoes are mandatory and verified before any header is used. */
@@ -4017,6 +4053,10 @@ export declare const SessionTurn: z.ZodObject<{
4017
4053
  }>;
4018
4054
  }, z.core.$strip>;
4019
4055
  initiatorContext: z.ZodRecord<z.ZodString, z.ZodUnknown>;
4056
+ personalConnections: z.ZodDefault<z.ZodArray<z.ZodObject<{
4057
+ serverId: z.ZodString;
4058
+ providerDomain: z.ZodString;
4059
+ }, z.core.$strict>>>;
4020
4060
  cancelledBy: z.ZodNullable<z.ZodString>;
4021
4061
  cancelReason: z.ZodNullable<z.ZodString>;
4022
4062
  startedAt: z.ZodNullable<z.ZodString>;
@@ -5197,6 +5237,10 @@ export declare const SessionQueueSnapshot: z.ZodObject<{
5197
5237
  quiescencePendingCount: z.ZodNumber;
5198
5238
  }, z.core.$strip>>;
5199
5239
  }, z.core.$strip>;
5240
+ activePersonalConnections: z.ZodDefault<z.ZodArray<z.ZodObject<{
5241
+ serverId: z.ZodString;
5242
+ providerDomain: z.ZodString;
5243
+ }, z.core.$strict>>>;
5200
5244
  stoppingPreviousAttempt: z.ZodBoolean;
5201
5245
  items: z.ZodArray<z.ZodObject<{
5202
5246
  id: z.ZodString;
@@ -5305,6 +5349,10 @@ export declare const SessionQueueSnapshot: z.ZodObject<{
5305
5349
  }>;
5306
5350
  }, z.core.$strip>;
5307
5351
  initiatorContext: z.ZodRecord<z.ZodString, z.ZodUnknown>;
5352
+ personalConnections: z.ZodDefault<z.ZodArray<z.ZodObject<{
5353
+ serverId: z.ZodString;
5354
+ providerDomain: z.ZodString;
5355
+ }, z.core.$strict>>>;
5308
5356
  cancelledBy: z.ZodNullable<z.ZodString>;
5309
5357
  cancelReason: z.ZodNullable<z.ZodString>;
5310
5358
  startedAt: z.ZodNullable<z.ZodString>;
@@ -5859,6 +5907,19 @@ export declare const ScheduledTask: z.ZodObject<{
5859
5907
  }, z.core.$strip>>;
5860
5908
  maxNestedAgentDepth: z.ZodOptional<z.ZodNumber>;
5861
5909
  }, z.core.$strip>;
5910
+ createdBy: z.ZodDefault<z.ZodObject<{
5911
+ subjectId: z.ZodString;
5912
+ label: z.ZodOptional<z.ZodString>;
5913
+ kind: z.ZodEnum<{
5914
+ service: "service";
5915
+ subject: "subject";
5916
+ }>;
5917
+ }, z.core.$strip>>;
5918
+ createdByContext: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5919
+ personalConnections: z.ZodDefault<z.ZodArray<z.ZodObject<{
5920
+ serverId: z.ZodString;
5921
+ providerDomain: z.ZodString;
5922
+ }, z.core.$strict>>>;
5862
5923
  reusableSessionId: z.ZodNullable<z.ZodString>;
5863
5924
  variableSetId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
5864
5925
  environmentId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -6732,6 +6793,11 @@ export declare function comparePersonalSlackCanonicalConnections(left: PersonalS
6732
6793
  export declare function selectCanonicalPersonalSlackConnection<T extends PersonalSlackCanonicalConnection>(connections: readonly T[]): T | null;
6733
6794
  export declare const ConnectionCredentialBundle: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6734
6795
  export type ConnectionCredentialBundle = z.infer<typeof ConnectionCredentialBundle>;
6796
+ export declare const ConnectionOwnership: z.ZodEnum<{
6797
+ personal: "personal";
6798
+ workspace: "workspace";
6799
+ }>;
6800
+ export type ConnectionOwnership = z.infer<typeof ConnectionOwnership>;
6735
6801
  export declare const CreateConnectionRequest: z.ZodObject<{
6736
6802
  providerDomain: z.ZodString;
6737
6803
  kind: z.ZodEnum<{
@@ -6740,6 +6806,10 @@ export declare const CreateConnectionRequest: z.ZodObject<{
6740
6806
  delegated: "delegated";
6741
6807
  oauth2: "oauth2";
6742
6808
  }>;
6809
+ ownership: z.ZodOptional<z.ZodEnum<{
6810
+ personal: "personal";
6811
+ workspace: "workspace";
6812
+ }>>;
6743
6813
  subjectId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6744
6814
  credential: z.ZodRecord<z.ZodString, z.ZodUnknown>;
6745
6815
  grantedScopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -6854,6 +6924,10 @@ export declare const OAuthStartRequest: z.ZodObject<{
6854
6924
  requestedScopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
6855
6925
  returnPath: z.ZodOptional<z.ZodString>;
6856
6926
  connectionId: z.ZodOptional<z.ZodString>;
6927
+ ownership: z.ZodOptional<z.ZodEnum<{
6928
+ personal: "personal";
6929
+ workspace: "workspace";
6930
+ }>>;
6857
6931
  oauthClient: z.ZodOptional<z.ZodObject<{
6858
6932
  clientId: z.ZodString;
6859
6933
  clientSecret: z.ZodOptional<z.ZodString>;
@@ -9566,6 +9640,7 @@ export declare const ToolAuthNeededPayload: z.ZodObject<{
9566
9640
  expired: "expired";
9567
9641
  insufficient_scope: "insufficient_scope";
9568
9642
  missing_connection: "missing_connection";
9643
+ personal_authority_unavailable: "personal_authority_unavailable";
9569
9644
  refresh_failed: "refresh_failed";
9570
9645
  resource_scope_unavailable: "resource_scope_unavailable";
9571
9646
  unsupported_auth: "unsupported_auth";
@@ -11305,6 +11380,10 @@ export declare const SessionQueueMutationResponse: z.ZodObject<{
11305
11380
  quiescencePendingCount: z.ZodNumber;
11306
11381
  }, z.core.$strip>>;
11307
11382
  }, z.core.$strip>;
11383
+ activePersonalConnections: z.ZodDefault<z.ZodArray<z.ZodObject<{
11384
+ serverId: z.ZodString;
11385
+ providerDomain: z.ZodString;
11386
+ }, z.core.$strict>>>;
11308
11387
  stoppingPreviousAttempt: z.ZodBoolean;
11309
11388
  items: z.ZodArray<z.ZodObject<{
11310
11389
  id: z.ZodString;
@@ -11413,6 +11492,10 @@ export declare const SessionQueueMutationResponse: z.ZodObject<{
11413
11492
  }>;
11414
11493
  }, z.core.$strip>;
11415
11494
  initiatorContext: z.ZodRecord<z.ZodString, z.ZodUnknown>;
11495
+ personalConnections: z.ZodDefault<z.ZodArray<z.ZodObject<{
11496
+ serverId: z.ZodString;
11497
+ providerDomain: z.ZodString;
11498
+ }, z.core.$strict>>>;
11416
11499
  cancelledBy: z.ZodNullable<z.ZodString>;
11417
11500
  cancelReason: z.ZodNullable<z.ZodString>;
11418
11501
  startedAt: z.ZodNullable<z.ZodString>;
@@ -12368,6 +12451,10 @@ export declare const SteerSessionMessageResponse: z.ZodObject<{
12368
12451
  }>;
12369
12452
  }, z.core.$strip>;
12370
12453
  initiatorContext: z.ZodRecord<z.ZodString, z.ZodUnknown>;
12454
+ personalConnections: z.ZodDefault<z.ZodArray<z.ZodObject<{
12455
+ serverId: z.ZodString;
12456
+ providerDomain: z.ZodString;
12457
+ }, z.core.$strict>>>;
12371
12458
  cancelledBy: z.ZodNullable<z.ZodString>;
12372
12459
  cancelReason: z.ZodNullable<z.ZodString>;
12373
12460
  startedAt: z.ZodNullable<z.ZodString>;
@@ -14605,3 +14692,4 @@ export * from "./secret-redaction";
14605
14692
  export * from "./workspace-instruction-policies";
14606
14693
  export * from "./workspace-state";
14607
14694
  export * from "./preference-registry";
14695
+ export * from "./scoped-knowledge";
package/dist/index.js CHANGED
@@ -53,6 +53,7 @@ import {
53
53
  ConnectionCredentialBundle,
54
54
  ConnectionKind,
55
55
  ConnectionMetadata,
56
+ ConnectionOwnership,
56
57
  ConnectionResponse,
57
58
  ConnectionStatus,
58
59
  CorrectPreferenceRegistryRequest,
@@ -215,12 +216,21 @@ import {
215
216
  InsightsSpendDriver,
216
217
  InsightsWarmGroupRow,
217
218
  IntegrationClientMetadata,
219
+ KnowledgeChangeProposalTargetKind,
220
+ KnowledgeClaimEvidencePolarity,
221
+ KnowledgeClaimOrigin,
222
+ KnowledgeClaimRelationType,
223
+ KnowledgeClaimReviewState,
224
+ KnowledgeFactObjectKind,
225
+ KnowledgeLifecycleEventType,
226
+ KnowledgeLifecycleState,
218
227
  KnowledgeMemory,
219
228
  KnowledgeMemoryKind,
220
229
  KnowledgeMemorySearchRequest,
221
230
  KnowledgeMemoryStatus,
222
231
  KnowledgeSourceKind,
223
232
  KnowledgeSourceRef,
233
+ KnowledgeSyncRunState,
224
234
  LatencyMode,
225
235
  LimitAction,
226
236
  LimitDecision,
@@ -237,6 +247,9 @@ import {
237
247
  ManagedAccount,
238
248
  MarketingDailyAnalysisTaskRequest,
239
249
  McpConnectionResourceScope,
250
+ McpPersonalConnectionDelegation,
251
+ McpPersonalConnectionDelegations,
252
+ McpPersonalConnectionSummary,
240
253
  McpServerConnectionRef,
241
254
  MetricSample,
242
255
  MintEnrollTokenRequest,
@@ -383,6 +396,8 @@ import {
383
396
  ScheduledTaskScheduleSpec,
384
397
  ScheduledTaskStatus,
385
398
  ScheduledTaskTriggerType,
399
+ ScopedKnowledgeActorKind,
400
+ ScopedKnowledgeScopeKind,
386
401
  ServiceTurnInitiator,
387
402
  ServiceTurnInitiatorContext,
388
403
  Session,
@@ -688,7 +703,7 @@ import {
688
703
  verifyRelayToken,
689
704
  verifyStreamToken,
690
705
  workspaceControlUtf8Bytes
691
- } from "./chunk-3Q5FLMOD.js";
706
+ } from "./chunk-YWKPXSLB.js";
692
707
  import {
693
708
  OPENGENI_SLACK_BOT_FORBIDDEN_SCOPES,
694
709
  OPENGENI_SLACK_BOT_REQUIRED_SCOPES,
@@ -751,6 +766,7 @@ export {
751
766
  ConnectionCredentialBundle,
752
767
  ConnectionKind,
753
768
  ConnectionMetadata,
769
+ ConnectionOwnership,
754
770
  ConnectionResponse,
755
771
  ConnectionStatus,
756
772
  CorrectPreferenceRegistryRequest,
@@ -913,12 +929,21 @@ export {
913
929
  InsightsSpendDriver,
914
930
  InsightsWarmGroupRow,
915
931
  IntegrationClientMetadata,
932
+ KnowledgeChangeProposalTargetKind,
933
+ KnowledgeClaimEvidencePolarity,
934
+ KnowledgeClaimOrigin,
935
+ KnowledgeClaimRelationType,
936
+ KnowledgeClaimReviewState,
937
+ KnowledgeFactObjectKind,
938
+ KnowledgeLifecycleEventType,
939
+ KnowledgeLifecycleState,
916
940
  KnowledgeMemory,
917
941
  KnowledgeMemoryKind,
918
942
  KnowledgeMemorySearchRequest,
919
943
  KnowledgeMemoryStatus,
920
944
  KnowledgeSourceKind,
921
945
  KnowledgeSourceRef,
946
+ KnowledgeSyncRunState,
922
947
  LatencyMode,
923
948
  LimitAction,
924
949
  LimitDecision,
@@ -935,6 +960,9 @@ export {
935
960
  ManagedAccount,
936
961
  MarketingDailyAnalysisTaskRequest,
937
962
  McpConnectionResourceScope,
963
+ McpPersonalConnectionDelegation,
964
+ McpPersonalConnectionDelegations,
965
+ McpPersonalConnectionSummary,
938
966
  McpServerConnectionRef,
939
967
  MetricSample,
940
968
  MintEnrollTokenRequest,
@@ -1084,6 +1112,8 @@ export {
1084
1112
  ScheduledTaskScheduleSpec,
1085
1113
  ScheduledTaskStatus,
1086
1114
  ScheduledTaskTriggerType,
1115
+ ScopedKnowledgeActorKind,
1116
+ ScopedKnowledgeScopeKind,
1087
1117
  ServiceTurnInitiator,
1088
1118
  ServiceTurnInitiatorContext,
1089
1119
  Session,
@@ -0,0 +1,233 @@
1
+ import { z } from "zod";
2
+ /** Tenant scope for normalized knowledge and source provenance. */
3
+ export declare const ScopedKnowledgeScopeKind: z.ZodEnum<{
4
+ organization: "organization";
5
+ personal: "personal";
6
+ workspace: "workspace";
7
+ }>;
8
+ export type ScopedKnowledgeScopeKind = z.infer<typeof ScopedKnowledgeScopeKind>;
9
+ export type ScopedKnowledgeScope = {
10
+ kind: "organization";
11
+ workspaceId: null;
12
+ subjectId: null;
13
+ } | {
14
+ kind: "workspace";
15
+ workspaceId: string;
16
+ subjectId: null;
17
+ } | {
18
+ kind: "personal";
19
+ workspaceId: string | null;
20
+ subjectId: string;
21
+ };
22
+ export declare const ScopedKnowledgeActorKind: z.ZodEnum<{
23
+ human: "human";
24
+ service: "service";
25
+ }>;
26
+ export type ScopedKnowledgeActorKind = z.infer<typeof ScopedKnowledgeActorKind>;
27
+ /**
28
+ * Immutable write provenance. A service actor may retain a causal human, but
29
+ * the service identity never substitutes for that human on personal reads.
30
+ */
31
+ export type ScopedKnowledgeActor = {
32
+ kind: ScopedKnowledgeActorKind;
33
+ subjectId: string;
34
+ initiatingHumanSubjectId: string | null;
35
+ };
36
+ export declare const KnowledgeLifecycleState: z.ZodEnum<{
37
+ active: "active";
38
+ deleted: "deleted";
39
+ revoked: "revoked";
40
+ }>;
41
+ export type KnowledgeLifecycleState = z.infer<typeof KnowledgeLifecycleState>;
42
+ export declare const KnowledgeLifecycleEventType: z.ZodEnum<{
43
+ acl_changed: "acl_changed";
44
+ deleted: "deleted";
45
+ object_version_added: "object_version_added";
46
+ restored: "restored";
47
+ revoked: "revoked";
48
+ sync_failed: "sync_failed";
49
+ sync_succeeded: "sync_succeeded";
50
+ }>;
51
+ export type KnowledgeLifecycleEventType = z.infer<typeof KnowledgeLifecycleEventType>;
52
+ export declare const KnowledgeSyncRunState: z.ZodEnum<{
53
+ failed: "failed";
54
+ started: "started";
55
+ succeeded: "succeeded";
56
+ }>;
57
+ export type KnowledgeSyncRunState = z.infer<typeof KnowledgeSyncRunState>;
58
+ export declare const KnowledgeClaimOrigin: z.ZodEnum<{
59
+ explicit: "explicit";
60
+ inferred: "inferred";
61
+ }>;
62
+ export type KnowledgeClaimOrigin = z.infer<typeof KnowledgeClaimOrigin>;
63
+ export declare const KnowledgeClaimRelationType: z.ZodEnum<{
64
+ conflicts_with: "conflicts_with";
65
+ supersedes: "supersedes";
66
+ }>;
67
+ export type KnowledgeClaimRelationType = z.infer<typeof KnowledgeClaimRelationType>;
68
+ export declare const KnowledgeClaimEvidencePolarity: z.ZodEnum<{
69
+ contradicts: "contradicts";
70
+ supports: "supports";
71
+ }>;
72
+ export type KnowledgeClaimEvidencePolarity = z.infer<typeof KnowledgeClaimEvidencePolarity>;
73
+ export declare const KnowledgeClaimReviewState: z.ZodEnum<{
74
+ approved: "approved";
75
+ proposed: "proposed";
76
+ rejected: "rejected";
77
+ revoked: "revoked";
78
+ }>;
79
+ export type KnowledgeClaimReviewState = z.infer<typeof KnowledgeClaimReviewState>;
80
+ export declare const KnowledgeFactObjectKind: z.ZodEnum<{
81
+ boolean: "boolean";
82
+ entity: "entity";
83
+ json: "json";
84
+ number: "number";
85
+ text: "text";
86
+ timestamp: "timestamp";
87
+ }>;
88
+ export type KnowledgeFactObjectKind = z.infer<typeof KnowledgeFactObjectKind>;
89
+ export declare const KnowledgeChangeProposalTargetKind: z.ZodEnum<{
90
+ instruction_policy: "instruction_policy";
91
+ preference: "preference";
92
+ }>;
93
+ export type KnowledgeChangeProposalTargetKind = z.infer<typeof KnowledgeChangeProposalTargetKind>;
94
+ export type KnowledgeProviderRecord = {
95
+ id: string;
96
+ accountId: string;
97
+ scope: ScopedKnowledgeScope;
98
+ providerKey: string;
99
+ externalTenantId: string;
100
+ lifecycleState: KnowledgeLifecycleState;
101
+ lifecycleGeneration: number;
102
+ createdAt: string;
103
+ updatedAt: string;
104
+ };
105
+ export type KnowledgeSourceRecord = {
106
+ id: string;
107
+ accountId: string;
108
+ providerId: string;
109
+ scope: ScopedKnowledgeScope;
110
+ externalSourceId: string;
111
+ sourceKind: string;
112
+ sourceUri: string | null;
113
+ currentAclGeneration: number | null;
114
+ syncGeneration: number;
115
+ syncCursor: string | null;
116
+ lifecycleState: KnowledgeLifecycleState;
117
+ lifecycleGeneration: number;
118
+ createdAt: string;
119
+ updatedAt: string;
120
+ };
121
+ export type KnowledgeSourceAclVersionRecord = {
122
+ id: string;
123
+ accountId: string;
124
+ sourceId: string;
125
+ generation: number;
126
+ aclVersion: string | null;
127
+ aclHash: string;
128
+ audience: ScopedKnowledgeScope;
129
+ agentAccess: boolean;
130
+ createdAt: string;
131
+ };
132
+ export type KnowledgeSyncRunRecord = {
133
+ id: string;
134
+ accountId: string;
135
+ sourceId: string;
136
+ operationId: string;
137
+ state: KnowledgeSyncRunState;
138
+ inputSyncGeneration: number;
139
+ inputLifecycleGeneration: number;
140
+ inputCursor: string | null;
141
+ outputCursor: string | null;
142
+ watermark: string | null;
143
+ metadata: Record<string, unknown>;
144
+ errorCode: string | null;
145
+ startedAt: string;
146
+ completedAt: string | null;
147
+ };
148
+ export type KnowledgeSourceObjectRecord = {
149
+ id: string;
150
+ accountId: string;
151
+ sourceId: string;
152
+ scope: ScopedKnowledgeScope;
153
+ externalObjectId: string;
154
+ documentId: string | null;
155
+ lifecycleState: KnowledgeLifecycleState;
156
+ lifecycleGeneration: number;
157
+ versionGeneration: number;
158
+ currentVersionId: string | null;
159
+ createdAt: string;
160
+ updatedAt: string;
161
+ };
162
+ export type KnowledgeDocumentVersionRecord = {
163
+ id: string;
164
+ accountId: string;
165
+ sourceId: string;
166
+ objectId: string;
167
+ scope: ScopedKnowledgeScope;
168
+ versionGeneration: number;
169
+ externalVersionId: string;
170
+ contentSha256: string;
171
+ ingestionKey: string;
172
+ aclVersionId: string;
173
+ aclGeneration: number;
174
+ documentId: string | null;
175
+ fileId: string | null;
176
+ createdAt: string;
177
+ };
178
+ export type KnowledgeEntityRecord = {
179
+ id: string;
180
+ accountId: string;
181
+ scope: ScopedKnowledgeScope;
182
+ entityType: string;
183
+ normalizedKey: string;
184
+ displayName: string;
185
+ createdAt: string;
186
+ };
187
+ export type KnowledgeFactRecord = {
188
+ id: string;
189
+ accountId: string;
190
+ scope: ScopedKnowledgeScope;
191
+ subjectEntityId: string;
192
+ predicateKey: string;
193
+ objectKind: KnowledgeFactObjectKind;
194
+ objectEntityId: string | null;
195
+ objectValue: unknown | null;
196
+ objectHash: string;
197
+ createdAt: string;
198
+ };
199
+ export type KnowledgeClaimRecord = {
200
+ id: string;
201
+ accountId: string;
202
+ scope: ScopedKnowledgeScope;
203
+ factId: string;
204
+ origin: KnowledgeClaimOrigin;
205
+ confidenceBps: number;
206
+ effectiveAt: string;
207
+ expiresAt: string | null;
208
+ extractionMethod: string;
209
+ modelProvider: string | null;
210
+ modelName: string | null;
211
+ modelVersion: string | null;
212
+ createdAt: string;
213
+ };
214
+ export type EligibleKnowledgeClaim = {
215
+ claim: KnowledgeClaimRecord;
216
+ fact: KnowledgeFactRecord;
217
+ reviewState: "approved";
218
+ supportingEvidenceCount: number;
219
+ };
220
+ export type KnowledgeChangeProposalRecord = {
221
+ id: string;
222
+ accountId: string;
223
+ scope: ScopedKnowledgeScope;
224
+ targetKind: KnowledgeChangeProposalTargetKind;
225
+ targetScope: string;
226
+ targetKey: string | null;
227
+ content: string;
228
+ contentHash: string;
229
+ claimId: string;
230
+ evidenceId: string;
231
+ status: "proposed";
232
+ createdAt: string;
233
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/contracts",
3
- "version": "0.28.1",
3
+ "version": "0.30.0",
4
4
  "description": "Shared zod schemas and wire-contract types for the OpenGeni API.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -2548,6 +2548,46 @@ export const McpServerConnectionRef = z
2548
2548
  });
2549
2549
  export type McpServerConnectionRef = z.infer<typeof McpServerConnectionRef>;
2550
2550
 
2551
+ /** Internal frozen authority for one personal MCP connection. */
2552
+ export const McpPersonalConnectionDelegation = z
2553
+ .object({
2554
+ serverId: z.string().min(1).max(256),
2555
+ connectionId: z.string().uuid(),
2556
+ ownerSubjectId: z.string().min(1).max(512),
2557
+ providerDomain: z.string().min(1).max(2048),
2558
+ kind: z.enum(["oauth2", "api_key", "app_install", "delegated"]).optional(),
2559
+ })
2560
+ .strict();
2561
+ export type McpPersonalConnectionDelegation = z.infer<typeof McpPersonalConnectionDelegation>;
2562
+
2563
+ /**
2564
+ * Exact personal MCP authority frozen on one causal turn or scheduled task.
2565
+ * One server can have at most one grant; bounded validation keeps corrupt JSON
2566
+ * from becoming executable credential authority at a DB read boundary.
2567
+ */
2568
+ export const McpPersonalConnectionDelegations = z
2569
+ .array(McpPersonalConnectionDelegation)
2570
+ .max(128)
2571
+ .superRefine((delegations, context) => {
2572
+ const seen = new Set<string>();
2573
+ for (const [index, delegation] of delegations.entries()) {
2574
+ if (seen.has(delegation.serverId)) {
2575
+ context.addIssue({
2576
+ code: "custom",
2577
+ message: "personal MCP delegations must be unique by serverId",
2578
+ path: [index, "serverId"],
2579
+ });
2580
+ }
2581
+ seen.add(delegation.serverId);
2582
+ }
2583
+ });
2584
+
2585
+ export const McpPersonalConnectionSummary = McpPersonalConnectionDelegation.pick({
2586
+ serverId: true,
2587
+ providerDomain: true,
2588
+ });
2589
+ export type McpPersonalConnectionSummary = z.infer<typeof McpPersonalConnectionSummary>;
2590
+
2551
2591
  export type McpCredentialsRequest = {
2552
2592
  accountId: string;
2553
2593
  workspaceId: string;
@@ -2575,6 +2615,7 @@ export type McpCredentialsRequest = {
2575
2615
 
2576
2616
  export type McpCredentialAuthNeededReason =
2577
2617
  | CredentialAuthNeededReason
2618
+ | "personal_authority_unavailable"
2578
2619
  | "unsupported_auth"
2579
2620
  | "resource_scope_unavailable";
2580
2621
 
@@ -4021,6 +4062,8 @@ export const SessionTurn = z.object({
4021
4062
  lineage: z.record(z.string(), z.unknown()),
4022
4063
  initiator: TurnInitiator,
4023
4064
  initiatorContext: TurnInitiatorContext,
4065
+ /** Secret-safe projection of the exact personal authority frozen on this turn. */
4066
+ personalConnections: z.array(McpPersonalConnectionSummary).default([]),
4024
4067
  cancelledBy: z.string().nullable(),
4025
4068
  cancelReason: z.string().nullable(),
4026
4069
  startedAt: z.string().nullable(),
@@ -4508,6 +4551,8 @@ export type SessionPendingInputPreview = z.infer<typeof SessionPendingInputPrevi
4508
4551
  export const SessionQueueSnapshot = z.object({
4509
4552
  version: z.number().int().nonnegative(),
4510
4553
  effectiveControl: EffectiveSessionControl,
4554
+ /** Secret-safe personal MCP summaries frozen on the exact active turn. */
4555
+ activePersonalConnections: z.array(McpPersonalConnectionSummary).default([]),
4511
4556
  /**
4512
4557
  * True while the latest attempt is interrupted but has not durably proved
4513
4558
  * quiescence: no more inference, user-visible output, or workspace-persistence
@@ -4875,6 +4920,9 @@ export const ScheduledTask = z.object({
4875
4920
  runMode: ScheduledTaskRunMode,
4876
4921
  overlapPolicy: ScheduledTaskOverlapPolicy,
4877
4922
  agentConfig: ScheduledTaskAgentConfig,
4923
+ createdBy: TurnInitiator.default({ kind: "service", subjectId: "unattributed-legacy" }),
4924
+ createdByContext: TurnInitiatorContext.default({}),
4925
+ personalConnections: z.array(McpPersonalConnectionSummary).default([]),
4878
4926
  reusableSessionId: z.string().uuid().nullable(),
4879
4927
  variableSetId: z.string().uuid().nullable().default(null),
4880
4928
  /** @deprecated use variableSetId */
@@ -5397,9 +5445,14 @@ function compareDescending(left: number | string, right: number | string): numbe
5397
5445
  export const ConnectionCredentialBundle = z.record(z.string(), z.unknown());
5398
5446
  export type ConnectionCredentialBundle = z.infer<typeof ConnectionCredentialBundle>;
5399
5447
 
5448
+ export const ConnectionOwnership = z.enum(["workspace", "personal"]);
5449
+ export type ConnectionOwnership = z.infer<typeof ConnectionOwnership>;
5450
+
5400
5451
  export const CreateConnectionRequest = z.object({
5401
5452
  providerDomain: z.string().min(1),
5402
5453
  kind: ConnectionKind,
5454
+ ownership: ConnectionOwnership.optional(),
5455
+ /** @deprecated use ownership */
5403
5456
  subjectId: z.string().min(1).nullable().optional(),
5404
5457
  credential: ConnectionCredentialBundle,
5405
5458
  grantedScopes: z.array(z.string().min(1)).default([]),
@@ -5449,6 +5502,7 @@ export const OAuthStartRequest = z
5449
5502
  requestedScopes: z.array(z.string().min(1)).default([]),
5450
5503
  returnPath: z.string().min(1).optional(),
5451
5504
  connectionId: z.string().uuid().optional(),
5505
+ ownership: ConnectionOwnership.optional(),
5452
5506
  oauthClient: z
5453
5507
  .object({
5454
5508
  clientId: z.string().min(1),
@@ -6243,6 +6297,7 @@ export const ToolAuthNeededPayload = z.object({
6243
6297
  "expired",
6244
6298
  "insufficient_scope",
6245
6299
  "refresh_failed",
6300
+ "personal_authority_unavailable",
6246
6301
  "unsupported_auth",
6247
6302
  "resource_scope_unavailable",
6248
6303
  ]),
@@ -9539,3 +9594,4 @@ export * from "./secret-redaction";
9539
9594
  export * from "./workspace-instruction-policies";
9540
9595
  export * from "./workspace-state";
9541
9596
  export * from "./preference-registry";
9597
+ export * from "./scoped-knowledge";