@capybara-hq/kernel 0.1.0-rc.84 → 0.1.0-rc.86
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.js +5 -0
- package/dist/admin/health.service.d.ts +2 -2
- package/dist/admin/health.service.js +10 -2
- package/dist/catalog/admin-catalog.controller.d.ts +2 -1
- package/dist/catalog/admin-catalog.controller.js +2 -1
- package/dist/catalog/catalog-content.d.ts +5 -15
- package/dist/catalog/catalog-content.js +5 -56
- package/dist/catalog/catalog-scope.service.d.ts +3 -3
- package/dist/catalog/catalog-scope.service.js +4 -3
- package/dist/catalog/catalog.module.d.ts +3 -1
- package/dist/catalog/catalog.module.js +14 -1
- package/dist/catalog/component-scope.service.d.ts +6 -1
- package/dist/catalog/component-scope.service.js +16 -2
- package/dist/catalog/job-ids.d.ts +29 -0
- package/dist/catalog/job-ids.js +29 -0
- package/dist/catalog/jobs.d.ts +12 -3
- package/dist/catalog/jobs.js +28 -7
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.controller.d.ts +2 -30
- package/dist/catalog/org-catalog.controller.js +3 -29
- package/dist/catalog/org-catalog.schemas.d.ts +9 -46
- package/dist/catalog/org-catalog.schemas.js +9 -23
- package/dist/catalog/org-catalog.service.js +14 -23
- package/dist/catalog/plugin-import.d.ts +21 -0
- package/dist/catalog/plugin-import.js +33 -3
- package/dist/catalog/plugin-install.d.ts +69 -76
- package/dist/catalog/plugin-install.js +156 -234
- package/dist/catalog/plugin-upgrade.d.ts +71 -11
- package/dist/catalog/plugin-upgrade.js +222 -43
- package/dist/catalog/scope-sync.d.ts +22 -20
- package/dist/catalog/scope-sync.js +57 -42
- package/dist/catalog/template-connector-ensure.d.ts +100 -0
- package/dist/catalog/template-connector-ensure.js +285 -0
- package/dist/catalog/template-connector-jobs.d.ts +28 -0
- package/dist/catalog/template-connector-jobs.js +54 -0
- package/dist/catalog/template-connector-reconcile.d.ts +44 -0
- package/dist/catalog/template-connector-reconcile.js +114 -0
- package/dist/catalog/template-connectors.processor.d.ts +32 -0
- package/dist/catalog/template-connectors.processor.js +101 -0
- package/dist/channels/cards.d.ts +7 -3
- package/dist/channels/cards.js +9 -4
- package/dist/channels/phrases.d.ts +10 -0
- package/dist/channels/phrases.js +10 -0
- package/dist/config/docs.js +1 -1
- package/dist/config/schema.d.ts +3 -0
- package/dist/config/schema.js +18 -12
- package/dist/ctx/create-ctx.d.ts +10 -1
- package/dist/ctx/create-ctx.js +42 -2
- package/dist/db/kernel-schema.d.ts +2 -1
- package/dist/device-access/device-access.module.d.ts +7 -0
- package/dist/device-access/device-access.module.js +41 -0
- package/dist/device-access/device-access.service.d.ts +142 -0
- package/dist/device-access/device-access.service.js +464 -0
- package/dist/device-access/token.d.ts +6 -0
- package/dist/device-access/token.js +6 -0
- package/dist/device-access/viewer-routes.d.ts +45 -0
- package/dist/device-access/viewer-routes.js +81 -0
- package/dist/device-access/viewer.d.ts +244 -0
- package/dist/device-access/viewer.js +844 -0
- package/dist/dial-in/access.d.ts +19 -0
- package/dist/dial-in/access.js +23 -0
- package/dist/dial-in/gateway.d.ts +48 -6
- package/dist/dial-in/gateway.js +145 -10
- package/dist/dial-in/keys.d.ts +7 -0
- package/dist/dial-in/keys.js +7 -0
- package/dist/dial-in/routes.d.ts +11 -3
- package/dist/dial-in/routes.js +15 -4
- package/dist/dial-in/streams.d.ts +58 -0
- package/dist/dial-in/streams.js +283 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +2 -0
- package/dist/extensions/host.d.ts +13 -1
- package/dist/extensions/host.js +20 -1
- package/dist/extensions/org-config.d.ts +6 -1
- package/dist/extensions/org-config.js +15 -2
- package/dist/extensions/permission-set.d.ts +15 -1
- package/dist/extensions/permission-set.js +13 -1
- package/dist/extensions/permission-view.d.ts +6 -4
- package/dist/extensions/permission-view.js +6 -1
- package/dist/git/gateway.js +3 -1
- package/dist/http/error.filter.js +2 -0
- package/dist/http/gateway-routes.d.ts +8 -4
- package/dist/http/gateway-routes.js +4 -3
- package/dist/infra/lock/lock.service.d.ts +5 -1
- package/dist/infra/lock/lock.service.js +10 -4
- package/dist/infra/outbox/registry.d.ts +28 -0
- package/dist/infra/outbox/registry.js +33 -0
- package/dist/infra/queue/queue-names.d.ts +1 -1
- package/dist/infra/queue/queue-names.js +2 -0
- package/dist/infra/throttler/named-throttlers.d.ts +3 -0
- package/dist/infra/throttler/named-throttlers.js +16 -0
- package/dist/kernel.module.js +3 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +8 -1
- package/dist/lifecycle/kernel-lifecycle.js +37 -11
- package/dist/orgs/org-owner.d.ts +7 -0
- package/dist/orgs/org-owner.js +16 -0
- package/dist/platform/operation.d.ts +3 -4
- package/dist/platform/ops/connectors.ops.js +8 -1
- package/dist/platform/ops/org-plugins.ops.d.ts +0 -9
- package/dist/platform/ops/org-plugins.ops.js +18 -235
- package/dist/platform/ops/plugins.ops.d.ts +0 -1
- package/dist/platform/ops/plugins.ops.js +3 -31
- package/dist/roles/gateway-role.d.ts +13 -6
- package/dist/roles/gateway-role.js +27 -9
- package/dist/roles/gateway.module.d.ts +2 -1
- package/dist/roles/gateway.module.js +13 -3
- package/dist/roles/worker-role.d.ts +9 -4
- package/dist/roles/worker-role.js +18 -5
- package/dist/roles/worker.module.d.ts +1 -1
- package/dist/roles/worker.module.js +8 -1
- package/dist/sandbox/device-services.d.ts +62 -0
- package/dist/sandbox/device-services.js +183 -0
- package/dist/sandbox/leases.d.ts +18 -1
- package/dist/sandbox/leases.js +75 -1
- package/dist/sandbox/network-grants.js +5 -2
- package/dist/sandbox/sandbox.module.d.ts +2 -1
- package/dist/sandbox/sandbox.module.js +5 -2
- package/dist/sandbox/sandbox.service.d.ts +44 -1
- package/dist/sandbox/sandbox.service.js +142 -5
- package/dist/setup/setup-guides.service.d.ts +9 -1
- package/dist/setup/setup-guides.service.js +38 -8
- package/dist/tools/admin-connectors.d.ts +3 -2
- package/dist/tools/admin-connectors.js +5 -4
- package/dist/tools/approvals.service.d.ts +45 -20
- package/dist/tools/approvals.service.js +19 -9
- package/dist/tools/call-scope.d.ts +60 -0
- package/dist/tools/call-scope.js +23 -0
- package/dist/tools/connector-setup.d.ts +28 -0
- package/dist/tools/connector-setup.js +33 -0
- package/dist/tools/connector-tools-jobs.d.ts +35 -0
- package/dist/tools/connector-tools-jobs.js +40 -0
- package/dist/tools/connector-tools.processor.d.ts +32 -0
- package/dist/tools/connector-tools.processor.js +97 -0
- package/dist/tools/connectors.controller.d.ts +1 -0
- package/dist/tools/connectors.schemas.d.ts +1 -0
- package/dist/tools/connectors.schemas.js +5 -0
- package/dist/tools/connectors.service.d.ts +138 -14
- package/dist/tools/connectors.service.js +410 -50
- package/dist/tools/credentials.d.ts +35 -0
- package/dist/tools/credentials.js +89 -1
- package/dist/tools/drift.d.ts +5 -0
- package/dist/tools/drift.js +21 -2
- package/dist/tools/editable-endpoint.d.ts +23 -0
- package/dist/tools/editable-endpoint.js +92 -0
- package/dist/tools/network-asks.d.ts +13 -0
- package/dist/tools/network-asks.js +26 -2
- package/dist/tools/oauth/flow.d.ts +1 -1
- package/dist/tools/oauth/flow.js +3 -2
- package/dist/tools/pipeline.d.ts +30 -1
- package/dist/tools/pipeline.js +299 -59
- package/dist/tools/questions.service.d.ts +24 -3
- package/dist/tools/questions.service.js +3 -1
- package/dist/tools/registry.d.ts +14 -2
- package/dist/tools/registry.js +27 -6
- package/dist/tools/tools.module.js +4 -0
- package/package.json +3 -3
- package/src/migrations/0183_connectors_created_by_nullable.sql +5 -0
package/dist/tools/registry.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { PersonFieldSpec } from "../platform/person-fields.js";
|
|
|
12
12
|
import type { ConversationKindForHooks } from "../runtime/hook-calls.js";
|
|
13
13
|
import type { ExecutionClaim } from "../runtime/run-execution.js";
|
|
14
14
|
import { BuiltinTools } from "./builtins/builtin-tools.js";
|
|
15
|
+
import { Credentials } from "./credentials.js";
|
|
15
16
|
import { OrgToolSwitches } from "./org-tool-switches.js";
|
|
16
17
|
export { BUILTIN_TOOL_NAMES } from "./builtin-names.js";
|
|
17
18
|
export { canonicalJson } from "./canonical-json.js";
|
|
@@ -347,8 +348,9 @@ export interface AgentTools {
|
|
|
347
348
|
* the org (`extension_org_configs.enabled`; required bootstrap plugins and builtin plugins'
|
|
348
349
|
* extensions are enabled in every org, `enabled.ts`), whose effective config for the org is valid (layering spec A §6) and that the
|
|
349
350
|
* org did not switch off (§7: the org's switch wins);
|
|
350
|
-
* - connector tools: every enabled tool of every live, active connector of the org
|
|
351
|
-
*
|
|
351
|
+
* - connector tools: every enabled tool of every live, active, `ready` connector of the org
|
|
352
|
+
* (a `needs_config` one offers none, plugin pages spec §5.2.1) whose connector extension is
|
|
353
|
+
* installed, with a valid key.
|
|
352
354
|
* What cannot be offered goes to `hidden` with the reason; nothing is reported to the model as
|
|
353
355
|
* unavailable except two sources with one key (the first wins).
|
|
354
356
|
*/
|
|
@@ -366,6 +368,11 @@ export declare class ToolRegistry {
|
|
|
366
368
|
private readonly effective;
|
|
367
369
|
/** The org's switches of single extension tools (layering spec A §7). */
|
|
368
370
|
private readonly switches;
|
|
371
|
+
/**
|
|
372
|
+
* The org inputs connectors need (plugin pages spec §5.2.1): a `needs_config` connector
|
|
373
|
+
* offers no tools.
|
|
374
|
+
*/
|
|
375
|
+
private readonly credentials;
|
|
369
376
|
/**
|
|
370
377
|
* `tools.searchThreshold*` and the sub-agent limits. Absent (some tests): `ToolSearch` is never
|
|
371
378
|
* offered and the sub-agent limits are the schema defaults.
|
|
@@ -383,6 +390,11 @@ export declare class ToolRegistry {
|
|
|
383
390
|
effective: Pick<EffectiveConfigs, "get">,
|
|
384
391
|
/** The org's switches of single extension tools (layering spec A §7). */
|
|
385
392
|
switches: Pick<OrgToolSwitches, "offKeys">,
|
|
393
|
+
/**
|
|
394
|
+
* The org inputs connectors need (plugin pages spec §5.2.1): a `needs_config` connector
|
|
395
|
+
* offers no tools.
|
|
396
|
+
*/
|
|
397
|
+
credentials: Pick<Credentials, "orgInputs">,
|
|
386
398
|
/**
|
|
387
399
|
* `tools.searchThreshold*` and the sub-agent limits. Absent (some tests): `ToolSearch` is never
|
|
388
400
|
* offered and the sub-agent limits are the schema defaults.
|
package/dist/tools/registry.js
CHANGED
|
@@ -24,6 +24,8 @@ import { AGENT_BUILTIN_NAMES, AGENT_TOOL, BASH_COMPANION_TOOLS, BUILTIN, SEND_ME
|
|
|
24
24
|
import { agentToolSpec } from "./builtins/agent.js";
|
|
25
25
|
import { BuiltinTools } from "./builtins/builtin-tools.js";
|
|
26
26
|
import { canonicalJson } from "./canonical-json.js";
|
|
27
|
+
import { connectorSetups } from "./connector-setup.js";
|
|
28
|
+
import { Credentials } from "./credentials.js";
|
|
27
29
|
import { toolKeyIssue } from "./naming.js";
|
|
28
30
|
import { OrgToolSwitches, toolTurnedOffReason } from "./org-tool-switches.js";
|
|
29
31
|
export { BUILTIN_TOOL_NAMES } from "./builtin-names.js";
|
|
@@ -98,8 +100,9 @@ const builtinTool = (b, spec) => ({
|
|
|
98
100
|
* the org (`extension_org_configs.enabled`; required bootstrap plugins and builtin plugins'
|
|
99
101
|
* extensions are enabled in every org, `enabled.ts`), whose effective config for the org is valid (layering spec A §6) and that the
|
|
100
102
|
* org did not switch off (§7: the org's switch wins);
|
|
101
|
-
* - connector tools: every enabled tool of every live, active connector of the org
|
|
102
|
-
*
|
|
103
|
+
* - connector tools: every enabled tool of every live, active, `ready` connector of the org
|
|
104
|
+
* (a `needs_config` one offers none, plugin pages spec §5.2.1) whose connector extension is
|
|
105
|
+
* installed, with a valid key.
|
|
103
106
|
* What cannot be offered goes to `hidden` with the reason; nothing is reported to the model as
|
|
104
107
|
* unavailable except two sources with one key (the first wins).
|
|
105
108
|
*/
|
|
@@ -110,6 +113,7 @@ let ToolRegistry = class ToolRegistry {
|
|
|
110
113
|
builtinTools;
|
|
111
114
|
effective;
|
|
112
115
|
switches;
|
|
116
|
+
credentials;
|
|
113
117
|
config;
|
|
114
118
|
constructor(db,
|
|
115
119
|
/** Extension tools and the organization's enabled extensions. */
|
|
@@ -123,6 +127,11 @@ let ToolRegistry = class ToolRegistry {
|
|
|
123
127
|
effective,
|
|
124
128
|
/** The org's switches of single extension tools (layering spec A §7). */
|
|
125
129
|
switches,
|
|
130
|
+
/**
|
|
131
|
+
* The org inputs connectors need (plugin pages spec §5.2.1): a `needs_config` connector
|
|
132
|
+
* offers no tools.
|
|
133
|
+
*/
|
|
134
|
+
credentials,
|
|
126
135
|
/**
|
|
127
136
|
* `tools.searchThreshold*` and the sub-agent limits. Absent (some tests): `ToolSearch` is never
|
|
128
137
|
* offered and the sub-agent limits are the schema defaults.
|
|
@@ -134,6 +143,7 @@ let ToolRegistry = class ToolRegistry {
|
|
|
134
143
|
this.builtinTools = builtinTools;
|
|
135
144
|
this.effective = effective;
|
|
136
145
|
this.switches = switches;
|
|
146
|
+
this.credentials = credentials;
|
|
137
147
|
this.config = config;
|
|
138
148
|
}
|
|
139
149
|
/** The kernel's builtin tools (`ToolSearch` is added by {@link forAgent}, not by definitions). */
|
|
@@ -458,8 +468,10 @@ let ToolRegistry = class ToolRegistry {
|
|
|
458
468
|
});
|
|
459
469
|
}
|
|
460
470
|
}
|
|
461
|
-
// connector tools: the org's live connectors
|
|
462
|
-
|
|
471
|
+
// connector tools: the org's live connectors, none from one that needs an org admin's input
|
|
472
|
+
const apps = await this.loadOrgConnectors(orgId, { includeDeleted: false });
|
|
473
|
+
const setups = await connectorSetups(this.credentials, orgId, apps);
|
|
474
|
+
for (const app of apps) {
|
|
463
475
|
if (disabled.some((r) => r.kind === "connector" && r.connectorId === app.id && r.tools === "all")) {
|
|
464
476
|
continue;
|
|
465
477
|
}
|
|
@@ -468,6 +480,13 @@ let ToolRegistry = class ToolRegistry {
|
|
|
468
480
|
hidden.push({ ref: all, reason: `App ${app.slug} is disabled` });
|
|
469
481
|
continue;
|
|
470
482
|
}
|
|
483
|
+
if (setups.get(app.id) !== "ready") {
|
|
484
|
+
hidden.push({
|
|
485
|
+
ref: all,
|
|
486
|
+
reason: `Connector ${app.slug} needs to be configured by an organization admin`,
|
|
487
|
+
});
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
471
490
|
if (!this.findConnector(app.connector)) {
|
|
472
491
|
hidden.push({
|
|
473
492
|
ref: all,
|
|
@@ -536,7 +555,7 @@ let ToolRegistry = class ToolRegistry {
|
|
|
536
555
|
async loadOrgConnectors(orgId, _opts) {
|
|
537
556
|
const apps = await this.db
|
|
538
557
|
.selectFrom("connectors")
|
|
539
|
-
.select(["id", "slug", "connector", "status"])
|
|
558
|
+
.select(["id", "slug", "connector", "auth", "status"])
|
|
540
559
|
.where("org_id", "=", orgId)
|
|
541
560
|
.where("deleted_at", "is", null)
|
|
542
561
|
.orderBy("slug")
|
|
@@ -563,6 +582,7 @@ let ToolRegistry = class ToolRegistry {
|
|
|
563
582
|
id: a.id,
|
|
564
583
|
slug: a.slug,
|
|
565
584
|
connector: a.connector,
|
|
585
|
+
auth: a.auth,
|
|
566
586
|
status: a.status,
|
|
567
587
|
tools: toolRows
|
|
568
588
|
.filter((t) => t.connector_id === a.id)
|
|
@@ -586,7 +606,8 @@ ToolRegistry = __decorate([
|
|
|
586
606
|
__param(3, Inject(BuiltinTools)),
|
|
587
607
|
__param(4, Inject(EffectiveConfigs)),
|
|
588
608
|
__param(5, Inject(OrgToolSwitches)),
|
|
589
|
-
__param(6, Inject(
|
|
609
|
+
__param(6, Inject(Credentials)),
|
|
610
|
+
__param(7, Inject(KernelConfigService))
|
|
590
611
|
], ToolRegistry);
|
|
591
612
|
export { ToolRegistry };
|
|
592
613
|
/**
|
|
@@ -40,6 +40,7 @@ import { ScheduleToolsPort, ScheduleUpdates } from "./builtins/schedules.js";
|
|
|
40
40
|
import { WebPages } from "./builtins/web/page-cache.js";
|
|
41
41
|
import { ConnectorAccountPolicies } from "./connector-account-policies.js";
|
|
42
42
|
import { ConnectorContent } from "./connector-content.js";
|
|
43
|
+
import { ConnectorToolsQueueModule } from "./connector-tools-jobs.js";
|
|
43
44
|
import { ConnectorsService } from "./connectors.service.js";
|
|
44
45
|
import { CredentialsModule } from "./credentials.module.js";
|
|
45
46
|
import { ToolDrift } from "./drift.js";
|
|
@@ -101,6 +102,9 @@ ToolsModule = __decorate([
|
|
|
101
102
|
// the `Platform` tool's operations, actor facts and agent docs (imports no domain module)
|
|
102
103
|
PlatformModule,
|
|
103
104
|
QueueModule.registerQueue(MAINTENANCE_QUEUE_NAME),
|
|
105
|
+
// the connector tool listings owed after a create or a setup (consumer: the worker role's
|
|
106
|
+
// ConnectorToolsProcessor)
|
|
107
|
+
ConnectorToolsQueueModule,
|
|
104
108
|
// a trial run's approvals become its scheduled task's grants (scheduled tasks spec §7)
|
|
105
109
|
ScheduledTaskStoreModule,
|
|
106
110
|
// connector credentials (also the git gateway's, without importing this module)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capybara-hq/kernel",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.86",
|
|
4
4
|
"description": "Capybara kernel: config, database, plugin host and HTTP API of the Capybara agent platform",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"yaml": "^2.9.1",
|
|
67
67
|
"yauzl": "3.4.0",
|
|
68
68
|
"zod": "^4.6.7",
|
|
69
|
-
"@capybara-hq/plugin-sdk": "^0.1.0-rc.
|
|
69
|
+
"@capybara-hq/plugin-sdk": "^0.1.0-rc.70"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@langchain/langgraph-checkpoint-validation": "^1.2.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@types/ws": "^8.18.2",
|
|
76
76
|
"@types/yauzl": "3.4.0",
|
|
77
77
|
"ws": "^8.22.0",
|
|
78
|
-
"@capybara-hq/testing": "0.1.0-rc.
|
|
78
|
+
"@capybara-hq/testing": "0.1.0-rc.40"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"build": "tsc -b"
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
-- Plugin pages spec §5.2.1 (ruling R17): the kernel creates template connectors as no person (a
|
|
2
|
+
-- plugin scope sync, the startup reconciliation), so such a connector has no creator. Relaxing NOT
|
|
3
|
+
-- NULL is expand-only: rows written before keep their creator, and dropping NOT NULL on a nullable
|
|
4
|
+
-- column is a no-op.
|
|
5
|
+
ALTER TABLE connectors ALTER COLUMN created_by DROP NOT NULL;
|