@capybara-hq/kernel 0.1.0-rc.72 → 0.1.0-rc.73

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.
@@ -203,7 +203,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
203
203
  /** The host versions (an entry's `minKernel` is judged against them). */
204
204
  export declare const HOST_VERSIONS: {
205
205
  readonly kernel: string;
206
- readonly sdk: "0.1.0-rc.56";
206
+ readonly sdk: "0.1.0-rc.57";
207
207
  };
208
208
  /** Whether this deployment satisfies the entry's `minKernel`. */
209
209
  export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
@@ -12,7 +12,7 @@ import { type DeviceAuthorizeBody, type DeviceConfirmBody, type DeviceProvidersQ
12
12
  * - `POST /authorize { name, os, arch, programVersion, protocol }` → `{ deviceCode, userCode,
13
13
  * verificationUri, verificationUriComplete, interval, expiresIn }` (`device-authorize-ip`);
14
14
  * - `POST /token { deviceCode }` → `{ credential, orgId, deviceId, connectUrl,
15
- * reconnectGraceSeconds, maxFrameBytes, outsideSandbox }` once, else `device_sign_in.authorization_pending` / `device_sign_in.slow_down` /
15
+ * reconnectGraceSeconds, maxFrameBytes, outsideSandbox, deviceName, orgName }` once, else `device_sign_in.authorization_pending` / `device_sign_in.slow_down` /
16
16
  * `device_sign_in.denied` / `device_sign_in.expired` (`device-token-ip`).
17
17
  *
18
18
  * The person's routes need a web session (the confirmation page `/device`); each try of a user
@@ -24,7 +24,7 @@ const CODE_THROTTLER = ["device-code-account"];
24
24
  * - `POST /authorize { name, os, arch, programVersion, protocol }` → `{ deviceCode, userCode,
25
25
  * verificationUri, verificationUriComplete, interval, expiresIn }` (`device-authorize-ip`);
26
26
  * - `POST /token { deviceCode }` → `{ credential, orgId, deviceId, connectUrl,
27
- * reconnectGraceSeconds, maxFrameBytes, outsideSandbox }` once, else `device_sign_in.authorization_pending` / `device_sign_in.slow_down` /
27
+ * reconnectGraceSeconds, maxFrameBytes, outsideSandbox, deviceName, orgName }` once, else `device_sign_in.authorization_pending` / `device_sign_in.slow_down` /
28
28
  * `device_sign_in.denied` / `device_sign_in.expired` (`device-token-ip`).
29
29
  *
30
30
  * The person's routes need a web session (the confirmation page `/device`); each try of a user
@@ -63,6 +63,10 @@ export interface DeviceGrant extends Grant {
63
63
  * does not allow it, even when the machine's owner ceiling does.
64
64
  */
65
65
  outsideSandbox: "allowed" | "off";
66
+ /** The device's name (`devices.name`; null when it has none), for `capybara-device status`. */
67
+ deviceName: string | null;
68
+ /** The organization's name (`orgs.name`), for `capybara-device status`. */
69
+ orgName: string;
66
70
  }
67
71
  /** A user code as typed → `XXXX-XXXX`, or null when it cannot be one. */
68
72
  export declare function normalizeUserCode(input: string): string | null;
@@ -188,9 +188,21 @@ let DialInAuthService = class DialInAuthService {
188
188
  case "approved": {
189
189
  const grant = JSON.parse(r[1]);
190
190
  const dialIn = this.config.get().devices.dialIn;
191
- const [deployment, settings] = await Promise.all([
191
+ const [deployment, settings, device, org] = await Promise.all([
192
192
  readDeploymentDevicePolicy(this.db.db, this.config),
193
193
  readOrgSettings(this.db.db, grant.orgId),
194
+ this.db.db
195
+ .selectFrom("devices")
196
+ .select("name")
197
+ .where("org_id", "=", grant.orgId)
198
+ .where("id", "=", grant.deviceId)
199
+ .executeTakeFirst(),
200
+ this.db.db
201
+ .selectFrom("orgs")
202
+ .select("name")
203
+ .where("id", "=", grant.orgId)
204
+ // the grant's org exists: the device row it names references it
205
+ .executeTakeFirstOrThrow(),
194
206
  ]);
195
207
  return {
196
208
  ...grant,
@@ -200,6 +212,8 @@ let DialInAuthService = class DialInAuthService {
200
212
  outsideSandbox: allowedDeviceMode(deployment.fullAccess, settings.outsideSandbox) === "auto"
201
213
  ? "allowed"
202
214
  : "off",
215
+ deviceName: device?.name ?? null,
216
+ orgName: org.name,
203
217
  };
204
218
  }
205
219
  case "slow_down":
@@ -119,7 +119,7 @@ export declare function buildPermissionSet(input: {
119
119
  * `config.org.secret:apiKey`, `table:todos`, `permissions.tools:write`,
120
120
  * `permissions.http.<access>:<METHOD> <path>` (`permissions.http.public:POST /events`),
121
121
  * `ui.view:tasks`, `ui.embed:board`, `permissions.client`, `ui.component:hud`,
122
- * `permissions.dialin:capybara-device/5`.
122
+ * `permissions.dialin:capybara-device/6`.
123
123
  * Tolerates old snapshots missing fields (read as empty), so format changes never throw.
124
124
  */
125
125
  export declare function permissionKeys(set: PermissionSet): string[];
@@ -128,7 +128,7 @@ export function buildPermissionSet(input) {
128
128
  * `config.org.secret:apiKey`, `table:todos`, `permissions.tools:write`,
129
129
  * `permissions.http.<access>:<METHOD> <path>` (`permissions.http.public:POST /events`),
130
130
  * `ui.view:tasks`, `ui.embed:board`, `permissions.client`, `ui.component:hud`,
131
- * `permissions.dialin:capybara-device/5`.
131
+ * `permissions.dialin:capybara-device/6`.
132
132
  * Tolerates old snapshots missing fields (read as empty), so format changes never throw.
133
133
  */
134
134
  export function permissionKeys(set) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/kernel",
3
- "version": "0.1.0-rc.72",
3
+ "version": "0.1.0-rc.73",
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.56"
69
+ "@capybara-hq/plugin-sdk": "^0.1.0-rc.57"
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/testing": "0.1.0-rc.35"
78
+ "@capybara-hq/testing": "0.1.0-rc.36"
79
79
  },
80
80
  "scripts": {
81
81
  "build": "tsc -b"