@capybara-hq/kernel 0.1.0-rc.56 → 0.1.0-rc.57
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
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"schemaVersion": 1,
|
|
4
4
|
"marketplace": {
|
|
5
5
|
"url": "https://github.com/capybara-hq/plugins.git",
|
|
6
|
-
"commit": "
|
|
6
|
+
"commit": "ae438abbbe7e200961c9f09f9463450769f9dbaa"
|
|
7
7
|
},
|
|
8
8
|
"plugins": [
|
|
9
9
|
{
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"name": "sandbox-docker",
|
|
91
91
|
"source": "npm",
|
|
92
92
|
"npm": "@capybara-hq/plugin-sandbox-docker",
|
|
93
|
-
"version": "0.1.0-rc.
|
|
94
|
-
"integrity": "sha512-
|
|
93
|
+
"version": "0.1.0-rc.20",
|
|
94
|
+
"integrity": "sha512-jWPQZ3TpxMuw8QcP22vkSKp2vSSexL8N66SBm8DcSX7HiveeU1O3nVGiPk/esZ4BKXCkjfYpYCtbBW68y+38Sw==",
|
|
95
95
|
"required": false
|
|
96
96
|
},
|
|
97
97
|
{
|
|
@@ -188,7 +188,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
|
|
|
188
188
|
/** The host versions (an entry's `minKernel` is judged against them). */
|
|
189
189
|
export declare const HOST_VERSIONS: {
|
|
190
190
|
readonly kernel: string;
|
|
191
|
-
readonly sdk: "0.1.0-rc.
|
|
191
|
+
readonly sdk: "0.1.0-rc.41";
|
|
192
192
|
};
|
|
193
193
|
/** Whether this deployment satisfies the entry's `minKernel`. */
|
|
194
194
|
export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApiError } from "../errors.js";
|
|
2
2
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
3
3
|
import { TransactionHost } from "../infra/database/transaction-host.js";
|
|
4
|
+
import type { KernelLogger } from "../log.js";
|
|
4
5
|
import type { SandboxMode } from "../sandbox/modes.js";
|
|
5
6
|
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
6
7
|
import { PermissionFacts } from "../sandbox/permission-facts.js";
|
|
@@ -65,9 +66,10 @@ export declare class DeviceProjectsService {
|
|
|
65
66
|
private readonly access;
|
|
66
67
|
private readonly facts;
|
|
67
68
|
private readonly ceilings;
|
|
69
|
+
private readonly log;
|
|
68
70
|
/** The paired activation gate: once on, every device read is an owner browse. */
|
|
69
71
|
private readonly activation?;
|
|
70
|
-
constructor(db: KernelDb, txHost: TransactionHost, sandbox: Pick<SandboxService, "withSandbox" | "withBrowse" | "ensureRunningForOwner">, access: Pick<DeviceAccess, "usable">, facts: Pick<PermissionFacts, "resolveProjectForBinding" | "projectMatches" | "projectScope">, ceilings: PermissionCeilingWrites,
|
|
72
|
+
constructor(db: KernelDb, txHost: TransactionHost, sandbox: Pick<SandboxService, "withSandbox" | "withBrowse" | "ensureRunningForOwner">, access: Pick<DeviceAccess, "usable">, facts: Pick<PermissionFacts, "resolveProjectForBinding" | "projectMatches" | "projectScope">, ceilings: PermissionCeilingWrites, log: Pick<KernelLogger, "warn">,
|
|
71
73
|
/** The paired activation gate: once on, every device read is an owner browse. */
|
|
72
74
|
activation?: boolean | undefined);
|
|
73
75
|
/** The projects the device's current mode can read; see {@link DeviceProjectList}. */
|
|
@@ -16,6 +16,7 @@ import { audit } from "../identity/audit.js";
|
|
|
16
16
|
import { KernelDb } from "../infra/database/kernel-db.js";
|
|
17
17
|
import { TransactionHost, withOrderedLocks } from "../infra/database/transaction-host.js";
|
|
18
18
|
import { Transactional } from "../infra/database/transactional.decorator.js";
|
|
19
|
+
import { KERNEL_LOGGER } from "../infra/tokens.js";
|
|
19
20
|
import { projectsUnsupported } from "../local-devices/local-device-provider.js";
|
|
20
21
|
import { POLICY_REFUSAL_PREFIX } from "../local-devices/relay.js";
|
|
21
22
|
import { PermissionCeilingWrites } from "../sandbox/permission-ceiling-writes.js";
|
|
@@ -80,8 +81,9 @@ let DeviceProjectsService = class DeviceProjectsService {
|
|
|
80
81
|
access;
|
|
81
82
|
facts;
|
|
82
83
|
ceilings;
|
|
84
|
+
log;
|
|
83
85
|
activation;
|
|
84
|
-
constructor(db, txHost, sandbox, access, facts, ceilings,
|
|
86
|
+
constructor(db, txHost, sandbox, access, facts, ceilings, log,
|
|
85
87
|
/** The paired activation gate: once on, every device read is an owner browse. */
|
|
86
88
|
activation) {
|
|
87
89
|
this.db = db;
|
|
@@ -90,6 +92,7 @@ let DeviceProjectsService = class DeviceProjectsService {
|
|
|
90
92
|
this.access = access;
|
|
91
93
|
this.facts = facts;
|
|
92
94
|
this.ceilings = ceilings;
|
|
95
|
+
this.log = log;
|
|
93
96
|
this.activation = activation;
|
|
94
97
|
}
|
|
95
98
|
/** The projects the device's current mode can read; see {@link DeviceProjectList}. */
|
|
@@ -139,7 +142,11 @@ let DeviceProjectsService = class DeviceProjectsService {
|
|
|
139
142
|
}
|
|
140
143
|
catch (e) {
|
|
141
144
|
// the base is the device's own workspace or home: a refusal there is not the person's path
|
|
142
|
-
|
|
145
|
+
const passed = passThrough(e);
|
|
146
|
+
if (passed !== undefined)
|
|
147
|
+
throw passed;
|
|
148
|
+
this.log.warn("device projects: the device could not scan", { deviceId, err: e });
|
|
149
|
+
throw unavailable(e);
|
|
143
150
|
}
|
|
144
151
|
// the device's answer is checked again: inside the base and the mode, a valid name, bounded
|
|
145
152
|
const candidates = found
|
|
@@ -217,7 +224,11 @@ let DeviceProjectsService = class DeviceProjectsService {
|
|
|
217
224
|
answer = await list(path, 1, sig);
|
|
218
225
|
}
|
|
219
226
|
catch (e) {
|
|
220
|
-
throw await listFailure(e, r, path, scope.mode, sig)
|
|
227
|
+
throw await listFailure(e, r, path, scope.mode, sig, (err, statErr) => this.log.warn("device projects: the device could not list", {
|
|
228
|
+
deviceId,
|
|
229
|
+
err,
|
|
230
|
+
statErr,
|
|
231
|
+
}));
|
|
221
232
|
}
|
|
222
233
|
if (answer === null)
|
|
223
234
|
throw pathMissing(path);
|
|
@@ -373,6 +384,8 @@ let DeviceProjectsService = class DeviceProjectsService {
|
|
|
373
384
|
throw e;
|
|
374
385
|
if (e instanceof SandboxProviderUnreachableError)
|
|
375
386
|
throw providerUnreachable();
|
|
387
|
+
// the answer hides the cause (a provider's text is not for people): ops read it here
|
|
388
|
+
this.log.warn("device projects: the device could not be asked", { deviceId, err: e });
|
|
376
389
|
throw unavailable(e);
|
|
377
390
|
}
|
|
378
391
|
}
|
|
@@ -409,8 +422,9 @@ DeviceProjectsService = __decorate([
|
|
|
409
422
|
__param(3, Inject(DeviceAccess)),
|
|
410
423
|
__param(4, Inject(PermissionFacts)),
|
|
411
424
|
__param(5, Inject(PermissionCeilingWrites)),
|
|
412
|
-
__param(6,
|
|
413
|
-
__param(
|
|
425
|
+
__param(6, Inject(KERNEL_LOGGER)),
|
|
426
|
+
__param(7, Optional()),
|
|
427
|
+
__param(7, Inject(PERMISSION_CONTEXT_ACTIVATION))
|
|
414
428
|
], DeviceProjectsService);
|
|
415
429
|
export { DeviceProjectsService };
|
|
416
430
|
/**
|
|
@@ -473,7 +487,7 @@ const pathMissing = (path) => new ApiError("device.project_path_missing", `${cli
|
|
|
473
487
|
* missing path `device.project_path_missing`, and a `stat` that fails too means the device could
|
|
474
488
|
* not be asked (503 `device.projects_unavailable`).
|
|
475
489
|
*/
|
|
476
|
-
async function listFailure(e, r, path, mode, signal) {
|
|
490
|
+
async function listFailure(e, r, path, mode, signal, logUnavailable) {
|
|
477
491
|
const passed = passThrough(e);
|
|
478
492
|
if (passed !== undefined)
|
|
479
493
|
return passed;
|
|
@@ -488,7 +502,11 @@ async function listFailure(e, r, path, mode, signal) {
|
|
|
488
502
|
st = await r.stat(path, signal);
|
|
489
503
|
}
|
|
490
504
|
catch (e2) {
|
|
491
|
-
|
|
505
|
+
const passed = passThrough(e2);
|
|
506
|
+
if (passed !== undefined)
|
|
507
|
+
return passed;
|
|
508
|
+
logUnavailable(e, e2);
|
|
509
|
+
return unavailable(e);
|
|
492
510
|
}
|
|
493
511
|
if (st === null)
|
|
494
512
|
return pathMissing(path);
|
|
@@ -1529,7 +1529,11 @@ let SandboxService = class SandboxService {
|
|
|
1529
1529
|
// outside any transaction; a failure releases the lease.
|
|
1530
1530
|
const binder = p.binder;
|
|
1531
1531
|
if (binder)
|
|
1532
|
-
await runOutsideTransaction(() => binder.bind(env, sig))
|
|
1532
|
+
await runOutsideTransaction(() => binder.bind(env, sig)).catch((err) => {
|
|
1533
|
+
// the caller's answer may be generic: the device's own refusal is kept for ops here
|
|
1534
|
+
this.log.warn("cannot bind the device's instance", { deviceId: env, err });
|
|
1535
|
+
throw err;
|
|
1536
|
+
});
|
|
1533
1537
|
const shared = await lease.downgrade();
|
|
1534
1538
|
await this.register(env, shared.token);
|
|
1535
1539
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capybara-hq/kernel",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.57",
|
|
4
4
|
"description": "Capybara kernel: config, database, plugin host and HTTP API of the Capybara agent platform",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"yaml": "^2.9.1",
|
|
67
67
|
"yauzl": "3.4.0",
|
|
68
68
|
"zod": "^4.6.7",
|
|
69
|
-
"@capybara-hq/plugin-sdk": "^0.1.0-rc.
|
|
69
|
+
"@capybara-hq/plugin-sdk": "^0.1.0-rc.41"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@langchain/langgraph-checkpoint-validation": "^1.2.0",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@types/ws": "^8.18.2",
|
|
76
76
|
"@types/yauzl": "3.4.0",
|
|
77
77
|
"ws": "^8.22.0",
|
|
78
|
-
"@capybara-hq/device": "0.1.0-rc.
|
|
78
|
+
"@capybara-hq/device": "0.1.0-rc.20",
|
|
79
79
|
"@capybara-hq/testing": "0.1.0-rc.29"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|