@maiaos/sdk 0.1.0-canary.2
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.
- package/README.md +177 -0
- package/dist/agent-permission/agent-permission.d.ts +9 -0
- package/dist/agent-permission/agent-permission.js +5 -0
- package/dist/agent-permission/effect.d.ts +4 -0
- package/dist/agent-permission/effect.js +34 -0
- package/dist/agent-permission/index.d.ts +2 -0
- package/dist/agent-permission/index.js +2 -0
- package/dist/approval/approval.d.ts +10 -0
- package/dist/approval/approval.js +5 -0
- package/dist/approval/effect.d.ts +5 -0
- package/dist/approval/effect.js +43 -0
- package/dist/approval/index.d.ts +2 -0
- package/dist/approval/index.js +2 -0
- package/dist/call/call.d.ts +26 -0
- package/dist/call/call.js +6 -0
- package/dist/call/effect.d.ts +5 -0
- package/dist/call/effect.js +46 -0
- package/dist/call/index.d.ts +2 -0
- package/dist/call/index.js +2 -0
- package/dist/client/effect.d.ts +8 -0
- package/dist/client/effect.js +283 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +2 -0
- package/dist/client/local-node-client.d.ts +100 -0
- package/dist/client/local-node-client.js +4 -0
- package/dist/connection/connection.d.ts +19 -0
- package/dist/connection/connection.js +5 -0
- package/dist/connection/effect.d.ts +5 -0
- package/dist/connection/effect.js +119 -0
- package/dist/connection/index.d.ts +2 -0
- package/dist/connection/index.js +2 -0
- package/dist/container/container.d.ts +14 -0
- package/dist/container/container.js +5 -0
- package/dist/container/effect.d.ts +4 -0
- package/dist/container/effect.js +90 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/container/index.js +2 -0
- package/dist/discovery/discovery.d.ts +11 -0
- package/dist/discovery/discovery.js +5 -0
- package/dist/discovery/effect.d.ts +5 -0
- package/dist/discovery/effect.js +44 -0
- package/dist/discovery/index.d.ts +2 -0
- package/dist/discovery/index.js +2 -0
- package/dist/execution/effect.d.ts +4 -0
- package/dist/execution/effect.js +8 -0
- package/dist/execution/index.d.ts +2 -0
- package/dist/execution/index.js +2 -0
- package/dist/execution/relocation.d.ts +10 -0
- package/dist/execution/relocation.js +4 -0
- package/dist/feature-bindings/feature-bindings.d.ts +10 -0
- package/dist/feature-bindings/feature-bindings.js +2 -0
- package/dist/feature-bindings/index.d.ts +2 -0
- package/dist/feature-bindings/index.js +2 -0
- package/dist/hold/effect.d.ts +5 -0
- package/dist/hold/effect.js +61 -0
- package/dist/hold/hold.d.ts +12 -0
- package/dist/hold/hold.js +5 -0
- package/dist/hold/index.d.ts +2 -0
- package/dist/hold/index.js +2 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +21 -0
- package/dist/interaction/effect.d.ts +5 -0
- package/dist/interaction/effect.js +79 -0
- package/dist/interaction/index.d.ts +2 -0
- package/dist/interaction/index.js +2 -0
- package/dist/interaction/interaction.d.ts +12 -0
- package/dist/interaction/interaction.js +5 -0
- package/dist/node/attach.d.ts +11 -0
- package/dist/node/attach.js +33 -0
- package/dist/node/bridge-frame.d.ts +18 -0
- package/dist/node/bridge-frame.js +67 -0
- package/dist/node/bridge.d.ts +31 -0
- package/dist/node/bridge.js +148 -0
- package/dist/node/discovery.d.ts +187 -0
- package/dist/node/discovery.js +408 -0
- package/dist/node/effect.d.ts +9 -0
- package/dist/node/effect.js +9 -0
- package/dist/node/fetch.d.ts +2 -0
- package/dist/node/fetch.js +2 -0
- package/dist/node/http.d.ts +27 -0
- package/dist/node/http.js +258 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.js +3 -0
- package/dist/node/local-node.d.ts +26 -0
- package/dist/node/local-node.js +67 -0
- package/dist/node/session.d.ts +15 -0
- package/dist/node/session.js +27 -0
- package/dist/node/ssh.d.ts +16 -0
- package/dist/node/ssh.js +74 -0
- package/dist/node/transport.d.ts +52 -0
- package/dist/node/transport.js +211 -0
- package/dist/node-changes/effect.d.ts +11 -0
- package/dist/node-changes/effect.js +61 -0
- package/dist/node-changes/index.d.ts +2 -0
- package/dist/node-changes/index.js +2 -0
- package/dist/node-changes/node-changes.d.ts +21 -0
- package/dist/node-changes/node-changes.js +23 -0
- package/dist/port-lease/effect.d.ts +5 -0
- package/dist/port-lease/effect.js +53 -0
- package/dist/port-lease/index.d.ts +2 -0
- package/dist/port-lease/index.js +2 -0
- package/dist/port-lease/port-lease.d.ts +11 -0
- package/dist/port-lease/port-lease.js +5 -0
- package/dist/presentation/client.d.ts +10 -0
- package/dist/presentation/client.js +4 -0
- package/dist/presentation/effect.d.ts +5 -0
- package/dist/presentation/effect.js +30 -0
- package/dist/presentation/index.d.ts +5 -0
- package/dist/presentation/index.js +3 -0
- package/dist/presentation/project-list.d.ts +7 -0
- package/dist/presentation/project-list.js +24 -0
- package/dist/presentation/session-list.d.ts +7 -0
- package/dist/presentation/session-list.js +32 -0
- package/dist/project-guard/effect.d.ts +5 -0
- package/dist/project-guard/effect.js +39 -0
- package/dist/project-guard/index.d.ts +2 -0
- package/dist/project-guard/index.js +2 -0
- package/dist/project-guard/project-guard.d.ts +10 -0
- package/dist/project-guard/project-guard.js +5 -0
- package/dist/project-workspace/effect.d.ts +5 -0
- package/dist/project-workspace/effect.js +124 -0
- package/dist/project-workspace/index.d.ts +2 -0
- package/dist/project-workspace/index.js +2 -0
- package/dist/project-workspace/project-workspace.d.ts +23 -0
- package/dist/project-workspace/project-workspace.js +4 -0
- package/dist/provider-pool/effect.d.ts +4 -0
- package/dist/provider-pool/effect.js +5 -0
- package/dist/provider-pool/index.d.ts +2 -0
- package/dist/provider-pool/index.js +2 -0
- package/dist/provider-pool/provider-pool.d.ts +7 -0
- package/dist/provider-pool/provider-pool.js +4 -0
- package/dist/remote-node/effect.d.ts +4 -0
- package/dist/remote-node/effect.js +57 -0
- package/dist/remote-node/index.d.ts +2 -0
- package/dist/remote-node/index.js +2 -0
- package/dist/remote-node/remote-node.d.ts +12 -0
- package/dist/remote-node/remote-node.js +5 -0
- package/dist/request/classify.d.ts +15 -0
- package/dist/request/classify.js +96 -0
- package/dist/request/client-error.d.ts +10 -0
- package/dist/request/client-error.js +11 -0
- package/dist/request/effect.d.ts +22 -0
- package/dist/request/effect.js +104 -0
- package/dist/request/envelope-schema.d.ts +2 -0
- package/dist/request/envelope-schema.js +2 -0
- package/dist/request/index.d.ts +5 -0
- package/dist/request/index.js +4 -0
- package/dist/request/maia-client.d.ts +21 -0
- package/dist/request/maia-client.js +9 -0
- package/dist/request/options.d.ts +9 -0
- package/dist/request/options.js +2 -0
- package/dist/run-ledger/effect.d.ts +5 -0
- package/dist/run-ledger/effect.js +72 -0
- package/dist/run-ledger/index.d.ts +2 -0
- package/dist/run-ledger/index.js +2 -0
- package/dist/run-ledger/run-ledger.d.ts +12 -0
- package/dist/run-ledger/run-ledger.js +2 -0
- package/dist/session/effect.d.ts +4 -0
- package/dist/session/effect.js +7 -0
- package/dist/session/index.d.ts +2 -0
- package/dist/session/index.js +2 -0
- package/dist/session/mailbox.d.ts +9 -0
- package/dist/session/mailbox.js +4 -0
- package/dist/session-creation/effect.d.ts +25 -0
- package/dist/session-creation/effect.js +269 -0
- package/dist/session-creation/index.d.ts +3 -0
- package/dist/session-creation/index.js +3 -0
- package/dist/session-creation/session-creation.d.ts +18 -0
- package/dist/session-creation/session-creation.js +24 -0
- package/dist/session-creation/tasks.d.ts +69 -0
- package/dist/session-creation/tasks.js +37 -0
- package/dist/session-view/index.d.ts +2 -0
- package/dist/session-view/index.js +2 -0
- package/dist/session-view/view.d.ts +42 -0
- package/dist/session-view/view.js +137 -0
- package/dist/stream/effect.d.ts +29 -0
- package/dist/stream/effect.js +77 -0
- package/dist/stream/index.d.ts +2 -0
- package/dist/stream/index.js +2 -0
- package/dist/stream/stream.d.ts +9 -0
- package/dist/stream/stream.js +2 -0
- package/dist/voice/effect.d.ts +7 -0
- package/dist/voice/effect.js +71 -0
- package/dist/voice/index.d.ts +4 -0
- package/dist/voice/index.js +3 -0
- package/dist/voice/managed-turn.d.ts +9 -0
- package/dist/voice/managed-turn.js +4 -0
- package/dist/voice/orchestrator-contract.d.ts +5 -0
- package/dist/voice/orchestrator-contract.js +4 -0
- package/dist/voice/orchestrator.d.ts +25 -0
- package/dist/voice/orchestrator.js +169 -0
- package/dist/voice/pi-relay-contract.d.ts +4 -0
- package/dist/voice/pi-relay-contract.js +2 -0
- package/dist/voice/pi-relay.d.ts +12 -0
- package/dist/voice/pi-relay.js +9 -0
- package/dist/voice/wire-schema.d.ts +215 -0
- package/dist/voice/wire-schema.js +16 -0
- package/package.json +84 -0
|
@@ -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,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
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
export declare const voiceWire: {
|
|
2
|
+
readonly orchestratorContextParameters: (input: unknown) => Readonly<Record<string, never>>;
|
|
3
|
+
readonly orchestratorContextResult: (input: unknown) => {
|
|
4
|
+
readonly method: "voice.orchestrator.context.show";
|
|
5
|
+
readonly releaseQualified: false;
|
|
6
|
+
readonly schemaVersion: "maia.voice-orchestrator-context/v1";
|
|
7
|
+
readonly scope: {
|
|
8
|
+
readonly contextRevision: string;
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly workspaceId: string;
|
|
11
|
+
readonly workspaceRevision: string;
|
|
12
|
+
};
|
|
13
|
+
readonly systemPrompt: string;
|
|
14
|
+
readonly systemPromptSha256: string;
|
|
15
|
+
readonly systemPromptVersion: number;
|
|
16
|
+
readonly tools: readonly [{
|
|
17
|
+
readonly description: "Route one bounded Maia voice action through the authoritative Maia Node. ask prepares an exact Pi message for trusted on-screen confirmation; status reads one current bounded Node snapshot.";
|
|
18
|
+
readonly name: "maia";
|
|
19
|
+
readonly parameters: {
|
|
20
|
+
readonly [x: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
readonly type: "function";
|
|
23
|
+
}];
|
|
24
|
+
};
|
|
25
|
+
readonly orchestratorToolParameters: (input: unknown) => {
|
|
26
|
+
readonly call: unknown;
|
|
27
|
+
readonly scopeId: string;
|
|
28
|
+
};
|
|
29
|
+
readonly orchestratorToolResult: (input: unknown) => {
|
|
30
|
+
readonly interaction: {
|
|
31
|
+
readonly body: string;
|
|
32
|
+
readonly confirmation: {
|
|
33
|
+
readonly commandId: string;
|
|
34
|
+
readonly contextRevision: string;
|
|
35
|
+
readonly expiresAt: string;
|
|
36
|
+
readonly releaseQualified: false;
|
|
37
|
+
readonly schemaVersion: 2;
|
|
38
|
+
readonly sessionId: string;
|
|
39
|
+
readonly workspaceId: string;
|
|
40
|
+
readonly workspaceRevision: string;
|
|
41
|
+
readonly method: "voice.pi.relay.preview";
|
|
42
|
+
readonly proof: string;
|
|
43
|
+
};
|
|
44
|
+
readonly kind: "confirmation-required";
|
|
45
|
+
} | null;
|
|
46
|
+
readonly method: "voice.orchestrator.tool.call";
|
|
47
|
+
readonly modelResult: {
|
|
48
|
+
readonly action: "status";
|
|
49
|
+
readonly authority: "managed-maia-agent";
|
|
50
|
+
readonly data: {
|
|
51
|
+
readonly status: "no-managed-turn" | "unknown";
|
|
52
|
+
} | {
|
|
53
|
+
readonly result: {
|
|
54
|
+
readonly phase: "completed" | "dispatching" | "failed" | "interrupted" | "outcome-unknown" | "queued" | "running";
|
|
55
|
+
readonly reason?: string | undefined;
|
|
56
|
+
readonly text?: string | undefined;
|
|
57
|
+
readonly truncated: boolean;
|
|
58
|
+
};
|
|
59
|
+
readonly sessionId: string;
|
|
60
|
+
readonly status: "ok";
|
|
61
|
+
readonly turnId: string;
|
|
62
|
+
};
|
|
63
|
+
readonly error: null;
|
|
64
|
+
readonly interaction: null;
|
|
65
|
+
readonly receipt: null;
|
|
66
|
+
readonly releaseQualified: false;
|
|
67
|
+
readonly schemaVersion: "maia.voice-managed-status-result/v1";
|
|
68
|
+
readonly status: "managed-status";
|
|
69
|
+
} | {
|
|
70
|
+
readonly action: "ask";
|
|
71
|
+
readonly authority: "managed-maia-agent";
|
|
72
|
+
readonly error: null;
|
|
73
|
+
readonly interaction: {
|
|
74
|
+
readonly applyMethod: "voice.managed-turn.confirm";
|
|
75
|
+
readonly commandId: string;
|
|
76
|
+
readonly expectedSessionRevision: string;
|
|
77
|
+
readonly expiresAt: string;
|
|
78
|
+
readonly requiresTrustedGesture: true;
|
|
79
|
+
readonly sessionId: string;
|
|
80
|
+
};
|
|
81
|
+
readonly receipt: null;
|
|
82
|
+
readonly releaseQualified: false;
|
|
83
|
+
readonly schemaVersion: "maia.voice-managed-preview-result/v1";
|
|
84
|
+
readonly status: "awaiting-confirmation";
|
|
85
|
+
} | {
|
|
86
|
+
readonly releaseQualified: false;
|
|
87
|
+
readonly schemaVersion: "maia.voice-tool-result/v1";
|
|
88
|
+
readonly action: "ask";
|
|
89
|
+
readonly error: null;
|
|
90
|
+
readonly interaction: {
|
|
91
|
+
readonly applyMethod: "voice.pi.relay";
|
|
92
|
+
readonly kind: "confirmation-required";
|
|
93
|
+
readonly previewId: string;
|
|
94
|
+
readonly requiresTrustedGesture: true;
|
|
95
|
+
};
|
|
96
|
+
readonly receipt: null;
|
|
97
|
+
readonly status: "confirmation-required";
|
|
98
|
+
} | {
|
|
99
|
+
readonly releaseQualified: false;
|
|
100
|
+
readonly schemaVersion: "maia.voice-tool-result/v1";
|
|
101
|
+
readonly action: "status";
|
|
102
|
+
readonly data: {
|
|
103
|
+
readonly lifecycle: "draining" | "failed" | "ready" | "starting" | "stopped";
|
|
104
|
+
readonly method: "node.status";
|
|
105
|
+
readonly processResources: {
|
|
106
|
+
readonly activeTrees: number;
|
|
107
|
+
readonly admissionState: "available" | "degraded" | "pressured" | "saturated" | "unavailable";
|
|
108
|
+
readonly cleanupUnknownTrees: number;
|
|
109
|
+
readonly nextStep: "close_idle_terminal" | "inspect_cleanup_unknown" | "inspect_observed_pressure" | "none" | "verify_native_host";
|
|
110
|
+
readonly pressure: "admission_degraded" | "cleanup_unknown" | "healthy" | "observed_pressure" | "warning";
|
|
111
|
+
};
|
|
112
|
+
readonly storageIntegrity: "ok";
|
|
113
|
+
};
|
|
114
|
+
readonly error: null;
|
|
115
|
+
readonly interaction: null;
|
|
116
|
+
readonly receipt: null;
|
|
117
|
+
readonly status: "ok";
|
|
118
|
+
} | {
|
|
119
|
+
readonly releaseQualified: false;
|
|
120
|
+
readonly schemaVersion: "maia.voice-tool-result/v1";
|
|
121
|
+
readonly action: "ask" | "status" | "unknown";
|
|
122
|
+
readonly error: {
|
|
123
|
+
readonly code: "bridge_unavailable" | "call_conflict" | "capacity_exceeded" | "invalid_input" | "scope_stale";
|
|
124
|
+
readonly message: string;
|
|
125
|
+
};
|
|
126
|
+
readonly interaction: null;
|
|
127
|
+
readonly receipt: null;
|
|
128
|
+
readonly status: "rejected";
|
|
129
|
+
};
|
|
130
|
+
readonly releaseQualified: false;
|
|
131
|
+
readonly schemaVersion: "maia.voice-orchestrator-call/v1";
|
|
132
|
+
readonly scopeId: string;
|
|
133
|
+
};
|
|
134
|
+
readonly previewParameters: (input: unknown) => {
|
|
135
|
+
readonly body: string;
|
|
136
|
+
readonly commandId: string;
|
|
137
|
+
readonly expectedContextRevision: string;
|
|
138
|
+
readonly expectedWorkspaceRevision: string;
|
|
139
|
+
readonly workspaceId: string;
|
|
140
|
+
};
|
|
141
|
+
readonly previewResult: (input: unknown) => {
|
|
142
|
+
readonly commandId: string;
|
|
143
|
+
readonly contextRevision: string;
|
|
144
|
+
readonly expiresAt: string;
|
|
145
|
+
readonly releaseQualified: false;
|
|
146
|
+
readonly schemaVersion: 2;
|
|
147
|
+
readonly sessionId: string;
|
|
148
|
+
readonly workspaceId: string;
|
|
149
|
+
readonly workspaceRevision: string;
|
|
150
|
+
readonly method: "voice.pi.relay.preview";
|
|
151
|
+
readonly proof: string;
|
|
152
|
+
};
|
|
153
|
+
readonly reconcileParameters: (input: unknown) => {
|
|
154
|
+
readonly commandId: string;
|
|
155
|
+
};
|
|
156
|
+
readonly reconcileResult: (input: unknown) => {
|
|
157
|
+
readonly commandId: string;
|
|
158
|
+
readonly contextRevision: string;
|
|
159
|
+
readonly expiresAt: string;
|
|
160
|
+
readonly releaseQualified: false;
|
|
161
|
+
readonly schemaVersion: 2;
|
|
162
|
+
readonly sessionId: string;
|
|
163
|
+
readonly workspaceId: string;
|
|
164
|
+
readonly workspaceRevision: string;
|
|
165
|
+
readonly method: "voice.pi.relay.reconcile";
|
|
166
|
+
readonly state: "acknowledged" | "dispatching" | "expired" | "outcome-unknown" | "prepared" | "previewed";
|
|
167
|
+
};
|
|
168
|
+
readonly relayParameters: (input: unknown) => {
|
|
169
|
+
readonly body: string;
|
|
170
|
+
readonly commandId: string;
|
|
171
|
+
readonly expectedContextRevision: string;
|
|
172
|
+
readonly expectedWorkspaceRevision: string;
|
|
173
|
+
readonly workspaceId: string;
|
|
174
|
+
readonly proof: string;
|
|
175
|
+
readonly sessionId: string;
|
|
176
|
+
};
|
|
177
|
+
readonly relayResult: (input: unknown) => {
|
|
178
|
+
readonly commandId: string;
|
|
179
|
+
readonly contextRevision: string;
|
|
180
|
+
readonly delivery: "duplicate" | "new";
|
|
181
|
+
readonly method: "voice.pi.relay";
|
|
182
|
+
readonly receipt: {
|
|
183
|
+
readonly actorId: string;
|
|
184
|
+
readonly aggregateRevision: string;
|
|
185
|
+
readonly commandId: string;
|
|
186
|
+
readonly createdAt: string;
|
|
187
|
+
readonly eventCursor: string;
|
|
188
|
+
readonly method: string;
|
|
189
|
+
readonly receiptId: string;
|
|
190
|
+
readonly schemaVersion: 1;
|
|
191
|
+
readonly state: "succeeded";
|
|
192
|
+
readonly target: {
|
|
193
|
+
readonly id: string;
|
|
194
|
+
readonly type: string;
|
|
195
|
+
};
|
|
196
|
+
readonly updatedAt: string;
|
|
197
|
+
};
|
|
198
|
+
readonly releaseQualified: false;
|
|
199
|
+
readonly schemaVersion: 2;
|
|
200
|
+
readonly sessionId: string;
|
|
201
|
+
readonly workspaceId: string;
|
|
202
|
+
readonly workspaceRevision: string;
|
|
203
|
+
};
|
|
204
|
+
readonly toolCall: (input: unknown) => {
|
|
205
|
+
readonly args: {
|
|
206
|
+
readonly action: "ask";
|
|
207
|
+
readonly utterance: string;
|
|
208
|
+
} | {
|
|
209
|
+
readonly action: "status";
|
|
210
|
+
};
|
|
211
|
+
readonly toolCallId: string;
|
|
212
|
+
readonly toolName: "maia";
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
//# sourceMappingURL=wire-schema.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { voiceOrchestratorContextShowParametersSchema, voiceOrchestratorContextShowResultSchema, voiceOrchestratorToolCallParametersSchema, voiceOrchestratorToolCallResultSchema, voiceOrchestratorToolCallSchema, } from "@maiaos/protocol/voice-orchestrator";
|
|
2
|
+
import { voicePiRelayParametersSchema, voicePiRelayPreviewParametersSchema, voicePiRelayPreviewResultSchema, voicePiRelayReconcileParametersSchema, voicePiRelayReconcileResultSchema, voicePiRelayResultSchema, } from "@maiaos/protocol/voice-pi-relay";
|
|
3
|
+
export const voiceWire = {
|
|
4
|
+
orchestratorContextParameters: voiceOrchestratorContextShowParametersSchema.parse,
|
|
5
|
+
orchestratorContextResult: voiceOrchestratorContextShowResultSchema.parse,
|
|
6
|
+
orchestratorToolParameters: voiceOrchestratorToolCallParametersSchema.parse,
|
|
7
|
+
orchestratorToolResult: voiceOrchestratorToolCallResultSchema.parse,
|
|
8
|
+
previewParameters: voicePiRelayPreviewParametersSchema.parse,
|
|
9
|
+
previewResult: voicePiRelayPreviewResultSchema.parse,
|
|
10
|
+
reconcileParameters: voicePiRelayReconcileParametersSchema.parse,
|
|
11
|
+
reconcileResult: voicePiRelayReconcileResultSchema.parse,
|
|
12
|
+
relayParameters: voicePiRelayParametersSchema.parse,
|
|
13
|
+
relayResult: voicePiRelayResultSchema.parse,
|
|
14
|
+
toolCall: voiceOrchestratorToolCallSchema.parse,
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=wire-schema.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maiaos/sdk",
|
|
3
|
+
"version": "0.1.0-canary.2",
|
|
4
|
+
"description": "TypeScript SDK for Maia Node: typed, validated calls to create and drive AI coding agent Sessions (Claude Code, Codex), wait for turns and read receipts.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"maia",
|
|
7
|
+
"maiaos",
|
|
8
|
+
"ai-agents",
|
|
9
|
+
"coding-agents",
|
|
10
|
+
"multi-agent",
|
|
11
|
+
"agent-orchestration",
|
|
12
|
+
"sdk",
|
|
13
|
+
"typescript",
|
|
14
|
+
"claude-code",
|
|
15
|
+
"codex",
|
|
16
|
+
"effect"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/maiaos/maiaos/tree/main/packages/sdk#readme",
|
|
19
|
+
"bugs": "https://github.com/maiaos/maiaos/issues",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/maiaos/maiaos.git",
|
|
23
|
+
"directory": "packages/sdk"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./node": {
|
|
35
|
+
"types": "./dist/node/index.d.ts",
|
|
36
|
+
"import": "./dist/node/index.js",
|
|
37
|
+
"default": "./dist/node/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./node/effect": {
|
|
40
|
+
"types": "./dist/node/effect.d.ts",
|
|
41
|
+
"import": "./dist/node/effect.js",
|
|
42
|
+
"default": "./dist/node/effect.js"
|
|
43
|
+
},
|
|
44
|
+
"./voice-orchestrator": {
|
|
45
|
+
"types": "./dist/voice/orchestrator-contract.d.ts",
|
|
46
|
+
"import": "./dist/voice/orchestrator-contract.js",
|
|
47
|
+
"default": "./dist/voice/orchestrator-contract.js"
|
|
48
|
+
},
|
|
49
|
+
"./voice-pi-relay": {
|
|
50
|
+
"types": "./dist/voice/pi-relay-contract.d.ts",
|
|
51
|
+
"import": "./dist/voice/pi-relay-contract.js",
|
|
52
|
+
"default": "./dist/voice/pi-relay-contract.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"dist",
|
|
57
|
+
"!dist/**/*.d.ts.map",
|
|
58
|
+
"!dist/**/*.js.map",
|
|
59
|
+
"README.md"
|
|
60
|
+
],
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"engines": {
|
|
65
|
+
"node": "24.22.1"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@types/node": "24.13.3",
|
|
69
|
+
"@typescript/native": "npm:typescript@7.0.2",
|
|
70
|
+
"@vllnt/typescript": "2.0.0-canary.a1749e0",
|
|
71
|
+
"eslint": "9.39.5",
|
|
72
|
+
"typescript": "npm:@typescript/typescript6@6.0.2"
|
|
73
|
+
},
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"@maiaos/protocol": "0.1.0-canary.2",
|
|
76
|
+
"effect": "4.0.0"
|
|
77
|
+
},
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{force:true,recursive:true})\" && tsc --project tsconfig.build.json",
|
|
80
|
+
"lint": "eslint src --max-warnings 0",
|
|
81
|
+
"test": "node -e \"require('node:fs').rmSync('.test-dist',{force:true,recursive:true})\" && tsc --project tsconfig.test.json && node --import ../../scripts/lib/test-environment.mjs --test --test-concurrency=2 --enable-source-maps \".test-dist/**/*.test.js\"",
|
|
82
|
+
"typecheck": "tsc --project tsconfig.json --noEmit"
|
|
83
|
+
}
|
|
84
|
+
}
|