@pellux/goodvibes-sdk 0.25.10 → 0.25.12
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 +178 -6
- package/dist/_internal/contracts/generated/foundation-client-types.d.ts +16 -1
- package/dist/_internal/contracts/generated/foundation-client-types.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/foundation-metadata.d.ts +2 -2
- package/dist/_internal/contracts/generated/foundation-metadata.js +2 -2
- package/dist/_internal/contracts/generated/operator-contract.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/operator-contract.js +178 -6
- package/dist/_internal/contracts/generated/operator-method-ids.d.ts +1 -1
- package/dist/_internal/contracts/generated/operator-method-ids.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/operator-method-ids.js +1 -0
- package/dist/_internal/daemon/context.d.ts +1 -0
- package/dist/_internal/daemon/context.d.ts.map +1 -1
- package/dist/_internal/daemon/integration-route-types.d.ts +1 -0
- package/dist/_internal/daemon/integration-route-types.d.ts.map +1 -1
- package/dist/_internal/daemon/integration-routes.d.ts +1 -1
- package/dist/_internal/daemon/integration-routes.d.ts.map +1 -1
- package/dist/_internal/daemon/integration-routes.js +3 -0
- package/dist/_internal/daemon/operator.d.ts +1 -1
- package/dist/_internal/daemon/operator.d.ts.map +1 -1
- package/dist/_internal/daemon/operator.js +2 -0
- package/dist/_internal/daemon/runtime-route-types.d.ts +1 -1
- package/dist/_internal/daemon/runtime-route-types.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/discord/index.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/discord/index.js +4 -5
- package/dist/_internal/platform/adapters/github/index.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/github/index.js +4 -5
- package/dist/_internal/platform/adapters/google-chat/index.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/google-chat/index.js +7 -5
- package/dist/_internal/platform/adapters/helpers.d.ts +2 -1
- package/dist/_internal/platform/adapters/helpers.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/helpers.js +3 -34
- package/dist/_internal/platform/adapters/homeassistant/index.d.ts +3 -0
- package/dist/_internal/platform/adapters/homeassistant/index.d.ts.map +1 -0
- package/dist/_internal/platform/adapters/homeassistant/index.js +185 -0
- package/dist/_internal/platform/adapters/index.d.ts +1 -0
- package/dist/_internal/platform/adapters/index.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/index.js +1 -0
- package/dist/_internal/platform/adapters/mattermost/index.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/mattermost/index.js +6 -2
- package/dist/_internal/platform/adapters/slack/index.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/slack/index.js +4 -5
- package/dist/_internal/platform/adapters/telegram/index.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/telegram/index.js +7 -5
- package/dist/_internal/platform/adapters/types.d.ts +1 -1
- package/dist/_internal/platform/adapters/types.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/webhook/index.d.ts.map +1 -1
- package/dist/_internal/platform/adapters/webhook/index.js +4 -1
- package/dist/_internal/platform/automation/types.d.ts +1 -1
- package/dist/_internal/platform/automation/types.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/accounts.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/accounts.js +23 -0
- package/dist/_internal/platform/channels/builtin/contracts.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/contracts.js +9 -0
- package/dist/_internal/platform/channels/builtin/descriptors.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/descriptors.js +9 -2
- package/dist/_internal/platform/channels/builtin/homeassistant.d.ts +64 -0
- package/dist/_internal/platform/channels/builtin/homeassistant.d.ts.map +1 -0
- package/dist/_internal/platform/channels/builtin/homeassistant.js +391 -0
- package/dist/_internal/platform/channels/builtin/plugins.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/plugins.js +2 -1
- package/dist/_internal/platform/channels/builtin/presentation.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/presentation.js +4 -0
- package/dist/_internal/platform/channels/builtin/rendering.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/rendering.js +7 -0
- package/dist/_internal/platform/channels/builtin/setup-schema.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/setup-schema.js +53 -0
- package/dist/_internal/platform/channels/builtin/shared.d.ts +1 -1
- package/dist/_internal/platform/channels/builtin/shared.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/shared.js +2 -0
- package/dist/_internal/platform/channels/builtin/surfaces.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/surfaces.js +1 -0
- package/dist/_internal/platform/channels/builtin/targets.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin/targets.js +24 -0
- package/dist/_internal/platform/channels/builtin-runtime.d.ts.map +1 -1
- package/dist/_internal/platform/channels/builtin-runtime.js +6 -0
- package/dist/_internal/platform/channels/delivery/strategies-core.d.ts +1 -0
- package/dist/_internal/platform/channels/delivery/strategies-core.d.ts.map +1 -1
- package/dist/_internal/platform/channels/delivery/strategies-core.js +60 -1
- package/dist/_internal/platform/channels/delivery/types.d.ts +2 -0
- package/dist/_internal/platform/channels/delivery/types.d.ts.map +1 -1
- package/dist/_internal/platform/channels/delivery-router.d.ts.map +1 -1
- package/dist/_internal/platform/channels/delivery-router.js +2 -1
- package/dist/_internal/platform/channels/reply-pipeline.d.ts.map +1 -1
- package/dist/_internal/platform/channels/reply-pipeline.js +9 -0
- package/dist/_internal/platform/channels/route-manager.d.ts.map +1 -1
- package/dist/_internal/platform/channels/route-manager.js +1 -0
- package/dist/_internal/platform/channels/surface-registry.d.ts.map +1 -1
- package/dist/_internal/platform/channels/surface-registry.js +4 -0
- package/dist/_internal/platform/channels/types.d.ts +1 -1
- package/dist/_internal/platform/channels/types.d.ts.map +1 -1
- 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 +27 -24
- package/dist/_internal/platform/cloudflare/types.d.ts +5 -0
- package/dist/_internal/platform/cloudflare/types.d.ts.map +1 -1
- package/dist/_internal/platform/cloudflare/utils.d.ts.map +1 -1
- package/dist/_internal/platform/cloudflare/utils.js +4 -10
- package/dist/_internal/platform/companion/companion-chat-manager.d.ts +24 -4
- package/dist/_internal/platform/companion/companion-chat-manager.d.ts.map +1 -1
- package/dist/_internal/platform/companion/companion-chat-manager.js +128 -78
- package/dist/_internal/platform/config/schema-domain-surfaces.d.ts +12 -0
- package/dist/_internal/platform/config/schema-domain-surfaces.d.ts.map +1 -1
- package/dist/_internal/platform/config/schema-domain-surfaces.js +67 -0
- package/dist/_internal/platform/config/schema-types.d.ts +15 -2
- package/dist/_internal/platform/config/schema-types.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/gateway-utils.d.ts +37 -0
- package/dist/_internal/platform/control-plane/gateway-utils.d.ts.map +1 -0
- package/dist/_internal/platform/control-plane/gateway-utils.js +97 -0
- package/dist/_internal/platform/control-plane/gateway.d.ts +4 -9
- package/dist/_internal/platform/control-plane/gateway.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/gateway.js +26 -61
- package/dist/_internal/platform/control-plane/method-catalog-runtime.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/method-catalog-runtime.js +11 -1
- package/dist/_internal/platform/control-plane/operator-contract-schemas-admin.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/operator-contract-schemas-admin.js +3 -2
- package/dist/_internal/platform/control-plane/operator-contract-schemas-control.d.ts +1 -0
- package/dist/_internal/platform/control-plane/operator-contract-schemas-control.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/operator-contract-schemas-control.js +26 -0
- package/dist/_internal/platform/control-plane/routes/operator.d.ts +1 -1
- package/dist/_internal/platform/control-plane/routes/operator.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/routes/operator.js +2 -0
- package/dist/_internal/platform/control-plane/session-types.d.ts +2 -1
- package/dist/_internal/platform/control-plane/session-types.d.ts.map +1 -1
- package/dist/_internal/platform/control-plane/types.d.ts +1 -1
- package/dist/_internal/platform/control-plane/types.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/control-plane.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/control-plane.js +50 -6
- package/dist/_internal/platform/daemon/facade-composition.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/facade-composition.js +30 -2
- package/dist/_internal/platform/daemon/facade-types.d.ts +1 -1
- package/dist/_internal/platform/daemon/facade-types.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/homeassistant-routes.d.ts +40 -0
- package/dist/_internal/platform/daemon/http/homeassistant-routes.d.ts.map +1 -0
- package/dist/_internal/platform/daemon/http/homeassistant-routes.js +468 -0
- package/dist/_internal/platform/daemon/http/router.d.ts +4 -2
- package/dist/_internal/platform/daemon/http/router.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http/router.js +28 -16
- package/dist/_internal/platform/daemon/http/runtime-route-types.d.ts +1 -1
- package/dist/_internal/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http-listener.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/http-listener.js +4 -8
- package/dist/_internal/platform/daemon/surface-actions.d.ts +1 -1
- package/dist/_internal/platform/daemon/surface-actions.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/surface-delivery.d.ts +1 -1
- package/dist/_internal/platform/daemon/surface-delivery.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/surface-delivery.js +15 -0
- package/dist/_internal/platform/daemon/surface-policy.d.ts +1 -1
- package/dist/_internal/platform/daemon/surface-policy.d.ts.map +1 -1
- package/dist/_internal/platform/daemon/surface-policy.js +8 -0
- package/dist/_internal/platform/daemon/types.d.ts +3 -3
- package/dist/_internal/platform/daemon/types.d.ts.map +1 -1
- package/dist/_internal/platform/integrations/homeassistant.d.ts +62 -0
- package/dist/_internal/platform/integrations/homeassistant.d.ts.map +1 -0
- package/dist/_internal/platform/integrations/homeassistant.js +174 -0
- package/dist/_internal/platform/integrations/index.d.ts +2 -0
- package/dist/_internal/platform/integrations/index.d.ts.map +1 -1
- package/dist/_internal/platform/integrations/index.js +1 -0
- package/dist/_internal/platform/runtime/events/control-plane.d.ts +1 -1
- package/dist/_internal/platform/runtime/events/control-plane.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/control-plane.js +1 -0
- package/dist/_internal/platform/runtime/events/routes.d.ts +1 -1
- package/dist/_internal/platform/runtime/events/routes.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/events/routes.js +1 -0
- package/dist/_internal/platform/runtime/feature-flags/flags.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/feature-flags/flags.js +9 -0
- package/dist/_internal/platform/runtime/feature-flags/gates.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/feature-flags/gates.js +2 -0
- package/dist/_internal/platform/runtime/index.d.ts +2 -0
- package/dist/_internal/platform/runtime/index.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/index.js +1 -0
- package/dist/_internal/platform/runtime/integration/helpers.d.ts +4 -0
- package/dist/_internal/platform/runtime/integration/helpers.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/integration/helpers.js +4 -0
- package/dist/_internal/platform/runtime/security-settings.d.ts +19 -0
- package/dist/_internal/platform/runtime/security-settings.d.ts.map +1 -0
- package/dist/_internal/platform/runtime/security-settings.js +187 -0
- package/dist/_internal/platform/runtime/services.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/services.js +1 -0
- package/dist/_internal/platform/security/user-auth.d.ts +1 -1
- package/dist/_internal/platform/security/user-auth.d.ts.map +1 -1
- package/dist/_internal/platform/security/user-auth.js +18 -3
- package/dist/_internal/platform/tools/edit/core.d.ts.map +1 -1
- package/dist/_internal/platform/tools/edit/core.js +4 -47
- package/dist/_internal/platform/tools/exec/runtime.d.ts.map +1 -1
- package/dist/_internal/platform/tools/exec/runtime.js +7 -1
- package/dist/_internal/platform/tools/exec/schema.d.ts +1 -0
- package/dist/_internal/platform/tools/exec/schema.d.ts.map +1 -1
- package/dist/_internal/platform/tools/exec/schema.js +1 -0
- package/dist/_internal/platform/tools/fetch/runtime.d.ts.map +1 -1
- package/dist/_internal/platform/tools/fetch/runtime.js +140 -19
- package/dist/_internal/platform/tools/fetch/schema.d.ts +1 -0
- package/dist/_internal/platform/tools/fetch/schema.d.ts.map +1 -1
- package/dist/_internal/platform/tools/fetch/schema.js +1 -0
- package/dist/_internal/platform/tools/find/executor.d.ts.map +1 -1
- package/dist/_internal/platform/tools/find/executor.js +7 -1
- package/dist/_internal/platform/tools/find/schema.d.ts.map +1 -1
- package/dist/_internal/platform/tools/find/schema.js +2 -0
- package/dist/_internal/platform/tools/read/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/read/index.js +7 -1
- package/dist/_internal/platform/tools/read/schema.d.ts +1 -0
- package/dist/_internal/platform/tools/read/schema.d.ts.map +1 -1
- package/dist/_internal/platform/tools/read/schema.js +1 -0
- package/dist/_internal/platform/tools/shared/process-manager.d.ts +2 -0
- package/dist/_internal/platform/tools/shared/process-manager.d.ts.map +1 -1
- package/dist/_internal/platform/tools/shared/process-manager.js +67 -5
- package/dist/_internal/platform/tools/write/index.d.ts.map +1 -1
- package/dist/_internal/platform/tools/write/index.js +3 -36
- package/dist/_internal/platform/utils/concurrency.d.ts +3 -0
- package/dist/_internal/platform/utils/concurrency.d.ts.map +1 -0
- package/dist/_internal/platform/utils/concurrency.js +17 -0
- package/dist/_internal/platform/utils/logger.d.ts.map +1 -1
- package/dist/_internal/platform/utils/logger.js +19 -1
- package/dist/_internal/platform/utils/request-body.d.ts +4 -0
- package/dist/_internal/platform/utils/request-body.d.ts.map +1 -0
- package/dist/_internal/platform/utils/request-body.js +45 -0
- package/dist/_internal/platform/version.js +1 -1
- package/dist/workers.d.ts +6 -0
- package/dist/workers.d.ts.map +1 -1
- package/dist/workers.js +55 -3
- package/package.json +1 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { timingSafeEqual, randomUUID } from 'node:crypto';
|
|
2
|
+
import { parseJsonRecord, readTextBodyWithinLimit } from '../helpers.js';
|
|
3
|
+
import { HOME_ASSISTANT_SURFACE, resolveHomeAssistantWebhookSecret, } from '../../channels/builtin/homeassistant.js';
|
|
4
|
+
export async function handleHomeAssistantSurfaceWebhook(req, context) {
|
|
5
|
+
const enabled = Boolean(context.configManager.get('surfaces.homeassistant.enabled'));
|
|
6
|
+
const secret = await resolveHomeAssistantWebhookSecret(context);
|
|
7
|
+
if (!enabled || !secret) {
|
|
8
|
+
return Response.json({ error: 'Home Assistant ingress is not configured' }, { status: 503 });
|
|
9
|
+
}
|
|
10
|
+
const rawBody = await readTextBodyWithinLimit(req);
|
|
11
|
+
if (rawBody instanceof Response)
|
|
12
|
+
return rawBody;
|
|
13
|
+
if (!isAuthorizedHomeAssistantRequest(req, secret)) {
|
|
14
|
+
return Response.json({ error: 'Unauthorized' }, { status: 401 });
|
|
15
|
+
}
|
|
16
|
+
const contentType = req.headers.get('content-type') ?? '';
|
|
17
|
+
const body = contentType.includes('application/json') || rawBody.trim().startsWith('{')
|
|
18
|
+
? parseJsonRecord(rawBody)
|
|
19
|
+
: { message: rawBody.trim() };
|
|
20
|
+
if (body instanceof Response)
|
|
21
|
+
return body;
|
|
22
|
+
const text = readString(body.prompt)
|
|
23
|
+
?? readString(body.message)
|
|
24
|
+
?? readString(body.text)
|
|
25
|
+
?? readString(body.task)
|
|
26
|
+
?? '';
|
|
27
|
+
const controlCommand = text ? context.parseSurfaceControlCommand(text) : null;
|
|
28
|
+
if (controlCommand) {
|
|
29
|
+
const message = await context.performSurfaceControlCommand(controlCommand);
|
|
30
|
+
return Response.json({ acknowledged: true, control: true, message });
|
|
31
|
+
}
|
|
32
|
+
const conversationId = readString(body.conversationId ?? body.conversation_id)
|
|
33
|
+
?? readString(body.threadId ?? body.thread_id)
|
|
34
|
+
?? readString(body.deviceId ?? body.device_id)
|
|
35
|
+
?? String(context.configManager.get('surfaces.homeassistant.defaultConversationId') || 'goodvibes');
|
|
36
|
+
const surfaceId = readString(body.surfaceId ?? body.instanceId ?? body.instance_id)
|
|
37
|
+
?? readString(body.hassInstanceId ?? body.hass_instance_id)
|
|
38
|
+
?? 'homeassistant';
|
|
39
|
+
const threadId = readString(body.threadId ?? body.thread_id);
|
|
40
|
+
const channelId = readString(body.areaId ?? body.area_id)
|
|
41
|
+
?? readString(body.entityId ?? body.entity_id)
|
|
42
|
+
?? conversationId;
|
|
43
|
+
const messageId = readString(body.messageId ?? body.message_id) ?? `ha-${randomUUID()}`;
|
|
44
|
+
const mode = readString(body.mode ?? body.type)?.toLowerCase() ?? 'prompt';
|
|
45
|
+
const conversationKind = conversationKindForHomeAssistant(mode, threadId, channelId);
|
|
46
|
+
const policy = await context.authorizeSurfaceIngress({
|
|
47
|
+
surface: HOME_ASSISTANT_SURFACE,
|
|
48
|
+
userId: readString(body.userId ?? body.user_id),
|
|
49
|
+
channelId,
|
|
50
|
+
groupId: readString(body.areaId ?? body.area_id) ?? channelId,
|
|
51
|
+
threadId,
|
|
52
|
+
workspaceId: readString(body.instanceId ?? body.instance_id),
|
|
53
|
+
conversationKind,
|
|
54
|
+
hasAnyMention: typeof body.hasAnyMention === 'boolean' ? body.hasAnyMention : true,
|
|
55
|
+
text,
|
|
56
|
+
mentioned: typeof body.mentioned === 'boolean' ? body.mentioned : true,
|
|
57
|
+
metadata: body,
|
|
58
|
+
});
|
|
59
|
+
if (!policy.allowed) {
|
|
60
|
+
return Response.json({ error: `Blocked by channel policy: ${policy.reason}` }, { status: 403 });
|
|
61
|
+
}
|
|
62
|
+
await context.routeBindings.start();
|
|
63
|
+
const binding = await context.routeBindings.upsertBinding({
|
|
64
|
+
kind: threadId ? 'thread' : 'channel',
|
|
65
|
+
surfaceKind: HOME_ASSISTANT_SURFACE,
|
|
66
|
+
surfaceId,
|
|
67
|
+
externalId: conversationId,
|
|
68
|
+
threadId,
|
|
69
|
+
channelId,
|
|
70
|
+
sessionId: readString(body.sessionId ?? body.session_id),
|
|
71
|
+
title: readString(body.title) ?? 'Home Assistant',
|
|
72
|
+
metadata: {
|
|
73
|
+
...body,
|
|
74
|
+
directoryKind: conversationKind === 'direct' ? 'user' : conversationKind,
|
|
75
|
+
source: 'homeassistant',
|
|
76
|
+
messageId,
|
|
77
|
+
conversationId,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
if (!text.trim()) {
|
|
81
|
+
return Response.json({
|
|
82
|
+
acknowledged: true,
|
|
83
|
+
queued: false,
|
|
84
|
+
bindingId: binding.id,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const routing = readRouting(body);
|
|
88
|
+
const submission = await context.sessionBroker.submitMessage({
|
|
89
|
+
sessionId: readString(body.sessionId ?? body.session_id),
|
|
90
|
+
routeId: binding.id,
|
|
91
|
+
surfaceKind: HOME_ASSISTANT_SURFACE,
|
|
92
|
+
surfaceId,
|
|
93
|
+
externalId: conversationId,
|
|
94
|
+
threadId,
|
|
95
|
+
userId: readString(body.userId ?? body.user_id),
|
|
96
|
+
displayName: readString(body.displayName ?? body.userName ?? body.user_name),
|
|
97
|
+
title: readString(body.title) ?? 'Home Assistant',
|
|
98
|
+
body: text,
|
|
99
|
+
metadata: {
|
|
100
|
+
source: 'homeassistant',
|
|
101
|
+
messageId,
|
|
102
|
+
conversationId,
|
|
103
|
+
deviceId: readString(body.deviceId ?? body.device_id) ?? null,
|
|
104
|
+
entityId: readString(body.entityId ?? body.entity_id) ?? null,
|
|
105
|
+
},
|
|
106
|
+
...(routing ? { routing } : {}),
|
|
107
|
+
});
|
|
108
|
+
if (submission.mode === 'continued-live') {
|
|
109
|
+
return Response.json({
|
|
110
|
+
acknowledged: true,
|
|
111
|
+
queued: true,
|
|
112
|
+
continued: true,
|
|
113
|
+
bindingId: binding.id,
|
|
114
|
+
sessionId: submission.session.id,
|
|
115
|
+
agentId: submission.activeAgentId ?? null,
|
|
116
|
+
messageId,
|
|
117
|
+
conversationId,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const spawnResult = context.trySpawnAgent({
|
|
121
|
+
mode: 'spawn',
|
|
122
|
+
task: submission.task,
|
|
123
|
+
...(routing?.modelId ? { model: routing.modelId } : {}),
|
|
124
|
+
...(routing?.providerId ? { provider: routing.providerId } : {}),
|
|
125
|
+
...(routing?.tools?.length ? { tools: [...routing.tools] } : {}),
|
|
126
|
+
context: `homeassistant:${conversationId}`,
|
|
127
|
+
}, 'handleHomeAssistantSurfaceWebhook', submission.session.id);
|
|
128
|
+
if (spawnResult instanceof Response)
|
|
129
|
+
return spawnResult;
|
|
130
|
+
await context.sessionBroker.bindAgent(submission.session.id, spawnResult.id);
|
|
131
|
+
context.queueSurfaceReplyFromBinding(binding, {
|
|
132
|
+
agentId: spawnResult.id,
|
|
133
|
+
task: text,
|
|
134
|
+
sessionId: submission.session.id,
|
|
135
|
+
});
|
|
136
|
+
return Response.json({
|
|
137
|
+
acknowledged: true,
|
|
138
|
+
queued: true,
|
|
139
|
+
bindingId: binding.id,
|
|
140
|
+
sessionId: submission.session.id,
|
|
141
|
+
agentId: spawnResult.id,
|
|
142
|
+
messageId,
|
|
143
|
+
conversationId,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function isAuthorizedHomeAssistantRequest(req, secret) {
|
|
147
|
+
const candidates = [
|
|
148
|
+
req.headers.get('x-goodvibes-homeassistant-secret'),
|
|
149
|
+
req.headers.get('x-goodvibes-webhook-secret'),
|
|
150
|
+
req.headers.get('authorization')?.replace(/^Bearer\s+/i, ''),
|
|
151
|
+
].filter((value) => typeof value === 'string' && value.length > 0);
|
|
152
|
+
return candidates.some((candidate) => safeEqual(candidate, secret));
|
|
153
|
+
}
|
|
154
|
+
function safeEqual(a, b) {
|
|
155
|
+
const left = Buffer.from(a);
|
|
156
|
+
const right = Buffer.from(b);
|
|
157
|
+
return left.length === right.length && timingSafeEqual(left, right);
|
|
158
|
+
}
|
|
159
|
+
function conversationKindForHomeAssistant(mode, threadId, channelId) {
|
|
160
|
+
if (threadId)
|
|
161
|
+
return 'thread';
|
|
162
|
+
if (mode === 'conversation' || mode === 'chat' || mode === 'prompt')
|
|
163
|
+
return 'direct';
|
|
164
|
+
return channelId ? 'channel' : 'service';
|
|
165
|
+
}
|
|
166
|
+
function readRouting(body) {
|
|
167
|
+
const providerId = readString(body.providerId ?? body.provider);
|
|
168
|
+
const modelId = readString(body.modelId ?? body.model);
|
|
169
|
+
const tools = readStringList(body.tools);
|
|
170
|
+
if (!providerId && !modelId && !tools.length)
|
|
171
|
+
return undefined;
|
|
172
|
+
return {
|
|
173
|
+
...(providerId ? { providerId } : {}),
|
|
174
|
+
...(modelId ? { modelId } : {}),
|
|
175
|
+
...(tools.length ? { tools } : {}),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function readString(value) {
|
|
179
|
+
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : undefined;
|
|
180
|
+
}
|
|
181
|
+
function readStringList(value) {
|
|
182
|
+
return Array.isArray(value)
|
|
183
|
+
? value.filter((entry) => typeof entry === 'string' && entry.trim().length > 0).map((entry) => entry.trim())
|
|
184
|
+
: [];
|
|
185
|
+
}
|
|
@@ -2,6 +2,7 @@ export * from './types.js';
|
|
|
2
2
|
export { handleSlackSurfacePayload, handleSlackSurfaceWebhook } from './slack/index.js';
|
|
3
3
|
export { handleDiscordGatewayDispatchPayload, handleDiscordInteractionPayload, handleDiscordSurfaceWebhook } from './discord/index.js';
|
|
4
4
|
export { handleNtfySurfacePayload, handleNtfySurfaceWebhook } from './ntfy/index.js';
|
|
5
|
+
export { handleHomeAssistantSurfaceWebhook } from './homeassistant/index.js';
|
|
5
6
|
export { handleTelegramSurfaceWebhook } from './telegram/index.js';
|
|
6
7
|
export { handleGoogleChatSurfaceWebhook } from './google-chat/index.js';
|
|
7
8
|
export { handleSignalSurfaceWebhook } from './signal/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,mCAAmC,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACvI,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,mCAAmC,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACvI,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -2,6 +2,7 @@ export * from './types.js';
|
|
|
2
2
|
export { handleSlackSurfacePayload, handleSlackSurfaceWebhook } from './slack/index.js';
|
|
3
3
|
export { handleDiscordGatewayDispatchPayload, handleDiscordInteractionPayload, handleDiscordSurfaceWebhook } from './discord/index.js';
|
|
4
4
|
export { handleNtfySurfacePayload, handleNtfySurfaceWebhook } from './ntfy/index.js';
|
|
5
|
+
export { handleHomeAssistantSurfaceWebhook } from './homeassistant/index.js';
|
|
5
6
|
export { handleTelegramSurfaceWebhook } from './telegram/index.js';
|
|
6
7
|
export { handleGoogleChatSurfaceWebhook } from './google-chat/index.js';
|
|
7
8
|
export { handleSignalSurfaceWebhook } from './signal/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/adapters/mattermost/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/adapters/mattermost/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAoCzD,wBAAsB,8BAA8B,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqHpH"}
|
|
@@ -8,8 +8,12 @@ function readString(value) {
|
|
|
8
8
|
async function readBody(req) {
|
|
9
9
|
const contentType = req.headers.get('content-type') ?? '';
|
|
10
10
|
if (contentType.includes('multipart/form-data')) {
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const contentLengthHeader = req.headers.get('content-length');
|
|
12
|
+
const contentLength = parseInt(contentLengthHeader ?? '', 10);
|
|
13
|
+
if (!contentLengthHeader || !Number.isFinite(contentLength)) {
|
|
14
|
+
return Response.json({ error: 'Content-Length required for multipart payloads' }, { status: 411 });
|
|
15
|
+
}
|
|
16
|
+
if (contentLength > 1_000_000) {
|
|
13
17
|
return Response.json({ error: 'Payload too large' }, { status: 413 });
|
|
14
18
|
}
|
|
15
19
|
const form = await req.formData().catch(() => null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/adapters/slack/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/adapters/slack/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAMzD,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4C/G;AAED,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,OAAO,EAAE,qBAAqB,EAC9B,KAAK,mBAAyB,EAC9B,GAAG,GAAE,OAAiF,GACrF,OAAO,CAAC,QAAQ,CAAC,CAyQnB"}
|
|
@@ -3,11 +3,8 @@ import { SlackIntegration } from '../../integrations/index.js';
|
|
|
3
3
|
import { summarizeError } from '../../utils/error-display.js';
|
|
4
4
|
import { fetchWithTimeout } from '../../utils/fetch-with-timeout.js';
|
|
5
5
|
import { resolveSecretInput } from '../../config/secret-refs.js';
|
|
6
|
+
import { readTextBodyWithinLimit } from '../helpers.js';
|
|
6
7
|
export async function handleSlackSurfaceWebhook(req, context) {
|
|
7
|
-
const contentLength = parseInt(req.headers.get('content-length') ?? '0', 10);
|
|
8
|
-
if (contentLength > 1_000_000) {
|
|
9
|
-
return Response.json({ error: 'Payload too large' }, { status: 413 });
|
|
10
|
-
}
|
|
11
8
|
const signingSecret = await context.serviceRegistry.resolveSecret('slack', 'signingSecret')
|
|
12
9
|
?? await resolveSlackConfigSecret(context, 'surfaces.slack.signingSecret')
|
|
13
10
|
?? process.env.SLACK_SIGNING_SECRET;
|
|
@@ -17,7 +14,9 @@ export async function handleSlackSurfaceWebhook(req, context) {
|
|
|
17
14
|
}
|
|
18
15
|
const timestamp = req.headers.get('x-slack-request-timestamp') ?? '';
|
|
19
16
|
const signature = req.headers.get('x-slack-signature') ?? '';
|
|
20
|
-
const rawBody = await req
|
|
17
|
+
const rawBody = await readTextBodyWithinLimit(req);
|
|
18
|
+
if (rawBody instanceof Response)
|
|
19
|
+
return rawBody;
|
|
21
20
|
const slack = new SlackIntegration(await context.serviceRegistry.resolveSecret('slack', 'webhookUrl') ?? process.env.SLACK_WEBHOOK_URL, await context.serviceRegistry.resolveSecret('slack', 'primary')
|
|
22
21
|
?? await resolveSlackConfigSecret(context, 'surfaces.slack.botToken')
|
|
23
22
|
?? process.env.SLACK_BOT_TOKEN);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/adapters/telegram/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/adapters/telegram/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAkCzD,wBAAsB,4BAA4B,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6HlH"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseJsonRecord, readTextBodyWithinLimit } from '../helpers.js';
|
|
1
2
|
function readRecord(value) {
|
|
2
3
|
return value && typeof value === 'object' ? value : null;
|
|
3
4
|
}
|
|
@@ -30,10 +31,6 @@ function telegramConversationKind(chatType, threadId) {
|
|
|
30
31
|
return 'group';
|
|
31
32
|
}
|
|
32
33
|
export async function handleTelegramSurfaceWebhook(req, context) {
|
|
33
|
-
const contentLength = parseInt(req.headers.get('content-length') ?? '0', 10);
|
|
34
|
-
if (contentLength > 1_000_000) {
|
|
35
|
-
return Response.json({ error: 'Payload too large' }, { status: 413 });
|
|
36
|
-
}
|
|
37
34
|
const configuredSecret = String(context.configManager.get('surfaces.telegram.webhookSecret') ?? '')
|
|
38
35
|
|| await context.serviceRegistry.resolveSecret('telegram', 'signingSecret')
|
|
39
36
|
|| process.env.TELEGRAM_WEBHOOK_SECRET
|
|
@@ -44,7 +41,12 @@ export async function handleTelegramSurfaceWebhook(req, context) {
|
|
|
44
41
|
return Response.json({ error: 'Unauthorized' }, { status: 401 });
|
|
45
42
|
}
|
|
46
43
|
}
|
|
47
|
-
const
|
|
44
|
+
const rawBody = await readTextBodyWithinLimit(req);
|
|
45
|
+
if (rawBody instanceof Response)
|
|
46
|
+
return rawBody;
|
|
47
|
+
const body = parseJsonRecord(rawBody);
|
|
48
|
+
if (body instanceof Response)
|
|
49
|
+
return body;
|
|
48
50
|
const payload = readRecord(body);
|
|
49
51
|
if (!payload)
|
|
50
52
|
return Response.json({ error: 'Invalid JSON body' }, { status: 400 });
|
|
@@ -43,7 +43,7 @@ export interface SurfaceAdapterContext {
|
|
|
43
43
|
readonly routeBindings: RouteBindingManager;
|
|
44
44
|
readonly sessionBroker: SharedSessionBroker;
|
|
45
45
|
readonly authorizeSurfaceIngress: (input: {
|
|
46
|
-
surface: Extract<AutomationSurfaceKind, 'slack' | 'discord' | 'ntfy' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix'>;
|
|
46
|
+
surface: Extract<AutomationSurfaceKind, 'slack' | 'discord' | 'ntfy' | 'homeassistant' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix'>;
|
|
47
47
|
userId?: string;
|
|
48
48
|
channelId?: string;
|
|
49
49
|
groupId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/adapters/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE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,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/adapters/webhook/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/adapters/webhook/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAYhE,wBAAsB,2BAA2B,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,QAAQ,CAAC,CAsKxH"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { timingSafeEqual } from 'node:crypto';
|
|
2
2
|
import { validatePublicWebhookUrl } from '../../utils/url-safety.js';
|
|
3
|
+
import { readTextBodyWithinLimit } from '../helpers.js';
|
|
3
4
|
function parseJsonRecord(rawBody) {
|
|
4
5
|
try {
|
|
5
6
|
return JSON.parse(rawBody);
|
|
@@ -14,7 +15,9 @@ export async function handleGenericWebhookSurface(req, context) {
|
|
|
14
15
|
if (!enabled || !configuredSecret) {
|
|
15
16
|
return Response.json({ error: 'Webhook ingress is not configured' }, { status: 503 });
|
|
16
17
|
}
|
|
17
|
-
const rawBody = await req
|
|
18
|
+
const rawBody = await readTextBodyWithinLimit(req);
|
|
19
|
+
if (rawBody instanceof Response)
|
|
20
|
+
return rawBody;
|
|
18
21
|
const providedSignature = req.headers.get('x-goodvibes-signature') ?? '';
|
|
19
22
|
const providedSecret = req.headers.get('x-goodvibes-webhook-secret')
|
|
20
23
|
?? req.headers.get('authorization')?.replace(/^Bearer\s+/i, '')
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export type AutomationJobStatus = 'enabled' | 'paused' | 'error' | 'archived';
|
|
7
7
|
export type AutomationRunStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
8
8
|
export type AutomationRunTrigger = 'scheduled' | 'manual' | 'catch_up' | 'webhook' | 'surface' | 'watcher' | 'migration';
|
|
9
|
-
export type AutomationSurfaceKind = 'tui' | 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'service';
|
|
9
|
+
export type AutomationSurfaceKind = 'tui' | 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'homeassistant' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'service';
|
|
10
10
|
export type AutomationRouteKind = 'session' | 'thread' | 'channel' | 'message';
|
|
11
11
|
export type AutomationSourceKind = 'schedule' | 'manual' | 'hook' | 'webhook' | 'surface' | 'watcher' | 'migration';
|
|
12
12
|
export type AutomationExecutionKind = 'isolated' | 'current' | 'pinned' | 'background' | 'main';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/automation/types.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;GAGG;AAEH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAC9E,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC9F,MAAM,MAAM,oBAAoB,GAC5B,WAAW,GACX,QAAQ,GACR,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,CAAC;AAEhB,MAAM,MAAM,qBAAqB,GAC7B,KAAK,GACL,KAAK,GACL,OAAO,GACP,SAAS,GACT,MAAM,GACN,SAAS,GACT,UAAU,GACV,aAAa,GACb,QAA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,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/channels/builtin/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAEV,oBAAoB,EAEpB,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC;CAC9E;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/channels/builtin/accounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAEV,oBAAoB,EAEpB,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAE7D,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC;CAC9E;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,oBAAoB,CAAC,CAiT/B;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAKtC"}
|
|
@@ -100,6 +100,29 @@ export async function buildBuiltinAccount(context, surface) {
|
|
|
100
100
|
},
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
+
case 'homeassistant': {
|
|
104
|
+
const surfaces = context.deps.configManager.getCategory('surfaces');
|
|
105
|
+
const secrets = await Promise.all([
|
|
106
|
+
describeBuiltinSecret(context.deps, 'primary', 'Long-lived access token', surfaces.homeassistant.accessToken, ['HOMEASSISTANT_ACCESS_TOKEN', 'HOME_ASSISTANT_ACCESS_TOKEN', 'HA_ACCESS_TOKEN'], 'homeassistant', 'primary'),
|
|
107
|
+
describeBuiltinSecret(context.deps, 'webhookSecret', 'Webhook secret', surfaces.homeassistant.webhookSecret, ['HOMEASSISTANT_WEBHOOK_SECRET', 'HOME_ASSISTANT_WEBHOOK_SECRET', 'HA_GOODVIBES_WEBHOOK_SECRET'], 'homeassistant', 'signingSecret'),
|
|
108
|
+
]);
|
|
109
|
+
return finalizeBuiltinChannelAccount({
|
|
110
|
+
surface,
|
|
111
|
+
label: 'Home Assistant',
|
|
112
|
+
enabled: context.deps.surfaceDeliveryEnabled('homeassistant'),
|
|
113
|
+
accountId: surfaces.homeassistant.deviceId || surfaces.homeassistant.defaultConversationId || 'surface:homeassistant',
|
|
114
|
+
secrets,
|
|
115
|
+
metadata: {
|
|
116
|
+
instanceUrl: surfaces.homeassistant.instanceUrl,
|
|
117
|
+
defaultConversationId: surfaces.homeassistant.defaultConversationId,
|
|
118
|
+
deviceId: surfaces.homeassistant.deviceId,
|
|
119
|
+
deviceName: surfaces.homeassistant.deviceName,
|
|
120
|
+
eventType: surfaces.homeassistant.eventType,
|
|
121
|
+
remoteSessionTtlMs: surfaces.homeassistant.remoteSessionTtlMs,
|
|
122
|
+
setupVersion: surfaces.homeassistant.setupVersion,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
}
|
|
103
126
|
case 'telegram': {
|
|
104
127
|
const surfaces = context.deps.configManager.getCategory('surfaces');
|
|
105
128
|
const secrets = await Promise.all([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/channels/builtin/contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAK1B,mBAAmB,EAGnB,qBAAqB,EAErB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,aAAa,CAAC;AAIrB,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC7C,QAAQ,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClF,QAAQ,CAAC,cAAc,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAC9G,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,2BAA2B,KAAK,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;CAClI;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,cAAc,GACtB,IAAI,CACL,aAAa,EACX,cAAc,GACd,cAAc,GACd,gBAAgB,GAChB,QAAQ,GACR,mBAAmB,GACnB,mBAAmB,GACnB,kBAAkB,GAClB,k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octorReport(context, surface, accountId) {
|
|
|
101
101
|
if (surface === 'matrix' && !surfaces.matrix.homeserverUrl) {
|
|
102
102
|
pushCheck('homeserver-url', 'Homeserver URL', 'fail', 'Matrix requires a homeserver URL.', 'setup');
|
|
103
103
|
}
|
|
104
|
+
if (surface === 'homeassistant' && !surfaces.homeassistant.webhookSecret) {
|
|
105
|
+
pushCheck('webhook-secret', 'Webhook secret', 'fail', 'Home Assistant ingress requires a webhook secret because webhook routes are evaluated before daemon bearer auth.', 'setup');
|
|
106
|
+
}
|
|
107
|
+
if (surface === 'homeassistant' && !surfaces.homeassistant.instanceUrl) {
|
|
108
|
+
pushCheck('instance-url', 'Instance URL', 'warn', 'Home Assistant REST-backed tools require an instance URL; daemon-only prompt ingress can work without one.', 'setup');
|
|
109
|
+
}
|
|
110
|
+
if (surface === 'homeassistant' && !surfaces.homeassistant.accessToken) {
|
|
111
|
+
pushCheck('access-token', 'Long-lived access token', 'warn', 'Home Assistant state, service, template, and event-delivery tools require an access token.', 'setup');
|
|
112
|
+
}
|
|
104
113
|
const failures = checks.filter((check) => check.status === 'fail').length;
|
|
105
114
|
const warnings = checks.filter((check) => check.status === 'warn').length;
|
|
106
115
|
const summary = failures > 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/channels/builtin/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAC3B,+BAA+B,EAC/B,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/channels/builtin/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAC3B,+BAA+B,EAC/B,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAOrB,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,oBAAoB,EAC7B,eAAe,EAAE,SAAS,iBAAiB,EAAE,GAC5C,2BAA2B,EAAE,CAiH/B;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,cAAc,GAAG,+BAA+B,EAAE,CAwOrG;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,qBAAqB,EAAE,CAgOjF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HOME_ASSISTANT_SURFACE, listHomeAssistantOperatorActions, listHomeAssistantTools, } from './homeassistant.js';
|
|
1
2
|
export function listBuiltinCapabilities(surface, account, rawCapabilities) {
|
|
2
3
|
const supports = (capability) => rawCapabilities.includes(capability);
|
|
3
4
|
return [
|
|
@@ -113,7 +114,7 @@ export function listBuiltinCapabilities(surface, account, rawCapabilities) {
|
|
|
113
114
|
];
|
|
114
115
|
}
|
|
115
116
|
export function listBuiltinOperatorActions(surface) {
|
|
116
|
-
|
|
117
|
+
const actions = [
|
|
117
118
|
{
|
|
118
119
|
id: 'inspect-account',
|
|
119
120
|
surface,
|
|
@@ -341,9 +342,12 @@ export function listBuiltinOperatorActions(surface) {
|
|
|
341
342
|
metadata: {},
|
|
342
343
|
},
|
|
343
344
|
];
|
|
345
|
+
return surface === HOME_ASSISTANT_SURFACE
|
|
346
|
+
? [...actions, ...listHomeAssistantOperatorActions()]
|
|
347
|
+
: actions;
|
|
344
348
|
}
|
|
345
349
|
export function listBuiltinTools(surface) {
|
|
346
|
-
|
|
350
|
+
const tools = [
|
|
347
351
|
{
|
|
348
352
|
id: `${surface}:account`,
|
|
349
353
|
surface,
|
|
@@ -563,4 +567,7 @@ export function listBuiltinTools(surface) {
|
|
|
563
567
|
metadata: {},
|
|
564
568
|
},
|
|
565
569
|
];
|
|
570
|
+
return surface === HOME_ASSISTANT_SURFACE
|
|
571
|
+
? [...tools, ...listHomeAssistantTools()]
|
|
572
|
+
: tools;
|
|
566
573
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { SecretsManager } from '../../config/secrets.js';
|
|
2
|
+
import type { ServiceRegistry } from '../../config/service-registry.js';
|
|
3
|
+
import { HomeAssistantIntegration } from '../../integrations/homeassistant.js';
|
|
4
|
+
import type { ChannelOperatorActionDescriptor, ChannelToolDescriptor } from '../types.js';
|
|
5
|
+
import type { BuiltinChannelRuntimeDeps } from './shared.js';
|
|
6
|
+
export declare const HOME_ASSISTANT_SURFACE: "homeassistant";
|
|
7
|
+
export declare const HOME_ASSISTANT_WEBHOOK_PATH = "/webhook/homeassistant";
|
|
8
|
+
export declare const HOME_ASSISTANT_DEFAULT_EVENT_TYPE = "goodvibes_message";
|
|
9
|
+
interface ConfigReader {
|
|
10
|
+
get(key: string): unknown;
|
|
11
|
+
}
|
|
12
|
+
interface HomeAssistantActionContext {
|
|
13
|
+
readonly deps: BuiltinChannelRuntimeDeps;
|
|
14
|
+
}
|
|
15
|
+
export interface HomeAssistantSurfaceManifest {
|
|
16
|
+
readonly protocolVersion: number;
|
|
17
|
+
readonly surface: 'homeassistant';
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly device: {
|
|
20
|
+
readonly identifiers: readonly string[];
|
|
21
|
+
readonly manufacturer: string;
|
|
22
|
+
readonly model: string;
|
|
23
|
+
readonly name: string;
|
|
24
|
+
readonly swVersion?: string;
|
|
25
|
+
};
|
|
26
|
+
readonly daemon: {
|
|
27
|
+
readonly baseUrl: string;
|
|
28
|
+
readonly auth: 'bearer';
|
|
29
|
+
readonly endpoints: Record<string, string>;
|
|
30
|
+
};
|
|
31
|
+
readonly capabilities: readonly string[];
|
|
32
|
+
readonly events: {
|
|
33
|
+
readonly outboundEventType: string;
|
|
34
|
+
readonly inboundWebhookPath: string;
|
|
35
|
+
readonly inboundSecretHeaders: readonly string[];
|
|
36
|
+
};
|
|
37
|
+
readonly recommendedServices: readonly {
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly target: 'config_entry' | 'device' | 'entity';
|
|
40
|
+
readonly description: string;
|
|
41
|
+
}[];
|
|
42
|
+
readonly metadata: Record<string, unknown>;
|
|
43
|
+
}
|
|
44
|
+
export declare function listHomeAssistantOperatorActions(): ChannelOperatorActionDescriptor[];
|
|
45
|
+
export declare function listHomeAssistantTools(): ChannelToolDescriptor[];
|
|
46
|
+
export declare function runHomeAssistantOperatorAction(context: HomeAssistantActionContext, actionId: string, input?: Record<string, unknown>): Promise<{
|
|
47
|
+
readonly handled: boolean;
|
|
48
|
+
readonly result: unknown;
|
|
49
|
+
}>;
|
|
50
|
+
export declare function buildHomeAssistantManifest(deps: Pick<BuiltinChannelRuntimeDeps, 'configManager'>): HomeAssistantSurfaceManifest;
|
|
51
|
+
export declare function createHomeAssistantClient(deps: BuiltinChannelRuntimeDeps): Promise<HomeAssistantIntegration>;
|
|
52
|
+
export declare function resolveHomeAssistantBaseUrl(configManager: ConfigReader, serviceRegistry?: Pick<ServiceRegistry, 'get'>): string | null;
|
|
53
|
+
export declare function resolveHomeAssistantAccessToken(deps: {
|
|
54
|
+
readonly configManager: ConfigReader;
|
|
55
|
+
readonly secretsManager?: Pick<SecretsManager, 'get' | 'getGlobalHome'>;
|
|
56
|
+
readonly serviceRegistry?: Pick<ServiceRegistry, 'resolveSecret'>;
|
|
57
|
+
}): Promise<string | null>;
|
|
58
|
+
export declare function resolveHomeAssistantWebhookSecret(deps: {
|
|
59
|
+
readonly configManager: ConfigReader;
|
|
60
|
+
readonly secretsManager?: Pick<SecretsManager, 'get' | 'getGlobalHome'>;
|
|
61
|
+
readonly serviceRegistry?: Pick<ServiceRegistry, 'resolveSecret'>;
|
|
62
|
+
}): Promise<string | null>;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=homeassistant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"homeassistant.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/platform/channels/builtin/homeassistant.ts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