@capybara-hq/kernel 0.1.0-rc.75 → 0.1.0-rc.77

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 (76) hide show
  1. package/bootstrap.json +5 -5
  2. package/dist/agents/readiness.controller.d.ts +4 -3
  3. package/dist/agents/readiness.controller.js +4 -3
  4. package/dist/agents/readiness.service.d.ts +44 -11
  5. package/dist/agents/readiness.service.js +59 -16
  6. package/dist/catalog/catalog-import.module.d.ts +1 -1
  7. package/dist/catalog/catalog-import.module.js +1 -1
  8. package/dist/catalog/cli.d.ts +9 -2
  9. package/dist/catalog/cli.js +10 -4
  10. package/dist/catalog/marketplaces.service.d.ts +1 -1
  11. package/dist/catalog/plugin-upgrade.d.ts +4 -2
  12. package/dist/catalog/plugin-upgrade.js +9 -3
  13. package/dist/db/kernel-schema.d.ts +5 -0
  14. package/dist/devices/device-projects.service.d.ts +3 -12
  15. package/dist/devices/device-projects.service.js +16 -59
  16. package/dist/extensions/bootstrap.d.ts +34 -3
  17. package/dist/extensions/bootstrap.js +111 -14
  18. package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
  19. package/dist/lifecycle/kernel-lifecycle.js +16 -11
  20. package/dist/overrides.d.ts +0 -5
  21. package/dist/overrides.js +0 -2
  22. package/dist/platform/file-ref.d.ts +6 -5
  23. package/dist/platform/ops/agent-skills.ops.js +1 -1
  24. package/dist/platform/ops/agents.ops.js +1 -1
  25. package/dist/runtime/model-call.d.ts +2 -2
  26. package/dist/runtime/project/knowledge.d.ts +1 -1
  27. package/dist/runtime/project/knowledge.js +1 -1
  28. package/dist/runtime/project/knowledge.service.d.ts +5 -11
  29. package/dist/runtime/project/knowledge.service.js +12 -23
  30. package/dist/runtime/providers.d.ts +34 -1
  31. package/dist/runtime/providers.js +56 -7
  32. package/dist/runtime/run-steps.d.ts +4 -6
  33. package/dist/runtime/run-steps.js +7 -15
  34. package/dist/runtime/runtime.module.js +1 -1
  35. package/dist/sandbox/held-operations.d.ts +2 -5
  36. package/dist/sandbox/held-operations.js +0 -14
  37. package/dist/sandbox/managed-device-context.d.ts +1 -1
  38. package/dist/sandbox/managed-device-context.js +1 -1
  39. package/dist/sandbox/permission-context-types.d.ts +0 -11
  40. package/dist/sandbox/permission-context-types.js +0 -13
  41. package/dist/sandbox/providers.d.ts +5 -0
  42. package/dist/sandbox/providers.js +1 -1
  43. package/dist/sandbox/sandbox-file-reader.d.ts +7 -12
  44. package/dist/sandbox/sandbox-file-reader.js +12 -29
  45. package/dist/sandbox/sandbox.service.d.ts +53 -32
  46. package/dist/sandbox/sandbox.service.js +217 -141
  47. package/dist/sandbox/use-context.d.ts +4 -1
  48. package/dist/skills/invoke.d.ts +13 -35
  49. package/dist/skills/invoke.js +23 -162
  50. package/dist/tools/builtins/builtin-tools.d.ts +2 -11
  51. package/dist/tools/builtins/builtin-tools.js +5 -23
  52. package/dist/tools/builtins/image/generate.js +2 -2
  53. package/dist/tools/builtins/sandbox/common.d.ts +32 -80
  54. package/dist/tools/builtins/sandbox/common.js +61 -173
  55. package/dist/tools/builtins/sandbox/deliver.js +2 -2
  56. package/dist/tools/builtins/sandbox/device-owner.d.ts +4 -5
  57. package/dist/tools/builtins/sandbox/device-owner.js +5 -6
  58. package/dist/tools/builtins/sandbox/fetch-attachment.js +2 -2
  59. package/dist/tools/builtins/sandbox/glob.js +1 -1
  60. package/dist/tools/builtins/sandbox/grep.js +1 -1
  61. package/dist/tools/builtins/sandbox/index.d.ts +2 -2
  62. package/dist/tools/builtins/sandbox/index.js +2 -2
  63. package/dist/tools/builtins/sandbox/read.js +1 -1
  64. package/dist/tools/builtins/sandbox/task-output.d.ts +3 -3
  65. package/dist/tools/builtins/sandbox/task-output.js +4 -4
  66. package/dist/tools/builtins/sandbox/task-stop.js +1 -1
  67. package/dist/tools/builtins/skill-load.d.ts +10 -9
  68. package/dist/tools/builtins/skill-load.js +15 -19
  69. package/dist/tools/connectors.service.d.ts +4 -2
  70. package/dist/tools/connectors.service.js +15 -3
  71. package/dist/tools/pipeline.d.ts +0 -2
  72. package/dist/tools/pipeline.js +7 -14
  73. package/dist/tools/tools.module.js +1 -1
  74. package/package.json +2 -2
  75. package/src/migrations/0179_device_report_limit_text.sql +28 -0
  76. package/src/migrations/0180_device_instance_abandoned.sql +6 -0
@@ -16,8 +16,8 @@ export { sandboxFetchAttachmentTool } from "./fetch-attachment.js";
16
16
  export { compileGlob, GlobPatternError, MAX_GLOB_STARS } from "./glob-match.js";
17
17
  /**
18
18
  * The sandbox builtins (M5 T8): Bash / Read / Write / Edit / Glob / Grep / Deliver / FetchAttachment,
19
- * all run in the conversation's device (`SandboxService.withSandbox`). Attachments are not copied
20
- * into it by a sandbox call: `FetchAttachment` is the only way in, writing one file under
19
+ * all run in the conversation's device (`SandboxService.withOperations`). Attachments are not
20
+ * copied into it by a sandbox call: `FetchAttachment` is the only way in, writing one file under
21
21
  * `<workspace>/attachments/<conversation>` (the instance's roots, environments spec §13.1).
22
22
  * Unavailable without a provider for it. Allowed by default; with the org setting
23
23
  * `sandboxToolPolicy` set to ask, every one but Read / Glob / Grep / FetchAttachment needs approval
@@ -163,7 +163,7 @@ export function sandboxReadTool(deps) {
163
163
  let path = "";
164
164
  const { value, notices } = await inToolSandbox(deps, ctx, async (s) => {
165
165
  const { h, p, signal } = s;
166
- path = checkToolPath(resolveToolPath(filePath, s), s, "file_path");
166
+ path = checkToolPath(resolveToolPath(filePath, s), "file_path");
167
167
  const st = await p.stat(h, path, signal);
168
168
  if (st === null)
169
169
  throw new ToolError(notFound(path));
@@ -35,9 +35,9 @@ export declare const subagentNotTaskText: (id: string) => string;
35
35
  */
36
36
  export declare function ownedTask(env: TaskEnv, ctx: BuiltinCallContext, id: string): Promise<BackgroundTaskRow>;
37
37
  /**
38
- * The per-call access re-check of every sandbox tool (`inSandbox`): the conversation's device
39
- * may still be used by its owner. The task tools read a task's own instance without `inSandbox`,
40
- * so they check here first; errors become the tools' errors.
38
+ * The per-call access re-check of every sandbox tool (`inToolSandbox`): the conversation's
39
+ * device may still be used by its owner. The task tools read a task's own instance without
40
+ * `inToolSandbox`, so they check here first; errors become the tools' errors.
41
41
  */
42
42
  export declare function recheckDevice(env: TaskEnv, ctx: BuiltinCallContext): Promise<void>;
43
43
  /**
@@ -112,9 +112,9 @@ export async function ownedTask(env, ctx, id) {
112
112
  return task;
113
113
  }
114
114
  /**
115
- * The per-call access re-check of every sandbox tool (`inSandbox`): the conversation's device
116
- * may still be used by its owner. The task tools read a task's own instance without `inSandbox`,
117
- * so they check here first; errors become the tools' errors.
115
+ * The per-call access re-check of every sandbox tool (`inToolSandbox`): the conversation's
116
+ * device may still be used by its owner. The task tools read a task's own instance without
117
+ * `inToolSandbox`, so they check here first; errors become the tools' errors.
118
118
  */
119
119
  export async function recheckDevice(env, ctx) {
120
120
  try {
@@ -185,7 +185,7 @@ export function taskOutputTool(deps) {
185
185
  async run(input, ctx) {
186
186
  const { task_id, block = true, timeout } = input;
187
187
  // another account's run never reads or stops on the owner's device (activated)
188
- assertDeviceOfRunAccount(deps.managedDeviceContextRequired, ctx);
188
+ assertDeviceOfRunAccount(ctx);
189
189
  const env = await taskEnv(deps, ctx);
190
190
  // A sub-agent's agentId is answered, not refused: where its report arrives is the answer
191
191
  // (acceptance 2026-11-13: guidance the model is expected to follow is not a failed call).
@@ -88,7 +88,7 @@ export function taskStopTool(deps) {
88
88
  async run(input, ctx) {
89
89
  const { task_id } = input;
90
90
  // another account's run never reads or stops on the owner's device (activated)
91
- assertDeviceOfRunAccount(deps.managedDeviceContextRequired, ctx);
91
+ assertDeviceOfRunAccount(ctx);
92
92
  const env = await taskEnv(deps, ctx);
93
93
  const task = await ownedTask(env, ctx, task_id);
94
94
  await recheckDevice(env, ctx);
@@ -63,10 +63,12 @@ export declare function findSkillVersion(db: KernelSchemaDb, ctx: Pick<BuiltinCa
63
63
  /** A digest of the right shape for the renderer; only inside the sentinel directory. */
64
64
  export declare const PROJECT_DIR_DIGEST = "000000000000";
65
65
  /** Why a project skill's SKILL.md could not be used (each caller phrases it for its reader). */
66
- export type ProjectSkillProblem = {
67
- kind: "outside_mode";
66
+ export type ProjectSkillProblem =
67
+ /** The path built from the recorded root fails the shape checks (`why`: which). */
68
+ {
69
+ kind: "bad_path";
68
70
  path: string;
69
- mode: string;
71
+ why: string;
70
72
  } | {
71
73
  kind: "gone";
72
74
  path: string;
@@ -97,12 +99,11 @@ export interface ProjectSkillFile {
97
99
  truncated: boolean;
98
100
  }
99
101
  /**
100
- * Reads `<root>/.agents/skills/<name>/SKILL.md` in `s` (its path checked as `Read` checks one,
101
- * {@link checkToolPath}) and parses it; its name must be its
102
- * directory's. Shared by `Skill` and a person's invocation (`SkillInvoker`), so both read a
103
- * project skill the same way. A problem with the file or its path throws
104
- * {@link ProjectSkillReadError}; the sandbox's own failures (offline, lost files, ...) and an abort
105
- * are rethrown as they are.
102
+ * Reads `<root>/.agents/skills/<name>/SKILL.md` in `s` (its path shape checked as `Read` checks
103
+ * one, `validateSandboxPathShape`) and parses it; its name must be its directory's. A problem with
104
+ * the file or its path throws {@link ProjectSkillReadError}; the sandbox's own failures (offline,
105
+ * lost files, a read outside the scope the device admits, ...) and an abort are rethrown as they
106
+ * are.
106
107
  */
107
108
  export declare function readProjectSkill(s: SandboxSession, root: string, bare: string, signal?: AbortSignal): Promise<ProjectSkillFile>;
108
109
  /** 内置工具 `Skill`(见文件头)。 */
@@ -1,5 +1,5 @@
1
1
  import { createHash } from "node:crypto";
2
- import { parseSkillMd, renderSkillBody, SKILL_ENTRY_FILE, SKILL_INVOCATION_LIMITS, SKILLS_SANDBOX_ROOT, skillDigest, skillInvocation, skillSandboxDir, skillSandboxPath, ToolError, } from "@capybara-hq/plugin-sdk";
2
+ import { parseSkillMd, renderSkillBody, SKILL_ENTRY_FILE, SKILL_INVOCATION_LIMITS, SKILLS_SANDBOX_ROOT, skillDigest, skillInvocation, skillSandboxDir, skillSandboxPath, ToolError, validateSandboxPathShape, } from "@capybara-hq/plugin-sdk";
3
3
  import { sql } from "kysely";
4
4
  import { normalizeStoredDefinition } from "../../agents/definition.js";
5
5
  import { ApiError } from "../../errors.js";
@@ -11,7 +11,7 @@ import { resolveSkillForkType } from "../../runtime/subagents/roster.js";
11
11
  import { invocationOf, resolveSkills } from "../../skills/catalog.js";
12
12
  import { PLATFORM_SOURCE, skillFileStore } from "../../skills/usable.js";
13
13
  import { AGENT_TOOL, SANDBOX_TOOL_NAMES } from "../builtin-names.js";
14
- import { checkToolPath, clip, display, inSandboxPreparation, inToolSandbox, mapSandboxError, sandboxBaseTimeoutMs, sandboxConversationOf, sandboxUnusableReason, withNotices, withPathLease, } from "./sandbox/common.js";
14
+ import { clip, display, inSandboxPreparation, inToolSandbox, mapSandboxError, sandboxBaseTimeoutMs, sandboxConversationOf, sandboxUnusableReason, withNotices, withPathLease, } from "./sandbox/common.js";
15
15
  /**
16
16
  * Builtin tool `Skill` (M5 T14, ruling M17): resolves the name against the latest skills catalog
17
17
  * snapshot in the log to an id and version, and returns that version's SKILL.md body and file list
@@ -392,7 +392,7 @@ const notInProject = (asked, project, names) => {
392
392
  const more = names.length > shown.length ? ", …" : "";
393
393
  return `Skill "${clip(asked, 80)}" is not one of the skills of the project "${project}"; call Skill with one of the project's skills (${shown.length === 0 ? "it lists none" : `${shown.join(", ")}${more}`}).`;
394
394
  };
395
- const projectOutsideModeText = (asked, path, mode) => `Skill "${asked}" cannot be loaded: ${path} is outside what the device can read in ${mode} mode now. Ask the user to switch the device to auto mode, or do the task without the skill.`;
395
+ const projectBadPathText = (asked, path, why) => `Skill "${asked}" cannot be loaded: the project's recorded root makes its SKILL.md path ${clip(path, 300)}, which is not a clean absolute path (${why}), so nothing was read. Ask the user to check the project's location on the device, or do the task without the skill.`;
396
396
  const projectFileGoneText = (asked, path) => `Skill "${asked}" cannot be loaded: ${path} is no longer on the device. Check the project's .agents/skills directory with Glob or Read, or do the task without the skill.`;
397
397
  const projectReadFailedText = (asked, path, why) => `Skill "${asked}" cannot be loaded: reading ${path} on the device failed (${clip(why, 300)}). Retry once; if it fails again, do the task without the skill.`;
398
398
  const projectParseText = (asked, path, why) => `Skill "${asked}" cannot be loaded: ${path} is not a valid SKILL.md (${clip(why, 300)}). Ask the user to fix it, or do the task without the skill.`;
@@ -405,24 +405,20 @@ export class ProjectSkillReadError extends Error {
405
405
  }
406
406
  }
407
407
  /**
408
- * Reads `<root>/.agents/skills/<name>/SKILL.md` in `s` (its path checked as `Read` checks one,
409
- * {@link checkToolPath}) and parses it; its name must be its
410
- * directory's. Shared by `Skill` and a person's invocation (`SkillInvoker`), so both read a
411
- * project skill the same way. A problem with the file or its path throws
412
- * {@link ProjectSkillReadError}; the sandbox's own failures (offline, lost files, ...) and an abort
413
- * are rethrown as they are.
408
+ * Reads `<root>/.agents/skills/<name>/SKILL.md` in `s` (its path shape checked as `Read` checks
409
+ * one, `validateSandboxPathShape`) and parses it; its name must be its directory's. A problem with
410
+ * the file or its path throws {@link ProjectSkillReadError}; the sandbox's own failures (offline,
411
+ * lost files, a read outside the scope the device admits, ...) and an abort are rethrown as they
412
+ * are.
414
413
  */
415
414
  export async function readProjectSkill(s, root, bare, signal = s.signal) {
416
415
  const dir = `${root}/${PROJECT_SKILLS_DIR}/${bare}`;
417
416
  const path = `${dir}/${SKILL_ENTRY_FILE}`;
418
- try {
419
- checkToolPath(path, s);
420
- }
421
- catch (e) {
422
- if (!(e instanceof ToolError))
423
- throw e;
424
- // only the fixed roots refuse a path, and they bound paths only in sandbox mode (legacy route)
425
- throw new ProjectSkillReadError({ kind: "outside_mode", path, mode: "sandbox" });
417
+ // only a path whose shape fails (from the recorded root) is refused here; what the device may
418
+ // read is the provider's rule, refused by the read itself
419
+ const shape = validateSandboxPathShape(path);
420
+ if (shape.length > 0) {
421
+ throw new ProjectSkillReadError({ kind: "bad_path", path, why: shape.join("; ") });
426
422
  }
427
423
  let read;
428
424
  try {
@@ -469,8 +465,8 @@ export async function readProjectSkill(s, root, bare, signal = s.signal) {
469
465
  /** The model's text for a {@link ProjectSkillProblem} of `Skill`. */
470
466
  function projectProblemText(asked, p) {
471
467
  switch (p.kind) {
472
- case "outside_mode":
473
- return projectOutsideModeText(asked, p.path, p.mode);
468
+ case "bad_path":
469
+ return projectBadPathText(asked, p.path, p.why);
474
470
  case "gone":
475
471
  return projectFileGoneText(asked, p.path);
476
472
  case "read_failed":
@@ -307,7 +307,7 @@ export declare class ConnectorsService {
307
307
  * OAuth the client setup (discovery, dynamic registration or the client credentials token; an
308
308
  * outbound failure -> 502 `connector.connect_failed`). Writes nothing.
309
309
  */
310
- prepareTemplateUpdate(actorAccountId: string, connector: string, input: TemplateUpdateInput): Promise<PreparedTemplateUpdate>;
310
+ prepareTemplateUpdate(actorAccountId: string | null, connector: string, input: TemplateUpdateInput): Promise<PreparedTemplateUpdate>;
311
311
  /**
312
312
  * Applies a prepared template update in the caller's transaction (the caller holds the org row
313
313
  * lock and checked the actor): the endpoint, auth and template version of the connector, the
@@ -317,7 +317,9 @@ export declare class ConnectorsService {
317
317
  * unnamed `derived` tools and the org's own (`admin`) stay (spec §10). Tool definitions are untouched (the next refresh takes the new endpoint through drift review). With `resetCredentials` the credentials are replaced.
318
318
  * Audits `connector.template_applied`. Deleted / missing -> `connector.not_found`.
319
319
  */
320
- applyTemplateIn(orgId: string, connectorId: string, actorAccountId: string, p: PreparedTemplateUpdate, actorTokenId?: string): Promise<void>;
320
+ applyTemplateIn(orgId: string, connectorId: string,
321
+ /** null: the kernel itself (a platform update the bootstrap step runs). */
322
+ actorAccountId: string | null, p: PreparedTemplateUpdate, actorTokenId?: string): Promise<void>;
321
323
  /** Refuses a loaded kind whose extension is not enabled in the org (the same notion as {@link kinds}). */
322
324
  private assertKindAvailable;
323
325
  /**
@@ -313,7 +313,12 @@ let ConnectorsService = class ConnectorsService {
313
313
  return { slug, endpoint };
314
314
  if (auth.type === "none")
315
315
  throw fail("credential", "Auth type none takes no credential");
316
- const owner = auth.ownership === "org" ? { kind: "org" } : { kind: "user", accountId: actorAccountId };
316
+ if (auth.ownership !== "org" && actorAccountId === null) {
317
+ throw new Error("a member's credential needs the acting account");
318
+ }
319
+ const owner = auth.ownership === "org"
320
+ ? { kind: "org" }
321
+ : { kind: "user", accountId: actorAccountId };
317
322
  this.credentials.validate(auth, owner, credential);
318
323
  return { slug, endpoint, owner, secret: credential };
319
324
  }
@@ -524,7 +529,12 @@ let ConnectorsService = class ConnectorsService {
524
529
  return out;
525
530
  if (auth.type === "none")
526
531
  throw fail("credential", "Auth type none takes no credential");
527
- const owner = auth.ownership === "org" ? { kind: "org" } : { kind: "user", accountId: actorAccountId };
532
+ if (auth.ownership !== "org" && actorAccountId === null) {
533
+ throw new Error("a member's credential needs the acting account");
534
+ }
535
+ const owner = auth.ownership === "org"
536
+ ? { kind: "org" }
537
+ : { kind: "user", accountId: actorAccountId };
528
538
  this.credentials.validate(auth, owner, credential);
529
539
  return { ...out, owner, secret: credential };
530
540
  }
@@ -542,7 +552,9 @@ let ConnectorsService = class ConnectorsService {
542
552
  * unnamed `derived` tools and the org's own (`admin`) stay (spec §10). Tool definitions are untouched (the next refresh takes the new endpoint through drift review). With `resetCredentials` the credentials are replaced.
543
553
  * Audits `connector.template_applied`. Deleted / missing -> `connector.not_found`.
544
554
  */
545
- async applyTemplateIn(orgId, connectorId, actorAccountId, p, actorTokenId) {
555
+ async applyTemplateIn(orgId, connectorId,
556
+ /** null: the kernel itself (a platform update the bootstrap step runs). */
557
+ actorAccountId, p, actorTokenId) {
546
558
  const t = this.db;
547
559
  const before = await this.row(t, orgId, connectorId, true);
548
560
  const { input } = p;
@@ -418,8 +418,6 @@ export declare class ToolPipeline {
418
418
  devices?: Pick<ConversationDevices, "reviewFacts">, permissionAuthority?: SandboxOperationAuthority | undefined, permissionGrants?: PermissionCallGrants | undefined,
419
419
  /** Full access auto-grants, recorded exactly once (absent in hand-built pipelines). */
420
420
  autoGrants?: PermissionAutoGrants | undefined, permissionLocks?: PermissionAuthorityLock | undefined,
421
- /** The paired activation gate: on, the managed builtins take the permission review. */
422
- activation?: boolean,
423
421
  /** Starts a cloud device before its first managed call is reviewed (absent: never). */
424
422
  sandboxes?: Pick<SandboxService, "ensureRunning" | "hostRefusal"> | undefined,
425
423
  /**
@@ -43,7 +43,6 @@ import { SandboxOperationAuthority } from "../sandbox/operation-authority.js";
43
43
  import { PermissionAuthorityLock } from "../sandbox/permission-authority-lock.js";
44
44
  import { PermissionAutoGrants } from "../sandbox/permission-auto-grants.js";
45
45
  import { PermissionCallGrants } from "../sandbox/permission-call-grants.js";
46
- import { PERMISSION_CONTEXT_ACTIVATION, permissionContextActive, } from "../sandbox/permission-context-types.js";
47
46
  import { permissionScopeHash } from "../sandbox/permission-facts.js";
48
47
  import { isSessionGrantableRule, } from "../sandbox/review/index.js";
49
48
  import { approverForCrossing, buildPermissionCandidate, crossingOfCandidate, ESCALATION_RETRY_HINT, ESCALATION_UNATTENDED_WHY, escalationRefusedText, isEscalatedCall, } from "../sandbox/review/permission-candidate.js";
@@ -262,7 +261,7 @@ const FAIL_CLOSED_CODES = new Set([
262
261
  ]);
263
262
  /** What the model gets when the permission check of its call refused (fail closed). */
264
263
  export const permissionCheckFailedText = (why) => `The permission check for this call could not be completed (${why.replace(/\.$/, "")}), so it did not run. Retry the call once; if it fails again, ask the user to check the conversation's permission profile or to approve the call again.`;
265
- /** The builtins whose device entry is the managed operation route once activated. */
264
+ /** The builtins whose device entry is the managed operation route. */
266
265
  const MANAGED_OPERATION_TOOLS = new Set([
267
266
  BUILTIN.Bash,
268
267
  BUILTIN.Read,
@@ -499,8 +498,6 @@ let ToolPipeline = class ToolPipeline {
499
498
  devices, permissionAuthority, permissionGrants,
500
499
  /** Full access auto-grants, recorded exactly once (absent in hand-built pipelines). */
501
500
  autoGrants, permissionLocks,
502
- /** The paired activation gate: on, the managed builtins take the permission review. */
503
- activation,
504
501
  /** Starts a cloud device before its first managed call is reviewed (absent: never). */
505
502
  sandboxes,
506
503
  /**
@@ -520,12 +517,10 @@ let ToolPipeline = class ToolPipeline {
520
517
  this.approvalProfile = approvalProfile;
521
518
  this.toolReview = toolReview;
522
519
  this.deps = {
523
- // the builtins that enter a device on the managed operation route once activated (common.ts
520
+ // the builtins that enter a device on the managed operation route (common.ts
524
521
  // `inToolSandbox`, `inSandboxPreparation`): their review is the permission review, whose
525
- // approvals issue the exact call grants admission reads; dormant, none (the command review)
526
- permissionOperations: permissionContextActive(activation)
527
- ? MANAGED_OPERATION_TOOLS
528
- : new Set(),
522
+ // approvals issue the exact call grants admission reads
523
+ permissionOperations: MANAGED_OPERATION_TOOLS,
529
524
  get db() {
530
525
  return kdb.db;
531
526
  },
@@ -2796,12 +2791,10 @@ ToolPipeline = __decorate([
2796
2791
  __param(24, Optional()),
2797
2792
  __param(24, Inject(PermissionAuthorityLock)),
2798
2793
  __param(25, Optional()),
2799
- __param(25, Inject(PERMISSION_CONTEXT_ACTIVATION)),
2794
+ __param(25, Inject(SandboxService)),
2800
2795
  __param(26, Optional()),
2801
- __param(26, Inject(SandboxService)),
2796
+ __param(26, Inject(ConversationApprovalProfile)),
2802
2797
  __param(27, Optional()),
2803
- __param(27, Inject(ConversationApprovalProfile)),
2804
- __param(28, Optional()),
2805
- __param(28, Inject(ToolAskReview))
2798
+ __param(27, Inject(ToolAskReview))
2806
2799
  ], ToolPipeline);
2807
2800
  export { ToolPipeline };
@@ -82,7 +82,7 @@ ToolsModule = __decorate([
82
82
  SubagentsModule,
83
83
  // the builtin sandbox and skill tools run in the conversation's device
84
84
  SandboxModule,
85
- // the managed sandbox route's device context writer (passed only once activated)
85
+ // the managed sandbox route's device context writer
86
86
  ManagedDeviceContextModule,
87
87
  DevicesModule,
88
88
  // network asks read the run tree's network grants
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/kernel",
3
- "version": "0.1.0-rc.75",
3
+ "version": "0.1.0-rc.77",
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.60"
69
+ "@capybara-hq/plugin-sdk": "^0.1.0-rc.62"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@langchain/langgraph-checkpoint-validation": "^1.2.0",
@@ -0,0 +1,28 @@
1
+ -- A device report's limit value became text (`DeviceReportLimit.value` is `{ en, zh? }`, core#663):
2
+ -- a stored report whose limit values are plain strings (written before) no longer passes
3
+ -- `parseDeviceReport`, so its device would show no report and lose its home until the next
4
+ -- refresh. Each string value becomes `{ "en": value }`; the order of the limits and every other
5
+ -- key (`support` included) are kept. Idempotent: a report without string values is not touched.
6
+ UPDATE devices
7
+ SET report = jsonb_set(
8
+ report,
9
+ '{limits}',
10
+ (
11
+ SELECT jsonb_agg(
12
+ CASE
13
+ WHEN jsonb_typeof(l.value -> 'value') = 'string'
14
+ THEN jsonb_set(l.value, '{value}', jsonb_build_object('en', l.value -> 'value'))
15
+ ELSE l.value
16
+ END
17
+ ORDER BY l.ordinality
18
+ )
19
+ FROM jsonb_array_elements(report -> 'limits') WITH ORDINALITY AS l(value, ordinality)
20
+ )
21
+ )
22
+ WHERE report IS NOT NULL
23
+ AND jsonb_typeof(report -> 'limits') = 'array'
24
+ AND EXISTS (
25
+ SELECT 1
26
+ FROM jsonb_array_elements(report -> 'limits') AS s(value)
27
+ WHERE jsonb_typeof(s.value -> 'value') = 'string'
28
+ );
@@ -0,0 +1,6 @@
1
+ -- Issue #675: a device instance whose provider plugin is no longer installed on this deployment
2
+ -- (no extension_installs row, or its catalog item removed) can never be destroyed by the kernel.
3
+ -- Deleting its device marks the row abandoned instead of retrying forever: abandoned_at is when,
4
+ -- and the row keeps the provider-side names (handle, fs_handle, prev_handle) for the super admin.
5
+ -- NULL for every other row. A provider of that name installed again destroys it as before.
6
+ ALTER TABLE device_instances ADD COLUMN IF NOT EXISTS abandoned_at timestamptz;