@openagents-org/agent-launcher 0.2.167 → 0.2.168
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/package.json +2 -2
- package/src/workspace-client.js +36 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openagents-org/agent-launcher",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "OpenAgents Launcher
|
|
3
|
+
"version": "0.2.168",
|
|
4
|
+
"description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"agn": "bin/agent-connector.js",
|
package/src/workspace-client.js
CHANGED
|
@@ -209,6 +209,27 @@ class WorkspaceClient {
|
|
|
209
209
|
const payload = { content, message_type: messageType };
|
|
210
210
|
if (attachments && attachments.length) payload.attachments = attachments;
|
|
211
211
|
|
|
212
|
+
// DM sessions (`dm:<counterpart address>`, created by _eventToMessage for
|
|
213
|
+
// incoming direct messages) reply as direct events to the counterpart —
|
|
214
|
+
// not into a `channel/dm:…` channel, which no client would ever read.
|
|
215
|
+
if (channelName && channelName.startsWith('dm:')) {
|
|
216
|
+
const counterpart = channelName.slice(3);
|
|
217
|
+
const meta = { ...(metadata || {}) };
|
|
218
|
+
if (!meta.target_agents) {
|
|
219
|
+
meta.target_agents = counterpart.startsWith('openagents:')
|
|
220
|
+
? [counterpart.replace(/^openagents:/, '')]
|
|
221
|
+
: ['__no_response__'];
|
|
222
|
+
}
|
|
223
|
+
return this.sendEvent(workspaceId, {
|
|
224
|
+
type: 'workspace.message.posted',
|
|
225
|
+
source,
|
|
226
|
+
target: counterpart,
|
|
227
|
+
payload,
|
|
228
|
+
metadata: meta,
|
|
229
|
+
visibility: 'direct',
|
|
230
|
+
}, token, sessionId);
|
|
231
|
+
}
|
|
232
|
+
|
|
212
233
|
return this.sendEvent(workspaceId, {
|
|
213
234
|
type: 'workspace.message.posted',
|
|
214
235
|
source,
|
|
@@ -841,9 +862,23 @@ class WorkspaceClient {
|
|
|
841
862
|
const target = event.target || '';
|
|
842
863
|
const ts = event.timestamp;
|
|
843
864
|
|
|
865
|
+
// Session id: channels map to their name. A direct message (visibility
|
|
866
|
+
// 'direct', target = this agent's own address) maps to a per-counterpart
|
|
867
|
+
// DM session `dm:<source address>` — so the adapter keeps one CLI session
|
|
868
|
+
// per DM peer, and sendMessage() below routes replies back as direct
|
|
869
|
+
// events to that peer instead of into a channel.
|
|
870
|
+
let sessionId;
|
|
871
|
+
if (target.startsWith('channel/')) {
|
|
872
|
+
sessionId = target.replace('channel/', '');
|
|
873
|
+
} else if (event.visibility === 'direct' && source) {
|
|
874
|
+
sessionId = `dm:${source}`;
|
|
875
|
+
} else {
|
|
876
|
+
sessionId = target;
|
|
877
|
+
}
|
|
878
|
+
|
|
844
879
|
const msg = {
|
|
845
880
|
messageId: event.id || '',
|
|
846
|
-
sessionId
|
|
881
|
+
sessionId,
|
|
847
882
|
senderType: isHuman ? 'human' : 'agent',
|
|
848
883
|
senderName,
|
|
849
884
|
content: (payload.content || event.content || ''),
|