@opengeni/core 1.0.1 → 2.2.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.
- package/dist/access/index.d.ts +37 -0
- package/dist/application/new-session-drafts.d.ts +8 -1
- package/dist/application/session-commands.d.ts +18 -11
- package/dist/application/session-tenancy.d.ts +18 -0
- package/dist/application/user-resource-grants.d.ts +20 -0
- package/dist/{chunk-6WKPWE5S.js → chunk-H7X52RI2.js} +27 -18
- package/dist/chunk-H7X52RI2.js.map +1 -0
- package/dist/{chunk-JJU6I5XD.js → chunk-VCZFFEPB.js} +21 -9
- package/dist/chunk-VCZFFEPB.js.map +1 -0
- package/dist/{chunk-NYPMQ7NO.js → chunk-ZYCNLYGH.js} +29 -27
- package/dist/chunk-ZYCNLYGH.js.map +1 -0
- package/dist/dependencies.d.ts +12 -1
- package/dist/domain/automations.d.ts +51 -0
- package/dist/domain/company-brain-governed-writes.d.ts +70 -0
- package/dist/domain/company-profile-agent-admin.d.ts +24 -0
- package/dist/domain/connection-authority.d.ts +97 -0
- package/dist/domain/connection-authority.js +169 -0
- package/dist/domain/connection-authority.js.map +1 -0
- package/dist/domain/editable-artifacts/service.d.ts +1 -2
- package/dist/domain/environments.d.ts +1 -1
- package/dist/domain/github-repository-bindings.d.ts +117 -0
- package/dist/domain/governed-learning-activation.d.ts +16 -0
- package/dist/domain/governed-learning-evaluator.d.ts +6 -0
- package/dist/domain/governed-learning-slack-publication.d.ts +45 -0
- package/dist/domain/memory-slack-delivery.d.ts +1 -4
- package/dist/domain/organization-membership-lifecycle.d.ts +1 -0
- package/dist/domain/packs.d.ts +5 -1
- package/dist/domain/personal-connection-delegations.d.ts +34 -2
- package/dist/domain/pr-review.d.ts +149 -0
- package/dist/domain/remember.d.ts +69 -0
- package/dist/domain/resources.d.ts +22 -1
- package/dist/domain/scheduled-tasks.d.ts +43 -2
- package/dist/domain/session-tool-policy.d.ts +1 -1
- package/dist/domain/sessions.d.ts +40 -6
- package/dist/editable-artifact-live/application.d.ts +10 -2
- package/dist/editable-artifact-live/ports.d.ts +0 -1
- package/dist/editable-artifact-live/server.d.ts +0 -1
- package/dist/editable-artifact-live/ticket.d.ts +0 -1
- package/dist/editable-artifact-live/types.d.ts +5 -2
- package/dist/editable-artifact-live.js +2 -2
- package/dist/editable-artifacts.js +2 -4
- package/dist/index.d.ts +13 -1
- package/dist/index.js +4827 -1164
- package/dist/index.js.map +1 -1
- package/dist/rigs/index.d.ts +22 -5
- package/dist/sandbox/fleet.d.ts +34 -6
- package/dist/sandbox/routing.d.ts +15 -1
- package/dist/sandbox/runtime-settings.d.ts +39 -0
- package/package.json +16 -11
- package/src/access/index.ts +157 -31
- package/src/application/new-session-drafts.ts +24 -2
- package/src/application/session-commands.ts +305 -71
- package/src/application/session-tenancy.ts +321 -0
- package/src/application/user-resource-grants.ts +140 -0
- package/src/billing/limits.ts +25 -15
- package/src/dependencies.ts +12 -1
- package/src/domain/automations.ts +196 -0
- package/src/domain/capabilities.ts +7 -1
- package/src/domain/company-brain-governed-writes.ts +330 -0
- package/src/domain/company-profile-agent-admin.ts +55 -0
- package/src/domain/connection-authority.ts +329 -0
- package/src/domain/editable-artifacts/agent-application.ts +17 -9
- package/src/domain/editable-artifacts/service.ts +12 -1
- package/src/domain/editable-artifacts/snapshot-compaction.ts +9 -5
- package/src/domain/editable-artifacts/snapshot-verifier-genesis.ts +10 -8
- package/src/domain/editable-artifacts/snapshot-verifier.ts +10 -3
- package/src/domain/environments.ts +16 -3
- package/src/domain/github-repository-bindings.ts +295 -0
- package/src/domain/governed-learning-activation.ts +44 -0
- package/src/domain/governed-learning-evaluator.ts +49 -0
- package/src/domain/governed-learning-slack-publication.ts +157 -0
- package/src/domain/insights.ts +9 -0
- package/src/domain/memory-slack-delivery.ts +0 -30
- package/src/domain/organization-membership-lifecycle.ts +9 -0
- package/src/domain/packs.ts +106 -3
- package/src/domain/personal-connection-delegations.ts +532 -51
- package/src/domain/pr-review.ts +671 -0
- package/src/domain/remember.ts +549 -0
- package/src/domain/resources.ts +131 -4
- package/src/domain/scheduled-tasks.ts +497 -76
- package/src/domain/session-tool-policy.ts +12 -9
- package/src/domain/sessions.ts +613 -166
- package/src/editable-artifact-live/application.ts +21 -3
- package/src/editable-artifact-live/ports.ts +0 -1
- package/src/editable-artifact-live/server.ts +13 -7
- package/src/editable-artifact-live/ticket.ts +1 -5
- package/src/editable-artifact-live/types.ts +6 -2
- package/src/editable-artifact-live/wire.ts +0 -10
- package/src/index.ts +13 -1
- package/src/rigs/index.ts +165 -48
- package/src/sandbox/fleet.ts +376 -30
- package/src/sandbox/routing.ts +91 -29
- package/src/sandbox/runtime-settings.ts +274 -0
- package/src/session-authorization.ts +17 -49
- package/dist/chunk-6WKPWE5S.js.map +0 -1
- package/dist/chunk-JJU6I5XD.js.map +0 -1
- package/dist/chunk-NYPMQ7NO.js.map +0 -1
- package/dist/domain/durable-learning-slack-publication.d.ts +0 -72
- package/src/domain/durable-learning-slack-publication.ts +0 -202
package/src/domain/resources.ts
CHANGED
|
@@ -14,8 +14,10 @@ import {
|
|
|
14
14
|
ResourceRefConflictError,
|
|
15
15
|
ResourceMountPathError,
|
|
16
16
|
stableJson,
|
|
17
|
+
type RepositoryResourceRef,
|
|
17
18
|
type ResourceRef,
|
|
18
19
|
type ToolRef,
|
|
20
|
+
type WorkspaceSessionToolDefaults,
|
|
19
21
|
} from "@opengeni/contracts";
|
|
20
22
|
import {
|
|
21
23
|
areGitHubRepositoriesAllowedForWorkspace,
|
|
@@ -42,15 +44,19 @@ export function validateToolRefs(tools: ToolRef[], settings: McpSettings): ToolR
|
|
|
42
44
|
}
|
|
43
45
|
// Tool refs are tri-state for pack portability across deployments:
|
|
44
46
|
// - bare / optional:false is STRICT: the id must be configured here and
|
|
45
|
-
// runtime connection failure fails
|
|
47
|
+
// runtime connection failure fails closed when preparation is demanded.
|
|
48
|
+
// Only an independent eager:true marker makes that a startup barrier.
|
|
46
49
|
// - optional:true + known id is preserved: runtime treats it like an
|
|
47
50
|
// auto-attached capability MCP and skips connect/list failures.
|
|
48
51
|
// - optional:true + unknown id is skipped above: the client explicitly
|
|
49
52
|
// opted into graceful degradation for MCPs (for example docs servers
|
|
50
53
|
// like context7) that only some deployments configure.
|
|
51
|
-
out.push(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
out.push({
|
|
55
|
+
kind: "mcp",
|
|
56
|
+
id: tool.id,
|
|
57
|
+
...(optional ? { optional: true } : {}),
|
|
58
|
+
...(tool.eager === true ? { eager: true } : {}),
|
|
59
|
+
});
|
|
54
60
|
}
|
|
55
61
|
return mergeToolRefs([], out);
|
|
56
62
|
}
|
|
@@ -81,6 +87,31 @@ export function withDefaultEnabledCapabilityMcpTools(
|
|
|
81
87
|
return mergeToolRefs(tools, enabledCapabilityMcpToolRefs(settings, runtimeSettings));
|
|
82
88
|
}
|
|
83
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Apply the workspace's exact new-session MCP defaults when configured.
|
|
92
|
+
* Stale or currently unavailable ids are optional and disappear from the
|
|
93
|
+
* executable selection without making every new session fail during a rolling
|
|
94
|
+
* connector change. An absent workspace override preserves the legacy
|
|
95
|
+
* deployment + enabled-capability default.
|
|
96
|
+
*/
|
|
97
|
+
export function withWorkspaceDefaultMcpTools(
|
|
98
|
+
tools: ToolRef[],
|
|
99
|
+
settings: McpSettings,
|
|
100
|
+
runtimeSettings: McpSettings,
|
|
101
|
+
defaults: WorkspaceSessionToolDefaults | null,
|
|
102
|
+
): ToolRef[] {
|
|
103
|
+
if (!defaults) {
|
|
104
|
+
return withDefaultEnabledCapabilityMcpTools(tools, settings, runtimeSettings);
|
|
105
|
+
}
|
|
106
|
+
return mergeToolRefs(
|
|
107
|
+
tools,
|
|
108
|
+
validateToolRefs(
|
|
109
|
+
defaults.mcpServerIds.map((id) => ({ kind: "mcp" as const, id, optional: true as const })),
|
|
110
|
+
runtimeSettings,
|
|
111
|
+
),
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
84
115
|
/** Drop stored refs that are no longer present in the current runtime registry. */
|
|
85
116
|
export function availableToolRefs(tools: ToolRef[], settings: McpSettings): ToolRef[] {
|
|
86
117
|
const available = new Set(settings.mcpServers.map((server) => server.id));
|
|
@@ -165,6 +196,7 @@ export function normalizeResources(resources: ResourceRef[]): ResourceRef[] {
|
|
|
165
196
|
mountPath,
|
|
166
197
|
...(resource.subpath ? { subpath: normalizeRepositorySubpath(resource.subpath) } : {}),
|
|
167
198
|
...(resource.provider ? { provider: resource.provider } : {}),
|
|
199
|
+
...(resource.connectionType ? { connectionType: resource.connectionType } : {}),
|
|
168
200
|
...(resource.credentialBindingId
|
|
169
201
|
? { credentialBindingId: resource.credentialBindingId }
|
|
170
202
|
: {}),
|
|
@@ -232,6 +264,97 @@ export function validateGitHubRepositorySelectionShapes(resources: ResourceRef[]
|
|
|
232
264
|
return [...new Set(selected.map((item) => item.installationId))];
|
|
233
265
|
}
|
|
234
266
|
|
|
267
|
+
export type PersonalGitHubRepositoryResource = RepositoryResourceRef & {
|
|
268
|
+
provider: "github";
|
|
269
|
+
connectionType: "github_personal";
|
|
270
|
+
credentialBindingId: string;
|
|
271
|
+
access: "read" | "write";
|
|
272
|
+
repositoryId: string;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
const PERSONAL_GITHUB_BINDING_ID_PATTERN =
|
|
276
|
+
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
|
|
277
|
+
|
|
278
|
+
function isPersonalGitHubRepositoryCandidate(
|
|
279
|
+
resource: ResourceRef,
|
|
280
|
+
): resource is RepositoryResourceRef & { provider: "github"; credentialBindingId: string } {
|
|
281
|
+
if (resource.kind !== "repository" || resource.connectionType !== "github_personal") {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
return resource.provider === "github" && resource.credentialBindingId !== undefined;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Validate and return the dedicated personal-GitHub repository resource lane.
|
|
289
|
+
* A host-opaque binding is only a selector for the server-side authority
|
|
290
|
+
* snapshot; it never authorizes a repository on its own.
|
|
291
|
+
*/
|
|
292
|
+
export function personalGitHubRepositoryResources(
|
|
293
|
+
resources: ResourceRef[],
|
|
294
|
+
): PersonalGitHubRepositoryResource[] {
|
|
295
|
+
const selected: PersonalGitHubRepositoryResource[] = [];
|
|
296
|
+
for (const resource of resources) {
|
|
297
|
+
if (!isPersonalGitHubRepositoryCandidate(resource)) {
|
|
298
|
+
if (resource.kind === "repository" && resource.connectionType === "github_personal") {
|
|
299
|
+
throw new HTTPException(422, {
|
|
300
|
+
message: "personal GitHub repository resources require the dedicated GitHub provider",
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
if (
|
|
306
|
+
!PERSONAL_GITHUB_BINDING_ID_PATTERN.test(resource.credentialBindingId) ||
|
|
307
|
+
typeof resource.repositoryId !== "string" ||
|
|
308
|
+
!/^[1-9]\d*$/u.test(resource.repositoryId) ||
|
|
309
|
+
(resource.access !== "read" && resource.access !== "write") ||
|
|
310
|
+
resource.installationId !== undefined ||
|
|
311
|
+
resource.githubInstallationId !== undefined ||
|
|
312
|
+
resource.githubRepositoryId !== undefined ||
|
|
313
|
+
resource.connectionId !== undefined ||
|
|
314
|
+
resource.projectId !== undefined
|
|
315
|
+
) {
|
|
316
|
+
throw new HTTPException(422, {
|
|
317
|
+
message:
|
|
318
|
+
"personal GitHub repository resources require one opaque binding, provider repository id, and explicit read or write access",
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
let uri: URL;
|
|
322
|
+
try {
|
|
323
|
+
uri = new URL(resource.uri);
|
|
324
|
+
} catch {
|
|
325
|
+
throw new HTTPException(422, { message: "personal GitHub repository URI is invalid" });
|
|
326
|
+
}
|
|
327
|
+
if (
|
|
328
|
+
uri.protocol !== "https:" ||
|
|
329
|
+
uri.hostname !== "github.com" ||
|
|
330
|
+
uri.port !== "" ||
|
|
331
|
+
uri.username !== "" ||
|
|
332
|
+
uri.password !== "" ||
|
|
333
|
+
uri.search !== "" ||
|
|
334
|
+
uri.hash !== "" ||
|
|
335
|
+
uri.pathname.endsWith(".git") ||
|
|
336
|
+
uri.pathname.split("/").filter(Boolean).length !== 2 ||
|
|
337
|
+
resource.uri !== `${uri.origin}${uri.pathname.replace(/\/$/u, "")}`
|
|
338
|
+
) {
|
|
339
|
+
throw new HTTPException(422, {
|
|
340
|
+
message: "personal GitHub repository resources require a canonical GitHub HTTPS URI",
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
selected.push(resource as PersonalGitHubRepositoryResource);
|
|
344
|
+
}
|
|
345
|
+
const identities = new Set<string>();
|
|
346
|
+
for (const resource of selected) {
|
|
347
|
+
const key = `${resource.credentialBindingId}\0${resource.repositoryId}`;
|
|
348
|
+
if (identities.has(key)) {
|
|
349
|
+
throw new HTTPException(422, {
|
|
350
|
+
message: "personal GitHub repository resources must not contain duplicates",
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
identities.add(key);
|
|
354
|
+
}
|
|
355
|
+
return selected;
|
|
356
|
+
}
|
|
357
|
+
|
|
235
358
|
/** @deprecated Use validateGitHubRepositorySelectionShapes for multi-installation sessions. */
|
|
236
359
|
export function validateGitHubRepositorySelectionShape(resources: ResourceRef[]): number | null {
|
|
237
360
|
const installationIds = validateGitHubRepositorySelectionShapes(resources);
|
|
@@ -250,6 +373,9 @@ function gitHubRepositorySelections(
|
|
|
250
373
|
if (resource.kind !== "repository") {
|
|
251
374
|
return [];
|
|
252
375
|
}
|
|
376
|
+
if (isPersonalGitHubRepositoryCandidate(resource)) {
|
|
377
|
+
return [];
|
|
378
|
+
}
|
|
253
379
|
const installationRaw =
|
|
254
380
|
resource.githubInstallationId ??
|
|
255
381
|
(resource.provider === "github" ? resource.installationId : undefined);
|
|
@@ -279,6 +405,7 @@ export async function validateGitHubRepositorySelection(
|
|
|
279
405
|
workspaceId: string,
|
|
280
406
|
resources: ResourceRef[],
|
|
281
407
|
): Promise<void> {
|
|
408
|
+
personalGitHubRepositoryResources(resources);
|
|
282
409
|
const installationIds = validateGitHubRepositorySelectionShapes(resources);
|
|
283
410
|
if (installationIds.length === 0) {
|
|
284
411
|
return;
|