volute 0.5.0 → 0.7.0

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.
Files changed (62) hide show
  1. package/dist/{agent-Z2B6EFEQ.js → agent-7JF7MT73.js} +13 -9
  2. package/dist/{agent-manager-PXBKA2GK.js → agent-manager-IMZ7ZMBF.js} +4 -4
  3. package/dist/channel-SMCNOIVQ.js +262 -0
  4. package/dist/{chunk-MW2KFO3B.js → chunk-62X577Y7.js} +10 -8
  5. package/dist/chunk-7ACDT3P2.js +265 -0
  6. package/dist/{chunk-MXUCNIBG.js → chunk-BX7KI4S3.js} +68 -3
  7. package/dist/{up-7ILD7GU7.js → chunk-EG45HBSJ.js} +16 -4
  8. package/dist/{chunk-HE67X4T6.js → chunk-H7AMDUIA.js} +1 -1
  9. package/dist/{chunk-7L4AN5D4.js → chunk-JR4UXCTO.js} +1 -1
  10. package/dist/{down-O7IFZLVJ.js → chunk-LLJNZPCU.js} +48 -13
  11. package/dist/{chunk-5X7HGB6L.js → chunk-NKXULRSW.js} +2 -1
  12. package/dist/{chunk-UX25Z2ND.js → chunk-UWHWAPGO.js} +7 -0
  13. package/dist/{chunk-UAVD2AHX.js → chunk-W76KWE23.js} +1 -1
  14. package/dist/chunk-ZZOOTYXK.js +583 -0
  15. package/dist/cli.js +22 -21
  16. package/dist/{connector-LYEMXQEV.js → connector-Y7JPNROO.js} +3 -3
  17. package/dist/connectors/discord.js +38 -7
  18. package/dist/connectors/slack.js +22 -3
  19. package/dist/connectors/telegram.js +34 -4
  20. package/dist/{create-RVCZN6HE.js → create-G525LWEA.js} +2 -2
  21. package/dist/{daemon-client-ZY6UUN2M.js → daemon-client-442IV43D.js} +2 -2
  22. package/dist/daemon-restart-4HVEKYFY.js +23 -0
  23. package/dist/daemon.js +1042 -809
  24. package/dist/{delete-3QH7VYIN.js → delete-UOU4AFQN.js} +7 -3
  25. package/dist/down-AZVH5TCD.js +11 -0
  26. package/dist/{env-4D4REPJF.js → env-7GLUJCWS.js} +2 -2
  27. package/dist/{history-OEONB53Z.js → history-H72ZUIBN.js} +2 -2
  28. package/dist/{import-MXJB2EII.js → import-AVKQJDYC.js} +2 -2
  29. package/dist/{logs-DF342W4M.js → logs-EDGK26AK.js} +1 -1
  30. package/dist/{message-ADHWFHSI.js → message-SCOQDR3P.js} +2 -2
  31. package/dist/{package-VQOE7JNH.js → package-T2WAVJOU.js} +1 -1
  32. package/dist/restart-O4ETYLJF.js +29 -0
  33. package/dist/{schedule-NAG6F463.js → schedule-S6QVC5ON.js} +2 -2
  34. package/dist/send-G7PE4DOJ.js +72 -0
  35. package/dist/{setup-RPRRGG2F.js → setup-F4TCWVSP.js} +2 -2
  36. package/dist/{start-TUOXDSFL.js → start-VHQ7LNWM.js} +2 -2
  37. package/dist/{status-A36EHRO4.js → status-QAJWXKMZ.js} +2 -2
  38. package/dist/{stop-AOJZLQ5X.js → stop-CAGCT5NI.js} +2 -2
  39. package/dist/up-RWZF6MLT.js +12 -0
  40. package/dist/{update-LPSIAWQ2.js → update-F7QWV2LB.js} +2 -2
  41. package/dist/{update-check-Y33QDCFL.js → update-check-B4J6IEQ4.js} +2 -2
  42. package/dist/{upgrade-FX2TKJ2S.js → upgrade-YXKPWDRU.js} +2 -2
  43. package/dist/{variant-LAB67OC2.js → variant-4Z6W3PP6.js} +2 -2
  44. package/dist/web-assets/assets/index-B1CqjUYD.js +308 -0
  45. package/dist/web-assets/index.html +1 -1
  46. package/package.json +1 -1
  47. package/templates/_base/.init/.config/scripts/session-reader.ts +59 -0
  48. package/templates/_base/_skills/sessions/SKILL.md +49 -0
  49. package/templates/_base/_skills/volute-agent/SKILL.md +13 -9
  50. package/templates/_base/src/lib/format-prefix.ts +6 -0
  51. package/templates/_base/src/lib/router.ts +30 -3
  52. package/templates/_base/src/lib/session-monitor.ts +400 -0
  53. package/templates/_base/src/lib/types.ts +2 -0
  54. package/templates/agent-sdk/src/agent.ts +16 -0
  55. package/templates/agent-sdk/src/lib/hooks/session-context.ts +32 -0
  56. package/templates/pi/src/agent.ts +7 -1
  57. package/templates/pi/src/lib/session-context-extension.ts +33 -0
  58. package/dist/channel-MK5OK2SI.js +0 -113
  59. package/dist/chunk-SMISE4SV.js +0 -226
  60. package/dist/conversation-ERXEQZTY.js +0 -163
  61. package/dist/send-66QMKRUH.js +0 -75
  62. package/dist/web-assets/assets/index-BbRmoxoA.js +0 -308
@@ -6,16 +6,16 @@ import {
6
6
  agentEnvPath,
7
7
  readEnv,
8
8
  writeEnv
9
- } from "./chunk-HE67X4T6.js";
9
+ } from "./chunk-H7AMDUIA.js";
10
10
  import {
11
11
  parseArgs
12
12
  } from "./chunk-D424ZQGI.js";
13
13
  import {
14
14
  daemonFetch
15
- } from "./chunk-7L4AN5D4.js";
15
+ } from "./chunk-JR4UXCTO.js";
16
16
  import {
17
17
  agentDir
18
- } from "./chunk-UX25Z2ND.js";
18
+ } from "./chunk-UWHWAPGO.js";
19
19
  import "./chunk-K3NQKI34.js";
20
20
 
21
21
  // src/commands/connector.ts
@@ -1,11 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ buildChannelSlug,
3
4
  fireAndForget,
4
5
  handleAgentMessage,
5
6
  loadEnv,
6
7
  loadFollowedChannels,
7
- splitMessage
8
- } from "../chunk-MXUCNIBG.js";
8
+ reportTyping,
9
+ slugify,
10
+ splitMessage,
11
+ writeChannelEntry
12
+ } from "../chunk-BX7KI4S3.js";
9
13
  import "../chunk-K3NQKI34.js";
10
14
 
11
15
  // src/connectors/discord.ts
@@ -32,7 +36,9 @@ var client = new Client({
32
36
  GatewayIntentBits.Guilds,
33
37
  GatewayIntentBits.GuildMessages,
34
38
  GatewayIntentBits.MessageContent,
35
- GatewayIntentBits.DirectMessages
39
+ GatewayIntentBits.DirectMessages,
40
+ GatewayIntentBits.GuildMessageTyping,
41
+ GatewayIntentBits.DirectMessageTyping
36
42
  ],
37
43
  partials: [Partials.Channel]
38
44
  });
@@ -88,8 +94,23 @@ client.on(Events.MessageCreate, async (message) => {
88
94
  }
89
95
  if (content.length === 0) return;
90
96
  const senderName = message.author.displayName || message.author.username;
91
- const channelKey = `discord:${message.channelId}`;
92
97
  const channelName = !isDM && "name" in message.channel ? message.channel.name : void 0;
98
+ const channelKey = isDM ? buildChannelSlug("discord", {
99
+ isDM: true,
100
+ recipients: [message.author.username]
101
+ }) : buildChannelSlug("discord", {
102
+ channelName: channelName ?? message.channelId,
103
+ serverName: message.guild?.name
104
+ });
105
+ if (env.agentDir) {
106
+ writeChannelEntry(env.agentDir, channelKey, {
107
+ platformId: message.channelId,
108
+ platform: "discord",
109
+ name: channelName ? `#${channelName}` : void 0,
110
+ server: message.guild?.name,
111
+ type: isDM ? "dm" : "channel"
112
+ });
113
+ }
93
114
  const participantCount = isDM ? 2 : message.guild?.memberCount;
94
115
  const payload = {
95
116
  content,
@@ -101,20 +122,29 @@ client.on(Events.MessageCreate, async (message) => {
101
122
  ...message.guild?.name ? { serverName: message.guild.name } : {},
102
123
  ...participantCount ? { participantCount } : {}
103
124
  };
125
+ reportTyping(env, channelKey, senderName, false);
104
126
  if (isFollowedChannel && !isMentioned) {
105
127
  await fireAndForget(env, payload);
106
128
  return;
107
129
  }
108
130
  await handleDiscordMessage(message, payload);
109
131
  });
132
+ client.on(Events.TypingStart, (typing) => {
133
+ if (typing.user.bot) return;
134
+ const sender = typing.user.displayName || typing.user.username || typing.user.id || "unknown";
135
+ const typingChannel = typing.guild ? `discord:${slugify(typing.guild.name)}/${slugify("name" in typing.channel ? String(typing.channel.name) : typing.channel.id)}` : `discord:@${slugify(typing.user.username ?? typing.user.id)}`;
136
+ reportTyping(env, typingChannel, sender, true);
137
+ });
110
138
  async function handleDiscordMessage(message, payload) {
111
139
  const channel = message.channel;
112
140
  if (!("sendTyping" in channel)) return;
113
141
  const typingInterval = setInterval(() => {
114
- channel.sendTyping().catch(() => {
142
+ channel.sendTyping().catch((err) => {
143
+ console.warn(`[discord] sendTyping failed: ${err}`);
115
144
  });
116
145
  }, TYPING_INTERVAL_MS);
117
- channel.sendTyping().catch(() => {
146
+ channel.sendTyping().catch((err) => {
147
+ console.warn(`[discord] sendTyping failed: ${err}`);
118
148
  });
119
149
  let replied = false;
120
150
  try {
@@ -155,7 +185,8 @@ async function handleDiscordMessage(message, payload) {
155
185
  }
156
186
  },
157
187
  onError: async (msg) => {
158
- await message.reply(msg).catch(() => {
188
+ await message.reply(msg).catch((err) => {
189
+ console.error(`[discord] failed to send error reply: ${err}`);
159
190
  });
160
191
  }
161
192
  });
@@ -1,12 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ buildChannelSlug,
3
4
  fireAndForget,
4
5
  handleAgentMessage,
5
6
  loadEnv,
6
7
  loadFollowedChannels,
7
8
  onShutdown,
8
- splitMessage
9
- } from "../chunk-MXUCNIBG.js";
9
+ splitMessage,
10
+ writeChannelEntry
11
+ } from "../chunk-BX7KI4S3.js";
10
12
  import "../chunk-K3NQKI34.js";
11
13
 
12
14
  // src/connectors/slack.ts
@@ -79,15 +81,32 @@ app.message(async ({ message, say }) => {
79
81
  }
80
82
  }
81
83
  let senderName = message.user;
84
+ let senderUsername = message.user;
82
85
  try {
83
86
  const userInfo = await app.client.users.info({
84
87
  user: message.user
85
88
  });
86
89
  senderName = userInfo.user?.profile?.display_name || userInfo.user?.profile?.real_name || message.user;
90
+ senderUsername = userInfo.user?.name ?? message.user;
87
91
  } catch (err) {
88
92
  console.warn(`Failed to get user info: ${err}`);
89
93
  }
90
- const channelKey = `slack:${message.channel}`;
94
+ const channelKey = isDM ? buildChannelSlug("slack", {
95
+ isDM: true,
96
+ senderName: senderUsername
97
+ }) : buildChannelSlug("slack", {
98
+ channelName: channelName ?? message.channel,
99
+ serverName
100
+ });
101
+ if (env.agentDir) {
102
+ writeChannelEntry(env.agentDir, channelKey, {
103
+ platformId: message.channel,
104
+ platform: "slack",
105
+ name: channelName ? `#${channelName}` : void 0,
106
+ server: serverName,
107
+ type: isDM ? "dm" : "channel"
108
+ });
109
+ }
91
110
  const participantCount = message.channel_type === "im" ? 2 : numMembers;
92
111
  const payload = {
93
112
  content,
@@ -1,11 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ buildChannelSlug,
3
4
  fireAndForget,
4
5
  handleAgentMessage,
5
6
  loadEnv,
6
7
  loadFollowedChannels,
7
- splitMessage
8
- } from "../chunk-MXUCNIBG.js";
8
+ splitMessage,
9
+ writeChannelEntry
10
+ } from "../chunk-BX7KI4S3.js";
9
11
  import "../chunk-K3NQKI34.js";
10
12
 
11
13
  // src/connectors/telegram.ts
@@ -48,9 +50,23 @@ bot.on(message("text"), async (ctx) => {
48
50
  console.warn(`Failed to get member count for chat ${ctx.chat.id}: ${err}`);
49
51
  }
50
52
  }
53
+ const channelSlug = isDM ? buildChannelSlug("telegram", {
54
+ isDM: true,
55
+ senderName: ctx.message.from.username ?? ctx.message.from.first_name
56
+ }) : buildChannelSlug("telegram", {
57
+ channelName: chatTitle ?? String(ctx.chat.id)
58
+ });
59
+ if (env.agentDir) {
60
+ writeChannelEntry(env.agentDir, channelSlug, {
61
+ platformId: String(ctx.chat.id),
62
+ platform: "telegram",
63
+ name: chatTitle,
64
+ type: isDM ? "dm" : "channel"
65
+ });
66
+ }
51
67
  const payload = {
52
68
  content,
53
- channel: `telegram:${ctx.chat.id}`,
69
+ channel: channelSlug,
54
70
  sender: senderName,
55
71
  platform: "Telegram",
56
72
  ...isDM ? { isDM: true } : {},
@@ -105,9 +121,23 @@ bot.on(message("photo"), async (ctx) => {
105
121
  console.warn(`Failed to get member count for chat ${ctx.chat.id}: ${err}`);
106
122
  }
107
123
  }
124
+ const channelSlug = isDM ? buildChannelSlug("telegram", {
125
+ isDM: true,
126
+ senderName: ctx.message.from.username ?? ctx.message.from.first_name
127
+ }) : buildChannelSlug("telegram", {
128
+ channelName: chatTitle ?? String(ctx.chat.id)
129
+ });
130
+ if (env.agentDir) {
131
+ writeChannelEntry(env.agentDir, channelSlug, {
132
+ platformId: String(ctx.chat.id),
133
+ platform: "telegram",
134
+ name: chatTitle,
135
+ type: isDM ? "dm" : "channel"
136
+ });
137
+ }
108
138
  const payload = {
109
139
  content,
110
- channel: `telegram:${ctx.chat.id}`,
140
+ channel: channelSlug,
111
141
  sender: senderName,
112
142
  platform: "Telegram",
113
143
  ...isDM ? { isDM: true } : {},
@@ -13,7 +13,7 @@ import {
13
13
  chownAgentDir,
14
14
  createAgentUser,
15
15
  ensureVoluteGroup
16
- } from "./chunk-UAVD2AHX.js";
16
+ } from "./chunk-W76KWE23.js";
17
17
  import {
18
18
  exec,
19
19
  execInherit
@@ -23,7 +23,7 @@ import {
23
23
  agentDir,
24
24
  ensureVoluteHome,
25
25
  nextPort
26
- } from "./chunk-UX25Z2ND.js";
26
+ } from "./chunk-UWHWAPGO.js";
27
27
  import "./chunk-K3NQKI34.js";
28
28
 
29
29
  // src/commands/create.ts
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  daemonFetch
4
- } from "./chunk-7L4AN5D4.js";
5
- import "./chunk-UX25Z2ND.js";
4
+ } from "./chunk-JR4UXCTO.js";
5
+ import "./chunk-UWHWAPGO.js";
6
6
  import "./chunk-K3NQKI34.js";
7
7
  export {
8
8
  daemonFetch
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ run
4
+ } from "./chunk-EG45HBSJ.js";
5
+ import {
6
+ stopDaemon
7
+ } from "./chunk-LLJNZPCU.js";
8
+ import "./chunk-D424ZQGI.js";
9
+ import "./chunk-UWHWAPGO.js";
10
+ import "./chunk-K3NQKI34.js";
11
+
12
+ // src/commands/daemon-restart.ts
13
+ async function run2(args) {
14
+ const result = await stopDaemon();
15
+ if (!result.stopped && result.reason === "kill-failed") {
16
+ console.error("Cannot restart: failed to stop the running daemon.");
17
+ process.exit(1);
18
+ }
19
+ await run(args);
20
+ }
21
+ export {
22
+ run2 as run
23
+ };