@capybara-hq/kernel 0.1.0-rc.37 → 0.1.0-rc.38
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/event-log.js +4 -1
- 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/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/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
package/dist/orgs/org-lock.js
CHANGED
|
@@ -10,8 +10,9 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { Inject, Injectable, Module } from "@nestjs/common";
|
|
11
11
|
import { ApiError } from "../errors.js";
|
|
12
12
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
13
|
-
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
13
|
+
import { assertNotSharedAdmission, inFencedTransaction, TransactionHost, } from "../infra/database/transaction-host.js";
|
|
14
14
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
15
|
+
import { XactLock } from "../infra/database/xact-lock.js";
|
|
15
16
|
import { can } from "./roles.js";
|
|
16
17
|
/**
|
|
17
18
|
* The org row lock that serializes an organization's member / invitation / token / config writes.
|
|
@@ -22,17 +23,64 @@ import { can } from "./roles.js";
|
|
|
22
23
|
* foreign key check against the org row (`FOR KEY SHARE`, taken by every insert of a row that
|
|
23
24
|
* references the org, and by an update of a row the same transaction already wrote) is not blocked.
|
|
24
25
|
* With FOR UPDATE, offboarding (org row, then the member's conversations) deadlocked with an event
|
|
25
|
-
* log append (a conversation row, then the org foreign key check).
|
|
26
|
+
* log append (a conversation row, then the org foreign key check). Nothing takes the org row
|
|
27
|
+
* `FOR UPDATE`: org deletion's `deleted_at` update is a no-key update too.
|
|
28
|
+
*
|
|
29
|
+
* The global lock order: the org admission lock ({@link lockForRemoval}; the run fence's shared
|
|
30
|
+
* admission, `RunExecution`) → this org row lock (also the run fence's exclusive admission) → the
|
|
31
|
+
* root conversation → the conversation. A writer that locks several conversation or run rows of
|
|
32
|
+
* one tree locks the tree's root conversation first. A transaction the run fence admitted shared
|
|
33
|
+
* takes none of these org-level locks (each method throws in one, `assertNotSharedAdmission`).
|
|
26
34
|
*/
|
|
27
35
|
let OrgLock = class OrgLock {
|
|
28
36
|
db;
|
|
37
|
+
xactLock;
|
|
29
38
|
txHost;
|
|
30
|
-
constructor(db, txHost) {
|
|
39
|
+
constructor(db, xactLock, txHost) {
|
|
31
40
|
this.db = db;
|
|
41
|
+
this.xactLock = xactLock;
|
|
32
42
|
this.txHost = txHost;
|
|
33
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Org deletion's and offboarding's lock: the org admission lock exclusively
|
|
46
|
+
* (`XactLock.admitOrgExclusive`), taken first in the transaction, before the org row
|
|
47
|
+
* ({@link lockAndAuthorize}). It waits for every run write the fence admitted shared (event
|
|
48
|
+
* appends, checkpoints) and keeps new ones out until the transaction ends, so a later one sees
|
|
49
|
+
* the org deleted; it queues fairly, so a stream of run writes does not starve it. Never inside
|
|
50
|
+
* a run's fenced transaction: that one may hold a conversation row that an admitted run write
|
|
51
|
+
* waits for.
|
|
52
|
+
*/
|
|
53
|
+
async lockForRemoval(orgId) {
|
|
54
|
+
if (inFencedTransaction()) {
|
|
55
|
+
throw new Error("org deletion and offboarding never run inside a run's fenced transaction");
|
|
56
|
+
}
|
|
57
|
+
await this.xactLock.admitOrgExclusive(orgId);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The role check of {@link lockAndAuthorize} without any lock, for the callers of
|
|
61
|
+
* {@link lockForRemoval}: an unauthorized call is refused (`org.not_found` / `forbidden`) before
|
|
62
|
+
* it waits for the org's run writes and holds them off. Advisory only; the caller still runs
|
|
63
|
+
* {@link lockAndAuthorize} after the locks, which decides.
|
|
64
|
+
*/
|
|
65
|
+
async precheck(orgId, actorAccountId, action) {
|
|
66
|
+
const row = await this.db
|
|
67
|
+
.selectFrom("orgs")
|
|
68
|
+
.leftJoin("memberships", (j) => j
|
|
69
|
+
.onRef("memberships.org_id", "=", "orgs.id")
|
|
70
|
+
.on("memberships.account_id", "=", actorAccountId))
|
|
71
|
+
.select("memberships.role")
|
|
72
|
+
.where("orgs.id", "=", orgId)
|
|
73
|
+
.where("orgs.deleted_at", "is", null)
|
|
74
|
+
.executeTakeFirst();
|
|
75
|
+
if (!row)
|
|
76
|
+
throw new ApiError("org.not_found", "Organization not found");
|
|
77
|
+
if (!row.role || !can(row.role, action)) {
|
|
78
|
+
throw new ApiError("forbidden", "Insufficient organization role");
|
|
79
|
+
}
|
|
80
|
+
}
|
|
34
81
|
/** Locks the org row; undefined when the org does not exist or is soft-deleted. */
|
|
35
82
|
async tryLock(orgId) {
|
|
83
|
+
assertNotSharedAdmission("the org lock");
|
|
36
84
|
return this.db
|
|
37
85
|
.selectFrom("orgs")
|
|
38
86
|
.select(["slug", "name"])
|
|
@@ -43,6 +91,7 @@ let OrgLock = class OrgLock {
|
|
|
43
91
|
}
|
|
44
92
|
/** Like {@link tryLock}; a missing or soft-deleted org → `org.not_found`. */
|
|
45
93
|
async lock(orgId) {
|
|
94
|
+
assertNotSharedAdmission("the org lock");
|
|
46
95
|
const org = await this.tryLock(orgId);
|
|
47
96
|
if (!org)
|
|
48
97
|
throw new ApiError("org.not_found", "Organization not found");
|
|
@@ -55,6 +104,7 @@ let OrgLock = class OrgLock {
|
|
|
55
104
|
* actor's account id, never a role from the caller.
|
|
56
105
|
*/
|
|
57
106
|
async lockAndAuthorize(orgId, actorAccountId, action) {
|
|
107
|
+
assertNotSharedAdmission("the org lock");
|
|
58
108
|
const org = await this.lock(orgId);
|
|
59
109
|
const m = await this.db
|
|
60
110
|
.selectFrom("memberships")
|
|
@@ -72,12 +122,16 @@ let OrgLock = class OrgLock {
|
|
|
72
122
|
* person, such as the plugin scope sync) only the lock, since no role applies.
|
|
73
123
|
*/
|
|
74
124
|
async lockFor(orgId, actor, action) {
|
|
125
|
+
assertNotSharedAdmission("the org lock");
|
|
75
126
|
if (actor === null)
|
|
76
127
|
await this.lock(orgId);
|
|
77
128
|
else
|
|
78
129
|
await this.lockAndAuthorize(orgId, actor, action);
|
|
79
130
|
}
|
|
80
131
|
};
|
|
132
|
+
__decorate([
|
|
133
|
+
Transactional({ propagation: "mandatory" })
|
|
134
|
+
], OrgLock.prototype, "lockForRemoval", null);
|
|
81
135
|
__decorate([
|
|
82
136
|
Transactional({ propagation: "mandatory" })
|
|
83
137
|
], OrgLock.prototype, "tryLock", null);
|
|
@@ -93,7 +147,8 @@ __decorate([
|
|
|
93
147
|
OrgLock = __decorate([
|
|
94
148
|
Injectable(),
|
|
95
149
|
__param(0, Inject(KernelDb)),
|
|
96
|
-
__param(1, Inject(
|
|
150
|
+
__param(1, Inject(XactLock)),
|
|
151
|
+
__param(2, Inject(TransactionHost))
|
|
97
152
|
], OrgLock);
|
|
98
153
|
export { OrgLock };
|
|
99
154
|
/** The one {@link OrgLock}: identity (service tokens), orgs and the other domains import it. */
|
|
@@ -2,8 +2,9 @@ import { z } from "zod";
|
|
|
2
2
|
import { type ApiTokenRecord, ApiTokenService } from "../identity/api-tokens.js";
|
|
3
3
|
import { type Principal } from "../identity/principal.js";
|
|
4
4
|
import { type Member, MembersService } from "./members.service.js";
|
|
5
|
+
import { OrgNetworkAllowances } from "./network-allowances.service.js";
|
|
5
6
|
import { type OrgContext } from "./org.guard.js";
|
|
6
|
-
import { OrgUpdateBody } from "./orgs.schemas.js";
|
|
7
|
+
import { type NetworkAllowanceView, OrgUpdateBody } from "./orgs.schemas.js";
|
|
7
8
|
import { type Org, OrgsService } from "./orgs.service.js";
|
|
8
9
|
import { type OrgRole } from "./roles.js";
|
|
9
10
|
declare const CreateSchema: z.ZodObject<{
|
|
@@ -35,7 +36,8 @@ export declare class OrgsController {
|
|
|
35
36
|
private readonly orgs;
|
|
36
37
|
private readonly members;
|
|
37
38
|
private readonly tokens;
|
|
38
|
-
|
|
39
|
+
private readonly allowances;
|
|
40
|
+
constructor(orgs: OrgsService, members: MembersService, tokens: ApiTokenService, allowances: OrgNetworkAllowances);
|
|
39
41
|
create(principal: Principal, body: z.infer<typeof CreateSchema>): Promise<{
|
|
40
42
|
org: Org;
|
|
41
43
|
role: "owner";
|
|
@@ -58,6 +60,13 @@ export declare class OrgsController {
|
|
|
58
60
|
listMembers(org: OrgContext): Promise<{
|
|
59
61
|
members: Member[];
|
|
60
62
|
}>;
|
|
63
|
+
/**
|
|
64
|
+
* The internal endpoints a super admin lets this org's extension requests reach (plugin safe
|
|
65
|
+
* fetch spec), read-only for org admins so a refused request is explainable; members get 403.
|
|
66
|
+
*/
|
|
67
|
+
listNetworkAllowances(org: OrgContext): Promise<{
|
|
68
|
+
allowances: NetworkAllowanceView[];
|
|
69
|
+
}>;
|
|
61
70
|
changeRole(principal: Principal, org: OrgContext, accountId: string, body: z.infer<typeof RoleSchema>): Promise<{
|
|
62
71
|
accountId: string;
|
|
63
72
|
role: OrgRole;
|
|
@@ -15,8 +15,9 @@ import { CurrentPrincipal, patTokenId, requireUser, SessionOnly, } from "../iden
|
|
|
15
15
|
import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
16
16
|
import { ZBody } from "../infra/validation/zod-params.js";
|
|
17
17
|
import { MembersService } from "./members.service.js";
|
|
18
|
+
import { OrgNetworkAllowances } from "./network-allowances.service.js";
|
|
18
19
|
import { CurrentOrg, OrgAction } from "./org.guard.js";
|
|
19
|
-
import { OrgUpdateBody } from "./orgs.schemas.js";
|
|
20
|
+
import { networkAllowanceView, OrgUpdateBody } from "./orgs.schemas.js";
|
|
20
21
|
import { OrgsService } from "./orgs.service.js";
|
|
21
22
|
import { ORG_ROLES } from "./roles.js";
|
|
22
23
|
const CreateSchema = z.object({
|
|
@@ -45,10 +46,12 @@ let OrgsController = class OrgsController {
|
|
|
45
46
|
orgs;
|
|
46
47
|
members;
|
|
47
48
|
tokens;
|
|
48
|
-
|
|
49
|
+
allowances;
|
|
50
|
+
constructor(orgs, members, tokens, allowances) {
|
|
49
51
|
this.orgs = orgs;
|
|
50
52
|
this.members = members;
|
|
51
53
|
this.tokens = tokens;
|
|
54
|
+
this.allowances = allowances;
|
|
52
55
|
}
|
|
53
56
|
async create(principal, body) {
|
|
54
57
|
const p = requireUser(principal);
|
|
@@ -84,6 +87,13 @@ let OrgsController = class OrgsController {
|
|
|
84
87
|
async listMembers(org) {
|
|
85
88
|
return { members: await this.members.list(org.orgId) };
|
|
86
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The internal endpoints a super admin lets this org's extension requests reach (plugin safe
|
|
92
|
+
* fetch spec), read-only for org admins so a refused request is explainable; members get 403.
|
|
93
|
+
*/
|
|
94
|
+
async listNetworkAllowances(org) {
|
|
95
|
+
return { allowances: (await this.allowances.list(org.orgId)).map(networkAllowanceView) };
|
|
96
|
+
}
|
|
87
97
|
async changeRole(principal, org, accountId, body) {
|
|
88
98
|
const p = requireUser(principal);
|
|
89
99
|
await this.members.changeRole(org.orgId, accountId, body.role, p.account.id, patTokenId(p));
|
|
@@ -153,6 +163,11 @@ __decorate([
|
|
|
153
163
|
OrgAction("org.members.read"),
|
|
154
164
|
__param(0, CurrentOrg())
|
|
155
165
|
], OrgsController.prototype, "listMembers", null);
|
|
166
|
+
__decorate([
|
|
167
|
+
Get(":orgId/network-allowances"),
|
|
168
|
+
OrgAction("org.update"),
|
|
169
|
+
__param(0, CurrentOrg())
|
|
170
|
+
], OrgsController.prototype, "listNetworkAllowances", null);
|
|
156
171
|
__decorate([
|
|
157
172
|
Patch(":orgId/members/:accountId"),
|
|
158
173
|
OrgAction("org.members.manage"),
|
|
@@ -196,6 +211,7 @@ OrgsController = __decorate([
|
|
|
196
211
|
Controller("api/v1/orgs"),
|
|
197
212
|
__param(0, Inject(OrgsService)),
|
|
198
213
|
__param(1, Inject(MembersService)),
|
|
199
|
-
__param(2, Inject(ApiTokenService))
|
|
214
|
+
__param(2, Inject(ApiTokenService)),
|
|
215
|
+
__param(3, Inject(OrgNetworkAllowances))
|
|
200
216
|
], OrgsController);
|
|
201
217
|
export { OrgsController };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Organizations: orgs, org settings, members, invitations, offboarding (its owed work goes through
|
|
3
|
-
* the outbox)
|
|
3
|
+
* the outbox), directory sync (the hourly scan cron, one-off syncs on the maintenance queue) and the
|
|
4
|
+
* org network allowances (internal endpoints a super admin lets the org's extension requests reach).
|
|
4
5
|
*/
|
|
5
6
|
export declare class OrgsModule {
|
|
6
7
|
}
|
package/dist/orgs/orgs.module.js
CHANGED
|
@@ -19,13 +19,15 @@ import { ToolsModule } from "../tools/tools.module.js";
|
|
|
19
19
|
import { DirectorySync } from "./directory-sync.js";
|
|
20
20
|
import { InvitationsService } from "./invitations.service.js";
|
|
21
21
|
import { MembersService } from "./members.service.js";
|
|
22
|
+
import { OrgNetworkAllowancesModule } from "./network-allowances.service.js";
|
|
22
23
|
import { Offboarding } from "./offboarding.js";
|
|
23
24
|
import { OrgLockModule } from "./org-lock.js";
|
|
24
25
|
import { OrgsService } from "./orgs.service.js";
|
|
25
26
|
import { OrgSettingsModule } from "./settings.service.js";
|
|
26
27
|
/**
|
|
27
28
|
* Organizations: orgs, org settings, members, invitations, offboarding (its owed work goes through
|
|
28
|
-
* the outbox)
|
|
29
|
+
* the outbox), directory sync (the hourly scan cron, one-off syncs on the maintenance queue) and the
|
|
30
|
+
* org network allowances (internal endpoints a super admin lets the org's extension requests reach).
|
|
29
31
|
*/
|
|
30
32
|
let OrgsModule = class OrgsModule {
|
|
31
33
|
};
|
|
@@ -52,6 +54,7 @@ OrgsModule = __decorate([
|
|
|
52
54
|
CatalogModule,
|
|
53
55
|
// the producer side of directory-sync jobs (the maintenance processor consumes them)
|
|
54
56
|
QueueModule.registerQueue(MAINTENANCE_QUEUE_NAME),
|
|
57
|
+
OrgNetworkAllowancesModule,
|
|
55
58
|
],
|
|
56
59
|
providers: [OrgsService, MembersService, InvitationsService, Offboarding, DirectorySync],
|
|
57
60
|
exports: [
|
|
@@ -62,6 +65,7 @@ OrgsModule = __decorate([
|
|
|
62
65
|
InvitationsService,
|
|
63
66
|
Offboarding,
|
|
64
67
|
DirectorySync,
|
|
68
|
+
OrgNetworkAllowancesModule,
|
|
65
69
|
],
|
|
66
70
|
})
|
|
67
71
|
], OrgsModule);
|
|
@@ -4,5 +4,17 @@ export declare const OrgUpdateBody: z.ZodObject<{
|
|
|
4
4
|
name: z.ZodOptional<z.ZodString>;
|
|
5
5
|
slug: z.ZodOptional<z.ZodString>;
|
|
6
6
|
}, z.core.$strip>;
|
|
7
|
+
/** One org network allowance as the routes and Platform operations return it. */
|
|
8
|
+
export interface NetworkAllowanceView {
|
|
9
|
+
id: string;
|
|
10
|
+
entry: string;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
}
|
|
13
|
+
/** The view of a stored allowance: who added it stays in the audit log. */
|
|
14
|
+
export declare function networkAllowanceView(a: {
|
|
15
|
+
id: string;
|
|
16
|
+
entry: string;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
}): NetworkAllowanceView;
|
|
7
19
|
export declare const ORG_ROUTES: readonly RouteSchemas[];
|
|
8
20
|
export declare const ORG_SETTINGS_ROUTES: readonly RouteSchemas[];
|
|
@@ -4,11 +4,16 @@ export const OrgUpdateBody = z.object({
|
|
|
4
4
|
name: z.string().min(1).max(100).optional(),
|
|
5
5
|
slug: z.string().min(1).max(40).optional(),
|
|
6
6
|
});
|
|
7
|
+
/** The view of a stored allowance: who added it stays in the audit log. */
|
|
8
|
+
export function networkAllowanceView(a) {
|
|
9
|
+
return { id: a.id, entry: a.entry, createdAt: a.createdAt };
|
|
10
|
+
}
|
|
7
11
|
export const ORG_ROUTES = [
|
|
8
12
|
{ route: "GET /api/v1/orgs" },
|
|
9
13
|
{ route: "GET /api/v1/orgs/:orgId" },
|
|
10
14
|
{ route: "PATCH /api/v1/orgs/:orgId", body: OrgUpdateBody },
|
|
11
15
|
{ route: "GET /api/v1/orgs/:orgId/members" },
|
|
16
|
+
{ route: "GET /api/v1/orgs/:orgId/network-allowances" },
|
|
12
17
|
];
|
|
13
18
|
export const ORG_SETTINGS_ROUTES = [
|
|
14
19
|
{ route: "GET /api/v1/orgs/:orgId/settings" },
|
|
@@ -241,7 +241,12 @@ let OrgsService = class OrgsService {
|
|
|
241
241
|
await this.softDeleteIn(orgId, actor, actorTokenId);
|
|
242
242
|
}
|
|
243
243
|
async softDeleteIn(orgId, actor, actorTokenId) {
|
|
244
|
-
//
|
|
244
|
+
// the org admission lock exclusively first (it waits for the run writes the fence admitted
|
|
245
|
+
// shared, which see the org deleted after this commits), then the org row, which admits the
|
|
246
|
+
// other fenced run writes (`RunExecution`)
|
|
247
|
+
// an unauthorized call is refused before it holds off the org's run writes
|
|
248
|
+
await this.orgLock.precheck(orgId, actor.id, "org.delete");
|
|
249
|
+
await this.orgLock.lockForRemoval(orgId);
|
|
245
250
|
await this.orgLock.lockAndAuthorize(orgId, actor.id, "org.delete");
|
|
246
251
|
await this.db
|
|
247
252
|
.updateTable("orgs")
|
package/dist/overrides.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { APP_INTERCEPTOR } from "@nestjs/core";
|
|
|
3
3
|
import { ADMIN_USAGE_TIMINGS, type AdminUsageTimings } from "./admin/usage.service.js";
|
|
4
4
|
import { SCOPE_ORG_CHUNK_SIZE } from "./catalog/scope-jobs.js";
|
|
5
5
|
import { CHANNEL_WEBHOOK_TIMINGS, type ChannelWebhookTimings } from "./channels/webhook.js";
|
|
6
|
+
import { EXTENSION_NET_SEAMS, type ExtensionNetSeams } from "./ctx/net.js";
|
|
6
7
|
import type { EvalReplayHooks } from "./evals/run-replay.js";
|
|
7
8
|
import { EVAL_REPLAY_HOOKS } from "./evals/worker.js";
|
|
8
9
|
import { BOOTSTRAP_LOCK_TTL } from "./extensions/bootstrap.js";
|
|
@@ -57,6 +58,8 @@ import { EMBED_TOKEN_CLOCK } from "./ui/embed-token.js";
|
|
|
57
58
|
* read (a test shortens it for one run);
|
|
58
59
|
* - `PLUGIN_PUBLIC_WRITE_LIMIT`: a lower limit for unsafe methods on `public` extension routes;
|
|
59
60
|
* - `SCOPE_ORG_CHUNK_SIZE`: fewer orgs per plugin scope sync chunk job (several chunks in a test);
|
|
61
|
+
* - `EXTENSION_NET_SEAMS`: `ctx.net`'s DNS and dispatcher (a hostname resolving to a private address
|
|
62
|
+
* served by a loopback fake);
|
|
60
63
|
* - `APP_INTERCEPTOR`: one more global interceptor (a probe of the matched routes).
|
|
61
64
|
*/
|
|
62
65
|
interface KernelSeams {
|
|
@@ -85,6 +88,7 @@ interface KernelSeams {
|
|
|
85
88
|
[PROJECT_KNOWLEDGE_TIMEOUT]: () => number;
|
|
86
89
|
[PLUGIN_PUBLIC_WRITE_LIMIT]: number;
|
|
87
90
|
[DEVICE_POLICY_AFTER_CALL]: (opId: string) => void;
|
|
91
|
+
[EXTENSION_NET_SEAMS]: ExtensionNetSeams;
|
|
88
92
|
[APP_INTERCEPTOR]: NestInterceptor;
|
|
89
93
|
}
|
|
90
94
|
/**
|
package/dist/overrides.js
CHANGED
|
@@ -2,6 +2,7 @@ import { APP_INTERCEPTOR } from "@nestjs/core";
|
|
|
2
2
|
import { ADMIN_USAGE_TIMINGS } from "./admin/usage.service.js";
|
|
3
3
|
import { SCOPE_ORG_CHUNK_SIZE } from "./catalog/scope-jobs.js";
|
|
4
4
|
import { CHANNEL_WEBHOOK_TIMINGS } from "./channels/webhook.js";
|
|
5
|
+
import { EXTENSION_NET_SEAMS } from "./ctx/net.js";
|
|
5
6
|
import { EVAL_REPLAY_HOOKS } from "./evals/worker.js";
|
|
6
7
|
import { BOOTSTRAP_LOCK_TTL } from "./extensions/bootstrap.js";
|
|
7
8
|
import { USAGE_SUBSCRIBERS_CLOCK } from "./extensions/usage-subscribers.js";
|
|
@@ -50,6 +51,7 @@ const SEAM_TOKENS = [
|
|
|
50
51
|
PROJECT_KNOWLEDGE_TIMEOUT,
|
|
51
52
|
PLUGIN_PUBLIC_WRITE_LIMIT,
|
|
52
53
|
DEVICE_POLICY_AFTER_CALL,
|
|
54
|
+
EXTENSION_NET_SEAMS,
|
|
53
55
|
APP_INTERCEPTOR,
|
|
54
56
|
];
|
|
55
57
|
const allSeamsListed = true;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type OnModuleInit } from "@nestjs/common";
|
|
2
2
|
import { AuditLogService } from "../../admin/audit-log.service.js";
|
|
3
|
+
import { OrgNetworkAdmin } from "../../admin/org-network.service.js";
|
|
3
4
|
import { AccountsService } from "../../identity/accounts.js";
|
|
4
5
|
import { SettingsService } from "../../identity/settings.js";
|
|
5
6
|
import { KernelConfigService } from "../../infra/config/kernel-config.service.js";
|
|
6
7
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
7
8
|
import { MembersService } from "../../orgs/members.service.js";
|
|
9
|
+
import { OrgNetworkAllowances } from "../../orgs/network-allowances.service.js";
|
|
8
10
|
import { OrgsService } from "../../orgs/orgs.service.js";
|
|
9
11
|
import { PlatformOperations } from "../registry.js";
|
|
10
12
|
/**
|
|
@@ -22,9 +24,13 @@ export declare class OrgsOperations implements OnModuleInit {
|
|
|
22
24
|
private readonly config;
|
|
23
25
|
private readonly kdb;
|
|
24
26
|
private readonly audit;
|
|
25
|
-
|
|
27
|
+
private readonly networkAdmin;
|
|
28
|
+
private readonly allowances;
|
|
29
|
+
constructor(registry: PlatformOperations, orgs: OrgsService, members: MembersService, settings: SettingsService, accounts: AccountsService, config: KernelConfigService, kdb: KernelDb, audit: AuditLogService, networkAdmin: OrgNetworkAdmin, allowances: OrgNetworkAllowances);
|
|
26
30
|
private org;
|
|
27
31
|
/** The actor as `OrgsService.update` takes it (it re-checks the role under the org lock). */
|
|
28
32
|
private actor;
|
|
33
|
+
/** The org's allowance `id` (for a card and the remove precheck); none → the remove's 404. */
|
|
34
|
+
private allowance;
|
|
29
35
|
onModuleInit(): void;
|
|
30
36
|
}
|
|
@@ -12,13 +12,16 @@ import { z } from "zod";
|
|
|
12
12
|
import { OrgAuditListQuery } from "../../admin/audit.schemas.js";
|
|
13
13
|
import { AuditLogService } from "../../admin/audit-log.service.js";
|
|
14
14
|
import { limitDefaults } from "../../admin/limit-defaults.js";
|
|
15
|
+
import { NetworkAllowanceBody, NetworkAllowanceParams } from "../../admin/org-network.schemas.js";
|
|
16
|
+
import { OrgNetworkAdmin } from "../../admin/org-network.service.js";
|
|
15
17
|
import { ApiError } from "../../errors.js";
|
|
16
18
|
import { AccountsService } from "../../identity/accounts.js";
|
|
17
19
|
import { DEPLOYMENT_SETTINGS_PATCH, SettingsService } from "../../identity/settings.js";
|
|
18
20
|
import { KernelConfigService } from "../../infra/config/kernel-config.service.js";
|
|
19
21
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
20
22
|
import { MembersService } from "../../orgs/members.service.js";
|
|
21
|
-
import {
|
|
23
|
+
import { OrgNetworkAllowances } from "../../orgs/network-allowances.service.js";
|
|
24
|
+
import { networkAllowanceView, OrgUpdateBody } from "../../orgs/orgs.schemas.js";
|
|
22
25
|
import { OrgsService } from "../../orgs/orgs.service.js";
|
|
23
26
|
import { defineOperation } from "../operation.js";
|
|
24
27
|
import { PlatformOperations } from "../registry.js";
|
|
@@ -57,7 +60,9 @@ let OrgsOperations = class OrgsOperations {
|
|
|
57
60
|
config;
|
|
58
61
|
kdb;
|
|
59
62
|
audit;
|
|
60
|
-
|
|
63
|
+
networkAdmin;
|
|
64
|
+
allowances;
|
|
65
|
+
constructor(registry, orgs, members, settings, accounts, config, kdb, audit, networkAdmin, allowances) {
|
|
61
66
|
this.registry = registry;
|
|
62
67
|
this.orgs = orgs;
|
|
63
68
|
this.members = members;
|
|
@@ -66,6 +71,8 @@ let OrgsOperations = class OrgsOperations {
|
|
|
66
71
|
this.config = config;
|
|
67
72
|
this.kdb = kdb;
|
|
68
73
|
this.audit = audit;
|
|
74
|
+
this.networkAdmin = networkAdmin;
|
|
75
|
+
this.allowances = allowances;
|
|
69
76
|
}
|
|
70
77
|
async org(orgId) {
|
|
71
78
|
const o = await this.orgs.get(orgId);
|
|
@@ -80,6 +87,14 @@ let OrgsOperations = class OrgsOperations {
|
|
|
80
87
|
throw new ApiError("forbidden", "Your account no longer exists");
|
|
81
88
|
return a;
|
|
82
89
|
}
|
|
90
|
+
/** The org's allowance `id` (for a card and the remove precheck); none → the remove's 404. */
|
|
91
|
+
async allowance(orgId, id) {
|
|
92
|
+
const a = (await this.networkAdmin.list(orgId)).find((x) => x.id === id);
|
|
93
|
+
if (!a) {
|
|
94
|
+
throw new ApiError("org.network_allowance_not_found", "The organization has no such internal endpoint allowance");
|
|
95
|
+
}
|
|
96
|
+
return a;
|
|
97
|
+
}
|
|
83
98
|
onModuleInit() {
|
|
84
99
|
this.registry.register([
|
|
85
100
|
defineOperation({
|
|
@@ -215,6 +230,108 @@ let OrgsOperations = class OrgsOperations {
|
|
|
215
230
|
};
|
|
216
231
|
},
|
|
217
232
|
}),
|
|
233
|
+
defineOperation({
|
|
234
|
+
id: "admin.org-network-allowances",
|
|
235
|
+
description: "List an org's internal endpoint allowances (super admin): the hosts, wildcards, IPs or CIDRs and origins the org's extension requests may reach although they resolve to private or loopback addresses, oldest first, each with its id, entry and when it was added. Add one with admin.org-network-allowance-add, remove one with admin.org-network-allowance-remove.",
|
|
236
|
+
input: z.object({ orgId: OrgId }).strict(),
|
|
237
|
+
example: { orgId: "00000000-0000-4000-8000-000000000000" },
|
|
238
|
+
authz: { superAdmin: true },
|
|
239
|
+
mirrors: ["GET /api/v1/admin/orgs/:orgId/network-allowances"],
|
|
240
|
+
extras: ["orgId"],
|
|
241
|
+
confirm: "read",
|
|
242
|
+
errors: [
|
|
243
|
+
{
|
|
244
|
+
code: "org.not_found",
|
|
245
|
+
next: "Look the org up with orgs.list and pass its id.",
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
run: async (input) => ({
|
|
249
|
+
allowances: (await this.networkAdmin.list(input.orgId)).map(networkAllowanceView),
|
|
250
|
+
}),
|
|
251
|
+
}),
|
|
252
|
+
defineOperation({
|
|
253
|
+
id: "admin.org-network-allowance-add",
|
|
254
|
+
description: "Let an org's extension requests reach an internal endpoint (super admin): entry is a hostname or *.domain wildcard (https, any port), an IP address or CIDR such as 10.1.0.0/16 (IP-literal URLs only), or an origin such as http://mcp.internal:8080 (exactly that scheme, host and port; plain http allowed). Link-local (cloud metadata), loopback and unspecified addresses are never allowed. Only a person widens: through this tool the add is always refused, and the super admin adds the endpoint in the admin console on the web; listing and removing work here.",
|
|
255
|
+
input: NetworkAllowanceBody.extend({ orgId: OrgId }).strict(),
|
|
256
|
+
example: {
|
|
257
|
+
orgId: "00000000-0000-4000-8000-000000000000",
|
|
258
|
+
entry: "http://mcp.internal:8080",
|
|
259
|
+
},
|
|
260
|
+
authz: { superAdmin: true },
|
|
261
|
+
mirrors: ["POST /api/v1/admin/orgs/:orgId/network-allowances"],
|
|
262
|
+
extras: ["orgId"],
|
|
263
|
+
confirm: "platform",
|
|
264
|
+
errors: [
|
|
265
|
+
{
|
|
266
|
+
code: "org.not_found",
|
|
267
|
+
next: "Look the org up with orgs.list and pass its id.",
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
code: "org.network_allowance_widen_not_allowed",
|
|
271
|
+
next: "Add the internal endpoint yourself on the org's page in the admin console on the web.",
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
precheck: (i) => precheckBy(() => this.networkAdmin.checkAdd(i.orgId, i.entry, true)),
|
|
275
|
+
summary: async (i) => {
|
|
276
|
+
const name = await orElse(async () => named((await this.org(i.orgId)).name), i.orgId);
|
|
277
|
+
const entry = named(i.entry.trim());
|
|
278
|
+
return {
|
|
279
|
+
zh: `允许组织「${name}」的扩展请求访问内部端点 ${entry}`,
|
|
280
|
+
en: `Let the extension requests of org "${name}" reach the internal endpoint ${entry}`,
|
|
281
|
+
};
|
|
282
|
+
},
|
|
283
|
+
run: async (input, ctx) => ({
|
|
284
|
+
allowance: networkAllowanceView(await this.networkAdmin.add(input.orgId, input.entry, { accountId: ctx.actorAccountId }, true, viaAgent("admin.org-network-allowance-add", ctx))),
|
|
285
|
+
}),
|
|
286
|
+
}),
|
|
287
|
+
defineOperation({
|
|
288
|
+
id: "admin.org-network-allowance-remove",
|
|
289
|
+
description: "Remove one of an org's internal endpoint allowances (super admin) by its id (admin.org-network-allowances): the org's extension requests to that endpoint are refused from the next request on. The org's audit log records it.",
|
|
290
|
+
input: NetworkAllowanceParams.extend({ orgId: OrgId }).strict(),
|
|
291
|
+
example: {
|
|
292
|
+
orgId: "00000000-0000-4000-8000-000000000000",
|
|
293
|
+
id: "00000000-0000-4000-8000-000000000001",
|
|
294
|
+
},
|
|
295
|
+
authz: { superAdmin: true },
|
|
296
|
+
mirrors: ["DELETE /api/v1/admin/orgs/:orgId/network-allowances/:id"],
|
|
297
|
+
extras: ["orgId"],
|
|
298
|
+
confirm: "platform",
|
|
299
|
+
errors: [
|
|
300
|
+
{
|
|
301
|
+
code: "org.not_found",
|
|
302
|
+
next: "Look the org up with orgs.list and pass its id.",
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
code: "org.network_allowance_not_found",
|
|
306
|
+
next: "List the org's allowances again with admin.org-network-allowances and pass one of their ids.",
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
precheck: (i) => precheckBy(() => this.allowance(i.orgId, i.id)),
|
|
310
|
+
summary: async (i) => {
|
|
311
|
+
const name = await orElse(async () => named((await this.org(i.orgId)).name), i.orgId);
|
|
312
|
+
const entry = await orElse(async () => named((await this.allowance(i.orgId, i.id)).entry), i.id);
|
|
313
|
+
return {
|
|
314
|
+
zh: `移除组织「${name}」的内部端点 ${entry},该组织的扩展请求将无法再访问它`,
|
|
315
|
+
en: `Remove the internal endpoint ${entry} of org "${name}"; the org's extension requests can no longer reach it`,
|
|
316
|
+
};
|
|
317
|
+
},
|
|
318
|
+
run: async (input, ctx) => {
|
|
319
|
+
await this.networkAdmin.remove(input.orgId, input.id, { accountId: ctx.actorAccountId }, viaAgent("admin.org-network-allowance-remove", ctx));
|
|
320
|
+
return { id: input.id, removed: true };
|
|
321
|
+
},
|
|
322
|
+
}),
|
|
323
|
+
defineOperation({
|
|
324
|
+
id: "orgs.network-allowances",
|
|
325
|
+
description: "Read this conversation's org's internal endpoint allowances (org admins, read-only): the hosts, wildcards, IPs or CIDRs and origins a super admin lets the org's extension requests reach although they resolve to private or loopback addresses. An extension request to an internal endpoint not listed is refused; only a super admin can add one.",
|
|
326
|
+
input: z.object({}).strict(),
|
|
327
|
+
example: {},
|
|
328
|
+
authz: { orgAction: "org.update" },
|
|
329
|
+
mirrors: ["GET /api/v1/orgs/:orgId/network-allowances"],
|
|
330
|
+
confirm: "read",
|
|
331
|
+
run: async (_input, ctx) => ({
|
|
332
|
+
allowances: (await this.allowances.list(ctx.orgId)).map(networkAllowanceView),
|
|
333
|
+
}),
|
|
334
|
+
}),
|
|
218
335
|
defineOperation({
|
|
219
336
|
id: "orgs.current",
|
|
220
337
|
description: "Read this conversation's org: its id, name, slug, when it was created, and your role in it.",
|
|
@@ -311,6 +428,8 @@ OrgsOperations = __decorate([
|
|
|
311
428
|
__param(4, Inject(AccountsService)),
|
|
312
429
|
__param(5, Inject(KernelConfigService)),
|
|
313
430
|
__param(6, Inject(KernelDb)),
|
|
314
|
-
__param(7, Inject(AuditLogService))
|
|
431
|
+
__param(7, Inject(AuditLogService)),
|
|
432
|
+
__param(8, Inject(OrgNetworkAdmin)),
|
|
433
|
+
__param(9, Inject(OrgNetworkAllowances))
|
|
315
434
|
], OrgsOperations);
|
|
316
435
|
export { OrgsOperations };
|
|
@@ -2,6 +2,7 @@ import { ADMIN_ROUTES } from "../admin/admin.schemas.js";
|
|
|
2
2
|
import { ADMIN_ITEM_ROUTES } from "../admin/admin-items.schemas.js";
|
|
3
3
|
import { AUDIT_ROUTES } from "../admin/audit.schemas.js";
|
|
4
4
|
import { ADMIN_EXTENSION_ROUTES } from "../admin/extensions.schemas.js";
|
|
5
|
+
import { ORG_NETWORK_ROUTES } from "../admin/org-network.schemas.js";
|
|
5
6
|
import { OUTBOX_DEAD_ROUTES } from "../admin/outbox-dead.schemas.js";
|
|
6
7
|
import { OVERVIEW_ROUTES } from "../admin/overview.schemas.js";
|
|
7
8
|
import { AGENT_ROUTES } from "../agents/agents.schemas.js";
|
|
@@ -88,4 +89,6 @@ export const ROUTE_SCHEMAS = [
|
|
|
88
89
|
...AUDIT_ROUTES,
|
|
89
90
|
// dead outbox rows (transactional outbox spec §3.4)
|
|
90
91
|
...OUTBOX_DEAD_ROUTES,
|
|
92
|
+
// org network allowances (plugin safe fetch spec)
|
|
93
|
+
...ORG_NETWORK_ROUTES,
|
|
91
94
|
];
|
|
@@ -9,6 +9,9 @@ import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
|
9
9
|
* 之后最新一份仍能独立还原。不要配合实验性的 `DeltaChannel` 使用:它依赖父链上的 writes 还原状态。
|
|
10
10
|
* - thread_id 约定为 runId。
|
|
11
11
|
* - 所有状态都在 PG 里,不持有进程内状态,任意副本都能续跑。
|
|
12
|
+
* - Writes are run loop hot-path writes: they ask the run fence for shared admission
|
|
13
|
+
* (`RunExecution`) and lock only the run's own checkpoint rows. LangGraph calls them between
|
|
14
|
+
* nodes, outside any transaction (never nested in a fenced one).
|
|
12
15
|
*/
|
|
13
16
|
export declare class KyselyCheckpointSaver extends BaseCheckpointSaver {
|
|
14
17
|
private readonly kdb;
|
|
@@ -32,6 +32,9 @@ const idC = sql `checkpoint_id collate "C"`;
|
|
|
32
32
|
* 之后最新一份仍能独立还原。不要配合实验性的 `DeltaChannel` 使用:它依赖父链上的 writes 还原状态。
|
|
33
33
|
* - thread_id 约定为 runId。
|
|
34
34
|
* - 所有状态都在 PG 里,不持有进程内状态,任意副本都能续跑。
|
|
35
|
+
* - Writes are run loop hot-path writes: they ask the run fence for shared admission
|
|
36
|
+
* (`RunExecution`) and lock only the run's own checkpoint rows. LangGraph calls them between
|
|
37
|
+
* nodes, outside any transaction (never nested in a fenced one).
|
|
35
38
|
*/
|
|
36
39
|
let KyselyCheckpointSaver = class KyselyCheckpointSaver extends BaseCheckpointSaver {
|
|
37
40
|
kdb;
|
|
@@ -259,16 +262,16 @@ let KyselyCheckpointSaver = class KyselyCheckpointSaver extends BaseCheckpointSa
|
|
|
259
262
|
}
|
|
260
263
|
};
|
|
261
264
|
__decorate([
|
|
262
|
-
Transactional({ propagation: "requires_new" })
|
|
265
|
+
Transactional({ propagation: "requires_new", admission: "shared" })
|
|
263
266
|
], KyselyCheckpointSaver.prototype, "put", null);
|
|
264
267
|
__decorate([
|
|
265
|
-
Transactional({ propagation: "requires_new" })
|
|
268
|
+
Transactional({ propagation: "requires_new", admission: "shared" })
|
|
266
269
|
], KyselyCheckpointSaver.prototype, "insertWrites", null);
|
|
267
270
|
__decorate([
|
|
268
|
-
Transactional({ propagation: "requires_new" })
|
|
271
|
+
Transactional({ propagation: "requires_new", admission: "shared" })
|
|
269
272
|
], KyselyCheckpointSaver.prototype, "deleteThread", null);
|
|
270
273
|
__decorate([
|
|
271
|
-
Transactional({ propagation: "requires_new" })
|
|
274
|
+
Transactional({ propagation: "requires_new", admission: "shared" })
|
|
272
275
|
], KyselyCheckpointSaver.prototype, "pruneToLatest", null);
|
|
273
276
|
KyselyCheckpointSaver = __decorate([
|
|
274
277
|
Injectable(),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Annotation, END, START, StateGraph } from "@langchain/langgraph";
|
|
2
2
|
import { MediaCache } from "./media-cache.js";
|
|
3
3
|
import { runFinalWrapUp, runModelStep, } from "./model-call.js";
|
|
4
|
+
import { withExclusiveAdmission } from "./run-execution.js";
|
|
4
5
|
import { budgetRunOf, subagentBudgetUsedUp } from "./subagents/limits.js";
|
|
5
6
|
import { isForkInvocation } from "./subagents/skill-fork.js";
|
|
6
7
|
/**
|
|
@@ -185,7 +186,9 @@ export class LangGraphLoop {
|
|
|
185
186
|
// carries the record too, but a child never dispatches.
|
|
186
187
|
const fork = firstStep && ctx.parent === undefined ? absorbed.find(isForkInvocation) : undefined;
|
|
187
188
|
if (fork !== undefined && deps.skillForks) {
|
|
188
|
-
const
|
|
189
|
+
const skillForks = deps.skillForks;
|
|
190
|
+
// a dispatch, like a tool step: its writes are admitted exclusively (`RunExecution`)
|
|
191
|
+
const r = await withExclusiveAdmission(() => skillForks.advance({ ctx, fork }));
|
|
189
192
|
if (r.kind === "suspend")
|
|
190
193
|
throw new LoopSuspended(r.waitingFor);
|
|
191
194
|
if (r.kind === "aborted") {
|
|
@@ -214,7 +217,9 @@ export class LangGraphLoop {
|
|
|
214
217
|
// 本步的全部工具调用都写下结果后才回到 prepare(不在「已记录调用、未记录结果」之间构建请求)。
|
|
215
218
|
// 某个调用需要等人处理时抛 LoopSuspended(该调用之后的调用留到续跑时处理)。
|
|
216
219
|
const tools = async (s) => {
|
|
217
|
-
|
|
220
|
+
// the tool step's writes are admitted exclusively, whatever they ask for (`RunExecution`):
|
|
221
|
+
// tools take org-level locks after the conversation rows
|
|
222
|
+
const r = await withExclusiveAdmission(() => deps.toolPipeline.runStep({
|
|
218
223
|
orgId: ctx.orgId,
|
|
219
224
|
conversationId: ctx.conversationId,
|
|
220
225
|
runId: ctx.runId,
|
|
@@ -230,7 +235,7 @@ export class LangGraphLoop {
|
|
|
230
235
|
...(ctx.limits.deadline !== undefined && { deadline: ctx.limits.deadline }),
|
|
231
236
|
...(ctx.conversationKind !== undefined && { conversationKind: ctx.conversationKind }),
|
|
232
237
|
...(ctx.parent !== undefined && { parent: ctx.parent }),
|
|
233
|
-
});
|
|
238
|
+
}));
|
|
234
239
|
if (r.kind === "suspended")
|
|
235
240
|
throw new LoopSuspended(r.waitingFor);
|
|
236
241
|
if (ctx.parent !== undefined) {
|