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

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 (74) hide show
  1. package/dist/agents/readiness.controller.d.ts +4 -3
  2. package/dist/agents/readiness.controller.js +4 -3
  3. package/dist/agents/readiness.service.d.ts +44 -11
  4. package/dist/agents/readiness.service.js +59 -16
  5. package/dist/catalog/catalog-import.module.d.ts +1 -1
  6. package/dist/catalog/catalog-import.module.js +1 -1
  7. package/dist/catalog/cli.d.ts +9 -2
  8. package/dist/catalog/cli.js +10 -4
  9. package/dist/catalog/marketplaces.service.d.ts +1 -1
  10. package/dist/catalog/plugin-upgrade.d.ts +4 -2
  11. package/dist/catalog/plugin-upgrade.js +9 -3
  12. package/dist/db/kernel-schema.d.ts +5 -0
  13. package/dist/devices/device-projects.service.d.ts +3 -12
  14. package/dist/devices/device-projects.service.js +16 -59
  15. package/dist/extensions/bootstrap.d.ts +17 -3
  16. package/dist/extensions/bootstrap.js +56 -14
  17. package/dist/lifecycle/kernel-lifecycle.d.ts +3 -1
  18. package/dist/lifecycle/kernel-lifecycle.js +16 -11
  19. package/dist/overrides.d.ts +0 -5
  20. package/dist/overrides.js +0 -2
  21. package/dist/platform/file-ref.d.ts +6 -5
  22. package/dist/platform/ops/agent-skills.ops.js +1 -1
  23. package/dist/platform/ops/agents.ops.js +1 -1
  24. package/dist/runtime/model-call.d.ts +2 -2
  25. package/dist/runtime/project/knowledge.d.ts +1 -1
  26. package/dist/runtime/project/knowledge.js +1 -1
  27. package/dist/runtime/project/knowledge.service.d.ts +5 -11
  28. package/dist/runtime/project/knowledge.service.js +12 -23
  29. package/dist/runtime/providers.d.ts +34 -1
  30. package/dist/runtime/providers.js +56 -7
  31. package/dist/runtime/run-steps.d.ts +4 -6
  32. package/dist/runtime/run-steps.js +7 -15
  33. package/dist/runtime/runtime.module.js +1 -1
  34. package/dist/sandbox/held-operations.d.ts +2 -5
  35. package/dist/sandbox/held-operations.js +0 -14
  36. package/dist/sandbox/managed-device-context.d.ts +1 -1
  37. package/dist/sandbox/managed-device-context.js +1 -1
  38. package/dist/sandbox/permission-context-types.d.ts +0 -11
  39. package/dist/sandbox/permission-context-types.js +0 -13
  40. package/dist/sandbox/providers.d.ts +5 -0
  41. package/dist/sandbox/providers.js +1 -1
  42. package/dist/sandbox/sandbox-file-reader.d.ts +7 -12
  43. package/dist/sandbox/sandbox-file-reader.js +12 -29
  44. package/dist/sandbox/sandbox.service.d.ts +53 -32
  45. package/dist/sandbox/sandbox.service.js +217 -141
  46. package/dist/sandbox/use-context.d.ts +4 -1
  47. package/dist/skills/invoke.d.ts +13 -35
  48. package/dist/skills/invoke.js +23 -162
  49. package/dist/tools/builtins/builtin-tools.d.ts +2 -11
  50. package/dist/tools/builtins/builtin-tools.js +5 -23
  51. package/dist/tools/builtins/image/generate.js +2 -2
  52. package/dist/tools/builtins/sandbox/common.d.ts +32 -80
  53. package/dist/tools/builtins/sandbox/common.js +61 -173
  54. package/dist/tools/builtins/sandbox/deliver.js +2 -2
  55. package/dist/tools/builtins/sandbox/device-owner.d.ts +4 -5
  56. package/dist/tools/builtins/sandbox/device-owner.js +5 -6
  57. package/dist/tools/builtins/sandbox/fetch-attachment.js +2 -2
  58. package/dist/tools/builtins/sandbox/glob.js +1 -1
  59. package/dist/tools/builtins/sandbox/grep.js +1 -1
  60. package/dist/tools/builtins/sandbox/index.d.ts +2 -2
  61. package/dist/tools/builtins/sandbox/index.js +2 -2
  62. package/dist/tools/builtins/sandbox/read.js +1 -1
  63. package/dist/tools/builtins/sandbox/task-output.d.ts +3 -3
  64. package/dist/tools/builtins/sandbox/task-output.js +4 -4
  65. package/dist/tools/builtins/sandbox/task-stop.js +1 -1
  66. package/dist/tools/builtins/skill-load.js +2 -2
  67. package/dist/tools/connectors.service.d.ts +4 -2
  68. package/dist/tools/connectors.service.js +15 -3
  69. package/dist/tools/pipeline.d.ts +0 -2
  70. package/dist/tools/pipeline.js +7 -14
  71. package/dist/tools/tools.module.js +1 -1
  72. package/package.json +2 -2
  73. package/src/migrations/0179_device_report_limit_text.sql +28 -0
  74. package/src/migrations/0180_device_instance_abandoned.sql +6 -0
@@ -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.76",
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.61"
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;