@agimon-ai/doompi-voice 0.0.1-alpha.93 → 0.0.1-alpha.95
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.
|
@@ -695,6 +695,7 @@ var VoiceMediaBroker = class {
|
|
|
695
695
|
}
|
|
696
696
|
async disconnect(request) {
|
|
697
697
|
const body = await jsonRecord(request);
|
|
698
|
+
if (this.client === void 0) return new Response(null, { status: 204 });
|
|
698
699
|
if (!this.matchesClient(body?.clientId, body?.connectionId)) return errorResponse$1("Voice media client does not own this session.", 409);
|
|
699
700
|
this.client = void 0;
|
|
700
701
|
this.failActiveClientWork("Voice media client disconnected.");
|
|
@@ -703,6 +704,7 @@ var VoiceMediaBroker = class {
|
|
|
703
704
|
}
|
|
704
705
|
async heartbeat(request) {
|
|
705
706
|
const body = await jsonRecord(request);
|
|
707
|
+
if (this.client === void 0) return Response.json(this.currentWake());
|
|
706
708
|
if (!this.matchesClient(body?.clientId, body?.connectionId)) return errorResponse$1("Voice media client does not own this session.", 409);
|
|
707
709
|
this.touchClient();
|
|
708
710
|
return Response.json(this.currentWake());
|
|
@@ -2861,7 +2863,11 @@ var root_server_default$1 = (0, _agimon_ai_doompi_core_extensionFile.defineRoot)
|
|
|
2861
2863
|
};
|
|
2862
2864
|
}
|
|
2863
2865
|
});
|
|
2864
|
-
if (!channelRegistration.mounted)
|
|
2866
|
+
if (!channelRegistration.mounted) {
|
|
2867
|
+
channelRegistration.dispose();
|
|
2868
|
+
channelRegistration = void 0;
|
|
2869
|
+
throw new Error("Global Voice could not claim its hub channel.");
|
|
2870
|
+
}
|
|
2865
2871
|
ownershipRegistration = host.registerChannel(createVoiceOwnershipChannel((owner) => {
|
|
2866
2872
|
coordinator = owner;
|
|
2867
2873
|
companion.setCatalog(owner);
|
|
@@ -2871,13 +2877,22 @@ var root_server_default$1 = (0, _agimon_ai_doompi_core_extensionFile.defineRoot)
|
|
|
2871
2877
|
}, () => {
|
|
2872
2878
|
companion.refreshSelectedCatalog().catch((error) => context.onNotice(`Global Voice catalog update failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
2873
2879
|
}));
|
|
2874
|
-
if (!ownershipRegistration.mounted)
|
|
2880
|
+
if (!ownershipRegistration.mounted) {
|
|
2881
|
+
ownershipRegistration.dispose();
|
|
2882
|
+
ownershipRegistration = void 0;
|
|
2883
|
+
channelRegistration.dispose();
|
|
2884
|
+
channelRegistration = void 0;
|
|
2885
|
+
throw new Error("Global Voice could not claim its ownership channel.");
|
|
2886
|
+
}
|
|
2875
2887
|
},
|
|
2876
2888
|
async onStop() {
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2889
|
+
try {
|
|
2890
|
+
await companion.close();
|
|
2891
|
+
} finally {
|
|
2892
|
+
ownershipRegistration?.dispose();
|
|
2893
|
+
coordinator = void 0;
|
|
2894
|
+
channelRegistration?.dispose();
|
|
2895
|
+
}
|
|
2881
2896
|
}
|
|
2882
2897
|
};
|
|
2883
2898
|
});
|
|
@@ -4050,17 +4065,22 @@ var root_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoot)((
|
|
|
4050
4065
|
realtimeProvider: require_voiceModeController.createRealtimeRuntime({ stateDirectory: (0, node_path.join)(homeDirectory, ".pi", ".doom") }).provider
|
|
4051
4066
|
});
|
|
4052
4067
|
const voice = createVoiceServer(agent, broker, homeDirectory, hubToken, host.context.peerAgents, host.context.requestApi === void 0 ? void 0 : (mount, basePath, request) => host.context.requestApi(mount, basePath, request));
|
|
4068
|
+
const voiceApi = voice.api?.find((api) => api.basePath === require_voiceModeController.VOICE_API_BASE_PATH);
|
|
4069
|
+
if (voiceApi === void 0) throw new Error("Voice server did not provide its session API.");
|
|
4070
|
+
const mediaApi = {
|
|
4071
|
+
basePath: require_clientMedia.VOICE_MEDIA_API_BASE_PATH,
|
|
4072
|
+
start: () => createVoiceSessionApi({
|
|
4073
|
+
directEvents,
|
|
4074
|
+
media: broker,
|
|
4075
|
+
projectRoot: agent.context.repoRoot,
|
|
4076
|
+
homeDirectory
|
|
4077
|
+
})
|
|
4078
|
+
};
|
|
4053
4079
|
const value = {
|
|
4054
4080
|
...voice,
|
|
4055
|
-
api: [...voice.api ?? [],
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
directEvents,
|
|
4059
|
-
media: broker,
|
|
4060
|
-
projectRoot: agent.context.repoRoot,
|
|
4061
|
-
homeDirectory
|
|
4062
|
-
})
|
|
4063
|
-
}]
|
|
4081
|
+
api: [...voice.api ?? [], mediaApi],
|
|
4082
|
+
voiceApi,
|
|
4083
|
+
mediaApi
|
|
4064
4084
|
};
|
|
4065
4085
|
return {
|
|
4066
4086
|
value,
|
|
@@ -4097,10 +4117,10 @@ var route_server_default$2 = (0, _agimon_ai_doompi_core_extensionFile.defineRout
|
|
|
4097
4117
|
var voice_media_wake_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineChannel)(createVoiceMediaWakeChannel);
|
|
4098
4118
|
//#endregion
|
|
4099
4119
|
//#region src/extensions/workspaces/sessions/(backend)/api/voice-media/route.server.ts
|
|
4100
|
-
var route_server_default$1 = (0, _agimon_ai_doompi_core_extensionFile.defineRoute)((context) => context.root.
|
|
4120
|
+
var route_server_default$1 = (0, _agimon_ai_doompi_core_extensionFile.defineRoute)((context) => context.root.mediaApi);
|
|
4101
4121
|
//#endregion
|
|
4102
4122
|
//#region src/extensions/workspaces/sessions/(backend)/api/voice/route.server.ts
|
|
4103
|
-
var route_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoute)((context) => context.root.
|
|
4123
|
+
var route_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoute)((context) => context.root.voiceApi);
|
|
4104
4124
|
//#endregion
|
|
4105
4125
|
//#region src/extensions/workspaces/sessions/(backend)/command/voice.server.ts
|
|
4106
4126
|
var voice_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineServerCommand)((context) => context.root.commands[0]);
|