@capybara-hq/kernel 0.1.0-rc.121 → 0.1.0-rc.122
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/background/finish.d.ts +5 -1
- package/dist/background/finish.js +29 -18
- package/dist/background/launch.d.ts +0 -5
- package/dist/background/launch.js +1 -6
- package/dist/background/managed.js +1 -4
- package/dist/background/poll.job.d.ts +3 -25
- package/dist/background/poll.job.js +20 -112
- package/dist/background/render.d.ts +2 -8
- package/dist/background/render.js +3 -17
- package/dist/background/stop.d.ts +15 -16
- package/dist/background/stop.js +39 -76
- package/dist/background/store.d.ts +17 -45
- package/dist/background/store.js +60 -94
- package/dist/background/tasks.service.d.ts +2 -5
- package/dist/background/tasks.service.js +9 -20
- package/dist/background/wake.js +3 -2
- package/dist/catalog/admin-catalog.controller.d.ts +2 -18
- package/dist/catalog/admin-catalog.controller.js +2 -28
- package/dist/catalog/catalog-content.d.ts +1 -5
- package/dist/catalog/catalog-items.d.ts +2 -6
- package/dist/catalog/catalog-items.js +5 -26
- package/dist/catalog/catalog-scope.service.d.ts +1 -121
- package/dist/catalog/catalog-scope.service.js +12 -552
- package/dist/catalog/catalog.service.d.ts +4 -15
- package/dist/catalog/catalog.service.js +7 -35
- package/dist/catalog/job-ids.d.ts +0 -18
- package/dist/catalog/job-ids.js +0 -20
- package/dist/catalog/marketplaces.service.d.ts +1 -1
- package/dist/catalog/org-catalog.service.js +6 -20
- package/dist/catalog/org-plugin-uploads.controller.d.ts +4 -19
- package/dist/catalog/org-plugin-uploads.controller.js +6 -34
- package/dist/catalog/org-plugin-uploads.d.ts +3 -10
- package/dist/catalog/org-plugin-uploads.js +4 -18
- package/dist/catalog/org-plugin-uploads.schemas.js +0 -1
- package/dist/catalog/owned-items.d.ts +6 -11
- package/dist/catalog/owned-items.js +10 -20
- package/dist/catalog/ownership.d.ts +3 -29
- package/dist/catalog/ownership.js +4 -54
- package/dist/catalog/platform-components.d.ts +5 -11
- package/dist/catalog/platform-components.js +8 -15
- package/dist/catalog/plugin-import.d.ts +3 -42
- package/dist/catalog/plugin-import.js +26 -195
- package/dist/catalog/plugin-install.js +1 -6
- package/dist/catalog/plugin-package.d.ts +1 -0
- package/dist/catalog/plugin-package.js +5 -0
- package/dist/catalog/plugin-upgrade.d.ts +3 -26
- package/dist/catalog/plugin-upgrade.js +20 -103
- package/dist/catalog/request-rules.js +4 -6
- package/dist/catalog/scope-sync.js +2 -4
- package/dist/catalog/scope.d.ts +2 -5
- package/dist/channels/jobs.d.ts +3 -3
- package/dist/channels/jobs.js +4 -3
- package/dist/channels/outbound.d.ts +1 -0
- package/dist/channels/outbound.js +32 -8
- package/dist/config/load.d.ts +0 -25
- package/dist/config/load.js +0 -57
- package/dist/config/schema.js +2 -3
- package/dist/conversations/attachments.service.js +3 -5
- package/dist/conversations/conversations.service.d.ts +3 -3
- package/dist/conversations/conversations.service.js +3 -3
- package/dist/conversations/job-org.d.ts +3 -0
- package/dist/conversations/job-org.js +11 -0
- package/dist/conversations/prompt-suggestions.d.ts +2 -7
- package/dist/conversations/prompt-suggestions.js +29 -27
- package/dist/conversations/titles.d.ts +3 -4
- package/dist/conversations/titles.js +19 -30
- package/dist/db/kernel-schema.d.ts +6 -16
- package/dist/db/pool.js +7 -2
- package/dist/devices/devices.controller.d.ts +0 -5
- package/dist/devices/devices.controller.js +2 -20
- package/dist/devices/devices.service.d.ts +1 -17
- package/dist/devices/devices.service.js +0 -22
- package/dist/errors.d.ts +1 -5
- package/dist/errors.js +1 -5
- package/dist/evals/judge.d.ts +3 -0
- package/dist/evals/judge.js +1 -1
- package/dist/evals/run-replay.d.ts +1 -1
- package/dist/evals/run-replay.js +26 -29
- package/dist/evals/step-replay.d.ts +3 -1
- package/dist/evals/step-replay.js +10 -1
- package/dist/evals/worker.d.ts +3 -1
- package/dist/evals/worker.js +53 -21
- package/dist/extensions/deployment-config-store.js +18 -14
- package/dist/extensions/effective-config.d.ts +1 -5
- package/dist/extensions/effective-config.js +1 -5
- package/dist/extensions/hooks.d.ts +3 -1
- package/dist/extensions/hooks.js +7 -2
- package/dist/extensions/installs.d.ts +2 -14
- package/dist/extensions/installs.js +10 -32
- package/dist/extensions/org-config.d.ts +3 -4
- package/dist/extensions/org-config.js +3 -4
- package/dist/extensions/plugin-guides.d.ts +0 -1
- package/dist/extensions/plugin-guides.js +0 -1
- package/dist/extensions/plugin-icons.d.ts +0 -1
- package/dist/extensions/plugin-icons.js +0 -3
- package/dist/files/blob-sweep.job.d.ts +2 -11
- package/dist/files/blob-sweep.job.js +7 -21
- package/dist/files/hash-job.d.ts +5 -15
- package/dist/files/hash-job.js +14 -33
- package/dist/files/library-jobs.module.d.ts +1 -6
- package/dist/files/library-jobs.module.js +3 -9
- package/dist/identity/api-tokens.js +54 -40
- package/dist/identity/auth.guard.js +2 -2
- package/dist/identity/sessions.js +7 -3
- package/dist/identity/settings.js +5 -21
- package/dist/inbox/inbox.service.d.ts +2 -3
- package/dist/inbox/org-notices.d.ts +0 -14
- package/dist/inbox/platform-inbox.service.d.ts +1 -8
- package/dist/inbox/platform-inbox.service.js +2 -6
- package/dist/inbox/platform-notices.d.ts +3 -3
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -3
- package/dist/infra/database/database.module.js +2 -1
- package/dist/infra/database/org-scope.d.ts +5 -3
- package/dist/infra/database/org-scope.js +7 -1
- package/dist/infra/database/scoped-dialect.d.ts +3 -1
- package/dist/infra/database/scoped-dialect.js +17 -5
- package/dist/infra/events/kernel-events.d.ts +2 -0
- package/dist/infra/outbox/outbox.service.d.ts +2 -0
- package/dist/infra/outbox/outbox.service.js +10 -0
- package/dist/infra/outbox/registry.d.ts +0 -41
- package/dist/infra/outbox/registry.js +0 -37
- package/dist/models/embeddings.d.ts +0 -5
- package/dist/models/embeddings.js +28 -35
- package/dist/models/images.d.ts +3 -8
- package/dist/models/images.js +19 -37
- package/dist/models/purposes.d.ts +7 -2
- package/dist/models/purposes.js +16 -3
- package/dist/orgs/device-network-setting.d.ts +0 -44
- package/dist/orgs/device-network-setting.js +0 -83
- package/dist/orgs/invitations.service.js +34 -30
- package/dist/orgs/offboarding.d.ts +2 -2
- package/dist/orgs/offboarding.js +2 -2
- package/dist/orgs/orgs.service.d.ts +1 -1
- package/dist/orgs/orgs.service.js +19 -15
- package/dist/orgs/settings.service.d.ts +19 -14
- package/dist/orgs/settings.service.js +12 -37
- package/dist/platform/exclusions.js +0 -11
- package/dist/platform/ops/catalog-admin.ops.js +0 -8
- package/dist/platform/ops/devices.ops.js +0 -28
- package/dist/platform/ops/extensions-admin.ops.js +3 -3
- package/dist/platform/ops/inbox.ops.js +5 -22
- package/dist/platform/ops/org-plugins.ops.d.ts +1 -3
- package/dist/platform/ops/org-plugins.ops.js +11 -67
- package/dist/roles/worker.module.js +0 -9
- package/dist/runtime/hook-calls.d.ts +13 -6
- package/dist/runtime/hook-calls.js +26 -4
- package/dist/runtime/maintenance.d.ts +3 -12
- package/dist/runtime/maintenance.js +25 -55
- package/dist/runtime/model-call.d.ts +4 -2
- package/dist/runtime/model-call.js +59 -58
- package/dist/runtime/providers.d.ts +27 -1
- package/dist/runtime/providers.js +57 -0
- package/dist/runtime/run-jobs.d.ts +1 -1
- package/dist/runtime/run-processors.d.ts +3 -9
- package/dist/runtime/run-worker.d.ts +2 -0
- package/dist/runtime/run-worker.js +23 -8
- package/dist/runtime/subagents/deliveries.js +6 -1
- package/dist/runtime/subagents/dispatch.d.ts +3 -3
- package/dist/runtime/write-base.service.d.ts +2 -3
- package/dist/runtime/write-base.service.js +3 -5
- package/dist/sandbox/device-sandbox-settings.d.ts +38 -92
- package/dist/sandbox/device-sandbox-settings.js +19 -325
- package/dist/sandbox/jobs.d.ts +3 -14
- package/dist/sandbox/jobs.js +2 -20
- package/dist/sandbox/modes.d.ts +5 -45
- package/dist/sandbox/modes.js +3 -60
- package/dist/sandbox/operation-authority.js +0 -11
- package/dist/sandbox/operation-intents.d.ts +32 -9
- package/dist/sandbox/operation-intents.js +241 -32
- package/dist/sandbox/operation-intents.module.js +2 -1
- package/dist/sandbox/operation-reconcile.job.d.ts +9 -11
- package/dist/sandbox/operation-reconcile.job.js +119 -33
- package/dist/sandbox/operation-revoke.d.ts +20 -0
- package/dist/sandbox/operation-revoke.js +3 -0
- package/dist/sandbox/permission-ceiling-writes.d.ts +1 -2
- package/dist/sandbox/permission-ceiling-writes.js +3 -6
- package/dist/sandbox/permission-config-publication.d.ts +1 -28
- package/dist/sandbox/permission-config-publication.js +14 -211
- package/dist/sandbox/permission-facts.d.ts +4 -15
- package/dist/sandbox/permission-facts.js +7 -29
- package/dist/sandbox/permission-instance-writes.d.ts +1 -4
- package/dist/sandbox/permission-instance-writes.js +1 -55
- package/dist/sandbox/providers.d.ts +1 -6
- package/dist/sandbox/providers.js +1 -15
- package/dist/sandbox/review/classifier.js +12 -13
- package/dist/sandbox/sandbox.module.js +3 -6
- package/dist/sandbox/sandbox.service.d.ts +17 -123
- package/dist/sandbox/sandbox.service.js +239 -998
- package/dist/shares/liveness.d.ts +1 -2
- package/dist/shares/liveness.js +1 -2
- package/dist/shares/shares.module.d.ts +1 -2
- package/dist/shares/shares.module.js +2 -5
- package/dist/shares/shares.service.js +1 -2
- package/dist/tools/builtins/image/generate.js +7 -15
- package/dist/tools/builtins/sandbox/common.d.ts +0 -2
- package/dist/tools/builtins/sandbox/common.js +1 -27
- package/dist/tools/builtins/sandbox/task-list.js +10 -10
- package/dist/tools/builtins/sandbox/task-output.d.ts +3 -10
- package/dist/tools/builtins/sandbox/task-output.js +13 -83
- package/dist/tools/builtins/sandbox/task-stop.js +18 -22
- package/dist/tools/builtins/vision/read-image.js +9 -10
- package/dist/tools/builtins/web/extract.js +9 -10
- package/package.json +3 -3
- package/src/migrations/0206_retire_org_extension_uploads.sql +125 -0
- package/src/migrations/0207_confirm_device_instance_destruction.sql +25 -0
- package/src/migrations/0208_convert_stored_permission_settings.sql +189 -0
- package/dist/background/retire-legacy-tasks.job.d.ts +0 -57
- package/dist/background/retire-legacy-tasks.job.js +0 -149
- package/dist/catalog/owned-plugin-cleanup.d.ts +0 -47
- package/dist/catalog/owned-plugin-cleanup.js +0 -140
- package/dist/config/permission-migration.d.ts +0 -34
- package/dist/config/permission-migration.js +0 -115
- package/dist/devices/legacy-cleanup.job.d.ts +0 -34
- package/dist/devices/legacy-cleanup.job.js +0 -147
- package/dist/files/library-backfill.d.ts +0 -63
- package/dist/files/library-backfill.js +0 -143
- package/dist/infra/cli/permission-cutover.d.ts +0 -59
- package/dist/infra/cli/permission-cutover.js +0 -107
- package/dist/sandbox/cloud-permission-snapshot.d.ts +0 -159
- package/dist/sandbox/cloud-permission-snapshot.js +0 -430
- package/dist/sandbox/cloud-permission-snapshot.module.d.ts +0 -8
- package/dist/sandbox/cloud-permission-snapshot.module.js +0 -34
- package/dist/sandbox/legacy-retirement.d.ts +0 -284
- package/dist/sandbox/legacy-retirement.js +0 -1165
- package/dist/sandbox/legacy-retirement.module.d.ts +0 -8
- package/dist/sandbox/legacy-retirement.module.js +0 -25
- package/dist/shares/share-objects.d.ts +0 -47
- package/dist/shares/share-objects.js +0 -93
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
2
|
-
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
3
|
-
import { PermissionAuthorityLock } from "./permission-authority-lock.js";
|
|
4
|
-
/** An unresolved or resolved obligation as the gate reads it. */
|
|
5
|
-
export interface RetirementObligation {
|
|
6
|
-
id: string;
|
|
7
|
-
deviceId: string;
|
|
8
|
-
orgId: string;
|
|
9
|
-
provider: string;
|
|
10
|
-
/** The exact instance generation (epoch ms as decimal text), or `unknown`. */
|
|
11
|
-
instanceGeneration: string;
|
|
12
|
-
state: "open" | "quarantined" | "resolved" | "abandoned";
|
|
13
|
-
reason: string | null;
|
|
14
|
-
attempts: number;
|
|
15
|
-
/** When it was recorded (a cloud `unknown` one resolves only if recorded after the freeze). */
|
|
16
|
-
createdAt: Date;
|
|
17
|
-
}
|
|
18
|
-
/** An owner-initiated proof check, fenced to the machine and current kernel incarnation it read. */
|
|
19
|
-
export interface LocalRetirementCheck {
|
|
20
|
-
orgId: string;
|
|
21
|
-
deviceId: string;
|
|
22
|
-
accountId: string;
|
|
23
|
-
machineId: string;
|
|
24
|
-
currentGeneration: string;
|
|
25
|
-
fence: number;
|
|
26
|
-
}
|
|
27
|
-
/** {@link LegacyRetirementStore.freeze}'s answer: the freeze is published and enumerated. */
|
|
28
|
-
export interface LegacyFreezeResult {
|
|
29
|
-
/** When the freeze was first published (a rerun keeps it). */
|
|
30
|
-
frozenAt: Date;
|
|
31
|
-
/** New obligation members this run's enumeration recorded. */
|
|
32
|
-
added: number;
|
|
33
|
-
stable: true;
|
|
34
|
-
}
|
|
35
|
-
/** Where the freeze stands: published (`frozenAt`) and its enumeration completed (`enumeratedAt`). */
|
|
36
|
-
export interface LegacyFreezeState {
|
|
37
|
-
frozenAt: Date | null;
|
|
38
|
-
/** When the freeze's own enumeration last completed with a stable pass; null: never. */
|
|
39
|
-
enumeratedAt: Date | null;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* The cutover barrier is not in place: legacy admission is still open (no freeze), or the freeze
|
|
43
|
-
* is published but its enumeration never completed. Nothing that depends on closed admission
|
|
44
|
-
* (the cloud snapshot) may run.
|
|
45
|
-
*/
|
|
46
|
-
export declare class CutoverBarrierError extends Error {
|
|
47
|
-
constructor(message: string);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* The freeze is published, but its enumeration kept finding new rows for every pass (legacy rows,
|
|
51
|
-
* for example of a replica without the freeze code, or revoked managed starts). The freeze stays published (it
|
|
52
|
-
* is never undone) and is not marked enumerated; stop that replica and run the freeze again.
|
|
53
|
-
*/
|
|
54
|
-
export declare class LegacyFreezeUnsettledError extends Error {
|
|
55
|
-
constructor(passes: number, added: number);
|
|
56
|
-
}
|
|
57
|
-
/** What the release gate reads: unresolved obligations are reported, never called retired. */
|
|
58
|
-
export interface LegacyRetirementReport {
|
|
59
|
-
frozen: boolean;
|
|
60
|
-
/** When the freeze was published; null before. */
|
|
61
|
-
frozenAt: Date | null;
|
|
62
|
-
/**
|
|
63
|
-
* When the freeze's own enumeration last completed stable; null while it never did (the cloud
|
|
64
|
-
* snapshot refuses until then: run the freeze again).
|
|
65
|
-
*/
|
|
66
|
-
freezeEnumeratedAt: Date | null;
|
|
67
|
-
/**
|
|
68
|
-
* Running legacy launches reserved by fenced code and never admitted for dispatch: the freeze
|
|
69
|
-
* refuses their dispatch (the pending producers it fences).
|
|
70
|
-
*/
|
|
71
|
-
fencedReservations: number;
|
|
72
|
-
/**
|
|
73
|
-
* Evidence of replicas without the 8.5 code (they are not fenced by the freeze): legacy rows
|
|
74
|
-
* without the dispatch marker (`legacy_dispatch = 'unknown'`) started after migration 0157 was
|
|
75
|
-
* applied (only such a replica writes them); how many of those started after the freeze, after
|
|
76
|
-
* its enumeration (the barrier refuses then) and in the last 15 minutes by the database clock;
|
|
77
|
-
* and the latest one's start. Nonzero `afterFreeze` or `recent`: an old replica still runs; stop
|
|
78
|
-
* it. Rows of an old replica that never starts a legacy task are not detectable here.
|
|
79
|
-
*/
|
|
80
|
-
unfencedWriters: {
|
|
81
|
-
sinceMigration: number;
|
|
82
|
-
afterFreeze: number;
|
|
83
|
-
afterEnumeration: number;
|
|
84
|
-
recent: number;
|
|
85
|
-
latestAt: Date | null;
|
|
86
|
-
};
|
|
87
|
-
open: number;
|
|
88
|
-
quarantined: number;
|
|
89
|
-
resolved: number;
|
|
90
|
-
/** Members of resolved obligations whose own records are not settled yet. */
|
|
91
|
-
unsettledMembers: number;
|
|
92
|
-
/**
|
|
93
|
-
* True only with the freeze published and every obligation not abandoned resolved and settled.
|
|
94
|
-
* Abandoned ones are excluded: see {@link cleanRetirement}.
|
|
95
|
-
*/
|
|
96
|
-
retired: boolean;
|
|
97
|
-
/** {@link retired} with no abandoned obligation either. */
|
|
98
|
-
cleanRetirement: boolean;
|
|
99
|
-
/** Obligations abandoned with their deleted devices: never evidence the processes ended. */
|
|
100
|
-
abandoned: number;
|
|
101
|
-
/** Members of abandoned obligations (left unsettled; not in {@link unsettledMembers}). */
|
|
102
|
-
abandonedMembers: number;
|
|
103
|
-
abandonedList: {
|
|
104
|
-
deviceId: string;
|
|
105
|
-
provider: string;
|
|
106
|
-
instanceGeneration: string;
|
|
107
|
-
abandonedAt: Date;
|
|
108
|
-
}[];
|
|
109
|
-
/**
|
|
110
|
-
* The cloud pre-check (before the freeze, too): cloud devices with legacy rows whose incarnation
|
|
111
|
-
* or provider is unknown. It reads the task rows, so it lists what the freeze will turn into
|
|
112
|
-
* such obligations; it does not empty by itself. After the freeze such an obligation resolves
|
|
113
|
-
* only once the device's current incarnation is destroyed with confirmation, it keeps no earlier
|
|
114
|
-
* provider's instance (`prevHandle`) and it has an instance record that once had an instance
|
|
115
|
-
* (`noInstance`); a device with either must be deleted and created again
|
|
116
|
-
* (`device.recreate_required`).
|
|
117
|
-
* `currentUnconfirmed`: the current row is not live and no destruction of it is recorded (the
|
|
118
|
-
* inactivity sweep before 0157, or a failed create); the gate then destroys by the device's
|
|
119
|
-
* instance name with the row's provider, which must be loaded (`device.unavailable` until then).
|
|
120
|
-
*/
|
|
121
|
-
cloudUnknown: {
|
|
122
|
-
deviceId: string;
|
|
123
|
-
prevHandle: boolean;
|
|
124
|
-
noInstance: boolean;
|
|
125
|
-
currentUnconfirmed: boolean;
|
|
126
|
-
}[];
|
|
127
|
-
unresolved: {
|
|
128
|
-
deviceId: string;
|
|
129
|
-
provider: string;
|
|
130
|
-
instanceGeneration: string;
|
|
131
|
-
state: "open" | "quarantined";
|
|
132
|
-
reason: string | null;
|
|
133
|
-
}[];
|
|
134
|
-
}
|
|
135
|
-
/** A member of an obligation (a legacy task row, or a revoked managed start). */
|
|
136
|
-
export interface RetirementMember {
|
|
137
|
-
obligationId: string;
|
|
138
|
-
kind: "legacy-task" | "revoked-start";
|
|
139
|
-
refId: string;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Whether `provider` names a provider (one whose whole-instance destroy is confirmed): any
|
|
143
|
-
* recorded provider, the same for every one, never the `unknown` of an incarnation the kernel
|
|
144
|
-
* cannot name.
|
|
145
|
-
*/
|
|
146
|
-
export declare const isKnownProvider: (provider: string) => boolean;
|
|
147
|
-
export declare class LegacyRetirementStore {
|
|
148
|
-
private readonly db;
|
|
149
|
-
readonly txHost: TransactionHost;
|
|
150
|
-
private readonly locks;
|
|
151
|
-
constructor(db: KernelDb, txHost: TransactionHost, locks: PermissionAuthorityLock);
|
|
152
|
-
/**
|
|
153
|
-
* Publishes the legacy-launch freeze under the platform authority writer, then enumerates every
|
|
154
|
-
* legacy row and revoked start until stable; idempotent. Returns when it was first published.
|
|
155
|
-
* Never undone.
|
|
156
|
-
*/
|
|
157
|
-
freeze(by: string): Promise<LegacyFreezeResult>;
|
|
158
|
-
/** Whether the freeze is published and whether its enumeration completed. */
|
|
159
|
-
freezeState(): Promise<LegacyFreezeState>;
|
|
160
|
-
/**
|
|
161
|
-
* The cutover barrier (B-10): legacy admission is closed (the freeze is published), the
|
|
162
|
-
* freeze's own enumeration completed, and no unmarked legacy row (only an old, unfenced replica
|
|
163
|
-
* writes one) started after that enumeration. Throws {@link CutoverBarrierError} otherwise. The
|
|
164
|
-
* freeze is never undone; a later legacy row is still enumerated by the gate before any use.
|
|
165
|
-
*/
|
|
166
|
-
assertCutoverBarrier(): Promise<void>;
|
|
167
|
-
private publishFreeze;
|
|
168
|
-
/** When the freeze was published; null before. */
|
|
169
|
-
frozenAt(): Promise<Date | null>;
|
|
170
|
-
/**
|
|
171
|
-
* The worker's sweep of obligations whose device is gone (its row missing, `deleted_at` set, or
|
|
172
|
-
* its org soft-deleted), at most `limit` per call:
|
|
173
|
-
* - one waits while the device's instance row exists:
|
|
174
|
-
* its destroy is still owed (the destroy job or the destruction sweep deletes the row when it
|
|
175
|
-
* is done) and records the destruction then;
|
|
176
|
-
* - one whose exact incarnation has a recorded confirmed destruction resolves
|
|
177
|
-
* `provider-destroyed`, an already `abandoned` one too (provider evidence, not a
|
|
178
|
-
* reopen);
|
|
179
|
-
* - every other one becomes `abandoned`. Device ids are never reused, so no device can acquire
|
|
180
|
-
* that incarnation again, but abandonment is no evidence that its processes ended (they may
|
|
181
|
-
* still run on that computer); its members stay unsettled.
|
|
182
|
-
* Returns the counts.
|
|
183
|
-
*/
|
|
184
|
-
abandonDeleted(limit: number): Promise<{
|
|
185
|
-
resolved: number;
|
|
186
|
-
abandoned: number;
|
|
187
|
-
}>;
|
|
188
|
-
frozen(): Promise<boolean>;
|
|
189
|
-
/**
|
|
190
|
-
* One enumeration pass: every legacy row (only once the freeze is published) and every revoked
|
|
191
|
-
* managed start that may still own processes on an incarnation that no longer runs, recorded as
|
|
192
|
-
* members of their obligations. Idempotent; returns how many new members it recorded. The
|
|
193
|
-
* worker repeats it every tick, so a row an old unfenced replica writes later is still found.
|
|
194
|
-
*/
|
|
195
|
-
scan(deviceId?: string): Promise<{
|
|
196
|
-
added: number;
|
|
197
|
-
}>;
|
|
198
|
-
/** Repeats {@link scan} until a pass adds nothing (at most `maxPasses`). */
|
|
199
|
-
scanUntilStable(maxPasses?: number, deviceId?: string): Promise<{
|
|
200
|
-
added: number;
|
|
201
|
-
stable: boolean;
|
|
202
|
-
}>;
|
|
203
|
-
/**
|
|
204
|
-
* Legacy rows whose processes may still exist and that are not members yet (one device's, or
|
|
205
|
-
* all). The `(status = 'running' OR kill_pending OR sid IS NULL)` conjunct is the partial index's
|
|
206
|
-
* predicate (0157), stated as is so the planner can use it.
|
|
207
|
-
*/
|
|
208
|
-
private legacyCandidates;
|
|
209
|
-
private scanLegacyTasks;
|
|
210
|
-
/** Revoked managed starts on an incarnation that no longer runs, not members yet. */
|
|
211
|
-
private revokedCandidates;
|
|
212
|
-
private scanRevokedStarts;
|
|
213
|
-
/** The obligation of the incarnation (created when missing), with the member added. */
|
|
214
|
-
private addMember;
|
|
215
|
-
/** The device's unresolved obligations (open and quarantined), oldest first. */
|
|
216
|
-
unresolved(deviceId: string): Promise<RetirementObligation[]>;
|
|
217
|
-
/**
|
|
218
|
-
* Whether the device has an unresolved obligation, or a candidate not enumerated yet (a legacy
|
|
219
|
-
* row once frozen, a revoked start): the shared-path check. A candidate counts as unresolved, so
|
|
220
|
-
* the device goes to the gate, which enumerates it under the exclusive lease (C1).
|
|
221
|
-
*/
|
|
222
|
-
hasUnresolved(deviceId: string): Promise<boolean>;
|
|
223
|
-
/**
|
|
224
|
-
* No trusted way to establish termination: the obligation is quarantined (the device stays
|
|
225
|
-
* unavailable). A resolved obligation is left as it is.
|
|
226
|
-
*/
|
|
227
|
-
quarantine(id: string, reason: string): Promise<void>;
|
|
228
|
-
/** A failed destroy or verification: the obligation stays as it is, the attempt is recorded. */
|
|
229
|
-
noteFailure(id: string, error: unknown): Promise<void>;
|
|
230
|
-
/** The provider confirmed the incarnation destroyed: the obligation resolves. */
|
|
231
|
-
resolveDestroyed(id: string): Promise<void>;
|
|
232
|
-
/**
|
|
233
|
-
* The provider confirmed the exact cancellation of the revoked managed starts `covered` on the
|
|
234
|
-
* resumed incarnation (B-22): under the obligation's row lock (the lock {@link addMember} takes
|
|
235
|
-
* before it adds a member), resolves it as `exact-cancelled` and acknowledges those
|
|
236
|
-
* revocations, only while every member is one of them. False (nothing changed) when a member
|
|
237
|
-
* outside `covered` exists, which was never stopped: the caller destroys the incarnation
|
|
238
|
-
* instead. Acknowledging here is what tells a member added later apart ({@link scan}).
|
|
239
|
-
*/
|
|
240
|
-
resolveCancelled(id: string, covered: readonly string[]): Promise<boolean>;
|
|
241
|
-
/**
|
|
242
|
-
* Reopens `exact-cancelled` obligations holding a member nobody stopped: a legacy row, or a
|
|
243
|
-
* revoked start whose intent is not there acknowledged, a missing intent included (every
|
|
244
|
-
* member the cancel covered was acknowledged with the resolution). A replica without the reopen in {@link addMember} (a
|
|
245
|
-
* rolling upgrade) adds such members to a resolved obligation; the next scan of a new one
|
|
246
|
-
* reopens it. Returns how many it reopened.
|
|
247
|
-
*/
|
|
248
|
-
private reopenLateMembers;
|
|
249
|
-
/**
|
|
250
|
-
* A member of obligation `o` an exact cancel never covered (see {@link reopenLateMembers}),
|
|
251
|
-
* correlated on `o.id`.
|
|
252
|
-
*/
|
|
253
|
-
private lateMember;
|
|
254
|
-
/** The exact old obligations the owner may check, within their guarded org. */
|
|
255
|
-
quarantinedLocal(check: LocalRetirementCheck): Promise<RetirementObligation[]>;
|
|
256
|
-
/** Correlate the kernel incarnation to a single exact generation of the local provider. */
|
|
257
|
-
localProviderGeneration(o: RetirementObligation): Promise<string | undefined>;
|
|
258
|
-
/** Commit exact evidence only while all identities seen by the owner check still hold. */
|
|
259
|
-
resolveLocalProof(check: LocalRetirementCheck, o: RetirementObligation, providerGeneration: string | undefined, signal: AbortSignal): Promise<void>;
|
|
260
|
-
/** The members of one obligation, oldest first. */
|
|
261
|
-
membersOf(obligationId: string): Promise<RetirementMember[]>;
|
|
262
|
-
/**
|
|
263
|
-
* Records the provider-confirmed destruction of an incarnation, the same for every provider (a
|
|
264
|
-
* provider is trusted like every extension). An `unknown` provider names nothing and is refused.
|
|
265
|
-
*/
|
|
266
|
-
recordDestruction(deviceId: string, provider: string, generation: string): Promise<void>;
|
|
267
|
-
/** Whether a confirmed destruction of exactly that incarnation was recorded. */
|
|
268
|
-
destructionRecorded(deviceId: string, provider: string, generation: string): Promise<boolean>;
|
|
269
|
-
/**
|
|
270
|
-
* Devices with an unresolved obligation the worker should try now: never attempted, or last
|
|
271
|
-
* attempted longer ago than the backoff (30 s doubling per attempt, at most an hour).
|
|
272
|
-
*/
|
|
273
|
-
due(limit: number): Promise<string[]>;
|
|
274
|
-
/** Members of resolved obligations whose own records are not settled yet. */
|
|
275
|
-
unsettledMembers(limit: number): Promise<RetirementMember[]>;
|
|
276
|
-
markSettled(m: RetirementMember): Promise<void>;
|
|
277
|
-
/**
|
|
278
|
-
* Legacy rows without the dispatch marker started after the marker's migration was applied:
|
|
279
|
-
* only a replica without the 8.5 code writes them (see {@link LegacyRetirementReport}).
|
|
280
|
-
*/
|
|
281
|
-
private unfencedWriters;
|
|
282
|
-
/** The release gate's honest view (a quarantined device is unavailable, not retired). */
|
|
283
|
-
report(): Promise<LegacyRetirementReport>;
|
|
284
|
-
}
|