@maiaos/protocol 0.1.0-canary.4 → 0.1.0-canary.41

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 (182) hide show
  1. package/dist/agent/definition.d.ts +2 -2
  2. package/dist/agent/worker-operation.d.ts +2 -0
  3. package/dist/agent/worker-operation.d.ts.map +1 -1
  4. package/dist/agents/contract.d.ts +25 -0
  5. package/dist/agents/contract.d.ts.map +1 -1
  6. package/dist/agents/contract.js +3 -1
  7. package/dist/agents/contract.js.map +1 -1
  8. package/dist/agents/effect-schema.d.ts +45 -0
  9. package/dist/agents/effect-schema.d.ts.map +1 -1
  10. package/dist/agents/effect-schema.js +38 -0
  11. package/dist/agents/effect-schema.js.map +1 -1
  12. package/dist/agents/feature.d.ts +25 -0
  13. package/dist/agents/feature.d.ts.map +1 -1
  14. package/dist/agents/feature.js +23 -0
  15. package/dist/agents/feature.js.map +1 -1
  16. package/dist/agents/index.d.ts +1 -1
  17. package/dist/agents/index.d.ts.map +1 -1
  18. package/dist/agents/index.js +1 -1
  19. package/dist/agents/index.js.map +1 -1
  20. package/dist/approval/contract.d.ts +4 -0
  21. package/dist/approval/contract.d.ts.map +1 -1
  22. package/dist/approval/feature.d.ts +6 -2
  23. package/dist/approval/feature.d.ts.map +1 -1
  24. package/dist/approval/feature.js +6 -2
  25. package/dist/approval/feature.js.map +1 -1
  26. package/dist/approval/request-effect-schema.d.ts +2 -0
  27. package/dist/approval/request-effect-schema.d.ts.map +1 -1
  28. package/dist/approval/request-effect-schema.js +2 -0
  29. package/dist/approval/request-effect-schema.js.map +1 -1
  30. package/dist/approval/result-effect-schema.d.ts +6 -0
  31. package/dist/approval/result-effect-schema.d.ts.map +1 -1
  32. package/dist/command-receipt/contract.d.ts +1 -0
  33. package/dist/command-receipt/contract.d.ts.map +1 -1
  34. package/dist/command-receipt/effect-schema.d.ts +2 -0
  35. package/dist/command-receipt/effect-schema.d.ts.map +1 -1
  36. package/dist/command-receipt/effect-schema.js +2 -0
  37. package/dist/command-receipt/effect-schema.js.map +1 -1
  38. package/dist/connection/request-effect-schema.d.ts +1 -1
  39. package/dist/connection/request-effect-schema.js +1 -1
  40. package/dist/coordinator-tool/registry.d.ts.map +1 -1
  41. package/dist/coordinator-tool/registry.js +14 -1
  42. package/dist/coordinator-tool/registry.js.map +1 -1
  43. package/dist/discovery/contract.d.ts +2 -0
  44. package/dist/discovery/contract.d.ts.map +1 -1
  45. package/dist/discovery/effect-schema.d.ts +4 -0
  46. package/dist/discovery/effect-schema.d.ts.map +1 -1
  47. package/dist/event/contract.d.ts +82 -0
  48. package/dist/event/contract.d.ts.map +1 -0
  49. package/dist/event/contract.js +13 -0
  50. package/dist/event/contract.js.map +1 -0
  51. package/dist/event/effect-schema.d.ts +3 -0
  52. package/dist/event/effect-schema.d.ts.map +1 -0
  53. package/dist/event/effect-schema.js +3 -0
  54. package/dist/event/effect-schema.js.map +1 -0
  55. package/dist/event/envelope-effect-schema.d.ts +37 -0
  56. package/dist/event/envelope-effect-schema.d.ts.map +1 -0
  57. package/dist/event/envelope-effect-schema.js +113 -0
  58. package/dist/event/envelope-effect-schema.js.map +1 -0
  59. package/dist/event/feature.d.ts +30 -0
  60. package/dist/event/feature.d.ts.map +1 -0
  61. package/dist/event/feature.js +34 -0
  62. package/dist/event/feature.js.map +1 -0
  63. package/dist/event/format.d.ts +14 -0
  64. package/dist/event/format.d.ts.map +1 -0
  65. package/dist/event/format.js +14 -0
  66. package/dist/event/format.js.map +1 -0
  67. package/dist/event/index.d.ts +6 -0
  68. package/dist/event/index.d.ts.map +1 -0
  69. package/dist/event/index.js +6 -0
  70. package/dist/event/index.js.map +1 -0
  71. package/dist/event/read-effect-schema.d.ts +105 -0
  72. package/dist/event/read-effect-schema.d.ts.map +1 -0
  73. package/dist/event/read-effect-schema.js +64 -0
  74. package/dist/event/read-effect-schema.js.map +1 -0
  75. package/dist/event/registry.d.ts +20 -0
  76. package/dist/event/registry.d.ts.map +1 -0
  77. package/dist/event/registry.js +207 -0
  78. package/dist/event/registry.js.map +1 -0
  79. package/dist/event/session-activity-effect-schema.d.ts +14 -0
  80. package/dist/event/session-activity-effect-schema.d.ts.map +1 -0
  81. package/dist/event/session-activity-effect-schema.js +21 -0
  82. package/dist/event/session-activity-effect-schema.js.map +1 -0
  83. package/dist/event/session-activity.d.ts +16 -0
  84. package/dist/event/session-activity.d.ts.map +1 -0
  85. package/dist/event/session-activity.js +11 -0
  86. package/dist/event/session-activity.js.map +1 -0
  87. package/dist/event-stream/contract.d.ts +120 -0
  88. package/dist/event-stream/contract.d.ts.map +1 -0
  89. package/dist/event-stream/contract.js +5 -0
  90. package/dist/event-stream/contract.js.map +1 -0
  91. package/dist/event-stream/effect-schema.d.ts +117 -0
  92. package/dist/event-stream/effect-schema.d.ts.map +1 -0
  93. package/dist/event-stream/effect-schema.js +90 -0
  94. package/dist/event-stream/effect-schema.js.map +1 -0
  95. package/dist/event-stream/index.d.ts +2 -0
  96. package/dist/event-stream/index.d.ts.map +1 -0
  97. package/dist/event-stream/index.js +2 -0
  98. package/dist/event-stream/index.js.map +1 -0
  99. package/dist/feature/registry.d.ts +2 -0
  100. package/dist/feature/registry.d.ts.map +1 -1
  101. package/dist/feature/registry.js +2 -0
  102. package/dist/feature/registry.js.map +1 -1
  103. package/dist/index.d.ts +5 -3
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/index.js +5 -3
  106. package/dist/index.js.map +1 -1
  107. package/dist/local-node/contract.d.ts +19 -7
  108. package/dist/local-node/contract.d.ts.map +1 -1
  109. package/dist/local-node/contract.js.map +1 -1
  110. package/dist/local-node/effect-schema.d.ts +85 -7
  111. package/dist/local-node/effect-schema.d.ts.map +1 -1
  112. package/dist/local-node/effect-schema.js +32 -6
  113. package/dist/local-node/effect-schema.js.map +1 -1
  114. package/dist/local-node/node-api/methods.d.ts +7 -4
  115. package/dist/local-node/node-api/methods.d.ts.map +1 -1
  116. package/dist/local-node/node-api/methods.js +7 -0
  117. package/dist/local-node/node-api/methods.js.map +1 -1
  118. package/dist/presentation/contract.d.ts +2 -0
  119. package/dist/presentation/contract.d.ts.map +1 -1
  120. package/dist/presentation/effect-schema.d.ts +2 -0
  121. package/dist/presentation/effect-schema.d.ts.map +1 -1
  122. package/dist/presentation/session-list-effect-schema.d.ts +2 -0
  123. package/dist/presentation/session-list-effect-schema.d.ts.map +1 -1
  124. package/dist/session/agent-permission-contract.d.ts +5 -5
  125. package/dist/session/agent-permission-effect-schema.d.ts +9 -9
  126. package/dist/session/contract.d.ts +80 -1
  127. package/dist/session/contract.d.ts.map +1 -1
  128. package/dist/session/contract.js +3 -1
  129. package/dist/session/contract.js.map +1 -1
  130. package/dist/session/effect-schema.d.ts +319 -4
  131. package/dist/session/effect-schema.d.ts.map +1 -1
  132. package/dist/session/effect-schema.js +75 -7
  133. package/dist/session/effect-schema.js.map +1 -1
  134. package/dist/session/feature.d.ts +25 -0
  135. package/dist/session/feature.d.ts.map +1 -1
  136. package/dist/session/feature.js +23 -0
  137. package/dist/session/feature.js.map +1 -1
  138. package/dist/session/index.d.ts +2 -2
  139. package/dist/session/index.d.ts.map +1 -1
  140. package/dist/session/index.js +2 -2
  141. package/dist/session/index.js.map +1 -1
  142. package/dist/session/policy.d.ts +25 -0
  143. package/dist/session/policy.d.ts.map +1 -1
  144. package/dist/session/policy.js +31 -0
  145. package/dist/session/policy.js.map +1 -1
  146. package/dist/session/stop-resume-contract.d.ts +4 -0
  147. package/dist/session/stop-resume-contract.d.ts.map +1 -1
  148. package/dist/session/worktree-effect-schema.d.ts +7 -0
  149. package/dist/session/worktree-effect-schema.d.ts.map +1 -1
  150. package/dist/session/worktree-effect-schema.js +14 -1
  151. package/dist/session/worktree-effect-schema.js.map +1 -1
  152. package/dist/session-guard/contract.d.ts +30 -1
  153. package/dist/session-guard/contract.d.ts.map +1 -1
  154. package/dist/session-guard/contract.js +10 -2
  155. package/dist/session-guard/contract.js.map +1 -1
  156. package/dist/session-guard/index.d.ts +1 -1
  157. package/dist/session-guard/index.d.ts.map +1 -1
  158. package/dist/session-guard/index.js +1 -1
  159. package/dist/session-guard/index.js.map +1 -1
  160. package/dist/session-guard/request-effect-schema.d.ts +33 -0
  161. package/dist/session-guard/request-effect-schema.d.ts.map +1 -1
  162. package/dist/session-guard/request-effect-schema.js +22 -0
  163. package/dist/session-guard/request-effect-schema.js.map +1 -1
  164. package/dist/session-guard/result-effect-schema.d.ts +26 -0
  165. package/dist/session-guard/result-effect-schema.d.ts.map +1 -1
  166. package/dist/session-guard/result-effect-schema.js +3 -1
  167. package/dist/session-guard/result-effect-schema.js.map +1 -1
  168. package/dist/terminal/contract.d.ts +1 -0
  169. package/dist/terminal/contract.d.ts.map +1 -1
  170. package/dist/terminal/effect-schema.d.ts +4 -0
  171. package/dist/terminal/effect-schema.d.ts.map +1 -1
  172. package/dist/terminal/effect-schema.js +2 -0
  173. package/dist/terminal/effect-schema.js.map +1 -1
  174. package/dist/voice/contract.d.ts +6 -6
  175. package/dist/voice/effect-schema.d.ts +9 -9
  176. package/dist/voice/effect-schema.d.ts.map +1 -1
  177. package/dist/voice/effect-schema.js +3 -1
  178. package/dist/voice/effect-schema.js.map +1 -1
  179. package/dist/voice/feature.d.ts +2 -2
  180. package/dist/voice/orchestrator-system-prompt.d.ts +2 -2
  181. package/dist/voice/orchestrator-system-prompt.js +2 -2
  182. package/package.json +1 -1
@@ -0,0 +1,30 @@
1
+ import { type MaiaOperationsFeature } from "../feature/descriptor/index.js";
2
+ /** The Node's event journal, read by cursor. */
3
+ export declare const EVENT_FEATURE_OPERATIONS: readonly [{
4
+ readonly method: "events.read";
5
+ readonly nodeHandler: "events";
6
+ readonly policy: {
7
+ readonly confirmation: "none";
8
+ readonly effectClass: "none";
9
+ readonly idempotency: "none";
10
+ readonly ownReceipt: false;
11
+ readonly receipt: "none";
12
+ readonly releaseQualified: false;
13
+ readonly revisionGuard: false;
14
+ readonly risk: "read";
15
+ };
16
+ readonly primitives: readonly ["read"];
17
+ readonly projections: {
18
+ readonly cli: false;
19
+ readonly coordinator: false;
20
+ readonly desktop: false;
21
+ readonly mobile: false;
22
+ readonly voice: false;
23
+ };
24
+ readonly sdk: {
25
+ readonly client: "local-node";
26
+ readonly operation: "call";
27
+ };
28
+ }];
29
+ export declare const EVENT_FEATURE: MaiaOperationsFeature<"events", typeof EVENT_FEATURE_OPERATIONS>;
30
+ //# sourceMappingURL=feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../src/event/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,gCAAgC,CAAC;AAExC,gDAAgD;AAChD,eAAO,MAAM,wBAAwB;qBAEzB,aAAa;0BACR,QAAQ;;iBAEnB,YAAY,EAAE,MAAM;iBACpB,WAAW,EAAE,MAAM;iBACnB,WAAW,EAAE,MAAM;iBACnB,UAAU;iBACV,OAAO,EAAE,MAAM;iBACf,gBAAgB;iBAChB,aAAa;iBACb,IAAI,EAAE,MAAM;;;;iBAIZ,GAAG;iBACH,WAAW;iBACX,OAAO;iBACP,MAAM;iBACN,KAAK;;;iBAEA,MAAM,EAAE,YAAY;iBAAE,SAAS,EAAE,MAAM;;EAEY,CAAC;AAE/D,eAAO,MAAM,aAAa,EAAE,qBAAqB,CAC/C,QAAQ,EACR,OAAO,wBAAwB,CAM/B,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { defineMaiaFeature, } from "../feature/descriptor/index.js";
2
+ /** The Node's event journal, read by cursor. */
3
+ export const EVENT_FEATURE_OPERATIONS = [
4
+ {
5
+ method: "events.read",
6
+ nodeHandler: "events",
7
+ policy: {
8
+ confirmation: "none",
9
+ effectClass: "none",
10
+ idempotency: "none",
11
+ ownReceipt: false,
12
+ receipt: "none",
13
+ releaseQualified: false,
14
+ revisionGuard: false,
15
+ risk: "read",
16
+ },
17
+ primitives: ["read"],
18
+ projections: {
19
+ cli: false,
20
+ coordinator: false,
21
+ desktop: false,
22
+ mobile: false,
23
+ voice: false,
24
+ },
25
+ sdk: { client: "local-node", operation: "call" },
26
+ },
27
+ ];
28
+ export const EVENT_FEATURE = defineMaiaFeature({
29
+ contributions: { routines: [], rules: [], schedules: [], skills: [] },
30
+ id: "events",
31
+ operations: EVENT_FEATURE_OPERATIONS,
32
+ schemaVersion: "maia.feature/events/v1",
33
+ });
34
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.js","sourceRoot":"","sources":["../../src/event/feature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,GAGlB,MAAM,gCAAgC,CAAC;AAExC,gDAAgD;AAChD,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC;QACE,MAAM,EAAE,aAAa;QACrB,WAAW,EAAE,QAAQ;QACrB,MAAM,EAAE;YACN,YAAY,EAAE,MAAM;YACpB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,MAAM;YACnB,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE,MAAM;YACf,gBAAgB,EAAE,KAAK;YACvB,aAAa,EAAE,KAAK;YACpB,IAAI,EAAE,MAAM;SACb;QACD,UAAU,EAAE,CAAC,MAAM,CAAC;QACpB,WAAW,EAAE;YACX,GAAG,EAAE,KAAK;YACV,WAAW,EAAE,KAAK;YAClB,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,KAAK;SACb;QACD,GAAG,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE;KACjD;CAC2D,CAAC;AAE/D,MAAM,CAAC,MAAM,aAAa,GAGtB,iBAAiB,CAAC;IACpB,aAAa,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;IACrE,EAAE,EAAE,QAAQ;IACZ,UAAU,EAAE,wBAAwB;IACpC,aAAa,EAAE,wBAAwB;CACxC,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const EVENT_SCHEMA_VERSION = "maia.event.v2";
2
+ /** The journal's payload cap; a kind may register a lower limit. */
3
+ export declare const MAX_EVENT_PAYLOAD_BYTES: number;
4
+ export declare const EVENT_CURSOR_PREFIX = "ev1.";
5
+ export declare const FEDERATED_EVENT_CURSOR_PREFIX = "evf1.";
6
+ /** `<source>.<noun>[.<qualifier>…]`: 2 to 5 segments, the first is the source. */
7
+ export declare const EVENT_KIND_PATTERN: RegExp;
8
+ /** The most events one page returns. */
9
+ export declare const MAX_EVENTS_READ_LIMIT = 100;
10
+ /** The most serialized bytes one page returns, under the 256 KiB frame cap. */
11
+ export declare const MAX_EVENTS_READ_PAGE_BYTES: number;
12
+ /** The most kinds one filter names. */
13
+ export declare const MAX_EVENTS_READ_KINDS = 16;
14
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/event/format.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AACpD,oEAAoE;AACpE,eAAO,MAAM,uBAAuB,QAAY,CAAC;AACjD,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAC1C,eAAO,MAAM,6BAA6B,UAAU,CAAC;AAErD,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,QACmB,CAAC;AAEnD,wCAAwC;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,+EAA+E;AAC/E,eAAO,MAAM,0BAA0B,QAAa,CAAC;AACrD,uCAAuC;AACvC,eAAO,MAAM,qBAAqB,KAAK,CAAC"}
@@ -0,0 +1,14 @@
1
+ export const EVENT_SCHEMA_VERSION = "maia.event.v2";
2
+ /** The journal's payload cap; a kind may register a lower limit. */
3
+ export const MAX_EVENT_PAYLOAD_BYTES = 64 * 1024;
4
+ export const EVENT_CURSOR_PREFIX = "ev1.";
5
+ export const FEDERATED_EVENT_CURSOR_PREFIX = "evf1.";
6
+ /** `<source>.<noun>[.<qualifier>…]`: 2 to 5 segments, the first is the source. */
7
+ export const EVENT_KIND_PATTERN = /^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*){1,4}$/u;
8
+ /** The most events one page returns. */
9
+ export const MAX_EVENTS_READ_LIMIT = 100;
10
+ /** The most serialized bytes one page returns, under the 256 KiB frame cap. */
11
+ export const MAX_EVENTS_READ_PAGE_BYTES = 192 * 1024;
12
+ /** The most kinds one filter names. */
13
+ export const MAX_EVENTS_READ_KINDS = 16;
14
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/event/format.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AACpD,oEAAoE;AACpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAC;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAC1C,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC;AAErD,kFAAkF;AAClF,MAAM,CAAC,MAAM,kBAAkB,GAC7B,gDAAgD,CAAC;AAEnD,wCAAwC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACzC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,GAAG,IAAI,CAAC;AACrD,uCAAuC;AACvC,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { EVENT_CURSOR_PREFIX, EVENT_KIND_PATTERN, EVENT_SCHEMA_VERSION, type EventCursorClaims, eventCursorClaimsSchema, eventCursorSchema, type EventEnvelope, eventEnvelopeSchema, eventIdSchema, eventKindSchema, type EventsReadParameters, eventsReadParametersSchema, type EventsReadResult, eventsReadResultSchema, FEDERATED_EVENT_CURSOR_PREFIX, federatedEventCursorSchema, MAX_EVENT_PAYLOAD_BYTES, } from "./contract.js";
2
+ export { EVENT_FEATURE } from "./feature.js";
3
+ export { MAX_EVENTS_READ_KINDS, MAX_EVENTS_READ_LIMIT, MAX_EVENTS_READ_PAGE_BYTES, } from "./format.js";
4
+ export { EVENT_KIND_REGISTRY, EVENT_SOURCES, type EventExposure, type EventKindRegistration, findEventKind, } from "./registry.js";
5
+ export { SESSION_ACTIVITY_SUBJECT_TYPE, type SessionActivity, } from "./session-activity.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/event/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,KAAK,aAAa,EAClB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,KAAK,oBAAoB,EACzB,0BAA0B,EAC1B,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,6BAA6B,EAC7B,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { EVENT_CURSOR_PREFIX, EVENT_KIND_PATTERN, EVENT_SCHEMA_VERSION, eventCursorClaimsSchema, eventCursorSchema, eventEnvelopeSchema, eventIdSchema, eventKindSchema, eventsReadParametersSchema, eventsReadResultSchema, FEDERATED_EVENT_CURSOR_PREFIX, federatedEventCursorSchema, MAX_EVENT_PAYLOAD_BYTES, } from "./contract.js";
2
+ export { EVENT_FEATURE } from "./feature.js";
3
+ export { MAX_EVENTS_READ_KINDS, MAX_EVENTS_READ_LIMIT, MAX_EVENTS_READ_PAGE_BYTES, } from "./format.js";
4
+ export { EVENT_KIND_REGISTRY, EVENT_SOURCES, findEventKind, } from "./registry.js";
5
+ export { SESSION_ACTIVITY_SUBJECT_TYPE, } from "./session-activity.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/event/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EAEpB,uBAAuB,EACvB,iBAAiB,EAEjB,mBAAmB,EACnB,aAAa,EACb,eAAe,EAEf,0BAA0B,EAE1B,sBAAsB,EACtB,6BAA6B,EAC7B,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,aAAa,EAGb,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,6BAA6B,GAE9B,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,105 @@
1
+ import * as Schema from "effect/Schema";
2
+ export declare const eventsReadParametersEffectSchema: Schema.Struct<{
3
+ readonly kinds: Schema.optional<Schema.$Array<Schema.String>>;
4
+ readonly limit: Schema.optional<Schema.Int>;
5
+ readonly since: Schema.optional<Schema.Union<readonly [Schema.String, Schema.String, Schema.String]>>;
6
+ readonly subject: Schema.optional<Schema.Struct<{
7
+ readonly id: Schema.String;
8
+ readonly type: Schema.String;
9
+ }>>;
10
+ }>;
11
+ /**
12
+ * One page of events after the cursor, in order. `next` resumes after the
13
+ * last event returned, or after the last one examined when a filter matched
14
+ * nothing.
15
+ */
16
+ export declare const eventsReadPageEffectSchema: Schema.Struct<{
17
+ readonly head: Schema.String;
18
+ readonly method: Schema.Literal<"events.read">;
19
+ readonly oldest: Schema.String;
20
+ readonly events: Schema.$Array<Schema.Struct<{
21
+ readonly command: Schema.optional<Schema.String>;
22
+ readonly id: Schema.String;
23
+ readonly kind: Schema.String;
24
+ readonly node: Schema.String;
25
+ readonly payload: Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.Unknown, never, never>;
26
+ readonly schemaVersion: Schema.Literal<"maia.event.v2">;
27
+ readonly seq: Schema.String;
28
+ readonly source: Schema.String;
29
+ readonly subject: Schema.Struct<{
30
+ readonly id: Schema.String;
31
+ readonly seq: Schema.String;
32
+ readonly type: Schema.String;
33
+ }>;
34
+ readonly ts: Schema.String;
35
+ readonly v: Schema.Int;
36
+ }>>;
37
+ readonly next: Schema.String;
38
+ readonly status: Schema.Literal<"ok">;
39
+ }>;
40
+ /**
41
+ * The cursor no longer fits the journal (retention ran, the journal was
42
+ * restored, the position is ahead of the journal, or the cursor expired).
43
+ * `next` is a cursor placed before `oldest`: resuming from it skips no event that
44
+ * remains.
45
+ */
46
+ export declare const eventsReadResetEffectSchema: Schema.Struct<{
47
+ readonly head: Schema.String;
48
+ readonly method: Schema.Literal<"events.read">;
49
+ readonly oldest: Schema.String;
50
+ readonly next: Schema.String;
51
+ readonly reason: Schema.Literals<readonly ["cursor_expired", "epoch_changed", "position_ahead", "position_pruned"]>;
52
+ readonly status: Schema.Literal<"cursor_reset_required">;
53
+ }>;
54
+ /** The cursor is not one this Node issued for this filter. */
55
+ export declare const eventsReadInvalidCursorEffectSchema: Schema.Struct<{
56
+ readonly method: Schema.Literal<"events.read">;
57
+ readonly status: Schema.Literal<"invalid_cursor">;
58
+ }>;
59
+ export declare const eventsReadResultEffectSchema: Schema.Union<readonly [Schema.Struct<{
60
+ readonly head: Schema.String;
61
+ readonly method: Schema.Literal<"events.read">;
62
+ readonly oldest: Schema.String;
63
+ readonly events: Schema.$Array<Schema.Struct<{
64
+ readonly command: Schema.optional<Schema.String>;
65
+ readonly id: Schema.String;
66
+ readonly kind: Schema.String;
67
+ readonly node: Schema.String;
68
+ readonly payload: Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.Unknown, never, never>;
69
+ readonly schemaVersion: Schema.Literal<"maia.event.v2">;
70
+ readonly seq: Schema.String;
71
+ readonly source: Schema.String;
72
+ readonly subject: Schema.Struct<{
73
+ readonly id: Schema.String;
74
+ readonly seq: Schema.String;
75
+ readonly type: Schema.String;
76
+ }>;
77
+ readonly ts: Schema.String;
78
+ readonly v: Schema.Int;
79
+ }>>;
80
+ readonly next: Schema.String;
81
+ readonly status: Schema.Literal<"ok">;
82
+ }>, Schema.Struct<{
83
+ readonly head: Schema.String;
84
+ readonly method: Schema.Literal<"events.read">;
85
+ readonly oldest: Schema.String;
86
+ readonly next: Schema.String;
87
+ readonly reason: Schema.Literals<readonly ["cursor_expired", "epoch_changed", "position_ahead", "position_pruned"]>;
88
+ readonly status: Schema.Literal<"cursor_reset_required">;
89
+ }>, Schema.Struct<{
90
+ readonly method: Schema.Literal<"events.read">;
91
+ readonly status: Schema.Literal<"invalid_cursor">;
92
+ }>]>;
93
+ export declare const eventsRequestEffectSchema: Schema.Struct<{
94
+ readonly method: Schema.Literal<"events.read">;
95
+ readonly parameters: Schema.Struct<{
96
+ readonly kinds: Schema.optional<Schema.$Array<Schema.String>>;
97
+ readonly limit: Schema.optional<Schema.Int>;
98
+ readonly since: Schema.optional<Schema.Union<readonly [Schema.String, Schema.String, Schema.String]>>;
99
+ readonly subject: Schema.optional<Schema.Struct<{
100
+ readonly id: Schema.String;
101
+ readonly type: Schema.String;
102
+ }>>;
103
+ }>;
104
+ }>;
105
+ //# sourceMappingURL=read-effect-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-effect-schema.d.ts","sourceRoot":"","sources":["../../src/event/read-effect-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAqBxC,eAAO,MAAM,gCAAgC;;;;;;;;EAc3C,CAAC;AAQH;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;EAKrC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B;;;;;;;EAUtC,CAAC;AAEH,8DAA8D;AAC9D,eAAO,MAAM,mCAAmC;;;EAG9C,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIvC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;EAGpC,CAAC"}
@@ -0,0 +1,64 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { protocolIdentifierEffectSchema as id } from "../envelope/effect-schema.js";
3
+ import { eventCursorEffectSchema, eventCursorSequenceEffectSchema, eventEnvelopeEffectSchema, eventIdEffectSchema, eventKindEffectSchema, eventSequenceEffectSchema, } from "./envelope-effect-schema.js";
4
+ import { MAX_EVENTS_READ_KINDS, MAX_EVENTS_READ_LIMIT } from "./format.js";
5
+ /** Where to start: a cursor, an event ID or a sequence. Absent means the oldest event kept. */
6
+ const eventsSinceEffectSchema = Schema.Union([
7
+ eventCursorEffectSchema,
8
+ eventIdEffectSchema,
9
+ eventSequenceEffectSchema,
10
+ ]);
11
+ export const eventsReadParametersEffectSchema = Schema.Struct({
12
+ kinds: Schema.optional(Schema.Array(eventKindEffectSchema).check(Schema.isMinLength(1), Schema.isMaxLength(MAX_EVENTS_READ_KINDS))),
13
+ limit: Schema.optional(Schema.Int.check(Schema.isBetween({ maximum: MAX_EVENTS_READ_LIMIT, minimum: 1 }))),
14
+ since: Schema.optional(eventsSinceEffectSchema),
15
+ subject: Schema.optional(Schema.Struct({ id, type: id })),
16
+ });
17
+ const position = {
18
+ head: eventCursorSequenceEffectSchema,
19
+ method: Schema.Literal("events.read"),
20
+ oldest: eventCursorSequenceEffectSchema,
21
+ };
22
+ /**
23
+ * One page of events after the cursor, in order. `next` resumes after the
24
+ * last event returned, or after the last one examined when a filter matched
25
+ * nothing.
26
+ */
27
+ export const eventsReadPageEffectSchema = Schema.Struct({
28
+ ...position,
29
+ events: Schema.Array(eventEnvelopeEffectSchema),
30
+ next: eventCursorEffectSchema,
31
+ status: Schema.Literal("ok"),
32
+ });
33
+ /**
34
+ * The cursor no longer fits the journal (retention ran, the journal was
35
+ * restored, the position is ahead of the journal, or the cursor expired).
36
+ * `next` is a cursor placed before `oldest`: resuming from it skips no event that
37
+ * remains.
38
+ */
39
+ export const eventsReadResetEffectSchema = Schema.Struct({
40
+ ...position,
41
+ next: eventCursorEffectSchema,
42
+ reason: Schema.Literals([
43
+ "cursor_expired",
44
+ "epoch_changed",
45
+ "position_ahead",
46
+ "position_pruned",
47
+ ]),
48
+ status: Schema.Literal("cursor_reset_required"),
49
+ });
50
+ /** The cursor is not one this Node issued for this filter. */
51
+ export const eventsReadInvalidCursorEffectSchema = Schema.Struct({
52
+ method: Schema.Literal("events.read"),
53
+ status: Schema.Literal("invalid_cursor"),
54
+ });
55
+ export const eventsReadResultEffectSchema = Schema.Union([
56
+ eventsReadPageEffectSchema,
57
+ eventsReadResetEffectSchema,
58
+ eventsReadInvalidCursorEffectSchema,
59
+ ]);
60
+ export const eventsRequestEffectSchema = Schema.Struct({
61
+ method: Schema.Literal("events.read"),
62
+ parameters: eventsReadParametersEffectSchema,
63
+ });
64
+ //# sourceMappingURL=read-effect-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-effect-schema.js","sourceRoot":"","sources":["../../src/event/read-effect-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,8BAA8B,IAAI,EAAE,EAAE,MAAM,8BAA8B,CAAC;AAEpF,OAAO,EACL,uBAAuB,EACvB,+BAA+B,EAC/B,yBAAyB,EACzB,mBAAmB,EACnB,qBAA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AAC,IAAI,CAAC;CAC7B,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,CAAC;IACvD,GAAG,QAAQ;IACX,IAAI,EAAE,uBAAuB;IAC7B,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC;QACtB,gBAAgB;QAChB,eAAe;QACf,gBAAgB;QAChB,iBAAiB;KAClB,CAAC;IACF,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC;CAChD,CAAC,CAAC;AAEH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,mCAAmC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/D,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,KAAK,CAAC;IACvD,0BAA0B;IAC1B,2BAA2B;IAC3B,mCAAmC;CACpC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC;IACrD,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC;IACrC,UAAU,EAAE,gCAAgC;CAC7C,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { RuntimeSchema } from "../runtime-schema/index.js";
2
+ /** Who may read a kind through the event reads: a `public` kind streams, an `internal` one does not. */
3
+ export type EventExposure = "internal" | "public";
4
+ export type EventKindRegistration = {
5
+ readonly exposure: EventExposure;
6
+ readonly kind: string;
7
+ /** The largest payload, in UTF-8 bytes, an append of this kind may carry. */
8
+ readonly maxPayloadBytes: number;
9
+ /** The schema an append of this kind has to match; absent means any JSON object. */
10
+ readonly payloadSchema?: RuntimeSchema<unknown>;
11
+ /** The component that produces the kind: the first segment of `kind`. */
12
+ readonly source: string;
13
+ /** The payload version an append of this kind must carry (`v` on the envelope). */
14
+ readonly version: number;
15
+ };
16
+ export declare const EVENT_KIND_REGISTRY: readonly EventKindRegistration[];
17
+ export declare const EVENT_SOURCES: readonly string[];
18
+ /** The registration of a kind, or undefined for an unregistered one. */
19
+ export declare const findEventKind: (kind: string) => EventKindRegistration | undefined;
20
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/event/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAKhE,wGAAwG;AACxG,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,QAAQ,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,oFAAoF;IACpF,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAChD,yEAAyE;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mFAAmF;IACnF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AA+MF,eAAO,MAAM,mBAAmB,EAAE,SAAS,qBAAqB,EAG7D,CAAC;AAEJ,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAE1C,CAAC;AAIF,wEAAwE;AACxE,eAAO,MAAM,aAAa,SAClB,MAAM,KACX,qBAAqB,GAAG,SAA6B,CAAC"}
@@ -0,0 +1,207 @@
1
+ import { MAX_EVENT_PAYLOAD_BYTES } from "./format.js";
2
+ import { sessionActivityChangedSchema } from "./session-activity.js";
3
+ /**
4
+ * Every kind the Node writes to `domain_events` today, by source, written
5
+ * without the source prefix. Each is `internal` until a slice that streams it
6
+ * marks it `public`, and keeps the journal's payload cap until that slice
7
+ * registers a tighter schema. A producer registers its new kind here.
8
+ */
9
+ const EXISTING_KINDS = [
10
+ ["agent", ["created", "disabled", "revised"]],
11
+ ["approval", ["requested", "resolved"]],
12
+ [
13
+ "connection",
14
+ [
15
+ "created",
16
+ "state.changed",
17
+ "capacity.changed",
18
+ "limit.recorded",
19
+ "login.started",
20
+ "grant.changed",
21
+ "pool.changed",
22
+ ],
23
+ ],
24
+ ["container", ["created", "renamed"]],
25
+ ["delivery", ["acknowledged", "acknowledgement-receipt"]],
26
+ ["dispatch", ["settled"]],
27
+ [
28
+ "execution",
29
+ [
30
+ "placement.created",
31
+ "relocation.prepared",
32
+ "relocation.reconciled",
33
+ "worktree.checkpoint.prepared",
34
+ "worktree.checkpoint.running",
35
+ "worktree.checkpoint.succeeded",
36
+ "worktree.checkpoint.failed",
37
+ "worktree.checkpoint.outcome_unknown",
38
+ "command.prepared",
39
+ "command.running",
40
+ "command.succeeded",
41
+ "command.failed",
42
+ "command.outcome_unknown",
43
+ "file.read.prepared",
44
+ "file.read.running",
45
+ "file.read.succeeded",
46
+ "file.read.failed",
47
+ "file.read.outcome_unknown",
48
+ "worktree.reconciled",
49
+ "worktree.create.prepared",
50
+ "worktree.create.dispatching",
51
+ "worktree.create.succeeded",
52
+ "worktree.create.failed",
53
+ "worktree.create.cleanup_unknown",
54
+ "worktree.create.outcome_unknown",
55
+ "worktree.import.prepared",
56
+ "worktree.import.dispatching",
57
+ "worktree.import.succeeded",
58
+ "worktree.import.failed",
59
+ "worktree.import.cleanup_unknown",
60
+ "worktree.import.outcome_unknown",
61
+ "worktree.remove.prepared",
62
+ "worktree.remove.dispatching",
63
+ "worktree.remove.succeeded",
64
+ "worktree.remove.failed",
65
+ "worktree.remove.cleanup_unknown",
66
+ "worktree.remove.outcome_unknown",
67
+ ],
68
+ ],
69
+ ["hold", ["placed", "released"]],
70
+ [
71
+ "integration",
72
+ [
73
+ "authorization.applied",
74
+ "authorization.revoking",
75
+ "authorization.update-policy.set",
76
+ ],
77
+ ],
78
+ ["interaction", ["created", "answered", "cancelled"]],
79
+ [
80
+ "port",
81
+ [
82
+ "lease.acquired",
83
+ "lease.renewed",
84
+ "lease.released",
85
+ "lease.release.repeated",
86
+ "lease.expired",
87
+ ],
88
+ ],
89
+ [
90
+ "project",
91
+ ["created", "registered", "renamed", "guard.changed", "context.recorded"],
92
+ ],
93
+ ["question", ["opened", "answered", "cancelled"]],
94
+ [
95
+ "remote_node",
96
+ [
97
+ "registered",
98
+ "installing",
99
+ "ready",
100
+ "install_failed",
101
+ "removing",
102
+ "removed",
103
+ "remove_failed",
104
+ ],
105
+ ],
106
+ ["routine", ["created", "paused", "resumed", "disabled", "fire.recorded"]],
107
+ [
108
+ "run",
109
+ [
110
+ "created",
111
+ "ledger.created",
112
+ "ledger.task.dispatched",
113
+ "ledger.task.settled",
114
+ ],
115
+ ],
116
+ [
117
+ "session",
118
+ [
119
+ "created",
120
+ "spawned",
121
+ "renamed",
122
+ "stopped",
123
+ "archived",
124
+ "start.requested",
125
+ "resume.requested",
126
+ "runtime.started",
127
+ "runtime.resumed",
128
+ "runtime.failed",
129
+ "runtime.recovery.requested",
130
+ "message.sent",
131
+ "inbox.acknowledged",
132
+ "worktree.removed",
133
+ "agent-permission.granted",
134
+ "activity.changed",
135
+ ],
136
+ ],
137
+ ["team-workspace", ["bootstrapped"]],
138
+ [
139
+ "terminal",
140
+ [
141
+ "create.rejected",
142
+ "mutation.outcome-unknown",
143
+ "create.recorded",
144
+ "controller.request.recorded",
145
+ "controller.acquire.recorded",
146
+ "controller.release.recorded",
147
+ "input.write.recorded",
148
+ "session.resize.recorded",
149
+ "session.signal.recorded",
150
+ "session.close.recorded",
151
+ ],
152
+ ],
153
+ [
154
+ "turn",
155
+ [
156
+ "queued",
157
+ "dispatching",
158
+ "started",
159
+ "completed",
160
+ "failed",
161
+ "cancelled",
162
+ "interrupted",
163
+ "interrupt.prepared",
164
+ "interrupt.dispatching",
165
+ "interrupt.acknowledged",
166
+ "interrupt.outcome-unknown",
167
+ "interrupt.settled",
168
+ ],
169
+ ],
170
+ ["voice", ["pi.relay.acknowledged"]],
171
+ [
172
+ "workspace",
173
+ [
174
+ "selected",
175
+ "execution.configured",
176
+ "membership.attached",
177
+ "repository.attached",
178
+ ],
179
+ ],
180
+ ];
181
+ const ACTIVITY_PAYLOAD_BYTES = 256;
182
+ /** A kind's registration: the journal's defaults, tightened for a kind with its own schema. */
183
+ const registrationOf = (source, name) => {
184
+ const kind = `${source}.${name}`;
185
+ return kind === "session.activity.changed"
186
+ ? {
187
+ exposure: "internal",
188
+ kind,
189
+ maxPayloadBytes: ACTIVITY_PAYLOAD_BYTES,
190
+ payloadSchema: sessionActivityChangedSchema,
191
+ source,
192
+ version: 1,
193
+ }
194
+ : {
195
+ exposure: "internal",
196
+ kind,
197
+ maxPayloadBytes: MAX_EVENT_PAYLOAD_BYTES,
198
+ source,
199
+ version: 1,
200
+ };
201
+ };
202
+ export const EVENT_KIND_REGISTRY = EXISTING_KINDS.flatMap(([source, names]) => names.map((name) => registrationOf(source, name)));
203
+ export const EVENT_SOURCES = EXISTING_KINDS.map(([source]) => source);
204
+ const byKind = new Map(EVENT_KIND_REGISTRY.map((entry) => [entry.kind, entry]));
205
+ /** The registration of a kind, or undefined for an unregistered one. */
206
+ export const findEventKind = (kind) => byKind.get(kind);
207
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/event/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAkBrE;;;;;GAKG;AACH,MAAM,cAAc,GAAsD;IACxE,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IAC7C,CAAC,UAAU,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACvC;QACE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AAEnC,+FAA+F;AAC/F,MAAM,cAAc,GAAG,CACrB,MAAc,EACd,IAAY,EACW,EAAE;IACzB,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC;IACjC,OAAO,IAAI,KAAK,0BAA0B;QACxC,CAAC,CAAC;YACE,QAAQ,EAAE,UAAU;YACpB,IAAI;YACJ,eAAe,EAAE,sBAAsB;YACvC,aAAa,EAAE,4BAA4B;YAC3C,MAAM;YACN,OAAO,EAAE,CAAC;SACX;QACH,CAAC,CAAC;YACE,QAAQ,EAAE,UAAU;YACpB,IAAI;YACJ,eAAe,EAAE,uBAAuB;YACxC,MAAM;YACN,OAAO,EAAE,CAAC;SACX,CAAC;AACR,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAC9B,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,CACzC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAClD,CAAC;AAEJ,MAAM,CAAC,MAAM,aAAa,GAAsB,cAAc,CAAC,GAAG,CAChE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CACrB,CAAC;AAEF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAEhF,wEAAwE;AACxE,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,IAAY,EACuB,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import * as Schema from "effect/Schema";
2
+ /** What a Session is doing, as a person or an agent would say it. */
3
+ export declare const sessionActivityEffectSchema: Schema.Literals<readonly ["stopped", "waiting_approval", "working", "idle"]>;
4
+ /**
5
+ * The payload of `session.activity.changed`. `approvalId` names the front
6
+ * pending approval and is present when `to` is `waiting_approval` and absent otherwise.
7
+ * `from` is null for a Session's first announcement.
8
+ */
9
+ export declare const sessionActivityChangedEffectSchema: Schema.Struct<{
10
+ readonly approvalId: Schema.optional<Schema.String>;
11
+ readonly from: Schema.NullOr<Schema.Literals<readonly ["stopped", "waiting_approval", "working", "idle"]>>;
12
+ readonly to: Schema.Literals<readonly ["stopped", "waiting_approval", "working", "idle"]>;
13
+ }>;
14
+ //# sourceMappingURL=session-activity-effect-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-activity-effect-schema.d.ts","sourceRoot":"","sources":["../../src/event/session-activity-effect-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,qEAAqE;AACrE,eAAO,MAAM,2BAA2B,8EAKtC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,kCAAkC;;;;EAc9C,CAAC"}
@@ -0,0 +1,21 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { protocolIdentifierEffectSchema as id } from "../envelope/effect-schema.js";
3
+ /** What a Session is doing, as a person or an agent would say it. */
4
+ export const sessionActivityEffectSchema = Schema.Literals([
5
+ "stopped",
6
+ "waiting_approval",
7
+ "working",
8
+ "idle",
9
+ ]);
10
+ /**
11
+ * The payload of `session.activity.changed`. `approvalId` names the front
12
+ * pending approval and is present when `to` is `waiting_approval` and absent otherwise.
13
+ * `from` is null for a Session's first announcement.
14
+ */
15
+ export const sessionActivityChangedEffectSchema = Schema.Struct({
16
+ approvalId: Schema.optional(id),
17
+ from: Schema.NullOr(sessionActivityEffectSchema),
18
+ to: sessionActivityEffectSchema,
19
+ }).check(Schema.makeFilter((payload) => (payload.to === "waiting_approval") ===
20
+ (payload.approvalId !== undefined)), Schema.makeFilter((payload) => payload.from !== payload.to || payload.to === "waiting_approval"));
21
+ //# sourceMappingURL=session-activity-effect-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-activity-effect-schema.js","sourceRoot":"","sources":["../../src/event/session-activity-effect-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,8BAA8B,IAAI,EAAE,EAAE,MAAM,8BAA8B,CAAC;AAEpF,qEAAqE;AACrE,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,QAAQ,CAAC;IACzD,SAAS;IACT,kBAAkB;IAClB,SAAS;IACT,MAAM;CACP,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9D,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,2BAA2B,CAAC;IAChD,EAAE,EAAE,2BAA2B;CAChC,CAAC,CAAC,KAAK,CACN,MAAM,CAAC,UAAU,CACf,CAAC,OAAO,EAAE,EAAE,CACV,CAAC,OAAO,CAAC,EAAE,KAAK,kBAAkB,CAAC;IACnC,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CACrC,EACD,MAAM,CAAC,UAAU,CACf,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,KAAK,kBAAkB,CACnE,CACF,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { InferRuntimeSchema } from "../runtime-schema/index.js";
2
+ /**
3
+ * The subject kind of `session.activity.changed`: the subject ID is the
4
+ * Session ID, and the subject's sequence counts activity events alone. Never
5
+ * compare it with a Session's revision.
6
+ */
7
+ export declare const SESSION_ACTIVITY_SUBJECT_TYPE = "session-activity";
8
+ export declare const sessionActivitySchema: import("../runtime-schema/runtime-schema.js").RuntimeSchema<"idle" | "stopped" | "waiting_approval" | "working">;
9
+ export type SessionActivity = InferRuntimeSchema<typeof sessionActivitySchema>;
10
+ export declare const sessionActivityChangedSchema: import("../runtime-schema/runtime-schema.js").RuntimeSchema<{
11
+ readonly approvalId?: string | undefined;
12
+ readonly from: "idle" | "stopped" | "waiting_approval" | "working" | null;
13
+ readonly to: "idle" | "stopped" | "waiting_approval" | "working";
14
+ }>;
15
+ export type SessionActivityChanged = InferRuntimeSchema<typeof sessionActivityChangedSchema>;
16
+ //# sourceMappingURL=session-activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-activity.d.ts","sourceRoot":"","sources":["../../src/event/session-activity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAOrE;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,qBAAqB,CAAC;AAEhE,eAAO,MAAM,qBAAqB,kHAEjC,CAAC;AACF,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE/E,eAAO,MAAM,4BAA4B;;;;EAExC,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CACrD,OAAO,4BAA4B,CACpC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { makeEffectRuntimeSchema } from "../runtime-schema/effect-schema.js";
2
+ import { sessionActivityChangedEffectSchema, sessionActivityEffectSchema, } from "./session-activity-effect-schema.js";
3
+ /**
4
+ * The subject kind of `session.activity.changed`: the subject ID is the
5
+ * Session ID, and the subject's sequence counts activity events alone. Never
6
+ * compare it with a Session's revision.
7
+ */
8
+ export const SESSION_ACTIVITY_SUBJECT_TYPE = "session-activity";
9
+ export const sessionActivitySchema = makeEffectRuntimeSchema(sessionActivityEffectSchema);
10
+ export const sessionActivityChangedSchema = makeEffectRuntimeSchema(sessionActivityChangedEffectSchema);
11
+ //# sourceMappingURL=session-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-activity.js","sourceRoot":"","sources":["../../src/event/session-activity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAG7E,OAAO,EACL,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,qCAAqC,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,kBAAkB,CAAC;AAEhE,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAC1D,2BAA2B,CAC5B,CAAC;AAGF,MAAM,CAAC,MAAM,4BAA4B,GAAG,uBAAuB,CACjE,kCAAkC,CACnC,CAAC"}