@capybara-hq/kernel 0.1.0-rc.73 → 0.1.0-rc.75
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/bootstrap.json +5 -5
- package/dist/catalog/admin-catalog.schemas.d.ts +3 -1
- package/dist/catalog/admin-catalog.schemas.js +6 -2
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.schemas.d.ts +3 -1
- package/dist/catalog/org-catalog.schemas.js +3 -1
- package/dist/catalog/plugin-package.js +7 -5
- package/dist/catalog/reserved-names.js +3 -9
- package/dist/channels/actions.js +4 -0
- package/dist/channels/cards.d.ts +10 -7
- package/dist/channels/cards.js +23 -12
- package/dist/channels/phrases.d.ts +24 -2
- package/dist/channels/phrases.js +12 -2
- package/dist/ctx/secrets.d.ts +4 -2
- package/dist/ctx/secrets.js +19 -5
- package/dist/db/kernel-schema.d.ts +14 -0
- package/dist/devices/conversation-devices.d.ts +3 -2
- package/dist/devices/conversation-devices.js +9 -4
- package/dist/devices/device-projects.service.d.ts +22 -27
- package/dist/devices/device-projects.service.js +39 -44
- package/dist/devices/devices.controller.d.ts +3 -5
- package/dist/devices/devices.controller.js +4 -17
- package/dist/devices/devices.schemas.d.ts +1 -1
- package/dist/devices/devices.schemas.js +1 -1
- package/dist/devices/devices.service.d.ts +75 -52
- package/dist/devices/devices.service.js +166 -95
- package/dist/devices/project-rules.d.ts +6 -8
- package/dist/devices/project-rules.js +5 -11
- package/dist/dial-in/auth.service.js +1 -1
- package/dist/dial-in/machines.d.ts +4 -15
- package/dist/dial-in/machines.js +4 -59
- package/dist/errors.d.ts +8 -3
- package/dist/errors.js +8 -3
- package/dist/extensions/admin-ops.js +2 -1
- package/dist/extensions/bootstrap-extra.d.ts +11 -1
- package/dist/extensions/bootstrap-extra.js +21 -1
- package/dist/extensions/bootstrap-manifest.d.ts +14 -0
- package/dist/extensions/bootstrap-manifest.js +23 -0
- package/dist/extensions/bootstrap-packages.d.ts +87 -0
- package/dist/extensions/bootstrap-packages.js +263 -0
- package/dist/extensions/bootstrap.d.ts +27 -71
- package/dist/extensions/bootstrap.js +85 -329
- package/dist/extensions/guide-places.d.ts +9 -0
- package/dist/extensions/guide-places.js +32 -22
- package/dist/extensions/plugin-guides.d.ts +20 -2
- package/dist/extensions/plugin-guides.js +39 -14
- package/dist/http/meta.controller.d.ts +0 -1
- package/dist/http/meta.controller.js +2 -6
- package/dist/identity/sso-paths.d.ts +7 -0
- package/dist/identity/sso-paths.js +13 -0
- package/dist/identity/sso.js +3 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/lifecycle/kernel-lifecycle.js +2 -2
- package/dist/platform/exclusions.js +2 -7
- package/dist/platform/ops/devices.ops.js +11 -7
- package/dist/platform/ops/setup.ops.js +1 -1
- package/dist/runtime/project/knowledge.service.js +6 -5
- package/dist/sandbox/device-sandbox.d.ts +27 -2
- package/dist/sandbox/device-sandbox.js +42 -5
- package/dist/sandbox/modes.d.ts +16 -4
- package/dist/sandbox/modes.js +12 -0
- package/dist/sandbox/operation-authority.js +3 -1
- package/dist/sandbox/permission-authority-lock.d.ts +6 -0
- package/dist/sandbox/permission-authority-lock.js +14 -0
- package/dist/sandbox/permission-facts.d.ts +16 -2
- package/dist/sandbox/permission-facts.js +20 -5
- package/dist/sandbox/review/permission-candidate.d.ts +12 -7
- package/dist/sandbox/review/permission-candidate.js +28 -7
- package/dist/sandbox/sandbox.service.d.ts +18 -11
- package/dist/sandbox/sandbox.service.js +51 -24
- package/dist/setup/setup-guides.service.d.ts +3 -4
- package/dist/setup/setup-guides.service.js +2 -5
- package/dist/shares/sweep.job.d.ts +2 -0
- package/dist/shares/sweep.job.js +3 -1
- package/dist/tools/approvals.service.d.ts +31 -11
- package/dist/tools/approvals.service.js +55 -19
- package/dist/tools/builtins/sandbox/common.d.ts +2 -2
- package/dist/tools/builtins/sandbox/common.js +2 -2
- package/dist/tools/network-asks.d.ts +103 -20
- package/dist/tools/network-asks.js +133 -18
- package/dist/tools/pipeline.d.ts +5 -0
- package/dist/tools/pipeline.js +15 -8
- package/package.json +3 -3
- package/src/migrations/0178_bootstrap_run_extra.sql +17 -0
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { SETUP_GUIDE_PLACE_INFO, } from "@capybara-hq/plugin-sdk";
|
|
8
8
|
import { webhookBase, webhookUrlOf } from "../channels/webhook-url.js";
|
|
9
9
|
import { ApiError } from "../errors.js";
|
|
10
|
+
import { ssoCallbackPath } from "../identity/sso-paths.js";
|
|
10
11
|
import { OAUTH_CALLBACK_PATH } from "../tools/oauth/flow-paths.js";
|
|
11
12
|
/**
|
|
12
13
|
* The org action each audience of a place needs besides `catalog.read` (spec §9.1).
|
|
@@ -25,7 +26,7 @@ const invalidQuery = (path, message) => new ApiError("validation_failed", "Reque
|
|
|
25
26
|
/** The target parameters each place takes; another place's parameter is 400. */
|
|
26
27
|
const TARGET_PARAMS = {
|
|
27
28
|
"channel-connection": ["connectionId", "name"],
|
|
28
|
-
"connector-template": ["connectorId"],
|
|
29
|
+
"connector-template": ["connectorId", "templateId"],
|
|
29
30
|
"extension-deployment": [],
|
|
30
31
|
"device-connection": [],
|
|
31
32
|
};
|
|
@@ -51,11 +52,11 @@ export async function resolvePlace(ctx) {
|
|
|
51
52
|
pluginVersion: ctx.item.version,
|
|
52
53
|
};
|
|
53
54
|
const reasons = {};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
: `${publicUrl}/api/v1/auth/sso/${encodeURIComponent(ctx.item.name)}/callback`;
|
|
55
|
+
// every place offering it gets the same URL: the SSO controller's callback route
|
|
56
|
+
const signIn = publicUrl === null ? null : `${publicUrl}${ssoCallbackPath(ctx.item.name)}`;
|
|
57
57
|
let target = null;
|
|
58
58
|
let storedMode = null;
|
|
59
|
+
let template = null;
|
|
59
60
|
if (place === "channel-connection") {
|
|
60
61
|
const connection = ctx.query.connectionId === undefined
|
|
61
62
|
? undefined
|
|
@@ -75,20 +76,32 @@ export async function resolvePlace(ctx) {
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
else if (place === "connector-template") {
|
|
79
|
+
const templates = ctx.guide.templates ?? [];
|
|
80
|
+
const asked = ctx.query.templateId;
|
|
81
|
+
if (asked !== undefined && !templates.includes(asked)) {
|
|
82
|
+
throw invalidQuery("templateId", `templateId must be one of the guide's templates: ${templates.join(", ")}`);
|
|
83
|
+
}
|
|
78
84
|
const connector = ctx.query.connectorId === undefined
|
|
79
85
|
? undefined
|
|
80
|
-
: await liveConnector(ctx, ctx.query.connectorId);
|
|
86
|
+
: await liveConnector(ctx, ctx.query.connectorId, asked === undefined ? templates : [asked]);
|
|
87
|
+
template =
|
|
88
|
+
connector?.template_id ?? asked ?? (templates.length === 1 ? (templates[0] ?? null) : null);
|
|
81
89
|
values.oauthCallbackUrl = publicUrl === null ? null : `${publicUrl}${OAUTH_CALLBACK_PATH}`;
|
|
82
90
|
values.signInCallbackUrl = signIn;
|
|
83
|
-
values.templateId =
|
|
84
|
-
values.templateName = await templateName(ctx);
|
|
91
|
+
values.templateId = template;
|
|
92
|
+
values.templateName = template === null ? null : await templateName(ctx, template);
|
|
93
|
+
reasons.templateId = "no_template";
|
|
94
|
+
reasons.templateName = "no_template";
|
|
85
95
|
values.connectorName = connector?.name ?? null;
|
|
86
96
|
reasons.connectorName = "no_connector";
|
|
87
97
|
if (connector !== undefined)
|
|
88
98
|
target = { kind: "connector", id: connector.id };
|
|
89
99
|
}
|
|
90
|
-
|
|
91
|
-
|
|
100
|
+
else if (place === "extension-deployment") {
|
|
101
|
+
values.signInCallbackUrl = signIn;
|
|
102
|
+
}
|
|
103
|
+
// `extension-deployment`: the common variables and the sign-in callback URL, no org and no
|
|
104
|
+
// target (the deployment); `device-connection`: the common ones and `orgId`, no target
|
|
92
105
|
reasons.publicUrl = "public_url";
|
|
93
106
|
reasons.signInCallbackUrl = "public_url";
|
|
94
107
|
reasons.oauthCallbackUrl = "public_url";
|
|
@@ -100,7 +113,7 @@ export async function resolvePlace(ctx) {
|
|
|
100
113
|
if (!Object.hasOwn(known, name) || values[name] !== null)
|
|
101
114
|
delete reasons[name];
|
|
102
115
|
}
|
|
103
|
-
return { values, reasons, target, storedMode };
|
|
116
|
+
return { values, reasons, target, storedMode, template };
|
|
104
117
|
}
|
|
105
118
|
/** A live connection of the org on the guide's plugin; otherwise `channel.not_found`. */
|
|
106
119
|
async function liveConnection(ctx, id) {
|
|
@@ -120,24 +133,24 @@ async function liveConnection(ctx, id) {
|
|
|
120
133
|
return c;
|
|
121
134
|
}
|
|
122
135
|
/**
|
|
123
|
-
* A live connector of the org made from the guide's
|
|
124
|
-
* the platform component of the item's template, org-owned
|
|
125
|
-
* `connector.not_found`, also for a custom connector or one made
|
|
136
|
+
* A live connector of the org made from one of `templates` (the guide's, or the one asked for;
|
|
137
|
+
* `connectors.platform_template_id` -> the platform component of the item's template, org-owned
|
|
138
|
+
* plugins included); otherwise `connector.not_found`, also for a custom connector or one made
|
|
139
|
+
* from another template.
|
|
126
140
|
*/
|
|
127
|
-
async function liveConnector(ctx, id) {
|
|
141
|
+
async function liveConnector(ctx, id, templates) {
|
|
128
142
|
const notFound = () => new ApiError("connector.not_found", "Connector not found");
|
|
129
|
-
|
|
130
|
-
if (ctx.org === null || template === undefined || !UUID_RE.test(id))
|
|
143
|
+
if (ctx.org === null || templates.length === 0 || !UUID_RE.test(id))
|
|
131
144
|
throw notFound();
|
|
132
145
|
const c = await ctx.db
|
|
133
146
|
.selectFrom("connectors as c")
|
|
134
147
|
.innerJoin("platform_connector_templates as t", "t.id", "c.platform_template_id")
|
|
135
|
-
.select(["c.id", "c.name"])
|
|
148
|
+
.select(["c.id", "c.name", "t.template_id"])
|
|
136
149
|
.where("c.id", "=", id)
|
|
137
150
|
.where("c.org_id", "=", ctx.org.orgId)
|
|
138
151
|
.where("c.deleted_at", "is", null)
|
|
139
152
|
.where("t.catalog_item_id", "=", ctx.item.id)
|
|
140
|
-
.where("t.template_id", "
|
|
153
|
+
.where("t.template_id", "in", [...templates])
|
|
141
154
|
.executeTakeFirst();
|
|
142
155
|
if (!c)
|
|
143
156
|
throw notFound();
|
|
@@ -147,10 +160,7 @@ async function liveConnector(ctx, id) {
|
|
|
147
160
|
* The template's display name in the document's language, from the platform component made from
|
|
148
161
|
* it at import (`platform_connector_templates.file`); the template id when there is none.
|
|
149
162
|
*/
|
|
150
|
-
async function templateName(ctx) {
|
|
151
|
-
const id = ctx.guide.template;
|
|
152
|
-
if (id === undefined)
|
|
153
|
-
return null;
|
|
163
|
+
async function templateName(ctx, id) {
|
|
154
164
|
const row = await ctx.db
|
|
155
165
|
.selectFrom("platform_connector_templates")
|
|
156
166
|
.select("file")
|
|
@@ -62,8 +62,14 @@ export interface RenderedSetupGuide {
|
|
|
62
62
|
version: string;
|
|
63
63
|
id: string;
|
|
64
64
|
place: SetupGuidePlace;
|
|
65
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* The connector template a `connector-template` guide is rendered for (the target connector's,
|
|
67
|
+
* the one asked for, or the guide's only one); null for other places and when a guide covering
|
|
68
|
+
* several templates was rendered without naming one.
|
|
69
|
+
*/
|
|
66
70
|
template: string | null;
|
|
71
|
+
/** The connector templates a `connector-template` guide covers; empty for other places. */
|
|
72
|
+
templates: string[];
|
|
67
73
|
/** The document rendered (zh falls back to en). */
|
|
68
74
|
locale: "en" | "zh";
|
|
69
75
|
title: string;
|
|
@@ -231,6 +237,16 @@ export declare class PluginGuides {
|
|
|
231
237
|
guide: PluginSetupGuide;
|
|
232
238
|
row: ItemRow;
|
|
233
239
|
}>>;
|
|
240
|
+
/**
|
|
241
|
+
* Plugin name -> its device-connection guide ref, for device provider plugins whose item the
|
|
242
|
+
* org's catalog shows (`GET /devices`); others are absent.
|
|
243
|
+
*/
|
|
244
|
+
deviceGuides(names: string[], org: {
|
|
245
|
+
orgId: string;
|
|
246
|
+
role: OrgRole;
|
|
247
|
+
}): Promise<Map<string, SetupGuideRef>>;
|
|
248
|
+
/** Plugin name -> its guide of a place, for plugins whose item the org's catalog shows. */
|
|
249
|
+
private guidesByPlace;
|
|
234
250
|
/** The guide fields of channel connections (one query each for guides and documents; spec §11). */
|
|
235
251
|
connectionStates(connections: {
|
|
236
252
|
id: string;
|
|
@@ -270,10 +286,12 @@ export declare class PluginGuides {
|
|
|
270
286
|
}, itemId: string, guideId: string, q: GuideQuery): Promise<RenderedSetupGuide>;
|
|
271
287
|
/**
|
|
272
288
|
* Renders a guide for the platform (the super admin's preview, `GET /admin/catalog/:itemId/guides/
|
|
273
|
-
* :guideId`): any live item, the admin audience, no org (`orgName` unresolved) and no target
|
|
289
|
+
* :guideId`): any live item, the admin audience, no org (`orgName` unresolved) and no target;
|
|
290
|
+
* `templateId` picks the template a guide covering several is shown for.
|
|
274
291
|
*/
|
|
275
292
|
renderForPlatform(itemId: string, guideId: string, q: {
|
|
276
293
|
locale?: "en" | "zh" | undefined;
|
|
294
|
+
templateId?: string | undefined;
|
|
277
295
|
}): Promise<RenderedSetupGuide>;
|
|
278
296
|
/**
|
|
279
297
|
* The `extension-deployment` guides of an extension, rendered for the platform (the super
|
|
@@ -23,7 +23,7 @@ import { orgVisibleItems } from "./plugin-icons.js";
|
|
|
23
23
|
export { PLACE_ACTIONS } from "./guide-places.js";
|
|
24
24
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
25
25
|
const GUIDE_ID_RE = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
26
|
-
const GUIDE_KEYS = new Set(["id", "place", "
|
|
26
|
+
const GUIDE_KEYS = new Set(["id", "place", "templates"]);
|
|
27
27
|
const itemNotFound = () => new ApiError("catalog.item_not_found", "Catalog item not found");
|
|
28
28
|
const guideNotFound = () => new ApiError("catalog.guide_not_found", "The plugin has no such setup guide");
|
|
29
29
|
const invalidQuery = (path, message) => new ApiError("validation_failed", "Request validation failed", [{ path, message }]);
|
|
@@ -59,7 +59,9 @@ function isV2Guide(g) {
|
|
|
59
59
|
typeof o.id === "string" &&
|
|
60
60
|
GUIDE_ID_RE.test(o.id) &&
|
|
61
61
|
SETUP_GUIDE_PLACES.includes(o.place) &&
|
|
62
|
-
(o.
|
|
62
|
+
(o.templates === undefined ||
|
|
63
|
+
(Array.isArray(o.templates) &&
|
|
64
|
+
o.templates.every((t) => typeof t === "string" && GUIDE_ID_RE.test(t)))));
|
|
63
65
|
}
|
|
64
66
|
/**
|
|
65
67
|
* A version's v2 guides and the entries skipped: a version imported before setup guides v2 keeps
|
|
@@ -78,7 +80,7 @@ const defaultAudience = (place) => {
|
|
|
78
80
|
return audiences.includes("admin") ? "admin" : (audiences[0] ?? "admin");
|
|
79
81
|
};
|
|
80
82
|
/** A plugin's guide for a place (and template): the manifest allows at most one. */
|
|
81
|
-
const guideFor = (manifest, place, templateId) => guidesOf(manifest).guides.find((g) => g.place === place && (templateId === undefined || g.
|
|
83
|
+
const guideFor = (manifest, place, templateId) => guidesOf(manifest).guides.find((g) => g.place === place && (templateId === undefined || (g.templates ?? []).includes(templateId)));
|
|
82
84
|
/**
|
|
83
85
|
* A connector template's guide in a version's manifest (v2 entries only), for callers that already
|
|
84
86
|
* hold the manifest (the org catalog detail).
|
|
@@ -281,7 +283,9 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
|
|
|
281
283
|
* admin's or the owner's preview).
|
|
282
284
|
*/
|
|
283
285
|
async templateGuideChanges(itemId, from, to) {
|
|
284
|
-
const targets = guidesOf(to.manifest).guides.
|
|
286
|
+
const targets = guidesOf(to.manifest).guides.flatMap((g) => g.place === "connector-template"
|
|
287
|
+
? (g.templates ?? []).map((templateId) => ({ guide: g, templateId }))
|
|
288
|
+
: []);
|
|
285
289
|
if (targets.length === 0)
|
|
286
290
|
return [];
|
|
287
291
|
const fromRow = from === null
|
|
@@ -293,8 +297,7 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
|
|
|
293
297
|
.where("version", "=", from)
|
|
294
298
|
.executeTakeFirst();
|
|
295
299
|
const out = [];
|
|
296
|
-
for (const guide of targets) {
|
|
297
|
-
const templateId = guide.template;
|
|
300
|
+
for (const { guide, templateId } of targets) {
|
|
298
301
|
const toHash = await this.storedHash(to, guide);
|
|
299
302
|
if (toHash === undefined)
|
|
300
303
|
continue;
|
|
@@ -336,13 +339,28 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
|
|
|
336
339
|
* (`GET channels/schema/:plugin` and the connection pages); others are absent.
|
|
337
340
|
*/
|
|
338
341
|
async channelGuides(names, org) {
|
|
342
|
+
return this.guidesByPlace("channel-connection", names, org);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Plugin name -> its device-connection guide ref, for device provider plugins whose item the
|
|
346
|
+
* org's catalog shows (`GET /devices`); others are absent.
|
|
347
|
+
*/
|
|
348
|
+
async deviceGuides(names, org) {
|
|
349
|
+
const out = new Map();
|
|
350
|
+
for (const [name, { itemId, guideId, version }] of await this.guidesByPlace("device-connection", names, org)) {
|
|
351
|
+
out.set(name, { itemId, guideId, version });
|
|
352
|
+
}
|
|
353
|
+
return out;
|
|
354
|
+
}
|
|
355
|
+
/** Plugin name -> its guide of a place, for plugins whose item the org's catalog shows. */
|
|
356
|
+
async guidesByPlace(place, names, org) {
|
|
339
357
|
const out = new Map();
|
|
340
358
|
if (names.length === 0)
|
|
341
359
|
return out;
|
|
342
|
-
const rows = (await this.latest("name", names)).filter((r) => guideFor(r.manifest,
|
|
360
|
+
const rows = (await this.latest("name", names)).filter((r) => guideFor(r.manifest, place) !== undefined);
|
|
343
361
|
const visible = await orgVisibleItems(this.db, rows, org.orgId, roleAtLeast(org.role, "admin"));
|
|
344
362
|
for (const r of visible) {
|
|
345
|
-
const guide = guideFor(r.manifest,
|
|
363
|
+
const guide = guideFor(r.manifest, place);
|
|
346
364
|
out.set(r.name, {
|
|
347
365
|
itemId: r.id,
|
|
348
366
|
guideId: guide.id,
|
|
@@ -465,13 +483,19 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
|
|
|
465
483
|
guide,
|
|
466
484
|
locale: docs.locale,
|
|
467
485
|
org: { orgId: org.orgId, name: orgRow?.name ?? "" },
|
|
468
|
-
query: {
|
|
486
|
+
query: {
|
|
487
|
+
connectionId: q.connectionId,
|
|
488
|
+
name: q.name,
|
|
489
|
+
connectorId: q.connectorId,
|
|
490
|
+
templateId: q.templateId,
|
|
491
|
+
},
|
|
469
492
|
});
|
|
470
493
|
return this.renderDoc(row, guide, docs, resolution, { mode: q.mode, audience });
|
|
471
494
|
}
|
|
472
495
|
/**
|
|
473
496
|
* Renders a guide for the platform (the super admin's preview, `GET /admin/catalog/:itemId/guides/
|
|
474
|
-
* :guideId`): any live item, the admin audience, no org (`orgName` unresolved) and no target
|
|
497
|
+
* :guideId`): any live item, the admin audience, no org (`orgName` unresolved) and no target;
|
|
498
|
+
* `templateId` picks the template a guide covering several is shown for.
|
|
475
499
|
*/
|
|
476
500
|
async renderForPlatform(itemId, guideId, q) {
|
|
477
501
|
if (!UUID_RE.test(itemId))
|
|
@@ -483,7 +507,7 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
|
|
|
483
507
|
const guide = guidesOf(row.manifest).guides.find((g) => g.id === guideId);
|
|
484
508
|
if (!guide)
|
|
485
509
|
throw guideNotFound();
|
|
486
|
-
return this.renderPlatformDoc(row, guide, q.locale ?? "en");
|
|
510
|
+
return this.renderPlatformDoc(row, guide, q.locale ?? "en", { templateId: q.templateId });
|
|
487
511
|
}
|
|
488
512
|
/**
|
|
489
513
|
* The `extension-deployment` guides of an extension, rendered for the platform (the super
|
|
@@ -530,7 +554,7 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
|
|
|
530
554
|
return this.renderPlatformDoc(row, guide, q.locale ?? "en");
|
|
531
555
|
}
|
|
532
556
|
/** A guide rendered without an org: the place's default audience, no target, `orgName` unresolved. */
|
|
533
|
-
async renderPlatformDoc(row, guide, locale) {
|
|
557
|
+
async renderPlatformDoc(row, guide, locale, query = {}) {
|
|
534
558
|
const docs = await this.documents(row, guide, locale);
|
|
535
559
|
const resolution = await resolvePlace({
|
|
536
560
|
db: this.db,
|
|
@@ -539,7 +563,7 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
|
|
|
539
563
|
guide,
|
|
540
564
|
locale: docs.locale,
|
|
541
565
|
org: null,
|
|
542
|
-
query
|
|
566
|
+
query,
|
|
543
567
|
});
|
|
544
568
|
return this.renderDoc(row, guide, docs, resolution, {
|
|
545
569
|
mode: undefined,
|
|
@@ -577,7 +601,8 @@ let PluginGuides = PluginGuides_1 = class PluginGuides {
|
|
|
577
601
|
version: row.latest_version,
|
|
578
602
|
id: guide.id,
|
|
579
603
|
place: guide.place,
|
|
580
|
-
template:
|
|
604
|
+
template: resolution.template,
|
|
605
|
+
templates: guide.templates ?? [],
|
|
581
606
|
locale: docs.locale,
|
|
582
607
|
title: doc.title,
|
|
583
608
|
modes: doc.modes,
|
|
@@ -27,13 +27,11 @@ export const MetaResponseSchema = z.object({
|
|
|
27
27
|
protocols: z.object({
|
|
28
28
|
/**
|
|
29
29
|
* The `capybara-device` protocol majors the loaded dial-in providers speak (their
|
|
30
|
-
* `permissions.dialIn.protocol`); without any, the SDK's major
|
|
30
|
+
* `permissions.dialIn.protocol`); without any, the SDK's major.
|
|
31
31
|
*/
|
|
32
32
|
device: z.object({ min: z.number().int(), max: z.number().int() }),
|
|
33
33
|
}),
|
|
34
34
|
features: z.object({
|
|
35
|
-
/** A dial-in provider speaking `capybara-device/<major>` (device-local) is loaded. */
|
|
36
|
-
localDevices: z.boolean(),
|
|
37
35
|
appSignIn: z.boolean(),
|
|
38
36
|
/** App ids a push provider covers with the providers that do; `[]` without `http.publicUrl`. */
|
|
39
37
|
push: z.array(z.object({ appId: z.string(), providers: z.array(z.string()) })),
|
|
@@ -77,8 +75,7 @@ let MetaController = class MetaController {
|
|
|
77
75
|
this.iconUrl("favicon"),
|
|
78
76
|
]);
|
|
79
77
|
const appSignIn = Boolean(config.http.publicUrl);
|
|
80
|
-
//
|
|
81
|
-
// (device-local); the shells offer "connect this machine" only then.
|
|
78
|
+
// The capybara-device majors the loaded dial-in providers (device-local) speak.
|
|
82
79
|
const devices = deviceProtocolRange(this.dialIn.loaded().map((p) => p.protocol));
|
|
83
80
|
return {
|
|
84
81
|
name: config.platform.name ?? null,
|
|
@@ -88,7 +85,6 @@ let MetaController = class MetaController {
|
|
|
88
85
|
device: devices ?? { min: DEVICE_PROTOCOL_VERSION, max: DEVICE_PROTOCOL_VERSION },
|
|
89
86
|
},
|
|
90
87
|
features: {
|
|
91
|
-
localDevices: devices !== null,
|
|
92
88
|
// The authorize route answers app_auth.unavailable without http.publicUrl.
|
|
93
89
|
appSignIn,
|
|
94
90
|
// A push message carries the deployment origin, which needs http.publicUrl.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The prefix of the SSO routes (`SsoController`); also the browser binding cookie's Path. */
|
|
2
|
+
export declare const SSO_PATH_PREFIX = "/api/v1/auth/sso";
|
|
3
|
+
/**
|
|
4
|
+
* The path of a sign-in source's callback route (`GET /api/v1/auth/sso/:plugin/callback`):
|
|
5
|
+
* `http.publicUrl` + this is the redirect URI registered at the identity provider.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ssoCallbackPath(plugin: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The third-party sign-in routes' paths: a leaf module (no service imports), so the SSO flow and
|
|
2
|
+
// `{{signInCallbackUrl}}` of the setup guides build the callback from one place. The controller's
|
|
3
|
+
// decorators stay string literals (check:platform-ops matches routes by them);
|
|
4
|
+
// test/identity/sso-paths.test.ts keeps them and these constants equal.
|
|
5
|
+
/** The prefix of the SSO routes (`SsoController`); also the browser binding cookie's Path. */
|
|
6
|
+
export const SSO_PATH_PREFIX = "/api/v1/auth/sso";
|
|
7
|
+
/**
|
|
8
|
+
* The path of a sign-in source's callback route (`GET /api/v1/auth/sso/:plugin/callback`):
|
|
9
|
+
* `http.publicUrl` + this is the redirect URI registered at the identity provider.
|
|
10
|
+
*/
|
|
11
|
+
export function ssoCallbackPath(plugin) {
|
|
12
|
+
return `${SSO_PATH_PREFIX}/${encodeURIComponent(plugin)}/callback`;
|
|
13
|
+
}
|
package/dist/identity/sso.js
CHANGED
|
@@ -16,12 +16,13 @@ import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
|
16
16
|
import { KERNEL_LOGGER, REDIS } from "../infra/tokens.js";
|
|
17
17
|
import { isSafeReturnPath } from "../tools/oauth/flow-paths.js";
|
|
18
18
|
import { ExternalIdentities, IdentityNotVerified } from "./external.js";
|
|
19
|
+
import { SSO_PATH_PREFIX, ssoCallbackPath } from "./sso-paths.js";
|
|
19
20
|
/** state 的有效期(秒)。 */
|
|
20
21
|
export const SSO_STATE_TTL_SECONDS = 600;
|
|
21
22
|
/** 浏览器绑定 Cookie:回调必须来自发起登录的同一个浏览器(防登录 CSRF / 把回跳链接转给别人)。 */
|
|
22
23
|
export const SSO_BINDING_COOKIE = "cap_sso";
|
|
23
24
|
/** 绑定 Cookie 的 Path:覆盖所有插件的回调。 */
|
|
24
|
-
export const SSO_COOKIE_PATH =
|
|
25
|
+
export const SSO_COOKIE_PATH = SSO_PATH_PREFIX;
|
|
25
26
|
/** 登录失败回到的网页(next-intl 会补语言前缀)。 */
|
|
26
27
|
export const LOGIN_PATH = "/login";
|
|
27
28
|
/** 插件 `callback` 的最长等待。 */
|
|
@@ -84,7 +85,7 @@ let SsoFlow = class SsoFlow {
|
|
|
84
85
|
}
|
|
85
86
|
redirectUri(plugin) {
|
|
86
87
|
const base = (this.config.get().http.publicUrl ?? "").replace(/\/+$/, "");
|
|
87
|
-
return `${base}
|
|
88
|
+
return `${base}${ssoCallbackPath(plugin)}`;
|
|
88
89
|
}
|
|
89
90
|
/** 绑定 Cookie 是否加 Secure:`auth.cookieSecure`,或 `http.publicUrl` 是 https(浏览器经 https 访问)。 */
|
|
90
91
|
cookieSecure() {
|
package/dist/index.d.ts
CHANGED
|
@@ -30,8 +30,10 @@ export { ExtensionAdminOps } from "./extensions/admin-ops.js";
|
|
|
30
30
|
export { ExtensionAdmin, PLUGINS_CHANGED_TOPIC } from "./extensions/admin-view.js";
|
|
31
31
|
export { type ApprovalDecision, ExtensionApprovals, type PendingExtension, type PermissionSnapshot, planApprovals, snapshotCovers, withPreApproved, } from "./extensions/approvals.js";
|
|
32
32
|
export { blobKey, ExtensionBlobIntegrityError, type ExtensionBlobSource, ExtensionBlobs, } from "./extensions/blobs.js";
|
|
33
|
-
export {
|
|
33
|
+
export { type BootstrapEntryResult, BootstrapFailedError, type BootstrapFailure, type BootstrapResult, BootstrapService, } from "./extensions/bootstrap.js";
|
|
34
34
|
export { BootstrapExtraMismatchError, type ExtraManifestTraces, hasExtraManifestTraces, loadBootstrapManifest, type MergedBootstrapManifest, mergeBootstrapManifests, missingExtraManifestMessage, readBootstrapExtraManifest, } from "./extensions/bootstrap-extra.js";
|
|
35
|
+
export { BOOTSTRAP_MANIFEST_FILE, bootstrapManifestSha256, readBootstrapManifest, } from "./extensions/bootstrap-manifest.js";
|
|
36
|
+
export { type BootstrapGitPlugin, type BootstrapResolveOptions, readBootstrapGitPlugin, resolveBootstrapPackages, } from "./extensions/bootstrap-packages.js";
|
|
35
37
|
export { type ExtensionCli, openExtensionCli } from "./extensions/cli.js";
|
|
36
38
|
export { DEPLOYMENT_SECRETS_ORG, type DeploymentConfigField, type DeploymentConfigView, ExtensionDeploymentConfigService, mergeDeploymentConfig, PLUGIN_DEPLOYMENT_CONFIG_TOPIC, readStoredDeploymentConfig, type SecretEntry, } from "./extensions/deployment-config.js";
|
|
37
39
|
export { assertSecretsReachable, ExtensionHost, type ExtensionLoadPlan, type InspectedExtension, type InstalledExtensionLoader, type InstallFailureReason, } from "./extensions/host.js";
|
package/dist/index.js
CHANGED
|
@@ -29,8 +29,10 @@ export { ExtensionAdminOps } from "./extensions/admin-ops.js";
|
|
|
29
29
|
export { ExtensionAdmin, PLUGINS_CHANGED_TOPIC } from "./extensions/admin-view.js";
|
|
30
30
|
export { ExtensionApprovals, planApprovals, snapshotCovers, withPreApproved, } from "./extensions/approvals.js";
|
|
31
31
|
export { blobKey, ExtensionBlobIntegrityError, ExtensionBlobs, } from "./extensions/blobs.js";
|
|
32
|
-
export {
|
|
32
|
+
export { BootstrapFailedError, BootstrapService, } from "./extensions/bootstrap.js";
|
|
33
33
|
export { BootstrapExtraMismatchError, hasExtraManifestTraces, loadBootstrapManifest, mergeBootstrapManifests, missingExtraManifestMessage, readBootstrapExtraManifest, } from "./extensions/bootstrap-extra.js";
|
|
34
|
+
export { BOOTSTRAP_MANIFEST_FILE, bootstrapManifestSha256, readBootstrapManifest, } from "./extensions/bootstrap-manifest.js";
|
|
35
|
+
export { readBootstrapGitPlugin, resolveBootstrapPackages, } from "./extensions/bootstrap-packages.js";
|
|
34
36
|
export { openExtensionCli } from "./extensions/cli.js";
|
|
35
37
|
export { DEPLOYMENT_SECRETS_ORG, ExtensionDeploymentConfigService, mergeDeploymentConfig, PLUGIN_DEPLOYMENT_CONFIG_TOPIC, readStoredDeploymentConfig, } from "./extensions/deployment-config.js";
|
|
36
38
|
export { assertSecretsReachable, ExtensionHost, } from "./extensions/host.js";
|
|
@@ -18,7 +18,7 @@ import { PromptSuggestionQueue } from "../conversations/prompt-suggestions.js";
|
|
|
18
18
|
import { TitleQueue } from "../conversations/titles.js";
|
|
19
19
|
import { migrate } from "../db/migrator.js";
|
|
20
20
|
import { ExtensionBlobs } from "../extensions/blobs.js";
|
|
21
|
-
import { BootstrapFailedError, BootstrapService,
|
|
21
|
+
import { BootstrapFailedError, BootstrapService, } from "../extensions/bootstrap.js";
|
|
22
22
|
import { BootstrapDefaultsService } from "../extensions/bootstrap-defaults.js";
|
|
23
23
|
import { BootstrapExtraMismatchError, hasExtraManifestTraces, loadBootstrapManifest, missingExtraManifestMessage, syncExtraMarketplaces, } from "../extensions/bootstrap-extra.js";
|
|
24
24
|
import { ExtensionHost } from "../extensions/host.js";
|
|
@@ -380,7 +380,7 @@ let KernelLifecycle = class KernelLifecycle {
|
|
|
380
380
|
async runBootstrap(dir, final = false) {
|
|
381
381
|
const manifest = await this.manifest();
|
|
382
382
|
const bootstrap = this.bootstrap;
|
|
383
|
-
if (await bootstrap.isDone(
|
|
383
|
+
if (await bootstrap.isDone(manifest))
|
|
384
384
|
return false;
|
|
385
385
|
try {
|
|
386
386
|
// The second pass records what the first one did (not `kept` for what it installed)
|
|
@@ -235,13 +235,8 @@ export const PLATFORM_EXCLUSIONS = [
|
|
|
235
235
|
// (`git/gateway.route.ts`), not a Nest controller, so it is not listed (like the webhook)
|
|
236
236
|
// devices (personal cloud devices, environments design phase 1)
|
|
237
237
|
// connected machines (environments design phase 2): device sign-in by the program and on the
|
|
238
|
-
// confirmation page
|
|
239
|
-
//
|
|
240
|
-
{
|
|
241
|
-
route: "DELETE /api/v1/orgs/:orgId/devices/:id/machine",
|
|
242
|
-
category: "human-only",
|
|
243
|
-
reason: "Disconnects a person's own machine (revokes its credential); a trust decision taken on the device's page",
|
|
244
|
-
},
|
|
238
|
+
// confirmation page. The machine's WebSocket (`GET /device/connect`) is a raw gateway-role
|
|
239
|
+
// route, not a Nest controller, so it is not listed (like the webhook)
|
|
245
240
|
{
|
|
246
241
|
route: "POST /api/v1/device/authorize",
|
|
247
242
|
category: "transport",
|
|
@@ -114,7 +114,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
114
114
|
this.registry.register([
|
|
115
115
|
defineOperation({
|
|
116
116
|
id: "devices.list",
|
|
117
|
-
description: "List your own devices in this org: one compact row each (name, state, whether it is the default, provider, whether it is a dial-in device signed in from a machine, whether that machine is online and which it is, last use), plus the default and last used ids, the device providers on in this org (a new device may name one) and the default provider (null: a new device must name one). The default device is shown as Personal. A device stays on the provider it was created on; while that provider is off it is unavailable.",
|
|
117
|
+
description: "List your own devices in this org: one compact row each (name, state, whether it is the default, provider, whether it is a dial-in device signed in from a machine, whether that machine is online and which it is, last use), plus the default and last used ids, the device providers on in this org (a new device may name one; each has its name, description and whether it is a dial-in provider) and the default provider (null: a new device must name one). A dial-in provider's devices are made on the machine, not created here. The default device is shown as Personal. A device stays on the provider it was created on; while that provider is off it is unavailable.",
|
|
118
118
|
input: z.object({}).strict(),
|
|
119
119
|
example: {},
|
|
120
120
|
authz: { orgAction: "agents.use" },
|
|
@@ -126,7 +126,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
126
126
|
items: l.items.map(row),
|
|
127
127
|
defaultId: l.defaultId,
|
|
128
128
|
lastUsedId: l.lastUsedId,
|
|
129
|
-
providers: l.providers,
|
|
129
|
+
providers: l.providers.map(({ guide: _guide, ...p }) => p),
|
|
130
130
|
defaultProvider: l.defaultProvider,
|
|
131
131
|
};
|
|
132
132
|
},
|
|
@@ -158,7 +158,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
158
158
|
}),
|
|
159
159
|
defineOperation({
|
|
160
160
|
id: "devices.create",
|
|
161
|
-
description: "Create a personal cloud device with a name (1-64 characters, unique among yours, case-insensitive) on a device provider: provider is one of the providers devices.list returns; omit it for the org's default provider. The device stays on that provider for life. It is ready at once; its instance and files are made on first use. Devices are limited per person.",
|
|
161
|
+
description: "Create a personal cloud device with a name (1-64 characters, unique among yours, case-insensitive) on a device provider: provider is one of the providers devices.list returns that is not a dial-in provider (a dial-in provider's device is created on the machine by following its guide on the web); omit it for the org's default provider. The device stays on that provider for life. It is ready at once; its instance and files are made on first use. Devices are limited per person.",
|
|
162
162
|
input: DeviceCreateBody,
|
|
163
163
|
example: { name: "Data analysis" },
|
|
164
164
|
authz: { orgAction: "agents.use" },
|
|
@@ -185,6 +185,10 @@ let DevicesOperations = class DevicesOperations {
|
|
|
185
185
|
member: "Call again naming one of the providers in the message as provider; with none listed, ask an org admin to switch one on.",
|
|
186
186
|
},
|
|
187
187
|
},
|
|
188
|
+
{
|
|
189
|
+
code: "device.provider_dial_in",
|
|
190
|
+
next: "That provider's devices are made on the machine: tell the person to follow its guide in 新建设备 on the web, or name a provider whose dialIn is false.",
|
|
191
|
+
},
|
|
188
192
|
{
|
|
189
193
|
code: "validation_failed",
|
|
190
194
|
next: "Name a provider devices.list returns under providers, or omit provider for the default one.",
|
|
@@ -376,7 +380,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
376
380
|
}),
|
|
377
381
|
defineOperation({
|
|
378
382
|
id: "devices.list-projects",
|
|
379
|
-
description: "List
|
|
383
|
+
description: "List every project of one of your devices (name and absolute path), plus the base a new project's path is relative to (the home directory the device reports, else its workspace) and whether the device offers projects at all. Takes the id from devices.list.",
|
|
380
384
|
input: DeviceId,
|
|
381
385
|
example: { deviceId: "4e8a0c1d-6b2f-4a37-8d19-3c5e7f9a1b20" },
|
|
382
386
|
authz: { orgAction: "agents.use" },
|
|
@@ -414,7 +418,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
414
418
|
}),
|
|
415
419
|
defineOperation({
|
|
416
420
|
id: "devices.add-project",
|
|
417
|
-
description: "Add a project to one of your devices: path is relative to the device's base (see devices.list-projects; empty for the base itself), never absolute, and
|
|
421
|
+
description: "Add a project to one of your devices: path is relative to the device's base (see devices.list-projects; empty for the base itself), never absolute, and never above the owner's home; name defaults to the directory's name (1-64 characters, no /, unique on the device). The device is asked first, so a missing directory, a file, an unreadable path or one the device refuses (with its reason) is refused. At most 100 projects per device. Takes the id from devices.list.",
|
|
418
422
|
input: DeviceId.extend(DeviceProjectAddBody.shape).strict(),
|
|
419
423
|
example: { deviceId: "4e8a0c1d-6b2f-4a37-8d19-3c5e7f9a1b20", path: "src/capybara" },
|
|
420
424
|
authz: { orgAction: "agents.use" },
|
|
@@ -436,7 +440,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
436
440
|
},
|
|
437
441
|
{
|
|
438
442
|
code: "device.project_outside_mode",
|
|
439
|
-
next: "
|
|
443
|
+
next: "The device does not let a project reach this directory: pick one inside its base (see devices.list-projects).",
|
|
440
444
|
},
|
|
441
445
|
{
|
|
442
446
|
code: "device.project_path_missing",
|
|
@@ -452,7 +456,7 @@ let DevicesOperations = class DevicesOperations {
|
|
|
452
456
|
},
|
|
453
457
|
{
|
|
454
458
|
code: "device.project_refused",
|
|
455
|
-
next: "The device
|
|
459
|
+
next: "The device refused the path: the reason says why; pick another directory.",
|
|
456
460
|
},
|
|
457
461
|
{
|
|
458
462
|
code: "device.projects_unsupported",
|
|
@@ -88,7 +88,7 @@ let SetupOperations = class SetupOperations {
|
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
code: "validation_failed",
|
|
91
|
-
next: "Pass a mode and audience the guide has (setup.guides lists the audience) and the target of its place: connectionId for a channel guide, connectorId for a connector template guide.",
|
|
91
|
+
next: "Pass a mode and audience the guide has (setup.guides lists the audience) and the target of its place: connectionId for a channel guide, connectorId (or templateId, one of the guide's templates) for a connector template guide.",
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
code: "forbidden",
|
|
@@ -12,7 +12,7 @@ import { DeviceProtocolError } from "@capybara-hq/plugin-sdk/device-protocol";
|
|
|
12
12
|
import { Inject, Injectable, Optional } from "@nestjs/common";
|
|
13
13
|
import { EventLog } from "../../conversations/event-log.js";
|
|
14
14
|
import { ConversationDevices } from "../../devices/conversation-devices.js";
|
|
15
|
-
import { DeviceProjectsService
|
|
15
|
+
import { DeviceProjectsService } from "../../devices/device-projects.service.js";
|
|
16
16
|
import { aboveHome } from "../../devices/working-root.js";
|
|
17
17
|
import { ApiError } from "../../errors.js";
|
|
18
18
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
@@ -210,12 +210,13 @@ let ProjectKnowledgeService = class ProjectKnowledgeService {
|
|
|
210
210
|
},
|
|
211
211
|
}, async (h, p, info, sig) => {
|
|
212
212
|
const target = { project: bound.project, root: bound.root, mode: scope.mode };
|
|
213
|
-
// the kernel's own check first: a root the
|
|
214
|
-
//
|
|
215
|
-
//
|
|
213
|
+
// the kernel's own check first: a root above the owner's home is refused as the working
|
|
214
|
+
// root's rule refuses it (`workingRootOf`, the same home: the reported one, else the
|
|
215
|
+
// workspace's prefix); below it, what the device serves is its provider's rule (a
|
|
216
|
+
// refusal is read as the root being outside what it can read)
|
|
216
217
|
const reported = scope.home;
|
|
217
218
|
const home = reported?.startsWith("/") ? reported : homeOf(info.roots.workspace);
|
|
218
|
-
if (
|
|
219
|
+
if (aboveHome(bound.root, home)) {
|
|
219
220
|
return unavailableProject(bound.project, bound.root, projectUnavailable.outsideMode(bound.root, scope.mode));
|
|
220
221
|
}
|
|
221
222
|
const list = p.list;
|
|
@@ -10,8 +10,17 @@ import type { SandboxBoundary, SandboxPermissionSupport } from "@capybara-hq/plu
|
|
|
10
10
|
*/
|
|
11
11
|
/** The sandbox network: the open public internet or an allowlist. `allowlist` is narrower. */
|
|
12
12
|
export type DeviceNetworkMode = "open" | "allowlist";
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The layer that set a ceiling, named by a disabled option and an actionable error. `owner` is the
|
|
15
|
+
* owner of the machine the device runs on, when its provider says that owner keeps the crossing
|
|
16
|
+
* closed (`SandboxPermissionSupport.limitedBy`); `provider` is the provider's own limit.
|
|
17
|
+
*/
|
|
18
|
+
export type DeviceSandboxLayer = "platform" | "org" | "device" | "owner" | "provider";
|
|
19
|
+
/**
|
|
20
|
+
* Whether a ceiling's layer is the device's side (its provider, or the owner of the machine it
|
|
21
|
+
* runs on): it clamps the sandbox network, never what an org allows per call.
|
|
22
|
+
*/
|
|
23
|
+
export declare const deviceSideLayer: (layer: DeviceSandboxLayer | null | undefined) => boolean;
|
|
15
24
|
/**
|
|
16
25
|
* The platform's device sandbox settings, as the settings reader returns them (env > file / Nacos >
|
|
17
26
|
* the super admin's stored choice > default `allowed`, `open`, `open`).
|
|
@@ -71,6 +80,11 @@ export interface DeviceSandboxProviderLayer {
|
|
|
71
80
|
perOperationHosts: boolean;
|
|
72
81
|
};
|
|
73
82
|
outsideSandbox: boolean;
|
|
83
|
+
/** Who keeps a closed crossing closed when not the provider itself (support `limitedBy`). */
|
|
84
|
+
limitedBy?: {
|
|
85
|
+
outsideSandbox?: "owner";
|
|
86
|
+
openPublic?: "owner";
|
|
87
|
+
};
|
|
74
88
|
}
|
|
75
89
|
/** The effective device sandbox: the same under every permission profile. */
|
|
76
90
|
export interface DeviceSandbox {
|
|
@@ -168,6 +182,17 @@ export declare function hostGrantRefusal(host: string, box: Pick<DeviceSandbox,
|
|
|
168
182
|
perCallHosts?: boolean;
|
|
169
183
|
layer?: Pick<DeviceSandbox["layer"], "network">;
|
|
170
184
|
}, platform: Pick<DeviceSandboxPlatformLayer, "egress" | "allowHosts" | "orgHosts">, org: DeviceSandboxOrgLayer): string | null;
|
|
185
|
+
/**
|
|
186
|
+
* Why `host` cannot be added to this device's own network list, naming who can make it possible,
|
|
187
|
+
* or null when it can. The device's list only narrows the org's effective hosts
|
|
188
|
+
* ({@link effectiveDeviceSandbox}, {@link orgHostsOf}), so a host is addable only when the network
|
|
189
|
+
* is not closed and either an org extra kept in those hosts covers it, or a kept platform entry
|
|
190
|
+
* covers it and no org exclusion (a pattern, as for a per-call grant) does. Exclusions drop
|
|
191
|
+
* platform entries only: never an extra, and nothing under `base: none`. Otherwise the refusal
|
|
192
|
+
* names the org admin (removing the exclusion, or adding the host when the org may extend the
|
|
193
|
+
* platform's list or the platform's list covers it), else the super admin.
|
|
194
|
+
*/
|
|
195
|
+
export declare function deviceListAddRefusal(host: string, box: Pick<DeviceSandbox, "networkMode" | "networkCeiling" | "layer">, platform: Pick<DeviceSandboxPlatformLayer, "egress" | "allowHosts" | "orgHosts">, org: DeviceSandboxOrgLayer): string | null;
|
|
171
196
|
/**
|
|
172
197
|
* The crossing ceilings a Full access consent covers (approval-only profiles design, "Consent
|
|
173
198
|
* fingerprint"): running outside, the network ceiling and mode and the per-call host ceiling.
|