@capybara-hq/kernel 0.1.0-rc.77 → 0.1.0-rc.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bootstrap.json +6 -6
- package/dist/admin/outbox-dead.service.js +4 -1
- package/dist/agents/admin-agents.js +2 -0
- package/dist/agents/agent-lookup.js +4 -0
- package/dist/agents/agent-profile.service.js +3 -0
- package/dist/agents/agents.service.js +7 -0
- package/dist/agents/org-templates.js +1 -0
- package/dist/agents/pending-connector-requests.js +6 -0
- package/dist/agents/pending-connectors.service.js +2 -0
- package/dist/agents/readiness.service.d.ts +9 -3
- package/dist/agents/readiness.service.js +3 -3
- package/dist/agents/templates.js +1 -0
- package/dist/background/finish.js +3 -0
- package/dist/background/stop.js +2 -0
- package/dist/background/store.js +44 -0
- package/dist/background/tasks.service.js +3 -2
- package/dist/background/wake-rules.js +1 -0
- package/dist/catalog/admin-catalog.controller.d.ts +6 -0
- package/dist/catalog/admin-catalog.controller.js +13 -0
- package/dist/catalog/catalog-content.d.ts +6 -0
- package/dist/catalog/catalog-content.js +1 -0
- package/dist/catalog/catalog-items.js +4 -0
- package/dist/catalog/catalog-scope.service.js +4 -1
- package/dist/catalog/component-promotion.js +2 -0
- package/dist/catalog/component-scope.controller.d.ts +9 -15
- package/dist/catalog/component-scope.controller.js +14 -9
- package/dist/catalog/component-scope.service.js +5 -0
- package/dist/catalog/component-state.js +2 -0
- package/dist/catalog/marketplaces.service.d.ts +6 -1
- package/dist/catalog/marketplaces.service.js +8 -3
- package/dist/catalog/org-catalog.controller.d.ts +9 -0
- package/dist/catalog/org-catalog.controller.js +18 -0
- package/dist/catalog/org-catalog.schemas.d.ts +2 -4
- package/dist/catalog/org-catalog.schemas.js +2 -3
- package/dist/catalog/org-catalog.service.d.ts +10 -1
- package/dist/catalog/org-catalog.service.js +34 -23
- package/dist/catalog/org-extension-switch.d.ts +3 -10
- package/dist/catalog/org-extension-switch.js +14 -60
- package/dist/catalog/org-extension.controller.d.ts +6 -7
- package/dist/catalog/org-extension.controller.js +4 -4
- package/dist/catalog/org-extension.schemas.d.ts +1 -2
- package/dist/catalog/org-extension.schemas.js +1 -3
- package/dist/catalog/owned-items.js +10 -1
- package/dist/catalog/ownership.js +2 -0
- package/dist/catalog/plugin-import.js +8 -0
- package/dist/catalog/plugin-install.d.ts +1 -4
- package/dist/catalog/plugin-install.js +11 -12
- package/dist/catalog/plugin-upgrade.js +4 -1
- package/dist/catalog/request-rules.js +6 -0
- package/dist/catalog/requests.service.js +4 -0
- package/dist/catalog/scope-orgs.js +1 -0
- package/dist/catalog/scope-sync.d.ts +8 -5
- package/dist/catalog/scope-sync.js +21 -23
- package/dist/catalog/unshare.js +3 -0
- package/dist/channels/connections.service.js +1 -0
- package/dist/channels/inbound.js +1 -0
- package/dist/channels/jobs.js +1 -0
- package/dist/channels/outbound.js +6 -0
- package/dist/channels/supervisor.js +1 -0
- package/dist/channels/threads.js +1 -0
- package/dist/client/client-reports.service.js +1 -0
- package/dist/config/fields.js +20 -4
- package/dist/conversations/access.js +1 -0
- package/dist/conversations/attachments.service.js +16 -4
- package/dist/conversations/conversations.service.js +17 -3
- package/dist/conversations/event-log.js +2 -0
- package/dist/conversations/events.d.ts +1 -0
- package/dist/conversations/events.js +3 -1
- package/dist/conversations/files.js +3 -2
- package/dist/conversations/permission-profiles.service.js +1 -0
- package/dist/conversations/prompt-suggestions.js +2 -0
- package/dist/conversations/queue.js +8 -0
- package/dist/conversations/queue.service.js +6 -2
- package/dist/conversations/source.js +2 -0
- package/dist/conversations/titles.js +10 -2
- package/dist/conversations/tree.js +6 -0
- package/dist/db/kernel-schema.d.ts +3 -1
- package/dist/devices/conversation-devices.js +3 -0
- package/dist/devices/device-projects.service.js +2 -0
- package/dist/devices/devices.service.js +5 -0
- package/dist/devices/legacy-cleanup.job.js +5 -2
- package/dist/dial-in/handlers.js +2 -0
- package/dist/dial-in/machines.js +11 -2
- package/dist/dial-in/targets.d.ts +0 -2
- package/dist/dial-in/targets.js +0 -10
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +0 -1
- package/dist/evals/budget.js +14 -1
- package/dist/evals/run-replay.js +4 -0
- package/dist/evals/runs.service.js +13 -7
- package/dist/evals/sets.service.js +23 -8
- package/dist/evals/trajectory.service.d.ts +1 -1
- package/dist/evals/trajectory.service.js +1 -0
- package/dist/evals/worker.js +5 -1
- package/dist/extensions/admin-ops.js +1 -0
- package/dist/extensions/admin-view.js +3 -1
- package/dist/extensions/bootstrap-packages.d.ts +12 -1
- package/dist/extensions/bootstrap-packages.js +49 -9
- package/dist/extensions/bootstrap.d.ts +17 -2
- package/dist/extensions/bootstrap.js +41 -9
- package/dist/extensions/config-json-schema.d.ts +2 -2
- package/dist/extensions/config-json-schema.js +1 -3
- package/dist/extensions/deployment-config.d.ts +5 -3
- package/dist/extensions/deployment-config.js +3 -3
- package/dist/extensions/effective-config.d.ts +8 -7
- package/dist/extensions/effective-config.js +8 -7
- package/dist/extensions/enabled.js +1 -0
- package/dist/extensions/host.d.ts +4 -3
- package/dist/extensions/host.js +11 -12
- package/dist/extensions/instance.d.ts +1 -1
- package/dist/extensions/instance.js +17 -2
- package/dist/extensions/org-config.d.ts +35 -97
- package/dist/extensions/org-config.js +48 -315
- package/dist/extensions/org-levels.d.ts +22 -9
- package/dist/extensions/org-levels.js +100 -20
- package/dist/extensions/org-overrides.d.ts +14 -15
- package/dist/extensions/org-overrides.js +20 -20
- package/dist/extensions/package.js +1 -1
- package/dist/extensions/permission-set.d.ts +1 -3
- package/dist/extensions/permission-set.js +3 -7
- package/dist/extensions/permission-view.d.ts +3 -1
- package/dist/extensions/permission-view.js +5 -4
- package/dist/extensions/plugin-icons.d.ts +72 -1
- package/dist/extensions/plugin-icons.js +194 -2
- package/dist/extensions/point-defaults.d.ts +17 -18
- package/dist/extensions/point-defaults.js +25 -28
- package/dist/identity/accounts.js +6 -0
- package/dist/identity/api-tokens.js +8 -0
- package/dist/infra/outbox/outbox.dispatcher.js +4 -1
- package/dist/infra/outbox/outbox.service.js +2 -0
- package/dist/orgs/directory-sync.d.ts +9 -6
- package/dist/orgs/directory-sync.js +15 -12
- package/dist/orgs/invitations.service.js +2 -0
- package/dist/orgs/members.service.js +2 -0
- package/dist/orgs/offboarding.js +2 -0
- package/dist/packages/npm.d.ts +9 -1
- package/dist/packages/npm.js +37 -5
- package/dist/platform/exclusions.js +20 -0
- package/dist/platform/ops/admin-items.ops.js +1 -0
- package/dist/platform/ops/agents.ops.js +1 -0
- package/dist/platform/ops/extensions.ops.d.ts +6 -8
- package/dist/platform/ops/extensions.ops.js +18 -97
- package/dist/platform/ops/org-plugins.ops.d.ts +3 -6
- package/dist/platform/ops/org-plugins.ops.js +14 -65
- package/dist/platform/ops/outbox.ops.js +1 -0
- package/dist/platform/ops/person-inputs.d.ts +0 -4
- package/dist/platform/ops/person-inputs.js +0 -8
- package/dist/platform/ops/plugins.ops.d.ts +4 -1
- package/dist/platform/ops/plugins.ops.js +27 -34
- package/dist/platform/person-fields.d.ts +1 -1
- package/dist/platform/person-fields.js +1 -1
- package/dist/platform/sealed-reveals.js +2 -0
- package/dist/push/recipients.js +9 -2
- package/dist/runtime/permission-context.service.js +1 -0
- package/dist/runtime/plugin-context.service.js +1 -0
- package/dist/runtime/project/knowledge.service.js +1 -0
- package/dist/runtime/run-context.service.js +1 -0
- package/dist/runtime/run-deletion.js +4 -0
- package/dist/runtime/run-execution.js +2 -0
- package/dist/runtime/run-finish.js +3 -0
- package/dist/runtime/run-jobs.js +3 -0
- package/dist/runtime/run-orphan-check.job.js +7 -0
- package/dist/runtime/run-queue.js +21 -2
- package/dist/runtime/run-worker.js +5 -0
- package/dist/runtime/step-log.js +1 -0
- package/dist/runtime/subagents/child.js +2 -0
- package/dist/runtime/subagents/deliveries.js +3 -0
- package/dist/runtime/subagents/dispatch.js +5 -1
- package/dist/runtime/subagents/messages.js +2 -0
- package/dist/runtime/subagents/org-agents.d.ts +1 -1
- package/dist/runtime/subagents/org-agents.js +2 -1
- package/dist/runtime/usage-report-jobs.js +1 -0
- package/dist/runtime/usage-report.js +3 -0
- package/dist/runtime/waits.js +5 -0
- package/dist/sandbox/cloud-permission-snapshot.js +9 -3
- package/dist/sandbox/device-reports.js +3 -0
- package/dist/sandbox/legacy-retirement.js +5 -1
- package/dist/sandbox/managed-device-context.js +1 -0
- package/dist/sandbox/modes.d.ts +5 -2
- package/dist/sandbox/modes.js +8 -4
- package/dist/sandbox/network-grants.js +2 -0
- package/dist/sandbox/operation-intents.js +58 -0
- package/dist/sandbox/operation-reconcile.job.js +2 -0
- package/dist/sandbox/permission-authority-lock.js +12 -6
- package/dist/sandbox/permission-call-grants.js +6 -0
- package/dist/sandbox/permission-ceiling-writes.js +5 -0
- package/dist/sandbox/permission-config-publication.js +5 -0
- package/dist/sandbox/permission-instance-writes.js +4 -0
- package/dist/sandbox/permission-runtime-reports.js +10 -1
- package/dist/sandbox/permission-transitions.js +3 -0
- package/dist/sandbox/review/review.service.js +8 -5
- package/dist/sandbox/sandbox.service.d.ts +14 -0
- package/dist/sandbox/sandbox.service.js +195 -29
- package/dist/sandbox/unreachable.js +4 -1
- package/dist/schedules/fire.js +9 -3
- package/dist/schedules/pause.js +2 -0
- package/dist/schedules/run-tracker.js +16 -1
- package/dist/schedules/scheduled-tasks.service.js +4 -2
- package/dist/schedules/store.js +8 -0
- package/dist/schedules/unattended.js +4 -0
- package/dist/setup/setup-checks.service.d.ts +1 -10
- package/dist/setup/setup-checks.service.js +19 -29
- package/dist/shares/share-open.service.js +1 -0
- package/dist/shares/shares.service.js +2 -0
- package/dist/skills/agent-skills.service.d.ts +1 -1
- package/dist/skills/agent-skills.service.js +13 -2
- package/dist/skills/catalog.js +3 -0
- package/dist/skills/changes.service.js +10 -2
- package/dist/skills/conversation-catalog.js +1 -0
- package/dist/skills/skills.service.js +4 -0
- package/dist/tools/approvals.service.js +40 -0
- package/dist/tools/builtins/schedules.js +11 -6
- package/dist/tools/builtins/web/fetch.js +1 -1
- package/dist/tools/builtins/web/search.js +1 -1
- package/dist/tools/connector-account-policies.js +3 -0
- package/dist/tools/connectors.controller.d.ts +20 -8
- package/dist/tools/connectors.controller.js +30 -12
- package/dist/tools/connectors.service.d.ts +8 -0
- package/dist/tools/connectors.service.js +21 -1
- package/dist/tools/drift.js +5 -0
- package/dist/tools/git-push-policy.js +3 -0
- package/dist/tools/oauth/flow.js +1 -0
- package/dist/tools/outputs.js +2 -0
- package/dist/tools/permission-approval-jobs.js +3 -0
- package/dist/tools/pipeline.js +2 -0
- package/dist/tools/policy.js +3 -0
- package/dist/tools/questions.service.js +13 -0
- package/package.json +3 -3
|
@@ -52,6 +52,8 @@ let LegacySandboxCleanupJob = class LegacySandboxCleanupJob {
|
|
|
52
52
|
this.log.info("legacy sandboxes destroyed", { ...res });
|
|
53
53
|
}
|
|
54
54
|
/** One run (see the class); `signal` (the stop, or a lost run lock) is read between rows. */
|
|
55
|
+
// org-filter: deployment-wide sweep of the legacy sandboxes table across all orgs
|
|
56
|
+
// (LockedInterval), each row keyed by its own conversation id
|
|
55
57
|
async runOnce(now = new Date(), signal) {
|
|
56
58
|
const any = await this.db
|
|
57
59
|
.selectFrom("sandboxes")
|
|
@@ -96,12 +98,13 @@ let LegacySandboxCleanupJob = class LegacySandboxCleanupJob {
|
|
|
96
98
|
? AbortSignal.any([signal, AbortSignal.timeout(CALL_TIMEOUT_MS)])
|
|
97
99
|
: AbortSignal.timeout(CALL_TIMEOUT_MS);
|
|
98
100
|
try {
|
|
99
|
-
|
|
101
|
+
// no device lease holds a legacy row: nothing to fence the destroy with
|
|
102
|
+
await impl.destroyByName(name, callSignal(), null);
|
|
100
103
|
await impl.destroyFileSystemByName(name, callSignal());
|
|
101
104
|
if (row.prev_provider !== null && row.prev_provider !== row.provider) {
|
|
102
105
|
const prev = this.providers.forDevice(row.prev_provider)?.impl;
|
|
103
106
|
if (prev !== undefined)
|
|
104
|
-
await prev.destroyByName(name, callSignal());
|
|
107
|
+
await prev.destroyByName(name, callSignal(), null);
|
|
105
108
|
else {
|
|
106
109
|
this.log.warn("legacy sandbox of a replaced provider left: provider not loaded", {
|
|
107
110
|
name,
|
package/dist/dial-in/handlers.js
CHANGED
|
@@ -29,6 +29,8 @@ let DialInHandlers = class DialInHandlers {
|
|
|
29
29
|
this.selection = selection;
|
|
30
30
|
this.registry = registry;
|
|
31
31
|
}
|
|
32
|
+
// org-filter: deviceId is the device of an authenticated machine connection (the gateway); the
|
|
33
|
+
// device row supplies its org
|
|
32
34
|
async forDevice(deviceId) {
|
|
33
35
|
const row = await this.kdb.db
|
|
34
36
|
.selectFrom("devices")
|
package/dist/dial-in/machines.js
CHANGED
|
@@ -60,6 +60,7 @@ let DialInMachines = class DialInMachines {
|
|
|
60
60
|
.selectFrom("device_machines")
|
|
61
61
|
.select(["name", "os", "arch"])
|
|
62
62
|
.where("device_id", "=", input.deviceId)
|
|
63
|
+
.where("org_id", "=", input.orgId)
|
|
63
64
|
.orderBy("created_at", "desc")
|
|
64
65
|
.orderBy("id", "desc")
|
|
65
66
|
.limit(1)
|
|
@@ -68,7 +69,7 @@ let DialInMachines = class DialInMachines {
|
|
|
68
69
|
const moved = prev !== undefined && !sameMachine(prev, input);
|
|
69
70
|
// no stop frame: it would wait on the list and could reach the replacement machine instead
|
|
70
71
|
await this.revokeActive(input.deviceId, "replaced");
|
|
71
|
-
await this.resetInstance(input.deviceId, moved);
|
|
72
|
+
await this.resetInstance(input.orgId, input.deviceId, moved);
|
|
72
73
|
const credential = MACHINE_CREDENTIAL_PREFIX + randomBytes(32).toString("base64url");
|
|
73
74
|
const row = await this.db
|
|
74
75
|
.insertInto("device_machines")
|
|
@@ -98,7 +99,7 @@ let DialInMachines = class DialInMachines {
|
|
|
98
99
|
* or arch differ from the device's previous machine) has other files. Another directory on
|
|
99
100
|
* the same machine is known only to the provider (from the new machine's first hello).
|
|
100
101
|
*/
|
|
101
|
-
async resetInstance(deviceId, moved) {
|
|
102
|
+
async resetInstance(orgId, deviceId, moved) {
|
|
102
103
|
await this.db
|
|
103
104
|
.updateTable("device_instances")
|
|
104
105
|
.set((eb) => ({
|
|
@@ -114,6 +115,7 @@ let DialInMachines = class DialInMachines {
|
|
|
114
115
|
: sql `CASE WHEN fs_status = 'lost' THEN fs_resets + 1 ELSE fs_resets END`,
|
|
115
116
|
}))
|
|
116
117
|
.where("device_id", "=", deviceId)
|
|
118
|
+
.where("org_id", "=", orgId)
|
|
117
119
|
.execute();
|
|
118
120
|
}
|
|
119
121
|
/**
|
|
@@ -150,6 +152,7 @@ let DialInMachines = class DialInMachines {
|
|
|
150
152
|
: null;
|
|
151
153
|
}
|
|
152
154
|
/** Whether the device is deleted (soft-deleted, or gone): why its credential stopped working. */
|
|
155
|
+
// org-filter: deviceId is the device of the connection's authenticated machine credential
|
|
153
156
|
async isDeviceDeleted(deviceId) {
|
|
154
157
|
const row = await this.db
|
|
155
158
|
.selectFrom("devices")
|
|
@@ -164,6 +167,7 @@ let DialInMachines = class DialInMachines {
|
|
|
164
167
|
* host's boot identity (none clears the stored one). Marks the machine seen. A revoked machine
|
|
165
168
|
* is left alone.
|
|
166
169
|
*/
|
|
170
|
+
// org-filter: machineId is the connection's authenticated machine credential, not caller input
|
|
167
171
|
async recordConnect(machineId, program) {
|
|
168
172
|
await this.db
|
|
169
173
|
.updateTable("device_machines")
|
|
@@ -179,6 +183,7 @@ let DialInMachines = class DialInMachines {
|
|
|
179
183
|
.execute();
|
|
180
184
|
}
|
|
181
185
|
/** Marks the machine seen (a ping); writes at most once every 60 seconds. */
|
|
186
|
+
// org-filter: machineId is the connection's authenticated machine credential, not caller input
|
|
182
187
|
async touch(machineId) {
|
|
183
188
|
await this.db
|
|
184
189
|
.updateTable("device_machines")
|
|
@@ -197,6 +202,8 @@ let DialInMachines = class DialInMachines {
|
|
|
197
202
|
* the revoked machine's id. Used by {@link issue} (`replaced`) and the device's deletion
|
|
198
203
|
* (`deleted`).
|
|
199
204
|
*/
|
|
205
|
+
// org-filter: deviceId is a device the caller already checked in its org (issue's sign-in
|
|
206
|
+
// confirmation, the device's deletion); the device row supplies the org for the locks
|
|
200
207
|
async revokeActive(deviceId, reason) {
|
|
201
208
|
const device = await this.db
|
|
202
209
|
.selectFrom("devices")
|
|
@@ -222,6 +229,7 @@ let DialInMachines = class DialInMachines {
|
|
|
222
229
|
* Revokes one machine by id (a sign-in whose credential never reached the program), with the
|
|
223
230
|
* same post-commit disconnect as a replacement (no stop frame). True when it was active.
|
|
224
231
|
*/
|
|
232
|
+
// org-filter: machineId was issued by this sign-in flow (DialInAuth.abandon), not caller input
|
|
225
233
|
async revokeMachine(machineId) {
|
|
226
234
|
const machine = await this.db
|
|
227
235
|
.selectFrom("device_machines")
|
|
@@ -246,6 +254,7 @@ let DialInMachines = class DialInMachines {
|
|
|
246
254
|
return true;
|
|
247
255
|
}
|
|
248
256
|
/** The device's active machine, or null. */
|
|
257
|
+
// org-filter: deviceId is the device the managed device context already resolved in its org
|
|
249
258
|
async activeFor(deviceId) {
|
|
250
259
|
const r = await this.db
|
|
251
260
|
.selectFrom("device_machines")
|
|
@@ -42,6 +42,4 @@ export declare class DeviceTargets {
|
|
|
42
42
|
*/
|
|
43
43
|
current(deviceId: string): Promise<DeviceConnectionInfo | null>;
|
|
44
44
|
state(deviceId: string): Promise<DeviceTargetState>;
|
|
45
|
-
/** The org of a live device, or null (missing or deleted). */
|
|
46
|
-
orgOf(deviceId: string): Promise<string | null>;
|
|
47
45
|
}
|
package/dist/dial-in/targets.js
CHANGED
|
@@ -81,16 +81,6 @@ let DeviceTargets = class DeviceTargets {
|
|
|
81
81
|
return "deleted";
|
|
82
82
|
return row.machine_id === null ? "revoked" : "active";
|
|
83
83
|
}
|
|
84
|
-
/** The org of a live device, or null (missing or deleted). */
|
|
85
|
-
async orgOf(deviceId) {
|
|
86
|
-
const row = await this.db
|
|
87
|
-
.selectFrom("devices")
|
|
88
|
-
.select("org_id")
|
|
89
|
-
.where("id", "=", deviceId)
|
|
90
|
-
.where("deleted_at", "is", null)
|
|
91
|
-
.executeTakeFirst();
|
|
92
|
-
return row?.org_id ?? null;
|
|
93
|
-
}
|
|
94
84
|
};
|
|
95
85
|
DeviceTargets = __decorate([
|
|
96
86
|
Injectable(),
|
package/dist/errors.d.ts
CHANGED
|
@@ -113,7 +113,6 @@ export declare const ERROR_CODES: {
|
|
|
113
113
|
/** The extension registers no tool of that name (org tool switches, layering spec A §7). */
|
|
114
114
|
readonly "extension.tool_not_found": 404;
|
|
115
115
|
readonly "extension.unavailable": 503;
|
|
116
|
-
readonly "extension.no_org_config": 400;
|
|
117
116
|
readonly "extension.config_invalid": 400;
|
|
118
117
|
readonly "extension.config_readonly": 409;
|
|
119
118
|
readonly "extension.field_not_overridable": 400;
|
package/dist/errors.js
CHANGED
|
@@ -113,7 +113,6 @@ export const ERROR_CODES = {
|
|
|
113
113
|
/** The extension registers no tool of that name (org tool switches, layering spec A §7). */
|
|
114
114
|
"extension.tool_not_found": 404,
|
|
115
115
|
"extension.unavailable": 503,
|
|
116
|
-
"extension.no_org_config": 400,
|
|
117
116
|
"extension.config_invalid": 400,
|
|
118
117
|
"extension.config_readonly": 409,
|
|
119
118
|
"extension.field_not_overridable": 400,
|
package/dist/evals/budget.js
CHANGED
|
@@ -26,6 +26,8 @@ export const usageTokens = (u) => u.inputTokens + u.outputTokens + u.cacheReadTo
|
|
|
26
26
|
* 累加用量:`UPDATE … RETURNING`,累加后 ≥ 上限且运行仍在执行 → 同一语句置 `capped`、记 `finished_at`。
|
|
27
27
|
* 运行已不在(被删)时返回 `{ used: 0, capped: true }`,调用方同样停下。
|
|
28
28
|
*/
|
|
29
|
+
// org-filter: by run id only; callers pass a run id read under an org filter or from a kernel-written
|
|
30
|
+
// eval job payload (worker), never a raw caller-supplied id
|
|
29
31
|
export async function consumeTokens(db, runId, tokens) {
|
|
30
32
|
const n = Math.max(0, Math.trunc(tokens));
|
|
31
33
|
const reaches = sql `tokens_used + ${n} >= token_cap AND status IN ('queued', 'running')`;
|
|
@@ -53,6 +55,8 @@ export const TOO_MANY_ERRORS = {
|
|
|
53
55
|
* 同一语句置 `failed`、记原因与 `finished_at`;成功 → 清零。返回运行是否因此被熔断。
|
|
54
56
|
* 多个任务并发时「连续」按写入顺序计(近似),足以挡住「每个请求都失败」的运行。
|
|
55
57
|
*/
|
|
58
|
+
// org-filter: by run id only; callers pass a run id read under an org filter or from a kernel-written
|
|
59
|
+
// eval job payload (worker), never a raw caller-supplied id
|
|
56
60
|
export async function recordOutcome(db, runId, ok, maxConsecutive) {
|
|
57
61
|
if (ok) {
|
|
58
62
|
await db
|
|
@@ -85,6 +89,8 @@ export async function recordOutcome(db, runId, ok, maxConsecutive) {
|
|
|
85
89
|
* 运行停下(取消 / 越限 / 熔断 / 删除评测集)时:还在等评委的结果(`judge_status = 'pending'`)记 `skipped`,
|
|
86
90
|
* 否则这些用例永远算不上做完。给了 `caseId` 只处理该用例。在途的评委请求做完后写不进来(条件是 pending),用量照样计入。
|
|
87
91
|
*/
|
|
92
|
+
// org-filter: by run id only; callers pass a run id read under an org filter or from a kernel-written
|
|
93
|
+
// eval job payload (worker), never a raw caller-supplied id
|
|
88
94
|
export async function skipPendingJudges(db, runId, caseId) {
|
|
89
95
|
let q = db
|
|
90
96
|
.updateTable("eval_results")
|
|
@@ -131,6 +137,8 @@ let EvalBudget = class EvalBudget {
|
|
|
131
137
|
* worker 每做完一个用例、取消、入队失败时都调用。Joins the caller's transaction (the lock is released with it),
|
|
132
138
|
* else runs in its own.
|
|
133
139
|
*/
|
|
140
|
+
// org-filter: by run id only; callers pass a run id read under an org filter or from a
|
|
141
|
+
// kernel-written eval job payload (worker), never a raw caller-supplied id
|
|
134
142
|
async recountCases(runId) {
|
|
135
143
|
const db = this.db.db;
|
|
136
144
|
const row = await db
|
|
@@ -172,7 +180,11 @@ let EvalBudget = class EvalBudget {
|
|
|
172
180
|
.where("status", "in", [...ACTIVE_EVAL_STATUSES]);
|
|
173
181
|
if (scope.agentId !== undefined) {
|
|
174
182
|
const agentId = scope.agentId;
|
|
175
|
-
q = q.where("set_id", "in", (eb) => eb
|
|
183
|
+
q = q.where("set_id", "in", (eb) => eb
|
|
184
|
+
.selectFrom("eval_sets")
|
|
185
|
+
.select("id")
|
|
186
|
+
.where("agent_id", "=", agentId)
|
|
187
|
+
.where("org_id", "=", scope.orgId));
|
|
176
188
|
}
|
|
177
189
|
const runs = await q.returning("id").execute();
|
|
178
190
|
for (const r of runs) {
|
|
@@ -192,6 +204,7 @@ let EvalBudget = class EvalBudget {
|
|
|
192
204
|
* A run that stopped (cancelled, its set deleted): its results not started yet are `skipped`,
|
|
193
205
|
* the pending judges too, and the progress is recounted, in the caller's transaction.
|
|
194
206
|
*/
|
|
207
|
+
// org-filter: by run id only; callers cancelled the run under an org filter in the same transaction
|
|
195
208
|
async skipRun(runId) {
|
|
196
209
|
await this.db
|
|
197
210
|
.updateTable("eval_results")
|
package/dist/evals/run-replay.js
CHANGED
|
@@ -63,6 +63,7 @@ let EvalReplaySeeder = class EvalReplaySeeder {
|
|
|
63
63
|
.selectFrom("eval_runs")
|
|
64
64
|
.select("id")
|
|
65
65
|
.where("id", "=", evalRunId)
|
|
66
|
+
.where("org_id", "=", p.orgId)
|
|
66
67
|
.where("status", "in", [...ACTIVE_EVAL_STATUSES])
|
|
67
68
|
.forShare()
|
|
68
69
|
.executeTakeFirst();
|
|
@@ -256,6 +257,8 @@ export function runBaseline(s) {
|
|
|
256
257
|
* 删掉一个评测对话(崩溃重跑前清掉上一次的残留):先删它各次运行的 checkpoint,再删对话(事件、运行随之级联删除)。
|
|
257
258
|
* 只删 `kind = 'eval'` 的对话。
|
|
258
259
|
*/
|
|
260
|
+
// org-filter: the id is an eval result's own eval_conversation_id (kernel-written, read by the worker
|
|
261
|
+
// from the claimed result row), and only `kind = 'eval'` rows are deleted
|
|
259
262
|
export async function deleteEvalConversation(d, conversationId) {
|
|
260
263
|
await d.hooks?.beforeDeleteConversation?.(conversationId);
|
|
261
264
|
const runs = await d.db
|
|
@@ -334,6 +337,7 @@ export async function replayRun(d, s, candidate, evalRunId, signal) {
|
|
|
334
337
|
.selectFrom("eval_runs")
|
|
335
338
|
.select("created_by")
|
|
336
339
|
.where("id", "=", evalRunId)
|
|
340
|
+
.where("org_id", "=", s.orgId)
|
|
337
341
|
.executeTakeFirstOrThrow();
|
|
338
342
|
const accountId = run.created_by;
|
|
339
343
|
const R = start.seq;
|
|
@@ -223,6 +223,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
223
223
|
.innerJoin("agent_versions as v", (j) => j.onRef("v.agent_id", "=", "a.id").onRef("v.version", "=", "a.current_version"))
|
|
224
224
|
.select("v.definition")
|
|
225
225
|
.where("a.id", "=", agentId)
|
|
226
|
+
.where("a.org_id", "=", orgId)
|
|
226
227
|
.executeTakeFirst();
|
|
227
228
|
model = current?.definition?.model;
|
|
228
229
|
}
|
|
@@ -256,6 +257,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
256
257
|
: sql `null`).as("subagent_source"),
|
|
257
258
|
])
|
|
258
259
|
.where("set_id", "=", setId)
|
|
260
|
+
.where("org_id", "=", orgId)
|
|
259
261
|
.orderBy("created_at")
|
|
260
262
|
.orderBy("id")
|
|
261
263
|
.execute();
|
|
@@ -381,11 +383,12 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
381
383
|
* 集合的 agent 已删除 → `agent.not_found`(删除 agent 会取消它的运行;之后再估算 / 启动只会建出全部跳过的运行)。
|
|
382
384
|
* 在事务里调用时 FOR SHARE,与删除 agent 互斥。
|
|
383
385
|
*/
|
|
384
|
-
async assertAgentLive(agentId, forShare = false) {
|
|
386
|
+
async assertAgentLive(orgId, agentId, forShare = false) {
|
|
385
387
|
let q = this.d.db
|
|
386
388
|
.selectFrom("agents")
|
|
387
389
|
.select("id")
|
|
388
390
|
.where("id", "=", agentId)
|
|
391
|
+
.where("org_id", "=", orgId)
|
|
389
392
|
.where("deleted_at", "is", null);
|
|
390
393
|
if (forShare)
|
|
391
394
|
q = q.forShare();
|
|
@@ -395,7 +398,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
395
398
|
}
|
|
396
399
|
async estimate(orgId, setId, input) {
|
|
397
400
|
const set = await this.liveSet(orgId, setId);
|
|
398
|
-
await this.assertAgentLive(set.agent_id);
|
|
401
|
+
await this.assertAgentLive(orgId, set.agent_id);
|
|
399
402
|
const caps = this.tokenCaps(input.tokenCap);
|
|
400
403
|
const versionDef = await this.checkCandidate(orgId, set.agent_id, input.candidate);
|
|
401
404
|
const plans = await this.plan(orgId, setId, input.mode, input.candidate, versionDef);
|
|
@@ -421,7 +424,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
421
424
|
*/
|
|
422
425
|
async start(orgId, actor, setId, input, actorTokenId, auditDetail) {
|
|
423
426
|
const set = await this.liveSet(orgId, setId);
|
|
424
|
-
await this.assertAgentLive(set.agent_id);
|
|
427
|
+
await this.assertAgentLive(orgId, set.agent_id);
|
|
425
428
|
const tokenCap = this.tokenCaps(input.tokenCap).effectiveTokenCap;
|
|
426
429
|
const versionDef = await this.checkCandidate(orgId, set.agent_id, input.candidate);
|
|
427
430
|
if (input.judge)
|
|
@@ -454,11 +457,12 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
454
457
|
.executeTakeFirst();
|
|
455
458
|
if (!locked)
|
|
456
459
|
throw setNotFound();
|
|
457
|
-
await this.assertAgentLive(agentId, true);
|
|
460
|
+
await this.assertAgentLive(orgId, agentId, true);
|
|
458
461
|
const alive = new Set((await db
|
|
459
462
|
.selectFrom("eval_cases")
|
|
460
463
|
.select("id")
|
|
461
464
|
.where("set_id", "=", setId)
|
|
465
|
+
.where("org_id", "=", orgId)
|
|
462
466
|
.where("id", "in", planned.map((p) => p.caseId))
|
|
463
467
|
.execute()).map((r) => r.id));
|
|
464
468
|
const plans = planned.filter((p) => alive.has(p.caseId));
|
|
@@ -521,7 +525,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
521
525
|
return { runId: run.id };
|
|
522
526
|
}
|
|
523
527
|
/** 各运行的汇总(只算已结束的)。 */
|
|
524
|
-
async summaries(rows) {
|
|
528
|
+
async summaries(orgId, rows) {
|
|
525
529
|
const finished = rows
|
|
526
530
|
.filter((r) => !ACTIVE_EVAL_STATUSES.includes(r.status))
|
|
527
531
|
.map((r) => r.id);
|
|
@@ -549,6 +553,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
549
553
|
FILTER (WHERE label IS NOT NULL)`.as("human_rate"),
|
|
550
554
|
])
|
|
551
555
|
.where("run_id", "in", finished)
|
|
556
|
+
.where("org_id", "=", orgId)
|
|
552
557
|
.groupBy("run_id")
|
|
553
558
|
.execute();
|
|
554
559
|
for (const id of finished) {
|
|
@@ -600,7 +605,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
600
605
|
.executeTakeFirst();
|
|
601
606
|
if (!r)
|
|
602
607
|
throw runNotFound();
|
|
603
|
-
const sums = await this.summaries([r]);
|
|
608
|
+
const sums = await this.summaries(orgId, [r]);
|
|
604
609
|
return EvalRunsService_1.toView(r, sums.get(r.id) ?? null);
|
|
605
610
|
}
|
|
606
611
|
async listForSet(orgId, setId) {
|
|
@@ -613,7 +618,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
613
618
|
.orderBy("created_at", "desc")
|
|
614
619
|
.orderBy("id", "desc")
|
|
615
620
|
.execute();
|
|
616
|
-
const sums = await this.summaries(rows);
|
|
621
|
+
const sums = await this.summaries(orgId, rows);
|
|
617
622
|
return rows.map((r) => EvalRunsService_1.toView(r, sums.get(r.id) ?? null));
|
|
618
623
|
}
|
|
619
624
|
/**
|
|
@@ -793,6 +798,7 @@ let EvalRunsService = EvalRunsService_1 = class EvalRunsService {
|
|
|
793
798
|
.innerJoin("eval_sets as es", "es.id", "er.set_id")
|
|
794
799
|
.select("er.id")
|
|
795
800
|
.whereRef("er.id", "=", "eval_results.run_id")
|
|
801
|
+
.where("er.org_id", "=", orgId)
|
|
796
802
|
.where("es.deleted_at", "is", null)))
|
|
797
803
|
.returningAll()
|
|
798
804
|
.executeTakeFirst();
|
|
@@ -134,6 +134,7 @@ let EvalSetsService = EvalSetsService_1 = class EvalSetsService {
|
|
|
134
134
|
.selectFrom("eval_cases as c")
|
|
135
135
|
.select(sql `count(*)`.as("n"))
|
|
136
136
|
.whereRef("c.set_id", "=", "s.id")
|
|
137
|
+
.where("c.org_id", "=", orgId)
|
|
137
138
|
.as("case_count"),
|
|
138
139
|
])
|
|
139
140
|
.where("s.org_id", "=", orgId)
|
|
@@ -269,7 +270,7 @@ let EvalSetsService = EvalSetsService_1 = class EvalSetsService {
|
|
|
269
270
|
.executeTakeFirst();
|
|
270
271
|
if (Number(r.numUpdatedRows) === 0)
|
|
271
272
|
throw setNotFound();
|
|
272
|
-
await stopAndPurgeRuns(this.db, this.budget, setId);
|
|
273
|
+
await stopAndPurgeRuns(this.db, this.budget, orgId, setId);
|
|
273
274
|
await audit(this.db, {
|
|
274
275
|
actorAccountId: actor,
|
|
275
276
|
...(actorTokenId !== undefined && { actorTokenId }),
|
|
@@ -292,7 +293,7 @@ let EvalSetsService = EvalSetsService_1 = class EvalSetsService {
|
|
|
292
293
|
.executeTakeFirst();
|
|
293
294
|
if (!set)
|
|
294
295
|
throw setNotFound();
|
|
295
|
-
if ((await this.caseCount(this.db, setId)) >= max)
|
|
296
|
+
if ((await this.caseCount(this.db, orgId, setId)) >= max)
|
|
296
297
|
return "full";
|
|
297
298
|
const row = await this.db
|
|
298
299
|
.insertInto("eval_cases")
|
|
@@ -382,11 +383,12 @@ let EvalSetsService = EvalSetsService_1 = class EvalSetsService {
|
|
|
382
383
|
throw setNotFound();
|
|
383
384
|
return set;
|
|
384
385
|
}
|
|
385
|
-
async caseCount(db, setId) {
|
|
386
|
+
async caseCount(db, orgId, setId) {
|
|
386
387
|
const r = await db
|
|
387
388
|
.selectFrom("eval_cases")
|
|
388
389
|
.select(sql `count(*)`.as("n"))
|
|
389
390
|
.where("set_id", "=", setId)
|
|
391
|
+
.where("org_id", "=", orgId)
|
|
390
392
|
.executeTakeFirstOrThrow();
|
|
391
393
|
return Number(r.n);
|
|
392
394
|
}
|
|
@@ -446,6 +448,7 @@ let EvalSetsService = EvalSetsService_1 = class EvalSetsService {
|
|
|
446
448
|
.selectFrom("eval_cases")
|
|
447
449
|
.select("id")
|
|
448
450
|
.where("set_id", "=", setId)
|
|
451
|
+
.where("org_id", "=", orgId)
|
|
449
452
|
.where("source_run_id", "=", input.runId)
|
|
450
453
|
.executeTakeFirst();
|
|
451
454
|
if (exists)
|
|
@@ -454,7 +457,7 @@ let EvalSetsService = EvalSetsService_1 = class EvalSetsService {
|
|
|
454
457
|
throw new ApiError("eval.run_not_finished", "The run has not finished yet");
|
|
455
458
|
}
|
|
456
459
|
const { maxCasesPerSet } = this.config.get().evals;
|
|
457
|
-
if ((await this.caseCount(this.db, setId)) >= maxCasesPerSet)
|
|
460
|
+
if ((await this.caseCount(this.db, orgId, setId)) >= maxCasesPerSet)
|
|
458
461
|
throw tooMany(maxCasesPerSet);
|
|
459
462
|
}
|
|
460
463
|
/**
|
|
@@ -487,7 +490,7 @@ let EvalSetsService = EvalSetsService_1 = class EvalSetsService {
|
|
|
487
490
|
async sample(orgId, actor, setId, input, actorTokenId, auditDetail) {
|
|
488
491
|
const set = await this.liveSet(orgId, setId);
|
|
489
492
|
const { maxCasesPerSet, maxCaseBytes } = this.config.get().evals;
|
|
490
|
-
const room = maxCasesPerSet - (await this.caseCount(this.db, setId));
|
|
493
|
+
const room = maxCasesPerSet - (await this.caseCount(this.db, orgId, setId));
|
|
491
494
|
if (room <= 0)
|
|
492
495
|
throw tooMany(maxCasesPerSet);
|
|
493
496
|
let q = this.db
|
|
@@ -504,6 +507,7 @@ let EvalSetsService = EvalSetsService_1 = class EvalSetsService {
|
|
|
504
507
|
.selectFrom("eval_cases as e")
|
|
505
508
|
.select(sql `1`.as("one"))
|
|
506
509
|
.where("e.set_id", "=", setId)
|
|
510
|
+
.where("e.org_id", "=", orgId)
|
|
507
511
|
.whereRef("e.source_run_id", "=", "r.id"))))
|
|
508
512
|
.orderBy(sql `random()`)
|
|
509
513
|
.limit(Math.min(input.count, room));
|
|
@@ -623,21 +627,27 @@ export { EvalSetsService };
|
|
|
623
627
|
* 与回放写种子互斥:种子事务对运行行加共享锁并复核仍在执行(见 `replayRun`),这里的 UPDATE 持行锁,
|
|
624
628
|
* 先提交的一方胜出,不会在删除之后再长出新的评测对话。
|
|
625
629
|
*/
|
|
626
|
-
async function stopAndPurgeRuns(db, budget, setId) {
|
|
630
|
+
async function stopAndPurgeRuns(db, budget, orgId, setId) {
|
|
627
631
|
const runs = await db
|
|
628
632
|
.updateTable("eval_runs")
|
|
629
633
|
.set({ status: "cancelled", finished_at: sql `now()` })
|
|
630
634
|
.where("set_id", "=", setId)
|
|
635
|
+
.where("org_id", "=", orgId)
|
|
631
636
|
.where("status", "in", ["queued", "running"])
|
|
632
637
|
.returning("id")
|
|
633
638
|
.execute();
|
|
634
639
|
for (const r of runs) {
|
|
635
640
|
await budget.skipRun(r.id);
|
|
636
641
|
}
|
|
637
|
-
const all = db
|
|
642
|
+
const all = db
|
|
643
|
+
.selectFrom("eval_runs")
|
|
644
|
+
.select("id")
|
|
645
|
+
.where("set_id", "=", setId)
|
|
646
|
+
.where("org_id", "=", orgId);
|
|
638
647
|
const convs = db
|
|
639
648
|
.selectFrom("conversations")
|
|
640
649
|
.select("id")
|
|
650
|
+
.where("org_id", "=", orgId)
|
|
641
651
|
.where("kind", "=", "eval")
|
|
642
652
|
.where("eval_run_id", "in", all);
|
|
643
653
|
const threads = db.selectFrom("runs").select("id").where("conversation_id", "in", convs);
|
|
@@ -645,9 +655,14 @@ async function stopAndPurgeRuns(db, budget, setId) {
|
|
|
645
655
|
await db.deleteFrom("lg_checkpoints").where("thread_id", "in", threads).execute();
|
|
646
656
|
await db
|
|
647
657
|
.deleteFrom("conversations")
|
|
658
|
+
.where("org_id", "=", orgId)
|
|
648
659
|
.where("kind", "=", "eval")
|
|
649
660
|
.where("eval_run_id", "in", all)
|
|
650
661
|
.execute();
|
|
651
662
|
// 用例快照是复制来的对话内容:硬删(结果随之级联删除),与单个移除用例一致
|
|
652
|
-
await db
|
|
663
|
+
await db
|
|
664
|
+
.deleteFrom("eval_cases")
|
|
665
|
+
.where("set_id", "=", setId)
|
|
666
|
+
.where("org_id", "=", orgId)
|
|
667
|
+
.execute();
|
|
653
668
|
}
|
|
@@ -162,6 +162,7 @@ let TrajectoryService = TrajectoryService_1 = class TrajectoryService {
|
|
|
162
162
|
? null
|
|
163
163
|
: {
|
|
164
164
|
runId: run.id,
|
|
165
|
+
// `runs.status` holds only these (the column's check constraint)
|
|
165
166
|
status: run.status,
|
|
166
167
|
startedAt: run.started_at === null ? null : run.started_at.toISOString(),
|
|
167
168
|
},
|
package/dist/evals/worker.js
CHANGED
|
@@ -869,7 +869,11 @@ __decorate([
|
|
|
869
869
|
Transactional({ propagation: "requires_new" })
|
|
870
870
|
], EvalWorker.prototype, "writeRunResultIn", null);
|
|
871
871
|
EvalWorker = __decorate([
|
|
872
|
-
Injectable()
|
|
872
|
+
Injectable()
|
|
873
|
+
// org-filter: queue worker of cap-kernel-evals: every id it uses is the kernel-written job payload
|
|
874
|
+
// (runId, caseId of one run in one org, enqueued by EvalRunsService.start) or a result row of that
|
|
875
|
+
// run it claimed; no caller input reaches these queries
|
|
876
|
+
,
|
|
873
877
|
__param(0, Inject(KernelDb)),
|
|
874
878
|
__param(1, Inject(EVAL_QUOTA)),
|
|
875
879
|
__param(2, Inject(KernelConfigService)),
|
|
@@ -563,6 +563,7 @@ async function hasRetainedData(db, name) {
|
|
|
563
563
|
const schema = await sql `SELECT 1 AS x FROM pg_namespace WHERE nspname = ${pluginSchemaName(name)}`.execute(db);
|
|
564
564
|
if (schema.rows.length > 0)
|
|
565
565
|
return true;
|
|
566
|
+
// org-filter: whether any org kept config for the plugin name (a deployment-wide existence check)
|
|
566
567
|
const hit = await db
|
|
567
568
|
.selectFrom("extension_permission_snapshots")
|
|
568
569
|
.select(sql `1`.as("x"))
|
|
@@ -44,7 +44,7 @@ const CLIENT_REPORTS_SHOWN = 50;
|
|
|
44
44
|
/** 空权限集合(包读不到的降级项)。 */
|
|
45
45
|
const EMPTY_SET = buildPermissionSet({
|
|
46
46
|
provides: [],
|
|
47
|
-
config: { deployment: []
|
|
47
|
+
config: { deployment: [] },
|
|
48
48
|
tables: [],
|
|
49
49
|
});
|
|
50
50
|
/**
|
|
@@ -555,6 +555,7 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
555
555
|
const built = [...clients].map(([plugin, c]) => ({ plugin, build: c.build }));
|
|
556
556
|
if (built.length === 0)
|
|
557
557
|
return { clients, reports };
|
|
558
|
+
// org-filter: super admin's extension view (ExtensionAdmin): client reports of every org
|
|
558
559
|
const ranked = this.db
|
|
559
560
|
.selectFrom("extension_client_reports")
|
|
560
561
|
.selectAll()
|
|
@@ -571,6 +572,7 @@ let ExtensionAdmin = class ExtensionAdmin {
|
|
|
571
572
|
list.push({
|
|
572
573
|
orgId: r.org_id,
|
|
573
574
|
contribution: r.contribution,
|
|
575
|
+
// written only from a validated report (`ReportBody.kind`)
|
|
574
576
|
kind: r.kind,
|
|
575
577
|
count: r.count,
|
|
576
578
|
firstAt: r.first_at.toISOString(),
|
|
@@ -10,6 +10,11 @@ import type { BootstrapGitRunEntry, MergedBootstrapEntry, MergedBootstrapManifes
|
|
|
10
10
|
*/
|
|
11
11
|
/** The sha512 integrity (`sha512-<base64>`) of a package's bytes. */
|
|
12
12
|
export declare const integrityOf: (bytes: Uint8Array) => string;
|
|
13
|
+
/**
|
|
14
|
+
* The waits before the second, third and fourth attempt of an npm download that failed
|
|
15
|
+
* transiently ({@link NpmFetchError.transient}): four attempts in about 8 s per package.
|
|
16
|
+
*/
|
|
17
|
+
export declare const BOOTSTRAP_DOWNLOAD_RETRY_DELAYS_MS: readonly number[];
|
|
13
18
|
/** What {@link resolveBootstrapPackages} needs from the kernel config. */
|
|
14
19
|
export interface BootstrapResolveOptions {
|
|
15
20
|
/**
|
|
@@ -22,6 +27,11 @@ export interface BootstrapResolveOptions {
|
|
|
22
27
|
log?: Pick<Logger, "warn">;
|
|
23
28
|
/** The npm download (default {@link fetchNpmPackage}; tests replace it). */
|
|
24
29
|
fetch?: typeof fetchNpmPackage;
|
|
30
|
+
/**
|
|
31
|
+
* The waits between attempts of an npm download that failed transiently (default
|
|
32
|
+
* {@link BOOTSTRAP_DOWNLOAD_RETRY_DELAYS_MS}; one more attempt than entries). Tests shorten them.
|
|
33
|
+
*/
|
|
34
|
+
retryDelaysMs?: readonly number[];
|
|
25
35
|
/**
|
|
26
36
|
* Entries whose package failing to be obtained is that entry's failure only: the error goes into
|
|
27
37
|
* `failed` (by entry name) and the other entries are still obtained. Every other entry's failure
|
|
@@ -49,7 +59,8 @@ export declare function bootstrapGitMarketplace(manifest: Pick<MergedBootstrapMa
|
|
|
49
59
|
/**
|
|
50
60
|
* Obtains every entry's tgz, checked against its pinned sha512: from the offline directory when a
|
|
51
61
|
* file there has that sha512, else (a `source: "npm"` entry) downloaded from the npm registry and
|
|
52
|
-
* verified against the pin (the packument's `dist.integrity` is not consulted
|
|
62
|
+
* verified against the pin (the packument's `dist.integrity` is not consulted; a transient failure
|
|
63
|
+
* is retried after each of `retryDelaysMs`; a 404, a refused connection or a mismatch is not), else (a
|
|
53
64
|
* `source: "git"` entry) its marketplace's tree at the pinned commit, the files under `path`
|
|
54
65
|
* re-rooted and packed with `packPackageTgz` (the pin is defined on that pack), refused unless the
|
|
55
66
|
* pack's sha512 is the pin: nothing of an unverified tree is read, translated or imported. The
|