@pellux/goodvibes-sdk 0.25.13 → 0.25.15
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/dist/_internal/contracts/artifacts/operator-contract.json +1 -1
- package/dist/_internal/contracts/generated/foundation-metadata.d.ts +1 -1
- package/dist/_internal/contracts/generated/foundation-metadata.js +1 -1
- package/dist/_internal/contracts/generated/operator-contract.js +1 -1
- package/dist/_internal/platform/adapters/homeassistant/index.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/homeassistant/index.js +45 -65
- package/dist/_internal/platform/adapters/types.d.ts +26 -0
- package/dist/_internal/platform/adapters/types.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/homeassistant.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/homeassistant.js +3 -5
- package/dist/_internal/platform/channels/builtin/setup-schema.js +3 -3
- package/dist/_internal/platform/cloudflare/manager.d.ts +1 -1
- package/dist/_internal/platform/cloudflare/manager.d.ts.map +1 -1
- package/dist/_internal/platform/cloudflare/manager.js +4 -5
- package/dist/_internal/platform/cloudflare/utils.d.ts +4 -0
- package/dist/_internal/platform/cloudflare/utils.d.ts.map +1 -1
- package/dist/_internal/platform/cloudflare/utils.js +72 -2
- package/dist/_internal/platform/control-plane/session-types.d.ts +1 -2
- package/dist/_internal/platform/control-plane/session-types.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/homeassistant-chat.d.ts +61 -0
- package/dist/_internal/platform/daemon/homeassistant-chat.d.ts.map +1 -0
- package/dist/_internal/platform/daemon/homeassistant-chat.js +128 -0
- package/dist/_internal/platform/daemon/http/homeassistant-routes.d.ts +6 -16
- package/dist/_internal/platform/daemon/http/homeassistant-routes.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/homeassistant-routes.js +73 -255
- package/dist/_internal/platform/daemon/http/router.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/router.js +6 -4
- package/dist/_internal/platform/daemon/surface-actions.d.ts +2 -0
- package/dist/_internal/platform/daemon/surface-actions.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/surface-actions.js +118 -0
- package/dist/_internal/platform/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { HOME_ASSISTANT_SURFACE } from '../channels/builtin/homeassistant.js';
|
|
2
|
+
export const HOME_ASSISTANT_DEFAULT_REMOTE_SESSION_TTL_MS = 20 * 60_000;
|
|
3
|
+
const MIN_REMOTE_SESSION_TTL_MS = 60_000;
|
|
4
|
+
const MAX_REMOTE_SESSION_TTL_MS = 24 * 60 * 60_000;
|
|
5
|
+
export async function postHomeAssistantChatMessage(runtime, input, options = {}) {
|
|
6
|
+
const resolution = await resolveHomeAssistantChatSession(runtime, input);
|
|
7
|
+
const clientId = options.clientId ?? `homeassistant:${input.surfaceId}:${input.conversationId}`;
|
|
8
|
+
if (options.wait === false) {
|
|
9
|
+
const messageId = await runtime.chatManager.postMessage(resolution.session.id, formatHomeAssistantUserMessage(input), clientId);
|
|
10
|
+
return { ...resolution, messageId };
|
|
11
|
+
}
|
|
12
|
+
const reply = await runtime.chatManager.postMessageAndWaitForReply(resolution.session.id, formatHomeAssistantUserMessage(input), clientId, { timeoutMs: options.timeoutMs });
|
|
13
|
+
return {
|
|
14
|
+
...resolution,
|
|
15
|
+
messageId: reply.messageId,
|
|
16
|
+
...(reply.assistantMessageId ? { assistantMessageId: reply.assistantMessageId } : {}),
|
|
17
|
+
...(reply.response ? { response: reply.response } : {}),
|
|
18
|
+
...(reply.error ? { error: reply.error } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export async function resolveHomeAssistantChatSession(runtime, input) {
|
|
22
|
+
await runtime.chatManager.init();
|
|
23
|
+
await runtime.routeBindings.start();
|
|
24
|
+
const binding = await runtime.routeBindings.upsertBinding({
|
|
25
|
+
kind: input.threadId ? 'thread' : 'channel',
|
|
26
|
+
surfaceKind: HOME_ASSISTANT_SURFACE,
|
|
27
|
+
surfaceId: input.surfaceId,
|
|
28
|
+
externalId: input.conversationId,
|
|
29
|
+
...(input.threadId ? { threadId: input.threadId } : {}),
|
|
30
|
+
channelId: input.channelId,
|
|
31
|
+
title: input.title,
|
|
32
|
+
metadata: {
|
|
33
|
+
source: 'homeassistant',
|
|
34
|
+
directoryKind: input.threadId ? 'thread' : 'user',
|
|
35
|
+
messageId: input.messageId,
|
|
36
|
+
conversationId: input.conversationId,
|
|
37
|
+
remoteSessionTtlMs: input.remoteSessionTtlMs,
|
|
38
|
+
...(input.context ? { homeAssistantContext: input.context } : {}),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
const now = Date.now();
|
|
42
|
+
const existingSessionId = readString(binding.metadata.homeAssistantChatSessionId);
|
|
43
|
+
const existing = existingSessionId ? runtime.chatManager.getSession(existingSessionId) : null;
|
|
44
|
+
const expired = Boolean(existing && existing.status !== 'closed' && now - existing.updatedAt > input.remoteSessionTtlMs);
|
|
45
|
+
if (expired && existing) {
|
|
46
|
+
runtime.chatManager.closeSession(existing.id);
|
|
47
|
+
}
|
|
48
|
+
const defaultProviderModel = runtime.resolveDefaultProviderModel?.() ?? null;
|
|
49
|
+
const provider = input.providerId ?? defaultProviderModel?.provider;
|
|
50
|
+
const model = input.modelId ?? defaultProviderModel?.model;
|
|
51
|
+
const systemPrompt = buildHomeAssistantSystemPrompt(input);
|
|
52
|
+
const shouldCreate = !existing || existing.status === 'closed' || expired;
|
|
53
|
+
const session = shouldCreate
|
|
54
|
+
? runtime.chatManager.createSession({
|
|
55
|
+
title: input.title || 'Home Assistant',
|
|
56
|
+
...(provider ? { provider } : {}),
|
|
57
|
+
...(model ? { model } : {}),
|
|
58
|
+
systemPrompt,
|
|
59
|
+
})
|
|
60
|
+
: runtime.chatManager.updateSession(existing.id, {
|
|
61
|
+
title: input.title || existing.title,
|
|
62
|
+
...(provider ? { provider } : {}),
|
|
63
|
+
...(model ? { model } : {}),
|
|
64
|
+
systemPrompt,
|
|
65
|
+
});
|
|
66
|
+
await runtime.routeBindings.patchBinding(binding.id, {
|
|
67
|
+
sessionId: null,
|
|
68
|
+
jobId: null,
|
|
69
|
+
runId: null,
|
|
70
|
+
metadata: {
|
|
71
|
+
homeAssistantChatSessionId: session.id,
|
|
72
|
+
homeAssistantChatSessionUpdatedAt: now,
|
|
73
|
+
remoteSessionTtlMs: input.remoteSessionTtlMs,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
binding,
|
|
78
|
+
session,
|
|
79
|
+
newSession: shouldCreate,
|
|
80
|
+
sessionExpired: expired,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export function readHomeAssistantRemoteSessionTtlMs(configManager, value) {
|
|
84
|
+
return clampNumber(value, Number(configManager.get('surfaces.homeassistant.remoteSessionTtlMs') ?? HOME_ASSISTANT_DEFAULT_REMOTE_SESSION_TTL_MS), MIN_REMOTE_SESSION_TTL_MS, MAX_REMOTE_SESSION_TTL_MS);
|
|
85
|
+
}
|
|
86
|
+
function buildHomeAssistantSystemPrompt(input) {
|
|
87
|
+
const contextLines = [
|
|
88
|
+
`Conversation id: ${input.conversationId}`,
|
|
89
|
+
`Surface id: ${input.surfaceId}`,
|
|
90
|
+
input.channelId ? `Area/entity channel: ${input.channelId}` : '',
|
|
91
|
+
input.userId ? `Home Assistant user id: ${input.userId}` : '',
|
|
92
|
+
input.displayName ? `Home Assistant display name: ${input.displayName}` : '',
|
|
93
|
+
].filter(Boolean);
|
|
94
|
+
return [
|
|
95
|
+
'You are GoodVibes responding inside Home Assistant.',
|
|
96
|
+
'Answer as a normal assistant. Do not emit JSON summaries, WRFC summaries, agent reports, changelogs, or engineering-stage output.',
|
|
97
|
+
'Use Home Assistant tools whenever the user asks about devices, entities, rooms, services, automations, templates, or current home state.',
|
|
98
|
+
'For weather questions, first look for Home Assistant weather entities or other relevant sensors before saying live weather is unavailable.',
|
|
99
|
+
'Ask a concise follow-up only when Home Assistant does not expose enough information to answer safely.',
|
|
100
|
+
contextLines.length ? `Home Assistant context:\n${contextLines.join('\n')}` : '',
|
|
101
|
+
].filter(Boolean).join('\n\n');
|
|
102
|
+
}
|
|
103
|
+
function formatHomeAssistantUserMessage(input) {
|
|
104
|
+
const metadata = {
|
|
105
|
+
source: 'homeassistant',
|
|
106
|
+
messageId: input.messageId,
|
|
107
|
+
conversationId: input.conversationId,
|
|
108
|
+
surfaceId: input.surfaceId,
|
|
109
|
+
channelId: input.channelId,
|
|
110
|
+
...(input.threadId ? { threadId: input.threadId } : {}),
|
|
111
|
+
...(input.userId ? { userId: input.userId } : {}),
|
|
112
|
+
...(input.displayName ? { displayName: input.displayName } : {}),
|
|
113
|
+
...(input.context ? { context: input.context } : {}),
|
|
114
|
+
};
|
|
115
|
+
return [
|
|
116
|
+
input.text,
|
|
117
|
+
`Home Assistant metadata: ${JSON.stringify(metadata)}`,
|
|
118
|
+
].join('\n\n');
|
|
119
|
+
}
|
|
120
|
+
function readString(value) {
|
|
121
|
+
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
|
|
122
|
+
}
|
|
123
|
+
function clampNumber(value, fallback, min, max) {
|
|
124
|
+
const parsed = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : fallback;
|
|
125
|
+
if (!Number.isFinite(parsed))
|
|
126
|
+
return fallback;
|
|
127
|
+
return Math.max(min, Math.min(max, Math.trunc(parsed)));
|
|
128
|
+
}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import type { AutomationRouteBinding } from '../../automation/routes.js';
|
|
2
1
|
import type { RouteBindingManager } from '../../channels/index.js';
|
|
2
|
+
import type { CompanionChatManager } from '../../companion/companion-chat-manager.js';
|
|
3
3
|
import type { ConfigManager } from '../../config/manager.js';
|
|
4
|
-
import type { SharedSessionBroker } from '../../control-plane/index.js';
|
|
5
|
-
import type { AgentManager, AgentRecord } from '../../tools/agent/index.js';
|
|
6
4
|
type JsonRecord = Record<string, unknown>;
|
|
7
5
|
interface HomeAssistantRouteContext {
|
|
8
6
|
readonly configManager: Pick<ConfigManager, 'get'>;
|
|
9
7
|
readonly routeBindings: Pick<RouteBindingManager, 'start' | 'upsertBinding' | 'patchBinding'>;
|
|
10
|
-
readonly
|
|
11
|
-
readonly agentManager: Pick<AgentManager, 'getStatus' | 'cancel'>;
|
|
8
|
+
readonly chatManager: CompanionChatManager;
|
|
12
9
|
readonly parseJsonBody: (req: Request) => Promise<JsonRecord | Response>;
|
|
13
|
-
readonly
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
readonly sessionId?: string;
|
|
18
|
-
}) => void;
|
|
10
|
+
readonly resolveDefaultProviderModel?: () => {
|
|
11
|
+
provider: string;
|
|
12
|
+
model: string;
|
|
13
|
+
} | null;
|
|
19
14
|
}
|
|
20
15
|
export declare class HomeAssistantConversationRoutes {
|
|
21
16
|
private readonly context;
|
|
@@ -28,11 +23,6 @@ export declare class HomeAssistantConversationRoutes {
|
|
|
28
23
|
private streamConversation;
|
|
29
24
|
private cancelConversation;
|
|
30
25
|
private parseInput;
|
|
31
|
-
private upsertBinding;
|
|
32
|
-
private resolveRemoteSession;
|
|
33
|
-
private buildRouting;
|
|
34
|
-
private waitForAgent;
|
|
35
|
-
private errorFromSpawnResponse;
|
|
36
26
|
private indexMessage;
|
|
37
27
|
private readRemoteSessionTtlMs;
|
|
38
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"homeassistant-routes.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/daemon/http/homeassistant-routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"homeassistant-routes.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/daemon/http/homeassistant-routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAW7D,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAkC1C,UAAU,yBAAyB;IACjC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACnD,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,eAAe,GAAG,cAAc,CAAC,CAAC;IAC9F,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAC3C,QAAQ,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC;IACzE,QAAQ,CAAC,2BAA2B,CAAC,EAAE,MAAM;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACzF;AAQD,qBAAa,+BAA+B;IAG9B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgD;gBAEhD,OAAO,EAAE,yBAAyB;IAEzD,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IA6BpD,OAAO,CAAC,cAAc;YA2BR,kBAAkB;IAmGhC,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,kBAAkB;IA2B1B,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,UAAU;IAuClB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,sBAAsB;CAG/B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { HOME_ASSISTANT_SURFACE } from '../../channels/builtin/homeassistant.js';
|
|
3
|
+
import { postHomeAssistantChatMessage, readHomeAssistantRemoteSessionTtlMs, } from '../homeassistant-chat.js';
|
|
3
4
|
const DEFAULT_WAIT_TIMEOUT_MS = 120_000;
|
|
4
5
|
const MAX_WAIT_TIMEOUT_MS = 10 * 60_000;
|
|
5
|
-
const DEFAULT_REMOTE_SESSION_TTL_MS = 20 * 60_000;
|
|
6
6
|
export class HomeAssistantConversationRoutes {
|
|
7
7
|
context;
|
|
8
8
|
messageIndex = new Map();
|
|
@@ -20,13 +20,13 @@ export class HomeAssistantConversationRoutes {
|
|
|
20
20
|
const body = await this.context.parseJsonBody(req);
|
|
21
21
|
if (body instanceof Response)
|
|
22
22
|
return body;
|
|
23
|
-
return this.respondToSubmit(await this.submitConversation(body
|
|
23
|
+
return this.respondToSubmit(await this.submitConversation(body));
|
|
24
24
|
}
|
|
25
25
|
if (url.pathname === '/api/homeassistant/conversation/stream' && req.method === 'POST') {
|
|
26
26
|
const body = await this.context.parseJsonBody(req);
|
|
27
27
|
if (body instanceof Response)
|
|
28
28
|
return body;
|
|
29
|
-
return this.streamConversation(body
|
|
29
|
+
return this.streamConversation(body);
|
|
30
30
|
}
|
|
31
31
|
if (url.pathname === '/api/homeassistant/conversation/cancel' && req.method === 'POST') {
|
|
32
32
|
const body = await this.context.parseJsonBody(req);
|
|
@@ -56,12 +56,13 @@ export class HomeAssistantConversationRoutes {
|
|
|
56
56
|
'conversation-stream',
|
|
57
57
|
'conversation-cancel',
|
|
58
58
|
'stable-correlation',
|
|
59
|
+
'isolated-remote-chat-session',
|
|
59
60
|
'remote-session-ttl',
|
|
60
61
|
'homeassistant-event-delivery',
|
|
61
62
|
],
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
|
-
async submitConversation(body
|
|
65
|
+
async submitConversation(body) {
|
|
65
66
|
if (!Boolean(this.context.configManager.get('surfaces.homeassistant.enabled'))) {
|
|
66
67
|
return {
|
|
67
68
|
ok: false,
|
|
@@ -93,87 +94,63 @@ export class HomeAssistantConversationRoutes {
|
|
|
93
94
|
error: 'Missing Home Assistant conversation message.',
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
source: 'homeassistant',
|
|
97
|
+
let posted;
|
|
98
|
+
try {
|
|
99
|
+
posted = await postHomeAssistantChatMessage({
|
|
100
|
+
configManager: this.context.configManager,
|
|
101
|
+
routeBindings: this.context.routeBindings,
|
|
102
|
+
chatManager: this.context.chatManager,
|
|
103
|
+
resolveDefaultProviderModel: this.context.resolveDefaultProviderModel,
|
|
104
|
+
}, input, {
|
|
105
|
+
wait: input.wait,
|
|
106
|
+
timeoutMs: input.waitTimeoutMs,
|
|
107
|
+
clientId: `homeassistant:${input.surfaceId}:${input.conversationId}`,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
return {
|
|
112
|
+
ok: false,
|
|
113
|
+
acknowledged: true,
|
|
114
114
|
messageId: input.messageId,
|
|
115
115
|
conversationId: input.conversationId,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
mode: 'spawn',
|
|
125
|
-
task: submission.task,
|
|
126
|
-
executionProtocol: 'direct',
|
|
127
|
-
reviewMode: 'none',
|
|
128
|
-
communicationLane: 'direct',
|
|
129
|
-
dangerously_disable_wrfc: true,
|
|
130
|
-
...(input.modelId ? { model: input.modelId } : {}),
|
|
131
|
-
...(input.providerId ? { provider: input.providerId } : {}),
|
|
132
|
-
...(input.tools?.length ? { tools: [...input.tools] } : {}),
|
|
133
|
-
context: `homeassistant:${input.conversationId}`,
|
|
134
|
-
}, 'HomeAssistantConversationRoutes.submitConversation', submission.session.id);
|
|
135
|
-
if (spawnResult instanceof Response) {
|
|
136
|
-
return this.errorFromSpawnResponse(input, sessionResolution, binding, spawnResult);
|
|
137
|
-
}
|
|
138
|
-
agentId = spawnResult.id;
|
|
139
|
-
await this.context.sessionBroker.bindAgent(submission.session.id, spawnResult.id);
|
|
140
|
-
if (input.publishEvent) {
|
|
141
|
-
this.context.queueSurfaceReplyFromBinding(binding, {
|
|
142
|
-
agentId: spawnResult.id,
|
|
143
|
-
task: input.text,
|
|
144
|
-
sessionId: submission.session.id,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
116
|
+
sessionId: '',
|
|
117
|
+
routeId: '',
|
|
118
|
+
mode: 'rejected',
|
|
119
|
+
newSession: false,
|
|
120
|
+
sessionExpired: false,
|
|
121
|
+
status: 'rejected',
|
|
122
|
+
error: error instanceof Error ? error.message : String(error),
|
|
123
|
+
};
|
|
147
124
|
}
|
|
148
|
-
this.indexMessage(input,
|
|
125
|
+
this.indexMessage(input, posted);
|
|
149
126
|
const base = {
|
|
150
127
|
ok: true,
|
|
151
128
|
acknowledged: true,
|
|
152
129
|
messageId: input.messageId,
|
|
153
130
|
conversationId: input.conversationId,
|
|
154
|
-
sessionId:
|
|
155
|
-
routeId: binding.id,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
sessionExpired: sessionResolution.sessionExpired,
|
|
131
|
+
sessionId: posted.session.id,
|
|
132
|
+
routeId: posted.binding.id,
|
|
133
|
+
mode: 'remote-chat',
|
|
134
|
+
newSession: posted.newSession,
|
|
135
|
+
sessionExpired: posted.sessionExpired,
|
|
160
136
|
};
|
|
161
|
-
if (
|
|
162
|
-
return { ...base,
|
|
163
|
-
}
|
|
164
|
-
if (!agentId || !input.wait) {
|
|
165
|
-
return { ...base, status: agentId ? 'running' : 'queued' };
|
|
137
|
+
if (!input.wait) {
|
|
138
|
+
return { ...base, status: 'running' };
|
|
166
139
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
return {
|
|
140
|
+
if (posted.error) {
|
|
141
|
+
const timedOut = posted.error.toLowerCase().includes('timed out');
|
|
142
|
+
return {
|
|
143
|
+
...base,
|
|
144
|
+
ok: false,
|
|
145
|
+
status: timedOut ? 'timeout' : 'failed',
|
|
146
|
+
...(timedOut ? { timeoutMs: input.waitTimeoutMs } : {}),
|
|
147
|
+
error: posted.error,
|
|
148
|
+
};
|
|
170
149
|
}
|
|
171
150
|
return {
|
|
172
151
|
...base,
|
|
173
|
-
status:
|
|
174
|
-
|
|
175
|
-
assistant: buildAssistantResult(finalRecord),
|
|
176
|
-
...(finalRecord.status !== 'completed' ? { error: finalRecord.error ?? finalRecord.status } : {}),
|
|
152
|
+
status: 'completed',
|
|
153
|
+
assistant: buildAssistantResult(posted.response ?? ''),
|
|
177
154
|
};
|
|
178
155
|
}
|
|
179
156
|
respondToSubmit(result) {
|
|
@@ -189,7 +166,7 @@ export class HomeAssistantConversationRoutes {
|
|
|
189
166
|
return Response.json(result, { status: 409 });
|
|
190
167
|
return Response.json(result, { status: result.status === 'completed' ? 200 : 202 });
|
|
191
168
|
}
|
|
192
|
-
streamConversation(body
|
|
169
|
+
streamConversation(body) {
|
|
193
170
|
const encoder = new TextEncoder();
|
|
194
171
|
const stream = new ReadableStream({
|
|
195
172
|
start: async (controller) => {
|
|
@@ -197,47 +174,13 @@ export class HomeAssistantConversationRoutes {
|
|
|
197
174
|
controller.enqueue(encoder.encode(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`));
|
|
198
175
|
};
|
|
199
176
|
try {
|
|
200
|
-
const result = await this.submitConversation({ ...body, wait:
|
|
201
|
-
send('
|
|
202
|
-
|
|
203
|
-
send('final', result);
|
|
204
|
-
controller.close();
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
let lastProgress = '';
|
|
208
|
-
for (;;) {
|
|
209
|
-
if (signal.aborted)
|
|
210
|
-
return;
|
|
211
|
-
const record = this.context.agentManager.getStatus(result.agentId);
|
|
212
|
-
if (!record) {
|
|
213
|
-
send('error', { ...result, ok: false, error: 'Unknown agent.' });
|
|
214
|
-
controller.close();
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
const progress = record.streamingContent ?? record.progress ?? '';
|
|
218
|
-
if (progress && progress !== lastProgress) {
|
|
219
|
-
lastProgress = progress;
|
|
220
|
-
send('progress', { messageId: result.messageId, agentId: result.agentId, text: progress });
|
|
221
|
-
}
|
|
222
|
-
if (record.status === 'completed' || record.status === 'failed' || record.status === 'cancelled') {
|
|
223
|
-
send('final', {
|
|
224
|
-
...result,
|
|
225
|
-
ok: record.status === 'completed',
|
|
226
|
-
status: normalizeAgentStatus(record.status),
|
|
227
|
-
assistant: buildAssistantResult(record),
|
|
228
|
-
...(record.status !== 'completed' ? { error: record.error ?? record.status } : {}),
|
|
229
|
-
});
|
|
230
|
-
controller.close();
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
await delay(250, signal);
|
|
234
|
-
}
|
|
177
|
+
const result = await this.submitConversation({ ...body, wait: true });
|
|
178
|
+
send(result.status === 'completed' ? 'final' : 'error', result);
|
|
179
|
+
controller.close();
|
|
235
180
|
}
|
|
236
181
|
catch (error) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
controller.close();
|
|
240
|
-
}
|
|
182
|
+
send('error', { ok: false, error: error instanceof Error ? error.message : String(error) });
|
|
183
|
+
controller.close();
|
|
241
184
|
}
|
|
242
185
|
},
|
|
243
186
|
cancel: () => undefined,
|
|
@@ -251,17 +194,17 @@ export class HomeAssistantConversationRoutes {
|
|
|
251
194
|
});
|
|
252
195
|
}
|
|
253
196
|
cancelConversation(body) {
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
if (!
|
|
259
|
-
return Response.json({ ok: false, error: '
|
|
197
|
+
const indexed = readString(body.messageId ?? body.message_id)
|
|
198
|
+
? this.messageIndex.get(readString(body.messageId ?? body.message_id))
|
|
199
|
+
: undefined;
|
|
200
|
+
const sessionId = readString(body.sessionId ?? body.session_id) ?? indexed?.sessionId;
|
|
201
|
+
if (!sessionId) {
|
|
202
|
+
return Response.json({ ok: false, error: 'sessionId or known messageId is required.' }, { status: 400 });
|
|
260
203
|
}
|
|
261
|
-
const
|
|
262
|
-
return
|
|
263
|
-
? Response.json({ ok: true,
|
|
264
|
-
: Response.json({ ok: false,
|
|
204
|
+
const session = this.context.chatManager.closeSession(sessionId);
|
|
205
|
+
return session
|
|
206
|
+
? Response.json({ ok: true, sessionId, status: 'cancelled' })
|
|
207
|
+
: Response.json({ ok: false, sessionId, error: 'Unknown Home Assistant chat session.' }, { status: 404 });
|
|
265
208
|
}
|
|
266
209
|
parseInput(body) {
|
|
267
210
|
const threadId = readString(body.threadId ?? body.thread_id);
|
|
@@ -301,111 +244,12 @@ export class HomeAssistantConversationRoutes {
|
|
|
301
244
|
remoteSessionTtlMs: this.readRemoteSessionTtlMs(body),
|
|
302
245
|
};
|
|
303
246
|
}
|
|
304
|
-
|
|
305
|
-
return this.context.routeBindings.upsertBinding({
|
|
306
|
-
kind: input.threadId ? 'thread' : 'channel',
|
|
307
|
-
surfaceKind: HOME_ASSISTANT_SURFACE,
|
|
308
|
-
surfaceId: input.surfaceId,
|
|
309
|
-
externalId: input.conversationId,
|
|
310
|
-
...(input.threadId ? { threadId: input.threadId } : {}),
|
|
311
|
-
channelId: input.channelId,
|
|
312
|
-
title: input.title,
|
|
313
|
-
metadata: {
|
|
314
|
-
source: 'homeassistant',
|
|
315
|
-
directoryKind: input.threadId ? 'thread' : 'user',
|
|
316
|
-
messageId: input.messageId,
|
|
317
|
-
conversationId: input.conversationId,
|
|
318
|
-
remoteSessionTtlMs: input.remoteSessionTtlMs,
|
|
319
|
-
...(input.context ? { homeAssistantContext: input.context } : {}),
|
|
320
|
-
},
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
async resolveRemoteSession(binding, input) {
|
|
324
|
-
const now = Date.now();
|
|
325
|
-
const current = binding.sessionId ? this.context.sessionBroker.getSession(binding.sessionId) : null;
|
|
326
|
-
if (current && current.status !== 'closed' && !isExpiredSession(current, input.remoteSessionTtlMs, now)) {
|
|
327
|
-
return { session: current, newSession: false, sessionExpired: false };
|
|
328
|
-
}
|
|
329
|
-
if (current && current.status !== 'closed' && !current.activeAgentId) {
|
|
330
|
-
await this.context.sessionBroker.closeSession(current.id);
|
|
331
|
-
}
|
|
332
|
-
const session = await this.context.sessionBroker.createSession({
|
|
333
|
-
title: input.title,
|
|
334
|
-
metadata: {
|
|
335
|
-
source: 'homeassistant',
|
|
336
|
-
conversationId: input.conversationId,
|
|
337
|
-
remote: true,
|
|
338
|
-
remoteSessionTtlMs: input.remoteSessionTtlMs,
|
|
339
|
-
},
|
|
340
|
-
routeBinding: binding,
|
|
341
|
-
participant: {
|
|
342
|
-
surfaceKind: HOME_ASSISTANT_SURFACE,
|
|
343
|
-
surfaceId: input.surfaceId,
|
|
344
|
-
externalId: input.conversationId,
|
|
345
|
-
...(input.userId ? { userId: input.userId } : {}),
|
|
346
|
-
...(input.displayName ? { displayName: input.displayName } : {}),
|
|
347
|
-
routeId: binding.id,
|
|
348
|
-
lastSeenAt: now,
|
|
349
|
-
},
|
|
350
|
-
kind: 'homeassistant-remote',
|
|
351
|
-
});
|
|
352
|
-
await this.context.routeBindings.patchBinding(binding.id, {
|
|
353
|
-
sessionId: session.id,
|
|
354
|
-
metadata: {
|
|
355
|
-
homeAssistantSessionId: session.id,
|
|
356
|
-
homeAssistantSessionCreatedAt: now,
|
|
357
|
-
remoteSessionTtlMs: input.remoteSessionTtlMs,
|
|
358
|
-
},
|
|
359
|
-
});
|
|
360
|
-
return {
|
|
361
|
-
session,
|
|
362
|
-
newSession: true,
|
|
363
|
-
sessionExpired: Boolean(current),
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
buildRouting(input) {
|
|
367
|
-
if (!input.providerId && !input.modelId && !input.tools?.length)
|
|
368
|
-
return undefined;
|
|
369
|
-
return {
|
|
370
|
-
...(input.providerId ? { providerId: input.providerId } : {}),
|
|
371
|
-
...(input.modelId ? { modelId: input.modelId } : {}),
|
|
372
|
-
...(input.tools?.length ? { tools: input.tools } : {}),
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
async waitForAgent(agentId, timeoutMs, signal) {
|
|
376
|
-
const startedAt = Date.now();
|
|
377
|
-
while (Date.now() - startedAt < timeoutMs) {
|
|
378
|
-
if (signal.aborted)
|
|
379
|
-
return null;
|
|
380
|
-
const record = this.context.agentManager.getStatus(agentId);
|
|
381
|
-
if (record && (record.status === 'completed' || record.status === 'failed' || record.status === 'cancelled')) {
|
|
382
|
-
return record;
|
|
383
|
-
}
|
|
384
|
-
await delay(200, signal);
|
|
385
|
-
}
|
|
386
|
-
return null;
|
|
387
|
-
}
|
|
388
|
-
errorFromSpawnResponse(input, session, binding, response) {
|
|
389
|
-
return {
|
|
390
|
-
ok: false,
|
|
391
|
-
acknowledged: true,
|
|
392
|
-
messageId: input.messageId,
|
|
393
|
-
conversationId: input.conversationId,
|
|
394
|
-
sessionId: session.session.id,
|
|
395
|
-
routeId: binding.id,
|
|
396
|
-
mode: 'rejected',
|
|
397
|
-
newSession: session.newSession,
|
|
398
|
-
sessionExpired: session.sessionExpired,
|
|
399
|
-
status: 'rejected',
|
|
400
|
-
error: `Home Assistant responder failed to start with HTTP ${response.status}.`,
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
indexMessage(input, sessionId, routeId, agentId) {
|
|
247
|
+
indexMessage(input, posted) {
|
|
404
248
|
this.messageIndex.set(input.messageId, {
|
|
405
249
|
messageId: input.messageId,
|
|
406
|
-
...(
|
|
407
|
-
sessionId,
|
|
408
|
-
routeId,
|
|
250
|
+
...(posted.assistantMessageId ? { assistantMessageId: posted.assistantMessageId } : {}),
|
|
251
|
+
sessionId: posted.session.id,
|
|
252
|
+
routeId: posted.binding.id,
|
|
409
253
|
conversationId: input.conversationId,
|
|
410
254
|
createdAt: Date.now(),
|
|
411
255
|
});
|
|
@@ -416,32 +260,17 @@ export class HomeAssistantConversationRoutes {
|
|
|
416
260
|
}
|
|
417
261
|
}
|
|
418
262
|
readRemoteSessionTtlMs(body) {
|
|
419
|
-
return
|
|
263
|
+
return readHomeAssistantRemoteSessionTtlMs(this.context.configManager, body.remoteSessionTtlMs);
|
|
420
264
|
}
|
|
421
265
|
}
|
|
422
|
-
function
|
|
423
|
-
if (session.activeAgentId)
|
|
424
|
-
return false;
|
|
425
|
-
return now - session.lastActivityAt > ttlMs;
|
|
426
|
-
}
|
|
427
|
-
function buildAssistantResult(record) {
|
|
428
|
-
const text = record.status === 'completed'
|
|
429
|
-
? (record.fullOutput ?? record.streamingContent ?? record.progress ?? 'Completed')
|
|
430
|
-
: record.error ?? record.status;
|
|
266
|
+
function buildAssistantResult(text) {
|
|
431
267
|
return {
|
|
432
268
|
text,
|
|
433
269
|
speechText: text,
|
|
434
|
-
status:
|
|
435
|
-
|
|
436
|
-
...(record.usage ? { usage: record.usage } : {}),
|
|
437
|
-
...(record.completedAt ? { completedAt: record.completedAt } : {}),
|
|
270
|
+
status: 'completed',
|
|
271
|
+
completedAt: Date.now(),
|
|
438
272
|
};
|
|
439
273
|
}
|
|
440
|
-
function normalizeAgentStatus(status) {
|
|
441
|
-
if (status === 'pending' || status === 'running')
|
|
442
|
-
return 'running';
|
|
443
|
-
return status;
|
|
444
|
-
}
|
|
445
274
|
function readString(value) {
|
|
446
275
|
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
|
|
447
276
|
}
|
|
@@ -459,14 +288,3 @@ function clampNumber(value, fallback, min, max) {
|
|
|
459
288
|
return fallback;
|
|
460
289
|
return Math.max(min, Math.min(max, Math.trunc(parsed)));
|
|
461
290
|
}
|
|
462
|
-
function delay(ms, signal) {
|
|
463
|
-
if (signal.aborted)
|
|
464
|
-
return Promise.resolve();
|
|
465
|
-
return new Promise((resolve) => {
|
|
466
|
-
const timer = setTimeout(resolve, ms);
|
|
467
|
-
signal.addEventListener('abort', () => {
|
|
468
|
-
clearTimeout(timer);
|
|
469
|
-
resolve();
|
|
470
|
-
}, { once: true });
|
|
471
|
-
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