@capybara-hq/kernel 0.1.0-rc.77 → 0.1.0-rc.79
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 +6 -6
- package/dist/admin/outbox-dead.service.js +4 -1
- package/dist/agents/admin-agents.js +2 -0
- package/dist/agents/agent-lookup.js +4 -0
- package/dist/agents/agent-profile.service.js +3 -0
- package/dist/agents/agents.service.js +7 -0
- package/dist/agents/org-templates.js +1 -0
- package/dist/agents/pending-connector-requests.js +6 -0
- package/dist/agents/pending-connectors.service.js +2 -0
- package/dist/agents/readiness.service.d.ts +9 -3
- package/dist/agents/readiness.service.js +3 -3
- package/dist/agents/templates.js +1 -0
- package/dist/background/finish.js +3 -0
- package/dist/background/stop.js +2 -0
- package/dist/background/store.js +44 -0
- package/dist/background/tasks.service.js +3 -2
- package/dist/background/wake-rules.js +1 -0
- package/dist/catalog/admin-catalog.controller.d.ts +6 -0
- package/dist/catalog/admin-catalog.controller.js +13 -0
- package/dist/catalog/catalog-content.d.ts +9 -0
- package/dist/catalog/catalog-content.js +3 -1
- package/dist/catalog/catalog-items.js +4 -0
- package/dist/catalog/catalog-scope.service.js +4 -1
- package/dist/catalog/component-promotion.js +2 -0
- package/dist/catalog/component-scope.controller.d.ts +9 -15
- package/dist/catalog/component-scope.controller.js +14 -9
- package/dist/catalog/component-scope.service.js +5 -0
- package/dist/catalog/component-state.d.ts +4 -1
- package/dist/catalog/component-state.js +4 -2
- package/dist/catalog/marketplace-fetch.d.ts +1 -1
- package/dist/catalog/marketplace-fetch.js +1 -1
- package/dist/catalog/marketplaces.service.d.ts +6 -1
- package/dist/catalog/marketplaces.service.js +8 -3
- package/dist/catalog/org-catalog.controller.d.ts +9 -0
- package/dist/catalog/org-catalog.controller.js +18 -0
- package/dist/catalog/org-catalog.schemas.d.ts +2 -4
- package/dist/catalog/org-catalog.schemas.js +2 -3
- package/dist/catalog/org-catalog.service.d.ts +10 -1
- package/dist/catalog/org-catalog.service.js +34 -23
- package/dist/catalog/org-extension-switch.d.ts +3 -10
- package/dist/catalog/org-extension-switch.js +14 -60
- package/dist/catalog/org-extension.controller.d.ts +6 -7
- package/dist/catalog/org-extension.controller.js +4 -4
- package/dist/catalog/org-extension.schemas.d.ts +1 -2
- package/dist/catalog/org-extension.schemas.js +1 -3
- package/dist/catalog/owned-items.js +10 -1
- package/dist/catalog/ownership.js +2 -0
- package/dist/catalog/plugin-import.d.ts +3 -0
- package/dist/catalog/plugin-import.js +10 -1
- package/dist/catalog/plugin-install.d.ts +1 -4
- package/dist/catalog/plugin-install.js +11 -12
- package/dist/catalog/plugin-upgrade.js +4 -1
- package/dist/catalog/request-rules.js +6 -0
- package/dist/catalog/requests.service.js +4 -0
- package/dist/catalog/scope-orgs.js +1 -0
- package/dist/catalog/scope-sync.d.ts +8 -5
- package/dist/catalog/scope-sync.js +21 -23
- package/dist/catalog/template-description.d.ts +17 -0
- package/dist/catalog/template-description.js +18 -0
- package/dist/catalog/unshare.js +3 -0
- package/dist/channels/connections.service.js +1 -0
- package/dist/channels/inbound.js +1 -0
- package/dist/channels/jobs.js +1 -0
- package/dist/channels/outbound.js +6 -0
- package/dist/channels/supervisor.js +1 -0
- package/dist/channels/threads.js +1 -0
- package/dist/client/client-reports.service.js +1 -0
- package/dist/config/fields.js +20 -4
- package/dist/config/schema.d.ts +1 -1
- package/dist/config/schema.js +13 -13
- package/dist/conversations/access.js +1 -0
- package/dist/conversations/attachments.service.js +16 -4
- package/dist/conversations/conversations.service.js +17 -3
- package/dist/conversations/event-log.js +2 -0
- package/dist/conversations/events.d.ts +1 -0
- package/dist/conversations/events.js +3 -1
- package/dist/conversations/files.js +3 -2
- package/dist/conversations/permission-profiles.service.js +1 -0
- package/dist/conversations/prompt-suggestions.js +2 -0
- package/dist/conversations/queue.js +8 -0
- package/dist/conversations/queue.service.js +6 -2
- package/dist/conversations/source.js +2 -0
- package/dist/conversations/titles.js +10 -2
- package/dist/conversations/tree.js +6 -0
- package/dist/db/kernel-schema.d.ts +5 -1
- package/dist/devices/conversation-devices.js +3 -0
- package/dist/devices/device-projects.service.js +2 -0
- package/dist/devices/devices.service.js +5 -0
- package/dist/devices/legacy-cleanup.job.js +5 -2
- package/dist/dial-in/handlers.js +2 -0
- package/dist/dial-in/machines.js +11 -2
- package/dist/dial-in/targets.d.ts +0 -2
- package/dist/dial-in/targets.js +0 -10
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/evals/budget.js +14 -1
- package/dist/evals/run-replay.js +4 -0
- package/dist/evals/runs.service.js +13 -7
- package/dist/evals/sets.service.js +23 -8
- package/dist/evals/trajectory.service.d.ts +1 -1
- package/dist/evals/trajectory.service.js +1 -0
- package/dist/evals/worker.js +5 -1
- package/dist/extensions/admin-ops.js +1 -0
- package/dist/extensions/admin-view.js +3 -1
- package/dist/extensions/bootstrap-packages.d.ts +12 -1
- package/dist/extensions/bootstrap-packages.js +49 -9
- package/dist/extensions/bootstrap.d.ts +17 -2
- package/dist/extensions/bootstrap.js +41 -9
- package/dist/extensions/config-json-schema.d.ts +2 -2
- package/dist/extensions/config-json-schema.js +1 -3
- package/dist/extensions/deployment-config.d.ts +5 -3
- package/dist/extensions/deployment-config.js +3 -3
- package/dist/extensions/effective-config.d.ts +8 -7
- package/dist/extensions/effective-config.js +8 -7
- package/dist/extensions/enabled.js +1 -0
- package/dist/extensions/host.d.ts +4 -3
- package/dist/extensions/host.js +11 -12
- package/dist/extensions/instance.d.ts +1 -1
- package/dist/extensions/instance.js +17 -2
- package/dist/extensions/org-config.d.ts +35 -97
- package/dist/extensions/org-config.js +48 -315
- package/dist/extensions/org-levels.d.ts +22 -9
- package/dist/extensions/org-levels.js +100 -20
- package/dist/extensions/org-overrides.d.ts +14 -15
- package/dist/extensions/org-overrides.js +20 -20
- package/dist/extensions/package.js +1 -1
- package/dist/extensions/permission-set.d.ts +1 -3
- package/dist/extensions/permission-set.js +3 -7
- package/dist/extensions/permission-view.d.ts +3 -1
- package/dist/extensions/permission-view.js +5 -4
- package/dist/extensions/plugin-icons.d.ts +80 -1
- package/dist/extensions/plugin-icons.js +211 -2
- package/dist/extensions/point-defaults.d.ts +17 -18
- package/dist/extensions/point-defaults.js +25 -28
- package/dist/git/gateway.js +1 -1
- package/dist/git/identity.d.ts +1 -1
- package/dist/git/identity.js +2 -2
- package/dist/identity/accounts.js +6 -0
- package/dist/identity/api-tokens.js +8 -0
- package/dist/infra/outbox/outbox.dispatcher.js +4 -1
- package/dist/infra/outbox/outbox.service.js +2 -0
- package/dist/net/public-address.d.ts +3 -3
- package/dist/net/public-address.js +3 -3
- package/dist/orgs/directory-sync.d.ts +9 -6
- package/dist/orgs/directory-sync.js +15 -12
- package/dist/orgs/invitations.service.js +2 -0
- package/dist/orgs/members.service.js +2 -0
- package/dist/orgs/offboarding.js +2 -0
- package/dist/packages/npm.d.ts +10 -2
- package/dist/packages/npm.js +38 -6
- package/dist/platform/exclusions.js +20 -0
- package/dist/platform/ops/admin-items.ops.js +1 -0
- package/dist/platform/ops/agents.ops.js +1 -0
- package/dist/platform/ops/connectors.ops.js +7 -1
- package/dist/platform/ops/extensions.ops.d.ts +6 -8
- package/dist/platform/ops/extensions.ops.js +18 -97
- package/dist/platform/ops/org-plugins.ops.d.ts +3 -6
- package/dist/platform/ops/org-plugins.ops.js +14 -65
- package/dist/platform/ops/outbox.ops.js +1 -0
- package/dist/platform/ops/person-inputs.d.ts +0 -4
- package/dist/platform/ops/person-inputs.js +0 -8
- package/dist/platform/ops/plugins.ops.d.ts +4 -1
- package/dist/platform/ops/plugins.ops.js +27 -34
- package/dist/platform/person-fields.d.ts +1 -1
- package/dist/platform/person-fields.js +1 -1
- package/dist/platform/sealed-reveals.js +2 -0
- package/dist/push/recipients.js +9 -2
- package/dist/runtime/permission-context.service.js +1 -0
- package/dist/runtime/plugin-context.service.js +1 -0
- package/dist/runtime/project/knowledge.service.js +1 -0
- package/dist/runtime/run-context.service.js +1 -0
- package/dist/runtime/run-deletion.js +4 -0
- package/dist/runtime/run-execution.js +2 -0
- package/dist/runtime/run-finish.js +3 -0
- package/dist/runtime/run-jobs.js +3 -0
- package/dist/runtime/run-orphan-check.job.js +7 -0
- package/dist/runtime/run-queue.js +21 -2
- package/dist/runtime/run-worker.js +5 -0
- package/dist/runtime/step-log.js +1 -0
- package/dist/runtime/subagents/child.js +2 -0
- package/dist/runtime/subagents/deliveries.js +3 -0
- package/dist/runtime/subagents/dispatch.js +5 -1
- package/dist/runtime/subagents/messages.js +2 -0
- package/dist/runtime/subagents/org-agents.d.ts +1 -1
- package/dist/runtime/subagents/org-agents.js +2 -1
- package/dist/runtime/usage-report-jobs.js +1 -0
- package/dist/runtime/usage-report.js +3 -0
- package/dist/runtime/waits.js +5 -0
- package/dist/sandbox/cloud-permission-snapshot.js +9 -3
- package/dist/sandbox/device-reports.js +3 -0
- package/dist/sandbox/legacy-retirement.js +5 -1
- package/dist/sandbox/managed-device-context.js +1 -0
- package/dist/sandbox/modes.d.ts +5 -2
- package/dist/sandbox/modes.js +8 -4
- package/dist/sandbox/network-grants.js +2 -0
- package/dist/sandbox/operation-intents.js +58 -0
- package/dist/sandbox/operation-reconcile.job.js +2 -0
- package/dist/sandbox/permission-authority-lock.js +12 -6
- package/dist/sandbox/permission-call-grants.js +6 -0
- package/dist/sandbox/permission-ceiling-writes.js +5 -0
- package/dist/sandbox/permission-config-publication.js +5 -0
- package/dist/sandbox/permission-instance-writes.js +4 -0
- package/dist/sandbox/permission-runtime-reports.js +10 -1
- package/dist/sandbox/permission-transitions.js +3 -0
- package/dist/sandbox/review/review.service.js +8 -5
- package/dist/sandbox/sandbox.service.d.ts +14 -0
- package/dist/sandbox/sandbox.service.js +195 -29
- package/dist/sandbox/unreachable.js +4 -1
- package/dist/schedules/fire.js +9 -3
- package/dist/schedules/pause.js +2 -0
- package/dist/schedules/run-tracker.js +16 -1
- package/dist/schedules/scheduled-tasks.service.js +4 -2
- package/dist/schedules/store.js +8 -0
- package/dist/schedules/unattended.js +4 -0
- package/dist/setup/setup-checks.service.d.ts +1 -10
- package/dist/setup/setup-checks.service.js +19 -29
- package/dist/shares/share-open.service.js +1 -0
- package/dist/shares/shares.service.js +2 -0
- package/dist/skills/agent-skills.service.d.ts +1 -1
- package/dist/skills/agent-skills.service.js +13 -2
- package/dist/skills/catalog.js +3 -0
- package/dist/skills/changes.service.js +10 -2
- package/dist/skills/conversation-catalog.js +1 -0
- package/dist/skills/skills.service.js +4 -0
- package/dist/tools/approvals.service.js +40 -0
- package/dist/tools/builtins/schedules.js +11 -6
- package/dist/tools/builtins/web/fetch.js +1 -1
- package/dist/tools/builtins/web/search.js +1 -1
- package/dist/tools/connector-account-policies.js +3 -0
- package/dist/tools/connectors.controller.d.ts +37 -9
- package/dist/tools/connectors.controller.js +47 -12
- package/dist/tools/connectors.schemas.d.ts +4 -0
- package/dist/tools/connectors.schemas.js +13 -1
- package/dist/tools/connectors.service.d.ts +17 -0
- package/dist/tools/connectors.service.js +36 -2
- package/dist/tools/drift.js +5 -0
- package/dist/tools/git-push-policy.js +3 -0
- package/dist/tools/oauth/discovery.d.ts +2 -2
- package/dist/tools/oauth/discovery.js +2 -2
- package/dist/tools/oauth/flow.js +1 -0
- package/dist/tools/outputs.js +2 -0
- package/dist/tools/permission-approval-jobs.js +3 -0
- package/dist/tools/pipeline.js +2 -0
- package/dist/tools/policy.js +3 -0
- package/dist/tools/questions.service.js +13 -0
- package/package.json +3 -3
- package/src/migrations/0181_connector_description.sql +3 -0
|
@@ -277,6 +277,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
277
277
|
.selectFrom("conversations")
|
|
278
278
|
.select("id")
|
|
279
279
|
.where("id", "=", input.conversationId)
|
|
280
|
+
.where("org_id", "=", input.orgId)
|
|
280
281
|
.forUpdate()
|
|
281
282
|
.execute();
|
|
282
283
|
await t
|
|
@@ -306,6 +307,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
306
307
|
const row = await t
|
|
307
308
|
.selectFrom("approvals")
|
|
308
309
|
.selectAll()
|
|
310
|
+
.where("org_id", "=", input.orgId)
|
|
309
311
|
.where("run_id", "=", input.runId)
|
|
310
312
|
.where("call_id", "=", input.callId)
|
|
311
313
|
.where("attempt", "=", input.attempt ?? 1)
|
|
@@ -359,6 +361,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
359
361
|
.selectFrom("conversations")
|
|
360
362
|
.select("id")
|
|
361
363
|
.where("id", "=", input.conversationId)
|
|
364
|
+
.where("org_id", "=", input.orgId)
|
|
362
365
|
.forUpdate()
|
|
363
366
|
.execute();
|
|
364
367
|
const detail = { personFields: input.personFields, target: input.target };
|
|
@@ -391,6 +394,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
391
394
|
const row = await t
|
|
392
395
|
.selectFrom("approvals")
|
|
393
396
|
.selectAll()
|
|
397
|
+
.where("org_id", "=", input.orgId)
|
|
394
398
|
.where("run_id", "=", input.runId)
|
|
395
399
|
.where("call_id", "=", input.callId)
|
|
396
400
|
.where("attempt", "=", input.attempt)
|
|
@@ -457,6 +461,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
457
461
|
.selectFrom("conversations")
|
|
458
462
|
.select("id")
|
|
459
463
|
.where("id", "=", input.conversationId)
|
|
464
|
+
.where("org_id", "=", input.orgId)
|
|
460
465
|
.forUpdate()
|
|
461
466
|
.execute();
|
|
462
467
|
// only the device's owner is ever asked: never another account the caller names
|
|
@@ -470,6 +475,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
470
475
|
const last = await t
|
|
471
476
|
.selectFrom("approvals")
|
|
472
477
|
.select(sql `max(attempt)`.as("attempt"))
|
|
478
|
+
.where("org_id", "=", input.orgId)
|
|
473
479
|
.where("run_id", "=", input.runId)
|
|
474
480
|
.where("call_id", "=", input.callId)
|
|
475
481
|
.executeTakeFirst();
|
|
@@ -552,6 +558,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
552
558
|
.selectFrom("conversations")
|
|
553
559
|
.select("id")
|
|
554
560
|
.where("id", "=", input.conversationId)
|
|
561
|
+
.where("org_id", "=", input.orgId)
|
|
555
562
|
.forUpdate()
|
|
556
563
|
.execute();
|
|
557
564
|
// only a member of the org is asked, and only about a live connector of the org
|
|
@@ -572,6 +579,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
572
579
|
const last = await t
|
|
573
580
|
.selectFrom("approvals")
|
|
574
581
|
.select(sql `max(attempt)`.as("attempt"))
|
|
582
|
+
.where("org_id", "=", input.orgId)
|
|
575
583
|
.where("run_id", "=", input.runId)
|
|
576
584
|
.where("call_id", "=", input.callId)
|
|
577
585
|
.executeTakeFirst();
|
|
@@ -668,6 +676,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
668
676
|
.selectFrom("conversations")
|
|
669
677
|
.select("id")
|
|
670
678
|
.where("id", "=", input.conversationId)
|
|
679
|
+
.where("org_id", "=", input.orgId)
|
|
671
680
|
.forUpdate()
|
|
672
681
|
.execute();
|
|
673
682
|
// only the device's owner is ever asked: never another account the caller names
|
|
@@ -685,6 +694,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
685
694
|
const last = await t
|
|
686
695
|
.selectFrom("approvals")
|
|
687
696
|
.select(sql `max(attempt)`.as("attempt"))
|
|
697
|
+
.where("org_id", "=", input.orgId)
|
|
688
698
|
.where("run_id", "=", input.runId)
|
|
689
699
|
.where("call_id", "=", input.callId)
|
|
690
700
|
.executeTakeFirst();
|
|
@@ -1216,6 +1226,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1216
1226
|
}),
|
|
1217
1227
|
})
|
|
1218
1228
|
.where("id", "=", id)
|
|
1229
|
+
.where("org_id", "=", orgId)
|
|
1219
1230
|
.execute();
|
|
1220
1231
|
return { leaked };
|
|
1221
1232
|
}
|
|
@@ -1277,6 +1288,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1277
1288
|
}),
|
|
1278
1289
|
})
|
|
1279
1290
|
.where("id", "=", id)
|
|
1291
|
+
.where("org_id", "=", orgId)
|
|
1280
1292
|
.returningAll()
|
|
1281
1293
|
.executeTakeFirstOrThrow();
|
|
1282
1294
|
if (approved && before.command?.permissionCandidate) {
|
|
@@ -1483,6 +1495,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1483
1495
|
.leftJoin("agent_versions as v", (j) => j.onRef("v.agent_id", "=", "ag.id").onRef("v.version", "=", "ag.current_version"))
|
|
1484
1496
|
.select(["s.account_id", "v.definition"])
|
|
1485
1497
|
.where("s.id", "=", served.taskId)
|
|
1498
|
+
.where("s.org_id", "=", a.orgId)
|
|
1486
1499
|
.where("s.deleted_at", "is", null)
|
|
1487
1500
|
.executeTakeFirst();
|
|
1488
1501
|
if (task?.account_id !== decidedBy)
|
|
@@ -1612,6 +1625,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1612
1625
|
* 详情,不做处理人校验(内核内部用:渠道出站投递组装 IM 审批卡片);不存在返回 null。
|
|
1613
1626
|
* 不得直接回给请求方——HTTP 接口用 {@link get}。
|
|
1614
1627
|
*/
|
|
1628
|
+
// org-filter: approvalId comes from an approval event payload in the conversation's own event
|
|
1629
|
+
// log (channel outbound cards), kernel-written, never caller input
|
|
1615
1630
|
async describe(id) {
|
|
1616
1631
|
const row = await this.db
|
|
1617
1632
|
.selectFrom("approvals")
|
|
@@ -1624,6 +1639,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1624
1639
|
return view ?? null;
|
|
1625
1640
|
}
|
|
1626
1641
|
/** 某个工具调用最近一次的工具审批(attempt 最大者,网络询问除外);没有则返回 null。 */
|
|
1642
|
+
// org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
|
|
1643
|
+
// never caller input
|
|
1627
1644
|
async forCall(runId, callId) {
|
|
1628
1645
|
const row = await this.db
|
|
1629
1646
|
.selectFrom("approvals")
|
|
@@ -1637,6 +1654,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1637
1654
|
return row ? toRecord(row) : null;
|
|
1638
1655
|
}
|
|
1639
1656
|
/** The latest secure input request of a tool call (highest attempt); null when it has none. */
|
|
1657
|
+
// org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
|
|
1658
|
+
// never caller input
|
|
1640
1659
|
async secureInputForCall(runId, callId) {
|
|
1641
1660
|
const row = await this.db
|
|
1642
1661
|
.selectFrom("approvals")
|
|
@@ -1650,6 +1669,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1650
1669
|
return row ? toRecord(row) : null;
|
|
1651
1670
|
}
|
|
1652
1671
|
/** The network ask of a tool call (at most one per call); null when it has none. */
|
|
1672
|
+
// org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
|
|
1673
|
+
// never caller input
|
|
1653
1674
|
async networkForCall(runId, callId) {
|
|
1654
1675
|
const row = await this.db
|
|
1655
1676
|
.selectFrom("approvals")
|
|
@@ -1663,6 +1684,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1663
1684
|
return row ? toRecord(row) : null;
|
|
1664
1685
|
}
|
|
1665
1686
|
/** The git push ask of a tool call (at most one per call); null when it has none. */
|
|
1687
|
+
// org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
|
|
1688
|
+
// never caller input
|
|
1666
1689
|
async gitForCall(runId, callId) {
|
|
1667
1690
|
const row = await this.db
|
|
1668
1691
|
.selectFrom("approvals")
|
|
@@ -1676,6 +1699,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1676
1699
|
return row ? toRecord(row) : null;
|
|
1677
1700
|
}
|
|
1678
1701
|
/** The command review ask of a tool call (at most one per call); null when it has none. */
|
|
1702
|
+
// org-filter: runId is the runtime's own run (a uuid) whose call the tool pipeline is handling;
|
|
1703
|
+
// never caller input
|
|
1679
1704
|
async commandForCall(runId, callId) {
|
|
1680
1705
|
const row = await this.db
|
|
1681
1706
|
.selectFrom("approvals")
|
|
@@ -1700,6 +1725,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1700
1725
|
}
|
|
1701
1726
|
return r.record ? { outcome: r.outcome, record: r.record } : { outcome: r.outcome };
|
|
1702
1727
|
}
|
|
1728
|
+
// org-filter: id is the approval of the kernel-written timeout job payload (Waits), not caller input
|
|
1703
1729
|
async expireIn(id) {
|
|
1704
1730
|
const t = this.db.db;
|
|
1705
1731
|
if (!(await this.lockConversationOf(id)))
|
|
@@ -1731,6 +1757,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1731
1757
|
* 在调用方的事务内(`mandatory`)取消运行的全部 pending 审批(运行在等待中被中止),各写
|
|
1732
1758
|
* `approval_decided{cancelled}`(处理人为 null)。返回被取消的记录;调用方提交后发布事件。
|
|
1733
1759
|
*/
|
|
1760
|
+
// org-filter: runId is the run the kernel is stopping or finishing (Waits, RunFinish), not caller
|
|
1761
|
+
// input
|
|
1734
1762
|
async cancelPendingIn(runId) {
|
|
1735
1763
|
const t = this.db.db;
|
|
1736
1764
|
const rows = await t
|
|
@@ -1802,6 +1830,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1802
1830
|
.updateTable("approvals")
|
|
1803
1831
|
.set({ status: "cancelled", decided_at: sql `now()` })
|
|
1804
1832
|
.where("id", "=", row.id)
|
|
1833
|
+
.where("org_id", "=", orgId)
|
|
1805
1834
|
.returningAll()
|
|
1806
1835
|
.executeTakeFirstOrThrow();
|
|
1807
1836
|
const seq = await this.decidedEvent(toRecord(row), "cancelled");
|
|
@@ -1823,6 +1852,9 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1823
1852
|
* and emits the domain event `approval.decided{skipped}` after the commit (its IM card update is
|
|
1824
1853
|
* owed by the append, transactional outbox spec §8.1).
|
|
1825
1854
|
*/
|
|
1855
|
+
// org-filter: conversationId is the conversation the caller wrote the author's message in and
|
|
1856
|
+
// holds locked (ConversationsService, checked in its org); the tree is its sub-agents'
|
|
1857
|
+
// conversations, and every row below is read from that tree
|
|
1826
1858
|
async skipNetworkIn(conversationId, authorAccountId) {
|
|
1827
1859
|
const t = this.db.db;
|
|
1828
1860
|
const tree = await this.subtreeOf(conversationId);
|
|
@@ -1880,6 +1912,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1880
1912
|
const row = await q.executeTakeFirst();
|
|
1881
1913
|
if (!row)
|
|
1882
1914
|
return false;
|
|
1915
|
+
// org-filter: the conversation of the approval row read just above (org-filtered when the
|
|
1916
|
+
// caller passes orgId; otherwise a kernel-written approval id, see expireIn)
|
|
1883
1917
|
await t
|
|
1884
1918
|
.selectFrom("conversations")
|
|
1885
1919
|
.select("id")
|
|
@@ -1893,6 +1927,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1893
1927
|
const found = [...new Set((await ids.execute()).map((r) => r.conversation_id))];
|
|
1894
1928
|
if (found.length === 0)
|
|
1895
1929
|
return [];
|
|
1930
|
+
// org-filter: the ids come from the caller's query over approvals of a conversation tree it
|
|
1931
|
+
// already holds (skipNetworkIn)
|
|
1896
1932
|
const rows = await this.db.db
|
|
1897
1933
|
.selectFrom("conversations")
|
|
1898
1934
|
.select("id")
|
|
@@ -1903,6 +1939,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1903
1939
|
return rows.map((r) => r.id);
|
|
1904
1940
|
}
|
|
1905
1941
|
/** `conversationId` and its sub-agents' conversations at any depth (at most 16 levels). */
|
|
1942
|
+
// org-filter: sub-agent conversations live in their parent's org; the root is the caller's
|
|
1906
1943
|
async subtreeOf(conversationId) {
|
|
1907
1944
|
const all = [conversationId];
|
|
1908
1945
|
let level = [conversationId];
|
|
@@ -1984,6 +2021,8 @@ let ApprovalsService = class ApprovalsService {
|
|
|
1984
2021
|
return m?.role ?? null;
|
|
1985
2022
|
}
|
|
1986
2023
|
/** agent id → 当前版本定义里的名字。 */
|
|
2024
|
+
// org-filter: the agent ids come from the conversations of approval rows the callers already
|
|
2025
|
+
// read in their org (views)
|
|
1987
2026
|
async agentNames(ids) {
|
|
1988
2027
|
if (ids.length === 0)
|
|
1989
2028
|
return new Map();
|
|
@@ -2027,6 +2066,7 @@ let ApprovalsService = class ApprovalsService {
|
|
|
2027
2066
|
const connectorIds = [
|
|
2028
2067
|
...new Set(recs.flatMap((r) => (r.connectorId === null ? [] : [r.connectorId]))),
|
|
2029
2068
|
];
|
|
2069
|
+
// org-filter: connector ids from approval rows the callers already read in their org
|
|
2030
2070
|
const apps = connectorIds.length === 0
|
|
2031
2071
|
? []
|
|
2032
2072
|
: await db
|
|
@@ -366,19 +366,23 @@ const normalizedChat = (chat) => ({
|
|
|
366
366
|
chatId: chat.chatId,
|
|
367
367
|
chatType: chat.chatType ?? "dm",
|
|
368
368
|
});
|
|
369
|
-
/**
|
|
370
|
-
|
|
369
|
+
/**
|
|
370
|
+
* A chat target with its connection's name for the words. The connection id may come from the
|
|
371
|
+
* model's tool input: only a connection of `orgId` lends its name (another org's id shows as is).
|
|
372
|
+
*/
|
|
373
|
+
async function chatTargetOf(db, orgId, chat) {
|
|
371
374
|
const c = await db
|
|
372
375
|
.selectFrom("channel_connections")
|
|
373
376
|
.select("name")
|
|
374
377
|
.where("id", "=", chat.connectionId)
|
|
378
|
+
.where("org_id", "=", orgId)
|
|
375
379
|
.executeTakeFirst();
|
|
376
380
|
return { mode: "chat", chat, connectionName: c?.name ?? chat.connectionId };
|
|
377
381
|
}
|
|
378
382
|
/** A stored task's target; a chat's connection name is read for the words. */
|
|
379
383
|
async function storedTarget(db, task) {
|
|
380
384
|
if (task.mode === "chat" && task.chat !== null)
|
|
381
|
-
return chatTargetOf(db, task.chat);
|
|
385
|
+
return chatTargetOf(db, task.orgId, task.chat);
|
|
382
386
|
if (task.mode === "conversation" && task.conversationId !== null) {
|
|
383
387
|
return { mode: "conversation", conversationId: task.conversationId };
|
|
384
388
|
}
|
|
@@ -552,6 +556,7 @@ export function scheduleTools(deps) {
|
|
|
552
556
|
.db()
|
|
553
557
|
.selectFrom("approvals")
|
|
554
558
|
.select("summary")
|
|
559
|
+
.where("org_id", "=", ctx.orgId)
|
|
555
560
|
.where("run_id", "=", ctx.runId)
|
|
556
561
|
.where("call_id", "=", ctx.callId)
|
|
557
562
|
.where("status", "=", "approved")
|
|
@@ -594,7 +599,7 @@ export function scheduleTools(deps) {
|
|
|
594
599
|
const target = input.mode === "here"
|
|
595
600
|
? await hereTarget(deps.db(), ctx.orgId, ctx.accountId, ctx.conversationId)
|
|
596
601
|
: input.mode === "chat"
|
|
597
|
-
? await chatTargetOf(deps.db(), normalizedChat(input.chat))
|
|
602
|
+
? await chatTargetOf(deps.db(), ctx.orgId, normalizedChat(input.chat))
|
|
598
603
|
: { mode: "new" };
|
|
599
604
|
return {
|
|
600
605
|
trigger,
|
|
@@ -709,7 +714,7 @@ export function scheduleTools(deps) {
|
|
|
709
714
|
const after = input.mode === "here"
|
|
710
715
|
? await hereTarget(db, ctx.orgId, ctx.accountId, ctx.conversationId)
|
|
711
716
|
: input.mode === "chat"
|
|
712
|
-
? await chatTargetOf(db, normalizedChat(input.chat))
|
|
717
|
+
? await chatTargetOf(db, ctx.orgId, normalizedChat(input.chat))
|
|
713
718
|
: { mode: "new" };
|
|
714
719
|
if (!sameTarget(before, after)) {
|
|
715
720
|
const b = targetWords(before, ctx.conversationId);
|
|
@@ -814,7 +819,7 @@ export function scheduleTools(deps) {
|
|
|
814
819
|
const target = input.mode === "here"
|
|
815
820
|
? await hereTarget(deps.db(), ctx.orgId, ctx.accountId, ctx.conversationId)
|
|
816
821
|
: input.mode === "chat"
|
|
817
|
-
? await chatTargetOf(deps.db(), normalizedChat(input.chat))
|
|
822
|
+
? await chatTargetOf(deps.db(), ctx.orgId, normalizedChat(input.chat))
|
|
818
823
|
: { mode: "new" };
|
|
819
824
|
const f = targetFields(target);
|
|
820
825
|
patch.mode = f.mode;
|
|
@@ -182,8 +182,8 @@ export function webSearchTool(deps) {
|
|
|
182
182
|
...(allowed !== undefined && allowed.length > 0 && { allowedDomains: allowed }),
|
|
183
183
|
...(blocked !== undefined && blocked.length > 0 && { blockedDomains: blocked }),
|
|
184
184
|
maxResults: max,
|
|
185
|
-
orgConfig: resolved.orgConfig,
|
|
186
185
|
config: resolved.config,
|
|
186
|
+
orgId: ctx.orgId,
|
|
187
187
|
signal: ctx.signal,
|
|
188
188
|
});
|
|
189
189
|
results = Array.isArray(out?.results) ? out.results : [];
|
|
@@ -67,6 +67,7 @@ let ConnectorAccountPolicies = class ConnectorAccountPolicies {
|
|
|
67
67
|
const mine = new Map((await this.db
|
|
68
68
|
.selectFrom("connector_tool_account_policies")
|
|
69
69
|
.select(["tool_name", "policy"])
|
|
70
|
+
.where("org_id", "=", orgId)
|
|
70
71
|
.where("connector_id", "=", connectorId)
|
|
71
72
|
.where("account_id", "=", accountId)
|
|
72
73
|
.execute()).map((r) => [r.tool_name, r.policy]));
|
|
@@ -98,6 +99,7 @@ let ConnectorAccountPolicies = class ConnectorAccountPolicies {
|
|
|
98
99
|
const rows = await this.db
|
|
99
100
|
.selectFrom("connector_tool_account_policies")
|
|
100
101
|
.select(["tool_name", "policy"])
|
|
102
|
+
.where("org_id", "=", orgId)
|
|
101
103
|
.where("connector_id", "=", connectorId)
|
|
102
104
|
.where("account_id", "=", accountId)
|
|
103
105
|
.where(sql `starts_with(tool_name, ${GIT_PUSH_PREFIX})`)
|
|
@@ -154,6 +156,7 @@ let ConnectorAccountPolicies = class ConnectorAccountPolicies {
|
|
|
154
156
|
if (cleared.length > 0) {
|
|
155
157
|
await this.db
|
|
156
158
|
.deleteFrom("connector_tool_account_policies")
|
|
159
|
+
.where("org_id", "=", orgId)
|
|
157
160
|
.where("connector_id", "=", connectorId)
|
|
158
161
|
.where("account_id", "=", accountId)
|
|
159
162
|
.where("tool_name", "in", cleared)
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
import type { FastifyReply } from "fastify";
|
|
1
2
|
import { z } from "zod";
|
|
3
|
+
/**
|
|
4
|
+
* The description of the platform connector template a connector was made from (its current
|
|
5
|
+
* version; both null for a custom connector or a template the reader may not see). The
|
|
6
|
+
* connector's own `description` comes first on the pages; this is the fallback.
|
|
7
|
+
*/
|
|
8
|
+
export interface ConnectorTemplateDescription {
|
|
9
|
+
/** The template's English or only text. */
|
|
10
|
+
templateDescription: string | null;
|
|
11
|
+
/** The template's Chinese text; null: `templateDescription` serves both languages. */
|
|
12
|
+
templateDescriptionZh: string | null;
|
|
13
|
+
}
|
|
2
14
|
import type { ConnectionGuideState } from "../extensions/plugin-guides.js";
|
|
3
15
|
import { PluginIcons } from "../extensions/plugin-icons.js";
|
|
4
16
|
import { type Principal } from "../identity/principal.js";
|
|
@@ -77,6 +89,7 @@ declare const CreateBody: z.ZodObject<{
|
|
|
77
89
|
}, z.core.$strict>], "type">;
|
|
78
90
|
credential: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
79
91
|
git: z.ZodOptional<z.ZodType<import("@capybara-hq/plugin-sdk").GitSource, unknown, z.core.$ZodTypeInternals<import("@capybara-hq/plugin-sdk").GitSource, unknown>>>;
|
|
92
|
+
description: z.ZodOptional<z.ZodString>;
|
|
80
93
|
}, z.core.$strict>;
|
|
81
94
|
declare const PreviewBody: z.ZodObject<{
|
|
82
95
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -167,6 +180,7 @@ declare const UpdateBody: z.ZodObject<{
|
|
|
167
180
|
}, z.core.$strict>>>;
|
|
168
181
|
allowUnannotated: z.ZodOptional<z.ZodBoolean>;
|
|
169
182
|
useForGit: z.ZodOptional<z.ZodBoolean>;
|
|
183
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
170
184
|
}, z.core.$strict>;
|
|
171
185
|
declare const ReviewBody: z.ZodObject<{
|
|
172
186
|
action: z.ZodEnum<{
|
|
@@ -180,18 +194,20 @@ interface MemberPolicySheet {
|
|
|
180
194
|
gitPush: MemberGitPushView | null;
|
|
181
195
|
}
|
|
182
196
|
/**
|
|
183
|
-
* A connector as the org's pages show it: with its plugin's icon (`icon`, see
|
|
184
|
-
* template's
|
|
185
|
-
*
|
|
197
|
+
* A connector as the org's pages show it: with its template's or plugin's icon (`icon`, see
|
|
198
|
+
* `withIcons`), its platform template's description (`templateDescription` /
|
|
199
|
+
* `templateDescriptionZh`, null for a custom connector; its own `description` comes first), its template's setup guide and the drift since it was set up (`setupGuide`,
|
|
200
|
+
* `guideDrift`; spec 2026-11-09-setup-guides-v2-design.md §9.3, §11).
|
|
186
201
|
*/
|
|
187
|
-
export type ConnectorPage<T extends ConnectorSummary = ConnectorDetail> = T & ConnectionGuideState & {
|
|
202
|
+
export type ConnectorPage<T extends ConnectorSummary = ConnectorDetail> = T & ConnectionGuideState & ConnectorTemplateDescription & {
|
|
188
203
|
icon: string | null;
|
|
189
204
|
/** The one-connector read of an `oauth_code` connector, for managers: its redirect URI. */
|
|
190
205
|
oauthCallbackUrl?: string | null;
|
|
191
206
|
};
|
|
192
207
|
/**
|
|
193
|
-
*
|
|
194
|
-
*
|
|
208
|
+
* Connectors (`/api/v1/orgs/:orgId/connectors`): reads and personal credentials need
|
|
209
|
+
* `connectors.use` (guests and up); install / update / delete / refresh / org credentials need
|
|
210
|
+
* `connectors.manage` (admins and up); both are for user principals only.
|
|
195
211
|
*/
|
|
196
212
|
export declare class ConnectorsController {
|
|
197
213
|
private readonly connectors;
|
|
@@ -200,11 +216,23 @@ export declare class ConnectorsController {
|
|
|
200
216
|
private readonly config;
|
|
201
217
|
constructor(connectors: ConnectorsService, icons: PluginIcons, memberPolicies: ConnectorAccountPolicies, config: Pick<KernelConfigService, "get">);
|
|
202
218
|
/**
|
|
203
|
-
* Each connector with `icon
|
|
204
|
-
*
|
|
205
|
-
*
|
|
219
|
+
* Each connector with `icon`, on its own icon route (`GET …/connectors/:id/icon`, so guests can
|
|
220
|
+
* load it too): the own icon of the platform connector template it was made from (its current
|
|
221
|
+
* version, the platform's one version of the template), else the icon of the plugin its template
|
|
222
|
+
* came from, else null (a custom connector, no icon, or one the reader's catalog does not show:
|
|
223
|
+
* the share gate holds; maintainer decision 2026-11-09). Also `templateDescription` /
|
|
224
|
+
* `templateDescriptionZh`: that platform template's description under the same gate (null for
|
|
225
|
+
* a custom connector).
|
|
206
226
|
*/
|
|
207
227
|
private withIcons;
|
|
228
|
+
/**
|
|
229
|
+
* The icon the connector shows (svg or png, the catalog icon response headers): its template's
|
|
230
|
+
* own icon, else its plugin's, under the same visibility gate as the catalog icon routes. It is
|
|
231
|
+
* the connector pages' icon URL, so every role that reads connectors (`connectors.use`, guests
|
|
232
|
+
* included) may load it without reading the catalog. Unknown connector -> 404
|
|
233
|
+
* `connector.not_found`; no icon the reader may see -> 404 `catalog.icon_not_found`.
|
|
234
|
+
*/
|
|
235
|
+
icon(org: OrgContext, connectorId: string, reply: FastifyReply): Promise<void>;
|
|
208
236
|
list(org: OrgContext): Promise<{
|
|
209
237
|
connectors: ConnectorPage<ConnectorSummary>[];
|
|
210
238
|
}>;
|
|
@@ -7,8 +7,9 @@ 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, Delete, Get, HttpCode, Inject, Param, Patch, Post, Put } from "@nestjs/common";
|
|
10
|
+
import { Controller, Delete, Get, HttpCode, Inject, Param, Patch, Post, Put, Res, } from "@nestjs/common";
|
|
11
11
|
import { z } from "zod";
|
|
12
|
+
import { sendCatalogIcon } from "../catalog/org-catalog.controller.js";
|
|
12
13
|
import { orgIconScope, PluginIcons } from "../extensions/plugin-icons.js";
|
|
13
14
|
import { CurrentPrincipal, patTokenId, requireUser, } from "../identity/principal.js";
|
|
14
15
|
import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
@@ -59,8 +60,9 @@ class GitPushPolicyDto extends createZodDto(GitPushPolicyBody, "ConnectorGitPush
|
|
|
59
60
|
class ConnectorGuideAckBody extends createZodDto(ConnectorGuideAckSchema, "ConnectorGuideAckBody") {
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
63
|
+
* Connectors (`/api/v1/orgs/:orgId/connectors`): reads and personal credentials need
|
|
64
|
+
* `connectors.use` (guests and up); install / update / delete / refresh / org credentials need
|
|
65
|
+
* `connectors.manage` (admins and up); both are for user principals only.
|
|
64
66
|
*/
|
|
65
67
|
let ConnectorsController = class ConnectorsController {
|
|
66
68
|
connectors;
|
|
@@ -74,17 +76,43 @@ let ConnectorsController = class ConnectorsController {
|
|
|
74
76
|
this.config = config;
|
|
75
77
|
}
|
|
76
78
|
/**
|
|
77
|
-
* Each connector with `icon
|
|
78
|
-
*
|
|
79
|
-
*
|
|
79
|
+
* Each connector with `icon`, on its own icon route (`GET …/connectors/:id/icon`, so guests can
|
|
80
|
+
* load it too): the own icon of the platform connector template it was made from (its current
|
|
81
|
+
* version, the platform's one version of the template), else the icon of the plugin its template
|
|
82
|
+
* came from, else null (a custom connector, no icon, or one the reader's catalog does not show:
|
|
83
|
+
* the share gate holds; maintainer decision 2026-11-09). Also `templateDescription` /
|
|
84
|
+
* `templateDescriptionZh`: that platform template's description under the same gate (null for
|
|
85
|
+
* a custom connector).
|
|
80
86
|
*/
|
|
81
87
|
async withIcons(org, rows) {
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
const scope = orgIconScope(org);
|
|
89
|
+
const templateIds = rows.flatMap((r) => (r.platformTemplateId ? [r.platformTemplateId] : []));
|
|
90
|
+
const [urls, descriptions] = await Promise.all([
|
|
91
|
+
this.icons.ofConnectors(rows.map((r) => ({ id: r.id, templateId: r.platformTemplateId, itemId: r.catalogItemId })), scope),
|
|
92
|
+
this.icons.templateDescriptions(templateIds, scope),
|
|
93
|
+
]);
|
|
94
|
+
return rows.map((r, i) => {
|
|
95
|
+
const d = r.platformTemplateId
|
|
96
|
+
? descriptions.get(r.platformTemplateId)
|
|
97
|
+
: undefined;
|
|
98
|
+
return {
|
|
99
|
+
...r,
|
|
100
|
+
templateDescription: d?.description ?? null,
|
|
101
|
+
templateDescriptionZh: d?.descriptionZh ?? null,
|
|
102
|
+
icon: urls[i] ?? null,
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The icon the connector shows (svg or png, the catalog icon response headers): its template's
|
|
108
|
+
* own icon, else its plugin's, under the same visibility gate as the catalog icon routes. It is
|
|
109
|
+
* the connector pages' icon URL, so every role that reads connectors (`connectors.use`, guests
|
|
110
|
+
* included) may load it without reading the catalog. Unknown connector -> 404
|
|
111
|
+
* `connector.not_found`; no icon the reader may see -> 404 `catalog.icon_not_found`.
|
|
112
|
+
*/
|
|
113
|
+
async icon(org, connectorId, reply) {
|
|
114
|
+
const ref = await this.connectors.iconRef(org.orgId, connectorId);
|
|
115
|
+
await sendCatalogIcon(reply, await this.icons.readConnectorIcon(ref, orgIconScope(org)));
|
|
88
116
|
}
|
|
89
117
|
async list(org) {
|
|
90
118
|
const list = (await this.connectors.list(org.orgId)).map((a) => forViewer(org, a));
|
|
@@ -221,6 +249,13 @@ let ConnectorsController = class ConnectorsController {
|
|
|
221
249
|
await this.connectors.clearMyCredential(org.orgId, connectorId, p.account.id, patTokenId(p));
|
|
222
250
|
}
|
|
223
251
|
};
|
|
252
|
+
__decorate([
|
|
253
|
+
Get(":connectorId/icon"),
|
|
254
|
+
OrgAction("connectors.use"),
|
|
255
|
+
__param(0, CurrentOrg()),
|
|
256
|
+
__param(1, Param("connectorId")),
|
|
257
|
+
__param(2, Res())
|
|
258
|
+
], ConnectorsController.prototype, "icon", null);
|
|
224
259
|
__decorate([
|
|
225
260
|
Get(),
|
|
226
261
|
OrgAction("connectors.use"),
|
|
@@ -27,6 +27,8 @@ export declare const GitPushPolicyBody: z.ZodObject<{
|
|
|
27
27
|
}>;
|
|
28
28
|
}, z.core.$strict>;
|
|
29
29
|
/** `POST …/connectors`: a custom connector with its endpoint, auth method and credential. */
|
|
30
|
+
/** Upper bound on a connector's own description, in characters (as a template's, per text). */
|
|
31
|
+
export declare const CONNECTOR_DESCRIPTION_MAX: 1024;
|
|
30
32
|
export declare const ConnectorCreateSchema: z.ZodObject<{
|
|
31
33
|
name: z.ZodString;
|
|
32
34
|
slug: z.ZodOptional<z.ZodString>;
|
|
@@ -97,6 +99,7 @@ export declare const ConnectorCreateSchema: z.ZodObject<{
|
|
|
97
99
|
}, z.core.$strict>], "type">;
|
|
98
100
|
credential: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
99
101
|
git: z.ZodOptional<z.ZodType<import("@capybara-hq/plugin-sdk").GitSource, unknown, z.core.$ZodTypeInternals<import("@capybara-hq/plugin-sdk").GitSource, unknown>>>;
|
|
102
|
+
description: z.ZodOptional<z.ZodString>;
|
|
100
103
|
}, z.core.$strict>;
|
|
101
104
|
/**
|
|
102
105
|
* `POST …/connectors/preview` (ruling A20): the create's connector, endpoint, auth and credential;
|
|
@@ -195,6 +198,7 @@ export declare const ConnectorUpdateSchema: z.ZodObject<{
|
|
|
195
198
|
}, z.core.$strict>>>;
|
|
196
199
|
allowUnannotated: z.ZodOptional<z.ZodBoolean>;
|
|
197
200
|
useForGit: z.ZodOptional<z.ZodBoolean>;
|
|
201
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
198
202
|
}, z.core.$strict>;
|
|
199
203
|
export declare const CONNECTOR_ROUTES: readonly RouteSchemas[];
|
|
200
204
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectorAuthSchema, GitSourceSchema, secret } from "@capybara-hq/plugin-sdk";
|
|
1
|
+
import { CONNECTOR_TEMPLATE_LIMITS, ConnectorAuthSchema, GitSourceSchema, secret, } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
/**
|
|
4
4
|
* A credential value: `Credentials.validate` checks its shape by auth method (values are never
|
|
@@ -21,6 +21,14 @@ export const ConnectorPathParams = z.object({ connectorId: z.string().min(1) });
|
|
|
21
21
|
*/
|
|
22
22
|
export const GitPushPolicyBody = z.object({ policy: z.enum(["allow", "ask", "deny"]) }).strict();
|
|
23
23
|
/** `POST …/connectors`: a custom connector with its endpoint, auth method and credential. */
|
|
24
|
+
/** Upper bound on a connector's own description, in characters (as a template's, per text). */
|
|
25
|
+
export const CONNECTOR_DESCRIPTION_MAX = CONNECTOR_TEMPLATE_LIMITS.descriptionChars;
|
|
26
|
+
/** A connector's own description: plain text an org admin typed, trimmed (blank means none). */
|
|
27
|
+
const ConnectorDescription = z
|
|
28
|
+
.string()
|
|
29
|
+
.trim()
|
|
30
|
+
.max(CONNECTOR_DESCRIPTION_MAX)
|
|
31
|
+
.describe("The connector's own description, plain text shown on the connector pages.");
|
|
24
32
|
export const ConnectorCreateSchema = z
|
|
25
33
|
.object({
|
|
26
34
|
name: z.string().trim().min(1).max(80),
|
|
@@ -31,6 +39,8 @@ export const ConnectorCreateSchema = z
|
|
|
31
39
|
credential: CredentialValue.optional(),
|
|
32
40
|
/** The git hosts the credential serves in sandboxes (sandbox git credentials spec §6.1). */
|
|
33
41
|
git: GitSourceSchema.optional(),
|
|
42
|
+
/** The connector's own description (plain text; blank: none). */
|
|
43
|
+
description: ConnectorDescription.optional(),
|
|
34
44
|
})
|
|
35
45
|
.strict();
|
|
36
46
|
/**
|
|
@@ -68,6 +78,8 @@ export const ConnectorUpdateSchema = z
|
|
|
68
78
|
allowUnannotated: z.boolean().optional(),
|
|
69
79
|
/** Use an org-credential connector for git in sandboxes (spec 2026-11-12 §6.2). */
|
|
70
80
|
useForGit: z.boolean().optional(),
|
|
81
|
+
/** The connector's own description; null or blank removes it. */
|
|
82
|
+
description: ConnectorDescription.nullable().optional(),
|
|
71
83
|
})
|
|
72
84
|
.strict();
|
|
73
85
|
export const CONNECTOR_ROUTES = [
|
|
@@ -86,6 +86,11 @@ export interface ConnectorSummary {
|
|
|
86
86
|
* the virtual tool `git_push`; sandbox git credentials spec §7); meaningful only with `git`.
|
|
87
87
|
*/
|
|
88
88
|
gitPushPolicy: ToolPolicy;
|
|
89
|
+
/**
|
|
90
|
+
* Its own description, set by an org admin (`connectors.description`); null: none (the pages
|
|
91
|
+
* then show its template's, `templateDescription` on the connector routes).
|
|
92
|
+
*/
|
|
93
|
+
description: string | null;
|
|
89
94
|
createdBy: string;
|
|
90
95
|
createdAt: Date;
|
|
91
96
|
updatedAt: Date;
|
|
@@ -110,6 +115,8 @@ export interface CreateConnectorInput {
|
|
|
110
115
|
* create body's; validated by the SDK's `GitSourceSchema`), stored in `connectors.git_hosts`.
|
|
111
116
|
*/
|
|
112
117
|
git?: GitSource | undefined;
|
|
118
|
+
/** The connector's own description (`connectors.description`; blank or absent: none). */
|
|
119
|
+
description?: string | undefined;
|
|
113
120
|
/**
|
|
114
121
|
* Install from a platform catalog connector template (T26, filled in by the catalog service,
|
|
115
122
|
* not accepted over HTTP): the connector records its source item and version, the item policy is
|
|
@@ -221,6 +228,8 @@ export interface UpdateConnectorInput {
|
|
|
221
228
|
* an org-ownership connector that declares git hosts; pushes are then the bot's.
|
|
222
229
|
*/
|
|
223
230
|
useForGit?: boolean | undefined;
|
|
231
|
+
/** The connector's own description; null or blank removes it. */
|
|
232
|
+
description?: string | null | undefined;
|
|
224
233
|
}
|
|
225
234
|
/** OAuth 安装准备的结果:要存的客户端,以及(客户端凭据流)安装时取到的组织 token。 */
|
|
226
235
|
export interface OAuthSetup {
|
|
@@ -381,6 +390,14 @@ export declare class ConnectorsService {
|
|
|
381
390
|
private ackIn;
|
|
382
391
|
/** The org's connectors that are not deleted (by creation time). */
|
|
383
392
|
list(orgId: string): Promise<ConnectorSummary[]>;
|
|
393
|
+
/**
|
|
394
|
+
* Where a live connector of the org takes its icon from: its platform template and its plugin
|
|
395
|
+
* (catalog item). Unknown -> `connector.not_found`.
|
|
396
|
+
*/
|
|
397
|
+
iconRef(orgId: string, connectorId: string): Promise<{
|
|
398
|
+
templateId: string | null;
|
|
399
|
+
itemId: string | null;
|
|
400
|
+
}>;
|
|
384
401
|
get(orgId: string, connectorId: string, viewerAccountId: string): Promise<ConnectorDetail>;
|
|
385
402
|
/** 改名、启停连接器、工具启停与默认策略、批量把无注解工具改为 allow(`connectors.manage`)。 */
|
|
386
403
|
update(orgId: string, connectorId: string, actorAccountId: string, patch: UpdateConnectorInput, actorTokenId?: string, auditDetail?: Record<string, unknown>): Promise<ConnectorDetail>;
|