@beeos-ai/device-agent 0.9.3 → 0.9.7
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/adapters/transport-bridge-ws.d.ts +12 -0
- package/dist/adapters/transport-bridge-ws.js +27 -3
- package/dist/adapters/transport-bridge-ws.js.map +1 -1
- package/dist/agent-runtime/core.d.ts +1 -1
- package/dist/agent-runtime/core.js +41 -0
- package/dist/agent-runtime/core.js.map +1 -1
- package/dist/app/session-manager.d.ts +14 -11
- package/dist/app/session-manager.js +8 -9
- package/dist/app/session-manager.js.map +1 -1
- package/dist/bootstrap.js +140 -11
- package/dist/bootstrap.js.map +1 -1
- package/dist/chat.js +11 -1
- package/dist/chat.js.map +1 -1
- package/dist/config/loader.js +3 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +3 -0
- package/dist/config/schema.js +65 -21
- package/dist/config/schema.js.map +1 -1
- package/dist/fleet/adapters/process/node-process-manager.d.ts +115 -13
- package/dist/fleet/adapters/process/node-process-manager.js +412 -64
- package/dist/fleet/adapters/process/node-process-manager.js.map +1 -1
- package/dist/fleet/adapters/state/port-allocator.d.ts +12 -0
- package/dist/fleet/adapters/state/port-allocator.js +39 -5
- package/dist/fleet/adapters/state/port-allocator.js.map +1 -1
- package/dist/fleet/domain/events.d.ts +23 -1
- package/dist/fleet/domain/fsm.d.ts +13 -1
- package/dist/fleet/domain/fsm.js +70 -0
- package/dist/fleet/domain/fsm.js.map +1 -1
- package/dist/fleet/supervisor.js +30 -0
- package/dist/fleet/supervisor.js.map +1 -1
- package/dist/health/adb-track-devices.d.ts +103 -0
- package/dist/health/adb-track-devices.js +171 -0
- package/dist/health/adb-track-devices.js.map +1 -0
- package/dist/health/health-reporter.d.ts +67 -0
- package/dist/health/health-reporter.js +123 -0
- package/dist/health/health-reporter.js.map +1 -0
- package/dist/health/index.d.ts +6 -0
- package/dist/health/index.js +4 -0
- package/dist/health/index.js.map +1 -0
- package/dist/health/mcp-health-monitor.d.ts +190 -0
- package/dist/health/mcp-health-monitor.js +267 -0
- package/dist/health/mcp-health-monitor.js.map +1 -0
- package/dist/inbound/cli/main.js +10 -3
- package/dist/inbound/cli/main.js.map +1 -1
- package/dist/inbound/cli/run-command.js +24 -2
- package/dist/inbound/cli/run-command.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-client/action-mapping.d.ts +45 -0
- package/dist/mcp-client/action-mapping.js +224 -0
- package/dist/mcp-client/action-mapping.js.map +1 -0
- package/dist/mcp-client/autospawn.d.ts +15 -2
- package/dist/mcp-client/autospawn.js +82 -4
- package/dist/mcp-client/autospawn.js.map +1 -1
- package/dist/mcp-client/client.d.ts +134 -38
- package/dist/mcp-client/client.js +394 -87
- package/dist/mcp-client/client.js.map +1 -1
- package/dist/mcp-client/index.d.ts +5 -3
- package/dist/mcp-client/index.js +2 -1
- package/dist/mcp-client/index.js.map +1 -1
- package/dist/mcp-client/inproc.d.ts +2 -2
- package/dist/mcp-client/inproc.js.map +1 -1
- package/dist/mcp-client/runtime.d.ts +124 -21
- package/dist/mcp-client/runtime.js +18 -7
- package/dist/mcp-client/runtime.js.map +1 -1
- package/dist/messaging/token-provider.d.ts +15 -14
- package/dist/messaging/token-provider.js +16 -16
- package/dist/messaging/token-provider.js.map +1 -1
- package/dist/model/adapters/autoglm.js +44 -45
- package/dist/model/adapters/autoglm.js.map +1 -1
- package/dist/model/adapters/guiowl.js +3 -2
- package/dist/model/adapters/guiowl.js.map +1 -1
- package/dist/model/adapters/maiui.js +80 -53
- package/dist/model/adapters/maiui.js.map +1 -1
- package/dist/model/adapters/qwenvl.js +147 -51
- package/dist/model/adapters/qwenvl.js.map +1 -1
- package/dist/model/adapters/tool-call.js +13 -3
- package/dist/model/adapters/tool-call.js.map +1 -1
- package/dist/model/adapters/uitars.js +80 -84
- package/dist/model/adapters/uitars.js.map +1 -1
- package/dist/plugins/acp/index.d.ts +35 -0
- package/dist/plugins/acp/index.js +121 -0
- package/dist/plugins/acp/index.js.map +1 -1
- package/dist/plugins/message-bus/busy-reply.d.ts +5 -5
- package/dist/plugins/message-bus/busy-reply.js +30 -9
- package/dist/plugins/message-bus/busy-reply.js.map +1 -1
- package/dist/plugins/message-bus/cancel.d.ts +5 -11
- package/dist/plugins/message-bus/cancel.js +8 -14
- package/dist/plugins/message-bus/cancel.js.map +1 -1
- package/dist/plugins/message-bus/inbound.d.ts +18 -25
- package/dist/plugins/message-bus/inbound.js +23 -55
- package/dist/plugins/message-bus/inbound.js.map +1 -1
- package/dist/plugins/message-bus/index.d.ts +25 -44
- package/dist/plugins/message-bus/index.js +70 -111
- package/dist/plugins/message-bus/index.js.map +1 -1
- package/dist/plugins/message-bus/ms-channel-notifier.d.ts +24 -37
- package/dist/plugins/message-bus/ms-channel-notifier.js +39 -59
- package/dist/plugins/message-bus/ms-channel-notifier.js.map +1 -1
- package/dist/ports/transport.d.ts +11 -0
- package/dist/resources/parsers.js +17 -0
- package/dist/resources/parsers.js.map +1 -1
- package/package.json +4 -3
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MsChannelNotifier — translate per-session ACP `session/update`
|
|
3
|
-
* envelopes into BeeOS Message Service wire
|
|
4
|
-
*
|
|
3
|
+
* envelopes into BeeOS Message Service wire messages for ONE
|
|
4
|
+
* conversation (`ch:{conversationId}`).
|
|
5
5
|
*
|
|
6
6
|
* Implements `SessionUpdateNotifier` so it can be `bindNotifier`'d
|
|
7
7
|
* to a specific sid in `SessionManager`. The MessageBus inbound
|
|
8
|
-
* handler creates one of these per `chat_message
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* handler creates one of these per `chat_message`, binds it for the
|
|
9
|
+
* duration of the turn, then unbinds it when the await for
|
|
10
|
+
* `promptForSession()` returns.
|
|
11
11
|
*
|
|
12
12
|
* Wire mapping (locked in to match beeos-claw `acp-server.ts onStreamDelta`):
|
|
13
13
|
*
|
|
14
|
-
* - `agent_message_chunk` → `agent_reply_delta`
|
|
14
|
+
* - `agent_message_chunk` → `agent_reply_delta` with
|
|
15
15
|
* `update.sessionUpdate=agent_message_chunk`. The text is also
|
|
16
16
|
* accumulated into `accumulatedText` so the terminal `agent_reply`
|
|
17
|
-
* can carry the full reply as `
|
|
17
|
+
* can carry the full reply as `content.text`.
|
|
18
18
|
*
|
|
19
|
-
* - `agent_thought_chunk` → `agent_reply_delta`
|
|
19
|
+
* - `agent_thought_chunk` → `agent_reply_delta` with
|
|
20
20
|
* `update.sessionUpdate=agent_thought_chunk`. Reasoning is NEVER
|
|
21
21
|
* accumulated — `backend/pkg/convmsg/extract.go::extractNestedDelta`
|
|
22
22
|
* intentionally drops thought chunks so they don't pollute reply
|
|
23
23
|
* text, and we mirror that here.
|
|
24
24
|
*
|
|
25
|
-
* - `stream_complete` → terminal `agent_reply
|
|
26
|
-
*
|
|
25
|
+
* - `stream_complete` → terminal `agent_reply`. Content shape
|
|
26
|
+
* mirrors beeos-claw:
|
|
27
27
|
* success → { session_key, text }
|
|
28
28
|
* cancelled → { session_key, error: "cancelled", text? }
|
|
29
29
|
* failure → { session_key, error, text? }
|
|
@@ -34,31 +34,18 @@
|
|
|
34
34
|
* outbound listener also skipped them; mirroring keeps the wire
|
|
35
35
|
* format byte-for-byte identical for downstream consumers.
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* - Terminal `agent_reply` — `sdk.sendChannelMessage` (durable REST
|
|
45
|
-
* POST that writes to `channel_messages` and fans out via MS).
|
|
46
|
-
* Carries `in_reply_to = inboundMessageId` so the caller's `/wait`
|
|
47
|
-
* can match. Persistence is REQUIRED: caller `/wait` long-polls in
|
|
48
|
-
* 30s reconnect cycles, and a Centrifugo direct publish landing in
|
|
49
|
-
* the reconnect gap would be lost forever (no DB row to replay
|
|
50
|
-
* from). Persistent path takes ~10-50ms more but is the only
|
|
51
|
-
* race-free option — see plan "Direct MS Token Auth".
|
|
52
|
-
*
|
|
53
|
-
* Mirrors beeos-claw `acp-server.ts:73-85` (delta) + the prescribed
|
|
54
|
-
* sendChannelMessage path for terminal reply (which beeos-claw uses
|
|
55
|
-
* as a fallback when sendToChannel fails).
|
|
37
|
+
* Both delta and terminal sends go through `client.messages.send`
|
|
38
|
+
* (persistent v2 path). Persistence is REQUIRED for terminal replies:
|
|
39
|
+
* caller `/wait` long-polls in 30s reconnect cycles, and an
|
|
40
|
+
* unpersisted publish landing in the reconnect gap would be lost
|
|
41
|
+
* forever (no DB row to replay from). Deltas inherit the same
|
|
42
|
+
* persistent path because the SDK no longer offers a non-persistent
|
|
43
|
+
* direct-Centrifugo publish.
|
|
56
44
|
*
|
|
57
45
|
* The notifier never throws out of `send()` — that runs on the
|
|
58
46
|
* SessionManager event hot path and a synchronous throw would skip
|
|
59
47
|
* subsequent handlers (e.g. status:idle). All publish failures are
|
|
60
|
-
* logged and swallowed.
|
|
61
|
-
* any subsequent publishes via the same path.
|
|
48
|
+
* logged and swallowed.
|
|
62
49
|
*/
|
|
63
50
|
export class MsChannelNotifier {
|
|
64
51
|
opts;
|
|
@@ -114,8 +101,6 @@ export class MsChannelNotifier {
|
|
|
114
101
|
return;
|
|
115
102
|
}
|
|
116
103
|
default:
|
|
117
|
-
// agent_status / tool_call / tool_call_update / history_turn
|
|
118
|
-
// / system_message_chunk / user_message_chunk → skip.
|
|
119
104
|
return;
|
|
120
105
|
}
|
|
121
106
|
}
|
|
@@ -128,16 +113,19 @@ export class MsChannelNotifier {
|
|
|
128
113
|
}
|
|
129
114
|
}
|
|
130
115
|
async publishDelta(sessionUpdate, text) {
|
|
131
|
-
//
|
|
132
|
-
// `
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
116
|
+
// Persistent delta send via v2 messages.send. Deltas MUST NOT
|
|
117
|
+
// carry `replyTo` (it would short-circuit MS `/wait` on the
|
|
118
|
+
// first delta — the wait endpoint matches purely on `reply_to`,
|
|
119
|
+
// not message type).
|
|
120
|
+
await this.opts.client.messages.send({
|
|
121
|
+
conversationId: this.opts.channelId,
|
|
122
|
+
type: "agent_reply_delta",
|
|
123
|
+
content: {
|
|
124
|
+
session_key: this.opts.sessionKey,
|
|
125
|
+
update: {
|
|
126
|
+
sessionUpdate,
|
|
127
|
+
content: { type: "text", text },
|
|
128
|
+
},
|
|
141
129
|
},
|
|
142
130
|
});
|
|
143
131
|
}
|
|
@@ -151,40 +139,32 @@ export class MsChannelNotifier {
|
|
|
151
139
|
if (this.finalized)
|
|
152
140
|
return;
|
|
153
141
|
this.finalized = true;
|
|
154
|
-
let
|
|
142
|
+
let content;
|
|
155
143
|
if (stopReason === "cancelled") {
|
|
156
|
-
|
|
144
|
+
content = {
|
|
157
145
|
session_key: this.opts.sessionKey,
|
|
158
146
|
error: "cancelled",
|
|
159
147
|
text: this.accumulatedText,
|
|
160
148
|
};
|
|
161
149
|
}
|
|
162
150
|
else if (errorText) {
|
|
163
|
-
|
|
151
|
+
content = {
|
|
164
152
|
session_key: this.opts.sessionKey,
|
|
165
153
|
error: errorText,
|
|
166
154
|
text: this.accumulatedText,
|
|
167
155
|
};
|
|
168
156
|
}
|
|
169
157
|
else {
|
|
170
|
-
|
|
158
|
+
content = {
|
|
171
159
|
session_key: this.opts.sessionKey,
|
|
172
160
|
text: this.accumulatedText,
|
|
173
161
|
};
|
|
174
162
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
// `FirstByInReplyTo` DB scan can match even if live publication
|
|
178
|
-
// missed during reconnect)
|
|
179
|
-
// - server-side fan-out to ch:{} + every personal:{} of the
|
|
180
|
-
// channel participants (real-time path preserved)
|
|
181
|
-
// - auth: SDK forwards the connect-time Centrifugo token as
|
|
182
|
-
// `Authorization: Bearer <jwt>`; MS verifies HMAC and pins
|
|
183
|
-
// sender_id to ctx.principal_id (no need for us to set it).
|
|
184
|
-
await this.opts.sdk.sendChannelMessage(this.opts.channelId, {
|
|
163
|
+
await this.opts.client.messages.send({
|
|
164
|
+
conversationId: this.opts.channelId,
|
|
185
165
|
type: "agent_reply",
|
|
186
|
-
|
|
187
|
-
|
|
166
|
+
replyTo: this.opts.inboundMessageId,
|
|
167
|
+
content,
|
|
188
168
|
});
|
|
189
169
|
}
|
|
190
170
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ms-channel-notifier.js","sourceRoot":"","sources":["../../../src/plugins/message-bus/ms-channel-notifier.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ms-channel-notifier.js","sourceRoot":"","sources":["../../../src/plugins/message-bus/ms-channel-notifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AA0BH,MAAM,OAAO,iBAAiB;IAKC;IAJ7B,qFAAqF;IAC7E,eAAe,GAAG,EAAE,CAAC;IACrB,SAAS,GAAG,KAAK,CAAC;IAE1B,YAA6B,IAA8B;QAA9B,SAAI,GAAJ,IAAI,CAA0B;IAAG,CAAC;IAE/D;;;;;OAKG;IACH,IAAI,CAAC,UAAkB,EAAE,MAA+B;QACtD,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED;;;OAGG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,+DAA+D;IAC/D,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEO,KAAK,CAAC,MAAM,CAAC,MAA+B;QAClD,MAAM,aAAa,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,CAAC;YACH,QAAQ,aAAa,EAAE,CAAC;gBACtB,KAAK,qBAAqB,CAAC,CAAC,CAAC;oBAC3B,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gB;YACnC,OAAO;SACR,CAAC,CAAC;IACL,CAAC;CACF;AAED,SAAS,iBAAiB,CAAC,MAA+B;IACxD,MAAM,CAAC,GAAG,MAAM,CAAC,aAAa,CAAC;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACxC,CAAC;AAED,SAAS,eAAe,CAAC,OAAgB;IACvC,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACvD,MAAM,CAAC,GAAG,OAA6C,CAAC;IACxD,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC,IAAI,CAAC;IAC9C,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,UAAU,CAAC,CAAU;IAC5B,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -29,4 +29,15 @@ export interface IBridgeTransport {
|
|
|
29
29
|
on(event: "disconnected", handler: (reason: string) => void): void;
|
|
30
30
|
on(event: "message", handler: (data: string) => void | Promise<void>): void;
|
|
31
31
|
on(event: "error", handler: (err: Error) => void): void;
|
|
32
|
+
/**
|
|
33
|
+
* Detach a handler previously attached via `on`. Used by long-lived
|
|
34
|
+
* subscribers (e.g. HealthReporter) to clean up on shutdown so the
|
|
35
|
+
* underlying EventEmitter doesn't grow unboundedly across hot reloads
|
|
36
|
+
* or test harnesses. The handler reference must match the one passed
|
|
37
|
+
* to `on`; identity-based removal mirrors `EventEmitter.off`.
|
|
38
|
+
*/
|
|
39
|
+
off(event: "connected", handler: () => void): void;
|
|
40
|
+
off(event: "disconnected", handler: (reason: string) => void): void;
|
|
41
|
+
off(event: "message", handler: (data: string) => void | Promise<void>): void;
|
|
42
|
+
off(event: "error", handler: (err: Error) => void): void;
|
|
32
43
|
}
|
|
@@ -25,6 +25,16 @@ const URL_RE = /\bhttps?:\/\/[^\s<>"'\u3000\u00A0`]+/giu;
|
|
|
25
25
|
* surrounding sentence rather than the URL itself ("see https://x.y/z.").
|
|
26
26
|
*/
|
|
27
27
|
const TRAILING_PUNCT_RE = /[)\].,;:!?'"`]+$/u;
|
|
28
|
+
/**
|
|
29
|
+
* URL path must end with a recognised media file extension to be a
|
|
30
|
+
* resource-resolution candidate. Navigation URLs (social media pages,
|
|
31
|
+
* short links) have no file extension and are intentionally excluded —
|
|
32
|
+
* they are web pages to navigate TO, not files to download.
|
|
33
|
+
*
|
|
34
|
+
* Trade-off: extension-less CDN/presigned URLs are also skipped.
|
|
35
|
+
* Use an explicit `beeos-resource://` URI for those cases in future.
|
|
36
|
+
*/
|
|
37
|
+
const MEDIA_EXT_RE = /\.(?:jpe?g|png|gif|webp|bmp|svg|ico|mp4|mov|avi|mkv|webm|flv|m4v|mp3|wav|ogg|flac|aac|m4a|pdf|zip|apk|docx?|xlsx?|pptx?|csv|txt)(?:[?#]|$)/i;
|
|
28
38
|
export class UrlParser {
|
|
29
39
|
name = "url";
|
|
30
40
|
parse(task) {
|
|
@@ -40,6 +50,13 @@ export class UrlParser {
|
|
|
40
50
|
continue;
|
|
41
51
|
if (seen.has(cleaned))
|
|
42
52
|
continue;
|
|
53
|
+
// Skip navigation URLs (web pages, short links, social media posts).
|
|
54
|
+
// Only URLs with a recognised media file extension are candidates for
|
|
55
|
+
// resource resolution (download + push to device). Navigation targets
|
|
56
|
+
// like Bilibili video pages or Xiaohongshu posts have no file extension;
|
|
57
|
+
// the VLM already handles "open this URL" from the original task text.
|
|
58
|
+
if (!MEDIA_EXT_RE.test(cleaned))
|
|
59
|
+
continue;
|
|
43
60
|
seen.add(cleaned);
|
|
44
61
|
out.push({ kind: "url", url: cleaned });
|
|
45
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/resources/parsers.ts"],"names":[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AE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAM,aAAa,GAAG,wCAAwC,CAAC;AAE/D,MAAM,OAAO,eAAe;IACjB,IAAI,GAAG,YAAY,CAAC;IAE7B,KAAK,CAAC,IAAY;QAChB,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,MAAM,GAAG,GAAkB,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC7C,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,SAAS;YAC1C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACjB,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,CAAC,IAAI,SAAS,EAAE,EAAE,IAAI,eAAe,EAAE,CAAC,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beeos-ai/device-agent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "BeeOS device-agent — Android/desktop AI control agent (TypeScript) speaking ACP over Bridge WebSocket. Connects to a sibling device-mcp-server process for device control.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -53,10 +53,11 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@beeos-ai/beeos-types": "^1.0.0",
|
|
55
55
|
"@beeos-ai/bridge-client": "^0.1.1",
|
|
56
|
-
"@beeos-ai/message-sdk": "^0.
|
|
56
|
+
"@beeos-ai/message-sdk": "^1.0.0",
|
|
57
57
|
"@fastify/cors": "^11.2.0",
|
|
58
58
|
"@fastify/multipart": "^10.0.0",
|
|
59
59
|
"@mariozechner/pi-coding-agent": "0.70.2",
|
|
60
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
60
61
|
"dotenv": "^16.5.0",
|
|
61
62
|
"fastify": "^5.8.5",
|
|
62
63
|
"openai": "^4.98.0",
|
|
@@ -72,7 +73,7 @@
|
|
|
72
73
|
"tsx": "^4.19.0",
|
|
73
74
|
"typescript": "^5.8.0",
|
|
74
75
|
"vitest": "^4.1.5",
|
|
75
|
-
"@beeos-ai/device-mcp-server": "0.
|
|
76
|
+
"@beeos-ai/device-mcp-server": "0.4.2"
|
|
76
77
|
},
|
|
77
78
|
"scripts": {
|
|
78
79
|
"build": "tsc -p tsconfig.json && chmod +x dist/inbound/cli/main.js",
|