@promptowl/contextnest-community 1.9.0 → 1.10.0

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.
@@ -27,7 +27,15 @@ var HISTORICAL_MIGRATIONS = [
27
27
  "016_workflow_edges",
28
28
  "017_workflow_runs",
29
29
  "018_subagent_runs",
30
- "019_grants"
30
+ "019_grants",
31
+ "020_schedules",
32
+ "021_schedule_bounds",
33
+ "022_tools_and_watchers",
34
+ "023_connectors",
35
+ "024_trigger_hooks",
36
+ "025_run_claims",
37
+ "020_server_settings",
38
+ "026_api_events_nest_index"
31
39
  ];
32
40
  async function runPostgresMigrations(db) {
33
41
  await db.exec(`
@@ -280,6 +288,79 @@ async function runPostgresMigrations(db) {
280
288
  ON grants(nest_id, target_type, target, user_id);
281
289
  CREATE INDEX IF NOT EXISTS idx_grants_user ON grants(nest_id, user_id);
282
290
 
291
+ CREATE TABLE IF NOT EXISTS schedules (
292
+ id TEXT PRIMARY KEY,
293
+ nest_id TEXT NOT NULL REFERENCES nests(id) ON DELETE CASCADE,
294
+ agent_node TEXT NOT NULL,
295
+ every_minutes INTEGER NOT NULL CHECK(every_minutes >= 5),
296
+ enabled INTEGER NOT NULL DEFAULT 1,
297
+ last_run_at TEXT,
298
+ max_runs INTEGER,
299
+ runs_created INTEGER NOT NULL DEFAULT 0,
300
+ created_by TEXT NOT NULL,
301
+ created_at TEXT NOT NULL,
302
+ updated_at TEXT NOT NULL
303
+ );
304
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_schedules_agent
305
+ ON schedules(nest_id, agent_node);
306
+
307
+ CREATE TABLE IF NOT EXISTS nest_env (
308
+ nest_id TEXT NOT NULL REFERENCES nests(id) ON DELETE CASCADE,
309
+ key TEXT NOT NULL,
310
+ value TEXT NOT NULL,
311
+ updated_by TEXT NOT NULL,
312
+ updated_at TEXT NOT NULL,
313
+ PRIMARY KEY (nest_id, key)
314
+ );
315
+ CREATE TABLE IF NOT EXISTS watchers (
316
+ id TEXT PRIMARY KEY,
317
+ nest_id TEXT NOT NULL REFERENCES nests(id) ON DELETE CASCADE,
318
+ node_id TEXT NOT NULL,
319
+ user_email TEXT NOT NULL,
320
+ created_by TEXT NOT NULL,
321
+ created_at TEXT NOT NULL
322
+ );
323
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_watchers_unique
324
+ ON watchers(nest_id, node_id, user_email);
325
+ CREATE TABLE IF NOT EXISTS notifications (
326
+ id TEXT PRIMARY KEY,
327
+ nest_id TEXT NOT NULL REFERENCES nests(id) ON DELETE CASCADE,
328
+ user_email TEXT NOT NULL,
329
+ kind TEXT NOT NULL,
330
+ subject_id TEXT,
331
+ message TEXT NOT NULL,
332
+ created_at TEXT NOT NULL,
333
+ read_at TEXT
334
+ );
335
+ CREATE INDEX IF NOT EXISTS idx_notifications_user
336
+ ON notifications(user_email, read_at, created_at);
337
+
338
+ CREATE TABLE IF NOT EXISTS connectors (
339
+ id TEXT PRIMARY KEY,
340
+ nest_id TEXT NOT NULL REFERENCES nests(id) ON DELETE CASCADE,
341
+ channel TEXT NOT NULL CHECK(channel IN ('slack', 'teams', 'webhook')),
342
+ url TEXT NOT NULL,
343
+ events TEXT NOT NULL,
344
+ enabled INTEGER NOT NULL DEFAULT 1,
345
+ created_by TEXT NOT NULL,
346
+ created_at TEXT NOT NULL,
347
+ updated_at TEXT NOT NULL
348
+ );
349
+ CREATE INDEX IF NOT EXISTS idx_connectors_nest ON connectors(nest_id);
350
+
351
+ CREATE TABLE IF NOT EXISTS trigger_hooks (
352
+ id TEXT PRIMARY KEY,
353
+ nest_id TEXT NOT NULL REFERENCES nests(id) ON DELETE CASCADE,
354
+ agent_node TEXT NOT NULL,
355
+ preset TEXT NOT NULL CHECK(preset IN ('slack', 'teams', 'webhook')),
356
+ enabled INTEGER NOT NULL DEFAULT 1,
357
+ fire_count INTEGER NOT NULL DEFAULT 0,
358
+ last_fired_at TEXT,
359
+ created_by TEXT NOT NULL,
360
+ created_at TEXT NOT NULL
361
+ );
362
+ CREATE INDEX IF NOT EXISTS idx_hooks_nest ON trigger_hooks(nest_id);
363
+
283
364
  CREATE TABLE IF NOT EXISTS edge_types (
284
365
  id TEXT PRIMARY KEY,
285
366
  nest_id TEXT NOT NULL REFERENCES nests(id) ON DELETE CASCADE,
@@ -365,6 +446,9 @@ async function runPostgresMigrations(db) {
365
446
  duration_ms INTEGER
366
447
  );
367
448
  CREATE INDEX IF NOT EXISTS idx_api_events_ts ON api_events(ts);
449
+ -- (nest_id, id) composite (migration 026): the per-nest trace view
450
+ -- (GET /nests/:id/trace) filters by nest_id and pages newest-first by id.
451
+ CREATE INDEX IF NOT EXISTS idx_api_events_nest_ts ON api_events(nest_id, id);
368
452
 
369
453
  CREATE TABLE IF NOT EXISTS runs (
370
454
  id TEXT PRIMARY KEY,
@@ -376,7 +460,9 @@ async function runPostgresMigrations(db) {
376
460
  inputs TEXT,
377
461
  trace TEXT,
378
462
  started_at TEXT NOT NULL,
379
- finished_at TEXT
463
+ finished_at TEXT,
464
+ claimed_by TEXT,
465
+ claimed_at TEXT
380
466
  );
381
467
  CREATE INDEX IF NOT EXISTS idx_runs_nest ON runs(nest_id, started_at);
382
468
  CREATE INDEX IF NOT EXISTS idx_runs_agent ON runs(nest_id, agent_node);
@@ -396,6 +482,18 @@ async function runPostgresMigrations(db) {
396
482
  ALTER TABLE runs ADD COLUMN IF NOT EXISTS depth INTEGER NOT NULL DEFAULT 0;
397
483
  CREATE INDEX IF NOT EXISTS idx_runs_parent ON runs(parent_run_id);
398
484
 
485
+ -- server_settings (migration 020): durable store for runtime-mutable server
486
+ -- config (admin Settings + installed license key), loaded into process.env
487
+ -- at boot. Replaces the ephemeral .env-file persistence. value NULL is a
488
+ -- tombstone (explicitly cleared); env_at_write is the deploy-env baseline
489
+ -- for reconcile precedence \u2014 see db/settings.ts.
490
+ CREATE TABLE IF NOT EXISTS server_settings (
491
+ key TEXT PRIMARY KEY,
492
+ value TEXT,
493
+ env_at_write TEXT,
494
+ updated_at TEXT NOT NULL DEFAULT ${NOW}
495
+ );
496
+
399
497
  CREATE TABLE IF NOT EXISTS schema_migrations (
400
498
  id TEXT PRIMARY KEY,
401
499
  applied_at TEXT NOT NULL DEFAULT ${NOW}
@@ -6,14 +6,15 @@ import {
6
6
  getReviewQueue,
7
7
  reject,
8
8
  submitForReview
9
- } from "./chunk-VC3QNHHB.js";
10
- import "./chunk-HRQWNRVI.js";
9
+ } from "./chunk-ZM4F7MY7.js";
10
+ import "./chunk-7PQREKSM.js";
11
+ import "./chunk-UHUU3VAK.js";
11
12
  import {
12
13
  canUserApprove
13
- } from "./chunk-BYS4HDME.js";
14
+ } from "./chunk-KFGZIECB.js";
14
15
  import "./chunk-3JTODC3Y.js";
15
16
  import "./chunk-XQ46F76G.js";
16
- import "./chunk-DPHV6Q26.js";
17
+ import "./chunk-BC6KFUZH.js";
17
18
  import "./chunk-SLTQACJW.js";
18
19
  export {
19
20
  approve,
@@ -20,10 +20,10 @@ import {
20
20
  syncFromConfig,
21
21
  updateSteward,
22
22
  updateStewardRole
23
- } from "./chunk-BYS4HDME.js";
23
+ } from "./chunk-KFGZIECB.js";
24
24
  import "./chunk-3JTODC3Y.js";
25
25
  import "./chunk-XQ46F76G.js";
26
- import "./chunk-DPHV6Q26.js";
26
+ import "./chunk-BC6KFUZH.js";
27
27
  import "./chunk-SLTQACJW.js";
28
28
  export {
29
29
  assignSteward,
@@ -11,9 +11,9 @@ import {
11
11
  hashContent,
12
12
  setApprovedVersion,
13
13
  systemAuthor
14
- } from "./chunk-HRQWNRVI.js";
14
+ } from "./chunk-UHUU3VAK.js";
15
15
  import "./chunk-XQ46F76G.js";
16
- import "./chunk-DPHV6Q26.js";
16
+ import "./chunk-BC6KFUZH.js";
17
17
  import "./chunk-SLTQACJW.js";
18
18
  export {
19
19
  SYSTEM_AUTHOR_PREFIX,