@capybara-hq/kernel 0.1.0-rc.21 → 0.1.0-rc.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/admin-agents.d.ts +16 -3
- package/dist/agents/admin-agents.js +65 -7
- package/dist/agents/agents.schemas.d.ts +24 -6
- package/dist/agents/agents.service.d.ts +4 -3
- package/dist/agents/agents.service.js +39 -26
- package/dist/agents/definition.d.ts +44 -6
- package/dist/agents/definition.js +86 -18
- package/dist/agents/from-template.d.ts +6 -3
- package/dist/agents/from-template.js +57 -44
- package/dist/agents/org-templates.js +97 -41
- package/dist/agents/templates.d.ts +6 -0
- package/dist/agents/templates.js +15 -1
- package/dist/catalog/admin-catalog.controller.d.ts +2 -4
- package/dist/catalog/admin-catalog.controller.js +2 -6
- package/dist/catalog/catalog.module.js +3 -0
- package/dist/catalog/claude/report.d.ts +9 -2
- package/dist/catalog/claude/report.js +1 -0
- package/dist/catalog/claude/translate.js +1 -1
- package/dist/catalog/component-promotion.js +1 -2
- package/dist/catalog/component-state.d.ts +13 -1
- package/dist/catalog/component-state.js +14 -5
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/marketplaces.service.js +2 -1
- package/dist/catalog/org-catalog.controller.d.ts +13 -3
- package/dist/catalog/org-catalog.controller.js +26 -4
- package/dist/catalog/org-catalog.schemas.d.ts +13 -0
- package/dist/catalog/org-catalog.schemas.js +34 -0
- package/dist/catalog/org-plugin-uploads.controller.js +0 -1
- package/dist/catalog/org-plugin-uploads.d.ts +0 -1
- package/dist/catalog/org-plugin-uploads.js +0 -3
- package/dist/catalog/org-plugin-uploads.schemas.d.ts +0 -1
- package/dist/catalog/org-plugin-uploads.schemas.js +0 -2
- package/dist/catalog/platform-components.d.ts +0 -1
- package/dist/catalog/platform-components.js +3 -8
- package/dist/catalog/plugin-import.d.ts +0 -8
- package/dist/catalog/plugin-import.js +4 -35
- package/dist/catalog/plugin-install.d.ts +2 -2
- package/dist/catalog/plugin-install.js +2 -2
- package/dist/catalog/plugin-package.d.ts +7 -0
- package/dist/catalog/plugin-package.js +27 -1
- package/dist/catalog/plugin-upgrade.d.ts +5 -6
- package/dist/catalog/plugin-upgrade.js +5 -23
- package/dist/catalog/requests.service.d.ts +66 -10
- package/dist/catalog/requests.service.js +196 -15
- package/dist/channels/actions.d.ts +2 -0
- package/dist/channels/actions.js +19 -4
- package/dist/channels/cards.d.ts +16 -2
- package/dist/channels/cards.js +40 -7
- package/dist/channels/channels.module.js +3 -0
- package/dist/channels/outbound.d.ts +22 -1
- package/dist/channels/outbound.js +116 -7
- package/dist/channels/phrases.d.ts +25 -0
- package/dist/channels/phrases.js +19 -0
- package/dist/channels/threads.d.ts +12 -0
- package/dist/channels/threads.js +34 -0
- package/dist/config/schema.d.ts +23 -1
- package/dist/config/schema.js +105 -5
- package/dist/conversations/conversations.service.d.ts +42 -9
- package/dist/conversations/conversations.service.js +57 -25
- package/dist/conversations/events.d.ts +106 -11
- package/dist/conversations/events.js +121 -18
- package/dist/conversations/message-context.d.ts +6 -3
- package/dist/conversations/message-context.js +14 -10
- package/dist/conversations/queue.d.ts +15 -2
- package/dist/conversations/queue.js +22 -3
- package/dist/conversations/queue.service.d.ts +12 -6
- package/dist/conversations/queue.service.js +36 -13
- package/dist/db/kernel-schema.d.ts +105 -3
- package/dist/devices/conversation-devices.d.ts +8 -1
- package/dist/devices/conversation-devices.js +8 -0
- package/dist/devices/devices.controller.d.ts +21 -4
- package/dist/devices/devices.controller.js +46 -8
- package/dist/devices/devices.schemas.d.ts +9 -1
- package/dist/devices/devices.schemas.js +11 -3
- package/dist/devices/devices.service.d.ts +176 -4
- package/dist/devices/devices.service.js +341 -6
- package/dist/devices/dto.d.ts +56 -3
- package/dist/devices/dto.js +51 -1
- package/dist/devices/public-suffix.d.ts +6 -0
- package/dist/devices/public-suffix.js +79 -0
- package/dist/errors.d.ts +46 -5
- package/dist/errors.js +46 -5
- package/dist/evals/reconstruct.d.ts +18 -13
- package/dist/evals/reconstruct.js +50 -36
- package/dist/evals/recorded-tools.d.ts +7 -7
- package/dist/evals/recorded-tools.js +4 -3
- package/dist/evals/trajectory.d.ts +6 -1
- package/dist/evals/trajectory.js +7 -0
- package/dist/extensions/package.js +2 -2
- package/dist/http/api.module.js +5 -0
- package/dist/inbox/inbox.module.js +2 -1
- package/dist/inbox/inbox.service.d.ts +19 -4
- package/dist/inbox/inbox.service.js +14 -3
- package/dist/infra/config/kernel-config.service.js +11 -0
- package/dist/infra/events/kernel-events.d.ts +2 -1
- package/dist/local-devices/device-policy.service.d.ts +65 -0
- package/dist/local-devices/device-policy.service.js +217 -0
- package/dist/local-devices/local-device-gateway.js +4 -1
- package/dist/local-devices/local-device-provider.d.ts +40 -3
- package/dist/local-devices/local-device-provider.js +109 -7
- package/dist/local-devices/local-devices.module.d.ts +2 -1
- package/dist/local-devices/local-devices.module.js +19 -3
- package/dist/local-devices/machines.d.ts +14 -3
- package/dist/local-devices/machines.js +41 -3
- package/dist/local-devices/network-grants.d.ts +104 -0
- package/dist/local-devices/network-grants.js +288 -0
- package/dist/local-devices/policy-summary.d.ts +20 -0
- package/dist/local-devices/policy-summary.js +63 -0
- package/dist/orgs/orgs.module.js +4 -10
- package/dist/orgs/roles.d.ts +1 -1
- package/dist/orgs/roles.js +4 -0
- package/dist/orgs/settings.controller.js +2 -1
- package/dist/orgs/settings.service.d.ts +164 -12
- package/dist/orgs/settings.service.js +212 -24
- package/dist/platform/exclusions.js +11 -1
- package/dist/platform/operation.js +4 -0
- package/dist/platform/ops/admin-items.ops.js +1 -1
- package/dist/platform/ops/agent-skills.ops.js +2 -2
- package/dist/platform/ops/agent-templates.ops.js +2 -2
- package/dist/platform/ops/agents.ops.js +11 -15
- package/dist/platform/ops/devices.ops.js +3 -1
- package/dist/platform/ops/inbox.ops.js +19 -0
- package/dist/platform/ops/org-settings.ops.js +14 -5
- package/dist/platform/ops/platform.ops.d.ts +9 -1
- package/dist/platform/ops/platform.ops.js +34 -12
- package/dist/platform/ops/requests.ops.js +3 -2
- package/dist/platform/ops/schedules.ops.d.ts +21 -0
- package/dist/platform/ops/schedules.ops.js +470 -0
- package/dist/platform/ops/skills.ops.js +3 -3
- package/dist/platform/platform-ops.module.d.ts +2 -1
- package/dist/platform/platform-ops.module.js +5 -0
- package/dist/platform/route-schemas.js +3 -0
- package/dist/roles/worker.module.js +3 -0
- package/dist/runtime/context/build.js +13 -4
- package/dist/runtime/context/compaction.js +6 -3
- package/dist/runtime/context/device-paths.d.ts +43 -21
- package/dist/runtime/context/device-paths.js +104 -21
- package/dist/runtime/context/run-context.d.ts +9 -0
- package/dist/runtime/context/run-context.js +8 -0
- package/dist/runtime/context/skills.d.ts +14 -1
- package/dist/runtime/context/skills.js +36 -5
- package/dist/runtime/maintenance.d.ts +4 -2
- package/dist/runtime/maintenance.js +16 -5
- package/dist/runtime/run-finish.d.ts +6 -1
- package/dist/runtime/run-finish.js +16 -2
- package/dist/runtime/run-queue.js +21 -2
- package/dist/runtime/run-worker.js +14 -33
- package/dist/runtime/runtime.module.js +3 -0
- package/dist/runtime/subagents/definition.d.ts +32 -14
- package/dist/runtime/subagents/definition.js +106 -109
- package/dist/runtime/subagents/dispatch.js +4 -3
- package/dist/runtime/subagents/preamble.d.ts +2 -1
- package/dist/runtime/subagents/preamble.js +2 -1
- package/dist/runtime/waits.js +14 -4
- package/dist/sandbox/sandbox.service.d.ts +120 -10
- package/dist/sandbox/sandbox.service.js +335 -28
- package/dist/sandbox/tiers.d.ts +86 -0
- package/dist/sandbox/tiers.js +96 -0
- package/dist/schedules/effective-settings.d.ts +16 -0
- package/dist/schedules/effective-settings.js +17 -0
- package/dist/schedules/errors.d.ts +8 -0
- package/dist/schedules/errors.js +8 -0
- package/dist/schedules/fire.d.ts +118 -0
- package/dist/schedules/fire.js +625 -0
- package/dist/schedules/grant-rules.d.ts +94 -0
- package/dist/schedules/grant-rules.js +126 -0
- package/dist/schedules/job-ids.d.ts +32 -0
- package/dist/schedules/job-ids.js +27 -0
- package/dist/schedules/pause.d.ts +9 -0
- package/dist/schedules/pause.js +33 -0
- package/dist/schedules/run-tracker.d.ts +81 -0
- package/dist/schedules/run-tracker.js +333 -0
- package/dist/schedules/scan.job.d.ts +64 -0
- package/dist/schedules/scan.job.js +303 -0
- package/dist/schedules/schedule-math.d.ts +31 -0
- package/dist/schedules/schedule-math.js +223 -0
- package/dist/schedules/scheduled-tasks.service.d.ts +351 -0
- package/dist/schedules/scheduled-tasks.service.js +1193 -0
- package/dist/schedules/schedules.controller.d.ts +68 -0
- package/dist/schedules/schedules.controller.js +242 -0
- package/dist/schedules/schedules.module.d.ts +16 -0
- package/dist/schedules/schedules.module.js +65 -0
- package/dist/schedules/schedules.schemas.d.ts +316 -0
- package/dist/schedules/schedules.schemas.js +186 -0
- package/dist/schedules/store.d.ts +81 -0
- package/dist/schedules/store.js +390 -0
- package/dist/schedules/store.module.d.ts +6 -0
- package/dist/schedules/store.module.js +21 -0
- package/dist/schedules/types.d.ts +108 -0
- package/dist/schedules/types.js +1 -0
- package/dist/schedules/unattended.d.ts +117 -0
- package/dist/schedules/unattended.js +228 -0
- package/dist/setup/oauth-token-probe.js +8 -4
- package/dist/skills/agent-skills.service.d.ts +4 -8
- package/dist/skills/agent-skills.service.js +18 -53
- package/dist/skills/catalog.d.ts +65 -62
- package/dist/skills/catalog.js +109 -206
- package/dist/skills/conversation-catalog.d.ts +3 -3
- package/dist/skills/conversation-catalog.js +5 -12
- package/dist/skills/invoke.d.ts +2 -2
- package/dist/skills/skills.controller.d.ts +3 -1
- package/dist/skills/skills.service.d.ts +38 -37
- package/dist/skills/skills.service.js +168 -107
- package/dist/skills/usable.d.ts +57 -8
- package/dist/skills/usable.js +172 -38
- package/dist/tools/approvals.controller.d.ts +4 -2
- package/dist/tools/approvals.controller.js +17 -2
- package/dist/tools/approvals.schemas.d.ts +1 -0
- package/dist/tools/approvals.schemas.js +3 -1
- package/dist/tools/approvals.service.d.ts +182 -7
- package/dist/tools/approvals.service.js +597 -13
- package/dist/tools/builtin-names.d.ts +25 -4
- package/dist/tools/builtin-names.js +45 -4
- package/dist/tools/builtins/builtin-tools.d.ts +8 -0
- package/dist/tools/builtins/builtin-tools.js +23 -2
- package/dist/tools/builtins/sandbox/bash.js +16 -7
- package/dist/tools/builtins/sandbox/common.d.ts +1 -1
- package/dist/tools/builtins/sandbox/common.js +33 -10
- package/dist/tools/builtins/sandbox/edit.js +7 -3
- package/dist/tools/builtins/sandbox/file-state.d.ts +31 -1
- package/dist/tools/builtins/sandbox/file-state.js +33 -3
- package/dist/tools/builtins/sandbox/write.js +8 -4
- package/dist/tools/builtins/schedules.d.ts +107 -0
- package/dist/tools/builtins/schedules.js +789 -0
- package/dist/tools/elicitation.d.ts +2 -0
- package/dist/tools/elicitation.js +1 -1
- package/dist/tools/fixed-ask.d.ts +7 -0
- package/dist/tools/fixed-ask.js +9 -0
- package/dist/tools/network-asks.d.ts +109 -0
- package/dist/tools/network-asks.js +221 -0
- package/dist/tools/pipeline.d.ts +53 -6
- package/dist/tools/pipeline.js +202 -13
- package/dist/tools/policy.d.ts +21 -8
- package/dist/tools/policy.js +63 -9
- package/dist/tools/registry.d.ts +10 -1
- package/dist/tools/tools.module.js +12 -0
- package/package.json +2 -2
- package/src/migrations/0113_scheduled_tasks.sql +108 -0
- package/src/migrations/0114_network_asks.sql +23 -0
- package/src/migrations/0115_network_requests.sql +28 -0
- package/src/migrations/0116_skills_default_on.sql +37 -0
- package/src/migrations/0117_sandbox_tiers.sql +11 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ExecResult, type SandboxActor, type SandboxHandle, type SandboxLimits, type SandboxProvider, type SandboxRoots } from "@capybara-hq/plugin-sdk";
|
|
1
|
+
import { type ExecResult, type SandboxActor, type SandboxHandle, type SandboxLimits, type SandboxProvider, type SandboxRoots, type SandboxTier } from "@capybara-hq/plugin-sdk";
|
|
2
2
|
import type { Redis } from "ioredis";
|
|
3
3
|
import { type Selectable } from "kysely";
|
|
4
4
|
import { BackgroundTaskStore } from "../background/store.js";
|
|
@@ -10,6 +10,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
|
|
|
10
10
|
import type { KernelLogger } from "../log.js";
|
|
11
11
|
import { SandboxLeases, type SandboxPathLease } from "./leases.js";
|
|
12
12
|
import { SandboxProviders } from "./providers.js";
|
|
13
|
+
import { type AppliedLimits, type EffectiveSandboxPolicy } from "./tiers.js";
|
|
13
14
|
export { SANDBOX_LOCK_PREFIX, SANDBOX_LOCK_TTL_MS, SandboxLockLostError, sandboxBusy, } from "./leases.js";
|
|
14
15
|
/** The third argument of the `withSandbox` callback. */
|
|
15
16
|
export interface SandboxUseInfo {
|
|
@@ -84,6 +85,17 @@ export type IfRunningResult<T> = {
|
|
|
84
85
|
| {
|
|
85
86
|
kind: "other_instance";
|
|
86
87
|
};
|
|
88
|
+
/** {@link SandboxService.limitsState}: the limits of a device's instance, for its page. */
|
|
89
|
+
export interface DeviceLimitsState {
|
|
90
|
+
/** The tier and egress mode the instance (or its file system) runs with; null = unknown. */
|
|
91
|
+
applied: AppliedLimits | null;
|
|
92
|
+
/** The tier and egress mode it should run with now (the device's effective policy). */
|
|
93
|
+
effective: AppliedLimits;
|
|
94
|
+
/** A cloud instance differs: its next use updates or recreates it, files kept. */
|
|
95
|
+
pendingNextUse: boolean;
|
|
96
|
+
/** Only a file reset applies the effective limits (`limitsApplyAt: "fileSystem"`). */
|
|
97
|
+
pendingFilesReset: boolean;
|
|
98
|
+
}
|
|
87
99
|
/** The provider-side name of a device's file system and instance. */
|
|
88
100
|
export declare const deviceResourceName: (deviceId: string) => string;
|
|
89
101
|
/** The device is missing, deleted, or not in the caller's org (404; ids cannot be probed). */
|
|
@@ -103,8 +115,8 @@ export declare const isInstance: (row: Pick<Row, "handle" | "created_at">, gone:
|
|
|
103
115
|
* Sandbox config problems to tell operators at startup (English log lines):
|
|
104
116
|
* - `runtime.maxRunSeconds` below `sandbox.limits.maxCommandSeconds`: long commands are cut by the
|
|
105
117
|
* run time limit (Ruling M20);
|
|
106
|
-
* - `sandbox.
|
|
107
|
-
* instance
|
|
118
|
+
* - `sandbox.tiers.max` is open but the current provider plugin sets `openEgress: "off"`: every
|
|
119
|
+
* creation of an open-tier instance is refused.
|
|
108
120
|
* With both time limits at their defaults (900 < 7200, a known trade-off) it is only info; warn
|
|
109
121
|
* when an operator changed one and they still disagree.
|
|
110
122
|
*/
|
|
@@ -212,12 +224,66 @@ export declare class SandboxService {
|
|
|
212
224
|
/** Concurrent holders of one device (`sandbox.maxConcurrentCommands`, read at every use). */
|
|
213
225
|
private get cap();
|
|
214
226
|
/**
|
|
215
|
-
* The
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*/
|
|
220
|
-
|
|
227
|
+
* The effective sandbox policy of a device (sandbox dev tiers spec §4.2): the platform's and
|
|
228
|
+
* the org's tiers and network with the device's own tier (`devices.tier`, read fresh; a local
|
|
229
|
+
* device and a missing one have none). Without `deviceId`: a device that follows the org's
|
|
230
|
+
* default.
|
|
231
|
+
*/
|
|
232
|
+
devicePolicy(device: {
|
|
233
|
+
orgId: string;
|
|
234
|
+
deviceId?: string;
|
|
235
|
+
}): Promise<EffectiveSandboxPolicy>;
|
|
236
|
+
/** The device's own tier (`devices.tier`); null when it follows the org or is not there. */
|
|
237
|
+
private deviceTier;
|
|
238
|
+
/**
|
|
239
|
+
* The device's effective sandbox limits (spec §8.4; sandbox dev tiers spec §4.2): the
|
|
240
|
+
* deployment's `sandbox.limits`, cpu / memory per the super admin's org override (C19 / Ruling
|
|
241
|
+
* M16), and the network of the effective tier ({@link devicePolicy}): egress narrowed by the
|
|
242
|
+
* org setting `sandboxEgress` (Ruling M19), widened by the tier. `opts.policy`: a policy the
|
|
243
|
+
* caller already read; `opts.tier`: limits for that tier instead (a local device's ceiling, an
|
|
244
|
+
* unattended run's cap). Cloud instances are created with them.
|
|
245
|
+
*/
|
|
246
|
+
deviceLimits(device: {
|
|
247
|
+
orgId: string;
|
|
248
|
+
deviceId?: string;
|
|
249
|
+
}, opts?: {
|
|
250
|
+
policy?: EffectiveSandboxPolicy;
|
|
251
|
+
tier?: SandboxTier;
|
|
252
|
+
}): Promise<SandboxLimits>;
|
|
253
|
+
/**
|
|
254
|
+
* The limits of the org's ceiling (its highest tier, {@link deviceLimits} at `ceiling`): what a
|
|
255
|
+
* local device's exec may reach at most, so what a network grant or approval is checked
|
|
256
|
+
* against.
|
|
257
|
+
*/
|
|
258
|
+
ceilingLimits(orgId: string): Promise<SandboxLimits>;
|
|
259
|
+
/**
|
|
260
|
+
* The limits state of a device's instance for its page (sandbox dev tiers spec §7.1, §11.1),
|
|
261
|
+
* read without a lease: `applied` is what the instance or file system was made with or updated
|
|
262
|
+
* to (null: unknown, or no instance yet), `effective` what it should run with now.
|
|
263
|
+
* `pendingNextUse`: a cloud instance exists and differs; its next use applies the new limits
|
|
264
|
+
* (files kept). `pendingFilesReset`: the provider fixes limits at its file system
|
|
265
|
+
* (`limitsApplyAt: "fileSystem"`) and cannot `update` them, so only a file reset applies them.
|
|
266
|
+
* A local device (its machine applies the tier at each command) is never pending, and its
|
|
267
|
+
* `applied` is null. `opts.policy`: the device's effective policy when the caller already read
|
|
268
|
+
* it ({@link devicePolicy}).
|
|
269
|
+
*/
|
|
270
|
+
limitsState(device: {
|
|
271
|
+
orgId: string;
|
|
272
|
+
deviceId: string;
|
|
273
|
+
}, opts?: {
|
|
274
|
+
policy?: EffectiveSandboxPolicy;
|
|
275
|
+
}): Promise<DeviceLimitsState>;
|
|
276
|
+
/**
|
|
277
|
+
* Whether a provider whose limits are fixed at its file system cannot apply `effective`
|
|
278
|
+
* without a file reset: it has no `update`, or its `update` already answered `recreate` for it.
|
|
279
|
+
*/
|
|
280
|
+
private fsBound;
|
|
281
|
+
/**
|
|
282
|
+
* Whether the running instance of `row` must get `want` before use (spec §7.1): a cloud
|
|
283
|
+
* instance whose recorded tier or egress mode differs, unless only a file reset could apply it
|
|
284
|
+
* ({@link fsBound}). `want` null: a local device (the tier travels with each command).
|
|
285
|
+
*/
|
|
286
|
+
private mustApply;
|
|
221
287
|
/**
|
|
222
288
|
* The device's instance state as shown to people (read only, no lease): `running` /
|
|
223
289
|
* `suspended` and the last use. No instance, a destroyed one, or one stuck in `creating` (being
|
|
@@ -274,6 +340,25 @@ export declare class SandboxService {
|
|
|
274
340
|
* meanwhile), `info.restarted` is true, so it learns its processes are gone (final review m5).
|
|
275
341
|
*/
|
|
276
342
|
withSandbox<T>(ctx: SandboxUseContext, fn: (h: SandboxHandle, p: HeldProvider, info: SandboxUseInfo, signal: AbortSignal) => Promise<T>, signal: AbortSignal): Promise<T>;
|
|
343
|
+
/**
|
|
344
|
+
* The limits a cloud device's instance must run with for this use (sandbox dev tiers spec
|
|
345
|
+
* §7.1), read fresh; null for a local device (its machine gets the tier with each command).
|
|
346
|
+
* `row`: the instance row read under the exclusive lease (read here when absent).
|
|
347
|
+
*
|
|
348
|
+
* A scheduled run without a person on a cloud device that may run in the open tier, without the
|
|
349
|
+
* task's `tier:open` grant, is refused (`device.tier_not_granted`, recorded in the task run's
|
|
350
|
+
* `missing_grants`): the tier belongs to the shared instance, so it is not switched under the
|
|
351
|
+
* device's attended sessions (spec §11.4). The tier it may run in is the effective one, or for a
|
|
352
|
+
* provider whose limits are fixed at its file system the higher of that and the recorded one
|
|
353
|
+
* (a NULL record there counts as open: nothing says the file system is narrower).
|
|
354
|
+
*/
|
|
355
|
+
private wantedLimits;
|
|
356
|
+
/**
|
|
357
|
+
* Whether the device's instance may run in the open tier during this use (see
|
|
358
|
+
* {@link wantedLimits}): the effective tier is open, or the provider fixes limits at its file
|
|
359
|
+
* system and the recorded tier is open or unknown.
|
|
360
|
+
*/
|
|
361
|
+
private mayRunOpen;
|
|
277
362
|
/**
|
|
278
363
|
* Ruling R24: an operation on the held instance `e` found its file system gone. Records
|
|
279
364
|
* `fs_status = 'lost'` while the row still records that instance on its file system (the
|
|
@@ -298,7 +383,9 @@ export declare class SandboxService {
|
|
|
298
383
|
* Becomes a holder: loops until it has a shared lease on a running instance, or `sandbox.busy`.
|
|
299
384
|
* An instance recorded `running` (with the current provider, not the `gone` instance) is used
|
|
300
385
|
* under a shared lease; otherwise the exclusive lease (with intent) makes it run and is
|
|
301
|
-
* downgraded. One token serves both, so the waiter passes its own intent.
|
|
386
|
+
* downgraded. One token serves both, so the waiter passes its own intent. `wantNow` reads the
|
|
387
|
+
* limits this use wants ({@link wantedLimits}), again after each wait, so a tier narrowed
|
|
388
|
+
* during the wait is never used with the old, wider limits.
|
|
302
389
|
*/
|
|
303
390
|
private enter;
|
|
304
391
|
private clearIntent;
|
|
@@ -411,6 +498,29 @@ export declare class SandboxService {
|
|
|
411
498
|
* new instance is destroyed (best effort) before {@link SandboxLockLostError} is thrown.
|
|
412
499
|
*/
|
|
413
500
|
private create;
|
|
501
|
+
/**
|
|
502
|
+
* Under the exclusive lease, on the running instance `handle` of `row` whose tier or egress
|
|
503
|
+
* mode differs from `want` (sandbox dev tiers spec §7.1): the provider's `update` when it has
|
|
504
|
+
* one; `updated` records `want`. Otherwise (`recreate`, no `update`, or the instance found gone
|
|
505
|
+
* by `update`) the instance is destroyed and created again on the kept files, which records
|
|
506
|
+
* `want` and is returned (the caller reports a restart). A provider whose limits are fixed at
|
|
507
|
+
* its file system is not recreated (that would not apply them): `want` is recorded as
|
|
508
|
+
* `unapplied` and the instance keeps running as is until a file reset.
|
|
509
|
+
*
|
|
510
|
+
* An `update` that fails otherwise never records `want`: a provider whose limits apply at
|
|
511
|
+
* instance create is recreated (warned); after an abort, or for a provider bound to its file
|
|
512
|
+
* system, the instance is suspended ({@link quarantine}) and the error thrown, so the next use
|
|
513
|
+
* resumes it and tries again.
|
|
514
|
+
*/
|
|
515
|
+
private applyLimits;
|
|
516
|
+
/**
|
|
517
|
+
* After a failed `update` that cannot be repaired by a recreate: best effort, with fresh short
|
|
518
|
+
* signals (the use's own may be aborted), suspends the instance (or kills its commands) and
|
|
519
|
+
* records it suspended (fenced: a lost lease leaves the record to the new holder).
|
|
520
|
+
*/
|
|
521
|
+
private quarantine;
|
|
522
|
+
/** Runs `call` with its own short signal; a failure is warned and returns false. */
|
|
523
|
+
private bestEffort;
|
|
414
524
|
/**
|
|
415
525
|
* Destroys the file system another provider may have made under the device's name without
|
|
416
526
|
* the kernel recording it (`destroyFileSystemByName`; not there is success). That provider not
|