@opengeni/contracts 4.1.0 → 5.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.
Files changed (69) hide show
  1. package/dist/atlassian.d.ts +1 -0
  2. package/dist/atlassian.js +4 -4
  3. package/dist/bundled-skills.d.ts +5 -1
  4. package/dist/{chunk-HR6NB3CA.js → chunk-CM7E7PFV.js} +8341 -8206
  5. package/dist/chunk-CM7E7PFV.js.map +1 -0
  6. package/dist/{chunk-O5LEQHDM.js → chunk-ENJTPHKP.js} +2 -2
  7. package/dist/chunk-KUCZDFJ5.js +186 -0
  8. package/dist/chunk-KUCZDFJ5.js.map +1 -0
  9. package/dist/{chunk-5LYFSZ7O.js → chunk-YJEOWXOE.js} +8 -8
  10. package/dist/company-profile.d.ts +9 -6
  11. package/dist/connect.js +4 -4
  12. package/dist/connection-authority.d.ts +9 -317
  13. package/dist/connection-authority.js +7 -27
  14. package/dist/connector-tool-permissions.d.ts +73 -0
  15. package/dist/editable-artifact-codec-registry.js +2 -2
  16. package/dist/editable-artifact-live.js +2 -2
  17. package/dist/editable-artifact-serialized-commit.js +3 -3
  18. package/dist/editable-artifacts.js +13 -13
  19. package/dist/google-drive.d.ts +1 -0
  20. package/dist/google-drive.js +4 -4
  21. package/dist/host-mcp-bindings.d.ts +5 -0
  22. package/dist/host-mcp-bindings.js +34 -8
  23. package/dist/host-mcp-bindings.js.map +1 -1
  24. package/dist/index.d.ts +771 -3222
  25. package/dist/index.js +121 -75
  26. package/dist/knowledge-entries.d.ts +33 -0
  27. package/dist/knowledge-preparation.d.ts +207 -0
  28. package/dist/managed-sign-in-methods.d.ts +56 -0
  29. package/dist/managed-sign-in-methods.js +46 -0
  30. package/dist/managed-sign-in-methods.js.map +1 -0
  31. package/dist/mcp-oauth.d.ts +2 -2
  32. package/dist/organization-integration-policy.d.ts +27 -0
  33. package/dist/organization-usage.d.ts +102 -0
  34. package/dist/personal-github.d.ts +1 -0
  35. package/dist/personal-github.js +4 -4
  36. package/dist/remember.d.ts +6 -4
  37. package/dist/sandbox-provider-command.d.ts +91 -1
  38. package/dist/sandbox-recovery.d.ts +101 -0
  39. package/dist/session-goal-reports.d.ts +21 -0
  40. package/dist/session-message-search.d.ts +68 -0
  41. package/dist/skill-catalog-context.d.ts +7 -0
  42. package/dist/skills.d.ts +15 -0
  43. package/package.json +4 -4
  44. package/src/bundled-skills.ts +2 -0
  45. package/src/connection-authority.ts +25 -225
  46. package/src/connector-tool-permissions.ts +59 -0
  47. package/src/host-mcp-bindings.ts +37 -5
  48. package/src/index.ts +406 -755
  49. package/src/knowledge-entries.ts +4 -0
  50. package/src/knowledge-preparation.ts +50 -0
  51. package/src/managed-sign-in-methods.ts +37 -0
  52. package/src/mcp-oauth.ts +16 -18
  53. package/src/organization-integration-policy.ts +54 -0
  54. package/src/organization-usage.ts +45 -0
  55. package/src/sandbox-provider-command.ts +57 -1
  56. package/src/sandbox-recovery.ts +61 -0
  57. package/src/session-goal-reports.ts +45 -0
  58. package/src/session-message-search.ts +54 -0
  59. package/src/skill-catalog-context.ts +50 -0
  60. package/src/skills.ts +21 -6
  61. package/dist/chunk-HR6NB3CA.js.map +0 -1
  62. package/dist/chunk-J6QIYKO5.js +0 -348
  63. package/dist/chunk-J6QIYKO5.js.map +0 -1
  64. package/dist/host-mcp-resolvers.d.ts +0 -32
  65. package/dist/host-mcp-resolvers.js +0 -34
  66. package/dist/host-mcp-resolvers.js.map +0 -1
  67. package/src/host-mcp-resolvers.ts +0 -50
  68. /package/dist/{chunk-O5LEQHDM.js.map → chunk-ENJTPHKP.js.map} +0 -0
  69. /package/dist/{chunk-5LYFSZ7O.js.map → chunk-YJEOWXOE.js.map} +0 -0
@@ -1,150 +1,7 @@
1
1
  import { z } from "zod";
2
- import {
3
- ConnectionKind,
4
- ManagedUserResourceGrantMode,
5
- SessionTenancyVisibility,
6
- UserResourceAuthorityGrant,
7
- UserResourceDelegation,
8
- } from "./index";
2
+ import { ConnectionKind, SessionTenancyVisibility } from "./index";
9
3
 
10
- /** The only generic grant action that authorizes use of a connection. */
11
- export const ConnectionUseAction = z.literal("connection.use");
12
- export type ConnectionUseAction = z.infer<typeof ConnectionUseAction>;
13
-
14
- /**
15
- * Connection authority is either workspace-owned or user-owned. Omission is
16
- * intentionally compatible with the historical workspace connection path.
17
- */
18
- export const ConnectionAuthorityEnvelope = z
19
- .object({
20
- scope: z.enum(["workspace", "user"]).default("workspace"),
21
- userDelegation: UserResourceDelegation.optional(),
22
- })
23
- .strict()
24
- .superRefine((value, context) => {
25
- if (value.scope === "workspace" && value.userDelegation !== undefined) {
26
- context.addIssue({
27
- code: "custom",
28
- path: ["userDelegation"],
29
- message: "workspace connections cannot carry user delegation",
30
- });
31
- return;
32
- }
33
- if (value.scope === "user" && value.userDelegation === undefined) {
34
- context.addIssue({
35
- code: "custom",
36
- path: ["userDelegation"],
37
- message: "user connections require an immutable delegation",
38
- });
39
- return;
40
- }
41
- if (value.userDelegation && value.userDelegation.action !== ConnectionUseAction.value) {
42
- context.addIssue({
43
- code: "custom",
44
- path: ["userDelegation", "action"],
45
- message: "connection delegation must use connection.use",
46
- });
47
- }
48
- });
49
- export type ConnectionAuthorityEnvelope = z.infer<typeof ConnectionAuthorityEnvelope>;
50
-
51
- export const ConnectionAuthorityGrant = UserResourceAuthorityGrant.extend({
52
- action: ConnectionUseAction,
53
- }).strict();
54
- export type ConnectionAuthorityGrant = z.infer<typeof ConnectionAuthorityGrant>;
55
-
56
- /** Owner-only opaque projection; connection identity and owner metadata stay server-side. */
57
- export const ConnectionAuthoritySummary = z
58
- .object({
59
- authorityId: z.string().uuid(),
60
- resourceId: z.string().uuid(),
61
- originWorkspaceId: z.string().uuid().nullable(),
62
- generation: z.number().int().positive(),
63
- status: z.enum(["active", "retained", "revoked"]),
64
- grants: z.array(ConnectionAuthorityGrant),
65
- })
66
- .strict();
67
- export type ConnectionAuthoritySummary = z.infer<typeof ConnectionAuthoritySummary>;
68
-
69
- export const ListConnectionAuthoritiesQuery = z
70
- .object({
71
- scope: z.literal("user"),
72
- cursor: z.string().uuid().optional(),
73
- limit: z.coerce.number().int().min(1).max(100).default(50),
74
- })
75
- .strict();
76
- export const ListConnectionAuthoritiesResponse = z
77
- .object({
78
- scope: z.literal("user"),
79
- authorities: z.array(ConnectionAuthoritySummary),
80
- nextCursor: z.string().uuid().nullable(),
81
- })
82
- .strict();
83
-
84
- export const IssueConnectionUseGrantRequest = z
85
- .object({
86
- scope: z.literal("user"),
87
- mode: ManagedUserResourceGrantMode,
88
- context: SessionTenancyVisibility,
89
- sessionId: z.string().uuid().nullable().optional(),
90
- expectedAuthorityEpoch: z.number().int().positive().nullable().optional(),
91
- workspaceSharedAcknowledged: z.boolean().default(false),
92
- })
93
- .strict()
94
- .superRefine((value, context) => {
95
- if (value.context === "workspace_shared" && !value.workspaceSharedAcknowledged) {
96
- context.addIssue({
97
- code: "custom",
98
- path: ["workspaceSharedAcknowledged"],
99
- message: "workspace_shared requires durable shared-output acknowledgement",
100
- });
101
- }
102
- if (value.mode === "always" && (value.sessionId || value.expectedAuthorityEpoch)) {
103
- context.addIssue({ code: "custom", path: ["sessionId"], message: "always is unbound" });
104
- }
105
- if (value.mode === "session" && (!value.sessionId || !value.expectedAuthorityEpoch)) {
106
- context.addIssue({
107
- code: "custom",
108
- path: ["sessionId"],
109
- message: "session requires a target session and expectedAuthorityEpoch",
110
- });
111
- }
112
- });
113
- export type IssueConnectionUseGrantRequest = z.infer<typeof IssueConnectionUseGrantRequest>;
114
-
115
- export const RevokeConnectionUseGrantQuery = z.object({ scope: z.literal("user") }).strict();
116
-
117
- export const ConnectionUseGrantMutationResponse = z
118
- .object({
119
- scope: z.literal("user"),
120
- grant: ConnectionAuthorityGrant,
121
- })
122
- .strict();
123
- export type ConnectionUseGrantMutationResponse = z.infer<typeof ConnectionUseGrantMutationResponse>;
124
-
125
- export const ConnectionUseGrantRevocationResponse = z
126
- .object({
127
- scope: z.literal("user"),
128
- grant: z
129
- .object({
130
- grantId: z.string().uuid(),
131
- generation: z.number().int().positive(),
132
- status: z.literal("revoked"),
133
- revokedAt: z.string().datetime(),
134
- })
135
- .strict(),
136
- })
137
- .strict();
138
- export type ConnectionUseGrantRevocationResponse = z.infer<
139
- typeof ConnectionUseGrantRevocationResponse
140
- >;
141
-
142
- export const ConnectionAuthoritySelectionSource = z.enum([
143
- "explicit_workspace",
144
- "legacy_workspace_omission",
145
- "legacy_user_compatibility",
146
- "user_delegation",
147
- ]);
4
+ export const ConnectionAuthoritySelectionSource = z.enum(["explicit_workspace", "sender"]);
148
5
  export type ConnectionAuthoritySelectionSource = z.infer<typeof ConnectionAuthoritySelectionSource>;
149
6
 
150
7
  export const ConnectionUseSelectionSource = z
@@ -190,13 +47,13 @@ export const ConnectionUseAuthoritySnapshot = z
190
47
  connectionStatus: z.literal("active"),
191
48
  providerDomain: z.string().min(1).max(2048),
192
49
  connectionKind: ConnectionKind,
193
- scope: z.enum(["workspace", "user", "legacy_user"]),
50
+ scope: z.enum(["workspace", "user"]),
194
51
  ownerSubjectId: z.string().min(1).max(512).nullable(),
195
52
  ownerOrganizationMembershipId: z.string().uuid().nullable(),
196
53
  ownerMembershipAuthorizationRevision: z.number().int().positive().nullable().default(null),
197
54
  authoritySource: ConnectionAuthoritySelectionSource,
198
55
  selectionSources: z.array(ConnectionUseSelectionSource).min(1).max(128),
199
- userDelegation: UserResourceDelegation.nullable(),
56
+ userDelegation: z.null(),
200
57
  })
201
58
  .strict()
202
59
  .superRefine((value, context) => {
@@ -223,39 +80,18 @@ export const ConnectionUseAuthoritySnapshot = z
223
80
  message: "only user connections retain an owner membership revision",
224
81
  });
225
82
  }
226
- if (delegated !== (value.userDelegation !== null)) {
227
- context.addIssue({
228
- code: "custom",
229
- path: ["userDelegation"],
230
- message: "only user connections retain a delegation",
231
- });
232
- }
233
- if (delegated && value.authoritySource !== "user_delegation") {
83
+ if (delegated && value.authoritySource !== "sender") {
234
84
  context.addIssue({
235
85
  code: "custom",
236
86
  path: ["authoritySource"],
237
- message: "user connections require user_delegation provenance",
87
+ message: "user connections require authenticated sender provenance",
238
88
  });
239
89
  }
240
- if (!delegated && value.authoritySource === "user_delegation") {
90
+ if (!delegated && value.authoritySource === "sender") {
241
91
  context.addIssue({
242
92
  code: "custom",
243
93
  path: ["authoritySource"],
244
- message: "non-delegated connections cannot claim user delegation provenance",
245
- });
246
- }
247
- if (value.scope === "legacy_user" && value.authoritySource !== "legacy_user_compatibility") {
248
- context.addIssue({
249
- code: "custom",
250
- path: ["authoritySource"],
251
- message: "legacy user connections require explicit compatibility provenance",
252
- });
253
- }
254
- if (value.scope === "workspace" && value.authoritySource === "legacy_user_compatibility") {
255
- context.addIssue({
256
- code: "custom",
257
- path: ["authoritySource"],
258
- message: "workspace connections cannot claim legacy user provenance",
94
+ message: "workspace connections cannot claim sender provenance",
259
95
  });
260
96
  }
261
97
  if (!delegated && value.originWorkspaceId !== value.targetWorkspaceId) {
@@ -265,50 +101,6 @@ export const ConnectionUseAuthoritySnapshot = z
265
101
  message: "workspace connections must be owned by the target workspace",
266
102
  });
267
103
  }
268
- const delegation = value.userDelegation;
269
- if (!delegation) return;
270
- const exactFacts: Array<[boolean, (string | number)[], string]> = [
271
- [
272
- delegation.organizationId === value.organizationId,
273
- ["userDelegation", "organizationId"],
274
- "delegation organization mismatch",
275
- ],
276
- [
277
- delegation.workspaceId === value.targetWorkspaceId,
278
- ["userDelegation", "workspaceId"],
279
- "delegation target workspace mismatch",
280
- ],
281
- [
282
- delegation.action === ConnectionUseAction.value,
283
- ["userDelegation", "action"],
284
- "delegation action mismatch",
285
- ],
286
- [
287
- delegation.context === value.targetSessionVisibility,
288
- ["userDelegation", "context"],
289
- "delegation visibility mismatch",
290
- ],
291
- ];
292
- for (const [matches, path, message] of exactFacts) {
293
- if (!matches) context.addIssue({ code: "custom", path, message });
294
- }
295
- if (delegation.sessionId !== null && delegation.sessionId !== value.targetSessionId) {
296
- context.addIssue({
297
- code: "custom",
298
- path: ["userDelegation", "sessionId"],
299
- message: "delegation session mismatch",
300
- });
301
- }
302
- if (
303
- delegation.authorityEpoch !== null &&
304
- delegation.authorityEpoch !== value.targetSessionAuthorityEpoch
305
- ) {
306
- context.addIssue({
307
- code: "custom",
308
- path: ["userDelegation", "authorityEpoch"],
309
- message: "delegation authority epoch mismatch",
310
- });
311
- }
312
104
  });
313
105
  export type ConnectionUseAuthoritySnapshot = z.infer<typeof ConnectionUseAuthoritySnapshot>;
314
106
 
@@ -370,24 +162,32 @@ function refineConnectionUseAttribution(
370
162
  });
371
163
  }
372
164
  }
373
- const delegated = value.scope === "user";
374
- for (const field of ["authorityId", "grantId"] as const) {
375
- if (delegated !== (value[field] !== null)) {
165
+ const owned = value.scope === "user";
166
+ for (const field of ["authorityId"] as const) {
167
+ if (owned !== (value[field] !== null)) {
376
168
  context.addIssue({
377
169
  code: "custom",
378
170
  path: [field],
379
- message: delegated
380
- ? `delegated personal attribution requires ${field}`
381
- : `non-delegated attribution cannot carry ${field}`,
171
+ message: owned
172
+ ? `personal attribution requires ${field}`
173
+ : `non-personal attribution cannot carry ${field}`,
382
174
  });
383
175
  }
384
176
  }
177
+ if (!owned && value.grantId !== null) {
178
+ context.addIssue({
179
+ code: "custom",
180
+ path: ["grantId"],
181
+ message: "only historical personal attribution can carry a grant",
182
+ });
183
+ }
385
184
  }
386
185
 
387
186
  /** Metadata-only attribution emitted after pre-use authorization. */
388
- export const ConnectionUseAttribution = ConnectionUseAttributionFields.superRefine(
389
- refineConnectionUseAttribution,
390
- );
187
+ export const ConnectionUseAttribution = ConnectionUseAttributionFields.extend({
188
+ scope: z.enum(["workspace", "user"]),
189
+ grantId: z.null(),
190
+ }).superRefine(refineConnectionUseAttribution);
391
191
  export type ConnectionUseAttribution = z.infer<typeof ConnectionUseAttribution>;
392
192
 
393
193
  export const ConnectionUseAuditFact = ConnectionUseAttributionFields.extend({
@@ -0,0 +1,59 @@
1
+ import { z } from "zod";
2
+
3
+ export const ConnectorToolPermission = z.enum(["allow", "ask", "block"]);
4
+ export type ConnectorToolPermission = z.infer<typeof ConnectorToolPermission>;
5
+
6
+ export const ConnectorToolPermissionEntry = z.object({
7
+ name: z.string().min(1).max(512),
8
+ title: z.string().optional(),
9
+ description: z.string().optional(),
10
+ group: z.enum(["read", "write", "other"]),
11
+ permission: ConnectorToolPermission,
12
+ inherited: z.boolean(),
13
+ approvalRequired: z.boolean(),
14
+ });
15
+ export type ConnectorToolPermissionEntry = z.infer<typeof ConnectorToolPermissionEntry>;
16
+
17
+ export const ConnectorToolPermissionsResponse = z.object({
18
+ connectionId: z.string(),
19
+ serverId: z.string(),
20
+ defaultPermission: ConnectorToolPermission.nullable(),
21
+ tools: z.array(ConnectorToolPermissionEntry),
22
+ discoveryError: z.string().nullable(),
23
+ canManage: z.boolean(),
24
+ });
25
+ export type ConnectorToolPermissionsResponse = z.infer<typeof ConnectorToolPermissionsResponse>;
26
+
27
+ // Group changes name the currently displayed tools explicitly. MCP annotations
28
+ // organize the UI only; they never grant future tools permission automatically.
29
+ export const UpdateConnectorToolPermissionsRequest = z.discriminatedUnion("target", [
30
+ z
31
+ .object({
32
+ connectionId: z.string().min(1).max(512),
33
+ target: z.literal("default"),
34
+ permission: ConnectorToolPermission,
35
+ })
36
+ .strict(),
37
+ z
38
+ .object({
39
+ connectionId: z.string().min(1).max(512),
40
+ target: z.literal("tools"),
41
+ toolNames: z
42
+ .array(
43
+ z
44
+ .string()
45
+ .min(1)
46
+ .max(512)
47
+ .refine((name) => name !== "*" && name === name.trim(), {
48
+ message: "Tool names must be exact and cannot use the connector-default wildcard.",
49
+ }),
50
+ )
51
+ .min(1)
52
+ .max(2048),
53
+ permission: ConnectorToolPermission,
54
+ })
55
+ .strict(),
56
+ ]);
57
+ export type UpdateConnectorToolPermissionsRequest = z.infer<
58
+ typeof UpdateConnectorToolPermissionsRequest
59
+ >;
@@ -1,10 +1,12 @@
1
1
  import { z } from "zod";
2
2
  export { HostMcpCreateSelections, type HostMcpCreateSelection } from "./index";
3
- import { McpServerConnectionRef, SessionTenancyVisibility, stableJson } from "./index";
4
3
  import {
5
- ConnectionUseAuthoritySnapshot,
6
- IssueConnectionUseGrantRequest,
7
- } from "./connection-authority";
4
+ McpServerConnectionRef,
5
+ SessionTenancyVisibility,
6
+ ManagedUserResourceGrantMode,
7
+ stableJson,
8
+ } from "./index";
9
+ import { ConnectionUseAuthoritySnapshot } from "./connection-authority";
8
10
  import { ExternalIdentity } from "./external-identities";
9
11
  export const HostMcpOwnerSubject = z.union([
10
12
  ExternalIdentity.shape.subjectId,
@@ -112,8 +114,38 @@ export const CreateHostMcpBindingRequest = z
112
114
  .strict();
113
115
  export type CreateHostMcpBindingRequest = z.infer<typeof CreateHostMcpBindingRequest>;
114
116
 
117
+ const HostMcpGrantRequest = z
118
+ .object({
119
+ scope: z.literal("user"),
120
+ mode: ManagedUserResourceGrantMode,
121
+ context: SessionTenancyVisibility,
122
+ sessionId: z.string().uuid().nullable().optional(),
123
+ expectedAuthorityEpoch: z.number().int().positive().nullable().optional(),
124
+ workspaceSharedAcknowledged: z.boolean().default(false),
125
+ })
126
+ .strict()
127
+ .superRefine((value, context) => {
128
+ if (value.context === "workspace_shared" && !value.workspaceSharedAcknowledged) {
129
+ context.addIssue({
130
+ code: "custom",
131
+ path: ["workspaceSharedAcknowledged"],
132
+ message: "workspace_shared requires durable shared-output acknowledgement",
133
+ });
134
+ }
135
+ if (value.mode === "always" && (value.sessionId || value.expectedAuthorityEpoch)) {
136
+ context.addIssue({ code: "custom", path: ["sessionId"], message: "always is unbound" });
137
+ }
138
+ if (value.mode === "session" && (!value.sessionId || !value.expectedAuthorityEpoch)) {
139
+ context.addIssue({
140
+ code: "custom",
141
+ path: ["sessionId"],
142
+ message: "session requires a target session and expectedAuthorityEpoch",
143
+ });
144
+ }
145
+ });
146
+
115
147
  /** Internal owner-authorized issuance; never itself proves caller identity. */
116
- const HostMcpDelegationGrant = IssueConnectionUseGrantRequest.superRefine((value, context) => {
148
+ const HostMcpDelegationGrant = HostMcpGrantRequest.superRefine((value, context) => {
117
149
  if (
118
150
  Boolean(value.sessionId) !== (value.expectedAuthorityEpoch != null) ||
119
151
  (value.expectedAuthorityEpoch != null && !Number.isSafeInteger(value.expectedAuthorityEpoch))