@moltzap/client 2026.729.0 → 2026.730.1

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 (200) hide show
  1. package/dist/agent-client.d.ts +2 -0
  2. package/dist/agent-client.d.ts.map +1 -1
  3. package/dist/agent-client.js +1 -0
  4. package/dist/agent-client.js.map +1 -1
  5. package/dist/app-client.d.ts +2 -0
  6. package/dist/app-client.d.ts.map +1 -1
  7. package/dist/app-client.js +1 -0
  8. package/dist/app-client.js.map +1 -1
  9. package/dist/auth.d.ts +7 -2
  10. package/dist/auth.d.ts.map +1 -1
  11. package/dist/auth.js +10 -5
  12. package/dist/auth.js.map +1 -1
  13. package/dist/channel-base/format-cross-conv.d.ts +8 -3
  14. package/dist/channel-base/format-cross-conv.d.ts.map +1 -1
  15. package/dist/channel-base/format-cross-conv.js +10 -9
  16. package/dist/channel-base/format-cross-conv.js.map +1 -1
  17. package/dist/channel-base/format-group-block.d.ts +9 -2
  18. package/dist/channel-base/format-group-block.d.ts.map +1 -1
  19. package/dist/channel-base/format-group-block.js +12 -7
  20. package/dist/channel-base/format-group-block.js.map +1 -1
  21. package/dist/channel-base/index.d.ts +8 -0
  22. package/dist/channel-base/index.d.ts.map +1 -1
  23. package/dist/channel-base/index.js +8 -0
  24. package/dist/channel-base/index.js.map +1 -1
  25. package/dist/channel-base/lease-guard.d.ts +6 -3
  26. package/dist/channel-base/lease-guard.d.ts.map +1 -1
  27. package/dist/channel-base/lease-guard.js +10 -4
  28. package/dist/channel-base/lease-guard.js.map +1 -1
  29. package/dist/channel-base/lease-store.d.ts +29 -10
  30. package/dist/channel-base/lease-store.d.ts.map +1 -1
  31. package/dist/channel-base/lease-store.js +33 -13
  32. package/dist/channel-base/lease-store.js.map +1 -1
  33. package/dist/channel-base/lease.d.ts +9 -1
  34. package/dist/channel-base/lease.d.ts.map +1 -1
  35. package/dist/channel-base/lease.js +16 -4
  36. package/dist/channel-base/lease.js.map +1 -1
  37. package/dist/channel-core-enrichment.d.ts +9 -2
  38. package/dist/channel-core-enrichment.d.ts.map +1 -1
  39. package/dist/channel-core-enrichment.js +17 -5
  40. package/dist/channel-core-enrichment.js.map +1 -1
  41. package/dist/channel-core-test-support.d.ts +46 -0
  42. package/dist/channel-core-test-support.d.ts.map +1 -1
  43. package/dist/channel-core-test-support.js +67 -13
  44. package/dist/channel-core-test-support.js.map +1 -1
  45. package/dist/channel-core.d.ts +37 -19
  46. package/dist/channel-core.d.ts.map +1 -1
  47. package/dist/channel-core.js +45 -30
  48. package/dist/channel-core.js.map +1 -1
  49. package/dist/cli/adapters.d.ts +4 -1
  50. package/dist/cli/adapters.d.ts.map +1 -1
  51. package/dist/cli/adapters.js +11 -4
  52. package/dist/cli/adapters.js.map +1 -1
  53. package/dist/cli/commands/agents.js +3 -3
  54. package/dist/cli/commands/contacts.d.ts +3 -3
  55. package/dist/cli/commands/contacts.d.ts.map +1 -1
  56. package/dist/cli/commands/contacts.js +13 -9
  57. package/dist/cli/commands/contacts.js.map +1 -1
  58. package/dist/cli/commands/conversations.d.ts +3 -2
  59. package/dist/cli/commands/conversations.d.ts.map +1 -1
  60. package/dist/cli/commands/conversations.js +7 -6
  61. package/dist/cli/commands/conversations.js.map +1 -1
  62. package/dist/cli/commands/messages.d.ts +6 -2
  63. package/dist/cli/commands/messages.d.ts.map +1 -1
  64. package/dist/cli/commands/messages.js +8 -5
  65. package/dist/cli/commands/messages.js.map +1 -1
  66. package/dist/cli/commands/register.d.ts +1 -1
  67. package/dist/cli/commands/register.js +4 -4
  68. package/dist/cli/commands/send.d.ts +7 -6
  69. package/dist/cli/commands/send.d.ts.map +1 -1
  70. package/dist/cli/commands/send.js +7 -6
  71. package/dist/cli/commands/send.js.map +1 -1
  72. package/dist/cli/commands/start.d.ts +15 -7
  73. package/dist/cli/commands/start.d.ts.map +1 -1
  74. package/dist/cli/commands/start.js +12 -5
  75. package/dist/cli/commands/start.js.map +1 -1
  76. package/dist/cli/commands/status.js +2 -2
  77. package/dist/cli/commands/test-transport.d.ts +9 -1
  78. package/dist/cli/commands/test-transport.d.ts.map +1 -1
  79. package/dist/cli/commands/test-transport.js +5 -1
  80. package/dist/cli/commands/test-transport.js.map +1 -1
  81. package/dist/cli/index.js +8 -7
  82. package/dist/cli/index.js.map +1 -1
  83. package/dist/cli/output.d.ts +10 -0
  84. package/dist/cli/output.d.ts.map +1 -1
  85. package/dist/cli/output.js +10 -0
  86. package/dist/cli/output.js.map +1 -1
  87. package/dist/cli/socket-client.d.ts +13 -3
  88. package/dist/cli/socket-client.d.ts.map +1 -1
  89. package/dist/cli/socket-client.js +16 -5
  90. package/dist/cli/socket-client.js.map +1 -1
  91. package/dist/cli/transport.d.ts +16 -3
  92. package/dist/cli/transport.d.ts.map +1 -1
  93. package/dist/cli/transport.js +19 -6
  94. package/dist/cli/transport.js.map +1 -1
  95. package/dist/config.d.ts +9 -3
  96. package/dist/config.d.ts.map +1 -1
  97. package/dist/config.js +8 -3
  98. package/dist/config.js.map +1 -1
  99. package/dist/config.test-utils.d.ts +7 -2
  100. package/dist/config.test-utils.d.ts.map +1 -1
  101. package/dist/config.test-utils.js +8 -1
  102. package/dist/config.test-utils.js.map +1 -1
  103. package/dist/index.d.ts +3 -0
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/index.js +2 -0
  106. package/dist/index.js.map +1 -1
  107. package/dist/local-daemon-rpc.d.ts +116 -93
  108. package/dist/local-daemon-rpc.d.ts.map +1 -1
  109. package/dist/local-daemon-rpc.js +128 -108
  110. package/dist/local-daemon-rpc.js.map +1 -1
  111. package/dist/local-history.d.ts +40 -20
  112. package/dist/local-history.d.ts.map +1 -1
  113. package/dist/local-history.js +45 -23
  114. package/dist/local-history.js.map +1 -1
  115. package/dist/local-paths.d.ts +17 -0
  116. package/dist/local-paths.d.ts.map +1 -1
  117. package/dist/local-paths.js +21 -4
  118. package/dist/local-paths.js.map +1 -1
  119. package/dist/local-socket-server.d.ts +13 -2
  120. package/dist/local-socket-server.d.ts.map +1 -1
  121. package/dist/local-socket-server.js +13 -2
  122. package/dist/local-socket-server.js.map +1 -1
  123. package/dist/message-rendering.d.ts +1 -0
  124. package/dist/message-rendering.d.ts.map +1 -1
  125. package/dist/message-rendering.js +1 -0
  126. package/dist/message-rendering.js.map +1 -1
  127. package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts +50 -2
  128. package/dist/notification/__tests__/subscribe-signatures.types-check.d.ts.map +1 -1
  129. package/dist/notification/__tests__/subscribe-signatures.types-check.js +22 -48
  130. package/dist/notification/__tests__/subscribe-signatures.types-check.js.map +1 -1
  131. package/dist/notification/errors.d.ts +2 -0
  132. package/dist/notification/errors.d.ts.map +1 -1
  133. package/dist/notification/errors.js +3 -1
  134. package/dist/notification/errors.js.map +1 -1
  135. package/dist/notification/index.d.ts +1 -0
  136. package/dist/notification/index.d.ts.map +1 -1
  137. package/dist/notification/index.js +1 -0
  138. package/dist/notification/index.js.map +1 -1
  139. package/dist/notification/stream.d.ts +11 -4
  140. package/dist/notification/stream.d.ts.map +1 -1
  141. package/dist/notification/stream.js +5 -38
  142. package/dist/notification/stream.js.map +1 -1
  143. package/dist/pagination.d.ts +13 -16
  144. package/dist/pagination.d.ts.map +1 -1
  145. package/dist/pagination.js +9 -1
  146. package/dist/pagination.js.map +1 -1
  147. package/dist/profile.d.ts +21 -9
  148. package/dist/profile.d.ts.map +1 -1
  149. package/dist/profile.js +30 -16
  150. package/dist/profile.js.map +1 -1
  151. package/dist/refs.d.ts +9 -1
  152. package/dist/refs.d.ts.map +1 -1
  153. package/dist/refs.js +9 -1
  154. package/dist/refs.js.map +1 -1
  155. package/dist/service-archive-purge.d.ts +18 -0
  156. package/dist/service-archive-purge.d.ts.map +1 -1
  157. package/dist/service-archive-purge.js +18 -0
  158. package/dist/service-archive-purge.js.map +1 -1
  159. package/dist/service-event-trace.d.ts +15 -0
  160. package/dist/service-event-trace.d.ts.map +1 -0
  161. package/dist/service-event-trace.js +35 -0
  162. package/dist/service-event-trace.js.map +1 -0
  163. package/dist/service-helpers.d.ts +35 -6
  164. package/dist/service-helpers.d.ts.map +1 -1
  165. package/dist/service-helpers.js +38 -8
  166. package/dist/service-helpers.js.map +1 -1
  167. package/dist/service-local-daemon.d.ts +12 -2
  168. package/dist/service-local-daemon.d.ts.map +1 -1
  169. package/dist/service-local-daemon.js +38 -25
  170. package/dist/service-local-daemon.js.map +1 -1
  171. package/dist/service.d.ts +62 -22
  172. package/dist/service.d.ts.map +1 -1
  173. package/dist/service.js +135 -80
  174. package/dist/service.js.map +1 -1
  175. package/dist/test-utils/channel-service-fixture.d.ts +8 -0
  176. package/dist/test-utils/channel-service-fixture.d.ts.map +1 -1
  177. package/dist/test-utils/channel-service-fixture.js +31 -13
  178. package/dist/test-utils/channel-service-fixture.js.map +1 -1
  179. package/dist/test-utils/fake-service.d.ts +20 -7
  180. package/dist/test-utils/fake-service.d.ts.map +1 -1
  181. package/dist/test-utils/fake-service.js +18 -4
  182. package/dist/test-utils/fake-service.js.map +1 -1
  183. package/dist/test-utils/harness.d.ts +5 -1
  184. package/dist/test-utils/harness.d.ts.map +1 -1
  185. package/dist/test-utils/harness.js +3 -0
  186. package/dist/test-utils/harness.js.map +1 -1
  187. package/dist/test-utils/ids.d.ts +25 -0
  188. package/dist/test-utils/ids.d.ts.map +1 -1
  189. package/dist/test-utils/ids.js +27 -1
  190. package/dist/test-utils/ids.js.map +1 -1
  191. package/dist/test-utils/index.d.ts +7 -1
  192. package/dist/test-utils/index.d.ts.map +1 -1
  193. package/dist/test-utils/index.js +7 -1
  194. package/dist/test-utils/index.js.map +1 -1
  195. package/dist/test-utils/standalone-provisioning.d.ts +5 -0
  196. package/dist/test-utils/standalone-provisioning.d.ts.map +1 -1
  197. package/dist/test-utils/standalone-provisioning.js +3 -0
  198. package/dist/test-utils/standalone-provisioning.js.map +1 -1
  199. package/dist/tsconfig.tsbuildinfo +1 -1
  200. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"pagination.js","s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AAC,EAAE,CAAC;gBAC5D,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CACvB,IAAI,uBAAuB,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,CACzD,CAAC;YACJ,CAAC;YACD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC9B,CAAC;YACD,MAAM,GAAG,UAAU,CAAC;YACpB,IAAI,GAAG,UAAU,KAAK,SAAS,CAAC;QAClC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC;AACjD,CAAC"}
package/dist/profile.d.ts CHANGED
@@ -1,18 +1,17 @@
1
1
  import { Effect, Schema } from "effect";
2
- import { AgentId } from "@moltzap/protocol/identity";
3
- import { AgentKey } from "@moltzap/protocol/identity";
4
- export declare const ProfileName: Schema.brand<Schema.filter<typeof Schema.String>, "ProfileName">;
2
+ /** Validates and decodes profile name values. */
3
+ export declare const profileName: Schema.brand<Schema.filter<typeof Schema.String>, "ProfileName">;
5
4
  /**
6
5
  * Branded profile name shared by profile lookup and CLI registration.
7
6
  */
8
- export type ProfileName = Schema.Schema.Type<typeof ProfileName>;
9
- declare const ProfileRecordSchema: Schema.Struct<{
10
- agentId: Schema.Schema<AgentId, string, never>;
11
- apiKey: Schema.Schema<AgentKey, string, never>;
7
+ export type ProfileName = Schema.Schema.Type<typeof profileName>;
8
+ declare const profileRecordSchema: Schema.Struct<{
9
+ agentId: Schema.Schema<import("@moltzap/protocol/identity").AgentId, string, never>;
10
+ apiKey: Schema.Schema<import("@moltzap/protocol/identity").AgentKey, string, never>;
12
11
  agentName: typeof Schema.String;
13
12
  }>;
14
13
  /** One profile's persisted auth record. */
15
- export type ProfileRecord = Schema.Schema.Type<typeof ProfileRecordSchema>;
14
+ export type ProfileRecord = Schema.Schema.Type<typeof profileRecordSchema>;
16
15
  /** Named profile view of config.json. */
17
16
  export interface LayeredConfig {
18
17
  readonly profiles: ReadonlyMap<ProfileName, ProfileRecord>;
@@ -22,6 +21,7 @@ export type ProfileError = ProfileNotFoundError | ProfileInvalidNameError | Prof
22
21
  declare const ProfileNotFoundError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
23
22
  readonly _tag: "ProfileNotFoundError";
24
23
  } & Readonly<A>;
24
+ /** Reports profile not found failures. */
25
25
  export declare class ProfileNotFoundError extends ProfileNotFoundError_base<{
26
26
  readonly name: string;
27
27
  }> {
@@ -29,6 +29,7 @@ export declare class ProfileNotFoundError extends ProfileNotFoundError_base<{
29
29
  declare const ProfileInvalidNameError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
30
30
  readonly _tag: "ProfileInvalidNameError";
31
31
  } & Readonly<A>;
32
+ /** Reports profile invalid name failures. */
32
33
  export declare class ProfileInvalidNameError extends ProfileInvalidNameError_base<{
33
34
  readonly name: string;
34
35
  readonly reason: string;
@@ -37,6 +38,7 @@ export declare class ProfileInvalidNameError extends ProfileInvalidNameError_bas
37
38
  declare const ProfileConfigReadError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
38
39
  readonly _tag: "ProfileConfigReadError";
39
40
  } & Readonly<A>;
41
+ /** Reports profile config read failures. */
40
42
  export declare class ProfileConfigReadError extends ProfileConfigReadError_base<{
41
43
  readonly path: string;
42
44
  readonly cause: unknown;
@@ -45,6 +47,7 @@ export declare class ProfileConfigReadError extends ProfileConfigReadError_base<
45
47
  declare const ProfileConfigWriteError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
46
48
  readonly _tag: "ProfileConfigWriteError";
47
49
  } & Readonly<A>;
50
+ /** Reports profile config write failures. */
48
51
  export declare class ProfileConfigWriteError extends ProfileConfigWriteError_base<{
49
52
  readonly path: string;
50
53
  readonly cause: unknown;
@@ -53,6 +56,8 @@ export declare class ProfileConfigWriteError extends ProfileConfigWriteError_bas
53
56
  /**
54
57
  * Parse and brand a raw profile name. Rejects the empty string and any
55
58
  * string that fails NAME_PATTERN.
59
+ * @param raw Value supplied to the operation.
60
+ * @returns The decoded profile name.
56
61
  */
57
62
  export declare const parseProfileName: (raw: string) => Effect.Effect<ProfileName, ProfileInvalidNameError>;
58
63
  /**
@@ -67,10 +72,15 @@ export declare const loadLayeredConfig: Effect.Effect<LayeredConfig, ProfileConf
67
72
  /**
68
73
  * Resolve a named profile record. CLI transport selection uses only
69
74
  * `agentId`; daemon startup consumes the redacted `apiKey`.
75
+ * @param name Name of the operation.
76
+ * @returns The next profile file result.
70
77
  */
71
78
  export declare const resolveProfileRecord: (name: ProfileName) => Effect.Effect<ProfileRecord, ProfileNotFoundError | ProfileConfigReadError>;
72
79
  /**
73
80
  * Persist a new profile record under `profiles.&lt;name>`.
81
+ * @param name Name of the operation.
82
+ * @param record Value supplied to the operation.
83
+ * @returns The write profile result.
74
84
  */
75
85
  export declare const writeProfile: (name: ProfileName, record: ProfileRecord) => Effect.Effect<void, ProfileConfigWriteError | ProfileConfigReadError>;
76
86
  /**
@@ -84,9 +94,11 @@ export declare const writeProfile: (name: ProfileName, record: ProfileRecord) =>
84
94
  *
85
95
  * The register command pipes the returned record through the printer,
86
96
  * which writes non-secret registration details to stdout.
97
+ * @param record Value supplied to the operation.
98
+ * @returns The emit no persist result.
87
99
  */
88
100
  export declare const emitNoPersist: (record: ProfileRecord) => Effect.Effect<{
89
101
  readonly record: ProfileRecord;
90
- }, never>;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ACH,eAAO,MAAM,YAAY,GACvB,MAAM,WAAW,EACjB,QAAQ,aAAa,KACpB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,sBAAsB,CAI7B,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,aAAa,KACpB,MAAM,CAAC,MAAM,CAAC;IAAE,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CACvB,CAAC"}
package/dist/profile.js CHANGED
@@ -7,8 +7,7 @@
7
7
  import { FileSystem } from "@effect/platform";
8
8
  import { NodeFileSystem } from "@effect/platform-node";
9
9
  import { Data, Effect, Either, Schema } from "effect";
10
- import { AgentId } from "@moltzap/protocol/identity";
11
- import { AgentKey } from "@moltzap/protocol/identity";
10
+ import { agentId, agentKey } from "@moltzap/protocol/identity";
12
11
  import { getMoltZapConfigDir, getMoltZapConfigPath } from "./local-paths.js";
13
12
  // ─── Branded names ─────────────────────────────────────────────────────────
14
13
  const NAME_PATTERN = /^[a-z0-9][a-z0-9-]{1,30}[a-z0-9]$/;
@@ -19,37 +18,44 @@ const getConfigDir = getMoltZapConfigDir;
19
18
  const getConfigFilePathSync = getMoltZapConfigPath;
20
19
  const STRICT_PARSE_OPTIONS = { onExcessProperty: "error" };
21
20
  // ─── Records ───────────────────────────────────────────────────────────────
22
- export const ProfileName = Schema.String.pipe(Schema.pattern(NAME_PATTERN), Schema.brand("ProfileName"));
23
- const ProfileRecordSchema = Schema.Struct({
24
- agentId: AgentId,
25
- apiKey: AgentKey,
21
+ /** Validates and decodes profile name values. */
22
+ export const profileName = Schema.String.pipe(Schema.pattern(NAME_PATTERN), Schema.brand("ProfileName"));
23
+ const profileRecordSchema = Schema.Struct({
24
+ agentId: agentId,
25
+ apiKey: agentKey,
26
26
  agentName: Schema.String,
27
27
  });
28
- const ProfileMapSchema = Schema.Record({
29
- key: ProfileName,
30
- value: ProfileRecordSchema,
28
+ const profileMapSchema = Schema.Record({
29
+ key: profileName,
30
+ value: profileRecordSchema,
31
31
  });
32
- const ProfileFileSchema = Schema.Struct({
33
- profiles: Schema.optional(ProfileMapSchema),
32
+ const profileFileSchema = Schema.Struct({
33
+ profiles: Schema.optional(profileMapSchema),
34
34
  });
35
- const ProfileFileTextSchema = Schema.parseJson(ProfileFileSchema, {
35
+ const profileFileTextSchema = Schema.parseJson(profileFileSchema, {
36
36
  space: JSON_INDENT_SPACES,
37
37
  });
38
+ /** Reports profile not found failures. */
38
39
  export class ProfileNotFoundError extends Data.TaggedError("ProfileNotFoundError") {
39
40
  }
41
+ /** Reports profile invalid name failures. */
40
42
  export class ProfileInvalidNameError extends Data.TaggedError("ProfileInvalidNameError") {
41
43
  }
44
+ /** Reports profile config read failures. */
42
45
  export class ProfileConfigReadError extends Data.TaggedError("ProfileConfigReadError") {
43
46
  }
47
+ /** Reports profile config write failures. */
44
48
  export class ProfileConfigWriteError extends Data.TaggedError("ProfileConfigWriteError") {
45
49
  }
46
50
  // ─── Public API ────────────────────────────────────────────────────────────
47
51
  /**
48
52
  * Parse and brand a raw profile name. Rejects the empty string and any
49
53
  * string that fails NAME_PATTERN.
54
+ * @param raw Value supplied to the operation.
55
+ * @returns The decoded profile name.
50
56
  */
51
57
  export const parseProfileName = (raw) => {
52
- return Schema.decodeUnknown(ProfileName)(raw).pipe(Effect.catchTag("ParseError", () => Effect.fail(new ProfileInvalidNameError({
58
+ return Schema.decodeUnknown(profileName)(raw).pipe(Effect.catchTag("ParseError", () => Effect.fail(new ProfileInvalidNameError({
53
59
  name: raw,
54
60
  reason: raw.length === 0 ? "empty string" : PROFILE_NAME_REASON,
55
61
  }))));
@@ -62,7 +68,7 @@ const readProfileFileText = (configPath) => FileSystem.FileSystem.pipe(Effect.fl
62
68
  onLeft: (cause) => Effect.fail(new ProfileConfigReadError({ path: configPath, cause })),
63
69
  onRight: (value) => Effect.succeed(value),
64
70
  })));
65
- const decodeProfileFileText = (configPath, text) => Schema.decodeUnknown(ProfileFileTextSchema, STRICT_PARSE_OPTIONS)(text).pipe(Effect.either, Effect.flatMap(Either.match({
71
+ const decodeProfileFileText = (configPath, text) => Schema.decodeUnknown(profileFileTextSchema, STRICT_PARSE_OPTIONS)(text).pipe(Effect.either, Effect.flatMap(Either.match({
66
72
  onLeft: (cause) => Effect.fail(new ProfileConfigReadError({ path: configPath, cause })),
67
73
  onRight: Effect.succeed,
68
74
  })));
@@ -76,7 +82,8 @@ const readProfileFile = () => Effect.gen(function* () {
76
82
  return { file, existed: true };
77
83
  });
78
84
  function profilesFromFile(file) {
79
- return new Map(Object.entries(file.profiles ?? {}));
85
+ return new Map(
86
+ /* Safe because the surrounding invariant establishes this asserted shape. */ Object.entries(file.profiles ?? {}));
80
87
  }
81
88
  /**
82
89
  * Load the full layered config view. Missing file resolves to an empty
@@ -95,6 +102,8 @@ export const loadLayeredConfig = Effect.gen(function* () {
95
102
  /**
96
103
  * Resolve a named profile record. CLI transport selection uses only
97
104
  * `agentId`; daemon startup consumes the redacted `apiKey`.
105
+ * @param name Name of the operation.
106
+ * @returns The next profile file result.
98
107
  */
99
108
  export const resolveProfileRecord = (name) => Effect.gen(function* () {
100
109
  const layered = yield* loadLayeredConfig;
@@ -112,7 +121,7 @@ function nextProfileFile(file, name, record) {
112
121
  },
113
122
  };
114
123
  }
115
- const encodeProfileFileText = (configPath, file) => Schema.encode(ProfileFileTextSchema, STRICT_PARSE_OPTIONS)(file).pipe(Effect.either, Effect.flatMap(Either.match({
124
+ const encodeProfileFileText = (configPath, file) => Schema.encode(profileFileTextSchema, STRICT_PARSE_OPTIONS)(file).pipe(Effect.either, Effect.flatMap(Either.match({
116
125
  onLeft: (cause) => Effect.fail(new ProfileConfigWriteError({ path: configPath, cause })),
117
126
  onRight: Effect.succeed,
118
127
  })));
@@ -128,6 +137,9 @@ const writeProfileFile = (next) => {
128
137
  };
129
138
  /**
130
139
  * Persist a new profile record under `profiles.&lt;name>`.
140
+ * @param name Name of the operation.
141
+ * @param record Value supplied to the operation.
142
+ * @returns The write profile result.
131
143
  */
132
144
  export const writeProfile = (name, record) => Effect.gen(function* () {
133
145
  const { file } = yield* readProfileFile();
@@ -144,6 +156,8 @@ export const writeProfile = (name, record) => Effect.gen(function* () {
144
156
  *
145
157
  * The register command pipes the returned record through the printer,
146
158
  * which writes non-secret registration details to stdout.
159
+ * @param record Value supplied to the operation.
160
+ * @returns The emit no persist result.
147
161
  */
148
162
  export const emitNoPersist = (record) => Effect.succeed({ record });
149
163
  //# sourceMappingURL=profile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,8EAA8E;AAE9E,MAAM,YAAY,GAAG,mCAAmC,CAAC;AACzD,MAAM,mBAAmB,GACvB,2FAA2F,CAAC;AAE9F,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,YAAY,GAAG,mBAAmB,CAAC;AACzC,MAAM,qBAAqB,GAAG,oBAAoB,CAAC;AACnD,MAAM,oBAAoB,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAW,CAAC;AAEpE,8EAA8E;AAE9E,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAC3C,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,EAC5B,MAAM,CA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M,CAAC,QAAQ,CACb,UAAU,CAAC,eAAe,CAAC,UAAU,EAAE,GAAG,IAAI,IAAI,EAAE;QAClD,IAAI,EAAE,gBAAgB;KACvB,CAAC,CACH,CACF,CACF,CACF,CACF,EACD,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,EACpC,MAAM,CAAC,MAAM,EACb,MAAM,CAAC,OAAO,CACZ,MAAM,CAAC,KAAK,CAAC;QACX,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAChB,MAAM,CAAC,IAAI,CAAC,IAAI,uBAAuB,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACvE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;KAC1C,CAAC,CACH,CACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAiB,EACjB,MAAqB,EACkD,EAAE,CACzE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC,eAAe,EAAE,CAAC;IAC1C,KAAK,CAAC,CAAC,gBAAgB,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC;AAE3C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,MAAqB,EAC8B,EAAE,CACrD,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC"}
package/dist/refs.d.ts CHANGED
@@ -3,8 +3,16 @@ import { HashMap, Ref } from "effect";
3
3
  * Read a `Ref` synchronously outside an Effect scope. Only safe for `Ref`s
4
4
  * that never fiber-park (the stock `Ref.Ref&lt;A>` never does). Use from
5
5
  * object methods or sync code paths that hold a `Ref` set up at construction.
6
+ * @param ref Value supplied to the operation.
7
+ * @returns The snapshot result.
6
8
  */
7
9
  export declare const snapshot: <A>(ref: Ref.Ref<A>) => A;
8
- /** Lookup `key` in `m`, falling back to `dflt()` if absent. Lazy default. */
10
+ /**
11
+ * Lookup `key` in `m`, falling back to `dflt()` if absent. Lazy default.
12
+ * @param m Value supplied to the operation.
13
+ * @param key Value supplied to the operation.
14
+ * @param dflt Value supplied to the operation.
15
+ * @returns The get or result.
16
+ */
9
17
  export declare const getOr: <K, V>(m: HashMap.HashMap<K, V>, key: K, dflt: () => V) => V;
10
18
  //# sourceMappingURL=refs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,OAAO,EAAU,GAAG,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAG,CAAiC,CAAC;AAEhF,6EAA6E;AAC7E,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,EACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EACxB,KAAK,CAAC,EACN,MAAM,MAAM,CAAC,KACZ,CAAgD,CAAC"}
1
+ {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,OAAO,EAAU,GAAG,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAG,CAAiC,CAAC;AAEhF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,EACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EACxB,KAAK,CAAC,EACN,MAAM,MAAM,CAAC,KACZ,CAAgD,CAAC"}
package/dist/refs.js CHANGED
@@ -3,8 +3,16 @@ import { Effect, HashMap, Option, Ref } from "effect";
3
3
  * Read a `Ref` synchronously outside an Effect scope. Only safe for `Ref`s
4
4
  * that never fiber-park (the stock `Ref.Ref&lt;A>` never does). Use from
5
5
  * object methods or sync code paths that hold a `Ref` set up at construction.
6
+ * @param ref Value supplied to the operation.
7
+ * @returns The snapshot result.
6
8
  */
7
9
  export const snapshot = (ref) => Effect.runSync(Ref.get(ref));
8
- /** Lookup `key` in `m`, falling back to `dflt()` if absent. Lazy default. */
10
+ /**
11
+ * Lookup `key` in `m`, falling back to `dflt()` if absent. Lazy default.
12
+ * @param m Value supplied to the operation.
13
+ * @param key Value supplied to the operation.
14
+ * @param dflt Value supplied to the operation.
15
+ * @returns The get or result.
16
+ */
9
17
  export const getOr = (m, key, dflt) => Option.getOrElse(HashMap.get(m, key), dflt);
10
18
  //# sourceMappingURL=refs.js.map
package/dist/refs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"refs.js","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAI,GAAe,EAAK,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,CAAwB,EACxB,GAAM,EACN,IAAa,EACV,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"refs.js","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAI,GAAe,EAAK,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,CAAwB,EACxB,GAAM,EACN,IAAa,EACV,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC"}
@@ -6,6 +6,12 @@ import type { TaskId } from "@moltzap/protocol/task";
6
6
  * the function under the 50-line ESLint cap and the file under the
7
7
  * 1050-line cap.
8
8
  */
9
+ /**
10
+ * Executes the purge agent cache entries operation.
11
+ * @param m Value supplied to the operation.
12
+ * @param conversationId Value supplied to the operation.
13
+ * @returns The purge agent cache entries result.
14
+ */
9
15
  export declare function purgeAgentCacheEntries(m: HashMap.HashMap<string, {
10
16
  readonly taskId: TaskId;
11
17
  readonly conversationId: ConversationId;
@@ -13,6 +19,18 @@ export declare function purgeAgentCacheEntries(m: HashMap.HashMap<string, {
13
19
  readonly taskId: TaskId;
14
20
  readonly conversationId: ConversationId;
15
21
  }>;
22
+ /**
23
+ * Executes the purge last notified operation.
24
+ * @param outer Value supplied to the operation.
25
+ * @param conversationId Value supplied to the operation.
26
+ * @returns The purge last notified result.
27
+ */
16
28
  export declare function purgeLastNotified(outer: HashMap.HashMap<string, HashMap.HashMap<string, string>>, conversationId: ConversationId): HashMap.HashMap<string, HashMap.HashMap<string, string>>;
29
+ /**
30
+ * Executes the purge last read operation.
31
+ * @param outer Value supplied to the operation.
32
+ * @param conversationId Value supplied to the operation.
33
+ * @returns The purge last read result.
34
+ */
17
35
  export declare function purgeLastRead(outer: HashMap.HashMap<string, HashMap.HashMap<string, ReadonlySet<string>>>, conversationId: ConversationId): HashMap.HashMap<string, HashMap.HashMap<string, ReadonlySet<string>>>;
18
36
  //# sourceMappingURL=service-archive-purge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-archive-purge.d.ts","sourceRoot":"","sources":["../src/service-archive-purge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;;;GAIG;AAEH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,OAAO,CAAC,OAAO,CAChB,MAAM,EACN;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAA;CAAE,CACrE,EACD,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,OAAO,CAChB,MAAM,EACN;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAA;CAAE,CACrE,CAWA;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC/D,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAY1D;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAC5E,cAAc,EAAE,cAAc,GAC7B,OAA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EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAavE"}
@@ -4,6 +4,12 @@ import { HashMap } from "effect";
4
4
  * the function under the 50-line ESLint cap and the file under the
5
5
  * 1050-line cap.
6
6
  */
7
+ /**
8
+ * Executes the purge agent cache entries operation.
9
+ * @param m Value supplied to the operation.
10
+ * @param conversationId Value supplied to the operation.
11
+ * @returns The purge agent cache entries result.
12
+ */
7
13
  export function purgeAgentCacheEntries(m, conversationId) {
8
14
  let next = HashMap.empty();
9
15
  for (const [agentName, entry] of HashMap.entries(m)) {
@@ -13,6 +19,12 @@ export function purgeAgentCacheEntries(m, conversationId) {
13
19
  }
14
20
  return next;
15
21
  }
22
+ /**
23
+ * Executes the purge last notified operation.
24
+ * @param outer Value supplied to the operation.
25
+ * @param conversationId Value supplied to the operation.
26
+ * @returns The purge last notified result.
27
+ */
16
28
  export function purgeLastNotified(outer, conversationId) {
17
29
  let next = HashMap.empty();
18
30
  for (const [viewConvId, markers] of HashMap.entries(outer)) {
@@ -22,6 +34,12 @@ export function purgeLastNotified(outer, conversationId) {
22
34
  }
23
35
  return next;
24
36
  }
37
+ /**
38
+ * Executes the purge last read operation.
39
+ * @param outer Value supplied to the operation.
40
+ * @param conversationId Value supplied to the operation.
41
+ * @returns The purge last read result.
42
+ */
25
43
  export function purgeLastRead(outer, conversationId) {
26
44
  let next = HashMap.empty();
27
45
  for (const [sessionKey, perConv] of HashMap.entries(outer)) {
@@ -1 +1 @@
1
- {"version":3,"file":"service-archive-purge.js","sourceRoot":"","sources":["../src/service-archive-purge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAIjC;;;;GAIG;AAEH,MAAM,UAAU,sBAAsB,CACpC,CAGC,EACD,cAA8B;IAK9B,IAAI,IAAI,GAAG,OAAO,CAAC,KAAK,EAGrB,CAAC;IACJ,KAAK,MAAM,CAAC,SAAS,EAAE,KAA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;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** @file Best-effort client event trace persistence. */
2
+ import { ConfigProvider, Effect } from "effect";
3
+ /**
4
+ * Resolve the configured trace directory while preserving empty-as-disabled.
5
+ * @param configProvider Source used to resolve the environment-backed config.
6
+ * @returns A nonempty configured directory, or `undefined` when disabled.
7
+ */
8
+ export declare function getClientEventLogDir(configProvider?: ConfigProvider.ConfigProvider): string | undefined;
9
+ /**
10
+ * Append one client event trace when trace persistence is configured.
11
+ * @param record Structured event fields to persist.
12
+ * @returns A best-effort write Effect that logs and absorbs storage failures.
13
+ */
14
+ export declare function appendClientEventTrace(record: Record<string, unknown>): Effect.Effect<void>;
15
+ //# sourceMappingURL=service-event-trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-event-trace.d.ts","sourceRoot":"","sources":["../src/service-event-trace.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAIxD,OAAO,EAAU,cAAc,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAMhE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,GAC7C,MAAM,GAAG,SAAS,CAMpB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CA0BrB"}
@@ -0,0 +1,35 @@
1
+ /** @file Best-effort client event trace persistence. */
2
+ import { FileSystem, Path } from "@effect/platform";
3
+ import { NodeContext } from "@effect/platform-node";
4
+ import { Config, ConfigProvider, Effect, Option } from "effect";
5
+ const clientEventLogDir = Config.option(Config.string("MOLTZAP_CLIENT_EVENT_LOG_DIR"));
6
+ /**
7
+ * Resolve the configured trace directory while preserving empty-as-disabled.
8
+ * @param configProvider Source used to resolve the environment-backed config.
9
+ * @returns A nonempty configured directory, or `undefined` when disabled.
10
+ */
11
+ export function getClientEventLogDir(configProvider) {
12
+ const provider = configProvider ?? ConfigProvider.fromEnv();
13
+ const directory = Option.getOrUndefined(Effect.runSync(clientEventLogDir.pipe(Effect.withConfigProvider(provider))));
14
+ return directory === "" ? undefined : directory;
15
+ }
16
+ /**
17
+ * Append one client event trace when trace persistence is configured.
18
+ * @param record Structured event fields to persist.
19
+ * @returns A best-effort write Effect that logs and absorbs storage failures.
20
+ */
21
+ export function appendClientEventTrace(record) {
22
+ const dir = getClientEventLogDir();
23
+ if (dir === undefined) {
24
+ return Effect.void;
25
+ }
26
+ return Effect.gen(function* () {
27
+ const fileSystem = yield* FileSystem.FileSystem;
28
+ const path = yield* Path.Path;
29
+ const agentId = typeof record.agentId === "string" ? record.agentId : "unknown";
30
+ const safeAgentId = /^[A-Za-z0-9_-]+$/.test(agentId) ? agentId : "unknown";
31
+ yield* Effect.zipRight(fileSystem.makeDirectory(dir, { recursive: true }), fileSystem.writeFileString(path.join(dir, `client-events-${safeAgentId}.jsonl`), `${JSON.stringify(record)}\n`, { flag: "a" }));
32
+ }).pipe(Effect.withSpan("appendClientEventTrace"), Effect.provide(NodeContext.layer), Effect.catchAll((error) => Effect.logWarning("moltzap client event trace write failed", error)));
33
+ }
34
+ // safer-arch-ignore no-trivial-sink-file: Event-trace lifecycle is isolated to keep the public service implementation within the normative function and file-size limits.
35
+ //# sourceMappingURL=service-event-trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-event-trace.js","sourceRoot":"","sources":["../src/service-event-trace.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhE,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CACrC,MAAM,CA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AiB,WAAW,QAAQ,CAAC,EACpD,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAC7B,EAAE,IAAI,EAAE,GAAG,EAAE,CACd,CACF,CAAC;IACJ,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAAC,EACzC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,EACjC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,MAAM,CAAC,UAAU,CAAC,yCAAyC,EAAE,KAAK,CAAC,CACpE,CACF,CAAC;AACJ,CAAC;AACD,0KAA0K"}
@@ -3,24 +3,53 @@ import type { AnyNotificationDefinition } from "@moltzap/protocol/socket/catalog
3
3
  import type { Message } from "@moltzap/protocol/message";
4
4
  import { HashMap } from "effect";
5
5
  import type { ConversationMeta, CrossConversationEntry } from "./service.js";
6
+ /** Describes cross conv state. */
6
7
  export interface CrossConvState {
7
- readonly messagesMap: HashMap.HashMap<string, ReadonlyArray<Message>>;
8
+ readonly messagesMap: HashMap.HashMap<string, readonly Message[]>;
8
9
  readonly conversationsMap: HashMap.HashMap<string, ConversationMeta>;
9
10
  readonly agentNamesMap: HashMap.HashMap<string, string>;
10
11
  readonly viewMarkers: HashMap.HashMap<string, string>;
11
12
  }
13
+ /** Describes context candidate. */
12
14
  export interface ContextCandidate {
13
15
  readonly convId: string;
14
- readonly newMsgs: ReadonlyArray<Message>;
16
+ readonly newMsgs: readonly Message[];
15
17
  readonly lastTs: number;
16
18
  }
17
19
  interface BuiltContextEntries {
18
20
  readonly entries: CrossConversationEntry[];
19
21
  readonly pendingAdvances: ReadonlyArray<readonly [string, string]>;
20
22
  }
21
- export declare function newMessagesForConversation(convId: string, messages: ReadonlyArray<Message>, viewMarkers: HashMap.HashMap<string, string>, currentConvId: string): ReadonlyArray<Message>;
22
- export declare function makeContextCandidate(convId: string, newMsgs: ReadonlyArray<Message>): ContextCandidate;
23
- export declare function buildContextEntries(candidates: ReadonlyArray<ContextCandidate>, state: CrossConvState, maxMessagesPerConv: number): BuiltContextEntries;
24
- export declare function notificationTraceRecord(notification: NotificationDelivery<AnyNotificationDefinition>, agentId: string | undefined): Record<string, unknown>;
23
+ /**
24
+ * Creates messages for conversation.
25
+ * @param convId Value supplied to the operation.
26
+ * @param messages Value supplied to the operation.
27
+ * @param viewMarkers Value supplied to the operation.
28
+ * @param currentConvId Value supplied to the operation.
29
+ * @returns The new messages for conversation result.
30
+ */
31
+ export declare function newMessagesForConversation(convId: string, messages: readonly Message[], viewMarkers: HashMap.HashMap<string, string>, currentConvId: string): readonly Message[];
32
+ /**
33
+ * Creates context candidate.
34
+ * @param convId Value supplied to the operation.
35
+ * @param newMsgs Value supplied to the operation.
36
+ * @returns The created context candidate.
37
+ */
38
+ export declare function makeContextCandidate(convId: string, newMsgs: readonly Message[]): ContextCandidate;
39
+ /**
40
+ * Creates context entries.
41
+ * @param candidates Value supplied to the operation.
42
+ * @param state Value supplied to the operation.
43
+ * @param maxMessagesPerConv Value supplied to the operation.
44
+ * @returns The created context entries.
45
+ */
46
+ export declare function buildContextEntries(candidates: readonly ContextCandidate[], state: CrossConvState, maxMessagesPerConv: number): BuiltContextEntries;
47
+ /**
48
+ * Executes the notification trace record operation.
49
+ * @param notification Value supplied to the operation.
50
+ * @param agentId Identifier of the agent targeted by the operation.
51
+ * @returns The notification trace record result.
52
+ */
53
+ export declare function notificationTraceRecord(notification: NotificationDelivery<AnyNotificationDefinition>, agentId?: string): Record<string, unknown>;
25
54
  export {};
26
55
  //# sourceMappingURL=service-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-helpers.d.ts","sourceRoot":"","sources":["../src/service-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,KAAK,EAAE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C,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAC3C,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpE;AAwBD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,OAAO,EAAE,EAC5B,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5C,aAAa,EAAE,MAAM,GACpB,SAAS,OAAO,EAAE,CAUpB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,SAAS,OAAO,EAAE,GAC1B,gBAAgB,CAUlB;AA4CD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,SAAS,gBAAgB,EAAE,EACvC,KAAK,EAAE,cAAc,EACrB,kBAAkB,EAAE,MAAM,GACzB,mBAAmB,CAarB;AAQD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,oBAAoB,CAAC,yBAAyB,CAAC,EAC7D,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBzB"}
@@ -12,17 +12,33 @@ const stringProperty = (record, key) => {
12
12
  const value = record[key];
13
13
  return typeof value === "string" ? value : undefined;
14
14
  };
15
+ /**
16
+ * Creates messages for conversation.
17
+ * @param convId Value supplied to the operation.
18
+ * @param messages Value supplied to the operation.
19
+ * @param viewMarkers Value supplied to the operation.
20
+ * @param currentConvId Value supplied to the operation.
21
+ * @returns The new messages for conversation result.
22
+ */
15
23
  export function newMessagesForConversation(convId, messages, viewMarkers, currentConvId) {
16
- if (convId === currentConvId || messages.length === 0)
24
+ if (convId === currentConvId || messages.length === 0) {
17
25
  return [];
26
+ }
18
27
  const lastSeenId = Option.getOrUndefined(HashMap.get(viewMarkers, convId));
19
28
  const lastSeenIndex = lastSeenId !== undefined
20
29
  ? messages.findIndex((message) => message.id === lastSeenId)
21
30
  : -1;
22
31
  return messages.slice(lastSeenIndex + 1);
23
32
  }
33
+ /**
34
+ * Creates context candidate.
35
+ * @param convId Value supplied to the operation.
36
+ * @param newMsgs Value supplied to the operation.
37
+ * @returns The created context candidate.
38
+ */
24
39
  export function makeContextCandidate(convId, newMsgs) {
25
- const last = newMsgs[newMsgs.length - 1];
40
+ const last =
41
+ /* Safe because the surrounding invariant establishes this asserted shape. */ newMsgs[newMsgs.length - 1];
26
42
  return {
27
43
  convId,
28
44
  newMsgs,
@@ -34,7 +50,8 @@ function minutesSince(timestamp) {
34
50
  }
35
51
  function contextEntryForCandidate(candidate, state, maxMessagesPerConv) {
36
52
  const reportable = candidate.newMsgs.slice(-maxMessagesPerConv);
37
- const last = reportable[reportable.length - 1];
53
+ const last =
54
+ /* Safe because the surrounding invariant establishes this asserted shape. */ reportable[reportable.length - 1];
38
55
  const senderName = getOr(state.agentNamesMap, last.senderId, () => last.senderId);
39
56
  return {
40
57
  entry: {
@@ -48,6 +65,13 @@ function contextEntryForCandidate(candidate, state, maxMessagesPerConv) {
48
65
  advance: [candidate.convId, last.id],
49
66
  };
50
67
  }
68
+ /**
69
+ * Creates context entries.
70
+ * @param candidates Value supplied to the operation.
71
+ * @param state Value supplied to the operation.
72
+ * @param maxMessagesPerConv Value supplied to the operation.
73
+ * @returns The created context entries.
74
+ */
51
75
  export function buildContextEntries(candidates, state, maxMessagesPerConv) {
52
76
  const entries = [];
53
77
  const pendingAdvances = [];
@@ -58,7 +82,13 @@ export function buildContextEntries(candidates, state, maxMessagesPerConv) {
58
82
  }
59
83
  return { entries, pendingAdvances };
60
84
  }
61
- const traceConversationId = (conversation, fallback) => conversation === undefined ? fallback : (conversation["id"] ?? fallback);
85
+ const traceConversationId = (conversation, fallback) => conversation === undefined ? fallback : (conversation.id ?? fallback);
86
+ /**
87
+ * Executes the notification trace record operation.
88
+ * @param notification Value supplied to the operation.
89
+ * @param agentId Identifier of the agent targeted by the operation.
90
+ * @returns The notification trace record result.
91
+ */
62
92
  export function notificationTraceRecord(notification, agentId) {
63
93
  const params = recordOrEmpty(notification.params);
64
94
  const message = recordProperty(params, "message");
@@ -68,11 +98,11 @@ export function notificationTraceRecord(notification, agentId) {
68
98
  ts: new Date().toISOString(),
69
99
  agentId: agentId ?? "unknown",
70
100
  notification: notification.method,
71
- messageId: message?.["id"],
72
- messageConversationId: message?.["conversationId"],
73
- messageSenderId: message?.["senderId"],
101
+ messageId: message?.id,
102
+ messageConversationId: message?.conversationId,
103
+ messageSenderId: message?.senderId,
74
104
  conversationId: traceConversationId(conversation, notificationConversationId),
75
- conversationName: conversation?.["name"],
105
+ conversationName: conversation?.name,
76
106
  };
77
107
  }
78
108
  //# sourceMappingURL=service-helpers.js.map