@capybara-hq/kernel 0.1.0-rc.109 → 0.1.0-rc.110

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 (51) hide show
  1. package/dist/admin/admin.schemas.d.ts +3 -0
  2. package/dist/background/wake-rules.js +2 -0
  3. package/dist/conversations/conversations.service.js +4 -2
  4. package/dist/conversations/event-log.js +11 -1
  5. package/dist/conversations/events.d.ts +5 -0
  6. package/dist/conversations/events.js +11 -2
  7. package/dist/conversations/prompt-suggestion-store.d.ts +3 -1
  8. package/dist/conversations/prompt-suggestion-store.js +5 -1
  9. package/dist/db/kernel-schema.d.ts +7 -0
  10. package/dist/identity/accounts.d.ts +8 -9
  11. package/dist/identity/accounts.js +18 -3
  12. package/dist/identity/me.controller.d.ts +4 -2
  13. package/dist/identity/me.controller.js +4 -2
  14. package/dist/identity/me.schemas.d.ts +3 -0
  15. package/dist/identity/me.schemas.js +5 -0
  16. package/dist/identity/settings.d.ts +15 -0
  17. package/dist/identity/settings.js +12 -0
  18. package/dist/infra/outbox/registry.d.ts +14 -0
  19. package/dist/infra/outbox/registry.js +14 -0
  20. package/dist/orgs/settings.service.d.ts +6 -0
  21. package/dist/platform/ops/org-settings.ops.js +1 -1
  22. package/dist/platform/ops/platform.ops.js +9 -3
  23. package/dist/push/recipients.js +4 -2
  24. package/dist/runtime/abort.d.ts +22 -3
  25. package/dist/runtime/abort.js +37 -17
  26. package/dist/runtime/compaction.service.d.ts +43 -12
  27. package/dist/runtime/compaction.service.js +60 -16
  28. package/dist/runtime/context/idle-compaction-rules.d.ts +94 -0
  29. package/dist/runtime/context/idle-compaction-rules.js +84 -0
  30. package/dist/runtime/idle-arm.d.ts +38 -0
  31. package/dist/runtime/idle-arm.js +269 -0
  32. package/dist/runtime/idle-compaction-jobs.d.ts +25 -0
  33. package/dist/runtime/idle-compaction-jobs.js +21 -0
  34. package/dist/runtime/idle-compaction.d.ts +43 -0
  35. package/dist/runtime/idle-compaction.js +316 -0
  36. package/dist/runtime/idle-return.d.ts +62 -0
  37. package/dist/runtime/idle-return.js +170 -0
  38. package/dist/runtime/maintenance.d.ts +5 -2
  39. package/dist/runtime/maintenance.js +14 -4
  40. package/dist/runtime/model-call.d.ts +113 -5
  41. package/dist/runtime/model-call.js +119 -71
  42. package/dist/runtime/run-finish.d.ts +16 -1
  43. package/dist/runtime/run-finish.js +27 -4
  44. package/dist/runtime/run-queue.d.ts +56 -2
  45. package/dist/runtime/run-queue.js +257 -8
  46. package/dist/runtime/run-worker.d.ts +22 -8
  47. package/dist/runtime/run-worker.js +75 -28
  48. package/dist/runtime/runtime.module.js +11 -0
  49. package/dist/runtime/waits.js +1 -1
  50. package/package.json +1 -1
  51. package/src/migrations/0195_idle_compaction.sql +7 -0
@@ -34,6 +34,9 @@ import { CompactionService } from "./compaction.service.js";
34
34
  import { CompactionProgressService } from "./compaction-progress.js";
35
35
  import { CompactionSettingsService } from "./compaction-settings.service.js";
36
36
  import { ConversationLock } from "./conversation-lock.js";
37
+ import { IdleArm } from "./idle-arm.js";
38
+ import { IdleCompactionJob } from "./idle-compaction.js";
39
+ import { IdleReturn } from "./idle-return.js";
37
40
  import { MAINTENANCE_QUEUE_NAME } from "./maintenance-queue.js";
38
41
  import { PermissionContextRecorder } from "./permission-context.service.js";
39
42
  import { PluginContextService } from "./plugin-context.service.js";
@@ -129,6 +132,13 @@ RuntimeModule = __decorate([
129
132
  CompactionProgressService,
130
133
  // the manual compaction execution of a compact run (spec 2026-11-14 §4.7)
131
134
  CompactionService,
135
+ // a chat run's finish decides whether it owes an idle compaction job (idle compaction spec §4.2)
136
+ IdleArm,
137
+ // a run start after a long idle gap logs `idle_return` (idle compaction spec S11)
138
+ IdleReturn,
139
+ // one delivery of the delayed idle compaction job (idle compaction spec §4.3; the maintenance
140
+ // processor, worker role only, consumes it)
141
+ IdleCompactionJob,
132
142
  // a finished background task wakes an idle conversation (background Bash spec §3)
133
143
  BackgroundWake,
134
144
  // one quota per key prefix (the org run quota, the org eval quota)
@@ -162,6 +172,7 @@ RuntimeModule = __decorate([
162
172
  PermissionContextRecorder,
163
173
  CompactionSettingsService,
164
174
  CompactionService,
175
+ IdleCompactionJob,
165
176
  RUN_QUOTA,
166
177
  EVAL_QUOTA,
167
178
  ProvidersModule,
@@ -754,7 +754,7 @@ let Waits = class Waits {
754
754
  await this.childFinished(runId);
755
755
  return false;
756
756
  }
757
- await this.abort.request(runId, byAccountId, detail);
757
+ await this.abort.request(runId, byAccountId, { detail });
758
758
  // the suspend handshake (see suspend): a run that became `waiting` after the read above may
759
759
  // have checked the marker before it was set, so check `waiting` again after setting it
760
760
  // (review M1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/kernel",
3
- "version": "0.1.0-rc.109",
3
+ "version": "0.1.0-rc.110",
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": {
@@ -0,0 +1,7 @@
1
+ -- Idle compaction (idle compaction spec §5.7): which compact runs were started by the idle job.
2
+ -- null = an ordinary run; a compact run written before this migration reads as manual.
3
+ ALTER TABLE runs ADD COLUMN IF NOT EXISTS compact_origin text NULL
4
+ CONSTRAINT runs_compact_origin_check CHECK (compact_origin IN ('manual', 'idle'));
5
+ -- The person's opt-out (spec §6.3): 'off' or null (follow the org).
6
+ ALTER TABLE accounts ADD COLUMN IF NOT EXISTS idle_compaction text NULL
7
+ CONSTRAINT accounts_idle_compaction_check CHECK (idle_compaction = 'off');