@capybara-hq/kernel 0.1.0-rc.41 → 0.1.0-rc.43
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 +3 -3
- package/dist/admin/admin.schemas.d.ts +6 -0
- package/dist/admin/org-network.service.d.ts +3 -1
- package/dist/admin/org-network.service.js +10 -2
- package/dist/app.d.ts +4 -0
- package/dist/app.js +2 -0
- package/dist/background/finish.d.ts +9 -1
- package/dist/background/finish.js +57 -4
- package/dist/background/launch.d.ts +23 -0
- package/dist/background/launch.js +55 -1
- package/dist/background/managed-output.d.ts +110 -0
- package/dist/background/managed-output.js +219 -0
- package/dist/background/managed.d.ts +52 -0
- package/dist/background/managed.js +128 -0
- package/dist/background/poll.job.d.ts +35 -1
- package/dist/background/poll.job.js +174 -9
- package/dist/background/render.js +1 -0
- package/dist/background/retire-legacy-tasks.job.d.ts +57 -0
- package/dist/background/retire-legacy-tasks.job.js +149 -0
- package/dist/background/session.d.ts +15 -5
- package/dist/background/session.js +22 -6
- package/dist/background/stop.d.ts +35 -5
- package/dist/background/stop.js +94 -8
- package/dist/background/store.d.ts +110 -3
- package/dist/background/store.js +205 -3
- package/dist/background/tasks.service.d.ts +18 -1
- package/dist/background/tasks.service.js +99 -9
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/channels/cards.js +1 -1
- package/dist/channels/inbound.js +2 -0
- package/dist/channels/phrases.d.ts +4 -0
- package/dist/channels/phrases.js +4 -0
- package/dist/config/load.d.ts +18 -0
- package/dist/config/load.js +39 -1
- package/dist/config/permission-migration.d.ts +26 -0
- package/dist/config/permission-migration.js +64 -0
- package/dist/config/schema.d.ts +4 -1
- package/dist/config/schema.js +41 -10
- package/dist/conversations/conversations.controller.d.ts +1 -1
- package/dist/conversations/conversations.controller.js +1 -1
- package/dist/conversations/conversations.module.js +12 -0
- package/dist/conversations/conversations.service.d.ts +11 -2
- package/dist/conversations/conversations.service.js +97 -27
- package/dist/conversations/event-log.d.ts +1 -1
- package/dist/conversations/event-log.js +10 -2
- package/dist/conversations/events.d.ts +307 -4
- package/dist/conversations/events.js +286 -32
- package/dist/conversations/permission-profile-store.d.ts +50 -0
- package/dist/conversations/permission-profile-store.js +67 -0
- package/dist/conversations/permission-profile-store.module.d.ts +2 -0
- package/dist/conversations/permission-profile-store.module.js +19 -0
- package/dist/conversations/permission-profiles.controller.d.ts +84 -0
- package/dist/conversations/permission-profiles.controller.js +105 -0
- package/dist/conversations/permission-profiles.schemas.d.ts +31 -0
- package/dist/conversations/permission-profiles.schemas.js +23 -0
- package/dist/conversations/permission-profiles.service.d.ts +56 -0
- package/dist/conversations/permission-profiles.service.js +179 -0
- package/dist/ctx/create-ctx.d.ts +12 -5
- package/dist/ctx/create-ctx.js +21 -5
- package/dist/db/kernel-schema.d.ts +248 -3
- package/dist/devices/access.js +1 -1
- package/dist/devices/access.module.d.ts +2 -0
- package/dist/devices/access.module.js +19 -0
- package/dist/devices/conversation-devices.d.ts +8 -29
- package/dist/devices/conversation-devices.js +37 -73
- package/dist/devices/device-projects.service.d.ts +26 -28
- package/dist/devices/device-projects.service.js +123 -127
- package/dist/devices/devices.controller.js +3 -1
- package/dist/devices/devices.module.js +11 -9
- package/dist/devices/devices.service.d.ts +116 -8
- package/dist/devices/devices.service.js +252 -20
- package/dist/devices/dto.d.ts +16 -0
- package/dist/devices/dto.js +34 -6
- package/dist/devices/errors.d.ts +8 -0
- package/dist/devices/errors.js +10 -0
- package/dist/devices/project-rules.d.ts +44 -0
- package/dist/devices/project-rules.js +27 -0
- package/dist/devices/working-root.d.ts +6 -0
- package/dist/devices/working-root.js +12 -1
- package/dist/errors.d.ts +31 -0
- package/dist/errors.js +31 -0
- package/dist/evals/reconstruct.d.ts +19 -2
- package/dist/evals/reconstruct.js +40 -2
- package/dist/evals/recorded-permission-context.d.ts +77 -0
- package/dist/evals/recorded-permission-context.js +151 -0
- package/dist/evals/recorded-tools.d.ts +10 -1
- package/dist/evals/recorded-tools.js +27 -3
- package/dist/evals/run-replay.d.ts +8 -2
- package/dist/evals/run-replay.js +18 -2
- package/dist/evals/trajectory.d.ts +1 -1
- package/dist/evals/worker.d.ts +10 -1
- package/dist/evals/worker.js +23 -14
- package/dist/extensions/host.d.ts +4 -1
- package/dist/extensions/host.js +10 -6
- package/dist/http/api.module.js +2 -0
- package/dist/identity/accounts.d.ts +14 -1
- package/dist/identity/accounts.js +61 -5
- package/dist/identity/identity.module.js +2 -0
- package/dist/identity/settings.d.ts +28 -12
- package/dist/identity/settings.js +89 -33
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/dist/infra/cli/kernel-cli.module.d.ts +2 -2
- package/dist/infra/cli/kernel-cli.module.js +5 -2
- package/dist/infra/cli/permission-cutover.d.ts +59 -0
- package/dist/infra/cli/permission-cutover.js +107 -0
- package/dist/infra/config/kernel-config.service.d.ts +2 -2
- package/dist/infra/config/kernel-config.service.js +35 -11
- package/dist/infra/database/startup-activation-transaction.d.ts +36 -0
- package/dist/infra/database/startup-activation-transaction.js +242 -0
- package/dist/infra/database/transaction-host.d.ts +47 -0
- package/dist/infra/database/transaction-host.js +119 -0
- package/dist/infra/database/xact-lock.d.ts +1 -0
- package/dist/infra/database/xact-lock.js +6 -0
- package/dist/infra/outbox/registry.d.ts +39 -0
- package/dist/infra/outbox/registry.js +18 -0
- package/dist/kernel.module.js +2 -0
- package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
- package/dist/lifecycle/kernel-lifecycle.js +55 -28
- package/dist/local-devices/device-auth.js +1 -1
- package/dist/local-devices/device-policy.service.d.ts +35 -5
- package/dist/local-devices/device-policy.service.js +188 -13
- package/dist/local-devices/instance-bindings.d.ts +82 -0
- package/dist/local-devices/instance-bindings.js +304 -0
- package/dist/local-devices/keys.d.ts +5 -0
- package/dist/local-devices/keys.js +5 -0
- package/dist/local-devices/local-device-gateway.d.ts +19 -4
- package/dist/local-devices/local-device-gateway.js +185 -17
- package/dist/local-devices/local-device-provider.d.ts +42 -7
- package/dist/local-devices/local-device-provider.js +185 -10
- package/dist/local-devices/local-devices.module.d.ts +17 -2
- package/dist/local-devices/local-devices.module.js +49 -8
- package/dist/local-devices/machines.d.ts +35 -12
- package/dist/local-devices/machines.js +203 -8
- package/dist/local-devices/network-grants.js +3 -3
- package/dist/local-devices/network-grants.module.d.ts +2 -0
- package/dist/local-devices/network-grants.module.js +14 -0
- package/dist/local-devices/owner-report.d.ts +79 -0
- package/dist/local-devices/owner-report.js +155 -0
- package/dist/local-devices/owner-reports.d.ts +48 -0
- package/dist/local-devices/owner-reports.js +190 -0
- package/dist/local-devices/policy-summary.d.ts +24 -1
- package/dist/local-devices/policy-summary.js +48 -0
- package/dist/local-devices/relay.d.ts +82 -6
- package/dist/local-devices/relay.js +187 -16
- package/dist/local-devices/targets.d.ts +16 -1
- package/dist/local-devices/targets.js +35 -2
- package/dist/models/image-usable.d.ts +22 -0
- package/dist/models/image-usable.js +29 -0
- package/dist/models/images.d.ts +125 -0
- package/dist/models/images.js +440 -0
- package/dist/models/models.module.d.ts +3 -2
- package/dist/models/models.module.js +16 -5
- package/dist/models/org-models.schemas.js +1 -0
- package/dist/models/purposes.controller.d.ts +7 -0
- package/dist/models/purposes.controller.js +9 -0
- package/dist/models/purposes.d.ts +28 -3
- package/dist/models/purposes.js +40 -13
- package/dist/orgs/cloud-network-setting.d.ts +33 -0
- package/dist/orgs/cloud-network-setting.js +47 -0
- package/dist/orgs/offboarding.d.ts +3 -1
- package/dist/orgs/offboarding.js +8 -2
- package/dist/orgs/org-lock.d.ts +10 -4
- package/dist/orgs/org-lock.js +10 -4
- package/dist/orgs/orgs.service.d.ts +3 -1
- package/dist/orgs/orgs.service.js +8 -2
- package/dist/orgs/settings.controller.d.ts +4 -1
- package/dist/orgs/settings.controller.js +3 -3
- package/dist/orgs/settings.service.d.ts +48 -56
- package/dist/orgs/settings.service.js +144 -101
- package/dist/overrides.d.ts +6 -1
- package/dist/overrides.js +2 -0
- package/dist/platform/exclusions.js +20 -0
- package/dist/platform/ops/admin.ops.js +14 -11
- package/dist/platform/ops/agent-skills.ops.js +2 -0
- package/dist/platform/ops/devices.ops.js +10 -2
- package/dist/platform/ops/models.ops.js +10 -0
- package/dist/platform/ops/org-settings.ops.js +6 -6
- package/dist/platform/ops/orgs.ops.js +1 -0
- package/dist/roles/worker.module.js +4 -0
- package/dist/runtime/context/build.d.ts +3 -1
- package/dist/runtime/context/build.js +19 -3
- package/dist/runtime/context/compaction.js +5 -0
- package/dist/runtime/context/device-paths.d.ts +9 -2
- package/dist/runtime/context/device-paths.js +20 -0
- package/dist/runtime/context/permission-profile.d.ts +46 -0
- package/dist/runtime/context/permission-profile.js +194 -0
- package/dist/runtime/hook-calls.d.ts +11 -1
- package/dist/runtime/hook-calls.js +24 -1
- package/dist/runtime/maintenance.d.ts +7 -1
- package/dist/runtime/maintenance.js +43 -15
- package/dist/runtime/model-call.d.ts +32 -0
- package/dist/runtime/model-call.js +67 -0
- package/dist/runtime/permission-context-errors.d.ts +39 -0
- package/dist/runtime/permission-context-errors.js +67 -0
- package/dist/runtime/permission-context.service.d.ts +60 -0
- package/dist/runtime/permission-context.service.js +286 -0
- package/dist/runtime/project/knowledge.d.ts +7 -2
- package/dist/runtime/project/knowledge.js +5 -2
- package/dist/runtime/project/knowledge.service.d.ts +17 -2
- package/dist/runtime/project/knowledge.service.js +76 -12
- package/dist/runtime/providers.d.ts +9 -5
- package/dist/runtime/providers.js +22 -3
- package/dist/runtime/run-execution.d.ts +4 -1
- package/dist/runtime/run-execution.js +14 -5
- package/dist/runtime/run-steps.d.ts +11 -3
- package/dist/runtime/run-steps.js +27 -4
- package/dist/runtime/runtime.module.js +11 -0
- package/dist/runtime/usage-report.d.ts +10 -6
- package/dist/runtime/usage-report.js +31 -11
- package/dist/sandbox/attachments-path.d.ts +15 -0
- package/dist/sandbox/attachments-path.js +15 -0
- package/dist/sandbox/cloud-permission-snapshot.d.ts +159 -0
- package/dist/sandbox/cloud-permission-snapshot.js +407 -0
- package/dist/sandbox/cloud-permission-snapshot.module.d.ts +8 -0
- package/dist/sandbox/cloud-permission-snapshot.module.js +34 -0
- package/dist/sandbox/held-operations.d.ts +39 -0
- package/dist/sandbox/held-operations.js +119 -0
- package/dist/sandbox/jobs.d.ts +14 -3
- package/dist/sandbox/jobs.js +20 -2
- package/dist/sandbox/kernel-read.d.ts +55 -0
- package/dist/sandbox/kernel-read.js +57 -0
- package/dist/sandbox/legacy-retirement.d.ts +336 -0
- package/dist/sandbox/legacy-retirement.js +1063 -0
- package/dist/sandbox/legacy-retirement.module.d.ts +8 -0
- package/dist/sandbox/legacy-retirement.module.js +25 -0
- package/dist/sandbox/managed-device-context.d.ts +94 -0
- package/dist/sandbox/managed-device-context.js +308 -0
- package/dist/sandbox/managed-device-context.module.d.ts +6 -0
- package/dist/sandbox/managed-device-context.module.js +33 -0
- package/dist/sandbox/modes.d.ts +56 -8
- package/dist/sandbox/modes.js +92 -8
- package/dist/sandbox/operation-authority-types.d.ts +8 -0
- package/dist/sandbox/operation-authority-types.js +32 -0
- package/dist/sandbox/operation-authority.d.ts +145 -0
- package/dist/sandbox/operation-authority.js +783 -0
- package/dist/sandbox/operation-authority.module.d.ts +2 -0
- package/dist/sandbox/operation-authority.module.js +29 -0
- package/dist/sandbox/operation-intents.d.ts +206 -0
- package/dist/sandbox/operation-intents.js +1252 -0
- package/dist/sandbox/operation-intents.module.d.ts +2 -0
- package/dist/sandbox/operation-intents.module.js +21 -0
- package/dist/sandbox/operation-payloads.d.ts +33 -0
- package/dist/sandbox/operation-payloads.js +332 -0
- package/dist/sandbox/operation-reconcile.job.d.ts +49 -0
- package/dist/sandbox/operation-reconcile.job.js +247 -0
- package/dist/sandbox/permission-authority-epochs.d.ts +18 -0
- package/dist/sandbox/permission-authority-epochs.js +83 -0
- package/dist/sandbox/permission-authority-lock.d.ts +38 -0
- package/dist/sandbox/permission-authority-lock.js +147 -0
- package/dist/sandbox/permission-authority.module.d.ts +9 -0
- package/dist/sandbox/permission-authority.module.js +55 -0
- package/dist/sandbox/permission-availability.d.ts +18 -0
- package/dist/sandbox/permission-availability.js +19 -0
- package/dist/sandbox/permission-call-grants.d.ts +34 -0
- package/dist/sandbox/permission-call-grants.js +349 -0
- package/dist/sandbox/permission-call-grants.module.d.ts +2 -0
- package/dist/sandbox/permission-call-grants.module.js +21 -0
- package/dist/sandbox/permission-call-types.d.ts +82 -0
- package/dist/sandbox/permission-call-types.js +1 -0
- package/dist/sandbox/permission-ceiling-writes.d.ts +47 -0
- package/dist/sandbox/permission-ceiling-writes.js +223 -0
- package/dist/sandbox/permission-config-publication.d.ts +76 -0
- package/dist/sandbox/permission-config-publication.js +339 -0
- package/dist/sandbox/permission-context-types.d.ts +64 -0
- package/dist/sandbox/permission-context-types.js +24 -0
- package/dist/sandbox/permission-facts.d.ts +206 -0
- package/dist/sandbox/permission-facts.js +627 -0
- package/dist/sandbox/permission-facts.module.d.ts +2 -0
- package/dist/sandbox/permission-facts.module.js +20 -0
- package/dist/sandbox/permission-instance-writes.d.ts +90 -0
- package/dist/sandbox/permission-instance-writes.js +305 -0
- package/dist/sandbox/permission-runtime-reports.d.ts +83 -0
- package/dist/sandbox/permission-runtime-reports.js +354 -0
- package/dist/sandbox/permission-transitions.d.ts +31 -0
- package/dist/sandbox/permission-transitions.js +155 -0
- package/dist/sandbox/platform-full-access.d.ts +128 -0
- package/dist/sandbox/platform-full-access.js +210 -0
- package/dist/sandbox/providers.d.ts +22 -0
- package/dist/sandbox/providers.js +10 -2
- package/dist/sandbox/providers.module.d.ts +2 -0
- package/dist/sandbox/providers.module.js +19 -0
- package/dist/sandbox/request-not-sent.d.ts +13 -0
- package/dist/sandbox/request-not-sent.js +13 -0
- package/dist/sandbox/review/classifier.d.ts +2 -0
- package/dist/sandbox/review/classifier.js +8 -0
- package/dist/sandbox/review/permission-candidate.d.ts +12 -0
- package/dist/sandbox/review/permission-candidate.js +145 -0
- package/dist/sandbox/review/review.service.d.ts +5 -2
- package/dist/sandbox/review/review.service.js +60 -15
- package/dist/sandbox/sandbox-file-reader.d.ts +18 -1
- package/dist/sandbox/sandbox-file-reader.js +51 -7
- package/dist/sandbox/sandbox.module.js +26 -6
- package/dist/sandbox/sandbox.service.d.ts +230 -34
- package/dist/sandbox/sandbox.service.js +1368 -199
- package/dist/sandbox/unreachable.js +17 -3
- package/dist/sandbox/use-context.d.ts +17 -0
- package/dist/sandbox/use-context.js +1 -0
- package/dist/skills/invoke.d.ts +27 -4
- package/dist/skills/invoke.js +72 -7
- package/dist/tools/approvals.controller.d.ts +1 -0
- package/dist/tools/approvals.schemas.d.ts +1 -0
- package/dist/tools/approvals.schemas.js +3 -1
- package/dist/tools/approvals.service.d.ts +23 -10
- package/dist/tools/approvals.service.js +104 -26
- package/dist/tools/builtin-names.d.ts +3 -1
- package/dist/tools/builtin-names.js +5 -1
- package/dist/tools/builtins/artifacts.d.ts +43 -0
- package/dist/tools/builtins/artifacts.js +67 -0
- package/dist/tools/builtins/builtin-tools.d.ts +20 -2
- package/dist/tools/builtins/builtin-tools.js +61 -10
- package/dist/tools/builtins/image/generate.d.ts +59 -0
- package/dist/tools/builtins/image/generate.js +535 -0
- package/dist/tools/builtins/image/index.d.ts +2 -0
- package/dist/tools/builtins/image/index.js +2 -0
- package/dist/tools/builtins/image/paths.d.ts +12 -0
- package/dist/tools/builtins/image/paths.js +26 -0
- package/dist/tools/builtins/sandbox/bash.d.ts +25 -1
- package/dist/tools/builtins/sandbox/bash.js +201 -5
- package/dist/tools/builtins/sandbox/common.d.ts +92 -20
- package/dist/tools/builtins/sandbox/common.js +201 -17
- package/dist/tools/builtins/sandbox/deliver.js +9 -51
- package/dist/tools/builtins/sandbox/edit.js +2 -2
- package/dist/tools/builtins/sandbox/fetch-attachment.js +11 -4
- package/dist/tools/builtins/sandbox/glob.js +2 -2
- package/dist/tools/builtins/sandbox/grep.js +2 -2
- package/dist/tools/builtins/sandbox/read.js +2 -2
- package/dist/tools/builtins/sandbox/task-list.js +7 -1
- package/dist/tools/builtins/sandbox/task-output.d.ts +1 -1
- package/dist/tools/builtins/sandbox/task-output.js +172 -0
- package/dist/tools/builtins/sandbox/task-stop.js +25 -3
- package/dist/tools/builtins/sandbox/write.js +2 -2
- package/dist/tools/builtins/skill-load.js +9 -6
- package/dist/tools/device-op-resolver.d.ts +1 -1
- package/dist/tools/device-op-resolver.js +13 -3
- package/dist/tools/permission-approval-jobs.d.ts +18 -0
- package/dist/tools/permission-approval-jobs.js +92 -0
- package/dist/tools/pipeline.d.ts +17 -2
- package/dist/tools/pipeline.js +315 -26
- package/dist/tools/registry.d.ts +9 -0
- package/dist/tools/tools.module.js +15 -0
- package/package.json +4 -3
- package/src/migrations/0146_permission_authority_epochs.sql +6 -0
- package/src/migrations/0147_conversation_permission_profiles.sql +4 -0
- package/src/migrations/0148_first_message_request_hash.sql +2 -0
- package/src/migrations/0149_sandbox_operation_intents.sql +66 -0
- package/src/migrations/0150_permission_call_grants_and_approvals.sql +36 -0
- package/src/migrations/0151_starting_execution_grants.sql +8 -0
- package/src/migrations/0152_background_launch_identity.sql +66 -0
- package/src/migrations/0153_background_cancel_requester.sql +13 -0
- package/src/migrations/0154_cloud_owner_ceiling.sql +14 -0
- package/src/migrations/0155_device_instance_generations.sql +30 -0
- package/src/migrations/0156_device_owner_report.sql +7 -0
- package/src/migrations/0157_legacy_retirement.sql +116 -0
- package/src/migrations/0158_legacy_freeze_enumerated.sql +5 -0
- package/src/migrations/0159_retirement_exact_cancel.sql +9 -0
- package/src/migrations/0160_model_usage_image_kind.sql +10 -0
- package/dist/sandbox/platform-auto-mode.d.ts +0 -63
- package/dist/sandbox/platform-auto-mode.js +0 -63
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SandboxLimits } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { type PlatformAttribution } from "../attribution/platform-attribution.js";
|
|
4
4
|
import type { KernelSchemaDb } from "../db/kernel-schema.js";
|
|
@@ -7,7 +7,9 @@ import { KernelConfigService } from "../infra/config/kernel-config.service.js";
|
|
|
7
7
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
8
8
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
9
9
|
import type { KernelLogger } from "../log.js";
|
|
10
|
-
import {
|
|
10
|
+
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
11
|
+
import { type DevicesAutoModeView, type DevicesFullAccessView, type FullAccessPermission } from "../sandbox/platform-full-access.js";
|
|
12
|
+
import { type CloudNetworkSetting } from "./cloud-network-setting.js";
|
|
11
13
|
import { OrgLock } from "./org-lock.js";
|
|
12
14
|
/**
|
|
13
15
|
* Org settings (`capybara.orgs.settings` jsonb). Read leniently: a missing or invalid field reads
|
|
@@ -22,9 +24,10 @@ import { OrgLock } from "./org-lock.js";
|
|
|
22
24
|
* execution). An invalid stored value reads as `ask` (narrower, never wider) and is logged.
|
|
23
25
|
* - `wakeOnBackgroundTask`: the org's override of `runtime.wakeOnBackgroundTask` (absent follows
|
|
24
26
|
* the deployment), see {@link effectiveWakeOnBackgroundTask}.
|
|
25
|
-
* - `
|
|
26
|
-
* follows the platform's `devices.
|
|
27
|
-
* (narrower, never wider). Setting `allowed` while the
|
|
27
|
+
* - `fullAccess`: whether devices of the org may run with Full permission (permission runtime
|
|
28
|
+
* cutover B1, replacing `autoMode`); absent follows the platform's `devices.fullAccess`, and an
|
|
29
|
+
* invalid stored value reads as `off` (narrower, never wider). Setting `allowed` while the
|
|
30
|
+
* platform is `off` is refused.
|
|
28
31
|
* - `cloudNetwork`: the org's sandbox-mode network as a delta over the platform's allowlist (org
|
|
29
32
|
* egress ceiling spec §D1, {@link CloudNetworkSettingSchema}). An invalid stored value reads as
|
|
30
33
|
* `{ mode: "allowlist", base: "none" }`, the empty allowlist (narrower, never wider).
|
|
@@ -39,43 +42,12 @@ import { OrgLock } from "./org-lock.js";
|
|
|
39
42
|
* - `gitGateway`: the org's git gateway switch and host sources (sandbox git credentials spec §9);
|
|
40
43
|
* not in the PATCH yet; an invalid stored value reads as `{ enabled: false }` (fails closed).
|
|
41
44
|
*/
|
|
42
|
-
|
|
43
|
-
export declare const ORG_SANDBOX_ALLOW_HOSTS_MAX = 200;
|
|
45
|
+
export { type CloudNetworkSetting, CloudNetworkSettingSchema, invalidCloudNetwork, ORG_SANDBOX_ALLOW_HOSTS_MAX, } from "./cloud-network-setting.js";
|
|
44
46
|
/**
|
|
45
|
-
* The org's
|
|
46
|
-
*
|
|
47
|
-
* org:
|
|
48
|
-
* - `mode`: the cloud network of a cloud device in sandbox mode, `open` (any public host; loopback,
|
|
49
|
-
* private and cloud metadata addresses are blocked outside the container) or `allowlist`; absent
|
|
50
|
-
* follows the platform's default (open). `sandbox.limits.orgHosts: within` makes it the allowlist.
|
|
51
|
-
* - `base`: `platform` (the default: start from the platform's list) or `none` (only the org's own
|
|
52
|
-
* hosts).
|
|
53
|
-
* - `extraHosts`: hosts the org adds (ignored outside the platform list under `within`).
|
|
54
|
-
* - `excludedHosts`: platform entries the org drops (exact entries; any host is accepted, since the
|
|
55
|
-
* platform may drop an entry later).
|
|
56
|
-
* The effective hosts ({@link orgEffectiveHosts} in `sandbox/modes.ts`) are also the ceiling a local
|
|
57
|
-
* device in sandbox mode reaches (the device intersects them with its own list).
|
|
47
|
+
* The org's Full permission switch (B1): `allowed` or `off`; absent follows the platform's
|
|
48
|
+
* `devices.fullAccess`. An invalid stored value reads as `off` (narrower, never wider).
|
|
58
49
|
*/
|
|
59
|
-
export declare const
|
|
60
|
-
mode: z.ZodOptional<z.ZodEnum<{
|
|
61
|
-
allowlist: "allowlist";
|
|
62
|
-
open: "open";
|
|
63
|
-
}>>;
|
|
64
|
-
base: z.ZodOptional<z.ZodEnum<{
|
|
65
|
-
none: "none";
|
|
66
|
-
platform: "platform";
|
|
67
|
-
}>>;
|
|
68
|
-
extraHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
-
excludedHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
-
}, z.core.$strict>;
|
|
71
|
-
export type CloudNetworkSetting = z.infer<typeof CloudNetworkSettingSchema>;
|
|
72
|
-
/** What an invalid stored `cloudNetwork` reads as: the allowlist with no host (never wider). */
|
|
73
|
-
export declare const invalidCloudNetwork: () => CloudNetworkSetting;
|
|
74
|
-
/**
|
|
75
|
-
* The org's auto-mode switch (auto mode spec §4.3): `allowed` or `off`; absent follows the
|
|
76
|
-
* platform's `devices.autoMode`. An invalid stored value reads as `off` (narrower, never wider).
|
|
77
|
-
*/
|
|
78
|
-
export declare const AutoModeSetting: z.ZodEnum<{
|
|
50
|
+
export declare const FullAccessSetting: z.ZodEnum<{
|
|
79
51
|
allowed: "allowed";
|
|
80
52
|
off: "off";
|
|
81
53
|
}>;
|
|
@@ -168,7 +140,7 @@ export declare const OrgSettingsSchema: z.ZodObject<{
|
|
|
168
140
|
on: "on";
|
|
169
141
|
"read-only": "read-only";
|
|
170
142
|
}>>>;
|
|
171
|
-
|
|
143
|
+
fullAccess: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
172
144
|
allowed: "allowed";
|
|
173
145
|
off: "off";
|
|
174
146
|
}>>>;
|
|
@@ -232,6 +204,8 @@ export type OrgSettingsView = OrgSettings & {
|
|
|
232
204
|
scheduledTasks: OrgSettings["scheduledTasks"] & {
|
|
233
205
|
forbiddenToolsUnreadable?: true;
|
|
234
206
|
};
|
|
207
|
+
/** The old public name of `fullAccess`, mirrored by {@link orgSettingsView}. */
|
|
208
|
+
autoMode?: FullAccessPermission;
|
|
235
209
|
};
|
|
236
210
|
/** PATCH 体:只改给出的字段;未知字段 → 400。 */
|
|
237
211
|
export declare const OrgSettingsPatchSchema: z.ZodObject<{
|
|
@@ -253,6 +227,10 @@ export declare const OrgSettingsPatchSchema: z.ZodObject<{
|
|
|
253
227
|
"read-only": "read-only";
|
|
254
228
|
}>>;
|
|
255
229
|
wakeOnBackgroundTask: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
230
|
+
fullAccess: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
231
|
+
allowed: "allowed";
|
|
232
|
+
off: "off";
|
|
233
|
+
}>>>;
|
|
256
234
|
autoMode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
257
235
|
allowed: "allowed";
|
|
258
236
|
off: "off";
|
|
@@ -302,6 +280,13 @@ export declare const OrgSettingsPatchSchema: z.ZodObject<{
|
|
|
302
280
|
}, z.core.$strict>>>;
|
|
303
281
|
}, z.core.$strict>;
|
|
304
282
|
export type OrgSettingsPatch = z.infer<typeof OrgSettingsPatchSchema>;
|
|
283
|
+
/** A patch with the old `autoMode` moved to `fullAccess` (the schema refuses both together). */
|
|
284
|
+
export declare function normalizeOrgSettingsPatch(patch: OrgSettingsPatch): OrgSettingsPatch;
|
|
285
|
+
/**
|
|
286
|
+
* The settings as the API answers them ({@link OrgSettingsView}), plus the old public name
|
|
287
|
+
* `autoMode` mirroring `fullAccess` until the old public readers are removed.
|
|
288
|
+
*/
|
|
289
|
+
export declare const orgSettingsView: (settings: OrgSettingsView) => OrgSettingsView;
|
|
305
290
|
/** Whether a finished background task wakes an idle conversation: the org's setting, else the deployment's. */
|
|
306
291
|
export declare function effectiveWakeOnBackgroundTask(deployment: boolean, org: OrgSettings["wakeOnBackgroundTask"]): boolean;
|
|
307
292
|
/**
|
|
@@ -326,7 +311,9 @@ export interface OrgEffectiveNetwork {
|
|
|
326
311
|
}
|
|
327
312
|
/** The deployment defaults the settings page shows for "follow the platform" (`GET` returns them). */
|
|
328
313
|
export interface OrgSettingsDeployment {
|
|
329
|
-
/** The platform's
|
|
314
|
+
/** The platform's Full permission switch and where it comes from. */
|
|
315
|
+
fullAccess: DevicesFullAccessView;
|
|
316
|
+
/** The same switch under its old public name (`{ mode, source }`). */
|
|
330
317
|
autoMode: DevicesAutoModeView;
|
|
331
318
|
/**
|
|
332
319
|
* The platform's network: its allowlist (what an org's delta applies to), whether orgs may go
|
|
@@ -348,7 +335,10 @@ export interface OrgSettingsDeployment {
|
|
|
348
335
|
/** The platform's conversation compaction settings (what "follow the platform" means). */
|
|
349
336
|
compaction: CompactionSettings;
|
|
350
337
|
}
|
|
351
|
-
/**
|
|
338
|
+
/**
|
|
339
|
+
* Parses the stored jsonb into settings (leniently, see {@link OrgSettingsSchema}). Until 8.6 `fullAccess` is read
|
|
340
|
+
* over both keys, the narrower of it and the old `autoMode` ({@link narrowedOrgFullAccess}).
|
|
341
|
+
*/
|
|
352
342
|
export declare function parseOrgSettings(raw: unknown): OrgSettings;
|
|
353
343
|
/** The org's stored settings jsonb, read live; undefined when the org is missing or deleted. */
|
|
354
344
|
export declare function readStoredOrgSettings(db: KernelSchemaDb, orgId: string): Promise<unknown>;
|
|
@@ -378,8 +368,8 @@ export declare const FORBIDDEN_TOOLS_UNREADABLE_GRANT_ERROR = "The organization'
|
|
|
378
368
|
* than written, with the org id.
|
|
379
369
|
*/
|
|
380
370
|
export declare function logUnreadableSecuritySettings(log: (msg: string, fields: Record<string, unknown>) => void, orgId: string, raw: unknown): void;
|
|
381
|
-
/** Whether a stored settings object holds
|
|
382
|
-
export declare function
|
|
371
|
+
/** Whether a stored settings object holds a `fullAccess` this version reads as `off`. */
|
|
372
|
+
export declare function invalidStoredFullAccess(raw: unknown): boolean;
|
|
383
373
|
/** Whether a stored settings object holds a `cloudNetwork` this version reads as an empty allowlist. */
|
|
384
374
|
export declare function invalidStoredCloudNetwork(raw: unknown): boolean;
|
|
385
375
|
/**
|
|
@@ -396,18 +386,19 @@ export declare class OrgSettingsService {
|
|
|
396
386
|
readonly txHost: TransactionHost;
|
|
397
387
|
private readonly orgLock;
|
|
398
388
|
/**
|
|
399
|
-
* The deployment config: `sandbox.limits` and the platform's
|
|
400
|
-
* (`devices.
|
|
389
|
+
* The deployment config: `sandbox.limits` and the platform's Full switch
|
|
390
|
+
* (`devices.fullAccess`; the org may follow it, never exceed it).
|
|
401
391
|
*/
|
|
402
392
|
private readonly config;
|
|
393
|
+
private readonly ceilings;
|
|
403
394
|
private readonly log?;
|
|
404
395
|
constructor(db: KernelDb, txHost: TransactionHost, orgLock: OrgLock,
|
|
405
396
|
/**
|
|
406
|
-
* The deployment config: `sandbox.limits` and the platform's
|
|
407
|
-
* (`devices.
|
|
397
|
+
* The deployment config: `sandbox.limits` and the platform's Full switch
|
|
398
|
+
* (`devices.fullAccess`; the org may follow it, never exceed it).
|
|
408
399
|
*/
|
|
409
|
-
config: Pick<KernelConfigService, "get" | "fieldSource">, log?: KernelLogger | undefined);
|
|
410
|
-
/** Parses stored settings, warning when an invalid `
|
|
400
|
+
config: Pick<KernelConfigService, "get" | "fieldSource">, ceilings: PermissionCeilingWrites, log?: KernelLogger | undefined);
|
|
401
|
+
/** Parses stored settings, warning when an invalid `fullAccess` narrows to `off`, an invalid
|
|
411
402
|
* `cloudNetwork` to an empty allowlist, or a security setting reads narrower
|
|
412
403
|
* ({@link logUnreadableSecuritySettings}, warn). */
|
|
413
404
|
private parseStored;
|
|
@@ -425,7 +416,7 @@ export declare class OrgSettingsService {
|
|
|
425
416
|
* The refusals of {@link update} that need no read of the org (the Platform tool's precheck):
|
|
426
417
|
* auto mode where the platform turned it off.
|
|
427
418
|
*/
|
|
428
|
-
check(
|
|
419
|
+
check(input: OrgSettingsPatch): Promise<void>;
|
|
429
420
|
/**
|
|
430
421
|
* Under `sandbox.limits.orgHosts: within` (spec §D2), refuses what would widen past the platform
|
|
431
422
|
* ceiling compared with the stored value `before`: the open cloud network where the org did not
|
|
@@ -434,26 +425,27 @@ export declare class OrgSettingsService {
|
|
|
434
425
|
* under the ceiling (they are filtered on read), so they never block a write.
|
|
435
426
|
*/
|
|
436
427
|
assertWithinCeiling(before: OrgSettings, patch: OrgSettingsPatch): void;
|
|
437
|
-
update(orgId: string,
|
|
428
|
+
update(orgId: string, input: OrgSettingsPatch, actorAccountId: string, actorTokenId?: string,
|
|
438
429
|
/** Merged into the audit detail (the Platform tool's `via: "agent"`). */
|
|
439
430
|
auditDetail?: Record<string, unknown>,
|
|
440
431
|
/**
|
|
441
|
-
* `onlyNarrows` (the Platform tool, API tokens): refuse
|
|
432
|
+
* `onlyNarrows` (the Platform tool, API tokens): refuse a `fullAccess` or `cloudNetwork`
|
|
442
433
|
* change that widens (see {@link assertOnlyNarrows}); only a person in a session widens.
|
|
443
434
|
*/
|
|
444
435
|
opts?: {
|
|
445
436
|
onlyNarrows?: boolean;
|
|
446
437
|
}): Promise<OrgSettingsView>;
|
|
438
|
+
private lockFor;
|
|
447
439
|
/**
|
|
448
440
|
* Refuses a patch that widens the org's sandbox (auto mode spec §4.3: only a person widens it,
|
|
449
441
|
* never the Platform tool or an API token):
|
|
450
|
-
* - `
|
|
442
|
+
* - `fullAccess`: `allowed` where the organization runs `off` (an absent value follows the
|
|
451
443
|
* platform); clearing it follows the platform too, never wider than the platform allows;
|
|
452
444
|
* - `cloudNetwork`: compared as stored deltas ({@link cloudNetworkWidens}), never as effective
|
|
453
445
|
* values: under the kill switch or the platform ceiling the effective values hide a widening
|
|
454
446
|
* that takes effect when the platform relaxes (org egress ceiling spec §D3).
|
|
455
447
|
*/
|
|
456
|
-
assertOnlyNarrows(before: OrgSettings,
|
|
448
|
+
assertOnlyNarrows(before: OrgSettings, input: OrgSettingsPatch): Promise<void>;
|
|
457
449
|
private updateIn;
|
|
458
450
|
}
|
|
459
451
|
/**
|