@clawling/clawchat-plugin-openclaw 2026.9.22-2 → 2026.9.23-2

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/src/tools.ts CHANGED
@@ -77,6 +77,17 @@ import {
77
77
  ClawchatListAppsSchema,
78
78
  ClawchatUnregisterAppSchema,
79
79
  ClawchatLivewareLoginSchema,
80
+ ClawchatOrchListAgentsSchema,
81
+ ClawchatOrchGetAgentSchema,
82
+ ClawchatOrchSetAgentBehaviorSchema,
83
+ ClawchatOrchListGroupsSchema,
84
+ ClawchatOrchGetGroupSchema,
85
+ ClawchatOrchSetGroupPromptSchema,
86
+ ClawchatOrchCreateGroupSchema,
87
+ ClawchatOrchGroupMemberSchema,
88
+ ClawchatOrchSetGroupAgentSettingsSchema,
89
+ ClawchatOrchCreateConnectCodeSchema,
90
+ ClawchatOrchGetConnectCodeSchema,
80
91
  type ClawchatMemoryEditParams,
81
92
  type ClawchatMemoryReadParams,
82
93
  type ClawchatMemorySearchParams,
@@ -109,6 +120,14 @@ import {
109
120
  type ClawchatRegisterAppParams,
110
121
  type ClawchatUnregisterAppParams,
111
122
  type ClawchatLivewareLoginParams,
123
+ type ClawchatOrchGetAgentParams,
124
+ type ClawchatOrchSetAgentBehaviorParams,
125
+ type ClawchatOrchGetGroupParams,
126
+ type ClawchatOrchSetGroupPromptParams,
127
+ type ClawchatOrchCreateGroupParams,
128
+ type ClawchatOrchGroupMemberParams,
129
+ type ClawchatOrchSetGroupAgentSettingsParams,
130
+ type ClawchatOrchGetConnectCodeParams,
112
131
  } from "./tools-schema.ts";
113
132
 
114
133
  const MAX_UPLOAD_BYTES = 20 * 1024 * 1024;
@@ -324,6 +343,14 @@ export function registerOpenclawClawlingTools(
324
343
  return;
325
344
  }
326
345
 
346
+ // Every tool below registers through this wrapper so the debug summary at
347
+ // the end is derived from what was actually registered, not hand-maintained.
348
+ const registeredToolNames: string[] = [];
349
+ const registerTool: OpenClawPluginApi["registerTool"] = (tool, opts) => {
350
+ if (opts?.name) registeredToolNames.push(opts.name);
351
+ api.registerTool(tool, opts);
352
+ };
353
+
327
354
  // Re-resolve at call time so config reloads pick up new tokens / baseUrl.
328
355
  function resolveCurrent(accountId: string | null) {
329
356
  return resolveOpenclawClawlingAccount(api.config!, accountId);
@@ -548,7 +575,7 @@ export function registerOpenclawClawlingTools(
548
575
  }
549
576
 
550
577
  function registerMemoryTools(): void {
551
- api.registerTool(
578
+ registerTool(
552
579
  (ctx) => ({
553
580
  name: "clawchat_memory_search",
554
581
  label: "Search ClawChat Memory",
@@ -582,7 +609,7 @@ export function registerOpenclawClawlingTools(
582
609
  { name: "clawchat_memory_search" },
583
610
  );
584
611
 
585
- api.registerTool(
612
+ registerTool(
586
613
  (ctx) => ({
587
614
  name: "clawchat_memory_read",
588
615
  label: "Read ClawChat Memory",
@@ -635,7 +662,7 @@ export function registerOpenclawClawlingTools(
635
662
  { name: "clawchat_memory_read" },
636
663
  );
637
664
 
638
- api.registerTool(
665
+ registerTool(
639
666
  (ctx) => ({
640
667
  name: "clawchat_memory_write",
641
668
  label: "Write ClawChat Memory",
@@ -667,7 +694,7 @@ export function registerOpenclawClawlingTools(
667
694
  { name: "clawchat_memory_write" },
668
695
  );
669
696
 
670
- api.registerTool(
697
+ registerTool(
671
698
  (ctx) => ({
672
699
  name: "clawchat_memory_edit",
673
700
  label: "Edit ClawChat Memory",
@@ -699,7 +726,7 @@ export function registerOpenclawClawlingTools(
699
726
  { name: "clawchat_memory_edit" },
700
727
  );
701
728
 
702
- api.registerTool(
729
+ registerTool(
703
730
  (ctx) => {
704
731
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
705
732
  return {
@@ -783,7 +810,7 @@ export function registerOpenclawClawlingTools(
783
810
  { name: "clawchat_metadata_sync" },
784
811
  );
785
812
 
786
- api.registerTool(
813
+ registerTool(
787
814
  (ctx) => {
788
815
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
789
816
  return {
@@ -842,7 +869,7 @@ export function registerOpenclawClawlingTools(
842
869
 
843
870
  registerMemoryTools();
844
871
 
845
- api.registerTool(
872
+ registerTool(
846
873
  (ctx) => {
847
874
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
848
875
  return {
@@ -867,7 +894,7 @@ export function registerOpenclawClawlingTools(
867
894
  { name: "clawchat_get_account_profile" },
868
895
  );
869
896
 
870
- api.registerTool(
897
+ registerTool(
871
898
  (ctx) => {
872
899
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
873
900
  return {
@@ -893,7 +920,7 @@ export function registerOpenclawClawlingTools(
893
920
  { name: "clawchat_get_user_profile" },
894
921
  );
895
922
 
896
- api.registerTool(
923
+ registerTool(
897
924
  (ctx) => {
898
925
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
899
926
  return {
@@ -915,7 +942,7 @@ export function registerOpenclawClawlingTools(
915
942
  { name: "clawchat_list_account_friends" },
916
943
  );
917
944
 
918
- api.registerTool(
945
+ registerTool(
919
946
  (ctx) => {
920
947
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
921
948
  return {
@@ -938,7 +965,7 @@ export function registerOpenclawClawlingTools(
938
965
  { name: "clawchat_send_friend_request" },
939
966
  );
940
967
 
941
- api.registerTool(
968
+ registerTool(
942
969
  (ctx) => {
943
970
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
944
971
  return {
@@ -961,7 +988,7 @@ export function registerOpenclawClawlingTools(
961
988
  { name: "clawchat_list_friend_requests" },
962
989
  );
963
990
 
964
- api.registerTool(
991
+ registerTool(
965
992
  (ctx) => {
966
993
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
967
994
  return {
@@ -984,7 +1011,7 @@ export function registerOpenclawClawlingTools(
984
1011
  { name: "clawchat_accept_friend_request" },
985
1012
  );
986
1013
 
987
- api.registerTool(
1014
+ registerTool(
988
1015
  (ctx) => {
989
1016
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
990
1017
  return {
@@ -1007,7 +1034,7 @@ export function registerOpenclawClawlingTools(
1007
1034
  { name: "clawchat_reject_friend_request" },
1008
1035
  );
1009
1036
 
1010
- api.registerTool(
1037
+ registerTool(
1011
1038
  (ctx) => {
1012
1039
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1013
1040
  return {
@@ -1030,7 +1057,7 @@ export function registerOpenclawClawlingTools(
1030
1057
  { name: "clawchat_remove_friend" },
1031
1058
  );
1032
1059
 
1033
- api.registerTool(
1060
+ registerTool(
1034
1061
  (ctx) => {
1035
1062
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1036
1063
  return {
@@ -1059,7 +1086,7 @@ export function registerOpenclawClawlingTools(
1059
1086
  { name: "clawchat_search_users" },
1060
1087
  );
1061
1088
 
1062
- api.registerTool(
1089
+ registerTool(
1063
1090
  (ctx) => {
1064
1091
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1065
1092
  return {
@@ -1092,7 +1119,7 @@ export function registerOpenclawClawlingTools(
1092
1119
  { name: "clawchat_get_conversation" },
1093
1120
  );
1094
1121
 
1095
- api.registerTool(
1122
+ registerTool(
1096
1123
  (ctx) => {
1097
1124
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1098
1125
  return {
@@ -1127,7 +1154,7 @@ export function registerOpenclawClawlingTools(
1127
1154
  { name: "clawchat_get_direct_conversation" },
1128
1155
  );
1129
1156
 
1130
- api.registerTool(
1157
+ registerTool(
1131
1158
  (ctx) => {
1132
1159
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1133
1160
  return {
@@ -1162,7 +1189,7 @@ export function registerOpenclawClawlingTools(
1162
1189
  { name: "clawchat_leave_group" },
1163
1190
  );
1164
1191
 
1165
- api.registerTool(
1192
+ registerTool(
1166
1193
  (ctx) => {
1167
1194
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1168
1195
  return {
@@ -1197,7 +1224,7 @@ export function registerOpenclawClawlingTools(
1197
1224
  { name: "clawchat_add_group_member" },
1198
1225
  );
1199
1226
 
1200
- api.registerTool(
1227
+ registerTool(
1201
1228
  (ctx) => {
1202
1229
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1203
1230
  return {
@@ -1269,7 +1296,7 @@ export function registerOpenclawClawlingTools(
1269
1296
  { name: "clawchat_mention_message" },
1270
1297
  );
1271
1298
 
1272
- api.registerTool(
1299
+ registerTool(
1273
1300
  (ctx) => {
1274
1301
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1275
1302
  return {
@@ -1326,7 +1353,7 @@ export function registerOpenclawClawlingTools(
1326
1353
  { name: "clawchat_react_message" },
1327
1354
  );
1328
1355
 
1329
- api.registerTool(
1356
+ registerTool(
1330
1357
  (ctx) => {
1331
1358
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1332
1359
  return {
@@ -1354,7 +1381,7 @@ export function registerOpenclawClawlingTools(
1354
1381
  { name: "clawchat_list_moments" },
1355
1382
  );
1356
1383
 
1357
- api.registerTool(
1384
+ registerTool(
1358
1385
  (ctx) => {
1359
1386
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1360
1387
  return {
@@ -1375,7 +1402,7 @@ export function registerOpenclawClawlingTools(
1375
1402
  { name: "clawchat_get_moment" },
1376
1403
  );
1377
1404
 
1378
- api.registerTool(
1405
+ registerTool(
1379
1406
  (ctx) => {
1380
1407
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1381
1408
  return {
@@ -1408,7 +1435,7 @@ export function registerOpenclawClawlingTools(
1408
1435
  { name: "clawchat_create_moment" },
1409
1436
  );
1410
1437
 
1411
- api.registerTool(
1438
+ registerTool(
1412
1439
  (ctx) => {
1413
1440
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1414
1441
  return {
@@ -1431,7 +1458,7 @@ export function registerOpenclawClawlingTools(
1431
1458
  { name: "clawchat_delete_moment" },
1432
1459
  );
1433
1460
 
1434
- api.registerTool(
1461
+ registerTool(
1435
1462
  (ctx) => {
1436
1463
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1437
1464
  return {
@@ -1459,7 +1486,7 @@ export function registerOpenclawClawlingTools(
1459
1486
  { name: "clawchat_toggle_moment_reaction" },
1460
1487
  );
1461
1488
 
1462
- api.registerTool(
1489
+ registerTool(
1463
1490
  (ctx) => {
1464
1491
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1465
1492
  return {
@@ -1487,7 +1514,7 @@ export function registerOpenclawClawlingTools(
1487
1514
  { name: "clawchat_create_moment_comment" },
1488
1515
  );
1489
1516
 
1490
- api.registerTool(
1517
+ registerTool(
1491
1518
  (ctx) => {
1492
1519
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1493
1520
  return {
@@ -1519,7 +1546,7 @@ export function registerOpenclawClawlingTools(
1519
1546
  { name: "clawchat_reply_moment_comment" },
1520
1547
  );
1521
1548
 
1522
- api.registerTool(
1549
+ registerTool(
1523
1550
  (ctx) => {
1524
1551
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1525
1552
  return {
@@ -1544,7 +1571,7 @@ export function registerOpenclawClawlingTools(
1544
1571
  { name: "clawchat_delete_moment_comment" },
1545
1572
  );
1546
1573
 
1547
- api.registerTool(
1574
+ registerTool(
1548
1575
  (ctx) => {
1549
1576
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1550
1577
  return {
@@ -1587,7 +1614,7 @@ export function registerOpenclawClawlingTools(
1587
1614
  { name: "clawchat_update_account_profile" },
1588
1615
  );
1589
1616
 
1590
- api.registerTool(
1617
+ registerTool(
1591
1618
  (ctx) => {
1592
1619
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1593
1620
  return {
@@ -1632,7 +1659,7 @@ export function registerOpenclawClawlingTools(
1632
1659
  { name: "clawchat_upload_avatar_image" },
1633
1660
  );
1634
1661
 
1635
- api.registerTool(
1662
+ registerTool(
1636
1663
  (ctx) => {
1637
1664
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1638
1665
  return {
@@ -1654,7 +1681,7 @@ export function registerOpenclawClawlingTools(
1654
1681
  { name: "clawchat_register_app" },
1655
1682
  );
1656
1683
 
1657
- api.registerTool(
1684
+ registerTool(
1658
1685
  (ctx) => {
1659
1686
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1660
1687
  return {
@@ -1672,7 +1699,7 @@ export function registerOpenclawClawlingTools(
1672
1699
  { name: "clawchat_list_apps" },
1673
1700
  );
1674
1701
 
1675
- api.registerTool(
1702
+ registerTool(
1676
1703
  (ctx) => {
1677
1704
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1678
1705
  return {
@@ -1691,7 +1718,7 @@ export function registerOpenclawClawlingTools(
1691
1718
  { name: "clawchat_unregister_app" },
1692
1719
  );
1693
1720
 
1694
- api.registerTool(
1721
+ registerTool(
1695
1722
  (ctx) => {
1696
1723
  const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1697
1724
  return {
@@ -1762,7 +1789,330 @@ export function registerOpenclawClawlingTools(
1762
1789
  { name: "clawchat_liveware_login" },
1763
1790
  );
1764
1791
 
1792
+ // --- cloud orchestration (`agent.orchestrate`) ---------------------------
1793
+ // Twelve tools, 1:1 with docs/features/agentorch.md. Every response is HTTP
1794
+ // 200 with the business code in the envelope (a 21003 owner-approval
1795
+ // denial is the single most common outcome), so these use plain
1796
+ // `withClient` — never `withGatedClient` — and hand the caller the raw
1797
+ // envelope untouched. The shared orchestration skill text tells the model
1798
+ // to read `code` itself; rewriting the shape here would make the same
1799
+ // sentence behave differently than on the Hermes side.
1800
+
1801
+ registerTool(
1802
+ (ctx) => {
1803
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1804
+ return {
1805
+ name: "clawchat_orchestrate_list_agents",
1806
+ label: "List The Owner's Agents",
1807
+ description: toolDescription(
1808
+ "List every agent the owner owns, including this one (flagged is_self). " +
1809
+ "TRIGGER — invoke first whenever the owner asks about, or asks to change, one of their OTHER agents. " +
1810
+ "This is the only way to learn a sibling's agentId; never guess one from a nickname.",
1811
+ ),
1812
+ parameters: ClawchatOrchListAgentsSchema,
1813
+ async execute(_callId, params) {
1814
+ return await recordClawchatToolCall(accountId, "clawchat_orchestrate_list_agents", params, async () =>
1815
+ withClient(accountId, (c) => c.orchListAgents()),
1816
+ );
1817
+ },
1818
+ };
1819
+ },
1820
+ { name: "clawchat_orchestrate_list_agents" },
1821
+ );
1822
+
1823
+ registerTool(
1824
+ (ctx) => {
1825
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1826
+ return {
1827
+ name: "clawchat_orchestrate_get_agent",
1828
+ label: "Get A Sibling Agent",
1829
+ description: toolDescription(
1830
+ "Read one of the owner's agents by explicit agentId, including its read-only permission map. " +
1831
+ "TRIGGER — invoke before rewriting a sibling's system prompt (the PATCH replaces the whole field, so read it first), " +
1832
+ "or to explain why a sibling cannot do something instead of retrying on its behalf.",
1833
+ ),
1834
+ parameters: ClawchatOrchGetAgentSchema,
1835
+ async execute(_callId, params) {
1836
+ return await recordClawchatToolCall(accountId, "clawchat_orchestrate_get_agent", params, async () => {
1837
+ const p = params as ClawchatOrchGetAgentParams;
1838
+ return await withClient(accountId, (c) => c.orchGetAgent(p.agentId));
1839
+ });
1840
+ },
1841
+ };
1842
+ },
1843
+ { name: "clawchat_orchestrate_get_agent" },
1844
+ );
1845
+
1846
+ registerTool(
1847
+ (ctx) => {
1848
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1849
+ return {
1850
+ name: "clawchat_orchestrate_set_agent_behavior",
1851
+ label: "Rewrite A Sibling's System Prompt",
1852
+ description: toolDescription(
1853
+ "Replace the WHOLE system prompt (behavior) of one of the owner's other agents. " +
1854
+ "TRIGGER — invoke when the owner asks to change how another agent behaves, talks, or what it is for. " +
1855
+ "This REPLACES the entire field — call clawchat_orchestrate_get_agent first, edit the text you got back, and send the full new value. " +
1856
+ "Sending a fragment deletes everything else and the owner cannot recover it. Max 3000 runes. " +
1857
+ "Nickname and bio cannot be changed here.",
1858
+ ),
1859
+ parameters: ClawchatOrchSetAgentBehaviorSchema,
1860
+ async execute(_callId, params) {
1861
+ return await recordClawchatToolCall(
1862
+ accountId,
1863
+ "clawchat_orchestrate_set_agent_behavior",
1864
+ params,
1865
+ async () => {
1866
+ const p = params as ClawchatOrchSetAgentBehaviorParams;
1867
+ return await withClient(accountId, (c) => c.orchSetAgentBehavior(p.agentId, p.behavior));
1868
+ },
1869
+ );
1870
+ },
1871
+ };
1872
+ },
1873
+ { name: "clawchat_orchestrate_set_agent_behavior" },
1874
+ );
1875
+
1876
+ registerTool(
1877
+ (ctx) => {
1878
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1879
+ return {
1880
+ name: "clawchat_orchestrate_list_groups",
1881
+ label: "List Manageable Groups",
1882
+ description: toolDescription(
1883
+ "List the groups the owner can administer. " +
1884
+ "TRIGGER — invoke when the owner talks about a group of their agents without naming a conversation id.",
1885
+ ),
1886
+ parameters: ClawchatOrchListGroupsSchema,
1887
+ async execute(_callId, params) {
1888
+ return await recordClawchatToolCall(accountId, "clawchat_orchestrate_list_groups", params, async () =>
1889
+ withClient(accountId, (c) => c.orchListGroups()),
1890
+ );
1891
+ },
1892
+ };
1893
+ },
1894
+ { name: "clawchat_orchestrate_list_groups" },
1895
+ );
1896
+
1897
+ registerTool(
1898
+ (ctx) => {
1899
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1900
+ return {
1901
+ name: "clawchat_orchestrate_get_group",
1902
+ label: "Get A Managed Group",
1903
+ description: toolDescription(
1904
+ "Read one group by explicit conversationId, including its system prompt and member agent ids. " +
1905
+ "TRIGGER — invoke before rewriting a group prompt, and after any write, to report what the server now says.",
1906
+ ),
1907
+ parameters: ClawchatOrchGetGroupSchema,
1908
+ async execute(_callId, params) {
1909
+ return await recordClawchatToolCall(accountId, "clawchat_orchestrate_get_group", params, async () => {
1910
+ const p = params as ClawchatOrchGetGroupParams;
1911
+ return await withClient(accountId, (c) => c.orchGetGroup(p.conversationId));
1912
+ });
1913
+ },
1914
+ };
1915
+ },
1916
+ { name: "clawchat_orchestrate_get_group" },
1917
+ );
1918
+
1919
+ registerTool(
1920
+ (ctx) => {
1921
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1922
+ return {
1923
+ name: "clawchat_orchestrate_set_group_prompt",
1924
+ label: "Rewrite A Group's System Prompt",
1925
+ description: toolDescription(
1926
+ "Replace the WHOLE system prompt (description) of a group the owner administers. " +
1927
+ "TRIGGER — invoke when the owner asks to change how a group behaves as a whole. " +
1928
+ "This REPLACES the entire field — call clawchat_orchestrate_get_group first and send the full new value. " +
1929
+ "Sending a fragment deletes everything else and the owner cannot recover it. Max 3000 runes. " +
1930
+ "The group title cannot be changed here.",
1931
+ ),
1932
+ parameters: ClawchatOrchSetGroupPromptSchema,
1933
+ async execute(_callId, params) {
1934
+ return await recordClawchatToolCall(
1935
+ accountId,
1936
+ "clawchat_orchestrate_set_group_prompt",
1937
+ params,
1938
+ async () => {
1939
+ const p = params as ClawchatOrchSetGroupPromptParams;
1940
+ return await withClient(accountId, (c) => c.orchSetGroupPrompt(p.conversationId, p.description));
1941
+ },
1942
+ );
1943
+ },
1944
+ };
1945
+ },
1946
+ { name: "clawchat_orchestrate_set_group_prompt" },
1947
+ );
1948
+
1949
+ registerTool(
1950
+ (ctx) => {
1951
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1952
+ return {
1953
+ name: "clawchat_orchestrate_create_group",
1954
+ label: "Create A Group Of The Owner's Agents",
1955
+ description: toolDescription(
1956
+ "Create a new group containing the owner's own agents. " +
1957
+ "TRIGGER — invoke when the owner asks to put several of their agents in a group together.",
1958
+ ),
1959
+ parameters: ClawchatOrchCreateGroupSchema,
1960
+ async execute(_callId, params) {
1961
+ return await recordClawchatToolCall(accountId, "clawchat_orchestrate_create_group", params, async () => {
1962
+ const p = params as ClawchatOrchCreateGroupParams;
1963
+ return await withClient(accountId, (c) => c.orchCreateGroup(p.title, p.agentIds));
1964
+ });
1965
+ },
1966
+ };
1967
+ },
1968
+ { name: "clawchat_orchestrate_create_group" },
1969
+ );
1970
+
1971
+ registerTool(
1972
+ (ctx) => {
1973
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
1974
+ return {
1975
+ name: "clawchat_orchestrate_add_group_member",
1976
+ label: "Add An Agent To A Group",
1977
+ description: toolDescription(
1978
+ "Add one of the owner's agents to a group the owner administers. " +
1979
+ "TRIGGER — invoke when the owner asks to bring another of their agents into an existing group. " +
1980
+ "You cannot add yourself; that is rejected outright.",
1981
+ ),
1982
+ parameters: ClawchatOrchGroupMemberSchema,
1983
+ async execute(_callId, params) {
1984
+ return await recordClawchatToolCall(
1985
+ accountId,
1986
+ "clawchat_orchestrate_add_group_member",
1987
+ params,
1988
+ async () => {
1989
+ const p = params as ClawchatOrchGroupMemberParams;
1990
+ return await withClient(accountId, (c) => c.orchAddGroupMember(p.conversationId, p.agentId));
1991
+ },
1992
+ );
1993
+ },
1994
+ };
1995
+ },
1996
+ { name: "clawchat_orchestrate_add_group_member" },
1997
+ );
1998
+
1999
+ registerTool(
2000
+ (ctx) => {
2001
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
2002
+ return {
2003
+ name: "clawchat_orchestrate_remove_group_member",
2004
+ label: "Remove An Agent From A Group",
2005
+ description: toolDescription(
2006
+ "Remove one of the owner's agents from a group the owner administers. " +
2007
+ "TRIGGER — invoke when the owner asks to take an agent out of a group.",
2008
+ ),
2009
+ parameters: ClawchatOrchGroupMemberSchema,
2010
+ async execute(_callId, params) {
2011
+ return await recordClawchatToolCall(
2012
+ accountId,
2013
+ "clawchat_orchestrate_remove_group_member",
2014
+ params,
2015
+ async () => {
2016
+ const p = params as ClawchatOrchGroupMemberParams;
2017
+ return await withClient(accountId, (c) => c.orchRemoveGroupMember(p.conversationId, p.agentId));
2018
+ },
2019
+ );
2020
+ },
2021
+ };
2022
+ },
2023
+ { name: "clawchat_orchestrate_remove_group_member" },
2024
+ );
2025
+
2026
+ registerTool(
2027
+ (ctx) => {
2028
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
2029
+ return {
2030
+ name: "clawchat_orchestrate_set_group_agent_settings",
2031
+ label: "Set An Agent's Speaking Settings In A Group",
2032
+ description: toolDescription(
2033
+ "Set how one agent speaks inside one group: muted, reply mode, and batching delay. " +
2034
+ "TRIGGER — invoke FIRST when a group is flooding, echoing, or an agent will not stop. " +
2035
+ "These are the hard controls; a rule written into a prompt stops working after compaction or a restart, so pair every soft rule with one of these. " +
2036
+ "Omitted fields are left unchanged.",
2037
+ ),
2038
+ parameters: ClawchatOrchSetGroupAgentSettingsSchema,
2039
+ async execute(_callId, params) {
2040
+ return await recordClawchatToolCall(
2041
+ accountId,
2042
+ "clawchat_orchestrate_set_group_agent_settings",
2043
+ params,
2044
+ async () => {
2045
+ const p = params as ClawchatOrchSetGroupAgentSettingsParams;
2046
+ return await withClient(accountId, (c) =>
2047
+ c.orchSetGroupAgentSettings(p.conversationId, p.agentId, {
2048
+ muted: p.muted,
2049
+ replyMode: p.replyMode,
2050
+ batchDelaySeconds: p.batchDelaySeconds,
2051
+ }),
2052
+ );
2053
+ },
2054
+ );
2055
+ },
2056
+ };
2057
+ },
2058
+ { name: "clawchat_orchestrate_set_group_agent_settings" },
2059
+ );
2060
+
2061
+ registerTool(
2062
+ (ctx) => {
2063
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
2064
+ return {
2065
+ name: "clawchat_orchestrate_create_connect_code",
2066
+ label: "Issue A Connect Code",
2067
+ description: toolDescription(
2068
+ "Mint a connect code on the owner's behalf, valid 30 minutes. " +
2069
+ "TRIGGER — invoke when the owner asks for a code to connect a new agent. " +
2070
+ "The rate limit bucket belongs to the owner and is shared with their own manual issuance, so do not retry on a limit.",
2071
+ ),
2072
+ parameters: ClawchatOrchCreateConnectCodeSchema,
2073
+ async execute(_callId, params) {
2074
+ return await recordClawchatToolCall(
2075
+ accountId,
2076
+ "clawchat_orchestrate_create_connect_code",
2077
+ params,
2078
+ async () => withClient(accountId, (c) => c.orchCreateConnectCode()),
2079
+ );
2080
+ },
2081
+ };
2082
+ },
2083
+ { name: "clawchat_orchestrate_create_connect_code" },
2084
+ );
2085
+
2086
+ registerTool(
2087
+ (ctx) => {
2088
+ const accountId = resolveOpenclawClawlingToolAccountId(ctx);
2089
+ return {
2090
+ name: "clawchat_orchestrate_get_connect_code",
2091
+ label: "Read A Connect Code's Status",
2092
+ description: toolDescription(
2093
+ "Read the status of a connect code the owner minted. " +
2094
+ "TRIGGER — invoke when the owner asks whether a code was used or has expired.",
2095
+ ),
2096
+ parameters: ClawchatOrchGetConnectCodeSchema,
2097
+ async execute(_callId, params) {
2098
+ return await recordClawchatToolCall(
2099
+ accountId,
2100
+ "clawchat_orchestrate_get_connect_code",
2101
+ params,
2102
+ async () => {
2103
+ const p = params as ClawchatOrchGetConnectCodeParams;
2104
+ return await withClient(accountId, (c) => c.orchGetConnectCode(p.code));
2105
+ },
2106
+ );
2107
+ },
2108
+ };
2109
+ },
2110
+ { name: "clawchat_orchestrate_get_connect_code" },
2111
+ );
2112
+
1765
2113
  api.logger.debug?.(
1766
- "clawchat-plugin-openclaw: registered 31 clawchat_* tools (get_account_profile, get_user_profile, list_account_friends, send_friend_request, list_friend_requests, accept_friend_request, reject_friend_request, remove_friend, search_users, get_conversation, mention_message, list_moments, get_moment, create_moment, delete_moment, toggle_moment_reaction, create_moment_comment, reply_moment_comment, delete_moment_comment, update_account_profile, upload_avatar_image, memory_search, memory_read, memory_write, memory_edit, metadata_sync, metadata_update, register_app, list_apps, unregister_app, liveware_login)",
2114
+ `clawchat-plugin-openclaw: registered ${registeredToolNames.length} clawchat_* tools (${registeredToolNames
2115
+ .map((name) => name.replace(/^clawchat_/, ""))
2116
+ .join(", ")})`,
1767
2117
  );
1768
2118
  }