@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,77 @@
1
+ import * as Cause from "effect/Cause";
2
+ import * as Duration from "effect/Duration";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Option from "effect/Option";
5
+ import * as Queue from "effect/Queue";
6
+ import * as Ref from "effect/Ref";
7
+ import * as Stream from "effect/Stream";
8
+ import { MaiaClientError } from "../request/index.js";
9
+ export const RESNAPSHOT = { kind: "resnapshot" };
10
+ export const MAX_BUFFERED_FRAMES = 256;
11
+ const MAX_RESNAPSHOTS = 3;
12
+ const RECONNECT_AFTER = Duration.seconds(2);
13
+ const RESUBSCRIBE_AFTER = Duration.millis(250);
14
+ const RELAY_CLOSED = Symbol("relay closed");
15
+ const OVERFLOWED = Symbol("buffer overflowed");
16
+ const ended = (reason) => new MaiaClientError("transport_failure", reason === RELAY_CLOSED
17
+ ? "The Maia Node stream relay closed."
18
+ : "The Maia Node stream outran its consumer.", { cause: reason });
19
+ const invalidFrame = () => new MaiaClientError("invalid_response", "The Maia Node stream frame is invalid.");
20
+ const tooManyResnapshots = () => new MaiaClientError("saturated", "The Maia Node stream keeps asking for a fresh snapshot.");
21
+ const fail = (queue, error) => {
22
+ Queue.failCauseUnsafe(queue, Cause.fail(error));
23
+ };
24
+ const offer = (queue, decode, terminal) => (event) => {
25
+ if (event.kind === "closed") {
26
+ fail(queue, ended(RELAY_CLOSED));
27
+ return;
28
+ }
29
+ const frame = decode(event.text);
30
+ if (Option.isNone(frame)) {
31
+ fail(queue, invalidFrame());
32
+ return;
33
+ }
34
+ if (!Queue.offerUnsafe(queue, frame.value)) {
35
+ fail(queue, ended(OVERFLOWED));
36
+ return;
37
+ }
38
+ if (terminal(frame.value))
39
+ Queue.endUnsafe(queue);
40
+ };
41
+ const subscribeFailed = (cause) => new MaiaClientError("transport_failure", "The Maia Node stream relay could not subscribe.", { cause });
42
+ const relayInto = (input, queue, subscribe) => Effect.acquireRelease(Effect.tryPromise({
43
+ catch: subscribeFailed,
44
+ try: () => input.relay(input.subscribe(subscribe.messageId, subscribe.cursor), offer(queue, (text) => input.decode(text, subscribe.messageId), input.terminal)),
45
+ }), (cancel) => Effect.ignore(Effect.tryPromise(() => Promise.resolve(cancel())))).pipe(Effect.catch((error) => Effect.sync(() => {
46
+ fail(queue, error);
47
+ })));
48
+ const subscription = (input, cursor) => Stream.unwrap(Effect.map(input.nextId("request"), (messageId) => Stream.callback((queue) => relayInto(input, queue, {
49
+ messageId,
50
+ ...(cursor === undefined ? {} : { cursor }),
51
+ }), { bufferSize: MAX_BUFFERED_FRAMES, strategy: "suspend" })));
52
+ const advance = (position, frame, step) => {
53
+ if (step.kind === "error")
54
+ return Effect.fail(new MaiaClientError("remote_error", step.error.message, {
55
+ remoteError: step.error,
56
+ }));
57
+ if (step.kind === "resnapshot")
58
+ return resnapshot(position);
59
+ return Effect.as(Ref.update(position, (current) => ({
60
+ cursor: step.cursor === undefined ? current.cursor : Option.some(step.cursor),
61
+ resnapshots: 0,
62
+ })), frame);
63
+ };
64
+ const resnapshot = (position) => Effect.flatMap(Ref.updateAndGet(position, (current) => ({
65
+ cursor: Option.none(),
66
+ resnapshots: current.resnapshots + 1,
67
+ })), (current) => current.resnapshots > MAX_RESNAPSHOTS
68
+ ? Effect.fail(tooManyResnapshots())
69
+ : Effect.succeed(RESNAPSHOT));
70
+ const endedBy = (reason) => (error) => error.cause === reason;
71
+ const pause = (duration) => Stream.drain(Stream.fromEffect(Effect.sleep(duration)));
72
+ const once = (input, position) => Stream.unwrap(Effect.map(Ref.get(position), ({ cursor }) => subscription(input, Option.getOrUndefined(cursor)))).pipe(Stream.mapEffect((frame) => advance(position, frame, input.step(frame))));
73
+ export const resumeStream = (input) => Stream.unwrap(Effect.map(Ref.make({ cursor: Option.none(), resnapshots: 0 }), (position) => {
74
+ const resumed = once(input, position).pipe(Stream.catchIf(endedBy(RELAY_CLOSED), () => pause(RECONNECT_AFTER)), Stream.catchIf(endedBy(OVERFLOWED), () => Stream.fromEffect(resnapshot(position))), Stream.concat(pause(RESUBSCRIBE_AFTER)), Stream.concat(Stream.suspend(() => resumed)));
75
+ return resumed;
76
+ }));
77
+ //# sourceMappingURL=effect.js.map
@@ -0,0 +1,2 @@
1
+ export type { StreamRelay, StreamRelayEvent } from "./stream.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ export type StreamRelayEvent = {
2
+ readonly kind: "closed";
3
+ readonly reason: string;
4
+ } | {
5
+ readonly kind: "frame";
6
+ readonly text: string;
7
+ };
8
+ export type StreamRelay<TSubscribe> = (subscribe: TSubscribe, onEvent: (event: StreamRelayEvent) => void) => Promise<() => Promise<void> | void>;
9
+ //# sourceMappingURL=stream.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=stream.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 { TeamWorkspaceClient } from "./team-workspace.js";
4
+ export declare const makeTeamWorkspaceOperations: <TError>(request: LocalNodeEffectRequester<TError>) => EffectClient<TeamWorkspaceClient, MaiaClientError | TError>;
5
+ //# sourceMappingURL=effect.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { teamWorkspaceBootstrapApplyResultSchema, teamWorkspaceBootstrapPreviewResultSchema, } 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 Team Workspace bootstrap response did not match the request.");
7
+ };
8
+ const parsePreview = (value, parameters) => {
9
+ const result = teamWorkspaceBootstrapPreviewResultSchema.parse(value);
10
+ requireMatch(result.commandId === parameters.commandId &&
11
+ result.expectedBootstrapRevision === parameters.expectedBootstrapRevision);
12
+ return result;
13
+ };
14
+ const parseApply = (value, parameters) => {
15
+ const result = teamWorkspaceBootstrapApplyResultSchema.parse(value);
16
+ requireMatch(result.commandId === parameters.commandId &&
17
+ result.inputDigest === parameters.inputDigest &&
18
+ result.previewId === parameters.previewId);
19
+ return result;
20
+ };
21
+ export const makeTeamWorkspaceOperations = (request) => ({
22
+ applyTeamWorkspaceBootstrap: (parameters, options) => verifiedMutation(request({ method: "team-workspace.bootstrap.apply", parameters }, { parse: (value) => parseApply(value, parameters) }, options), options),
23
+ previewTeamWorkspaceBootstrap: (parameters, options) => request({ method: "team-workspace.bootstrap.preview", parameters }, { parse: (value) => parsePreview(value, parameters) }, options),
24
+ });
25
+ //# sourceMappingURL=effect.js.map
@@ -0,0 +1,2 @@
1
+ export { makeTeamWorkspaceClient, MAX_TEAM_WORKSPACE_BOOTSTRAP_NAME_BYTES, TEAM_WORKSPACE_BOOTSTRAP_ERROR_CODES, TEAM_WORKSPACE_BOOTSTRAP_PREVIEW_TTL_MILLISECONDS, TEAM_WORKSPACE_BOOTSTRAP_SCHEMA_VERSION, type TeamWorkspaceBootstrapApplyParameters, teamWorkspaceBootstrapApplyParametersSchema, type TeamWorkspaceBootstrapApplyResult, teamWorkspaceBootstrapApplyResultSchema, type TeamWorkspaceBootstrapErrorCode, type TeamWorkspaceBootstrapPreviewParameters, teamWorkspaceBootstrapPreviewParametersSchema, type TeamWorkspaceBootstrapPreviewResult, teamWorkspaceBootstrapPreviewResultSchema, type TeamWorkspaceClient, } from "./team-workspace.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { makeTeamWorkspaceClient, MAX_TEAM_WORKSPACE_BOOTSTRAP_NAME_BYTES, TEAM_WORKSPACE_BOOTSTRAP_ERROR_CODES, TEAM_WORKSPACE_BOOTSTRAP_PREVIEW_TTL_MILLISECONDS, TEAM_WORKSPACE_BOOTSTRAP_SCHEMA_VERSION, teamWorkspaceBootstrapApplyParametersSchema, teamWorkspaceBootstrapApplyResultSchema, teamWorkspaceBootstrapPreviewParametersSchema, teamWorkspaceBootstrapPreviewResultSchema, } from "./team-workspace.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ import type { TeamWorkspaceBootstrapApplyParameters, TeamWorkspaceBootstrapApplyResult, TeamWorkspaceBootstrapPreviewParameters, TeamWorkspaceBootstrapPreviewResult } from "@maiaos/protocol";
2
+ import type { LocalNodeRequester, LocalNodeRequestOptions } from "../request/index.js";
3
+ export type TeamWorkspaceClient = {
4
+ readonly applyTeamWorkspaceBootstrap: (parameters: TeamWorkspaceBootstrapApplyParameters, options: LocalNodeRequestOptions) => Promise<TeamWorkspaceBootstrapApplyResult>;
5
+ readonly previewTeamWorkspaceBootstrap: (parameters: TeamWorkspaceBootstrapPreviewParameters, options: LocalNodeRequestOptions) => Promise<TeamWorkspaceBootstrapPreviewResult>;
6
+ };
7
+ export declare const makeTeamWorkspaceClient: (request: LocalNodeRequester) => TeamWorkspaceClient;
8
+ export { MAX_TEAM_WORKSPACE_BOOTSTRAP_NAME_BYTES, TEAM_WORKSPACE_BOOTSTRAP_ERROR_CODES, TEAM_WORKSPACE_BOOTSTRAP_PREVIEW_TTL_MILLISECONDS, TEAM_WORKSPACE_BOOTSTRAP_SCHEMA_VERSION, type TeamWorkspaceBootstrapApplyParameters, teamWorkspaceBootstrapApplyParametersSchema, type TeamWorkspaceBootstrapApplyResult, teamWorkspaceBootstrapApplyResultSchema, type TeamWorkspaceBootstrapErrorCode, type TeamWorkspaceBootstrapPreviewParameters, teamWorkspaceBootstrapPreviewParametersSchema, type TeamWorkspaceBootstrapPreviewResult, teamWorkspaceBootstrapPreviewResultSchema, } from "@maiaos/protocol";
9
+ //# sourceMappingURL=team-workspace.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { fromPromiseRequester, toPromiseClient } from "../request/effect.js";
2
+ import { makeTeamWorkspaceOperations } from "./effect.js";
3
+ export const makeTeamWorkspaceClient = (request) => toPromiseClient(makeTeamWorkspaceOperations(fromPromiseRequester(request)));
4
+ export { MAX_TEAM_WORKSPACE_BOOTSTRAP_NAME_BYTES, TEAM_WORKSPACE_BOOTSTRAP_ERROR_CODES, TEAM_WORKSPACE_BOOTSTRAP_PREVIEW_TTL_MILLISECONDS, TEAM_WORKSPACE_BOOTSTRAP_SCHEMA_VERSION, teamWorkspaceBootstrapApplyParametersSchema, teamWorkspaceBootstrapApplyResultSchema, teamWorkspaceBootstrapPreviewParametersSchema, teamWorkspaceBootstrapPreviewResultSchema, } from "@maiaos/protocol";
5
+ //# sourceMappingURL=team-workspace.js.map
@@ -0,0 +1,7 @@
1
+ import { type EffectClient, type LocalNodeEffectRequester } from "../request/effect.js";
2
+ import { MaiaClientError } from "../request/index.js";
3
+ import type { VoiceManagedTurnClient } from "./managed-turn.js";
4
+ import type { InvalidVoicePiRelayResponse, VoicePiRelayClient } from "./pi-relay.js";
5
+ export declare const makeVoiceManagedTurnOperations: (request: LocalNodeEffectRequester<unknown>) => EffectClient<VoiceManagedTurnClient>;
6
+ export declare const makeVoicePiRelayOperations: <TError>(request: LocalNodeEffectRequester<TError>, invalidResponse: InvalidVoicePiRelayResponse) => EffectClient<VoicePiRelayClient, MaiaClientError | TError>;
7
+ //# sourceMappingURL=effect.d.ts.map
@@ -0,0 +1,71 @@
1
+ import { turnSendResultSchema } from "@maiaos/protocol";
2
+ import { voiceManagedTurnConfirmParametersSchema, voiceManagedTurnPreviewParametersSchema, voiceManagedTurnPreviewResultSchema, } from "@maiaos/protocol/voice-orchestrator";
3
+ import { Effect } from "effect";
4
+ import { failInvalidResponse, } from "../request/effect.js";
5
+ import { MaiaClientError } from "../request/index.js";
6
+ import { voiceWire } from "./wire-schema.js";
7
+ const invalidManagedTurnResponse = () => new MaiaClientError("invalid_response", "The managed voice response did not match the request.");
8
+ const validate = (schema, value) => Effect.try({
9
+ catch: () => new MaiaClientError("invalid_request", "The managed voice request is invalid."),
10
+ try: () => schema.parse(value),
11
+ });
12
+ const managedTurnFailure = (error) => error instanceof MaiaClientError ? error : invalidManagedTurnResponse();
13
+ const matchesConfirmation = (result, parameters) => result.turn.sessionId === parameters.sessionId &&
14
+ result.receipt.commandId === parameters.confirmation.commandId &&
15
+ result.receipt.method === "turn.send" &&
16
+ result.receipt.target.id === result.turn.id &&
17
+ result.receipt.target.type === "turn";
18
+ const matchesPreview = (result, parameters) => result.sessionId === parameters.sessionId &&
19
+ result.projectId === parameters.projectId &&
20
+ result.voiceSessionId === parameters.scopeId &&
21
+ result.expectedSessionRevision === parameters.expectedSessionRevision &&
22
+ result.turnInput === parameters.utterance.trim();
23
+ const confirmVoiceManagedTurn = (request, parameters, options) => Effect.gen(function* () {
24
+ const validated = yield* validate(voiceManagedTurnConfirmParametersSchema, parameters);
25
+ const result = yield* request({ method: "voice.managed-turn.confirm", parameters: validated }, turnSendResultSchema, options).pipe(Effect.mapError(managedTurnFailure));
26
+ if (!matchesConfirmation(result, validated))
27
+ return yield* Effect.fail(invalidManagedTurnResponse());
28
+ return result;
29
+ });
30
+ const previewVoiceManagedTurn = (request, parameters, options) => Effect.gen(function* () {
31
+ const validated = yield* validate(voiceManagedTurnPreviewParametersSchema, parameters);
32
+ const result = yield* request({ method: "voice.managed-turn.preview", parameters: validated }, voiceManagedTurnPreviewResultSchema, options).pipe(Effect.mapError(managedTurnFailure));
33
+ if (!matchesPreview(result, validated))
34
+ return yield* Effect.fail(invalidManagedTurnResponse());
35
+ return result;
36
+ });
37
+ export const makeVoiceManagedTurnOperations = (request) => ({
38
+ confirmVoiceManagedTurn: (parameters, options) => confirmVoiceManagedTurn(request, parameters, options),
39
+ previewVoiceManagedTurn: (parameters, options) => previewVoiceManagedTurn(request, parameters, options),
40
+ });
41
+ const matchedRelayResult = (context, result, matches) => matches
42
+ ? Effect.succeed(result)
43
+ : failInvalidResponse(context.invalidResponse);
44
+ const requestVoicePiRelayPreview = (context, parameters, options) => Effect.suspend(() => context.request({
45
+ method: "voice.pi.relay.preview",
46
+ parameters: voiceWire.previewParameters(parameters),
47
+ }, { parse: (value) => voiceWire.previewResult(value) }, options)).pipe(Effect.flatMap((result) => matchedRelayResult(context, result, result.commandId === parameters.commandId &&
48
+ result.workspaceId === parameters.workspaceId &&
49
+ result.workspaceRevision === parameters.expectedWorkspaceRevision &&
50
+ result.contextRevision === parameters.expectedContextRevision)));
51
+ const requestVoicePiRelayReconcile = (context, parameters, options) => Effect.suspend(() => context.request({
52
+ method: "voice.pi.relay.reconcile",
53
+ parameters: voiceWire.reconcileParameters(parameters),
54
+ }, { parse: (value) => voiceWire.reconcileResult(value) }, options)).pipe(Effect.flatMap((result) => matchedRelayResult(context, result, result.commandId === parameters.commandId)));
55
+ const requestConfirmedVoicePiRelay = (context, parameters, options) => Effect.suspend(() => context.request({
56
+ method: "voice.pi.relay",
57
+ parameters: voiceWire.relayParameters(parameters),
58
+ }, { parse: (value) => voiceWire.relayResult(value) }, options)).pipe(Effect.flatMap((result) => matchedRelayResult(context, result, result.commandId === parameters.commandId &&
59
+ result.workspaceId === parameters.workspaceId &&
60
+ result.sessionId === parameters.sessionId &&
61
+ result.workspaceRevision === parameters.expectedWorkspaceRevision &&
62
+ result.contextRevision === parameters.expectedContextRevision)));
63
+ export const makeVoicePiRelayOperations = (request, invalidResponse) => {
64
+ const context = { invalidResponse, request };
65
+ return {
66
+ previewVoiceToPi: (parameters, options) => requestVoicePiRelayPreview(context, parameters, options),
67
+ reconcileVoiceToPi: (parameters, options) => requestVoicePiRelayReconcile(context, parameters, options),
68
+ relayVoiceToPi: (parameters, options) => requestConfirmedVoicePiRelay(context, parameters, options),
69
+ };
70
+ };
71
+ //# sourceMappingURL=effect.js.map
@@ -0,0 +1,4 @@
1
+ export { makeVoiceManagedTurnClient, type VoiceManagedTurnClient, } from "./managed-turn.js";
2
+ export type { VoiceOrchestratorClient } from "./orchestrator.js";
3
+ export { type InvalidVoicePiRelayResponse, makeVoicePiRelayClient, type VoicePiRelayClient, } from "./pi-relay.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ export { makeVoiceManagedTurnClient, } from "./managed-turn.js";
2
+ export { makeVoicePiRelayClient, } from "./pi-relay.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ import type { TurnSendResult } from "@maiaos/protocol";
2
+ import type { VoiceManagedTurnConfirmParameters, VoiceManagedTurnPreviewParameters, VoiceManagedTurnPreviewResult } from "@maiaos/protocol/voice-orchestrator";
3
+ import type { LocalNodeRequester, LocalNodeRequestOptions } from "../request/index.js";
4
+ export type VoiceManagedTurnClient = {
5
+ readonly confirmVoiceManagedTurn: (parameters: VoiceManagedTurnConfirmParameters, options: LocalNodeRequestOptions) => Promise<TurnSendResult>;
6
+ readonly previewVoiceManagedTurn: (parameters: VoiceManagedTurnPreviewParameters, options: LocalNodeRequestOptions) => Promise<VoiceManagedTurnPreviewResult>;
7
+ };
8
+ export declare const makeVoiceManagedTurnClient: (request: LocalNodeRequester) => VoiceManagedTurnClient;
9
+ //# sourceMappingURL=managed-turn.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { fromPromiseRequester, toPromiseClient } from "../request/effect.js";
2
+ import { makeVoiceManagedTurnOperations } from "./effect.js";
3
+ export const makeVoiceManagedTurnClient = (request) => toPromiseClient(makeVoiceManagedTurnOperations(fromPromiseRequester(request)));
4
+ //# sourceMappingURL=managed-turn.js.map
@@ -0,0 +1,5 @@
1
+ export { createVoiceOrchestratorClient, type VoiceOrchestratorClient, VoiceOrchestratorClientError, type VoiceOrchestratorClientErrorCode, type VoiceOrchestratorRequestOptions, type VoiceOrchestratorTransport, } from "./orchestrator.js";
2
+ export type { VoiceOrchestratorContextShowParameters, VoiceOrchestratorContextShowResult, VoiceOrchestratorToolCall, VoiceOrchestratorToolCallParameters, VoiceOrchestratorToolCallResult, VoiceOrchestratorToolDefinition, VoiceOrchestratorToolParameters, VoiceOrchestratorToolResult, } from "@maiaos/protocol/voice-orchestrator";
3
+ export { VOICE_MANAGED_TURN_SCHEMA_VERSION, type VoiceManagedTurnConfirmParameters, voiceManagedTurnConfirmParametersSchema, type VoiceManagedTurnPreviewParameters, voiceManagedTurnPreviewParametersSchema, type VoiceManagedTurnPreviewResult, voiceManagedTurnPreviewResultSchema, } from "@maiaos/protocol/voice-orchestrator";
4
+ export { MAX_VOICE_ORCHESTRATOR_CONTEXT_BYTES, MAX_VOICE_ORCHESTRATOR_SAFE_MESSAGE_BYTES, MAX_VOICE_ORCHESTRATOR_TOOL_CALLS, MAX_VOICE_ORCHESTRATOR_TOOL_OUTPUT_BYTES, MAX_VOICE_ORCHESTRATOR_TOOL_REQUEST_BYTES, VOICE_ORCHESTRATOR_ASK_AUTHORITY, VOICE_ORCHESTRATOR_CONTEXT_SCHEMA_VERSION, VOICE_ORCHESTRATOR_OPERATION_BINDINGS, VOICE_ORCHESTRATOR_REVIEWED_SKILL, VOICE_ORCHESTRATOR_REVIEWED_SKILL_PROJECTION, VOICE_ORCHESTRATOR_SYSTEM_PROMPT, VOICE_ORCHESTRATOR_SYSTEM_PROMPT_SCHEMA, VOICE_ORCHESTRATOR_SYSTEM_PROMPT_SHA256, VOICE_ORCHESTRATOR_SYSTEM_PROMPT_VERSION, VOICE_ORCHESTRATOR_TOOL_CALL_RESULT_SCHEMA_VERSION, VOICE_ORCHESTRATOR_TOOL_DEFINITION, VOICE_ORCHESTRATOR_TOOL_DEFINITIONS, VOICE_ORCHESTRATOR_TOOL_DESCRIPTION, VOICE_ORCHESTRATOR_TOOL_NAME, VOICE_ORCHESTRATOR_TOOL_RESULT_SCHEMA_VERSION, VOICE_ORCHESTRATOR_TOOL_SCHEMA_VERSION, voiceOrchestratorContextShowParametersSchema, voiceOrchestratorContextShowResultSchema, voiceOrchestratorToolCallParametersSchema, voiceOrchestratorToolCallResultSchema, voiceOrchestratorToolCallSchema, voiceOrchestratorToolDefinitionSchema, voiceOrchestratorToolParametersSchema, voiceOrchestratorToolResultSchema, } from "@maiaos/protocol/voice-orchestrator";
5
+ //# sourceMappingURL=orchestrator-contract.d.ts.map
@@ -0,0 +1,4 @@
1
+ export { createVoiceOrchestratorClient, VoiceOrchestratorClientError, } from "./orchestrator.js";
2
+ export { VOICE_MANAGED_TURN_SCHEMA_VERSION, voiceManagedTurnConfirmParametersSchema, voiceManagedTurnPreviewParametersSchema, voiceManagedTurnPreviewResultSchema, } from "@maiaos/protocol/voice-orchestrator";
3
+ export { MAX_VOICE_ORCHESTRATOR_CONTEXT_BYTES, MAX_VOICE_ORCHESTRATOR_SAFE_MESSAGE_BYTES, MAX_VOICE_ORCHESTRATOR_TOOL_CALLS, MAX_VOICE_ORCHESTRATOR_TOOL_OUTPUT_BYTES, MAX_VOICE_ORCHESTRATOR_TOOL_REQUEST_BYTES, VOICE_ORCHESTRATOR_ASK_AUTHORITY, VOICE_ORCHESTRATOR_CONTEXT_SCHEMA_VERSION, VOICE_ORCHESTRATOR_OPERATION_BINDINGS, VOICE_ORCHESTRATOR_REVIEWED_SKILL, VOICE_ORCHESTRATOR_REVIEWED_SKILL_PROJECTION, VOICE_ORCHESTRATOR_SYSTEM_PROMPT, VOICE_ORCHESTRATOR_SYSTEM_PROMPT_SCHEMA, VOICE_ORCHESTRATOR_SYSTEM_PROMPT_SHA256, VOICE_ORCHESTRATOR_SYSTEM_PROMPT_VERSION, VOICE_ORCHESTRATOR_TOOL_CALL_RESULT_SCHEMA_VERSION, VOICE_ORCHESTRATOR_TOOL_DEFINITION, VOICE_ORCHESTRATOR_TOOL_DEFINITIONS, VOICE_ORCHESTRATOR_TOOL_DESCRIPTION, VOICE_ORCHESTRATOR_TOOL_NAME, VOICE_ORCHESTRATOR_TOOL_RESULT_SCHEMA_VERSION, VOICE_ORCHESTRATOR_TOOL_SCHEMA_VERSION, voiceOrchestratorContextShowParametersSchema, voiceOrchestratorContextShowResultSchema, voiceOrchestratorToolCallParametersSchema, voiceOrchestratorToolCallResultSchema, voiceOrchestratorToolCallSchema, voiceOrchestratorToolDefinitionSchema, voiceOrchestratorToolParametersSchema, voiceOrchestratorToolResultSchema, } from "@maiaos/protocol/voice-orchestrator";
4
+ //# sourceMappingURL=orchestrator-contract.js.map
@@ -0,0 +1,25 @@
1
+ import { type ProtocolError, type ProtocolRequestEnvelope } from "@maiaos/protocol";
2
+ import type { VoiceOrchestratorContextShowParameters, VoiceOrchestratorContextShowResult, VoiceOrchestratorToolCallParameters, VoiceOrchestratorToolCallResult } from "@maiaos/protocol/voice-orchestrator";
3
+ export type VoiceOrchestratorRequestOptions = {
4
+ readonly messageId: string;
5
+ readonly signal?: AbortSignal;
6
+ };
7
+ export type VoiceOrchestratorTransport = {
8
+ readonly request: (envelope: ProtocolRequestEnvelope<unknown>, options?: {
9
+ readonly signal?: AbortSignal;
10
+ }) => Promise<unknown>;
11
+ };
12
+ export type VoiceOrchestratorClient = {
13
+ readonly callVoiceOrchestratorTool: (parameters: VoiceOrchestratorToolCallParameters, options: VoiceOrchestratorRequestOptions) => Promise<VoiceOrchestratorToolCallResult>;
14
+ readonly showVoiceOrchestratorContext: (parameters: VoiceOrchestratorContextShowParameters, options: VoiceOrchestratorRequestOptions) => Promise<VoiceOrchestratorContextShowResult>;
15
+ };
16
+ export type VoiceOrchestratorClientErrorCode = "cancelled" | "correlation_mismatch" | "deadline_exceeded" | "invalid_request" | "invalid_response" | "outcome_unknown" | "remote_error" | "saturated" | "transport_failure";
17
+ export declare class VoiceOrchestratorClientError extends Error {
18
+ readonly code: VoiceOrchestratorClientErrorCode;
19
+ readonly remoteError?: ProtocolError;
20
+ constructor(code: VoiceOrchestratorClientErrorCode, message: string, options?: ErrorOptions & {
21
+ readonly remoteError?: ProtocolError;
22
+ });
23
+ }
24
+ export declare const createVoiceOrchestratorClient: (transport: VoiceOrchestratorTransport) => VoiceOrchestratorClient;
25
+ //# sourceMappingURL=orchestrator.d.ts.map
@@ -0,0 +1,169 @@
1
+ import { MAIA_PROTOCOL_VERSION, protocolErrorEnvelopeSchema, protocolIdentifierSchema, protocolRequestEnvelopeSchema, protocolSuccessEnvelopeSchema, } from "@maiaos/protocol";
2
+ import { MAX_VOICE_ORCHESTRATOR_CONTEXT_BYTES, MAX_VOICE_ORCHESTRATOR_SAFE_MESSAGE_BYTES, MAX_VOICE_ORCHESTRATOR_TOOL_OUTPUT_BYTES, MAX_VOICE_ORCHESTRATOR_TOOL_REQUEST_BYTES, } from "@maiaos/protocol/voice-orchestrator";
3
+ import { voiceWire } from "./wire-schema.js";
4
+ export class VoiceOrchestratorClientError extends Error {
5
+ code;
6
+ remoteError;
7
+ constructor(code, message, options) {
8
+ super(message, options);
9
+ this.name = "VoiceOrchestratorClientError";
10
+ this.code = code;
11
+ this.remoteError = options?.remoteError;
12
+ }
13
+ }
14
+ const utf8 = new TextEncoder();
15
+ const objectWithin = (value, maximumBytes) => {
16
+ try {
17
+ const encoded = JSON.stringify(value);
18
+ return (encoded !== undefined && utf8.encode(encoded).byteLength <= maximumBytes);
19
+ }
20
+ catch {
21
+ return false;
22
+ }
23
+ };
24
+ const invalidRequest = (message, error) => {
25
+ throw new VoiceOrchestratorClientError("invalid_request", message, {
26
+ ...(error === undefined ? {} : { cause: error }),
27
+ });
28
+ };
29
+ const invalidResponse = (message, error) => {
30
+ throw new VoiceOrchestratorClientError("invalid_response", message, {
31
+ ...(error === undefined ? {} : { cause: error }),
32
+ });
33
+ };
34
+ const validateContextParameters = (parameters) => {
35
+ try {
36
+ return voiceWire.orchestratorContextParameters(parameters);
37
+ }
38
+ catch (error) {
39
+ return invalidRequest("The voice orchestrator context input is invalid.", error);
40
+ }
41
+ };
42
+ const validateToolParameters = (parameters) => {
43
+ if (!objectWithin(parameters, MAX_VOICE_ORCHESTRATOR_TOOL_REQUEST_BYTES)) {
44
+ return invalidRequest("The voice orchestrator tool input is invalid.");
45
+ }
46
+ try {
47
+ const validated = voiceWire.orchestratorToolParameters(parameters);
48
+ voiceWire.toolCall(validated.call);
49
+ return validated;
50
+ }
51
+ catch (error) {
52
+ return invalidRequest("The voice orchestrator tool input is invalid.", error);
53
+ }
54
+ };
55
+ const parseRequestEnvelope = (messageId, payload) => {
56
+ try {
57
+ protocolIdentifierSchema.parse(messageId);
58
+ return protocolRequestEnvelopeSchema.parse({
59
+ kind: "request",
60
+ messageId,
61
+ payload,
62
+ protocolVersion: MAIA_PROTOCOL_VERSION,
63
+ });
64
+ }
65
+ catch (error) {
66
+ return invalidRequest("The Maia voice orchestrator request failed runtime validation.", error);
67
+ }
68
+ };
69
+ const requestTransport = async (transport, envelope, signal) => {
70
+ if (signal?.aborted === true) {
71
+ throw new VoiceOrchestratorClientError("cancelled", "The Maia voice orchestrator request was cancelled.");
72
+ }
73
+ try {
74
+ return await transport.request(envelope, signal === undefined ? undefined : { signal });
75
+ }
76
+ catch (error) {
77
+ if (error instanceof VoiceOrchestratorClientError)
78
+ throw error;
79
+ const cancelled = signal?.aborted ?? false;
80
+ throw new VoiceOrchestratorClientError(cancelled ? "cancelled" : "transport_failure", cancelled
81
+ ? "The Maia voice orchestrator request was cancelled."
82
+ : "The Maia voice orchestrator transport request failed.", { cause: error });
83
+ }
84
+ };
85
+ const remoteErrorCode = (code) => code === "deadline_exceeded" ||
86
+ code === "outcome_unknown" ||
87
+ code === "saturated"
88
+ ? code
89
+ : "remote_error";
90
+ const rejectRemoteError = (rawResponse, messageId) => {
91
+ const remote = protocolErrorEnvelopeSchema.safeParse(rawResponse);
92
+ if (!remote.success)
93
+ return;
94
+ if (remote.data.correlationId !== messageId) {
95
+ throw new VoiceOrchestratorClientError("correlation_mismatch", "The Maia voice orchestrator response did not match the request.");
96
+ }
97
+ throw new VoiceOrchestratorClientError(remoteErrorCode(remote.data.payload.error.code), remote.data.payload.error.message, { remoteError: remote.data.payload.error });
98
+ };
99
+ const parsePayload = (rawResponse, messageId) => {
100
+ rejectRemoteError(rawResponse, messageId);
101
+ try {
102
+ const response = protocolSuccessEnvelopeSchema.parse(rawResponse);
103
+ if (response.correlationId !== messageId) {
104
+ throw new VoiceOrchestratorClientError("correlation_mismatch", "The Maia voice orchestrator response did not match the request.");
105
+ }
106
+ return response.payload.result;
107
+ }
108
+ catch (error) {
109
+ if (error instanceof VoiceOrchestratorClientError)
110
+ throw error;
111
+ return invalidResponse("The Maia voice orchestrator response envelope is invalid.", error);
112
+ }
113
+ };
114
+ const parseContextResult = (raw) => {
115
+ if (!objectWithin(raw, MAX_VOICE_ORCHESTRATOR_CONTEXT_BYTES)) {
116
+ return invalidResponse("The voice orchestrator context output is invalid.");
117
+ }
118
+ try {
119
+ return voiceWire.orchestratorContextResult(raw);
120
+ }
121
+ catch (error) {
122
+ return invalidResponse("The voice orchestrator context output is invalid.", error);
123
+ }
124
+ };
125
+ const parseToolResult = (raw) => {
126
+ if (!objectWithin(raw, MAX_VOICE_ORCHESTRATOR_TOOL_OUTPUT_BYTES)) {
127
+ return invalidResponse("The voice orchestrator tool output is invalid.");
128
+ }
129
+ try {
130
+ const result = voiceWire.orchestratorToolResult(raw);
131
+ if (result.modelResult.status === "rejected" &&
132
+ utf8.encode(result.modelResult.error.message).byteLength >
133
+ MAX_VOICE_ORCHESTRATOR_SAFE_MESSAGE_BYTES) {
134
+ return invalidResponse("The voice orchestrator tool output is invalid.");
135
+ }
136
+ return result;
137
+ }
138
+ catch (error) {
139
+ return invalidResponse("The voice orchestrator tool output is invalid.", error);
140
+ }
141
+ };
142
+ const request = async (transport, input) => {
143
+ const { options, parse, payload } = input;
144
+ const envelope = parseRequestEnvelope(options.messageId, payload);
145
+ const raw = await requestTransport(transport, envelope, options.signal);
146
+ return parse(parsePayload(raw, options.messageId));
147
+ };
148
+ export const createVoiceOrchestratorClient = (transport) => ({
149
+ callVoiceOrchestratorTool: async (rawParameters, options) => {
150
+ const parameters = validateToolParameters(rawParameters);
151
+ const result = await request(transport, {
152
+ options,
153
+ parse: parseToolResult,
154
+ payload: { method: "voice.orchestrator.tool.call", parameters },
155
+ });
156
+ return result.scopeId === parameters.scopeId
157
+ ? result
158
+ : invalidResponse("The voice orchestrator response did not match the request.");
159
+ },
160
+ showVoiceOrchestratorContext: (rawParameters, options) => {
161
+ const parameters = validateContextParameters(rawParameters);
162
+ return request(transport, {
163
+ options,
164
+ parse: parseContextResult,
165
+ payload: { method: "voice.orchestrator.context.show", parameters },
166
+ });
167
+ },
168
+ });
169
+ //# sourceMappingURL=orchestrator.js.map
@@ -0,0 +1,4 @@
1
+ export type { MaiaTransport } from "../request/index.js";
2
+ export { createVoicePiRelayClient, type VoicePiRelayClient, } from "./pi-relay.js";
3
+ export type { VoicePiRelayParameters, VoicePiRelayPreviewParameters, VoicePiRelayPreviewResult, VoicePiRelayReconcileParameters, VoicePiRelayReconcileResult, VoicePiRelayResult, } from "@maiaos/protocol/voice-pi-relay";
4
+ //# sourceMappingURL=pi-relay-contract.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { createVoicePiRelayClient, } from "./pi-relay.js";
2
+ //# sourceMappingURL=pi-relay-contract.js.map
@@ -0,0 +1,12 @@
1
+ import type { VoicePiRelayParameters, VoicePiRelayPreviewParameters, VoicePiRelayPreviewResult, VoicePiRelayReconcileParameters, VoicePiRelayReconcileResult, VoicePiRelayResult } from "@maiaos/protocol/voice-pi-relay";
2
+ import type { LocalNodeRequester, LocalNodeRequestOptions } from "../request/index.js";
3
+ import { type MaiaTransport } from "../request/index.js";
4
+ export type VoicePiRelayClient = {
5
+ readonly previewVoiceToPi: (parameters: VoicePiRelayPreviewParameters, options: LocalNodeRequestOptions) => Promise<VoicePiRelayPreviewResult>;
6
+ readonly reconcileVoiceToPi: (parameters: VoicePiRelayReconcileParameters, options: LocalNodeRequestOptions) => Promise<VoicePiRelayReconcileResult>;
7
+ readonly relayVoiceToPi: (parameters: VoicePiRelayParameters, options: LocalNodeRequestOptions) => Promise<VoicePiRelayResult>;
8
+ };
9
+ export type InvalidVoicePiRelayResponse = () => never;
10
+ export declare const makeVoicePiRelayClient: (request: LocalNodeRequester, invalidResponse: InvalidVoicePiRelayResponse) => VoicePiRelayClient;
11
+ export declare const createVoicePiRelayClient: (transport: MaiaTransport) => VoicePiRelayClient;
12
+ //# sourceMappingURL=pi-relay.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { fromPromiseRequester, fromPromiseTransport, makeLocalNodeEffectRequester, toPromiseClient, } from "../request/effect.js";
2
+ import { MaiaClientError } from "../request/index.js";
3
+ import { makeVoicePiRelayOperations } from "./effect.js";
4
+ export const makeVoicePiRelayClient = (request, invalidResponse) => toPromiseClient(makeVoicePiRelayOperations(fromPromiseRequester(request), invalidResponse));
5
+ const invalidVoicePiRelayResponse = () => {
6
+ throw new MaiaClientError("invalid_response", "The Pi voice relay response did not match the request.");
7
+ };
8
+ export const createVoicePiRelayClient = (transport) => toPromiseClient(makeVoicePiRelayOperations(makeLocalNodeEffectRequester(fromPromiseTransport(transport), false), invalidVoicePiRelayResponse));
9
+ //# sourceMappingURL=pi-relay.js.map