trellis 3.2.3 → 3.2.4

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 (194) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +4 -0
  3. package/dist/better-sqlite-backend-CDYOAJDF.js +209 -0
  4. package/dist/boot-middleware-LBJX4N2S.js +9 -0
  5. package/dist/boot-middleware-PATBLD52.js +9 -0
  6. package/dist/bridge-G5DPW6TY.js +2361 -0
  7. package/dist/bridge-JSSPQPRH.js +2389 -0
  8. package/dist/bridge-LNXE4HAW.js +2389 -0
  9. package/dist/bridge-OAAXJWSA.js +2389 -0
  10. package/dist/bridge-SFS63RHC.js +2367 -0
  11. package/dist/bridge-U5TOUBVM.js +2389 -0
  12. package/dist/browser/index.js +12 -12
  13. package/dist/{chunk-KSU2GW22.js → chunk-276W52FK.js} +8 -0
  14. package/dist/{chunk-KFQGP6VL.js → chunk-2ESYSVXG.js} +15 -0
  15. package/dist/{chunk-L5N5PR2S.js → chunk-2WW2X2BR.js} +313 -77
  16. package/dist/chunk-3XCOAP6G.js +48 -0
  17. package/dist/chunk-53PDCTJ3.js +1856 -0
  18. package/dist/{chunk-N6MYZT4O.js → chunk-547FZFKO.js} +1 -1
  19. package/dist/{chunk-7DUMWO5L.js → chunk-7WVOPXJV.js} +3 -3
  20. package/dist/chunk-CMSFD6OV.js +11801 -0
  21. package/dist/{chunk-RSWUFTO2.js → chunk-CPUYCCLT.js} +2 -2
  22. package/dist/{chunk-4HYPLFJD.js → chunk-FA5TFVA5.js} +1 -1
  23. package/dist/{chunk-4XIVMVHC.js → chunk-G3XIHPSQ.js} +1 -1
  24. package/dist/{chunk-JHHEXEDM.js → chunk-GCQF75T4.js} +3 -3
  25. package/dist/{chunk-FKQO5A3H.js → chunk-GHG4H3AS.js} +2 -2
  26. package/dist/{chunk-GLM4HGN4.js → chunk-GRWQPKYK.js} +1 -1
  27. package/dist/{chunk-PZ4XYZ4J.js → chunk-GXA73CNC.js} +33 -8
  28. package/dist/{chunk-6GEZ6DN5.js → chunk-H6VTC5SS.js} +3 -3
  29. package/dist/{chunk-S3XLFZ27.js → chunk-IHHSOBJS.js} +1 -1
  30. package/dist/chunk-IJNC25UD.js +2243 -0
  31. package/dist/{chunk-VDAKEOML.js → chunk-J6OUIION.js} +1 -1
  32. package/dist/chunk-JAVAYMMS.js +6 -0
  33. package/dist/{chunk-S6GBJ2ZB.js → chunk-JCQQFLO5.js} +1 -1
  34. package/dist/{chunk-FWRS4CSC.js → chunk-KQG6ZYXP.js} +3 -3
  35. package/dist/chunk-KXAISKZT.js +119 -0
  36. package/dist/chunk-N3R74ZSR.js +7949 -0
  37. package/dist/{chunk-GU374KWZ.js → chunk-NLFRRGX6.js} +3 -3
  38. package/dist/{chunk-XMQ7G77X.js → chunk-OB4CMMX6.js} +1 -1
  39. package/dist/chunk-OKNASCZY.js +182 -0
  40. package/dist/chunk-ONOPPX5E.js +394 -0
  41. package/dist/chunk-QMSU2RAH.js +98 -0
  42. package/dist/{chunk-TCKXSOBP.js → chunk-RARKFVWU.js} +8 -1
  43. package/dist/{chunk-2AACZRII.js → chunk-SJWVDS5M.js} +751 -162
  44. package/dist/{chunk-SPSPV5BC.js → chunk-SZ3VAB5P.js} +159 -2
  45. package/dist/chunk-V2ASD6RQ.js +147 -0
  46. package/dist/{chunk-KQ4A2D2P.js → chunk-V4YCJDYL.js} +58 -38
  47. package/dist/{chunk-LNUIGRDZ.js → chunk-VWKLKLYB.js} +1 -1
  48. package/dist/chunk-W5PADCDF.js +1856 -0
  49. package/dist/{chunk-MLC5BUYO.js → chunk-WMERMSWI.js} +1 -1
  50. package/dist/chunk-WXAURJUD.js +1948 -0
  51. package/dist/chunk-YC5I32PS.js +147 -0
  52. package/dist/{chunk-VBYUTRXX.js → chunk-YKVB4LUQ.js} +3 -3
  53. package/dist/{chunk-NWSW5YNS.js → chunk-YPT6XMS4.js} +20 -50
  54. package/dist/cli/deploy-cli.d.ts.map +1 -1
  55. package/dist/cli/deploy-cli.js +43 -4
  56. package/dist/cli/gateway-deploy-cli.d.ts +19 -0
  57. package/dist/cli/gateway-deploy-cli.d.ts.map +1 -0
  58. package/dist/cli/index.d.ts.map +1 -1
  59. package/dist/cli/index.js +1360 -881
  60. package/dist/cli/lane.d.ts.map +1 -1
  61. package/dist/cli/protocol.d.ts +6 -0
  62. package/dist/cli/protocol.d.ts.map +1 -0
  63. package/dist/client/index.browser.js +2 -2
  64. package/dist/client/index.js +11 -11
  65. package/dist/client/sdk.browser.js +1 -1
  66. package/dist/client/sdk.js +2 -2
  67. package/dist/cms/index.js +1 -1
  68. package/dist/config-KMY6RRK3.js +19 -0
  69. package/dist/core/index.js +13 -13
  70. package/dist/core/kernel/boot-middleware.d.ts +1 -1
  71. package/dist/core/kernel/boot-middleware.d.ts.map +1 -1
  72. package/dist/core/kernel/schema-middleware.d.ts +2 -1
  73. package/dist/core/kernel/schema-middleware.d.ts.map +1 -1
  74. package/dist/core/kernel/trellis-kernel.d.ts +10 -10
  75. package/dist/core/kernel/trellis-kernel.d.ts.map +1 -1
  76. package/dist/core/persist/factory.js +2 -2
  77. package/dist/core/persist/sqljs-backend.js +2 -2
  78. package/dist/db/index.js +30 -25
  79. package/dist/decisions/index.js +4 -4
  80. package/dist/embeddings/index.js +2 -2
  81. package/dist/engine.d.ts +24 -6
  82. package/dist/engine.d.ts.map +1 -1
  83. package/dist/gateway-deploy-cli-4TU4V3QI.js +312 -0
  84. package/dist/gateway-deploy-cli-A4ISTDHJ.js +298 -0
  85. package/dist/gateway-deploy-cli-D3XTKJQJ.js +312 -0
  86. package/dist/gateway-deploy-cli-ECV3OQCN.js +305 -0
  87. package/dist/gateway-deploy-cli-JUHKVIJE.js +296 -0
  88. package/dist/gateway-deploy-cli-NSDW2JLT.js +310 -0
  89. package/dist/gateway-serve-CM5EAZ52.js +113 -0
  90. package/dist/import-AJLYHFIA.js +10 -0
  91. package/dist/index.js +11 -11
  92. package/dist/launch-explorer-FVX6ZABW.js +95 -0
  93. package/dist/links/index.js +2 -2
  94. package/dist/mcp/bridge.d.ts +45 -0
  95. package/dist/mcp/bridge.d.ts.map +1 -0
  96. package/dist/mcp/discovery.d.ts +15 -0
  97. package/dist/mcp/discovery.d.ts.map +1 -0
  98. package/dist/mcp/gateway-config.d.ts +20 -0
  99. package/dist/mcp/gateway-config.d.ts.map +1 -0
  100. package/dist/mcp/gateway-serve.d.ts +19 -0
  101. package/dist/mcp/gateway-serve.d.ts.map +1 -0
  102. package/dist/mcp/gateway-serve.js +119 -0
  103. package/dist/mcp/graph-summary.d.ts +47 -0
  104. package/dist/mcp/graph-summary.d.ts.map +1 -0
  105. package/dist/mcp/room-audit.d.ts +14 -0
  106. package/dist/mcp/room-audit.d.ts.map +1 -0
  107. package/dist/mcp/room-helpers.d.ts +43 -0
  108. package/dist/mcp/room-helpers.d.ts.map +1 -0
  109. package/dist/mcp/room-registry.d.ts +32 -0
  110. package/dist/mcp/room-registry.d.ts.map +1 -0
  111. package/dist/mcp/room.d.ts +28 -0
  112. package/dist/mcp/room.d.ts.map +1 -0
  113. package/dist/plugins/agent-memory/index.js +1 -1
  114. package/dist/plugins/idea-garden/index.js +1 -1
  115. package/dist/plugins/plan-approval/index.js +1 -1
  116. package/dist/plugins/proactive-watcher/index.js +1 -1
  117. package/dist/protocol/envelope.d.ts +30 -0
  118. package/dist/protocol/envelope.d.ts.map +1 -0
  119. package/dist/protocol/index.d.ts +3 -0
  120. package/dist/protocol/index.d.ts.map +1 -0
  121. package/dist/protocol/whereami.d.ts +33 -0
  122. package/dist/protocol/whereami.d.ts.map +1 -0
  123. package/dist/query-KHDDIR5G.js +31 -0
  124. package/dist/react/index.js +1 -1
  125. package/dist/react/realtime.js +1 -1
  126. package/dist/react/schema-hooks.js +5 -5
  127. package/dist/realtime/index.js +3 -3
  128. package/dist/realtime/relay-server.d.ts.map +1 -1
  129. package/dist/realtime/room.d.ts.map +1 -1
  130. package/dist/realtime.bundle.js +2 -0
  131. package/dist/relay-server-BT6DCJ7F.js +12 -0
  132. package/dist/relay-server-MPQVGNQU.js +12 -0
  133. package/dist/relay-server-PAPW2EWC.js +12 -0
  134. package/dist/remote-manager-6ERQUBSL.js +224 -0
  135. package/dist/remote-manager-G665WWYY.js +224 -0
  136. package/dist/remote-manager-HJTEZ4OF.js +224 -0
  137. package/dist/remote-manager-NYP2Y5UR.js +224 -0
  138. package/dist/remote-manager-WGLCAMMC.js +224 -0
  139. package/dist/scaffold/write.d.ts.map +1 -1
  140. package/dist/schema/index.js +1 -1
  141. package/dist/server/cors.d.ts.map +1 -1
  142. package/dist/server/deploy-gateway.d.ts +27 -0
  143. package/dist/server/deploy-gateway.d.ts.map +1 -0
  144. package/dist/server/deploy.d.ts.map +1 -1
  145. package/dist/server/deploy.js +3 -2
  146. package/dist/server/discovery-mcp-gateway.d.ts +13 -0
  147. package/dist/server/discovery-mcp-gateway.d.ts.map +1 -0
  148. package/dist/server/index.js +38 -31
  149. package/dist/server/mcp-gateway.d.ts +27 -0
  150. package/dist/server/mcp-gateway.d.ts.map +1 -0
  151. package/dist/server/mcp-oauth-metadata.d.ts +31 -0
  152. package/dist/server/mcp-oauth-metadata.d.ts.map +1 -0
  153. package/dist/server/node-adapter.d.ts +7 -0
  154. package/dist/server/node-adapter.d.ts.map +1 -1
  155. package/dist/server/node-adapter.js +2 -2
  156. package/dist/server/realtime.d.ts.map +1 -1
  157. package/dist/server/server.d.ts +8 -0
  158. package/dist/server/server.d.ts.map +1 -1
  159. package/dist/server/streamable-mcp-gateway.d.ts +12 -0
  160. package/dist/server/streamable-mcp-gateway.d.ts.map +1 -0
  161. package/dist/server/usage-meter.d.ts +11 -0
  162. package/dist/server/usage-meter.d.ts.map +1 -1
  163. package/dist/server-4VEZHXXS.js +23 -0
  164. package/dist/{server-OGVWNDNK.js → server-556BMK4C.js} +1 -1
  165. package/dist/server-FQT2VYRE.js +23 -0
  166. package/dist/server-HGZE4ECC.js +23 -0
  167. package/dist/server-J4JKEAMH.js +23 -0
  168. package/dist/server-LXPM5TFR.js +23 -0
  169. package/dist/server-POB4NEUX.js +18 -0
  170. package/dist/server-VJKAPGPG.js +23 -0
  171. package/dist/server-YHS3XIIG.js +23 -0
  172. package/dist/server-ZHTPWPXS.js +23 -0
  173. package/dist/sprites-NC6D7YZS.js +27 -0
  174. package/dist/svelte/index.js +3 -3
  175. package/dist/svelte/schema-hooks.js +4 -4
  176. package/dist/sync/index.js +4 -4
  177. package/dist/tenancy-2SZTP4UD.js +16 -0
  178. package/dist/tenancy-7MTSESMJ.js +16 -0
  179. package/dist/tenancy-U4E7ZEAG.js +16 -0
  180. package/dist/vcs/decompose.d.ts.map +1 -1
  181. package/dist/vcs/index.js +5 -5
  182. package/dist/vcs/lane-disk-materialize.d.ts +11 -0
  183. package/dist/vcs/lane-disk-materialize.d.ts.map +1 -0
  184. package/dist/vcs/lane-worktree.d.ts +21 -0
  185. package/dist/vcs/lane-worktree.d.ts.map +1 -0
  186. package/dist/vcs/store.d.ts +28 -0
  187. package/dist/vcs/store.d.ts.map +1 -0
  188. package/dist/vcs/types.d.ts +5 -0
  189. package/dist/vcs/types.d.ts.map +1 -1
  190. package/dist/vm-config-YZRJ3KUB.js +21 -0
  191. package/dist/vue/index.js +3 -3
  192. package/dist/vue/schema-hooks.js +4 -4
  193. package/package.json +4 -3
  194. package/dist/chunk-GFZCJ4EH.js +0 -108
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Room registry — known Trellis rooms for MCP discovery.
3
+ *
4
+ * Aggregates deploy metadata from ~/.trellis/vm.json, project .trellis-db.json,
5
+ * and optional TRELLIS_ROOM_REGISTRY / TRELLIS_MCP_GATEWAY_ROOMS env JSON.
6
+ *
7
+ * @module trellis/mcp
8
+ */
9
+ export interface RegisteredRoom {
10
+ name: string;
11
+ url: string;
12
+ mcpUrl: string;
13
+ apiKey?: string;
14
+ source: 'vm' | 'project' | 'registry' | 'env';
15
+ deployedAt?: string;
16
+ active?: boolean;
17
+ }
18
+ export interface RoomRegistryOptions {
19
+ /** Project directory for .trellis-db.json (default: cwd). */
20
+ configDir?: string;
21
+ /** Public gateway base URL for connect_room hints (e.g. https://mcp.trellis.computer). */
22
+ gatewayPublicUrl?: string;
23
+ }
24
+ /** MCP HTTP path for a room host (Sprites reserves `/mcp` on *.sprites.app). */
25
+ export declare function roomMcpPathForUrl(baseUrl: string): string;
26
+ /**
27
+ * List all known rooms, de-duplicated by URL (vm.json wins over project config).
28
+ */
29
+ export declare function listRegisteredRooms(opts?: RoomRegistryOptions): RegisteredRoom[];
30
+ export declare function getRegisteredRoom(nameOrUrl: string, opts?: RoomRegistryOptions): RegisteredRoom | null;
31
+ export declare function gatewayPublicUrl(opts?: RoomRegistryOptions): string;
32
+ //# sourceMappingURL=room-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-registry.d.ts","sourceRoot":"","sources":["../../src/mcp/room-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,IAAI,GAAG,SAAS,GAAG,UAAU,GAAG,KAAK,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAMD,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUzD;AAgCD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,mBAAwB,GAAG,cAAc,EAAE,CAyDpF;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,mBAAmB,GACzB,cAAc,GAAG,IAAI,CAYvB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,mBAAmB,GAAG,MAAM,CASnE"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Trellis Room MCP — graph query/CRUD tools backed by the TurtleDB kernel.
3
+ *
4
+ * Mounted at POST/GET/DELETE `/mcp` on `trellis db serve` and deployed rooms.
5
+ * Tool names align with the trellis-graph skill for agent portability.
6
+ *
7
+ * @module trellis/mcp
8
+ */
9
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
10
+ import type { AuthContext } from '../server/auth.js';
11
+ import type { PermissionRegistry } from '../server/permissions.js';
12
+ import type { SubscriptionManager } from '../server/realtime.js';
13
+ import type { TenantPool } from '../server/tenancy.js';
14
+ import { type UsageMeter } from '../server/usage-meter.js';
15
+ export interface RoomMcpContext {
16
+ pool: TenantPool;
17
+ permissions: PermissionRegistry | null;
18
+ subs: SubscriptionManager;
19
+ meter: UsageMeter | null;
20
+ auth: AuthContext;
21
+ tenantId: string | null;
22
+ /** From `X-Trellis-Lane` header when present. */
23
+ headerLane?: string | null;
24
+ /** From `X-Trellis-Tenant` header when present. */
25
+ headerTenant?: string | null;
26
+ }
27
+ export declare function createRoomMcpServer(ctx: RoomMcpContext): McpServer;
28
+ //# sourceMappingURL=room.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room.d.ts","sourceRoot":"","sources":["../../src/mcp/room.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,0BAA0B,CAAC;AAiBlC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACvC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AA4FD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,CA8elE"}
@@ -1,4 +1,4 @@
1
- import "../../chunk-KFQGP6VL.js";
1
+ import "../../chunk-2ESYSVXG.js";
2
2
 
3
3
  // src/plugins/agent-memory/ontology.ts
4
4
  var agentMemoryOntology = {
@@ -1,4 +1,4 @@
1
- import "../../chunk-KFQGP6VL.js";
1
+ import "../../chunk-2ESYSVXG.js";
2
2
 
3
3
  // src/plugins/idea-garden/api.ts
4
4
  var IdeaGarden = class {
@@ -1,4 +1,4 @@
1
- import "../../chunk-KFQGP6VL.js";
1
+ import "../../chunk-2ESYSVXG.js";
2
2
 
3
3
  // src/plugins/plan-approval/ontology.ts
4
4
  var planApprovalOntology = {
@@ -1,4 +1,4 @@
1
- import "../../chunk-KFQGP6VL.js";
1
+ import "../../chunk-2ESYSVXG.js";
2
2
 
3
3
  // src/plugins/proactive-watcher/ontology.ts
4
4
  var proactiveWatcherOntology = {
@@ -0,0 +1,30 @@
1
+ /**
2
+ * trellis-handoffs envelope — parse, validate, serialize.
3
+ */
4
+ export declare const HANDOFF_ROLES: readonly ["strategist", "designer", "architect", "executor", "reviewer", "optimizer", "synthesist", "writer", "human"];
5
+ export type HandoffRole = (typeof HANDOFF_ROLES)[number];
6
+ export declare const HANDOFF_STATUSES: readonly ["HANDOFF", "CLARIFY", "REJECT", "BLOCKED", "DECISION"];
7
+ export type HandoffStatus = (typeof HANDOFF_STATUSES)[number];
8
+ export interface HandoffEnvelope {
9
+ from: HandoffRole;
10
+ to: HandoffRole;
11
+ re: string;
12
+ status: HandoffStatus;
13
+ body?: string;
14
+ refs?: string[];
15
+ in_reply_to?: string;
16
+ }
17
+ export declare function extractYamlFooter(text: string): string | null;
18
+ export declare function parseEnvelope(text: string): HandoffEnvelope;
19
+ export declare function validateEnvelope(env: HandoffEnvelope): {
20
+ ok: true;
21
+ } | {
22
+ ok: false;
23
+ errors: string[];
24
+ };
25
+ export declare function formatEnvelope(env: HandoffEnvelope): string;
26
+ export declare function formatTurnBanner(env: HandoffEnvelope, stage?: string): string;
27
+ export declare function formatIssueDescription(env: HandoffEnvelope, stage?: string): string;
28
+ export declare function isWaitingOnHuman(env: HandoffEnvelope): boolean;
29
+ export declare function tryParseEnvelope(description?: string): HandoffEnvelope | undefined;
30
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/protocol/envelope.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,aAAa,wHAUhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,gBAAgB,kEAMnB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,EAAE,EAAE,WAAW,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA0DD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAU7D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAiC3D;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,eAAe,GACnB;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAmBhD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,CAwB3D;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,eAAe,EACpB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAIR;AAED,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,eAAe,EACpB,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAER;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAE9D;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,CAAC,EAAE,MAAM,GACnB,eAAe,GAAG,SAAS,CAO7B"}
@@ -0,0 +1,3 @@
1
+ export * from './envelope.js';
2
+ export * from './whereami.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocol/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Re-entry orientation — WAITING ON YOU / MOVED / ACTIVE.
3
+ */
4
+ import type { TrellisVcsEngine } from '../engine.js';
5
+ import type { IssueInfo } from '../vcs/issue.js';
6
+ import { type HandoffEnvelope } from './envelope.js';
7
+ export interface ReentryCheckpoint {
8
+ at: string;
9
+ issueIds: string[];
10
+ openMessageIds: string[];
11
+ }
12
+ export interface WhereamiOptions {
13
+ engine: TrellisVcsEngine;
14
+ rootPath: string;
15
+ debug?: boolean;
16
+ }
17
+ export declare function loadCheckpoint(rootPath: string): ReentryCheckpoint | null;
18
+ export declare function writeCheckpoint(rootPath: string, issueIds: string[], openMessageIds: string[]): ReentryCheckpoint;
19
+ export declare function collectProtocolChildren(engine: TrellisVcsEngine): IssueInfo[];
20
+ export declare function findWaitingOnYou(engine: TrellisVcsEngine): Array<{
21
+ issue: IssueInfo;
22
+ envelope: HandoffEnvelope;
23
+ }>;
24
+ export declare function findMovedSinceCheckpoint(engine: TrellisVcsEngine, rootPath: string): IssueInfo[];
25
+ export interface ActiveContext {
26
+ issues: IssueInfo[];
27
+ laneId?: string;
28
+ worktreePath?: string;
29
+ editRoot: string;
30
+ }
31
+ export declare function getActiveContext(engine: TrellisVcsEngine, rootPath: string): ActiveContext;
32
+ export declare function formatWhereami(opts: WhereamiOptions): string;
33
+ //# sourceMappingURL=whereami.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whereami.d.ts","sourceRoot":"","sources":["../../src/protocol/whereami.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAUD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAQzE;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE,MAAM,EAAE,GACvB,iBAAiB,CAUnB;AAOD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,EAAE,CAI7E;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,KAAK,CAAC;IAChE,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC,CAkBD;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,MAAM,GACf,SAAS,EAAE,CA2Bb;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,MAAM,GACf,aAAa,CASf;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAuD5D"}
@@ -0,0 +1,31 @@
1
+ import {
2
+ DatalogRuntime,
3
+ parseQuery,
4
+ parseRule,
5
+ parseSimple,
6
+ reverseReachabilityRules,
7
+ siblingRules,
8
+ transitiveClosureRules
9
+ } from "./chunk-X5FLTRUB.js";
10
+ import {
11
+ QueryEngine,
12
+ isLiteral,
13
+ isVariable,
14
+ literal,
15
+ variable
16
+ } from "./chunk-6CTA6MCE.js";
17
+ import "./chunk-2ESYSVXG.js";
18
+ export {
19
+ DatalogRuntime,
20
+ QueryEngine,
21
+ isLiteral,
22
+ isVariable,
23
+ literal,
24
+ parseQuery,
25
+ parseRule,
26
+ parseSimple,
27
+ reverseReachabilityRules,
28
+ siblingRules,
29
+ transitiveClosureRules,
30
+ variable
31
+ };
@@ -8,7 +8,7 @@ import {
8
8
  useSignal
9
9
  } from "../chunk-O2AV5WMN.js";
10
10
  import "../chunk-6RWGFC3N.js";
11
- import "../chunk-KFQGP6VL.js";
11
+ import "../chunk-2ESYSVXG.js";
12
12
 
13
13
  // src/react/hooks.ts
14
14
  import { useState, useEffect, useCallback, useRef } from "react";
@@ -3,7 +3,7 @@ import {
3
3
  useRoom,
4
4
  useSignal
5
5
  } from "../chunk-O2AV5WMN.js";
6
- import "../chunk-KFQGP6VL.js";
6
+ import "../chunk-2ESYSVXG.js";
7
7
  export {
8
8
  usePresence,
9
9
  useRoom,
@@ -4,19 +4,19 @@ import {
4
4
  import {
5
5
  useSignal
6
6
  } from "../chunk-O2AV5WMN.js";
7
+ import {
8
+ entityMutations
9
+ } from "../chunk-USEINYUL.js";
7
10
  import {
8
11
  liveEntities,
9
12
  liveEntity
10
13
  } from "../chunk-J3WYZO3Q.js";
11
- import "../chunk-6RWGFC3N.js";
12
- import {
13
- entityMutations
14
- } from "../chunk-USEINYUL.js";
15
14
  import "../chunk-JUEMDWLU.js";
15
+ import "../chunk-6RWGFC3N.js";
16
16
  import {
17
17
  Signal
18
18
  } from "../chunk-UBGUDMUV.js";
19
- import "../chunk-KFQGP6VL.js";
19
+ import "../chunk-2ESYSVXG.js";
20
20
 
21
21
  // src/react/schema-hooks.ts
22
22
  import { useEffect, useMemo } from "react";
@@ -12,14 +12,14 @@ import {
12
12
  createPresenceTransport,
13
13
  joinPresence,
14
14
  localStorageChannelStore
15
- } from "../chunk-KSU2GW22.js";
15
+ } from "../chunk-276W52FK.js";
16
16
  import {
17
17
  DEFAULT_MAX_CHAT,
18
18
  DEFAULT_MAX_TEXT_OPS,
19
19
  RelayPersistence
20
- } from "../chunk-GFZCJ4EH.js";
20
+ } from "../chunk-KXAISKZT.js";
21
21
  import "../chunk-UBGUDMUV.js";
22
- import "../chunk-KFQGP6VL.js";
22
+ import "../chunk-2ESYSVXG.js";
23
23
  export {
24
24
  BroadcastChannelTransport,
25
25
  DEFAULT_MAX_CHAT,
@@ -1 +1 @@
1
- {"version":3,"file":"relay-server.d.ts","sourceRoot":"","sources":["../../src/realtime/relay-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAmB,MAAM,WAAW,CAAC;AAEvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAapE,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,CAAC,MAAM,gBAAgB,CAAC,CAAC;IAC/C;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnC,0EAA0E;IAC1E,KAAK,IAAI,MAAM,EAAE,CAAC;IAClB,sEAAsE;IACtE,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAAC;IACtD,2DAA2D;IAC3D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAmBD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,UAAU,EAClB,IAAI,GAAE,oBAAyB,GAC9B,OAAO,CAAC,aAAa,CAAC,CA2IxB;AAED,MAAM,WAAW,8BAA+B,SAAQ,oBAAoB;IAC1E,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAwB,SAAQ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AE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM;IAiBnE,OAAO,CAAC,QAAQ;IAQhB,uEAAuE;IACvE,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,IAAI;IAiB1D;;;OAGG;IACH,MAAM,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,IAAI;IAMzC,wCAAwC;IACxC,KAAK,IAAI,IAAI;IAoBb,OAAO,CAAC,MAAM;IAWd,OAAO,CAAC,kBAAkB;IAQ1B,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,eAAe;IA8CvB,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,iBAAiB;CAa1B"}
@@ -214,6 +214,7 @@ var RealtimeRoom = class _RealtimeRoom {
214
214
  return false;
215
215
  }
216
216
  integrateRemote(message) {
217
+ if (message.from === this.id) return;
217
218
  switch (message.t) {
218
219
  case "hello":
219
220
  this.announcePresence();
@@ -297,6 +298,7 @@ var RealtimeRoom = class _RealtimeRoom {
297
298
  if (changed) this.recomputePresence();
298
299
  }
299
300
  recomputePresence() {
301
+ this.peers.delete(this.id);
300
302
  const self = {
301
303
  id: this.id,
302
304
  state: this.myState,
@@ -0,0 +1,12 @@
1
+ import {
2
+ attachRealtimeRelay,
3
+ createRealtimeRelay,
4
+ init_relay_server
5
+ } from "./chunk-3ISHWWMM.js";
6
+ import "./chunk-KXAISKZT.js";
7
+ import "./chunk-2ESYSVXG.js";
8
+ init_relay_server();
9
+ export {
10
+ attachRealtimeRelay,
11
+ createRealtimeRelay
12
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ attachRealtimeRelay,
3
+ createRealtimeRelay,
4
+ init_relay_server
5
+ } from "./chunk-P5KPV44Y.js";
6
+ import "./chunk-RBM7GT42.js";
7
+ import "./chunk-KFQGP6VL.js";
8
+ init_relay_server();
9
+ export {
10
+ attachRealtimeRelay,
11
+ createRealtimeRelay
12
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ attachRealtimeRelay,
3
+ createRealtimeRelay,
4
+ init_relay_server
5
+ } from "./chunk-GXA73CNC.js";
6
+ import "./chunk-KXAISKZT.js";
7
+ import "./chunk-2ESYSVXG.js";
8
+ init_relay_server();
9
+ export {
10
+ attachRealtimeRelay,
11
+ createRealtimeRelay
12
+ };
@@ -0,0 +1,224 @@
1
+ import {
2
+ TrellisVcsEngine,
3
+ init_engine
4
+ } from "./chunk-N3R74ZSR.js";
5
+ import "./chunk-NLFRRGX6.js";
6
+ import "./chunk-G3XIHPSQ.js";
7
+ import "./chunk-IJNC25UD.js";
8
+ import "./chunk-547FZFKO.js";
9
+ import "./chunk-GRWQPKYK.js";
10
+ import "./chunk-2ESYSVXG.js";
11
+
12
+ // src/federation/remote-manager.ts
13
+ init_engine();
14
+ import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
15
+ import { join, resolve } from "path";
16
+ var RemoteManager = class {
17
+ trellisPath;
18
+ remotesPath;
19
+ constructor(trellisPath) {
20
+ this.trellisPath = trellisPath;
21
+ this.remotesPath = join(trellisPath, "remotes.json");
22
+ }
23
+ /** Load remotes configuration */
24
+ loadRemotes() {
25
+ if (!existsSync(this.remotesPath)) {
26
+ return { remotes: {} };
27
+ }
28
+ try {
29
+ const content = readFileSync(this.remotesPath, "utf8");
30
+ return JSON.parse(content);
31
+ } catch (error) {
32
+ throw new Error(`Failed to load remotes config: ${error}`);
33
+ }
34
+ }
35
+ /** Save remotes configuration */
36
+ saveRemotes(config) {
37
+ try {
38
+ if (!existsSync(this.trellisPath)) {
39
+ mkdirSync(this.trellisPath, { recursive: true });
40
+ }
41
+ writeFileSync(this.remotesPath, JSON.stringify(config, null, 2), "utf8");
42
+ } catch (error) {
43
+ throw new Error(`Failed to save remotes config: ${error}`);
44
+ }
45
+ }
46
+ /** Add a new remote */
47
+ addRemote(name, path) {
48
+ const config = this.loadRemotes();
49
+ if (config.remotes[name]) {
50
+ throw new Error(`Remote '${name}' already exists`);
51
+ }
52
+ const resolvedPath = resolve(path);
53
+ if (!TrellisVcsEngine.isRepo(resolvedPath)) {
54
+ throw new Error(`Not a TrellisVCS repository: ${resolvedPath}`);
55
+ }
56
+ config.remotes[name] = {
57
+ name,
58
+ path: resolvedPath
59
+ };
60
+ this.saveRemotes(config);
61
+ }
62
+ /** Remove a remote */
63
+ removeRemote(name) {
64
+ const config = this.loadRemotes();
65
+ if (!config.remotes[name]) {
66
+ throw new Error(`Remote '${name}' not found`);
67
+ }
68
+ delete config.remotes[name];
69
+ this.saveRemotes(config);
70
+ }
71
+ /** List all remotes */
72
+ listRemotes() {
73
+ const config = this.loadRemotes();
74
+ return Object.values(config.remotes);
75
+ }
76
+ /** Pull new ops from a specific remote */
77
+ async pullRemote(remoteName, localEngine) {
78
+ const startTime = Date.now();
79
+ const config = this.loadRemotes();
80
+ const remote = config.remotes[remoteName];
81
+ if (!remote) {
82
+ throw new Error(`Remote '${remoteName}' not found`);
83
+ }
84
+ const errors = [];
85
+ let newOps = 0;
86
+ let latestOpId = remote.lastOpId || "";
87
+ try {
88
+ const remoteEngine = new TrellisVcsEngine({ rootPath: remote.path });
89
+ remoteEngine.open();
90
+ const remoteOps = remoteEngine.getOps();
91
+ if (remoteOps.length === 0) {
92
+ return {
93
+ remote: remoteName,
94
+ newOps: 0,
95
+ latestOpId: "",
96
+ durationMs: Date.now() - startTime,
97
+ errors: []
98
+ };
99
+ }
100
+ const lastOpHash = remote.lastOpId;
101
+ let startIndex = 0;
102
+ if (lastOpHash) {
103
+ startIndex = remoteOps.findIndex((op) => op.hash === lastOpHash);
104
+ if (startIndex === -1) {
105
+ startIndex = 0;
106
+ errors.push(
107
+ `Last op hash ${lastOpHash} not found in remote, pulling all ops`
108
+ );
109
+ } else {
110
+ startIndex++;
111
+ }
112
+ }
113
+ const opsToPull = remoteOps.slice(startIndex);
114
+ if (opsToPull.length > 0) {
115
+ const prefixedOps = opsToPull.map(
116
+ (op) => this.prefixOpEntities(op, remoteName)
117
+ );
118
+ for (const op of prefixedOps) {
119
+ localEngine.opLog.append(op);
120
+ newOps++;
121
+ }
122
+ latestOpId = remoteOps[remoteOps.length - 1].hash;
123
+ }
124
+ remote.lastOpId = latestOpId;
125
+ remote.pulledAt = (/* @__PURE__ */ new Date()).toISOString();
126
+ this.saveRemotes(config);
127
+ } catch (error) {
128
+ errors.push(`Failed to pull from remote: ${error}`);
129
+ }
130
+ return {
131
+ remote: remoteName,
132
+ newOps,
133
+ latestOpId,
134
+ durationMs: Date.now() - startTime,
135
+ errors
136
+ };
137
+ }
138
+ /** Pull from all configured remotes */
139
+ async pullAll(localEngine) {
140
+ const config = this.loadRemotes();
141
+ const remoteNames = Object.keys(config.remotes);
142
+ if (remoteNames.length === 0) {
143
+ return {
144
+ results: [],
145
+ totalNewOps: 0,
146
+ totalDurationMs: 0
147
+ };
148
+ }
149
+ const startTime = Date.now();
150
+ const results = [];
151
+ let totalNewOps = 0;
152
+ for (const remoteName of remoteNames) {
153
+ try {
154
+ const result = await this.pullRemote(remoteName, localEngine);
155
+ results.push(result);
156
+ totalNewOps += result.newOps;
157
+ } catch (error) {
158
+ results.push({
159
+ remote: remoteName,
160
+ newOps: 0,
161
+ latestOpId: "",
162
+ durationMs: 0,
163
+ errors: [`Failed to pull: ${error}`]
164
+ });
165
+ }
166
+ }
167
+ return {
168
+ results,
169
+ totalNewOps,
170
+ totalDurationMs: Date.now() - startTime
171
+ };
172
+ }
173
+ /** Prefix entity IDs in operations with remote name */
174
+ prefixOpEntities(op, remoteName) {
175
+ const prefixed = { ...op };
176
+ if (op.vcs) {
177
+ const vcs = { ...op.vcs };
178
+ if (vcs.issueId && !vcs.issueId.includes(":")) {
179
+ vcs.issueId = `${remoteName}:${vcs.issueId}`;
180
+ }
181
+ if (vcs.parentIssueId && !vcs.parentIssueId.includes(":")) {
182
+ vcs.parentIssueId = `${remoteName}:${vcs.parentIssueId}`;
183
+ }
184
+ if (vcs.blockedByIssueId && !vcs.blockedByIssueId.includes(":")) {
185
+ vcs.blockedByIssueId = `${remoteName}:${vcs.blockedByIssueId}`;
186
+ }
187
+ if (vcs.decisionId && !vcs.decisionId.includes(":")) {
188
+ vcs.decisionId = `${remoteName}:${vcs.decisionId}`;
189
+ }
190
+ prefixed.vcs = vcs;
191
+ }
192
+ if (op.facts) {
193
+ prefixed.facts = op.facts.map((fact) => {
194
+ if (fact.e === "entity" && fact.a === "id" && typeof fact.v === "string" && !fact.v.includes(":")) {
195
+ return { ...fact, v: `${remoteName}:${fact.v}` };
196
+ }
197
+ if (fact.e === "entity" && fact.a === "from" && typeof fact.v === "string" && !fact.v.includes(":")) {
198
+ return { ...fact, v: `${remoteName}:${fact.v}` };
199
+ }
200
+ if (fact.e === "entity" && fact.a === "to" && typeof fact.v === "string" && !fact.v.includes(":")) {
201
+ return { ...fact, v: `${remoteName}:${fact.v}` };
202
+ }
203
+ return fact;
204
+ });
205
+ }
206
+ if (op.links) {
207
+ prefixed.links = op.links.map((link) => ({
208
+ ...link,
209
+ e1: link.e1.includes(":") ? link.e1 : `${remoteName}:${link.e1}`,
210
+ e2: link.e2.includes(":") ? link.e2 : `${remoteName}:${link.e2}`
211
+ }));
212
+ }
213
+ if (!prefixed.facts) prefixed.facts = [];
214
+ prefixed.facts.push({
215
+ e: "op",
216
+ a: "remote",
217
+ v: remoteName
218
+ });
219
+ return prefixed;
220
+ }
221
+ };
222
+ export {
223
+ RemoteManager
224
+ };