@capybara-hq/kernel 0.1.0-rc.92 → 0.1.0-rc.94

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.
Files changed (57) hide show
  1. package/bootstrap.json +3 -3
  2. package/dist/admin/login-sources.controller.d.ts +30 -0
  3. package/dist/admin/login-sources.controller.js +77 -0
  4. package/dist/admin/login-sources.schemas.d.ts +25 -0
  5. package/dist/admin/login-sources.schemas.js +49 -0
  6. package/dist/catalog/marketplaces.service.d.ts +1 -1
  7. package/dist/config/schema.d.ts +0 -2
  8. package/dist/config/schema.js +0 -28
  9. package/dist/ctx/create-ctx.d.ts +5 -1
  10. package/dist/ctx/create-ctx.js +13 -2
  11. package/dist/device-access/device-access.service.d.ts +27 -4
  12. package/dist/device-access/device-access.service.js +183 -29
  13. package/dist/errors.d.ts +10 -0
  14. package/dist/errors.js +10 -0
  15. package/dist/extensions/instance.js +3 -1
  16. package/dist/http/api.module.js +2 -0
  17. package/dist/identity/auth.controller.d.ts +2 -0
  18. package/dist/identity/auth.controller.js +1 -1
  19. package/dist/identity/external.d.ts +78 -40
  20. package/dist/identity/external.js +157 -72
  21. package/dist/identity/identity.module.js +9 -0
  22. package/dist/identity/linked-accounts.d.ts +42 -0
  23. package/dist/identity/linked-accounts.js +78 -0
  24. package/dist/identity/login-sources.d.ts +160 -0
  25. package/dist/identity/login-sources.js +403 -0
  26. package/dist/identity/sso-decisions.d.ts +75 -0
  27. package/dist/identity/sso-decisions.js +42 -0
  28. package/dist/identity/sso-link.d.ts +61 -0
  29. package/dist/identity/sso-link.js +157 -0
  30. package/dist/identity/sso.controller.d.ts +98 -14
  31. package/dist/identity/sso.controller.js +222 -28
  32. package/dist/identity/sso.d.ts +75 -30
  33. package/dist/identity/sso.js +129 -70
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +1 -0
  36. package/dist/infra/config/kernel-config.service.js +0 -3
  37. package/dist/infra/throttler/named-throttlers.d.ts +1 -1
  38. package/dist/infra/throttler/named-throttlers.js +1 -1
  39. package/dist/platform/exclusions.js +15 -0
  40. package/dist/platform/operation.js +4 -0
  41. package/dist/platform/ops/admin.ops.d.ts +3 -1
  42. package/dist/platform/ops/admin.ops.js +106 -2
  43. package/dist/platform/ops/extensions-admin.ops.d.ts +24 -2
  44. package/dist/platform/ops/extensions-admin.ops.js +54 -6
  45. package/dist/platform/route-schemas.js +2 -0
  46. package/dist/tools/builtins/sandbox/glob.js +7 -4
  47. package/dist/tools/builtins/sandbox/grep.d.ts +8 -1
  48. package/dist/tools/builtins/sandbox/grep.js +27 -33
  49. package/dist/tools/builtins/sandbox/search-command.d.ts +43 -0
  50. package/dist/tools/builtins/sandbox/search-command.js +86 -0
  51. package/dist/tools/call-scope.d.ts +19 -6
  52. package/dist/tools/call-scope.js +29 -0
  53. package/dist/tools/pipeline.d.ts +3 -2
  54. package/dist/tools/pipeline.js +29 -10
  55. package/dist/tools/questions.service.d.ts +2 -2
  56. package/dist/tools/questions.service.js +1 -1
  57. package/package.json +3 -3
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": "44fa9a1384c92d8016c54dae17d36fb9d464c9e5"
6
+ "commit": "a48ecd8f674cbe24c7094ab8390d7d9ef56b7d80"
7
7
  },
8
8
  "plugins": [
9
9
  {
@@ -98,8 +98,8 @@
98
98
  "name": "device-local",
99
99
  "source": "npm",
100
100
  "npm": "@capybara-hq/plugin-device-local",
101
- "version": "0.1.0-rc.11",
102
- "integrity": "sha512-ZxWxrGjPjNpJtwH/2oK58itxfPFRi5CQQFbMe8VPyfYaEdfyPT8ZlOjgocdz/F8hR9jeu+E2VPgOmh7uMeBo/w==",
101
+ "version": "0.1.0-rc.12",
102
+ "integrity": "sha512-ncQmaRGa48fNjFD5rHQL94yEzBKv0pTS+4vy1uoK9SMWqSJw4/NUfVHs18Li0N2X92yRUystyuGHuJ0/oD4HPA==",
103
103
  "required": false,
104
104
  "scope": "all"
105
105
  },
@@ -0,0 +1,30 @@
1
+ import type { z } from "zod";
2
+ import { LoginSourcesService, type LoginSourceView } from "../identity/login-sources.js";
3
+ import { type Principal } from "../identity/principal.js";
4
+ import { LoginSourceBody, LoginSourceParams, LoginSourcesOrderBody } from "./login-sources.schemas.js";
5
+ /**
6
+ * The login sources (`/api/v1/admin/login-sources`, login extensions spec §3): which
7
+ * `identity-source@1` extensions the login page offers, in which order, what happens to an
8
+ * unlinked external account and the tenants trusted for email merge. Super admins only; every
9
+ * write is audited `login_sources.updated` and the login page follows at once.
10
+ */
11
+ export declare class AdminLoginSourcesController {
12
+ private readonly sources;
13
+ constructor(sources: LoginSourcesService);
14
+ /** Every loaded identity source and every stored entry: enabled first in order, then by name. */
15
+ list(): Promise<{
16
+ items: LoginSourceView[];
17
+ }>;
18
+ /**
19
+ * Sets the login page order (declared before `:plugin`; the router also prefers the static
20
+ * segment): every enabled entry exactly once, else 400 `validation_failed`.
21
+ */
22
+ reorder(principal: Principal, body: z.infer<typeof LoginSourcesOrderBody>): Promise<{
23
+ items: LoginSourceView[];
24
+ }>;
25
+ /**
26
+ * Changes one entry (partial). 404 `login_sources.unknown_plugin`, 400
27
+ * `login_sources.invalid_tenant`, 409 `login_sources.needs_config`.
28
+ */
29
+ update(principal: Principal, { plugin }: z.infer<typeof LoginSourceParams>, body: z.infer<typeof LoginSourceBody>): Promise<LoginSourceView>;
30
+ }
@@ -0,0 +1,77 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
8
+ return function (target, key) { decorator(target, key, paramIndex); }
9
+ };
10
+ import { Controller, Get, Inject, Put } from "@nestjs/common";
11
+ import { LoginSourcesService } from "../identity/login-sources.js";
12
+ import { CurrentPrincipal, SuperAdmin } from "../identity/principal.js";
13
+ import { writeActorOf } from "../identity/write-actor.js";
14
+ import { createZodDto } from "../infra/validation/create-zod-dto.js";
15
+ import { ZBody, ZParam } from "../infra/validation/zod-params.js";
16
+ import { LoginSourceBody, LoginSourceParams, LoginSourcesOrderBody, } from "./login-sources.schemas.js";
17
+ class LoginSourceParamsDto extends createZodDto(LoginSourceParams, "LoginSourceParams") {
18
+ }
19
+ class LoginSourceBodyDto extends createZodDto(LoginSourceBody, "LoginSourceBody") {
20
+ }
21
+ class LoginSourcesOrderBodyDto extends createZodDto(LoginSourcesOrderBody, "LoginSourcesOrderBody") {
22
+ }
23
+ /**
24
+ * The login sources (`/api/v1/admin/login-sources`, login extensions spec §3): which
25
+ * `identity-source@1` extensions the login page offers, in which order, what happens to an
26
+ * unlinked external account and the tenants trusted for email merge. Super admins only; every
27
+ * write is audited `login_sources.updated` and the login page follows at once.
28
+ */
29
+ let AdminLoginSourcesController = class AdminLoginSourcesController {
30
+ sources;
31
+ constructor(sources) {
32
+ this.sources = sources;
33
+ }
34
+ /** Every loaded identity source and every stored entry: enabled first in order, then by name. */
35
+ async list() {
36
+ return { items: await this.sources.overview() };
37
+ }
38
+ /**
39
+ * Sets the login page order (declared before `:plugin`; the router also prefers the static
40
+ * segment): every enabled entry exactly once, else 400 `validation_failed`.
41
+ */
42
+ async reorder(principal, body) {
43
+ const actor = writeActorOf(principal);
44
+ await this.sources.reorder(body.plugins, actor.accountId, viaToken(actor.tokenId));
45
+ return { items: await this.sources.overview() };
46
+ }
47
+ /**
48
+ * Changes one entry (partial). 404 `login_sources.unknown_plugin`, 400
49
+ * `login_sources.invalid_tenant`, 409 `login_sources.needs_config`.
50
+ */
51
+ async update(principal, { plugin }, body) {
52
+ const actor = writeActorOf(principal);
53
+ await this.sources.update(plugin, body, actor.accountId, viaToken(actor.tokenId));
54
+ return this.sources.view(plugin);
55
+ }
56
+ };
57
+ __decorate([
58
+ Get()
59
+ ], AdminLoginSourcesController.prototype, "list", null);
60
+ __decorate([
61
+ Put("order"),
62
+ __param(0, CurrentPrincipal()),
63
+ __param(1, ZBody(LoginSourcesOrderBodyDto))
64
+ ], AdminLoginSourcesController.prototype, "reorder", null);
65
+ __decorate([
66
+ Put(":plugin"),
67
+ __param(0, CurrentPrincipal()),
68
+ __param(1, ZParam(LoginSourceParamsDto)),
69
+ __param(2, ZBody(LoginSourceBodyDto))
70
+ ], AdminLoginSourcesController.prototype, "update", null);
71
+ AdminLoginSourcesController = __decorate([
72
+ Controller("api/v1/admin/login-sources"),
73
+ SuperAdmin(),
74
+ __param(0, Inject(LoginSourcesService))
75
+ ], AdminLoginSourcesController);
76
+ export { AdminLoginSourcesController };
77
+ const viaToken = (tokenId) => tokenId === undefined ? {} : { actorTokenId: tokenId };
@@ -0,0 +1,25 @@
1
+ import { z } from "zod";
2
+ import type { RouteSchemas } from "../platform/route-schemas.js";
3
+ /** `PUT /api/v1/admin/login-sources/:plugin`. */
4
+ export declare const LoginSourceParams: z.ZodObject<{
5
+ plugin: z.ZodString;
6
+ }, z.core.$strip>;
7
+ /**
8
+ * `PUT /api/v1/admin/login-sources/:plugin`: the fields to change (login extensions spec §1); a
9
+ * field left out keeps its value. The service trims, de-duplicates and checks the tenants
10
+ * against the source's tenant declaration (`login_sources.invalid_tenant`).
11
+ */
12
+ export declare const LoginSourceBody: z.ZodObject<{
13
+ enabled: z.ZodOptional<z.ZodBoolean>;
14
+ signUp: z.ZodOptional<z.ZodEnum<{
15
+ create: "create";
16
+ link: "link";
17
+ }>>;
18
+ trustedTenants: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ }, z.core.$strip>;
20
+ /** `PUT /api/v1/admin/login-sources/order`: the login page order. */
21
+ export declare const LoginSourcesOrderBody: z.ZodObject<{
22
+ plugins: z.ZodArray<z.ZodString>;
23
+ }, z.core.$strip>;
24
+ /** The super admin's login sources routes. */
25
+ export declare const LOGIN_SOURCE_ROUTES: readonly RouteSchemas[];
@@ -0,0 +1,49 @@
1
+ import { z } from "zod";
2
+ import { MAX_TRUSTED_TENANTS, TENANT_MAX } from "../identity/login-sources.js";
3
+ /** A plugin name as the extension host takes it (the npm package name limit). */
4
+ const PluginName = z
5
+ .string()
6
+ .min(1)
7
+ .max(214)
8
+ .describe("The plugin name of an extension providing identity-source@1, e.g. slack.");
9
+ /** `PUT /api/v1/admin/login-sources/:plugin`. */
10
+ export const LoginSourceParams = z.object({ plugin: PluginName });
11
+ /**
12
+ * `PUT /api/v1/admin/login-sources/:plugin`: the fields to change (login extensions spec §1); a
13
+ * field left out keeps its value. The service trims, de-duplicates and checks the tenants
14
+ * against the source's tenant declaration (`login_sources.invalid_tenant`).
15
+ */
16
+ export const LoginSourceBody = z
17
+ .object({
18
+ enabled: z
19
+ .boolean()
20
+ .optional()
21
+ .describe("Whether the login page offers this sign-in; turning it on puts it last in the login page order."),
22
+ signUp: z
23
+ .enum(["link", "create"])
24
+ .optional()
25
+ .describe("An external account nobody has linked: link (the link page, where the person signs in with a username and password to link it) or create (a new account is created)."),
26
+ trustedTenants: z
27
+ .array(z.string().max(TENANT_MAX))
28
+ .max(MAX_TRUSTED_TENANTS)
29
+ .optional()
30
+ .describe("The whole list of tenant ids (e.g. a Slack workspace id) whose verified emails link to the existing account with that email; [] trusts none."),
31
+ })
32
+ .refine((b) => Object.keys(b).length > 0, { message: "at least one field is required" });
33
+ /** `PUT /api/v1/admin/login-sources/order`: the login page order. */
34
+ export const LoginSourcesOrderBody = z.object({
35
+ plugins: z
36
+ .array(PluginName)
37
+ .max(100)
38
+ .describe("Every enabled login source exactly once, in the order the login page shows them."),
39
+ });
40
+ /** The super admin's login sources routes. */
41
+ export const LOGIN_SOURCE_ROUTES = [
42
+ { route: "GET /api/v1/admin/login-sources" },
43
+ { route: "PUT /api/v1/admin/login-sources/order", body: LoginSourcesOrderBody },
44
+ {
45
+ route: "PUT /api/v1/admin/login-sources/:plugin",
46
+ params: LoginSourceParams,
47
+ body: LoginSourceBody,
48
+ },
49
+ ];
@@ -208,7 +208,7 @@ export declare function headsToResolve(entries: readonly MarketplaceEntry[], imp
208
208
  /** The host versions (an entry's `minKernel` is judged against them). */
209
209
  export declare const HOST_VERSIONS: {
210
210
  readonly kernel: string;
211
- readonly sdk: "0.1.0-rc.75";
211
+ readonly sdk: "0.1.0-rc.77";
212
212
  };
213
213
  /** Whether this deployment satisfies the entry's `minKernel`. */
214
214
  export declare const entryCompatible: (e: Pick<MarketplaceEntry, "minKernel">) => boolean;
@@ -142,8 +142,6 @@ export declare const KernelConfigSchema: z.ZodObject<{
142
142
  cookieSecure: z.ZodDefault<z.ZodBoolean>;
143
143
  appRedirectUris: z.ZodDefault<z.ZodArray<z.ZodString>>;
144
144
  setupToken: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>>;
145
- loginSources: z.ZodDefault<z.ZodArray<z.ZodString>>;
146
- trustedIdentitySources: z.ZodDefault<z.ZodArray<z.ZodString>>;
147
145
  }, z.core.$strict>>;
148
146
  runtime: z.ZodDefault<z.ZodObject<{
149
147
  maxSteps: z.ZodDefault<z.ZodNumber>;
@@ -17,11 +17,6 @@ function isValidMasterKey(value) {
17
17
  return false;
18
18
  return Buffer.from(value, "base64").length === 32;
19
19
  }
20
- /**
21
- * 受信任身份源的一项:完整的身份源键 `<插件名>:<租户 id>`(Ruling A19,信任按租户)。
22
- * 插件名同清单规则(不能是 `local`),租户 id 非空、不含空白;与 identity/external.ts 的身份源键规则一致。
23
- */
24
- const TRUSTED_SOURCE_RE = /^(?!local:)[a-z0-9][a-z0-9._-]{0,213}:\S{1,256}$/;
25
20
  /** Schemes an app redirect URI never uses: the consent page navigates to it. */
26
21
  const UNSAFE_REDIRECT_RE = /^\s*(?:javascript|data|vbscript|file):/i;
27
22
  /** `sandbox.limits.maxCommandSeconds` 的默认值。 */
@@ -749,35 +744,12 @@ export const KernelConfigSchema = z.strictObject({
749
744
  .preprocess((v) => v === "" ? undefined : typeof v === "number" || typeof v === "boolean" ? String(v) : v, z.string().min(1).optional())
750
745
  .optional()
751
746
  .meta(meta({ secret: true, description: "If set, the setup wizard requires this token" })),
752
- loginSources: z
753
- .array(z.string().min(1).max(214))
754
- .max(50)
755
- .default([])
756
- .meta(meta({
757
- hot: true,
758
- description: "Extension names (providing identity-source@1) offered as third-party sign-in on the login page, in this order; the sign-in callback URL is <http.publicUrl>/api/v1/auth/sso/<plugin>/callback",
759
- })),
760
- trustedIdentitySources: z
761
- .array(z
762
- .string()
763
- .max(471)
764
- .refine((v) => TRUSTED_SOURCE_RE.test(v), {
765
- message: 'Each entry must be a full identity source key "<plugin>:<tenantId>" (for example "lark:tenant_1"); plugin-only entries are not allowed, trust is per tenant',
766
- }))
767
- .max(50)
768
- .default([])
769
- .meta(meta({
770
- hot: true,
771
- description: 'Identity source keys "<plugin>:<tenantId>" (one tenant each, e.g. "lark:tenant_1") whose external identities are trusted: on third-party sign-in, when the identity\'s email and an existing account\'s email are both verified and equal, the identity is linked to that account instead of creating a new one; and accounts created through a trusted source count as email-verified. Only list tenants (workspaces / apps) that your enterprise controls; otherwise anyone in that tenant could claim your users\' emails. Entries without a tenant id are rejected',
772
- })),
773
747
  })
774
748
  .default({
775
749
  accessTokenTtlSeconds: 900,
776
750
  refreshTokenTtlDays: 30,
777
751
  cookieSecure: true,
778
752
  appRedirectUris: ["capybara://auth/callback"],
779
- loginSources: [],
780
- trustedIdentitySources: [],
781
753
  }),
782
754
  runtime: z
783
755
  .strictObject({
@@ -226,4 +226,8 @@ export declare class LiveConfig {
226
226
  * An undeclared access throws `ExtensionPermissionError` and audits `extension.permission_denied`
227
227
  * (once per extension and item).
228
228
  */
229
- export declare function createExtensionContext(deps: KernelDeps, manifest: ExtensionManifest, deploymentConfig: unknown, extensionPointAccess?: ExtensionPointAccess): KernelExtensionContext;
229
+ export declare function createExtensionContext(deps: KernelDeps, manifest: ExtensionManifest, deploymentConfig: unknown, extensionPointAccess?: ExtensionPointAccess,
230
+ /** The package this instance was loaded from (null: not from an install record). */
231
+ identity?: {
232
+ sha256: string | null;
233
+ }): KernelExtensionContext;
@@ -211,7 +211,9 @@ export class LiveConfig {
211
211
  * An undeclared access throws `ExtensionPermissionError` and audits `extension.permission_denied`
212
212
  * (once per extension and item).
213
213
  */
214
- export function createExtensionContext(deps, manifest, deploymentConfig, extensionPointAccess = noProviders(deps)) {
214
+ export function createExtensionContext(deps, manifest, deploymentConfig, extensionPointAccess = noProviders(deps),
215
+ /** The package this instance was loaded from (null: not from an install record). */
216
+ identity = { sha256: null }) {
215
217
  const name = manifest.name;
216
218
  const live = deploymentConfig instanceof LiveConfig ? deploymentConfig : new LiveConfig(deploymentConfig);
217
219
  const routes = [];
@@ -226,6 +228,8 @@ export function createExtensionContext(deps, manifest, deploymentConfig, extensi
226
228
  const lifecycle = new AbortController();
227
229
  /** 撤销时队列 worker 排空的截止时刻(epoch 毫秒);undefined = 一直等(停机路径)。 */
228
230
  let drainDeadline;
231
+ /** Set once this instance begins to be disposed (an upgrade or unload drains it). */
232
+ let disposing = false;
229
233
  const lock = createLock(deps.locks, name);
230
234
  const tag = (fields) => ({ ...fields, plugin: name });
231
235
  let closing;
@@ -369,7 +373,13 @@ export function createExtensionContext(deps, manifest, deploymentConfig, extensi
369
373
  // approved manifest declares and only for the conversation's owner (DeviceAccessService checks)
370
374
  const deviceAccessApi = perms.deviceAccess
371
375
  ? (() => {
372
- const caller = { extension: name, services: [...(perms.deviceAccess?.services ?? [])] };
376
+ const caller = {
377
+ extension: name,
378
+ services: [...(perms.deviceAccess?.services ?? [])],
379
+ sha256: identity.sha256,
380
+ // a draining instance (its successor is loaded) never rolls a service back to its files
381
+ superseded: () => disposing || lifecycle.signal.aborted,
382
+ };
373
383
  const backend = () => {
374
384
  const b = deps.deviceAccess?.();
375
385
  if (!b)
@@ -808,6 +818,7 @@ export function createExtensionContext(deps, manifest, deploymentConfig, extensi
808
818
  ledger,
809
819
  async beginDispose(deadline) {
810
820
  drainDeadline = deadline;
821
+ disposing = true;
811
822
  await queue.pauseWorkers();
812
823
  },
813
824
  drainQueues: (deadline) => queue.drainWorkers(deadline),
@@ -1,4 +1,4 @@
1
- import { type DeviceAccessScope, type DeviceServiceSpec, type DeviceServiceStatus, type Logger, type ToolCallContext } from "@capybara-hq/plugin-sdk";
1
+ import { type DeviceAccessScope, type DeviceServiceSpec, type DeviceServiceStatus, type Logger, type ServiceBlockedHost, type ToolCallContext } from "@capybara-hq/plugin-sdk";
2
2
  import type { Redis } from "ioredis";
3
3
  import { DeviceAccess } from "../devices/access.js";
4
4
  import { ConversationDevices } from "../devices/conversation-devices.js";
@@ -35,6 +35,10 @@ export interface DeviceStreamTicket {
35
35
  export interface DeviceAccessCaller {
36
36
  extension: string;
37
37
  services: readonly string[];
38
+ /** The package the calling instance was loaded from (null or absent: not an install record). */
39
+ sha256?: string | null;
40
+ /** True once the calling instance is being replaced or unloaded (it drains its calls). */
41
+ superseded?: () => boolean;
38
42
  }
39
43
  /**
40
44
  * `ctx.deviceAccess` (browser use spec §7): an extension's device services in the conversation's
@@ -72,6 +76,23 @@ export declare class DeviceAccessService {
72
76
  */
73
77
  ensureService(caller: DeviceAccessCaller, call: ToolCallContext, spec: DeviceServiceSpec): Promise<DeviceServiceStatus>;
74
78
  private ensureServiceNow;
79
+ /**
80
+ * Whether a roll of a running service onto `digest` is held now ({@link rollHeld}), logged
81
+ * with the reason when it is.
82
+ */
83
+ private holdRoll;
84
+ /**
85
+ * Why a running service on other files is kept for now, or null to roll it:
86
+ * - the calling instance is being replaced or is not the one this replica runs now (it drains),
87
+ * or not the version the deployment has enabled (a replica that has not reloaded yet): its
88
+ * files are older, and rolling to them would flip the service back and forth;
89
+ * - the service answers the roll check busy (a person controls it or a handoff waits), for at
90
+ * most {@link ROLL_HOLD_CAP_MS} after the first busy answer for these files (a Redis record
91
+ * with a TTL: a service that stays busy, a handoff nobody ends, never holds an upgrade for
92
+ * good).
93
+ * A failed check (an older service, no answer) lets the roll go ahead.
94
+ */
95
+ private rollHeld;
75
96
  /** One request to the service's socket in the call's device. */
76
97
  request(caller: DeviceAccessCaller, call: ToolCallContext, req: {
77
98
  service: string;
@@ -79,10 +100,12 @@ export declare class DeviceAccessService {
79
100
  timeoutMs: number;
80
101
  }): Promise<Uint8Array>;
81
102
  /**
82
- * Records refused hosts in the call scope (synchronous: the pipeline reads it once the handler
83
- * returns) on the device this call's own `ctx.deviceAccess` calls resolved, if any.
103
+ * Records refused hosts with their layers in the call scope (synchronous: the pipeline reads it
104
+ * once the handler returns) on the device this call's own `ctx.deviceAccess` calls resolved, if
105
+ * any. A malformed entry (not a non-empty host with a known layer) is dropped; a host reported
106
+ * again keeps its most restrictive layer, so a later report never makes it grantable.
84
107
  */
85
- reportBlockedHosts(call: ToolCallContext, hosts: string[], opts?: {
108
+ reportBlockedHosts(call: ToolCallContext, hosts: ServiceBlockedHost[], opts?: {
86
109
  url?: string;
87
110
  }): void;
88
111
  /** A single-use viewer ticket for the service (the person's panel opens `url`). */