@promptowl/contextnest-community 1.16.1 → 1.18.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.
Files changed (30) hide show
  1. package/CONFIGURATION.md +415 -415
  2. package/LICENSE.md +142 -142
  3. package/README.md +168 -169
  4. package/dist/{chunk-D6HICFVW.js → chunk-34UXRZXD.js} +59 -14
  5. package/dist/chunk-F66VCBLA.js +136 -0
  6. package/dist/{chunk-L7UCMGWZ.js → chunk-FUUJG6XP.js} +641 -285
  7. package/dist/{chunk-QJVRZT6M.js → chunk-HGN45I5P.js} +59 -21
  8. package/dist/{chunk-JMJLNEXE.js → chunk-HYSTFMFG.js} +43 -2
  9. package/dist/chunk-OOBZG6BW.js +379 -0
  10. package/dist/{chunk-OTGZQZKK.js → chunk-QUZXRLUA.js} +11 -10
  11. package/dist/{chunk-CLKZZZS2.js → chunk-TQACHVVA.js} +35 -4
  12. package/dist/{chunk-SLTQACJW.js → chunk-YB3LKF7U.js} +3 -1
  13. package/dist/{client-OBS5HOTA.js → client-SW5I6ZBK.js} +2 -2
  14. package/dist/engine-34E3YNX7.js +14 -0
  15. package/dist/external-edit-service-6Q6SHEOF.js +33 -0
  16. package/dist/{grants-service-I535QVTW.js → grants-service-ME7HIVHU.js} +5 -5
  17. package/dist/index.js +700 -526
  18. package/dist/{keys-73STFJJB.js → keys-CTOGAG3W.js} +5 -1
  19. package/dist/{migrations.postgres-CYKO5CFV.js → migrations.postgres-5VI4RDTS.js} +41 -4
  20. package/dist/{review-service-V2GR6VM3.js → review-service-H2M5ACPQ.js} +11 -9
  21. package/dist/{stewardship-service-LTREGVSJ.js → stewardship-service-U4CKL7Y5.js} +8 -4
  22. package/dist/{version-service-V6K5SZ3P.js → version-service-JWEN5UUW.js} +6 -4
  23. package/dist/web3/assets/{hootie-C2ocYkn4.svg → hootie-_U3ECslt.svg} +8 -8
  24. package/dist/web3/assets/index-DONv5_Ni.css +1 -0
  25. package/dist/web3/assets/index-jSGrnboh.js +1065 -0
  26. package/dist/web3/index.html +14 -14
  27. package/package.json +165 -165
  28. package/dist/chunk-XRK6SQSC.js +0 -58
  29. package/dist/web3/assets/index-DnQARUL3.css +0 -1
  30. package/dist/web3/assets/index-_m7WyozM.js +0 -1051
@@ -11,7 +11,7 @@ import {
11
11
  resolveNestPermission,
12
12
  resolveTeamRolesForUser,
13
13
  sendEmailToRecipient
14
- } from "./chunk-L7UCMGWZ.js";
14
+ } from "./chunk-FUUJG6XP.js";
15
15
  import {
16
16
  ConflictError,
17
17
  ValidationError
@@ -20,7 +20,7 @@ import {
20
20
  config,
21
21
  getDb,
22
22
  isEmailish
23
- } from "./chunk-JMJLNEXE.js";
23
+ } from "./chunk-HYSTFMFG.js";
24
24
 
25
25
  // src/governance/stewardship-service.ts
26
26
  import { v4 as uuid } from "uuid";
@@ -229,7 +229,7 @@ async function createStewardRecord(params) {
229
229
  );
230
230
  let userId = userRow?.id;
231
231
  if (!userId) {
232
- const { hashPassword } = await import("./keys-73STFJJB.js");
232
+ const { hashPassword } = await import("./keys-CTOGAG3W.js");
233
233
  userId = uuid();
234
234
  await db.run(
235
235
  "INSERT INTO users (id, email, name, password_hash, is_invited) VALUES (?, ?, ?, ?, 1)",
@@ -389,7 +389,7 @@ async function resolveGrantRoles(nestId, userEmail, userId) {
389
389
  )
390
390
  ];
391
391
  }
392
- async function resolveUserRoles(nestId, userEmail, opts) {
392
+ async function resolveNestWideRoles(nestId, userEmail) {
393
393
  const roles = /* @__PURE__ */ new Set();
394
394
  if (isSuperAdmin(userEmail)) roles.add("admin");
395
395
  const owner = await getNestOwnerEmail(nestId);
@@ -404,6 +404,35 @@ async function resolveUserRoles(nestId, userEmail, opts) {
404
404
  roles.add(role);
405
405
  }
406
406
  }
407
+ return [...roles];
408
+ }
409
+ async function stewardCoverageForUser(nestId, userEmail) {
410
+ const db = getDb();
411
+ const rows = await db.all(
412
+ `SELECT scope, node_pattern, tag_name FROM stewards
413
+ WHERE nest_id = ? AND is_active = 1 AND LOWER(user_email) = LOWER(?)`,
414
+ [nestId, userEmail]
415
+ );
416
+ const nodeIds = /* @__PURE__ */ new Set();
417
+ const tags = [];
418
+ for (const r of rows) {
419
+ if (r.scope === "nest") return { nestWide: true, nodeIds };
420
+ if (r.scope === "document" && r.node_pattern) nodeIds.add(r.node_pattern);
421
+ else if (r.scope === "tag" && r.tag_name) tags.push(r.tag_name);
422
+ }
423
+ if (tags.length) {
424
+ const placeholders = tags.map(() => "?").join(", ");
425
+ const tagged = await db.all(
426
+ `SELECT DISTINCT node_id FROM node_tag_index
427
+ WHERE nest_id = ? AND tag_name IN (${placeholders})`,
428
+ [nestId, ...tags]
429
+ );
430
+ for (const t of tagged) nodeIds.add(t.node_id);
431
+ }
432
+ return { nestWide: false, nodeIds };
433
+ }
434
+ async function resolveUserRoles(nestId, userEmail, opts) {
435
+ const roles = new Set(await resolveNestWideRoles(nestId, userEmail));
407
436
  const stewardRoles = opts?.nodeId ? (await resolveStewardsForNode(nestId, opts.nodeId)).filter(
408
437
  (r) => r.steward.userEmail.toLowerCase() === userEmail.toLowerCase()
409
438
  ).map((r) => r.steward.role) : await getStewardRolesForUser(nestId, userEmail);
@@ -614,6 +643,8 @@ export {
614
643
  getStewardsForUser,
615
644
  getCollaboratorRole,
616
645
  resolveGrantRoles,
646
+ resolveNestWideRoles,
647
+ stewardCoverageForUser,
617
648
  resolveUserRoles,
618
649
  canManageStewards,
619
650
  canCreateInNest,
@@ -1,8 +1,10 @@
1
1
  // src/shared/constants.ts
2
2
  var ANON_USER_ID = "00000000-0000-0000-0000-000000000000";
3
3
  var ANON_EMAIL = "admin@localhost";
4
+ var MAX_FOLDER_DEPTH = 8;
4
5
 
5
6
  export {
6
7
  ANON_USER_ID,
7
- ANON_EMAIL
8
+ ANON_EMAIL,
9
+ MAX_FOLDER_DEPTH
8
10
  };
@@ -2,8 +2,8 @@ import {
2
2
  getDb,
3
3
  initDb,
4
4
  resetDb
5
- } from "./chunk-JMJLNEXE.js";
6
- import "./chunk-SLTQACJW.js";
5
+ } from "./chunk-HYSTFMFG.js";
6
+ import "./chunk-YB3LKF7U.js";
7
7
  export {
8
8
  getDb,
9
9
  initDb,
@@ -0,0 +1,14 @@
1
+ import {
2
+ engineApi,
3
+ engineCache,
4
+ opContext
5
+ } from "./chunk-FUUJG6XP.js";
6
+ import "./chunk-GUNJTORH.js";
7
+ import "./chunk-HYSTFMFG.js";
8
+ import "./chunk-YB3LKF7U.js";
9
+ import "./chunk-FRQJWGN3.js";
10
+ export {
11
+ engineApi,
12
+ engineCache,
13
+ opContext
14
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ approveExternalEdit,
3
+ documentsWithSuggestions,
4
+ getExternalEditDetail,
5
+ getPendingChange,
6
+ listExternalEditVerdicts,
7
+ listNestExternalEdits,
8
+ loadLatestApprovedNode,
9
+ rejectExternalEdit,
10
+ scanDocumentForDrift,
11
+ scanNestForDrift,
12
+ startDriftScanner,
13
+ stopDriftScanner
14
+ } from "./chunk-OOBZG6BW.js";
15
+ import "./chunk-FUUJG6XP.js";
16
+ import "./chunk-GUNJTORH.js";
17
+ import "./chunk-HYSTFMFG.js";
18
+ import "./chunk-YB3LKF7U.js";
19
+ import "./chunk-FRQJWGN3.js";
20
+ export {
21
+ approveExternalEdit,
22
+ documentsWithSuggestions,
23
+ getExternalEditDetail,
24
+ getPendingChange,
25
+ listExternalEditVerdicts,
26
+ listNestExternalEdits,
27
+ loadLatestApprovedNode,
28
+ rejectExternalEdit,
29
+ scanDocumentForDrift,
30
+ scanNestForDrift,
31
+ startDriftScanner,
32
+ stopDriftScanner
33
+ };
@@ -2,19 +2,19 @@ import {
2
2
  createGrant,
3
3
  deleteGrant,
4
4
  grantCoversNode,
5
- hasAnyGrant,
5
+ grantRoleForNode,
6
6
  listGrants,
7
7
  listUserGrants,
8
8
  resolveNodeGrant
9
- } from "./chunk-OTGZQZKK.js";
9
+ } from "./chunk-QUZXRLUA.js";
10
10
  import "./chunk-GUNJTORH.js";
11
- import "./chunk-JMJLNEXE.js";
12
- import "./chunk-SLTQACJW.js";
11
+ import "./chunk-HYSTFMFG.js";
12
+ import "./chunk-YB3LKF7U.js";
13
13
  export {
14
14
  createGrant,
15
15
  deleteGrant,
16
16
  grantCoversNode,
17
- hasAnyGrant,
17
+ grantRoleForNode,
18
18
  listGrants,
19
19
  listUserGrants,
20
20
  resolveNodeGrant