@maiaos/sdk 0.1.0-canary.10

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 (220) hide show
  1. package/README.md +62 -0
  2. package/dist/agent-permission/agent-permission.d.ts +9 -0
  3. package/dist/agent-permission/agent-permission.js +5 -0
  4. package/dist/agent-permission/effect.d.ts +4 -0
  5. package/dist/agent-permission/effect.js +34 -0
  6. package/dist/agent-permission/index.d.ts +2 -0
  7. package/dist/agent-permission/index.js +2 -0
  8. package/dist/agents/agents.d.ts +11 -0
  9. package/dist/agents/agents.js +5 -0
  10. package/dist/agents/effect.d.ts +5 -0
  11. package/dist/agents/effect.js +59 -0
  12. package/dist/agents/index.d.ts +2 -0
  13. package/dist/agents/index.js +2 -0
  14. package/dist/approval/approval.d.ts +10 -0
  15. package/dist/approval/approval.js +5 -0
  16. package/dist/approval/effect.d.ts +5 -0
  17. package/dist/approval/effect.js +43 -0
  18. package/dist/approval/index.d.ts +2 -0
  19. package/dist/approval/index.js +2 -0
  20. package/dist/call/call.d.ts +26 -0
  21. package/dist/call/call.js +6 -0
  22. package/dist/call/effect.d.ts +5 -0
  23. package/dist/call/effect.js +46 -0
  24. package/dist/call/index.d.ts +2 -0
  25. package/dist/call/index.js +2 -0
  26. package/dist/client/effect.d.ts +8 -0
  27. package/dist/client/effect.js +298 -0
  28. package/dist/client/index.d.ts +2 -0
  29. package/dist/client/index.js +2 -0
  30. package/dist/client/local-node-client.d.ts +106 -0
  31. package/dist/client/local-node-client.js +4 -0
  32. package/dist/connection/connection.d.ts +28 -0
  33. package/dist/connection/connection.js +5 -0
  34. package/dist/connection/effect.d.ts +5 -0
  35. package/dist/connection/effect.js +211 -0
  36. package/dist/connection/index.d.ts +2 -0
  37. package/dist/connection/index.js +2 -0
  38. package/dist/container/container.d.ts +14 -0
  39. package/dist/container/container.js +5 -0
  40. package/dist/container/effect.d.ts +4 -0
  41. package/dist/container/effect.js +90 -0
  42. package/dist/container/index.d.ts +2 -0
  43. package/dist/container/index.js +2 -0
  44. package/dist/discovery/discovery.d.ts +11 -0
  45. package/dist/discovery/discovery.js +5 -0
  46. package/dist/discovery/effect.d.ts +5 -0
  47. package/dist/discovery/effect.js +44 -0
  48. package/dist/discovery/index.d.ts +2 -0
  49. package/dist/discovery/index.js +2 -0
  50. package/dist/execution/effect.d.ts +4 -0
  51. package/dist/execution/effect.js +8 -0
  52. package/dist/execution/index.d.ts +2 -0
  53. package/dist/execution/index.js +2 -0
  54. package/dist/execution/relocation.d.ts +10 -0
  55. package/dist/execution/relocation.js +4 -0
  56. package/dist/feature-bindings/feature-bindings.d.ts +10 -0
  57. package/dist/feature-bindings/feature-bindings.js +2 -0
  58. package/dist/feature-bindings/index.d.ts +2 -0
  59. package/dist/feature-bindings/index.js +2 -0
  60. package/dist/hold/effect.d.ts +5 -0
  61. package/dist/hold/effect.js +61 -0
  62. package/dist/hold/hold.d.ts +12 -0
  63. package/dist/hold/hold.js +5 -0
  64. package/dist/hold/index.d.ts +2 -0
  65. package/dist/hold/index.js +2 -0
  66. package/dist/index.d.ts +29 -0
  67. package/dist/index.js +24 -0
  68. package/dist/interaction/effect.d.ts +5 -0
  69. package/dist/interaction/effect.js +79 -0
  70. package/dist/interaction/index.d.ts +2 -0
  71. package/dist/interaction/index.js +2 -0
  72. package/dist/interaction/interaction.d.ts +12 -0
  73. package/dist/interaction/interaction.js +5 -0
  74. package/dist/node/attach.d.ts +11 -0
  75. package/dist/node/attach.js +33 -0
  76. package/dist/node/bridge-frame.d.ts +18 -0
  77. package/dist/node/bridge-frame.js +67 -0
  78. package/dist/node/bridge.d.ts +55 -0
  79. package/dist/node/bridge.js +286 -0
  80. package/dist/node/deadlines.d.ts +5 -0
  81. package/dist/node/deadlines.js +32 -0
  82. package/dist/node/discovery.d.ts +192 -0
  83. package/dist/node/discovery.js +408 -0
  84. package/dist/node/effect.d.ts +10 -0
  85. package/dist/node/effect.js +10 -0
  86. package/dist/node/fetch.d.ts +2 -0
  87. package/dist/node/fetch.js +2 -0
  88. package/dist/node/http.d.ts +27 -0
  89. package/dist/node/http.js +270 -0
  90. package/dist/node/index.d.ts +3 -0
  91. package/dist/node/index.js +3 -0
  92. package/dist/node/local-node.d.ts +26 -0
  93. package/dist/node/local-node.js +67 -0
  94. package/dist/node/session.d.ts +15 -0
  95. package/dist/node/session.js +27 -0
  96. package/dist/node/ssh.d.ts +29 -0
  97. package/dist/node/ssh.js +122 -0
  98. package/dist/node/transport.d.ts +52 -0
  99. package/dist/node/transport.js +211 -0
  100. package/dist/node-changes/change.d.ts +16 -0
  101. package/dist/node-changes/change.js +16 -0
  102. package/dist/node-changes/effect.d.ts +11 -0
  103. package/dist/node-changes/effect.js +62 -0
  104. package/dist/node-changes/index.d.ts +3 -0
  105. package/dist/node-changes/index.js +3 -0
  106. package/dist/node-changes/node-changes.d.ts +7 -0
  107. package/dist/node-changes/node-changes.js +8 -0
  108. package/dist/port-lease/effect.d.ts +5 -0
  109. package/dist/port-lease/effect.js +53 -0
  110. package/dist/port-lease/index.d.ts +2 -0
  111. package/dist/port-lease/index.js +2 -0
  112. package/dist/port-lease/port-lease.d.ts +11 -0
  113. package/dist/port-lease/port-lease.js +5 -0
  114. package/dist/presentation/client.d.ts +10 -0
  115. package/dist/presentation/client.js +4 -0
  116. package/dist/presentation/effect.d.ts +5 -0
  117. package/dist/presentation/effect.js +30 -0
  118. package/dist/presentation/index.d.ts +5 -0
  119. package/dist/presentation/index.js +3 -0
  120. package/dist/presentation/project-list.d.ts +7 -0
  121. package/dist/presentation/project-list.js +24 -0
  122. package/dist/presentation/session-list.d.ts +7 -0
  123. package/dist/presentation/session-list.js +32 -0
  124. package/dist/project-guard/effect.d.ts +5 -0
  125. package/dist/project-guard/effect.js +39 -0
  126. package/dist/project-guard/index.d.ts +2 -0
  127. package/dist/project-guard/index.js +2 -0
  128. package/dist/project-guard/project-guard.d.ts +10 -0
  129. package/dist/project-guard/project-guard.js +5 -0
  130. package/dist/project-workspace/effect.d.ts +5 -0
  131. package/dist/project-workspace/effect.js +124 -0
  132. package/dist/project-workspace/index.d.ts +2 -0
  133. package/dist/project-workspace/index.js +2 -0
  134. package/dist/project-workspace/project-workspace.d.ts +23 -0
  135. package/dist/project-workspace/project-workspace.js +4 -0
  136. package/dist/provider-pool/effect.d.ts +4 -0
  137. package/dist/provider-pool/effect.js +5 -0
  138. package/dist/provider-pool/index.d.ts +2 -0
  139. package/dist/provider-pool/index.js +2 -0
  140. package/dist/provider-pool/provider-pool.d.ts +7 -0
  141. package/dist/provider-pool/provider-pool.js +4 -0
  142. package/dist/remote-node/effect.d.ts +4 -0
  143. package/dist/remote-node/effect.js +83 -0
  144. package/dist/remote-node/index.d.ts +2 -0
  145. package/dist/remote-node/index.js +2 -0
  146. package/dist/remote-node/remote-node.d.ts +14 -0
  147. package/dist/remote-node/remote-node.js +5 -0
  148. package/dist/request/classify.d.ts +15 -0
  149. package/dist/request/classify.js +97 -0
  150. package/dist/request/client-error.d.ts +11 -0
  151. package/dist/request/client-error.js +20 -0
  152. package/dist/request/effect.d.ts +22 -0
  153. package/dist/request/effect.js +104 -0
  154. package/dist/request/envelope-schema.d.ts +2 -0
  155. package/dist/request/envelope-schema.js +2 -0
  156. package/dist/request/index.d.ts +5 -0
  157. package/dist/request/index.js +4 -0
  158. package/dist/request/maia-client.d.ts +21 -0
  159. package/dist/request/maia-client.js +9 -0
  160. package/dist/request/options.d.ts +10 -0
  161. package/dist/request/options.js +2 -0
  162. package/dist/routine/effect.d.ts +5 -0
  163. package/dist/routine/effect.js +115 -0
  164. package/dist/routine/index.d.ts +2 -0
  165. package/dist/routine/index.js +2 -0
  166. package/dist/routine/routine.d.ts +17 -0
  167. package/dist/routine/routine.js +5 -0
  168. package/dist/run-ledger/effect.d.ts +5 -0
  169. package/dist/run-ledger/effect.js +72 -0
  170. package/dist/run-ledger/index.d.ts +2 -0
  171. package/dist/run-ledger/index.js +2 -0
  172. package/dist/run-ledger/run-ledger.d.ts +12 -0
  173. package/dist/run-ledger/run-ledger.js +2 -0
  174. package/dist/session/effect.d.ts +4 -0
  175. package/dist/session/effect.js +7 -0
  176. package/dist/session/index.d.ts +2 -0
  177. package/dist/session/index.js +2 -0
  178. package/dist/session/mailbox.d.ts +9 -0
  179. package/dist/session/mailbox.js +4 -0
  180. package/dist/session-creation/effect.d.ts +25 -0
  181. package/dist/session-creation/effect.js +269 -0
  182. package/dist/session-creation/index.d.ts +3 -0
  183. package/dist/session-creation/index.js +3 -0
  184. package/dist/session-creation/session-creation.d.ts +18 -0
  185. package/dist/session-creation/session-creation.js +24 -0
  186. package/dist/session-creation/tasks.d.ts +69 -0
  187. package/dist/session-creation/tasks.js +37 -0
  188. package/dist/session-view/index.d.ts +2 -0
  189. package/dist/session-view/index.js +2 -0
  190. package/dist/session-view/view.d.ts +42 -0
  191. package/dist/session-view/view.js +137 -0
  192. package/dist/stream/effect.d.ts +29 -0
  193. package/dist/stream/effect.js +77 -0
  194. package/dist/stream/index.d.ts +2 -0
  195. package/dist/stream/index.js +2 -0
  196. package/dist/stream/stream.d.ts +9 -0
  197. package/dist/stream/stream.js +2 -0
  198. package/dist/team-workspace/effect.d.ts +5 -0
  199. package/dist/team-workspace/effect.js +25 -0
  200. package/dist/team-workspace/index.d.ts +2 -0
  201. package/dist/team-workspace/index.js +2 -0
  202. package/dist/team-workspace/team-workspace.d.ts +9 -0
  203. package/dist/team-workspace/team-workspace.js +5 -0
  204. package/dist/voice/effect.d.ts +7 -0
  205. package/dist/voice/effect.js +71 -0
  206. package/dist/voice/index.d.ts +4 -0
  207. package/dist/voice/index.js +3 -0
  208. package/dist/voice/managed-turn.d.ts +9 -0
  209. package/dist/voice/managed-turn.js +4 -0
  210. package/dist/voice/orchestrator-contract.d.ts +5 -0
  211. package/dist/voice/orchestrator-contract.js +4 -0
  212. package/dist/voice/orchestrator.d.ts +25 -0
  213. package/dist/voice/orchestrator.js +169 -0
  214. package/dist/voice/pi-relay-contract.d.ts +4 -0
  215. package/dist/voice/pi-relay-contract.js +2 -0
  216. package/dist/voice/pi-relay.d.ts +12 -0
  217. package/dist/voice/pi-relay.js +9 -0
  218. package/dist/voice/wire-schema.d.ts +215 -0
  219. package/dist/voice/wire-schema.js +16 -0
  220. package/package.json +84 -0
@@ -0,0 +1,104 @@
1
+ import { localNodeOperationErrorCodeSchema, MAIA_PROTOCOL_VERSION, protocolErrorEnvelopeSchema, protocolRequestEnvelopeSchema, protocolSuccessEnvelopeSchema, } from "@maiaos/protocol";
2
+ import * as Effect from "effect/Effect";
3
+ import { platformStoppedBeforeDispatch } from "./classify.js";
4
+ import { MaiaClientError } from "./client-error.js";
5
+ import { localNodeRequestPayloadParser } from "./envelope-schema.js";
6
+ const transportRequestError = (error, signal) => {
7
+ if (error instanceof MaiaClientError)
8
+ return error;
9
+ const cancelled = signal?.aborted ?? false;
10
+ return new MaiaClientError(cancelled ? "cancelled" : "transport_failure", cancelled
11
+ ? "The Maia request was cancelled."
12
+ : "The Maia transport request failed.", { cause: error });
13
+ };
14
+ export const fromPromiseTransport = (transport) => ({
15
+ request: (envelope, options) => Effect.tryPromise({
16
+ catch: (error) => transportRequestError(error, options?.signal),
17
+ try: () => transport.request(envelope, options),
18
+ }),
19
+ });
20
+ const createRequestEnvelope = (request) => Effect.try({
21
+ catch: (error) => new MaiaClientError("invalid_request", "The Maia request failed runtime validation.", { cause: error }),
22
+ try: () => {
23
+ const envelope = {
24
+ kind: "request",
25
+ messageId: request.messageId,
26
+ payload: request.inputSchema.parse(request.payload),
27
+ protocolVersion: MAIA_PROTOCOL_VERSION,
28
+ };
29
+ protocolRequestEnvelopeSchema.parse(envelope);
30
+ return envelope;
31
+ },
32
+ });
33
+ const requireCorrelation = (response, requestMessageId) => response.correlationId === requestMessageId
34
+ ? Effect.void
35
+ : Effect.fail(new MaiaClientError("correlation_mismatch", "The Maia response did not match the request message."));
36
+ const rejectRemoteError = (rawResponse, requestMessageId) => {
37
+ const response = protocolErrorEnvelopeSchema.safeParse(rawResponse);
38
+ if (!response.success)
39
+ return Effect.void;
40
+ const { error } = response.data.payload;
41
+ return requireCorrelation(response.data, requestMessageId).pipe(Effect.andThen(Effect.suspend(() => {
42
+ const localCode = localNodeOperationErrorCodeSchema.safeParse(error.code);
43
+ return Effect.fail(new MaiaClientError(localCode.success ? localCode.data : "remote_error", error.message, { remoteError: error }));
44
+ })));
45
+ };
46
+ const parseSuccessResult = (rawResponse, requestMessageId) => Effect.try({
47
+ catch: (error) => new MaiaClientError("invalid_response", "The Maia response envelope failed runtime validation.", { cause: error }),
48
+ try: () => protocolSuccessEnvelopeSchema.parse(rawResponse),
49
+ }).pipe(Effect.tap((response) => requireCorrelation(response, requestMessageId)), Effect.map((response) => response.payload.result));
50
+ const parseOutput = (outputSchema, output) => Effect.try({
51
+ catch: (error) => new MaiaClientError("invalid_response", "The Maia response payload failed runtime validation.", { cause: error }),
52
+ try: () => outputSchema.parse(output),
53
+ });
54
+ const cancelledRequest = () => new MaiaClientError("cancelled", "The Maia request was cancelled.");
55
+ export const executeMaiaRequest = (transport, request) => Effect.gen(function* () {
56
+ const envelope = yield* createRequestEnvelope(request);
57
+ const { messageId, outputSchema, signal } = request;
58
+ if (signal?.aborted === true)
59
+ return yield* Effect.fail(cancelledRequest());
60
+ const rawResponse = yield* transport.request(envelope, signal === undefined ? undefined : { signal });
61
+ yield* rejectRemoteError(rawResponse, messageId);
62
+ const output = yield* parseSuccessResult(rawResponse, messageId);
63
+ return yield* parseOutput(outputSchema, output);
64
+ });
65
+ export const makeLocalNodeEffectRequester = (transport, validatePayload = true) => (payload, outputSchema, { messageId, signal }) => executeMaiaRequest(transport, {
66
+ inputSchema: validatePayload
67
+ ? localNodeRequestPayloadParser
68
+ : { parse: () => payload },
69
+ messageId,
70
+ outputSchema,
71
+ payload,
72
+ signal,
73
+ });
74
+ export const fromPromiseRequester = (request) => (payload, outputSchema, options) => Effect.tryPromise({
75
+ catch: (error) => error,
76
+ try: () => request(payload, outputSchema, options),
77
+ });
78
+ const uncertainMutation = (error, cancelledBeforeRequest) => error instanceof MaiaClientError &&
79
+ !platformStoppedBeforeDispatch(error) &&
80
+ (error.code === "invalid_response" ||
81
+ error.code === "correlation_mismatch" ||
82
+ error.code === "transport_failure" ||
83
+ (error.code === "cancelled" && !cancelledBeforeRequest))
84
+ ? new MaiaClientError("outcome_unknown", "The mutation result could not be verified. Reconcile the original command ID.")
85
+ : error;
86
+ export const verifiedMutation = (mutation, options) => Effect.suspend(() => {
87
+ const cancelledBeforeRequest = options.signal?.aborted ?? false;
88
+ return Effect.mapError(mutation, (error) => uncertainMutation(error, cancelledBeforeRequest));
89
+ });
90
+ export const failInvalidResponse = (reject) => Effect.suspend(() => {
91
+ try {
92
+ return reject();
93
+ }
94
+ catch (error) {
95
+ return error instanceof MaiaClientError
96
+ ? Effect.fail(error)
97
+ : Effect.die(error);
98
+ }
99
+ });
100
+ export const toPromiseClient = (client) => Object.fromEntries(Object.entries(client).map(([name, operation]) => [
101
+ name,
102
+ (...arguments_) => Effect.runPromise(operation(...arguments_)),
103
+ ]));
104
+ //# sourceMappingURL=effect.js.map
@@ -0,0 +1,2 @@
1
+ export { localNodeRequestPayloadSchema as localNodeRequestPayloadParser } from "@maiaos/protocol";
2
+ //# sourceMappingURL=envelope-schema.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { localNodeRequestPayloadSchema as localNodeRequestPayloadParser } from "@maiaos/protocol";
2
+ //# sourceMappingURL=envelope-schema.js.map
@@ -0,0 +1,5 @@
1
+ export { classifyClientError, type MaiaError, type MaiaErrorKind, } from "./classify.js";
2
+ export { MaiaClientError, type MaiaClientErrorCode } from "./client-error.js";
3
+ export { type CancellationSignal, createMaiaClient, type MaiaClient, type MaiaRequest, type MaiaTransport, type RuntimeSchema, type TransportRequestOptions, } from "./maia-client.js";
4
+ export type { LocalNodeRequester, LocalNodeRequestOptions } from "./options.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export { classifyClientError, } from "./classify.js";
2
+ export { MaiaClientError } from "./client-error.js";
3
+ export { createMaiaClient, } from "./maia-client.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,21 @@
1
+ import type { ProtocolRequestEnvelope, RuntimeParser } from "@maiaos/protocol";
2
+ export type CancellationSignal = AbortSignal;
3
+ export type TransportRequestOptions = {
4
+ readonly signal?: CancellationSignal;
5
+ };
6
+ export type MaiaTransport = {
7
+ readonly request: (envelope: ProtocolRequestEnvelope<unknown>, options?: TransportRequestOptions) => Promise<unknown>;
8
+ };
9
+ export type RuntimeSchema<TValue> = RuntimeParser<TValue>;
10
+ export type MaiaRequest<TInput, TOutput> = {
11
+ readonly inputSchema: RuntimeSchema<TInput>;
12
+ readonly messageId: string;
13
+ readonly outputSchema: RuntimeSchema<TOutput>;
14
+ readonly payload: TInput;
15
+ readonly signal?: CancellationSignal;
16
+ };
17
+ export type MaiaClient = {
18
+ readonly request: <TInput, TOutput>(request: MaiaRequest<TInput, TOutput>) => Promise<TOutput>;
19
+ };
20
+ export declare const createMaiaClient: (transport: MaiaTransport) => MaiaClient;
21
+ //# sourceMappingURL=maia-client.d.ts.map
@@ -0,0 +1,9 @@
1
+ import * as Effect from "effect/Effect";
2
+ import { executeMaiaRequest, fromPromiseTransport } from "./effect.js";
3
+ export const createMaiaClient = (transport) => {
4
+ const effectTransport = fromPromiseTransport(transport);
5
+ return {
6
+ request: (request) => Effect.runPromise(executeMaiaRequest(effectTransport, request)),
7
+ };
8
+ };
9
+ //# sourceMappingURL=maia-client.js.map
@@ -0,0 +1,10 @@
1
+ import type { LocalNodeRequestPayload } from "@maiaos/protocol";
2
+ export type LocalNodeRequestOptions = {
3
+ readonly deadlineAt?: bigint;
4
+ readonly messageId: string;
5
+ readonly signal?: AbortSignal;
6
+ };
7
+ export type LocalNodeRequester = <TOutput>(payload: LocalNodeRequestPayload, outputSchema: {
8
+ readonly parse: (value: unknown) => TOutput;
9
+ }, options: LocalNodeRequestOptions) => Promise<TOutput>;
10
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1,5 @@
1
+ import { type EffectClient, type LocalNodeEffectRequester } from "../request/effect.js";
2
+ import { MaiaClientError } from "../request/index.js";
3
+ import type { RoutineClient } from "./routine.js";
4
+ export declare const makeRoutineOperations: <TError>(request: LocalNodeEffectRequester<TError>) => EffectClient<RoutineClient, MaiaClientError | TError>;
5
+ //# sourceMappingURL=effect.d.ts.map
@@ -0,0 +1,115 @@
1
+ import { routineCreateConfirmResultSchema, routineCreatePreviewResultSchema, routineDisableConfirmResultSchema, routineDisablePreviewResultSchema, routineListResultSchema, routinePauseResultSchema, routineResumeResultSchema, routineRunConfirmResultSchema, routineRunPreviewResultSchema, routineShowResultSchema, } from "@maiaos/protocol";
2
+ import { verifiedMutation, } from "../request/effect.js";
3
+ import { MaiaClientError, } from "../request/index.js";
4
+ const requireMatch = (matches) => {
5
+ if (!matches)
6
+ throw new MaiaClientError("invalid_response", "The routine response did not match the request.");
7
+ };
8
+ const createMatches = (result, input) => result.commandId === input.commandId &&
9
+ result.name === input.name &&
10
+ JSON.stringify(result.schedule) === JSON.stringify(input.schedule) &&
11
+ result.template.projectId === input.template.projectId;
12
+ const parsePreview = (value, parameters) => {
13
+ const result = routineCreatePreviewResultSchema.parse(value);
14
+ requireMatch(createMatches(result, parameters));
15
+ return result;
16
+ };
17
+ const parseConfirmation = (value, parameters) => {
18
+ const result = routineCreateConfirmResultSchema.parse(value);
19
+ requireMatch(result.inputDigest === parameters.inputDigest &&
20
+ createMatches({ ...result.routine, commandId: result.commandId }, parameters));
21
+ return result;
22
+ };
23
+ const parseList = (value, parameters) => {
24
+ const result = routineListResultSchema.parse(value);
25
+ requireMatch(result.items.length <= parameters.limit &&
26
+ result.items.every((routine) => (parameters.state === undefined ||
27
+ routine.state === parameters.state) &&
28
+ (parameters.projectId === undefined ||
29
+ routine.template.projectId === parameters.projectId)));
30
+ return result;
31
+ };
32
+ const parseShow = (value, parameters) => {
33
+ const result = routineShowResultSchema.parse(value);
34
+ requireMatch(result.routine.id === parameters.routineId &&
35
+ result.fires.every((fire) => fire.routineId === parameters.routineId));
36
+ return result;
37
+ };
38
+ const parseTransitionPreview = (schema) => (value, parameters) => {
39
+ const result = schema.parse(value);
40
+ requireMatch(result.commandId === parameters.commandId &&
41
+ result.expectedRevision === parameters.expectedRevision &&
42
+ result.routineId === parameters.routineId);
43
+ return result;
44
+ };
45
+ const parseDisablePreview = parseTransitionPreview(routineDisablePreviewResultSchema);
46
+ const parseRunPreview = parseTransitionPreview(routineRunPreviewResultSchema);
47
+ const parseRun = (value, parameters) => {
48
+ const result = routineRunConfirmResultSchema.parse(value);
49
+ requireMatch(result.fire.routineId === parameters.routineId &&
50
+ result.receipt.commandId === parameters.commandId);
51
+ return result;
52
+ };
53
+ const parseChange = (schema) => (value, parameters) => {
54
+ const result = schema.parse(value);
55
+ requireMatch(result.routine.id === parameters.routineId &&
56
+ result.receipt.commandId === parameters.commandId);
57
+ return result;
58
+ };
59
+ const query = (request, payload, parse) => (parameters, options) => request(payload(parameters), { parse: (value) => parse(value, parameters) }, options);
60
+ const change = (request, payload, parse) => (parameters, options) => verifiedMutation(query(request, payload, parse)(parameters, options), options);
61
+ const payloadOf = {
62
+ create: (parameters) => ({
63
+ method: "routine.create.confirm",
64
+ parameters,
65
+ }),
66
+ createPreview: (parameters) => ({
67
+ method: "routine.create.preview",
68
+ parameters,
69
+ }),
70
+ disable: (parameters) => ({
71
+ method: "routine.disable.confirm",
72
+ parameters,
73
+ }),
74
+ disablePreview: (parameters) => ({
75
+ method: "routine.disable.preview",
76
+ parameters,
77
+ }),
78
+ list: (parameters) => ({
79
+ method: "routine.list",
80
+ parameters,
81
+ }),
82
+ pause: (parameters) => ({
83
+ method: "routine.pause",
84
+ parameters,
85
+ }),
86
+ resume: (parameters) => ({ method: "routine.resume", parameters }),
87
+ run: (parameters) => ({
88
+ method: "routine.run.confirm",
89
+ parameters,
90
+ }),
91
+ runPreview: (parameters) => ({
92
+ method: "routine.run.preview",
93
+ parameters,
94
+ }),
95
+ show: (parameters) => ({
96
+ method: "routine.show",
97
+ parameters,
98
+ }),
99
+ };
100
+ const parseDisable = parseChange(routineDisableConfirmResultSchema);
101
+ const parsePause = parseChange(routinePauseResultSchema);
102
+ const parseResume = parseChange(routineResumeResultSchema);
103
+ export const makeRoutineOperations = (request) => ({
104
+ confirmRoutineCreate: change(request, payloadOf.create, parseConfirmation),
105
+ confirmRoutineDisable: change(request, payloadOf.disable, parseDisable),
106
+ confirmRoutineRun: change(request, payloadOf.run, parseRun),
107
+ listRoutines: query(request, payloadOf.list, parseList),
108
+ pauseRoutine: change(request, payloadOf.pause, parsePause),
109
+ previewRoutineCreate: query(request, payloadOf.createPreview, parsePreview),
110
+ previewRoutineDisable: query(request, payloadOf.disablePreview, parseDisablePreview),
111
+ previewRoutineRun: query(request, payloadOf.runPreview, parseRunPreview),
112
+ resumeRoutine: change(request, payloadOf.resume, parseResume),
113
+ showRoutine: query(request, payloadOf.show, parseShow),
114
+ });
115
+ //# sourceMappingURL=effect.js.map
@@ -0,0 +1,2 @@
1
+ export { makeRoutineClient, MAX_LIVE_ROUTINES_PER_PROJECT, MAX_ROUTINE_PAGE_SIZE, MAX_ROUTINE_PREVIEW_FIRES, MAX_ROUTINE_SHOWN_FIRES, MIN_ROUTINE_INTERVAL_MINUTES, type Routine, ROUTINE_ERROR_CODES, ROUTINE_FIRE_REASONS, type RoutineClient, type RoutineCreateConfirmParameters, routineCreateConfirmParametersSchema, type RoutineCreateConfirmResult, type RoutineCreatePreviewParameters, routineCreatePreviewParametersSchema, type RoutineCreatePreviewResult, type RoutineDisableConfirmParameters, routineDisableConfirmParametersSchema, type RoutineDisableConfirmResult, type RoutineDisablePreviewParameters, routineDisablePreviewParametersSchema, type RoutineDisablePreviewResult, type RoutineFire, type RoutineListParameters, routineListParametersSchema, type RoutineListResult, type RoutinePauseResult, type RoutineResumeResult, type RoutineRunConfirmParameters, routineRunConfirmParametersSchema, type RoutineRunConfirmResult, type RoutineRunPreviewResult, type RoutineSchedule, routineSchema, type RoutineShowParameters, routineShowParametersSchema, type RoutineShowResult, type RoutineTemplate, type RoutineTransitionParameters, routineTransitionParametersSchema, } from "./routine.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { makeRoutineClient, MAX_LIVE_ROUTINES_PER_PROJECT, MAX_ROUTINE_PAGE_SIZE, MAX_ROUTINE_PREVIEW_FIRES, MAX_ROUTINE_SHOWN_FIRES, MIN_ROUTINE_INTERVAL_MINUTES, ROUTINE_ERROR_CODES, ROUTINE_FIRE_REASONS, routineCreateConfirmParametersSchema, routineCreatePreviewParametersSchema, routineDisableConfirmParametersSchema, routineDisablePreviewParametersSchema, routineListParametersSchema, routineRunConfirmParametersSchema, routineSchema, routineShowParametersSchema, routineTransitionParametersSchema, } from "./routine.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,17 @@
1
+ import type { RoutineCreateConfirmParameters, RoutineCreateConfirmResult, RoutineCreatePreviewParameters, RoutineCreatePreviewResult, RoutineDisableConfirmParameters, RoutineDisableConfirmResult, RoutineDisablePreviewParameters, RoutineDisablePreviewResult, RoutineListParameters, RoutineListResult, RoutinePauseResult, RoutineResumeResult, RoutineRunConfirmParameters, RoutineRunConfirmResult, RoutineRunPreviewResult, RoutineShowParameters, RoutineShowResult, RoutineTransitionParameters } from "@maiaos/protocol";
2
+ import type { LocalNodeRequester, LocalNodeRequestOptions } from "../request/index.js";
3
+ export type RoutineClient = {
4
+ readonly confirmRoutineCreate: (parameters: RoutineCreateConfirmParameters, options: LocalNodeRequestOptions) => Promise<RoutineCreateConfirmResult>;
5
+ readonly confirmRoutineDisable: (parameters: RoutineDisableConfirmParameters, options: LocalNodeRequestOptions) => Promise<RoutineDisableConfirmResult>;
6
+ readonly confirmRoutineRun: (parameters: RoutineRunConfirmParameters, options: LocalNodeRequestOptions) => Promise<RoutineRunConfirmResult>;
7
+ readonly listRoutines: (parameters: RoutineListParameters, options: LocalNodeRequestOptions) => Promise<RoutineListResult>;
8
+ readonly pauseRoutine: (parameters: RoutineTransitionParameters, options: LocalNodeRequestOptions) => Promise<RoutinePauseResult>;
9
+ readonly previewRoutineCreate: (parameters: RoutineCreatePreviewParameters, options: LocalNodeRequestOptions) => Promise<RoutineCreatePreviewResult>;
10
+ readonly previewRoutineDisable: (parameters: RoutineDisablePreviewParameters, options: LocalNodeRequestOptions) => Promise<RoutineDisablePreviewResult>;
11
+ readonly previewRoutineRun: (parameters: RoutineTransitionParameters, options: LocalNodeRequestOptions) => Promise<RoutineRunPreviewResult>;
12
+ readonly resumeRoutine: (parameters: RoutineTransitionParameters, options: LocalNodeRequestOptions) => Promise<RoutineResumeResult>;
13
+ readonly showRoutine: (parameters: RoutineShowParameters, options: LocalNodeRequestOptions) => Promise<RoutineShowResult>;
14
+ };
15
+ export declare const makeRoutineClient: (request: LocalNodeRequester) => RoutineClient;
16
+ export { MAX_LIVE_ROUTINES_PER_PROJECT, MAX_ROUTINE_PAGE_SIZE, MAX_ROUTINE_PREVIEW_FIRES, MAX_ROUTINE_SHOWN_FIRES, MIN_ROUTINE_INTERVAL_MINUTES, type Routine, ROUTINE_ERROR_CODES, ROUTINE_FIRE_REASONS, type RoutineCreateConfirmParameters, routineCreateConfirmParametersSchema, type RoutineCreateConfirmResult, type RoutineCreatePreviewParameters, routineCreatePreviewParametersSchema, type RoutineCreatePreviewResult, type RoutineDisableConfirmParameters, routineDisableConfirmParametersSchema, type RoutineDisableConfirmResult, type RoutineDisablePreviewParameters, routineDisablePreviewParametersSchema, type RoutineDisablePreviewResult, type RoutineFire, type RoutineListParameters, routineListParametersSchema, type RoutineListResult, type RoutinePauseResult, type RoutineResumeResult, type RoutineRunConfirmParameters, routineRunConfirmParametersSchema, type RoutineRunConfirmResult, type RoutineRunPreviewResult, type RoutineSchedule, routineSchema, type RoutineShowParameters, routineShowParametersSchema, type RoutineShowResult, type RoutineTemplate, type RoutineTransitionParameters, routineTransitionParametersSchema, } from "@maiaos/protocol";
17
+ //# sourceMappingURL=routine.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { fromPromiseRequester, toPromiseClient } from "../request/effect.js";
2
+ import { makeRoutineOperations } from "./effect.js";
3
+ export const makeRoutineClient = (request) => toPromiseClient(makeRoutineOperations(fromPromiseRequester(request)));
4
+ export { MAX_LIVE_ROUTINES_PER_PROJECT, MAX_ROUTINE_PAGE_SIZE, MAX_ROUTINE_PREVIEW_FIRES, MAX_ROUTINE_SHOWN_FIRES, MIN_ROUTINE_INTERVAL_MINUTES, ROUTINE_ERROR_CODES, ROUTINE_FIRE_REASONS, routineCreateConfirmParametersSchema, routineCreatePreviewParametersSchema, routineDisableConfirmParametersSchema, routineDisablePreviewParametersSchema, routineListParametersSchema, routineRunConfirmParametersSchema, routineSchema, routineShowParametersSchema, routineTransitionParametersSchema, } from "@maiaos/protocol";
5
+ //# sourceMappingURL=routine.js.map
@@ -0,0 +1,5 @@
1
+ import { type EffectClient, type LocalNodeEffectRequester } from "../request/effect.js";
2
+ import { MaiaClientError } from "../request/index.js";
3
+ import type { RunLedgerClient } from "./run-ledger.js";
4
+ export declare const makeRunLedgerOperations: <TError>(request: LocalNodeEffectRequester<TError>) => EffectClient<RunLedgerClient, MaiaClientError | TError>;
5
+ //# sourceMappingURL=effect.d.ts.map
@@ -0,0 +1,72 @@
1
+ import { runLedgerCreateResultSchema, runLedgerListResultSchema, runLedgerTaskDispatchResultSchema, runLedgerTaskListResultSchema, runLedgerTaskSettleResultSchema, runLedgerTaskShowResultSchema, } from "@maiaos/protocol";
2
+ import { verifiedMutation, } from "../request/effect.js";
3
+ import { MaiaClientError } from "../request/index.js";
4
+ const requireMatch = (matches) => {
5
+ if (!matches)
6
+ throw new MaiaClientError("invalid_response", "The Run ledger response did not match the request.");
7
+ };
8
+ const parseCreate = (value, input) => {
9
+ const result = runLedgerCreateResultSchema.parse(value);
10
+ requireMatch(result.commandId === input.commandId &&
11
+ result.run.workspaceId === input.workspaceId &&
12
+ result.tasks.map((task) => task.clientKey).join("\n") ===
13
+ input.tasks.map((task) => task.clientKey).join("\n"));
14
+ return result;
15
+ };
16
+ const parseDispatch = (value, input) => {
17
+ const result = runLedgerTaskDispatchResultSchema.parse(value);
18
+ requireMatch(result.commandId === input.commandId &&
19
+ result.task.runId === input.runId &&
20
+ result.task.id === input.taskId &&
21
+ result.dispatch.sessionId === input.sessionId &&
22
+ BigInt(result.task.revision) === BigInt(input.expectedTaskRevision) + 1n);
23
+ return result;
24
+ };
25
+ const parseSettle = (value, input) => {
26
+ const result = runLedgerTaskSettleResultSchema.parse(value);
27
+ const settled = result.task.dispatches.at(-1);
28
+ requireMatch(result.commandId === input.commandId &&
29
+ result.task.runId === input.runId &&
30
+ result.task.id === input.taskId &&
31
+ settled?.sessionId === input.sessionId &&
32
+ settled.state === input.outcome &&
33
+ settled.evidence === input.evidence &&
34
+ (input.turnId === undefined || settled.settledTurnId === input.turnId) &&
35
+ BigInt(result.task.revision) === BigInt(input.expectedTaskRevision) + 1n);
36
+ return result;
37
+ };
38
+ const parseList = (value, input) => {
39
+ const result = runLedgerListResultSchema.parse(value);
40
+ requireMatch(result.items.length <= input.limit &&
41
+ result.items.every((run) => run.workspaceId === input.workspaceId) &&
42
+ (result.nextCursor === undefined ||
43
+ result.nextCursor !== input.afterCursor));
44
+ return result;
45
+ };
46
+ const parseTaskList = (value, input) => {
47
+ const result = runLedgerTaskListResultSchema.parse(value);
48
+ requireMatch(result.run.id === input.runId &&
49
+ (input.ready !== true ||
50
+ result.items.every((task) => task.state === "ready")));
51
+ return result;
52
+ };
53
+ const parseTaskShow = (value, input) => {
54
+ const result = runLedgerTaskShowResultSchema.parse(value);
55
+ requireMatch(result.task.runId === input.runId && result.task.id === input.taskId);
56
+ return result;
57
+ };
58
+ const makeRunLedgerMutations = (request) => ({
59
+ createRunLedger: (parameters, options) => request({ method: "run.ledger.create", parameters }, { parse: (value) => parseCreate(value, parameters) }, options),
60
+ dispatchRunLedgerTask: (parameters, options) => request({ method: "run.ledger.task.dispatch", parameters }, { parse: (value) => parseDispatch(value, parameters) }, options),
61
+ settleRunLedgerTask: (parameters, options) => request({ method: "run.ledger.task.settle", parameters }, { parse: (value) => parseSettle(value, parameters) }, options),
62
+ });
63
+ export const makeRunLedgerOperations = (request) => {
64
+ const verified = (payload, output, options) => verifiedMutation(request(payload, output, options), options);
65
+ return {
66
+ ...makeRunLedgerMutations(verified),
67
+ listRunLedgers: (parameters, options) => request({ method: "run.ledger.list", parameters }, { parse: (value) => parseList(value, parameters) }, options),
68
+ listRunLedgerTasks: (parameters, options) => request({ method: "run.ledger.task.list", parameters }, { parse: (value) => parseTaskList(value, parameters) }, options),
69
+ showRunLedgerTask: (parameters, options) => request({ method: "run.ledger.task.show", parameters }, { parse: (value) => parseTaskShow(value, parameters) }, options),
70
+ };
71
+ };
72
+ //# sourceMappingURL=effect.js.map
@@ -0,0 +1,2 @@
1
+ export { MAX_RUN_LEDGER_EVIDENCE_BYTES, MAX_RUN_LEDGER_FAILED_DISPATCHES, MAX_RUN_LEDGER_LIST_PAGE_SIZE, RUN_LEDGER_ERROR_CODES, RUN_LEDGER_SCHEMA_VERSION, type RunLedgerClient, type RunLedgerCreateParameters, runLedgerCreateParametersSchema, type RunLedgerCreateResult, runLedgerCreateResultSchema, type RunLedgerDispatch, type RunLedgerDispatchSummary, type RunLedgerErrorCode, type RunLedgerListParameters, runLedgerListParametersSchema, type RunLedgerListResult, runLedgerListResultSchema, type RunLedgerRun, type RunLedgerTask, type RunLedgerTaskDispatchParameters, runLedgerTaskDispatchParametersSchema, type RunLedgerTaskDispatchResult, runLedgerTaskDispatchResultSchema, type RunLedgerTaskListParameters, runLedgerTaskListParametersSchema, type RunLedgerTaskListResult, runLedgerTaskListResultSchema, type RunLedgerTaskSettleParameters, runLedgerTaskSettleParametersSchema, type RunLedgerTaskSettleResult, runLedgerTaskSettleResultSchema, type RunLedgerTaskShowParameters, runLedgerTaskShowParametersSchema, type RunLedgerTaskShowResult, runLedgerTaskShowResultSchema, type RunLedgerTaskSummary, } from "./run-ledger.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { MAX_RUN_LEDGER_EVIDENCE_BYTES, MAX_RUN_LEDGER_FAILED_DISPATCHES, MAX_RUN_LEDGER_LIST_PAGE_SIZE, RUN_LEDGER_ERROR_CODES, RUN_LEDGER_SCHEMA_VERSION, runLedgerCreateParametersSchema, runLedgerCreateResultSchema, runLedgerListParametersSchema, runLedgerListResultSchema, runLedgerTaskDispatchParametersSchema, runLedgerTaskDispatchResultSchema, runLedgerTaskListParametersSchema, runLedgerTaskListResultSchema, runLedgerTaskSettleParametersSchema, runLedgerTaskSettleResultSchema, runLedgerTaskShowParametersSchema, runLedgerTaskShowResultSchema, } from "./run-ledger.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,12 @@
1
+ import type { RunLedgerCreateParameters, RunLedgerCreateResult, RunLedgerListParameters, RunLedgerListResult, RunLedgerTaskDispatchParameters, RunLedgerTaskDispatchResult, RunLedgerTaskListParameters, RunLedgerTaskListResult, RunLedgerTaskSettleParameters, RunLedgerTaskSettleResult, RunLedgerTaskShowParameters, RunLedgerTaskShowResult } from "@maiaos/protocol";
2
+ import type { LocalNodeRequestOptions } from "../request/index.js";
3
+ export type RunLedgerClient = {
4
+ readonly createRunLedger: (parameters: RunLedgerCreateParameters, options: LocalNodeRequestOptions) => Promise<RunLedgerCreateResult>;
5
+ readonly dispatchRunLedgerTask: (parameters: RunLedgerTaskDispatchParameters, options: LocalNodeRequestOptions) => Promise<RunLedgerTaskDispatchResult>;
6
+ readonly listRunLedgers: (parameters: RunLedgerListParameters, options: LocalNodeRequestOptions) => Promise<RunLedgerListResult>;
7
+ readonly listRunLedgerTasks: (parameters: RunLedgerTaskListParameters, options: LocalNodeRequestOptions) => Promise<RunLedgerTaskListResult>;
8
+ readonly settleRunLedgerTask: (parameters: RunLedgerTaskSettleParameters, options: LocalNodeRequestOptions) => Promise<RunLedgerTaskSettleResult>;
9
+ readonly showRunLedgerTask: (parameters: RunLedgerTaskShowParameters, options: LocalNodeRequestOptions) => Promise<RunLedgerTaskShowResult>;
10
+ };
11
+ export { MAX_RUN_LEDGER_EVIDENCE_BYTES, MAX_RUN_LEDGER_FAILED_DISPATCHES, MAX_RUN_LEDGER_LIST_PAGE_SIZE, RUN_LEDGER_ERROR_CODES, RUN_LEDGER_SCHEMA_VERSION, type RunLedgerCreateParameters, runLedgerCreateParametersSchema, type RunLedgerCreateResult, runLedgerCreateResultSchema, type RunLedgerDispatch, type RunLedgerDispatchSummary, type RunLedgerErrorCode, type RunLedgerListParameters, runLedgerListParametersSchema, type RunLedgerListResult, runLedgerListResultSchema, type RunLedgerRun, type RunLedgerTask, type RunLedgerTaskDispatchParameters, runLedgerTaskDispatchParametersSchema, type RunLedgerTaskDispatchResult, runLedgerTaskDispatchResultSchema, type RunLedgerTaskListParameters, runLedgerTaskListParametersSchema, type RunLedgerTaskListResult, runLedgerTaskListResultSchema, type RunLedgerTaskSettleParameters, runLedgerTaskSettleParametersSchema, type RunLedgerTaskSettleResult, runLedgerTaskSettleResultSchema, type RunLedgerTaskShowParameters, runLedgerTaskShowParametersSchema, type RunLedgerTaskShowResult, runLedgerTaskShowResultSchema, type RunLedgerTaskSummary, } from "@maiaos/protocol";
12
+ //# sourceMappingURL=run-ledger.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { MAX_RUN_LEDGER_EVIDENCE_BYTES, MAX_RUN_LEDGER_FAILED_DISPATCHES, MAX_RUN_LEDGER_LIST_PAGE_SIZE, RUN_LEDGER_ERROR_CODES, RUN_LEDGER_SCHEMA_VERSION, runLedgerCreateParametersSchema, runLedgerCreateResultSchema, runLedgerListParametersSchema, runLedgerListResultSchema, runLedgerTaskDispatchParametersSchema, runLedgerTaskDispatchResultSchema, runLedgerTaskListParametersSchema, runLedgerTaskListResultSchema, runLedgerTaskSettleParametersSchema, runLedgerTaskSettleResultSchema, runLedgerTaskShowParametersSchema, runLedgerTaskShowResultSchema, } from "@maiaos/protocol";
2
+ //# sourceMappingURL=run-ledger.js.map
@@ -0,0 +1,4 @@
1
+ import type { EffectClient, LocalNodeEffectRequester } from "../request/effect.js";
2
+ import type { SessionMailboxClient } from "./mailbox.js";
3
+ export declare const makeSessionMailboxOperations: <TError>(request: LocalNodeEffectRequester<TError>) => EffectClient<SessionMailboxClient, TError>;
4
+ //# sourceMappingURL=effect.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { sessionInboxAckResultSchema, sessionInboxCheckResultSchema, sessionMessageSendResultSchema, } from "@maiaos/protocol";
2
+ export const makeSessionMailboxOperations = (request) => ({
3
+ acknowledgeSessionDelivery: (parameters, options) => request({ method: "session.inbox.ack", parameters }, sessionInboxAckResultSchema, options),
4
+ checkSessionInbox: (parameters, options) => request({ method: "session.inbox.check", parameters }, sessionInboxCheckResultSchema, options),
5
+ sendSessionMessage: (parameters, options) => request({ method: "session.message.send", parameters }, sessionMessageSendResultSchema, options),
6
+ });
7
+ //# sourceMappingURL=effect.js.map
@@ -0,0 +1,2 @@
1
+ export { makeSessionMailboxClient, type SessionMailboxClient, } from "./mailbox.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { makeSessionMailboxClient, } from "./mailbox.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ import type { SessionInboxAckParameters, SessionInboxAckResult, SessionInboxCheckParameters, SessionInboxCheckResult, SessionMessageSendParameters, SessionMessageSendResult } from "@maiaos/protocol";
2
+ import type { LocalNodeRequester, LocalNodeRequestOptions } from "../request/index.js";
3
+ export type SessionMailboxClient = {
4
+ readonly acknowledgeSessionDelivery: (parameters: SessionInboxAckParameters, options: LocalNodeRequestOptions) => Promise<SessionInboxAckResult>;
5
+ readonly checkSessionInbox: (parameters: SessionInboxCheckParameters, options: LocalNodeRequestOptions) => Promise<SessionInboxCheckResult>;
6
+ readonly sendSessionMessage: (parameters: SessionMessageSendParameters, options: LocalNodeRequestOptions) => Promise<SessionMessageSendResult>;
7
+ };
8
+ export declare const makeSessionMailboxClient: (request: LocalNodeRequester) => SessionMailboxClient;
9
+ //# sourceMappingURL=mailbox.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { fromPromiseRequester, toPromiseClient } from "../request/effect.js";
2
+ import { makeSessionMailboxOperations } from "./effect.js";
3
+ export const makeSessionMailboxClient = (request) => toPromiseClient(makeSessionMailboxOperations(fromPromiseRequester(request)));
4
+ //# sourceMappingURL=mailbox.js.map
@@ -0,0 +1,25 @@
1
+ import type { Session } from "@maiaos/protocol";
2
+ import * as Crypto from "effect/Crypto";
3
+ import * as Effect from "effect/Effect";
4
+ import type { EffectClient } from "../request/effect.js";
5
+ import { MaiaClientError } from "../request/index.js";
6
+ import { type SessionCreationClient, type SessionCreationInput, type SessionCreationOutcome, type SessionCreationPlan } from "./tasks.js";
7
+ export type SessionCreationEffectClient<TError = MaiaClientError> = EffectClient<SessionCreationClient, TError>;
8
+ export type NextIdentifier = (prefix: "command" | "request") => Effect.Effect<string>;
9
+ export declare const fromPromiseClient: <TClient extends Partial<SessionCreationClient>>(client: TClient) => EffectClient<TClient, unknown>;
10
+ export declare const planSessionCreationWith: <TError>(client: SessionCreationEffectClient<TError>, input: SessionCreationInput, nextId: NextIdentifier) => Effect.Effect<SessionCreationPlan, MaiaClientError | TError>;
11
+ export declare const awaitSessionRunningWith: <TError>(client: Pick<SessionCreationEffectClient<TError>, "showSession">, sessionId: string, options: {
12
+ readonly deadlineMilliseconds: number;
13
+ readonly nextId: NextIdentifier;
14
+ }) => Effect.Effect<Session, MaiaClientError | TError>;
15
+ type RunOptions = {
16
+ readonly nextId: NextIdentifier;
17
+ readonly previous?: readonly SessionCreationOutcome[];
18
+ readonly report?: (outcomes: readonly SessionCreationOutcome[]) => Effect.Effect<void>;
19
+ };
20
+ export declare const createSessionsWith: <TError>(client: SessionCreationEffectClient<TError>, plan: SessionCreationPlan, options: RunOptions) => Effect.Effect<readonly SessionCreationOutcome[]>;
21
+ export declare const planSessionCreationEffect: (client: SessionCreationEffectClient, input: SessionCreationInput) => Effect.Effect<SessionCreationPlan, MaiaClientError, Crypto.Crypto>;
22
+ export declare const createSessionsEffect: (client: SessionCreationEffectClient, plan: SessionCreationPlan, options?: Omit<RunOptions, "nextId">) => Effect.Effect<readonly SessionCreationOutcome[], never, Crypto.Crypto>;
23
+ export declare const awaitSessionRunningEffect: (client: Pick<SessionCreationEffectClient, "showSession">, sessionId: string, deadlineMilliseconds: number) => Effect.Effect<Session, MaiaClientError, Crypto.Crypto>;
24
+ export {};
25
+ //# sourceMappingURL=effect.d.ts.map