@capybara-hq/kernel 0.1.0-rc.37 → 0.1.0-rc.39
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/admin/admin.module.d.ts +2 -1
- package/dist/admin/admin.module.js +5 -1
- package/dist/admin/org-network.controller.d.ts +30 -0
- package/dist/admin/org-network.controller.js +77 -0
- package/dist/admin/org-network.schemas.d.ts +16 -0
- package/dist/admin/org-network.schemas.js +27 -0
- package/dist/admin/org-network.service.d.ts +41 -0
- package/dist/admin/org-network.service.js +101 -0
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/config/schema.d.ts +1 -0
- package/dist/config/schema.js +8 -2
- package/dist/conversations/attachments.service.d.ts +39 -0
- package/dist/conversations/attachments.service.js +59 -22
- package/dist/conversations/conversations.controller.d.ts +1 -1
- package/dist/conversations/conversations.controller.js +1 -1
- package/dist/conversations/conversations.service.d.ts +5 -1
- package/dist/conversations/conversations.service.js +9 -2
- package/dist/conversations/event-log.js +4 -1
- package/dist/conversations/files.d.ts +39 -12
- package/dist/conversations/files.js +134 -55
- package/dist/ctx/create-ctx.d.ts +8 -1
- package/dist/ctx/create-ctx.js +12 -1
- package/dist/ctx/net.d.ts +50 -0
- package/dist/ctx/net.js +67 -0
- package/dist/db/kernel-schema.d.ts +10 -0
- package/dist/devices/devices.service.js +2 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +5 -0
- package/dist/extensions/extensions.module.js +3 -0
- package/dist/extensions/host.d.ts +7 -1
- package/dist/extensions/host.js +13 -3
- package/dist/files/previewers.js +6 -0
- package/dist/http/api.module.js +2 -0
- package/dist/infra/database/transaction-host.d.ts +32 -1
- package/dist/infra/database/transaction-host.js +30 -4
- package/dist/infra/database/xact-lock.d.ts +16 -0
- package/dist/infra/database/xact-lock.js +28 -1
- package/dist/net/public-address.d.ts +21 -1
- package/dist/net/public-address.js +56 -10
- package/dist/net/safe-fetch.d.ts +4 -1
- package/dist/net/safe-fetch.js +15 -4
- package/dist/orgs/directory-sync.js +2 -0
- package/dist/orgs/members.service.js +5 -0
- package/dist/orgs/network-allowances.service.d.ts +79 -0
- package/dist/orgs/network-allowances.service.js +371 -0
- package/dist/orgs/offboarding.d.ts +3 -1
- package/dist/orgs/offboarding.js +9 -2
- package/dist/orgs/org-lock.d.ts +28 -2
- package/dist/orgs/org-lock.js +59 -4
- package/dist/orgs/orgs.controller.d.ts +11 -2
- package/dist/orgs/orgs.controller.js +19 -3
- package/dist/orgs/orgs.module.d.ts +2 -1
- package/dist/orgs/orgs.module.js +5 -1
- package/dist/orgs/orgs.schemas.d.ts +12 -0
- package/dist/orgs/orgs.schemas.js +5 -0
- package/dist/orgs/orgs.service.js +6 -1
- package/dist/overrides.d.ts +4 -0
- package/dist/overrides.js +2 -0
- package/dist/platform/ops/conversations.ops.js +2 -1
- package/dist/platform/ops/orgs.ops.d.ts +7 -1
- package/dist/platform/ops/orgs.ops.js +122 -3
- package/dist/platform/route-schemas.js +3 -0
- package/dist/runtime/checkpointer.d.ts +3 -0
- package/dist/runtime/checkpointer.js +7 -4
- package/dist/runtime/langgraph-loop.js +8 -3
- package/dist/runtime/run-execution.d.ts +56 -3
- package/dist/runtime/run-execution.js +77 -8
- package/dist/runtime/step-log.d.ts +5 -0
- package/dist/runtime/step-log.js +9 -4
- package/dist/runtime/waits.js +3 -1
- package/dist/tools/connector-content.js +1 -0
- package/dist/tools/connectors.service.js +9 -6
- package/dist/tools/drift.d.ts +5 -1
- package/dist/tools/drift.js +9 -4
- package/dist/tools/pipeline.js +1 -0
- package/package.json +3 -3
- package/src/migrations/0145_org_network_allowances.sql +12 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deployment administration: the setup wizard, the audit log reader (the platform's and each
|
|
3
3
|
* org's) and the admin overview with its health read, seven-day usage aggregate and dead outbox
|
|
4
|
-
* rows (its controllers are the api
|
|
4
|
+
* rows, and the super admin's side of the org network allowances (its controllers are the api
|
|
5
|
+
* role's, `ApiModule`).
|
|
5
6
|
*/
|
|
6
7
|
export declare class AdminModule {
|
|
7
8
|
}
|
|
@@ -20,6 +20,7 @@ import { RunJobsModule } from "../runtime/run-jobs.js";
|
|
|
20
20
|
import { UsageReportModule } from "../runtime/usage-report.js";
|
|
21
21
|
import { AuditLogService } from "./audit-log.service.js";
|
|
22
22
|
import { AdminHealthService } from "./health.service.js";
|
|
23
|
+
import { OrgNetworkAdmin } from "./org-network.service.js";
|
|
23
24
|
import { OutboxDeadService } from "./outbox-dead.service.js";
|
|
24
25
|
import { AdminOverviewService } from "./overview.service.js";
|
|
25
26
|
import { SetupService } from "./setup.service.js";
|
|
@@ -28,7 +29,8 @@ import { AdminUsageService } from "./usage.service.js";
|
|
|
28
29
|
/**
|
|
29
30
|
* Deployment administration: the setup wizard, the audit log reader (the platform's and each
|
|
30
31
|
* org's) and the admin overview with its health read, seven-day usage aggregate and dead outbox
|
|
31
|
-
* rows (its controllers are the api
|
|
32
|
+
* rows, and the super admin's side of the org network allowances (its controllers are the api
|
|
33
|
+
* role's, `ApiModule`).
|
|
32
34
|
*/
|
|
33
35
|
let AdminModule = class AdminModule {
|
|
34
36
|
};
|
|
@@ -60,6 +62,7 @@ AdminModule = __decorate([
|
|
|
60
62
|
AdminHealthService,
|
|
61
63
|
AdminUsageService,
|
|
62
64
|
OutboxDeadService,
|
|
65
|
+
OrgNetworkAdmin,
|
|
63
66
|
],
|
|
64
67
|
exports: [
|
|
65
68
|
SetupService,
|
|
@@ -68,6 +71,7 @@ AdminModule = __decorate([
|
|
|
68
71
|
AdminHealthService,
|
|
69
72
|
AdminUsageService,
|
|
70
73
|
OutboxDeadService,
|
|
74
|
+
OrgNetworkAdmin,
|
|
71
75
|
],
|
|
72
76
|
})
|
|
73
77
|
], AdminModule);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import { type Principal } from "../identity/principal.js";
|
|
3
|
+
import { type NetworkAllowanceView } from "../orgs/orgs.schemas.js";
|
|
4
|
+
import { AdminOrgParams } from "./admin.schemas.js";
|
|
5
|
+
import { NetworkAllowanceBody, NetworkAllowanceParams } from "./org-network.schemas.js";
|
|
6
|
+
import { OrgNetworkAdmin } from "./org-network.service.js";
|
|
7
|
+
/**
|
|
8
|
+
* An org's network allowances (`/api/v1/admin/orgs/:orgId/network-allowances`, plugin safe fetch
|
|
9
|
+
* spec): the internal endpoints the org's extension requests may reach although they resolve to
|
|
10
|
+
* private or loopback addresses. Super admins only (service tokens 403); adding and removing are
|
|
11
|
+
* audited `org.network_allowance_added` / `org.network_allowance_removed`. Org admins read their
|
|
12
|
+
* org's list at `GET /api/v1/orgs/:orgId/network-allowances`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AdminOrgNetworkController {
|
|
15
|
+
private readonly admin;
|
|
16
|
+
constructor(admin: OrgNetworkAdmin);
|
|
17
|
+
/** The org's entries, oldest first; a missing or deleted org → `org.not_found`. */
|
|
18
|
+
list({ orgId }: z.infer<typeof AdminOrgParams>): Promise<{
|
|
19
|
+
allowances: NetworkAllowanceView[];
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Adds an entry; an invalid one → 400 `org.network_allowance_invalid` with the reason. Only a
|
|
23
|
+
* person widens: a personal access token → 400 `org.network_allowance_widen_not_allowed`.
|
|
24
|
+
*/
|
|
25
|
+
add(principal: Principal, { orgId }: z.infer<typeof AdminOrgParams>, body: z.infer<typeof NetworkAllowanceBody>): Promise<{
|
|
26
|
+
allowance: NetworkAllowanceView;
|
|
27
|
+
}>;
|
|
28
|
+
/** Removes an entry; an id the org does not list → 404 `org.network_allowance_not_found`. */
|
|
29
|
+
remove(principal: Principal, { orgId, id }: z.infer<typeof AdminOrgParams> & z.infer<typeof NetworkAllowanceParams>): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Controller, Delete, Get, HttpCode, Inject, Post } from "@nestjs/common";
|
|
11
|
+
import { CurrentPrincipal, SuperAdmin } from "../identity/principal.js";
|
|
12
|
+
import { writeActorOf } from "../identity/write-actor.js";
|
|
13
|
+
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
14
|
+
import { ZBody, ZParam } from "../infra/validation/zod-params.js";
|
|
15
|
+
import { networkAllowanceView } from "../orgs/orgs.schemas.js";
|
|
16
|
+
import { AdminOrgParams } from "./admin.schemas.js";
|
|
17
|
+
import { NetworkAllowanceBody, NetworkAllowanceParams } from "./org-network.schemas.js";
|
|
18
|
+
import { OrgNetworkAdmin } from "./org-network.service.js";
|
|
19
|
+
class AdminOrgNetworkParamsDto extends createZodDto(AdminOrgParams, "AdminOrgNetworkParams") {
|
|
20
|
+
}
|
|
21
|
+
class NetworkAllowanceItemParamsDto extends createZodDto(AdminOrgParams.extend(NetworkAllowanceParams.shape), "NetworkAllowanceItemParams") {
|
|
22
|
+
}
|
|
23
|
+
class NetworkAllowanceBodyDto extends createZodDto(NetworkAllowanceBody, "NetworkAllowanceBody") {
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An org's network allowances (`/api/v1/admin/orgs/:orgId/network-allowances`, plugin safe fetch
|
|
27
|
+
* spec): the internal endpoints the org's extension requests may reach although they resolve to
|
|
28
|
+
* private or loopback addresses. Super admins only (service tokens 403); adding and removing are
|
|
29
|
+
* audited `org.network_allowance_added` / `org.network_allowance_removed`. Org admins read their
|
|
30
|
+
* org's list at `GET /api/v1/orgs/:orgId/network-allowances`.
|
|
31
|
+
*/
|
|
32
|
+
let AdminOrgNetworkController = class AdminOrgNetworkController {
|
|
33
|
+
admin;
|
|
34
|
+
constructor(admin) {
|
|
35
|
+
this.admin = admin;
|
|
36
|
+
}
|
|
37
|
+
/** The org's entries, oldest first; a missing or deleted org → `org.not_found`. */
|
|
38
|
+
async list({ orgId }) {
|
|
39
|
+
return { allowances: (await this.admin.list(orgId)).map(networkAllowanceView) };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Adds an entry; an invalid one → 400 `org.network_allowance_invalid` with the reason. Only a
|
|
43
|
+
* person widens: a personal access token → 400 `org.network_allowance_widen_not_allowed`.
|
|
44
|
+
*/
|
|
45
|
+
async add(principal, { orgId }, body) {
|
|
46
|
+
const actor = writeActorOf(principal);
|
|
47
|
+
const allowance = await this.admin.add(orgId, body.entry, actor, actor.tokenId !== undefined);
|
|
48
|
+
return { allowance: networkAllowanceView(allowance) };
|
|
49
|
+
}
|
|
50
|
+
/** Removes an entry; an id the org does not list → 404 `org.network_allowance_not_found`. */
|
|
51
|
+
async remove(principal, { orgId, id }) {
|
|
52
|
+
await this.admin.remove(orgId, id, writeActorOf(principal));
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
__decorate([
|
|
56
|
+
Get(),
|
|
57
|
+
__param(0, ZParam(AdminOrgNetworkParamsDto))
|
|
58
|
+
], AdminOrgNetworkController.prototype, "list", null);
|
|
59
|
+
__decorate([
|
|
60
|
+
Post(),
|
|
61
|
+
HttpCode(201),
|
|
62
|
+
__param(0, CurrentPrincipal()),
|
|
63
|
+
__param(1, ZParam(AdminOrgNetworkParamsDto)),
|
|
64
|
+
__param(2, ZBody(NetworkAllowanceBodyDto))
|
|
65
|
+
], AdminOrgNetworkController.prototype, "add", null);
|
|
66
|
+
__decorate([
|
|
67
|
+
Delete(":id"),
|
|
68
|
+
HttpCode(204),
|
|
69
|
+
__param(0, CurrentPrincipal()),
|
|
70
|
+
__param(1, ZParam(NetworkAllowanceItemParamsDto))
|
|
71
|
+
], AdminOrgNetworkController.prototype, "remove", null);
|
|
72
|
+
AdminOrgNetworkController = __decorate([
|
|
73
|
+
Controller("api/v1/admin/orgs/:orgId/network-allowances"),
|
|
74
|
+
SuperAdmin(),
|
|
75
|
+
__param(0, Inject(OrgNetworkAdmin))
|
|
76
|
+
], AdminOrgNetworkController);
|
|
77
|
+
export { AdminOrgNetworkController };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { RouteSchemas } from "../platform/route-schemas.js";
|
|
3
|
+
/**
|
|
4
|
+
* `POST /api/v1/admin/orgs/:orgId/network-allowances`: one internal endpoint the org's extension
|
|
5
|
+
* requests may reach (plugin safe fetch spec). The service checks and normalizes the entry and
|
|
6
|
+
* refuses an invalid one with `org.network_allowance_invalid`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NetworkAllowanceBody: z.ZodObject<{
|
|
9
|
+
entry: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
/** `DELETE /api/v1/admin/orgs/:orgId/network-allowances/:id`. */
|
|
12
|
+
export declare const NetworkAllowanceParams: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
/** The super admin's org network allowance routes (the org admins' read is in `ORG_ROUTES`). */
|
|
16
|
+
export declare const ORG_NETWORK_ROUTES: readonly RouteSchemas[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* `POST /api/v1/admin/orgs/:orgId/network-allowances`: one internal endpoint the org's extension
|
|
4
|
+
* requests may reach (plugin safe fetch spec). The service checks and normalizes the entry and
|
|
5
|
+
* refuses an invalid one with `org.network_allowance_invalid`.
|
|
6
|
+
*/
|
|
7
|
+
export const NetworkAllowanceBody = z.object({
|
|
8
|
+
entry: z
|
|
9
|
+
.string()
|
|
10
|
+
.min(1)
|
|
11
|
+
.max(300)
|
|
12
|
+
.describe("A hostname or *.domain wildcard (https, any port), an IP address or CIDR (e.g. 10.1.0.0/16), or an origin such as http://mcp.internal:8080 (exactly that origin, plain http allowed)."),
|
|
13
|
+
});
|
|
14
|
+
/** `DELETE /api/v1/admin/orgs/:orgId/network-allowances/:id`. */
|
|
15
|
+
export const NetworkAllowanceParams = z.object({
|
|
16
|
+
id: z.string().min(1).max(100).describe("The allowance id (from the list)."),
|
|
17
|
+
});
|
|
18
|
+
/** The super admin's org network allowance routes (the org admins' read is in `ORG_ROUTES`). */
|
|
19
|
+
export const ORG_NETWORK_ROUTES = [
|
|
20
|
+
// `:orgId` is never compared: the admin operations name the org with an `orgId` extra
|
|
21
|
+
{ route: "GET /api/v1/admin/orgs/:orgId/network-allowances" },
|
|
22
|
+
{ route: "POST /api/v1/admin/orgs/:orgId/network-allowances", body: NetworkAllowanceBody },
|
|
23
|
+
{
|
|
24
|
+
route: "DELETE /api/v1/admin/orgs/:orgId/network-allowances/:id",
|
|
25
|
+
params: NetworkAllowanceParams,
|
|
26
|
+
},
|
|
27
|
+
];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
2
|
+
import type { WriteActor } from "../identity/write-actor.js";
|
|
3
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
4
|
+
import { type OrgNetworkAllowance, OrgNetworkAllowances } from "../orgs/network-allowances.service.js";
|
|
5
|
+
import { OrgsService } from "../orgs/orgs.service.js";
|
|
6
|
+
/**
|
|
7
|
+
* The super admin's side of the org network allowances (plugin safe fetch spec): the admin routes
|
|
8
|
+
* and their Platform operations call it. Writes take the super admin lock and re-check the actor
|
|
9
|
+
* in the same transaction as the store's write (`OrgNetworkAllowances` joins it).
|
|
10
|
+
*
|
|
11
|
+
* Only a person widens: an add is refused for an API token or the Platform tool (`onlyNarrows`)
|
|
12
|
+
* with `org.network_allowance_widen_not_allowed`; listing and removing stay open to both.
|
|
13
|
+
*/
|
|
14
|
+
export declare class OrgNetworkAdmin {
|
|
15
|
+
private readonly allowances;
|
|
16
|
+
private readonly orgs;
|
|
17
|
+
private readonly adminLock;
|
|
18
|
+
readonly txHost: TransactionHost;
|
|
19
|
+
constructor(allowances: OrgNetworkAllowances, orgs: OrgsService, adminLock: SuperAdminLock, txHost: TransactionHost);
|
|
20
|
+
/** The org's entries, oldest first; a missing or deleted org is `org.not_found`. */
|
|
21
|
+
list(orgId: string): Promise<OrgNetworkAllowance[]>;
|
|
22
|
+
/**
|
|
23
|
+
* The read-only preconditions of {@link add}, throwing its own refusals: `onlyNarrows` →
|
|
24
|
+
* `org.network_allowance_widen_not_allowed`, a missing org → `org.not_found`, an invalid entry →
|
|
25
|
+
* `org.network_allowance_invalid` (the cap is checked by the write only).
|
|
26
|
+
*/
|
|
27
|
+
checkAdd(orgId: string, entry: string, onlyNarrows: boolean): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Adds an entry (audited `org.network_allowance_added`); an entry already listed is returned.
|
|
30
|
+
* `onlyNarrows` (an API token, the Platform tool) refuses it: only a person widens. The actor's
|
|
31
|
+
* token id and `auditDetail` go into the audit event.
|
|
32
|
+
*/
|
|
33
|
+
add(orgId: string, entry: string, actor: WriteActor, onlyNarrows: boolean, auditDetail?: Record<string, unknown>): Promise<OrgNetworkAllowance>;
|
|
34
|
+
/**
|
|
35
|
+
* Removes the org's entry `id` (audited `org.network_allowance_removed`); a missing or deleted
|
|
36
|
+
* org is `org.not_found`, an id the org does not list `org.network_allowance_not_found`. The
|
|
37
|
+
* actor's token id and `auditDetail` go into the audit event.
|
|
38
|
+
*/
|
|
39
|
+
remove(orgId: string, id: string, actor: WriteActor, auditDetail?: Record<string, unknown>): Promise<void>;
|
|
40
|
+
private assertOrg;
|
|
41
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
};
|
|
10
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
11
|
+
import { ApiError } from "../errors.js";
|
|
12
|
+
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
13
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
14
|
+
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
15
|
+
import { allowanceEntryProblem, OrgNetworkAllowances, } from "../orgs/network-allowances.service.js";
|
|
16
|
+
import { OrgsService } from "../orgs/orgs.service.js";
|
|
17
|
+
/**
|
|
18
|
+
* The super admin's side of the org network allowances (plugin safe fetch spec): the admin routes
|
|
19
|
+
* and their Platform operations call it. Writes take the super admin lock and re-check the actor
|
|
20
|
+
* in the same transaction as the store's write (`OrgNetworkAllowances` joins it).
|
|
21
|
+
*
|
|
22
|
+
* Only a person widens: an add is refused for an API token or the Platform tool (`onlyNarrows`)
|
|
23
|
+
* with `org.network_allowance_widen_not_allowed`; listing and removing stay open to both.
|
|
24
|
+
*/
|
|
25
|
+
let OrgNetworkAdmin = class OrgNetworkAdmin {
|
|
26
|
+
allowances;
|
|
27
|
+
orgs;
|
|
28
|
+
adminLock;
|
|
29
|
+
txHost;
|
|
30
|
+
constructor(allowances, orgs, adminLock, txHost) {
|
|
31
|
+
this.allowances = allowances;
|
|
32
|
+
this.orgs = orgs;
|
|
33
|
+
this.adminLock = adminLock;
|
|
34
|
+
this.txHost = txHost;
|
|
35
|
+
}
|
|
36
|
+
/** The org's entries, oldest first; a missing or deleted org is `org.not_found`. */
|
|
37
|
+
async list(orgId) {
|
|
38
|
+
await this.assertOrg(orgId);
|
|
39
|
+
return this.allowances.list(orgId);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The read-only preconditions of {@link add}, throwing its own refusals: `onlyNarrows` →
|
|
43
|
+
* `org.network_allowance_widen_not_allowed`, a missing org → `org.not_found`, an invalid entry →
|
|
44
|
+
* `org.network_allowance_invalid` (the cap is checked by the write only).
|
|
45
|
+
*/
|
|
46
|
+
async checkAdd(orgId, entry, onlyNarrows) {
|
|
47
|
+
assertWidenAllowed(onlyNarrows);
|
|
48
|
+
await this.assertOrg(orgId);
|
|
49
|
+
const problem = allowanceEntryProblem(entry);
|
|
50
|
+
if (problem !== null) {
|
|
51
|
+
throw new ApiError("org.network_allowance_invalid", `${entry.trim()}: ${problem}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Adds an entry (audited `org.network_allowance_added`); an entry already listed is returned.
|
|
56
|
+
* `onlyNarrows` (an API token, the Platform tool) refuses it: only a person widens. The actor's
|
|
57
|
+
* token id and `auditDetail` go into the audit event.
|
|
58
|
+
*/
|
|
59
|
+
async add(orgId, entry, actor, onlyNarrows, auditDetail = {}) {
|
|
60
|
+
assertWidenAllowed(onlyNarrows);
|
|
61
|
+
await this.adminLock.lockAndAuthorize(actor.accountId);
|
|
62
|
+
return this.allowances.add(orgId, entry, actor, auditDetail);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Removes the org's entry `id` (audited `org.network_allowance_removed`); a missing or deleted
|
|
66
|
+
* org is `org.not_found`, an id the org does not list `org.network_allowance_not_found`. The
|
|
67
|
+
* actor's token id and `auditDetail` go into the audit event.
|
|
68
|
+
*/
|
|
69
|
+
async remove(orgId, id, actor, auditDetail = {}) {
|
|
70
|
+
await this.adminLock.lockAndAuthorize(actor.accountId);
|
|
71
|
+
await this.assertOrg(orgId);
|
|
72
|
+
if (!(await this.allowances.remove(orgId, id, actor, auditDetail))) {
|
|
73
|
+
throw new ApiError("org.network_allowance_not_found", "The organization has no such internal endpoint allowance");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async assertOrg(orgId) {
|
|
77
|
+
if ((await this.orgs.get(orgId)) === undefined) {
|
|
78
|
+
throw new ApiError("org.not_found", "Organization not found");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
__decorate([
|
|
83
|
+
Transactional()
|
|
84
|
+
], OrgNetworkAdmin.prototype, "add", null);
|
|
85
|
+
__decorate([
|
|
86
|
+
Transactional()
|
|
87
|
+
], OrgNetworkAdmin.prototype, "remove", null);
|
|
88
|
+
OrgNetworkAdmin = __decorate([
|
|
89
|
+
Injectable(),
|
|
90
|
+
__param(0, Inject(OrgNetworkAllowances)),
|
|
91
|
+
__param(1, Inject(OrgsService)),
|
|
92
|
+
__param(2, Inject(SuperAdminLock)),
|
|
93
|
+
__param(3, Inject(TransactionHost))
|
|
94
|
+
], OrgNetworkAdmin);
|
|
95
|
+
export { OrgNetworkAdmin };
|
|
96
|
+
/** Only a person in a web session widens what an org's extension requests may reach. */
|
|
97
|
+
function assertWidenAllowed(onlyNarrows) {
|
|
98
|
+
if (onlyNarrows) {
|
|
99
|
+
throw new ApiError("org.network_allowance_widen_not_allowed", "Allowing an internal endpoint needs a super admin in the admin console on the web, not an API token or the Platform tool.");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -188,7 +188,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
|
|
|
188
188
|
/** The host versions (an entry's `minKernel` is judged against them). */
|
|
189
189
|
export declare const HOST_VERSIONS: {
|
|
190
190
|
readonly kernel: string;
|
|
191
|
-
readonly sdk: "0.1.0-rc.
|
|
191
|
+
readonly sdk: "0.1.0-rc.30";
|
|
192
192
|
};
|
|
193
193
|
/** Whether this deployment satisfies the entry's `minKernel`. */
|
|
194
194
|
export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -107,6 +107,7 @@ export declare const KernelConfigSchema: z.ZodObject<{
|
|
|
107
107
|
allowedHosts: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
108
108
|
}, z.core.$strict>>;
|
|
109
109
|
net: z.ZodPrefault<z.ZodObject<{
|
|
110
|
+
allowInsecureLoopback: z.ZodDefault<z.ZodBoolean>;
|
|
110
111
|
httpsProxy: z.ZodOptional<z.ZodString>;
|
|
111
112
|
noProxy: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
112
113
|
}, z.core.$strict>>;
|
package/dist/config/schema.js
CHANGED
|
@@ -534,6 +534,12 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
534
534
|
.prefault({}),
|
|
535
535
|
net: z
|
|
536
536
|
.strictObject({
|
|
537
|
+
allowInsecureLoopback: z
|
|
538
|
+
.boolean()
|
|
539
|
+
.default(false)
|
|
540
|
+
.meta(meta({
|
|
541
|
+
description: "Testing only: lift every loopback and unspecified-address refusal for extensions' ctx.net.fetch (127.0.0.0/8, ::1, 0.0.0.0/8, ::), including plain http to them (fake servers in test stacks). Link-local and cloud metadata addresses stay refused. Never set it in production",
|
|
542
|
+
})),
|
|
537
543
|
httpsProxy: z
|
|
538
544
|
.string()
|
|
539
545
|
.superRefine((value, ctx) => {
|
|
@@ -544,7 +550,7 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
544
550
|
.optional()
|
|
545
551
|
.meta(meta({
|
|
546
552
|
secret: true,
|
|
547
|
-
description: "HTTP(S) egress proxy for marketplace, archive and git downloads, npm registry downloads (packages, provenance, bootstrap plugins)
|
|
553
|
+
description: "HTTP(S) egress proxy for marketplace, archive and git downloads, npm registry downloads (packages, provenance, bootstrap plugins) OAuth requests (discovery, registration, token endpoints) and extensions' ctx.net.fetch requests (person-supplied URLs such as connector endpoints), e.g. http://user:password@proxy.internal:3128. https downloads tunnel through it with CONNECT and the kernel no longer resolves their hosts: the proxy does, so blocking private and internal addresses becomes the proxy's job, including for organizations' ctx.net requests (IP-literal URLs are still checked against marketplaces.allowPrivateHosts, or for ctx.net against the organization's allowed internal endpoints). Loopback hosts never use it, nor does an http:// npm registry; list an internal https registry in net.noProxy, and likewise every internal https host an organization's allowed internal endpoints name (with a proxy set the proxy resolves it, so the organization's allowances do not apply unless the host is in net.noProxy). HTTPS_PROXY / NODE_USE_ENV_PROXY are not read. Credentials in the URL are sent as Basic Proxy-Authorization and never logged",
|
|
548
554
|
})),
|
|
549
555
|
noProxy: z
|
|
550
556
|
.array(z
|
|
@@ -559,7 +565,7 @@ export const KernelConfigSchema = z.strictObject({
|
|
|
559
565
|
.max(100)
|
|
560
566
|
.default([])
|
|
561
567
|
.meta(meta({
|
|
562
|
-
description: "Hostnames or IP addresses that bypass net.httpsProxy (an entry also matches its subdomains; a leading dot is allowed). These hosts are resolved locally and must resolve to public addresses unless listed in marketplaces.allowPrivateHosts",
|
|
568
|
+
description: "Hostnames or IP addresses that bypass net.httpsProxy (an entry also matches its subdomains; a leading dot is allowed). These hosts are resolved locally and must resolve to public addresses unless listed in marketplaces.allowPrivateHosts (marketplace downloads) or in an organization's allowed internal endpoints (ctx.net.fetch). List an organization's allowed internal https hosts here when net.httpsProxy is set, otherwise the proxy resolves them and the allowances do not apply",
|
|
563
569
|
})),
|
|
564
570
|
})
|
|
565
571
|
.prefault({}),
|
|
@@ -76,6 +76,28 @@ export interface OpenedAttachment {
|
|
|
76
76
|
size: number;
|
|
77
77
|
body: ReadableStream<Uint8Array>;
|
|
78
78
|
}
|
|
79
|
+
/** A ready `chat` attachment bound to a conversation ({@link AttachmentsService.boundRows}). */
|
|
80
|
+
export interface BoundAttachment {
|
|
81
|
+
id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
contentType: string;
|
|
84
|
+
size: number;
|
|
85
|
+
objectKey: string;
|
|
86
|
+
/** The etag recorded at finalize (null: none recorded). */
|
|
87
|
+
etag: string | null;
|
|
88
|
+
createdAt: Date;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Whether a stored object is still the attachment finalize checked: the same size, and the same
|
|
92
|
+
* etag when one was recorded. Anything else is treated as no longer available.
|
|
93
|
+
*/
|
|
94
|
+
export declare function attachmentContentMatches(recorded: {
|
|
95
|
+
size: number;
|
|
96
|
+
etag: string | null;
|
|
97
|
+
}, head: {
|
|
98
|
+
size: number;
|
|
99
|
+
etag?: string | undefined;
|
|
100
|
+
}): boolean;
|
|
79
101
|
/** `POST /attachments` 的返回:浏览器按 `upload` 直传存储,然后调 finalize。 */
|
|
80
102
|
export interface CreatedAttachment {
|
|
81
103
|
id: string;
|
|
@@ -147,6 +169,23 @@ export declare class AttachmentsService {
|
|
|
147
169
|
id: string;
|
|
148
170
|
name: string;
|
|
149
171
|
}[]>;
|
|
172
|
+
/**
|
|
173
|
+
* The ready `chat` attachments bound to the conversation in this org (never another purpose, a
|
|
174
|
+
* pending or an unbound upload), oldest first by upload time, then id; with `id`, only that one.
|
|
175
|
+
* Nothing here checks who reads them: callers check the conversation's access first.
|
|
176
|
+
*/
|
|
177
|
+
boundRows(orgId: string, conversationId: string, id?: string): Promise<BoundAttachment[]>;
|
|
178
|
+
/**
|
|
179
|
+
* {@link attachmentContentMatches} for a bound attachment's stored object (`null`: gone), with
|
|
180
|
+
* the warning logged when the content was replaced after finalize.
|
|
181
|
+
*/
|
|
182
|
+
storedMatches(a: Pick<BoundAttachment, "id" | "size" | "etag">, head: {
|
|
183
|
+
size: number;
|
|
184
|
+
etag?: string | undefined;
|
|
185
|
+
} | null, where: {
|
|
186
|
+
orgId: string;
|
|
187
|
+
conversationId?: string;
|
|
188
|
+
}): boolean;
|
|
150
189
|
/**
|
|
151
190
|
* 读取一个绑定在该会话、已 ready 的附件(沙箱同步等内核内部用途):没有行、未绑定到该会话、对象已不在、
|
|
152
191
|
* 大小或 etag 与 finalize 时不符 → null。其余错误(存储不可用等)照常抛出。调用方负责读完或取消 `body`。
|
|
@@ -62,6 +62,13 @@ export const ATTACHMENT_CLEANUP_JOB = "attachment-cleanup";
|
|
|
62
62
|
const CLEANUP_BATCH = 100;
|
|
63
63
|
/** finalize 时读取开头多少字节核对文件签名。 */
|
|
64
64
|
const SNIFF_BYTES = 1024;
|
|
65
|
+
/**
|
|
66
|
+
* Whether a stored object is still the attachment finalize checked: the same size, and the same
|
|
67
|
+
* etag when one was recorded. Anything else is treated as no longer available.
|
|
68
|
+
*/
|
|
69
|
+
export function attachmentContentMatches(recorded, head) {
|
|
70
|
+
return head.size === recorded.size && (recorded.etag === null || recorded.etag === head.etag);
|
|
71
|
+
}
|
|
65
72
|
const notFound = () => new ApiError("attachment.not_found", "Attachment not found");
|
|
66
73
|
/** 去掉参数、转小写:`Text/Plain; charset=utf-8` → `text/plain`。 */
|
|
67
74
|
export const normalizeContentType = (ct) => (ct.split(";")[0] ?? "").trim().toLowerCase();
|
|
@@ -297,7 +304,15 @@ let AttachmentsService = class AttachmentsService {
|
|
|
297
304
|
this.storage.assertAvailable();
|
|
298
305
|
const row = await this.db
|
|
299
306
|
.selectFrom("attachments")
|
|
300
|
-
.select([
|
|
307
|
+
.select([
|
|
308
|
+
"account_id",
|
|
309
|
+
"conversation_id",
|
|
310
|
+
"name",
|
|
311
|
+
"content_type",
|
|
312
|
+
"object_key",
|
|
313
|
+
"size",
|
|
314
|
+
"etag",
|
|
315
|
+
])
|
|
301
316
|
.where("id", "=", id)
|
|
302
317
|
.where("org_id", "=", orgId)
|
|
303
318
|
.where("status", "=", "ready")
|
|
@@ -312,7 +327,7 @@ let AttachmentsService = class AttachmentsService {
|
|
|
312
327
|
throw notFound();
|
|
313
328
|
const store = this.storage.kernel(orgId);
|
|
314
329
|
const head = await store.head(row.object_key);
|
|
315
|
-
if (!
|
|
330
|
+
if (!this.storedMatches({ id, size: Number(row.size), etag: row.etag }, head, { orgId })) {
|
|
316
331
|
throw notFound();
|
|
317
332
|
}
|
|
318
333
|
const inline = isImageContentType(row.content_type) || row.content_type === "application/pdf";
|
|
@@ -327,43 +342,65 @@ let AttachmentsService = class AttachmentsService {
|
|
|
327
342
|
* 绑定在该会话、已 ready 的附件(id 与原始文件名),按上传时间、id 排序(沙箱同步按这个顺序分配文件名)。
|
|
328
343
|
*/
|
|
329
344
|
async listForConversation(orgId, conversationId) {
|
|
330
|
-
return this.
|
|
345
|
+
return (await this.boundRows(orgId, conversationId)).map((r) => ({ id: r.id, name: r.name }));
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* The ready `chat` attachments bound to the conversation in this org (never another purpose, a
|
|
349
|
+
* pending or an unbound upload), oldest first by upload time, then id; with `id`, only that one.
|
|
350
|
+
* Nothing here checks who reads them: callers check the conversation's access first.
|
|
351
|
+
*/
|
|
352
|
+
async boundRows(orgId, conversationId, id) {
|
|
353
|
+
let q = this.db
|
|
331
354
|
.selectFrom("attachments")
|
|
332
|
-
.select(["id", "name"])
|
|
355
|
+
.select(["id", "name", "content_type", "size", "object_key", "etag", "created_at"])
|
|
333
356
|
.where("org_id", "=", orgId)
|
|
334
357
|
.where("conversation_id", "=", conversationId)
|
|
335
358
|
.where("purpose", "=", "chat")
|
|
336
|
-
.where("status", "=", "ready")
|
|
337
|
-
|
|
338
|
-
.
|
|
339
|
-
|
|
359
|
+
.where("status", "=", "ready");
|
|
360
|
+
if (id !== undefined)
|
|
361
|
+
q = q.where("id", "=", id);
|
|
362
|
+
const rows = await q.orderBy("created_at").orderBy("id").execute();
|
|
363
|
+
return rows.map((r) => ({
|
|
364
|
+
id: r.id,
|
|
365
|
+
name: r.name,
|
|
366
|
+
contentType: r.content_type,
|
|
367
|
+
size: Number(r.size),
|
|
368
|
+
objectKey: r.object_key,
|
|
369
|
+
etag: r.etag,
|
|
370
|
+
createdAt: r.created_at,
|
|
371
|
+
}));
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* {@link attachmentContentMatches} for a bound attachment's stored object (`null`: gone), with
|
|
375
|
+
* the warning logged when the content was replaced after finalize.
|
|
376
|
+
*/
|
|
377
|
+
storedMatches(a, head, where) {
|
|
378
|
+
if (!head)
|
|
379
|
+
return false;
|
|
380
|
+
if (attachmentContentMatches(a, head))
|
|
381
|
+
return true;
|
|
382
|
+
this.log.warn("attachment content changed after finalize; treating it as unavailable", {
|
|
383
|
+
...where,
|
|
384
|
+
attachmentId: a.id,
|
|
385
|
+
});
|
|
386
|
+
return false;
|
|
340
387
|
}
|
|
341
388
|
/**
|
|
342
389
|
* 读取一个绑定在该会话、已 ready 的附件(沙箱同步等内核内部用途):没有行、未绑定到该会话、对象已不在、
|
|
343
390
|
* 大小或 etag 与 finalize 时不符 → null。其余错误(存储不可用等)照常抛出。调用方负责读完或取消 `body`。
|
|
344
391
|
*/
|
|
345
392
|
async openForConversation(orgId, conversationId, attachmentId) {
|
|
346
|
-
const row = await this.
|
|
347
|
-
.selectFrom("attachments")
|
|
348
|
-
.select(["name", "content_type", "object_key", "size", "etag"])
|
|
349
|
-
.where("id", "=", attachmentId)
|
|
350
|
-
.where("org_id", "=", orgId)
|
|
351
|
-
.where("conversation_id", "=", conversationId)
|
|
352
|
-
.where("purpose", "=", "chat")
|
|
353
|
-
.where("status", "=", "ready")
|
|
354
|
-
.executeTakeFirst();
|
|
393
|
+
const [row] = await this.boundRows(orgId, conversationId, attachmentId);
|
|
355
394
|
if (!row)
|
|
356
395
|
return null;
|
|
357
|
-
const got = await this.storage.kernel(orgId).get(row.
|
|
396
|
+
const got = await this.storage.kernel(orgId).get(row.objectKey);
|
|
358
397
|
if (!got)
|
|
359
398
|
return null;
|
|
360
|
-
|
|
361
|
-
if (got.head.size !== size ||
|
|
362
|
-
!this.sameContent(row.etag, got.head.etag, { orgId, conversationId, attachmentId })) {
|
|
399
|
+
if (!this.storedMatches(row, got.head, { orgId, conversationId })) {
|
|
363
400
|
await got.body.cancel().catch(() => { });
|
|
364
401
|
return null;
|
|
365
402
|
}
|
|
366
|
-
return { name: row.name, contentType: row.
|
|
403
|
+
return { name: row.name, contentType: row.contentType, size: row.size, body: got.body };
|
|
367
404
|
}
|
|
368
405
|
/**
|
|
369
406
|
* 发消息时在调用方事务里绑定附件(行锁),返回写进 user_message 的媒体块(`ref`,按 ids 顺序):
|
|
@@ -223,7 +223,7 @@ export declare class ConversationsController {
|
|
|
223
223
|
preview: ArtifactPreview;
|
|
224
224
|
}>;
|
|
225
225
|
/**
|
|
226
|
-
* The conversation's file outputs, newest first, grouped by source path into versions (UI
|
|
226
|
+
* The conversation's file outputs and the attachments sent in it, newest first, grouped by source path into versions (UI
|
|
227
227
|
* refresh B). `next` is the last file's id (passed back as `after`), null at the end.
|
|
228
228
|
*/
|
|
229
229
|
listFiles(principal: Principal, org: OrgContext, id: string, q: z.infer<typeof FilesQuery>): Promise<{
|
|
@@ -348,7 +348,7 @@ let ConversationsController = class ConversationsController {
|
|
|
348
348
|
return { preview: await this.artifacts.preview(org.orgId, id, p.account.id, artifactId) };
|
|
349
349
|
}
|
|
350
350
|
/**
|
|
351
|
-
* The conversation's file outputs, newest first, grouped by source path into versions (UI
|
|
351
|
+
* The conversation's file outputs and the attachments sent in it, newest first, grouped by source path into versions (UI
|
|
352
352
|
* refresh B). `next` is the last file's id (passed back as `after`), null at the end.
|
|
353
353
|
*/
|
|
354
354
|
async listFiles(principal, org, id, q) {
|
|
@@ -574,7 +574,11 @@ export declare class ConversationsService {
|
|
|
574
574
|
* with the queue, which reads them when a message is queued (decision 15).
|
|
575
575
|
*/
|
|
576
576
|
resolveExtra(orgId: string, accountId: string, input: Pick<UserMessageInput, "attachments">): Promise<ResolvedExtra>;
|
|
577
|
-
/**
|
|
577
|
+
/**
|
|
578
|
+
* Binds uploaded files inside the message's (or queue item's) transaction; none → no blocks.
|
|
579
|
+
* The bound files join the conversation's files, so open pages read the list again after the
|
|
580
|
+
* commit (`changed: files`, a hint).
|
|
581
|
+
*/
|
|
578
582
|
bindIn(orgId: string, conversationId: string, accountId: string, files: readonly string[]): Promise<LogContentBlock[]>;
|
|
579
583
|
private userMessage;
|
|
580
584
|
/**
|
|
@@ -15,6 +15,7 @@ import { unbindConversation } from "../channels/threads.js";
|
|
|
15
15
|
import { ConversationDevices, } from "../devices/conversation-devices.js";
|
|
16
16
|
import { DeviceProjectsService } from "../devices/device-projects.service.js";
|
|
17
17
|
import { ApiError } from "../errors.js";
|
|
18
|
+
import { afterCommit } from "../infra/database/after-commit.js";
|
|
18
19
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
19
20
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
20
21
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
@@ -1042,11 +1043,17 @@ let ConversationsService = class ConversationsService {
|
|
|
1042
1043
|
return { blocks: [], attachments: [] };
|
|
1043
1044
|
return this.content.resolveAttachments(orgId, accountId, refs);
|
|
1044
1045
|
}
|
|
1045
|
-
/**
|
|
1046
|
+
/**
|
|
1047
|
+
* Binds uploaded files inside the message's (or queue item's) transaction; none → no blocks.
|
|
1048
|
+
* The bound files join the conversation's files, so open pages read the list again after the
|
|
1049
|
+
* commit (`changed: files`, a hint).
|
|
1050
|
+
*/
|
|
1046
1051
|
async bindIn(orgId, conversationId, accountId, files) {
|
|
1047
1052
|
if (files.length === 0)
|
|
1048
1053
|
return [];
|
|
1049
|
-
|
|
1054
|
+
const blocks = await this.attachments.bindForMessage(orgId, conversationId, accountId, files);
|
|
1055
|
+
afterCommit(() => this.eventLog.publishChanged(conversationId, "files"));
|
|
1056
|
+
return blocks;
|
|
1050
1057
|
}
|
|
1051
1058
|
userMessage(accountId, input, extra, fileBlocks, invoked, context, schedule) {
|
|
1052
1059
|
// a skill invocation's rendered text replaces the typed arguments as content[0]
|