@capybara-hq/kernel 0.1.0-rc.123 → 0.1.0-rc.124
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/admin.controller.d.ts +2 -2
- package/dist/admin/admin.controller.js +1 -1
- package/dist/admin/health.service.js +5 -5
- package/dist/admin/overview.service.d.ts +2 -2
- package/dist/admin/overview.service.js +1 -1
- package/dist/agents/agents.module.js +4 -0
- package/dist/agents/agents.schemas.js +1 -0
- package/dist/agents/models.controller.d.ts +2 -2
- package/dist/agents/onboarding-checklist.d.ts +30 -0
- package/dist/agents/onboarding-checklist.js +176 -0
- package/dist/agents/readiness.controller.d.ts +1 -0
- package/dist/agents/readiness.controller.js +12 -2
- package/dist/agents/readiness.service.d.ts +5 -2
- package/dist/agents/readiness.service.js +14 -3
- package/dist/automations/automations.service.js +7 -21
- package/dist/automations/events/acceptance.d.ts +2 -0
- package/dist/automations/events/acceptance.js +14 -3
- package/dist/automations/events/sweep.job.d.ts +3 -36
- package/dist/automations/events/sweep.job.js +5 -127
- package/dist/automations/fire.d.ts +3 -0
- package/dist/automations/fire.js +18 -1
- package/dist/automations/grant-rules.d.ts +0 -14
- package/dist/automations/grant-rules.js +0 -18
- package/dist/automations/scan.job.js +22 -16
- package/dist/catalog/catalog.module.d.ts +4 -7
- package/dist/catalog/catalog.module.js +4 -10
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/plugin-import.js +2 -1
- package/dist/catalog/plugin-install.d.ts +2 -2
- package/dist/catalog/plugin-install.js +2 -2
- package/dist/catalog/template-connector-ensure.d.ts +4 -7
- package/dist/catalog/template-connector-ensure.js +11 -15
- package/dist/channels/supervisor.js +34 -23
- package/dist/channels/webhook.d.ts +1 -0
- package/dist/channels/webhook.js +10 -5
- package/dist/conversations/job-org.d.ts +2 -0
- package/dist/conversations/job-org.js +12 -0
- package/dist/ctx/create-ctx.js +2 -1
- package/dist/db/kernel-schema.d.ts +1 -0
- package/dist/dial-in/auth.controller.js +3 -2
- package/dist/dial-in/auth.service.js +3 -2
- package/dist/dial-in/gateway.d.ts +0 -1
- package/dist/dial-in/gateway.js +6 -9
- package/dist/extensions/host.d.ts +2 -2
- package/dist/extensions/host.js +22 -13
- package/dist/extensions/installs.d.ts +1 -0
- package/dist/extensions/installs.js +2 -0
- package/dist/html/html-document.controller.js +3 -0
- package/dist/html/html-document.service.js +2 -0
- package/dist/http/plugin-route-access.js +7 -2
- package/dist/identity/account-avatar.controller.js +4 -2
- package/dist/identity/accounts.js +19 -32
- package/dist/identity/api-tokens.d.ts +2 -0
- package/dist/identity/api-tokens.js +14 -10
- package/dist/identity/audit.js +10 -5
- package/dist/identity/binding.d.ts +1 -1
- package/dist/identity/binding.js +19 -10
- package/dist/lifecycle/kernel-lifecycle.d.ts +1 -8
- package/dist/lifecycle/kernel-lifecycle.js +11 -37
- package/dist/models/purposes.d.ts +24 -3
- package/dist/models/purposes.js +131 -14
- package/dist/orgs/directory-sync.js +6 -4
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +1 -0
- package/dist/platform/exclusions.js +5 -0
- package/dist/platform/ops/admin.ops.js +1 -1
- package/dist/platform/ops/agents.ops.js +1 -1
- package/dist/platform/ops/models.ops.js +3 -3
- package/dist/push/fanout.d.ts +1 -0
- package/dist/push/fanout.js +11 -4
- package/dist/push/recipients.d.ts +3 -1
- package/dist/push/recipients.js +29 -22
- package/dist/runtime/maintenance.d.ts +5 -1
- package/dist/runtime/maintenance.js +50 -11
- package/dist/runtime/providers.d.ts +12 -9
- package/dist/runtime/providers.js +2 -23
- package/dist/runtime/run-orphan-check.job.d.ts +1 -0
- package/dist/runtime/run-orphan-check.job.js +23 -21
- package/dist/runtime/usage-report.d.ts +2 -1
- package/dist/runtime/usage-report.js +26 -4
- package/dist/sandbox/providers.d.ts +2 -0
- package/dist/sandbox/providers.js +2 -0
- package/dist/shares/liveness.d.ts +3 -2
- package/dist/shares/liveness.js +26 -11
- package/dist/shares/share-open.service.js +2 -0
- package/dist/skills/usable.d.ts +2 -0
- package/dist/skills/usable.js +56 -0
- package/dist/tools/builtins/platform.js +17 -12
- package/dist/tools/connector-setup.d.ts +5 -1
- package/dist/tools/connector-setup.js +14 -0
- package/dist/tools/credentials.d.ts +5 -0
- package/dist/tools/credentials.js +10 -0
- package/dist/tools/oauth/flow.d.ts +1 -0
- package/dist/tools/oauth/flow.js +8 -3
- package/dist/tools/registry.d.ts +2 -0
- package/dist/tools/registry.js +6 -0
- package/package.json +3 -3
- package/src/migrations/0209_onboarding_checklist.sql +5 -0
- package/dist/catalog/template-connector-reconcile.d.ts +0 -44
- package/dist/catalog/template-connector-reconcile.js +0 -114
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": "e5cc914a56d4c1dbb1383ba1729fcac8233dfd16"
|
|
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.17",
|
|
14
|
+
"integrity": "sha512-ly1FFSEK5uwWqs+TPGmbiGeURqTXRuUjpakcj1wEsryxgueIDe2uyj+yvyIf/jwyTU3728tmxxZmgucGh9b1Qg==",
|
|
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.13",
|
|
22
|
+
"integrity": "sha512-J0bhmRafIoifcZsI6ESTTKClZMSN/cPLVFKfVBIjGTzhGcZobAuTY5+m+j3zMeZCQcEzirBhtF3t76KpslWTZg==",
|
|
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.13",
|
|
30
|
+
"integrity": "sha512-9r5EWfkJl6y+MqGTk8dkX4Lz8KuJMrx7Q7o+CQUqaGkhLYZW6ZvvmXjnlpexJdSV0bomUeBpRo1nPSy54lvsNQ==",
|
|
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.16",
|
|
38
|
+
"integrity": "sha512-QG87aBbF+de82lTAO2H+opusoWhCZYQWU9RljYpsL766v/AivdVW2gZhLhdine60C6dNCEP7zPzeECUxHtmEGA==",
|
|
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.15",
|
|
46
|
+
"integrity": "sha512-96WxB2yo6ohakBtGH1l6unG86e3gR/8T40WNzqcN0P/tyytTkBLFu2+fLDFuHKM2SMViP3HWAwoqFSUE6yDDPQ==",
|
|
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.16",
|
|
54
|
+
"integrity": "sha512-rrDYU4ryQvFtb9XTpf5vDJ8EtGR+wtOqp3w8U+U/I4HL+LNSV8ckwtwNHC4bxhqhq3joi2KIdJQswUYkSJYLhA==",
|
|
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.16",
|
|
62
|
+
"integrity": "sha512-ezWTJn2FJdsbBuWfpuoEbcxnTFlZxIQRA70nKkqf9cCeSXnZCwij2lc+6Og1qeUfSmYnFHcrXicp8RV2mmXjPw==",
|
|
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.14",
|
|
70
|
+
"integrity": "sha512-/dzF1Pw6V2r4lsU1pCmAlAxjVWoX2LSlJ/zVj7nwM8yje90n9+/b17UX9ZSNVXQHs/h/6FH2uearnzM0iYDYxg==",
|
|
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.14",
|
|
78
|
+
"integrity": "sha512-Zt881ix9pgLQcyYl9r9HMRWld0pq2o4qi/k9L19ZmIWkDlaYavz6SZ5gocD8jYvzZPKMdA1RXu0Y/HWdYJXpXQ==",
|
|
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.11",
|
|
86
|
+
"integrity": "sha512-zmGyRObcS4aEOI1SZoHqMFbeBKvgNNVoYKYk+h69hMheYIiChe+oIXVedysxsXZisucpwzoDPRQ/un0gHIn2XA==",
|
|
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.36",
|
|
94
|
+
"integrity": "sha512-29vne4OcJDkOG0lq4AHEivdgFiAM7v+OnWhShDkLDfI0laet1jYRAglut+OqskoerOyi+gVTFGsBtid/dEuetg==",
|
|
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.17",
|
|
102
|
+
"integrity": "sha512-1cO8hRNz5mlArA+QxXkwr39Aluza0njOIyZidtI8wmX61eEuCxEiPv5W/+dBuUCatshwhjCGG+E0rB2udjliLA==",
|
|
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.16",
|
|
111
|
+
"integrity": "sha512-4jJ8uJ96d9Z1s30j9gDi+EKxgLyOctRw0rZXd20eSRW80/a+obmuSYPoZStuBxB7O+4SqF+dzGZxmBDlYRjWmA==",
|
|
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.3",
|
|
119
|
+
"integrity": "sha512-z4vqSFBZnh/Fh0/xHZ55Fw17cjb56i+Yfi8c5pmF5v4BTRCtEPp4416uyvisbLKBZ6oGjNMxI01UBddDXNntrg==",
|
|
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.6",
|
|
128
|
+
"integrity": "sha512-CNaziqin6RbmFGNesCoBTFcCLhko6DZBmUXsh6XcAoIE7cQvQBzjO8U4SsbGwBaLCQqKiaNrCxowAi3p/2zJVA==",
|
|
129
129
|
"required": false,
|
|
130
130
|
"builtin": true
|
|
131
131
|
}
|
|
@@ -15,7 +15,7 @@ import { type ModelPrice, type ModelPricePut, PricesService } from "../models/pr
|
|
|
15
15
|
import { ModelPurposesService, type PurposeListing, type PurposePut } from "../models/purposes.js";
|
|
16
16
|
import { type Member, MembersService } from "../orgs/members.service.js";
|
|
17
17
|
import { type Org, OrgsService } from "../orgs/orgs.service.js";
|
|
18
|
-
import { ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
18
|
+
import { type PlatformProviderState, ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
19
19
|
import { AccountListQuery, AccountParams, AdminOrgParams, CreateAccountBody, DeploymentSettingsBody, PurposeParams, UpdateAccountBody } from "./admin.schemas.js";
|
|
20
20
|
import { type LimitDefaults } from "./limit-defaults.js";
|
|
21
21
|
/**
|
|
@@ -81,7 +81,7 @@ export declare class AdminController {
|
|
|
81
81
|
* (the platform's disabled list, spec B §5.3).
|
|
82
82
|
*/
|
|
83
83
|
getModels(): Promise<{
|
|
84
|
-
providers: (ProviderStatus & {
|
|
84
|
+
providers: (ProviderStatus<PlatformProviderState> & {
|
|
85
85
|
displayName: LocalizedName | null;
|
|
86
86
|
icon: string | null;
|
|
87
87
|
})[];
|
|
@@ -28,7 +28,7 @@ import { purposeTargetOf } from "../models/purposes.controller.js";
|
|
|
28
28
|
import { ModelPurposesService, PurposePutDto, withDeclaredByNames, } from "../models/purposes.js";
|
|
29
29
|
import { MembersService } from "../orgs/members.service.js";
|
|
30
30
|
import { OrgsService } from "../orgs/orgs.service.js";
|
|
31
|
-
import { ProviderRegistry } from "../runtime/providers.js";
|
|
31
|
+
import { ProviderRegistry, } from "../runtime/providers.js";
|
|
32
32
|
import { AccountListQuery, AccountParams, AdminOrgParams, CreateAccountBody, DeploymentSettingsBody, PurposeParams, UpdateAccountBody, } from "./admin.schemas.js";
|
|
33
33
|
import { limitDefaults } from "./limit-defaults.js";
|
|
34
34
|
class AccountListQueryDto extends createZodDto(AccountListQuery, "AccountListQuery") {
|
|
@@ -18,6 +18,7 @@ import { TITLE_QUEUE } from "../conversations/titles.js";
|
|
|
18
18
|
import { EVAL_QUEUE_NAME } from "../evals/jobs.js";
|
|
19
19
|
import { LIFECYCLE_QUEUE } from "../extensions/lifecycle-hooks.js";
|
|
20
20
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
21
|
+
import { asPlatform } from "../infra/database/org-scope.js";
|
|
21
22
|
import { ReplicaPresence } from "../infra/presence/replica-presence.js";
|
|
22
23
|
import { KERNEL_LOGGER, REDIS } from "../infra/tokens.js";
|
|
23
24
|
import { PUSH_QUEUE } from "../push/jobs.js";
|
|
@@ -97,11 +98,10 @@ let AdminHealthService = class AdminHealthService {
|
|
|
97
98
|
];
|
|
98
99
|
}
|
|
99
100
|
async read() {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
]);
|
|
101
|
+
const redisRead = within(this.readRedis(), HEALTH_READ_TIMEOUT_MS);
|
|
102
|
+
// org-filter: deployment-wide counts of live channels, devices and sandbox instances
|
|
103
|
+
const dbRead = asPlatform("read deployment health counts", () => this.readDb());
|
|
104
|
+
const [r, d] = await Promise.allSettled([redisRead, within(dbRead, HEALTH_READ_TIMEOUT_MS)]);
|
|
105
105
|
const unavailable = [];
|
|
106
106
|
const redis = r.status === "fulfilled" ? r.value : null;
|
|
107
107
|
if (r.status === "rejected") {
|
|
@@ -8,7 +8,7 @@ import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
|
8
8
|
import { AccountsService } from "../identity/accounts.js";
|
|
9
9
|
import { PlatformInboxService } from "../inbox/platform-inbox.service.js";
|
|
10
10
|
import { OrgsService } from "../orgs/orgs.service.js";
|
|
11
|
-
import { ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
11
|
+
import { type PlatformProviderState, ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
12
12
|
import { QueueLostJobs } from "../runtime/queue-lost-jobs.js";
|
|
13
13
|
import { OutboxDeadService } from "./outbox-dead.service.js";
|
|
14
14
|
/** The most rows each attention list returns; the rest are counted in `more`. */
|
|
@@ -105,7 +105,7 @@ export interface AdminAttention {
|
|
|
105
105
|
/** The reason an extension is listed, or null when it needs nothing. */
|
|
106
106
|
export declare function extensionReason(e: Pick<AdminExtensionView, "status" | "configValid">): AttentionExtensionReason | null;
|
|
107
107
|
/** The problem of a provider in the platform view, or null (`org_configured` is not one). */
|
|
108
|
-
export declare function providerProblem(p: ProviderStatus): AttentionProviderProblem | null;
|
|
108
|
+
export declare function providerProblem(p: ProviderStatus<PlatformProviderState>): AttentionProviderProblem | null;
|
|
109
109
|
/**
|
|
110
110
|
* The admin overview (spec §4.1, §5.2): its numbers and the 待处理 lists, read live from the sources
|
|
111
111
|
* the admin pages read (`ExtensionAdmin`, the catalog, the provider registry's cached lists, the
|
|
@@ -17,7 +17,7 @@ import { AccountsService } from "../identity/accounts.js";
|
|
|
17
17
|
import { PlatformInboxService } from "../inbox/platform-inbox.service.js";
|
|
18
18
|
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
19
19
|
import { OrgsService } from "../orgs/orgs.service.js";
|
|
20
|
-
import { ProviderRegistry } from "../runtime/providers.js";
|
|
20
|
+
import { ProviderRegistry, } from "../runtime/providers.js";
|
|
21
21
|
import { QueueLostJobs } from "../runtime/queue-lost-jobs.js";
|
|
22
22
|
import { OutboxDeadService } from "./outbox-dead.service.js";
|
|
23
23
|
/** The most rows each attention list returns; the rest are counted in `more`. */
|
|
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { Module } from "@nestjs/common";
|
|
8
8
|
import { AttachmentsModule } from "../conversations/attachments.module.js";
|
|
9
|
+
import { DeviceProviderSelectionModule } from "../devices/device-provider-selection.module.js";
|
|
9
10
|
import { EvalBudgetModule } from "../evals/budget.js";
|
|
10
11
|
import { ExtensionsModule } from "../extensions/extensions.module.js";
|
|
11
12
|
import { LifecycleHooksModule } from "../extensions/lifecycle-hooks.js";
|
|
@@ -20,6 +21,7 @@ import { AgentLookupModule } from "./agent-lookup.js";
|
|
|
20
21
|
import { AgentProfileService } from "./agent-profile.service.js";
|
|
21
22
|
import { AgentsService } from "./agents.service.js";
|
|
22
23
|
import { AgentsFromTemplate } from "./from-template.service.js";
|
|
24
|
+
import { OnboardingChecklist } from "./onboarding-checklist.js";
|
|
23
25
|
import { OrgAgentTemplates } from "./org-templates.js";
|
|
24
26
|
import { PendingConnectorRequests } from "./pending-connector-requests.js";
|
|
25
27
|
import { PendingConnectorsService } from "./pending-connectors.service.js";
|
|
@@ -40,6 +42,7 @@ AgentsModule = __decorate([
|
|
|
40
42
|
Module({
|
|
41
43
|
imports: [
|
|
42
44
|
AgentLookupModule,
|
|
45
|
+
DeviceProviderSelectionModule,
|
|
43
46
|
// avatar uploads
|
|
44
47
|
AttachmentsModule,
|
|
45
48
|
OrgLockModule,
|
|
@@ -66,6 +69,7 @@ AgentsModule = __decorate([
|
|
|
66
69
|
PendingConnectorRequests,
|
|
67
70
|
PendingConnectorsService,
|
|
68
71
|
ReadinessService,
|
|
72
|
+
OnboardingChecklist,
|
|
69
73
|
],
|
|
70
74
|
exports: [
|
|
71
75
|
AgentLookupModule,
|
|
@@ -4,7 +4,7 @@ import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
|
4
4
|
import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
5
5
|
import { type Principal } from "../identity/principal.js";
|
|
6
6
|
import { type OrgContext } from "../orgs/org.guard.js";
|
|
7
|
-
import { type KernelModelInfo, ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
7
|
+
import { type KernelModelInfo, type OrgProviderState, ProviderRegistry, type ProviderStatus } from "../runtime/providers.js";
|
|
8
8
|
export declare const ModelsQuery: z.ZodObject<{
|
|
9
9
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
10
10
|
chat: "chat";
|
|
@@ -43,7 +43,7 @@ export declare class ModelsController {
|
|
|
43
43
|
* org's own list.
|
|
44
44
|
*/
|
|
45
45
|
catalog(principal: Principal, org: OrgContext): Promise<{
|
|
46
|
-
providers: (ProviderStatus & {
|
|
46
|
+
providers: (ProviderStatus<OrgProviderState> & {
|
|
47
47
|
displayName: LocalizedName | null;
|
|
48
48
|
icon: string | null;
|
|
49
49
|
})[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DeviceProviderSelection } from "../devices/device-provider-selection.js";
|
|
2
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
3
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
4
|
+
import { ToolRegistry } from "../tools/registry.js";
|
|
5
|
+
export interface OptionalReadiness {
|
|
6
|
+
members: boolean;
|
|
7
|
+
sandbox: boolean;
|
|
8
|
+
connectors: boolean;
|
|
9
|
+
channels: boolean;
|
|
10
|
+
skills: boolean;
|
|
11
|
+
connections: boolean;
|
|
12
|
+
device: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface OnboardingStatus {
|
|
15
|
+
optional: OptionalReadiness;
|
|
16
|
+
checklistDismissed: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** Read-only signals for the workspace checklist and its per-membership dismissal. */
|
|
19
|
+
export declare class OnboardingChecklist {
|
|
20
|
+
private readonly db;
|
|
21
|
+
readonly txHost: TransactionHost;
|
|
22
|
+
private readonly devices;
|
|
23
|
+
private readonly tools;
|
|
24
|
+
constructor(db: KernelDb, txHost: TransactionHost, devices: DeviceProviderSelection, tools: ToolRegistry);
|
|
25
|
+
get(orgId: string, viewer: string | null): Promise<OnboardingStatus>;
|
|
26
|
+
dismiss(orgId: string, viewer: string): Promise<void>;
|
|
27
|
+
private sandboxReady;
|
|
28
|
+
private personalSteps;
|
|
29
|
+
private adminSteps;
|
|
30
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
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 { sql } from "kysely";
|
|
12
|
+
import { DeviceProviderSelection } from "../devices/device-provider-selection.js";
|
|
13
|
+
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
14
|
+
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
15
|
+
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
16
|
+
import { can } from "../orgs/roles.js";
|
|
17
|
+
import { LOCAL_DEVICE_PROVIDER, servesDialIn } from "../sandbox/providers.js";
|
|
18
|
+
import { hasNonBuiltinSkill } from "../skills/usable.js";
|
|
19
|
+
import { connectorReady } from "../tools/connector-setup.js";
|
|
20
|
+
import { connectorCredentialExists } from "../tools/credentials.js";
|
|
21
|
+
import { ToolRegistry } from "../tools/registry.js";
|
|
22
|
+
const EMPTY_OPTIONAL = {
|
|
23
|
+
members: false,
|
|
24
|
+
sandbox: false,
|
|
25
|
+
connectors: false,
|
|
26
|
+
channels: false,
|
|
27
|
+
skills: false,
|
|
28
|
+
connections: false,
|
|
29
|
+
device: false,
|
|
30
|
+
};
|
|
31
|
+
/** Read-only signals for the workspace checklist and its per-membership dismissal. */
|
|
32
|
+
let OnboardingChecklist = class OnboardingChecklist {
|
|
33
|
+
db;
|
|
34
|
+
txHost;
|
|
35
|
+
devices;
|
|
36
|
+
tools;
|
|
37
|
+
constructor(db, txHost, devices, tools) {
|
|
38
|
+
this.db = db;
|
|
39
|
+
this.txHost = txHost;
|
|
40
|
+
this.devices = devices;
|
|
41
|
+
this.tools = tools;
|
|
42
|
+
}
|
|
43
|
+
async get(orgId, viewer) {
|
|
44
|
+
const empty = { optional: EMPTY_OPTIONAL, checklistDismissed: false };
|
|
45
|
+
if (viewer === null)
|
|
46
|
+
return empty;
|
|
47
|
+
const membership = await this.db
|
|
48
|
+
.selectFrom("memberships")
|
|
49
|
+
.select(["role", "checklist_dismissed"])
|
|
50
|
+
.where("org_id", "=", orgId)
|
|
51
|
+
.where("account_id", "=", viewer)
|
|
52
|
+
.executeTakeFirst();
|
|
53
|
+
if (!membership)
|
|
54
|
+
return empty;
|
|
55
|
+
const admin = can(membership.role, "org.invitations.manage");
|
|
56
|
+
const [personal, org, sandbox, skills] = await Promise.all([
|
|
57
|
+
this.personalSteps(orgId, viewer),
|
|
58
|
+
admin ? this.adminSteps(orgId, viewer) : undefined,
|
|
59
|
+
admin ? this.sandboxReady(orgId) : false,
|
|
60
|
+
can(membership.role, "skills.read") && hasNonBuiltinSkill(this.db.db, orgId),
|
|
61
|
+
]);
|
|
62
|
+
return {
|
|
63
|
+
optional: { ...EMPTY_OPTIONAL, ...org, ...personal, sandbox, skills },
|
|
64
|
+
checklistDismissed: membership.checklist_dismissed,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async dismiss(orgId, viewer) {
|
|
68
|
+
await this.db
|
|
69
|
+
.updateTable("memberships")
|
|
70
|
+
.set({ checklist_dismissed: true })
|
|
71
|
+
.where("org_id", "=", orgId)
|
|
72
|
+
.where("account_id", "=", viewer)
|
|
73
|
+
.where("checklist_dismissed", "=", false)
|
|
74
|
+
.execute();
|
|
75
|
+
}
|
|
76
|
+
async sandboxReady(orgId) {
|
|
77
|
+
const providers = await this.devices.onInOrg(orgId);
|
|
78
|
+
if (providers.some((provider) => !servesDialIn(provider)))
|
|
79
|
+
return true;
|
|
80
|
+
if (providers.length === 0)
|
|
81
|
+
return false;
|
|
82
|
+
return ((await this.db
|
|
83
|
+
.selectFrom("devices")
|
|
84
|
+
.select("id")
|
|
85
|
+
.where("org_id", "=", orgId)
|
|
86
|
+
.where("provider", "in", providers.map(({ plugin }) => plugin))
|
|
87
|
+
.where("deleted_at", "is", null)
|
|
88
|
+
.limit(1)
|
|
89
|
+
.executeTakeFirst()) !== undefined);
|
|
90
|
+
}
|
|
91
|
+
personalSteps(orgId, viewer) {
|
|
92
|
+
const db = this.db.db;
|
|
93
|
+
return db
|
|
94
|
+
.selectNoFrom((eb) => [
|
|
95
|
+
eb
|
|
96
|
+
.exists(db
|
|
97
|
+
.selectFrom("devices")
|
|
98
|
+
.select("id")
|
|
99
|
+
.where("org_id", "=", orgId)
|
|
100
|
+
.where("owner_kind", "=", "personal")
|
|
101
|
+
.where("owner_account_id", "=", viewer)
|
|
102
|
+
.where("provider", "=", LOCAL_DEVICE_PROVIDER)
|
|
103
|
+
.where("deleted_at", "is", null))
|
|
104
|
+
.$castTo()
|
|
105
|
+
.as("device"),
|
|
106
|
+
eb
|
|
107
|
+
.exists(db
|
|
108
|
+
.selectFrom("connectors as c")
|
|
109
|
+
.select("c.id")
|
|
110
|
+
.where("c.org_id", "=", orgId)
|
|
111
|
+
.where("c.deleted_at", "is", null)
|
|
112
|
+
.where(sql `c.auth->>'ownership'`, "=", "personal")
|
|
113
|
+
.where(({ ref }) => connectorCredentialExists(db, orgId, ref("c.id"), { accountId: viewer })))
|
|
114
|
+
.$castTo()
|
|
115
|
+
.as("connections"),
|
|
116
|
+
])
|
|
117
|
+
.executeTakeFirstOrThrow();
|
|
118
|
+
}
|
|
119
|
+
adminSteps(orgId, viewer) {
|
|
120
|
+
const db = this.db.db;
|
|
121
|
+
const kinds = this.tools.loadedConnectorKinds();
|
|
122
|
+
return db
|
|
123
|
+
.selectNoFrom((eb) => [
|
|
124
|
+
eb
|
|
125
|
+
.or([
|
|
126
|
+
eb.exists(db
|
|
127
|
+
.selectFrom("memberships")
|
|
128
|
+
.select("account_id")
|
|
129
|
+
.where("org_id", "=", orgId)
|
|
130
|
+
.where("account_id", "!=", viewer)),
|
|
131
|
+
eb.exists(db
|
|
132
|
+
.selectFrom("invitations")
|
|
133
|
+
.select("id")
|
|
134
|
+
.where("org_id", "=", orgId)
|
|
135
|
+
.where("accepted_at", "is", null)
|
|
136
|
+
.where("revoked_at", "is", null)
|
|
137
|
+
.where("expires_at", ">", sql `now()`)),
|
|
138
|
+
])
|
|
139
|
+
.$castTo()
|
|
140
|
+
.as("members"),
|
|
141
|
+
eb
|
|
142
|
+
.exists(db
|
|
143
|
+
.selectFrom("channel_connections")
|
|
144
|
+
.select("id")
|
|
145
|
+
.where("org_id", "=", orgId)
|
|
146
|
+
.where("deleted_at", "is", null))
|
|
147
|
+
.$castTo()
|
|
148
|
+
.as("channels"),
|
|
149
|
+
kinds.length === 0
|
|
150
|
+
? sql `false`.as("connectors")
|
|
151
|
+
: eb
|
|
152
|
+
.exists(db
|
|
153
|
+
.selectFrom("connectors as c")
|
|
154
|
+
.select("c.id")
|
|
155
|
+
.where("c.org_id", "=", orgId)
|
|
156
|
+
.where("c.deleted_at", "is", null)
|
|
157
|
+
.where("c.status", "=", "active")
|
|
158
|
+
.where("c.connector", "in", kinds)
|
|
159
|
+
.where(({ ref }) => connectorReady(db, orgId, ref("c.id"), ref("c.auth"))))
|
|
160
|
+
.$castTo()
|
|
161
|
+
.as("connectors"),
|
|
162
|
+
])
|
|
163
|
+
.executeTakeFirstOrThrow();
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
__decorate([
|
|
167
|
+
Transactional()
|
|
168
|
+
], OnboardingChecklist.prototype, "dismiss", null);
|
|
169
|
+
OnboardingChecklist = __decorate([
|
|
170
|
+
Injectable(),
|
|
171
|
+
__param(0, Inject(KernelDb)),
|
|
172
|
+
__param(1, Inject(TransactionHost)),
|
|
173
|
+
__param(2, Inject(DeviceProviderSelection)),
|
|
174
|
+
__param(3, Inject(ToolRegistry))
|
|
175
|
+
], OnboardingChecklist);
|
|
176
|
+
export { OnboardingChecklist };
|
|
@@ -7,8 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
8
8
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
9
|
};
|
|
10
|
-
import { Controller, Get, Inject } from "@nestjs/common";
|
|
11
|
-
import { CurrentPrincipal } from "../identity/principal.js";
|
|
10
|
+
import { Controller, Get, HttpCode, Inject, Post } from "@nestjs/common";
|
|
11
|
+
import { CurrentPrincipal, requireUser } from "../identity/principal.js";
|
|
12
12
|
import { CurrentOrg, OrgAction } from "../orgs/org.guard.js";
|
|
13
13
|
import { ReadinessService } from "./readiness.service.js";
|
|
14
14
|
/** Service tokens have no account: they see `visibility='org'` agents only (as the agent list). */
|
|
@@ -29,6 +29,9 @@ let ReadinessController = class ReadinessController {
|
|
|
29
29
|
get(principal, org) {
|
|
30
30
|
return this.readiness.get(org.orgId, viewerOf(principal));
|
|
31
31
|
}
|
|
32
|
+
dismiss(principal, org) {
|
|
33
|
+
return this.readiness.dismissChecklist(org.orgId, requireUser(principal).account.id);
|
|
34
|
+
}
|
|
32
35
|
};
|
|
33
36
|
__decorate([
|
|
34
37
|
Get(),
|
|
@@ -36,6 +39,13 @@ __decorate([
|
|
|
36
39
|
__param(0, CurrentPrincipal()),
|
|
37
40
|
__param(1, CurrentOrg())
|
|
38
41
|
], ReadinessController.prototype, "get", null);
|
|
42
|
+
__decorate([
|
|
43
|
+
Post("dismiss"),
|
|
44
|
+
OrgAction("org.onboarding.dismiss"),
|
|
45
|
+
HttpCode(204),
|
|
46
|
+
__param(0, CurrentPrincipal()),
|
|
47
|
+
__param(1, CurrentOrg())
|
|
48
|
+
], ReadinessController.prototype, "dismiss", null);
|
|
39
49
|
ReadinessController = __decorate([
|
|
40
50
|
Controller("api/v1/orgs/:orgId/readiness"),
|
|
41
51
|
__param(0, Inject(ReadinessService))
|
|
@@ -3,6 +3,7 @@ import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
|
3
3
|
import { OrgExtensionConfigs, type OrgExtensionView } from "../extensions/org-config.js";
|
|
4
4
|
import { type ListErrorKind, ProviderRegistry } from "../runtime/providers.js";
|
|
5
5
|
import { AgentsService } from "./agents.service.js";
|
|
6
|
+
import { OnboardingChecklist, type OnboardingStatus } from "./onboarding-checklist.js";
|
|
6
7
|
/**
|
|
7
8
|
* A model provider an org admin can make usable on `/settings/models`, and what it waits for:
|
|
8
9
|
* `not_enabled`, the org has not switched it on (it may also need the org's config then);
|
|
@@ -34,7 +35,7 @@ export type UnusableProvider = {
|
|
|
34
35
|
reason: "no_chat_models";
|
|
35
36
|
});
|
|
36
37
|
/** What `GET /orgs/:orgId/readiness` and the `agents.readiness` operation answer. */
|
|
37
|
-
export interface OrgReadiness {
|
|
38
|
+
export interface OrgReadiness extends OnboardingStatus {
|
|
38
39
|
/**
|
|
39
40
|
* `ready`: the org has a chat model an agent can pick (the agent form's list:
|
|
40
41
|
* `GET /orgs/:orgId/models?kind=chat`); `no_models`: providers are on with a valid config but
|
|
@@ -75,7 +76,9 @@ export declare class ReadinessService {
|
|
|
75
76
|
private readonly configs;
|
|
76
77
|
private readonly agents;
|
|
77
78
|
private readonly displayNames;
|
|
78
|
-
|
|
79
|
+
private readonly checklist;
|
|
80
|
+
constructor(registry: ProviderRegistry, configs: OrgExtensionConfigs, agents: AgentsService, displayNames: ExtensionDisplayNames, checklist: OnboardingChecklist);
|
|
79
81
|
get(orgId: string, viewer: string | null): Promise<OrgReadiness>;
|
|
82
|
+
dismissChecklist(orgId: string, viewer: string): Promise<void>;
|
|
80
83
|
private unusable;
|
|
81
84
|
}
|
|
@@ -13,6 +13,7 @@ import { ExtensionDisplayNames } from "../extensions/display-name.js";
|
|
|
13
13
|
import { OrgExtensionConfigs, providesOf, } from "../extensions/org-config.js";
|
|
14
14
|
import { ProviderRegistry } from "../runtime/providers.js";
|
|
15
15
|
import { AgentsService } from "./agents.service.js";
|
|
16
|
+
import { OnboardingChecklist } from "./onboarding-checklist.js";
|
|
16
17
|
const MODEL_PROVIDER = parseExtensionPoint(MODEL_PROVIDER_EXTENSION_POINT_V2).name;
|
|
17
18
|
const isModelProvider = (v) => providesOf(v).some((ref) => parseExtensionPoint(ref).name === MODEL_PROVIDER);
|
|
18
19
|
/** The org can fill the config the extension waits for: it has an overridable field. */
|
|
@@ -45,16 +46,19 @@ let ReadinessService = class ReadinessService {
|
|
|
45
46
|
configs;
|
|
46
47
|
agents;
|
|
47
48
|
displayNames;
|
|
48
|
-
|
|
49
|
+
checklist;
|
|
50
|
+
constructor(registry, configs, agents, displayNames, checklist) {
|
|
49
51
|
this.registry = registry;
|
|
50
52
|
this.configs = configs;
|
|
51
53
|
this.agents = agents;
|
|
52
54
|
this.displayNames = displayNames;
|
|
55
|
+
this.checklist = checklist;
|
|
53
56
|
}
|
|
54
57
|
async get(orgId, viewer) {
|
|
55
|
-
const [gate, visible] = await Promise.all([
|
|
58
|
+
const [gate, visible, checklist] = await Promise.all([
|
|
56
59
|
this.registry.hasProvider(orgId),
|
|
57
60
|
this.agents.listVisible(orgId, viewer),
|
|
61
|
+
this.checklist.get(orgId, viewer),
|
|
58
62
|
]);
|
|
59
63
|
const usability = gate ? await this.registry.chatUsability(orgId) : [];
|
|
60
64
|
if (usability.some((u) => u.state === "usable")) {
|
|
@@ -63,6 +67,7 @@ let ReadinessService = class ReadinessService {
|
|
|
63
67
|
orgFixableProviders: [],
|
|
64
68
|
unusableProviders: [],
|
|
65
69
|
agents: visible.length,
|
|
70
|
+
...checklist,
|
|
66
71
|
};
|
|
67
72
|
}
|
|
68
73
|
const views = await this.configs.list(orgId);
|
|
@@ -73,6 +78,7 @@ let ReadinessService = class ReadinessService {
|
|
|
73
78
|
orgFixableProviders: fixable,
|
|
74
79
|
unusableProviders: await this.unusable(usability, views),
|
|
75
80
|
agents: visible.length,
|
|
81
|
+
...checklist,
|
|
76
82
|
};
|
|
77
83
|
}
|
|
78
84
|
return {
|
|
@@ -80,8 +86,12 @@ let ReadinessService = class ReadinessService {
|
|
|
80
86
|
orgFixableProviders: fixable,
|
|
81
87
|
unusableProviders: [],
|
|
82
88
|
agents: visible.length,
|
|
89
|
+
...checklist,
|
|
83
90
|
};
|
|
84
91
|
}
|
|
92
|
+
dismissChecklist(orgId, viewer) {
|
|
93
|
+
return this.checklist.dismiss(orgId, viewer);
|
|
94
|
+
}
|
|
85
95
|
async unusable(usability, views) {
|
|
86
96
|
const byPlugin = new Map(views.map((v) => [v.plugin, v]));
|
|
87
97
|
const names = await this.displayNames.many(usability.map((u) => u.provider));
|
|
@@ -105,7 +115,8 @@ ReadinessService = __decorate([
|
|
|
105
115
|
__param(0, Inject(ProviderRegistry)),
|
|
106
116
|
__param(1, Inject(OrgExtensionConfigs)),
|
|
107
117
|
__param(2, Inject(AgentsService)),
|
|
108
|
-
__param(3, Inject(ExtensionDisplayNames))
|
|
118
|
+
__param(3, Inject(ExtensionDisplayNames)),
|
|
119
|
+
__param(4, Inject(OnboardingChecklist))
|
|
109
120
|
], ReadinessService);
|
|
110
121
|
export { ReadinessService };
|
|
111
122
|
function orgFixableOf(views) {
|