@capybara-hq/kernel 0.1.0-rc.137 → 0.1.0-rc.139
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 +31 -31
- package/dist/admin/extensions.controller.d.ts +5 -2
- package/dist/admin/extensions.controller.js +10 -1
- package/dist/admin/extensions.schemas.d.ts +4 -0
- package/dist/admin/extensions.schemas.js +9 -0
- package/dist/admin/health.service.d.ts +1 -1
- package/dist/admin/health.service.js +3 -3
- package/dist/catalog/catalog-content.d.ts +5 -7
- package/dist/catalog/catalog-items.js +1 -1
- package/dist/catalog/catalog-scope.service.js +5 -5
- package/dist/catalog/catalog.module.js +5 -4
- package/dist/catalog/catalog.service.d.ts +7 -1
- package/dist/catalog/catalog.service.js +19 -2
- package/dist/catalog/effect-work.d.ts +27 -0
- package/dist/catalog/effect-work.js +151 -0
- package/dist/catalog/jobs.d.ts +4 -1
- package/dist/catalog/jobs.js +14 -4
- package/dist/catalog/org-catalog.service.d.ts +2 -0
- package/dist/catalog/org-catalog.service.js +68 -12
- package/dist/catalog/org-intent.d.ts +4 -2
- package/dist/catalog/org-intent.js +25 -4
- package/dist/catalog/owned-items.d.ts +5 -1
- package/dist/catalog/owned-items.js +18 -3
- package/dist/catalog/plugin-import.d.ts +4 -2
- package/dist/catalog/plugin-import.js +10 -5
- package/dist/catalog/plugin-install.d.ts +17 -51
- package/dist/catalog/plugin-install.js +209 -235
- package/dist/catalog/plugin-upgrade.d.ts +8 -3
- package/dist/catalog/plugin-upgrade.js +63 -34
- package/dist/catalog/scope-sync-workers.d.ts +7 -11
- package/dist/catalog/scope-sync-workers.js +10 -26
- package/dist/catalog/scope-sync.d.ts +19 -114
- package/dist/catalog/scope-sync.js +220 -239
- package/dist/catalog/scope-writer.d.ts +10 -1
- package/dist/catalog/scope-writer.js +62 -4
- package/dist/catalog/template-connector-ensure.js +1 -1
- package/dist/catalog/unshare.js +1 -2
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/schema.js +7 -4
- package/dist/db/kernel-schema.d.ts +18 -17
- package/dist/erasure/org-catalog.js +2 -2
- package/dist/erasure/org-rules.js +2 -2
- package/dist/extensions/admin-ops.d.ts +1 -1
- package/dist/extensions/admin-ops.js +1 -1
- package/dist/extensions/admin-view.d.ts +4 -1
- package/dist/extensions/admin-view.js +27 -11
- package/dist/extensions/bootstrap.d.ts +1 -1
- package/dist/extensions/bootstrap.js +2 -3
- package/dist/extensions/enabled.d.ts +159 -0
- package/dist/extensions/enabled.js +7 -0
- package/dist/extensions/host.d.ts +1 -0
- package/dist/extensions/host.js +5 -2
- package/dist/extensions/isolated/authorization.d.ts +8 -0
- package/dist/extensions/isolated/authorization.js +56 -11
- package/dist/extensions/isolated/broker.js +30 -11
- package/dist/extensions/isolated/engine-binds.d.ts +9 -0
- package/dist/extensions/isolated/engine-binds.js +82 -0
- package/dist/extensions/isolated/engine-policy.d.ts +85 -0
- package/dist/extensions/isolated/engine-policy.js +75 -0
- package/dist/extensions/isolated/engine-proxy-main.d.ts +1 -0
- package/dist/extensions/isolated/engine-proxy-main.js +20 -0
- package/dist/extensions/isolated/engine-proxy.d.ts +7 -0
- package/dist/extensions/isolated/engine-proxy.js +408 -0
- package/dist/extensions/isolated/engine-vaults.d.ts +12 -0
- package/dist/extensions/isolated/engine-vaults.js +93 -0
- package/dist/extensions/isolated/lanes.d.ts +11 -3
- package/dist/extensions/isolated/lanes.js +43 -16
- package/dist/extensions/isolated/postgres-gate.d.ts +1 -0
- package/dist/extensions/isolated/postgres-gate.js +6 -6
- package/dist/extensions/isolated/revision.d.ts +1 -1
- package/dist/extensions/isolated/revision.js +3 -2
- package/dist/extensions/isolated/sandbox.d.ts +10 -6
- package/dist/extensions/isolated/sandbox.js +101 -117
- package/dist/extensions/lifecycle-topics.d.ts +1 -0
- package/dist/extensions/lifecycle-topics.js +1 -0
- package/dist/extensions/lifecycle.js +23 -2
- package/dist/extensions/permission-view.d.ts +6 -1
- package/dist/inbox/platform-inbox.service.js +16 -27
- package/dist/infra/events/kernel-events.d.ts +4 -0
- package/dist/infra/outbox/registry.d.ts +3 -36
- package/dist/infra/outbox/registry.js +4 -49
- package/dist/infra/queue/queue-names.d.ts +1 -1
- package/dist/infra/queue/queue-names.js +1 -1
- package/dist/orgs/org-lock.d.ts +3 -1
- package/dist/orgs/org-lock.js +3 -1
- package/dist/orgs/orgs.service.d.ts +3 -1
- package/dist/orgs/orgs.service.js +15 -8
- package/dist/overrides.d.ts +0 -3
- package/dist/overrides.js +0 -2
- package/dist/platform/ops/extensions-admin.ops.js +20 -3
- package/dist/platform/ops/org-plugins.ops.js +5 -2
- package/dist/platform/ops/plugins.ops.js +11 -10
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.js +6 -2
- package/package.json +2 -2
- package/src/migrations/0231_plugin_effect_work.sql +171 -0
- package/src/migrations/0232_contract_plugin_effect_schema.sql +49 -0
- package/dist/catalog/install-status.d.ts +0 -5
- package/dist/catalog/install-status.js +0 -5
- package/dist/catalog/scope-jobs.d.ts +0 -59
- package/dist/catalog/scope-jobs.js +0 -78
package/bootstrap.json
CHANGED
|
@@ -3,103 +3,103 @@
|
|
|
3
3
|
"schemaVersion": 1,
|
|
4
4
|
"marketplace": {
|
|
5
5
|
"url": "https://github.com/capybara-hq/plugins.git",
|
|
6
|
-
"commit": "
|
|
6
|
+
"commit": "ecc903f26ba0d949cc17a7f44dade2ca0316973f"
|
|
7
7
|
},
|
|
8
8
|
"plugins": [
|
|
9
9
|
{
|
|
10
10
|
"name": "openai-compatible",
|
|
11
11
|
"source": "npm",
|
|
12
12
|
"npm": "@capybara-hq/plugin-openai-compatible",
|
|
13
|
-
"version": "0.1.0-rc.
|
|
14
|
-
"integrity": "sha512-
|
|
13
|
+
"version": "0.1.0-rc.18",
|
|
14
|
+
"integrity": "sha512-u2/gp9oYXINijXSqiLdeKYoHQzTHiZM7bxt8lynrjNGxYtPzV4rwmPk3See1yOTpmJMeKqNPqavudisocZYOBA==",
|
|
15
15
|
"required": false
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"name": "object-store-s3",
|
|
19
19
|
"source": "npm",
|
|
20
20
|
"npm": "@capybara-hq/plugin-object-store-s3",
|
|
21
|
-
"version": "0.1.0-rc.
|
|
22
|
-
"integrity": "sha512-
|
|
21
|
+
"version": "0.1.0-rc.14",
|
|
22
|
+
"integrity": "sha512-SRqBeqzAIuli9kEsdFprO4wQW17mCLxXooheNei0q4UyzPZggtpRORrRCZcgixTsFuzQFP0hPonZcgx3wm0oqQ==",
|
|
23
23
|
"required": true
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"name": "anthropic",
|
|
27
27
|
"source": "npm",
|
|
28
28
|
"npm": "@capybara-hq/plugin-anthropic",
|
|
29
|
-
"version": "0.1.0-rc.
|
|
30
|
-
"integrity": "sha512-
|
|
29
|
+
"version": "0.1.0-rc.14",
|
|
30
|
+
"integrity": "sha512-Ygtv1sWffIBX2Vd6q7T71DHkwhAMDPwKEr4TUjp7cZxyUtG2oZvrlRIVxcfRVaF/OSpGrUrf47v8DLWNOwCaxQ==",
|
|
31
31
|
"required": false
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
"name": "openai",
|
|
35
35
|
"source": "npm",
|
|
36
36
|
"npm": "@capybara-hq/plugin-openai",
|
|
37
|
-
"version": "0.1.0-rc.
|
|
38
|
-
"integrity": "sha512-
|
|
37
|
+
"version": "0.1.0-rc.17",
|
|
38
|
+
"integrity": "sha512-e5AXAERCCXP4EGLmUwtVH8KmTbTi7W+baaSz3RHY3sMmJEtGQaHcyg9BjjRCDi1/Ic6G8OURhs+SUcgHs/m13Q==",
|
|
39
39
|
"required": false
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"name": "deepseek",
|
|
43
43
|
"source": "npm",
|
|
44
44
|
"npm": "@capybara-hq/plugin-deepseek",
|
|
45
|
-
"version": "0.1.0-rc.
|
|
46
|
-
"integrity": "sha512-
|
|
45
|
+
"version": "0.1.0-rc.16",
|
|
46
|
+
"integrity": "sha512-WDNjY/MyKp1A2Lf2TfuAucD/GdtP2FNGZRe3yQmBDXn8SMqJ7Plr876P6gL1j667rhbgGGz8w/uUBXcr+smiLg==",
|
|
47
47
|
"required": false
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"name": "bailian",
|
|
51
51
|
"source": "npm",
|
|
52
52
|
"npm": "@capybara-hq/plugin-bailian",
|
|
53
|
-
"version": "0.1.0-rc.
|
|
54
|
-
"integrity": "sha512-
|
|
53
|
+
"version": "0.1.0-rc.17",
|
|
54
|
+
"integrity": "sha512-76rHTjx6ri9+eWpsLDQhAK8V06+FfUdFWrSc1Br/vCF4NQ3HQlvmqwzalJxUiPtTz4UnyBmHf7UC/0N2lnmahw==",
|
|
55
55
|
"required": false
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"name": "ark",
|
|
59
59
|
"source": "npm",
|
|
60
60
|
"npm": "@capybara-hq/plugin-ark",
|
|
61
|
-
"version": "0.1.0-rc.
|
|
62
|
-
"integrity": "sha512-
|
|
61
|
+
"version": "0.1.0-rc.17",
|
|
62
|
+
"integrity": "sha512-VL6Tphbffn/6jSZaOq2m9W6Z5qglqs7qYCxrNrDRW4JeLFaQtHz6ykIqxJUvGfRQkkSsDX6VO8Gwnpj7B/kKIg==",
|
|
63
63
|
"required": false
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
"name": "connector-mcp",
|
|
67
67
|
"source": "npm",
|
|
68
68
|
"npm": "@capybara-hq/plugin-connector-mcp",
|
|
69
|
-
"version": "0.1.0-rc.
|
|
70
|
-
"integrity": "sha512
|
|
69
|
+
"version": "0.1.0-rc.15",
|
|
70
|
+
"integrity": "sha512-BuSf3Igah93ZXWe30dx7nueuwWCPHZtgDtvtZ5EZ877+s4FfnPAufdaPqygzT2aAtD0P1mhy62+cDx67TzPNOg==",
|
|
71
71
|
"required": false
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
"name": "connector-openapi",
|
|
75
75
|
"source": "npm",
|
|
76
76
|
"npm": "@capybara-hq/plugin-connector-openapi",
|
|
77
|
-
"version": "0.1.0-rc.
|
|
78
|
-
"integrity": "sha512-
|
|
77
|
+
"version": "0.1.0-rc.15",
|
|
78
|
+
"integrity": "sha512-PiuBDlCHtIIqlapdw5LRRhxIwgPqrsZEZuxvXg9rsBoN1Qygkh0OX2SNv2nx6wJQZ8eXnLXFFysWNaIPslFNUg==",
|
|
79
79
|
"required": false
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
"name": "jina",
|
|
83
83
|
"source": "npm",
|
|
84
84
|
"npm": "@capybara-hq/plugin-jina",
|
|
85
|
-
"version": "0.1.0-rc.
|
|
86
|
-
"integrity": "sha512-
|
|
85
|
+
"version": "0.1.0-rc.12",
|
|
86
|
+
"integrity": "sha512-LYE+UdX/m2YunIVxzbqj8qpHyOOjDBlaF96WbLPBuDcfNwwtHSHFCwzrjHzJhcZPKn9VF9JCdLrYWRQS4nehqQ==",
|
|
87
87
|
"required": false
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
"name": "device-docker",
|
|
91
91
|
"source": "npm",
|
|
92
92
|
"npm": "@capybara-hq/plugin-device-docker",
|
|
93
|
-
"version": "0.1.0-rc.
|
|
94
|
-
"integrity": "sha512-
|
|
93
|
+
"version": "0.1.0-rc.37",
|
|
94
|
+
"integrity": "sha512-eQbKWWB391h02S8ViOl9SIzHTRjEYGun7LTP/IkMWrkytwr8YR6jFEqUUTB+oYW0a4nBxjWm42gh2UJ0H+6WHw==",
|
|
95
95
|
"required": false
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
"name": "device-local",
|
|
99
99
|
"source": "npm",
|
|
100
100
|
"npm": "@capybara-hq/plugin-device-local",
|
|
101
|
-
"version": "0.1.0-rc.
|
|
102
|
-
"integrity": "sha512-
|
|
101
|
+
"version": "0.1.0-rc.21",
|
|
102
|
+
"integrity": "sha512-LPwym68E61ZUdgDziwXIpfPO9pXz9tD5aUdMZdoZF6sqea6uDrijz7djo1oCZ+yrGAZhzLBXDqEHJCT8kdRkqw==",
|
|
103
103
|
"required": false,
|
|
104
104
|
"scope": "all"
|
|
105
105
|
},
|
|
@@ -107,16 +107,16 @@
|
|
|
107
107
|
"name": "todo",
|
|
108
108
|
"source": "npm",
|
|
109
109
|
"npm": "@capybara-hq/plugin-todo",
|
|
110
|
-
"version": "0.1.0-rc.
|
|
111
|
-
"integrity": "sha512-
|
|
110
|
+
"version": "0.1.0-rc.18",
|
|
111
|
+
"integrity": "sha512-KpIBNLiQAOM8/rRpdVwbUKMVpPwT2MZ1ygjWqTqShtD2xSKEyTJ9yo1buSADPrWTeQfqDx/YRu5+sQ/QYm5cOA==",
|
|
112
112
|
"required": false
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "skills-core",
|
|
116
116
|
"source": "npm",
|
|
117
117
|
"npm": "@capybara-hq/plugin-skills-core",
|
|
118
|
-
"version": "0.1.0-rc.
|
|
119
|
-
"integrity": "sha512-
|
|
118
|
+
"version": "0.1.0-rc.4",
|
|
119
|
+
"integrity": "sha512-uF/tvRQH2eje98tRj15xOkbEWMGT6MVkEXgdrlWNNtH9+/kFE27HtmHRLb9m5bwWFonlXOtxvN9sP2DBE2gGWA==",
|
|
120
120
|
"required": false,
|
|
121
121
|
"builtin": true
|
|
122
122
|
},
|
|
@@ -124,8 +124,8 @@
|
|
|
124
124
|
"name": "file-preview",
|
|
125
125
|
"source": "npm",
|
|
126
126
|
"npm": "@capybara-hq/plugin-file-preview",
|
|
127
|
-
"version": "0.1.0-rc.
|
|
128
|
-
"integrity": "sha512-
|
|
127
|
+
"version": "0.1.0-rc.7",
|
|
128
|
+
"integrity": "sha512-0xIyrYnFtw04gVyqw+HxgKoDvsAVqoy+u2C3Wn6+adhCs+58q8miqMB1AGFxV6b9DSUuQT6nqzhWsBH5lLLgkA==",
|
|
129
129
|
"required": false,
|
|
130
130
|
"builtin": true
|
|
131
131
|
}
|
|
@@ -4,14 +4,14 @@ import { ExtensionAdmin } from "../extensions/admin-view.js";
|
|
|
4
4
|
import { type DeploymentConfigView, ExtensionDeploymentConfigService } from "../extensions/deployment-config.js";
|
|
5
5
|
import { ExtensionInstalls, type PackageReview } from "../extensions/installs.js";
|
|
6
6
|
import { type OrgOverrideSummary, OrgOverrides } from "../extensions/org-overrides.js";
|
|
7
|
-
import type { AdminExtensionView } from "../extensions/permission-view.js";
|
|
7
|
+
import type { AdminExtensionView, ExtensionOrgCounts } from "../extensions/permission-view.js";
|
|
8
8
|
import { PluginGuides, type RenderedSetupGuide } from "../extensions/plugin-guides.js";
|
|
9
9
|
import { type Principal } from "../identity/principal.js";
|
|
10
10
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
11
11
|
import type { SetupCheckState } from "../setup/setup-check-registry.js";
|
|
12
12
|
import { DeploymentCheckPathParams, DeploymentCheckRunBody, DeploymentGuidePathParams, DeploymentGuidesPathParams, DeploymentGuidesQuery } from "../setup/setup-checks.schemas.js";
|
|
13
13
|
import { SetupChecksService } from "../setup/setup-checks.service.js";
|
|
14
|
-
import { AdminExtensionConfigBody } from "./extensions.schemas.js";
|
|
14
|
+
import { AdminExtensionConfigBody, AdminExtensionOrgCountsQuery } from "./extensions.schemas.js";
|
|
15
15
|
declare const ApproveSchema: z.ZodObject<{
|
|
16
16
|
sha256: z.ZodNullable<z.ZodString>;
|
|
17
17
|
reviewHash: z.ZodString;
|
|
@@ -52,6 +52,9 @@ export declare class AdminExtensionsController {
|
|
|
52
52
|
extensions: AdminExtensionView[];
|
|
53
53
|
drainSeconds: number;
|
|
54
54
|
}>;
|
|
55
|
+
counts(query: z.infer<typeof AdminExtensionOrgCountsQuery>): Promise<{
|
|
56
|
+
counts: ExtensionOrgCounts[];
|
|
57
|
+
}>;
|
|
55
58
|
/** A single extension; unknown -> 404 `extension.not_found`. */
|
|
56
59
|
get(name: string): Promise<AdminExtensionView>;
|
|
57
60
|
/**
|
|
@@ -23,7 +23,7 @@ import { createZodDto } from "../infra/validation/create-zod-dto.js";
|
|
|
23
23
|
import { ZBody, ZParam, ZQuery } from "../infra/validation/zod-params.js";
|
|
24
24
|
import { DeploymentCheckPathParams, DeploymentCheckRunBody, DeploymentGuidePathParams, DeploymentGuidesPathParams, DeploymentGuidesQuery, } from "../setup/setup-checks.schemas.js";
|
|
25
25
|
import { SetupChecksService } from "../setup/setup-checks.service.js";
|
|
26
|
-
import { AdminExtensionConfigBody } from "./extensions.schemas.js";
|
|
26
|
+
import { AdminExtensionConfigBody, AdminExtensionOrgCountsQuery } from "./extensions.schemas.js";
|
|
27
27
|
const ApproveSchema = z.object({
|
|
28
28
|
/** 安装记录的包(审阅时的 sha256);配置声明的插件为 null。 */
|
|
29
29
|
sha256: z
|
|
@@ -46,6 +46,8 @@ class ExtensionInstallBody extends createZodDto(InstallSchema, "ExtensionInstall
|
|
|
46
46
|
}
|
|
47
47
|
class ExtensionConfigBody extends createZodDto(AdminExtensionConfigBody, "ExtensionConfigBody") {
|
|
48
48
|
}
|
|
49
|
+
class ExtensionOrgCountsQuery extends createZodDto(AdminExtensionOrgCountsQuery, "ExtensionOrgCountsQuery") {
|
|
50
|
+
}
|
|
49
51
|
class ExtensionNpmImportBody extends createZodDto(NpmSchema, "ExtensionNpmImportBody") {
|
|
50
52
|
}
|
|
51
53
|
/** The `:name` route parameter of the org-overrides list (decision R20). */
|
|
@@ -100,6 +102,9 @@ let AdminExtensionsController = class AdminExtensionsController {
|
|
|
100
102
|
drainSeconds: this.kernelConfig.get().extensionHost.drainSeconds,
|
|
101
103
|
};
|
|
102
104
|
}
|
|
105
|
+
async counts(query) {
|
|
106
|
+
return { counts: await this.admin.orgCounts(query.names.split(",")) };
|
|
107
|
+
}
|
|
103
108
|
/** A single extension; unknown -> 404 `extension.not_found`. */
|
|
104
109
|
get(name) {
|
|
105
110
|
return this.admin.get(name);
|
|
@@ -244,6 +249,10 @@ let AdminExtensionsController = class AdminExtensionsController {
|
|
|
244
249
|
__decorate([
|
|
245
250
|
Get()
|
|
246
251
|
], AdminExtensionsController.prototype, "list", null);
|
|
252
|
+
__decorate([
|
|
253
|
+
Get("counts/orgs"),
|
|
254
|
+
__param(0, ZQuery(ExtensionOrgCountsQuery))
|
|
255
|
+
], AdminExtensionsController.prototype, "counts", null);
|
|
247
256
|
__decorate([
|
|
248
257
|
Get(":name"),
|
|
249
258
|
__param(0, Param("name"))
|
|
@@ -25,4 +25,8 @@ export declare const AdminExtensionConfigBody: z.ZodObject<{
|
|
|
25
25
|
renameFrom: z.ZodOptional<z.ZodString>;
|
|
26
26
|
}, z.core.$strict>>>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
|
+
export declare const EXTENSION_ORG_COUNT_PAGE_SIZE = 20;
|
|
29
|
+
export declare const AdminExtensionOrgCountsQuery: z.ZodObject<{
|
|
30
|
+
names: z.ZodString;
|
|
31
|
+
}, z.core.$strict>;
|
|
28
32
|
export declare const ADMIN_EXTENSION_ROUTES: readonly RouteSchemas[];
|
|
@@ -31,10 +31,19 @@ export const AdminExtensionConfigBody = z.object({
|
|
|
31
31
|
/** Single keys of hinted secret records (extension config forms spec §4.3), applied in order. */
|
|
32
32
|
secretEntries: z.array(AdminExtensionSecretEntry).max(200).optional(),
|
|
33
33
|
});
|
|
34
|
+
export const EXTENSION_ORG_COUNT_PAGE_SIZE = 20;
|
|
35
|
+
export const AdminExtensionOrgCountsQuery = z
|
|
36
|
+
.object({
|
|
37
|
+
names: z
|
|
38
|
+
.string()
|
|
39
|
+
.regex(/^[a-z0-9][a-z0-9_-]{0,63}(,[a-z0-9][a-z0-9_-]{0,63}){0,19}$/, "Pass one to 20 comma-separated extension names"),
|
|
40
|
+
})
|
|
41
|
+
.strict();
|
|
34
42
|
export const ADMIN_EXTENSION_ROUTES = [
|
|
35
43
|
// the extension package is the raw body (no schema)
|
|
36
44
|
{ route: "POST /api/v1/admin/extensions/packages/file" },
|
|
37
45
|
{ route: "GET /api/v1/admin/extensions" },
|
|
46
|
+
{ route: "GET /api/v1/admin/extensions/counts/orgs", query: AdminExtensionOrgCountsQuery },
|
|
38
47
|
{ route: "GET /api/v1/admin/extensions/:name", params: AdminExtensionNamePathParams },
|
|
39
48
|
{ route: "POST /api/v1/admin/extensions/:name/enable", params: AdminExtensionNamePathParams },
|
|
40
49
|
{ route: "POST /api/v1/admin/extensions/:name/disable", params: AdminExtensionNamePathParams },
|
|
@@ -5,7 +5,7 @@ import { type LiveReplica, ReplicaPresence } from "../infra/presence/replica-pre
|
|
|
5
5
|
import type { KernelLogger } from "../log.js";
|
|
6
6
|
import { DeviceProviders } from "../sandbox/providers.js";
|
|
7
7
|
/** The kernel's own queues, in the order the overview lists them (extension queues are not read). */
|
|
8
|
-
export declare const KERNEL_QUEUE_NAMES: readonly ["cap-kernel-runs", "cap-kernel-subagent-runs", "cap-kernel-channels", "cap-kernel-maintenance", "cap-kernel-tool-watch", "cap-kernel-plugin-
|
|
8
|
+
export declare const KERNEL_QUEUE_NAMES: readonly ["cap-kernel-runs", "cap-kernel-subagent-runs", "cap-kernel-channels", "cap-kernel-maintenance", "cap-kernel-tool-watch", "cap-kernel-plugin-effects", "cap-kernel-titles", "cap-kernel-suggestions", "cap-kernel-usage-report", "cap-kernel-evals", "cap-kernel-lifecycle", "cap-push-deliver", "cap-connector-tools", "cap-template-connectors", "cap-device-service-events", "cap-external-calls"];
|
|
9
9
|
/** How long each source's reads may take before the answer marks it unavailable. */
|
|
10
10
|
export declare const HEALTH_READ_TIMEOUT_MS = 3000;
|
|
11
11
|
/** A live replica as the overview shows it. */
|
|
@@ -10,7 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { getQueueToken } from "@nestjs/bullmq";
|
|
11
11
|
import { Inject, Injectable } from "@nestjs/common";
|
|
12
12
|
import { sql } from "kysely";
|
|
13
|
-
import {
|
|
13
|
+
import { PLUGIN_EFFECT_QUEUE } from "../catalog/scope-sync.js";
|
|
14
14
|
import { TEMPLATE_CONNECTORS_QUEUE } from "../catalog/template-connector-jobs.js";
|
|
15
15
|
import { CHANNEL_QUEUE_NAME } from "../channels/jobs.js";
|
|
16
16
|
import { EXTERNAL_CALLS_QUEUE } from "../conversations/external/external-calls.js";
|
|
@@ -38,7 +38,7 @@ export const KERNEL_QUEUE_NAMES = [
|
|
|
38
38
|
CHANNEL_QUEUE_NAME,
|
|
39
39
|
MAINTENANCE_QUEUE_NAME,
|
|
40
40
|
TOOL_WATCH_QUEUE,
|
|
41
|
-
|
|
41
|
+
PLUGIN_EFFECT_QUEUE,
|
|
42
42
|
TITLE_QUEUE,
|
|
43
43
|
PROMPT_SUGGESTION_QUEUE,
|
|
44
44
|
USAGE_REPORT_QUEUE,
|
|
@@ -305,7 +305,7 @@ AdminHealthService = __decorate([
|
|
|
305
305
|
__param(7, Inject(getQueueToken(CHANNEL_QUEUE_NAME))),
|
|
306
306
|
__param(8, Inject(getQueueToken(MAINTENANCE_QUEUE_NAME))),
|
|
307
307
|
__param(9, Inject(getQueueToken(TOOL_WATCH_QUEUE))),
|
|
308
|
-
__param(10, Inject(getQueueToken(
|
|
308
|
+
__param(10, Inject(getQueueToken(PLUGIN_EFFECT_QUEUE))),
|
|
309
309
|
__param(11, Inject(getQueueToken(TITLE_QUEUE))),
|
|
310
310
|
__param(12, Inject(getQueueToken(PROMPT_SUGGESTION_QUEUE))),
|
|
311
311
|
__param(13, Inject(getQueueToken(USAGE_REPORT_QUEUE))),
|
|
@@ -36,11 +36,9 @@ export interface OrgCatalogItem extends Omit<CatalogItemView, "installs" | "mark
|
|
|
36
36
|
switchable: boolean;
|
|
37
37
|
/** The plugin's extension (or a template's connector extension) is not on the deployment. */
|
|
38
38
|
notDeployed: boolean;
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
* kept for the web until its upgrade dialog goes).
|
|
43
|
-
*/
|
|
39
|
+
/** Pending work or the latest failed effect, independent of whether the plugin can be used. */
|
|
40
|
+
setup?: "pending" | "install_failed";
|
|
41
|
+
/** The version of this plugin's applied org resources, when it owns any. */
|
|
44
42
|
installed: {
|
|
45
43
|
pluginInstallId: string;
|
|
46
44
|
version: string;
|
|
@@ -192,10 +190,10 @@ export interface OrgInstallResult {
|
|
|
192
190
|
installed: {
|
|
193
191
|
itemId: string;
|
|
194
192
|
version: string;
|
|
195
|
-
pluginInstallId: string;
|
|
193
|
+
pluginInstallId: string | null;
|
|
196
194
|
};
|
|
197
195
|
/** The install view (its components, dependency installs included). */
|
|
198
|
-
install: PluginInstallView;
|
|
196
|
+
install: PluginInstallView | null;
|
|
199
197
|
}
|
|
200
198
|
/**
|
|
201
199
|
* The org actions installing / uninstalling a plugin needs: the union over its components (an
|
|
@@ -458,7 +458,7 @@ export async function countInstalls(db, itemIds) {
|
|
|
458
458
|
.innerJoin("orgs as org", "org.id", "install.org_id")
|
|
459
459
|
.select(["install.item_id", (eb) => eb.fn.count("install.org_id").distinct().as("n")])
|
|
460
460
|
.where("install.item_id", "in", itemIds)
|
|
461
|
-
.where("install.
|
|
461
|
+
.where("install.version", "is not", null)
|
|
462
462
|
.where("org.deleted_at", "is", null)
|
|
463
463
|
.groupBy("install.item_id")
|
|
464
464
|
.execute();
|
|
@@ -24,7 +24,6 @@ import { CatalogService } from "./catalog.service.js";
|
|
|
24
24
|
import { assertOrgsExist } from "./catalog-items.js";
|
|
25
25
|
import { nameConflictError } from "./component-scope.service.js";
|
|
26
26
|
import { agentsUsing, COMPONENT_KINDS, componentOffered, componentOn, listedIn, loadComponents, loadScopeState, pluginFactsOf, skillNameClashes, switchOf, themeIdClashes, } from "./component-state.js";
|
|
27
|
-
import { LIVE_INSTALL_STATUSES } from "./install-status.js";
|
|
28
27
|
import { orgUsable } from "./org-intent.js";
|
|
29
28
|
import { assertOwnerListed, assertShareable, assertShareableTarget, newlySharedWith, } from "./ownership.js";
|
|
30
29
|
import { PluginImport } from "./plugin-import.js";
|
|
@@ -287,7 +286,7 @@ let CatalogScopeService = class CatalogScopeService {
|
|
|
287
286
|
...opts.auditDetail,
|
|
288
287
|
},
|
|
289
288
|
});
|
|
290
|
-
await this.enqueue(itemId);
|
|
289
|
+
await this.enqueue(itemId, from);
|
|
291
290
|
},
|
|
292
291
|
};
|
|
293
292
|
});
|
|
@@ -370,6 +369,7 @@ let CatalogScopeService = class CatalogScopeService {
|
|
|
370
369
|
}
|
|
371
370
|
if (narrowed)
|
|
372
371
|
await this.enqueue(itemId);
|
|
372
|
+
this.scopeWriter.refreshIsolatedOrgIntent();
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
375
|
* Adds one org to a `named` item's list in the caller's transaction (an approved `access`
|
|
@@ -392,8 +392,8 @@ let CatalogScopeService = class CatalogScopeService {
|
|
|
392
392
|
await this.enqueue(itemId);
|
|
393
393
|
}
|
|
394
394
|
/** Owes the item's scope sync in the transaction that changes its scope (outbox spec §8.1). */
|
|
395
|
-
async enqueue(itemId) {
|
|
396
|
-
await this.sync.enqueueItem(itemId);
|
|
395
|
+
async enqueue(itemId, previousOrgs = []) {
|
|
396
|
+
await this.sync.enqueueItem(itemId, previousOrgs);
|
|
397
397
|
}
|
|
398
398
|
/**
|
|
399
399
|
* 409 `theme.platform_default` when a live theme of the item is the platform default and `after`
|
|
@@ -484,7 +484,7 @@ let CatalogScopeService = class CatalogScopeService {
|
|
|
484
484
|
.selectFrom("plugin_installs")
|
|
485
485
|
.select(["id", "org_id"])
|
|
486
486
|
.where("item_id", "=", item.id)
|
|
487
|
-
.where("
|
|
487
|
+
.where("version", "is not", null)
|
|
488
488
|
.execute();
|
|
489
489
|
const live = new Map(installs.map((install) => [install.org_id, install.id]));
|
|
490
490
|
const affected = [];
|
|
@@ -17,6 +17,7 @@ import { ToolsModule } from "../tools/tools.module.js";
|
|
|
17
17
|
import { CatalogImportModule } from "./catalog-import.module.js";
|
|
18
18
|
import { CatalogScopeService } from "./catalog-scope.service.js";
|
|
19
19
|
import { ComponentScopeService } from "./component-scope.service.js";
|
|
20
|
+
import { PLUGIN_EFFECT_QUEUE } from "./effect-work.js";
|
|
20
21
|
import { OrgCatalogService } from "./org-catalog.service.js";
|
|
21
22
|
import { OrgPluginUploads } from "./org-plugin-uploads.js";
|
|
22
23
|
import { OwnedItems } from "./owned-items.js";
|
|
@@ -24,13 +25,13 @@ import { PlatformImportUpdate } from "./platform-import-update.js";
|
|
|
24
25
|
import { PluginInstaller } from "./plugin-install.js";
|
|
25
26
|
import { PlatformPluginUpdater } from "./plugin-upgrade.js";
|
|
26
27
|
import { CatalogRequestsService } from "./requests.service.js";
|
|
27
|
-
import {
|
|
28
|
+
import { PluginScopeSync } from "./scope-sync.js";
|
|
28
29
|
import { ScopeWriter } from "./scope-writer.js";
|
|
29
30
|
import { TemplateConnectorEnsurer } from "./template-connector-ensure.js";
|
|
30
31
|
import { TemplateConnectorsQueueModule } from "./template-connector-jobs.js";
|
|
31
32
|
export { CatalogImportModule };
|
|
32
33
|
/** The plugin scope sync's queue registration (re-exported: the admin health reads its counts). */
|
|
33
|
-
const
|
|
34
|
+
const PLUGIN_EFFECT_QUEUE_MODULE = QueueModule.registerQueue(PLUGIN_EFFECT_QUEUE);
|
|
34
35
|
/** This module's maintenance queue registration (re-exported for the admin health). */
|
|
35
36
|
const MAINTENANCE_QUEUE_MODULE = QueueModule.registerQueue(MAINTENANCE_QUEUE_NAME);
|
|
36
37
|
/**
|
|
@@ -57,7 +58,7 @@ CatalogModule = __decorate([
|
|
|
57
58
|
ToolsModule,
|
|
58
59
|
// the plugin scope sync's queue: the outbox dispatcher adds the owed jobs through it
|
|
59
60
|
// (`PluginScopeWorkersModule` consumes it)
|
|
60
|
-
|
|
61
|
+
PLUGIN_EFFECT_QUEUE_MODULE,
|
|
61
62
|
// the queue of a removed org plugin's owed cleanup job (`OwnedItems`, `CatalogScopeService`;
|
|
62
63
|
// consumed by the worker role's `MaintenanceProcessor`)
|
|
63
64
|
MAINTENANCE_QUEUE_MODULE,
|
|
@@ -80,7 +81,7 @@ CatalogModule = __decorate([
|
|
|
80
81
|
TemplateConnectorEnsurer,
|
|
81
82
|
],
|
|
82
83
|
exports: [
|
|
83
|
-
|
|
84
|
+
PLUGIN_EFFECT_QUEUE_MODULE,
|
|
84
85
|
TemplateConnectorsQueueModule,
|
|
85
86
|
MAINTENANCE_QUEUE_MODULE,
|
|
86
87
|
CatalogImportModule,
|
|
@@ -7,6 +7,9 @@ import { SuperAdminLock } from "../identity/super-admin.js";
|
|
|
7
7
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
8
8
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
9
9
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
10
|
+
import { XactLock } from "../infra/database/xact-lock.js";
|
|
11
|
+
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
12
|
+
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
10
13
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
11
14
|
import type { OfficialPublisherProof } from "../packages/official-publisher.js";
|
|
12
15
|
import type { TranslationReport } from "./claude/report.js";
|
|
@@ -257,6 +260,9 @@ export declare class CatalogService {
|
|
|
257
260
|
/** The orgs whose connectors a delete switches off, locked before the item (ruling P3-50). */
|
|
258
261
|
private readonly orgLock;
|
|
259
262
|
readonly txHost: TransactionHost;
|
|
263
|
+
private readonly xactLock;
|
|
264
|
+
private readonly outbox;
|
|
265
|
+
private readonly events;
|
|
260
266
|
constructor(kdb: KernelDb,
|
|
261
267
|
/** The super admin lock (identity/super-admin.ts): joins the caller's transaction. */
|
|
262
268
|
adminLock: SuperAdminLock, config: KernelConfigService, installs: ExtensionInstalls,
|
|
@@ -269,7 +275,7 @@ export declare class CatalogService {
|
|
|
269
275
|
/** Serializes a claim release with an install of that name still committing (F10). */
|
|
270
276
|
installLock: PluginInstallLock,
|
|
271
277
|
/** The orgs whose connectors a delete switches off, locked before the item (ruling P3-50). */
|
|
272
|
-
orgLock: OrgLock, txHost: TransactionHost);
|
|
278
|
+
orgLock: OrgLock, txHost: TransactionHost, xactLock: XactLock, outbox: OutboxService, events: KernelEvents);
|
|
273
279
|
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
274
280
|
private get db();
|
|
275
281
|
/** Downloads a marketplace archive source, verified against its integrity. */
|
|
@@ -19,14 +19,19 @@ import { captureSourceIntent, restoreSourceIntent } from "../extensions/source-i
|
|
|
19
19
|
import { audit } from "../identity/audit.js";
|
|
20
20
|
import { SuperAdminLock } from "../identity/super-admin.js";
|
|
21
21
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
22
|
+
import { afterCommit } from "../infra/database/after-commit.js";
|
|
22
23
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
23
24
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
24
25
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
26
|
+
import { XactLock } from "../infra/database/xact-lock.js";
|
|
27
|
+
import { KernelEvents } from "../infra/events/kernel-events.js";
|
|
28
|
+
import { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
25
29
|
import { OrgLock } from "../orgs/org-lock.js";
|
|
26
30
|
import { sameRepository } from "../packages/provenance.js";
|
|
27
31
|
import { assertNotPlatformDefault } from "../themes/theme-usage.js";
|
|
28
32
|
import { countInstalls, inAuthorOrder, itemConfirmations, itemScopeFacts, itemView, marketplaceLatest, versionUsable, } from "./catalog-items.js";
|
|
29
33
|
import { retireCatalogDependencyEdges } from "./dependency-edges.js";
|
|
34
|
+
import { EFFECT_CANDIDATES_LOCK, oweEffectWork } from "./effect-work.js";
|
|
30
35
|
import { expandGitUrl, GitSourceError, gitErrorDetails, normalGitPath, readGitTreeAndOids, resolveGitCommit, } from "./git-source.js";
|
|
31
36
|
import { fetchMarketplaceArchive, marketplaceNetPolicy, marketplaceUrlProblem, requireMarketplacePublisher, } from "./marketplace-fetch.js";
|
|
32
37
|
import { assertEntryNotDeprecated, entryCompatible, entrySourceHost, HOST_VERSIONS, hostAllowed, loadMarketplaceEntry, MarketplacesService, pluginNameFrom, } from "./marketplaces.service.js";
|
|
@@ -106,6 +111,9 @@ let CatalogService = class CatalogService {
|
|
|
106
111
|
installLock;
|
|
107
112
|
orgLock;
|
|
108
113
|
txHost;
|
|
114
|
+
xactLock;
|
|
115
|
+
outbox;
|
|
116
|
+
events;
|
|
109
117
|
constructor(kdb,
|
|
110
118
|
/** The super admin lock (identity/super-admin.ts): joins the caller's transaction. */
|
|
111
119
|
adminLock, config, installs,
|
|
@@ -118,7 +126,7 @@ let CatalogService = class CatalogService {
|
|
|
118
126
|
/** Serializes a claim release with an install of that name still committing (F10). */
|
|
119
127
|
installLock,
|
|
120
128
|
/** The orgs whose connectors a delete switches off, locked before the item (ruling P3-50). */
|
|
121
|
-
orgLock, txHost) {
|
|
129
|
+
orgLock, txHost, xactLock, outbox, events) {
|
|
122
130
|
this.kdb = kdb;
|
|
123
131
|
this.adminLock = adminLock;
|
|
124
132
|
this.config = config;
|
|
@@ -129,6 +137,9 @@ let CatalogService = class CatalogService {
|
|
|
129
137
|
this.installLock = installLock;
|
|
130
138
|
this.orgLock = orgLock;
|
|
131
139
|
this.txHost = txHost;
|
|
140
|
+
this.xactLock = xactLock;
|
|
141
|
+
this.outbox = outbox;
|
|
142
|
+
this.events = events;
|
|
132
143
|
}
|
|
133
144
|
/** The kernel-schema handle of the current context (the transaction, else the pool). */
|
|
134
145
|
get db() {
|
|
@@ -526,6 +537,7 @@ let CatalogService = class CatalogService {
|
|
|
526
537
|
await this.assertExtensionDisabled(this.kdb.db, itemId);
|
|
527
538
|
}
|
|
528
539
|
async writeRemove(actor, itemId, opts) {
|
|
540
|
+
await this.xactLock.lock(EFFECT_CANDIDATES_LOCK);
|
|
529
541
|
await this.adminLock.lockAndAuthorize(actor);
|
|
530
542
|
// The orgs whose connectors the delete switches off, sorted, before the item (the global lock
|
|
531
543
|
// order, ruling P3-50, as the platform plugin update takes them)
|
|
@@ -673,7 +685,9 @@ let CatalogService = class CatalogService {
|
|
|
673
685
|
for (const [plugin, before] of sourceIntent) {
|
|
674
686
|
await restoreSourceIntent(t, plugin, before, actor);
|
|
675
687
|
}
|
|
688
|
+
await oweEffectWork(this.outbox, t, { itemIds: [itemId] });
|
|
676
689
|
await retireCatalogDependencyEdges(t, itemId);
|
|
690
|
+
afterCommit(() => this.events.emit("catalog.org-intent-changed", {}));
|
|
677
691
|
return { name: row.name };
|
|
678
692
|
}
|
|
679
693
|
};
|
|
@@ -694,6 +708,9 @@ CatalogService = __decorate([
|
|
|
694
708
|
__param(6, Inject(MarketplacesService)),
|
|
695
709
|
__param(7, Inject(PluginInstallLock)),
|
|
696
710
|
__param(8, Inject(OrgLock)),
|
|
697
|
-
__param(9, Inject(TransactionHost))
|
|
711
|
+
__param(9, Inject(TransactionHost)),
|
|
712
|
+
__param(10, Inject(XactLock)),
|
|
713
|
+
__param(11, Inject(OutboxService)),
|
|
714
|
+
__param(12, Inject(KernelEvents))
|
|
698
715
|
], CatalogService);
|
|
699
716
|
export { CatalogService };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
2
|
+
import type { OutboxService } from "../infra/outbox/outbox.service.js";
|
|
3
|
+
export declare const PLUGIN_EFFECT_QUEUE = "cap-kernel-plugin-effects";
|
|
4
|
+
export declare const PLUGIN_EFFECT_JOB = "plugin-effect";
|
|
5
|
+
export declare const EFFECT_CANDIDATES_LOCK = "capybara.plugin-effect-candidates";
|
|
6
|
+
export type EffectJob = {
|
|
7
|
+
kind: "chunk";
|
|
8
|
+
itemId: string;
|
|
9
|
+
orgIds: [string];
|
|
10
|
+
};
|
|
11
|
+
type Outbox = Pick<OutboxService, "addMany">;
|
|
12
|
+
export declare function effectGeneration(jobId: string, { itemId, orgIds }: EffectJob): string;
|
|
13
|
+
type EffectMutation = {
|
|
14
|
+
itemIds: readonly string[];
|
|
15
|
+
previousOrgs?: readonly string[];
|
|
16
|
+
orgId?: string;
|
|
17
|
+
includeDependents?: boolean;
|
|
18
|
+
} | {
|
|
19
|
+
orgId: string;
|
|
20
|
+
};
|
|
21
|
+
/** Selects sparse intent or ownership first. Only an all-scope root needs the org census. */
|
|
22
|
+
export declare function oweEffectWork(outbox: Outbox, db: KernelSchemaDb, mutation: EffectMutation): Promise<void>;
|
|
23
|
+
/** Re-owes the same generation if a worker did not settle it. */
|
|
24
|
+
export declare function recoverEffectWork(outbox: Outbox, db: KernelSchemaDb): Promise<void>;
|
|
25
|
+
/** Resolve a deployed extension's live catalog item before owing its affected pairs. */
|
|
26
|
+
export declare function oweDeployedExtensionSync(outbox: Outbox, db: KernelSchemaDb, extensionName: string): Promise<void>;
|
|
27
|
+
export {};
|