@capybara-hq/kernel 0.1.0-rc.36 → 0.1.0-rc.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap.json +5 -5
- package/dist/admin/admin.module.d.ts +3 -2
- package/dist/admin/admin.module.js +9 -5
- package/dist/admin/audit-log.service.d.ts +51 -0
- package/dist/admin/{platform-audit.service.js → audit-log.service.js} +20 -12
- package/dist/admin/audit.controller.d.ts +18 -6
- package/dist/admin/audit.controller.js +36 -6
- package/dist/admin/audit.schemas.d.ts +9 -1
- package/dist/admin/audit.schemas.js +22 -2
- package/dist/admin/org-network.controller.d.ts +30 -0
- package/dist/admin/org-network.controller.js +77 -0
- package/dist/admin/org-network.schemas.d.ts +16 -0
- package/dist/admin/org-network.schemas.js +27 -0
- package/dist/admin/org-network.service.d.ts +41 -0
- package/dist/admin/org-network.service.js +101 -0
- package/dist/admin/outbox-dead.controller.d.ts +4 -6
- package/dist/admin/outbox-dead.controller.js +9 -6
- package/dist/admin/outbox-dead.schemas.d.ts +16 -0
- package/dist/admin/outbox-dead.schemas.js +25 -1
- package/dist/admin/outbox-dead.service.d.ts +16 -7
- package/dist/admin/outbox-dead.service.js +34 -10
- package/dist/admin/overview.service.d.ts +3 -3
- package/dist/admin/overview.service.js +0 -1
- package/dist/agents/agent-lookup.js +2 -10
- package/dist/agents/agents.service.js +9 -20
- package/dist/agents/definition.d.ts +3 -51
- package/dist/agents/definition.js +4 -254
- package/dist/agents/org-templates.js +2 -6
- package/dist/agents/readiness.controller.d.ts +4 -12
- package/dist/agents/readiness.controller.js +4 -12
- package/dist/agents/readiness.service.d.ts +23 -11
- package/dist/agents/readiness.service.js +31 -14
- package/dist/agents/templates.d.ts +0 -6
- package/dist/agents/templates.js +8 -34
- package/dist/background/store.d.ts +2 -0
- package/dist/background/store.js +3 -1
- package/dist/background/wake-rules.js +2 -1
- package/dist/catalog/admin-catalog.controller.d.ts +1 -2
- package/dist/catalog/admin-catalog.controller.js +1 -2
- package/dist/catalog/appearance.service.js +1 -3
- package/dist/catalog/catalog-content.d.ts +1 -1
- package/dist/catalog/catalog-content.js +1 -4
- package/dist/catalog/catalog-items.js +3 -3
- package/dist/catalog/catalog-scope.service.d.ts +10 -28
- package/dist/catalog/catalog-scope.service.js +22 -73
- package/dist/catalog/cli.d.ts +0 -11
- package/dist/catalog/cli.js +0 -20
- package/dist/catalog/component-scope.service.js +0 -2
- package/dist/catalog/component-state.js +2 -2
- package/dist/catalog/install-status.d.ts +6 -0
- package/dist/catalog/install-status.js +6 -0
- package/dist/catalog/job-ids.d.ts +0 -4
- package/dist/catalog/job-ids.js +0 -4
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.d.ts +2 -0
- package/dist/catalog/org-catalog.service.js +8 -3
- package/dist/catalog/org-extension-switch.d.ts +7 -2
- package/dist/catalog/org-extension-switch.js +56 -9
- package/dist/catalog/org-plugin-uploads.d.ts +6 -15
- package/dist/catalog/org-plugin-uploads.js +9 -27
- package/dist/catalog/owned-items.js +1 -3
- package/dist/catalog/platform-import-update.js +1 -1
- package/dist/catalog/plugin-import.d.ts +15 -13
- package/dist/catalog/plugin-import.js +21 -30
- package/dist/catalog/plugin-install.d.ts +3 -43
- package/dist/catalog/plugin-install.js +8 -150
- package/dist/catalog/plugin-package.d.ts +5 -10
- package/dist/catalog/plugin-package.js +12 -33
- package/dist/catalog/plugin-upgrade.js +5 -4
- package/dist/catalog/scope-jobs.d.ts +34 -34
- package/dist/catalog/scope-jobs.js +50 -37
- package/dist/catalog/scope-orgs.d.ts +1 -1
- package/dist/catalog/scope-orgs.js +1 -2
- package/dist/catalog/scope-sync-workers.d.ts +4 -3
- package/dist/catalog/scope-sync-workers.js +18 -6
- package/dist/catalog/scope-sync.d.ts +56 -59
- package/dist/catalog/scope-sync.js +96 -166
- package/dist/catalog/unshare.d.ts +3 -4
- package/dist/catalog/unshare.js +5 -8
- package/dist/channels/job-ids.d.ts +2 -6
- package/dist/channels/job-ids.js +2 -6
- package/dist/channels/outbound.d.ts +1 -1
- package/dist/channels/outbound.js +1 -1
- package/dist/channels/supervisor.d.ts +2 -3
- package/dist/channels/supervisor.js +2 -3
- package/dist/client/client-access.service.js +1 -1
- package/dist/config/env.js +19 -1
- package/dist/config/load.d.ts +0 -6
- package/dist/config/load.js +8 -27
- package/dist/config/schema.d.ts +54 -47
- package/dist/config/schema.js +198 -42
- package/dist/conversations/attachments.service.d.ts +10 -3
- package/dist/conversations/attachments.service.js +49 -16
- package/dist/conversations/conversations.controller.d.ts +0 -39
- package/dist/conversations/conversations.controller.js +0 -39
- package/dist/conversations/event-log.js +4 -1
- package/dist/conversations/events.d.ts +71 -46
- package/dist/conversations/events.js +124 -112
- package/dist/conversations/media-types.d.ts +25 -0
- package/dist/conversations/media-types.js +38 -0
- package/dist/conversations/queue.d.ts +3 -1
- package/dist/conversations/queue.service.js +9 -2
- package/dist/conversations/titles.js +6 -0
- package/dist/ctx/create-ctx.d.ts +8 -1
- package/dist/ctx/create-ctx.js +13 -3
- package/dist/ctx/net.d.ts +50 -0
- package/dist/ctx/net.js +67 -0
- package/dist/ctx/secrets.d.ts +24 -7
- package/dist/ctx/secrets.js +97 -30
- package/dist/db/kernel-schema.d.ts +27 -6
- package/dist/devices/devices.service.js +2 -1
- package/dist/errors.d.ts +10 -2
- package/dist/errors.js +10 -2
- package/dist/evals/reconstruct.d.ts +4 -17
- package/dist/evals/reconstruct.js +13 -53
- package/dist/evals/recorded-tools.d.ts +0 -27
- package/dist/evals/recorded-tools.js +2 -92
- package/dist/evals/run-replay.d.ts +1 -6
- package/dist/evals/run-replay.js +10 -17
- package/dist/evals/sets.service.d.ts +17 -5
- package/dist/evals/sets.service.js +33 -12
- package/dist/evals/snapshot.d.ts +1 -2
- package/dist/evals/snapshot.js +4 -17
- package/dist/extensions/admin-ops.d.ts +6 -1
- package/dist/extensions/admin-ops.js +17 -4
- package/dist/extensions/admin-view.d.ts +7 -4
- package/dist/extensions/admin-view.js +27 -21
- package/dist/extensions/bootstrap.js +0 -1
- package/dist/extensions/cli.js +0 -1
- package/dist/extensions/extensions.module.js +3 -0
- package/dist/extensions/host.d.ts +9 -4
- package/dist/extensions/host.js +14 -8
- package/dist/extensions/installs.d.ts +1 -3
- package/dist/extensions/instance.d.ts +0 -2
- package/dist/extensions/instance.js +0 -3
- package/dist/extensions/org-config.d.ts +4 -4
- package/dist/extensions/org-config.js +13 -22
- package/dist/extensions/package.d.ts +6 -6
- package/dist/extensions/package.js +3 -7
- package/dist/extensions/permission-view.d.ts +2 -4
- package/dist/extensions/plugin-items.d.ts +21 -1
- package/dist/extensions/plugin-items.js +28 -0
- package/dist/extensions/sync.js +5 -10
- package/dist/extensions/unavailable.js +0 -1
- package/dist/http/api.module.js +4 -1
- package/dist/identity/audit.d.ts +0 -12
- package/dist/identity/audit.js +0 -27
- package/dist/identity/auth.controller.js +5 -9
- package/dist/identity/cookies.d.ts +4 -9
- package/dist/identity/cookies.js +8 -32
- package/dist/identity/initial-passwords.d.ts +1 -1
- package/dist/identity/initial-passwords.js +1 -2
- package/dist/identity/sessions.d.ts +0 -6
- package/dist/identity/sessions.js +0 -18
- package/dist/inbox/platform-inbox.service.d.ts +33 -1
- package/dist/inbox/platform-inbox.service.js +56 -6
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/infra/cli/master-key-rewrap.d.ts +15 -0
- package/dist/infra/cli/master-key-rewrap.js +24 -0
- package/dist/infra/config/kernel-config.service.js +0 -17
- package/dist/infra/database/transaction-host.d.ts +32 -1
- package/dist/infra/database/transaction-host.js +30 -4
- package/dist/infra/database/xact-lock.d.ts +16 -0
- package/dist/infra/database/xact-lock.js +28 -1
- package/dist/infra/health/health.controller.js +8 -0
- package/dist/infra/health/process-fault.d.ts +16 -0
- package/dist/infra/health/process-fault.js +49 -0
- package/dist/infra/lifecycle/process-guards.d.ts +8 -2
- package/dist/infra/lifecycle/process-guards.js +12 -3
- package/dist/infra/lifecycle/shutdown-signals.d.ts +10 -1
- package/dist/infra/lifecycle/shutdown-signals.js +28 -13
- package/dist/infra/outbox/outbox.service.d.ts +12 -9
- package/dist/infra/outbox/outbox.service.js +22 -26
- package/dist/infra/outbox/registry.d.ts +15 -7
- package/dist/infra/outbox/registry.js +39 -23
- package/dist/lifecycle/kernel-lifecycle.js +1 -7
- package/dist/models/enablement.d.ts +5 -6
- package/dist/models/enablement.js +7 -14
- package/dist/net/public-address.d.ts +21 -1
- package/dist/net/public-address.js +56 -10
- package/dist/net/safe-fetch.d.ts +4 -1
- package/dist/net/safe-fetch.js +15 -4
- package/dist/orgs/directory-sync.js +2 -0
- package/dist/orgs/members.service.js +5 -0
- package/dist/orgs/network-allowances.service.d.ts +79 -0
- package/dist/orgs/network-allowances.service.js +371 -0
- package/dist/orgs/offboarding.d.ts +3 -1
- package/dist/orgs/offboarding.js +9 -2
- package/dist/orgs/org-lock.d.ts +28 -2
- package/dist/orgs/org-lock.js +59 -4
- package/dist/orgs/orgs.controller.d.ts +11 -2
- package/dist/orgs/orgs.controller.js +19 -3
- package/dist/orgs/orgs.module.d.ts +3 -2
- package/dist/orgs/orgs.module.js +6 -2
- package/dist/orgs/orgs.schemas.d.ts +12 -0
- package/dist/orgs/orgs.schemas.js +5 -0
- package/dist/orgs/orgs.service.js +6 -1
- package/dist/orgs/settings.controller.d.ts +3 -2
- package/dist/orgs/settings.service.d.ts +59 -14
- package/dist/orgs/settings.service.js +102 -20
- package/dist/overrides.d.ts +7 -7
- package/dist/overrides.js +4 -4
- package/dist/packages/tgz.d.ts +0 -2
- package/dist/packages/tgz.js +0 -2
- package/dist/platform/exclusions.js +0 -5
- package/dist/platform/operation.js +1 -1
- package/dist/platform/ops/admin.ops.d.ts +2 -2
- package/dist/platform/ops/admin.ops.js +9 -6
- package/dist/platform/ops/agents.ops.js +1 -1
- package/dist/platform/ops/connectors.ops.js +46 -1
- package/dist/platform/ops/evals.ops.js +1 -64
- package/dist/platform/ops/extensions-admin.ops.js +1 -1
- package/dist/platform/ops/inbox.ops.js +16 -3
- package/dist/platform/ops/org-plugins.ops.js +1 -1
- package/dist/platform/ops/orgs.ops.d.ts +11 -3
- package/dist/platform/ops/orgs.ops.js +139 -5
- package/dist/platform/ops/outbox.ops.js +5 -5
- package/dist/platform/route-schemas.js +3 -0
- package/dist/roles/worker-role.d.ts +2 -3
- package/dist/roles/worker-role.js +3 -13
- package/dist/runtime/checkpointer.d.ts +3 -0
- package/dist/runtime/checkpointer.js +7 -4
- package/dist/runtime/context/build.d.ts +56 -18
- package/dist/runtime/context/build.js +143 -50
- package/dist/runtime/context/compaction.d.ts +1 -3
- package/dist/runtime/context/compaction.js +42 -8
- package/dist/runtime/context/run-context.js +1 -2
- package/dist/runtime/context/skills.d.ts +27 -56
- package/dist/runtime/context/skills.js +42 -114
- package/dist/runtime/context/tool-changes.d.ts +3 -3
- package/dist/runtime/context/tool-changes.js +6 -16
- package/dist/runtime/hook-calls.d.ts +6 -6
- package/dist/runtime/hook-calls.js +7 -7
- package/dist/runtime/langgraph-loop.js +9 -3
- package/dist/runtime/maintenance.d.ts +3 -11
- package/dist/runtime/maintenance.js +5 -20
- package/dist/runtime/model-call.d.ts +5 -0
- package/dist/runtime/model-call.js +48 -36
- package/dist/runtime/providers.d.ts +33 -35
- package/dist/runtime/providers.js +64 -109
- package/dist/runtime/run-context.service.js +7 -22
- package/dist/runtime/run-deletion.d.ts +6 -0
- package/dist/runtime/run-deletion.js +39 -16
- package/dist/runtime/run-execution.d.ts +56 -3
- package/dist/runtime/run-execution.js +81 -11
- package/dist/runtime/run-finish.js +2 -1
- package/dist/runtime/run-liveness.d.ts +11 -0
- package/dist/runtime/run-liveness.js +19 -0
- package/dist/runtime/run-orphan-check.job.js +2 -1
- package/dist/runtime/run-queue.js +8 -16
- package/dist/runtime/run-worker.d.ts +2 -2
- package/dist/runtime/run-worker.js +8 -6
- package/dist/runtime/step-log.d.ts +5 -0
- package/dist/runtime/step-log.js +9 -4
- package/dist/runtime/subagents/definition.d.ts +16 -20
- package/dist/runtime/subagents/definition.js +27 -27
- package/dist/runtime/subagents/dispatch.d.ts +6 -2
- package/dist/runtime/subagents/dispatch.js +17 -3
- package/dist/runtime/subagents/org-agents.js +1 -2
- package/dist/runtime/subagents/preamble.d.ts +3 -2
- package/dist/runtime/subagents/preamble.js +3 -2
- package/dist/runtime/subagents/render.d.ts +1 -2
- package/dist/runtime/subagents/render.js +1 -2
- package/dist/runtime/subagents/skill-fork.d.ts +2 -4
- package/dist/runtime/subagents/template-skills.d.ts +47 -0
- package/dist/runtime/subagents/template-skills.js +76 -0
- package/dist/runtime/waits.js +3 -1
- package/dist/schedules/effective-settings.d.ts +9 -3
- package/dist/schedules/effective-settings.js +5 -4
- package/dist/schedules/fire.js +11 -0
- package/dist/schedules/scheduled-tasks.service.js +5 -0
- package/dist/schedules/unattended.d.ts +2 -0
- package/dist/schedules/unattended.js +6 -1
- package/dist/skills/agent-skills.service.js +1 -2
- package/dist/skills/catalog.d.ts +1 -3
- package/dist/skills/catalog.js +1 -3
- package/dist/skills/conversation-catalog.d.ts +1 -2
- package/dist/skills/conversation-catalog.js +1 -2
- package/dist/skills/usable.js +2 -3
- package/dist/storage/storage.service.js +9 -1
- package/dist/tools/approvals.service.js +2 -4
- package/dist/tools/builtin-names.d.ts +2 -9
- package/dist/tools/builtin-names.js +4 -13
- package/dist/tools/builtins/sandbox/bash.js +3 -3
- package/dist/tools/builtins/sandbox/common.d.ts +7 -13
- package/dist/tools/builtins/sandbox/common.js +8 -115
- package/dist/tools/builtins/sandbox/fetch-attachment.d.ts +10 -0
- package/dist/tools/builtins/sandbox/fetch-attachment.js +119 -0
- package/dist/tools/builtins/sandbox/glob.js +1 -3
- package/dist/tools/builtins/sandbox/grep.js +3 -5
- package/dist/tools/builtins/sandbox/index.d.ts +8 -5
- package/dist/tools/builtins/sandbox/index.js +10 -5
- package/dist/tools/builtins/sandbox/read.js +3 -2
- package/dist/tools/builtins/tool-search.d.ts +4 -7
- package/dist/tools/builtins/tool-search.js +6 -10
- package/dist/tools/connector-account-policies.d.ts +30 -3
- package/dist/tools/connector-account-policies.js +54 -7
- package/dist/tools/connector-content.js +1 -0
- package/dist/tools/connectors.controller.d.ts +24 -11
- package/dist/tools/connectors.controller.js +35 -6
- package/dist/tools/connectors.schemas.d.ts +14 -1
- package/dist/tools/connectors.schemas.js +14 -2
- package/dist/tools/connectors.service.d.ts +22 -0
- package/dist/tools/connectors.service.js +65 -6
- package/dist/tools/drift.d.ts +6 -2
- package/dist/tools/drift.js +10 -5
- package/dist/tools/git-push-policy.d.ts +4 -1
- package/dist/tools/git-push-policy.js +3 -1
- package/dist/tools/info.d.ts +1 -7
- package/dist/tools/info.js +5 -18
- package/dist/tools/job-ids.d.ts +0 -4
- package/dist/tools/job-ids.js +1 -6
- package/dist/tools/pipeline.d.ts +4 -10
- package/dist/tools/pipeline.js +17 -62
- package/dist/tools/policy.d.ts +6 -2
- package/dist/tools/policy.js +14 -12
- package/dist/tools/registry.js +1 -5
- package/dist/ui/views.d.ts +5 -5
- package/dist/ui/views.js +10 -16
- package/package.json +3 -3
- package/src/migrations/0137_audit_org_idx.sql +5 -0
- package/src/migrations/0138_plugin_install_status_no_upgrading.sql +18 -0
- package/src/migrations/0139_retire_legacy_forms.sql +183 -0
- package/src/migrations/0140_retire_history_forms.sql +148 -0
- package/src/migrations/0141_install_ledger_promoted_rows.sql +36 -0
- package/src/migrations/0142_backfill_event_fields.sql +74 -0
- package/src/migrations/0143_backfill_model_call_fields.sql +105 -0
- package/src/migrations/0144_retire_frozen_definition_keys.sql +163 -0
- package/src/migrations/0145_org_network_allowances.sql +12 -0
- package/dist/admin/platform-audit.service.d.ts +0 -41
- package/dist/conversations/job-ids.d.ts +0 -6
- package/dist/conversations/job-ids.js +0 -6
- package/dist/extensions/job-ids.d.ts +0 -6
- package/dist/extensions/job-ids.js +0 -6
- package/dist/infra/queue/retired-schedulers.d.ts +0 -7
- package/dist/infra/queue/retired-schedulers.js +0 -9
- package/dist/orgs/job-ids.d.ts +0 -8
- package/dist/orgs/job-ids.js +0 -8
- package/dist/runtime/context/legacy-text.d.ts +0 -22
- package/dist/runtime/context/legacy-text.js +0 -37
- package/dist/runtime/job-ids.d.ts +0 -10
- package/dist/runtime/job-ids.js +0 -10
- package/dist/runtime/retired-schedulers.d.ts +0 -7
- package/dist/runtime/retired-schedulers.js +0 -31
- package/dist/storage/job-ids.d.ts +0 -6
- package/dist/storage/job-ids.js +0 -6
- package/dist/tools/legacy-data.d.ts +0 -34
- package/dist/tools/legacy-data.js +0 -76
- package/dist/tools/legacy-keys.d.ts +0 -51
- package/dist/tools/legacy-keys.js +0 -114
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type OnModuleInit } from "@nestjs/common";
|
|
2
|
+
import { AuditLogService } from "../../admin/audit-log.service.js";
|
|
2
3
|
import { AdminHealthService } from "../../admin/health.service.js";
|
|
3
4
|
import { AdminOverviewService } from "../../admin/overview.service.js";
|
|
4
|
-
import { PlatformAuditService } from "../../admin/platform-audit.service.js";
|
|
5
5
|
import { AdminUsageService } from "../../admin/usage.service.js";
|
|
6
6
|
import { ExtensionDisplayNames } from "../../extensions/display-name.js";
|
|
7
7
|
import { ExtensionRegistry } from "../../extensions/registry.js";
|
|
@@ -32,7 +32,7 @@ export declare class AdminOperations implements OnModuleInit {
|
|
|
32
32
|
private readonly overview;
|
|
33
33
|
private readonly health;
|
|
34
34
|
private readonly usage;
|
|
35
|
-
constructor(registry: PlatformOperations, settings: SettingsService, providers: ProviderRegistry, displayNames: ExtensionDisplayNames, extensionRegistry: ExtensionRegistry, enablement: ModelEnablement, prices: PricesService, purposes: ModelPurposesService, themes: ThemesService, audit:
|
|
35
|
+
constructor(registry: PlatformOperations, settings: SettingsService, providers: ProviderRegistry, displayNames: ExtensionDisplayNames, extensionRegistry: ExtensionRegistry, enablement: ModelEnablement, prices: PricesService, purposes: ModelPurposesService, themes: ThemesService, audit: AuditLogService, overview: AdminOverviewService, health: AdminHealthService, usage: AdminUsageService);
|
|
36
36
|
private assertProvider;
|
|
37
37
|
onModuleInit(): void;
|
|
38
38
|
}
|
|
@@ -11,10 +11,10 @@ import { Inject, Injectable } from "@nestjs/common";
|
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { DeploymentSettingsBody, PurposeParams } from "../../admin/admin.schemas.js";
|
|
13
13
|
import { AuditListQuery } from "../../admin/audit.schemas.js";
|
|
14
|
+
import { AuditLogService } from "../../admin/audit-log.service.js";
|
|
14
15
|
import { AdminHealthService } from "../../admin/health.service.js";
|
|
15
16
|
import { UsageQuery } from "../../admin/overview.schemas.js";
|
|
16
17
|
import { AdminOverviewService } from "../../admin/overview.service.js";
|
|
17
|
-
import { PlatformAuditService } from "../../admin/platform-audit.service.js";
|
|
18
18
|
import { AdminUsageService } from "../../admin/usage.service.js";
|
|
19
19
|
import { ApiError } from "../../errors.js";
|
|
20
20
|
import { ExtensionDisplayNames } from "../../extensions/display-name.js";
|
|
@@ -154,7 +154,7 @@ let AdminOperations = class AdminOperations {
|
|
|
154
154
|
}),
|
|
155
155
|
defineOperation({
|
|
156
156
|
id: "admin.attention",
|
|
157
|
-
description: "What needs the super admin besides the platform inbox (super admin), one compact row each (kind, id, name, state, reason, next step): extensions (reason config, load_failed, approval, dependency, conflict,
|
|
157
|
+
description: "What needs the super admin besides the platform inbox (super admin), one compact row each (kind, id, name, state, reason, next step): extensions (reason config, load_failed, approval, dependency, conflict, or converging), platform plugins with a newer marketplace version (reason names both versions) model providers (reason list_failed or no_chat_model) background work the kernel could not queue (kind outbox: how many outbox rows are dead and since when) and run jobs the queue lost (kind queue: Redis lost data; the runs were queued again). Each kind lists at most 20 rows; more counts the rest per kind. unavailable names a kind that could not be read right now (try again later). The platform inbox itself is inbox.platform-list.",
|
|
158
158
|
input: z.object({}).strict(),
|
|
159
159
|
example: {},
|
|
160
160
|
authz: { superAdmin: true },
|
|
@@ -190,13 +190,16 @@ let AdminOperations = class AdminOperations {
|
|
|
190
190
|
}),
|
|
191
191
|
defineOperation({
|
|
192
192
|
id: "admin.audit",
|
|
193
|
-
description: "The platform-level audit log (super admin), newest first: deployment settings, accounts, marketplaces, catalog imports and scope, extensions, model prices and purposes, setup. Each event has its id, time, actor (id, name, email; null for the kernel itself), viaToken (done with a personal access token), viaAgent (done through the Platform tool), action and target; never the event's details, and never an org's own events. limit is 1 to 100 (default 20); pages by keyset: pass the returned next as params.after (null: no more).",
|
|
194
|
-
|
|
193
|
+
description: "The platform-level audit log (super admin), newest first: deployment settings, accounts, marketplaces, catalog imports and scope, extensions, model prices and purposes, setup. Each event has its id, time, actor (id, name, email; null for the kernel itself), viaToken (done with a personal access token), viaAgent (done through the Platform tool), action and target; never the event's details, and never an org's own events (an org's log is orgs.audit, in that org). action filters by an action name or its prefix (e.g. marketplace.). limit is 1 to 100 (default 20); pages by keyset: pass the returned next as params.after (null: no more).",
|
|
194
|
+
// Another org's events are never read through an agent (the conversation's org: orgs.audit).
|
|
195
|
+
// The route's `orgId` query field is left out; parity treats `orgId` as implicit (never an
|
|
196
|
+
// operation field), so it needs no `omits` entry.
|
|
197
|
+
input: AuditListQuery.omit({ orgId: true }).strict(),
|
|
195
198
|
example: { limit: 20 },
|
|
196
199
|
authz: { superAdmin: true },
|
|
197
200
|
mirrors: ["GET /api/v1/admin/audit"],
|
|
198
201
|
confirm: "read",
|
|
199
|
-
run: (input) => this.audit.list(input),
|
|
202
|
+
run: (input) => this.audit.list({ platform: true }, input),
|
|
200
203
|
}),
|
|
201
204
|
defineOperation({
|
|
202
205
|
id: "admin.settings",
|
|
@@ -538,7 +541,7 @@ AdminOperations = __decorate([
|
|
|
538
541
|
__param(6, Inject(PricesService)),
|
|
539
542
|
__param(7, Inject(ModelPurposesService)),
|
|
540
543
|
__param(8, Inject(ThemesService)),
|
|
541
|
-
__param(9, Inject(
|
|
544
|
+
__param(9, Inject(AuditLogService)),
|
|
542
545
|
__param(10, Inject(AdminOverviewService)),
|
|
543
546
|
__param(11, Inject(AdminHealthService)),
|
|
544
547
|
__param(12, Inject(AdminUsageService))
|
|
@@ -696,7 +696,7 @@ let AgentsOperations = class AgentsOperations {
|
|
|
696
696
|
}),
|
|
697
697
|
defineOperation({
|
|
698
698
|
id: "agents.readiness",
|
|
699
|
-
description: "Whether the org can run agents: modelProvider is ready when a model provider is available in the org
|
|
699
|
+
description: "Whether the org can run agents: modelProvider is ready when a model provider is available in the org; org_fixable when an org admin can make one available on Settings > Models (orgFixableProviders names each provider and its reason: not_enabled, switch it on; needs_config, fill the org's config); none when only the super admin can help; and how many agents you can see.",
|
|
700
700
|
input: z.object({}).strict(),
|
|
701
701
|
example: {},
|
|
702
702
|
authz: { orgAction: "org.read" },
|
|
@@ -10,7 +10,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
10
10
|
import { Inject, Injectable } from "@nestjs/common";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { ComponentScopeService } from "../../catalog/component-scope.service.js";
|
|
13
|
-
import { ConnectorPathParams } from "../../tools/connectors.schemas.js";
|
|
13
|
+
import { ConnectorPathParams, GitPushPolicyBody } from "../../tools/connectors.schemas.js";
|
|
14
14
|
import { ConnectorsService, } from "../../tools/connectors.service.js";
|
|
15
15
|
import { publicEndpoint } from "../../tools/endpoint.js";
|
|
16
16
|
import { defineOperation } from "../operation.js";
|
|
@@ -19,6 +19,11 @@ import { precheckBy, viaAgent } from "./errors.js";
|
|
|
19
19
|
import { Cursor, pageOf, startOf } from "./paging.js";
|
|
20
20
|
import { named, orElse } from "./summary.js";
|
|
21
21
|
const PAGE = 50;
|
|
22
|
+
/** `connectors.set-git-push-policy`: the route's path param and body. */
|
|
23
|
+
const SetGitPushPolicyInput = z
|
|
24
|
+
.object({ connectorId: ConnectorPathParams.shape.connectorId.max(100) })
|
|
25
|
+
.extend(GitPushPolicyBody.shape)
|
|
26
|
+
.strict();
|
|
22
27
|
/**
|
|
23
28
|
* A connector without anything secret: the auth method and who holds the credential (the org or
|
|
24
29
|
* each person), never the auth preset's fields or a credential. The endpoint is always the public
|
|
@@ -42,6 +47,8 @@ const summary = (c) => ({
|
|
|
42
47
|
/** A connector's detail: its tools (name, description, state, default policy) and your credential state. */
|
|
43
48
|
const detail = (c) => ({
|
|
44
49
|
...summary(c),
|
|
50
|
+
// the org's default for git pushes through its credential, when it serves git hosts
|
|
51
|
+
gitPushPolicy: c.git !== null ? c.gitPushPolicy : null,
|
|
45
52
|
credential: c.credential,
|
|
46
53
|
tools: c.tools.map((t) => ({
|
|
47
54
|
name: t.name,
|
|
@@ -178,6 +185,44 @@ let ConnectorsOperations = class ConnectorsOperations {
|
|
|
178
185
|
return { connector: detail(r.connector), issues: r.issues, changes: r.changes };
|
|
179
186
|
},
|
|
180
187
|
}),
|
|
188
|
+
defineOperation({
|
|
189
|
+
id: "connectors.set-git-push-policy",
|
|
190
|
+
description: "Set the org's default for git pushes through a connector's credential in sandboxes (org admins): deny refuses every push, ask asks the person for each repository, allow pushes without asking. Through this tool it may only be tightened (allow to ask or deny, ask to deny); loosening needs a person on the connector's settings page. Only a connector that declares git hosts.",
|
|
191
|
+
input: SetGitPushPolicyInput,
|
|
192
|
+
example: { connectorId: "5d2e8f1a-0b3c-4d5e-8f9a-1b2c3d4e5f60", policy: "deny" },
|
|
193
|
+
authz: { orgAction: "connectors.manage" },
|
|
194
|
+
mirrors: ["PUT /api/v1/orgs/:orgId/connectors/:connectorId/git-push-policy"],
|
|
195
|
+
confirm: "org",
|
|
196
|
+
errors: [
|
|
197
|
+
{ code: "connector.not_found", next: "Check the connector id with connectors.list." },
|
|
198
|
+
{
|
|
199
|
+
code: "connector.git_push_widen_not_allowed",
|
|
200
|
+
next: {
|
|
201
|
+
orgAdmin: "Loosen the git push policy yourself on the connector's settings page on the web.",
|
|
202
|
+
member: "Ask an org admin to loosen the git push policy on the connector's settings page on the web.",
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
code: "validation_failed",
|
|
207
|
+
next: "The connector declares no git hosts, so it has no git push policy; connectors.get shows gitPushPolicy null for such a connector.",
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
precheck: (i, ctx) => precheckBy(() => this.connectors.checkGitPushPolicy(ctx.orgId, i.connectorId, i.policy, true)),
|
|
211
|
+
summary: async (i, ctx) => {
|
|
212
|
+
const n = await this.connectorName(ctx, i.connectorId);
|
|
213
|
+
const zh = { allow: "允许", ask: "需审批", deny: "禁止" }[i.policy];
|
|
214
|
+
return {
|
|
215
|
+
zh: `把连接器「${n}」的 git 推送默认策略设为「${zh}」`,
|
|
216
|
+
en: `Set the default git push policy of connector "${n}" to ${i.policy}`,
|
|
217
|
+
};
|
|
218
|
+
},
|
|
219
|
+
run: async (input, ctx) => ({
|
|
220
|
+
connector: detail(await this.connectors.setGitPushPolicy(ctx.orgId, input.connectorId, ctx.actorAccountId, input.policy, {
|
|
221
|
+
auditDetail: viaAgent("connectors.set-git-push-policy", ctx),
|
|
222
|
+
onlyNarrows: true,
|
|
223
|
+
})),
|
|
224
|
+
}),
|
|
225
|
+
}),
|
|
181
226
|
]);
|
|
182
227
|
}
|
|
183
228
|
};
|
|
@@ -313,70 +313,7 @@ let EvalsOperations = class EvalsOperations {
|
|
|
313
313
|
},
|
|
314
314
|
],
|
|
315
315
|
precheck: async (i, ctx) => {
|
|
316
|
-
|
|
317
|
-
if (!found.ok)
|
|
318
|
-
return found;
|
|
319
|
-
const set = await this.sets.get(ctx.orgId, i.setId);
|
|
320
|
-
const conv = await this.kdb.db
|
|
321
|
-
.selectFrom("conversations")
|
|
322
|
-
.select(["agent_id", "kind"])
|
|
323
|
-
.where("id", "=", i.conversationId)
|
|
324
|
-
.where("org_id", "=", ctx.orgId)
|
|
325
|
-
.executeTakeFirst();
|
|
326
|
-
if (conv?.kind !== "chat" && conv?.kind !== "subagent") {
|
|
327
|
-
return {
|
|
328
|
-
ok: false,
|
|
329
|
-
code: "conversation.not_found",
|
|
330
|
-
message: "Conversation or run not found",
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
const sets = await this.kdb.db
|
|
334
|
-
.selectFrom("eval_sets")
|
|
335
|
-
.select("agent_id")
|
|
336
|
-
.where("id", "=", i.setId)
|
|
337
|
-
.executeTakeFirstOrThrow();
|
|
338
|
-
if (conv.agent_id !== sets.agent_id) {
|
|
339
|
-
return {
|
|
340
|
-
ok: false,
|
|
341
|
-
code: "eval.agent_mismatch",
|
|
342
|
-
message: "The run belongs to a different agent",
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
if (set.cases.some((c) => c.sourceRunId === i.runId)) {
|
|
346
|
-
return {
|
|
347
|
-
ok: false,
|
|
348
|
-
code: "eval.case_exists",
|
|
349
|
-
message: "That run is already a case of the eval set",
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
const run = await this.kdb.db
|
|
353
|
-
.selectFrom("runs")
|
|
354
|
-
.select(["status", "compact"])
|
|
355
|
-
.where("id", "=", i.runId)
|
|
356
|
-
.where("conversation_id", "=", i.conversationId)
|
|
357
|
-
.executeTakeFirst();
|
|
358
|
-
if (run === undefined) {
|
|
359
|
-
return {
|
|
360
|
-
ok: false,
|
|
361
|
-
code: "conversation.not_found",
|
|
362
|
-
message: "Conversation or run not found",
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
if (run.compact) {
|
|
366
|
-
return {
|
|
367
|
-
ok: false,
|
|
368
|
-
code: "eval.compact_not_replayable",
|
|
369
|
-
message: "A manual compaction run has no model step to replay",
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
if (run.status === "running" || run.status === "queued") {
|
|
373
|
-
return {
|
|
374
|
-
ok: false,
|
|
375
|
-
code: "eval.run_not_finished",
|
|
376
|
-
message: "The run has not finished yet",
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
return this.roomCheck(ctx, i.setId);
|
|
316
|
+
return precheckBy(() => this.sets.checkAddCase(ctx.orgId, i.setId, i));
|
|
380
317
|
},
|
|
381
318
|
summary: async (i, ctx) => {
|
|
382
319
|
const n = await this.setName(ctx, i.setId);
|
|
@@ -132,7 +132,7 @@ let ExtensionsAdminOperations = class ExtensionsAdminOperations {
|
|
|
132
132
|
this.registry.register([
|
|
133
133
|
defineOperation({
|
|
134
134
|
id: "extensions.platform-list",
|
|
135
|
-
description: "List the extensions on the platform (super admin), one compact row each: the deployment status (enabled, disabled, pending_approval, pending_config, pending_migration, converging, failed, dependency, conflict
|
|
135
|
+
description: "List the extensions on the platform (super admin), one compact row each: the deployment status (enabled, disabled, pending_approval, pending_config, pending_migration, converging, failed, dependency, conflict), why one does not run (reason) and your next step (next), its version, how many orgs have it on and whether it is required. Extensions only other orgs' own plugins bring are counted (otherOrgExtensions), never listed. Details come from extensions.platform-get. Pages by 50: pass the returned next as params.cursor.",
|
|
136
136
|
input: z.object({ cursor: Cursor.optional() }).strict(),
|
|
137
137
|
example: {},
|
|
138
138
|
authz: { superAdmin: true },
|
|
@@ -180,6 +180,16 @@ function platformRow(i) {
|
|
|
180
180
|
next: "Open the plugin in the admin console to see the error and retry.",
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
+
case "extension_disabled": {
|
|
184
|
+
const d = i.disabled;
|
|
185
|
+
return {
|
|
186
|
+
...base,
|
|
187
|
+
name: d.item.name,
|
|
188
|
+
state: "disabled",
|
|
189
|
+
summary: `Plugin ${d.item.name} is on by its scope, but its extension ${d.extension.name} ${d.extension.version} is disabled on the deployment, so it is installed in no org that lacks it.`,
|
|
190
|
+
next: "Enable the extension in the admin console (or disable another provider of its single-provider extension point first); the enable syncs the plugin's scope.",
|
|
191
|
+
};
|
|
192
|
+
}
|
|
183
193
|
case "ownership_transferred":
|
|
184
194
|
return {
|
|
185
195
|
...base,
|
|
@@ -307,7 +317,7 @@ let InboxOperations = class InboxOperations {
|
|
|
307
317
|
}),
|
|
308
318
|
defineOperation({
|
|
309
319
|
id: "inbox.platform-list",
|
|
310
|
-
description: "List the platform inbox (super admin), newest first, one compact row each (type, what, state, summary, next step): orgs' requests to the platform, plugins waiting for a permission confirmation, this org's uploads waiting for you, failed scope syncs and ownership notices. Only the newest 100 items are read (truncated: more wait); listed is how many of them are shown, otherOrgItems how many are items of plugins other orgs own (only counted). total counts everything waiting on the platform, other orgs' items included, as the admin console does; byType splits total by type (everything waiting, not the listed page). Nothing is decided here: requests and confirmations are done in the admin console. Pages by 50: pass the returned next as params.cursor.",
|
|
320
|
+
description: "List the platform inbox (super admin), newest first, one compact row each (type, what, state, summary, next step): orgs' requests to the platform, plugins waiting for a permission confirmation, this org's uploads waiting for you, failed scope syncs, plugins on by scope whose extension is disabled, and ownership notices. Only the newest 100 items are read (truncated: more wait); listed is how many of them are shown, otherOrgItems how many are items of plugins other orgs own (only counted). total counts everything waiting on the platform, other orgs' items included, as the admin console does; byType splits total by type (everything waiting, not the listed page). Nothing is decided here: requests and confirmations are done in the admin console. Pages by 50: pass the returned next as params.cursor.",
|
|
311
321
|
input: z.object({ cursor: Cursor.optional() }).strict(),
|
|
312
322
|
example: {},
|
|
313
323
|
authz: { superAdmin: true },
|
|
@@ -320,7 +330,9 @@ let InboxOperations = class InboxOperations {
|
|
|
320
330
|
? [i.item.id]
|
|
321
331
|
: i.type === "scope_sync_failed"
|
|
322
332
|
? [i.failure.item.id]
|
|
323
|
-
:
|
|
333
|
+
: i.type === "extension_disabled"
|
|
334
|
+
? [i.disabled.item.id]
|
|
335
|
+
: []);
|
|
324
336
|
const owners = await this.owners(itemIds);
|
|
325
337
|
const theirs = (itemId) => {
|
|
326
338
|
const o = owners.get(itemId);
|
|
@@ -328,7 +340,8 @@ let InboxOperations = class InboxOperations {
|
|
|
328
340
|
};
|
|
329
341
|
const shown = view.items.filter((i) => !(((i.type === "org_upload_pending" || i.type === "permission_confirmation") &&
|
|
330
342
|
theirs(i.item.id)) ||
|
|
331
|
-
(i.type === "scope_sync_failed" && theirs(i.failure.item.id))
|
|
343
|
+
(i.type === "scope_sync_failed" && theirs(i.failure.item.id)) ||
|
|
344
|
+
(i.type === "extension_disabled" && theirs(i.disabled.item.id))));
|
|
332
345
|
const page = pageOf(shown.map(platformRow), startOf(input.cursor), 50);
|
|
333
346
|
// total is the console's count of everything waiting (other orgs' items included): when
|
|
334
347
|
// the inbox is truncated the items past the newest 100 cannot be told apart, so the
|
|
@@ -101,7 +101,7 @@ let OrgPluginsOperations = class OrgPluginsOperations {
|
|
|
101
101
|
this.registry.register([
|
|
102
102
|
defineOperation({
|
|
103
103
|
id: "plugins.installs",
|
|
104
|
-
description: "List the plugin installs of this org (org admins), one compact row each: the plugin, the install state (installing, installed, failed, uninstalling
|
|
104
|
+
description: "List the plugin installs of this org (org admins), one compact row each: the plugin, the install state (installing, installed, failed, uninstalling), a failure's step and code (reason), the version and how many components it brought. Pages by 50: pass the returned next as params.cursor.",
|
|
105
105
|
input: z.object({ cursor: Cursor.optional() }).strict(),
|
|
106
106
|
example: {},
|
|
107
107
|
authz: { orgAction: "org.extensions.manage" },
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { type OnModuleInit } from "@nestjs/common";
|
|
2
|
+
import { AuditLogService } from "../../admin/audit-log.service.js";
|
|
3
|
+
import { OrgNetworkAdmin } from "../../admin/org-network.service.js";
|
|
2
4
|
import { AccountsService } from "../../identity/accounts.js";
|
|
3
5
|
import { SettingsService } from "../../identity/settings.js";
|
|
4
6
|
import { KernelConfigService } from "../../infra/config/kernel-config.service.js";
|
|
5
7
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
6
8
|
import { MembersService } from "../../orgs/members.service.js";
|
|
9
|
+
import { OrgNetworkAllowances } from "../../orgs/network-allowances.service.js";
|
|
7
10
|
import { OrgsService } from "../../orgs/orgs.service.js";
|
|
8
11
|
import { PlatformOperations } from "../registry.js";
|
|
9
12
|
/**
|
|
10
13
|
* Org operations of the `Platform` tool (spec §14.2): the super admin's view of every org (list,
|
|
11
14
|
* get, the per-org limits) through their own private agent, and the conversation's org for its
|
|
12
|
-
* members (read, rename, member list). Creating, deleting and
|
|
13
|
-
* member role changes and removal stay on the web (human-only).
|
|
15
|
+
* members (read, rename, member list, the org audit log for its admins). Creating, deleting and
|
|
16
|
+
* transferring an org, invitations, member role changes and removal stay on the web (human-only).
|
|
14
17
|
*/
|
|
15
18
|
export declare class OrgsOperations implements OnModuleInit {
|
|
16
19
|
private readonly registry;
|
|
@@ -20,9 +23,14 @@ export declare class OrgsOperations implements OnModuleInit {
|
|
|
20
23
|
private readonly accounts;
|
|
21
24
|
private readonly config;
|
|
22
25
|
private readonly kdb;
|
|
23
|
-
|
|
26
|
+
private readonly audit;
|
|
27
|
+
private readonly networkAdmin;
|
|
28
|
+
private readonly allowances;
|
|
29
|
+
constructor(registry: PlatformOperations, orgs: OrgsService, members: MembersService, settings: SettingsService, accounts: AccountsService, config: KernelConfigService, kdb: KernelDb, audit: AuditLogService, networkAdmin: OrgNetworkAdmin, allowances: OrgNetworkAllowances);
|
|
24
30
|
private org;
|
|
25
31
|
/** The actor as `OrgsService.update` takes it (it re-checks the role under the org lock). */
|
|
26
32
|
private actor;
|
|
33
|
+
/** The org's allowance `id` (for a card and the remove precheck); none → the remove's 404. */
|
|
34
|
+
private allowance;
|
|
27
35
|
onModuleInit(): void;
|
|
28
36
|
}
|
|
@@ -9,14 +9,19 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Inject, Injectable } from "@nestjs/common";
|
|
11
11
|
import { z } from "zod";
|
|
12
|
+
import { OrgAuditListQuery } from "../../admin/audit.schemas.js";
|
|
13
|
+
import { AuditLogService } from "../../admin/audit-log.service.js";
|
|
12
14
|
import { limitDefaults } from "../../admin/limit-defaults.js";
|
|
15
|
+
import { NetworkAllowanceBody, NetworkAllowanceParams } from "../../admin/org-network.schemas.js";
|
|
16
|
+
import { OrgNetworkAdmin } from "../../admin/org-network.service.js";
|
|
13
17
|
import { ApiError } from "../../errors.js";
|
|
14
18
|
import { AccountsService } from "../../identity/accounts.js";
|
|
15
19
|
import { DEPLOYMENT_SETTINGS_PATCH, SettingsService } from "../../identity/settings.js";
|
|
16
20
|
import { KernelConfigService } from "../../infra/config/kernel-config.service.js";
|
|
17
21
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
18
22
|
import { MembersService } from "../../orgs/members.service.js";
|
|
19
|
-
import {
|
|
23
|
+
import { OrgNetworkAllowances } from "../../orgs/network-allowances.service.js";
|
|
24
|
+
import { networkAllowanceView, OrgUpdateBody } from "../../orgs/orgs.schemas.js";
|
|
20
25
|
import { OrgsService } from "../../orgs/orgs.service.js";
|
|
21
26
|
import { defineOperation } from "../operation.js";
|
|
22
27
|
import { PlatformOperations } from "../registry.js";
|
|
@@ -43,8 +48,8 @@ async function limitsOf(settings, orgId) {
|
|
|
43
48
|
/**
|
|
44
49
|
* Org operations of the `Platform` tool (spec §14.2): the super admin's view of every org (list,
|
|
45
50
|
* get, the per-org limits) through their own private agent, and the conversation's org for its
|
|
46
|
-
* members (read, rename, member list). Creating, deleting and
|
|
47
|
-
* member role changes and removal stay on the web (human-only).
|
|
51
|
+
* members (read, rename, member list, the org audit log for its admins). Creating, deleting and
|
|
52
|
+
* transferring an org, invitations, member role changes and removal stay on the web (human-only).
|
|
48
53
|
*/
|
|
49
54
|
let OrgsOperations = class OrgsOperations {
|
|
50
55
|
registry;
|
|
@@ -54,7 +59,10 @@ let OrgsOperations = class OrgsOperations {
|
|
|
54
59
|
accounts;
|
|
55
60
|
config;
|
|
56
61
|
kdb;
|
|
57
|
-
|
|
62
|
+
audit;
|
|
63
|
+
networkAdmin;
|
|
64
|
+
allowances;
|
|
65
|
+
constructor(registry, orgs, members, settings, accounts, config, kdb, audit, networkAdmin, allowances) {
|
|
58
66
|
this.registry = registry;
|
|
59
67
|
this.orgs = orgs;
|
|
60
68
|
this.members = members;
|
|
@@ -62,6 +70,9 @@ let OrgsOperations = class OrgsOperations {
|
|
|
62
70
|
this.accounts = accounts;
|
|
63
71
|
this.config = config;
|
|
64
72
|
this.kdb = kdb;
|
|
73
|
+
this.audit = audit;
|
|
74
|
+
this.networkAdmin = networkAdmin;
|
|
75
|
+
this.allowances = allowances;
|
|
65
76
|
}
|
|
66
77
|
async org(orgId) {
|
|
67
78
|
const o = await this.orgs.get(orgId);
|
|
@@ -76,6 +87,14 @@ let OrgsOperations = class OrgsOperations {
|
|
|
76
87
|
throw new ApiError("forbidden", "Your account no longer exists");
|
|
77
88
|
return a;
|
|
78
89
|
}
|
|
90
|
+
/** The org's allowance `id` (for a card and the remove precheck); none → the remove's 404. */
|
|
91
|
+
async allowance(orgId, id) {
|
|
92
|
+
const a = (await this.networkAdmin.list(orgId)).find((x) => x.id === id);
|
|
93
|
+
if (!a) {
|
|
94
|
+
throw new ApiError("org.network_allowance_not_found", "The organization has no such internal endpoint allowance");
|
|
95
|
+
}
|
|
96
|
+
return a;
|
|
97
|
+
}
|
|
79
98
|
onModuleInit() {
|
|
80
99
|
this.registry.register([
|
|
81
100
|
defineOperation({
|
|
@@ -211,6 +230,108 @@ let OrgsOperations = class OrgsOperations {
|
|
|
211
230
|
};
|
|
212
231
|
},
|
|
213
232
|
}),
|
|
233
|
+
defineOperation({
|
|
234
|
+
id: "admin.org-network-allowances",
|
|
235
|
+
description: "List an org's internal endpoint allowances (super admin): the hosts, wildcards, IPs or CIDRs and origins the org's extension requests may reach although they resolve to private or loopback addresses, oldest first, each with its id, entry and when it was added. Add one with admin.org-network-allowance-add, remove one with admin.org-network-allowance-remove.",
|
|
236
|
+
input: z.object({ orgId: OrgId }).strict(),
|
|
237
|
+
example: { orgId: "00000000-0000-4000-8000-000000000000" },
|
|
238
|
+
authz: { superAdmin: true },
|
|
239
|
+
mirrors: ["GET /api/v1/admin/orgs/:orgId/network-allowances"],
|
|
240
|
+
extras: ["orgId"],
|
|
241
|
+
confirm: "read",
|
|
242
|
+
errors: [
|
|
243
|
+
{
|
|
244
|
+
code: "org.not_found",
|
|
245
|
+
next: "Look the org up with orgs.list and pass its id.",
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
run: async (input) => ({
|
|
249
|
+
allowances: (await this.networkAdmin.list(input.orgId)).map(networkAllowanceView),
|
|
250
|
+
}),
|
|
251
|
+
}),
|
|
252
|
+
defineOperation({
|
|
253
|
+
id: "admin.org-network-allowance-add",
|
|
254
|
+
description: "Let an org's extension requests reach an internal endpoint (super admin): entry is a hostname or *.domain wildcard (https, any port), an IP address or CIDR such as 10.1.0.0/16 (IP-literal URLs only), or an origin such as http://mcp.internal:8080 (exactly that scheme, host and port; plain http allowed). Link-local (cloud metadata), loopback and unspecified addresses are never allowed. Only a person widens: through this tool the add is always refused, and the super admin adds the endpoint in the admin console on the web; listing and removing work here.",
|
|
255
|
+
input: NetworkAllowanceBody.extend({ orgId: OrgId }).strict(),
|
|
256
|
+
example: {
|
|
257
|
+
orgId: "00000000-0000-4000-8000-000000000000",
|
|
258
|
+
entry: "http://mcp.internal:8080",
|
|
259
|
+
},
|
|
260
|
+
authz: { superAdmin: true },
|
|
261
|
+
mirrors: ["POST /api/v1/admin/orgs/:orgId/network-allowances"],
|
|
262
|
+
extras: ["orgId"],
|
|
263
|
+
confirm: "platform",
|
|
264
|
+
errors: [
|
|
265
|
+
{
|
|
266
|
+
code: "org.not_found",
|
|
267
|
+
next: "Look the org up with orgs.list and pass its id.",
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
code: "org.network_allowance_widen_not_allowed",
|
|
271
|
+
next: "Add the internal endpoint yourself on the org's page in the admin console on the web.",
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
precheck: (i) => precheckBy(() => this.networkAdmin.checkAdd(i.orgId, i.entry, true)),
|
|
275
|
+
summary: async (i) => {
|
|
276
|
+
const name = await orElse(async () => named((await this.org(i.orgId)).name), i.orgId);
|
|
277
|
+
const entry = named(i.entry.trim());
|
|
278
|
+
return {
|
|
279
|
+
zh: `允许组织「${name}」的扩展请求访问内部端点 ${entry}`,
|
|
280
|
+
en: `Let the extension requests of org "${name}" reach the internal endpoint ${entry}`,
|
|
281
|
+
};
|
|
282
|
+
},
|
|
283
|
+
run: async (input, ctx) => ({
|
|
284
|
+
allowance: networkAllowanceView(await this.networkAdmin.add(input.orgId, input.entry, { accountId: ctx.actorAccountId }, true, viaAgent("admin.org-network-allowance-add", ctx))),
|
|
285
|
+
}),
|
|
286
|
+
}),
|
|
287
|
+
defineOperation({
|
|
288
|
+
id: "admin.org-network-allowance-remove",
|
|
289
|
+
description: "Remove one of an org's internal endpoint allowances (super admin) by its id (admin.org-network-allowances): the org's extension requests to that endpoint are refused from the next request on. The org's audit log records it.",
|
|
290
|
+
input: NetworkAllowanceParams.extend({ orgId: OrgId }).strict(),
|
|
291
|
+
example: {
|
|
292
|
+
orgId: "00000000-0000-4000-8000-000000000000",
|
|
293
|
+
id: "00000000-0000-4000-8000-000000000001",
|
|
294
|
+
},
|
|
295
|
+
authz: { superAdmin: true },
|
|
296
|
+
mirrors: ["DELETE /api/v1/admin/orgs/:orgId/network-allowances/:id"],
|
|
297
|
+
extras: ["orgId"],
|
|
298
|
+
confirm: "platform",
|
|
299
|
+
errors: [
|
|
300
|
+
{
|
|
301
|
+
code: "org.not_found",
|
|
302
|
+
next: "Look the org up with orgs.list and pass its id.",
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
code: "org.network_allowance_not_found",
|
|
306
|
+
next: "List the org's allowances again with admin.org-network-allowances and pass one of their ids.",
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
precheck: (i) => precheckBy(() => this.allowance(i.orgId, i.id)),
|
|
310
|
+
summary: async (i) => {
|
|
311
|
+
const name = await orElse(async () => named((await this.org(i.orgId)).name), i.orgId);
|
|
312
|
+
const entry = await orElse(async () => named((await this.allowance(i.orgId, i.id)).entry), i.id);
|
|
313
|
+
return {
|
|
314
|
+
zh: `移除组织「${name}」的内部端点 ${entry},该组织的扩展请求将无法再访问它`,
|
|
315
|
+
en: `Remove the internal endpoint ${entry} of org "${name}"; the org's extension requests can no longer reach it`,
|
|
316
|
+
};
|
|
317
|
+
},
|
|
318
|
+
run: async (input, ctx) => {
|
|
319
|
+
await this.networkAdmin.remove(input.orgId, input.id, { accountId: ctx.actorAccountId }, viaAgent("admin.org-network-allowance-remove", ctx));
|
|
320
|
+
return { id: input.id, removed: true };
|
|
321
|
+
},
|
|
322
|
+
}),
|
|
323
|
+
defineOperation({
|
|
324
|
+
id: "orgs.network-allowances",
|
|
325
|
+
description: "Read this conversation's org's internal endpoint allowances (org admins, read-only): the hosts, wildcards, IPs or CIDRs and origins a super admin lets the org's extension requests reach although they resolve to private or loopback addresses. An extension request to an internal endpoint not listed is refused; only a super admin can add one.",
|
|
326
|
+
input: z.object({}).strict(),
|
|
327
|
+
example: {},
|
|
328
|
+
authz: { orgAction: "org.update" },
|
|
329
|
+
mirrors: ["GET /api/v1/orgs/:orgId/network-allowances"],
|
|
330
|
+
confirm: "read",
|
|
331
|
+
run: async (_input, ctx) => ({
|
|
332
|
+
allowances: (await this.allowances.list(ctx.orgId)).map(networkAllowanceView),
|
|
333
|
+
}),
|
|
334
|
+
}),
|
|
214
335
|
defineOperation({
|
|
215
336
|
id: "orgs.current",
|
|
216
337
|
description: "Read this conversation's org: its id, name, slug, when it was created, and your role in it.",
|
|
@@ -285,6 +406,16 @@ let OrgsOperations = class OrgsOperations {
|
|
|
285
406
|
...(m.anonymous && { anonymous: true }),
|
|
286
407
|
})), startOf(input.cursor), PAGE),
|
|
287
408
|
}),
|
|
409
|
+
defineOperation({
|
|
410
|
+
id: "orgs.audit",
|
|
411
|
+
description: "The audit log of this conversation's org (org admins), newest first: members and invitations, settings, agents, connectors, skills, plugins and extensions in the org, channels, schedules. Each event has its id, time, actor (id, name, email; null for the kernel itself), viaToken (done with a personal access token), viaAgent (done through the Platform tool), action and target; never the event's details. action filters by an action name or its prefix (e.g. org.member.). limit is 1 to 100 (default 20); pages by keyset: pass the returned next as params.after (null: no more).",
|
|
412
|
+
input: OrgAuditListQuery.strict(),
|
|
413
|
+
example: { limit: 20 },
|
|
414
|
+
authz: { orgAction: "org.update" },
|
|
415
|
+
mirrors: ["GET /api/v1/orgs/:orgId/audit"],
|
|
416
|
+
confirm: "read",
|
|
417
|
+
run: (input, ctx) => this.audit.list({ orgId: ctx.orgId }, input),
|
|
418
|
+
}),
|
|
288
419
|
]);
|
|
289
420
|
}
|
|
290
421
|
};
|
|
@@ -296,6 +427,9 @@ OrgsOperations = __decorate([
|
|
|
296
427
|
__param(3, Inject(SettingsService)),
|
|
297
428
|
__param(4, Inject(AccountsService)),
|
|
298
429
|
__param(5, Inject(KernelConfigService)),
|
|
299
|
-
__param(6, Inject(KernelDb))
|
|
430
|
+
__param(6, Inject(KernelDb)),
|
|
431
|
+
__param(7, Inject(AuditLogService)),
|
|
432
|
+
__param(8, Inject(OrgNetworkAdmin)),
|
|
433
|
+
__param(9, Inject(OrgNetworkAllowances))
|
|
300
434
|
], OrgsOperations);
|
|
301
435
|
export { OrgsOperations };
|
|
@@ -9,7 +9,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
9
9
|
};
|
|
10
10
|
import { Inject, Injectable } from "@nestjs/common";
|
|
11
11
|
import { z } from "zod";
|
|
12
|
-
import { OutboxDeadParams } from "../../admin/outbox-dead.schemas.js";
|
|
12
|
+
import { OutboxDeadListQuery, OutboxDeadParams } from "../../admin/outbox-dead.schemas.js";
|
|
13
13
|
import { OutboxDeadService } from "../../admin/outbox-dead.service.js";
|
|
14
14
|
import { KernelDb } from "../../infra/database/kernel-db.js";
|
|
15
15
|
import { defineOperation } from "../operation.js";
|
|
@@ -54,13 +54,13 @@ let OutboxOperations = class OutboxOperations {
|
|
|
54
54
|
this.registry.register([
|
|
55
55
|
defineOperation({
|
|
56
56
|
id: "admin.outbox-list-dead",
|
|
57
|
-
description: "List background work the kernel could not queue (super admin): outbox rows dead after their last delivery attempt, oldest first
|
|
58
|
-
input:
|
|
59
|
-
example: {},
|
|
57
|
+
description: "List background work the kernel could not queue (super admin): outbox rows dead after their last delivery attempt, oldest first, a page of at most 200 (pass the returned next as after for the following page; next is null at the end), each with its id, queue, job name, job id, org (null for platform work), attempts, last error and when it died. Retry one with admin.outbox-retry or drop it with admin.outbox-discard.",
|
|
58
|
+
input: OutboxDeadListQuery.strict(),
|
|
59
|
+
example: { limit: 200 },
|
|
60
60
|
authz: { superAdmin: true },
|
|
61
61
|
mirrors: ["GET /api/v1/admin/outbox/dead"],
|
|
62
62
|
confirm: "read",
|
|
63
|
-
run: () => this.dead.list(),
|
|
63
|
+
run: (input) => this.dead.list(input),
|
|
64
64
|
}),
|
|
65
65
|
defineOperation({
|
|
66
66
|
id: "admin.outbox-retry",
|
|
@@ -2,6 +2,7 @@ import { ADMIN_ROUTES } from "../admin/admin.schemas.js";
|
|
|
2
2
|
import { ADMIN_ITEM_ROUTES } from "../admin/admin-items.schemas.js";
|
|
3
3
|
import { AUDIT_ROUTES } from "../admin/audit.schemas.js";
|
|
4
4
|
import { ADMIN_EXTENSION_ROUTES } from "../admin/extensions.schemas.js";
|
|
5
|
+
import { ORG_NETWORK_ROUTES } from "../admin/org-network.schemas.js";
|
|
5
6
|
import { OUTBOX_DEAD_ROUTES } from "../admin/outbox-dead.schemas.js";
|
|
6
7
|
import { OVERVIEW_ROUTES } from "../admin/overview.schemas.js";
|
|
7
8
|
import { AGENT_ROUTES } from "../agents/agents.schemas.js";
|
|
@@ -88,4 +89,6 @@ export const ROUTE_SCHEMAS = [
|
|
|
88
89
|
...AUDIT_ROUTES,
|
|
89
90
|
// dead outbox rows (transactional outbox spec §3.4)
|
|
90
91
|
...OUTBOX_DEAD_ROUTES,
|
|
92
|
+
// org network allowances (plugin safe fetch spec)
|
|
93
|
+
...ORG_NETWORK_ROUTES,
|
|
91
94
|
];
|
|
@@ -49,10 +49,9 @@ export declare class WorkerRole {
|
|
|
49
49
|
* Starts the queue consumers (after the extension load), then opens the schedules' start gate:
|
|
50
50
|
* the cron and interval timers were armed at application bootstrap, but every tick before this
|
|
51
51
|
* point skipped (decision R21 of the Nest kernel spec); the `@LockedInterval({ runOnStart })`
|
|
52
|
-
* jobs run now, in the background (once across replicas starting together).
|
|
53
|
-
* when a stop began meanwhile.
|
|
52
|
+
* jobs run now, in the background (once across replicas starting together).
|
|
54
53
|
*/
|
|
55
|
-
start(
|
|
54
|
+
start(): void;
|
|
56
55
|
/**
|
|
57
56
|
* Closes the start gate and stops the schedulers (no new tick; the runs in progress get the stop
|
|
58
57
|
* signal) and returns the wait for those runs, at most `budgetMs`.
|
|
@@ -78,25 +78,15 @@ let WorkerRole = class WorkerRole {
|
|
|
78
78
|
* Starts the queue consumers (after the extension load), then opens the schedules' start gate:
|
|
79
79
|
* the cron and interval timers were armed at application bootstrap, but every tick before this
|
|
80
80
|
* point skipped (decision R21 of the Nest kernel spec); the `@LockedInterval({ runOnStart })`
|
|
81
|
-
* jobs run now, in the background (once across replicas starting together).
|
|
82
|
-
* when a stop began meanwhile.
|
|
81
|
+
* jobs run now, in the background (once across replicas starting together).
|
|
83
82
|
*/
|
|
84
|
-
|
|
83
|
+
start() {
|
|
85
84
|
// both run queues' @Processor workers (built with the run config, never autorun)
|
|
86
85
|
this.runWorker.start([this.runsProcessor.worker, this.subagentRunsProcessor.worker]);
|
|
87
86
|
this.runsStarted = true;
|
|
88
87
|
this.evalWorker.start(this.evalsProcessor.worker);
|
|
89
88
|
this.evalsStarted = true;
|
|
90
|
-
//
|
|
91
|
-
// replicas do it), then start its one consumer. A failure is only logged and does not stop the
|
|
92
|
-
// start (like the workers' connection errors): any worker replica removes them on its next start.
|
|
93
|
-
try {
|
|
94
|
-
await this.maintenanceProcessor.removeRetiredSchedulers();
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
this.log.error("cannot register maintenance job schedulers", { err });
|
|
98
|
-
}
|
|
99
|
-
checkpoint();
|
|
89
|
+
// the maintenance queue's one consumer
|
|
100
90
|
this.maintenanceProcessor.start();
|
|
101
91
|
this.scopeProcessor.start();
|
|
102
92
|
this.lifecycleProcessor.start();
|