@bevel-software/platform-core-backend 0.30.0 → 0.32.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 (210) hide show
  1. package/agent-guide/access-control.md +49 -4
  2. package/agent-guide/html-views.md +76 -2
  3. package/dist/core/catalog-revision.js +3 -3
  4. package/dist/core/create-core-server.d.ts.map +1 -1
  5. package/dist/core/create-core-server.js +2 -1
  6. package/dist/core/create-core-server.js.map +1 -1
  7. package/dist/core/create-core-services.d.ts +7 -0
  8. package/dist/core/create-core-services.d.ts.map +1 -1
  9. package/dist/core/create-core-services.js +16 -3
  10. package/dist/core/create-core-services.js.map +1 -1
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/modules/access/access-control.service.d.ts.map +1 -1
  16. package/dist/modules/access/access-control.service.js +1 -5
  17. package/dist/modules/access/access-control.service.js.map +1 -1
  18. package/dist/modules/access-model/index.d.ts +14 -0
  19. package/dist/modules/access-model/index.d.ts.map +1 -0
  20. package/dist/modules/access-model/index.js +13 -0
  21. package/dist/modules/access-model/index.js.map +1 -0
  22. package/dist/modules/audit/agent-audit.service.d.ts.map +1 -1
  23. package/dist/modules/audit/agent-audit.service.js +66 -6
  24. package/dist/modules/audit/agent-audit.service.js.map +1 -1
  25. package/dist/modules/audit/audit.contract.d.ts +52 -8
  26. package/dist/modules/audit/audit.contract.d.ts.map +1 -1
  27. package/dist/modules/audit/audit.contract.js +37 -1
  28. package/dist/modules/audit/audit.contract.js.map +1 -1
  29. package/dist/modules/audit/audit.routes.d.ts +1 -1
  30. package/dist/modules/audit/audit.routes.d.ts.map +1 -1
  31. package/dist/modules/audit/audit.routes.js +15 -13
  32. package/dist/modules/audit/audit.routes.js.map +1 -1
  33. package/dist/modules/audit/request-audit.d.ts +21 -10
  34. package/dist/modules/audit/request-audit.d.ts.map +1 -1
  35. package/dist/modules/audit/request-audit.js +26 -10
  36. package/dist/modules/audit/request-audit.js.map +1 -1
  37. package/dist/modules/auth/account-hooks.d.ts +4 -6
  38. package/dist/modules/auth/account-hooks.d.ts.map +1 -1
  39. package/dist/modules/auth/account-hooks.js +7 -17
  40. package/dist/modules/auth/account-hooks.js.map +1 -1
  41. package/dist/modules/auth/auth.service.d.ts +9 -8
  42. package/dist/modules/auth/auth.service.d.ts.map +1 -1
  43. package/dist/modules/auth/auth.service.js +19 -18
  44. package/dist/modules/auth/auth.service.js.map +1 -1
  45. package/dist/modules/database/core-schema.d.ts +43 -4
  46. package/dist/modules/database/core-schema.d.ts.map +1 -1
  47. package/dist/modules/database/core-schema.js +31 -7
  48. package/dist/modules/database/core-schema.js.map +1 -1
  49. package/dist/modules/kb-fs/index.d.ts +1 -0
  50. package/dist/modules/kb-fs/index.d.ts.map +1 -1
  51. package/dist/modules/kb-fs/index.js +1 -0
  52. package/dist/modules/kb-fs/index.js.map +1 -1
  53. package/dist/modules/kb-fs/locking-filesystem.d.ts.map +1 -1
  54. package/dist/modules/kb-fs/locking-filesystem.js +3 -12
  55. package/dist/modules/kb-fs/locking-filesystem.js.map +1 -1
  56. package/dist/modules/kb-fs/mutex.d.ts +11 -0
  57. package/dist/modules/kb-fs/mutex.d.ts.map +1 -1
  58. package/dist/modules/kb-fs/mutex.js +14 -0
  59. package/dist/modules/kb-fs/mutex.js.map +1 -1
  60. package/dist/modules/mcp/mcp-auth.middleware.d.ts +14 -0
  61. package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
  62. package/dist/modules/mcp/mcp-auth.middleware.js +4 -0
  63. package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
  64. package/dist/modules/mcp/mcp.routes.d.ts +5 -0
  65. package/dist/modules/mcp/mcp.routes.d.ts.map +1 -1
  66. package/dist/modules/mcp/mcp.routes.js +67 -0
  67. package/dist/modules/mcp/mcp.routes.js.map +1 -1
  68. package/dist/modules/mcp/mcp.service.d.ts +107 -27
  69. package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
  70. package/dist/modules/mcp/mcp.service.js +257 -50
  71. package/dist/modules/mcp/mcp.service.js.map +1 -1
  72. package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts +28 -0
  73. package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
  74. package/dist/modules/mcp/oauth/bevel-oauth-provider.js +166 -39
  75. package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
  76. package/dist/modules/mcp/request-context.d.ts +25 -0
  77. package/dist/modules/mcp/request-context.d.ts.map +1 -0
  78. package/dist/modules/mcp/request-context.js +11 -0
  79. package/dist/modules/mcp/request-context.js.map +1 -0
  80. package/dist/modules/mcp/shared-definitions.d.ts +56 -0
  81. package/dist/modules/mcp/shared-definitions.d.ts.map +1 -0
  82. package/dist/modules/mcp/shared-definitions.js +117 -0
  83. package/dist/modules/mcp/shared-definitions.js.map +1 -0
  84. package/dist/modules/mcp/surface-cache.d.ts +70 -0
  85. package/dist/modules/mcp/surface-cache.d.ts.map +1 -0
  86. package/dist/modules/mcp/surface-cache.js +104 -0
  87. package/dist/modules/mcp/surface-cache.js.map +1 -0
  88. package/dist/modules/tool-helpers/tool-context.d.ts.map +1 -1
  89. package/dist/modules/tool-helpers/tool-context.js +33 -12
  90. package/dist/modules/tool-helpers/tool-context.js.map +1 -1
  91. package/dist/modules/tool-helpers/tool.contract.d.ts +8 -0
  92. package/dist/modules/tool-helpers/tool.contract.d.ts.map +1 -1
  93. package/dist/modules/tool-helpers/tool.contract.js.map +1 -1
  94. package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts.map +1 -1
  95. package/dist/modules/workflow/agent-tools/change-request-read.tools.js +3 -14
  96. package/dist/modules/workflow/agent-tools/change-request-read.tools.js.map +1 -1
  97. package/dist/modules/workflow/agent-tools/change-request-summary.d.ts +10 -1
  98. package/dist/modules/workflow/agent-tools/change-request-summary.d.ts.map +1 -1
  99. package/dist/modules/workflow/agent-tools/change-request-summary.js +2 -0
  100. package/dist/modules/workflow/agent-tools/change-request-summary.js.map +1 -1
  101. package/dist/modules/workflow/agent-tools/workflow.tools.d.ts +18 -1
  102. package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
  103. package/dist/modules/workflow/agent-tools/workflow.tools.js +458 -2
  104. package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
  105. package/dist/modules/workflow/change-request-hooks.d.ts +78 -0
  106. package/dist/modules/workflow/change-request-hooks.d.ts.map +1 -0
  107. package/dist/modules/workflow/change-request-hooks.js +15 -0
  108. package/dist/modules/workflow/change-request-hooks.js.map +1 -0
  109. package/dist/modules/workflow/git/git.service.d.ts +113 -4
  110. package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
  111. package/dist/modules/workflow/git/git.service.js +470 -106
  112. package/dist/modules/workflow/git/git.service.js.map +1 -1
  113. package/dist/modules/workflow/git/pull-request.service.d.ts +10 -0
  114. package/dist/modules/workflow/git/pull-request.service.d.ts.map +1 -1
  115. package/dist/modules/workflow/git/pull-request.service.js +9 -0
  116. package/dist/modules/workflow/git/pull-request.service.js.map +1 -1
  117. package/dist/modules/workflow/read-on-branch.d.ts +35 -0
  118. package/dist/modules/workflow/read-on-branch.d.ts.map +1 -0
  119. package/dist/modules/workflow/read-on-branch.js +58 -0
  120. package/dist/modules/workflow/read-on-branch.js.map +1 -0
  121. package/dist/modules/workflow/workflow.routes.d.ts.map +1 -1
  122. package/dist/modules/workflow/workflow.routes.js +22 -41
  123. package/dist/modules/workflow/workflow.routes.js.map +1 -1
  124. package/dist/modules/workflow/workflow.service.d.ts +124 -24
  125. package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
  126. package/dist/modules/workflow/workflow.service.js +326 -48
  127. package/dist/modules/workflow/workflow.service.js.map +1 -1
  128. package/dist/modules/workspace/index.d.ts +2 -0
  129. package/dist/modules/workspace/index.d.ts.map +1 -1
  130. package/dist/modules/workspace/index.js +4 -0
  131. package/dist/modules/workspace/index.js.map +1 -1
  132. package/dist/shared/git.contract.d.ts +7 -0
  133. package/dist/shared/git.contract.d.ts.map +1 -1
  134. package/dist/shared/git.contract.js +9 -0
  135. package/dist/shared/git.contract.js.map +1 -1
  136. package/dist/shared/listener-seam.d.ts +34 -0
  137. package/dist/shared/listener-seam.d.ts.map +1 -0
  138. package/dist/shared/listener-seam.js +42 -0
  139. package/dist/shared/listener-seam.js.map +1 -0
  140. package/dist/shared/no-link-below.d.ts +10 -0
  141. package/dist/shared/no-link-below.d.ts.map +1 -0
  142. package/dist/shared/no-link-below.js +30 -0
  143. package/dist/shared/no-link-below.js.map +1 -0
  144. package/migrations/0018_agent_events_page.sql +11 -0
  145. package/migrations/0019_oauth_token_rotated_at.sql +7 -0
  146. package/migrations/meta/0018_snapshot.json +2429 -0
  147. package/migrations/meta/0019_snapshot.json +2435 -0
  148. package/migrations/meta/_journal.json +15 -1
  149. package/package.json +3 -3
  150. package/src/core/catalog-revision.ts +3 -3
  151. package/src/core/create-core-server.ts +2 -1
  152. package/src/core/create-core-services.ts +21 -2
  153. package/src/index.ts +7 -0
  154. package/src/modules/access/access-control.service.ts +1 -6
  155. package/src/modules/access-model/index.ts +13 -0
  156. package/src/modules/agent-guide/__tests__/agent-guide.test.ts +22 -1
  157. package/src/modules/audit/__tests__/agent-audit.service.test.ts +78 -1
  158. package/src/modules/audit/__tests__/audit.routes.test.ts +43 -5
  159. package/src/modules/audit/agent-audit.service.ts +66 -6
  160. package/src/modules/audit/audit.contract.ts +62 -10
  161. package/src/modules/audit/audit.routes.ts +14 -12
  162. package/src/modules/audit/request-audit.ts +28 -13
  163. package/src/modules/auth/__tests__/account-deactivation.test.ts +38 -2
  164. package/src/modules/auth/account-hooks.ts +13 -21
  165. package/src/modules/auth/auth.service.ts +19 -18
  166. package/src/modules/database/core-schema.ts +31 -7
  167. package/src/modules/kb-fs/__tests__/mutex.canonical.test.ts +57 -0
  168. package/src/modules/kb-fs/index.ts +1 -0
  169. package/src/modules/kb-fs/locking-filesystem.ts +3 -12
  170. package/src/modules/kb-fs/mutex.ts +16 -0
  171. package/src/modules/mcp/__tests__/bevel-oauth-provider.pg.test.ts +279 -0
  172. package/src/modules/mcp/__tests__/bevel-oauth-provider.test.ts +190 -15
  173. package/src/modules/mcp/__tests__/mcp-routes-harness.ts +7 -1
  174. package/src/modules/mcp/__tests__/mcp.routes.page.test.ts +115 -0
  175. package/src/modules/mcp/__tests__/mcp.surface-cache.test.ts +521 -0
  176. package/src/modules/mcp/__tests__/shared-definitions.test.ts +28 -0
  177. package/src/modules/mcp/__tests__/surface-cache.test.ts +127 -0
  178. package/src/modules/mcp/mcp-auth.middleware.ts +21 -0
  179. package/src/modules/mcp/mcp.routes.ts +68 -0
  180. package/src/modules/mcp/mcp.service.ts +315 -51
  181. package/src/modules/mcp/oauth/bevel-oauth-provider.ts +214 -48
  182. package/src/modules/mcp/request-context.ts +34 -0
  183. package/src/modules/mcp/shared-definitions.ts +121 -0
  184. package/src/modules/mcp/surface-cache.ts +154 -0
  185. package/src/modules/tool-helpers/tool-context.ts +37 -18
  186. package/src/modules/tool-helpers/tool.contract.ts +8 -0
  187. package/src/modules/tool-registry/__tests__/own-tool-schemas.test.ts +1 -1
  188. package/src/modules/tool-registry/__tests__/tool-description-length.test.ts +1 -1
  189. package/src/modules/workflow/__tests__/change-request-hooks.test.ts +62 -0
  190. package/src/modules/workflow/__tests__/workflow.routes.history-read-gate.test.ts +23 -12
  191. package/src/modules/workflow/__tests__/workflow.routes.open-change-request.test.ts +79 -0
  192. package/src/modules/workflow/__tests__/workflow.service.delete-branch.test.ts +9 -1
  193. package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +508 -5
  194. package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +474 -4
  195. package/src/modules/workflow/agent-tools/change-request-read.tools.ts +4 -22
  196. package/src/modules/workflow/agent-tools/change-request-summary.ts +10 -1
  197. package/src/modules/workflow/agent-tools/workflow.tools.ts +468 -1
  198. package/src/modules/workflow/change-request-hooks.ts +96 -0
  199. package/src/modules/workflow/git/__tests__/git.service.diffFileBetweenBranches.test.ts +76 -11
  200. package/src/modules/workflow/git/__tests__/git.service.mergeIntoBranch.test.ts +721 -0
  201. package/src/modules/workflow/git/git.service.ts +537 -106
  202. package/src/modules/workflow/git/pull-request.service.ts +10 -0
  203. package/src/modules/workflow/read-on-branch.ts +79 -0
  204. package/src/modules/workflow/workflow.routes.ts +21 -39
  205. package/src/modules/workflow/workflow.service.ts +390 -55
  206. package/src/modules/workspace/index.ts +11 -0
  207. package/src/shared/__tests__/no-link-below.test.ts +45 -0
  208. package/src/shared/git.contract.ts +10 -0
  209. package/src/shared/listener-seam.ts +52 -0
  210. package/src/shared/no-link-below.ts +29 -0
@@ -148,4 +148,13 @@ export function assertOneSpecPerLine(specs) {
148
148
  export function isGitTimeout(err) {
149
149
  return err instanceof GitRunError && err.timedOut;
150
150
  }
151
+ /**
152
+ * A full object id (SHA-1 or SHA-256, lowercase hex): what every at-ref
153
+ * access gate resolves its ref to before reading, and the one spelling the
154
+ * history tools accept for a commit — anything shorter or mixed-case is a
155
+ * name, which a fetch can move.
156
+ */
157
+ export function isCommitSha(ref) {
158
+ return /^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(ref);
159
+ }
151
160
  //# sourceMappingURL=git.contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"git.contract.js","sourceRoot":"","sources":["../../src/shared/git.contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AA6CH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC;AAE5C,iEAAiE;AACjE,MAAM,CAAC,MAAM,kBAAkB,GAAmB,MAAM,CAAC,MAAM,CAAC;IAC9D,QAAQ,EAAE,GAAG,EAAE,CAAC,oBAAoB;IACpC,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C,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;AACH,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,OAAO,GAAG,YAAY,WAAW,IAAI,GAAG,CAAC,QAAQ,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,iCAAiC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { ILogger } from './logger.contract.js';
2
+ /**
3
+ * A listener answers how it reached the people an event concerns — a
4
+ * non-empty channel name, `'email'` say — or null when it did not (nothing
5
+ * configured, nobody to tell, the send failed). It is awaited: the caller's
6
+ * answer says who was notified, truthfully, so a listener bounds its own
7
+ * wait. A throw is logged and counts as null; it never fails the caller. An
8
+ * empty name is no channel and counts as null too.
9
+ */
10
+ export type NotifyingListener<E> = (event: E) => Promise<string | null>;
11
+ /**
12
+ * The one way core runs the notification listeners a deployment registers
13
+ * on a seam (an account invited, a change request opened): every listener
14
+ * in registration order, each awaited, the channels that reached somebody
15
+ * collected in that order, a failure logged and counted as "did not" so the
16
+ * event's own effect — the account made, the request opened — stands
17
+ * whatever the listeners do. A seam wraps one of these per event and keeps
18
+ * its own typed registration method, so the rule above is written once.
19
+ */
20
+ export declare class ListenerSeam<E> {
21
+ private readonly log;
22
+ private readonly failed;
23
+ private readonly listeners;
24
+ /**
25
+ * @param log Where a failed listener is reported.
26
+ * @param failed The line logged for one, said in the seam's own terms
27
+ * ("an account-invited listener failed; the person was not notified by it:").
28
+ */
29
+ constructor(log: ILogger, failed: string);
30
+ add(listener: NotifyingListener<E>): void;
31
+ /** Run every listener in registration order; the channels that reached somebody, in that order. */
32
+ run(event: E): Promise<string[]>;
33
+ }
34
+ //# sourceMappingURL=listener-seam.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listener-seam.d.ts","sourceRoot":"","sources":["../../src/shared/listener-seam.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAExE;;;;;;;;GAQG;AACH,qBAAa,YAAY,CAAC,CAAC;IASvB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IATzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA8B;IAExD;;;;OAIG;gBAEgB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM;IAGjC,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI;IAIzC,mGAAmG;IAC7F,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAYvC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The one way core runs the notification listeners a deployment registers
3
+ * on a seam (an account invited, a change request opened): every listener
4
+ * in registration order, each awaited, the channels that reached somebody
5
+ * collected in that order, a failure logged and counted as "did not" so the
6
+ * event's own effect — the account made, the request opened — stands
7
+ * whatever the listeners do. A seam wraps one of these per event and keeps
8
+ * its own typed registration method, so the rule above is written once.
9
+ */
10
+ export class ListenerSeam {
11
+ log;
12
+ failed;
13
+ listeners = [];
14
+ /**
15
+ * @param log Where a failed listener is reported.
16
+ * @param failed The line logged for one, said in the seam's own terms
17
+ * ("an account-invited listener failed; the person was not notified by it:").
18
+ */
19
+ constructor(log, failed) {
20
+ this.log = log;
21
+ this.failed = failed;
22
+ }
23
+ add(listener) {
24
+ this.listeners.push(listener);
25
+ }
26
+ /** Run every listener in registration order; the channels that reached somebody, in that order. */
27
+ async run(event) {
28
+ const notified = [];
29
+ for (const listener of this.listeners) {
30
+ try {
31
+ const channel = await listener(event);
32
+ if (channel !== null && channel !== '')
33
+ notified.push(channel);
34
+ }
35
+ catch (err) {
36
+ this.log.error(this.failed, { err });
37
+ }
38
+ }
39
+ return notified;
40
+ }
41
+ }
42
+ //# sourceMappingURL=listener-seam.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listener-seam.js","sourceRoot":"","sources":["../../src/shared/listener-seam.ts"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,MAAM,OAAO,YAAY;IASJ;IACA;IATF,SAAS,GAA2B,EAAE,CAAC;IAExD;;;;OAIG;IACH,YACmB,GAAY,EACZ,MAAc;QADd,QAAG,GAAH,GAAG,CAAS;QACZ,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;IAEJ,GAAG,CAAC,QAA8B;QAChC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,mGAAmG;IACnG,KAAK,CAAC,GAAG,CAAC,KAAQ;QAChB,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACtC,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;gBACtC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,EAAE;oBAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACjE,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YACvC,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The first folder between `base` (exclusive) and `absolute` (inclusive)
3
+ * that is a symbolic link, or null when none is — judged by `lstat` on each
4
+ * ancestor, so a path that would be followed out of `base` is named before
5
+ * anything reads or writes through it. ONE rule for every sink that resolves
6
+ * a repository path on disk: the locking filesystem's moves and the merge's
7
+ * conflict reads and writes.
8
+ */
9
+ export declare function linkedAncestor(base: string, absolute: string): Promise<string | null>;
10
+ //# sourceMappingURL=no-link-below.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-link-below.d.ts","sourceRoot":"","sources":["../../src/shared/no-link-below.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiB3F"}
@@ -0,0 +1,30 @@
1
+ import path from 'node:path';
2
+ import { lstatOrNull } from './rename-no-replace.js';
3
+ /**
4
+ * The first folder between `base` (exclusive) and `absolute` (inclusive)
5
+ * that is a symbolic link, or null when none is — judged by `lstat` on each
6
+ * ancestor, so a path that would be followed out of `base` is named before
7
+ * anything reads or writes through it. ONE rule for every sink that resolves
8
+ * a repository path on disk: the locking filesystem's moves and the merge's
9
+ * conflict reads and writes.
10
+ */
11
+ export async function linkedAncestor(base, absolute) {
12
+ const root = path.resolve(base);
13
+ // Below `root` means past a separator after it: `/tmp/repository` is a
14
+ // sibling of `/tmp/repo`, not inside it, and is never walked or stat'ed. A
15
+ // filesystem root already ends with its separator.
16
+ const inside = root.endsWith(path.sep) ? root : root + path.sep;
17
+ let current = path.resolve(absolute);
18
+ const ancestors = [];
19
+ while (current.startsWith(inside)) {
20
+ ancestors.push(current);
21
+ current = path.dirname(current);
22
+ }
23
+ for (const ancestor of ancestors) {
24
+ const stat = await lstatOrNull(ancestor);
25
+ if (stat?.isSymbolicLink())
26
+ return ancestor;
27
+ }
28
+ return null;
29
+ }
30
+ //# sourceMappingURL=no-link-below.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-link-below.js","sourceRoot":"","sources":["../../src/shared/no-link-below.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY,EAAE,QAAgB;IACjE,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,uEAAuE;IACvE,2EAA2E;IAC3E,mDAAmD;IACnD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC;IAChE,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,OAAO,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,IAAI,EAAE,cAAc,EAAE;YAAE,OAAO,QAAQ,CAAC;IAC9C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,11 @@
1
+ -- A page's calls in the Audit log: an HTML page of the knowledge base that
2
+ -- calls the viewer's tools is recorded under its own path (`page_path`), as a
3
+ -- third kind of principal beside the connection key and the agent connection,
4
+ -- and a call the viewer refused it is recorded as `refused`. Exactly one
5
+ -- principal per row still holds, now over the three columns.
6
+ ALTER TABLE "agent_events" DROP CONSTRAINT "agent_events_outcome";--> statement-breakpoint
7
+ ALTER TABLE "agent_events" DROP CONSTRAINT "agent_events_principal";--> statement-breakpoint
8
+ ALTER TABLE "agent_events" ADD COLUMN "page_path" text;--> statement-breakpoint
9
+ CREATE INDEX "agent_events_by_page" ON "agent_events" USING btree ("user_id","page_path","at");--> statement-breakpoint
10
+ ALTER TABLE "agent_events" ADD CONSTRAINT "agent_events_outcome" CHECK ("agent_events"."outcome" IN ('ok', 'error', 'denied', 'refused'));--> statement-breakpoint
11
+ ALTER TABLE "agent_events" ADD CONSTRAINT "agent_events_principal" CHECK (num_nonnulls("agent_events"."key_id", "agent_events"."connection_id", "agent_events"."page_path") = 1);
@@ -0,0 +1,7 @@
1
+ -- When a refresh of the row's refresh token minted its successor. Rotation
2
+ -- sets it; a revoke never does, so the two are told apart: a rotated row's
3
+ -- access token still verifies until its own expiry, and its refresh token is
4
+ -- honoured once more within the reuse grace, while a revoked row does neither
5
+ -- (see `exchangeRefreshToken` in bevel-oauth-provider.ts). Null on every
6
+ -- existing row, which rotation then marks as it does any other.
7
+ ALTER TABLE "oauth_tokens" ADD COLUMN "rotated_at" timestamp;