@hasna/conversations 0.2.39 → 0.2.41
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/bin/index.js +47 -20
- package/bin/mcp.js +471 -431
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -13645,6 +13645,14 @@ var init_db = __esm(() => {
|
|
|
13645
13645
|
});
|
|
13646
13646
|
|
|
13647
13647
|
// src/lib/identity.ts
|
|
13648
|
+
var exports_identity = {};
|
|
13649
|
+
__export(exports_identity, {
|
|
13650
|
+
updateCachedAutoName: () => updateCachedAutoName,
|
|
13651
|
+
resolveIdentity: () => resolveIdentity,
|
|
13652
|
+
requireIdentity: () => requireIdentity,
|
|
13653
|
+
getAutoName: () => getAutoName,
|
|
13654
|
+
_resetAutoName: () => _resetAutoName
|
|
13655
|
+
});
|
|
13648
13656
|
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync6 } from "fs";
|
|
13649
13657
|
import { join as join9, dirname as dirname3 } from "path";
|
|
13650
13658
|
function isNameTaken(name) {
|
|
@@ -13692,6 +13700,15 @@ function resolveIdentity(explicit) {
|
|
|
13692
13700
|
return envValue;
|
|
13693
13701
|
return getAutoName();
|
|
13694
13702
|
}
|
|
13703
|
+
function requireIdentity(explicit) {
|
|
13704
|
+
const explicitValue = explicit?.trim();
|
|
13705
|
+
if (explicitValue)
|
|
13706
|
+
return explicitValue;
|
|
13707
|
+
const envValue = process.env.CONVERSATIONS_AGENT_ID?.trim();
|
|
13708
|
+
if (envValue)
|
|
13709
|
+
return envValue;
|
|
13710
|
+
throw new Error("Agent identity required. Set CONVERSATIONS_AGENT_ID env var or pass --from flag.");
|
|
13711
|
+
}
|
|
13695
13712
|
function updateCachedAutoName(newName) {
|
|
13696
13713
|
cachedAutoName = newName;
|
|
13697
13714
|
try {
|
|
@@ -13700,6 +13717,9 @@ function updateCachedAutoName(newName) {
|
|
|
13700
13717
|
`, "utf-8");
|
|
13701
13718
|
} catch {}
|
|
13702
13719
|
}
|
|
13720
|
+
function _resetAutoName() {
|
|
13721
|
+
cachedAutoName = null;
|
|
13722
|
+
}
|
|
13703
13723
|
var AGENT_ID_FILE, cachedAutoName = null;
|
|
13704
13724
|
var init_identity = __esm(() => {
|
|
13705
13725
|
init_names();
|
|
@@ -14914,7 +14934,7 @@ var init_presence = __esm(() => {
|
|
|
14914
14934
|
var require_package = __commonJS((exports, module) => {
|
|
14915
14935
|
module.exports = {
|
|
14916
14936
|
name: "@hasna/conversations",
|
|
14917
|
-
version: "0.2.
|
|
14937
|
+
version: "0.2.41",
|
|
14918
14938
|
description: "Real-time CLI messaging for AI agents",
|
|
14919
14939
|
type: "module",
|
|
14920
14940
|
bin: {
|
|
@@ -45597,6 +45617,10 @@ var init_projects2 = __esm(() => {
|
|
|
45597
45617
|
// src/mcp/channel.ts
|
|
45598
45618
|
function setSessionAgent(agentId) {
|
|
45599
45619
|
sessionAgentId = agentId;
|
|
45620
|
+
try {
|
|
45621
|
+
const { updateCachedAutoName: updateCachedAutoName2 } = (init_identity(), __toCommonJS(exports_identity));
|
|
45622
|
+
updateCachedAutoName2(agentId);
|
|
45623
|
+
} catch {}
|
|
45600
45624
|
}
|
|
45601
45625
|
function getSessionAgent() {
|
|
45602
45626
|
return sessionAgentId || process.env.CONVERSATIONS_AGENT_ID || null;
|
|
@@ -45631,15 +45655,10 @@ function registerChannelBridge(server) {
|
|
|
45631
45655
|
markReadByIds([msg.id]);
|
|
45632
45656
|
} catch {}
|
|
45633
45657
|
}
|
|
45634
|
-
const
|
|
45635
|
-
|
|
45636
|
-
|
|
45637
|
-
|
|
45638
|
-
msg.space ? `Space: ${msg.space}` : null,
|
|
45639
|
-
msg.priority && msg.priority !== "normal" ? `Priority: ${msg.priority}` : null
|
|
45640
|
-
].filter(Boolean).join(" | ");
|
|
45641
|
-
const enrichedContent = `[${context}]
|
|
45642
|
-
${msg.content}`;
|
|
45658
|
+
const enrichedContent = `${msg.content}
|
|
45659
|
+
|
|
45660
|
+
---
|
|
45661
|
+
[Via Conversations MCP from ${msg.from_agent} (message #${msg.id}). To reply, use the conversations send_message tool with to="${msg.from_agent}"]`;
|
|
45643
45662
|
server.server.notification({
|
|
45644
45663
|
method: "notifications/claude/channel",
|
|
45645
45664
|
params: {
|
|
@@ -45664,14 +45683,14 @@ ${msg.content}`;
|
|
|
45664
45683
|
const agent = getSessionAgent();
|
|
45665
45684
|
const sid = getSessionId();
|
|
45666
45685
|
if (agent) {
|
|
45667
|
-
const msgs = readMessages({ to: agent, order: "asc", limit: 20 }).filter((m) => m.id > lastAgentMsgId);
|
|
45686
|
+
const msgs = readMessages({ to: agent, order: "asc", limit: 20 }).filter((m) => m.id > lastAgentMsgId && m.from_agent !== agent);
|
|
45668
45687
|
for (const msg of msgs) {
|
|
45669
45688
|
lastAgentMsgId = msg.id;
|
|
45670
45689
|
pushNotification(msg, false);
|
|
45671
45690
|
}
|
|
45672
45691
|
}
|
|
45673
45692
|
if (sid) {
|
|
45674
|
-
const msgs = readMessages({ to: `session:${sid}`, order: "asc", limit: 20 }).filter((m) => m.id > lastSessionMsgId);
|
|
45693
|
+
const msgs = readMessages({ to: `session:${sid}`, order: "asc", limit: 20 }).filter((m) => m.id > lastSessionMsgId && m.from_agent !== agent);
|
|
45675
45694
|
for (const msg of msgs) {
|
|
45676
45695
|
lastSessionMsgId = msg.id;
|
|
45677
45696
|
pushNotification(msg, true);
|
|
@@ -45690,15 +45709,21 @@ var init_channel = __esm(() => {
|
|
|
45690
45709
|
// src/mcp/tools/agents.ts
|
|
45691
45710
|
function registerAgentTools(server, agentFocus, getAgentFocus) {
|
|
45692
45711
|
server.registerTool("register_agent", {
|
|
45693
|
-
description: "Register an agent
|
|
45712
|
+
description: "Register an agent. Just provide the name \u2014 session_id is auto-detected.",
|
|
45694
45713
|
inputSchema: {
|
|
45695
|
-
name: exports_external2.string(),
|
|
45696
|
-
|
|
45714
|
+
name: exports_external2.string().optional().describe("Agent name"),
|
|
45715
|
+
agent_name: exports_external2.string().optional().describe("Agent name (alias)"),
|
|
45716
|
+
agent_id: exports_external2.string().optional().describe("Agent name (alias)"),
|
|
45717
|
+
session_id: exports_external2.string().optional().describe("Auto-detected from environment, do not set manually"),
|
|
45697
45718
|
role: exports_external2.string().optional(),
|
|
45698
45719
|
project_id: exports_external2.string().optional()
|
|
45699
45720
|
}
|
|
45700
45721
|
}, async (args) => {
|
|
45701
|
-
const { name, session_id, role, project_id } = args;
|
|
45722
|
+
const { name: nameParam, agent_name, agent_id, session_id: manualSid, role, project_id } = args;
|
|
45723
|
+
const name = nameParam || agent_name || agent_id;
|
|
45724
|
+
if (!name)
|
|
45725
|
+
return { content: [{ type: "text", text: "Error: name is required" }], isError: true };
|
|
45726
|
+
const session_id = manualSid || process.env.CONVERSATIONS_SESSION_ID || `${name}-${Date.now()}`;
|
|
45702
45727
|
try {
|
|
45703
45728
|
const result = registerAgent(name, session_id, role, project_id);
|
|
45704
45729
|
setSessionAgent(name);
|
|
@@ -45716,14 +45741,16 @@ function registerAgentTools(server, agentFocus, getAgentFocus) {
|
|
|
45716
45741
|
}
|
|
45717
45742
|
});
|
|
45718
45743
|
server.registerTool("heartbeat", {
|
|
45719
|
-
description: "Send presence heartbeat.",
|
|
45744
|
+
description: "Send presence heartbeat. Use 'from' or 'name' to set agent identity.",
|
|
45720
45745
|
inputSchema: {
|
|
45721
|
-
from: exports_external2.string().optional(),
|
|
45746
|
+
from: exports_external2.string().optional().describe("Agent name"),
|
|
45747
|
+
name: exports_external2.string().optional().describe("Agent name (alias for from)"),
|
|
45748
|
+
agent_name: exports_external2.string().optional().describe("Agent name (alias for from)"),
|
|
45722
45749
|
status: exports_external2.string().optional()
|
|
45723
45750
|
}
|
|
45724
45751
|
}, async (args) => {
|
|
45725
|
-
const { from: fromParam, status } = args;
|
|
45726
|
-
const agent = resolveIdentity(fromParam);
|
|
45752
|
+
const { from: fromParam, name: nameParam, agent_name, status } = args;
|
|
45753
|
+
const agent = resolveIdentity(fromParam || nameParam || agent_name);
|
|
45727
45754
|
heartbeat(agent, status);
|
|
45728
45755
|
setSessionAgent(agent);
|
|
45729
45756
|
return {
|
package/bin/mcp.js
CHANGED
|
@@ -17924,6 +17924,441 @@ var init_db = __esm(() => {
|
|
|
17924
17924
|
init_dist();
|
|
17925
17925
|
});
|
|
17926
17926
|
|
|
17927
|
+
// src/lib/names.ts
|
|
17928
|
+
var AGENT_NAMES;
|
|
17929
|
+
var init_names = __esm(() => {
|
|
17930
|
+
AGENT_NAMES = [
|
|
17931
|
+
"amber-fox",
|
|
17932
|
+
"arctic-wolf",
|
|
17933
|
+
"ashen-crow",
|
|
17934
|
+
"azure-hawk",
|
|
17935
|
+
"astral-lynx",
|
|
17936
|
+
"autumn-bear",
|
|
17937
|
+
"agile-puma",
|
|
17938
|
+
"alpine-ibex",
|
|
17939
|
+
"ancient-owl",
|
|
17940
|
+
"aqua-otter",
|
|
17941
|
+
"arid-viper",
|
|
17942
|
+
"atom-finch",
|
|
17943
|
+
"auburn-deer",
|
|
17944
|
+
"aurora-seal",
|
|
17945
|
+
"avid-mink",
|
|
17946
|
+
"blaze-tiger",
|
|
17947
|
+
"bright-heron",
|
|
17948
|
+
"bronze-eagle",
|
|
17949
|
+
"brisk-hare",
|
|
17950
|
+
"burnt-moth",
|
|
17951
|
+
"bold-raven",
|
|
17952
|
+
"blue-whale",
|
|
17953
|
+
"boreal-fox",
|
|
17954
|
+
"brass-cobra",
|
|
17955
|
+
"brave-ram",
|
|
17956
|
+
"brick-crane",
|
|
17957
|
+
"brief-newt",
|
|
17958
|
+
"briny-crab",
|
|
17959
|
+
"broad-elk",
|
|
17960
|
+
"brook-dove",
|
|
17961
|
+
"calm-panda",
|
|
17962
|
+
"cedar-jay",
|
|
17963
|
+
"chief-lion",
|
|
17964
|
+
"chrome-bat",
|
|
17965
|
+
"civic-wren",
|
|
17966
|
+
"clear-swan",
|
|
17967
|
+
"cliff-goat",
|
|
17968
|
+
"coal-shark",
|
|
17969
|
+
"cold-crane",
|
|
17970
|
+
"copper-jay",
|
|
17971
|
+
"coral-fish",
|
|
17972
|
+
"crisp-lark",
|
|
17973
|
+
"cross-mole",
|
|
17974
|
+
"cubic-wasp",
|
|
17975
|
+
"cyan-toad",
|
|
17976
|
+
"dark-stag",
|
|
17977
|
+
"dawn-robin",
|
|
17978
|
+
"deep-squid",
|
|
17979
|
+
"delta-fox",
|
|
17980
|
+
"dense-boar",
|
|
17981
|
+
"dew-spider",
|
|
17982
|
+
"dim-gecko",
|
|
17983
|
+
"draft-bear",
|
|
17984
|
+
"drift-gull",
|
|
17985
|
+
"dry-newt",
|
|
17986
|
+
"dual-crane",
|
|
17987
|
+
"dune-mouse",
|
|
17988
|
+
"dusk-moth",
|
|
17989
|
+
"dusty-mule",
|
|
17990
|
+
"dwarf-carp",
|
|
17991
|
+
"east-falcon",
|
|
17992
|
+
"echo-parrot",
|
|
17993
|
+
"edge-shark",
|
|
17994
|
+
"elm-beetle",
|
|
17995
|
+
"ember-lynx",
|
|
17996
|
+
"epoch-crane",
|
|
17997
|
+
"even-pike",
|
|
17998
|
+
"extra-ant",
|
|
17999
|
+
"elder-stork",
|
|
18000
|
+
"ebon-crow",
|
|
18001
|
+
"ever-finch",
|
|
18002
|
+
"exact-moth",
|
|
18003
|
+
"exile-wren",
|
|
18004
|
+
"equal-dove",
|
|
18005
|
+
"etch-hare",
|
|
18006
|
+
"faint-orca",
|
|
18007
|
+
"far-condor",
|
|
18008
|
+
"fern-mouse",
|
|
18009
|
+
"fierce-yak",
|
|
18010
|
+
"first-kite",
|
|
18011
|
+
"fjord-seal",
|
|
18012
|
+
"flint-wolf",
|
|
18013
|
+
"fog-parrot",
|
|
18014
|
+
"forge-bull",
|
|
18015
|
+
"fossil-ray",
|
|
18016
|
+
"frank-mink",
|
|
18017
|
+
"free-eagle",
|
|
18018
|
+
"fresh-colt",
|
|
18019
|
+
"frost-bear",
|
|
18020
|
+
"fuse-wasp",
|
|
18021
|
+
"gale-hawk",
|
|
18022
|
+
"gem-turtle",
|
|
18023
|
+
"ghost-lynx",
|
|
18024
|
+
"gilt-robin",
|
|
18025
|
+
"glad-moose",
|
|
18026
|
+
"glass-eel",
|
|
18027
|
+
"gleam-puma",
|
|
18028
|
+
"glyph-owl",
|
|
18029
|
+
"gold-crane",
|
|
18030
|
+
"gorge-lion",
|
|
18031
|
+
"grain-duck",
|
|
18032
|
+
"grand-wolf",
|
|
18033
|
+
"gray-fox",
|
|
18034
|
+
"green-hare",
|
|
18035
|
+
"grit-shark",
|
|
18036
|
+
"half-stork",
|
|
18037
|
+
"haze-panther",
|
|
18038
|
+
"heart-dove",
|
|
18039
|
+
"helm-eagle",
|
|
18040
|
+
"herb-toad",
|
|
18041
|
+
"hex-spider",
|
|
18042
|
+
"high-falcon",
|
|
18043
|
+
"hive-hornet",
|
|
18044
|
+
"holo-swan",
|
|
18045
|
+
"hood-cobra",
|
|
18046
|
+
"horn-bison",
|
|
18047
|
+
"huge-squid",
|
|
18048
|
+
"hull-crab",
|
|
18049
|
+
"hunt-marten",
|
|
18050
|
+
"husk-moth",
|
|
18051
|
+
"ice-leopard",
|
|
18052
|
+
"idle-crane",
|
|
18053
|
+
"inch-beetle",
|
|
18054
|
+
"indigo-jay",
|
|
18055
|
+
"inner-fox",
|
|
18056
|
+
"ion-parrot",
|
|
18057
|
+
"iron-bull",
|
|
18058
|
+
"isle-pelican",
|
|
18059
|
+
"ivory-hawk",
|
|
18060
|
+
"ivy-snake",
|
|
18061
|
+
"iota-wren",
|
|
18062
|
+
"ink-raven",
|
|
18063
|
+
"ignite-ram",
|
|
18064
|
+
"inert-slug",
|
|
18065
|
+
"infra-mole",
|
|
18066
|
+
"jade-tiger",
|
|
18067
|
+
"jest-magpie",
|
|
18068
|
+
"jewel-crane",
|
|
18069
|
+
"joint-boar",
|
|
18070
|
+
"jovial-elk",
|
|
18071
|
+
"jump-frog",
|
|
18072
|
+
"jungle-cat",
|
|
18073
|
+
"jury-dove",
|
|
18074
|
+
"just-heron",
|
|
18075
|
+
"jolt-wasp",
|
|
18076
|
+
"keen-osprey",
|
|
18077
|
+
"kelp-seal",
|
|
18078
|
+
"key-falcon",
|
|
18079
|
+
"kind-panda",
|
|
18080
|
+
"knot-viper",
|
|
18081
|
+
"kraft-bear",
|
|
18082
|
+
"kite-mouse",
|
|
18083
|
+
"knoll-deer",
|
|
18084
|
+
"know-crane",
|
|
18085
|
+
"karma-wolf",
|
|
18086
|
+
"lake-otter",
|
|
18087
|
+
"lapis-jay",
|
|
18088
|
+
"last-condor",
|
|
18089
|
+
"leaf-gecko",
|
|
18090
|
+
"lean-coyote",
|
|
18091
|
+
"light-lynx",
|
|
18092
|
+
"lime-parrot",
|
|
18093
|
+
"live-eagle",
|
|
18094
|
+
"long-crane",
|
|
18095
|
+
"lost-fox",
|
|
18096
|
+
"loud-finch",
|
|
18097
|
+
"low-shark",
|
|
18098
|
+
"luck-rabbit",
|
|
18099
|
+
"lunar-owl",
|
|
18100
|
+
"lush-ibis",
|
|
18101
|
+
"malt-badger",
|
|
18102
|
+
"maple-wren",
|
|
18103
|
+
"mars-falcon",
|
|
18104
|
+
"matte-crow",
|
|
18105
|
+
"mesa-hawk",
|
|
18106
|
+
"mild-orca",
|
|
18107
|
+
"mint-dove",
|
|
18108
|
+
"mist-puma",
|
|
18109
|
+
"mock-robin",
|
|
18110
|
+
"mono-wolf",
|
|
18111
|
+
"moon-bear",
|
|
18112
|
+
"moss-turtle",
|
|
18113
|
+
"mud-heron",
|
|
18114
|
+
"mute-swan",
|
|
18115
|
+
"myth-lynx",
|
|
18116
|
+
"navy-eagle",
|
|
18117
|
+
"near-mink",
|
|
18118
|
+
"neon-parrot",
|
|
18119
|
+
"nest-crane",
|
|
18120
|
+
"next-fox",
|
|
18121
|
+
"nimble-ram",
|
|
18122
|
+
"node-spider",
|
|
18123
|
+
"noon-hawk",
|
|
18124
|
+
"north-seal",
|
|
18125
|
+
"nova-owl",
|
|
18126
|
+
"null-moth",
|
|
18127
|
+
"numb-carp",
|
|
18128
|
+
"nutmeg-jay",
|
|
18129
|
+
"neat-cobra",
|
|
18130
|
+
"nomad-elk",
|
|
18131
|
+
"oak-badger",
|
|
18132
|
+
"oat-finch",
|
|
18133
|
+
"odd-pelican",
|
|
18134
|
+
"olive-bear",
|
|
18135
|
+
"onyx-raven",
|
|
18136
|
+
"opal-crane",
|
|
18137
|
+
"open-wolf",
|
|
18138
|
+
"orbit-lynx",
|
|
18139
|
+
"ore-shark",
|
|
18140
|
+
"outer-dove",
|
|
18141
|
+
"pale-tiger",
|
|
18142
|
+
"park-heron",
|
|
18143
|
+
"peak-eagle",
|
|
18144
|
+
"pine-fox",
|
|
18145
|
+
"pixel-owl",
|
|
18146
|
+
"plain-goat",
|
|
18147
|
+
"plum-crane",
|
|
18148
|
+
"polar-ray",
|
|
18149
|
+
"port-falcon",
|
|
18150
|
+
"prime-wolf",
|
|
18151
|
+
"prism-jay",
|
|
18152
|
+
"proud-lion",
|
|
18153
|
+
"pulse-bat",
|
|
18154
|
+
"pure-swan",
|
|
18155
|
+
"pyro-hawk",
|
|
18156
|
+
"quake-bear",
|
|
18157
|
+
"quartz-jay",
|
|
18158
|
+
"quest-falcon",
|
|
18159
|
+
"quick-otter",
|
|
18160
|
+
"quiet-crane",
|
|
18161
|
+
"rain-leopard",
|
|
18162
|
+
"rapid-hare",
|
|
18163
|
+
"raw-condor",
|
|
18164
|
+
"reef-dolphin",
|
|
18165
|
+
"regal-stag",
|
|
18166
|
+
"ridge-fox",
|
|
18167
|
+
"rift-cobra",
|
|
18168
|
+
"rigid-crane",
|
|
18169
|
+
"river-otter",
|
|
18170
|
+
"rock-eagle",
|
|
18171
|
+
"root-mole",
|
|
18172
|
+
"rose-finch",
|
|
18173
|
+
"rough-boar",
|
|
18174
|
+
"ruby-hawk",
|
|
18175
|
+
"rust-wolf",
|
|
18176
|
+
"sage-owl",
|
|
18177
|
+
"salt-crane",
|
|
18178
|
+
"sand-viper",
|
|
18179
|
+
"satin-dove",
|
|
18180
|
+
"scale-dragon",
|
|
18181
|
+
"scarlet-ibis",
|
|
18182
|
+
"sea-falcon",
|
|
18183
|
+
"shade-lynx",
|
|
18184
|
+
"sharp-eagle",
|
|
18185
|
+
"shell-crab",
|
|
18186
|
+
"short-fox",
|
|
18187
|
+
"sigma-jay",
|
|
18188
|
+
"silk-moth",
|
|
18189
|
+
"silver-wolf",
|
|
18190
|
+
"slate-bear",
|
|
18191
|
+
"slim-heron",
|
|
18192
|
+
"smoke-puma",
|
|
18193
|
+
"snap-turtle",
|
|
18194
|
+
"snow-leopard",
|
|
18195
|
+
"solar-crane",
|
|
18196
|
+
"solid-ram",
|
|
18197
|
+
"sonic-bat",
|
|
18198
|
+
"south-seal",
|
|
18199
|
+
"spark-robin",
|
|
18200
|
+
"spice-wren",
|
|
18201
|
+
"split-mink",
|
|
18202
|
+
"spring-elk",
|
|
18203
|
+
"squid-ink",
|
|
18204
|
+
"stark-crow",
|
|
18205
|
+
"steel-hawk",
|
|
18206
|
+
"stern-bull",
|
|
18207
|
+
"still-swan",
|
|
18208
|
+
"stone-fox",
|
|
18209
|
+
"storm-eagle",
|
|
18210
|
+
"stout-boar",
|
|
18211
|
+
"stray-cat",
|
|
18212
|
+
"strong-lion",
|
|
18213
|
+
"sun-parrot",
|
|
18214
|
+
"surf-dolphin",
|
|
18215
|
+
"swift-deer",
|
|
18216
|
+
"teal-crane",
|
|
18217
|
+
"terra-wolf",
|
|
18218
|
+
"thick-bear",
|
|
18219
|
+
"thin-spider",
|
|
18220
|
+
"third-owl",
|
|
18221
|
+
"thorn-fox",
|
|
18222
|
+
"tide-seal",
|
|
18223
|
+
"timber-jay",
|
|
18224
|
+
"tiny-wren",
|
|
18225
|
+
"toast-mole",
|
|
18226
|
+
"topaz-hawk",
|
|
18227
|
+
"torch-lynx",
|
|
18228
|
+
"trace-falcon",
|
|
18229
|
+
"true-eagle",
|
|
18230
|
+
"tusk-walrus",
|
|
18231
|
+
"ultra-crane",
|
|
18232
|
+
"umbra-wolf",
|
|
18233
|
+
"unit-fox",
|
|
18234
|
+
"upper-hawk",
|
|
18235
|
+
"urban-jay",
|
|
18236
|
+
"vale-deer",
|
|
18237
|
+
"vast-eagle",
|
|
18238
|
+
"vault-bear",
|
|
18239
|
+
"velvet-owl",
|
|
18240
|
+
"vent-crane",
|
|
18241
|
+
"verse-fox",
|
|
18242
|
+
"vigor-lynx",
|
|
18243
|
+
"vine-parrot",
|
|
18244
|
+
"vivid-swan",
|
|
18245
|
+
"void-raven",
|
|
18246
|
+
"volt-hawk",
|
|
18247
|
+
"vow-falcon",
|
|
18248
|
+
"vintage-jay",
|
|
18249
|
+
"vista-wolf",
|
|
18250
|
+
"vital-hare",
|
|
18251
|
+
"warm-otter",
|
|
18252
|
+
"wave-dolphin",
|
|
18253
|
+
"wax-crane",
|
|
18254
|
+
"west-falcon",
|
|
18255
|
+
"wheat-mouse",
|
|
18256
|
+
"white-tiger",
|
|
18257
|
+
"wide-eagle",
|
|
18258
|
+
"wild-fox",
|
|
18259
|
+
"wind-hawk",
|
|
18260
|
+
"wire-spider",
|
|
18261
|
+
"wise-owl",
|
|
18262
|
+
"wood-thrush",
|
|
18263
|
+
"wool-ram",
|
|
18264
|
+
"wren-song",
|
|
18265
|
+
"wry-crow",
|
|
18266
|
+
"xeno-crane",
|
|
18267
|
+
"xerus-fox",
|
|
18268
|
+
"yarn-robin",
|
|
18269
|
+
"yew-falcon",
|
|
18270
|
+
"young-wolf",
|
|
18271
|
+
"zeal-hawk",
|
|
18272
|
+
"zen-panda",
|
|
18273
|
+
"zero-crane",
|
|
18274
|
+
"zinc-eagle",
|
|
18275
|
+
"zone-fox"
|
|
18276
|
+
];
|
|
18277
|
+
});
|
|
18278
|
+
|
|
18279
|
+
// src/lib/identity.ts
|
|
18280
|
+
var exports_identity = {};
|
|
18281
|
+
__export(exports_identity, {
|
|
18282
|
+
updateCachedAutoName: () => updateCachedAutoName,
|
|
18283
|
+
resolveIdentity: () => resolveIdentity,
|
|
18284
|
+
requireIdentity: () => requireIdentity,
|
|
18285
|
+
getAutoName: () => getAutoName,
|
|
18286
|
+
_resetAutoName: () => _resetAutoName
|
|
18287
|
+
});
|
|
18288
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync7 } from "fs";
|
|
18289
|
+
import { join as join11, dirname as dirname3 } from "path";
|
|
18290
|
+
function isNameTaken(name) {
|
|
18291
|
+
try {
|
|
18292
|
+
const { getDb: getDb2 } = (init_db(), __toCommonJS(exports_db));
|
|
18293
|
+
const db2 = getDb2();
|
|
18294
|
+
const row = db2.prepare("SELECT agent FROM agent_presence WHERE agent = ?").get(name);
|
|
18295
|
+
return !!row;
|
|
18296
|
+
} catch {
|
|
18297
|
+
return false;
|
|
18298
|
+
}
|
|
18299
|
+
}
|
|
18300
|
+
function getAutoName() {
|
|
18301
|
+
if (cachedAutoName)
|
|
18302
|
+
return cachedAutoName;
|
|
18303
|
+
try {
|
|
18304
|
+
const name2 = readFileSync5(AGENT_ID_FILE, "utf-8").trim();
|
|
18305
|
+
if (name2) {
|
|
18306
|
+
cachedAutoName = name2;
|
|
18307
|
+
return name2;
|
|
18308
|
+
}
|
|
18309
|
+
} catch {}
|
|
18310
|
+
const shuffled = [...AGENT_NAMES].sort(() => Math.random() - 0.5);
|
|
18311
|
+
let name = shuffled[0];
|
|
18312
|
+
for (const candidate of shuffled) {
|
|
18313
|
+
if (!isNameTaken(candidate)) {
|
|
18314
|
+
name = candidate;
|
|
18315
|
+
break;
|
|
18316
|
+
}
|
|
18317
|
+
}
|
|
18318
|
+
cachedAutoName = name;
|
|
18319
|
+
try {
|
|
18320
|
+
mkdirSync7(dirname3(AGENT_ID_FILE), { recursive: true });
|
|
18321
|
+
writeFileSync3(AGENT_ID_FILE, name + `
|
|
18322
|
+
`, "utf-8");
|
|
18323
|
+
} catch {}
|
|
18324
|
+
return name;
|
|
18325
|
+
}
|
|
18326
|
+
function resolveIdentity(explicit) {
|
|
18327
|
+
const explicitValue = explicit?.trim();
|
|
18328
|
+
if (explicitValue)
|
|
18329
|
+
return explicitValue;
|
|
18330
|
+
const envValue = process.env.CONVERSATIONS_AGENT_ID?.trim();
|
|
18331
|
+
if (envValue)
|
|
18332
|
+
return envValue;
|
|
18333
|
+
return getAutoName();
|
|
18334
|
+
}
|
|
18335
|
+
function requireIdentity(explicit) {
|
|
18336
|
+
const explicitValue = explicit?.trim();
|
|
18337
|
+
if (explicitValue)
|
|
18338
|
+
return explicitValue;
|
|
18339
|
+
const envValue = process.env.CONVERSATIONS_AGENT_ID?.trim();
|
|
18340
|
+
if (envValue)
|
|
18341
|
+
return envValue;
|
|
18342
|
+
throw new Error("Agent identity required. Set CONVERSATIONS_AGENT_ID env var or pass --from flag.");
|
|
18343
|
+
}
|
|
18344
|
+
function updateCachedAutoName(newName) {
|
|
18345
|
+
cachedAutoName = newName;
|
|
18346
|
+
try {
|
|
18347
|
+
mkdirSync7(dirname3(AGENT_ID_FILE), { recursive: true });
|
|
18348
|
+
writeFileSync3(AGENT_ID_FILE, newName + `
|
|
18349
|
+
`, "utf-8");
|
|
18350
|
+
} catch {}
|
|
18351
|
+
}
|
|
18352
|
+
function _resetAutoName() {
|
|
18353
|
+
cachedAutoName = null;
|
|
18354
|
+
}
|
|
18355
|
+
var AGENT_ID_FILE, cachedAutoName = null;
|
|
18356
|
+
var init_identity = __esm(() => {
|
|
18357
|
+
init_names();
|
|
18358
|
+
init_db();
|
|
18359
|
+
AGENT_ID_FILE = join11(getDataDir2(), "agent-id");
|
|
18360
|
+
});
|
|
18361
|
+
|
|
17927
18362
|
// src/lib/pg-migrations.ts
|
|
17928
18363
|
var exports_pg_migrations = {};
|
|
17929
18364
|
__export(exports_pg_migrations, {
|
|
@@ -40793,418 +41228,8 @@ function getSessionActivity(sessionId) {
|
|
|
40793
41228
|
};
|
|
40794
41229
|
}
|
|
40795
41230
|
|
|
40796
|
-
// src/lib/identity.ts
|
|
40797
|
-
import { readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync7 } from "fs";
|
|
40798
|
-
import { join as join11, dirname as dirname3 } from "path";
|
|
40799
|
-
|
|
40800
|
-
// src/lib/names.ts
|
|
40801
|
-
var AGENT_NAMES = [
|
|
40802
|
-
"amber-fox",
|
|
40803
|
-
"arctic-wolf",
|
|
40804
|
-
"ashen-crow",
|
|
40805
|
-
"azure-hawk",
|
|
40806
|
-
"astral-lynx",
|
|
40807
|
-
"autumn-bear",
|
|
40808
|
-
"agile-puma",
|
|
40809
|
-
"alpine-ibex",
|
|
40810
|
-
"ancient-owl",
|
|
40811
|
-
"aqua-otter",
|
|
40812
|
-
"arid-viper",
|
|
40813
|
-
"atom-finch",
|
|
40814
|
-
"auburn-deer",
|
|
40815
|
-
"aurora-seal",
|
|
40816
|
-
"avid-mink",
|
|
40817
|
-
"blaze-tiger",
|
|
40818
|
-
"bright-heron",
|
|
40819
|
-
"bronze-eagle",
|
|
40820
|
-
"brisk-hare",
|
|
40821
|
-
"burnt-moth",
|
|
40822
|
-
"bold-raven",
|
|
40823
|
-
"blue-whale",
|
|
40824
|
-
"boreal-fox",
|
|
40825
|
-
"brass-cobra",
|
|
40826
|
-
"brave-ram",
|
|
40827
|
-
"brick-crane",
|
|
40828
|
-
"brief-newt",
|
|
40829
|
-
"briny-crab",
|
|
40830
|
-
"broad-elk",
|
|
40831
|
-
"brook-dove",
|
|
40832
|
-
"calm-panda",
|
|
40833
|
-
"cedar-jay",
|
|
40834
|
-
"chief-lion",
|
|
40835
|
-
"chrome-bat",
|
|
40836
|
-
"civic-wren",
|
|
40837
|
-
"clear-swan",
|
|
40838
|
-
"cliff-goat",
|
|
40839
|
-
"coal-shark",
|
|
40840
|
-
"cold-crane",
|
|
40841
|
-
"copper-jay",
|
|
40842
|
-
"coral-fish",
|
|
40843
|
-
"crisp-lark",
|
|
40844
|
-
"cross-mole",
|
|
40845
|
-
"cubic-wasp",
|
|
40846
|
-
"cyan-toad",
|
|
40847
|
-
"dark-stag",
|
|
40848
|
-
"dawn-robin",
|
|
40849
|
-
"deep-squid",
|
|
40850
|
-
"delta-fox",
|
|
40851
|
-
"dense-boar",
|
|
40852
|
-
"dew-spider",
|
|
40853
|
-
"dim-gecko",
|
|
40854
|
-
"draft-bear",
|
|
40855
|
-
"drift-gull",
|
|
40856
|
-
"dry-newt",
|
|
40857
|
-
"dual-crane",
|
|
40858
|
-
"dune-mouse",
|
|
40859
|
-
"dusk-moth",
|
|
40860
|
-
"dusty-mule",
|
|
40861
|
-
"dwarf-carp",
|
|
40862
|
-
"east-falcon",
|
|
40863
|
-
"echo-parrot",
|
|
40864
|
-
"edge-shark",
|
|
40865
|
-
"elm-beetle",
|
|
40866
|
-
"ember-lynx",
|
|
40867
|
-
"epoch-crane",
|
|
40868
|
-
"even-pike",
|
|
40869
|
-
"extra-ant",
|
|
40870
|
-
"elder-stork",
|
|
40871
|
-
"ebon-crow",
|
|
40872
|
-
"ever-finch",
|
|
40873
|
-
"exact-moth",
|
|
40874
|
-
"exile-wren",
|
|
40875
|
-
"equal-dove",
|
|
40876
|
-
"etch-hare",
|
|
40877
|
-
"faint-orca",
|
|
40878
|
-
"far-condor",
|
|
40879
|
-
"fern-mouse",
|
|
40880
|
-
"fierce-yak",
|
|
40881
|
-
"first-kite",
|
|
40882
|
-
"fjord-seal",
|
|
40883
|
-
"flint-wolf",
|
|
40884
|
-
"fog-parrot",
|
|
40885
|
-
"forge-bull",
|
|
40886
|
-
"fossil-ray",
|
|
40887
|
-
"frank-mink",
|
|
40888
|
-
"free-eagle",
|
|
40889
|
-
"fresh-colt",
|
|
40890
|
-
"frost-bear",
|
|
40891
|
-
"fuse-wasp",
|
|
40892
|
-
"gale-hawk",
|
|
40893
|
-
"gem-turtle",
|
|
40894
|
-
"ghost-lynx",
|
|
40895
|
-
"gilt-robin",
|
|
40896
|
-
"glad-moose",
|
|
40897
|
-
"glass-eel",
|
|
40898
|
-
"gleam-puma",
|
|
40899
|
-
"glyph-owl",
|
|
40900
|
-
"gold-crane",
|
|
40901
|
-
"gorge-lion",
|
|
40902
|
-
"grain-duck",
|
|
40903
|
-
"grand-wolf",
|
|
40904
|
-
"gray-fox",
|
|
40905
|
-
"green-hare",
|
|
40906
|
-
"grit-shark",
|
|
40907
|
-
"half-stork",
|
|
40908
|
-
"haze-panther",
|
|
40909
|
-
"heart-dove",
|
|
40910
|
-
"helm-eagle",
|
|
40911
|
-
"herb-toad",
|
|
40912
|
-
"hex-spider",
|
|
40913
|
-
"high-falcon",
|
|
40914
|
-
"hive-hornet",
|
|
40915
|
-
"holo-swan",
|
|
40916
|
-
"hood-cobra",
|
|
40917
|
-
"horn-bison",
|
|
40918
|
-
"huge-squid",
|
|
40919
|
-
"hull-crab",
|
|
40920
|
-
"hunt-marten",
|
|
40921
|
-
"husk-moth",
|
|
40922
|
-
"ice-leopard",
|
|
40923
|
-
"idle-crane",
|
|
40924
|
-
"inch-beetle",
|
|
40925
|
-
"indigo-jay",
|
|
40926
|
-
"inner-fox",
|
|
40927
|
-
"ion-parrot",
|
|
40928
|
-
"iron-bull",
|
|
40929
|
-
"isle-pelican",
|
|
40930
|
-
"ivory-hawk",
|
|
40931
|
-
"ivy-snake",
|
|
40932
|
-
"iota-wren",
|
|
40933
|
-
"ink-raven",
|
|
40934
|
-
"ignite-ram",
|
|
40935
|
-
"inert-slug",
|
|
40936
|
-
"infra-mole",
|
|
40937
|
-
"jade-tiger",
|
|
40938
|
-
"jest-magpie",
|
|
40939
|
-
"jewel-crane",
|
|
40940
|
-
"joint-boar",
|
|
40941
|
-
"jovial-elk",
|
|
40942
|
-
"jump-frog",
|
|
40943
|
-
"jungle-cat",
|
|
40944
|
-
"jury-dove",
|
|
40945
|
-
"just-heron",
|
|
40946
|
-
"jolt-wasp",
|
|
40947
|
-
"keen-osprey",
|
|
40948
|
-
"kelp-seal",
|
|
40949
|
-
"key-falcon",
|
|
40950
|
-
"kind-panda",
|
|
40951
|
-
"knot-viper",
|
|
40952
|
-
"kraft-bear",
|
|
40953
|
-
"kite-mouse",
|
|
40954
|
-
"knoll-deer",
|
|
40955
|
-
"know-crane",
|
|
40956
|
-
"karma-wolf",
|
|
40957
|
-
"lake-otter",
|
|
40958
|
-
"lapis-jay",
|
|
40959
|
-
"last-condor",
|
|
40960
|
-
"leaf-gecko",
|
|
40961
|
-
"lean-coyote",
|
|
40962
|
-
"light-lynx",
|
|
40963
|
-
"lime-parrot",
|
|
40964
|
-
"live-eagle",
|
|
40965
|
-
"long-crane",
|
|
40966
|
-
"lost-fox",
|
|
40967
|
-
"loud-finch",
|
|
40968
|
-
"low-shark",
|
|
40969
|
-
"luck-rabbit",
|
|
40970
|
-
"lunar-owl",
|
|
40971
|
-
"lush-ibis",
|
|
40972
|
-
"malt-badger",
|
|
40973
|
-
"maple-wren",
|
|
40974
|
-
"mars-falcon",
|
|
40975
|
-
"matte-crow",
|
|
40976
|
-
"mesa-hawk",
|
|
40977
|
-
"mild-orca",
|
|
40978
|
-
"mint-dove",
|
|
40979
|
-
"mist-puma",
|
|
40980
|
-
"mock-robin",
|
|
40981
|
-
"mono-wolf",
|
|
40982
|
-
"moon-bear",
|
|
40983
|
-
"moss-turtle",
|
|
40984
|
-
"mud-heron",
|
|
40985
|
-
"mute-swan",
|
|
40986
|
-
"myth-lynx",
|
|
40987
|
-
"navy-eagle",
|
|
40988
|
-
"near-mink",
|
|
40989
|
-
"neon-parrot",
|
|
40990
|
-
"nest-crane",
|
|
40991
|
-
"next-fox",
|
|
40992
|
-
"nimble-ram",
|
|
40993
|
-
"node-spider",
|
|
40994
|
-
"noon-hawk",
|
|
40995
|
-
"north-seal",
|
|
40996
|
-
"nova-owl",
|
|
40997
|
-
"null-moth",
|
|
40998
|
-
"numb-carp",
|
|
40999
|
-
"nutmeg-jay",
|
|
41000
|
-
"neat-cobra",
|
|
41001
|
-
"nomad-elk",
|
|
41002
|
-
"oak-badger",
|
|
41003
|
-
"oat-finch",
|
|
41004
|
-
"odd-pelican",
|
|
41005
|
-
"olive-bear",
|
|
41006
|
-
"onyx-raven",
|
|
41007
|
-
"opal-crane",
|
|
41008
|
-
"open-wolf",
|
|
41009
|
-
"orbit-lynx",
|
|
41010
|
-
"ore-shark",
|
|
41011
|
-
"outer-dove",
|
|
41012
|
-
"pale-tiger",
|
|
41013
|
-
"park-heron",
|
|
41014
|
-
"peak-eagle",
|
|
41015
|
-
"pine-fox",
|
|
41016
|
-
"pixel-owl",
|
|
41017
|
-
"plain-goat",
|
|
41018
|
-
"plum-crane",
|
|
41019
|
-
"polar-ray",
|
|
41020
|
-
"port-falcon",
|
|
41021
|
-
"prime-wolf",
|
|
41022
|
-
"prism-jay",
|
|
41023
|
-
"proud-lion",
|
|
41024
|
-
"pulse-bat",
|
|
41025
|
-
"pure-swan",
|
|
41026
|
-
"pyro-hawk",
|
|
41027
|
-
"quake-bear",
|
|
41028
|
-
"quartz-jay",
|
|
41029
|
-
"quest-falcon",
|
|
41030
|
-
"quick-otter",
|
|
41031
|
-
"quiet-crane",
|
|
41032
|
-
"rain-leopard",
|
|
41033
|
-
"rapid-hare",
|
|
41034
|
-
"raw-condor",
|
|
41035
|
-
"reef-dolphin",
|
|
41036
|
-
"regal-stag",
|
|
41037
|
-
"ridge-fox",
|
|
41038
|
-
"rift-cobra",
|
|
41039
|
-
"rigid-crane",
|
|
41040
|
-
"river-otter",
|
|
41041
|
-
"rock-eagle",
|
|
41042
|
-
"root-mole",
|
|
41043
|
-
"rose-finch",
|
|
41044
|
-
"rough-boar",
|
|
41045
|
-
"ruby-hawk",
|
|
41046
|
-
"rust-wolf",
|
|
41047
|
-
"sage-owl",
|
|
41048
|
-
"salt-crane",
|
|
41049
|
-
"sand-viper",
|
|
41050
|
-
"satin-dove",
|
|
41051
|
-
"scale-dragon",
|
|
41052
|
-
"scarlet-ibis",
|
|
41053
|
-
"sea-falcon",
|
|
41054
|
-
"shade-lynx",
|
|
41055
|
-
"sharp-eagle",
|
|
41056
|
-
"shell-crab",
|
|
41057
|
-
"short-fox",
|
|
41058
|
-
"sigma-jay",
|
|
41059
|
-
"silk-moth",
|
|
41060
|
-
"silver-wolf",
|
|
41061
|
-
"slate-bear",
|
|
41062
|
-
"slim-heron",
|
|
41063
|
-
"smoke-puma",
|
|
41064
|
-
"snap-turtle",
|
|
41065
|
-
"snow-leopard",
|
|
41066
|
-
"solar-crane",
|
|
41067
|
-
"solid-ram",
|
|
41068
|
-
"sonic-bat",
|
|
41069
|
-
"south-seal",
|
|
41070
|
-
"spark-robin",
|
|
41071
|
-
"spice-wren",
|
|
41072
|
-
"split-mink",
|
|
41073
|
-
"spring-elk",
|
|
41074
|
-
"squid-ink",
|
|
41075
|
-
"stark-crow",
|
|
41076
|
-
"steel-hawk",
|
|
41077
|
-
"stern-bull",
|
|
41078
|
-
"still-swan",
|
|
41079
|
-
"stone-fox",
|
|
41080
|
-
"storm-eagle",
|
|
41081
|
-
"stout-boar",
|
|
41082
|
-
"stray-cat",
|
|
41083
|
-
"strong-lion",
|
|
41084
|
-
"sun-parrot",
|
|
41085
|
-
"surf-dolphin",
|
|
41086
|
-
"swift-deer",
|
|
41087
|
-
"teal-crane",
|
|
41088
|
-
"terra-wolf",
|
|
41089
|
-
"thick-bear",
|
|
41090
|
-
"thin-spider",
|
|
41091
|
-
"third-owl",
|
|
41092
|
-
"thorn-fox",
|
|
41093
|
-
"tide-seal",
|
|
41094
|
-
"timber-jay",
|
|
41095
|
-
"tiny-wren",
|
|
41096
|
-
"toast-mole",
|
|
41097
|
-
"topaz-hawk",
|
|
41098
|
-
"torch-lynx",
|
|
41099
|
-
"trace-falcon",
|
|
41100
|
-
"true-eagle",
|
|
41101
|
-
"tusk-walrus",
|
|
41102
|
-
"ultra-crane",
|
|
41103
|
-
"umbra-wolf",
|
|
41104
|
-
"unit-fox",
|
|
41105
|
-
"upper-hawk",
|
|
41106
|
-
"urban-jay",
|
|
41107
|
-
"vale-deer",
|
|
41108
|
-
"vast-eagle",
|
|
41109
|
-
"vault-bear",
|
|
41110
|
-
"velvet-owl",
|
|
41111
|
-
"vent-crane",
|
|
41112
|
-
"verse-fox",
|
|
41113
|
-
"vigor-lynx",
|
|
41114
|
-
"vine-parrot",
|
|
41115
|
-
"vivid-swan",
|
|
41116
|
-
"void-raven",
|
|
41117
|
-
"volt-hawk",
|
|
41118
|
-
"vow-falcon",
|
|
41119
|
-
"vintage-jay",
|
|
41120
|
-
"vista-wolf",
|
|
41121
|
-
"vital-hare",
|
|
41122
|
-
"warm-otter",
|
|
41123
|
-
"wave-dolphin",
|
|
41124
|
-
"wax-crane",
|
|
41125
|
-
"west-falcon",
|
|
41126
|
-
"wheat-mouse",
|
|
41127
|
-
"white-tiger",
|
|
41128
|
-
"wide-eagle",
|
|
41129
|
-
"wild-fox",
|
|
41130
|
-
"wind-hawk",
|
|
41131
|
-
"wire-spider",
|
|
41132
|
-
"wise-owl",
|
|
41133
|
-
"wood-thrush",
|
|
41134
|
-
"wool-ram",
|
|
41135
|
-
"wren-song",
|
|
41136
|
-
"wry-crow",
|
|
41137
|
-
"xeno-crane",
|
|
41138
|
-
"xerus-fox",
|
|
41139
|
-
"yarn-robin",
|
|
41140
|
-
"yew-falcon",
|
|
41141
|
-
"young-wolf",
|
|
41142
|
-
"zeal-hawk",
|
|
41143
|
-
"zen-panda",
|
|
41144
|
-
"zero-crane",
|
|
41145
|
-
"zinc-eagle",
|
|
41146
|
-
"zone-fox"
|
|
41147
|
-
];
|
|
41148
|
-
|
|
41149
|
-
// src/lib/identity.ts
|
|
41150
|
-
init_db();
|
|
41151
|
-
var AGENT_ID_FILE = join11(getDataDir2(), "agent-id");
|
|
41152
|
-
var cachedAutoName = null;
|
|
41153
|
-
function isNameTaken(name) {
|
|
41154
|
-
try {
|
|
41155
|
-
const { getDb: getDb2 } = (init_db(), __toCommonJS(exports_db));
|
|
41156
|
-
const db2 = getDb2();
|
|
41157
|
-
const row = db2.prepare("SELECT agent FROM agent_presence WHERE agent = ?").get(name);
|
|
41158
|
-
return !!row;
|
|
41159
|
-
} catch {
|
|
41160
|
-
return false;
|
|
41161
|
-
}
|
|
41162
|
-
}
|
|
41163
|
-
function getAutoName() {
|
|
41164
|
-
if (cachedAutoName)
|
|
41165
|
-
return cachedAutoName;
|
|
41166
|
-
try {
|
|
41167
|
-
const name2 = readFileSync5(AGENT_ID_FILE, "utf-8").trim();
|
|
41168
|
-
if (name2) {
|
|
41169
|
-
cachedAutoName = name2;
|
|
41170
|
-
return name2;
|
|
41171
|
-
}
|
|
41172
|
-
} catch {}
|
|
41173
|
-
const shuffled = [...AGENT_NAMES].sort(() => Math.random() - 0.5);
|
|
41174
|
-
let name = shuffled[0];
|
|
41175
|
-
for (const candidate of shuffled) {
|
|
41176
|
-
if (!isNameTaken(candidate)) {
|
|
41177
|
-
name = candidate;
|
|
41178
|
-
break;
|
|
41179
|
-
}
|
|
41180
|
-
}
|
|
41181
|
-
cachedAutoName = name;
|
|
41182
|
-
try {
|
|
41183
|
-
mkdirSync7(dirname3(AGENT_ID_FILE), { recursive: true });
|
|
41184
|
-
writeFileSync3(AGENT_ID_FILE, name + `
|
|
41185
|
-
`, "utf-8");
|
|
41186
|
-
} catch {}
|
|
41187
|
-
return name;
|
|
41188
|
-
}
|
|
41189
|
-
function resolveIdentity(explicit) {
|
|
41190
|
-
const explicitValue = explicit?.trim();
|
|
41191
|
-
if (explicitValue)
|
|
41192
|
-
return explicitValue;
|
|
41193
|
-
const envValue = process.env.CONVERSATIONS_AGENT_ID?.trim();
|
|
41194
|
-
if (envValue)
|
|
41195
|
-
return envValue;
|
|
41196
|
-
return getAutoName();
|
|
41197
|
-
}
|
|
41198
|
-
function updateCachedAutoName(newName) {
|
|
41199
|
-
cachedAutoName = newName;
|
|
41200
|
-
try {
|
|
41201
|
-
mkdirSync7(dirname3(AGENT_ID_FILE), { recursive: true });
|
|
41202
|
-
writeFileSync3(AGENT_ID_FILE, newName + `
|
|
41203
|
-
`, "utf-8");
|
|
41204
|
-
} catch {}
|
|
41205
|
-
}
|
|
41206
|
-
|
|
41207
41231
|
// src/mcp/tools/messaging.ts
|
|
41232
|
+
init_identity();
|
|
41208
41233
|
function registerMessagingTools(server, resolveProjectId) {
|
|
41209
41234
|
server.registerTool("send_message", {
|
|
41210
41235
|
description: "Send a DM to an agent by name, or to a specific agent-claude session by ID. When target_session_id is provided, the message is routed to that exact session and auto-injected into its conversation.",
|
|
@@ -41732,6 +41757,7 @@ function unarchiveSpace(name) {
|
|
|
41732
41757
|
}
|
|
41733
41758
|
|
|
41734
41759
|
// src/mcp/tools/spaces.ts
|
|
41760
|
+
init_identity();
|
|
41735
41761
|
function registerSpaceTools(server) {
|
|
41736
41762
|
server.registerTool("create_space", {
|
|
41737
41763
|
description: "Create a space and auto-join.",
|
|
@@ -42224,6 +42250,7 @@ function deleteProject(id) {
|
|
|
42224
42250
|
}
|
|
42225
42251
|
|
|
42226
42252
|
// src/mcp/tools/projects.ts
|
|
42253
|
+
init_identity();
|
|
42227
42254
|
function registerProjectTools(server) {
|
|
42228
42255
|
server.registerTool("create_project", {
|
|
42229
42256
|
description: "Create a project for agent collaboration.",
|
|
@@ -42426,11 +42453,18 @@ function registerProjectTools(server) {
|
|
|
42426
42453
|
});
|
|
42427
42454
|
}
|
|
42428
42455
|
|
|
42456
|
+
// src/mcp/tools/agents.ts
|
|
42457
|
+
init_identity();
|
|
42458
|
+
|
|
42429
42459
|
// src/mcp/channel.ts
|
|
42430
42460
|
var POLL_INTERVAL_MS = 1000;
|
|
42431
42461
|
var sessionAgentId = null;
|
|
42432
42462
|
function setSessionAgent(agentId) {
|
|
42433
42463
|
sessionAgentId = agentId;
|
|
42464
|
+
try {
|
|
42465
|
+
const { updateCachedAutoName: updateCachedAutoName2 } = (init_identity(), __toCommonJS(exports_identity));
|
|
42466
|
+
updateCachedAutoName2(agentId);
|
|
42467
|
+
} catch {}
|
|
42434
42468
|
}
|
|
42435
42469
|
function getSessionAgent() {
|
|
42436
42470
|
return sessionAgentId || process.env.CONVERSATIONS_AGENT_ID || null;
|
|
@@ -42465,15 +42499,10 @@ function registerChannelBridge(server) {
|
|
|
42465
42499
|
markReadByIds([msg.id]);
|
|
42466
42500
|
} catch {}
|
|
42467
42501
|
}
|
|
42468
|
-
const
|
|
42469
|
-
|
|
42470
|
-
|
|
42471
|
-
|
|
42472
|
-
msg.space ? `Space: ${msg.space}` : null,
|
|
42473
|
-
msg.priority && msg.priority !== "normal" ? `Priority: ${msg.priority}` : null
|
|
42474
|
-
].filter(Boolean).join(" | ");
|
|
42475
|
-
const enrichedContent = `[${context}]
|
|
42476
|
-
${msg.content}`;
|
|
42502
|
+
const enrichedContent = `${msg.content}
|
|
42503
|
+
|
|
42504
|
+
---
|
|
42505
|
+
[Via Conversations MCP from ${msg.from_agent} (message #${msg.id}). To reply, use the conversations send_message tool with to="${msg.from_agent}"]`;
|
|
42477
42506
|
server.server.notification({
|
|
42478
42507
|
method: "notifications/claude/channel",
|
|
42479
42508
|
params: {
|
|
@@ -42498,14 +42527,14 @@ ${msg.content}`;
|
|
|
42498
42527
|
const agent = getSessionAgent();
|
|
42499
42528
|
const sid = getSessionId();
|
|
42500
42529
|
if (agent) {
|
|
42501
|
-
const msgs = readMessages({ to: agent, order: "asc", limit: 20 }).filter((m) => m.id > lastAgentMsgId);
|
|
42530
|
+
const msgs = readMessages({ to: agent, order: "asc", limit: 20 }).filter((m) => m.id > lastAgentMsgId && m.from_agent !== agent);
|
|
42502
42531
|
for (const msg of msgs) {
|
|
42503
42532
|
lastAgentMsgId = msg.id;
|
|
42504
42533
|
pushNotification(msg, false);
|
|
42505
42534
|
}
|
|
42506
42535
|
}
|
|
42507
42536
|
if (sid) {
|
|
42508
|
-
const msgs = readMessages({ to: `session:${sid}`, order: "asc", limit: 20 }).filter((m) => m.id > lastSessionMsgId);
|
|
42537
|
+
const msgs = readMessages({ to: `session:${sid}`, order: "asc", limit: 20 }).filter((m) => m.id > lastSessionMsgId && m.from_agent !== agent);
|
|
42509
42538
|
for (const msg of msgs) {
|
|
42510
42539
|
lastSessionMsgId = msg.id;
|
|
42511
42540
|
pushNotification(msg, true);
|
|
@@ -42520,15 +42549,21 @@ ${msg.content}`;
|
|
|
42520
42549
|
// src/mcp/tools/agents.ts
|
|
42521
42550
|
function registerAgentTools(server, agentFocus, getAgentFocus) {
|
|
42522
42551
|
server.registerTool("register_agent", {
|
|
42523
|
-
description: "Register an agent
|
|
42552
|
+
description: "Register an agent. Just provide the name \u2014 session_id is auto-detected.",
|
|
42524
42553
|
inputSchema: {
|
|
42525
|
-
name: exports_external.string(),
|
|
42526
|
-
|
|
42554
|
+
name: exports_external.string().optional().describe("Agent name"),
|
|
42555
|
+
agent_name: exports_external.string().optional().describe("Agent name (alias)"),
|
|
42556
|
+
agent_id: exports_external.string().optional().describe("Agent name (alias)"),
|
|
42557
|
+
session_id: exports_external.string().optional().describe("Auto-detected from environment, do not set manually"),
|
|
42527
42558
|
role: exports_external.string().optional(),
|
|
42528
42559
|
project_id: exports_external.string().optional()
|
|
42529
42560
|
}
|
|
42530
42561
|
}, async (args) => {
|
|
42531
|
-
const { name, session_id, role, project_id } = args;
|
|
42562
|
+
const { name: nameParam, agent_name, agent_id, session_id: manualSid, role, project_id } = args;
|
|
42563
|
+
const name = nameParam || agent_name || agent_id;
|
|
42564
|
+
if (!name)
|
|
42565
|
+
return { content: [{ type: "text", text: "Error: name is required" }], isError: true };
|
|
42566
|
+
const session_id = manualSid || process.env.CONVERSATIONS_SESSION_ID || `${name}-${Date.now()}`;
|
|
42532
42567
|
try {
|
|
42533
42568
|
const result = registerAgent(name, session_id, role, project_id);
|
|
42534
42569
|
setSessionAgent(name);
|
|
@@ -42546,14 +42581,16 @@ function registerAgentTools(server, agentFocus, getAgentFocus) {
|
|
|
42546
42581
|
}
|
|
42547
42582
|
});
|
|
42548
42583
|
server.registerTool("heartbeat", {
|
|
42549
|
-
description: "Send presence heartbeat.",
|
|
42584
|
+
description: "Send presence heartbeat. Use 'from' or 'name' to set agent identity.",
|
|
42550
42585
|
inputSchema: {
|
|
42551
|
-
from: exports_external.string().optional(),
|
|
42586
|
+
from: exports_external.string().optional().describe("Agent name"),
|
|
42587
|
+
name: exports_external.string().optional().describe("Agent name (alias for from)"),
|
|
42588
|
+
agent_name: exports_external.string().optional().describe("Agent name (alias for from)"),
|
|
42552
42589
|
status: exports_external.string().optional()
|
|
42553
42590
|
}
|
|
42554
42591
|
}, async (args) => {
|
|
42555
|
-
const { from: fromParam, status } = args;
|
|
42556
|
-
const agent = resolveIdentity(fromParam);
|
|
42592
|
+
const { from: fromParam, name: nameParam, agent_name, status } = args;
|
|
42593
|
+
const agent = resolveIdentity(fromParam || nameParam || agent_name);
|
|
42557
42594
|
heartbeat(agent, status);
|
|
42558
42595
|
setSessionAgent(agent);
|
|
42559
42596
|
return {
|
|
@@ -42709,6 +42746,9 @@ function registerAgentTools(server, agentFocus, getAgentFocus) {
|
|
|
42709
42746
|
});
|
|
42710
42747
|
}
|
|
42711
42748
|
|
|
42749
|
+
// src/mcp/tools/advanced.ts
|
|
42750
|
+
init_identity();
|
|
42751
|
+
|
|
42712
42752
|
// src/lib/reactions.ts
|
|
42713
42753
|
init_db();
|
|
42714
42754
|
function addReaction(messageId, agent, emoji3) {
|
|
@@ -44406,7 +44446,7 @@ function registerTmuxTools(server) {
|
|
|
44406
44446
|
// package.json
|
|
44407
44447
|
var package_default = {
|
|
44408
44448
|
name: "@hasna/conversations",
|
|
44409
|
-
version: "0.2.
|
|
44449
|
+
version: "0.2.41",
|
|
44410
44450
|
description: "Real-time CLI messaging for AI agents",
|
|
44411
44451
|
type: "module",
|
|
44412
44452
|
bin: {
|